Final merge of HEAD (bf-blender) into the orange branch.
[blender.git] / source / blender / src / drawoops.c
index 0fc22ceea916fdbc59af56cc5ad420d2d33fbf74..dbf245179dfc91f14b46c6be6621dfb69d87c561 100644 (file)
@@ -87,7 +87,7 @@ void boundbox_oops(short sel)
        
        oops= G.soops->oops.first;
        while(oops) {
-               if (oops->hide==0 && !sel || (sel && oops->flag & SELECT )) {
+               if ((oops->hide==0 && !sel) || (sel && oops->flag & SELECT )) {
                        ok= 1;
                        
                        min[0]= MIN2(min[0], oops->x);
@@ -132,7 +132,9 @@ void draw_oopslink(Oops *oops)
        
        if(oops->type==ID_SCE) {
                if(oops->flag & SELECT) {
-                       if(oops->id->lib) cpack(0x4080A0);
+                       /* when using python Mesh to make meshes a file was saved
+                       that had an oops with no ID, stops a segfault when looking for lib */
+                       if(oops->id && oops->id->lib) cpack(0x4080A0);
                        else cpack(0x808080);
                }
                else cpack(0x606060);
@@ -346,7 +348,10 @@ void draw_oops(Oops *oops)
 
                glRectf(x1,  y1,  x2,  y2);
        }
-       if(oops->id->lib) {
+       
+       /* it has never happened that an oops was missing an ID at
+       this point but has occured elseware so lets be safe */
+       if(oops->id && oops->id->lib) { 
                if(oops->id->flag & LIB_INDIRECT) cpack(0x1144FF);
                else cpack(0x11AAFF);
 
@@ -369,8 +374,8 @@ void draw_oops(Oops *oops)
        } else { /* NO ICON, UNINDENT*/
                v1[0] -= 1.3 / oopscalex;
        }
-       if(oops->flag & SELECT) cpack(0xFFFFFF); 
-       else cpack(0x0);
+       if(oops->flag & SELECT) BIF_ThemeColor(TH_TEXT_HI);
+       else BIF_ThemeColor(TH_TEXT);
        glRasterPos3f(v1[0],  v1[1], 0.0);
        BMF_DrawString(font, str);
 
@@ -423,6 +428,12 @@ void drawoopsspace(ScrArea *sa, void *spacedata)
        float col[3];
        
        BIF_GetThemeColor3fv(TH_BACK, col);
+       
+       /* darker background for oops */
+       if(soops->type!=SO_OUTLINER) {
+               col[0] = col[0] * 0.75; col[1] = col[1] * 0.75; col[2] = col[2] * 0.75;
+       }
+       
        glClearColor(col[0], col[1], col[2], 0.0);
        glClear(GL_COLOR_BUFFER_BIT);
        if(soops==0) return;    
@@ -438,7 +449,20 @@ void drawoopsspace(ScrArea *sa, void *spacedata)
 
                oopscalex= .14*((float)curarea->winx)/(G.v2d->cur.xmax-G.v2d->cur.xmin);
                calc_ipogrid(); /* for scrollvariables */
-
+               
+               
+               /* Draw a page about the oops */
+               BIF_GetThemeColor3fv(TH_BACK, col);
+               glColor3fv(col);
+               glRectf(G.v2d->tot.xmin-2, G.v2d->tot.ymin-2,  G.v2d->tot.xmax+2, G.v2d->tot.ymax+2); /* light square in the centre */
+               BIF_ThemeColorShade(TH_BACK, -96); /* drop shadow color */
+               glRectf(G.v2d->tot.xmin-1, G.v2d->tot.ymin-2,  G.v2d->tot.xmax+3, G.v2d->tot.ymin-3); /* bottom dropshadow */
+               glRectf(G.v2d->tot.xmax+2, G.v2d->tot.ymin-2,  G.v2d->tot.xmax+3, G.v2d->tot.ymax+1); /* right hand dropshadow */
+               /* box around the oops. */
+               cpack(0x0);
+               mysbox(G.v2d->tot.xmin-2, G.v2d->tot.ymin-2,  G.v2d->tot.xmax+2, G.v2d->tot.ymax+2);
+               
+               
                /* Set the font size for the oops based on the zoom level */
                if (oopscalex > 6.0) font = BMF_GetFont(BMF_kScreen15);
                else if (oopscalex > 3.5) font = G.font;