Wed, 04 Jun 2014 01:51:18 +0300
- sort primitive categories alphabetically
changelog.txt | file | annotate | diff | comparison | revisions | |
src/primitives.cc | file | annotate | diff | comparison | revisions |
--- a/changelog.txt Wed Jun 04 01:43:21 2014 +0300 +++ b/changelog.txt Wed Jun 04 01:51:18 2014 +0300 @@ -37,6 +37,7 @@ + - Inverting a subfile now detects whether the subfile is flat and flips it if it is instead of naively invertnexting everything. + - Added an action for opening the subfiles pointed to by selected references as editable documents. + - Added a toolbox for primitives. These primitives can be dragged and dropped into the main viewport. ++ - Primitive categories are now sorted alphabetically. - - The camera is now changed to the top one if switching to draw mode while using the free camera instead of disabling the draw mode. - - The color selector now uses the color's edge color for the borders instead of black.
--- a/src/primitives.cc Wed Jun 04 01:43:21 2014 +0300 +++ b/src/primitives.cc Wed Jun 04 01:51:18 2014 +0300 @@ -54,8 +54,6 @@ // void loadPrimitives() { - PrimitiveCategory::loadCategories(); - // Try to load prims.cfg QFile conf (Config::filepath ("prims.cfg")); @@ -202,6 +200,7 @@ if (g_activeScanner) return; + PrimitiveCategory::loadCategories(); PrimitiveScanner* scanner = new PrimitiveScanner; scanner->work(); } @@ -216,10 +215,11 @@ // void PrimitiveCategory::populateCategories() { + loadCategories(); + for (PrimitiveCategory* cat : g_PrimitiveCategories) cat->prims.clear(); - for (Primitive& prim : g_primitives) { bool matched = false; @@ -265,6 +265,14 @@ else g_unmatched->prims << prim; } + + // Sort the categories. Note that we do this here because we need the existing + // order for regex matching. + qSort (g_PrimitiveCategories.begin(), g_PrimitiveCategories.end(), + [](PrimitiveCategory* const& a, PrimitiveCategory* const& b) -> bool + { + return a->name() < b->name(); + }); } // =============================================================================