- The basic layer for Themes in place!

- currently only implemented for 3d window
- create as many themes you like, and name them
- default theme is not editable, and always will be defined at startup
  (initTheme)
- saves in .B.blend
- themes for spaces can become local too, so you can set individual
  3d windows at theme 'Maya' or so. (to be implemented)
- it uses alpha as well...!

API:
This doesnt use the old method with BFCOLORID blahblah. The API is copied
from OpenGL conventions (naming) as much as possible:

- void BIF_ThemeColor(ScrArea *sa, int colorid)
  sets a color... id's are in BIF_resources.h (TH_GRID, TH_WIRE, etc)

- void BIF_ThemeColorShade(ScrArea *sa, int colorid, int offset)
  sets a color with offset, no more weird COLORSHADE_LGREY stuff

- void BIF_GetThemeColor3fv(ScrArea *sa, int colorid, float *col)
  like opengl, this gives you in *col the three rgb values

- void BIF_GetThemeColor4ubv(ScrArea *sa, int colorid, char *col)
  or the one to get 4 bytes

ThemeColor calls for globals (UI etc) can also call NULL for *sa... this
is to be implemented still.

Next step: cleaning up interface.c for all weird colorcalls.
This commit is contained in:
2003-10-17 14:02:08 +00:00
parent 00cf36d6a5
commit 0321602b65
20 changed files with 757 additions and 107 deletions

View File

@@ -2664,7 +2664,7 @@ static int ui_do_but_MENU(uiBut *but)
int width, height, a, xmax, starty;
short startx;
int columns=1, rows=0, boxh, event;
short x1, y1;
short x1, y1, active= -1;
short mval[2];
MenuData *md;
@@ -2709,15 +2709,18 @@ static int ui_do_but_MENU(uiBut *but)
/* find active item */
fvalue= ui_get_but_val(but);
for(a=0; a<md->nitems; a++) {
if( md->items[a].retval== (int)fvalue ) break;
for(active=0; active<md->nitems; active++) {
if( md->items[active].retval== (int)fvalue ) break;
}
/* no active item? */
if(a==md->nitems) {
if(md->title) a= -1;
else a= 0;
if(active==md->nitems) {
if(md->title) active= -1;
else active= 0;
}
/* for now disabled... works confusing because you think it's a title or so.... */
active= -1;
/* here we go! */
startx= but->x1;
starty= but->y1;
@@ -2731,7 +2734,7 @@ static int ui_do_but_MENU(uiBut *but)
}
for(a=0; a<md->nitems; a++) {
x1= but->x1 + width*((int)a/rows);
y1= but->y1 - boxh*(a%rows) + (rows-1)*boxh;
@@ -2739,7 +2742,8 @@ static int ui_do_but_MENU(uiBut *but)
uiDefBut(block, SEPR, B_NOP, "", x1, y1,(short)(width-(rows>1)), (short)(boxh-1), NULL, 0.0, 0.0, 0, 0, "");
}
else {
uiDefBut(block, BUTM|but->pointype, but->retval, md->items[a].str, x1, y1,(short)(width-(rows>1)), (short)(boxh-1), but->poin, (float) md->items[a].retval, 0.0, 0, 0, "");
uiBut *bt= uiDefBut(block, BUTM|but->pointype, but->retval, md->items[a].str, x1, y1,(short)(width-(rows>1)), (short)(boxh-1), but->poin, (float) md->items[a].retval, 0.0, 0, 0, "");
if(active==a) bt->flag |= UI_ACTIVE;
}
}
@@ -4269,7 +4273,7 @@ static int ui_do_block(uiBlock *block, uiEvent *uevent)
if(block->win != mywinget()) return UI_NOTHING;
/* filter some unwanted events */
if(uevent==0 || uevent->event==LEFTSHIFTKEY || uevent->event==RIGHTSHIFTKEY) return UI_NOTHING;
if(uevent==0 || uevent->event==0 || uevent->event==LEFTSHIFTKEY || uevent->event==RIGHTSHIFTKEY) return UI_NOTHING;
if(block->flag & UI_BLOCK_ENTER_OK) {
if(uevent->event == RETKEY && uevent->val) {
@@ -4447,8 +4451,11 @@ static int ui_do_block(uiBlock *block, uiEvent *uevent)
/* hilite case 2 */
if(but->flag & UI_ACTIVE) {
if( (but->flag & UI_MOUSE_OVER)==0) {
but->flag &= ~UI_ACTIVE;
if(but->type != LABEL && but->embossfunc != ui_emboss_N) ui_draw_but(but);
/* we dont clear active flag until mouse move, for Menu buttons to remain showing active item when opened */
if (uevent->event==MOUSEY) {
but->flag &= ~UI_ACTIVE;
if(but->type != LABEL && but->embossfunc != ui_emboss_N) ui_draw_but(but);
}
}
else if(but->type==BLOCK || but->type==MENU) { // automatic opens block button (pulldown)
int time;
@@ -4489,16 +4496,18 @@ static int ui_do_block(uiBlock *block, uiEvent *uevent)
if(uevent->val || (block->flag & UI_BLOCK_RET_1)==0) {
if ELEM3(uevent->event, LEFTMOUSE, PADENTER, RETKEY) {
butevent= ui_do_button(block, but, uevent);
if(butevent) addqueue(block->winq, UI_BUT_EVENT, (short)butevent);
/* when mouse outside, don't do button */
if(inside || uevent->event!=LEFTMOUSE) {
butevent= ui_do_button(block, but, uevent);
if(butevent) addqueue(block->winq, UI_BUT_EVENT, (short)butevent);
/* i doubt about the next line! */
/* if(but->func) mywinset(block->win); */
/* i doubt about the next line! */
/* if(but->func) mywinset(block->win); */
if( (block->flag & UI_BLOCK_LOOP) && but->type==BLOCK);
else
if(/*but->func ||*/ butevent) retval= UI_RETURN_OK;
if( (block->flag & UI_BLOCK_LOOP) && but->type==BLOCK);
else
if(/*but->func ||*/ butevent) retval= UI_RETURN_OK;
}
}
}
}