* 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.
This commit is contained in:
@@ -59,7 +59,7 @@ typedef struct AZone {
|
||||
/* internal */
|
||||
short do_draw;
|
||||
/* for draw */
|
||||
short x1, y1, x2, y2, x3, y3;
|
||||
short x1, y1, x2, y2;
|
||||
/* for clip */
|
||||
rcti rect;
|
||||
} AZone;
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
GLUquadricObj *qobj = gluNewQuadric();
|
||||
short midx = az->x1 + (az->x2 - az->x1)/2;
|
||||
short midy = az->y1 + (az->y2 - az->y1)/2;
|
||||
|
||||
if(az->ar==NULL) return;
|
||||
|
||||
UI_SetTheme(sa->spacetype, az->ar->type->regionid);
|
||||
/* only display action zone icons when the region is hidden */
|
||||
if (!(az->ar->flag & RGN_FLAG_HIDDEN)) return;
|
||||
|
||||
UI_ThemeColor(TH_BACK);
|
||||
glBegin(GL_TRIANGLES);
|
||||
glVertex2s(az->x1, az->y1);
|
||||
glVertex2s(az->x2, az->y2);
|
||||
glVertex2s(az->x3, az->y3);
|
||||
glEnd();
|
||||
glPushMatrix();
|
||||
glTranslatef(midx, midy, 0.);
|
||||
|
||||
UI_ThemeColorShade(TH_BACK, 50);
|
||||
sdrawline(az->x1, az->y1, az->x3, az->y3);
|
||||
|
||||
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,9 +461,91 @@ static void area_azone_initialize(ScrArea *sa)
|
||||
BLI_init_rcti(&az->rect, az->x1, az->x2, az->y1, az->y2);
|
||||
}
|
||||
|
||||
#define AZONEPAD_EDGE 4
|
||||
#define AZONEPAD_ICON 6
|
||||
static void region_azone_edge(AZone *az, ARegion *ar)
|
||||
{
|
||||
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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
else if(az->edge=='l') {
|
||||
az->x1= ar->winrct.xmin;
|
||||
az->y1= ar->winrct.ymin;
|
||||
az->x2= ar->winrct.xmin + AZONEPAD_EDGE;
|
||||
az->y2= ar->winrct.ymax;
|
||||
}
|
||||
else { // if(az->edge=='r') {
|
||||
az->x1= ar->winrct.xmax;
|
||||
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(az->edge=='t' || az->edge=='b') {
|
||||
az->x1+= AZONESPOT;
|
||||
az->x2+= AZONESPOT;
|
||||
BLI_init_rcti(&az->rect, az->x1, az->x2, az->y1, az->y2);
|
||||
}
|
||||
else {
|
||||
az->y1-= AZONESPOT;
|
||||
az->y2-= AZONESPOT;
|
||||
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, *azt;
|
||||
AZone *az;
|
||||
|
||||
az= (AZone *)MEM_callocN(sizeof(AZone), "actionzone");
|
||||
BLI_addtail(&(sa->actionzones), az);
|
||||
@@ -459,61 +553,10 @@ static void region_azone_initialize(ScrArea *sa, ARegion *ar, char edge)
|
||||
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;
|
||||
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;
|
||||
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') {
|
||||
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);
|
||||
}
|
||||
else { // if(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);
|
||||
}
|
||||
|
||||
/* 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') {
|
||||
az->x1+= AZONESPOT;
|
||||
az->x2+= AZONESPOT;
|
||||
az->x3+= AZONESPOT;
|
||||
BLI_init_rcti(&az->rect, az->x1, az->x2, az->y1, az->y3);
|
||||
}
|
||||
else {
|
||||
az->y1-= AZONESPOT;
|
||||
az->y2-= AZONESPOT;
|
||||
az->y3-= AZONESPOT;
|
||||
BLI_init_rcti(&az->rect, az->x1, az->x3, az->y1, az->y2);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ar->flag & RGN_FLAG_HIDDEN) {
|
||||
region_azone_icon(sa, az, ar);
|
||||
} else {
|
||||
region_azone_edge(az, ar);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -396,15 +396,7 @@ AZone *is_in_area_actionzone(ScrArea *sa, int x, int y)
|
||||
break;
|
||||
}
|
||||
else if(az->type == AZONE_REGION) {
|
||||
float v1[2], v2[2], v3[2], pt[2];
|
||||
|
||||
v1[0]= az->x1; v1[1]= az->y1;
|
||||
v2[0]= az->x2; v2[1]= az->y2;
|
||||
v3[0]= az->x3; v3[1]= az->y3;
|
||||
pt[0]= x; pt[1]=y;
|
||||
|
||||
if(IsPointInTri2D(v1, v2, v3, pt))
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1273,7 +1265,9 @@ static void SCREEN_OT_area_split(wmOperatorType *ot)
|
||||
/* ************** scale region edge operator *********************************** */
|
||||
|
||||
typedef struct RegionMoveData {
|
||||
AZone *az;
|
||||
ARegion *ar;
|
||||
ScrArea *sa;
|
||||
int bigger, smaller, origval;
|
||||
int origx, origy;
|
||||
char edge;
|
||||
@@ -1290,7 +1284,9 @@ static int region_scale_invoke(bContext *C, wmOperator *op, wmEvent *event)
|
||||
|
||||
op->customdata= rmd;
|
||||
|
||||
rmd->az = az;
|
||||
rmd->ar= az->ar;
|
||||
rmd->sa = sad->sa1;
|
||||
rmd->edge= az->edge;
|
||||
rmd->origx= event->x;
|
||||
rmd->origy= event->y;
|
||||
@@ -1322,8 +1318,8 @@ static int region_scale_modal(bContext *C, wmOperator *op, wmEvent *event)
|
||||
if(rmd->edge=='l') delta= -delta;
|
||||
rmd->ar->type->minsizex= rmd->origval + delta;
|
||||
CLAMP(rmd->ar->type->minsizex, 0, 1000);
|
||||
if(rmd->ar->type->minsizex < 10) {
|
||||
rmd->ar->type->minsizex= 10;
|
||||
if(rmd->ar->type->minsizex < 24) {
|
||||
rmd->ar->type->minsizex= rmd->origval;
|
||||
rmd->ar->flag |= RGN_FLAG_HIDDEN;
|
||||
}
|
||||
else
|
||||
@@ -1334,8 +1330,8 @@ static int region_scale_modal(bContext *C, wmOperator *op, wmEvent *event)
|
||||
if(rmd->edge=='b') delta= -delta;
|
||||
rmd->ar->type->minsizey= rmd->origval + delta;
|
||||
CLAMP(rmd->ar->type->minsizey, 0, 1000);
|
||||
if(rmd->ar->type->minsizey < 10) {
|
||||
rmd->ar->type->minsizey= 10;
|
||||
if(rmd->ar->type->minsizey < 24) {
|
||||
rmd->ar->type->minsizey= rmd->origval;
|
||||
rmd->ar->flag |= RGN_FLAG_HIDDEN;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -742,7 +742,7 @@ static void draw_viewport_name(ARegion *ar, View3D *v3d)
|
||||
|
||||
if (printable) {
|
||||
UI_ThemeColor(TH_TEXT_HI);
|
||||
BLF_draw_default(10, ar->winy-20, 0.0f, printable);
|
||||
BLF_draw_default(20, ar->winy-20, 0.0f, printable);
|
||||
}
|
||||
|
||||
if (v3d->localview) {
|
||||
|
||||
Reference in New Issue
Block a user