From f788818d120aa06f85d9ea42ebbb4729de92bfaa Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Fri, 2 Sep 2022 22:46:44 +0200 Subject: [PATCH] Some more refactoring - further abstracting layout view from container widget --- src/edt/edt/edtMainService.cc | 26 +- src/edt/edt/edtRecentConfigurationPage.cc | 8 +- src/edt/edt/edtService.cc | 4 +- src/img/img/imgNavigator.cc | 24 +- src/img/img/imgNavigator.h | 8 +- src/lay/lay/layFillDialog.cc | 20 +- src/lay/lay/layFillDialog.h | 2 +- src/lay/lay/layMainWindow.cc | 132 ++++---- src/lay/lay/layMainWindow.h | 4 +- src/lay/lay/layNavigator.cc | 45 ++- src/lay/lay/layNavigator.h | 3 +- src/lay/lay/layViewWidgetStack.cc | 18 +- src/lay/lay/layViewWidgetStack.h | 8 +- src/laybasic/laybasic/layLayoutViewBase.cc | 16 - src/laybasic/laybasic/layLayoutViewBase.h | 18 +- src/laybasic/laybasic/layViewObject.cc | 6 +- src/layui/layui/layEditLineStylesForm.cc | 4 +- src/layui/layui/layEditLineStylesForm.h | 2 +- src/layui/layui/layEditStipplesForm.cc | 4 +- src/layui/layui/layEditStipplesForm.h | 2 +- src/layui/layui/layLayerToolbox.cc | 4 +- src/layui/layui/layLayerTreeModel.cc | 7 +- src/layui/layui/layLayerTreeModel.h | 1 + src/layui/layui/layLayoutViewFunctions.cc | 58 ++-- .../layview/gsiDeclLayLayoutView_qt.cc | 5 +- src/layview/layview/layLayoutView_qt.cc | 74 ++++- src/layview/layview/layLayoutView_qt.h | 282 +++++++++--------- .../lay_plugin/layBooleanOperationsPlugin.cc | 12 +- 28 files changed, 424 insertions(+), 373 deletions(-) diff --git a/src/edt/edt/edtMainService.cc b/src/edt/edt/edtMainService.cc index 3a0f52992..1ea0436cf 100644 --- a/src/edt/edt/edtMainService.cc +++ b/src/edt/edt/edtMainService.cc @@ -26,7 +26,7 @@ #include "dbLibrary.h" #include "dbLibraryManager.h" #include "tlExceptions.h" -#include "layLayoutViewBase.h" +#include "layLayoutView.h" #include "laySelector.h" #include "layFinder.h" #include "layLayerProperties.h" @@ -100,7 +100,7 @@ edt::RoundCornerOptionsDialog * MainService::round_corners_dialog () { if (! mp_round_corners_dialog) { - mp_round_corners_dialog = new edt::RoundCornerOptionsDialog (view ()->widget ()); + mp_round_corners_dialog = new edt::RoundCornerOptionsDialog (lay::widget_from_view (view ())); } return mp_round_corners_dialog; } @@ -109,7 +109,7 @@ edt::AlignOptionsDialog * MainService::align_options_dialog () { if (! mp_align_options_dialog) { - mp_align_options_dialog = new edt::AlignOptionsDialog (view ()->widget ()); + mp_align_options_dialog = new edt::AlignOptionsDialog (lay::widget_from_view (view ())); } return mp_align_options_dialog; } @@ -118,7 +118,7 @@ edt::DistributeOptionsDialog * MainService::distribute_options_dialog () { if (! mp_distribute_options_dialog) { - mp_distribute_options_dialog = new edt::DistributeOptionsDialog (view ()->widget ()); + mp_distribute_options_dialog = new edt::DistributeOptionsDialog (lay::widget_from_view (view ())); } return mp_distribute_options_dialog; } @@ -127,7 +127,7 @@ lay::FlattenInstOptionsDialog * MainService::flatten_inst_options_dialog () { if (! mp_flatten_inst_options_dialog) { - mp_flatten_inst_options_dialog = new lay::FlattenInstOptionsDialog (view ()->widget (), false /*don't allow pruning*/); + mp_flatten_inst_options_dialog = new lay::FlattenInstOptionsDialog (lay::widget_from_view (view ()), false /*don't allow pruning*/); } return mp_flatten_inst_options_dialog; } @@ -136,7 +136,7 @@ edt::MakeCellOptionsDialog * MainService::make_cell_options_dialog () { if (! mp_make_cell_options_dialog) { - mp_make_cell_options_dialog = new edt::MakeCellOptionsDialog (view ()->widget ()); + mp_make_cell_options_dialog = new edt::MakeCellOptionsDialog (lay::widget_from_view (view ())); } return mp_make_cell_options_dialog; } @@ -145,7 +145,7 @@ edt::MakeArrayOptionsDialog * MainService::make_array_options_dialog () { if (! mp_make_array_options_dialog) { - mp_make_array_options_dialog = new edt::MakeArrayOptionsDialog (view ()->widget ()); + mp_make_array_options_dialog = new edt::MakeArrayOptionsDialog (lay::widget_from_view (view ())); } return mp_make_array_options_dialog; } @@ -1228,7 +1228,7 @@ MainService::cm_convert_to_pcell () } bool ok = false; - QString item = QInputDialog::getItem (view ()->widget (), + QString item = QInputDialog::getItem (lay::widget_from_view (view ()), tr ("Select Target PCell"), tr ("Select the PCell the shape should be converted into"), items, 0, false, &ok); @@ -1333,7 +1333,7 @@ MainService::cm_convert_to_pcell () if (any_non_converted) { tl::warn << tl::to_string (tr ("Some of the shapes could not be converted to the desired PCell")); #if defined(HAVE_QT) - QMessageBox::warning (view ()->widget (), tr ("Warning"), tr ("Some of the shapes could not be converted to the desired PCell")); + QMessageBox::warning (lay::widget_from_view (view ()), tr ("Warning"), tr ("Some of the shapes could not be converted to the desired PCell")); #endif } @@ -1565,7 +1565,7 @@ MainService::cm_size () #if defined(HAVE_QT) // TODO: keep the value persistent so we can set it externally in the Qt-less case bool ok = false; - QString s = QInputDialog::getText (view ()->widget (), + QString s = QInputDialog::getText (lay::widget_from_view (view ()), tr ("Sizing"), tr ("Sizing (in micron, positive or negative). Two values (dx, dy) for anisotropic sizing."), QLineEdit::Normal, QString::fromUtf8 ("0.0"), @@ -2159,7 +2159,8 @@ MainService::cm_tap () #endif #if defined(HAVE_QT) - if (! view ()->canvas ()->widget ()) { + QWidget *view_widget = lay::widget_from_view (view ()); + if (! view_widget) { return; } #endif @@ -2202,7 +2203,8 @@ MainService::cm_tap () #if defined(HAVE_QT) // TODO: what to do here in Qt-less case? Store results in configuration so they can be retrieved externally? - std::unique_ptr menu (new QMenu (view ()->widget ())); + + std::unique_ptr menu (new QMenu (view_widget)); menu->show (); int icon_size = menu->style ()->pixelMetric (QStyle::PM_ButtonIconSize); diff --git a/src/edt/edt/edtRecentConfigurationPage.cc b/src/edt/edt/edtRecentConfigurationPage.cc index ee68dbd75..191ddbb5c 100644 --- a/src/edt/edt/edtRecentConfigurationPage.cc +++ b/src/edt/edt/edtRecentConfigurationPage.cc @@ -182,7 +182,7 @@ RecentConfigurationPage::render_to (QTreeWidgetItem *item, int column, const std case RecentConfigurationPage::Layer: { - int icon_size = view ()->widget ()->style ()->pixelMetric (QStyle::PM_ButtonIconSize); + int icon_size = item->treeWidget ()->style ()->pixelMetric (QStyle::PM_ButtonIconSize); lay::LayerPropertiesConstIterator l; try { l = lp_iter_from_string (view (), values [column]); @@ -348,7 +348,7 @@ RecentConfigurationPage::update_list (const std::list > } static bool -set_or_request_current_layer (lay::LayoutViewBase *view, unsigned int cv_index, const db::LayerProperties &lp) +set_or_request_current_layer (QWidget *parent, lay::LayoutViewBase *view, unsigned int cv_index, const db::LayerProperties &lp) { bool ok = view->set_current_layer (cv_index, lp); if (ok) { @@ -364,7 +364,7 @@ set_or_request_current_layer (lay::LayoutViewBase *view, unsigned int cv_index, return false; } - if (QMessageBox::question (view->widget (), tr ("Create Layer"), tr ("Layer %1 does not exist yet. Create it now?").arg (tl::to_qstring (lp.to_string ()))) == QMessageBox::Yes) { + if (QMessageBox::question (parent, tr ("Create Layer"), tr ("Layer %1 does not exist yet. Create it now?").arg (tl::to_qstring (lp.to_string ()))) == QMessageBox::Yes) { lay::LayerPropertiesNode lpn; lpn.set_source (lay::ParsedLayerSource (lp, cv_index)); @@ -400,7 +400,7 @@ RecentConfigurationPage::item_clicked (QTreeWidgetItem *item) ex.read (cv_index); } - set_or_request_current_layer (view (), cv_index, lp); + set_or_request_current_layer (item->treeWidget (), view (), cv_index, lp); } else { dispatcher ()->config_set (c->cfg_name, v); diff --git a/src/edt/edt/edtService.cc b/src/edt/edt/edtService.cc index 7ff291a1b..27a7f8b40 100644 --- a/src/edt/edt/edtService.cc +++ b/src/edt/edt/edtService.cc @@ -31,7 +31,7 @@ # include "edtDialogs.h" #endif #include "layFinder.h" -#include "layLayoutViewBase.h" +#include "layLayoutView.h" #include "laySnap.h" #include "tlProgress.h" #include "tlTimer.h" @@ -315,7 +315,7 @@ void Service::copy_selected () { #if defined(HAVE_QT) - edt::CopyModeDialog mode_dialog (view ()->widget ()); + edt::CopyModeDialog mode_dialog (lay::widget_from_view (view ())); bool need_to_ask_for_copy_mode = false; unsigned int inst_mode = 0; diff --git a/src/img/img/imgNavigator.cc b/src/img/img/imgNavigator.cc index 8eb7dee63..9e0b16dc3 100644 --- a/src/img/img/imgNavigator.cc +++ b/src/img/img/imgNavigator.cc @@ -52,26 +52,25 @@ img::Object * Navigator::setup (lay::Dispatcher *root, img::Object *img) { mp_view = new lay::LayoutViewWidget (0, false, root, this, lay::LayoutView::LV_Naked + lay::LayoutView::LV_NoZoom + lay::LayoutView::LV_NoServices + lay::LayoutView::LV_NoGrid); - tl_assert (mp_view->widget ()); - mp_view->widget ()->setSizePolicy (QSizePolicy::Expanding, QSizePolicy::Expanding); - mp_view->widget ()->setMinimumWidth (100); - mp_view->widget ()->setMinimumHeight (100); + mp_view->setSizePolicy (QSizePolicy::Expanding, QSizePolicy::Expanding); + mp_view->setMinimumWidth (100); + mp_view->setMinimumHeight (100); QVBoxLayout *layout = new QVBoxLayout (this); - layout->addWidget (mp_view->widget ()); - layout->setStretchFactor (mp_view->widget (), 1); + layout->addWidget (mp_view); + layout->setStretchFactor (mp_view, 1); layout->setContentsMargins (0, 0, 0, 0); layout->setSpacing (0); setLayout (layout); - mp_zoom_service = new lay::ZoomService (mp_view); + mp_zoom_service = new lay::ZoomService (view ()); - img::Service *img_target = mp_view->get_plugin (); + img::Service *img_target = view ()->get_plugin (); if (img_target) { img_target->clear_images (); img::Object *img_object = img_target->insert_image (*img); img_object->set_matrix (db::Matrix3d (1.0)); - mp_view->zoom_fit (); + view ()->zoom_fit (); return img_object; } else { return 0; @@ -91,10 +90,15 @@ Navigator::~Navigator () } } +lay::LayoutView *Navigator::view () +{ + return mp_view->view (); +} + void Navigator::activate_service (lay::ViewService *service) { - mp_view->canvas ()->activate (service); + view ()->canvas ()->activate (service); } void diff --git a/src/img/img/imgNavigator.h b/src/img/img/imgNavigator.h index e9c70ffdc..00ecd7650 100644 --- a/src/img/img/imgNavigator.h +++ b/src/img/img/imgNavigator.h @@ -30,6 +30,7 @@ namespace lay { class Dispatcher; + class LayoutViewWidget; class LayoutView; class ZoomService; class ViewService; @@ -55,15 +56,12 @@ public: void background_color (QColor c); img::Object *setup (lay::Dispatcher *root, img::Object *img); - lay::LayoutView *view () - { - return mp_view; - } + lay::LayoutView *view (); void activate_service (lay::ViewService *service); private: - lay::LayoutView *mp_view; + lay::LayoutViewWidget *mp_view; lay::ZoomService *mp_zoom_service; }; diff --git a/src/lay/lay/layFillDialog.cc b/src/lay/lay/layFillDialog.cc index 1d8a31471..c8536b8f5 100644 --- a/src/lay/lay/layFillDialog.cc +++ b/src/lay/lay/layFillDialog.cc @@ -63,14 +63,14 @@ 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::LayoutViewBase *view) const - { - if (lay::has_gui ()) { - return new FillDialog (view); - } else { - return 0; - } - } + virtual lay::Plugin *create_plugin (db::Manager *, lay::Dispatcher *, lay::LayoutViewBase *view) const + { + if (lay::has_gui ()) { + return new FillDialog (lay::MainWindow::instance (), view); + } else { + return 0; + } + } }; static tl::RegisteredClass config_decl (new FillDialogPluginDeclaration (), 20000, "FillDialogPlugin"); @@ -78,8 +78,8 @@ static tl::RegisteredClass config_decl (new FillDialogPl // ------------------------------------------------------------ -FillDialog::FillDialog (LayoutViewBase *view) - : QDialog (view->widget ()), +FillDialog::FillDialog (QWidget *parent, LayoutViewBase *view) + : QDialog (parent), lay::Plugin (view), Ui::FillDialog (), mp_view (view) diff --git a/src/lay/lay/layFillDialog.h b/src/lay/lay/layFillDialog.h index c3afebe68..f734e6a7c 100644 --- a/src/lay/lay/layFillDialog.h +++ b/src/lay/lay/layFillDialog.h @@ -76,7 +76,7 @@ class LAY_PUBLIC FillDialog Q_OBJECT public: - FillDialog (lay::LayoutViewBase *view); + FillDialog (QWidget *parent, lay::LayoutViewBase *view); ~FillDialog (); public slots: diff --git a/src/lay/lay/layMainWindow.cc b/src/lay/lay/layMainWindow.cc index 17d9af300..851db07bc 100644 --- a/src/lay/lay/layMainWindow.cc +++ b/src/lay/lay/layMainWindow.cc @@ -594,18 +594,18 @@ BEGIN_PROTECTED m_file_changed_timer.blockSignals (false); - std::map > views_per_file; + std::map > views_per_file; - for (std::vector::iterator v = mp_views.begin (); v != mp_views.end (); ++v) { - for (int cv = 0; cv < int ((*v)->cellviews ()); ++cv) { - views_per_file [tl::to_qstring ((*v)->cellview (cv)->filename ())] = std::make_pair (*v, cv); + for (std::vector::iterator v = mp_views.begin (); v != mp_views.end (); ++v) { + for (int cv = 0; cv < int ((*v)->view ()->cellviews ()); ++cv) { + views_per_file [tl::to_qstring ((*v)->view ()->cellview (cv)->filename ())] = std::make_pair (*v, cv); } } for (std::vector::const_iterator f = changed_files.begin (); f != changed_files.end (); ++f) { - std::map >::const_iterator v = views_per_file.find (*f); + std::map >::const_iterator v = views_per_file.find (*f); if (v != views_per_file.end ()) { - v->second.first->reload_layout (v->second.second); + v->second.first->view ()->reload_layout (v->second.second); reloaded_files.insert (*f); } } @@ -675,7 +675,7 @@ MainWindow::close_all () current_view_changed (); for (unsigned int i = 0; i < mp_views.size (); ++i) { - mp_views [i]->stop (); + mp_views [i]->view ()->stop (); } m_manager.clear (); @@ -695,7 +695,7 @@ MainWindow::close_all () view_closed_event (int (mp_views.size () - 1)); - lay::LayoutView *view = mp_views.back (); + lay::LayoutViewWidget *view = mp_views.back (); mp_views.pop_back (); mp_lp_stack->remove_widget (mp_views.size ()); mp_hp_stack->remove_widget (mp_views.size ()); @@ -1333,9 +1333,9 @@ MainWindow::libraries_changed () { // if the libraries have changed, remove all selections and cancel any operations to avoid // that the view refers to an invalid instance or shape - for (std::vector ::iterator vp = mp_views.begin (); vp != mp_views.end (); ++vp) { - (*vp)->clear_selection (); - (*vp)->cancel (); + for (std::vector ::iterator vp = mp_views.begin (); vp != mp_views.end (); ++vp) { + (*vp)->view ()->clear_selection (); + (*vp)->view ()->cancel (); } } @@ -1650,7 +1650,7 @@ lay::LayoutView * MainWindow::view (int index) { if (index >= 0 && index < int (mp_views.size ())) { - return mp_views [index]; + return mp_views [index]->view (); } else { return 0; } @@ -1660,7 +1660,7 @@ const lay::LayoutView * MainWindow::view (int index) const { if (index >= 0 && index < int (mp_views.size ())) { - return mp_views [index]; + return mp_views [index]->view (); } else { return 0; } @@ -1670,7 +1670,7 @@ int MainWindow::index_of (const lay::LayoutView *view) const { for (int i = 0; i < int (mp_views.size ()); ++i) { - if (mp_views [i] == view) { + if (mp_views [i]->view () == view) { return i; } } @@ -1696,8 +1696,8 @@ MainWindow::select_mode (int m) if (m_mode != m) { m_mode = m; - for (std::vector ::iterator vp = mp_views.begin (); vp != mp_views.end (); ++vp) { - (*vp)->mode (m); + for (std::vector ::iterator vp = mp_views.begin (); vp != mp_views.end (); ++vp) { + (*vp)->view ()->mode (m); } // Update the actions by checking the one that is selected programmatically. Use the toolbar menu for reference. @@ -1753,9 +1753,9 @@ void MainWindow::cm_undo () { if (current_view () && m_manager.available_undo ().first) { - for (std::vector ::iterator vp = mp_views.begin (); vp != mp_views.end (); ++vp) { - (*vp)->clear_selection (); - (*vp)->cancel (); + for (std::vector ::iterator vp = mp_views.begin (); vp != mp_views.end (); ++vp) { + (*vp)->view ()->clear_selection (); + (*vp)->view ()->cancel (); } m_manager.undo (); } @@ -1765,9 +1765,9 @@ void MainWindow::cm_redo () { if (current_view () && m_manager.available_redo ().first) { - for (std::vector ::iterator vp = mp_views.begin (); vp != mp_views.end (); ++vp) { - (*vp)->clear_selection (); - (*vp)->cancel (); + for (std::vector ::iterator vp = mp_views.begin (); vp != mp_views.end (); ++vp) { + (*vp)->view ()->clear_selection (); + (*vp)->view ()->cancel (); } m_manager.redo (); } @@ -1964,8 +1964,8 @@ MainWindow::cancel () m_manager.commit (); } - for (std::vector ::iterator vp = mp_views.begin (); vp != mp_views.end (); ++vp) { - (*vp)->cancel (); + for (std::vector ::iterator vp = mp_views.begin (); vp != mp_views.end (); ++vp) { + (*vp)->view ()->cancel (); } select_mode (lay::LayoutView::default_mode ()); @@ -1975,8 +1975,8 @@ void MainWindow::load_layer_properties (const std::string &fn, bool all_views, bool add_default) { if (all_views) { - for (std::vector ::iterator vp = mp_views.begin (); vp != mp_views.end (); ++vp) { - (*vp)->load_layer_props (fn, add_default); + for (std::vector ::iterator vp = mp_views.begin (); vp != mp_views.end (); ++vp) { + (*vp)->view ()->load_layer_props (fn, add_default); } } else if (current_view ()) { current_view ()->load_layer_props (fn, add_default); @@ -1987,8 +1987,8 @@ void MainWindow::load_layer_properties (const std::string &fn, int cv_index, bool all_views, bool add_default) { if (all_views) { - for (std::vector ::iterator vp = mp_views.begin (); vp != mp_views.end (); ++vp) { - (*vp)->load_layer_props (fn, cv_index, add_default); + for (std::vector ::iterator vp = mp_views.begin (); vp != mp_views.end (); ++vp) { + (*vp)->view ()->load_layer_props (fn, cv_index, add_default); } } else if (current_view ()) { current_view ()->load_layer_props (fn, cv_index, add_default); @@ -2571,15 +2571,17 @@ MainWindow::cm_clone () void MainWindow::clone_current_view () { - lay::LayoutView *view = 0; + lay::LayoutViewWidget *view_widget = 0; lay::LayoutView *curr = current_view (); if (! curr) { throw tl::Exception (tl::to_string (QObject::tr ("No view open to clone"))); } // create a new view - view = new lay::LayoutViewWidget (current_view (), &m_manager, lay::ApplicationBase::instance ()->is_editable (), dispatcher (), mp_view_stack); - add_view (view); + view_widget = new lay::LayoutViewWidget (current_view (), &m_manager, lay::ApplicationBase::instance ()->is_editable (), dispatcher (), mp_view_stack); + add_view (view_widget); + + lay::LayoutView *view = view_widget->view (); // set initial attributes view->set_hier_levels (curr->get_hier_levels ()); @@ -2598,16 +2600,16 @@ MainWindow::clone_current_view () view->update_content (); - mp_views.back ()->set_current (); + mp_views.back ()->view ()->set_current (); mp_layer_toolbox->set_view (current_view ()); - mp_view_stack->add_widget (view); - mp_lp_stack->add_widget (view->layer_control_frame ()); - mp_hp_stack->add_widget (view->hierarchy_control_frame ()); - mp_libs_stack->add_widget (view->libraries_frame ()); - mp_eo_stack->add_widget (view->editor_options_frame ()); - mp_bm_stack->add_widget (view->bookmarks_frame ()); + mp_view_stack->add_widget (view_widget); + mp_lp_stack->add_widget (view_widget->layer_control_frame ()); + mp_hp_stack->add_widget (view_widget->hierarchy_control_frame ()); + mp_libs_stack->add_widget (view_widget->libraries_frame ()); + mp_eo_stack->add_widget (view_widget->editor_options_frame ()); + mp_bm_stack->add_widget (view_widget->bookmarks_frame ()); bool f = m_disable_tab_selected; m_disable_tab_selected = true; @@ -2752,9 +2754,9 @@ MainWindow::interactive_close_view (int index, bool all_cellviews) int count = 0; - for (std::vector ::const_iterator v = mp_views.begin (); v != mp_views.end (); ++v) { - for (unsigned int cvi = 0; cvi < (*v)->cellviews (); ++cvi) { - if ((*v)->cellview (cvi)->name () == name) { + for (std::vector ::const_iterator v = mp_views.begin (); v != mp_views.end (); ++v) { + for (unsigned int cvi = 0; cvi < (*v)->view ()->cellviews (); ++cvi) { + if ((*v)->view ()->cellview (cvi)->name () == name) { ++count; } } @@ -2863,7 +2865,7 @@ MainWindow::close_view (int index) view_closed_event (int (index)); // delete the view later as it may still be needed by event handlers or similar - std::unique_ptr old_view (view (index)); + std::unique_ptr old_view (mp_views [index]); mp_views.erase (mp_views.begin () + index, mp_views.begin () + index + 1); @@ -3364,33 +3366,33 @@ MainWindow::create_layout (const std::string &technology, int mode) } void -MainWindow::add_view (lay::LayoutView *view) +MainWindow::add_view (lay::LayoutViewWidget *view) { - tl_assert (view->widget ()); - - connect (view->widget (), SIGNAL (title_changed (lay::LayoutView *)), this, SLOT (view_title_changed (lay::LayoutView *))); - connect (view->widget (), SIGNAL (dirty_changed (lay::LayoutView *)), this, SLOT (view_title_changed (lay::LayoutView *))); - connect (view->widget (), SIGNAL (edits_enabled_changed ()), this, SLOT (edits_enabled_changed ())); - connect (view->widget (), SIGNAL (menu_needs_update ()), this, SLOT (menu_needs_update ())); - connect (view->widget (), SIGNAL (show_message (const std::string &, int)), this, SLOT (message (const std::string &, int))); - connect (view->widget (), SIGNAL (current_pos_changed (double, double, bool)), this, SLOT (current_pos (double, double, bool))); - connect (view->widget (), SIGNAL (clear_current_pos ()), this, SLOT (clear_current_pos ())); - connect (view->widget (), SIGNAL (mode_change (int)), this, SLOT (select_mode (int))); + connect (view, SIGNAL (title_changed (lay::LayoutView *)), this, SLOT (view_title_changed (lay::LayoutView *))); + connect (view, SIGNAL (dirty_changed (lay::LayoutView *)), this, SLOT (view_title_changed (lay::LayoutView *))); + connect (view, SIGNAL (edits_enabled_changed ()), this, SLOT (edits_enabled_changed ())); + connect (view, SIGNAL (menu_needs_update ()), this, SLOT (menu_needs_update ())); + connect (view, SIGNAL (show_message (const std::string &, int)), this, SLOT (message (const std::string &, int))); + connect (view, SIGNAL (current_pos_changed (double, double, bool)), this, SLOT (current_pos (double, double, bool))); + connect (view, SIGNAL (clear_current_pos ()), this, SLOT (clear_current_pos ())); + connect (view, SIGNAL (mode_change (int)), this, SLOT (select_mode (int))); mp_views.push_back (view); // we must resize the widget here to set the geometry properly. // This is required to make zoom_fit work. - view->widget ()->setGeometry (0, 0, mp_view_stack->width (), mp_view_stack->height ()); - view->widget ()->show (); + view->setGeometry (0, 0, mp_view_stack->width (), mp_view_stack->height ()); + view->show (); } int MainWindow::do_create_view () { // create a new view - lay::LayoutViewWidget *view = new lay::LayoutViewWidget (&m_manager, lay::ApplicationBase::instance ()->is_editable (), dispatcher (), mp_view_stack); - add_view (view); + lay::LayoutViewWidget *view_widget = new lay::LayoutViewWidget (&m_manager, lay::ApplicationBase::instance ()->is_editable (), dispatcher (), mp_view_stack); + add_view (view_widget); + + lay::LayoutView *view = view_widget->view (); // set initial attributes view->set_synchronous (synchronous ()); @@ -3416,7 +3418,7 @@ MainWindow::create_view () int view_index = do_create_view (); // add a new tab and make the new view the current one - mp_views.back ()->set_current (); + mp_views.back ()->view ()->set_current (); mp_layer_toolbox->set_view (current_view ()); @@ -3480,7 +3482,7 @@ MainWindow::create_or_load_layout (const std::string *filename, const db::LoadLa // make the new view the current one if (mode == 1) { - mp_views.back ()->set_current (); + mp_views.back ()->view ()->set_current (); mp_layer_toolbox->set_view (current_view ()); @@ -3640,8 +3642,8 @@ void MainWindow::set_synchronous (bool sync_mode) { m_synchronous = sync_mode; - for (std::vector ::iterator vp = mp_views.begin (); vp != mp_views.end (); ++vp) { - (*vp)->set_synchronous (sync_mode); + for (std::vector ::iterator vp = mp_views.begin (); vp != mp_views.end (); ++vp) { + (*vp)->view ()->set_synchronous (sync_mode); } } @@ -4187,8 +4189,8 @@ MainWindow::plugin_registered (lay::PluginDeclaration *cls) cls->init_menu (dispatcher ()); // recreate all plugins - for (std::vector ::iterator vp = mp_views.begin (); vp != mp_views.end (); ++vp) { - (*vp)->create_plugins (); + for (std::vector ::iterator vp = mp_views.begin (); vp != mp_views.end (); ++vp) { + (*vp)->view ()->create_plugins (); } } @@ -4198,8 +4200,8 @@ MainWindow::plugin_removed (lay::PluginDeclaration *cls) cls->remove_menu_items (dispatcher ()); // recreate all plugins except the one that got removed - for (std::vector ::iterator vp = mp_views.begin (); vp != mp_views.end (); ++vp) { - (*vp)->create_plugins (cls); + for (std::vector ::iterator vp = mp_views.begin (); vp != mp_views.end (); ++vp) { + (*vp)->view ()->create_plugins (cls); } } diff --git a/src/lay/lay/layMainWindow.h b/src/lay/lay/layMainWindow.h index 21f6d9996..c1df91385 100644 --- a/src/lay/lay/layMainWindow.h +++ b/src/lay/lay/layMainWindow.h @@ -703,7 +703,7 @@ private: lay::LogViewerDialog *mp_log_viewer_dialog; int m_mode; SettingsForm *mp_setup_form; - std::vector mp_views; + std::vector mp_views; int m_open_mode; int m_keep_backups; std::vector > m_mru; @@ -808,7 +808,7 @@ private: void current_view_changed (); void update_window_title (); void update_tab_title (int i); - void add_view (LayoutView *view); + void add_view (LayoutViewWidget *view); bool can_close (); lay::CellViewRef create_or_load_layout (const std::string *filename, const db::LoadLayoutOptions *options, const std::string &tech, const int mode); diff --git a/src/lay/lay/layNavigator.cc b/src/lay/lay/layNavigator.cc index ea338d1ef..809a74dea 100644 --- a/src/lay/lay/layNavigator.cc +++ b/src/lay/lay/layNavigator.cc @@ -630,8 +630,8 @@ Navigator::view_closed (int index) void Navigator::resizeEvent (QResizeEvent *) { - if (mp_view && mp_view->widget ()) { - mp_view->widget ()->setGeometry (mp_placeholder_label->geometry ()); + if (mp_view) { + mp_view->setGeometry (mp_placeholder_label->geometry ()); } } @@ -650,21 +650,20 @@ Navigator::attach_view (LayoutView *view) delete mp_service; mp_service = 0; - LayoutView *old_view = mp_view; + LayoutViewWidget *old_view = mp_view; mp_view = 0; if (mp_source_view) { mp_view = new LayoutViewWidget (0, false, mp_source_view, this, LayoutView::LV_Naked + LayoutView::LV_NoZoom + LayoutView::LV_NoServices + LayoutView::LV_NoGrid); - tl_assert (mp_view->widget ()); - mp_view->widget ()->setSizePolicy (QSizePolicy::Expanding, QSizePolicy::Expanding); - mp_view->widget ()->setMinimumWidth (100); - mp_view->widget ()->setMinimumHeight (100); - mp_view->widget ()->setGeometry (mp_placeholder_label->geometry ()); - mp_view->widget ()->show (); + mp_view->setSizePolicy (QSizePolicy::Expanding, QSizePolicy::Expanding); + mp_view->setMinimumWidth (100); + mp_view->setMinimumHeight (100); + mp_view->setGeometry (mp_placeholder_label->geometry ()); + mp_view->show (); - mp_service = new NavigatorService (mp_view); - mp_view->canvas ()->activate (mp_service); + mp_service = new NavigatorService (mp_view->view ()); + mp_view->view ()->canvas ()->activate (mp_service); mp_source_view->cellviews_changed_event.add (this, &Navigator::content_changed); mp_source_view->cellview_changed_event.add (this, &Navigator::content_changed_with_int); @@ -714,7 +713,7 @@ void Navigator::hier_levels_changed () { if (m_show_all_hier_levels && mp_source_view && m_frozen_list.find (mp_source_view) == m_frozen_list.end ()) { - mp_view->set_hier_levels (mp_source_view->get_hier_levels ()); + mp_view->view ()->set_hier_levels (mp_source_view->get_hier_levels ()); } } @@ -729,19 +728,19 @@ Navigator::update_layers () void Navigator::update () { - if (! mp_view || ! mp_source_view) { + if (! mp_view || ! mp_view->view () || ! mp_source_view) { return; } if (m_frozen_list.find (mp_source_view) == m_frozen_list.end ()) { - mp_view->select_cellviews (mp_source_view->cellview_list ()); - mp_view->set_properties (mp_source_view->get_properties ()); + mp_view->view ()->select_cellviews (mp_source_view->cellview_list ()); + mp_view->view ()->set_properties (mp_source_view->get_properties ()); } else { - mp_view->select_cellviews (mp_source_view->cellview_list ()); - mp_view->set_properties (m_frozen_list [mp_source_view].layer_properties); + mp_view->view ()->select_cellviews (mp_source_view->cellview_list ()); + mp_view->view ()->set_properties (m_frozen_list [mp_source_view].layer_properties); } - img::Service *img_target = mp_view->get_plugin (); + img::Service *img_target = mp_view->view ()->get_plugin (); if (img_target) { img_target->clear_images (); @@ -759,16 +758,16 @@ Navigator::update () if (m_show_all_hier_levels && mp_source_view) { if (m_frozen_list.find (mp_source_view) == m_frozen_list.end ()) { - mp_view->set_hier_levels (mp_source_view->get_hier_levels ()); + mp_view->view ()->set_hier_levels (mp_source_view->get_hier_levels ()); } else { - mp_view->set_hier_levels (m_frozen_list [mp_source_view].hierarchy_levels); + mp_view->view ()->set_hier_levels (m_frozen_list [mp_source_view].hierarchy_levels); } } else { - mp_view->set_hier_levels (std::make_pair (0, 0)); + mp_view->view ()->set_hier_levels (std::make_pair (0, 0)); } - mp_view->zoom_fit (); - mp_view->update_content (); + mp_view->view ()->zoom_fit (); + mp_view->view ()->update_content (); mp_service->update_marker (); } diff --git a/src/lay/lay/layNavigator.h b/src/lay/lay/layNavigator.h index 774289f95..ec4bea599 100644 --- a/src/lay/lay/layNavigator.h +++ b/src/lay/lay/layNavigator.h @@ -41,6 +41,7 @@ namespace lay class MainWindow; class LayoutView; +class LayoutViewWidget; class AbstractMenu; class DMarker; class NavigatorService; @@ -98,7 +99,7 @@ private: bool m_update_layers_needed; bool m_update_needed; MainWindow *mp_main_window; - LayoutView *mp_view; + LayoutViewWidget *mp_view; QLabel *mp_placeholder_label; QFrame *mp_menu_bar; LayoutView *mp_source_view; diff --git a/src/lay/lay/layViewWidgetStack.cc b/src/lay/lay/layViewWidgetStack.cc index d99f3c098..e9901c7eb 100644 --- a/src/lay/lay/layViewWidgetStack.cc +++ b/src/lay/lay/layViewWidgetStack.cc @@ -40,12 +40,12 @@ ViewWidgetStack::ViewWidgetStack (QWidget *parent, const char *name) mp_bglabel->show (); } -void ViewWidgetStack::add_widget (LayoutView *w) +void ViewWidgetStack::add_widget (LayoutViewWidget *w) { - tl_assert (w->widget ()); + tl_assert (w); m_widgets.push_back (w); - w->widget ()->setParent (this); + w->setParent (this); resize_children (); raise_widget (m_widgets.size () - 1); @@ -66,20 +66,20 @@ void ViewWidgetStack::raise_widget (size_t index) { if (index < m_widgets.size ()) { mp_bglabel->hide (); - m_widgets [index]->widget ()->show (); + m_widgets [index]->show (); } else { mp_bglabel->show (); } size_t i = 0; - for (std::vector ::iterator child = m_widgets.begin (); child != m_widgets.end (); ++child, ++i) { + for (std::vector ::iterator child = m_widgets.begin (); child != m_widgets.end (); ++child, ++i) { if (i != index) { - (*child)->widget ()->hide (); + (*child)->hide (); } } } -LayoutView *ViewWidgetStack::widget (size_t index) +LayoutViewWidget *ViewWidgetStack::widget (size_t index) { if (index < m_widgets.size ()) { return m_widgets [index]; @@ -96,8 +96,8 @@ QWidget *ViewWidgetStack::background_widget () void ViewWidgetStack::resize_children () { // set the geometry of all children - for (std::vector ::iterator child = m_widgets.begin (); child != m_widgets.end (); ++child) { - (*child)->widget ()->setGeometry (0, 0, width (), height ()); + for (std::vector ::iterator child = m_widgets.begin (); child != m_widgets.end (); ++child) { + (*child)->setGeometry (0, 0, width (), height ()); } mp_bglabel->setGeometry (0, 0, width (), height ()); } diff --git a/src/lay/lay/layViewWidgetStack.h b/src/lay/lay/layViewWidgetStack.h index 7d7f66894..f8fd55889 100644 --- a/src/lay/lay/layViewWidgetStack.h +++ b/src/lay/lay/layViewWidgetStack.h @@ -33,7 +33,7 @@ class QLabel; namespace lay { -class LayoutView; +class LayoutViewWidget; class ViewWidgetStack : public QWidget @@ -41,10 +41,10 @@ class ViewWidgetStack public: ViewWidgetStack (QWidget *parent = 0, const char *name = 0); - void add_widget (LayoutView *w); + void add_widget (lay::LayoutViewWidget *w); void remove_widget (size_t index); void raise_widget (size_t index); - LayoutView *widget (size_t index); + LayoutViewWidget *widget (size_t index); QWidget *background_widget (); protected: @@ -55,7 +55,7 @@ protected: void resize_children (); - std::vector m_widgets; + std::vector m_widgets; QLabel *mp_bglabel; }; diff --git a/src/laybasic/laybasic/layLayoutViewBase.cc b/src/laybasic/laybasic/layLayoutViewBase.cc index 89f087a31..859156ca1 100644 --- a/src/laybasic/laybasic/layLayoutViewBase.cc +++ b/src/laybasic/laybasic/layLayoutViewBase.cc @@ -413,15 +413,7 @@ LayoutViewBase::finish () { // if we're the root dispatcher initialize the menu and build the context menus. No other menus are built so far. if (dispatcher () == this) { -#if defined(HAVE_QT) - set_menu_parent_widget (widget ()); init_menu (); - if (widget ()) { - menu ()->build (0, 0); - } -#else - init_menu (); -#endif } } @@ -3457,14 +3449,6 @@ LayoutViewBase::box () const return mp_canvas->viewport ().box (); } -#if defined(HAVE_QT) -QWidget * -LayoutViewBase::widget () -{ - return 0; -} -#endif - LayoutView * LayoutViewBase::get_ui () { diff --git a/src/laybasic/laybasic/layLayoutViewBase.h b/src/laybasic/laybasic/layLayoutViewBase.h index 7ad6ba773..0ed2f28cf 100644 --- a/src/laybasic/laybasic/layLayoutViewBase.h +++ b/src/laybasic/laybasic/layLayoutViewBase.h @@ -1662,10 +1662,6 @@ public: /** * @brief Gets the canvas object (where the layout is drawn and view objects are placed) - * - * This method intentionally delivers the ViewObjectWidget, not the - * LayoutCanvas to emphasize that the LayoutCanvas object shall not - * be modified. */ lay::LayoutCanvas *canvas () { @@ -1690,7 +1686,7 @@ public: } /** - * @brief Gets the hierarchy panel + * @brief Gets the editor options page */ virtual lay::EditorOptionsPages *editor_options_pages () { @@ -1863,9 +1859,6 @@ public: /** * @brief Get the Drawings interface - * - * Although the Drawings interface is implemented by LayoutCanvas, - * it is a different interface from ViewObjectWidget. */ lay::Drawings *drawings () { @@ -2647,13 +2640,6 @@ public: virtual void deactivate_all_browsers (); -#if defined(HAVE_QT) - /** - * @brief Gets the QWidget interface - */ - virtual QWidget *widget (); -#endif - /** * @brief Gets the LayoutView interface */ @@ -2866,9 +2852,9 @@ protected: void free_resources (); void shutdown (); - void finish (); void init_menu (); + virtual void finish (); virtual tl::Color default_background_color (); virtual void do_set_background_color (tl::Color color, tl::Color contrast); virtual void do_paste (); diff --git a/src/laybasic/laybasic/layViewObject.cc b/src/laybasic/laybasic/layViewObject.cc index c5167dd38..322e875bb 100644 --- a/src/laybasic/laybasic/layViewObject.cc +++ b/src/laybasic/laybasic/layViewObject.cc @@ -216,8 +216,8 @@ ViewService::set_cursor (lay::Cursor::cursor_shape cursor) class ViewObjectQWidget : public QWidget { public: - ViewObjectQWidget (ViewObjectUI *view) - : QWidget (), mp_view (view) + ViewObjectQWidget (QWidget *parent, ViewObjectUI *view) + : QWidget (parent), mp_view (view) { // .. nothing yet .. } @@ -529,7 +529,7 @@ ViewObjectUI::init_ui (QWidget *parent) tl_assert (parent != 0); tl_assert (mp_widget == 0); - mp_widget = new ViewObjectQWidget (this); + mp_widget = new ViewObjectQWidget (parent, this); mp_widget->setMouseTracking (true); mp_widget->setAcceptDrops (true); } diff --git a/src/layui/layui/layEditLineStylesForm.cc b/src/layui/layui/layEditLineStylesForm.cc index ece6f7bca..7b2f90eda 100644 --- a/src/layui/layui/layEditLineStylesForm.cc +++ b/src/layui/layui/layEditLineStylesForm.cc @@ -50,8 +50,8 @@ struct CurrentStyleOp int prev_index, new_index; }; -EditLineStylesForm::EditLineStylesForm (lay::LayoutViewBase *view, const lay::LineStyles &styles) - : QDialog (view->widget ()), db::Object (0), +EditLineStylesForm::EditLineStylesForm (QWidget *parent, lay::LayoutViewBase *view, const lay::LineStyles &styles) + : QDialog (parent), db::Object (0), m_selected (-1), m_styles (styles), m_manager (true), mp_view (view) { m_selection_changed_enabled = false; diff --git a/src/layui/layui/layEditLineStylesForm.h b/src/layui/layui/layEditLineStylesForm.h index 1eab57563..e3b6916b6 100644 --- a/src/layui/layui/layEditLineStylesForm.h +++ b/src/layui/layui/layEditLineStylesForm.h @@ -48,7 +48,7 @@ class EditLineStylesForm Q_OBJECT public: - EditLineStylesForm (lay::LayoutViewBase *view, const lay::LineStyles &styles); + EditLineStylesForm (QWidget *parent, lay::LayoutViewBase *view, const lay::LineStyles &styles); ~EditLineStylesForm (); // ... diff --git a/src/layui/layui/layEditStipplesForm.cc b/src/layui/layui/layEditStipplesForm.cc index eef978271..b139372a4 100644 --- a/src/layui/layui/layEditStipplesForm.cc +++ b/src/layui/layui/layEditStipplesForm.cc @@ -50,8 +50,8 @@ struct CurrentPatternOp int prev_index, new_index; }; -EditStipplesForm::EditStipplesForm (lay::LayoutViewBase *view, const lay::DitherPattern &pattern) - : QDialog (view->widget ()), db::Object (0), +EditStipplesForm::EditStipplesForm (QWidget *parent, lay::LayoutViewBase *view, const lay::DitherPattern &pattern) + : QDialog (parent), db::Object (0), m_selected (-1), m_pattern (pattern), m_manager (true), mp_view (view) { m_selection_changed_enabled = false; diff --git a/src/layui/layui/layEditStipplesForm.h b/src/layui/layui/layEditStipplesForm.h index 9d3e55cd0..627e00a14 100644 --- a/src/layui/layui/layEditStipplesForm.h +++ b/src/layui/layui/layEditStipplesForm.h @@ -48,7 +48,7 @@ class EditStipplesForm Q_OBJECT public: - EditStipplesForm (lay::LayoutViewBase *view, const lay::DitherPattern &pattern); + EditStipplesForm (QWidget *parent, lay::LayoutViewBase *view, const lay::DitherPattern &pattern); ~EditStipplesForm (); // ... diff --git a/src/layui/layui/layLayerToolbox.cc b/src/layui/layui/layLayerToolbox.cc index 416858fdd..ab19c19c5 100644 --- a/src/layui/layui/layLayerToolbox.cc +++ b/src/layui/layui/layLayerToolbox.cc @@ -258,7 +258,7 @@ LCPDitherPalette::button_clicked (int index) // edit pattern lay::DitherPattern pattern (mp_view->dither_pattern ()); - lay::EditStipplesForm stipples_form (mp_view, pattern); + lay::EditStipplesForm stipples_form (this, mp_view, pattern); if (stipples_form.exec () && stipples_form.pattern () != pattern) { emit pattern_changed (stipples_form.pattern ()); } @@ -686,7 +686,7 @@ LCPStylePalette::button_clicked (int index) // edit pattern lay::LineStyles styles (mp_view->line_styles ()); - lay::EditLineStylesForm line_styles_form (mp_view, styles); + lay::EditLineStylesForm line_styles_form (this, mp_view, styles); if (line_styles_form.exec () && line_styles_form.styles () != styles) { emit line_styles_changed (line_styles_form.styles ()); } diff --git a/src/layui/layui/layLayerTreeModel.cc b/src/layui/layui/layLayerTreeModel.cc index 789e70b02..383d75fd3 100644 --- a/src/layui/layui/layLayerTreeModel.cc +++ b/src/layui/layui/layLayerTreeModel.cc @@ -181,7 +181,8 @@ EmptyWithinViewCache::determine_empty_layers (const db::Layout *layout, unsigned LayerTreeModel::LayerTreeModel (QWidget *parent, lay::LayoutViewBase *view) : QAbstractItemModel (parent), - mp_view (view), m_filter_mode (false), m_id_start (0), m_id_end (0), m_phase ((unsigned int) -1), m_test_shapes_in_view (false), m_hide_empty_layers (false) + mp_parent (parent), mp_view (view), m_filter_mode (false), m_id_start (0), m_id_end (0), + m_phase ((unsigned int) -1), m_test_shapes_in_view (false), m_hide_empty_layers (false) { // .. nothing yet .. } @@ -849,9 +850,9 @@ LayerTreeModel::data (const QModelIndex &index, int role) const } else if (role == Qt::BackgroundRole) { - if (m_selected_ids.find (size_t (index.internalPointer ())) != m_selected_ids.end ()) { + if (mp_parent && m_selected_ids.find (size_t (index.internalPointer ())) != m_selected_ids.end ()) { // for selected items pick a color between Highlight and Base - QPalette pl (mp_view->widget ()->palette ()); + QPalette pl (mp_parent->palette ()); QColor c1 = pl.color (QPalette::Highlight); QColor cb = pl.color (QPalette::Base); return QVariant (QColor ((c1.red () + cb.red ()) / 2, (c1.green () + cb.green ()) / 2, (c1.blue () + cb.blue ()) / 2)); diff --git a/src/layui/layui/layLayerTreeModel.h b/src/layui/layui/layLayerTreeModel.h index b5a0b49d5..47132c990 100644 --- a/src/layui/layui/layLayerTreeModel.h +++ b/src/layui/layui/layLayerTreeModel.h @@ -251,6 +251,7 @@ signals: void hidden_flags_need_update (); private: + QWidget *mp_parent; lay::LayoutViewBase *mp_view; bool m_filter_mode; size_t m_id_start, m_id_end; diff --git a/src/layui/layui/layLayoutViewFunctions.cc b/src/layui/layui/layLayoutViewFunctions.cc index 8417f6022..a493670e4 100644 --- a/src/layui/layui/layLayoutViewFunctions.cc +++ b/src/layui/layui/layLayoutViewFunctions.cc @@ -41,10 +41,30 @@ #include #include +#include +#include namespace lay { +/** + * @brief Gets a suitable parent widget for the modal dialogs used in this module + */ +static QWidget *parent () +{ + QWidgetList tl_widgets; + if (qApp) { + tl_widgets = qApp->topLevelWidgets (); + } + for (auto i = tl_widgets.begin (); i != tl_widgets.end (); ++i) { + QMainWindow *mw = dynamic_cast (*i); + if (mw) { + return mw; + } + } + return 0; +} + static void collect_cells_to_delete (const db::Layout &layout, const db::Cell &cell, std::set &called) { @@ -113,7 +133,7 @@ LayoutViewFunctions::menu_activated (const std::string &symbol) if (symbol == "cm_show_properties") { - view ()->show_properties (view ()->widget ()); + view ()->show_properties (parent ()); } else if (symbol == "cm_delete") { @@ -306,10 +326,10 @@ LayoutViewFunctions::menu_activated (const std::string &symbol) cm_new_layer (); } } else if (symbol == "cm_layout_props") { - lay::LayoutPropertiesForm lp_form (view ()->widget (), view (), "layout_props_form"); + lay::LayoutPropertiesForm lp_form (parent (), view (), "layout_props_form"); lp_form.exec (); } else if (symbol == "cm_layout_stats") { - lay::LayoutStatisticsForm lp_form (view ()->widget (), view (), "layout_props_form"); + lay::LayoutStatisticsForm lp_form (parent (), view (), "layout_props_form"); lp_form.exec (); } else if (symbol == "cm_reload") { cm_reload (); @@ -429,7 +449,7 @@ LayoutViewFunctions::cm_cell_user_properties () db::Cell &cell = layout.cell (path.back ()); db::properties_id_type prop_id = cell.prop_id (); - lay::UserPropertiesForm props_form (view ()->widget ()); + lay::UserPropertiesForm props_form (parent ()); if (props_form.show (view (), cv_index, prop_id)) { view ()->transaction (tl::to_string (tr ("Edit cell's user properties"))); @@ -464,7 +484,7 @@ LayoutViewFunctions::cm_cell_replace () } - lay::ReplaceCellOptionsDialog mode_dialog (view ()->widget ()); + lay::ReplaceCellOptionsDialog mode_dialog (parent ()); db::cell_index_type with_cell = paths.front ().back (); int mode = needs_to_ask ? m_del_cell_mode : 0; @@ -652,7 +672,7 @@ LayoutViewFunctions::cm_cell_delete () mode = 0; } - lay::DeleteCellModeDialog mode_dialog (view ()->widget ()); + lay::DeleteCellModeDialog mode_dialog (parent ()); if (! needs_to_ask || mode_dialog.exec_dialog (mode)) { if (needs_to_ask) { @@ -775,7 +795,7 @@ LayoutViewFunctions::cm_cell_flatten () } } - FlattenInstOptionsDialog options_dialog (view ()->widget ()); + FlattenInstOptionsDialog options_dialog (parent ()); int flatten_insts_levels = -1; bool prune = true; @@ -857,7 +877,7 @@ LayoutViewFunctions::cm_cell_rename () if (cv_index >= 0 && path.size () > 0) { - lay::RenameCellDialog name_dialog (view ()->widget ()); + lay::RenameCellDialog name_dialog (parent ()); db::Layout &layout = view ()->cellview (cv_index)->layout (); std::string name (layout.cell_name (path.back ())); @@ -1207,7 +1227,7 @@ LayoutViewFunctions::cm_new_cell () static double s_new_cell_window_size = 2.0; static std::string s_new_cell_cell_name; - NewCellPropertiesDialog cell_prop_dia (view ()->widget ()); + NewCellPropertiesDialog cell_prop_dia (parent ()); if (cell_prop_dia.exec_dialog (& cv->layout (), s_new_cell_cell_name, s_new_cell_window_size)) { db::cell_index_type new_ci = view ()->new_cell (view ()->active_cellview_index (), s_new_cell_cell_name.c_str ()); @@ -1270,7 +1290,7 @@ LayoutViewFunctions::cm_reload () bool can_reload = true; if (dirty_layouts != 0) { - QMessageBox mbox (view ()->widget ()); + QMessageBox mbox (parent ()); mbox.setText (tl::to_qstring (tl::to_string (tr ("The following layouts need saving:\n\n")) + dirty_files + "\n\nPress 'Reload Without Saving' to reload anyhow and discard changes.")); mbox.setWindowTitle (tr ("Save Needed")); mbox.setIcon (QMessageBox::Warning); @@ -1323,7 +1343,7 @@ LayoutViewFunctions::transform_layout (const db::DCplxTrans &tr_mic) } if (has_proxy && - QMessageBox::question (view ()->widget (), + QMessageBox::question (parent (), tr ("Transforming PCells Or Library Cells"), tr ("The layout contains PCells or library cells or both.\n" "Any changes to such cells may be lost when their layout is refreshed later.\n" @@ -1410,7 +1430,7 @@ LayoutViewFunctions::cm_lay_scale () void LayoutViewFunctions::cm_lay_move () { - lay::MoveOptionsDialog options (view ()->widget ()); + lay::MoveOptionsDialog options (parent ()); if (options.exec_dialog (m_move_dist)) { transform_layout (db::DCplxTrans (m_move_dist)); } @@ -1530,7 +1550,7 @@ LayoutViewFunctions::cm_sel_move_to () double y = sel_bbox.bottom () + (sel_bbox.height () * (1 + m_move_to_origin_mode_y) * 0.5); db::DPoint move_target (x, y); - lay::MoveToOptionsDialog options (view ()->widget ()); + lay::MoveToOptionsDialog options (parent ()); if (options.exec_dialog (m_move_to_origin_mode_x, m_move_to_origin_mode_y, move_target)) { x = sel_bbox.left () + (sel_bbox.width () * (1 + m_move_to_origin_mode_x) * 0.5); @@ -1544,7 +1564,7 @@ LayoutViewFunctions::cm_sel_move_to () void LayoutViewFunctions::cm_sel_move () { - lay::MoveOptionsDialog options (view ()->widget ()); + lay::MoveOptionsDialog options (parent ()); if (options.exec_dialog (m_move_dist)) { do_transform (db::DCplxTrans (m_move_dist)); } @@ -1578,7 +1598,7 @@ LayoutViewFunctions::cm_copy_layer () } - lay::DuplicateLayerDialog dialog (view ()->widget ()); + lay::DuplicateLayerDialog dialog (parent ()); if (dialog.exec_dialog (view (), m_copy_cva, m_copy_layera, m_copy_cvr, m_copy_layerr, m_duplicate_hier_mode, m_clear_before)) { bool supports_undo = true; @@ -1738,7 +1758,7 @@ LayoutViewFunctions::cm_new_layer () const lay::CellView &cv = view ()->cellview (index); - lay::NewLayerPropertiesDialog prop_dia (view ()->widget ()); + lay::NewLayerPropertiesDialog prop_dia (parent ()); if (prop_dia.exec_dialog (cv, m_new_layer_props)) { for (unsigned int l = 0; l < cv->layout ().layers (); ++l) { @@ -1776,7 +1796,7 @@ LayoutViewFunctions::cm_align_cell_origin () throw tl::Exception (tl::to_string (tr ("Cannot use this function on a PCell or library cell"))); } - lay::AlignCellOptionsDialog dialog (view ()->widget ()); + lay::AlignCellOptionsDialog dialog (parent ()); if (dialog.exec_dialog (m_align_cell_options)) { view ()->clear_selection (); @@ -1877,7 +1897,7 @@ LayoutViewFunctions::cm_edit_layer () db::LayerProperties layer_props = layout.get_properties ((unsigned int) sel->layer_index ()); db::LayerProperties old_props = layer_props; - lay::NewLayerPropertiesDialog prop_dia (view ()->widget ()); + lay::NewLayerPropertiesDialog prop_dia (parent ()); if (prop_dia.exec_dialog (cv, layer_props)) { for (unsigned int l = 0; l < layout.layers (); ++l) { @@ -2020,7 +2040,7 @@ LayoutViewFunctions::cm_clear_layer () throw tl::Exception (tl::to_string (tr ("No layer selected for clearing"))); } - lay::ClearLayerModeDialog mode_dialog (view ()->widget ()); + lay::ClearLayerModeDialog mode_dialog (parent ()); if (mode_dialog.exec_dialog (m_layer_hier_mode)) { view ()->cancel_edits (); diff --git a/src/layview/layview/gsiDeclLayLayoutView_qt.cc b/src/layview/layview/gsiDeclLayLayoutView_qt.cc index d8bf51328..f55a8c244 100644 --- a/src/layview/layview/gsiDeclLayLayoutView_qt.cc +++ b/src/layview/layview/gsiDeclLayLayoutView_qt.cc @@ -44,6 +44,7 @@ namespace gsi { #if defined(HAVE_QTBINDINGS) + static lay::LayoutViewWidget *new_view_widget (QWidget *parent, bool editable, db::Manager *manager, unsigned int options) { lay::LayoutViewWidget *lv = new lay::LayoutViewWidget (manager, editable, 0 /*plugin parent*/, parent, options); @@ -56,7 +57,7 @@ static lay::LayoutViewWidget *new_view_widget (QWidget *parent, bool editable, d static lay::LayoutView *get_view (lay::LayoutViewWidget *lv) { - return lv; + return lv->view (); } static QWidget *layer_control_frame (lay::LayoutViewWidget *lv) @@ -86,7 +87,7 @@ Class decl_LayoutViewWidget (QT_EXTERNAL_BASE (QFrame) "l "@param parent The parent widget in which to embed the view\n" "@param editable True to make the view editable\n" "@param manager The \\Manager object to enable undo/redo\n" - "@param options A combination of the values in the LV_... constants\n" + "@param options A combination of the values in the LV_... constants from \\LayoutView\n" "\n" "This constructor has been introduced in version 0.25.\n" "It has been enhanced with the arguments in version 0.27.\n" diff --git a/src/layview/layview/layLayoutView_qt.cc b/src/layview/layview/layLayoutView_qt.cc index c78708fff..e5bb2b62f 100644 --- a/src/layview/layview/layLayoutView_qt.cc +++ b/src/layview/layview/layLayoutView_qt.cc @@ -93,22 +93,34 @@ namespace lay { // ------------------------------------------------------------- -// LayoutViewFrame implementation +// LayoutViewWidget implementation -LayoutViewFrame::LayoutViewFrame (QWidget *parent, lay::LayoutView *view) - : QFrame (parent), mp_view (view) +LayoutViewWidget::LayoutViewWidget (db::Manager *mgr, bool editable, lay::Plugin *plugin_parent, QWidget *parent, unsigned int options) + : QFrame (parent) { - // .. nothing yet .. + mp_view = new LayoutView (mgr, editable, plugin_parent, this, options); +} + +LayoutViewWidget::LayoutViewWidget (lay::LayoutView *source, db::Manager *mgr, bool editable, lay::Plugin *plugin_parent, QWidget *parent, unsigned int options) + : QFrame (parent) +{ + mp_view = new LayoutView (source, mgr, editable, plugin_parent, this, options); +} + +LayoutViewWidget::~LayoutViewWidget () +{ + delete mp_view; + mp_view = 0; } QSize -LayoutViewFrame::sizeHint () const +LayoutViewWidget::sizeHint () const { return mp_view->size_hint (); } bool -LayoutViewFrame::eventFilter(QObject *obj, QEvent *event) +LayoutViewWidget::eventFilter(QObject *obj, QEvent *event) { bool taken = false; bool res = mp_view->event_filter (obj, event, taken); @@ -119,16 +131,41 @@ LayoutViewFrame::eventFilter(QObject *obj, QEvent *event) } } -void LayoutViewFrame::showEvent (QShowEvent *) +void LayoutViewWidget::showEvent (QShowEvent *) { mp_view->show_event (); } -void LayoutViewFrame::hideEvent (QHideEvent *) +void LayoutViewWidget::hideEvent (QHideEvent *) { mp_view->hide_event (); } +QWidget *LayoutViewWidget::layer_control_frame () +{ + return view ()->layer_control_frame (); +} + +QWidget *LayoutViewWidget::hierarchy_control_frame () +{ + return view ()->hierarchy_control_frame (); +} + +QWidget *LayoutViewWidget::libraries_frame () +{ + return view ()->libraries_frame (); +} + +QWidget *LayoutViewWidget::bookmarks_frame () +{ + return view ()->bookmarks_frame (); +} + +QWidget *LayoutViewWidget::editor_options_frame () +{ + return view ()->editor_options_frame (); +} + // ------------------------------------------------------------- // LayoutViewConnector implementation @@ -224,7 +261,7 @@ LayoutView::LayoutView (lay::LayoutView *source, db::Manager *manager, bool edit LayoutView::set_active_cellview_index (source->active_cellview_index ()); } -LayoutView::LayoutView (db::Manager *manager, bool editable, lay::Plugin *plugin_parent, LayoutViewFrame *widget, unsigned int options) +LayoutView::LayoutView (db::Manager *manager, bool editable, lay::Plugin *plugin_parent, LayoutViewWidget *widget, unsigned int options) : LayoutViewBase (this, manager, editable, plugin_parent, options), mp_widget (widget), dm_setup_editor_option_pages (this, &LayoutView::do_setup_editor_options_pages) @@ -235,7 +272,7 @@ LayoutView::LayoutView (db::Manager *manager, bool editable, lay::Plugin *plugin init_ui (); } -LayoutView::LayoutView (lay::LayoutView *source, db::Manager *manager, bool editable, lay::Plugin *plugin_parent, LayoutViewFrame *widget, unsigned int options) +LayoutView::LayoutView (lay::LayoutView *source, db::Manager *manager, bool editable, lay::Plugin *plugin_parent, LayoutViewWidget *widget, unsigned int options) : LayoutViewBase (this, source, manager, editable, plugin_parent, options), mp_widget (widget), dm_setup_editor_option_pages (this, &LayoutView::do_setup_editor_options_pages) @@ -423,6 +460,11 @@ LayoutView::~LayoutView () close (); } +QWidget *LayoutView::widget () +{ + return mp_widget; +} + void LayoutView::close() { close_event (); @@ -465,6 +507,18 @@ void LayoutView::close() mp_bookmarks_view = 0; } +void +LayoutView::finish () +{ + if (dispatcher () == this) { + set_menu_parent_widget (mp_widget); + init_menu (); + if (mp_widget) { + menu ()->build (0, 0); + } + } +} + void LayoutView::do_change_active_cellview () { diff --git a/src/layview/layview/layLayoutView_qt.h b/src/layview/layview/layLayoutView_qt.h index c8acc7a55..c1d7faaee 100644 --- a/src/layview/layview/layLayoutView_qt.h +++ b/src/layview/layview/layLayoutView_qt.h @@ -72,6 +72,7 @@ namespace db { namespace lay { +class LayoutViewWidget; class AbstractMenu; class LayerControlPanel; class HierarchyControlPanel; @@ -86,88 +87,6 @@ class ColorButton; class ConfigureAction; class EditorOptionsPages; -/** - * @brief A custom QFrame that acts as the central widget for the LayoutView - */ -class LAYVIEW_PUBLIC LayoutViewFrame - : public QFrame -{ -Q_OBJECT - -public: - LayoutViewFrame (QWidget *parent, lay::LayoutView *view); - - virtual QSize sizeHint () const; - virtual bool eventFilter(QObject *obj, QEvent *event); - virtual void showEvent (QShowEvent *); - virtual void hideEvent (QHideEvent *); - - void emit_title_changed (lay::LayoutView *view) { emit title_changed (view); } - void emit_dirty_changed (lay::LayoutView *view) { emit dirty_changed (view); } - void emit_show_message (const std::string &s, int ms) { emit show_message (s, ms); } - void emit_current_pos_changed (double x, double y, bool dbu_units) { emit current_pos_changed (x, y, dbu_units); } - void emit_clear_current_pos () { emit clear_current_pos (); } - void emit_edits_enabled_changed () { emit edits_enabled_changed (); } - void emit_mode_change (int m) { emit mode_change (m); } - void emit_current_layer_changed (const lay::LayerPropertiesConstIterator &l) { emit current_layer_changed (l); } - void emit_menu_needs_update () { emit menu_needs_update (); } - void emit_layer_order_changed () { emit layer_order_changed (); } - -signals: - /** - * @brief This signal is emitted when the title changes - */ - void title_changed (lay::LayoutView *view); - - /** - * @brief This signal is emitted when the "dirty" flag changes - */ - void dirty_changed (lay::LayoutView *view); - - /** - * @brief This signal is emitted when the view wants to show a message for the given time (of infinitely for ms == 0) - */ - void show_message (const std::string &s, int ms); - - /** - * @brief This signal is emitted when the view wants to indicate a mouse position change - */ - void current_pos_changed (double x, double y, bool dbu_units); - - /** - * @brief This signal is emitted when the view wants to clear the mouse position - */ - void clear_current_pos (); - - /** - * @brief This signal is sent when the "edits_enabled" state has changed - */ - void edits_enabled_changed (); - - /** - * @brief This signal is sent when the view wants to update the menu - */ - void menu_needs_update (); - - /** - * @brief The view initiated a mode change - */ - void mode_change (int m); - - /** - * @brief The current layer changed - */ - void current_layer_changed (const lay::LayerPropertiesConstIterator &l); - - /** - * @brief The layer order has changed - */ - void layer_order_changed (); - -private: - LayoutView *mp_view; -}; - /** * @brief An object connecting child widget signals with methods from LayoutView */ @@ -225,6 +144,11 @@ public: */ ~LayoutView (); + /** + * @brief Gets the widget object that view is embedded in + */ + QWidget *widget (); + /** * @brief Makes this view the current one */ @@ -439,14 +363,6 @@ public: */ virtual lay::EditorOptionsPages *editor_options_pages (); - /** - * @brief Gets the container with the layer control panel - */ - QWidget *layer_control_frame () - { - return mp_control_frame; - } - /** * @brief Gets the layer control panel */ @@ -455,14 +371,6 @@ public: return mp_control_panel; } - /** - * @brief Gets the container with the hierarchy control panel - */ - QWidget *hierarchy_control_frame () - { - return mp_hierarchy_frame; - } - /** * @brief Gets the hierarchy panel */ @@ -471,30 +379,6 @@ public: return mp_hierarchy_panel; } - /** - * @brief Gets the container with the libraries view - */ - QWidget *libraries_frame () - { - return mp_libraries_frame; - } - - /** - * @brief Gets the container with the bookmarks view - */ - QWidget *bookmarks_frame () - { - return mp_bookmarks_frame; - } - - /** - * @brief Gets the container with the editor options - */ - QWidget *editor_options_frame () - { - return mp_editor_options_frame; - } - /** * @brief Resizes the view to the given width and height in pixels */ @@ -519,16 +403,6 @@ public: */ virtual void cut (); - /** - * @brief Gets the widget object - * - * This pointer may be 0 if the layout view is created in a headless environment. - */ - virtual QWidget *widget () - { - return mp_widget; - } - /** * @brief An event signalling that the view is going to close */ @@ -712,10 +586,10 @@ public: private: friend class LayoutViewSignalConnector; - friend class LayoutViewFrame; + friend class LayoutViewWidget; QTimer *mp_timer; - LayoutViewFrame *mp_widget; + LayoutViewWidget *mp_widget; LayoutViewSignalConnector *mp_connector; bool m_activated; QFrame *mp_left_frame; @@ -748,16 +622,22 @@ private: void init_ui (); void do_setup_editor_options_pages (); + QWidget *layer_control_frame () { return mp_control_frame; } + QWidget *hierarchy_control_frame () { return mp_hierarchy_frame; } + QWidget *libraries_frame () { return mp_libraries_frame; } + QWidget *bookmarks_frame () { return mp_bookmarks_frame; } + QWidget *editor_options_frame () { return mp_editor_options_frame; } + protected: /** * @brief Constructor with widget */ - LayoutView (db::Manager *mgr, bool editable, lay::Plugin *plugin_parent, LayoutViewFrame *widget, unsigned int options = (unsigned int) LV_Normal); + LayoutView (db::Manager *mgr, bool editable, lay::Plugin *plugin_parent, LayoutViewWidget *widget, unsigned int options = (unsigned int) LV_Normal); /** * @brief Constructor (clone from another view) with widget */ - LayoutView (lay::LayoutView *source, db::Manager *mgr, bool editable, lay::Plugin *plugin_parent, LayoutViewFrame *widget, unsigned int options = (unsigned int) LV_Normal); + LayoutView (lay::LayoutView *source, db::Manager *mgr, bool editable, lay::Plugin *plugin_parent, LayoutViewWidget *widget, unsigned int options = (unsigned int) LV_Normal); void activate (); void deactivate (); @@ -765,6 +645,7 @@ protected: virtual bool configure (const std::string &name, const std::string &value); virtual void config_finalize (); + virtual void finish (); virtual tl::Color default_background_color (); virtual void do_set_background_color (tl::Color color, tl::Color contrast); virtual void do_paste (); @@ -797,28 +678,139 @@ private: * but only created if a QApplication is present. */ class LAYVIEW_PUBLIC LayoutViewWidget - : public LayoutViewFrame, public LayoutView + : public QFrame, public gsi::ObjectBase { +Q_OBJECT + public: /** * @brief Constructor */ - LayoutViewWidget (db::Manager *mgr, bool editable, lay::Plugin *plugin_parent, QWidget *parent = 0, unsigned int options = (unsigned int) LV_Normal) - : LayoutViewFrame (parent, this), LayoutView (mgr, editable, plugin_parent, this, options) - { - // .. nothing yet .. - } + LayoutViewWidget (db::Manager *mgr, bool editable, lay::Plugin *plugin_parent, QWidget *parent = 0, unsigned int options = (unsigned int) LayoutView::LV_Normal); /** * @brief Constructor (clone from another view) */ - LayoutViewWidget (lay::LayoutView *source, db::Manager *mgr, bool editable, lay::Plugin *plugin_parent, QWidget *parent = 0, unsigned int options = (unsigned int) LV_Normal) - : LayoutViewFrame (parent, this), LayoutView (source, mgr, editable, plugin_parent, this, options) + LayoutViewWidget (lay::LayoutView *source, db::Manager *mgr, bool editable, lay::Plugin *plugin_parent, QWidget *parent = 0, unsigned int options = (unsigned int) LayoutView::LV_Normal); + + /** + * @brief Destructor + */ + ~LayoutViewWidget (); + + /** + * @brief Gets the LayoutView embedded into this widget + */ + lay::LayoutView *view () { - // .. nothing yet .. + return mp_view; } + + virtual QSize sizeHint () const; + virtual bool eventFilter(QObject *obj, QEvent *event); + virtual void showEvent (QShowEvent *); + virtual void hideEvent (QHideEvent *); + + void emit_title_changed (lay::LayoutView *view) { emit title_changed (view); } + void emit_dirty_changed (lay::LayoutView *view) { emit dirty_changed (view); } + void emit_show_message (const std::string &s, int ms) { emit show_message (s, ms); } + void emit_current_pos_changed (double x, double y, bool dbu_units) { emit current_pos_changed (x, y, dbu_units); } + void emit_clear_current_pos () { emit clear_current_pos (); } + void emit_edits_enabled_changed () { emit edits_enabled_changed (); } + void emit_mode_change (int m) { emit mode_change (m); } + void emit_current_layer_changed (const lay::LayerPropertiesConstIterator &l) { emit current_layer_changed (l); } + void emit_menu_needs_update () { emit menu_needs_update (); } + void emit_layer_order_changed () { emit layer_order_changed (); } + + /** + * @brief Gets the container with the layer control panel + */ + QWidget *layer_control_frame (); + + /** + * @brief Gets the container with the hierarchy control panel + */ + QWidget *hierarchy_control_frame (); + + /** + * @brief Gets the container with the libraries view + */ + QWidget *libraries_frame (); + + /** + * @brief Gets the container with the bookmarks view + */ + QWidget *bookmarks_frame (); + + /** + * @brief Gets the container with the editor options + */ + QWidget *editor_options_frame (); + +signals: + /** + * @brief This signal is emitted when the title changes + */ + void title_changed (lay::LayoutView *view); + + /** + * @brief This signal is emitted when the "dirty" flag changes + */ + void dirty_changed (lay::LayoutView *view); + + /** + * @brief This signal is emitted when the view wants to show a message for the given time (of infinitely for ms == 0) + */ + void show_message (const std::string &s, int ms); + + /** + * @brief This signal is emitted when the view wants to indicate a mouse position change + */ + void current_pos_changed (double x, double y, bool dbu_units); + + /** + * @brief This signal is emitted when the view wants to clear the mouse position + */ + void clear_current_pos (); + + /** + * @brief This signal is sent when the "edits_enabled" state has changed + */ + void edits_enabled_changed (); + + /** + * @brief This signal is sent when the view wants to update the menu + */ + void menu_needs_update (); + + /** + * @brief The view initiated a mode change + */ + void mode_change (int m); + + /** + * @brief The current layer changed + */ + void current_layer_changed (const lay::LayerPropertiesConstIterator &l); + + /** + * @brief The layer order has changed + */ + void layer_order_changed (); + +private: + LayoutView *mp_view; }; +/** + * @brief Gets the container widget for a LayoutViewBase object + */ +inline QWidget *widget_from_view (lay::LayoutViewBase *view_base) +{ + lay::LayoutView *view = dynamic_cast (view_base); + return view ? view->widget () : 0; +} + } #endif diff --git a/src/plugins/tools/bool/lay_plugin/layBooleanOperationsPlugin.cc b/src/plugins/tools/bool/lay_plugin/layBooleanOperationsPlugin.cc index 56c311fd7..e1a76a4eb 100644 --- a/src/plugins/tools/bool/lay_plugin/layBooleanOperationsPlugin.cc +++ b/src/plugins/tools/bool/lay_plugin/layBooleanOperationsPlugin.cc @@ -27,6 +27,7 @@ #include "layPlugin.h" #include "layTipDialog.h" #include "layLayoutViewBase.h" +#include "layMainWindow.h" #include "dbShapeProcessor.h" @@ -35,6 +36,11 @@ namespace lay { +static QWidget *parent_widget () +{ + return lay::MainWindow::instance (); +} + class BooleanOperationsPlugin : public lay::Plugin { @@ -100,7 +106,7 @@ public: } - lay::BooleanOptionsDialog dialog (mp_view->widget ()); + lay::BooleanOptionsDialog dialog (parent_widget ()); if (dialog.exec_dialog (mp_view, m_boolean_cva, m_boolean_layera, m_boolean_cvb, m_boolean_layerb, m_boolean_cvr, m_boolean_layerr, m_boolean_mode, m_boolean_hier_mode, m_boolean_mincoh)) { mp_view->cancel (); @@ -237,7 +243,7 @@ public: } - lay::MergeOptionsDialog dialog (mp_view->widget ()); + lay::MergeOptionsDialog dialog (parent_widget ()); if (dialog.exec_dialog (mp_view, m_boolean_cva, m_boolean_layera, m_boolean_cvr, m_boolean_layerr, m_boolean_minwc, m_boolean_hier_mode, m_boolean_mincoh)) { mp_view->cancel (); @@ -352,7 +358,7 @@ public: } - lay::SizingOptionsDialog dialog (mp_view->widget ()); + lay::SizingOptionsDialog dialog (parent_widget ()); if (dialog.exec_dialog (mp_view, m_boolean_cva, m_boolean_layera, m_boolean_cvr, m_boolean_layerr, m_boolean_sizex, m_boolean_sizey, m_boolean_size_mode, m_boolean_hier_mode, m_boolean_mincoh)) { mp_view->cancel ();