Various ui fixes:

- panel drawing now correctly follows scaled view
- made imagewindow buttons using TH_PANEL color back (was too dark)
- click on open/close panel was wrong
- menu items disabling now draws correct
- curve/hsv widgets didn't draw on right locations
- numsliders have nicer interior slider decoration
- new type TOGBUT to enforce old style toggle button (not new type
  'option button' with checkmark
- (temp) disabled live updating while using Curve widget, was 
  too slow to be fun. Needs general solution :)
This commit is contained in:
2009-04-12 13:40:29 +00:00
parent 1fec143198
commit 5cb480cef4
14 changed files with 228 additions and 170 deletions

View File

@@ -191,6 +191,7 @@ typedef struct uiPopupBlockHandle uiPopupBlockHandle;
#define FTPREVIEW (35<<9)
#define NUMABS (36<<9)
#define HMENU (37<<9)
#define TOGBUT (38<<9)
#define BUTTYPE (63<<9)
/* Drawing

View File

@@ -710,7 +710,7 @@ void uiDrawBlock(const bContext *C, uiBlock *block)
glPushMatrix();
glLoadIdentity();
wmOrtho2(0.0f, ar->winx, 0.0f, ar->winy);
wmOrtho2(-0.01f, ar->winx-0.01f, -0.01f, ar->winy-0.01f);
/* back */
if(block->flag & UI_BLOCK_LOOP)
@@ -760,6 +760,7 @@ static void ui_is_but_sel(uiBut *but)
case KEYEVT:
if (value==-1) push= 1;
break;
case TOGBUT:
case TOG:
case TOGR:
case TOG3:

View File

@@ -509,17 +509,17 @@ static void ui_draw_but_CHARTAB(uiBut *but)
charmax = G.charmax = 0xffff;
/* Calculate the size of the button */
width = abs(but->x2 - but->x1);
height = abs(but->y2 - but->y1);
width = abs(rect->xmax - rect->xmin);
height = abs(rect->ymax - rect->ymin);
butw = floor(width / 12);
buth = floor(height / 6);
/* Initialize variables */
sx = but->x1;
ex = but->x1 + butw;
sy = but->y1 + height - buth;
ey = but->y1 + height;
sx = rect->xmin;
ex = rect->xmin + butw;
sy = rect->ymin + height - buth;
ey = rect->ymin + height;
cs = G.charstart;
@@ -555,7 +555,7 @@ static void ui_draw_but_CHARTAB(uiBut *but)
glShadeModel(GL_SMOOTH);
glColor3ub(200, 200, 200);
glRectf((but->x1), (but->y1), (but->x2), (but->y2));
glRectf((rect->xmin), (rect->ymin), (rect->xmax), (rect->ymax));
glColor3ub(0, 0, 0);
for(y = 0; y < 6; y++)
@@ -633,8 +633,8 @@ static void ui_draw_but_CHARTAB(uiBut *but)
/* Add the y position and reset x position */
sy -= buth;
ey -= buth;
sx = but->x1;
ex = but->x1 + butw;
sx = rect->xmin;
ex = rect->xmin + butw;
}
glShadeModel(GL_FLAT);
@@ -663,7 +663,7 @@ static void ui_draw_but_CHARTAB(uiBut *but)
#endif // INTERNATIONAL
#endif
void ui_draw_but_COLORBAND(uiBut *but)
void ui_draw_but_COLORBAND(uiBut *but, rcti *rect)
{
ColorBand *coba;
CBData *cbd;
@@ -674,10 +674,10 @@ void ui_draw_but_COLORBAND(uiBut *but)
coba= (ColorBand *)(but->editcoba? but->editcoba: but->poin);
if(coba==NULL) return;
x1= but->x1;
y1= but->y1;
sizex= but->x2-x1;
sizey= but->y2-y1;
x1= rect->xmin;
y1= rect->ymin;
sizex= rect->xmax-x1;
sizey= rect->ymax-y1;
/* first background, to show tranparency */
dx= sizex/12.0;
@@ -790,7 +790,7 @@ void ui_draw_but_COLORBAND(uiBut *but)
glEnd();
}
void ui_draw_but_NORMAL(uiBut *but)
void ui_draw_but_NORMAL(uiBut *but, rcti *rect)
{
static GLuint displist=0;
int a, old[8];
@@ -804,7 +804,7 @@ void ui_draw_but_NORMAL(uiBut *but)
/* backdrop */
UI_ThemeColor(TH_BUT_NEUTRAL);
uiSetRoundBox(15);
gl_round_box(GL_POLYGON, but->x1, but->y1, but->x2, but->y2, 5.0f);
gl_round_box(GL_POLYGON, rect->xmin, rect->ymin, rect->xmax, rect->ymax, 5.0f);
/* sphere color */
glMaterialfv(GL_FRONT, GL_DIFFUSE, diffn);
@@ -830,8 +830,8 @@ void ui_draw_but_NORMAL(uiBut *but)
/* transform to button */
glPushMatrix();
glTranslatef(but->x1 + 0.5f*(but->x2-but->x1), but->y1+ 0.5f*(but->y2-but->y1), 0.0f);
size= (but->x2-but->x1)/200.f;
glTranslatef(rect->xmin + 0.5f*(rect->xmax-rect->xmin), rect->ymin+ 0.5f*(rect->ymax-rect->ymin), 0.0f);
size= (rect->xmax-rect->xmin)/200.f;
glScalef(size, size, size);
if(displist==0) {
@@ -866,38 +866,38 @@ void ui_draw_but_NORMAL(uiBut *but)
}
}
static void ui_draw_but_curve_grid(uiBut *but, float zoomx, float zoomy, float offsx, float offsy, float step)
static void ui_draw_but_curve_grid(rcti *rect, float zoomx, float zoomy, float offsx, float offsy, float step)
{
float dx, dy, fx, fy;
glBegin(GL_LINES);
dx= step*zoomx;
fx= but->x1 + zoomx*(-offsx);
if(fx > but->x1) fx -= dx*( floor(fx-but->x1));
while(fx < but->x2) {
glVertex2f(fx, but->y1);
glVertex2f(fx, but->y2);
fx= rect->xmin + zoomx*(-offsx);
if(fx > rect->xmin) fx -= dx*( floor(fx-rect->xmin));
while(fx < rect->xmax) {
glVertex2f(fx, rect->ymin);
glVertex2f(fx, rect->ymax);
fx+= dx;
}
dy= step*zoomy;
fy= but->y1 + zoomy*(-offsy);
if(fy > but->y1) fy -= dy*( floor(fy-but->y1));
while(fy < but->y2) {
glVertex2f(but->x1, fy);
glVertex2f(but->x2, fy);
fy= rect->ymin + zoomy*(-offsy);
if(fy > rect->ymin) fy -= dy*( floor(fy-rect->ymin));
while(fy < rect->ymax) {
glVertex2f(rect->xmin, fy);
glVertex2f(rect->xmax, fy);
fy+= dy;
}
glEnd();
}
void ui_draw_but_CURVE(ARegion *ar, uiBut *but)
void ui_draw_but_CURVE(ARegion *ar, uiBut *but, rcti *rect)
{
CurveMapping *cumap;
CurveMap *cuma;
CurveMapPoint *cmp;
float fx, fy, dx, dy, fac[2], zoomx, zoomy, offsx, offsy;
float fx, fy, fac[2], zoomx, zoomy, offsx, offsy;
GLint scissor[4];
int a;
@@ -906,46 +906,42 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but)
/* need scissor test, curve can draw outside of boundary */
glGetIntegerv(GL_VIEWPORT, scissor);
fx= but->x1; fy= but->y1;
ui_block_to_window_fl(ar, but->block, &fx, &fy);
dx= but->x2; dy= but->y2;
ui_block_to_window_fl(ar, but->block, &dx, &dy);
glScissor((int)floor(fx), (int)floor(fy), (int)ceil(dx-fx), (int)ceil(dy-fy));
glScissor(ar->winrct.xmin + rect->xmin, ar->winrct.ymin+rect->ymin, rect->xmax-rect->xmin, rect->ymax-rect->ymin);
/* calculate offset and zoom */
zoomx= (but->x2-but->x1-2.0*but->aspect)/(cumap->curr.xmax - cumap->curr.xmin);
zoomy= (but->y2-but->y1-2.0*but->aspect)/(cumap->curr.ymax - cumap->curr.ymin);
zoomx= (rect->xmax-rect->xmin-2.0*but->aspect)/(cumap->curr.xmax - cumap->curr.xmin);
zoomy= (rect->ymax-rect->ymin-2.0*but->aspect)/(cumap->curr.ymax - cumap->curr.ymin);
offsx= cumap->curr.xmin-but->aspect/zoomx;
offsy= cumap->curr.ymin-but->aspect/zoomy;
/* backdrop */
if(cumap->flag & CUMA_DO_CLIP) {
UI_ThemeColorShade(TH_BUT_NEUTRAL, -20);
glRectf(but->x1, but->y1, but->x2, but->y2);
glRectf(rect->xmin, rect->ymin, rect->xmax, rect->ymax);
UI_ThemeColor(TH_BUT_NEUTRAL);
glRectf(but->x1 + zoomx*(cumap->clipr.xmin-offsx),
but->y1 + zoomy*(cumap->clipr.ymin-offsy),
but->x1 + zoomx*(cumap->clipr.xmax-offsx),
but->y1 + zoomy*(cumap->clipr.ymax-offsy));
glRectf(rect->xmin + zoomx*(cumap->clipr.xmin-offsx),
rect->ymin + zoomy*(cumap->clipr.ymin-offsy),
rect->xmin + zoomx*(cumap->clipr.xmax-offsx),
rect->ymin + zoomy*(cumap->clipr.ymax-offsy));
}
else {
UI_ThemeColor(TH_BUT_NEUTRAL);
glRectf(but->x1, but->y1, but->x2, but->y2);
glRectf(rect->xmin, rect->ymin, rect->xmax, rect->ymax);
}
/* grid, every .25 step */
UI_ThemeColorShade(TH_BUT_NEUTRAL, -16);
ui_draw_but_curve_grid(but, zoomx, zoomy, offsx, offsy, 0.25f);
ui_draw_but_curve_grid(rect, zoomx, zoomy, offsx, offsy, 0.25f);
/* grid, every 1.0 step */
UI_ThemeColorShade(TH_BUT_NEUTRAL, -24);
ui_draw_but_curve_grid(but, zoomx, zoomy, offsx, offsy, 1.0f);
ui_draw_but_curve_grid(rect, zoomx, zoomy, offsx, offsy, 1.0f);
/* axes */
UI_ThemeColorShade(TH_BUT_NEUTRAL, -50);
glBegin(GL_LINES);
glVertex2f(but->x1, but->y1 + zoomy*(-offsy));
glVertex2f(but->x2, but->y1 + zoomy*(-offsy));
glVertex2f(but->x1 + zoomx*(-offsx), but->y1);
glVertex2f(but->x1 + zoomx*(-offsx), but->y2);
glVertex2f(rect->xmin, rect->ymin + zoomy*(-offsy));
glVertex2f(rect->xmax, rect->ymin + zoomy*(-offsy));
glVertex2f(rect->xmin + zoomx*(-offsx), rect->ymin);
glVertex2f(rect->xmin + zoomx*(-offsx), rect->ymax);
glEnd();
/* cfra option */
@@ -953,8 +949,8 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but)
if(cumap->flag & CUMA_DRAW_CFRA) {
glColor3ub(0x60, 0xc0, 0x40);
glBegin(GL_LINES);
glVertex2f(but->x1 + zoomx*(cumap->sample[0]-offsx), but->y1);
glVertex2f(but->x1 + zoomx*(cumap->sample[0]-offsx), but->y2);
glVertex2f(rect->xmin + zoomx*(cumap->sample[0]-offsx), rect->ymin);
glVertex2f(rect->xmin + zoomx*(cumap->sample[0]-offsx), rect->ymax);
glEnd();
}*/
/* sample option */
@@ -965,8 +961,8 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but)
glColor3ub(240, 240, 240);
glBegin(GL_LINES);
glVertex2f(but->x1 + zoomx*(lum-offsx), but->y1);
glVertex2f(but->x1 + zoomx*(lum-offsx), but->y2);
glVertex2f(rect->xmin + zoomx*(lum-offsx), rect->ymin);
glVertex2f(rect->xmin + zoomx*(lum-offsx), rect->ymax);
glEnd();
}
else {
@@ -978,8 +974,8 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but)
glColor3ub(100, 100, 240);
glBegin(GL_LINES);
glVertex2f(but->x1 + zoomx*(cumap->sample[cumap->cur]-offsx), but->y1);
glVertex2f(but->x1 + zoomx*(cumap->sample[cumap->cur]-offsx), but->y2);
glVertex2f(rect->xmin + zoomx*(cumap->sample[cumap->cur]-offsx), rect->ymin);
glVertex2f(rect->xmin + zoomx*(cumap->sample[cumap->cur]-offsx), rect->ymax);
glEnd();
}
}*/
@@ -996,23 +992,23 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but)
/* first point */
if((cuma->flag & CUMA_EXTEND_EXTRAPOLATE)==0)
glVertex2f(but->x1, but->y1 + zoomy*(cmp[0].y-offsy));
glVertex2f(rect->xmin, rect->ymin + zoomy*(cmp[0].y-offsy));
else {
fx= but->x1 + zoomx*(cmp[0].x-offsx + cuma->ext_in[0]);
fy= but->y1 + zoomy*(cmp[0].y-offsy + cuma->ext_in[1]);
fx= rect->xmin + zoomx*(cmp[0].x-offsx + cuma->ext_in[0]);
fy= rect->ymin + zoomy*(cmp[0].y-offsy + cuma->ext_in[1]);
glVertex2f(fx, fy);
}
for(a=0; a<=CM_TABLE; a++) {
fx= but->x1 + zoomx*(cmp[a].x-offsx);
fy= but->y1 + zoomy*(cmp[a].y-offsy);
fx= rect->xmin + zoomx*(cmp[a].x-offsx);
fy= rect->ymin + zoomy*(cmp[a].y-offsy);
glVertex2f(fx, fy);
}
/* last point */
if((cuma->flag & CUMA_EXTEND_EXTRAPOLATE)==0)
glVertex2f(but->x2, but->y1 + zoomy*(cmp[CM_TABLE].y-offsy));
glVertex2f(rect->xmax, rect->ymin + zoomy*(cmp[CM_TABLE].y-offsy));
else {
fx= but->x1 + zoomx*(cmp[CM_TABLE].x-offsx - cuma->ext_out[0]);
fy= but->y1 + zoomy*(cmp[CM_TABLE].y-offsy - cuma->ext_out[1]);
fx= rect->xmin + zoomx*(cmp[CM_TABLE].x-offsx - cuma->ext_out[0]);
fy= rect->ymin + zoomy*(cmp[CM_TABLE].y-offsy - cuma->ext_out[1]);
glVertex2f(fx, fy);
}
glEnd();
@@ -1028,8 +1024,8 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but)
UI_ThemeColor(TH_TEXT_HI);
else
UI_ThemeColor(TH_TEXT);
fac[0]= but->x1 + zoomx*(cmp[a].x-offsx);
fac[1]= but->y1 + zoomy*(cmp[a].y-offsy);
fac[0]= rect->xmin + zoomx*(cmp[a].x-offsx);
fac[1]= rect->ymin + zoomy*(cmp[a].y-offsy);
bglVertex2fv(fac);
}
bglEnd();
@@ -1040,7 +1036,7 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but)
/* outline */
UI_ThemeColor(TH_BUT_OUTLINE);
fdrawbox(but->x1, but->y1, but->x2, but->y2);
fdrawbox(rect->xmin, rect->ymin, rect->xmax, rect->ymax);
}

View File

@@ -564,6 +564,7 @@ static void ui_apply_button(bContext *C, uiBlock *block, uiBut *but, uiHandleBut
case TEX:
ui_apply_but_TEX(C, but, data);
break;
case TOGBUT:
case TOG:
case TOGR:
case ICONTOG:
@@ -2658,6 +2659,7 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, wmEvent *event)
case KEYEVT:
retval= ui_do_but_KEYEVT(C, but, data, event);
break;
case TOGBUT:
case TOG:
case TOGR:
case ICONTOG:
@@ -2972,7 +2974,7 @@ static void button_activate_init(bContext *C, ARegion *ar, uiBut *but, uiButtonA
data= MEM_callocN(sizeof(uiHandleButtonData), "uiHandleButtonData");
data->window= CTX_wm_window(C);
data->region= ar;
data->interactive= 1;
data->interactive= but->type==BUT_CURVE?0:1; // XXX temp
data->state = BUTTON_STATE_INIT;
/* activate button */

View File

@@ -373,9 +373,9 @@ extern void gl_round_box(int mode, float minx, float miny, float maxx, float max
extern void gl_round_box_shade(int mode, float minx, float miny, float maxx, float maxy, float rad, float shadetop, float shadedown);
extern void gl_round_box_vertical_shade(int mode, float minx, float miny, float maxx, float maxy, float rad, float shadeLeft, float shadeRight);
void ui_draw_but_COLORBAND(uiBut *but);
void ui_draw_but_NORMAL(uiBut *but);
void ui_draw_but_CURVE(ARegion *ar, uiBut *but);
void ui_draw_but_COLORBAND(uiBut *but, rcti *rect);
void ui_draw_but_NORMAL(uiBut *but, rcti *rect);
void ui_draw_but_CURVE(ARegion *ar, uiBut *but, rcti *rect);
/* interface_handlers.c */

View File

@@ -458,6 +458,19 @@ void ui_draw_tria_icon(float x, float y, char dir)
}
}
/* triangle 'icon' inside rect */
void ui_draw_tria_rect(rctf *rect, char dir)
{
if(dir=='h') {
float half= 0.5f*(rect->ymax - rect->ymin);
ui_draw_anti_tria(rect->xmin, rect->ymin, rect->xmin, rect->ymax, rect->xmax, rect->ymin+half);
}
else {
float half= 0.5f*(rect->xmax - rect->xmin);
ui_draw_anti_tria(rect->xmin, rect->ymax, rect->xmax, rect->ymax, rect->xmin+half, rect->ymin);
}
}
void ui_draw_anti_x(float x1, float y1, float x2, float y2)
{
@@ -512,15 +525,15 @@ static void ui_draw_panel_scalewidget(rcti *rect)
glDisable(GL_BLEND);
}
static void ui_draw_panel_dragwidget(rcti *rect)
static void ui_draw_panel_dragwidget(rctf *rect)
{
float xmin, xmax, dx;
float ymin, ymax, dy;
xmin= rect->xmax-10-PNL_HEADER+8;
xmax= rect->xmax-10;
ymin= rect->ymax+4;
ymax= rect->ymax+PNL_HEADER-4;
xmin= rect->xmin;
xmax= rect->xmax;
ymin= rect->ymin;
ymax= rect->ymax;
dx= 0.333f*(xmax-xmin);
dy= 0.333f*(ymax-ymin);
@@ -539,8 +552,9 @@ static void ui_draw_panel_dragwidget(rcti *rect)
}
static void ui_draw_panel_header_style(ARegion *ar, uiStyle *style, Panel *panel, rcti *rect)
static void ui_draw_panel_header_style(ARegion *ar, uiStyle *style, uiBlock *block, rcti *rect)
{
Panel *panel= block->panel;
Panel *pa;
rcti hrect;
float width;
@@ -548,16 +562,14 @@ static void ui_draw_panel_header_style(ARegion *ar, uiStyle *style, Panel *panel
char *activename= panel->drawname[0]?panel->drawname:panel->panelname;
char *panelname;
ui_draw_panel_dragwidget(rect);
/* count */
for(pa= ar->panels.first; pa; pa=pa->next)
if(pa->active)
if(pa->paneltab==panel)
nr++;
pnl_icons= PNL_ICON+8;
if(panel->control & UI_PNL_CLOSE) pnl_icons+= PNL_ICON;
if(panel->control & UI_PNL_CLOSE) pnl_icons=(2*PNL_ICON+10)/block->aspect;
else pnl_icons= (PNL_ICON+10)/block->aspect;
if(nr==1) {
@@ -565,17 +577,15 @@ static void ui_draw_panel_header_style(ARegion *ar, uiStyle *style, Panel *panel
/* draw text label */
UI_ThemeColor(TH_TEXT);
hrect= *rect;
hrect.xmin= rect->xmin+pnl_icons;
hrect.ymin= rect->ymax;
hrect.xmax= rect->xmax;
hrect.ymax= rect->ymax + PNL_HEADER;
uiStyleFontDraw(&style->paneltitle, &hrect, activename);
return;
}
a= 0;
width= (panel->sizex - 3 - pnl_icons - PNL_ICON)/nr;
width= (rect->xmax-rect->xmin - 3 - pnl_icons - PNL_ICON)/nr;
for(pa= ar->panels.first; pa; pa=pa->next) {
panelname= pa->drawname[0]?pa->drawname:pa->panelname;
@@ -586,10 +596,9 @@ static void ui_draw_panel_header_style(ARegion *ar, uiStyle *style, Panel *panel
else
UI_ThemeColorBlend(TH_TEXT, TH_BACK, 0.5f);
hrect= *rect;
hrect.xmin= rect->xmin+pnl_icons + a*width;
hrect.ymin= rect->ymax;
hrect.xmax= hrect.xmin + width;
hrect.ymax= hrect.ymin + PNL_HEADER;
uiStyleFontDraw(&style->paneltitle, &hrect, panelname);
a++;
@@ -597,13 +606,33 @@ static void ui_draw_panel_header_style(ARegion *ar, uiStyle *style, Panel *panel
}
}
static void rectf_scale(rctf *rect, float scale)
{
float centx= 0.5f*(rect->xmin+rect->xmax);
float centy= 0.5f*(rect->ymin+rect->ymax);
float sizex= 0.5f*scale*(rect->xmax - rect->xmin);
float sizey= 0.5f*scale*(rect->ymax - rect->ymin);
rect->xmin= centx - sizex;
rect->xmax= centx + sizex;
rect->ymin= centy - sizey;
rect->ymax= centy + sizey;
}
void ui_draw_panel(ARegion *ar, uiStyle *style, uiBlock *block, rcti *rect)
{
Panel *panel= block->panel, *prev;
rcti headrect;
rctf itemrect;
int ofsx;
if(panel->paneltab) return;
/* calculate header rect */
headrect= *rect;
headrect.ymin= headrect.ymax;
headrect.ymax= headrect.ymin + floor(PNL_HEADER/block->aspect);
/* divider only when there's a previous panel */
prev= panel->prev;
while(prev) {
@@ -612,21 +641,29 @@ void ui_draw_panel(ARegion *ar, uiStyle *style, uiBlock *block, rcti *rect)
}
if(prev) {
float minx= rect->xmin+10;
float maxx= rect->xmax-10;
float y= rect->ymax + PNL_HEADER;
float minx= rect->xmin+10.0f/block->aspect;
float maxx= rect->xmax-10.0f/block->aspect;
float y= headrect.ymax;
glEnable(GL_BLEND);
glColor4f(0.0f, 0.0f, 0.0f, 0.5f);
fdrawline(minx, y, maxx, y);
fdrawline(minx, y+1, maxx, y+1);
glColor4f(1.0f, 1.0f, 1.0f, 0.25f);
fdrawline(minx, y-1, maxx, y-1);
fdrawline(minx, y, maxx, y);
glDisable(GL_BLEND);
}
/* title */
if(!(panel->flag & PNL_CLOSEDX)) {
ui_draw_panel_header_style(ar, style, panel, rect);
ui_draw_panel_header_style(ar, style, block, &headrect);
/* itemrect smaller */
itemrect.xmax= headrect.xmax - 10.0f/block->aspect;
itemrect.xmin= itemrect.xmax - (headrect.ymax-headrect.ymin);
itemrect.ymin= headrect.ymin;
itemrect.ymax= headrect.ymax;
rectf_scale(&itemrect, 0.8f);
ui_draw_panel_dragwidget(&itemrect);
}
/* if the panel is minimized vertically:
@@ -654,14 +691,14 @@ void ui_draw_panel(ARegion *ar, uiStyle *style, uiBlock *block, rcti *rect)
else uiSetRoundBox(3);
UI_ThemeColorShade(TH_HEADER, -120);
uiRoundRect(rect->xmin, rect->ymin, rect->xmax, rect->ymax+PNL_HEADER, 8);
uiRoundRect(rect->xmin, rect->ymin, rect->xmax, headrect.ymax+1, 8);
}
if(panel->flag & PNL_OVERLAP) {
if(panel->control & UI_PNL_SOLID) uiSetRoundBox(15);
else uiSetRoundBox(3);
UI_ThemeColor(TH_TEXT_HI);
uiRoundRect(rect->xmin, rect->ymin, rect->xmax, rect->ymax+PNL_HEADER, 8);
uiRoundRect(rect->xmin, rect->ymin, rect->xmax, headrect.ymax+1, 8);
}
if(panel->control & UI_PNL_SCALE)
@@ -680,12 +717,20 @@ void ui_draw_panel(ARegion *ar, uiStyle *style, uiBlock *block, rcti *rect)
/* draw collapse icon */
UI_ThemeColor(TH_TEXT);
/* itemrect smaller */
itemrect.xmin= headrect.xmin + 10.0f/block->aspect;
itemrect.xmax= itemrect.xmin + (headrect.ymax-headrect.ymin);
itemrect.ymin= headrect.ymin;
itemrect.ymax= headrect.ymax;
rectf_scale(&itemrect, 0.7f);
if(panel->flag & PNL_CLOSEDY)
ui_draw_tria_icon(rect->xmin+6+ofsx, rect->ymax+3, 'h');
ui_draw_tria_rect(&itemrect, 'h');
else if(panel->flag & PNL_CLOSEDX)
ui_draw_tria_icon(rect->xmin+7, rect->ymax+3, 'h');
ui_draw_tria_rect(&itemrect, 'h');
else
ui_draw_tria_icon(rect->xmin+6+ofsx, rect->ymax+3, 'v');
ui_draw_tria_rect(&itemrect, 'v');
}
@@ -1252,15 +1297,17 @@ static void ui_handle_panel_header(bContext *C, uiBlock *block, int mx, int my)
/* mouse coordinates in panel space! */
/* XXX weak code, currently it assumes layout style for location of widgets */
/* check open/collapsed button */
if(block->panel->flag & PNL_CLOSEDX) {
if(my >= block->maxy) button= 1;
}
else if(block->panel->control & UI_PNL_CLOSE) {
if(mx <= block->minx+PNL_ICON-2) button= 2;
else if(mx <= block->minx+2*PNL_ICON+2) button= 1;
if(mx <= block->minx+10+PNL_ICON-2) button= 2;
else if(mx <= block->minx+10+2*PNL_ICON+2) button= 1;
}
else if(mx <= block->minx+PNL_ICON+2) {
else if(mx <= block->minx+10+PNL_ICON+2) {
button= 1;
}

View File

@@ -1159,7 +1159,12 @@ static void widget_state_menu_item(uiWidgetType *wt, int state)
{
wt->wcol= *(wt->wcol_theme);
if(state & UI_ACTIVE) {
if(state & UI_BUT_DISABLED) {
wt->wcol.text[0]= 0.5f*(wt->wcol.text[0]+wt->wcol.text_sel[0]);
wt->wcol.text[1]= 0.5f*(wt->wcol.text[1]+wt->wcol.text_sel[1]);
wt->wcol.text[2]= 0.5f*(wt->wcol.text[2]+wt->wcol.text_sel[2]);
}
else if(state & UI_ACTIVE) {
QUATCOPY(wt->wcol.inner, wt->wcol.inner_sel);
VECCOPY(wt->wcol.text, wt->wcol.text_sel);
@@ -1236,7 +1241,7 @@ static void widget_menu_back(uiWidgetColors *wcol, rcti *rect, int flag, int dir
/* ************ custom buttons, old stuff ************** */
/* draws in resolution of 20x4 colors */
static void ui_draw_but_HSVCUBE(uiBut *but)
static void ui_draw_but_HSVCUBE(uiBut *but, rcti *rect)
{
int a;
float h,s,v;
@@ -1314,10 +1319,10 @@ static void ui_draw_but_HSVCUBE(uiBut *but)
}
// rect
sx1= but->x1 + dx*(but->x2-but->x1);
sx2= but->x1 + (dx+0.05)*(but->x2-but->x1);
sy= but->y1;
dy= (but->y2-but->y1)/3.0;
sx1= rect->xmin + dx*(rect->xmax-rect->xmin);
sx2= rect->xmin + (dx+0.05)*(rect->xmax-rect->xmin);
sy= rect->ymin;
dy= (rect->ymax-rect->ymin)/3.0;
glBegin(GL_QUADS);
for(a=0; a<3; a++, sy+=dy) {
@@ -1339,16 +1344,16 @@ static void ui_draw_but_HSVCUBE(uiBut *but)
glShadeModel(GL_FLAT);
/* cursor */
x= but->x1 + x*(but->x2-but->x1);
y= but->y1 + y*(but->y2-but->y1);
CLAMP(x, but->x1+3.0, but->x2-3.0);
CLAMP(y, but->y1+3.0, but->y2-3.0);
x= rect->xmin + x*(rect->xmax-rect->xmin);
y= rect->ymin + y*(rect->ymax-rect->ymin);
CLAMP(x, rect->xmin+3.0, rect->xmax-3.0);
CLAMP(y, rect->ymin+3.0, rect->ymax-3.0);
fdrawXORcirc(x, y, 3.1);
/* outline */
glColor3ub(0, 0, 0);
fdrawbox((but->x1), (but->y1), (but->x2), (but->y2));
fdrawbox((rect->xmin), (rect->ymin), (rect->xmax), (rect->ymax));
}
@@ -1381,7 +1386,7 @@ static void widget_numslider(uiBut *but, uiWidgetColors *wcol, rcti *rect, int s
uiWidgetBase wtb, wtb1;
rcti rect1;
double value;
float offs, fac, inner[3];
float offs, fac, outline[3];
widget_init(&wtb);
widget_init(&wtb1);
@@ -1396,21 +1401,22 @@ static void widget_numslider(uiBut *but, uiWidgetColors *wcol, rcti *rect, int s
widgetbase_draw(&wtb, wcol);
/* slider part */
roundboxalign &= ~6;
rect1= *rect;
value= ui_get_but_val(but);
fac= (value-but->softmin)*(rect1.xmax - rect1.xmin - 2.0f*offs)/(but->softmax - but->softmin);
rect1.xmax= rect1.xmin + fac + offs;
rect1.xmax= rect1.xmin + fac + 2.0f*offs;
round_box_edges(&wtb1, roundboxalign, &rect1, offs);
wtb1.outline= 0;
VECCOPY(inner, wcol->inner);
VECCOPY(outline, wcol->outline);
VECCOPY(wcol->outline, wcol->item);
VECCOPY(wcol->inner, wcol->item);
SWAP(float, wcol->shadetop, wcol->shadedown);
widgetbase_draw(&wtb1, wcol);
VECCOPY(wcol->inner, inner);
VECCOPY(wcol->outline, outline);
SWAP(float, wcol->shadetop, wcol->shadedown);
/* outline */
wtb.outline= 1;
@@ -1787,6 +1793,9 @@ void ui_draw_but(ARegion *ar, uiStyle *style, uiBut *but, rcti *rect)
case TEX:
wt= widget_type(UI_WTYPE_NAME);
break;
case TOGBUT:
wt= widget_type(UI_WTYPE_TOGGLE);
break;
case TOG:
case TOGN:
case TOG3:
@@ -1818,16 +1827,16 @@ void ui_draw_but(ARegion *ar, uiStyle *style, uiBut *but, rcti *rect)
// XXX four old button types
case HSVCUBE:
ui_draw_but_HSVCUBE(but);
ui_draw_but_HSVCUBE(but, rect);
break;
case BUT_COLORBAND:
ui_draw_but_COLORBAND(but);
ui_draw_but_COLORBAND(but, rect);
break;
case BUT_NORMAL:
ui_draw_but_NORMAL(but);
ui_draw_but_NORMAL(but, rect);
break;
case BUT_CURVE:
ui_draw_but_CURVE(ar, but);
ui_draw_but_CURVE(ar, but, rect);
break;
default:
@@ -1836,6 +1845,7 @@ void ui_draw_but(ARegion *ar, uiStyle *style, uiBut *but, rcti *rect)
}
if(wt) {
rcti disablerect= *rect; /* rect gets clipped smaller for text */
int roundboxalign, state;
roundboxalign= widget_roundbox_set(but, rect);
@@ -1850,7 +1860,8 @@ void ui_draw_but(ARegion *ar, uiStyle *style, uiBut *but, rcti *rect)
wt->text(&style->widget, but, rect, wt->wcol.text);
if(state & UI_BUT_DISABLED)
widget_disabled(rect);
if(but->dt!=UI_EMBOSSP)
widget_disabled(&disablerect);
}
}

View File

@@ -148,7 +148,7 @@ void buttons_header_buttons(const bContext *C, ARegion *ar)
xmax= GetButStringLength("View");
uiDefPulldownBut(block, dummy_viewmenu, CTX_wm_area(C),
"View", xco, yco-2, xmax-3, 24, "");
"View", xco, yco, xmax-3, 20, "");
xco+=XIC+xmax;
}

View File

@@ -744,23 +744,23 @@ void image_header_buttons(const bContext *C, ARegion *ar)
uiBlockSetEmboss(block, UI_EMBOSSP);
xmax= GetButStringLength("View");
uiDefMenuBut(block, image_viewmenu, NULL, "View", xco, yco-2, xmax-3, 24, "");
uiDefMenuBut(block, image_viewmenu, NULL, "View", xco, yco, xmax-3, 20, "");
xco+= xmax;
if(show_uvedit) {
xmax= GetButStringLength("Select");
uiDefMenuBut(block, image_selectmenu, NULL, "Select", xco, yco-2, xmax-3, 24, "");
uiDefMenuBut(block, image_selectmenu, NULL, "Select", xco, yco, xmax-3, 20, "");
xco+= xmax;
}
menuname= (ibuf && (ibuf->userflags & IB_BITMAPDIRTY))? "Image*": "Image";
xmax= GetButStringLength(menuname);
uiDefMenuBut(block, image_imagemenu, NULL, menuname, xco, yco-2, xmax-3, 24, "");
uiDefMenuBut(block, image_imagemenu, NULL, menuname, xco, yco, xmax-3, 20, "");
xco+= xmax;
if(show_uvedit) {
xmax= GetButStringLength("UVs");
uiDefMenuBut(block, image_uvsmenu, NULL, "UVs", xco, yco-2, xmax-3, 24, "");
uiDefMenuBut(block, image_uvsmenu, NULL, "UVs", xco, yco, xmax-3, 20, "");
xco+= xmax;
}
}

View File

@@ -1357,13 +1357,13 @@ void ED_image_uiblock_panel(const bContext *C, uiBlock *block, Image **ima_pp, I
/* fields */
uiBlockBeginAlign(block);
but= uiDefButBitS(block, TOG, IMA_FIELDS, imagechanged, "Fields", 10, 70, 65, 20, &ima->flag, 0, 0, 0, 0, "Click to enable use of fields in Image");
but= uiDefButBitS(block, TOGBUT, IMA_FIELDS, imagechanged, "Fields", 10, 70, 65, 20, &ima->flag, 0, 0, 0, 0, "Click to enable use of fields in Image");
uiButSetFunc(but, image_field_test, ima, iuser);
uiDefButBitS(block, TOG, IMA_STD_FIELD, B_NOP, "Odd", 75, 70, 45, 20, &ima->flag, 0, 0, 0, 0, "Standard Field Toggle");
uiDefButBitS(block, TOGBUT, IMA_STD_FIELD, B_NOP, "Odd", 75, 70, 45, 20, &ima->flag, 0, 0, 0, 0, "Standard Field Toggle");
uiBlockSetFunc(block, image_reload_cb, ima, iuser);
uiDefButBitS(block, TOG, IMA_ANTIALI, B_NOP, "Anti", 10, 50, 45, 20, &ima->flag, 0, 0, 0, 0, "Toggles Image anti-aliasing, only works with solid colors");
uiDefButBitS(block, TOG, IMA_DO_PREMUL, imagechanged, "Premul", 55, 50, 65, 20, &ima->flag, 0, 0, 0, 0, "Toggles premultiplying alpha");
uiDefButBitS(block, TOGBUT, IMA_ANTIALI, B_NOP, "Anti", 10, 50, 45, 20, &ima->flag, 0, 0, 0, 0, "Toggles Image anti-aliasing, only works with solid colors");
uiDefButBitS(block, TOGBUT, IMA_DO_PREMUL, imagechanged, "Premul", 55, 50, 65, 20, &ima->flag, 0, 0, 0, 0, "Toggles premultiplying alpha");
uiBlockEndAlign(block);
if( ELEM(ima->source, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE)) {
@@ -1395,7 +1395,7 @@ void ED_image_uiblock_panel(const bContext *C, uiBlock *block, Image **ima_pp, I
uiBlockSetFunc(block, image_generated_change_cb, ima, iuser);
uiDefButS(block, NUM, imagechanged, "SizeX:", 120,70,100,20, &ima->gen_x, 1.0, 5000.0, 0, 0, "Image size x");
uiDefButS(block, NUM, imagechanged, "SizeY:", 220,70,90,20, &ima->gen_y, 1.0, 5000.0, 0, 0, "Image size y");
uiDefButS(block, TOG, imagechanged, "UV Test grid",120,50,190,20, &ima->gen_type, 0.0, 1.0, 0, 0, "");
uiDefButS(block, TOGBUT, imagechanged, "UV Test grid",120,50,190,20, &ima->gen_type, 0.0, 1.0, 0, 0, "");
uiBlockSetFunc(block, NULL, NULL, NULL);
}
}

View File

@@ -496,7 +496,7 @@ static void image_buttons_area_draw(const bContext *C, ARegion *ar)
float col[3];
/* clear */
UI_GetThemeColor3fv(TH_BACK, col);
UI_GetThemeColor3fv(TH_PANEL, col);
glClearColor(col[0], col[1], col[2], 0.0);
glClear(GL_COLOR_BUFFER_BIT);

View File

@@ -404,27 +404,27 @@ void info_header_buttons(const bContext *C, ARegion *ar)
uiBlockSetEmboss(block, UI_EMBOSSP);
xmax= GetButStringLength("File");
uiDefMenuBut(block, info_filemenu, NULL, "File", xco, yco, xmax-3, 22, "");
uiDefMenuBut(block, info_filemenu, NULL, "File", xco, yco, xmax-3, 20, "");
xco+= xmax;
xmax= GetButStringLength("Add");
uiDefPulldownBut(block, dummy_viewmenu, sa, "Add", xco, yco, xmax-3, 22, "");
uiDefPulldownBut(block, dummy_viewmenu, sa, "Add", xco, yco, xmax-3, 20, "");
xco+= xmax;
xmax= GetButStringLength("Timeline");
uiDefPulldownBut(block, dummy_viewmenu, sa, "Timeline", xco, yco, xmax-3, 22, "");
uiDefPulldownBut(block, dummy_viewmenu, sa, "Timeline", xco, yco, xmax-3, 20, "");
xco+= xmax;
xmax= GetButStringLength("Game");
uiDefPulldownBut(block, dummy_viewmenu, sa, "Game", xco, yco, xmax-3, 22, "");
uiDefPulldownBut(block, dummy_viewmenu, sa, "Game", xco, yco, xmax-3, 20, "");
xco+= xmax;
xmax= GetButStringLength("Render");
uiDefPulldownBut(block, dummy_viewmenu, sa, "Render", xco, yco, xmax-3, 22, "");
uiDefPulldownBut(block, dummy_viewmenu, sa, "Render", xco, yco, xmax-3, 20, "");
xco+= xmax;
xmax= GetButStringLength("Help");
uiDefPulldownBut(block, dummy_viewmenu, NULL, "Help", xco, yco, xmax-3, 22, "");
uiDefPulldownBut(block, dummy_viewmenu, NULL, "Help", xco, yco, xmax-3, 20, "");
xco+= xmax;
}

View File

@@ -445,16 +445,16 @@ void time_header_buttons(const bContext *C, ARegion *ar)
xmax= GetButStringLength("View");
uiDefPulldownBut(block, time_viewmenu, sa,
"View", xco, yco-2, xmax-3, 24, "");
"View", xco, yco, xmax-3, 20, "");
xco+= xmax;
xmax= GetButStringLength("Frame");
uiDefPulldownBut(block, time_framemenu, sa,
"Frame", xco, yco-2, xmax-3, 24, "");
"Frame", xco, yco, xmax-3, 20, "");
xco+= xmax;
xmax= GetButStringLength("Playback");
uiDefPulldownBut(block, time_redrawmenu, sa,
"Playback", xco, yco-2, xmax-3, 24, "");
"Playback", xco, yco, xmax-3, 20, "");
xco+= xmax;
}

View File

@@ -5143,115 +5143,115 @@ static void view3d_header_pulldowns(const bContext *C, uiBlock *block, Object *o
* height of the header */
xmax= GetButStringLength("View");
uiDefMenuBut(block, view3d_viewmenu, NULL, "View", xco, yco-2, xmax-3, 24, "");
//uiDefPulldownBut(block, view3d_viewmenu, NULL, "View", xco, yco-2, xmax-3, 24, "");
uiDefMenuBut(block, view3d_viewmenu, NULL, "View", xco, yco, xmax-3, 20, "");
//uiDefPulldownBut(block, view3d_viewmenu, NULL, "View", xco, yco, xmax-3, 20, "");
xco+= xmax;
xmax= GetButStringLength("Select");
if (obedit) {
if (ob && ob->type == OB_MESH) {
uiDefPulldownBut(block, view3d_select_meshmenu, NULL, "Select", xco,yco-2, xmax-3, 24, "");
uiDefPulldownBut(block, view3d_select_meshmenu, NULL, "Select", xco,yco, xmax-3, 24, "");
} else if (ob && (ob->type == OB_CURVE || ob->type == OB_SURF)) {
uiDefMenuBut(block, view3d_select_curvemenu, NULL, "Select", xco, yco-2, xmax-3, 24, "");
uiDefMenuBut(block, view3d_select_curvemenu, NULL, "Select", xco, yco, xmax-3, 24, "");
} else if (ob && ob->type == OB_FONT) {
xmax= 0;
} else if (ob && ob->type == OB_MBALL) {
uiDefPulldownBut(block, view3d_select_metaballmenu, NULL, "Select", xco,yco-2, xmax-3, 24, "");
uiDefPulldownBut(block, view3d_select_metaballmenu, NULL, "Select", xco,yco, xmax-3, 24, "");
} else if (ob && ob->type == OB_LATTICE) {
uiDefPulldownBut(block, view3d_select_latticemenu, NULL, "Select", xco,yco-2, xmax-3, 24, "");
uiDefPulldownBut(block, view3d_select_latticemenu, NULL, "Select", xco,yco, xmax-3, 20, "");
} else if (ob && ob->type == OB_ARMATURE) {
uiDefPulldownBut(block, view3d_select_armaturemenu, NULL, "Select", xco,yco-2, xmax-3, 24, "");
uiDefPulldownBut(block, view3d_select_armaturemenu, NULL, "Select", xco,yco, xmax-3, 20, "");
}
} else if (FACESEL_PAINT_TEST) {
if (ob && ob->type == OB_MESH) {
uiDefPulldownBut(block, view3d_select_faceselmenu, NULL, "Select", xco,yco-2, xmax-3, 24, "");
uiDefPulldownBut(block, view3d_select_faceselmenu, NULL, "Select", xco,yco, xmax-3, 20, "");
}
} else if ((G.f & G_VERTEXPAINT) || (G.f & G_TEXTUREPAINT) || (G.f & G_WEIGHTPAINT)) {
uiDefBut(block, LABEL,0,"", xco, 0, xmax, 20, 0, 0, 0, 0, 0, "");
} else if (G.f & G_PARTICLEEDIT) {
uiDefMenuBut(block, view3d_select_particlemenu, NULL, "Select", xco,yco-2, xmax-3, 24, "");
uiDefMenuBut(block, view3d_select_particlemenu, NULL, "Select", xco,yco, xmax-3, 20, "");
} else {
if (ob && (ob->flag & OB_POSEMODE))
uiDefPulldownBut(block, view3d_select_pose_armaturemenu, NULL, "Select", xco,yco-2, xmax-3, 24, "");
uiDefPulldownBut(block, view3d_select_pose_armaturemenu, NULL, "Select", xco,yco, xmax-3, 20, "");
else
uiDefPulldownBut(block, view3d_select_objectmenu, NULL, "Select", xco,yco-2, xmax-3, 24, "");
uiDefPulldownBut(block, view3d_select_objectmenu, NULL, "Select", xco,yco, xmax-3, 20, "");
}
xco+= xmax;
if (obedit) {
if (ob && ob->type == OB_MESH) {
xmax= GetButStringLength("Mesh");
uiDefPulldownBut(block, view3d_edit_meshmenu, NULL, "Mesh", xco,yco-2, xmax-3, 24, "");
uiDefPulldownBut(block, view3d_edit_meshmenu, NULL, "Mesh", xco,yco, xmax-3, 20, "");
xco+= xmax;
} else if (ob && ob->type == OB_CURVE) {
xmax= GetButStringLength("Curve");
uiDefMenuBut(block, view3d_edit_curvemenu, NULL, "Curve", xco, yco-2, xmax-3, 24, "");
uiDefMenuBut(block, view3d_edit_curvemenu, NULL, "Curve", xco, yco, xmax-3, 20, "");
xco+= xmax;
} else if (ob && ob->type == OB_SURF) {
xmax= GetButStringLength("Surface");
uiDefMenuBut(block, view3d_edit_curvemenu, NULL, "Surface", xco, yco-2, xmax-3, 24, "");
uiDefMenuBut(block, view3d_edit_curvemenu, NULL, "Surface", xco, yco, xmax-3, 20, "");
xco+= xmax;
} else if (ob && ob->type == OB_FONT) {
xmax= GetButStringLength("Text");
uiDefMenuBut(block, view3d_edit_textmenu, NULL, "Text", xco, yco-2, xmax-3, 24, "");
uiDefMenuBut(block, view3d_edit_textmenu, NULL, "Text", xco, yco, xmax-3, 20, "");
xco+= xmax;
} else if (ob && ob->type == OB_MBALL) {
xmax= GetButStringLength("Metaball");
uiDefPulldownBut(block, view3d_edit_metaballmenu, NULL, "Metaball", xco,yco-2, xmax-3, 24, "");
uiDefPulldownBut(block, view3d_edit_metaballmenu, NULL, "Metaball", xco,yco, xmax-3, 20, "");
xco+= xmax;
} else if (ob && ob->type == OB_LATTICE) {
xmax= GetButStringLength("Lattice");
uiDefPulldownBut(block, view3d_edit_latticemenu, NULL, "Lattice", xco,yco-2, xmax-3, 24, "");
uiDefPulldownBut(block, view3d_edit_latticemenu, NULL, "Lattice", xco,yco, xmax-3, 20, "");
xco+= xmax;
} else if (ob && ob->type == OB_ARMATURE) {
xmax= GetButStringLength("Armature");
uiDefPulldownBut(block, view3d_edit_armaturemenu, NULL, "Armature", xco,yco-2, xmax-3, 24, "");
uiDefPulldownBut(block, view3d_edit_armaturemenu, NULL, "Armature", xco,yco, xmax-3, 20, "");
xco+= xmax;
}
}
else if (G.f & G_WEIGHTPAINT) {
xmax= GetButStringLength("Paint");
uiDefPulldownBut(block, view3d_wpaintmenu, NULL, "Paint", xco,yco-2, xmax-3, 24, "");
uiDefPulldownBut(block, view3d_wpaintmenu, NULL, "Paint", xco,yco, xmax-3, 20, "");
xco+= xmax;
}
else if (G.f & G_VERTEXPAINT) {
xmax= GetButStringLength("Paint");
uiDefPulldownBut(block, view3d_vpaintmenu, NULL, "Paint", xco,yco-2, xmax-3, 24, "");
uiDefPulldownBut(block, view3d_vpaintmenu, NULL, "Paint", xco,yco, xmax-3, 20, "");
xco+= xmax;
}
else if (G.f & G_TEXTUREPAINT) {
xmax= GetButStringLength("Paint");
uiDefPulldownBut(block, view3d_tpaintmenu, NULL, "Paint", xco,yco-2, xmax-3, 24, "");
uiDefPulldownBut(block, view3d_tpaintmenu, NULL, "Paint", xco,yco, xmax-3, 20, "");
xco+= xmax;
}
else if( G.f & G_SCULPTMODE) {
xmax= GetButStringLength("Sculpt");
uiDefMenuBut(block, view3d_sculpt_menu, NULL, "Sculpt", xco, yco-2, xmax-3, 24, "");
uiDefMenuBut(block, view3d_sculpt_menu, NULL, "Sculpt", xco, yco, xmax-3, 20, "");
xco+= xmax;
}
else if (FACESEL_PAINT_TEST) {
if (ob && ob->type == OB_MESH) {
xmax= GetButStringLength("Face");
uiDefPulldownBut(block, view3d_faceselmenu, NULL, "Face", xco,yco-2, xmax-3, 24, "");
uiDefPulldownBut(block, view3d_faceselmenu, NULL, "Face", xco,yco, xmax-3, 20, "");
xco+= xmax;
}
}
else if(G.f & G_PARTICLEEDIT) {
xmax= GetButStringLength("Particle");
uiDefMenuBut(block, view3d_particlemenu, NULL, "Particle", xco,yco-2, xmax-3, 24, "");
uiDefMenuBut(block, view3d_particlemenu, NULL, "Particle", xco,yco, xmax-3, 20, "");
xco+= xmax;
}
else {
if (ob && (ob->flag & OB_POSEMODE)) {
xmax= GetButStringLength("Pose");
uiDefPulldownBut(block, view3d_pose_armaturemenu, NULL, "Pose", xco,yco-2, xmax-3, 24, "");
uiDefPulldownBut(block, view3d_pose_armaturemenu, NULL, "Pose", xco,yco, xmax-3, 20, "");
xco+= xmax;
}
else {
xmax= GetButStringLength("Object");
uiDefPulldownBut(block, view3d_edit_objectmenu, NULL, "Object", xco,yco-2, xmax-3, 24, "");
uiDefPulldownBut(block, view3d_edit_objectmenu, NULL, "Object", xco,yco, xmax-3, 20, "");
xco+= xmax;
}
}