mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-08-25 14:22:54 -06:00
Bazaar/XMLMenu : made commands case-insensitive
git-svn-id: svn://ultimatepp.org/upp/trunk@12592 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
60244e3729
commit
7718e446a8
3 changed files with 20 additions and 20 deletions
|
|
@ -74,7 +74,7 @@ XMLCommands &XMLCommands::Add(String const &id, String const &cmdStr)
|
|||
cmd->callback.Clear();
|
||||
cmd->menuCallback.Clear();
|
||||
cmd->commandString = cmdStr;
|
||||
commands.Add(id, cmd);
|
||||
commands.Add(ToUpper(id), cmd);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
@ -84,7 +84,7 @@ XMLCommands &XMLCommands::Add(String const &id, Function<void()> cb)
|
|||
bool has = Has(id);
|
||||
XMLCommand *cmd;
|
||||
if(has)
|
||||
cmd = &commands.Get(id);
|
||||
cmd = &commands.Get(ToUpper(id));
|
||||
else
|
||||
cmd = new XMLCommand;
|
||||
cmd->control = NULL;
|
||||
|
|
@ -93,7 +93,7 @@ XMLCommands &XMLCommands::Add(String const &id, Function<void()> cb)
|
|||
cmd->callback = cb;
|
||||
cmd->menuCallback.Clear();
|
||||
if(!has)
|
||||
commands.Add(id, cmd);
|
||||
commands.Add(ToUpper(id), cmd);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
@ -103,7 +103,7 @@ XMLCommands &XMLCommands::Add(String const &id, Function<void(XMLToolBar &)> mc)
|
|||
bool has = Has(id);
|
||||
XMLCommand *cmd;
|
||||
if(has)
|
||||
cmd = &commands.Get(id);
|
||||
cmd = &commands.Get(ToUpper(id));
|
||||
else
|
||||
cmd = new XMLCommand;
|
||||
cmd->control = NULL;
|
||||
|
|
@ -112,7 +112,7 @@ XMLCommands &XMLCommands::Add(String const &id, Function<void(XMLToolBar &)> mc)
|
|||
cmd->callback.Clear();
|
||||
cmd->menuCallback = mc;
|
||||
if(!has)
|
||||
commands.Add(id, cmd);
|
||||
commands.Add(ToUpper(id), cmd);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
@ -122,7 +122,7 @@ XMLCommands &XMLCommands::Add(String const &id, Ctrl &ctrl, Size const &size)
|
|||
bool has = Has(id);
|
||||
XMLCommand *cmd;
|
||||
if(has)
|
||||
cmd = &commands.Get(id);
|
||||
cmd = &commands.Get(ToUpper(id));
|
||||
else
|
||||
cmd = new XMLCommand;
|
||||
cmd->control = &ctrl;
|
||||
|
|
@ -132,7 +132,7 @@ XMLCommands &XMLCommands::Add(String const &id, Ctrl &ctrl, Size const &size)
|
|||
cmd->callback.Clear();
|
||||
cmd->menuCallback.Clear();
|
||||
if(!has)
|
||||
commands.Add(id, cmd);
|
||||
commands.Add(ToUpper(id), cmd);
|
||||
return *this;
|
||||
}
|
||||
XMLCommands &XMLCommands::Add(String const &id, Ctrl &ctrl)
|
||||
|
|
@ -146,7 +146,7 @@ XMLCommands &XMLCommands::Add(bool enabled, String const &id, String const &cmdS
|
|||
bool has = Has(id);
|
||||
XMLCommand *cmd;
|
||||
if(has)
|
||||
cmd = &commands.Get(id);
|
||||
cmd = &commands.Get(ToUpper(id));
|
||||
else
|
||||
cmd = new XMLCommand;
|
||||
cmd->control = NULL;
|
||||
|
|
@ -156,7 +156,7 @@ XMLCommands &XMLCommands::Add(bool enabled, String const &id, String const &cmdS
|
|||
cmd->menuCallback.Clear();
|
||||
cmd->commandString = cmdStr;
|
||||
if(!has)
|
||||
commands.Add(id, cmd);
|
||||
commands.Add(ToUpper(id), cmd);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
@ -166,7 +166,7 @@ XMLCommands &XMLCommands::Add(bool enabled, String const &id, Function<void()> c
|
|||
bool has = Has(id);
|
||||
XMLCommand *cmd;
|
||||
if(has)
|
||||
cmd = &commands.Get(id);
|
||||
cmd = &commands.Get(ToUpper(id));
|
||||
else
|
||||
cmd = new XMLCommand;
|
||||
cmd->control = NULL;
|
||||
|
|
@ -175,7 +175,7 @@ XMLCommands &XMLCommands::Add(bool enabled, String const &id, Function<void()> c
|
|||
cmd->callback = cb;
|
||||
cmd->menuCallback.Clear();
|
||||
if(!has)
|
||||
commands.Add(id, cmd);
|
||||
commands.Add(ToUpper(id), cmd);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
@ -185,7 +185,7 @@ XMLCommands &XMLCommands::Add(bool enabled, String const &id, Function<void(XMLT
|
|||
bool has = Has(id);
|
||||
XMLCommand *cmd;
|
||||
if(has)
|
||||
cmd = &commands.Get(id);
|
||||
cmd = &commands.Get(ToUpper(id));
|
||||
else
|
||||
cmd = new XMLCommand;
|
||||
cmd->control = NULL;
|
||||
|
|
@ -194,7 +194,7 @@ XMLCommands &XMLCommands::Add(bool enabled, String const &id, Function<void(XMLT
|
|||
cmd->callback.Clear();
|
||||
cmd->menuCallback = mc;
|
||||
if(!has)
|
||||
commands.Add(id, cmd);
|
||||
commands.Add(ToUpper(id), cmd);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
@ -204,7 +204,7 @@ XMLCommands &XMLCommands::Add(bool enabled, String const &id, Ctrl &ctrl, Size c
|
|||
bool has = Has(id);
|
||||
XMLCommand *cmd;
|
||||
if(has)
|
||||
cmd = &commands.Get(id);
|
||||
cmd = &commands.Get(ToUpper(id));
|
||||
else
|
||||
cmd = new XMLCommand;
|
||||
cmd->control = &ctrl;
|
||||
|
|
@ -214,7 +214,7 @@ XMLCommands &XMLCommands::Add(bool enabled, String const &id, Ctrl &ctrl, Size c
|
|||
cmd->callback.Clear();
|
||||
cmd->menuCallback.Clear();
|
||||
if(!has)
|
||||
commands.Add(id, cmd);
|
||||
commands.Add(ToUpper(id), cmd);
|
||||
return *this;
|
||||
}
|
||||
XMLCommands &XMLCommands::Add(bool enabled, String const &id, Ctrl &ctrl)
|
||||
|
|
|
|||
|
|
@ -135,17 +135,17 @@ class XMLCommands : DeepCopyOption<XMLCommands>
|
|||
Vector<String> const &GetIds(void) const;
|
||||
|
||||
// get a command for a given id
|
||||
XMLCommand const &Get(String const &id) const { return commands.Get(id); }
|
||||
XMLCommand &Get(String const &id) { return commands.Get(id); }
|
||||
XMLCommand const &Get(String const &id) const { return commands.Get(ToUpper(id)); }
|
||||
XMLCommand &Get(String const &id) { return commands.Get(ToUpper(id)); }
|
||||
|
||||
// find a command given its name
|
||||
int Find(String const &id) const { return commands.Find(id); }
|
||||
int Find(String const &id) const { return commands.Find(ToUpper(id)); }
|
||||
|
||||
// sets the commands by a callback
|
||||
void Set(Function<void(XMLCommands &)> commands);
|
||||
|
||||
// checks wether a command is present given its id
|
||||
bool Has(String const &id) const { return commands.Find(id) >= 0; }
|
||||
bool Has(String const &id) const { return commands.Find(ToUpper(id)) >= 0; }
|
||||
|
||||
// array access
|
||||
XMLCommand const &operator[](int idx) const { return commands[idx]; }
|
||||
|
|
|
|||
|
|
@ -656,7 +656,7 @@ void XMLMenuEditor::cmdContextEditCb(void)
|
|||
{
|
||||
XMLCmdEdit edit(commands, false);
|
||||
edit.cmdId <<= cmdPane.commandList.GetData();
|
||||
edit.cmdStr <<= commands.Get(cmdPane.commandList.GetData()).GetCommandString();
|
||||
edit.cmdStr <<= commands.Get(ToUpper(String(cmdPane.commandList.GetData()))).GetCommandString();
|
||||
int res = edit.RunAppModal();
|
||||
edit.Close();
|
||||
if(res == IDOK)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue