mirror of https://github.com/KLayout/klayout.git
Some refactoring, bug fix
This commit is contained in:
parent
20a3dbeaf8
commit
e2b5c29131
|
|
@ -646,12 +646,12 @@ PluginImpl::tracking_position () const
|
|||
}
|
||||
}
|
||||
|
||||
int PluginImpl::focus_page_open(lay::EditorOptionsPage *fp)
|
||||
int PluginImpl::focus_page_open ()
|
||||
{
|
||||
if (f_focus_page_open.can_issue ()) {
|
||||
return f_focus_page_open.issue<lay::EditorServiceBase, int, lay::EditorOptionsPage *> (&lay::EditorServiceBase::focus_page_open, fp);
|
||||
return f_focus_page_open.issue<lay::EditorServiceBase, int> (&lay::EditorServiceBase::focus_page_open);
|
||||
} else {
|
||||
return lay::EditorServiceBase::focus_page_open (fp);
|
||||
return lay::EditorServiceBase::focus_page_open ();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -987,9 +987,10 @@ Class<gsi::PluginImpl> decl_Plugin (decl_PluginBase, "lay", "Plugin",
|
|||
"\n"
|
||||
"This method has been added in version 0.30.4."
|
||||
) +
|
||||
callback ("focus_page_open", &gsi::PluginImpl::focus_page_open, &gsi::PluginImpl::f_focus_page_open, gsi::arg ("focus_page"),
|
||||
callback ("focus_page_open", &gsi::PluginImpl::focus_page_open, &gsi::PluginImpl::f_focus_page_open,
|
||||
"@brief Gets called when the focus page wants to be opened - i.e. if 'Tab' is pressed during editing\n"
|
||||
"The default implementation calls \\EditorOptionsPage#show. This method can be overloaded to provide certain actions before "
|
||||
"The default implementation calls \\EditorOptionsPage#show on the focus page.\n"
|
||||
"This method can be overloaded to provide certain actions before "
|
||||
"or after the page is shown, specifically if the page is a modal one. For example, it can update the page with current "
|
||||
"dimensions of a shape that is created and after committing the page, adjust the shape accordingly.\n"
|
||||
"\n"
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ public:
|
|||
db::DPoint tracking_position_test () const;
|
||||
virtual db::DPoint tracking_position () const;
|
||||
|
||||
virtual int focus_page_open (lay::EditorOptionsPage *fp);
|
||||
virtual int focus_page_open ();
|
||||
|
||||
virtual lay::ViewService *view_service_interface ()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -291,8 +291,8 @@ class DragBoxPlugin < RBA::Plugin
|
|||
end
|
||||
|
||||
# overloaded callback: the focus page is requested
|
||||
def focus_page_open(fp)
|
||||
|
||||
def focus_page_open
|
||||
|
||||
# stop unless dragging
|
||||
if !@marker
|
||||
return
|
||||
|
|
@ -301,6 +301,7 @@ class DragBoxPlugin < RBA::Plugin
|
|||
# configure the focus page and show it:
|
||||
# the page will call the handler of "update_box" to commit
|
||||
# changes to the box
|
||||
fp = self.focus_page
|
||||
fp.box = @box
|
||||
fp.pfix = @start_point
|
||||
fp.update_box = lambda { |box| self._update_box(box) }
|
||||
|
|
@ -310,7 +311,9 @@ class DragBoxPlugin < RBA::Plugin
|
|||
# accepted: stop dragging now, we are done.
|
||||
self._finish
|
||||
end
|
||||
|
||||
return ret
|
||||
|
||||
end
|
||||
|
||||
# overloaded callback:
|
||||
|
|
|
|||
|
|
@ -307,7 +307,7 @@ class DragBoxPlugin(pya.Plugin):
|
|||
self.box = box
|
||||
self._update_marker()
|
||||
|
||||
def focus_page_open(self, fp):
|
||||
def focus_page_open(self):
|
||||
|
||||
"""
|
||||
overloaded callback: the focus page is requested
|
||||
|
|
@ -320,6 +320,7 @@ class DragBoxPlugin(pya.Plugin):
|
|||
# configure the focus page and show it:
|
||||
# the page will call the handler of "update_box" to commit
|
||||
# changes to the box
|
||||
fp = self.focus_page()
|
||||
fp.box = self.box
|
||||
fp.pfix = self.start_point
|
||||
fp.update_box = self._update_box
|
||||
|
|
@ -328,6 +329,7 @@ class DragBoxPlugin(pya.Plugin):
|
|||
if ret == 1:
|
||||
# accepted: stop dragging now, we are done.
|
||||
self._finish()
|
||||
|
||||
return ret
|
||||
|
||||
def activated(self):
|
||||
|
|
|
|||
|
|
@ -379,7 +379,7 @@ bool
|
|||
EditorServiceBase::key_event (unsigned int key, unsigned int buttons)
|
||||
{
|
||||
if (is_active () && key == Qt::Key_Tab && buttons == 0) {
|
||||
focus_page_open (focus_page ());
|
||||
focus_page_open ();
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
|
@ -387,8 +387,9 @@ EditorServiceBase::key_event (unsigned int key, unsigned int buttons)
|
|||
}
|
||||
|
||||
int
|
||||
EditorServiceBase::focus_page_open (EditorOptionsPage *fp)
|
||||
EditorServiceBase::focus_page_open ()
|
||||
{
|
||||
auto fp = focus_page ();
|
||||
return fp ? fp->show () : 0;
|
||||
}
|
||||
|
||||
|
|
@ -414,7 +415,7 @@ EditorServiceBase::show_error (tl::Exception &ex)
|
|||
}
|
||||
|
||||
void
|
||||
EditorServiceBase::focus_page_enter ()
|
||||
EditorServiceBase::focus_page_open ()
|
||||
{
|
||||
// .. nothing yet ..
|
||||
}
|
||||
|
|
|
|||
|
|
@ -265,6 +265,13 @@ public:
|
|||
// The default implementation does nothing
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Gets called when the focus page opens
|
||||
*
|
||||
* The default implementation will call fp->show() and return its return value.
|
||||
*/
|
||||
virtual int focus_page_open ();
|
||||
|
||||
#if defined(HAVE_QT)
|
||||
/**
|
||||
* @brief Gets the editor options pages associated with this plugin
|
||||
|
|
@ -275,13 +282,6 @@ public:
|
|||
* @brief Gets the focus page or 0 if there is none
|
||||
*/
|
||||
lay::EditorOptionsPage *focus_page ();
|
||||
|
||||
/**
|
||||
* @brief Gets called when the focus page opens
|
||||
*
|
||||
* The default implementation will call fp->show() and return its return value.
|
||||
*/
|
||||
virtual int focus_page_open (EditorOptionsPage *fp);
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ MoveService::key_event (unsigned int key, unsigned int buttons)
|
|||
}
|
||||
|
||||
int
|
||||
MoveService::focus_page_open (EditorOptionsPage * /*fp*/)
|
||||
MoveService::focus_page_open ()
|
||||
{
|
||||
// This method is called on "Tab" by "key_event". "fp" is null as we don't have a focus page registered.
|
||||
if (is_active () && dispatcher ()) {
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ private:
|
|||
virtual bool key_event (unsigned int key, unsigned int buttons);
|
||||
virtual void drag_cancel ();
|
||||
virtual void deactivated ();
|
||||
int focus_page_open (EditorOptionsPage *fp);
|
||||
int focus_page_open ();
|
||||
|
||||
bool handle_click (const db::DPoint &p, unsigned int buttons, bool drag_transient, db::Transaction *transaction);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue