diff options
author | Ton Roosendaal <ton@blender.org> | 2003-10-20 19:40:20 +0400 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2003-10-20 19:40:20 +0400 |
commit | 7f5d06d638ff24444da942cf91c130d5393818cb (patch) | |
tree | 2b21f227adfb1d7f2004087e60b05c3af230d5ee /source/blender/include | |
parent | 628b0025836183436ab5b83120497ebe060f89b7 (diff) |
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
Diffstat (limited to 'source/blender/include')
-rw-r--r-- | source/blender/include/BIF_interface.h | 18 | ||||
-rw-r--r-- | source/blender/include/BIF_language.h | 3 | ||||
-rw-r--r-- | source/blender/include/BIF_resources.h | 107 | ||||
-rw-r--r-- | source/blender/include/interface.h | 14 |
4 files changed, 47 insertions, 95 deletions
diff --git a/source/blender/include/BIF_interface.h b/source/blender/include/BIF_interface.h index 579810a5903..60c5fab0e06 100644 --- a/source/blender/include/BIF_interface.h +++ b/source/blender/include/BIF_interface.h @@ -38,18 +38,12 @@ struct ListBase; struct ScrArea; /* uiBlock->dt */ -#define UI_EMBOSSX 0 /* Rounded embossed button */ -#define UI_EMBOSSW 1 /* Flat bordered button */ -#define UI_EMBOSSN 2 /* No border */ - -#define UI_EMBOSSM 4 /* Colored Border */ -#define UI_EMBOSSP 5 /* Borderless coloured button */ -#define UI_EMBOSSA 6 /* same as EMBOSSX but with arrows to simulate */ -#define UI_EMBOSSTABL 7 -#define UI_EMBOSSTABM 8 -#define UI_EMBOSSTABR 9 -#define UI_EMBOSST 10 -#define UI_EMBOSSMB 11 /* emboss menu button */ +#define UI_EMBOSS 0 /* use one of the themes for drawing */ +#define UI_EMBOSSN 1 /* Nothing */ +#define UI_EMBOSSM 2 /* Minimal builtin emboss, also for logic buttons */ +#define UI_EMBOSSP 3 /* Pulldown */ + +#define UI_EMBOSSX 0 /* for a python file, which i can't change.... duh! */ /* uiBlock->direction */ #define UI_TOP 0 diff --git a/source/blender/include/BIF_language.h b/source/blender/include/BIF_language.h index 91cdc18673d..414207c2e44 100644 --- a/source/blender/include/BIF_language.h +++ b/source/blender/include/BIF_language.h @@ -45,8 +45,7 @@ void lang_setlanguage(void); /* usiblender.c */ char *language_pup(void); char *fontsize_pup(void); -int BIF_DrawString(struct BMF_Font* font, char *str, int translate, int col); -int BIF_DrawStringRGB(struct BMF_Font* font, char *str, int translate, float r, float g, float b); +int BIF_DrawString(struct BMF_Font* font, char *str, int translate); float BIF_GetStringWidth(struct BMF_Font* font, char *str, int translate); #endif /* BIF_LANGUAGE_H */ diff --git a/source/blender/include/BIF_resources.h b/source/blender/include/BIF_resources.h index f329dffea17..78cef040fde 100644 --- a/source/blender/include/BIF_resources.h +++ b/source/blender/include/BIF_resources.h @@ -258,87 +258,41 @@ typedef enum { #define BIFNICONIDS (BIFICONID_LAST-BIFICONID_FIRST + 1) } BIFIconID; -typedef enum { -#define BIFCOLORSHADE_FIRST (COLORSHADE_DARK) - COLORSHADE_DARK, - COLORSHADE_GREY, - COLORSHADE_LGREY, - COLORSHADE_LMEDIUM, - COLORSHADE_MEDIUM, - COLORSHADE_HILITE, - COLORSHADE_LIGHT, - COLORSHADE_WHITE, - -#define BIFCOLORSHADE_LAST (COLORSHADE_WHITE) -#define BIFNCOLORSHADES (BIFCOLORSHADE_LAST-BIFCOLORSHADE_FIRST + 1) -} BIFColorShade; - -typedef enum { -#define BIFCOLORID_FIRST (BUTGREY) - BUTGREY, - BUTGREEN, - BUTBLUE, - BUTSALMON, - MIDGREY, - BUTPURPLE, - BUTYELLOW, - REDALERT, - BUTRUST, - BUTWHITE, - BUTDBLUE, - BUTPINK, - BUTDPINK, - BUTMACTIVE, - - ACTIONBUTCOL, - NUMBUTCOL, - TEXBUTCOL, - TOGBUTCOL, - SLIDERCOL, - TABCOL, - MENUCOL, - MENUACTIVECOL, - - BUTIPO, - BUTAUDIO, - BUTCAMERA, - BUTRANDOM, - BUTEDITOBJECT, - BUTPROPERTY, - BUTSCENE, - BUTMOTION, - BUTMESSAGE, - BUTACTION, - BUTCD, - BUTGAME, - BUTVISIBILITY, - BUTYUCK, - BUTSEASICK, - BUTCHOKE, - - HEADERCOL, - HEADERCOLSEL, - - BUTIMPERIAL, -#define BIFCOLORID_LAST (BUTIMPERIAL) -#define BIFNCOLORIDS (BIFCOLORID_LAST-BIFCOLORID_FIRST + 1) -} BIFColorID; - /* ---------- theme ----------- */ +enum { + TH_AUTO, /* for buttons, to signal automatic color assignment */ + // uibutton colors - - -#define TH_THEMEUI 99 - + TH_BUT_NEUTRAL, + TH_BUT_ACTION, + TH_BUT_SETTING, + TH_BUT_SETTING1, + TH_BUT_SETTING2, + TH_BUT_NUM, + TH_BUT_TEXTFIELD, + TH_BUT_POPUP, + TH_BUT_TEXT, + TH_BUT_TEXT_HI, + TH_MENU_BACK, + TH_MENU_ITEM, + TH_MENU_HILITE, + TH_MENU_TEXT, + TH_MENU_TEXT_HI, + + TH_BUT_DRAWTYPE, + + TH_REDALERT, + + TH_THEMEUI, // common colors among spaces - -enum { - TH_BACK = 100, + + TH_BACK, TH_TEXT, TH_TEXT_HI, TH_HEADER, + TH_HEADERDESEL, TH_PANEL, TH_SHADE1, TH_SHADE2, @@ -377,7 +331,8 @@ void BIF_ThemeColorShade(int colorid, int offset); void BIF_ThemeColorBlend(int colorid1, int colorid2, float fac); // returns one value, not scaled -float BIF_GetThemeColorf(int colorid); +float BIF_GetThemeValuef(int colorid); +int BIF_GetThemeValue(int colorid); // get three color values, scaled to 0.0-1.0 range void BIF_GetThemeColor3fv(int colorid, float *col); @@ -398,9 +353,7 @@ void BIF_resources_free (void); int BIF_get_icon_width (BIFIconID icon); int BIF_get_icon_height (BIFIconID icon); void BIF_draw_icon (BIFIconID icon); -void BIF_draw_icon_blended (BIFIconID icon, BIFColorID color, BIFColorShade shade); - -void BIF_set_color (BIFColorID color, BIFColorShade shade); +void BIF_draw_icon_blended (BIFIconID icon, int colorid, int shade); /* only for buttons in theme editor! */ char *BIF_ThemeGetColorPtr(struct bTheme *btheme, int spacetype, int colorid); diff --git a/source/blender/include/interface.h b/source/blender/include/interface.h index b9cbbbc5332..02fdd9c2e25 100644 --- a/source/blender/include/interface.h +++ b/source/blender/include/interface.h @@ -128,16 +128,18 @@ struct uiBut { void *func_arg1; void *func_arg2; - void (*embossfunc)(BIFColorID, float, float, float, float, float, int); + void (*embossfunc)(int , int , float, float, float, float, float, int); + void (*sliderfunc)(int , float, float, float, float, float, float, int); uiLink *link; char *tip, *lockstr; - BIFColorID col; + int themecol; /* themecolor id */ void *font; BIFIconID icon; + short but_align; /* aligning buttons, horiz/vertical */ short lock, win; short iconadd; @@ -179,7 +181,8 @@ struct uiBlock { /* extra draw function for custom blocks */ void (*drawextra)(); - BIFColorID col; + int themecol; /* themecolor id */ + short but_align; /* aligning buttons, horiz/vertical */ short font; /* indices */ int afterval; void *curfont; @@ -195,6 +198,7 @@ struct uiBlock { /* interface.c */ extern void ui_check_but(uiBut *but); +extern double ui_get_but_val(uiBut *but); extern void ui_autofill(uiBlock *block); extern void ui_graphics_to_window(int win, float *x, float *y); extern void ui_window_to_graphics(int win, float *x, float *y); @@ -203,7 +207,9 @@ extern void ui_window_to_graphics(int win, float *x, float *y); extern void ui_draw_panel(uiBlock *block); extern void ui_do_panel(uiBlock *block, uiEvent *uevent); - +/* interface_draw.c */ +extern void ui_set_embossfunc(uiBut *but, int drawtype); +extern void ui_draw_but(uiBut *but); #endif |