mirror of https://github.com/KLayout/klayout.git
Bugfix: tab title was not updated when current cell is renamed
This commit is contained in:
parent
32fe65adc0
commit
414a06c70f
|
|
@ -607,7 +607,7 @@ LAYBASIC_PUBLIC Class<lay::LayoutViewBase> decl_LayoutViewBase ("lay", "LayoutVi
|
||||||
"\n"
|
"\n"
|
||||||
"See \\set_title and \\title for a description about how titles are handled."
|
"See \\set_title and \\title for a description about how titles are handled."
|
||||||
) +
|
) +
|
||||||
gsi::method ("title", static_cast<std::string (lay::LayoutViewBase::*) () const> (&lay::LayoutViewBase::title),
|
gsi::method ("title", static_cast<const std::string &(lay::LayoutViewBase::*) () const> (&lay::LayoutViewBase::title),
|
||||||
"@brief Returns the view's title string\n"
|
"@brief Returns the view's title string\n"
|
||||||
"\n"
|
"\n"
|
||||||
"@return The title string\n"
|
"@return The title string\n"
|
||||||
|
|
|
||||||
|
|
@ -539,7 +539,7 @@ void LayoutViewBase::update_event_handlers ()
|
||||||
cellview (i)->layout ().dbu_changed_event.add (this, &LayoutViewBase::signal_bboxes_changed);
|
cellview (i)->layout ().dbu_changed_event.add (this, &LayoutViewBase::signal_bboxes_changed);
|
||||||
cellview (i)->layout ().prop_ids_changed_event.add (this, &LayoutViewBase::signal_prop_ids_changed);
|
cellview (i)->layout ().prop_ids_changed_event.add (this, &LayoutViewBase::signal_prop_ids_changed);
|
||||||
cellview (i)->layout ().layer_properties_changed_event.add (this, &LayoutViewBase::signal_layer_properties_changed);
|
cellview (i)->layout ().layer_properties_changed_event.add (this, &LayoutViewBase::signal_layer_properties_changed);
|
||||||
cellview (i)->layout ().cell_name_changed_event.add (this, &LayoutViewBase::signal_cell_name_changed);
|
cellview (i)->layout ().cell_name_changed_event.add (this, &LayoutViewBase::signal_cell_name_changed, i);
|
||||||
cellview (i)->apply_technology_with_sender_event.add (this, &LayoutViewBase::signal_apply_technology);
|
cellview (i)->apply_technology_with_sender_event.add (this, &LayoutViewBase::signal_apply_technology);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -685,13 +685,30 @@ LayoutViewBase::is_dirty () const
|
||||||
return m_dirty;
|
return m_dirty;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string
|
const std::string &
|
||||||
LayoutViewBase::title () const
|
LayoutViewBase::title () const
|
||||||
|
{
|
||||||
|
return m_current_title;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
LayoutViewBase::update_title ()
|
||||||
{
|
{
|
||||||
if (! m_title.empty ()) {
|
if (! m_title.empty ()) {
|
||||||
return m_title;
|
|
||||||
|
if (m_title != m_current_title) {
|
||||||
|
m_current_title = m_title;
|
||||||
|
emit_title_changed ();
|
||||||
|
}
|
||||||
|
|
||||||
} else if (cellviews () == 0) {
|
} else if (cellviews () == 0) {
|
||||||
return tl::to_string (tr ("<empty>"));
|
|
||||||
|
static std::string empty_title = tl::to_string (tr ("<empty>"));
|
||||||
|
if (m_current_title != empty_title) {
|
||||||
|
m_current_title = empty_title;
|
||||||
|
emit_title_changed ();
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
int cv_index = active_cellview_index ();
|
int cv_index = active_cellview_index ();
|
||||||
|
|
@ -714,27 +731,25 @@ LayoutViewBase::title () const
|
||||||
t += " ...";
|
t += " ...";
|
||||||
}
|
}
|
||||||
|
|
||||||
return t;
|
if (t != m_current_title) {
|
||||||
|
m_current_title = t;
|
||||||
|
emit_title_changed ();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
LayoutViewBase::set_title (const std::string &t)
|
LayoutViewBase::set_title (const std::string &t)
|
||||||
{
|
{
|
||||||
if (m_title != t) {
|
m_title = t;
|
||||||
m_title = t;
|
update_title ();
|
||||||
emit_title_changed ();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
LayoutViewBase::reset_title ()
|
LayoutViewBase::reset_title ()
|
||||||
{
|
{
|
||||||
if (! m_title.empty ()) {
|
m_title.clear ();
|
||||||
m_title = "";
|
update_title ();
|
||||||
emit_title_changed ();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|
@ -1977,9 +1992,9 @@ LayoutViewBase::replace_layer_node (unsigned int index, const LayerPropertiesCon
|
||||||
manager ()->clear ();
|
manager ()->clear ();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (index == current_layer_list ()) {
|
if (index == current_layer_list ()) {
|
||||||
begin_layer_updates ();
|
begin_layer_updates ();
|
||||||
}
|
}
|
||||||
|
|
||||||
LayerPropertiesIterator non_const_iter (get_properties (index), iter.uint ());
|
LayerPropertiesIterator non_const_iter (get_properties (index), iter.uint ());
|
||||||
*non_const_iter = node;
|
*non_const_iter = node;
|
||||||
|
|
@ -2342,9 +2357,13 @@ LayoutViewBase::signal_bboxes_changed ()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
LayoutViewBase::signal_cell_name_changed ()
|
LayoutViewBase::signal_cell_name_changed (unsigned int cv_index)
|
||||||
{
|
{
|
||||||
cell_visibility_changed_event (); // HINT: that is not what actually is intended, but it serves the function ...
|
cellview_changed_event (int (cv_index));
|
||||||
|
|
||||||
|
// Because the title reflects the active cell, emit a title changed event
|
||||||
|
update_title ();
|
||||||
|
|
||||||
redraw_later (); // needs redraw
|
redraw_later (); // needs redraw
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2489,10 +2508,7 @@ LayoutViewBase::erase_cellview (unsigned int index)
|
||||||
finish_cellviews_changed ();
|
finish_cellviews_changed ();
|
||||||
|
|
||||||
update_content ();
|
update_content ();
|
||||||
|
update_title ();
|
||||||
if (m_title.empty ()) {
|
|
||||||
emit_title_changed ();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -2522,9 +2538,7 @@ LayoutViewBase::clear_cellviews ()
|
||||||
|
|
||||||
finish_cellviews_changed ();
|
finish_cellviews_changed ();
|
||||||
|
|
||||||
if (m_title.empty ()) {
|
update_title ();
|
||||||
emit_title_changed ();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const CellView &
|
const CellView &
|
||||||
|
|
@ -2592,9 +2606,7 @@ LayoutViewBase::set_layout (const lay::CellView &cv, unsigned int cvindex)
|
||||||
// the layouts are released as far as possible. This is important for reload () for example.
|
// the layouts are released as far as possible. This is important for reload () for example.
|
||||||
update_content_for_cv (cvindex);
|
update_content_for_cv (cvindex);
|
||||||
|
|
||||||
if (m_title.empty ()) {
|
update_title ();
|
||||||
emit_title_changed ();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -4866,9 +4878,7 @@ LayoutViewBase::cellview_changed (unsigned int index)
|
||||||
|
|
||||||
cellview_changed_event (index);
|
cellview_changed_event (index);
|
||||||
|
|
||||||
if (m_title.empty ()) {
|
update_title ();
|
||||||
emit_title_changed ();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const lay::CellView &
|
const lay::CellView &
|
||||||
|
|
@ -4961,10 +4971,8 @@ LayoutViewBase::enable_active_cellview_changed_event (bool enable, bool silent)
|
||||||
active_cellview_changed_with_index_event (*i);
|
active_cellview_changed_with_index_event (*i);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Because the title reflects the active one, emit a title changed event
|
// Because the title reflects the active cell, emit a title changed event
|
||||||
if (title_string ().empty ()) {
|
update_title ();
|
||||||
emit_title_changed ();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -4987,10 +4995,8 @@ LayoutViewBase::active_cellview_changed (int index)
|
||||||
active_cellview_changed_event ();
|
active_cellview_changed_event ();
|
||||||
active_cellview_changed_with_index_event (index);
|
active_cellview_changed_with_index_event (index);
|
||||||
|
|
||||||
// Because the title reflects the active one, emit a title changed event
|
// Because the title reflects the active cell, emit a title changed event
|
||||||
if (title_string ().empty ()) {
|
update_title ();
|
||||||
emit_title_changed ();
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
m_active_cellview_changed_events.insert (index);
|
m_active_cellview_changed_events.insert (index);
|
||||||
|
|
@ -5936,14 +5942,11 @@ LayoutViewBase::update_content_for_cv (int /*cellview_index*/)
|
||||||
void
|
void
|
||||||
LayoutViewBase::rename_cellview (const std::string &name, int cellview_index)
|
LayoutViewBase::rename_cellview (const std::string &name, int cellview_index)
|
||||||
{
|
{
|
||||||
if (cellview_index >= 0 && cellview_index < int (m_cellviews.size ())) {
|
if (cellview_index >= 0 && cellview_index < int (m_cellviews.size ()) &&
|
||||||
if ((*cellview_iter (cellview_index))->name () != name) {
|
(*cellview_iter (cellview_index))->name () != name) {
|
||||||
(*cellview_iter (cellview_index))->rename (name);
|
(*cellview_iter (cellview_index))->rename (name);
|
||||||
update_content_for_cv (cellview_index);
|
update_content_for_cv (cellview_index);
|
||||||
if (m_title.empty ()) {
|
update_title ();
|
||||||
emit_title_changed ();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2614,7 +2614,7 @@ public:
|
||||||
/**
|
/**
|
||||||
* @brief Gets the window title of the view
|
* @brief Gets the window title of the view
|
||||||
*/
|
*/
|
||||||
std::string title () const;
|
const std::string &title () const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Sets the window title to an explicit string
|
* @brief Sets the window title to an explicit string
|
||||||
|
|
@ -2837,7 +2837,7 @@ private:
|
||||||
void signal_bboxes_changed ();
|
void signal_bboxes_changed ();
|
||||||
void signal_prop_ids_changed ();
|
void signal_prop_ids_changed ();
|
||||||
void signal_layer_properties_changed ();
|
void signal_layer_properties_changed ();
|
||||||
void signal_cell_name_changed ();
|
void signal_cell_name_changed (unsigned int cv_index);
|
||||||
void signal_annotations_changed ();
|
void signal_annotations_changed ();
|
||||||
void signal_plugin_enabled_changed ();
|
void signal_plugin_enabled_changed ();
|
||||||
void signal_apply_technology (lay::LayoutHandle *layout_handle);
|
void signal_apply_technology (lay::LayoutHandle *layout_handle);
|
||||||
|
|
@ -2853,6 +2853,7 @@ private:
|
||||||
lay::AnnotationShapes m_annotation_shapes;
|
lay::AnnotationShapes m_annotation_shapes;
|
||||||
std::vector <std::set <cell_index_type> > m_hidden_cells;
|
std::vector <std::set <cell_index_type> > m_hidden_cells;
|
||||||
std::string m_title;
|
std::string m_title;
|
||||||
|
std::string m_current_title;
|
||||||
tl::vector <rdb::Database *> m_rdbs;
|
tl::vector <rdb::Database *> m_rdbs;
|
||||||
tl::vector <db::LayoutToNetlist *> m_l2ndbs;
|
tl::vector <db::LayoutToNetlist *> m_l2ndbs;
|
||||||
std::string m_def_lyp_file;
|
std::string m_def_lyp_file;
|
||||||
|
|
@ -3005,6 +3006,8 @@ private:
|
||||||
void init_layer_properties (LayerProperties &props, const LayerPropertiesList &lp_list) const;
|
void init_layer_properties (LayerProperties &props, const LayerPropertiesList &lp_list) const;
|
||||||
void merge_dither_pattern (lay::LayerPropertiesList &props);
|
void merge_dither_pattern (lay::LayerPropertiesList &props);
|
||||||
|
|
||||||
|
void update_title ();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
* @brief Constructor for calling from a LayoutView
|
* @brief Constructor for calling from a LayoutView
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue