From 7eadac527bc181ee06e7eee32d044bba57188b56 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sat, 29 Jun 2024 23:55:02 +0200 Subject: [PATCH] Debugging and finalization --- .../laybasic/gsiDeclLayLayoutViewBase.cc | 2 ++ src/laybasic/laybasic/layMarker.cc | 27 ++++++++++++------- src/laybasic/laybasic/layMarker.h | 21 +++++++-------- 3 files changed, 30 insertions(+), 20 deletions(-) diff --git a/src/laybasic/laybasic/gsiDeclLayLayoutViewBase.cc b/src/laybasic/laybasic/gsiDeclLayLayoutViewBase.cc index 9dce193e2..22e12cc9c 100644 --- a/src/laybasic/laybasic/gsiDeclLayLayoutViewBase.cc +++ b/src/laybasic/laybasic/gsiDeclLayLayoutViewBase.cc @@ -474,6 +474,8 @@ static void add_marker (lay::LayoutViewBase *view, lay::ManagedDMarker *object) { if (view->canvas ()) { view->canvas ()->add_object (object); + object->keep (); + object->set_view (view); } } diff --git a/src/laybasic/laybasic/layMarker.cc b/src/laybasic/laybasic/layMarker.cc index dabea8f11..42b8d2d61 100644 --- a/src/laybasic/laybasic/layMarker.cc +++ b/src/laybasic/laybasic/layMarker.cc @@ -203,7 +203,16 @@ MarkerBase::MarkerBase (lay::LayoutViewBase *view) // .. nothing yet .. } -void +void +MarkerBase::set_view (LayoutViewBase *view) +{ + if (mp_view != view) { + mp_view = view; + redraw (); + } +} + +void MarkerBase::set_frame_color (tl::Color color) { if (color != m_frame_color) { @@ -381,7 +390,7 @@ MarkerBase::get_bitmaps (const Viewport & /*vp*/, ViewObjectCanvas &canvas, lay: // ------------------------------------------------------------------------ GenericMarkerBase::GenericMarkerBase (lay::LayoutViewBase *view, unsigned int cv_index) - : MarkerBase (view), mp_trans_vector (0), mp_view (view), m_cv_index (cv_index) + : MarkerBase (view), mp_trans_vector (0), m_cv_index (cv_index) { // .. nothing yet .. } @@ -463,7 +472,7 @@ GenericMarkerBase::set (const db::DCplxTrans &t1, const std::vectorcellview (m_cv_index); + const lay::CellView &cv = view ()->cellview (m_cv_index); if (! cv.is_valid ()) { return db::DBox (); } @@ -483,11 +492,11 @@ GenericMarkerBase::bbox () const const db::Layout * GenericMarkerBase::layout () const { - if (m_cv_index >= (unsigned int) (mp_view->cellviews ())) { + if (m_cv_index >= (unsigned int) (view ()->cellviews ())) { return 0; } - const lay::CellView &cv = mp_view->cellview (m_cv_index); + const lay::CellView &cv = view ()->cellview (m_cv_index); if (! cv.is_valid ()) { return 0; } else { @@ -1175,7 +1184,7 @@ Marker::render (const Viewport &vp, ViewObjectCanvas &canvas) // ------------------------------------------------------------------------ DMarker::DMarker (LayoutViewBase *view) - : MarkerBase (view), mp_view (view) + : MarkerBase (view) { m_type = None; m_object.any = 0; @@ -1304,9 +1313,9 @@ DMarker::render (const Viewport &vp, ViewObjectCanvas &canvas) lay::Renderer &r = canvas.renderer (); - r.set_font (db::Font (mp_view->text_font ())); - r.apply_text_trans (mp_view->apply_text_trans ()); - r.default_text_size (mp_view->default_text_size ()); + r.set_font (db::Font (view ()->text_font ())); + r.apply_text_trans (view ()->apply_text_trans ()); + r.default_text_size (view ()->default_text_size ()); r.set_precise (true); db::DCplxTrans t = vp.trans (); diff --git a/src/laybasic/laybasic/layMarker.h b/src/laybasic/laybasic/layMarker.h index 14312380e..1b0dd9629 100644 --- a/src/laybasic/laybasic/layMarker.h +++ b/src/laybasic/laybasic/layMarker.h @@ -62,6 +62,11 @@ public: */ MarkerBase (lay::LayoutViewBase *view); + /** + * @brief Attaches to a new view + */ + void set_view (lay::LayoutViewBase *view); + /** * @brief Get the color by which the marker is drawn * @@ -232,6 +237,11 @@ protected: return mp_view; } + const lay::LayoutViewBase *view () const + { + return mp_view; + } + private: tl::Color m_color; tl::Color m_frame_color; @@ -325,14 +335,6 @@ public: return m_cv_index; } - /** - * @brief Gets the view object - */ - lay::LayoutViewBase *view () const - { - return mp_view; - } - /** * @brief Gets the bounding box */ @@ -351,7 +353,6 @@ public: private: db::CplxTrans m_trans; std::vector *mp_trans_vector; - lay::LayoutViewBase *mp_view; unsigned int m_cv_index; /** @@ -828,8 +829,6 @@ private: db::DText *text; void *any; } m_object; - - lay::LayoutViewBase *mp_view; }; /**