Hi,
some time ago I thought it would be nice if dialogs could be _toggled_ (as opposed to only be shown) by their corresponding keyboard shortcuts. This is especially true with the new dockable dialogs (great improvement, by the way, in case I haven't mentioned it yet :)) because they don't respond to Ctrl+W any more so that they closing them is only possible by using mouse clicks, not the keyboard alone.
I tried to implement toggling but have two small questions:
- What is the right entry point in the code? Should this be done in the DialogManager::showDialog() function? In this case, is there already a way to test whether a Dialog is currently visible, or do I need to add a new boolean variable to the Dialog class?
- When a dialog is invoked for the very first time after startup, it seems to be present()-ed more than once so that a check for the dialog's visibility wrongly indicates that it is already being shown (thus in order to initially show a dialog, its corresponding shortcut needs to be pressed twice, which is annoying and inconsistent). What is the reason for this? And is there a less cumbersome way to circumvent it than introducing yet another boolean variable just to check whether the dialog was already shown before?
Thanks for any hints, Max