@@ -2277,6 +2277,29 @@ MainWindow::cm_save_as ()
22772277 do_save (true );
22782278}
22792279
2280+ static db::SaveLayoutOptions
2281+ get_save_options_from_cv (const lay::CellView &cv)
2282+ {
2283+ db::SaveLayoutOptions options = cv->save_options ();
2284+ if (!cv->save_options_valid () && cv->technology ()) {
2285+ options = cv->technology ()->save_layout_options ();
2286+ options.set_format (cv->save_options ().format ());
2287+ }
2288+
2289+ // preconfigure options with current values
2290+
2291+ options.set_dbu (cv->layout ().dbu ());
2292+
2293+ if (cv->layout ().has_meta_info (" libname" )) {
2294+ tl::Variant libname = cv->layout ().meta_info (" libname" ).value ;
2295+ if (libname.is_a_string ()) {
2296+ options.set_libname (libname.to_stdstring ());
2297+ }
2298+ }
2299+
2300+ return options;
2301+ }
2302+
22802303void
22812304MainWindow::do_save (bool as)
22822305{
@@ -2309,22 +2332,7 @@ MainWindow::do_save (bool as)
23092332 // - if the layout's save options are valid we take the options from there, otherwise we take the options from the technology
23102333 // - on "save as" we let the user edit the options
23112334
2312- db::SaveLayoutOptions options = cv->save_options ();
2313- if (!cv->save_options_valid () && cv->technology ()) {
2314- options = cv->technology ()->save_layout_options ();
2315- options.set_format (cv->save_options ().format ());
2316- }
2317-
2318- // preconfigure options with current values
2319-
2320- options.set_dbu (cv->layout ().dbu ());
2321-
2322- if (cv->layout ().has_meta_info (" libname" )) {
2323- tl::Variant libname = cv->layout ().meta_info (" libname" ).value ;
2324- if (libname.is_a_string ()) {
2325- options.set_libname (libname.to_stdstring ());
2326- }
2327- }
2335+ db::SaveLayoutOptions options = get_save_options_from_cv (cv);
23282336
23292337 if (as || options.format ().empty ()) {
23302338 options.set_format_from_filename (fn);
@@ -2337,7 +2345,18 @@ MainWindow::do_save (bool as)
23372345 }
23382346
23392347 current_view ()->save_as ((unsigned int ) cv_index, fn, om, options, true , m_keep_backups);
2340- add_mru (fn, current_view ()->cellview (cv_index)->tech_name ());
2348+ add_mru (fn, cv->tech_name ());
2349+
2350+ if (as) {
2351+
2352+ lay::LayoutViewNotification n (" reload" , tl::to_string (tr (" The next 'save' operations will use the writer options you have picked, instead of the application-wide ones." )));
2353+ current_view ()->add_notification (n);
2354+
2355+ // freeze writer options in the 'save_as' case, so we can do another "save" and get the
2356+ // selected options again
2357+ cv->set_save_options (options, true );
2358+
2359+ }
23412360
23422361 }
23432362
@@ -2362,23 +2381,14 @@ MainWindow::cm_save_all ()
23622381
23632382 if (! fn.empty () || mp_layout_fdia->get_save (fn, tl::to_string (tr (" Save Layout '%1'" ).arg (tl::to_qstring (cv->name ()))))) {
23642383
2365- db::SaveLayoutOptions options (cv->save_options ());
2366- options.set_dbu (cv->layout ().dbu ());
2384+ db::SaveLayoutOptions options = get_save_options_from_cv (cv);
23672385
23682386 if (options.format ().empty ()) {
23692387 options.set_format_from_filename (fn);
23702388 }
23712389
23722390 tl::OutputStream::OutputStreamMode om = tl::OutputStream::OM_Auto;
23732391
2374- // initialize the specific options from the configuration if required
2375- for (tl::Registrar<lay::PluginDeclaration>::iterator cls = tl::Registrar<lay::PluginDeclaration>::begin (); cls != tl::Registrar<lay::PluginDeclaration>::end (); ++cls) {
2376- const StreamWriterPluginDeclaration *decl = dynamic_cast <const StreamWriterPluginDeclaration *> (&*cls);
2377- if (decl) {
2378- options.set_options (decl->create_specific_options ());
2379- }
2380- }
2381-
23822392 view (view_index)->save_as (cv_index, fn, om, options, true , m_keep_backups);
23832393 add_mru (fn, cv->tech_name ());
23842394
0 commit comments