diff options
author | Matt Ebb <matt@mke3.net> | 2009-01-04 03:05:40 +0300 |
---|---|---|
committer | Matt Ebb <matt@mke3.net> | 2009-01-04 03:05:40 +0300 |
commit | 3817b1f018971e01f969043fc2c5e4b848fcd2be (patch) | |
tree | 1d924a625549fa1f4925bbf5c39c9c5c30f9ec54 /source | |
parent | 4a8fdd80648d9e8b4fb3639462a822f71d578432 (diff) |
Some tweaks to menu drawing
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/include/UI_interface.h | 2 | ||||
-rw-r--r-- | source/blender/editors/interface/interface.c | 2 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_draw.c | 57 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_regions.c | 11 | ||||
-rw-r--r-- | source/blender/editors/interface/resources.c | 98 |
5 files changed, 87 insertions, 83 deletions
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index 69232d41efe..5c664a1e768 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -180,7 +180,7 @@ void uiEmboss(float x1, float y1, float x2, float y2, int sel); void uiRoundBox(float minx, float miny, float maxx, float maxy, float rad); void uiSetRoundBox(int type); void uiRoundRect(float minx, float miny, float maxx, float maxy, float rad); -void uiDrawMenuBox(float minx, float miny, float maxx, float maxy, short flag); +void uiDrawMenuBox(float minx, float miny, float maxx, float maxy, short flag, short direction); void uiDrawBoxShadow(unsigned char alpha, float minx, float miny, float maxx, float maxy); /* Popup Menu's */ diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index b72cdb17ec4..bfe39c41a0a 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -511,7 +511,7 @@ void uiDrawBlock(const bContext *C, uiBlock *block) glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); if(block->flag & UI_BLOCK_LOOP) - uiDrawMenuBox(block->minx, block->miny, block->maxx, block->maxy, block->flag); + uiDrawMenuBox(block->minx, block->miny, block->maxx, block->maxy, block->flag, block->direction); else if(block->panel) ui_draw_panel(CTX_wm_region(C), block); diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index 5c8bdb55315..0742080e9fd 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -2090,9 +2090,9 @@ static void ui_shadowbox(float minx, float miny, float maxx, float maxy, float s glBegin(GL_POLYGON); glColor4ub(0, 0, 0, alpha); glVertex2f(maxx, miny); - glVertex2f(maxx, maxy-shadsize); + glVertex2f(maxx, maxy-0.3*shadsize); glColor4ub(0, 0, 0, 0); - glVertex2f(maxx+shadsize, maxy-shadsize-shadsize); + glVertex2f(maxx+shadsize, maxy-0.75*shadsize); glVertex2f(maxx+shadsize, miny); glEnd(); @@ -2109,11 +2109,11 @@ static void ui_shadowbox(float minx, float miny, float maxx, float maxy, float s /* bottom quad */ glBegin(GL_POLYGON); glColor4ub(0, 0, 0, alpha); - glVertex2f(minx+shadsize, miny); + glVertex2f(minx+0.3*shadsize, miny); glVertex2f(maxx, miny); glColor4ub(0, 0, 0, 0); glVertex2f(maxx, miny-shadsize); - glVertex2f(minx+shadsize+shadsize, miny-shadsize); + glVertex2f(minx+0.5*shadsize, miny-shadsize); glEnd(); glDisable(GL_BLEND); @@ -2123,33 +2123,48 @@ static void ui_shadowbox(float minx, float miny, float maxx, float maxy, float s void uiDrawBoxShadow(unsigned char alpha, float minx, float miny, float maxx, float maxy) { /* accumulated outline boxes to make shade not linear, is more pleasant */ - ui_shadowbox(minx, miny, maxx, maxy, 6.0, (30*alpha)>>8); - ui_shadowbox(minx, miny, maxx, maxy, 4.0, (70*alpha)>>8); - ui_shadowbox(minx, miny, maxx, maxy, 2.0, (100*alpha)>>8); + ui_shadowbox(minx, miny, maxx, maxy, 11.0, (20*alpha)>>8); + ui_shadowbox(minx, miny, maxx, maxy, 7.0, (40*alpha)>>8); + ui_shadowbox(minx, miny, maxx, maxy, 5.0, (80*alpha)>>8); } // background for pulldowns, pullups, and other drawing temporal menus.... // has to be made themable still (now only color) -void uiDrawMenuBox(float minx, float miny, float maxx, float maxy, short flag) +void uiDrawMenuBox(float minx, float miny, float maxx, float maxy, short flag, short direction) { char col[4]; + int rounded = ELEM(UI_GetThemeValue(TH_BUT_DRAWTYPE), TH_ROUNDED, TH_ROUNDSHADED); + UI_GetThemeColor4ubv(TH_MENU_BACK, col); + if (rounded) { + if (direction == UI_DOWN) { + uiSetRoundBox(12); + miny -= 4.0; + } else if (direction == UI_TOP) { + uiSetRoundBox(3); + maxy += 4.0; + } else { + uiSetRoundBox(0); + } + } + if( (flag & UI_BLOCK_NOSHADOW)==0) { /* accumulated outline boxes to make shade not linear, is more pleasant */ - ui_shadowbox(minx, miny, maxx, maxy, 6.0, (30*col[3])>>8); - ui_shadowbox(minx, miny, maxx, maxy, 4.0, (70*col[3])>>8); - ui_shadowbox(minx, miny, maxx, maxy, 2.0, (100*col[3])>>8); - - glEnable(GL_BLEND); - glColor4ubv((GLubyte *)col); - glRectf(minx-1, miny, minx, maxy); // 1 pixel on left, to distinguish sublevel menus + ui_shadowbox(minx, miny, maxx, maxy, 11.0, (20*col[3])>>8); + ui_shadowbox(minx, miny, maxx, maxy, 7.0, (40*col[3])>>8); + ui_shadowbox(minx, miny, maxx, maxy, 5.0, (80*col[3])>>8); } glEnable(GL_BLEND); glColor4ubv((GLubyte *)col); - glRectf(minx, miny, maxx, maxy); + + if (rounded) { + gl_round_box(GL_POLYGON, minx, miny, maxx, maxy, 4.0); + } else { + glRectf(minx, miny, maxx, maxy); + } glDisable(GL_BLEND); } @@ -3082,6 +3097,14 @@ static void ui_draw_but_CURVE(uiBut *but) fdrawbox(but->x1, but->y1, but->x2, but->y2); } +static void ui_draw_sepr(uiBut *but) +{ + float y = but->y1 + (but->y2 - but->y1)*0.5; + + UI_ThemeColorBlend(TH_MENU_TEXT, TH_MENU_BACK, 0.85); + fdrawline(but->x1, y, but->x2, y); +} + static void ui_draw_roundbox(uiBut *but) { glEnable(GL_BLEND); @@ -3242,7 +3265,7 @@ void ui_draw_but(uiBut *but) break; case SEPR: - // only background + ui_draw_sepr(but); break; case COL: diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index d32cad92569..7361e17079a 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -59,11 +59,13 @@ #include "interface_intern.h" #define MENU_BUTTON_HEIGHT 20 +#define MENU_SEPR_HEIGHT 6 #define B_NOP -1 #define MENU_SHADOW_LEFT -1 #define MENU_SHADOW_BOTTOM -10 #define MENU_SHADOW_RIGHT 10 #define MENU_SHADOW_TOP 1 +#define MENU_ROUNDED_TOP 5 /*********************** Menu Data Parsing ********************* */ @@ -670,15 +672,16 @@ uiMenuBlockHandle *ui_menu_block_create(bContext *C, ARegion *butregion, uiBut * saferct= MEM_callocN(sizeof(uiSafetyRct), "uiSafetyRct"); saferct->safety= block->safety; BLI_addhead(&block->saferct, saferct); + block->direction= UI_TOP; } /* the block and buttons were positioned in window space as in 2.4x, now * these menu blocks are regions so we bring it back to region space. - * additionally we add some padding for the menu shadow */ + * additionally we add some padding for the menu shadow or rounded menus */ ar->winrct.xmin= block->minx + MENU_SHADOW_LEFT; ar->winrct.xmax= block->maxx + MENU_SHADOW_RIGHT; ar->winrct.ymin= block->miny + MENU_SHADOW_BOTTOM; - ar->winrct.ymax= block->maxy + MENU_SHADOW_TOP; + ar->winrct.ymax= block->maxy + MENU_SHADOW_TOP + MENU_ROUNDED_TOP; block->minx -= ar->winrct.xmin; block->maxx -= ar->winrct.xmin; @@ -1429,10 +1432,12 @@ uiBlock *ui_block_func_PUPMENU(bContext *C, uiMenuBlockHandle *handle, void *arg bt->flag= UI_TEXT_LEFT; } uiSetCurFont(block, UI_HELV); + + //uiDefBut(block, SEPR, 0, "", startx, (short)(starty+height)-MENU_SEPR_HEIGHT, width, MENU_SEPR_HEIGHT, NULL, 0.0, 0.0, 0, 0, ""); } x1= startx + width*((int)a/rows); - y1= starty + height - MENU_BUTTON_HEIGHT; + y1= starty + height - MENU_BUTTON_HEIGHT; // - MENU_SEPR_HEIGHT; for(a=0; a<md->nitems; a++) { char *name= md->items[a].str; diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c index 8b9b26c372a..786306cdfb9 100644 --- a/source/blender/editors/interface/resources.c +++ b/source/blender/editors/interface/resources.c @@ -378,73 +378,49 @@ void ui_theme_init_userdef(void) SETCOL(btheme->tui.text, 0,0,0, 255); SETCOL(btheme->tui.text_hi, 255, 255, 255, 255); - SETCOL(btheme->tui.menu_back, 0xD2,0xD2,0xD2, 255); - SETCOL(btheme->tui.menu_item, 0xDA,0xDA,0xDA, 255); + SETCOL(btheme->tui.menu_back, 255, 255, 255, 235); + SETCOL(btheme->tui.menu_item, 255, 255, 255, 20); SETCOL(btheme->tui.menu_hilite, 0x7F,0x7F,0x7F, 255); SETCOL(btheme->tui.menu_text, 0, 0, 0, 255); SETCOL(btheme->tui.menu_text_hi, 255, 255, 255, 255); + btheme->tui.but_drawtype= TH_ROUNDSHADED; - BLI_strncpy(btheme->tui.iconfile, "", sizeof(btheme->tui.iconfile)); - + /* space view3d */ -SETCOL(btheme->tui.outline, 0xA0,0xA0,0xA0, 255); - SETCOL(btheme->tui.neutral, 180, 180, 180, 255); - SETCOL(btheme->tui.action, 180, 180, 180, 255); - SETCOL(btheme->tui.setting, 180, 180, 180, 255); - SETCOL(btheme->tui.setting1, 180, 180, 180, 255); - SETCOL(btheme->tui.setting2, 180, 180, 180, 255); - SETCOL(btheme->tui.num, 143, 143, 143, 255); - SETCOL(btheme->tui.textfield, 143, 142, 143, 255); - SETCOL(btheme->tui.textfield_hi,255, 151, 26, 255); - SETCOL(btheme->tui.popup, 174, 174, 174, 255); - - SETCOL(btheme->tui.text, 0,0,0, 255); - SETCOL(btheme->tui.text_hi, 255, 255, 255, 255); - - SETCOL(btheme->tui.menu_back, 0xD2,0xD2,0xD2, 255); - SETCOL(btheme->tui.menu_item, 0xDA,0xDA,0xDA, 255); - SETCOL(btheme->tui.menu_hilite, 0x7F,0x7F,0x7F, 255); - SETCOL(btheme->tui.menu_text, 0, 0, 0, 255); - SETCOL(btheme->tui.menu_text_hi, 255, 255, 255, 255); - btheme->tui.but_drawtype= TH_ROUNDSHADED; - - BLI_strncpy(btheme->tui.iconfile, "", sizeof(btheme->tui.iconfile)); - - /* space view3d */ - SETCOL(btheme->tv3d.back, 90, 90, 90, 255); - SETCOL(btheme->tv3d.text, 0, 0, 0, 255); - SETCOL(btheme->tv3d.text_hi, 255, 255, 255, 255); - SETCOL(btheme->tv3d.header, 195, 195, 195, 255); - SETCOL(btheme->tv3d.panel, 165, 165, 165, 127); - - SETCOL(btheme->tv3d.shade1, 160, 160, 160, 100); - SETCOL(btheme->tv3d.shade2, 0x7f, 0x70, 0x70, 100); - - SETCOL(btheme->tv3d.grid, 74, 74, 74 , 255); - SETCOL(btheme->tv3d.wire, 0x0, 0x0, 0x0, 255); - SETCOL(btheme->tv3d.lamp, 0, 0, 0, 40); - SETCOL(btheme->tv3d.select, 241, 88, 0, 255); - SETCOL(btheme->tv3d.active, 255, 140, 25, 255); - SETCOL(btheme->tv3d.group, 16, 64, 16, 255); - SETCOL(btheme->tv3d.group_active, 85, 187, 85, 255); - SETCOL(btheme->tv3d.transform, 0xff, 0xff, 0xff, 255); - SETCOL(btheme->tv3d.vertex, 0, 0, 0, 255); - SETCOL(btheme->tv3d.vertex_select, 255, 133, 0, 255); - btheme->tv3d.vertex_size= 3; - SETCOL(btheme->tv3d.edge, 0x0, 0x0, 0x0, 255); - SETCOL(btheme->tv3d.edge_select, 255, 160, 0, 255); - SETCOL(btheme->tv3d.edge_seam, 219, 37, 18, 255); - SETCOL(btheme->tv3d.edge_facesel, 75, 75, 75, 255); - SETCOL(btheme->tv3d.face, 0, 0, 0, 18); - SETCOL(btheme->tv3d.face_select, 255, 133, 0, 60); - SETCOL(btheme->tv3d.normal, 0x22, 0xDD, 0xDD, 255); - SETCOL(btheme->tv3d.face_dot, 255, 133, 0, 255); - btheme->tv3d.facedot_size= 4; - SETCOL(btheme->tv3d.cframe, 0x60, 0xc0, 0x40, 255); - - SETCOL(btheme->tv3d.bone_solid, 200, 200, 200, 255); - SETCOL(btheme->tv3d.bone_pose, 80, 200, 255, 80); // alpha 80 is not meant editable, used for wire+action draw + SETCOL(btheme->tv3d.back, 90, 90, 90, 255); + SETCOL(btheme->tv3d.text, 0, 0, 0, 255); + SETCOL(btheme->tv3d.text_hi, 255, 255, 255, 255); + SETCOL(btheme->tv3d.header, 195, 195, 195, 255); + SETCOL(btheme->tv3d.panel, 165, 165, 165, 127); + + SETCOL(btheme->tv3d.shade1, 160, 160, 160, 100); + SETCOL(btheme->tv3d.shade2, 0x7f, 0x70, 0x70, 100); + + SETCOL(btheme->tv3d.grid, 74, 74, 74 , 255); + SETCOL(btheme->tv3d.wire, 0x0, 0x0, 0x0, 255); + SETCOL(btheme->tv3d.lamp, 0, 0, 0, 40); + SETCOL(btheme->tv3d.select, 241, 88, 0, 255); + SETCOL(btheme->tv3d.active, 255, 140, 25, 255); + SETCOL(btheme->tv3d.group, 16, 64, 16, 255); + SETCOL(btheme->tv3d.group_active, 85, 187, 85, 255); + SETCOL(btheme->tv3d.transform, 0xff, 0xff, 0xff, 255); + SETCOL(btheme->tv3d.vertex, 0, 0, 0, 255); + SETCOL(btheme->tv3d.vertex_select, 255, 133, 0, 255); + btheme->tv3d.vertex_size= 3; + SETCOL(btheme->tv3d.edge, 0x0, 0x0, 0x0, 255); + SETCOL(btheme->tv3d.edge_select, 255, 160, 0, 255); + SETCOL(btheme->tv3d.edge_seam, 219, 37, 18, 255); + SETCOL(btheme->tv3d.edge_facesel, 75, 75, 75, 255); + SETCOL(btheme->tv3d.face, 0, 0, 0, 18); + SETCOL(btheme->tv3d.face_select, 255, 133, 0, 60); + SETCOL(btheme->tv3d.normal, 0x22, 0xDD, 0xDD, 255); + SETCOL(btheme->tv3d.face_dot, 255, 133, 0, 255); + btheme->tv3d.facedot_size= 4; + SETCOL(btheme->tv3d.cframe, 0x60, 0xc0, 0x40, 255); + + SETCOL(btheme->tv3d.bone_solid, 200, 200, 200, 255); + SETCOL(btheme->tv3d.bone_pose, 80, 200, 255, 80); // alpha 80 is not meant editable, used for wire+action draw /* space buttons */ |