| 57 | } |
| 58 | |
| 59 | bool StateBasePlugin::enable( bool on ) |
| 60 | { |
| 61 | bool res = false; |
| 62 | if ( on && !isEnabled_ ) |
| 63 | { |
| 64 | if ( onEnable_() ) |
| 65 | { |
| 66 | isEnabled_ = true; |
| 67 | dialogIsOpen_ = true; |
| 68 | onPluginEnable_(); // virtual call from IPluginCloseCheck |
| 69 | res = true; |
| 70 | } |
| 71 | } |
| 72 | else if ( !on && isEnabled_ ) |
| 73 | { |
| 74 | if ( onDisable_() ) |
| 75 | { |
| 76 | isEnabled_ = false; |
| 77 | dialogIsOpen_ = false; |
| 78 | onPluginDisable_(); // virtual call from IPluginCloseCheck |
| 79 | res = true; |
| 80 | } |
| 81 | else if ( !dialogIsOpen_ ) |
| 82 | { |
| 83 | dialogIsOpen_ = true; // we are here after setting `dialogIsOpen_ = false` followed by `onDisable_() = false` |
| 84 | } |
| 85 | } |
| 86 | if ( res ) |
| 87 | { |
| 88 | if ( auto ribbonMenu = RibbonMenu::instance() ) |
| 89 | ribbonMenu->updateItemStatus( name() ); |
| 90 | } |
| 91 | return res; |
| 92 | } |
| 93 | |
| 94 | bool StateBasePlugin::dialogIsOpen() const |
| 95 | { |
nothing calls this directly
no test coverage detected