From 9184bef6f852c65c8246885bea3811dea719f843 Mon Sep 17 00:00:00 2001
From: Matthias Koefferlein
Date: Sun, 28 Jan 2024 18:25:02 +0100
Subject: [PATCH 01/10] Transient mode for auto-measure ruler
---
src/ant/ant/antService.cc | 159 ++++++++++++++++++++-----
src/ant/ant/antService.h | 50 +++++++-
src/laybasic/laybasic/layMove.cc | 5 +-
src/laybasic/laybasic/laySelector.h | 9 +-
src/laybasic/laybasic/layViewObject.cc | 10 +-
src/laybasic/laybasic/layViewObject.h | 16 +++
6 files changed, 200 insertions(+), 49 deletions(-)
diff --git a/src/ant/ant/antService.cc b/src/ant/ant/antService.cc
index f7506bea6..e1cc12f97 100644
--- a/src/ant/ant/antService.cc
+++ b/src/ant/ant/antService.cc
@@ -1056,8 +1056,18 @@ Service::Service (db::Manager *manager, lay::LayoutViewBase *view)
m_drawing (false), m_current (),
m_move_mode (MoveNone),
m_seg_index (0),
- m_current_template (0)
-{
+ m_current_template (0),
+ m_hover (false),
+ m_hover_wait (false),
+ m_hover_buttons (0),
+ m_mouse_in_window (false)
+{
+#if defined(HAVE_QT)
+ m_timer.setInterval (100 /*hover time*/);
+ m_timer.setSingleShot (true);
+ connect (&m_timer, SIGNAL (timeout ()), this, SLOT (timeout ()));
+#endif
+
mp_view->annotations_changed_event.add (this, &Service::annotations_changed);
}
@@ -1809,9 +1819,36 @@ Service::mouse_double_click_event (const db::DPoint & /*p*/, unsigned int button
return false;
}
+lay::TwoPointSnapToObjectResult
+Service::auto_measure (const db::DPoint &p, lay::angle_constraint_type ac, const ant::Template &tpl)
+{
+ // for auto-metric we need some cutline constraint - any or global won't do.
+ if (ac == lay::AC_Global) {
+ ac = tpl.angle_constraint ();
+ }
+ if (ac == lay::AC_Global) {
+ ac = m_snap_mode;
+ }
+ if (ac == lay::AC_Global) {
+ ac = lay::AC_Diagonal;
+ }
+
+ db::DVector g;
+ if (m_grid_snap) {
+ g = db::DVector (m_grid, m_grid);
+ }
+
+ double snap_range = ui ()->mouse_event_trans ().inverted ().ctrans (m_snap_range);
+ snap_range *= 0.5;
+
+ return lay::obj_snap2 (mp_view, p, g, ac, snap_range, snap_range * 1000.0);
+}
+
bool
Service::mouse_click_event (const db::DPoint &p, unsigned int buttons, bool prio)
{
+ hover_reset ();
+
if (prio && (buttons & lay::LeftButton) != 0) {
const ant::Template &tpl = current_template ();
@@ -1852,27 +1889,7 @@ Service::mouse_click_event (const db::DPoint &p, unsigned int buttons, bool prio
} else if (tpl.mode () == ant::Template::RulerAutoMetric) {
- // for auto-metric we need some cutline constraint - any or global won't do.
- lay::angle_constraint_type ac = ac_from_buttons (buttons);
- if (ac == lay::AC_Global) {
- ac = tpl.angle_constraint ();
- }
- if (ac == lay::AC_Global) {
- ac = m_snap_mode;
- }
- if (ac == lay::AC_Global) {
- ac = lay::AC_Diagonal;
- }
-
- db::DVector g;
- if (m_grid_snap) {
- g = db::DVector (m_grid, m_grid);
- }
-
- double snap_range = ui ()->mouse_event_trans ().inverted ().ctrans (m_snap_range);
- snap_range *= 0.5;
-
- lay::TwoPointSnapToObjectResult ee = lay::obj_snap2 (mp_view, p, g, ac, snap_range, snap_range * 1000.0);
+ lay::TwoPointSnapToObjectResult ee = auto_measure (p, ac_from_buttons (buttons), tpl);
if (ee.any) {
// begin the transaction
@@ -1968,21 +1985,33 @@ Service::create_measure_ruler (const db::DPoint &pt, lay::angle_constraint_type
bool
Service::mouse_move_event (const db::DPoint &p, unsigned int buttons, bool prio)
{
- if (prio) {
+ if (! prio) {
+ return false;
+ }
- lay::PointSnapToObjectResult snap_details;
- if (m_drawing) {
- snap_details = snap2_details (m_p1, p, mp_active_ruler->ruler (), ac_from_buttons (buttons));
- } else {
- const ant::Template &tpl = current_template ();
- snap_details = snap1_details (p, m_obj_snap && tpl.snap ());
- }
+ if (! m_drawing && m_mouse_in_window && view ()->transient_selection_mode ()) {
- mouse_cursor_from_snap_details (snap_details);
+ // Restart hover timer
+ m_hover_wait = true;
+#if defined(HAVE_QT)
+ m_timer.start ();
+#endif
+ m_hover_point = p;
+ m_hover_buttons = buttons;
}
- if (m_drawing && prio) {
+ lay::PointSnapToObjectResult snap_details;
+ if (m_drawing) {
+ snap_details = snap2_details (m_p1, p, mp_active_ruler->ruler (), ac_from_buttons (buttons));
+ } else {
+ const ant::Template &tpl = current_template ();
+ snap_details = snap1_details (p, m_obj_snap && tpl.snap ());
+ }
+
+ mouse_cursor_from_snap_details (snap_details);
+
+ if (m_drawing) {
set_cursor (lay::Cursor::cross);
@@ -2284,6 +2313,70 @@ Service::click_proximity (const db::DPoint &pos, lay::Editable::SelectionMode mo
}
}
+bool
+Service::enter_event (bool /*prio*/)
+{
+ m_mouse_in_window = true;
+ return false;
+}
+
+bool
+Service::leave_event (bool)
+{
+ m_mouse_in_window = false;
+ hover_reset ();
+ return false;
+}
+
+void
+Service::hover_reset ()
+{
+ if (m_hover_wait) {
+#if defined(HAVE_QT)
+ m_timer.stop ();
+#endif
+ m_hover_wait = false;
+ }
+ if (m_hover) {
+ // as we use the transient selection for the hover ruler, we have to remove it here
+ clear_transient_selection ();
+ m_hover = false;
+ }
+}
+
+#if defined(HAVE_QT)
+void
+Service::timeout ()
+{
+ m_hover_wait = false;
+ m_hover = true;
+
+ // as we use the transient selection for the hover ruler, we have to remove it here
+ clear_transient_selection ();
+
+ // transiently create an auto-metric ruler if requested
+
+ const ant::Template &tpl = current_template ();
+ if (tpl.mode () == ant::Template::RulerAutoMetric) {
+
+ lay::TwoPointSnapToObjectResult ee = auto_measure (m_hover_point, ac_from_buttons (m_hover_buttons), tpl);
+ if (ee.any) {
+
+ m_current = ant::Object (ee.first, ee.second, 0, tpl);
+
+ // HINT: there is no special style for "transient selection on rulers"
+ mp_transient_ruler = new ant::View (this, &m_current, true /*not selected*/);
+
+ if (! editables ()->has_selection ()) {
+ display_status (true);
+ }
+
+ }
+
+ }
+}
+#endif
+
bool
Service::transient_select (const db::DPoint &pos)
{
diff --git a/src/ant/ant/antService.h b/src/ant/ant/antService.h
index eaf664726..fb3ed67fe 100644
--- a/src/ant/ant/antService.h
+++ b/src/ant/ant/antService.h
@@ -39,6 +39,11 @@
#include
-out = in.drc(if_all(area > 0.5, rectangle))
+out = in.drc(if_all(area > 0.5, rectangles))
The condition expressions may be of any type (edges, edge pairs and polygons).
diff --git a/src/drc/drc/built-in-macros/_drc_cop_integration.rb b/src/drc/drc/built-in-macros/_drc_cop_integration.rb
index 8eebae6fb..7b617aab0 100644
--- a/src/drc/drc/built-in-macros/_drc_cop_integration.rb
+++ b/src/drc/drc/built-in-macros/_drc_cop_integration.rb
@@ -555,7 +555,7 @@ module DRC
# whose area is larger than 0.5 square micrometers:
#
# @code
- # out = in.drc(if_all(area > 0.5, rectangle))
+ # out = in.drc(if_all(area > 0.5, rectangles))
# @/code
#
# The condition expressions may be of any type (edges, edge pairs and polygons).
From ba61c4880f2376076dab117136006073bd938f26 Mon Sep 17 00:00:00 2001
From: Matthias Koefferlein
Date: Sun, 11 Feb 2024 15:22:41 +0100
Subject: [PATCH 09/10] [consider merging] Update of testcase which was broken
OAS
---
.../foreigncell/au_ignore_foreign.oas.gz | Bin 906 -> 1493 bytes
1 file changed, 0 insertions(+), 0 deletions(-)
diff --git a/testdata/lefdef/foreigncell/au_ignore_foreign.oas.gz b/testdata/lefdef/foreigncell/au_ignore_foreign.oas.gz
index c9dd21723297b02c121d520c30bd1668a62c76a4..907e6401611bfedbdf9ba20e545a14d60905272d 100644
GIT binary patch
literal 1493
zcmd^-{ZrBh9LK*8;ui%(5(*R32vSF;BpP~Qu>_SxD&}m4v-yB_M){a{w$e&$Vk(W9
zn77V{)Ky+-cGc=?YChCVO`F&%F(MyY1t^~r_Id*AzBzr61Ap-1wBp`Kyf
z$k0ffEeJC=dIM7kNLdA;ttfbyvdRh%PzZQ%aUm*jC|cUbw9WU%@?S7rn{LU}@d=(I
z4J<e(HAU^HUXl3oPp1NS#$wU=v}+3Mu8Ex~ST!f!&rX~kbP#ju+}jV)
zPKBYllaDXok8O2YpIbG2fC}g#EhsIG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=pB@Z
zQS4fr@@)CXo8!-aTJje1Zo$iOWZj5k>&Ga8!TDU;?tS`Mt?Qugw;vOJOpfD)AI!mm
z#1>*^2{~lsF_Ku?FowL#ogs-7;wVtYj}l*qPn)?S#Y8@br2xhG^h_pCZy;Z|Ndn!B
ze6E$r{+tBe4r_zR~!n(|g(;ls!521-ou
zCm^2C7(z;`4q*eMo_auZZFPz{#JPuI)COu-hY)2vwSJGd>bXPA
zK12l~Pa&kD%Bq~otAZL(MK!2Os;nxis)p1{YFJOcN?3gp@4`A(pTNQca&vwg`fwM1
z$6fdy2k;%<+<`T22Zp>JV<&!wK7W?nhWo^=_?G){k5uoIEwA7XP@ViZumwM&xrtkF
z6xfDM`~j^U{(#eC5V!*k{k^E6M;WTr9tYOAUHFFErxsQFuy6wVWB~KK@D$uhek0p(
zgeSBq1jmI@^O(4V7HmkGp-WEiFQmQnXVdM_;_|cMp1>*XwT?%0z&}`p@twI$otgMo
zXONZqut&b;tN~bk7}5vs3wz|hWrY|%5Dr3-NhSax59ze*kit?sVt
gK}f;y3EU&6s8A(kHju3SpAW
Date: Sun, 11 Feb 2024 16:22:42 +0100
Subject: [PATCH 10/10] Compatibility with older Ruby versions
---
testdata/ruby/dbRegionTest.rb | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/testdata/ruby/dbRegionTest.rb b/testdata/ruby/dbRegionTest.rb
index 0c196a6bd..d1dd6615a 100644
--- a/testdata/ruby/dbRegionTest.rb
+++ b/testdata/ruby/dbRegionTest.rb
@@ -1202,7 +1202,7 @@ class DBRegion_TestClass < TestBase
2.times do |ix|
2.times do |iy|
am = r.rasterize(RBA::Point::new(-50 + ix * ps.x, -20 + iy * ps.y), pd, ps, 7, 7)
- sum += am.collect { |r| r.sum }.sum
+ sum += am.collect { |r| r.inject(:+) }.inject(:+)
end
end
@@ -1212,7 +1212,7 @@ class DBRegion_TestClass < TestBase
pd = RBA::Vector::new(50, 50)
am = r.rasterize(RBA::Point::new(-50, -20), pd, 7, 7)
- sum = am.collect { |r| r.sum }.sum
+ sum = am.collect { |r| r.inject(:+) }.inject(:+)
assert_equal("%.12g" % sum, "%.12g" % (7.0 * pd.x * pd.y))