From bbaaa14b2c8ef686b454823a5286ff0b77c300ad Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sat, 22 Nov 2025 23:57:40 +0100 Subject: [PATCH] Bringing 'save all' on the same level than 'same' - Taking the technology's settings for save options - Deploying "libname", e.g. for GDS2 --- src/lay/lay/layMainWindow.cc | 43 ++++++++++++++++------------ src/laybasic/laybasic/layCellView.cc | 26 ----------------- src/laybasic/laybasic/layCellView.h | 9 ------ 3 files changed, 25 insertions(+), 53 deletions(-) diff --git a/src/lay/lay/layMainWindow.cc b/src/lay/lay/layMainWindow.cc index b54499056..b1fa11141 100644 --- a/src/lay/lay/layMainWindow.cc +++ b/src/lay/lay/layMainWindow.cc @@ -2277,6 +2277,29 @@ MainWindow::cm_save_as () do_save (true); } +static db::SaveLayoutOptions +get_save_options_from_cv (const lay::CellView &cv) +{ + db::SaveLayoutOptions options = cv->save_options (); + if (!cv->save_options_valid () && cv->technology ()) { + options = cv->technology ()->save_layout_options (); + options.set_format (cv->save_options ().format ()); + } + + // preconfigure options with current values + + options.set_dbu (cv->layout ().dbu ()); + + if (cv->layout ().has_meta_info ("libname")) { + tl::Variant libname = cv->layout ().meta_info ("libname").value; + if (libname.is_a_string ()) { + options.set_libname (libname.to_stdstring ()); + } + } + + return options; +} + void MainWindow::do_save (bool as) { @@ -2309,22 +2332,7 @@ MainWindow::do_save (bool as) // - if the layout's save options are valid we take the options from there, otherwise we take the options from the technology // - on "save as" we let the user edit the options - db::SaveLayoutOptions options = cv->save_options (); - if (!cv->save_options_valid () && cv->technology ()) { - options = cv->technology ()->save_layout_options (); - options.set_format (cv->save_options ().format ()); - } - - // preconfigure options with current values - - options.set_dbu (cv->layout ().dbu ()); - - if (cv->layout ().has_meta_info ("libname")) { - tl::Variant libname = cv->layout ().meta_info ("libname").value; - if (libname.is_a_string ()) { - options.set_libname (libname.to_stdstring ()); - } - } + db::SaveLayoutOptions options = get_save_options_from_cv (cv); if (as || options.format ().empty ()) { options.set_format_from_filename (fn); @@ -2362,8 +2370,7 @@ MainWindow::cm_save_all () if (! fn.empty () || mp_layout_fdia->get_save (fn, tl::to_string (tr ("Save Layout '%1'").arg (tl::to_qstring (cv->name ()))))) { - db::SaveLayoutOptions options (cv->save_options ()); - options.set_dbu (cv->layout ().dbu ()); + db::SaveLayoutOptions options = get_save_options_from_cv (cv); if (options.format ().empty ()) { options.set_format_from_filename (fn); diff --git a/src/laybasic/laybasic/layCellView.cc b/src/laybasic/laybasic/layCellView.cc index 84cbde12c..4249f91db 100644 --- a/src/laybasic/laybasic/layCellView.cc +++ b/src/laybasic/laybasic/layCellView.cc @@ -300,32 +300,6 @@ LayoutHandle::set_save_options (const db::SaveLayoutOptions &options, bool valid m_save_options_valid = valid; } -void -LayoutHandle::update_save_options (db::SaveLayoutOptions &options) -{ -#if defined(HAVE_QT) - for (tl::Registrar::iterator cls = tl::Registrar::begin (); cls != tl::Registrar::end (); ++cls) { - - const lay::StreamWriterPluginDeclaration *decl = dynamic_cast (&*cls); - if (! decl || decl->options_alias ()) { - continue; - } - - std::unique_ptr 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 ()) { - options.set_options (specific_options.release ()); - } - - } -#endif -} - void LayoutHandle::save_as (const std::string &fn, tl::OutputStream::OutputStreamMode om, const db::SaveLayoutOptions &options, bool update, int keep_backups) { diff --git a/src/laybasic/laybasic/layCellView.h b/src/laybasic/laybasic/layCellView.h index 661d6c8c1..0b5adadd1 100644 --- a/src/laybasic/laybasic/layCellView.h +++ b/src/laybasic/laybasic/layCellView.h @@ -242,15 +242,6 @@ 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 *