2.5
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:
@@ -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);
|
||||
|
||||
@@ -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 *****
|
||||
*/
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
/**
|
||||
* $Id$
|
||||
*
|
||||
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
||||
@@ -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 *****
|
||||
*/
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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! */
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -122,8 +122,6 @@ enum {
|
||||
WM_NOTE_SCREEN_CHANGED,
|
||||
WM_NOTE_GESTURE_REDRAW,
|
||||
|
||||
WM_NOTE_TIMELINE_SYNC,
|
||||
|
||||
WM_NOTE_OBJECT_CHANGED,
|
||||
|
||||
WM_NOTE_LAST
|
||||
|
||||
@@ -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 ********** */
|
||||
|
||||
Reference in New Issue
Block a user