mirror of https://github.com/KLayout/klayout.git
WIP
This commit is contained in:
parent
2298a9a5c8
commit
2378f7964e
File diff suppressed because it is too large
Load Diff
|
|
@ -94,7 +94,8 @@ class EditorOptionsPages;
|
|||
* It manages the layer display list, bookmark list etc.
|
||||
*/
|
||||
class LAYBASIC_PUBLIC LayoutView
|
||||
: public LayoutViewBase
|
||||
: public QFrame,
|
||||
public LayoutViewBase
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
|
@ -109,6 +110,11 @@ public:
|
|||
*/
|
||||
LayoutView (lay::LayoutView *source, db::Manager *mgr, bool editable, lay::Plugin *plugin_parent, QWidget *parent = 0, const char *name = "view", unsigned int options = (unsigned int) LV_Normal);
|
||||
|
||||
/**
|
||||
* @brief Destructor
|
||||
*/
|
||||
~LayoutView ();
|
||||
|
||||
/**
|
||||
* @brief Makes this view the current one
|
||||
*/
|
||||
|
|
@ -119,12 +125,20 @@ public:
|
|||
*
|
||||
* The argument can be 0 which means there is no current view.
|
||||
*/
|
||||
static void set_current (LayoutViewBase *);
|
||||
static void set_current (LayoutView *);
|
||||
|
||||
/**
|
||||
* @brief Gets the current view
|
||||
*/
|
||||
static LayoutViewBase *current ();
|
||||
static LayoutView *current ();
|
||||
|
||||
/**
|
||||
* @brief Determine if there is something to copy
|
||||
*
|
||||
* This reimplementation of the lay::Editables interface additionally
|
||||
* looks for content providers in the tree views for example.
|
||||
*/
|
||||
virtual bool has_selection ();
|
||||
|
||||
/**
|
||||
* @brief Gets the window title of the view
|
||||
|
|
@ -141,6 +155,32 @@ public:
|
|||
*/
|
||||
void reset_title ();
|
||||
|
||||
/**
|
||||
* @brief Display a status message
|
||||
*/
|
||||
void message (const std::string &s = "", int timeout = 10);
|
||||
|
||||
/**
|
||||
* @brief Switches the application's mode
|
||||
*
|
||||
* Switches the mode on application level. Use this method to initiate
|
||||
* a mode switch from the view.
|
||||
*/
|
||||
void switch_mode (int m);
|
||||
|
||||
/**
|
||||
* @brief Updates the menu for the given view
|
||||
* If the view is 0, the menu shall be updated to reflect "no view active"
|
||||
*/
|
||||
static void update_menu (lay::LayoutView *view, lay::AbstractMenu &menu);
|
||||
|
||||
/**
|
||||
* @brief Create all plugins
|
||||
*
|
||||
* If plugins already exist, they are deleted and created again
|
||||
*/
|
||||
void create_plugins (const lay::PluginDeclaration *except_this = 0);
|
||||
|
||||
/**
|
||||
* @brief Sets the currently active layer by layer properties and cell view index
|
||||
*
|
||||
|
|
@ -264,6 +304,11 @@ public:
|
|||
set_current_cell_path (active_cellview_index (), path);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Indicates the current position
|
||||
*/
|
||||
virtual void current_pos (double x, double y);
|
||||
|
||||
/**
|
||||
* @brief Bookmark the current view under the given name
|
||||
*/
|
||||
|
|
@ -358,10 +403,26 @@ public:
|
|||
return mp_editor_options_frame;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Copies to clipboard
|
||||
*
|
||||
* This reimplementation of the lay::Editables interface additionally
|
||||
* looks for copy providers in the tree views for example.
|
||||
*/
|
||||
virtual void copy ();
|
||||
|
||||
/**
|
||||
* @brief Cuts to clipboard
|
||||
*
|
||||
* This reimplementation of the lay::Editables interface additionally
|
||||
* looks for cut & copy providers in the tree views for example.
|
||||
*/
|
||||
virtual void cut ();
|
||||
|
||||
/**
|
||||
* @brief Deliver a size hint (reimplementation of QWidget)
|
||||
*/
|
||||
QSize sizeHint () const;
|
||||
virtual QSize sizeHint () const;
|
||||
|
||||
/**
|
||||
* @brief An event signalling that the view is going to close
|
||||
|
|
@ -378,6 +439,19 @@ 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
|
||||
|
|
@ -560,56 +634,22 @@ public slots:
|
|||
LayoutViewBase::redraw_cell_boxes ();
|
||||
}
|
||||
|
||||
void layer_tab_changed ()
|
||||
{
|
||||
LayoutViewBase::layer_tab_changed ();
|
||||
}
|
||||
|
||||
void layer_order_changed ()
|
||||
{
|
||||
LayoutViewBase::layer_order_changed ();
|
||||
}
|
||||
void layer_tab_changed ();
|
||||
void layer_order_changed ();
|
||||
|
||||
void timer ()
|
||||
{
|
||||
LayoutViewBase::timer ();
|
||||
}
|
||||
|
||||
void min_hier_changed (int i)
|
||||
{
|
||||
LayoutViewBase::min_hier_changed (i);
|
||||
}
|
||||
|
||||
void max_hier_changed (int i)
|
||||
{
|
||||
LayoutViewBase::max_hier_changed (i);
|
||||
}
|
||||
void min_hier_changed (int i);
|
||||
void max_hier_changed (int i);
|
||||
|
||||
void deactivate_all_browsers ();
|
||||
|
||||
private:
|
||||
// event handlers used to connect to the layout object's events
|
||||
void signal_hier_changed ();
|
||||
void signal_bboxes_from_layer_changed (unsigned int cv_index, unsigned int layer_index);
|
||||
void signal_bboxes_changed ();
|
||||
void signal_prop_ids_changed ();
|
||||
void signal_layer_properties_changed ();
|
||||
void signal_cell_name_changed ();
|
||||
void signal_annotations_changed ();
|
||||
void signal_plugin_enabled_changed ();
|
||||
void signal_apply_technology (lay::LayoutHandle *layout_handle);
|
||||
|
||||
private slots:
|
||||
void active_cellview_changed (int index)
|
||||
{
|
||||
LayoutViewBase::active_cellview_changed (index);
|
||||
}
|
||||
|
||||
void active_library_changed (int index)
|
||||
{
|
||||
LayoutViewBase::active_library_changed (index);
|
||||
}
|
||||
|
||||
void active_cellview_changed (int index);
|
||||
void active_library_changed (int index);
|
||||
void side_panel_destroyed ();
|
||||
|
||||
signals:
|
||||
|
|
@ -660,6 +700,7 @@ signals:
|
|||
|
||||
private:
|
||||
QTimer *mp_timer;
|
||||
bool m_activated;
|
||||
QFrame *mp_left_frame;
|
||||
lay::LayerControlPanel *mp_control_panel;
|
||||
lay::HierarchyControlPanel *mp_hierarchy_panel;
|
||||
|
|
@ -672,18 +713,27 @@ private:
|
|||
BookmarkList m_bookmarks;
|
||||
bool m_active_cellview_changed_event_enabled;
|
||||
|
||||
tl::DeferredMethod<lay::LayoutView> dm_prop_changed;
|
||||
tl::DeferredMethod<lay::LayoutView> dm_setup_editor_option_pages;
|
||||
|
||||
void init (db::Manager *mgr, QWidget *parent);
|
||||
void init_ui ();
|
||||
void init_menu ();
|
||||
lay::EditorOptionsPages *editor_options_pages ();
|
||||
void do_setup_editor_options_pages ();
|
||||
|
||||
protected:
|
||||
void activate ();
|
||||
void deactivate ();
|
||||
|
||||
bool eventFilter(QObject *obj, QEvent *ev);
|
||||
void showEvent (QShowEvent *);
|
||||
void hideEvent (QHideEvent *);
|
||||
virtual bool eventFilter(QObject *obj, QEvent *ev);
|
||||
virtual void showEvent (QShowEvent *);
|
||||
virtual void hideEvent (QHideEvent *);
|
||||
|
||||
virtual bool configure (const std::string &name, const std::string &value);
|
||||
virtual void config_finalize ();
|
||||
|
||||
virtual lay::Color default_background_color ();
|
||||
virtual void do_set_background_color (lay::Color color, lay::Color contrast);
|
||||
virtual void do_paste ();
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -236,23 +236,17 @@ struct OpDeleteLayerProps
|
|||
|
||||
// -------------------------------------------------------------
|
||||
|
||||
const int timer_interval = 500;
|
||||
|
||||
static LayoutViewBase *ms_current = 0;
|
||||
const double animation_interval = 0.5;
|
||||
|
||||
LayoutViewBase::LayoutViewBase (db::Manager *manager, bool editable, lay::Plugin *plugin_parent, unsigned int options)
|
||||
: lay::Dispatcher (plugin_parent, false /*not standalone*/),
|
||||
m_editable (editable),
|
||||
m_options (options),
|
||||
m_annotation_shapes (manager),
|
||||
dm_prop_changed (this, &LayoutViewBase::do_prop_changed)
|
||||
m_annotation_shapes (manager)
|
||||
{
|
||||
// either it's us or the parent has a dispatcher
|
||||
tl_assert (dispatcher () != 0);
|
||||
|
||||
// ensures the deferred method scheduler is present
|
||||
tl::DeferredMethodScheduler::instance ();
|
||||
|
||||
init (manager);
|
||||
}
|
||||
|
||||
|
|
@ -260,15 +254,11 @@ LayoutViewBase::LayoutViewBase (lay::LayoutViewBase *source, db::Manager *manage
|
|||
: lay::Dispatcher (plugin_parent, false /*not standalone*/),
|
||||
m_editable (editable),
|
||||
m_options (options),
|
||||
m_annotation_shapes (manager),
|
||||
dm_prop_changed (this, &LayoutViewBase::do_prop_changed)
|
||||
m_annotation_shapes (manager)
|
||||
{
|
||||
// either it's us or the parent has a dispatcher
|
||||
tl_assert (dispatcher () != 0);
|
||||
|
||||
// ensures the deferred method scheduler is present
|
||||
tl::DeferredMethodScheduler::instance ();
|
||||
|
||||
m_annotation_shapes = source->m_annotation_shapes;
|
||||
|
||||
init (manager);
|
||||
|
|
@ -297,10 +287,6 @@ LayoutViewBase::LayoutViewBase (lay::LayoutViewBase *source, db::Manager *manage
|
|||
mp_canvas->set_dither_pattern (m_layer_properties_lists [0]->dither_pattern ());
|
||||
}
|
||||
|
||||
bookmarks (source->bookmarks ());
|
||||
|
||||
set_active_cellview_index (source->active_cellview_index ());
|
||||
|
||||
// copy the title
|
||||
m_title = source->m_title;
|
||||
|
||||
|
|
@ -361,7 +347,7 @@ LayoutViewBase::init (db::Manager *mgr)
|
|||
m_drop_small_cells_cond = DSC_Max;
|
||||
m_draw_array_border_instances = false;
|
||||
m_dirty = false;
|
||||
m_activated = true;
|
||||
m_prop_changed = false;
|
||||
m_animated = false;
|
||||
m_phase = 0;
|
||||
m_palette = lay::ColorPalette::default_palette ();
|
||||
|
|
@ -423,10 +409,6 @@ LayoutViewBase::init (db::Manager *mgr)
|
|||
|
||||
LayoutViewBase::~LayoutViewBase ()
|
||||
{
|
||||
if (ms_current == this) {
|
||||
ms_current = 0;
|
||||
}
|
||||
|
||||
// detach all observers
|
||||
// This is to prevent signals to partially destroyed observers that own a LayoutViewBase
|
||||
layer_list_changed_event.clear ();
|
||||
|
|
@ -535,6 +517,14 @@ void LayoutViewBase::drop_url (const std::string &path_or_url)
|
|||
}
|
||||
}
|
||||
|
||||
void LayoutViewBase::clear_plugins ()
|
||||
{
|
||||
for (std::vector<lay::Plugin *>::iterator p = mp_plugins.begin (); p != mp_plugins.end (); ++p) {
|
||||
delete *p;
|
||||
}
|
||||
mp_plugins.clear ();
|
||||
}
|
||||
|
||||
lay::Plugin *LayoutViewBase::create_plugin (const lay::PluginDeclaration *cls)
|
||||
{
|
||||
lay::Plugin *p = cls->create_plugin (manager (), dispatcher (), this);
|
||||
|
|
@ -557,39 +547,6 @@ lay::Plugin *LayoutViewBase::create_plugin (const lay::PluginDeclaration *cls)
|
|||
return p;
|
||||
}
|
||||
|
||||
void LayoutViewBase::create_plugins (const lay::PluginDeclaration *except_this)
|
||||
{
|
||||
for (std::vector<lay::Plugin *>::iterator p = mp_plugins.begin (); p != mp_plugins.end (); ++p) {
|
||||
delete *p;
|
||||
}
|
||||
mp_plugins.clear ();
|
||||
|
||||
// create the plugins
|
||||
for (tl::Registrar<lay::PluginDeclaration>::iterator cls = tl::Registrar<lay::PluginDeclaration>::begin (); cls != tl::Registrar<lay::PluginDeclaration>::end (); ++cls) {
|
||||
|
||||
if (&*cls != except_this) {
|
||||
|
||||
// TODO: clean solution. The following is a HACK:
|
||||
if (cls.current_name () == "ant::Plugin" || cls.current_name () == "img::Plugin") {
|
||||
// ant and img are created always
|
||||
create_plugin (&*cls);
|
||||
} else if ((m_options & LV_NoPlugins) == 0) {
|
||||
// others: only create unless LV_NoPlugins is set
|
||||
create_plugin (&*cls);
|
||||
} else if ((m_options & LV_NoGrid) == 0 && cls.current_name () == "GridNetPlugin") {
|
||||
// except grid net plugin which is created on request
|
||||
create_plugin (&*cls);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
dm_setup_editor_option_pages ();
|
||||
|
||||
mode (default_mode ());
|
||||
}
|
||||
|
||||
Plugin *LayoutViewBase::get_plugin_by_name (const std::string &name) const
|
||||
{
|
||||
lay::PluginDeclaration *decl = 0;
|
||||
|
|
@ -670,82 +627,6 @@ LayoutViewBase::configure (const std::string &name, const std::string &value)
|
|||
update_content ();
|
||||
return true;
|
||||
|
||||
/*@@@
|
||||
} else if (name == cfg_flat_cell_list) {
|
||||
|
||||
bool f;
|
||||
tl::from_string (value, f);
|
||||
if (mp_hierarchy_panel) {
|
||||
mp_hierarchy_panel->set_flat (f);
|
||||
}
|
||||
return true;
|
||||
|
||||
} else if (name == cfg_split_cell_list) {
|
||||
|
||||
bool f;
|
||||
tl::from_string (value, f);
|
||||
if (mp_hierarchy_panel) {
|
||||
mp_hierarchy_panel->set_split_mode (f);
|
||||
}
|
||||
return true;
|
||||
|
||||
} else if (name == cfg_split_lib_views) {
|
||||
|
||||
bool f;
|
||||
tl::from_string (value, f);
|
||||
if (mp_libraries_view) {
|
||||
mp_libraries_view->set_split_mode (f);
|
||||
}
|
||||
return true;
|
||||
|
||||
} else if (name == cfg_bookmarks_follow_selection) {
|
||||
|
||||
bool f;
|
||||
tl::from_string (value, f);
|
||||
if (mp_bookmarks_view) {
|
||||
mp_bookmarks_view->follow_selection (f);
|
||||
}
|
||||
return true;
|
||||
|
||||
} else if (name == cfg_current_lib_view) {
|
||||
|
||||
if (mp_libraries_view) {
|
||||
mp_libraries_view->select_active_lib_by_name (value);
|
||||
}
|
||||
return true;
|
||||
|
||||
} else if (name == cfg_cell_list_sorting) {
|
||||
|
||||
if (mp_hierarchy_panel) {
|
||||
if (value == "by-name") {
|
||||
mp_hierarchy_panel->set_sorting (CellTreeModel::ByName);
|
||||
} else if (value == "by-area") {
|
||||
mp_hierarchy_panel->set_sorting (CellTreeModel::ByArea);
|
||||
} else if (value == "by-area-reverse") {
|
||||
mp_hierarchy_panel->set_sorting (CellTreeModel::ByAreaReverse);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
} else if (name == cfg_hide_empty_layers) {
|
||||
|
||||
bool f;
|
||||
tl::from_string (value, f);
|
||||
if (mp_control_panel) {
|
||||
mp_control_panel->set_hide_empty_layers (f);
|
||||
}
|
||||
return true;
|
||||
|
||||
} else if (name == cfg_test_shapes_in_view) {
|
||||
|
||||
bool f;
|
||||
tl::from_string (value, f);
|
||||
if (mp_control_panel) {
|
||||
mp_control_panel->set_test_shapes_in_view (f);
|
||||
}
|
||||
return true;
|
||||
|
||||
@@@*/
|
||||
} else if (name == cfg_background_color) {
|
||||
|
||||
lay::Color color;
|
||||
|
|
@ -1270,9 +1151,7 @@ LayoutViewBase::configure (const std::string &name, const std::string &value)
|
|||
void
|
||||
LayoutViewBase::config_finalize ()
|
||||
{
|
||||
// It's important that the editor option pages are updated last - because the
|
||||
// configuration change may trigger other configuration changes
|
||||
dm_setup_editor_option_pages ();
|
||||
// .. nothing yet ..
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -1396,7 +1275,7 @@ LayoutViewBase::insert_layer_list (unsigned index, const LayerPropertiesList &pr
|
|||
|
||||
redraw ();
|
||||
|
||||
dm_prop_changed ();
|
||||
m_prop_changed = true;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -1438,7 +1317,7 @@ LayoutViewBase::delete_layer_list (unsigned index)
|
|||
}
|
||||
|
||||
layer_list_deleted_event (index);
|
||||
dm_prop_changed ();
|
||||
m_prop_changed = true;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -1551,7 +1430,7 @@ LayoutViewBase::set_properties (unsigned int index, const LayerPropertiesList &p
|
|||
|
||||
redraw ();
|
||||
|
||||
dm_prop_changed ();
|
||||
m_prop_changed = true;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1615,7 +1494,7 @@ LayoutViewBase::replace_layer_node (unsigned int index, const LayerPropertiesCon
|
|||
// TODO: check, if redraw is actually necessary (this is complex!)
|
||||
redraw ();
|
||||
|
||||
dm_prop_changed ();
|
||||
m_prop_changed = true;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1658,7 +1537,7 @@ LayoutViewBase::set_properties (unsigned int index, const LayerPropertiesConstIt
|
|||
|
||||
// perform the callbacks asynchronously to collect the necessary calls instead
|
||||
// of executing them immediately.
|
||||
dm_prop_changed ();
|
||||
m_prop_changed = true;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1685,7 +1564,7 @@ LayoutViewBase::insert_layer (unsigned int index, const LayerPropertiesConstIter
|
|||
if (index == current_layer_list ()) {
|
||||
layer_list_changed_event (2);
|
||||
redraw ();
|
||||
dm_prop_changed ();
|
||||
m_prop_changed = true;
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
|
@ -1717,7 +1596,7 @@ LayoutViewBase::delete_layer (unsigned int index, LayerPropertiesConstIterator &
|
|||
if (index == current_layer_list ()) {
|
||||
layer_list_changed_event (2);
|
||||
redraw ();
|
||||
dm_prop_changed ();
|
||||
m_prop_changed = true;
|
||||
}
|
||||
|
||||
// invalidate the iterator so it can be used to refer to the next element
|
||||
|
|
@ -3202,6 +3081,7 @@ LayoutViewBase::box () const
|
|||
return mp_canvas->viewport ().box ();
|
||||
}
|
||||
|
||||
// @@@ needs to be called "as often as possible"
|
||||
void
|
||||
LayoutViewBase::timer ()
|
||||
{
|
||||
|
|
@ -3215,26 +3095,23 @@ LayoutViewBase::timer ()
|
|||
emit dirty_changed ();
|
||||
}
|
||||
|
||||
if (m_animated) {
|
||||
set_view_ops ();
|
||||
if (mp_control_panel) {
|
||||
mp_control_panel->set_phase (int (m_phase));
|
||||
}
|
||||
if (m_animated) {
|
||||
++m_phase;
|
||||
}
|
||||
if (m_prop_changed) {
|
||||
do_prop_changed ();
|
||||
m_prop_changed = false;
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
LayoutViewBase::layer_model_updated ()
|
||||
{
|
||||
// because check_updated is called in the initialization phase, we check if the pointers
|
||||
// to the widgets are non-null:
|
||||
if (mp_control_panel) {
|
||||
return mp_control_panel->model_updated ();
|
||||
} else {
|
||||
return false;
|
||||
tl::Clock current_time = tl::Clock::current ();
|
||||
if ((current_time - m_last_checked).seconds () > animation_interval) {
|
||||
m_last_checked = current_time;
|
||||
if (m_animated) {
|
||||
set_view_ops ();
|
||||
if (mp_control_panel) {
|
||||
mp_control_panel->set_phase (int (m_phase));
|
||||
}
|
||||
if (m_animated) {
|
||||
++m_phase;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -3561,18 +3438,6 @@ LayoutViewBase::do_prop_changed ()
|
|||
update_content ();
|
||||
}
|
||||
|
||||
void
|
||||
LayoutViewBase::layer_tab_changed ()
|
||||
{
|
||||
update_content ();
|
||||
}
|
||||
|
||||
void
|
||||
LayoutViewBase::layer_order_changed ()
|
||||
{
|
||||
update_content ();
|
||||
}
|
||||
|
||||
void
|
||||
LayoutViewBase::set_view_ops ()
|
||||
{
|
||||
|
|
@ -4014,20 +3879,6 @@ LayoutViewBase::get_hier_levels () const
|
|||
return std::make_pair (m_from_level, m_to_level);
|
||||
}
|
||||
|
||||
void
|
||||
LayoutViewBase::min_hier_changed (int i)
|
||||
{
|
||||
mp_max_hier_spbx->setMinimum (i);
|
||||
set_hier_levels (std::make_pair (i, m_to_level));
|
||||
}
|
||||
|
||||
void
|
||||
LayoutViewBase::max_hier_changed (int i)
|
||||
{
|
||||
mp_min_hier_spbx->setMaximum (i);
|
||||
set_hier_levels (std::make_pair (m_from_level, i));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief set the maximum hierarchy level to the number of levels available
|
||||
*/
|
||||
|
|
@ -4173,6 +4024,18 @@ LayoutViewBase::abstract_mode_enabled (bool e)
|
|||
}
|
||||
}
|
||||
|
||||
lay::Color
|
||||
LayoutViewBase::default_background_color ()
|
||||
{
|
||||
return lay::Color (0, 0, 0); // black.
|
||||
}
|
||||
|
||||
void
|
||||
LayoutViewBase::do_set_background_color (lay::Color /*color*/, lay::Color /*contrast*/)
|
||||
{
|
||||
// .. nothing yet ..
|
||||
}
|
||||
|
||||
void
|
||||
LayoutViewBase::background_color (lay::Color c)
|
||||
{
|
||||
|
|
@ -4182,7 +4045,7 @@ LayoutViewBase::background_color (lay::Color c)
|
|||
|
||||
// replace by "real" background color if required
|
||||
if (! c.is_valid ()) {
|
||||
c = lay::Color (palette ().color (QPalette::Normal, QPalette::Base).rgb ());
|
||||
c = default_background_color ();
|
||||
}
|
||||
|
||||
lay::Color contrast;
|
||||
|
|
@ -4192,25 +4055,7 @@ LayoutViewBase::background_color (lay::Color c)
|
|||
contrast = lay::Color (255, 255, 255);
|
||||
}
|
||||
|
||||
if (mp_control_panel) {
|
||||
mp_control_panel->set_background_color (c);
|
||||
mp_control_panel->set_text_color (contrast);
|
||||
}
|
||||
|
||||
if (mp_hierarchy_panel) {
|
||||
mp_hierarchy_panel->set_background_color (c);
|
||||
mp_hierarchy_panel->set_text_color (contrast);
|
||||
}
|
||||
|
||||
if (mp_libraries_view) {
|
||||
mp_libraries_view->set_background_color (c);
|
||||
mp_libraries_view->set_text_color (contrast);
|
||||
}
|
||||
|
||||
if (mp_bookmarks_view) {
|
||||
mp_bookmarks_view->set_background_color (c);
|
||||
mp_bookmarks_view->set_text_color (contrast);
|
||||
}
|
||||
do_set_background_color (c, contrast);
|
||||
|
||||
if (mp_selection_service) {
|
||||
mp_selection_service->set_colors (c, contrast);
|
||||
|
|
@ -4274,41 +4119,6 @@ LayoutViewBase::select_cellviews_fit (const std::list <CellView> &cvs)
|
|||
}
|
||||
}
|
||||
|
||||
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
|
||||
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 (m_title.empty ()) {
|
||||
emit title_changed ();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
LayoutViewBase::active_library_changed (int /*index*/)
|
||||
{
|
||||
std::string lib_name;
|
||||
if (mp_libraries_view->active_lib ()) {
|
||||
lib_name = mp_libraries_view->active_lib ()->get_name ();
|
||||
}
|
||||
|
||||
// commit the new active library to the other views and persist this state
|
||||
// TODO: could be passed through the LibraryController (like through some LibraryController::active_library)
|
||||
dispatcher ()->config_set (cfg_current_lib_view, lib_name);
|
||||
}
|
||||
|
||||
void
|
||||
LayoutViewBase::cellview_changed (unsigned int index)
|
||||
{
|
||||
|
|
@ -4741,13 +4551,13 @@ LayoutViewBase::text_color (lay::Color c)
|
|||
bool
|
||||
LayoutViewBase::has_selection ()
|
||||
{
|
||||
if (mp_control_panel && mp_control_panel->has_focus ()) {
|
||||
return mp_control_panel->has_selection ();
|
||||
} else if (mp_hierarchy_panel && mp_hierarchy_panel->has_focus ()) {
|
||||
return mp_hierarchy_panel->has_selection ();
|
||||
} else {
|
||||
return lay::Editables::has_selection ();
|
||||
}
|
||||
return lay::Editables::has_selection ();
|
||||
}
|
||||
|
||||
void
|
||||
LayoutViewBase::do_paste ()
|
||||
{
|
||||
// .. nothing yet ..
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -4759,12 +4569,7 @@ LayoutViewBase::paste ()
|
|||
db::Transaction trans (manager (), tl::to_string (tr ("Paste")));
|
||||
|
||||
// let the receivers sort out who is pasting what ..
|
||||
if (mp_hierarchy_panel) {
|
||||
mp_hierarchy_panel->paste ();
|
||||
}
|
||||
if (mp_control_panel) {
|
||||
mp_control_panel->paste ();
|
||||
}
|
||||
do_paste ();
|
||||
lay::Editables::paste ();
|
||||
}
|
||||
|
||||
|
|
@ -4792,12 +4597,7 @@ LayoutViewBase::paste_interactive ()
|
|||
|
||||
{
|
||||
// let the receivers sort out who is pasting what ..
|
||||
if (mp_hierarchy_panel) {
|
||||
mp_hierarchy_panel->paste ();
|
||||
}
|
||||
if (mp_control_panel) {
|
||||
mp_control_panel->paste ();
|
||||
}
|
||||
do_paste ();
|
||||
lay::Editables::paste ();
|
||||
}
|
||||
|
||||
|
|
@ -4985,21 +4785,9 @@ LayoutViewBase::has_next_display_state ()
|
|||
}
|
||||
|
||||
void
|
||||
LayoutViewBase::current_pos (double x, double y)
|
||||
LayoutViewBase::current_pos (double /*x*/, double /*y*/)
|
||||
{
|
||||
if (m_activated) {
|
||||
if (dbu_coordinates ()) {
|
||||
double dx = 0.0, dy = 0.0;
|
||||
if (active_cellview_index () >= 0) {
|
||||
double dbu = cellview (active_cellview_index ())->layout ().dbu ();
|
||||
dx = x / dbu;
|
||||
dy = y / dbu;
|
||||
}
|
||||
emit current_pos_changed (dx, dy, true);
|
||||
} else {
|
||||
emit current_pos_changed (x, y, false);
|
||||
}
|
||||
}
|
||||
// .. nothing yet ..
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -5008,6 +4796,12 @@ LayoutViewBase::stop_redraw ()
|
|||
mp_canvas->stop_redraw ();
|
||||
}
|
||||
|
||||
void
|
||||
LayoutViewBase::free_resources ()
|
||||
{
|
||||
mp_canvas->free_resources ();
|
||||
}
|
||||
|
||||
void
|
||||
LayoutViewBase::stop ()
|
||||
{
|
||||
|
|
@ -5015,6 +4809,12 @@ LayoutViewBase::stop ()
|
|||
deactivate_all_browsers ();
|
||||
}
|
||||
|
||||
void
|
||||
LayoutViewBase::switch_mode (int /*m*/)
|
||||
{
|
||||
// .. nothing yet ..
|
||||
}
|
||||
|
||||
void
|
||||
LayoutViewBase::mode (int m)
|
||||
{
|
||||
|
|
@ -5282,12 +5082,6 @@ LayoutViewBase::set_search_range_box (unsigned int sr)
|
|||
m_search_range_box = sr;
|
||||
}
|
||||
|
||||
void
|
||||
LayoutViewBase::message (const std::string &s, int timeout)
|
||||
{
|
||||
emit show_message (s, timeout * 1000);
|
||||
}
|
||||
|
||||
db::cell_index_type
|
||||
LayoutViewBase::new_cell (int cv_index, const std::string &cell_name)
|
||||
{
|
||||
|
|
@ -5309,15 +5103,6 @@ LayoutViewBase::new_cell (int cv_index, const std::string &cell_name)
|
|||
return new_ci;
|
||||
}
|
||||
|
||||
void
|
||||
LayoutViewBase::switch_mode (int m)
|
||||
{
|
||||
if (m_mode != m) {
|
||||
mode (m);
|
||||
emit mode_change (m);
|
||||
}
|
||||
}
|
||||
|
||||
template <class T, class Iter>
|
||||
static void make_unique_name (T *object, Iter from, Iter to)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@
|
|||
#include "gsi.h"
|
||||
#include "tlException.h"
|
||||
#include "tlEvents.h"
|
||||
#include "tlTimer.h"
|
||||
#include "dbInstElement.h"
|
||||
|
||||
namespace rdb {
|
||||
|
|
@ -196,7 +197,7 @@ public:
|
|||
* This reimplementation of the lay::Editables interface additionally
|
||||
* looks for content providers in the tree views for example.
|
||||
*/
|
||||
bool has_selection ();
|
||||
virtual bool has_selection ();
|
||||
|
||||
/**
|
||||
* @brief Pastes from clipboard
|
||||
|
|
@ -217,7 +218,7 @@ public:
|
|||
* This reimplementation of the lay::Editables interface additionally
|
||||
* looks for copy providers in the tree views for example.
|
||||
*/
|
||||
void copy ();
|
||||
virtual void copy ();
|
||||
|
||||
/**
|
||||
* @brief Cuts to clipboard
|
||||
|
|
@ -225,7 +226,7 @@ public:
|
|||
* This reimplementation of the lay::Editables interface additionally
|
||||
* looks for cut & copy providers in the tree views for example.
|
||||
*/
|
||||
void cut ();
|
||||
virtual void cut ();
|
||||
|
||||
/**
|
||||
* @brief Gets the explicit title string of the view
|
||||
|
|
@ -638,19 +639,6 @@ public:
|
|||
*/
|
||||
tl::Event cell_visibility_changed_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;
|
||||
|
||||
/**
|
||||
* @brief Save the given cellview into the given file (with options)
|
||||
* If "update" is true, the cell view's properties will be updated (options, filename etc.).
|
||||
|
|
@ -1294,9 +1282,9 @@ public:
|
|||
unsigned int add_layout (lay::LayoutHandle *layout_handle, bool add_cellview, bool initialize_layers = true);
|
||||
|
||||
/**
|
||||
* @brief Pass the current position from the mouse tracker to the status bar
|
||||
* @brief Indicates the current position
|
||||
*/
|
||||
void current_pos (double x, double y);
|
||||
virtual void current_pos (double x, double y);
|
||||
|
||||
/**
|
||||
* @brief Obtain the number of cellviews
|
||||
|
|
@ -1389,11 +1377,6 @@ public:
|
|||
*/
|
||||
db::DBox box () const;
|
||||
|
||||
/**
|
||||
* @brief Display a status message
|
||||
*/
|
||||
void message (const std::string &s = "", int timeout = 10);
|
||||
|
||||
/**
|
||||
* @brief Create a new cell with the given in the given cellview
|
||||
*
|
||||
|
|
@ -1411,14 +1394,6 @@ public:
|
|||
*/
|
||||
void mode (int m);
|
||||
|
||||
/**
|
||||
* @brief Switches the application's mode
|
||||
*
|
||||
* Switches the mode on application level. Use this method to initiate
|
||||
* a mode switch from the view.
|
||||
*/
|
||||
void switch_mode (int m);
|
||||
|
||||
/**
|
||||
* @brief Test, if the view is currently in move mode.
|
||||
*/
|
||||
|
|
@ -1434,12 +1409,6 @@ public:
|
|||
*/
|
||||
static unsigned int intrinsic_mouse_modes (std::vector<std::string> *descriptions);
|
||||
|
||||
/**
|
||||
* @brief Updates the menu for the given view
|
||||
* If the view is 0, the menu shall be updated to reflect "no view active"
|
||||
*/
|
||||
static void update_menu (lay::LayoutViewBase *view, lay::AbstractMenu &menu);
|
||||
|
||||
/**
|
||||
* @brief Query the default mode
|
||||
*/
|
||||
|
|
@ -1925,16 +1894,6 @@ public:
|
|||
*/
|
||||
void merge_layer_props (const std::vector<lay::LayerPropertiesList> &props);
|
||||
|
||||
/**
|
||||
* @brief Internal method: check, if the layer tree is and an consistent state.
|
||||
*
|
||||
* This method is used by the layer tree model to check, if the tree has been brought into
|
||||
* a consistent state.
|
||||
* HINT: for the layout this is solved more consistently with the "under construction" attribute
|
||||
* of the layout. There is no equivalent object for the layer tree currently.
|
||||
*/
|
||||
bool layer_model_updated ();
|
||||
|
||||
/**
|
||||
* @brief Get the "select inside PCells" selection mode
|
||||
*
|
||||
|
|
@ -2278,13 +2237,6 @@ public:
|
|||
lay::SelectionService *selection_service () const { return mp_selection_service; }
|
||||
lay::MoveService *move_service () const { return mp_move_service; }
|
||||
|
||||
/**
|
||||
* @brief Create all plugins
|
||||
*
|
||||
* If plugins already exist, they are deleted and created again
|
||||
*/
|
||||
void create_plugins (const lay::PluginDeclaration *except_this = 0);
|
||||
|
||||
/**
|
||||
* @brief Gets the full field box
|
||||
*
|
||||
|
|
@ -2385,11 +2337,7 @@ public:
|
|||
void redraw_layer (unsigned int index);
|
||||
void redraw_deco_layer ();
|
||||
void redraw_cell_boxes ();
|
||||
void layer_tab_changed ();
|
||||
void layer_order_changed ();
|
||||
void timer ();
|
||||
void min_hier_changed (int i);
|
||||
void max_hier_changed (int i);
|
||||
|
||||
private:
|
||||
// event handlers used to connect to the layout object's events
|
||||
|
|
@ -2403,10 +2351,6 @@ private:
|
|||
void signal_plugin_enabled_changed ();
|
||||
void signal_apply_technology (lay::LayoutHandle *layout_handle);
|
||||
|
||||
void active_cellview_changed (int index);
|
||||
void active_library_changed (int index);
|
||||
void side_panel_destroyed ();
|
||||
|
||||
private:
|
||||
bool m_editable;
|
||||
int m_disabled_edits;
|
||||
|
|
@ -2492,7 +2436,7 @@ private:
|
|||
bool m_absolute_coordinates;
|
||||
|
||||
bool m_dirty;
|
||||
bool m_activated;
|
||||
bool m_prop_changed;
|
||||
bool m_animated;
|
||||
unsigned int m_phase;
|
||||
|
||||
|
|
@ -2519,6 +2463,8 @@ private:
|
|||
|
||||
bool m_visibility_changed;
|
||||
|
||||
tl::Clock m_clock, m_last_checked;
|
||||
|
||||
void init (db::Manager *mgr);
|
||||
|
||||
void do_prop_changed ();
|
||||
|
|
@ -2544,9 +2490,6 @@ private:
|
|||
void viewport_changed ();
|
||||
void cellview_changed (unsigned int index);
|
||||
|
||||
bool configure (const std::string &name, const std::string &value);
|
||||
void config_finalize ();
|
||||
|
||||
void do_load_layer_props (const std::string &fn, bool map_cv, int cv_index, bool add_default);
|
||||
void finish_cellviews_changed ();
|
||||
void init_layer_properties (LayerProperties &props, const LayerPropertiesList &lp_list) const;
|
||||
|
|
@ -2555,10 +2498,32 @@ private:
|
|||
// overrides Editables method to display a message
|
||||
void signal_selection_changed ();
|
||||
|
||||
lay::Plugin *create_plugin (const lay::PluginDeclaration *cls);
|
||||
protected:
|
||||
unsigned int options () const
|
||||
{
|
||||
return m_options;
|
||||
}
|
||||
|
||||
int mode () const
|
||||
{
|
||||
return m_mode;
|
||||
}
|
||||
|
||||
bool configure (const std::string &name, const std::string &value);
|
||||
void config_finalize ();
|
||||
|
||||
std::list<lay::CellView>::iterator cellview_iter (int cv_index);
|
||||
std::list<lay::CellView>::const_iterator cellview_iter (int cv_index) const;
|
||||
|
||||
lay::Plugin *create_plugin (const lay::PluginDeclaration *cls);
|
||||
void clear_plugins ();
|
||||
|
||||
void free_resources ();
|
||||
|
||||
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);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
namespace lay
|
||||
{
|
||||
|
||||
MouseTracker::MouseTracker (lay::LayoutView *view)
|
||||
MouseTracker::MouseTracker (lay::LayoutViewBase *view)
|
||||
: lay::ViewService (view->view_object_widget ()), mp_view (view)
|
||||
{
|
||||
widget ()->grab_mouse (this, false);
|
||||
|
|
|
|||
Loading…
Reference in New Issue