octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: MouseMode in QtHandles


From: Michael Goffioul
Subject: Re: MouseMode in QtHandles
Date: Tue, 3 Feb 2015 12:46:30 -0500

On Tue, Feb 3, 2015 at 12:29 PM, John W. Eaton <address@hidden> wrote:
Michael.

I've been looking at making the pan and zoom functions more compatible with Matlab and making them work with QtHandles plotting.  Taking Matlab's zoom function as an example, it can return some kind of object that says how the mouse is supposed to work for zooming.  This object works like a handle but isn't a classdef object and doesn't seem to be a graphics handle either (you may recall that we discussed this in Montreal).

Yes, I remember. I believe this is internal implementation of the original HG system from Matlab, that predates the introduction of classdef. I think this is the kind of things that we should reimplement using regular classdef objects.
 

If you do

  zoom on

then the object that's returned includes a field that has Enabled = "on".  Other fields are described in the Matlab docs.  I wanted to use a classdef object for this, but there were some problems (not important at the moment).  So instead I decided to just create a struct that is stored as a hidden figure property.  Then QtHandles or other toolkit code can look at this property and decide what to do for mouse clicks. It won't be completely compatible, but at least it works to store the info and can probably be converted to some other type of object that can provide better compatibility later.

Then I noticed that there is already a MouseMode enum in QtHandles.  I'd rather not store this info in multiple places, so instead of storing m_mouseMode in the QtHandles Figure object, I'd have the Figure object get and set the values from the graphics properties as needed.  Do you see a problem with that?

No. The only things about which you might be careful are:
- thread concurrency
- if you implement the object as a regular structure, then want to move to a classdef handle-type object, you'll change the semantic of the object (value vs. handle)
 

Also, can you help me understand what the intent of m_lastMouseMode is?  I don't understand why that is needed.  Do you remember?

It's been a while, but looking at the code, I believe it is to keep track of the mouse mode when the toolbar is hidden. That is: when you hide the toolbar, you want to revert to NoMode as it could be awkward to have some mouse mode enabled, while not being able to change it; so m_mouseMode is reset to NoMode, as it's being used in the rest of the code. However, when you show the toolbar again, you may want to restore the mouse mode to what it was initially (especially to keep the visual state of the toggle buttons in sync with the actual mouse mode).

It's probably better to check first in Matlab how this is handled. Maybe I made things to complicated and we should just maintain the mouse mode, even after hiding the toolbar.

Michael.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]