mirror of https://github.com/KLayout/klayout.git
WIP
This commit is contained in:
parent
8add404adc
commit
15a5f7f7c2
|
|
@ -2027,8 +2027,6 @@ PartialService::mouse_click_event (const db::DPoint &p, unsigned int buttons, bo
|
||||||
manager ()->transaction (tl::to_string (tr ("Partial move")));
|
manager ()->transaction (tl::to_string (tr ("Partial move")));
|
||||||
}
|
}
|
||||||
|
|
||||||
// heuristically, if there is just one edge selected: do not confine to the movement
|
|
||||||
// angle constraint - the edge usually is confined enough
|
|
||||||
db::DTrans move_trans = db::DTrans (m_current - m_start);
|
db::DTrans move_trans = db::DTrans (m_current - m_start);
|
||||||
|
|
||||||
transform_selection (move_trans);
|
transform_selection (move_trans);
|
||||||
|
|
@ -2506,8 +2504,6 @@ PartialService::end_move (const db::DPoint & /*p*/, lay::angle_constraint_type a
|
||||||
manager ()->transaction (tl::to_string (tr ("Partial move")));
|
manager ()->transaction (tl::to_string (tr ("Partial move")));
|
||||||
}
|
}
|
||||||
|
|
||||||
// heuristically, if there is just one edge selected: do not confine to the movement
|
|
||||||
// angle constraint - the edge usually is confined enough
|
|
||||||
db::DTrans move_trans = db::DTrans (m_current - m_start);
|
db::DTrans move_trans = db::DTrans (m_current - m_start);
|
||||||
|
|
||||||
transform_selection (move_trans);
|
transform_selection (move_trans);
|
||||||
|
|
|
||||||
|
|
@ -77,6 +77,10 @@ Class<lay::EditorOptionsPage> decl_EditorOptionsPageBase (QT_EXTERNAL_BASE (QWid
|
||||||
method ("cancel", &lay::EditorOptionsPage::cancel,
|
method ("cancel", &lay::EditorOptionsPage::cancel,
|
||||||
"@brief Gets called when the Escape key is pressed on a non-modal page\n"
|
"@brief Gets called when the Escape key is pressed on a non-modal page\n"
|
||||||
"This method has been introduced in version 0.30.6."
|
"This method has been introduced in version 0.30.6."
|
||||||
|
) +
|
||||||
|
method ("commit", &lay::EditorOptionsPage::commit,
|
||||||
|
"@brief Gets called when the Enter key is pressed on a non-modal page\n"
|
||||||
|
"This method has been introduced in version 0.30.6."
|
||||||
),
|
),
|
||||||
"@brief The plugin framework's editor options page base class\n"
|
"@brief The plugin framework's editor options page base class\n"
|
||||||
"\n"
|
"\n"
|
||||||
|
|
@ -168,6 +172,22 @@ EditorOptionsPageImpl::cancel ()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
EditorOptionsPageImpl::commit_impl (lay::Dispatcher *root)
|
||||||
|
{
|
||||||
|
lay::EditorOptionsPage::commit (root);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
EditorOptionsPageImpl::commit (lay::Dispatcher *root)
|
||||||
|
{
|
||||||
|
if (f_commit.can_issue ()) {
|
||||||
|
f_commit.issue<EditorOptionsPageImpl, lay::Dispatcher *> (&EditorOptionsPageImpl::commit_impl, root);
|
||||||
|
} else {
|
||||||
|
EditorOptionsPageImpl::commit_impl (root);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
EditorOptionsPageImpl *new_editor_options_page (const std::string &title, int index)
|
EditorOptionsPageImpl *new_editor_options_page (const std::string &title, int index)
|
||||||
{
|
{
|
||||||
return new EditorOptionsPageImpl (title, index);
|
return new EditorOptionsPageImpl (title, index);
|
||||||
|
|
@ -204,6 +224,12 @@ Class<EditorOptionsPageImpl> decl_EditorOptionsPage (decl_EditorOptionsPageBase,
|
||||||
callback ("cancel", &EditorOptionsPageImpl::cancel, &EditorOptionsPageImpl::f_cancel,
|
callback ("cancel", &EditorOptionsPageImpl::cancel, &EditorOptionsPageImpl::f_cancel,
|
||||||
"@brief Reimplement this method to receive Escape key events for the page\n"
|
"@brief Reimplement this method to receive Escape key events for the page\n"
|
||||||
"This method has been added in version 0.30.6.\n"
|
"This method has been added in version 0.30.6.\n"
|
||||||
|
) +
|
||||||
|
// prevents infinite recursion
|
||||||
|
method_ext ("commit", &commit_fb, gsi::arg ("dispatcher"), "@hide") +
|
||||||
|
callback ("commit", &EditorOptionsPageImpl::commit, &EditorOptionsPageImpl::f_commit, gsi::arg ("dispatcher"),
|
||||||
|
"@brief Reimplement this method to receive Enter key events for the page\n"
|
||||||
|
"This method has been added in version 0.30.6.\n"
|
||||||
),
|
),
|
||||||
"@brief The plugin framework's editor options page\n"
|
"@brief The plugin framework's editor options page\n"
|
||||||
"\n"
|
"\n"
|
||||||
|
|
|
||||||
|
|
@ -53,11 +53,13 @@ public:
|
||||||
void call_edited ();
|
void call_edited ();
|
||||||
virtual void apply (lay::Dispatcher *root);
|
virtual void apply (lay::Dispatcher *root);
|
||||||
virtual void setup (lay::Dispatcher *root);
|
virtual void setup (lay::Dispatcher *root);
|
||||||
virtual void cancel ();
|
virtual void cancel (lay::Dispatcher *root);
|
||||||
|
virtual void commit ();
|
||||||
|
|
||||||
gsi::Callback f_apply;
|
gsi::Callback f_apply;
|
||||||
gsi::Callback f_setup;
|
gsi::Callback f_setup;
|
||||||
gsi::Callback f_cancel;
|
gsi::Callback f_cancel;
|
||||||
|
gsi::Callback f_commit;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
tl::weak_ptr<lay::LayoutViewBase> mp_view;
|
tl::weak_ptr<lay::LayoutViewBase> mp_view;
|
||||||
|
|
@ -67,7 +69,8 @@ private:
|
||||||
|
|
||||||
void apply_impl (lay::Dispatcher *root);
|
void apply_impl (lay::Dispatcher *root);
|
||||||
void setup_impl (lay::Dispatcher *root);
|
void setup_impl (lay::Dispatcher *root);
|
||||||
void cancel_impl ();
|
void cancel_impl (lay::Dispatcher *root);
|
||||||
|
void commit_impl ();
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -103,6 +103,14 @@ Dispatcher::config_finalize ()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Dispatcher::function (const std::string &symbol, const std::string &args)
|
||||||
|
{
|
||||||
|
if (mp_delegate) {
|
||||||
|
mp_delegate->function (symbol, args);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Writing and Reading of configuration
|
// Writing and Reading of configuration
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -87,6 +87,14 @@ public:
|
||||||
// .. this implementation does nothing ..
|
// .. this implementation does nothing ..
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Generic function call
|
||||||
|
*/
|
||||||
|
virtual void function (const std::string & /*symbol*/, const std::string & /*args*/)
|
||||||
|
{
|
||||||
|
// .. this implementation does nothing ..
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Receives configuration events
|
* @brief Receives configuration events
|
||||||
*/
|
*/
|
||||||
|
|
@ -250,6 +258,7 @@ protected:
|
||||||
// capture the configuration events so we can change the value of the configuration actions
|
// capture the configuration events so we can change the value of the configuration actions
|
||||||
virtual bool configure (const std::string &name, const std::string &value);
|
virtual bool configure (const std::string &name, const std::string &value);
|
||||||
virtual void config_finalize ();
|
virtual void config_finalize ();
|
||||||
|
virtual void function (const std::string &symbol, const std::string &args);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Dispatcher (const Dispatcher &);
|
Dispatcher (const Dispatcher &);
|
||||||
|
|
|
||||||
|
|
@ -72,6 +72,9 @@ EditorOptionsPage::show ()
|
||||||
{
|
{
|
||||||
if (! m_active) {
|
if (! m_active) {
|
||||||
return -1;
|
return -1;
|
||||||
|
} else if (m_toolbox_widget) {
|
||||||
|
set_focus ();
|
||||||
|
return -1;
|
||||||
} else if (mp_owner) {
|
} else if (mp_owner) {
|
||||||
if (! is_modal_page ()) {
|
if (! is_modal_page ()) {
|
||||||
mp_owner->make_page_current (this);
|
mp_owner->make_page_current (this);
|
||||||
|
|
@ -80,7 +83,6 @@ EditorOptionsPage::show ()
|
||||||
return mp_owner->exec_modal (this) ? 1 : 0;
|
return mp_owner->exec_modal (this) ? 1 : 0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
set_focus ();
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -123,10 +125,10 @@ EditorOptionsPage::activate (bool active)
|
||||||
{
|
{
|
||||||
if (m_active != active) {
|
if (m_active != active) {
|
||||||
m_active = active;
|
m_active = active;
|
||||||
if (mp_owner) {
|
|
||||||
mp_owner->activate_page (this);
|
|
||||||
}
|
|
||||||
if (m_active) {
|
if (m_active) {
|
||||||
|
if (mp_owner) {
|
||||||
|
mp_owner->activate_page (this);
|
||||||
|
}
|
||||||
activated ();
|
activated ();
|
||||||
} else {
|
} else {
|
||||||
deactivated ();
|
deactivated ();
|
||||||
|
|
@ -197,7 +199,7 @@ BEGIN_PROTECTED
|
||||||
} else {
|
} else {
|
||||||
// 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 ());
|
commit (dispatcher ());
|
||||||
}
|
}
|
||||||
view ()->set_focus ();
|
view ()->set_focus ();
|
||||||
event->accept ();
|
event->accept ();
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,9 @@ public:
|
||||||
virtual const char *name () const { return 0; }
|
virtual const char *name () const { return 0; }
|
||||||
virtual void apply (lay::Dispatcher * /*root*/) { }
|
virtual void apply (lay::Dispatcher * /*root*/) { }
|
||||||
virtual void cancel () { }
|
virtual void cancel () { }
|
||||||
|
virtual void commit (lay::Dispatcher * /*root*/) { }
|
||||||
virtual void setup (lay::Dispatcher * /*root*/) { }
|
virtual void setup (lay::Dispatcher * /*root*/) { }
|
||||||
|
virtual void configure (const std::string & /*name*/, const std::string & /*value*/) { }
|
||||||
virtual void commit_recent (lay::Dispatcher * /*root*/) { }
|
virtual void commit_recent (lay::Dispatcher * /*root*/) { }
|
||||||
virtual void config_recent_for_layer (lay::Dispatcher * /*root*/, const db::LayerProperties & /*lp*/, int /*cv_index*/) { }
|
virtual void config_recent_for_layer (lay::Dispatcher * /*root*/, const db::LayerProperties & /*lp*/, int /*cv_index*/) { }
|
||||||
virtual void set_focus () { }
|
virtual void set_focus () { }
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,6 @@
|
||||||
#if defined(HAVE_QT)
|
#if defined(HAVE_QT)
|
||||||
# include "layEditorOptionsPage.h"
|
# include "layEditorOptionsPage.h"
|
||||||
# include <QWidget>
|
# include <QWidget>
|
||||||
# include <QKeyEvent> // @@@
|
|
||||||
# include <QHBoxLayout>
|
# include <QHBoxLayout>
|
||||||
# include <QLineEdit>
|
# include <QLineEdit>
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -38,7 +37,9 @@
|
||||||
namespace lay
|
namespace lay
|
||||||
{
|
{
|
||||||
|
|
||||||
const char *move_editor_options_name = "move-editor-options";
|
const std::string move_editor_options_name ("move-editor-options");
|
||||||
|
const std::string move_function_name ("move-execute");
|
||||||
|
const std::string move_distance_setter_name ("move-distance");
|
||||||
|
|
||||||
// -------------------------------------------------------------
|
// -------------------------------------------------------------
|
||||||
// MoveService implementation
|
// MoveService implementation
|
||||||
|
|
@ -86,6 +87,19 @@ MoveService::configure (const std::string &name, const std::string &value)
|
||||||
return false; // not taken
|
return false; // not taken
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
MoveService::function (const std::string &name, const std::string &value)
|
||||||
|
{
|
||||||
|
if (name == move_function_name) {
|
||||||
|
try {
|
||||||
|
db::DVector s;
|
||||||
|
tl::from_string (value, s);
|
||||||
|
tl::info << "@@@ move " << s.to_string ();
|
||||||
|
} catch (...) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
MoveService::key_event (unsigned int key, unsigned int buttons)
|
MoveService::key_event (unsigned int key, unsigned int buttons)
|
||||||
{
|
{
|
||||||
|
|
@ -418,7 +432,7 @@ public:
|
||||||
|
|
||||||
virtual const char *name () const
|
virtual const char *name () const
|
||||||
{
|
{
|
||||||
return move_editor_options_name;
|
return move_editor_options_name.c_str ();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual int order () const
|
virtual int order () const
|
||||||
|
|
@ -431,9 +445,21 @@ public:
|
||||||
hide ();
|
hide ();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void apply (lay::Dispatcher * /*dispatcher*/)
|
virtual void commit (lay::Dispatcher *dispatcher)
|
||||||
{
|
{
|
||||||
tl::info << "@@@ Accept!";
|
tl::info << "@@@ Commit!";
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
double dx = 0.0, dy = 0.0;
|
||||||
|
|
||||||
|
tl::from_string (tl::to_string (mp_x_le->text ()), dx);
|
||||||
|
tl::from_string (tl::to_string (mp_y_le->text ()), dy);
|
||||||
|
|
||||||
|
dispatcher->call_function (move_function_name, db::DVector (dx, dy).to_string ());
|
||||||
|
|
||||||
|
} catch (...) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void cancel ()
|
virtual void cancel ()
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,7 @@ public:
|
||||||
bool start_move (db::Transaction *transaction = 0, bool transient_selection = false);
|
bool start_move (db::Transaction *transaction = 0, bool transient_selection = false);
|
||||||
|
|
||||||
bool configure (const std::string &name, const std::string &value);
|
bool configure (const std::string &name, const std::string &value);
|
||||||
|
void function (const std::string &name, const std::string &value);
|
||||||
void finish ();
|
void finish ();
|
||||||
void cancel ();
|
void cancel ();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -523,6 +523,15 @@ Plugin::do_config_set (const std::string &name, const std::string &value, bool f
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Plugin::call_function (const std::string &symbol, const std::string &args)
|
||||||
|
{
|
||||||
|
function (symbol, args);
|
||||||
|
for (tl::weak_collection<Plugin>::iterator c = m_children.begin (); c != m_children.end (); ++c) {
|
||||||
|
c->call_function (symbol, args);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------------------------------
|
||||||
// Menu item generators
|
// Menu item generators
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -744,6 +744,13 @@ public:
|
||||||
// .. this implementation does nothing ..
|
// .. this implementation does nothing ..
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Generic function call
|
||||||
|
*
|
||||||
|
* This method calls "function" on this plugin and all the children.
|
||||||
|
*/
|
||||||
|
virtual void call_function (const std::string &symbol, const std::string &args);
|
||||||
|
|
||||||
#if defined(HAVE_QT)
|
#if defined(HAVE_QT)
|
||||||
/**
|
/**
|
||||||
* @brief Return the lay::Browser interface if this object has one
|
* @brief Return the lay::Browser interface if this object has one
|
||||||
|
|
@ -859,6 +866,17 @@ protected:
|
||||||
// .. the default implementation does nothing ..
|
// .. the default implementation does nothing ..
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Implements a generic function call
|
||||||
|
*
|
||||||
|
* This method can be used to establish a communication between a properties page and
|
||||||
|
* a plugin for example.
|
||||||
|
*/
|
||||||
|
virtual void function (const std::string & /*symbol*/, const std::string & /*args*/)
|
||||||
|
{
|
||||||
|
// .. this implementation does nothing ..
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Plugin (const Plugin &);
|
Plugin (const Plugin &);
|
||||||
Plugin &operator= (const Plugin &);
|
Plugin &operator= (const Plugin &);
|
||||||
|
|
|
||||||
|
|
@ -49,11 +49,12 @@ namespace lay
|
||||||
* Any: no angle constraint
|
* Any: no angle constraint
|
||||||
* Diagonal: vertical, horizontal and 45 degree diagonals
|
* Diagonal: vertical, horizontal and 45 degree diagonals
|
||||||
* Ortho: vertical and horizontal
|
* Ortho: vertical and horizontal
|
||||||
|
* DiagonalOnly: 45 degree diagonals, not vertically or horizontally
|
||||||
* Horizontal: horizontal only
|
* Horizontal: horizontal only
|
||||||
* Vertical: vertical only
|
* Vertical: vertical only
|
||||||
* Global: use global setting (templates and ruler specific setting only)
|
* Global: use global setting (templates and ruler specific setting only)
|
||||||
*/
|
*/
|
||||||
enum angle_constraint_type { AC_Any = 0, AC_Diagonal, AC_DiagonalOnly, AC_Ortho, AC_Horizontal, AC_Vertical, AC_Global, AC_NumModes };
|
enum angle_constraint_type { AC_Any = 0, AC_Diagonal, AC_Ortho, AC_DiagonalOnly, AC_Horizontal, AC_Vertical, AC_Global, AC_NumModes };
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief snap a coordinate value to a unit grid
|
* @brief snap a coordinate value to a unit grid
|
||||||
|
|
|
||||||
|
|
@ -66,9 +66,7 @@ EditorOptionsPages::EditorOptionsPages (QWidget *parent, lay::LayoutViewBase *vi
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto p = m_pages.begin (); p != m_pages.end (); ++p) {
|
for (auto p = m_pages.begin (); p != m_pages.end (); ++p) {
|
||||||
if (! p->is_toolbox_widget ()) {
|
p->set_owner (this);
|
||||||
p->set_owner (this);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
update (0);
|
update (0);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue