Debugging and finalization

This commit is contained in:
Matthias Koefferlein 2024-06-29 23:55:02 +02:00
parent b92c7bf225
commit 7eadac527b
3 changed files with 30 additions and 20 deletions

View File

@ -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);
}
}

View File

@ -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::vector<db::DCplxTra
db::DBox
GenericMarkerBase::bbox () const
{
const lay::CellView &cv = mp_view->cellview (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 ();

View File

@ -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<db::DCplxTrans> *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;
};
/**