From 5ca19a0d9b62897a87cab3102772dadf3379087b Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Fri, 21 Oct 2022 10:43:48 +0200 Subject: [PATCH] hotkeys for geometry filters; geometry list is now a list; unfiltered list --- geom-exp.cpp | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/geom-exp.cpp b/geom-exp.cpp index 68665b24..14535689 100644 --- a/geom-exp.cpp +++ b/geom-exp.cpp @@ -249,6 +249,7 @@ EX void activate_ge_land_selection() { #if HDR struct geometry_filter { string name; + int hotkey; /** test if the current geometry matches the filter */ function test; }; @@ -258,23 +259,24 @@ EX geometry_filter *current_filter; bool forced_quotient() { return quotient && !(cgflags & qOPTQ); } -EX geometry_filter gf_hyperbolic = {"hyperbolic", [] { return (arcm::in() || arb::in() || hyperbolic) && !forced_quotient(); }}; -EX geometry_filter gf_spherical = {"spherical", [] { return (arcm::in() || arb::in() || sphere) && !forced_quotient(); }}; -EX geometry_filter gf_euclidean = {"Euclidean", [] { return (arcm::in() || arb::in() || euclid) && !forced_quotient(); }}; -EX geometry_filter gf_other = {"non-isotropic", [] { return prod || nonisotropic; }}; -EX geometry_filter gf_regular_2d = {"regular 2D tesselations", [] { +EX geometry_filter gf_hyperbolic = {"hyperbolic", 'h', [] { return (arcm::in() || arb::in() || hyperbolic) && !forced_quotient(); }}; +EX geometry_filter gf_spherical = {"spherical", 's', [] { return (arcm::in() || arb::in() || sphere) && !forced_quotient(); }}; +EX geometry_filter gf_euclidean = {"Euclidean", 'e', [] { return (arcm::in() || arb::in() || euclid) && !forced_quotient(); }}; +EX geometry_filter gf_other = {"non-isotropic", 'n', [] { return prod || nonisotropic; }}; +EX geometry_filter gf_regular_2d = {"regular 2D tesselations", 'r', [] { return standard_tiling() && WDIM == 2 && !forced_quotient(); }}; -EX geometry_filter gf_regular_3d = {"regular 3D honeycombs", [] { +EX geometry_filter gf_regular_3d = {"regular 3D honeycombs", '3', [] { if(euclid) return geometry == gCubeTiling; return !bt::in() && !kite::in() && WDIM == 3 && !forced_quotient() && !nonisotropic && !prod; }}; -EX geometry_filter gf_quotient = {"interesting quotient spaces", [] { +EX geometry_filter gf_quotient = {"interesting quotient spaces", 'q', [] { return forced_quotient() && !elliptic; }}; -EX geometry_filter gf_tes_file = {"load from file", [] { return arb::in(); }}; +EX geometry_filter gf_tes_file = {"load from file", 'f', [] { return arb::in(); }}; +EX geometry_filter gf_no_filters = {"no filters", '-', [] { return true; }}; -EX vector available_filters = { &gf_hyperbolic, &gf_spherical, &gf_euclidean, &gf_other, &gf_regular_2d, &gf_regular_3d, &gf_quotient, &gf_tes_file }; +EX vector available_filters = { &gf_hyperbolic, &gf_spherical, &gf_euclidean, &gf_other, &gf_regular_2d, &gf_regular_3d, &gf_quotient, &gf_tes_file, &gf_no_filters }; void ge_select_filter() { cmode = sm::SIDE | sm::MAYDARK; @@ -282,12 +284,11 @@ void ge_select_filter() { dialog::init(XLAT("geometries")); - char x = 'a'; for(auto f: available_filters) { if(current_filter) - dialog::addBoolItem(XLAT(f->name), f == current_filter, x++); + dialog::addBoolItem(XLAT(f->name), f == current_filter, f->hotkey); else - dialog::addItem(XLAT(f->name), x++); + dialog::addItem(XLAT(f->name), f->hotkey); dialog::add_action([f] { current_filter = f; popScreen(); }); } @@ -380,7 +381,8 @@ void ge_select_tiling() { dialog::addBreak(100); - char letter = 'a'; + dialog::start_list(500, 1500, 'a'); + for(int i=0; i