// get a 3 byte color, blended and shaded between two other char color pointers
void UI_GetColorPtrBlendShade3ubv(char *cp1, char *cp2, char *col, float fac, int offset);
+// clear the openGL ClearColor using the input colorid
+void UI_ThemeClearColor(int colorid);
+
// internal (blender) usage only, for init and set active
void UI_SetTheme(int spacetype, int regionid);
wmOrtho2(-0.01f, ar->winx-0.01f, -0.01f, ar->winy-0.01f);
+ UI_ThemeClearColor(TH_BACK);
+
/* back */
if(block->flag & UI_BLOCK_LOOP)
ui_draw_menu_back(&style, block, &rect);
}
+static void widget_box(uiBut *but, uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign)
+{
+ uiWidgetBase wtb;
+
+ widget_init(&wtb);
+
+ /* half rounded */
+ round_box_edges(&wtb, roundboxalign, rect, 4.0f);
+
+ widgetbase_draw(&wtb, wcol);
+
+ /* store the box bg as gl clearcolor, to retrieve later when drawing semi-transparent rects
+ * over the top to indicate disabled buttons */
+ glClearColor(wcol->inner[0]/255.0, wcol->inner[1]/255.0, wcol->inner[2]/255.0, 1.0);
+}
+
static void widget_but(uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign)
{
uiWidgetBase wtb;
/* can't use theme TH_BACK or TH_PANEL... undefined */
glGetFloatv(GL_COLOR_CLEAR_VALUE, col);
glColor4f(col[0], col[1], col[2], 0.5f);
+
/* need -1 and +1 to make it work right for aligned buttons,
* but problem may be somewhere else? */
- glRectf(rect->xmin-1, rect->ymin, rect->xmax, rect->ymax+1);
-
+ glRectf(rect->xmin-1, rect->ymin-1, rect->xmax, rect->ymax+1);
+
glDisable(GL_BLEND);
}
break;
case UI_WTYPE_BOX:
+ wt.custom= widget_box;
wt.wcol_theme= &btheme->tui.wcol_box;
break;
col[2] = b;
}
+void UI_ThemeClearColor(int colorid)
+{
+ float col[3];
+
+ UI_GetThemeColor3fv(colorid, col);
+ glClearColor(col[0], col[1], col[2], 0.0);
+}
+
void UI_make_axis_color(char *src_col, char *dst_col, char axis)
{
switch(axis)
/* optional header info instead? */
if(ar->headerstr) {
- float col[3];
- UI_GetThemeColor3fv(TH_HEADER, col);
- glClearColor(col[0], col[1], col[2], 0.0);
+ UI_ThemeClearColor(TH_HEADER);
glClear(GL_COLOR_BUFFER_BIT);
UI_ThemeColor(TH_TEXT);
Panel *panel;
View2D *v2d= &ar->v2d;
View2DScrollers *scrollers;
- float col[3];
int xco, yco, x, y, miny=0, w, em, header, triangle, open, newcontext= 0;
if(contextnr >= 0)
}
/* clear */
- if (ar->type->regionid == RGN_TYPE_PREVIEW)
- UI_GetThemeColor3fv(TH_PREVIEW_BACK, col);
- else
- UI_GetThemeColor3fv(TH_BACK, col);
-
- glClearColor(col[0], col[1], col[2], 0.0);
+ UI_ThemeClearColor((ar->type->regionid == RGN_TYPE_PREVIEW)?TH_PREVIEW_BACK:TH_BACK);
glClear(GL_COLOR_BUFFER_BIT);
-
+
/* before setting the view */
if(vertical) {
/* only allow scrolling in vertical direction */
uiLayout *layout;
HeaderType *ht;
Header header = {0};
- float col[3];
int maxco, xco, yco;
- /* clear */
- if(ED_screen_area_active(C))
- UI_GetThemeColor3fv(TH_HEADER, col);
- else
- UI_GetThemeColor3fv(TH_HEADERDESEL, col);
-
- glClearColor(col[0], col[1], col[2], 0.0);
+ /* clear */
+ UI_ThemeClearColor((ED_screen_area_active(C))?TH_HEADER:TH_HEADERDESEL);
glClear(GL_COLOR_BUFFER_BIT);
/* set view2d view matrix for scrolling (without scrollers) */
View2D *v2d= &ar->v2d;
View2DGrid *grid;
View2DScrollers *scrollers;
- float col[3];
short unit=0, flag=0;
/* clear and setup matrix */
- UI_GetThemeColor3fv(TH_BACK, col);
- glClearColor(col[0], col[1], col[2], 0.0);
+ UI_ThemeClearColor(TH_BACK);
glClear(GL_COLOR_BUFFER_BIT);
UI_view2d_view_ortho(C, v2d);
bAnimContext ac;
View2D *v2d= &ar->v2d;
View2DScrollers *scrollers;
- float col[3];
/* clear and setup matrix */
- UI_GetThemeColor3fv(TH_BACK, col);
- glClearColor(col[0], col[1], col[2], 0.0);
+ UI_ThemeClearColor(TH_BACK);
glClear(GL_COLOR_BUFFER_BIT);
UI_view2d_view_ortho(C, v2d);
ED_region_header(C, ar);
#else
- float col[3];
-
+
/* clear */
- if(ED_screen_area_active(C))
- UI_GetThemeColor3fv(TH_HEADER, col);
- else
- UI_GetThemeColor3fv(TH_HEADERDESEL, col);
-
- glClearColor(col[0], col[1], col[2], 0.0);
+ UI_ThemeClearColor(ED_screen_area_active(C)?TH_HEADER:TH_HEADERDESEL);
glClear(GL_COLOR_BUFFER_BIT);
/* set view2d view matrix for scrolling (without scrollers) */
SpaceConsole *sc= CTX_wm_space_console(C);
View2D *v2d= &ar->v2d;
View2DScrollers *scrollers;
- float col[3];
if((sc->type==CONSOLE_TYPE_PYTHON) && (sc->scrollback.first==NULL))
WM_operator_name_call((bContext *)C, "CONSOLE_OT_banner", WM_OP_EXEC_DEFAULT, NULL);
/* clear and setup matrix */
- UI_GetThemeColor3fv(TH_BACK, col);
- glClearColor(col[0], col[1], col[2], 1.0);
+ UI_ThemeClearColor(TH_BACK);
glClear(GL_COLOR_BUFFER_BIT);
console_update_rect(C, ar);
static void info_main_area_draw(const bContext *C, ARegion *ar)
{
- float col[3];
/* clear and setup matrix */
- UI_GetThemeColor3fv(TH_BACK, col);
- glClearColor(col[0], col[1], col[2], 0.0);
+ UI_ThemeClearColor(TH_BACK);
glClear(GL_COLOR_BUFFER_BIT);
}
// SpaceLogic *slogic= CTX_wm_space_logic(C);
View2D *v2d= &ar->v2d;
View2DScrollers *scrollers;
- float col[3];
/* clear and setup matrix */
- UI_GetThemeColor3fv(TH_BACK, col);
- glClearColor(col[0], col[1], col[2], 0.0);
+ UI_ThemeClearColor(TH_BACK);
glClear(GL_COLOR_BUFFER_BIT);
UI_view2d_view_ortho(C, v2d);
static void logic_header_area_draw(const bContext *C, ARegion *ar)
{
- float col[3];
-
/* clear */
- if(ED_screen_area_active(C))
- UI_GetThemeColor3fv(TH_HEADER, col);
- else
- UI_GetThemeColor3fv(TH_HEADERDESEL, col);
-
- glClearColor(col[0], col[1], col[2], 0.0);
+ UI_ThemeClearColor(ED_screen_area_active(C)?TH_HEADER:TH_HEADERDESEL);
glClear(GL_COLOR_BUFFER_BIT);
/* set view2d view matrix for scrolling (without scrollers) */
bAnimContext ac;
View2D *v2d= &ar->v2d;
View2DScrollers *scrollers;
- float col[3];
/* clear and setup matrix */
- UI_GetThemeColor3fv(TH_BACK, col);
- glClearColor(col[0], col[1], col[2], 0.0);
+ UI_ThemeClearColor(TH_BACK);
glClear(GL_COLOR_BUFFER_BIT);
UI_view2d_view_ortho(C, v2d);
View2D *v2d= &ar->v2d;
View2DGrid *grid;
View2DScrollers *scrollers;
- float col[3];
short unit=0, flag=0;
/* clear and setup matrix */
- UI_GetThemeColor3fv(TH_BACK, col);
- glClearColor(col[0], col[1], col[2], 0.0);
+ UI_ThemeClearColor(TH_BACK);
glClear(GL_COLOR_BUFFER_BIT);
UI_view2d_view_ortho(C, v2d);
void drawnodespace(const bContext *C, ARegion *ar, View2D *v2d)
{
- float col[3];
View2DScrollers *scrollers;
SpaceNode *snode= CTX_wm_space_node(C);
Scene *scene= CTX_data_scene(C);
int color_manage = scene->r.color_mgt_flag & R_COLOR_MANAGEMENT;
- UI_GetThemeColor3fv(TH_BACK, col);
- glClearColor(col[0], col[1], col[2], 0);
+ UI_ThemeClearColor(TH_BACK);
glClear(GL_COLOR_BUFFER_BIT);
UI_view2d_view_ortho(C, v2d);
{
View2D *v2d= &ar->v2d;
View2DScrollers *scrollers;
- float col[3];
/* clear */
- UI_GetThemeColor3fv(TH_BACK, col);
- glClearColor(col[0], col[1], col[2], 0.0);
+ UI_ThemeClearColor(TH_BACK);
glClear(GL_COLOR_BUFFER_BIT);
draw_outliner(C);
/* draw entirely, view changes should be handled here */
SpaceScript *sscript= (SpaceScript*)CTX_wm_space_data(C);
View2D *v2d= &ar->v2d;
- float col[3];
-
+
/* clear and setup matrix */
- UI_GetThemeColor3fv(TH_BACK, col);
- glClearColor(col[0], col[1], col[2], 0.0);
+ UI_ThemeClearColor(TH_BACK);
glClear(GL_COLOR_BUFFER_BIT);
UI_view2d_view_ortho(C, v2d);
/* draw entirely, view changes should be handled here */
// SpaceSound *ssound= (SpaceSound*)CTX_wm_space_data(C);
View2D *v2d= &ar->v2d;
- float col[3];
/* clear and setup matrix */
- UI_GetThemeColor3fv(TH_BACK, col);
- glClearColor(col[0], col[1], col[2], 0.0);
+ UI_ThemeClearColor(TH_BACK);
glClear(GL_COLOR_BUFFER_BIT);
UI_view2d_view_ortho(C, v2d);
/* draw entirely, view changes should be handled here */
SpaceText *st= CTX_wm_space_text(C);
//View2D *v2d= &ar->v2d;
- float col[3];
/* clear and setup matrix */
- UI_GetThemeColor3fv(TH_BACK, col);
- glClearColor(col[0], col[1], col[2], 0.0);
+ UI_ThemeClearColor(TH_BACK);
glClear(GL_COLOR_BUFFER_BIT);
// UI_view2d_view_ortho(C, v2d);
View2DGrid *grid;
View2DScrollers *scrollers;
int unit, flag=0;
- float col[3];
/* clear and setup matrix */
- UI_GetThemeColor3fv(TH_BACK, col);
- glClearColor(col[0], col[1], col[2], 0.0);
+ UI_ThemeClearColor(TH_BACK);
glClear(GL_COLOR_BUFFER_BIT);
UI_view2d_view_ortho(C, v2d);
glClearColor(scene->world->horr, scene->world->horg, scene->world->horb, 0.0);
}
else {
- float col[3];
- UI_GetThemeColor3fv(TH_BACK, col);
- glClearColor(col[0], col[1], col[2], 0.0);
+ UI_ThemeClearColor(TH_BACK);
}
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
Scene *sce;
Base *base;
Object *ob;
- float col[3];
int retopo= 0, sculptparticle= 0;
Object *obact = OBACT;
char *grid_unit= NULL;
}
/* clear background */
- UI_GetThemeColor3fv(TH_BACK, col);
- glClearColor(col[0], col[1], col[2], 0.0);
+ UI_ThemeClearColor(TH_BACK);
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
/* setup view matrices */