Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorTon Roosendaal <ton@blender.org>2008-12-16 21:42:12 +0300
committerTon Roosendaal <ton@blender.org>2008-12-16 21:42:12 +0300
commit962870b2358775ebef96198da4efe61a4224b526 (patch)
tree00e43e1188b7ec826e2a70232bc48852f11f4204 /source
parente34528e1a659996a0efc95353b99cb662fc1e1f5 (diff)
2.5
More notifier and redraw cleanup - notifiers are not filtered anymore, apart from window/screen notifiers, they get to all regions. - fixed drawing of 'action zones' in areas. - added support for basic multilayer draw, like for action zones now, and future other area decorations (tabs, region handlers) check: ED_area_overdraw_flush() ED_area_overdraw() - bugfix in UI redraw tags, it was calling region pointer in free'd data - added notifier for marker-changed - added keymap for markers to ipo window
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/include/ED_screen.h4
-rw-r--r--source/blender/editors/include/ED_screen_types.h5
-rw-r--r--source/blender/editors/interface/interface_handlers.c6
-rw-r--r--source/blender/editors/screen/area.c68
-rw-r--r--source/blender/editors/screen/glutil.c3
-rw-r--r--source/blender/editors/space_ipo/space_ipo.c8
-rw-r--r--source/blender/editors/space_time/ed_markers.c22
-rw-r--r--source/blender/editors/space_time/space_time.c5
-rw-r--r--source/blender/editors/space_time/time_ops.c2
-rw-r--r--source/blender/windowmanager/WM_types.h3
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c75
11 files changed, 117 insertions, 84 deletions
diff --git a/source/blender/editors/include/ED_screen.h b/source/blender/editors/include/ED_screen.h
index 3028a1f0ad6..7b4dd41e4a8 100644
--- a/source/blender/editors/include/ED_screen.h
+++ b/source/blender/editors/include/ED_screen.h
@@ -54,11 +54,13 @@ void ED_spacetypes_init(void);
void ED_spacetypes_keymap(struct wmWindowManager *wm);
struct ARegionType *ED_regiontype_from_id(struct SpaceType *st, int regionid);
int ED_area_header_standardbuttons(const bContext *C, struct uiBlock *block, int yco);
+void ED_area_overdraw(struct bContext *C);
+void ED_area_overdraw_flush(struct bContext *C);
+
/* areas */
void ED_area_initialize(struct wmWindowManager *wm, struct wmWindow *win, struct ScrArea *sa);
void ED_area_exit(struct bContext *C, struct ScrArea *sa);
-void ED_area_do_draw(struct bContext *C, struct ScrArea *sa);
int ED_screen_area_active(const struct bContext *C);
void ED_area_tag_redraw(ScrArea *sa);
diff --git a/source/blender/editors/include/ED_screen_types.h b/source/blender/editors/include/ED_screen_types.h
index 29e62d51f7d..7910351f318 100644
--- a/source/blender/editors/include/ED_screen_types.h
+++ b/source/blender/editors/include/ED_screen_types.h
@@ -32,7 +32,8 @@
typedef struct AZone {
struct AZone *next, *prev;
int type;
- int flag;
+ short flag;
+ short do_draw;
int pos;
short x1, y1, x2, y2;
} AZone;
@@ -41,6 +42,8 @@ typedef struct AZone {
#define AZONE_TRI 1
#define AZONE_QUAD 2
+/* actionzone flag */
+
/* actionzone pos */
#define AZONE_S 1
#define AZONE_SW 2
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index 6de197f5cac..761e0ff0712 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -2880,14 +2880,14 @@ static void button_activate_exit(bContext *C, uiHandleButtonData *data, uiBut *b
if(data->origstr)
MEM_freeN(data->origstr);
+ /* redraw (data is but->active!) */
+ ED_region_tag_redraw(data->region);
+
/* clean up button */
MEM_freeN(but->active);
but->active= NULL;
but->flag &= ~(UI_ACTIVE|UI_SELECT);
- /* redraw */
- ED_region_tag_redraw(data->region);
-
/* adds empty mousemove in queue for re-init handler, in case mouse is
* still over a button. we cannot just check for this ourselfs because
* at this point the mouse may be over a button in another region */
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index 3e44566e593..5fe8d5e315c 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -104,7 +104,6 @@ void ED_region_pixelspace(const bContext *C, ARegion *ar)
void ED_region_do_listen(ARegion *ar, wmNotifier *note)
{
-
/* generic notes first */
switch(note->type) {
case WM_NOTE_WINDOW_REDRAW:
@@ -118,24 +117,54 @@ void ED_region_do_listen(ARegion *ar, wmNotifier *note)
}
}
-/* only internal decoration, AZone for now */
-void ED_area_do_draw(bContext *C, ScrArea *sa)
+/* based on screen region draw tags, set draw tags in azones, and future region tabs etc */
+void ED_area_overdraw_flush(bContext *C)
{
- AZone *az;
+ ScrArea *sa;
+
+ for(sa= C->screen->areabase.first; sa; sa= sa->next) {
+ ARegion *ar;
+
+ for(ar= sa->regionbase.first; ar; ar= ar->next) {
+ if(ar->do_draw) {
+ AZone *az;
+
+ for(az= sa->actionzones.first; az; az= az->next) {
+ int xs= (az->x1+az->x2)/2, ys= (az->y1+az->y2)/2;
+
+ /* test if inside */
+ if(BLI_in_rcti(&ar->winrct, xs, ys)) {
+ az->do_draw= 1;
+ }
+ }
+ }
+ }
+ }
+}
+
+void ED_area_overdraw(bContext *C)
+{
+ ScrArea *sa;
- /* hrmf, screenspace for zones */
+ /* Draw AZones, in screenspace */
wm_subwindow_set(C->window, C->window->screen->mainwin);
+
+ glEnable( GL_BLEND );
+ glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
- /* temporary viz for 'action corner' */
- for(az= sa->actionzones.first; az; az= az->next) {
-
- glEnable( GL_BLEND );
- glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
- glColor4ub(0, 0, 0, 80);
- if(az->type==AZONE_TRI) sdrawtrifill(az->x1, az->y1, az->x2, az->y2);
- //if(az->type==AZONE_TRI) sdrawtri(az->x1, az->y1, az->x2, az->y2);
- glDisable( GL_BLEND );
- }
+ for(sa= C->screen->areabase.first; sa; sa= sa->next) {
+ AZone *az;
+ for(az= sa->actionzones.first; az; az= az->next) {
+ if(az->do_draw) {
+ if(az->type==AZONE_TRI) {
+ glColor4ub(0, 0, 0, 70);
+ sdrawtrifill(az->x1, az->y1, az->x2, az->y2);
+ }
+ az->do_draw= 0;
+ }
+ }
+ }
+ glDisable( GL_BLEND );
}
@@ -180,15 +209,17 @@ void ED_region_do_draw(bContext *C, ARegion *ar)
void ED_region_tag_redraw(ARegion *ar)
{
- ar->do_draw= 1;
+ if(ar)
+ ar->do_draw= 1;
}
void ED_area_tag_redraw(ScrArea *sa)
{
ARegion *ar;
- for(ar= sa->regionbase.first; ar; ar= ar->next)
- ar->do_draw= 1;
+ if(sa)
+ for(ar= sa->regionbase.first; ar; ar= ar->next)
+ ar->do_draw= 1;
}
@@ -328,6 +359,7 @@ static void area_calc_totrct(ScrArea *sa, int sizex, int sizey)
sa->winy= sa->totrct.ymax-sa->totrct.ymin+1;
}
+
#define AZONESPOT 12
void area_azone_initialize(ScrArea *sa)
{
diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c
index 0be29fc53c0..f4739a218d6 100644
--- a/source/blender/editors/screen/glutil.c
+++ b/source/blender/editors/screen/glutil.c
@@ -103,7 +103,8 @@ void sdrawline(short x1, short y1, short x2, short y2)
*/
-static void sdrawtripoints(short x1, short y1, short x2, short y2){
+static void sdrawtripoints(short x1, short y1, short x2, short y2)
+{
short v[2];
v[0]= x1; v[1]= y1;
glVertex2sv(v);
diff --git a/source/blender/editors/space_ipo/space_ipo.c b/source/blender/editors/space_ipo/space_ipo.c
index 0afe38ea470..3395af35cd2 100644
--- a/source/blender/editors/space_ipo/space_ipo.c
+++ b/source/blender/editors/space_ipo/space_ipo.c
@@ -293,6 +293,12 @@ static void ipo_header_area_draw(const bContext *C, ARegion *ar)
static void ipo_main_area_listener(ARegion *ar, wmNotifier *wmn)
{
/* context changes */
+ switch(wmn->type) {
+
+ case WM_NOTE_MARKERS_CHANGED:
+ ED_region_tag_redraw(ar);
+ break;
+ }
}
/* only called once, from space/spacetypes.c */
@@ -316,7 +322,7 @@ void ED_spacetype_ipo(void)
art->init= ipo_main_area_init;
art->draw= ipo_main_area_draw;
art->listener= ipo_main_area_listener;
- art->keymapflag= ED_KEYMAP_VIEW2D;
+ art->keymapflag= ED_KEYMAP_VIEW2D|ED_KEYMAP_MARKERS;
BLI_addhead(&st->regiontypes, art);
diff --git a/source/blender/editors/space_time/ed_markers.c b/source/blender/editors/space_time/ed_markers.c
index 43b2601d2fa..0dc68fb4b27 100644
--- a/source/blender/editors/space_time/ed_markers.c
+++ b/source/blender/editors/space_time/ed_markers.c
@@ -332,7 +332,7 @@ static void ed_marker_move_cancel(bContext *C, wmOperator *op)
ed_marker_move_apply(C, op);
ed_marker_move_exit(C, op);
- ED_area_tag_redraw(C->area);
+ WM_event_add_notifier(C, WM_NOTE_MARKERS_CHANGED, 0, NULL);
}
@@ -374,7 +374,7 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, wmEvent *evt)
case RIGHTMOUSE:
if(WM_modal_tweak_check(evt, mm->event_type)) {
ed_marker_move_exit(C, op);
- ED_area_tag_redraw(C->area);
+ WM_event_add_notifier(C, WM_NOTE_MARKERS_CHANGED, 0, NULL);
return OPERATOR_FINISHED;
}
@@ -451,7 +451,7 @@ XXX else if (mm->slink->spacetype == SPACE_ACTION) {
}
}
- ED_area_tag_redraw(C->area);
+ WM_event_add_notifier(C, WM_NOTE_MARKERS_CHANGED, 0, NULL);
// headerprint(str); XXX
}
}
@@ -618,8 +618,7 @@ static int ed_marker_select(bContext *C, wmEvent *evt, int extend)
else
select_timeline_marker_frame(cfra, 0);
- /* XXX notifier for markers... */
- ED_area_tag_redraw(C->area);
+ WM_event_add_notifier(C, WM_NOTE_MARKERS_CHANGED, 0, NULL);
return OPERATOR_PASS_THROUGH;
}
@@ -712,8 +711,7 @@ static int ed_marker_border_select_exec(bContext *C, wmOperator *op)
}
}
- /* XXX notifier for markers... */
- ED_area_tag_redraw(C->area);
+ WM_event_add_notifier(C, WM_NOTE_MARKERS_CHANGED, 0, NULL);
return 1;
}
@@ -766,8 +764,7 @@ static int ed_marker_select_all_exec(bContext *C, wmOperator *op)
marker->flag &= ~SELECT;
}
- /* XXX notifier for markers... */
- ED_area_tag_redraw(C->area);
+ WM_event_add_notifier(C, WM_NOTE_MARKERS_CHANGED, 0, NULL);
return OPERATOR_FINISHED;
}
@@ -813,10 +810,9 @@ static int ed_marker_delete_exec(bContext *C, wmOperator *op)
}
}
- /* XXX notifier for markers... */
- if(changed)
- ED_area_tag_redraw(C->area);
-
+ if(changed) {
+ WM_event_add_notifier(C, WM_NOTE_MARKERS_CHANGED, 0, NULL);
+ }
return OPERATOR_FINISHED;
}
diff --git a/source/blender/editors/space_time/space_time.c b/source/blender/editors/space_time/space_time.c
index c5d5c088d7e..a472c2d2717 100644
--- a/source/blender/editors/space_time/space_time.c
+++ b/source/blender/editors/space_time/space_time.c
@@ -162,8 +162,11 @@ static void time_main_area_draw(const bContext *C, ARegion *ar)
static void time_main_area_listener(ARegion *ar, wmNotifier *wmn)
{
/* context changes */
-
switch(wmn->type) {
+
+ case WM_NOTE_MARKERS_CHANGED:
+ ED_region_tag_redraw(ar);
+ break;
}
}
diff --git a/source/blender/editors/space_time/time_ops.c b/source/blender/editors/space_time/time_ops.c
index bc0ed1634da..c95e7fd7e9d 100644
--- a/source/blender/editors/space_time/time_ops.c
+++ b/source/blender/editors/space_time/time_ops.c
@@ -218,8 +218,8 @@ void time_keymap(wmWindowManager *wm)
WM_keymap_verify_item(keymap, "ED_TIME_OT_change_frame", LEFTMOUSE, KM_PRESS, 0, 0);
WM_keymap_verify_item(keymap, "ED_TIME_OT_toggle_time", TKEY, KM_PRESS, 0, 0);
-
/* markers (XXX move to function?) */
+ keymap= WM_keymap_listbase(wm, "Markers", 0, 0);
WM_keymap_verify_item(keymap, "ED_MARKER_OT_add", MKEY, KM_PRESS, 0, 0);
WM_keymap_verify_item(keymap, "ED_MARKER_OT_move", EVT_TWEAK_R, KM_ANY, 0, 0);
WM_keymap_verify_item(keymap, "ED_MARKER_OT_duplicate", DKEY, KM_PRESS, KM_SHIFT, 0);
diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h
index 5a148ef9a4f..b85a83931bf 100644
--- a/source/blender/windowmanager/WM_types.h
+++ b/source/blender/windowmanager/WM_types.h
@@ -121,9 +121,8 @@ enum {
WM_NOTE_WINDOW_REDRAW,
WM_NOTE_SCREEN_CHANGED,
WM_NOTE_GESTURE_REDRAW,
-
+ WM_NOTE_MARKERS_CHANGED,
WM_NOTE_OBJECT_CHANGED,
-
WM_NOTE_LAST
};
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index 710e7a5a4cc..7bfda3437a9 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -101,15 +101,8 @@ void WM_event_add_notifier(bContext *C, int type, int value, void *data)
BLI_addtail(&C->wm->queue, note);
note->window= C->window;
-
- /* catch local notifications here */
- switch (type) {
- case WM_NOTE_GESTURE_REDRAW:
- if(C->region)
- note->swinid= C->region->swinid;
- break;
- }
-
+ if(C->region)
+ note->swinid= C->region->swinid;
note->type= type;
note->value= value;
note->data= data;
@@ -136,7 +129,7 @@ void wm_event_do_notifiers(bContext *C)
ARegion *ar;
C->window= win;
- C->screen= win->screen;
+ C->screen= win->screen; /* XXX context in notifiers? */
if(note->window && note->window!=win)
continue;
@@ -147,27 +140,13 @@ void wm_event_do_notifiers(bContext *C)
ED_screen_do_listen(win, note);
for(ar=win->screen->regionbase.first; ar; ar= ar->next) {
- if(note->swinid && note->swinid!=ar->swinid)
- continue;
-
- C->region= ar;
ED_region_do_listen(ar, note);
- C->region= NULL;
}
for(sa= win->screen->areabase.first; sa; sa= sa->next) {
- C->area= sa;
-
for(ar=sa->regionbase.first; ar; ar= ar->next) {
- if(note->swinid && note->swinid!=ar->swinid)
- continue;
-
- C->region= ar;
ED_region_do_listen(ar, note);
- C->region= NULL;
}
-
- C->area= NULL;
}
C->window= NULL;
@@ -178,7 +157,8 @@ void wm_event_do_notifiers(bContext *C)
}
}
-static void wm_flush_draw_updates(bScreen *screen, rcti *dirty)
+/* mark regions to redraw if overlapped with rect */
+static void wm_flush_regions(bScreen *screen, rcti *dirty)
{
ScrArea *sa;
ARegion *ar;
@@ -191,19 +171,28 @@ static void wm_flush_draw_updates(bScreen *screen, rcti *dirty)
}
}
-/* quick test to prevent changing window drawable */
-static int wm_draw_update_test_window(wmWindow *win)
+/* all the overlay management, menus, actionzones, region tabs, etc */
+static void wm_flush_draw_update(bContext *C)
{
- ScrArea *sa;
ARegion *ar;
- /* flush */
- for(ar=win->screen->regionbase.first; ar; ar= ar->next) {
+ /* flush redraws of screen regions (menus) down */
+ for(ar= C->screen->regionbase.first; ar; ar= ar->next) {
if(ar->swinid && ar->do_draw) {
- wm_flush_draw_updates(win->screen, &ar->winrct);
+ wm_flush_regions(C->screen, &ar->winrct);
}
}
+
+ /* sets redraws for Azones, future region tabs, etc */
+ ED_area_overdraw_flush(C);
+}
+/* quick test to prevent changing window drawable */
+static int wm_draw_update_test_window(wmWindow *win)
+{
+ ScrArea *sa;
+ ARegion *ar;
+
if(win->screen->do_refresh)
return 1;
if(win->screen->do_draw)
@@ -211,12 +200,15 @@ static int wm_draw_update_test_window(wmWindow *win)
if(win->screen->do_gesture)
return 1;
- for(sa= win->screen->areabase.first; sa; sa= sa->next) {
- for(ar=sa->regionbase.first; ar; ar= ar->next) {
+ for(ar= win->screen->regionbase.first; ar; ar= ar->next)
+ if(ar->swinid && ar->do_draw)
+ return 1;
+
+ for(sa= win->screen->areabase.first; sa; sa= sa->next)
+ for(ar=sa->regionbase.first; ar; ar= ar->next)
if(ar->swinid && ar->do_draw)
return 1;
- }
- }
+
return 0;
}
@@ -238,25 +230,22 @@ void wm_draw_update(bContext *C)
/* notifiers for screen redraw */
if(win->screen->do_refresh)
ED_screen_refresh(C->wm, win);
+
+ /* flush draw updates for multiple layers */
+ wm_flush_draw_update(C);
for(sa= win->screen->areabase.first; sa; sa= sa->next) {
- int area_do_draw= 0;
C->area= sa;
for(ar=sa->regionbase.first; ar; ar= ar->next) {
C->region= ar;
- if(ar->swinid && ar->do_draw) {
+ if(ar->swinid && ar->do_draw)
ED_region_do_draw(C, ar);
- area_do_draw= 1;
- }
C->region= NULL;
}
- /* only internal decoration, like AZone */
- if(area_do_draw)
- ED_area_do_draw(C, sa);
C->area = NULL;
}
@@ -264,6 +253,8 @@ void wm_draw_update(bContext *C)
/* move this here so we can do area 'overlay' drawing */
if(win->screen->do_draw)
ED_screen_draw(win);
+
+ ED_area_overdraw(C);
/* regions are menus here */
for(ar=win->screen->regionbase.first; ar; ar= ar->next) {