added option to manually save the collapsed/expanded state of tools

This commit is contained in:
Alberto Griggio
2017-08-21 18:42:15 +02:00
parent ad20c39907
commit 610f3e4853
11 changed files with 84 additions and 4 deletions

View File

@@ -680,6 +680,36 @@ bool RTWindow::on_delete_event(GdkEventAny* event)
return false;
}
void RTWindow::writeToolExpandedStatus(std::vector<int> &tpOpen)
{
if ((isSingleTabMode() || gimpPlugin) && epanel->isRealized()) {
epanel->writeToolExpandedStatus(tpOpen);
} else {
// Storing the options of the last EditorPanel before Gtk destroys everything
// Look at the active panel first, if any, otherwise look at the first one (sorted on the filename)
if (epanels.size()) {
int page = mainNB->get_current_page();
Gtk::Widget *w = mainNB->get_nth_page(page);
bool optionsWritten = false;
for (std::map<Glib::ustring, EditorPanel*>::iterator i = epanels.begin(); i != epanels.end(); ++i) {
if (i->second == w) {
i->second->writeToolExpandedStatus(tpOpen);
optionsWritten = true;
}
}
if (!optionsWritten) {
// fallback solution: save the options of the first editor panel
std::map<Glib::ustring, EditorPanel*>::iterator i = epanels.begin();
i->second->writeToolExpandedStatus(tpOpen);
}
}
}
}
void RTWindow::showPreferences ()
{
Preferences *pref = new Preferences (this);