This patch implements a wxWidgets terminal. It provides
all the basic functionnality, but also mouse+hotkeys
support and enhanced text mode.
It is designed to be cross-platform (really few lines
to tweak, apart from the makefiles), and it will
provide other benefits such as text anti-aliasing, and
even line anti-aliasing depending on the platform port
of the library itself (for example, with recent gtk+
and cario).
Moreover, it is easy to add gui facilities, through
menus and toolbars, as it is already done by OS/2 and
windows implementations.
Note : this is really a work-in-progress, and it can
affect gnuplot's general behaviour as it modifies the
main loop to process the terminal events. In
particular, it adds some overhead by initializing the
wxwidgets library.
declare enhanced text routines and variables as extern in term_api.h
replace PKG_MAJOR by VERSION_MAJOR (pkg-config requirement)
Windows : make the getc() wrapper call term->waitforinput()
move UNSET/yes/enum in term_api.h (fix a FIXME)
Logged In: YES
user_id=1333817
Here is a new patch, to be applied along with the four
preliminary ones.
The changes are :
* more cairo code factorization
* more wxWidgets code factorization
* more cleanups
* better handling of strings encoding, default to locale
charset, try to fallback to iso_8859_1 in case of an error
* properly free the allocated memory for font names, text
strings, polygon corners, image pixels
* implement 'set term wxt <n> close'
* implement 'set term wxt title "<title>" '
This version is "valgrind-safe" (apart from problems coming
from wxWidgets or gtk+).
17th version, memory leaks fixed, encoding reworked, need the four preliminary patches
Logged In: YES
user_id=27517
[Deleting a large number of intermediate versions of this
patch from the attachment list.]
I'm wondering about enhanced_extern.dif: if these were never
published before, how did other terminal drivers outside
term.c (PM, X11) ever manage to use them? I.e. what's
different about wx that makes it need these exported?
Logged In: YES
user_id=1333817
> I'm wondering about enhanced_extern.dif:
> if these were never published before,
> how did other terminal drivers outside
> term.c (PM, X11) ever manage to use them?
> I.e. what's different about wx that makes
> it need these exported?
X11 and PM process the enhanced text (recursion...) before
sending the commands (open, flush) to the pipe.
I have chosen to just store the initial command (i.e. the
string and its position) and to process it later. Storing
the initial command is done in the wxt_gui.cpp, the
processing of the command is done in gp_cairo.c, where the
enhanced routines are needed.
Motivation for this separation :
* I need a separate file for wxWidgets which is C++
* the cairo routines are not C++, and could be used later to
write other terminals (for example a png terminal with
antialiasing), so they deserve to be in an other separate file
I could use the enhanced routines either before or after
storing gnuplot commands.
X11 and PM do this before sending the commands through the
pipe, so this is done in the terminal file included in term.c
I have chosen to process them after storing the commands, so
that's done in gp_cairo.c
I could have done it before, but then the enhanced routines
would be called from the C++ file, so they would still need
to be declared extern.
I could have changed everything (again) to really move all
the terminal functions in wxt.trm, but it would imply adding
a lot of other wrappers for C++ functions... and I would
lose the reusability of the enhanced code as it is written
now in gp_cairo.c ...
Maybe I lose another obvious solution (leaving wxWidgets for
a pure C toolkit ??), but anyway it does not seem a big deal
to me ;-)
Thanks for your review.
Logged In: YES
user_id=1333817
A new patch, again (hopefully the last one), to be applied
on top of the four preliminary patches :
* internally store oversampling and antialiasing settings in
two different variables
* with wxGTK, handle raise_console_window with gdk instead
of X11
* copy the bitmap directly to the screen without asking for
refresh in the message queue : small speedup, especially
noticeable on Windows where rotating plots works better now
(previously you add to stop moving your mouse to give a
chance to the message queue to process the refresh request)
* cleanups, more comments ...
Snapshot for windows :
http://tipote.free.fr/wgnuplot-wxt-20060426.zip
On my "todo" list :
* learn to use CVS to commit all this stuff
* use custom cursors instead of the stock cursors provided
by wxWidgets : some are ugly, some don't fit with their
purpose, some are black-only so they are not visible on dark
surfaces, and finally they are not the same on all
platforms. This can be done later.
18th version, improve window refresh, cleanups, use gdk instead of X11
Logged In: YES
user_id=1333817
New patch :
* corrects the EndOfLine characters for the file wxt.trm
(was DOS/Windows)
* Add an additional license statement to all new files, so
that the code can be alternatively licensed under the GPL
(two portions taken from other gnuplot files are excluded in
wxt_gui.cpp and designated as such)
19th version, GPL as an alternative license, corrected EOL
Logged In: YES
user_id=1333817
I am closing this entry now that everything has been
committed to the CVS.
P.S. : It would be nice to store a Windows snapshot with the
wxWidgets terminal among the other binaries on
http://gnuplot.info/development/binaries/