Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTon Roosendaal <ton@blender.org>2004-10-11 15:54:14 +0400
committerTon Roosendaal <ton@blender.org>2004-10-11 15:54:14 +0400
commitb024faabe5ac0704c074db3e6d14e72ad396bd8e (patch)
treeeee38c5ee41513e7d5b276c74fb2716e23e8e9f3 /source/blender/src/interface_draw.c
parent2d833b37220cee02bbde27eb8c37261d9da47db3 (diff)
Outliner features:
- Rename! CTRL+leftmouse click on name, makes it a text button. Works for all items as currently being displayed. Most work was doing the Bones, which is a nightmare :) But it uses same code as buttons in Armature-Editmode now, without even needing EditMode :) When renaming a bone, the Outliner makes the Object active though. - PageUp / PageDown keys Do what you expect.
Diffstat (limited to 'source/blender/src/interface_draw.c')
-rw-r--r--source/blender/src/interface_draw.c136
1 files changed, 70 insertions, 66 deletions
diff --git a/source/blender/src/interface_draw.c b/source/blender/src/interface_draw.c
index 12cd21c957b..dcd96aa6914 100644
--- a/source/blender/src/interface_draw.c
+++ b/source/blender/src/interface_draw.c
@@ -1421,7 +1421,7 @@ static void ui_draw_text_icon(uiBut *but)
if (but->type == ICONTEXTROW) {
ui_draw_icon(but, (BIFIconID) (but->icon+but->iconadd));
}
- else if(but->drawstr[0]!=0) {
+ else {
// text button cursor
if(but->pos != -1) {
@@ -1429,86 +1429,90 @@ static void ui_draw_text_icon(uiBut *but)
pos= but->pos+strlen(but->str);
if(pos >= but->ofs) {
- ch= but->drawstr[pos];
- but->drawstr[pos]= 0;
-
- t= but->aspect*BIF_GetStringWidth(but->font, but->drawstr+but->ofs, (U.transopts & USER_TR_BUTTONS)) + 3;
-
- but->drawstr[pos]= ch;
+ if(but->drawstr[0]!=0) {
+ ch= but->drawstr[pos];
+ but->drawstr[pos]= 0;
+
+ t= but->aspect*BIF_GetStringWidth(but->font, but->drawstr+but->ofs, (U.transopts & USER_TR_BUTTONS)) + 3;
+
+ but->drawstr[pos]= ch;
+ }
+ else t= 3;
+
glColor3ub(255,0,0);
-
glRects(but->x1+t, but->y1+2, but->x1+t+3, but->y2-2);
}
}
- // cut string in 2 parts
- cpoin= strchr(but->drawstr, '|');
- if(cpoin) *cpoin= 0;
+ if(but->drawstr[0]!=0) {
+ // cut string in 2 parts
+ cpoin= strchr(but->drawstr, '|');
+ if(cpoin) *cpoin= 0;
- /* If there's an icon too (made with uiDefIconTextBut) then draw the icon
- and offset the text label to accomodate it */
-
- if ( (but->flag & UI_HAS_ICON) && (but->flag & UI_ICON_LEFT) ) {
- ui_draw_icon(but, but->icon);
+ /* If there's an icon too (made with uiDefIconTextBut) then draw the icon
+ and offset the text label to accomodate it */
+
+ if ( (but->flag & UI_HAS_ICON) && (but->flag & UI_ICON_LEFT) ) {
+ ui_draw_icon(but, but->icon);
- if(but->flag & UI_TEXT_LEFT) x= but->x1+24.0;
- else x= (but->x1+but->x2-but->strwidth+1)/2.0;
- }
- else {
- if(but->flag & UI_TEXT_LEFT) x= but->x1+4.0;
- else x= (but->x1+but->x2-but->strwidth+1)/2.0;
- }
-
- /* text color, with pulldown item exception */
- if(but->dt==UI_EMBOSSP) {
- if(but->flag & (UI_SELECT|UI_ACTIVE)) {
- BIF_ThemeColor(TH_MENU_TEXT_HI);
- } else {
- BIF_ThemeColor(TH_MENU_TEXT);
+ if(but->flag & UI_TEXT_LEFT) x= but->x1+24.0;
+ else x= (but->x1+but->x2-but->strwidth+1)/2.0;
}
- }
- else {
- if(but->flag & UI_SELECT) {
- BIF_ThemeColor(TH_BUT_TEXT_HI);
- } else {
- BIF_ThemeColor(TH_BUT_TEXT);
+ else {
+ if(but->flag & UI_TEXT_LEFT) x= but->x1+4.0;
+ else x= (but->x1+but->x2-but->strwidth+1)/2.0;
}
- }
-
- /* tog3 button exception */
- if(but->type==TOG3 && (but->flag & UI_SELECT)) {
- int ok= 0;
- if( but->pointype==CHA ) {
- if( BTST( *(but->poin+2), but->bitnr )) ok= 1;
+ /* text color, with pulldown item exception */
+ if(but->dt==UI_EMBOSSP) {
+ if(but->flag & (UI_SELECT|UI_ACTIVE)) {
+ BIF_ThemeColor(TH_MENU_TEXT_HI);
+ } else {
+ BIF_ThemeColor(TH_MENU_TEXT);
+ }
+ }
+ else {
+ if(but->flag & UI_SELECT) {
+ BIF_ThemeColor(TH_BUT_TEXT_HI);
+ } else {
+ BIF_ThemeColor(TH_BUT_TEXT);
+ }
}
- else if( but->pointype ==SHO ) {
- short *sp= (short *)but->poin;
- if( BTST( sp[1], but->bitnr )) ok= 1;
+
+ /* tog3 button exception */
+ if(but->type==TOG3 && (but->flag & UI_SELECT)) {
+ int ok= 0;
+
+ if( but->pointype==CHA ) {
+ if( BTST( *(but->poin+2), but->bitnr )) ok= 1;
+ }
+ else if( but->pointype ==SHO ) {
+ short *sp= (short *)but->poin;
+ if( BTST( sp[1], but->bitnr )) ok= 1;
+ }
+
+ ui_tog3_invert(but->x1,but->y1,but->x2,but->y2, ok);
+ if (ok) glColor3ub(255, 255, 0);
}
- ui_tog3_invert(but->x1,but->y1,but->x2,but->y2, ok);
- if (ok) glColor3ub(255, 255, 0);
- }
+ /* LABEL button exception */
+ if(but->type==LABEL && but->min!=0.0) BIF_ThemeColor(TH_BUT_TEXT_HI);
- /* LABEL button exception */
- if(but->type==LABEL && but->min!=0.0) BIF_ThemeColor(TH_BUT_TEXT_HI);
-
- ui_rasterpos_safe(x, (but->y1+but->y2- 9.0)/2.0, but->aspect);
- BIF_DrawString(but->font, but->drawstr+but->ofs, (U.transopts & USER_TR_BUTTONS));
-
- /* part text right aligned */
- if(cpoin) {
- len= BIF_GetStringWidth(but->font, cpoin+1, (U.transopts & USER_TR_BUTTONS));
- ui_rasterpos_safe( but->x2 - len*but->aspect-3, (but->y1+but->y2- 9.0)/2.0, but->aspect);
- BIF_DrawString(but->font, cpoin+1, (U.transopts & USER_TR_BUTTONS));
- *cpoin= '|';
+ ui_rasterpos_safe(x, (but->y1+but->y2- 9.0)/2.0, but->aspect);
+ BIF_DrawString(but->font, but->drawstr+but->ofs, (U.transopts & USER_TR_BUTTONS));
+
+ /* part text right aligned */
+ if(cpoin) {
+ len= BIF_GetStringWidth(but->font, cpoin+1, (U.transopts & USER_TR_BUTTONS));
+ ui_rasterpos_safe( but->x2 - len*but->aspect-3, (but->y1+but->y2- 9.0)/2.0, but->aspect);
+ BIF_DrawString(but->font, cpoin+1, (U.transopts & USER_TR_BUTTONS));
+ *cpoin= '|';
+ }
+ }
+ /* if there's no text label, then check to see if there's an icon only and draw it */
+ else if( but->flag & UI_HAS_ICON ) {
+ ui_draw_icon(but, (BIFIconID) (but->icon+but->iconadd));
}
}
- /* if there's no text label, then check to see if there's an icon only and draw it */
- else if( but->flag & UI_HAS_ICON ) {
- ui_draw_icon(but, (BIFIconID) (but->icon+but->iconadd));
- }
-
}
static void ui_draw_but_COL(uiBut *but)