diff --git a/src/ant/ant/antPlugin.cc b/src/ant/ant/antPlugin.cc index 330442a94..10f8643b2 100644 --- a/src/ant/ant/antPlugin.cc +++ b/src/ant/ant/antPlugin.cc @@ -91,7 +91,7 @@ PluginDeclaration::get_menu_entries (std::vector &menu_entries) } lay::Plugin * -PluginDeclaration::create_plugin (db::Manager *manager, lay::Dispatcher *, lay::LayoutView *view) const +PluginDeclaration::create_plugin (db::Manager *manager, lay::Dispatcher *, lay::LayoutViewBase *view) const { return new ant::Service (manager, view); } diff --git a/src/ant/ant/antPlugin.h b/src/ant/ant/antPlugin.h index 6d65c03e6..18950ffac 100644 --- a/src/ant/ant/antPlugin.h +++ b/src/ant/ant/antPlugin.h @@ -40,7 +40,7 @@ public: virtual void get_options (std::vector < std::pair > &options) const; virtual void get_menu_entries (std::vector &menu_entries) const; - virtual lay::Plugin *create_plugin (db::Manager *manager, lay::Dispatcher *, lay::LayoutView *view) const; + virtual lay::Plugin *create_plugin (db::Manager *manager, lay::Dispatcher *, lay::LayoutViewBase *view) const; virtual bool implements_editable (std::string &title) const; virtual bool implements_mouse_mode (std::string &title) const; virtual bool configure (const std::string &name, const std::string &value); diff --git a/src/ant/ant/antService.cc b/src/ant/ant/antService.cc index 5c6db1ec2..761b8e059 100644 --- a/src/ant/ant/antService.cc +++ b/src/ant/ant/antService.cc @@ -784,7 +784,7 @@ View::render (const lay::Viewport &vp, lay::ViewObjectCanvas &canvas) // ------------------------------------------------------------- // ant::Service implementation -Service::Service (db::Manager *manager, lay::LayoutView *view) +Service::Service (db::Manager *manager, lay::LayoutViewBase *view) : lay::EditorServiceBase (view), lay::Drawing (1/*number of planes*/, view->drawings ()), db::Object (manager), diff --git a/src/ant/ant/antService.h b/src/ant/ant/antService.h index 9b53cbe03..9aeee7458 100644 --- a/src/ant/ant/antService.h +++ b/src/ant/ant/antService.h @@ -41,7 +41,7 @@ namespace ant { -class LayoutView; +class LayoutViewBase; class LayoutCanvas; class Service; @@ -201,7 +201,7 @@ public: */ enum MoveMode { MoveNone, MoveP1, MoveP2, MoveP12, MoveP21, MoveP1X, MoveP2X, MoveP1Y, MoveP2Y, MoveRuler, MoveSelected }; - Service (db::Manager *manager, lay::LayoutView *view); + Service (db::Manager *manager, lay::LayoutViewBase *view); ~Service (); @@ -427,7 +427,7 @@ public: /** * @brief Access to the view object */ - lay::LayoutView *view () const + lay::LayoutViewBase *view () const { return mp_view; } @@ -510,7 +510,7 @@ private: int m_max_number_of_rulers; // The layout view that the ruler service is attached to - lay::LayoutView *mp_view; + lay::LayoutViewBase *mp_view; // The ruler view objects representing the selection // and the moved rules in move mode diff --git a/src/ant/ant/gsiDeclAnt.cc b/src/ant/ant/gsiDeclAnt.cc index ee928abc6..f7391f5cd 100644 --- a/src/ant/ant/gsiDeclAnt.cc +++ b/src/ant/ant/gsiDeclAnt.cc @@ -72,8 +72,8 @@ static int align_up () { return int (ant::Object::AL_up); } static void clear_annotations (lay::LayoutView *view); static void insert_annotation (lay::LayoutView *view, AnnotationRef *obj); -static void erase_annotation (lay::LayoutView *view, int id); -static void replace_annotation (lay::LayoutView *view, int id, const AnnotationRef &obj); +static void erase_annotation_base (lay::LayoutViewBase *view, int id); +static void replace_annotation_base (lay::LayoutViewBase *view, int id, const AnnotationRef &obj); /** * @brief An extension of the ant::Object that provides "live" updates of the view @@ -88,7 +88,7 @@ public: // .. nothing yet .. } - AnnotationRef (const ant::Object &other, lay::LayoutView *view) + AnnotationRef (const ant::Object &other, lay::LayoutViewBase *view) : ant::Object (other), mp_view (view) { // .. nothing yet .. @@ -132,7 +132,7 @@ public: void erase () { if (mp_view && id () >= 0) { - erase_annotation (mp_view.get (), id ()); + erase_annotation_base (mp_view.get (), id ()); detach (); } } @@ -140,10 +140,10 @@ public: template AnnotationRef transformed (const T &t) const { - return AnnotationRef (ant::Object::transformed (t), const_cast (mp_view.get ())); + return AnnotationRef (ant::Object::transformed (t), const_cast (mp_view.get ())); } - void set_view (lay::LayoutView *view) + void set_view (lay::LayoutViewBase *view) { mp_view.reset (view); } @@ -152,12 +152,12 @@ protected: void property_changed () { if (mp_view && id () >= 0) { - replace_annotation (mp_view.get (), id (), *this); + replace_annotation_base (mp_view.get (), id (), *this); } } private: - tl::weak_ptr mp_view; + tl::weak_ptr mp_view; }; static void clear_annotations (lay::LayoutView *view) @@ -182,7 +182,7 @@ static void insert_annotation (lay::LayoutView *view, AnnotationRef *obj) } } -static void erase_annotation (lay::LayoutView *view, int id) +static void erase_annotation_base (lay::LayoutViewBase *view, int id) { ant::Service *ant_service = view->get_plugin (); if (ant_service) { @@ -195,7 +195,12 @@ static void erase_annotation (lay::LayoutView *view, int id) } } -static void replace_annotation (lay::LayoutView *view, int id, const AnnotationRef &obj) +static void erase_annotation (lay::LayoutView *view, int id) +{ + erase_annotation_base (view, id); +} + +static void replace_annotation_base (lay::LayoutViewBase *view, int id, const AnnotationRef &obj) { ant::Service *ant_service = view->get_plugin (); if (ant_service) { @@ -208,6 +213,11 @@ static void replace_annotation (lay::LayoutView *view, int id, const AnnotationR } } +static void replace_annotation (lay::LayoutView *view, int id, const AnnotationRef &obj) +{ + replace_annotation_base (view, id, obj); +} + static AnnotationRef create_measure_ruler (lay::LayoutView *view, const db::DPoint &pt, int angle_constraint) { std::vector ant_services = view->get_plugins (); diff --git a/src/edt/edt/edtDialogs.cc b/src/edt/edt/edtDialogs.cc index 55fd4a0a2..3cd05ea3f 100644 --- a/src/edt/edt/edtDialogs.cc +++ b/src/edt/edt/edtDialogs.cc @@ -280,7 +280,7 @@ AlignOptionsDialog::~AlignOptionsDialog () } bool -AlignOptionsDialog::exec_dialog (lay::LayoutView * /*view*/, int &hmode, int &vmode, bool &visible_layers) +AlignOptionsDialog::exec_dialog (int &hmode, int &vmode, bool &visible_layers) { QRadioButton *hmode_buttons [] = { this->h_none_rb, this->h_left_rb, this->h_center_rb, this->h_right_rb }; QRadioButton *vmode_buttons [] = { this->v_none_rb, this->v_top_rb, this->v_center_rb, this->v_bottom_rb }; @@ -343,7 +343,7 @@ DistributeOptionsDialog::~DistributeOptionsDialog () } bool -DistributeOptionsDialog::exec_dialog (lay::LayoutView * /*view*/, bool &hdistribute, int &hmode, double &hpitch, double &hspace, bool &vdistribute, int &vmode, double &vpitch, double &vspace, bool &visible_layers) +DistributeOptionsDialog::exec_dialog (bool &hdistribute, int &hmode, double &hpitch, double &hspace, bool &vdistribute, int &vmode, double &vpitch, double &vspace, bool &visible_layers) { QRadioButton *hmode_buttons [] = { this->h_none_rb, this->h_left_rb, this->h_center_rb, this->h_right_rb }; QRadioButton *vmode_buttons [] = { this->v_none_rb, this->v_top_rb, this->v_center_rb, this->v_bottom_rb }; diff --git a/src/edt/edt/edtDialogs.h b/src/edt/edt/edtDialogs.h index 30444311a..f700e01d4 100644 --- a/src/edt/edt/edtDialogs.h +++ b/src/edt/edt/edtDialogs.h @@ -125,7 +125,7 @@ public: AlignOptionsDialog (QWidget *parent); virtual ~AlignOptionsDialog (); - bool exec_dialog (lay::LayoutView *view, int &hmode, int &vmode, bool &visible_layers); + bool exec_dialog (int &hmode, int &vmode, bool &visible_layers); }; /** @@ -141,7 +141,7 @@ public: DistributeOptionsDialog (QWidget *parent); virtual ~DistributeOptionsDialog (); - bool exec_dialog (lay::LayoutView *view, bool &hdistribute, int &hmode, double &hpitch, double &hspace, bool &vdistribute, int &vmode, double &vpitch, double &vspace, bool &visible_layers); + bool exec_dialog (bool &hdistribute, int &hmode, double &hpitch, double &hspace, bool &vdistribute, int &vmode, double &vpitch, double &vspace, bool &visible_layers); }; /** diff --git a/src/edt/edt/edtInstPropertiesPage.cc b/src/edt/edt/edtInstPropertiesPage.cc index cc18336da..a4fe4ac54 100644 --- a/src/edt/edt/edtInstPropertiesPage.cc +++ b/src/edt/edt/edtInstPropertiesPage.cc @@ -206,8 +206,11 @@ END_PROTECTED void InstPropertiesPage::show_props () { + lay::LayoutView *lv = dynamic_cast (mp_service->view ()); + tl_assert (lv != 0); + lay::UserPropertiesForm props_form (this); - if (props_form.show (mp_service->view (), m_selection_ptrs [m_index]->cv_index (), m_prop_id)) { + if (props_form.show (lv, m_selection_ptrs [m_index]->cv_index (), m_prop_id)) { emit edited (); } } @@ -381,21 +384,27 @@ InstPropertiesPage::update () void InstPropertiesPage::show_cell () { + lay::LayoutView *lv = dynamic_cast (mp_service->view ()); + tl_assert (lv != 0); + edt::Service::obj_iterator pos = m_selection_ptrs [m_index]; - lay::CellView::unspecific_cell_path_type path (mp_service->view ()->cellview (pos->cv_index ()).combined_unspecific_path ()); + lay::CellView::unspecific_cell_path_type path (lv->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 ()); } - mp_service->view ()->set_current_cell_path (pos->cv_index (), path); + lv->set_current_cell_path (pos->cv_index (), path); } void InstPropertiesPage::show_inst () { + lay::LayoutView *lv = dynamic_cast (mp_service->view ()); + tl_assert (lv != 0); + InstantiationForm inst_form (this); - inst_form.show (mp_service->view (), *m_selection_ptrs [m_index]); + inst_form.show (lv, *m_selection_ptrs [m_index]); } bool @@ -843,6 +852,9 @@ InstPropertiesPage::apply_to_all (bool relative) void InstPropertiesPage::update_pcell_parameters () { + lay::LayoutView *lv = dynamic_cast (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 @@ -854,7 +866,7 @@ InstPropertiesPage::update_pcell_parameters () } else { edt::Service::obj_iterator pos = m_selection_ptrs [m_index]; - const lay::CellView &cv = mp_service->view ()->cellview (pos->cv_index ()); + const lay::CellView &cv = lv->cellview (pos->cv_index ()); layout = &cv->layout (); } @@ -878,7 +890,7 @@ InstPropertiesPage::update_pcell_parameters () std::vector parameters; edt::Service::obj_iterator pos = m_selection_ptrs [m_index]; - const lay::CellView &cv = mp_service->view ()->cellview (pos->cv_index ()); + const lay::CellView &cv = lv->cellview (pos->cv_index ()); db::Cell &cell = cv->layout ().cell (pos->cell_index ()); std::pair 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; @@ -912,7 +924,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 (mp_service->view (), pos->cv_index (), layout->pcell_declaration (pc.second), parameters); + mp_pcell_parameters->setup (lv, pos->cv_index (), layout->pcell_declaration (pc.second), parameters); pcell_tab->layout ()->addWidget (mp_pcell_parameters); } diff --git a/src/edt/edt/edtMainService.cc b/src/edt/edt/edtMainService.cc index 837b0c944..30e5ff26c 100644 --- a/src/edt/edt/edtMainService.cc +++ b/src/edt/edt/edtMainService.cc @@ -55,7 +55,7 @@ namespace edt // ----------------------------------------------------------------------------- // Main Service implementation -MainService::MainService (db::Manager *manager, lay::LayoutView *view, lay::Dispatcher *root) +MainService::MainService (db::Manager *manager, lay::LayoutViewBase *view, lay::Dispatcher *root) : lay::Plugin (view), lay::Editable (view), db::Object (manager), @@ -93,7 +93,7 @@ edt::RoundCornerOptionsDialog * MainService::round_corners_dialog () { if (! mp_round_corners_dialog) { - mp_round_corners_dialog = new edt::RoundCornerOptionsDialog (view ()); + mp_round_corners_dialog = new edt::RoundCornerOptionsDialog (view ()->widget ()); } return mp_round_corners_dialog; } @@ -102,7 +102,7 @@ edt::AlignOptionsDialog * MainService::align_options_dialog () { if (! mp_align_options_dialog) { - mp_align_options_dialog = new edt::AlignOptionsDialog (view ()); + mp_align_options_dialog = new edt::AlignOptionsDialog (view ()->widget ()); } return mp_align_options_dialog; } @@ -111,7 +111,7 @@ edt::DistributeOptionsDialog * MainService::distribute_options_dialog () { if (! mp_distribute_options_dialog) { - mp_distribute_options_dialog = new edt::DistributeOptionsDialog (view ()); + mp_distribute_options_dialog = new edt::DistributeOptionsDialog (view ()->widget ()); } return mp_distribute_options_dialog; } @@ -120,7 +120,7 @@ lay::FlattenInstOptionsDialog * MainService::flatten_inst_options_dialog () { if (! mp_flatten_inst_options_dialog) { - mp_flatten_inst_options_dialog = new lay::FlattenInstOptionsDialog (view (), false /*don't allow pruning*/); + mp_flatten_inst_options_dialog = new lay::FlattenInstOptionsDialog (view ()->widget (), false /*don't allow pruning*/); } return mp_flatten_inst_options_dialog; } @@ -129,7 +129,7 @@ edt::MakeCellOptionsDialog * MainService::make_cell_options_dialog () { if (! mp_make_cell_options_dialog) { - mp_make_cell_options_dialog = new edt::MakeCellOptionsDialog (view ()); + mp_make_cell_options_dialog = new edt::MakeCellOptionsDialog (view ()->widget ()); } return mp_make_cell_options_dialog; } @@ -138,7 +138,7 @@ edt::MakeArrayOptionsDialog * MainService::make_array_options_dialog () { if (! mp_make_array_options_dialog) { - mp_make_array_options_dialog = new edt::MakeArrayOptionsDialog (view ()); + mp_make_array_options_dialog = new edt::MakeArrayOptionsDialog (view ()->widget ()); } return mp_make_array_options_dialog; } @@ -1188,9 +1188,10 @@ MainService::cm_convert_to_pcell () } bool ok = false; - QString item = QInputDialog::getItem (view (), QObject::tr ("Select Target PCell"), - QObject::tr ("Select the PCell the shape should be converted into"), - items, 0, false, &ok); + QString item = QInputDialog::getItem (view ()->widget (), + QObject::tr ("Select Target PCell"), + QObject::tr ("Select the PCell the shape should be converted into"), + items, 0, false, &ok); if (! ok) { return; } @@ -1289,7 +1290,7 @@ MainService::cm_convert_to_pcell () } if (any_non_converted) { - QMessageBox::warning (view (), QObject::tr ("Warning"), QObject::tr ("Some of the shapes could not be converted to the desired PCell")); + QMessageBox::warning (view ()->widget (), QObject::tr ("Warning"), QObject::tr ("Some of the shapes could not be converted to the desired PCell")); } manager ()->commit (); @@ -1505,7 +1506,7 @@ MainService::cm_size () } bool ok = false; - QString s = QInputDialog::getText (view (), + QString s = QInputDialog::getText (view ()->widget (), QObject::tr ("Sizing"), QObject::tr ("Sizing (in micron, positive or negative). Two values (dx, dy) for anisotropic sizing."), QLineEdit::Normal, QString::fromUtf8 ("0.0"), @@ -1750,7 +1751,7 @@ db::DVector compute_alignment_vector (const db::DBox &prim_box, const db::DBox & } static db::DBox -inst_bbox (const db::CplxTrans &tr, lay::LayoutView *view, int cv_index, const db::InstElement &inst_element, bool visible_only) +inst_bbox (const db::CplxTrans &tr, lay::LayoutViewBase *view, int cv_index, const db::InstElement &inst_element, bool visible_only) { db::DBox box; @@ -1779,7 +1780,7 @@ MainService::cm_align () std::vector edt_services = view ()->get_plugins (); - if (! align_options_dialog ()->exec_dialog (view (), m_align_hmode, m_align_vmode, m_align_visible_layers)) { + if (! align_options_dialog ()->exec_dialog (m_align_hmode, m_align_vmode, m_align_visible_layers)) { return; } @@ -1865,9 +1866,9 @@ MainService::cm_distribute () std::vector edt_services = view ()->get_plugins (); - if (! distribute_options_dialog ()->exec_dialog (view (), m_hdistribute, m_distribute_hmode, m_distribute_hpitch, m_distribute_hspace, - m_vdistribute, m_distribute_vmode, m_distribute_vpitch, m_distribute_vspace, - m_distribute_visible_layers)) { + if (! distribute_options_dialog ()->exec_dialog (m_hdistribute, m_distribute_hmode, m_distribute_hpitch, m_distribute_hspace, + m_vdistribute, m_distribute_vmode, m_distribute_vpitch, m_distribute_vspace, + m_distribute_visible_layers)) { return; } @@ -2107,7 +2108,7 @@ MainService::cm_tap () // List the layers under the cursor as pop up a menu - std::unique_ptr menu (new QMenu (view ())); + std::unique_ptr menu (new QMenu (view ()->widget ())); menu->show (); int icon_size = menu->style ()->pixelMetric (QStyle::PM_ButtonIconSize); @@ -2294,7 +2295,7 @@ class NewObjectsSelection : public db::ClipboardDataInsertReceiver { public: - NewObjectsSelection (int cv_index, db::cell_index_type topcell, lay::LayoutView *view) + NewObjectsSelection (int cv_index, db::cell_index_type topcell, lay::LayoutViewBase *view) : m_cv_index (cv_index), m_topcell (topcell) { mp_polygon_service = view->get_plugin (); diff --git a/src/edt/edt/edtMainService.h b/src/edt/edt/edtMainService.h index 60c8c4a8f..3ca99c373 100644 --- a/src/edt/edt/edtMainService.h +++ b/src/edt/edt/edtMainService.h @@ -64,7 +64,7 @@ public: /** * @brief The constructor */ - MainService (db::Manager *manager, lay::LayoutView *view, lay::Dispatcher *root); + MainService (db::Manager *manager, lay::LayoutViewBase *view, lay::Dispatcher *root); /** * @brief The destructor @@ -74,7 +74,7 @@ public: /** * @brief Access to the view object */ - lay::LayoutView *view () const + lay::LayoutViewBase *view () const { return mp_view; } @@ -196,7 +196,7 @@ public: private: // The layout view that this service is attached to - lay::LayoutView *mp_view; + lay::LayoutViewBase *mp_view; lay::Dispatcher *mp_root; bool m_needs_update; diff --git a/src/edt/edt/edtPartialService.cc b/src/edt/edt/edtPartialService.cc index a22882651..f43270b35 100644 --- a/src/edt/edt/edtPartialService.cc +++ b/src/edt/edt/edtPartialService.cc @@ -1010,7 +1010,7 @@ PartialShapeFinder::visit_cell (const db::Cell &cell, const db::Box &search_box, // ----------------------------------------------------------------------------- // Main Service implementation -PartialService::PartialService (db::Manager *manager, lay::LayoutView *view, lay::Dispatcher *root) +PartialService::PartialService (db::Manager *manager, lay::LayoutViewBase *view, lay::Dispatcher *root) : QObject (), lay::EditorServiceBase (view), db::Object (manager), diff --git a/src/edt/edt/edtPartialService.h b/src/edt/edt/edtPartialService.h index 0781dcf81..4c7018334 100644 --- a/src/edt/edt/edtPartialService.h +++ b/src/edt/edt/edtPartialService.h @@ -149,7 +149,7 @@ public: /** * @brief The constructor */ - PartialService (db::Manager *manager, lay::LayoutView *view, lay::Dispatcher *root); + PartialService (db::Manager *manager, lay::LayoutViewBase *view, lay::Dispatcher *root); /** * @brief The destructor @@ -159,7 +159,7 @@ public: /** * @brief Access to the view object */ - lay::LayoutView *view () const + lay::LayoutViewBase *view () const { tl_assert (mp_view != 0); return mp_view; @@ -298,7 +298,7 @@ protected: private: // The layout view that this service is attached to - lay::LayoutView *mp_view; + lay::LayoutViewBase *mp_view; lay::Dispatcher *mp_root; bool m_dragging; bool m_keep_selection; diff --git a/src/edt/edt/edtPlugin.cc b/src/edt/edt/edtPlugin.cc index a4a6e3608..518aaa140 100644 --- a/src/edt/edt/edtPlugin.cc +++ b/src/edt/edt/edtPlugin.cc @@ -179,18 +179,21 @@ public: // .. nothing yet .. } - virtual void get_editor_options_pages (std::vector &pages, lay::LayoutView *view, lay::Dispatcher *root) const + virtual void get_editor_options_pages (std::vector &pages, lay::LayoutViewBase *view, lay::Dispatcher *root) const { + lay::LayoutView *lv = dynamic_cast (view); + tl_assert (lv != 0); + if (mp_pages_f != 0) { size_t nstart = pages.size (); - (*mp_pages_f) (pages, view, root); + (*mp_pages_f) (pages, lv, root); while (nstart < pages.size ()) { pages [nstart++]->set_plugin_declaration (this); } } } - virtual lay::Plugin *create_plugin (db::Manager *manager, lay::Dispatcher *, lay::LayoutView *view) const + virtual lay::Plugin *create_plugin (db::Manager *manager, lay::Dispatcher *, lay::LayoutViewBase *view) const { Svc *service = new Svc (manager, view); service->set_plugin_declaration (this); @@ -312,7 +315,7 @@ public: return false; } - virtual lay::Plugin *create_plugin (db::Manager *manager, lay::Dispatcher *root, lay::LayoutView *view) const + virtual lay::Plugin *create_plugin (db::Manager *manager, lay::Dispatcher *root, lay::LayoutViewBase *view) const { return new edt::MainService (manager, view, root); } @@ -327,10 +330,13 @@ public: return false; } - virtual void get_editor_options_pages (std::vector &pages, lay::LayoutView *view, lay::Dispatcher *dispatcher) const + virtual void get_editor_options_pages (std::vector &pages, lay::LayoutViewBase *view, lay::Dispatcher *dispatcher) const { + lay::LayoutView *lv = dynamic_cast (view); + tl_assert (lv != 0); + // NOTE: we do not set plugin_declaration which makes the page unspecific - EditorOptionsGeneric *generic_opt = new EditorOptionsGeneric (view, dispatcher); + EditorOptionsGeneric *generic_opt = new EditorOptionsGeneric (lv, dispatcher); pages.push_back (generic_opt); } @@ -413,9 +419,14 @@ private: static tl::RegisteredClass config_decl_main (new edt::MainPluginDeclaration (tl::to_string (QObject::tr ("Instances and shapes"))), 4000, "edt::MainService"); void -commit_recent (lay::LayoutView *view) +commit_recent (lay::LayoutViewBase *view) { - lay::EditorOptionsPages *eo_pages = view->editor_options_pages ();; + lay::LayoutView *lv = dynamic_cast (view); + if (!lv) { + return; + } + + lay::EditorOptionsPages *eo_pages = lv->editor_options_pages (); if (!eo_pages) { return; } @@ -442,12 +453,12 @@ public: // .. nothing yet .. } - virtual void get_editor_options_pages (std::vector & /*pages*/, lay::LayoutView * /*view*/, lay::Dispatcher * /*root*/) const + virtual void get_editor_options_pages (std::vector & /*pages*/, lay::LayoutViewBase * /*view*/, lay::Dispatcher * /*root*/) const { // .. no specific ones .. } - virtual lay::Plugin *create_plugin (db::Manager *manager, lay::Dispatcher *root, lay::LayoutView *view) const + virtual lay::Plugin *create_plugin (db::Manager *manager, lay::Dispatcher *root, lay::LayoutViewBase *view) const { return new edt::PartialService (manager, view, root); } diff --git a/src/edt/edt/edtPlugin.h b/src/edt/edt/edtPlugin.h index f5a789a3e..1baee02fa 100644 --- a/src/edt/edt/edtPlugin.h +++ b/src/edt/edt/edtPlugin.h @@ -32,6 +32,7 @@ namespace lay { class Dispatcher; class EditorOptionsPage; + class LayoutView; } namespace edt @@ -48,7 +49,7 @@ namespace edt /** * @brief Commits the current configuration for the recently used configuration list */ - void commit_recent (lay::LayoutView *view); + void commit_recent (lay::LayoutViewBase *view); } #endif diff --git a/src/edt/edt/edtPropertiesPages.cc b/src/edt/edt/edtPropertiesPages.cc index 5943d609a..21b3079c9 100644 --- a/src/edt/edt/edtPropertiesPages.cc +++ b/src/edt/edt/edtPropertiesPages.cc @@ -360,15 +360,21 @@ ShapePropertiesPage::update_shape () void ShapePropertiesPage::show_inst () { + lay::LayoutView *lv = dynamic_cast (mp_service->view ()); + tl_assert (lv != 0); + InstantiationForm inst_form (this); - inst_form.show (mp_service->view (), *m_selection_ptrs [m_index]); + inst_form.show (lv, *m_selection_ptrs [m_index]); } void ShapePropertiesPage::show_props () { + lay::LayoutView *lv = dynamic_cast (mp_service->view ()); + tl_assert (lv != 0); + lay::UserPropertiesForm props_form (this); - if (props_form.show (mp_service->view (), m_selection_ptrs [m_index]->cv_index (), m_prop_id)) { + if (props_form.show (lv, m_selection_ptrs [m_index]->cv_index (), m_prop_id)) { emit edited (); } } diff --git a/src/edt/edt/edtService.cc b/src/edt/edt/edtService.cc index 40dbefc39..1f750dad2 100644 --- a/src/edt/edt/edtService.cc +++ b/src/edt/edt/edtService.cc @@ -60,7 +60,7 @@ ac_from_buttons (unsigned int buttons) // ------------------------------------------------------------- -Service::Service (db::Manager *manager, lay::LayoutView *view, db::ShapeIterator::flags_type flags) +Service::Service (db::Manager *manager, lay::LayoutViewBase *view, db::ShapeIterator::flags_type flags) : lay::EditorServiceBase (view), db::Object (manager), mp_view (view), @@ -80,7 +80,7 @@ Service::Service (db::Manager *manager, lay::LayoutView *view, db::ShapeIterator // .. nothing yet .. } -Service::Service (db::Manager *manager, lay::LayoutView *view) +Service::Service (db::Manager *manager, lay::LayoutViewBase *view) : lay::EditorServiceBase (view), db::Object (manager), mp_view (view), @@ -312,7 +312,7 @@ Service::copy () void Service::copy_selected () { - edt::CopyModeDialog mode_dialog (view ()); + edt::CopyModeDialog mode_dialog (view ()->widget ()); bool need_to_ask_for_copy_mode = false; unsigned int inst_mode = 0; diff --git a/src/edt/edt/edtService.h b/src/edt/edt/edtService.h index 2dc67d46a..ea420c4cb 100644 --- a/src/edt/edt/edtService.h +++ b/src/edt/edt/edtService.h @@ -82,12 +82,12 @@ public: /** * @brief The constructor for an service selecting shapes */ - Service (db::Manager *manager, lay::LayoutView *view, db::ShapeIterator::flags_type shape_types); + Service (db::Manager *manager, lay::LayoutViewBase *view, db::ShapeIterator::flags_type shape_types); /** * @brief The constructor for an service selecting instances */ - Service (db::Manager *manager, lay::LayoutView *view); + Service (db::Manager *manager, lay::LayoutViewBase *view); /** * @brief The destructor @@ -243,7 +243,7 @@ public: /** * @brief Access to the view object */ - lay::LayoutView *view () const + lay::LayoutViewBase *view () const { tl_assert (mp_view != 0); return mp_view; @@ -559,7 +559,7 @@ protected: private: // The layout view that the editor service is attached to - lay::LayoutView *mp_view; + lay::LayoutViewBase *mp_view; // The marker objects representing the selection std::vector m_markers; diff --git a/src/edt/edt/edtServiceImpl.cc b/src/edt/edt/edtServiceImpl.cc index b22360339..d4aa7413d 100644 --- a/src/edt/edt/edtServiceImpl.cc +++ b/src/edt/edt/edtServiceImpl.cc @@ -47,7 +47,7 @@ namespace edt // ----------------------------------------------------------------------------- // ShapeEditService implementation -ShapeEditService::ShapeEditService (db::Manager *manager, lay::LayoutView *view, db::ShapeIterator::flags_type shape_types) +ShapeEditService::ShapeEditService (db::Manager *manager, lay::LayoutViewBase *view, db::ShapeIterator::flags_type shape_types) : edt::Service (manager, view, shape_types), m_layer (0), m_cv_index (0), mp_cell (0), mp_layout (0), m_combine_mode (CM_Add) { @@ -362,7 +362,7 @@ ShapeEditService::deliver_shape (const db::Box &box) // ----------------------------------------------------------------------------- // PolygonService implementation -PolygonService::PolygonService (db::Manager *manager, lay::LayoutView *view) +PolygonService::PolygonService (db::Manager *manager, lay::LayoutViewBase *view) : ShapeEditService (manager, view, db::ShapeIterator::Polygons), m_closure_set (false), m_closure () { @@ -692,7 +692,7 @@ PolygonService::update_marker () // ----------------------------------------------------------------------------- // BoxService implementation -BoxService::BoxService (db::Manager *manager, lay::LayoutView *view) +BoxService::BoxService (db::Manager *manager, lay::LayoutViewBase *view) : ShapeEditService (manager, view, db::ShapeIterator::Boxes) { // .. nothing yet .. @@ -784,7 +784,7 @@ BoxService::selection_applies (const lay::ObjectInstPath &sel) const // ----------------------------------------------------------------------------- // TextService implementation -TextService::TextService (db::Manager *manager, lay::LayoutView *view) +TextService::TextService (db::Manager *manager, lay::LayoutViewBase *view) : ShapeEditService (manager, view, db::ShapeIterator::Texts), m_rot (0) { @@ -972,7 +972,7 @@ TextService::configure (const std::string &name, const std::string &value) // ----------------------------------------------------------------------------- // PathService implementation -PathService::PathService (db::Manager *manager, lay::LayoutView *view) +PathService::PathService (db::Manager *manager, lay::LayoutViewBase *view) : ShapeEditService (manager, view, db::ShapeIterator::Paths), m_width (0.1), m_bgnext (0.0), m_endext (0.0), m_type (Flush), m_needs_update (true) { @@ -1211,7 +1211,7 @@ PathService::config_finalize () // ----------------------------------------------------------------------------- // InstService implementation -InstService::InstService (db::Manager *manager, lay::LayoutView *view) +InstService::InstService (db::Manager *manager, lay::LayoutViewBase *view) : edt::Service (manager, view), m_angle (0.0), m_scale (1.0), m_mirror (false), m_is_pcell (false), diff --git a/src/edt/edt/edtServiceImpl.h b/src/edt/edt/edtServiceImpl.h index c3caf4383..145a8d2ff 100644 --- a/src/edt/edt/edtServiceImpl.h +++ b/src/edt/edt/edtServiceImpl.h @@ -45,7 +45,7 @@ class ShapeEditService : public edt::Service { public: - ShapeEditService (db::Manager *manager, lay::LayoutView *view, db::ShapeIterator::flags_type shape_types); + ShapeEditService (db::Manager *manager, lay::LayoutViewBase *view, db::ShapeIterator::flags_type shape_types); protected: void get_edit_layer (); @@ -86,7 +86,7 @@ class PolygonService : public ShapeEditService { public: - PolygonService (db::Manager *manager, lay::LayoutView *view); + PolygonService (db::Manager *manager, lay::LayoutViewBase *view); virtual lay::PropertiesPage *properties_page (db::Manager *manager, QWidget *parent); virtual void do_delete (); @@ -117,7 +117,7 @@ class BoxService : public ShapeEditService { public: - BoxService (db::Manager *manager, lay::LayoutView *view); + BoxService (db::Manager *manager, lay::LayoutViewBase *view); virtual lay::PropertiesPage *properties_page (db::Manager *manager, QWidget *parent); virtual void do_begin_edit (const db::DPoint &p); @@ -142,7 +142,7 @@ class TextService : public ShapeEditService { public: - TextService (db::Manager *manager, lay::LayoutView *view); + TextService (db::Manager *manager, lay::LayoutViewBase *view); ~TextService (); virtual lay::PropertiesPage *properties_page (db::Manager *manager, QWidget *parent); @@ -174,7 +174,7 @@ class PathService : public ShapeEditService { public: - PathService (db::Manager *manager, lay::LayoutView *view); + PathService (db::Manager *manager, lay::LayoutViewBase *view); ~PathService (); virtual lay::PropertiesPage *properties_page (db::Manager *manager, QWidget *parent); @@ -211,7 +211,7 @@ class InstService : public edt::Service { public: - InstService (db::Manager *manager, lay::LayoutView *view); + InstService (db::Manager *manager, lay::LayoutViewBase *view); virtual lay::PropertiesPage *properties_page (db::Manager *manager, QWidget *parent); virtual void do_begin_edit (const db::DPoint &p); diff --git a/src/edt/edt/edtUtils.cc b/src/edt/edt/edtUtils.cc index 4b04d9de8..08ca08827 100644 --- a/src/edt/edt/edtUtils.cc +++ b/src/edt/edt/edtUtils.cc @@ -77,7 +77,7 @@ std::map pcell_parameters_from_string (const std::stri // ------------------------------------------------------------- // SelectionIterator implementation -SelectionIterator::SelectionIterator (lay::LayoutView *view, bool including_transient) +SelectionIterator::SelectionIterator (lay::LayoutViewBase *view, bool including_transient) : m_transient_mode (false) { mp_edt_services = view->get_plugins (); @@ -145,7 +145,7 @@ SelectionIterator::next () // TransformationsVariants implementation // for a lay::LayoutView -TransformationVariants::TransformationVariants (const lay::LayoutView *view, bool per_cv_and_layer, bool per_cv) +TransformationVariants::TransformationVariants (const lay::LayoutViewBase *view, bool per_cv_and_layer, bool per_cv) { // build the transformation variants cache diff --git a/src/edt/edt/edtUtils.h b/src/edt/edt/edtUtils.h index af9a81999..703dcfbf7 100644 --- a/src/edt/edt/edtUtils.h +++ b/src/edt/edt/edtUtils.h @@ -40,7 +40,7 @@ namespace lay { - class LayoutView; + class LayoutViewBase; } namespace edt { @@ -84,7 +84,7 @@ public: class TransformationVariants { public: - TransformationVariants (const lay::LayoutView *view, bool per_cv_and_layer = true, bool per_cv = true); + TransformationVariants (const lay::LayoutViewBase *view, bool per_cv_and_layer = true, bool per_cv = true); const std::vector *per_cv_and_layer (unsigned int cv, unsigned int layer) const; const std::vector *per_cv (unsigned int cv) const; @@ -109,7 +109,7 @@ public: * * If "including_transient" is true, the transient selection will be used as fallback. */ - SelectionIterator (lay::LayoutView *view, bool including_transient = true); + SelectionIterator (lay::LayoutViewBase *view, bool including_transient = true); /** * @brief Returns a value indicating whether the transient selection is taken diff --git a/src/img/img/gsiDeclImg.cc b/src/img/img/gsiDeclImg.cc index 096375845..bc40cc8c1 100644 --- a/src/img/img/gsiDeclImg.cc +++ b/src/img/img/gsiDeclImg.cc @@ -299,8 +299,8 @@ gsi::Class decl_ImageDataMapping ("lay", "ImageDataMapping", class ImageRef; -static void replace_image (lay::LayoutView *view, size_t id, ImageRef &new_obj); -static void erase_image (lay::LayoutView *view, size_t id); +static void replace_image_base (lay::LayoutViewBase *view, size_t id, ImageRef &new_obj); +static void erase_image_base (lay::LayoutViewBase *view, size_t id); /** * @brief An extension of the img::Object that provides "live" updates of the view @@ -321,7 +321,7 @@ public: // .. nothing yet .. } - ImageRef (const img::Object &other, lay::LayoutView *view) + ImageRef (const img::Object &other, lay::LayoutViewBase *view) : img::Object (other), mp_view (view), dm_update_view (this, &ImageRef::do_update_view) { // .. nothing yet .. @@ -365,7 +365,7 @@ public: void erase () { if (mp_view) { - erase_image (mp_view.get (), id ()); + erase_image_base (mp_view.get (), id ()); detach (); } } @@ -373,7 +373,7 @@ public: template ImageRef transformed (const T &t) const { - return ImageRef (img::Object::transformed (t), const_cast (mp_view.get ())); + return ImageRef (img::Object::transformed (t), const_cast (mp_view.get ())); } void set_view (lay::LayoutView *view) @@ -398,12 +398,12 @@ protected: void do_update_view () { if (mp_view) { - replace_image (mp_view.get (), id (), *this); + replace_image_base (mp_view.get (), id (), *this); } } private: - tl::weak_ptr mp_view; + tl::weak_ptr mp_view; tl::DeferredMethod dm_update_view; }; @@ -1114,7 +1114,7 @@ static void show_image (lay::LayoutView *view, size_t id, bool visible) } } -static void replace_image (lay::LayoutView *view, size_t id, ImageRef &new_obj) +void replace_image_base (lay::LayoutViewBase *view, size_t id, ImageRef &new_obj) { img::Service *img_service = view->get_plugin (); if (img_service) { @@ -1129,7 +1129,12 @@ static void replace_image (lay::LayoutView *view, size_t id, ImageRef &new_obj) } } -static void erase_image (lay::LayoutView *view, size_t id) +static void replace_image (lay::LayoutView *view, size_t id, ImageRef &new_obj) +{ + replace_image_base (view, id, new_obj); +} + +void erase_image_base (lay::LayoutViewBase *view, size_t id) { img::Service *img_service = view->get_plugin (); if (img_service) { @@ -1144,6 +1149,11 @@ static void erase_image (lay::LayoutView *view, size_t id) } } +static void erase_image (lay::LayoutView *view, size_t id) +{ + erase_image_base (view, id); +} + static void insert_image (lay::LayoutView *view, ImageRef &obj) { if (obj.is_valid ()) { diff --git a/src/img/img/imgPlugin.cc b/src/img/img/imgPlugin.cc index 74d710786..33b15b146 100644 --- a/src/img/img/imgPlugin.cc +++ b/src/img/img/imgPlugin.cc @@ -45,7 +45,7 @@ PluginDeclaration::get_menu_entries (std::vector &menu_entries) } lay::Plugin * -PluginDeclaration::create_plugin (db::Manager *manager, lay::Dispatcher *, lay::LayoutView *view) const +PluginDeclaration::create_plugin (db::Manager *manager, lay::Dispatcher *, lay::LayoutViewBase *view) const { return new img::Service (manager, view); } diff --git a/src/img/img/imgPlugin.h b/src/img/img/imgPlugin.h index 4dc9fa0bd..1575ceccb 100644 --- a/src/img/img/imgPlugin.h +++ b/src/img/img/imgPlugin.h @@ -36,7 +36,7 @@ class PluginDeclaration { public: virtual void get_menu_entries (std::vector &menu_entries) const; - virtual lay::Plugin *create_plugin (db::Manager *manager, lay::Dispatcher *, lay::LayoutView *view) const; + virtual lay::Plugin *create_plugin (db::Manager *manager, lay::Dispatcher *, lay::LayoutViewBase *view) const; virtual bool implements_editable (std::string &title) const; virtual void get_options (std::vector < std::pair > &options) const; }; diff --git a/src/img/img/imgService.cc b/src/img/img/imgService.cc index 627c03967..86c7cef71 100644 --- a/src/img/img/imgService.cc +++ b/src/img/img/imgService.cc @@ -402,7 +402,7 @@ View::render (const lay::Viewport &vp, lay::ViewObjectCanvas &canvas) // ------------------------------------------------------------- // img::Service implementation -Service::Service (db::Manager *manager, lay::LayoutView *view) +Service::Service (db::Manager *manager, lay::LayoutViewBase *view) : lay::BackgroundViewObject (view->view_object_widget ()), lay::Editable (view), lay::Plugin (view), diff --git a/src/img/img/imgService.h b/src/img/img/imgService.h index 65e7bfa70..167177727 100644 --- a/src/img/img/imgService.h +++ b/src/img/img/imgService.h @@ -203,7 +203,7 @@ public: typedef lay::AnnotationShapes::iterator obj_iterator; enum MoveMode { move_none, move_selected, move_landmark, move_l, move_r, move_t, move_b, move_lr, move_tr, move_ll, move_tl, move_all }; - Service (db::Manager *manager, lay::LayoutView *view); + Service (db::Manager *manager, lay::LayoutViewBase *view); ~Service (); @@ -432,7 +432,7 @@ public: /** * @brief Access to the view object */ - lay::LayoutView *view () const + lay::LayoutViewBase *view () const { return mp_view; } @@ -480,7 +480,7 @@ public: private: // The layout view that the image service is attached to - lay::LayoutView *mp_view; + lay::LayoutViewBase *mp_view; // The view objects representing the selection and the moved images in move mode std::vector m_selected_image_views; diff --git a/src/lay/lay/layClipDialog.cc b/src/lay/lay/layClipDialog.cc index e28d5589d..f644a8ce5 100644 --- a/src/lay/lay/layClipDialog.cc +++ b/src/lay/lay/layClipDialog.cc @@ -55,7 +55,7 @@ public: menu_entries.push_back (lay::menu_item ("clip_tool::show", "clip_tool:edit_mode", "edit_menu.utils_menu.end", tl::to_string (QObject::tr ("Clip Tool")))); } - virtual lay::Plugin *create_plugin (db::Manager *, lay::Dispatcher *root, lay::LayoutView *view) const + virtual lay::Plugin *create_plugin (db::Manager *, lay::Dispatcher *root, lay::LayoutViewBase *view) const { return new ClipDialog (root, view); } diff --git a/src/lay/lay/layFillDialog.cc b/src/lay/lay/layFillDialog.cc index 2cc2d500b..5969b677a 100644 --- a/src/lay/lay/layFillDialog.cc +++ b/src/lay/lay/layFillDialog.cc @@ -62,7 +62,7 @@ public: menu_entries.push_back (lay::menu_item ("fill_tool::show", "fill_tool:edit_mode", "edit_menu.utils_menu.end", tl::to_string (QObject::tr ("Fill Tool")))); } - virtual lay::Plugin *create_plugin (db::Manager *, lay::Dispatcher *root, lay::LayoutView *view) const + virtual lay::Plugin *create_plugin (db::Manager *, lay::Dispatcher *root, lay::LayoutViewBase *view) const { return new FillDialog (root, view); } diff --git a/src/lay/lay/laySearchReplacePlugin.cc b/src/lay/lay/laySearchReplacePlugin.cc index bc603736d..6c4be161b 100644 --- a/src/lay/lay/laySearchReplacePlugin.cc +++ b/src/lay/lay/laySearchReplacePlugin.cc @@ -63,7 +63,7 @@ public: menu_entries.push_back (lay::menu_item ("search_replace::show", "search_replace_viewer:edit:view_mode", "edit_menu.utils_group+", tl::to_string (QObject::tr ("Search")))); } - virtual lay::Plugin *create_plugin (db::Manager *, lay::Dispatcher *root, lay::LayoutView *view) const + virtual lay::Plugin *create_plugin (db::Manager *, lay::Dispatcher *root, lay::LayoutViewBase *view) const { return new SearchReplaceDialog (root, view); } diff --git a/src/laybasic/laybasic/gsiDeclLayMarker.cc b/src/laybasic/laybasic/gsiDeclLayMarker.cc index 5e23b71aa..9f5e58bd9 100644 --- a/src/laybasic/laybasic/gsiDeclLayMarker.cc +++ b/src/laybasic/laybasic/gsiDeclLayMarker.cc @@ -29,7 +29,7 @@ namespace gsi { static -lay::DMarker *create_marker (lay::LayoutView *view) +lay::DMarker *create_marker (lay::LayoutViewBase *view) { return new lay::DMarker (view); } diff --git a/src/laybasic/laybasic/gsiDeclLayPlugin.cc b/src/laybasic/laybasic/gsiDeclLayPlugin.cc index 9d8cf8e1c..530fd82d7 100644 --- a/src/laybasic/laybasic/gsiDeclLayPlugin.cc +++ b/src/laybasic/laybasic/gsiDeclLayPlugin.cc @@ -40,7 +40,7 @@ namespace gsi // since PluginBase object are only allowed to be created inside the create_plugin method // of the factory, this hack is a quick but dirty workaround. static bool s_in_create_plugin = false; -static lay::LayoutView *sp_view = 0; +static lay::LayoutViewBase *sp_view = 0; static lay::Dispatcher *sp_dispatcher = 0; class PluginBase @@ -393,7 +393,7 @@ public: } } - virtual lay::Plugin *create_plugin (db::Manager *manager, lay::Dispatcher *root, lay::LayoutView *view) const + virtual lay::Plugin *create_plugin (db::Manager *manager, lay::Dispatcher *root, lay::LayoutViewBase *view) const { if (f_create_plugin.can_issue ()) { return create_plugin_gsi (manager, root, view); @@ -402,7 +402,7 @@ public: } } - virtual gsi::PluginBase *create_plugin_gsi (db::Manager *manager, lay::Dispatcher *root, lay::LayoutView *view) const + virtual gsi::PluginBase *create_plugin_gsi (db::Manager *manager, lay::Dispatcher *root, lay::LayoutViewBase *view) const { // TODO: this is a hack. See notes above at s_in_create_plugin s_in_create_plugin = true; @@ -410,7 +410,7 @@ public: sp_dispatcher = root; gsi::PluginBase *ret = 0; try { - ret = f_create_plugin.issue (&PluginFactoryBase::create_plugin_gsi, manager, root, view); + ret = f_create_plugin.issue (&PluginFactoryBase::create_plugin_gsi, manager, root, view); s_in_create_plugin = false; sp_view = 0; sp_dispatcher = 0; diff --git a/src/laybasic/laybasic/layBrowseInstancesForm.cc b/src/laybasic/laybasic/layBrowseInstancesForm.cc index fb28e6b65..1d486a42e 100644 --- a/src/laybasic/laybasic/layBrowseInstancesForm.cc +++ b/src/laybasic/laybasic/layBrowseInstancesForm.cc @@ -79,7 +79,7 @@ public: menu_entries.push_back (lay::menu_item ("browse_instances::show", "browse_instances", "tools_menu.end", tl::to_string (QObject::tr ("Browse Instances")))); } - virtual lay::Plugin *create_plugin (db::Manager *, lay::Dispatcher *root, lay::LayoutView *view) const + virtual lay::Plugin *create_plugin (db::Manager *, lay::Dispatcher *root, lay::LayoutViewBase *view) const { return new BrowseInstancesForm (root, view); } @@ -289,7 +289,7 @@ private: // ------------------------------------------------------------ -BrowseInstancesForm::BrowseInstancesForm (lay::Dispatcher *root, lay::LayoutView *vw) +BrowseInstancesForm::BrowseInstancesForm (lay::Dispatcher *root, LayoutViewBase *vw) : lay::Browser (root, vw), Ui::BrowseInstancesForm (), m_cv_index (0), @@ -349,9 +349,12 @@ void BrowseInstancesForm::choose_cell_pressed () { BEGIN_PROTECTED - CellSelectionForm form (this, view (), "browse_cell", true /*simple mode*/); - if (form.exec ()) { - change_cell (form.selected_cellview ().cell_index (), form.selected_cellview_index ()); + lay::LayoutView *lv = dynamic_cast (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 ()); + } } END_PROTECTED } @@ -522,18 +525,21 @@ struct BrowseInstancesCellInfo void BrowseInstancesForm::activated () { - view ()->save_view (m_display_state); + lay::LayoutView *lv = dynamic_cast (view ()); + tl_assert (lv != 0); + + lv->save_view (m_display_state); // if no cellviews are available, don't do anything - if (! view ()->cellviews ()) { + if (! lv->cellviews ()) { return; } // obtain active cellview index and cell index - int cv_index = view ()->active_cellview_index (); + int cv_index = lv->active_cellview_index (); lay::LayoutView::cell_path_type path; - view ()->current_cell_path (path); + lv->current_cell_path (path); // no cell to index if (path.empty ()) { diff --git a/src/laybasic/laybasic/layBrowseInstancesForm.h b/src/laybasic/laybasic/layBrowseInstancesForm.h index ae4d5e2b0..61bec73de 100644 --- a/src/laybasic/laybasic/layBrowseInstancesForm.h +++ b/src/laybasic/laybasic/layBrowseInstancesForm.h @@ -65,7 +65,7 @@ public: enum mode_type { ToCellView = 0, AnyTop, Parent }; enum window_type { DontChange = 0, FitCell, FitMarker, Center, CenterSize }; - BrowseInstancesForm (lay::Dispatcher *root, lay::LayoutView *view); + BrowseInstancesForm (lay::Dispatcher *root, lay::LayoutViewBase *view); ~BrowseInstancesForm (); bool eventFilter (QObject *watched, QEvent *event); diff --git a/src/laybasic/laybasic/layBrowseShapesForm.cc b/src/laybasic/laybasic/layBrowseShapesForm.cc index 08304872a..a31e6ff42 100644 --- a/src/laybasic/laybasic/layBrowseShapesForm.cc +++ b/src/laybasic/laybasic/layBrowseShapesForm.cc @@ -80,7 +80,7 @@ public: menu_entries.push_back (lay::menu_item ("browse_shapes::show", "browse_shapes", "tools_menu.end", tl::to_string (QObject::tr ("Browse Shapes")))); } - virtual lay::Plugin *create_plugin (db::Manager *, lay::Dispatcher *root, lay::LayoutView *view) const + virtual lay::Plugin *create_plugin (db::Manager *, lay::Dispatcher *root, lay::LayoutViewBase *view) const { return new BrowseShapesForm (root, view); } @@ -392,7 +392,7 @@ private: // ------------------------------------------------------------ -BrowseShapesForm::BrowseShapesForm (lay::Dispatcher *root, lay::LayoutView *vw) +BrowseShapesForm::BrowseShapesForm (lay::Dispatcher *root, LayoutViewBase *vw) : lay::Browser (root, vw), Ui::BrowseShapesForm (), m_cv_index (-1), @@ -660,9 +660,12 @@ BrowseShapesForm::cell_inst_changed (QTreeWidgetItem *, QTreeWidgetItem *) void BrowseShapesForm::activated () { - view ()->save_view (m_display_state); + lay::LayoutView *lv = dynamic_cast (view ()); + tl_assert (lv != 0); - std::vector sel_layers = view ()->selected_layers (); + lv->save_view (m_display_state); + + std::vector sel_layers = lv->selected_layers (); if (sel_layers.empty ()) { throw tl::Exception (tl::to_string (QObject::tr ("No layer selected"))); @@ -688,7 +691,7 @@ BrowseShapesForm::activated () } } else { m_cv_index = cv_index; - m_cellview = view ()->cellview (m_cv_index); + m_cellview = lv->cellview (m_cv_index); } } diff --git a/src/laybasic/laybasic/layBrowseShapesForm.h b/src/laybasic/laybasic/layBrowseShapesForm.h index d4c74afff..4ff63c739 100644 --- a/src/laybasic/laybasic/layBrowseShapesForm.h +++ b/src/laybasic/laybasic/layBrowseShapesForm.h @@ -64,7 +64,7 @@ public: enum mode_type { ToCellView = 0, AnyTop, Local }; enum window_type { DontChange = 0, FitCell, FitMarker, Center, CenterSize }; - BrowseShapesForm (lay::Dispatcher *root, lay::LayoutView *view); + BrowseShapesForm (lay::Dispatcher *root, LayoutViewBase *view); ~BrowseShapesForm (); bool eventFilter (QObject *watched, QEvent *event); diff --git a/src/laybasic/laybasic/layBrowser.cc b/src/laybasic/laybasic/layBrowser.cc index 8a9fcc241..07b2a9828 100644 --- a/src/laybasic/laybasic/layBrowser.cc +++ b/src/laybasic/laybasic/layBrowser.cc @@ -32,9 +32,9 @@ namespace lay { #if QT_VERSION >= 0x050000 -Browser::Browser (lay::Dispatcher *root, lay::LayoutView *view, const char *name, Qt::WindowFlags fl) +Browser::Browser (lay::Dispatcher *root, lay::LayoutViewBase *view, const char *name, Qt::WindowFlags fl) #else -Browser::Browser (lay::Dispatcher *root, lay::LayoutView *view, const char *name, Qt::WFlags fl) +Browser::Browser (lay::Dispatcher *root, lay::LayoutViewBase *view, const char *name, Qt::WFlags fl) #endif // TODO: clarify whether to keep the browsers as separate (potentially hidden) windows : QDialog (0 /*view*/, fl), diff --git a/src/laybasic/laybasic/layBrowser.h b/src/laybasic/laybasic/layBrowser.h index 31510fd5f..fcc490c53 100644 --- a/src/laybasic/laybasic/layBrowser.h +++ b/src/laybasic/laybasic/layBrowser.h @@ -47,9 +47,9 @@ public: * @brief Constructor */ #if QT_VERSION >= 0x050000 - Browser (lay::Dispatcher *root, lay::LayoutView *view, const char *name = "", Qt::WindowFlags fl = Qt::Window /*adds minimize button for example*/); + Browser (lay::Dispatcher *root, lay::LayoutViewBase *view, const char *name = "", Qt::WindowFlags fl = Qt::Window /*adds minimize button for example*/); #else - Browser (lay::Dispatcher *root, lay::LayoutView *view, const char *name = "", Qt::WFlags fl = Qt::Window /*adds minimize button for example*/); + Browser (lay::Dispatcher *root, lay::LayoutViewBase *view, const char *name = "", Qt::WFlags fl = Qt::Window /*adds minimize button for example*/); #endif /** @@ -93,7 +93,7 @@ public: /** * @brief Return the pointer to the layout view */ - lay::LayoutView *view () + lay::LayoutViewBase *view () { return mp_view; } @@ -132,7 +132,7 @@ public: private: bool m_active; - lay::LayoutView *mp_view; + lay::LayoutViewBase *mp_view; lay::Dispatcher *mp_root; void closeEvent (QCloseEvent *); diff --git a/src/laybasic/laybasic/layCellSelectionForm.cc b/src/laybasic/laybasic/layCellSelectionForm.cc index fd84934c0..0bd3ff519 100644 --- a/src/laybasic/laybasic/layCellSelectionForm.cc +++ b/src/laybasic/laybasic/layCellSelectionForm.cc @@ -49,7 +49,7 @@ static const std::string cfg_cell_selection_search_use_expressions ("cell-select // ------------------------------------------------------------ -CellSelectionForm::CellSelectionForm (QWidget *parent, lay::LayoutView *view, const char *name, bool simple_mode) +CellSelectionForm::CellSelectionForm (QWidget *parent, LayoutView *view, const char *name, bool simple_mode) : QDialog (parent), Ui::CellSelectionForm (), mp_view (view), m_current_cv (-1), diff --git a/src/laybasic/laybasic/layCellSelectionForm.h b/src/laybasic/laybasic/layCellSelectionForm.h index 3d6f8c42b..adc0a5cc7 100644 --- a/src/laybasic/laybasic/layCellSelectionForm.h +++ b/src/laybasic/laybasic/layCellSelectionForm.h @@ -49,7 +49,7 @@ class LAYBASIC_PUBLIC CellSelectionForm Q_OBJECT public: - CellSelectionForm (QWidget *parent, lay::LayoutView *view, const char *name, bool simple_mode = false); + CellSelectionForm (QWidget *parent, LayoutView *view, const char *name, bool simple_mode = false); /** * @brief Obtain the selected cellview's index (with changes) diff --git a/src/laybasic/laybasic/layCellView.cc b/src/laybasic/laybasic/layCellView.cc index 476b6867e..ee28b6cbc 100644 --- a/src/laybasic/laybasic/layCellView.cc +++ b/src/laybasic/laybasic/layCellView.cc @@ -674,7 +674,7 @@ CellViewRef::CellViewRef () // .. nothing yet .. } -CellViewRef::CellViewRef (lay::CellView *cv, lay::LayoutView *view) +CellViewRef::CellViewRef (lay::CellView *cv, lay::LayoutViewBase *view) : mp_cv (cv), mp_view (view) { // .. nothing yet .. @@ -706,7 +706,7 @@ CellViewRef::index () const } } -lay::LayoutView * +lay::LayoutViewBase * CellViewRef::view () { return mp_view.get (); diff --git a/src/laybasic/laybasic/layDispatcher.cc b/src/laybasic/laybasic/layDispatcher.cc index 809d25a56..740393388 100644 --- a/src/laybasic/laybasic/layDispatcher.cc +++ b/src/laybasic/laybasic/layDispatcher.cc @@ -46,21 +46,6 @@ Dispatcher::Dispatcher (Plugin *parent, bool standalone) } } -#if defined(HAVE_QT) -Dispatcher::Dispatcher (QWidget *menu_parent_widget, Plugin *parent, bool standalone) - : Plugin (parent, standalone), - mp_menu_parent_widget (menu_parent_widget), - mp_delegate (0) -{ - if (mp_menu_parent_widget) { - mp_menu.reset (new lay::AbstractMenu (this)); - } - if (! parent && ! ms_dispatcher_instance) { - ms_dispatcher_instance = this; - } -} -#endif - Dispatcher::Dispatcher (DispatcherDelegate *delegate, Plugin *parent, bool standalone) : Plugin (parent, standalone), #if defined(HAVE_QT) diff --git a/src/laybasic/laybasic/layEditorOptionsFrame.cc b/src/laybasic/laybasic/layEditorOptionsFrame.cc index dd593f9e4..55607c77f 100644 --- a/src/laybasic/laybasic/layEditorOptionsFrame.cc +++ b/src/laybasic/laybasic/layEditorOptionsFrame.cc @@ -47,7 +47,7 @@ EditorOptionsFrame::~EditorOptionsFrame () } void -EditorOptionsFrame::populate (LayoutView *view) +EditorOptionsFrame::populate (LayoutViewBase *view) { std::vector prop_dialog_pages; for (tl::Registrar::iterator cls = tl::Registrar::begin (); cls != tl::Registrar::end (); ++cls) { diff --git a/src/laybasic/laybasic/layEditorOptionsFrame.h b/src/laybasic/laybasic/layEditorOptionsFrame.h index 6ccadf986..0922be2ee 100644 --- a/src/laybasic/laybasic/layEditorOptionsFrame.h +++ b/src/laybasic/laybasic/layEditorOptionsFrame.h @@ -30,7 +30,7 @@ namespace lay { class EditorOptionsPages; -class LayoutView; +class LayoutViewBase; class LAYBASIC_PUBLIC EditorOptionsFrame : public QFrame @@ -39,7 +39,7 @@ public: EditorOptionsFrame (QWidget *parent); virtual ~EditorOptionsFrame (); - void populate (LayoutView *view); + void populate (lay::LayoutViewBase *view); EditorOptionsPages *pages_widget () const { diff --git a/src/laybasic/laybasic/layEditorServiceBase.cc b/src/laybasic/laybasic/layEditorServiceBase.cc index 7dbc0fad1..2e887fa5b 100644 --- a/src/laybasic/laybasic/layEditorServiceBase.cc +++ b/src/laybasic/laybasic/layEditorServiceBase.cc @@ -202,7 +202,7 @@ private: // -------------------------------------------------------------------------------------- -EditorServiceBase::EditorServiceBase (lay::LayoutView *view) +EditorServiceBase::EditorServiceBase (LayoutViewBase *view) : lay::ViewService (view->view_object_widget ()), lay::Editable (view), lay::Plugin (view), diff --git a/src/laybasic/laybasic/layEditorServiceBase.h b/src/laybasic/laybasic/layEditorServiceBase.h index 276f1a66a..7316eeba6 100644 --- a/src/laybasic/laybasic/layEditorServiceBase.h +++ b/src/laybasic/laybasic/layEditorServiceBase.h @@ -46,7 +46,7 @@ public: /** * @brief Constructor */ - EditorServiceBase (lay::LayoutView *view); + EditorServiceBase (lay::LayoutViewBase *view); /** * @brief Destructor diff --git a/src/laybasic/laybasic/layFinder.cc b/src/laybasic/laybasic/layFinder.cc index 7fa2d4589..7bd3dac16 100644 --- a/src/laybasic/laybasic/layFinder.cc +++ b/src/laybasic/laybasic/layFinder.cc @@ -86,7 +86,7 @@ Finder::closer (double d) } void -Finder::start (lay::LayoutView *view, const lay::CellView &cv, unsigned int cv_index, const std::vector &trans, const db::Box ®ion, int min_level, int max_level, const std::vector &layers) +Finder::start (lay::LayoutViewBase *view, const lay::CellView &cv, unsigned int cv_index, const std::vector &trans, const db::Box ®ion, int min_level, int max_level, const std::vector &layers) { m_layers = layers; m_region = region; @@ -265,7 +265,7 @@ struct LPContextCompareOp }; bool -ShapeFinder::find (lay::LayoutView *view, const db::DBox ®ion_mu) +ShapeFinder::find (LayoutViewBase *view, const db::DBox ®ion_mu) { tl::AbsoluteProgress progress (tl::to_string (QObject::tr ("Selecting ..."))); progress.set_unit (1000); @@ -330,7 +330,7 @@ ShapeFinder::find (lay::LayoutView *view, const db::DBox ®ion_mu) } bool -ShapeFinder::find (lay::LayoutView *view, const lay::LayerProperties &lprops, const db::DBox ®ion_mu) +ShapeFinder::find (lay::LayoutViewBase *view, const lay::LayerProperties &lprops, const db::DBox ®ion_mu) { tl::AbsoluteProgress progress (tl::to_string (QObject::tr ("Selecting ..."))); progress.set_unit (1000); @@ -349,7 +349,7 @@ ShapeFinder::find (lay::LayoutView *view, const lay::LayerProperties &lprops, co } bool -ShapeFinder::find_internal (lay::LayoutView *view, unsigned int cv_index, const std::set *prop_sel, bool inv_prop_sel, const lay::HierarchyLevelSelection &hier_sel, const std::vector &trans_mu, const std::vector &layers, const db::DBox ®ion_mu) +ShapeFinder::find_internal (lay::LayoutViewBase *view, unsigned int cv_index, const std::set *prop_sel, bool inv_prop_sel, const lay::HierarchyLevelSelection &hier_sel, const std::vector &trans_mu, const std::vector &layers, const db::DBox ®ion_mu) { m_cv_index = cv_index; @@ -624,7 +624,7 @@ InstFinder::InstFinder (bool point_mode, bool top_level_sel, bool full_arrays, b } bool -InstFinder::find (lay::LayoutView *view, const db::DBox ®ion_mu) +InstFinder::find (lay::LayoutViewBase *view, const db::DBox ®ion_mu) { tl::AbsoluteProgress progress (tl::to_string (QObject::tr ("Selecting ..."))); progress.set_unit (1000); @@ -641,7 +641,7 @@ InstFinder::find (lay::LayoutView *view, const db::DBox ®ion_mu) } bool -InstFinder::find (lay::LayoutView *view, unsigned int cv_index, const db::DCplxTrans &trans_mu, const db::DBox ®ion_mu) +InstFinder::find (LayoutViewBase *view, unsigned int cv_index, const db::DCplxTrans &trans_mu, const db::DBox ®ion_mu) { tl::AbsoluteProgress progress (tl::to_string (QObject::tr ("Selecting ..."))); progress.set_unit (1000); @@ -655,7 +655,7 @@ InstFinder::find (lay::LayoutView *view, unsigned int cv_index, const db::DCplxT } bool -InstFinder::find_internal (lay::LayoutView *view, unsigned int cv_index, const db::DCplxTrans &trans_mu, const db::DBox ®ion_mu) +InstFinder::find_internal (LayoutViewBase *view, unsigned int cv_index, const db::DCplxTrans &trans_mu, const db::DBox ®ion_mu) { const lay::CellView &cv = view->cellview (cv_index); if (! cv.is_valid ()) { diff --git a/src/laybasic/laybasic/layFinder.h b/src/laybasic/laybasic/layFinder.h index 166842421..f411872b6 100644 --- a/src/laybasic/laybasic/layFinder.h +++ b/src/laybasic/laybasic/layFinder.h @@ -136,7 +136,7 @@ protected: return m_max_level; } - lay::LayoutView *view () const + lay::LayoutViewBase *view () const { return mp_view; } @@ -153,7 +153,7 @@ protected: * path of instantiations up to the top cell is maintained and accessible by * the path() accessor. */ - void start (lay::LayoutView *view, const lay::CellView &cv, unsigned int cv_index, const std::vector &trans, const db::Box ®ion, int min_level, int max_level, const std::vector &layers = std::vector ()); + void start (LayoutViewBase *view, const lay::CellView &cv, unsigned int cv_index, const std::vector &trans, const db::Box ®ion, int min_level, int max_level, const std::vector &layers = std::vector ()); /** * @brief Provide a basic edge test facility @@ -186,7 +186,7 @@ private: int m_min_level, m_max_level; std::vector m_path; const db::Layout *mp_layout; - lay::LayoutView *mp_view; + lay::LayoutViewBase *mp_view; unsigned int m_cv_index; db::Box m_region; std::vector m_layers; @@ -214,8 +214,8 @@ public: ShapeFinder (bool point_mode, bool top_level_sel, db::ShapeIterator::flags_type flags, const std::set *excludes = 0); - bool find (lay::LayoutView *view, const lay::LayerProperties &lprops, const db::DBox ®ion_mu); - bool find (lay::LayoutView *view, const db::DBox ®ion_mu); + bool find (LayoutViewBase *view, const lay::LayerProperties &lprops, const db::DBox ®ion_mu); + bool find (LayoutViewBase *view, const db::DBox ®ion_mu); iterator begin () const { @@ -262,13 +262,13 @@ protected: private: virtual void visit_cell (const db::Cell &cell, const db::Box &search_box, const db::ICplxTrans &t, int /*level*/); - bool find_internal (lay::LayoutView *view, - unsigned int cv_index, - const std::set *prop_sel, - bool inv_prop_sel, + bool find_internal (LayoutViewBase *view, + unsigned int cv_index, + const std::set *prop_sel, + bool inv_prop_sel, const lay::HierarchyLevelSelection &hier_sel, const std::vector &trans_mu, - const std::vector &layers, + const std::vector &layers, const db::DBox ®ion_mu); const std::set *mp_excludes; @@ -300,8 +300,8 @@ public: InstFinder (bool point_mode, bool top_level_sel, bool full_arrays, bool enclose_inst = true, const std::set *excludes = 0, bool visible_layers = false); - bool find (lay::LayoutView *view, unsigned int cv_index, const db::DCplxTrans &trans, const db::DBox ®ion_mu); - bool find (lay::LayoutView *view, const db::DBox ®ion_mu); + bool find (LayoutViewBase *view, unsigned int cv_index, const db::DCplxTrans &trans, const db::DBox ®ion_mu); + bool find (LayoutViewBase *view, const db::DBox ®ion_mu); iterator begin () const { @@ -315,7 +315,7 @@ public: private: virtual void visit_cell (const db::Cell &cell, const db::Box &search_box, const db::ICplxTrans &t, int level); - bool find_internal (lay::LayoutView *view, unsigned int cv_index, const db::DCplxTrans &trans_mu, const db::DBox ®ion_mu); + bool find_internal (LayoutViewBase *view, unsigned int cv_index, const db::DCplxTrans &trans_mu, const db::DBox ®ion_mu); unsigned int m_cv_index; db::cell_index_type m_topcell; @@ -326,7 +326,7 @@ private: bool m_enclose_insts; bool m_visible_layers; std::vector m_visible_layer_indexes; - lay::LayoutView *mp_view; + LayoutViewBase *mp_view; tl::AbsoluteProgress *mp_progress; }; diff --git a/src/laybasic/laybasic/layGridNet.cc b/src/laybasic/laybasic/layGridNet.cc index 31f0dca4f..f7f205ad1 100644 --- a/src/laybasic/laybasic/layGridNet.cc +++ b/src/laybasic/laybasic/layGridNet.cc @@ -105,7 +105,7 @@ GridNetPluginDeclaration::config_page (QWidget *parent, std::string &title) cons } lay::Plugin * -GridNetPluginDeclaration::create_plugin (db::Manager *, Dispatcher *, lay::LayoutView *view) const +GridNetPluginDeclaration::create_plugin (db::Manager *, Dispatcher *, lay::LayoutViewBase *view) const { return new lay::GridNet (view); } @@ -192,7 +192,7 @@ GridNetConfigPage::commit (lay::Dispatcher *root) // ------------------------------------------------------------ // Implementation of the GridNet object -GridNet::GridNet (lay::LayoutView *view) +GridNet::GridNet (LayoutViewBase *view) : lay::BackgroundViewObject (view->view_object_widget ()), lay::Plugin (view), mp_view (view), diff --git a/src/laybasic/laybasic/layGridNet.h b/src/laybasic/laybasic/layGridNet.h index 98063d9bd..0a7ab5d95 100644 --- a/src/laybasic/laybasic/layGridNet.h +++ b/src/laybasic/laybasic/layGridNet.h @@ -45,7 +45,7 @@ class GridNetPluginDeclaration public: virtual void get_options (std::vector < std::pair > &options) const; virtual lay::ConfigPage *config_page (QWidget *parent, std::string &title) const; - virtual lay::Plugin *create_plugin (db::Manager *, lay::Dispatcher *, lay::LayoutView *view) const; + virtual lay::Plugin *create_plugin (db::Manager *, lay::Dispatcher *, lay::LayoutViewBase *view) const; }; class GridNetConfigPage @@ -83,7 +83,7 @@ public: CheckerBoard }; - GridNet (lay::LayoutView *view); + GridNet (lay::LayoutViewBase *view); private: virtual void render_bg (const lay::Viewport &vp, lay::ViewObjectCanvas &canvas); @@ -91,7 +91,7 @@ private: // implementation of the lay::Plugin interface virtual bool configure (const std::string &name, const std::string &value); - lay::LayoutView *mp_view; + lay::LayoutViewBase *mp_view; bool m_visible; bool m_show_ruler; double m_grid; diff --git a/src/laybasic/laybasic/layLayerTreeModel.cc b/src/laybasic/laybasic/layLayerTreeModel.cc index 5a3c09eea..d52ace764 100644 --- a/src/laybasic/laybasic/layLayerTreeModel.cc +++ b/src/laybasic/laybasic/layLayerTreeModel.cc @@ -631,7 +631,7 @@ LayerTreeModel::empty_within_view_predicate (const QModelIndex &index) const LAYBASIC_PUBLIC QIcon -LayerTreeModel::icon_for_layer (const lay::LayerPropertiesConstIterator &iter, lay::LayoutView *view, unsigned int w, unsigned int h, unsigned int di_off, bool no_state) +LayerTreeModel::icon_for_layer (const lay::LayerPropertiesConstIterator &iter, lay::LayoutViewBase *view, unsigned int w, unsigned int h, unsigned int di_off, bool no_state) { h = std::max ((unsigned int) 16, h); w = std::max ((unsigned int) 16, w); diff --git a/src/laybasic/laybasic/layLayerTreeModel.h b/src/laybasic/laybasic/layLayerTreeModel.h index 8273526f7..7da95e367 100644 --- a/src/laybasic/laybasic/layLayerTreeModel.h +++ b/src/laybasic/laybasic/layLayerTreeModel.h @@ -48,6 +48,7 @@ namespace lay { class LayoutView; +class LayoutViewBase; class LayerPropertiesConstIterator; /** @@ -108,7 +109,7 @@ public: /** * @brief Provides an icon for a given layer style */ - static QIcon icon_for_layer (const lay::LayerPropertiesConstIterator &iter, lay::LayoutView *view, unsigned int w, unsigned int h, unsigned int di_offset, bool no_state = false); + static QIcon icon_for_layer (const lay::LayerPropertiesConstIterator &iter, lay::LayoutViewBase *view, unsigned int w, unsigned int h, unsigned int di_offset, bool no_state = false); /** * @brief Gets the preferred icon size diff --git a/src/laybasic/laybasic/layLayoutCanvas.cc b/src/laybasic/laybasic/layLayoutCanvas.cc index 99a6200dd..6e60f4a2f 100644 --- a/src/laybasic/laybasic/layLayoutCanvas.cc +++ b/src/laybasic/laybasic/layLayoutCanvas.cc @@ -274,7 +274,7 @@ invert (unsigned char *data, unsigned int width, unsigned int height) } } -LayoutCanvas::LayoutCanvas (QWidget *parent, lay::LayoutView *view, const char *name) +LayoutCanvas::LayoutCanvas (QWidget *parent, lay::LayoutViewBase *view, const char *name) : lay::ViewObjectWidget (parent, name), mp_view (view), mp_image (0), mp_image_bg (0), mp_pixmap (0), diff --git a/src/laybasic/laybasic/layLayoutView.cc b/src/laybasic/laybasic/layLayoutView.cc index 70de70c82..47e531863 100644 --- a/src/laybasic/laybasic/layLayoutView.cc +++ b/src/laybasic/laybasic/layLayoutView.cc @@ -689,6 +689,7 @@ LayoutView::ensure_layer_selected () void LayoutView::remove_unused_layers () { + // @@@ should not be in control panel if (mp_control_panel) { mp_control_panel->cm_remove_unused (); } @@ -702,6 +703,18 @@ LayoutView::begin_layer_updates () } } +bool +LayoutView::layer_model_updated () +{ + // because check_updated is called in the initialization phase, we check if the pointers + // to the widgets are non-null: + if (mp_control_panel) { + return mp_control_panel->model_updated (); + } else { + return false; + } +} + void LayoutView::bookmark_current_view () { diff --git a/src/laybasic/laybasic/layLayoutView.h b/src/laybasic/laybasic/layLayoutView.h index 707754d4d..69af08d9d 100644 --- a/src/laybasic/laybasic/layLayoutView.h +++ b/src/laybasic/laybasic/layLayoutView.h @@ -322,10 +322,20 @@ public: */ void remove_unused_layers (); + /** + * @brief Internal method: check, if the layer tree is and an consistent state. + * + * This method is used by the layer tree model to check, if the tree has been brought into + * a consistent state. + * HINT: for the layout this is solved more consistently with the "under construction" attribute + * of the layout. There is no equivalent object for the layer tree currently. + */ + bool layer_model_updated (); + /** * @brief Returns true, if the layer source shall be shown always in the layer properties tree */ - bool always_show_source () const + virtual bool always_show_source () const { return m_always_show_source; } @@ -333,7 +343,7 @@ public: /** * @brief Returns true, if the layer/datatype shall be shown always in the layer properties tree */ - bool always_show_ld () const + virtual bool always_show_ld () const { return m_always_show_ld; } @@ -341,7 +351,7 @@ public: /** * @brief Returns true, if the layout index shall be shown always in the layer properties tree */ - bool always_show_layout_index () const + virtual bool always_show_layout_index () const { return m_always_show_layout_index; } @@ -389,6 +399,11 @@ public: */ void open_l2ndb_browser (int l2ndb_index, int cv_index); + /** + * @brief Gets the editor options pages + */ + lay::EditorOptionsPages *editor_options_pages (); + /** * @brief Gets the container with the layer control panel */ @@ -763,7 +778,6 @@ private: void init_ui (); void init_menu (); - lay::EditorOptionsPages *editor_options_pages (); void do_setup_editor_options_pages (); protected: diff --git a/src/laybasic/laybasic/layLayoutViewBase.cc b/src/laybasic/laybasic/layLayoutViewBase.cc index 7323a86ac..84ecfad9e 100644 --- a/src/laybasic/laybasic/layLayoutViewBase.cc +++ b/src/laybasic/laybasic/layLayoutViewBase.cc @@ -613,6 +613,12 @@ LayoutViewBase::set_synchronous (bool s) m_synchronous = s; } +void +LayoutViewBase::message (const std::string & /*s*/, int /*timeout*/) +{ + // .. nothing yet .. +} + bool LayoutViewBase::is_dirty () const { @@ -1401,6 +1407,24 @@ LayoutViewBase::merge_dither_pattern (lay::LayerPropertiesList &props) } } +bool +LayoutViewBase::always_show_source () const +{ + return false; +} + +bool +LayoutViewBase::always_show_ld () const +{ + return true; +} + +bool +LayoutViewBase::always_show_layout_index () const +{ + return false; +} + void LayoutViewBase::set_properties (unsigned int index, const LayerPropertiesList &props) { diff --git a/src/laybasic/laybasic/layLayoutViewBase.h b/src/laybasic/laybasic/layLayoutViewBase.h index 55fd70dd8..781b534d2 100644 --- a/src/laybasic/laybasic/layLayoutViewBase.h +++ b/src/laybasic/laybasic/layLayoutViewBase.h @@ -243,6 +243,11 @@ public: return m_title; } + /** + * @brief Display a status message + */ + void message (const std::string &s = "", int timeout = 10); + /** * @brief The "dirty" flag indicates that one of the layout has been modified * @@ -250,6 +255,21 @@ public: */ bool is_dirty () const; + /** + * @brief Returns true, if the layer source shall be shown always in the layer properties tree + */ + virtual bool always_show_source () const; + + /** + * @brief Returns true, if the layer/datatype shall be shown always in the layer properties tree + */ + virtual bool always_show_ld () const; + + /** + * @brief Returns true, if the layout index shall be shown always in the layer properties tree + */ + virtual bool always_show_layout_index () const; + /** * @brief Fill the layer properties for a new layer * @@ -402,6 +422,11 @@ public: return get_properties (index).end_const_recursive (); } + /** + * @brief Rename a layer properties list + */ + void rename_properties (unsigned int index, const std::string &new_name); + /** * @brief Replace the current layer properties list */ @@ -410,11 +435,6 @@ public: set_properties (current_layer_list (), list); } - /** - * @brief Rename a layer properties list - */ - void rename_properties (unsigned int index, const std::string &new_name); - /** * @brief Replace the specified layer properties list */ @@ -2314,6 +2334,12 @@ public: void redraw_cell_boxes (); void timer (); + virtual void deactivate_all_browsers (); + +#if defined(HAVE_QT) + virtual QWidget *widget () { return 0; } +#endif + private: // event handlers used to connect to the layout object's events void signal_hier_changed (); @@ -2505,7 +2531,6 @@ protected: virtual void do_set_current_layer (const lay::LayerPropertiesConstIterator &l); virtual void do_set_no_stipples (bool no_stipples); virtual void do_set_phase (int phase); - virtual void deactivate_all_browsers (); virtual bool is_activated () const; virtual void update_content_for_cv (int cv_index); virtual void set_active_cellview_index (int index); @@ -2517,10 +2542,6 @@ protected: virtual void emit_title_changed () { } virtual void emit_dirty_changed () { } virtual void emit_layer_order_changed () { } - -#if defined(HAVE_QT) - virtual QWidget *widget () { return 0; } -#endif }; } diff --git a/src/laybasic/laybasic/layLayoutViewFunctions.cc b/src/laybasic/laybasic/layLayoutViewFunctions.cc index ba769f0d6..65188d4de 100644 --- a/src/laybasic/laybasic/layLayoutViewFunctions.cc +++ b/src/laybasic/laybasic/layLayoutViewFunctions.cc @@ -77,8 +77,8 @@ validate_cell_path (const db::Layout &layout, lay::LayoutView::cell_path_type &p return false; } -LayoutViewFunctions::LayoutViewFunctions (db::Manager *manager, LayoutView *view) - : lay::Plugin (view), mp_view (view), mp_manager (manager) +LayoutViewFunctions::LayoutViewFunctions (db::Manager *manager, LayoutViewBase *view) + : lay::Plugin (view), mp_view (dynamic_cast (view)), mp_manager (manager) { m_del_cell_mode = 0; m_move_to_origin_mode_x = 0; @@ -104,6 +104,10 @@ LayoutViewFunctions::~LayoutViewFunctions () void LayoutViewFunctions::menu_activated (const std::string &symbol) { + if (! view ()) { + return; + } + if (symbol == "cm_show_properties") { view ()->show_properties (view ()); @@ -2240,7 +2244,7 @@ public: } } - lay::Plugin *create_plugin (db::Manager *manager, Dispatcher *, LayoutView *view) const + lay::Plugin *create_plugin (db::Manager *manager, Dispatcher *, LayoutViewBase *view) const { return new LayoutViewFunctions (manager, view); } diff --git a/src/laybasic/laybasic/layLayoutViewFunctions.h b/src/laybasic/laybasic/layLayoutViewFunctions.h index 37fdeb676..6661a4753 100644 --- a/src/laybasic/laybasic/layLayoutViewFunctions.h +++ b/src/laybasic/laybasic/layLayoutViewFunctions.h @@ -46,7 +46,7 @@ public: /** * @brief Constructor */ - LayoutViewFunctions (db::Manager *manager, lay::LayoutView *view); + LayoutViewFunctions (db::Manager *manager, lay::LayoutViewBase *view); /** * @brief Destructor diff --git a/src/laybasic/laybasic/layMarker.cc b/src/laybasic/laybasic/layMarker.cc index 8e1f7ab7d..959f3601a 100644 --- a/src/laybasic/laybasic/layMarker.cc +++ b/src/laybasic/laybasic/layMarker.cc @@ -188,7 +188,7 @@ void render_cell_inst (const db::Layout &layout, const db::CellInstArray &inst, // ------------------------------------------------------------------------ -MarkerBase::MarkerBase (lay::LayoutView *view) +MarkerBase::MarkerBase (lay::LayoutViewBase *view) : lay::ViewObject (view->view_object_widget ()), m_line_width (-1), m_vertex_size (-1), m_halo (-1), m_text_enabled (true), m_vertex_shape (lay::ViewOp::Rect), m_line_style (-1), m_dither_pattern (-1), m_frame_pattern (0), mp_view (view) { @@ -372,7 +372,7 @@ MarkerBase::get_bitmaps (const Viewport & /*vp*/, ViewObjectCanvas &canvas, lay: // ------------------------------------------------------------------------ -GenericMarkerBase::GenericMarkerBase (lay::LayoutView *view, unsigned int cv_index) +GenericMarkerBase::GenericMarkerBase (lay::LayoutViewBase *view, unsigned int cv_index) : MarkerBase (view), mp_trans_vector (0), mp_view (view), m_cv_index (cv_index) { // .. nothing yet .. @@ -496,7 +496,7 @@ GenericMarkerBase::dbu () const // ------------------------------------------------------------------------ -InstanceMarker::InstanceMarker (lay::LayoutView *view, unsigned int cv_index, bool draw_outline, size_t max_shapes) +InstanceMarker::InstanceMarker (LayoutViewBase *view, unsigned int cv_index, bool draw_outline, size_t max_shapes) : GenericMarkerBase (view, cv_index), m_draw_outline (draw_outline), m_max_shapes (max_shapes), m_inst () { // .. nothing yet .. @@ -576,7 +576,7 @@ InstanceMarker::item_bbox () const // ------------------------------------------------------------------------ -ShapeMarker::ShapeMarker (lay::LayoutView *view, unsigned int cv_index) +ShapeMarker::ShapeMarker (LayoutViewBase *view, unsigned int cv_index) : GenericMarkerBase (view, cv_index), m_shape () { // .. nothing yet .. @@ -643,7 +643,7 @@ ShapeMarker::item_bbox () const // ------------------------------------------------------------------------ -Marker::Marker (lay::LayoutView *view, unsigned int cv_index, bool draw_outline, size_t max_shapes) +Marker::Marker (lay::LayoutViewBase *view, unsigned int cv_index, bool draw_outline, size_t max_shapes) : GenericMarkerBase (view, cv_index), m_draw_outline (draw_outline), m_max_shapes (max_shapes) { m_type = None; @@ -1135,7 +1135,7 @@ Marker::render (const Viewport &vp, ViewObjectCanvas &canvas) // ------------------------------------------------------------------------ -DMarker::DMarker (lay::LayoutView *view) +DMarker::DMarker (LayoutViewBase *view) : MarkerBase (view), mp_view (view) { m_type = None; diff --git a/src/laybasic/laybasic/layMarker.h b/src/laybasic/laybasic/layMarker.h index 7b18deab6..2cc4a4133 100644 --- a/src/laybasic/laybasic/layMarker.h +++ b/src/laybasic/laybasic/layMarker.h @@ -44,7 +44,7 @@ namespace lay { -class LayoutView; +class LayoutViewBase; /** * @brief The marker base class @@ -59,7 +59,7 @@ public: /** * @brief The constructor */ - MarkerBase (lay::LayoutView *view); + MarkerBase (lay::LayoutViewBase *view); /** * @brief Get the color by which the marker is drawn @@ -232,7 +232,7 @@ protected: bool m_text_enabled; lay::ViewOp::Shape m_vertex_shape; int m_line_style, m_dither_pattern, m_frame_pattern; - lay::LayoutView *mp_view; + lay::LayoutViewBase *mp_view; }; /** @@ -252,7 +252,7 @@ public: /** * @brief The constructor */ - GenericMarkerBase (lay::LayoutView *view, unsigned int cv_index); + GenericMarkerBase (lay::LayoutViewBase *view, unsigned int cv_index); /** * @brief The destructor @@ -321,7 +321,7 @@ public: /** * @brief Gets the view object */ - lay::LayoutView *view () const + lay::LayoutViewBase *view () const { return mp_view; } @@ -344,7 +344,7 @@ public: private: db::CplxTrans m_trans; std::vector *mp_trans_vector; - lay::LayoutView *mp_view; + lay::LayoutViewBase *mp_view; unsigned int m_cv_index; /** @@ -367,7 +367,7 @@ public: /** * @brief The constructor */ - ShapeMarker (lay::LayoutView *view, unsigned int cv_index); + ShapeMarker (lay::LayoutViewBase *view, unsigned int cv_index); /** * @brief The destructor @@ -418,7 +418,7 @@ public: * @param draw_outline True to have instances drawing their outline * @param max_shapes The maximum number of shapes to draw for instances (just a box is drawn if more shapes are present) */ - InstanceMarker (lay::LayoutView *view, unsigned int cv_index, bool draw_outline = true, size_t max_shapes = 0); + InstanceMarker (lay::LayoutViewBase *view, unsigned int cv_index, bool draw_outline = true, size_t max_shapes = 0); /** * @brief The destructor @@ -508,7 +508,7 @@ public: * @param draw_outline True to have instances drawing their outline * @param max_shapes The maximum number of shapes to draw for instances (just a box is drawn if more shapes are present) */ - Marker (lay::LayoutView *view, unsigned int cv_index, bool draw_outline = true, size_t max_shapes = 0); + Marker (lay::LayoutViewBase *view, unsigned int cv_index, bool draw_outline = true, size_t max_shapes = 0); /** * @brief The destructor @@ -743,7 +743,7 @@ public: /** * @brief The constructor */ - DMarker (lay::LayoutView *view); + DMarker (lay::LayoutViewBase *view); /** * @brief The destructor @@ -806,7 +806,7 @@ private: void *any; } m_object; - lay::LayoutView *mp_view; + lay::LayoutViewBase *mp_view; }; } diff --git a/src/laybasic/laybasic/layMove.cc b/src/laybasic/laybasic/layMove.cc index 5347b8999..9e6102f39 100644 --- a/src/laybasic/laybasic/layMove.cc +++ b/src/laybasic/laybasic/layMove.cc @@ -34,9 +34,8 @@ namespace lay // ------------------------------------------------------------- // MoveService implementation -MoveService::MoveService (lay::LayoutView *view) - : QObject (), - lay::ViewService (view->view_object_widget ()), +MoveService::MoveService (lay::LayoutViewBase *view) + : lay::ViewService (view->view_object_widget ()), m_dragging (false), m_dragging_transient (false), mp_editables (view), diff --git a/src/laybasic/laybasic/layNetlistBrowser.cc b/src/laybasic/laybasic/layNetlistBrowser.cc index d43501a38..ab689cb92 100644 --- a/src/laybasic/laybasic/layNetlistBrowser.cc +++ b/src/laybasic/laybasic/layNetlistBrowser.cc @@ -376,7 +376,7 @@ public: menu_entries.push_back (lay::menu_item ("netlist_browser::show", "browse_netlists", "tools_menu.end", tl::to_string (QObject::tr ("Netlist Browser")))); } - virtual lay::Plugin *create_plugin (db::Manager *, lay::Dispatcher *root, lay::LayoutView *view) const + virtual lay::Plugin *create_plugin (db::Manager *, lay::Dispatcher *root, lay::LayoutViewBase *view) const { return new lay::NetlistBrowserDialog (root, view); } diff --git a/src/laybasic/laybasic/layNetlistBrowserDialog.cc b/src/laybasic/laybasic/layNetlistBrowserDialog.cc index 820ebdf32..b294befc6 100644 --- a/src/laybasic/laybasic/layNetlistBrowserDialog.cc +++ b/src/laybasic/laybasic/layNetlistBrowserDialog.cc @@ -56,7 +56,7 @@ extern const std::string cfg_l2ndb_max_shapes_highlighted; extern const std::string cfg_l2ndb_show_all; extern const std::string cfg_l2ndb_window_state; -NetlistBrowserDialog::NetlistBrowserDialog (lay::Dispatcher *root, lay::LayoutView *vw) +NetlistBrowserDialog::NetlistBrowserDialog (lay::Dispatcher *root, lay::LayoutViewBase *vw) : lay::Browser (root, vw), lay::ViewService (vw->view_object_widget ()), Ui::NetlistBrowserDialog (), @@ -729,19 +729,22 @@ NetlistBrowserDialog::cv_index_changed (int index) void NetlistBrowserDialog::activated () { + lay::LayoutView *lv = dynamic_cast (view ()); + tl_assert (lv != 0); + std::string state; - view ()->config_get (cfg_l2ndb_window_state, state); + lv->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 = view ()->cellview (m_cv_index); + lay::CellView cv = lv->cellview (m_cv_index); if (! cv.is_valid ()) { - m_cv_index = view ()->active_cellview_index (); + m_cv_index = lv->active_cellview_index (); } - if (m_l2n_index < 0 && view ()->get_l2ndb (0) != 0) { + if (m_l2n_index < 0 && lv->get_l2ndb (0) != 0) { - m_l2ndb_name = view ()->get_l2ndb (0)->name (); + m_l2ndb_name = lv->get_l2ndb (0)->name (); l2ndbs_changed (); } else { diff --git a/src/laybasic/laybasic/layNetlistBrowserDialog.h b/src/laybasic/laybasic/layNetlistBrowserDialog.h index ebebe1c14..d7ad87699 100644 --- a/src/laybasic/laybasic/layNetlistBrowserDialog.h +++ b/src/laybasic/laybasic/layNetlistBrowserDialog.h @@ -42,7 +42,7 @@ class NetlistBrowserDialog Q_OBJECT public: - NetlistBrowserDialog (lay::Dispatcher *root, lay::LayoutView *view); + NetlistBrowserDialog (lay::Dispatcher *root, lay::LayoutViewBase *view); ~NetlistBrowserDialog (); void load (int lay_index, int cv_index); diff --git a/src/laybasic/laybasic/layNetlistBrowserPage.cc b/src/laybasic/laybasic/layNetlistBrowserPage.cc index ef1fdc4f0..828be2771 100644 --- a/src/laybasic/laybasic/layNetlistBrowserPage.cc +++ b/src/laybasic/laybasic/layNetlistBrowserPage.cc @@ -242,7 +242,7 @@ NetlistBrowserPage::set_highlight_style (lay::Color color, int line_width, int v } void -NetlistBrowserPage::set_view (lay::LayoutView *view, int cv_index) +NetlistBrowserPage::set_view (lay::LayoutViewBase *view, int cv_index) { if (mp_view) { mp_view->layer_list_changed_event.remove (this, &NetlistBrowserPage::layer_list_changed); @@ -1424,7 +1424,7 @@ NetlistBrowserPage::export_nets (const std::vector *nets) if (dialog->exec_dialog (mp_plugin_root)) { // NOTE: mp_view and database might get reset to 0 in create_layout - lay::LayoutView *view = mp_view; + lay::LayoutViewBase *view = mp_view; db::LayoutToNetlist *database = mp_database.get (); unsigned int cv_index = view->create_layout (true); diff --git a/src/laybasic/laybasic/layNetlistBrowserPage.h b/src/laybasic/laybasic/layNetlistBrowserPage.h index d11f126e9..2d330b0d7 100644 --- a/src/laybasic/laybasic/layNetlistBrowserPage.h +++ b/src/laybasic/laybasic/layNetlistBrowserPage.h @@ -86,7 +86,7 @@ public: * If that pointer is non-null, the browser will attach itself to * the view and provide highlights for the selected markers inside the given cellview. */ - void set_view (lay::LayoutView *view, int cv_index); + void set_view (LayoutViewBase *view, int cv_index); /** * @brief Attaches the page to a L2N DB @@ -224,7 +224,7 @@ private: int m_marker_dither_pattern; int m_marker_intensity; bool m_use_original_colors; - lay::LayoutView *mp_view; + lay::LayoutViewBase *mp_view; unsigned int m_cv_index; lay::Dispatcher *mp_plugin_root; tl::weak_ptr mp_database; diff --git a/src/laybasic/laybasic/layRedrawThread.cc b/src/laybasic/laybasic/layRedrawThread.cc index b0902a379..25d1a24b3 100644 --- a/src/laybasic/laybasic/layRedrawThread.cc +++ b/src/laybasic/laybasic/layRedrawThread.cc @@ -39,7 +39,7 @@ namespace lay // ------------------------------------------------------------- // RedrawThread implementation -RedrawThread::RedrawThread (lay::RedrawThreadCanvas *canvas, lay::LayoutView *view) +RedrawThread::RedrawThread (lay::RedrawThreadCanvas *canvas, LayoutViewBase *view) : tl::Object () { m_initial_update = false; diff --git a/src/laybasic/laybasic/layRedrawThread.h b/src/laybasic/laybasic/layRedrawThread.h index 4658b8c85..47ac943e2 100644 --- a/src/laybasic/laybasic/layRedrawThread.h +++ b/src/laybasic/laybasic/layRedrawThread.h @@ -55,7 +55,7 @@ class RedrawThread public tl::JobBase { public: - RedrawThread (lay::RedrawThreadCanvas *canvas, lay::LayoutView *view); + RedrawThread (lay::RedrawThreadCanvas *canvas, lay::LayoutViewBase *view); virtual ~RedrawThread (); void commit (const std::vector &layers, const lay::Viewport &vp, double resolution); @@ -116,7 +116,7 @@ private: db::DFTrans m_stored_fp; lay::RedrawThreadCanvas *mp_canvas; - lay::LayoutView *mp_view; + lay::LayoutViewBase *mp_view; bool m_start_recursion_sentinel; tl::Clock m_clock; diff --git a/src/laybasic/laybasic/layRedrawThreadWorker.cc b/src/laybasic/laybasic/layRedrawThreadWorker.cc index b63e15b2a..661d61224 100644 --- a/src/laybasic/laybasic/layRedrawThreadWorker.cc +++ b/src/laybasic/laybasic/layRedrawThreadWorker.cc @@ -496,7 +496,7 @@ RedrawThreadWorker::finish () } void -RedrawThreadWorker::setup (LayoutView *view, RedrawThreadCanvas *canvas, const std::vector &redraw_region, const db::DCplxTrans &vp_trans) +RedrawThreadWorker::setup (LayoutViewBase *view, RedrawThreadCanvas *canvas, const std::vector &redraw_region, const db::DCplxTrans &vp_trans) { m_redraw_region = redraw_region; m_vp_trans = vp_trans; diff --git a/src/laybasic/laybasic/layRedrawThreadWorker.h b/src/laybasic/laybasic/layRedrawThreadWorker.h index 545772118..68cc2e264 100644 --- a/src/laybasic/laybasic/layRedrawThreadWorker.h +++ b/src/laybasic/laybasic/layRedrawThreadWorker.h @@ -168,7 +168,7 @@ public: RedrawThreadWorker (RedrawThread *redraw_thread); virtual ~RedrawThreadWorker (); - void setup (LayoutView *view, RedrawThreadCanvas *canvas, const std::vector &redraw_region, const db::DCplxTrans &vp_trans); + void setup (LayoutViewBase *view, RedrawThreadCanvas *canvas, const std::vector &redraw_region, const db::DCplxTrans &vp_trans); void finish (); protected: diff --git a/src/laybasic/laybasic/laySelector.cc b/src/laybasic/laybasic/laySelector.cc index e1dea2f3b..029b1cbe1 100644 --- a/src/laybasic/laybasic/laySelector.cc +++ b/src/laybasic/laybasic/laySelector.cc @@ -37,7 +37,7 @@ namespace lay // ------------------------------------------------------------- // SelectionService implementation -SelectionService::SelectionService (lay::LayoutView *view) +SelectionService::SelectionService (lay::LayoutViewBase *view) : QObject (), lay::ViewService (view->view_object_widget ()), mp_view (view), diff --git a/src/laybasic/laybasic/laySelector.h b/src/laybasic/laybasic/laySelector.h index f804b243e..ad81060b3 100644 --- a/src/laybasic/laybasic/laySelector.h +++ b/src/laybasic/laybasic/laySelector.h @@ -88,7 +88,7 @@ private: db::DPoint m_p1, m_p2; db::DPoint m_current_position; - lay::LayoutView *mp_view; + lay::LayoutViewBase *mp_view; lay::RubberBox *mp_box; unsigned int m_color; unsigned int m_buttons; diff --git a/src/laybasic/laybasic/laySnap.cc b/src/laybasic/laybasic/laySnap.cc index f7a92dca6..6c005d933 100644 --- a/src/laybasic/laybasic/laySnap.cc +++ b/src/laybasic/laybasic/laySnap.cc @@ -23,7 +23,7 @@ #include "laySnap.h" -#include "layLayoutView.h" +#include "layLayoutViewBase.h" #include "dbEdge.h" @@ -282,7 +282,7 @@ public: * This will run the finder on the given view. * "search_range" is the search range in micron units. */ - void find (lay::LayoutView *view, double search_range) + void find (lay::LayoutViewBase *view, double search_range) { if (! view) { return; @@ -586,7 +586,7 @@ private: } void - do_find (lay::LayoutView *view, int cv_index, const db::Cell &cell, unsigned int l, int min_level, int max_level, const db::CplxTrans &t) + do_find (lay::LayoutViewBase *view, int cv_index, const db::Cell &cell, unsigned int l, int min_level, int max_level, const db::CplxTrans &t) { db::Box touch_box = t.inverted () * m_region; @@ -727,7 +727,7 @@ private: }; static PointSnapToObjectResult -do_obj_snap (lay::LayoutView *view, const db::DPoint &pt, const db::DVector &grid, double snap_range, const std::vector &cutlines) +do_obj_snap (lay::LayoutViewBase *view, const db::DPoint &pt, const db::DVector &grid, double snap_range, const std::vector &cutlines) { db::DPoint dp (pt); @@ -792,7 +792,7 @@ do_obj_snap (lay::LayoutView *view, const db::DPoint &pt, const db::DVector &gri } static TwoPointSnapToObjectResult -do_obj_snap2 (lay::LayoutView *view, const db::DPoint &pt1, const db::DPoint &pt2, const db::DVector &grid, double min_search_range, double max_search_range, const std::vector &cutlines) +do_obj_snap2 (lay::LayoutViewBase *view, const db::DPoint &pt1, const db::DPoint &pt2, const db::DVector &grid, double min_search_range, double max_search_range, const std::vector &cutlines) { db::DPoint dp1 (pt1); db::DPoint dp2 (pt2); @@ -915,13 +915,13 @@ make_cutlines (lay::angle_constraint_type snap_mode, const db::DPoint &p1, std:: } PointSnapToObjectResult -obj_snap (lay::LayoutView *view, const db::DPoint &pt, const db::DVector &grid, double snap_range) +obj_snap (lay::LayoutViewBase *view, const db::DPoint &pt, const db::DVector &grid, double snap_range) { return do_obj_snap (view, pt, grid, snap_range, std::vector ()); } PointSnapToObjectResult -obj_snap (lay::LayoutView *view, const db::DPoint &p1, const db::DPoint &p2, const db::DVector &grid, lay::angle_constraint_type snap_mode, double snap_range) +obj_snap (lay::LayoutViewBase *view, const db::DPoint &p1, const db::DPoint &p2, const db::DVector &grid, lay::angle_constraint_type snap_mode, double snap_range) { std::vector cutlines; make_cutlines (snap_mode, p1, cutlines); @@ -929,19 +929,19 @@ obj_snap (lay::LayoutView *view, const db::DPoint &p1, const db::DPoint &p2, con } TwoPointSnapToObjectResult -obj_snap2 (lay::LayoutView *view, const db::DPoint &pt, const db::DVector &grid, double min_search_range, double max_search_range) +obj_snap2 (lay::LayoutViewBase *view, const db::DPoint &pt, const db::DVector &grid, double min_search_range, double max_search_range) { return obj_snap2 (view, pt, pt, grid, min_search_range, max_search_range); } TwoPointSnapToObjectResult -obj_snap2 (lay::LayoutView *view, const db::DPoint &pt, const db::DVector &grid, lay::angle_constraint_type ac, double min_search_range, double max_search_range) +obj_snap2 (lay::LayoutViewBase *view, const db::DPoint &pt, const db::DVector &grid, lay::angle_constraint_type ac, double min_search_range, double max_search_range) { return obj_snap2 (view, pt, pt, grid, ac, min_search_range, max_search_range); } TwoPointSnapToObjectResult -obj_snap2 (lay::LayoutView *view, const db::DPoint &pt1, const db::DPoint &pt2, const db::DVector &grid, double min_search_range, double max_search_range) +obj_snap2 (lay::LayoutViewBase *view, const db::DPoint &pt1, const db::DPoint &pt2, const db::DVector &grid, double min_search_range, double max_search_range) { db::DPoint dp1 = lay::snap_xy (pt1, grid); db::DPoint dp2 = lay::snap_xy (pt2, grid); @@ -950,7 +950,7 @@ obj_snap2 (lay::LayoutView *view, const db::DPoint &pt1, const db::DPoint &pt2, } TwoPointSnapToObjectResult -obj_snap2 (lay::LayoutView *view, const db::DPoint &pt1, const db::DPoint &pt2, const db::DVector &grid, lay::angle_constraint_type snap_mode, double min_search_range, double max_search_range) +obj_snap2 (lay::LayoutViewBase *view, const db::DPoint &pt1, const db::DPoint &pt2, const db::DVector &grid, lay::angle_constraint_type snap_mode, double min_search_range, double max_search_range) { db::DPoint dp1 = lay::snap_xy (pt1, grid); db::DPoint dp2 = lay::snap_xy (pt2, grid); diff --git a/src/laybasic/laybasic/laySnap.h b/src/laybasic/laybasic/laySnap.h index c05eabda3..776cb1acd 100644 --- a/src/laybasic/laybasic/laySnap.h +++ b/src/laybasic/laybasic/laySnap.h @@ -41,7 +41,7 @@ namespace lay { - class LayoutView; + class LayoutViewBase; /** * @brief An angle constraint type @@ -154,7 +154,7 @@ namespace lay * @param grid Either (0,0) to disable grid snapping or a (gx,gy) value for the (potentially anisotropic grid) * @param snap_range The search range for objects */ - LAYBASIC_PUBLIC PointSnapToObjectResult obj_snap (lay::LayoutView *view, const db::DPoint &pt, const db::DVector &grid, double snap_range); + LAYBASIC_PUBLIC PointSnapToObjectResult obj_snap (lay::LayoutViewBase *view, const db::DPoint &pt, const db::DVector &grid, double snap_range); /** * @brief combined grid-, projection- and object snapping provided to implementing "magnetic features" @@ -162,7 +162,7 @@ namespace lay * This is a convenience method that creates the projection axes from a reference point and an angle mode. * "pr" is the reference point, "pt" is the point to snap. */ - LAYBASIC_PUBLIC PointSnapToObjectResult obj_snap (lay::LayoutView *view, const db::DPoint &pr, const db::DPoint &pt, const db::DVector &grid, lay::angle_constraint_type ac, double snap_range); + LAYBASIC_PUBLIC PointSnapToObjectResult obj_snap (lay::LayoutViewBase *view, const db::DPoint &pr, const db::DPoint &pt, const db::DVector &grid, lay::angle_constraint_type ac, double snap_range); /** * @brief A structure describing the snap result for a two-sided object snap (distance measurement) @@ -208,7 +208,7 @@ namespace lay * This method basically implements "auto measure". The first value of the returned pair * is true if such an edge could be found. Otherwise it's false. */ - LAYBASIC_PUBLIC TwoPointSnapToObjectResult obj_snap2 (lay::LayoutView *view, const db::DPoint &pt, const db::DVector &grid, double min_search_range, double max_search_range); + LAYBASIC_PUBLIC TwoPointSnapToObjectResult obj_snap2 (lay::LayoutViewBase *view, const db::DPoint &pt, const db::DVector &grid, double min_search_range, double max_search_range); /** * @brief Same than obj_snap, but delivers two points on two opposite sides of the initial points @@ -218,14 +218,14 @@ namespace lay * * This version accepts two points defining different search regions for first and second edge. */ - LAYBASIC_PUBLIC TwoPointSnapToObjectResult obj_snap2 (lay::LayoutView *view, const db::DPoint &pt1, const db::DPoint &pt2, const db::DVector &grid, double min_search_range, double max_search_range); + LAYBASIC_PUBLIC TwoPointSnapToObjectResult obj_snap2 (lay::LayoutViewBase *view, const db::DPoint &pt1, const db::DPoint &pt2, const db::DVector &grid, double min_search_range, double max_search_range); /** * @brief Same than the previous obj_snap2, but allows specification of an angle constraint * * Measurements will be confined to the direction specified. */ - LAYBASIC_PUBLIC TwoPointSnapToObjectResult obj_snap2 (lay::LayoutView *view, const db::DPoint &pt, const db::DVector &grid, lay::angle_constraint_type ac, double min_search_range, double max_search_range); + LAYBASIC_PUBLIC TwoPointSnapToObjectResult obj_snap2 (lay::LayoutViewBase *view, const db::DPoint &pt, const db::DVector &grid, lay::angle_constraint_type ac, double min_search_range, double max_search_range); /** * @brief Same than the previous obj_snap2, but allows specification of an angle constraint @@ -234,7 +234,7 @@ namespace lay * * This version accepts two points defining different search regions for first and second edge. */ - LAYBASIC_PUBLIC TwoPointSnapToObjectResult obj_snap2 (lay::LayoutView *view, const db::DPoint &pt1, const db::DPoint &pt2, const db::DVector &grid, lay::angle_constraint_type ac, double min_search_range, double max_search_range); + LAYBASIC_PUBLIC TwoPointSnapToObjectResult obj_snap2 (lay::LayoutViewBase *view, const db::DPoint &pt1, const db::DPoint &pt2, const db::DVector &grid, lay::angle_constraint_type ac, double min_search_range, double max_search_range); /** * @brief Reduce a given vector according to the angle constraint diff --git a/src/laybasic/laybasic/layZoomBox.cc b/src/laybasic/laybasic/layZoomBox.cc index bef7e40f2..97f080aa5 100644 --- a/src/laybasic/laybasic/layZoomBox.cc +++ b/src/laybasic/laybasic/layZoomBox.cc @@ -31,7 +31,7 @@ namespace lay // ------------------------------------------------------------- // ZoomService implementation -ZoomService::ZoomService (lay::LayoutView *view) +ZoomService::ZoomService (lay::LayoutViewBase *view) : lay::ViewService (view->view_object_widget ()), mp_view (view), mp_box (0), diff --git a/src/laybasic/laybasic/rdbMarkerBrowser.cc b/src/laybasic/laybasic/rdbMarkerBrowser.cc index 2a7e9928a..6311b0f1b 100644 --- a/src/laybasic/laybasic/rdbMarkerBrowser.cc +++ b/src/laybasic/laybasic/rdbMarkerBrowser.cc @@ -302,7 +302,7 @@ public: menu_entries.push_back (lay::menu_item ("marker_browser::scan_layers_flat", "scan_layers_flat", "tools_menu.shapes_to_markers.end", tl::to_string (QObject::tr ("Flat")))); } - virtual lay::Plugin *create_plugin (db::Manager *, lay::Dispatcher *root, lay::LayoutView *view) const + virtual lay::Plugin *create_plugin (db::Manager *, lay::Dispatcher *root, lay::LayoutViewBase *view) const { return new rdb::MarkerBrowserDialog (root, view); } diff --git a/src/laybasic/laybasic/rdbMarkerBrowserDialog.cc b/src/laybasic/laybasic/rdbMarkerBrowserDialog.cc index c85b40024..a7caa9026 100644 --- a/src/laybasic/laybasic/rdbMarkerBrowserDialog.cc +++ b/src/laybasic/laybasic/rdbMarkerBrowserDialog.cc @@ -54,7 +54,7 @@ extern std::string cfg_rdb_marker_vertex_size; extern std::string cfg_rdb_marker_halo; extern std::string cfg_rdb_marker_dither_pattern; -MarkerBrowserDialog::MarkerBrowserDialog (lay::Dispatcher *root, lay::LayoutView *vw) +MarkerBrowserDialog::MarkerBrowserDialog (lay::Dispatcher *root, lay::LayoutViewBase *vw) : lay::Browser (root, vw), Ui::MarkerBrowserDialog (), m_context (rdb::AnyCell), @@ -635,19 +635,22 @@ MarkerBrowserDialog::cv_index_changed (int index) void MarkerBrowserDialog::activated () { + lay::LayoutView *lv = dynamic_cast (view ()); + tl_assert (lv != 0); + std::string state; - view ()->config_get (cfg_rdb_window_state, state); + lv->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 = view ()->cellview (m_cv_index); + lay::CellView cv = lv->cellview (m_cv_index); if (! cv.is_valid ()) { - m_cv_index = view ()->active_cellview_index (); + m_cv_index = lv->active_cellview_index (); } - if (m_rdb_index < 0 && view ()->get_rdb (0) != 0) { + if (m_rdb_index < 0 && lv->get_rdb (0) != 0) { - m_rdb_name = view ()->get_rdb (0)->name (); + m_rdb_name = lv->get_rdb (0)->name (); rdbs_changed (); } else { @@ -714,7 +717,10 @@ MarkerBrowserDialog::deactivated () void MarkerBrowserDialog::scan_layer () { - std::vector layers = view ()->selected_layers (); + lay::LayoutView *lv = dynamic_cast (view ()); + tl_assert (lv != 0); + + std::vector layers = lv->selected_layers (); if (layers.empty ()) { throw tl::Exception (tl::to_string (QObject::tr ("No layer selected to get shapes from"))); } @@ -806,13 +812,16 @@ MarkerBrowserDialog::scan_layer () } unsigned int rdb_index = view ()->add_rdb (rdb.release ()); - view ()->open_rdb_browser (rdb_index, cv_index); + lv->open_rdb_browser (rdb_index, cv_index); } void MarkerBrowserDialog::scan_layer_flat () { - std::vector layers = view ()->selected_layers (); + lay::LayoutView *lv = dynamic_cast (view ()); + tl_assert (lv != 0); + + std::vector layers = lv->selected_layers (); if (layers.empty ()) { throw tl::Exception (tl::to_string (QObject::tr ("No layer selected to get shapes from"))); } @@ -882,7 +891,7 @@ MarkerBrowserDialog::scan_layer_flat () } unsigned int rdb_index = view ()->add_rdb (rdb.release ()); - view ()->open_rdb_browser (rdb_index, cv_index); + lv->open_rdb_browser (rdb_index, cv_index); } void diff --git a/src/laybasic/laybasic/rdbMarkerBrowserDialog.h b/src/laybasic/laybasic/rdbMarkerBrowserDialog.h index 5e0bd782e..57836ca33 100644 --- a/src/laybasic/laybasic/rdbMarkerBrowserDialog.h +++ b/src/laybasic/laybasic/rdbMarkerBrowserDialog.h @@ -38,7 +38,7 @@ class MarkerBrowserDialog Q_OBJECT public: - MarkerBrowserDialog (lay::Dispatcher *root, lay::LayoutView *view); + MarkerBrowserDialog (lay::Dispatcher *root, lay::LayoutViewBase *view); ~MarkerBrowserDialog (); void load (int rdb_index, int cv_index); diff --git a/src/laybasic/laybasic/rdbMarkerBrowserPage.cc b/src/laybasic/laybasic/rdbMarkerBrowserPage.cc index df28158db..6560e3044 100644 --- a/src/laybasic/laybasic/rdbMarkerBrowserPage.cc +++ b/src/laybasic/laybasic/rdbMarkerBrowserPage.cc @@ -1620,7 +1620,7 @@ MarkerBrowserPage::set_marker_style (lay::Color color, int line_width, int verte } void -MarkerBrowserPage::set_view (lay::LayoutView *view, unsigned int cv_index) +MarkerBrowserPage::set_view (lay::LayoutViewBase *view, unsigned int cv_index) { mp_view = view; m_cv_index = cv_index; diff --git a/src/laybasic/laybasic/rdbMarkerBrowserPage.h b/src/laybasic/laybasic/rdbMarkerBrowserPage.h index f879884a6..6c7ab7820 100644 --- a/src/laybasic/laybasic/rdbMarkerBrowserPage.h +++ b/src/laybasic/laybasic/rdbMarkerBrowserPage.h @@ -78,7 +78,7 @@ public: * If that pointer is non-null, the browser will attach itself to * the view and provide highlights for the selected markers inside the given cellview. */ - void set_view (lay::LayoutView *view, unsigned int cv_index); + void set_view (lay::LayoutViewBase *view, unsigned int cv_index); /** * @brief Attach the page to a RDB @@ -184,7 +184,7 @@ private: rdb::Database *mp_database; bool m_show_all; QAction *m_show_all_action; - lay::LayoutView *mp_view; + lay::LayoutViewBase *mp_view; unsigned int m_cv_index; std::vector mp_markers; db::DBox m_markers_bbox; diff --git a/src/plugins/tools/bool/lay_plugin/layBooleanOperationsPlugin.cc b/src/plugins/tools/bool/lay_plugin/layBooleanOperationsPlugin.cc index 668f159e6..7202d66e1 100644 --- a/src/plugins/tools/bool/lay_plugin/layBooleanOperationsPlugin.cc +++ b/src/plugins/tools/bool/lay_plugin/layBooleanOperationsPlugin.cc @@ -494,7 +494,7 @@ public: // .. nothing yet .. } - lay::Plugin *create_plugin (db::Manager *, lay::Dispatcher *root, lay::LayoutView *view) const + lay::Plugin *create_plugin (db::Manager *, lay::Dispatcher *root, lay::LayoutViewBase *view) const { return new BooleanOperationsPlugin (root, view); } diff --git a/src/plugins/tools/diff/lay_plugin/layDiffPlugin.cc b/src/plugins/tools/diff/lay_plugin/layDiffPlugin.cc index 7cc1a6f52..7f207a1d2 100644 --- a/src/plugins/tools/diff/lay_plugin/layDiffPlugin.cc +++ b/src/plugins/tools/diff/lay_plugin/layDiffPlugin.cc @@ -102,7 +102,7 @@ public: // .. nothing yet .. } - lay::Plugin *create_plugin (db::Manager *, lay::Dispatcher *root, lay::LayoutView *view) const + lay::Plugin *create_plugin (db::Manager *, lay::Dispatcher *root, lay::LayoutViewBase *view) const { return new DiffPlugin (root, view); } diff --git a/src/plugins/tools/net_tracer/lay_plugin/layNetTracerPlugin.cc b/src/plugins/tools/net_tracer/lay_plugin/layNetTracerPlugin.cc index 9d7eb3d27..4382851b4 100644 --- a/src/plugins/tools/net_tracer/lay_plugin/layNetTracerPlugin.cc +++ b/src/plugins/tools/net_tracer/lay_plugin/layNetTracerPlugin.cc @@ -75,7 +75,7 @@ public: menu_entries.push_back (lay::menu_item ("lay::edit_layer_stack", "edit_layer_stack", "tools_menu.end", tl::to_string (QObject::tr ("Edit Layer Stack")))); } - virtual lay::Plugin *create_plugin (db::Manager * /*manager*/, lay::Dispatcher *root, lay::LayoutView *view) const + virtual lay::Plugin *create_plugin (db::Manager * /*manager*/, lay::Dispatcher *root, lay::LayoutViewBase *view) const { return new NetTracerDialog (root, view); } diff --git a/src/plugins/tools/view_25d/lay_plugin/layD25Plugin.cc b/src/plugins/tools/view_25d/lay_plugin/layD25Plugin.cc index c6830127c..4bb1601c8 100644 --- a/src/plugins/tools/view_25d/lay_plugin/layD25Plugin.cc +++ b/src/plugins/tools/view_25d/lay_plugin/layD25Plugin.cc @@ -67,7 +67,7 @@ public: // .. nothing yet .. } - lay::Plugin *create_plugin (db::Manager *, lay::Dispatcher *root, lay::LayoutView *view) const + lay::Plugin *create_plugin (db::Manager *, lay::Dispatcher *root, lay::LayoutViewBase *view) const { return new D25View (root, view); } diff --git a/src/plugins/tools/xor/lay_plugin/layXORPlugin.cc b/src/plugins/tools/xor/lay_plugin/layXORPlugin.cc index f6f9f79e1..094f67beb 100644 --- a/src/plugins/tools/xor/lay_plugin/layXORPlugin.cc +++ b/src/plugins/tools/xor/lay_plugin/layXORPlugin.cc @@ -34,7 +34,7 @@ class XORPlugin : public lay::Plugin { public: - XORPlugin (Plugin *parent, lay::LayoutView *view) + XORPlugin (Plugin *parent, lay::LayoutViewBase *view) : lay::Plugin (parent), mp_view (view) { mp_dialog = new lay::XORToolDialog (0); @@ -110,7 +110,7 @@ public: // .. nothing yet .. } - lay::Plugin *create_plugin (db::Manager *, lay::Dispatcher *root, lay::LayoutView *view) const + lay::Plugin *create_plugin (db::Manager *, lay::Dispatcher *root, lay::LayoutViewBase *view) const { return new XORPlugin (root, view); } diff --git a/src/plugins/tools/xor/lay_plugin/layXORToolDialog.cc b/src/plugins/tools/xor/lay_plugin/layXORToolDialog.cc index ff8c7888b..f5141f114 100644 --- a/src/plugins/tools/xor/lay_plugin/layXORToolDialog.cc +++ b/src/plugins/tools/xor/lay_plugin/layXORToolDialog.cc @@ -186,7 +186,7 @@ XORToolDialog::~XORToolDialog () } int -XORToolDialog::exec_dialog (lay::LayoutView *view) +XORToolDialog::exec_dialog (lay::LayoutViewBase *view) { mp_view = view; diff --git a/src/plugins/tools/xor/lay_plugin/layXORToolDialog.h b/src/plugins/tools/xor/lay_plugin/layXORToolDialog.h index adeb9fb1b..a5b0d52be 100644 --- a/src/plugins/tools/xor/lay_plugin/layXORToolDialog.h +++ b/src/plugins/tools/xor/lay_plugin/layXORToolDialog.h @@ -61,7 +61,7 @@ public: XORToolDialog (QWidget *parent); ~XORToolDialog (); - int exec_dialog (lay::LayoutView *view); + int exec_dialog (lay::LayoutViewBase *view); protected: void accept ();