mirror of https://github.com/KLayout/klayout.git
WIP
This commit is contained in:
parent
ee622fc104
commit
c2aa597022
|
|
@ -1681,6 +1681,13 @@ Service::show_message ()
|
||||||
view ()->message (pos);
|
view ()->message (pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Service::end_move (const db::DVector &v)
|
||||||
|
{
|
||||||
|
m_trans = db::DTrans (v) * db::DTrans (m_trans.fp_trans ());
|
||||||
|
end_move (db::DPoint (), lay::AC_Any);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Service::end_move (const db::DPoint &, lay::angle_constraint_type)
|
Service::end_move (const db::DPoint &, lay::angle_constraint_type)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -347,6 +347,11 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual void end_move (const db::DPoint &p, lay::angle_constraint_type ac);
|
virtual void end_move (const db::DPoint &p, lay::angle_constraint_type ac);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Terminate a "move" operation with compulsory move vector
|
||||||
|
*/
|
||||||
|
virtual void end_move (const db::DVector &v);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Return the bbox of the selection (reimplementation of lay::Editable interface)
|
* @brief Return the bbox of the selection (reimplementation of lay::Editable interface)
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -133,6 +133,13 @@ MoveTrackerService::end_move (const db::DPoint & /*p*/, lay::angle_constraint_ty
|
||||||
move_cancel (); // formally this functionality fits here
|
move_cancel (); // formally this functionality fits here
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
MoveTrackerService::end_move (const db::DVector & /*v*/)
|
||||||
|
{
|
||||||
|
call_editor_hooks (m_editor_hooks, &edt::EditorHooks::commit_edit);
|
||||||
|
move_cancel (); // formally this functionality fits here
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
MoveTrackerService::edit_cancel ()
|
MoveTrackerService::edit_cancel ()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -68,6 +68,11 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual void end_move (const db::DPoint &p, lay::angle_constraint_type ac);
|
virtual void end_move (const db::DPoint &p, lay::angle_constraint_type ac);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Terminate a "move" operation with compulsory move vector
|
||||||
|
*/
|
||||||
|
virtual void end_move (const db::DVector &v);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Access to the view object
|
* @brief Access to the view object
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -2489,14 +2489,19 @@ PartialService::move (const db::DPoint &p, lay::angle_constraint_type ac)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
PartialService::end_move (const db::DPoint & /*p*/, lay::angle_constraint_type ac)
|
PartialService::end_move (const db::DVector &v)
|
||||||
|
{
|
||||||
|
m_current = m_start + v;
|
||||||
|
end_move (db::DPoint (), lay::AC_Any);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
PartialService::end_move (const db::DPoint & /*p*/, lay::angle_constraint_type /*ac*/)
|
||||||
{
|
{
|
||||||
if (! m_dragging) {
|
if (! m_dragging) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_alt_ac = ac;
|
|
||||||
|
|
||||||
if (m_current != m_start) {
|
if (m_current != m_start) {
|
||||||
|
|
||||||
// stop dragging
|
// stop dragging
|
||||||
|
|
|
||||||
|
|
@ -287,6 +287,11 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual void end_move (const db::DPoint &p, lay::angle_constraint_type ac);
|
virtual void end_move (const db::DPoint &p, lay::angle_constraint_type ac);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Terminate a "move" operation with compulsory move vector
|
||||||
|
*/
|
||||||
|
virtual void end_move (const db::DVector &v);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Implement the "select" method at least to clear the selection
|
* @brief Implement the "select" method at least to clear the selection
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -602,15 +602,28 @@ Service::move_transform (const db::DPoint &pu, db::DFTrans tr, lay::angle_constr
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Service::end_move (const db::DPoint & /*p*/, lay::angle_constraint_type ac)
|
Service::end_move (const db::DVector &v)
|
||||||
|
{
|
||||||
|
if (view ()->is_editable () && m_moving) {
|
||||||
|
transform (db::DCplxTrans (db::DTrans (v) * db::DTrans (m_move_trans.fp_trans ())));
|
||||||
|
move_cancel (); // formally this functionality fits here
|
||||||
|
// accept changes to guiding shapes
|
||||||
|
handle_guiding_shape_changes (true);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_alt_ac = lay::AC_Global;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Service::end_move (const db::DPoint & /*p*/, lay::angle_constraint_type /*ac*/)
|
||||||
{
|
{
|
||||||
m_alt_ac = ac;
|
|
||||||
if (view ()->is_editable () && m_moving) {
|
if (view ()->is_editable () && m_moving) {
|
||||||
transform (db::DCplxTrans (m_move_trans));
|
transform (db::DCplxTrans (m_move_trans));
|
||||||
move_cancel (); // formally this functionality fits here
|
move_cancel (); // formally this functionality fits here
|
||||||
// accept changes to guiding shapes
|
// accept changes to guiding shapes
|
||||||
handle_guiding_shape_changes (true);
|
handle_guiding_shape_changes (true);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_alt_ac = lay::AC_Global;
|
m_alt_ac = lay::AC_Global;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -190,6 +190,11 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual void end_move (const db::DPoint &p, lay::angle_constraint_type ac);
|
virtual void end_move (const db::DPoint &p, lay::angle_constraint_type ac);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Terminate a "move" operation with compulsory move vector
|
||||||
|
*/
|
||||||
|
virtual void end_move (const db::DVector &v);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Indicates whether objects are selected
|
* @brief Indicates whether objects are selected
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -872,6 +872,13 @@ Service::show_message ()
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Service::end_move (const db::DVector &v)
|
||||||
|
{
|
||||||
|
m_trans = db::DTrans (v) * db::DTrans (m_trans.fp_trans ());
|
||||||
|
end_move (db::DPoint (), lay::AC_Any);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Service::end_move (const db::DPoint &, lay::angle_constraint_type)
|
Service::end_move (const db::DPoint &, lay::angle_constraint_type)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -359,6 +359,11 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual void end_move (const db::DPoint &p, lay::angle_constraint_type ac);
|
virtual void end_move (const db::DPoint &p, lay::angle_constraint_type ac);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Terminate a "move" operation with compulsory move vector
|
||||||
|
*/
|
||||||
|
virtual void end_move (const db::DVector &v);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Return the bbox of the selection (reimplementation of lay::Editable interface)
|
* @brief Return the bbox of the selection (reimplementation of lay::Editable interface)
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -621,6 +621,37 @@ Editables::move_transform (const db::DPoint &p, db::DFTrans t, lay::angle_constr
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Editables::end_move (const db::DVector &v, db::Transaction *transaction)
|
||||||
|
{
|
||||||
|
std::unique_ptr<db::Transaction> trans_holder (transaction ? transaction : new db::Transaction (manager (), tl::to_string (tr ("Move"))));
|
||||||
|
|
||||||
|
if (m_any_move_operation) {
|
||||||
|
|
||||||
|
trans_holder->open ();
|
||||||
|
|
||||||
|
// this dummy operation will update the screen:
|
||||||
|
if (manager ()) {
|
||||||
|
manager ()->queue (this, new db::Op ());
|
||||||
|
}
|
||||||
|
|
||||||
|
for (iterator e = begin (); e != end (); ++e) {
|
||||||
|
e->end_move (v);
|
||||||
|
}
|
||||||
|
|
||||||
|
// clear the selection that was set previously
|
||||||
|
if (m_move_selection) {
|
||||||
|
clear_selection ();
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
trans_holder->cancel ();
|
||||||
|
edit_cancel ();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Editables::end_move (const db::DPoint &p, lay::angle_constraint_type ac, db::Transaction *transaction)
|
Editables::end_move (const db::DPoint &p, lay::angle_constraint_type ac, db::Transaction *transaction)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -326,6 +326,16 @@ public:
|
||||||
// .. by default, nothing is implemented ..
|
// .. by default, nothing is implemented ..
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Terminate a "move" operation with compulsory shift vector
|
||||||
|
*
|
||||||
|
* @param v The move distance to be applied
|
||||||
|
*/
|
||||||
|
virtual void end_move (const db::DVector & /*v*/)
|
||||||
|
{
|
||||||
|
// .. by default, nothing is implemented ..
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Cancel any pending operations
|
* @brief Cancel any pending operations
|
||||||
*
|
*
|
||||||
|
|
@ -610,6 +620,16 @@ public:
|
||||||
*/
|
*/
|
||||||
void end_move (const db::DPoint &p, lay::angle_constraint_type ac, db::Transaction *transaction = 0);
|
void end_move (const db::DPoint &p, lay::angle_constraint_type ac, db::Transaction *transaction = 0);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief End "move" operation with given vector
|
||||||
|
*
|
||||||
|
* If a transaction is given, the operation will be appended to this pending transaction
|
||||||
|
* The Editables object takes ownership over the Transaction object.
|
||||||
|
*
|
||||||
|
* The vector is supposed to be taken "as is" and no snapping shall be applied.
|
||||||
|
*/
|
||||||
|
void end_move (const db::DVector &v, db::Transaction *transaction = 0);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Indicates how many objects are selected.
|
* @brief Indicates how many objects are selected.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -91,12 +91,28 @@ void
|
||||||
MoveService::function (const std::string &name, const std::string &value)
|
MoveService::function (const std::string &name, const std::string &value)
|
||||||
{
|
{
|
||||||
if (name == move_function_name) {
|
if (name == move_function_name) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
db::DVector s;
|
db::DVector s;
|
||||||
tl::from_string (value, s);
|
tl::from_string (value, s);
|
||||||
tl::info << "@@@ move " << s.to_string ();
|
|
||||||
|
m_dragging = false;
|
||||||
|
|
||||||
|
show_toolbox (false);
|
||||||
|
ui ()->ungrab_mouse (this);
|
||||||
|
|
||||||
|
mp_editables->end_move (s, mp_transaction.release ());
|
||||||
|
|
||||||
|
if (m_dragging_transient) {
|
||||||
|
mp_editables->clear_selection ();
|
||||||
|
}
|
||||||
|
|
||||||
|
drag_cancel ();
|
||||||
|
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -481,8 +497,6 @@ public:
|
||||||
|
|
||||||
virtual void commit (lay::Dispatcher *dispatcher)
|
virtual void commit (lay::Dispatcher *dispatcher)
|
||||||
{
|
{
|
||||||
tl::info << "@@@ Commit!";
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
double dx = 0.0, dy = 0.0;
|
double dx = 0.0, dy = 0.0;
|
||||||
|
|
@ -505,19 +519,14 @@ public:
|
||||||
db::DVector mv;
|
db::DVector mv;
|
||||||
tl::from_string (value, mv);
|
tl::from_string (value, mv);
|
||||||
|
|
||||||
mp_x_le->setText (tl::to_qstring (tl::to_string (mv.x ())));
|
mp_x_le->setText (tl::to_qstring (tl::micron_to_string (mv.x ())));
|
||||||
mp_y_le->setText (tl::to_qstring (tl::to_string (mv.y ())));
|
mp_y_le->setText (tl::to_qstring (tl::micron_to_string (mv.y ())));
|
||||||
|
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void cancel ()
|
|
||||||
{
|
|
||||||
tl::info << "@@@ Escape!";
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QHBoxLayout *mp_layout;
|
QHBoxLayout *mp_layout;
|
||||||
QLineEdit *mp_x_le, *mp_y_le;
|
QLineEdit *mp_x_le, *mp_y_le;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue