hotkeys for geometry filters; geometry list is now a list; unfiltered list

This commit is contained in:
Zeno Rogue 2022-10-21 10:43:48 +02:00
parent 72bdd123a2
commit 5ca19a0d9b
1 changed files with 17 additions and 14 deletions

View File

@ -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<bool()> 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<geometry_filter*> available_filters = { &gf_hyperbolic, &gf_spherical, &gf_euclidean, &gf_other, &gf_regular_2d, &gf_regular_3d, &gf_quotient, &gf_tes_file };
EX vector<geometry_filter*> 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<isize(ginf); i++) {
eGeometry g = eGeometry(i);
if(among(g, gProduct, gRotSpace)) hybrid::configure(g);
@ -408,11 +410,12 @@ void ge_select_tiling() {
dialog::addBoolItem(
is_product ? XLAT("current geometry x E") :
is_rotspace ? XLAT("space of rotations in current geometry") :
XLAT(ginf[g].menu_displayed_name), on, letter++);
XLAT(ginf[g].menu_displayed_name), on, dialog::list_fake_key++);
dialog::lastItem().value += validclasses[land_validity(specialland).quality_level];
dialog::add_action([g] { set_or_configure_geometry(g); });
}
dialog::end_list();
dialog::addBreak(100);
dual::add_choice();
dialog::addBack();