diff --git a/src/edt/edt/CopyModeDialog.ui b/src/edt/edt/CopyModeDialog.ui index 8add36f07..563c8580c 100644 --- a/src/edt/edt/CopyModeDialog.ui +++ b/src/edt/edt/CopyModeDialog.ui @@ -1,7 +1,8 @@ - + + CopyModeDialog - - + + 0 0 @@ -9,38 +10,56 @@ 164 - + Copy Options - - - 9 - - + + 6 + + 9 + + + 9 + + + 9 + + + 9 + - - + + Copy Mode - - - 9 - - + + 6 + + 9 + + + 9 + + + 9 + + + 9 + - - + + Shallow copy (instances only) - - + + Deep copy (instances plus cell) @@ -48,12 +67,19 @@ + + + + Don't ask again (you can always reset this in the editor options) + + + - + Qt::Vertical - + 20 40 @@ -62,12 +88,12 @@ - - + + Qt::Horizontal - - QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok @@ -81,11 +107,11 @@ CopyModeDialog accept() - + 248 254 - + 157 274 @@ -97,11 +123,11 @@ CopyModeDialog reject() - + 316 260 - + 286 274 diff --git a/src/edt/edt/EditorOptionsGeneric.ui b/src/edt/edt/EditorOptionsGeneric.ui index 022fc069c..36c1aadd0 100644 --- a/src/edt/edt/EditorOptionsGeneric.ui +++ b/src/edt/edt/EditorOptionsGeneric.ui @@ -1,7 +1,8 @@ - + + EditorOptionsGeneric - - + + 0 0 @@ -9,34 +10,52 @@ 417 - + Form - - - 9 - - + + 6 + + 9 + + + 9 + + + 9 + + + 9 + - - + + Snapping - - + + 9 - + + 9 + + + 9 + + + 9 + + 6 - + - + Qt::Horizontal - + 148 16 @@ -44,15 +63,15 @@ - + - + Qt::Horizontal - + QSizePolicy::Fixed - + 16 20 @@ -60,57 +79,55 @@ - - - - - 0 - 0 + + + + 0 0 - - Enter the grid in micron. Can be anisotropic ("gx,gy") + + Enter the grid in micron. Can be anisotropic ("gx,gy") - - - + + + Grid - - - + + + Objects - - + + - + No grid - + Global grid - + Other grid ... - - - + + + Snap to other objects @@ -119,75 +136,84 @@ - - + + Angle Constraints - - + + 9 - + + 9 + + + 9 + + + 9 + + 6 - - - + + + Movements - - - + + + Connections - - + + - + Any Angle - + Diagonal - + Manhattan - - + + - + Any Direction - + Diagonal - + Manhattan - + - + Qt::Horizontal - + 257 41 @@ -199,36 +225,91 @@ - - - Selection Mode + + + Hierarchical Features - - + + 9 - + + 9 + + + 9 + + + 9 + + 6 - - - - - 7 - 0 + + + + Copy mode + + + + + + + Shallow select + + + + + + + 0 0 - - Select top level objects only + + QComboBox::AdjustToContentsOnFirstShow + + + Shallow mode (instance only) + + + + + Deep mode (instance and cell) + + + + + Ask + + - - - - Hierarchy + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + Select top level objects only @@ -236,30 +317,37 @@ - - + + Instance Display - - - 9 - - + + 6 + + 9 + + + 9 + + + 9 + + + 9 + - - + + Show shapes when moving (max. - - - - 5 - 0 + + + 0 0 @@ -267,18 +355,18 @@ - - + + shapes) - + Qt::Horizontal - + 20 20 @@ -291,10 +379,10 @@ - + Qt::Vertical - + 121 51 diff --git a/src/edt/edt/edtConfig.cc b/src/edt/edt/edtConfig.cc index 2c62dac78..ef531eaa8 100644 --- a/src/edt/edt/edtConfig.cc +++ b/src/edt/edt/edtConfig.cc @@ -57,6 +57,7 @@ std::string cfg_edit_inst_column_x ("edit-inst-column_x"); std::string cfg_edit_inst_column_y ("edit-inst-column_y"); std::string cfg_edit_inst_place_origin ("edit-inst-place-origin"); std::string cfg_edit_top_level_selection ("edit-top-level-selection"); +std::string cfg_edit_hier_copy_mode ("edit-hier-copy-mode"); std::string cfg_edit_show_shapes_of_instances ("edit-show-shapes-of-instances"); std::string cfg_edit_max_shapes_of_instances ("edit-max-shapes-of-instances"); std::string cfg_edit_global_grid ("grid-micron"); diff --git a/src/edt/edt/edtConfig.h b/src/edt/edt/edtConfig.h index b727ea4a7..1c9795678 100644 --- a/src/edt/edt/edtConfig.h +++ b/src/edt/edt/edtConfig.h @@ -68,6 +68,7 @@ extern EDT_PUBLIC std::string cfg_edit_inst_column_x; extern EDT_PUBLIC std::string cfg_edit_inst_column_y; extern EDT_PUBLIC std::string cfg_edit_inst_place_origin; extern EDT_PUBLIC std::string cfg_edit_top_level_selection; +extern EDT_PUBLIC std::string cfg_edit_hier_copy_mode; extern EDT_PUBLIC std::string cfg_edit_combine_mode; // ------------------------------------------------------------ diff --git a/src/edt/edt/edtDialogs.cc b/src/edt/edt/edtDialogs.cc index cf596fd37..7234ec51b 100644 --- a/src/edt/edt/edtDialogs.cc +++ b/src/edt/edt/edtDialogs.cc @@ -196,7 +196,7 @@ CopyModeDialog::~CopyModeDialog () } bool -CopyModeDialog::exec_dialog (unsigned int &mode) +CopyModeDialog::exec_dialog (unsigned int &mode, bool &dont_ask) { if (mode == 0) { shallow_rb->setChecked (true); @@ -207,6 +207,7 @@ CopyModeDialog::exec_dialog (unsigned int &mode) } else { mode = 1; } + dont_ask = dont_ask_cbx->isChecked (); return true; } else { return false; diff --git a/src/edt/edt/edtDialogs.h b/src/edt/edt/edtDialogs.h index e7d8d6258..cbb137edb 100644 --- a/src/edt/edt/edtDialogs.h +++ b/src/edt/edt/edtDialogs.h @@ -64,7 +64,7 @@ public: CopyModeDialog (QWidget *parent); virtual ~CopyModeDialog (); - bool exec_dialog (unsigned int &mode); + bool exec_dialog (unsigned int &mode, bool &dont_ask); }; /** diff --git a/src/edt/edt/edtEditorOptionsPages.cc b/src/edt/edt/edtEditorOptionsPages.cc index b47af42b7..b1b8585f4 100644 --- a/src/edt/edt/edtEditorOptionsPages.cc +++ b/src/edt/edt/edtEditorOptionsPages.cc @@ -265,6 +265,8 @@ EditorOptionsGeneric::apply (lay::Plugin *root) root->config_set (cfg_edit_connect_angle_mode, acc.to_string (lay::angle_constraint_type (mp_ui->conn_angle_cb->currentIndex ()))); root->config_set (cfg_edit_top_level_selection, tl::to_string (mp_ui->hier_sel_cbx->isChecked ())); + int cpm = mp_ui->hier_copy_mode_cbx->currentIndex (); + root->config_set (cfg_edit_hier_copy_mode, tl::to_string ((cpm < 0 || cpm > 1) ? -1 : cpm)); root->config_set (cfg_edit_snap_to_objects, tl::to_string (mp_ui->snap_objects_cbx->isChecked ())); unsigned int max_shapes = 1000; @@ -321,6 +323,10 @@ EditorOptionsGeneric::setup (lay::Plugin *root) root->config_get (cfg_edit_top_level_selection, top_level_sel); mp_ui->hier_sel_cbx->setChecked (top_level_sel); + int cpm = -1; + root->config_get (cfg_edit_hier_copy_mode, cpm); + mp_ui->hier_copy_mode_cbx->setCurrentIndex ((cpm < 0 || cpm > 1) ? 2 : cpm); + bool snap_to_objects = false; root->config_get (cfg_edit_snap_to_objects, snap_to_objects); mp_ui->snap_objects_cbx->setChecked (snap_to_objects); diff --git a/src/edt/edt/edtPlugin.cc b/src/edt/edt/edtPlugin.cc index d97395acf..478121156 100644 --- a/src/edt/edt/edtPlugin.cc +++ b/src/edt/edt/edtPlugin.cc @@ -198,6 +198,7 @@ public: virtual void get_options (std::vector < std::pair > &options) const { options.push_back (std::pair (cfg_edit_top_level_selection, "false")); + options.push_back (std::pair (cfg_edit_hier_copy_mode, "-1")); options.push_back (std::pair (cfg_edit_grid, "")); options.push_back (std::pair (cfg_edit_snap_to_objects, "false")); options.push_back (std::pair (cfg_edit_move_angle_mode, "any")); diff --git a/src/edt/edt/edtService.cc b/src/edt/edt/edtService.cc index 7d5914bde..5573329d5 100644 --- a/src/edt/edt/edtService.cc +++ b/src/edt/edt/edtService.cc @@ -113,6 +113,7 @@ Service::Service (db::Manager *manager, lay::LayoutView *view, db::ShapeIterator m_connect_ac (lay::AC_Any), m_move_ac (lay::AC_Any), m_alt_ac (lay::AC_Global), m_snap_to_objects (false), m_top_level_sel (false), m_show_shapes_of_instances (true), m_max_shapes_of_instances (1000), + m_hier_copy_mode (-1), m_indicate_secondary_selection (false), m_seq (0), dm_selection_to_view (this, &edt::Service::do_selection_to_view) @@ -134,6 +135,7 @@ Service::Service (db::Manager *manager, lay::LayoutView *view) m_connect_ac (lay::AC_Any), m_move_ac (lay::AC_Any), m_alt_ac (lay::AC_Global), m_snap_to_objects (true), m_top_level_sel (false), m_show_shapes_of_instances (true), m_max_shapes_of_instances (1000), + m_hier_copy_mode (-1), m_indicate_secondary_selection (false), m_seq (0), dm_selection_to_view (this, &edt::Service::do_selection_to_view) @@ -255,6 +257,8 @@ Service::configure (const std::string &name, const std::string &value) return true; // taken } else if (name == cfg_edit_top_level_selection) { tl::from_string (value, m_top_level_sel); + } else if (name == cfg_edit_hier_copy_mode) { + tl::from_string (value, m_hier_copy_mode); } return false; // not taken @@ -309,18 +313,30 @@ Service::copy_selected () edt::CopyModeDialog mode_dialog (view ()); bool need_to_ask_for_copy_mode = false; - for (objects::const_iterator r = m_selection.begin (); r != m_selection.end () && ! need_to_ask_for_copy_mode; ++r) { - if (r->is_cell_inst ()) { - const db::Cell &cell = view ()->cellview (r->cv_index ())->layout ().cell (r->back ().inst_ptr.cell_index ()); - if (! cell.is_proxy ()) { - need_to_ask_for_copy_mode = true; + unsigned int inst_mode = 0; + + if (m_hier_copy_mode < 0) { + for (objects::const_iterator r = m_selection.begin (); r != m_selection.end () && ! need_to_ask_for_copy_mode; ++r) { + if (r->is_cell_inst ()) { + const db::Cell &cell = view ()->cellview (r->cv_index ())->layout ().cell (r->back ().inst_ptr.cell_index ()); + if (! cell.is_proxy ()) { + need_to_ask_for_copy_mode = true; + } } } + } else { + inst_mode = (unsigned int) m_hier_copy_mode; } - unsigned int inst_mode = 0; + bool dont_ask_again = false; - if (! need_to_ask_for_copy_mode || mode_dialog.exec_dialog (inst_mode)) { + if (! need_to_ask_for_copy_mode || mode_dialog.exec_dialog (inst_mode, dont_ask_again)) { + + // store the given value "forever" + if (dont_ask_again) { + plugin_root ()->config_set (cfg_edit_hier_copy_mode, tl::to_string (inst_mode)); + plugin_root ()->config_end (); + } // create one ClipboardData object per cv_index because, this one assumes that there is // only one source layout object. diff --git a/src/edt/edt/edtService.h b/src/edt/edt/edtService.h index 2f0fee85d..647a70ae4 100644 --- a/src/edt/edt/edtService.h +++ b/src/edt/edt/edtService.h @@ -579,6 +579,9 @@ private: bool m_show_shapes_of_instances; unsigned int m_max_shapes_of_instances; + // Hierarchical copy mode (-1: ask, 0: shallow, 1: deep) + int m_hier_copy_mode; + // Sequence number of selection bool m_indicate_secondary_selection; unsigned long m_seq;