Fixed #30: Writer options dialog non-functional on a fresh configuration

This commit is contained in:
Matthias Koefferlein 2017-11-29 23:23:28 +01:00
parent be80682853
commit 8e55a4171e
3 changed files with 39 additions and 2 deletions

View File

@ -191,9 +191,20 @@ SaveLayoutOptionsDialog::commit ()
// create the particular options for all formats
for (std::vector< std::pair<StreamWriterOptionsPage *, std::string> >::iterator page = m_pages.begin (); page != m_pages.end (); ++page) {
if (page->first) {
page->first->commit (m_opt_array [m_technology_index].get_options (page->second), m_tech_array [m_technology_index], false);
db::FormatSpecificWriterOptions *specific_options = m_opt_array [m_technology_index].get_options (page->second);
if (! specific_options) {
// Create a container for the options unless there is one already
specific_options = StreamWriterPluginDeclaration::plugin_for_format (page->second)->create_specific_options ();
m_opt_array [m_technology_index].set_options (specific_options);
}
page->first->commit (specific_options, m_tech_array [m_technology_index], false);
}
}
}
@ -206,7 +217,14 @@ SaveLayoutOptionsDialog::update ()
for (std::vector< std::pair<StreamWriterOptionsPage *, std::string> >::iterator page = m_pages.begin (); page != m_pages.end (); ++page) {
if (page->first) {
page->first->setup (m_opt_array [m_technology_index].get_options (page->second), m_tech_array [m_technology_index]);
db::FormatSpecificWriterOptions *specific_options = m_opt_array [m_technology_index].get_options (page->second);
if (! specific_options) {
// Create a container for the options unless there is one already
std::auto_ptr<db::FormatSpecificWriterOptions> new_options (StreamWriterPluginDeclaration::plugin_for_format (page->second)->create_specific_options ());
page->first->setup (new_options.get (), m_tech_array [m_technology_index]);
} else {
page->first->setup (specific_options, m_tech_array [m_technology_index]);
}
}
}
}
@ -256,6 +274,10 @@ SaveLayoutOptionsDialog::edit_global_options (lay::PluginRoot *config_root, lay:
technologies->begin ()[i].set_save_layout_options (m_opt_array [i]);
}
// TODO: this call is required currently because otherwise the technology
// management subsystem does not notice the changes of technologies.
technologies->notify_technologies_changed ();
return true;
} else {

View File

@ -184,6 +184,12 @@ Technologies::end_updates ()
}
}
void
Technologies::notify_technologies_changed ()
{
technologies_changed ();
}
void
Technologies::end_updates_no_event ()
{

View File

@ -157,6 +157,15 @@ public:
*/
void end_updates_no_event ();
/**
* @brief Notifies the system of changes in technologies
* For performance reasons, changes inside a technology are not propagated to
* the system directly. Only bulk changes (such as adding or removing technologies
* are). To inform the system of individual technology updates, call this method
* after a technology or multiple technologies have been changed.
*/
void notify_technologies_changed ();
/**
* @brief Checks, if a technology with the given name exists
*/