diff options
Diffstat (limited to 'source/blender/editors/screen/area.c')
-rw-r--r-- | source/blender/editors/screen/area.c | 81 |
1 files changed, 45 insertions, 36 deletions
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index d0361c5fa01..4784f19012e 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -36,6 +36,7 @@ #include "BLI_blenlib.h" #include "BLI_math.h" #include "BLI_rand.h" +#include "BLI_utildefines.h" #include "BKE_context.h" #include "BKE_global.h" @@ -144,7 +145,7 @@ void ED_area_do_refresh(bContext *C, ScrArea *sa) /* based on screen region draw tags, set draw tags in azones, and future region tabs etc */ /* only exported for WM */ -void ED_area_overdraw_flush(bContext *C, ScrArea *sa, ARegion *ar) +void ED_area_overdraw_flush(ScrArea *sa, ARegion *ar) { AZone *az; @@ -163,31 +164,26 @@ void ED_area_overdraw_flush(bContext *C, ScrArea *sa, ARegion *ar) static void area_draw_azone(short x1, short y1, short x2, short y2) { - float xmin = x1; - float xmax = x2-2; - float ymin = y1-1; - float ymax = y2-3; - - float dx= 0.3f*(xmax-xmin); - float dy= 0.3f*(ymax-ymin); + int dx= floor(0.3f*(x2-x1)); + int dy= floor(0.3f*(y2-y1)); glColor4ub(255, 255, 255, 180); - fdrawline(xmin, ymax, xmax, ymin); + fdrawline(x1, y2, x2, y1); glColor4ub(255, 255, 255, 130); - fdrawline(xmin, ymax-dy, xmax-dx, ymin); + fdrawline(x1, y2-dy, x2-dx, y1); glColor4ub(255, 255, 255, 80); - fdrawline(xmin, ymax-2*dy, xmax-2*dx, ymin); + fdrawline(x1, y2-2*dy, x2-2*dx, y1); glColor4ub(0, 0, 0, 210); - fdrawline(xmin, ymax+1, xmax+1, ymin); + fdrawline(x1, y2+1, x2+1, y1); glColor4ub(0, 0, 0, 180); - fdrawline(xmin, ymax-dy+1, xmax-dx+1, ymin); + fdrawline(x1, y2-dy+1, x2-dx+1, y1); glColor4ub(0, 0, 0, 150); - fdrawline(xmin, ymax-2*dy+1, xmax-2*dx+1, ymin); + fdrawline(x1, y2-2*dy+1, x2-2*dx+1, y1); } -static void region_draw_azone(ScrArea *sa, AZone *az) +static void region_draw_azone(AZone *az) { GLUquadricObj *qobj = NULL; short midx = az->x1 + (az->x2 - az->x1)/2; @@ -247,7 +243,7 @@ void ED_area_overdraw(bContext *C) if(az->type==AZONE_AREA) { area_draw_azone(az->x1, az->y1, az->x2, az->y2); } else if(az->type==AZONE_REGION) { - region_draw_azone(sa, az); + region_draw_azone(az); } az->do_draw= 0; @@ -338,7 +334,7 @@ void ED_region_do_draw(bContext *C, ARegion *ar) glClear(GL_COLOR_BUFFER_BIT); UI_ThemeColor(TH_TEXT); - BLF_draw_default(20, 8, 0.0f, ar->headerstr); + BLF_draw_default(20, 8, 0.0f, ar->headerstr, 65535); /* XXX, use real length */ } else if(at->draw) { at->draw(C, ar); @@ -405,6 +401,19 @@ void ED_area_tag_redraw(ScrArea *sa) ED_region_tag_redraw(ar); } +void ED_area_tag_redraw_regiontype(ScrArea *sa, int regiontype) +{ + ARegion *ar; + + if(sa) { + for(ar= sa->regionbase.first; ar; ar= ar->next) { + if(ar->regiontype == regiontype) { + ED_region_tag_redraw(ar); + } + } + } +} + void ED_area_tag_refresh(ScrArea *sa) { if(sa) @@ -437,7 +446,6 @@ void ED_area_headerprint(ScrArea *sa, const char *str) /* ************************************************************ */ -#define AZONESPOT 12 static void area_azone_initialize(ScrArea *sa) { AZone *az; @@ -451,8 +459,8 @@ static void area_azone_initialize(ScrArea *sa) az->type= AZONE_AREA; az->x1= sa->totrct.xmin; az->y1= sa->totrct.ymin; - az->x2= sa->totrct.xmin + AZONESPOT-1; - az->y2= sa->totrct.ymin + AZONESPOT-1; + az->x2= sa->totrct.xmin + AZONESPOT; + az->y2= sa->totrct.ymin + AZONESPOT; BLI_init_rcti(&az->rect, az->x1, az->x2, az->y1, az->y2); az= (AZone *)MEM_callocN(sizeof(AZone), "actionzone"); @@ -460,13 +468,13 @@ static void area_azone_initialize(ScrArea *sa) az->type= AZONE_AREA; az->x1= sa->totrct.xmax+1; az->y1= sa->totrct.ymax+1; - az->x2= sa->totrct.xmax-AZONESPOT+1; - az->y2= sa->totrct.ymax-AZONESPOT+1; + az->x2= sa->totrct.xmax-AZONESPOT; + az->y2= sa->totrct.ymax-AZONESPOT; BLI_init_rcti(&az->rect, az->x1, az->x2, az->y1, az->y2); } #define AZONEPAD_EDGE 4 -#define AZONEPAD_ICON 8 +#define AZONEPAD_ICON 9 static void region_azone_edge(AZone *az, ARegion *ar) { switch(az->edge) { @@ -817,7 +825,7 @@ static void area_calc_totrct(ScrArea *sa, int sizex, int sizey) /* used for area initialize below */ -static void region_subwindow(wmWindowManager *wm, wmWindow *win, ARegion *ar) +static void region_subwindow(wmWindow *win, ARegion *ar) { if(ar->flag & (RGN_FLAG_HIDDEN|RGN_FLAG_TOO_SMALL)) { if(ar->swinid) @@ -908,7 +916,7 @@ void ED_area_initialize(wmWindowManager *wm, wmWindow *win, ScrArea *sa) /* region windows, default and own handlers */ for(ar= sa->regionbase.first; ar; ar= ar->next) { - region_subwindow(wm, win, ar); + region_subwindow(win, ar); if(ar->swinid) { /* default region handlers */ @@ -931,7 +939,7 @@ void ED_region_init(bContext *C, ARegion *ar) // ARegionType *at= ar->type; /* refresh can be called before window opened */ - region_subwindow(CTX_wm_manager(C), CTX_wm_window(C), ar); + region_subwindow(CTX_wm_window(C), ar); ar->winx= ar->winrct.xmax - ar->winrct.xmin + 1; ar->winy= ar->winrct.ymax - ar->winrct.ymin + 1; @@ -946,7 +954,6 @@ void ED_region_toggle_hidden(bContext *C, ARegion *ar) ScrArea *sa= CTX_wm_area(C); ar->flag ^= RGN_FLAG_HIDDEN; - ar->v2d.flag &= ~V2D_IS_INITIALISED; /* XXX should become hide/unhide api? */ if(ar->flag & RGN_FLAG_HIDDEN) WM_event_remove_handlers(C, &ar->handlers); @@ -1090,10 +1097,12 @@ void ED_area_newspace(bContext *C, ScrArea *sa, int type) /*send space change notifyer*/ WM_event_add_notifier(C, NC_SPACE|ND_SPACE_CHANGED, sa); - - ED_area_tag_redraw(sa); + ED_area_tag_refresh(sa); } + + /* also redraw when re-used */ + ED_area_tag_redraw(sa); } void ED_area_prevspace(bContext *C, ScrArea *sa) @@ -1117,7 +1126,7 @@ void ED_area_prevspace(bContext *C, ScrArea *sa) WM_event_add_notifier(C, NC_SPACE|ND_SPACE_CHANGED, sa); } -static char *editortype_pup(void) +static const char *editortype_pup(void) { return( "Editor type:%t" @@ -1152,11 +1161,11 @@ static char *editortype_pup(void) "|%l" - "|Console %x18" + "|Python Console %x18" ); } -static void spacefunc(struct bContext *C, void *arg1, void *arg2) +static void spacefunc(struct bContext *C, void *UNUSED(arg1), void *UNUSED(arg2)) { ED_area_newspace(C, CTX_wm_area(C), CTX_wm_area(C)->butspacetype); ED_area_tag_redraw(CTX_wm_area(C)); @@ -1214,7 +1223,7 @@ int ED_area_header_standardbuttons(const bContext *C, uiBlock *block, int yco) /************************ standard UI regions ************************/ -void ED_region_panels(const bContext *C, ARegion *ar, int vertical, char *context, int contextnr) +void ED_region_panels(const bContext *C, ARegion *ar, int vertical, const char *context, int contextnr) { ScrArea *sa= CTX_wm_area(C); uiStyle *style= U.uistyles.first; @@ -1244,7 +1253,7 @@ void ED_region_panels(const bContext *C, ARegion *ar, int vertical, char *contex uiBeginPanels(C, ar); /* set view2d view matrix for scrolling (without scrollers) */ - UI_view2d_view_ortho(C, v2d); + UI_view2d_view_ortho(v2d); for(pt= ar->type->paneltypes.first; pt; pt= pt->next) { /* verify context */ @@ -1365,7 +1374,7 @@ void ED_region_panels(const bContext *C, ARegion *ar, int vertical, char *contex UI_view2d_totRect_set(v2d, x+V2D_SCROLL_WIDTH, y+V2D_SCROLL_HEIGHT); /* set the view */ - UI_view2d_view_ortho(C, v2d); + UI_view2d_view_ortho(v2d); /* this does the actual drawing! */ uiEndPanels(C, ar); @@ -1414,7 +1423,7 @@ void ED_region_header(const bContext *C, ARegion *ar) glClear(GL_COLOR_BUFFER_BIT); /* set view2d view matrix for scrolling (without scrollers) */ - UI_view2d_view_ortho(C, &ar->v2d); + UI_view2d_view_ortho(&ar->v2d); xco= maxco= 8; yco= HEADERY-3; |