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/blenkernel/intern/screen.c
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/blenkernel/intern/screen.c')
-rw-r--r--source/blender/blenkernel/intern/screen.c40
1 files changed, 34 insertions, 6 deletions
diff --git a/source/blender/blenkernel/intern/screen.c b/source/blender/blenkernel/intern/screen.c
index 0c93281bf84..e23291d42d4 100644
--- a/source/blender/blenkernel/intern/screen.c
+++ b/source/blender/blenkernel/intern/screen.c
@@ -309,6 +309,30 @@ void BKE_spacedata_draw_locks(int set)
}
}
+/**
+ * Version of #BKE_area_find_region_type that also works if \a slink is not the active space of \a sa.
+ */
+ARegion *BKE_spacedata_find_region_type(const SpaceLink *slink, const ScrArea *sa, int region_type)
+{
+ const bool is_slink_active = slink == sa->spacedata.first;
+ const ListBase *regionbase = (is_slink_active) ?
+ &sa->regionbase : &slink->regionbase;
+ ARegion *ar = NULL;
+
+ BLI_assert(BLI_findindex(&sa->spacedata, slink) != -1);
+ for (ar = regionbase->first; ar; ar = ar->next) {
+ if (ar->regiontype == region_type) {
+ break;
+ }
+ }
+
+ /* Should really unit test this instead. */
+ BLI_assert(!is_slink_active || ar == BKE_area_find_region_type(sa, region_type));
+
+ return ar;
+}
+
+
static void (*spacedata_id_remap_cb)(struct ScrArea *sa, struct SpaceLink *sl, ID *old_id, ID *new_id) = NULL;
void BKE_spacedata_callback_id_remap_set(void (*func)(ScrArea *sa, SpaceLink *sl, ID *, ID *))
@@ -644,17 +668,21 @@ void BKE_screen_remove_unused_scrverts(bScreen *sc)
/* ***************** Utilities ********************** */
-/* Find a region of the specified type from the given area */
-ARegion *BKE_area_find_region_type(ScrArea *sa, int type)
+/**
+ * Find a region of type \a region_type in the currently active space of \a sa.
+ *
+ * \note This does _not_ work if the region to look up is not in the active
+ * space. Use #BKE_spacedata_find_region_type if that may be the case.
+ */
+ARegion *BKE_area_find_region_type(const ScrArea *sa, int region_type)
{
if (sa) {
- ARegion *ar;
-
- for (ar = sa->regionbase.first; ar; ar = ar->next) {
- if (ar->regiontype == type)
+ for (ARegion *ar = sa->regionbase.first; ar; ar = ar->next) {
+ if (ar->regiontype == region_type)
return ar;
}
}
+
return NULL;
}