Command Executor: removed set_button_state()
This had to do with setting up GUI1 theme buttons.
This commit is contained in:
parent
d6cc93be1b
commit
db64bc7126
5 changed files with 0 additions and 85 deletions
|
@ -1226,7 +1226,6 @@ void editor_controller::refresh_image_cache()
|
|||
|
||||
void editor_controller::display_redraw_callback(display&)
|
||||
{
|
||||
set_button_state();
|
||||
toolkit_->adjust_size();
|
||||
toolkit_->get_palette_manager()->draw_contents();
|
||||
get_current_map_context().get_labels().recalculate_labels();
|
||||
|
@ -1302,7 +1301,6 @@ bool editor_controller::left_click(int x, int y, const bool browse)
|
|||
LOG_ED << "Left click action " << hex_clicked << "\n";
|
||||
editor_action* a = get_mouse_action().click_left(*gui_, x, y);
|
||||
perform_refresh_delete(a, true);
|
||||
if (a) set_button_state();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -1317,7 +1315,6 @@ void editor_controller::left_mouse_up(int x, int y, const bool /*browse*/)
|
|||
{
|
||||
editor_action* a = get_mouse_action().up_left(*gui_, x, y);
|
||||
perform_delete(a);
|
||||
if (a) set_button_state();
|
||||
toolkit_->set_mouseover_overlay();
|
||||
context_manager_->refresh_after_action();
|
||||
}
|
||||
|
@ -1332,7 +1329,6 @@ bool editor_controller::right_click(int x, int y, const bool browse)
|
|||
LOG_ED << "Right click action " << hex_clicked << "\n";
|
||||
editor_action* a = get_mouse_action().click_right(*gui_, x, y);
|
||||
perform_refresh_delete(a, true);
|
||||
if (a) set_button_state();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1349,7 +1345,6 @@ void editor_controller::right_mouse_up(int x, int y, const bool browse)
|
|||
|
||||
editor_action* a = get_mouse_action().up_right(*gui_, x, y);
|
||||
perform_delete(a);
|
||||
if (a) set_button_state();
|
||||
toolkit_->set_mouseover_overlay();
|
||||
context_manager_->refresh_after_action();
|
||||
}
|
||||
|
|
|
@ -40,17 +40,6 @@ EXIT_STATUS start(const config& game_conf, const std::string& filename /* = "" *
|
|||
editor.context_manager_->load_map_dialog(true);
|
||||
} else {
|
||||
editor.context_manager_->load_map(filename, false);
|
||||
|
||||
// HACK: this fixes an issue where the button overlays would be missing when
|
||||
// the loaded map appears. Since we're gonna drop this ridiculous GUI1 drawing
|
||||
// stuff in 1.15 I'm not going to waste time coming up with a better fix.
|
||||
//
|
||||
// Do note adding a redraw_everything call to context_manager::refresh_all also
|
||||
// fixes the issue, but I'm pretty sure thats just because editor_controller::
|
||||
// display_redraw_callback gets called, which then calls set_button_state.
|
||||
//
|
||||
// -- vultraz, 2018-02-24
|
||||
editor.set_button_state();
|
||||
}
|
||||
|
||||
if (take_screenshot) {
|
||||
|
|
|
@ -417,7 +417,6 @@ void command_executor::show_menu(const std::vector<config>& items_arg, int xloc,
|
|||
} else {
|
||||
const hotkey::hotkey_command& cmd = hotkey::get_hotkey_command(items[res]["id"]);
|
||||
do_execute_command(cmd, res);
|
||||
set_button_state();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -433,7 +432,6 @@ void command_executor::execute_action(const std::vector<std::string>& items_arg,
|
|||
const hotkey_command &command = hotkey::get_hotkey_command(*i);
|
||||
if (can_execute_command(command)) {
|
||||
do_execute_command(command);
|
||||
set_button_state();
|
||||
}
|
||||
++i;
|
||||
}
|
||||
|
@ -551,7 +549,6 @@ static void event_execute(const SDL_Event& event, command_executor* executor)
|
|||
{
|
||||
if (!executor) return;
|
||||
executor->execute_command(event);
|
||||
executor->set_button_state();
|
||||
}
|
||||
|
||||
void command_executor::execute_command(const SDL_Event& event, int index)
|
||||
|
@ -632,68 +629,6 @@ void command_executor::execute_command(const SDL_Event& event, int index)
|
|||
}
|
||||
}
|
||||
|
||||
void command_executor_default::set_button_state()
|
||||
{
|
||||
display& disp = get_display();
|
||||
for (const theme::menu& menu : disp.get_theme().menus()) {
|
||||
|
||||
std::shared_ptr<gui::button> button = disp.find_menu_button(menu.get_id());
|
||||
if (!button) continue;
|
||||
bool enabled = false;
|
||||
for (const auto& command : menu.items()) {
|
||||
|
||||
const hotkey::hotkey_command& command_obj = hotkey::get_hotkey_command(command["id"]);
|
||||
bool can_execute = can_execute_command(command_obj);
|
||||
if (can_execute) {
|
||||
enabled = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
button->enable(enabled);
|
||||
}
|
||||
|
||||
for (const theme::action& action : disp.get_theme().actions()) {
|
||||
|
||||
std::shared_ptr<gui::button> button = disp.find_action_button(action.get_id());
|
||||
if (!button) continue;
|
||||
bool enabled = false;
|
||||
int i = 0;
|
||||
for (const std::string& command : action.items()) {
|
||||
|
||||
const hotkey::hotkey_command& command_obj = hotkey::get_hotkey_command(command);
|
||||
std::string tooltip = action.tooltip(i);
|
||||
if (filesystem::file_exists(game_config::path + "/images/icons/action/" + command + "_25.png" ))
|
||||
button->set_overlay("icons/action/" + command);
|
||||
if (!tooltip.empty())
|
||||
button->set_tooltip_string(tooltip);
|
||||
|
||||
bool can_execute = can_execute_command(command_obj);
|
||||
i++;
|
||||
if (!can_execute) continue;
|
||||
enabled = true;
|
||||
|
||||
ACTION_STATE state = get_action_state(command_obj.id, -1);
|
||||
switch (state) {
|
||||
case ACTION_SELECTED:
|
||||
case ACTION_ON:
|
||||
button->set_check(true);
|
||||
break;
|
||||
case ACTION_OFF:
|
||||
case ACTION_DESELECTED:
|
||||
button->set_check(false);
|
||||
break;
|
||||
case ACTION_STATELESS:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
button->enable(enabled);
|
||||
}
|
||||
}
|
||||
|
||||
void command_executor_default::recalculate_minimap()
|
||||
{
|
||||
get_display().recalculate_minimap();
|
||||
|
|
|
@ -117,7 +117,6 @@ public:
|
|||
virtual void map_screenshot() {}
|
||||
virtual void surrender_quit_game() {}
|
||||
|
||||
virtual void set_button_state() {}
|
||||
virtual void recalculate_minimap() {}
|
||||
|
||||
// execute_command's parameter is changed to "hotkey_command& command" and this not maybe that is too inconsistent.
|
||||
|
@ -157,7 +156,6 @@ class command_executor_default : public command_executor
|
|||
protected:
|
||||
virtual display& get_display() = 0;
|
||||
public:
|
||||
void set_button_state();
|
||||
void recalculate_minimap();
|
||||
void lua_console();
|
||||
void zoom_in();
|
||||
|
|
|
@ -136,7 +136,6 @@ void playsingle_controller::init_gui()
|
|||
}
|
||||
|
||||
update_locker lock_display(gui_->video(), is_skipping_replay());
|
||||
get_hotkey_command_executor()->set_button_state();
|
||||
}
|
||||
|
||||
|
||||
|
@ -505,7 +504,6 @@ void playsingle_controller::linger()
|
|||
void playsingle_controller::end_turn_enable(bool enable)
|
||||
{
|
||||
gui_->enable_menu("endturn", enable);
|
||||
get_hotkey_command_executor()->set_button_state();
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue