27 #include <QApplication>
30 #include <QInputDialog>
32 #include <QMouseEvent>
33 #include <QWheelEvent>
79 static QCursor origCursor = w->cursor ();
85 w->setCursor (Qt::OpenHandCursor);
89 w->setCursor (QPixmap (
":/images/zoom-in.png"));
93 w->setCursor (QPixmap (
":/images/zoom-out.png"));
97 w->setCursor (origCursor);
113 gl2ps_print (figObj, file_cmd.toStdString (), term.toStdString ());
134 for (
int i = 0; i < num_children; i++)
138 if (childObj.
isa (
"axes"))
151 cp(0,0) = p1(0); cp(0,1) = p1(1); cp(0,2) = p1(2);
152 cp(1,0) = p2(0); cp(1,1) = p2(1); cp(1,2) = p2(2);
172 for (
int i = 0; i < num_children; i++)
176 if (childObj.
isa (
"axes"))
181 QPoint p = w->mapFromGlobal (QCursor::pos ());
191 cp(0,0) = p1(0); cp(0,1) = p1(1); cp(0,2) = p1(2);
192 cp(1,0) = p2(0); cp(1,1) = p2(1); cp(1,2) = p2(2);
203 Ffeval (
ovl (
"annotation").append (args));
331 = Utils::properties<figure> (figObj).get___pan_mode__ ();
343 = Utils::properties<figure> (figObj).get___pan_mode__ ();
355 = Utils::properties<figure> (figObj).get___rotate_mode__ ();
367 = Utils::properties<figure> (figObj).get___zoom_mode__ ();
379 = Utils::properties<figure> (figObj).get___zoom_mode__ ();
391 = Utils::properties<figure> (figObj).get___zoom_mode__ ();
433 std::string mode =
pan_mode (figObj);
463 "windowbuttonmotionfcn");
480 switch (event->button ())
490 case Qt::RightButton:
507 bool isdblclick = (
event->type () == QEvent::MouseButtonDblClick);
518 for (
int i = 0; i < num_children; i++)
522 if (childObj.
isa (
"axes"))
523 axesList.append (childObj);
524 else if (childObj.
isa (
"uicontrol") || childObj.
isa (
"uipanel"))
527 QRectF r (bb(0), bb(1), bb(2), bb(3));
529 r.adjust (-5, -5, 5, 5);
530 if (r.contains (event->posF ()))
532 currentObj = childObj;
541 it != axesList.end (); ++it)
552 else if (it->get_properties ().is_hittest ())
554 Matrix bb = it->get_properties ().get_boundingbox (
true);
555 QRectF r (bb(0), bb(1), bb(2), bb(3));
557 if (r.contains (event->posF ()))
561 if (axesObj && currentObj)
567 if (axesObj.get_properties ().handlevisibility_is (
"on"))
568 Utils::properties<figure> (figObj)
569 .set_currentaxes (axesObj.get_handle ().as_octave_value ());
571 currentObj = axesObj;
578 if (currentObj.get_properties ().handlevisibility_is (
"on"))
579 Utils::properties<figure> (figObj)
580 .set_currentobject (currentObj.get_handle ().as_octave_value ());
582 Utils::properties<figure> (figObj).set_currentobject (
octave_NaN);
591 switch (newMouseMode)
600 "windowbuttondownfcn",
607 if (event->button () == Qt::RightButton)
609 event->globalPos ());
614 if (event->modifiers () == Qt::NoModifier)
616 switch (event->buttons ())
633 if (axesObj && axesObj.get_properties ().handlevisibility_is (
"on"))
635 bool redraw_figure =
true;
639 if (event->button () == Qt::LeftButton)
647 redraw_figure =
false;
650 else if (event->modifiers () == Qt::NoModifier)
652 switch (event->buttons ())
661 case Qt::RightButton:
675 Utils::properties<axes> (axesObj);
682 redraw_figure =
false;
686 else if (event->modifiers () == Qt::ShiftModifier)
688 switch (event->buttons ())
701 redraw_figure =
false;
760 ap.
zoom (zm, xl, yl);
777 "windowbuttonupfcn");
801 if (anno_dlg.exec () == QDialog::Accepted)
831 for (
int i = 0; i < num_children; i++)
835 if (childObj.
isa (
"axes"))
860 Utils::properties<figure> (figObj)
865 if (event->delta () > 0)
880 bool redrawFigure =
true;
882 switch (newMouseMode)
894 ? 1 / (1.0 - wheel_zoom_speed)
895 : 1.0 - wheel_zoom_speed);
899 ap.
zoom (mode, factor);
907 double factor =
event->delta () > 0 ? 0.1 : -0.1;
909 ap.
pan (mode, factor);
914 redrawFigure =
false;
942 eventData.
getfield (
"Character"),
false);
970 return new GLCanvas (parent, handle);
graphics_handle m_mouseAxes
virtual QWidget * qWidget(void)=0
static std::string zoom_direction(const graphics_object figObj)
void rotate3d(double x0, double x1, double y0, double y1, bool push_to_zoom_stack=true)
void set_ylimmode(const octave_value &val)
bool handlevisibility_is(const std::string &v) const
static void post_callback(const graphics_handle &h, const std::string &name, const octave_value &data=Matrix())
bool is_visible(void) const
static uint32_t state[624]
bool isa(const std::string &go_name) const
octave_idx_type numel(void) const
Number of elements in the array.
const octave_value & contents(const_iterator p) const
void updateCurrentPoint(const graphics_object &fig, const graphics_object &obj, QMouseEvent *event)
void zoom(const std::string &mode, double factor, bool push_to_zoom_stack=true)
void set_visible(const octave_value &val)
virtual Matrix get_boundingbox(bool=false, const Matrix &=Matrix()) const
void translate_view(const std::string &mode, double x0, double x1, double y0, double y1, bool push_to_zoom_stack=true)
static bool rotate_enabled(const graphics_object figObj)
void print(const QString &file_cmd, const QString &term)
void set_zgrid(const octave_value &val)
Matrix figureCurrentPoint(const graphics_object &fig, QMouseEvent *event)
void redraw(bool sync=false)
void canvasToggleGrid(const graphics_handle &handle)
octave_value get(bool all=false) const
virtual void drawZoomBox(const QPoint &p1, const QPoint &p2)=0
static void autoscale_axes(axes::properties &ap)
void canvasMouseDoubleClickEvent(QMouseEvent *event)
graphics_xform get_transform(void) const
void gl2ps_print(const graphics_object &fig, const std::string &cmd, const std::string &term)
std::string get_zgrid(void) const
void canvasToggleAxes(const graphics_handle &handle)
static void executeAt(const base_properties &props, const QPoint &pt)
void pan(const std::string &mode, double factor, bool push_to_zoom_stack=true)
void canvasMousePressEvent(QMouseEvent *event)
void canvasWheelEvent(QWheelEvent *event)
bool canvasKeyPressEvent(QKeyEvent *event)
Matrix get_children(void) const
void canvasMouseMoveEvent(QMouseEvent *event)
std::string string_value(bool force=false) const
octave_scalar_map makeKeyEventStruct(QKeyEvent *event)
static bool zoom_enabled(const graphics_object figObj)
double get_mousewheelzoom(void) const
void canvasAutoAxes(const graphics_handle &handle)
std::complex< double > w(std::complex< double > z, double relerr=0)
std::string get_ygrid(void) const
static void post_event(T *obj, void(T::*method)(void))
base_properties & get_properties(void)
void zoom_about_point(const std::string &mode, double x, double y, double factor, bool push_to_zoom_stack=true)
graphics_object get_ancestor(const std::string &type) const
Matrix matrix_value(bool frc_str_conv=false) const
std::string get_xgrid(void) const
void canvasPaintEvent(void)
void set_xgrid(const octave_value &val)
void canvasMouseReleaseEvent(QMouseEvent *event)
bool valid_object(void) const
charNDArray max(char d, const charNDArray &m)
static Object * toolkitObject(const graphics_object &go)
std::string figureSelectionType(QMouseEvent *event, bool isDoubleClick)
bool canvasKeyReleaseEvent(QKeyEvent *event)
octave_value_list ovl(const octave_value &a0)
ColumnVector pixel2coord(double px, double py) const
virtual void draw(const graphics_handle &handle)=0
octave_scalar_map scalar_map_value(void) const
void setCursor(MouseMode mode)
void set_xlimmode(const octave_value &val)
void set_zlimmode(const octave_value &val)
octave_handle graphics_handle
static bool pan_enabled(const graphics_object figObj)
Matrix get_all_children(void) const
virtual graphics_object selectFromAxes(const graphics_object &ax, const QPoint &pt)=0
void clear_zoom_stack(bool do_unzoom=true)
static Canvas * create(const std::string &name, QWidget *parent, const graphics_handle &handle)
static graphics_object get_object(double val)
octave_value_list get_properties() const
void annotation_callback(const octave_value_list &args)
static std::string pan_mode(const graphics_object figObj)
octave_value getfield(const std::string &key) const
OCTINTERP_API octave_value_list Ffeval(const octave_value_list &=octave_value_list(), int=0)
graphics_handle get_handle(void) const
void set_ygrid(const octave_value &val)
static double button_number(QMouseEvent *event)
Matrix get_transform_zlim(void) const
octave_value as_octave_value(void) const
static std::string zoom_mode(const graphics_object figObj)
void blockRedraw(bool block=true)
static void post_set(const graphics_handle &h, const std::string &name, const octave_value &value, bool notify_toolkit=true)
charNDArray min(char d, const charNDArray &m)