mirror of https://github.com/KLayout/klayout.git
WIP: adding tab key to move tool (calls 'move by' menu), enhancing 'move_to' and 'move_by' dialogs.
This commit is contained in:
parent
aba1f87b0d
commit
7fd01a64f6
|
|
@ -98,9 +98,7 @@ BEGIN_PROTECTED
|
||||||
// The Return key on a non-modal page commits the values and gives back the focus
|
// The Return key on a non-modal page commits the values and gives back the focus
|
||||||
// to the view
|
// to the view
|
||||||
apply (dispatcher ());
|
apply (dispatcher ());
|
||||||
if (view ()->canvas ()->widget ()) {
|
view ()->set_focus ();
|
||||||
view ()->canvas ()->widget ()->setFocus (Qt::TabFocusReason);
|
|
||||||
}
|
|
||||||
event->accept ();
|
event->accept ();
|
||||||
} else {
|
} else {
|
||||||
QWidget::keyPressEvent (event);
|
QWidget::keyPressEvent (event);
|
||||||
|
|
|
||||||
|
|
@ -691,6 +691,12 @@ LayoutViewBase::message (const std::string & /*s*/, int /*timeout*/)
|
||||||
// .. nothing yet ..
|
// .. nothing yet ..
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
LayoutViewBase::set_focus ()
|
||||||
|
{
|
||||||
|
// .. nothing yet ..
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
LayoutViewBase::is_dirty () const
|
LayoutViewBase::is_dirty () const
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -295,6 +295,11 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual void message (const std::string &s = "", int timeout = 10);
|
virtual void message (const std::string &s = "", int timeout = 10);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Sets the keyboard focus to the view
|
||||||
|
*/
|
||||||
|
virtual void set_focus ();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The "dirty" flag indicates that one of the layout has been modified
|
* @brief The "dirty" flag indicates that one of the layout has been modified
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,7 @@ MoveService::MoveService (lay::LayoutViewBase *view)
|
||||||
lay::Plugin (view),
|
lay::Plugin (view),
|
||||||
m_dragging (false),
|
m_dragging (false),
|
||||||
m_dragging_transient (false),
|
m_dragging_transient (false),
|
||||||
|
m_active (false),
|
||||||
mp_editables (view),
|
mp_editables (view),
|
||||||
mp_view (view),
|
mp_view (view),
|
||||||
m_global_grid (0.001)
|
m_global_grid (0.001)
|
||||||
|
|
@ -51,10 +52,17 @@ MoveService::~MoveService ()
|
||||||
drag_cancel ();
|
drag_cancel ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
MoveService::activated ()
|
||||||
|
{
|
||||||
|
m_active = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
MoveService::deactivated ()
|
MoveService::deactivated ()
|
||||||
{
|
{
|
||||||
m_shift = db::DPoint ();
|
m_shift = db::DPoint ();
|
||||||
|
m_active = false;
|
||||||
mp_view->clear_transient_selection ();
|
mp_view->clear_transient_selection ();
|
||||||
drag_cancel ();
|
drag_cancel ();
|
||||||
}
|
}
|
||||||
|
|
@ -87,8 +95,15 @@ MoveService::configure (const std::string &name, const std::string &value)
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
MoveService::key_event (unsigned int key, unsigned int /*buttons*/)
|
MoveService::key_event (unsigned int key, unsigned int buttons)
|
||||||
{
|
{
|
||||||
|
if (m_active && key == Qt::Key_Tab && buttons == 0) {
|
||||||
|
if (dispatcher ()) {
|
||||||
|
dispatcher ()->menu_activated ("cm_sel_move");
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
double dx = 0.0, dy = 0.0;
|
double dx = 0.0, dy = 0.0;
|
||||||
if (int (key) == lay::KeyDown) {
|
if (int (key) == lay::KeyDown) {
|
||||||
dy = -1.0;
|
dy = -1.0;
|
||||||
|
|
|
||||||
|
|
@ -61,12 +61,14 @@ private:
|
||||||
virtual bool wheel_event (int delta, bool horizontal, const db::DPoint &p, unsigned int buttons, bool prio);
|
virtual bool wheel_event (int delta, bool horizontal, const db::DPoint &p, unsigned int buttons, bool prio);
|
||||||
virtual bool key_event (unsigned int key, unsigned int buttons);
|
virtual bool key_event (unsigned int key, unsigned int buttons);
|
||||||
virtual void drag_cancel ();
|
virtual void drag_cancel ();
|
||||||
|
virtual void activated ();
|
||||||
virtual void deactivated ();
|
virtual void deactivated ();
|
||||||
|
|
||||||
bool handle_click (const db::DPoint &p, unsigned int buttons, bool drag_transient, db::Transaction *transaction);
|
bool handle_click (const db::DPoint &p, unsigned int buttons, bool drag_transient, db::Transaction *transaction);
|
||||||
|
|
||||||
bool m_dragging;
|
bool m_dragging;
|
||||||
bool m_dragging_transient;
|
bool m_dragging_transient;
|
||||||
|
bool m_active;
|
||||||
lay::Editables *mp_editables;
|
lay::Editables *mp_editables;
|
||||||
lay::LayoutViewBase *mp_view;
|
lay::LayoutViewBase *mp_view;
|
||||||
double m_global_grid;
|
double m_global_grid;
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>233</width>
|
<width>240</width>
|
||||||
<height>168</height>
|
<height>168</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="margin">
|
<property name="margin" stdset="0">
|
||||||
<number>9</number>
|
<number>9</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
|
|
@ -26,12 +26,16 @@
|
||||||
<string>Displacement</string>
|
<string>Displacement</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout">
|
<layout class="QGridLayout">
|
||||||
<property name="margin">
|
|
||||||
<number>9</number>
|
|
||||||
</property>
|
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
|
<item row="1" column="2">
|
||||||
|
<widget class="QLabel" name="label_5">
|
||||||
|
<property name="text">
|
||||||
|
<string>µm</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item row="0" column="2">
|
<item row="0" column="2">
|
||||||
<widget class="QLabel" name="label_4">
|
<widget class="QLabel" name="label_4">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
|
|
@ -45,13 +49,6 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="2">
|
|
||||||
<widget class="QLabel" name="label_5">
|
|
||||||
<property name="text">
|
|
||||||
<string>µm</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
<item row="1" column="0">
|
||||||
<widget class="QLabel" name="label_3">
|
<widget class="QLabel" name="label_3">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
|
@ -69,13 +66,6 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QLabel" name="label_2">
|
|
||||||
<property name="text">
|
|
||||||
<string>x </string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1">
|
<item row="0" column="1">
|
||||||
<widget class="QLineEdit" name="disp_x_le">
|
<widget class="QLineEdit" name="disp_x_le">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
|
|
@ -86,6 +76,13 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>x </string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
@ -117,26 +114,9 @@
|
||||||
<tabstops>
|
<tabstops>
|
||||||
<tabstop>disp_x_le</tabstop>
|
<tabstop>disp_x_le</tabstop>
|
||||||
<tabstop>disp_y_le</tabstop>
|
<tabstop>disp_y_le</tabstop>
|
||||||
<tabstop>buttonBox</tabstop>
|
|
||||||
</tabstops>
|
</tabstops>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections>
|
<connections>
|
||||||
<connection>
|
|
||||||
<sender>buttonBox</sender>
|
|
||||||
<signal>accepted()</signal>
|
|
||||||
<receiver>MoveOptionsDialog</receiver>
|
|
||||||
<slot>accept()</slot>
|
|
||||||
<hints>
|
|
||||||
<hint type="sourcelabel">
|
|
||||||
<x>248</x>
|
|
||||||
<y>254</y>
|
|
||||||
</hint>
|
|
||||||
<hint type="destinationlabel">
|
|
||||||
<x>157</x>
|
|
||||||
<y>274</y>
|
|
||||||
</hint>
|
|
||||||
</hints>
|
|
||||||
</connection>
|
|
||||||
<connection>
|
<connection>
|
||||||
<sender>buttonBox</sender>
|
<sender>buttonBox</sender>
|
||||||
<signal>rejected()</signal>
|
<signal>rejected()</signal>
|
||||||
|
|
@ -153,5 +133,53 @@
|
||||||
</hint>
|
</hint>
|
||||||
</hints>
|
</hints>
|
||||||
</connection>
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>buttonBox</sender>
|
||||||
|
<signal>accepted()</signal>
|
||||||
|
<receiver>MoveOptionsDialog</receiver>
|
||||||
|
<slot>accept()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>119</x>
|
||||||
|
<y>146</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>119</x>
|
||||||
|
<y>83</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>disp_x_le</sender>
|
||||||
|
<signal>returnPressed()</signal>
|
||||||
|
<receiver>MoveOptionsDialog</receiver>
|
||||||
|
<slot>accept()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>119</x>
|
||||||
|
<y>53</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>119</x>
|
||||||
|
<y>83</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>disp_y_le</sender>
|
||||||
|
<signal>returnPressed()</signal>
|
||||||
|
<receiver>MoveOptionsDialog</receiver>
|
||||||
|
<slot>accept()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>119</x>
|
||||||
|
<y>84</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>119</x>
|
||||||
|
<y>83</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
</connections>
|
</connections>
|
||||||
</ui>
|
</ui>
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>396</width>
|
<width>396</width>
|
||||||
<height>345</height>
|
<height>357</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
|
@ -354,6 +354,13 @@
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
|
<property name="standardButtons">
|
||||||
|
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QFrame" name="frame">
|
<widget class="QFrame" name="frame">
|
||||||
<property name="frameShape">
|
<property name="frameShape">
|
||||||
|
|
@ -369,44 +376,14 @@
|
||||||
<property name="margin" stdset="0">
|
<property name="margin" stdset="0">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
|
||||||
<spacer>
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>209</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="pushButton">
|
|
||||||
<property name="text">
|
|
||||||
<string>Ok</string>
|
|
||||||
</property>
|
|
||||||
<property name="default">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="pushButton_2">
|
|
||||||
<property name="text">
|
|
||||||
<string>Cancel</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<tabstops>
|
<tabstops>
|
||||||
<tabstop>pushButton</tabstop>
|
<tabstop>x_le</tabstop>
|
||||||
<tabstop>pushButton_2</tabstop>
|
<tabstop>y_le</tabstop>
|
||||||
<tabstop>lt</tabstop>
|
<tabstop>lt</tabstop>
|
||||||
<tabstop>ct</tabstop>
|
<tabstop>ct</tabstop>
|
||||||
<tabstop>rt</tabstop>
|
<tabstop>rt</tabstop>
|
||||||
|
|
@ -422,34 +399,34 @@
|
||||||
</resources>
|
</resources>
|
||||||
<connections>
|
<connections>
|
||||||
<connection>
|
<connection>
|
||||||
<sender>pushButton</sender>
|
<sender>buttonBox</sender>
|
||||||
<signal>clicked()</signal>
|
<signal>accepted()</signal>
|
||||||
<receiver>MoveToOptionsDialog</receiver>
|
<receiver>MoveToOptionsDialog</receiver>
|
||||||
<slot>accept()</slot>
|
<slot>accept()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>237</x>
|
<x>197</x>
|
||||||
<y>203</y>
|
<y>323</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>147</x>
|
<x>197</x>
|
||||||
<y>81</y>
|
<y>175</y>
|
||||||
</hint>
|
</hint>
|
||||||
</hints>
|
</hints>
|
||||||
</connection>
|
</connection>
|
||||||
<connection>
|
<connection>
|
||||||
<sender>pushButton_2</sender>
|
<sender>buttonBox</sender>
|
||||||
<signal>clicked()</signal>
|
<signal>rejected()</signal>
|
||||||
<receiver>MoveToOptionsDialog</receiver>
|
<receiver>MoveToOptionsDialog</receiver>
|
||||||
<slot>reject()</slot>
|
<slot>reject()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>325</x>
|
<x>197</x>
|
||||||
<y>202</y>
|
<y>323</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>325</x>
|
<x>197</x>
|
||||||
<y>57</y>
|
<y>175</y>
|
||||||
</hint>
|
</hint>
|
||||||
</hints>
|
</hints>
|
||||||
</connection>
|
</connection>
|
||||||
|
|
|
||||||
|
|
@ -1577,12 +1577,21 @@ LayoutView::message (const std::string &s, int timeout)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
LayoutView::set_focus ()
|
||||||
|
{
|
||||||
|
if (canvas () && canvas ()->widget ()) {
|
||||||
|
canvas ()->widget ()->setFocus (Qt::TabFocusReason);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
LayoutView::mode (int m)
|
LayoutView::mode (int m)
|
||||||
{
|
{
|
||||||
if (mode () != m) {
|
if (mode () != m) {
|
||||||
LayoutViewBase::mode (m);
|
LayoutViewBase::mode (m);
|
||||||
activate_editor_option_pages ();
|
activate_editor_option_pages ();
|
||||||
|
set_focus ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1599,10 +1608,12 @@ void
|
||||||
LayoutView::switch_mode (int m)
|
LayoutView::switch_mode (int m)
|
||||||
{
|
{
|
||||||
if (mode () != m) {
|
if (mode () != m) {
|
||||||
mode (m);
|
LayoutViewBase::mode (m);
|
||||||
|
activate_editor_option_pages ();
|
||||||
if (mp_widget) {
|
if (mp_widget) {
|
||||||
mp_widget->emit_mode_change (m);
|
mp_widget->emit_mode_change (m);
|
||||||
}
|
}
|
||||||
|
set_focus ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -183,6 +183,11 @@ public:
|
||||||
*/
|
*/
|
||||||
void message (const std::string &s = "", int timeout = 10);
|
void message (const std::string &s = "", int timeout = 10);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Sets the keyboard focus to the view
|
||||||
|
*/
|
||||||
|
virtual void set_focus ();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Select a certain mode (by index)
|
* @brief Select a certain mode (by index)
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue