struct View2DScrollers;
struct wmWindowManager;
+struct bScreen;
struct bContext;
typedef struct View2DGrid View2DGrid;
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);
* 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 *****
*/
/**
- * $Id$
- *
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* 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 *****
*/
+/**
+ * ***** 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>
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);
+ }
+ }
+ }
}
}
/* 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 */
/* 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 ------------------- */
/* 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 */
/* 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! */
/* 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;
}
}
* 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 *****
*/
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 */
WM_NOTE_SCREEN_CHANGED,
WM_NOTE_GESTURE_REDRAW,
- WM_NOTE_TIMELINE_SYNC,
-
WM_NOTE_OBJECT_CHANGED,
WM_NOTE_LAST
#include "wm_subwindow.h"
#include "wm_event_system.h"
+#include "ED_screen.h"
+
static ListBase global_ops= {NULL, NULL};
/* ************ operator API, exported ********** */