mirror of
https://github.com/KLayout/klayout.git
synced 2026-09-08 04:08:14 +02:00
WIP
This commit is contained in:
@@ -49,7 +49,7 @@ static const std::string cfg_cell_selection_search_use_expressions ("cell-select
|
||||
|
||||
// ------------------------------------------------------------
|
||||
|
||||
CellSelectionForm::CellSelectionForm (QWidget *parent, LayoutView *view, const char *name, bool simple_mode)
|
||||
CellSelectionForm::CellSelectionForm (QWidget *parent, LayoutViewBase *view, const char *name, bool simple_mode)
|
||||
: QDialog (parent), Ui::CellSelectionForm (),
|
||||
mp_view (view),
|
||||
m_current_cv (-1),
|
||||
|
||||
@@ -49,7 +49,7 @@ class LAYBASIC_PUBLIC CellSelectionForm
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CellSelectionForm (QWidget *parent, LayoutView *view, const char *name, bool simple_mode = false);
|
||||
CellSelectionForm (QWidget *parent, LayoutViewBase *view, const char *name, bool simple_mode = false);
|
||||
|
||||
/**
|
||||
* @brief Obtain the selected cellview's index (with changes)
|
||||
@@ -76,7 +76,7 @@ public slots:
|
||||
void find_prev_clicked();
|
||||
|
||||
private:
|
||||
lay::LayoutView *mp_view;
|
||||
lay::LayoutViewBase *mp_view;
|
||||
std::vector <lay::CellView> m_cellviews;
|
||||
int m_current_cv;
|
||||
bool m_name_cb_enabled;
|
||||
|
||||
@@ -303,7 +303,7 @@ CellTreeItem::by_area_equal_than (const CellTreeItem *b) const
|
||||
// valid ("under construction"). In this case, the model will return defaults or void
|
||||
// objects.
|
||||
|
||||
CellTreeModel::CellTreeModel (QWidget *parent, lay::LayoutView *view, int cv_index, unsigned int flags, const db::Cell *base, Sorting sorting)
|
||||
CellTreeModel::CellTreeModel (QWidget *parent, lay::LayoutViewBase *view, int cv_index, unsigned int flags, const db::Cell *base, Sorting sorting)
|
||||
: QAbstractItemModel (parent),
|
||||
m_flags (flags),
|
||||
m_sorting (sorting),
|
||||
@@ -379,7 +379,7 @@ CellTreeModel::~CellTreeModel ()
|
||||
}
|
||||
|
||||
void
|
||||
CellTreeModel::configure (lay::LayoutView *view, int cv_index, unsigned int flags, const db::Cell *base, Sorting sorting)
|
||||
CellTreeModel::configure (lay::LayoutViewBase *view, int cv_index, unsigned int flags, const db::Cell *base, Sorting sorting)
|
||||
{
|
||||
db::Layout *layout = & view->cellview (cv_index)->layout ();
|
||||
do_configure (layout, 0, view, cv_index, flags, base, sorting);
|
||||
@@ -398,7 +398,7 @@ CellTreeModel::configure (db::Library *library, unsigned int flags, const db::Ce
|
||||
}
|
||||
|
||||
void
|
||||
CellTreeModel::do_configure (db::Layout *layout, db::Library *library, lay::LayoutView *view, int cv_index, unsigned int flags, const db::Cell *base, Sorting sorting)
|
||||
CellTreeModel::do_configure (db::Layout *layout, db::Library *library, lay::LayoutViewBase *view, int cv_index, unsigned int flags, const db::Cell *base, Sorting sorting)
|
||||
{
|
||||
bool flat = ((flags & Flat) != 0) && ((flags & TopCells) == 0);
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace db
|
||||
namespace lay
|
||||
{
|
||||
|
||||
class LayoutView;
|
||||
class LayoutViewBase;
|
||||
class CellTreeItem;
|
||||
|
||||
/**
|
||||
@@ -85,7 +85,7 @@ public:
|
||||
* If flags "Children" or "Parents" are given, "base" must be set to the cell of which
|
||||
* the children or parents should be derived.
|
||||
*/
|
||||
CellTreeModel (QWidget *parent, lay::LayoutView *view, int cv_index, unsigned int flags = 0, const db::Cell *base = 0, Sorting sorting = ByName);
|
||||
CellTreeModel (QWidget *parent, lay::LayoutViewBase *view, int cv_index, unsigned int flags = 0, const db::Cell *base = 0, Sorting sorting = ByName);
|
||||
|
||||
/**
|
||||
* @brief Constructor
|
||||
@@ -120,7 +120,7 @@ public:
|
||||
/**
|
||||
* @brief Reconfigures the model with a LayoutView
|
||||
*/
|
||||
void configure (lay::LayoutView *view, int cv_index, unsigned int flags = 0, const db::Cell *base = 0, Sorting sorting = ByName);
|
||||
void configure (LayoutViewBase *view, int cv_index, unsigned int flags = 0, const db::Cell *base = 0, Sorting sorting = ByName);
|
||||
|
||||
/**
|
||||
* @brief Reconfigures the model with a pure Layout
|
||||
@@ -257,7 +257,7 @@ private:
|
||||
unsigned int m_flags;
|
||||
Sorting m_sorting;
|
||||
QWidget *mp_parent;
|
||||
lay::LayoutView *mp_view;
|
||||
lay::LayoutViewBase *mp_view;
|
||||
db::Layout *mp_layout;
|
||||
db::Library *mp_library;
|
||||
int m_cv_index;
|
||||
@@ -271,7 +271,7 @@ private:
|
||||
void build_top_level ();
|
||||
void clear_top_level ();
|
||||
bool search_children (const tl::GlobPattern &pattern, CellTreeItem *item);
|
||||
void do_configure (db::Layout *layout, db::Library *library, lay::LayoutView *view, int cv_index, unsigned int flags, const db::Cell *base, Sorting sorting);
|
||||
void do_configure (db::Layout *layout, db::Library *library, LayoutViewBase *view, int cv_index, unsigned int flags, const db::Cell *base, Sorting sorting);
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -321,6 +321,12 @@ LayoutView::~LayoutView ()
|
||||
mp_bookmarks_view = 0;
|
||||
}
|
||||
|
||||
void
|
||||
LayoutView::do_change_active_cellview ()
|
||||
{
|
||||
dm_setup_editor_option_pages ();
|
||||
}
|
||||
|
||||
lay::EditorOptionsPages *LayoutView::editor_options_pages ()
|
||||
{
|
||||
if (! mp_editor_options_frame) {
|
||||
@@ -614,21 +620,6 @@ LayoutView::set_or_request_current_layer (unsigned int cv_index, const db::Layer
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
LayoutView::set_current_layer (unsigned int cv_index, const db::LayerProperties &lp)
|
||||
{
|
||||
// rename the ones that got shifted.
|
||||
lay::LayerPropertiesConstIterator l = begin_layers ();
|
||||
while (! l.at_end ()) {
|
||||
if (l->source (true).cv_index () == int (cv_index) && l->source (true).layer_props ().log_equal (lp)) {
|
||||
set_current_layer (l);
|
||||
return true;
|
||||
}
|
||||
++l;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
LayoutView::set_current_layer (const lay::LayerPropertiesConstIterator &l)
|
||||
{
|
||||
@@ -637,13 +628,7 @@ LayoutView::set_current_layer (const lay::LayerPropertiesConstIterator &l)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
LayoutView::do_set_current_layer (const lay::LayerPropertiesConstIterator &l)
|
||||
{
|
||||
set_current_layer (l);
|
||||
}
|
||||
|
||||
lay::LayerPropertiesConstIterator
|
||||
lay::LayerPropertiesConstIterator
|
||||
LayoutView::current_layer () const
|
||||
{
|
||||
if (mp_control_panel) {
|
||||
@@ -838,67 +823,6 @@ LayoutView::do_set_phase (int phase)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
LayoutView::enable_active_cellview_changed_event (bool enable, bool silent)
|
||||
{
|
||||
if (m_active_cellview_changed_event_enabled == enable) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_active_cellview_changed_event_enabled = enable;
|
||||
if (enable) {
|
||||
|
||||
if (!silent && ! m_active_cellview_changed_events.empty ()) {
|
||||
|
||||
// deliver stored events
|
||||
|
||||
// we need to cancel pending drawing or dragging operations to reflect the new cellview (different target, may have different technology etc.)
|
||||
cancel_esc ();
|
||||
|
||||
// we need to setup the editor option pages because the technology may have changed
|
||||
dm_setup_editor_option_pages ();
|
||||
|
||||
active_cellview_changed_event ();
|
||||
for (std::set<int>::const_iterator i = m_active_cellview_changed_events.begin (); i != m_active_cellview_changed_events.end (); ++i) {
|
||||
active_cellview_changed_with_index_event (*i);
|
||||
}
|
||||
|
||||
// Because the title reflects the active one, emit a title changed event
|
||||
if (title_string ().empty ()) {
|
||||
emit title_changed ();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
m_active_cellview_changed_events.clear ();
|
||||
}
|
||||
|
||||
void
|
||||
LayoutView::active_cellview_changed (int index)
|
||||
{
|
||||
if (m_active_cellview_changed_event_enabled) {
|
||||
|
||||
// we need to cancel pending drawing or dragging operations to reflect the new cellview (different target, may have different technology etc.)
|
||||
cancel_esc ();
|
||||
|
||||
// we need to setup the editor option pages because the technology may have changed
|
||||
dm_setup_editor_option_pages ();
|
||||
|
||||
active_cellview_changed_event ();
|
||||
active_cellview_changed_with_index_event (index);
|
||||
|
||||
// Because the title reflects the active one, emit a title changed event
|
||||
if (title_string ().empty ()) {
|
||||
emit title_changed ();
|
||||
}
|
||||
|
||||
} else {
|
||||
m_active_cellview_changed_events.insert (index);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
LayoutView::active_library_changed (int /*index*/)
|
||||
{
|
||||
@@ -989,18 +913,6 @@ LayoutView::cut ()
|
||||
}
|
||||
}
|
||||
|
||||
const lay::CellView &
|
||||
LayoutView::active_cellview () const
|
||||
{
|
||||
return cellview ((unsigned int) active_cellview_index ());
|
||||
}
|
||||
|
||||
lay::CellViewRef
|
||||
LayoutView::active_cellview_ref ()
|
||||
{
|
||||
return cellview_ref ((unsigned int) active_cellview_index ());
|
||||
}
|
||||
|
||||
int
|
||||
LayoutView::active_cellview_index () const
|
||||
{
|
||||
|
||||
@@ -140,21 +140,6 @@ public:
|
||||
*/
|
||||
virtual bool has_selection ();
|
||||
|
||||
/**
|
||||
* @brief Gets the window title of the view
|
||||
*/
|
||||
std::string title () const;
|
||||
|
||||
/**
|
||||
* @brief Sets the window title to an explicit string
|
||||
*/
|
||||
void set_title (const std::string &t);
|
||||
|
||||
/**
|
||||
* @brief Resets the explicit title and enable the automatic naming
|
||||
*/
|
||||
void reset_title ();
|
||||
|
||||
/**
|
||||
* @brief Display a status message
|
||||
*/
|
||||
@@ -179,7 +164,7 @@ public:
|
||||
* Switches the mode on application level. Use this method to initiate
|
||||
* a mode switch from the view.
|
||||
*/
|
||||
void switch_mode (int m);
|
||||
virtual void switch_mode (int m);
|
||||
|
||||
/**
|
||||
* @brief Updates the menu for the given view
|
||||
@@ -210,7 +195,10 @@ public:
|
||||
*
|
||||
* Returns false if the layer is not a valid one.
|
||||
*/
|
||||
bool set_current_layer (unsigned int cv_index, const db::LayerProperties &properties);
|
||||
bool set_current_layer (unsigned int cv_index, const db::LayerProperties &properties)
|
||||
{
|
||||
return LayoutViewBase::set_current_layer (cv_index, properties);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Sets the currently active layer
|
||||
@@ -218,7 +206,7 @@ public:
|
||||
* The active layer is the one that is active in the layer
|
||||
* browser panel. This method will also select this layer.
|
||||
*/
|
||||
void set_current_layer (const lay::LayerPropertiesConstIterator &l);
|
||||
virtual void set_current_layer (const lay::LayerPropertiesConstIterator &l);
|
||||
|
||||
/**
|
||||
* @brief Retrieve the index of the currently active layer
|
||||
@@ -227,7 +215,7 @@ public:
|
||||
* browser panel.
|
||||
* This method returns a null iterator, if no layer is active.
|
||||
*/
|
||||
lay::LayerPropertiesConstIterator current_layer () const;
|
||||
virtual lay::LayerPropertiesConstIterator current_layer () const;
|
||||
|
||||
/**
|
||||
* @brief Return the layers that are selected in the layer browser
|
||||
@@ -246,16 +234,6 @@ public:
|
||||
*/
|
||||
int active_cellview_index () const;
|
||||
|
||||
/**
|
||||
* @brief Get the index of the active cellview (shown in hierarchy browser)
|
||||
*/
|
||||
const lay::CellView &active_cellview () const;
|
||||
|
||||
/**
|
||||
* @brief Gets a cellview reference to the active cellview
|
||||
*/
|
||||
lay::CellViewRef active_cellview_ref ();
|
||||
|
||||
/**
|
||||
* @brief Select a certain cellview for the active one
|
||||
*/
|
||||
@@ -277,18 +255,6 @@ public:
|
||||
*/
|
||||
void current_cell_path (int cv_index, cell_path_type &path) const;
|
||||
|
||||
/**
|
||||
* @brief Cell path of the current cell
|
||||
*
|
||||
* This method version is provided for automation purposes mainly.
|
||||
*/
|
||||
cell_path_type get_current_cell_path (int cv_index) const
|
||||
{
|
||||
cell_path_type r;
|
||||
current_cell_path (cv_index, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Cell path of the current cell in the active cellview
|
||||
*
|
||||
@@ -307,16 +273,6 @@ public:
|
||||
*/
|
||||
virtual void set_current_cell_path (int cv_index, const cell_path_type &path);
|
||||
|
||||
/**
|
||||
* @brief Set the path to the current cell is the current cellview
|
||||
*
|
||||
* This is a convenience function setting the path for the active cellview.
|
||||
*/
|
||||
void set_current_cell_path (const cell_path_type &path)
|
||||
{
|
||||
set_current_cell_path (active_cellview_index (), path);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Remove unused layers
|
||||
*/
|
||||
@@ -496,19 +452,6 @@ public:
|
||||
*/
|
||||
tl::Event hide_event;
|
||||
|
||||
/**
|
||||
* @brief An event triggered if the active cellview changes
|
||||
* This event is triggered after the active cellview changed.
|
||||
*/
|
||||
tl::Event active_cellview_changed_event;
|
||||
|
||||
/**
|
||||
* @brief An event triggered if the active cellview changes
|
||||
* This event is triggered after the active cellview changed. The integer parameter is the index of the
|
||||
* new cellview.
|
||||
*/
|
||||
tl::event<int> active_cellview_changed_with_index_event;
|
||||
|
||||
public slots:
|
||||
/**
|
||||
* @brief Store the current state on the "previous states" stack
|
||||
@@ -705,7 +648,11 @@ public slots:
|
||||
void deactivate_all_browsers ();
|
||||
|
||||
private slots:
|
||||
void active_cellview_changed (int index);
|
||||
void active_cellview_changed (int index)
|
||||
{
|
||||
LayoutViewBase::active_cellview_changed (index);
|
||||
}
|
||||
|
||||
void active_library_changed (int index);
|
||||
void side_panel_destroyed ();
|
||||
|
||||
@@ -768,8 +715,6 @@ private:
|
||||
QSpinBox *mp_min_hier_spbx;
|
||||
QSpinBox *mp_max_hier_spbx;
|
||||
BookmarkList m_bookmarks;
|
||||
bool m_active_cellview_changed_event_enabled;
|
||||
std::set<int> m_active_cellview_changed_events;
|
||||
bool m_always_show_source;
|
||||
bool m_always_show_ld;
|
||||
bool m_always_show_layout_index;
|
||||
@@ -796,13 +741,12 @@ protected:
|
||||
virtual void do_paste ();
|
||||
virtual void begin_layer_updates ();
|
||||
virtual void ensure_layer_selected ();
|
||||
virtual void do_set_current_layer (const lay::LayerPropertiesConstIterator &l);
|
||||
virtual void update_content_for_cv (int cv_index);
|
||||
virtual void do_set_no_stipples (bool no_stipples);
|
||||
virtual void do_set_phase (int phase);
|
||||
virtual bool set_hier_levels_basic (std::pair<int, int> l);
|
||||
virtual void do_change_active_cellview ();
|
||||
virtual bool is_activated () const;
|
||||
virtual void enable_active_cellview_changed_event (bool enable, bool silent = false);
|
||||
|
||||
// overrides Editables method to display a message
|
||||
void signal_selection_changed ();
|
||||
|
||||
@@ -304,6 +304,9 @@ LayoutViewBase::init (db::Manager *mgr)
|
||||
{
|
||||
manager (mgr);
|
||||
|
||||
m_active_cellview_index = -1;
|
||||
m_active_cellview_changed_event_enabled = true;
|
||||
|
||||
m_annotation_shapes.manager (mgr);
|
||||
|
||||
m_visibility_changed = false;
|
||||
@@ -625,6 +628,58 @@ LayoutViewBase::is_dirty () const
|
||||
return m_dirty;
|
||||
}
|
||||
|
||||
std::string
|
||||
LayoutViewBase::title () const
|
||||
{
|
||||
if (! m_title.empty ()) {
|
||||
return m_title;
|
||||
} else if (cellviews () == 0) {
|
||||
return tl::to_string (QObject::tr ("<empty>"));
|
||||
} else {
|
||||
|
||||
int cv_index = active_cellview_index ();
|
||||
if (cv_index < 0 || cv_index >= int (cellviews ())) {
|
||||
cv_index = 0;
|
||||
}
|
||||
|
||||
const lay::CellView &cv0 = cellview (cv_index);
|
||||
|
||||
std::string t;
|
||||
|
||||
t += cv0->name ();
|
||||
if (cv0->layout ().is_valid_cell_index (cv0.cell_index ())) {
|
||||
t += " [";
|
||||
t += cv0->layout ().cell_name (cv0.cell_index ());
|
||||
t += "]";
|
||||
}
|
||||
|
||||
if (cellviews () > 1) {
|
||||
t += " ...";
|
||||
}
|
||||
|
||||
return t;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
LayoutViewBase::set_title (const std::string &t)
|
||||
{
|
||||
if (m_title != t) {
|
||||
m_title = t;
|
||||
emit_title_changed ();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
LayoutViewBase::reset_title ()
|
||||
{
|
||||
if (! m_title.empty ()) {
|
||||
m_title = "";
|
||||
emit_title_changed ();
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
LayoutViewBase::configure (const std::string &name, const std::string &value)
|
||||
{
|
||||
@@ -1355,6 +1410,35 @@ LayoutViewBase::rename_properties (unsigned int index, const std::string &new_na
|
||||
layer_list_changed_event (4);
|
||||
}
|
||||
|
||||
bool
|
||||
LayoutViewBase::set_current_layer (unsigned int cv_index, const db::LayerProperties &lp)
|
||||
{
|
||||
// rename the ones that got shifted.
|
||||
lay::LayerPropertiesConstIterator l = begin_layers ();
|
||||
while (! l.at_end ()) {
|
||||
if (l->source (true).cv_index () == int (cv_index) && l->source (true).layer_props ().log_equal (lp)) {
|
||||
set_current_layer (l);
|
||||
return true;
|
||||
}
|
||||
++l;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
LayoutViewBase::set_current_layer (const lay::LayerPropertiesConstIterator &l)
|
||||
{
|
||||
// @@@ No checking happens
|
||||
m_current_layer = l;
|
||||
}
|
||||
|
||||
lay::LayerPropertiesConstIterator
|
||||
LayoutViewBase::current_layer () const
|
||||
{
|
||||
// @@@ No checking happens
|
||||
return m_current_layer;
|
||||
}
|
||||
|
||||
void
|
||||
LayoutViewBase::merge_dither_pattern (lay::LayerPropertiesList &props)
|
||||
{
|
||||
@@ -1975,6 +2059,10 @@ LayoutViewBase::erase_cellview (unsigned int index)
|
||||
m_hidden_cells.erase (m_hidden_cells.begin () + index);
|
||||
}
|
||||
|
||||
if (m_current_cell_per_cellview.size () > index) {
|
||||
m_current_cell_per_cellview.erase (m_current_cell_per_cellview.begin () + index);
|
||||
}
|
||||
|
||||
for (unsigned int lindex = 0; lindex < layer_lists (); ++lindex) {
|
||||
|
||||
// remove all references to the cellview
|
||||
@@ -2030,6 +2118,9 @@ LayoutViewBase::clear_cellviews ()
|
||||
set_properties (lay::LayerPropertiesList ());
|
||||
m_cellviews.clear ();
|
||||
|
||||
m_hidden_cells.clear ();
|
||||
m_current_cell_per_cellview.clear ();
|
||||
|
||||
// clear the history, store path and zoom box
|
||||
m_display_states.clear ();
|
||||
m_display_state_ptr = 0;
|
||||
@@ -2312,7 +2403,7 @@ LayoutViewBase::add_new_layers (const std::vector <unsigned int> &layer_ids, int
|
||||
set_properties (new_props);
|
||||
|
||||
if (was_empty) {
|
||||
do_set_current_layer (new_props.begin_const_recursive ());
|
||||
set_current_layer (new_props.begin_const_recursive ());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2601,6 +2692,11 @@ LayoutViewBase::reload_layout (unsigned int cv_index)
|
||||
}
|
||||
}
|
||||
|
||||
// clear the current cell (NOTE: this is for providing a cell target for some UI functions only)
|
||||
if (m_current_cell_per_cellview.size () > cv_index) {
|
||||
m_current_cell_per_cellview [cv_index] = cell_path_type ();
|
||||
}
|
||||
|
||||
// Determine which layers to create as new layers. New layer need to be created
|
||||
// if these have not been present in the original layout and there are no layer views
|
||||
// referring to them.
|
||||
@@ -4116,13 +4212,133 @@ LayoutViewBase::cellview_changed (unsigned int index)
|
||||
}
|
||||
}
|
||||
|
||||
const lay::CellView &
|
||||
LayoutViewBase::active_cellview () const
|
||||
{
|
||||
return cellview ((unsigned int) active_cellview_index ());
|
||||
}
|
||||
|
||||
lay::CellViewRef
|
||||
LayoutViewBase::active_cellview_ref ()
|
||||
{
|
||||
return cellview_ref ((unsigned int) active_cellview_index ());
|
||||
}
|
||||
|
||||
int
|
||||
LayoutViewBase::active_cellview_index () const
|
||||
{
|
||||
return m_active_cellview_index;
|
||||
}
|
||||
|
||||
void
|
||||
LayoutViewBase::set_current_cell_path (int /*cv_index*/, const cell_path_type & /*path*/)
|
||||
LayoutViewBase::set_active_cellview_index (int index)
|
||||
{
|
||||
if (index >= 0 && index < int (cellviews ())) {
|
||||
if (m_active_cellview_index != index) {
|
||||
m_active_cellview_index = index;
|
||||
active_cellview_changed (index);
|
||||
}
|
||||
} else {
|
||||
m_active_cellview_index = -1;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
LayoutViewBase::selected_cells_paths (int /*cv_index*/, std::vector<cell_path_type> & /*paths*/) const
|
||||
{
|
||||
// TODO: not implemented yet as there is no setter so far.
|
||||
// (but it is implemented in the UI version where it is bound to the hierarchy control panel)
|
||||
}
|
||||
|
||||
void
|
||||
LayoutViewBase::current_cell_path (int cv_index, cell_path_type &path) const
|
||||
{
|
||||
if (cv_index >= 0 && cv_index < int (m_current_cell_per_cellview.size ())) {
|
||||
path = m_current_cell_per_cellview [cv_index];
|
||||
} else {
|
||||
path = cell_path_type ();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
LayoutViewBase::set_current_cell_path (int cv_index, const cell_path_type &path)
|
||||
{
|
||||
if (cv_index >= 0) {
|
||||
while (cv_index <= int (m_current_cell_per_cellview.size ())) {
|
||||
m_current_cell_per_cellview.push_back (cell_path_type ());
|
||||
}
|
||||
m_current_cell_per_cellview [cv_index] = path;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
LayoutViewBase::do_change_active_cellview ()
|
||||
{
|
||||
// .. nothing yet ..
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
LayoutViewBase::enable_active_cellview_changed_event (bool enable, bool silent)
|
||||
{
|
||||
if (m_active_cellview_changed_event_enabled == enable) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_active_cellview_changed_event_enabled = enable;
|
||||
if (enable) {
|
||||
|
||||
if (!silent && ! m_active_cellview_changed_events.empty ()) {
|
||||
|
||||
// deliver stored events
|
||||
|
||||
// we need to cancel pending drawing or dragging operations to reflect the new cellview (different target, may have different technology etc.)
|
||||
cancel_esc ();
|
||||
|
||||
// we need to setup the editor option pages because the technology may have changed
|
||||
do_change_active_cellview ();
|
||||
|
||||
active_cellview_changed_event ();
|
||||
for (std::set<int>::const_iterator i = m_active_cellview_changed_events.begin (); i != m_active_cellview_changed_events.end (); ++i) {
|
||||
active_cellview_changed_with_index_event (*i);
|
||||
}
|
||||
|
||||
// Because the title reflects the active one, emit a title changed event
|
||||
if (title_string ().empty ()) {
|
||||
emit_title_changed ();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
m_active_cellview_changed_events.clear ();
|
||||
}
|
||||
|
||||
void
|
||||
LayoutViewBase::active_cellview_changed (int index)
|
||||
{
|
||||
if (m_active_cellview_changed_event_enabled) {
|
||||
|
||||
// we need to cancel pending drawing or dragging operations to reflect the new cellview (different target, may have different technology etc.)
|
||||
cancel_esc ();
|
||||
|
||||
// we need to setup the editor option pages because the technology may have changed
|
||||
do_change_active_cellview ();
|
||||
|
||||
active_cellview_changed_event ();
|
||||
active_cellview_changed_with_index_event (index);
|
||||
|
||||
// Because the title reflects the active one, emit a title changed event
|
||||
if (title_string ().empty ()) {
|
||||
emit_title_changed ();
|
||||
}
|
||||
|
||||
} else {
|
||||
m_active_cellview_changed_events.insert (index);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
LayoutViewBase::select_cell_dispatch (const cell_path_type &path, int cellview_index)
|
||||
{
|
||||
bool set_max_hier = (m_full_hier_new_cell || has_max_hier ());
|
||||
@@ -4781,12 +4997,6 @@ LayoutViewBase::ensure_layer_selected ()
|
||||
// .. nothing yet ..
|
||||
}
|
||||
|
||||
void
|
||||
LayoutViewBase::do_set_current_layer (const lay::LayerPropertiesConstIterator & /*l*/)
|
||||
{
|
||||
// .. nothing yet ..
|
||||
}
|
||||
|
||||
void
|
||||
LayoutViewBase::do_set_no_stipples (bool /*no_stipples*/)
|
||||
{
|
||||
@@ -4812,21 +5022,9 @@ LayoutViewBase::is_activated () const
|
||||
}
|
||||
|
||||
void
|
||||
LayoutViewBase::switch_mode (int /*m*/)
|
||||
LayoutViewBase::switch_mode (int m)
|
||||
{
|
||||
// .. nothing yet ..
|
||||
}
|
||||
|
||||
void
|
||||
LayoutViewBase::set_active_cellview_index (int /*index*/)
|
||||
{
|
||||
// .. nothing yet ..
|
||||
}
|
||||
|
||||
void
|
||||
LayoutViewBase::enable_active_cellview_changed_event (bool /*enable*/, bool /*silent*/)
|
||||
{
|
||||
// .. nothing yet ..
|
||||
mode (m);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -195,6 +195,22 @@ public:
|
||||
*/
|
||||
~LayoutViewBase ();
|
||||
|
||||
/**
|
||||
* @brief Gets the current mode
|
||||
*/
|
||||
int mode () const
|
||||
{
|
||||
return m_mode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Switches the application's mode
|
||||
*
|
||||
* Switches the mode on application level. Use this method to initiate
|
||||
* a mode switch from the view.
|
||||
*/
|
||||
virtual void switch_mode (int m);
|
||||
|
||||
/**
|
||||
* @brief Determine if there is something to copy
|
||||
*
|
||||
@@ -508,6 +524,33 @@ public:
|
||||
insert_layer_list (index, LayerPropertiesList ());
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Sets the currently active layer by layer properties and cell view index
|
||||
*
|
||||
* This method will look up that layer in the layer view tree and select that layer.
|
||||
* This method will also select this layer.
|
||||
*
|
||||
* Returns false if the layer is not a valid one.
|
||||
*/
|
||||
bool set_current_layer (unsigned int cv_index, const db::LayerProperties &properties);
|
||||
|
||||
/**
|
||||
* @brief Sets the currently active layer
|
||||
*
|
||||
* The active layer is the one that is active in the layer
|
||||
* browser panel. This method will also select this layer.
|
||||
*/
|
||||
virtual void set_current_layer (const lay::LayerPropertiesConstIterator &l);
|
||||
|
||||
/**
|
||||
* @brief Retrieve the index of the currently active layer
|
||||
*
|
||||
* The active layer is the one that is active in the layer
|
||||
* browser panel.
|
||||
* This method returns a null iterator, if no layer is active.
|
||||
*/
|
||||
virtual lay::LayerPropertiesConstIterator current_layer () const;
|
||||
|
||||
/**
|
||||
* @brief Set the custom dither pattern
|
||||
*/
|
||||
@@ -1837,7 +1880,96 @@ public:
|
||||
*/
|
||||
db::InstElement ascend (int cellview_index);
|
||||
|
||||
/**
|
||||
/**
|
||||
* @brief Get the index of the active cellview (shown in hierarchy browser)
|
||||
*/
|
||||
const lay::CellView &active_cellview () const;
|
||||
|
||||
/**
|
||||
* @brief Gets a cellview reference to the active cellview
|
||||
*/
|
||||
lay::CellViewRef active_cellview_ref ();
|
||||
|
||||
/**
|
||||
* @brief Get the index of the active cellview (shown in hierarchy browser)
|
||||
*/
|
||||
virtual int active_cellview_index () const;
|
||||
|
||||
/**
|
||||
* @brief Select a certain cellview for the active one
|
||||
*/
|
||||
virtual void set_active_cellview_index (int index);
|
||||
|
||||
/**
|
||||
* @brief An event triggered if the active cellview changes
|
||||
* This event is triggered after the active cellview changed.
|
||||
*/
|
||||
tl::Event active_cellview_changed_event;
|
||||
|
||||
/**
|
||||
* @brief An event triggered if the active cellview changes
|
||||
* This event is triggered after the active cellview changed. The integer parameter is the index of the
|
||||
* new cellview.
|
||||
*/
|
||||
tl::event<int> active_cellview_changed_with_index_event;
|
||||
|
||||
/**
|
||||
* @brief Cell paths of the selected cells
|
||||
*
|
||||
* The current cell is the one highlighted in the browser with the focus rectangle. The
|
||||
* current path is returned for the cellview given by cv_index.
|
||||
*/
|
||||
virtual void selected_cells_paths (int cv_index, std::vector<cell_path_type> &paths) const;
|
||||
|
||||
/**
|
||||
* @brief Cell path of the current cell
|
||||
*
|
||||
* The current cell is the one highlighted in the browser with the focus rectangle. The
|
||||
* current path is returned for the cellview given by cv_index.
|
||||
*/
|
||||
virtual void current_cell_path (int cv_index, cell_path_type &path) const;
|
||||
|
||||
/**
|
||||
* @brief Cell path of the current cell
|
||||
*
|
||||
* This method version is provided for automation purposes mainly.
|
||||
*/
|
||||
cell_path_type get_current_cell_path (int cv_index) const
|
||||
{
|
||||
cell_path_type r;
|
||||
current_cell_path (cv_index, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Cell path of the current cell in the active cellview
|
||||
*
|
||||
* This is a convenience function returning the path for the active cellview.
|
||||
*/
|
||||
void current_cell_path (cell_path_type &path) const
|
||||
{
|
||||
current_cell_path (active_cellview_index (), path);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the path to the current cell
|
||||
*
|
||||
* The current cell is the one highlighted in the browser with the focus rectangle. The
|
||||
* cell given by the path is highlighted and scrolled into view.
|
||||
*/
|
||||
virtual void set_current_cell_path (int cv_index, const cell_path_type &path);
|
||||
|
||||
/**
|
||||
* @brief Set the path to the current cell is the current cellview
|
||||
*
|
||||
* This is a convenience function setting the path for the active cellview.
|
||||
*/
|
||||
void set_current_cell_path (const cell_path_type &path)
|
||||
{
|
||||
set_current_cell_path (active_cellview_index (), path);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Select a cell by path for a certain cell view and fit cell
|
||||
*/
|
||||
void select_cell_fit (const cell_path_type &path, int cellview_index);
|
||||
@@ -2186,6 +2318,21 @@ public:
|
||||
return mp_canvas->global_trans ();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Gets the window title of the view
|
||||
*/
|
||||
std::string title () const;
|
||||
|
||||
/**
|
||||
* @brief Sets the window title to an explicit string
|
||||
*/
|
||||
void set_title (const std::string &t);
|
||||
|
||||
/**
|
||||
* @brief Resets the explicit title and enable the automatic naming
|
||||
*/
|
||||
void reset_title ();
|
||||
|
||||
/**
|
||||
* @brief Removes the previous state from the stack
|
||||
*/
|
||||
@@ -2461,6 +2608,14 @@ private:
|
||||
|
||||
lay::Plugin *mp_active_plugin;
|
||||
|
||||
int m_active_cellview_index;
|
||||
bool m_active_cellview_changed_event_enabled;
|
||||
std::set<int> m_active_cellview_changed_events;
|
||||
|
||||
lay::LayerPropertiesConstIterator m_current_layer;
|
||||
|
||||
std::vector<cell_path_type> m_current_cell_per_cellview;
|
||||
|
||||
bool m_visibility_changed;
|
||||
|
||||
tl::Clock m_clock, m_last_checked;
|
||||
@@ -2500,11 +2655,6 @@ protected:
|
||||
return m_options;
|
||||
}
|
||||
|
||||
int mode () const
|
||||
{
|
||||
return m_mode;
|
||||
}
|
||||
|
||||
lay::Plugin *active_plugin () const
|
||||
{
|
||||
return mp_active_plugin;
|
||||
@@ -2525,18 +2675,17 @@ protected:
|
||||
virtual lay::Color default_background_color ();
|
||||
virtual void do_set_background_color (lay::Color color, lay::Color contrast);
|
||||
virtual void do_paste ();
|
||||
virtual void switch_mode (int m);
|
||||
virtual void begin_layer_updates ();
|
||||
virtual void ensure_layer_selected ();
|
||||
virtual void do_set_current_layer (const lay::LayerPropertiesConstIterator &l);
|
||||
virtual void do_set_no_stipples (bool no_stipples);
|
||||
virtual void do_set_phase (int phase);
|
||||
virtual bool is_activated () const;
|
||||
virtual void do_change_active_cellview ();
|
||||
virtual void update_content_for_cv (int cv_index);
|
||||
virtual void set_active_cellview_index (int index);
|
||||
virtual void enable_active_cellview_changed_event (bool enable, bool silent = false);
|
||||
virtual bool set_hier_levels_basic (std::pair<int, int> l);
|
||||
virtual void set_current_cell_path (int cv_index, const cell_path_type &path);
|
||||
|
||||
void enable_active_cellview_changed_event (bool enable, bool silent = false);
|
||||
void active_cellview_changed (int index);
|
||||
|
||||
virtual void emit_edits_enabled_changed () { }
|
||||
virtual void emit_title_changed () { }
|
||||
|
||||
Reference in New Issue
Block a user