diff --git a/src/ant/ant/RulerPropertiesPage.ui b/src/ant/ant/RulerPropertiesPage.ui index ef0074318..ad86d29e0 100644 --- a/src/ant/ant/RulerPropertiesPage.ui +++ b/src/ant/ant/RulerPropertiesPage.ui @@ -7,7 +7,7 @@ 0 0 622 - 502 + 621 @@ -53,34 +53,106 @@ 6 - - - - Qt::Vertical + + + + + 1 + 0 + - - - 20 - 5 - + + true - + - - - - Qt::Vertical + + + + First point (x/y) - - - 20 - 5 - - - + - + + + QFrame::NoFrame + + + QFrame::Raised + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + ... + + + + :/down.png:/down.png + + + false + + + + + + + ... + + + + :/up.png:/up.png + + + false + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 1 @@ -89,28 +161,7 @@ - - - - x = - - - - - - - Outline - - - - - - - <html>(See <a href="int:/manual/ruler_properties.xml">here</a> for a description of the properties)</html> - - - - + @@ -123,31 +174,17 @@ - - - - X label format - - - - - - - y = - - - - + y = - - + + - d = + X label format @@ -195,13 +232,565 @@ - - - - Length + + + + + 1 + 0 + + + + + x = + + + + + + + x = + + + + + + + Delta (x/y) + + + + + + + ... position + + + + + + + Qt::Vertical + + + + 20 + 5 + + + + + + + + Second point (x/y) + + + + + + + + Diagonal + + + + + Horizonal and vertical (in this order) + + + + + Diagonal plus horizonal and vertical (triangle) + + + + + Vertical and horizonal (in this order) + + + + + Diagonal plus vertical and horizontal (triangle) + + + + + Box + + + + + Ellipse + + + + + + + + Qt::Vertical + + + + 20 + 5 + + + + + + + + + 1 + 0 + + + + + + + + Outline + + + + + + + QFrame::NoFrame + + + QFrame::Raised + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Qt::Horizontal + + + + 223 + 20 + + + + + + + + H + + + + + + + + 0 + 0 + + + + + Auto + + + + + H. center + + + + + Left + + + + + Right + + + + + + + + V + + + + + + + + 0 + 0 + + + + + Auto + + + + + V. center + + + + + Bottom + + + + + Top + + + + + + + + + + + + + + + 0 + 0 + + + + + Sans Serif + 12 + 75 + false + true + false + false + + + + Ruler Properties + + + + + + + d = + + + + + + + + 1 + 0 + + + + + + + + + + + x = + + + + + + + + + + Qt::Vertical + + + + 20 + 5 + + + + + + + + QFrame::NoFrame + + + QFrame::Raised + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Qt::Horizontal + + + + 223 + 20 + + + + + + + + H + + + + + + + + 0 + 0 + + + + + Auto + + + + + H. center + + + + + Left + + + + + Right + + + + + + + + V + + + + + + + + 0 + 0 + + + + + Auto + + + + + V. center + + + + + Bottom + + + + + Top + + + + + + + + + + + ... position + + + + + + + Y label format + + + + + + + + 1 + 0 + + + + true + + + + + + + Qt::Horizontal + + + + + + + ... position + + + + + + + Style + + + + + + + <html>(See <a href="int:/manual/ruler_properties.xml">here</a> for a description of the properties)</html> + + + + + + + Label format + + + + + + + QFrame::NoFrame + + + QFrame::Raised + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + ... + + + + :/down.png:/down.png + + + false + + + + + + + ... + + + + :/up.png:/up.png + + + false + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + @@ -347,292 +936,17 @@ - - - - - 1 - 0 - - - - true - - - - - - - Qt::Horizontal - - - - - - - - 1 - 0 - - - - - - - - - - - x = - - - - - - - - 1 - 0 - - - - true - - - - - - - - 1 - 0 - - - - - - - - - + + y = - - + + - ... position - - - - - - - QFrame::NoFrame - - - QFrame::Raised - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Qt::Horizontal - - - - 223 - 20 - - - - - - - - H - - - - - - - - 0 - 0 - - - - - Auto - - - - - H. center - - - - - Left - - - - - Right - - - - - - - - V - - - - - - - - 0 - 0 - - - - - Auto - - - - - V. center - - - - - Bottom - - - - - Top - - - - - - - - - - - x = - - - - - - - - 0 - 0 - - - - - Sans Serif - 12 - 75 - false - true - false - false - - - - Ruler Properties - - - - - - - Delta (x/y) - - - - - - - - Diagonal - - - - - Horizonal and vertical (in this order) - - - - - Diagonal plus horizonal and vertical (triangle) - - - - - Vertical and horizonal (in this order) - - - - - Diagonal plus vertical and horizontal (triangle) - - - - - Box - - - - - Ellipse - - - - - - - - Second point (x/y) - - - - - - - Label format - - - - - - - First point (x/y) + Length @@ -652,69 +966,22 @@ - - + + - ... position + y = - - - - - 1 - 0 - - - - - - - - Style - - - - - - - - - - ... position - - - - - - - Y label format - - - - - - - Qt::Vertical - - - - 20 - 5 - - - - - - + + QFrame::NoFrame QFrame::Raised - + 0 @@ -728,92 +995,55 @@ 0 - + + + Snap to layout: + + + + + + + P1 + + + false + + + + + + + P2 + + + false + + + + + + + Both (auto-measure) + + + false + + + + + Qt::Horizontal - 223 + 40 20 - - - - H - - - - - - - - 0 - 0 - - - - - Auto - - - - - H. center - - - - - Left - - - - - Right - - - - - - - - V - - - - - - - - 0 - 0 - - - - - Auto - - - - - V. center - - - - - Bottom - - - - - Top - - - - @@ -848,6 +1078,8 @@ dy dd - + + + diff --git a/src/ant/ant/antPropertiesPage.cc b/src/ant/ant/antPropertiesPage.cc index 35c7e1d79..ad1c3df0e 100644 --- a/src/ant/ant/antPropertiesPage.cc +++ b/src/ant/ant/antPropertiesPage.cc @@ -31,14 +31,32 @@ namespace ant // ------------------------------------------------------------------------- // PropertiesPage implementation -PropertiesPage::PropertiesPage (ant::Service *rulers, QWidget *parent) - : lay::PropertiesPage (parent, rulers), mp_rulers (rulers), m_enable_cb_callback (true) +PropertiesPage::PropertiesPage (ant::Service *rulers, db::Manager *manager, QWidget *parent) + : lay::PropertiesPage (parent, manager, rulers), mp_rulers (rulers), m_enable_cb_callback (true) { mp_rulers->get_selection (m_selection); m_pos = m_selection.begin (); setupUi (this); + connect (p1x_to_p2x, SIGNAL (clicked ()), this, SLOT (xfer_coord_clicked ())); + connect (p2x_to_p1x, SIGNAL (clicked ()), this, SLOT (xfer_coord_clicked ())); + connect (p1y_to_p2y, SIGNAL (clicked ()), this, SLOT (xfer_coord_clicked ())); + connect (p2y_to_p1y, SIGNAL (clicked ()), this, SLOT (xfer_coord_clicked ())); + + connect (p1_to_layout, SIGNAL (clicked ()), this, SLOT (snap_to_layout_clicked ())); + connect (p2_to_layout, SIGNAL (clicked ()), this, SLOT (snap_to_layout_clicked ())); + connect (both_to_layout, SIGNAL (clicked ()), this, SLOT (snap_to_layout_clicked ())); + + p1x_to_p2x->setEnabled (! readonly()); + p2x_to_p1x->setEnabled (! readonly()); + p1y_to_p2y->setEnabled (! readonly()); + p2y_to_p1y->setEnabled (! readonly()); + + p1_to_layout->setEnabled (! readonly()); + p2_to_layout->setEnabled (! readonly()); + both_to_layout->setEnabled (! readonly()); + lay::activate_help_links (help_label); mp_rulers->clear_highlights (); @@ -61,6 +79,115 @@ PropertiesPage::front () m_pos = m_selection.begin (); } +void +PropertiesPage::xfer_coord_clicked () +{ + if (readonly ()) { + return; + } + + if (sender () == p1x_to_p2x) { + x2->setText (x1->text ()); + } else if (sender () == p2x_to_p1x) { + x1->setText (x2->text ()); + } else if (sender () == p1y_to_p2y) { + y2->setText (y1->text ()); + } else if (sender () == p2y_to_p1y) { + y1->setText (y2->text ()); + } + + db::Transaction t (manager (), tl::to_string (QObject::tr ("Copy ruler coordinates"))); + apply (); +} + +void +PropertiesPage::snap_to_layout_clicked () +{ + if (readonly ()) { + return; + } + + ant::Service *service = dynamic_cast (editable ()); + tl_assert (service != 0); + + double dx1 = 0.0, dy1 = 0.0, dx2 = 0.0, dy2 = 0.0; + tl::from_string (tl::to_string (x1->text ()), dx1); + tl::from_string (tl::to_string (x2->text ()), dx2); + tl::from_string (tl::to_string (y1->text ()), dy1); + tl::from_string (tl::to_string (y2->text ()), dy2); + + db::DPoint p1 (dx1, dy1), p2 (dx2, dy2); + + ant::Object r = current (); + + // for auto-metric we need some cutline constraint - any or global won't do. + lay::angle_constraint_type ac = r.angle_constraint (); + if (ac == lay::AC_Global) { + ac = service->snap_mode (); + } + if (ac == lay::AC_Global) { + ac = lay::AC_Diagonal; + } + + db::DVector g; + if (service->grid_snap ()) { + g = db::DVector (service->grid (), service->grid ()); + } + + if (sender () == p1_to_layout || sender () == p2_to_layout) { + + double snap_range = service->widget ()->mouse_event_trans ().inverted ().ctrans (service->snap_range ()); + double max_range = 1000 * snap_range; + + while (snap_range < max_range) { + + std::pair pp = lay::obj_snap (service->view (), p1, p1, g, ac, snap_range); + if (pp.first) { + + QString xs = tl::to_qstring (tl::micron_to_string (pp.second.x ())); + QString ys = tl::to_qstring (tl::micron_to_string (pp.second.y ())); + + if (sender () == p1_to_layout) { + x1->setText (xs); + y1->setText (ys); + } else { + x2->setText (xs); + y2->setText (ys); + } + + db::Transaction t (manager (), tl::to_string (sender () == p1_to_layout ? QObject::tr ("Snap first ruler point") : QObject::tr ("Snap second ruler point"))); + apply (); + + break; + + } + + // no point found -> one more iteration with increased range + snap_range *= 2.0; + + } + + } else { + + double snap_range = service->widget ()->mouse_event_trans ().inverted ().ctrans (service->snap_range ()); + snap_range *= 0.5; + + std::pair ee = lay::obj_snap2 (service->view (), p1, g, ac, snap_range, snap_range * 1000.0); + if (ee.first) { + + x1->setText (tl::to_qstring (tl::micron_to_string (ee.second.p1 ().x ()))); + y1->setText (tl::to_qstring (tl::micron_to_string (ee.second.p1 ().y ()))); + x2->setText (tl::to_qstring (tl::micron_to_string (ee.second.p2 ().x ()))); + y2->setText (tl::to_qstring (tl::micron_to_string (ee.second.p2 ().y ()))); + + db::Transaction t (manager (), tl::to_string (QObject::tr ("Snap both ruler points"))); + apply (); + + } + + } +} + const ant::Object & PropertiesPage::current () const { diff --git a/src/ant/ant/antPropertiesPage.h b/src/ant/ant/antPropertiesPage.h index 9e71ac471..0a4555c0d 100644 --- a/src/ant/ant/antPropertiesPage.h +++ b/src/ant/ant/antPropertiesPage.h @@ -39,7 +39,7 @@ class PropertiesPage Q_OBJECT public: - PropertiesPage (ant::Service *rulers, QWidget *parent); + PropertiesPage (ant::Service *rulers, db::Manager *manager, QWidget *parent); ~PropertiesPage (); virtual void back (); @@ -53,6 +53,10 @@ public: virtual bool readonly (); virtual void apply (); +private slots: + void xfer_coord_clicked (); + void snap_to_layout_clicked (); + private: std::vector m_selection; std::vector ::iterator m_pos; diff --git a/src/ant/ant/antService.cc b/src/ant/ant/antService.cc index 185446dbf..24a2397bf 100644 --- a/src/ant/ant/antService.cc +++ b/src/ant/ant/antService.cc @@ -2067,9 +2067,9 @@ Service::display_status (bool transient) } lay::PropertiesPage * -Service::properties_page (QWidget *parent) +Service::properties_page (db::Manager *manager, QWidget *parent) { - return new PropertiesPage (this, parent); + return new PropertiesPage (this, manager, parent); } void diff --git a/src/ant/ant/antService.h b/src/ant/ant/antService.h index 4c0f954e4..f8e6faaaf 100644 --- a/src/ant/ant/antService.h +++ b/src/ant/ant/antService.h @@ -333,7 +333,7 @@ public: /** * @brief Create the properties page */ - virtual lay::PropertiesPage *properties_page (QWidget * /*parent*/); + virtual lay::PropertiesPage *properties_page (db::Manager *manager, QWidget *parent); /** * @brief Get the selection for the properties page @@ -415,7 +415,39 @@ public: { return mp_view; } - + + /** + * @brief Gets the snap range + */ + int snap_range () const + { + return m_snap_range; + } + + /** + * @brief Gets the global snap mode + */ + lay::angle_constraint_type snap_mode () const + { + return m_snap_mode; + } + + /** + * @brief Gets the grid + */ + double grid () const + { + return m_grid; + } + + /** + * @brief Gets a value indicating whether to snap to grid + */ + bool grid_snap () const + { + return m_grid_snap; + } + /** * @brief Implement the menu response function */ diff --git a/src/edt/edt/edtInstPropertiesPage.cc b/src/edt/edt/edtInstPropertiesPage.cc index 12ca5280c..c6595e17a 100644 --- a/src/edt/edt/edtInstPropertiesPage.cc +++ b/src/edt/edt/edtInstPropertiesPage.cc @@ -44,8 +44,8 @@ namespace edt // ------------------------------------------------------------------------- // InstPropertiesPage implementation -InstPropertiesPage::InstPropertiesPage (edt::Service *service, QWidget *parent) - : lay::PropertiesPage (parent, service), mp_service (service), m_enable_cb_callback (true), mp_pcell_parameters (0) +InstPropertiesPage::InstPropertiesPage (edt::Service *service, db::Manager *manager, QWidget *parent) + : lay::PropertiesPage (parent, manager, service), mp_service (service), m_enable_cb_callback (true), mp_pcell_parameters (0) { m_selection_ptrs.reserve (service->selection ().size ()); for (edt::Service::obj_iterator s = service->selection ().begin (); s != service->selection ().end (); ++s) { diff --git a/src/edt/edt/edtInstPropertiesPage.h b/src/edt/edt/edtInstPropertiesPage.h index 014a645cf..361e57233 100644 --- a/src/edt/edt/edtInstPropertiesPage.h +++ b/src/edt/edt/edtInstPropertiesPage.h @@ -43,7 +43,7 @@ class InstPropertiesPage Q_OBJECT public: - InstPropertiesPage (edt::Service *service, QWidget *parent); + InstPropertiesPage (edt::Service *service, db::Manager *manager, QWidget *parent); ~InstPropertiesPage (); virtual void back (); diff --git a/src/edt/edt/edtPropertiesPages.cc b/src/edt/edt/edtPropertiesPages.cc index 8c71c113e..e0df67879 100644 --- a/src/edt/edt/edtPropertiesPages.cc +++ b/src/edt/edt/edtPropertiesPages.cc @@ -40,8 +40,8 @@ namespace edt // ------------------------------------------------------------------------- // ShapePropertiesPage implementation -ShapePropertiesPage::ShapePropertiesPage (edt::Service *service, QWidget *parent) - : lay::PropertiesPage (parent, service), +ShapePropertiesPage::ShapePropertiesPage (edt::Service *service, db::Manager *manager, QWidget *parent) + : lay::PropertiesPage (parent, manager, service), mp_service (service), m_enable_cb_callback (true) { m_selection_ptrs.reserve (service->selection ().size ()); @@ -403,8 +403,8 @@ ShapePropertiesPage::readonly () // ------------------------------------------------------------------------- // PolygonPropertiesPage implementation -PolygonPropertiesPage::PolygonPropertiesPage (edt::Service *service, QWidget *parent) - : ShapePropertiesPage (service, parent) +PolygonPropertiesPage::PolygonPropertiesPage (edt::Service *service, db::Manager *manager, QWidget *parent) + : ShapePropertiesPage (service, manager, parent) { setupUi (this); setup (); @@ -517,8 +517,8 @@ PolygonPropertiesPage::create_applicator (db::Shapes & /*shapes*/, const db::Sha static bool s_coordinateMode = true; -BoxPropertiesPage::BoxPropertiesPage (edt::Service *service, QWidget *parent) - : ShapePropertiesPage (service, parent), +BoxPropertiesPage::BoxPropertiesPage (edt::Service *service, db::Manager *manager, QWidget *parent) + : ShapePropertiesPage (service, manager, parent), m_recursion_sentinel (false), m_tab_index (0), m_dbu (1.0), m_lr_swapped (false), m_tb_swapped (false) { setupUi (this); @@ -669,8 +669,8 @@ BoxPropertiesPage::changed () // ------------------------------------------------------------------------- // TextPropertiesPage implementation -TextPropertiesPage::TextPropertiesPage (edt::Service *service, QWidget *parent) - : ShapePropertiesPage (service, parent) +TextPropertiesPage::TextPropertiesPage (edt::Service *service, db::Manager *manager, QWidget *parent) + : ShapePropertiesPage (service, manager, parent) { setupUi (this); setup (); @@ -755,8 +755,8 @@ TextPropertiesPage::create_applicator (db::Shapes & /*shapes*/, const db::Shape // ------------------------------------------------------------------------- // PathPropertiesPage implementation -PathPropertiesPage::PathPropertiesPage (edt::Service *service, QWidget *parent) - : ShapePropertiesPage (service, parent) +PathPropertiesPage::PathPropertiesPage (edt::Service *service, db::Manager *manager, QWidget *parent) + : ShapePropertiesPage (service, manager, parent) { setupUi (this); setup (); @@ -857,8 +857,8 @@ PathPropertiesPage::create_applicator (db::Shapes & /*shapes*/, const db::Shape // ------------------------------------------------------------------------- // EditablePathPropertiesPage implementation -EditablePathPropertiesPage::EditablePathPropertiesPage (edt::Service *service, QWidget *parent) - : ShapePropertiesPage (service, parent) +EditablePathPropertiesPage::EditablePathPropertiesPage (edt::Service *service, db::Manager *manager, QWidget *parent) + : ShapePropertiesPage (service, manager, parent) { setupUi (this); setup (); diff --git a/src/edt/edt/edtPropertiesPages.h b/src/edt/edt/edtPropertiesPages.h index 5fbadf5eb..006fb9c2a 100644 --- a/src/edt/edt/edtPropertiesPages.h +++ b/src/edt/edt/edtPropertiesPages.h @@ -45,7 +45,7 @@ class ShapePropertiesPage Q_OBJECT public: - ShapePropertiesPage (edt::Service *service, QWidget *parent); + ShapePropertiesPage (edt::Service *service, db::Manager *manager, QWidget *parent); ~ShapePropertiesPage (); virtual void back (); @@ -96,7 +96,7 @@ class PolygonPropertiesPage Q_OBJECT public: - PolygonPropertiesPage (edt::Service *service, QWidget *parent); + PolygonPropertiesPage (edt::Service *service, db::Manager *manager, QWidget *parent); virtual void do_update (const db::Shape &shape, double dbu, const std::string &lname); virtual ChangeApplicator *create_applicator (db::Shapes &shapes, const db::Shape &shape, double dbu); @@ -113,7 +113,7 @@ class BoxPropertiesPage Q_OBJECT public: - BoxPropertiesPage (edt::Service *service, QWidget *parent); + BoxPropertiesPage (edt::Service *service, db::Manager *manager, QWidget *parent); virtual void do_update (const db::Shape &shape, double dbu, const std::string &lname); virtual ChangeApplicator *create_applicator (db::Shapes &shapes, const db::Shape &shape, double dbu); @@ -142,7 +142,7 @@ class TextPropertiesPage Q_OBJECT public: - TextPropertiesPage (edt::Service *service, QWidget *parent); + TextPropertiesPage (edt::Service *service, db::Manager *manager, QWidget *parent); virtual void do_update (const db::Shape &shape, double dbu, const std::string &lname); virtual ChangeApplicator *create_applicator (db::Shapes &shapes, const db::Shape &shape, double dbu); @@ -159,7 +159,7 @@ class PathPropertiesPage Q_OBJECT public: - PathPropertiesPage (edt::Service *service, QWidget *parent); + PathPropertiesPage (edt::Service *service, db::Manager *manager, QWidget *parent); virtual void do_update (const db::Shape &shape, double dbu, const std::string &lname); virtual ChangeApplicator *create_applicator (db::Shapes &shapes, const db::Shape &shape, double dbu); @@ -176,7 +176,7 @@ class EditablePathPropertiesPage Q_OBJECT public: - EditablePathPropertiesPage (edt::Service *service, QWidget *parent); + EditablePathPropertiesPage (edt::Service *service, db::Manager *manager, QWidget *parent); virtual void do_update (const db::Shape &shape, double dbu, const std::string &lname); virtual ChangeApplicator *create_applicator (db::Shapes &shapes, const db::Shape &shape, double dbu); diff --git a/src/edt/edt/edtServiceImpl.cc b/src/edt/edt/edtServiceImpl.cc index 8de181dc9..462794098 100644 --- a/src/edt/edt/edtServiceImpl.cc +++ b/src/edt/edt/edtServiceImpl.cc @@ -296,9 +296,9 @@ PolygonService::PolygonService (db::Manager *manager, lay::LayoutView *view) } lay::PropertiesPage * -PolygonService::properties_page (QWidget *parent) +PolygonService::properties_page (db::Manager *manager, QWidget *parent) { - return new edt::PolygonPropertiesPage (this, parent); + return new edt::PolygonPropertiesPage (this, manager, parent); } void @@ -624,9 +624,9 @@ BoxService::BoxService (db::Manager *manager, lay::LayoutView *view) } lay::PropertiesPage * -BoxService::properties_page (QWidget *parent) +BoxService::properties_page (db::Manager *manager, QWidget *parent) { - return new edt::BoxPropertiesPage (this, parent); + return new edt::BoxPropertiesPage (this, manager, parent); } void @@ -712,9 +712,9 @@ TextService::~TextService () } lay::PropertiesPage * -TextService::properties_page (QWidget *parent) +TextService::properties_page (db::Manager *manager, QWidget *parent) { - return new edt::TextPropertiesPage (this, parent); + return new edt::TextPropertiesPage (this, manager, parent); } void @@ -895,12 +895,12 @@ PathService::~PathService () } lay::PropertiesPage * -PathService::properties_page (QWidget *parent) +PathService::properties_page (db::Manager *manager, QWidget *parent) { if (view ()->is_editable ()) { - return new edt::EditablePathPropertiesPage (this, parent); + return new edt::EditablePathPropertiesPage (this, manager, parent); } else { - return new edt::PathPropertiesPage (this, parent); + return new edt::PathPropertiesPage (this, manager, parent); } } @@ -1120,9 +1120,9 @@ InstService::InstService (db::Manager *manager, lay::LayoutView *view) } lay::PropertiesPage * -InstService::properties_page (QWidget *parent) +InstService::properties_page (db::Manager *manager, QWidget *parent) { - return new edt::InstPropertiesPage (this, parent); + return new edt::InstPropertiesPage (this, manager, parent); } bool diff --git a/src/edt/edt/edtServiceImpl.h b/src/edt/edt/edtServiceImpl.h index ca31dd672..503581144 100644 --- a/src/edt/edt/edtServiceImpl.h +++ b/src/edt/edt/edtServiceImpl.h @@ -85,7 +85,7 @@ class PolygonService public: PolygonService (db::Manager *manager, lay::LayoutView *view); - virtual lay::PropertiesPage *properties_page (QWidget *parent); + virtual lay::PropertiesPage *properties_page (db::Manager *manager, QWidget *parent); virtual void do_begin_edit (const db::DPoint &p); virtual void do_mouse_move (const db::DPoint &p); virtual bool do_mouse_click (const db::DPoint &p); @@ -114,7 +114,7 @@ class BoxService public: BoxService (db::Manager *manager, lay::LayoutView *view); - virtual lay::PropertiesPage *properties_page (QWidget *parent); + virtual lay::PropertiesPage *properties_page (db::Manager *manager, QWidget *parent); virtual void do_begin_edit (const db::DPoint &p); virtual void do_mouse_move (const db::DPoint &p); virtual bool do_mouse_click (const db::DPoint &p); @@ -139,7 +139,7 @@ public: TextService (db::Manager *manager, lay::LayoutView *view); ~TextService (); - virtual lay::PropertiesPage *properties_page (QWidget *parent); + virtual lay::PropertiesPage *properties_page (db::Manager *manager, QWidget *parent); virtual void do_begin_edit (const db::DPoint &p); virtual void do_mouse_transform (const db::DPoint &p, db::DFTrans trans); virtual void do_mouse_move (const db::DPoint &p); @@ -170,7 +170,7 @@ public: PathService (db::Manager *manager, lay::LayoutView *view); ~PathService (); - virtual lay::PropertiesPage *properties_page (QWidget *parent); + virtual lay::PropertiesPage *properties_page (db::Manager *manager, QWidget *parent); virtual void do_begin_edit (const db::DPoint &p); virtual void do_mouse_move (const db::DPoint &p); virtual bool do_mouse_click (const db::DPoint &p); @@ -204,7 +204,7 @@ class InstService public: InstService (db::Manager *manager, lay::LayoutView *view); - virtual lay::PropertiesPage *properties_page (QWidget *parent); + virtual lay::PropertiesPage *properties_page (db::Manager *manager, QWidget *parent); virtual void do_begin_edit (const db::DPoint &p); virtual void do_mouse_move (const db::DPoint &p); virtual bool do_mouse_click (const db::DPoint &p); diff --git a/src/img/img/imgPropertiesPage.cc b/src/img/img/imgPropertiesPage.cc index 870fb55aa..cdc9b01b3 100644 --- a/src/img/img/imgPropertiesPage.cc +++ b/src/img/img/imgPropertiesPage.cc @@ -36,8 +36,8 @@ const double max_gamma = 3.0; // ------------------------------------------------------------------------- // PropertiesPage implementation -PropertiesPage::PropertiesPage (img::Service *service, QWidget *parent) - : lay::PropertiesPage (parent, service), mp_service (service), mp_direct_image (0) +PropertiesPage::PropertiesPage (img::Service *service, db::Manager *manager, QWidget *parent) + : lay::PropertiesPage (parent, manager, service), mp_service (service), mp_direct_image (0) { mp_service->get_selection (m_selection); m_pos = m_selection.begin (); @@ -48,7 +48,7 @@ PropertiesPage::PropertiesPage (img::Service *service, QWidget *parent) } PropertiesPage::PropertiesPage (QWidget *parent) - : lay::PropertiesPage (parent, 0), mp_service (0), mp_direct_image (0) + : lay::PropertiesPage (parent, 0, 0), mp_service (0), mp_direct_image (0) { init (); } diff --git a/src/img/img/imgPropertiesPage.h b/src/img/img/imgPropertiesPage.h index 66517c166..81264baee 100644 --- a/src/img/img/imgPropertiesPage.h +++ b/src/img/img/imgPropertiesPage.h @@ -45,7 +45,7 @@ class PropertiesPage Q_OBJECT public: - PropertiesPage (img::Service *service, QWidget *parent); + PropertiesPage (img::Service *service, db::Manager *manager, QWidget *parent); PropertiesPage (QWidget *parent); ~PropertiesPage (); diff --git a/src/img/img/imgService.cc b/src/img/img/imgService.cc index 2bcafcf50..3b4987c14 100644 --- a/src/img/img/imgService.cc +++ b/src/img/img/imgService.cc @@ -1312,9 +1312,9 @@ Service::display_status (bool transient) } lay::PropertiesPage * -Service::properties_page (QWidget *parent) +Service::properties_page (db::Manager *manager, QWidget *parent) { - return new img::PropertiesPage (this, parent); + return new img::PropertiesPage (this, manager, parent); } void diff --git a/src/img/img/imgService.h b/src/img/img/imgService.h index e0c679bca..6d8c070ad 100644 --- a/src/img/img/imgService.h +++ b/src/img/img/imgService.h @@ -352,7 +352,7 @@ public: /** * @brief Create the properties page */ - virtual lay::PropertiesPage *properties_page (QWidget * /*parent*/); + virtual lay::PropertiesPage *properties_page (db::Manager *manager, QWidget *parent); /** * @brief Get the selection for the properties page diff --git a/src/laybasic/laybasic/layEditable.h b/src/laybasic/laybasic/layEditable.h index 6b48aa169..61f3e4995 100644 --- a/src/laybasic/laybasic/layEditable.h +++ b/src/laybasic/laybasic/layEditable.h @@ -331,7 +331,7 @@ public: * by the caller. The return value is 0 if the Editable object does * not support a properties page. */ - virtual lay::PropertiesPage *properties_page (QWidget * /*parent*/) + virtual lay::PropertiesPage *properties_page (db::Manager * /*manager*/, QWidget * /*parent*/) { return 0; } diff --git a/src/laybasic/laybasic/layProperties.cc b/src/laybasic/laybasic/layProperties.cc index 7b381dd7e..709b92133 100644 --- a/src/laybasic/laybasic/layProperties.cc +++ b/src/laybasic/laybasic/layProperties.cc @@ -27,8 +27,8 @@ namespace lay { -PropertiesPage::PropertiesPage (QWidget *parent, lay::Editable *editable) - : QFrame (parent), mp_editable (editable) +PropertiesPage::PropertiesPage (QWidget *parent, db::Manager *manager, lay::Editable *editable) + : QFrame (parent), mp_manager (manager), mp_editable (editable) { // .. nothing else .. } diff --git a/src/laybasic/laybasic/layProperties.h b/src/laybasic/laybasic/layProperties.h index f466710d7..f103e0eac 100644 --- a/src/laybasic/laybasic/layProperties.h +++ b/src/laybasic/laybasic/layProperties.h @@ -57,7 +57,7 @@ public: * empty, at_start () is supposed to return true then. * The dialog will call update () to update the display accordingly. */ - PropertiesPage (QWidget *parent, lay::Editable *editable); + PropertiesPage (QWidget *parent, db::Manager *manager, lay::Editable *editable); /** * @brief The destructor @@ -210,7 +210,17 @@ public: return mp_editable; } + /** + * @brief Gets the transaction manager object + * Use this object to implement undable operations on the properties page. + */ + db::Manager *manager () + { + return mp_manager; + } + private: + db::Manager *mp_manager; lay::Editable *mp_editable; }; diff --git a/src/laybasic/laybasic/layPropertiesDialog.cc b/src/laybasic/laybasic/layPropertiesDialog.cc index f668b285c..02e30507f 100644 --- a/src/laybasic/laybasic/layPropertiesDialog.cc +++ b/src/laybasic/laybasic/layPropertiesDialog.cc @@ -46,7 +46,7 @@ PropertiesDialog::PropertiesDialog (QWidget * /*parent*/, db::Manager *manager, mp_stack = new QStackedLayout; for (lay::Editables::iterator e = mp_editables->begin (); e != mp_editables->end (); ++e) { - mp_properties_pages.push_back (e->properties_page (content_frame)); + mp_properties_pages.push_back (e->properties_page (mp_manager, content_frame)); if (mp_properties_pages.back ()) { mp_stack->addWidget (mp_properties_pages.back ()); }