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
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/screen/area.c')
-rw-r--r--source/blender/editors/screen/area.c204
1 files changed, 130 insertions, 74 deletions
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index 2cdb75e28e3..87901d75494 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -159,14 +159,8 @@ void ED_area_overdraw_flush(bContext *C, ScrArea *sa, ARegion *ar)
for(az= sa->actionzones.first; az; az= az->next) {
int xs, ys;
- if(az->type==AZONE_AREA) {
- xs= (az->x1+az->x2)/2;
- ys= (az->y1+az->y2)/2;
- }
- else {
- xs= az->x3;
- ys= az->y3;
- }
+ xs= (az->x1+az->x2)/2;
+ ys= (az->y1+az->y2)/2;
/* test if inside */
if(BLI_in_rcti(&ar->winrct, xs, ys)) {
@@ -196,25 +190,42 @@ static void area_draw_azone(short x1, short y1, short x2, short y2)
fdrawline(xmin, ymax-2*dy+1, xmax-2*dx+1, ymin);
}
+
static void region_draw_azone(ScrArea *sa, AZone *az)
{
- if(az->ar==NULL) return;
+ GLUquadricObj *qobj = gluNewQuadric();
+ short midx = az->x1 + (az->x2 - az->x1)/2;
+ short midy = az->y1 + (az->y2 - az->y1)/2;
- UI_SetTheme(sa->spacetype, az->ar->type->regionid);
+ if(az->ar==NULL) return;
- UI_ThemeColor(TH_BACK);
- glBegin(GL_TRIANGLES);
- glVertex2s(az->x1, az->y1);
- glVertex2s(az->x2, az->y2);
- glVertex2s(az->x3, az->y3);
- glEnd();
+ /* only display action zone icons when the region is hidden */
+ if (!(az->ar->flag & RGN_FLAG_HIDDEN)) return;
- UI_ThemeColorShade(TH_BACK, 50);
- sdrawline(az->x1, az->y1, az->x3, az->y3);
+ glPushMatrix();
+ glTranslatef(midx, midy, 0.);
- UI_ThemeColorShade(TH_BACK, -50);
- sdrawline(az->x2, az->y2, az->x3, az->y3);
+ /* outlined circle */
+ glEnable(GL_LINE_SMOOTH);
+
+ glColor4f(1.f, 1.f, 1.f, 0.8f);
+
+ gluQuadricDrawStyle(qobj, GLU_FILL);
+ gluDisk( qobj, 0.0, 4.25f, 16, 1);
+ glColor4f(0.2f, 0.2f, 0.2f, 0.9f);
+
+ gluQuadricDrawStyle(qobj, GLU_SILHOUETTE);
+ gluDisk( qobj, 0.0, 4.25f, 16, 1);
+
+ glDisable(GL_LINE_SMOOTH);
+
+ glPopMatrix();
+ gluDeleteQuadric(qobj);
+
+ /* + */
+ sdrawline(midx, midy-2, midx, midy+3);
+ sdrawline(midx-2, midy, midx+3, midy);
}
@@ -235,10 +246,11 @@ void ED_area_overdraw(bContext *C)
AZone *az;
for(az= sa->actionzones.first; az; az= az->next) {
if(az->do_draw) {
- if(az->type==AZONE_AREA)
+ if(az->type==AZONE_AREA) {
area_draw_azone(az->x1, az->y1, az->x2, az->y2);
- else if(az->type==AZONE_REGION)
+ } else if(az->type==AZONE_REGION) {
region_draw_azone(sa, az);
+ }
az->do_draw= 0;
}
@@ -449,72 +461,103 @@ static void area_azone_initialize(ScrArea *sa)
BLI_init_rcti(&az->rect, az->x1, az->x2, az->y1, az->y2);
}
-static void region_azone_initialize(ScrArea *sa, ARegion *ar, char edge)
+#define AZONEPAD_EDGE 4
+#define AZONEPAD_ICON 8
+static void region_azone_edge(AZone *az, ARegion *ar)
{
- AZone *az, *azt;
-
- az= (AZone *)MEM_callocN(sizeof(AZone), "actionzone");
- BLI_addtail(&(sa->actionzones), az);
- az->type= AZONE_REGION;
- az->ar= ar;
- az->edge= edge;
-
- if(edge=='t') {
- az->x1= ar->winrct.xmin+AZONESPOT;
- az->y1= ar->winrct.ymax;
- az->x2= ar->winrct.xmin+2*AZONESPOT;
+ if(az->edge=='t') {
+ az->x1= ar->winrct.xmin;
+ az->y1= ar->winrct.ymax - AZONEPAD_EDGE;
+ az->x2= ar->winrct.xmax;
az->y2= ar->winrct.ymax;
- az->x3= (az->x1+az->x2)/2;
- az->y3= az->y2+AZONESPOT/2;
- BLI_init_rcti(&az->rect, az->x1, az->x2, az->y1, az->y3);
}
- else if(edge=='b') {
- az->x1= ar->winrct.xmin+AZONESPOT;
- az->y1= ar->winrct.ymin;
- az->x2= ar->winrct.xmin+2*AZONESPOT;
+ else if(az->edge=='b') {
+ az->x1= ar->winrct.xmin;
+ az->y1= ar->winrct.ymin + AZONEPAD_EDGE;
+ az->x2= ar->winrct.xmax;
az->y2= ar->winrct.ymin;
- az->x3= (az->x1+az->x2)/2;
- az->y3= az->y2-AZONESPOT/2;
- BLI_init_rcti(&az->rect, az->x1, az->x2, az->y3, az->y1);
}
- else if(edge=='l') {
+ else if(az->edge=='l') {
az->x1= ar->winrct.xmin;
- az->y1= ar->winrct.ymax-AZONESPOT;
- az->x2= ar->winrct.xmin;
- az->y2= ar->winrct.ymax-2*AZONESPOT;
- az->x3= az->x2-AZONESPOT/2;
- az->y3= (az->y1+az->y2)/2;
- BLI_init_rcti(&az->rect, az->x3, az->x1, az->y1, az->y2);
+ az->y1= ar->winrct.ymin;
+ az->x2= ar->winrct.xmin + AZONEPAD_EDGE;
+ az->y2= ar->winrct.ymax;
}
- else { // if(edge=='r') {
+ else { // if(az->edge=='r') {
az->x1= ar->winrct.xmax;
- az->y1= ar->winrct.ymax-AZONESPOT;
- az->x2= ar->winrct.xmax;
- az->y2= ar->winrct.ymax-2*AZONESPOT;
- az->x3= az->x2+AZONESPOT/2;
- az->y3= (az->y1+az->y2)/2;
- BLI_init_rcti(&az->rect, az->x1, az->x3, az->y1, az->y2);
+ az->y1= ar->winrct.ymin;
+ az->x2= ar->winrct.xmax - AZONEPAD_EDGE;
+ az->y2= ar->winrct.ymax;
}
+
+ BLI_init_rcti(&az->rect, az->x1, az->x2, az->y1, az->y2);
+}
+
+static void region_azone_icon(ScrArea *sa, AZone *az, ARegion *ar)
+{
+ AZone *azt;
+
+ if(az->edge=='t') {
+ az->x1= ar->winrct.xmax - AZONEPAD_ICON;
+ az->y1= ar->winrct.ymax + AZONEPAD_ICON;
+ az->x2= ar->winrct.xmax - 2*AZONEPAD_ICON;
+ az->y2= ar->winrct.ymax + 2*AZONEPAD_ICON;
+ }
+ else if(az->edge=='b') {
+ az->x1= ar->winrct.xmin + AZONEPAD_ICON;
+ az->y1= ar->winrct.ymin - AZONEPAD_ICON;
+ az->x2= ar->winrct.xmin + 2*AZONEPAD_ICON;
+ az->y2= ar->winrct.ymin - 2*AZONEPAD_ICON;
+ }
+ else if(az->edge=='l') {
+ az->x1= ar->winrct.xmin - 2*AZONEPAD_ICON;
+ az->y1= ar->winrct.ymax - 2*AZONEPAD_ICON;
+ az->x2= ar->winrct.xmin - AZONEPAD_ICON;
+ az->y2= ar->winrct.ymax - AZONEPAD_ICON;
+ }
+ else { // if(az->edge=='r') {
+ az->x1= ar->winrct.xmax + AZONEPAD_ICON;
+ az->y1= ar->winrct.ymax - 2*AZONEPAD_ICON;
+ az->x2= ar->winrct.xmax + 2*AZONEPAD_ICON;
+ az->y2= ar->winrct.ymax - AZONEPAD_ICON;
+ }
+
+ BLI_init_rcti(&az->rect, az->x1, az->x2, az->y1, az->y2);
/* if more azones on 1 spot, set offset */
for(azt= sa->actionzones.first; azt; azt= azt->next) {
if(az!=azt) {
if( ABS(az->x1-azt->x1) < 2 && ABS(az->y1-azt->y1) < 2) {
- if(edge=='t' || edge=='b') {
+ if(az->edge=='t' || az->edge=='b') {
az->x1+= AZONESPOT;
az->x2+= AZONESPOT;
- az->x3+= AZONESPOT;
- BLI_init_rcti(&az->rect, az->x1, az->x2, az->y1, az->y3);
+ BLI_init_rcti(&az->rect, az->x1, az->x2, az->y1, az->y2);
}
else {
az->y1-= AZONESPOT;
az->y2-= AZONESPOT;
- az->y3-= AZONESPOT;
- BLI_init_rcti(&az->rect, az->x1, az->x3, az->y1, az->y2);
+ BLI_init_rcti(&az->rect, az->x1, az->x2, az->y1, az->y2);
}
}
}
}
+}
+
+static void region_azone_initialize(ScrArea *sa, ARegion *ar, char edge)
+{
+ AZone *az;
+
+ az= (AZone *)MEM_callocN(sizeof(AZone), "actionzone");
+ BLI_addtail(&(sa->actionzones), az);
+ az->type= AZONE_REGION;
+ az->ar= ar;
+ az->edge= edge;
+
+ if (ar->flag & RGN_FLAG_HIDDEN) {
+ region_azone_icon(sa, az, ar);
+ } else {
+ region_azone_edge(az, ar);
+ }
}
@@ -781,24 +824,24 @@ static void ed_default_handlers(wmWindowManager *wm, ListBase *handlers, int fla
UI_add_region_handlers(handlers);
}
if(flag & ED_KEYMAP_VIEW2D) {
- ListBase *keymap= WM_keymap_listbase(wm, "View2D", 0, 0);
+ wmKeyMap *keymap= WM_keymap_find(wm, "View2D", 0, 0);
WM_event_add_keymap_handler(handlers, keymap);
}
if(flag & ED_KEYMAP_MARKERS) {
- ListBase *keymap= WM_keymap_listbase(wm, "Markers", 0, 0);
+ wmKeyMap *keymap= WM_keymap_find(wm, "Markers", 0, 0);
WM_event_add_keymap_handler(handlers, keymap);
// XXX need boundbox check urgently!!!
}
if(flag & ED_KEYMAP_ANIMATION) {
- ListBase *keymap= WM_keymap_listbase(wm, "Animation", 0, 0);
+ wmKeyMap *keymap= WM_keymap_find(wm, "Animation", 0, 0);
WM_event_add_keymap_handler(handlers, keymap);
}
if(flag & ED_KEYMAP_FRAMES) {
- ListBase *keymap= WM_keymap_listbase(wm, "Frames", 0, 0);
+ wmKeyMap *keymap= WM_keymap_find(wm, "Frames", 0, 0);
WM_event_add_keymap_handler(handlers, keymap);
}
if(flag & ED_KEYMAP_GPENCIL) {
- ListBase *keymap= WM_keymap_listbase(wm, "Grease Pencil", 0, 0);
+ wmKeyMap *keymap= WM_keymap_find(wm, "Grease Pencil", 0, 0);
WM_event_add_keymap_handler(handlers, keymap);
}
}
@@ -873,6 +916,19 @@ void ED_region_init(bContext *C, ARegion *ar)
}
+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);
+
+ ED_area_initialize(CTX_wm_manager(C), CTX_wm_window(C), sa);
+ ED_area_tag_redraw(sa);
+}
/* sa2 to sa1, we swap spaces for fullscreen to keep all allocated data */
/* area vertices were set */
@@ -1198,7 +1254,7 @@ void ED_region_panels(const bContext *C, ARegion *ar, int vertical, char *contex
pt->draw_header(C, panel);
- uiBlockLayoutResolve(C, block, &xco, &yco);
+ uiBlockLayoutResolve(block, &xco, &yco);
panel->labelofs= xco - triangle;
panel->layout= NULL;
}
@@ -1209,7 +1265,7 @@ void ED_region_panels(const bContext *C, ARegion *ar, int vertical, char *contex
pt->draw(C, panel);
- uiBlockLayoutResolve(C, block, &xco, &yco);
+ uiBlockLayoutResolve(block, &xco, &yco);
panel->layout= NULL;
yco -= 2*style->panelspace;
@@ -1297,7 +1353,7 @@ void ED_region_panels(const bContext *C, ARegion *ar, int vertical, char *contex
void ED_region_panels_init(wmWindowManager *wm, ARegion *ar)
{
- ListBase *keymap;
+ wmKeyMap *keymap;
// XXX quick hacks for files saved with 2.5 already (i.e. the builtin defaults file)
// scrollbars for button regions
@@ -1310,7 +1366,7 @@ void ED_region_panels_init(wmWindowManager *wm, ARegion *ar)
UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_PANELS_UI, ar->winx, ar->winy);
- keymap= WM_keymap_listbase(wm, "View2D Buttons List", 0, 0);
+ keymap= WM_keymap_find(wm, "View2D Buttons List", 0, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
}
@@ -1355,7 +1411,7 @@ void ED_region_header(const bContext *C, ARegion *ar)
maxco= xco;
}
- uiBlockLayoutResolve(C, block, &xco, &yco);
+ uiBlockLayoutResolve(block, &xco, &yco);
/* for view2d */
if(xco > maxco)