mirror of https://github.com/KLayout/klayout.git
'Save As Waiver DB' implemented
This commit is contained in:
parent
9fcd9d7616
commit
86a2a6dd40
|
|
@ -368,6 +368,14 @@ to load a marker database</string>
|
||||||
<enum>QAction::NoRole</enum>
|
<enum>QAction::NoRole</enum>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="saveas_waiver_db_action">
|
||||||
|
<property name="text">
|
||||||
|
<string>Save As Waiver DB</string>
|
||||||
|
</property>
|
||||||
|
<property name="menuRole">
|
||||||
|
<enum>QAction::NoRole</enum>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
|
|
|
||||||
|
|
@ -88,6 +88,7 @@ MarkerBrowserDialog::MarkerBrowserDialog (lay::Dispatcher *root, lay::LayoutView
|
||||||
connect (mp_ui->open_action, SIGNAL (triggered ()), this, SLOT (open_clicked ()));
|
connect (mp_ui->open_action, SIGNAL (triggered ()), this, SLOT (open_clicked ()));
|
||||||
connect (mp_ui->save_action, SIGNAL (triggered ()), this, SLOT (save_clicked ()));
|
connect (mp_ui->save_action, SIGNAL (triggered ()), this, SLOT (save_clicked ()));
|
||||||
connect (mp_ui->saveas_action, SIGNAL (triggered ()), this, SLOT (saveas_clicked ()));
|
connect (mp_ui->saveas_action, SIGNAL (triggered ()), this, SLOT (saveas_clicked ()));
|
||||||
|
connect (mp_ui->saveas_waiver_db_action, SIGNAL (triggered ()), this, SLOT (saveas_waiver_db_clicked ()));
|
||||||
connect (mp_ui->export_action, SIGNAL (triggered ()), this, SLOT (export_clicked ()));
|
connect (mp_ui->export_action, SIGNAL (triggered ()), this, SLOT (export_clicked ()));
|
||||||
connect (mp_ui->reload_action, SIGNAL (triggered ()), this, SLOT (reload_clicked ()));
|
connect (mp_ui->reload_action, SIGNAL (triggered ()), this, SLOT (reload_clicked ()));
|
||||||
connect (mp_ui->info_action, SIGNAL (triggered ()), this, SLOT (info_clicked ()));
|
connect (mp_ui->info_action, SIGNAL (triggered ()), this, SLOT (info_clicked ()));
|
||||||
|
|
@ -97,6 +98,7 @@ MarkerBrowserDialog::MarkerBrowserDialog (lay::Dispatcher *root, lay::LayoutView
|
||||||
mp_ui->file_menu->addAction (mp_ui->open_action);
|
mp_ui->file_menu->addAction (mp_ui->open_action);
|
||||||
mp_ui->file_menu->addAction (mp_ui->save_action);
|
mp_ui->file_menu->addAction (mp_ui->save_action);
|
||||||
mp_ui->file_menu->addAction (mp_ui->saveas_action);
|
mp_ui->file_menu->addAction (mp_ui->saveas_action);
|
||||||
|
mp_ui->file_menu->addAction (mp_ui->saveas_waiver_db_action);
|
||||||
QAction *sep0 = new QAction (mp_ui->file_menu);
|
QAction *sep0 = new QAction (mp_ui->file_menu);
|
||||||
sep0->setSeparator (true);
|
sep0->setSeparator (true);
|
||||||
mp_ui->file_menu->addAction (mp_ui->export_action);
|
mp_ui->file_menu->addAction (mp_ui->export_action);
|
||||||
|
|
@ -393,6 +395,28 @@ BEGIN_PROTECTED
|
||||||
END_PROTECTED
|
END_PROTECTED
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
MarkerBrowserDialog::saveas_waiver_db_clicked ()
|
||||||
|
{
|
||||||
|
BEGIN_PROTECTED
|
||||||
|
|
||||||
|
rdb::Database *rdb = 0;
|
||||||
|
if (m_rdb_index < int (view ()->num_rdbs ()) && m_rdb_index >= 0) {
|
||||||
|
rdb = view ()->get_rdb (m_rdb_index);
|
||||||
|
}
|
||||||
|
if (! rdb) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rdb->filename ().empty ()) {
|
||||||
|
throw tl::Exception (tl::to_string (tr ("The current report database is not saved.\nSave it to some file with 'Save As', before saving it as waiver DB.")));
|
||||||
|
}
|
||||||
|
|
||||||
|
rdb->write (rdb->filename () + ".w");
|
||||||
|
|
||||||
|
END_PROTECTED
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
MarkerBrowserDialog::saveas_clicked ()
|
MarkerBrowserDialog::saveas_clicked ()
|
||||||
{
|
{
|
||||||
|
|
@ -760,6 +784,7 @@ MarkerBrowserDialog::update_content ()
|
||||||
|
|
||||||
mp_ui->save_action->setEnabled (rdb != 0);
|
mp_ui->save_action->setEnabled (rdb != 0);
|
||||||
mp_ui->saveas_action->setEnabled (rdb != 0);
|
mp_ui->saveas_action->setEnabled (rdb != 0);
|
||||||
|
mp_ui->saveas_waiver_db_action->setEnabled (rdb != 0);
|
||||||
mp_ui->export_action->setEnabled (rdb != 0);
|
mp_ui->export_action->setEnabled (rdb != 0);
|
||||||
mp_ui->unload_action->setEnabled (rdb != 0);
|
mp_ui->unload_action->setEnabled (rdb != 0);
|
||||||
mp_ui->unload_all_action->setEnabled (rdb != 0);
|
mp_ui->unload_all_action->setEnabled (rdb != 0);
|
||||||
|
|
|
||||||
|
|
@ -77,6 +77,7 @@ public slots:
|
||||||
void info_clicked ();
|
void info_clicked ();
|
||||||
void save_clicked ();
|
void save_clicked ();
|
||||||
void saveas_clicked ();
|
void saveas_clicked ();
|
||||||
|
void saveas_waiver_db_clicked ();
|
||||||
void export_clicked ();
|
void export_clicked ();
|
||||||
void reload_clicked ();
|
void reload_clicked ();
|
||||||
void open_clicked ();
|
void open_clicked ();
|
||||||
|
|
|
||||||
|
|
@ -2444,6 +2444,13 @@ public:
|
||||||
*/
|
*/
|
||||||
void save (const std::string &filename);
|
void save (const std::string &filename);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Write the database to a file
|
||||||
|
*
|
||||||
|
* This function is like "save", but does not update the file name attribute.
|
||||||
|
*/
|
||||||
|
void write (const std::string &filename);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Load the database from a file
|
* @brief Load the database from a file
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -118,17 +118,25 @@ make_rdb_structure (rdb::Database *rdb)
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------------------------
|
// -------------------------------------------------------------
|
||||||
// Implementation of rdb::Database::save
|
// Implementation of rdb::Database::save and write
|
||||||
// TODO: move this somewhere else - with generalized functionality
|
// TODO: move this somewhere else - with generalized functionality
|
||||||
|
|
||||||
void
|
void
|
||||||
rdb::Database::save (const std::string &fn)
|
rdb::Database::save (const std::string &fn)
|
||||||
{
|
{
|
||||||
tl::OutputStream os (fn, tl::OutputStream::OM_Auto);
|
write (fn);
|
||||||
make_rdb_structure (this).write (os, *this);
|
|
||||||
set_filename (fn);
|
set_filename (fn);
|
||||||
|
}
|
||||||
|
|
||||||
tl::log << "Saved RDB to " << fn;
|
void
|
||||||
|
rdb::Database::write (const std::string &fn)
|
||||||
|
{
|
||||||
|
tl::OutputStream os (fn, tl::OutputStream::OM_Auto);
|
||||||
|
make_rdb_structure (this).write (os, *this);
|
||||||
|
|
||||||
|
if (tl::verbosity () >= 10) {
|
||||||
|
tl::log << "Saved RDB to " << fn;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------------------------
|
// -------------------------------------------------------------
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue