add support for storing text styles in themes.
authorCampbell Barton <ideasman42@gmail.com>
Fri, 7 Jun 2013 00:27:21 +0000 (00:27 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Fri, 7 Jun 2013 00:27:21 +0000 (00:27 +0000)
also reset text styles when resetting to the default theme.

release/scripts/startup/bl_ui/space_userpref.py
source/blender/editors/interface/interface_intern.h
source/blender/editors/interface/interface_ops.c
source/blender/editors/interface/resources.c

index 0e20829ed487b43f23ec0d30fbf02508fcec51c3..ef4e5468194c57f6d60ce6463e826b8357f85bbb 100644 (file)
@@ -488,7 +488,10 @@ class USERPREF_MT_interface_theme_presets(Menu):
     preset_subdir = "interface_theme"
     preset_operator = "script.execute_preset"
     preset_type = 'XML'
-    preset_xml_map = (("user_preferences.themes[0]", "Theme"), )
+    preset_xml_map = (
+        ("user_preferences.themes[0]", "Theme"),
+        ("user_preferences.ui_styles[0]", "ThemeStyle"),
+        )
     draw = Menu.draw_preset
 
 
index 4b2fb1023058ded87d1dce7c7f9f778e4c63311d..5621aa2d0cccdc4a22b6b768287f755d553f6894 100644 (file)
@@ -560,6 +560,7 @@ int ui_id_icon_get(struct bContext *C, struct ID *id, const bool big);
 /* resources.c */
 void init_userdef_do_versions(void);
 void ui_theme_init_default(void);
+void ui_style_init_default(void);
 void ui_resources_init(void);
 void ui_resources_free(void);
 
index f5758711ad24cc87c77b340ce5eaf3747bf8e09e..9f7d14351956f92dbf7f92ada31beb0eea4d0e92 100644 (file)
@@ -351,6 +351,7 @@ static void UI_OT_eyedropper(wmOperatorType *ot)
 static int reset_default_theme_exec(bContext *C, wmOperator *UNUSED(op))
 {
        ui_theme_init_default();
+       ui_style_init_default();
        WM_event_add_notifier(C, NC_WINDOW, NULL);
        
        return OPERATOR_FINISHED;
index e43b4925fbd1c886aca6d2aaef728e4074a04943..283cafcc70601c984028ebd8d967aef96f2017fd 100644 (file)
@@ -1001,6 +1001,13 @@ void ui_theme_init_default(void)
        btheme->tclip.handle_vertex_size = 4;
 }
 
+void ui_style_init_default(void)
+{
+       BLI_freelistN(&U.uistyles);
+       /* gets automatically re-allocated */
+       uiStyleInit();
+}
+
 
 void UI_SetTheme(int spacetype, int regionid)
 {