Update of /cvsroot/audacity/audacity-src/src/commands
In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv22551/src/commands
Modified Files:
CommandManager.cpp
Log Message:
Fix enabling/disabling of effects in multiple submenus
Index: CommandManager.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/commands/CommandManager.cpp,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -d -r1.40 -r1.41
--- CommandManager.cpp 7 Jun 2007 20:27:40 -0000 1.40
+++ CommandManager.cpp 3 Jul 2007 09:32:19 -0000 1.41
@@ -396,7 +396,7 @@
for(i=0; i<effLen; i++) {
int ID = NewIdentifier(name, labels[i], CurrentMenu(), callback,
true, i, effLen);
-
+
CurrentMenu()->Append(ID, labels[i]);
if(((i+1) % MAX_SUBMENU_LEN) == 0 && i != (effLen - 1)) {
@@ -485,7 +485,7 @@
tmpEntry->flags = mDefaultFlags;
tmpEntry->mask = mDefaultMask;
tmpEntry->enabled = true;
-
+
// Key from preferences overridse the default key given
gPrefs->SetPath(wxT("/NewKeys"));
if (gPrefs->HasEntry(name)) {
@@ -543,12 +543,21 @@
for(i=1; i<entry->count; i++) {
ID = NextIdentifier(ID);
- wxMenuItem *item = entry->menu->FindItem(ID);
- if (item) {
- item->Enable(enabled);
+
+ // This menu item is not necessarily in the same menu, because
+ // multi-items can be spread across multiple sub menus
+ CommandListEntry *multiEntry = mCommandIDHash[ID];
+ if (multiEntry) {
+ wxMenuItem *item = multiEntry->menu->FindItem(ID);
+
+ if (item) {
+ item->Enable(enabled);
+ } else {
+ wxLogDebug(wxT("Warning: Menu entry with id %i in %s not
found"),
+ ID, (const wxChar*)entry->name);
+ }
} else {
- wxLogDebug(wxT("Warning: Menu entry with id %i in %s not found"),
- ID, (const wxChar*)entry->name);
+ wxLogDebug(wxT("Warning: Menu entry with id %i not in hash"), ID);
}
}
}
@@ -558,7 +567,8 @@
{
CommandListEntry *entry = mCommandNameHash[name];
if (!entry || !entry->menu) {
- //printf("WARNING: Unknown command enabled: '%s'\n", (const char
*)name.mb_str());
+ wxLogDebug(wxT("Warning: Unknown command enabled: '%s'"),
+ (const wxChar*)name);
return;
}
@@ -573,7 +583,7 @@
CommandListEntry *entry = mCommandList[i];
if (entry->multi && entry->index != 0)
continue;
-
+
wxUint32 combinedMask = (mask & entry->mask);
if (combinedMask) {
bool enable = ((flags & combinedMask) ==
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Audacity-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/audacity-cvs