Fixed #115 (Reader options are not persisted).

This commit is contained in:
Matthias Koefferlein 2018-04-17 00:56:53 +02:00
parent 86a90571e6
commit c7fcd18413
4 changed files with 24 additions and 8 deletions

View File

@ -214,7 +214,7 @@ TechnologyController::technologies_changed ()
void void
TechnologyController::technology_changed (lay::Technology *) TechnologyController::technology_changed (lay::Technology *)
{ {
update_menu (); technologies_changed ();
} }
bool bool

View File

@ -250,9 +250,11 @@ LoadLayoutOptionsDialog::edit_global_options (lay::PluginRoot *config_root, lay:
config_root->config_set (cfg_reader_options_show_always, tl::to_string (m_show_always)); config_root->config_set (cfg_reader_options_show_always, tl::to_string (m_show_always));
i = 0; i = 0;
technologies->begin_updates ();
for (lay::Technologies::iterator t = technologies->begin (); t != technologies->end () && i < m_opt_array.size (); ++t, ++i) { for (lay::Technologies::iterator t = technologies->begin (); t != technologies->end () && i < m_opt_array.size (); ++t, ++i) {
technologies->begin ()[i].set_load_layout_options (m_opt_array [i]); technologies->begin ()[i].set_load_layout_options (m_opt_array [i]);
} }
technologies->end_updates ();
return true; return true;

View File

@ -60,17 +60,24 @@ Technologies::operator= (const Technologies &other)
{ {
if (&other != this) { if (&other != this) {
m_technologies = other.m_technologies; m_technologies = other.m_technologies;
technologies_changed_event (); for (iterator i = begin (); i != end (); ++i) {
i->technology_changed_with_sender_event.add (this, &Technologies::technology_changed);
}
technologies_changed ();
} }
return *this; return *this;
} }
static std::auto_ptr<lay::Technologies> sp_technologies;
lay::Technologies * lay::Technologies *
Technologies::instance () Technologies::instance ()
{ {
static lay::Technologies s_technologies; if (! sp_technologies.get ()) {
return &s_technologies; sp_technologies.reset (new lay::Technologies ());
}
return sp_technologies.get ();
} }
static tl::XMLElementList xml_elements () static tl::XMLElementList xml_elements ()
@ -167,6 +174,16 @@ Technologies::clear ()
} }
} }
void
Technologies::technology_changed (Technology *t)
{
if (m_in_update) {
m_changed = true;
} else {
technology_changed_event (t);
}
}
void void
Technologies::technologies_changed () Technologies::technologies_changed ()
{ {

View File

@ -234,10 +234,7 @@ protected:
/** /**
* @brief Forward the event from the individual technologies * @brief Forward the event from the individual technologies
*/ */
void technology_changed (Technology *t) void technology_changed (Technology *t);
{
technology_changed_event (t);
}
/** /**
* @brief Sends the technologies_changed event * @brief Sends the technologies_changed event