Whiteboard: hotkeys for bumping actions up and down the queue,
...not functional yet.
This commit is contained in:
parent
d0b8bbed41
commit
9d3268d9fb
7 changed files with 96 additions and 19 deletions
|
@ -254,12 +254,20 @@
|
|||
key=-
|
||||
[/hotkey]
|
||||
[hotkey]
|
||||
command=executenextaction
|
||||
command=wbexecuteaction
|
||||
key=y
|
||||
[/hotkey]
|
||||
[hotkey]
|
||||
command=deletelastaction
|
||||
command=wbdeleteaction
|
||||
key=h
|
||||
[/hotkey]
|
||||
[hotkey]
|
||||
command=wbbumpupaction
|
||||
key=1
|
||||
[/hotkey]
|
||||
[hotkey]
|
||||
command=wbbumpdownaction
|
||||
key=2
|
||||
[/hotkey]
|
||||
|
||||
#undef IF_APPLE_CMD_ELSE_CTRL
|
||||
|
|
|
@ -101,8 +101,10 @@ const struct {
|
|||
N_("Team 1"), false, hotkey::SCOPE_GAME },
|
||||
{ hotkey::HOTKEY_REPLAY_SKIP_ANIMATION, "replayskipanimation", N_("Skip animation"), false, hotkey::SCOPE_GAME },
|
||||
// Whiteboard commands
|
||||
{ hotkey::HOTKEY_EXECUTE_NEXT_ACTION, "executenextaction", N_("Execute next planned action"), false, hotkey::SCOPE_GAME },
|
||||
{ hotkey::HOTKEY_DELETE_LAST_ACTION, "deletelastaction", N_("Delete last planned action"), false, hotkey::SCOPE_GAME },
|
||||
{ hotkey::HOTKEY_WB_EXECUTE_ACTION, "wbexecuteaction", N_("Execute next planned action"), false, hotkey::SCOPE_GAME },
|
||||
{ hotkey::HOTKEY_WB_DELETE_ACTION, "wbdeleteaction", N_("Delete last planned action"), false, hotkey::SCOPE_GAME },
|
||||
{ hotkey::HOTKEY_WB_BUMP_UP_ACTION, "wbbumpupaction", N_("Move planned action toward queue beginning"), false, hotkey::SCOPE_GAME },
|
||||
{ hotkey::HOTKEY_WB_BUMP_DOWN_ACTION, "wbbumpdownaction", N_("Move planned action toward queue end"), false, hotkey::SCOPE_GAME },
|
||||
|
||||
#ifndef DISABLE_EDITOR
|
||||
{ hotkey::HOTKEY_EDITOR_QUIT_TO_DESKTOP, "editor-quit-to-desktop", N_("Quit to Desktop"), false, hotkey::SCOPE_EDITOR },
|
||||
|
@ -859,11 +861,17 @@ bool command_executor::execute_command(HOTKEY_COMMAND command, int /*index*/)
|
|||
case HOTKEY_REPLAY_SKIP_ANIMATION:
|
||||
replay_skip_animation();
|
||||
break;
|
||||
case HOTKEY_EXECUTE_NEXT_ACTION:
|
||||
execute_next_action();
|
||||
case HOTKEY_WB_EXECUTE_ACTION:
|
||||
whiteboard_execute_action();
|
||||
break;
|
||||
case HOTKEY_DELETE_LAST_ACTION:
|
||||
delete_last_action();
|
||||
case HOTKEY_WB_DELETE_ACTION:
|
||||
whiteboard_delete_action();
|
||||
break;
|
||||
case HOTKEY_WB_BUMP_UP_ACTION:
|
||||
whiteboard_bump_up_action();
|
||||
break;
|
||||
case HOTKEY_WB_BUMP_DOWN_ACTION:
|
||||
whiteboard_bump_down_action();
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
|
|
|
@ -62,8 +62,10 @@ enum HOTKEY_COMMAND {
|
|||
HOTKEY_REPLAY_SKIP_ANIMATION,
|
||||
|
||||
// Whiteboard commands
|
||||
HOTKEY_EXECUTE_NEXT_ACTION,
|
||||
HOTKEY_DELETE_LAST_ACTION,
|
||||
HOTKEY_WB_EXECUTE_ACTION,
|
||||
HOTKEY_WB_DELETE_ACTION,
|
||||
HOTKEY_WB_BUMP_UP_ACTION,
|
||||
HOTKEY_WB_BUMP_DOWN_ACTION,
|
||||
|
||||
#ifndef DISABLE_EDITOR
|
||||
HOTKEY_EDITOR_QUIT_TO_DESKTOP,
|
||||
|
@ -300,8 +302,10 @@ public:
|
|||
virtual void replay_show_each() {}
|
||||
virtual void replay_show_team1() {}
|
||||
virtual void replay_skip_animation() {}
|
||||
virtual void execute_next_action() {}
|
||||
virtual void delete_last_action() {}
|
||||
virtual void whiteboard_execute_action() {}
|
||||
virtual void whiteboard_delete_action() {}
|
||||
virtual void whiteboard_bump_up_action() {}
|
||||
virtual void whiteboard_bump_down_action() {}
|
||||
|
||||
//Gets the action's image (if any). Displayed left of the action text in menus.
|
||||
virtual std::string get_action_image(hotkey::HOTKEY_COMMAND /*command*/, int /*index*/) const { return ""; }
|
||||
|
|
|
@ -447,14 +447,24 @@ void play_controller::search(){
|
|||
menu_handler_.search();
|
||||
}
|
||||
|
||||
void play_controller::execute_next_action(){
|
||||
void play_controller::whiteboard_execute_action(){
|
||||
whiteboard_manager_->contextual_execute();
|
||||
}
|
||||
|
||||
void play_controller::delete_last_action(){
|
||||
void play_controller::whiteboard_delete_action(){
|
||||
whiteboard_manager_->contextual_delete();
|
||||
}
|
||||
|
||||
void play_controller::whiteboard_bump_up_action()
|
||||
{
|
||||
whiteboard_manager_->contextual_bump_up_action();
|
||||
}
|
||||
|
||||
void play_controller::whiteboard_bump_down_action()
|
||||
{
|
||||
whiteboard_manager_->contextual_bump_down_action();
|
||||
}
|
||||
|
||||
void play_controller::fire_prestart(bool execute){
|
||||
// Run initialization scripts, even if loading from a snapshot.
|
||||
game_events::fire("preload");
|
||||
|
@ -778,8 +788,10 @@ bool play_controller::can_execute_command(hotkey::HOTKEY_COMMAND command, int in
|
|||
menu_handler_.current_unit(mouse_handler_)->side() == gui_->viewing_side() &&
|
||||
teams_[menu_handler_.current_unit(mouse_handler_)->side() - 1].is_human();
|
||||
|
||||
case hotkey::HOTKEY_EXECUTE_NEXT_ACTION:
|
||||
case hotkey::HOTKEY_DELETE_LAST_ACTION:
|
||||
case hotkey::HOTKEY_WB_EXECUTE_ACTION:
|
||||
case hotkey::HOTKEY_WB_DELETE_ACTION:
|
||||
case hotkey::HOTKEY_WB_BUMP_UP_ACTION:
|
||||
case hotkey::HOTKEY_WB_BUMP_DOWN_ACTION:
|
||||
return resources::whiteboard->is_active();
|
||||
|
||||
default:
|
||||
|
|
|
@ -97,8 +97,12 @@ public:
|
|||
virtual void toggle_ellipses();
|
||||
virtual void toggle_grid();
|
||||
virtual void search();
|
||||
virtual void execute_next_action(); //part of whiteboard
|
||||
virtual void delete_last_action(); //part of whiteboard
|
||||
|
||||
// Whiteboard hotkeys
|
||||
virtual void whiteboard_execute_action();
|
||||
virtual void whiteboard_delete_action();
|
||||
virtual void whiteboard_bump_up_action();
|
||||
virtual void whiteboard_bump_down_action();
|
||||
|
||||
virtual void do_init_side(const unsigned int team_index);
|
||||
virtual void play_side(const unsigned int team_num, bool save) = 0;
|
||||
|
|
|
@ -352,6 +352,44 @@ void manager::contextual_delete()
|
|||
}
|
||||
}
|
||||
|
||||
void manager::contextual_bump_up_action()
|
||||
{
|
||||
if (!current_actions()->empty())
|
||||
{
|
||||
if (selected_unit_ && unit_has_actions(*selected_unit_))
|
||||
{
|
||||
|
||||
}
|
||||
else if (highlighted_unit_ && unit_has_actions(*highlighted_unit_))
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void manager::contextual_bump_down_action()
|
||||
{
|
||||
if (!current_actions()->empty())
|
||||
{
|
||||
if (selected_unit_ && unit_has_actions(*selected_unit_))
|
||||
{
|
||||
|
||||
}
|
||||
else if (highlighted_unit_ && unit_has_actions(*highlighted_unit_))
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool manager::unit_has_actions(const unit& unit) const
|
||||
{
|
||||
return current_actions()->find_first_action_of(unit)
|
||||
|
|
|
@ -100,9 +100,12 @@ public:
|
|||
|
||||
/** Executes first action in the queue for current side */
|
||||
void contextual_execute();
|
||||
|
||||
/** Deletes last action in the queue for current side */
|
||||
void contextual_delete();
|
||||
/** Moves the action determined by the UI toward the beginning of the queue */
|
||||
void contextual_bump_up_action();
|
||||
/** Moves the action determined by the UI toward the beginning of the queue */
|
||||
void contextual_bump_down_action();
|
||||
|
||||
/** Checks whether the specified unit has at least one planned action */
|
||||
bool unit_has_actions(const unit& unit) const;
|
||||
|
|
Loading…
Add table
Reference in a new issue