mirror of https://github.com/KLayout/klayout.git
WIP
This commit is contained in:
parent
53490a9faf
commit
d2f2d630d9
|
|
@ -34,6 +34,7 @@
|
|||
#include <QVBoxLayout>
|
||||
#include <QHeaderView>
|
||||
#include <QLabel>
|
||||
#include <QMessageBox>
|
||||
|
||||
namespace edt
|
||||
{
|
||||
|
|
@ -346,6 +347,40 @@ RecentConfigurationPage::update_list (const std::list<std::vector<std::string> >
|
|||
mp_tree_widget->header ()->resizeSections (QHeaderView::ResizeToContents);
|
||||
}
|
||||
|
||||
static bool
|
||||
set_or_request_current_layer (lay::LayoutViewBase *view, unsigned int cv_index, const db::LayerProperties &lp)
|
||||
{
|
||||
bool ok = view->set_current_layer (cv_index, lp);
|
||||
if (ok) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (! view->control_panel ()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const lay::CellView &cv = view->cellview (cv_index);
|
||||
if (! cv.is_valid ()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (QMessageBox::question (view->widget (), tr ("Create Layer"), tr ("Layer %1 does not exist yet. Create it now?").arg (tl::to_qstring (lp.to_string ()))) == QMessageBox::Yes) {
|
||||
|
||||
lay::LayerPropertiesNode lpn;
|
||||
lpn.set_source (lay::ParsedLayerSource (lp, cv_index));
|
||||
view->init_layer_properties (lpn);
|
||||
|
||||
view->transaction (tl::to_string (QObject::tr ("Create new layer")));
|
||||
view->set_current_layer (lay::LayerPropertiesConstIterator (& view->insert_layer (view->end_layers (), lpn)));
|
||||
view->commit ();
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
RecentConfigurationPage::item_clicked (QTreeWidgetItem *item)
|
||||
{
|
||||
|
|
@ -365,7 +400,7 @@ RecentConfigurationPage::item_clicked (QTreeWidgetItem *item)
|
|||
ex.read (cv_index);
|
||||
}
|
||||
|
||||
view ()->set_or_request_current_layer (cv_index, lp);
|
||||
set_or_request_current_layer (view (), cv_index, lp);
|
||||
|
||||
} else {
|
||||
dispatcher ()->config_set (c->cfg_name, v);
|
||||
|
|
|
|||
|
|
@ -33,7 +33,6 @@
|
|||
#include <QImageWriter>
|
||||
#include <QInputDialog>
|
||||
#include <QKeyEvent>
|
||||
#include <QMessageBox>
|
||||
#include <QVBoxLayout>
|
||||
#include <QHBoxLayout>
|
||||
|
||||
|
|
@ -608,40 +607,6 @@ LayoutView::config_finalize ()
|
|||
dm_setup_editor_option_pages ();
|
||||
}
|
||||
|
||||
bool
|
||||
LayoutView::set_or_request_current_layer (unsigned int cv_index, const db::LayerProperties &lp)
|
||||
{
|
||||
bool ok = set_current_layer (cv_index, lp);
|
||||
if (ok) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (! mp_control_panel) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const lay::CellView &cv = cellview (cv_index);
|
||||
if (! cv.is_valid ()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (QMessageBox::question (this, tr ("Create Layer"), tr ("Layer %1 does not exist yet. Create it now?").arg (tl::to_qstring (lp.to_string ()))) == QMessageBox::Yes) {
|
||||
|
||||
lay::LayerPropertiesNode lpn;
|
||||
lpn.set_source (lay::ParsedLayerSource (lp, cv_index));
|
||||
init_layer_properties (lpn);
|
||||
|
||||
transaction (tl::to_string (QObject::tr ("Create new layer")));
|
||||
set_current_layer (lay::LayerPropertiesConstIterator (& insert_layer (end_layers (), lpn)));
|
||||
commit ();
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
LayoutView::set_current_layer (const lay::LayerPropertiesConstIterator &l)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -179,14 +179,6 @@ public:
|
|||
*/
|
||||
virtual void create_plugins (const lay::PluginDeclaration *except_this = 0);
|
||||
|
||||
/**
|
||||
* @brief Sets the currently active layer by layer properties and cell view index
|
||||
*
|
||||
* If the layer does not exist, the user will be asked whether to create the layer.
|
||||
* Returns false if the layer is not a valid one and the user defined to create the layer.
|
||||
*/
|
||||
bool set_or_request_current_layer (unsigned int cv_index, const db::LayerProperties &properties);
|
||||
|
||||
/**
|
||||
* @brief Sets the currently active layer by layer properties and cell view index
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue