- simplified Theme API. No need to include 'current active area' anymore.
authorTon Roosendaal <ton@blender.org>
Sun, 19 Oct 2003 09:19:58 +0000 (09:19 +0000)
committerTon Roosendaal <ton@blender.org>
Sun, 19 Oct 2003 09:19:58 +0000 (09:19 +0000)
  like: BIF_ThemeColor(TH_GRID); will be sufficient. Blender does the rest.
- fixed bug in CTRL-X (reload home file) with themes
- fixed bug in horizontal alignment of different height panels. Seems also
  to solve the drawing error with constraints...

source/blender/include/BIF_resources.h
source/blender/src/butspace.c
source/blender/src/drawipo.c
source/blender/src/drawobject.c
source/blender/src/drawview.c
source/blender/src/editscreen.c
source/blender/src/filesel.c
source/blender/src/interface_panel.c
source/blender/src/resources.c
source/blender/src/space.c
source/blender/src/usiblender.c

index ac8a4faf210baf3184c781627e8829f7dce8d783..f329dffea177c613928dc81a4a70c40c9d4df2dc 100644 (file)
@@ -362,24 +362,39 @@ enum {
 
 struct bTheme;
 
-void   BIF_InitThemeColors(void);
-void   BIF_ThemeColor(struct ScrArea *sa, int colorid);
-void   BIF_ThemeColor4(struct ScrArea *sa, int colorid);
-void   BIF_ThemeColorShade(struct ScrArea *sa, int colorid, int offset);
-void   BIF_ThemeColorBlend(struct ScrArea *sa, int colorid1, int colorid2, float fac);
-
-// get only one value, not scaled
-float  BIF_GetThemeColorf(struct ScrArea *sa, int colorid);
+// THE CODERS API FOR THEMES:
+
+// sets the color
+void   BIF_ThemeColor(int colorid);
+
+// sets the color plus alpha
+void   BIF_ThemeColor4(int colorid);
+
+// sets color plus offset for shade
+void   BIF_ThemeColorShade(int colorid, int offset);
+
+// sets color, which is blend between two theme colors
+void   BIF_ThemeColorBlend(int colorid1, int colorid2, float fac);
+
+// returns one value, not scaled
+float  BIF_GetThemeColorf(int colorid);
+
 // get three color values, scaled to 0.0-1.0 range
-void   BIF_GetThemeColor3fv(struct ScrArea *sa, int colorid, float *col);
-// get the byte values
-void   BIF_GetThemeColor3ubv(struct ScrArea *sa, int colorid, char *col);
-void   BIF_GetThemeColor4ubv(struct ScrArea *sa, int colorid, char *col);
+void   BIF_GetThemeColor3fv(int colorid, float *col);
+
+// get the 3 or 4 byte values
+void   BIF_GetThemeColor3ubv(int colorid, char *col);
+void   BIF_GetThemeColor4ubv(int colorid, char *col);
+
 
+// internal (blender) usage only, for init and set active
+void   BIF_InitTheme(void);
+void   BIF_SetTheme(struct ScrArea *sa);
 void   BIF_resources_init              (void);
 void   BIF_resources_free              (void);
 
 
+// icon API
 int            BIF_get_icon_width              (BIFIconID icon);
 int            BIF_get_icon_height             (BIFIconID icon);
 void   BIF_draw_icon                   (BIFIconID icon);
index bd443ec1bb8ebdce8b495418c4b67cac1faedacd..ae04bceba9b28b415eb79597d83c494154e5678c 100644 (file)
@@ -378,7 +378,7 @@ void drawbutspace(ScrArea *sa, void *spacedata)
        
        myortho2(v2d->cur.xmin, v2d->cur.xmax, v2d->cur.ymin, v2d->cur.ymax);
 
-       BIF_GetThemeColor3fv(sa, TH_BACK, col);
+       BIF_GetThemeColor3fv(TH_BACK, col);
        glClearColor(col[0], col[1], col[2], 0.0); 
        glClear(GL_COLOR_BUFFER_BIT);
 
index a52157c4b56da2ae81067cf656c5cbff25b323fe..dc8ecb1a513e9f401489c24613f0298246ce82a2 100644 (file)
@@ -206,7 +206,7 @@ void draw_ipogrid(void)
        step= (G.v2d->mask.xmax-G.v2d->mask.xmin+1)/IPOSTEP;
        
        if(curarea->spacetype==SPACE_SOUND) glColor3ub(0x70, 0x70, 0x60);
-       else BIF_ThemeColor(curarea, TH_GRID);
+       else BIF_ThemeColor(TH_GRID);
        
        for(a=0; a<step; a++) {
                glBegin(GL_LINE_STRIP);
@@ -218,7 +218,7 @@ void draw_ipogrid(void)
        vec2[0]= vec1[0]-= 0.5*ipogrid_dx;
        
        if(curarea->spacetype==SPACE_SOUND) glColor3ub(0x80, 0x80, 0x70);
-       else  BIF_ThemeColorShade(curarea, TH_GRID, 16);
+       else  BIF_ThemeColorShade(TH_GRID, 16);
        
        step++;
        for(a=0; a<=step; a++) {
@@ -235,7 +235,7 @@ void draw_ipogrid(void)
                
                step= (curarea->winy+1)/IPOSTEP;
                
-               BIF_ThemeColor(curarea, TH_GRID);
+               BIF_ThemeColor(TH_GRID);
                for(a=0; a<=step; a++) {
                        glBegin(GL_LINE_STRIP);
                        glVertex2fv(vec1); glVertex2fv(vec2);
@@ -246,7 +246,7 @@ void draw_ipogrid(void)
                step++;
                
                if(curarea->spacetype==SPACE_IPO) {
-                       BIF_ThemeColorShade(curarea, TH_GRID, 16);
+                       BIF_ThemeColorShade(TH_GRID, 16);
                        for(a=0; a<step; a++) {
                                glBegin(GL_LINE_STRIP);
                                glVertex2fv(vec1); glVertex2fv(vec2);
@@ -256,7 +256,7 @@ void draw_ipogrid(void)
                }
        }
        
-       BIF_ThemeColorShade(curarea, TH_GRID, -50);
+       BIF_ThemeColorShade(TH_GRID, -50);
        
        if (curarea->spacetype!=SPACE_ACTION && curarea->spacetype!=SPACE_NLA)
        {       /* Horizontal axis */
@@ -615,7 +615,7 @@ void drawscroll(int disptype)
        
        if(G.v2d->scroll & HOR_SCROLL) {
                
-               BIF_ThemeColorShade(curarea, TH_SHADE1, light);
+               BIF_ThemeColorShade(TH_SHADE1, light);
                glRecti(hor.xmin,  hor.ymin,  hor.xmax,  hor.ymax);
                
                /* slider */
@@ -629,11 +629,11 @@ void drawscroll(int disptype)
                
                if(horxmin > horxmax) horxmin= horxmax;
                
-               BIF_ThemeColorShade(curarea, TH_SHADE1, dark);
+               BIF_ThemeColorShade(TH_SHADE1, dark);
                glRecti(horxmin,  hor.ymin,  horxmax,  hor.ymax);
 
                /* decoration bright line */
-               BIF_ThemeColorShade(curarea, TH_SHADE1, lighter);
+               BIF_ThemeColorShade(TH_SHADE1, lighter);
                sdrawline(hor.xmin, hor.ymax, hor.xmax, hor.ymax);
 
                /* the numbers: convert ipogrid_startx and -dx to scroll coordinates */
@@ -643,7 +643,7 @@ void drawscroll(int disptype)
                dfac= (ipogrid_dx)/(G.v2d->cur.xmax-G.v2d->cur.xmin);
                dfac= dfac*(hor.xmax-hor.xmin);
                
-               BIF_ThemeColor(curarea, TH_TEXT);
+               BIF_ThemeColor(TH_TEXT);
                val= ipogrid_startx;
                while(fac < hor.xmax) {
                        
@@ -675,7 +675,7 @@ void drawscroll(int disptype)
        }
        
        if(G.v2d->scroll & VERT_SCROLL) {
-               BIF_ThemeColorShade(curarea, TH_SHADE1, light);
+               BIF_ThemeColorShade(TH_SHADE1, light);
                glRecti(vert.xmin,  vert.ymin,  vert.xmax,  vert.ymax);
                
                /* slider */
@@ -689,11 +689,11 @@ void drawscroll(int disptype)
                
                if(vertymin > vertymax) vertymin= vertymax;
                
-               BIF_ThemeColorShade(curarea, TH_SHADE1, dark);
+               BIF_ThemeColorShade(TH_SHADE1, dark);
                glRecti(vert.xmin,  vertymin,  vert.xmax,  vertymax);
 
                /* decoration black line */
-               BIF_ThemeColorShade(curarea, TH_SHADE1, darker);
+               BIF_ThemeColorShade(TH_SHADE1, darker);
                if(G.v2d->scroll & HOR_SCROLL) 
                        sdrawline(vert.xmax, vert.ymin+SCROLLH, vert.xmax, vert.ymax);
                else 
@@ -707,7 +707,7 @@ void drawscroll(int disptype)
                dfac= dfac*(vert.ymax-vert.ymin-SCROLLH);
                
                if(curarea->spacetype==SPACE_SEQ) {
-                       BIF_ThemeColor(curarea, TH_TEXT);
+                       BIF_ThemeColor(TH_TEXT);
                        val= ipogrid_starty;
                        fac+= 0.5*dfac;
                        while(fac < vert.ymax) {
@@ -722,7 +722,7 @@ void drawscroll(int disptype)
                        /* No digits on vertical axis in action mode! */
                }
                else {
-                       BIF_ThemeColor(curarea, TH_TEXT);
+                       BIF_ThemeColor(TH_TEXT);
                        val= ipogrid_starty;
                        while(fac < vert.ymax) {
                                scroll_prstr((float)(vert.xmax)-14.0, fac, val, 'v', disptype);
@@ -750,7 +750,7 @@ static void draw_ipobuts(SpaceIpo *sipo)
                if(tot<area->winy) sipo->butofs= 0;
        }
        
-       BIF_ThemeColor(curarea, TH_SHADE2);
+       BIF_ThemeColor(TH_SHADE2);
        glRects(v2d->mask.xmax,  0,  area->winx,  area->winy);
        
        cpack(0x0);
@@ -840,14 +840,14 @@ static void draw_ipovertices(int sel)
                if ISPOIN(ei, flag & IPO_VISIBLE, icu) {
                        
                        if(G.sipo->showkey) {
-                               if(sel) BIF_ThemeColor(curarea, TH_TEXT_HI);
-                                else BIF_ThemeColor(curarea, TH_TEXT);
+                               if(sel) BIF_ThemeColor(TH_TEXT_HI);
+                                else BIF_ThemeColor(TH_TEXT);
                        } else if(ei->flag & IPO_EDIT) {
-                               if(sel) BIF_ThemeColor(curarea, TH_VERTEX_SELECT); 
-                               else BIF_ThemeColor(curarea, TH_VERTEX);
+                               if(sel) BIF_ThemeColor(TH_VERTEX_SELECT); 
+                               else BIF_ThemeColor(TH_VERTEX);
                        } else {
-                               if(sel) BIF_ThemeColor(curarea, TH_TEXT_HI);
-                                else BIF_ThemeColor(curarea, TH_TEXT);
+                               if(sel) BIF_ThemeColor(TH_TEXT_HI);
+                                else BIF_ThemeColor(TH_TEXT);
                                 
                                val= (ei->icu->flag & IPO_SELECT)!=0;
                                if(sel != val) continue;
@@ -1008,7 +1008,7 @@ static void draw_ipocurves(int sel)
                                icu= ei->icu;   
                                
                                /* curve */
-                               if(G.sipo->showkey) BIF_ThemeColor(curarea, TH_TEXT); 
+                               if(G.sipo->showkey) BIF_ThemeColor(TH_TEXT); 
                                else cpack(ei->col);
                                
                                /* cyclic */
@@ -1204,7 +1204,7 @@ static void draw_cfra(SpaceIpo *sipo)
        vec[0]*= G.scene->r.framelen;
        
        vec[1]= v2d->cur.ymin;
-       BIF_ThemeColor(curarea, TH_HILITE);
+       BIF_ThemeColor(TH_HILITE);
        glLineWidth(2.0);
        
        glBegin(GL_LINE_STRIP);
@@ -1218,7 +1218,7 @@ static void draw_cfra(SpaceIpo *sipo)
                if(ob && ob->sf!=0.0 && (ob->ipoflag & OB_OFFS_OB) ) {
                        vec[0]-= ob->sf;
                        
-                       BIF_ThemeColorShade(curarea, TH_HILITE, -30);
+                       BIF_ThemeColorShade(TH_HILITE, -30);
                        
                        glBegin(GL_LINE_STRIP);
                        glVertex2fv(vec);
@@ -1309,7 +1309,7 @@ void drawipospace(ScrArea *sa, void *spacedata)
        v2d->hor.xmax+=IPOBUTX;
        calc_scrollrcts(G.v2d, curarea->winx, curarea->winy);
 
-       BIF_GetThemeColor3fv(sa, TH_BACK, col);
+       BIF_GetThemeColor3fv(TH_BACK, col);
        glClearColor(col[0], col[1], col[2], 0.0); 
 
        if (sipo->pin)
index 0ff8088f31c17ecffd14234521c161552ad1566b..02f01debb630d91684244d84f5b15cc0dc00c2ee 100644 (file)
@@ -732,11 +732,11 @@ static void tekenvertslatt(short sel)
        float size;
        int a, uxt, u, vxt, v, wxt, w;
 
-       size= BIF_GetThemeColorf(curarea, TH_VERTEX_SIZE);
+       size= BIF_GetThemeColorf(TH_VERTEX_SIZE);
        glPointSize(size);
 
-       if(sel) BIF_ThemeColor(curarea, TH_VERTEX_SELECT);
-       else BIF_ThemeColor(curarea, TH_VERTEX);
+       if(sel) BIF_ThemeColor(TH_VERTEX_SELECT);
+       else BIF_ThemeColor(TH_VERTEX);
 
        glBegin(GL_POINTS);
 
@@ -1036,11 +1036,11 @@ void tekenvertices(short sel)
        EditVert *eve;
        float size;
        
-       size= BIF_GetThemeColorf(curarea, TH_VERTEX_SIZE);
+       size= BIF_GetThemeColorf(TH_VERTEX_SIZE);
        glPointSize(size);
        
-       if(sel) BIF_ThemeColor(curarea, TH_VERTEX_SELECT);
-       else BIF_ThemeColor(curarea, TH_VERTEX);
+       if(sel) BIF_ThemeColor(TH_VERTEX_SELECT);
+       else BIF_ThemeColor(TH_VERTEX);
 
        glBegin(GL_POINTS);
 
@@ -2400,8 +2400,8 @@ static void drawmeshwire(Object *ob)
                if(G.f & (G_FACESELECT+G_DRAWFACES)) {  /* faces */
                        char col1[4], col2[4];
                        
-                       BIF_GetThemeColor4ubv(curarea, TH_FACE, col1);
-                       BIF_GetThemeColor4ubv(curarea, TH_FACE_SELECT, col2);
+                       BIF_GetThemeColor4ubv(TH_FACE, col1);
+                       BIF_GetThemeColor4ubv(TH_FACE_SELECT, col2);
                        
                        glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
                        glEnable(GL_BLEND);
@@ -2459,7 +2459,7 @@ static void drawmeshwire(Object *ob)
                
                if(G.f & G_DRAWEDGES) { /* Use edge Highlighting */
                        char col[4];
-                       BIF_GetThemeColor3ubv(curarea, TH_EDGE_SELECT, col);
+                       BIF_GetThemeColor3ubv(TH_EDGE_SELECT, col);
                        glShadeModel(GL_SMOOTH);
                        
                        eed= G.eded.first;
@@ -2785,10 +2785,10 @@ static void tekenvertsN(Nurb *nu, short sel)
 
        if(nu->hide) return;
 
-       if(sel) BIF_ThemeColor(curarea, TH_VERTEX_SELECT);
-       else BIF_ThemeColor(curarea, TH_VERTEX);
+       if(sel) BIF_ThemeColor(TH_VERTEX_SELECT);
+       else BIF_ThemeColor(TH_VERTEX);
 
-       size= BIF_GetThemeColorf(curarea, TH_VERTEX_SIZE);
+       size= BIF_GetThemeColorf(TH_VERTEX_SIZE);
        glPointSize(size);
        
        glBegin(GL_POINTS);
@@ -3453,15 +3453,15 @@ void draw_object(Base *base)
        if((G.f & (G_BACKBUFSEL+G_PICKSEL)) == 0) {
                project_short(ob->obmat[3], &base->sx);
                
-               if(G.moving==1 && (base->flag & (SELECT+BA_PARSEL))) BIF_ThemeColor(curarea, TH_TRANSFORM);
+               if(G.moving==1 && (base->flag & (SELECT+BA_PARSEL))) BIF_ThemeColor(TH_TRANSFORM);
                else {
                
-                       BIF_ThemeColor(curarea, TH_WIRE);
+                       BIF_ThemeColor(TH_WIRE);
                        if((G.scene->basact)==base) {
-                               if(base->flag & (SELECT+BA_WASSEL)) BIF_ThemeColor(curarea, TH_ACTIVE);
+                               if(base->flag & (SELECT+BA_WASSEL)) BIF_ThemeColor(TH_ACTIVE);
                        }
                        else {
-                               if(base->flag & (SELECT+BA_WASSEL)) BIF_ThemeColor(curarea, TH_SELECT);
+                               if(base->flag & (SELECT+BA_WASSEL)) BIF_ThemeColor(TH_SELECT);
                        }
                        
                        // no theme yet
index 1f54532f996107d8d52d59a9447dbd83b567988f..166a8d5b728671d6b1e1b49dc16a02f59bb1b10b 100644 (file)
@@ -428,7 +428,7 @@ static void drawgrid_draw(float wx, float wy, float x, float y, float dx)
 
 }
 
-static void drawgrid(ScrArea *sa)
+static void drawgrid(void)
 {
        /* extern short bgpicmode; */
        float wx, wy, x, y, fw, fx, fy, dx;
@@ -460,7 +460,7 @@ static void drawgrid(ScrArea *sa)
        if(dx==0) dx= fabs(y-(wy)*fy/fw);
 
        /* check zoom out */
-       BIF_ThemeColor(sa, TH_GRID);
+       BIF_ThemeColor(TH_GRID);
        persp(PERSP_WIN);
 
        if(dx<6.0) {
@@ -473,23 +473,23 @@ static void drawgrid(ScrArea *sa)
                                dx*=10;
                                if(dx<6.0);
                                else {
-                                       BIF_ThemeColor(sa, TH_GRID);
+                                       BIF_ThemeColor(TH_GRID);
                                        drawgrid_draw(wx, wy, x, y, dx);
                                }
                        }
                        else {  // start blending out
-                               BIF_ThemeColorBlend(curarea, TH_BACK, TH_GRID, dx/60.0);
+                               BIF_ThemeColorBlend(TH_BACK, TH_GRID, dx/60.0);
                                drawgrid_draw(wx, wy, x, y, dx);
                        
-                               BIF_ThemeColor(sa, TH_GRID);
+                               BIF_ThemeColor(TH_GRID);
                                drawgrid_draw(wx, wy, x, y, 10*dx);
                        }
                }
                else {  // start blending out (6 < dx < 60)
-                       BIF_ThemeColorBlend(curarea, TH_BACK, TH_GRID, dx/60.0);
+                       BIF_ThemeColorBlend(TH_BACK, TH_GRID, dx/60.0);
                        drawgrid_draw(wx, wy, x, y, dx);
                        
-                       BIF_ThemeColor(sa, TH_GRID);
+                       BIF_ThemeColor(TH_GRID);
                        drawgrid_draw(wx, wy, x, y, 10*dx);
                }
        }
@@ -499,34 +499,34 @@ static void drawgrid(ScrArea *sa)
                        if(dx>60.0) {           // start blending in
                                dx/= 10.0;
                                if(dx>60.0) {
-                                       BIF_ThemeColor(sa, TH_GRID);
+                                       BIF_ThemeColor(TH_GRID);
                                        drawgrid_draw(wx, wy, x, y, dx);
                                }
                                else {
-                                       BIF_ThemeColorBlend(curarea, TH_BACK, TH_GRID, dx/60.0);
+                                       BIF_ThemeColorBlend(TH_BACK, TH_GRID, dx/60.0);
                                        drawgrid_draw(wx, wy, x, y, dx);
-                                       BIF_ThemeColor(sa, TH_GRID);
+                                       BIF_ThemeColor(TH_GRID);
                                        drawgrid_draw(wx, wy, x, y, dx*10);
                                }
                        }
                        else {
-                               BIF_ThemeColorBlend(curarea, TH_BACK, TH_GRID, dx/60.0);
+                               BIF_ThemeColorBlend(TH_BACK, TH_GRID, dx/60.0);
                                drawgrid_draw(wx, wy, x, y, dx);
-                               BIF_ThemeColor(sa, TH_GRID);
+                               BIF_ThemeColor(TH_GRID);
                                drawgrid_draw(wx, wy, x, y, dx*10);
                        }
                }
                else {
-                       BIF_ThemeColorBlend(curarea, TH_BACK, TH_GRID, dx/60.0);
+                       BIF_ThemeColorBlend(TH_BACK, TH_GRID, dx/60.0);
                        drawgrid_draw(wx, wy, x, y, dx);
-                       BIF_ThemeColor(sa, TH_GRID);
+                       BIF_ThemeColor(TH_GRID);
                        drawgrid_draw(wx, wy, x, y, dx*10);
                }
        }
 
        x+= (wx); 
        y+= (wy);
-       BIF_GetThemeColor3ubv(curarea, TH_GRID, col);
+       BIF_GetThemeColor3ubv(TH_GRID, col);
        
        /* center cross */
        if(G.vd->view==3) glColor3ub(col[0]<36?0:col[0]-36, col[1]>199?255:col[1]+56, col[2]<36?0:col[2]-36); /* y-as */
@@ -544,7 +544,7 @@ static void drawgrid(ScrArea *sa)
 }
 
 
-static void drawfloor(ScrArea *sa)
+static void drawfloor(void)
 {
        View3D *vd;
        float vert[3], grid;
@@ -560,8 +560,8 @@ static void drawfloor(ScrArea *sa)
        gridlines= vd->gridlines/2;
        grid= gridlines*vd->grid;
        
-       BIF_ThemeColor(sa, TH_GRID);
-       BIF_GetThemeColor3ubv(curarea, TH_GRID, col);
+       BIF_ThemeColor(TH_GRID);
+       BIF_GetThemeColor3ubv(TH_GRID, col);
        
        for(a= -gridlines;a<=gridlines;a++) {
 
@@ -569,7 +569,7 @@ static void drawfloor(ScrArea *sa)
                        glColor3ub(col[0]<36?0:col[0]-36, col[1]>199?255:col[1]+56, col[2]<36?0:col[2]-36);     /* y-as */
                }
                else if(a==1) {
-                       BIF_ThemeColor(sa, TH_GRID);
+                       BIF_ThemeColor(TH_GRID);
                }
                
        
@@ -582,14 +582,14 @@ static void drawfloor(ScrArea *sa)
                glEnd();
        }
        
-       BIF_ThemeColor(sa, TH_GRID);
+       BIF_ThemeColor(TH_GRID);
        
        for(a= -gridlines;a<=gridlines;a++) {
                if(a==0) {
                        glColor3ub(col[0]>219?255:col[0]+36, col[1]<26?0:col[1]-26, col[2]<26?0:col[2]-26);     /* x-as */
                }
                else if(a==1) {
-                       BIF_ThemeColor(sa, TH_GRID);
+                       BIF_ThemeColor(TH_GRID);
                }
        
                glBegin(GL_LINE_STRIP);
@@ -846,7 +846,7 @@ static void draw_selected_name(char *name)
 
        sprintf(info, "(%d) %s", CFRA, name);
 
-       BIF_ThemeColor(curarea, TH_TEXT_HI);
+       BIF_ThemeColor(TH_TEXT_HI);
        glRasterPos2i(30,  10);
        BMF_DrawString(G.fonts, info);
 }
@@ -1226,7 +1226,7 @@ void drawview3dspace(ScrArea *sa, void *spacedata)
                }
                else {
                        float col[3];
-                       BIF_GetThemeColor3fv(sa, TH_BACK, col);
+                       BIF_GetThemeColor3fv(TH_BACK, col);
                        glClearColor(col[0], col[1], col[2], 0.0); 
                }
                glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
@@ -1235,7 +1235,7 @@ void drawview3dspace(ScrArea *sa, void *spacedata)
        }
        else {
                float col[3];
-               BIF_GetThemeColor3fv(sa, TH_BACK, col);
+               BIF_GetThemeColor3fv(TH_BACK, col);
                glClearColor(col[0], col[1], col[2], 0.0);
                glClear(GL_COLOR_BUFFER_BIT);
        }
@@ -1244,7 +1244,7 @@ void drawview3dspace(ScrArea *sa, void *spacedata)
        persp(PERSP_STORE);  // store correct view for persp(PERSP_VIEW) calls
 
        if(G.vd->view==0 || G.vd->persp!=0) {
-               drawfloor(sa);
+               drawfloor();
                if(G.vd->persp==2) {
                        if(G.scene->world) {
                                if(G.scene->world->mode & WO_STARS) RE_make_stars(star_stuff_init_func,
@@ -1255,7 +1255,7 @@ void drawview3dspace(ScrArea *sa, void *spacedata)
                }
        }
        else {
-               drawgrid(sa);
+               drawgrid();
 
                if(G.vd->flag & V3D_DISPBGPIC) {
                        draw_bgpic();
index a18e4ce1a5dd9b2b136bed95c96f9483ca9d6555..679479e8ebb21511ad9da71cbe39d4fb4330ef2f 100644 (file)
@@ -246,6 +246,8 @@ void areawinset(short win)
                        return;
                }
                
+               BIF_SetTheme(curarea);
+               
                switch(curarea->spacetype) {
                case SPACE_VIEW3D:
                        G.vd= curarea->spacedata.first;
@@ -300,8 +302,8 @@ void headerbox(ScrArea *area)
        glClearColor(SCR_BACK, SCR_BACK, SCR_BACK, 0.0);
        glClear(GL_COLOR_BUFFER_BIT);
 
-       if(area_is_active_area(area)) BIF_ThemeColor(area, TH_HEADER);
-       else BIF_ThemeColorShade(area, TH_HEADER, -20);
+       if(area_is_active_area(area)) BIF_ThemeColor(TH_HEADER);
+       else BIF_ThemeColorShade(TH_HEADER, -20);
        
        /* weird values here... is because of window matrix that centres buttons */
        if(area->headertype==HEADERTOP) {
index 5ab50ea76cae65209257b703b4c0f001467e7712..bd7584d177a31f1396043ca12966b53f28f668ab 100644 (file)
@@ -887,12 +887,12 @@ static void draw_filescroll(SpaceFile *sfile)
 
        if(scrollrct.ymin+10 >= scrollrct.ymax) return;
        
-       BIF_ThemeColor(curarea, TH_BACK);
+       BIF_ThemeColor(TH_BACK);
        glRecti(scrollrct.xmin,  scrollrct.ymin,  scrollrct.xmax,  scrollrct.ymax);
 
        uiEmboss(scrollrct.xmin, scrollrct.ymin, scrollrct.xmax, scrollrct.ymax, 1);
 
-       BIF_ThemeColor(curarea, TH_HEADER);
+       BIF_ThemeColor(TH_HEADER);
        glRecti(bar.xmin+2,  bar.ymin+2,  bar.xmax-2,  bar.ymax-2);
 
        uiEmboss(bar.xmin+2, bar.ymin+2, bar.xmax-2, bar.ymax-2, filescrollselect);
@@ -902,11 +902,11 @@ static void draw_filescroll(SpaceFile *sfile)
 static void regelrect(int id, int x, int y)
 {
        if(id & ACTIVE) {
-               if(id & HILITE) BIF_ThemeColorShade(curarea, TH_HILITE, 20);
-               else BIF_ThemeColor(curarea, TH_HILITE);
+               if(id & HILITE) BIF_ThemeColorShade(TH_HILITE, 20);
+               else BIF_ThemeColor(TH_HILITE);
        }
-       else if(id & HILITE) BIF_ThemeColorShade(curarea, TH_BACK, 20);
-       else BIF_ThemeColor(curarea, TH_BACK);
+       else if(id & HILITE) BIF_ThemeColorShade(TH_BACK, 20);
+       else BIF_ThemeColor(TH_BACK);
        
        glRects(x-17,  y-3,  x+collumwidth-21,  y+11);
 
@@ -952,8 +952,8 @@ static void printregel(SpaceFile *sfile, struct direntry *files, int x, int y)
                glRects(x-14,  y,  x-8,  y+7);
        }
        
-       if(S_ISDIR(files->type)) BIF_ThemeColor(curarea, TH_TEXT_HI);
-       else BIF_ThemeColor(curarea, TH_TEXT);
+       if(S_ISDIR(files->type)) BIF_ThemeColor(TH_TEXT_HI);
+       else BIF_ThemeColor(TH_TEXT);
 
        s = files->string;
        if(s) {
@@ -1095,7 +1095,7 @@ static void draw_filetext(SpaceFile *sfile)
 
 
        /* box */
-       BIF_ThemeColor(curarea, TH_BACK);
+       BIF_ThemeColor(TH_BACK);
        glRecti(textrct.xmin,  textrct.ymin,  textrct.xmax,  textrct.ymax);
 
        /* collums */
@@ -1128,7 +1128,7 @@ static void draw_filetext(SpaceFile *sfile)
        /* clear drawing errors, with text at the right hand side: */
        uiEmboss(textrct.xmin, textrct.ymin, textrct.xmax, textrct.ymax, 1);
        
-       BIF_ThemeColor(curarea, TH_HEADER);
+       BIF_ThemeColor(TH_HEADER);
        glRecti(textrct.xmax+2,  textrct.ymin,  textrct.xmax+10,  textrct.ymax);
 }
 
@@ -1144,7 +1144,7 @@ void drawfilespace(ScrArea *sa, void *spacedata)
 
        myortho2(-0.5, sa->winx-0.5, -0.5, sa->winy-0.5);
 
-       BIF_GetThemeColor3fv(sa, TH_HEADER, col);       // basic undrawn color is border
+       BIF_GetThemeColor3fv(TH_HEADER, col);   // basic undrawn color is border
        glClearColor(col[0], col[1], col[2], 0.0); 
        glClear(GL_COLOR_BUFFER_BIT);
 
index 32fd2349ed2fe6d6a1c2e56b31af0e0a9f9f7475..09f30f66944fc4a8d0218655ce4e682e476fc358 100644 (file)
@@ -677,7 +677,7 @@ static void ui_draw_tria_icon(float x, float y, float aspect, char dir)
 {
 
        
-       BIF_ThemeColor(curarea, TH_TEXT_HI);
+       BIF_ThemeColor(TH_TEXT_HI);
        
        if(dir=='h') {
                ui_draw_anti_tria( x, y, x, y+10.0, x+6, y+5.25);
@@ -758,11 +758,11 @@ static void ui_draw_panel_header(uiBlock *block)
        if(nr==1) {
                /* active tab */
                /*uiSetRoundBox(3);
-               BIF_ThemeColorShade(curarea, TH_HEADER, -3);
+               BIF_ThemeColorShade(TH_HEADER, -3);
                uiRoundBox(2+block->minx+pnl_icons, panel->sizey-1, block->maxx, panel->sizey+PNL_HEADER, 10);
                */
 
-               BIF_ThemeColor(curarea, TH_TEXT_HI);
+               BIF_ThemeColor(TH_TEXT_HI);
                glRasterPos2f(4+block->minx+pnl_icons, block->maxy+5);
                BIF_DrawString(block->curfont, block->panel->panelname, (U.transopts & TR_BUTTONS), 1);
                return;
@@ -776,10 +776,10 @@ static void ui_draw_panel_header(uiBlock *block)
                else if(pa==panel) {
                        /* active tab */
                        uiSetRoundBox(3);
-                       BIF_ThemeColorShade(curarea, TH_HEADER, -3);
+                       BIF_ThemeColorShade(TH_HEADER, -3);
                        uiRoundBox(2+pnl_icons+a*width, panel->sizey-1, pnl_icons+(a+1)*width, panel->sizey+PNL_HEADER-3, 8);
 
-                       BIF_ThemeColor(curarea, TH_TEXT);
+                       BIF_ThemeColor(TH_TEXT);
                        glRasterPos2f(16+pnl_icons+a*width, panel->sizey+4);
                        str= ui_block_cut_str(block, pa->panelname, (short)(width-10));
                        BIF_DrawString(block->curfont, str, (U.transopts & TR_BUTTONS), 0);
@@ -789,10 +789,10 @@ static void ui_draw_panel_header(uiBlock *block)
                else if(pa->paneltab==panel) {
                        /* not active tab */
                        
-                       BIF_ThemeColorShade(curarea, TH_HEADER, -60);
+                       BIF_ThemeColorShade(TH_HEADER, -60);
                        uiRoundBox(2+pnl_icons+a*width, panel->sizey, pnl_icons+(a+1)*width, panel->sizey+PNL_HEADER-3, 8);
                        
-                       BIF_ThemeColor(curarea, TH_TEXT_HI);
+                       BIF_ThemeColor(TH_TEXT_HI);
                        glRasterPos2f(16+pnl_icons+a*width, panel->sizey+4);
                        str= ui_block_cut_str(block, pa->panelname, (short)(width-10));
                        BIF_DrawString(block->curfont, str, (U.transopts & TR_BUTTONS), 1);
@@ -805,7 +805,7 @@ static void ui_draw_panel_header(uiBlock *block)
        // dragger
        /*
        uiSetRoundBox(15);
-       BIF_ThemeColorShade(curarea, TH_HEADER, -70);
+       BIF_ThemeColorShade(TH_HEADER, -70);
        uiRoundBox(panel->sizex-PNL_ICON+5, panel->sizey+5, panel->sizex-5, panel->sizey+PNL_HEADER-5, 5);
        */
        
@@ -825,23 +825,23 @@ void ui_draw_panel(uiBlock *block)
        
        if(panel->flag & PNL_CLOSEDY) {
                uiSetRoundBox(15);
-               BIF_ThemeColorShade(curarea, TH_HEADER, -30);
+               BIF_ThemeColorShade(TH_HEADER, -30);
                uiRoundBox(block->minx, block->maxy, block->maxx, block->maxy+PNL_HEADER, 10);
                
                // title
                ofsx= PNL_ICON+8;
                if(panel->control & UI_PNL_CLOSE) ofsx+= PNL_ICON;
-               BIF_ThemeColor(curarea, TH_TEXT_HI);
+               BIF_ThemeColor(TH_TEXT_HI);
                glRasterPos2f(4+block->minx+ofsx, block->maxy+5);
                BIF_DrawString(block->curfont, panel->panelname, (U.transopts & TR_BUTTONS), 1);
 
                //  border
                if(panel->flag & PNL_SELECT) {
-                       BIF_ThemeColorShade(curarea, TH_HEADER, -120);
+                       BIF_ThemeColorShade(TH_HEADER, -120);
                        uiRoundRect(block->minx, block->maxy, block->maxx, block->maxy+PNL_HEADER, 10);
                }
                if(panel->flag & PNL_OVERLAP) {
-                       BIF_ThemeColor(curarea, TH_TEXT_HI);
+                       BIF_ThemeColor(TH_TEXT_HI);
                        uiRoundRect(block->minx, block->maxy, block->maxx, block->maxy+PNL_HEADER, 10);
                }
        
@@ -851,11 +851,11 @@ void ui_draw_panel(uiBlock *block)
                int a, end, ofs;
                
                uiSetRoundBox(15);
-               BIF_ThemeColorShade(curarea, TH_HEADER, -30);
+               BIF_ThemeColorShade(TH_HEADER, -30);
                uiRoundBox(block->minx, block->miny, block->minx+PNL_HEADER, block->maxy+PNL_HEADER, 10);
        
                // title, only capitals for now
-               BIF_ThemeColor(curarea, TH_TEXT_HI);
+               BIF_ThemeColor(TH_TEXT_HI);
                str[1]= 0;
                end= strlen(panel->panelname);
                ofs= 20;
@@ -870,11 +870,11 @@ void ui_draw_panel(uiBlock *block)
                
                //  border
                if(panel->flag & PNL_SELECT) {
-                       BIF_ThemeColorShade(curarea, TH_HEADER, -120);
+                       BIF_ThemeColorShade(TH_HEADER, -120);
                        uiRoundRect(block->minx, block->miny, block->minx+PNL_HEADER, block->maxy+PNL_HEADER, 10);
                }
                if(panel->flag & PNL_OVERLAP) {
-                       BIF_ThemeColor(curarea, TH_TEXT_HI);
+                       BIF_ThemeColor(TH_TEXT_HI);
                        uiRoundRect(block->minx, block->miny, block->minx+PNL_HEADER, block->maxy+PNL_HEADER, 10);
                }
        
@@ -884,12 +884,12 @@ void ui_draw_panel(uiBlock *block)
                uiSetRoundBox(3);
 
                if(panel->control & UI_PNL_SOLID) {
-                       BIF_ThemeColorShade(curarea, TH_HEADER, -40);
+                       BIF_ThemeColorShade(TH_HEADER, -40);
                        uiRoundBox(block->minx, block->maxy, block->maxx, block->maxy+PNL_HEADER, 10);
                        // blend now for panels in 3d window, test...
                        glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
                        glEnable(GL_BLEND);
-                       BIF_ThemeColor4(curarea, TH_PANEL);
+                       BIF_ThemeColor4(TH_PANEL);
                        glRectf(block->minx, block->miny, block->maxx, block->maxy);
 
                        //if(align) {
@@ -903,12 +903,12 @@ void ui_draw_panel(uiBlock *block)
                        glDisable(GL_BLEND);
                }
                else if(panel->control & UI_PNL_TRANSP) {
-                       BIF_ThemeColorShade(curarea, TH_HEADER, -30);
+                       BIF_ThemeColorShade(TH_HEADER, -30);
                        uiRoundBox(block->minx, block->maxy, block->maxx, block->maxy+PNL_HEADER, 10);
                        
                        glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
                        glEnable(GL_BLEND);
-                       BIF_ThemeColor4(curarea, TH_PANEL);
+                       BIF_ThemeColor4(TH_PANEL);
                        glRectf(block->minx, block->miny, block->maxx, block->maxy);
 
                        glDisable(GL_BLEND);
@@ -920,11 +920,11 @@ void ui_draw_panel(uiBlock *block)
                //  border
                uiSetRoundBox(3);
                if(panel->flag & PNL_SELECT) {
-                       BIF_ThemeColorShade(curarea, TH_HEADER, -120);
+                       BIF_ThemeColorShade(TH_HEADER, -120);
                        uiRoundRect(block->minx, block->miny, block->maxx, block->maxy+PNL_HEADER, 10);
                }
                if(panel->flag & PNL_OVERLAP) {
-                       BIF_ThemeColor(curarea, TH_TEXT_HI);
+                       BIF_ThemeColor(TH_TEXT_HI);
                        uiRoundRect(block->minx, block->miny, block->maxx, block->maxy+PNL_HEADER, 10);
                }
                
@@ -1085,7 +1085,7 @@ int uiAlignPanelStep(ScrArea *sa, float fac)
                }
                else {
                        psnext->pa->ofsx = get_panel_real_ofsx(ps->pa)+PNL_DIST;
-                       psnext->pa->ofsy = ps->pa->ofsy;
+                       psnext->pa->ofsy = ps->pa->ofsy + ps->pa->sizey - psnext->pa->sizey;
                }
        }
        
index b2a0bd4f1ff9a03615cfba2eae994d6aa65116b7..0c9702abc34b7e52e6584f228d6c211b135e3057 100644 (file)
@@ -423,7 +423,7 @@ char *BIF_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colorid)
 #define SETCOL(col, r, g, b, a)  col[0]=r; col[1]=g; col[2]= b; col[3]= a;
 
 // initialize
-void BIF_InitThemeColors(void)
+void BIF_InitTheme(void)
 {
        bTheme *btheme= U.themes.first;
        
@@ -438,6 +438,8 @@ void BIF_InitThemeColors(void)
                strcpy(btheme->name, "Default");
        }
        
+       BIF_SetTheme(NULL);     // make sure the global used in this file is set
+       
        /* UI buttons (todo) */
        
        /* space view3d */
@@ -560,131 +562,119 @@ char *BIF_ThemeColorsPup(int spacetype)
        return cp;
 }
 
+static bTheme *theme_active=NULL;
+static int theme_spacetype= SPACE_VIEW3D;
+
+void BIF_SetTheme(ScrArea *sa)
+{
+       if(sa==NULL) {  // called for safety, when delete themes
+               theme_active= U.themes.first;
+               theme_spacetype= SPACE_VIEW3D;
+       }
+       else {
+               // later on, a local theme can be found too
+               theme_active= U.themes.first;
+               theme_spacetype= sa->spacetype;
+       
+       }
+}
+
 // for space windows only
-void BIF_ThemeColor(ScrArea *sa, int colorid)
+void BIF_ThemeColor(int colorid)
 {
-       bTheme *btheme= U.themes.first;
        char *cp;
        
-       if(btheme) {
-               cp= BIF_ThemeGetColorPtr(btheme, sa->spacetype, colorid);
-               glColor3ub(cp[0], cp[1], cp[2]);
-       }
-       else {  // debug mostly, you never know
-               glColor3ub(255, 0, 255);
-       }
+       cp= BIF_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
+       glColor3ub(cp[0], cp[1], cp[2]);
+
 }
 
 // plus alpha
-void BIF_ThemeColor4(ScrArea *sa, int colorid)
+void BIF_ThemeColor4(int colorid)
 {
-       bTheme *btheme= U.themes.first;
        char *cp;
        
-       if(btheme) {
-               cp= BIF_ThemeGetColorPtr(btheme, sa->spacetype, colorid);
-               glColor4ub(cp[0], cp[1], cp[2], cp[3]);
-       }
-       else {  // debug mostly, you never know
-               glColor3ub(255, 0, 255);
-       }
+       cp= BIF_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
+       glColor4ub(cp[0], cp[1], cp[2], cp[3]);
+
 }
 
-void BIF_ThemeColorShade(ScrArea *sa, int colorid, int offset)
+// set the color with offset for shades
+void BIF_ThemeColorShade(int colorid, int offset)
 {
-       bTheme *btheme= U.themes.first;
        int r, g, b;
        char *cp;
        
-       if(btheme) {
-               cp= BIF_ThemeGetColorPtr(btheme, sa->spacetype, colorid);
-               r= offset + (int) cp[0];
-               CLAMP(r, 0, 255);
-               g= offset + (int) cp[1];
-               CLAMP(g, 0, 255);
-               b= offset + (int) cp[2];
-               CLAMP(b, 0, 255);
-               glColor3ub(r, g, b);
-       }
-       else {  // debug mostly, you never know
-               glColor3ub(255, 0, 255);
-       }
+       cp= BIF_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
+       r= offset + (int) cp[0];
+       CLAMP(r, 0, 255);
+       g= offset + (int) cp[1];
+       CLAMP(g, 0, 255);
+       b= offset + (int) cp[2];
+       CLAMP(b, 0, 255);
+       glColor3ub(r, g, b);
 }
 
-void BIF_ThemeColorBlend(ScrArea *sa, int colorid1, int colorid2, float fac)
+// blend between to theme colors, and set it
+void BIF_ThemeColorBlend(int colorid1, int colorid2, float fac)
 {
-       bTheme *btheme= U.themes.first;
        int r, g, b;
        char *cp1, *cp2;
        
-       if(btheme) {
-               cp1= BIF_ThemeGetColorPtr(btheme, sa->spacetype, colorid1);
-               cp2= BIF_ThemeGetColorPtr(btheme, sa->spacetype, colorid2);
-               if(fac<0.0) fac=0.0; else if(fac>1.0) fac= 1.0;
-               r= floor((1.0-fac)*cp1[0] + fac*cp2[0]);
-               g= floor((1.0-fac)*cp1[1] + fac*cp2[1]);
-               b= floor((1.0-fac)*cp1[2] + fac*cp2[2]);
-               
-               glColor3ub(r, g, b);
-       }
-       else {  // debug mostly, you never know
-               glColor3ub(255, 0, 255);
-       }
+       cp1= BIF_ThemeGetColorPtr(theme_active, theme_spacetype, colorid1);
+       cp2= BIF_ThemeGetColorPtr(theme_active, theme_spacetype, colorid2);
+
+       if(fac<0.0) fac=0.0; else if(fac>1.0) fac= 1.0;
+       r= floor((1.0-fac)*cp1[0] + fac*cp2[0]);
+       g= floor((1.0-fac)*cp1[1] + fac*cp2[1]);
+       b= floor((1.0-fac)*cp1[2] + fac*cp2[2]);
+       
+       glColor3ub(r, g, b);
 }
 
 
 // get individual values, not scaled
-float BIF_GetThemeColorf(ScrArea *sa, int colorid)
+float BIF_GetThemeColorf(int colorid)
 {
-       bTheme *btheme= U.themes.first;
        char *cp;
        
-       if(btheme) {
-               cp= BIF_ThemeGetColorPtr(btheme, sa->spacetype, colorid);
-               return ((float)cp[0]);
-       }
-       return 1.0;
+       cp= BIF_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
+       return ((float)cp[0]);
+
 }
 
 // get the color, range 0.0-1.0
-void BIF_GetThemeColor3fv(ScrArea *sa, int colorid, float *col)
+void BIF_GetThemeColor3fv(int colorid, float *col)
 {
-       bTheme *btheme= U.themes.first;
        char *cp;
        
-       if(btheme) {
-               cp= BIF_ThemeGetColorPtr(btheme, sa->spacetype, colorid);
-               col[0]= ((float)cp[0])/255.0;
-               col[1]= ((float)cp[1])/255.0;
-               col[2]= ((float)cp[2])/255.0;
-       }
+       cp= BIF_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
+       col[0]= ((float)cp[0])/255.0;
+       col[1]= ((float)cp[1])/255.0;
+       col[2]= ((float)cp[2])/255.0;
 }
 
-void BIF_GetThemeColor3ubv(ScrArea *sa, int colorid, char *col)
+// get the color, in char pointer
+void BIF_GetThemeColor3ubv(int colorid, char *col)
 {
-       bTheme *btheme= U.themes.first;
        char *cp;
        
-       if(btheme) {
-               cp= BIF_ThemeGetColorPtr(btheme, sa->spacetype, colorid);
-               col[0]= cp[0];
-               col[1]= cp[1];
-               col[2]= cp[2];
-       }
+       cp= BIF_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
+       col[0]= cp[0];
+       col[1]= cp[1];
+       col[2]= cp[2];
 }
 
-void BIF_GetThemeColor4ubv(ScrArea *sa, int colorid, char *col)
+// get the color, in char pointer
+void BIF_GetThemeColor4ubv(int colorid, char *col)
 {
-       bTheme *btheme= U.themes.first;
        char *cp;
        
-       if(btheme) {
-               cp= BIF_ThemeGetColorPtr(btheme, sa->spacetype, colorid);
-               col[0]= cp[0];
-               col[1]= cp[1];
-               col[2]= cp[2];
-               col[3]= cp[3];
-       }
+       cp= BIF_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
+       col[0]= cp[0];
+       col[1]= cp[1];
+       col[2]= cp[2];
+       col[3]= cp[3];
 }
 
 
index 612bf6ed505dd3338ae06c946e68e2dcad17144b..80ac9ae7cd55943b5b5af08f9a8aeb855b861686 100644 (file)
@@ -2209,6 +2209,7 @@ void winqreadinfospace(ScrArea *sa, void *spacedata, BWinEvent *evt)
                                bTheme *btheme= U.themes.first;
                                BLI_remlink(&U.themes, btheme);
                                MEM_freeN(btheme);
+                               BIF_SetTheme(curarea); // prevent usage of old theme in calls   
                                addqueue(sa->win, REDRAW, 1);
                        }
                        else if(val==B_NAME_THEME) {
index 8eb130e12257fb8723741157ce7045984150e48f..00dd129084c9af86053f0724e226c956065ee2df 100644 (file)
@@ -142,7 +142,6 @@ void BIF_read_file(char *name)
 
 int BIF_read_homefile(void)
 {
-       bTheme *btheme;
        char tstr[FILE_MAXDIR+FILE_MAXFILE], scestr[FILE_MAXDIR];
        char *home= BLI_gethome();
        int success;
@@ -164,7 +163,9 @@ int BIF_read_homefile(void)
                success = BKE_read_file_from_memory(datatoc_B_blend, datatoc_B_blend_size, NULL);
        }
        strcpy(G.sce, scestr);
-
+       
+       BIF_InitTheme();        // sets default again
+       
        if (success) {
                G.save_over = 0;
 
@@ -490,7 +491,6 @@ void BIF_init(void)
        init_draw_rects();      /* drawobject.c */
        init_gl_stuff();        /* drawview.c */
        BIF_read_homefile(); 
-       BIF_InitThemeColors();  /* after read home file! */
        readBlog();
        strcpy(G.lib, G.sce);