mirror of https://github.com/KLayout/klayout.git
WIP
This commit is contained in:
parent
9b7a237a79
commit
8cbb49d5f9
|
|
@ -206,11 +206,8 @@ END_PROTECTED
|
|||
void
|
||||
InstPropertiesPage::show_props ()
|
||||
{
|
||||
lay::LayoutView *lv = dynamic_cast<lay::LayoutView *> (mp_service->view ());
|
||||
tl_assert (lv != 0);
|
||||
|
||||
lay::UserPropertiesForm props_form (this);
|
||||
if (props_form.show (lv, m_selection_ptrs [m_index]->cv_index (), m_prop_id)) {
|
||||
if (props_form.show (mp_service->view ()->ui (), m_selection_ptrs [m_index]->cv_index (), m_prop_id)) {
|
||||
emit edited ();
|
||||
}
|
||||
}
|
||||
|
|
@ -384,27 +381,21 @@ InstPropertiesPage::update ()
|
|||
void
|
||||
InstPropertiesPage::show_cell ()
|
||||
{
|
||||
lay::LayoutView *lv = dynamic_cast<lay::LayoutView *> (mp_service->view ());
|
||||
tl_assert (lv != 0);
|
||||
|
||||
edt::Service::obj_iterator pos = m_selection_ptrs [m_index];
|
||||
|
||||
lay::CellView::unspecific_cell_path_type path (lv->cellview (pos->cv_index ()).combined_unspecific_path ());
|
||||
lay::CellView::unspecific_cell_path_type path (mp_service->view ()->cellview (pos->cv_index ()).combined_unspecific_path ());
|
||||
for (lay::ObjectInstPath::iterator p = pos->begin (); p != pos->end (); ++p) {
|
||||
path.push_back (p->inst_ptr.cell_index ());
|
||||
}
|
||||
|
||||
lv->set_current_cell_path (pos->cv_index (), path);
|
||||
mp_service->view ()->set_current_cell_path (pos->cv_index (), path);
|
||||
}
|
||||
|
||||
void
|
||||
InstPropertiesPage::show_inst ()
|
||||
{
|
||||
lay::LayoutView *lv = dynamic_cast<lay::LayoutView *> (mp_service->view ());
|
||||
tl_assert (lv != 0);
|
||||
|
||||
InstantiationForm inst_form (this);
|
||||
inst_form.show (lv, *m_selection_ptrs [m_index]);
|
||||
inst_form.show (mp_service->view ()->ui (), *m_selection_ptrs [m_index]);
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
@ -852,9 +843,6 @@ InstPropertiesPage::apply_to_all (bool relative)
|
|||
void
|
||||
InstPropertiesPage::update_pcell_parameters ()
|
||||
{
|
||||
lay::LayoutView *lv = dynamic_cast<lay::LayoutView *> (mp_service->view ());
|
||||
tl_assert (lv != 0);
|
||||
|
||||
db::Layout *layout;
|
||||
|
||||
// find the layout the cell has to be looked up: that is either the layout of the current instance or
|
||||
|
|
@ -866,7 +854,7 @@ InstPropertiesPage::update_pcell_parameters ()
|
|||
} else {
|
||||
|
||||
edt::Service::obj_iterator pos = m_selection_ptrs [m_index];
|
||||
const lay::CellView &cv = lv->cellview (pos->cv_index ());
|
||||
const lay::CellView &cv = mp_service->view ()->cellview (pos->cv_index ());
|
||||
layout = &cv->layout ();
|
||||
|
||||
}
|
||||
|
|
@ -890,7 +878,7 @@ InstPropertiesPage::update_pcell_parameters ()
|
|||
std::vector<tl::Variant> parameters;
|
||||
|
||||
edt::Service::obj_iterator pos = m_selection_ptrs [m_index];
|
||||
const lay::CellView &cv = lv->cellview (pos->cv_index ());
|
||||
const lay::CellView &cv = mp_service->view ()->cellview (pos->cv_index ());
|
||||
db::Cell &cell = cv->layout ().cell (pos->cell_index ());
|
||||
std::pair<bool, db::pcell_id_type> pci = cell.is_pcell_instance (pos->back ().inst_ptr);
|
||||
const db::Library *pci_lib = cv->layout ().defining_library (pos->back ().inst_ptr.cell_index ()).first;
|
||||
|
|
@ -924,7 +912,7 @@ InstPropertiesPage::update_pcell_parameters ()
|
|||
|
||||
mp_pcell_parameters = new PCellParametersPage (pcell_tab);
|
||||
connect (mp_pcell_parameters, SIGNAL (edited ()), this, SIGNAL (edited ()));
|
||||
mp_pcell_parameters->setup (lv, pos->cv_index (), layout->pcell_declaration (pc.second), parameters);
|
||||
mp_pcell_parameters->setup (mp_service->view ()->ui (), pos->cv_index (), layout->pcell_declaration (pc.second), parameters);
|
||||
pcell_tab->layout ()->addWidget (mp_pcell_parameters);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -181,12 +181,9 @@ public:
|
|||
|
||||
virtual void get_editor_options_pages (std::vector<lay::EditorOptionsPage *> &pages, lay::LayoutViewBase *view, lay::Dispatcher *root) const
|
||||
{
|
||||
lay::LayoutView *lv = dynamic_cast<lay::LayoutView *> (view);
|
||||
tl_assert (lv != 0);
|
||||
|
||||
if (mp_pages_f != 0) {
|
||||
size_t nstart = pages.size ();
|
||||
(*mp_pages_f) (pages, lv, root);
|
||||
(*mp_pages_f) (pages, view->ui (), root);
|
||||
while (nstart < pages.size ()) {
|
||||
pages [nstart++]->set_plugin_declaration (this);
|
||||
}
|
||||
|
|
@ -332,11 +329,8 @@ public:
|
|||
|
||||
virtual void get_editor_options_pages (std::vector<lay::EditorOptionsPage *> &pages, lay::LayoutViewBase *view, lay::Dispatcher *dispatcher) const
|
||||
{
|
||||
lay::LayoutView *lv = dynamic_cast<lay::LayoutView *> (view);
|
||||
tl_assert (lv != 0);
|
||||
|
||||
// NOTE: we do not set plugin_declaration which makes the page unspecific
|
||||
EditorOptionsGeneric *generic_opt = new EditorOptionsGeneric (lv, dispatcher);
|
||||
EditorOptionsGeneric *generic_opt = new EditorOptionsGeneric (view->ui (), dispatcher);
|
||||
pages.push_back (generic_opt);
|
||||
}
|
||||
|
||||
|
|
@ -421,12 +415,7 @@ static tl::RegisteredClass<lay::PluginDeclaration> config_decl_main (new edt::Ma
|
|||
void
|
||||
commit_recent (lay::LayoutViewBase *view)
|
||||
{
|
||||
lay::LayoutView *lv = dynamic_cast<lay::LayoutView *> (view);
|
||||
if (!lv) {
|
||||
return;
|
||||
}
|
||||
|
||||
lay::EditorOptionsPages *eo_pages = lv->editor_options_pages ();
|
||||
lay::EditorOptionsPages *eo_pages = view->ui ()->editor_options_pages ();
|
||||
if (!eo_pages) {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -360,21 +360,15 @@ ShapePropertiesPage::update_shape ()
|
|||
void
|
||||
ShapePropertiesPage::show_inst ()
|
||||
{
|
||||
lay::LayoutView *lv = dynamic_cast<lay::LayoutView *> (mp_service->view ());
|
||||
tl_assert (lv != 0);
|
||||
|
||||
InstantiationForm inst_form (this);
|
||||
inst_form.show (lv, *m_selection_ptrs [m_index]);
|
||||
inst_form.show (mp_service->view ()->ui (), *m_selection_ptrs [m_index]);
|
||||
}
|
||||
|
||||
void
|
||||
ShapePropertiesPage::show_props ()
|
||||
{
|
||||
lay::LayoutView *lv = dynamic_cast<lay::LayoutView *> (mp_service->view ());
|
||||
tl_assert (lv != 0);
|
||||
|
||||
lay::UserPropertiesForm props_form (this);
|
||||
if (props_form.show (lv, m_selection_ptrs [m_index]->cv_index (), m_prop_id)) {
|
||||
if (props_form.show (mp_service->view ()->ui (), m_selection_ptrs [m_index]->cv_index (), m_prop_id)) {
|
||||
emit edited ();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -316,12 +316,7 @@ FillDialog::get_fill_parameters ()
|
|||
} else if (layer_spec_cbx->currentIndex () == 2) {
|
||||
|
||||
// get selected layers
|
||||
std::vector<lay::LayerPropertiesConstIterator> s;
|
||||
|
||||
lay::LayoutView *lv = dynamic_cast<lay::LayoutView *> (mp_view);
|
||||
if (lv) {
|
||||
s = lv->selected_layers (); // @@@ should be part of LayoutViewBase too
|
||||
}
|
||||
std::vector<lay::LayerPropertiesConstIterator> s = mp_view->selected_layers ();
|
||||
|
||||
for (std::vector<lay::LayerPropertiesConstIterator>::const_iterator l = s.begin (); l != s.end (); ++l) {
|
||||
if (! (*l)->has_children () && cv->layout ().is_valid_layer ((*l)->layer_index ())) {
|
||||
|
|
|
|||
|
|
@ -65,9 +65,7 @@ public:
|
|||
|
||||
virtual lay::Plugin *create_plugin (db::Manager *, lay::Dispatcher *root, lay::LayoutViewBase *view) const
|
||||
{
|
||||
lay::LayoutView *lv = dynamic_cast<lay::LayoutView *> (view);
|
||||
tl_assert (lv != 0);
|
||||
return new SearchReplaceDialog (root, lv);
|
||||
return new SearchReplaceDialog (root, view->ui ());
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -349,12 +349,9 @@ void
|
|||
BrowseInstancesForm::choose_cell_pressed ()
|
||||
{
|
||||
BEGIN_PROTECTED
|
||||
lay::LayoutView *lv = dynamic_cast<lay::LayoutView *> (view ());
|
||||
if (lv) {
|
||||
CellSelectionForm form (this, lv, "browse_cell", true /*simple mode*/);
|
||||
if (form.exec ()) {
|
||||
change_cell (form.selected_cellview ().cell_index (), form.selected_cellview_index ());
|
||||
}
|
||||
CellSelectionForm form (this, view ()->ui (), "browse_cell", true /*simple mode*/);
|
||||
if (form.exec ()) {
|
||||
change_cell (form.selected_cellview ().cell_index (), form.selected_cellview_index ());
|
||||
}
|
||||
END_PROTECTED
|
||||
}
|
||||
|
|
@ -525,21 +522,18 @@ struct BrowseInstancesCellInfo
|
|||
void
|
||||
BrowseInstancesForm::activated ()
|
||||
{
|
||||
lay::LayoutView *lv = dynamic_cast<lay::LayoutView *> (view ());
|
||||
tl_assert (lv != 0);
|
||||
|
||||
lv->save_view (m_display_state);
|
||||
view ()->save_view (m_display_state);
|
||||
|
||||
// if no cellviews are available, don't do anything
|
||||
if (! lv->cellviews ()) {
|
||||
if (! view ()->cellviews ()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// obtain active cellview index and cell index
|
||||
int cv_index = lv->active_cellview_index ();
|
||||
int cv_index = view ()->active_cellview_index ();
|
||||
|
||||
lay::LayoutView::cell_path_type path;
|
||||
lv->current_cell_path (path);
|
||||
view ()->current_cell_path (path);
|
||||
|
||||
// no cell to index
|
||||
if (path.empty ()) {
|
||||
|
|
|
|||
|
|
@ -660,12 +660,9 @@ BrowseShapesForm::cell_inst_changed (QTreeWidgetItem *, QTreeWidgetItem *)
|
|||
void
|
||||
BrowseShapesForm::activated ()
|
||||
{
|
||||
lay::LayoutView *lv = dynamic_cast<lay::LayoutView *> (view ());
|
||||
tl_assert (lv != 0);
|
||||
view ()->save_view (m_display_state);
|
||||
|
||||
lv->save_view (m_display_state);
|
||||
|
||||
std::vector <lay::LayerPropertiesConstIterator> sel_layers = lv->selected_layers ();
|
||||
std::vector <lay::LayerPropertiesConstIterator> sel_layers = view ()->selected_layers ();
|
||||
|
||||
if (sel_layers.empty ()) {
|
||||
throw tl::Exception (tl::to_string (QObject::tr ("No layer selected")));
|
||||
|
|
@ -691,7 +688,7 @@ BrowseShapesForm::activated ()
|
|||
}
|
||||
} else {
|
||||
m_cv_index = cv_index;
|
||||
m_cellview = lv->cellview (m_cv_index);
|
||||
m_cellview = view ()->cellview (m_cv_index);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -444,39 +444,12 @@ void
|
|||
LayerControlPanel::cm_remove_unused ()
|
||||
{
|
||||
BEGIN_PROTECTED_CLEANUP
|
||||
|
||||
begin_updates ();
|
||||
|
||||
transaction (tl::to_string (QObject::tr ("Clean up views")));
|
||||
|
||||
bool any_deleted;
|
||||
do {
|
||||
|
||||
std::vector <lay::LayerPropertiesConstIterator> sel;
|
||||
|
||||
lay::LayerPropertiesConstIterator l = mp_view->begin_layers ();
|
||||
while (! l.at_end ()) {
|
||||
if (! l->has_children () && l->bbox ().empty ()) {
|
||||
sel.push_back (l);
|
||||
}
|
||||
++l;
|
||||
}
|
||||
|
||||
std::sort (sel.begin (), sel.end (), CompareLayerIteratorBottomUp ());
|
||||
any_deleted = false;
|
||||
for (std::vector<lay::LayerPropertiesConstIterator>::iterator s = sel.begin (); s != sel.end (); ++s) {
|
||||
mp_view->delete_layer (*s);
|
||||
any_deleted = true;
|
||||
}
|
||||
|
||||
} while (any_deleted);
|
||||
|
||||
mp_view->remove_unused_layers ();
|
||||
commit ();
|
||||
|
||||
end_updates ();
|
||||
|
||||
emit order_changed ();
|
||||
|
||||
END_PROTECTED_CLEANUP { recover (); }
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -656,30 +656,6 @@ LayoutView::set_selected_layers (const std::vector<lay::LayerPropertiesConstIter
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
LayoutView::ensure_layer_selected ()
|
||||
{
|
||||
if (! mp_control_panel->has_selection ()) {
|
||||
const lay::LayerPropertiesList &lp = get_properties ();
|
||||
lay::LayerPropertiesConstIterator li = lp.begin_const_recursive ();
|
||||
while (! li.at_end () && li->has_children ()) {
|
||||
++li;
|
||||
}
|
||||
if (! li.at_end ()) {
|
||||
mp_control_panel->set_current_layer (li);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
LayoutView::remove_unused_layers ()
|
||||
{
|
||||
// @@@ should not be in control panel
|
||||
if (mp_control_panel) {
|
||||
mp_control_panel->cm_remove_unused ();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
LayoutView::begin_layer_updates ()
|
||||
{
|
||||
|
|
@ -688,6 +664,14 @@ LayoutView::begin_layer_updates ()
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
LayoutView::end_layer_updates ()
|
||||
{
|
||||
if (mp_control_panel) {
|
||||
mp_control_panel->end_updates ();
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
LayoutView::layer_model_updated ()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -273,11 +273,6 @@ public:
|
|||
*/
|
||||
virtual void set_current_cell_path (int cv_index, const cell_path_type &path);
|
||||
|
||||
/**
|
||||
* @brief Remove unused layers
|
||||
*/
|
||||
void remove_unused_layers ();
|
||||
|
||||
/**
|
||||
* @brief Internal method: check, if the layer tree is and an consistent state.
|
||||
*
|
||||
|
|
@ -416,6 +411,16 @@ public:
|
|||
return mp_editor_options_frame;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Gets the QWidget interface
|
||||
*/
|
||||
virtual QWidget *widget () { return this; }
|
||||
|
||||
/**
|
||||
* @brief Gets the LayoutView interface
|
||||
*/
|
||||
virtual LayoutView *ui () { return this; }
|
||||
|
||||
/**
|
||||
* @brief Copies to clipboard
|
||||
*
|
||||
|
|
@ -740,7 +745,7 @@ protected:
|
|||
virtual void do_set_background_color (lay::Color color, lay::Color contrast);
|
||||
virtual void do_paste ();
|
||||
virtual void begin_layer_updates ();
|
||||
virtual void ensure_layer_selected ();
|
||||
virtual void end_layer_updates ();
|
||||
virtual void update_content_for_cv (int cv_index);
|
||||
virtual void do_set_no_stipples (bool no_stipples);
|
||||
virtual void do_set_phase (int phase);
|
||||
|
|
@ -755,8 +760,6 @@ protected:
|
|||
virtual void emit_title_changed ();
|
||||
virtual void emit_dirty_changed ();
|
||||
virtual void emit_layer_order_changed ();
|
||||
|
||||
virtual QWidget *widget () { return this; }
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1336,6 +1336,8 @@ LayoutViewBase::insert_layer_list (unsigned index, const LayerPropertiesList &pr
|
|||
manager ()->clear ();
|
||||
}
|
||||
|
||||
clear_layer_selection ();
|
||||
|
||||
m_layer_properties_lists.insert (m_layer_properties_lists.begin () + index, new LayerPropertiesList (props));
|
||||
m_layer_properties_lists [index]->attach_view (this, index);
|
||||
merge_dither_pattern (*m_layer_properties_lists [index]);
|
||||
|
|
@ -1363,6 +1365,8 @@ LayoutViewBase::delete_layer_list (unsigned index)
|
|||
manager ()->clear ();
|
||||
}
|
||||
|
||||
clear_layer_selection ();
|
||||
|
||||
delete m_layer_properties_lists [index];
|
||||
m_layer_properties_lists.erase (m_layer_properties_lists.begin () + index);
|
||||
|
||||
|
|
@ -1425,20 +1429,44 @@ LayoutViewBase::set_current_layer (unsigned int cv_index, const db::LayerPropert
|
|||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
LayoutViewBase::clear_layer_selection ()
|
||||
{
|
||||
m_current_layer = lay::LayerPropertiesConstIterator ();
|
||||
m_selected_layers.clear ();
|
||||
}
|
||||
|
||||
void
|
||||
LayoutViewBase::set_current_layer (const lay::LayerPropertiesConstIterator &l)
|
||||
{
|
||||
// @@@ No checking happens
|
||||
m_current_layer = l;
|
||||
m_selected_layers.clear ();
|
||||
m_selected_layers.push_back (l);
|
||||
}
|
||||
|
||||
lay::LayerPropertiesConstIterator
|
||||
LayoutViewBase::current_layer () const
|
||||
{
|
||||
// @@@ No checking happens
|
||||
return m_current_layer;
|
||||
}
|
||||
|
||||
std::vector<lay::LayerPropertiesConstIterator>
|
||||
LayoutViewBase::selected_layers () const
|
||||
{
|
||||
return m_selected_layers;
|
||||
}
|
||||
|
||||
void
|
||||
LayoutViewBase::set_selected_layers (const std::vector<lay::LayerPropertiesConstIterator> &sel)
|
||||
{
|
||||
m_selected_layers = sel;
|
||||
if (sel.empty ()) {
|
||||
m_current_layer = lay::LayerPropertiesConstIterator ();
|
||||
} else {
|
||||
m_current_layer = sel.front ();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
LayoutViewBase::merge_dither_pattern (lay::LayerPropertiesList &props)
|
||||
{
|
||||
|
|
@ -1544,13 +1572,10 @@ LayoutViewBase::set_properties (unsigned int index, const LayerPropertiesList &p
|
|||
merge_dither_pattern (*m_layer_properties_lists [index]);
|
||||
|
||||
if (index == current_layer_list ()) {
|
||||
|
||||
end_layer_updates ();
|
||||
layer_list_changed_event (3);
|
||||
|
||||
redraw ();
|
||||
|
||||
m_prop_changed = true;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1607,14 +1632,11 @@ LayoutViewBase::replace_layer_node (unsigned int index, const LayerPropertiesCon
|
|||
non_const_iter->attach_view (this, index);
|
||||
|
||||
if (index == current_layer_list ()) {
|
||||
|
||||
end_layer_updates ();
|
||||
layer_list_changed_event (2);
|
||||
|
||||
// TODO: check, if redraw is actually necessary (this is complex!)
|
||||
redraw ();
|
||||
|
||||
m_prop_changed = true;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1681,6 +1703,7 @@ LayoutViewBase::insert_layer (unsigned int index, const LayerPropertiesConstIter
|
|||
|
||||
// signal to the observers that something has changed
|
||||
if (index == current_layer_list ()) {
|
||||
end_layer_updates ();
|
||||
layer_list_changed_event (2);
|
||||
redraw ();
|
||||
m_prop_changed = true;
|
||||
|
|
@ -1713,6 +1736,7 @@ LayoutViewBase::delete_layer (unsigned int index, LayerPropertiesConstIterator &
|
|||
|
||||
// signal to the observers that something has changed
|
||||
if (index == current_layer_list ()) {
|
||||
end_layer_updates ();
|
||||
layer_list_changed_event (2);
|
||||
redraw ();
|
||||
m_prop_changed = true;
|
||||
|
|
@ -2088,6 +2112,8 @@ LayoutViewBase::erase_cellview (unsigned int index)
|
|||
m_display_states.clear ();
|
||||
m_display_state_ptr = 0;
|
||||
|
||||
end_layer_updates ();
|
||||
|
||||
// signal to the observers that something has changed
|
||||
layer_list_changed_event (3);
|
||||
|
||||
|
|
@ -3178,6 +3204,20 @@ LayoutViewBase::box () const
|
|||
return mp_canvas->viewport ().box ();
|
||||
}
|
||||
|
||||
#if defined(HAVE_QT)
|
||||
QWidget *
|
||||
LayoutViewBase::widget ()
|
||||
{
|
||||
tl_assert (false);
|
||||
}
|
||||
#endif
|
||||
|
||||
LayoutView *
|
||||
LayoutViewBase::ui ()
|
||||
{
|
||||
tl_assert (false);
|
||||
}
|
||||
|
||||
// @@@ needs to be called "as often as possible"
|
||||
void
|
||||
LayoutViewBase::timer ()
|
||||
|
|
@ -4836,6 +4876,34 @@ LayoutViewBase::cut ()
|
|||
lay::Editables::cut ();
|
||||
}
|
||||
|
||||
void
|
||||
LayoutViewBase::remove_unused_layers ()
|
||||
{
|
||||
bool any_deleted;
|
||||
do {
|
||||
|
||||
std::vector <lay::LayerPropertiesConstIterator> sel;
|
||||
|
||||
lay::LayerPropertiesConstIterator l = begin_layers ();
|
||||
while (! l.at_end ()) {
|
||||
if (! l->has_children () && l->bbox ().empty ()) {
|
||||
sel.push_back (l);
|
||||
}
|
||||
++l;
|
||||
}
|
||||
|
||||
std::sort (sel.begin (), sel.end (), CompareLayerIteratorBottomUp ());
|
||||
any_deleted = false;
|
||||
for (std::vector<lay::LayerPropertiesConstIterator>::iterator s = sel.begin (); s != sel.end (); ++s) {
|
||||
delete_layer (*s);
|
||||
any_deleted = true;
|
||||
}
|
||||
|
||||
} while (any_deleted);
|
||||
|
||||
emit_layer_order_changed ();
|
||||
}
|
||||
|
||||
void
|
||||
LayoutViewBase::add_missing_layers ()
|
||||
{
|
||||
|
|
@ -4992,11 +5060,26 @@ LayoutViewBase::begin_layer_updates ()
|
|||
}
|
||||
|
||||
void
|
||||
LayoutViewBase::ensure_layer_selected ()
|
||||
LayoutViewBase::end_layer_updates ()
|
||||
{
|
||||
// .. nothing yet ..
|
||||
}
|
||||
|
||||
void
|
||||
LayoutViewBase::ensure_layer_selected ()
|
||||
{
|
||||
if (current_layer () == lay::LayerPropertiesConstIterator ()) {
|
||||
const lay::LayerPropertiesList &lp = get_properties ();
|
||||
lay::LayerPropertiesConstIterator li = lp.begin_const_recursive ();
|
||||
while (! li.at_end () && li->has_children ()) {
|
||||
++li;
|
||||
}
|
||||
if (! li.at_end ()) {
|
||||
set_current_layer (li);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
LayoutViewBase::do_set_no_stipples (bool /*no_stipples*/)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -70,6 +70,7 @@ namespace db {
|
|||
|
||||
namespace lay {
|
||||
|
||||
class LayoutView;
|
||||
class MouseTracker;
|
||||
class ZoomService;
|
||||
class SelectionService;
|
||||
|
|
@ -551,6 +552,18 @@ public:
|
|||
*/
|
||||
virtual lay::LayerPropertiesConstIterator current_layer () const;
|
||||
|
||||
/**
|
||||
* @brief Return the layers that are selected in the layer browser
|
||||
*
|
||||
* Returns an empty list if no layer is selected.
|
||||
*/
|
||||
virtual std::vector<lay::LayerPropertiesConstIterator> selected_layers () const;
|
||||
|
||||
/**
|
||||
* @brief Sets the layers that are selected in the layer browser
|
||||
*/
|
||||
virtual void set_selected_layers (const std::vector<lay::LayerPropertiesConstIterator> &sel);
|
||||
|
||||
/**
|
||||
* @brief Set the custom dither pattern
|
||||
*/
|
||||
|
|
@ -2168,6 +2181,11 @@ public:
|
|||
*/
|
||||
void add_missing_layers ();
|
||||
|
||||
/**
|
||||
* @brief Remove unused layers
|
||||
*/
|
||||
void remove_unused_layers ();
|
||||
|
||||
/**
|
||||
* @brief Add layers which are not part of the LayerState
|
||||
*/
|
||||
|
|
@ -2484,9 +2502,17 @@ public:
|
|||
virtual void deactivate_all_browsers ();
|
||||
|
||||
#if defined(HAVE_QT)
|
||||
virtual QWidget *widget () { return 0; }
|
||||
/**
|
||||
* @brief Gets the QWidget interface
|
||||
*/
|
||||
virtual QWidget *widget ();
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Gets the LayoutView interface
|
||||
*/
|
||||
virtual LayoutView *ui ();
|
||||
|
||||
private:
|
||||
// event handlers used to connect to the layout object's events
|
||||
void signal_hier_changed ();
|
||||
|
|
@ -2613,6 +2639,7 @@ private:
|
|||
std::set<int> m_active_cellview_changed_events;
|
||||
|
||||
lay::LayerPropertiesConstIterator m_current_layer;
|
||||
std::vector<lay::LayerPropertiesConstIterator> m_selected_layers;
|
||||
|
||||
std::vector<cell_path_type> m_current_cell_per_cellview;
|
||||
|
||||
|
|
@ -2676,7 +2703,8 @@ protected:
|
|||
virtual void do_set_background_color (lay::Color color, lay::Color contrast);
|
||||
virtual void do_paste ();
|
||||
virtual void begin_layer_updates ();
|
||||
virtual void ensure_layer_selected ();
|
||||
virtual void end_layer_updates ();
|
||||
virtual void clear_layer_selection ();
|
||||
virtual void do_set_no_stipples (bool no_stipples);
|
||||
virtual void do_set_phase (int phase);
|
||||
virtual bool is_activated () const;
|
||||
|
|
@ -2684,6 +2712,8 @@ protected:
|
|||
virtual void update_content_for_cv (int cv_index);
|
||||
virtual bool set_hier_levels_basic (std::pair<int, int> l);
|
||||
|
||||
void ensure_layer_selected ();
|
||||
|
||||
void enable_active_cellview_changed_event (bool enable, bool silent = false);
|
||||
void active_cellview_changed (int index);
|
||||
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ validate_cell_path (const db::Layout &layout, lay::LayoutView::cell_path_type &p
|
|||
}
|
||||
|
||||
LayoutViewFunctions::LayoutViewFunctions (db::Manager *manager, LayoutViewBase *view)
|
||||
: lay::Plugin (view), mp_view (dynamic_cast <lay::LayoutView *> (view)), mp_manager (manager)
|
||||
: lay::Plugin (view), mp_view (view->ui ()), mp_manager (manager)
|
||||
{
|
||||
m_del_cell_mode = 0;
|
||||
m_move_to_origin_mode_x = 0;
|
||||
|
|
|
|||
|
|
@ -729,22 +729,19 @@ NetlistBrowserDialog::cv_index_changed (int index)
|
|||
void
|
||||
NetlistBrowserDialog::activated ()
|
||||
{
|
||||
lay::LayoutView *lv = dynamic_cast<lay::LayoutView *> (view ());
|
||||
tl_assert (lv != 0);
|
||||
|
||||
std::string state;
|
||||
lv->config_get (cfg_l2ndb_window_state, state);
|
||||
view ()->config_get (cfg_l2ndb_window_state, state);
|
||||
lay::restore_dialog_state (this, state, false /*don't adjust the section sizes*/);
|
||||
|
||||
// Switch to the active cellview index when no valid one is set.
|
||||
lay::CellView cv = lv->cellview (m_cv_index);
|
||||
lay::CellView cv = view ()->cellview (m_cv_index);
|
||||
if (! cv.is_valid ()) {
|
||||
m_cv_index = lv->active_cellview_index ();
|
||||
m_cv_index = view ()->active_cellview_index ();
|
||||
}
|
||||
|
||||
if (m_l2n_index < 0 && lv->get_l2ndb (0) != 0) {
|
||||
if (m_l2n_index < 0 && view ()->get_l2ndb (0) != 0) {
|
||||
|
||||
m_l2ndb_name = lv->get_l2ndb (0)->name ();
|
||||
m_l2ndb_name = view ()->get_l2ndb (0)->name ();
|
||||
l2ndbs_changed ();
|
||||
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -635,22 +635,19 @@ MarkerBrowserDialog::cv_index_changed (int index)
|
|||
void
|
||||
MarkerBrowserDialog::activated ()
|
||||
{
|
||||
lay::LayoutView *lv = dynamic_cast<lay::LayoutView *> (view ());
|
||||
tl_assert (lv != 0);
|
||||
|
||||
std::string state;
|
||||
lv->config_get (cfg_rdb_window_state, state);
|
||||
view ()->config_get (cfg_rdb_window_state, state);
|
||||
lay::restore_dialog_state (this, state);
|
||||
|
||||
// Switch to the active cellview index when no valid one is set.
|
||||
lay::CellView cv = lv->cellview (m_cv_index);
|
||||
lay::CellView cv = view ()->cellview (m_cv_index);
|
||||
if (! cv.is_valid ()) {
|
||||
m_cv_index = lv->active_cellview_index ();
|
||||
m_cv_index = view ()->active_cellview_index ();
|
||||
}
|
||||
|
||||
if (m_rdb_index < 0 && lv->get_rdb (0) != 0) {
|
||||
if (m_rdb_index < 0 && view ()->get_rdb (0) != 0) {
|
||||
|
||||
m_rdb_name = lv->get_rdb (0)->name ();
|
||||
m_rdb_name = view ()->get_rdb (0)->name ();
|
||||
rdbs_changed ();
|
||||
|
||||
} else {
|
||||
|
|
@ -717,10 +714,7 @@ MarkerBrowserDialog::deactivated ()
|
|||
void
|
||||
MarkerBrowserDialog::scan_layer ()
|
||||
{
|
||||
lay::LayoutView *lv = dynamic_cast<lay::LayoutView *> (view ());
|
||||
tl_assert (lv != 0);
|
||||
|
||||
std::vector<lay::LayerPropertiesConstIterator> layers = lv->selected_layers ();
|
||||
std::vector<lay::LayerPropertiesConstIterator> layers = view ()->selected_layers ();
|
||||
if (layers.empty ()) {
|
||||
throw tl::Exception (tl::to_string (QObject::tr ("No layer selected to get shapes from")));
|
||||
}
|
||||
|
|
@ -812,16 +806,13 @@ MarkerBrowserDialog::scan_layer ()
|
|||
}
|
||||
|
||||
unsigned int rdb_index = view ()->add_rdb (rdb.release ());
|
||||
lv->open_rdb_browser (rdb_index, cv_index);
|
||||
view ()->ui ()->open_rdb_browser (rdb_index, cv_index);
|
||||
}
|
||||
|
||||
void
|
||||
MarkerBrowserDialog::scan_layer_flat ()
|
||||
{
|
||||
lay::LayoutView *lv = dynamic_cast<lay::LayoutView *> (view ());
|
||||
tl_assert (lv != 0);
|
||||
|
||||
std::vector<lay::LayerPropertiesConstIterator> layers = lv->selected_layers ();
|
||||
std::vector<lay::LayerPropertiesConstIterator> layers = view ()->selected_layers ();
|
||||
if (layers.empty ()) {
|
||||
throw tl::Exception (tl::to_string (QObject::tr ("No layer selected to get shapes from")));
|
||||
}
|
||||
|
|
@ -891,7 +882,7 @@ MarkerBrowserDialog::scan_layer_flat ()
|
|||
}
|
||||
|
||||
unsigned int rdb_index = view ()->add_rdb (rdb.release ());
|
||||
lv->open_rdb_browser (rdb_index, cv_index);
|
||||
view ()->ui ()->open_rdb_browser (rdb_index, cv_index);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -496,9 +496,7 @@ public:
|
|||
|
||||
lay::Plugin *create_plugin (db::Manager *, lay::Dispatcher *root, lay::LayoutViewBase *view) const
|
||||
{
|
||||
lay::LayoutView *lv = dynamic_cast<lay::LayoutView *> (view);
|
||||
tl_assert (lv != 0);
|
||||
return new BooleanOperationsPlugin (root, lv);
|
||||
return new BooleanOperationsPlugin (root, view->ui ());
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -105,9 +105,7 @@ public:
|
|||
|
||||
lay::Plugin *create_plugin (db::Manager *, lay::Dispatcher *root, lay::LayoutViewBase *view) const
|
||||
{
|
||||
lay::LayoutView *lv = dynamic_cast<lay::LayoutView *> (view);
|
||||
tl_assert (lv != 0);
|
||||
return new DiffPlugin (root, lv);
|
||||
return new DiffPlugin (root, view->ui ());
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -78,9 +78,7 @@ public:
|
|||
|
||||
virtual lay::Plugin *create_plugin (db::Manager * /*manager*/, lay::Dispatcher *root, lay::LayoutViewBase *view) const
|
||||
{
|
||||
lay::LayoutView *lv = dynamic_cast<lay::LayoutView *> (view);
|
||||
tl_assert (lv != 0);
|
||||
return new NetTracerDialog (root, lv);
|
||||
return new NetTracerDialog (root, view->ui ());
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -113,9 +113,7 @@ public:
|
|||
|
||||
lay::Plugin *create_plugin (db::Manager *, lay::Dispatcher *root, lay::LayoutViewBase *view) const
|
||||
{
|
||||
lay::LayoutView *lv = dynamic_cast<lay::LayoutView *> (view);
|
||||
tl_assert (lv != 0);
|
||||
return new XORPlugin (root, lv);
|
||||
return new XORPlugin (root, view->ui ());
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue