[Bf-blender-cvs] [94adf2c] temp-ui-widget-refactor: Cleanup: Move widget_type function to widgets.c and widget type enum to widget.h
Julian Eisel
noreply at git.blender.org
Fri Jul 17 00:52:08 CEST 2015
Commit: 94adf2cc5ff3d4b0345db562a849c2f0e5ad199c
Author: Julian Eisel
Date: Thu Jul 16 23:22:48 2015 +0200
Branches: temp-ui-widget-refactor
https://developer.blender.org/rB94adf2cc5ff3d4b0345db562a849c2f0e5ad199c
Cleanup: Move widget_type function to widgets.c and widget type enum to widget.h
And suddenly, things are soooo much nicer ;)
===================================================================
M source/blender/editors/interface/interface_intern.h
M source/blender/editors/interface/interface_widgets.c
M source/blender/editors/interface/widgets/widgets.c
M source/blender/editors/interface/widgets/widgets.h
===================================================================
diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h
index 6a8d627..5d9b296 100644
--- a/source/blender/editors/interface/interface_intern.h
+++ b/source/blender/editors/interface/interface_intern.h
@@ -57,53 +57,6 @@ struct ImBuf;
#define RNA_NO_INDEX -1
#define RNA_ENUM_VALUE -2
-/* visual types for drawing */
-/* for time being separated from functional types */
-typedef enum {
- /* default */
- UI_WTYPE_REGULAR,
-
- /* standard set */
- UI_WTYPE_LABEL,
- UI_WTYPE_TOGGLE,
- UI_WTYPE_CHECKBOX,
- UI_WTYPE_RADIO,
- UI_WTYPE_NUMBER,
- UI_WTYPE_SLIDER,
- UI_WTYPE_EXEC,
- UI_WTYPE_TOOLTIP,
-
- /* strings */
- UI_WTYPE_NAME,
- UI_WTYPE_NAME_LINK,
- UI_WTYPE_POINTER_LINK,
- UI_WTYPE_FILENAME,
-
- /* menus */
- UI_WTYPE_MENU_RADIO,
- UI_WTYPE_MENU_ICON_RADIO,
- UI_WTYPE_MENU_POINTER_LINK,
- UI_WTYPE_MENU_NODE_LINK,
-
- UI_WTYPE_PULLDOWN,
- UI_WTYPE_MENU_LABEL,
- UI_WTYPE_MENU_ITEM,
- UI_WTYPE_MENU_ITEM_PREVIEW,
- UI_WTYPE_MENU_ITEM_RADIAL,
- UI_WTYPE_MENU_BACK,
-
- /* specials */
- UI_WTYPE_ICON,
- UI_WTYPE_SWATCH,
- UI_WTYPE_RGB_PICKER,
- UI_WTYPE_UNITVEC,
- UI_WTYPE_BOX,
- UI_WTYPE_SCROLL,
- UI_WTYPE_LISTITEM,
- UI_WTYPE_PROGRESSBAR,
- UI_WTYPE_LINK,
-} uiWidgetTypeEnum;
-
/* menu scrolling */
#define UI_MENU_SCROLL_ARROW 12
#define UI_MENU_SCROLL_MOUSE (UI_MENU_SCROLL_ARROW + 2)
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index e616949..281bb44 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -1187,175 +1187,6 @@ static void widget_draw_extra_mask(const bContext *C, uiBut *but, uiWidgetType *
widgetbase_draw(&wtb, &wt->wcol);
}
-/* TODO move to widgets/widgets.c */
-static uiWidgetType *widget_type(uiWidgetTypeEnum type)
-{
- bTheme *btheme = UI_GetTheme();
- uiWidgetDrawStyle *draw_style = widget_drawstyle_get(0); /* TODO drawstyles aren't in use yet */
- static uiWidgetType wt;
-
- /* defaults */
- wt.wcol_theme = &btheme->tui.wcol_regular;
- wt.wcol_state = &btheme->tui.wcol_state;
- wt.draw_type = NULL;
-
- switch (type) {
- case UI_WTYPE_REGULAR:
- wt.draw_type = draw_style->regular;
- break;
-
- case UI_WTYPE_LABEL:
- wt.draw_type = draw_style->label;
- break;
-
- case UI_WTYPE_TOGGLE:
- wt.wcol_theme = &btheme->tui.wcol_toggle;
- wt.draw_type = draw_style->toggle;
- break;
-
- case UI_WTYPE_CHECKBOX:
- wt.wcol_theme = &btheme->tui.wcol_option;
- wt.draw_type = draw_style->checkbox;
- break;
-
- case UI_WTYPE_RADIO:
- wt.wcol_theme = &btheme->tui.wcol_radio;
- wt.draw_type = draw_style->radio;
- break;
-
- case UI_WTYPE_NUMBER:
- wt.wcol_theme = &btheme->tui.wcol_num;
- wt.draw_type = draw_style->number;
- break;
-
- case UI_WTYPE_SLIDER:
- wt.wcol_theme = &btheme->tui.wcol_numslider;
- wt.draw_type = draw_style->slider;
- break;
-
- case UI_WTYPE_EXEC:
- wt.wcol_theme = &btheme->tui.wcol_tool;
- wt.draw_type = draw_style->exec;
- break;
-
- case UI_WTYPE_TOOLTIP:
- wt.wcol_theme = &btheme->tui.wcol_tooltip;
- wt.draw_type = draw_style->tooltip;
- break;
-
-
- /* strings */
- case UI_WTYPE_NAME:
- wt.wcol_theme = &btheme->tui.wcol_text;
- wt.draw_type = draw_style->name;
- break;
-
- case UI_WTYPE_NAME_LINK:
- break;
-
- case UI_WTYPE_POINTER_LINK:
- break;
-
- case UI_WTYPE_FILENAME:
- break;
-
-
- /* start menus */
- case UI_WTYPE_MENU_RADIO:
- wt.wcol_theme = &btheme->tui.wcol_menu;
- wt.draw_type = draw_style->menu_radio;
- break;
-
- case UI_WTYPE_MENU_ICON_RADIO:
- wt.wcol_theme = &btheme->tui.wcol_menu;
- wt.draw_type = draw_style->menu_icon_radio;
- break;
-
- case UI_WTYPE_MENU_POINTER_LINK:
- wt.wcol_theme = &btheme->tui.wcol_menu;
- wt.draw_type = draw_style->pointer_link;
- break;
-
- case UI_WTYPE_MENU_NODE_LINK:
- wt.wcol_theme = &btheme->tui.wcol_menu;
- wt.draw_type = draw_style->menu_node_link;
- break;
-
- case UI_WTYPE_PULLDOWN:
- wt.wcol_theme = &btheme->tui.wcol_pulldown;
- wt.draw_type = draw_style->pulldown;
- break;
-
- /* in menus */
- case UI_WTYPE_MENU_LABEL:
- wt.wcol_theme = &btheme->tui.wcol_menu_back;
- wt.draw_type = draw_style->menu_label;
- break;
-
- case UI_WTYPE_MENU_ITEM:
- wt.wcol_theme = &btheme->tui.wcol_menu_item;
- wt.draw_type = draw_style->menu_item;
- break;
-
- case UI_WTYPE_MENU_BACK:
- wt.wcol_theme = &btheme->tui.wcol_menu_back;
- wt.draw_type = draw_style->menu_back;
- break;
-
- case UI_WTYPE_MENU_ITEM_PREVIEW:
- wt.wcol_theme = &btheme->tui.wcol_menu_item;
- wt.draw_type = draw_style->menu_item_preview;
- break;
-
- /* specials */
- case UI_WTYPE_ICON:
- wt.draw_type = draw_style->icon;
- break;
-
- case UI_WTYPE_SWATCH:
- wt.draw_type = draw_style->swatch;
- break;
-
- case UI_WTYPE_BOX:
- wt.wcol_theme = &btheme->tui.wcol_box;
- wt.draw_type = draw_style->box;
- break;
-
- case UI_WTYPE_RGB_PICKER:
- break;
-
- case UI_WTYPE_UNITVEC:
- wt.draw_type = draw_style->unitvec;
- break;
-
- case UI_WTYPE_SCROLL:
- wt.wcol_theme = &btheme->tui.wcol_scroll;
- wt.draw_type = draw_style->scroll;
- break;
-
- case UI_WTYPE_LISTITEM:
- wt.wcol_theme = &btheme->tui.wcol_list_item;
- wt.draw_type = draw_style->listitem;
- break;
-
- case UI_WTYPE_PROGRESSBAR:
- wt.wcol_theme = &btheme->tui.wcol_progress;
- wt.draw_type = draw_style->progressbar;
- break;
-
- case UI_WTYPE_MENU_ITEM_RADIAL:
- wt.wcol_theme = &btheme->tui.wcol_pie_menu;
- wt.draw_type = draw_style->menu_item_radial;
- break;
-
- case UI_WTYPE_LINK:
- wt.draw_type = draw_style->link;
- break;
- }
-
- return &wt;
-}
-
static int widget_roundbox_set(uiBut *but, rcti *rect)
{
diff --git a/source/blender/editors/interface/widgets/widgets.c b/source/blender/editors/interface/widgets/widgets.c
index 60fd85d..53663fd 100644
--- a/source/blender/editors/interface/widgets/widgets.c
+++ b/source/blender/editors/interface/widgets/widgets.c
@@ -29,6 +29,7 @@
#include "DNA_screen_types.h"
#include "UI_interface.h"
+#include "UI_resources.h"
#include "widgets.h" /* own include */
@@ -53,9 +54,165 @@ uiWidgetDrawStyle *widget_drawstyle_get(const int widget_style_type) /* TODO wid
#endif
}
-#if 0 /* TODO */
-static uiWidgetType *widget_type(uiWidgetTypeEnum type)
+uiWidgetType *widget_type(const uiWidgetTypeEnum type)
{
-
+ bTheme *btheme = UI_GetTheme();
+ const uiWidgetDrawStyle *draw_style = widget_drawstyle_get(0); /* TODO drawstyles aren't in use yet */
+ static uiWidgetType wt;
+
+
+ /* defaults */
+ wt.wcol_theme = &btheme->tui.wcol_regular;
+ wt.wcol_state = &btheme->tui.wcol_state;
+ wt.draw_type = NULL;
+
+ switch (type) {
+ case UI_WTYPE_BOX:
+ wt.wcol_theme = &btheme->tui.wcol_box;
+ wt.draw_type = draw_style->box;
+ break;
+
+ case UI_WTYPE_CHECKBOX:
+ wt.wcol_theme = &btheme->tui.wcol_option;
+ wt.draw_type = draw_style->checkbox;
+ break;
+
+ case UI_WTYPE_EXEC:
+ wt.wcol_theme = &btheme->tui.wcol_tool;
+ wt.draw_type = draw_style->exec;
+ break;
+
+ case UI_WTYPE_FILENAME:
+ break;
+
+ case UI_WTYPE_ICON:
+ wt.draw_type = draw_style->icon;
+ break;
+
+ case UI_WTYPE_LABEL:
+ wt.draw_type = draw_style->label;
+ break;
+
+ case UI_WTYPE_LINK:
+ wt.draw_type = draw_style->link;
+ break;
+
+ case UI_WTYPE_LISTITEM:
+ wt.wcol_theme = &btheme->tui.wcol_list_item;
+ wt.draw_type = draw_style->listitem;
+ break;
+
+ case UI_WTYPE_MENU_BACK:
+ wt.wcol_theme = &btheme->tui.wcol_menu_back;
+ wt.draw_type = draw_style->menu_back;
+ break;
+
+ case UI_WTYPE_MENU_ICON_RADIO:
+ wt.wcol_theme = &btheme->tui.wcol_menu;
+ wt.draw_type = draw_style->menu_icon_radio;
+ break;
+
+ case UI_WTYPE_MENU_ITEM:
+ wt.wcol_theme = &btheme->tui.wcol_menu_item;
+ wt.draw_type = draw_style->menu_item;
+ break;
+
+ case UI_WTYPE_MENU_ITEM_PREVIEW:
+ wt.wcol_theme = &btheme->tui.wcol_menu_item;
+ wt.draw_type = draw_style->menu_item_preview;
+ break;
+
+ case UI_WTYPE_MENU_ITEM_RADIAL:
+ wt.wcol_theme = &btheme->tui.wcol_pie_menu;
+ wt.draw_type = draw_style->menu_item_radial;
+ break;
+
+ case UI_WTYPE_MENU_LABEL:
+ wt.wcol_theme = &btheme->tui.wcol_menu_back;
+ wt.draw_type = draw_style->menu_label;
+ break;
+
+ case UI_WTYPE_MENU_NODE_LINK:
+ wt.wcol_theme = &btheme->tui.wcol_menu;
+ wt.draw_type = draw_style->menu_node_link;
+ break;
+
+ case UI_WTYPE_MENU_POINTER_LINK:
+ wt.wcol_theme = &btheme->tui.wcol_menu;
+ wt.draw_type = draw_style->pointer_link;
+ break;
+
+ case UI_WTYPE_MENU_RADIO:
+ wt.wcol_theme = &btheme->tui.wcol_menu;
+ wt.draw_type = draw_style->menu_radio;
+ break;
+
+ case UI_WTYPE_NAME:
+ wt.wcol_theme = &btheme->tui.wcol_text;
+ wt.draw_type = draw_style->name;
+ break;
+
+ case UI_WTYPE_NAME_LINK:
+ break;
+
+ case UI_WTYPE_NUMBER:
+ wt.wcol_theme = &btheme->tui.wcol_num;
+ wt.draw_type = draw_style->number;
+ break;
+
+ case UI_WTYPE_POINTER_LINK:
+ break;
+
+ case UI_WTYPE_PROGRESSBAR:
+ wt.wcol_theme = &btheme->tui.wcol_progress;
+ wt.draw_type = draw_style->progressbar;
+ break;
+
+ case UI_WTYPE_PULLDOWN:
+ wt.wcol_theme = &btheme->tui.wcol_pulldown;
+ wt.draw_type = draw_style->pulldown;
+ break;
+
+ case UI_WTYPE_RADIO:
+ wt.wcol_theme = &btheme->tui.wcol_radio;
+ wt.draw_type = draw_style->radio;
+ break;
+
+ case UI_WTYPE_REGULAR:
+ wt.draw_type = draw_style->regular;
+ break;
+
+ case UI_WTYPE_RGB_PICKER:
+ break;
+
+ case UI_WTYPE_SCROLL:
+ wt.wcol_theme = &btheme->tui.wcol_scroll;
+ wt.draw_type = draw_style->scroll;
+ break;
+
+ case UI_WTYPE_SLIDER:
+ wt.wcol_theme = &btheme->tui.wcol_numslider;
+ wt.draw_type = draw_style->slider;
+ break;
+
+ case UI_WTYPE_SWATCH:
+ wt.draw_type = draw_style->swatch;
+ break;
+
+ case UI_WTYPE_TOGGLE:
+ wt.wcol_theme = &btheme->tui.wcol_toggle;
+ wt.draw_type = draw_style->toggle;
+ break;
+
+ case UI_WTYPE_TOOLTIP:
+ wt.wcol_theme = &btheme->tui.wcol_tooltip;
+ wt.draw_type = draw_style->tooltip;
+
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list