mirror of https://github.com/KLayout/klayout.git
Feature: hide or show markers using the new View/Show Markers configuration option.
This commit is contained in:
parent
b64d14e02e
commit
5f8b258235
|
|
@ -837,6 +837,7 @@ MainWindow::init_menu ()
|
|||
MenuLayoutEntry ("show_grid", tl::to_string (QObject::tr ("Show Grid")), std::make_pair (cfg_grid_visible, "?")),
|
||||
MenuLayoutEntry ("default_grid:default_grids_group", tl::to_string (QObject::tr ("Grid")), empty_menu),
|
||||
MenuLayoutEntry::separator ("layout_group"),
|
||||
MenuLayoutEntry ("show_markers", tl::to_string (QObject::tr ("Show Markers")), std::make_pair (cfg_markers_visible, "?")),
|
||||
MenuLayoutEntry ("show_texts", tl::to_string (QObject::tr ("Show Texts")), std::make_pair (cfg_text_visible, "?")),
|
||||
MenuLayoutEntry ("show_cell_boxes", tl::to_string (QObject::tr ("Show Cell Frames")), std::make_pair (cfg_cell_box_visible, "?")),
|
||||
MenuLayoutEntry ("no_stipples", tl::to_string (QObject::tr ("Show Layers Without Fill")), std::make_pair (cfg_no_stipple, "?")),
|
||||
|
|
@ -1307,6 +1308,18 @@ MainWindow::about_to_exec ()
|
|||
}
|
||||
}
|
||||
|
||||
f = false;
|
||||
config_get (cfg_markers_visible, f);
|
||||
if (! f) {
|
||||
TipDialog td (this,
|
||||
tl::to_string (QObject::tr ("Markers are not visible because they have been turned off.\nYou may not see markers when using the marker browser feature.\n\nTo turn markers on, check \"Show Markers\" in the \"View\" menu.")),
|
||||
"show-markers");
|
||||
if (td.exec_dialog ()) {
|
||||
// Don't bother the user with more dialogs.
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
f = false;
|
||||
config_get (cfg_hide_empty_layers, f);
|
||||
if (f) {
|
||||
|
|
|
|||
|
|
@ -164,6 +164,18 @@ Class<lay::DMarker> decl_Marker ("Marker",
|
|||
"@brief Returns a value indicating whether the marker has a specific frame color\n"
|
||||
"The set method has been added in version 0.20.\n"
|
||||
) +
|
||||
gsi::method ("dismissable=", &lay::DMarker::set_dismissable,
|
||||
"@brief Sets a value indicating whether the marker can be hidden\n"
|
||||
"@args flag\n"
|
||||
"Dismissable markers can be hidden setting \"View/Show Markers\" to \"off\". "
|
||||
"The default setting is \"false\" meaning the marker can't be hidden.\n"
|
||||
"\n"
|
||||
"This attribute has been introduced in version 0.25.4."
|
||||
) +
|
||||
gsi::method ("dismissable?", &lay::DMarker::get_dismissable,
|
||||
"@brief Gets a value indicating whether the marker can be hidden\n"
|
||||
"See \\dismissable= for a description of this predicate."
|
||||
) +
|
||||
gsi::method ("line_width=", &lay::DMarker::set_line_width,
|
||||
"@brief Sets the line width of the marker\n"
|
||||
"@args width\n"
|
||||
|
|
|
|||
|
|
@ -378,6 +378,7 @@ LayoutView::init (db::Manager *mgr, lay::PluginRoot *root, QWidget * /*parent*/)
|
|||
m_apply_text_trans = true;
|
||||
m_default_text_size = 0.1;
|
||||
m_text_font = 0;
|
||||
m_show_markers = true;
|
||||
m_no_stipples = false;
|
||||
m_stipple_offset = true;
|
||||
m_fit_new_cell = true;
|
||||
|
|
@ -1149,6 +1150,13 @@ LayoutView::configure (const std::string &name, const std::string &value)
|
|||
apply_text_trans (flag);
|
||||
return true;
|
||||
|
||||
} else if (name == cfg_markers_visible) {
|
||||
|
||||
bool flag;
|
||||
tl::from_string (value, flag);
|
||||
mp_canvas->set_dismiss_view_objects (! flag);
|
||||
return true;
|
||||
|
||||
} else if (name == cfg_no_stipple) {
|
||||
|
||||
bool flag;
|
||||
|
|
@ -4917,7 +4925,16 @@ LayoutView::no_stipples (bool f)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
LayoutView::show_markers (bool f)
|
||||
{
|
||||
if (m_show_markers != f) {
|
||||
m_show_markers = f;
|
||||
mp_canvas->update_image ();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
LayoutView::text_color (QColor c)
|
||||
{
|
||||
if (m_text_color != c) {
|
||||
|
|
|
|||
|
|
@ -1062,6 +1062,19 @@ public:
|
|||
return m_default_text_size;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Show or hide markers
|
||||
*/
|
||||
void show_markers (bool f);
|
||||
|
||||
/**
|
||||
* @brief "show_markers" property getter
|
||||
*/
|
||||
bool show_markers () const
|
||||
{
|
||||
return m_show_markers;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Don't show stipples
|
||||
*/
|
||||
|
|
@ -2671,6 +2684,7 @@ private:
|
|||
bool m_apply_text_trans;
|
||||
double m_default_text_size;
|
||||
unsigned int m_text_font;
|
||||
bool m_show_markers;
|
||||
bool m_no_stipples;
|
||||
bool m_stipple_offset;
|
||||
|
||||
|
|
|
|||
|
|
@ -1510,6 +1510,7 @@ public:
|
|||
options.push_back (std::pair<std::string, std::string> (cfg_stipple_offset, "true"));
|
||||
options.push_back (std::pair<std::string, std::string> (cfg_line_style_palette, lay::LineStylePalette ().to_string ()));
|
||||
options.push_back (std::pair<std::string, std::string> (cfg_no_stipple, "false"));
|
||||
options.push_back (std::pair<std::string, std::string> (cfg_markers_visible, "true"));
|
||||
}
|
||||
|
||||
virtual std::vector<std::pair <std::string, ConfigPage *> > config_pages (QWidget *parent) const
|
||||
|
|
|
|||
|
|
@ -270,7 +270,7 @@ MarkerBase::set_line_style (int line_style)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
MarkerBase::get_bitmaps (const Viewport & /*vp*/, ViewObjectCanvas &canvas, lay::CanvasPlane *&fill, lay::CanvasPlane *&contour, lay::CanvasPlane *&vertex, lay::CanvasPlane *&text)
|
||||
{
|
||||
double resolution = canvas.resolution ();
|
||||
|
|
|
|||
|
|
@ -165,7 +165,7 @@ BackgroundViewObject::z_order (int z)
|
|||
// ViewObject implementation
|
||||
|
||||
ViewObject::ViewObject (ViewObjectWidget *widget, bool _static)
|
||||
: mp_widget (widget), m_static (_static), m_visible (true)
|
||||
: mp_widget (widget), m_static (_static), m_visible (true), m_dismissable (false)
|
||||
{
|
||||
if (widget) {
|
||||
widget->m_objects.push_back (this);
|
||||
|
|
@ -178,6 +178,15 @@ ViewObject::~ViewObject ()
|
|||
redraw ();
|
||||
}
|
||||
|
||||
void
|
||||
ViewObject::set_dismissable (bool dismissable)
|
||||
{
|
||||
if (m_dismissable != dismissable) {
|
||||
m_dismissable = dismissable;
|
||||
redraw ();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ViewObject::visible (bool vis)
|
||||
{
|
||||
|
|
@ -251,6 +260,7 @@ ViewService::set_cursor (lay::Cursor::cursor_shape cursor)
|
|||
|
||||
ViewObjectWidget::ViewObjectWidget (QWidget *parent, const char *name)
|
||||
: QWidget (parent),
|
||||
m_view_objects_dismissed (false),
|
||||
m_needs_update_static (false),
|
||||
m_needs_update_bg (false),
|
||||
mp_active_service (0),
|
||||
|
|
@ -888,7 +898,7 @@ ViewObjectWidget::do_render (const lay::Viewport &vp, lay::ViewObjectCanvas &can
|
|||
}
|
||||
|
||||
for (object_iterator obj = begin_objects (); obj != end_objects (); ++obj) {
|
||||
if (obj->m_static == st && obj->is_visible ()) {
|
||||
if (obj->m_static == st && obj->is_visible () && (! m_view_objects_dismissed || ! obj->get_dismissable ())) {
|
||||
BEGIN_PROTECTED_SILENT
|
||||
obj->render (vp, canvas);
|
||||
END_PROTECTED_SILENT
|
||||
|
|
@ -963,6 +973,16 @@ ViewObjectWidget::touch_bg ()
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
ViewObjectWidget::set_dismiss_view_objects (bool dismiss)
|
||||
{
|
||||
if (dismiss != m_view_objects_dismissed) {
|
||||
m_view_objects_dismissed = dismiss;
|
||||
touch ();
|
||||
update ();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ViewObjectWidget::objects_changed ()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -513,6 +513,23 @@ public:
|
|||
return const_cast<ViewObjectWidget *> (mp_widget.get());
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Gets a value indicating whether the marker can be dismissed (made invisible)
|
||||
*
|
||||
* Markers with this flag set to true can be hidden by using ViewObjectCanvas::show_markers.
|
||||
*/
|
||||
bool get_dismissable () const
|
||||
{
|
||||
return m_dismissable;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Sets a value indicating whether the marker can be dismissed (made invisible)
|
||||
*
|
||||
* See \\get_dismissable for details.
|
||||
*/
|
||||
void set_dismissable (bool f);
|
||||
|
||||
/**
|
||||
* @brief Set the visibility state of the view object
|
||||
*
|
||||
|
|
@ -561,6 +578,7 @@ private:
|
|||
tl::weak_ptr<ViewObjectWidget> mp_widget;
|
||||
bool m_static;
|
||||
bool m_visible;
|
||||
bool m_dismissable;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -905,6 +923,21 @@ public:
|
|||
*/
|
||||
void set_default_cursor (lay::Cursor::cursor_shape cursor);
|
||||
|
||||
/**
|
||||
* @brief Sets a value indicating whether dismissable view objects shall be drawn or not
|
||||
*
|
||||
* Markers with dismissable = false are always drawn. The default value is "false".
|
||||
*/
|
||||
void set_dismiss_view_objects (bool dismissed);
|
||||
|
||||
/**
|
||||
* @brief Gets a value indicating whether dismissable markers shall be drawn or not
|
||||
*/
|
||||
bool dismiss_view_objects () const
|
||||
{
|
||||
return m_view_objects_dismissed;
|
||||
}
|
||||
|
||||
protected:
|
||||
/**
|
||||
* @brief Qt focus event handler
|
||||
|
|
@ -985,6 +1018,7 @@ private:
|
|||
tl::weak_collection<lay::BackgroundViewObject> m_background_objects;
|
||||
std::list<lay::ViewService *> m_services;
|
||||
std::list<ViewService *> m_grabbed;
|
||||
bool m_view_objects_dismissed;
|
||||
bool m_needs_update_static;
|
||||
bool m_needs_update_bg;
|
||||
lay::ViewService *mp_active_service;
|
||||
|
|
|
|||
|
|
@ -70,6 +70,8 @@ static const std::string cfg_sel_line_style ("sel-line-style");
|
|||
static const std::string cfg_sel_transient_mode ("sel-transient-mode");
|
||||
static const std::string cfg_sel_inside_pcells_mode ("sel-inside-pcells-mode");
|
||||
|
||||
static const std::string cfg_markers_visible ("markers-visible");
|
||||
|
||||
static const std::string cfg_min_inst_label_size ("min-inst-label-size");
|
||||
static const std::string cfg_cell_box_text_font ("inst-label-font");
|
||||
static const std::string cfg_cell_box_text_transform ("inst-label-transform");
|
||||
|
|
|
|||
|
|
@ -2177,36 +2177,42 @@ MarkerBrowserPage::do_update_markers ()
|
|||
|
||||
mp_markers.push_back (new lay::DMarker (mp_view));
|
||||
mp_markers.back ()->set (trans * polygon_value->value ());
|
||||
mp_markers.back ()->set_dismissable (true);
|
||||
m_markers_bbox += trans * polygon_value->value ().box ();
|
||||
|
||||
} else if (edge_pair_value) {
|
||||
|
||||
mp_markers.push_back (new lay::DMarker (mp_view));
|
||||
mp_markers.back ()->set (trans * edge_pair_value->value ());
|
||||
mp_markers.back ()->set_dismissable (true);
|
||||
m_markers_bbox += trans * db::DBox (edge_pair_value->value ().bbox ());
|
||||
|
||||
} else if (edge_value) {
|
||||
|
||||
mp_markers.push_back (new lay::DMarker (mp_view));
|
||||
mp_markers.back ()->set (trans * edge_value->value ());
|
||||
mp_markers.back ()->set_dismissable (true);
|
||||
m_markers_bbox += trans * db::DBox (edge_value->value ().bbox ());
|
||||
|
||||
} else if (box_value) {
|
||||
|
||||
mp_markers.push_back (new lay::DMarker (mp_view));
|
||||
mp_markers.back ()->set (trans * box_value->value ());
|
||||
mp_markers.back ()->set_dismissable (true);
|
||||
m_markers_bbox += trans * box_value->value ();
|
||||
|
||||
} else if (text_value) {
|
||||
|
||||
mp_markers.push_back (new lay::DMarker (mp_view));
|
||||
mp_markers.back ()->set (trans * text_value->value ());
|
||||
mp_markers.back ()->set_dismissable (true);
|
||||
m_markers_bbox += trans * text_value->value ().box ();
|
||||
|
||||
} else if (path_value) {
|
||||
|
||||
mp_markers.push_back (new lay::DMarker (mp_view));
|
||||
mp_markers.back ()->set (trans * path_value->value ());
|
||||
mp_markers.back ()->set_dismissable (true);
|
||||
m_markers_bbox += trans * path_value->value ().box ();
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue