mirror of https://github.com/KLayout/klayout.git
Some refactoring: pulled out the layout functionality from the layout view and put into a plugin.
This commit is contained in:
parent
79d3676257
commit
374c8d2c4d
|
|
@ -444,6 +444,14 @@ Editables::select (const db::DPoint &pt, lay::Editable::SelectionMode mode)
|
|||
signal_selection_changed ();
|
||||
}
|
||||
|
||||
void
|
||||
Editables::repeat_selection (Editable::SelectionMode mode)
|
||||
{
|
||||
if (m_last_selected_point.is_point ()) {
|
||||
select (m_last_selected_point, mode);
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
Editables::begin_move (const db::DPoint &p, lay::angle_constraint_type ac)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -493,6 +493,13 @@ public:
|
|||
*/
|
||||
void select (const db::DPoint &pt, Editable::SelectionMode mode);
|
||||
|
||||
/**
|
||||
* @brief Repeat the previous selection
|
||||
*
|
||||
* This method will not do anything if there is no previous, click-at selection.
|
||||
*/
|
||||
void repeat_selection (Editable::SelectionMode mode);
|
||||
|
||||
/**
|
||||
* @brief Start "move" operation
|
||||
*
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -50,7 +50,6 @@
|
|||
#include "layPlugin.h"
|
||||
#include "layDisplayState.h"
|
||||
#include "layBookmarkList.h"
|
||||
#include "layDialogs.h"
|
||||
#include "gsi.h"
|
||||
#include "tlException.h"
|
||||
#include "tlEvents.h"
|
||||
|
|
@ -237,6 +236,14 @@ public:
|
|||
return mp_control_frame;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Gets the layer control panel
|
||||
*/
|
||||
lay::LayerControlPanel *control_panel ()
|
||||
{
|
||||
return mp_control_panel;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Gets the container with the hierarchy control panel
|
||||
*/
|
||||
|
|
@ -245,6 +252,14 @@ public:
|
|||
return mp_hierarchy_frame;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Gets the hierarchy panel
|
||||
*/
|
||||
lay::HierarchyControlPanel *hierarchy_panel ()
|
||||
{
|
||||
return mp_hierarchy_panel;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Gets the container with the libraries view
|
||||
*/
|
||||
|
|
@ -1958,6 +1973,14 @@ public:
|
|||
*/
|
||||
virtual void drop_url (const std::string &path_or_url);
|
||||
|
||||
/**
|
||||
* @brief Gets a list of all plugins
|
||||
*/
|
||||
const std::vector<lay::Plugin *> &plugins ()
|
||||
{
|
||||
return mp_plugins;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Localize a plugin by name
|
||||
*
|
||||
|
|
@ -2582,81 +2605,6 @@ public slots:
|
|||
void pan_right_fast ();
|
||||
void pan_down_fast ();
|
||||
|
||||
// menu callbacks
|
||||
void cm_new_layer ();
|
||||
void cm_clear_layer ();
|
||||
void cm_delete_layer ();
|
||||
void cm_copy_layer ();
|
||||
void cm_align_cell_origin ();
|
||||
void cm_edit_layer ();
|
||||
void cm_lay_convert_to_static ();
|
||||
void cm_lay_flip_x ();
|
||||
void cm_lay_flip_y ();
|
||||
void cm_lay_rot_cw ();
|
||||
void cm_lay_rot_ccw ();
|
||||
void cm_lay_free_rot ();
|
||||
void cm_lay_scale ();
|
||||
void cm_lay_move ();
|
||||
void cm_sel_flip_x ();
|
||||
void cm_sel_flip_y ();
|
||||
void cm_sel_rot_cw ();
|
||||
void cm_sel_rot_ccw ();
|
||||
void cm_sel_free_rot ();
|
||||
void cm_sel_scale ();
|
||||
void cm_sel_move ();
|
||||
void cm_sel_move_to ();
|
||||
void cm_sel_move_interactive ();
|
||||
|
||||
// forwarded to the layer control panel
|
||||
void cm_new_tab ();
|
||||
void cm_rename_tab ();
|
||||
void cm_remove_tab ();
|
||||
void cm_select_all ();
|
||||
void cm_make_valid ();
|
||||
void cm_make_invalid ();
|
||||
void cm_hide ();
|
||||
void cm_hide_all ();
|
||||
void cm_show ();
|
||||
void cm_show_all ();
|
||||
void cm_show_only ();
|
||||
void cm_rename ();
|
||||
void cm_delete ();
|
||||
void cm_insert ();
|
||||
void cm_group ();
|
||||
void cm_ungroup ();
|
||||
void cm_source ();
|
||||
void cm_sort_by_name ();
|
||||
void cm_sort_by_ild ();
|
||||
void cm_sort_by_idl ();
|
||||
void cm_sort_by_ldi ();
|
||||
void cm_sort_by_dli ();
|
||||
void cm_regroup_by_index ();
|
||||
void cm_regroup_by_datatype ();
|
||||
void cm_regroup_by_layer ();
|
||||
void cm_regroup_flatten ();
|
||||
void cm_expand_all ();
|
||||
void cm_add_missing ();
|
||||
void cm_remove_unused ();
|
||||
void cm_layer_copy ();
|
||||
void cm_layer_cut ();
|
||||
void cm_layer_paste ();
|
||||
|
||||
// forwarded to the cell control panel
|
||||
void cm_cell_user_properties ();
|
||||
void cm_cell_flatten ();
|
||||
void cm_cell_rename ();
|
||||
void cm_cell_replace ();
|
||||
void cm_cell_delete ();
|
||||
void cm_cell_select ();
|
||||
void cm_open_current_cell ();
|
||||
void cm_cell_hide ();
|
||||
void cm_cell_show ();
|
||||
void cm_cell_show_all ();
|
||||
void cm_cell_copy ();
|
||||
void cm_cell_cut ();
|
||||
void cm_cell_paste ();
|
||||
void cm_cell_convert_to_static ();
|
||||
|
||||
// called by children and owner
|
||||
void redraw ();
|
||||
void redraw_layer (unsigned int index);
|
||||
|
|
@ -2869,17 +2817,6 @@ private:
|
|||
|
||||
std::vector<lay::Plugin *> mp_plugins;
|
||||
|
||||
db::LayerProperties m_new_layer_props;
|
||||
db::DVector m_move_dist;
|
||||
int m_move_to_origin_mode_x, m_move_to_origin_mode_y;
|
||||
lay::AlignCellOptions m_align_cell_options;
|
||||
int m_del_cell_mode;
|
||||
int m_layer_hier_mode;
|
||||
int m_duplicate_hier_mode;
|
||||
bool m_clear_before;
|
||||
int m_copy_cva, m_copy_cvr;
|
||||
int m_copy_layera, m_copy_layerr;
|
||||
|
||||
bool m_visibility_changed;
|
||||
bool m_active_cellview_changed_event_enabled;
|
||||
tl::DeferredMethod<lay::LayoutView> dm_prop_changed;
|
||||
|
|
@ -2890,8 +2827,6 @@ private:
|
|||
void do_prop_changed ();
|
||||
void do_redraw (int layer);
|
||||
void do_redraw ();
|
||||
void do_transform (const db::DCplxTrans &tr);
|
||||
void transform_layout (const db::DCplxTrans &tr);
|
||||
|
||||
void background_color (QColor c);
|
||||
void ctx_color (QColor c);
|
||||
|
|
@ -2918,11 +2853,6 @@ private:
|
|||
void init_layer_properties (LayerProperties &props, const LayerPropertiesList &lp_list) const;
|
||||
void merge_dither_pattern (lay::LayerPropertiesList &props);
|
||||
|
||||
void do_cm_duplicate (bool interactive);
|
||||
void do_cm_paste (bool interactive);
|
||||
void cm_new_cell ();
|
||||
void cm_reload ();
|
||||
|
||||
// overrides Editables method to display a message
|
||||
void signal_selection_changed ();
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,171 @@
|
|||
|
||||
/*
|
||||
|
||||
KLayout Layout Viewer
|
||||
Copyright (C) 2006-2020 Matthias Koefferlein
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#ifndef HDR_layLayoutViewFunctions
|
||||
#define HDR_layLayoutViewFunctions
|
||||
|
||||
#include "laybasicCommon.h"
|
||||
|
||||
#include "layPlugin.h"
|
||||
#include "layDialogs.h" // For AlignCellOptions
|
||||
|
||||
#include "dbTrans.h"
|
||||
#include "dbLayerProperties.h"
|
||||
|
||||
namespace lay {
|
||||
|
||||
class LayoutView;
|
||||
|
||||
/**
|
||||
* @brief The layout view's functions implementation
|
||||
*/
|
||||
class LAYBASIC_PUBLIC LayoutViewFunctions
|
||||
: public lay::Plugin
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @brief Constructor
|
||||
*/
|
||||
LayoutViewFunctions (db::Manager *manager, lay::LayoutView *view);
|
||||
|
||||
/**
|
||||
* @brief Destructor
|
||||
*/
|
||||
~LayoutViewFunctions ();
|
||||
|
||||
// Plugin interface implementation
|
||||
void menu_activated (const std::string &symbol);
|
||||
|
||||
// menu callbacks
|
||||
void cm_new_layer ();
|
||||
void cm_clear_layer ();
|
||||
void cm_delete_layer ();
|
||||
void cm_copy_layer ();
|
||||
void cm_align_cell_origin ();
|
||||
void cm_edit_layer ();
|
||||
void cm_lay_convert_to_static ();
|
||||
void cm_lay_flip_x ();
|
||||
void cm_lay_flip_y ();
|
||||
void cm_lay_rot_cw ();
|
||||
void cm_lay_rot_ccw ();
|
||||
void cm_lay_free_rot ();
|
||||
void cm_lay_scale ();
|
||||
void cm_lay_move ();
|
||||
void cm_sel_flip_x ();
|
||||
void cm_sel_flip_y ();
|
||||
void cm_sel_rot_cw ();
|
||||
void cm_sel_rot_ccw ();
|
||||
void cm_sel_free_rot ();
|
||||
void cm_sel_scale ();
|
||||
void cm_sel_move ();
|
||||
void cm_sel_move_to ();
|
||||
void cm_sel_move_interactive ();
|
||||
|
||||
// forwarded to the layer control panel
|
||||
void cm_new_tab ();
|
||||
void cm_rename_tab ();
|
||||
void cm_remove_tab ();
|
||||
void cm_select_all ();
|
||||
void cm_make_valid ();
|
||||
void cm_make_invalid ();
|
||||
void cm_hide ();
|
||||
void cm_hide_all ();
|
||||
void cm_show ();
|
||||
void cm_show_all ();
|
||||
void cm_show_only ();
|
||||
void cm_rename ();
|
||||
void cm_delete ();
|
||||
void cm_insert ();
|
||||
void cm_group ();
|
||||
void cm_ungroup ();
|
||||
void cm_source ();
|
||||
void cm_sort_by_name ();
|
||||
void cm_sort_by_ild ();
|
||||
void cm_sort_by_idl ();
|
||||
void cm_sort_by_ldi ();
|
||||
void cm_sort_by_dli ();
|
||||
void cm_regroup_by_index ();
|
||||
void cm_regroup_by_datatype ();
|
||||
void cm_regroup_by_layer ();
|
||||
void cm_regroup_flatten ();
|
||||
void cm_expand_all ();
|
||||
void cm_add_missing ();
|
||||
void cm_remove_unused ();
|
||||
void cm_layer_copy ();
|
||||
void cm_layer_cut ();
|
||||
void cm_layer_paste ();
|
||||
|
||||
// forwarded to the cell control panel
|
||||
void cm_cell_user_properties ();
|
||||
void cm_cell_flatten ();
|
||||
void cm_cell_rename ();
|
||||
void cm_cell_replace ();
|
||||
void cm_cell_delete ();
|
||||
void cm_cell_select ();
|
||||
void cm_open_current_cell ();
|
||||
void cm_cell_hide ();
|
||||
void cm_cell_show ();
|
||||
void cm_cell_show_all ();
|
||||
void cm_cell_copy ();
|
||||
void cm_cell_cut ();
|
||||
void cm_cell_paste ();
|
||||
void cm_cell_convert_to_static ();
|
||||
|
||||
protected:
|
||||
lay::LayoutView *view ()
|
||||
{
|
||||
return mp_view;
|
||||
}
|
||||
|
||||
db::Manager *manager ()
|
||||
{
|
||||
return mp_manager;
|
||||
}
|
||||
|
||||
void do_cm_duplicate (bool interactive);
|
||||
void do_cm_paste (bool interactive);
|
||||
void cm_new_cell ();
|
||||
void cm_reload ();
|
||||
|
||||
void do_transform (const db::DCplxTrans &tr);
|
||||
void transform_layout (const db::DCplxTrans &tr);
|
||||
|
||||
private:
|
||||
lay::LayoutView *mp_view;
|
||||
db::Manager *mp_manager;
|
||||
db::LayerProperties m_new_layer_props;
|
||||
db::DVector m_move_dist;
|
||||
int m_move_to_origin_mode_x, m_move_to_origin_mode_y;
|
||||
lay::AlignCellOptions m_align_cell_options;
|
||||
int m_del_cell_mode;
|
||||
int m_layer_hier_mode;
|
||||
int m_duplicate_hier_mode;
|
||||
bool m_clear_before;
|
||||
int m_copy_cva, m_copy_cvr;
|
||||
int m_copy_layera, m_copy_layerr;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
@ -184,7 +184,8 @@ SOURCES = \
|
|||
layDispatcher.cc \
|
||||
laySelectCellViewForm.cc \
|
||||
layLayoutStatisticsForm.cc \
|
||||
gsiDeclLayNetlistBrowserDialog.cc
|
||||
gsiDeclLayNetlistBrowserDialog.cc \
|
||||
layLayoutViewFunctions.cc
|
||||
|
||||
HEADERS = \
|
||||
gtf.h \
|
||||
|
|
@ -285,7 +286,8 @@ HEADERS = \
|
|||
layGenericSyntaxHighlighter.h \
|
||||
layDispatcher.h \
|
||||
laySelectCellViewForm.h \
|
||||
layLayoutStatisticsForm.h
|
||||
layLayoutStatisticsForm.h \
|
||||
layLayoutViewFunctions.h
|
||||
|
||||
INCLUDEPATH += $$TL_INC $$GSI_INC $$DB_INC $$RDB_INC $$LYM_INC
|
||||
DEPENDPATH += $$TL_INC $$GSI_INC $$DB_INC $$RDB_INC $$LYM_INC
|
||||
|
|
|
|||
Loading…
Reference in New Issue