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.
This commit is contained in:
2008-12-16 13:19:02 +00:00
parent 6fe19cfc85
commit 626e5c8b42
11 changed files with 63 additions and 38 deletions

View File

@@ -122,6 +122,7 @@ struct View2DGrid;
struct View2DScrollers; struct View2DScrollers;
struct wmWindowManager; struct wmWindowManager;
struct bScreen;
struct bContext; struct bContext;
typedef struct View2DGrid View2DGrid; 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(const struct bContext *C);
struct View2D *UI_view2d_fromcontext_rwin(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_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 */ /* operators */
void ui_view2d_operatortypes(void); void ui_view2d_operatortypes(void);

View File

@@ -20,9 +20,7 @@
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved. * All rights reserved.
* *
* The Original Code is: all of this file. * Contributor(s): Blender Foundation 2002-2008, full recode.
*
* Contributor(s): none yet.
* *
* ***** END GPL LICENSE BLOCK ***** * ***** END GPL LICENSE BLOCK *****
*/ */

View File

@@ -1,6 +1,4 @@
/** /**
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK ***** * ***** BEGIN GPL LICENSE BLOCK *****
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or

View File

@@ -20,9 +20,7 @@
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved. * All rights reserved.
* *
* The Original Code is: all of this file. * Contributors: Blender Foundation, full recode
*
* Contributor(s): none yet.
* *
* ***** END GPL LICENSE BLOCK ***** * ***** END GPL LICENSE BLOCK *****
*/ */

View 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 <stdarg.h>
#include <stdlib.h> #include <stdlib.h>

View 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); if (y) *y = (v2d->mask.ymax - v2d->mask.ymin) / (v2d->cur.ymax - v2d->cur.ymin);
} }
/* called by notifier WM_NOTE_TIMELINE_SYNC */ /* called by menus to activate it, or by view2d operators */
void UI_view2d_sync(View2D *v2d, View2D *v2dfrom, int flag) void UI_view2d_sync(bScreen *screen, View2D *v2dcur, int flag)
{ {
ScrArea *sa;
ARegion *ar;
if(flag == V2D_LOCK_COPY) { if(!(v2dcur->flag & V2D_VIEWSYNC_X))
v2d->cur.xmin= v2dfrom->cur.xmin; return;
v2d->cur.xmax= v2dfrom->cur.xmax;
} for(sa= screen->areabase.first; sa; sa= sa->next) {
else { for(ar= sa->regionbase.first; ar; ar= ar->next) {
v2dfrom->cur.xmin= v2d->cur.xmin; if(v2dcur != &ar->v2d) {
v2dfrom->cur.xmax= v2d->cur.xmax; 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);
}
}
}
} }
} }

View File

@@ -167,8 +167,7 @@ static void view_pan_apply(bContext *C, wmOperator *op)
/* request updates to be done... */ /* request updates to be done... */
ED_area_tag_redraw(C->area); ED_area_tag_redraw(C->area);
if(v2d->flag & V2D_VIEWSYNC_X) UI_view2d_sync(C->screen, v2d, V2D_LOCK_COPY);
WM_event_add_notifier(C, WM_NOTE_TIMELINE_SYNC, V2D_LOCK_COPY, v2d);
} }
/* cleanup temp customdata */ /* cleanup temp customdata */
@@ -496,8 +495,7 @@ static void view_zoomstep_apply(bContext *C, wmOperator *op)
/* request updates to be done... */ /* request updates to be done... */
ED_area_tag_redraw(C->area); ED_area_tag_redraw(C->area);
if(v2d->flag & V2D_VIEWSYNC_X) UI_view2d_sync(C->screen, v2d, V2D_LOCK_COPY);
WM_event_add_notifier(C, WM_NOTE_TIMELINE_SYNC, V2D_LOCK_COPY, v2d);
} }
/* --------------- Individual Operators ------------------- */ /* --------------- Individual Operators ------------------- */
@@ -649,8 +647,7 @@ static void view_zoomdrag_apply(bContext *C, wmOperator *op)
/* request updates to be done... */ /* request updates to be done... */
ED_area_tag_redraw(C->area); ED_area_tag_redraw(C->area);
if(v2d->flag & V2D_VIEWSYNC_X) UI_view2d_sync(C->screen, v2d, V2D_LOCK_COPY);
WM_event_add_notifier(C, WM_NOTE_TIMELINE_SYNC, V2D_LOCK_COPY, v2d);
} }
/* cleanup temp customdata */ /* cleanup temp customdata */
@@ -1030,8 +1027,7 @@ static void scroller_activate_apply(bContext *C, wmOperator *op)
/* request updates to be done... */ /* request updates to be done... */
ED_area_tag_redraw(C->area); ED_area_tag_redraw(C->area);
if(v2d->flag & V2D_VIEWSYNC_X) UI_view2d_sync(C->screen, v2d, V2D_LOCK_COPY);
WM_event_add_notifier(C, WM_NOTE_TIMELINE_SYNC, V2D_LOCK_COPY, v2d);
} }
/* handle user input for scrollers - calculations of mouse-movement need to be done here, not in the apply callback! */ /* handle user input for scrollers - calculations of mouse-movement need to be done here, not in the apply callback! */

View File

@@ -164,12 +164,6 @@ static void time_main_area_listener(ARegion *ar, wmNotifier *wmn)
/* context changes */ /* context changes */
switch(wmn->type) { 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;
} }
} }

View File

@@ -20,8 +20,9 @@
* The Original Code is Copyright (C) 2008 Blender Foundation. * The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved. * All rights reserved.
* *
* * The Original Code is: all of this file.
* Contributor(s): Blender Foundation *
* Contributor(s): none yet.
* *
* ***** END GPL LICENSE BLOCK ***** * ***** END GPL LICENSE BLOCK *****
*/ */
@@ -190,8 +191,7 @@ static void do_time_viewmenu(bContext *C, void *arg, int event)
case 11: case 11:
if(v2d) { if(v2d) {
v2d->flag ^= V2D_VIEWSYNC_X; v2d->flag ^= V2D_VIEWSYNC_X;
if(v2d->flag & V2D_VIEWSYNC_X) UI_view2d_sync(C->screen, v2d, V2D_LOCK_SET);
WM_event_add_notifier(C, WM_NOTE_TIMELINE_SYNC, V2D_LOCK_SET, v2d);
} }
break; break;
case 12: /* only show keyframes from selected data */ case 12: /* only show keyframes from selected data */

View File

@@ -122,8 +122,6 @@ enum {
WM_NOTE_SCREEN_CHANGED, WM_NOTE_SCREEN_CHANGED,
WM_NOTE_GESTURE_REDRAW, WM_NOTE_GESTURE_REDRAW,
WM_NOTE_TIMELINE_SYNC,
WM_NOTE_OBJECT_CHANGED, WM_NOTE_OBJECT_CHANGED,
WM_NOTE_LAST WM_NOTE_LAST

View File

@@ -56,6 +56,8 @@
#include "wm_subwindow.h" #include "wm_subwindow.h"
#include "wm_event_system.h" #include "wm_event_system.h"
#include "ED_screen.h"
static ListBase global_ops= {NULL, NULL}; static ListBase global_ops= {NULL, NULL};
/* ************ operator API, exported ********** */ /* ************ operator API, exported ********** */