'goto position' now shows a single-cross ruler on the target place.

This commit is contained in:
Matthias Koefferlein 2017-07-02 19:21:04 +02:00
parent d83c420c0a
commit b6b604ff93
1 changed files with 38 additions and 2 deletions

View File

@ -92,6 +92,8 @@
#include "layLayoutPropertiesForm.h"
#include "layLayoutStatisticsForm.h"
#include "layMacroController.h"
#include "antObject.h"
#include "antService.h"
#include "ui_HelpAboutDialog.h"
#include "gsi.h"
#include "gsiInterpreter.h"
@ -2355,12 +2357,46 @@ MainWindow::cm_goto_position ()
std::string tt (tl::to_string (text));
tl::Extractor ex (tt.c_str ());
ex >> x >> "," >> y;
db::DPoint pt (x, y);
if (! ex.at_end ()) {
ex >> "," >> s >> tl::Extractor::end ();
current_view ()->goto_window (db::DPoint (x, y), s);
current_view ()->goto_window (pt, s);
} else {
current_view ()->goto_window (db::DPoint (x, y));
current_view ()->goto_window (pt);
}
std::string goto_marker_cat = "_goto_marker";
ant::Service *ant_service = current_view ()->get_plugin<ant::Service> ();
if (ant_service) {
// Produce a "goto marker" at the target position
ant::AnnotationIterator a = ant_service->begin_annotations ();
while (! a.at_end ()) {
if (a->category () == goto_marker_cat) {
ant_service->delete_ruler (a.current ());
}
++a;
}
ant::Object marker;
marker.p1 (pt);
marker.p2 (pt);
marker.fmt_x ("");
marker.fmt_y ("");
marker.fmt ("$U,$V");
marker.angle_constraint (lay::AC_Any);
marker.style (ant::Object::STY_cross_both);
marker.outline (ant::Object::OL_diag);
marker.set_category (goto_marker_cat);
ant_service->insert_ruler (marker, false);
}
break;
}