mirror of
https://github.com/aseprite/aseprite.git
synced 2025-02-06 03:39:51 +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,31 +54,27 @@ bool AppMenuItem::onProcessMessage(Message* msg)
|
||||
{
|
||||
switch (msg->type()) {
|
||||
|
||||
case kOpenMessage: {
|
||||
UIContext* context = UIContext::instance();
|
||||
|
||||
if (m_command) {
|
||||
if (m_params)
|
||||
m_command->loadParams(m_params);
|
||||
|
||||
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) {
|
||||
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)
|
||||
m_command->loadParams(m_params);
|
||||
|
||||
setEnabled(m_command->isEnabled(context));
|
||||
setSelected(m_command->isChecked(context));
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user