On 2017-02-28 12:19-0800 Alan W. Irwin wrote:

My remaining plans for the -DPL_WXWIDGETS_IPC2=ON case are as follows:

1. Implement interactivity so that C example 1 works with -locate mode
and C example 20 works.

Hi Phil:

I am having trouble with implementing interactivity and could use some
help from you to figure this out although I will be trying
independently to figure this out on my own using gdb.

The attached patch implements the required (as far as I can tell)
small changes to implement interactivity for -DPL_WXWIDGETS_IPC2=ON.
As a result of these changes, the entire code should have the following logic
for dealing with locate mode for -DPL_WXWIDGETS_IPC2=ON:

* In example 1 after all normal PLplot calls to generate the plot have
been called (which fills up plbuf with 24272 bytes of information, see
below), the locate mode loop generates a series of plGetCursor calls.

* Each of those plGetCursor calls ends up (for -dev wxwidgets) as a call to
wxPLDevice::Locate and

TransmitBuffer( pls, transmissionLocate );

* TransmitBuffer calls transmitBytes to send header information
(including transmissionLocate = 4 and  plbufAmountToTransmit = 24272
bytes in plbuf to be received by wxPLViewer using receiveBytes.

The results are

Before transmitBytes
transmissionType = 4
plbufAmountToTransmit = 24272
viewerOpenFlag = 1
locateModeFlag = 1
completeFlag = 0
After receiveBytes
transmissionType = 4
plbufAmountToTransmit = 24272
viewerOpenFlag = 1
locateModeFlag = 1
completeFlag = 0
Successful read of plbuf

i.e., that transmission of the plbuf information and
transmissionLocate to wxPLViewer was a complete success.

* Because plbufAmountToTransmit is non-zero, wxPLViewer appends that
plbuf information to the correct element of the m_pageBuffers array
and conditionally (although the result is the condition is true
because of the above 24272 says there is a lot more data to plot)
calls SetPageAndUpdate as per normal which should plot the page in
preparation for the locate mode.

* After plbuf is processed, then transmissionLocate calls
SetPageAndUpdate one more time (which has no effect because
everything should be plotted now), then sets m_locateMode = true

* Here my understanding gets fuzzy, but wxPlFrame::OnMouse is part of
a table of events which I presume means it is called whenever there is
any mouse activity.  But when m_locateMode is true, then in
wxPlFrame::OnMouse information about
the latest mouse click is collected into the m_header.graphicsIn
struct, and then the whole header is sent back to -dev wxwidgets with
transmit_Bytes (which because of the three-semaphore design will wait
for the end of the previous transmit_Bytes before proceeding so I
don't think we are up against any race condition here) where
wxPLDevice::Locate receives it with receiveBytes, and passes it back
to the example 1 locate loop which prints out values collected for a
particular mouse click, then (unless there is an exit from locate mode
by a mouse click off of a viewport keeps repeating the whole process
indefinitely.

I think this design should "just work" (especially because my
changes to implement it in the attached patch are so small
and straightforward).

What happens in practice is the whole code just hangs without even
displaying the plot (something it should do regardless of anything
else right after the above "Successful read of plbuf" message).

I am pretty sure the problem is due to some minor bug.  For example,
the wxPlFrame::OnKey routine is just empty for the
-DPL_WXWIDGETS_IPC2=ON case, and maybe I need to implement something
there as well for that case, but I cannot see how that would stop the
whole display showing (as it does for example 1 if the -locate option
is not used), and I don't see how it would stop wxPlFrame::OnMouse
from working properly.  So if you spot that bug please let me know. Of
course, the answer may be there is a fundamental flaw in the above
design so it you feel that is the case please let me know.  And your
clarification of my fuzzy understanding of when wxPlFrame::OnMouse
gets called would be helpful as well.

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state
implementation for stellar interiors (freeeos.sf.net); the Time
Ephemerides project (timeephem.sf.net); PLplot scientific plotting
software package (plplot.sf.net); the libLASi project
(unifont.org/lasi); the Loads of Linux Links project (loll.sf.net);
and the Linux Brochure Project (lbproject.sf.net).
__________________________

Linux-powered Science
__________________________

Attachment: wxwidgets_interactive.patch.gz
Description: interactive implemention for -DPL_WXWIDGETS_IPC2=ON

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel

Reply via email to