diff --git a/src/ant/ant/RulerPropertiesPage.ui b/src/ant/ant/RulerPropertiesPage.ui
index ef0074318..5e4497bbd 100644
--- a/src/ant/ant/RulerPropertiesPage.ui
+++ b/src/ant/ant/RulerPropertiesPage.ui
@@ -7,7 +7,7 @@
0
0
622
- 502
+ 621
@@ -53,6 +53,96 @@
6
+ -
+
+
+ Second point (x/y)
+
+
+
+ -
+
+
+ Style
+
+
+
+ -
+
+
+ <html>(See <a href="int:/manual/ruler_properties.xml">here</a> for a description of the properties)</html>
+
+
+
+ -
+
+
+ ... position
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 5
+
+
+
+
+ -
+
+
+ -
+
+
-
+
+ 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
+
+
+
+
+ -
+
+
+ d =
+
+
+
-
@@ -66,91 +156,22 @@
- -
-
+
-
+
Qt::Vertical
+
+ QSizePolicy::Fixed
+
- 20
- 5
+ 456
+ 16
- -
-
-
-
- 1
- 0
-
-
-
-
- -
-
-
- x =
-
-
-
- -
-
-
- Outline
-
-
-
- -
-
-
- <html>(See <a href="int:/manual/ruler_properties.xml">here</a> for a description of the properties)</html>
-
-
-
- -
-
-
-
- 1
- 0
-
-
-
- true
-
-
-
- -
-
-
- X label format
-
-
-
- -
-
-
- y =
-
-
-
- -
-
-
- y =
-
-
-
- -
-
-
- d =
-
-
-
-
-
@@ -195,10 +216,20 @@
+ -
+
+
+
+ 1
+ 0
+
+
+
+
-
-
+
- Length
+ Delta (x/y)
@@ -347,83 +378,38 @@
- -
-
-
-
- 1
- 0
-
-
-
- true
-
-
-
- -
+
-
Qt::Horizontal
- -
-
-
-
- 1
- 0
-
-
-
-
- -
-
-
- -
-
+
-
+
x =
- -
-
-
-
- 1
- 0
-
-
-
- true
-
-
-
- -
-
-
-
- 1
- 0
-
-
-
-
- -
-
-
- -
-
+
-
+
- y =
+ Label format
- -
-
+
-
+
- ... position
+ Length
+
+
+
+ -
+
+
+ Outline
@@ -538,94 +524,29 @@
- -
-
-
- x =
-
-
-
- -
-
+
-
+
-
- 0
+
+ 1
0
-
-
- Sans Serif
- 12
- 75
- false
- true
- false
- false
-
-
-
- Ruler Properties
+
+ true
- -
-
-
- Delta (x/y)
+
-
+
+
+
+ 1
+ 0
+
-
-
- -
-
-
-
-
- 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
+
+ true
@@ -636,31 +557,8 @@
- -
-
-
- Qt::Vertical
-
-
- QSizePolicy::Fixed
-
-
-
- 456
- 16
-
-
-
-
- -
-
-
- ... position
-
-
-
- -
-
+
-
+
1
@@ -669,32 +567,112 @@
- -
-
+
-
+
- Style
+ y =
- -
-
-
- -
-
-
- ... position
+
-
+
+
+ QFrame::NoFrame
+
+ QFrame::Raised
+
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
-
+
+
+ Swap points
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+ QSizePolicy::Fixed
+
+
+
+ 10
+ 20
+
+
+
+
+ -
+
+
+ Snap to layout:
+
+
+
+ -
+
+
+ P1
+
+
+ false
+
+
+
+ -
+
+
+ P2
+
+
+ false
+
+
+
+ -
+
+
+ Both (auto-measure)
+
+
+ false
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+
- -
-
-
- Y label format
-
-
-
- -
-
+
-
+
Qt::Vertical
@@ -706,6 +684,49 @@
+ -
+
+
+ y =
+
+
+
+ -
+
+
+ -
+
+
+
+ 1
+ 0
+
+
+
+ true
+
+
+
+ -
+
+
+
+ 1
+ 0
+
+
+
+
+ -
+
+
+ ... position
+
+
+
+ -
+
+
-
@@ -817,6 +838,82 @@
+ -
+
+
+ ... position
+
+
+
+ -
+
+
+ x =
+
+
+
+ -
+
+
+
+ 1
+ 0
+
+
+
+
+ -
+
+
+ Y label format
+
+
+
+ -
+
+
+ X label format
+
+
+
+ -
+
+
+ y =
+
+
+
+ -
+
+
+ x =
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ Sans Serif
+ 12
+ 75
+ false
+ true
+ false
+ false
+
+
+
+ Ruler Properties
+
+
+
diff --git a/src/ant/ant/antPropertiesPage.cc b/src/ant/ant/antPropertiesPage.cc
index 35c7e1d79..847e58754 100644
--- a/src/ant/ant/antPropertiesPage.cc
+++ b/src/ant/ant/antPropertiesPage.cc
@@ -31,14 +31,25 @@ 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 (swap_points, SIGNAL (clicked ()), this, SLOT (swap_points_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 ()));
+
+ swap_points->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 +72,118 @@ PropertiesPage::front ()
m_pos = m_selection.begin ();
}
+void
+PropertiesPage::swap_points_clicked ()
+{
+ if (readonly ()) {
+ return;
+ }
+
+ QString tx1 = x1->text (), tx2 = x2->text ();
+ QString ty1 = y1->text (), ty2 = y2->text ();
+
+ std::swap (tx1, tx2);
+ std::swap (ty1, ty2);
+
+ x1->setText (tx1);
+ x2->setText (tx2);
+ y1->setText (ty1);
+ y2->setText (ty2);
+
+ db::Transaction t (manager (), tl::to_string (QObject::tr ("Swap ruler points")));
+ 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) {
+
+ bool snap_p1 = sender () == p1_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 (), snap_p1 ? p2 : p1, snap_p1 ? p1 : p2, 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 (snap_p1 ? 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, p2, 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..5cb1d2a06 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 swap_points_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/ant/ant/gsiDeclAnt.cc b/src/ant/ant/gsiDeclAnt.cc
index ee891d633..68cb6f6c1 100644
--- a/src/ant/ant/gsiDeclAnt.cc
+++ b/src/ant/ant/gsiDeclAnt.cc
@@ -47,6 +47,7 @@ static int outline_diag_xy () { return int (ant::Object::OL_diag_xy); }
static int outline_yx () { return int (ant::Object::OL_yx); }
static int outline_diag_yx () { return int (ant::Object::OL_diag_yx); }
static int outline_box () { return int (ant::Object::OL_box); }
+static int outline_ellipse () { return int (ant::Object::OL_ellipse); }
static int angle_any () { return int (lay::AC_Any); }
static int angle_diagonal () { return int (lay::AC_Diagonal); }
@@ -552,6 +553,13 @@ gsi::Class decl_Annotation (decl_BasicAnnotation, "lay", "Annotat
"start and end point. All box edges are drawn in the style specified with the \\style "
"attribute."
) +
+ gsi::method ("OutlineEllipse|#outline_ellipse", &gsi::outline_ellipse,
+ "@brief Gets the ellipse outline code for use with the \\outline method\n"
+ "When this outline style is specified, an ellipse is drawn with the extensions specified by the "
+ "start and end point. The contour drawn as a line.\n"
+ "\n"
+ "This constant has been introduced in version 0.26."
+ ) +
gsi::method ("AngleAny|#angle_any", &gsi::angle_any,
"@brief Gets the any angle code for use with the \\angle_constraint method\n"
"If this value is specified for the angle constraint, all angles will be allowed."
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/lay/lay/doc/programming/application_api.xml b/src/lay/lay/doc/programming/application_api.xml
index f88751b9f..1fb7914fe 100644
--- a/src/lay/lay/doc/programming/application_api.xml
+++ b/src/lay/lay/doc/programming/application_api.xml
@@ -915,7 +915,7 @@ begin
view.transaction("Restyle annotations")
view.each_annotation do |a|
- adup.style = RBA::Annotation::StyleArrowBoth
+ a.style = RBA::Annotation::StyleArrowBoth
end
ensure
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 ());
}
diff --git a/src/laybasic/laybasic/laySnap.cc b/src/laybasic/laybasic/laySnap.cc
index a524ec607..0989441d4 100644
--- a/src/laybasic/laybasic/laySnap.cc
+++ b/src/laybasic/laybasic/laySnap.cc
@@ -441,7 +441,7 @@ private:
if (m_directed) {
for (std::vector::const_iterator cl = m_cutlines.begin (); cl != m_cutlines.end (); ++cl) {
- if (db::sprod_sign (p - cl->p1 (), cl->d ()) <= 0) {
+ if (db::sprod_sign (p - m_original, cl->d ()) <= 0) {
return;
}
}
@@ -462,7 +462,7 @@ private:
if (m_directed) {
for (std::vector::const_iterator cl = m_cutlines.begin (); cl != m_cutlines.end (); ++cl) {
- if (db::sprod_sign (p - cl->p1 (), cl->d ()) < 0) {
+ if (db::sprod_sign (p - m_original, cl->d ()) < 0) {
return;
}
}
@@ -552,7 +552,7 @@ private:
std::pair ip = e.intersect_point (db::DEdge (e1, e2));
if (ip.first) {
- find_closest (ip.second, e);
+ find_closest_exact (ip.second, e);
}
}
@@ -765,10 +765,12 @@ do_obj_snap (lay::LayoutView *view, const db::DPoint &pt, const db::DVector &gri
}
std::pair
-do_obj_snap2 (lay::LayoutView *view, const db::DPoint &pt, const db::DVector &grid, double min_search_range, double max_search_range, const std::vector &cutlines)
+do_obj_snap2 (lay::LayoutView *view, const db::DPoint &pt1, const db::DPoint &pt2, const db::DVector &grid, double min_search_range, double max_search_range, const std::vector &cutlines)
{
- db::DPoint dp (pt);
- ContourFinder finder (dp, grid, cutlines, false /*no vertex snap*/);
+ db::DPoint dp1 (pt1);
+ db::DPoint dp2 (pt2);
+
+ ContourFinder finder (dp1, grid, cutlines, cutlines.empty () /*vertex snap on "any direction"*/);
double sr = min_search_range;
while (sr < max_search_range + 1e-6) {
@@ -788,9 +790,9 @@ do_obj_snap2 (lay::LayoutView *view, const db::DPoint &pt, const db::DVector &gr
for (std::vector::const_iterator i = cutlines.begin (); i != cutlines.end (); ++i) {
db::DVector n = i->d ();
- db::DVector d = dp - p1;
+ db::DVector d = dp2 - p1;
if (fabs (db::vprod (n, d)) < 1e-6 * n.length () * d.length ()) {
- if (db::sprod (n, d) < 0.0) {
+ if (db::sprod_sign (n, d) < 0) {
n = -n;
}
cl.push_back (db::DEdge (p1, p1 + n));
@@ -798,17 +800,21 @@ do_obj_snap2 (lay::LayoutView *view, const db::DPoint &pt, const db::DVector &gr
}
+ } else if (finder.is_vertex ()) {
+
+ cl.push_back (db::DEdge (p1, dp2));
+
} else if (finder.has_found_edge ()) {
n = finder.get_found_edge ().d ().transformed (db::DTrans (db::DTrans::r90));
- if (db::sprod (n, dp - p1) < 0.0) {
+ if (db::sprod_sign (n, dp2 - p1) < 0) {
n = -n;
}
cl.push_back (db::DEdge (p1, p1 + n));
}
- ContourFinder finder2 (dp, grid, cl, false /*no vertex snap*/, true /*directional cutlines*/);
+ ContourFinder finder2 (dp2, grid, cl, false /*no vertex snap*/, true /*directional cutlines*/);
double sr2 = min_search_range;
while (sr2 < max_search_range + 1e-6) {
@@ -872,17 +878,33 @@ obj_snap (lay::LayoutView *view, const db::DPoint &p1, const db::DPoint &p2, con
std::pair
obj_snap2 (lay::LayoutView *view, const db::DPoint &pt, const db::DVector &grid, double min_search_range, double max_search_range)
{
- return do_obj_snap2 (view, lay::snap_xy (pt, grid), db::DVector (), min_search_range, max_search_range, std::vector ());
+ return obj_snap2 (view, pt, pt, grid, min_search_range, max_search_range);
}
std::pair
-obj_snap2 (lay::LayoutView *view, const db::DPoint &pt, const db::DVector &grid, lay::angle_constraint_type snap_mode, double min_search_range, double max_search_range)
+obj_snap2 (lay::LayoutView *view, const db::DPoint &pt, const db::DVector &grid, lay::angle_constraint_type ac, double min_search_range, double max_search_range)
{
- db::DPoint dp = lay::snap_xy (pt, grid);
+ return obj_snap2 (view, pt, pt, grid, ac, min_search_range, max_search_range);
+}
+
+std::pair
+obj_snap2 (lay::LayoutView *view, const db::DPoint &pt1, const db::DPoint &pt2, const db::DVector &grid, double min_search_range, double max_search_range)
+{
+ db::DPoint dp1 = lay::snap_xy (pt1, grid);
+ db::DPoint dp2 = lay::snap_xy (pt2, grid);
+
+ return do_obj_snap2 (view, dp1, dp2, db::DVector (), min_search_range, max_search_range, std::vector ());
+}
+
+std::pair
+obj_snap2 (lay::LayoutView *view, const db::DPoint &pt1, const db::DPoint &pt2, const db::DVector &grid, lay::angle_constraint_type snap_mode, double min_search_range, double max_search_range)
+{
+ db::DPoint dp1 = lay::snap_xy (pt1, grid);
+ db::DPoint dp2 = lay::snap_xy (pt2, grid);
std::vector cutlines;
- make_cutlines (snap_mode, dp, cutlines);
- return do_obj_snap2 (view, dp, db::DVector (), min_search_range, max_search_range, cutlines);
+ make_cutlines (snap_mode, dp1, cutlines);
+ return do_obj_snap2 (view, dp1, dp2, db::DVector (), min_search_range, max_search_range, cutlines);
}
}
diff --git a/src/laybasic/laybasic/laySnap.h b/src/laybasic/laybasic/laySnap.h
index 9e7248446..1913887da 100644
--- a/src/laybasic/laybasic/laySnap.h
+++ b/src/laybasic/laybasic/laySnap.h
@@ -143,6 +143,16 @@ namespace lay
*/
LAYBASIC_PUBLIC std::pair obj_snap2 (lay::LayoutView *view, const db::DPoint &pt, const db::DVector &grid, double min_search_range, double max_search_range);
+ /**
+ * @brief Same than obj_snap, but delivers two points on two opposite sides of the initial points
+ *
+ * This method basically implements "auto measure". The first value of the returned pair
+ * is true if such an edge could be found. Otherwise it's false.
+ *
+ * This version accepts two points defining different search regions for first and second edge.
+ */
+ LAYBASIC_PUBLIC std::pair obj_snap2 (lay::LayoutView *view, const db::DPoint &pt1, const db::DPoint &pt2, const db::DVector &grid, double min_search_range, double max_search_range);
+
/**
* @brief Same than the previous obj_snap2, but allows specification of an angle constraint
*
@@ -150,6 +160,15 @@ namespace lay
*/
LAYBASIC_PUBLIC std::pair obj_snap2 (lay::LayoutView *view, const db::DPoint &pt, const db::DVector &grid, lay::angle_constraint_type ac, double min_search_range, double max_search_range);
+ /**
+ * @brief Same than the previous obj_snap2, but allows specification of an angle constraint
+ *
+ * Measurements will be confined to the direction specified.
+ *
+ * This version accepts two points defining different search regions for first and second edge.
+ */
+ LAYBASIC_PUBLIC std::pair obj_snap2 (lay::LayoutView *view, const db::DPoint &pt1, const db::DPoint &pt2, const db::DVector &grid, lay::angle_constraint_type ac, double min_search_range, double max_search_range);
+
/**
* @brief Reduce a given vector according to the angle constraint
*/