Yet another GUI releated thought
John Swensen
jpswensen at comcast.net
Wed May 7 14:44:57 CDT 2008
On May 7, 2008, at 3:26 PM, Søren Hauberg wrote:
> Hi All,
> I'm still not convinced that it is necessary to make Octave thread
> safe or similar complicated things to provide a graphical interface to
> Octave. I don't really understand the input handling in Octave, so
> this
> has been developed in a "Hmmm, I wonder what happens if I press this
> button..." style.
> What I have done is the following:
> In 'src/input.cc' I have added:
>
> // TRUE if the GUI is being used
> bool using_gui = true;
>
> Then later (same file) I have changed the function 'gnu_readline' so
> it
> reads
>
> if (!using_gui)
> retval = command_editor::readline (s, eof);
> else
> retval = GUI::readline (s, eof);
>
> This is probably the wrong place to do this, but it seems to work
> (haven't tested much, though). The function 'GUI::readline' returns
> when
> the user pressed Return in the GUI. The GUI is being started in
> 'octave_main' in 'src/octave.cc' in a separate thread.
> Using this approach the GUI supports partial statements. It does not
> support tab-completion and history searching, and similar. Such things
> will have to be reimplemented in the GUI. I don't think that's much
> work
> though. Are there any issues with this approach that I'm missing?
>
> Søren
>
I don't think it is necessary to make Octave "explicitly" thread-safe
either. In fact, the current method in OctaveDE of registering a
function with the Readline idle event function seems to provide all
the thread-safety my IDE needs. Now, when you say GUI, maybe you are
referring to creating uicontrol objects and handling their callback
functions.
John Swensen
More information about the Octave-maintainers
mailing list