mirror of
https://github.com/KLayout/klayout.git
synced 2026-09-07 11:31:08 +02:00
WIP: adding tab key to move tool (calls 'move by' menu), enhancing 'move_to' and 'move_by' dialogs.
This commit is contained in:
@@ -98,9 +98,7 @@ BEGIN_PROTECTED
|
||||
// The Return key on a non-modal page commits the values and gives back the focus
|
||||
// to the view
|
||||
apply (dispatcher ());
|
||||
if (view ()->canvas ()->widget ()) {
|
||||
view ()->canvas ()->widget ()->setFocus (Qt::TabFocusReason);
|
||||
}
|
||||
view ()->set_focus ();
|
||||
event->accept ();
|
||||
} else {
|
||||
QWidget::keyPressEvent (event);
|
||||
|
||||
@@ -691,6 +691,12 @@ LayoutViewBase::message (const std::string & /*s*/, int /*timeout*/)
|
||||
// .. nothing yet ..
|
||||
}
|
||||
|
||||
void
|
||||
LayoutViewBase::set_focus ()
|
||||
{
|
||||
// .. nothing yet ..
|
||||
}
|
||||
|
||||
bool
|
||||
LayoutViewBase::is_dirty () const
|
||||
{
|
||||
|
||||
@@ -295,6 +295,11 @@ public:
|
||||
*/
|
||||
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
|
||||
*
|
||||
|
||||
@@ -39,6 +39,7 @@ MoveService::MoveService (lay::LayoutViewBase *view)
|
||||
lay::Plugin (view),
|
||||
m_dragging (false),
|
||||
m_dragging_transient (false),
|
||||
m_active (false),
|
||||
mp_editables (view),
|
||||
mp_view (view),
|
||||
m_global_grid (0.001)
|
||||
@@ -51,10 +52,17 @@ MoveService::~MoveService ()
|
||||
drag_cancel ();
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
MoveService::activated ()
|
||||
{
|
||||
m_active = true;
|
||||
}
|
||||
|
||||
void
|
||||
MoveService::deactivated ()
|
||||
{
|
||||
m_shift = db::DPoint ();
|
||||
m_active = false;
|
||||
mp_view->clear_transient_selection ();
|
||||
drag_cancel ();
|
||||
}
|
||||
@@ -87,8 +95,15 @@ MoveService::configure (const std::string &name, const std::string &value)
|
||||
}
|
||||
|
||||
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;
|
||||
if (int (key) == lay::KeyDown) {
|
||||
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 key_event (unsigned int key, unsigned int buttons);
|
||||
virtual void drag_cancel ();
|
||||
virtual void activated ();
|
||||
virtual void deactivated ();
|
||||
|
||||
bool handle_click (const db::DPoint &p, unsigned int buttons, bool drag_transient, db::Transaction *transaction);
|
||||
|
||||
bool m_dragging;
|
||||
bool m_dragging_transient;
|
||||
bool m_active;
|
||||
lay::Editables *mp_editables;
|
||||
lay::LayoutViewBase *mp_view;
|
||||
double m_global_grid;
|
||||
|
||||
Reference in New Issue
Block a user