From b0c1ef2d6b51f56de0d1694b7319c015e2fee417 Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Fri, 20 Jan 2012 21:33:30 +0000 Subject: [PATCH] Add support for commands with dynamic help strings Originally committed to SVN as r6326. --- aegisub/src/command/command.h | 7 +++++-- aegisub/src/menu.cpp | 2 ++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/aegisub/src/command/command.h b/aegisub/src/command/command.h index db9d4dd36..008fe805a 100644 --- a/aegisub/src/command/command.h +++ b/aegisub/src/command/command.h @@ -79,8 +79,11 @@ namespace cmd { /// This command's name may change based on the state of the project COMMAND_DYNAMIC_NAME = 8, + /// This command's help string may change + COMMAND_DYNAMIC_HELP = 16, + /// This command's icon may change based on the state of the project - COMMAND_DYNAMIC_ICON = 16 + COMMAND_DYNAMIC_ICON = 32 }; /// Holds an individual Command @@ -93,7 +96,7 @@ namespace cmd { /// Plain string for display purposes; should normally be the same as StrMenu /// but without accelerators virtual wxString StrDisplay(const agi::Context *) const=0; - /// Short help string descripting the command purpose. + /// Short help string describing what the command does virtual wxString StrHelp() const=0; /// Get this command's type flags diff --git a/aegisub/src/menu.cpp b/aegisub/src/menu.cpp index 646d0de38..914d88e6b 100644 --- a/aegisub/src/menu.cpp +++ b/aegisub/src/menu.cpp @@ -148,6 +148,8 @@ class CommandManager { int flags = c->Type(); if (flags & cmd::COMMAND_DYNAMIC_NAME) UpdateItemName(item); + if (flags & cmd::COMMAND_DYNAMIC_HELP) + item.second->SetHelp(c->StrHelp()); if (flags & cmd::COMMAND_VALIDATE) item.second->Enable(c->Validate(context)); if (flags & cmd::COMMAND_RADIO || flags & cmd::COMMAND_TOGGLE) {