2.5
authorTon Roosendaal <ton@blender.org>
Tue, 16 Dec 2008 13:19:02 +0000 (13:19 +0000)
committerTon Roosendaal <ton@blender.org>
Tue, 16 Dec 2008 13:19:02 +0000 (13:19 +0000)
More notifier cleanup;

- removed view2d sync notifier, its data operations are too complex
  for UI hints/notes, direct calls work too :)
- updated missing gpl header in region file

Noticed weird delay on menu refreshing now... will check.

source/blender/editors/include/UI_view2d.h
source/blender/editors/interface/interface.c
source/blender/editors/interface/interface_handlers.c
source/blender/editors/interface/interface_icons.c
source/blender/editors/interface/interface_regions.c
source/blender/editors/interface/view2d.c
source/blender/editors/interface/view2d_ops.c
source/blender/editors/space_time/space_time.c
source/blender/editors/space_time/time_header.c
source/blender/windowmanager/WM_types.h
source/blender/windowmanager/intern/wm_operators.c

index a60b827c44c7b223ebcc7165b6c31a2ff8932db5..af517b798dea370646cd3be423090acaadd636e6 100644 (file)
@@ -122,6 +122,7 @@ struct View2DGrid;
 struct View2DScrollers;
 
 struct wmWindowManager;
+struct bScreen;
 struct bContext;
 
 typedef struct View2DGrid View2DGrid;
@@ -162,7 +163,7 @@ void UI_view2d_to_region_no_clip(struct View2D *v2d, float x, float y, short *re
 struct View2D *UI_view2d_fromcontext(const struct bContext *C);
 struct View2D *UI_view2d_fromcontext_rwin(const struct bContext *C);
 void UI_view2d_getscale(struct View2D *v2d, float *x, float *y);
-void UI_view2d_sync(struct View2D *v2d, struct View2D *v2dfrom, int flag);
+void UI_view2d_sync(struct bScreen *screen, struct View2D *v2dcur, int flag);
 
 /* operators */
 void ui_view2d_operatortypes(void);
index e0575c1d9a833b174bd6ee58897d00b26bffa579..afb10a1bb26d59872f8e0f71dba2fd11baccd2b9 100644 (file)
@@ -20,9 +20,7 @@
  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
  * All rights reserved.
  *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
+ * Contributor(s): Blender Foundation 2002-2008, full recode.
  *
  * ***** END GPL LICENSE BLOCK *****
  */
index 2e44fedc66aca682e9a7df6bad62c101e0737a96..e8a952718972368ba7e17026729b2c9564b69307 100644 (file)
@@ -1,6 +1,4 @@
 /**
- * $Id$
- *
  * ***** BEGIN GPL LICENSE BLOCK *****
  *
  * This program is free software; you can redistribute it and/or
index 2b22e47b5bf9acea28e4cbd18b6169fe9b69cd0c..5e0c78ebf359a86b8b3a5289a90f3bfe5f17f2ea 100644 (file)
@@ -20,9 +20,7 @@
  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
  * All rights reserved.
  *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
+ * Contributors: Blender Foundation, full recode
  *
  * ***** END GPL LICENSE BLOCK *****
  */
index b1f70ddebd2e156b63778edb1108727f917c0b97..0c298b62070cae5c43fc66a46122bcbafb0846f6 100644 (file)
@@ -1,3 +1,28 @@
+/**
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. 
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2008 Blender Foundation.
+ * All rights reserved.
+ * 
+ * Contributor(s): Blender Foundation
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
 
 #include <stdarg.h>
 #include <stdlib.h>
index 7798f3535ad9aa96a615ddacb1575f98897a4dec..605ae4bb23cefbce874aaa10141364a7e60a6da9 100644 (file)
@@ -1526,17 +1526,32 @@ void UI_view2d_getscale(View2D *v2d, float *x, float *y)
        if (y) *y = (v2d->mask.ymax - v2d->mask.ymin) / (v2d->cur.ymax - v2d->cur.ymin);
 }
 
-/* called by notifier WM_NOTE_TIMELINE_SYNC */
-void UI_view2d_sync(View2D *v2d, View2D *v2dfrom, int flag)
+/* called by menus to activate it, or by view2d operators */
+void UI_view2d_sync(bScreen *screen, View2D *v2dcur, int flag)
 {
+       ScrArea *sa;
+       ARegion *ar;
        
-       if(flag == V2D_LOCK_COPY) {
-               v2d->cur.xmin= v2dfrom->cur.xmin;
-               v2d->cur.xmax= v2dfrom->cur.xmax;
-       }
-       else {
-               v2dfrom->cur.xmin= v2d->cur.xmin;
-               v2dfrom->cur.xmax= v2d->cur.xmax;
+       if(!(v2dcur->flag & V2D_VIEWSYNC_X))
+               return;
+       
+       for(sa= screen->areabase.first; sa; sa= sa->next) {
+               for(ar= sa->regionbase.first; ar; ar= ar->next) {
+                       if(v2dcur != &ar->v2d) {
+                               if(ar->v2d.flag & V2D_VIEWSYNC_X) {
+                                       if(flag == V2D_LOCK_COPY) {
+                                               
+                                               ar->v2d.cur.xmin= v2dcur->cur.xmin;
+                                               ar->v2d.cur.xmax= v2dcur->cur.xmax;
+                                       }
+                                       else { /* V2D_LOCK_SET */
+                                               v2dcur->cur.xmin= ar->v2d.cur.xmin;
+                                               v2dcur->cur.xmax= ar->v2d.cur.xmax;
+                                       }
+                                       ED_region_tag_redraw(ar);
+                               }
+                       }
+               }
        }
 }
 
index da3a412c1470a56fca3cc46da31e80e6f134b27d..abf114e8fd9015196b38f4e2baf7a4b73cd6f2a1 100644 (file)
@@ -167,8 +167,7 @@ static void view_pan_apply(bContext *C, wmOperator *op)
        
        /* request updates to be done... */
        ED_area_tag_redraw(C->area);
-       if(v2d->flag & V2D_VIEWSYNC_X)
-               WM_event_add_notifier(C, WM_NOTE_TIMELINE_SYNC, V2D_LOCK_COPY, v2d);
+       UI_view2d_sync(C->screen, v2d, V2D_LOCK_COPY);
 }
 
 /* cleanup temp customdata  */
@@ -496,8 +495,7 @@ static void view_zoomstep_apply(bContext *C, wmOperator *op)
        
        /* request updates to be done... */
        ED_area_tag_redraw(C->area);
-       if(v2d->flag & V2D_VIEWSYNC_X)
-               WM_event_add_notifier(C, WM_NOTE_TIMELINE_SYNC, V2D_LOCK_COPY, v2d);
+       UI_view2d_sync(C->screen, v2d, V2D_LOCK_COPY);
 }
 
 /* --------------- Individual Operators ------------------- */
@@ -649,8 +647,7 @@ static void view_zoomdrag_apply(bContext *C, wmOperator *op)
        
        /* request updates to be done... */
        ED_area_tag_redraw(C->area);
-       if(v2d->flag & V2D_VIEWSYNC_X)
-               WM_event_add_notifier(C, WM_NOTE_TIMELINE_SYNC, V2D_LOCK_COPY, v2d);
+       UI_view2d_sync(C->screen, v2d, V2D_LOCK_COPY);
 }
 
 /* cleanup temp customdata  */
@@ -1030,8 +1027,7 @@ static void scroller_activate_apply(bContext *C, wmOperator *op)
        
        /* request updates to be done... */
        ED_area_tag_redraw(C->area);
-       if(v2d->flag & V2D_VIEWSYNC_X)
-               WM_event_add_notifier(C, WM_NOTE_TIMELINE_SYNC, V2D_LOCK_COPY, v2d);
+       UI_view2d_sync(C->screen, v2d, V2D_LOCK_COPY);
 }
 
 /* handle user input for scrollers - calculations of mouse-movement need to be done here, not in the apply callback! */
index 417ddb0937374b0f20098908ce4db727daf47de9..c5d5c088d7e3fcbd4cf85e4d8f5e4e955202db5a 100644 (file)
@@ -164,12 +164,6 @@ static void time_main_area_listener(ARegion *ar, wmNotifier *wmn)
        /* context changes */
        
        switch(wmn->type) {
-               case WM_NOTE_TIMELINE_SYNC:
-                       if(ar->v2d.flag & V2D_VIEWSYNC_X) {
-                               ED_region_tag_redraw(ar);
-                               UI_view2d_sync(&ar->v2d, wmn->data, wmn->value);
-                       }
-                       break;
        }
 }
 
index 65203cb7421a61f175c528a9d93a7f642390c7a9..cc8ac6d1e7325e0248e5d1fc0337d312b1ccf857 100644 (file)
@@ -20,8 +20,9 @@
  * The Original Code is Copyright (C) 2008 Blender Foundation.
  * All rights reserved.
  *
- * 
- * Contributor(s): Blender Foundation
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
  *
  * ***** END GPL LICENSE BLOCK *****
  */
@@ -190,8 +191,7 @@ static void do_time_viewmenu(bContext *C, void *arg, int event)
                case 11:
                        if(v2d) {
                                v2d->flag ^= V2D_VIEWSYNC_X;
-                               if(v2d->flag & V2D_VIEWSYNC_X)
-                                       WM_event_add_notifier(C, WM_NOTE_TIMELINE_SYNC, V2D_LOCK_SET, v2d);
+                               UI_view2d_sync(C->screen, v2d, V2D_LOCK_SET);
                        }
                        break;
                case 12: /* only show keyframes from selected data */
index 7f7f7aac32fcadf176098a9ae19c1230f15f8161..5a148ef9a4fea2a2822d638d610e96d9ca6849f9 100644 (file)
@@ -122,8 +122,6 @@ enum {
        WM_NOTE_SCREEN_CHANGED,
        WM_NOTE_GESTURE_REDRAW,
        
-       WM_NOTE_TIMELINE_SYNC,
-       
        WM_NOTE_OBJECT_CHANGED,
        
        WM_NOTE_LAST
index 1cd903e7cf32487c3bf0e959f7b3ff66f69c9be0..a7b542896161ca61df0e1a8117888cd9a15a6d53 100644 (file)
@@ -56,6 +56,8 @@
 #include "wm_subwindow.h"
 #include "wm_event_system.h"
 
+#include "ED_screen.h"
+
 static ListBase global_ops= {NULL, NULL};
 
 /* ************ operator API, exported ********** */