Commit: 96e7a92a23b6fe6e591c1b90ae298b83ba68cee3
Author: Julian Eisel
Date:   Wed Jun 3 12:23:32 2015 +0200
Branches: UI-graphical-redesign
https://developer.blender.org/rB96e7a92a23b6fe6e591c1b90ae298b83ba68cee3

Redesign area/region edges

Mainly removed unnecessarily drawn edges and doubled line thickness for
area edges to clearly separate areas from regions.

For now I've added a theme option to control the color of the area
edges, we can check later if it's worth keeping it, but IMHO it's quite
important to have this controllable.

===================================================================

M       release/scripts/startup/bl_ui/space_userpref.py
M       source/blender/editors/include/UI_resources.h
M       source/blender/editors/interface/resources.c
M       source/blender/editors/screen/area.c
M       source/blender/editors/screen/screen_edit.c
M       source/blender/makesdna/DNA_userdef_types.h
M       source/blender/makesrna/intern/rna_userdef.c

===================================================================

diff --git a/release/scripts/startup/bl_ui/space_userpref.py 
b/release/scripts/startup/bl_ui/space_userpref.py
index 00cb1d8..3aadbbd 100644
--- a/release/scripts/startup/bl_ui/space_userpref.py
+++ b/release/scripts/startup/bl_ui/space_userpref.py
@@ -795,6 +795,7 @@ class USERPREF_PT_theme(Panel):
             colsub = padding.column()
             colsub = padding.column()
             colsub.row().prop(ui, "widget_emboss")
+            colsub.row().prop(ui, "area_edges")
 
             col.separator()
             col.separator()
diff --git a/source/blender/editors/include/UI_resources.h 
b/source/blender/editors/include/UI_resources.h
index 2b19b61..2011546 100644
--- a/source/blender/editors/include/UI_resources.h
+++ b/source/blender/editors/include/UI_resources.h
@@ -55,6 +55,9 @@ enum {
        TH_REDALERT,
 
        TH_THEMEUI,
+
+       TH_AREA_EDGES,
+
 // common colors among spaces
        
        TH_BACK,
diff --git a/source/blender/editors/interface/resources.c 
b/source/blender/editors/interface/resources.c
index 626df74..88cb455 100644
--- a/source/blender/editors/interface/resources.c
+++ b/source/blender/editors/interface/resources.c
@@ -171,6 +171,10 @@ const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, 
int spacetype, int colo
                        }
 
                        switch (colorid) {
+                               case TH_AREA_EDGES:
+                                       cp = btheme->tui.area_edges;
+                                       break;
+
                                case TH_BACK:
                                        if (theme_regionid == RGN_TYPE_WINDOW)
                                                cp = ts->back;
@@ -851,7 +855,9 @@ void ui_theme_init_default(void)
 
        /* UI buttons */
        ui_widget_color_init(&btheme->tui);
-       
+
+       rgba_char_args_set_fl(btheme->tui.area_edges, 0.15f, 0.15f, 0.15f, 
1.0f);
+
        btheme->tui.iconfile[0] = 0;
        btheme->tui.panel.show_back = false;
        btheme->tui.panel.show_header = false;
@@ -2660,6 +2666,8 @@ void init_userdef_do_versions(void)
                        btheme->tui.wcol_toggle.roundness = 0.2f;
                        btheme->tui.wcol_tool.roundness = 0.25f;
                        btheme->tui.wcol_tooltip.roundness = 0.2f;
+
+                       rgba_char_args_set_fl(btheme->tui.area_edges, 0.15, 
0.15f, 0.15f, 1.0f);
                }
        }
 
diff --git a/source/blender/editors/screen/area.c 
b/source/blender/editors/screen/area.c
index 8d0bf36..d8f094c 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -78,33 +78,31 @@ extern void ui_draw_anti_tria(float x1, float y1, float x2, 
float y2, float x3,
 static void region_draw_emboss(ARegion *ar, rcti *scirct)
 {
        rcti rect;
-       
+
+       if (!ELEM(ar->regiontype, RGN_TYPE_HEADER, RGN_TYPE_TOOL_PROPS))
+               return;
+
        /* translate scissor rect to region space */
        rect.xmin = scirct->xmin - ar->winrct.xmin;
        rect.ymin = scirct->ymin - ar->winrct.ymin;
        rect.xmax = scirct->xmax - ar->winrct.xmin;
        rect.ymax = scirct->ymax - ar->winrct.ymin;
-       
+
        /* set transp line */
        glEnable(GL_BLEND);
        glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-       
-       /* right  */
-       glColor4ub(0, 0, 0, 30);
-       sdrawline(rect.xmax, rect.ymin, rect.xmax, rect.ymax);
-       
+       glColor4ub(0, 0, 0, 50);
+
        /* bottom  */
-       glColor4ub(0, 0, 0, 30);
-       sdrawline(rect.xmin, rect.ymin, rect.xmax, rect.ymin);
-       
+       if (ar->alignment == RGN_ALIGN_TOP) {
+               sdrawline(rect.xmin, rect.ymin, rect.xmax, rect.ymin);
+       }
        /* top  */
-       glColor4ub(255, 255, 255, 30);
-       sdrawline(rect.xmin, rect.ymax, rect.xmax, rect.ymax);
+       else {
+               BLI_assert(ar->alignment == RGN_ALIGN_BOTTOM);
+               sdrawline(rect.xmin, rect.ymax, rect.xmax, rect.ymax);
+       }
 
-       /* left  */
-       glColor4ub(255, 255, 255, 30);
-       sdrawline(rect.xmin, rect.ymin, rect.xmin, rect.ymax);
-       
        glDisable(GL_BLEND);
 }
 
diff --git a/source/blender/editors/screen/screen_edit.c 
b/source/blender/editors/screen/screen_edit.c
index d9bd9cc..1a05504 100644
--- a/source/blender/editors/screen/screen_edit.c
+++ b/source/blender/editors/screen/screen_edit.c
@@ -63,6 +63,7 @@
 #include "ED_render.h"
 
 #include "UI_interface.h"
+#include "UI_resources.h"
 
 /* XXX actually should be not here... solve later */
 #include "wm_subwindow.h"
@@ -1010,47 +1011,38 @@ static void scrarea_draw_shape_light(ScrArea *sa, char 
UNUSED(dir))
        glDisable(GL_BLEND);
 }
 
-static void drawscredge_area_draw(int sizex, int sizey, int x1, int y1, int 
x2, int y2, int a)
+static void drawscredge_area_draw(int sizex, int sizey, int x1, int y1, int 
x2, int y2)
 {
        /* right border area */
        if (x2 < sizex - 1)
-               sdrawline(x2 + a, y1, x2 + a, y2);
+               sdrawline(x2, y1, x2, y2);
        
        /* left border area */
        if (x1 > 0) /* otherwise it draws the emboss of window over */
-               sdrawline(x1 + a, y1, x1 + a, y2);
+               sdrawline(x1, y1, x1, y2);
        
        /* top border area */
        if (y2 < sizey - 1)
-               sdrawline(x1, y2 + a, x2, y2 + a);
+               sdrawline(x1, y2, x2, y2);
        
        /* bottom border area */
        if (y1 > 0)
-               sdrawline(x1, y1 + a, x2, y1 + a);
+               sdrawline(x1, y1, x2, y1);
        
 }
 
 /** screen edges drawing **/
-static void drawscredge_area(ScrArea *sa, int sizex, int sizey, int center)
+static void drawscredge_area(ScrArea *sa, int sizex, int sizey)
 {
        short x1 = sa->v1->vec.x;
        short y1 = sa->v1->vec.y;
        short x2 = sa->v3->vec.x;
        short y2 = sa->v3->vec.y;
-       
-       if (center == 0) {
-               if (U.pixelsize > 1.0f) {
-               
-                       glColor3ub(0x50, 0x50, 0x50);
-                       glLineWidth((2.0f * U.pixelsize) - 1);
-                       drawscredge_area_draw(sizex, sizey, x1, y1, x2, y2, 0);
-                       glLineWidth(1.0f);
-               }
-       }
-       else {
-               glColor3ub(0, 0, 0);
-               drawscredge_area_draw(sizex, sizey, x1, y1, x2, y2, 0);
-       }
+
+       glLineWidth(UI_DPI_FAC * 2.0f);
+       UI_ThemeColor(TH_AREA_EDGES);
+       drawscredge_area_draw(sizex, sizey, x1, y1, x2, y2);
+       glLineWidth(1.0f);
 }
 
 /* ****************** EXPORTED API TO OTHER MODULES 
*************************** */
@@ -1133,10 +1125,8 @@ void ED_screen_draw(wmWindow *win)
                if (sa->flag & AREA_FLAG_DRAWJOINFROM) sa1 = sa;
                if (sa->flag & AREA_FLAG_DRAWJOINTO) sa2 = sa;
                if (sa->flag & (AREA_FLAG_DRAWSPLIT_H | AREA_FLAG_DRAWSPLIT_V)) 
sa3 = sa;
-               drawscredge_area(sa, winsize_x, winsize_y, 0);
+               drawscredge_area(sa, winsize_x, winsize_y);
        }
-       for (sa = win->screen->areabase.first; sa; sa = sa->next)
-               drawscredge_area(sa, winsize_x, winsize_y, 1);
        
        /* blended join arrow */
        if (sa1 && sa2) {
diff --git a/source/blender/makesdna/DNA_userdef_types.h 
b/source/blender/makesdna/DNA_userdef_types.h
index cfd742f..3f901e5 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -169,13 +169,15 @@ typedef struct ThemeUI {
 
        uiPanelColors panel; /* depricated, but we keep it for do_versions 
(2.66.1) */
 
+       char area_edges[4];
+
        char widget_emboss[4];
 
        /* fac: 0 - 1 for blend factor, width in pixels */
        float menu_shadow_fac;
        short menu_shadow_width;
        
-       short pad[3];
+       short pad[5];
        
        char iconfile[256];     // FILE_MAXFILE length
        float icon_alpha;
diff --git a/source/blender/makesrna/intern/rna_userdef.c 
b/source/blender/makesrna/intern/rna_userdef.c
index 218e79b..906bd94 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -1031,6 +1031,12 @@ static void rna_def_userdef_theme_ui(BlenderRNA *brna)
        RNA_def_property_ui_text(prop, "State Colors", "");
        RNA_def_property_update(prop, 0, "rna_userdef_update");
 
+       prop = RNA_def_property(srna, "area_edges", PROP_FLOAT, 
PROP_COLOR_GAMMA);
+       RNA_def_property_float_sdna(prop, NULL, "area_edges");
+       RNA_def_property_array(prop, 3);
+       RNA_def_property_ui_text(prop, "Area Edges", "Color of the 1px 
separator between areas");
+       RNA_def_property_update(prop, 0, "rna_userdef_update");
+
        prop = RNA_def_property(srna, "menu_shadow_fac", PROP_FLOAT, 
PROP_FACTOR);
        RNA_def_property_ui_text(prop, "Menu Shadow Strength", "Blending factor 
for menu shadows");
        RNA_def_property_range(prop, 0.01f, 1.0f);

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to