mirror of
https://github.com/aseprite/aseprite.git
synced 2025-02-11 09:40:42 +00:00
AppMenuItem: fix updating enabled/checked state in popup menus (in timeline popups mainly)
This commit is contained in:
parent
4d48e40484
commit
0120ef58e1
@ -54,8 +54,19 @@ bool AppMenuItem::onProcessMessage(Message* msg)
|
||||
{
|
||||
switch (msg->type()) {
|
||||
|
||||
case kOpenMessage: {
|
||||
UIContext* context = UIContext::instance();
|
||||
case kCloseMessage:
|
||||
// disable the menu (the keyboard shortcuts are processed by "manager_msg_proc")
|
||||
setEnabled(false);
|
||||
break;
|
||||
|
||||
default:
|
||||
if (msg->type() == kOpenMessage ||
|
||||
msg->type() == kOpenMenuItemMessage) {
|
||||
// Update the context flags after opening the menuitem's
|
||||
// submenu to update the "enabled" flag of each command
|
||||
// correctly.
|
||||
Context* context = UIContext::instance();
|
||||
context->updateFlags();
|
||||
|
||||
if (m_command) {
|
||||
if (m_params)
|
||||
@ -64,21 +75,6 @@ bool AppMenuItem::onProcessMessage(Message* msg)
|
||||
setEnabled(m_command->isEnabled(context));
|
||||
setSelected(m_command->isChecked(context));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case kCloseMessage:
|
||||
// disable the menu (the keyboard shortcuts are processed by "manager_msg_proc")
|
||||
setEnabled(false);
|
||||
break;
|
||||
|
||||
default:
|
||||
if (msg->type() == kOpenMenuItemMessage) {
|
||||
// Update the context flags after opening the menuitem's
|
||||
// submenu to update the "enabled" flag of each command
|
||||
// correctly.
|
||||
Context* context = UIContext::instance();
|
||||
context->updateFlags();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user