Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Eisel <eiseljulian@gmail.com>2018-11-25 18:21:35 +0300
committerJulian Eisel <eiseljulian@gmail.com>2018-11-25 19:08:58 +0300
commitb00963afc14978b2de7f2859525bf89612aa4aee (patch)
treef83ec02a96b84019735037528e31e827dcc0dbd6 /source/blender/editors
parent3135ed376bba357f3a41f7025db3fb79fd6c0f61 (diff)
UI: Initial User-Preferences redesign
Implements the first changes for T54115: * Rename "User Preferences" window to "Settings" in the UI. We'll likely put workspace settings in there, separate from the global user settings. System settings should become separate from user settings in future to allow settings for specific hardware. * Add sidebar region for navigation (scrolls independently). Addresses space problems, so we can add more categories as needed now. * Increase size of Settings window to compensate new navigation bar. * Group sections into User Preferences and System. Icons for section groups by Andrzej Ambroz. Thanks! * Bumps subversion for file compatibility. Screenshot: https://developer.blender.org/F5715337 I also added categories for future work, but commented them out. We may also want to redesign contents of each section now. Reviewers: brecht, campbellbarton Differential Revision: https://developer.blender.org/D3088 Design Task: https://developer.blender.org/T54115
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/include/UI_interface.h1
-rw-r--r--source/blender/editors/interface/interface_layout.c15
-rw-r--r--source/blender/editors/screen/screen_ops.c16
-rw-r--r--source/blender/editors/space_userpref/space_userpref.c40
4 files changed, 63 insertions, 9 deletions
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index dd0070b3b37..dac1ca95eff 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -200,6 +200,7 @@ enum {
#define UI_PANEL_WIDTH 340
#define UI_COMPACT_PANEL_WIDTH 160
+#define UI_NAVIGATION_REGION_WIDTH UI_COMPACT_PANEL_WIDTH
#define UI_PANEL_CATEGORY_MARGIN_WIDTH (U.widget_unit * 1.0f)
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index 306fa89a062..8a27fd55d37 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -655,6 +655,7 @@ static void ui_item_enum_expand_exec(
uiLayout *layout_radial = NULL;
const EnumPropertyItem *item, *item_array;
const char *name;
+ char group_name[UI_MAX_NAME_STR];
int itemw, icon, value;
bool free;
bool radial = (layout->root->type == UI_LAYOUT_PIEMENU);
@@ -687,10 +688,22 @@ static void ui_item_enum_expand_exec(
}
for (item = item_array; item->identifier; item++) {
+ const bool is_first = item == item_array;
+
if (!item->identifier[0]) {
const EnumPropertyItem *next_item = item + 1;
+
+ /* Separate items, potentially with a label. */
if (next_item->identifier) {
- if (radial && layout_radial) {
+ /* Item without identifier but with name: Add group label for the following items. */
+ if (item->name) {
+ if (!is_first) {
+ uiItemS(block->curlayout);
+ }
+ BLI_snprintf(group_name, sizeof(group_name), "%s:", item->name);
+ uiItemL(block->curlayout, group_name, item->icon);
+ }
+ else if (radial && layout_radial) {
uiItemS(layout_radial);
}
else {
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index 6a9f1e13aea..2305ce8f5fe 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -4332,9 +4332,9 @@ static void SCREEN_OT_back_to_previous(struct wmOperatorType *ot)
/** \name Show User Preferences Operator
* \{ */
-static int userpref_show_invoke(bContext *C, wmOperator *op, const wmEvent *event)
+static int settings_show_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
- int sizex = 800 * UI_DPI_FAC;
+ int sizex = (800 + UI_NAVIGATION_REGION_WIDTH) * UI_DPI_FAC;
int sizey = 500 * UI_DPI_FAC;
/* changes context! */
@@ -4348,15 +4348,15 @@ static int userpref_show_invoke(bContext *C, wmOperator *op, const wmEvent *even
}
-static void SCREEN_OT_userpref_show(struct wmOperatorType *ot)
+static void SCREEN_OT_settings_show(struct wmOperatorType *ot)
{
/* identifiers */
- ot->name = "Show User Preferences";
- ot->description = "Show user preferences";
- ot->idname = "SCREEN_OT_userpref_show";
+ ot->name = "Show Blender Settings";
+ ot->description = "Edit user preferences, workspaces and system settings";
+ ot->idname = "SCREEN_OT_settings_show";
/* api callbacks */
- ot->invoke = userpref_show_invoke;
+ ot->invoke = settings_show_invoke;
ot->poll = ED_operator_screenactive;
}
@@ -4814,7 +4814,7 @@ void ED_operatortypes_screen(void)
WM_operatortype_append(SCREEN_OT_back_to_previous);
WM_operatortype_append(SCREEN_OT_spacedata_cleanup);
WM_operatortype_append(SCREEN_OT_screenshot);
- WM_operatortype_append(SCREEN_OT_userpref_show);
+ WM_operatortype_append(SCREEN_OT_settings_show);
WM_operatortype_append(SCREEN_OT_drivers_editor_show);
WM_operatortype_append(SCREEN_OT_region_blend);
WM_operatortype_append(SCREEN_OT_space_context_cycle);
diff --git a/source/blender/editors/space_userpref/space_userpref.c b/source/blender/editors/space_userpref/space_userpref.c
index 06c6e612f13..87da461f269 100644
--- a/source/blender/editors/space_userpref/space_userpref.c
+++ b/source/blender/editors/space_userpref/space_userpref.c
@@ -47,6 +47,8 @@
#include "WM_api.h"
#include "WM_types.h"
+#include "UI_interface.h"
+
/* ******************** default callbacks for userpref space ***************** */
@@ -59,6 +61,13 @@ static SpaceLink *userpref_new(const ScrArea *UNUSED(area), const Scene *UNUSED(
spref = MEM_callocN(sizeof(SpaceUserPref), "inituserpref");
spref->spacetype = SPACE_USERPREF;
+ /* navigation region */
+ ar = MEM_callocN(sizeof(ARegion), "navigation region for userpref");
+
+ BLI_addtail(&spref->regionbase, ar);
+ ar->regiontype = RGN_TYPE_NAV_BAR;
+ ar->alignment = RGN_ALIGN_LEFT;
+
/* header */
ar = MEM_callocN(sizeof(ARegion), "header for userpref");
@@ -136,6 +145,19 @@ static void userpref_header_region_draw(const bContext *C, ARegion *ar)
ED_region_header(C, ar);
}
+/* add handlers, stuff you only do once or on area/region changes */
+static void userpref_navigation_region_init(wmWindowManager *wm, ARegion *ar)
+{
+ ar->v2d.scroll = V2D_SCROLL_RIGHT | V2D_SCROLL_VERTICAL_HIDE;
+
+ ED_region_panels_init(wm, ar);
+}
+
+static void userpref_navigation_region_draw(const bContext *C, ARegion *ar)
+{
+ ED_region_panels(C, ar);
+}
+
static void userpref_main_region_listener(
wmWindow *UNUSED(win), ScrArea *UNUSED(sa), ARegion *UNUSED(ar),
wmNotifier *UNUSED(wmn), const Scene *UNUSED(scene))
@@ -156,6 +178,13 @@ static void userpref_header_listener(
#endif
}
+static void userpref_navigation_region_listener(
+ wmWindow *UNUSED(win), ScrArea *UNUSED(sa), ARegion *UNUSED(ar),
+ wmNotifier *UNUSED(wmn), const Scene *UNUSED(scene))
+{
+ /* context changes */
+}
+
/* only called once, from space/spacetypes.c */
void ED_spacetype_userpref(void)
{
@@ -193,6 +222,17 @@ void ED_spacetype_userpref(void)
BLI_addhead(&st->regiontypes, art);
+ /* regions: navigation window */
+ art = MEM_callocN(sizeof(ARegionType), "spacetype userpref region");
+ art->regionid = RGN_TYPE_NAV_BAR;
+ art->prefsizex = UI_NAVIGATION_REGION_WIDTH;
+ art->init = userpref_navigation_region_init;
+ art->draw = userpref_navigation_region_draw;
+ art->listener = userpref_navigation_region_listener;
+ art->keymapflag = ED_KEYMAP_UI;
+
+ BLI_addhead(&st->regiontypes, art);
+
BKE_spacetype_register(st);
}