@@ -154,12 +154,12 @@ static std::map<virtual_identity*, getFocusStringsHandler> getFocusStringsHandle
154154
155155#define VIEWSCREEN (name ) df::viewscreen_##name##st
156156#define DEFINE_GET_FOCUS_STRING_HANDLER (screen_type ) \
157- static void getFocusStrings_##screen_type(std::string &baseFocus, std::vector<std::string> &focusStrings, VIEWSCREEN(screen_type) *screen);\
157+ static void getFocusStrings_##screen_type(const std::string &baseFocus, std::vector<std::string> &focusStrings, VIEWSCREEN(screen_type) *screen);\
158158 DFHACK_STATIC_ADD_TO_MAP (\
159159 &getFocusStringsHandlers, &VIEWSCREEN (screen_type)::_identity, \
160160 (getFocusStringsHandler)getFocusStrings_##screen_type \
161161 ); \
162- static void getFocusStrings_##screen_type(std::string &baseFocus, std::vector<std::string> &focusStrings, VIEWSCREEN(screen_type) *screen)
162+ static void getFocusStrings_##screen_type(const std::string &baseFocus, std::vector<std::string> &focusStrings, VIEWSCREEN(screen_type) *screen)
163163
164164DEFINE_GET_FOCUS_STRING_HANDLER (title)
165165{
@@ -258,7 +258,7 @@ DEFINE_GET_FOCUS_STRING_HANDLER(world)
258258}
259259
260260static bool widget_is_visible (df::widget * w) {
261- return w && w->flag .bits .WIDGET_VISIBILITY_VISIBLE ;
261+ return w && w->flag .bits .VISIBILITY_VISIBLE ;
262262}
263263
264264static size_t get_num_children (df::widget * w) {
@@ -327,15 +327,9 @@ static void add_profile_tab_focus_string(
327327 focusStrings.push_back (fs);
328328}
329329
330- DEFINE_GET_FOCUS_STRING_HANDLER (dwarfmode)
331- {
330+ static void add_main_interface_focus_strings (const string &baseFocus, vector<string> &focusStrings) {
332331 std::string newFocusString;
333332
334- if (df::global::gametype && !World::isFortressMode ()) {
335- newFocusString = baseFocus;
336- newFocusString += ' /' + enum_item_key (*df::global::gametype);
337- focusStrings.push_back (newFocusString);
338- }
339333 if (game->main_interface .main_designation_selected != -1 ) {
340334 newFocusString = baseFocus;
341335 newFocusString += " /Designate/" + enum_item_key (game->main_interface .main_designation_selected );
@@ -589,7 +583,7 @@ DEFINE_GET_FOCUS_STRING_HANDLER(dwarfmode)
589583 focusStrings.push_back (newFocusString);
590584 }
591585
592- if (game->main_interface .bottom_mode_selected != -1 ) {
586+ if (game->main_interface .bottom_mode_selected != -1 ) {
593587 newFocusString = baseFocus;
594588
595589 switch (game->main_interface .bottom_mode_selected ) {
@@ -700,7 +694,7 @@ DEFINE_GET_FOCUS_STRING_HANDLER(dwarfmode)
700694 newFocusString += " /ImageCreator" ;
701695 focusStrings.push_back (newFocusString);
702696 }
703- if (game->main_interface .unit_selector .flag .bits .WIDGET_VISIBILITY_ACTIVE ) {
697+ if (game->main_interface .unit_selector .flag .bits .VISIBILITY_ACTIVE ) {
704698 newFocusString = baseFocus;
705699 newFocusString += " /UnitSelector/" ;
706700 newFocusString += enum_item_key (game->main_interface .unit_selector .context );
@@ -721,11 +715,6 @@ DEFINE_GET_FOCUS_STRING_HANDLER(dwarfmode)
721715 newFocusString += " /PatrolRoutes" ;
722716 focusStrings.push_back (newFocusString);
723717 }
724- if (game->main_interface .squad_schedule .open ) {
725- newFocusString = baseFocus;
726- newFocusString += " /SquadSchedule" ;
727- focusStrings.push_back (newFocusString);
728- }
729718 if (game->main_interface .squad_selector .open ) {
730719 newFocusString = baseFocus;
731720 newFocusString += " /SquadSelector" ;
@@ -772,6 +761,31 @@ DEFINE_GET_FOCUS_STRING_HANDLER(dwarfmode)
772761 newFocusString += " /SquadSupplies" ;
773762 focusStrings.push_back (newFocusString);
774763 }
764+ if (game->main_interface .squads .open ) {
765+ newFocusString = baseFocus;
766+ newFocusString += " /Squads" ;
767+ if (game->main_interface .squads .editing_squad_schedule_id >= 0 ) {
768+ newFocusString += " /EditingSchedule" ;
769+ } else if (game->main_interface .squad_schedule .open ) {
770+ newFocusString += " /Schedule" ;
771+ } else if (game->main_interface .squad_equipment .open ) {
772+ newFocusString += " /Equipment" ;
773+ if (game->main_interface .squad_equipment .customizing_equipment ) {
774+ newFocusString += " /Customizing" ;
775+ if (game->main_interface .squad_equipment .cs_setting_material )
776+ newFocusString += " /Material" ;
777+ else if (game->main_interface .squad_equipment .cs_setting_color_pattern )
778+ newFocusString += " /Color" ;
779+ else
780+ newFocusString += " /Default" ;
781+ }
782+ else
783+ newFocusString += " /Default" ;
784+ } else {
785+ newFocusString += " /Default" ;
786+ }
787+ focusStrings.push_back (newFocusString);
788+ }
775789 if (game->main_interface .assign_uniform .open ) {
776790 newFocusString = baseFocus;
777791 newFocusString += " /AssignUniform" ;
@@ -803,33 +817,33 @@ DEFINE_GET_FOCUS_STRING_HANDLER(dwarfmode)
803817
804818 focusStrings.push_back (newFocusString);
805819 }
806- if (game->main_interface .squad_equipment .open ) {
820+ }
821+
822+ DEFINE_GET_FOCUS_STRING_HANDLER (dwarfmode)
823+ {
824+ std::string newFocusString;
825+
826+ if (df::global::gametype && !World::isFortressMode ()) {
807827 newFocusString = baseFocus;
808- newFocusString += " /SquadEquipment" ;
809- if (game->main_interface .squad_equipment .customizing_equipment ) {
810- newFocusString += " /Customizing" ;
811- if (game->main_interface .squad_equipment .cs_setting_material )
812- newFocusString += " /Material" ;
813- else if (game->main_interface .squad_equipment .cs_setting_color_pattern )
814- newFocusString += " /Color" ;
828+ newFocusString += ' /' + enum_item_key (*df::global::gametype);
829+ if (*df::global::gametype == df::game_type::DWARF_ARENA) {
830+ if (game->main_interface .bottom_mode_selected != df::main_bottom_mode_type::NONE)
831+ newFocusString += " /Paint/" + enum_item_key (game->main_interface .bottom_mode_selected );
832+ else if (game->main_interface .arena_unit .open )
833+ newFocusString += " /ConfigureUnit" ;
834+ else if (game->main_interface .arena_tree .open )
835+ newFocusString += " /ConfigureTree" ;
815836 else
816837 newFocusString += " /Default" ;
817838 }
818- else
819- newFocusString += " /Default" ;
820839 focusStrings.push_back (newFocusString);
821840 }
841+ add_main_interface_focus_strings (baseFocus, focusStrings);
822842
823- if (!focusStrings.size ()) {
843+ static const string squads_default = " dwarfmode/Squads/Default" ;
844+ if (!focusStrings.size () || (focusStrings.size () == 1 && focusStrings[0 ] == squads_default)) {
824845 focusStrings.push_back (baseFocus + " /Default" );
825846 }
826-
827- // squads panel is not exclusive with the others
828- if (game->main_interface .squads .open ) {
829- newFocusString = baseFocus;
830- newFocusString += " /Squads" ;
831- focusStrings.push_back (newFocusString);
832- }
833847}
834848
835849/* TODO: understand how this changes for v50
0 commit comments