70
76
/* translate scissor rect to region space */
71
rect.xmin= scirct->xmin - ar->winrct.xmin;
72
rect.ymin= scirct->ymin - ar->winrct.ymin;
73
rect.xmax= scirct->xmax - ar->winrct.xmin;
74
rect.ymax= scirct->ymax - ar->winrct.ymin;
77
rect.xmin = scirct->xmin - ar->winrct.xmin;
78
rect.ymin = scirct->ymin - ar->winrct.ymin;
79
rect.xmax = scirct->xmax - ar->winrct.xmin;
80
rect.ymax = scirct->ymax - ar->winrct.ymin;
76
82
/* set transp line */
77
83
glEnable( GL_BLEND );
78
84
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
81
glColor4ub(0,0,0, 50);
87
glColor4ub(0,0,0, 30);
82
88
sdrawline(rect.xmax, rect.ymin, rect.xmax, rect.ymax);
85
glColor4ub(0,0,0, 80);
91
glColor4ub(0,0,0, 30);
86
92
sdrawline(rect.xmin, rect.ymin, rect.xmax, rect.ymin);
89
glColor4ub(255,255,255, 60);
95
glColor4ub(255,255,255, 30);
90
96
sdrawline(rect.xmin, rect.ymax, rect.xmax, rect.ymax);
93
glColor4ub(255,255,255, 50);
99
glColor4ub(255,255,255, 30);
94
100
sdrawline(rect.xmin, rect.ymin, rect.xmin, rect.ymax);
96
102
glDisable( GL_BLEND );
170
170
static void area_draw_azone(short x1, short y1, short x2, short y2)
177
float dx= 0.3f*(xmax-xmin);
178
float dy= 0.3f*(ymax-ymin);
175
dx= copysign(ceil(0.3f*fabs(dx)), dx);
176
dy= copysign(ceil(0.3f*fabs(dy)), dy);
179
glEnable(GL_LINE_SMOOTH);
180
181
glColor4ub(255, 255, 255, 180);
181
fdrawline(xmin, ymax, xmax, ymin);
182
fdrawline(x1, y2, x2, y1);
182
183
glColor4ub(255, 255, 255, 130);
183
fdrawline(xmin, ymax-dy, xmax-dx, ymin);
184
fdrawline(x1, y2-dy, x2-dx, y1);
184
185
glColor4ub(255, 255, 255, 80);
185
fdrawline(xmin, ymax-2*dy, xmax-2*dx, ymin);
186
fdrawline(x1, y2-2*dy, x2-2*dx, y1);
187
188
glColor4ub(0, 0, 0, 210);
188
fdrawline(xmin, ymax+1, xmax+1, ymin);
189
fdrawline(x1, y2+1, x2+1, y1);
189
190
glColor4ub(0, 0, 0, 180);
190
fdrawline(xmin, ymax-dy+1, xmax-dx+1, ymin);
191
fdrawline(x1, y2-dy+1, x2-dx+1, y1);
191
192
glColor4ub(0, 0, 0, 150);
192
fdrawline(xmin, ymax-2*dy+1, xmax-2*dx+1, ymin);
193
fdrawline(x1, y2-2*dy+1, x2-2*dx+1, y1);
195
glDisable(GL_LINE_SMOOTH);
196
static void region_draw_azone(ScrArea *sa, AZone *az)
199
static void region_draw_azone_icon(AZone *az)
198
201
GLUquadricObj *qobj = NULL;
199
202
short midx = az->x1 + (az->x2 - az->x1)/2;
200
203
short midy = az->y1 + (az->y2 - az->y1)/2;
202
if(az->ar==NULL) return;
204
/* only display action zone icons when the region is hidden */
205
if (!(az->ar->flag & RGN_FLAG_HIDDEN)) return;
207
205
qobj = gluNewQuadric();
210
glTranslatef(midx, midy, 0.);
208
glTranslatef(midx, midy, 0.0);
212
210
/* outlined circle */
213
211
glEnable(GL_LINE_SMOOTH);
232
230
sdrawline(midx-2, midy, midx+3, midy);
233
static void draw_azone_plus(float x1, float y1, float x2, float y2)
238
glRectf((x1 + x2 - width)*0.5f, y1 + pad, (x1 + x2 + width)*0.5f, y2 - pad);
239
glRectf(x1 + pad, (y1 + y2 - width)*0.5f, (x1 + x2 - width)*0.5f, (y1 + y2 + width)*0.5f);
240
glRectf((x1 + x2 + width)*0.5f, (y1 + y2 - width)*0.5f, x2 - pad, (y1 + y2 + width)*0.5f);
243
static void region_draw_azone_tab_plus(AZone *az)
245
extern void ui_draw_anti_tria(float x1, float y1, float x2, float y2, float x3, float y3); /* xxx temp */
249
/* add code to draw region hidden as 'too small' */
251
case AE_TOP_TO_BOTTOMRIGHT:
252
uiSetRoundBox(UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT);
254
case AE_BOTTOM_TO_TOPLEFT:
255
uiSetRoundBox(UI_CNR_BOTTOM_RIGHT | UI_CNR_BOTTOM_LEFT);
257
case AE_LEFT_TO_TOPRIGHT:
258
uiSetRoundBox(UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT);
260
case AE_RIGHT_TO_TOPLEFT:
261
uiSetRoundBox(UI_CNR_TOP_RIGHT | UI_CNR_BOTTOM_RIGHT);
265
glColor4f(0.05f, 0.05f, 0.05f, 0.4f);
266
uiRoundBox((float)az->x1, (float)az->y1, (float)az->x2, (float)az->y2, 4.0f);
270
glColor4f(0.8f, 0.8f, 0.8f, 0.4f);
271
draw_azone_plus((float)az->x1, (float)az->y1, (float)az->x2, (float)az->y2);
276
static void region_draw_azone_tab(AZone *az)
281
UI_GetThemeColor3fv(TH_HEADER, col);
282
glColor4f(col[0], col[1], col[2], 0.5f);
284
/* add code to draw region hidden as 'too small' */
286
case AE_TOP_TO_BOTTOMRIGHT:
287
uiSetRoundBox(UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT | UI_RB_ALPHA);
289
uiDrawBoxShade(GL_POLYGON, (float)az->x1, (float)az->y1, (float)az->x2, (float)az->y2, 4.0f, -0.3f, 0.05f);
290
glColor4ub(0, 0, 0, 255);
291
uiRoundRect((float)az->x1, 0.3f+(float)az->y1, (float)az->x2, 0.3f+(float)az->y2, 4.0f);
293
case AE_BOTTOM_TO_TOPLEFT:
294
uiSetRoundBox(UI_CNR_BOTTOM_RIGHT | UI_CNR_BOTTOM_LEFT | UI_RB_ALPHA);
296
uiDrawBoxShade(GL_POLYGON, (float)az->x1, (float)az->y1, (float)az->x2, (float)az->y2, 4.0f, -0.3f, 0.05f);
297
glColor4ub(0, 0, 0, 255);
298
uiRoundRect((float)az->x1, 0.3f+(float)az->y1, (float)az->x2, 0.3f+(float)az->y2, 4.0f);
300
case AE_LEFT_TO_TOPRIGHT:
301
uiSetRoundBox(UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT | UI_RB_ALPHA);
303
uiDrawBoxShade(GL_POLYGON, (float)az->x1, (float)az->y1, (float)az->x2, (float)az->y2, 4.0f, -0.3f, 0.05f);
304
glColor4ub(0, 0, 0, 255);
305
uiRoundRect((float)az->x1, (float)az->y1, (float)az->x2, (float)az->y2, 4.0f);
307
case AE_RIGHT_TO_TOPLEFT:
308
uiSetRoundBox(UI_CNR_TOP_RIGHT | UI_CNR_BOTTOM_RIGHT | UI_RB_ALPHA);
310
uiDrawBoxShade(GL_POLYGON, (float)az->x1, (float)az->y1, (float)az->x2, (float)az->y2, 4.0f, -0.3f, 0.05f);
311
glColor4ub(0, 0, 0, 255);
312
uiRoundRect((float)az->x1, (float)az->y1, (float)az->x2, (float)az->y2, 4.0f);
319
static void region_draw_azone_tria(AZone *az)
321
extern void ui_draw_anti_tria(float x1, float y1, float x2, float y2, float x3, float y3); /* xxx temp */
324
//UI_GetThemeColor3fv(TH_HEADER, col);
325
glColor4f(0.0f, 0.0f, 0.0f, 0.35f);
327
/* add code to draw region hidden as 'too small' */
329
case AE_TOP_TO_BOTTOMRIGHT:
330
ui_draw_anti_tria((float)az->x1, (float)az->y1, (float)az->x2, (float)az->y1, (float)(az->x1+az->x2)/2, (float)az->y2);
333
case AE_BOTTOM_TO_TOPLEFT:
334
ui_draw_anti_tria((float)az->x1, (float)az->y2, (float)az->x2, (float)az->y2, (float)(az->x1+az->x2)/2, (float)az->y1);
337
case AE_LEFT_TO_TOPRIGHT:
338
ui_draw_anti_tria((float)az->x2, (float)az->y1, (float)az->x2, (float)az->y2, (float)az->x1, (float)(az->y1+az->y2)/2);
341
case AE_RIGHT_TO_TOPLEFT:
342
ui_draw_anti_tria((float)az->x1, (float)az->y1, (float)az->x1, (float)az->y2, (float)az->x2, (float)(az->y1+az->y2)/2);
236
350
/* only exported for WM */
237
351
void ED_area_overdraw(bContext *C)
339
471
UI_SetTheme(sa?sa->spacetype:0, ar->type?ar->type->regionid:0);
341
473
/* optional header info instead? */
343
475
UI_ThemeClearColor(TH_HEADER);
344
476
glClear(GL_COLOR_BUFFER_BIT);
346
478
UI_ThemeColor(TH_TEXT);
347
BLF_draw_default(20, 8, 0.0f, ar->headerstr);
479
BLF_draw_default(20, 8, 0.0f, ar->headerstr, BLF_DRAW_STR_DUMMY_MAX);
353
uiFreeInactiveBlocks(C, &ar->uiblocks);
356
region_draw_emboss(ar, &winrct);
358
485
/* XXX test: add convention to end regions always in pixel space, for drawing of borders/gestures etc */
359
486
ED_region_pixelspace(ar);
488
ED_region_draw_cb_draw(C, ar, REGION_DRAW_POST_PIXEL);
362
491
memset(&ar->drawrct, 0, sizeof(ar->drawrct));
493
uiFreeInactiveBlocks(C, &ar->uiblocks);
496
region_draw_emboss(ar, &winrct);
365
499
/* **********************************
366
maybe silly, but let's try for now
367
to keep these tags protected
368
********************************** */
500
* maybe silly, but let's try for now
501
* to keep these tags protected
502
* ********************************** */
370
504
void ED_region_tag_redraw(ARegion *ar)
373
507
/* zero region means full region redraw */
374
508
ar->do_draw= RGN_DRAW;
375
509
memset(&ar->drawrct, 0, sizeof(ar->drawrct));
453
603
az= (AZone *)MEM_callocN(sizeof(AZone), "actionzone");
454
604
BLI_addtail(&(sa->actionzones), az);
455
605
az->type= AZONE_AREA;
456
az->x1= sa->totrct.xmin;
457
az->y1= sa->totrct.ymin;
458
az->x2= sa->totrct.xmin + AZONESPOT-1;
459
az->y2= sa->totrct.ymin + AZONESPOT-1;
606
az->x1= sa->totrct.xmin - 1;
607
az->y1= sa->totrct.ymin - 1;
608
az->x2= sa->totrct.xmin + (AZONESPOT-1);
609
az->y2= sa->totrct.ymin + (AZONESPOT-1);
460
610
BLI_init_rcti(&az->rect, az->x1, az->x2, az->y1, az->y2);
462
612
az= (AZone *)MEM_callocN(sizeof(AZone), "actionzone");
463
613
BLI_addtail(&(sa->actionzones), az);
464
614
az->type= AZONE_AREA;
465
az->x1= sa->totrct.xmax+1;
466
az->y1= sa->totrct.ymax+1;
467
az->x2= sa->totrct.xmax-AZONESPOT+1;
468
az->y2= sa->totrct.ymax-AZONESPOT+1;
615
az->x1= sa->totrct.xmax + 1;
616
az->y1= sa->totrct.ymax + 1;
617
az->x2= sa->totrct.xmax - (AZONESPOT-1);
618
az->y2= sa->totrct.ymax - (AZONESPOT-1);
469
619
BLI_init_rcti(&az->rect, az->x1, az->x2, az->y1, az->y2);
472
622
#define AZONEPAD_EDGE 4
473
#define AZONEPAD_ICON 8
623
#define AZONEPAD_ICON 9
474
624
static void region_azone_edge(AZone *az, ARegion *ar)
477
az->x1= ar->winrct.xmin;
478
az->y1= ar->winrct.ymax - AZONEPAD_EDGE;
479
az->x2= ar->winrct.xmax;
480
az->y2= ar->winrct.ymax;
482
else if(az->edge=='b') {
483
az->x1= ar->winrct.xmin;
484
az->y1= ar->winrct.ymin + AZONEPAD_EDGE;
485
az->x2= ar->winrct.xmax;
486
az->y2= ar->winrct.ymin;
488
else if(az->edge=='l') {
489
az->x1= ar->winrct.xmin;
490
az->y1= ar->winrct.ymin;
491
az->x2= ar->winrct.xmin + AZONEPAD_EDGE;
492
az->y2= ar->winrct.ymax;
494
else { // if(az->edge=='r') {
495
az->x1= ar->winrct.xmax;
496
az->y1= ar->winrct.ymin;
497
az->x2= ar->winrct.xmax - AZONEPAD_EDGE;
498
az->y2= ar->winrct.ymax;
627
case AE_TOP_TO_BOTTOMRIGHT:
628
az->x1= ar->winrct.xmin;
629
az->y1= ar->winrct.ymax - AZONEPAD_EDGE;
630
az->x2= ar->winrct.xmax;
631
az->y2= ar->winrct.ymax;
633
case AE_BOTTOM_TO_TOPLEFT:
634
az->x1= ar->winrct.xmin;
635
az->y1= ar->winrct.ymin + AZONEPAD_EDGE;
636
az->x2= ar->winrct.xmax;
637
az->y2= ar->winrct.ymin;
639
case AE_LEFT_TO_TOPRIGHT:
640
az->x1= ar->winrct.xmin;
641
az->y1= ar->winrct.ymin;
642
az->x2= ar->winrct.xmin + AZONEPAD_EDGE;
643
az->y2= ar->winrct.ymax;
645
case AE_RIGHT_TO_TOPLEFT:
646
az->x1= ar->winrct.xmax;
647
az->y1= ar->winrct.ymin;
648
az->x2= ar->winrct.xmax - AZONEPAD_EDGE;
649
az->y2= ar->winrct.ymax;
501
653
BLI_init_rcti(&az->rect, az->x1, az->x2, az->y1, az->y2);
509
for(azt= sa->actionzones.first; azt; azt= azt->next) {
510
if(azt->edge == az->edge) tot++;
661
/* count how many actionzones with along same edge are available.
662
* This allows for adding more action zones in the future without
663
* having to worry about correct offset */
664
for (azt= sa->actionzones.first; azt; azt= azt->next) {
665
if (azt->edge == az->edge) tot++;
514
az->x1= ar->winrct.xmax - tot*2*AZONEPAD_ICON;
515
az->y1= ar->winrct.ymax + AZONEPAD_ICON;
516
az->x2= ar->winrct.xmax - tot*AZONEPAD_ICON;
517
az->y2= ar->winrct.ymax + 2*AZONEPAD_ICON;
519
else if(az->edge=='b') {
520
az->x1= ar->winrct.xmin + AZONEPAD_ICON;
521
az->y1= ar->winrct.ymin - 2*AZONEPAD_ICON;
522
az->x2= ar->winrct.xmin + 2*AZONEPAD_ICON;
523
az->y2= ar->winrct.ymin - AZONEPAD_ICON;
525
else if(az->edge=='l') {
526
az->x1= ar->winrct.xmin - 2*AZONEPAD_ICON;
527
az->y1= ar->winrct.ymax - tot*2*AZONEPAD_ICON;
528
az->x2= ar->winrct.xmin - AZONEPAD_ICON;
529
az->y2= ar->winrct.ymax - tot*AZONEPAD_ICON;
531
else { // if(az->edge=='r') {
532
az->x1= ar->winrct.xmax + AZONEPAD_ICON;
533
az->y1= ar->winrct.ymax - tot*2*AZONEPAD_ICON;
534
az->x2= ar->winrct.xmax + 2*AZONEPAD_ICON;
535
az->y2= ar->winrct.ymax - tot*AZONEPAD_ICON;
669
case AE_TOP_TO_BOTTOMRIGHT:
670
az->x1= ar->winrct.xmax - tot*2*AZONEPAD_ICON;
671
az->y1= ar->winrct.ymax + AZONEPAD_ICON;
672
az->x2= ar->winrct.xmax - tot*AZONEPAD_ICON;
673
az->y2= ar->winrct.ymax + 2*AZONEPAD_ICON;
675
case AE_BOTTOM_TO_TOPLEFT:
676
az->x1= ar->winrct.xmin + AZONEPAD_ICON;
677
az->y1= ar->winrct.ymin - 2*AZONEPAD_ICON;
678
az->x2= ar->winrct.xmin + 2*AZONEPAD_ICON;
679
az->y2= ar->winrct.ymin - AZONEPAD_ICON;
681
case AE_LEFT_TO_TOPRIGHT:
682
az->x1= ar->winrct.xmin - 2*AZONEPAD_ICON;
683
az->y1= ar->winrct.ymax - tot*2*AZONEPAD_ICON;
684
az->x2= ar->winrct.xmin - AZONEPAD_ICON;
685
az->y2= ar->winrct.ymax - tot*AZONEPAD_ICON;
687
case AE_RIGHT_TO_TOPLEFT:
688
az->x1= ar->winrct.xmax + AZONEPAD_ICON;
689
az->y1= ar->winrct.ymax - tot*2*AZONEPAD_ICON;
690
az->x2= ar->winrct.xmax + 2*AZONEPAD_ICON;
691
az->y2= ar->winrct.ymax - tot*AZONEPAD_ICON;
538
695
BLI_init_rcti(&az->rect, az->x1, az->x2, az->y1, az->y2);
540
697
/* if more azones on 1 spot, set offset */
541
for(azt= sa->actionzones.first; azt; azt= azt->next) {
543
if( ABS(az->x1-azt->x1) < 2 && ABS(az->y1-azt->y1) < 2) {
544
if(az->edge=='t' || az->edge=='b') {
698
for (azt= sa->actionzones.first; azt; azt= azt->next) {
700
if ( ABS(az->x1-azt->x1) < 2 && ABS(az->y1-azt->y1) < 2) {
701
if (az->edge==AE_TOP_TO_BOTTOMRIGHT || az->edge==AE_BOTTOM_TO_TOPLEFT) {
545
702
az->x1+= AZONESPOT;
546
703
az->x2+= AZONESPOT;
547
BLI_init_rcti(&az->rect, az->x1, az->x2, az->y1, az->y2);
550
706
az->y1-= AZONESPOT;
551
707
az->y2-= AZONESPOT;
552
BLI_init_rcti(&az->rect, az->x1, az->x2, az->y1, az->y2);
709
BLI_init_rcti(&az->rect, az->x1, az->x2, az->y1, az->y2);
559
static void region_azone_initialize(ScrArea *sa, ARegion *ar, char edge)
715
#define AZONEPAD_TAB_PLUSW 14
716
#define AZONEPAD_TAB_PLUSH 14
718
/* region already made zero sized, in shape of edge */
719
static void region_azone_tab_plus(ScrArea *sa, AZone *az, ARegion *ar)
724
for (azt= sa->actionzones.first; azt; azt= azt->next) {
725
if (azt->edge == az->edge) tot++;
729
case AE_TOP_TO_BOTTOMRIGHT:
730
if (ar->winrct.ymax == sa->totrct.ymin) add= 1; else add= 0;
731
az->x1= ar->winrct.xmax - 2.5*AZONEPAD_TAB_PLUSW;
732
az->y1= ar->winrct.ymax - add;
733
az->x2= ar->winrct.xmax - 1.5*AZONEPAD_TAB_PLUSW;
734
az->y2= ar->winrct.ymax - add + AZONEPAD_TAB_PLUSH;
736
case AE_BOTTOM_TO_TOPLEFT:
737
az->x1= ar->winrct.xmax - 2.5*AZONEPAD_TAB_PLUSW;
738
az->y1= ar->winrct.ymin - AZONEPAD_TAB_PLUSH;
739
az->x2= ar->winrct.xmax - 1.5*AZONEPAD_TAB_PLUSW;
740
az->y2= ar->winrct.ymin;
742
case AE_LEFT_TO_TOPRIGHT:
743
az->x1= ar->winrct.xmin - AZONEPAD_TAB_PLUSH;
744
az->y1= ar->winrct.ymax - 2.5*AZONEPAD_TAB_PLUSW;
745
az->x2= ar->winrct.xmin;
746
az->y2= ar->winrct.ymax - 1.5*AZONEPAD_TAB_PLUSW;
748
case AE_RIGHT_TO_TOPLEFT:
749
az->x1= ar->winrct.xmax - 1;
750
az->y1= ar->winrct.ymax - 2.5*AZONEPAD_TAB_PLUSW;
751
az->x2= ar->winrct.xmax - 1 + AZONEPAD_TAB_PLUSH;
752
az->y2= ar->winrct.ymax - 1.5*AZONEPAD_TAB_PLUSW;
755
/* rect needed for mouse pointer test */
756
BLI_init_rcti(&az->rect, az->x1, az->x2, az->y1, az->y2);
760
#define AZONEPAD_TABW 18
761
#define AZONEPAD_TABH 7
763
/* region already made zero sized, in shape of edge */
764
static void region_azone_tab(ScrArea *sa, AZone *az, ARegion *ar)
769
for (azt= sa->actionzones.first; azt; azt= azt->next) {
770
if (azt->edge == az->edge) tot++;
774
case AE_TOP_TO_BOTTOMRIGHT:
775
if (ar->winrct.ymax == sa->totrct.ymin) add= 1; else add= 0;
776
az->x1= ar->winrct.xmax - 2*AZONEPAD_TABW;
777
az->y1= ar->winrct.ymax - add;
778
az->x2= ar->winrct.xmax - AZONEPAD_TABW;
779
az->y2= ar->winrct.ymax - add + AZONEPAD_TABH;
781
case AE_BOTTOM_TO_TOPLEFT:
782
az->x1= ar->winrct.xmin + AZONEPAD_TABW;
783
az->y1= ar->winrct.ymin - AZONEPAD_TABH;
784
az->x2= ar->winrct.xmin + 2*AZONEPAD_TABW;
785
az->y2= ar->winrct.ymin;
787
case AE_LEFT_TO_TOPRIGHT:
788
az->x1= ar->winrct.xmin + 1 - AZONEPAD_TABH;
789
az->y1= ar->winrct.ymax - 2*AZONEPAD_TABW;
790
az->x2= ar->winrct.xmin + 1;
791
az->y2= ar->winrct.ymax - AZONEPAD_TABW;
793
case AE_RIGHT_TO_TOPLEFT:
794
az->x1= ar->winrct.xmax - 1;
795
az->y1= ar->winrct.ymax - 2*AZONEPAD_TABW;
796
az->x2= ar->winrct.xmax - 1 + AZONEPAD_TABH;
797
az->y2= ar->winrct.ymax - AZONEPAD_TABW;
800
/* rect needed for mouse pointer test */
801
BLI_init_rcti(&az->rect, az->x1, az->x2, az->y1, az->y2);
804
#define AZONEPAD_TRIAW 16
805
#define AZONEPAD_TRIAH 9
808
/* region already made zero sized, in shape of edge */
809
static void region_azone_tria(ScrArea *sa, AZone *az, ARegion *ar)
814
for (azt= sa->actionzones.first; azt; azt= azt->next) {
815
if (azt->edge == az->edge) tot++;
819
case AE_TOP_TO_BOTTOMRIGHT:
820
if (ar->winrct.ymax == sa->totrct.ymin) add= 1; else add= 0;
821
az->x1= ar->winrct.xmax - 2*AZONEPAD_TRIAW;
822
az->y1= ar->winrct.ymax - add;
823
az->x2= ar->winrct.xmax - AZONEPAD_TRIAW;
824
az->y2= ar->winrct.ymax - add + AZONEPAD_TRIAH;
826
case AE_BOTTOM_TO_TOPLEFT:
827
az->x1= ar->winrct.xmin + AZONEPAD_TRIAW;
828
az->y1= ar->winrct.ymin - AZONEPAD_TRIAH;
829
az->x2= ar->winrct.xmin + 2*AZONEPAD_TRIAW;
830
az->y2= ar->winrct.ymin;
832
case AE_LEFT_TO_TOPRIGHT:
833
az->x1= ar->winrct.xmin + 1 - AZONEPAD_TRIAH;
834
az->y1= ar->winrct.ymax - 2*AZONEPAD_TRIAW;
835
az->x2= ar->winrct.xmin + 1;
836
az->y2= ar->winrct.ymax - AZONEPAD_TRIAW;
838
case AE_RIGHT_TO_TOPLEFT:
839
az->x1= ar->winrct.xmax - 1;
840
az->y1= ar->winrct.ymax - 2*AZONEPAD_TRIAW;
841
az->x2= ar->winrct.xmax - 1 + AZONEPAD_TRIAH;
842
az->y2= ar->winrct.ymax - AZONEPAD_TRIAW;
845
/* rect needed for mouse pointer test */
846
BLI_init_rcti(&az->rect, az->x1, az->x2, az->y1, az->y2);
850
static void region_azone_initialize(ScrArea *sa, ARegion *ar, AZEdge edge)
580
879
static void region_azone_add(ScrArea *sa, ARegion *ar, int alignment)
582
/* edge code (t b l r) is where azone will be drawn */
881
/* edge code (t b l r) is along which area edge azone will be drawn */
584
if(alignment==RGN_ALIGN_TOP)
585
region_azone_initialize(sa, ar, 'b');
586
else if(alignment==RGN_ALIGN_BOTTOM)
587
region_azone_initialize(sa, ar, 't');
588
else if(ELEM(alignment, RGN_ALIGN_RIGHT, RGN_OVERLAP_RIGHT))
589
region_azone_initialize(sa, ar, 'l');
590
else if(ELEM(alignment, RGN_ALIGN_LEFT, RGN_OVERLAP_LEFT))
591
region_azone_initialize(sa, ar, 'r');
883
if (alignment==RGN_ALIGN_TOP)
884
region_azone_initialize(sa, ar, AE_BOTTOM_TO_TOPLEFT);
885
else if (alignment==RGN_ALIGN_BOTTOM)
886
region_azone_initialize(sa, ar, AE_TOP_TO_BOTTOMRIGHT);
887
else if (ELEM(alignment, RGN_ALIGN_RIGHT, RGN_OVERLAP_RIGHT))
888
region_azone_initialize(sa, ar, AE_LEFT_TO_TOPRIGHT);
889
else if (ELEM(alignment, RGN_ALIGN_LEFT, RGN_OVERLAP_LEFT))
890
region_azone_initialize(sa, ar, AE_RIGHT_TO_TOPLEFT);
595
893
/* dir is direction to check, not the splitting edge direction! */
596
894
static int rct_fits(rcti *rect, char dir, int size)
599
897
return rect->xmax-rect->xmin - size;
625
923
/* clear state flags first */
626
924
ar->flag &= ~RGN_FLAG_TOO_SMALL;
627
925
/* user errors */
628
if(ar->next==NULL && alignment!=RGN_ALIGN_QSPLIT)
926
if (ar->next==NULL && alignment!=RGN_ALIGN_QSPLIT)
629
927
alignment= RGN_ALIGN_NONE;
929
/* prefsize, for header we stick to exception */
631
930
prefsizex= ar->sizex?ar->sizex:ar->type->prefsizex;
632
prefsizey= ar->sizey?ar->sizey:ar->type->prefsizey;
931
if (ar->regiontype==RGN_TYPE_HEADER)
932
prefsizey= ar->type->prefsizey;
933
else if (ar->regiontype==RGN_TYPE_UI && sa->spacetype == SPACE_FILE) {
934
prefsizey= UI_UNIT_Y * 2 + (UI_UNIT_Y/2);
937
prefsizey= ar->sizey?ar->sizey:ar->type->prefsizey;
634
939
/* hidden is user flag */
635
if(ar->flag & RGN_FLAG_HIDDEN);
940
if (ar->flag & RGN_FLAG_HIDDEN);
636
941
/* XXX floating area region, not handled yet here */
637
else if(alignment == RGN_ALIGN_FLOAT);
942
else if (alignment == RGN_ALIGN_FLOAT);
638
943
/* remainder is too small for any usage */
639
else if( rct_fits(remainder, 'v', 1)<0 || rct_fits(remainder, 'h', 1) < 0 ) {
944
else if ( rct_fits(remainder, 'v', 1)<0 || rct_fits(remainder, 'h', 1) < 0 ) {
640
945
ar->flag |= RGN_FLAG_TOO_SMALL;
642
else if(alignment==RGN_ALIGN_NONE) {
947
else if (alignment==RGN_ALIGN_NONE) {
643
948
/* typically last region */
644
949
ar->winrct= *remainder;
645
950
BLI_init_rcti(remainder, 0, 0, 0, 0);
647
else if(alignment==RGN_ALIGN_TOP || alignment==RGN_ALIGN_BOTTOM) {
952
else if (alignment==RGN_ALIGN_TOP || alignment==RGN_ALIGN_BOTTOM) {
649
if( rct_fits(remainder, 'v', prefsizey) < 0 ) {
954
if ( rct_fits(remainder, 'v', prefsizey) < 0 ) {
650
955
ar->flag |= RGN_FLAG_TOO_SMALL;
653
958
int fac= rct_fits(remainder, 'v', prefsizey);
656
961
prefsizey += fac;
658
963
ar->winrct= *remainder;
660
if(alignment==RGN_ALIGN_TOP) {
661
ar->winrct.ymin= ar->winrct.ymax - prefsizey + 1;
662
remainder->ymax= ar->winrct.ymin - 1;
965
if (alignment==RGN_ALIGN_TOP) {
966
ar->winrct.ymin = ar->winrct.ymax - prefsizey + 1;
967
remainder->ymax = ar->winrct.ymin - 1;
665
ar->winrct.ymax= ar->winrct.ymin + prefsizey - 1;
666
remainder->ymin= ar->winrct.ymax + 1;
970
ar->winrct.ymax = ar->winrct.ymin + prefsizey - 1;
971
remainder->ymin = ar->winrct.ymax + 1;
670
else if( ELEM4(alignment, RGN_ALIGN_LEFT, RGN_ALIGN_RIGHT, RGN_OVERLAP_LEFT, RGN_OVERLAP_RIGHT)) {
975
else if ( ELEM4(alignment, RGN_ALIGN_LEFT, RGN_ALIGN_RIGHT, RGN_OVERLAP_LEFT, RGN_OVERLAP_RIGHT)) {
672
if( rct_fits(remainder, 'h', prefsizex) < 0 ) {
977
if ( rct_fits(remainder, 'h', prefsizex) < 0 ) {
673
978
ar->flag |= RGN_FLAG_TOO_SMALL;
676
981
int fac= rct_fits(remainder, 'h', prefsizex);
679
984
prefsizex += fac;
681
986
ar->winrct= *remainder;
683
if(ELEM(alignment, RGN_ALIGN_RIGHT, RGN_OVERLAP_RIGHT)) {
684
ar->winrct.xmin= ar->winrct.xmax - prefsizex + 1;
685
if(alignment==RGN_ALIGN_RIGHT)
686
remainder->xmax= ar->winrct.xmin - 1;
988
if (ELEM(alignment, RGN_ALIGN_RIGHT, RGN_OVERLAP_RIGHT)) {
989
ar->winrct.xmin = ar->winrct.xmax - prefsizex + 1;
990
if (alignment==RGN_ALIGN_RIGHT)
991
remainder->xmax = ar->winrct.xmin - 1;
689
ar->winrct.xmax= ar->winrct.xmin + prefsizex - 1;
690
if(alignment==RGN_ALIGN_LEFT)
691
remainder->xmin= ar->winrct.xmax + 1;
994
ar->winrct.xmax = ar->winrct.xmin + prefsizex - 1;
995
if (alignment==RGN_ALIGN_LEFT)
996
remainder->xmin = ar->winrct.xmax + 1;
695
else if(alignment==RGN_ALIGN_VSPLIT || alignment==RGN_ALIGN_HSPLIT) {
1000
else if (alignment==RGN_ALIGN_VSPLIT || alignment==RGN_ALIGN_HSPLIT) {
696
1001
/* percentage subdiv*/
697
1002
ar->winrct= *remainder;
699
if(alignment==RGN_ALIGN_HSPLIT) {
700
if( rct_fits(remainder, 'h', prefsizex) > 4) {
701
ar->winrct.xmax= (remainder->xmin+remainder->xmax)/2;
702
remainder->xmin= ar->winrct.xmax+1;
1004
if (alignment==RGN_ALIGN_HSPLIT) {
1005
if ( rct_fits(remainder, 'h', prefsizex) > 4) {
1006
ar->winrct.xmax = (remainder->xmin+remainder->xmax)/2;
1007
remainder->xmin = ar->winrct.xmax+1;
705
1010
BLI_init_rcti(remainder, 0, 0, 0, 0);
709
if( rct_fits(remainder, 'v', prefsizey) > 4) {
710
ar->winrct.ymax= (remainder->ymin+remainder->ymax)/2;
711
remainder->ymin= ar->winrct.ymax+1;
1014
if ( rct_fits(remainder, 'v', prefsizey) > 4) {
1015
ar->winrct.ymax = (remainder->ymin+remainder->ymax)/2;
1016
remainder->ymin = ar->winrct.ymax+1;
714
1019
BLI_init_rcti(remainder, 0, 0, 0, 0);
718
else if(alignment==RGN_ALIGN_QSPLIT) {
1023
else if (alignment==RGN_ALIGN_QSPLIT) {
719
1024
ar->winrct= *remainder;
721
1026
/* test if there's still 4 regions left */
723
1028
ARegion *artest= ar->next;
727
1032
artest->alignment= RGN_ALIGN_QSPLIT;
728
1033
artest= artest->next;
733
1038
/* let's stop adding regions */
734
1039
BLI_init_rcti(remainder, 0, 0, 0, 0);
1040
if (G.debug & G_DEBUG)
736
1041
printf("region quadsplit failed\n");
741
if(quad==1) { /* left bottom */
1046
if (quad==1) { /* left bottom */
742
1047
ar->winrct.xmax = (remainder->xmin + remainder->xmax)/2;
743
1048
ar->winrct.ymax = (remainder->ymin + remainder->ymax)/2;
745
else if(quad==2) { /* left top */
1050
else if (quad==2) { /* left top */
746
1051
ar->winrct.xmax = (remainder->xmin + remainder->xmax)/2;
747
1052
ar->winrct.ymin = 1 + (remainder->ymin + remainder->ymax)/2;
749
else if(quad==3) { /* right bottom */
1054
else if (quad==3) { /* right bottom */
750
1055
ar->winrct.xmin = 1 + (remainder->xmin + remainder->xmax)/2;
751
1056
ar->winrct.ymax = (remainder->ymin + remainder->ymax)/2;
764
1069
ar->winx= ar->winrct.xmax - ar->winrct.xmin + 1;
765
1070
ar->winy= ar->winrct.ymax - ar->winrct.ymin + 1;
767
/* restore test exception */
768
if(ar->alignment & RGN_SPLIT_PREV) {
1072
/* set winrect for azones */
1073
if (ar->flag & (RGN_FLAG_HIDDEN|RGN_FLAG_TOO_SMALL)) {
1074
ar->winrct= *remainder;
1076
if (alignment==RGN_ALIGN_TOP)
1077
ar->winrct.ymin = ar->winrct.ymax;
1078
else if (alignment==RGN_ALIGN_BOTTOM)
1079
ar->winrct.ymax = ar->winrct.ymin;
1080
else if (ELEM(alignment, RGN_ALIGN_RIGHT, RGN_OVERLAP_RIGHT))
1081
ar->winrct.xmin = ar->winrct.xmax;
1082
else if (ELEM(alignment, RGN_ALIGN_LEFT, RGN_OVERLAP_LEFT))
1083
ar->winrct.xmax = ar->winrct.xmin;
1084
else /* prevent winrct to be valid */
1085
ar->winrct.xmax = ar->winrct.xmin;
1088
/* restore prev-split exception */
1089
if (ar->alignment & RGN_SPLIT_PREV) {
770
1091
remainder= remainder_prev;
771
1092
ar->prev->winx= ar->prev->winrct.xmax - ar->prev->winrct.xmin + 1;
772
1093
ar->prev->winy= ar->prev->winrct.ymax - ar->prev->winrct.ymin + 1;
776
/* set winrect for azones */
777
if(ar->flag & (RGN_FLAG_HIDDEN|RGN_FLAG_TOO_SMALL)) {
778
ar->winrct= *remainder;
780
if(alignment==RGN_ALIGN_TOP)
781
ar->winrct.ymin= ar->winrct.ymax;
782
else if(alignment==RGN_ALIGN_BOTTOM)
783
ar->winrct.ymax= ar->winrct.ymin;
784
else if(ELEM(alignment, RGN_ALIGN_RIGHT, RGN_OVERLAP_RIGHT))
785
ar->winrct.xmin= ar->winrct.xmax;
786
else if(ELEM(alignment, RGN_ALIGN_LEFT, RGN_OVERLAP_LEFT))
787
ar->winrct.xmax= ar->winrct.xmin;
788
else /* prevent winrct to be valid */
789
ar->winrct.xmax= ar->winrct.xmin;
791
1097
/* in end, add azones, where appropriate */
792
region_azone_add(sa, ar, alignment);
1098
if (ar->regiontype == RGN_TYPE_HEADER && ar->winy + 6 > sa->winy) {
1099
/* The logic for this is: when the header takes up the full area,
1100
* disallow hiding it to view the main window.
1102
* Without this, you can drag down the file selectors header and hide it
1103
* by accident very easily (highly annoying!), the value 6 is arbitrary
1104
* but accounts for small common rounding problems when scaling the UI,
1105
* must be minimum '4' */
1108
region_azone_add(sa, ar, alignment);
795
1111
region_rect_recursive(sa, ar->next, remainder, quad);
798
1114
static void area_calc_totrct(ScrArea *sa, int sizex, int sizey)
800
short rt= CLAMPIS(G.rt, 0, 16);
1116
short rt= 0; // CLAMPIS(G.rt, 0, 16);
802
if(sa->v1->vec.x>0) sa->totrct.xmin= sa->v1->vec.x+1+rt;
803
else sa->totrct.xmin= sa->v1->vec.x;
804
if(sa->v4->vec.x<sizex-1) sa->totrct.xmax= sa->v4->vec.x-1-rt;
805
else sa->totrct.xmax= sa->v4->vec.x;
1118
if (sa->v1->vec.x>0) sa->totrct.xmin = sa->v1->vec.x+1+rt;
1119
else sa->totrct.xmin = sa->v1->vec.x;
1120
if (sa->v4->vec.x<sizex-1) sa->totrct.xmax = sa->v4->vec.x-1-rt;
1121
else sa->totrct.xmax = sa->v4->vec.x;
807
if(sa->v1->vec.y>0) sa->totrct.ymin= sa->v1->vec.y+1+rt;
808
else sa->totrct.ymin= sa->v1->vec.y;
809
if(sa->v2->vec.y<sizey-1) sa->totrct.ymax= sa->v2->vec.y-1-rt;
810
else sa->totrct.ymax= sa->v2->vec.y;
1123
if (sa->v1->vec.y>0) sa->totrct.ymin = sa->v1->vec.y+1+rt;
1124
else sa->totrct.ymin = sa->v1->vec.y;
1125
if (sa->v2->vec.y<sizey-1) sa->totrct.ymax = sa->v2->vec.y-1-rt;
1126
else sa->totrct.ymax = sa->v2->vec.y;
812
1128
/* for speedup */
813
1129
sa->winx= sa->totrct.xmax-sa->totrct.xmin+1;
818
1134
/* used for area initialize below */
819
static void region_subwindow(wmWindowManager *wm, wmWindow *win, ARegion *ar)
1135
static void region_subwindow(wmWindow *win, ARegion *ar)
821
if(ar->flag & (RGN_FLAG_HIDDEN|RGN_FLAG_TOO_SMALL)) {
1137
if (ar->flag & (RGN_FLAG_HIDDEN|RGN_FLAG_TOO_SMALL)) {
823
1139
wm_subwindow_close(win, ar->swinid);
826
else if(ar->swinid==0)
1142
else if (ar->swinid==0)
827
1143
ar->swinid= wm_subwindow_open(win, &ar->winrct);
829
1145
wm_subwindow_position(win, ar->swinid, &ar->winrct);
832
static void ed_default_handlers(wmWindowManager *wm, ListBase *handlers, int flag)
1148
static void ed_default_handlers(wmWindowManager *wm, ScrArea *sa, ListBase *handlers, int flag)
834
1150
/* note, add-handler checks if it already exists */
836
1152
// XXX it would be good to have boundbox checks for some of these...
837
if(flag & ED_KEYMAP_UI) {
1153
if (flag & ED_KEYMAP_UI) {
838
1154
/* user interface widgets */
839
1155
UI_add_region_handlers(handlers);
841
if(flag & ED_KEYMAP_VIEW2D) {
1157
if (flag & ED_KEYMAP_VIEW2D) {
842
1158
/* 2d-viewport handling+manipulation */
843
wmKeyMap *keymap= WM_keymap_find(wm->defaultconf, "View2D", 0, 0);
1159
wmKeyMap *keymap = WM_keymap_find(wm->defaultconf, "View2D", 0, 0);
844
1160
WM_event_add_keymap_handler(handlers, keymap);
846
if(flag & ED_KEYMAP_MARKERS) {
1162
if (flag & ED_KEYMAP_MARKERS) {
847
1163
/* time-markers */
848
wmKeyMap *keymap= WM_keymap_find(wm->defaultconf, "Markers", 0, 0);
849
WM_event_add_keymap_handler(handlers, keymap);
850
// XXX need boundbox check urgently!!!
1164
wmKeyMap *keymap = WM_keymap_find(wm->defaultconf, "Markers", 0, 0);
1166
/* time space only has this keymap, the others get a boundbox restricted map */
1167
if (sa->spacetype!=SPACE_TIME) {
1169
static rcti rect= {0, 10000, 0, 30}; /* same local check for all areas */
1170
ar= BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
1172
WM_event_add_keymap_handler_bb(handlers, keymap, &rect, &ar->winrct);
1176
WM_event_add_keymap_handler(handlers, keymap);
852
if(flag & ED_KEYMAP_ANIMATION) {
1178
if (flag & ED_KEYMAP_ANIMATION) {
853
1179
/* frame changing and timeline operators (for time spaces) */
854
wmKeyMap *keymap= WM_keymap_find(wm->defaultconf, "Animation", 0, 0);
1180
wmKeyMap *keymap = WM_keymap_find(wm->defaultconf, "Animation", 0, 0);
855
1181
WM_event_add_keymap_handler(handlers, keymap);
857
if(flag & ED_KEYMAP_FRAMES) {
1183
if (flag & ED_KEYMAP_FRAMES) {
858
1184
/* frame changing/jumping (for all spaces) */
859
wmKeyMap *keymap= WM_keymap_find(wm->defaultconf, "Frames", 0, 0);
1185
wmKeyMap *keymap = WM_keymap_find(wm->defaultconf, "Frames", 0, 0);
860
1186
WM_event_add_keymap_handler(handlers, keymap);
862
if(flag & ED_KEYMAP_GPENCIL) {
1188
if (flag & ED_KEYMAP_GPENCIL) {
863
1189
/* grease pencil */
864
wmKeyMap *keymap= WM_keymap_find(wm->defaultconf, "Grease Pencil", 0, 0);
1190
wmKeyMap *keymap = WM_keymap_find(wm->defaultconf, "Grease Pencil", 0, 0);
865
1191
WM_event_add_keymap_handler(handlers, keymap);
867
if(flag & ED_KEYMAP_HEADER) {
1193
if (flag & ED_KEYMAP_HEADER) {
868
1194
/* standard keymap for headers regions */
869
wmKeyMap *keymap= WM_keymap_find(wm->defaultconf, "Header", 0, 0);
1195
wmKeyMap *keymap = WM_keymap_find(wm->defaultconf, "Header", 0, 0);
870
1196
WM_event_add_keymap_handler(handlers, keymap);
1199
1529
uiBlockSetEmboss(block, UI_EMBOSSN);
1201
1531
if (sa->flag & HEADER_NO_PULLDOWN) {
1202
uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, 0,
1532
but = uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, 0,
1203
1533
ICON_DISCLOSURE_TRI_RIGHT,
1534
xco,yco,UI_UNIT_X,UI_UNIT_Y-2,
1205
1535
&(sa->flag), 0, 0, 0, 0,
1206
1536
"Show pulldown menus");
1209
uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, 0,
1539
but = uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, 0,
1210
1540
ICON_DISCLOSURE_TRI_DOWN,
1541
xco,yco,UI_UNIT_X,UI_UNIT_Y-2,
1212
1542
&(sa->flag), 0, 0, 0, 0,
1213
1543
"Hide pulldown menus");
1546
uiButClearFlag(but, UI_BUT_UNDO); /* skip undo on screen buttons */
1216
1548
uiBlockSetEmboss(block, UI_EMBOSS);
1550
return xco + UI_UNIT_X;
1221
1553
/************************ standard UI regions ************************/
1223
void ED_region_panels(const bContext *C, ARegion *ar, int vertical, char *context, int contextnr)
1555
void ED_region_panels(const bContext *C, ARegion *ar, int vertical, const char *context, int contextnr)
1225
1557
ScrArea *sa= CTX_wm_area(C);
1226
uiStyle *style= U.uistyles.first;
1558
uiStyle *style= UI_GetStyle();
1227
1559
uiBlock *block;
1230
1562
View2D *v2d= &ar->v2d;
1231
1563
View2DScrollers *scrollers;
1232
int xco, yco, x, y, miny=0, w, em, header, triangle, open, newcontext= 0;
1564
int x, y, xco, yco, w, em, triangle, open, newcontext= 0;
1235
1567
newcontext= UI_view2d_tab_set(v2d, contextnr);
1238
1570
w= v2d->cur.xmax - v2d->cur.xmin;
1239
em= (ar->type->prefsizex)? 10: 20;
1571
em= (ar->type->prefsizex)? UI_UNIT_Y/2: UI_UNIT_Y;
1242
1574
w= UI_PANEL_WIDTH;
1243
em= (ar->type->prefsizex)? 10: 20;
1575
em= (ar->type->prefsizex)? UI_UNIT_Y/2: UI_UNIT_Y;
1247
y= -style->panelouter;
1249
1578
/* create panels */
1250
1579
uiBeginPanels(C, ar);
1252
1581
/* set view2d view matrix for scrolling (without scrollers) */
1253
UI_view2d_view_ortho(C, v2d);
1582
UI_view2d_view_ortho(v2d);
1255
for(pt= ar->type->paneltypes.first; pt; pt= pt->next) {
1584
for (pt= ar->type->paneltypes.first; pt; pt= pt->next) {
1256
1585
/* verify context */
1258
if(pt->context[0] && strcmp(context, pt->context) != 0)
1587
if (pt->context[0] && strcmp(context, pt->context) != 0)
1261
1590
/* draw panel */
1262
if(pt->draw && (!pt->poll || pt->poll(C, pt))) {
1591
if (pt->draw && (!pt->poll || pt->poll(C, pt))) {
1263
1592
block= uiBeginBlock(C, ar, pt->idname, UI_EMBOSS);
1264
1593
panel= uiBeginPanel(sa, ar, block, pt, &open);
1266
1595
/* bad fixed values */
1267
header= (pt->flag & PNL_NO_HEADER)? 0: 20;
1273
if(pt->draw_header && header && (open || vertical)) {
1596
triangle= (int)(UI_UNIT_Y * 1.1f);
1598
if (pt->draw_header && !(pt->flag & PNL_NO_HEADER) && (open || vertical)) {
1274
1599
/* for enabled buttons */
1275
1600
panel->layout= uiBlockLayout(block, UI_LAYOUT_HORIZONTAL, UI_LAYOUT_HEADER,
1276
triangle, header+style->panelspace, header, 1, style);
1601
triangle, UI_UNIT_Y+style->panelspace+2, UI_UNIT_Y, 1, style);
1278
1603
pt->draw_header(C, panel);
1396
1705
ar->v2d.scroll &= ~V2D_SCROLL_VERTICAL_HIDE;
1397
1706
ar->v2d.keepzoom |= V2D_KEEPZOOM;
1399
// correctly initialised User-Prefs?
1400
if(!(ar->v2d.align & V2D_ALIGN_NO_POS_Y))
1708
// correctly initialized User-Prefs?
1709
if (!(ar->v2d.align & V2D_ALIGN_NO_POS_Y))
1401
1710
ar->v2d.flag &= ~V2D_IS_INITIALISED;
1403
1712
UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_PANELS_UI, ar->winx, ar->winy);
1405
keymap= WM_keymap_find(wm->defaultconf, "View2D Buttons List", 0, 0);
1714
keymap = WM_keymap_find(wm->defaultconf, "View2D Buttons List", 0, 0);
1406
1715
WM_event_add_keymap_handler(&ar->handlers, keymap);
1409
1718
void ED_region_header(const bContext *C, ARegion *ar)
1411
uiStyle *style= U.uistyles.first;
1720
uiStyle *style= UI_GetStyle();
1412
1721
uiBlock *block;
1413
1722
uiLayout *layout;
1414
1723
HeaderType *ht;
1415
Header header = {0};
1724
Header header = {NULL};
1416
1725
int maxco, xco, yco;
1726
int headery= ED_area_headersize();
1419
1729
UI_ThemeClearColor((ED_screen_area_active(C))?TH_HEADER:TH_HEADERDESEL);
1420
1730
glClear(GL_COLOR_BUFFER_BIT);
1422
1732
/* set view2d view matrix for scrolling (without scrollers) */
1423
UI_view2d_view_ortho(C, &ar->v2d);
1733
UI_view2d_view_ortho(&ar->v2d);
1428
1738
/* draw all headers types */
1429
for(ht= ar->type->headertypes.first; ht; ht= ht->next) {
1430
block= uiBeginBlock(C, ar, "header buttons", UI_EMBOSS);
1431
layout= uiBlockLayout(block, UI_LAYOUT_HORIZONTAL, UI_LAYOUT_HEADER, xco, yco, HEADERY-6, 1, style);
1739
for (ht= ar->type->headertypes.first; ht; ht= ht->next) {
1740
block= uiBeginBlock(C, ar, ht->idname, UI_EMBOSS);
1741
layout= uiBlockLayout(block, UI_LAYOUT_HORIZONTAL, UI_LAYOUT_HEADER, xco, yco, UI_UNIT_Y, 1, style);
1434
1744
header.type= ht;
1435
1745
header.layout= layout;
1436
1746
ht->draw(C, &header);
1438
1748
/* for view2d */
1439
1749
xco= uiLayoutGetWidth(layout);
1444
1754
uiBlockLayoutResolve(block, &xco, &yco);
1446
1756
/* for view2d */
1450
1760
uiEndBlock(C, block);