bugGNU Octave - Bugs: bug #56347, Implement figure...

 
 

bug #56347: Implement figure "pointer" property

Submitter:  Pantxo Diribarne <pantxo>
Submitted:  Sun 19 May 2019 09:32:14 AM UTC
   
 
Category:  Plotting with OpenGL Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Feature Request
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Wed 22 May 2019 03:01:43 PM UTC, comment #14: 

@Panxto:
Sure I'll try but I have no time for testing til June, 3.
Just yesterday I made a new crossbuild; the pointers look nice on Windows.

Philip Nienhuis <philipnienhuis>
Group Member
Wed 22 May 2019 12:13:09 PM UTC, comment #13: 

@Philip: I attached a patch to make use of Qt's standard cursors on Windows and Mac. Could you test it? The simplest way to test is something like:


pointers = set (gcf, "pointer");
uicontrol ("style", "popupmenu", "string", pointers, ...
           "callback", @(h) set (gcbf, "pointer", pointers{get (h, "value")}));


Change the cursor using the popupmenu and see if it looks like https://www.mathworks.com/help/matlab/ref/matlab.ui.figure-properties.html#buiwuyk-1-Pointer.

(file #46960)

Pantxo Diribarne <pantxo>
Group Member
Tue 21 May 2019 10:54:21 PM UTC, comment #12: 

@Panxto: Thanks for testing.  I only have the Matlab documentation to go by, and often it doesn't reflect what their software actually does.

Rik <rik5>
Group administrator
Tue 21 May 2019 10:39:50 PM UTC, comment #11: 

@Philip: "crosshair" should read "fullcrosshair"

Pantxo Diribarne <pantxo>
Group Member
Tue 21 May 2019 10:34:16 PM UTC, comment #10: 

@Rik: AFAICT both Matlab and Qt have platform dependent behaviors, what I see on linux is very different from their respective documentation:

  • Matlab [1]: I guess the images on their doc are taken from the theme they use on Windows, but what they actually use on linux (tested at work using ML2016a on Scientific Linux 6) is the same DMZ theme  that we now have, including a distinction between topl and botr, botl and topr, ... and including "fleur" corresponding to a grabbing hand.
  • Qt [2]: Same here the images in the doc (Windows-like, Matlab's doc-like icons) are not what I see in linux when using their standard set of QCursors: I see DMZ icons (provided by the OS) but with some bugs, what should be a forward diagonal double arrow is represented as a top right (or bottom left I don't remember) single arrow, same kind of bug for the backward diagonal double arrow cursor.


As a summary, we cannot directly use Qt's standard set of cursors at least on linux (due to the above mentioned bug) but this may not be true on Windows and Mac. I can prepare a patch for testing.

In any event since on linux we have distinct icons for dragging a top-right or bottom-left corner and since even Matlab distinguishes topr and botl on this platform, I'd keep using DMZ as is.

@Philip: Yes "crosshair" used to be an accepted value for "pointer" but had never been implemented. Since it was removed from Matlab 5 years ago (and since it was a pain), I didn't bother to implement it in the patch. Rik simply made "crosshair" become a forbidden value instead of an unimplemented one. 

[1] https://www.mathworks.com/help/matlab/ref/matlab.ui.figure-properties.html#buiwuyk-1-Pointer
[2] https://doc.qt.io/qt-5/qt.html#CursorShape-enum

Pantxo Diribarne <pantxo>
Group Member
Tue 21 May 2019 06:01:26 PM UTC, comment #9: 

Looks good.  'make check' passes so I checked it in here (https://hg.savannah.gnu.org/hgweb/octave/rev/2cd31365c84a).

I did notice some tweaks that I think would make it even nicer.

The Matlab documentation for the cursor shapes is at https://www.mathworks.com/help/matlab/ref/matlab.ui.figure-properties.html.

1) The "cross" shape in Matlab seems to have a gap at the center so you can see what is at the center.  Octave's behavior is to use the "crosshair" shape for both "crosshair" and "cross".  It would be nice to separate them.  In the DMZ archive the crosshair.png already has the necessary cut-out.

2) The "topl"/"botr" shape in Matlab is a double-arrow, but a single arrow in Octave.  It seems like the DMZ icon "bd_double_arrow.png" would be a more similar replacement

3) The "topr"/"botl" shape in Matlab is a double-arrow, but a single arrow in Octave.  It seems like the DMZ icon "fd_double_arrow.png" would be a more similar replacement.

4) The "left"/"right" shape in Matlab is a double-arrow, but a single arrow in Octave.  It seems like the DMZ icon "sb_h_double_arrow.png" would be a more similar replacement.

5) The "top"/"bottom" shape in Matlab is a double-arrow, but a single arrow in Octave.  It seems like the DMZ icon "sb_v_double_arrow.png" would be a more similar replacement.

6) The "fleur" shape in Matlab is a 4-way arrow that looks like they combined "left" + "top" icons.  In Octave, it is very different and sort of looks like a hand.  Maybe it is possible to manually merge the DMZ icons in to a "fleur" shape?






Rik <rik5>
Group administrator
Tue 21 May 2019 05:57:54 PM UTC, comment #8: 

Ah you mean it was never implemented, also not in the patch, just mentioned in Octave all along.

Philip Nienhuis <philipnienhuis>
Group Member
Tue 21 May 2019 05:23:27 PM UTC, comment #7: 

@Rik: Thanks. I attached an updated cset that fixes the two issues mentioned in comment #2. I also mentioned in the doc that the hotspot was [row col] (and fixed an inversion in the previous version of the patch).

(file #46940)

Pantxo Diribarne <pantxo>
Group Member
Tue 21 May 2019 05:20:55 PM UTC, comment #6: 

The "fullcrosshair" is not implemented in this patch.  If you set it to that value it defaults back to "arrow".  Removing it is Matlab-compatible and means we don't need to write additional code.

Rik <rik5>
Group administrator
Tue 21 May 2019 05:13:18 PM UTC, comment #5: 

Why remove "pointer shape "fullcrosshair" ?
Is it a realistic maintenance burden or merely a case of Matlab-copying?

In Matlab 2014a (the last version before object-based graphics, we use it a lot at work because some of our code only work with handle-based graphics) it is a fairly convenient feature.
It is often much easier to keep an eye on the points where the cursor lines cross the axes (plot box) than watching the coordinates in small font in the lower left.

Philip Nienhuis <philipnienhuis>
Group Member
Tue 21 May 2019 04:02:53 PM UTC, comment #4: 

@Pantxo: A binary patch is attached.

I didn't change any of the binary files so overlaying my patch on top of yours (with 'patch -p1 < file') would also work.

(file #46939)

Rik <rik5>
Group administrator
Tue 21 May 2019 11:50:44 AM UTC, comment #3: 

@Rik: Thanks for the review. I think I have a fix for both issues, but could post your updated version of the patch with binary data included (I use "hg export --git -o patchname")?

Pantxo Diribarne <pantxo>
Group Member
Mon 20 May 2019 08:54:23 PM UTC, comment #2: 

This is cool.

I tried it out and made a few changes.

1) I modified some of the documentation in genpropdoc.m to--hopefully?--be clearer.

2) In libgui/icons/module.mk there was a line to add the icon xterm.png, but I don't see that anywhere, so I removed it.

3) The pointer shape "fullcrosshair" was removed in Matlab 2014B so I removed it as a choice from graphics.in.h

4) The default value for "pointerhotspot" was [0,0] which I changed to [1,1] (top-left)

I found two things that I think need fixing.

#1: weirdly colored pixels when using 16x16 cursors.  The odd pixels are in ones that should be transparent.

Code to reproduce


clf;
ptr = zeros (16,16);
# Cross shape
ptr (8,:) = 1;
ptr (:,8) = 1;
set (gcf, 'pointershapecdata', ptr);
set (gcf, 'pointer', 'custom');


#2: Changing "pointershapecdata" doesn't automatically update cursor.

Code to reproduce


clf;
# This will make cursor a black square
set (gcf, 'pointer', 'custom');
ptr = zeros (16,16);
# Cross shape
ptr (8,:) = 1;
ptr (:,8) = 1;
set (gcf, 'pointershapecdata', ptr);
# Cursor is still black
# This toggles the cursor and makes it work.
set (gcf, 'pointer', 'arrow');
set (gcf, 'pointer', 'custom');


I uploaded a version 4 of the patch that includes my changes.

(file #46933)

Rik <rik5>
Group administrator
Sun 19 May 2019 09:39:42 AM UTC, comment #1: 

Patch attached. In order to have consistent cursors across platforms, I imported a subset of the standard DMZ theme in Octave icons resources.

(file #46927)

Pantxo Diribarne <pantxo>
Group Member
Sun 19 May 2019 09:32:14 AM UTC, original submission:  

The figure "pointer", "pointershapecdata" and "pointershapehotspot" are currently unimplemented. I will attach a patch as soon as I have a bug number.

Pantxo Diribarne <pantxo>
Group Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #46960:  pointer_native.patch added by pantxo (5KiB - text/x-patch)
file #46940:  pointer5.patch added by pantxo (38KiB - text/x-patch)
file #46939:  pointer4.binary.cset added by rik5 (38KiB - application/octet-stream)
file #46933:  pointer4.cset added by rik5 (21KiB - application/octet-stream)
file #46927:  pointer3.patch added by pantxo (38KiB - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Updated the item)
  • -email is unavailable- added by pantxo (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 8 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-05-22 pantxo Attached File- Added pointer_native.patch, #46960
    2019-05-21 rik5 Open/ClosedOpen Closed
    2019-05-21 rik5 StatusPatch Submitted Fixed
    2019-05-21 pantxo Attached File- Added pointer5.patch, #46940
    2019-05-21 rik5 Attached File- Added pointer4.binary.cset, #46939
    2019-05-20 rik5 Attached File- Added pointer4.cset, #46933
    2019-05-19 pantxo Attached File- Added pointer3.patch, #46927
        StatusNone Patch Submitted

    Back to the top

    Powered by Savane 3.13-caa5.
    Corresponding source code