Skip to content

Commit

Permalink
Consolidate 'Enable/Disable camera sync' commands
Browse files Browse the repository at this point in the history
Instead of separate commands to enable or disable camera sync with no
indication of the current status, there is now a single toggle option 'Game
position follows DarkRadiant camera'.

Also renamed "Sync camera back now" to "Move camera to current game position",
and added a menu separator underneath these two camera options to separate them
from the following map-related options.
  • Loading branch information
Matthew Mott committed Dec 28, 2020
1 parent b461cd0 commit 842d7e7
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 23 deletions.
30 changes: 15 additions & 15 deletions include/iuimanager.h
Expand Up @@ -67,21 +67,21 @@ class IMenuManager
*/
virtual void setVisibility(const std::string& path, bool visible) = 0;

/** greebo: Adds a new item as child under the given path.
*
* @insertPath: the path where to insert the item: "main/filters"
* @name: the name of the new item
* @type: the item type (usually menuFolder / menuItem)
* @caption: the display string of the menu item (incl. mnemonic)
* @icon: the icon filename (can be empty)
* @eventname: the event name (e.g. "ToggleShowSizeInfo")
*/
virtual void add(const std::string& insertPath,
const std::string& name,
ui::eMenuItemType type,
const std::string& caption,
const std::string& icon,
const std::string& eventName) = 0;
/** greebo: Adds a new item as child under the given path.
*
* @insertPath: the path where to insert the item: "main/filters"
* @name: the name of the new item
* @type: the item type (usually menuFolder / menuItem)
* @caption: the display string of the menu item (incl. mnemonic)
* @icon: the icon filename (can be empty)
* @eventname: the event name (e.g. "ToggleShowSizeInfo")
*/
virtual void add(const std::string& insertPath,
const std::string& name,
ui::eMenuItemType type,
const std::string& caption = "",
const std::string& icon = "",
const std::string& eventName = "") = 0;

/** greebo: Inserts a new menuItem as sibling _before_ the given insertPath.
*
Expand Down
18 changes: 10 additions & 8 deletions plugins/dm.gameconnection/GameConnection.cpp
Expand Up @@ -213,11 +213,12 @@ const StringSet& GameConnection::getDependencies() const

void GameConnection::initialiseModule(const IApplicationContext& ctx)
{
GlobalEventManager().addToggle(
"GameConnectionToggleCameraSync",
[this](bool v) { setCameraSyncEnabled(v); }
);

// Add commands
GlobalCommandSystem().addCommand("GameConnectionCameraSyncEnable",
[this](const cmd::ArgumentList&) { setCameraSyncEnabled(true); });
GlobalCommandSystem().addCommand("GameConnectionCameraSyncDisable",
[this](const cmd::ArgumentList&) { setCameraSyncEnabled(false); });
GlobalCommandSystem().addCommand("GameConnectionBackSyncCamera",
[this](const cmd::ArgumentList&) { backSyncCamera(); });
GlobalCommandSystem().addCommand("GameConnectionReloadMap",
Expand All @@ -242,12 +243,13 @@ void GameConnection::initialiseModule(const IApplicationContext& ctx)
// Add menu items
IMenuManager& mm = GlobalUIManager().getMenuManager();
mm.insert("main/help", "connection", ui::menuFolder, _("Connection"), "", "");

mm.add("main/connection", "cameraSyncEnable", ui::menuItem,
_("Enable camera synchronization"), "", "GameConnectionCameraSyncEnable");
mm.add("main/connection", "cameraSyncDisable", ui::menuItem,
_("Disable camera synchronization"), "", "GameConnectionCameraSyncDisable");
_("Game position follows DarkRadiant camera"), "", "GameConnectionToggleCameraSync");
mm.add("main/connection", "backSyncCamera", ui::menuItem,
_("Sync camera back now"), "", "GameConnectionBackSyncCamera");
_("Move camera to current game position"), "", "GameConnectionBackSyncCamera");
mm.add("main/connection", "postCameraSep", ui::menuSeparator);

mm.add("main/connection", "reloadMap", ui::menuItem,
_("Reload map from .map file"), "", "GameConnectionReloadMap");
mm.add("main/connection", "reloadMapAutoEnable", ui::menuItem,
Expand Down

0 comments on commit 842d7e7

Please sign in to comment.