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:
authorMatt Ebb <matt@mke3.net>2009-09-13 03:56:30 +0400
committerMatt Ebb <matt@mke3.net>2009-09-13 03:56:30 +0400
commitfb599348d39d940d722b79864dd8d171d5ed973a (patch)
treed8ce9aec9093ad2d6b861ddf992098f01dc823b7 /source/blender/editors/screen/area.c
parent26942cd78936d9f160478aff3d6df11514c9d50d (diff)
* Removed the grey overlapping 'region manipulation' triangles.
- They were causing unnecessary visual noise, breaking up the lines of the region edges - Now you can just drag anywhere on a region edge to resize it, like existing area edges - To minimise a region, click once on the region edge, or resize it down to nothing. For minimised regions, a (+) icon will appear, which you can click to restore it to the size it was before it was minimised.
Diffstat (limited to 'source/blender/editors/screen/area.c')
-rw-r--r--source/blender/editors/screen/area.c171
1 files changed, 107 insertions, 64 deletions
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index 2cdb75e28e3..93348d9d556 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 6
+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 - 3*AZONEPAD_ICON;
+ az->x2= ar->winrct.xmin - AZONEPAD_ICON;
+ az->y2= ar->winrct.ymax - 2*AZONEPAD_ICON;
+ }
+ else { // if(az->edge=='r') {
+ az->x1= ar->winrct.xmax + AZONEPAD_ICON;
+ az->y1= ar->winrct.ymax - 3*AZONEPAD_ICON;
+ az->x2= ar->winrct.xmax + 2*AZONEPAD_ICON;
+ az->y2= ar->winrct.ymax - 2*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);
+ }
}