From 73787eed8a1d36f74dba28f823e904d9664de02c Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Tue, 18 Aug 2020 21:44:20 +0200 Subject: [PATCH] WIP: recent options of boxes, polygons, styling --- src/edt/edt/EditorOptionsGeneric.ui | 84 ++--- src/edt/edt/EditorOptionsPath.ui | 450 ++++++++++++------------ src/edt/edt/EditorOptionsText.ui | 453 ++++++++++++++----------- src/edt/edt/edtPlugin.cc | 33 +- src/edt/edt/edtServiceImpl.cc | 4 + src/lay/lay/layMainWindow.cc | 1 + src/laybasic/laybasic/layLayoutView.cc | 16 +- 7 files changed, 568 insertions(+), 473 deletions(-) diff --git a/src/edt/edt/EditorOptionsGeneric.ui b/src/edt/edt/EditorOptionsGeneric.ui index 4ba0b27e1..8de52d009 100644 --- a/src/edt/edt/EditorOptionsGeneric.ui +++ b/src/edt/edt/EditorOptionsGeneric.ui @@ -105,7 +105,7 @@ - + 1 0 @@ -204,45 +204,10 @@ - - - - Connections - - - - - - - - 1 - 0 - - - - QComboBox::AdjustToContents - - - - Any Angle - - - - - Diagonal - - - - - Manhattan - - - - - + 1 0 @@ -267,15 +232,50 @@ - - + + + + Connections + + + + + + + + 1 + 0 + + + + QComboBox::AdjustToContents + + + + Any Angle + + + + + Diagonal + + + + + Manhattan + + + + + + Qt::Horizontal - 257 - 10 + 40 + 20 @@ -324,7 +324,7 @@ - + 1 0 diff --git a/src/edt/edt/EditorOptionsPath.ui b/src/edt/edt/EditorOptionsPath.ui index 0b2769df6..c50521d5a 100644 --- a/src/edt/edt/EditorOptionsPath.ui +++ b/src/edt/edt/EditorOptionsPath.ui @@ -18,240 +18,256 @@ 6 - 4 + 0 - 4 + 0 - 4 + 0 - 4 + 0 - + QFrame::NoFrame - - QFrame::Raised + + true - - - 6 + + + + 0 + 0 + 357 + 289 + - - 0 - - - 0 - - - 0 - - - 0 - - - - - Width - - - - - - - - 0 - 0 - - - - - - - - µm - - - - - - - Qt::Horizontal - - - - 21 - 20 - - - - - + + + + + QFrame::NoFrame + + + QFrame::Raised + + + + 6 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Width + + + + + + + + 0 + 0 + + + + + + + + µm + + + + + + + Qt::Horizontal + + + + 21 + 20 + + + + + + + + + + + + 0 + 0 + + + + Extensions + + + + 4 + + + 4 + + + 4 + + + 4 + + + 6 + + + 2 + + + + + end = + + + + + + + + 1 + 0 + + + + + + + + µm + + + + + + + + 1 + 0 + + + + + + + + + 0 + 0 + + + + + Flush + + + + + Square + + + + + Variable + + + + + Round + + + + + + + + Variable + + + + + + + µm + + + + + + + start = + + + + + + + Type + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + Qt::Vertical + + + + 271 + 123 + + + + + + - - - - - 0 - 0 - - - - Extensions - - - - 4 - - - 4 - - - 4 - - - 4 - - - 6 - - - 2 - - - - - Qt::Horizontal - - - - 21 - 10 - - - - - - - - µm - - - - - - - µm - - - - - - - - 1 - 0 - - - - - - - - end = - - - - - - - start = - - - - - - - - 1 - 0 - - - - - - - - Variable - - - - - - - - 0 - 0 - - - - - Flush - - - - - Square - - - - - Variable - - - - - Round - - - - - - - - Type - - - - - - - - - - Qt::Vertical - - - - 271 - 63 - - - - - - width_le - type_cb - start_ext_le - end_ext_le - diff --git a/src/edt/edt/EditorOptionsText.ui b/src/edt/edt/EditorOptionsText.ui index bd19c5e98..1cc821fd4 100644 --- a/src/edt/edt/EditorOptionsText.ui +++ b/src/edt/edt/EditorOptionsText.ui @@ -18,227 +18,280 @@ 2 - 4 + 0 - 4 + 0 - 4 + 0 - 4 + 0 - + QFrame::NoFrame - - QFrame::Raised + + true - - - 4 + + + + 0 + 0 + 542 + 243 + - - 4 - - - 4 - - - 4 - - - 6 - - - 2 - - - - - Alignment - - - - - - - - 0 - 0 - - - - h = - - - - - - - Text size - - - - - - - - 0 - 0 - - - - - - - - - 0 - 0 - - - - Text - - - - - - - Hint: orientation, alignments and size cannot be saved to OASIS files. Enable a vector font and text scaling in the setup dialog to show text objects scaled and rotated. - - - true - - - - - - - - - - (empty for default) - - - - - - - - 1 - 0 - - - - - (Default) + + + + + QFrame::NoFrame - - - - Top + + QFrame::Raised - - - - Center + + + 4 + + + 4 + + + 4 + + + 4 + + + 6 + + + 2 + + + + + + 0 + 0 + + + + v = + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 5 + + + + + + + + Text size + + + + + + + + 0 + 0 + + + + Text + + + + + + + + 1 + 0 + + + + + (Default) + + + + + Top + + + + + Center + + + + + Bottom + + + + + + + + + 1 + 0 + + + + + (Default) + + + + + Left + + + + + Center + + + + + Right + + + + + + + + + 0 + 0 + + + + h = + + + + + + + Alignment + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + + + + QFrame::NoFrame + + + QFrame::Raised + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + + + (empty for default) + + + + + + + + + + Hint: orientation, alignments and size cannot be saved to OASIS files. Enable a vector font and text scaling in the setup dialog to show text objects scaled and rotated. + + + true + + + + + + + + + + Qt::Vertical - - - - Bottom + + + 20 + 77 + - - - - - - - - 0 - 0 - - - - v = - - - - - - - - 1 - 0 - - - - - (Default) - - - - - Left - - - - - Center - - - - - Right - - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 5 - - - - - + + + + - - - - Qt::Vertical - - - - 20 - 40 - - - - - - text_le - halign_cbx - valign_cbx - size_le - diff --git a/src/edt/edt/edtPlugin.cc b/src/edt/edt/edtPlugin.cc index 05748747b..975cf2ccc 100644 --- a/src/edt/edt/edtPlugin.cc +++ b/src/edt/edt/edtPlugin.cc @@ -37,7 +37,19 @@ namespace edt { -static +edt::RecentConfigurationPage::ConfigurationDescriptor shape_cfg_descriptors[] = +{ + edt::RecentConfigurationPage::ConfigurationDescriptor ("", tl::to_string (tr ("Layer")), edt::RecentConfigurationPage::Layer), +}; + +static +void get_shape_editor_options_pages (std::vector &ret, lay::LayoutView *view, lay::Dispatcher *dispatcher) +{ + ret.push_back (new RecentConfigurationPage (view, dispatcher, "edit-recent-shape-param", + &shape_cfg_descriptors[0], &shape_cfg_descriptors[sizeof (shape_cfg_descriptors) / sizeof (shape_cfg_descriptors[0])])); +} + +static void get_text_options (std::vector < std::pair > &options) { options.push_back (std::pair (cfg_edit_text_string, "ABC")); @@ -46,9 +58,20 @@ void get_text_options (std::vector < std::pair > &opti options.push_back (std::pair (cfg_edit_text_valign, "bottom")); } -static -void get_text_editor_options_pages (std::vector &ret, lay::LayoutView *, lay::Dispatcher *dispatcher) +edt::RecentConfigurationPage::ConfigurationDescriptor text_cfg_descriptors[] = { + edt::RecentConfigurationPage::ConfigurationDescriptor ("", tl::to_string (tr ("Layer")), edt::RecentConfigurationPage::Layer), + edt::RecentConfigurationPage::ConfigurationDescriptor (cfg_edit_text_string, tl::to_string (tr ("Text")), edt::RecentConfigurationPage::Text), + edt::RecentConfigurationPage::ConfigurationDescriptor (cfg_edit_text_size, tl::to_string (tr ("Size")), edt::RecentConfigurationPage::Double), + edt::RecentConfigurationPage::ConfigurationDescriptor (cfg_edit_text_halign, tl::to_string (tr ("Hor. align")), edt::RecentConfigurationPage::Text), + edt::RecentConfigurationPage::ConfigurationDescriptor (cfg_edit_text_valign, tl::to_string (tr ("Vert. align")), edt::RecentConfigurationPage::Text) +}; + +static +void get_text_editor_options_pages (std::vector &ret, lay::LayoutView *view, lay::Dispatcher *dispatcher) +{ + ret.push_back (new RecentConfigurationPage (view, dispatcher, "edit-recent-text-param", + &text_cfg_descriptors[0], &text_cfg_descriptors[sizeof (text_cfg_descriptors) / sizeof (text_cfg_descriptors[0])])); ret.push_back (new edt::EditorOptionsText (dispatcher)); } @@ -192,12 +215,12 @@ private: }; static tl::RegisteredClass config_decl1 ( - new edt::PluginDeclaration (tl::to_string (QObject::tr ("Polygons")), "polygon:edit_mode\t" + tl::to_string (QObject::tr ("Polygon")) + "<:polygon.png>" + tl::to_string (QObject::tr ("{Create a polygon}"))), + new edt::PluginDeclaration (tl::to_string (QObject::tr ("Polygons")), "polygon:edit_mode\t" + tl::to_string (QObject::tr ("Polygon")) + "<:polygon.png>" + tl::to_string (QObject::tr ("{Create a polygon}")), 0, &get_shape_editor_options_pages), 4010, "edt::Service(Polygons)" ); static tl::RegisteredClass config_decl2 ( - new edt::PluginDeclaration (tl::to_string (QObject::tr ("Boxes")), "box:edit_mode\t" + tl::to_string (QObject::tr ("Box")) + "\t<:box.png>" + tl::to_string (QObject::tr ("{Create a box}"))), + new edt::PluginDeclaration (tl::to_string (QObject::tr ("Boxes")), "box:edit_mode\t" + tl::to_string (QObject::tr ("Box")) + "\t<:box.png>" + tl::to_string (QObject::tr ("{Create a box}")), 0, &get_shape_editor_options_pages), 4011, "edt::Service(Boxes)" ); diff --git a/src/edt/edt/edtServiceImpl.cc b/src/edt/edt/edtServiceImpl.cc index f105d1031..59fbdd3de 100644 --- a/src/edt/edt/edtServiceImpl.cc +++ b/src/edt/edt/edtServiceImpl.cc @@ -440,6 +440,7 @@ void PolygonService::do_finish_edit () { deliver_shape (get_polygon ()); + commit_recent (view ()); } db::Polygon @@ -737,6 +738,7 @@ void BoxService::do_finish_edit () { deliver_shape (get_box ()); + commit_recent (view ()); } void @@ -854,6 +856,8 @@ TextService::do_finish_edit () cell ().shapes (layer ()).insert (get_text ()); manager ()->commit (); + commit_recent (view ()); + if (! view ()->text_visible ()) { lay::TipDialog td (QApplication::activeWindow (), diff --git a/src/lay/lay/layMainWindow.cc b/src/lay/lay/layMainWindow.cc index 36b9bb96c..a75141306 100644 --- a/src/lay/lay/layMainWindow.cc +++ b/src/lay/lay/layMainWindow.cc @@ -551,6 +551,7 @@ MainWindow::MainWindow (QApplication *app, lay::Plugin *plugin_parent, const cha mp_eo_dock_widget = new QDockWidget (QObject::tr ("Editor Options"), this); mp_eo_dock_widget->setObjectName (QString::fromUtf8 ("eo_dock_widget")); + mp_eo_dock_widget->setMinimumHeight (150); mp_eo_stack = new ControlWidgetStack (mp_eo_dock_widget, "eo_stack"); mp_eo_dock_widget->setWidget (mp_eo_stack); mp_eo_dock_widget->setFocusProxy (mp_eo_stack); diff --git a/src/laybasic/laybasic/layLayoutView.cc b/src/laybasic/laybasic/layLayoutView.cc index 56b8ce57c..e1ff1d99d 100644 --- a/src/laybasic/laybasic/layLayoutView.cc +++ b/src/laybasic/laybasic/layLayoutView.cc @@ -543,14 +543,13 @@ LayoutView::init (db::Manager *mgr, QWidget * /*parent*/) if ((m_options & LV_NoLibrariesView) == 0 && (m_options & LV_Naked) == 0) { - QFrame *libraries_frame = new QFrame (0); - libraries_frame->setObjectName (QString::fromUtf8 ("libs_frame")); - mp_libraries_frame = libraries_frame; - QVBoxLayout *left_frame_ly = new QVBoxLayout (libraries_frame); + mp_libraries_frame = new QFrame (0); + mp_libraries_frame->setObjectName (QString::fromUtf8 ("libs_frame")); + QVBoxLayout *left_frame_ly = new QVBoxLayout (mp_libraries_frame); left_frame_ly->setMargin (0); left_frame_ly->setSpacing (0); - mp_libraries_view = new lay::LibrariesView (this, libraries_frame, "libs"); + mp_libraries_view = new lay::LibrariesView (this, mp_libraries_frame, "libs"); left_frame_ly->addWidget (mp_libraries_view, 1 /*stretch*/); connect (mp_libraries_view, SIGNAL (active_library_changed (int)), this, SLOT (active_library_changed (int))); @@ -560,11 +559,10 @@ LayoutView::init (db::Manager *mgr, QWidget * /*parent*/) if (is_editable () && (m_options & LV_NoEditorOptionsPanel) == 0 && (m_options & LV_Naked) == 0) { - QFrame *editor_options_frame = new QFrame (0); - editor_options_frame->setObjectName (QString::fromUtf8 ("editor_options_frame")); - mp_editor_options_frame = editor_options_frame; + mp_editor_options_frame = new QFrame (0); + mp_editor_options_frame->setObjectName (QString::fromUtf8 ("editor_options_frame")); - QVBoxLayout *left_frame_ly = new QVBoxLayout (editor_options_frame); + QVBoxLayout *left_frame_ly = new QVBoxLayout (mp_editor_options_frame); left_frame_ly->setMargin (0); left_frame_ly->setSpacing (0);