Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/laybasic/laybasic/gsiDeclLayMarker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,19 @@ Class<lay::ManagedDMarker> decl_Marker ("lay", "Marker",
"@brief Gets the halo flag\n"
"See \\halo= for a description of the halo flag."
) +
gsi::method ("text_frame_enabled=", (void (lay::ManagedDMarker::*) (bool)) &lay::ManagedDMarker::set_text_frame_enabled, gsi::arg ("enabled"),
"@brief Enables or disables the label frame\n"
"With the value set to true (the default), texts (labels) are drawn with a frame indicating the label dimension.\n"
"To turn off that frame, set this attribute to false.\n"
"\n"
"This attribute has been introduced in version 0.30.7."
) +
gsi::method ("text_frame_enabled", (bool (lay::ManagedDMarker::*) () const) &lay::ManagedDMarker::is_text_frame_enabled,
"@brief Gets a value indicating whether label frames are enabled\n"
"See \\text_frame_enabled= for a description of this attribute."
"\n"
"This attribute has been introduced in version 0.30.7."
) +
gsi::method ("dither_pattern=", (void (lay::ManagedDMarker::*) (int)) &lay::ManagedDMarker::set_dither_pattern, gsi::arg ("index"),
"@brief Sets the stipple pattern index\n"
"A value of -1 or less than zero indicates that the marker is not filled. Otherwise, the "
Expand Down
19 changes: 14 additions & 5 deletions src/laybasic/laybasic/layMarker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ void render_cell_inst (const db::Layout &layout, const db::CellInstArray &inst,

MarkerBase::MarkerBase (lay::LayoutViewBase *view)
: lay::ViewObject (view ? view->canvas () : 0),
m_line_width (-1), m_vertex_size (-1), m_halo (-1), m_text_enabled (true), m_vertex_shape (lay::ViewOp::Rect), m_line_style (-1), m_dither_pattern (-1), m_frame_pattern (0), mp_view (view)
m_line_width (-1), m_vertex_size (-1), m_halo (-1), m_text_enabled (true), m_text_frame_enabled (true), m_vertex_shape (lay::ViewOp::Rect), m_line_style (-1), m_dither_pattern (-1), m_frame_pattern (0), mp_view (view)
{
// .. nothing yet ..
}
Expand Down Expand Up @@ -266,6 +266,15 @@ MarkerBase::set_text_enabled (bool en)
}
}

void
MarkerBase::set_text_frame_enabled (bool en)
{
if (m_text_frame_enabled != en) {
m_text_frame_enabled = en;
redraw ();
}
}

void
MarkerBase::set_frame_pattern (int frame_pattern)
{
Expand Down Expand Up @@ -638,7 +647,7 @@ ShapeMarker::render (const Viewport &vp, ViewObjectCanvas &canvas)
if (trans_vector ()) {
for (std::vector<db::DCplxTrans>::const_iterator tr = trans_vector ()->begin (); tr != trans_vector ()->end (); ++tr) {
db::CplxTrans t = vp.trans () * *tr * trans ();
if (m_shape.is_text () && text) {
if (m_shape.is_text () && text && is_text_frame_enabled ()) {
// draw a frame around the text
lay::TextInfo ti (view ());
db::DCplxTrans vp_trans = vp.trans () * *tr;
Expand All @@ -654,7 +663,7 @@ ShapeMarker::render (const Viewport &vp, ViewObjectCanvas &canvas)
}
} else {
db::CplxTrans t = vp.trans () * trans ();
if (m_shape.is_text () && text) {
if (m_shape.is_text () && text && is_text_frame_enabled ()) {
// draw a frame around the text
lay::TextInfo ti (view ());
db::Text t;
Expand Down Expand Up @@ -1118,7 +1127,7 @@ Marker::draw (lay::Renderer &r, const db::CplxTrans &t, lay::CanvasPlane *fill,
// TODO: in order to draw the box we'd need a separation of dbu-to-micron and micron-to-pixel transformations ...
r.draw (*m_object.text, t, fill, contour, vertex, text);
} else if (m_type == DText) {
if (view () && text) {
if (view () && text && is_text_frame_enabled ()) {
// draw a frame around the text
lay::TextInfo ti (view ());
db::DCplxTrans dt (t);
Expand Down Expand Up @@ -1323,7 +1332,7 @@ DMarker::render (const Viewport &vp, ViewObjectCanvas &canvas)
} else if (m_type == Path) {
r.draw (*m_object.path, t, fill, contour, vertex, text);
} else if (m_type == Text) {
if (view () && text) {
if (view () && text && is_text_frame_enabled ()) {
// draw a frame around the text
lay::TextInfo ti (view ());
db::DBox box = ti.bbox (*m_object.text, t).enlarged (text_box_enlargement (t));
Expand Down
17 changes: 17 additions & 0 deletions src/laybasic/laybasic/layMarker.h
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,22 @@ class LAYBASIC_PUBLIC MarkerBase
*/
void set_text_enabled (bool en);

/**
* @brief Gets a value indicating whether text frame drawing is enabled
*
* If this value is true (the default), labels are drawn with a frame indicating the text box.
* Set this value to value to disable the text box.
*/
bool is_text_frame_enabled () const
{
return m_text_frame_enabled;
}

/**
* @brief Sets a value indicating whether text drawing is enabled
*/
void set_text_frame_enabled (bool en);

/**
* @brief Gets the bounding box
*/
Expand All @@ -255,6 +271,7 @@ class LAYBASIC_PUBLIC MarkerBase
tl::Color m_frame_color;
int m_line_width, m_vertex_size, m_halo;
bool m_text_enabled;
bool m_text_frame_enabled;
lay::ViewOp::Shape m_vertex_shape;
int m_line_style, m_dither_pattern, m_frame_pattern;
lay::LayoutViewBase *mp_view;
Expand Down
4 changes: 4 additions & 0 deletions testdata/ruby/layMarkers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ def test_1
m.dither_pattern = 15
assert_equal(m.dither_pattern, 15)

assert_equal(m.text_frame_enabled, true)
m.text_frame_enabled = false
assert_equal(m.text_frame_enabled, false)

# Keep the marker alive after GC.start:
# $marker = m

Expand Down
Loading