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 <QVBoxLayout>
|
||||||
#include <QHeaderView>
|
#include <QHeaderView>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
|
#include <QMessageBox>
|
||||||
|
|
||||||
namespace edt
|
namespace edt
|
||||||
{
|
{
|
||||||
|
|
@ -346,6 +347,40 @@ RecentConfigurationPage::update_list (const std::list<std::vector<std::string> >
|
||||||
mp_tree_widget->header ()->resizeSections (QHeaderView::ResizeToContents);
|
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
|
void
|
||||||
RecentConfigurationPage::item_clicked (QTreeWidgetItem *item)
|
RecentConfigurationPage::item_clicked (QTreeWidgetItem *item)
|
||||||
{
|
{
|
||||||
|
|
@ -365,7 +400,7 @@ RecentConfigurationPage::item_clicked (QTreeWidgetItem *item)
|
||||||
ex.read (cv_index);
|
ex.read (cv_index);
|
||||||
}
|
}
|
||||||
|
|
||||||
view ()->set_or_request_current_layer (cv_index, lp);
|
set_or_request_current_layer (view (), cv_index, lp);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
dispatcher ()->config_set (c->cfg_name, v);
|
dispatcher ()->config_set (c->cfg_name, v);
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,6 @@
|
||||||
#include <QImageWriter>
|
#include <QImageWriter>
|
||||||
#include <QInputDialog>
|
#include <QInputDialog>
|
||||||
#include <QKeyEvent>
|
#include <QKeyEvent>
|
||||||
#include <QMessageBox>
|
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
|
|
||||||
|
|
@ -608,40 +607,6 @@ LayoutView::config_finalize ()
|
||||||
dm_setup_editor_option_pages ();
|
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
|
void
|
||||||
LayoutView::set_current_layer (const lay::LayerPropertiesConstIterator &l)
|
LayoutView::set_current_layer (const lay::LayerPropertiesConstIterator &l)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -179,14 +179,6 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual void create_plugins (const lay::PluginDeclaration *except_this = 0);
|
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
|
* @brief Sets the currently active layer by layer properties and cell view index
|
||||||
*
|
*
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue