Fixed #162 (GDS2 libname not maintained)

This commit is contained in:
Matthias Koefferlein 2018-08-31 23:25:19 +02:00
parent 904c19ebcb
commit 753e170a68
4 changed files with 41 additions and 0 deletions

View File

@ -1,3 +1,8 @@
0.25.5 (xxxx-xx-xx):
* Bugfix: https://github.com/klayoutmatthias/klayout/issues/162
GDS2 LIBNAME was not maintained on "File/Save".
0.25.4 (2018-08-25):
* Bugfix: https://github.com/klayoutmatthias/klayout/issues/121
Issue with multiple reads of GDS2 layouts including PCells

View File

@ -3170,6 +3170,8 @@ MainWindow::do_save (bool as)
options.set_dbu (cv->layout ().dbu ());
options.set_format_from_filename (fn);
cv->update_save_options (options);
tl::OutputStream::OutputStreamMode om = tl::OutputStream::OM_Auto;
if (as && ! mp_layout_save_as_options->get_options (current_view (), cv_index, fn, om, options)) {

View File

@ -258,6 +258,31 @@ LayoutHandle::set_save_options (const db::SaveLayoutOptions &options, bool valid
m_save_options_valid = valid;
}
void
LayoutHandle::update_save_options (db::SaveLayoutOptions &options)
{
for (tl::Registrar<lay::PluginDeclaration>::iterator cls = tl::Registrar<lay::PluginDeclaration>::begin (); cls != tl::Registrar<lay::PluginDeclaration>::end (); ++cls) {
const lay::StreamWriterPluginDeclaration *decl = dynamic_cast <const lay::StreamWriterPluginDeclaration *> (&*cls);
if (! decl) {
continue;
}
std::auto_ptr<db::FormatSpecificWriterOptions> specific_options;
if (options.get_options (decl->format_name ())) {
specific_options.reset (options.get_options (decl->format_name ())->clone ());
} else {
specific_options.reset (decl->create_specific_options ());
}
if (specific_options.get ()) {
decl->initialize_options_from_layout_handle (specific_options.get (), *this);
options.set_options (specific_options.release ());
}
}
}
void
LayoutHandle::save_as (const std::string &fn, tl::OutputStream::OutputStreamMode om, const db::SaveLayoutOptions &options, bool update)
{

View File

@ -234,6 +234,15 @@ public:
return m_save_options;
}
/**
* @brief Updates the given save options with attributes from this cell view
*
* Some formats will initialize attributes from the cell view and the layout's
* metadata (example: libname of GDS2). This method will update the options
* if the layout provides attributes for initializing the latter.
*/
void update_save_options (db::SaveLayoutOptions &options);
/**
* @brief Gets a flag indicating whether the save options are valid
*