+ /** @} */
// labeltypes:
static void set_labeltype(Fl_Labeltype,Fl_Label_Draw_F*,Fl_Label_Measure_F*);
- static void set_labeltype(Fl_Labeltype, Fl_Labeltype from);
+ /** Sets the functions to call to draw and measure a specific labeltype. */
+ static void set_labeltype(Fl_Labeltype, Fl_Labeltype from); // is it defined ?
// boxtypes:
static Fl_Box_Draw_F *get_boxtype(Fl_Boxtype);
@@ -247,47 +740,287 @@ public:
static int box_dh(Fl_Boxtype);
static int draw_box_active();
- // back compatability:
+ // back compatibility:
+ /** \addtogroup fl_windows
+ @{ */
+ /** For back compatibility, sets the void Fl::fatal handler callback */
static void set_abort(void (*f)(const char*,...)) {fatal = f;}
static void (*atclose)(Fl_Window*,void*);
static void default_atclose(Fl_Window*,void*);
+ /** For back compatibility, sets the Fl::atclose handler callback. You
+ can now simply change the callback for the window instead.
+ \see Fl_Window::callback(Fl_Callback*) */
static void set_atclose(void (*f)(Fl_Window*,void*)) {atclose = f;}
+ /** @} */
+
+ /** \addtogroup fl_events
+ @{ */
+ /** Returns non-zero if the Shift key is pressed. */
static int event_shift() {return e_state&FL_SHIFT;}
+ /** Returns non-zero if the Control key is pressed. */
static int event_ctrl() {return e_state&FL_CTRL;}
+ /** Returns non-zero if the Alt key is pressed. */
static int event_alt() {return e_state&FL_ALT;}
+ /**
+ Returns the mouse buttons state bits; if non-zero, then at least one
+ button is pressed now. This function returns the button state at the
+ time of the event. During an FL_RELEASE event, the state
+ of the released button will be 0. To find out, which button
+ caused an FL_RELEASE event, you can use Fl::event_button() instead.
+ \return a bit mask value like { [FL_BUTTON1] | [FL_BUTTON2] | [FL_BUTTON3] }
+ */
static int event_buttons() {return e_state&0x7f000000;}
+ /**
+ Returns non-zero if mouse button 1 is currently held down.
+ For more details, see Fl::event_buttons().
+ */
static int event_button1() {return e_state&FL_BUTTON1;}
+ /**
+ Returns non-zero if button 2 is currently held down.
+ For more details, see Fl::event_buttons().
+ */
static int event_button2() {return e_state&FL_BUTTON2;}
+ /**
+ Returns non-zero if button 3 is currently held down.
+ For more details, see Fl::event_buttons().
+ */
static int event_button3() {return e_state&FL_BUTTON3;}
+ /** @} */
+
+ /**
+ Sets an idle callback.
+
+ \deprecated This method is obsolete - use the add_idle() method instead.
+ */
static void set_idle(void (*cb)()) {idle = cb;}
+ /** See Fl_Window* grab() */
static void grab(Fl_Window&win) {grab(&win);}
+ /** Releases the current grabbed window, equals grab(0).
+ \deprecated Use Fl::grab(0) instead.
+ \see Fl_Window* grab() */
static void release() {grab(0);}
// Visible focus methods...
+ /**
+ Gets or sets the visible keyboard focus on buttons and other
+ non-text widgets. The default mode is to enable keyboard focus
+ for all widgets.
+ */
static void visible_focus(int v) { visible_focus_ = v; }
+ /**
+ Gets or sets the visible keyboard focus on buttons and other
+ non-text widgets. The default mode is to enable keyboard focus
+ for all widgets.
+ */
static int visible_focus() { return visible_focus_; }
// Drag-n-drop text operation methods...
+ /**
+ Gets or sets whether drag and drop text operations are supported.
+ This specifically affects whether selected text can
+ be dragged from text fields or dragged within a text field as a
+ cut/paste shortcut.
+ */
static void dnd_text_ops(int v) { dnd_text_ops_ = v; }
+ /**
+ Gets or sets whether drag and drop text operations are
+ supported. This specifically affects whether selected text can
+ be dragged from text fields or dragged within a text field as a
+ cut/paste shortcut.
+ */
static int dnd_text_ops() { return dnd_text_ops_; }
+ /** \defgroup fl_multithread Multithreading support functions
+ fl multithreading support functions
+ @{ */
// Multithreading support:
static void lock();
static void unlock();
static void awake(void* message = 0);
+ /** See void awake(void* message=0). */
static int awake(Fl_Awake_Handler cb, void* message = 0);
- static void* thread_message();
+ /**
+ The thread_message() method returns the last message
+ that was sent from a child by the awake() method.
+
+ See also: multithreading
+ */
+ static void* thread_message(); // platform dependent
+ /** @} */
+ /** \defgroup fl_del_widget Safe widget deletion support functions
+
+ These functions support deletion of widgets inside callbacks.
+
+ Fl::delete_widget() should be called when deleting widgets
+ or complete widget trees (Fl_Group, Fl_Window, ...) inside
+ callbacks.
+
+ The other functions are intended for internal use. The preferred
+ way to use them is by using the helper class Fl_Widget_Tracker.
+
+ The following is to show how it works ...
+
+ There are three groups of related methods:
+
+ -# scheduled widget deletion
+ - Fl::delete_widget() schedules widgets for deletion
+ - Fl::do_widget_deletion() deletes all scheduled widgets
+ -# widget watch list ("smart pointers")
+ - Fl::watch_widget_pointer() adds a widget pointer to the watch list
+ - Fl::release_widget_pointer() removes a widget pointer from the watch list
+ - Fl::clear_widget_pointer() clears a widget pointer \e in the watch list
+ -# the class Fl_Widget_Tracker:
+ - the constructor calls Fl::watch_widget_pointer()
+ - the destructor calls Fl::release_widget_pointer()
+ - the access methods can be used to test, if a widget has been deleted
+ \see Fl_Widget_Tracker.
+
+ @{ */
// Widget deletion:
static void delete_widget(Fl_Widget *w);
static void do_widget_deletion();
static void watch_widget_pointer(Fl_Widget *&w);
static void release_widget_pointer(Fl_Widget *&w);
static void clear_widget_pointer(Fl_Widget const *w);
+ /** @} */
+
+#ifdef HAVE_CAIRO
+ /** \defgroup group_cairo Cairo support functions and classes
+ @{
+ */
+public:
+ // Cairo support API
+ static cairo_t * cairo_make_current(Fl_Window* w);
+ /** when HAVE_CAIRO is defined and cairo_autolink_context() is true,
+ any current window dc is linked to a current context.
+ This is not the default, because it may not be necessary
+ to add cairo support to all fltk supported windows.
+ When you wish to associate a cairo context in this mode,
+ you need to call explicitly in your draw() overridden method,
+ FL::cairo_make_current(Fl_Window*). This will create a cairo context
+ but only for this Window.
+ Still in custom cairo application it is possible to handle
+ completely this process automatically by setting \p alink to true.
+ In this last case, you don't need anymore to call Fl::cairo_make_current().
+ You can use Fl::cairo_cc() to get the current cairo context anytime.
+ \note Only available when configure has the --enable-cairo option
+ */
+ static void cairo_autolink_context(bool alink) {cairo_state_.autolink(alink);}
+ /**
+ Gets the current autolink mode for cairo support.
+ \retval false if no cairo context autolink is made for each window.
+ \retval true if any fltk window is attached a cairo context when it
+ is current. \see void cairo_autolink_context(bool alink)
+ \note Only available when configure has the --enable-cairo option
+ */
+ static bool cairo_autolink_context() {return cairo_state_.autolink();}
+ /** Gets the current cairo context linked with a fltk window. */
+ static cairo_t * cairo_cc() { return cairo_state_.cc(); }
+ /** Sets the current cairo context to \p c.
+ Set \p own to true if you want fltk to handle this cc deletion.
+ \note Only available when configure has the --enable-cairo option
+*/
+ static void cairo_cc(cairo_t * c, bool own=false){ cairo_state_.cc(c, own); }
+
+private:
+ static cairo_t * cairo_make_current(void* gc);
+ static cairo_t * cairo_make_current(void* gc, int W, int H);
+ static Fl_Cairo_State cairo_state_;
+public:
+ /** @} */
+
+#endif // HAVE_CAIRO
+
};
+/**
+ This class should be used to control safe widget deletion.
+
+ You can use an Fl_Widget_Tracker object to watch another widget, if you
+ need to know, if this widget has been deleted during a callback.
+
+ This simplifies the use of the "safe widget deletion" methods
+ Fl::watch_widget_pointer() and Fl::release_widget_pointer() and
+ makes their use more reliable, because the destructor autmatically
+ releases the widget pointer from the widget watch list.
+
+ It is intended to be used as an automatic (local/stack) variable,
+ such that the automatic destructor is called when the object's
+ scope is left. This ensures that no stale widget pointers are
+ left in the widget watch list (see example below).
+
+ You can also create Fl_Widget_Tracker objects with \c new, but then it
+ is your responsibility to delete the object (and thus remove the
+ widget pointer from the watch list) when it is not needed any more.
+
+ Example:
+
+ \code
+ int MyClass::handle (int event) {
+
+ if (...) {
+ Fl_Widget_Tracker wp(this); // watch myself
+ do_callback(); // call the callback
+
+ if (wp.deleted()) return 1; // exit, if deleted
+
+ // Now we are sure that the widget has not been deleted.
+ // It is safe to access the widget
+
+ clear_changed(); // access the widget
+ }
+ }
+ \endcode
+
+*/
+class FL_EXPORT Fl_Widget_Tracker {
+
+ Fl_Widget* wp_;
+
+public:
+
+ Fl_Widget_Tracker(Fl_Widget *wi);
+ ~Fl_Widget_Tracker();
+
+ /**
+ Returns a pointer to the watched widget.
+
+ This pointer is \c NULL, if the widget has been deleted.
+ */
+ Fl_Widget *widget() {return wp_;}
+
+ /**
+ Returns 1, if the watched widget has been deleted.
+
+ This is a convenience method. You can also use something like
+
+ if (wp.widget() == 0) // ...
+
+ where \p wp is an Fl_Widget_Tracker object.
+ */
+ int deleted() {return wp_ == 0;}
+
+ /**
+ Returns 1, if the watched widget exists (has not been deleted).
+
+ This is a convenience method. You can also use something like
+
+ if (wp.widget() != 0) // ...
+
+ where \p wp is an Fl_Widget_Tracker object.
+ */
+ int exists() {return wp_ != 0;}
+
+};
+
+ /** \defgroup fl_unicode Unicode and UTF-8 functions
+ fl global Unicode and UTF-8 handling functions
+ @{ */
+ /** @} */
+
#endif // !Fl_H
//
-// End of "$Id: Fl.H 5848 2007-05-20 16:18:31Z mike $".
+// End of "$Id: Fl.H 6771 2009-04-19 12:47:36Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Adjuster.H b/plugins/zynaddsubfx/fltk/FL/Fl_Adjuster.H
index 466283ae8..8f3c68550 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Adjuster.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Adjuster.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Adjuster.H 4288 2005-04-16 00:13:17Z mike $"
+// "$Id: Fl_Adjuster.H 6614 2009-01-01 16:11:32Z matt $"
//
// Adjuster widget header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,6 +25,9 @@
// http://www.fltk.org/str.php
//
+/* \file
+ Fl_Adjuster widget . */
+
// 3-button "slider", made for Nuke
#ifndef Fl_Adjuster_H
@@ -34,6 +37,18 @@
#include "Fl_Valuator.H"
#endif
+/**
+ The Fl_Adjuster widget was stolen from Prisms, and has proven
+ to be very useful for values that need a large dynamic range.
+ \image html adjuster1.gif
+ \image latex adjuster1.eps "Fl_Adjuster" width=4cm
+ When you press a button and drag to the right the value increases.
+ When you drag to the left it decreases. The largest button adjusts by
+ 100 * step(), the next by 10 * step() and that
+ smallest button by step(). Clicking on the buttons
+ increments by 10 times the amount dragging by a pixel does. Shift +
+ click decrements by 10 times the amount.
+*/
class FL_EXPORT Fl_Adjuster : public Fl_Valuator {
int drag;
int ix;
@@ -44,12 +59,24 @@ protected:
void value_damage();
public:
Fl_Adjuster(int X,int Y,int W,int H,const char *l=0);
+ /**
+ If "soft" is turned on, the user is allowed to drag the value outside
+ the range. If they drag the value to one of the ends, let go, then
+ grab again and continue to drag, they can get to any value. Default is
+ one.
+ */
void soft(int s) {soft_ = s;}
+ /**
+ If "soft" is turned on, the user is allowed to drag the value outside
+ the range. If they drag the value to one of the ends, let go, then
+ grab again and continue to drag, they can get to any value. Default is
+ one.
+ */
int soft() const {return soft_;}
};
#endif
//
-// End of "$Id: Fl_Adjuster.H 4288 2005-04-16 00:13:17Z mike $".
+// End of "$Id: Fl_Adjuster.H 6614 2009-01-01 16:11:32Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Bitmap.H b/plugins/zynaddsubfx/fltk/FL/Fl_Bitmap.H
index e8686b09d..9fec48d76 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Bitmap.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Bitmap.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Bitmap.H 4288 2005-04-16 00:13:17Z mike $"
+// "$Id: Fl_Bitmap.H 6614 2009-01-01 16:11:32Z matt $"
//
// Bitmap header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,6 +25,9 @@
// http://www.fltk.org/str.php
//
+/* \file
+ Fl_Bitmap widget . */
+
#ifndef Fl_Bitmap_H
#define Fl_Bitmap_H
# include "Fl_Image.H"
@@ -32,19 +35,28 @@
class Fl_Widget;
struct Fl_Menu_Item;
+/**
+ The Fl_Bitmap class supports caching and drawing of mono-color
+ (bitmap) images. Images are drawn using the current color.
+*/
class FL_EXPORT Fl_Bitmap : public Fl_Image {
public:
+ /** pointer to raw bitmap data */
const uchar *array;
- int alloc_array; // Non-zero if data was allocated
+ /** Non-zero if array points to bitmap data allocated internally */
+ int alloc_array;
#if defined(__APPLE__) || defined(WIN32)
- void *id; // for internal use
+ /** for internal use */
+ void *id;
#else
- unsigned id; // for internal use
+ /** for internal use */
+ unsigned id;
#endif // __APPLE__ || WIN32
-
+ /** The constructors create a new bitmap from the specified bitmap data */
Fl_Bitmap(const uchar *bits, int W, int H) :
Fl_Image(W,H,0), array(bits), alloc_array(0), id(0) {data((const char **)&array, 1);}
+ /** The constructors create a new bitmap from the specified bitmap data */
Fl_Bitmap(const char *bits, int W, int H) :
Fl_Image(W,H,0), array((const uchar *)bits), alloc_array(0), id(0) {data((const char **)&array, 1);}
virtual ~Fl_Bitmap();
@@ -60,5 +72,5 @@ class FL_EXPORT Fl_Bitmap : public Fl_Image {
#endif
//
-// End of "$Id: Fl_Bitmap.H 4288 2005-04-16 00:13:17Z mike $".
+// End of "$Id: Fl_Bitmap.H 6614 2009-01-01 16:11:32Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Box.H b/plugins/zynaddsubfx/fltk/FL/Fl_Box.H
index 36fdc0f0c..f9e09effb 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Box.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Box.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Box.H 4288 2005-04-16 00:13:17Z mike $"
+// "$Id: Fl_Box.H 6614 2009-01-01 16:11:32Z matt $"
//
// Box header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,6 +25,9 @@
// http://www.fltk.org/str.php
//
+/* \file
+ Fl_Box widget . */
+
#ifndef Fl_Box_H
#define Fl_Box_H
@@ -32,13 +35,28 @@
#include "Fl_Widget.H"
#endif
+/**
+ This widget simply draws its box, and possibly it's label. Putting it
+ before some other widgets and making it big enough to surround them
+ will let you draw a frame around them.
+*/
class FL_EXPORT Fl_Box : public Fl_Widget {
protected:
void draw();
public:
- Fl_Box(int X, int Y, int W, int H, const char *l=0)
+ /**
+ - The first constructor sets box() to FL_NO_BOX, which
+ means it is invisible. However such widgets are useful as placeholders
+ or Fl_Group::resizable()
+ values. To change the box to something visible, use box(n).
+ - The second form of the constructor sets the box to the specified box
+ type.
+
The destructor removes the box.
+ */
+ Fl_Box(int X, int Y, int W, int H, const char *l=0)
: Fl_Widget(X,Y,W,H,l) {}
- Fl_Box(Fl_Boxtype b, int X, int Y, int W, int H, const char *l)
+ /** See Fl_Box::Fl_Box(int x, int y, int w, int h, const char * = 0) */
+ Fl_Box(Fl_Boxtype b, int X, int Y, int W, int H, const char *l)
: Fl_Widget(X,Y,W,H,l) {box(b);}
virtual int handle(int);
@@ -47,5 +65,5 @@ public:
#endif
//
-// End of "$Id: Fl_Box.H 4288 2005-04-16 00:13:17Z mike $".
+// End of "$Id: Fl_Box.H 6614 2009-01-01 16:11:32Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Browser.H b/plugins/zynaddsubfx/fltk/FL/Fl_Browser.H
index ed0af811d..d8f920d4e 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Browser.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Browser.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Browser.H 4288 2005-04-16 00:13:17Z mike $"
+// "$Id: Fl_Browser.H 6726 2009-03-27 16:52:31Z greg.ercolano $"
//
// Browser header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,6 +25,9 @@
// http://www.fltk.org/str.php
//
+/* \file
+ Fl_Browser widget . */
+
// Forms-compatable browser. Probably useful for other
// lists of textual data. Notice that the line numbers
// start from 1, and 0 means "no line".
@@ -36,6 +39,52 @@
struct FL_BLINE;
+/**
+ The Fl_Browser widget displays a scrolling list of text
+ lines, and manages all the storage for the text. This is not a text
+ editor or spreadsheet! But it is useful for showing a vertical list of
+ named objects to the user.
+
+ Each line in the browser is identified by number. The numbers
+ start at one (this is so that zero can be reserved for "no line" in
+ the selective browsers). Unless otherwise noted, the methods do not
+ check to see if the passed line number is in range and legal. It must
+ always be greater than zero and <= size().
+
+ Each line contains a null-terminated string of text and a void *
+ data pointer. The text string is displayed, the void *
+ pointer can be used by the callbacks to reference the object the text
+ describes.
+
+ The base class does nothing when the user clicks on it. The
+ subclasses
+ Fl_Select_Browser,
+ Fl_Hold_Browser, and
+ Fl_Multi_Browser react to user clicks to select lines in
+ the browser and do callbacks.
+
+ The base class
+ Fl_Browser_ provides the scrolling and selection mechanisms of
+ this and all the subclasses, but the dimensions and appearance of each
+ item are determined by the subclass. You can use Fl_Browser_
+ to display information other than text, or text that is dynamically
+ produced from your own data structures. If you find that loading the
+ browser is a lot of work or is inefficient, you may want to make a
+ subclass of Fl_Browser_.
+
+ Some common coding patterns used for working with Fl_Browser:
+ \code
+ // How to loop through all the items in the browser
+ for ( int t=1; t<=browser->size(); t++ ) { // index 1 based..!
+ printf("item #%d, label='%s'\n", t, browser->text(t));
+ }
+ \endcode
+
+ Note: If you are subclassing Fl_Browser, it's more efficient
+ to use the protected methods item_first() and item_next(), since
+ Fl_Browser internally uses linked lists to manage the browser's items.
+ For more info, see find_item(int).
+*/
class FL_EXPORT Fl_Browser : public Fl_Browser_ {
FL_BLINE *first; // the array of lines
@@ -52,81 +101,218 @@ protected:
// required routines for Fl_Browser_ subclass:
void* item_first() const ;
- void* item_next(void*) const ;
- void* item_prev(void*) const ;
- int item_selected(void*) const ;
- void item_select(void*, int);
- int item_height(void*) const ;
- int item_width(void*) const ;
- void item_draw(void*, int, int, int, int) const ;
+ void* item_next(void* item) const ;
+ void* item_prev(void* item) const ;
+ void* item_last()const ;
+ int item_selected(void* item) const ;
+ void item_select(void* item, int val);
+ int item_height(void* item) const ;
+ int item_width(void* item) const ;
+ void item_draw(void* item, int X, int Y, int W, int H) const ;
int full_height() const ;
int incr_height() const ;
+ const char *item_text(void *item) const;
+ /** Swap the items \p a and \p b.
+ You must call redraw() to make any changes visible.
+ \param[in] a,b the items to be swapped.
+ \see swap(int,int), item_swap()
+ */
+ void item_swap(void *a, void *b) { swap((FL_BLINE*)a, (FL_BLINE*)b); }
+ /** Return the item at specified \p line.
+ \param[in] line The line of the item to return. (1 based)
+ \returns The item, or NULL if line out of range.
+ \see item_at(), find_line(), lineno()
+ */
+ void *item_at(int line) const { return (void*)find_line(line); }
- FL_BLINE* find_line(int) const ;
- FL_BLINE* _remove(int) ;
- void insert(int, FL_BLINE*);
- int lineno(void*) const ;
+ FL_BLINE* find_line(int line) const ;
+ FL_BLINE* _remove(int line) ;
+ void insert(int line, FL_BLINE* item);
+ int lineno(void *item) const ;
void swap(FL_BLINE *a, FL_BLINE *b);
public:
- void remove(int);
- void add(const char*, void* = 0);
- void insert(int, const char*, void* = 0);
+ void remove(int line);
+ void add(const char* newtext, void* d = 0);
+ void insert(int line, const char* newtext, void* d = 0);
void move(int to, int from);
int load(const char* filename);
void swap(int a, int b);
void clear();
- int size() const {return lines;}
+ /**
+ Returns how many lines are in the browser.
+ The last line number is equal to this.
+ Returns 0 if browser is empty.
+ */
+ int size() const { return lines; }
void size(int W, int H) { Fl_Widget::size(W, H); }
int topline() const ;
+ /** For internal use only? */
enum Fl_Line_Position { TOP, BOTTOM, MIDDLE };
- void lineposition(int, Fl_Line_Position);
- void topline(int l) { lineposition(l, TOP); }
- void bottomline(int l) { lineposition(l, BOTTOM); }
- void middleline(int l) { lineposition(l, MIDDLE); }
+ void lineposition(int line, Fl_Line_Position pos);
+ /**
+ Scrolls the browser so the top item in the browser
+ is showing the specified \p line.
+ \param[in] line The line to be displayed at the top.
+ \see topline(), middleline(), bottomline(), displayed(), lineposition()
+ */
+ void topline(int line) { lineposition(line, TOP); }
+ /**
+ Scrolls the browser so the bottom item in the browser
+ is showing the specified \p line.
+ \param[in] line The line to be displayed at the bottom.
+ \see topline(), middleline(), bottomline(), displayed(), lineposition()
+ */
+ void bottomline(int line) { lineposition(line, BOTTOM); }
+ /**
+ Scrolls the browser so the middle item in the browser
+ is showing the specified \p line.
+ \param[in] line The line to be displayed in the middle.
+ \see topline(), middleline(), bottomline(), displayed(), lineposition()
+ */
+ void middleline(int line) { lineposition(line, MIDDLE); }
- int select(int, int=1);
- int selected(int) const ;
- void show(int n);
- void show() {Fl_Widget::show();}
- void hide(int n);
- void hide() {Fl_Widget::hide();}
- int visible(int n) const ;
+ int select(int line, int val=1);
+ int selected(int line) const ;
+ void show(int line);
+ /** Shows the entire Fl_Browser widget -- opposite of hide(). */
+ void show() { Fl_Widget::show(); }
+ void hide(int line);
+ /** Hides the entire Fl_Browser widget -- opposite of show(). */
+ void hide() { Fl_Widget::hide(); }
+ int visible(int line) const ;
int value() const ;
- void value(int v) {select(v);}
- const char* text(int) const ;
- void text(int, const char*);
- void* data(int) const ;
- void data(int, void* v);
+ /**
+ Sets the browser's value(), which selects the specified \p line.
+ This is the same as calling select(line).
+ \see select(), selected(), value(), item_select(), item_selected()
+ */
+ void value(int line) { select(line); }
+ const char* text(int line) const ;
+ void text(int line, const char* newtext);
+ void* data(int line) const ;
+ void data(int line, void* d);
- Fl_Browser(int, int, int, int, const char* = 0);
+ Fl_Browser(int X, int Y, int W, int H, const char *L = 0);
+ /**
+ The destructor deletes all list items and destroys the browser.
+ */
~Fl_Browser() { clear(); }
- char format_char() const {return format_char_;}
- void format_char(char c) {format_char_ = c;}
- char column_char() const {return column_char_;}
- void column_char(char c) {column_char_ = c;}
- const int* column_widths() const {return column_widths_;}
- void column_widths(const int* l) {column_widths_ = l;}
+ /**
+ Gets the current format code prefix character, which by default is '\@'.
+ A string of formatting codes at the start of each column are stripped off
+ and used to modify how the rest of the line is printed:
+
+ \li '\@.' Print rest of line, don't look for more '\@' signs
+ \li '\@\@' Print rest of line starting with '\@'
+ \li '\@l' Use a LARGE (24 point) font
+ \li '\@m' Use a medium large (18 point) font
+ \li '\@s' Use a small (11 point) font
+ \li '\@b' Use a bold font (adds FL_BOLD to font)
+ \li '\@i' Use an italic font (adds FL_ITALIC to font)
+ \li '\@f' or '\@t' Use a fixed-pitch
+ font (sets font to FL_COURIER)
+ \li '\@c' Center the line horizontally
+ \li '\@r' Right-justify the text
+ \li '\@B0', '\@B1', ... '\@B255' Fill the backgound with
+ fl_color(n)
+ \li '\@C0', '\@C1', ... '\@C255' Use fl_color(n) to draw the text
+ \li '\@F0', '\@F1', ... Use fl_font(n) to draw the text
+ \li '\@S1', '\@S2', ... Use point size n to draw the text
+ \li '\@u' or '\@_' Underline the text.
+ \li '\@-' draw an engraved line through the middle.
- int displayed(int n) const {return Fl_Browser_::displayed(find_line(n));}
- void make_visible(int n) {
- if (n < 1) Fl_Browser_::display(find_line(1));
- else if (n > lines) Fl_Browser_::display(find_line(lines));
- else Fl_Browser_::display(find_line(n));
+ Notice that the '\@.' command can be used to reliably
+ terminate the parsing. To print a random string in a random color, use
+ sprintf("@C%d@.%s", color, string) and it will work even if the
+ string starts with a digit or has the format character in it.
+ */
+ char format_char() const { return format_char_; }
+ /**
+ Sets the current format code prefix character to \p c.
+ The default prefix is '\@'. Set the prefix to 0 to disable formatting.
+ \see format_char() for list of '\@' codes
+ */
+ void format_char(char c) { format_char_ = c; }
+ /**
+ Gets the current column separator character.
+ The default is '\\t' (tab).
+ \see column_char(), column_widths()
+ */
+ char column_char() const { return column_char_; }
+ /**
+ Sets the column separator to c.
+ This will only have an effect if you also set column_widths().
+ The default is '\\t' (tab).
+ \see column_char(), column_widths()
+ */
+ void column_char(char c) { column_char_ = c; }
+ /**
+ Gets the current column width array.
+ This array is zero-terminated and specifies the widths in pixels of
+ each column. The text is split at each column_char() and each part is
+ formatted into it's own column. After the last column any remaining
+ text is formatted into the space between the last column and the
+ right edge of the browser, even if the text contains instances of
+ column_char() . The default value is a one-element array of just
+ a zero, which means there are no columns.
+
+ Example:
+ \code
+ Fl_Browser *b = new Fl_Browser(..);
+ int widths[] = { 50, 50, 50, 70, 70, 40, 40, 70, 70, 50, 0 }; // widths for each column
+ b->column_widths(widths); // assign array to widget
+ b->column_char('\t'); // use tab as the column character
+ b->add("USER\tPID\tCPU\tMEM\tVSZ\tRSS\tTTY\tSTAT\tSTART\tTIME\tCOMMAND");
+ b->add("root\t2888\t0.0\t0.0\t1352\t0\ttty3\tSW\tAug15\t0:00\t@b@f/sbin/mingetty tty3");
+ b->add("root\t13115\t0.0\t0.0\t1352\t0\ttty2\tSW\tAug30\t0:00\t@b@f/sbin/mingetty tty2");
+ [..]
+ \endcode
+ \see column_char(), column_widths()
+ */
+ const int* column_widths() const { return column_widths_; }
+ /**
+ Sets the current array to \p arr. Make sure the last entry is zero.
+ \see column_char(), column_widths()
+ */
+ void column_widths(const int* arr) { column_widths_ = arr; }
+
+ /**
+ Returns non-zero if \p line has been scrolled to a position where it is being displayed.
+ Checks to see if the item's vertical position is within the top and bottom
+ edges of the display window. This does NOT take into account the hide()/show()
+ status of the widget or item.
+ \param[in] line The line to be checked
+ \returns 1 if visible, 0 if not visible.
+ \see topline(), middleline(), bottomline(), displayed(), lineposition()
+ */
+ int displayed(int line) const { return Fl_Browser_::displayed(find_line(line)); }
+
+ /**
+ Make the item at the specified \p line visible().
+ Functionally similar to show(int line).
+ If \p line is out of range, redisplay top or bottom of list as appropriate.
+ \param[in] line The line to be made visible.
+ \see show(int), hide(int), display(), visible(), make_visible()
+ */
+ void make_visible(int line) {
+ if (line < 1) Fl_Browser_::display(find_line(1));
+ else if (line > lines) Fl_Browser_::display(find_line(lines));
+ else Fl_Browser_::display(find_line(line));
}
- // for back compatability only:
- void replace(int a, const char* b) {text(a, b);}
- void display(int, int=1);
+ /** For back compatibility only. */
+ void replace(int a, const char* b) { text(a, b); }
+ void display(int line, int val=1);
};
#endif
//
-// End of "$Id: Fl_Browser.H 4288 2005-04-16 00:13:17Z mike $".
+// End of "$Id: Fl_Browser.H 6726 2009-03-27 16:52:31Z greg.ercolano $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Browser_.H b/plugins/zynaddsubfx/fltk/FL/Fl_Browser_.H
index 3469be40c..3d89a8ec9 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Browser_.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Browser_.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Browser_.H 4879 2006-03-28 23:27:20Z matt $"
+// "$Id: Fl_Browser_.H 6737 2009-04-02 06:44:34Z greg.ercolano $"
//
// Common browser header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,10 +25,8 @@
// http://www.fltk.org/str.php
//
-// This is the base class for browsers. To be useful it must
-// be subclassed and several virtual functions defined. The
-// Forms-compatable browser and the file chooser's browser are
-// subclassed off of this.
+/* \file
+ Fl_Browser_ widget . */
// Yes, I know this should be a template...
@@ -39,12 +37,33 @@
#include "Fl_Group.H"
#endif
#include "Fl_Scrollbar.H"
+#include // Fl::scrollbar_size()
-#define FL_NORMAL_BROWSER 0
-#define FL_SELECT_BROWSER 1
-#define FL_HOLD_BROWSER 2
-#define FL_MULTI_BROWSER 3
+#define FL_NORMAL_BROWSER 0 /**< type() of Fl_Browser */
+#define FL_SELECT_BROWSER 1 /**< type() of FL_Select_Browser */
+#define FL_HOLD_BROWSER 2 /**< type() of Fl_Hold_Browser */
+#define FL_MULTI_BROWSER 3 /**< type() of Fl_Multi_Browser */
+#define FL_SORT_ASCENDING 0 /**< sort browser items in ascending alphabetic order. */
+#define FL_SORT_DESCENDING 1 /**< sort in descending order */
+
+/**
+ This is the base class for browsers. To be useful it must be
+ subclassed and several virtual functions defined. The Forms-compatible
+ browser and the file chooser's browser are subclassed off of this.
+
+ This has been designed so that the subclass has complete control
+ over the storage of the data, although because next() and
+ prev() functions are used to index, it works best as a linked list
+ or as a large block of characters in which the line breaks must be
+ searched for.
+
+ A great deal of work has been done so that the "height" of a data
+ object does not need to be determined until it is drawn. This is
+ useful if actually figuring out the size of an object requires
+ accessing image data or doing stat() on a file or doing some
+ other slow operation.
+*/
class FL_EXPORT Fl_Browser_ : public Fl_Group {
int position_; // where user wants it scrolled to
int real_position_; // the current vertical scrolling position
@@ -53,102 +72,307 @@ class FL_EXPORT Fl_Browser_ : public Fl_Group {
int offset_; // how far down top_ item the real_position is
int max_width; // widest object seen so far
uchar has_scrollbar_; // which scrollbars are enabled
- uchar textfont_, textsize_;
+ Fl_Font textfont_;
+ Fl_Fontsize textsize_;
unsigned textcolor_;
void* top_; // which item scrolling position is in
void* selection_; // which is selected (except for FL_MULTI_BROWSER)
void *redraw1,*redraw2; // minimal update pointers
void* max_width_item; // which item has max_width_
-
- static int scrollbar_width_;
+ int scrollbar_size_; // size of scrollbar trough
void update_top();
protected:
// All of the following must be supplied by the subclass:
+ /**
+ This method must be provided by the subclass
+ to return the first item in the list.
+ \see item_first(), item_next(), item_last(), item_prev()
+ */
virtual void *item_first() const = 0;
- virtual void *item_next(void *) const = 0;
- virtual void *item_prev(void *) const = 0;
- virtual int item_height(void *) const = 0;
- virtual int item_width(void *) const = 0;
- virtual int item_quick_height(void *) const ;
- virtual void item_draw(void *,int,int,int,int) const = 0;
+ /**
+ This method must be provided by the subclass
+ to return the item in the list after \p item.
+ \see item_first(), item_next(), item_last(), item_prev()
+ */
+ virtual void *item_next(void *item) const = 0;
+ /**
+ This method must be provided by the subclass
+ to return the item in the list before \p item.
+ \see item_first(), item_next(), item_last(), item_prev()
+ */
+ virtual void *item_prev(void *item) const = 0;
+ /**
+ This method must be provided by the subclass
+ to return the last item in the list.
+ \see item_first(), item_next(), item_last(), item_prev()
+ */
+ virtual void *item_last() const { return 0L; }
+ /**
+ This method must be provided by the subclass to return
+ the height of \p item in pixels.
+ Allow for two additional pixels for the list selection box.
+ \param[in] item The item whose height is returned.
+ \returns The height of the specified \p item in pixels.
+ \see item_height(), item_width(), item_quick_height()
+ */
+ virtual int item_height(void *item) const = 0;
+ /**
+ This method must be provided by the subclass to return the width of the
+ \p item in pixels. Allow for two additional pixels for the list
+ selection box.
+ \param[in] item The item whose width is returned.
+ \returns The width of the item in pixels.
+ */
+ virtual int item_width(void *item) const = 0;
+ virtual int item_quick_height(void *item) const ;
+ /**
+ This method must be provided by the subclass to draw the \p item
+ in the area indicated by \p X, \p Y, \p W, \p H.
+ */
+ virtual void item_draw(void *item,int X,int Y,int W,int H) const = 0;
+ /**
+ This optional method returns a string (label) that may be used for sorting.
+ \param[in] item The item whose label text is returned.
+ \returns The item's text label. (Can be NULL if blank)
+ */
+ virtual const char *item_text(void *item) const { return 0L; }
+ /**
+ This optional method should be provided by the subclass
+ to efficiently swap browser items \p a and \p b, such as for sorting.
+ \param[in] a,b The two items to be swapped.
+ */
+ virtual void item_swap(void *a,void *b) { }
+ /**
+ This method must be provided by the subclass
+ to return the item for the specified \p index.
+ \param[in] index The \p index of the item to be returned
+ \returns The item at the specified \p index.
+ */
+ virtual void *item_at(int index) const { return 0L; }
// you don't have to provide these but it may help speed it up:
virtual int full_width() const ; // current width of all items
virtual int full_height() const ; // current height of all items
virtual int incr_height() const ; // average height of an item
// These only need to be done by subclass if you want a multi-browser:
- virtual void item_select(void *,int=1);
- virtual int item_selected(void *) const ;
+ virtual void item_select(void *item,int val=1);
+ virtual int item_selected(void *item) const ;
// things the subclass may want to call:
- void *top() const {return top_;}
- void *selection() const {return selection_;}
+ /**
+ Returns the item that appears at the top of the list.
+ */
+ void *top() const { return top_; }
+ /**
+ Returns the item currently selected, or NULL if there is no selection.
+
+ For multiple selection browsers this call returns the currently focused item,
+ even if it is not selected. To find all selected items, call
+ Fl_Multi_Browser::selected() for every item in question.
+ */
+ void *selection() const { return selection_; }
void new_list(); // completely clobber all data, as though list replaced
- void deleting(void *a); // get rid of any pointers to a
+ void deleting(void *item); // get rid of any pointers to item
void replacing(void *a,void *b); // change a pointers to b
void swapping(void *a,void *b); // exchange pointers a and b
void inserting(void *a,void *b); // insert b near a
- int displayed(void *) const ; // true if this line is visible
- void redraw_line(void *); // minimal update, no change in size
- void redraw_lines() {damage(FL_DAMAGE_SCROLL);} // redraw all of them
- void bbox(int&,int&,int&,int&) const;
+ int displayed(void *item) const ; // true if this item is visible
+ void redraw_line(void *item); // minimal update, no change in size
+ /**
+ This method will cause the entire list to be redrawn.
+ \see redraw_lines(), redraw_line()
+ */
+ void redraw_lines() { damage(FL_DAMAGE_SCROLL); } // redraw all of them
+ void bbox(int &X,int &Y,int &W,int &H) const;
int leftedge() const; // x position after scrollbar & border
- void *find_item(int my); // item under mouse
- void draw(int,int,int,int);
- int handle(int,int,int,int,int);
-
+ void *find_item(int ypos); // item under mouse
+
void draw();
- Fl_Browser_(int,int,int,int,const char * = 0);
+ Fl_Browser_(int X,int Y,int W,int H,const char *L=0);
public:
- Fl_Scrollbar scrollbar; // Vertical scrollbar
- Fl_Scrollbar hscrollbar; // Horizontal scrollbar
+ /**
+ Vertical scrollbar. Public, so that it can be accessed directly.
+ */
+ Fl_Scrollbar scrollbar;
+ /**
+ Horizontal scrollbar. Public, so that it can be accessed directly.
+ */
+ Fl_Scrollbar hscrollbar;
- int handle(int);
- void resize(int,int,int,int);
+ int handle(int event);
+ void resize(int X,int Y,int W,int H);
- int select(void *,int=1,int docallbacks=0);
- int select_only(void *,int docallbacks=0);
+ int select(void *item,int val=1,int docallbacks=0);
+ int select_only(void *item,int docallbacks=0);
int deselect(int docallbacks=0);
- int position() const {return position_;}
- int hposition() const {return hposition_;}
- void position(int); // scroll to here
+ /**
+ Gets the vertical scroll position of the list as a pixel position \p pos.
+ The position returned is how many pixels of the list are scrolled off the top edge
+ of the screen. Example: A position of '3' indicates the top 3 pixels of
+ the list are scrolled off the top edge of the screen.
+ \see position(), hposition()
+ */
+ int position() const { return position_; }
+ void position(int pos); // scroll to here
+ /**
+ Gets the horizontal scroll position of the list as a pixel position \p pos.
+ The position returned is how many pixels of the list are scrolled off the left edge
+ of the screen. Example: A position of '18' indicates the left 18 pixels of
+ the list are scrolled off the left edge of the screen.
+ \see position(), hposition()
+ */
+ int hposition() const { return hposition_; }
void hposition(int); // pan to here
- void display(void*); // scroll so this item is shown
+ void display(void *item); // scroll so this item is shown
- uchar has_scrollbar() const {return has_scrollbar_;}
- void has_scrollbar(uchar i) {has_scrollbar_ = i;}
+ /**
+ Values for has_scrollbar().
+ */
+ /** Anonymous enum bit flags for has_scrollbar().
+ - bit 0: horizontal
+ - bit 1: vertical
+ - bit 2: 'always' (to be combined with bits 0 and 1)
+ - bit 3-31: reserved for future use
+ */
enum { // values for has_scrollbar()
- HORIZONTAL = 1,
- VERTICAL = 2,
- BOTH = 3,
- ALWAYS_ON = 4,
- HORIZONTAL_ALWAYS = 5,
- VERTICAL_ALWAYS = 6,
- BOTH_ALWAYS = 7
+ HORIZONTAL = 1, ///< Only show horizontal scrollbar.
+ VERTICAL = 2, ///< Only show vertical scrollbar.
+ BOTH = 3, ///< Show both scrollbars. (default)
+ ALWAYS_ON = 4, ///< Specified scrollbar(s) should 'always' be shown (to be used with HORIZONTAL/VERTICAL)
+ HORIZONTAL_ALWAYS = 5, ///< Horizontal scrollbar always on.
+ VERTICAL_ALWAYS = 6, ///< Vertical scrollbar always on.
+ BOTH_ALWAYS = 7 ///< Both scrollbars always on.
};
+ /**
+ Returns the current scrollbar mode, see Fl_Browser_::has_scrollbar(uchar)
+ */
+ uchar has_scrollbar() const { return has_scrollbar_; }
+ /**
+ Sets whether the widget should have scrollbars or not (default Fl_Browser_::BOTH).
+ By default you can scroll in both directions, and the scrollbars
+ disappear if the data will fit in the widget.
+ has_scrollbar() changes this based on the value of \p mode:
+
+ - 0 - No scrollbars.
- Fl_Font textfont() const {return (Fl_Font)textfont_;}
- void textfont(uchar s) {textfont_ = s;}
- uchar textsize() const {return textsize_;}
- void textsize(uchar s) {textsize_ = s;}
- Fl_Color textcolor() const {return (Fl_Color)textcolor_;}
- void textcolor(unsigned n) {textcolor_ = n;}
+ - Fl_Browser_::HORIZONTAL - Only a horizontal scrollbar.
- static void scrollbar_width(int b) {scrollbar_width_ = b;}
- static int scrollbar_width() {return scrollbar_width_;}
+ - Fl_Browser_::VERTICAL - Only a vertical scrollbar.
- // for back compatability:
- void scrollbar_right() {scrollbar.align(FL_ALIGN_RIGHT);}
- void scrollbar_left() {scrollbar.align(FL_ALIGN_LEFT);}
+ - Fl_Browser_::BOTH - The default is both scrollbars.
+ - Fl_Browser_::HORIZONTAL_ALWAYS - Horizontal scrollbar always on,
+ vertical always off.
+
+ - Fl_Browser_::VERTICAL_ALWAYS - Vertical scrollbar always on,
+ horizontal always off.
+
+ - Fl_Browser_::BOTH_ALWAYS - Both always on.
+ */
+ void has_scrollbar(uchar mode) { has_scrollbar_ = mode; }
+
+ /**
+ Gets the default text font for the lines in the browser.
+ \see textfont(), textsize(), textcolor()
+ */
+ Fl_Font textfont() const { return textfont_; }
+ /**
+ Sets the default text font for the lines in the browser to \p font.
+ */
+ void textfont(Fl_Font font) { textfont_ = font; }
+
+ /**
+ Gets the default text size (in pixels) for the lines in the browser.
+ */
+ Fl_Fontsize textsize() const { return textsize_; }
+ /**
+ Sets the default text size (in pixels) for the lines in the browser to \p size.
+ */
+ void textsize(Fl_Fontsize size) { textsize_ = size; }
+
+ /**
+ Gets the default text color for the lines in the browser.
+ */
+ Fl_Color textcolor() const { return (Fl_Color)textcolor_; }
+ /**
+ Sets the default text color for the lines in the browser to color \p col.
+ */
+ void textcolor(unsigned col) { textcolor_ = col; }
+
+ /**
+ Gets the current size of the scrollbars' troughs, in pixels.
+
+ If this value is zero (default), this widget will use the
+ Fl::scrollbar_size() value as the scrollbar's width.
+
+ \returns Scrollbar size in pixels, or 0 if the global Fl::scrollsize() is being used.
+ \see Fl::scrollbar_size(int)
+ */
+ int scrollbar_size() const {
+ return(scrollbar_size_);
+ }
+ /**
+ Sets the pixel size of the scrollbars' troughs to the \p size, in pixels.
+
+ Normally you should not need this method, and should use
+ Fl::scrollbar_size(int) instead to manage the size of ALL
+ your widgets' scrollbars. This ensures your application
+ has a consistent UI, is the default behavior, and is normally
+ what you want.
+
+ Only use THIS method if you really need to override the global
+ scrollbar size. The need for this should be rare.
+
+ Setting \p size to the special value of 0 causes the widget to
+ track the global Fl::scrollbar_size(), which is the default.
+
+ \param[in] size Sets the scrollbar size in pixels.\n
+ If 0 (default), scrollbar size tracks the global Fl::scrollbar_size()
+ \see Fl::scrollbar_size()
+ */
+ void scrollbar_size(int size) {
+ scrollbar_size_ = size;
+ }
+ /**
+ This method has been deprecated, existing for backwards compatibility only.
+ Use scrollbar_size() instead.
+ This method always returns the global value Fl::scrollbar_size().
+ \returns Always returns the global value Fl::scrollbar_size().
+ \todo This method should eventually be removed in 1.4+
+ */
+ int scrollbar_width() const {
+ return(Fl::scrollbar_size());
+ }
+ /**
+ This method has been deprecated, existing for backwards compatibility only.
+ Use scrollbar_size(int) instead.
+ This method sets the global Fl::scrollbar_size(), and forces this
+ instance of the widget to use it.
+ \todo This method should eventually be removed in 1.4+
+ */
+ void scrollbar_width(int width) {
+ Fl::scrollbar_size(width);
+ scrollbar_size_ = 0;
+ }
+ /**
+ Moves the vertical scrollbar to the righthand side of the list.
+ For back compatibility.
+ */
+ void scrollbar_right() { scrollbar.align(FL_ALIGN_RIGHT); }
+ /**
+ Moves the vertical scrollbar to the lefthand side of the list.
+ For back compatibility.
+ */
+ void scrollbar_left() { scrollbar.align(FL_ALIGN_LEFT); }
+ void sort(int flags=0);
};
#endif
//
-// End of "$Id: Fl_Browser_.H 4879 2006-03-28 23:27:20Z matt $".
+// End of "$Id: Fl_Browser_.H 6737 2009-04-02 06:44:34Z greg.ercolano $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Button.H b/plugins/zynaddsubfx/fltk/FL/Fl_Button.H
index 15510b137..d71c06672 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Button.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Button.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Button.H 4288 2005-04-16 00:13:17Z mike $"
+// "$Id: Fl_Button.H 6614 2009-01-01 16:11:32Z matt $"
//
// Button header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,6 +25,9 @@
// http://www.fltk.org/str.php
//
+/* \file
+ Fl_Button widget . */
+
#ifndef Fl_Button_H
#define Fl_Button_H
@@ -33,13 +36,51 @@
#endif
// values for type()
-#define FL_NORMAL_BUTTON 0
-#define FL_TOGGLE_BUTTON 1
-#define FL_RADIO_BUTTON (FL_RESERVED_TYPE+2)
-#define FL_HIDDEN_BUTTON 3 // for Forms compatability
+#define FL_NORMAL_BUTTON 0 /**< value() will be set to 1 during the press of the button and
+ reverts back to 0 when the button is released */
+#define FL_TOGGLE_BUTTON 1 ///< value() toggles between 0 and 1 at every click of the button
+#define FL_RADIO_BUTTON (FL_RESERVED_TYPE+2) /**< is set to 1 at button press, and all other
+ buttons in the same group with type() == FL_RADIO_BUTTON
+ are set to zero.*/
+#define FL_HIDDEN_BUTTON 3 ///< for Forms compatibility
+#ifndef FL_DOXYGEN
extern FL_EXPORT int fl_old_shortcut(const char*);
+#endif
+/**
+ \class Fl_Button
+ \brief Buttons generate callbacks when they are clicked by the user.
+
+ You control exactly when and how by changing the values for type() and
+ when(). Buttons can also generate callbacks in response to \c FL_SHORTCUT
+ events. The button can either have an explicit shortcut(int s) value or a
+ letter shortcut can be indicated in the label() with an '\&' character
+ before it. For the label shortcut it does not matter if \e Alt is held
+ down, but if you have an input field in the same window, the user will have
+ to hold down the \e Alt key so that the input field does not eat the event
+ first as an \c FL_KEYBOARD event.
+
+ \todo Refactor the doxygen comments for Fl_Button type() documentation.
+
+ For an Fl_Button object, the type() call returns one of:
+ \li \c FL_NORMAL_BUTTON (0): value() remains unchanged after button press.
+ \li \c FL_TOGGLE_BUTTON: value() is inverted after button press.
+ \li \c FL_RADIO_BUTTON: value() is set to 1 after button press, and all other
+ buttons in the current group with type() == FL_RADIO_BUTTON
+ are set to zero.
+
+ \todo Refactor the doxygen comments for Fl_Button when() documentation.
+
+ For an Fl_Button object, the following when() values are useful, the default
+ being \c FL_WHEN_RELEASE:
+ \li \c 0: The callback is not done, instead changed() is turned on.
+ \li \c FL_WHEN_RELEASE: The callback is done after the user successfully
+ clicks the button, or when a shortcut is typed.
+ \li \c FL_WHEN_CHANGED: The callback is done each time the value() changes
+ (when the user pushes and releases the button, and as the mouse is
+ dragged around in and out of the button).
+*/
class FL_EXPORT Fl_Button : public Fl_Widget {
int shortcut_;
@@ -54,25 +95,82 @@ protected:
public:
virtual int handle(int);
- Fl_Button(int,int,int,int,const char * = 0);
- int value(int);
+
+ Fl_Button(int X, int Y, int W, int H, const char *L = 0);
+
+ int value(int v);
+
+ /**
+ Returns the current value of the button (0 or 1).
+ */
char value() const {return value_;}
+
+ /**
+ Same as \c value(1).
+ \see value(int v)
+ */
int set() {return value(1);}
+
+ /**
+ Same as \c value(0).
+ \see value(int v)
+ */
int clear() {return value(0);}
+
void setonly(); // this should only be called on FL_RADIO_BUTTONs
+
+ /**
+ Returns the current shortcut key for the button.
+ \retval int
+ */
int shortcut() const {return shortcut_;}
+
+ /**
+ Sets the shortcut key to \c s.
+ Setting this overrides the use of '\&' in the label().
+ The value is a bitwise OR of a key and a set of shift flags, for example:
+ FL_ALT | 'a', or
+ FL_ALT | (FL_F + 10), or just
+ 'a'.
+ A value of 0 disables the shortcut.
+
+ The key can be any value returned by Fl::event_key(), but will usually be
+ an ASCII letter. Use a lower-case letter unless you require the shift key
+ to be held down.
+
+ The shift flags can be any set of values accepted by Fl::event_state().
+ If the bit is on, that shift key must be pushed. Meta, Alt, Ctrl, and
+ Shift must be off if they are not in the shift flags (zero for the other
+ bits indicates a "don't care" setting).
+ \param[in] s bitwise OR of key and shift flags
+ */
void shortcut(int s) {shortcut_ = s;}
+
+ /**
+ Returns the current down box type, which is drawn when value() is non-zero.
+ \retval Fl_Boxtype
+ */
Fl_Boxtype down_box() const {return (Fl_Boxtype)down_box_;}
+
+ /**
+ Sets the down box type. The default value of 0 causes FLTK to figure out
+ the correct matching down version of box().
+ \param[in] b down box type
+ */
void down_box(Fl_Boxtype b) {down_box_ = b;}
- // back compatability:
+ /// (for backwards compatibility)
void shortcut(const char *s) {shortcut(fl_old_shortcut(s));}
+
+ /// (for backwards compatibility)
Fl_Color down_color() const {return selection_color();}
+
+ /// (for backwards compatibility)
void down_color(unsigned c) {selection_color(c);}
};
#endif
//
-// End of "$Id: Fl_Button.H 4288 2005-04-16 00:13:17Z mike $".
+// End of "$Id: Fl_Button.H 6614 2009-01-01 16:11:32Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Chart.H b/plugins/zynaddsubfx/fltk/FL/Fl_Chart.H
index a70593099..29b68ed44 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Chart.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Chart.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Chart.H 4288 2005-04-16 00:13:17Z mike $"
+// "$Id: Fl_Chart.H 6614 2009-01-01 16:11:32Z matt $"
//
// Forms chart header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,6 +25,9 @@
// http://www.fltk.org/str.php
//
+/* \file
+ Fl_Chart widget . */
+
#ifndef Fl_Chart_H
#define Fl_Chart_H
@@ -33,25 +36,48 @@
#endif
// values for type()
-#define FL_BAR_CHART 0
-#define FL_HORBAR_CHART 1
-#define FL_LINE_CHART 2
-#define FL_FILL_CHART 3
-#define FL_SPIKE_CHART 4
-#define FL_PIE_CHART 5
-#define FL_SPECIALPIE_CHART 6
+#define FL_BAR_CHART 0 /**< type() for Bar Chart variant */
+#define FL_HORBAR_CHART 1 /**< type() for Horizontal Bar Chart variant */
+#define FL_LINE_CHART 2 /**< type() for Line Chart variant */
+#define FL_FILL_CHART 3 /**< type() for Fill Line Chart variant */
+#define FL_SPIKE_CHART 4 /**< type() for Spike Chart variant */
+#define FL_PIE_CHART 5 /**< type() for Pie Chart variant */
+#define FL_SPECIALPIE_CHART 6 /**< type() for Special Pie Chart variant */
-#define FL_FILLED_CHART FL_FILL_CHART // compatibility
+#define FL_FILLED_CHART FL_FILL_CHART /**< for compatibility */
-#define FL_CHART_MAX 128
-#define FL_CHART_LABEL_MAX 18
+#define FL_CHART_MAX 128 /**< max entries per chart */
+#define FL_CHART_LABEL_MAX 18 /**< max label length for entry */
+/** For internal use only */
struct FL_CHART_ENTRY {
- float val;
- unsigned col;
- char str[FL_CHART_LABEL_MAX+1];
+ float val; /**< For internal use only. */
+ unsigned col; /**< For internal use only. */
+ char str[FL_CHART_LABEL_MAX+1]; /**< For internal use only. */
};
+/**
+ \class Fl_Chart
+ \brief Fl_Chart displays simple charts.
+ It is provided for Forms compatibility.
+
+ \image html charts.gif
+ \image latex charts.eps "Fl_Chart" width=10cm
+ \todo Refactor Fl_Chart::type() information.
+
+ The type of an Fl_Chart object can be set using type(uchar t) to:
+ \li \c FL_BAR_CHART: Each sample value is drawn as a vertical bar.
+ \li \c FL_FILLED_CHART: The chart is filled from the bottom of the graph
+ to the sample values.
+ \li \c FL_HORBAR_CHART: Each sample value is drawn as a horizontal bar.
+ \li \c FL_LINE_CHART: The chart is drawn as a polyline with vertices at
+ each sample value.
+ \li \c FL_PIE_CHART: A pie chart is drawn with each sample value being
+ drawn as a proportionate slice in the circle.
+ \li \c FL_SPECIALPIE_CHART: Like \c FL_PIE_CHART, but the first slice is
+ separated from the pie.
+ \li \c FL_SPIKE_CHART: Each sample value is drawn as a vertical line.
+ */
class FL_EXPORT Fl_Chart : public Fl_Widget {
int numb;
int maxnumb;
@@ -59,35 +85,76 @@ class FL_EXPORT Fl_Chart : public Fl_Widget {
FL_CHART_ENTRY *entries;
double min,max;
uchar autosize_;
- uchar textfont_,textsize_;
+ Fl_Font textfont_;
+ Fl_Fontsize textsize_;
unsigned textcolor_;
protected:
void draw();
public:
- Fl_Chart(int,int,int,int,const char * = 0);
+ Fl_Chart(int X, int Y, int W, int H, const char *L = 0);
+
~Fl_Chart();
+
void clear();
- void add(double, const char * =0, unsigned=0);
- void insert(int, double, const char * =0, unsigned=0);
- void replace(int, double, const char * =0, unsigned=0);
+
+ void add(double val, const char *str = 0, unsigned col = 0);
+
+ void insert(int ind, double val, const char *str = 0, unsigned col = 0);
+
+ void replace(int ind, double val, const char *str = 0, unsigned col = 0);
+
+ /**
+ Gets the lower and upper bounds of the chart values.
+ \param[out] a, b are set to lower, upper
+ */
void bounds(double *a,double *b) const {*a = min; *b = max;}
+
void bounds(double a,double b);
+
+ /**
+ Returns the number of data values in the chart.
+ */
int size() const {return numb;}
+
void size(int W, int H) { Fl_Widget::size(W, H); }
+
+ /**
+ Gets the maximum number of data values for a chart.
+ */
int maxsize() const {return maxnumb;}
- void maxsize(int);
- Fl_Font textfont() const {return (Fl_Font)textfont_;}
- void textfont(uchar s) {textfont_ = s;}
- uchar textsize() const {return textsize_;}
- void textsize(uchar s) {textsize_ = s;}
+
+ void maxsize(int m);
+
+ /** Gets the chart's text font */
+ Fl_Font textfont() const {return textfont_;}
+ /** Sets the chart's text font to \p s. */
+ void textfont(Fl_Font s) {textfont_ = s;}
+
+ /** Gets the chart's text size */
+ Fl_Fontsize textsize() const {return textsize_;}
+ /** gets the chart's text size to \p s. */
+ void textsize(Fl_Fontsize s) {textsize_ = s;}
+
+ /** Gets the chart's text color */
Fl_Color textcolor() const {return (Fl_Color)textcolor_;}
+ /** gets the chart's text color to \p n. */
void textcolor(unsigned n) {textcolor_ = n;}
+
+ /**
+ Get whether the chart will automatically adjust the bounds of the chart.
+ \returns non-zero if auto-sizing is enabled and zero if disabled.
+ */
uchar autosize() const {return autosize_;}
+
+ /**
+ Set whether the chart will automatically adjust the bounds of the chart.
+ \param[in] n non-zero to enable automatic resizing, zero to disable.
+ */
void autosize(uchar n) {autosize_ = n;}
};
#endif
//
-// End of "$Id: Fl_Chart.H 4288 2005-04-16 00:13:17Z mike $".
+// End of "$Id: Fl_Chart.H 6614 2009-01-01 16:11:32Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Check_Browser.H b/plugins/zynaddsubfx/fltk/FL/Fl_Check_Browser.H
index b3c741d33..c61c690ab 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Check_Browser.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Check_Browser.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Check_Browser.H 5979 2007-11-19 15:46:24Z matt $"
+// "$Id: Fl_Check_Browser.H 6614 2009-01-01 16:11:32Z matt $"
//
// Fl_Check_Browser header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,12 +25,19 @@
// http://www.fltk.org/str.php
//
+/* \file
+ Fl_Check_Browser widget . */
+
#ifndef Fl_Check_Browser_H
#define Fl_Check_Browser_H
#include "Fl.H"
#include "Fl_Browser_.H"
+/**
+ The Fl_Check_Browser widget displays a scrolling list of text
+ lines that may be selected and/or checked by the user.
+*/
class FL_EXPORT Fl_Check_Browser : public Fl_Browser_ {
/* required routines for Fl_Browser_ subclass: */
@@ -47,13 +54,16 @@ class FL_EXPORT Fl_Check_Browser : public Fl_Browser_ {
public: // IRIX 5.3 C++ compiler doesn't support private structures...
+#ifndef FL_DOXYGEN
+ /** For internal use only. */
struct cb_item {
- cb_item *next;
- cb_item *prev;
- char checked;
- char selected;
- char *text;
+ cb_item *next; /**< For internal use only. */
+ cb_item *prev; /**< For internal use only. */
+ char checked; /**< For internal use only. */
+ char selected; /**< For internal use only. */
+ char *text; /**< For internal use only. */
};
+#endif // !FL_DOXYGEN
private:
@@ -69,6 +79,7 @@ class FL_EXPORT Fl_Check_Browser : public Fl_Browser_ {
public:
Fl_Check_Browser(int x, int y, int w, int h, const char *l = 0);
+ /** The destructor deletes all list items and destroys the browser. */
~Fl_Check_Browser() { clear(); }
int add(char *s); // add an (unchecked) item
int add(char *s, int b); // add an item and set checked
@@ -76,14 +87,22 @@ class FL_EXPORT Fl_Check_Browser : public Fl_Browser_ {
int remove(int item); // delete an item. Returns nitems()
// inline const char * methods to avoid breaking binary compatibility...
+ /** See int Fl_Check_Browser::add(char *s) */
int add(const char *s) { return add((char *)s); }
+ /** See int Fl_Check_Browser::add(char *s) */
int add(const char *s, int b) { return add((char *)s, b); }
void clear(); // delete all items
+ /**
+ Returns how many lines are in the browser. The last line number is equal to
+ this.
+ */
int nitems() const { return nitems_; }
+ /** Returns how many items are currently checked. */
int nchecked() const { return nchecked_; }
int checked(int item) const;
void checked(int item, int b);
+ /** Equivalent to Fl_Check_Browser::checked(item, 1). */
void set_checked(int item) { checked(item, 1); }
void check_all();
void check_none();
@@ -98,6 +117,6 @@ class FL_EXPORT Fl_Check_Browser : public Fl_Browser_ {
#endif // Fl_Check_Browser_H
//
-// End of "$Id: Fl_Check_Browser.H 5979 2007-11-19 15:46:24Z matt $".
+// End of "$Id: Fl_Check_Browser.H 6614 2009-01-01 16:11:32Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Check_Button.H b/plugins/zynaddsubfx/fltk/FL/Fl_Check_Button.H
index 4064cf5b9..38eecb9a1 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Check_Button.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Check_Button.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Check_Button.H 4288 2005-04-16 00:13:17Z mike $"
+// "$Id: Fl_Check_Button.H 6614 2009-01-01 16:11:32Z matt $"
//
// Check button header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,18 +25,36 @@
// http://www.fltk.org/str.php
//
+/* \file
+ Fl_Check_Button widget . */
+
#ifndef Fl_Check_Button_H
#define Fl_Check_Button_H
#include "Fl_Light_Button.H"
+/**
+ \class Fl_Check_Button
+ \brief A button with an "checkmark" to show its status.
+
+ \image html Fl_Check_Button.gif
+ \image latex Fl_Check_Button.eps "Fl_Check_Button" width=4cm
+ Buttons generate callbacks when they are clicked by the user. You control
+ exactly when and how by changing the values for type() and when().
+
+ The Fl_Check_Button subclass displays its "ON" state by showing a "checkmark"
+ rather than drawing itself pushed in.
+
+ \todo Refactor Fl_Check_Button doxygen comments (add color() info etc?)
+ \todo Generate Fl_Check_Button.gif with visible checkmark.
+ */
class FL_EXPORT Fl_Check_Button : public Fl_Light_Button {
public:
- Fl_Check_Button(int x,int y,int w,int h,const char *l = 0);
+ Fl_Check_Button(int X, int Y, int W, int H, const char *L = 0);
};
#endif
//
-// End of "$Id: Fl_Check_Button.H 4288 2005-04-16 00:13:17Z mike $".
+// End of "$Id: Fl_Check_Button.H 6614 2009-01-01 16:11:32Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Choice.H b/plugins/zynaddsubfx/fltk/FL/Fl_Choice.H
index 64e59b68f..50bb1e4e1 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Choice.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Choice.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Choice.H 4288 2005-04-16 00:13:17Z mike $"
+// "$Id: Fl_Choice.H 6614 2009-01-01 16:11:32Z matt $"
//
// Choice header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,24 +25,84 @@
// http://www.fltk.org/str.php
//
+/* \file
+ Fl_Choice widget . */
+
#ifndef Fl_Choice_H
#define Fl_Choice_H
#include "Fl_Menu_.H"
+/**
+ \class Fl_Choice
+ \brief A button that is used to pop up a menu.
+
+ This is a button that, when pushed, pops up a menu (or hierarchy of menus)
+ defined by an array of Fl_Menu_Item objects.
+ Motif calls this an OptionButton.
+
+ The only difference between this and a Fl_Menu_Button is that the name of
+ the most recent chosen menu item is displayed inside the box, while the
+ label is displayed outside the box. However, since the use of this is most
+ often to control a single variable rather than do individual callbacks,
+ some of the Fl_Menu_Button methods are redescribed here in those terms.
+
+ When the user picks an item off the menu the value() is set to that item
+ and then the item's callback is done with the menu_button as the
+ \c Fl_Widget* argument. If the item does not have a callback the
+ menu_button's callback is done instead.
+
+ All three mouse buttons pop up the menu. The Forms behavior of the first
+ two buttons to increment/decrement the choice is not implemented. This
+ could be added with a subclass, however.
+
+ The menu will also pop up in response to shortcuts indicated by putting
+ a '\&' character in the label(). See Fl_Button::shortcut(int s) for a
+ description of this.
+
+ Typing the shortcut() of any of the items will do exactly the same as when
+ you pick the item with the mouse. The '\&' character in item names are
+ only looked at when the menu is popped up, however.
+
+ \image html choice.gif
+ \image latex choice.eps "Fl_Choice" width=4cm
+ \todo Refactor the doxygen comments for Fl_Choice changed() documentation.
+
+ \li int Fl_Widget::changed() const
+ This value is true the user picks a different value. It is turned
+ off by value() and just before doing a callback (the callback can turn
+ it back on if desired).
+ \li void Fl_Widget::set_changed()
+ This method sets the changed() flag.
+ \li void Fl_Widget::clear_changed()
+ This method clears the changed() flag.
+ \li Fl_Boxtype Fl_Choice::down_box() const
+ Gets the current down box, which is used when the menu is popped up.
+ The default down box type is \c FL_DOWN_BOX.
+ \li void Fl_Choice::down_box(Fl_Boxtype b)
+ Sets the current down box type to \p b.
+ */
class FL_EXPORT Fl_Choice : public Fl_Menu_ {
protected:
void draw();
public:
int handle(int);
- Fl_Choice(int,int,int,int,const char * = 0);
- int value(const Fl_Menu_Item*);
- int value(int i);
+
+ Fl_Choice(int X, int Y, int W, int H, const char *L = 0);
+
+ /**
+ Gets the index of the last item chosen by the user.
+ The index is zero initially.
+ */
int value() const {return Fl_Menu_::value();}
+
+ int value(int v);
+
+ int value(const Fl_Menu_Item* v);
};
#endif
//
-// End of "$Id: Fl_Choice.H 4288 2005-04-16 00:13:17Z mike $".
+// End of "$Id: Fl_Choice.H 6614 2009-01-01 16:11:32Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Clock.H b/plugins/zynaddsubfx/fltk/FL/Fl_Clock.H
index 261470c9f..fcd6bd745 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Clock.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Clock.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Clock.H 4288 2005-04-16 00:13:17Z mike $"
+// "$Id: Fl_Clock.H 6754 2009-04-12 11:32:22Z AlbrechtS $"
//
// Clock header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,6 +25,9 @@
// http://www.fltk.org/str.php
//
+/* \file
+ Fl_Clock, Fl_Clock_Output widgets . */
+
#ifndef Fl_Clock_H
#define Fl_Clock_H
@@ -33,43 +36,102 @@
#endif
// values for type:
-#define FL_SQUARE_CLOCK 0
-#define FL_ROUND_CLOCK 1
-#define FL_ANALOG_CLOCK FL_SQUARE_CLOCK
-#define FL_DIGITAL_CLOCK FL_SQUARE_CLOCK // nyi
+#define FL_SQUARE_CLOCK 0 /**< type() of Square Clock variant */
+#define FL_ROUND_CLOCK 1 /**< type() of Round Clock variant */
+#define FL_ANALOG_CLOCK FL_SQUARE_CLOCK /**< An analog clock is square */
+#define FL_DIGITAL_CLOCK FL_SQUARE_CLOCK /**< Not yet implemented */
-// a Fl_Clock_Output can be used to display a program-supplied time:
+// fabien: Please keep the horizontal formatting of both images in class desc,
+// don't loose vert. space for nothing!
+/**
+ \class Fl_Clock_Output
+ \brief This widget can be used to display a program-supplied time.
+
+ The time shown on the clock is not updated. To display the current time,
+ use Fl_Clock instead.
+
+ \htmlonly
+ type() FL_SQUARE_CLOCK and FL_ROUND_CLOCK | \endhtmlonly
+ \image html clock.gif
+ \htmlonly | \endhtmlonly
+ \image html round_clock.gif
+ \htmlonly |
\endhtmlonly
+ \image latex clock.eps "FL_SQUARE_CLOCK type" width=4cm
+ \image latex round_clock.eps "FL_ROUND_CLOCK type" width=4cm
+ */
class FL_EXPORT Fl_Clock_Output : public Fl_Widget {
int hour_, minute_, second_;
ulong value_;
void drawhands(Fl_Color,Fl_Color); // part of draw
protected:
- void draw(int, int, int, int);
void draw();
+ void draw(int X, int Y, int W, int H);
public:
- Fl_Clock_Output(int x,int y,int w,int h, const char *l = 0);
+
+ Fl_Clock_Output(int X, int Y, int W, int H, const char *L = 0);
+
void value(ulong v); // set to this Unix time
- void value(int,int,int); // set hour, minute, second
+
+ void value(int H, int m, int s);
+
+ /**
+ Returns the displayed time.
+ Returns the time in seconds since the UNIX epoch (January 1, 1970).
+ \see value(ulong)
+ */
ulong value() const {return value_;}
+
+ /**
+ Returns the displayed hour (0 to 23).
+ \see value(), minute(), second()
+ */
int hour() const {return hour_;}
+
+ /**
+ Returns the displayed minute (0 to 59).
+ \see value(), hour(), second()
+ */
int minute() const {return minute_;}
+
+ /**
+ Returns the displayed second (0 to 60, 60=leap second).
+ \see value(), hour(), minute()
+ */
int second() const {return second_;}
};
// a Fl_Clock displays the current time always by using a timeout:
+/**
+ \class Fl_Clock
+ \brief This widget provides a round analog clock display.
+
+ Fl_Clock is provided for Forms compatibility.
+ It installs a 1-second timeout callback using Fl::add_timeout().
+ You can choose the rounded or square type of the the clock with type(), see below.
+ \htmlonly
+ type() FL_SQUARE_CLOCK and FL_ROUND_CLOCK | \endhtmlonly
+ \image html clock.gif
+ \htmlonly | \endhtmlonly
+ \image html round_clock.gif
+ \htmlonly |
\endhtmlonly
+ \image latex clock.eps "FL_SQUARE_CLOCK type" width=4cm
+ \image latex round_clock.eps "FL_ROUND_CLOCK type" width=4cm
+ */
class FL_EXPORT Fl_Clock : public Fl_Clock_Output {
public:
int handle(int);
- void update();
- Fl_Clock(int x,int y,int w,int h, const char *l = 0);
- Fl_Clock(uchar t,int x,int y,int w,int h, const char *l);
+
+ Fl_Clock(int X, int Y, int W, int H, const char *L = 0);
+
+ Fl_Clock(uchar t, int X, int Y, int W, int H, const char *L);
+
~Fl_Clock();
};
#endif
//
-// End of "$Id: Fl_Clock.H 4288 2005-04-16 00:13:17Z mike $".
+// End of "$Id: Fl_Clock.H 6754 2009-04-12 11:32:22Z AlbrechtS $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Color_Chooser.H b/plugins/zynaddsubfx/fltk/FL/Fl_Color_Chooser.H
index 2ef725063..890c67cc2 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Color_Chooser.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Color_Chooser.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Color_Chooser.H 4288 2005-04-16 00:13:17Z mike $"
+// "$Id: Fl_Color_Chooser.H 6614 2009-01-01 16:11:32Z matt $"
//
// Color chooser header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,6 +25,9 @@
// http://www.fltk.org/str.php
//
+/** \file
+ Fl_Color_Chooser widget . */
+
// The color chooser object and the color chooser popup. The popup
// is just a window containing a single color chooser and some boxes
// to indicate the current and cancelled color.
@@ -38,6 +41,9 @@
#include
#include
+#ifndef FL_DOXYGEN
+
+/** For internal use only */
class FL_EXPORT Flcc_HueBox : public Fl_Widget {
int px, py;
protected:
@@ -49,6 +55,7 @@ public:
px = py = 0;}
};
+/** For internal use only */
class FL_EXPORT Flcc_ValueBox : public Fl_Widget {
int py;
protected:
@@ -60,12 +67,52 @@ public:
py = 0;}
};
+/** For internal use only */
class FL_EXPORT Flcc_Value_Input : public Fl_Value_Input {
public:
int format(char*);
Flcc_Value_Input(int X, int Y, int W, int H) : Fl_Value_Input(X,Y,W,H) {}
};
+#endif // !FL_DOXYGEN
+
+/** \addtogroup group_comdlg
+ @{ */
+
+/**
+ \class Fl_Color_Chooser
+ \brief The Fl_Color_Chooser widget provides a standard RGB color chooser.
+
+ \image html fl_color_chooser.jpg
+ \image latex fl_color_chooser.eps "fl_color_chooser()" width=5cm
+
+ You can place any number of the widgets into a panel of your own design.
+ The diagram shows the widget as part of a color chooser dialog created by
+ the fl_color_chooser() function. The Fl_Color_Chooser widget contains the
+ hue box, value slider, and rgb input fields from the above diagram (it
+ does not have the color chips or the Cancel or OK buttons).
+ The callback is done every time the user changes the rgb value. It is not
+ done if they move the hue control in a way that produces the \e same rgb
+ value, such as when saturation or value is zero.
+
+ The fl_color_chooser() function pops up a window to let the user pick an
+ arbitrary RGB color. They can pick the hue and saturation in the "hue box"
+ on the left (hold down CTRL to just change the saturation), and the
+ brightness using the vertical slider. Or they can type the 8-bit numbers
+ into the RGB Fl_Value_Input fields, or drag the mouse across them to adjust
+ them. The pull-down menu lets the user set the input fields to show RGB,
+ HSV, or 8-bit RGB (0 to 255).
+
+ fl_color_chooser() returns non-zero if the user picks ok, and updates the
+ RGB values. If the user picks cancel or closes the window this returns
+ zero and leaves RGB unchanged.
+
+ If you use the color chooser on an 8-bit screen, it will allocate all the
+ available colors, leaving you no space to exactly represent the color the
+ user picks! You can however use fl_rectf() to fill a region with a simulated
+ color using dithering.
+ */
+/** @} */
class FL_EXPORT Fl_Color_Chooser : public Fl_Group {
Flcc_HueBox huebox;
Flcc_ValueBox valuebox;
@@ -80,18 +127,56 @@ class FL_EXPORT Fl_Color_Chooser : public Fl_Group {
static void rgb_cb(Fl_Widget*, void*);
static void mode_cb(Fl_Widget*, void*);
public:
+ /** Returns which Fl_Color_Chooser variant is currently active */
int mode() {return choice.value();}
+
+ /**
+ Returns the current hue.
+ 0 <= hue < 6. Zero is red, one is yellow, two is green, etc.
+ This value is convenient for the internal calculations - some other
+ systems consider hue to run from zero to one, or from 0 to 360.
+ */
double hue() const {return hue_;}
+
+ /**
+ Returns the saturation.
+ 0 <= saturation <= 1.
+ */
double saturation() const {return saturation_;}
+
+ /**
+ Returns the value/brightness.
+ 0 <= value <= 1.
+ */
double value() const {return value_;}
+
+ /**
+ Returns the current red value.
+ 0 <= r <= 1.
+ */
double r() const {return r_;}
+
+ /**
+ Returns the current green value.
+ 0 <= g <= 1.
+ */
double g() const {return g_;}
+
+ /**
+ Returns the current blue value.
+ 0 <= b <= 1.
+ */
double b() const {return b_;}
- int hsv(double,double,double);
- int rgb(double,double,double);
- static void hsv2rgb(double, double, double,double&,double&,double&);
- static void rgb2hsv(double, double, double,double&,double&,double&);
- Fl_Color_Chooser(int,int,int,int,const char* = 0);
+
+ int hsv(double H, double S, double V);
+
+ int rgb(double R, double G, double B);
+
+ static void hsv2rgb(double H, double S, double V, double& R, double& G, double& B);
+
+ static void rgb2hsv(double R, double G, double B, double& H, double& S, double& V);
+
+ Fl_Color_Chooser(int X, int Y, int W, int H, const char *L = 0);
};
FL_EXPORT int fl_color_chooser(const char* name, double& r, double& g, double& b);
@@ -100,5 +185,5 @@ FL_EXPORT int fl_color_chooser(const char* name, uchar& r, uchar& g, uchar& b);
#endif
//
-// End of "$Id: Fl_Color_Chooser.H 4288 2005-04-16 00:13:17Z mike $".
+// End of "$Id: Fl_Color_Chooser.H 6614 2009-01-01 16:11:32Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Counter.H b/plugins/zynaddsubfx/fltk/FL/Fl_Counter.H
index 73781a8b8..e52c092c5 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Counter.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Counter.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Counter.H 4288 2005-04-16 00:13:17Z mike $"
+// "$Id: Fl_Counter.H 6716 2009-03-24 01:40:44Z fabien $"
//
// Counter header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,6 +25,9 @@
// http://www.fltk.org/str.php
//
+/* \file
+ Fl_Counter widget . */
+
// A numerical value with up/down step buttons. From Forms.
#ifndef Fl_Counter_H
@@ -35,12 +38,26 @@
#endif
// values for type():
-#define FL_NORMAL_COUNTER 0
-#define FL_SIMPLE_COUNTER 1
+#define FL_NORMAL_COUNTER 0 /**< type() for counter with fast buttons */
+#define FL_SIMPLE_COUNTER 1 /**< type() for counter without fast buttons */
+/**
+ Controls a single floating point value with button (or keyboard) arrows.
+ Double arrows buttons achieve larger steps than simple arrows.
+ \see Fl_Spinner for value input with vertical step arrows.
+ \image html counter.gif
+ \image latex counter.eps "Fl_Counter" width=4cm
+
+ \todo Refactor the doxygen comments for Fl_Counter type() documentation.
+
+ The type of an Fl_Counter object can be set using type(uchar t) to:
+ \li \c FL_NORMAL_COUNTER: Displays a counter with 4 arrow buttons.
+ \li \c FL_SIMPLE_COUNTER: Displays a counter with only 2 arrow buttons.
+*/
class FL_EXPORT Fl_Counter : public Fl_Valuator {
- uchar textfont_, textsize_;
+ Fl_Font textfont_;
+ Fl_Fontsize textsize_;
unsigned textcolor_;
double lstep_;
uchar mouseobj;
@@ -55,16 +72,47 @@ protected:
public:
int handle(int);
- Fl_Counter(int,int,int,int,const char * = 0);
+
+ Fl_Counter(int X, int Y, int W, int H, const char* L = 0);
~Fl_Counter();
+
+ /**
+ Sets the increment for the large step buttons.
+ The default value is 1.0.
+ \param[in] a large step increment.
+ */
void lstep(double a) {lstep_ = a;}
+
+ /**
+ Sets the increments for the normal and large step buttons.
+ \param[in] a, b normal and large step increments.
+ */
void step(double a,double b) {Fl_Valuator::step(a); lstep_ = b;}
+
+ /**
+ Sets the increment for the normal step buttons.
+ \param[in] a normal step increment.
+ */
void step(double a) {Fl_Valuator::step(a);}
- Fl_Font textfont() const {return (Fl_Font)textfont_;}
- void textfont(uchar s) {textfont_ = s;}
- uchar textsize() const {return textsize_;}
- void textsize(uchar s) {textsize_ = s;}
+
+ /**
+ Returns the increment for normal step buttons.
+ */
+ double step() {return Fl_Valuator::step();}
+
+ /** Gets the text font */
+ Fl_Font textfont() const {return textfont_;}
+ /** Sets the text font to \p s */
+ void textfont(Fl_Font s) {textfont_ = s;}
+
+ /** Gets the font size */
+ Fl_Fontsize textsize() const {return textsize_;}
+ /** Sets the font size to \p s */
+ void textsize(Fl_Fontsize s) {textsize_ = s;}
+
+ /** Gets the font color */
Fl_Color textcolor() const {return (Fl_Color)textcolor_;}
+ /** Sets the font color to \p s */
void textcolor(unsigned s) {textcolor_ = s;}
};
@@ -72,5 +120,5 @@ public:
#endif
//
-// End of "$Id: Fl_Counter.H 4288 2005-04-16 00:13:17Z mike $".
+// End of "$Id: Fl_Counter.H 6716 2009-03-24 01:40:44Z fabien $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Dial.H b/plugins/zynaddsubfx/fltk/FL/Fl_Dial.H
index f067036ff..5ca33ec0c 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Dial.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Dial.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Dial.H 4288 2005-04-16 00:13:17Z mike $"
+// "$Id: Fl_Dial.H 6614 2009-01-01 16:11:32Z matt $"
//
// Dial header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,6 +25,9 @@
// http://www.fltk.org/str.php
//
+/* \file
+ Fl_Dial widget . */
+
#ifndef Fl_Dial_H
#define Fl_Dial_H
@@ -33,10 +36,23 @@
#endif
// values for type():
-#define FL_NORMAL_DIAL 0
-#define FL_LINE_DIAL 1
-#define FL_FILL_DIAL 2
+#define FL_NORMAL_DIAL 0 /**< type() for dial variant with dot */
+#define FL_LINE_DIAL 1 /**< type() for dial variant with line */
+#define FL_FILL_DIAL 2 /**< type() for dial variant with filled arc */
+/**
+ The Fl_Dial widget provides a circular dial to control a
+ single floating point value.
+ \image html dial.gif
+ \image latex dial.eps "Fl_Dial" width=4cm
+ Use type() to set the type of the dial to:
+
+ - FL_NORMAL_DIAL - Draws a normal dial with a knob.
+ - FL_LINE_DIAL - Draws a dial with a line.
+ - FL_FILL_DIAL - Draws a dial with a filled arc.
+
+
+*/
class FL_EXPORT Fl_Dial : public Fl_Valuator {
short a1,a2;
@@ -44,18 +60,32 @@ class FL_EXPORT Fl_Dial : public Fl_Valuator {
protected:
// these allow subclasses to put the dial in a smaller area:
- void draw(int, int, int, int);
- int handle(int, int, int, int, int);
+ void draw(int X, int Y, int W, int H);
+ int handle(int event, int X, int Y, int W, int H);
void draw();
public:
int handle(int);
+ /**
+ Creates a new Fl_Dial widget using the given position, size,
+ and label string. The default type is FL_NORMAL_DIAL.
+ */
Fl_Dial(int x,int y,int w,int h, const char *l = 0);
+ /**
+ Sets Or gets the angles used for the minimum and maximum values. The default
+ values are 45 and 315 (0 degrees is straight down and the angles
+ progress clockwise). Normally angle1 is less than angle2, but if you
+ reverse them the dial moves counter-clockwise.
+ */
short angle1() const {return a1;}
+ /** See short angle1() const */
void angle1(short a) {a1 = a;}
+ /** See short angle1() const */
short angle2() const {return a2;}
+ /** See short angle1() const */
void angle2(short a) {a2 = a;}
+ /** See short angle1() const */
void angles(short a, short b) {a1 = a; a2 = b;}
};
@@ -63,5 +93,5 @@ public:
#endif
//
-// End of "$Id: Fl_Dial.H 4288 2005-04-16 00:13:17Z mike $".
+// End of "$Id: Fl_Dial.H 6614 2009-01-01 16:11:32Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Double_Window.H b/plugins/zynaddsubfx/fltk/FL/Fl_Double_Window.H
index 635c7cb3c..f67e9f245 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Double_Window.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Double_Window.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Double_Window.H 4288 2005-04-16 00:13:17Z mike $"
+// "$Id: Fl_Double_Window.H 6614 2009-01-01 16:11:32Z matt $"
//
// Double-buffered window header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,15 +25,35 @@
// http://www.fltk.org/str.php
//
+/* \file
+ Fl_Double_Window widget . */
+
#ifndef Fl_Double_Window_H
#define Fl_Double_Window_H
#include "Fl_Window.H"
+/**
+ The Fl_Double_Window provides a double-buffered window.
+ If possible this will use the X double buffering extension (Xdbe). If
+ not, it will draw the window data into an off-screen pixmap, and then
+ copy it to the on-screen window.
+ It is highly recommended that you put the following code before the
+ first show() of any window in your program:
+ \code
+ Fl::visual(FL_DOUBLE|FL_INDEX)
+ \endcode
+ This makes sure you can use Xdbe on servers where double buffering
+ does not exist for every visual.
+*/
class FL_EXPORT Fl_Double_Window : public Fl_Window {
protected:
void flush(int eraseoverlay);
- char force_doublebuffering_; // force db, even if the OS already buffers windows (overlays need that on MacOS and Windows2000)
+ /**
+ Force double buffering, even if the OS already buffers windows
+ (overlays need that on MacOS and Windows2000)
+ */
+ char force_doublebuffering_;
public:
void show();
void show(int a, char **b) {Fl_Window::show(a,b);}
@@ -41,8 +61,15 @@ public:
void resize(int,int,int,int);
void hide();
~Fl_Double_Window();
+ /**
+ Creates a new Fl_Double_Window widget using the given
+ position, size, and label (title) string.
+ */
Fl_Double_Window(int W, int H, const char *l = 0)
: Fl_Window(W,H,l), force_doublebuffering_(0) { type(FL_DOUBLE_WINDOW); }
+ /**
+ See Fl_Double_Window::Fl_Double_Window(int w, int h, const char *label = 0)
+ */
Fl_Double_Window(int X, int Y, int W, int H, const char *l = 0)
: Fl_Window(X,Y,W,H,l), force_doublebuffering_(0) { type(FL_DOUBLE_WINDOW); }
};
@@ -50,5 +77,5 @@ public:
#endif
//
-// End of "$Id: Fl_Double_Window.H 4288 2005-04-16 00:13:17Z mike $".
+// End of "$Id: Fl_Double_Window.H 6614 2009-01-01 16:11:32Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Export.H b/plugins/zynaddsubfx/fltk/FL/Fl_Export.H
index 267f63222..73887dc46 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Export.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Export.H
@@ -1,9 +1,9 @@
/*
- * "$Id: Fl_Export.H 4288 2005-04-16 00:13:17Z mike $"
+ * "$Id: Fl_Export.H 6614 2009-01-01 16:11:32Z matt $"
*
- * WIN32 DLL export definitions for the Fast Light Tool Kit (FLTK).
+ * WIN32 DLL export .
*
- * Copyright 1998-2005 by Bill Spitzak and others.
+ * Copyright 1998-2009 by Bill Spitzak and others.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -45,5 +45,5 @@
#endif /* !Fl_Export_H */
/*
- * End of "$Id: Fl_Export.H 4288 2005-04-16 00:13:17Z mike $".
+ * End of "$Id: Fl_Export.H 6614 2009-01-01 16:11:32Z matt $".
*/
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_File_Browser.H b/plugins/zynaddsubfx/fltk/FL/Fl_File_Browser.H
index 3efbecc6a..9de6851d9 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_File_Browser.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_File_Browser.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_File_Browser.H 4288 2005-04-16 00:13:17Z mike $"
+// "$Id: Fl_File_Browser.H 6614 2009-01-01 16:11:32Z matt $"
//
// FileBrowser definitions.
//
-// Copyright 1999-2005 by Michael Sweet.
+// Copyright 1999-2009 by Michael Sweet.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,6 +25,9 @@
// http://www.fltk.org/str.php
//
+/* \file
+ Fl_File_Browser widget . */
+
//
// Include necessary header files...
//
@@ -41,6 +44,7 @@
// Fl_File_Browser class...
//
+/** The Fl_File_Browser widget displays a list of filenames, optionally with file-specific icons. */
class FL_EXPORT Fl_File_Browser : public Fl_Browser
{
int filetype_;
@@ -57,25 +61,60 @@ class FL_EXPORT Fl_File_Browser : public Fl_Browser
public:
enum { FILES, DIRECTORIES };
+ /**
+ The constructor creates the Fl_File_Browser widget at the specified position and size.
+ The destructor destroys the widget and frees all memory that has been allocated.
+ */
Fl_File_Browser(int, int, int, int, const char * = 0);
+ /** Sets or gets the size of the icons. The default size is 20 pixels. */
uchar iconsize() const { return (iconsize_); };
+ /** Sets or gets the size of the icons. The default size is 20 pixels. */
void iconsize(uchar s) { iconsize_ = s; redraw(); };
+ /**
+ Sets or gets the filename filter. The pattern matching uses
+ the fl_filename_match()
+ function in FLTK.
+ */
void filter(const char *pattern);
+ /**
+ Sets or gets the filename filter. The pattern matching uses
+ the fl_filename_match()
+ function in FLTK.
+ */
const char *filter() const { return (pattern_); };
+ /**
+ Loads the specified directory into the browser. If icons have been
+ loaded then the correct icon is associated with each file in the list.
+
+ The sort argument specifies a sort function to be used with
+ fl_filename_list().
+ */
int load(const char *directory, Fl_File_Sort_F *sort = fl_numericsort);
- uchar textsize() const { return (Fl_Browser::textsize()); };
- void textsize(uchar s) { Fl_Browser::textsize(s); iconsize_ = (uchar)(3 * s / 2); };
+ Fl_Fontsize textsize() const { return Fl_Browser::textsize(); };
+ void textsize(Fl_Fontsize s) { Fl_Browser::textsize(s); iconsize_ = (uchar)(3 * s / 2); };
+ /**
+ Sets or gets the file browser type, FILES or
+ DIRECTORIES. When set to FILES, both
+ files and directories are shown. Otherwise only directories are
+ shown.
+ */
int filetype() const { return (filetype_); };
+ /**
+ Sets or gets the file browser type, FILES or
+ DIRECTORIES. When set to FILES, both
+ files and directories are shown. Otherwise only directories are
+ shown.
+ */
void filetype(int t) { filetype_ = t; };
};
#endif // !_Fl_File_Browser_H_
//
-// End of "$Id: Fl_File_Browser.H 4288 2005-04-16 00:13:17Z mike $".
+// End of "$Id: Fl_File_Browser.H 6614 2009-01-01 16:11:32Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_File_Chooser.H b/plugins/zynaddsubfx/fltk/FL/Fl_File_Chooser.H
index 727c73dc3..95145a106 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_File_Chooser.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_File_Chooser.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_File_Chooser.H 5644 2007-01-28 19:41:56Z mike $"
+// "$Id: Fl_File_Chooser.H 6678 2009-03-13 23:36:09Z AlbrechtS $"
//
// Fl_File_Chooser dialog for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,7 +25,7 @@
// http://www.fltk.org/str.php
//
-// generated by Fast Light User Interface Designer (fluid) version 1.0108
+// generated by Fast Light User Interface Designer (fluid) version 1.0300
#ifndef Fl_File_Chooser_H
#define Fl_File_Chooser_H
@@ -150,10 +150,10 @@ public:
int shown();
void textcolor(Fl_Color c);
Fl_Color textcolor();
- void textfont(uchar f);
- uchar textfont();
- void textsize(uchar s);
- uchar textsize();
+ void textfont(Fl_Font f);
+ Fl_Font textfont();
+ void textsize(Fl_Fontsize s);
+ Fl_Fontsize textsize();
void type(int t);
int type();
void * user_data() const;
@@ -161,20 +161,67 @@ public:
const char *value(int f = 1);
void value(const char *filename);
int visible();
+ /**
+ [standard text may be customized at run-time]
+ */
static const char *add_favorites_label;
+ /**
+ [standard text may be customized at run-time]
+ */
static const char *all_files_label;
+ /**
+ [standard text may be customized at run-time]
+ */
static const char *custom_filter_label;
+ /**
+ [standard text may be customized at run-time]
+ */
static const char *existing_file_label;
+ /**
+ [standard text may be customized at run-time]
+ */
static const char *favorites_label;
+ /**
+ [standard text may be customized at run-time]
+ */
static const char *filename_label;
+ /**
+ [standard text may be customized at run-time]
+ */
static const char *filesystems_label;
+ /**
+ [standard text may be customized at run-time]
+ */
static const char *manage_favorites_label;
+ /**
+ [standard text may be customized at run-time]
+ */
static const char *new_directory_label;
+ /**
+ [standard text may be customized at run-time]
+ */
static const char *new_directory_tooltip;
+ /**
+ [standard text may be customized at run-time]
+ */
static const char *preview_label;
+ /**
+ [standard text may be customized at run-time]
+ */
static const char *save_label;
+ /**
+ [standard text may be customized at run-time]
+ */
static const char *show_label;
+ /**
+ the sort function that is used when loading
+ the contents of a directory.
+ */
static Fl_File_Sort_F *sort;
+private:
+ Fl_Widget* ext_group;
+public:
+ Fl_Widget* add_extra(Fl_Widget* gr);
};
FL_EXPORT char *fl_dir_chooser(const char *message,const char *fname,int relative=0);
FL_EXPORT char *fl_file_chooser(const char *message,const char *pat,const char *fname,int relative=0);
@@ -183,5 +230,5 @@ FL_EXPORT void fl_file_chooser_ok_label(const char*l);
#endif
//
-// End of "$Id: Fl_File_Chooser.H 5644 2007-01-28 19:41:56Z mike $".
+// End of "$Id: Fl_File_Chooser.H 6678 2009-03-13 23:36:09Z AlbrechtS $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_File_Icon.H b/plugins/zynaddsubfx/fltk/FL/Fl_File_Icon.H
index 85201296a..174c7604e 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_File_Icon.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_File_Icon.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_File_Icon.H 4288 2005-04-16 00:13:17Z mike $"
+// "$Id: Fl_File_Icon.H 6614 2009-01-01 16:11:32Z matt $"
//
// Fl_File_Icon definitions.
//
-// Copyright 1999-2005 by Michael Sweet.
+// Copyright 1999-2009 by Michael Sweet.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,6 +25,9 @@
// http://www.fltk.org/str.php
//
+/* \file
+ Fl_File_Icon widget . */
+
//
// Include necessary header files...
//
@@ -39,13 +42,17 @@
// Special color value for the icon color.
//
-# define FL_ICON_COLOR (Fl_Color)0xffffffff
+# define FL_ICON_COLOR (Fl_Color)0xffffffff /**< icon color [background?]*/
//
// Fl_File_Icon class...
//
+/**
+ The Fl_File_Icon class manages icon images that can be used
+ as labels in other widgets and as icons in the FileBrowser widget.
+*/
class FL_EXPORT Fl_File_Icon //// Icon data
{
static Fl_File_Icon *first_; // Pointer to first icon/filetype
@@ -83,27 +90,73 @@ class FL_EXPORT Fl_File_Icon //// Icon data
~Fl_File_Icon();
short *add(short d);
+
+ /**
+ Adds a color value to the icon array, returning a pointer to it.
+ \param[in] c color value
+ */
short *add_color(Fl_Color c)
{ short *d = add((short)COLOR); add((short)(c >> 16)); add((short)c); return (d); }
+
+ /**
+ Adds a vertex value to the icon array, returning a pointer to it.
+ The integer version accepts coordinates from 0 to 10000.
+ The origin (0.0) is in the lower-lefthand corner of the icon.
+ \param[in] x, y vertex coordinates
+ */
short *add_vertex(int x, int y)
{ short *d = add((short)VERTEX); add((short)x); add((short)y); return (d); }
+
+ /**
+ Adds a vertex value to the icon array, returning a pointer to it.
+ The floating point version goes from 0.0 to 1.0.
+ The origin (0.0) is in the lower-lefthand corner of the icon.
+ \param[in] x, y vertex coordinates
+ */
short *add_vertex(float x, float y)
{ short *d = add((short)VERTEX); add((short)(x * 10000.0));
add((short)(y * 10000.0)); return (d); }
+
+ /** Clears all icon data from the icon.*/
void clear() { num_data_ = 0; }
+
void draw(int x, int y, int w, int h, Fl_Color ic, int active = 1);
+
void label(Fl_Widget *w);
+
static void labeltype(const Fl_Label *o, int x, int y, int w, int h, Fl_Align a);
void load(const char *f);
int load_fti(const char *fti);
int load_image(const char *i);
+
+ /** Returns next file icon object. See Fl_File_Icon::first() */
Fl_File_Icon *next() { return (next_); }
+
+ /** Returns the filename matching pattern for the icon.*/
const char *pattern() { return (pattern_); }
+
+ /** Returns the number of words of data used by the icon.*/
int size() { return (num_data_); }
+
+ /**
+ Returns the filetype associated with the icon, which can be one of the
+ following:
+
+ \li Fl_File_Icon::ANY, any kind of file.
+ \li Fl_File_Icon::PLAIN, plain files.
+ \li Fl_File_Icon::FIFO, named pipes.
+ \li Fl_File_Icon::DEVICE, character and block devices.
+ \li Fl_File_Icon::LINK, symbolic links.
+ \li Fl_File_Icon::DIRECTORY, directories.
+ */
int type() { return (type_); }
+
+ /** Returns the data array for the icon.*/
short *value() { return (data_); }
static Fl_File_Icon *find(const char *filename, int filetype = ANY);
+
+ /** Returns a pointer to the first icon in the list.*/
static Fl_File_Icon *first() { return (first_); }
static void load_system_icons(void);
};
@@ -111,5 +164,5 @@ class FL_EXPORT Fl_File_Icon //// Icon data
#endif // !_Fl_Fl_File_Icon_H_
//
-// End of "$Id: Fl_File_Icon.H 4288 2005-04-16 00:13:17Z mike $".
+// End of "$Id: Fl_File_Icon.H 6614 2009-01-01 16:11:32Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_File_Input.H b/plugins/zynaddsubfx/fltk/FL/Fl_File_Input.H
index b5ec6f104..cb45acf06 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_File_Input.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_File_Input.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_File_Input.H 4288 2005-04-16 00:13:17Z mike $"
+// "$Id: Fl_File_Input.H 6716 2009-03-24 01:40:44Z fabien $"
//
// File_Input header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
// Original version Copyright 1998 by Curtis Edwards.
//
// This library is free software; you can redistribute it and/or
@@ -26,12 +26,31 @@
// http://www.fltk.org/str.php
//
+/* \file
+ Fl_File_Input widget . */
+
#ifndef Fl_File_Input_H
# define Fl_File_Input_H
# include
+/**
+ \class Fl_File_Input
+ \brief This widget displays a pathname in a text input field.
+ A navigation bar located above the input field allows the user to
+ navigate upward in the directory tree.
+ You may want to handle FL_WHEN_CHANGED events for tracking text changes
+ and also FL_WHEN_RELEASE for button release when changing to parent dir.
+ FL_WHEN_RELEASE callback won't be called if the directory clicked
+ is the same that the current one.
+ \image html Fl_File_Input.gif
+ \image latex Fl_File_Input.eps "Fl_File_Input" width=6cm
+ \note As all Fl_Input derived objects, Fl_File_Input may call its callback
+ when loosing focus (see FL_UNFOCUS) to update its state like its cursor shape.
+ One resulting side effect is that you should call clear_changed() early in your callback
+ to avoid reentrant calls if you plan to show another window or dialog box in the callback.
+*/
class FL_EXPORT Fl_File_Input : public Fl_Input
{
Fl_Color errorcolor_;
@@ -46,17 +65,34 @@ class FL_EXPORT Fl_File_Input : public Fl_Input
public:
- Fl_File_Input(int,int,int,int,const char *t=0);
+ Fl_File_Input(int X, int Y, int W, int H, const char *L=0);
- virtual int handle(int);
+ virtual int handle(int event);
+
+protected:
virtual void draw();
+public:
+ /** Gets the box type used for the navigation bar. */
Fl_Boxtype down_box() const { return (Fl_Boxtype)down_box_; }
+ /** Sets the box type to use for the navigation bar. */
void down_box(Fl_Boxtype b) { down_box_ = b; }
+
+ /**
+ Gets the current error color.
+ \todo Better docs for Fl_File_Input::errorcolor() - is it even used?
+ */
Fl_Color errorcolor() const { return errorcolor_; }
+ /** Sets the current error color to \p c */
void errorcolor(Fl_Color c) { errorcolor_ = c; }
- int value(const char*);
- int value(const char*, int);
+
+ int value(const char *str);
+ int value(const char *str, int len);
+
+ /**
+ Returns the current value, which is a pointer to an internal buffer
+ and is valid only until the next event is handled.
+ */
const char *value() { return Fl_Input_::value(); }
};
@@ -64,5 +100,5 @@ public:
//
-// End of "$Id: Fl_File_Input.H 4288 2005-04-16 00:13:17Z mike $".
+// End of "$Id: Fl_File_Input.H 6716 2009-03-24 01:40:44Z fabien $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Fill_Dial.H b/plugins/zynaddsubfx/fltk/FL/Fl_Fill_Dial.H
index 2472f6dc4..b2a27fbe6 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Fill_Dial.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Fill_Dial.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Fill_Dial.H 4288 2005-04-16 00:13:17Z mike $"
+// "$Id: Fl_Fill_Dial.H 6614 2009-01-01 16:11:32Z matt $"
//
// Filled dial header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,13 +25,18 @@
// http://www.fltk.org/str.php
//
+/* \file
+ Fl_Fill_Dial widget . */
+
#ifndef Fl_Fill_Dial_H
#define Fl_Fill_Dial_H
#include "Fl_Dial.H"
+/** Draws a dial with a filled arc */
class Fl_Fill_Dial : public Fl_Dial {
public:
+ /** Creates a filled dial, also setting its type to FL_FILL_DIAL. */
Fl_Fill_Dial(int x,int y,int w,int h, const char *l = 0)
: Fl_Dial(x,y,w,h,l) {type(FL_FILL_DIAL);}
};
@@ -39,5 +44,5 @@ public:
#endif
//
-// End of "$Id: Fl_Fill_Dial.H 4288 2005-04-16 00:13:17Z mike $".
+// End of "$Id: Fl_Fill_Dial.H 6614 2009-01-01 16:11:32Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Fill_Slider.H b/plugins/zynaddsubfx/fltk/FL/Fl_Fill_Slider.H
index 8635eeb82..92a49fed8 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Fill_Slider.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Fill_Slider.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Fill_Slider.H 4288 2005-04-16 00:13:17Z mike $"
+// "$Id: Fl_Fill_Slider.H 6614 2009-01-01 16:11:32Z matt $"
//
// Filled slider header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,13 +25,17 @@
// http://www.fltk.org/str.php
//
+/* \file
+ Fl_Fill_Slider widget . */
+
#ifndef Fl_Fill_Slider_H
#define Fl_Fill_Slider_H
#include "Fl_Slider.H"
-
+/** Widget that draws a filled horizontal slider, useful as a progress or value meter*/
class Fl_Fill_Slider : public Fl_Slider {
public:
+ /** Creates the slider from its position,size and optional title. */
Fl_Fill_Slider(int x,int y,int w,int h,const char *l=0)
: Fl_Slider(x,y,w,h,l) {type(FL_VERT_FILL_SLIDER);}
};
@@ -39,5 +43,5 @@ public:
#endif
//
-// End of "$Id: Fl_Fill_Slider.H 4288 2005-04-16 00:13:17Z mike $".
+// End of "$Id: Fl_Fill_Slider.H 6614 2009-01-01 16:11:32Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Float_Input.H b/plugins/zynaddsubfx/fltk/FL/Fl_Float_Input.H
index 526674d2b..2a312308a 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Float_Input.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Float_Input.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Float_Input.H 4288 2005-04-16 00:13:17Z mike $"
+// "$Id: Fl_Float_Input.H 6614 2009-01-01 16:11:32Z matt $"
//
// Floating point input header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,19 +25,33 @@
// http://www.fltk.org/str.php
//
+/* \file
+ Fl_Float_Input widget . */
+
+
#ifndef Fl_Float_Input_H
#define Fl_Float_Input_H
#include "Fl_Input.H"
+/**
+ The Fl_Float_Input class is a subclass of Fl_Input
+ that only allows the user to type floating point numbers (sign,
+ digits, decimal point, more digits, 'E' or 'e', sign, digits).
+*/
class Fl_Float_Input : public Fl_Input {
public:
- Fl_Float_Input(int X,int Y,int W,int H,const char *l = 0)
- : Fl_Input(X,Y,W,H,l) {type(FL_FLOAT_INPUT);}
+ /**
+ Creates a new Fl_Float_Input widget using the given position,
+ size, and label string. The default boxtype is FL_DOWN_BOX.
+ Inherited destructor destroys the widget and any value associated with it
+ */
+ Fl_Float_Input(int X,int Y,int W,int H,const char *l = 0)
+ : Fl_Input(X,Y,W,H,l) {type(FL_FLOAT_INPUT);}
};
#endif
//
-// End of "$Id: Fl_Float_Input.H 4288 2005-04-16 00:13:17Z mike $".
+// End of "$Id: Fl_Float_Input.H 6614 2009-01-01 16:11:32Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_FormsBitmap.H b/plugins/zynaddsubfx/fltk/FL/Fl_FormsBitmap.H
index caa3a0734..fe3347526 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_FormsBitmap.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_FormsBitmap.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_FormsBitmap.H 4288 2005-04-16 00:13:17Z mike $"
+// "$Id: Fl_FormsBitmap.H 6614 2009-01-01 16:11:32Z matt $"
//
// Forms bitmap header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,11 +25,17 @@
// http://www.fltk.org/str.php
//
+/* \file
+ Fl_FormsBitmap widget . */
+
#ifndef Fl_FormsBitmap_H
#define Fl_FormsBitmap_H
#include "Fl_Bitmap.H"
+/**
+ Forms compatibility Bitmap Image Widget
+*/
class FL_EXPORT Fl_FormsBitmap : public Fl_Widget {
Fl_Bitmap *b;
protected:
@@ -37,12 +43,14 @@ protected:
public:
Fl_FormsBitmap(Fl_Boxtype, int, int, int, int, const char * = 0);
void set(int W, int H, const uchar *bits);
+ /** Sets a new bitmap. */
void bitmap(Fl_Bitmap *B) {b = B;}
+ /** Gets a the current associated Fl_Bitmap objects. */
Fl_Bitmap *bitmap() const {return b;}
};
#endif
//
-// End of "$Id: Fl_FormsBitmap.H 4288 2005-04-16 00:13:17Z mike $".
+// End of "$Id: Fl_FormsBitmap.H 6614 2009-01-01 16:11:32Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_FormsPixmap.H b/plugins/zynaddsubfx/fltk/FL/Fl_FormsPixmap.H
index f25bed6d7..23b8a8ce7 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_FormsPixmap.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_FormsPixmap.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_FormsPixmap.H 4288 2005-04-16 00:13:17Z mike $"
+// "$Id: Fl_FormsPixmap.H 6614 2009-01-01 16:11:32Z matt $"
//
// Forms pixmap header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,24 +25,39 @@
// http://www.fltk.org/str.php
//
+/* \file
+ Fl_FormsPixmap widget . */
+
#ifndef Fl_FormsPixmap_H
#define Fl_FormsPixmap_H
#include "Fl_Pixmap.H"
+/**
+ \class Fl_FormsPixmap
+ \brief Forms pixmap drawing routines
+*/
class FL_EXPORT Fl_FormsPixmap : public Fl_Widget {
Fl_Pixmap *b;
protected:
void draw();
public:
- Fl_FormsPixmap(Fl_Boxtype, int, int, int, int, const char * = 0);
+ Fl_FormsPixmap(Fl_Boxtype t, int X, int Y, int W, int H, const char *L= 0);
+
void set(/*const*/char * const * bits);
+
+ /**
+ Set the internal pixmap pointer to an existing pixmap.
+ \param[in] B existing pixmap
+ */
void Pixmap(Fl_Pixmap *B) {b = B;}
+
+ /** Get the internal pixmap pointer. */
Fl_Pixmap *Pixmap() const {return b;}
};
#endif
//
-// End of "$Id: Fl_FormsPixmap.H 4288 2005-04-16 00:13:17Z mike $".
+// End of "$Id: Fl_FormsPixmap.H 6614 2009-01-01 16:11:32Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Free.H b/plugins/zynaddsubfx/fltk/FL/Fl_Free.H
index 7895dfe17..4bab575e0 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Free.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Free.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Free.H 4288 2005-04-16 00:13:17Z mike $"
+// "$Id: Fl_Free.H 6614 2009-01-01 16:11:32Z matt $"
//
// Forms free header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,6 +25,9 @@
// http://www.fltk.org/str.php
//
+/* \file
+ Fl_Free widget . */
+
#ifndef Fl_Free_H
#define Fl_Free_H
@@ -32,35 +35,55 @@
#include "Fl_Widget.H"
#endif
-#define FL_NORMAL_FREE 1
-#define FL_SLEEPING_FREE 2
-#define FL_INPUT_FREE 3
-#define FL_CONTINUOUS_FREE 4
-#define FL_ALL_FREE 5
+#define FL_NORMAL_FREE 1 /**< normal event handling */
+#define FL_SLEEPING_FREE 2 /**< deactivate event handling */
+#define FL_INPUT_FREE 3 /**< accepts FL_FOCUS events */
+#define FL_CONTINUOUS_FREE 4 /**< repeated timeout handling */
+#define FL_ALL_FREE 5 /**< FL_INPUT_FREE and FL_CONTINOUS_FREE */
+/** appropriate signature for handle function */
typedef int (*FL_HANDLEPTR)(Fl_Widget *, int , float, float, char);
+/**
+ Emulation of the Forms "free" widget.
+
+ This emulation allows the free demo to run, and appears to be useful for
+ porting programs written in Forms which use the free widget or make
+ subclasses of the Forms widgets.
+
+ There are five types of free, which determine when the handle function
+ is called:
+
+ \li \c FL_NORMAL_FREE normal event handling.
+ \li \c FL_SLEEPING_FREE deactivates event handling (widget is inactive).
+ \li \c FL_INPUT_FREE accepts FL_FOCUS events.
+ \li \c FL_CONTINUOUS_FREE sets a timeout callback 100 times a second and
+ provides an FL_STEP event. This has obvious
+ detrimental effects on machine performance.
+ \li \c FL_ALL_FREE same as FL_INPUT_FREE and FL_CONTINUOUS_FREE.
+
+*/
class FL_EXPORT Fl_Free : public Fl_Widget {
FL_HANDLEPTR hfunc;
static void step(void *);
protected:
void draw();
public:
- int handle(int);
- Fl_Free(uchar t,int x,int y,int w,int h,const char *l,FL_HANDLEPTR hdl);
- ~Fl_Free();
+ int handle(int e);
+ Fl_Free(uchar t,int X,int Y,int W,int H,const char *L,FL_HANDLEPTR hdl);
+ ~Fl_Free();
};
-// old event names for compatability:
-#define FL_MOUSE FL_DRAG
-#define FL_DRAW 100 // NOT USED
-#define FL_STEP 101
-#define FL_FREEMEM 102 // NOT USED
-#define FL_FREEZE 103 // NOT USED
-#define FL_THAW 104 // NOT USED
+// old event names for compatibility:
+#define FL_MOUSE FL_DRAG /**< for backward compatibility */
+#define FL_DRAW 100 /**< for backward compatibility [UNUSED]*/
+#define FL_STEP 101 /**< for backward compatibility */
+#define FL_FREEMEM 102 /**< for backward compatibility [UNUSED]*/
+#define FL_FREEZE 103 /**< for backward compatibility [UNUSED]*/
+#define FL_THAW 104 /**< for backward compatibility [UNUSED]*/
#endif
//
-// End of "$Id: Fl_Free.H 4288 2005-04-16 00:13:17Z mike $".
+// End of "$Id: Fl_Free.H 6614 2009-01-01 16:11:32Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Group.H b/plugins/zynaddsubfx/fltk/FL/Fl_Group.H
index 8e4bb926d..2db9d7992 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Group.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Group.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Group.H 5993 2007-12-15 16:42:00Z mike $"
+// "$Id: Fl_Group.H 6716 2009-03-24 01:40:44Z fabien $"
//
// Group header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,6 +25,9 @@
// http://www.fltk.org/str.php
//
+/* \file
+ Fl_Group, Fl_End classes . */
+
#ifndef Fl_Group_H
#define Fl_Group_H
@@ -32,13 +35,20 @@
#include "Fl_Widget.H"
#endif
+/**
+ The Fl_Group class is the FLTK container widget. It maintains
+ an array of child widgets. These children can themselves be any widget
+ including Fl_Group. The most important subclass of Fl_Group
+ is Fl_Window, however groups can also be used to control radio buttons
+ or to enforce resize behavior.
+*/
class FL_EXPORT Fl_Group : public Fl_Widget {
Fl_Widget** array_;
Fl_Widget* savedfocus_;
Fl_Widget* resizable_;
int children_;
- short *sizes_; // remembered initial sizes of children
+ int *sizes_; // remembered initial sizes of children
int navigation(int);
static Fl_Group *current_;
@@ -50,15 +60,12 @@ class FL_EXPORT Fl_Group : public Fl_Widget {
protected:
enum { CLIP_CHILDREN = 2048 };
- void clip_children(int c) { if (c) set_flag(CLIP_CHILDREN); else clear_flag(CLIP_CHILDREN); }
- int clip_children() { return (flags() & CLIP_CHILDREN) != 0; }
-
void draw();
- void draw_child(Fl_Widget&) const;
+ void draw_child(Fl_Widget& widget) const;
void draw_children();
- void draw_outside_label(const Fl_Widget&) const ;
- void update_child(Fl_Widget&) const;
- short* sizes();
+ void draw_outside_label(const Fl_Widget& widget) const ;
+ void update_child(Fl_Widget& widget) const;
+ int *sizes();
public:
@@ -68,44 +75,154 @@ public:
static Fl_Group *current();
static void current(Fl_Group *g);
+ /**
+ Returns how many child widgets the group has.
+ */
int children() const {return children_;}
+ /**
+ Returns array()[n]. No range checking is done!
+ */
Fl_Widget* child(int n) const {return array()[n];}
int find(const Fl_Widget*) const;
+ /**
+ See int Fl_Group::find(const Fl_Widget *w) const
+ */
int find(const Fl_Widget& o) const {return find(&o);}
Fl_Widget* const* array() const;
void resize(int,int,int,int);
+ /**
+ Creates a new Fl_Group widget using the given position, size,
+ and label string. The default boxtype is FL_NO_BOX.
+ */
Fl_Group(int,int,int,int, const char * = 0);
virtual ~Fl_Group();
void add(Fl_Widget&);
+ /**
+ See void Fl_Group::add(Fl_Widget &w)
+ */
void add(Fl_Widget* o) {add(*o);}
void insert(Fl_Widget&, int i);
+ /**
+ This does insert(w, find(before)). This will append the
+ widget if \p before is not in the group.
+ */
void insert(Fl_Widget& o, Fl_Widget* before) {insert(o,find(before));}
void remove(Fl_Widget&);
+ /**
+ Removes the widget \p o from the group.
+ \sa void remove(Fl_Widget&)
+ */
void remove(Fl_Widget* o) {remove(*o);}
void clear();
+ /**
+ See void Fl_Group::resizable(Fl_Widget *box)
+ */
void resizable(Fl_Widget& o) {resizable_ = &o;}
+ /**
+ The resizable widget defines the resizing box for the group. When the
+ group is resized it calculates a new size and position for all of its
+ children. Widgets that are horizontally or vertically inside the
+ dimensions of the box are scaled to the new size. Widgets outside the
+ box are moved.
+
+ In these examples the gray area is the resizable:
+
+ \image html resizebox1.gif
+
+ \image html resizebox2.gif
+
+ \image latex resizebox1.eps "before resize" width=4cm
+
+ \image latex resizebox2.eps "after resize" width=4cm
+
+ The resizable may be set to the group itself, in which case all the
+ contents are resized. This is the default value for Fl_Group,
+ although NULL is the default for Fl_Window and Fl_Pack.
+
+ If the resizable is NULL then all widgets remain a fixed size
+ and distance from the top-left corner.
+
+ It is possible to achieve any type of resize behavior by using an
+ invisible Fl_Box as the resizable and/or by using a hierarchy
+ of child Fl_Group's.
+ */
void resizable(Fl_Widget* o) {resizable_ = o;}
+ /**
+ See void Fl_Group::resizable(Fl_Widget *box)
+ */
Fl_Widget* resizable() const {return resizable_;}
+ /**
+ Adds a widget to the group and makes it the resizable widget.
+ */
void add_resizable(Fl_Widget& o) {resizable_ = &o; add(o);}
void init_sizes();
- // back compatability function:
- void focus(Fl_Widget* o) {o->take_focus();}
+ /**
+ Controls whether the group widget clips the drawing of
+ child widgets to its bounding box.
+
+ Set \p c to 1 if you want to clip the child widgets to the
+ bounding box.
+
+ The default is to not clip (0) the drawing of child widgets.
+ */
+ void clip_children(int c) { if (c) set_flag(CLIP_CHILDREN); else clear_flag(CLIP_CHILDREN); }
+ /**
+ Returns the current clipping mode.
+
+ \return true, if clipping is enabled, false otherwise.
+
+ \see void Fl_Group::clip_children(int c)
+ */
+ int clip_children() { return (flags() & CLIP_CHILDREN) != 0; }
+
+ // back compatibility functions:
+
+ /**
+ \deprecated This is for backwards compatibility only. You should use
+ \e W->%take_focus() instead.
+ \sa Fl_Widget::take_focus();
+ */
+ void focus(Fl_Widget* W) {W->take_focus();}
+
+ /** This is for forms compatibility only */
Fl_Widget* & _ddfdesign_kludge() {return resizable_;}
+
+ /** This is for forms compatibility only */
void forms_end();
};
// dummy class used to end child groups in constructors for complex
// subclasses of Fl_Group:
+/**
+ This is a dummy class that allows you to end a Fl_Group in a constructor list of a
+ class:
+ \code
+ class MyClass {
+ Fl_Group group;
+ Fl_Button button_in_group;
+ Fl_End end;
+ Fl_Button button_outside_group;
+ MyClass();
+ };
+ MyClass::MyClass() :
+ group(10,10,100,100),
+ button_in_group(20,20,60,30),
+ end(),
+ button_outside_group(10,120,60,30)
+ {}
+ \endcode
+*/
class FL_EXPORT Fl_End {
public:
+ /** All it does is calling Fl_Group::current()->end() */
Fl_End() {Fl_Group::current()->end();}
};
#endif
//
-// End of "$Id: Fl_Group.H 5993 2007-12-15 16:42:00Z mike $".
+// End of "$Id: Fl_Group.H 6716 2009-03-24 01:40:44Z fabien $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Help_Dialog.H b/plugins/zynaddsubfx/fltk/FL/Fl_Help_Dialog.H
index bf86af767..3b8fe4c31 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Help_Dialog.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Help_Dialog.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Help_Dialog.H 5643 2007-01-28 19:36:51Z mike $"
+// "$Id: Fl_Help_Dialog.H 6614 2009-01-01 16:11:32Z matt $"
//
// Fl_Help_Dialog dialog for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,6 +25,9 @@
// http://www.fltk.org/str.php
//
+/* \file
+ Fl_Help_Dialog widget . */
+
// generated by Fast Light User Interface Designer (fluid) version 1.0108
#ifndef Fl_Help_Dialog_H
@@ -74,8 +77,8 @@ public:
void resize(int xx, int yy, int ww, int hh);
void show();
void show(int argc, char **argv);
- void textsize(uchar s);
- uchar textsize();
+ void textsize(Fl_Fontsize s);
+ Fl_Fontsize textsize();
void topline(const char *n);
void topline(int n);
void value(const char *f);
@@ -88,5 +91,5 @@ public:
#endif
//
-// End of "$Id: Fl_Help_Dialog.H 5643 2007-01-28 19:36:51Z mike $".
+// End of "$Id: Fl_Help_Dialog.H 6614 2009-01-01 16:11:32Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Help_View.H b/plugins/zynaddsubfx/fltk/FL/Fl_Help_View.H
index 0229115e9..eedb150fd 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Help_View.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Help_View.H
@@ -1,10 +1,10 @@
//
-// "$Id: Fl_Help_View.H 5991 2007-12-15 16:08:23Z mike $"
+// "$Id: Fl_Help_View.H 6743 2009-04-07 17:33:22Z AlbrechtS $"
//
// Help Viewer widget definitions.
//
-// Copyright 1997-2005 by Easy Software Products.
-// Image support donated by Matthias Melcher, Copyright 2000.
+// Copyright 1997-2009 by Easy Software Products.
+// Image support by Matthias Melcher, Copyright 2000-2009.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -26,6 +26,9 @@
// http://www.fltk.org/str.php
//
+/* \file
+ Fl_Help_View widget . */
+
#ifndef Fl_Help_View_H
# define Fl_Help_View_H
@@ -69,69 +72,118 @@ struct Fl_Help_Block
//
// Fl_Help_Link structure...
//
-
+/** Definition of a link for the html viewer. */
struct Fl_Help_Link
{
- char filename[192], // Reference filename
- name[32]; // Link target (blank if none)
- int x, // X offset of link text
- y, // Y offset of link text
- w, // Width of link text
- h; // Height of link text
+ char filename[192], ///< Reference filename
+ name[32]; ///< Link target (blank if none)
+ int x, ///< X offset of link text
+ y, ///< Y offset of link text
+ w, ///< Width of link text
+ h; ///< Height of link text
};
-//
-// Fl_Help_Target structure...
-//
+/*
+ * Fl_Help_View font stack opaque implementation
+ */
+
+/** Fl_Help_View font stack element definition. */
+struct Fl_Help_Font_Style {
+ Fl_Font f; ///< Font
+ Fl_Fontsize s; ///< Font Size
+ Fl_Color c; ///< Font Color
+ void get(Fl_Font &afont, Fl_Fontsize &asize, Fl_Color &acolor) {afont=f; asize=s; acolor=c;} ///< Gets current font attributes
+ void set(Fl_Font afont, Fl_Fontsize asize, Fl_Color acolor) {f=afont; s=asize; c=acolor;} ///< Sets current font attributes
+ Fl_Help_Font_Style(Fl_Font afont, Fl_Fontsize asize, Fl_Color acolor) {set(afont, asize, acolor);}
+ Fl_Help_Font_Style(){} // For in table use
+};
+
+/** Fl_Help_View font stack definition. */
+const size_t MAX_FL_HELP_FS_ELTS = 100;
+
+struct Fl_Help_Font_Stack {
+ /** font stack construction, initialize attributes. */
+ Fl_Help_Font_Stack() {
+ nfonts_ = 0;
+ }
+
+ void init(Fl_Font f, Fl_Fontsize s, Fl_Color c) {
+ nfonts_ = 0;
+ elts_[nfonts_].set(f, s, c);
+ fl_font(f, s);
+ fl_color(c);
+ }
+ /** Gets the top (current) element on the stack. */
+ void top(Fl_Font &f, Fl_Fontsize &s, Fl_Color &c) { elts_[nfonts_].get(f, s, c); }
+ /** Pushes the font style triplet on the stack, also calls fl_font() & fl_color() adequately */
+ void push(Fl_Font f, Fl_Fontsize s, Fl_Color c) {
+ if (nfonts_ < MAX_FL_HELP_FS_ELTS-1) nfonts_ ++;
+ elts_[nfonts_].set(f, s, c);
+ fl_font(f, s); fl_color(c);
+ }
+ /** Pops from the stack the font style triplet and calls fl_font() & fl_color() adequately */
+ void pop(Fl_Font &f, Fl_Fontsize &s, Fl_Color &c) {
+ if (nfonts_ > 0) nfonts_ --;
+ top(f, s, c);
+ fl_font(f, s); fl_color(c);
+ }
+ /** Gets the current count of font style elements in the stack. */
+ size_t count() const {return nfonts_;} // Gets the current number of fonts in the stack
+
+protected:
+ size_t nfonts_; ///< current number of fonts in stack
+ Fl_Help_Font_Style elts_[100]; ///< font elements
+};
+
+/** Fl_Help_Target structure */
struct Fl_Help_Target
{
- char name[32]; // Target name
- int y; // Y offset of target
+ char name[32]; ///< Target name
+ int y; ///< Y offset of target
};
-//
-// Fl_Help_View class...
-//
-
-class FL_EXPORT Fl_Help_View : public Fl_Group //// Help viewer widget
+/**
+ The Fl_Help_View widget displays HTML text. Most HTML 2.0
+ elements are supported, as well as a primitive implementation of tables.
+ GIF, JPEG, and PNG images are displayed inline.
+*/
+class FL_EXPORT Fl_Help_View : public Fl_Group // Help viewer widget
{
- enum { RIGHT = -1, CENTER, LEFT }; // Alignments
+ enum { RIGHT = -1, CENTER, LEFT }; ///< Alignments
- char title_[1024]; // Title string
- Fl_Color defcolor_, // Default text color
- bgcolor_, // Background color
- textcolor_, // Text color
- linkcolor_; // Link color
- uchar textfont_, // Default font for text
- textsize_; // Default font size
- const char *value_; // HTML text value
+ char title_[1024]; ///< Title string
+ Fl_Color defcolor_, ///< Default text color
+ bgcolor_, ///< Background color
+ textcolor_, ///< Text color
+ linkcolor_; ///< Link color
+ Fl_Font textfont_; ///< Default font for text
+ Fl_Fontsize textsize_; ///< Default font size
+ const char *value_; ///< HTML text value
+ Fl_Help_Font_Stack fstack_; ///< font stack management
+ int nblocks_, ///< Number of blocks/paragraphs
+ ablocks_; ///< Allocated blocks
+ Fl_Help_Block *blocks_; ///< Blocks
- int nblocks_, // Number of blocks/paragraphs
- ablocks_; // Allocated blocks
- Fl_Help_Block *blocks_; // Blocks
+ Fl_Help_Func *link_; ///< Link transform function
- int nfonts_; // Number of fonts in stack
- uchar fonts_[100][2]; // Font stack
+ int nlinks_, ///< Number of links
+ alinks_; ///< Allocated links
+ Fl_Help_Link *links_; ///< Links
- Fl_Help_Func *link_; // Link transform function
+ int ntargets_, ///< Number of targets
+ atargets_; ///< Allocated targets
+ Fl_Help_Target *targets_; ///< Targets
- int nlinks_, // Number of links
- alinks_; // Allocated links
- Fl_Help_Link *links_; // Links
-
- int ntargets_, // Number of targets
- atargets_; // Allocated targets
- Fl_Help_Target *targets_; // Targets
-
- char directory_[1024]; // Directory for current file
- char filename_[1024]; // Current filename
- int topline_, // Top line in document
- leftline_, // Lefthand position
- size_, // Total document length
- hsize_; // Maximum document width
- Fl_Scrollbar scrollbar_, // Vertical scrollbar for document
- hscrollbar_; // Horizontal scrollbar
+ char directory_[1024]; ///< Directory for current file
+ char filename_[1024]; ///< Current filename
+ int topline_, ///< Top line in document
+ leftline_, ///< Lefthand position
+ size_, ///< Total document length
+ hsize_, ///< Maximum document width
+ scrollbar_size_; ///< Size for both scrollbars
+ Fl_Scrollbar scrollbar_, ///< Vertical scrollbar for document
+ hscrollbar_; ///< Horizontal scrollbar
static int selection_first;
static int selection_last;
@@ -148,6 +200,12 @@ class FL_EXPORT Fl_Help_View : public Fl_Group //// Help viewer widget
static Fl_Color hv_selection_color;
static Fl_Color hv_selection_text_color;
+
+ void initfont(Fl_Font &f, Fl_Fontsize &s, Fl_Color &c) { f = textfont_; s = textsize_; c = textcolor_; fstack_.init(f, s, c); }
+ void pushfont(Fl_Font f, Fl_Fontsize s) {fstack_.push(f, s, textcolor_);}
+ void pushfont(Fl_Font f, Fl_Fontsize s, Fl_Color c) {fstack_.push(f, s, c);}
+ void popfont(Fl_Font &f, Fl_Fontsize &s, Fl_Color &c) {fstack_.pop(f, s, c);}
+
Fl_Help_Block *add_block(const char *s, int xx, int yy, int ww, int hh, uchar border = 0);
void add_link(const char *n, int xx, int yy, int ww, int hh);
void add_target(const char *n, int yy);
@@ -164,16 +222,6 @@ class FL_EXPORT Fl_Help_View : public Fl_Group //// Help viewer widget
int get_length(const char *l);
int handle(int);
- void initfont(uchar &f, uchar &s) { nfonts_ = 0;
- fl_font(f = fonts_[0][0] = textfont_,
- s = fonts_[0][1] = textsize_); }
- void pushfont(uchar f, uchar s) { if (nfonts_ < 99) nfonts_ ++;
- fl_font(fonts_[nfonts_][0] = f,
- fonts_[nfonts_][1] = s); }
- void popfont(uchar &f, uchar &s) { if (nfonts_ > 0) nfonts_ --;
- fl_font(f = fonts_[nfonts_][0],
- s = fonts_[nfonts_][1]); }
-
void hv_draw(const char *t, int x, int y);
char begin_selection();
char extend_selection();
@@ -186,36 +234,105 @@ public:
Fl_Help_View(int xx, int yy, int ww, int hh, const char *l = 0);
~Fl_Help_View();
+ /** Returns the current directory for the text in the buffer. */
const char *directory() const { if (directory_[0]) return (directory_);
else return ((const char *)0); }
+ /** Returns the current filename for the text in the buffer. */
const char *filename() const { if (filename_[0]) return (filename_);
else return ((const char *)0); }
int find(const char *s, int p = 0);
+ /**
+ This method assigns a callback function to use when a link is
+ followed or a file is loaded (via Fl_Help_View::load()) that
+ requires a different file or path.
+
+ The callback function receives a pointer to the Fl_Help_View
+ widget and the URI or full pathname for the file in question.
+ It must return a pathname that can be opened as a local file or NULL:
+
+ \code
+ const char *fn(Fl_Widget *w, const char *uri);
+ \endcode
+
+ The link function can be used to retrieve remote or virtual
+ documents, returning a temporary file that contains the actual
+ data. If the link function returns NULL, the value of
+ the Fl_Help_View widget will remain unchanged.
+
+ If the link callback cannot handle the URI scheme, it should
+ return the uri value unchanged or set the value() of the widget
+ before returning NULL.
+ */
void link(Fl_Help_Func *fn) { link_ = fn; }
int load(const char *f);
void resize(int,int,int,int);
+ /** Gets the size of the help view. */
int size() const { return (size_); }
void size(int W, int H) { Fl_Widget::size(W, H); }
+ /** Sets the default text color. */
void textcolor(Fl_Color c) { if (textcolor_ == defcolor_) textcolor_ = c; defcolor_ = c; }
+ /** Returns the current default text color. */
Fl_Color textcolor() const { return (defcolor_); }
- void textfont(uchar f) { textfont_ = f; format(); }
- uchar textfont() const { return (textfont_); }
- void textsize(uchar s) { textsize_ = s; format(); }
- uchar textsize() const { return (textsize_); }
+ /** Sets the default text font. */
+ void textfont(Fl_Font f) { textfont_ = f; format(); }
+ /** Returns the current default text font. */
+ Fl_Font textfont() const { return (textfont_); }
+ /** Sets the default text size. */
+ void textsize(Fl_Fontsize s) { textsize_ = s; format(); }
+ /** Gets the default text size. */
+ Fl_Fontsize textsize() const { return (textsize_); }
+ /** Returns the current document title, or NULL if there is no title. */
const char *title() { return (title_); }
void topline(const char *n);
void topline(int);
+ /** Returns the current top line in pixels. */
int topline() const { return (topline_); }
void leftline(int);
+ /** Gets the left position in pixels. */
int leftline() const { return (leftline_); }
- void value(const char *v);
+ void value(const char *val);
+ /** Returns the current buffer contents. */
const char *value() const { return (value_); }
void clear_selection();
void select_all();
+ /**
+ Gets the current size of the scrollbars' troughs, in pixels.
+
+ If this value is zero (default), this widget will use the
+ Fl::scrollbar_size() value as the scrollbar's width.
+
+ \returns Scrollbar size in pixels, or 0 if the global Fl::scrollbar_size() is being used.
+ \see Fl::scrollbar_size(int)
+ */
+ int scrollbar_size() const {
+ return(scrollbar_size_);
+ }
+ /**
+ Sets the pixel size of the scrollbars' troughs to the \p size, in pixels.
+
+ Normally you should not need this method, and should use
+ Fl::scrollbar_size(int) instead to manage the size of ALL
+ your widgets' scrollbars. This ensures your application
+ has a consistent UI, is the default behavior, and is normally
+ what you want.
+
+ Only use THIS method if you really need to override the global
+ scrollbar size. The need for this should be rare.
+
+ Setting \p size to the special value of 0 causes the widget to
+ track the global Fl::scrollbar_size(), which is the default.
+
+ \param[in] size Sets the scrollbar size in pixels.\n
+ If 0 (default), scrollbar size tracks the global Fl::scrollbar_size()
+ \see Fl::scrollbar_size()
+ */
+ void scrollbar_size(int size) {
+ scrollbar_size_ = size;
+ }
};
#endif // !Fl_Help_View_H
//
-// End of "$Id: Fl_Help_View.H 5991 2007-12-15 16:08:23Z mike $".
+// End of "$Id: Fl_Help_View.H 6743 2009-04-07 17:33:22Z AlbrechtS $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Hold_Browser.H b/plugins/zynaddsubfx/fltk/FL/Fl_Hold_Browser.H
index 6286a60bf..f4cb3979d 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Hold_Browser.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Hold_Browser.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Hold_Browser.H 4288 2005-04-16 00:13:17Z mike $"
+// "$Id: Fl_Hold_Browser.H 6614 2009-01-01 16:11:32Z matt $"
//
// Hold browser header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,19 +25,37 @@
// http://www.fltk.org/str.php
//
+/* \file
+ Fl_Hold_Browser widget . */
+
#ifndef Fl_Hold_Browser_H
#define Fl_Hold_Browser_H
#include "Fl_Browser.H"
+/**
+ The Fl_Hold_Browser is a subclass of Fl_Browser
+ which lets the user select a single item, or no items by clicking on
+ the empty space. As long as the mouse button is held down the item
+ pointed to by it is highlighted, and this highlighting remains on when
+ the mouse button is released. Normally the callback is done when the
+ user releases the mouse, but you can change this with when().
+
See Fl_Browser for methods to add and remove lines from the browser.
+*/
class Fl_Hold_Browser : public Fl_Browser {
public:
- Fl_Hold_Browser(int X,int Y,int W,int H,const char *l=0)
+ /**
+ Creates a new Fl_Hold_Browser widget using the given
+ position, size, and label string. The default boxtype is FL_DOWN_BOX.
+ The constructor specializes Fl_Browser() by setting the type to FL_HOLD_BROWSER.
+ The destructor destroys the widget and frees all memory that has been allocated.
+ */
+ Fl_Hold_Browser(int X,int Y,int W,int H,const char *l=0)
: Fl_Browser(X,Y,W,H,l) {type(FL_HOLD_BROWSER);}
};
#endif
//
-// End of "$Id: Fl_Hold_Browser.H 4288 2005-04-16 00:13:17Z mike $".
+// End of "$Id: Fl_Hold_Browser.H 6614 2009-01-01 16:11:32Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Hor_Fill_Slider.H b/plugins/zynaddsubfx/fltk/FL/Fl_Hor_Fill_Slider.H
index a7a87f5ea..e7ebc6d4b 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Hor_Fill_Slider.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Hor_Fill_Slider.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Hor_Fill_Slider.H 4288 2005-04-16 00:13:17Z mike $"
+// "$Id: Fl_Hor_Fill_Slider.H 6614 2009-01-01 16:11:32Z matt $"
//
// Horizontal fill slider header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -24,6 +24,10 @@
//
// http://www.fltk.org/str.php
//
+
+/* \file
+ Fl_Hor_Fill_Slider widget . */
+
#ifndef Fl_Hor_Fill_Slider_H
#define Fl_Hor_Fill_Slider_H
@@ -38,5 +42,5 @@ public:
#endif
//
-// End of "$Id: Fl_Hor_Fill_Slider.H 4288 2005-04-16 00:13:17Z mike $".
+// End of "$Id: Fl_Hor_Fill_Slider.H 6614 2009-01-01 16:11:32Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Hor_Nice_Slider.H b/plugins/zynaddsubfx/fltk/FL/Fl_Hor_Nice_Slider.H
index bed75a51c..6e6fce9db 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Hor_Nice_Slider.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Hor_Nice_Slider.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Hor_Nice_Slider.H 4288 2005-04-16 00:13:17Z mike $"
+// "$Id: Fl_Hor_Nice_Slider.H 6614 2009-01-01 16:11:32Z matt $"
//
// Horizontal "nice" slider header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,6 +25,9 @@
// http://www.fltk.org/str.php
//
+/* \file
+ Fl_Hor_Nice_Slider widget . */
+
#ifndef Fl_Hor_Nice_Slider_H
#define Fl_Hor_Nice_Slider_H
@@ -39,5 +42,5 @@ public:
#endif
//
-// End of "$Id: Fl_Hor_Nice_Slider.H 4288 2005-04-16 00:13:17Z mike $".
+// End of "$Id: Fl_Hor_Nice_Slider.H 6614 2009-01-01 16:11:32Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Hor_Slider.H b/plugins/zynaddsubfx/fltk/FL/Fl_Hor_Slider.H
index 34be6961e..9bbee8f2c 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Hor_Slider.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Hor_Slider.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Hor_Slider.H 4288 2005-04-16 00:13:17Z mike $"
+// "$Id: Fl_Hor_Slider.H 6614 2009-01-01 16:11:32Z matt $"
//
// Horizontal slider header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,6 +25,9 @@
// http://www.fltk.org/str.php
//
+/* \file
+ Fl_Hor_Slider widget . */
+
#ifndef Fl_Hor_Slider_H
#define Fl_Hor_Slider_H
@@ -39,5 +42,5 @@ public:
#endif
//
-// End of "$Id: Fl_Hor_Slider.H 4288 2005-04-16 00:13:17Z mike $".
+// End of "$Id: Fl_Hor_Slider.H 6614 2009-01-01 16:11:32Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Hor_Value_Slider.H b/plugins/zynaddsubfx/fltk/FL/Fl_Hor_Value_Slider.H
index d499feadf..a02a50c31 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Hor_Value_Slider.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Hor_Value_Slider.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Hor_Value_Slider.H 4288 2005-04-16 00:13:17Z mike $"
+// "$Id: Fl_Hor_Value_Slider.H 6614 2009-01-01 16:11:32Z matt $"
//
// Horizontal value slider header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,6 +25,9 @@
// http://www.fltk.org/str.php
//
+/* \file
+ Fl_Hor_Value_Slider widget . */
+
#ifndef Fl_Hor_Value_Slider_H
#define Fl_Hor_Value_Slider_H
@@ -39,5 +42,5 @@ public:
#endif
//
-// End of "$Id: Fl_Hor_Value_Slider.H 4288 2005-04-16 00:13:17Z mike $".
+// End of "$Id: Fl_Hor_Value_Slider.H 6614 2009-01-01 16:11:32Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Image.H b/plugins/zynaddsubfx/fltk/FL/Fl_Image.H
index 4d6f052d5..7d0aa9495 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Image.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Image.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Image.H 4288 2005-04-16 00:13:17Z mike $"
+// "$Id: Fl_Image.H 6614 2009-01-01 16:11:32Z matt $"
//
// Image header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,6 +25,9 @@
// http://www.fltk.org/str.php
//
+/* \file
+ Fl_Image, Fl_RGB_Image classes . */
+
#ifndef Fl_Image_H
# define Fl_Image_H
@@ -34,6 +37,17 @@ class Fl_Widget;
struct Fl_Menu_Item;
struct Fl_Label;
+/**
+ Fl_Image is the base class used for caching and
+ drawing all kinds of images in FLTK. This class keeps track of
+ common image data such as the pixels, colormap, width, height,
+ and depth. Virtual methods are used to provide type-specific
+ image handling.
+
+ Since the Fl_Image class does not support image
+ drawing by itself, calling the draw() method results in
+ a box with an X in it being drawn instead.
+*/
class FL_EXPORT Fl_Image {
int w_, h_, d_, ld_, count_;
const char * const *data_;
@@ -44,10 +58,34 @@ class FL_EXPORT Fl_Image {
protected:
+ /**
+ The first form of the w() method returns the current
+ image width in pixels.
+
+ The second form is a protected method that sets the current
+ image width.
+ */
void w(int W) {w_ = W;}
+ /**
+ The first form of the h() method returns the current
+ image height in pixels.
+
+ The second form is a protected method that sets the current
+ image height.
+ */
void h(int H) {h_ = H;}
+ /**
+ The first form of the d() method returns the current
+ image depth. The return value will be 0 for bitmaps, 1 for
+ pixmaps, and 1 to 4 for color images.
+
+ The second form is a protected method that sets the current
+ image depth.
+ */
void d(int D) {d_ = D;}
+ /** See int ld() */
void ld(int LD) {ld_ = LD;}
+ /** See const char * const *data() */
void data(const char * const *p, int c) {data_ = p; count_ = c;}
void draw_empty(int X, int Y);
@@ -56,27 +94,99 @@ class FL_EXPORT Fl_Image {
public:
+ /** See void Fl_Image::w(int) */
int w() const {return w_;}
+ /** See void Fl_Image::h(int) */
int h() const {return h_;}
+ /**
+ The first form of the d() method returns the current
+ image depth. The return value will be 0 for bitmaps, 1 for
+ pixmaps, and 1 to 4 for color images.
+
+ The second form is a protected method that sets the current
+ image depth.
+ */
int d() const {return d_;}
+ /**
+ The first form of the ld() method returns the current
+ line data size in bytes. Line data is extra data that is included
+ after each line of color image data and is normally not present.
+
+ The second form is a protected method that sets the current
+ line data size in bytes.
+ */
int ld() const {return ld_;}
+ /**
+ The count() method returns the number of data values
+ associated with the image. The value will be 0 for images with
+ no associated data, 1 for bitmap and color images, and greater
+ than 2 for pixmap images.
+ */
int count() const {return count_;}
+ /**
+ The first form of the data() method returns a
+ pointer to the current image data array. Use the
+ count() method to find the size of the data array.
+
+ The second form is a protected method that sets the current
+ array pointer and count of pointers in the array.
+ */
const char * const *data() const {return data_;}
+ /**
+ The constructor creates an empty image with the specified
+ width, height, and depth. The width and height are in pixels.
+ The depth is 0 for bitmaps, 1 for pixmap (colormap) images, and
+ 1 to 4 for color images.
+ */
Fl_Image(int W, int H, int D) {w_ = W; h_ = H; d_ = D; ld_ = 0; count_ = 0; data_ = 0;}
virtual ~Fl_Image();
virtual Fl_Image *copy(int W, int H);
+ /**
+ The copy() method creates a copy of the specified
+ image. If the width and height are provided, the image is
+ resized to the specified size. The image should be deleted (or in
+ the case of Fl_Shared_Image, released) when you are done
+ with it.
+ */
Fl_Image *copy() { return copy(w(), h()); }
virtual void color_average(Fl_Color c, float i);
+ /**
+ The inactive() method calls
+ color_average(FL_BACKGROUND_COLOR, 0.33f) to produce
+ an image that appears grayed out. This method does not
+ alter the original image data.
+ */
void inactive() { color_average(FL_GRAY, .33f); }
virtual void desaturate();
virtual void label(Fl_Widget*w);
virtual void label(Fl_Menu_Item*m);
- virtual void draw(int X, int Y, int W, int H, int cx=0, int cy=0);
- void draw(int X, int Y) {draw(X, Y, w(), h(), 0, 0);}
+ /**
+ The draw() methods draw the image. This form specifies
+ a bounding box for the image, with the origin
+ (upper-lefthand corner) of the image offset by the cx
+ and cy arguments.
+ */
+ virtual void draw(int X, int Y, int W, int H, int cx=0, int cy=0); // platform dependent
+ /**
+ The draw() methods draw the image. This form
+ specifies the upper-lefthand corner of the image
+ */
+ void draw(int X, int Y) {draw(X, Y, w(), h(), 0, 0);} // platform dependent
virtual void uncache();
};
+/**
+ The Fl_RGB_Image class supports caching and drawing
+ of full-color images with 1 to 4 channels of color information.
+ Images with an even number of channels are assumed to contain
+ alpha information, which is used to blend the image with the
+ contents of the screen.
+
+ Fl_RGB_Image is defined in
+ <FL/Fl_Image.H>, however for compatibility reasons
+ <FL/Fl_RGB_Image.H> should be included.
+*/
class FL_EXPORT Fl_RGB_Image : public Fl_Image {
public:
@@ -90,7 +200,7 @@ class FL_EXPORT Fl_RGB_Image : public Fl_Image {
unsigned id; // for internal use
unsigned mask; // for internal use (mask bitmap)
#endif // __APPLE__ || WIN32
-
+/** The constructor creates a new image from the specified data. */
Fl_RGB_Image(const uchar *bits, int W, int H, int D=3, int LD=0) :
Fl_Image(W,H,D), array(bits), alloc_array(0), id(0), mask(0) {data((const char **)&array, 1); ld(LD);}
virtual ~Fl_RGB_Image();
@@ -108,5 +218,5 @@ class FL_EXPORT Fl_RGB_Image : public Fl_Image {
#endif // !Fl_Image_H
//
-// End of "$Id: Fl_Image.H 4288 2005-04-16 00:13:17Z mike $".
+// End of "$Id: Fl_Image.H 6614 2009-01-01 16:11:32Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Input.H b/plugins/zynaddsubfx/fltk/FL/Fl_Input.H
index 03823fe08..01ae60d48 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Input.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Input.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Input.H 5300 2006-08-14 07:06:45Z matt $"
+// "$Id: Fl_Input.H 6699 2009-03-18 22:58:12Z engelsman $"
//
// Input header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,17 +25,232 @@
// http://www.fltk.org/str.php
//
+/* \file
+ Fl_Input widget . */
+
#ifndef Fl_Input_H
#define Fl_Input_H
#include "Fl_Input_.H"
+/**
+ This is the FLTK text input widget. It displays a single line
+ of text and lets the user edit it. Normally it is drawn with an
+ inset box and a white background. The text may contain any
+ characters (even 0), and will correctly display anything, using
+ ^X notation for unprintable control characters and \\nnn notation
+ for unprintable characters with the high bit set. It assumes the
+ font can draw any characters in the ISO-8859-1 character set.
+
+
+
+ | Mouse button 1 | Moves the cursor to
+ this point. Drag selects characters. Double click selects words.
+ Triple click selects all text. Shift+click extends the selection.
+ When you select text it is automatically copied to the clipboard.
+ |
+
+ | Mouse button 2 | Insert the clipboard at
+ the point clicked. You can also select a region and replace it with the
+ clipboard by selecting the region with mouse button 2.
+ |
+
+ | Mouse button 3 | Currently acts like button 1. |
+
+ | Backspace | Deletes one character to the left, or
+ deletes the selected region. |
+ | Enter | May cause the callback, see when(). |
+ | ^A or Home | Go to start of line. |
+ | ^B or Left | Move left |
+ | ^C | Copy the selection to the clipboard |
+ | ^D or Delete | Deletes one character to the right
+ or deletes the selected region. |
+ | ^E or End | Go to the end of line. |
+ | ^F or Right | Move right |
+ | ^K | Delete to the end of line (next \\n character)
+ or deletes a single \\n character. These deletions are all concatenated
+ into the clipboard. |
+ | ^N or Down | Move down (for Fl_Multiline_Input
+ only, otherwise it moves to the next input field). |
+ | ^P or Up | Move up (for Fl_Multiline_Input only,
+ otherwise it moves to the previous input field). |
+ | ^U | Delete everything. |
+ | ^V or ^Y | Paste the clipboard |
+ | ^X or ^W | Copy the region to the clipboard and
+ delete it. |
+ | ^Z or ^_ | Undo. This is a single-level undo
+ mechanism, but all adjacent deletions and insertions are concatenated
+ into a single "undo". Often this will undo a lot more than you
+ expected. |
+ | Shift+move | Move the cursor but also extend the
+ selection. |
+
+ RightCtrl or
+ Compose |
+ \anchor Fl_Input_Compose_Character
+ Start a compose-character
+ sequence. The next one or two keys typed define the character to
+ insert (see table that follows.)
+
+ For instance, to type "á" type [compose][a]['] or [compose]['][a].
+
+ The character "nbsp" (non-breaking space) is typed by using
+ [compose][space].
+
+ The single-character sequences may be followed by a space if
+ necessary to remove ambiguity. For instance, if you really want to
+ type "ª~" rather than "ã" you must type [compose][a][space][~].
+
+ The same key may be used to "quote" control characters into the
+ text. If you need a ^Q character you can get one by typing
+ [compose][Control+Q].
+
+ X may have a key on the keyboard
+ defined as XK_Multi_key. If so this key may be used as well
+ as the right-hand control key. You can set this up with the program
+ xmodmap.
+
+ If your keyboard is set to support a foreign language you should
+ also be able to type "dead key" prefix characters. On X you will
+ actually be able to see what dead key you typed, and if you then move
+ the cursor without completing the sequence the accent will remain
+ inserted. |
+
+
+
+
+ Character Composition Table
+
+ | Keys | Char |
+ Keys | Char |
+ Keys | Char |
+ Keys | Char |
+ Keys | Char |
+ Keys | Char |
+
+
+ | sp | nbsp |
+ * | ° |
+ ` A | À |
+ D - | Ð |
+ ` a | à |
+ d - | ð |
+
+ | ! | ¡ |
+ + - | ± |
+ ' A | Á |
+ ~ N | Ñ |
+ ' a | á |
+ ~ n | ñ |
+
+ | % | ¢ |
+ 2 | ² |
+ A ^ | Â |
+ ` O | Ò |
+ ^ a | â |
+ ` o | ò |
+
+ | # | £ |
+ 3 | ³ |
+ ~ A | Ã |
+ ' O | Ó |
+ ~ a | ã |
+ ' o | ó |
+
+ | $ | ¤ |
+ ' | ´ |
+ : A | Ä |
+ ^ O | Ô |
+ : a | ä |
+ ^ o | ô |
+
+ | y = | ¥ |
+ u | µ |
+ * A | Å |
+ ~ O | Õ |
+ * a | å |
+ ~ o | õ |
+
+ | | | ¦ |
+ p | ¶ |
+ A E | Æ |
+ : O | Ö |
+ a e | æ |
+ : o | ö |
+
+ | & | § |
+ . | · |
+ , C | Ç |
+ x | × |
+ , c | ç |
+ - : | ÷ |
+
+ | : | ¨ |
+ , | ¸ |
+ E ` | È |
+ O / | Ø |
+ ` e | è |
+ o / | ø |
+
+ | c | © |
+ 1 | ¹ |
+ ' E | É |
+ ` U | Ù |
+ ' e | é |
+ ` u | ù |
+
+ | a | ª |
+ o | º |
+ ^ E | Ê |
+ ' U | Ú |
+ ^ e | ê |
+ ' u | ú |
+
+ | < < | « |
+ > > | » |
+ : E | Ë |
+ ^ U | Û |
+ : e | ë |
+ ^ u | û |
+
+ | ~ | ¬ |
+ 1 4 | ¼ |
+ ` I | Ì |
+ : U | Ü |
+ ` i | ì |
+ : u | ü |
+
+ | - | |
+ 1 2 | ½ |
+ ' I | Í |
+ ' Y | Ý |
+ ' i | í |
+ ' y | ý |
+
+ | r | ® |
+ 3 4 | ¾ |
+ ^ I | Î |
+ T H | Þ |
+ ^ i | î |
+ t h | þ |
+
+ | _ | ¯ |
+ ? | ¿ |
+ : I | Ï |
+ s s | ß |
+ : i | ï |
+ : y | ÿ |
+
+
+*/
class FL_EXPORT Fl_Input : public Fl_Input_ {
int handle_key();
int shift_position(int p);
int shift_up_down_position(int p);
-public:
+ void handle_mouse(int keepmark=0);
+protected:
void draw();
+public:
int handle(int);
Fl_Input(int,int,int,int,const char * = 0);
};
@@ -43,5 +258,5 @@ public:
#endif
//
-// End of "$Id: Fl_Input.H 5300 2006-08-14 07:06:45Z matt $".
+// End of "$Id: Fl_Input.H 6699 2009-03-18 22:58:12Z engelsman $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Input_.H b/plugins/zynaddsubfx/fltk/FL/Fl_Input_.H
index 0c52ce613..d418235ba 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Input_.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Input_.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Input_.H 4288 2005-04-16 00:13:17Z mike $"
+// "$Id: Fl_Input_.H 6777 2009-04-23 15:32:19Z matt $"
//
// Input base class header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,6 +25,9 @@
// http://www.fltk.org/str.php
//
+/* \file
+ Fl_Input_ widget . */
+
#ifndef Fl_Input__H
#define Fl_Input__H
@@ -46,100 +49,406 @@
#define FL_MULTILINE_INPUT_WRAP (FL_MULTILINE_INPUT | FL_INPUT_WRAP)
#define FL_MULTILINE_OUTPUT_WRAP (FL_MULTILINE_INPUT | FL_INPUT_READONLY | FL_INPUT_WRAP)
+/**
+ This class provides a low-overhead text input field.
+
+ This is a virtual base class below Fl_Input. It has all
+ the same interfaces, but lacks the handle() and
+ draw() method. You may want to subclass it if you are
+ one of those people who likes to change how the editing keys
+ work. It may also be useful for adding scrollbars
+ to the input field.
+
+ This can act like any of the subclasses of Fl_Input, by
+ setting type() to one of the following values:
+
+ \code
+ #define FL_NORMAL_INPUT 0
+ #define FL_FLOAT_INPUT 1
+ #define FL_INT_INPUT 2
+ #define FL_MULTILINE_INPUT 4
+ #define FL_SECRET_INPUT 5
+ #define FL_INPUT_TYPE 7
+ #define FL_INPUT_READONLY 8
+ #define FL_NORMAL_OUTPUT (FL_NORMAL_INPUT | FL_INPUT_READONLY)
+ #define FL_MULTILINE_OUTPUT (FL_MULTILINE_INPUT | FL_INPUT_READONLY)
+ #define FL_INPUT_WRAP 16
+ #define FL_MULTILINE_INPUT_WRAP (FL_MULTILINE_INPUT | FL_INPUT_WRAP)
+ #define FL_MULTILINE_OUTPUT_WRAP (FL_MULTILINE_INPUT | FL_INPUT_READONLY | FL_INPUT_WRAP)
+ \endcode
+
+ All variables that represent an index into a text buffer are byte-oriented,
+ not character oriented. Since utf8 characters can be up to six bytes long,
+ simply incrementing such an index will not reliably advance to the next character
+ in the text buffer.
+
+ Indices and pointers into the text buffer shoudl always point at an 7 bit ASCII
+ character or the beginning of a utf8 character sequence. Behavior for false
+ utf8 sequences and pointers into the middle of a seqeunce are undefined.
+
+ \see Fl_Text_Display, Fl_Text_Editor for more powerful text handling widgets
+
+ \internal
+ When porting this widget from ASCII to UTF8, previously legal pointers into
+ the text of this widget can become illegal by pointing into the middle of
+ a UTF8 seuence. This is not a big problem for Fl_Input_ because all code
+ in this module is quite tolerant. It could be problematic though when deriving
+ from this class because no feedback for illegal pointers is given. Additionaly,
+ a careless "copy" call can put partial UTF8 sequnces into the clipboard.
+
+ None of these issues should be desasterous. Nevertheless, we should
+ discuss how FLTK should handle false UTF8 suequences and pointers.
+*/
class FL_EXPORT Fl_Input_ : public Fl_Widget {
+ /** \internal Storage for the text field. */
const char* value_;
+
+ /** \internal Buffer memory for expanded text. \see expand() */
char* buffer;
+ /** \internal Size of text in bytes in the \p value_ field. */
int size_;
+
+ /** \internal \todo Please document me! */
int bufsize;
+
+ /** \internal Positin of the cursor in the document */
int position_;
+
+ /** \internal Position of the other and of the selected text. If \p position_ equals
+ \p mark_, no text is selected */
int mark_;
+
+ /** \internal Offset to text origin within wdget bounds */
int xscroll_, yscroll_;
+
+ /** \internal Minimal update pointer. Display requirs redraw from here to the end
+ of the buffer. */
int mu_p;
+
+ /** \internal Maximum size of buffer. \todo Is this really needed? */
int maximum_size_;
+ /** \internal Shorcut key that will get this widget the focus. */
+ int shortcut_;
+
+ /** \internal This is set if no text but only the cursor needs updating. */
uchar erase_cursor_only;
- uchar textfont_;
- uchar textsize_;
+
+ /** \internal The font used for the entire text. */
+ Fl_Font textfont_;
+
+ /** \internal Height of the font used for the entire text. */
+ Fl_Fontsize textsize_;
+
+ /** \internal color of the entire text */
unsigned textcolor_;
+
+ /** \internal color of the text cursor */
unsigned cursor_color_;
+ /** \internal Horizontal cursor position in pixels while movin up or down. */
+ static double up_down_pos;
+
+ /** \internal Flag to remeber last cursor move. */
+ static int was_up_down;
+
+ /* Convert a given text segment into the text that will be rendered on screen. */
const char* expand(const char*, char*) const;
+
+ /* Calculates the width in pixels of part of a text buffer. */
double expandpos(const char*, const char*, const char*, int*) const;
+
+ /* Mark a range of characters for update. */
void minimal_update(int, int);
+
+ /* Mark a range of characters for update. */
void minimal_update(int p);
+
+ /* Copy the value from a possibly static entry into the internal buffer. */
void put_in_buffer(int newsize);
+ /* Set the current font and font size. */
void setfont() const;
protected:
+ /* Finds the start of a word. */
int word_start(int i) const;
+
+ /* Finds the end of a word. */
int word_end(int i) const;
+
+ /* Finds the start of a line. */
int line_start(int i) const;
+
+ /* Finds the end of a line. */
int line_end(int i) const;
+
+ /* Draw the text in the passed bounding box. */
void drawtext(int, int, int, int);
+
+ /* Move the cursor to the column given by up_down_pos. */
int up_down_position(int, int keepmark=0);
+
+ /* Handle mouse clicks and mose moves. */
void handle_mouse(int, int, int, int, int keepmark=0);
+
+ /* Handle all kinds of text field related events. */
int handletext(int e, int, int, int, int);
+
+ /* Check the when() field and do a callback if indicated. */
void maybe_do_callback();
+
+ /** \internal Horizontal offset of text to left edge of widget. */
int xscroll() const {return xscroll_;}
+
+ /** \internal Vertical offset of text to top edge of widget. */
int yscroll() const {return yscroll_;}
+ /* Return the number of lines displayed on a single page. */
+ int linesPerPage();
+
public:
+ /* Change the size of the widget. */
void resize(int, int, int, int);
+ /* Creator */
Fl_Input_(int, int, int, int, const char* = 0);
+
+ /* Destructor */
~Fl_Input_();
+ /* Changes the widget text. */
int value(const char*);
+
+ /* Changes the widget text. */
int value(const char*, int);
+
+ /* Changes the widget text. */
int static_value(const char*);
+
+ /* Changes the widget text. */
int static_value(const char*, int);
+
+ /**
+ Returns the text displayed in the widget.
+
+ This function returns the current value, which is a pointer
+ to the internal buffer and is valid only until the next event is
+ handled.
+
+ \return pointer to an internal buffer - do not free() this
+ \see Fl_Input_::value(const char*)
+ */
const char* value() const {return value_;}
- char index(int i) const {return value_[i];}
+
+ /* Returns the character at index \p i. */
+ Fl_Char index(int i) const;
+
+ /**
+ Returns the number of bytes in value().
+
+ This may be greater than strlen(value()) if there are
+ \c nul characters in the text.
+
+ \return number of bytes in the text
+ */
int size() const {return size_;}
+
+ /** Sets the width and height of this widget.
+ \param [in] W, H new width and height
+ \see Fl_Widget::size(int, int) */
void size(int W, int H) { Fl_Widget::size(W, H); }
+
+ /** Gets the maximum length of the input field.
+ \todo It is not clear if this function is actually required */
int maximum_size() const {return maximum_size_;}
+
+ /** Sets the maximum length of the input field.
+ \todo It is not clear if this function is actually required */
void maximum_size(int m) {maximum_size_ = m;}
+ /** Gets the position of the text cursor.
+ \return the cursor position as an index
+ \see position(int, int)
+ */
int position() const {return position_;}
+
+ /** Gets the current selection mark.
+ \return index into the text */
int mark() const {return mark_;}
+
+ /* Sets the index for the cursor and mark. */
int position(int p, int m);
+
+ /** Set the cursor position and mark.
+ position(n) is the same as position(n, n).
+ \param p new index for cursor and mark
+ \return 0 if no positions changed
+ \see position(int, int), position(), mark(int)
+ */
int position(int p) {return position(p, p);}
+
+ /** Sets the current selection mark.
+ mark(n) is the same as position(position(),n).
+ \param m new index of the mark
+ \return 0 if the mark did not change
+ \see position(), position(int, int) */
int mark(int m) {return position(position(), m);}
+
+ /* Deletes text from b to e and inserts the new string text. */
int replace(int, int, const char*, int=0);
+
+ /**
+ Deletes the current selection.
+
+ This function deletes the currently selected text
+ \e without storing it in the clipboard. To use the clipboard,
+ you may call copy() first or copy_cuts() after
+ this call.
+
+ \return 0 if no data was copied
+ */
int cut() {return replace(position(), mark(), 0);}
+
+ /**
+ Deletes the next \p n bytes rounded to characters before or after the cursor.
+
+ This function deletes the currently selected text
+ \e without storing it in the clipboard. To use the clipboard,
+ you may call copy() first or copy_cuts() after
+ this call.
+
+ \param n number of bytes rounded to full characters and clamped to the buffer.
+ A negative number will cut characters to the left of the cursor.
+ \return 0 if no data was copied
+ */
int cut(int n) {return replace(position(), position()+n, 0);}
+
+ /**
+ Deletes all characters between index \p a and \p b.
+
+ This function deletes the currently selected text
+ \e without storing it in the clipboard. To use the clipboard,
+ you may call copy() first or copy_cuts() after
+ this call.
+
+ \param a, b range of bytes rounded to full characters and clamped to the buffer
+ \return 0 if no data was copied
+ */
int cut(int a, int b) {return replace(a, b, 0);}
+
+ /**
+ Inserts text at the cursor position.
+
+ This function inserts the string in \p t at the cursor
+ position() and moves the new position and mark to
+ the end of the inserted text.
+
+ \param [in] t text that will be inserted
+ \param [in] l length of text, or 0 if the string is terminated by \c nul.
+ \return 0 if no text was inserted
+ */
int insert(const char* t, int l=0){return replace(position_, mark_, t, l);}
+
+ /* Put the current selection into the clipboard. */
int copy(int clipboard);
+
+ /* Undo previous changes to the text buffer. */
int undo();
+
+ /* Copy the yank buffer to the clipboard. */
int copy_cuts();
- Fl_Font textfont() const {return (Fl_Font)textfont_;}
- void textfont(uchar s) {textfont_ = s;}
- uchar textsize() const {return textsize_;}
- void textsize(uchar s) {textsize_ = s;}
+ /** Return the shortcut key associtaed with this widget.
+ \return shortcut keystroke
+ \see Fl_Button::shortcut() */
+ int shortcut() const {return shortcut_;}
+
+ /**
+ Sets the shortcut key associtaed with this widget.
+ Pressing the shortcut key gives text editing focus to this widget.
+ \param [in] s new shortcut keystroke
+ \see Fl_Button::shortcut()
+ */
+ void shortcut(int s) {shortcut_ = s;}
+
+ /** Gets the font of the text in the input field.
+ \return the current Fl_Font index */
+ Fl_Font textfont() const {return textfont_;}
+
+ /** Sets the font of the text in the input field.
+ The text font defaults to \c FL_HELVETICA.
+ \param [in] s the new text font */
+ void textfont(Fl_Font s) {textfont_ = s;}
+
+ /** Gets the size of the text in the input field.
+ \return the text height in pixels */
+ Fl_Fontsize textsize() const {return textsize_;}
+
+ /** Sets the size of the text in the input field.
+ The text height defaults to \c FL_NORMAL_SIZE.
+ \param [in] s the new font height in pixel units */
+ void textsize(Fl_Fontsize s) {textsize_ = s;}
+
+ /** Gets the color of the text in the input field.
+ \return the text color
+ \see textcolor(unsigned) */
Fl_Color textcolor() const {return (Fl_Color)textcolor_;}
+
+ /** Sets the color of the text in the input field.
+ The text color defaults to \c FL_FOREGROUND_COLOR.
+ \param [in] n new text color
+ \see textcolor() */
void textcolor(unsigned n) {textcolor_ = n;}
+
+ /** Gets the color of the cursor.
+ \return the current cursor color */
Fl_Color cursor_color() const {return (Fl_Color)cursor_color_;}
+
+ /** Sets the color of the cursor.
+ The default color for the cursor is \c FL_BLACK.
+ \param [in] n the new cursor color */
void cursor_color(unsigned n) {cursor_color_ = n;}
+ /** Gets the input field type.
+ \return the current input type */
int input_type() const {return type() & FL_INPUT_TYPE; }
+
+ /** Sets the input field type.
+ A redraw() is required to reformat the input field.
+ \param [in] t new input type */
void input_type(int t) { type((uchar)(t | readonly())); }
+
+ /** Gets the read-only state of the input field.
+ \return non-zero if this widget is read-only */
int readonly() const { return type() & FL_INPUT_READONLY; }
+
+ /** Sets the read-only state of the input field.
+ \param [in] b if \p b is 0, the text in this widget can be edited by the user */
void readonly(int b) { if (b) type((uchar)(type() | FL_INPUT_READONLY));
else type((uchar)(type() & ~FL_INPUT_READONLY)); }
+
+ /**
+ Gets the word wrapping state of the input field.
+ Word wrap is only functional with multi-line input fields.
+ */
int wrap() const { return type() & FL_INPUT_WRAP; }
+
+ /**
+ Sets the word wrapping state of the input field.
+ Word wrap is only functional with multi-line input fields.
+ */
void wrap(int b) { if (b) type((uchar)(type() | FL_INPUT_WRAP));
else type((uchar)(type() & ~FL_INPUT_WRAP)); }
+
};
#endif
//
-// End of "$Id: Fl_Input_.H 4288 2005-04-16 00:13:17Z mike $".
+// End of "$Id: Fl_Input_.H 6777 2009-04-23 15:32:19Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Input_Choice.H b/plugins/zynaddsubfx/fltk/FL/Fl_Input_Choice.H
index 3c2c22f96..26345a44e 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Input_Choice.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Input_Choice.H
@@ -1,5 +1,5 @@
//
-// "$Id$"
+// "$Id: Fl_Input_Choice.H 6614 2009-01-01 16:11:32Z matt $"
//
// An input/chooser widget.
// ______________ ____
@@ -7,7 +7,7 @@
// | input area || \/ |
// |______________||____|
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
// Copyright 2004 by Greg Ercolano.
//
// This library is free software; you can redistribute it and/or
@@ -30,6 +30,11 @@
// http://www.fltk.org/str.php
//
+/* \file
+ Fl_Input_Choice widget . */
+
+
+
#ifndef Fl_Input_Choice_H
#define Fl_Input_Choice_H
@@ -40,6 +45,17 @@
#include
#include
+/**
+ A combination of the input widget and a menu button.
+ The user can either type into the input area, or use the
+ menu button chooser on the right, which loads the input area
+ with predefined text. Normally it is drawn with an inset box
+ and a white background.
+
+ The application can directly access both the input and menu
+ widgets directly, using the menubutton()
+ and input() accessor methods.
+*/
class Fl_Input_Choice : public Fl_Group {
// Private class to handle slightly 'special' behavior of menu button
class InputMenuButton : public Fl_Menu_Button {
@@ -112,6 +128,11 @@ class Fl_Input_Choice : public Fl_Group {
inline int menu_h() { return(h() - Fl::box_dh(box())); }
public:
+ /**
+ Creates a new Fl_Input_Choice widget using the given position, size,
+ and label string.
+
Inherited destructor Destroys the widget and any value associated with it.
+ */
Fl_Input_Choice (int x,int y,int w,int h,const char*l=0) : Fl_Group(x,y,w,h,l) {
Fl_Group::box(FL_DOWN_BOX);
align(FL_ALIGN_LEFT); // default like Fl_Input
@@ -126,12 +147,10 @@ public:
menu_->box(FL_FLAT_BOX); // cosmetic
end();
}
- void add(const char *s) {
- menu_->add(s);
- }
- int changed() const {
- return inp_->changed() | Fl_Widget::changed();
- }
+
+ /** Adds an item to the menu.*/
+ void add(const char *s) { menu_->add(s); }
+ int changed() const { return inp_->changed() | Fl_Widget::changed();}
void clear_changed() {
inp_->clear_changed();
Fl_Widget::clear_changed();
@@ -140,60 +159,58 @@ public:
inp_->set_changed();
// no need to call Fl_Widget::set_changed()
}
- void clear() {
- menu_->clear();
- }
- Fl_Boxtype down_box() const {
- return (menu_->down_box());
- }
- void down_box(Fl_Boxtype b) {
- menu_->down_box(b);
- }
- const Fl_Menu_Item *menu() {
- return (menu_->menu());
- }
- void menu(const Fl_Menu_Item *m) {
- menu_->menu(m);
- }
+ /** Removes all items from the menu. */
+ void clear() { menu_->clear(); }
+ /** Gets the box type of the menu button */
+ Fl_Boxtype down_box() const { return (menu_->down_box()); }
+ /** Sets the box type of the menu button */
+ void down_box(Fl_Boxtype b) { menu_->down_box(b); }
+ /** Gets the Fl_Menu_Item array used for the menu. */
+ const Fl_Menu_Item *menu() { return (menu_->menu()); }
+ /** Sets the Fl_Menu_Item array used for the menu. */
+ void menu(const Fl_Menu_Item *m) { menu_->menu(m); }
void resize(int X, int Y, int W, int H) {
Fl_Group::resize(X,Y,W,H);
inp_->resize(inp_x(), inp_y(), inp_w(), inp_h());
menu_->resize(menu_x(), menu_y(), menu_w(), menu_h());
}
- Fl_Color textcolor() const {
- return (inp_->textcolor());
- }
- void textcolor(Fl_Color c) {
- inp_->textcolor(c);
- }
- uchar textfont() const {
- return (inp_->textfont());
- }
- void textfont(uchar f) {
- inp_->textfont(f);
- }
- uchar textsize() const {
- return (inp_->textsize());
- }
- void textsize(uchar s) {
- inp_->textsize(s);
- }
- const char* value() const {
- return (inp_->value());
- }
- void value(const char *val) {
- inp_->value(val);
- }
+ /** Gets the encapsulated input text color attributes */
+ Fl_Color textcolor() const { return (inp_->textcolor());}
+ /** Sets the encapsulated input text color attributes */
+ void textcolor(Fl_Color c) { inp_->textcolor(c);}
+ /** Gets the encapsulated input text font attributes */
+ Fl_Font textfont() const { return (inp_->textfont());}
+ /** Sets the encapsulated input text font attributes */
+ void textfont(Fl_Font f) { inp_->textfont(f);}
+ /** Gets the encapsulated input size attributes */
+ Fl_Fontsize textsize() const { return (inp_->textsize()); }
+ /** Sets the encapsulated input size attributes */
+ void textsize(Fl_Fontsize s) { inp_->textsize(s); }
+ /** See void Fl_Input_Choice::value(const char *s) */
+ const char* value() const { return (inp_->value()); }
+ /**
+ Sets or returns the input widget's current contents. The
+ second form sets the contents using the index into the menu
+ which you can set as an integer. Setting the value effectively
+ 'chooses' this menu item, and sets it as the new input text,
+ deleting the previous text.
+ */
+ void value(const char *val) { inp_->value(val); }
+ /** See void Fl_Input_Choice::value(const char *s) */
void value(int val) {
menu_->value(val);
inp_->value(menu_->text(val));
}
+ /** Returns a reference to the internal Fl_Menu_Button widget. */
Fl_Menu_Button *menubutton() { return menu_; }
+ /**
+ Returns a reference to the internal Fl_Input widget.
+ */
Fl_Input *input() { return inp_; }
};
#endif // !Fl_Input_Choice_H
//
-// End of "$Id$".
+// End of "$Id: Fl_Input_Choice.H 6614 2009-01-01 16:11:32Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Int_Input.H b/plugins/zynaddsubfx/fltk/FL/Fl_Int_Input.H
index 641ad1639..85db694b6 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Int_Input.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Int_Input.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Int_Input.H 4288 2005-04-16 00:13:17Z mike $"
+// "$Id: Fl_Int_Input.H 6614 2009-01-01 16:11:32Z matt $"
//
// Integer input header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,19 +25,31 @@
// http://www.fltk.org/str.php
//
+/* \file
+ Fl_Int_Input widget . */
+
#ifndef Fl_Int_Input_H
#define Fl_Int_Input_H
#include "Fl_Input.H"
+/**
+ The Fl_Int_Input class is a subclass of Fl_Input
+ that only allows the user to type decimal digits (or hex numbers of the form 0xaef).
+*/
class Fl_Int_Input : public Fl_Input {
public:
- Fl_Int_Input(int X,int Y,int W,int H,const char *l = 0)
- : Fl_Input(X,Y,W,H,l) {type(FL_INT_INPUT);}
+ /**
+ Creates a new Fl_Int_Input widget using the given position,
+ size, and label string. The default boxtype is FL_DOWN_BOX.
+ Inherited destructor Destroys the widget and any value associated with it.
+ */
+ Fl_Int_Input(int X,int Y,int W,int H,const char *l = 0)
+ : Fl_Input(X,Y,W,H,l) {type(FL_INT_INPUT);}
};
#endif
//
-// End of "$Id: Fl_Int_Input.H 4288 2005-04-16 00:13:17Z mike $".
+// End of "$Id: Fl_Int_Input.H 6614 2009-01-01 16:11:32Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Light_Button.H b/plugins/zynaddsubfx/fltk/FL/Fl_Light_Button.H
index f056a3001..23085a3da 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Light_Button.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Light_Button.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Light_Button.H 4288 2005-04-16 00:13:17Z mike $"
+// "$Id: Fl_Light_Button.H 6614 2009-01-01 16:11:32Z matt $"
//
// Lighted button header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,11 +25,25 @@
// http://www.fltk.org/str.php
//
+/* \file
+ Fl_Light_Button widget . */
+
#ifndef Fl_Light_Button_H
#define Fl_Light_Button_H
#include "Fl_Button.H"
+/**
+
This subclass displays the "on" state by turning on a light,
+ rather than drawing pushed in. The shape of the "light"
+ is initially set to FL_DOWN_BOX. The color of the light when
+ on is controlled with selection_color(), which defaults to FL_YELLOW.
+
+ Buttons generate callbacks when they are clicked by the user. You
+ control exactly when and how by changing the values for type() and when().
+
\image html Fl_Light_Button.gif
+ \image latex Fl_Light_Button.eps "Fl_Light_Button" width=4cm
+*/
class FL_EXPORT Fl_Light_Button : public Fl_Button {
protected:
virtual void draw();
@@ -41,5 +55,5 @@ public:
#endif
//
-// End of "$Id: Fl_Light_Button.H 4288 2005-04-16 00:13:17Z mike $".
+// End of "$Id: Fl_Light_Button.H 6614 2009-01-01 16:11:32Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Line_Dial.H b/plugins/zynaddsubfx/fltk/FL/Fl_Line_Dial.H
index 301bff9de..64763c0b8 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Line_Dial.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Line_Dial.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Line_Dial.H 4288 2005-04-16 00:13:17Z mike $"
+// "$Id: Fl_Line_Dial.H 6614 2009-01-01 16:11:32Z matt $"
//
// Line dial header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,6 +25,9 @@
// http://www.fltk.org/str.php
//
+/* \file
+ Fl_Line_Dial widget . */
+
#ifndef Fl_Line_Dial_H
#define Fl_Line_Dial_H
@@ -39,5 +42,5 @@ public:
#endif
//
-// End of "$Id: Fl_Line_Dial.H 4288 2005-04-16 00:13:17Z mike $".
+// End of "$Id: Fl_Line_Dial.H 6614 2009-01-01 16:11:32Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Menu.H b/plugins/zynaddsubfx/fltk/FL/Fl_Menu.H
index 9d7798017..8cc42e32f 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Menu.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Menu.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Menu.H 4288 2005-04-16 00:13:17Z mike $"
+// "$Id: Fl_Menu.H 6614 2009-01-01 16:11:32Z matt $"
//
// Old menu header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,9 +25,9 @@
// http://www.fltk.org/str.php
//
-// this include file is for back compatability only
+// this include file is for back compatibility only
#include "Fl_Menu_Item.H"
//
-// End of "$Id: Fl_Menu.H 4288 2005-04-16 00:13:17Z mike $".
+// End of "$Id: Fl_Menu.H 6614 2009-01-01 16:11:32Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Menu_.H b/plugins/zynaddsubfx/fltk/FL/Fl_Menu_.H
index b04e4e93d..41bcd5c14 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Menu_.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Menu_.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Menu_.H 4288 2005-04-16 00:13:17Z mike $"
+// "$Id: Fl_Menu_.H 6614 2009-01-01 16:11:32Z matt $"
//
// Menu base class header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,6 +25,9 @@
// http://www.fltk.org/str.php
//
+/* \file
+ Fl_Menu_ widget . */
+
#ifndef Fl_Menu__H
#define Fl_Menu__H
@@ -33,6 +36,15 @@
#endif
#include "Fl_Menu_Item.H"
+/**
+ Base class of all widgets that have a menu in FLTK.
+ Currently FLTK provides you with
+ Fl_Menu_Button, Fl_Menu_Bar, and Fl_Choice.
+
+ The class contains a pointer to an array of structures of type Fl_Menu_Item. The
+ array may either be supplied directly by the user program, or it may
+ be "private": a dynamically allocated array managed by the Fl_Menu_.
+*/
class FL_EXPORT Fl_Menu_ : public Fl_Widget {
Fl_Menu_Item *menu_;
@@ -42,8 +54,8 @@ protected:
uchar alloc;
uchar down_box_;
- uchar textfont_;
- uchar textsize_;
+ Fl_Font textfont_;
+ Fl_Fontsize textsize_;
unsigned textcolor_;
public:
@@ -57,46 +69,78 @@ public:
const Fl_Menu_Item* test_shortcut() {return picked(menu()->test_shortcut());}
void global();
+ /**
+ Returns a pointer to the array of Fl_Menu_Items. This will either be
+ the value passed to menu(value) or the private copy.
+ */
const Fl_Menu_Item *menu() const {return menu_;}
void menu(const Fl_Menu_Item *m);
void copy(const Fl_Menu_Item *m, void* user_data = 0);
int add(const char*, int shortcut, Fl_Callback*, void* = 0, int = 0);
- int add(const char* a, const char* b, Fl_Callback* c,
- void* d = 0, int e = 0) {return add(a,fl_old_shortcut(b),c,d,e);}
+ /** See int Fl_Menu_::add(const char* label, int shortcut, Fl_Callback*, void *user_data=0, int flags=0)*/
+ int add(const char* a, const char* b, Fl_Callback* c, void* d = 0, int e = 0) {
+ return add(a,fl_old_shortcut(b),c,d,e);}
+ int add(const char *);
int size() const ;
void size(int W, int H) { Fl_Widget::size(W, H); }
void clear();
- int add(const char *);
void replace(int,const char *);
void remove(int);
+ /** Changes the shortcut of item i to n. */
void shortcut(int i, int s) {menu_[i].shortcut(s);}
+ /** Sets the flags of item i. For a list of the flags, see Fl_Menu_Item. */
void mode(int i,int fl) {menu_[i].flags = fl;}
+ /** Gets the flags of item i. For a list of the flags, see Fl_Menu_Item. */
int mode(int i) const {return menu_[i].flags;}
+ /** Returns a pointer to the last menu item that was picked. */
const Fl_Menu_Item *mvalue() const {return value_;}
+ /** Returns the index into menu() of the last item chosen by the user. It is zero initially. */
int value() const {return value_ ? (int)(value_-menu_) : -1;}
int value(const Fl_Menu_Item*);
+ /**
+ The value is the index into menu() of the last item chosen by
+ the user. It is zero initially. You can set it as an integer, or set
+ it with a pointer to a menu item. The set routines return non-zero if
+ the new value is different than the old one.
+ */
int value(int i) {return value(menu_+i);}
+ /** Returns the title of the last item chosen, or of item i. */
const char *text() const {return value_ ? value_->text : 0;}
+ /** Returns the title of the last item chosen, or of item i. */
const char *text(int i) const {return menu_[i].text;}
- Fl_Font textfont() const {return (Fl_Font)textfont_;}
- void textfont(uchar c) {textfont_=c;}
- uchar textsize() const {return textsize_;}
- void textsize(uchar c) {textsize_=c;}
+ /** Gets the current font of menu item labels. */
+ Fl_Font textfont() const {return textfont_;}
+ /** Sets the current font of menu item labels. */
+ void textfont(Fl_Font c) {textfont_=c;}
+ /** Gets the font size of menu item labels. */
+ Fl_Fontsize textsize() const {return textsize_;}
+ /** Sets the font size of menu item labels. */
+ void textsize(Fl_Fontsize c) {textsize_=c;}
+ /** Get the current color of menu item labels. */
Fl_Color textcolor() const {return (Fl_Color)textcolor_;}
+ /** Sets the current color of menu item labels. */
void textcolor(unsigned c) {textcolor_=c;}
+ /**
+ This box type is used to surround the currently-selected items in the
+ menus. If this is FL_NO_BOX then it acts like
+ FL_THIN_UP_BOX and selection_color() acts like
+ FL_WHITE, for back compatibility.
+ */
Fl_Boxtype down_box() const {return (Fl_Boxtype)down_box_;}
+ /** See Fl_Boxtype Fl_Menu_::down_box() const */
void down_box(Fl_Boxtype b) {down_box_ = b;}
- // back compatability:
+ /** For back compatibility, same as selection_color() */
Fl_Color down_color() const {return selection_color();}
+ /** For back compatibility, same as selection_color() */
void down_color(unsigned c) {selection_color(c);}
};
#endif
//
-// End of "$Id: Fl_Menu_.H 4288 2005-04-16 00:13:17Z mike $".
+// End of "$Id: Fl_Menu_.H 6614 2009-01-01 16:11:32Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Menu_Bar.H b/plugins/zynaddsubfx/fltk/FL/Fl_Menu_Bar.H
index ab240da7a..e48adbcdc 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Menu_Bar.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Menu_Bar.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Menu_Bar.H 4288 2005-04-16 00:13:17Z mike $"
+// "$Id: Fl_Menu_Bar.H 6614 2009-01-01 16:11:32Z matt $"
//
// Menu bar header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,16 +25,59 @@
// http://www.fltk.org/str.php
//
+/* \file
+ Fl_Menu_Bar widget . */
+
#ifndef Fl_Menu_Bar_H
#define Fl_Menu_Bar_H
#include "Fl_Menu_.H"
+/**
+ This widget provides a standard menubar interface. Usually you will
+ put this widget along the top edge of your window. The height of the
+ widget should be 30 for the menu titles to draw correctly with the
+ default font.
+
The items on the bar and the menus they bring up are defined by a
+ single Fl_Menu_Item
+ array. Because a Fl_Menu_Item array defines a hierarchy, the
+ top level menu defines the items in the menubar, while the submenus
+ define the pull-down menus. Sub-sub menus and lower pop up to the right
+ of the submenus.
+ \image html menubar.gif
+ \image latex menubar.eps " menubar" width=12cm
+ If there is an item in the top menu that is not a title of a
+ submenu, then it acts like a "button" in the menubar. Clicking on it
+ will pick it.
+ When the user picks an item off the menu, the item's callback is
+ done with the menubar as the Fl_Widget* argument. If the item
+ does not have a callback the menubar's callback is done instead.
+ Submenus will also pop up in response to shortcuts indicated by
+ putting a '&' character in the name field of the menu item. If you put a
+ '&' character in a top-level "button" then the shortcut picks it. The
+ '&' character in submenus is ignored until the menu is popped up.
+ Typing the shortcut() of any of the menu items will cause
+ callbacks exactly the same as when you pick the item with the mouse.
+*/
class FL_EXPORT Fl_Menu_Bar : public Fl_Menu_ {
protected:
void draw();
public:
int handle(int);
+ /**
+ Creates a new Fl_Menu_Bar widget using the given position,
+ size, and label string. The default boxtype is FL_UP_BOX.
+
The constructor sets menu() to NULL. See
+ Fl_Menu_ for the methods to set or change the menu.
+ labelsize(), labelfont(), and labelcolor()
+ are used to control how the menubar items are drawn. They are
+ initialized from the Fl_Menu static variables, but you can
+ change them if desired.
+ label() is ignored unless you change align() to
+ put it outside the menubar.
+
The destructor removes the Fl_Menu_Bar widget and all of its
+ menu items.
+ */
Fl_Menu_Bar(int X, int Y, int W, int H,const char *l=0)
: Fl_Menu_(X,Y,W,H,l) {}
};
@@ -42,5 +85,5 @@ public:
#endif
//
-// End of "$Id: Fl_Menu_Bar.H 4288 2005-04-16 00:13:17Z mike $".
+// End of "$Id: Fl_Menu_Bar.H 6614 2009-01-01 16:11:32Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Menu_Button.H b/plugins/zynaddsubfx/fltk/FL/Fl_Menu_Button.H
index 39a2665a0..430b66087 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Menu_Button.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Menu_Button.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Menu_Button.H 4288 2005-04-16 00:13:17Z mike $"
+// "$Id: Fl_Menu_Button.H 6614 2009-01-01 16:11:32Z matt $"
//
// Menu button header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,11 +25,35 @@
// http://www.fltk.org/str.php
//
+/* \file
+ Fl_Menu_Button widget . */
+
#ifndef Fl_Menu_Button_H
#define Fl_Menu_Button_H
#include "Fl_Menu_.H"
+/**
+ This is a button that when pushed pops up a menu (or hierarchy of
+ menus) defined by an array of
+ Fl_Menu_Item objects.
+
\image html menu_button.gif
+ \image latex menu_button.eps " menu_button" width=5cm
+ Normally any mouse button will pop up a menu and it is lined up
+ below the button as shown in the picture. However an Fl_Menu_Button
+ may also control a pop-up menu. This is done by setting the type()
+ , see below.
+ The menu will also pop up in response to shortcuts indicated by
+ putting a '&' character in the label().
+ Typing the shortcut() of any of the menu items will cause
+ callbacks exactly the same as when you pick the item with the mouse.
+ The '&' character in menu item names are only looked at when the menu is
+ popped up, however.
+ When the user picks an item off the menu, the item's callback is
+ done with the menu_button as the Fl_Widget* argument. If the
+ item does not have a callback the menu_button's callback is done
+ instead.
+*/
class FL_EXPORT Fl_Menu_Button : public Fl_Menu_ {
protected:
void draw();
@@ -44,5 +68,5 @@ public:
#endif
//
-// End of "$Id: Fl_Menu_Button.H 4288 2005-04-16 00:13:17Z mike $".
+// End of "$Id: Fl_Menu_Button.H 6614 2009-01-01 16:11:32Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Menu_Item.H b/plugins/zynaddsubfx/fltk/FL/Fl_Menu_Item.H
index 33e520a67..b4052b8c8 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Menu_Item.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Menu_Item.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Menu_Item.H 4288 2005-04-16 00:13:17Z mike $"
+// "$Id: Fl_Menu_Item.H 6614 2009-01-01 16:11:32Z matt $"
//
// Menu item header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -51,64 +51,285 @@ extern FL_EXPORT int fl_old_shortcut(const char*);
class Fl_Menu_;
+/**
+ The Fl_Menu_Item structure defines a single menu item that
+ is used by the Fl_Menu_ class.
+ \code
+ struct Fl_Menu_Item {
+ const char* text; // label()
+ ulong shortcut_;
+ Fl_Callback* callback_;
+ void* user_data_;
+ int flags;
+ uchar labeltype_;
+ uchar labelfont_;
+ uchar labelsize_;
+ uchar labelcolor_;
+ };
+
+ enum { // values for flags:
+ FL_MENU_INACTIVE = 1,
+ FL_MENU_TOGGLE = 2,
+ FL_MENU_VALUE = 4,
+ FL_MENU_RADIO = 8,
+ FL_MENU_INVISIBLE = 0x10,
+ FL_SUBMENU_POINTER = 0x20,
+ FL_SUBMENU = 0x40,
+ FL_MENU_DIVIDER = 0x80,
+ FL_MENU_HORIZONTAL = 0x100
+ };
+ \endcode
+ Typically menu items are statically defined; for example:
+ \code
+ Fl_Menu_Item popup[] = {
+ {"&alpha", FL_ALT+'a', the_cb, (void*)1},
+ {"&beta", FL_ALT+'b', the_cb, (void*)2},
+ {"gamma", FL_ALT+'c', the_cb, (void*)3, FL_MENU_DIVIDER},
+ {"&strange", 0, strange_cb},
+ {"&charm", 0, charm_cb},
+ {"&truth", 0, truth_cb},
+ {"b&eauty", 0, beauty_cb},
+ {"sub&menu", 0, 0, 0, FL_SUBMENU},
+ {"one"},
+ {"two"},
+ {"three"},
+ {0},
+ {"inactive", FL_ALT+'i', 0, 0, FL_MENU_INACTIVE|FL_MENU_DIVIDER},
+ {"invisible",FL_ALT+'i', 0, 0, FL_MENU_INVISIBLE},
+ {"check", FL_ALT+'i', 0, 0, FL_MENU_TOGGLE|FL_MENU_VALUE},
+ {"box", FL_ALT+'i', 0, 0, FL_MENU_TOGGLE},
+ {0}};
+ \endcode
+ produces:
+
+ \image html menu.gif
+ \image latex menu.eps "menu" width=10cm
+
+ A submenu title is identified by the bit FL_SUBMENU in the
+ flags field, and ends with a label() that is NULL.
+ You can nest menus to any depth. A pointer to the first item in the
+ submenu can be treated as an Fl_Menu array itself. It is also
+ possible to make separate submenu arrays with FL_SUBMENU_POINTER flags.
+
+ You should use the method functions to access structure members and
+ not access them directly to avoid compatibility problems with future
+ releases of FLTK.
+*/
struct FL_EXPORT Fl_Menu_Item {
- const char *text; // label()
- int shortcut_;
- Fl_Callback *callback_;
- void *user_data_;
- int flags;
- uchar labeltype_;
- uchar labelfont_;
- uchar labelsize_;
- unsigned labelcolor_;
+ const char *text; ///< menu item text, returned by label()
+ int shortcut_; ///< menu item shortcut
+ Fl_Callback *callback_; ///< menu item callback
+ void *user_data_; ///< menu item user_data for 3rd party apps
+ int flags; ///< menu item flags like FL_MENU_TOGGLE, FL_MENU_RADIO
+ uchar labeltype_; ///< how the menu item text looks like
+ Fl_Font labelfont_; ///< which font for this menu item text
+ Fl_Fontsize labelsize_; ///< size of menu item text
+ unsigned labelcolor_; ///< menu item text color
// advance N items, skipping submenus:
const Fl_Menu_Item *next(int=1) const;
+
+ /**
+ Advances a pointer by n items through a menu array, skipping
+ the contents of submenus and invisible items. There are two calls so
+ that you can advance through const and non-const data.
+ */
Fl_Menu_Item *next(int i=1) {
return (Fl_Menu_Item*)(((const Fl_Menu_Item*)this)->next(i));}
+
+ /** Returns the first menu item, same as next(0). */
const Fl_Menu_Item *first() const { return next(0); }
+
+ /** Returns the first menu item, same as next(0). */
Fl_Menu_Item *first() { return next(0); }
// methods on menu items:
+ /**
+ Returns the title of the item.
+ A NULL here indicates the end of the menu (or of a submenu).
+ A '&' in the item will print an underscore under the next letter,
+ and if the menu is popped up that letter will be a "shortcut" to pick
+ that item. To get a real '&' put two in a row.
+ */
const char* label() const {return text;}
+
+ /** See const char* Fl_Menu_Item::label() const */
void label(const char* a) {text=a;}
+
+ /** See const char* Fl_Menu_Item::label() const */
void label(Fl_Labeltype a,const char* b) {labeltype_ = a; text = b;}
+
+ /**
+ A labeltype identifies a routine that draws the label of the
+ widget. This can be used for special effects such as emboss, or to use
+ the label() pointer as another form of data such as a bitmap.
+ The value FL_NORMAL_LABEL prints the label as text.
+ */
Fl_Labeltype labeltype() const {return (Fl_Labeltype)labeltype_;}
+
+ /**
+ A labeltype identifies a routine that draws the label of the
+ widget. This can be used for special effects such as emboss, or to use
+ the label() pointer as another form of data such as a bitmap.
+ The value FL_NORMAL_LABEL prints the label as text.
+ */
void labeltype(Fl_Labeltype a) {labeltype_ = a;}
+
+ /**
+ This color is passed to the labeltype routine, and is typically the
+ color of the label text. This defaults to FL_BLACK. If this
+ color is not black fltk will not use overlay bitplanes to draw
+ the menu - this is so that images put in the menu draw correctly.
+ */
Fl_Color labelcolor() const {return (Fl_Color)labelcolor_;}
+
+ /** See Fl_Color Fl_Menu_Item::labelcolor() const */
void labelcolor(unsigned a) {labelcolor_ = a;}
- Fl_Font labelfont() const {return (Fl_Font)labelfont_;}
- void labelfont(uchar a) {labelfont_ = a;}
- uchar labelsize() const {return labelsize_;}
- void labelsize(uchar a) {labelsize_ = a;}
+ /**
+ Fonts are identified by small 8-bit indexes into a table. See the
+ enumeration list for predefined fonts. The default value is a
+ Helvetica font. The function Fl::set_font() can define new fonts.
+ */
+ Fl_Font labelfont() const {return labelfont_;}
+
+ /**
+ Fonts are identified by small 8-bit indexes into a table. See the
+ enumeration list for predefined fonts. The default value is a
+ Helvetica font. The function Fl::set_font() can define new fonts.
+ */
+ void labelfont(Fl_Font a) {labelfont_ = a;}
+
+ /** Gets the label font pixel size/height.*/
+ Fl_Fontsize labelsize() const {return labelsize_;}
+
+ /** Sets the label font pixel size/height.*/
+ void labelsize(Fl_Fontsize a) {labelsize_ = a;}
+
+ /**
+ Each item has space for a callback function and an argument for that
+ function. Due to back compatibility, the Fl_Menu_Item itself
+ is not passed to the callback, instead you have to get it by calling
+ ((Fl_Menu_*)w)->mvalue() where w is the widget argument.
+ */
Fl_Callback_p callback() const {return callback_;}
+
+ /** See Fl_Callback_p Fl_MenuItem::callback() const */
void callback(Fl_Callback* c, void* p) {callback_=c; user_data_=p;}
+
+ /** See Fl_Callback_p Fl_MenuItem::callback() const */
void callback(Fl_Callback* c) {callback_=c;}
+
+ /** See Fl_Callback_p Fl_MenuItem::callback() const */
void callback(Fl_Callback0*c) {callback_=(Fl_Callback*)c;}
+
+ /** See Fl_Callback_p Fl_MenuItem::callback() const */
void callback(Fl_Callback1*c, long p=0) {callback_=(Fl_Callback*)c; user_data_=(void*)p;}
+
+ /**
+ Get or set the user_data argument that is sent to the
+ callback function.
+ */
void* user_data() const {return user_data_;}
+ /**
+ Get or set the user_data argument that is sent to the
+ callback function.
+ */
void user_data(void* v) {user_data_ = v;}
+ /**
+ For convenience you can also define the callback as taking a long
+ argument. This is implemented by casting this to a Fl_Callback
+ and casting the long to a void* and may not be
+ portable to some machines.
+ */
long argument() const {return (long)user_data_;}
+ /**
+ For convenience you can also define the callback as taking a long
+ argument. This is implemented by casting this to a Fl_Callback
+ and casting the long to a void* and may not be
+ portable to some machines.
+ */
void argument(long v) {user_data_ = (void*)v;}
+
+ /** Gets what key combination shortcut will trigger the menu item. */
int shortcut() const {return shortcut_;}
+
+ /**
+ Sets exactly what key combination will trigger the menu item. The
+ value is a logical 'or' of a key and a set of shift flags, for instance
+ FL_ALT+'a' or FL_ALT+FL_F+10 or just 'a'. A value of
+ zero disables the shortcut.
+
+ The key can be any value returned by Fl::event_key(), but will usually
+ be an ASCII letter. Use a lower-case letter unless you require the shift
+ key to be held down.
+
+ The shift flags can be any set of values accepted by Fl::event_state().
+ If the bit is on that shift key must be pushed. Meta, Alt, Ctrl,
+ and Shift must be off if they are not in the shift flags (zero for the
+ other bits indicates a "don't care" setting).
+ */
void shortcut(int s) {shortcut_ = s;}
+ /**
+ Returns true if either FL_SUBMENU or FL_SUBMENU_POINTER
+ is on in the flags. FL_SUBMENU indicates an embedded submenu
+ that goes from the next item through the next one with a NULL
+ label(). FL_SUBMENU_POINTER indicates that user_data()
+ is a pointer to another menu array.
+ */
int submenu() const {return flags&(FL_SUBMENU|FL_SUBMENU_POINTER);}
+ /**
+ Returns true if a checkbox will be drawn next to this item. This is
+ true if FL_MENU_TOGGLE or FL_MENU_RADIO is set in the flags.
+ */
int checkbox() const {return flags&FL_MENU_TOGGLE;}
+ /**
+ Returns true if this item is a radio item. When a radio button is
+ selected all "adjacent" radio buttons are turned off. A set of radio
+ items is delimited by an item that has radio() false, or by an
+ item with FL_MENU_DIVIDER turned on.
+ */
int radio() const {return flags&FL_MENU_RADIO;}
+ /** Returns the current value of the check or radio item. */
int value() const {return flags&FL_MENU_VALUE;}
+ /**
+ Turns the check or radio item "on" for the menu item. Note that this
+ does not turn off any adjacent radio items like set_only() does.
+ */
void set() {flags |= FL_MENU_VALUE;}
+
+ /** Turns the check or radio item "off" for the menu item. */
void clear() {flags &= ~FL_MENU_VALUE;}
+
void setonly();
+
+ /** Gets the visibility of an item. */
int visible() const {return !(flags&FL_MENU_INVISIBLE);}
+
+ /** Makes an item visible in the menu. */
void show() {flags &= ~FL_MENU_INVISIBLE;}
+
+ /** Hides an item in the menu. */
void hide() {flags |= FL_MENU_INVISIBLE;}
+
+ /** Gets whether or not the item can be picked. */
int active() const {return !(flags&FL_MENU_INACTIVE);}
+
+ /** Allows a menu item to be picked. */
void activate() {flags &= ~FL_MENU_INACTIVE;}
+ /**
+ Prevents a menu item from being picked. Note that this will also cause
+ the menu item to appear grayed-out.
+ */
void deactivate() {flags |= FL_MENU_INACTIVE;}
- int activevisible() const {return !(flags&0x11);}
+ /** Returns non 0 if FL_INACTIVE and FL_INVISIBLE are cleared, 0 otherwise. */
+ int activevisible() const {return !(flags & (FL_MENU_INACTIVE|FL_MENU_INVISIBLE));}
// compatibility for FLUID so it can set the image of a menu item...
+
+ /** compatibility api for FLUID, same as a->label(this) */
void image(Fl_Image* a) {a->label(this);}
+
+ /** compatibility api for FLUID, same as a.label(this) */
void image(Fl_Image& a) {a.label(this);}
// used by menubar:
@@ -130,24 +351,54 @@ struct FL_EXPORT Fl_Menu_Item {
const Fl_Menu_Item* test_shortcut() const;
const Fl_Menu_Item* find_shortcut(int *ip=0) const;
+ /**
+ Calls the Fl_Menu_Item item's callback, and provides the
+ Fl_Widget argument (and optionally overrides the user_data()
+ argument). You must first check that callback() is non-zero
+ before calling this.
+ */
void do_callback(Fl_Widget* o) const {callback_(o, user_data_);}
+
+ /**
+ Calls the Fl_Menu_Item item's callback, and provides the
+ Fl_Widget argument (and optionally overrides the user_data()
+ argument). You must first check that callback() is non-zero
+ before calling this.
+ */
void do_callback(Fl_Widget* o,void* arg) const {callback_(o, arg);}
+
+ /**
+ Calls the Fl_Menu_Item item's callback, and provides the
+ Fl_Widget argument (and optionally overrides the user_data()
+ argument). You must first check that callback() is non-zero
+ before calling this.
+ */
void do_callback(Fl_Widget* o,long arg) const {callback_(o, (void*)arg);}
- // back-compatability, do not use:
+ // back-compatibility, do not use:
+
+ /** back compatibility only \deprecated. */
int checked() const {return flags&FL_MENU_VALUE;}
+
+ /** back compatibility only \deprecated. */
void check() {flags |= FL_MENU_VALUE;}
+
+ /** back compatibility only \deprecated. */
void uncheck() {flags &= ~FL_MENU_VALUE;}
+
int add(const char*, int shortcut, Fl_Callback*, void* =0, int = 0);
+
+ /** See int add(const char*, int shortcut, Fl_Callback*, void*, int) */
int add(const char*a, const char* b, Fl_Callback* c,
void* d = 0, int e = 0) {
return add(a,fl_old_shortcut(b),c,d,e);}
+
int size() const ;
};
-typedef Fl_Menu_Item Fl_Menu; // back compatability
+typedef Fl_Menu_Item Fl_Menu; // back compatibility
-enum { // back-compatability enum:
+enum { // back-compatibility enum:
FL_PUP_NONE = 0,
FL_PUP_GREY = FL_MENU_INACTIVE,
FL_PUP_GRAY = FL_MENU_INACTIVE,
@@ -163,5 +414,5 @@ enum { // back-compatability enum:
#endif
//
-// End of "$Id: Fl_Menu_Item.H 4288 2005-04-16 00:13:17Z mike $".
+// End of "$Id: Fl_Menu_Item.H 6614 2009-01-01 16:11:32Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Menu_Window.H b/plugins/zynaddsubfx/fltk/FL/Fl_Menu_Window.H
index 1056fb2e0..e2e77f1ea 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Menu_Window.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Menu_Window.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Menu_Window.H 4288 2005-04-16 00:13:17Z mike $"
+// "$Id: Fl_Menu_Window.H 6614 2009-01-01 16:11:32Z matt $"
//
// Menu window header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,11 +25,20 @@
// http://www.fltk.org/str.php
//
+/* \file
+ Fl_Menu_Window widget . */
+
#ifndef Fl_Menu_Window_H
#define Fl_Menu_Window_H
#include "Fl_Single_Window.H"
+/**
+ The Fl_Menu_Window widget is a window type used for menus. By
+ default the window is drawn in the hardware overlay planes if they are
+ available so that the menu don't force the rest of the window to
+ redraw.
+*/
class FL_EXPORT Fl_Menu_Window : public Fl_Single_Window {
enum {NO_OVERLAY = 128};
public:
@@ -37,12 +46,18 @@ public:
void erase();
void flush();
void hide();
+ /** Tells if hardware overlay mode is set */
int overlay() {return !(flags()&NO_OVERLAY);}
+ /** Tells FLTK to use hardware overlay planes if they are available. */
void set_overlay() {clear_flag(NO_OVERLAY);}
+ /** Tells FLTK to use normal drawing planes instead of overlay planes.
+ This is usually necessary if your menu contains multi-color pixmaps. */
void clear_overlay() {set_flag(NO_OVERLAY);}
~Fl_Menu_Window();
+ /** Creates a new Fl_Menu_Window widget using the given size, and label string. */
Fl_Menu_Window(int W, int H, const char *l = 0)
: Fl_Single_Window(W,H,l) { image(0); }
+ /** Creates a new Fl_Menu_Window widget using the given position, size, and label string. */
Fl_Menu_Window(int X, int Y, int W, int H, const char *l = 0)
: Fl_Single_Window(X,Y,W,H,l) { image(0); }
};
@@ -50,5 +65,5 @@ public:
#endif
//
-// End of "$Id: Fl_Menu_Window.H 4288 2005-04-16 00:13:17Z mike $".
+// End of "$Id: Fl_Menu_Window.H 6614 2009-01-01 16:11:32Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Multi_Browser.H b/plugins/zynaddsubfx/fltk/FL/Fl_Multi_Browser.H
index c1646dc05..18303b18c 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Multi_Browser.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Multi_Browser.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Multi_Browser.H 4288 2005-04-16 00:13:17Z mike $"
+// "$Id: Fl_Multi_Browser.H 6614 2009-01-01 16:11:32Z matt $"
//
// Multi browser header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,13 +25,32 @@
// http://www.fltk.org/str.php
//
+/* \file
+ Fl_Multi_Browser widget . */
+
#ifndef Fl_Multi_Browser_H
#define Fl_Multi_Browser_H
#include "Fl_Browser.H"
+/**
+ The Fl_Multi_Browser class is a subclass of Fl_Browser
+ which lets the user select any set of the lines. The user interface
+ is Macintosh style: clicking an item turns off all the others and
+ selects that one, dragging selects all the items the mouse moves over,
+ and shift + click toggles the items. This is different then how forms
+ did it. Normally the callback is done when the user releases the
+ mouse, but you can change this with when().
+
See Fl_Browser for methods to add and remove lines from the browser.
+*/
class Fl_Multi_Browser : public Fl_Browser {
public:
+ /**
+ Creates a new Fl_Multi_Browser widget using the given
+ position, size, and label string. The default boxtype is FL_DOWN_BOX.
+ The constructor specializes Fl_Browser() by setting the type to FL_MULTI_BROWSER.
+ The destructor destroys the widget and frees all memory that has been allocated.
+ */
Fl_Multi_Browser(int X,int Y,int W,int H,const char *L=0)
: Fl_Browser(X,Y,W,H,L) {type(FL_MULTI_BROWSER);}
};
@@ -39,5 +58,5 @@ public:
#endif
//
-// End of "$Id: Fl_Multi_Browser.H 4288 2005-04-16 00:13:17Z mike $".
+// End of "$Id: Fl_Multi_Browser.H 6614 2009-01-01 16:11:32Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Multi_Label.H b/plugins/zynaddsubfx/fltk/FL/Fl_Multi_Label.H
index f4f915112..c53a3f8c4 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Multi_Label.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Multi_Label.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Multi_Label.H 4288 2005-04-16 00:13:17Z mike $"
+// "$Id: Fl_Multi_Label.H 6614 2009-01-01 16:11:32Z matt $"
//
// Multi-label header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -43,5 +43,5 @@ struct FL_EXPORT Fl_Multi_Label {
#endif
//
-// End of "$Id: Fl_Multi_Label.H 4288 2005-04-16 00:13:17Z mike $".
+// End of "$Id: Fl_Multi_Label.H 6614 2009-01-01 16:11:32Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Multiline_Input.H b/plugins/zynaddsubfx/fltk/FL/Fl_Multiline_Input.H
index 0d6d1ddd2..feec46498 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Multiline_Input.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Multiline_Input.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Multiline_Input.H 4288 2005-04-16 00:13:17Z mike $"
+// "$Id: Fl_Multiline_Input.H 6614 2009-01-01 16:11:32Z matt $"
//
// Multiline input header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,19 +25,38 @@
// http://www.fltk.org/str.php
//
+/* \file
+ Fl_Multiline_Input widget . */
+
+
#ifndef Fl_Multiline_Input_H
#define Fl_Multiline_Input_H
#include "Fl_Input.H"
+/**
+ This input field displays '\n' characters as new lines rather than ^J,
+ and accepts the Return, Tab, and up and down arrow keys. This is for
+ editing multiline text.
+
This is far from the nirvana of text editors, and is probably only
+ good for small bits of text, 10 lines at most. I think FLTK can be
+ used to write a powerful text editor, but it is not going to be a
+ built-in feature. Powerful text editors in a toolkit are a big source
+ of bloat.
+*/
class Fl_Multiline_Input : public Fl_Input {
public:
- Fl_Multiline_Input(int X,int Y,int W,int H,const char *l = 0)
- : Fl_Input(X,Y,W,H,l) {type(FL_MULTILINE_INPUT);}
+ /**
+ Creates a new Fl_Multiline_Input widget using the given
+ position, size, and label string. The default boxtype is FL_DOWN_BOX.
+
Inherited destructor destroys the widget and any value associated with it.
+ */
+ Fl_Multiline_Input(int X,int Y,int W,int H,const char *l = 0)
+ : Fl_Input(X,Y,W,H,l) {type(FL_MULTILINE_INPUT);}
};
#endif
//
-// End of "$Id: Fl_Multiline_Input.H 4288 2005-04-16 00:13:17Z mike $".
+// End of "$Id: Fl_Multiline_Input.H 6614 2009-01-01 16:11:32Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Multiline_Output.H b/plugins/zynaddsubfx/fltk/FL/Fl_Multiline_Output.H
index 6d243587d..0dbcb06dc 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Multiline_Output.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Multiline_Output.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Multiline_Output.H 4288 2005-04-16 00:13:17Z mike $"
+// "$Id: Fl_Multiline_Output.H 6614 2009-01-01 16:11:32Z matt $"
//
// Multi line output header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,19 +25,32 @@
// http://www.fltk.org/str.php
//
+/* \file
+ Fl_Multiline_Output widget . */
+
#ifndef Fl_Multiline_Output_H
#define Fl_Multiline_Output_H
#include "Fl_Output.H"
+/**
+ This widget is a subclass of Fl_Output that displays multiple
+ lines of text. It also displays tab characters as whitespace to the
+ next column.
+*/
class Fl_Multiline_Output : public Fl_Output {
public:
- Fl_Multiline_Output(int X,int Y,int W,int H,const char *l = 0)
- : Fl_Output(X,Y,W,H,l) {type(FL_MULTILINE_OUTPUT);}
+ /**
+ Creates a new Fl_Multiline_Output widget using the given
+ position, size, and label string. The default boxtype is FL_DOWN_BOX
+
Inherited destructor destroys the widget and any value associated with it.
+ */
+ Fl_Multiline_Output(int X,int Y,int W,int H,const char *l = 0)
+ : Fl_Output(X,Y,W,H,l) {type(FL_MULTILINE_OUTPUT);}
};
#endif
//
-// End of "$Id: Fl_Multiline_Output.H 4288 2005-04-16 00:13:17Z mike $".
+// End of "$Id: Fl_Multiline_Output.H 6614 2009-01-01 16:11:32Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Nice_Slider.H b/plugins/zynaddsubfx/fltk/FL/Fl_Nice_Slider.H
index 6a623f9ed..1d78a4985 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Nice_Slider.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Nice_Slider.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Nice_Slider.H 4288 2005-04-16 00:13:17Z mike $"
+// "$Id: Fl_Nice_Slider.H 6614 2009-01-01 16:11:32Z matt $"
//
// "Nice" slider header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -24,6 +24,10 @@
//
// http://www.fltk.org/str.php
//
+
+/* \file
+ Fl_Nice_Slider widget . */
+
#ifndef Fl_Nice_Slider_H
#define Fl_Nice_Slider_H
@@ -38,5 +42,5 @@ public:
#endif
//
-// End of "$Id: Fl_Nice_Slider.H 4288 2005-04-16 00:13:17Z mike $".
+// End of "$Id: Fl_Nice_Slider.H 6614 2009-01-01 16:11:32Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Object.H b/plugins/zynaddsubfx/fltk/FL/Fl_Object.H
index e2a040452..464f492ec 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Object.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Object.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Object.H 4288 2005-04-16 00:13:17Z mike $"
+// "$Id: Fl_Object.H 6614 2009-01-01 16:11:32Z matt $"
//
// Old Fl_Object header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,12 +25,12 @@
// http://www.fltk.org/str.php
//
-// This file is provided for back compatability only. Please use Fl_Widget
+// This file is provided for back compatibility only. Please use Fl_Widget
#ifndef Fl_Object
#define Fl_Object Fl_Widget
#endif
#include "Fl_Widget.H"
//
-// End of "$Id: Fl_Object.H 4288 2005-04-16 00:13:17Z mike $".
+// End of "$Id: Fl_Object.H 6614 2009-01-01 16:11:32Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Output.H b/plugins/zynaddsubfx/fltk/FL/Fl_Output.H
index 23414b402..0d02d82d5 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Output.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Output.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Output.H 4288 2005-04-16 00:13:17Z mike $"
+// "$Id: Fl_Output.H 6614 2009-01-01 16:11:32Z matt $"
//
// Output header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,19 +25,43 @@
// http://www.fltk.org/str.php
//
+/* \file
+ Fl_Output widget . */
+
#ifndef Fl_Output_H
#define Fl_Output_H
#include "Fl_Input.H"
-
+/**
+ This widget displays a piece of text. When you set the value()
+ , Fl_Output does a strcpy() to it's own storage,
+ which is useful for program-generated values. The user may select
+ portions of the text using the mouse and paste the contents into other
+ fields or programs.
+
\image html text.gif
+ \image latex text.eps "Fl_Output" width=8cm
+ There is a single subclass,
+ Fl_Multiline_Output, which allows you to display multiple lines of
+ text.
+ The text may contain any characters except \\0, and will correctly
+ display anything, using ^X notation for unprintable control characters
+ and \\nnn notation for unprintable characters with the high bit set. It
+ assumes the font can draw any characters in the ISO-Latin1 character
+ set.
+*/
class Fl_Output : public Fl_Input {
public:
- Fl_Output(int X,int Y,int W,int H, const char *l = 0)
+ /**
+ Creates a new Fl_Output widget using the given position,
+ size, and label string. The default boxtype is FL_DOWN_BOX.
+
Inherited destrucor destroys the widget and any value associated with it.
+ */
+ Fl_Output(int X,int Y,int W,int H, const char *l = 0)
: Fl_Input(X, Y, W, H, l) {type(FL_NORMAL_OUTPUT);}
};
#endif
//
-// End of "$Id: Fl_Output.H 4288 2005-04-16 00:13:17Z mike $".
+// End of "$Id: Fl_Output.H 6614 2009-01-01 16:11:32Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Overlay_Window.H b/plugins/zynaddsubfx/fltk/FL/Fl_Overlay_Window.H
index bf873d2fb..923d64258 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Overlay_Window.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Overlay_Window.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Overlay_Window.H 4288 2005-04-16 00:13:17Z mike $"
+// "$Id: Fl_Overlay_Window.H 6614 2009-01-01 16:11:32Z matt $"
//
// Overlay window header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,11 +25,25 @@
// http://www.fltk.org/str.php
//
+/* \file
+ Fl_Overlay_Window class . */
+
#ifndef Fl_Overlay_Window_H
#define Fl_Overlay_Window_H
#include "Fl_Double_Window.H"
+/**
+ This window provides double buffering and also the ability to draw the
+ "overlay" which is another picture placed on top of the main image. The
+ overlay is designed to be a rapidly-changing but simple graphic such as
+ a mouse selection box. Fl_Overlay_Window uses the overlay
+ planes provided by your graphics hardware if they are available.
+
If no hardware support is found the overlay is simulated by drawing
+ directly into the on-screen copy of the double-buffered window, and
+ "erased" by copying the backbuffer over it again. This means the
+ overlay will blink if you change the image in the window.
+*/
class FL_EXPORT Fl_Overlay_Window : public Fl_Double_Window {
friend class _Fl_Overlay;
virtual void draw_overlay() = 0;
@@ -42,9 +56,18 @@ public:
~Fl_Overlay_Window();
int can_do_overlay();
void redraw_overlay();
+ /**
+ Creates a new Fl_Overlay_Window widget using the given
+ position, size, and label (title) string. If the
+ positions (x,y) are not given, then the window manager
+ will choose them.
+ */
Fl_Overlay_Window(int W, int H, const char *l=0)
: Fl_Double_Window(W,H,l) {overlay_ = 0; force_doublebuffering_=1; image(0); }
- Fl_Overlay_Window(int X, int Y, int W, int H, const char *l=0)
+ /**
+ See Fl_Overlay_Window::Fl_Overlay_Window(int W, int H, const char *l=0)
+ */
+ Fl_Overlay_Window(int X, int Y, int W, int H, const char *l=0)
: Fl_Double_Window(X,Y,W,H,l) {overlay_ = 0; force_doublebuffering_=1; image(0); }
void show(int a, char **b) {Fl_Double_Window::show(a,b);}
};
@@ -52,5 +75,5 @@ public:
#endif
//
-// End of "$Id: Fl_Overlay_Window.H 4288 2005-04-16 00:13:17Z mike $".
+// End of "$Id: Fl_Overlay_Window.H 6614 2009-01-01 16:11:32Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Pack.H b/plugins/zynaddsubfx/fltk/FL/Fl_Pack.H
index 8e3c2ba72..dc3847dc2 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Pack.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Pack.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Pack.H 4288 2005-04-16 00:13:17Z mike $"
+// "$Id: Fl_Pack.H 6664 2009-02-18 09:27:54Z AlbrechtS $"
//
// Pack header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,27 +25,60 @@
// http://www.fltk.org/str.php
//
+/* \file
+ Fl_Pack widget . */
+
#ifndef Fl_Pack_H
#define Fl_Pack_H
#include
+/**
+ This widget was designed to add the functionality of compressing and
+ aligning widgets.
+ If type() is Fl_Pack::HORIZONTAL all the children are
+ resized to the height of the Fl_Pack, and are moved next to
+ each other horizontally. If type() is not Fl_Pack::HORIZONTAL
+ then the children are resized to the width and are stacked below each
+ other. Then the Fl_Pack resizes itself to surround the child
+ widgets.
+
This widget is needed for the Fl_Tabs.
+ In addition you may want to put the Fl_Pack inside an
+ Fl_Scroll.
+
+
The resizable for Fl_Pack is set to NULL by default.
+ See also: Fl_Group::resizable()
+*/
class FL_EXPORT Fl_Pack : public Fl_Group {
int spacing_;
+
public:
enum { // values for type(int)
VERTICAL = 0,
HORIZONTAL = 1
};
+
+protected:
void draw();
+
+public:
Fl_Pack(int x,int y,int w ,int h,const char *l = 0);
+ /**
+ Gets the number of extra pixels of blank space that are added
+ between the children.
+ */
int spacing() const {return spacing_;}
+ /**
+ Sets the number of extra pixels of blank space that are added
+ between the children.
+ */
void spacing(int i) {spacing_ = i;}
+ /** Same as Fl_Group::type() */
uchar horizontal() const {return type();}
};
#endif
//
-// End of "$Id: Fl_Pack.H 4288 2005-04-16 00:13:17Z mike $".
+// End of "$Id: Fl_Pack.H 6664 2009-02-18 09:27:54Z AlbrechtS $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Pixmap.H b/plugins/zynaddsubfx/fltk/FL/Fl_Pixmap.H
index 97f1f2695..264fb38a5 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Pixmap.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Pixmap.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Pixmap.H 4288 2005-04-16 00:13:17Z mike $"
+// "$Id: Fl_Pixmap.H 6614 2009-01-01 16:11:32Z matt $"
//
// Pixmap header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,6 +25,9 @@
// http://www.fltk.org/str.php
//
+/* \file
+ Fl_Pixmap widget . */
+
#ifndef Fl_Pixmap_H
#define Fl_Pixmap_H
# include "Fl_Image.H"
@@ -37,6 +40,10 @@ struct Fl_Menu_Item;
# define explicit
# endif // __sgi && !_COMPILER_VERSION
+/**
+ The Fl_Pixmap class supports caching and drawing of colormap
+ (pixmap) images, including transparency.
+*/
class FL_EXPORT Fl_Pixmap : public Fl_Image {
void copy_data();
void delete_data();
@@ -57,9 +64,13 @@ class FL_EXPORT Fl_Pixmap : public Fl_Image {
unsigned mask; // for internal use (mask bitmap)
#endif // __APPLE__ || WIN32
+ /** The constructors create a new pixmap from the specified XPM data. */
explicit Fl_Pixmap(char * const * D) : Fl_Image(-1,0,1), alloc_data(0), id(0), mask(0) {set_data((const char*const*)D); measure();}
+ /** The constructors create a new pixmap from the specified XPM data. */
explicit Fl_Pixmap(uchar* const * D) : Fl_Image(-1,0,1), alloc_data(0), id(0), mask(0) {set_data((const char*const*)D); measure();}
+ /** The constructors create a new pixmap from the specified XPM data. */
explicit Fl_Pixmap(const char * const * D) : Fl_Image(-1,0,1), alloc_data(0), id(0), mask(0) {set_data((const char*const*)D); measure();}
+ /** The constructors create a new pixmap from the specified XPM data. */
explicit Fl_Pixmap(const uchar* const * D) : Fl_Image(-1,0,1), alloc_data(0), id(0), mask(0) {set_data((const char*const*)D); measure();}
virtual ~Fl_Pixmap();
virtual Fl_Image *copy(int W, int H);
@@ -76,5 +87,5 @@ class FL_EXPORT Fl_Pixmap : public Fl_Image {
#endif
//
-// End of "$Id: Fl_Pixmap.H 4288 2005-04-16 00:13:17Z mike $".
+// End of "$Id: Fl_Pixmap.H 6614 2009-01-01 16:11:32Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Positioner.H b/plugins/zynaddsubfx/fltk/FL/Fl_Positioner.H
index dbd147f37..04f181aa6 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Positioner.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Positioner.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Positioner.H 4288 2005-04-16 00:13:17Z mike $"
+// "$Id: Fl_Positioner.H 6614 2009-01-01 16:11:32Z matt $"
//
// Positioner header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,6 +25,9 @@
// http://www.fltk.org/str.php
//
+/* \file
+ Fl_Positioner widget . */
+
#ifndef Fl_Positioner_H
#define Fl_Positioner_H
@@ -32,6 +35,14 @@
#include "Fl_Widget.H"
#endif
+/**
+ This class is provided for Forms compatibility. It provides 2D input.
+ It would be useful if this could be put atop another widget so that the
+ crosshairs are on top, but this is not implemented. The color of the
+ crosshairs is selection_color().
+
\image html positioner.gif
+ \image latex positioner.eps " Fl_Positioner" width=4cm
+*/
class FL_EXPORT Fl_Positioner : public Fl_Widget {
double xmin, ymin;
@@ -49,29 +60,44 @@ protected:
public:
int handle(int);
+ /**
+ Creates a new Fl_Positioner widget using the given position,
+ size, and label string. The default boxtype is FL_NO_BOX.
+ */
Fl_Positioner(int x,int y,int w,int h, const char *l=0);
+ /** Gets the X axis coordinate.*/
double xvalue() const {return xvalue_;}
+ /** Gets the Y axis coordinate.*/
double yvalue() const {return yvalue_;}
int xvalue(double);
int yvalue(double);
int value(double,double);
void xbounds(double, double);
+ /** Gets the X axis minimum */
double xminimum() const {return xmin;}
+ /** Same as xbounds(a, xmaximum()) */
void xminimum(double a) {xbounds(a,xmax);}
+ /** Gets the X axis maximum */
double xmaximum() const {return xmax;}
+ /** Same as xbounds(xminimum(), a) */
void xmaximum(double a) {xbounds(xmin,a);}
void ybounds(double, double);
+ /** Gets the Y axis minimum */
double yminimum() const {return ymin;}
- void yminimum(double a) {ybounds(a,ymax);}
+ /** Same as ybounds(a, ymaximum()) */
+ void yminimum(double a) {ybounds(a, ymax);}
+ /** Gets the Y axis maximum */
double ymaximum() const {return ymax;}
- void ymaximum(double a) {ybounds(ymin,a);}
+ /** Same as ybounds(ymininimum(), a) */
+ void ymaximum(double a) {ybounds(ymin, a);}
+ /** Sets the stepping value for the X axis.*/
void xstep(double a) {xstep_ = a;}
+ /** Sets the stepping value for the Y axis.*/
void ystep(double a) {ystep_ = a;}
-
};
#endif
//
-// End of "$Id: Fl_Positioner.H 4288 2005-04-16 00:13:17Z mike $".
+// End of "$Id: Fl_Positioner.H 6614 2009-01-01 16:11:32Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Preferences.H b/plugins/zynaddsubfx/fltk/FL/Fl_Preferences.H
index 392ac0568..a05653d14 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Preferences.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Preferences.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Preferences.H 5330 2006-08-18 07:29:09Z matt $"
+// "$Id: Fl_Preferences.H 6770 2009-04-18 18:52:59Z matt $"
//
-// Preferences definitions for the Fast Light Tool Kit (FLTK).
+// Preferences .
//
-// Copyright 2002-2005 by Matthias Melcher.
+// Copyright 2002-2009 by Matthias Melcher.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,42 +25,75 @@
// http://www.fltk.org/str.php
//
+/* \file
+ Fl_Preferences class . */
+
#ifndef Fl_Preferences_H
# define Fl_Preferences_H
-# ifdef WIN32
-# include
-# endif // WIN32
-
# include
# include "Fl_Export.H"
/**
- * Preferences are a data tree containing a root, branches and leafs
+ \brief Fl_Preferences provides methods to store user
+ settings between application starts.
+
+ It is similar to the
+ Registry on WIN32 and Preferences on MacOS, and provides a
+ simple configuration mechanism for UNIX.
+
+ Fl_Preferences uses a hierarchy to store data. It
+ bundles similar data into groups and manages entries into those
+ groups as name/value pairs.
+
+ Preferences are stored in text files that can be edited
+ manually. The file format is easy to read and relatively
+ forgiving. Preferences files are the same on all platforms. User
+ comments in preference files are preserved. Filenames are unique
+ for each application by using a vendor/application naming
+ scheme. The user must provide default values for all entries to
+ ensure proper operation should preferences be corrupted or not
+ yet exist.
+
+ Entries can be of any length. However, the size of each
+ preferences file should be kept under 100k for performance
+ reasons. One application can have multiple preferences files.
+ Extensive binary data however should be stored in separate
+ files: see getUserdataPath().
+
+ \note Starting with FLTK 1.3, preference databases are expected to
+ be in utf8 encoding. Previous databases were stored in the
+ current chracter set or code page which renders them incompatible
+ for text entries using international characters.
*/
class FL_EXPORT Fl_Preferences
{
public:
- enum Root { SYSTEM=0, USER };
- // enum Type { win32, macos, fltk };
+ /**
+ Define the scope of the preferences.
+ */
+ enum Root {
+ SYSTEM=0, ///< Preferences are used system-wide
+ USER ///< Preferences apply only to the current user
+ };
Fl_Preferences( Root root, const char *vendor, const char *application );
Fl_Preferences( const char *path, const char *vendor, const char *application );
- Fl_Preferences( Fl_Preferences&, const char *group );
+ Fl_Preferences( Fl_Preferences &parent, const char *group );
Fl_Preferences( Fl_Preferences*, const char *group );
~Fl_Preferences();
int groups();
- const char *group( int );
- char groupExists( const char *group );
+ const char *group( int num_group );
+ char groupExists( const char *key );
char deleteGroup( const char *group );
int entries();
- const char *entry( int );
- char entryExists( const char *entry );
+ const char *entry( int index );
+ char entryExists( const char *key );
char deleteEntry( const char *entry );
char set( const char *entry, int value );
@@ -70,14 +103,15 @@ public:
char set( const char *entry, double value, int precision );
char set( const char *entry, const char *value );
char set( const char *entry, const void *value, int size );
-
- char get( const char *entry, int &value, int defaultValue );
+
+ char get( const char *entry, int &value, int defaultValue );
char get( const char *entry, float &value, float defaultValue );
char get( const char *entry, double &value, double defaultValue );
char get( const char *entry, char *&value, const char *defaultValue );
char get( const char *entry, char *value, const char *defaultValue, int maxSize );
char get( const char *entry, void *&value, const void *defaultValue, int defaultSize );
char get( const char *entry, void *value, const void *defaultValue, int defaultSize, int maxSize );
+
int size( const char *entry );
char getUserdataPath( char *path, int pathlen );
@@ -87,15 +121,35 @@ public:
// char export( const char *filename, Type fileFormat );
// char import( const char *filename );
+ /**
+ 'Name' provides a simple method to create numerical or more complex
+ procedural names for entries and groups on the fly.
+
+ Example: prefs.set(Fl_Preferences::Name("File%d",i),file[i]);.
+
+ See test/preferences.cxx as a sample for writing arrays into preferences.
+ 'Name' is actually implemented as a class inside Fl_Preferences. It casts
+ into const char* and gets automatically destroyed after the enclosing call
+ ends.
+ */
class FL_EXPORT Name {
+
char *data_;
+
public:
+
Name( unsigned int n );
Name( const char *format, ... );
+
+ /**
+ Return the Name as a "C" string.
+ \internal
+ */
operator const char *() { return data_; }
~Name();
};
+ /** \internal An entry associates a preference name to its corresponding value */
struct Entry
{
char *name, *value;
@@ -167,5 +221,5 @@ private:
#endif // !Fl_Preferences_H
//
-// End of "$Id: Fl_Preferences.H 5330 2006-08-18 07:29:09Z matt $".
+// End of "$Id: Fl_Preferences.H 6770 2009-04-18 18:52:59Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Progress.H b/plugins/zynaddsubfx/fltk/FL/Fl_Progress.H
index 836d53ad7..5d2e8c434 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Progress.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Progress.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Progress.H 4288 2005-04-16 00:13:17Z mike $"
+// "$Id: Fl_Progress.H 6614 2009-01-01 16:11:32Z matt $"
//
// Progress bar widget definitions.
//
-// Copyright 2000-2005 by Michael Sweet.
+// Copyright 2000-2009 by Michael Sweet.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,6 +25,9 @@
// http://www.fltk.org/str.php
//
+/* \file
+ Fl_Progress widget . */
+
#ifndef _Fl_Progress_H_
# define _Fl_Progress_H_
@@ -38,7 +41,9 @@
//
// Progress class...
//
-
+/**
+ Displays a progress bar for the user.
+*/
class FL_EXPORT Fl_Progress : public Fl_Widget
{
float value_,
@@ -53,18 +58,24 @@ class FL_EXPORT Fl_Progress : public Fl_Widget
Fl_Progress(int x, int y, int w, int h, const char *l = 0);
+ /** Sets the maximum value in the progress widget. */
void maximum(float v) { maximum_ = v; redraw(); }
+ /** Gets the maximum value in the progress widget. */
float maximum() const { return (maximum_); }
+ /** Sets the minimum value in the progress widget. */
void minimum(float v) { minimum_ = v; redraw(); }
+ /** Gets the minimum value in the progress widget. */
float minimum() const { return (minimum_); }
+ /** Sets the current value in the progress widget. */
void value(float v) { value_ = v; redraw(); }
+ /** Gets the current value in the progress widget. */
float value() const { return (value_); }
};
#endif // !_Fl_Progress_H_
//
-// End of "$Id: Fl_Progress.H 4288 2005-04-16 00:13:17Z mike $".
+// End of "$Id: Fl_Progress.H 6614 2009-01-01 16:11:32Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Radio_Button.H b/plugins/zynaddsubfx/fltk/FL/Fl_Radio_Button.H
index 888a9ac7b..892730705 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Radio_Button.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Radio_Button.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Radio_Button.H 4288 2005-04-16 00:13:17Z mike $"
+// "$Id: Fl_Radio_Button.H 6614 2009-01-01 16:11:32Z matt $"
//
// Radio button header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,6 +25,9 @@
// http://www.fltk.org/str.php
//
+/* \file
+ Fl_Radio_Button widget . */
+
#ifndef Fl_Radio_Button_H
#define Fl_Radio_Button_H
@@ -39,5 +42,5 @@ public:
#endif
//
-// End of "$Id: Fl_Radio_Button.H 4288 2005-04-16 00:13:17Z mike $".
+// End of "$Id: Fl_Radio_Button.H 6614 2009-01-01 16:11:32Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Radio_Light_Button.H b/plugins/zynaddsubfx/fltk/FL/Fl_Radio_Light_Button.H
index 0d6a3ae7e..136915d5d 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Radio_Light_Button.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Radio_Light_Button.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Radio_Light_Button.H 4288 2005-04-16 00:13:17Z mike $"
+// "$Id: Fl_Radio_Light_Button.H 6614 2009-01-01 16:11:32Z matt $"
//
// Radio light button header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -24,6 +24,10 @@
//
// http://www.fltk.org/str.php
//
+
+/* \file
+ Fl_Radio_Light_Button widget . */
+
#ifndef Fl_Radio_Light_Button_H
#define Fl_Radio_Light_Button_H
@@ -38,5 +42,5 @@ public:
#endif
//
-// End of "$Id: Fl_Radio_Light_Button.H 4288 2005-04-16 00:13:17Z mike $".
+// End of "$Id: Fl_Radio_Light_Button.H 6614 2009-01-01 16:11:32Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Radio_Round_Button.H b/plugins/zynaddsubfx/fltk/FL/Fl_Radio_Round_Button.H
index 7e525c518..588d02360 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Radio_Round_Button.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Radio_Round_Button.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Radio_Round_Button.H 4288 2005-04-16 00:13:17Z mike $"
+// "$Id: Fl_Radio_Round_Button.H 6614 2009-01-01 16:11:32Z matt $"
//
// Radio round button header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,6 +25,9 @@
// http://www.fltk.org/str.php
//
+/* \file
+ Fl_Radio_Round_Button widget . */
+
#ifndef Fl_Radio_Round_Button_H
#define Fl_Radio_Round_Button_H
@@ -39,5 +42,5 @@ public:
#endif
//
-// End of "$Id: Fl_Radio_Round_Button.H 4288 2005-04-16 00:13:17Z mike $".
+// End of "$Id: Fl_Radio_Round_Button.H 6614 2009-01-01 16:11:32Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Repeat_Button.H b/plugins/zynaddsubfx/fltk/FL/Fl_Repeat_Button.H
index 5e0b65075..0ed4a8f6b 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Repeat_Button.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Repeat_Button.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Repeat_Button.H 4288 2005-04-16 00:13:17Z mike $"
+// "$Id: Fl_Repeat_Button.H 6614 2009-01-01 16:11:32Z matt $"
//
// Repeat button header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,15 +25,29 @@
// http://www.fltk.org/str.php
//
+/* \file
+ Fl_Repeat_Button widget . */
+
#ifndef Fl_Repeat_Button_H
#define Fl_Repeat_Button_H
#include "Fl.H"
#include "Fl_Button.H"
+/**
+ The Fl_Repeat_Button is a subclass of Fl_Button that
+ generates a callback when it is pressed and then repeatedly generates
+ callbacks as long as it is held down. The speed of the repeat is fixed
+ and depends on the implementation.
+*/
class FL_EXPORT Fl_Repeat_Button : public Fl_Button {
static void repeat_callback(void *);
public:
int handle(int);
+ /**
+ Creates a new Fl_Repeat_Button widget using the given
+ position, size, and label string. The default boxtype is FL_UP_BOX.
+ Deletes the button.
+ */
Fl_Repeat_Button(int X,int Y,int W,int H,const char *l=0)
: Fl_Button(X,Y,W,H,l) {}
void deactivate() {
@@ -45,5 +59,5 @@ public:
#endif
//
-// End of "$Id: Fl_Repeat_Button.H 4288 2005-04-16 00:13:17Z mike $".
+// End of "$Id: Fl_Repeat_Button.H 6614 2009-01-01 16:11:32Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Return_Button.H b/plugins/zynaddsubfx/fltk/FL/Fl_Return_Button.H
index f9cb52a07..afa13a64e 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Return_Button.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Return_Button.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Return_Button.H 4288 2005-04-16 00:13:17Z mike $"
+// "$Id: Fl_Return_Button.H 6614 2009-01-01 16:11:32Z matt $"
//
// Return button header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,15 +25,30 @@
// http://www.fltk.org/str.php
//
+/* \file
+ Fl_Return_Button widget . */
+
#ifndef Fl_Return_Button_H
#define Fl_Return_Button_H
#include "Fl_Button.H"
+/**
+ The Fl_Return_Button is a subclass of Fl_Button that
+ generates a callback when it is pressed or when the user presses the
+ Enter key. A carriage-return symbol is drawn next to the button label.
+
\image html Fl_Return_Button.gif
+ \image latex Fl_Return_Button.eps "Fl_Return_Button" width=4cm
+*/
class FL_EXPORT Fl_Return_Button : public Fl_Button {
protected:
void draw();
public:
int handle(int);
+ /**
+ Creates a new Fl_Return_Button widget using the given
+ position, size, and label string. The default boxtype is FL_UP_BOX.
+
The inherited destructor deletes the button.
+ */
Fl_Return_Button(int X, int Y, int W, int H,const char *l=0)
: Fl_Button(X,Y,W,H,l) {}
};
@@ -41,5 +56,5 @@ public:
#endif
//
-// End of "$Id: Fl_Return_Button.H 4288 2005-04-16 00:13:17Z mike $".
+// End of "$Id: Fl_Return_Button.H 6614 2009-01-01 16:11:32Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Roller.H b/plugins/zynaddsubfx/fltk/FL/Fl_Roller.H
index 064b15068..60659812f 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Roller.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Roller.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Roller.H 4288 2005-04-16 00:13:17Z mike $"
+// "$Id: Fl_Roller.H 6614 2009-01-01 16:11:32Z matt $"
//
// Roller header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,6 +25,9 @@
// http://www.fltk.org/str.php
//
+/* \file
+ Fl_Roller widget . */
+
#ifndef Fl_Roller_H
#define Fl_Roller_H
@@ -32,6 +35,12 @@
#include "Fl_Valuator.H"
#endif
+/**
+ The Fl_Roller widget is a "dolly" control commonly used to
+ move 3D objects.
+
\image html Fl_Roller.gif
+ \image latex Fl_Roller.eps "Fl_Roller" width=4cm
+*/
class FL_EXPORT Fl_Roller : public Fl_Valuator {
protected:
void draw();
@@ -43,5 +52,5 @@ public:
#endif
//
-// End of "$Id: Fl_Roller.H 4288 2005-04-16 00:13:17Z mike $".
+// End of "$Id: Fl_Roller.H 6614 2009-01-01 16:11:32Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Round_Button.H b/plugins/zynaddsubfx/fltk/FL/Fl_Round_Button.H
index c47e92cd1..de4179119 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Round_Button.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Round_Button.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Round_Button.H 4288 2005-04-16 00:13:17Z mike $"
+// "$Id: Fl_Round_Button.H 6614 2009-01-01 16:11:32Z matt $"
//
// Round button header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,11 +25,26 @@
// http://www.fltk.org/str.php
//
+/* \file
+ Fl_Round_Button widget . */
+
#ifndef Fl_Round_Button_H
#define Fl_Round_Button_H
#include "Fl_Light_Button.H"
+/**
+ Buttons generate callbacks when they are clicked by the user. You
+ control exactly when and how by changing the values for type()
+ and when().
+
\image html Fl_Round_Button.gif
+ \image latex Fl_Round_Button.eps " Fl_Round_Button" width=4cm
+ The Fl_Round_Button subclass display the "on" state by
+ turning on a light, rather than drawing pushed in. The shape of the
+ "light" is initially set to FL_ROUND_DOWN_BOX. The color of the light
+ when on is controlled with selection_color(), which defaults to
+ FL_RED.
+*/
class FL_EXPORT Fl_Round_Button : public Fl_Light_Button {
public:
Fl_Round_Button(int x,int y,int w,int h,const char *l = 0);
@@ -38,5 +53,5 @@ public:
#endif
//
-// End of "$Id: Fl_Round_Button.H 4288 2005-04-16 00:13:17Z mike $".
+// End of "$Id: Fl_Round_Button.H 6614 2009-01-01 16:11:32Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Round_Clock.H b/plugins/zynaddsubfx/fltk/FL/Fl_Round_Clock.H
index d3b9fb091..919bfbda5 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Round_Clock.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Round_Clock.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Round_Clock.H 4288 2005-04-16 00:13:17Z mike $"
+// "$Id: Fl_Round_Clock.H 6614 2009-01-01 16:11:32Z matt $"
//
// Round clock header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,13 +25,18 @@
// http://www.fltk.org/str.php
//
+/* \file
+ Fl_Round_Clock widget . */
+
#ifndef Fl_Round_Clock_H
#define Fl_Round_Clock_H
#include "Fl_Clock.H"
+/** A clock widget of type FL_ROUND_CLOCK. Has no box. */
class Fl_Round_Clock : public Fl_Clock {
public:
+ /** Creates the clock widget, setting his type and box. */
Fl_Round_Clock(int x,int y,int w,int h, const char *l = 0)
: Fl_Clock(x,y,w,h,l) {type(FL_ROUND_CLOCK); box(FL_NO_BOX);}
};
@@ -39,5 +44,5 @@ public:
#endif
//
-// End of "$Id: Fl_Round_Clock.H 4288 2005-04-16 00:13:17Z mike $".
+// End of "$Id: Fl_Round_Clock.H 6614 2009-01-01 16:11:32Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Scroll.H b/plugins/zynaddsubfx/fltk/FL/Fl_Scroll.H
index 67c650fac..0545c84fb 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Scroll.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Scroll.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Scroll.H 5618 2007-01-18 19:23:24Z matt $"
+// "$Id: Fl_Scroll.H 6614 2009-01-01 16:11:32Z matt $"
//
// Scroll header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,12 +25,71 @@
// http://www.fltk.org/str.php
//
+/* \file
+ Fl_Scroll widget . */
+
#ifndef Fl_Scroll_H
#define Fl_Scroll_H
#include "Fl_Group.H"
#include "Fl_Scrollbar.H"
+/**
+ This container widget lets you maneuver around a set of widgets much
+ larger than your window. If the child widgets are larger than the size
+ of this object then scrollbars will appear so that you can scroll over
+ to them:
+
\image html Fl_Scroll.gif
+ \image latex Fl_Scroll.eps "Fl_Scroll" width=4cm
+ If all of the child widgets are packed together into a solid
+ rectangle then you want to set box() to FL_NO_BOX or
+ one of the _FRAME types. This will result in the best output.
+ However, if the child widgets are a sparse arrangment you must set
+ box() to a real _BOX type. This can result in some
+ blinking during redrawing, but that can be solved by using a
+ Fl_Double_Window.
+
+ By default you can scroll in both directions, and the scrollbars
+ disappear if the data will fit in the area of the scroll.
+ Use Fl_Scroll::type() to change this as follows :
+
+ - 0 - No scrollbars
+ - Fl_Scroll::HORIZONTAL - Only a horizontal scrollbar.
+ - Fl_Scroll::VERTICAL - Only a vertical scrollbar.
+ - Fl_Scroll::BOTH - The default is both scrollbars.
+ - Fl_Scroll::HORIZONTAL_ALWAYS - Horizontal scrollbar always on, vertical always off.
+ - Fl_Scroll::VERTICAL_ALWAYS - Vertical scrollbar always on, horizontal always off.
+ - Fl_Scroll::BOTH_ALWAYS - Both always on.
+
+
+ Use scrollbar.align(int) ( see void Fl_Widget::align(Fl_Align) ) :
+ to change what side the scrollbars are drawn on.
If the
+ FL_ALIGN_LEFT bit is on, the vertical scrollbar is on the left.
+ If the FL_ALIGN_TOP bit is on, the horizontal scrollbar is on
+ the top. Note that only the alignment flags in scrollbar are
+ considered. The flags in hscrollbar however are ignored.
+
+
This widget can also be used to pan around a single child widget
+ "canvas". This child widget should be of your own class, with a
+ draw() method that draws the contents. The scrolling is done by
+ changing the x() and y() of the widget, so this child
+ must use the x() and y() to position it's drawing.
+ To speed up drawing it should test fl_push_clip().
+
+
Another very useful child is a single
+ Fl_Pack, which is itself a group that packs it's children
+ together and changes size to surround them. Filling the Fl_Pack
+ with Fl_Tabs groups (and then putting
+ normal widgets inside those) gives you a very powerful scrolling list
+ of individually-openable panels.
+
+ Fluid lets you create these, but you can only lay out objects that
+ fit inside the Fl_Scroll without scrolling. Be sure to leave
+ space for the scrollbars, as Fluid won't show these either.
+ You cannot use Fl_Window as a child of this since the
+ clipping is not conveyed to it when drawn, and it will draw over the
+ scrollbars and neighboring objects.
+*/
class FL_EXPORT Fl_Scroll : public Fl_Group {
int xposition_, yposition_;
@@ -66,14 +125,16 @@ public:
BOTH_ALWAYS = 7
};
+ /** Gets the current horizontal scrolling position. */
int xposition() const {return xposition_;}
+ /** Gets the current vertical scrolling position. */
int yposition() const {return yposition_;}
- void position(int, int);
+ void scroll_to(int, int);
void clear();
};
#endif
//
-// End of "$Id: Fl_Scroll.H 5618 2007-01-18 19:23:24Z matt $".
+// End of "$Id: Fl_Scroll.H 6614 2009-01-01 16:11:32Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Scrollbar.H b/plugins/zynaddsubfx/fltk/FL/Fl_Scrollbar.H
index bea51e2d2..0b7ab1d5c 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Scrollbar.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Scrollbar.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Scrollbar.H 6042 2008-02-25 13:00:53Z matt $"
+// "$Id: Fl_Scrollbar.H 6683 2009-03-14 11:46:43Z engelsman $"
//
// Scroll bar header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,11 +25,30 @@
// http://www.fltk.org/str.php
//
+/* \file
+ Fl_Scrollbar widget . */
+
#ifndef Fl_Scrollbar_H
#define Fl_Scrollbar_H
#include "Fl_Slider.H"
+/**
+ The Fl_Scrollbar widget displays a slider with arrow buttons at
+ the ends of the scrollbar. Clicking on the arrows move up/left and
+ down/right by linesize(). Scrollbars also accept FL_SHORTCUT events:
+ the arrows move by linesize(), and vertical scrollbars take Page
+ Up/Down (they move by the page size minus linesize()) and Home/End
+ (they jump to the top or bottom).
+
+ Scrollbars have step(1) preset (they always return integers). If
+ desired you can set the step() to non-integer values. You will then
+ have to use casts to get at the floating-point versions of value()
+ from Fl_Slider.
+
+ \image html scrollbar.gif
+ \image latex scrollbar.eps "Fl_Scrollbar" width=4cm
+*/
class FL_EXPORT Fl_Scrollbar : public Fl_Slider {
int linesize_;
@@ -41,15 +60,55 @@ protected:
public:
- Fl_Scrollbar(int x,int y,int w,int h, const char *l = 0);
+ Fl_Scrollbar(int X,int Y,int W,int H, const char *L = 0);
~Fl_Scrollbar();
int handle(int);
- int value() {return int(Fl_Slider::value());}
- int value(int p, int s, int top, int total) {
- return scrollvalue(p, s, top, total);
+ /**
+ Gets the integer value (position) of the slider in the scrollbar.
+ You can get the floating point value with Fl_Slider::value().
+
+ \see Fl_Scrollbar::value(int p)
+ \see Fl_Scrollbar::value(int pos, int size, int first, int total)
+ */
+ int value() const {return int(Fl_Slider::value());}
+
+ /**
+ Sets the value (position) of the slider in the scrollbar.
+
+ \see Fl_Scrollbar::value()
+ \see Fl_Scrollbar::value(int pos, int size, int first, int total)
+ */
+ int value(int p) {return int(Fl_Slider::value((double)p));}
+
+ /**
+ Sets the position, size and range of the slider in the scrollbar.
+ \param[in] pos position, first line displayed
+ \param[in] size window size, number of lines displayed
+ \param[in] first number of first line
+ \param[in] total total number of lines
+
+ You should call this every time your window changes size, your data
+ changes size, or your scroll position changes (even if in response
+ to a callback from this scrollbar).
+ All necessary calls to redraw() are done.
+
+ Calls Fl_Slider::scrollvalue(int pos, int size, int first, int total).
+ */
+ int value(int pos, int size, int first, int total) {
+ return scrollvalue(pos, size, first, total);
}
+
+ /**
+ Get the size of step, in lines, that the arror keys move.
+ */
int linesize() const {return linesize_;}
+
+ /**
+ This number controls how big the steps are that the arrow keys do.
+ In addition page up/down move by the size last sent to value()
+ minus one linesize(). The default is 16.
+ */
void linesize(int i) {linesize_ = i;}
};
@@ -57,5 +116,5 @@ public:
#endif
//
-// End of "$Id: Fl_Scrollbar.H 6042 2008-02-25 13:00:53Z matt $".
+// End of "$Id: Fl_Scrollbar.H 6683 2009-03-14 11:46:43Z engelsman $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Secret_Input.H b/plugins/zynaddsubfx/fltk/FL/Fl_Secret_Input.H
index a87bef59d..90a65cf87 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Secret_Input.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Secret_Input.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Secret_Input.H 4288 2005-04-16 00:13:17Z mike $"
+// "$Id: Fl_Secret_Input.H 6614 2009-01-01 16:11:32Z matt $"
//
// Secret input header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,19 +25,32 @@
// http://www.fltk.org/str.php
//
+/* \file
+ Fl_Secret_Input widget . */
+
#ifndef Fl_Secret_Input_H
#define Fl_Secret_Input_H
#include "Fl_Input.H"
+/**
+ The Fl_Secret_Input class is a subclass of Fl_Input
+ that displays its input as a string of asterisks. This subclass is
+ usually used to receive passwords and other "secret" information.
+*/
class Fl_Secret_Input : public Fl_Input {
public:
- Fl_Secret_Input(int X,int Y,int W,int H,const char *l = 0)
- : Fl_Input(X,Y,W,H,l) {type(FL_SECRET_INPUT);}
+ /**
+ Creates a new Fl_Secret_Input widget using the given
+ position, size, and label string. The default boxtype is FL_DOWN_BOX.
+
Inherited destructor destroys the widget and any value associated with it.
+ */
+ Fl_Secret_Input(int X,int Y,int W,int H,const char *l = 0)
+ : Fl_Input(X,Y,W,H,l) {type(FL_SECRET_INPUT);}
};
#endif
//
-// End of "$Id: Fl_Secret_Input.H 4288 2005-04-16 00:13:17Z mike $".
+// End of "$Id: Fl_Secret_Input.H 6614 2009-01-01 16:11:32Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Select_Browser.H b/plugins/zynaddsubfx/fltk/FL/Fl_Select_Browser.H
index 4a8ef9210..2ae7406c5 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Select_Browser.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Select_Browser.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Select_Browser.H 4288 2005-04-16 00:13:17Z mike $"
+// "$Id: Fl_Select_Browser.H 6614 2009-01-01 16:11:32Z matt $"
//
// Select browser header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,19 +25,36 @@
// http://www.fltk.org/str.php
//
+/* \file
+ Fl_Select_Browser widget . */
+
#ifndef Fl_Select_Browser_H
#define Fl_Select_Browser_H
#include "Fl_Browser.H"
+/**
+ The class is a subclass of Fl_Browser
+ which lets the user select a single item, or no items by clicking on
+ the empty space. As long as the mouse button is held down on an
+ unselected item it is highlighted. Normally the callback is done when the
+ user presses the mouse, but you can change this with when().
+
See Fl_Browser for methods to add and remove lines from the browser.
+*/
class Fl_Select_Browser : public Fl_Browser {
public:
- Fl_Select_Browser(int X,int Y,int W,int H,const char *l=0)
+ /**
+ Creates a new Fl_Select_Browser widget using the given
+ position, size, and label string. The default boxtype is FL_DOWN_BOX.
+ The constructor specializes Fl_Browser() by setting the type to FL_SELECT_BROWSER.
+ The destructor destroys the widget and frees all memory that has been allocated.
+ */
+ Fl_Select_Browser(int X,int Y,int W,int H,const char *l=0)
: Fl_Browser(X,Y,W,H,l) {type(FL_SELECT_BROWSER);}
};
#endif
//
-// End of "$Id: Fl_Select_Browser.H 4288 2005-04-16 00:13:17Z mike $".
+// End of "$Id: Fl_Select_Browser.H 6614 2009-01-01 16:11:32Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Shared_Image.H b/plugins/zynaddsubfx/fltk/FL/Fl_Shared_Image.H
index 042b7827d..8566b6267 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Shared_Image.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Shared_Image.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Shared_Image.H 4288 2005-04-16 00:13:17Z mike $"
+// "$Id: Fl_Shared_Image.H 6614 2009-01-01 16:11:32Z matt $"
//
// Shared image header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,6 +25,9 @@
// http://www.fltk.org/str.php
//
+/* \file
+ Fl_Shared_Image class . */
+
#ifndef Fl_Shared_Image_H
# define Fl_Shared_Image_H
@@ -36,6 +39,13 @@ typedef Fl_Image *(*Fl_Shared_Handler)(const char *name, uchar *header,
int headerlen);
// Shared images class.
+/**
+ This class supports caching, loading,
+ and drawing of image files. Most applications will also want to
+ link against the fltk_images library and call the
+ fl_register_images()
+ function to support standard image formats such as BMP, GIF, JPEG, and PNG.
+*/
class FL_EXPORT Fl_Shared_Image : public Fl_Image {
protected:
@@ -62,8 +72,9 @@ class FL_EXPORT Fl_Shared_Image : public Fl_Image {
void update();
public:
-
+ /** Returns the filename of the shared image */
const char *name() { return name_; }
+ /** Returns the number of references of this shared image. When reference is below 1, the image is deleted. */
int refcount() { return refcount_; }
void release();
void reload();
@@ -95,5 +106,5 @@ FL_EXPORT extern void fl_register_images();
#endif // !Fl_Shared_Image_H
//
-// End of "$Id: Fl_Shared_Image.H 4288 2005-04-16 00:13:17Z mike $"
+// End of "$Id: Fl_Shared_Image.H 6614 2009-01-01 16:11:32Z matt $"
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Simple_Counter.H b/plugins/zynaddsubfx/fltk/FL/Fl_Simple_Counter.H
index 84e07c9b5..3b1a92784 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Simple_Counter.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Simple_Counter.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Simple_Counter.H 4288 2005-04-16 00:13:17Z mike $"
+// "$Id: Fl_Simple_Counter.H 6614 2009-01-01 16:11:32Z matt $"
//
// Simple counter header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,11 +25,18 @@
// http://www.fltk.org/str.php
//
+/* \file
+ Fl_Simple_Counter widget . */
+
#ifndef Fl_Simple_Counter_H
#define Fl_Simple_Counter_H
#include "Fl_Counter.H"
-
+/**
+ This widget creates a counter with only 2 arrow buttons
+
\image html counter.gif
+ \image latex counter.eps "Fl_Simple_Counter" width=4cm
+*/
class Fl_Simple_Counter : public Fl_Counter {
public:
Fl_Simple_Counter(int x,int y,int w,int h, const char *l = 0)
@@ -39,5 +46,5 @@ public:
#endif
//
-// End of "$Id: Fl_Simple_Counter.H 4288 2005-04-16 00:13:17Z mike $".
+// End of "$Id: Fl_Simple_Counter.H 6614 2009-01-01 16:11:32Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Single_Window.H b/plugins/zynaddsubfx/fltk/FL/Fl_Single_Window.H
index c68e66e32..a536c4951 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Single_Window.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Single_Window.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Single_Window.H 4288 2005-04-16 00:13:17Z mike $"
+// "$Id: Fl_Single_Window.H 6614 2009-01-01 16:11:32Z matt $"
//
// Single-buffered window header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,18 +25,36 @@
// http://www.fltk.org/str.php
//
+/* \file
+ Fl_Single_Window class . */
+
#ifndef Fl_Single_Window_H
#define Fl_Single_Window_H
#include "Fl_Window.H"
+/**
+ This is the same as Fl_Window. However, it is possible that
+ some implementations will provide double-buffered windows by default.
+ This subcan be used to force single-buffering. This may be
+ useful for modifying existing programs that use incremental update, or
+ for some types of image data, such as a movie flipbook.
+*/
class FL_EXPORT Fl_Single_Window : public Fl_Window {
public:
void show();
void show(int a, char **b) {Fl_Window::show(a,b);}
void flush();
+ /**
+ Creates a new Fl_Single_Window widget using the given
+ size, and label (title) string.
+ */
Fl_Single_Window(int W, int H, const char *l=0)
: Fl_Window(W,H,l) {}
+ /**
+ Creates a new Fl_Single_Window widget using the given
+ position, size, and label (title) string.
+ */
Fl_Single_Window(int X, int Y, int W, int H, const char *l=0)
: Fl_Window(X,Y,W,H,l) {}
int make_current();
@@ -45,5 +63,5 @@ public:
#endif
//
-// End of "$Id: Fl_Single_Window.H 4288 2005-04-16 00:13:17Z mike $".
+// End of "$Id: Fl_Single_Window.H 6614 2009-01-01 16:11:32Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Slider.H b/plugins/zynaddsubfx/fltk/FL/Fl_Slider.H
index 8a6b93d60..20c60c4e6 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Slider.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Slider.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Slider.H 4288 2005-04-16 00:13:17Z mike $"
+// "$Id: Fl_Slider.H 6683 2009-03-14 11:46:43Z engelsman $"
//
// Slider header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,6 +25,9 @@
// http://www.fltk.org/str.php
//
+/* \file
+ Fl_Slider widget . */
+
#ifndef Fl_Slider_H
#define Fl_Slider_H
@@ -40,6 +43,30 @@
#define FL_VERT_NICE_SLIDER 4
#define FL_HOR_NICE_SLIDER 5
+/**
+ The Fl_Slider widget contains a sliding knob inside a box. It if
+ often used as a scrollbar. Moving the box all the way to the
+ top/left sets it to the minimum(), and to the bottom/right to the
+ maximum(). The minimum() may be greater than the maximum() to
+ reverse the slider direction.
+
+ Use void Fl_Widget::type(int) to set how the slider is drawn,
+ which can be one of the following:
+
+ \li FL_VERTICAL - Draws a vertical slider (this is the default).
+ \li FL_HORIZONTAL - Draws a horizontal slider.
+ \li FL_VERT_FILL_SLIDER - Draws a filled vertical slider,
+ useful as a progress or value meter.
+ \li FL_HOR_FILL_SLIDER - Draws a filled horizontal slider,
+ useful as a progress or value meter.
+ \li FL_VERT_NICE_SLIDER - Draws a vertical slider with a nice
+ looking control knob.
+ \li FL_HOR_NICE_SLIDER - Draws a horizontal slider with a
+ nice looking control knob.
+
+ \image html slider.gif
+ \image latex slider.eps "Fl_Slider" width=4cm
+*/
class FL_EXPORT Fl_Slider : public Fl_Valuator {
float slider_size_;
@@ -52,24 +79,42 @@ protected:
// these allow subclasses to put the slider in a smaller area:
void draw(int, int, int, int);
int handle(int, int, int, int, int);
+ void draw();
public:
- void draw();
int handle(int);
- Fl_Slider(int x,int y,int w,int h, const char *l = 0);
- Fl_Slider(uchar t,int x,int y,int w,int h, const char *l);
+ Fl_Slider(int X,int Y,int W,int H, const char *L = 0);
+ Fl_Slider(uchar t,int X,int Y,int W,int H, const char *L);
- int scrollvalue(int windowtop,int windowsize,int first,int totalsize);
+ int scrollvalue(int pos,int size,int first,int total);
void bounds(double a, double b);
+
+ /**
+ Get the dimensions of the moving piece of slider.
+ */
float slider_size() const {return slider_size_;}
+
+ /**
+ Set the dimensions of the moving piece of slider. This is
+ the fraction of the size of the entire widget. If you set this
+ to 1 then the slider cannot move. The default value is .08.
+
+ For the "fill" sliders this is the size of the area around the
+ end that causes a drag effect rather than causing the slider to
+ jump to the mouse.
+ */
void slider_size(double v);
+
+ /** Gets the slider box type. */
Fl_Boxtype slider() const {return (Fl_Boxtype)slider_;}
+
+ /** Sets the slider box type. */
void slider(Fl_Boxtype c) {slider_ = c;}
};
#endif
//
-// End of "$Id: Fl_Slider.H 4288 2005-04-16 00:13:17Z mike $".
+// End of "$Id: Fl_Slider.H 6683 2009-03-14 11:46:43Z engelsman $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Spinner.H b/plugins/zynaddsubfx/fltk/FL/Fl_Spinner.H
index 9f76ad73e..b718d9281 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Spinner.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Spinner.H
@@ -1,9 +1,9 @@
//
-// "$Id$"
+// "$Id: Fl_Spinner.H 6614 2009-01-01 16:11:32Z matt $"
//
// Spinner widget for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2006 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,6 +25,9 @@
// http://www.fltk.org/str.php
//
+/* \file
+ Fl_Spinner widget . */
+
#ifndef Fl_Spinner_H
# define Fl_Spinner_H
@@ -40,10 +43,11 @@
# include
-//
-// Fl_Spinner widget class...
-//
-
+/**
+ This widget is a combination of the input
+ widget and repeat buttons. The user can either type into the
+ input area or use the buttons to change the value.
+*/
class Fl_Spinner : public Fl_Group
{
double value_; // Current value
@@ -114,6 +118,11 @@ class Fl_Spinner : public Fl_Group
public:
+ /**
+ Creates a new Fl_Spinner widget using the given position, size,
+ and label string.
+ Inherited destructor Destroys the widget and any value associated with it.
+ */
Fl_Spinner(int X, int Y, int W, int H, const char *L = 0)
: Fl_Group(X, Y, W, H, L),
input_(X, Y, W - H / 2 - 2, H),
@@ -140,7 +149,9 @@ class Fl_Spinner : public Fl_Group
down_button_.callback((Fl_Callback *)sb_cb, this);
}
+ /** Sets or returns the format string for the value. */
const char *format() { return (format_); }
+ /** Sets or returns the format string for the value. */
void format(const char *f) { format_ = f; update(); }
int handle(int event) {
@@ -163,13 +174,19 @@ class Fl_Spinner : public Fl_Group
return Fl_Group::handle(event);
}
- // Speling mistaks retained for source compatibility...
+ /** Speling mistakes retained for source compatibility \deprecated */
double maxinum() const { return (maximum_); }
+ /** Gets the maximum value of the widget. */
double maximum() const { return (maximum_); }
+ /** Sets the maximum value of the widget. */
void maximum(double m) { maximum_ = m; }
+ /** Speling mistakes retained for source compatibility \deprecated */
double mininum() const { return (minimum_); }
+ /** Gets the minimum value of the widget. */
double minimum() const { return (minimum_); }
+ /** Sets the minimum value of the widget. */
void minimum(double m) { minimum_ = m; }
+ /** Sets the minimum and maximum values for the widget. */
void range(double a, double b) { minimum_ = a; maximum_ = b; }
void resize(int X, int Y, int W, int H) {
Fl_Group::resize(X,Y,W,H);
@@ -179,32 +196,51 @@ class Fl_Spinner : public Fl_Group
down_button_.resize(X + W - H / 2 - 2, Y + H - H / 2,
H / 2 + 2, H / 2);
}
+ /**
+ Sets or returns the amount to change the value when the user clicks a button.
+ Before setting step to a non-integer value, the spinner
+ type() should be changed to floating point.
+ */
double step() const { return (step_); }
+ /** See double Fl_Spinner::step() const */
void step(double s) {
step_ = s;
if (step_ != (int)step_) input_.type(FL_FLOAT_INPUT);
else input_.type(FL_INT_INPUT);
update();
}
+ /** Gets the color of the text in the input field. */
Fl_Color textcolor() const {
return (input_.textcolor());
}
+ /** Sets the color of the text in the input field. */
void textcolor(Fl_Color c) {
input_.textcolor(c);
}
- uchar textfont() const {
+ /** Gets the font of the text in the input field. */
+ Fl_Font textfont() const {
return (input_.textfont());
}
- void textfont(uchar f) {
+ /** Sets the font of the text in the input field. */
+ void textfont(Fl_Font f) {
input_.textfont(f);
}
- uchar textsize() const {
+ /** Gets the size of the text in the input field. */
+ Fl_Fontsize textsize() const {
return (input_.textsize());
}
- void textsize(uchar s) {
+ /** Sets the size of the text in the input field. */
+ void textsize(Fl_Fontsize s) {
input_.textsize(s);
}
+ /** Sets or Gets the numeric representation in the input field.
+ Valid values are FL_INT_INPUT and FL_FLOAT_INPUT.
+ The first form also changes the format() template.
+ Setting a new spinner type via a superclass pointer will not work.
+ \note type is not a virtual function.
+ */
uchar type() const { return (input_.type()); }
+ /** See uchar Fl_Spinner::type() const */
void type(uchar v) {
if (v==FL_FLOAT_INPUT) {
format("%.*f");
@@ -213,12 +249,18 @@ class Fl_Spinner : public Fl_Group
}
input_.type(v);
}
+ /** Gets the current value of the widget. */
double value() const { return (value_); }
+ /**
+ Sets the current value of the widget.
+ Before setting value to a non-integer value, the spinner
+ type() should be changed to floating point.
+ */
void value(double v) { value_ = v; update(); }
};
#endif // !Fl_Spinner_H
//
-// End of "$Id$".
+// End of "$Id: Fl_Spinner.H 6614 2009-01-01 16:11:32Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Sys_Menu_Bar.H b/plugins/zynaddsubfx/fltk/FL/Fl_Sys_Menu_Bar.H
index 01f4b60c9..27cf7494c 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Sys_Menu_Bar.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Sys_Menu_Bar.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Sys_Menu_Bar.H 4546 2005-08-29 20:05:38Z matt $"
+// "$Id: Fl_Sys_Menu_Bar.H 6614 2009-01-01 16:11:32Z matt $"
//
// MacOS system menu bar header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -52,5 +52,5 @@ typedef Fl_Menu_Bar Fl_Sys_Menu_Bar;
#endif
//
-// End of "$Id: Fl_Sys_Menu_Bar.H 4546 2005-08-29 20:05:38Z matt $".
+// End of "$Id: Fl_Sys_Menu_Bar.H 6614 2009-01-01 16:11:32Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Tabs.H b/plugins/zynaddsubfx/fltk/FL/Fl_Tabs.H
index c46bb2e1a..aff3096a4 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Tabs.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Tabs.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Tabs.H 5326 2006-08-17 13:43:07Z matt $"
+// "$Id: Fl_Tabs.H 6614 2009-01-01 16:11:32Z matt $"
//
// Tab header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,11 +25,40 @@
// http://www.fltk.org/str.php
//
+/* \file
+ Fl_Tabs widget . */
+
#ifndef Fl_Tabs_H
#define Fl_Tabs_H
#include "Fl_Group.H"
+/**
+ The Fl_Tabs widget is the "file card tabs"
+ interface that allows you to put lots and lots of buttons and
+ switches in a panel, as popularized by many toolkits.
+
+ \image html tabs.gif
+ \image latex tabs.eps "Fl_Tabs" width=8cm
+
+ Clicking the tab makes a child visible() by calling
+ show() on it, and all other children are made invisible
+ by calling hide() on them. Usually the children are Fl_Group widgets
+ containing several widgets themselves.
+
+ Each child makes a card, and its label() is printed
+ on the card tab, including the label font and style. The
+ selection color of that child is used to color the tab, while
+ the color of the child determines the background color of the pane.
+
+ The size of the tabs is controlled by the bounding box of the
+ children (there should be some space between the children and
+ the edge of the Fl_Tabs), and the tabs may be placed
+ "inverted" on the bottom - this is determined by which
+ gap is larger. It is easiest to lay this out in fluid, using the
+ fluid browser to select each child group and resize them until
+ the tabs look the way you want them to.
+*/
class FL_EXPORT Fl_Tabs : public Fl_Group {
Fl_Widget *value_;
Fl_Widget *push_;
@@ -53,5 +82,5 @@ public:
#endif
//
-// End of "$Id: Fl_Tabs.H 5326 2006-08-17 13:43:07Z matt $".
+// End of "$Id: Fl_Tabs.H 6614 2009-01-01 16:11:32Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Text_Buffer.H b/plugins/zynaddsubfx/fltk/FL/Fl_Text_Buffer.H
index 1c1f60547..6ad34e8fd 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Text_Buffer.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Text_Buffer.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Text_Buffer.H 6010 2008-01-04 20:31:52Z matt $"
+// "$Id: Fl_Text_Buffer.H 6618 2009-01-01 21:54:10Z matt $"
//
// Header file for Fl_Text_Buffer class.
//
-// Copyright 2001-2005 by Bill Spitzak and others.
+// Copyright 2001-2009 by Bill Spitzak and others.
// Original code Copyright Mark Edel. Permission to distribute under
// the LGPL for the FLTK library granted by Mark Edel.
//
@@ -27,6 +27,9 @@
// http://www.fltk.org/str.php
//
+/* \file
+ Fl_Text_Buffer, Fl_Text_Selection widget . */
+
#ifndef FL_TEXT_BUFFER_H
#define FL_TEXT_BUFFER_H
@@ -36,6 +39,11 @@
#include "Fl_Export.H"
+/** \class Fl_Text_Selection
+ This is an internal class for Fl_Text_Buffer to manage text selections.
+
+ \todo members must be documented
+ */
class FL_EXPORT Fl_Text_Selection {
friend class Fl_Text_Buffer;
@@ -48,6 +56,10 @@ class FL_EXPORT Fl_Text_Selection {
int end() { return mEnd; }
int rect_start() { return mRectStart; }
int rect_end() { return mRectEnd; }
+ /**
+ Returns a non-zero number if any text has been selected, or 0
+ if no text is selected.
+ */
char selected() { return mSelected; }
void selected(char b) { mSelected = b; }
int includes(int pos, int lineStartPos, int dispIndex);
@@ -69,11 +81,26 @@ typedef void (*Fl_Text_Modify_Cb)(int pos, int nInserted, int nDeleted,
void* cbArg);
typedef void (*Fl_Text_Predelete_Cb)(int pos, int nDeleted, void* cbArg);
+/**
+ The Fl_Text_Buffer class is used by the Fl_Text_Display
+ and Fl_Text_Editor to manage complex text data and is based upon the
+ excellent NEdit text editor engine - see http://www.nedit.org/.
+*/
+/**
+ The Fl_Text_Buffer class is used by the
+ Fl_Text_Display
+ and
+ Fl_Text_Editor
+ to manage complex text data and is based upon the
+ excellent NEdit text editor engine - see
+ http://www.nedit.org/.
+*/
class FL_EXPORT Fl_Text_Buffer {
public:
- Fl_Text_Buffer(int requestedSize = 0);
+ Fl_Text_Buffer(int requestedSize = 0, int preferredGapSize = 1024);
~Fl_Text_Buffer();
+ /** Returns the number of characters in the buffer. */
int length() { return mLength; }
char* text();
void text(const char* text);
@@ -81,6 +108,7 @@ class FL_EXPORT Fl_Text_Buffer {
char character(int pos);
char* text_in_rectangle(int start, int end, int rectStart, int rectEnd);
void insert(int pos, const char* text);
+ /** Appends the text string to the end of the buffer. */
void append(const char* t) { insert(length(), t); }
void remove(int start, int end);
void replace(int start, int end, const char *text);
@@ -88,11 +116,19 @@ class FL_EXPORT Fl_Text_Buffer {
int undo(int *cp=0);
void canUndo(char flag=1);
int insertfile(const char *file, int pos, int buflen = 128*1024);
+ /**
+ Appends the named file to the end of the buffer. Returns 0 on
+ success, non-zero on error (strerror() contains reason). 1 indicates
+ open for read failed (no data loaded). 2 indicates error occurred
+ while reading data (data was partially loaded).
+ */
int appendfile(const char *file, int buflen = 128*1024)
{ return insertfile(file, length(), buflen); }
+ /** Loads a text file into the buffer */
int loadfile(const char *file, int buflen = 128*1024)
{ select(0, length()); remove_selection(); return appendfile(file, buflen); }
int outputfile(const char *file, int start, int end, int buflen = 128*1024);
+ /** Saves a text file from the current buffer */
int savefile(const char *file, int buflen = 128*1024)
{ return outputfile(file, 0, length(), buflen); }
@@ -108,9 +144,11 @@ class FL_EXPORT Fl_Text_Buffer {
void remove_rectangular(int start, int end, int rectStart, int rectEnd);
void clear_rectangular(int start, int end, int rectStart, int rectEnd);
+ /** Gets the tab width. */
int tab_distance() { return mTabDist; }
void tab_distance(int tabDist);
void select(int start, int end);
+ /** Returns a non 0 value if text has been selected, 0 otherwise */
int selected() { return mPrimary.selected(); }
void unselect();
void select_rectangular(int start, int end, int rectStart, int rectEnd);
@@ -123,7 +161,10 @@ class FL_EXPORT Fl_Text_Buffer {
void remove_selection();
void replace_selection(const char* text);
void secondary_select(int start, int end);
+ /** Returns a non 0 value if text has been selected in the secondary
+ text selection, 0 otherwise */
int secondary_selected() { return mSecondary.selected(); }
+ /** Clears any selection in the secondary text selection object. */
void secondary_unselect();
void secondary_select_rectangular(int start, int end, int rectStart,
@@ -137,6 +178,10 @@ class FL_EXPORT Fl_Text_Buffer {
void remove_secondary_selection();
void replace_secondary_selection(const char* text);
void highlight(int start, int end);
+ /**
+ Returns the highlighted text. When you are done with the
+ text, free it using the free() function.
+ */
int highlight() { return mHighlight.selected(); }
void unhighlight();
void highlight_rectangular(int start, int end, int rectStart, int rectEnd);
@@ -149,12 +194,21 @@ class FL_EXPORT Fl_Text_Buffer {
void add_modify_callback(Fl_Text_Modify_Cb bufModifiedCB, void* cbArg);
void remove_modify_callback(Fl_Text_Modify_Cb bufModifiedCB, void* cbArg);
+ /**
+ Calls all modify callbacks that have been registered using
+ the add_modify_callback()
+ method.
+ */
void call_modify_callbacks() { call_modify_callbacks(0, 0, 0, 0, 0); }
void add_predelete_callback(Fl_Text_Predelete_Cb bufPredelCB, void* cbArg);
void remove_predelete_callback(Fl_Text_Predelete_Cb predelCB, void* cbArg);
- void call_predelete_callbacks() { call_predelete_callbacks(0, 0); }
+ /**
+ Calls the stored pre-delete callback procedure(s) for this buffer to update
+ the changed area(s) on the screen and any other listeners.
+ */
+ void call_predelete_callbacks() { call_predelete_callbacks(0, 0); }
char* line_text(int pos);
int line_start(int pos);
@@ -185,9 +239,13 @@ class FL_EXPORT Fl_Text_Buffer {
int substitute_null_characters(char* string, int length);
void unsubstitute_null_characters(char* string);
+ /** Returns the current nul substitution character. */
char null_substitution_character() { return mNullSubsChar; }
+ /** Returns the primary selection. */
Fl_Text_Selection* primary_selection() { return &mPrimary; }
+ /** Returns the secondary selection. */
Fl_Text_Selection* secondary_selection() { return &mSecondary; }
+ /** Returns the current highlight selection. */
Fl_Text_Selection* highlight_selection() { return &mHighlight; }
protected:
@@ -223,41 +281,44 @@ class FL_EXPORT Fl_Text_Buffer {
void update_selections(int pos, int nDeleted, int nInserted);
- Fl_Text_Selection mPrimary; /* highlighted areas */
- Fl_Text_Selection mSecondary;
- Fl_Text_Selection mHighlight;
- int mLength; /* length of the text in the buffer (the length
+ Fl_Text_Selection mPrimary; /**< highlighted areas */
+ Fl_Text_Selection mSecondary; /**< highlighted areas */
+ Fl_Text_Selection mHighlight; /**< highlighted areas */
+ int mLength; /**< length of the text in the buffer (the length
of the buffer itself must be calculated:
gapEnd - gapStart + length) */
- char* mBuf; /* allocated memory where the text is stored */
- int mGapStart; /* points to the first character of the gap */
- int mGapEnd; /* points to the first char after the gap */
+ char* mBuf; /**< allocated memory where the text is stored */
+ int mGapStart; /**< points to the first character of the gap */
+ int mGapEnd; /**< points to the first char after the gap */
// The hardware tab distance used by all displays for this buffer,
// and used in computing offsets for rectangular selection operations.
- int mTabDist; /* equiv. number of characters in a tab */
- int mUseTabs; /* True if buffer routines are allowed to use
+ int mTabDist; /**< equiv. number of characters in a tab */
+ int mUseTabs; /**< True if buffer routines are allowed to use
tabs for padding in rectangular operations */
- int mNModifyProcs; /* number of modify-redisplay procs attached */
- Fl_Text_Modify_Cb* /* procedures to call when buffer is */
- mNodifyProcs; /* modified to redisplay contents */
- void** mCbArgs; /* caller arguments for modifyProcs above */
- int mNPredeleteProcs; /* number of pre-delete procs attached */
- Fl_Text_Predelete_Cb* /* procedure to call before text is deleted */
- mPredeleteProcs; /* from the buffer; at most one is supported. */
- void **mPredeleteCbArgs; /* caller argument for pre-delete proc above */
- int mCursorPosHint; /* hint for reasonable cursor position after
+ int mNModifyProcs; /**< number of modify-redisplay procs attached */
+ Fl_Text_Modify_Cb* /**< procedures to call when buffer is */
+ mNodifyProcs; /**< modified to redisplay contents */
+ void** mCbArgs; /**< caller arguments for modifyProcs above */
+ int mNPredeleteProcs; /**< number of pre-delete procs attached */
+ Fl_Text_Predelete_Cb* /**< procedure to call before text is deleted */
+ mPredeleteProcs; /**< from the buffer; at most one is supported. */
+ void **mPredeleteCbArgs; /**< caller argument for pre-delete proc above */
+ int mCursorPosHint; /**< hint for reasonable cursor position after
a buffer modification operation */
- char mNullSubsChar; /* NEdit is based on C null-terminated strings,
+ char mNullSubsChar; /**< NEdit is based on C null-terminated strings,
so ascii-nul characters must be substituted
with something else. This is the else, but
of course, things get quite messy when you
use it */
- char mCanUndo; /* if this buffer is used for attributes, it must
+ char mCanUndo; /**< if this buffer is used for attributes, it must
not do any undo calls */
+ int mPreferredGapSize; /**< the default allocation for the text gap is 1024
+ bytes and should only be increased if frequent
+ and large changes in buffer size are expected */
};
#endif
//
-// End of "$Id: Fl_Text_Buffer.H 6010 2008-01-04 20:31:52Z matt $".
+// End of "$Id: Fl_Text_Buffer.H 6618 2009-01-01 21:54:10Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Text_Display.H b/plugins/zynaddsubfx/fltk/FL/Fl_Text_Display.H
index e7ef14d3f..a76895a1a 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Text_Display.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Text_Display.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Text_Display.H 4502 2005-08-10 23:11:51Z matt $"
+// "$Id: Fl_Text_Display.H 6614 2009-01-01 16:11:32Z matt $"
//
// Header file for Fl_Text_Display class.
//
-// Copyright 2001-2005 by Bill Spitzak and others.
+// Copyright 2001-2009 by Bill Spitzak and others.
// Original code Copyright Mark Edel. Permission to distribute under
// the LGPL for the FLTK library granted by Mark Edel.
//
@@ -27,6 +27,9 @@
// http://www.fltk.org/str.php
//
+/* \file
+ Fl_Text_Display widget . */
+
#ifndef FL_TEXT_DISPLAY_H
#define FL_TEXT_DISPLAY_H
@@ -36,8 +39,16 @@
#include "Fl_Scrollbar.H"
#include "Fl_Text_Buffer.H"
+/**
+ This is the FLTK text display widget. It allows the user to
+ view multiple lines of text and supports highlighting and
+ scrolling. The buffer that is displayed in the widget is managed
+ by the Fl_Text_Buffer
+ class.
+*/
class FL_EXPORT Fl_Text_Display: public Fl_Group {
public:
+ /** text display cursor shapes enumeration */
enum {
NORMAL_CURSOR, CARET_CURSOR, DIM_CURSOR,
BLOCK_CURSOR, HEAVY_CURSOR
@@ -47,9 +58,10 @@ class FL_EXPORT Fl_Text_Display: public Fl_Group {
CURSOR_POS, CHARACTER_POS
};
- // drag types- they match Fl::event_clicks() so that single clicking to
- // start a collection selects by character, double clicking selects by
- // word and triple clicking selects by line.
+ /** drag types- they match Fl::event_clicks() so that single clicking to
+ start a collection selects by character, double clicking selects by
+ word and triple clicking selects by line.
+ */
enum {
DRAG_CHAR = 0, DRAG_WORD = 1, DRAG_LINE = 2
};
@@ -57,13 +69,14 @@ class FL_EXPORT Fl_Text_Display: public Fl_Group {
typedef void (*Unfinished_Style_Cb)(int, void *);
- // style attributes - currently not implemented!
+ /** style attributes - currently not implemented! */
enum {
ATTR_NONE = 0,
ATTR_UNDERLINE = 1,
ATTR_HIDDEN = 2
};
-
+ /** This structure associates the color,font,size of a string to draw
+ with an attribute mask matching attr */
struct Style_Table_Entry {
Fl_Color color;
Fl_Font font;
@@ -76,13 +89,22 @@ class FL_EXPORT Fl_Text_Display: public Fl_Group {
virtual int handle(int e);
void buffer(Fl_Text_Buffer* buf);
+ /**
+ Sets or gets the current text buffer associated with the text widget.
+ Multiple text widgets can be associated with the same text buffer.
+ */
void buffer(Fl_Text_Buffer& buf) { buffer(&buf); }
+ /**
+ Gets the current text buffer associated with the text widget.
+ Multiple text widgets can be associated with the same text buffer.
+ */
Fl_Text_Buffer* buffer() { return mBuffer; }
void redisplay_range(int start, int end);
void scroll(int topLineNum, int horizOffset);
void insert(const char* text);
void overstrike(const char* text);
void insert_position(int newPos);
+ /** Gets the position of the text insertion cursor for text display */
int insert_position() { return mCursorPos; }
int in_selection(int x, int y);
void show_insert_position();
@@ -98,15 +120,24 @@ class FL_EXPORT Fl_Text_Display: public Fl_Group {
void next_word(void);
void previous_word(void);
void show_cursor(int b = 1);
+ /** Hides the text cursor */
void hide_cursor() { show_cursor(0); }
void cursor_style(int style);
+ /** Sets or gets the text cursor color. */
Fl_Color cursor_color() const {return mCursor_color;}
+ /** Sets or gets the text cursor color. */
void cursor_color(Fl_Color n) {mCursor_color = n;}
+ /** Sets or gets the width/height of the scrollbars. */
int scrollbar_width() { return scrollbar_width_; }
- Fl_Align scrollbar_align() { return scrollbar_align_; }
+ /** Sets or gets the width/height of the scrollbars. */
void scrollbar_width(int W) { scrollbar_width_ = W; }
+ /** Gets the scrollbar alignment type */
+ Fl_Align scrollbar_align() { return scrollbar_align_; }
+ /** Sets the scrollbar alignment type */
void scrollbar_align(Fl_Align a) { scrollbar_align_ = a; }
+ /** Moves the insert position to the beginning of the current word. */
int word_start(int pos) { return buffer()->word_start(pos); }
+ /** Moves the insert position to the end of the current word. */
int word_end(int pos) { return buffer()->word_end(pos); }
@@ -118,12 +149,24 @@ class FL_EXPORT Fl_Text_Display: public Fl_Group {
int position_style(int lineStartPos, int lineLen, int lineIndex,
int dispIndex);
+ /** \todo FIXME : get set methods pointing on shortcut_
+ have no effects as shortcut_ is unused in this class and derived! */
+ int shortcut() const {return shortcut_;}
+ /** \todo FIXME : get set methods pointing on shortcut_
+ have no effects as shortcut_ is unused in this class and derived! */
+ void shortcut(int s) {shortcut_ = s;}
- Fl_Font textfont() const {return (Fl_Font)textfont_;}
- void textfont(uchar s) {textfont_ = s;}
- uchar textsize() const {return textsize_;}
- void textsize(uchar s) {textsize_ = s;}
+ /** Gets the default font used when drawing text in the widget. */
+ Fl_Font textfont() const {return textfont_;}
+ /** Sets the default font used when drawing text in the widget. */
+ void textfont(Fl_Font s) {textfont_ = s;}
+ /** Gets the default size of text in the widget. */
+ Fl_Fontsize textsize() const {return textsize_;}
+ /** Sets the default size of text in the widget. */
+ void textsize(Fl_Fontsize s) {textsize_ = s;}
+ /** Gets the default color of text in the widget. */
Fl_Color textcolor() const {return (Fl_Color)textcolor_;}
+ /** Sets the default color of text in the widget. */
void textcolor(unsigned n) {textcolor_ = n;}
int wrapped_column(int row, int column);
@@ -212,7 +255,7 @@ class FL_EXPORT Fl_Text_Display: public Fl_Group {
int wrap_uses_character(int lineEndPos);
int range_touches_selection(Fl_Text_Selection *sel, int rangeStart,
int rangeEnd);
-
+#ifndef FL_DOXYGEN
int damage_range1_start, damage_range1_end;
int damage_range2_start, damage_range2_end;
int mCursorPos;
@@ -280,8 +323,10 @@ class FL_EXPORT Fl_Text_Display: public Fl_Group {
int display_insert_position_hint;
struct { int x, y, w, h; } text_area;
- uchar textfont_;
- uchar textsize_;
+ int shortcut_;
+
+ Fl_Font textfont_;
+ Fl_Fontsize textsize_;
unsigned textcolor_;
// The following are not presently used from the original NEdit code,
@@ -289,10 +334,11 @@ class FL_EXPORT Fl_Text_Display: public Fl_Group {
// can implement line numbers without breaking binary compatibility.
int mLineNumLeft, mLineNumWidth;
/* Line number margin and width */
+#endif
};
#endif
//
-// End of "$Id: Fl_Text_Display.H 4502 2005-08-10 23:11:51Z matt $".
+// End of "$Id: Fl_Text_Display.H 6614 2009-01-01 16:11:32Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Text_Editor.H b/plugins/zynaddsubfx/fltk/FL/Fl_Text_Editor.H
index 81782f120..85f3611db 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Text_Editor.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Text_Editor.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Text_Editor.H 4288 2005-04-16 00:13:17Z mike $"
+// "$Id: Fl_Text_Editor.H 6614 2009-01-01 16:11:32Z matt $"
//
// Header file for Fl_Text_Editor class.
//
-// Copyright 2001-2005 by Bill Spitzak and others.
+// Copyright 2001-2009 by Bill Spitzak and others.
// Original code Copyright Mark Edel. Permission to distribute under
// the LGPL for the FLTK library granted by Mark Edel.
//
@@ -27,6 +27,9 @@
// http://www.fltk.org/str.php
//
+/* \file
+ Fl_Text_Editor widget . */
+
#ifndef FL_TEXT_EDITOR_H
#define FL_TEXT_EDITOR_H
@@ -36,35 +39,59 @@
// key will match in any state
#define FL_TEXT_EDITOR_ANY_STATE (-1L)
+/**
+ This is the FLTK text editor widget. It allows the user to
+ edit multiple lines of text and supports highlighting and
+ scrolling. The buffer that is displayed in the widget is managed
+ by the Fl_Text_Buffer
+ class.
+*/
class FL_EXPORT Fl_Text_Editor : public Fl_Text_Display {
public:
+ /** Key function binding callback type */
typedef int (*Key_Func)(int key, Fl_Text_Editor* editor);
+ /** Simple linked list associating a key/state to a function */
struct Key_Binding {
- int key;
- int state;
- Key_Func function;
- Key_Binding* next;
+ int key; ///< the key pressed
+ int state; ///< the state of key modifiers
+ Key_Func function; ///< associated function
+ Key_Binding* next; ///< next key binding in the list
};
Fl_Text_Editor(int X, int Y, int W, int H, const char* l = 0);
~Fl_Text_Editor() { remove_all_key_bindings(); }
virtual int handle(int e);
+ /**
+ Sets the current insert mode; if non-zero, new text
+ is inserted before the current cursor position. Otherwise, new
+ text replaces text at the current cursor position.
+ */
void insert_mode(int b) { insert_mode_ = b; }
+ /**
+ Gets the current insert mode; if non-zero, new text
+ is inserted before the current cursor position. Otherwise, new
+ text replaces text at the current cursor position.
+ */
int insert_mode() { return insert_mode_; }
void add_key_binding(int key, int state, Key_Func f, Key_Binding** list);
+ /** Adds a key of state "state" with the function "function" */
void add_key_binding(int key, int state, Key_Func f)
{ add_key_binding(key, state, f, &key_bindings); }
void remove_key_binding(int key, int state, Key_Binding** list);
+ /** Removes the key binding associated with the key "key" of state "state". */
void remove_key_binding(int key, int state)
{ remove_key_binding(key, state, &key_bindings); }
void remove_all_key_bindings(Key_Binding** list);
+ /** Removes all of the key bindings associated with the text editor or list. */
void remove_all_key_bindings() { remove_all_key_bindings(&key_bindings); }
void add_default_key_bindings(Key_Binding** list);
Key_Func bound_key_function(int key, int state, Key_Binding* list);
+ /** Returns the function associated with a key binding. */
Key_Func bound_key_function(int key, int state)
{ return bound_key_function(key, state, key_bindings); }
+ /** Sets the default key function for unassigned keys. */
void default_key_function(Key_Func f) { default_key_function_ = f; }
// functions for the built in default bindings
@@ -96,15 +123,17 @@ class FL_EXPORT Fl_Text_Editor : public Fl_Text_Display {
int handle_key();
void maybe_do_callback();
+#ifndef FL_DOXYGEN
int insert_mode_;
Key_Binding* key_bindings;
static Key_Binding* global_key_bindings;
Key_Func default_key_function_;
+#endif
};
#endif
//
-// End of "$Id: Fl_Text_Editor.H 4288 2005-04-16 00:13:17Z mike $".
+// End of "$Id: Fl_Text_Editor.H 6614 2009-01-01 16:11:32Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Tile.H b/plugins/zynaddsubfx/fltk/FL/Fl_Tile.H
index 69250f8b9..1d9c9174c 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Tile.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Tile.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Tile.H 4288 2005-04-16 00:13:17Z mike $"
+// "$Id: Fl_Tile.H 6614 2009-01-01 16:11:32Z matt $"
//
// Tile header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,14 +25,71 @@
// http://www.fltk.org/str.php
//
+/* \file
+ Fl_Tile widget . */
+
#ifndef Fl_Tile_H
#define Fl_Tile_H
#include "Fl_Group.H"
+/**
+ The Fl_Tile class lets you resize the children by dragging
+ the border between them:
+
+
\image html Fl_Tile.gif
+ \image latex Fl_Tile.eps "Fl_Tile" width=4cm
+
+ For the tiling to work correctly, the children of an
+ Fl_Tile must cover the entire area of the widget, but not
+ overlap. This means that all children must touch each
+ other at their edges, and no gaps can't be left inside the
+ Fl_Tile.
+
+
Fl_Tile does not normailly draw any graphics of its own.
+ The "borders" which can be seen in the snapshot above
+ are actually part of the children. Their boxtypes have been set
+ to FL_DOWN_BOX creating the impression of
+ "ridges" where the boxes touch. What you see are
+ actually two adjacent FL_DOWN_BOX's drawn next to each
+ other. All neighboring widgets share the same edge - the widget's
+ thick borders make it appear as though the widgets aren't actually
+ touching, but they are. If the edges of adjacent widgets do not
+ touch, then it will be impossible to drag the corresponding
+ edges.
+
+ Fl_Tile allows objects to be resized to zero dimensions.
+ To prevent this you can use the resizable() to limit where
+ corners can be dragged to.
+
+ Even though objects can be resized to zero sizes, they must
+ initially have non-zero sizes so the Fl_Tile can figure out
+ their layout. If desired, call position() after creating the
+ children but before displaying the window to set the borders where you
+ want.
+
+
Note on resizable(Fl_Widget &w) :
+ The "resizable" child widget (which should be invisible) limits where the
+ border can be dragged to. If you don't set it, it will be possible to
+ drag the borders right to the edge, and thus resize objects on the edge
+ to zero width or height. The resizable() widget is not
+ resized by dragging any borders. See also void Fl_Group::resizable(Fl_Widget &w)
+
+*/
class FL_EXPORT Fl_Tile : public Fl_Group {
public:
int handle(int);
+ /**
+ Creates a new Fl_Tile widget using the given position, size,
+ and label string. The default boxtype is FL_NO_BOX.
+
+
The destructor also deletes all the children. This allows a
+ whole tree to be deleted at once, without having to keep a pointer to
+ all the children in the user code. A kludge has been done so the
+ Fl_Tile and all of it's children can be automatic (local)
+ variables, but you must declare the Fl_Tile first, so
+ that it is destroyed last.
+ */
Fl_Tile(int X,int Y,int W,int H,const char*l=0) : Fl_Group(X,Y,W,H,l) {}
void resize(int, int, int, int);
void position(int, int, int, int);
@@ -41,5 +98,5 @@ public:
#endif
//
-// End of "$Id: Fl_Tile.H 4288 2005-04-16 00:13:17Z mike $".
+// End of "$Id: Fl_Tile.H 6614 2009-01-01 16:11:32Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Tiled_Image.H b/plugins/zynaddsubfx/fltk/FL/Fl_Tiled_Image.H
index 4af8a9d85..bff39e251 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Tiled_Image.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Tiled_Image.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Tiled_Image.H 4288 2005-04-16 00:13:17Z mike $"
+// "$Id: Fl_Tiled_Image.H 6614 2009-01-01 16:11:32Z matt $"
//
// Tiled image header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,13 +25,23 @@
// http://www.fltk.org/str.php
//
+/* \file
+ Fl_Tiled_Image widget . */
+
#ifndef Fl_Tiled_Image_H
# define Fl_Tiled_Image_H
# include "Fl_Image.H"
-// Tiled image class.
+/**
+ This class supports tiling of images
+ over a specified area. The source (tile) image is not
+ copied unless you call the color_average(),
+ desaturate(),
+ or inactive()
+ methods.
+*/
class FL_EXPORT Fl_Tiled_Image : public Fl_Image {
protected:
@@ -49,11 +59,12 @@ class FL_EXPORT Fl_Tiled_Image : public Fl_Image {
virtual void desaturate();
virtual void draw(int X, int Y, int W, int H, int cx, int cy);
void draw(int X, int Y) { draw(X, Y, w(), h(), 0, 0); }
+ /** Gets The image that is shared */
Fl_Image *image() { return image_; }
};
#endif // !Fl_Tiled_Image_H
//
-// End of "$Id: Fl_Tiled_Image.H 4288 2005-04-16 00:13:17Z mike $"
+// End of "$Id: Fl_Tiled_Image.H 6614 2009-01-01 16:11:32Z matt $"
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Timer.H b/plugins/zynaddsubfx/fltk/FL/Fl_Timer.H
index 765afdbf8..5af7bc612 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Timer.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Timer.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Timer.H 4288 2005-04-16 00:13:17Z mike $"
+// "$Id: Fl_Timer.H 6614 2009-01-01 16:11:32Z matt $"
//
// Timer header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,6 +25,9 @@
// http://www.fltk.org/str.php
//
+/* \file
+ Fl_Timer widget . */
+
#ifndef Fl_Timer_H
#define Fl_Timer_H
@@ -37,6 +40,13 @@
#define FL_VALUE_TIMER 1
#define FL_HIDDEN_TIMER 2
+/**
+ This is provided only to emulate the Forms Timer widget. It works by
+ making a timeout callback every 1/5 second. This is wasteful and
+ inaccurate if you just want something to happen a fixed time in the
+ future. You should directly call
+ Fl::add_timeout() instead.
+*/
class FL_EXPORT Fl_Timer : public Fl_Widget {
static void stepcb(void *);
void step();
@@ -50,9 +60,21 @@ public:
Fl_Timer(uchar t,int x,int y,int w,int h, const char *l);
~Fl_Timer();
void value(double);
+ /** See void Fl_Timer::value(double) */
double value() const {return delay>0.0?delay:0.0;}
+ /**
+ Gets or sets the direction of the timer. If the direction is zero
+ then the timer will count up, otherwise it will count down from the
+ initial value().
+ */
char direction() const {return direction_;}
+ /**
+ Gets or sets the direction of the timer. If the direction is zero
+ then the timer will count up, otherwise it will count down from the
+ initial value().
+ */
void direction(char d) {direction_ = d;}
+ /** Gets or sets whether the timer is suspended. */
char suspended() const {return !on;}
void suspended(char d);
};
@@ -60,6 +82,6 @@ public:
#endif
//
-// End of "$Id: Fl_Timer.H 4288 2005-04-16 00:13:17Z mike $".
+// End of "$Id: Fl_Timer.H 6614 2009-01-01 16:11:32Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Toggle_Button.H b/plugins/zynaddsubfx/fltk/FL/Fl_Toggle_Button.H
index b7764c5c0..c7f48a7cc 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Toggle_Button.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Toggle_Button.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Toggle_Button.H 4288 2005-04-16 00:13:17Z mike $"
+// "$Id: Fl_Toggle_Button.H 6614 2009-01-01 16:11:32Z matt $"
//
// Toggle button header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,13 +25,30 @@
// http://www.fltk.org/str.php
//
+/* \file
+ Fl_Toggle_Button widget . */
+
#ifndef Fl_Toggle_Button_H
#define Fl_Toggle_Button_H
#include "Fl_Button.H"
+/**
+ The toggle button is a push button that needs to be clicked once
+ to toggle on, and one more time to toggle off.
+ The Fl_Toggle_Button subclass displays the "on" state by
+ drawing a pushed-in button.
+ Buttons generate callbacks when they are clicked by the user. You
+ control exactly when and how by changing the values for type()
+ and when().
+*/
class Fl_Toggle_Button : public Fl_Button {
public:
+ /**
+ Creates a new Fl_Toggle_Button widget using the given
+ position, size, and label string.
+
The inherited destructor deletes the toggle button.
+ */
Fl_Toggle_Button(int X,int Y,int W,int H,const char *l=0)
: Fl_Button(X,Y,W,H,l) {type(FL_TOGGLE_BUTTON);}
};
@@ -39,5 +56,5 @@ public:
#endif
//
-// End of "$Id: Fl_Toggle_Button.H 4288 2005-04-16 00:13:17Z mike $".
+// End of "$Id: Fl_Toggle_Button.H 6614 2009-01-01 16:11:32Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Toggle_Light_Button.H b/plugins/zynaddsubfx/fltk/FL/Fl_Toggle_Light_Button.H
index be9e8a6f2..caecb99d0 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Toggle_Light_Button.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Toggle_Light_Button.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Toggle_Light_Button.H 4288 2005-04-16 00:13:17Z mike $"
+// "$Id: Fl_Toggle_Light_Button.H 6614 2009-01-01 16:11:32Z matt $"
//
// Toggle light button header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,7 +25,7 @@
// http://www.fltk.org/str.php
//
-// provided for back-compatability only
+// provided for back-compatibility only
#ifndef Fl_Toggle_Light_Button
#include "Fl_Light_Button.H"
@@ -33,5 +33,5 @@
#endif
//
-// End of "$Id: Fl_Toggle_Light_Button.H 4288 2005-04-16 00:13:17Z mike $".
+// End of "$Id: Fl_Toggle_Light_Button.H 6614 2009-01-01 16:11:32Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Toggle_Round_Button.H b/plugins/zynaddsubfx/fltk/FL/Fl_Toggle_Round_Button.H
index 087ad8e5f..fef2ae4b6 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Toggle_Round_Button.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Toggle_Round_Button.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Toggle_Round_Button.H 4288 2005-04-16 00:13:17Z mike $"
+// "$Id: Fl_Toggle_Round_Button.H 6614 2009-01-01 16:11:32Z matt $"
//
// Toggle round button header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,7 +25,7 @@
// http://www.fltk.org/str.php
//
-// provided for back-compatability only
+// provided for back-compatibility only
#ifndef Fl_Toggle_Round_Button
#include "Fl_Round_Button.H"
@@ -33,5 +33,5 @@
#endif
//
-// End of "$Id: Fl_Toggle_Round_Button.H 4288 2005-04-16 00:13:17Z mike $".
+// End of "$Id: Fl_Toggle_Round_Button.H 6614 2009-01-01 16:11:32Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Tooltip.H b/plugins/zynaddsubfx/fltk/FL/Fl_Tooltip.H
index 28fb69a23..033e83f2b 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Tooltip.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Tooltip.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Tooltip.H 4288 2005-04-16 00:13:17Z mike $"
+// "$Id: Fl_Tooltip.H 6614 2009-01-01 16:11:32Z matt $"
//
// Tooltip header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,53 +25,85 @@
// http://www.fltk.org/str.php
//
+/* \file
+ Fl_Tooltip widget . */
+
#ifndef Fl_Tooltip_H
#define Fl_Tooltip_H
#include
#include
+/**
+ The Fl_Tooltip class provides tooltip support for
+ all FLTK widgets. It contains only static methods.
+*/
class FL_EXPORT Fl_Tooltip {
public:
+ /** Gets the tooltip delay. The default delay is 1.0 seconds. */
static float delay() { return delay_; }
+ /** Sets the tooltip delay. The default delay is 1.0 seconds. */
static void delay(float f) { delay_ = f; }
+ /**
+ Gets the tooltip hover delay, the delay between tooltips.
+ The default delay is 0.2 seconds.
+ */
static float hoverdelay() { return hoverdelay_; }
+ /**
+ Sets the tooltip hover delay, the delay between tooltips.
+ The default delay is 0.2 seconds.
+ */
static void hoverdelay(float f) { hoverdelay_ = f; }
+ /** Returns non-zero if tooltips are enabled. */
static int enabled() { return enabled_; }
+ /** Enables tooltips on all widgets (or disables if b is false). */
static void enable(int b = 1) { enabled_ = b;}
+ /** Same as enable(0), disables tooltips on all widgets. */
static void disable() { enabled_ = 0; }
static void (*enter)(Fl_Widget* w);
static void enter_area(Fl_Widget* w, int X, int Y, int W, int H, const char* tip);
static void (*exit)(Fl_Widget *w);
+ /** Gets the current widget target */
static Fl_Widget* current() {return widget_;}
static void current(Fl_Widget*);
- static int font() { return font_; }
- static int size() { return size_; }
- static void font(int i) { font_ = i; }
- static void size(int s) { size_ = s; }
- static void color(unsigned c) { color_ = c; }
+ /** Gets the typeface for the tooltip text. */
+ static Fl_Font font() { return font_; }
+ /** Sets the typeface for the tooltip text. */
+ static void font(Fl_Font i) { font_ = i; }
+ /** Gets the size of the tooltip text. */
+ static Fl_Fontsize size() { return size_; }
+ /** Sets the size of the tooltip text. */
+ static void size(Fl_Fontsize s) { size_ = s; }
+ /** Gets the background color for tooltips. The default background color is a pale yellow. */
static Fl_Color color() { return (Fl_Color)color_; }
- static void textcolor(unsigned c) { textcolor_ = c; }
+ /** Sets the background color for tooltips. The default background color is a pale yellow. */
+ static void color(unsigned c) { color_ = c; }
+ /** Gets the color of the text in the tooltip. The default is black. */
static Fl_Color textcolor() { return (Fl_Color)textcolor_; }
+ /** Sets the color of the text in the tooltip. The default is black. */
+ static void textcolor(unsigned c) { textcolor_ = c; }
// These should not be public, but Fl_Widget::tooltip() needs them...
+ // fabien: made it private with only a friend function access
+private:
+ friend void Fl_Widget::tooltip(const char *);
static void enter_(Fl_Widget* w);
static void exit_(Fl_Widget *w);
private:
- static float delay_;
- static float hoverdelay_;
+ static float delay_; //!< delay before a tooltip is shown
+ static float hoverdelay_; //!< delay between tooltips
static int enabled_;
static unsigned color_;
static unsigned textcolor_;
- static int font_;
- static int size_;
- static Fl_Widget* widget_;
+ static Fl_Font font_;
+ static Fl_Fontsize size_;
+ static Fl_Widget* widget_; //!< Keeps track of the current target widget
};
#endif
//
-// End of "$Id: Fl_Tooltip.H 4288 2005-04-16 00:13:17Z mike $".
+// End of "$Id: Fl_Tooltip.H 6614 2009-01-01 16:11:32Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Valuator.H b/plugins/zynaddsubfx/fltk/FL/Fl_Valuator.H
index b2cd60149..af217477e 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Valuator.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Valuator.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Valuator.H 4288 2005-04-16 00:13:17Z mike $"
+// "$Id: Fl_Valuator.H 6614 2009-01-01 16:11:32Z matt $"
//
// Valuator header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,6 +25,9 @@
// http://www.fltk.org/str.php
//
+/* \file
+ Fl_Valuator widget . */
+
#ifndef Fl_Valuator_H
#define Fl_Valuator_H
@@ -33,9 +36,22 @@
#endif
// shared type() values for classes that work in both directions:
-#define FL_VERTICAL 0
-#define FL_HORIZONTAL 1
+#define FL_VERTICAL 0 ///< The valuator can work vertically
+#define FL_HORIZONTAL 1 ///< The valuator can work horizontally
+/**
+ The Fl_Valuator class controls a single floating-point value
+ and provides a consistent interface to set the value, range, and step,
+ and insures that callbacks are done the same for every object.
+ There are probably more of these classes in FLTK than any others:
+
\image html valuators.gif
+ \image latex valuators.eps "Valuators derived from Fl_Valuators" width=10cm
+ In the above diagram each box surrounds an actual subclass. These
+ are further differentiated by setting the type() of the widget t
+ o the symbolic value labeling the widget.
+ The ones labelled "0" are the default versions with a type(0).
+ For consistency the symbol FL_VERTICAL is defined as zero.
+*/
class FL_EXPORT Fl_Valuator : public Fl_Widget {
double value_;
@@ -44,32 +60,74 @@ class FL_EXPORT Fl_Valuator : public Fl_Widget {
double A; int B; // rounds to multiples of A/B, or no rounding if A is zero
protected:
-
- int horizontal() const {return type()&1;}
+ /** Tells if the valuator is an FL_HORIZONTAL one */
+ int horizontal() const {return type()& FL_HORIZONTAL;}
Fl_Valuator(int X, int Y, int W, int H, const char* L);
+ /** Gets the previous floating point value before an event changed it */
double previous_value() const {return previous_value_;}
+ /** Stores the current value in the previous value */
void handle_push() {previous_value_ = value_;}
double softclamp(double);
void handle_drag(double newvalue);
void handle_release(); // use drag() value
virtual void value_damage(); // cause damage() due to value() changing
+ /** Sets the current floating point value. */
void set_value(double v) {value_ = v;}
public:
- void bounds(double a, double b) {min=a; max=b;}
- double minimum() const {return min;}
- void minimum(double a) {min = a;}
- double maximum() const {return max;}
- void maximum(double a) {max = a;}
+ /** Sets the minimum (a) and maximum (b) values for the valuator widget. */
+ void bounds(double a, double b) {min=a; max=b;}
+ /** Gets the minimum value for the valuator. */
+ double minimum() const {return min;}
+ /** Sets the minimum value for the valuator. */
+ void minimum(double a) {min = a;}
+ /** Gets the maximum value for the valuator. */
+ double maximum() const {return max;}
+ /** Sets the maximum value for the valuator. */
+ void maximum(double a) {max = a;}
+ /**
+ Sets the minimum and maximum values for the valuator. When
+ the user manipulates the widget, the value is limited to this
+ range. This clamping is done after rounding to the step
+ value (this makes a difference if the range is not a multiple of
+ the step).
+
+
The minimum may be greater than the maximum. This has the
+ effect of "reversing" the object so the larger values
+ are in the opposite direction. This also switches which end of
+ the filled sliders is filled.
+
+ Some widgets consider this a "soft" range. This
+ means they will stop at the range, but if the user releases and
+ grabs the control again and tries to move it further, it is
+ allowed.
+
+ The range may affect the display. You must redraw()
+ the widget after changing the range.
+ */
void range(double a, double b) {min = a; max = b;}
+ /** See double Fl_Valuator::step() const */
void step(int a) {A = a; B = 1;}
+ /** See double Fl_Valuator::step() const */
void step(double a, int b) {A = a; B = b;}
void step(double s);
+ /**
+ Gets or sets the step value. As the user moves the mouse the
+ value is rounded to the nearest multiple of the step value. This
+ is done before clamping it to the range. For most widgets
+ the default step is zero.
+
+
For precision the step is stored as the ratio of two
+ integers, A/B. You can set these integers directly. Currently
+ setting a floating point value sets the nearest A/1 or 1/B value
+ possible.
+ */
double step() const {return A/B;}
void precision(int);
+ /** Gets the floating point(double) value. See int value(double) */
double value() const {return value_;}
int value(double);
@@ -82,5 +140,5 @@ public:
#endif
//
-// End of "$Id: Fl_Valuator.H 4288 2005-04-16 00:13:17Z mike $".
+// End of "$Id: Fl_Valuator.H 6614 2009-01-01 16:11:32Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Value_Input.H b/plugins/zynaddsubfx/fltk/FL/Fl_Value_Input.H
index 78dc21115..52d9f31d1 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Value_Input.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Value_Input.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Value_Input.H 4288 2005-04-16 00:13:17Z mike $"
+// "$Id: Fl_Value_Input.H 6664 2009-02-18 09:27:54Z AlbrechtS $"
//
// Value input header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,14 +25,47 @@
// http://www.fltk.org/str.php
//
+/* \file
+ Fl_Value_Input widget . */
+
#ifndef Fl_Value_Input_H
#define Fl_Value_Input_H
#include "Fl_Valuator.H"
#include "Fl_Input.H"
+/**
+ The Fl_Value_Input widget displays a numeric value.
+ The user can click in the text field and edit it - there is in
+ fact a hidden Fl_Input widget with
+ type(FL_FLOAT_INPUT) or type(FL_INT_INPUT) in
+ there - and when they hit return or tab the value updates to
+ what they typed and the callback is done.
+
+
If step() is non-zero and integral, then the range of numbers
+ is limited to integers instead of floating point numbers. As
+ well as displaying the value as an integer, typed input is also
+ limited to integer values, even if the hidden Fl_Input widget
+ is of type(FL_FLOAT_INPUT).
+
+ If step() is non-zero, the user can also drag the
+ mouse across the object and thus slide the value. The left
+ button moves one step() per pixel, the middle by 10
+ * step(), and the right button by 100 * step(). It
+ is therefore impossible to select text by dragging across it,
+ although clicking can still move the insertion cursor.
+
+ If step() is non-zero and integral, then the range
+ of numbers are limited to integers instead of floating point
+ values.
+
+
\image html Fl_Value_Input.gif
+ \image latex Fl_Value_Input.eps "Fl_Value_Input" width=8cm
+*/
class FL_EXPORT Fl_Value_Input : public Fl_Valuator {
public:
+ /* This is the encapsulated Fl_input attribute to which
+ this class delegates the value font, color and shortcut */
Fl_Input input;
private:
char soft_;
@@ -40,20 +73,57 @@ private:
virtual void value_damage(); // cause damage() due to value() changing
public:
int handle(int);
+protected:
void draw();
+public:
void resize(int,int,int,int);
Fl_Value_Input(int x,int y,int w,int h,const char *l=0);
+ ~Fl_Value_Input();
+ /** See void Fl_Value_Input::soft(char s) */
void soft(char s) {soft_ = s;}
+ /**
+ If "soft" is turned on, the user is allowed to drag
+ the value outside the range. If they drag the value to one of
+ the ends, let go, then grab again and continue to drag, they can
+ get to any value. The default is true.
+ */
char soft() const {return soft_;}
+ /**
+ The first form returns the current shortcut key for the Input.
+
The second form sets the shortcut key to key. Setting this
+ overrides the use of '&' in the label(). The value is a bitwise
+ OR of a key and a set of shift flags, for example FL_ALT | 'a'
+ , FL_ALT | (FL_F + 10), or just 'a'. A value
+ of 0 disables the shortcut.
+ The key can be any value returned by
+ Fl::event_key(), but will usually be an ASCII letter. Use
+ a lower-case letter unless you require the shift key to be held down.
+ The shift flags can be any set of values accepted by
+ Fl::event_state(). If the bit is on that shift key must
+ be pushed. Meta, Alt, Ctrl, and Shift must be off if they are not in
+ the shift flags (zero for the other bits indicates a "don't care"
+ setting).
+ */
+ int shortcut() const {return input.shortcut();}
+ /** See int Fl_Value_Input::shortcut() const */
+ void shortcut(int s) {input.shortcut(s);}
+ /** Gets the typeface of the text in the value box. */
Fl_Font textfont() const {return input.textfont();}
- void textfont(uchar s) {input.textfont(s);}
- uchar textsize() const {return input.textsize();}
- void textsize(uchar s) {input.textsize(s);}
+ /** Sets the typeface of the text in the value box. */
+ void textfont(Fl_Font s) {input.textfont(s);}
+ /** Gets the size of the text in the value box. */
+ Fl_Fontsize textsize() const {return input.textsize();}
+ /** Sets the size of the text in the value box. */
+ void textsize(Fl_Fontsize s) {input.textsize(s);}
+ /** Gets the color of the text in the value box. */
Fl_Color textcolor() const {return input.textcolor();}
+ /** Sets the color of the text in the value box.*/
void textcolor(unsigned n) {input.textcolor(n);}
+ /** Gets the color of the text cursor. The text cursor is black by default. */
Fl_Color cursor_color() const {return input.cursor_color();}
+ /** Sets the color of the text cursor. The text cursor is black by default. */
void cursor_color(unsigned n) {input.cursor_color(n);}
};
@@ -61,5 +131,5 @@ public:
#endif
//
-// End of "$Id: Fl_Value_Input.H 4288 2005-04-16 00:13:17Z mike $".
+// End of "$Id: Fl_Value_Input.H 6664 2009-02-18 09:27:54Z AlbrechtS $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Value_Output.H b/plugins/zynaddsubfx/fltk/FL/Fl_Value_Output.H
index 3353e885c..1654219c6 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Value_Output.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Value_Output.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Value_Output.H 4288 2005-04-16 00:13:17Z mike $"
+// "$Id: Fl_Value_Output.H 6664 2009-02-18 09:27:54Z AlbrechtS $"
//
// Value output header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,6 +25,9 @@
// http://www.fltk.org/str.php
//
+/* \file
+ Fl_Value_Output widget . */
+
#ifndef Fl_Value_Output_H
#define Fl_Value_Output_H
@@ -32,27 +35,61 @@
#include "Fl_Valuator.H"
#endif
+/**
+ The Fl_Value_Output widget displays a floating point value.
+ If step() is not zero, the user can adjust the value by
+ dragging the mouse left and right. The left button moves one step()
+ per pixel, the middle by 10 * step(), and the right button by
+ 100 * step().
+
This is much lighter-weight than
+ Fl_Value_Input because it contains no text editing code or
+ character buffer.
+ \image html Fl_Value_Output.gif
+ \image latex Fl_Value_Output.eps "Fl_Value_Output" width=8cm
+*/
class FL_EXPORT Fl_Value_Output : public Fl_Valuator {
- uchar textfont_, textsize_, soft_;
+ Fl_Font textfont_;
+ Fl_Fontsize textsize_;
+ uchar soft_;
unsigned textcolor_;
+
+protected:
+ void draw();
+
public:
int handle(int);
- void draw();
Fl_Value_Output(int x,int y,int w,int h,const char *l=0);
+ /**
+ If "soft" is turned on, the user is allowed to drag the value outside
+ the range. If they drag the value to one of the ends, let go, then
+ grab again and continue to drag, they can get to any value. Default is
+ one.
+ */
void soft(uchar s) {soft_ = s;}
+ /**
+ If "soft" is turned on, the user is allowed to drag the value outside
+ the range. If they drag the value to one of the ends, let go, then
+ grab again and continue to drag, they can get to any value. Default is
+ one.
+ */
uchar soft() const {return soft_;}
- Fl_Font textfont() const {return (Fl_Font)textfont_;}
- void textfont(uchar s) {textfont_ = s;}
- uchar textsize() const {return textsize_;}
- void textsize(uchar s) {textsize_ = s;}
+ /** Gets the typeface of the text in the value box. */
+ Fl_Font textfont() const {return textfont_;}
+ /** Sets the typeface of the text in the value box. */
+ void textfont(Fl_Font s) {textfont_ = s;}
+ /** Gets the size of the text in the value box. */
+ Fl_Fontsize textsize() const {return textsize_;}
+ void textsize(Fl_Fontsize s) {textsize_ = s;}
+ /** Sets the color of the text in the value box. */
Fl_Color textcolor() const {return (Fl_Color)textcolor_;}
+ /** Gets the color of the text in the value box. */
void textcolor(unsigned s) {textcolor_ = s;}
};
#endif
//
-// End of "$Id: Fl_Value_Output.H 4288 2005-04-16 00:13:17Z mike $".
+// End of "$Id: Fl_Value_Output.H 6664 2009-02-18 09:27:54Z AlbrechtS $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Value_Slider.H b/plugins/zynaddsubfx/fltk/FL/Fl_Value_Slider.H
index 5162e8a3f..c2b5afe50 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Value_Slider.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Value_Slider.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Value_Slider.H 4288 2005-04-16 00:13:17Z mike $"
+// "$Id: Fl_Value_Slider.H 6664 2009-02-18 09:27:54Z AlbrechtS $"
//
// Value slider header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,28 +25,45 @@
// http://www.fltk.org/str.php
//
+/* \file
+ Fl_Value_Slider widget . */
+
#ifndef Fl_Value_Slider_H
#define Fl_Value_Slider_H
#include "Fl_Slider.H"
+/**
+ The Fl_Value_Slider widget is a Fl_Slider widget
+ with a box displaying the current value.
+
\image html value_slider.gif
+ \image latex value_slider.eps "Fl_Value_Slider" width=4cm
+*/
class FL_EXPORT Fl_Value_Slider : public Fl_Slider {
- uchar textfont_, textsize_;
+ Fl_Font textfont_;
+ Fl_Fontsize textsize_;
unsigned textcolor_;
-public:
+protected:
void draw();
+public:
int handle(int);
Fl_Value_Slider(int x,int y,int w,int h, const char *l = 0);
- Fl_Font textfont() const {return (Fl_Font)textfont_;}
- void textfont(uchar s) {textfont_ = s;}
- uchar textsize() const {return textsize_;}
- void textsize(uchar s) {textsize_ = s;}
+ /** Gets the typeface of the text in the value box. */
+ Fl_Font textfont() const {return textfont_;}
+ /** Sets the typeface of the text in the value box. */
+ void textfont(Fl_Font s) {textfont_ = s;}
+ /** Gets the size of the text in the value box. */
+ Fl_Fontsize textsize() const {return textsize_;}
+ /** Sets the size of the text in the value box. */
+ void textsize(Fl_Fontsize s) {textsize_ = s;}
+ /** Gets the color of the text in the value box. */
Fl_Color textcolor() const {return (Fl_Color)textcolor_;}
+ /** Sets the color of the text in the value box. */
void textcolor(unsigned s) {textcolor_ = s;}
};
#endif
//
-// End of "$Id: Fl_Value_Slider.H 4288 2005-04-16 00:13:17Z mike $".
+// End of "$Id: Fl_Value_Slider.H 6664 2009-02-18 09:27:54Z AlbrechtS $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Widget.H b/plugins/zynaddsubfx/fltk/FL/Fl_Widget.H
index 09f93eccb..426156137 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Widget.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Widget.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Widget.H 5982 2007-11-19 16:21:48Z matt $"
+// "$Id: Fl_Widget.H 6753 2009-04-12 09:40:59Z AlbrechtS $"
//
// Widget header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,6 +25,9 @@
// http://www.fltk.org/str.php
//
+/* \file
+ Fl_Widget, Fl_Label classes . */
+
#ifndef Fl_Widget_H
#define Fl_Widget_H
@@ -35,30 +38,63 @@ class Fl_Window;
class Fl_Group;
class Fl_Image;
+/** Default callback type definition for all fltk widgets (by far the most used) */
typedef void (Fl_Callback )(Fl_Widget*, void*);
+/** Default callback type pointer definition for all fltk widgets */
typedef Fl_Callback* Fl_Callback_p; // needed for BORLAND
+/** One parameter callback type definition passing only the widget */
typedef void (Fl_Callback0)(Fl_Widget*);
+/** Callback type definition passing the widget and a long data value */
typedef void (Fl_Callback1)(Fl_Widget*, long);
+
+/** This struct stores all information for a text or mixed graphics label.
+
+ \todo For FLTK 1.3, the Fl_Label type will become a widget by itself. That way
+ we will be avoiding a lot of code duplication by handling labels in
+ a similar fashion to widgets containing text. We also provide an easy
+ interface for very complex labels, containing html or vector graphics.
+ */
struct FL_EXPORT Fl_Label {
+ /** label text */
const char* value;
+ /** optional image for an active label */
Fl_Image* image;
+ /** optional image for a deactivated label */
Fl_Image* deimage;
+ /** type of label. \see Fl_Labeltype */
uchar type;
- uchar font;
- uchar size;
+ /** label font used in text */
+ Fl_Font font;
+ /** size of label font */
+ Fl_Fontsize size;
+ /** text color */
unsigned color;
+ /** Draws the label aligned to the given box */
void draw(int,int,int,int, Fl_Align) const ;
- void measure(int&, int&) const ;
+ void measure(int &w, int &h) const ;
};
+
+/** Fl_Widget is the base class for all widgets in FLTK.
+
+ You can't create one of these because the constructor is not public.
+ However you can subclass it.
+
+ All "property" accessing methods, such as color(), parent(), or argument()
+ are implemented as trivial inline functions and thus are as fast and small
+ as accessing fields in a structure. Unless otherwise noted, the property
+ setting methods such as color(n) or label(s) are also trivial inline
+ functions, even if they change the widget's appearance. It is up to the
+ user code to call redraw() after these.
+ */
class FL_EXPORT Fl_Widget {
friend class Fl_Group;
Fl_Group* parent_;
Fl_Callback* callback_;
void* user_data_;
- short x_,y_,w_,h_;
+ int x_,y_,w_,h_;
Fl_Label label_;
int flags_;
unsigned color_;
@@ -66,156 +102,826 @@ class FL_EXPORT Fl_Widget {
uchar type_;
uchar damage_;
uchar box_;
- uchar align_;
+ Fl_Align align_:8;
uchar when_;
const char *tooltip_;
- // unimplemented copy ctor and assignment operator
+ /** unimplemented copy ctor */
Fl_Widget(const Fl_Widget &);
+ /** unimplemented assignment operator */
Fl_Widget& operator=(const Fl_Widget &);
protected:
- Fl_Widget(int,int,int,int,const char* =0);
+ /** Creates a widget at the given position and size.
- void x(int v) {x_ = (short)v;}
- void y(int v) {y_ = (short)v;}
- void w(int v) {w_ = (short)v;}
- void h(int v) {h_ = (short)v;}
+ The Fl_Widget is a protected constructor, but all derived widgets have a
+ matching public constructor. It takes a value for x(), y(), w(), h(), and
+ an optional value for label().
+
+ \param[in] x, y the position of the widget relative to the enclosing window
+ \param[in] w, h size of the widget in pixels
+ \param[in] label optional text for the widget label
+ */
+ Fl_Widget(int x, int y, int w, int h, Fl_CString label=0L);
+ /** Internal use only. Use position(int,int), size(int,int) or resize(int,int,int,int) instead. */
+ void x(int v) {x_ = v;}
+ /** Internal use only. Use position(int,int), size(int,int) or resize(int,int,int,int) instead. */
+ void y(int v) {y_ = v;}
+ /** Internal use only. Use position(int,int), size(int,int) or resize(int,int,int,int) instead. */
+ void w(int v) {w_ = v;}
+ /** Internal use only. Use position(int,int), size(int,int) or resize(int,int,int,int) instead. */
+ void h(int v) {h_ = v;}
+ /** Gets the widget flags mask */
int flags() const {return flags_;}
+ /** Sets a flag in the flags mask */
void set_flag(int c) {flags_ |= c;}
+ /** Clears a flag in the flags mask */
void clear_flag(int c) {flags_ &= ~c;}
- enum {INACTIVE=1, INVISIBLE=2, OUTPUT=4, SHORTCUT_LABEL=64,
- CHANGED=128, VISIBLE_FOCUS=512, COPIED_LABEL = 1024};
-
+ /** flags possible values enumeration.
+ See activate(), output(), visible(), changed(), set_visible_focus()
+ */
+ enum {
+ INACTIVE=1, ///< the widget can't receive focus, and is disabled but potentially visible
+ INVISIBLE=2, ///< the widget is not drawn but can receive events
+ OUTPUT=4, ///< for output only
+ SHORTCUT_LABEL=64, ///< the label contains a shortcut we need to draw
+ CHANGED=128, ///< the widget value changed
+ VISIBLE_FOCUS=512, ///< accepts keyboard focus navigation if the widget can have the focus
+ COPIED_LABEL=1024 ///< the widget label is internally copied, its destruction is handled by the widget
+ };
void draw_box() const;
- void draw_box(Fl_Boxtype, Fl_Color) const;
- void draw_box(Fl_Boxtype, int,int,int,int, Fl_Color) const;
+ void draw_box(Fl_Boxtype t, Fl_Color c) const;
+ void draw_box(Fl_Boxtype t, int x,int y,int w,int h, Fl_Color c) const;
+ /** draws a focus rectangle around the widget */
void draw_focus() {draw_focus(box(),x(),y(),w(),h());}
- void draw_focus(Fl_Boxtype, int,int,int,int) const;
+ void draw_focus(Fl_Boxtype t, int x,int y,int w,int h) const;
void draw_label() const;
void draw_label(int, int, int, int) const;
public:
+ /** Destroys the widget.
+ Destroying single widgets is not very common. You almost always want to
+ destroy the parent group instead, which will destroy all of the child widgets
+ and groups in that group.
+
+ \since FLTK 1.3, the widget's destructor removes the widget from its parent
+ group, if it is member of a group.
+ */
virtual ~Fl_Widget();
- virtual void draw() = 0;
- virtual int handle(int);
- Fl_Group* parent() const {return parent_;}
- void parent(Fl_Group* p) {parent_ = p;} // for hacks only, Fl_Group::add()
+ /** Draws the widget.
+ Never call this function directly. FLTK will schedule redrawing whenever
+ needed. If your widget must be redrawn as soon as possible, call redraw()
+ instead.
+ Override this function to draw your own widgets.
+
+ If you ever need to call another widget's draw method from within your
+ own draw() method, e.g. for an embedded scrollbar, you can do it
+ (because draw() is virtual) like this:
+
+ \code
+ Fl_Widget *s = &scroll; // scroll is an embedded Fl_Scrollbar
+ s->draw(); // calls Fl_Scrollbar::draw()
+ \endcode
+ */
+ virtual void draw() = 0;
+
+ /** Handles the specified event.
+ You normally don't call this method directly, but instead let FLTK do
+ it when the user interacts with the widget.
+
+ When implemented in a widget, this function must return 0 if the
+ widget does not use the event or 1 otherwise.
+
+ Most of the time, you want to call the inherited handle() method in
+ your overridden method so that you don't short-circuit events that you
+ don't handle. In this last case you should return the callee retval.
+
+ \param[in] event the kind of event received
+ \retval 0 if the event was not used or understood
+ \retval 1 if the event was used and can be deleted
+ \see Fl_Event
+ */
+ virtual int handle(int event);
+
+ /** Returns a pointer to the parent widget.
+ Usually this is a Fl_Group or Fl_Window.
+ \retval NULL if the widget has no parent
+ \see Fl_Group::add(Fl_Widget*)
+ */
+ Fl_Group* parent() const {return parent_;}
+
+ /** Internal use only - "for hacks only".
+
+ It is \em \b STRONGLY recommended not to use this method, because it
+ short-circuits Fl_Group's normal widget adding and removing methods,
+ if the widget is already a child widget of another Fl_Group.
+
+ Use Fl_Group::add(Fl_Widget*) and/or Fl_Group::remove(Fl_Widget*) instead.
+ */
+ void parent(Fl_Group* p) {parent_ = p;} // for hacks only, use Fl_Group::add()
+
+ /** Gets the widget type.
+ Returns the widget type value, which is used for Forms compatibility
+ and to simulate RTTI.
+
+ \todo Explain "simulate RTTI" (currently only used to decide if a widget
+ is a window, i.e. type()>=FL_WINDOW ?). Is type() really used in a way
+ that ensures "Forms compatibility" ?
+ */
uchar type() const {return type_;}
+
+ /** Sets the widget type.
+ This is used for Forms compatibility.
+ */
void type(uchar t) {type_ = t;}
+ /** Gets the widget position in its window.
+ \return the x position relative to the window
+ */
int x() const {return x_;}
+
+ /** Gets the widget position in its window.
+ \return the y position relative to the window
+ */
int y() const {return y_;}
+
+ /** Gets the widget width.
+ \return the width of the widget in pixels.
+ */
int w() const {return w_;}
+
+ /** Gets the widget height.
+ \return the height of the widget in pixels.
+ */
int h() const {return h_;}
- virtual void resize(int,int,int,int);
+
+ /** Changes the size or position of the widget.
+
+ This is a virtual function so that the widget may implement its
+ own handling of resizing. The default version does \e not
+ call the redraw() method, but instead relies on the parent widget
+ to do so because the parent may know a faster way to update the
+ display, such as scrolling from the old position.
+
+ Some window managers under X11 call resize() a lot more often
+ than needed. Please verify that the position or size of a widget
+ did actually change before doing any extensive calculations.
+
+ position(X, Y) is a shortcut for resize(X, Y, w(), h()),
+ and size(W, H) is a shortcut for resize(x(), y(), W, H).
+
+ \param[in] x, y new position relative to the parent window
+ \param[in] w, h new size
+ \see position(int,int), size(int,int)
+ */
+ virtual void resize(int x, int y, int w, int h);
+
+ /** Internal use only. */
int damage_resize(int,int,int,int);
+
+ /** Repositions the window or widget.
+
+ position(X, Y) is a shortcut for resize(X, Y, w(), h()).
+
+ \param[in] X, Y new position relative to the parent window
+ \see resize(int,int,int,int), size(int,int)
+ */
void position(int X,int Y) {resize(X,Y,w_,h_);}
+
+ /** Changes the size of the widget.
+
+ size(W, H) is a shortcut for resize(x(), y(), W, H).
+
+ \param[in] W, H new size
+ \see position(int,int), resize(int,int,int,int)
+ */
void size(int W,int H) {resize(x_,y_,W,H);}
- Fl_Align align() const {return (Fl_Align)align_;}
- void align(uchar a) {align_ = a;}
+ /** Gets the label alignment.
+
+ \return label alignment
+ \see label(), align(Fl_Align), Fl_Align
+ \todo This function should not take uchar as an argument.
+ Apart from the fact that uchar is too short with only 8 bits,
+ it does not provide type safety (in which case we don't need
+ to declare Fl_Align an enum to begin with).
+ *NOTE* The current (FLTK 1.3) implementation (Dec 2008) is such that
+ Fl_Align is (typedef'd to be) "unsigned" (int), but Fl_Widget's
+ "align_" member variable is a bit field of 8 bits only !
+ */
+ Fl_Align align() const {return align_;}
+
+ /** Sets the label alignment.
+ This controls how the label is displayed next to or inside the widget.
+ The default value is FL_ALIGN_CENTER, which centers the label inside
+ the widget.
+ \param[in] alignment new label alignment
+ \see align(), Fl_Align
+ */
+ void align(Fl_Align alignment) {align_ = alignment;}
+
+ /** Gets the box type of the widget.
+ \return the current box type
+ \see box(Fl_Boxtype), Fl_Boxtype
+ */
Fl_Boxtype box() const {return (Fl_Boxtype)box_;}
- void box(Fl_Boxtype a) {box_ = a;}
+
+ /** Sets the box type for the widget.
+ This identifies a routine that draws the background of the widget.
+ See Fl_Boxtype for the available types. The default depends on the
+ widget, but is usually FL_NO_BOX or FL_UP_BOX.
+ \param[in] new_box the new box type
+ \see box(), Fl_Boxtype
+ */
+ void box(Fl_Boxtype new_box) {box_ = new_box;}
+
+ /** Gets the background color of the widget.
+ \return current background color
+ \see color(unsigned), color(unsigned, unsigned)
+ */
Fl_Color color() const {return (Fl_Color)color_;}
- void color(unsigned a) {color_ = a;}
+
+ /** Sets the background color of the widget.
+ The color is passed to the box routine. The color is either an index into
+ an internal table of RGB colors or an RGB color value generated using
+ fl_rgb_color().
+
+ The default for most widgets is FL_BACKGROUND_COLOR. Use Fl::set_color()
+ to redefine colors in the color map.
+ \param[in] bg background color
+ \see color(), color(unsigned, unsigned), selection_color(unsigned)
+ */
+ void color(unsigned bg) {color_ = bg;}
+
+ /** Gets the selection color.
+ \return the current selection color
+ \see selection_color(unsigned), color(unsigned, unsigned)
+ */
Fl_Color selection_color() const {return (Fl_Color)color2_;}
+
+ /** Sets the selection color.
+ The selection color is defined for Forms compatibility and is usually
+ used to color the widget when it is selected, although some widgets
+ use this color for other purposes. You can set both colors at once
+ with color(unsigned bg, unsigned sel).
+ \param[in] a the new selection color
+ \see selection_color(), color(unsigned, unsigned)
+ */
void selection_color(unsigned a) {color2_ = a;}
- void color(unsigned a, unsigned b) {color_=a; color2_=b;}
+
+ /** Sets the background and selection color of the widget.
+
+ The two color form sets both the background and selection colors.
+ \param[in] bg background color
+ \param[in] sel selection color
+ \see color(unsigned), selection_color(unsigned)
+ */
+ void color(unsigned bg, unsigned sel) {color_=bg; color2_=sel;}
+
+ /** Gets the current label text.
+ \return a pointer to the current label text
+ \see label(Fl_CString), copy_label(Fl_CString)
+ */
const char* label() const {return label_.value;}
- void label(const char* a);
- void copy_label(const char* a);
- void label(Fl_Labeltype a,const char* b) {label_.type = a; label_.value = b;}
+
+ /** Sets the current label pointer.
+
+ The label is shown somewhere on or next to the widget. The passed pointer
+ is stored unchanged in the widget (the string is \em not copied), so if
+ you need to set the label to a formatted value, make sure the buffer is
+ static, global, or allocated. The copy_label() method can be used
+ to make a copy of the label string automatically.
+ \param[in] text pointer to new label text
+ \see copy_label()
+ */
+ void label(const char* text);
+
+ /** Sets the current label.
+ Unlike label(), this method allocates a copy of the label
+ string instead of using the original string pointer.
+
+ The internal copy will automatically be freed whenever you assign
+ a new label or when the widget is destroyed.
+
+ \param[in] new_label the new label text
+ \see label()
+ */
+ void copy_label(Fl_CString new_label);
+
+ /** Shortcut to set the label text and type in one call.
+ \see label(FL_CString), labeltype(Fl_Labeltype)
+ */
+ void label(Fl_Labeltype a, const char* b) {label_.type = a; label_.value = b;}
+
+ /** Gets the label type.
+ \return the current label type.
+ \see Fl_Labeltype
+ */
Fl_Labeltype labeltype() const {return (Fl_Labeltype)label_.type;}
+
+ /** Sets the label type.
+ The label type identifies the function that draws the label of the widget.
+ This is generally used for special effects such as embossing or for using
+ the label() pointer as another form of data such as an icon. The value
+ FL_NORMAL_LABEL prints the label as plain text.
+ \param[in] a new label type
+ \see Fl_Labeltype
+ */
void labeltype(Fl_Labeltype a) {label_.type = a;}
+
+ /** Gets the label color.
+ The default color is FL_FOREGROUND_COLOR.
+ \return the current label color
+ */
Fl_Color labelcolor() const {return (Fl_Color)label_.color;}
- void labelcolor(unsigned a) {label_.color=a;}
- Fl_Font labelfont() const {return (Fl_Font)label_.font;}
- void labelfont(uchar a) {label_.font=a;}
- uchar labelsize() const {return label_.size;}
- void labelsize(uchar a) {label_.size=a;}
+
+ /** Sets the label color.
+ The default color is FL_FOREGROUND_COLOR.
+ \param[in] c the new label color
+ */
+ void labelcolor(unsigned c) {label_.color=c;}
+
+ /** Gets the font to use.
+ Fonts are identified by indexes into a table. The default value
+ uses a Helvetica typeface (Arial for Microsoft® Windows®).
+ The function Fl::set_font() can define new typefaces.
+ \return current font used by the label
+ \see Fl_Font
+ */
+ Fl_Font labelfont() const {return label_.font;}
+
+ /** Sets the font to use.
+ Fonts are identified by indexes into a table. The default value
+ uses a Helvetica typeface (Arial for Microsoft® Windows®).
+ The function Fl::set_font() can define new typefaces.
+ \param[in] f the new font for the label
+ \see Fl_Font
+ */
+ void labelfont(Fl_Font f) {label_.font=f;}
+
+ /** Gets the font size in pixels.
+ The default size is 14 pixels.
+ \return the current font size
+ */
+ Fl_Fontsize labelsize() const {return label_.size;}
+
+ /** Sets the font size in pixels.
+ \param[in] pix the new font size
+ \see Fl_Fontsize labelsize()
+ */
+ void labelsize(Fl_Fontsize pix) {label_.size=pix;}
+
+ /** Gets the image that is used as part of the widget label.
+ This image is used when drawing the widget in the active state.
+ \return the current image
+ */
Fl_Image* image() {return label_.image;}
- void image(Fl_Image* a) {label_.image=a;}
- void image(Fl_Image& a) {label_.image=&a;}
+
+ /** Sets the image to use as part of the widget label.
+ This image is used when drawing the widget in the active state.
+ \param[in] img the new image for the label
+ */
+ void image(Fl_Image* img) {label_.image=img;}
+
+ /** Sets the image to use as part of the widget label.
+ This image is used when drawing the widget in the active state.
+ \param[in] img the new image for the label
+ */
+ void image(Fl_Image& img) {label_.image=&img;}
+
+ /** Gets the image that is used as part of the widget label.
+ This image is used when drawing the widget in the inactive state.
+ \return the current image for the deactivated widget
+ */
Fl_Image* deimage() {return label_.deimage;}
- void deimage(Fl_Image* a) {label_.deimage=a;}
- void deimage(Fl_Image& a) {label_.deimage=&a;}
+
+ /** Sets the image to use as part of the widget label.
+ This image is used when drawing the widget in the inactive state.
+ \param[in] img the new image for the deactivated widget
+ */
+ void deimage(Fl_Image* img) {label_.deimage=img;}
+
+ /** Sets the image to use as part of the widget label.
+ This image is used when drawing the widget in the inactive state.
+ \param[in] img the new image for the deactivated widget
+ */
+ void deimage(Fl_Image& img) {label_.deimage=&img;}
+
+ /** Gets the current tooltip text.
+ \return a pointer to the tooltip text or NULL
+ */
const char *tooltip() const {return tooltip_;}
+
+ /** Sets the current tooltip text.
+ Sets a string of text to display in a popup tooltip window when the user
+ hovers the mouse over the widget. The string is not copied, so
+ make sure any formatted string is stored in a static, global,
+ or allocated buffer.
+
+ If no tooltip is set, the tooltip of the parent is inherited. Setting a
+ tooltip for a group and setting no tooltip for a child will show the
+ group's tooltip instead. To avoid this behavior, you can set the child's
+ tooltip to an empty string ("").
+ \param[in] t new tooltip
+ */
void tooltip(const char *t);
+
+ /** Gets the current callback function for the widget.
+ Each widget has a single callback.
+ \return current callback
+ */
Fl_Callback_p callback() const {return callback_;}
- void callback(Fl_Callback* c, void* p) {callback_=c; user_data_=p;}
- void callback(Fl_Callback* c) {callback_=c;}
- void callback(Fl_Callback0*c) {callback_=(Fl_Callback*)c;}
- void callback(Fl_Callback1*c, long p=0) {callback_=(Fl_Callback*)c; user_data_=(void*)p;}
+
+ /** Sets the current callback function for the widget.
+ Each widget has a single callback.
+ \param[in] cb new callback
+ \param[in] p user data
+ */
+ void callback(Fl_Callback* cb, void* p) {callback_=cb; user_data_=p;}
+
+ /** Sets the current callback function for the widget.
+ Each widget has a single callback.
+ \param[in] cb new callback
+ */
+ void callback(Fl_Callback* cb) {callback_=cb;}
+
+ /** Sets the current callback function for the widget.
+ Each widget has a single callback.
+ \param[in] cb new callback
+ */
+ void callback(Fl_Callback0*cb) {callback_=(Fl_Callback*)cb;}
+
+ /** Sets the current callback function for the widget.
+ Each widget has a single callback.
+ \param[in] cb new callback
+ \param[in] p user data
+ */
+ void callback(Fl_Callback1*cb, long p=0) {callback_=(Fl_Callback*)cb; user_data_=(void*)p;}
+
+ /** Gets the user data for this widget.
+ Gets the current user data (void *) argument that is passed to the callback function.
+ \return user data as a pointer
+ */
void* user_data() const {return user_data_;}
+
+ /** Sets the user data for this widget.
+ Sets the new user data (void *) argument that is passed to the callback function.
+ \param[in] v new user data
+ */
void user_data(void* v) {user_data_ = v;}
+
+ /** Gets the current user data (long) argument that is passed to the callback function.
+ */
long argument() const {return (long)user_data_;}
+
+ /** Sets the current user data (long) argument that is passed to the callback function.
+ \todo The user data value must be implemented using a \em union to avoid
+ 64 bit machine incompatibilities.
+ */
void argument(long v) {user_data_ = (void*)v;}
+
+ /** Returns the conditions under which the callback is called.
+
+ You can set the flags with when(uchar), the default value is
+ FL_WHEN_RELEASE.
+
+ \return set of flags
+ \see when(uchar)
+ */
Fl_When when() const {return (Fl_When)when_;}
+
+ /** Sets the flags used to decide when a callback is called.
+
+ This controls when callbacks are done. The following values are useful,
+ the default value is FL_WHEN_RELEASE:
+
+ \li 0: The callback is not done, but changed() is turned on.
+ \li FL_WHEN_CHANGED: The callback is done each time the text is
+ changed by the user.
+ \li FL_WHEN_RELEASE: The callback will be done when this widget loses
+ the focus, including when the window is unmapped. This is a useful
+ value for text fields in a panel where doing the callback on every
+ change is wasteful. However the callback will also happen if the
+ mouse is moved out of the window, which means it should not do
+ anything visible (like pop up an error message).
+ You might do better setting this to zero, and scanning all the
+ items for changed() when the OK button on a panel is pressed.
+ \li FL_WHEN_ENTER_KEY: If the user types the Enter key, the entire
+ text is selected, and the callback is done if the text has changed.
+ Normally the Enter key will navigate to the next field (or insert
+ a newline for a Fl_Multiline_Input) - this changes the behavior.
+ \li FL_WHEN_ENTER_KEY|FL_WHEN_NOT_CHANGED: The Enter key will do the
+ callback even if the text has not changed. Useful for command fields.
+ Fl_Widget::when() is a set of bitflags used by subclasses of
+ Fl_Widget to decide when to do the callback.
+
+ If the value is zero then the callback is never done. Other values
+ are described in the individual widgets. This field is in the base
+ class so that you can scan a panel and do_callback() on all the ones
+ that don't do their own callbacks in response to an "OK" button.
+ \param[in] i set of flags
+ */
void when(uchar i) {when_ = i;}
+ /** Returns whether a widget is visible.
+ \retval 0 if the widget is not drawn and hence invisible.
+ \see show(), hide(), visible_r()
+ */
int visible() const {return !(flags_&INVISIBLE);}
+
+ /** Returns whether a widget and all its parents are visible.
+ \retval 0 if the widget or any of its parents are invisible.
+ \see show(), hide(), visible()
+ */
int visible_r() const;
- void show();
- void hide();
+
+ /** Makes a widget visible.
+ An invisible widget never gets redrawn and does not get events.
+ The visible() method returns true if the widget is set to be
+ visible. The visible_r() method returns true if the widget and
+ all of its parents are visible. A widget is only visible if
+ visible() is true on it and all of its parents.
+
+ Changing it will send FL_SHOW or FL_HIDE events to
+ the widget. Do not change it if the parent is not visible, as this
+ will send false FL_SHOW or FL_HIDE events to the widget.
+ redraw() is called if necessary on this or the parent.
+
+ \see hide(), visible(), visible_r()
+ */
+ virtual void show();
+
+ /** Makes a widget invisible.
+ \see show(), visible(), visible_r()
+ */
+ virtual void hide();
+
+ /** Makes the widget visible.
+ You must still redraw the parent widget to see a change in the
+ window. Normally you want to use the show() method instead.
+ */
void set_visible() {flags_ &= ~INVISIBLE;}
+
+ /** Hides the widget.
+ You must still redraw the parent to see a change in the window.
+ Normally you want to use the hide() method instead.
+ */
void clear_visible() {flags_ |= INVISIBLE;}
+
+ /** Returns whether the widget is active.
+ \retval 0 if the widget is inactive
+ \see active_r(), activate(), deactivate()
+ */
int active() const {return !(flags_&INACTIVE);}
+
+ /** Returns whether the widget and all of its parents are active.
+ \retval 0 if this or any of the parent widgets are inactive
+ \see active(), activate(), deactivate()
+ */
int active_r() const;
+
+ /** Activates the widget.
+ Changing this value will send FL_ACTIVATE to the widget if
+ active_r() is true.
+ \see active(), active_r(), deactivate()
+ */
void activate();
+
+ /** Deactivates the widget.
+ Inactive widgets will be drawn "grayed out", e.g. with less contrast
+ than the active widget. Inactive widgets will not receive any keyboard
+ or mouse button events. Other events (including FL_ENTER, FL_MOVE,
+ FL_LEAVE, FL_SHORTCUT, and others) will still be sent. A widget is
+ only active if active() is true on it and all of its parents.
+
+ Changing this value will send FL_DEACTIVATE to the widget if
+ active_r() is true.
+
+ Currently you cannot deactivate Fl_Window widgets.
+
+ \see activate(), active(), active_r()
+ */
void deactivate();
+
+ /** Returns if a widget is used for output only.
+ output() means the same as !active() except it does not change how the
+ widget is drawn. The widget will not receive any events. This is useful
+ for making scrollbars or buttons that work as displays rather than input
+ devices.
+ \retval 0 if the widget is used for input and output
+ \see set_output(), clear_output()
+ */
int output() const {return (flags_&OUTPUT);}
+
+ /** Sets a widget to output only.
+ \see output(), clear_output()
+ */
void set_output() {flags_ |= OUTPUT;}
+
+ /** Sets a widget to accept input.
+ \see set_output(), output()
+ */
void clear_output() {flags_ &= ~OUTPUT;}
+
+ /** Returns if the widget is able to take events.
+ This is the same as (active() && !output()
+ && visible()) but is faster.
+ \retval 0 if the widget takes no events
+ */
int takesevents() const {return !(flags_&(INACTIVE|INVISIBLE|OUTPUT));}
+
+ /**
+ Checks if the widget value changed since the last callback.
+
+ "Changed" is a flag that is turned on when the user changes the value
+ stored in the widget. This is only used by subclasses of Fl_Widget that
+ store values, but is in the base class so it is easier to scan all the
+ widgets in a panel and do_callback() on the changed ones in response
+ to an "OK" button.
+
+ Most widgets turn this flag off when they do the callback, and when
+ the program sets the stored value.
+
+ \retval 0 if the value did not change
+ \see set_changed(), clear_changed()
+ */
int changed() const {return flags_&CHANGED;}
+
+ /** Marks the value of the widget as changed.
+ \see changed(), clear_changed()
+ */
void set_changed() {flags_ |= CHANGED;}
+
+ /** Marks the value of the widget as unchanged.
+ \see changed(), set_changed()
+ */
void clear_changed() {flags_ &= ~CHANGED;}
+
+ /** Gives the widget the keyboard focus.
+ Tries to make this widget be the Fl::focus() widget, by first sending
+ it an FL_FOCUS event, and if it returns non-zero, setting
+ Fl::focus() to this widget. You should use this method to
+ assign the focus to a widget.
+ \return true if the widget accepted the focus.
+ */
int take_focus();
+
+ /** Enables keyboard focus navigation with this widget.
+ Note, however, that this will not necessarily mean that the widget
+ will accept focus, but for widgets that can accept focus, this method
+ enables it if it has been disabled.
+ \see visible_focus(), clear_visible_focus(), visible_focus(int)
+ */
void set_visible_focus() { flags_ |= VISIBLE_FOCUS; }
+
+ /** Disables keyboard focus navigation with this widget.
+ Normally, all widgets participate in keyboard focus navigation.
+ \see set_visible_focus(), visible_focus(), visible_focus(int)
+ */
void clear_visible_focus() { flags_ &= ~VISIBLE_FOCUS; }
+
+ /** Modifies keyboard focus navigation.
+ \param[in] v set or clear visible focus
+ \see set_visible_focus(), clear_visible_focus(), visible_focus()
+ */
void visible_focus(int v) { if (v) set_visible_focus(); else clear_visible_focus(); }
+
+ /** Checks whether this widget has a visible focus.
+ \retval 0 if this widget has no visible focus.
+ \see visible_focus(int), set_visible_focus(), clear_visible_focus()
+ */
int visible_focus() { return flags_ & VISIBLE_FOCUS; }
- static void default_callback(Fl_Widget*, void*);
- void do_callback() {callback_(this,user_data_); if (callback_ != default_callback) clear_changed();}
- void do_callback(Fl_Widget* o,void* arg=0) {callback_(o,arg); if (callback_ != default_callback) clear_changed();}
- void do_callback(Fl_Widget* o,long arg) {callback_(o,(void*)arg); if (callback_ != default_callback) clear_changed();}
+ /** Sets the default callback for all widgets.
+ Sets the default callback, which puts a pointer to the widget on the queue
+ returned by Fl::readqueue(). You may want to call this from your own callback.
+ \param[in] cb the new callback
+ \param[in] d user data associated with that callback
+ \see callback(), do_callback(), Fl::readqueue()
+ */
+ static void default_callback(Fl_Widget *cb, void *d);
+
+ /** Calls the widget callback.
+ Causes a widget to invoke its callback function with default arguments.
+ \see callback()
+ */
+ void do_callback() {do_callback(this,user_data_);}
+
+ /** Calls the widget callback.
+ Causes a widget to invoke its callback function with arbitrary arguments.
+ \param[in] o call the callback with \p o as the widget argument
+ \param[in] arg call the callback with \p arg as the user data argument
+ \see callback()
+ */
+ void do_callback(Fl_Widget* o,long arg) {do_callback(o,(void*)arg);}
+
+ // Causes a widget to invoke its callback function with arbitrary arguments.
+ // Documentation and implementation in Fl_Widget.cxx
+ void do_callback(Fl_Widget* o,void* arg=0);
+
+ /** Internal use only. */
int test_shortcut();
+ /** Internal use only. */
static char label_shortcut(const char *t);
+ /** Internal use only. */
static int test_shortcut(const char*);
- int contains(const Fl_Widget*) const ;
- int inside(const Fl_Widget* o) const {return o ? o->contains(this) : 0;}
+ /** Checks if w is a child of this widget.
+ \param[in] w potential child widget
+ \return Returns 1 if \p w is a child of this widget, or is
+ equal to this widget. Returns 0 if \p w is NULL.
+ */
+ int contains(const Fl_Widget *w) const ;
+
+ /** Checks if this widget is a child of w.
+ Returns 1 if this widget is a child of \p w, or is
+ equal to \p w. Returns 0 if \p w is NULL.
+ \param[in] w the possible parent widget.
+ \see contains()
+ */
+ int inside(const Fl_Widget* w) const {return w ? w->contains(this) : 0;}
+
+ /** Schedules the drawing of the widget.
+ Marks the widget as needing its draw() routine called.
+ */
void redraw();
- void redraw_label();
- uchar damage() const {return damage_;}
- void clear_damage(uchar c = 0) {damage_ = c;}
- void damage(uchar c);
- void damage(uchar c,int,int,int,int);
- void draw_label(int, int, int, int, Fl_Align) const;
- void measure_label(int& xx, int& yy) {label_.measure(xx,yy);}
+ /** Schedules the drawing of the label.
+ Marks the widget or the parent as needing a redraw for the label area
+ of a widget.
+ */
+ void redraw_label();
+
+ /** Returns non-zero if draw() needs to be called.
+ The damage value is actually a bit field that the widget
+ subclass can use to figure out what parts to draw.
+ \return a bitmap of flags describing the kind of damage to the widget
+ \see damage(uchar), clear_damage(uchar)
+ */
+ uchar damage() const {return damage_;}
+
+ /** Clears the damage flags.
+ Damage flags are cleared when parts of the widget drawing is repaired.
+ \param[in] c bitmask of flags to clear
+ \see damage(uchar), damage()
+ */
+ void clear_damage(uchar c = 0) {damage_ = c;}
+
+ /** Sets the damage bits for the widget.
+ Setting damage bits will schedule the widget for the next redraw.
+ \param[in] c bitmask of flags to set
+ \see damage(), clear_damage(uchar)
+ */
+ void damage(uchar c);
+
+ /** Sets the damage bits for an area inside the widget.
+ Setting damage bits will schedule the widget for the next redraw.
+ \param[in] c bitmask of flags to set
+ \param[in] x, y, w, h size of damaged area
+ \see damage(), clear_damage(uchar)
+ */
+ void damage(uchar c, int x, int y, int w, int h);
+
+ void draw_label(int, int, int, int, Fl_Align) const;
+
+ /** Sets width ww and height hh accordingly with the label size.
+ Labels with images will return w() and h() of the image.
+ */
+ void measure_label(int& ww, int& hh) {label_.measure(ww, hh);}
+
+ /** Returns a pointer to the primary Fl_Window widget.
+ \retval NULL if no window is associated with this widget.
+ \note for an Fl_Window widget, this returns its parent window
+ (if any), not this window.
+ */
Fl_Window* window() const ;
- // back compatability only:
+ /** For back compatibility only.
+ \deprecated Use selection_color() instead.
+ */
Fl_Color color2() const {return (Fl_Color)color2_;}
+
+ /** For back compatibility only.
+ \deprecated Use selection_color(unsigned) instead.
+ */
void color2(unsigned a) {color2_ = a;}
};
-// reserved type numbers (necessary for my cheapo RTTI) start here.
-// grep the header files for "RESERVED_TYPE" to find the next available
-// number.
+/**
+ Reserved type numbers (necessary for my cheapo RTTI) start here.
+ Grep the header files for "RESERVED_TYPE" to find the next available
+ number.
+*/
#define FL_RESERVED_TYPE 100
#endif
//
-// End of "$Id: Fl_Widget.H 5982 2007-11-19 16:21:48Z matt $".
+// End of "$Id: Fl_Widget.H 6753 2009-04-12 09:40:59Z AlbrechtS $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Window.H b/plugins/zynaddsubfx/fltk/FL/Fl_Window.H
index 16a02259e..bd44635d3 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Window.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Window.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Window.H 4421 2005-07-15 09:34:53Z matt $"
+// "$Id: Fl_Window.H 6614 2009-01-01 16:11:32Z matt $"
//
// Window header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,16 +25,34 @@
// http://www.fltk.org/str.php
//
+/* \file
+ Fl_Window widget . */
+
#ifndef Fl_Window_H
#define Fl_Window_H
#include "Fl_Group.H"
-#define FL_WINDOW 0xF0 // all subclasses have type() >= this
-#define FL_DOUBLE_WINDOW 0xF1
+#define FL_WINDOW 0xF0 ///< window type id all subclasses have type() >= this
+#define FL_DOUBLE_WINDOW 0xF1 ///< double window type id
class Fl_X;
+/**
+ This widget produces an actual window. This can either be a main
+ window, with a border and title and all the window management controls,
+ or a "subwindow" inside a window. This is controlled by whether or not
+ the window has a parent().
+
Once you create a window, you usually add children Fl_Widget
+ 's to it by using window->add(child) for each new widget. See Fl_Group for more information
+ on how to add and remove children.
+ There are several subclasses of Fl_Window that provide
+ double-buffering, overlay, menu, and OpenGL support.
+ The window's callback is done if the user tries to close a window
+ using the window manager and
+ Fl::modal() is zero or equal to the window. Fl_Window
+ has a default callback that calls Fl_Window::hide().
+*/
class FL_EXPORT Fl_Window : public Fl_Group {
friend class Fl_X;
@@ -44,8 +62,9 @@ class FL_EXPORT Fl_Window : public Fl_Group {
const char* xclass_;
const void* icon_;
// size_range stuff:
- short minw, minh, maxw, maxh;
- uchar dw, dh, aspect, size_range_set;
+ int minw, minh, maxw, maxh;
+ int dw, dh, aspect;
+ uchar size_range_set;
// cursor stuff
Fl_Cursor cursor_default;
Fl_Color cursor_fg, cursor_bg;
@@ -66,63 +85,282 @@ class FL_EXPORT Fl_Window : public Fl_Group {
protected:
+ /** Stores the last window that was made current. See current() const */
static Fl_Window *current_;
virtual void draw();
+ /** Forces the window to be drawn, this window is also made current and calls draw(). */
virtual void flush();
public:
- Fl_Window(int,int,int,int, const char* = 0);
- Fl_Window(int,int, const char* = 0);
- virtual ~Fl_Window();
+ /**
+ Creates a window from the given size and title.
+ If Fl_Group::current() is not NULL, the window is created as a
+ subwindow of the parent window.
+
+ The first form of the constructor creates a top-level window
+ and asks the window manager to position the window. The second
+ form of the constructor either creates a subwindow or a
+ top-level window at the specified location (x,y) , subject to window
+ manager configuration. If you do not specify the position of the
+ window, the window manager will pick a place to show the window
+ or allow the user to pick a location. Use position(x,y)
+ or hotspot() before calling show() to request a
+ position on the screen. See Fl_Window::resize()
+ for some more details on positioning windows.
+
+ Top-level windows initially have visible() set to 0
+ and parent() set to NULL. Subwindows initially
+ have visible() set to 1 and parent() set to
+ the parent window pointer.
+
+ Fl_Widget::box() defaults to FL_FLAT_BOX. If you
+ plan to completely fill the window with children widgets you should
+ change this to FL_NO_BOX. If you turn the window border off
+ you may want to change this to FL_UP_BOX.
+ */
+ Fl_Window(int w, int h, const char* title= 0);
+ /** Creates a window from the given position, size and title.
+ See Fl_Window::Fl_Window(int w, int h, const char *title = 0)
+ */
+ Fl_Window(int x, int y, int w, int h, const char* title = 0);
+ /**
+ The destructor also deletes all the children. This allows a
+ whole tree to be deleted at once, without having to keep a pointer to
+ all the children in the user code. A kludge has been done so the
+ Fl_Window and all of it's children can be automatic (local)
+ variables, but you must declare the Fl_Window first so
+ that it is destroyed last.
+ */
+ virtual ~Fl_Window();
virtual int handle(int);
+ /**
+ Changes the size and position of the window. If shown() is
+ true, these changes are communicated to the window server (which may
+ refuse that size and cause a further resize). If shown() is
+ false, the size and position are used when show() is called.
+ See Fl_Group for the effect
+ of resizing on the child widgets.
+
You can also call the Fl_Widget methods size(x,y)
+ and position(w,h), which are inline wrappers for this virtual
+ function.
+ A top-level window can not force, but merely suggest a position and
+ size to the operating system. The window manager may not be willing or
+ able to display a window at the desired position or with the given
+ dimensions. It is up to the application developer to verify window
+ parameters after the resize request.
+ */
virtual void resize(int,int,int,int);
+ /**
+ Gets or sets whether or not the window manager border is around the
+ window. The default value is true. border(n) can be used to
+ turn the border on and off, and returns non-zero if the value has been
+ changed. Under most X window managers this does not work after
+ show() has been called, although SGI's 4DWM does work.
+ */
void border(int b);
+ /**
+ Fast inline function to turn the border
+ off. It only works before show() is called.
+ */
void clear_border() {set_flag(FL_NOBORDER);}
+ /** See int Fl_Window::border(int) */
int border() const {return !(flags() & FL_NOBORDER);}
+ /** Activate the flags FL_NOBORDER|FL_OVERRIDE */
void set_override() {set_flag(FL_NOBORDER|FL_OVERRIDE);}
+ /** Returns non zero if FL_OVERRIDE flag is set, 0 otherwise. */
int override() const { return flags()&FL_OVERRIDE; }
+ /**
+ A "modal" window, when shown(), will prevent any events from
+ being delivered to other windows in the same program, and will also
+ remain on top of the other windows (if the X window manager supports
+ the "transient for" property). Several modal windows may be shown at
+ once, in which case only the last one shown gets events. You can See
+ which window (if any) is modal by calling
+ Fl::modal().
+ */
void set_modal() {set_flag(FL_MODAL);}
+ /** Returns true if this window is modal. */
int modal() const {return flags() & FL_MODAL;}
+ /**
+ A "non-modal" window (terminology borrowed from Microsoft Windows)
+ acts like a modal() one in that it remains on top, but it has
+ no effect on event delivery. There are three states for a
+ window: modal, non-modal, and normal.
+ */
void set_non_modal() {set_flag(FL_NON_MODAL);}
+ /** Returns true if this window is modal or non-modal. */
int non_modal() const {return flags() & (FL_NON_MODAL|FL_MODAL);}
+ /**
+ Position the window so that the mouse is pointing at the
+ given position, or at the center of the given widget, which may be the
+ window itself. If the optional offscreen parameter is
+ non-zero, then the window is allowed to extend off the screen (this
+ does not work with some X window managers). \see position()
+ */
void hotspot(int x, int y, int offscreen = 0);
+ /** See void Fl_Window::hotspot(int x, int y, int offscreen = 0) */
void hotspot(const Fl_Widget*, int offscreen = 0);
+ /** See void Fl_Window::hotspot(int x, int y, int offscreen = 0) */
void hotspot(const Fl_Widget& p, int offscreen = 0) {hotspot(&p,offscreen);}
+ /**
+ Undoes the effect of a previous resize() or show()
+ so that the next time show() is called the window manager is
+ free to position the window.
+ */
void free_position() {clear_flag(FL_FORCE_POSITION);}
+ /**
+ Set the allowable range the user can resize this window to. This only
+ works for top-level windows.
+
+ - minw and minh are the smallest the window can
+ be. Either value must be greater than 0.
+ - maxw and maxh are the largest the window can be.
+ If either is equal to the minimum then you cannot resize in
+ that direction. If either is zero then FLTK picks a maximum size in
+ that direction such that the window will fill the screen.
+ - dw and dh are size increments. The window will
+ be constrained to widths of minw + N * dw, where N
+ is any non-negative integer. If these are less or equal to 1 they
+ are ignored. (this is ignored on WIN32)
+ - aspect is a flag that indicates that the window should
+ preserve it's aspect ratio. This only works if both the maximum and
+ minimum have the same aspect ratio. (ignored on WIN32 and by many X
+ window managers)
+
+ If this function is not called, FLTK tries to figure out the range
+ from the setting of resizable():
+
+ - If resizable() is NULL (this is the default)
+ then the window cannot be resized and the resize border and max-size
+ control will not be displayed for the window.
+ - If either dimension of resizable() is less than 100,
+ then that is considered the minimum size. Otherwise the
+ resizable() has a minimum size of 100.
+ - If either dimension of resizable() is zero, then that is
+ also the maximum size (so the window cannot resize in that direction).
+
+ It is undefined what happens if the current size does not fit in the
+ constraints passed to size_range().
+ */
void size_range(int a, int b, int c=0, int d=0, int e=0, int f=0, int g=0) {
- minw=(short)a; minh=(short)b; maxw=(short)c; maxh=(short)d; dw=(uchar)e; dh=(uchar)f; aspect=(uchar)g; size_range_();}
+ minw=a; minh=b; maxw=c; maxh=d; dw=e; dh=f; aspect=g; size_range_();}
+ /** See void Fl_Window::label(const char*) */
const char* label() const {return Fl_Widget::label();}
+ /** See void Fl_Window::iconlabel(const char*) */
const char* iconlabel() const {return iconlabel_;}
+ /** Sets the window title bar label. */
void label(const char*);
+ /** Sets the icon label. */
void iconlabel(const char*);
- void label(const char* label, const char* iconlabel);
+ /** Gets or sets the icon label. */
+ void label(const char* label, const char* iconlabel); // platform dependent
void copy_label(const char* a);
+ /** See void Fl_Window::xclass(const char*) */
const char* xclass() const {return xclass_;}
+ /**
+ A string used to tell the system what type of window this is. Mostly
+ this identifies the picture to draw in the icon. Under X, this is
+ turned into a XA_WM_CLASS pair by truncating at the first
+ non-alphanumeric character and capitalizing the first character, and
+ the second one if the first is 'x'. Thus "foo" turns into "foo, Foo",
+ and "xprog.1" turns into "xprog, XProg". This only works if called
+ before calling show().
+ Under Microsoft Windows this string is used as the name of the
+ WNDCLASS structure, though it is not clear if this can have any
+ visible effect. The passed pointer is stored unchanged. The string
+ is not copied.
+ */
void xclass(const char* c) {xclass_ = c;}
+ /** Gets the current icon window target dependent data */
const void* icon() const {return icon_;}
+ /** Sets the current icon window target dependent data */
void icon(const void * ic) {icon_ = ic;}
+ /**
+ Returns non-zero if show() has been called (but not hide()
+ ). You can tell if a window is iconified with (w->shown()
+ &!w->visible()).
+ */
int shown() {return i != 0;}
+ /**
+ Put the window on the screen. Usually this has the side effect of
+ opening the display. The second form is used for top-level
+ windows and allow standard arguments to be parsed from the
+ command-line.
+
If the window is already shown then it is restored and raised to the
+ top. This is really convenient because your program can call show()
+ at any time, even if the window is already up. It also means that
+ show() serves the purpose of raise() in other toolkits.
+ */
virtual void show();
+ /**
+ Remove the window from the screen. If the window is already hidden or
+ has not been shown then this does nothing and is harmless.
+ */
virtual void hide();
+ /**
+ See virtual void Fl_Window::show()
+ */
void show(int, char**);
+ /**
+ Makes the window completely fill the screen, without any window
+ manager border visible. You must use fullscreen_off() to undo
+ this. This may not work with all window managers.
+ */
void fullscreen();
+ /**
+ Turns off any side effects of fullscreen() and does
+ resize(x,y,w,h).
+ */
void fullscreen_off(int,int,int,int);
+ /**
+ Iconifies the window. If you call this when shown() is false
+ it will show() it as an icon. If the window is already
+ iconified this does nothing.
+
Call show() to restore the window.
+ When a window is iconified/restored (either by these calls or by the
+ user) the handle() method is called with FL_HIDE and
+ FL_SHOW events and visible() is turned on and off.
+ There is no way to control what is drawn in the icon except with the
+ string passed to Fl_Window::xclass(). You should not rely on
+ window managers displaying the icons.
+ */
void iconize();
int x_root() const ;
int y_root() const ;
- static Fl_Window *current();
+ static Fl_Window *current();
+ /**
+ Sets things up so that the drawing functions in <FL/fl_draw.H> will go into this
+ window. This is useful for incremental update of windows, such as in an
+ idle callback, which will make your program behave much better if it
+ draws a slow graphic. Danger: incremental update is very hard to
+ debug and maintain!
+
This method only works for the Fl_Window and
+ Fl_Gl_Window derived classes.
+ */
void make_current();
- // for back-compatability only:
- void cursor(Fl_Cursor, Fl_Color=FL_BLACK, Fl_Color=FL_WHITE);
+ // for back-compatibility only:
+ /**
+ Changes the cursor for this window. This always calls the system, if
+ you are changing the cursor a lot you may want to keep track of how
+ you set it in a static varaible and call this only if the new cursor
+ is different.
+
+
The type Fl_Cursor is an enumeration defined in <Enumerations.H>.
+ (Under X you can get any XC_cursor value by passing
+ Fl_Cursor((XC_foo/2)+1)). The colors only work on X, they are
+ not implemented on WIN32.
+
For back compatibility only.
+ */
+ void cursor(Fl_Cursor, Fl_Color=FL_BLACK, Fl_Color=FL_WHITE); // platform dependent
void default_cursor(Fl_Cursor, Fl_Color=FL_BLACK, Fl_Color=FL_WHITE);
static void default_callback(Fl_Window*, void* v);
@@ -131,5 +369,5 @@ public:
#endif
//
-// End of "$Id: Fl_Window.H 4421 2005-07-15 09:34:53Z matt $".
+// End of "$Id: Fl_Window.H 6614 2009-01-01 16:11:32Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Wizard.H b/plugins/zynaddsubfx/fltk/FL/Fl_Wizard.H
index 4c39b7ec5..80d8af52c 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Wizard.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Wizard.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Wizard.H 4288 2005-04-16 00:13:17Z mike $"
+// "$Id: Fl_Wizard.H 6614 2009-01-01 16:11:32Z matt $"
//
// Fl_Wizard widget definitions.
//
-// Copyright 1999-2005 by Easy Software Products.
+// Copyright 1999-2009 by Easy Software Products.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,6 +25,9 @@
// http://www.fltk.org/str.php
//
+/* \file
+ Fl_Wizard widget . */
+
//
// Include necessary header files...
//
@@ -35,10 +38,15 @@
# include
-//
-// Fl_Wizard class...
-//
+/**
+ This widget is based off the Fl_Tabs
+ widget, but instead of displaying tabs it only changes "tabs" under
+ program control. Its primary purpose is to support "wizards" that
+ step a user through configuration or troubleshooting tasks.
+ As with Fl_Tabs, wizard panes are composed of child (usually
+ Fl_Group) widgets. Navigation buttons must be added separately.
+*/
class FL_EXPORT Fl_Wizard : public Fl_Group
{
Fl_Widget *value_;
@@ -58,5 +66,5 @@ class FL_EXPORT Fl_Wizard : public Fl_Group
#endif // !_Fl_Wizard_H_
//
-// End of "$Id: Fl_Wizard.H 4288 2005-04-16 00:13:17Z mike $".
+// End of "$Id: Fl_Wizard.H 6614 2009-01-01 16:11:32Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_XBM_Image.H b/plugins/zynaddsubfx/fltk/FL/Fl_XBM_Image.H
index 90f94ab9f..315cee80c 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_XBM_Image.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_XBM_Image.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_XBM_Image.H 4288 2005-04-16 00:13:17Z mike $"
+// "$Id: Fl_XBM_Image.H 6614 2009-01-01 16:11:32Z matt $"
//
// XBM image header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,10 +25,17 @@
// http://www.fltk.org/str.php
//
+/* \file
+ Fl_XBM_Image class . */
+
#ifndef Fl_XBM_Image_H
#define Fl_XBM_Image_H
# include "Fl_Bitmap.H"
+/**
+ The Fl_XBM_Image class supports loading, caching,
+ and drawing of X Bitmap (XBM) bitmap files.
+*/
class FL_EXPORT Fl_XBM_Image : public Fl_Bitmap {
public:
@@ -39,5 +46,5 @@ class FL_EXPORT Fl_XBM_Image : public Fl_Bitmap {
#endif // !Fl_XBM_Image_H
//
-// End of "$Id: Fl_XBM_Image.H 4288 2005-04-16 00:13:17Z mike $".
+// End of "$Id: Fl_XBM_Image.H 6614 2009-01-01 16:11:32Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_XPM_Image.H b/plugins/zynaddsubfx/fltk/FL/Fl_XPM_Image.H
index 9ffb1c108..e5e7ec61d 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_XPM_Image.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_XPM_Image.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_XPM_Image.H 4288 2005-04-16 00:13:17Z mike $"
+// "$Id: Fl_XPM_Image.H 6614 2009-01-01 16:11:32Z matt $"
//
// XPM image header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,10 +25,18 @@
// http://www.fltk.org/str.php
//
+/* \file
+
+ Fl_XPM_Image class . */
+
#ifndef Fl_XPM_Image_H
#define Fl_XPM_Image_H
# include "Fl_Pixmap.H"
+/**
+ The Fl_XPM_Image class supports loading, caching,
+ and drawing of X Pixmap (XPM) images, including transparency.
+*/
class FL_EXPORT Fl_XPM_Image : public Fl_Pixmap {
public:
@@ -39,5 +47,5 @@ class FL_EXPORT Fl_XPM_Image : public Fl_Pixmap {
#endif // !Fl_XPM_Image
//
-// End of "$Id: Fl_XPM_Image.H 4288 2005-04-16 00:13:17Z mike $".
+// End of "$Id: Fl_XPM_Image.H 6614 2009-01-01 16:11:32Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Xutf8.h b/plugins/zynaddsubfx/fltk/FL/Xutf8.h
new file mode 100644
index 000000000..f8815287b
--- /dev/null
+++ b/plugins/zynaddsubfx/fltk/FL/Xutf8.h
@@ -0,0 +1,176 @@
+/* "$Id: $"
+ *
+ * Author: Jean-Marc Lienher ( http://oksid.ch )
+ * Copyright 2000-2003 by O'ksi'D.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA.
+ *
+ * Please report all bugs and problems on the following page:
+ *
+ * http://www.fltk.org/str.php
+ */
+
+#ifndef _Xutf8_h
+#define _Xutf8_h
+
+# ifdef __cplusplus
+extern "C" {
+# endif
+
+#include
+#include
+#include
+#include
+
+typedef struct {
+ int nb_font;
+ char **font_name_list;
+ int *encodings;
+ XFontStruct **fonts;
+ Font fid;
+ int ascent;
+ int descent;
+ int *ranges;
+} XUtf8FontStruct;
+
+XUtf8FontStruct *
+XCreateUtf8FontStruct (
+ Display *dpy,
+ const char *base_font_name_list);
+
+void
+XUtf8DrawString(
+ Display *display,
+ Drawable d,
+ XUtf8FontStruct *font_set,
+ GC gc,
+ int x,
+ int y,
+ const char *string,
+ int num_bytes);
+
+void
+XUtf8DrawRtlString(
+ Display *display,
+ Drawable d,
+ XUtf8FontStruct *font_set,
+ GC gc,
+ int x,
+ int y,
+ const char *string,
+ int num_bytes);
+
+void
+XUtf8DrawImageString(
+ Display *display,
+ Drawable d,
+ XUtf8FontStruct *font_set,
+ GC gc,
+ int x,
+ int y,
+ const char *string,
+ int num_bytes);
+
+int
+XUtf8TextWidth(
+ XUtf8FontStruct *font_set,
+ const char *string,
+ int num_bytes);
+int
+XUtf8UcsWidth(
+ XUtf8FontStruct *font_set,
+ unsigned int ucs);
+
+int
+XGetUtf8FontAndGlyph(
+ XUtf8FontStruct *font_set,
+ unsigned int ucs,
+ XFontStruct **fnt,
+ unsigned short *id);
+
+void
+XFreeUtf8FontStruct(
+ Display *dpy,
+ XUtf8FontStruct *font_set);
+
+
+int
+XConvertUtf8ToUcs(
+ const unsigned char *buf,
+ int len,
+ unsigned int *ucs);
+
+int
+XConvertUcsToUtf8(
+ unsigned int ucs,
+ char *buf);
+
+int
+XUtf8CharByteLen(
+ const unsigned char *buf,
+ int len);
+
+int
+XCountUtf8Char(
+ const unsigned char *buf,
+ int len);
+
+int
+XFastConvertUtf8ToUcs(
+ const unsigned char *buf,
+ int len,
+ unsigned int *ucs);
+
+long
+XKeysymToUcs(
+ KeySym keysym);
+
+int
+XUtf8LookupString(
+ XIC ic,
+ XKeyPressedEvent* event,
+ char* buffer_return,
+ int bytes_buffer,
+ KeySym* keysym,
+ Status* status_return);
+
+unsigned short
+XUtf8IsNonSpacing(
+ unsigned int ucs);
+
+unsigned short
+XUtf8IsRightToLeft(
+ unsigned int ucs);
+
+
+int
+XUtf8Tolower(
+ int ucs);
+
+int
+XUtf8Toupper(
+ int ucs);
+
+
+# ifdef __cplusplus
+}
+# endif
+
+#endif
+
+/*
+ * End of "$Id: $".
+ */
diff --git a/plugins/zynaddsubfx/fltk/FL/dirent.h b/plugins/zynaddsubfx/fltk/FL/dirent.h
index 59a925cc3..5261b2c52 100644
--- a/plugins/zynaddsubfx/fltk/FL/dirent.h
+++ b/plugins/zynaddsubfx/fltk/FL/dirent.h
@@ -1,9 +1,9 @@
//
-// "$Id: dirent.h 4288 2005-04-16 00:13:17Z mike $"
+// "$Id: dirent.h 6614 2009-01-01 16:11:32Z matt $"
//
// Directory header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -29,5 +29,5 @@
#include "filename.H"
//
-// End of "$Id: dirent.h 4288 2005-04-16 00:13:17Z mike $".
+// End of "$Id: dirent.h 6614 2009-01-01 16:11:32Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/filename.H b/plugins/zynaddsubfx/fltk/FL/filename.H
index daf5e32b2..e70e3dac3 100644
--- a/plugins/zynaddsubfx/fltk/FL/filename.H
+++ b/plugins/zynaddsubfx/fltk/FL/filename.H
@@ -1,9 +1,9 @@
/*
- * "$Id: filename.H 5635 2007-01-23 15:02:00Z mike $"
+ * "$Id: filename.H 6716 2009-03-24 01:40:44Z fabien $"
*
* Filename header file for the Fast Light Tool Kit (FLTK).
*
- * Copyright 1998-2005 by Bill Spitzak and others.
+ * Copyright 1998-2009 by Bill Spitzak and others.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -30,9 +30,12 @@
# include "Fl_Export.H"
-# define FL_PATH_MAX 256 /* all buffers are this length */
+/** \addtogroup filenames File names and URI utility functions
+ @{ */
-FL_EXPORT const char *fl_filename_name(const char *);
+# define FL_PATH_MAX 256 /**< all path buffers should use this length */
+/** Gets the file name from a path. \return a pointer to the char after the last slash, or to \p filename if there is none. */
+FL_EXPORT const char *fl_filename_name(const char * filename);
FL_EXPORT const char *fl_filename_ext(const char *);
FL_EXPORT char *fl_filename_setext(char *to, int tolen, const char *ext);
FL_EXPORT int fl_filename_expand(char *to, int tolen, const char *from);
@@ -41,7 +44,7 @@ FL_EXPORT int fl_filename_relative(char *to, int tolen, const char *from);
FL_EXPORT int fl_filename_match(const char *name, const char *pattern);
FL_EXPORT int fl_filename_isdir(const char *name);
-# ifdef __cplusplus
+# if defined(__cplusplus) && !defined(FL_DOXYGEN)
/*
* Under WIN32, we include filename.H from numericsort.c; this should probably change...
*/
@@ -91,18 +94,20 @@ struct dirent {char d_name[1];};
# include
# endif
-# ifdef __cplusplus
+# if defined (__cplusplus)
extern "C" {
# endif /* __cplusplus */
+# if !defined(FL_DOXYGEN)
FL_EXPORT int fl_alphasort(struct dirent **, struct dirent **);
FL_EXPORT int fl_casealphasort(struct dirent **, struct dirent **);
FL_EXPORT int fl_casenumericsort(struct dirent **, struct dirent **);
FL_EXPORT int fl_numericsort(struct dirent **, struct dirent **);
+# endif
-typedef int (Fl_File_Sort_F)(struct dirent **, struct dirent **);
+ typedef int (Fl_File_Sort_F)(struct dirent **, struct dirent **); /**< File sorting function. \see fl_filename_list() */
-# ifdef __cplusplus
+# if defined(__cplusplus)
}
/*
@@ -120,6 +125,7 @@ FL_EXPORT int fl_filename_list(const char *d, struct dirent ***l,
FL_EXPORT int fl_open_uri(const char *uri, char *msg = (char *)0,
int msglen = 0);
+# ifndef FL_DOXYGEN
/*
* _fl_filename_isdir_quick() is a private function that checks for a
* trailing slash and assumes that the passed name is a directory if
@@ -128,6 +134,7 @@ FL_EXPORT int fl_open_uri(const char *uri, char *msg = (char *)0,
* outside of FLTK...
*/
int _fl_filename_isdir_quick(const char *name);
+# endif
# endif /* __cplusplus */
@@ -151,6 +158,8 @@ int _fl_filename_isdir_quick(const char *name);
#endif /* FL_FILENAME_H */
+/** @} */
+
/*
- * End of "$Id: filename.H 5635 2007-01-23 15:02:00Z mike $".
+ * End of "$Id: filename.H 6716 2009-03-24 01:40:44Z fabien $".
*/
diff --git a/plugins/zynaddsubfx/fltk/FL/fl_ask.H b/plugins/zynaddsubfx/fltk/FL/fl_ask.H
index f237af11d..f9a245748 100644
--- a/plugins/zynaddsubfx/fltk/FL/fl_ask.H
+++ b/plugins/zynaddsubfx/fltk/FL/fl_ask.H
@@ -1,9 +1,9 @@
//
-// "$Id: fl_ask.H 4279 2005-04-13 19:35:28Z mike $"
+// "$Id: fl_ask.H 6614 2009-01-01 16:11:32Z matt $"
//
// Standard dialog header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -31,7 +31,7 @@
# include "Enumerations.H"
class Fl_Widget;
-
+/** Different system beeps available. \relatesalso fl_beep(int) */
enum {
FL_BEEP_DEFAULT = 0,
FL_BEEP_MESSAGE,
@@ -63,9 +63,9 @@ FL_EXPORT const char *fl_password(const char *label, const char *deflt = 0, ...)
FL_EXPORT Fl_Widget *fl_message_icon();
extern FL_EXPORT Fl_Font fl_message_font_;
-extern FL_EXPORT unsigned char fl_message_size_;
-inline void fl_message_font(unsigned char f,unsigned char s) {
- fl_message_font_ = (Fl_Font)f; fl_message_size_ = s;}
+extern FL_EXPORT Fl_Fontsize fl_message_size_;
+inline void fl_message_font(Fl_Font f, Fl_Fontsize s) {
+ fl_message_font_ = f; fl_message_size_ = s;}
// pointers you can use to change FLTK to a foreign language:
extern FL_EXPORT const char* fl_no;
@@ -73,9 +73,8 @@ extern FL_EXPORT const char* fl_yes;
extern FL_EXPORT const char* fl_ok;
extern FL_EXPORT const char* fl_cancel;
extern FL_EXPORT const char* fl_close;
-
#endif // !fl_ask_H
//
-// End of "$Id: fl_ask.H 4279 2005-04-13 19:35:28Z mike $".
+// End of "$Id: fl_ask.H 6614 2009-01-01 16:11:32Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/fl_draw.H b/plugins/zynaddsubfx/fltk/FL/fl_draw.H
index c752795c5..fab90b477 100644
--- a/plugins/zynaddsubfx/fltk/FL/fl_draw.H
+++ b/plugins/zynaddsubfx/fltk/FL/fl_draw.H
@@ -1,9 +1,9 @@
//
-// "$Id: fl_draw.H 5430 2006-09-15 15:35:16Z matt $"
+// "$Id: fl_draw.H 6779 2009-04-24 09:28:30Z yuri $"
//
// Portable drawing function header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,10 +25,16 @@
// http://www.fltk.org/str.php
//
+/**
+ \file fl_draw.H
+ \brief utility header to pull drawing functions together
+*/
+
#ifndef fl_draw_H
#define fl_draw_H
#include "Enumerations.H" // for the color names
+#include "Fl_Window.H" // for fl_set_spot()
// Image class...
class Fl_Image;
@@ -36,15 +42,28 @@ class Fl_Image;
// Label flags...
FL_EXPORT extern char fl_draw_shortcut;
+/** \addtogroup fl_attributes
+ @{
+*/
// Colors:
-FL_EXPORT void fl_color(Fl_Color); // select indexed color
-inline void fl_color(int c) {fl_color((Fl_Color)c);} // for back compatability
-FL_EXPORT void fl_color(uchar, uchar, uchar); // select actual color
+FL_EXPORT void fl_color(Fl_Color i); // select indexed color
+/** for back compatibility - use fl_color(Fl_Color c) instead */
+inline void fl_color(int c) {fl_color((Fl_Color)c);}
+FL_EXPORT void fl_color(uchar r, uchar g, uchar b); // select actual color
extern FL_EXPORT Fl_Color fl_color_;
+/**
+ Returns the last fl_color() that was set.
+ This can be used for state save/restore.
+*/
inline Fl_Color fl_color() {return fl_color_;}
+/** @} */
+/** \addtogroup fl_drawings
+ @{
+*/
// clip:
FL_EXPORT void fl_push_clip(int x, int y, int w, int h);
+/** The fl_clip() name is deprecated and will be removed from future releases */
#define fl_clip fl_push_clip
FL_EXPORT void fl_push_no_clip();
FL_EXPORT void fl_pop_clip();
@@ -57,38 +76,49 @@ FL_EXPORT void fl_point(int x, int y);
// line type:
FL_EXPORT void fl_line_style(int style, int width=0, char* dashes=0);
enum {
- FL_SOLID = 0,
- FL_DASH = 1,
- FL_DOT = 2,
- FL_DASHDOT = 3,
- FL_DASHDOTDOT = 4,
+ FL_SOLID = 0, ///< line style: ___________
+ FL_DASH = 1, ///< line style: _ _ _ _ _ _
+ FL_DOT = 2, ///< line style: . . . . . .
+ FL_DASHDOT = 3, ///< line style: _ . _ . _ .
+ FL_DASHDOTDOT = 4, ///< line style: _ . . _ . .
- FL_CAP_FLAT = 0x100,
- FL_CAP_ROUND = 0x200,
- FL_CAP_SQUARE = 0x300,
+ FL_CAP_FLAT = 0x100, ///< cap style: end is flat
+ FL_CAP_ROUND = 0x200, ///< cap style: end is round
+ FL_CAP_SQUARE = 0x300, ///< cap style: end wraps end point
- FL_JOIN_MITER = 0x1000,
- FL_JOIN_ROUND = 0x2000,
- FL_JOIN_BEVEL = 0x3000
+ FL_JOIN_MITER = 0x1000, ///< join style: line join extends to a point
+ FL_JOIN_ROUND = 0x2000, ///< join style: line join is rounded
+ FL_JOIN_BEVEL = 0x3000 ///< join style: line join is tidied
};
// rectangles tweaked to exactly fill the pixel rectangle:
FL_EXPORT void fl_rect(int x, int y, int w, int h);
+/** Draws a 1-pixel border \e inside the given bounding box */
inline void fl_rect(int x, int y, int w, int h, Fl_Color c) {fl_color(c); fl_rect(x,y,w,h);}
FL_EXPORT void fl_rectf(int x, int y, int w, int h);
+/** Colors a rectangle that exactly fills the given bounding box */
inline void fl_rectf(int x, int y, int w, int h, Fl_Color c) {fl_color(c); fl_rectf(x,y,w,h);}
+/**
+ Color a rectangle with "exactly" the passed r,g,b color.
+ On screens with less than 24 bits of color this is done by drawing a
+ solid-colored block using fl_draw_image() so that the correct color
+ shade is produced.
+ */
+/* note: doxygen comment here to avoid triplication in os-speciic files */
+FL_EXPORT void fl_rectf(int x, int y, int w, int h, uchar r, uchar g, uchar b);
+
// line segments:
-FL_EXPORT void fl_line(int,int, int,int);
-FL_EXPORT void fl_line(int,int, int,int, int,int);
+FL_EXPORT void fl_line(int x, int y, int x1, int y1);
+FL_EXPORT void fl_line(int x, int y, int x1, int y1, int x2, int y2);
// closed line segments:
-FL_EXPORT void fl_loop(int,int, int,int, int,int);
-FL_EXPORT void fl_loop(int,int, int,int, int,int, int,int);
+FL_EXPORT void fl_loop(int x, int y, int x1, int y1, int x2, int y2);
+FL_EXPORT void fl_loop(int x, int y, int x1, int y1, int x2, int y2, int x3, int y3);
// filled polygons
-FL_EXPORT void fl_polygon(int,int, int,int, int,int);
-FL_EXPORT void fl_polygon(int,int, int,int, int,int, int,int);
+FL_EXPORT void fl_polygon(int x, int y, int x1, int y1, int x2, int y2);
+FL_EXPORT void fl_polygon(int x, int y, int x1, int y1, int x2, int y2, int x3, int y3);
// draw rectilinear lines, horizontal segment first:
FL_EXPORT void fl_xyline(int x, int y, int x1);
@@ -103,6 +133,7 @@ FL_EXPORT void fl_yxline(int x, int y, int y1, int x2, int y3);
// circular lines and pie slices (code in fl_arci.C):
FL_EXPORT void fl_arc(int x, int y, int w, int h, double a1, double a2);
FL_EXPORT void fl_pie(int x, int y, int w, int h, double a1, double a2);
+/** fl_chord declaration is a place holder - the function does not yet exist */
FL_EXPORT void fl_chord(int x, int y, int w, int h, double a1, double a2); // nyi
// scalable drawing code (code in fl_vertex.C and fl_arc.C):
@@ -118,7 +149,7 @@ FL_EXPORT void fl_begin_line();
FL_EXPORT void fl_begin_loop();
FL_EXPORT void fl_begin_polygon();
FL_EXPORT void fl_vertex(double x, double y);
-FL_EXPORT void fl_curve(double, double, double, double, double, double, double, double);
+FL_EXPORT void fl_curve(double X0, double Y0, double X1, double Y1, double X2, double Y2, double X3, double Y3);
FL_EXPORT void fl_arc(double x, double y, double r, double start, double a);
FL_EXPORT void fl_circle(double x, double y, double r);
FL_EXPORT void fl_end_points();
@@ -134,37 +165,154 @@ FL_EXPORT double fl_transform_y(double x, double y);
FL_EXPORT double fl_transform_dx(double x, double y);
FL_EXPORT double fl_transform_dy(double x, double y);
FL_EXPORT void fl_transformed_vertex(double x, double y);
+/** @} */
-// current font:
-FL_EXPORT void fl_font(int face, int size);
-extern FL_EXPORT int fl_font_;
-inline int fl_font() {return fl_font_;}
-extern FL_EXPORT int fl_size_;
-inline int fl_size() {return fl_size_;}
+/** \addtogroup fl_attributes
+ @{ */
+/* NOTE: doxygen comments here to avoid triplication in os-specific sources */
+/**
+ Sets the current font, which is then used in various drawing routines.
+ You may call this outside a draw context if necessary to call fl_width(),
+ but on X this will open the display.
+
+ The font is identified by a \p face and a \p size.
+ The size of the font is measured in pixels and not "points".
+ Lines should be spaced \p size pixels apart or more.
+*/
+
+// Fonts:
+FL_EXPORT void fl_font(Fl_Font face, Fl_Fontsize size);
+extern FL_EXPORT Fl_Font fl_font_; ///< current font index
+
+/**
+ Returns the \p face set by the most recent call to fl_font().
+ This can be used to save/restore the font.
+*/
+inline Fl_Font fl_font() {return fl_font_;}
+/** current font size */
+extern FL_EXPORT Fl_Fontsize fl_size_;
+/**
+ Returns the \p size set by the most recent call to fl_font().
+ This can be used to save/restore the font.
+*/
+inline Fl_Fontsize fl_size() {return fl_size_;}
// information you can get about the current font:
+/**
+ Returns the recommended minimum line spacing for the current font.
+ You can also use the value of \p size passed to fl_font()
+*/
FL_EXPORT int fl_height(); // using "size" should work ok
-inline int fl_height(int, int size) {return size;}
-FL_EXPORT int fl_descent();
-FL_EXPORT double fl_width(const char*);
-FL_EXPORT double fl_width(const char*, int n);
-FL_EXPORT double fl_width(uchar);
+/**
+ Dummy passthru function called only in Fl_Text_Display that simply returns
+ the font height as given by the \p size parameter in the same call!
-// draw using current font:
-FL_EXPORT void fl_draw(const char*, int x, int y);
-FL_EXPORT void fl_draw(const char*, int n, int x, int y);
-FL_EXPORT void fl_measure(const char*, int& x, int& y, int draw_symbols = 1);
-FL_EXPORT void fl_draw(const char*, int,int,int,int, Fl_Align, Fl_Image* img=0,
- int draw_symbols = 1);
-FL_EXPORT void fl_draw(const char*, int,int,int,int, Fl_Align,
- void (*callthis)(const char *, int n, int x, int y),
- Fl_Image* img=0, int draw_symbols = 1);
+ \todo Is fl_height(int, int size) required for Fl_Text_Dispay?
+ Why not use \p size parameter directly?
+*/
+inline int fl_height(int, int size) {return size;}
+/**
+ Returns the recommended distance above the bottom of a fl_height() tall box to
+ draw the text at so it looks centered vertically in that box.
+*/
+FL_EXPORT int fl_descent();
+/** Return the typographical width of a nul-terminated string */
+FL_EXPORT double fl_width(const char* txt);
+/** Return the typographical width of a sequence of \p n characters */
+FL_EXPORT double fl_width(const char* txt, int n);
+/** Return the typographical width of a single character :
+ \note if a valid fl_gc is NOT found then it uses the first window gc,
+ or the screen gc if no fltk window is available when called. */
+FL_EXPORT double fl_width(Fl_Char);
+/** Determine the minimum pixel dimensions of a nul-terminated string.
+
+Usage: given a string "txt" drawn using fl_draw(txt, x, y) you would determine
+its pixel extents on the display using fl_text_extents(txt, dx, dy, wo, ho)
+such that a bounding box that exactly fits around the text could be drawn with
+fl_rect(x+dx, y+dy, wo, ho). Note the dx, dy values hold the offset of the first
+"colored in" pixel of the string, from the draw origin.
+*/
+FL_EXPORT void fl_text_extents(const char*, int& dx, int& dy, int& w, int& h); // NO fltk symbol expansion will be performed
+/** Determine the minimum pixel dimensions of a sequence of \p n characters.
+\see fl_text_extents(const char*, int& dx, int& dy, int& w, int& h)
+*/
+FL_EXPORT void fl_text_extents(const char*, int n, int& dx, int& dy, int& w, int& h);
// font encoding:
-FL_EXPORT const char *fl_latin1_to_local(const char *, int n=-1);
-FL_EXPORT const char *fl_local_to_latin1(const char *, int n=-1);
-FL_EXPORT const char *fl_mac_roman_to_local(const char *, int n=-1);
-FL_EXPORT const char *fl_local_to_mac_roman(const char *, int n=-1);
+// Note: doxygen comments here to avoid duplication for os-sepecific cases
+/**
+ convert text from Windows/X11 latin1 charcter set to local encoding.
+ \param[in] t character string (latin1 encoding)
+ \param[in] n optional number of characters to convert (default is all)
+ \returns pointer to internal buffer containing converted characters
+ */
+FL_EXPORT const char *fl_latin1_to_local(const char *t, int n=-1);
+/**
+ convert text from local encoding to Windowx/X11 latin1 character set.
+ \param[in] t character string (local encoding)
+ \param[in] n optional number of characters to convert (default is all)
+ \returns pointer to internal buffer containing converted characters
+ */
+FL_EXPORT const char *fl_local_to_latin1(const char *t, int n=-1);
+/**
+ convert text from Mac Roman charcter set to local encoding.
+ \param[in] t character string (Mac Roman encoding)
+ \param[in] n optional number of characters to convert (default is all)
+ \returns pointer to internal buffer containing converted characters
+ */
+FL_EXPORT const char *fl_mac_roman_to_local(const char *t, int n=-1);
+/**
+ convert text from local encoding to Mac Roman character set.
+ \param[in] t character string (local encoding)
+ \param[in] n optional number of characters to convert (default is all)
+ \returns pointer to internal buffer containing converted characters
+ */
+FL_EXPORT const char *fl_local_to_mac_roman(const char *t, int n=-1);
+/** @} */
+
+/** \addtogroup fl_drawings
+ @{ */
+/**
+ Draws a nul-terminated string starting at the given location.
+
+ Text is aligned to the left and to the baseline of the font.
+ To align to the bottom, subtract fl_descent() from \p y.
+ To align to the top, subtract fl_descent() and add fl_height().
+ This version of fl_draw provides direct access to the text drawing
+ function of the underlying OS. It does not apply any special handling
+ to control characters.
+*/
+FL_EXPORT void fl_draw(const char* str, int x, int y);
+/**
+ Draws a nul-terminated string starting at the given location and
+ rotating \p angle degrees counterclockwise.
+ This version of fl_draw provides direct access to the text drawing
+ function of the underlying OS and suported for Xft, Win32 and MacOS
+ fltk subset.
+*/
+FL_EXPORT void fl_draw(int angle,const char* str, int x, int y);
+/**
+ Draws an array of \p n characters starting at the given location.
+*/
+FL_EXPORT void fl_draw(const char* str, int n, int x, int y);
+/**
+ Draws an array of \p n characters starting at the given location,
+ rotating \p angle degrees counterclockwise.
+*/
+FL_EXPORT void fl_draw(int angle,const char* str, int n, int x, int y);
+/**
+ Draws an array of \p n characters right to left starting at given location.
+*/
+FL_EXPORT void fl_rtl_draw(const char*, int n, int x, int y);
+FL_EXPORT void fl_measure(const char* str, int& x, int& y,
+ int draw_symbols = 1);
+FL_EXPORT void fl_draw(const char* str, int x, int y, int w, int h,
+ Fl_Align align,
+ Fl_Image* img=0, int draw_symbols = 1);
+FL_EXPORT void fl_draw(const char* str, int x, int y, int w, int h,
+ Fl_Align align,
+ void (*callthis)(const char *,int,int,int),
+ Fl_Image* img=0, int draw_symbols = 1);
// boxtypes:
FL_EXPORT void fl_frame(const char* s, int x, int y, int w, int h);
@@ -172,36 +320,160 @@ FL_EXPORT void fl_frame2(const char* s, int x, int y, int w, int h);
FL_EXPORT void fl_draw_box(Fl_Boxtype, int x, int y, int w, int h, Fl_Color);
// images:
-FL_EXPORT void fl_draw_image(const uchar*, int,int,int,int, int delta=3, int ldelta=0);
-FL_EXPORT void fl_draw_image_mono(const uchar*, int,int,int,int, int delta=1, int ld=0);
-typedef void (*Fl_Draw_Image_Cb)(void*,int,int,int,uchar*);
-FL_EXPORT void fl_draw_image(Fl_Draw_Image_Cb, void*, int,int,int,int, int delta=3);
-FL_EXPORT void fl_draw_image_mono(Fl_Draw_Image_Cb, void*, int,int,int,int, int delta=1);
-FL_EXPORT void fl_rectf(int x, int y, int w, int h, uchar r, uchar g, uchar b);
+/**
+ signature of image generation callback function.
+ \param[in] data user data passed to function
+ \param[in] x,y,w position and width of scan line in image
+ \param[out] buf buffer for generated image data. You must copy \p w
+ pixels from scanline \p y, starting at pixel \p x
+ to this buffer.
+ */
+typedef void (*Fl_Draw_Image_Cb)(void* data,int x,int y,int w,uchar* buf);
+
+/**
+ Draw an 8-bit per color RGB or luminance image.
+ \param[in] buf points at the "r" data of the top-left pixel.
+ Color data must be in r,g,b order.
+ \param[in] X,Y position where to put top-left corner of image
+ \param[in] W,H size of the image
+ \param[in] D delta to add to the pointer between pixels. it may be
+ any value greater than or equal to 3, or it can be
+ negative to flip the image horizontally
+ \param[in] L delta to add to the pointer between lines (if 0 is
+ passed it uses \p W * \p D), and may be larger than
+ \p W * \p D to crop data, or negative to flip the
+ image vertically
+
+ It is highly recommended that you put the following code before the
+ first show() of \e any window in your program to get rid of
+ the dithering if possible:
+ \code
+ Fl::visual(FL_RGB);
+ \endcode
+ Gray scale (1-channel) images may be drawn. This is done if
+ abs(D) is less than 3, or by calling fl_draw_image_mono().
+ Only one 8-bit sample is used for each pixel, and on screens with
+ different numbers of bits for red, green, and blue only gray colors
+ are used. Setting \p D greater than 1 will let you display one channel
+ of a color image.
+
+ \par Note:
+ The X version does not support all possible visuals. If FLTK cannot
+ draw the image in the current visual it will abort. FLTK supports
+ any visual of 8 bits or less, and all common TrueColor visuals up
+ to 32 bits.
+ */
+FL_EXPORT void fl_draw_image(const uchar* buf, int X,int Y,int W,int H, int D=3, int L=0);
+
+/**
+ Draw a gray-scale (1 channel) image.
+ \see fl_draw_image(const uchar* buf, int X,int Y,int W,int H, int D, int L)
+ */
+FL_EXPORT void fl_draw_image_mono(const uchar* buf, int X,int Y,int W,int H, int D=1, int L=0);
+
+/**
+ Draw image using callback function to generate image data.
+ You can generate the image as it is being drawn, or do arbitrary
+ decompression of stored data, provided it can be decompressed to
+ individual scan lines easily.
+ \param[in] cb callback function to generate scan line data
+ \param[in] data user data passed to callback function
+ \param[in] X,Y
+ \param[in] W,H
+ \param[in] D
+ \see fl_draw_image(const uchar* buf, int X,int Y,int W,int H, int D, int L)
+
+ The callback function \p cb is called with the void* \p data
+ user data pointer to allow access to a structure of information about
+ the image, and the \p x, \p y, and \p w of the scan line desired from
+ the image. 0,0 is the upper-left corner of the image, not \p X, \p Y.
+ A pointer to a buffer to put the data into is passed. You must copy
+ \p w pixels from scanline \p y, starting at pixel \p x, to this buffer.
+
+ Due to cropping, less than the whole image may be requested. So \p x
+ may be greater than zero, the first \p y may be greater than zero,
+ and \p w may be less than \p W. The buffer is long enough to store
+ the entire \p W * \p D pixels, this is for convenience with some
+ decompression schemes where you must decompress the entire line at
+ once: decompress it into the buffer, and then if \p x is not zero,
+ copy the data over so the \p x'th pixel is at the start of the buffer.
+
+ You can assume the \p y's will be consecutive, except the first one
+ may be greater than zero.
+
+ If \p D is 4 or more, you must fill in the unused bytes with zero.
+ */
+FL_EXPORT void fl_draw_image(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D=3);
+
+/**
+ Draw gray-scale image using callback function to generate image data.
+ \see fl_draw_image(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D)
+ */
+FL_EXPORT void fl_draw_image_mono(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D=1);
+
+/**
+ Checks whether platform supports true alpha blending for RGBA images.
+ \returns 1 if true alpha blending supported by platform
+ \returns 0 not supported so FLTK will use screen door transparency
+ */
+/* note: doxygen comment here to avoid triplication in os-speciic files */
FL_EXPORT char fl_can_do_alpha_blending();
-FL_EXPORT uchar *fl_read_image(uchar *p, int x,int y, int w, int h, int alpha=0);
+/**
+ Read an RGB(A) image from the current window or off-screen buffer.
+ \param[in] p pixel buffer, or NULL to allocate one
+ \param[in] X,Y position of top-left of image to read
+ \param[in] W,H width and height of image to read
+ \param[in] alpha alpha value for image (0 fr none)
+ \returns pointer to pixel buffer, or NULL if allocation failed.
+
+ The \p p argument points to a buffer that can hold the image and must
+ be at least \p W*H*3 bytes when reading RGB images, or \p W*H*4 bytes
+ when reading RGBA images. If NULL, fl_read_image() will create an
+ array of the proper suze which can be freed using delete[].
+
+ The \p alpha parameter controls whether an alpha channel is created
+ and the value that is placed in the alpha channel. If 0, no alpha
+ channel is generated.
+ */
+/* note: doxygen comment here to avoid triplication in os-speciic files */
+FL_EXPORT uchar *fl_read_image(uchar *p,int X,int Y,int W,int H,int alpha=0);
// pixmaps:
FL_EXPORT int fl_draw_pixmap(/*const*/ char* const* data, int x,int y,Fl_Color=FL_GRAY);
+FL_EXPORT int fl_draw_pixmap(const char* const* cdata, int x,int y,Fl_Color=FL_GRAY);
FL_EXPORT int fl_measure_pixmap(/*const*/ char* const* data, int &w, int &h);
-FL_EXPORT int fl_draw_pixmap(const char* const* data, int x,int y,Fl_Color=FL_GRAY);
-FL_EXPORT int fl_measure_pixmap(const char* const* data, int &w, int &h);
+FL_EXPORT int fl_measure_pixmap(const char* const* cdata, int &w, int &h);
// other:
FL_EXPORT void fl_scroll(int X, int Y, int W, int H, int dx, int dy,
void (*draw_area)(void*, int,int,int,int), void* data);
-FL_EXPORT const char* fl_shortcut_label(int);
-FL_EXPORT void fl_overlay_rect(int,int,int,int);
+FL_EXPORT const char* fl_shortcut_label(int shortcut);
+FL_EXPORT const char* fl_shortcut_label(int shortcuti, const char **eom);
+FL_EXPORT void fl_overlay_rect(int x,int y,int w,int h);
FL_EXPORT void fl_overlay_clear();
-FL_EXPORT void fl_cursor(Fl_Cursor, Fl_Color=FL_BLACK, Fl_Color=FL_WHITE);
+FL_EXPORT void fl_cursor(Fl_Cursor, Fl_Color fg=FL_BLACK, Fl_Color bg=FL_WHITE);
+FL_EXPORT const char* fl_expand_text(const char* from, char* buf, int maxbuf,
+ double maxw, int& n, double &width,
+ int wrap, int draw_symbols = 0);
+
+// XIM:
+/** \todo provide user documentation for fl_set_status function */
+FL_EXPORT void fl_set_status(int X, int Y, int W, int H);
+/** \todo provide user documentation for fl_set_spot function */
+FL_EXPORT void fl_set_spot(int font, int size, int X, int Y, int W, int H, Fl_Window *win=0);
+/** \todo provide user documentation for fl_reset_spot function*/
+FL_EXPORT void fl_reset_spot(void);
+
+
// XForms symbols:
FL_EXPORT int fl_draw_symbol(const char* label,int x,int y,int w,int h, Fl_Color);
FL_EXPORT int fl_add_symbol(const char* name, void (*drawit)(Fl_Color), int scalable);
+/** @} */
#endif
//
-// End of "$Id: fl_draw.H 5430 2006-09-15 15:35:16Z matt $".
+// End of "$Id: fl_draw.H 6779 2009-04-24 09:28:30Z yuri $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/fl_message.H b/plugins/zynaddsubfx/fltk/FL/fl_message.H
index dd66272ee..bb64474e1 100644
--- a/plugins/zynaddsubfx/fltk/FL/fl_message.H
+++ b/plugins/zynaddsubfx/fltk/FL/fl_message.H
@@ -1,9 +1,9 @@
//
-// "$Id: fl_message.H 4288 2005-04-16 00:13:17Z mike $"
+// "$Id: fl_message.H 6614 2009-01-01 16:11:32Z matt $"
//
// Standard message header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -28,5 +28,5 @@
#include "fl_ask.H"
//
-// End of "$Id: fl_message.H 4288 2005-04-16 00:13:17Z mike $".
+// End of "$Id: fl_message.H 6614 2009-01-01 16:11:32Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/fl_show_colormap.H b/plugins/zynaddsubfx/fltk/FL/fl_show_colormap.H
index baaa2b708..f72fc5176 100644
--- a/plugins/zynaddsubfx/fltk/FL/fl_show_colormap.H
+++ b/plugins/zynaddsubfx/fltk/FL/fl_show_colormap.H
@@ -1,9 +1,9 @@
//
-// "$Id: fl_show_colormap.H 4288 2005-04-16 00:13:17Z mike $"
+// "$Id: fl_show_colormap.H 6614 2009-01-01 16:11:32Z matt $"
//
// Colormap picker header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -33,5 +33,5 @@ FL_EXPORT Fl_Color fl_show_colormap(Fl_Color oldcol);
#endif
//
-// End of "$Id: fl_show_colormap.H 4288 2005-04-16 00:13:17Z mike $".
+// End of "$Id: fl_show_colormap.H 6614 2009-01-01 16:11:32Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/fl_show_input.H b/plugins/zynaddsubfx/fltk/FL/fl_show_input.H
index 3773f99ac..268c3d168 100644
--- a/plugins/zynaddsubfx/fltk/FL/fl_show_input.H
+++ b/plugins/zynaddsubfx/fltk/FL/fl_show_input.H
@@ -1,9 +1,9 @@
//
-// "$Id: fl_show_input.H 4288 2005-04-16 00:13:17Z mike $"
+// "$Id: fl_show_input.H 6614 2009-01-01 16:11:32Z matt $"
//
// Standard input dialog header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -28,5 +28,5 @@
#include "fl_ask.H"
//
-// End of "$Id: fl_show_input.H 4288 2005-04-16 00:13:17Z mike $".
+// End of "$Id: fl_show_input.H 6614 2009-01-01 16:11:32Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/fl_types.h b/plugins/zynaddsubfx/fltk/FL/fl_types.h
new file mode 100644
index 000000000..e676a621e
--- /dev/null
+++ b/plugins/zynaddsubfx/fltk/FL/fl_types.h
@@ -0,0 +1,63 @@
+/*
+ * "$Id: fl_types.h 6299 2008-09-18 19:09:34Z fabien $"
+ *
+ * Simple "C"-style types for the Fast Light Tool Kit (FLTK).
+ *
+ * Copyright 1998-2009 by Bill Spitzak and others.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA.
+ *
+ * Please report all bugs and problems on the following page:
+ *
+ * http://www.fltk.org/str.php
+ */
+
+/** \file
+ * This file contains simple "C"-style type definitions.
+ */
+
+#ifndef FL_TYPES_H
+#define FL_TYPES_H
+
+/** \name Miscellaneous */
+/*@{*/ /* group: Miscellaneous */
+
+/** unsigned char */
+typedef unsigned char uchar;
+/** unsigned long */
+typedef unsigned long ulong;
+
+/** Flexible length utf8 Unicode text
+ *
+ * \todo FIXME: temporary (?) typedef to mark UTF8 and Unicode conversions
+ */
+typedef char *Fl_String;
+
+/** Flexible length utf8 Unicode read-only string
+ * \sa Fl_String
+ */
+typedef const char *Fl_CString;
+
+/** 24-bit Unicode character + 8-bit indicator for keyboard flags */
+typedef unsigned int Fl_Char;
+
+/*@}*/ /* group: Miscellaneous */
+
+#endif
+
+/*
+ * End of "$Id: fl_types.h 6299 2008-09-18 19:09:34Z fabien $".
+ */
diff --git a/plugins/zynaddsubfx/fltk/FL/fl_utf8.h b/plugins/zynaddsubfx/fltk/FL/fl_utf8.h
new file mode 100644
index 000000000..e7bc9010a
--- /dev/null
+++ b/plugins/zynaddsubfx/fltk/FL/fl_utf8.h
@@ -0,0 +1,250 @@
+/* "$Id: $"
+ *
+ * Author: Jean-Marc Lienher ( http://oksid.ch )
+ * Copyright 2000-2009 by O'ksi'D.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA.
+ *
+ * Please report all bugs and problems on the following page:
+ *
+ * http://www.fltk.org/str.php
+ */
+
+/* Merged in some functionality from the fltk-2 version. IMM.
+ * The following code is an attempt to merge the functions incorporated in FLTK2
+ * with the functions provided in OksiD's fltk-1.1.6-utf8 port
+ */
+
+/*** NOTE : all functions are LIMITED to 24 bits Unicode values !!! ***/
+
+/**
+ \file fl_utf8.h
+ \brief header for Unicode and UTF8 chracter handling
+*/
+
+#ifndef _HAVE_FL_UTF8_HDR_
+#define _HAVE_FL_UTF8_HDR_
+
+#include "FL/Fl_Export.H"
+#include "FL/fl_types.h"
+
+#include
+#include
+#include
+
+#ifdef WIN32
+# include
+# include
+# include
+# include
+# define xchar wchar_t
+# if !defined(FL_DLL) && !defined(__CYGWIN__)
+# undef strdup
+# define strdup _strdup
+# undef putenv
+# define putenv _putenv
+# undef stricmp
+# define stricmp _stricmp
+# undef strnicmp
+# define strnicmp _strnicmp
+# undef hypot
+# define hypot _hypot
+# undef chdir
+# define chdir _chdir
+# endif
+#elif defined(__APPLE__)
+# include
+# include
+# define xchar wchar_t
+#else /* X11 */
+# include
+# include
+# include "Xutf8.h"
+# include
+# include
+# include
+# define xchar unsigned short
+#endif
+
+# ifdef __cplusplus
+extern "C" {
+# endif
+
+/** \addtogroup fl_unicode
+ @{
+*/
+
+/* F2: comes from FLTK2 */
+/* OD: comes from OksiD */
+
+/**
+ Return the number of bytes needed to encode the given UCS4 character in UTF8.
+ \param [in] ucs UCS4 encoded character
+ \return number of bytes required
+ */
+FL_EXPORT int fl_utf8bytes(unsigned ucs);
+
+/* OD: returns the byte length of the first UTF-8 char sequence (returns -1 if not valid) */
+FL_EXPORT int fl_utf8len(char c);
+
+/* OD: returns the number of Unicode chars in the UTF-8 string */
+FL_EXPORT int fl_utf_nb_char(const unsigned char *buf, int len);
+
+/* F2: Convert the next UTF8 char-sequence into a Unicode value (and say how many bytes were used) */
+FL_EXPORT unsigned fl_utf8decode(const char* p, const char* end, int* len);
+
+/* F2: Encode a Unicode value into a UTF8 sequence, return the number of bytes used */
+FL_EXPORT int fl_utf8encode(unsigned ucs, char* buf);
+
+/* F2: Move forward to the next valid UTF8 sequence start betwen start and end */
+FL_EXPORT const char* fl_utf8fwd(const char* p, const char* start, const char* end);
+
+/* F2: Move backward to the previous valid UTF8 sequence start */
+FL_EXPORT const char* fl_utf8back(const char* p, const char* start, const char* end);
+
+/* F2: Convert a UTF8 string into UTF16 */
+FL_EXPORT unsigned fl_utf8toUtf16(const char* src, unsigned srclen, unsigned short* dst, unsigned dstlen);
+
+/* F2: Convert a UTF8 string into a wide character string - makes UTF16 on win32, "UCS4" elsewhere */
+FL_EXPORT unsigned fl_utf8towc(const char *src, unsigned srclen, wchar_t *dst, unsigned dstlen);
+
+/* F2: Convert a wide character string to UTF8 - takes in UTF16 on win32, "UCS4" elsewhere */
+FL_EXPORT unsigned fl_utf8fromwc(char *dst, unsigned dstlen, const wchar_t *src, unsigned srclen);
+
+/* F2: Convert a UTF8 string into ASCII, eliding untranslatable glyphs */
+FL_EXPORT unsigned fl_utf8toa (const char *src, unsigned srclen, char *dst, unsigned dstlen);
+/* OD: convert UTF-8 string to latin1 */
+/* FL_EXPORT int fl_utf2latin1(const unsigned char *src, int srclen, char *dst); */
+
+/* F2: Convert 8859-1 string to UTF8 */
+FL_EXPORT unsigned fl_utf8froma (char *dst, unsigned dstlen, const char *src, unsigned srclen);
+/* OD: convert latin1 str to UTF-8 */
+/* FL_EXPORT int fl_latin12utf(const unsigned char *src, int srclen, char *dst); */
+
+/* F2: Returns true if the current O/S locale is UTF8 */
+FL_EXPORT int fl_utf8locale();
+
+/* F2: Examine the first len characters of src, to determine if the input text is UTF8 or not
+ * NOTE: The value returned is not simply boolean - it contains information about the probable
+ * type of the src text. */
+FL_EXPORT int fl_utf8test(const char *src, unsigned len);
+
+/* OD: Return true if the character is non-spacing */
+FL_EXPORT unsigned int fl_nonspacing(unsigned int ucs);
+
+/* F2: Convert UTF8 to a local multi-byte encoding - mainly for win32? */
+FL_EXPORT unsigned fl_utf8to_mb(const char *src, unsigned srclen, char *dst, unsigned dstlen);
+/* OD: Convert UTF8 to a local multi-byte encoding */
+FL_EXPORT char* fl_utf2mbcs(const char *src);
+
+/* F2: Convert a local multi-byte encoding to UTF8 - mainly for win32? */
+FL_EXPORT unsigned fl_utf8from_mb(char *dst, unsigned dstlen, const char *src, unsigned srclen);
+/* OD: Convert a local multi-byte encoding to UTF8 */
+/* FL_EXPORT char* fl_mbcs2utf(const char *src); */
+
+/*****************************************************************************/
+#ifdef WIN32
+/* OD: Attempt to convert the UTF8 string to the current locale */
+FL_EXPORT char *fl_utf8_to_locale(const char *s, int len, unsigned int codepage);
+
+/* OD: Attempt to convert a string in the current locale to UTF8 */
+FL_EXPORT char *fl_locale_to_utf8(const char *s, int len, unsigned int codepage);
+#endif
+
+/*****************************************************************************
+ * The following functions are intended to provide portable, UTF8 aware
+ * versions of standard functions
+ */
+
+/* OD: UTF8 aware strncasecmp - converts to lower case Unicode and tests */
+FL_EXPORT int fl_utf_strncasecmp(const char *s1, const char *s2, int n);
+
+/* OD: UTF8 aware strcasecmp - converts to Unicode and tests */
+FL_EXPORT int fl_utf_strcasecmp(const char *s1, const char *s2);
+
+/* OD: return the Unicode lower case value of ucs */
+FL_EXPORT int fl_tolower(unsigned int ucs);
+
+/* OD: return the Unicode upper case value of ucs */
+FL_EXPORT int fl_toupper(unsigned int ucs);
+
+/* OD: converts the UTF8 string to the lower case equivalent */
+FL_EXPORT int fl_utf_tolower(const unsigned char *str, int len, char *buf);
+
+/* OD: converts the UTF8 string to the upper case equivalent */
+FL_EXPORT int fl_utf_toupper(const unsigned char *str, int len, char *buf);
+
+/* OD: Portable UTF8 aware chmod wrapper */
+FL_EXPORT int fl_chmod(const char* f, int mode);
+
+/* OD: Portable UTF8 aware access wrapper */
+FL_EXPORT int fl_access(const char* f, int mode);
+
+/* OD: Portable UTF8 aware stat wrapper */
+FL_EXPORT int fl_stat( const char *path, struct stat *buffer );
+
+/* OD: Portable UTF8 aware getcwd wrapper */
+FL_EXPORT char* fl_getcwd( char *buf, int maxlen);
+
+/* OD: Portable UTF8 aware fopen wrapper */
+FL_EXPORT FILE *fl_fopen(const char *f, const char *mode);
+
+/* OD: Portable UTF8 aware system wrapper */
+FL_EXPORT int fl_system(const char* f);
+
+/* OD: Portable UTF8 aware execvp wrapper */
+FL_EXPORT int fl_execvp(const char *file, char *const *argv);
+
+/* OD: Portable UTF8 aware open wrapper */
+FL_EXPORT int fl_open(const char* f, int o, ...);
+
+/* OD: Portable UTF8 aware unlink wrapper */
+FL_EXPORT int fl_unlink(const char *f);
+
+/* OD: Portable UTF8 aware rmdir wrapper */
+FL_EXPORT int fl_rmdir(const char *f);
+
+/* OD: Portable UTF8 aware getenv wrapper */
+FL_EXPORT char* fl_getenv(const char *name);
+
+/* OD: Portable UTF8 aware execvp wrapper */
+FL_EXPORT int fl_mkdir(const char* f, int mode);
+
+/* OD: Portable UTF8 aware rename wrapper */
+FL_EXPORT int fl_rename(const char* f, const char *t);
+
+
+/* OD: Given a full pathname, this will create the directory path needed to hold the file named */
+FL_EXPORT void fl_make_path_for_file( const char *path );
+
+/* OD: recursively create a path in the file system */
+FL_EXPORT char fl_make_path( const char *path );
+
+
+/** @} */
+
+/*****************************************************************************/
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+
+#endif /* _HAVE_FL_UTF8_HDR_ */
+
+/*
+ * End of "$Id: $".
+ */
diff --git a/plugins/zynaddsubfx/fltk/FL/mac.H b/plugins/zynaddsubfx/fltk/FL/mac.H
index 0af94a089..79cbd10c2 100644
--- a/plugins/zynaddsubfx/fltk/FL/mac.H
+++ b/plugins/zynaddsubfx/fltk/FL/mac.H
@@ -1,9 +1,9 @@
//
-// "$Id: mac.H 5379 2006-08-29 11:03:05Z matt $"
+// "$Id: mac.H 6614 2009-01-01 16:11:32Z matt $"
//
// Mac header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -28,8 +28,9 @@
// Do not directly include this file, instead use . It will
// include this file if "__APPLE__" is defined. This is to encourage
// portability of even the system-specific code...
+#ifndef FL_DOXYGEN
-#ifndef Fl_X_H
+#if !defined(Fl_X_H)
# error "Never use directly; include instead."
#endif // !Fl_X_H
@@ -129,8 +130,8 @@ extern void fl_open_display();
extern void fl_open_callback(void (*cb)(const char *));
extern FL_EXPORT int fl_parse_color(const char* p, uchar& r, uchar& g, uchar& b);
-
+#endif // FL_DOXYGEN
//
-// End of "$Id: mac.H 5379 2006-08-29 11:03:05Z matt $".
+// End of "$Id: mac.H 6614 2009-01-01 16:11:32Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/math.h b/plugins/zynaddsubfx/fltk/FL/math.h
index b20af65f7..d7a0fb63a 100644
--- a/plugins/zynaddsubfx/fltk/FL/math.h
+++ b/plugins/zynaddsubfx/fltk/FL/math.h
@@ -1,9 +1,9 @@
//
-// "$Id: math.h 4288 2005-04-16 00:13:17Z mike $"
+// "$Id: math.h 6614 2009-01-01 16:11:32Z matt $"
//
// Math header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -68,5 +68,5 @@ inline double copysign(double a, double b) {return b<0 ? -a : a;}
//
-// End of "$Id: math.h 4288 2005-04-16 00:13:17Z mike $".
+// End of "$Id: math.h 6614 2009-01-01 16:11:32Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/names.h b/plugins/zynaddsubfx/fltk/FL/names.h
index 39238dac2..1c09463f3 100644
--- a/plugins/zynaddsubfx/fltk/FL/names.h
+++ b/plugins/zynaddsubfx/fltk/FL/names.h
@@ -1,9 +1,9 @@
//
-// "$Id:$"
+// "$Id: names.h 6731 2009-03-31 22:41:10Z greg.ercolano $"
//
// Event names header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2007 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -30,7 +30,7 @@
#ifndef FL_NAMES_H
#define FL_NAMES_H
-char *fl_eventnames[] =
+const char * const fl_eventnames[] =
{
"FL_NO_EVENT",
"FL_PUSH",
@@ -58,7 +58,7 @@ char *fl_eventnames[] =
"FL_DND_RELEASE",
};
-char *fl_fontnames[] =
+const char * const fl_fontnames[] =
{
"FL_HELVETICA",
"FL_HELVETICA_BOLD",
@@ -81,5 +81,5 @@ char *fl_fontnames[] =
#endif /* FL_NAMES_H */
//
-// End of "$Id:$".
+// End of "$Id: names.h 6731 2009-03-31 22:41:10Z greg.ercolano $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/win32.H b/plugins/zynaddsubfx/fltk/FL/win32.H
index 7122ab15e..a9f482979 100644
--- a/plugins/zynaddsubfx/fltk/FL/win32.H
+++ b/plugins/zynaddsubfx/fltk/FL/win32.H
@@ -1,9 +1,9 @@
//
-// "$Id: win32.H 5436 2006-09-16 16:02:00Z matt $"
+// "$Id: win32.H 6614 2009-01-01 16:11:32Z matt $"
//
// WIN32 header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -29,6 +29,7 @@
// include this file if WIN32 is defined. This is to encourage
// portability of even the system-specific code...
+#ifndef FL_DOXYGEN
#ifndef Fl_X_H
# error "Never use directly; include instead."
#endif // !Fl_X_H
@@ -124,12 +125,12 @@ typedef HBITMAP Fl_Offscreen;
extern FL_EXPORT HDC fl_makeDC(HBITMAP);
-#define fl_begin_offscreen(b) \
- HDC _sgc=fl_gc; Window _sw=fl_window; \
- fl_gc=fl_makeDC(b); int _savedc = SaveDC(fl_gc); fl_window=(HWND)b; fl_push_no_clip()
+# define fl_begin_offscreen(b) \
+ HDC _sgc=fl_gc; Window _sw=fl_window; \
+ fl_gc=fl_makeDC(b); int _savedc = SaveDC(fl_gc); fl_window=(HWND)b; fl_push_no_clip()
-#define fl_end_offscreen() \
- fl_pop_clip(); RestoreDC(fl_gc, _savedc); DeleteDC(fl_gc); fl_window=_sw; fl_gc = _sgc
+# define fl_end_offscreen() \
+ fl_pop_clip(); RestoreDC(fl_gc, _savedc); DeleteDC(fl_gc); fl_window=_sw; fl_gc = _sgc
FL_EXPORT void fl_copy_offscreen(int x,int y,int w,int h,HBITMAP pixmap,int srcx,int srcy);
FL_EXPORT void fl_copy_offscreen_with_alpha(int x,int y,int w,int h,HBITMAP pixmap,int srcx,int srcy);
@@ -146,7 +147,7 @@ extern FL_EXPORT void fl_delete_bitmask(Fl_Bitmask bm);
inline void fl_open_callback(void (*)(const char *)) {}
extern FL_EXPORT int fl_parse_color(const char* p, uchar& r, uchar& g, uchar& b);
-
+#endif // FL_DOXYGEN
//
-// End of "$Id: win32.H 5436 2006-09-16 16:02:00Z matt $".
+// End of "$Id: win32.H 6614 2009-01-01 16:11:32Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/x.H b/plugins/zynaddsubfx/fltk/FL/x.H
index 3a3139317..89efe6ae8 100644
--- a/plugins/zynaddsubfx/fltk/FL/x.H
+++ b/plugins/zynaddsubfx/fltk/FL/x.H
@@ -1,9 +1,9 @@
//
-// "$Id: x.H 5262 2006-07-18 11:23:20Z matt $"
+// "$Id: x.H 6614 2009-01-01 16:11:32Z matt $"
//
// X11 header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -30,7 +30,7 @@
// need to call Xlib directly. These symbols may not exist on non-X
// systems.
-#ifndef Fl_X_H
+#if !defined(Fl_X_H) && !defined(FL_DOXYGEN)
# define Fl_X_H
# include "Enumerations.H"
@@ -50,7 +50,7 @@
# endif
# include
# include "Fl_Window.H"
-
+# include "Xutf8.h"
// Mirror X definition of Region to Fl_Region, for portability...
typedef Region Fl_Region;
@@ -65,34 +65,11 @@ extern FL_EXPORT int fl_screen;
extern FL_EXPORT XVisualInfo *fl_visual;
extern FL_EXPORT Colormap fl_colormap;
-#if USE_XFT
-// access to core fonts
-FL_EXPORT XFontStruct* fl_xxfont();
-class Fl_XFont_On_Demand
-{
-public:
- Fl_XFont_On_Demand(XFontStruct* p = NULL) : ptr(p) { }
- Fl_XFont_On_Demand& operator=(const Fl_XFont_On_Demand& x)
- { ptr = x.ptr; return *this; }
- Fl_XFont_On_Demand& operator=(XFontStruct* p)
- { ptr = p; return *this; }
- XFontStruct* value() { if (!ptr) { ptr = fl_xxfont(); } return ptr; }
- operator XFontStruct*() { return value(); }
- XFontStruct& operator*() { return *value(); }
- XFontStruct* operator->() { return value(); }
- bool operator==(const Fl_XFont_On_Demand& x) { return ptr == x.ptr; }
- bool operator!=(const Fl_XFont_On_Demand& x) { return ptr != x.ptr; }
-private:
- XFontStruct* ptr;
-};
-extern FL_EXPORT Fl_XFont_On_Demand fl_xfont;
-#else
-extern FL_EXPORT XFontStruct* fl_xfont;
-#endif
-
// drawing functions:
extern FL_EXPORT GC fl_gc;
extern FL_EXPORT Window fl_window;
+//extern FL_EXPORT XFontStruct* fl_xfont;
+extern FL_EXPORT XUtf8FontStruct* fl_xfont;
extern FL_EXPORT void *fl_xftfont;
FL_EXPORT ulong fl_xpixel(Fl_Color i);
FL_EXPORT ulong fl_xpixel(uchar r, uchar g, uchar b);
@@ -168,5 +145,5 @@ extern FL_EXPORT int fl_parse_color(const char* p, uchar& r, uchar& g, uchar& b)
#endif
//
-// End of "$Id: x.H 5262 2006-07-18 11:23:20Z matt $".
+// End of "$Id: x.H 6614 2009-01-01 16:11:32Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/README b/plugins/zynaddsubfx/fltk/README
index 80edbe936..103554c88 100644
--- a/plugins/zynaddsubfx/fltk/README
+++ b/plugins/zynaddsubfx/fltk/README
@@ -1,4 +1,4 @@
-README - Fast Light Tool Kit (FLTK) Version 1.1.9
+README - Fast Light Tool Kit (FLTK) Version 1.3.0
-------------------------------------------------
WHAT IS FLTK?
@@ -84,9 +84,8 @@ BUILDING AND INSTALLING FLTK UNDER UNIX AND MacOS X
BUILDING FLTK UNDER MICROSOFT WINDOWS
There are two ways to build FLTK under Microsoft Windows.
- The first is to use the VC++ 6.0 project files under the
- "visualc" directory. Just open (or double-click on) the
- "fltk.dsw" file to get the whole shebang.
+ The first is to use the Visual C++ project files under the
+ "ide/" directory. See the file ide/README.IDE for more info.
The second method is to use a GNU-based development tool
with the files in the "makefiles" directory. To build
@@ -164,20 +163,9 @@ TRADEMARKS
COPYRIGHT
- FLTK is copyright 1998-2008 by Bill Spitzak
- (spitzak@users.sourceforge.net) and others, including:
-
- Craig P. Earls
- Curtis Edwards (trilex@users.sourceforge.net)
- Gustavo Hime (hime@users.sourceforge.net)
- Talbot Hughes
- Robert Kesterson (robertk@users.sourceforge.net)
- Matthias Melcher (matthiaswm@users.sourceforge.net)
- James Dean Palmer (jamespalmer@users.sourceforge.net)
- Vincent Penne (vincentp@users.sourceforge.net)
- Michael Sweet (easysw@users.sourceforge.net)
- Carl Thompson (clip@users.sourceforge.net)
- Nafees Bin Zafar (nafees@users.sourceforge.net)
+ FLTK is copyright 1998-2009 by Bill Spitzak
+ (spitzak@users.sourceforge.net) and others,
+ see the CREDITS file for more info.
This library is free software; you can redistribute it
and/or modify it under the terms of the GNU Library General
diff --git a/plugins/zynaddsubfx/fltk/README.mac b/plugins/zynaddsubfx/fltk/README.mac
index ab042c427..b4388ab20 100644
--- a/plugins/zynaddsubfx/fltk/README.mac
+++ b/plugins/zynaddsubfx/fltk/README.mac
@@ -39,29 +39,12 @@ KNOWN MacFLTK BUGS
- Sub-sub-subwindow not tested.
- The 'shiny' demo needs work (flush/aglFlush).
+UNIVERSAL BINARES
-TEST SUITE STATUS
-
- OS X:
-
- CubeView(++), adjuster(++), arc(++), ask(++), bitmap(++),
- boxtype(++), browser(++), button(++), buttons(++),
- checkers(++), clock(++), colbrowser(++), color_chooser(++),
- cube(++), cursor(++), curve(++), demo(++), doublebuffer(++),
- editor(++), fast_slow(++), file_chooser(++), fonts(++),
- forms(++), fractals(++), fullscreen(++), gl_overlay(++),
- glpuzzle(++), hello(++), help(++), iconize(++), image(+),
- inactive(++), input(++), keyboard(++), label(++),
- line_style(+), mandelbrot(++), menubar(++), message(++),
- minimum(++), navigation(++), output(++), overlay(++),
- pack(++), pixmap(++), pixmap_browser(++), radio(++),
- resizebox(++), scroll(++), shape(++), shiny(-),
- subwindow(++), symbols(++), tabs(++), tile(++),
- tiled_image(++), valuators(++), fluid(++)
-
- (o)=minor bugs, (+)=usable, (++)=running perfectly,
- (-)=major bugs, (--)=crashes
-
+ To create Universal Binaries for Tiger, start "configure"
+ with the following flags:
+ ./configure --with-archflags="-mmacosx-version-min=10.4\
+ -arch i386 -arch ppc"
OTHER STUFF
diff --git a/plugins/zynaddsubfx/fltk/configh.cmake.in b/plugins/zynaddsubfx/fltk/configh.cmake.in
index e3ffc70fb..ec5167a15 100644
--- a/plugins/zynaddsubfx/fltk/configh.cmake.in
+++ b/plugins/zynaddsubfx/fltk/configh.cmake.in
@@ -1,10 +1,10 @@
/*
- * "$Id: configh.cmake.in 6106 2008-04-21 21:10:47Z matt $"
+ * "$Id: configh.cmake.in 6614 2009-01-01 16:11:32Z matt $"
*
* Configuration file for the Fast Light Tool Kit (FLTK).
* @configure_input@
*
- * Copyright 1998-2008 by Bill Spitzak and others.
+ * Copyright 1998-2009 by Bill Spitzak and others.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -47,6 +47,8 @@
#define BORDER_WIDTH 2
+#cmakedefine USE_X11 1
+
/*
* HAVE_GL:
*
@@ -265,5 +267,5 @@
#endif
/*
- * End of "$Id: configh.cmake.in 6106 2008-04-21 21:10:47Z matt $".
+ * End of "$Id: configh.cmake.in 6614 2009-01-01 16:11:32Z matt $".
*/
diff --git a/plugins/zynaddsubfx/fltk/fltk-config.in b/plugins/zynaddsubfx/fltk/fltk-config.in
index 0794f6826..0c9eef992 100644
--- a/plugins/zynaddsubfx/fltk/fltk-config.in
+++ b/plugins/zynaddsubfx/fltk/fltk-config.in
@@ -1,10 +1,10 @@
#!/bin/sh
#
-# "$Id: fltk-config.in 6032 2008-02-20 18:10:13Z matt $"
+# "$Id: fltk-config.in 6614 2009-01-01 16:11:32Z matt $"
#
# FLTK configuration utility.
#
-# Copyright 2000-2007 by Bill Spitzak and others.
+# Copyright 2000-2009 by Bill Spitzak and others.
# Original version Copyright 2000 by James Dean Palmer
# Adapted by Vincent Penne and Michael Sweet
#
@@ -35,7 +35,7 @@ VERSION="$MAJOR_VERSION.$MINOR_VERSION.$PATCH_VERSION"
APIVERSION="$MAJOR_VERSION.$MINOR_VERSION"
### BEGIN fltk-config
-selfdir=`dirname $0`
+selfdir=`dirname "$0"`
prefix=@prefix@
exec_prefix=@exec_prefix@
@@ -49,9 +49,6 @@ srcdir=@srcdir@
CC="@CC@"
CXX="@CXX@"
-# post-process command (only needed for MacOS)
-POSTBUILD="@POSTBUILD@"
-
# flags for C++ compiler:
ARCHFLAGS="@ARCHFLAGS@"
CFLAGS="@CFLAGS@ @LARGEFILE@ @PTHREAD_FLAGS@"
@@ -59,6 +56,7 @@ CXXFLAGS="@CXXFLAGS@ @LARGEFILE@ @PTHREAD_FLAGS@"
LDFLAGS="@LDFLAGS@"
LDLIBS="@LIBS@"
OPTIM="@OPTIM@"
+CAIROFLAGS="@CAIROFLAGS@"
# Check for local invocation, and update paths accordingly...
if test -f "$selfdir/FL/Fl_Window.H"; then
@@ -87,11 +85,18 @@ if test -d $includedir/FL/images; then
CXXFLAGS="-I$includedir/FL/images $CXXFLAGS"
fi
+if test -f "$libdir/libfltk_cairo.a"; then
+ CFLAGS="$CAIROFLAGS $CFLAGS"
+ CXXFLAGS="$CAIROFLAGS $CXXFLAGS"
+fi
+
# libraries to link with:
LIBNAME="@LIBNAME@"
DSONAME="@DSONAME@"
DSOLINK="@DSOLINK@"
IMAGELIBS="@IMAGELIBS@"
+STATICIMAGELIBS="@STATICIMAGELIBS@"
+CAIROLIBS="@CAIROLIBS@"
SHAREDSUFFIX="@SHAREDSUFFIX@"
usage ()
@@ -106,6 +111,7 @@ Options telling what we are doing:
[--use-images] use extra image formats (PNG, JPEG)
[--use-glut] use glut compatibility layer
[--use-forms] use forms compatibility layer
+ [--use-cairo] use cairo graphics lib
Options telling what information we request:
[--cc] return C compiler used to compile FLTK
@@ -118,11 +124,11 @@ Options telling what information we request:
even if there are DSOs installed
[--libs] return FLTK libraries full path for dependencies
-Option to compile and link an application:
+Options to compile and link an application:
[-g] compile the program with debugging information
[-Dname[=value]] compile the program with the given define
[--compile program.cxx]
- [--post program]
+ [--post program] prepare the program for desktop use
"
exit $1
}
@@ -173,6 +179,9 @@ do
--use-images)
use_images=yes
;;
+ --use-cairo)
+ use_cairo=yes
+ ;;
--cflags)
echo_cflags=yes
;;
@@ -195,12 +204,11 @@ do
CXXFLAGS="$CXXFLAGS $1"
;;
--compile)
- compile=$2
- post=$2
+ compile="$2"
shift
;;
--post)
- post=$2
+ post="$2"
shift
;;
*)
@@ -239,6 +247,11 @@ if test x$use_images = xyes; then
LDSTATIC="$libdir/libfltk_images.a $IMAGELIBS $LDSTATIC"
fi
+if test x$use_cairo = xyes; then
+ LDLIBS="-lfltk_cairo$SHAREDSUFFIX $CAIROLIBS $LDLIBS"
+ LDSTATIC="$libdir/libfltk_cairo.a $CAIROLIBS $LDSTATIC"
+fi
+
LDLIBS="$DSOLINK $LDFLAGS $libs $LDLIBS"
LDSTATIC="$LDFLAGS $LDSTATIC"
@@ -248,40 +261,68 @@ if test -n "$echo_help"; then
fi
if test -n "$compile"; then
- case $compile in
+ case "$compile" in
*.cxx)
- prog=`basename $compile .cxx`
+ prog="`basename \"$compile\" .cxx`"
;;
*.cpp)
- prog=`basename $compile .cpp`
+ prog="`basename \"$compile\" .cpp`"
;;
*.cc)
- prog=`basename $compile .cc`
+ prog="`basename \"$compile\" .cc`"
;;
*.C)
- prog=`basename $compile .C`
+ prog="`basename \"$compile\" .C`"
;;
*)
echo "ERROR: Unknown/bad C++ source file extension on \"$compile\"!"
exit 1
;;
esac
-
- post=$prog
- echo $CXX $ARCHFLAGS $includes $CXXFLAGS $debug -o $prog $compile $LDLIBS
- $CXX $ARCHFLAGS $includes $CXXFLAGS $debug -o $prog $compile $LDLIBS
+ post="$prog"
- # stop after compilation in case of errors
- err=$?
- if test $err != 0; then
- exit $err
- fi
+ echo $CXX $ARCHFLAGS $includes $CXXFLAGS $debug -o "'$prog'" "'$compile'" $LDSTATIC
+ $CXX $ARCHFLAGS $includes $CXXFLAGS $debug -o "$prog" "$compile" $LDSTATIC || exit 1
fi
-if test -n "$post" -a "$POSTBUILD" != ":"; then
- echo $POSTBUILD $post $includedir/FL/mac.r
- $POSTBUILD $post $includedir/FL/mac.r
+if test -n "$post"; then
+ case "`uname`" in
+ Darwin)
+ echo Creating "'$post.app'" bundle for desktop...
+ id=`echo $post | tr ' ' '_'`
+
+ # Make the bundle directory and move the executable there
+ rm -rf "$post.app/Contents/MacOS"
+ mkdir -p "$post.app/Contents/MacOS"
+ mv "$post" "$post.app/Contents/MacOS"
+
+ # Make a shell script that runs the bundled executable
+ echo "#!/bin/sh" >"$post"
+ echo 'dir="`dirname '"'"'$0'"'"'`"' >>"$post"
+ echo 'exec "$dir/'"$post.app/Contents/MacOS/$post"'" "$@"' >>"$post"
+ chmod +x "$post"
+
+ # Make the simplest Info.plist needed for an application
+ cat >"$post.app/Contents/Info.plist" <
+
+
+ CFBundleInfoDictionaryVersion
+ 6.0
+ CFBundleExecutable
+ $post
+ CFBundleIdentifier
+ org.fltk.$id
+ CFBundleName
+ $post
+ CFBundlePackageType
+ APPL
+
+
+EOF
+ ;;
+ esac
fi
if test "$echo_cflags" = "yes"; then
@@ -317,28 +358,31 @@ if test "$echo_ldstaticflags" = "yes"; then
fi
if test "$echo_libs" = "yes"; then
- echo -n $libdir/libfltk.a
+ echo $libdir/libfltk.a
if test x$use_forms = xyes; then
- echo -n " $libdir/libfltk_forms.a"
+ echo $libdir/libfltk_forms.a
fi
if test x$use_gl = xyes; then
- echo -n " $libdir/libfltk_gl.a"
+ echo $libdir/libfltk_gl.a
+ fi
+
+ if test x$use_cairo = xyes; then
+ echo $libdir/libfltk_cairo.a
fi
if test x$use_images = xyes; then
- echo -n " $libdir/libfltk_images.a"
+ echo $libdir/libfltk_images.a
for lib in fltk_jpeg fltk_png fltk_z; do
if test -f $libdir/lib$lib.a; then
- echo -n " $libdir/lib$lib.a"
+ echo $libdir/lib$lib.a
fi
done
fi
- echo
fi
#
-# End of "$Id: fltk-config.in 6032 2008-02-20 18:10:13Z matt $".
+# End of "$Id: fltk-config.in 6614 2009-01-01 16:11:32Z matt $".
#
diff --git a/plugins/zynaddsubfx/fltk/fltk.list.in b/plugins/zynaddsubfx/fltk/fltk.list.in
index 681d8c9e6..5f3d27758 100644
--- a/plugins/zynaddsubfx/fltk/fltk.list.in
+++ b/plugins/zynaddsubfx/fltk/fltk.list.in
@@ -1,11 +1,11 @@
#
-# "$Id: fltk.list.in 6059 2008-02-28 16:50:07Z mike $"
+# "$Id: fltk.list.in 6614 2009-01-01 16:11:32Z matt $"
#
# EPM product list file for the Fast Light Tool Kit (FLTK).
#
# (EPM can be found at http://www.epmhome.org/)
#
-# Copyright 1998-2008 by Bill Spitzak and others.
+# Copyright 1998-2009 by Bill Spitzak and others.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
@@ -28,7 +28,7 @@
#
%product Fast Light Tool Kit (FLTK)
-%copyright 1998-2008 by Bill Spitzak and others.
+%copyright 1998-2009 by Bill Spitzak and others.
%vendor FLTK Development Team
%license COPYING
%readme README
@@ -408,5 +408,5 @@ f 0444 root sys $mandir/man6/checkers.6 documentation/checkers.man
f 0444 root sys $mandir/man6/sudoku.6 documentation/sudoku.man
#
-# End of "$Id: fltk.list.in 6059 2008-02-28 16:50:07Z mike $".
+# End of "$Id: fltk.list.in 6614 2009-01-01 16:11:32Z matt $".
#
diff --git a/plugins/zynaddsubfx/fltk/fltk.spec.in b/plugins/zynaddsubfx/fltk/fltk.spec.in
index 28fed04cc..80ef576d6 100644
--- a/plugins/zynaddsubfx/fltk/fltk.spec.in
+++ b/plugins/zynaddsubfx/fltk/fltk.spec.in
@@ -1,9 +1,9 @@
#
-# "$Id: fltk.spec.in 6059 2008-02-28 16:50:07Z mike $"
+# "$Id: fltk.spec.in 6614 2009-01-01 16:11:32Z matt $"
#
# RPM spec file for FLTK.
#
-# Copyright 1998-2008 by Bill Spitzak and others.
+# Copyright 1998-2009 by Bill Spitzak and others.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
@@ -141,5 +141,5 @@ rm -rf $RPM_BUILD_ROOT
%{prefix}/share/icons/hicolor/*/apps/sudoku.png
#
-# End of "$Id: fltk.spec.in 6059 2008-02-28 16:50:07Z mike $".
+# End of "$Id: fltk.spec.in 6614 2009-01-01 16:11:32Z matt $".
#
diff --git a/plugins/zynaddsubfx/fltk/src/CMakeLists.txt b/plugins/zynaddsubfx/fltk/src/CMakeLists.txt
index d63f61b0d..7b628bd01 100644
--- a/plugins/zynaddsubfx/fltk/src/CMakeLists.txt
+++ b/plugins/zynaddsubfx/fltk/src/CMakeLists.txt
@@ -1,3 +1,7 @@
+IF(COMMAND cmake_policy)
+ cmake_policy(SET CMP0003 NEW)
+ENDIF(COMMAND cmake_policy)
+
SET(CPPFILES
Fl.cxx
Fl_Adjuster.cxx
@@ -124,7 +128,8 @@ SET(CPPFILES
fl_show_colormap.cxx
fl_symbols.cxx
fl_vertex.cxx
- screen_xywh.cxx
+ screen_xywh.cxx
+ fl_utf8.cxx
)
SET(FLCPPFILES
forms_compatability.cxx
@@ -160,10 +165,18 @@ SET(IMGCPPFILES
SET(CFILES
fl_call_main.c
+ fl_utf.c
flstring.c
scandir.c
numericsort.c
vsnprintf.c
+ xutf8/case.c
+ xutf8/is_right2left.c
+ xutf8/is_spacing.c
+ xutf8/keysym2Ucs.c
+ xutf8/utf8Input.c
+ xutf8/utf8Utils.c
+ xutf8/utf8Wrap.c
)
ADD_LIBRARY(fltk ${CPPFILES} ${CFILES})
diff --git a/plugins/zynaddsubfx/fltk/src/Fl.cxx b/plugins/zynaddsubfx/fltk/src/Fl.cxx
index 0ea325bfb..95fcb31fd 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl.cxx 5654 2007-02-02 13:52:37Z matt $"
+// "$Id: Fl.cxx 6787 2009-05-14 20:16:09Z engelsman $"
//
// Main event handling code for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2006 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,11 +25,12 @@
// http://www.fltk.org/str.php
//
+
// warning: the Apple Quartz version still uses some Quickdraw calls,
// mostly to get around the single active context in QD and
// to implement clipping. This should be changed into pure
// Quartz calls in the near future.
-
+#include "config.h"
#include
#include
#include
@@ -55,7 +56,7 @@ void fl_cleanup_dc_list(void);
//
// Globals...
//
-
+#ifndef FL_DOXYGEN
Fl_Widget *Fl::belowmouse_,
*Fl::pushed_,
*Fl::focus_,
@@ -72,39 +73,78 @@ int Fl::damage_,
Fl::e_clicks,
Fl::e_is_click,
Fl::e_keysym,
- Fl::e_original_keysym;
+ Fl::e_original_keysym,
+ Fl::scrollbar_size_ = 16;
+
char *Fl::e_text = (char *)"";
int Fl::e_length;
int Fl::visible_focus_ = 1,
Fl::dnd_text_ops_ = 1;
-
Fl_Window *fl_xfocus; // which window X thinks has focus
Fl_Window *fl_xmousewin;// which window X thinks has FL_ENTER
Fl_Window *Fl::grab_; // most recent Fl::grab()
Fl_Window *Fl::modal_; // topmost modal() window
+#endif // FL_DOXYGEN
+
//
// 'Fl::version()' - Return the API version number...
//
double
+/**
+ Returns the compiled-in value of the FL_VERSION constant. This
+ is useful for checking the version of a shared library.
+*/
Fl::version() {
return FL_VERSION;
}
+/**
+ Gets the default scrollbar size used by
+ Fl_Browser_,
+ Fl_Help_View,
+ Fl_Scroll, and
+ Fl_Text_Display widgets.
+ \returns The default size for widget scrollbars, in pixels.
+*/
+int Fl::scrollbar_size() {
+ return scrollbar_size_;
+}
-//
-// 'Fl:event_inside()' - Return whether or not the mouse event is inside
-// the given rectangle.
-//
+/**
+ Sets the default scrollbar size that is used by the
+ Fl_Browser_,
+ Fl_Help_View,
+ Fl_Scroll, and
+ Fl_Text_Display widgets.
+ \param[in] W The new default size for widget scrollbars, in pixels.
+*/
+void Fl::scrollbar_size(int W) {
+ scrollbar_size_ = W;
+}
+
+/**
+ Returns whether or not the mouse event is inside the given rectangle.
+ Returns non-zero if the current event_x and event_y
+ put it inside the widget or inside an arbitrary bounding box. You
+ should always call this rather than doing your own comparison so you
+ are consistent about edge effects.
+*/
int Fl::event_inside(int xx,int yy,int ww,int hh) /*const*/ {
int mx = e_x - xx;
int my = e_y - yy;
return (mx >= 0 && mx < ww && my >= 0 && my < hh);
}
+/** Returns whether or not the mouse event is inside the given widget.
+ Returns non-zero if the current event_x and event_y
+ put it inside the widget or inside an arbitrary bounding box. You
+ should always call this rather than doing your own comparison so you
+ are consistent about edge effects.
+*/
int Fl::event_inside(const Fl_Widget *o) /*const*/ {
int mx = e_x - o->x();
int my = e_y - o->y();
@@ -197,12 +237,19 @@ void Fl::repeat_timeout(double time, Fl_Timeout_Handler cb, void *argp) {
*p = t;
}
+/**
+ Returns true if the timeout exists and has not been called yet.
+*/
int Fl::has_timeout(Fl_Timeout_Handler cb, void *argp) {
for (Timeout* t = first_timeout; t; t = t->next)
if (t->cb == cb && t->arg == argp) return 1;
return 0;
}
+/**
+ Removes a timeout callback. It is harmless to remove a timeout
+ callback that no longer exists.
+*/
void Fl::remove_timeout(Fl_Timeout_Handler cb, void *argp) {
// This version removes all matching timeouts, not just the first one.
// This may change in the future.
@@ -235,6 +282,37 @@ struct Check {
};
static Check *first_check, *next_check, *free_check;
+/**
+ FLTK will call this callback just before it flushes the display and
+ waits for events. This is different than an idle callback because it
+ is only called once, then FLTK calls the system and tells it not to
+ return until an event happens.
+
+ This can be used by code that wants to monitor the
+ application's state, such as to keep a display up to date. The
+ advantage of using a check callback is that it is called only when no
+ events are pending. If events are coming in quickly, whole blocks of
+ them will be processed before this is called once. This can save
+ significant time and avoid the application falling behind the events.
+
+ Sample code:
+
+ \code
+ bool state_changed; // anything that changes the display turns this on
+
+ void callback(void*) {
+ if (!state_changed) return;
+ state_changed = false;
+ do_expensive_calculation();
+ widget->redraw();
+ }
+
+ main() {
+ Fl::add_check(callback);
+ return Fl::run();
+ }
+ \endcode
+*/
void Fl::add_check(Fl_Timeout_Handler cb, void *argp) {
Check* t = free_check;
if (t) free_check = t->next;
@@ -246,6 +324,10 @@ void Fl::add_check(Fl_Timeout_Handler cb, void *argp) {
first_check = t;
}
+/**
+ Removes a check callback. It is harmless to remove a check
+ callback that no longer exists.
+*/
void Fl::remove_check(Fl_Timeout_Handler cb, void *argp) {
for (Check** p = &first_check; *p;) {
Check* t = *p;
@@ -261,9 +343,8 @@ void Fl::remove_check(Fl_Timeout_Handler cb, void *argp) {
}
/**
- * Return 1, if a check with the same handler and data pointer
- * is pending, 0 otherwise.
- */
+ Returns 1 if the check exists and has not been called yet, 0 otherwise.
+*/
int Fl::has_check(Fl_Timeout_Handler cb, void *argp) {
for (Check** p = &first_check; *p;) {
Check* t = *p;
@@ -302,6 +383,9 @@ void (*Fl::idle)(); // see Fl_add_idle.cxx for the add/remove functions
extern int fl_ready(); // in Fl_.cxx
extern int fl_wait(double time); // in Fl_.cxx
+/**
+ See int wait()
+*/
double Fl::wait(double time_to_wait) {
// delete all widgets that were listed during callbacks
do_widget_deletion();
@@ -323,6 +407,8 @@ double Fl::wait(double time_to_wait) {
if (idle) time_to_wait = 0.0;
}
flush();
+ if (idle && !in_idle) // 'idle' may have been set within flush()
+ time_to_wait = 0.0;
return fl_wait(time_to_wait);
#else
@@ -369,6 +455,8 @@ double Fl::wait(double time_to_wait) {
} else {
// do flush first so that user sees the display:
flush();
+ if (idle && !in_idle) // 'idle' may have been set within flush()
+ time_to_wait = 0.0;
return fl_wait(time_to_wait);
}
#endif
@@ -376,6 +464,13 @@ double Fl::wait(double time_to_wait) {
#define FOREVER 1e20
+/**
+ As long as any windows are displayed this calls Fl::wait()
+ repeatedly. When all the windows are closed it returns zero
+ (supposedly it would return non-zero on any errors, but FLTK calls
+ exit directly for these). A normal program will end main()
+ with return Fl::run();.
+*/
int Fl::run() {
while (Fl_X::first) wait(FOREVER);
return 0;
@@ -398,17 +493,76 @@ static Fl_Win32_At_Exit win32_at_exit;
+/**
+ Waits until "something happens" and then returns. Call this
+ repeatedly to "run" your program. You can also check what happened
+ each time after this returns, which is quite useful for managing
+ program state.
+
+ What this really does is call all idle callbacks, all elapsed
+ timeouts, call Fl::flush() to get the screen to update, and
+ then wait some time (zero if there are idle callbacks, the shortest of
+ all pending timeouts, or infinity), for any events from the user or
+ any Fl::add_fd() callbacks. It then handles the events and
+ calls the callbacks and then returns.
+
+ The return value of the first form is non-zero if there are
+ any visible windows - this may change in future versions of
+ FLTK.
+
+ The second form waits a maximum of time
+ seconds. It can return much sooner if something happens.
+
+ The return value is positive if an event or fd happens before the
+ time elapsed. It is zero if nothing happens (on Win32 this will only
+ return zero if time is zero). It is negative if an error
+ occurs (this will happen on UNIX if a signal happens).
+*/
int Fl::wait() {
if (!Fl_X::first) return 0;
wait(FOREVER);
return Fl_X::first != 0; // return true if there is a window
}
+/**
+ Same as Fl::wait(0). Calling this during a big calculation
+ will keep the screen up to date and the interface responsive:
+
+ \code
+ while (!calculation_done()) {
+ calculate();
+ Fl::check();
+ if (user_hit_abort_button()) break;
+ }
+ \endcode
+
+ The returns non-zero if any windows are displayed, and 0 if no
+ windows are displayed (this is likely to change in future versions of
+ FLTK).
+*/
int Fl::check() {
wait(0.0);
return Fl_X::first != 0; // return true if there is a window
}
+/**
+ This is similar to Fl::check() except this does \e not
+ call Fl::flush() or any callbacks, which is useful if your
+ program is in a state where such callbacks are illegal. This returns
+ true if Fl::check() would do anything (it will continue to
+ return true until you call Fl::check() or Fl::wait()).
+
+ \code
+ while (!calculation_done()) {
+ calculate();
+ if (Fl::ready()) {
+ do_expensive_cleanup();
+ Fl::check();
+ if (user_hit_abort_button()) break;
+ }
+ }
+ \endcode
+*/
int Fl::ready() {
#if ! defined( WIN32 ) && ! defined(__APPLE__)
if (first_timeout) {
@@ -424,17 +578,19 @@ int Fl::ready() {
////////////////////////////////////////////////////////////////
// Window list management:
+#ifndef FL_DOXYGEN
Fl_X* Fl_X::first;
+#endif
Fl_Window* fl_find(Window xid) {
Fl_X *window;
for (Fl_X **pp = &Fl_X::first; (window = *pp); pp = &window->next)
-#ifdef __APPLE_QD__
- if (window->xid == xid && !window->w->window()) {
+#if defined(WIN32) || defined(USE_X11)
+ if (window->xid == xid) {
#elif defined(__APPLE_QUARTZ__)
if (window->xid == xid && !window->w->window()) {
#else
- if (window->xid == xid) {
+# error unsupported platform
#endif // __APPLE__
if (window != Fl_X::first && !Fl::modal()) {
// make this window be first to speed up searches
@@ -448,25 +604,58 @@ Fl_Window* fl_find(Window xid) {
return 0;
}
+/**
+ Returns the first top-level window in the list of shown() windows. If
+ a modal() window is shown this is the top-most modal window, otherwise
+ it is the most recent window to get an event.
+
+ The second form sets the window that is returned by
+ first_window. The window is removed from wherever it is in the
+ list and inserted at the top. This is not done if Fl::modal()
+ is on or if the window is not shown(). Because the first window
+ is used to set the "parent" of modal windows, this is often
+ useful.
+*/
Fl_Window* Fl::first_window() {
Fl_X* i = Fl_X::first;
return i ? i->w : 0;
}
+/**
+ Returns the next top-level window in the list of shown() windows. You can
+ use this call to iterate through all the windows that are shown().
+*/
Fl_Window* Fl::next_window(const Fl_Window* window) {
Fl_X* i = Fl_X::i(window)->next;
return i ? i->w : 0;
}
+/**
+ See Fl_Window* first_window()
+*/
void Fl::first_window(Fl_Window* window) {
if (!window || !window->shown()) return;
fl_find(fl_xid(window));
}
+/**
+ Redraws all widgets.
+*/
void Fl::redraw() {
for (Fl_X* i = Fl_X::first; i; i = i->next) i->w->redraw();
}
+/**
+ Causes all the windows that need it to be redrawn and graphics forced
+ out through the pipes.
+
+ This is what wait() does before looking for events.
+
+ Note: in multi-threaded applications you should only call Fl::flush()
+ from the main thread. If a child thread needs to trigger a redraw event,
+ it should instead call Fl::awake() to get the main thread to process the
+ event queue.
+*/
void Fl::flush() {
if (damage()) {
damage_ = 0;
@@ -479,19 +668,15 @@ void Fl::flush() {
if (i->region) {XDestroyRegion(i->region); i->region = 0;}
}
}
-
-#ifdef WIN32
+#if defined(USE_X11)
+ if (fl_display) XFlush(fl_display);
+#elif defined(WIN32)
GdiFlush();
-#elif defined(__APPLE_QD__)
- GrafPtr port;
- GetPort( &port );
- if ( port )
- QDFlushPortBuffer( port, 0 );
#elif defined (__APPLE_QUARTZ__)
if (fl_gc)
CGContextFlush(fl_gc);
#else
- if (fl_display) XFlush(fl_display);
+# error unsupported platform
#endif
}
@@ -505,6 +690,20 @@ struct handler_link {
static handler_link *handlers = 0;
+/**
+ Install a function to parse unrecognized events. If FLTK cannot
+ figure out what to do with an event, it calls each of these functions
+ (most recent first) until one of them returns non-zero. If none of
+ them returns non zero then the event is ignored. Events that cause
+ this to be called are:
+
+ - FL_SHORTCUT events that are not recognized by any widget.
+ This lets you provide global shortcut keys.
+ - System events that FLTK does not recognize. See fl_xevent.
+ - \e Some other events when the widget FLTK selected returns
+ zero from its handle() method. Exactly which ones may change
+ in future versions, however.
+*/
void Fl::add_handler(int (*ha)(int)) {
handler_link *l = new handler_link;
l->handle = ha;
@@ -512,6 +711,9 @@ void Fl::add_handler(int (*ha)(int)) {
handlers = l;
}
+/**
+ Removes a previously added event handler.
+*/
void Fl::remove_handler(int (*ha)(int)) {
handler_link *l, *p;
@@ -540,6 +742,18 @@ static int send_handlers(int e) {
Fl_Widget* fl_oldfocus; // kludge for Fl_Group...
+/**
+ Sets the widget that will receive FL_KEYBOARD events.
+
+ If you change Fl::focus(), the previous widget and all
+ parents (that don't contain the new widget) are sent FL_UNFOCUS
+ events. Changing the focus does \e not send FL_FOCUS to
+ this or any widget, because sending FL_FOCUS is supposed to
+ \e test if the widget wants the focus (by it returning non-zero from
+ handle()).
+
+ \sa Fl_Widget::take_focus()
+*/
void Fl::focus(Fl_Widget *o) {
if (o && !o->visible_focus()) return;
if (grab()) return; // don't do anything while grab is on
@@ -568,6 +782,20 @@ void Fl::focus(Fl_Widget *o) {
static char dnd_flag = 0; // make 'belowmouse' send DND_LEAVE instead of LEAVE
+/**
+ Sets the widget that is below the mouse. This is for
+ highlighting buttons. It is not used to send FL_PUSH or
+ FL_MOVE directly, for several obscure reasons, but those events
+ typically go to this widget. This is also the first widget tried for
+ FL_SHORTCUT events.
+
+ If you change the belowmouse widget, the previous one and all
+ parents (that don't contain the new widget) are sent FL_LEAVE
+ events. Changing this does \e not send FL_ENTER to this
+ or any widget, because sending FL_ENTER is supposed to \e test
+ if the widget wants the mouse (by it returning non-zero from
+ handle()).
+*/
void Fl::belowmouse(Fl_Widget *o) {
if (grab()) return; // don't do anything while grab is on
Fl_Widget *p = belowmouse_;
@@ -582,7 +810,19 @@ void Fl::belowmouse(Fl_Widget *o) {
}
}
-void Fl::pushed(Fl_Widget *o) {
+/**
+ Sets the widget that is being pushed. FL_DRAG or
+ FL_RELEASE (and any more FL_PUSH) events will be sent to
+ this widget.
+
+ If you change the pushed widget, the previous one and all parents
+ (that don't contain the new widget) are sent FL_RELEASE
+ events. Changing this does \e not send FL_PUSH to this
+ or any widget, because sending FL_PUSH is supposed to \e test
+ if the widget wants the mouse (by it returning non-zero from
+ handle()).
+*/
+ void Fl::pushed(Fl_Widget *o) {
pushed_ = o;
}
@@ -703,6 +943,10 @@ static int send(int event, Fl_Widget* to, Fl_Window* window) {
}
int Fl::handle(int e, Fl_Window* window)
+/**
+ Sends the event to a window for processing. Returns non-zero if any
+ widget uses the event.
+*/
{
e_number = e;
if (fl_local_grab) return fl_local_grab(e);
@@ -717,11 +961,11 @@ int Fl::handle(int e, Fl_Window* window)
return 1;
case FL_SHOW:
- wi->show(); // this calls Fl_Widget::show(), not Fl_Window::show()
+ wi->Fl_Widget::show(); // this calls Fl_Widget::show(), not Fl_Window::show()
return 1;
case FL_HIDE:
- wi->hide(); // this calls Fl_Widget::hide(), not Fl_Window::hide()
+ wi->Fl_Widget::hide(); // this calls Fl_Widget::hide(), not Fl_Window::hide()
return 1;
case FL_PUSH:
@@ -955,7 +1199,7 @@ void Fl_Window::hide() {
fl_throw_focus(this);
handle(FL_HIDE);
-#ifdef WIN32
+#if defined(WIN32)
// this little trick keeps the current clipboard alive, even if we are about
// to destroy the window that owns the selection.
if (GetClipboardOwner()==ip->xid) {
@@ -973,10 +1217,10 @@ void Fl_Window::hide() {
fl_release_dc(fl_window, fl_gc);
fl_window = (HWND)-1;
fl_gc = 0;
+# ifdef USE_CAIRO
+ if (Fl::cairo_autolink_context()) Fl::cairo_make_current((Fl_Window*) 0);
+# endif
}
-#elif defined(__APPLE_QD__)
- if ( ip->xid == fl_window && !parent() )
- fl_window = 0;
#elif defined(__APPLE_QUARTZ__)
Fl_X::q_release_context(ip);
if ( ip->xid == fl_window && !parent() )
@@ -985,7 +1229,12 @@ void Fl_Window::hide() {
if (ip->region) XDestroyRegion(ip->region);
-#ifdef WIN32
+#if defined(USE_X11)
+# if USE_XFT
+ fl_destroy_xft_draw(ip->xid);
+# endif
+ XDestroyWindow(fl_display, ip->xid);
+#elif defined(WIN32)
// this little trickery seems to avoid the popup window stacking problem
HWND p = GetForegroundWindow();
if (p==GetParent(ip->xid)) {
@@ -993,15 +1242,10 @@ void Fl_Window::hide() {
ShowWindow(p, SW_SHOWNA);
}
XDestroyWindow(fl_display, ip->xid);
-#elif defined(__APPLE_QD__)
- MacDestroyWindow(this, ip->xid);
#elif defined(__APPLE_QUARTZ__)
MacDestroyWindow(this, ip->xid);
#else
-# if USE_XFT
- fl_destroy_xft_draw(ip->xid);
-# endif
- XDestroyWindow(fl_display, ip->xid);
+# error unsupported platform
#endif
#ifdef WIN32
@@ -1019,7 +1263,7 @@ Fl_Window::~Fl_Window() {
// FL_SHOW and FL_HIDE are called whenever the visibility of this widget
// or any parent changes. We must correctly map/unmap the system's window.
-// For top-level windows it is assummed the window has already been
+// For top-level windows it is assumed the window has already been
// mapped or unmapped!!! This is because this should only happen when
// Fl_Window::show() or Fl_Window::hide() is called, or in response to
// iconize/deiconize events from the system.
@@ -1031,12 +1275,12 @@ int Fl_Window::handle(int ev)
case FL_SHOW:
if (!shown()) show();
else {
-#ifdef __APPLE_QD__
- MacMapWindow(this, fl_xid(this));
+#if defined(USE_X11) || defined(WIN32)
+ XMapWindow(fl_display, fl_xid(this)); // extra map calls are harmless
#elif defined(__APPLE_QUARTZ__)
MacMapWindow(this, fl_xid(this));
#else
- XMapWindow(fl_display, fl_xid(this)); // extra map calls are harmless
+# error unsupported platform
#endif // __APPLE__
}
break;
@@ -1053,13 +1297,13 @@ int Fl_Window::handle(int ev)
Fl_Widget* p = parent(); for (;p->visible();p = p->parent()) {}
if (p->type() >= FL_WINDOW) break; // don't do the unmap
}
-#ifdef __APPLE_QD__
- MacUnmapWindow(this, fl_xid(this));
+#if defined(USE_X11) || defined(WIN32)
+ XUnmapWindow(fl_display, fl_xid(this));
#elif defined(__APPLE_QUARTZ__)
MacUnmapWindow(this, fl_xid(this));
#else
- XUnmapWindow(fl_display, fl_xid(this));
-#endif // __APPLE__
+# error platform unsupported
+#endif
}
break;
}
@@ -1071,15 +1315,44 @@ int Fl_Window::handle(int ev)
}
////////////////////////////////////////////////////////////////
-// Back compatability cut & paste functions for fltk 1.1 only:
+// Back compatibility cut & paste functions for fltk 1.1 only:
+/** Back-compatibility only: The single-argument call can be used to
+ move the selection to another widget or to set the owner to
+ NULL, without changing the actual text of the
+ selection. FL_SELECTIONCLEAR is sent to the previous
+ selection owner, if any.
+
+ Copying the buffer every time the selection is changed is
+ obviously wasteful, especially for large selections. An interface will
+ probably be added in a future version to allow the selection to be made
+ by a callback function. The current interface will be emulated on top
+ of this.
+*/
void Fl::selection_owner(Fl_Widget *owner) {selection_owner_ = owner;}
+/**
+ Changes the current selection. The block of text is
+ copied to an internal buffer by FLTK (be careful if doing this in
+ response to an FL_PASTE as this \e may be the same buffer
+ returned by event_text()). The selection_owner()
+ widget is set to the passed owner.
+*/
void Fl::selection(Fl_Widget &owner, const char* text, int len) {
selection_owner_ = &owner;
Fl::copy(text, len, 0);
}
+/** Backward compatibility only:
+ Set things up so the receiver widget will be called with an FL_PASTE event some
+ time in the future for the specified clipboard. The reciever
+ should be prepared to be called \e directly by this, or for
+ it to happen \e later, or possibly not at all. This
+ allows the window system to take as long as necessary to retrieve
+ the paste buffer (or even to screw up completely) without complex
+ and error-prone synchronization code in FLTK.
+ \see Fl::paste(Fl_Widget &receiver, int clipboard)
+*/
void Fl::paste(Fl_Widget &receiver) {
Fl::paste(receiver, 0);
}
@@ -1171,24 +1444,21 @@ void Fl_Widget::damage(uchar fl, int X, int Y, int W, int H) {
if (wi->damage()) {
// if we already have damage we must merge with existing region:
if (i->region) {
-#ifdef WIN32
+#if defined(USE_X11)
+ XRectangle R;
+ R.x = X; R.y = Y; R.width = W; R.height = H;
+ XUnionRectWithRegion(&R, i->region, i->region);
+#elif defined(WIN32)
Fl_Region R = XRectangleRegion(X, Y, W, H);
CombineRgn(i->region, i->region, R, RGN_OR);
XDestroyRegion(R);
-#elif defined(__APPLE_QD__)
- Fl_Region R = NewRgn();
- SetRectRgn(R, X, Y, X+W, Y+H);
- UnionRgn(R, i->region, i->region);
- DisposeRgn(R);
#elif defined(__APPLE_QUARTZ__)
Fl_Region R = NewRgn();
SetRectRgn(R, X, Y, X+W, Y+H);
UnionRgn(R, i->region, i->region);
DisposeRgn(R);
#else
- XRectangle R;
- R.x = X; R.y = Y; R.width = W; R.height = H;
- XUnionRectWithRegion(&R, i->region, i->region);
+# error unsupported platform
#endif
}
wi->damage_ |= fl;
@@ -1200,7 +1470,6 @@ void Fl_Widget::damage(uchar fl, int X, int Y, int W, int H) {
}
Fl::damage(FL_DAMAGE_CHILD);
}
-
void Fl_Window::flush() {
make_current();
//if (damage() == FL_DAMAGE_EXPOSE && can_boxcheat(box())) fl_boxcheat = this;
@@ -1222,8 +1491,17 @@ void Fl_Window::flush() {
static int num_dwidgets = 0, alloc_dwidgets = 0;
static Fl_Widget **dwidgets = 0;
-void
-Fl::delete_widget(Fl_Widget *wi) {
+/**
+ Schedules a widget for deletion at the next call to the event loop.
+ Use this method to delete a widget inside a callback function.
+ To avoid early deletion of widgets, this function
+ should be called toward the end of a callback and only after any call
+ to the event loop (Fl:wait(), Fl::flush(), fl_ask(), etc).
+
+ When deleting groups or windows, you must only delete the group or
+ window widget and not the individual child widgets.
+*/
+void Fl::delete_widget(Fl_Widget *wi) {
if (!wi) return;
if (num_dwidgets >= alloc_dwidgets) {
@@ -1243,9 +1521,18 @@ Fl::delete_widget(Fl_Widget *wi) {
num_dwidgets ++;
}
+/**
+ Deletes widgets previously scheduled for deletion.
+
+ This is for internal use only. You should never call this directly.
-void
-Fl::do_widget_deletion() {
+ Fl::do_widget_deletion() is called from the FLTK event loop or whenever
+ you call Fl::wait(). The previously scheduled widgets are deleted in the
+ same order they were scheduled by calling Fl::delete_widget().
+
+ \see Fl::delete_widget(Fl_Widget *wi)
+*/
+void Fl::do_widget_deletion() {
if (!num_dwidgets) return;
for (int i = 0; i < num_dwidgets; i ++)
@@ -1258,6 +1545,51 @@ static Fl_Widget ***widget_watch = 0;
static int num_widget_watch = 0;
static int max_widget_watch = 0;
+/**
+ Adds a widget pointer to the widget watch list.
+
+ \note Internal use only, please use class Fl_Widget_Tracker instead.
+
+ This can be used, if it is possible that a widget might be deleted during
+ a callback or similar function. The widget pointer must be added to the
+ watch list before calling the callback. After the callback the widget
+ pointer can be queried, if it is NULL. \e If it is NULL, then the widget has been
+ deleted during the callback and must not be accessed anymore. If the widget
+ pointer is \e not NULL, then the widget has not been deleted and can be accessed
+ safely.
+
+ After accessing the widget, the widget pointer must be released from the
+ watch list by calling Fl::release_widget_pointer().
+
+ Example for a button that is clicked (from its handle() method):
+ \code
+ Fl_Widget *wp = this; // save 'this' in a pointer variable
+ Fl::watch_widget_pointer(wp); // add the pointer to the watch list
+ set_changed(); // set the changed flag
+ do_callback(); // call the callback
+ if (!wp) { // the widget has been deleted
+
+ // DO NOT ACCESS THE DELETED WIDGET !
+
+ } else { // the widget still exists
+ clear_changed(); // reset the changed flag
+ }
+
+ Fl::release_widget_pointer(wp); // remove the pointer from the watch list
+ \endcode
+
+ This works, because all widgets call Fl::clear_widget_pointer() in their
+ destructors.
+
+ \see Fl::release_widget_pointer()
+ \see Fl::clear_widget_pointer()
+
+ An easier and more convenient method to control widget deletion during
+ callbacks is to use the class Fl_Widget_Tracker with a local (automatic)
+ variable.
+
+ \see class Fl_Widget_Tracker
+*/
void Fl::watch_widget_pointer(Fl_Widget *&w)
{
Fl_Widget **wp = &w;
@@ -1265,31 +1597,67 @@ void Fl::watch_widget_pointer(Fl_Widget *&w)
for (i=0; i %8p\n",
+ num_widget_watch,num_widget_watch,wp,*wp);
+ fflush(stdout);
+#endif // DEBUG
}
+/**
+ Releases a widget pointer from the watch list.
+
+ This is used to remove a widget pointer that has been added to the watch list
+ with Fl::watch_widget_pointer(), when it is not needed anymore.
+
+ \note Internal use only, please use class Fl_Widget_Tracker instead.
+
+ \see Fl::watch_widget_pointer()
+*/
void Fl::release_widget_pointer(Fl_Widget *&w)
{
Fl_Widget **wp = &w;
- int i;
+ int i,j=0;
for (i=0; i %8p\n",
+ i+1,num_widget_watch,wp,*wp);
+ }
+#endif //DEBUG
}
+ num_widget_watch = j;
+#ifdef DEBUG
+ printf (" num_widget_watch = %d\n\n",num_widget_watch);
+ fflush(stdout);
+#endif // DEBUG
+ return;
}
+/**
+ Clears a widget pointer \e in the watch list.
+ This is called when a widget is destroyed (by its destructor). You should never
+ call this directly.
+
+ \note Internal use only !
+
+ This method searches the widget watch list for pointers to the widget and
+ clears each pointer that points to it. Widget pointers can be added to the
+ widget watch list by calling Fl::watch_widget_pointer() or by using the
+ helper class Fl_Widget_Tracker (recommended).
+
+ \see Fl::watch_widget_pointer()
+ \see class Fl_Widget_Tracker
+*/
void Fl::clear_widget_pointer(Fl_Widget const *w)
{
if (w==0L) return;
@@ -1301,7 +1669,25 @@ void Fl::clear_widget_pointer(Fl_Widget const *w)
}
}
+// Helper class Fl_Widget_Tracker
+
+/**
+ The constructor adds a widget to the watch list.
+*/
+Fl_Widget_Tracker::Fl_Widget_Tracker(Fl_Widget *wi) {
+
+ wp_ = wi;
+ Fl::watch_widget_pointer(wp_); // add pointer to watch list
+}
+
+/**
+ The destructor removes a widget from the watch list.
+*/
+Fl_Widget_Tracker::~Fl_Widget_Tracker() {
+
+ Fl::release_widget_pointer(wp_); // remove pointer from watch list
+}
//
-// End of "$Id: Fl.cxx 5654 2007-02-02 13:52:37Z matt $".
+// End of "$Id: Fl.cxx 6787 2009-05-14 20:16:09Z engelsman $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Adjuster.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Adjuster.cxx
index 5a2bfab4f..f6d9ec3ac 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Adjuster.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Adjuster.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Adjuster.cxx 5190 2006-06-09 16:16:34Z mike $"
+// "$Id: Fl_Adjuster.cxx 6616 2009-01-01 21:28:26Z matt $"
//
// Adjuster widget for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,7 +25,6 @@
// http://www.fltk.org/str.php
//
-
#include
#include
#include
@@ -157,6 +156,12 @@ int Fl_Adjuster::handle(int event) {
return 0;
}
+/**
+ Creates a new Fl_Adjuster widget using the given position,
+ size, and label string. It looks best if one of the dimensions is 3
+ times the other.
+ Inherited destructor destroys the Valuator.
+*/
Fl_Adjuster::Fl_Adjuster(int X, int Y, int W, int H, const char* l)
: Fl_Valuator(X, Y, W, H, l) {
box(FL_UP_BOX);
@@ -167,5 +172,5 @@ Fl_Adjuster::Fl_Adjuster(int X, int Y, int W, int H, const char* l)
}
//
-// End of "$Id: Fl_Adjuster.cxx 5190 2006-06-09 16:16:34Z mike $".
+// End of "$Id: Fl_Adjuster.cxx 6616 2009-01-01 21:28:26Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Bitmap.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Bitmap.cxx
index 407081d55..fe054f3d6 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Bitmap.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Bitmap.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Bitmap.cxx 5190 2006-06-09 16:16:34Z mike $"
+// "$Id: Fl_Bitmap.cxx 6616 2009-01-01 21:28:26Z matt $"
//
// Bitmap drawing routines for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,6 +25,12 @@
// http://www.fltk.org/str.php
//
+/** \fn Fl_Bitmap::Fl_Bitmap(const char *array, int W, int H)
+ The constructors create a new bitmap from the specified bitmap data.*/
+
+/** \fn Fl_Bitmap::Fl_Bitmap(const unsigned char *array, int W, int H)
+ The constructors create a new bitmap from the specified bitmap data.*/
+
#include
#include
#include
@@ -33,53 +39,7 @@
#include
#include "flstring.h"
-#ifdef __APPLE_QD__ // MacOS bitmask functions
-Fl_Bitmask fl_create_bitmask(int w, int h, const uchar *array) {
- Rect srcRect;
- srcRect.left = 0; srcRect.right = w;
- srcRect.top = 0; srcRect.bottom = h;
- GrafPtr savePort;
-
- GetPort(&savePort); // remember the current port
-
- Fl_Bitmask gw;
- NewGWorld( &gw, 1, &srcRect, 0L, 0L, 0 );
- PixMapHandle pm = GetGWorldPixMap( gw );
- if ( pm )
- {
- LockPixels( pm );
- if ( *pm )
- {
- uchar *base = (uchar*)GetPixBaseAddr( pm );
- if ( base )
- {
- PixMapPtr pmp = *pm;
- // verify the parameters for direct memory write
- if ( pmp->pixelType == 0 || pmp->pixelSize == 1 || pmp->cmpCount == 1 || pmp->cmpSize == 1 )
- {
- static uchar reverse[16] = /* Bit reversal lookup table */
- { 0x00, 0x88, 0x44, 0xcc, 0x22, 0xaa, 0x66, 0xee, 0x11, 0x99, 0x55, 0xdd, 0x33, 0xbb, 0x77, 0xff };
- uchar *dst = base;
- const uchar *src = array;
- int rowBytesSrc = (w+7)>>3 ;
- int rowPatch = (pmp->rowBytes&0x3fff) - rowBytesSrc;
- for ( int j=0; j> 4) & 0x0f] & 0x0f);
- }
- }
- UnlockPixels( pm );
- }
- }
-
- SetPort(savePort);
- return gw; /* tell caller we succeeded! */
-}
-
-void fl_delete_bitmask(Fl_Bitmask id) {
- if (id) DisposeGWorld(id);
-}
-#elif defined(__APPLE_QUARTZ__)
+#if defined(__APPLE_QUARTZ__)
Fl_Bitmask fl_create_bitmask(int w, int h, const uchar *array) {
static uchar reverse[16] = /* Bit reversal lookup table */
{ 0x00, 0x88, 0x44, 0xcc, 0x22, 0xaa, 0x66, 0xee,
@@ -230,54 +190,6 @@ void fl_delete_bitmask(Fl_Bitmask bm) {
#endif // __APPLE__
-// MRS: Currently it appears that CopyDeepMask() does not work with an 8-bit alpha mask.
-// If you want to test/fix this, uncomment the "#ifdef __APPLE__" and comment out
-// the "#if 0" here. Also see Fl_Image.cxx for a similar check...
-
-//#ifdef __APPLE_QD__
-#if 0
-// Create an 8-bit mask used for alpha blending
-Fl_Bitmask fl_create_alphamask(int w, int h, int d, int ld, const uchar *array) {
- Rect srcRect;
- srcRect.left = 0; srcRect.right = w;
- srcRect.top = 0; srcRect.bottom = h;
- GrafPtr savePort;
-
- GetPort(&savePort); // remember the current port
-
- Fl_Bitmask gw;
- NewGWorld( &gw, 8, &srcRect, 0L, 0L, 0 );
- PixMapHandle pm = GetGWorldPixMap( gw );
- if ( pm )
- {
- LockPixels( pm );
- if ( *pm )
- {
- uchar *base = (uchar*)GetPixBaseAddr( pm );
- if ( base )
- {
- PixMapPtr pmp = *pm;
- // verify the parameters for direct memory write
- if ( pmp->pixelType == 0 || pmp->pixelSize == 8 || pmp->cmpCount == 1 || pmp->cmpSize == 8 )
- {
- // Copy alpha values from the source array to the pixmap...
- array += d - 1;
- int rowoffset = (pmp->rowBytes & 0x3fff) - w;
- for (int y = h; y > 0; y --, array += ld, base += rowoffset) {
- for (int x = w; x > 0; x --, array += d) {
- *base++ = 255 /*255 - *array*/;
- }
- }
- }
- }
- UnlockPixels( pm );
- }
- }
-
- SetPort(savePort);
- return gw; /* tell caller we succeeded! */
-}
-#else
// Create a 1-bit mask used for alpha blending
Fl_Bitmask fl_create_alphamask(int w, int h, int d, int ld, const uchar *array) {
Fl_Bitmask mask;
@@ -350,7 +262,6 @@ Fl_Bitmask fl_create_alphamask(int w, int h, int d, int ld, const uchar *array)
return (mask);
}
-#endif // __APPLE__
void Fl_Bitmap::draw(int XP, int YP, int WP, int HP, int cx, int cy) {
if (!array) {
@@ -368,7 +279,18 @@ void Fl_Bitmap::draw(int XP, int YP, int WP, int HP, int cx, int cy) {
if (cy < 0) {H += cy; Y -= cy; cy = 0;}
if ((cy+H) > h()) H = h()-cy;
if (H <= 0) return;
-#ifdef WIN32
+
+#if defined(USE_X11)
+ if (!id) id = fl_create_bitmask(w(), h(), array);
+
+ XSetStipple(fl_display, fl_gc, id);
+ int ox = X-cx; if (ox < 0) ox += w();
+ int oy = Y-cy; if (oy < 0) oy += h();
+ XSetTSOrigin(fl_display, fl_gc, ox, oy);
+ XSetFillStyle(fl_display, fl_gc, FillStippled);
+ XFillRectangle(fl_display, fl_window, fl_gc, X, Y, W, H);
+ XSetFillStyle(fl_display, fl_gc, FillSolid);
+#elif defined(WIN32)
if (!id) id = fl_create_bitmap(w(), h(), array);
HDC tempdc = CreateCompatibleDC(fl_gc);
@@ -379,20 +301,6 @@ void Fl_Bitmap::draw(int XP, int YP, int WP, int HP, int cx, int cy) {
BitBlt(fl_gc, X, Y, W, H, tempdc, cx, cy, 0xE20746L);
RestoreDC(tempdc, save);
DeleteDC(tempdc);
-#elif defined(__APPLE_QD__)
- if (!id) id = fl_create_bitmask(w(), h(), array);
- GrafPtr dstPort;
- GetPort( &dstPort );
- Rect src, dst;
- GetPortBounds( (Fl_Offscreen)id, &src );
- SetRect( &src, cx, cy, cx+W, cy+H );
- SetRect( &dst, X, Y, X+W, Y+H );
- CopyBits(GetPortBitMapForCopyBits((Fl_Offscreen)id), // srcBits
- GetPortBitMapForCopyBits(dstPort), // dstBits
- &src, // src bounds
- &dst, // dst bounds
- srcOr, // mode
- 0L); // mask region
#elif defined(__APPLE_QUARTZ__)
if (!id) id = fl_create_bitmask(w(), h(), array);
if (id && fl_gc) {
@@ -402,18 +310,14 @@ void Fl_Bitmap::draw(int XP, int YP, int WP, int HP, int cx, int cy) {
Fl_X::q_end_image();
}
#else
- if (!id) id = fl_create_bitmask(w(), h(), array);
-
- XSetStipple(fl_display, fl_gc, id);
- int ox = X-cx; if (ox < 0) ox += w();
- int oy = Y-cy; if (oy < 0) oy += h();
- XSetTSOrigin(fl_display, fl_gc, ox, oy);
- XSetFillStyle(fl_display, fl_gc, FillStippled);
- XFillRectangle(fl_display, fl_window, fl_gc, X, Y, W, H);
- XSetFillStyle(fl_display, fl_gc, FillSolid);
+# error unsupported platform
#endif
}
+/**
+ The destructor free all memory and server resources that are used by
+ the bitmap.
+*/
Fl_Bitmap::~Fl_Bitmap() {
uncache();
if (alloc_array) delete[] (uchar *)array;
@@ -514,5 +418,5 @@ Fl_Image *Fl_Bitmap::copy(int W, int H) {
//
-// End of "$Id: Fl_Bitmap.cxx 5190 2006-06-09 16:16:34Z mike $".
+// End of "$Id: Fl_Bitmap.cxx 6616 2009-01-01 21:28:26Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Box.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Box.cxx
index 34b63d7e1..2e9245229 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Box.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Box.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Box.cxx 5190 2006-06-09 16:16:34Z mike $"
+// "$Id: Fl_Box.cxx 6616 2009-01-01 21:28:26Z matt $"
//
// Box widget for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -40,5 +40,5 @@ int Fl_Box::handle(int event) {
//
-// End of "$Id: Fl_Box.cxx 5190 2006-06-09 16:16:34Z mike $".
+// End of "$Id: Fl_Box.cxx 6616 2009-01-01 21:28:26Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Browser.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Browser.cxx
index b0006d698..14a2db47c 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Browser.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Browser.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Browser.cxx 5987 2007-11-20 21:57:17Z mike $"
+// "$Id: Fl_Browser.cxx 6726 2009-03-27 16:52:31Z greg.ercolano $"
//
// Browser widget for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2007 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -34,12 +34,11 @@
// I modified this from the original Forms data to use a linked list
// so that the number of items in the browser and size of those items
-// is unlimited. The only problem is that the old browser used an
+// is unlimited. The only problem is that the old browser used an
// index number to identify a line, and it is slow to convert from/to
-// a pointer. I use a cache of the last match to try to speed this
-// up.
+// a pointer. I use a cache of the last match to try to speed this up.
-// Also added the ability to "hide" a line. This set's it's height to
+// Also added the ability to "hide" a line. This sets its height to
// zero, so the Fl_Browser_ cannot pick it.
#define SELECTED 1
@@ -54,20 +53,94 @@ struct FL_BLINE { // data is in a linked list of these
char txt[1]; // start of allocated array
};
+/**
+ Returns the very first item in the list.
+ Example of use:
+ \code
+ // Walk the browser from beginning to end
+ for ( void *i=item_first(); i; i=item_next(i) ) {
+ printf("item label='%s'\n", item_text(i));
+ }
+ \endcode
+ \returns The first item, or NULL if list is empty.
+ \see item_first(), item_last(), item_next(), item_prev()
+*/
void* Fl_Browser::item_first() const {return first;}
-void* Fl_Browser::item_next(void* l) const {return ((FL_BLINE*)l)->next;}
+/**
+ Returns the next item after \p item.
+ \param[in] item The 'current' item
+ \returns The next item after \p item, or NULL if there are none after this one.
+ \see item_first(), item_last(), item_next(), item_prev()
+*/
+void* Fl_Browser::item_next(void* item) const {return ((FL_BLINE*)item)->next;}
-void* Fl_Browser::item_prev(void* l) const {return ((FL_BLINE*)l)->prev;}
+/**
+ Returns the previous item before \p item.
+ \param[in] item The 'current' item
+ \returns The previous item before \p item, or NULL if there none before this one.
+ \see item_first(), item_last(), item_next(), item_prev()
+*/
+void* Fl_Browser::item_prev(void* item) const {return ((FL_BLINE*)item)->prev;}
-int Fl_Browser::item_selected(void* l) const {
- return ((FL_BLINE*)l)->flags&SELECTED;}
+/**
+ Returns the very last item in the list.
+ Example of use:
+ \code
+ // Walk the browser in reverse, from end to start
+ for ( void *i=item_last(); i; i=item_prev(i) ) {
+ printf("item label='%s'\n", item_text(i));
+ }
+ \endcode
+ \returns The last item, or NULL if list is empty.
+ \see item_first(), item_last(), item_next(), item_prev()
+*/
+void* Fl_Browser::item_last() const {return last;}
-void Fl_Browser::item_select(void* l, int v) {
- if (v) ((FL_BLINE*)l)->flags |= SELECTED;
- else ((FL_BLINE*)l)->flags &= ~SELECTED;
+/**
+ See if \p item is selected.
+ \param[in] item The item whose selection state is to be checked.
+ \returns 1 if selected, 0 if not.
+ \see select(), selected(), value(), item_select(), item_selected()
+*/
+int Fl_Browser::item_selected(void* item) const {
+ return ((FL_BLINE*)item)->flags&SELECTED;
+}
+/**
+ Change the selection state of \p item to the value \p val.
+ \param[in] item The item to be changed.
+ \param[in] val The new selection state: 1 selects, 0 de-selects.
+ \see select(), selected(), value(), item_select(), item_selected()
+*/
+void Fl_Browser::item_select(void *item, int val) {
+ if (val) ((FL_BLINE*)item)->flags |= SELECTED;
+ else ((FL_BLINE*)item)->flags &= ~SELECTED;
}
+/**
+ Returns the label text for \p item.
+ \param[in] item The item whose label text is returned.
+ \returns The item's text string. (Can be NULL)
+*/
+const char *Fl_Browser::item_text(void *item) const {
+ return ((FL_BLINE*)item)->txt;
+}
+
+/**
+ Returns the item for specified \p line.
+
+ Note: This call is slow. It's fine for e.g. responding to user
+ clicks, but slow if called often, such as in a tight sorting loop.
+ Finding an item 'by line' involves a linear lookup on the internal
+ linked list. The performance hit can be significant if the browser's
+ contents is large, and the method is called often (e.g. during a sort).
+ If you're writing a subclass, use the protected methods item_first(),
+ item_next(), etc. to access the internal linked list more efficiently.
+
+ \param[in] line The line number of the item to return. (1 based)
+ \returns The returned item.
+ \see item_at(), find_line(), lineno()
+*/
FL_BLINE* Fl_Browser::find_line(int line) const {
int n; FL_BLINE* l;
if (line == cacheline) return cache;
@@ -85,8 +158,15 @@ FL_BLINE* Fl_Browser::find_line(int line) const {
return l;
}
-int Fl_Browser::lineno(void* v) const {
- FL_BLINE* l = (FL_BLINE*)v;
+/**
+ Returns line number corresponding to \p item, or zero if not found.
+ Caveat: See efficiency note in find_line().
+ \param[in] item The item to be found
+ \returns The line number of the item, or 0 if not found.
+ \see item_at(), find_line(), lineno()
+*/
+int Fl_Browser::lineno(void *item) const {
+ FL_BLINE* l = (FL_BLINE*)item;
if (!l) return 0;
if (l == cache) return cacheline;
if (l == first) return 1;
@@ -95,7 +175,7 @@ int Fl_Browser::lineno(void* v) const {
((Fl_Browser*)this)->cache = first;
((Fl_Browser*)this)->cacheline = 1;
}
- // assumme it is near cache, search both directions:
+ // assume it is near cache, search both directions:
FL_BLINE* b = cache->prev;
int bnum = cacheline-1;
FL_BLINE* f = cache->next;
@@ -112,6 +192,14 @@ int Fl_Browser::lineno(void* v) const {
return n;
}
+/**
+ Removes the item at the specified \p line.
+ Caveat: See efficiency note in find_line().
+ You must call redraw() to make any changes visible.
+ \param[in] line The line number to be removed. (1 based) Must be in range!
+ \returns Pointer to browser item that was removed (and is no longer valid).
+ \see add(), insert(), remove(), swap(int,int), clear()
+*/
FL_BLINE* Fl_Browser::_remove(int line) {
FL_BLINE* ttt = find_line(line);
deleting(ttt);
@@ -128,41 +216,70 @@ FL_BLINE* Fl_Browser::_remove(int line) {
return(ttt);
}
+/**
+ Remove entry for given \p line number, making the browser one line shorter.
+ You must call redraw() to make any changes visible.
+ \param[in] line Line to be removed. (1 based) \n
+ If \p line is out of range, no action is taken.
+ \see add(), insert(), remove(), swap(int,int), clear()
+*/
void Fl_Browser::remove(int line) {
if (line < 1 || line > lines) return;
free(_remove(line));
}
-void Fl_Browser::insert(int line, FL_BLINE* t) {
+/**
+ Insert specified \p item above \p line.
+ If \p line > size() then the line is added to the end.
+
+ Caveat: See efficiency note in find_line().
+
+ \param[in] line The new line will be inserted above this line (1 based).
+ \param[in] item The item to be added.
+*/
+void Fl_Browser::insert(int line, FL_BLINE* item) {
if (!first) {
- t->prev = t->next = 0;
- first = last = t;
+ item->prev = item->next = 0;
+ first = last = item;
} else if (line <= 1) {
- inserting(first, t);
- t->prev = 0;
- t->next = first;
- t->next->prev = t;
- first = t;
+ inserting(first, item);
+ item->prev = 0;
+ item->next = first;
+ item->next->prev = item;
+ first = item;
} else if (line > lines) {
- t->prev = last;
- t->prev->next = t;
- t->next = 0;
- last = t;
+ item->prev = last;
+ item->prev->next = item;
+ item->next = 0;
+ last = item;
} else {
FL_BLINE* n = find_line(line);
- inserting(n, t);
- t->next = n;
- t->prev = n->prev;
- t->prev->next = t;
- n->prev = t;
+ inserting(n, item);
+ item->next = n;
+ item->prev = n->prev;
+ item->prev->next = item;
+ n->prev = item;
}
cacheline = line;
- cache = t;
+ cache = item;
lines++;
- full_height_ += item_height(t);
- redraw_line(t);
+ full_height_ += item_height(item);
+ redraw_line(item);
}
+/**
+ Insert a new entry whose label is \p newtext \e above given \p line, optional data \p d.
+
+ Text may contain format characters; see format_char() for details.
+ \p newtext is copied using the strdup() function, and can be NULL to make a blank line.
+
+ The optional void * argument \p d will be the data() of the new item.
+
+ \param[in] line Line position for insert. (1 based) \n
+ If \p line > size(), the entry will be added at the end.
+ \param[in] newtext The label text for the new line.
+ \param[in] d Optional pointer to user data to be associated with the new line.
+*/
void Fl_Browser::insert(int line, const char* newtext, void* d) {
int l = strlen(newtext);
FL_BLINE* t = (FL_BLINE*)malloc(sizeof(FL_BLINE)+l);
@@ -173,11 +290,28 @@ void Fl_Browser::insert(int line, const char* newtext, void* d) {
insert(line, t);
}
+/**
+ Line \p from is removed and reinserted at \p to.
+ Note: \p to is calculated \e after line \p from gets removed.
+ \param[in] to Destination line number (calculated \e after line \p from is removed)
+ \param[in] from Line number of item to be moved
+*/
void Fl_Browser::move(int to, int from) {
if (from < 1 || from > lines) return;
insert(to, _remove(from));
}
+/**
+ Sets the text for the specified \p line to \p newtext.
+
+ Text may contain format characters; see format_char() for details.
+ \p newtext is copied using the strdup() function, and can be NULL to make a blank line.
+
+ Does nothing if \p line is out of range.
+
+ \param[in] line The line of the item whose text will be changed. (1 based)
+ \param[in] newtext The new string to be assigned to the item.
+*/
void Fl_Browser::text(int line, const char* newtext) {
if (line < 1 || line > lines) return;
FL_BLINE* t = find_line(line);
@@ -200,13 +334,27 @@ void Fl_Browser::text(int line, const char* newtext) {
redraw_line(t);
}
+/**
+ Sets the user data for specified \p line to \p d.
+ Does nothing if \p line is out of range.
+ \param[in] line The line of the item whose data() is to be changed. (1 based)
+ \param[in] d The new data to be assigned to the item. (can be NULL)
+*/
void Fl_Browser::data(int line, void* d) {
if (line < 1 || line > lines) return;
find_line(line)->data = d;
}
-int Fl_Browser::item_height(void* lv) const {
- FL_BLINE* l = (FL_BLINE*)lv;
+/**
+ Returns height of \p item in pixels.
+ This takes into account embedded \@ codes within the text() label.
+ \param[in] item The item whose height is returned.
+ \returns The height of the item in pixels.
+ \see item_height(), item_width(),\n
+ incr_height(), full_height()
+*/
+int Fl_Browser::item_height(void *item) const {
+ FL_BLINE* l = (FL_BLINE*)item;
if (l->flags & NOTDISPLAYED) return 0;
int hmax = 2; // use 2 to insure we don't return a zero!
@@ -255,12 +403,20 @@ int Fl_Browser::item_height(void* lv) const {
return hmax; // previous version returned hmax+2!
}
-int Fl_Browser::item_width(void* v) const {
- char* str = ((FL_BLINE*)v)->txt;
+/**
+ Returns width of \p item in pixels.
+ This takes into account embedded \@ codes within the text() label.
+ \param[in] item The item whose width is returned.
+ \returns The width of the item in pixels.
+ \see item_height(), item_width(),\n
+ incr_height(), full_height()
+*/
+int Fl_Browser::item_width(void *item) const {
+ char* str = ((FL_BLINE*)item)->txt;
const int* i = column_widths();
int ww = 0;
- while (*i) { // add up all tab-seperated fields
+ while (*i) { // add up all tab-separated fields
char* e;
e = strchr(str, column_char());
if (!e) break; // last one occupied by text
@@ -305,19 +461,41 @@ int Fl_Browser::item_width(void* v) const {
return ww + int(fl_width(str)) + 6;
}
+/**
+ The height of the entire list of all visible() items in pixels.
+ This returns the accumulated height of *all* the items in the browser
+ that are not hidden with hide(), including items scrolled off screen.
+ \returns The accumulated size of all the visible items in pixels.
+ \see item_height(), item_width(),\n
+ incr_height(), full_height()
+*/
int Fl_Browser::full_height() const {
return full_height_;
}
+/**
+ The default 'average' item height (including inter-item spacing) in pixels.
+ This currently returns textsize() + 2.
+ \returns The value in pixels.
+ \see item_height(), item_width(),\n
+ incr_height(), full_height()
+*/
int Fl_Browser::incr_height() const {
return textsize()+2;
}
-void Fl_Browser::item_draw(void* v, int X, int Y, int W, int H) const {
- char* str = ((FL_BLINE*)v)->txt;
+/**
+ Draws \p item at the position specified by \p X \p Y \p W \p H.
+ The \p W and \p H values are used for clipping.
+ Should only be called within the context of an FLTK draw().
+ \param[in] item The item to be drawn
+ \param[in] X,Y,W,H position and size.
+*/
+void Fl_Browser::item_draw(void* item, int X, int Y, int W, int H) const {
+ char* str = ((FL_BLINE*)item)->txt;
const int* i = column_widths();
- while (W > 6) { // do each tab-seperated field
+ while (W > 6) { // do each tab-separated field
int w1 = W; // width for this field
char* e = 0; // pointer to end of field or null if none
if (*i) { // find end of field and temporarily replace with 0
@@ -329,6 +507,9 @@ void Fl_Browser::item_draw(void* v, int X, int Y, int W, int H) const {
Fl_Color lcol = textcolor();
Fl_Align talign = FL_ALIGN_LEFT;
// check for all the @-lines recognized by XForms:
+ //#if defined(__GNUC__)
+ //#warning FIXME This maybe needs to be more UTF8 aware now...?
+ //#endif /*__GNUC__*/
while (*str == format_char() && *++str && *str != format_char()) {
switch (*str++) {
case 'l': case 'L': tsize = 24; break;
@@ -340,7 +521,7 @@ void Fl_Browser::item_draw(void* v, int X, int Y, int W, int H) const {
case 'c': talign = FL_ALIGN_CENTER; break;
case 'r': talign = FL_ALIGN_RIGHT; break;
case 'B':
- if (!(((FL_BLINE*)v)->flags & SELECTED)) {
+ if (!(((FL_BLINE*)item)->flags & SELECTED)) {
fl_color((Fl_Color)strtol(str, &str, 10));
fl_rectf(X, Y, w1, H);
} else strtol(str, &str, 10);
@@ -376,13 +557,13 @@ void Fl_Browser::item_draw(void* v, int X, int Y, int W, int H) const {
}
BREAK:
fl_font(font, tsize);
- if (((FL_BLINE*)v)->flags & SELECTED)
+ if (((FL_BLINE*)item)->flags & SELECTED)
lcol = fl_contrast(lcol, selection_color());
if (!active_r()) lcol = fl_inactive(lcol);
fl_color(lcol);
fl_draw(str, X+3, Y, w1-6, H, e ? Fl_Align(talign|FL_ALIGN_CLIP) : talign, 0, 0);
if (!e) break; // no more fields...
- *e = column_char(); // put the seperator back
+ *e = column_char(); // put the separator back
X += w1;
W -= w1;
str = e+1;
@@ -391,8 +572,13 @@ void Fl_Browser::item_draw(void* v, int X, int Y, int W, int H) const {
static const int no_columns[1] = {0};
-Fl_Browser::Fl_Browser(int X, int Y, int W, int H, const char*l)
- : Fl_Browser_(X, Y, W, H, l) {
+/**
+ The constructor makes an empty browser.
+ \param[in] X,Y,W,H position and size.
+ \param[in] L label string, may be NULL.
+*/
+Fl_Browser::Fl_Browser(int X, int Y, int W, int H, const char *L)
+: Fl_Browser_(X, Y, W, H, L) {
column_widths_ = no_columns;
lines = 0;
full_height_ = 0;
@@ -402,6 +588,13 @@ Fl_Browser::Fl_Browser(int X, int Y, int W, int H, const char*l)
first = last = cache = 0;
}
+/**
+ Updates the browser so that \p line is shown at position \p pos.
+ \param[in] line line number. (1 based)
+ \param[in] pos position.
+ \see topline(), middleline(), bottomline(), \n
++: Command not found.
+*/
void Fl_Browser::lineposition(int line, Fl_Line_Position pos) {
if (line<1) line = 1;
if (line>lines) line = lines;
@@ -426,10 +619,19 @@ void Fl_Browser::lineposition(int line, Fl_Line_Position pos) {
position(final);
}
+/**
+ Returns the line that is currently visible at the top of the browser.
+ If there is no vertical scrollbar then this will always return 1.
+ \returns The lineno() of the top() of the browser.
+*/
int Fl_Browser::topline() const {
return lineno(top());
}
+/**
+ Removes all the lines in the browser.
+ \see add(), insert(), remove(), swap(int,int), clear()
+*/
void Fl_Browser::clear() {
for (FL_BLINE* l = first; l;) {
FL_BLINE* n = l->next;
@@ -438,35 +640,85 @@ void Fl_Browser::clear() {
}
full_height_ = 0;
first = 0;
+ last = 0;
lines = 0;
new_list();
}
+/**
+ Adds a new line to the end of the browser.
+
+ The text string \p newtext may contain format characters; see format_char() for details.
+ \p newtext is copied using the strdup() function, and can be NULL to make a blank line.
+
+ The optional void* argument \p d will be the data() for the new item.
+
+ \param[in] newtext The label text used for the added item
+ \param[in] d Optional user data() for the item (0 if unspecified)
+ \see add(), insert(), remove(), swap(int,int), clear()
+*/
void Fl_Browser::add(const char* newtext, void* d) {
insert(lines+1, newtext, d);
//Fl_Browser_::display(last);
}
+/**
+ Returns the label text for the specified \p line.
+ Return value can be NULL if \p line is out of range or unset.
+ The parameter \p line is 1 based.
+ \param[in] line The line number of the item whose text is returned. (1 based)
+ \returns The text string (can be NULL)
+*/
const char* Fl_Browser::text(int line) const {
if (line < 1 || line > lines) return 0;
return find_line(line)->txt;
}
+/**
+ Returns the user data() for specified \p line.
+ Return value can be NULL if \p line is out of range or no user data() was defined.
+ The parameter \p line is 1 based (1 will be the first item in the list).
+ \param[in] line The line number of the item whose data() is returned. (1 based)
+ \returns The user data pointer (can be NULL)
+
+*/
void* Fl_Browser::data(int line) const {
if (line < 1 || line > lines) return 0;
return find_line(line)->data;
}
-int Fl_Browser::select(int line, int v) {
+/**
+ Sets the selection state of the item at \p line to the value \p val.
+ If \p val is not specified, the default is 1 (selects the item).
+ \param[in] line The line number of the item to be changed. (1 based)
+ \param[in] val The new selection state (1=select, 0=de-select).
+ \returns 1 if the state changed, 0 if not.
+ \see select(), selected(), value(), item_select(), item_selected()
+*/
+int Fl_Browser::select(int line, int val) {
if (line < 1 || line > lines) return 0;
- return Fl_Browser_::select(find_line(line), v);
+ return Fl_Browser_::select(find_line(line), val);
}
+/**
+ Returns 1 if specified \p line is selected, 0 if not.
+ \param[in] line The line being checked (1 based)
+ \returns 1 if item selected, 0 if not.
+ \see select(), selected(), value(), item_select(), item_selected()
+ */
int Fl_Browser::selected(int line) const {
if (line < 1 || line > lines) return 0;
return find_line(line)->flags & SELECTED;
}
+/**
+ Makes \p line visible, and available for selection by user.
+ Opposite of hide(int).
+ This changes the full_height() if the state was changed.
+ redraw() is called automatically if a change occurred.
+ \param[in] line The line to be shown. (1 based)
+ \see show(int), hide(int), display(), visible(), make_visible()
+*/
void Fl_Browser::show(int line) {
FL_BLINE* t = find_line(line);
if (t->flags & NOTDISPLAYED) {
@@ -476,6 +728,15 @@ void Fl_Browser::show(int line) {
}
}
+/**
+ Makes \p line invisible, preventing selection by the user.
+ The line can still be selected under program control.
+ This changes the full_height() if the state was changed.
+ When a line is made invisible, lines below it are moved up in the display.
+ redraw() is called automatically if a change occurred.
+ \param[in] line The line to be hidden. (1 based)
+ \see show(int), hide(int), display(), visible(), make_visible()
+*/
void Fl_Browser::hide(int line) {
FL_BLINE* t = find_line(line);
if (!(t->flags & NOTDISPLAYED)) {
@@ -485,21 +746,43 @@ void Fl_Browser::hide(int line) {
}
}
-void Fl_Browser::display(int line, int v) {
+/**
+ For back compatibility.
+ This calls show(line) if \p val is true, and hide(line) otherwise.
+ If \p val is not specified, the default is 1 (makes the line visible).
+ \see show(int), hide(int), display(), visible(), make_visible()
+*/
+void Fl_Browser::display(int line, int val) {
if (line < 1 || line > lines) return;
- if (v) show(line); else hide(line);
+ if (val) show(line); else hide(line);
}
+/**
+ Returns non-zero if the specified \p line is visible, 0 if hidden.
+ Use show(int), hide(int), or make_visible(int) to change an item's visible state.
+ \param[in] line The line in the browser to be tested. (1 based)
+ \see show(int), hide(int), display(), visible(), make_visible()
+*/
int Fl_Browser::visible(int line) const {
if (line < 1 || line > lines) return 0;
return !(find_line(line)->flags&NOTDISPLAYED);
}
+/**
+ Returns the line number of the currently selected line, or 0 if none.
+ \returns The line number of current selection, or 0 if none selected.
+ \see select(), selected(), value(), item_select(), item_selected()
+*/
int Fl_Browser::value() const {
return lineno(selection());
}
-// SWAP TWO LINES
+/**
+ Swap the two items \p a and \p b.
+ Uses swapping() to ensure list updates correctly.
+ \param[in] a,b The two items to be swapped.
+ \see swap(int,int), item_swap()
+*/
void Fl_Browser::swap(FL_BLINE *a, FL_BLINE *b) {
if ( a == b || !a || !b) return; // nothing to do
@@ -539,13 +822,19 @@ void Fl_Browser::swap(FL_BLINE *a, FL_BLINE *b) {
cache = 0;
}
-void Fl_Browser::swap(int ai, int bi) {
- if (ai < 1 || ai > lines || bi < 1 || bi > lines) return;
- FL_BLINE* a = find_line(ai);
- FL_BLINE* b = find_line(bi);
- swap(a,b);
+/**
+ Swaps two browser lines \p a and \p b.
+ You must call redraw() to make any changes visible.
+ \param[in] a,b The two lines to be swapped. (both 1 based)
+ \see swap(int,int), item_swap()
+*/
+void Fl_Browser::swap(int a, int b) {
+ if (a < 1 || a > lines || b < 1 || b > lines) return;
+ FL_BLINE* ai = find_line(a);
+ FL_BLINE* bi = find_line(b);
+ swap(ai,bi);
}
//
-// End of "$Id: Fl_Browser.cxx 5987 2007-11-20 21:57:17Z mike $".
+// End of "$Id: Fl_Browser.cxx 6726 2009-03-27 16:52:31Z greg.ercolano $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Browser_.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Browser_.cxx
index 5659293cb..2eb24415e 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Browser_.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Browser_.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Browser_.cxx 5992 2007-12-15 16:20:16Z mike $"
+// "$Id: Fl_Browser_.cxx 6737 2009-04-02 06:44:34Z greg.ercolano $"
//
// Base Browser widget class for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2006 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -36,7 +36,7 @@
// This is the base class for browsers. To be useful it must be
// subclassed and several virtual functions defined. The
-// Forms-compatable browser and the file chooser's browser are
+// Forms-compatible browser and the file chooser's browser are
// subclassed off of this.
// Yes, I know this should be a template...
@@ -67,39 +67,38 @@ static void hscrollbar_callback(Fl_Widget* s, void*) {
((Fl_Browser_*)(s->parent()))->hposition(int(((Fl_Scrollbar*)s)->value()));
}
-// Scrollbar size should be part of the Fl class, but is left here for
-// binary compatibility in 1.1.x - M. Sweet
-int Fl_Browser_::scrollbar_width_ = 16;
-
-// Get the standard scrollbar size
-int Fl::scrollbar_size() {
- return Fl_Browser_::scrollbar_width();
-}
-
-// Set the standard scrollbar size
-void Fl::scrollbar_size(int W) {
- Fl_Browser_::scrollbar_width(W);
-}
-
// return where to draw the actual box:
+/**
+ Returns the bounding box for the interior of the list's display window, inside
+ the scrollbars.
+ \param[out] X,Y,W,H The returned bounding box.\n
+ (The original contents of these parameters are overwritten)
+*/
void Fl_Browser_::bbox(int& X, int& Y, int& W, int& H) const {
+ int scrollsize = scrollbar_size_ ? scrollbar_size_ : Fl::scrollbar_size();
Fl_Boxtype b = box() ? box() : FL_DOWN_BOX;
X = x()+Fl::box_dx(b);
Y = y()+Fl::box_dy(b);
W = w()-Fl::box_dw(b);
H = h()-Fl::box_dh(b);
if (scrollbar.visible()) {
- W -= scrollbar_width_;
- if (scrollbar.align() & FL_ALIGN_LEFT) X += scrollbar_width_;
+ W -= scrollsize;
+ if (scrollbar.align() & FL_ALIGN_LEFT) X += scrollsize;
}
if (W < 0) W = 0;
if (hscrollbar.visible()) {
- H -= scrollbar_width_;
- if (scrollbar.align() & FL_ALIGN_TOP) Y += scrollbar_width_;
+ H -= scrollsize;
+ if (scrollbar.align() & FL_ALIGN_TOP) Y += scrollsize;
}
if (H < 0) H = 0;
}
+/**
+ This method returns the X position of the left edge of the list area
+ after adjusting for the scrollbar and border, if any.
+ \returns The X position of the left edge of the list, in pixels.
+ \see Fl_Browser_::bbox()
+*/
int Fl_Browser_::leftedge() const {
int X, Y, W, H; bbox(X, Y, W, H);
return X;
@@ -108,22 +107,33 @@ int Fl_Browser_::leftedge() const {
// The scrollbars may be moved again by draw(), since each one's size
// depends on whether the other is visible or not. This skips over
// Fl_Group::resize since it moves the scrollbars uselessly.
+/**
+ Repositions and/or resizes the browser.
+ \param[in] X,Y,W,H The new position and size for the browser, in pixels.
+*/
void Fl_Browser_::resize(int X, int Y, int W, int H) {
+ int scrollsize = scrollbar_size_ ? scrollbar_size_ : Fl::scrollbar_size();
Fl_Widget::resize(X, Y, W, H);
// move the scrollbars so they can respond to events:
bbox(X,Y,W,H);
scrollbar.resize(
- scrollbar.align()&FL_ALIGN_LEFT ? X-scrollbar_width_ : X+W,
- Y, scrollbar_width_, H);
+ scrollbar.align()&FL_ALIGN_LEFT ? X-scrollsize : X+W,
+ Y, scrollsize, H);
hscrollbar.resize(
- X, scrollbar.align()&FL_ALIGN_TOP ? Y-scrollbar_width_ : Y+H,
- W, scrollbar_width_);
+ X, scrollbar.align()&FL_ALIGN_TOP ? Y-scrollsize : Y+H,
+ W, scrollsize);
}
// Cause minimal update to redraw the given item:
-void Fl_Browser_::redraw_line(void* l) {
- if (!redraw1 || redraw1 == l) {redraw1 = l; damage(FL_DAMAGE_EXPOSE);}
- else if (!redraw2 || redraw2 == l) {redraw2 = l; damage(FL_DAMAGE_EXPOSE);}
+/**
+ This method should be called when the contents of \p item has changed,
+ but not its height.
+ \param[in] item The item that needs to be redrawn.
+ \see redraw_lines(), redraw_line()
+*/
+void Fl_Browser_::redraw_line(void* item) {
+ if (!redraw1 || redraw1 == item) {redraw1 = item; damage(FL_DAMAGE_EXPOSE);}
+ else if (!redraw2 || redraw2 == item) {redraw2 = item; damage(FL_DAMAGE_EXPOSE);}
else damage(FL_DAMAGE_SCROLL);
}
@@ -183,26 +193,51 @@ void Fl_Browser_::update_top() {
// Change position(), top() will update when update_top() is called
// (probably by draw() or handle()):
-void Fl_Browser_::position(int yy) {
- if (yy < 0) yy = 0;
- if (yy == position_) return;
- position_ = yy;
- if (yy != real_position_) redraw_lines();
+/**
+ Sets the vertical scroll position of the list to pixel position \p pos.
+ The position is how many pixels of the list are scrolled off the top edge
+ of the screen. Example: A position of '3' scrolls the top three pixels of
+ the list off the top edge of the screen.
+ \param[in] pos The vertical position (in pixels) to scroll the browser to.
+ \see position(), hposition()
+*/
+void Fl_Browser_::position(int pos) {
+ if (pos < 0) pos = 0;
+ if (pos == position_) return;
+ position_ = pos;
+ if (pos != real_position_) redraw_lines();
}
-void Fl_Browser_::hposition(int xx) {
- if (xx < 0) xx = 0;
- if (xx == hposition_) return;
- hposition_ = xx;
- if (xx != real_hposition_) redraw_lines();
+/**
+ Sets the horizontal scroll position of the list to pixel position \p pos.
+ The position is how many pixels of the list are scrolled off the left edge
+ of the screen. Example: A position of '18' scrolls the left 18 pixels of the list
+ off the left edge of the screen.
+ \param[in] pos The horizontal position (in pixels) to scroll the browser to.
+ \see position(), hposition()
+*/
+void Fl_Browser_::hposition(int pos) {
+ if (pos < 0) pos = 0;
+ if (pos == hposition_) return;
+ hposition_ = pos;
+ if (pos != real_hposition_) redraw_lines();
}
// Tell whether item is currently displayed:
-int Fl_Browser_::displayed(void* p) const {
+/**
+ Returns non-zero if \p item has been scrolled to a position where it is being displayed.
+ Checks to see if the item's vertical position is within the top and bottom
+ edges of the display window. This does NOT take into account the hide()/show()
+ status of the widget or item.
+ \param[in] item The item to check
+ \returns 1 if visible, 0 if not visible.
+ \see display(), displayed()
+*/
+int Fl_Browser_::displayed(void* item) const {
int X, Y, W, H; bbox(X, Y, W, H);
int yy = H+offset_;
for (void* l = top_; l && yy > 0; l = item_next(l)) {
- if (l == p) return 1;
+ if (l == item) return 1;
yy -= item_height(l);
}
return 0;
@@ -210,11 +245,16 @@ int Fl_Browser_::displayed(void* p) const {
// Ensure this item is displayed:
// Messy because we have no idea if it is before top or after bottom:
-void Fl_Browser_::display(void* p) {
+/**
+ Displays the \p item, scrolling the list as necessary.
+ \param[in] item The item to be displayed.
+ \see display(), displayed()
+*/
+void Fl_Browser_::display(void* item) {
// First special case - want to display first item in the list?
update_top();
- if (p == item_first()) {position(0); return;}
+ if (item == item_first()) {position(0); return;}
int X, Y, W, H, Yp; bbox(X, Y, W, H);
void* l = top_;
@@ -222,11 +262,11 @@ void Fl_Browser_::display(void* p) {
int h1;
// 2nd special case - want to display item already displayed at top of browser?
- if (l == p) {position(real_position_+Y); return;} // scroll up a bit
+ if (l == item) {position(real_position_+Y); return;} // scroll up a bit
// 3rd special case - want to display item just above top of browser?
void* lp = item_prev(l);
- if (lp == p) {position(real_position_+Y-item_quick_height(lp)); return;}
+ if (lp == item) {position(real_position_+Y-item_quick_height(lp)); return;}
#ifdef DISPLAY_SEARCH_BOTH_WAYS_AT_ONCE
// search for item. We search both up and down the list at the same time,
@@ -235,7 +275,7 @@ void Fl_Browser_::display(void* p) {
while (l || lp) {
if (l) {
h1 = item_quick_height(l);
- if (l == p) {
+ if (l == item) {
if (Y <= H) { // it is visible or right at bottom
Y = Y+h1-H; // find where bottom edge is
if (Y > 0) position(real_position_+Y); // scroll down a bit
@@ -250,7 +290,7 @@ void Fl_Browser_::display(void* p) {
if (lp) {
h1 = item_quick_height(lp);
Yp -= h1;
- if (lp == p) {
+ if (lp == item) {
if ((Yp + h1) >= 0) position(real_position_+Yp);
else position(real_position_+Yp-(H-h1)/2);
return;
@@ -264,7 +304,7 @@ void Fl_Browser_::display(void* p) {
l = top_;
for (; l; l = item_next(l)) {
h1 = item_quick_height(l);
- if (l == p) {
+ if (l == item) {
if (Y <= H) { // it is visible or right at bottom
Y = Y+h1-H; // find where bottom edge is
if (Y > 0) position(real_position_+Y); // scroll down a bit
@@ -281,7 +321,7 @@ void Fl_Browser_::display(void* p) {
for (; l; l = item_prev(l)) {
h1 = item_quick_height(l);
Y -= h1;
- if (l == p) {
+ if (l == item) {
if ((Y + h1) >= 0) position(real_position_+Y);
else position(real_position_+Y-(H-h1)/2);
return;
@@ -291,7 +331,9 @@ void Fl_Browser_::display(void* p) {
}
// redraw, has side effect of updating top and setting scrollbar:
-
+/**
+ Draws the list within the normal widget bounding box.
+*/
void Fl_Browser_::draw() {
int drawsquare = 0;
update_top();
@@ -356,7 +398,7 @@ J1:
bbox(X, Y, W, H);
- fl_clip(X, Y, W, H);
+ fl_push_clip(X, Y, W, H);
// for each line, draw it if full redraw or scrolled. Erase background
// if not a full redraw or if it is selected:
void* l = top();
@@ -413,11 +455,12 @@ J1:
}
// update the scrollbars and redraw them:
+ int scrollsize = scrollbar_size_ ? scrollbar_size_ : Fl::scrollbar_size();
int dy = top_ ? item_quick_height(top_) : 0; if (dy < 10) dy = 10;
if (scrollbar.visible()) {
scrollbar.damage_resize(
- scrollbar.align()&FL_ALIGN_LEFT ? X-scrollbar_width_ : X+W,
- Y, scrollbar_width_, H);
+ scrollbar.align()&FL_ALIGN_LEFT ? X-scrollsize : X+W,
+ Y, scrollsize, H);
scrollbar.value(position_, H, 0, full_height_);
scrollbar.linesize(dy);
if (drawsquare) draw_child(scrollbar);
@@ -425,8 +468,8 @@ J1:
}
if (hscrollbar.visible()) {
hscrollbar.damage_resize(
- X, scrollbar.align()&FL_ALIGN_TOP ? Y-scrollbar_width_ : Y+H,
- W, scrollbar_width_);
+ X, scrollbar.align()&FL_ALIGN_TOP ? Y-scrollsize : Y+H,
+ W, scrollsize);
hscrollbar.value(hposition_, W, 0, full_width_);
hscrollbar.linesize(dy);
if (drawsquare) draw_child(hscrollbar);
@@ -436,13 +479,20 @@ J1:
// draw that little square between the scrollbars:
if (drawsquare && scrollbar.visible() && hscrollbar.visible()) {
fl_color(parent()->color());
- fl_rectf(scrollbar.x(), hscrollbar.y(), scrollbar_width_,scrollbar_width_);
+ fl_rectf(scrollbar.x(), hscrollbar.y(), scrollsize, scrollsize);
}
real_hposition_ = hposition_;
}
// Quick way to delete and reset everything:
+/**
+ This method should be called when the list data is completely replaced
+ or cleared. It informs the Fl_Browser_ widget that any cached
+ information it has concerning the items is invalid.
+ This method does not clear the list, it just handles the follow up
+ bookkeeping after the list has been cleared.
+*/
void Fl_Browser_::new_list() {
top_ = 0;
position_ = real_position_ = 0;
@@ -456,14 +506,21 @@ void Fl_Browser_::new_list() {
// Tell it that this item is going away, and that this must remove
// all pointers to it:
-void Fl_Browser_::deleting(void* l) {
- if (displayed(l)) {
+/**
+ This method should be used when \p item is being deleted from the list.
+ It allows the Fl_Browser_ to discard any cached data it has on the item.
+ This method does not actually delete the item, but handles the follow up
+ bookkeeping after the item has just been deleted.
+ \param[in] item The item being deleted.
+*/
+void Fl_Browser_::deleting(void* item) {
+ if (displayed(item)) {
redraw_lines();
- if (l == top_) {
+ if (item == top_) {
real_position_ -= offset_;
offset_ = 0;
- top_ = item_next(l);
- if (!top_) top_ = item_prev(l);
+ top_ = item_next(item);
+ if (!top_) top_ = item_prev(item);
}
} else {
// we don't know where this item is, recalculate top...
@@ -471,10 +528,19 @@ void Fl_Browser_::deleting(void* l) {
offset_ = 0;
top_ = 0;
}
- if (l == selection_) selection_ = 0;
- if (l == max_width_item) {max_width_item = 0; max_width = 0;}
+ if (item == selection_) selection_ = 0;
+ if (item == max_width_item) {max_width_item = 0; max_width = 0;}
}
+/**
+ This method should be used when item \p a is being replaced by item \p b.
+ It allows the Fl_Browser_ to update its cache data as needed,
+ schedules a redraw for the item being changed, and tries to maintain the selection.
+ This method does not actually replace the item, but handles the follow up
+ bookkeeping after the item has just been replaced.
+ \param[in] a Item being replaced
+ \param[in] b Item to replace 'a'
+*/
void Fl_Browser_::replacing(void* a, void* b) {
redraw_line(a);
if (a == selection_) selection_ = b;
@@ -482,6 +548,14 @@ void Fl_Browser_::replacing(void* a, void* b) {
if (a == max_width_item) {max_width_item = 0; max_width = 0;}
}
+/**
+ This method should be used when two items \p a and \p b are being swapped.
+ It allows the Fl_Browser_ to update its cache data as needed,
+ schedules a redraw for the two items, and tries to maintain the current selection.
+ This method does not actually swap items, but handles the follow up
+ bookkeeping after items have been swapped.
+ \param[in] a,b Items being swapped.
+*/
void Fl_Browser_::swapping(void* a, void* b) {
redraw_line(a);
redraw_line(b);
@@ -491,47 +565,75 @@ void Fl_Browser_::swapping(void* a, void* b) {
else if (b == top_) top_ = a;
}
+/**
+ This method should be used when an item is in the process of
+ being inserted into the list.
+ It allows the Fl_Browser_ to update its cache data as needed,
+ scheduling a redraw for the affected lines.
+ This method does not actually insert items, but handles the
+ follow up bookkeeping after items have been inserted.
+ \param[in] a The starting item position
+ \param[in] b The new item being inserted
+*/
void Fl_Browser_::inserting(void* a, void* b) {
if (displayed(a)) redraw_lines();
if (a == top_) top_ = b;
}
-void* Fl_Browser_::find_item(int my) {
+/**
+ This method returns the item under mouse y position \p ypos.
+ NULL is returned if no item is displayed at that position.
+ \param[in] ypos The y position (eg. Fl::event_y()) to find an item under.
+ \returns The item, or NULL if not found
+*/
+void* Fl_Browser_::find_item(int ypos) {
update_top();
int X, Y, W, H; bbox(X, Y, W, H);
- void* l;
int yy = Y-offset_;
- for (l = top_; l; l = item_next(l)) {
+ for (void *l = top_; l; l = item_next(l)) {
int hh = item_height(l); if (hh <= 0) continue;
yy += hh;
- if (my <= yy || yy>=(Y+H)) return l;
+ if (ypos <= yy || yy>=(Y+H)) return l;
}
return 0;
}
-int Fl_Browser_::select(void* l, int i, int docallbacks) {
+/**
+ Sets the selection state of \p item to \p val,
+ and returns 1 if the state changed or 0 if it did not.
+
+ If \p docallbacks is non-zero, select tries to call
+ the callback function for the widget.
+
+ \param[in] item The item whose selection state is to be changed
+ \param[in] val The new selection state (1=select, 0=de-select)
+ \param[in] docallbacks If 1, invokes widget callback if item changed.\n
+ If 0, doesn't do callback (default).
+ \returns 1 if state was changed, 0 if not.
+*/
+int Fl_Browser_::select(void* item, int val, int docallbacks) {
if (type() == FL_MULTI_BROWSER) {
- if (selection_ != l) {
+ if (selection_ != item) {
if (selection_) redraw_line(selection_);
- selection_ = l;
- redraw_line(l);
+ selection_ = item;
+ redraw_line(item);
}
- if ((!i)==(!item_selected(l))) return 0;
- item_select(l, i);
- redraw_line(l);
+ if ((!val)==(!item_selected(item))) return 0;
+ item_select(item, val);
+ redraw_line(item);
} else {
- if (i && selection_ == l) return 0;
- if (!i && selection_ != l) return 0;
+ if (val && selection_ == item) return 0;
+ if (!val && selection_ != item) return 0;
if (selection_) {
item_select(selection_, 0);
redraw_line(selection_);
selection_ = 0;
}
- if (i) {
- item_select(l, 1);
- selection_ = l;
- redraw_line(l);
- display(l);
+ if (val) {
+ item_select(item, 1);
+ selection_ = item;
+ redraw_line(item);
+ display(item);
}
}
if (docallbacks) {
@@ -541,6 +643,16 @@ int Fl_Browser_::select(void* l, int i, int docallbacks) {
return 1;
}
+/**
+ Deselects all items in the list and returns 1 if the state changed
+ or 0 if it did not.
+
+ If the optional \p docallbacks parameter is non-zero, deselect tries
+ to call the callback function for the widget.
+
+ \param[in] docallbacks If 1, invokes widget callback if item changed.\n
+ If 0, doesn't do callback (default).
+*/
int Fl_Browser_::deselect(int docallbacks) {
if (type() == FL_MULTI_BROWSER) {
int change = 0;
@@ -556,18 +668,30 @@ int Fl_Browser_::deselect(int docallbacks) {
}
}
-int Fl_Browser_::select_only(void* l, int docallbacks) {
- if (!l) return deselect(docallbacks);
+/**
+ Selects \p item and returns 1 if the state changed or 0 if it did not.
+ Any other items in the list are deselected.
+ \param[in] item The \p item to select.
+ \param[in] docallbacks If 1, invokes widget callback if item changed.\n
+ If 0, doesn't do callback (default).
+*/
+int Fl_Browser_::select_only(void* item, int docallbacks) {
+ if (!item) return deselect(docallbacks);
int change = 0;
if (type() == FL_MULTI_BROWSER) {
for (void* p = item_first(); p; p = item_next(p))
- if (p != l) change |= select(p, 0, docallbacks);
+ if (p != item) change |= select(p, 0, docallbacks);
}
- change |= select(l, 1, docallbacks);
- display(l);
+ change |= select(item, 1, docallbacks);
+ display(item);
return change;
}
+/**
+ Handles the \p event within the normal widget bounding box.
+ \param[in] event The event to process.
+ \returns 1 if event was processed, 0 if not.
+*/
int Fl_Browser_::handle(int event) {
// must do shortcuts first or the scrollbar will get them...
if (event == FL_ENTER || event == FL_LEAVE) return 1;
@@ -784,8 +908,13 @@ J1:
return 0;
}
-Fl_Browser_::Fl_Browser_(int X, int Y, int W, int H, const char* l)
- : Fl_Group(X, Y, W, H, l),
+/**
+ The constructor makes an empty browser.
+ \param[in] X,Y,W,H position and size.
+ \param[in] L The label string, may be NULL.
+*/
+Fl_Browser_::Fl_Browser_(int X, int Y, int W, int H, const char* L)
+ : Fl_Group(X, Y, W, H, L),
scrollbar(0, 0, 0, 0, 0), // they will be resized by draw()
hscrollbar(0, 0, 0, 0, 0)
{
@@ -799,29 +928,99 @@ Fl_Browser_::Fl_Browser_(int X, int Y, int W, int H, const char* l)
selection_ = 0;
color(FL_BACKGROUND2_COLOR, FL_SELECTION_COLOR);
scrollbar.callback(scrollbar_callback);
-//scrollbar.align(FL_ALIGN_LEFT|FL_ALIGN_BOTTOM); // back compatability?
+//scrollbar.align(FL_ALIGN_LEFT|FL_ALIGN_BOTTOM); // back compatibility?
hscrollbar.callback(hscrollbar_callback);
hscrollbar.type(FL_HORIZONTAL);
textfont_ = FL_HELVETICA;
- textsize_ = (uchar)FL_NORMAL_SIZE;
+ textsize_ = FL_NORMAL_SIZE;
textcolor_ = FL_FOREGROUND_COLOR;
has_scrollbar_ = BOTH;
max_width = 0;
max_width_item = 0;
+ scrollbar_size_ = 0;
redraw1 = redraw2 = 0;
end();
}
-// Default versions of some of the virtual functions:
-
-int Fl_Browser_::item_quick_height(void* l) const {
- return item_height(l);
+/**
+ Sort the items in the browser based on \p flags.
+ item_swap(void*, void*) and item_text(void*) must be implemented for this call.
+ \param[in] flags FL_SORT_ASCENDING -- sort in ascending order\n
+ FL_SORT_DESCENDING -- sort in descending order\n
+ Values other than the above will cause undefined behavior\n
+ Other flags may appear in the future.
+ \todo Add a flag to ignore case
+*/
+void Fl_Browser_::sort(int flags) {
+ //
+ // Simple bubble sort - pure lazyness on my side.
+ //
+ int i, j, n = -1, desc = ((flags&FL_SORT_DESCENDING)==FL_SORT_DESCENDING);
+ void *a =item_first(), *b, *c;
+ if (!a) return;
+ while (a) {
+ a = item_next(a);
+ n++;
+ }
+ for (i=n-1; i>0; i--) {
+ char swapped = 0;
+ a = item_first();
+ b = item_next(a);
+ for (j=0; j0) {
+ item_swap(a, b);
+ swapped = 1;
+ }
+ }
+ b = c; a = item_prev(b);
+ }
+ if (!swapped)
+ break;
+ }
}
+// Default versions of some of the virtual functions:
+
+/**
+ This method may be provided by the subclass to return the height of the
+ \p item, in pixels.
+ Allow for two additional pixels for the list selection box.
+ This method differs from item_height in that it is only called for
+ selection and scrolling operations.
+ The default implementation calls item_height.
+ \param[in] item The item whose height to return.
+ \returns The height, in pixels.
+*/
+int Fl_Browser_::item_quick_height(void* item) const {
+ return item_height(item);
+}
+
+/**
+ This method may be provided to return the average height of all items
+ to be used for scrolling.
+ The default implementation uses the height of the first item.
+ \returns The average height of items, in pixels.
+*/
int Fl_Browser_::incr_height() const {
return item_quick_height(item_first());
}
+/**
+ This method may be provided by the subclass to indicate the full height
+ of the item list, in pixels.
+ The default implementation computes the full height from the item heights.
+ Includes the items that are scrolled off screen.
+ \returns The height of the entire list, in pixels.
+*/
int Fl_Browser_::full_height() const {
int t = 0;
for (void* p = item_first(); p; p = item_next(p))
@@ -829,14 +1028,35 @@ int Fl_Browser_::full_height() const {
return t;
}
+/**
+ This method may be provided by the subclass to indicate the full width
+ of the item list, in pixels.
+ The default implementation computes the full width from the item widths.
+ \returns The maximum width of all the items, in pixels.
+*/
int Fl_Browser_::full_width() const {
return max_width;
}
-void Fl_Browser_::item_select(void*, int) {}
+/**
+ This method must be implemented by the subclass if it supports
+ multiple selections; sets the selection state to \p val for the \p item.
+ Sets the selection state for \p item, where optional \p val is 1 (select, the default)
+ or 0 (de-select).
+ \param[in] item The item to be selected
+ \param[in] val The optional selection state; 1=select, 0=de-select.\n
+ The default is to select the item (1).
+*/
+void Fl_Browser_::item_select(void *item, int val) {}
-int Fl_Browser_::item_selected(void* l) const {return l==selection_;}
+/**
+ This method must be implemented by the subclass if it supports
+ multiple selections; returns the selection state for \p item.
+ The method should return 1 if \p item is selected, or 0 otherwise.
+ \param[in] item The item to test.
+*/
+int Fl_Browser_::item_selected(void* item) const { return item==selection_ ? 1 : 0; }
//
-// End of "$Id: Fl_Browser_.cxx 5992 2007-12-15 16:20:16Z mike $".
+// End of "$Id: Fl_Browser_.cxx 6737 2009-04-02 06:44:34Z greg.ercolano $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Browser_load.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Browser_load.cxx
index 0ba153173..c72d31fd2 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Browser_load.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Browser_load.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Browser_load.cxx 5190 2006-06-09 16:16:34Z mike $"
+// "$Id: Fl_Browser_load.cxx 6726 2009-03-27 16:52:31Z greg.ercolano $"
//
// File loading routines for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -28,7 +28,19 @@
#include
#include
#include
+#include
+/**
+ Clears the browser and reads the file, adding each line from the file
+ to the browser. If the filename is NULL or a zero-length
+ string then this just clears the browser. This returns zero if there
+ was any error in opening or reading the file, in which case errno
+ is set to the system error. The data() of each line is set
+ to NULL.
+ \param[in] filename The filename to load
+ \returns 1 if OK, 0 on error (errno has reason)
+ \see add()
+*/
int Fl_Browser::load(const char *filename) {
#define MAXFL_BLINE 1024
char newtext[MAXFL_BLINE];
@@ -36,7 +48,7 @@ int Fl_Browser::load(const char *filename) {
int i;
clear();
if (!filename || !(filename[0])) return 1;
- FILE *fl = fopen(filename,"r");
+ FILE *fl = fl_fopen(filename,"r");
if (!fl) return 0;
i = 0;
do {
@@ -45,13 +57,14 @@ int Fl_Browser::load(const char *filename) {
newtext[i] = 0;
add(newtext);
i = 0;
- } else
+ } else {
newtext[i++] = c;
+ }
} while (c >= 0);
fclose(fl);
return 1;
}
//
-// End of "$Id: Fl_Browser_load.cxx 5190 2006-06-09 16:16:34Z mike $".
+// End of "$Id: Fl_Browser_load.cxx 6726 2009-03-27 16:52:31Z greg.ercolano $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Button.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Button.cxx
index 31cbc8753..686de5de7 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Button.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Button.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Button.cxx 6031 2008-02-20 17:59:13Z matt $"
+// "$Id: Fl_Button.cxx 6616 2009-01-01 21:28:26Z matt $"
//
// Button widget for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2006 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -34,6 +34,12 @@
// them are implemented by setting the type() value and testing it
// here. This includes Fl_Radio_Button and Fl_Toggle_Button
+/**
+ Sets the current value of the button.
+ A non-zero value sets the button to 1 (ON), and zero sets it to 0 (OFF).
+ \param[in] v button value.
+ \see set(), clear()
+ */
int Fl_Button::value(int v) {
v = v ? 1 : 0;
oldval = v;
@@ -48,6 +54,10 @@ int Fl_Button::value(int v) {
}
}
+/**
+ Turns on this button and turns off all other radio buttons in the group
+ (calling \c value(1) or \c set() does not do this).
+ */
void Fl_Button::setonly() { // set this radio button on, turn others off
value(1);
Fl_Group* g = (Fl_Group*)parent();
@@ -120,11 +130,13 @@ int Fl_Button::handle(int event) {
if (type() == FL_RADIO_BUTTON && !value_) {
setonly();
set_changed();
- if (when() & FL_WHEN_CHANGED) do_callback();
+ if (when() & (FL_WHEN_CHANGED|FL_WHEN_RELEASE) )
+ do_callback();
} else if (type() == FL_TOGGLE_BUTTON) {
value(!value());
set_changed();
- if (when() & FL_WHEN_CHANGED) do_callback();
+ if (when() & (FL_WHEN_CHANGED|FL_WHEN_RELEASE))
+ do_callback();
} else if (when() & FL_WHEN_RELEASE) do_callback();
return 1;
case FL_FOCUS :
@@ -159,8 +171,13 @@ int Fl_Button::handle(int event) {
}
}
-Fl_Button::Fl_Button(int X, int Y, int W, int H, const char *l)
-: Fl_Widget(X,Y,W,H,l) {
+/**
+ The constructor creates the button using the given position, size and label.
+ \param[in] X, Y, W, H position and size of the widget
+ \param[in] L widget label, default is no label
+ */
+Fl_Button::Fl_Button(int X, int Y, int W, int H, const char *L)
+: Fl_Widget(X,Y,W,H,L) {
box(FL_UP_BOX);
down_box(FL_NO_BOX);
value_ = oldval = 0;
@@ -169,5 +186,5 @@ Fl_Button::Fl_Button(int X, int Y, int W, int H, const char *l)
}
//
-// End of "$Id: Fl_Button.cxx 6031 2008-02-20 17:59:13Z matt $".
+// End of "$Id: Fl_Button.cxx 6616 2009-01-01 21:28:26Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Chart.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Chart.cxx
index 8c86a7f09..28004c901 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Chart.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Chart.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Chart.cxx 5942 2007-10-06 17:33:17Z matt $"
+// "$Id: Fl_Chart.cxx 6616 2009-01-01 21:28:26Z matt $"
//
// Forms-compatible chart widget for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -285,8 +285,14 @@ void Fl_Chart::draw() {
#define FL_CHART_LCOL FL_LCOL
#define FL_CHART_ALIGN FL_ALIGN_BOTTOM
-Fl_Chart::Fl_Chart(int X, int Y, int W, int H,const char *l) :
-Fl_Widget(X,Y,W,H,l) {
+/**
+ Create a new Fl_Chart widget using the given position, size and label string.
+ The default boxstyle is \c FL_NO_BOX.
+ \param[in] X, Y, W, H position and size of the widget
+ \param[in] L widget label, default is no label
+ */
+Fl_Chart::Fl_Chart(int X, int Y, int W, int H,const char *L) :
+Fl_Widget(X,Y,W,H,L) {
box(FL_BORDER_BOX);
align(FL_ALIGN_BOTTOM);
numb = 0;
@@ -300,15 +306,29 @@ Fl_Widget(X,Y,W,H,l) {
entries = (FL_CHART_ENTRY *)calloc(sizeof(FL_CHART_ENTRY), FL_CHART_MAX + 1);
}
+/**
+ Destroys the Fl_Chart widget and all of its data.
+ */
Fl_Chart::~Fl_Chart() {
free(entries);
}
+/**
+ Removes all values from the chart.
+ */
void Fl_Chart::clear() {
numb = 0;
+ min = max = 0;
redraw();
}
+/**
+ Add the data value \p val with optional label \p str and color \p col
+ to the chart.
+ \param[in] val data value
+ \param[in] str optional data label
+ \param[in] col optional data color
+ */
void Fl_Chart::add(double val, const char *str, unsigned col) {
/* Allocate more entries if required */
if (numb >= sizenumb) {
@@ -331,6 +351,14 @@ void Fl_Chart::add(double val, const char *str, unsigned col) {
redraw();
}
+/**
+ Inserts a data value \p val at the given position \p ind.
+ Position 1 is the first data value.
+ \param[in] ind insertion position
+ \param[in] val data value
+ \param[in] str optional data label
+ \param[in] col optional data color
+ */
void Fl_Chart::insert(int ind, double val, const char *str, unsigned col) {
int i;
if (ind < 1 || ind > numb+1) return;
@@ -353,6 +381,14 @@ void Fl_Chart::insert(int ind, double val, const char *str, unsigned col) {
redraw();
}
+/**
+ Replace a data value \p val at the given position \p ind.
+ Position 1 is the first data value.
+ \param[in] ind insertion position
+ \param[in] val data value
+ \param[in] str optional data label
+ \param[in] col optional data color
+ */
void Fl_Chart::replace(int ind,double val, const char *str, unsigned col) {
if (ind < 1 || ind > numb) return;
entries[ind-1].val = float(val);
@@ -365,12 +401,22 @@ void Fl_Chart::replace(int ind,double val, const char *str, unsigned col) {
redraw();
}
-void Fl_Chart::bounds(double mymin, double mymax) {
- this->min = mymin;
- this->max = mymax;
+/**
+ Sets the lower and upper bounds of the chart values.
+ \param[in] a, b are used to set lower, upper
+ */
+void Fl_Chart::bounds(double a, double b) {
+ this->min = a;
+ this->max = b;
redraw();
}
+/**
+ Set the maximum number of data values for a chart.
+ If you do not call this method then the chart will be allowed to grow
+ to any size depending on available memory.
+ \param[in] m maximum number of data values allowed.
+ */
void Fl_Chart::maxsize(int m) {
int i;
/* Fill in the new number */
@@ -386,5 +432,5 @@ void Fl_Chart::maxsize(int m) {
}
//
-// End of "$Id: Fl_Chart.cxx 5942 2007-10-06 17:33:17Z matt $".
+// End of "$Id: Fl_Chart.cxx 6616 2009-01-01 21:28:26Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Check_Browser.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Check_Browser.cxx
index 6f34990e3..77284c8cc 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Check_Browser.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Check_Browser.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Check_Browser.cxx 5985 2007-11-20 21:15:08Z mike $"
+// "$Id: Fl_Check_Browser.cxx 6616 2009-01-01 21:28:26Z matt $"
//
// Fl_Check_Browser header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -85,7 +85,8 @@ int Fl_Check_Browser::lineno(cb_item *p0) const {
}
Fl_Check_Browser::Fl_Check_Browser(int X, int Y, int W, int H, const char *l)
- : Fl_Browser_(X, Y, W, H, l) {
+/** The constructor makes an empty browser.*/
+: Fl_Browser_(X, Y, W, H, l) {
type(FL_SELECT_BROWSER);
when(FL_WHEN_NEVER);
first = last = 0;
@@ -164,11 +165,16 @@ int Fl_Check_Browser::item_selected(void *v) const {
cb_item *i = (cb_item *)v;
return i->selected;
}
-
+/**
+ Add a new unchecked line to the end of the browser. The text is copied
+ using the strdup() function. It may also be NULL to make
+ a blank line. The second form can set the item checked.
+*/
int Fl_Check_Browser::add(char *s) {
return (add(s, 0));
}
+/** See int Fl_Check_Browser::add(char *s) */
int Fl_Check_Browser::add(char *s, int b) {
cb_item *p = (cb_item *)malloc(sizeof(cb_item));
p->next = 0;
@@ -193,6 +199,10 @@ int Fl_Check_Browser::add(char *s, int b) {
return (nitems_);
}
+/**
+ Remove line n and make the browser one line shorter. Returns the
+ number of lines left in the browser.
+*/
int Fl_Check_Browser::remove(int item) {
cb_item *p = find_item(item);
@@ -225,6 +235,7 @@ int Fl_Check_Browser::remove(int item) {
return (nitems_);
}
+/** Remove every item from the browser.*/
void Fl_Check_Browser::clear() {
cb_item *p = first;
cb_item *next;
@@ -246,6 +257,7 @@ void Fl_Check_Browser::clear() {
cached_item = -1;
}
+/** Gets the current status of item item. */
int Fl_Check_Browser::checked(int i) const {
cb_item *p = find_item(i);
@@ -253,6 +265,7 @@ int Fl_Check_Browser::checked(int i) const {
return 0;
}
+/** Sets the check status of item item to b. */
void Fl_Check_Browser::checked(int i, int b) {
cb_item *p = find_item(i);
@@ -267,10 +280,12 @@ void Fl_Check_Browser::checked(int i, int b) {
}
}
+/** Returns the index of the currently selected item.*/
int Fl_Check_Browser::value() const {
return lineno((cb_item *)selection());
}
+/** Return a pointer to an internal buffer holding item item's text.*/
char *Fl_Check_Browser::text(int i) const {
cb_item *p = find_item(i);
@@ -278,6 +293,7 @@ char *Fl_Check_Browser::text(int i) const {
return 0;
}
+/** Sets all the items checked.*/
void Fl_Check_Browser::check_all() {
cb_item *p;
@@ -288,6 +304,7 @@ void Fl_Check_Browser::check_all() {
redraw();
}
+/** Sets all the items unchecked.*/
void Fl_Check_Browser::check_none() {
cb_item *p;
@@ -305,5 +322,5 @@ int Fl_Check_Browser::handle(int event) {
}
//
-// End of "$Id: Fl_Check_Browser.cxx 5985 2007-11-20 21:15:08Z mike $".
+// End of "$Id: Fl_Check_Browser.cxx 6616 2009-01-01 21:28:26Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Check_Button.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Check_Button.cxx
index a2b88f871..d6f24b90c 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Check_Button.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Check_Button.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Check_Button.cxx 5190 2006-06-09 16:16:34Z mike $"
+// "$Id: Fl_Check_Button.cxx 6616 2009-01-01 21:28:26Z matt $"
//
// Check button widget for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -28,12 +28,19 @@
#include
#include
+// TODO Correct incorrect Fl_Check_Button comments.
// A subclass of Fl_Button that always draws as a diamond box. This
// diamond is smaller than the widget size and can be surchecked by
-// another box type, for compatability with Forms.
+// another box type, for compatibility with Forms.
-Fl_Check_Button::Fl_Check_Button(int X, int Y, int W, int H, const char *l)
-: Fl_Light_Button(X, Y, W, H, l) {
+/**
+ Creates a new Fl_Check_Button widget using the given position, size and
+ label string.
+ \param[in] X, Y, W, H position and size of the widget
+ \param[in] L widget label, default is no label
+ */
+Fl_Check_Button::Fl_Check_Button(int X, int Y, int W, int H, const char *L)
+: Fl_Light_Button(X, Y, W, H, L) {
box(FL_NO_BOX);
down_box(FL_DOWN_BOX);
selection_color(FL_FOREGROUND_COLOR);
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Choice.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Choice.cxx
index c9f927bee..22054e821 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Choice.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Choice.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Choice.cxx 5485 2006-09-24 13:35:23Z mike $"
+// "$Id: Fl_Choice.cxx 6616 2009-01-01 21:28:26Z matt $"
//
// Choice widget for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2006 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -87,7 +87,7 @@ void Fl_Choice::draw() {
// ERCO
int xx = x() + dx, yy = y() + dy + 1, ww = w() - W, hh = H - 2;
- fl_clip(xx, yy, ww, hh);
+ fl_push_clip(xx, yy, ww, hh);
if ( Fl::scheme()) {
Fl_Label l;
@@ -95,7 +95,7 @@ void Fl_Choice::draw() {
l.image = 0;
l.deimage = 0;
l.type = m.labeltype_;
- l.font = m.labelsize_ || m.labelfont_ ? m.labelfont_ : uchar(textfont());
+ l.font = m.labelsize_ || m.labelfont_ ? m.labelfont_ : textfont();
l.size = m.labelsize_ ? m.labelsize_ : textsize();
l.color= m.labelcolor_ ? m.labelcolor_ : textcolor();
if (!m.active()) l.color = fl_inactive((Fl_Color)l.color);
@@ -116,8 +116,18 @@ void Fl_Choice::draw() {
draw_label();
}
-Fl_Choice::Fl_Choice(int X, int Y, int W, int H, const char *l)
-: Fl_Menu_(X,Y,W,H,l) {
+/**
+ Create a new Fl_Choice widget using the given position, size and label string.
+ The default boxtype is \c FL_UP_BOX.
+
+ The constructor sets menu() to NULL.
+ See Fl_Menu_ for the methods to set or change the menu.
+
+ \param[in] X, Y, W, H position and size of the widget
+ \param[in] L widget label, default is no label
+ */
+Fl_Choice::Fl_Choice(int X, int Y, int W, int H, const char *L)
+: Fl_Menu_(X,Y,W,H,L) {
align(FL_ALIGN_LEFT);
when(FL_WHEN_RELEASE);
textfont(FL_HELVETICA);
@@ -125,12 +135,24 @@ Fl_Choice::Fl_Choice(int X, int Y, int W, int H, const char *l)
down_box(FL_BORDER_BOX);
}
+/**
+ Sets the currently selected value using a pointer to menu item.
+ Changing the selected value causes a redraw().
+ \param[in] v pointer to menu item in the menu item array.
+ \returns non-zero if the new value is different to the old one.
+ */
int Fl_Choice::value(const Fl_Menu_Item *v) {
if (!Fl_Menu_::value(v)) return 0;
redraw();
return 1;
}
+/**
+ Sets the currently selected value using the index into the menu item array.
+ Changing the selected value causes a redraw().
+ \param[in] v index of value in the menu item array.
+ \returns non-zero if the new value is different to the old one.
+ */
int Fl_Choice::value(int v) {
if (v == -1) return value((const Fl_Menu_Item *)0);
if (v < 0 || v >= (size() - 1)) return 0;
@@ -187,5 +209,5 @@ int Fl_Choice::handle(int e) {
}
//
-// End of "$Id: Fl_Choice.cxx 5485 2006-09-24 13:35:23Z mike $".
+// End of "$Id: Fl_Choice.cxx 6616 2009-01-01 21:28:26Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Clock.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Clock.cxx
index 6516256d0..f00ba255f 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Clock.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Clock.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Clock.cxx 5472 2006-09-20 03:03:14Z mike $"
+// "$Id: Fl_Clock.cxx 6616 2009-01-01 21:28:26Z matt $"
//
// Clock widget for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2006 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -74,6 +74,10 @@ static void rect(double x, double y, double w, double h) {
fl_end_polygon();
}
+/**
+ Draw clock with the given position and size.
+ \param[in] X, Y, W, H position and size
+*/
void Fl_Clock_Output::draw(int X, int Y, int W, int H) {
Fl_Color box_color = type()==FL_ROUND_CLOCK ? FL_GRAY : color();
Fl_Color shadow_color = fl_color_average(box_color, FL_BLACK, 0.5);
@@ -107,11 +111,20 @@ void Fl_Clock_Output::draw(int X, int Y, int W, int H) {
fl_pop_matrix();
}
+/**
+ Draw clock with current position and size.
+*/
void Fl_Clock_Output::draw() {
draw(x(), y(), w(), h());
draw_label();
}
+/**
+ Set the displayed time.
+ Set the time in hours, minutes, and seconds.
+ \param[in] H, m, s displayed time
+ \see hour(), minute(), second()
+ */
void Fl_Clock_Output::value(int H, int m, int s) {
if (H!=hour_ || m!=minute_ || s!=second_) {
hour_ = H; minute_ = m; second_ = s;
@@ -120,6 +133,12 @@ void Fl_Clock_Output::value(int H, int m, int s) {
}
}
+/**
+ Set the displayed time.
+ Set the time in seconds since the UNIX epoch (January 1, 1970).
+ \param[in] v seconds since epoch
+ \see value()
+ */
void Fl_Clock_Output::value(ulong v) {
value_ = v;
struct tm *timeofday;
@@ -129,8 +148,14 @@ void Fl_Clock_Output::value(ulong v) {
value(timeofday->tm_hour, timeofday->tm_min, timeofday->tm_sec);
}
-Fl_Clock_Output::Fl_Clock_Output(int X, int Y, int W, int H, const char *l)
-: Fl_Widget(X, Y, W, H, l) {
+/**
+ Create a new Fl_Clock_Output widget with the given position, size and label.
+ The default boxtype is \c FL_NO_BOX.
+ \param[in] X, Y, W, H position and size of the widget
+ \param[in] L widget label, default is no label
+ */
+Fl_Clock_Output::Fl_Clock_Output(int X, int Y, int W, int H, const char *L)
+: Fl_Widget(X, Y, W, H, L) {
box(FL_UP_BOX);
selection_color(fl_gray_ramp(5));
align(FL_ALIGN_BOTTOM);
@@ -142,11 +167,24 @@ Fl_Clock_Output::Fl_Clock_Output(int X, int Y, int W, int H, const char *l)
////////////////////////////////////////////////////////////////
-Fl_Clock::Fl_Clock(int X, int Y, int W, int H, const char *l)
- : Fl_Clock_Output(X, Y, W, H, l) {}
+/**
+ Create an Fl_Clock widget using the given position, size, and label string.
+ The default boxtype is \c FL_NO_BOX.
+ \param[in] X, Y, W, H position and size of the widget
+ \param[in] L widget label, default is no label
+ */
+Fl_Clock::Fl_Clock(int X, int Y, int W, int H, const char *L)
+ : Fl_Clock_Output(X, Y, W, H, L) {}
-Fl_Clock::Fl_Clock(uchar t, int X, int Y, int W, int H, const char *l)
- : Fl_Clock_Output(X, Y, W, H, l) {
+/**
+ Create an Fl_Clock widget using the given boxtype, position, size, and
+ label string.
+ \param[in] t boxtype
+ \param[in] X, Y, W, H position and size of the widget
+ \param[in] L widget label, default is no label
+ */
+Fl_Clock::Fl_Clock(uchar t, int X, int Y, int W, int H, const char *L)
+ : Fl_Clock_Output(X, Y, W, H, L) {
type(t);
box(t==FL_ROUND_CLOCK ? FL_NO_BOX : FL_UP_BOX);
}
@@ -168,10 +206,13 @@ int Fl_Clock::handle(int event) {
return Fl_Clock_Output::handle(event);
}
+/**
+ The destructor removes the clock.
+ */
Fl_Clock::~Fl_Clock() {
Fl::remove_timeout(tick, this);
}
//
-// End of "$Id: Fl_Clock.cxx 5472 2006-09-20 03:03:14Z mike $".
+// End of "$Id: Fl_Clock.cxx 6616 2009-01-01 21:28:26Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Color_Chooser.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Color_Chooser.cxx
index b68520baf..8cf4c59f1 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Color_Chooser.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Color_Chooser.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Color_Chooser.cxx 5190 2006-06-09 16:16:34Z mike $"
+// "$Id: Fl_Color_Chooser.cxx 6616 2009-01-01 21:28:26Z matt $"
//
// Color chooser for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -47,6 +47,11 @@
// you get this by defining this:
#define UPDATE_HUE_BOX 1
+/**
+ This \e static method converts HSV colors to RGB colorspace.
+ \param[in] H, S, V color components
+ \param[out] R, G, B color components
+ */
void Fl_Color_Chooser::hsv2rgb(
double H, double S, double V, double& R, double& G, double& B) {
if (S < 5.0e-6) {
@@ -68,6 +73,11 @@ void Fl_Color_Chooser::hsv2rgb(
}
}
+/**
+ This \e static method converts RGB colors to HSV colorspace.
+ \param[in] R, G, B color components
+ \param[out] H, S, V color components
+ */
void Fl_Color_Chooser::rgb2hsv(
double R, double G, double B, double& H, double& S, double& V) {
double maxv = R > G ? R : G; if (B > maxv) maxv = B;
@@ -83,7 +93,13 @@ void Fl_Color_Chooser::rgb2hsv(
}
}
-enum {M_RGB, M_BYTE, M_HEX, M_HSV}; // modes
+/** Fl_Color_Chooser modes */
+enum {
+ M_RGB, /**< mode() of Fl_Color_Chooser showing RGB values */
+ M_BYTE, /**< mode() of Fl_Color_Chooser showing byte values */
+ M_HEX, /**< mode() of Fl_Color_Chooser showing hex values */
+ M_HSV /**< mode() of Fl_Color_Chooser showing HSV values */
+};
static Fl_Menu_Item mode_menu[] = {
{"rgb"},
{"byte"},
@@ -92,11 +108,13 @@ static Fl_Menu_Item mode_menu[] = {
{0}
};
+#ifndef FL_DOXYGEN
int Flcc_Value_Input::format(char* buf) {
Fl_Color_Chooser* c = (Fl_Color_Chooser*)parent();
if (c->mode() == M_HEX) return sprintf(buf,"0x%02X", int(value()));
else return Fl_Valuator::format(buf);
}
+#endif // !FL_DOXYGEN
void Fl_Color_Chooser::set_valuators() {
switch (mode()) {
@@ -119,6 +137,13 @@ void Fl_Color_Chooser::set_valuators() {
}
}
+/**
+ Sets the current rgb color values.
+ Does not do the callback. Does not clamp (but out of range values will
+ produce psychedelic effects in the hue selector).
+ \param[in] R, G, B color components.
+ \return 1 if a new rgb value was set, 0 if the rgb value was the previous one.
+ */
int Fl_Color_Chooser::rgb(double R, double G, double B) {
if (R == r_ && G == g_ && B == b_) return 0;
r_ = R; g_ = G; b_ = B;
@@ -140,6 +165,13 @@ int Fl_Color_Chooser::rgb(double R, double G, double B) {
return 1;
}
+/**
+ Set the hsv values.
+ The passed values are clamped (or for hue, modulus 6 is used) to get
+ legal values. Does not do the callback.
+ \param[in] H, S, V color components.
+ \return 1 if a new hsv value was set, 0 if the hsv value was the previous one.
+*/
int Fl_Color_Chooser::hsv(double H, double S, double V) {
H = fmod(H,6.0); if (H < 0.0) H += 6.0;
if (S < 0.0) S = 0.0; else if (S > 1.0) S = 1.0;
@@ -179,6 +211,7 @@ static void tohs(double x, double y, double& h, double& s) {
#endif
}
+#ifndef FL_DOXYGEN
int Flcc_HueBox::handle(int e) {
static double ih, is;
Fl_Color_Chooser* c = (Fl_Color_Chooser*)parent();
@@ -213,6 +246,7 @@ int Flcc_HueBox::handle(int e) {
return 0;
}
}
+#endif // !FL_DOXYGEN
static void generate_image(void* vv, int X, int Y, int W, uchar* buf) {
Flcc_HueBox* v = (Flcc_HueBox*)vv;
@@ -234,6 +268,7 @@ static void generate_image(void* vv, int X, int Y, int W, uchar* buf) {
}
}
+#ifndef FL_DOXYGEN
int Flcc_HueBox::handle_key(int key) {
int w1 = w()-Fl::box_dw(box())-6;
int h1 = h()-Fl::box_dh(box())-6;
@@ -272,14 +307,16 @@ int Flcc_HueBox::handle_key(int key) {
return 1;
}
+#endif // !FL_DOXYGEN
+#ifndef FL_DOXYGEN
void Flcc_HueBox::draw() {
if (damage()&FL_DAMAGE_ALL) draw_box();
int x1 = x()+Fl::box_dx(box());
int yy1 = y()+Fl::box_dy(box());
int w1 = w()-Fl::box_dw(box());
int h1 = h()-Fl::box_dh(box());
- if (damage() == FL_DAMAGE_EXPOSE) fl_clip(x1+px,yy1+py,6,6);
+ if (damage() == FL_DAMAGE_EXPOSE) fl_push_clip(x1+px,yy1+py,6,6);
fl_draw_image(generate_image, this, x1, yy1, w1, h1);
if (damage() == FL_DAMAGE_EXPOSE) fl_pop_clip();
Fl_Color_Chooser* c = (Fl_Color_Chooser*)parent();
@@ -296,9 +333,11 @@ void Flcc_HueBox::draw() {
draw_box(FL_UP_BOX,x1+X,yy1+Y,6,6,Fl::focus() == this ? FL_FOREGROUND_COLOR : FL_GRAY);
px = X; py = Y;
}
+#endif // !FL_DOXYGEN
////////////////////////////////////////////////////////////////
+#ifndef FL_DOXYGEN
int Flcc_ValueBox::handle(int e) {
static double iv;
Fl_Color_Chooser* c = (Fl_Color_Chooser*)parent();
@@ -328,6 +367,7 @@ int Flcc_ValueBox::handle(int e) {
return 0;
}
}
+#endif // !FL_DOXYGEN
static double tr, tg, tb;
static void generate_vimage(void* vv, int X, int Y, int W, uchar* buf) {
@@ -341,6 +381,7 @@ static void generate_vimage(void* vv, int X, int Y, int W, uchar* buf) {
}
}
+#ifndef FL_DOXYGEN
void Flcc_ValueBox::draw() {
if (damage()&FL_DAMAGE_ALL) draw_box();
Fl_Color_Chooser* c = (Fl_Color_Chooser*)parent();
@@ -349,7 +390,7 @@ void Flcc_ValueBox::draw() {
int yy1 = y()+Fl::box_dy(box());
int w1 = w()-Fl::box_dw(box());
int h1 = h()-Fl::box_dh(box());
- if (damage() == FL_DAMAGE_EXPOSE) fl_clip(x1,yy1+py,w1,6);
+ if (damage() == FL_DAMAGE_EXPOSE) fl_push_clip(x1,yy1+py,w1,6);
fl_draw_image(generate_vimage, this, x1, yy1, w1, h1);
if (damage() == FL_DAMAGE_EXPOSE) fl_pop_clip();
int Y = int((1-c->value()) * (h1-6));
@@ -357,7 +398,9 @@ void Flcc_ValueBox::draw() {
draw_box(FL_UP_BOX,x1,yy1+Y,w1,6,Fl::focus() == this ? FL_FOREGROUND_COLOR : FL_GRAY);
py = Y;
}
+#endif // !FL_DOXYGEN
+#ifndef FL_DOXYGEN
int Flcc_ValueBox::handle_key(int key) {
int h1 = h()-Fl::box_dh(box())-6;
Fl_Color_Chooser* c = (Fl_Color_Chooser*)parent();
@@ -382,6 +425,7 @@ int Flcc_ValueBox::handle_key(int key) {
return 1;
}
+#endif // !FL_DOXYGEN
////////////////////////////////////////////////////////////////
@@ -413,6 +457,13 @@ void Fl_Color_Chooser::mode_cb(Fl_Widget* o, void*) {
////////////////////////////////////////////////////////////////
+/**
+ Creates a new Fl_Color_Chooser widget using the given position, size, and
+ label string.
+ The recommended dimensions are 200x95. The color is initialized to black.
+ \param[in] X, Y, W, H position and size of the widget
+ \param[in] L widget label, default is no label
+ */
Fl_Color_Chooser::Fl_Color_Chooser(int X, int Y, int W, int H, const char* L)
: Fl_Group(0,0,195,115,L),
huebox(0,0,115,115),
@@ -477,6 +528,18 @@ static void chooser_cb(Fl_Object* o, void* vv) {
extern const char* fl_ok;
extern const char* fl_cancel;
+/** \addtogroup group_comdlg
+ @{ */
+/**
+ \brief Pops up a window to let the user pick an arbitrary RGB color.
+ \image html fl_color_chooser.jpg
+ \image latex fl_color_chooser.eps "fl_color_chooser" width=8cm
+ \param[in] name title label for the window
+ \param[in,out] r, g, b color components in the range 0.0 to 1.0.
+ \retval 1 if user confirms the selection
+ \retval 0 if user cancels the dialog
+ \relates Fl_Color_Chooser
+ */
int fl_color_chooser(const char* name, double& r, double& g, double& b) {
Fl_Window window(215,200,name);
Fl_Color_Chooser chooser(10, 10, 195, 115);
@@ -511,6 +574,16 @@ int fl_color_chooser(const char* name, double& r, double& g, double& b) {
return 0;
}
+/**
+ \brief Pops up a window to let the user pick an arbitrary RGB color.
+ \image html fl_color_chooser.jpg
+ \image latex fl_color_chooser.eps "fl_color_chooser" width=8cm
+ \param[in] name title label for the window
+ \param[in,out] r, g, b color components in the range 0 to 255.
+ \retval 1 if user confirms the selection
+ \retval 0 if user cancels the dialog
+ \relates Fl_Color_Chooser
+ */
int fl_color_chooser(const char* name, uchar& r, uchar& g, uchar& b) {
double dr = r/255.0;
double dg = g/255.0;
@@ -523,7 +596,7 @@ int fl_color_chooser(const char* name, uchar& r, uchar& g, uchar& b) {
}
return 0;
}
-
+/** @} */
//
-// End of "$Id: Fl_Color_Chooser.cxx 5190 2006-06-09 16:16:34Z mike $".
+// End of "$Id: Fl_Color_Chooser.cxx 6616 2009-01-01 21:28:26Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Counter.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Counter.cxx
index 53902236b..1b6575407 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Counter.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Counter.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Counter.cxx 5190 2006-06-09 16:16:34Z mike $"
+// "$Id: Fl_Counter.cxx 6616 2009-01-01 21:28:26Z matt $"
//
// Counter widget for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -174,12 +174,21 @@ int Fl_Counter::handle(int event) {
}
}
+/**
+ Destroys the valuator.
+ */
Fl_Counter::~Fl_Counter() {
Fl::remove_timeout(repeat_callback, this);
}
-Fl_Counter::Fl_Counter(int X, int Y, int W, int H, const char* l)
- : Fl_Valuator(X, Y, W, H, l) {
+/**
+ Creates a new Fl_Counter widget using the given position, size, and label
+ string. The default type is FL_NORMAL_COUNTER.
+ \param[in] X, Y, W, H position and size of the widget
+ \param[in] L widget label, default is no label
+ */
+Fl_Counter::Fl_Counter(int X, int Y, int W, int H, const char* L)
+ : Fl_Valuator(X, Y, W, H, L) {
box(FL_UP_BOX);
selection_color(FL_INACTIVE_COLOR); // was FL_BLUE
align(FL_ALIGN_BOTTOM);
@@ -188,10 +197,10 @@ Fl_Counter::Fl_Counter(int X, int Y, int W, int H, const char* l)
lstep_ = 1.0;
mouseobj = 0;
textfont_ = FL_HELVETICA;
- textsize_ = (uchar)FL_NORMAL_SIZE;
+ textsize_ = FL_NORMAL_SIZE;
textcolor_ = FL_FOREGROUND_COLOR;
}
//
-// End of "$Id: Fl_Counter.cxx 5190 2006-06-09 16:16:34Z mike $".
+// End of "$Id: Fl_Counter.cxx 6616 2009-01-01 21:28:26Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Dial.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Dial.cxx
index af5a1b83a..3acb26d8e 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Dial.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Dial.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Dial.cxx 5472 2006-09-20 03:03:14Z mike $"
+// "$Id: Fl_Dial.cxx 6616 2009-01-01 21:28:26Z matt $"
//
// Circular dial widget for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2006 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -32,7 +32,10 @@
#include
// All angles are measured with 0 to the right and counter-clockwise
-
+/**
+ Draws dial at given position and size.
+ \param[in] X, Y, W, H position and size
+*/
void Fl_Dial::draw(int X, int Y, int W, int H) {
if (damage()&FL_DAMAGE_ALL) draw_box(box(), X, Y, W, H, color());
X += Fl::box_dx(box());
@@ -92,11 +95,18 @@ void Fl_Dial::draw(int X, int Y, int W, int H) {
fl_pop_matrix();
}
+/**
+ Draws dial at current position and size.
+*/
void Fl_Dial::draw() {
draw(x(), y(), w(), h());
draw_label();
}
+/**
+ Allows subclasses to handle event based on given position and size.
+ \param[in] event, X, Y, W, H event to handle, related position and size.
+*/
int Fl_Dial::handle(int event, int X, int Y, int W, int H) {
switch (event) {
case FL_PUSH:
@@ -130,12 +140,19 @@ int Fl_Dial::handle(int event, int X, int Y, int W, int H) {
}
}
+/**
+ Allow subclasses to handle event based on current position and size.
+*/
int Fl_Dial::handle(int e) {
return handle(e, x(), y(), w(), h());
}
Fl_Dial::Fl_Dial(int X, int Y, int W, int H, const char* l)
- : Fl_Valuator(X, Y, W, H, l) {
+/**
+ Creates a new Fl_Dial widget using the given position, size,
+ and label string. The default type is FL_NORMAL_DIAL.
+*/
+: Fl_Valuator(X, Y, W, H, l) {
box(FL_OVAL_BOX);
selection_color(FL_INACTIVE_COLOR); // was 37
a1 = 45;
@@ -143,5 +160,5 @@ Fl_Dial::Fl_Dial(int X, int Y, int W, int H, const char* l)
}
//
-// End of "$Id: Fl_Dial.cxx 5472 2006-09-20 03:03:14Z mike $".
+// End of "$Id: Fl_Dial.cxx 6616 2009-01-01 21:28:26Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Double_Window.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Double_Window.cxx
index 4546d2424..f26951e4d 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Double_Window.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Double_Window.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Double_Window.cxx 5829 2007-05-14 15:51:00Z matt $"
+// "$Id: Fl_Double_Window.cxx 6616 2009-01-01 21:28:26Z matt $"
//
// Double-buffered window code for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2007 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -64,7 +64,13 @@ void Fl_Double_Window::show() {
Fl_Window::show();
}
-#ifdef WIN32
+#if defined(USE_X11)
+
+// maybe someone feels inclined to implement alpha blending on X11?
+char fl_can_do_alpha_blending() {
+ return 0;
+}
+#elif defined(WIN32)
// Code used to switch output to an off-screen window. See macros in
// win32.H which save the old state in local variables.
@@ -154,83 +160,6 @@ void fl_copy_offscreen_with_alpha(int x,int y,int w,int h,HBITMAP bitmap,int src
extern void fl_restore_clip();
-#elif defined(__APPLE_QD__)
-
-char fl_can_do_alpha_blending() {
- return 0;
-}
-
-GWorldPtr fl_create_offscreen(int w, int h) {
- GWorldPtr gw;
- Rect bounds;
- bounds.left=0; bounds.right=w; bounds.top=0; bounds.bottom=h;
- QDErr err = NewGWorld(&gw, 0, &bounds, 0L, 0L, 0); // 'useTempMem' should not be used (says the Carbon port manual)
- if ( err == -108 )
- { }
-// fl_message( "The application memory is low. Please increase the initial memory assignment.\n" );
- if (err!=noErr || gw==0L) return 0L;
- return gw;
-}
-
-void fl_copy_offscreen(int x,int y,int w,int h,GWorldPtr gWorld,int srcx,int srcy) {
- Rect src;
- if ( !gWorld ) return;
- src.top = srcy; src.left = srcx; src.bottom = srcy+h; src.right = srcx+w;
- Rect dst;
- GrafPtr dstPort; GetPort(&dstPort);
- dst.top = y; dst.left = x; dst.bottom = y+h; dst.right = x+w;
- RGBColor rgb, oldbg, oldfg;
- GetForeColor(&oldfg);
- GetBackColor(&oldbg);
- rgb.red = 0xffff; rgb.green = 0xffff; rgb.blue = 0xffff;
- RGBBackColor( &rgb );
- rgb.red = 0x0000; rgb.green = 0x0000; rgb.blue = 0x0000;
- RGBForeColor( &rgb );
- CopyBits(GetPortBitMapForCopyBits(gWorld), GetPortBitMapForCopyBits(dstPort), &src, &dst, srcCopy, 0L);
- RGBBackColor(&oldbg);
- RGBForeColor(&oldfg);
-}
-
-void fl_delete_offscreen(GWorldPtr gWorld) {
- DisposeGWorld(gWorld);
-}
-
-static GrafPtr prevPort;
-static GDHandle prevGD;
-
-void fl_begin_offscreen(GWorldPtr gWorld) {
- GetGWorld( &prevPort, &prevGD );
- if ( gWorld )
- {
- SetGWorld( gWorld, 0 ); // sets the correct port
- PixMapHandle pm = GetGWorldPixMap(gWorld);
- Boolean ret = LockPixels(pm);
- if ( ret == false )
- {
- Rect rect;
- GetPortBounds( gWorld, &rect );
- UpdateGWorld( &gWorld, 0, &rect, 0, 0, 0 );
- pm = GetGWorldPixMap( gWorld );
- LockPixels( pm );
- }
- fl_window = 0;
- }
- fl_push_no_clip();
-}
-
-void fl_end_offscreen() {
- GWorldPtr currPort;
- GDHandle currGD;
- GetGWorld( &currPort, &currGD );
- fl_pop_clip();
- PixMapHandle pm = GetGWorldPixMap(currPort);
- UnlockPixels(pm);
- SetGWorld( prevPort, prevGD );
- fl_window = GetWindowFromPort( prevPort );
-}
-
-extern void fl_restore_clip();
-
#elif defined(__APPLE_QUARTZ__)
char fl_can_do_alpha_blending() {
@@ -318,21 +247,23 @@ void fl_end_offscreen() {
extern void fl_restore_clip();
-#else // X11
-
-// maybe someone feels inclined to implement alpha blending on X11?
-char fl_can_do_alpha_blending() {
- return 0;
-}
-
+#else
+# error unsupported platform
#endif
-// Fl_Overlay_Window relies on flush(1) copying the back buffer to the
-// front everywhere, even if damage() == 0, thus erasing the overlay,
-// and leaving the clip region set to the entire window.
-
+/**
+ Forces the window to be redrawn.
+*/
void Fl_Double_Window::flush() {flush(0);}
+/**
+ Forces the window to be redrawn.
+ \param[in] eraseoverlay non-zero to erase overlay, zero to ignore
+
+ Fl_Overlay_Window relies on flush(1) copying the back buffer to the
+ front everywhere, even if damage() == 0, thus erasing the overlay,
+ and leaving the clip region set to the entire window.
+*/
void Fl_Double_Window::flush(int eraseoverlay) {
make_current(); // make sure fl_gc is non-zero
Fl_X *myi = Fl_X::i(this);
@@ -344,20 +275,16 @@ void Fl_Double_Window::flush(int eraseoverlay) {
myi->backbuffer_bad = 1;
} else
#endif
-#ifdef __APPLE_QD__
- if ( ( !QDIsPortBuffered( GetWindowPort(myi->xid) ) )
- || force_doublebuffering_ ) {
- myi->other_xid = fl_create_offscreen(w(), h());
- clear_damage(FL_DAMAGE_ALL);
- }
+#if defined(USE_X11) || defined(WIN32)
+ myi->other_xid = fl_create_offscreen(w(), h());
+ clear_damage(FL_DAMAGE_ALL);
#elif defined(__APPLE_QUARTZ__)
if (force_doublebuffering_) {
myi->other_xid = fl_create_offscreen(w(), h());
clear_damage(FL_DAMAGE_ALL);
}
#else
- myi->other_xid = fl_create_offscreen(w(), h());
- clear_damage(FL_DAMAGE_ALL);
+# error unsupported platform
#endif
}
#if USE_XDBE
@@ -396,6 +323,9 @@ void Fl_Double_Window::flush(int eraseoverlay) {
RestoreDC(fl_gc, save);
DeleteDC(fl_gc);
fl_gc = _sgc;
+ //# if defined(USE_CAIRO)
+ //if Fl::cairo_autolink_context() Fl::cairo_make_current(this); // capture gc changes automatically to update the cairo context adequately
+ //# endif
#elif defined(__APPLE__)
if ( myi->other_xid ) {
fl_begin_offscreen( myi->other_xid );
@@ -443,10 +373,15 @@ void Fl_Double_Window::hide() {
Fl_Window::hide();
}
+/**
+ The destructor also deletes all the children. This allows a
+ whole tree to be deleted at once, without having to keep a pointer to
+ all the children in the user code.
+*/
Fl_Double_Window::~Fl_Double_Window() {
hide();
}
//
-// End of "$Id: Fl_Double_Window.cxx 5829 2007-05-14 15:51:00Z matt $".
+// End of "$Id: Fl_Double_Window.cxx 6616 2009-01-01 21:28:26Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_File_Browser.cxx b/plugins/zynaddsubfx/fltk/src/Fl_File_Browser.cxx
index 35eee8345..1834185a4 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_File_Browser.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_File_Browser.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_File_Browser.cxx 5635 2007-01-23 15:02:00Z mike $"
+// "$Id: Fl_File_Browser.cxx 6616 2009-01-01 21:28:26Z matt $"
//
// Fl_File_Browser routines.
//
-// Copyright 1999-2006 by Michael Sweet.
+// Copyright 1999-2009 by Michael Sweet.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -538,13 +538,13 @@ Fl_File_Browser::load(const char *directory,// I - Directory to load
// Open the file that contains a list of mounted filesystems...
//
- mtab = fopen("/etc/mnttab", "r"); // Fairly standard
+ mtab = fl_fopen("/etc/mnttab", "r"); // Fairly standard
if (mtab == NULL)
- mtab = fopen("/etc/mtab", "r"); // More standard
+ mtab = fl_fopen("/etc/mtab", "r"); // More standard
if (mtab == NULL)
- mtab = fopen("/etc/fstab", "r"); // Otherwise fallback to full list
+ mtab = fl_fopen("/etc/fstab", "r"); // Otherwise fallback to full list
if (mtab == NULL)
- mtab = fopen("/etc/vfstab", "r"); // Alternate full list file
+ mtab = fl_fopen("/etc/vfstab", "r"); // Alternate full list file
if (mtab != NULL)
{
@@ -635,5 +635,5 @@ Fl_File_Browser::filter(const char *pattern) // I - Pattern string
//
-// End of "$Id: Fl_File_Browser.cxx 5635 2007-01-23 15:02:00Z mike $".
+// End of "$Id: Fl_File_Browser.cxx 6616 2009-01-01 21:28:26Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_File_Chooser.cxx b/plugins/zynaddsubfx/fltk/src/Fl_File_Chooser.cxx
index ef66b5c71..6a4ba00d3 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_File_Chooser.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_File_Chooser.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_File_Chooser.cxx 6092 2008-04-11 12:57:37Z matt $"
+// "$Id: Fl_File_Chooser.cxx 6616 2009-01-01 21:28:26Z matt $"
//
// Fl_File_Chooser dialog for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,7 +25,7 @@
// http://www.fltk.org/str.php
//
-// generated by Fast Light User Interface Designer (fluid) version 1.0108
+// generated by Fast Light User Interface Designer (fluid) version 1.0300
#include "../FL/Fl_File_Chooser.H"
#include
@@ -173,7 +173,7 @@ Fl_File_Chooser::Fl_File_Chooser(const char *d, const char *p, int t, const char
{ favoritesButton = new Fl_Menu_Button(290, 10, 155, 25, "Favorites");
favoritesButton->down_box(FL_BORDER_BOX);
favoritesButton->callback((Fl_Callback*)cb_favoritesButton);
- favoritesButton->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
+ favoritesButton->align(Fl_Align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE));
favoritesButton->label(favorites_label);
} // Fl_Menu_Button* favoritesButton
{ Fl_Button* o = newButton = new Fl_Button(455, 10, 25, 25);
@@ -194,7 +194,7 @@ Fl_File_Chooser::Fl_File_Chooser(const char *d, const char *p, int t, const char
{ previewBox = new Fl_Box(305, 45, 175, 225, "?");
previewBox->box(FL_DOWN_BOX);
previewBox->labelsize(100);
- previewBox->align(FL_ALIGN_CLIP|FL_ALIGN_INSIDE);
+ previewBox->align(Fl_Align(FL_ALIGN_CLIP|FL_ALIGN_INSIDE));
} // Fl_Box* previewBox
o->end();
Fl_Group::current()->resizable(o);
@@ -202,9 +202,9 @@ Fl_File_Chooser::Fl_File_Chooser(const char *d, const char *p, int t, const char
{ Fl_Group* o = new Fl_Group(10, 275, 470, 95);
{ Fl_Group* o = new Fl_Group(10, 275, 470, 20);
{ previewButton = new Fl_Check_Button(10, 275, 73, 20, "Preview");
+ previewButton->shortcut(0x80070);
previewButton->down_box(FL_DOWN_BOX);
previewButton->value(1);
- previewButton->shortcut(0x80070);
previewButton->callback((Fl_Callback*)cb_previewButton);
previewButton->label(preview_label);
} // Fl_Check_Button* previewButton
@@ -222,7 +222,7 @@ Fl_File_Chooser::Fl_File_Chooser(const char *d, const char *p, int t, const char
} // Fl_File_Input* fileName
{ Fl_Box* o = new Fl_Box(10, 310, 105, 25, "Filename:");
o->labelfont(1);
- o->align(FL_ALIGN_RIGHT|FL_ALIGN_INSIDE);
+ o->align(Fl_Align(FL_ALIGN_RIGHT|FL_ALIGN_INSIDE));
o->label(filename_label);
} // Fl_Box* o
{ Fl_Group* o = new Fl_Group(10, 345, 470, 25);
@@ -298,10 +298,12 @@ int e;
prefs_.get("preview", e, 1);
preview(e);
Fl_Group::current(prev_current);
+ ext_group=(Fl_Widget*)0;
}
Fl_File_Chooser::~Fl_File_Chooser() {
Fl::remove_timeout((Fl_Timeout_Handler)previewCB, this);
+if(ext_group)window->remove(ext_group);
delete window;
delete favWindow;
}
@@ -391,19 +393,19 @@ Fl_Color Fl_File_Chooser::textcolor() {
return (fileList->textcolor());
}
-void Fl_File_Chooser::textfont(uchar f) {
+void Fl_File_Chooser::textfont(Fl_Font f) {
fileList->textfont(f);
}
-uchar Fl_File_Chooser::textfont() {
+Fl_Font Fl_File_Chooser::textfont() {
return (fileList->textfont());
}
-void Fl_File_Chooser::textsize(uchar s) {
+void Fl_File_Chooser::textsize(Fl_Fontsize s) {
fileList->textsize(s);
}
-uchar Fl_File_Chooser::textsize() {
+Fl_Fontsize Fl_File_Chooser::textsize() {
return (fileList->textsize());
}
@@ -439,6 +441,33 @@ int Fl_File_Chooser::visible() {
return window->visible();
}
+Fl_Widget* Fl_File_Chooser::add_extra(Fl_Widget* gr) {
+ Fl_Widget* ret=ext_group;
+ if (gr==ext_group) {
+ return ret;
+ }
+ if (ext_group) {
+ int sh=ext_group->h()+4;
+Fl_Widget* svres=window->resizable();
+window->resizable(NULL);
+window->size(window->w(),window->h()-sh);
+window->remove(ext_group);
+ext_group=NULL;
+window->resizable(svres);
+ }
+ if (gr) {
+ int nh=window->h()+gr->h()+4;
+Fl_Widget* svres=window->resizable();
+window->resizable(NULL);
+window->size(window->w(),nh);
+gr->position(2,okButton->y()+okButton->h()+2);
+window->add(gr);
+ext_group=gr;
+window->resizable(svres);
+ }
+ return ret;
+}
+
//
-// End of "$Id: Fl_File_Chooser.cxx 6092 2008-04-11 12:57:37Z matt $".
+// End of "$Id: Fl_File_Chooser.cxx 6616 2009-01-01 21:28:26Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_File_Chooser.fl b/plugins/zynaddsubfx/fltk/src/Fl_File_Chooser.fl
index 991b39f70..84716418b 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_File_Chooser.fl
+++ b/plugins/zynaddsubfx/fltk/src/Fl_File_Chooser.fl
@@ -1,13 +1,13 @@
# data file for the Fltk User Interface Designer (fluid)
-version 1.0108
+version 1.0300
header_name {../FL/Fl_File_Chooser.H}
code_name {.cxx}
comment {//
-// "$Id: Fl_File_Chooser.fl 6092 2008-04-11 12:57:37Z matt $"
+// "$Id: Fl_File_Chooser.fl 6678 2009-03-13 23:36:09Z AlbrechtS $"
//
// Fl_File_Chooser dialog for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -53,8 +53,7 @@ class FL_EXPORT Fl_File_Chooser {open
decl {void showChoiceCB();} {}
decl {void update_favorites();} {}
decl {void update_preview();} {}
- Function {Fl_File_Chooser(const char *d, const char *p, int t, const char *title)} {open
- } {
+ Function {Fl_File_Chooser(const char *d, const char *p, int t, const char *title)} {} {
code {Fl_Group *prev_current = Fl_Group::current();} {}
Fl_Window window {
label {Choose File}
@@ -62,13 +61,13 @@ class FL_EXPORT Fl_File_Chooser {open
fileList->deselect();
Fl::remove_timeout((Fl_Timeout_Handler)previewCB, this);
window->hide();} open
- private xywh {388 284 490 380} type Double resizable
+ private xywh {507 327 490 380} type Double resizable
code0 {if (title) window->label(title);}
code1 {\#include }
code2 {\#include }
code3 {\#include } modal visible
} {
- Fl_Group {} {
+ Fl_Group {} {open
private xywh {10 10 470 25}
} {
Fl_Choice showChoice {
@@ -100,7 +99,7 @@ window->hide();} open
code0 {\#include }
}
Fl_Box previewBox {
- label {?} selected
+ label {?}
private xywh {305 45 175 225} box DOWN_BOX labelsize 100 align 80
}
}
@@ -221,9 +220,12 @@ int e;
prefs_.get("preview", e, 1);
preview(e);
Fl_Group::current(prev_current);} {}
+ code {ext_group=(Fl_Widget*)0;} {}
}
- Function {~Fl_File_Chooser()} {} {
+ Function {~Fl_File_Chooser()} {open
+ } {
code {Fl::remove_timeout((Fl_Timeout_Handler)previewCB, this);
+if(ext_group)window->remove(ext_group);
delete window;
delete favWindow;} {}
}
@@ -325,19 +327,19 @@ fileName->take_focus();} {}
} {
code {return (fileList->textcolor());} {}
}
- Function {textfont(uchar f)} {return_type void
+ Function {textfont(Fl_Font f)} {return_type void
} {
code {fileList->textfont(f);} {}
}
- Function {textfont()} {return_type uchar
+ Function {textfont()} {selected return_type Fl_Font
} {
code {return (fileList->textfont());} {}
}
- Function {textsize(uchar s)} {return_type void
+ Function {textsize(Fl_Fontsize s)} {return_type void
} {
code {fileList->textsize(s);} {}
}
- Function {textsize()} {return_type uchar
+ Function {textsize()} {return_type Fl_Fontsize
} {
code {return (fileList->textsize());} {}
}
@@ -377,33 +379,79 @@ else
} {
code {return window->visible();} {}
}
- decl {static const char *add_favorites_label;} {public
+ decl {static const char *add_favorites_label;} {
+ comment {[standard text may be customized at run-time]} public
}
- decl {static const char *all_files_label;} {public
+ decl {static const char *all_files_label;} {
+ comment {[standard text may be customized at run-time]} public
}
- decl {static const char *custom_filter_label;} {public
+ decl {static const char *custom_filter_label;} {
+ comment {[standard text may be customized at run-time]} public
}
- decl {static const char *existing_file_label;} {public
+ decl {static const char *existing_file_label;} {
+ comment {[standard text may be customized at run-time]} public
}
- decl {static const char *favorites_label;} {public
+ decl {static const char *favorites_label;} {
+ comment {[standard text may be customized at run-time]} public
}
- decl {static const char *filename_label;} {public
+ decl {static const char *filename_label;} {
+ comment {[standard text may be customized at run-time]} public
}
- decl {static const char *filesystems_label;} {public
+ decl {static const char *filesystems_label;} {
+ comment {[standard text may be customized at run-time]} public
}
- decl {static const char *manage_favorites_label;} {public
+ decl {static const char *manage_favorites_label;} {
+ comment {[standard text may be customized at run-time]} public
}
- decl {static const char *new_directory_label;} {public
+ decl {static const char *new_directory_label;} {
+ comment {[standard text may be customized at run-time]} public
}
- decl {static const char *new_directory_tooltip;} {public
+ decl {static const char *new_directory_tooltip;} {
+ comment {[standard text may be customized at run-time]} public
}
- decl {static const char *preview_label;} {public
+ decl {static const char *preview_label;} {
+ comment {[standard text may be customized at run-time]} public
}
- decl {static const char *save_label;} {public
+ decl {static const char *save_label;} {
+ comment {[standard text may be customized at run-time]} public
}
- decl {static const char *show_label;} {public
+ decl {static const char *show_label;} {
+ comment {[standard text may be customized at run-time]} public
}
- decl {static Fl_File_Sort_F *sort;} {public
+ decl {static Fl_File_Sort_F *sort;} {
+ comment {the sort function that is used when loading
+the contents of a directory.} public
+ }
+ decl {Fl_Widget* ext_group;} {}
+ Function {add_extra(Fl_Widget* gr)} {open return_type {Fl_Widget*}
+ } {
+ code {Fl_Widget* ret=ext_group;} {}
+ codeblock {if (gr==ext_group)} {open
+ } {
+ code {return ret;} {}
+ }
+ codeblock {if (ext_group)} {open
+ } {
+ code {int sh=ext_group->h()+4;
+Fl_Widget* svres=window->resizable();
+window->resizable(NULL);
+window->size(window->w(),window->h()-sh);
+window->remove(ext_group);
+ext_group=NULL;
+window->resizable(svres);} {}
+ }
+ codeblock {if (gr)} {open
+ } {
+ code {int nh=window->h()+gr->h()+4;
+Fl_Widget* svres=window->resizable();
+window->resizable(NULL);
+window->size(window->w(),nh);
+gr->position(2,okButton->y()+okButton->h()+2);
+window->add(gr);
+ext_group=gr;
+window->resizable(svres);} {}
+ }
+ code {return ret;} {}
}
}
@@ -421,6 +469,6 @@ decl {FL_EXPORT void fl_file_chooser_ok_label(const char*l);} {public
comment {
//
-// End of "$Id: Fl_File_Chooser.fl 6092 2008-04-11 12:57:37Z matt $".
+// End of "$Id: Fl_File_Chooser.fl 6678 2009-03-13 23:36:09Z AlbrechtS $".
//} {in_source in_header
}
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_File_Chooser2.cxx b/plugins/zynaddsubfx/fltk/src/Fl_File_Chooser2.cxx
index f2bf38af8..f94bc5859 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_File_Chooser2.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_File_Chooser2.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_File_Chooser2.cxx 6092 2008-04-11 12:57:37Z matt $"
+// "$Id: Fl_File_Chooser2.cxx 6678 2009-03-13 23:36:09Z AlbrechtS $"
//
// More Fl_File_Chooser routines.
//
-// Copyright 1999-2005 by Michael Sweet.
+// Copyright 1999-2009 by Michael Sweet.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -24,6 +24,288 @@
//
// http://www.fltk.org/str.php
//
+
+// fabien: ATTENTION: Only Out Of Source Gen. because cxx/H files are autogenerated by fluid.
+/** \defgroup group_comdlg Common Dialogs classes and functions
+ @{
+*/
+/** \class Fl_File_Chooser
+ The Fl_File_Chooser widget displays a standard file selection
+ dialog that supports various selection modes.
+
+ \image html Fl_File_Chooser.jpg
+ \image latex Fl_File_Chooser.eps "Fl_File_Chooser" width=12cm
+
+ The Fl_File_Chooser class also exports several static values
+ that may be used to localize or customize the appearance of all file chooser
+ dialogs:
+
+
+
+ | Member |
+ Default value |
+
+
+ | add_favorites_label |
+ "Add to Favorites" |
+
+
+ | all_files_label |
+ "All Files (*)" |
+
+
+ | custom_filter_label |
+ "Custom Filter" |
+
+
+ | existing_file_label |
+ "Please choose an existing file!" |
+
+
+ | favorites_label |
+ "Favorites" |
+
+
+ | filename_label |
+ "Filename:" |
+
+
+ | filesystems_label |
+ "My Computer" (WIN32)
+ "File Systems" (all others) |
+
+
+ | manage_favorites_label |
+ "Manage Favorites" |
+
+
+ | new_directory_label |
+ "New Directory?" |
+
+
+ | new_directory_tooltip |
+ "Create a new directory." |
+
+
+ | preview_label |
+ "Preview" |
+
+
+ | save_label |
+ "Save" |
+
+
+ | show_label |
+ "Show:" |
+
+
+ | sort |
+ fl_numericsort |
+
+
+
+ The Fl_File_Chooser::sort member specifies the sort function that is
+ used when loading the contents of a directory and can be customized
+ at run-time.
+
+ The Fl_File_Chooser class also exports the Fl_File_Chooser::newButton
+ and Fl_File_Chooser::previewButton widgets so that application developers
+ can control their appearance and use. For more complex customization,
+ consider copying the FLTK file chooser code and changing it accordingly.
+*/
+/** @} */
+
+/** \fn Fl_File_Chooser::Fl_File_Chooser(const char *pathname, const char *pattern, int type, const char *title)
+ The constructor creates the Fl_File_Chooser dialog shown.
+ The pathname argument can be a directory name or a
+ complete file name (in which case the corresponding file is highlighted
+ in the list and in the filename input field.)
+
+ The pattern argument can be a NULL
+ string or "*" to list all files, or it can be a
+ series of descriptions and filter strings separated by tab
+ characters (\\t). The format of filters is either
+ "Description text (patterns)" or just "patterns". A file chooser
+ that provides filters for HTML and image files might look like:
+
+ \code
+ "HTML Files (*.html)\tImage Files (*.{bmp,gif,jpg,png})"
+ \endcode
+
+ The file chooser will automatically add the "All Files (*)"
+ pattern to the end of the string you pass if you do not provide
+ one. The first filter in the string is the default filter.
+
+ See the FLTK documentation on fl_filename_match()
+ for the kinds of pattern strings that are supported.
+
+ The type argument can be one of the following:
+
+ \li \c SINGLE - allows the user to select a single, existing file.
+ \li \c MULTI - allows the user to select one or more existing files.
+ \li \c CREATE - allows the user to select a single, existing file or
+ specify a new filename.
+ \li \c DIRECTORY - allows the user to select a single, existing directory.
+
+ The title argument is used to set the title bar text for the
+ Fl_File_Chooser window.
+*/
+
+/** \var Fl_File_Chooser::newButton
+ The "new directory" button is exported so that application developers
+ can control the appearance and use.
+*/
+
+/** \var Fl_File_Chooser::previewButton
+ The "preview" button is exported so that application developers can
+ control the appearance and use.
+*/
+
+/** \fn Fl_File_Chooser::~Fl_File_Chooser()
+ Destroys the widget and frees all memory used by it.*/
+
+/** \fn void Fl_File_Chooser::color(Fl_Color c)
+ Sets or gets the background color of the Fl_File_Browser list.*/
+
+/** \fn Fl_Color Fl_File_Chooser::color()
+ Sets or gets the background color of the Fl_File_Browser list.*/
+
+/** \fn int Fl_File_Chooser::count()
+ Returns the number of selected files.*/
+
+/** \fn void Fl_File_Chooser::directory(const char *pathname)
+ Sets or gets the current directory.*/
+
+/** \fn const char *Fl_File_Chooser::directory()
+ Sets or gets the current directory.*/
+
+/** \fn void Fl_File_Chooser::filter(const char *pattern)
+ Sets or gets the current filename filter patterns. The filter
+ patterns use fl_filename_match().
+ Multiple patterns can be used by separating them with tabs, like
+ "*.jpg\t*.png\t*.gif\t*". In addition, you can provide
+ human-readable labels with the patterns inside parenthesis, like
+ "JPEG Files (*.jpg)\tPNG Files (*.png)\tGIF Files (*.gif)\tAll Files (*)"
+ .
+
+ Use filter(NULL) to show all files.
+*/
+
+/** \fn const char *Fl_File_Chooser::filter()
+ See void filter(const char *pattern)*/
+
+/** \fn void Fl_File_Chooser::filter_value(int f)
+ Sets or gets the current filename filter selection.*/
+
+/** \fn int Fl_File_Chooser::filter_value()
+ Sets or gets the current filename filter selection.*/
+
+/** \fn void Fl_File_Chooser::hide()
+ Hides the Fl_File_Chooser window.*/
+
+/** \fn void Fl_File_Chooser::iconsize(uchar s)
+ Sets or gets the size of the icons in the Fl_File_Browser. By
+ default the icon size is set to 1.5 times the textsize().
+*/
+
+/** \fn uchar Fl_File_Chooser::iconsize()
+ Sets or gets the size of the icons in the Fl_File_Browser. By
+ default the icon size is set to 1.5 times the textsize().
+*/
+
+/** \fn void Fl_File_Chooser::label(const char *l)
+ Sets or gets the title bar text for the Fl_File_Chooser.*/
+
+/** \fn const char *Fl_File_Chooser::label()
+ Sets or gets the title bar text for the Fl_File_Chooser.*/
+
+/** \fn void Fl_File_Chooser::ok_label(const char *l)
+ Sets or gets the label for the "ok" button in the Fl_File_Chooser.
+*/
+
+/** \fn const char *Fl_File_Chooser::ok_label()
+ Sets or gets the label for the "ok" button in the Fl_File_Chooser.
+*/
+
+/** \fn int Fl_File_Chooser::preview() const
+ Returns the current state of the preview box. */
+
+/** \fn void Fl_File_Chooser::rescan()
+ Reloads the current directory in the Fl_File_Browser.*/
+
+/** \fn void Fl_File_Chooser::show()
+ Shows the Fl_File_Chooser window.*/
+
+/** \fn void Fl_File_Chooser::textcolor(Fl_Color c)
+ Sets or gets the current Fl_File_Browser text color.*/
+
+/** \fn Fl_Color Fl_File_Chooser::textcolor()
+ Sets or gets the current Fl_File_Browser text color.*/
+
+/** \fn void Fl_File_Chooser::textfont(Fl_Font f)
+ Sets or gets the current Fl_File_Browser text font.*/
+
+/** \fn Fl_Font Fl_File_Chooser::textfont()
+ Sets or gets the current Fl_File_Browser text font.*/
+
+/** \fn void Fl_File_Chooser::textsize(Fl_Fontsize s)
+ Sets or gets the current Fl_File_Browser text size.*/
+
+/** \fn Fl_Fontsize Fl_File_Chooser::textsize()
+ Sets or gets the current Fl_File_Browser text size.*/
+
+/** \fn void Fl_File_Chooser::type(int t)
+ Sets or gets the current type of Fl_File_Chooser.*/
+
+/** \fn int Fl_File_Chooser::type()
+ Sets or gets the current type of Fl_File_Chooser.*/
+
+/** \fn const char *Fl_File_Chooser::value(const char *pathname)
+ Sets or gets the current value of the selected file.
+
+ In the second form, \p file is a \c 1-based index into a list of
+ file names. The number of selected files is returned by
+ Fl_File_Chooser::count().
+
+ This sample code loops through all selected files:
+ \code
+ // Get list of filenames user selected from a MULTI chooser
+ for ( int t=1; t<=chooser->count(); t++ ) {
+ const char *filename = chooser->value(t);
+ ...
+ }
+ \endcode
+*/
+
+/** \fn const char *Fl_File_Chooser::value(int file)
+ See const char *value(const char *pathname)*/
+
+/** \fn int Fl_File_Chooser::visible()
+ Returns 1 if the Fl_File_Chooser window is visible.*/
+
+/** \fn Fl_Widget* Fl_File_Chooser::add_extra(Fl_Widget*)
+ Adds extra widget at the bottom of Fl_File_Chooser window.
+ Returns pointer for previous extra widget or NULL if not set previously.
+ If argument is NULL only remove previous extra widget.
+
+ \note Fl_File_Chooser does \b not delete extra widget in destructor!
+ To prevent memory leakage, don't forget to delete unused extra widgets
+*/
+ /** \fn int Fl_File_Chooser::shown()
+ Returns non-zero if the file chooser main window show() has been called (but not hide()
+ see Fl_Window::shown()
+ */
+
+ /** \fn void Fl_File_Chooser::callback(void (*cb)(Fl_File_Chooser *, void *), void *d = 0)
+ Sets the file chooser callback cb and associated data d */
+
+ /** \fn void Fl_File_Chooser::user_data(void *d)
+ Sets the file chooser user data d */
+
+ /** \fn void * Fl_File_Chooser::user_data() const
+ Gets the file chooser user data d */
+// *** END OF OUT OF SOURCE DOC ***
+
// Contents:
//
// Fl_File_Chooser::count() - Return the number of selected files.
@@ -41,6 +323,13 @@
// quote_pathname() - Quote a pathname for a menu.
// unquote_pathname() - Unquote a pathname from a menu.
//
+// Fl_File_Chooser::add_extra() - add extra widget at the bottom, return pointer
+// to previous extra widget or NULL if none,
+// If argument is NULL extra widget removed.
+// NOTE! file chooser does't delete extra widget in
+// destructor! To prevent memory leakage don't forget
+// delete unused extra widgets by yourself.
+//
//
// Include necessary headers.
@@ -787,12 +1076,9 @@ Fl_File_Chooser::newdir()
}
-//
-// 'Fl_File_Chooser::preview()' - Enable or disable the preview tile.
-//
-void
-Fl_File_Chooser::preview(int e)// I - 1 = enable preview, 0 = disable preview
+/** Enable or disable the preview tile. 1 = enable preview, 0 = disable preview. */
+void Fl_File_Chooser::preview(int e)
{
previewButton->value(e);
prefs_.set("preview", e);
@@ -861,12 +1147,11 @@ Fl_File_Chooser::rescan()
}
//
-// 'Fl_File_Chooser::rescan_keep_filename()' - Rescan the current directory
-// without clearing the filename, then select the file if it is in the list
-//
-
-void
-Fl_File_Chooser::rescan_keep_filename()
+/**
+ Rescan the current directory without clearing the filename,
+ then select the file if it is in the list
+*/
+void Fl_File_Chooser::rescan_keep_filename()
{
// if no filename was set, this is likely a diretory browser
const char *fn = fileName->value();
@@ -1067,7 +1352,7 @@ Fl_File_Chooser::update_preview()
previewBox->label(preview_text_);
previewBox->align((Fl_Align)(FL_ALIGN_CLIP | FL_ALIGN_INSIDE |
FL_ALIGN_LEFT | FL_ALIGN_TOP));
- previewBox->labelsize((uchar)size);
+ previewBox->labelsize(size);
previewBox->labelfont(FL_COURIER);
}
} else {
@@ -1304,5 +1589,5 @@ unquote_pathname(char *dst, // O - Destination string
//
-// End of "$Id: Fl_File_Chooser2.cxx 6092 2008-04-11 12:57:37Z matt $".
+// End of "$Id: Fl_File_Chooser2.cxx 6678 2009-03-13 23:36:09Z AlbrechtS $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_File_Icon.cxx b/plugins/zynaddsubfx/fltk/src/Fl_File_Icon.cxx
index ec671c73d..7de58c8b7 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_File_Icon.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_File_Icon.cxx
@@ -1,11 +1,11 @@
//
-// "$Id: Fl_File_Icon.cxx 5190 2006-06-09 16:16:34Z mike $"
+// "$Id: Fl_File_Icon.cxx 6616 2009-01-01 21:28:26Z matt $"
//
// Fl_File_Icon routines.
//
// KDE icon code donated by Maarten De Boer.
//
-// Copyright 1999-2005 by Michael Sweet.
+// Copyright 1999-2009 by Michael Sweet.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -43,6 +43,7 @@
#include
#include
+#include
#include "flstring.h"
#include
#include
@@ -80,10 +81,13 @@
Fl_File_Icon *Fl_File_Icon::first_ = (Fl_File_Icon *)0;
-//
-// 'Fl_File_Icon::Fl_File_Icon()' - Create a new file icon.
-//
-
+/**
+ Creates a new Fl_File_Icon with the specified information.
+ \param[in] p filename pattern
+ \param[in] t file type
+ \param[in] nd number of data values
+ \param[in] d data values
+*/
Fl_File_Icon::Fl_File_Icon(const char *p, /* I - Filename pattern */
int t, /* I - File type */
int nd, /* I - Number of data values */
@@ -113,12 +117,11 @@ Fl_File_Icon::Fl_File_Icon(const char *p, /* I - Filename pattern */
}
-//
-// 'Fl_File_Icon::~Fl_File_Icon()' - Remove a file icon.
-//
-
-Fl_File_Icon::~Fl_File_Icon()
-{
+/**
+ The destructor destroys the icon and frees all memory that has been
+ allocated for it.
+*/
+Fl_File_Icon::~Fl_File_Icon() {
Fl_File_Icon *current, // Current icon in list
*prev; // Previous icon in list
@@ -143,10 +146,10 @@ Fl_File_Icon::~Fl_File_Icon()
}
-//
-// 'Fl_File_Icon::add()' - Add data to an icon.
-//
-
+/**
+ Adds a keyword value to the icon array, returning a pointer to it.
+ \param[in] d data value
+*/
short * // O - Pointer to new data value
Fl_File_Icon::add(short d) // I - Data to add
{
@@ -177,10 +180,12 @@ Fl_File_Icon::add(short d) // I - Data to add
}
-//
-// 'Fl_File_Icon::find()' - Find an icon based upon a given file.
-//
-
+/**
+ Finds an icon that matches the given filename and file type.
+ \param[in] filename name of file
+ \param[in] filetype enumerated file type
+ \return matching file icon or NULL
+*/
Fl_File_Icon * // O - Matching file icon or NULL
Fl_File_Icon::find(const char *filename,// I - Name of file */
int filetype) // I - Enumerated file type
@@ -203,7 +208,7 @@ Fl_File_Icon::find(const char *filename,// I - Name of file */
else
filetype = PLAIN;
#else
- if (!stat(filename, &fileinfo))
+ if (!fl_stat(filename, &fileinfo))
{
if (S_ISDIR(fileinfo.st_mode))
filetype = DIRECTORY;
@@ -242,11 +247,12 @@ Fl_File_Icon::find(const char *filename,// I - Name of file */
return (current);
}
-
-//
-// 'Fl_File_Icon::draw()' - Draw an icon.
-//
-
+/**
+ Draws an icon in the indicated area.
+ \param[in] x, y, w, h position and size
+ \param[in] ic icon color
+ \param[in] active status, default is active [non-zero]
+*/
void
Fl_File_Icon::draw(int x, // I - Upper-lefthand X
int y, // I - Upper-lefthand Y
@@ -445,23 +451,24 @@ Fl_File_Icon::draw(int x, // I - Upper-lefthand X
fl_pop_matrix();
}
-
-//
-// 'Fl_File_Icon::label()' - Set the widget's label to an icon.
-//
-
-void
-Fl_File_Icon::label(Fl_Widget *w) // I - Widget to label
+/**
+ Applies the icon to the widget, registering the Fl_File_Icon
+ label type as needed.
+ \param[in] w widget for which this icon will become the label
+*/
+void Fl_File_Icon::label(Fl_Widget *w) // I - Widget to label
{
Fl::set_labeltype(_FL_ICON_LABEL, labeltype, 0);
w->label(_FL_ICON_LABEL, (const char*)this);
}
-//
-// 'Fl_File_Icon::labeltype()' - Draw the icon label.
-//
-
+/**
+ Draw the icon label.
+ \param[in] o label data
+ \param[in] x, y, w, h position and size of label
+ \param[in] a label alignment [not used]
+*/
void
Fl_File_Icon::labeltype(const Fl_Label *o, // I - Label data
int x, // I - X position of label
@@ -481,5 +488,5 @@ Fl_File_Icon::labeltype(const Fl_Label *o, // I - Label data
//
-// End of "$Id: Fl_File_Icon.cxx 5190 2006-06-09 16:16:34Z mike $".
+// End of "$Id: Fl_File_Icon.cxx 6616 2009-01-01 21:28:26Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_File_Input.cxx b/plugins/zynaddsubfx/fltk/src/Fl_File_Input.cxx
index 009eaaa69..d46c98452 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_File_Input.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_File_Input.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_File_Input.cxx 5190 2006-06-09 16:16:34Z mike $"
+// "$Id: Fl_File_Input.cxx 6758 2009-04-13 07:32:01Z matt $"
//
// File_Input header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
// Original version Copyright 1998 by Curtis Edwards.
//
// This library is free software; you can redistribute it and/or
@@ -48,12 +48,14 @@
#define FL_DAMAGE_BAR 0x10
-//
-// 'Fl_File_Input::Fl_File_Input()' - Create a Fl_File_Input widget.
-//
-
-Fl_File_Input::Fl_File_Input(int X, int Y, int W, int H, const char *l)
- : Fl_Input(X, Y, W, H, l) {
+/**
+ Creates a new Fl_File_Input widget using the given position,
+ size, and label string. The default boxtype is FL_DOWN_BOX.
+ \param[in] X, Y, W, H position and size of the widget
+ \param[in] L widget label, default is no label
+*/
+Fl_File_Input::Fl_File_Input(int X, int Y, int W, int H, const char *L)
+ : Fl_Input(X, Y, W, H, L) {
buttons_[0] = 0;
errorcolor_ = FL_RED;
ok_entry_ = 1;
@@ -62,12 +64,10 @@ Fl_File_Input::Fl_File_Input(int X, int Y, int W, int H, const char *l)
down_box(FL_UP_BOX);
}
-//
-// 'Fl_File_Input::draw_buttons()' - Draw directory buttons.
-//
-
-void
-Fl_File_Input::draw_buttons() {
+/**
+ Draw directory buttons.
+*/
+void Fl_File_Input::draw_buttons() {
int i, // Looping var
X; // Current X position
@@ -101,12 +101,10 @@ Fl_File_Input::draw_buttons() {
}
}
-//
-// 'Fl_File_Input::update_buttons()' - Update the sizes of the directory buttons.
-//
-
-void
-Fl_File_Input::update_buttons() {
+/**
+ Update the sizes of the directory buttons.
+*/
+void Fl_File_Input::update_buttons() {
int i; // Looping var
const char *start, // Start of path component
*end; // End of path component
@@ -140,10 +138,12 @@ Fl_File_Input::update_buttons() {
}
-//
-// 'Fl_File_Input::value()' - Set the value of the widget...
-//
-
+/**
+ Sets the value of the widget given a new string value and its length.
+ Returns non 0 on success.
+ \param[in] str new string value
+ \param[in] len lengh of value
+*/
int // O - TRUE on success
Fl_File_Input::value(const char *str, // I - New string value
int len) { // I - Length of value
@@ -152,6 +152,11 @@ Fl_File_Input::value(const char *str, // I - New string value
}
+/**
+ Sets the value of the widget given a new string value.
+ Returns non 0 on success.
+ \param[in] str new string value
+*/
int // O - TRUE on success
Fl_File_Input::value(const char *str) { // I - New string value
damage(FL_DAMAGE_BAR);
@@ -159,12 +164,10 @@ Fl_File_Input::value(const char *str) { // I - New string value
}
-//
-// 'Fl_File_Input::draw()' - Draw the file input widget...
-//
-
-void
-Fl_File_Input::draw() {
+/**
+ Draws the file input widget
+*/
+void Fl_File_Input::draw() {
Fl_Boxtype b = box();
if (damage() & (FL_DAMAGE_BAR | FL_DAMAGE_ALL)) draw_buttons();
// this flag keeps Fl_Input_::drawtext from drawing a bogus box!
@@ -178,47 +181,55 @@ Fl_File_Input::draw() {
}
-//
-// 'Fl_File_Input::handle()' - Handle events in the widget...
-//
+/**
+ Handle events in the widget.
+ Return non zero if event is handled.
+ \param[in] event
+*/
int // O - TRUE if we handled event
Fl_File_Input::handle(int event) // I - Event
{
// printf("handle(event = %d)\n", event);
+ static char inButtonBar = 0;
switch (event) {
case FL_MOVE :
case FL_ENTER :
if (active_r()) {
- if (Fl::event_y() < (y() + DIR_HEIGHT)) window()->cursor(FL_CURSOR_DEFAULT);
- else window()->cursor(FL_CURSOR_INSERT);
+ if (Fl::event_y() < (y() + DIR_HEIGHT))
+ window()->cursor(FL_CURSOR_DEFAULT);
+ else
+ window()->cursor(FL_CURSOR_INSERT);
}
return 1;
case FL_PUSH :
+ inButtonBar = (Fl::event_y() < (y() + DIR_HEIGHT));
case FL_RELEASE :
case FL_DRAG :
- if (Fl::event_y() < (y() + DIR_HEIGHT) || pressed_ >= 0) return handle_button(event);
-
- return Fl_Input::handle(event);
+ if (inButtonBar)
+ return handle_button(event);
+ else
+ return Fl_Input::handle(event);
default :
if (Fl_Input::handle(event)) {
damage(FL_DAMAGE_BAR);
return 1;
}
-
return 0;
}
}
-//
-// 'Fl_File_Input::handle_button()' - Handle button events in the widget...
-//
+/**
+ Handles button events in the widget.
+ Return non zero if event is handled.
+ \param[in] event
+*/
int // O - TRUE if we handled event
Fl_File_Input::handle_button(int event) // I - Event
{
@@ -271,7 +282,7 @@ Fl_File_Input::handle_button(int event) // I - Event
// Then do the callbacks, if necessary...
set_changed();
- if (when() & FL_WHEN_CHANGED) do_callback();
+ if (when() & (FL_WHEN_CHANGED|FL_WHEN_RELEASE) ) do_callback();
}
return 1;
@@ -279,5 +290,5 @@ Fl_File_Input::handle_button(int event) // I - Event
//
-// End of "$Id: Fl_File_Input.cxx 5190 2006-06-09 16:16:34Z mike $".
+// End of "$Id: Fl_File_Input.cxx 6758 2009-04-13 07:32:01Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Font.H b/plugins/zynaddsubfx/fltk/src/Fl_Font.H
index 4781ae02a..9869eb752 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Font.H
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Font.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Font.H 5334 2006-08-19 15:24:55Z matt $"
+// "$Id: Fl_Font.H 6779 2009-04-24 09:28:30Z yuri $"
//
// Font definitions for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -30,11 +30,6 @@
// Fl_Fontdesc: an entry into the fl_font() table. There is one of these
// for each fltk font number.
//
-// Fl_FontSize: a structure for an actual system font, with junk to
-// help choose it and info on character sizes. Each Fl_Fontdesc has a
-// linked list of these. These are created the first time each system
-// font/size combination is used.
-
#ifndef FL_FONT_
#define FL_FONT_
@@ -42,54 +37,70 @@
# if USE_XFT
typedef struct _XftFont XftFont;
+# elif !defined(WIN32) && !defined(__APPLE__)
+# include
# endif // USE_XFT
-class Fl_FontSize {
+/**
+ This a structure for an actual system font, with junk to
+ help choose it and info on character sizes. Each Fl_Fontdesc has a
+ linked list of these. These are created the first time each system
+ font/size combination is used.
+*/
+class Fl_Font_Descriptor {
public:
- Fl_FontSize *next; // linked list for this Fl_Fontdesc
+ /** linked list for this Fl_Fontdesc */
+ Fl_Font_Descriptor *next;
+#ifndef FL_DOXYGEN // don't bother with platorm dependant details in the doc.
# ifdef WIN32
HFONT fid;
- int width[256];
+ int *width[64];
TEXTMETRIC metr;
- FL_EXPORT Fl_FontSize(const char* fontname, int size);
+ int angle;
+ FL_EXPORT Fl_Font_Descriptor(const char* fontname, Fl_Fontsize size);
# elif defined(__APPLE_QD__)
- FL_EXPORT Fl_FontSize(const char* fontname, int size);
+ FL_EXPORT Fl_Font_Descriptor(const char* fontname, Fl_Fontsize size);
short font, face, size;
short ascent, descent;
short width[256];
bool knowMetrics;
# elif defined(__APPLE_QUARTZ__)
- FL_EXPORT Fl_FontSize(const char* fontname, int size);
+ FL_EXPORT Fl_Font_Descriptor(const char* fontname, Fl_Fontsize size);
ATSUTextLayout layout;
ATSUStyle style;
short ascent, descent, q_width;
- short width[256];
- bool knowWidths;
+// short width[256];
+// bool knowWidths;
char *q_name;
int size;
# elif USE_XFT
XftFont* font;
const char* encoding;
- int size;
- FL_EXPORT Fl_FontSize(const char* xfontname);
+ Fl_Fontsize size;
+ int angle;
+ FL_EXPORT Fl_Font_Descriptor(const char* xfontname);
# else
- XFontStruct* font; // X font information
- FL_EXPORT Fl_FontSize(const char* xfontname);
+ XUtf8FontStruct* font; // X UTF-8 font information
+ FL_EXPORT Fl_Font_Descriptor(const char* xfontname);
# endif
- int minsize; // smallest point size that should use this
- int maxsize; // largest point size that should use this
+ Fl_Fontsize minsize; // smallest point size that should use this
+ Fl_Fontsize maxsize; // largest point size that should use this
# if HAVE_GL
unsigned int listbase;// base of display list, 0 = none
+ char glok[64];
# endif
- FL_EXPORT ~Fl_FontSize();
+
+ FL_EXPORT ~Fl_Font_Descriptor();
+
+#endif // FL_DOXYGEN
};
-extern FL_EXPORT Fl_FontSize *fl_fontsize; // the currently selected one
+extern FL_EXPORT Fl_Font_Descriptor *fl_fontsize; // the currently selected one
struct Fl_Fontdesc {
const char *name;
char fontname[128]; // "Pretty" font name
- Fl_FontSize *first; // linked list of sizes of this style
+ Fl_Font_Descriptor *first; // linked list of sizes of this style
# ifndef WIN32
char **xlist; // matched X font names
int n; // size of xlist, negative = don't free xlist!
@@ -107,5 +118,5 @@ FL_EXPORT char *fl_find_fontsize(char *name);
#endif
//
-// End of "$Id: Fl_Font.H 5334 2006-08-19 15:24:55Z matt $".
+// End of "$Id: Fl_Font.H 6779 2009-04-24 09:28:30Z yuri $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Gl_Choice.H b/plugins/zynaddsubfx/fltk/src/Fl_Gl_Choice.H
index 68a783044..3e3f86fd2 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Gl_Choice.H
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Gl_Choice.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Gl_Choice.H 4052 2005-02-24 21:55:12Z mike $"
+// "$Id: Fl_Gl_Choice.H 6616 2009-01-01 21:28:26Z matt $"
//
// OpenGL definitions for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2001 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -128,5 +128,5 @@ void fl_delete_gl_context(GLContext);
#endif
//
-// End of "$Id: Fl_Gl_Choice.H 4052 2005-02-24 21:55:12Z mike $".
+// End of "$Id: Fl_Gl_Choice.H 6616 2009-01-01 21:28:26Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Group.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Group.cxx
index 9a12da2fc..3373b321a 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Group.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Group.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Group.cxx 6030 2008-02-20 17:42:08Z matt $"
+// "$Id: Fl_Group.cxx 6656 2009-02-09 11:41:56Z AlbrechtS $"
//
// Group widget for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -41,10 +41,19 @@ Fl_Group* Fl_Group::current_;
// Hack: A single child is stored in the pointer to the array, while
// multiple children are stored in an allocated array:
+
+/**
+ Returns a pointer to the array of children. This pointer is only
+ valid until the next time a child is added or removed.
+*/
Fl_Widget*const* Fl_Group::array() const {
return children_ <= 1 ? (Fl_Widget**)(&array_) : array_;
}
+/**
+ Searches the child array for the widget and returns the index. Returns children()
+ if the widget is NULL or not found.
+*/
int Fl_Group::find(const Fl_Widget* o) const {
Fl_Widget*const* a = array();
int i; for (i=0; i < children_; i++) if (*a++ == o) break;
@@ -53,14 +62,40 @@ int Fl_Group::find(const Fl_Widget* o) const {
// Metrowerks CodeWarrior and others can't export the static
// class member: current_, so these methods can't be inlined...
+
+/**
+ Sets the current group so you can build the widget
+ tree by just constructing the widgets.
+
+ begin() is automatically called by the constructor for Fl_Group (and thus for
+ Fl_Window as well). begin() is exactly the same as current(this).
+ Don't forget to end() the group or window!
+*/
void Fl_Group::begin() {current_ = this;}
+
+/**
+ Exactly the same as current(this->parent()). Any new widgets
+ added to the widget tree will be added to the parent of the group.
+*/
void Fl_Group::end() {current_ = (Fl_Group*)parent();}
+
+/**
+ Returns the currently active group.
+
+ The Fl_Widget constructor automatically does current()->add(widget) if this
+ is not null. To prevent new widgets from being added to a group, call
+ Fl_Group::current(0).
+*/
Fl_Group *Fl_Group::current() {return current_;}
+
+/**
+ See static Fl_Group *Fl_Group::current()
+*/
void Fl_Group::current(Fl_Group *g) {current_ = g;}
extern Fl_Widget* fl_oldfocus; // set by Fl::focus
-// For back-compatability, we must adjust all events sent to child
+// For back-compatibility, we must adjust all events sent to child
// windows so they are relative to that window.
static int send(Fl_Widget* o, int event) {
@@ -341,28 +376,56 @@ Fl_Group::Fl_Group(int X,int Y,int W,int H,const char *l)
begin();
}
+/**
+ Deletes all child widgets from memory recursively.
+
+ This method differs from the remove() method in that it
+ affects all child widgets and deletes them from memory.
+*/
void Fl_Group::clear() {
- Fl_Widget*const* old_array = array();
- int old_children = children();
- // clear everything now, in case fl_fix_focus recursively calls us:
- children_ = 0;
- //array_ = 0; //dont do this, it will clobber old_array if only one child
savedfocus_ = 0;
resizable_ = this;
init_sizes();
// okay, now it is safe to destroy the children:
- Fl_Widget*const* a = old_array;
- for (int i=old_children; i--;) {
- Fl_Widget* o = *a++;
- if (o->parent() == this) delete o;
+ while (children_) {
+ Fl_Widget* o = child(0); // *first* child widget
+ if (o->parent() == this) { // should always be true
+ remove(o); // remove child widget first
+ delete o; // then delete it
+ } else { // this should never happen !
+#ifdef DEBUG_CLEAR
+ printf ("Fl_Group::clear() widget:%p, parent: %p != this (%p)\n",
+ o, o->parent(), this); fflush(stdout);
+#endif // DEBUG_CLEAR
+ remove(o); // remove it
+ }
}
- if (old_children > 1) free((void*)old_array);
}
+/**
+ The destructor also deletes all the children. This allows a
+ whole tree to be deleted at once, without having to keep a pointer to
+ all the children in the user code.
+
+ It is allowed that the Fl_Group and all of its children are automatic
+ (local) variables, but you must declare the Fl_Group \e first, so that
+ it is destroyed last.
+
+ If you add static or automatic (local) variables to an Fl_Group, then it
+ is your responsibility to remove (or delete) all such static or automatic
+ child widgets \e \b before destroying the group - otherwise the child
+ widgets' destructors would be called twice!
+*/
Fl_Group::~Fl_Group() {
clear();
}
+/**
+ The widget is removed from its current group (if any) and then
+ inserted into this group. It is put at index n - or at the end,
+ if n >= children(). This can also be used to rearrange
+ the widgets inside a group.
+*/
void Fl_Group::insert(Fl_Widget &o, int index) {
if (o.parent()) {
Fl_Group* g = (Fl_Group*)(o.parent());
@@ -392,14 +455,37 @@ void Fl_Group::insert(Fl_Widget &o, int index) {
init_sizes();
}
+/**
+ The widget is removed from its current group (if any) and then added
+ to the end of this group.
+*/
void Fl_Group::add(Fl_Widget &o) {insert(o, children_);}
+/**
+ Removes a widget from the group but does not delete it.
+
+ This method does nothing if the widget is not a child of the group.
+
+ This method differs from the clear() method in that it only affects
+ a single widget and does not delete it from memory.
+*/
void Fl_Group::remove(Fl_Widget &o) {
if (!children_) return;
int i = find(o);
if (i >= children_) return;
if (&o == savedfocus_) savedfocus_ = 0;
- o.parent_ = 0;
+ if (o.parent_ == this) { // this should always be true
+ o.parent_ = 0;
+ }
+#ifdef DEBUG_REMOVE
+ else { // this should never happen !
+ printf ("Fl_Group::remove(): widget %p, parent_ (%p) != this (%p)\n",
+ &o, o.parent_, this);
+ }
+#endif // DEBUG_REMOVE
+
+ // remove the widget from the group
+
children_--;
if (children_ == 1) { // go from 2 to 1 child
Fl_Widget *t = array_[!i];
@@ -420,17 +506,47 @@ void Fl_Group::remove(Fl_Widget &o) {
// sizes array stores the initial positions of widgets as
// left,right,top,bottom quads. The first quad is the group, the
// second is the resizable (clipped to the group), and the
-// rest are the children. This is a convienent order for the
-// algorithim. If you change this be sure to fix Fl_Tile which
+// rest are the children. This is a convenient order for the
+// algorithm. If you change this be sure to fix Fl_Tile which
// also uses this array!
+/**
+ Resets the internal array of widget sizes and positions.
+
+ The Fl_Group widget keeps track of the original widget sizes and
+ positions when resizing occurs so that if you resize a window back to its
+ original size the widgets will be in the correct places. If you rearrange
+ the widgets in your group, call this method to register the new arrangement
+ with the Fl_Group that contains them.
+
+ If you add or remove widgets, this will be done automatically.
+
+ \note The internal array of widget sizes and positions will be allocated and
+ filled when the next resize() occurs.
+
+ \sa sizes()
+*/
void Fl_Group::init_sizes() {
delete[] sizes_; sizes_ = 0;
}
-short* Fl_Group::sizes() {
+/**
+ Returns the internal array of widget sizes and positions.
+
+ If the sizes() array does not exist, it will be allocated and filled
+ with the current widget sizes and positions.
+
+ \note You should never need to use this method directly, unless you have
+ special needs to rearrange the children of a Fl_Group. Fl_Tile uses
+ this to rearrange its widget positions.
+
+ \sa init_sizes()
+
+ \todo Should the internal representation of the sizes() array be documented?
+*/
+int* Fl_Group::sizes() {
if (!sizes_) {
- short* p = sizes_ = new short[4*(children_+2)];
+ int* p = sizes_ = new int[4*(children_+2)];
// first thing in sizes array is the group's size:
if (type() < FL_WINDOW) {p[0] = x(); p[2] = y();} else {p[0] = p[2] = 0;}
p[1] = p[0]+w(); p[3] = p[2]+h();
@@ -461,13 +577,31 @@ short* Fl_Group::sizes() {
return sizes_;
}
+/**
+ Resizes the Fl_Group widget and all of its children.
+
+ The Fl_Group widget first resizes itself, and then it moves and resizes
+ all its children according to the rules documented for
+ Fl_Group::resizable(Fl_Widget*)
+
+ \sa Fl_Group::resizable(Fl_Widget*)
+ \sa Fl_Group::resizable()
+ \sa Fl_Widget::resize(int,int,int,int)
+*/
void Fl_Group::resize(int X, int Y, int W, int H) {
- if (!resizable() || W==w() && H==h() ) {
+ int dx = X-x();
+ int dy = Y-y();
+ int dw = W-w();
+ int dh = H-h();
+
+ int *p = sizes(); // save initial sizes and positions
+
+ Fl_Widget::resize(X,Y,W,H); // make new xywh values visible for children
+
+ if (!resizable() || dw==0 && dh==0 ) {
if (type() < FL_WINDOW) {
- int dx = X-x();
- int dy = Y-y();
Fl_Widget*const* a = array();
for (int i=children_; i--;) {
Fl_Widget* o = *a++;
@@ -477,13 +611,11 @@ void Fl_Group::resize(int X, int Y, int W, int H) {
} else if (children_) {
- short* p = sizes();
-
// get changes in size/position from the initial size:
- int dx = X - p[0];
- int dw = W - (p[1]-p[0]);
- int dy = Y - p[2];
- int dh = H - (p[3]-p[2]);
+ dx = X - p[0];
+ dw = W - (p[1]-p[0]);
+ dy = Y - p[2];
+ dh = H - (p[3]-p[2]);
if (type() >= FL_WINDOW) dx = dy = 0;
p += 4;
@@ -528,10 +660,15 @@ void Fl_Group::resize(int X, int Y, int W, int H) {
o->resize(XX+dx, YY+dy, R-XX, B-YY);
}
}
-
- Fl_Widget::resize(X,Y,W,H);
}
+/**
+ Draws all children of the group.
+
+ This is useful, if you derived a widget from Fl_Group and want to draw a special
+ border or background. You can call draw_children() from the derived draw() method
+ after drawing the box, border, or background.
+*/
void Fl_Group::draw_children() {
Fl_Widget*const* a = array();
@@ -563,7 +700,14 @@ void Fl_Group::draw() {
draw_children();
}
-// Draw a child only if it needs it:
+/**
+ Draws a child only if it needs it.
+
+ This draws a child widget, if it is not clipped \em and if any damage() bits
+ are set. The damage bits are cleared after drawing.
+
+ \sa Fl_Group::draw_child(Fl_Widget& widget) const
+*/
void Fl_Group::update_child(Fl_Widget& widget) const {
if (widget.damage() && widget.visible() && widget.type() < FL_WINDOW &&
fl_not_clipped(widget.x(), widget.y(), widget.w(), widget.h())) {
@@ -572,7 +716,12 @@ void Fl_Group::update_child(Fl_Widget& widget) const {
}
}
-// Force a child to redraw:
+/**
+ Forces a child to redraw.
+
+ This draws a child widget, if it is not clipped.
+ The damage bits are cleared after drawing.
+*/
void Fl_Group::draw_child(Fl_Widget& widget) const {
if (widget.visible() && widget.type() < FL_WINDOW &&
fl_not_clipped(widget.x(), widget.y(), widget.w(), widget.h())) {
@@ -584,7 +733,7 @@ void Fl_Group::draw_child(Fl_Widget& widget) const {
extern char fl_draw_shortcut;
-// Parents normally call this to draw outside labels:
+/** Parents normally call this to draw outside labels of child widgets. */
void Fl_Group::draw_outside_label(const Fl_Widget& widget) const {
if (!widget.visible()) return;
// skip any labels that are inside the widget:
@@ -616,5 +765,5 @@ void Fl_Group::draw_outside_label(const Fl_Widget& widget) const {
}
//
-// End of "$Id: Fl_Group.cxx 6030 2008-02-20 17:42:08Z matt $".
+// End of "$Id: Fl_Group.cxx 6656 2009-02-09 11:41:56Z AlbrechtS $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Help_Dialog.fl b/plugins/zynaddsubfx/fltk/src/Fl_Help_Dialog.fl
index 909e2ba37..e1faef039 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Help_Dialog.fl
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Help_Dialog.fl
@@ -3,11 +3,11 @@ version 1.0108
header_name {../FL/Fl_Help_Dialog.H}
code_name {.cxx}
comment {//
-// "$Id: Fl_Help_Dialog.fl 5643 2007-01-28 19:36:51Z mike $"
+// "$Id: Fl_Help_Dialog.fl 6616 2009-01-01 21:28:26Z matt $"
//
// Fl_Help_Dialog dialog for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -204,7 +204,7 @@ window_->label(view_->title());} {}
} {
code {window_->show(argc, argv);} {}
}
- Function {textsize(uchar s)} {return_type void
+ Function {textsize(Fl_Fontsize s)} {return_type void
} {
code {view_->textsize(s);
@@ -218,7 +218,7 @@ if (s >= 18)
else
larger_->activate();} {}
}
- Function {textsize()} {return_type uchar
+ Function {textsize()} {return_type Fl_Fontsize
} {
code {return (view_->textsize());} {}
}
@@ -260,6 +260,6 @@ window_->label(view_->title());} {}
comment {
//
-// End of "$Id: Fl_Help_Dialog.fl 5643 2007-01-28 19:36:51Z mike $".
+// End of "$Id: Fl_Help_Dialog.fl 6616 2009-01-01 21:28:26Z matt $".
//} {in_source in_header
}
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Help_View.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Help_View.cxx
index d8e9d35b6..04d4cae88 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Help_View.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Help_View.cxx
@@ -1,10 +1,10 @@
//
-// "$Id: Fl_Help_View.cxx 6091 2008-04-11 11:12:16Z matt $"
+// "$Id: Fl_Help_View.cxx 6776 2009-04-22 09:02:13Z greg.ercolano $"
//
// Fl_Help_View widget routines.
//
-// Copyright 1997-2007 by Easy Software Products.
-// Image support donated by Matthias Melcher, Copyright 2000.
+// Copyright 1997-2009 by Easy Software Products.
+// Image support by Matthias Melcher, Copyright 2000-2009.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -61,6 +61,8 @@
#include
#include
#include
+#include
+#include // fl_open_uri()
#include "flstring.h"
#include
#include
@@ -69,9 +71,6 @@
#if defined(WIN32) && ! defined(__CYGWIN__)
# include
# include
-// Visual C++ 2005 incorrectly displays a warning about the use of POSIX APIs
-// on Windows, which is supposed to be POSIX compliant...
-# define getcwd _getcwd
#else
# include
#endif // WIN32
@@ -97,6 +96,11 @@ static int quote_char(const char *);
static void scrollbar_callback(Fl_Widget *s, void *);
static void hscrollbar_callback(Fl_Widget *s, void *);
+//
+// global flag for image loading (see get_image).
+//
+
+static char initial_load = 0;
//
// Broken image...
@@ -274,10 +278,7 @@ void Fl_Help_View::hv_draw(const char *t, int x, int y)
}
-//
-// 'Fl_Help_View::add_block()' - Add a text block to the list.
-//
-
+/** Adds a text block to the list. */
Fl_Help_Block * // O - Pointer to new block
Fl_Help_View::add_block(const char *s, // I - Pointer to start of block text
int xx, // I - X position of block
@@ -318,12 +319,8 @@ Fl_Help_View::add_block(const char *s, // I - Pointer to start of block text
}
-//
-// 'Fl_Help_View::add_link()' - Add a new link to the list.
-//
-
-void
-Fl_Help_View::add_link(const char *n, // I - Name of link
+/** Adds a new link to the list. */
+void Fl_Help_View::add_link(const char *n, // I - Name of link
int xx, // I - X position of link
int yy, // I - Y position of link
int ww, // I - Width of link text
@@ -364,13 +361,9 @@ Fl_Help_View::add_link(const char *n, // I - Name of link
}
-//
-// 'Fl_Help_View::add_target()' - Add a new target to the list.
-//
-
-void
-Fl_Help_View::add_target(const char *n, // I - Name of target
- int yy) // I - Y position of target
+/** Adds a new target to the list. */
+void Fl_Help_View::add_target(const char *n, // I - Name of target
+ int yy) // I - Y position of target
{
Fl_Help_Target *temp; // New target
@@ -393,11 +386,7 @@ Fl_Help_View::add_target(const char *n, // I - Name of target
ntargets_ ++;
}
-
-//
-// 'Fl_Help_View::compare_targets()' - Compare two targets.
-//
-
+/** Compares two targets.*/
int // O - Result of comparison
Fl_Help_View::compare_targets(const Fl_Help_Target *t0, // I - First target
const Fl_Help_Target *t1) // I - Second target
@@ -405,11 +394,7 @@ Fl_Help_View::compare_targets(const Fl_Help_Target *t0, // I - First target
return (strcasecmp(t0->name, t1->name));
}
-
-//
-// 'Fl_Help_View::do_align()' - Compute the alignment for a line in a block.
-//
-
+/** Computes the alignment for a line in a block.*/
int // O - New line
Fl_Help_View::do_align(Fl_Help_Block *block, // I - Block to add to
int line, // I - Current line
@@ -448,11 +433,7 @@ Fl_Help_View::do_align(Fl_Help_Block *block, // I - Block to add to
return (line);
}
-
-//
-// 'Fl_Help_View::draw()' - Draw the Fl_Help_View widget.
-//
-
+/** Draws the Fl_Help_View widget. */
void
Fl_Help_View::draw()
{
@@ -465,7 +446,9 @@ Fl_Help_View::draw()
attr[1024]; // Attribute buffer
int xx, yy, ww, hh; // Current positions and sizes
int line; // Current line
- unsigned char font, fsize; // Current font and size
+ Fl_Font font;
+ Fl_Fontsize fsize; // Current font and size
+ Fl_Color fcolor; // current font color
int head, pre, // Flags for text
needspace; // Do we need whitespace?
Fl_Boxtype b = box() ? box() : FL_DOWN_BOX;
@@ -473,29 +456,41 @@ Fl_Help_View::draw()
int underline, // Underline text?
xtra_ww; // Extra width for underlined space between words
-
// Draw the scrollbar(s) and box first...
- ww = w() ;
+ ww = w();
hh = h();
i = 0;
draw_box(b, x(), y(), ww, hh, bgcolor_);
- int ss = Fl::scrollbar_size();
- if (hscrollbar_.visible()) {
- draw_child(hscrollbar_);
- hh -= ss;
- i ++;
- }
- if (scrollbar_.visible()) {
- draw_child(scrollbar_);
- ww -= ss;
- i ++;
- }
- if (i == 2) {
- fl_color(FL_GRAY);
- fl_rectf(x() + ww - Fl::box_dw(b) + Fl::box_dx(b),
- y() + hh - Fl::box_dh(b) + Fl::box_dy(b), ss, ss);
+ if ( hscrollbar_.visible() || scrollbar_.visible() ) {
+ int scrollsize = scrollbar_size_ ? scrollbar_size_ : Fl::scrollbar_size();
+ int hor_vis = hscrollbar_.visible();
+ int ver_vis = scrollbar_.visible();
+ // Scrollbar corner
+ int scorn_x = x() + ww - (ver_vis?scrollsize:0) - Fl::box_dw(b) + Fl::box_dx(b);
+ int scorn_y = y() + hh - (hor_vis?scrollsize:0) - Fl::box_dh(b) + Fl::box_dy(b);
+ if ( hor_vis ) {
+ if ( hscrollbar_.h() != scrollsize ) { // scrollsize changed?
+ hscrollbar_.resize(x(), scorn_y, scorn_x - x(), scrollsize);
+ init_sizes();
+ }
+ draw_child(hscrollbar_);
+ hh -= scrollsize;
+ }
+ if ( ver_vis ) {
+ if ( scrollbar_.w() != scrollsize ) { // scrollsize changed?
+ scrollbar_.resize(scorn_x, y(), scrollsize, scorn_y - y());
+ init_sizes();
+ }
+ draw_child(scrollbar_);
+ ww -= scrollsize;
+ }
+ if ( hor_vis && ver_vis ) {
+ // Both scrollbars visible? Draw little gray box in corner
+ fl_color(FL_GRAY);
+ fl_rectf(scorn_x, scorn_y, scrollsize, scrollsize);
+ }
}
if (!value_)
@@ -525,7 +520,7 @@ Fl_Help_View::draw()
needspace = 0;
underline = 0;
- initfont(font, fsize);
+ initfont(font, fsize, fcolor);
for (ptr = block->start, s = buf; ptr < block->end;)
{
@@ -700,11 +695,11 @@ Fl_Help_View::draw()
if (tolower(buf[0]) == 'h')
{
font = FL_HELVETICA_BOLD;
- fsize = (uchar)(textsize_ + '7' - buf[1]);
+ fsize = textsize_ + '7' - buf[1];
}
else if (strcasecmp(buf, "DT") == 0)
{
- font = (uchar)(textfont_ | FL_ITALIC);
+ font = textfont_ | FL_ITALIC;
fsize = textsize_;
}
else if (strcasecmp(buf, "PRE") == 0)
@@ -716,13 +711,13 @@ Fl_Help_View::draw()
if (strcasecmp(buf, "LI") == 0)
{
-#ifdef __APPLE_QUARTZ__
- fl_font(FL_SYMBOL, fsize);
- hv_draw("\245", xx - fsize + x() - leftline_, yy + y());
-#else
- fl_font(FL_SYMBOL, fsize);
- hv_draw("\267", xx - fsize + x() - leftline_, yy + y());
-#endif
+// fl_font(FL_SYMBOL, fsize); // The default SYMBOL font on my XP box is not Unicode...
+ char buf[8];
+ wchar_t b[] = {0x2022, 0x0};
+// buf[fl_unicode2utf(b, 1, buf)] = 0;
+ unsigned dstlen = fl_utf8fromwc(buf, 8, b, 1);
+ buf[dstlen] = 0;
+ hv_draw(buf, xx - fsize + x() - leftline_, yy + y());
}
pushfont(font, fsize);
@@ -741,7 +736,7 @@ Fl_Help_View::draw()
else if (strcasecmp(buf, "FONT") == 0)
{
if (get_attr(attrs, "COLOR", attr, sizeof(attr)) != NULL) {
- fl_color(get_color(attr, textcolor_));
+ textcolor_ = get_color(attr, textcolor_);
}
if (get_attr(attrs, "FACE", attr, sizeof(attr)) != NULL) {
@@ -768,8 +763,7 @@ Fl_Help_View::draw()
}
else if (strcasecmp(buf, "/FONT") == 0)
{
- fl_color(textcolor_);
- popfont(font, fsize);
+ popfont(font, fsize, textcolor_);
}
else if (strcasecmp(buf, "U") == 0)
underline = 1;
@@ -844,10 +838,10 @@ Fl_Help_View::draw()
strcasecmp(buf, "/TT") == 0 ||
strcasecmp(buf, "/KBD") == 0 ||
strcasecmp(buf, "/VAR") == 0)
- popfont(font, fsize);
+ popfont(font, fsize, fcolor);
else if (strcasecmp(buf, "/PRE") == 0)
{
- popfont(font, fsize);
+ popfont(font, fsize, fcolor);
pre = 0;
}
else if (strcasecmp(buf, "IMG") == 0)
@@ -892,7 +886,6 @@ Fl_Help_View::draw()
if (img) {
img->draw(xx + x() - leftline_,
yy + y() - fl_height() + fl_descent() + 2);
- img->release();
}
xx += ww;
@@ -946,7 +939,10 @@ Fl_Help_View::draw()
if (qch < 0)
*s++ = '&';
else {
- *s++ = qch;
+ int l;
+ l = fl_utf8encode((unsigned int) qch, s);
+ if (l < 1) l = 1;
+ s += l;
ptr = strchr(ptr, ';') + 1;
}
@@ -994,10 +990,11 @@ Fl_Help_View::draw()
}
-//
-// 'Fl_Help_View::find()' - Find the specified string...
-//
+/** Finds the specified string \p s at starting position \p p.
+
+ \return the matching position or -1 if not found
+*/
int // O - Matching position or -1 if not found
Fl_Help_View::find(const char *s, // I - String to find
int p) // I - Starting position
@@ -1055,14 +1052,8 @@ Fl_Help_View::find(const char *s, // I - String to find
return (-1);
}
-
-//
-// 'Fl_Help_View::format()' - Format the help text.
-//
-
-void
-Fl_Help_View::format()
-{
+/** Formats the help text. */
+void Fl_Help_View::format() {
int i; // Looping var
int done; // Are we done yet?
Fl_Help_Block *block, // Current block
@@ -1082,7 +1073,9 @@ Fl_Help_View::format()
int xx, yy, ww, hh; // Size of current text fragment
int line; // Current line in block
int links; // Links for current line
- unsigned char font, fsize; // Current font and size
+ Fl_Font font;
+ Fl_Fontsize fsize; // Current font and size
+ Fl_Color fcolor; // Current font color
unsigned char border; // Draw border?
int talign, // Current alignment
newalign, // New alignment
@@ -1101,7 +1094,8 @@ Fl_Help_View::format()
// Reset document width...
- hsize_ = w() - Fl::scrollbar_size() - Fl::box_dw(b);
+ int scrollsize = scrollbar_size_ ? scrollbar_size_ : Fl::scrollbar_size();
+ hsize_ = w() - scrollsize - Fl::box_dw(b);
done = 0;
while (!done)
@@ -1124,7 +1118,7 @@ Fl_Help_View::format()
return;
// Setup for formatting...
- initfont(font, fsize);
+ initfont(font, fsize, fcolor);
line = 0;
links = 0;
@@ -1144,11 +1138,13 @@ Fl_Help_View::format()
linkdest[0] = '\0';
table_offset = 0;
+ // Html text character loop
for (ptr = value_, s = buf; *ptr;)
{
+ // End of word?
if ((*ptr == '<' || isspace((*ptr)&255)) && s > buf)
{
- // Get width...
+ // Get width of word parsed so far...
*s = '\0';
ww = (int)fl_width(buf);
@@ -1237,6 +1233,7 @@ Fl_Help_View::format()
if (*ptr == '<')
{
+ // Handle html tags..
start = ptr;
ptr ++;
@@ -1387,11 +1384,11 @@ Fl_Help_View::format()
if (tolower(buf[0]) == 'h' && isdigit(buf[1]))
{
font = FL_HELVETICA_BOLD;
- fsize = (uchar)(textsize_ + '7' - buf[1]);
+ fsize = textsize_ + '7' - buf[1];
}
else if (strcasecmp(buf, "DT") == 0)
{
- font = (uchar)(textfont_ | FL_ITALIC);
+ font = textfont_ | FL_ITALIC;
fsize = textsize_;
}
else if (strcasecmp(buf, "PRE") == 0)
@@ -1473,8 +1470,11 @@ Fl_Help_View::format()
else if (strcasecmp(buf, "/CENTER") == 0)
talign = LEFT;
- popfont(font, fsize);
+ popfont(font, fsize, fcolor);
+ //#if defined(__GNUC__)
+ //#warning FIXME this isspace & 255 test will probably not work on a utf8 stream... And we use it everywhere!
+ //#endif /*__GNUC__*/
while (isspace((*ptr)&255))
ptr ++;
@@ -1575,7 +1575,7 @@ Fl_Help_View::format()
block->h += hh;
if (strcasecmp(buf, "TH") == 0)
- font = (uchar)(textfont_ | FL_BOLD);
+ font = textfont_ | FL_BOLD;
else
font = textfont_;
@@ -1622,7 +1622,7 @@ Fl_Help_View::format()
strcasecmp(buf, "/TH") == 0) && row)
{
line = do_align(block, line, xx, newalign, links);
- popfont(font, fsize);
+ popfont(font, fsize, fcolor);
xx = margins.pop();
talign = LEFT;
}
@@ -1651,7 +1651,7 @@ Fl_Help_View::format()
pushfont(font, fsize);
}
else if (strcasecmp(buf, "/FONT") == 0)
- popfont(font, fsize);
+ popfont(font, fsize, fcolor);
else if (strcasecmp(buf, "B") == 0 ||
strcasecmp(buf, "STRONG") == 0)
pushfont(font |= FL_BOLD, fsize);
@@ -1673,7 +1673,7 @@ Fl_Help_View::format()
strcasecmp(buf, "/TT") == 0 ||
strcasecmp(buf, "/KBD") == 0 ||
strcasecmp(buf, "/VAR") == 0)
- popfont(font, fsize);
+ popfont(font, fsize, fcolor);
else if (strcasecmp(buf, "IMG") == 0)
{
Fl_Shared_Image *img = 0;
@@ -1743,11 +1743,14 @@ Fl_Help_View::format()
else if (isspace((*ptr)&255))
{
needspace = 1;
-
+ if ( pre ) {
+ xx += (int)fl_width(' ');
+ }
ptr ++;
}
else if (*ptr == '&' && s < (buf + sizeof(buf) - 1))
{
+ // Handle html '&' codes, eg. "&"
ptr ++;
int qch = quote_char(ptr);
@@ -1755,7 +1758,10 @@ Fl_Help_View::format()
if (qch < 0)
*s++ = '&';
else {
- *s++ = qch;
+ int l;
+ l = fl_utf8encode((unsigned int) qch, s);
+ if (l < 1) l = 1;
+ s += l;
ptr = strchr(ptr, ';') + 1;
}
@@ -1820,7 +1826,7 @@ Fl_Help_View::format()
int dx = Fl::box_dw(b) - Fl::box_dx(b);
int dy = Fl::box_dh(b) - Fl::box_dy(b);
- int ss = Fl::scrollbar_size();
+ int ss = scrollbar_size_ ? scrollbar_size_ : Fl::scrollbar_size();
int dw = Fl::box_dw(b) + ss;
int dh = Fl::box_dh(b);
@@ -1867,10 +1873,7 @@ Fl_Help_View::format()
}
-//
-// 'Fl_Help_View::format_table()' - Format a table...
-//
-
+/** Formats a table */
void
Fl_Help_View::format_table(int *table_width, // O - Total table width
int *columns, // O - Column widths
@@ -1894,8 +1897,9 @@ Fl_Help_View::format_table(int *table_width, // O - Total table width
*attrs, // Pointer to attributes
*start; // Start of element
int minwidths[MAX_COLUMNS]; // Minimum widths for each column
- unsigned char font, fsize; // Current font and size
-
+ Fl_Font font;
+ Fl_Fontsize fsize; // Current font and size
+ Fl_Color fcolor; // Currrent font color
// Clear widths...
*table_width = 0;
@@ -1910,8 +1914,7 @@ Fl_Help_View::format_table(int *table_width, // O - Total table width
max_width = 0;
pre = 0;
needspace = 0;
- font = fonts_[nfonts_][0];
- fsize = fonts_[nfonts_][1];
+ fstack_.top(font, fsize, fcolor);
// Scan the table...
for (ptr = table, column = -1, width = 0, s = buf, incell = 0; *ptr;)
@@ -1988,11 +1991,11 @@ Fl_Help_View::format_table(int *table_width, // O - Total table width
if (tolower(buf[0]) == 'h' && isdigit(buf[1]))
{
font = FL_HELVETICA_BOLD;
- fsize = (uchar)(textsize_ + '7' - buf[1]);
+ fsize = textsize_ + '7' - buf[1];
}
else if (strcasecmp(buf, "DT") == 0)
{
- font = (uchar)(textfont_ | FL_ITALIC);
+ font = textfont_ | FL_ITALIC;
fsize = textsize_;
}
else if (strcasecmp(buf, "PRE") == 0)
@@ -2031,7 +2034,7 @@ Fl_Help_View::format_table(int *table_width, // O - Total table width
width = 0;
needspace = 0;
- popfont(font, fsize);
+ popfont(font, fsize, fcolor);
}
else if (strcasecmp(buf, "TR") == 0 || strcasecmp(buf, "/TR") == 0 ||
strcasecmp(buf, "/TABLE") == 0)
@@ -2102,7 +2105,7 @@ Fl_Help_View::format_table(int *table_width, // O - Total table width
incell = 1;
if (strcasecmp(buf, "TH") == 0)
- font = (uchar)(textfont_ | FL_BOLD);
+ font = textfont_ | FL_BOLD;
else
font = textfont_;
@@ -2121,7 +2124,7 @@ Fl_Help_View::format_table(int *table_width, // O - Total table width
strcasecmp(buf, "/TH") == 0)
{
incell = 0;
- popfont(font, fsize);
+ popfont(font, fsize, fcolor);
}
else if (strcasecmp(buf, "B") == 0 ||
strcasecmp(buf, "STRONG") == 0)
@@ -2144,7 +2147,7 @@ Fl_Help_View::format_table(int *table_width, // O - Total table width
strcasecmp(buf, "/TT") == 0 ||
strcasecmp(buf, "/KBD") == 0 ||
strcasecmp(buf, "/VAR") == 0)
- popfont(font, fsize);
+ popfont(font, fsize, fcolor);
else if (strcasecmp(buf, "IMG") == 0 && incell)
{
Fl_Shared_Image *img = 0;
@@ -2196,6 +2199,10 @@ Fl_Help_View::format_table(int *table_width, // O - Total table width
if (qch < 0)
*s++ = '&';
else {
+// int l;
+// l = fl_utf8encode((unsigned int) qch, s);
+// if (l < 1) l = 1;
+// s += l;
*s++ = qch;
ptr = strchr(ptr, ';') + 1;
}
@@ -2237,8 +2244,9 @@ Fl_Help_View::format_table(int *table_width, // O - Total table width
// Adjust the width if needed...
int scale_width = *table_width;
+ int scrollsize = scrollbar_size_ ? scrollbar_size_ : Fl::scrollbar_size();
if (scale_width == 0) {
- if (width > (hsize_ - Fl::scrollbar_size())) scale_width = hsize_ - Fl::scrollbar_size();
+ if (width > (hsize_ - scrollsize)) scale_width = hsize_ - scrollsize;
else scale_width = width;
}
@@ -2299,13 +2307,10 @@ Fl_Help_View::format_table(int *table_width, // O - Total table width
}
-//
-// 'Fl_Help_View::free_data()' - Free memory used for the document.
-//
-
+/** Frees memory used for the document. */
void
Fl_Help_View::free_data() {
- // Releae all images...
+ // Release all images...
if (value_) {
const char *ptr, // Pointer into block
*attrs; // Pointer to start of element attributes
@@ -2315,7 +2320,6 @@ Fl_Help_View::free_data() {
wattr[1024], // Width attribute buffer
hattr[1024]; // Height attribute buffer
-
for (ptr = value_; *ptr;)
{
if (*ptr == '<')
@@ -2358,17 +2362,17 @@ Fl_Help_View::free_data() {
int width;
int height;
-
get_attr(attrs, "WIDTH", wattr, sizeof(wattr));
get_attr(attrs, "HEIGHT", hattr, sizeof(hattr));
width = get_length(wattr);
height = get_length(hattr);
if (get_attr(attrs, "SRC", attr, sizeof(attr))) {
- // Release the image twice to free it from memory...
+ // Get and release the image to free it from memory...
img = get_image(attr, width, height);
- img->release();
- img->release();
+ if ((void*)img != &broken_image) {
+ img->release();
+ }
}
}
}
@@ -2406,10 +2410,7 @@ Fl_Help_View::free_data() {
}
}
-//
-// 'Fl_Help_View::get_align()' - Get an alignment attribute.
-//
-
+/** Gets an alignment attribute. */
int // O - Alignment
Fl_Help_View::get_align(const char *p, // I - Pointer to start of attrs
int a) // I - Default alignment
@@ -2429,10 +2430,7 @@ Fl_Help_View::get_align(const char *p, // I - Pointer to start of attrs
}
-//
-// 'Fl_Help_View::get_attr()' - Get an attribute value from the string.
-//
-
+/** Gets an attribute value from the string. */
const char * // O - Pointer to buf or NULL
Fl_Help_View::get_attr(const char *p, // I - Pointer to start of attributes
const char *n, // I - Name of attribute
@@ -2504,10 +2502,7 @@ Fl_Help_View::get_attr(const char *p, // I - Pointer to start of attributes
}
-//
-// 'Fl_Help_View::get_color()' - Get an alignment attribute.
-//
-
+/** Gets a color attribute. */
Fl_Color // O - Color value
Fl_Help_View::get_color(const char *n, // I - Color name
Fl_Color c) // I - Default color value
@@ -2566,9 +2561,47 @@ Fl_Help_View::get_color(const char *n, // I - Color name
}
-//
-// 'Fl_Help_View::get_image()' - Get an inline image.
-//
+/** Gets an inline image.
+
+ The image reference count is maintained accordingly, such that
+ the image can be released exactly once when the document is closed.
+
+ \return a pointer to a cached Fl_Shared_Image, if the image can be loaded,
+ otherwise a pointer to an internal Fl_Pixmap (broken_image).
+
+ \todo Fl_Help_View::get_image() returns a pointer to the internal
+ Fl_Pixmap broken_image, but this is _not_ compatible with the
+ return type Fl_Shared_Image (release() must not be called).
+*/
+
+/* Implementation note: (A.S. Apr 05, 2009)
+
+ Fl_Help_View::get_image() uses a static global flag (initial_load)
+ to determine, if it is called from the initial loading of a document
+ (load() or value()), or from resize() or draw().
+
+ A better solution would be to manage all loaded images in an own
+ structure like Fl_Help_Target (Fl_Help_Image ?) to avoid using this
+ global flag, but this would break the ABI !
+
+ This should be fixed in FLTK 1.3 !
+
+
+ If initial_load is true, then Fl_Shared_Image::get() is called to
+ load the image, and the reference count of the shared image is
+ increased by one.
+
+ If initial_load is false, then Fl_Shared_Image::find() is called to
+ load the image, and the image is released immediately. This avoids
+ increasing the reference count when calling get_image() from draw()
+ or resize().
+
+ Calling Fl_Shared_Image::find() instead of Fl_Shared_Image::get() avoids
+ doing unnecessary i/o for "broken images" within each resize/redraw.
+
+ Each image must be released exactly once in the destructor or before
+ a new document is loaded: see free_data().
+*/
Fl_Shared_Image *
Fl_Help_View::get_image(const char *name, int W, int H) {
@@ -2597,7 +2630,7 @@ Fl_Help_View::get_image(const char *name, int W, int H) {
} else if (name[0] != '/' && strchr(name, ':') == NULL) {
if (directory_[0]) snprintf(temp, sizeof(temp), "%s/%s", directory_, name);
else {
- getcwd(dir, sizeof(dir));
+ fl_getcwd(dir, sizeof(dir));
snprintf(temp, sizeof(temp), "file:%s/%s", dir, name);
}
@@ -2610,17 +2643,23 @@ Fl_Help_View::get_image(const char *name, int W, int H) {
if (strncmp(localname, "file:", 5) == 0) localname += 5;
- if ((ip = Fl_Shared_Image::get(localname, W, H)) == NULL)
- ip = (Fl_Shared_Image *)&broken_image;
+ if (initial_load) {
+ if ((ip = Fl_Shared_Image::get(localname, W, H)) == NULL) {
+ ip = (Fl_Shared_Image *)&broken_image;
+ }
+ } else { // draw or resize
+ if ((ip = Fl_Shared_Image::find(localname, W, H)) == NULL) {
+ ip = (Fl_Shared_Image *)&broken_image;
+ } else {
+ ip->release();
+ }
+ }
return ip;
}
-//
-// 'Fl_Help_View::get_length()' - Get a length value, either absolute or %.
-//
-
+/** Gets a length value, either absolute or %. */
int
Fl_Help_View::get_length(const char *l) { // I - Value
int val; // Integer value
@@ -2632,7 +2671,8 @@ Fl_Help_View::get_length(const char *l) { // I - Value
if (val > 100) val = 100;
else if (val < 0) val = 0;
- val = val * (hsize_ - Fl::scrollbar_size()) / 100;
+ int scrollsize = scrollbar_size_ ? scrollbar_size_ : Fl::scrollbar_size();
+ val = val * (hsize_ - scrollsize) / 100;
}
return val;
@@ -2688,7 +2728,7 @@ void Fl_Help_View::follow_link(Fl_Help_Link *linkp)
snprintf(temp, sizeof(temp), "%s/%s", directory_, linkp->filename);
else
{
- getcwd(dir, sizeof(dir));
+ fl_getcwd(dir, sizeof(dir));
snprintf(temp, sizeof(temp), "file:%s/%s", dir, linkp->filename);
}
}
@@ -2709,12 +2749,13 @@ void Fl_Help_View::follow_link(Fl_Help_Link *linkp)
leftline(0);
}
+/** Removes the current text selection. */
void Fl_Help_View::clear_selection()
{
if (current_view==this)
clear_global_selection();
}
-
+/** Selects all the text in the view. */
void Fl_Help_View::select_all()
{
clear_global_selection();
@@ -2901,10 +2942,7 @@ void Fl_Help_View::end_selection(int clipboard)
#define ctrl(x) ((x)&0x1f)
-//
-// 'Fl_Help_View::handle()' - Handle events in the widget.
-//
-
+/** Handles events in the widget. */
int // O - 1 if we handled it, 0 otherwise
Fl_Help_View::handle(int event) // I - Event to handle
{
@@ -2987,10 +3025,10 @@ Fl_Help_View::handle(int event) // I - Event to handle
return (Fl_Group::handle(event));
}
-//
-// 'Fl_Help_View::Fl_Help_View()' - Build a Fl_Help_View widget.
-//
-
+/**
+ The constructor creates the Fl_Help_View widget at the specified
+ position and size.
+*/
Fl_Help_View::Fl_Help_View(int xx, // I - Left position
int yy, // I - Top position
int ww, // I - Width in pixels
@@ -3017,8 +3055,6 @@ Fl_Help_View::Fl_Help_View(int xx, // I - Left position
nblocks_ = 0;
blocks_ = (Fl_Help_Block *)0;
- nfonts_ = 0;
-
link_ = (Fl_Help_Func *)0;
alinks_ = 0;
@@ -3036,6 +3072,7 @@ Fl_Help_View::Fl_Help_View(int xx, // I - Left position
leftline_ = 0;
size_ = 0;
hsize_ = 0;
+ scrollbar_size_ = 0;
scrollbar_.value(0, hh, 0, 1);
scrollbar_.step(8.0);
@@ -3053,10 +3090,11 @@ Fl_Help_View::Fl_Help_View(int xx, // I - Left position
}
-//
-// 'Fl_Help_View::~Fl_Help_View()' - Destroy a Fl_Help_View widget.
-//
+/** Destroys the Fl_Help_View widget.
+ The destructor destroys the widget and frees all memory that has been
+ allocated for the current document.
+*/
Fl_Help_View::~Fl_Help_View()
{
clear_selection();
@@ -3064,10 +3102,10 @@ Fl_Help_View::~Fl_Help_View()
}
-//
-// 'Fl_Help_View::load()' - Load the specified file.
-//
+/** Loads the specified file.
+ This method loads the specified file or URL.
+*/
int // O - 0 on success, -1 on error
Fl_Help_View::load(const char *f)// I - Filename to load (may also have target)
{
@@ -3079,6 +3117,53 @@ Fl_Help_View::load(const char *f)// I - Filename to load (may also have target)
char error[1024]; // Error buffer
char newname[1024]; // New filename buffer
+ // printf("load(%s)\n",f); fflush(stdout);
+
+ if (strncmp(f, "ftp:", 4) == 0 ||
+ strncmp(f, "http:", 5) == 0 ||
+ strncmp(f, "https:", 6) == 0 ||
+ strncmp(f, "ipp:", 4) == 0 ||
+ strncmp(f, "mailto:", 7) == 0 ||
+ strncmp(f, "news:", 5) == 0) {
+ char urimsg[256];
+ if ( fl_open_uri(f, urimsg, sizeof(urimsg)) == 0 ) {
+ clear_selection();
+
+ strlcpy(newname, f, sizeof(newname));
+ if ((target = strrchr(newname, '#')) != NULL)
+ *target++ = '\0';
+
+ if (link_)
+ localname = (*link_)(this, newname);
+ else
+ localname = filename_;
+
+ if (!localname)
+ return (0);
+
+ free_data();
+
+ strlcpy(filename_, newname, sizeof(filename_));
+ strlcpy(directory_, newname, sizeof(directory_));
+
+ // Note: We do not support Windows backslashes, since they are illegal
+ // in URLs...
+ if ((slash = strrchr(directory_, '/')) == NULL)
+ directory_[0] = '\0';
+ else if (slash > directory_ && slash[-1] != '/')
+ *slash = '\0';
+
+ snprintf(error, sizeof(error),
+ "Error"
+ "Error
"
+ "Unable to follow the link \"%s\" - "
+ "%s.
",
+ f, urimsg);
+ value(error);
+ //return(-1);
+ }
+ return(0);
+ }
clear_selection();
@@ -3094,6 +3179,8 @@ Fl_Help_View::load(const char *f)// I - Filename to load (may also have target)
if (!localname)
return (0);
+ free_data();
+
strlcpy(filename_, newname, sizeof(filename_));
strlcpy(directory_, newname, sizeof(directory_));
@@ -3104,56 +3191,33 @@ Fl_Help_View::load(const char *f)// I - Filename to load (may also have target)
else if (slash > directory_ && slash[-1] != '/')
*slash = '\0';
- if (value_ != NULL)
- {
- free((void *)value_);
- value_ = NULL;
- }
+ if (strncmp(localname, "file:", 5) == 0)
+ localname += 5; // Adjust for local filename...
- if (strncmp(localname, "ftp:", 4) == 0 ||
- strncmp(localname, "http:", 5) == 0 ||
- strncmp(localname, "https:", 6) == 0 ||
- strncmp(localname, "ipp:", 4) == 0 ||
- strncmp(localname, "mailto:", 7) == 0 ||
- strncmp(localname, "news:", 5) == 0)
+ if ((fp = fl_fopen(localname, "rb")) != NULL)
{
- // Remote link wasn't resolved...
- snprintf(error, sizeof(error),
- "Error"
- "Error
"
- "Unable to follow the link \"%s\" - "
- "no handler exists for this URI scheme.
",
- localname);
- value_ = strdup(error);
+ fseek(fp, 0, SEEK_END);
+ len = ftell(fp);
+ rewind(fp);
+
+ value_ = (const char *)calloc(len + 1, 1);
+ fread((void *)value_, 1, len, fp);
+ fclose(fp);
}
else
{
- if (strncmp(localname, "file:", 5) == 0)
- localname += 5; // Adjust for local filename...
-
- if ((fp = fopen(localname, "rb")) != NULL)
- {
- fseek(fp, 0, SEEK_END);
- len = ftell(fp);
- rewind(fp);
-
- value_ = (const char *)calloc(len + 1, 1);
- fread((void *)value_, 1, len, fp);
- fclose(fp);
- }
- else
- {
- snprintf(error, sizeof(error),
- "Error"
- "Error
"
- "Unable to follow the link \"%s\" - "
- "%s.
",
- localname, strerror(errno));
- value_ = strdup(error);
- }
+ snprintf(error, sizeof(error),
+ "Error"
+ "Error
"
+ "Unable to follow the link \"%s\" - "
+ "%s.
",
+ localname, strerror(errno));
+ value_ = strdup(error);
}
+ initial_load = 1;
format();
+ initial_load = 0;
if (target)
topline(target);
@@ -3164,9 +3228,7 @@ Fl_Help_View::load(const char *f)// I - Filename to load (may also have target)
}
-//
-// 'Fl_Help_View::resize()' - Resize the help widget.
-//
+/** Resizes the help widget. */
void
Fl_Help_View::resize(int xx, // I - New left position
@@ -3180,21 +3242,21 @@ Fl_Help_View::resize(int xx, // I - New left position
Fl_Widget::resize(xx, yy, ww, hh);
- int ss = Fl::scrollbar_size();
- scrollbar_.resize(x() + w() - ss - Fl::box_dw(b) + Fl::box_dx(b),
- y() + Fl::box_dy(b), ss, h() - ss - Fl::box_dh(b));
+ int scrollsize = scrollbar_size_ ? scrollbar_size_ : Fl::scrollbar_size();
+ scrollbar_.resize(x() + w() - scrollsize - Fl::box_dw(b) + Fl::box_dx(b),
+ y() + Fl::box_dy(b), scrollsize, h() - scrollsize - Fl::box_dh(b));
hscrollbar_.resize(x() + Fl::box_dx(b),
- y() + h() - ss - Fl::box_dh(b) + Fl::box_dy(b),
- w() - ss - Fl::box_dw(b), ss);
+ y() + h() - scrollsize - Fl::box_dh(b) + Fl::box_dy(b),
+ w() - scrollsize - Fl::box_dw(b), scrollsize);
format();
}
-//
-// 'Fl_Help_View::topline()' - Set the top line to the named target.
-//
+/** Scrolls the text to the indicated position, given a named destination.
+ \param[in] n target name
+*/
void
Fl_Help_View::topline(const char *n) // I - Target name
{
@@ -3215,24 +3277,28 @@ Fl_Help_View::topline(const char *n) // I - Target name
}
-//
-// 'Fl_Help_View::topline()' - Set the top line by number.
-//
+/** Scrolls the text to the indicated position, given a pixel line.
+ If the given pixel value \p top is out of range, then the text is
+ scrolled to the top or bottom of the document, resp.
+
+ \param[in] top top line number in pixels (0 = start of document)
+*/
void
-Fl_Help_View::topline(int t) // I - Top line number
+Fl_Help_View::topline(int top) // I - Top line number
{
if (!value_)
return;
- if (size_ < (h() - Fl::scrollbar_size()) || t < 0)
- t = 0;
- else if (t > size_)
- t = size_;
+ int scrollsize = scrollbar_size_ ? scrollbar_size_ : Fl::scrollbar_size();
+ if (size_ < (h() - scrollsize) || top < 0)
+ top = 0;
+ else if (top > size_)
+ top = size_;
- topline_ = t;
+ topline_ = top;
- scrollbar_.value(topline_, h() - Fl::scrollbar_size(), 0, size_);
+ scrollbar_.value(topline_, h() - scrollsize, 0, size_);
do_callback();
@@ -3240,64 +3306,69 @@ Fl_Help_View::topline(int t) // I - Top line number
}
-//
-// 'Fl_Help_View::leftline()' - Set the left position.
-//
+/** Scrolls the text to the indicated position, given a pixel column.
+ If the given pixel value \p left is out of range, then the text is
+ scrolled to the left or right side of the document, resp.
+
+ \param[in] left left column number in pixels (0 = left side)
+*/
void
-Fl_Help_View::leftline(int l) // I - Left position
+Fl_Help_View::leftline(int left) // I - Left position
{
if (!value_)
return;
- if (hsize_ < (w() - Fl::scrollbar_size()) || l < 0)
- l = 0;
- else if (l > hsize_)
- l = hsize_;
+ int scrollsize = scrollbar_size_ ? scrollbar_size_ : Fl::scrollbar_size();
+ if (hsize_ < (w() - scrollsize) || left < 0)
+ left = 0;
+ else if (left > hsize_)
+ left = hsize_;
- leftline_ = l;
+ leftline_ = left;
- hscrollbar_.value(leftline_, w() - Fl::scrollbar_size(), 0, hsize_);
+ hscrollbar_.value(leftline_, w() - scrollsize, 0, hsize_);
redraw();
}
-//
-// 'Fl_Help_View::value()' - Set the help text directly.
-//
+/** Sets the current help text buffer to the string provided and reformats the text.
+ The provided character string \p val is copied internally and will be
+ freed when value() is called again, or when the widget is destroyed.
+
+ If \p val is NULL, then the widget is cleared.
+*/
void
-Fl_Help_View::value(const char *v) // I - Text to view
+Fl_Help_View::value(const char *val) // I - Text to view
{
clear_selection();
free_data();
set_changed();
- if (!v)
+ if (!val)
return;
- value_ = strdup(v);
+ value_ = strdup(val);
+ initial_load = 1;
format();
+ initial_load = 0;
topline(0);
leftline(0);
}
+
#ifdef ENC
# undef ENC
#endif
-#ifdef __APPLE__
-# define ENC(a, b) b
-#else
+// part b in the table seems to be mac_roman - beku
# define ENC(a, b) a
-#endif
-//
-// 'quote_char()' - Return the character code associated with a quoted char.
-//
+/** Returns the character code associated with a quoted char. */
static int // O - Code or -1 on error
quote_char(const char *p) { // I - Quoted string
int i; // Looping var
@@ -3427,10 +3498,7 @@ quote_char(const char *p) { // I - Quoted string
}
-//
-// 'scrollbar_callback()' - A callback for the scrollbar.
-//
-
+/** The vertical scrollbar callback. */
static void
scrollbar_callback(Fl_Widget *s, void *)
{
@@ -3438,10 +3506,7 @@ scrollbar_callback(Fl_Widget *s, void *)
}
-//
-// 'hscrollbar_callback()' - A callback for the horizontal scrollbar.
-//
-
+/** The horizontal scrollbar callback. */
static void
hscrollbar_callback(Fl_Widget *s, void *)
{
@@ -3450,5 +3515,5 @@ hscrollbar_callback(Fl_Widget *s, void *)
//
-// End of "$Id: Fl_Help_View.cxx 6091 2008-04-11 11:12:16Z matt $".
+// End of "$Id: Fl_Help_View.cxx 6776 2009-04-22 09:02:13Z greg.ercolano $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Image.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Image.cxx
index 35ddcae35..631035802 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Image.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Image.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Image.cxx 5888 2007-06-07 17:23:41Z matt $"
+// "$Id: Fl_Image.cxx 6773 2009-04-21 09:25:22Z AlbrechtS $"
//
// Image drawing code for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2006 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -43,9 +43,18 @@ void fl_restore_clip(); // from fl_rect.cxx
// Base image class...
//
+/**
+ The destructor is a virtual method that frees all memory used
+ by the image.
+*/
Fl_Image::~Fl_Image() {
}
+/**
+ If the image has been cached for display, delete the cache
+ data. This allows you to change the data used for the image and
+ then redraw it without recreating an image object.
+*/
void Fl_Image::uncache() {
}
@@ -53,6 +62,11 @@ void Fl_Image::draw(int XP, int YP, int, int, int, int) {
draw_empty(XP, YP);
}
+/**
+ The protected method draw_empty() draws a box with
+ an X in it. It can be used to draw any image that lacks image
+ data.
+*/
void Fl_Image::draw_empty(int X, int Y) {
if (w() > 0 && h() > 0) {
fl_color(FL_FOREGROUND_COLOR);
@@ -62,20 +76,56 @@ void Fl_Image::draw_empty(int X, int Y) {
}
}
+/**
+ The copy() method creates a copy of the specified
+ image. If the width and height are provided, the image is
+ resized to the specified size. The image should be deleted (or in
+ the case of Fl_Shared_Image, released) when you are done
+ with it.
+*/
Fl_Image *Fl_Image::copy(int W, int H) {
return new Fl_Image(W, H, d());
}
+/**
+ The color_average() method averages the colors in
+ the image with the FLTK color value c. The i
+ argument specifies the amount of the original image to combine
+ with the color, so a value of 1.0 results in no color blend, and
+ a value of 0.0 results in a constant image of the specified
+ color. The original image data is not altered by this
+ method.
+*/
void Fl_Image::color_average(Fl_Color, float) {
}
+/**
+ The desaturate() method converts an image to
+ grayscale. If the image contains an alpha channel (depth = 4),
+ the alpha channel is preserved. This method does not alter
+ the original image data.
+*/
void Fl_Image::desaturate() {
}
+/**
+ The label() methods are an obsolete way to set the
+ image attribute of a widget or menu item. Use the
+ image() or deimage() methods of the
+ Fl_Widget and Fl_Menu_Item classes
+ instead.
+*/
void Fl_Image::label(Fl_Widget* widget) {
widget->image(this);
}
+/**
+ The label() methods are an obsolete way to set the
+ image attribute of a widget or menu item. Use the
+ image() or deimage() methods of the
+ Fl_Widget and Fl_Menu_Item classes
+ instead.
+*/
void Fl_Image::label(Fl_Menu_Item* m) {
Fl::set_labeltype(_FL_IMAGE_LABEL, labeltype, measure);
m->label(_FL_IMAGE_LABEL, (const char*)this);
@@ -122,7 +172,7 @@ Fl_Image::measure(const Fl_Label *lo, // I - Label
//
// RGB image class...
//
-
+/** The destructor free all memory and server resources that are used by the image. */
Fl_RGB_Image::~Fl_RGB_Image() {
uncache();
if (alloc_array) delete[] (uchar *)array;
@@ -402,7 +452,11 @@ void Fl_RGB_Image::draw(int XP, int YP, int WP, int HP, int cx, int cy) {
if (H <= 0) return;
if (!id) {
#ifdef __APPLE_QUARTZ__
- CGColorSpaceRef lut = CGColorSpaceCreateDeviceRGB();
+ CGColorSpaceRef lut = 0;
+ if (d()<=2)
+ lut = CGColorSpaceCreateDeviceGray();
+ else
+ lut = CGColorSpaceCreateDeviceRGB();
CGDataProviderRef src = CGDataProviderCreateWithData( 0L, array, w()*h()*d(), 0L);
id = CGImageCreate( w(), h(), 8, d()*8, ld()?ld():w()*d(),
lut, (d()&1)?kCGImageAlphaNone:kCGImageAlphaLast,
@@ -432,56 +486,8 @@ void Fl_RGB_Image::draw(int XP, int YP, int WP, int HP, int cx, int cy) {
}
#endif
}
-#ifdef WIN32
- if (mask) {
- HDC new_gc = CreateCompatibleDC(fl_gc);
- int save = SaveDC(new_gc);
- SelectObject(new_gc, (void*)mask);
- BitBlt(fl_gc, X, Y, W, H, new_gc, cx, cy, SRCAND);
- SelectObject(new_gc, (void*)id);
- BitBlt(fl_gc, X, Y, W, H, new_gc, cx, cy, SRCPAINT);
- RestoreDC(new_gc,save);
- DeleteDC(new_gc);
- } else if (d()==2 || d()==4) {
- fl_copy_offscreen_with_alpha(X, Y, W, H, (Fl_Offscreen)id, cx, cy);
- } else {
- fl_copy_offscreen(X, Y, W, H, (Fl_Offscreen)id, cx, cy);
- }
-#elif defined(__APPLE_QD__)
- if (mask) {
- Rect src, dst;
- // MRS: STR #114 says we should be using cx, cy, W, and H...
-// src.left = 0; src.right = w();
-// src.top = 0; src.bottom = h();
-// dst.left = X; dst.right = X+w();
-// dst.top = Y; dst.bottom = Y+h();
- src.left = cx; src.right = cx+W;
- src.top = cy; src.bottom = cy+H;
- dst.left = X; dst.right = X+W;
- dst.top = Y; dst.bottom = Y+H;
- RGBColor rgb;
- rgb.red = 0xffff; rgb.green = 0xffff; rgb.blue = 0xffff;
- RGBBackColor(&rgb);
- rgb.red = 0x0000; rgb.green = 0x0000; rgb.blue = 0x0000;
- RGBForeColor(&rgb);
- CopyMask(GetPortBitMapForCopyBits((GrafPtr)id),
- GetPortBitMapForCopyBits((GrafPtr)mask),
- GetPortBitMapForCopyBits(GetWindowPort(fl_window)),
- &src, &src, &dst);
- } else if (id) fl_copy_offscreen(X, Y, W, H, (Fl_Offscreen)id, cx, cy);
- else {
- // Composite image with alpha manually each time...
- alpha_blend(this, X, Y, W, H, cx, cy);
- }
-#elif defined(__APPLE_QUARTZ__)
- if (id && fl_gc) {
- CGRect rect = { { X, Y }, { W, H } };
- Fl_X::q_begin_image(rect, cx, cy, w(), h());
- CGContextDrawImage(fl_gc, rect, (CGImageRef)id);
- Fl_X::q_end_image();
- }
-#else
+#if defined(USE_X11)
if (id) {
if (mask) {
// I can't figure out how to combine a mask with existing region,
@@ -507,6 +513,30 @@ void Fl_RGB_Image::draw(int XP, int YP, int WP, int HP, int cx, int cy) {
// Composite image with alpha manually each time...
alpha_blend(this, X, Y, W, H, cx, cy);
}
+#elif defined(WIN32)
+ if (mask) {
+ HDC new_gc = CreateCompatibleDC(fl_gc);
+ int save = SaveDC(new_gc);
+ SelectObject(new_gc, (void*)mask);
+ BitBlt(fl_gc, X, Y, W, H, new_gc, cx, cy, SRCAND);
+ SelectObject(new_gc, (void*)id);
+ BitBlt(fl_gc, X, Y, W, H, new_gc, cx, cy, SRCPAINT);
+ RestoreDC(new_gc,save);
+ DeleteDC(new_gc);
+ } else if (d()==2 || d()==4) {
+ fl_copy_offscreen_with_alpha(X, Y, W, H, (Fl_Offscreen)id, cx, cy);
+ } else {
+ fl_copy_offscreen(X, Y, W, H, (Fl_Offscreen)id, cx, cy);
+ }
+#elif defined(__APPLE_QUARTZ__)
+ if (id && fl_gc) {
+ CGRect rect = { { X, Y }, { W, H } };
+ Fl_X::q_begin_image(rect, cx, cy, w(), h());
+ CGContextDrawImage(fl_gc, rect, (CGImageRef)id);
+ Fl_X::q_end_image();
+ }
+#else
+# error unsupported platform
#endif
}
@@ -521,5 +551,5 @@ void Fl_RGB_Image::label(Fl_Menu_Item* m) {
//
-// End of "$Id: Fl_Image.cxx 5888 2007-06-07 17:23:41Z matt $".
+// End of "$Id: Fl_Image.cxx 6773 2009-04-21 09:25:22Z AlbrechtS $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Input.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Input.cxx
index ae3e8d33d..1b25a6898 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Input.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Input.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Input.cxx 6103 2008-04-21 20:42:51Z matt $"
+// "$Id: Fl_Input.cxx 6765 2009-04-15 08:35:28Z matt $"
//
// Input widget for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2006 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -140,47 +140,210 @@ int Fl_Input::handle_key() {
return 1;
}
+ unsigned int mods = Fl::event_state() & (FL_META|FL_CTRL|FL_ALT);
switch (Fl::event_key()) {
case FL_Insert:
if (Fl::event_state() & FL_CTRL) ascii = ctrl('C');
else if (Fl::event_state() & FL_SHIFT) ascii = ctrl('V');
break;
case FL_Delete:
- if (Fl::event_state() & FL_SHIFT) ascii = ctrl('X');
- else ascii = ctrl('D');
- break;
+#ifdef __APPLE__
+ if (mods==0 || mods==FL_CTRL) { // delete next char
+ ascii = ctrl('D');
+ } else if (mods==FL_ALT) { // delete next word
+ if (mark() != position()) return cut();
+ cut(position(), word_end(position()));
+ return 1;
+ } else if (mods==FL_META) { // delete to the end of the line
+ if (mark() != position()) return cut();
+ cut(position(), line_end(position()));
+ return 1;
+ } else return 1;
+#else
+ if (mods==0) {
+ ascii = ctrl('D');
+ } else if (mods==FL_SHIFT) {
+ ascii = ctrl('X');
+ } else return 1;
+#endif
+ break;
case FL_Left:
- ascii = ctrl('B'); break;
+#ifdef __APPLE__
+ if (mods==0) { // char left
+ ascii = ctrl('B');
+ } else if (mods==FL_ALT) { // word left
+ shift_position(word_start(position()));
+ return 1;
+ } else if (mods==FL_CTRL || mods==FL_META) { // start of line
+ shift_position(line_start(position()));
+ return 1;
+ } else return 1;
+#else
+ if (mods==0) { // char left
+ ascii = ctrl('B');
+ } else if (mods==FL_CTRL) { // word left
+ shift_position(word_start(position()));
+ return 1;
+ } else return 1;
+#endif
+ break;
case FL_Right:
- ascii = ctrl('F'); break;
+#ifdef __APPLE__
+ if (mods==0) { // char right
+ ascii = ctrl('F');
+ } else if (mods==FL_ALT) { // word right
+ shift_position(word_end(position()));
+ return 1;
+ } else if (mods==FL_CTRL || mods==FL_META) { // end of line
+ shift_position(line_end(position()));
+ return 1;
+ } else return 1;
+#else
+ if (mods==0) { // char right
+ ascii = ctrl('F');
+ } else if (mods==FL_CTRL) { // word right
+ shift_position(word_end(position()));
+ return 1;
+ } else return 1;
+#endif // __APPLE__
+ break;
case FL_Page_Up:
- fl_font(textfont(),textsize()); //ensure current font is set to ours
- repeat_num=h()/fl_height(); // number of lines to scroll
- if (!repeat_num) repeat_num=1;
+#ifdef __APPLE__
+ if (mods==0) { // scroll text one page
+ // OS X scrolls the view, but does not move the cursor
+ // Fl_Input has no scroll control, so instead we move the cursor by one page
+ repeat_num = linesPerPage();
+ ascii = ctrl('P');
+ } else if (mods==FL_ALT) { // move cursor one page
+ repeat_num = linesPerPage();
+ ascii = ctrl('P');
+ } else return 1;
+ break;
+#else
+ repeat_num = linesPerPage();
+ // fall through
+#endif
case FL_Up:
- ascii = ctrl('P'); break;
+#ifdef __APPLE__
+ if (mods==0) { // line up
+ ascii = ctrl('P');
+ } else if (mods==FL_CTRL) { // scroll text down one page
+ // OS X scrolls the view, but does not move the cursor
+ // Fl_Input has no scroll control, so instead we move the cursor by one page
+ repeat_num = linesPerPage();
+ ascii = ctrl('P');
+ } else if (mods==FL_ALT) { // line start and up
+ if (line_start(position())==position() && position()>0)
+ return shift_position(line_start(position()-1)) + NORMAL_INPUT_MOVE;
+ else
+ return shift_position(line_start(position())) + NORMAL_INPUT_MOVE;
+ } else if (mods==FL_META) { // start of document
+ shift_position(0);
+ return 1;
+ } else return 1;
+#else
+ if (mods==0) { // line up
+ ascii = ctrl('P');
+ } else if (mods==FL_CTRL) { // scroll text down one line
+ // Fl_Input has no scroll control, so instead we move the cursor by one page
+ ascii = ctrl('P');
+ } else return 1;
+#endif
+ break;
case FL_Page_Down:
- fl_font(textfont(),textsize());
- repeat_num=h()/fl_height();
- if (!repeat_num) repeat_num=1;
+#ifdef __APPLE__
+ if (mods==0) { // scroll text one page
+ // OS X scrolls the view, but does not move the cursor
+ // Fl_Input has no scroll control, so instead we move the cursor by one page
+ repeat_num = linesPerPage();
+ ascii = ctrl('N');
+ } else if (mods==FL_ALT) { // move cursor one page
+ repeat_num = linesPerPage();
+ ascii = ctrl('N');
+ } else return 1;
+ break;
+#else
+ repeat_num = linesPerPage();
+ // fall through
+#endif
case FL_Down:
- ascii = ctrl('N'); break;
+#ifdef __APPLE__
+ if (mods==0) { // line down
+ ascii = ctrl('N');
+ } else if (mods==FL_CTRL) {
+ // OS X scrolls the view, but does not move the cursor
+ // Fl_Input has no scroll control, so instead we move the cursor by one page
+ repeat_num = linesPerPage();
+ ascii = ctrl('N');
+ } else if (mods==FL_ALT) { // line end and down
+ if (line_end(position())==position() && position()= size()) return NORMAL_INPUT_MOVE;
while (repeat_num--) {
@@ -258,7 +421,7 @@ int Fl_Input::handle_key() {
}
shift_up_down_position(i);
return 1;
- case ctrl('P'):
+ case ctrl('P'): // go up one line
i = position();
if (!line_start(i)) return NORMAL_INPUT_MOVE;
while(repeat_num--) {
@@ -268,13 +431,13 @@ int Fl_Input::handle_key() {
}
shift_up_down_position(line_start(i));
return 1;
- case ctrl('U'):
+ case ctrl('U'): // clear the whole document?
if (readonly()) {
fl_beep();
return 1;
}
return cut(0, size());
- case ctrl('V'):
+ case ctrl('V'): // paste text
case ctrl('Y'):
if (readonly()) {
fl_beep();
@@ -282,7 +445,7 @@ int Fl_Input::handle_key() {
}
Fl::paste(*this, 1);
return 1;
- case ctrl('X'):
+ case ctrl('X'): // cut the selected text
case ctrl('W'):
if (readonly()) {
fl_beep();
@@ -290,14 +453,14 @@ int Fl_Input::handle_key() {
}
copy(1);
return cut();
- case ctrl('Z'):
+ case ctrl('Z'): // undo
case ctrl('_'):
if (readonly()) {
fl_beep();
return 1;
}
return undo();
- case ctrl('I'):
+ case ctrl('I'): // insert literal
case ctrl('J'):
case ctrl('L'):
case ctrl('M'):
@@ -465,10 +628,14 @@ int Fl_Input::handle(int event) {
w()-Fl::box_dw(b), h()-Fl::box_dh(b));
}
+/**
+ Creates a new Fl_Input widget using the given position, size,
+ and label string. The default boxtype is FL_DOWN_BOX.
+*/
Fl_Input::Fl_Input(int X, int Y, int W, int H, const char *l)
: Fl_Input_(X, Y, W, H, l) {
}
//
-// End of "$Id: Fl_Input.cxx 6103 2008-04-21 20:42:51Z matt $".
+// End of "$Id: Fl_Input.cxx 6765 2009-04-15 08:35:28Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Input_.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Input_.cxx
index e0458a082..ef7a441d9 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Input_.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Input_.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Input_.cxx 6104 2008-04-21 20:54:37Z matt $"
+// "$Id: Fl_Input_.cxx 6777 2009-04-23 15:32:19Z matt $"
//
// Common input widget routines for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2006 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,17 +25,13 @@
// http://www.fltk.org/str.php
//
-// This is the base class for Fl_Input. You can use it directly
-// if you are one of those people who like to define their own
-// set of editing keys. It may also be useful for adding scrollbars
-// to the input field.
-
#include
#include
#include
#include
#include
#include
+#include
#include "flstring.h"
#include
#include
@@ -46,9 +42,19 @@ extern void fl_draw(const char*, int, float, float);
////////////////////////////////////////////////////////////////
-// Copy string p..e to the buffer, replacing characters with ^X and \nnn
-// as necessary. Truncate if necessary so the resulting string and
-// null terminator fits in a buffer of size n. Return new end pointer.
+/** \internal
+ Convert a given text segment into the text that will be rendered on screen.
+
+ Copy the text from \p p to \p buf, replacing charcters with ^X
+ and \\nnn as necessary.
+
+ The destination buffer is limited to \c MAXBUF (currently at 1024). All
+ following text is truncated.
+
+ \param [in] p pointer to source buffer
+ \param [in] buf pointer to destination buffer
+ \return pointer to the end of the destination buffer
+*/
const char* Fl_Input_::expand(const char* p, char* buf) const {
char* o = buf;
char* e = buf+(MAXBUF-4);
@@ -57,9 +63,14 @@ const char* Fl_Input_::expand(const char* p, char* buf) const {
int width_to_lastspace = 0;
int word_count = 0;
int word_wrap;
+// const char *pe = p + strlen(p);
if (input_type()==FL_SECRET_INPUT) {
- while (o= 1) *o++ = '*';
+ p++;
+ }
+
} else while (o= value_+size_ || isspace(*p & 255))) {
word_wrap = w() - Fl::box_dw(box()) - 2;
@@ -79,27 +90,13 @@ const char* Fl_Input_::expand(const char* p, char* buf) const {
if (c < ' ' || c == 127) {
if (c=='\n' && input_type()==FL_MULTILINE_INPUT) {p--; break;}
if (c == '\t' && input_type()==FL_MULTILINE_INPUT) {
- for (c = (o-buf)%8; c<8 && o= 128 && c < 0xA0) {
- // these codes are not defined in ISO code, so we output the octal code instead
- // *o++ = '\\';
- // *o++ = ((c>>6)&0x03) + '0';
- // *o++ = ((c>>3)&0x07) + '0';
- // *o++ = (c&0x07) + '0';
- } else if (c == 0xA0) { // nbsp
- *o++ = ' ';
-#endif
} else {
*o++ = c;
}
@@ -108,7 +105,17 @@ const char* Fl_Input_::expand(const char* p, char* buf) const {
return p;
}
-// After filling in such a buffer, find the width to e
+/** \internal
+ Calculates the width in pixels of part of a text buffer.
+
+ This call takes a string, usually created by expand, and calculates
+ the width of the string when rendered with the give font.
+
+ \param [in] p pointer to the start of the original string
+ \param [in] e pointer to the end of the original string
+ \param [in] buf pointer to the buffer as returned by expand()
+ \return width of string in pixels
+*/
double Fl_Input_::expandpos(
const char* p, // real string
const char* e, // pointer into real string
@@ -116,23 +123,24 @@ double Fl_Input_::expandpos(
int* returnn // return offset into buf here
) const {
int n = 0;
- if (input_type()==FL_SECRET_INPUT) n = e-p;
- else while (p= 1) n++;
+ p++;
+ }
+ } else while (p= 128 && c < 0xA0) {
- // these codes are not defined in ISO code, so we output the octal code instead
- // n += 4;
-#endif
+ if (c == '\t' && input_type()==FL_MULTILINE_INPUT) {
+ n += 8-(chr%8);
+ chr += 8-(chr%8);
+ } else n += 2;
} else {
n++;
}
+ chr += fl_utf8len((char)p[0]) >= 1;
+ p++;
}
if (returnn) *returnn = n;
return fl_width(buf, n);
@@ -140,12 +148,20 @@ double Fl_Input_::expandpos(
////////////////////////////////////////////////////////////////
-// minimal update:
-// Characters from mu_p to end of widget are redrawn.
-// If erase_cursor_only, small part at mu_p is redrawn.
-// Right now minimal update just keeps unchanged characters from
-// being erased, so they don't blink.
+/** \internal
+ Mark a range of characters for update.
+ This call marks all characters from \p to the end of the
+ text buffer for update. At least these chracters
+ will be redrawn in the next update cycle.
+
+ Characters from \p mu_p to end of widget are redrawn.
+ If \p erase_cursor_only, small part at \p mu_p is redrawn.
+ Right now minimal update just keeps unchanged characters from
+ being erased, so they don't blink.
+
+ \param [in] p start of update range
+*/
void Fl_Input_::minimal_update(int p) {
if (damage() & FL_DAMAGE_ALL) return; // don't waste time if it won't be done
if (damage() & FL_DAMAGE_EXPOSE) {
@@ -158,6 +174,15 @@ void Fl_Input_::minimal_update(int p) {
erase_cursor_only = 0;
}
+/** \internal
+ Mark a range of characters for update.
+
+ This call marks a text range for update. At least all chracters
+ from \p p to \p q will be redrawn in the next update cycle.
+
+ \param [in] p start of update range
+ \param [in] q end of update range
+*/
void Fl_Input_::minimal_update(int p, int q) {
if (q < p) p = q;
minimal_update(p);
@@ -165,13 +190,28 @@ void Fl_Input_::minimal_update(int p, int q) {
////////////////////////////////////////////////////////////////
-static double up_down_pos;
-static int was_up_down;
+/* Horizontal cursor position in pixels while movin up or down. */
+double Fl_Input_::up_down_pos = 0;
+/* Flag to remeber last cursor move. */
+int Fl_Input_::was_up_down = 0;
+
+/**
+ Set the current font and font size.
+*/
void Fl_Input_::setfont() const {
- fl_font(textfont(), textsize());
+ fl_font(textfont(), textsize());
}
+/**
+ Draw the text in the passed bounding box.
+
+ If damage() & FL_DAMAGE_ALL is true, this assumes the
+ area has already been erased to color(). Otherwise it does
+ minimal update and erases the area itself.
+
+ \param X, Y, W, H area that must be redrawn
+*/
void Fl_Input_::drawtext(int X, int Y, int W, int H) {
int do_mu = !(damage()&FL_DAMAGE_ALL);
@@ -240,7 +280,7 @@ void Fl_Input_::drawtext(int X, int Y, int W, int H) {
yscroll_ = -(H-height)/2;
}
- fl_clip(X, Y, W, H);
+ fl_push_clip(X, Y, W, H);
Fl_Color tc = active_r() ? textcolor() : fl_inactive(textcolor());
p = value();
@@ -344,27 +384,66 @@ void Fl_Input_::drawtext(int X, int Y, int W, int H) {
}
fl_pop_clip();
+ if (Fl::focus() == this) {
+ fl_set_spot(textfont(), textsize(),
+ (int)xpos+curx, Y+ypos-fl_descent(), W, H, window());
+ }
}
+/** \internal
+ Simple function that determins if a charcter could be part of a word.
+ \todo This function is not ucs4-aware.
+*/
static int isword(char c) {
return (c&128 || isalnum(c) || strchr("#%&-/@\\_~", c));
}
+/**
+ Finds the end of a word.
+
+ This call calculates the end of a word based on the given
+ index \p i. Calling this function repeatedly will move
+ forwards to the end of the text.
+
+ \param [in] i starting index for the search
+ \return end of the word
+*/
int Fl_Input_::word_end(int i) const {
if (input_type() == FL_SECRET_INPUT) return size();
//while (i < size() && !isword(index(i))) i++;
+ while (i < size() && !isword(index(i))) i++;
while (i < size() && isword(index(i))) i++;
return i;
}
+/**
+ Finds the start of a word.
+
+ This call calculates the start of a word based on the given
+ index \p i. Calling this function repeatedly will move
+ backwards to the beginning of the text.
+
+ \param [in] i starting index for the search
+ \return start of the word
+*/
int Fl_Input_::word_start(int i) const {
if (input_type() == FL_SECRET_INPUT) return 0;
// if (i >= size() || !isword(index(i)))
// while (i > 0 && !isword(index(i-1))) i--;
+ while (i > 0 && !isword(index(i-1))) i--;
while (i > 0 && isword(index(i-1))) i--;
return i;
}
+/**
+ Finds the end of a line.
+
+ This call calculates the end of a line based on the given
+ index \p i.
+
+ \param [in] i starting index for the search
+ \return end of the line
+*/
int Fl_Input_::line_end(int i) const {
if (input_type() != FL_MULTILINE_INPUT) return size();
@@ -386,6 +465,15 @@ int Fl_Input_::line_end(int i) const {
}
}
+/**
+ Finds the start of a line.
+
+ This call calculates the start of a line based on the given
+ index \p i.
+
+ \param [in] i starting index for the search
+ \return start of the line
+*/
int Fl_Input_::line_start(int i) const {
if (input_type() != FL_MULTILINE_INPUT) return 0;
int j = i;
@@ -402,6 +490,10 @@ int Fl_Input_::line_start(int i) const {
} else return j;
}
+/**
+ Handle mouse clicks and mouse moves.
+ \todo Add comment and parameters
+*/
void Fl_Input_::handle_mouse(int X, int Y, int /*W*/, int /*H*/, int drag) {
was_up_down = 0;
if (!size()) return;
@@ -423,14 +515,20 @@ void Fl_Input_::handle_mouse(int X, int Y, int /*W*/, int /*H*/, int drag) {
const char *l, *r, *t; double f0 = Fl::event_x()-X+xscroll_;
for (l = p, r = e; l 0) {
+ f1 = X-xscroll_+expandpos(p, l + cw, buf, 0) - Fl::event_x();
+ if (f1 < f0) l = l+cw;
+ }
}
newpos = l-value();
@@ -469,13 +567,51 @@ void Fl_Input_::handle_mouse(int X, int Y, int /*W*/, int /*H*/, int drag) {
position(newpos, newmark);
}
+/**
+ Sets the index for the cursor and mark.
+
+ The input widget maintains two pointers into the string. The
+ \e position is where the cursor is. The
+ \e mark is the other end of the selected text. If they
+ are equal then there is no selection. Changing this does not
+ affect the clipboard (use copy() to do that).
+
+ Changing these values causes a redraw(). The new
+ values are bounds checked.
+
+ \param p index for the cursor position
+ \param m index for the mark
+ \return 0 if no positions changed
+ \see position(int), position(), mark(int)
+*/
int Fl_Input_::position(int p, int m) {
+ int is_same = 0;
was_up_down = 0;
if (p<0) p = 0;
if (p>size()) p = size();
if (m<0) m = 0;
if (m>size()) m = size();
+ if (p == m) is_same = 1;
+
+ while (p < position_ && p > 0 && (size() - p) > 0 &&
+ (fl_utf8len((char)(value() + p)[0]) < 1)) { p--; }
+ int ul = fl_utf8len((char)(value() + p)[0]);
+ while (p < size() && p > position_ && ul < 0) {
+ p++;
+ ul = fl_utf8len((char)(value() + p)[0]);
+ }
+
+ while (m < mark_ && m > 0 && (size() - m) > 0 &&
+ (fl_utf8len((char)(value() + m)[0]) < 1)) { m--; }
+ ul = fl_utf8len((char)(value() + m)[0]);
+ while (m < size() && m > mark_ && ul < 0) {
+ m++;
+ ul = fl_utf8len((char)(value() + m)[0]);
+ }
+ if (is_same) m = p;
if (p == position_ && m == mark_) return 0;
+
+
//if (Fl::selection_owner() == this) Fl::selection_owner(0);
if (p != m) {
if (p != position_) minimal_update(position_, p);
@@ -496,6 +632,18 @@ int Fl_Input_::position(int p, int m) {
return 1;
}
+/**
+ Move the cursor to the column given by \p up_down_pos.
+
+ This function is helpful when implementing up and down
+ cursor movement. It moves the cursor from the beginning
+ of a line to the column indicated by the global variable
+ \p up_down_pos in pixel units.
+
+ \param [in] i index into the beginning of a line of text
+ \param [in] keepmark if set, move only the cursor, but not the mark
+ \return index to new cursor position
+*/
int Fl_Input_::up_down_position(int i, int keepmark) {
// unlike before, i must be at the start of the line already!
@@ -515,6 +663,19 @@ int Fl_Input_::up_down_position(int i, int keepmark) {
return j;
}
+/**
+ Put the current selection into the clipboard.
+
+ This function copies the current selection between mark() and
+ position() into the specified clipboard. This does not
+ replace the old clipboard contents if position() and
+ mark() are equal. Clipboard 0 maps to the current text
+ selection and clipboard 1 maps to the cut/paste clipboard.
+
+ \param clipboard the clipboard destionation 0 or 1
+ \return 0 if no text is selected, 1 if the selection was copied
+ \see Fl::copy(const char *, int, int)
+*/
int Fl_Input_::copy(int clipboard) {
int b = position();
int e = mark();
@@ -549,9 +710,39 @@ static void undobuffersize(int n) {
}
}
-// all changes go through here, delete characters b-e and insert text:
-int Fl_Input_::replace(int b, int e, const char* text, int ilen) {
+/**
+ Deletes text from \p b to \p e and inserts the new string \p text.
+ All changes to the text buffer go through this function.
+ It deletes the region between \p a and \p b (either one may be less or
+ equal to the other), and then inserts the string \p text
+ at that point and moves the mark() and
+ position() to the end of the insertion. Does the callback if
+ when() & FL_WHEN_CHANGED and there is a change.
+
+ Set \p b and \p e equal to not delete
+ anything. Set insert to \c NULL to not insert
+ anything.
+
+ \p ilen must be zero or strlen(insert), this
+ saves a tiny bit of time if you happen to already know the
+ length of the insertion, or can be used to insert a portion of a
+ string or a string containing nul's.
+
+ \p b and \p e are clamped to the
+ 0..size() range, so it is safe to pass any values.
+
+ cut() and insert() are just inline
+ functions that call replace().
+
+ \param [in] b beginning index of text to be deleted
+ \param [in] e ending index of text to be deleted and insertion position
+ \param [in] text string that will be inserted
+ \param [in] ilen length of \p text or 0 for \c nul terminated strings
+ \return 0 if nothing changed
+*/
+int Fl_Input_::replace(int b, int e, const char* text, int ilen) {
+ int ul, om, op;
was_up_down = 0;
if (b<0) b = 0;
@@ -559,6 +750,13 @@ int Fl_Input_::replace(int b, int e, const char* text, int ilen) {
if (b>size_) b = size_;
if (e>size_) e = size_;
if (e 0 && (size_ - b) > 0 &&
+ (fl_utf8len((value_ + b)[0]) < 1)) { b--; }
+ ul = fl_utf8len((char)(value_ + e)[0]);
+ while (e < size_ && e > 0 && ul < 0) {
+ e++;
+ ul = fl_utf8len((char)(value_ + e)[0]);
+ }
if (text && !ilen) ilen = strlen(text);
if (e<=b && !ilen) return 0; // don't clobber undo for a null operation
if (size_+ilen-(e-b) > maximum_size_) {
@@ -605,7 +803,9 @@ int Fl_Input_::replace(int b, int e, const char* text, int ilen) {
size_ += ilen;
}
undowidget = this;
- undoat = b+ilen;
+ om = mark_;
+ op = position_;
+ mark_ = position_ = undoat = b+ilen;
// Insertions into the word at the end of the line will cause it to
// wrap to the next line, so we must indicate that the changes may start
@@ -615,7 +815,7 @@ int Fl_Input_::replace(int b, int e, const char* text, int ilen) {
if (wrap()) {
// if there is a space in the pasted text, the whole line may have rewrapped
int i;
- for (i=0; i 0 && !isspace(index(b) & 255) && index(b)!='\n') b--;
@@ -624,8 +824,8 @@ int Fl_Input_::replace(int b, int e, const char* text, int ilen) {
}
// make sure we redraw the old selection or cursor:
- if (mark_ < b) b = mark_;
- if (position_ < b) b = position_;
+ if (om < b) b = om;
+ if (op < b) b = op;
minimal_update(b);
@@ -636,6 +836,13 @@ int Fl_Input_::replace(int b, int e, const char* text, int ilen) {
return 1;
}
+/**
+ Undo previous changes to the text buffer.
+
+ This call undoes a number of previous calls to replace().
+
+ \return non-zero if any change was made.
+*/
int Fl_Input_::undo() {
was_up_down = 0;
if (undowidget != this || !undocut && !undoinsert) return 0;
@@ -676,6 +883,16 @@ int Fl_Input_::undo() {
return 1;
}
+/**
+ Copy the \e yank buffer to the clipboard.
+
+ Copy all the previous contiguous cuts from the undo
+ information to the clipboard. This function implemnts
+ the \c ^K shortcut key.
+
+ \return 0 if the operation did not change the clipboard
+ \see copy(int), cut()
+*/
int Fl_Input_::copy_cuts() {
// put the yank buffer into the X clipboard
if (!yankcut || input_type()==FL_SECRET_INPUT) return 0;
@@ -683,12 +900,21 @@ int Fl_Input_::copy_cuts() {
return 1;
}
+/** \internal
+ Check the when() field and do a callback if indicated.
+*/
void Fl_Input_::maybe_do_callback() {
if (changed() || (when()&FL_WHEN_NOT_CHANGED)) {
do_callback();
}
}
+/**
+ Handle all kinds of text field related events.
+
+ This is calle by derived classes.
+ \todo Add comment and parameters
+*/
int Fl_Input_::handletext(int event, int X, int Y, int W, int H) {
switch (event) {
@@ -702,6 +928,7 @@ int Fl_Input_::handletext(int event, int X, int Y, int W, int H) {
return 1;
case FL_FOCUS:
+ fl_set_spot(textfont(), textsize(), x(), y(), w(), h(), window());
if (mark_ == position_) {
minimal_update(size()+1);
} else //if (Fl::selection_owner() != this)
@@ -715,6 +942,7 @@ int Fl_Input_::handletext(int event, int X, int Y, int W, int H) {
} else //if (Fl::selection_owner() != this)
minimal_update(mark_, position_);
case FL_HIDE:
+ fl_reset_spot();
if (!readonly() && (when() & FL_WHEN_RELEASE))
maybe_do_callback();
return 1;
@@ -788,6 +1016,14 @@ int Fl_Input_::handletext(int event, int X, int Y, int W, int H) {
}
return replace(position(), mark(), t, e-t);}
+ case FL_SHORTCUT:
+ if (!(shortcut() ? Fl::test_shortcut(shortcut()) : test_shortcut()))
+ return 0;
+ if (Fl::visible_focus() && handle(FL_FOCUS)) {
+ Fl::focus(this);
+ return 1;
+ } // else fall through
+
default:
return 0;
}
@@ -795,12 +1031,22 @@ int Fl_Input_::handletext(int event, int X, int Y, int W, int H) {
/*------------------------------*/
+/**
+ Creates a new Fl_Input_ widget.
+
+ This function created a new Fl_Input_ widget and adds it to the curren
+ Fl_Group. The value() is set the \c NULL.
+ The default boxtype is \c FL_DOWN_BOX.
+
+ \param X, Y, W, H the dimensions of the new widget
+ \param l an optional label text
+*/
Fl_Input_::Fl_Input_(int X, int Y, int W, int H, const char* l)
: Fl_Widget(X, Y, W, H, l) {
box(FL_DOWN_BOX);
color(FL_BACKGROUND2_COLOR, FL_SELECTION_COLOR);
align(FL_ALIGN_LEFT);
- textsize_ = (uchar)FL_NORMAL_SIZE;
+ textsize_ = FL_NORMAL_SIZE;
textfont_ = FL_HELVETICA;
textcolor_ = FL_FOREGROUND_COLOR;
cursor_color_ = FL_FOREGROUND_COLOR; // was FL_BLUE
@@ -810,8 +1056,15 @@ Fl_Input_::Fl_Input_(int X, int Y, int W, int H, const char* l)
value_ = "";
xscroll_ = yscroll_ = 0;
maximum_size_ = 32767;
+ shortcut_ = 0;
+ set_flag(SHORTCUT_LABEL);
}
+/**
+ Copy the value from a possibly static entry into the internal buffer.
+
+ \param [in] len size of the current text
+*/
void Fl_Input_::put_in_buffer(int len) {
if (value_ == buffer && bufsize > len) {
buffer[size_] = 0;
@@ -847,6 +1100,24 @@ void Fl_Input_::put_in_buffer(int len) {
value_ = buffer;
}
+/**
+ Changes the widget text.
+
+ This function change the text and set the mark and the point to
+ the end of it. The string is \e not copied. If the user edits the
+ string it is copied to the internal buffer then. This can save a
+ great deal of time and memory if your program is rapidly
+ changing the values of text fields, but this will only work if
+ the passed string remains unchanged until either the
+ Fl_Input is destroyed or value() is called again.
+
+ You can use the \p len parameter to directly set the length
+ if you know it already or want to put \c nul characters in the text.
+
+ \param [in] str the new text
+ \param [in] len the length of the new text
+ \return non-zero if the new value is different than the current one
+*/
int Fl_Input_::static_value(const char* str, int len) {
clear_changed();
if (undowidget == this) undowidget = 0;
@@ -877,31 +1148,112 @@ int Fl_Input_::static_value(const char* str, int len) {
return 1;
}
+/**
+ Changes the widget text.
+
+ This function change the text and set the mark and the point to
+ the end of it. The string is \e not copied. If the user edits the
+ string it is copied to the internal buffer then. This can save a
+ great deal of time and memory if your program is rapidly
+ changing the values of text fields, but this will only work if
+ the passed string remains unchanged until either the
+ Fl_Input is destroyed or value() is called again.
+
+ \param [in] str the new text
+ \return non-zero if the new value is different than the current one
+*/
int Fl_Input_::static_value(const char* str) {
return static_value(str, str ? strlen(str) : 0);
}
+/**
+ Changes the widget text.
+
+ This function changes the text and sets the mark and the
+ point to the end of it. The string is copied to the internal
+ buffer. Passing \c NULL is the same as "".
+
+ You can use the \p length parameter to directly set the length
+ if you know it already or want to put \c nul characters in the text.
+
+ \param [in] str the new text
+ \param [in] len the length of the new text
+ \return non-zero if the new value is different than the current one
+ \see Fl_Input_::value(const char* str), Fl_Input_::value()
+*/
int Fl_Input_::value(const char* str, int len) {
int r = static_value(str, len);
if (len) put_in_buffer(len);
return r;
}
+/**
+ Changes the widget text.
+
+ This function changes the text and sets the mark and the
+ point to the end of it. The string is copied to the internal
+ buffer. Passing \c NULL is the same as \c "".
+
+ \param [in] str the new text
+ \return non-zero if the new value is different than the current one
+ \see Fl_Input_::value(const char* str, int len), Fl_Input_::value()
+*/
int Fl_Input_::value(const char* str) {
return value(str, str ? strlen(str) : 0);
}
+/**
+ Change the size of the widget.
+ This call updates the text layout so that the cursor is visible.
+ \param [in] X, Y, W, H new size of the widget
+ \see Fl_Widget::resize(int, int, int, int)
+*/
void Fl_Input_::resize(int X, int Y, int W, int H) {
if (W != w()) xscroll_ = 0;
if (H != h()) yscroll_ = 0;
Fl_Widget::resize(X, Y, W, H);
}
+/**
+ Destroys the widget.
+
+ The destructor clears all allocated buffers and removes the widget
+ from the parent Fl_Group.
+*/
Fl_Input_::~Fl_Input_() {
if (undowidget == this) undowidget = 0;
if (bufsize) free((void*)buffer);
}
+/** \internal
+ Return the number of lines displayed on a single page.
+ \return widget height divided by the font height
+*/
+int Fl_Input_::linesPerPage() {
+ int n = 1;
+ if (input_type() == FL_MULTILINE_INPUT) {
+ fl_font(textfont(),textsize()); //ensure current font is set to ours
+ n = h()/fl_height(); // number of lines to scroll
+ if (n<=0) n = 1;
+ }
+ return n;
+}
+
+/**
+ Returns the character at index \p i.
+
+ This function returns the utf8 character at \p i
+ as a ucs4 character code.
+
+ \param [in] i index into the value field
+ \return the character at index \p i
+*/
+Fl_Char Fl_Input_::index(int i) const
+{
+ int len = 0;
+ return fl_utf8decode(value_+i, value_+size_, &len);
+}
+
//
-// End of "$Id: Fl_Input_.cxx 6104 2008-04-21 20:54:37Z matt $".
+// End of "$Id: Fl_Input_.cxx 6777 2009-04-23 15:32:19Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Light_Button.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Light_Button.cxx
index 9a8c50b87..8041f4354 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Light_Button.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Light_Button.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Light_Button.cxx 5721 2007-02-27 19:23:24Z matt $"
+// "$Id: Fl_Light_Button.cxx 6616 2009-01-01 21:28:26Z matt $"
//
// Lighted button widget for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2006 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -157,6 +157,11 @@ int Fl_Light_Button::handle(int event) {
}
}
+/**
+ Creates a new Fl_Light_Button widget using the given
+ position, size, and label string.
+ The destructor deletes the check button.
+*/
Fl_Light_Button::Fl_Light_Button(int X, int Y, int W, int H, const char* l)
: Fl_Button(X, Y, W, H, l) {
type(FL_TOGGLE_BUTTON);
@@ -165,5 +170,5 @@ Fl_Light_Button::Fl_Light_Button(int X, int Y, int W, int H, const char* l)
}
//
-// End of "$Id: Fl_Light_Button.cxx 5721 2007-02-27 19:23:24Z matt $".
+// End of "$Id: Fl_Light_Button.cxx 6616 2009-01-01 21:28:26Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Menu.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Menu.cxx
index 1513d8fac..5d1a92bdc 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Menu.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Menu.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Menu.cxx 6043 2008-02-25 13:09:30Z matt $"
+// "$Id: Fl_Menu.cxx 6757 2009-04-12 20:00:45Z matt $"
//
// Menu code for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2006 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -41,7 +41,7 @@
#ifdef __APPLE__
# include
#endif
-
+/** Size of the menu starting from this menu item */
int Fl_Menu_Item::size() const {
const Fl_Menu_Item* m = this;
int nest = 0;
@@ -56,6 +56,11 @@ int Fl_Menu_Item::size() const {
}
}
+/**
+ Advance a pointer by n items through a menu array, skipping
+ the contents of submenus and invisible items. There are two calls so
+ that you can advance through const and non-const data.
+*/
const Fl_Menu_Item* Fl_Menu_Item::next(int n) const {
if (n < 0) return 0; // this is so selected==-1 returns NULL
const Fl_Menu_Item* m = this;
@@ -75,7 +80,7 @@ const Fl_Menu_Item* Fl_Menu_Item::next(int n) const {
}
// appearance of current menus are pulled from this parent widget:
-static const Fl_Menu_* button;
+static const Fl_Menu_* button=0;
////////////////////////////////////////////////////////////////
@@ -101,6 +106,7 @@ public:
int numitems;
int selected;
int drawn_selected; // last redraw has this selected
+ int shortcutWidth;
const Fl_Menu_Item* menu;
menuwindow(const Fl_Menu_Item* m, int X, int Y, int W, int H,
const Fl_Menu_Item* picked, const Fl_Menu_Item* title,
@@ -118,15 +124,18 @@ public:
extern char fl_draw_shortcut;
-// width of label, including effect of & characters:
+/**
+ Measures width of label, including effect of & characters.
+ Optionally, can get height if hp is not NULL.
+*/
int Fl_Menu_Item::measure(int* hp, const Fl_Menu_* m) const {
Fl_Label l;
l.value = text;
l.image = 0;
l.deimage = 0;
l.type = labeltype_;
- l.font = labelsize_ || labelfont_ ? labelfont_ : uchar(m ? m->textfont() : FL_HELVETICA);
- l.size = labelsize_ ? labelsize_ : m ? m->textsize() : (uchar)FL_NORMAL_SIZE;
+ l.font = labelsize_ || labelfont_ ? labelfont_ : (m ? m->textfont() : FL_HELVETICA);
+ l.size = labelsize_ ? labelsize_ : m ? m->textsize() : FL_NORMAL_SIZE;
l.color = FL_FOREGROUND_COLOR; // this makes no difference?
fl_draw_shortcut = 1;
int w = 0; int h = 0;
@@ -136,6 +145,7 @@ int Fl_Menu_Item::measure(int* hp, const Fl_Menu_* m) const {
return w;
}
+/** Draws the menu item in bounding box x,y,w,h, optionally selects the item. */
void Fl_Menu_Item::draw(int x, int y, int w, int h, const Fl_Menu_* m,
int selected) const {
Fl_Label l;
@@ -143,15 +153,15 @@ void Fl_Menu_Item::draw(int x, int y, int w, int h, const Fl_Menu_* m,
l.image = 0;
l.deimage = 0;
l.type = labeltype_;
- l.font = labelsize_ || labelfont_ ? labelfont_ : uchar(m ? m->textfont() : FL_HELVETICA);
- l.size = labelsize_ ? labelsize_ : m ? m->textsize() : (uchar)FL_NORMAL_SIZE;
+ l.font = labelsize_ || labelfont_ ? labelfont_ : (m ? m->textfont() : FL_HELVETICA);
+ l.size = labelsize_ ? labelsize_ : m ? m->textsize() : FL_NORMAL_SIZE;
l.color = labelcolor_ ? labelcolor_ : m ? m->textcolor() : int(FL_FOREGROUND_COLOR);
if (!active()) l.color = fl_inactive((Fl_Color)l.color);
Fl_Color color = m ? m->color() : FL_GRAY;
if (selected) {
Fl_Color r = m ? m->selection_color() : FL_SELECTION_COLOR;
Fl_Boxtype b = m && m->down_box() ? m->down_box() : FL_FLAT_BOX;
- if (fl_contrast(r,color)!=r) { // back compatability boxtypes
+ if (fl_contrast(r,color)!=r) { // back compatibility boxtypes
if (selected == 2) { // menu title
r = color;
b = m ? m->box() : FL_UP_BOX;
@@ -287,11 +297,12 @@ menuwindow::menuwindow(const Fl_Menu_Item* m, int X, int Y, int Wp, int Hp,
}
color(button && !Fl::scheme() ? button->color() : FL_GRAY);
selected = -1;
- {int j = 0;
- if (m) for (const Fl_Menu_Item* m1=m; ; m1 = m1->next(), j++) {
- if (picked) {
- if (m1 == picked) {selected = j; picked = 0;}
- else if (m1 > picked) {selected = j-1; picked = 0; Wp = Hp = 0;}
+ {
+ int j = 0;
+ if (m) for (const Fl_Menu_Item* m1=m; ; m1 = m1->next(), j++) {
+ if (picked) {
+ if (m1 == picked) {selected = j; picked = 0;}
+ else if (m1 > picked) {selected = j-1; picked = 0; Wp = Hp = 0;}
}
if (!m1->text) break;
}
@@ -306,48 +317,55 @@ menuwindow::menuwindow(const Fl_Menu_Item* m, int X, int Y, int Wp, int Hp,
itemheight = 1;
int hotKeysw = 0;
+ int hotModsw = 0;
int Wtitle = 0;
int Htitle = 0;
if (t) Wtitle = t->measure(&Htitle, button) + 12;
int W = 0;
if (m) for (; m->text; m = m->next()) {
- int hh; int w1 = m->measure(&hh, button);
+ int hh;
+ int w1 = m->measure(&hh, button);
if (hh+LEADING>itemheight) itemheight = hh+LEADING;
if (m->flags&(FL_SUBMENU|FL_SUBMENU_POINTER)) w1 += 14;
if (w1 > W) W = w1;
if (m->shortcut_) {
- w1 = int(fl_width(fl_shortcut_label(m->shortcut_))) + 8;
+ const char *k, *s = fl_shortcut_label(m->shortcut_, &k);
+ w1 = int(fl_width(s, k-s));
+ if (w1 > hotModsw) hotModsw = w1;
+ w1 = int(fl_width(k))+4;
if (w1 > hotKeysw) hotKeysw = w1;
}
if (m->labelcolor_ || Fl::scheme() || m->labeltype_ > FL_NO_LABEL) clear_overlay();
}
+ shortcutWidth = hotKeysw;
if (selected >= 0 && !Wp) X -= W/2;
int BW = Fl::box_dx(box());
- W += hotKeysw+2*BW+7;
+ W += hotKeysw+hotModsw+2*BW+7;
if (Wp > W) W = Wp;
if (Wtitle > W) W = Wtitle;
- if (X < scr_x) X = scr_x; if (X > scr_x+scr_w-W) X= scr_x+scr_w-W;
+ if (X < scr_x) X = scr_x; if (X > scr_x+scr_w-W) X = right_edge-W; //X= scr_x+scr_w-W;
x(X); w(W);
h((numitems ? itemheight*numitems-LEADING : 0)+2*BW+3);
- if (selected >= 0)
+ if (selected >= 0) {
Y = Y+(Hp-itemheight)/2-selected*itemheight-BW;
- else {
+ } else {
Y = Y+Hp;
// if the menu hits the bottom of the screen, we try to draw
// it above the menubar instead. We will not adjust any menu
// that has a selected item.
if (Y+h()>scr_y+scr_h && Y-h()>=scr_y) {
- if (Hp>1)
+ if (Hp>1) {
// if we know the height of the Fl_Menu_, use it
Y = Y-Hp-h();
- else if (t)
+ } else if (t) {
// assume that the menubar item height relates to the first
// menuitem as well
Y = Y-itemheight-h()-Fl::box_dh(box());
- else
+ } else {
// draw the menu to the right
Y = Y-h()+itemheight+Fl::box_dy(box());
+ }
}
}
if (m) y(Y); else {y(Y-2); w(1); h(1);}
@@ -362,8 +380,9 @@ menuwindow::menuwindow(const Fl_Menu_Item* m, int X, int Y, int Wp, int Hp,
int ht = Htitle+2*BW+3;
title = new menutitle(X, Y-ht-dy, Wtitle, ht, t);
}
- } else
+ } else {
title = 0;
+ }
}
menuwindow::~menuwindow() {
@@ -413,7 +432,7 @@ void menuwindow::drawentry(const Fl_Menu_Item* m, int n, int eraseit) {
m->draw(xx, yy, ww, hh, button, n==selected);
- // the shortcuts and arrows assumme fl_color() was left set by draw():
+ // the shortcuts and arrows assume fl_color() was left set by draw():
if (m->submenu()) {
int sz = (hh-7)&-2;
int y1 = yy+(hh-sz)/2;
@@ -424,7 +443,10 @@ void menuwindow::drawentry(const Fl_Menu_Item* m, int n, int eraseit) {
button ? button->textfont() : FL_HELVETICA;
fl_font(f, m->labelsize_ ? m->labelsize_ :
button ? button->textsize() : FL_NORMAL_SIZE);
- fl_draw(fl_shortcut_label(m->shortcut_), xx, yy, ww-3, hh, FL_ALIGN_RIGHT);
+ const char *k, *s = fl_shortcut_label(m->shortcut_, &k);
+ char buf[32]; strcpy(buf, s); buf[k-s] = 0;
+ fl_draw(buf, xx, yy, ww-shortcutWidth, hh, FL_ALIGN_RIGHT);
+ fl_draw( k, xx+ww-shortcutWidth, yy, shortcutWidth, hh, FL_ALIGN_LEFT);
}
if (m->flags & FL_MENU_DIVIDER) {
@@ -532,7 +554,7 @@ struct menustate {
menuwindow* fakemenu; // kludge for buttons in menubar
int is_inside(int mx, int my);
};
-static menustate* p;
+static menustate* p=0;
// return 1 if the coordinates are inside any of the menuwindows
int menustate::is_inside(int mx, int my) {
@@ -664,65 +686,71 @@ int menuwindow::early_hide_handle(int e) {
return 1;
}
break;
- case FL_SHORTCUT: {
- for (int mymenu = pp.nummenus; mymenu--;) {
- menuwindow &mw = *(pp.p[mymenu]);
- int item; const Fl_Menu_Item* m = mw.menu->find_shortcut(&item);
- if (m) {
- setitem(m, mymenu, item);
- if (!m->submenu()) pp.state = DONE_STATE;
- return 1;
+ case FL_SHORTCUT:
+ {
+ for (int mymenu = pp.nummenus; mymenu--;) {
+ menuwindow &mw = *(pp.p[mymenu]);
+ int item; const Fl_Menu_Item* m = mw.menu->find_shortcut(&item);
+ if (m) {
+ setitem(m, mymenu, item);
+ if (!m->submenu()) pp.state = DONE_STATE;
+ return 1;
+ }
}
- }} break;
+ }
+ break;
case FL_ENTER:
case FL_MOVE:
case FL_PUSH:
- case FL_DRAG: {
+ case FL_DRAG:
+ {
#ifdef __QNX__
- // STR 704: workaround QNX X11 bug - in QNX a FL_MOVE event is sent
- // right after FL_RELEASE...
- if (pp.state == DONE_STATE) return 1;
+ // STR 704: workaround QNX X11 bug - in QNX a FL_MOVE event is sent
+ // right after FL_RELEASE...
+ if (pp.state == DONE_STATE) return 1;
#endif // __QNX__
- int mx = Fl::event_x_root();
- int my = Fl::event_y_root();
- int item=0; int mymenu = pp.nummenus-1;
- // Clicking or dragging outside menu cancels it...
- if ((!pp.menubar || mymenu) && !pp.is_inside(mx, my)) {
- setitem(0, -1, 0);
- if (e==FL_PUSH)
- pp.state = DONE_STATE;
- return 1;
- }
- for (mymenu = pp.nummenus-1; ; mymenu--) {
- item = pp.p[mymenu]->find_selected(mx, my);
- if (item >= 0)
- break;
- if (mymenu <= 0) {
- // buttons in menubars must be deselected if we move outside of them!
- if (pp.menu_number==-1 && e==FL_PUSH) {
- pp.state = DONE_STATE;
- return 1;
- }
- if (pp.current_item && pp.menu_number==0 && !pp.current_item->submenu()) {
- if (e==FL_PUSH)
- pp.state = DONE_STATE;
- setitem(0, -1, 0);
- return 1;
- }
- // all others can stay selected
- return 0;
+ int mx = Fl::event_x_root();
+ int my = Fl::event_y_root();
+ int item=0; int mymenu = pp.nummenus-1;
+ // Clicking or dragging outside menu cancels it...
+ if ((!pp.menubar || mymenu) && !pp.is_inside(mx, my)) {
+ setitem(0, -1, 0);
+ if (e==FL_PUSH)
+ pp.state = DONE_STATE;
+ return 1;
+ }
+ for (mymenu = pp.nummenus-1; ; mymenu--) {
+ item = pp.p[mymenu]->find_selected(mx, my);
+ if (item >= 0)
+ break;
+ if (mymenu <= 0) {
+ // buttons in menubars must be deselected if we move outside of them!
+ if (pp.menu_number==-1 && e==FL_PUSH) {
+ pp.state = DONE_STATE;
+ return 1;
+ }
+ if (pp.current_item && pp.menu_number==0 && !pp.current_item->submenu()) {
+ if (e==FL_PUSH)
+ pp.state = DONE_STATE;
+ setitem(0, -1, 0);
+ return 1;
+ }
+ // all others can stay selected
+ return 0;
+ }
+ }
+ if (my == 0 && item > 0) setitem(mymenu, item - 1);
+ else setitem(mymenu, item);
+ if (e == FL_PUSH) {
+ if (pp.current_item && pp.current_item->submenu() // this is a menu title
+ && item != pp.p[mymenu]->selected // and it is not already on
+ && !pp.current_item->callback_) // and it does not have a callback
+ pp.state = MENU_PUSH_STATE;
+ else
+ pp.state = PUSH_STATE;
}
}
- if (my == 0 && item > 0) setitem(mymenu, item - 1);
- else setitem(mymenu, item);
- if (e == FL_PUSH) {
- if (pp.current_item && pp.current_item->submenu() // this is a menu title
- && item != pp.p[mymenu]->selected // and it is not already on
- && !pp.current_item->callback_) // and it does not have a callback
- pp.state = MENU_PUSH_STATE;
- else
- pp.state = PUSH_STATE;
- }} return 1;
+ return 1;
case FL_RELEASE:
// Mouse must either be held down/dragged some, or this must be
// the second click (not the one that popped up the menu):
@@ -745,13 +773,22 @@ int menuwindow::early_hide_handle(int e) {
return Fl_Window::handle(e);
}
+/**
+ Pulldown() is similar to popup(), but a rectangle is
+ provided to position the menu. The menu is made at least W
+ wide, and the picked item is centered over the rectangle
+ (like Fl_Choice uses). If picked is zero or not
+ found, the menu is aligned just below the rectangle (like a pulldown
+ menu).
+ The title and menubar arguments are used
+ internally by the Fl_Menu_Bar widget.
+*/
const Fl_Menu_Item* Fl_Menu_Item::pulldown(
int X, int Y, int W, int H,
const Fl_Menu_Item* initial_item,
const Fl_Menu_* pbutton,
const Fl_Menu_Item* t,
- int menubar) const
-{
+ int menubar) const {
Fl_Group::current(0); // fix possible user error...
button = pbutton;
@@ -783,7 +820,7 @@ const Fl_Menu_Item* Fl_Menu_Item::pulldown(
if (menubar) {
// find the initial menu
if (!mw.handle(FL_DRAG)) {
- Fl::release();
+ Fl::grab(0);
return 0;
}
}
@@ -794,21 +831,25 @@ const Fl_Menu_Item* Fl_Menu_Item::pulldown(
for (;;) {
// make sure all the menus are shown:
- {for (int k = menubar; k < pp.nummenus; k++)
- if (!pp.p[k]->shown()) {
- if (pp.p[k]->title) pp.p[k]->title->show();
- pp.p[k]->show();
+ {
+ for (int k = menubar; k < pp.nummenus; k++) {
+ if (!pp.p[k]->shown()) {
+ if (pp.p[k]->title) pp.p[k]->title->show();
+ pp.p[k]->show();
+ }
}
}
// get events:
- {const Fl_Menu_Item* oldi = pp.current_item;
- Fl::wait();
- if (pp.state == DONE_STATE) break; // done.
- if (pp.current_item == oldi) continue;}
- // only do rest if item changes:
+ {
+ const Fl_Menu_Item* oldi = pp.current_item;
+ Fl::wait();
+ if (pp.state == DONE_STATE) break; // done.
+ if (pp.current_item == oldi) continue;
+ }
- delete pp.fakemenu; pp.fakemenu = 0; // turn off "menubar button"
+ // only do rest if item changes:
+ if(pp.fakemenu) {delete pp.fakemenu; pp.fakemenu = 0;} // turn off "menubar button"
if (!pp.current_item) { // pointing at nothing
// turn off selection in deepest menu, but don't erase other menus:
@@ -816,7 +857,7 @@ const Fl_Menu_Item* Fl_Menu_Item::pulldown(
continue;
}
- delete pp.fakemenu; pp.fakemenu = 0;
+ if(pp.fakemenu) {delete pp.fakemenu; pp.fakemenu = 0;}
initial_item = 0; // stop the startup code
pp.p[pp.menu_number]->autoscroll(pp.item_number);
@@ -887,28 +928,46 @@ const Fl_Menu_Item* Fl_Menu_Item::pulldown(
}
}
const Fl_Menu_Item* m = pp.current_item;
- Fl::release();
+ Fl::grab(0);
delete pp.fakemenu;
while (pp.nummenus>1) delete pp.p[--pp.nummenus];
mw.hide();
return m;
}
-const Fl_Menu_Item*
-Fl_Menu_Item::popup(
+/**
+ This method is called by widgets that want to display menus. The menu
+ stays up until the user picks an item or dismisses it. The selected
+ item (or NULL if none) is returned. This does not do the
+ callbacks or change the state of check or radio items.
+
X,Y is the position of the mouse cursor, relative to the
+ window that got the most recent event (usually you can pass
+ Fl::event_x() and Fl::event_y() unchanged here).
+ title is a character string title for the menu. If
+ non-zero a small box appears above the menu with the title in it.
+ The menu is positioned so the cursor is centered over the item
+ picked. This will work even if picked is in a submenu.
+ If picked is zero or not in the menu item table the menu is
+ positioned with the cursor in the top-left corner.
+ button is a pointer to an
+ Fl_Menu_ from which the color and boxtypes for the menu are
+ pulled. If NULL then defaults are used.
+*/
+const Fl_Menu_Item* Fl_Menu_Item::popup(
int X, int Y,
const char* title,
const Fl_Menu_Item* picked,
const Fl_Menu_* but
- ) const
-{
+ ) const {
static Fl_Menu_Item dummy; // static so it is all zeros
dummy.text = title;
return pulldown(X, Y, 0, 0, picked, but, title ? &dummy : 0);
}
-// Search only the top level menu for a shortcut. Either &x in the
-// label or the shortcut fields are used:
+/**
+ Search only the top level menu for a shortcut.
+ Either &x in the label or the shortcut fields are used.
+*/
const Fl_Menu_Item* Fl_Menu_Item::find_shortcut(int* ip) const {
const Fl_Menu_Item* m = first();
if (m) for (int ii = 0; m->text; m = m->next(), ii++) {
@@ -925,6 +984,14 @@ const Fl_Menu_Item* Fl_Menu_Item::find_shortcut(int* ip) const {
// Recursive search of all submenus for anything with this key as a
// shortcut. Only uses the shortcut field, ignores &x in the labels:
+/**
+ This is designed to be called by a widgets handle() method in
+ response to a FL_SHORTCUT event. If the current event matches
+ one of the items shortcut, that item is returned. If the keystroke
+ does not match any shortcuts then NULL is returned. This only
+ matches the shortcut() fields, not the letters in the title
+ preceeded by '
+*/
const Fl_Menu_Item* Fl_Menu_Item::test_shortcut() const {
const Fl_Menu_Item* m = first();
const Fl_Menu_Item* ret = 0;
@@ -945,5 +1012,5 @@ const Fl_Menu_Item* Fl_Menu_Item::test_shortcut() const {
}
//
-// End of "$Id: Fl_Menu.cxx 6043 2008-02-25 13:09:30Z matt $".
+// End of "$Id: Fl_Menu.cxx 6757 2009-04-12 20:00:45Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Menu_.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Menu_.cxx
index 5585bbdf1..ce7c89e10 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Menu_.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Menu_.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Menu_.cxx 5190 2006-06-09 16:16:34Z mike $"
+// "$Id: Fl_Menu_.cxx 6660 2009-02-15 18:58:03Z AlbrechtS $"
//
// Common menu code for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -24,7 +24,6 @@
//
// http://www.fltk.org/str.php
//
-
// This is a base class for all items that have a menu:
// Fl_Menu_Bar, Fl_Menu_Button, Fl_Choice
// This provides storage for a menu item, functions to add/modify/delete
@@ -38,15 +37,15 @@
#include
#include
-// Set 'pathname' of specified menuitem
-// If finditem==NULL, mvalue() is used (the most recently picked menuitem)
-// Returns:
-// 0 : OK
-// -1 : item not found (name="")
-// -2 : 'name' not large enough (name="")
-//
-#define SAFE_STRCAT(s) \
- { len += strlen(s); if ( len >= namelen ) { *name='\0'; return(-2); } else strcat(name,(s)); }
+#define SAFE_STRCAT(s) { len += strlen(s); if ( len >= namelen ) { *name='\0'; return(-2); } else strcat(name,(s)); }
+
+/** Set 'pathname' of specified menuitem
+ If finditem==NULL, mvalue() is used (the most recently picked menuitem)
+ Returns:
+ - 0 : OK
+ - -1 : item not found (name="")
+ - -2 : 'name' not large enough (name="")
+*/
int Fl_Menu_::item_pathname(char *name, int namelen, const Fl_Menu_Item *finditem) const {
int len = 0;
finditem = finditem ? finditem : mvalue();
@@ -75,14 +74,13 @@ int Fl_Menu_::item_pathname(char *name, int namelen, const Fl_Menu_Item *findite
return(-1); // item not found
}
-// FIND MENU ITEM INDEX, GIVEN MENU PATHNAME
-// eg. "Edit/Copy"
-// Will also return submenus, eg. "Edit"
-// Returns NULL if not found.
-//
-const Fl_Menu_Item *
-Fl_Menu_::find_item(const char *name)
-{
+/**
+ Find menu item index, given menu pathname
+ eg. "Edit/Copy"
+ Will also return submenus, eg. "Edit"
+ Returns NULL if not found.
+*/
+const Fl_Menu_Item * Fl_Menu_::find_item(const char *name) {
char menupath[1024] = ""; // File/Export
for ( int t=0; t < size(); t++ ) {
@@ -115,15 +113,23 @@ Fl_Menu_::find_item(const char *name)
return (const Fl_Menu_Item *)0;
}
+/**
+ The value is the index into menu() of the last item chosen by
+ the user. It is zero initially. You can set it as an integer, or set
+ it with a pointer to a menu item. The set routines return non-zero if
+ the new value is different than the old one.
+*/
int Fl_Menu_::value(const Fl_Menu_Item* m) {
clear_changed();
if (value_ != m) {value_ = m; return 1;}
return 0;
}
-// When user picks a menu item, call this. It will do the callback.
-// Unfortunatly this also casts away const for the checkboxes, but this
-// was necessary so non-checkbox menus can really be declared const...
+/**
+ When user picks a menu item, call this. It will do the callback.
+ Unfortunately this also casts away const for the checkboxes, but this
+ was necessary so non-checkbox menus can really be declared const...
+*/
const Fl_Menu_Item* Fl_Menu_::picked(const Fl_Menu_Item* v) {
if (v) {
if (v->radio()) {
@@ -150,7 +156,7 @@ const Fl_Menu_Item* Fl_Menu_::picked(const Fl_Menu_Item* v) {
return v;
}
-// turn on one of a set of radio buttons
+/** Turns the radio item "on" for the menu item and turns off adjacent radio items set. */
void Fl_Menu_Item::setonly() {
flags |= FL_MENU_RADIO | FL_MENU_VALUE;
Fl_Menu_Item* j;
@@ -167,6 +173,10 @@ void Fl_Menu_Item::setonly() {
}
Fl_Menu_::Fl_Menu_(int X,int Y,int W,int H,const char* l)
+/**
+ Creates a new Fl_Menu_ widget using the given position, size,
+ and label string. menu() is initialized to null.
+*/
: Fl_Widget(X,Y,W,H,l) {
set_flag(SHORTCUT_LABEL);
box(FL_UP_BOX);
@@ -175,16 +185,29 @@ Fl_Menu_::Fl_Menu_(int X,int Y,int W,int H,const char* l)
alloc = 0;
selection_color(FL_SELECTION_COLOR);
textfont(FL_HELVETICA);
- textsize((uchar)FL_NORMAL_SIZE);
+ textsize(FL_NORMAL_SIZE);
textcolor(FL_FOREGROUND_COLOR);
down_box(FL_NO_BOX);
}
+/**
+ This returns the number of Fl_Menu_Item structures that make up the
+ menu, correctly counting submenus. This includes the "terminator"
+ item at the end. To copy a menu array you need to copy
+ size()*sizeof(Fl_Menu_Item) bytes. If the menu is
+ NULL this returns zero (an empty menu will return 1).
+*/
int Fl_Menu_::size() const {
if (!menu_) return 0;
return menu_->size();
}
+/**
+ Sets the menu array pointer directly. If the old menu is private it is
+ deleted. NULL is allowed and acts the same as a zero-length
+ menu. If you try to modify the array (with add(), replace(), or
+ delete()) a private copy is automatically done.
+*/
void Fl_Menu_::menu(const Fl_Menu_Item* m) {
clear();
value_ = menu_ = (Fl_Menu_Item*)m;
@@ -192,13 +215,18 @@ void Fl_Menu_::menu(const Fl_Menu_Item* m) {
// this version is ok with new Fl_Menu_add code with fl_menu_array_owner:
+/**
+ Sets the menu array pointer with a copy of m that will be automatically deleted.
+ If ud is not NULL, then all user data pointers are changed in the menus as well.
+ See void Fl_Menu_::menu(const Fl_Menu_Item* m).
+*/
void Fl_Menu_::copy(const Fl_Menu_Item* m, void* ud) {
int n = m->size();
Fl_Menu_Item* newMenu = new Fl_Menu_Item[n];
memcpy(newMenu, m, n*sizeof(Fl_Menu_Item));
menu(newMenu);
alloc = 1; // make destructor free array, but not strings
- // for convienence, provide way to change all the user data pointers:
+ // for convenience, provide way to change all the user data pointers:
if (ud) for (; n--;) {
if (newMenu->callback_) newMenu->user_data_ = ud;
newMenu++;
@@ -213,6 +241,12 @@ Fl_Menu_::~Fl_Menu_() {
// expanding array. We must not free this array:
Fl_Menu_* fl_menu_array_owner = 0;
+/**
+ Same as menu(NULL), set the array pointer to null, indicating
+ a zero-length menu.
+
+ Menus must not be cleared during a callback to the same menu.
+*/
void Fl_Menu_::clear() {
if (alloc) {
if (alloc>1) for (int i = size(); i--;)
@@ -228,5 +262,5 @@ void Fl_Menu_::clear() {
}
//
-// End of "$Id: Fl_Menu_.cxx 5190 2006-06-09 16:16:34Z mike $".
+// End of "$Id: Fl_Menu_.cxx 6660 2009-02-15 18:58:03Z AlbrechtS $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Menu_Bar.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Menu_Bar.cxx
index 15035f237..8328836e3 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Menu_Bar.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Menu_Bar.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Menu_Bar.cxx 5190 2006-06-09 16:16:34Z mike $"
+// "$Id: Fl_Menu_Bar.cxx 6616 2009-01-01 21:28:26Z matt $"
//
// Menu bar widget for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -74,5 +74,5 @@ int Fl_Menu_Bar::handle(int event) {
}
//
-// End of "$Id: Fl_Menu_Bar.cxx 5190 2006-06-09 16:16:34Z mike $".
+// End of "$Id: Fl_Menu_Bar.cxx 6616 2009-01-01 21:28:26Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Menu_Button.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Menu_Button.cxx
index 76c4a8600..0334b2e35 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Menu_Button.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Menu_Button.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Menu_Button.cxx 5190 2006-06-09 16:16:34Z mike $"
+// "$Id: Fl_Menu_Button.cxx 6659 2009-02-15 13:49:34Z AlbrechtS $"
//
// Menu button widget for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2006 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -37,7 +37,7 @@ void Fl_Menu_Button::draw() {
draw_box(pressed_menu_button_ == this ? fl_down(box()) : box(), color());
draw_label();
if (Fl::focus() == this) draw_focus();
- if (box() == FL_FLAT_BOX) return; // for XForms compatability
+ // ** if (box() == FL_FLAT_BOX) return; // for XForms compatibility
int H = (labelsize()-3)&-2;
int X = x()+w()-H*2;
int Y = y()+(h()-H)/2;
@@ -47,12 +47,18 @@ void Fl_Menu_Button::draw() {
fl_line(X+H, Y, X+H/2, Y+H);
}
+/**
+ Act exactly as though the user clicked the button or typed the
+ shortcut key. The menu appears, it waits for the user to pick an item,
+ and if they pick one it sets value() and does the callback or
+ sets changed() as described above. The menu item is returned
+ or NULL if the user dismisses the menu.
+*/
const Fl_Menu_Item* Fl_Menu_Button::popup() {
const Fl_Menu_Item* m;
pressed_menu_button_ = this;
redraw();
- Fl_Widget *mb = this;
- Fl::watch_widget_pointer(mb);
+ Fl_Widget_Tracker mb(this);
if (!box() || type()) {
m = menu()->popup(Fl::event_x(), Fl::event_y(), label(), mvalue(), this);
} else {
@@ -60,8 +66,7 @@ const Fl_Menu_Item* Fl_Menu_Button::popup() {
}
picked(m);
pressed_menu_button_ = 0;
- if (mb) mb->redraw();
- Fl::release_widget_pointer(mb);
+ if (mb.exists()) redraw();
return m;
}
@@ -101,11 +106,17 @@ int Fl_Menu_Button::handle(int e) {
}
}
+/**
+ Creates a new Fl_Menu_Button widget using the given position,
+ size, and label string. The default boxtype is FL_UP_BOX.
+ The constructor sets menu() to NULL. See
+ Fl_Menu_ for the methods to set or change the menu.
+*/
Fl_Menu_Button::Fl_Menu_Button(int X,int Y,int W,int H,const char *l)
: Fl_Menu_(X,Y,W,H,l) {
down_box(FL_NO_BOX);
}
//
-// End of "$Id: Fl_Menu_Button.cxx 5190 2006-06-09 16:16:34Z mike $".
+// End of "$Id: Fl_Menu_Button.cxx 6659 2009-02-15 13:49:34Z AlbrechtS $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Menu_Window.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Menu_Window.cxx
index 42f51c934..8f230c379 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Menu_Window.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Menu_Window.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Menu_Window.cxx 5190 2006-06-09 16:16:34Z mike $"
+// "$Id: Fl_Menu_Window.cxx 6616 2009-01-01 21:28:26Z matt $"
//
// Menu window code for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -67,7 +67,12 @@ void Fl_Menu_Window::flush() {
if (!fl_overlay_visual || !overlay()) {Fl_Single_Window::flush(); return;}
Fl_X *myi = Fl_X::i(this);
fl_window = myi->xid;
- if (!gc) gc = XCreateGC(fl_display, myi->xid, 0, 0);
+ if (!gc) {
+ gc = XCreateGC(fl_display, myi->xid, 0, 0);
+# if defined(USE_CAIRO)
+ if(Fl::autolink_context()) Fl::cairo_make_current(gc); // capture gc changes automatically to update the cairo context adequately
+# endif
+ }
fl_gc = gc;
fl_overlay = 1;
fl_clip_region(myi->region); myi->region = 0; current_ = this;
@@ -78,6 +83,7 @@ void Fl_Menu_Window::flush() {
#endif
}
+/** Erases the window, does nothing if HAVE_OVERLAY is not defined config.h */
void Fl_Menu_Window::erase() {
#if HAVE_OVERLAY
if (!gc || !shown()) return;
@@ -94,10 +100,11 @@ void Fl_Menu_Window::hide() {
Fl_Single_Window::hide();
}
+/** Destroys the window and all of its children.*/
Fl_Menu_Window::~Fl_Menu_Window() {
hide();
}
//
-// End of "$Id: Fl_Menu_Window.cxx 5190 2006-06-09 16:16:34Z mike $".
+// End of "$Id: Fl_Menu_Window.cxx 6616 2009-01-01 21:28:26Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Menu_add.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Menu_add.cxx
index 805e694d2..2c1a3c8d8 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Menu_add.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Menu_add.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Menu_add.cxx 5190 2006-06-09 16:16:34Z mike $"
+// "$Id: Fl_Menu_add.cxx 6716 2009-03-24 01:40:44Z fabien $"
//
// Menu utilities for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -24,7 +24,6 @@
//
// http://www.fltk.org/str.php
//
-
// Methods to alter the menu in an Fl_Menu_ widget.
// These are for Forms emulation and for dynamically changing the
@@ -76,7 +75,8 @@ static Fl_Menu_Item* insert(
m->callback_ = 0;
m->user_data_ = 0;
m->flags = flags;
- m->labeltype_ = m->labelfont_ = m->labelsize_ = m->labelcolor_ = 0;
+ m->labeltype_ = m->labelsize_ = m->labelcolor_ = 0;
+ m->labelfont_ = FL_HELVETICA;
return array;
}
@@ -96,9 +96,10 @@ static int compare(const char* a, const char* b) {
}
}
-// Add an item. The text is split at '/' characters to automatically
-// produce submenus (actually a totally unnecessary feature as you can
-// now add submenu titles directly by setting SUBMENU in the flags):
+/** Adds an item. The text is split at '/' characters to automatically
+ produce submenus (actually a totally unnecessary feature as you can
+ now add submenu titles directly by setting SUBMENU in the flags):
+*/
int Fl_Menu_Item::add(
const char *mytext,
int sc,
@@ -119,7 +120,7 @@ int Fl_Menu_Item::add(
// split at slashes to make submenus:
for (;;) {
- // leading slash makes us assumme it is a filename:
+ // leading slash makes us assume it is a filename:
if (*mytext == '/') {item = mytext; break;}
// leading underscore causes divider line:
@@ -175,6 +176,56 @@ int Fl_Menu_Item::add(
return m-array;
}
+/**
+ Adds a new menu item, with a title string, shortcut int (or string),
+ callback, argument to the callback, and flags.
+ If the menu array was directly set with menu(x), then copy() is done
+ to make a private array.
+
+ The characters "&", "/", "\", and "_" are treated as
+ special characters in the label string. The "&" character
+ specifies that the following character is an accelerator and
+ will be underlined. The "\" character is used to escape the next
+ character in the string. Labels starting with the "_" character
+ cause a divider to be placed after that menu item.
+
+ A label of the form "foo/bar/baz" will create submenus called
+ "foo" and "bar" with an entry called "baz". The "/" character is
+ ignored if it appears as the first character of the label string, e.g.
+ "/foo/bar/baz".
+
+ The label string is copied to new memory and can be freed.
+ The other arguments (including the shortcut) are copied into the
+ menu item unchanged.
+
+ If an item exists already with that name then it is replaced with
+ this new one. Otherwise this new one is added to the end of the
+ correct menu or submenu. The return value is the offset into the array
+ that the new entry was placed at.
+
+ Shortcut can be 0L, or either a modifier/key combination (for example
+ FL_CTRL+'A') or a string describing the shortcut in one of two ways:
+
+ \code
+ [#+^] e.g. "97", "^97", "+97", "#97"
+ [#+^] e.g. "a", "^a", "+a", "#a"
+ \endcode
+ ..where \ is a decimal value representing an
+ ascii character (eg. 97 is the ascii for 'a'), and the optional
+ prefixes enhance the value that follows. Multiple prefixes must
+ appear in the above order.
+ \code
+ # - Alt
+ + - Shift
+ ^ - Control
+ \endcode
+ Text shortcuts are converted to integer shortcut by calling
+ int fl_old_shortcut(const char*).
+
+ The return value is the index into the array that the entry was put.
+
+ No items must be added to a menu during a callback to the same menu.
+ */
int Fl_Menu_::add(const char *t, int s, Fl_Callback *c,void *v,int f) {
// make this widget own the local array:
if (this != fl_menu_array_owner) {
@@ -217,9 +268,19 @@ int Fl_Menu_::add(const char *t, int s, Fl_Callback *c,void *v,int f) {
return r;
}
-// This is a Forms (and SGI GL library) compatable add function, it
-// adds many menu items, with '|' seperating the menu items, and tab
-// seperating the menu item names from an optional shortcut string.
+/**
+ This is a Forms (and SGI GL library) compatible add function, it
+ adds many menu items, with '|' separating the menu items, and tab
+ separating the menu item names from an optional shortcut string.
+
+ The passed string is split at any '|' characters and then
+ add(s,0,0,0,0) is done with each section. This is
+ often useful if you are just using the value, and is compatible
+ with Forms and other GL programs. The section strings use the
+ same special characters as described for the long version of add().
+
+ No items must be added to a menu during a callback to the same menu.
+*/
int Fl_Menu_::add(const char *str) {
char buf[1024];
int r = 0;
@@ -237,6 +298,11 @@ int Fl_Menu_::add(const char *str) {
return r;
}
+/**
+ Changes the text of item \p i. This is the only way to get
+ slash into an add()'ed menu item. If the menu array was directly set
+ with menu(x) then copy() is done to make a private array.
+*/
void Fl_Menu_::replace(int i, const char *str) {
if (i<0 || i>=size()) return;
if (!alloc) copy(menu_);
@@ -246,7 +312,12 @@ void Fl_Menu_::replace(int i, const char *str) {
}
menu_[i].text = str;
}
-
+/**
+ Deletes item \p i from the menu. If the menu array was directly
+ set with menu(x) then copy() is done to make a private array.
+
+ No items must be removed from a menu during a callback to the same menu.
+*/
void Fl_Menu_::remove(int i) {
int n = size();
if (i<0 || i>=n) return;
@@ -264,5 +335,5 @@ void Fl_Menu_::remove(int i) {
}
//
-// End of "$Id: Fl_Menu_add.cxx 5190 2006-06-09 16:16:34Z mike $".
+// End of "$Id: Fl_Menu_add.cxx 6716 2009-03-24 01:40:44Z fabien $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Menu_global.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Menu_global.cxx
index e751f1497..31349a8f7 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Menu_global.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Menu_global.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Menu_global.cxx 5190 2006-06-09 16:16:34Z mike $"
+// "$Id: Fl_Menu_global.cxx 6616 2009-01-01 21:28:26Z matt $"
//
// Global menu shortcut code for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -40,11 +40,21 @@ static int handler(int e) {
return the_widget->handle(e);
}
+/**
+ Make the shortcuts for this menu work no matter what window has the
+ focus when you type it. This is done by using
+ Fl::add_handler(). This Fl_Menu_ widget does not
+ have to be visible (ie the window it is in can be hidden, or it does
+ not have to be put in a window at all).
+ Currently there can be only one global()menu. Setting a new
+ one will replace the old one. There is no way to remove the
+ global() setting (so don't destroy the widget!)
+*/
void Fl_Menu_::global() {
if (!the_widget) Fl::add_handler(handler);
the_widget = this;
}
//
-// End of "$Id: Fl_Menu_global.cxx 5190 2006-06-09 16:16:34Z mike $".
+// End of "$Id: Fl_Menu_global.cxx 6616 2009-01-01 21:28:26Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Multi_Label.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Multi_Label.cxx
index 6c5bcd4e4..d8e5cff8a 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Multi_Label.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Multi_Label.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Multi_Label.cxx 5190 2006-06-09 16:16:34Z mike $"
+// "$Id: Fl_Multi_Label.cxx 6616 2009-01-01 21:28:26Z matt $"
//
// Multi-label widget for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -76,5 +76,5 @@ void Fl_Multi_Label::label(Fl_Menu_Item* o) {
}
//
-// End of "$Id: Fl_Multi_Label.cxx 5190 2006-06-09 16:16:34Z mike $".
+// End of "$Id: Fl_Multi_Label.cxx 6616 2009-01-01 21:28:26Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Overlay_Window.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Overlay_Window.cxx
index 26f847041..af6090ee8 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Overlay_Window.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Overlay_Window.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Overlay_Window.cxx 5190 2006-06-09 16:16:34Z mike $"
+// "$Id: Fl_Overlay_Window.cxx 6616 2009-01-01 21:28:26Z matt $"
//
// Overlay window code for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,6 +25,13 @@
// http://www.fltk.org/str.php
//
+/** \fn virtual void Fl_Overlay_Window::draw_overlay() = 0
+ You must subclass Fl_Overlay_Window and provide this method.
+ It is just like a draw() method, except it draws the overlay.
+ The overlay will have already been "cleared" when this is called. You
+ can use any of the routines described in <FL/fl_draw.H>.
+*/
+
// A window using double-buffering and able to draw an overlay
// on top of that. Uses the hardware to draw the overlay if
// possible, otherwise it just draws in the front buffer.
@@ -65,6 +72,9 @@ void Fl_Overlay_Window::resize(int X, int Y, int W, int H) {
if (overlay_ && overlay_!=this) overlay_->resize(0,0,w(),h());
}
+/**
+ Destroys the window and all child widgets.
+*/
Fl_Overlay_Window::~Fl_Overlay_Window() {
hide();
// delete overlay; this is done by ~Fl_Group
@@ -74,6 +84,12 @@ Fl_Overlay_Window::~Fl_Overlay_Window() {
int Fl_Overlay_Window::can_do_overlay() {return 0;}
+/**
+ Call this to indicate that the overlay data has changed and needs to
+ be redrawn. The overlay will be clear until the first time this is
+ called, so if you want an initial display you must call this after
+ calling show().
+*/
void Fl_Overlay_Window::redraw_overlay() {
overlay_ = this;
clear_damage((uchar)(damage()|FL_DAMAGE_OVERLAY));
@@ -115,8 +131,13 @@ void _Fl_Overlay::show() {
void _Fl_Overlay::flush() {
fl_window = fl_xid(this);
- if (!gc) gc = XCreateGC(fl_display, fl_xid(this), 0, 0);
+ if (!gc) {
+ gc = XCreateGC(fl_display, fl_xid(this), 0, 0);
+ }
fl_gc = gc;
+#if defined(USE_CAIRO)
+ if (Fl::cairo_autolink_context()) Fl::cairo_make_current(this); // capture gc changes automatically to update the cairo context adequately
+#endif
fl_overlay = 1;
Fl_Overlay_Window *w = (Fl_Overlay_Window *)parent();
Fl_X *myi = Fl_X::i(this);
@@ -151,5 +172,5 @@ void Fl_Overlay_Window::redraw_overlay() {
#endif
//
-// End of "$Id: Fl_Overlay_Window.cxx 5190 2006-06-09 16:16:34Z mike $".
+// End of "$Id: Fl_Overlay_Window.cxx 6616 2009-01-01 21:28:26Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Pack.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Pack.cxx
index 29d43af9c..86935910c 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Pack.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Pack.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Pack.cxx 5981 2007-11-19 16:21:19Z matt $"
+// "$Id: Fl_Pack.cxx 6616 2009-01-01 21:28:26Z matt $"
//
// Packing widget for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2006 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -34,6 +34,16 @@
#include
#include
+/**
+ Creates a new Fl_Pack widget using the given position, size,
+ and label string. The default boxtype is FL_NO_BOX.
+ The destructor also deletes all the children. This allows a
+ whole tree to be deleted at once, without having to keep a pointer to
+ all the children in the user code. A kludge has been done so the
+ Fl_Pack and all of it's children can be automatic (local)
+ variables, but you must declare the Fl_Packfirst, so
+ that it is destroyed last.
+*/
Fl_Pack::Fl_Pack(int X, int Y, int W, int H,const char *l)
: Fl_Group(X, Y, W, H, l) {
resizable(0);
@@ -143,5 +153,5 @@ void Fl_Pack::draw() {
}
//
-// End of "$Id: Fl_Pack.cxx 5981 2007-11-19 16:21:19Z matt $".
+// End of "$Id: Fl_Pack.cxx 6616 2009-01-01 21:28:26Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Pixmap.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Pixmap.cxx
index 382b692bf..3093f6059 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Pixmap.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Pixmap.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Pixmap.cxx 5190 2006-06-09 16:16:34Z mike $"
+// "$Id: Fl_Pixmap.cxx 6616 2009-01-01 21:28:26Z matt $"
//
// Pixmap drawing code for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,6 +25,15 @@
// http://www.fltk.org/str.php
//
+/** \fn Fl_Pixmap::Fl_Pixmap(const char **data)
+ The constructors create a new pixmap from the specified XPM data.*/
+
+/** \fn Fl_Pixmap::Fl_Pixmap(const unsigned char * const *data)
+ The constructors create a new pixmap from the specified XPM data.*/
+
+/** \fn Fl_Pixmap::Fl_Pixmap(const unsigned char **data)
+ The constructors create a new pixmap from the specified XPM data.*/
+
// Draws X pixmap data, keeping it stashed in a server pixmap so it
// redraws fast.
@@ -109,45 +118,8 @@ void Fl_Pixmap::draw(int XP, int YP, int WP, int HP, int cx, int cy) {
fl_end_offscreen();
#endif
}
-#ifdef WIN32
- if (mask) {
- HDC new_gc = CreateCompatibleDC(fl_gc);
- int save = SaveDC(new_gc);
- SelectObject(new_gc, (void*)mask);
- BitBlt(fl_gc, X, Y, W, H, new_gc, cx, cy, SRCAND);
- SelectObject(new_gc, (void*)id);
- BitBlt(fl_gc, X, Y, W, H, new_gc, cx, cy, SRCPAINT);
- RestoreDC(new_gc,save);
- DeleteDC(new_gc);
- } else {
- fl_copy_offscreen(X, Y, W, H, (Fl_Offscreen)id, cx, cy);
- }
-#elif defined(__APPLE_QD__)
- if (mask) {
- Rect src, dst;
- src.left = cx; src.right = cx+W;
- src.top = cy; src.bottom = cy+H;
- dst.left = X; dst.right = X+W;
- dst.top = Y; dst.bottom = Y+H;
- RGBColor rgb, oldfg, oldbg;
- GetForeColor(&oldfg);
- GetBackColor(&oldbg);
- rgb.red = 0xffff; rgb.green = 0xffff; rgb.blue = 0xffff;
- RGBBackColor(&rgb);
- rgb.red = 0x0000; rgb.green = 0x0000; rgb.blue = 0x0000;
- RGBForeColor(&rgb);
- CopyMask(GetPortBitMapForCopyBits((GrafPtr)id),
- GetPortBitMapForCopyBits((GrafPtr)mask),
- GetPortBitMapForCopyBits(GetWindowPort(fl_window)),
- &src, &src, &dst);
- RGBBackColor(&oldbg);
- RGBForeColor(&oldfg);
- } else {
- fl_copy_offscreen(X, Y, W, H, (Fl_Offscreen)id, cx, cy);
- }
-#elif defined(__APPLE_QUARTZ__)
- fl_copy_offscreen(X, Y, W, H, (Fl_Offscreen)id, cx, cy);
-#else
+
+#if defined(USE_X11)
if (mask) {
// I can't figure out how to combine a mask with existing region,
// so cut the image down to a clipped rectangle:
@@ -166,9 +138,30 @@ void Fl_Pixmap::draw(int XP, int YP, int WP, int HP, int cx, int cy) {
XSetClipOrigin(fl_display, fl_gc, 0, 0);
fl_restore_clip();
}
+#elif defined(WIN32)
+ if (mask) {
+ HDC new_gc = CreateCompatibleDC(fl_gc);
+ int save = SaveDC(new_gc);
+ SelectObject(new_gc, (void*)mask);
+ BitBlt(fl_gc, X, Y, W, H, new_gc, cx, cy, SRCAND);
+ SelectObject(new_gc, (void*)id);
+ BitBlt(fl_gc, X, Y, W, H, new_gc, cx, cy, SRCPAINT);
+ RestoreDC(new_gc,save);
+ DeleteDC(new_gc);
+ } else {
+ fl_copy_offscreen(X, Y, W, H, (Fl_Offscreen)id, cx, cy);
+ }
+#elif defined(__APPLE_QUARTZ__)
+ fl_copy_offscreen(X, Y, W, H, (Fl_Offscreen)id, cx, cy);
+#else
+# error unsupported platform
#endif
}
+/**
+ The destructor free all memory and server resources that are used by
+ the pixmap.
+*/
Fl_Pixmap::~Fl_Pixmap() {
uncache();
delete_data();
@@ -491,5 +484,5 @@ void Fl_Pixmap::desaturate() {
}
//
-// End of "$Id: Fl_Pixmap.cxx 5190 2006-06-09 16:16:34Z mike $".
+// End of "$Id: Fl_Pixmap.cxx 6616 2009-01-01 21:28:26Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Positioner.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Positioner.cxx
index a688a9a09..11f954dd9 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Positioner.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Positioner.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Positioner.cxx 5347 2006-08-23 12:57:42Z matt $"
+// "$Id: Fl_Positioner.cxx 6616 2009-01-01 21:28:26Z matt $"
//
// Positioner widget for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,6 +25,7 @@
// http://www.fltk.org/str.php
//
+
// The positioner widget from Forms, gives 2D input
// Written by: Mark Overmars
@@ -56,6 +57,7 @@ void Fl_Positioner::draw() {
draw_label();
}
+/** Returns the current position in x and y.*/
int Fl_Positioner::value(double X, double Y) {
clear_changed();
if (X == xvalue_ && Y == yvalue_) return 0;
@@ -64,10 +66,12 @@ int Fl_Positioner::value(double X, double Y) {
return 1;
}
+/** Sets the X axis coordinate.*/
int Fl_Positioner::xvalue(double X) {
return(value(X, yvalue_));
}
+/** Sets the Y axis coordinate.*/
int Fl_Positioner::yvalue(double Y) {
return(value(xvalue_, Y));
}
@@ -120,6 +124,10 @@ int Fl_Positioner::handle(int e) {
return handle(e, x(), y(), w(), h());
}
+/**
+ Creates a new Fl_Positioner widget using the given position,
+ size, and label string. The default boxtype is FL_NO_BOX.
+*/
Fl_Positioner::Fl_Positioner(int X, int Y, int W, int H, const char* l)
: Fl_Widget(X, Y, W, H, l) {
box(FL_DOWN_BOX);
@@ -132,6 +140,7 @@ Fl_Positioner::Fl_Positioner(int X, int Y, int W, int H, const char* l)
xstep_ = ystep_ = 0;
}
+/** Sets the X axis bounds.*/
void Fl_Positioner::xbounds(double a, double b) {
if (a != xmin || b != xmax) {
xmin = a; xmax = b;
@@ -139,6 +148,7 @@ void Fl_Positioner::xbounds(double a, double b) {
}
}
+/** Sets the Y axis bounds.*/
void Fl_Positioner::ybounds(double a, double b) {
if (a != ymin || b != ymax) {
ymin = a; ymax = b;
@@ -147,5 +157,5 @@ void Fl_Positioner::ybounds(double a, double b) {
}
//
-// End of "$Id: Fl_Positioner.cxx 5347 2006-08-23 12:57:42Z matt $".
+// End of "$Id: Fl_Positioner.cxx 6616 2009-01-01 21:28:26Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Preferences.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Preferences.cxx
index 91c46cf27..e1ab87d3f 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Preferences.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Preferences.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Preferences.cxx 6015 2008-01-09 21:23:51Z matt $"
+// "$Id: Fl_Preferences.cxx 6716 2009-03-24 01:40:44Z fabien $"
//
// Preferences methods for the Fast Light Tool Kit (FLTK).
//
-// Copyright 2002-2005 by Matthias Melcher.
+// Copyright 2002-2009 by Matthias Melcher.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -33,6 +33,7 @@
#include
#include
#include
+#include
#include "flstring.h"
#include
@@ -50,20 +51,34 @@
# include
#endif
+#ifdef WIN32
+#include
+#endif // WIN32
char Fl_Preferences::nameBuffer[128];
/**
- * create the initial preferences base
- * - root: machine or user preferences
- * - vendor: unique identification of author or vendor of application
- * Must be a valid directory name.
- * - application: vendor unique application name, i.e. "PreferencesTest"
- * multiple preferences files can be created per application.
- * Must be a valid file name.
- * example: Fl_Preferences base( Fl_Preferences::USER, "fltk.org", "test01");
- */
+ The constructor creates a group that manages name/value pairs and
+ child groups. Groups are ready for reading and writing at any time.
+ The root argument is either Fl_Preferences::USER
+ or Fl_Preferences::SYSTEM.
+
+ This constructor creates the base instance for all
+ following entries and reads existing databases into memory. The
+ vendor argument is a unique text string identifying the
+ development team or vendor of an application. A domain name or
+ an EMail address are great unique names, e.g.
+ "researchATmatthiasm.com" or "fltk.org". The
+ application argument can be the working title or final
+ name of your application. Both vendor and
+ application must be valid relative UNIX pathnames and
+ may contain '/'s to create deeper file structures.
+
+ \param[in] root can be \c USER or \c SYSTEM for user specific or system wide preferences
+ \param[in] vendor unique text describing the company or author of this file
+ \param[in] application unique text describing the application
+*/
Fl_Preferences::Fl_Preferences( Root root, const char *vendor, const char *application )
{
node = new Node( "." );
@@ -72,9 +87,16 @@ Fl_Preferences::Fl_Preferences( Root root, const char *vendor, const char *appli
/**
- * create the initial preferences base
- * - path: an application-supplied path
- * example: Fl_Preferences base( "/usr/foo" );
+ \brief Use this constructor to create or read a preferences file at an
+ arbitrary position in the file system.
+
+ The file name is generated in the form
+ path/application.prefs. If \p application
+ is \c NULL, \p path must contain the full file name.
+
+ \param[in] path path to the directory that contains the preferences file
+ \param[in] vendor unique text describing the company or author of this file
+ \param[in] application unique text describing the application
*/
Fl_Preferences::Fl_Preferences( const char *path, const char *vendor, const char *application )
{
@@ -84,41 +106,46 @@ Fl_Preferences::Fl_Preferences( const char *path, const char *vendor, const char
/**
- * create a Preferences node in relation to a parent node for reading and writing
- * - parent: base name for group
- * - group: group name (can contain '/' seperated group names)
- * example: Fl_Preferences colors( base, "setup/colors" );
+ \brief Generate or read a new group of entries within another group.
+
+ Use the \p group argument to name the group that you would like to access.
+ \p Group can also contain a path to a group further down the hierarchy by
+ separating group names with a forward slash '/'.
+
+ \param[in] parent reference object for the new group
+ \param[in] group name of the group to access (may contain '/'s)
*/
-Fl_Preferences::Fl_Preferences( Fl_Preferences &parent, const char *key )
+Fl_Preferences::Fl_Preferences( Fl_Preferences &parent, const char *group )
{
rootNode = parent.rootNode;
- node = parent.node->addChild( key );
+ node = parent.node->addChild( group );
}
/**
- * create a Preferences node in relation to a parent node for reading and writing
- * - parent: base name for group
- * - group: group name (can contain '/' seperated group names)
- * example: Fl_Preferences colors( base, "setup/colors" );
+ \see Fl_Preferences( Fl_Preferences&, const char *group )
*/
-Fl_Preferences::Fl_Preferences( Fl_Preferences *parent, const char *key )
+Fl_Preferences::Fl_Preferences( Fl_Preferences *parent, const char *group )
{
rootNode = parent->rootNode;
- node = parent->node->addChild( key );
+ node = parent->node->addChild( group );
}
/**
- * destroy individual keys
- * - destroying the base preferences will flush changes to the prefs file
- * - after destroying the base, none of the depending preferences must be read or written
+ The destructor removes allocated resources. When used on the
+ \em base preferences group, the destructor flushes all
+ changes to the preferences file and deletes all internal
+ databases.
+
+ The destructor does not remove any data from the database. It merely
+ deletes your reference to the database.
*/
Fl_Preferences::~Fl_Preferences()
{
if (node && !node->parent()) delete rootNode;
// DO NOT delete nodes! The root node will do that after writing the preferences
- // zero all pointer to avoid memory errors, event though
+ // zero all pointer to avoid memory errors, even though
// Valgrind does not complain (Cygwind does though)
node = 0L;
rootNode = 0L;
@@ -126,8 +153,9 @@ Fl_Preferences::~Fl_Preferences()
/**
- * return the number of groups that are contained within a group
- * example: int n = base.groups();
+ Returns the number of groups that are contained within a group.
+
+ \return 0 for no groups at all
*/
int Fl_Preferences::groups()
{
@@ -136,20 +164,27 @@ int Fl_Preferences::groups()
/**
- * return the group name of the n'th group
- * - there is no guaranteed order of group names
- * - the index must be within the range given by groups()
- * example: printf( "Group(%d)='%s'\n", ix, base.group(ix) );
+ Returns the name of the Nth (\p num_group) group.
+ There is no guaranteed order of group names. The index must
+ be within the range given by groups().
+
+ \param[in] num_group number indexing the requested group
+ \return 'C' string pointer to the group name
*/
-const char *Fl_Preferences::group( int ix )
+const char *Fl_Preferences::group( int num_group )
{
- return node->child( ix );
+ return node->child( num_group );
}
/**
- * return 1, if a group with this name exists
- * example: if ( base.groupExists( "setup/colors" ) ) ...
+ Returns non-zero if a group with this name exists.
+ Group names are relative to the Preferences node and can contain a path.
+ "." describes the current node, "./" describes the topmost node.
+ By preceding a groupname with a "./", its path becomes relative to the topmost node.
+
+ \param[in] key name of group that is searched for
+ \return 0 if no group by that name was found
*/
char Fl_Preferences::groupExists( const char *key )
{
@@ -158,20 +193,26 @@ char Fl_Preferences::groupExists( const char *key )
/**
- * delete a group
- * example: setup.deleteGroup( "colors/buttons" );
+ Deletes a group.
+
+ Removes a group and all keys and groups within that group
+ from the database.
+
+ \param[in] group name of the group to delete
+ \return 0 if call failed
*/
-char Fl_Preferences::deleteGroup( const char *key )
+char Fl_Preferences::deleteGroup( const char *group )
{
- Node *nd = node->search( key );
+ Node *nd = node->search( group );
if ( nd ) return nd->remove();
return 0;
}
/**
- * return the number of entries (name/value) pairs for a group
- * example: int n = buttonColor.entries();
+ Returns the number of entries (name/value pairs) in a group.
+
+ \return number of entries
*/
int Fl_Preferences::entries()
{
@@ -180,20 +221,24 @@ int Fl_Preferences::entries()
/**
- * return the name of an entry
- * - there is no guaranteed order of entry names
- * - the index must be within the range given by entries()
- * example: printf( "Entry(%d)='%s'\n", ix, buttonColor.entry(ix) );
+ Returns the name of an entry. There is no guaranteed order of
+ entry names. The index must be within the range given by
+ entries().
+
+ \param[in] index number indexing the requested entry
+ \return pointer to value cstring
*/
-const char *Fl_Preferences::entry( int ix )
+const char *Fl_Preferences::entry( int index )
{
- return node->entry[ix].name;
+ return node->entry[index].name;
}
/**
- * return 1, if an entry with this name exists
- * example: if ( buttonColor.entryExists( "red" ) ) ...
+ Returns non-zero if an entry with this name exists.
+
+ \param[in] key name of entry that is searched for
+ \return 0 if entry was not found
*/
char Fl_Preferences::entryExists( const char *key )
{
@@ -202,8 +247,12 @@ char Fl_Preferences::entryExists( const char *key )
/**
- * remove a single entry (name/value pair)
- * example: buttonColor.deleteEntry( "red" );
+ Deletes a single name/value pair.
+
+ This function removes the entry \p key from the database.
+
+ \param[in] key name of entry to delete
+ \return 0 if deleting the entry failed
*/
char Fl_Preferences::deleteEntry( const char *key )
{
@@ -212,7 +261,14 @@ char Fl_Preferences::deleteEntry( const char *key )
/**
- * read an entry from the group
+ Reads an entry from the group. A default value must be
+ supplied. The return value indicates if the value was available
+ (non-zero) or the default was used (0).
+
+ \param[in] key name of entry
+ \param[out] value returned from preferences or default value if none was set
+ \param[in] defaultValue default value to be used if no preference was set
+ \return 0 if the default value was used
*/
char Fl_Preferences::get( const char *key, int &value, int defaultValue )
{
@@ -222,8 +278,15 @@ char Fl_Preferences::get( const char *key, int &value, int defaultValue )
}
-/**
- * set an entry (name/value pair)
+/**
+ Sets an entry (name/value pair). The return value indicates if there
+ was a problem storing the data in memory. However it does not
+ reflect if the value was actually stored in the preferences
+ file.
+
+ \param[in] key name of entry
+ \param[in] value set this entry to \p value
+ \return 0 if setting the value failed
*/
char Fl_Preferences::set( const char *key, int value )
{
@@ -234,7 +297,14 @@ char Fl_Preferences::set( const char *key, int value )
/**
- * read an entry from the group
+ Reads an entry from the group. A default value must be
+ supplied. The return value indicates if the value was available
+ (non-zero) or the default was used (0).
+
+ \param[in] key name of entry
+ \param[out] value returned from preferences or default value if none was set
+ \param[in] defaultValue default value to be used if no preference was set
+ \return 0 if the default value was used
*/
char Fl_Preferences::get( const char *key, float &value, float defaultValue )
{
@@ -244,8 +314,15 @@ char Fl_Preferences::get( const char *key, float &value, float defaultValue )
}
-/**
- * set an entry (name/value pair)
+/**
+ Sets an entry (name/value pair). The return value indicates if there
+ was a problem storing the data in memory. However it does not
+ reflect if the value was actually stored in the preferences
+ file.
+
+ \param[in] key name of entry
+ \param[in] value set this entry to \p value
+ \return 0 if setting the value failed
*/
char Fl_Preferences::set( const char *key, float value )
{
@@ -255,8 +332,16 @@ char Fl_Preferences::set( const char *key, float value )
}
-/**
- * set an entry (name/value pair)
+/**
+ Sets an entry (name/value pair). The return value indicates if there
+ was a problem storing the data in memory. However it does not
+ reflect if the value was actually stored in the preferences
+ file.
+
+ \param[in] key name of entry
+ \param[in] value set this entry to \p value
+ \param[in] precision number of decimal digits to represent value
+ \return 0 if setting the value failed
*/
char Fl_Preferences::set( const char *key, float value, int precision )
{
@@ -267,7 +352,14 @@ char Fl_Preferences::set( const char *key, float value, int precision )
/**
- * read an entry from the group
+ Reads an entry from the group. A default value must be
+ supplied. The return value indicates if the value was available
+ (non-zero) or the default was used (0).
+
+ \param[in] key name of entry
+ \param[out] value returned from preferences or default value if none was set
+ \param[in] defaultValue default value to be used if no preference was set
+ \return 0 if the default value was used
*/
char Fl_Preferences::get( const char *key, double &value, double defaultValue )
{
@@ -277,8 +369,15 @@ char Fl_Preferences::get( const char *key, double &value, double defaultValue )
}
-/**
- * set an entry (name/value pair)
+/**
+ Sets an entry (name/value pair). The return value indicates if there
+ was a problem storing the data in memory. However it does not
+ reflect if the value was actually stored in the preferences
+ file.
+
+ \param[in] key name of entry
+ \param[in] value set this entry to \p value
+ \return 0 if setting the value failed
*/
char Fl_Preferences::set( const char *key, double value )
{
@@ -288,8 +387,16 @@ char Fl_Preferences::set( const char *key, double value )
}
-/**
- * set an entry (name/value pair)
+/**
+ Sets an entry (name/value pair). The return value indicates if there
+ was a problem storing the data in memory. However it does not
+ reflect if the value was actually stored in the preferences
+ file.
+
+ \param[in] key name of entry
+ \param[in] value set this entry to \p value
+ \param[in] precision number of decimal digits to represent value
+ \return 0 if setting the value failed
*/
char Fl_Preferences::set( const char *key, double value, int precision )
{
@@ -330,9 +437,17 @@ static char *decodeText( const char *src )
/**
- * read a text entry from the group
- * the text will be moved into the given text buffer
- * text will be clipped to the buffer size
+ Reads an entry from the group. A default value must be
+ supplied. The return value indicates if the value was available
+ (non-zero) or the default was used (0).
+ 'maxSize' is the maximum length of text that will be read.
+ The text buffer must allow for one additional byte for a trailling zero.
+
+ \param[in] key name of entry
+ \param[out] text returned from preferences or default value if none was set
+ \param[in] defaultValue default value to be used if no preference was set
+ \param[in] maxSize maximum length of value plus one byte for a trailing zero
+ \return 0 if the default value was used
*/
char Fl_Preferences::get( const char *key, char *text, const char *defaultValue, int maxSize )
{
@@ -351,9 +466,16 @@ char Fl_Preferences::get( const char *key, char *text, const char *defaultValue,
/**
- * read a text entry from the group
- * 'text' will be changed to point to a new text buffer
- * the text buffer must be deleted with 'free(text)' by the user.
+ Reads an entry from the group. A default value must be
+ supplied. The return value indicates if the value was available
+ (non-zero) or the default was used (0). get() allocates memory of
+ sufficient size to hold the value. The buffer must be free'd by
+ the developer using 'free(value)'.
+
+ \param[in] key name of entry
+ \param[out] text returned from preferences or default value if none was set
+ \param[in] defaultValue default value to be used if no preference was set
+ \return 0 if the default value was used
*/
char Fl_Preferences::get( const char *key, char *&text, const char *defaultValue )
{
@@ -372,8 +494,16 @@ char Fl_Preferences::get( const char *key, char *&text, const char *defaultValue
}
-/**
- * set an entry (name/value pair)
+
+/**
+ Sets an entry (name/value pair). The return value indicates if there
+ was a problem storing the data in memory. However it does not
+ reflect if the value was actually stored in the preferences
+ file.
+
+ \param[in] key name of entry
+ \param[in] text set this entry to \p value
+ \return 0 if setting the value failed
*/
char Fl_Preferences::set( const char *key, const char *text )
{
@@ -427,9 +557,19 @@ static void *decodeHex( const char *src, int &size )
/**
- * read a binary entry from the group
- * the data will be moved into the given destination buffer
- * data will be clipped to the buffer size
+ Reads an entry from the group. A default value must be
+ supplied. The return value indicates if the value was available
+ (non-zero) or the default was used (0).
+ 'maxSize' is the maximum length of text that will be read.
+
+ \param[in] key name of entry
+ \param[out] data value returned from preferences or default value if none was set
+ \param[in] defaultValue default value to be used if no preference was set
+ \param[in] defaultSize size of default value array
+ \param[in] maxSize maximum length of value
+ \return 0 if the default value was used
+
+ \todo maxSize should receive the number of bytes that were read.
*/
char Fl_Preferences::get( const char *key, void *data, const void *defaultValue, int defaultSize, int maxSize )
{
@@ -449,9 +589,17 @@ char Fl_Preferences::get( const char *key, void *data, const void *defaultValue,
/**
- * read a binary entry from the group
- * 'data' will be changed to point to a new data buffer
- * the data buffer must be deleted with 'free(data)' by the user.
+ Reads an entry from the group. A default value must be
+ supplied. The return value indicates if the value was available
+ (non-zero) or the default was used (0). get() allocates memory of
+ sufficient size to hold the value. The buffer must be free'd by
+ the developer using 'free(value)'.
+
+ \param[in] key name of entry
+ \param[out] data returned from preferences or default value if none was set
+ \param[in] defaultValue default value to be used if no preference was set
+ \param[in] defaultSize size of default value array
+ \return 0 if the default value was used
*/
char Fl_Preferences::get( const char *key, void *&data, const void *defaultValue, int defaultSize )
{
@@ -473,8 +621,16 @@ char Fl_Preferences::get( const char *key, void *&data, const void *defaultValue
}
-/**
- * set an entry (name/value pair)
+/**
+ Sets an entry (name/value pair). The return value indicates if there
+ was a problem storing the data in memory. However it does not
+ reflect if the value was actually stored in the preferences
+ file.
+
+ \param[in] key name of entry
+ \param[in] data set this entry to \p value
+ \param[in] dsize size of data array
+ \return 0 if setting the value failed
*/
char Fl_Preferences::set( const char *key, const void *data, int dsize )
{
@@ -495,7 +651,10 @@ char Fl_Preferences::set( const char *key, const void *data, int dsize )
/**
- * return the size of the value part of an entry
+ Returns the size of the value part of an entry.
+
+ \param[in] key name of entry
+ \return size of value
*/
int Fl_Preferences::size( const char *key )
{
@@ -503,19 +662,33 @@ int Fl_Preferences::size( const char *key )
return v ? strlen( v ) : 0 ;
}
+
/**
- * creates a path that is related to the preferences file
- * and that is usable for application data beyond what is covered
- * by Fl_Preferences.
- * - 'getUserdataPath' actually creates the directory
- * - 'path' must be large enough to receive a complete file path
- * example:
- * Fl_Preferences prefs( USER, "matthiasm.com", "test" );
- * char path[FL_PATH_MAX];
- * prefs.getUserdataPath( path );
- * sample returns:
- * Win32: c:/Documents and Settings/matt/Application Data/matthiasm.com/test/
- * prefs: c:/Documents and Settings/matt/Application Data/matthiasm.com/test.prefs
+ \brief Creates a path that is related to the preferences file and
+ that is usable for additional application data.
+
+ This function creates a directory that is named after the preferences
+ database without the \c .prefs extension and located in the same directory.
+ It then fills the given buffer with the complete path name.
+
+ Exmaple:
+ \code
+ Fl_Preferences prefs( USER, "matthiasm.com", "test" );
+ char path[FL_PATH_MAX];
+ prefs.getUserdataPath( path );
+ \endcode
+ creates the preferences database in (MS Windows):
+ \code
+ c:/Documents and Settings/matt/Application Data/matthiasm.com/test.prefs
+ \endcode
+ and returns the userdata path:
+ \code
+ c:/Documents and Settings/matt/Application Data/matthiasm.com/test/
+ \endcode
+
+ \param[out] path buffer for user data path
+ \param[in] pathlen size of path buffer (should be at least \c FL_PATH_MAX)
+ \return 0 if path was not created or pathname can't fit into buffer
*/
char Fl_Preferences::getUserdataPath( char *path, int pathlen )
{
@@ -525,9 +698,9 @@ char Fl_Preferences::getUserdataPath( char *path, int pathlen )
}
/**
- * write all preferences to disk
- * - this function works only with the base preference group
- * - this function is rarely used as deleting the base preferences flushes automatically
+ Writes all preferences to disk. This function works only with
+ the base preferences group. This function is rarely used as
+ deleting the base preferences flushes automatically.
*/
void Fl_Preferences::flush()
{
@@ -540,14 +713,17 @@ void Fl_Preferences::flush()
//
/**
- * create a group name or entry name on the fly
- * - this version creates a simple unsigned integer as an entry name
- * example:
- * int n, i;
- * Fl_Preferences prev( appPrefs, "PreviousFiles" );
- * prev.get( "n", 0 );
- * for ( i=0; i 0 && path[ len ] == 0 )
+ if ( len > 0 && path[ len ] == 0 )
return this;
if ( len <= 0 || path[ len ] == '/' )
{
@@ -1178,5 +1379,5 @@ char Fl_Preferences::Node::remove()
//
-// End of "$Id: Fl_Preferences.cxx 6015 2008-01-09 21:23:51Z matt $".
+// End of "$Id: Fl_Preferences.cxx 6716 2009-03-24 01:40:44Z fabien $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Progress.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Progress.cxx
index 1d26b0c9a..bb00d60d2 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Progress.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Progress.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Progress.cxx 5540 2006-11-12 20:44:12Z matt $"
+// "$Id: Fl_Progress.cxx 6616 2009-01-01 21:28:26Z matt $"
//
// Progress bar widget routines.
//
-// Copyright 2000-2005 by Michael Sweet.
+// Copyright 2000-2009 by Michael Sweet.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,6 +25,7 @@
// http://www.fltk.org/str.php
//
// Contents:
+
//
// Fl_Progress::draw() - Draw the check button.
// Fl_Progress::Fl_Progress() - Construct a Fl_Progress widget.
@@ -49,6 +50,7 @@
// 'Fl_Progress::draw()' - Draw the check button.
//
+/** Draws the progress bar. */
void Fl_Progress::draw()
{
int progress; // Size of progress bar...
@@ -76,7 +78,7 @@ void Fl_Progress::draw()
Fl_Color c = labelcolor();
labelcolor(fl_contrast(labelcolor(), color2()));
- fl_clip(x(), y(), progress + bx, h());
+ fl_push_clip(x(), y(), progress + bx, h());
draw_box(box(), x(), y(), w(), h(), active_r() ? color2() : fl_inactive(color2()));
draw_label(tx, y() + by, tw, h() - bh);
fl_pop_clip();
@@ -84,7 +86,7 @@ void Fl_Progress::draw()
labelcolor(c);
if (progress The inherited destructor removes the progress bar.
+*/
Fl_Progress::Fl_Progress(int X, int Y, int W, int H, const char* l)
-: Fl_Widget(X, Y, W, H, l)
-{
+: Fl_Widget(X, Y, W, H, l) {
align(FL_ALIGN_INSIDE);
box(FL_DOWN_BOX);
color(FL_BACKGROUND2_COLOR, FL_YELLOW);
@@ -113,5 +115,5 @@ Fl_Progress::Fl_Progress(int X, int Y, int W, int H, const char* l)
//
-// End of "$Id: Fl_Progress.cxx 5540 2006-11-12 20:44:12Z matt $".
+// End of "$Id: Fl_Progress.cxx 6616 2009-01-01 21:28:26Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Repeat_Button.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Repeat_Button.cxx
index 73f1cc26f..cff903a8f 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Repeat_Button.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Repeat_Button.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Repeat_Button.cxx 5219 2006-06-21 06:52:10Z matt $"
+// "$Id: Fl_Repeat_Button.cxx 6616 2009-01-01 21:28:26Z matt $"
//
// Repeat button widget for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -66,5 +66,5 @@ int Fl_Repeat_Button::handle(int event) {
}
//
-// End of "$Id: Fl_Repeat_Button.cxx 5219 2006-06-21 06:52:10Z matt $".
+// End of "$Id: Fl_Repeat_Button.cxx 6616 2009-01-01 21:28:26Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Return_Button.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Return_Button.cxx
index 360a91a6b..3ab21cbe7 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Return_Button.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Return_Button.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Return_Button.cxx 5190 2006-06-09 16:16:34Z mike $"
+// "$Id: Fl_Return_Button.cxx 6616 2009-01-01 21:28:26Z matt $"
//
// Return button widget for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -68,5 +68,5 @@ int Fl_Return_Button::handle(int event) {
}
//
-// End of "$Id: Fl_Return_Button.cxx 5190 2006-06-09 16:16:34Z mike $".
+// End of "$Id: Fl_Return_Button.cxx 6616 2009-01-01 21:28:26Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Roller.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Roller.cxx
index c00f3b9f2..7efc3472d 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Roller.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Roller.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Roller.cxx 5190 2006-06-09 16:16:34Z mike $"
+// "$Id: Fl_Roller.cxx 6616 2009-01-01 21:28:26Z matt $"
//
// Roller widget for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -169,6 +169,11 @@ void Fl_Roller::draw() {
if (Fl::focus() == this) draw_focus(FL_THIN_UP_FRAME, x(), y(), w(), h());
}
+/**
+ Creates a new Fl_Roller widget using the given position,
+ size, and label string. The default boxtype is FL_NO_BOX.
+ Inherited destructor destroys the valuator.
+*/
Fl_Roller::Fl_Roller(int X,int Y,int W,int H,const char* L)
: Fl_Valuator(X,Y,W,H,L) {
box(FL_UP_BOX);
@@ -176,5 +181,5 @@ Fl_Roller::Fl_Roller(int X,int Y,int W,int H,const char* L)
}
//
-// End of "$Id: Fl_Roller.cxx 5190 2006-06-09 16:16:34Z mike $".
+// End of "$Id: Fl_Roller.cxx 6616 2009-01-01 21:28:26Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Round_Button.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Round_Button.cxx
index fe8ffa28e..7ca8e40d4 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Round_Button.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Round_Button.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Round_Button.cxx 5190 2006-06-09 16:16:34Z mike $"
+// "$Id: Fl_Round_Button.cxx 6616 2009-01-01 21:28:26Z matt $"
//
// Round button for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -27,11 +27,15 @@
// A subclass of Fl_Button that always draws as a round circle. This
// circle is smaller than the widget size and can be surrounded by
-// another box type, for compatability with Forms.
+// another box type, for compatibility with Forms.
#include
#include
+/**
+ Creates a new Fl_Round_Button widget using the given
+ position, size, and label string.
+*/
Fl_Round_Button::Fl_Round_Button(int X,int Y,int W,int H, const char *l)
: Fl_Light_Button(X,Y,W,H,l) {
box(FL_NO_BOX);
@@ -40,5 +44,5 @@ Fl_Round_Button::Fl_Round_Button(int X,int Y,int W,int H, const char *l)
}
//
-// End of "$Id: Fl_Round_Button.cxx 5190 2006-06-09 16:16:34Z mike $".
+// End of "$Id: Fl_Round_Button.cxx 6616 2009-01-01 21:28:26Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Scroll.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Scroll.cxx
index ba3571c70..c3bc9b744 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Scroll.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Scroll.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Scroll.cxx 5547 2006-11-16 23:17:13Z mike $"
+// "$Id: Fl_Scroll.cxx 6654 2009-02-08 18:47:37Z AlbrechtS $"
//
// Scroll widget for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2006 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -30,7 +30,7 @@
#include
#include
-// Clear all but the scrollbars...
+/** Clear all but the scrollbars... */
void Fl_Scroll::clear() {
for (int i=children() - 1; i >= 0; i --) {
Fl_Widget* o = child(i);
@@ -41,7 +41,7 @@ void Fl_Scroll::clear() {
}
}
-// Insure the scrollbars are the last children:
+/** Insure the scrollbars are the last children */
void Fl_Scroll::fix_scrollbar_order() {
Fl_Widget** a = (Fl_Widget**)array();
if (a[children()-1] != &scrollbar) {
@@ -53,7 +53,7 @@ void Fl_Scroll::fix_scrollbar_order() {
}
void Fl_Scroll::draw_clip(void* v,int X, int Y, int W, int H) {
- fl_clip(X,Y,W,H);
+ fl_push_clip(X,Y,W,H);
Fl_Scroll* s = (Fl_Scroll*)v;
// erase background as needed...
switch (s->box()) {
@@ -92,6 +92,16 @@ void Fl_Scroll::draw_clip(void* v,int X, int Y, int W, int H) {
fl_pop_clip();
}
+/**
+ Returns the bounding box for the interior of the scrolling area, inside
+ the scrollbars.
+
+ Currently this is only reliable after draw(), and before any resizing of
+ the Fl_Scroll or any child widgets occur.
+
+ \todo The visibility of the scrollbars ought to be checked/calculated
+ outside of the draw() method (STR #1895).
+*/
void Fl_Scroll::bbox(int& X, int& Y, int& W, int& H) {
X = x()+Fl::box_dx(box());
Y = y()+Fl::box_dy(box());
@@ -140,7 +150,7 @@ void Fl_Scroll::draw() {
if (B < (Y + H)) draw_clip(this, X, B, W, Y + H - B);
}
if (d & FL_DAMAGE_CHILD) { // draw damaged children
- fl_clip(X, Y, W, H);
+ fl_push_clip(X, Y, W, H);
Fl_Widget*const* a = array();
for (int i=children()-2; i--;) update_child(**a++);
fl_pop_clip();
@@ -237,17 +247,30 @@ void Fl_Scroll::draw() {
}
void Fl_Scroll::resize(int X, int Y, int W, int H) {
+ int dx = X-x(), dy = Y-y();
+ int dw = W-w(), dh = H-h();
+ Fl_Widget::resize(X,Y,W,H); // resize _before_ moving children around
fix_scrollbar_order();
// move all the children:
Fl_Widget*const* a = array();
for (int i=children()-2; i--;) {
Fl_Object* o = *a++;
- o->position(o->x()+X-x(), o->y()+Y-y());
+ o->position(o->x()+dx, o->y()+dy);
+ }
+ if (dw==0 && dh==0) {
+ char pad = (scrollbar.visible() && hscrollbar.visible());
+ char al = (scrollbar.align()&FL_ALIGN_LEFT!=0);
+ char at = (scrollbar.align()&FL_ALIGN_TOP!=0);
+ scrollbar.position(al?X:X+W-scrollbar.w(), (at&&pad)?Y+hscrollbar.h():Y);
+ hscrollbar.position((al&&pad)?X+scrollbar.w():X, at?Y:Y+H-hscrollbar.h());
+ } else {
+ // FIXME recalculation of scrollbars needs to be moved out fo "draw()" (STR #1895)
+ redraw(); // need full recalculation of scrollbars
}
- Fl_Widget::resize(X,Y,W,H);
}
-void Fl_Scroll::position(int X, int Y) {
+/** Moves the contents of the scroll group to a new position.*/
+void Fl_Scroll::scroll_to(int X, int Y) {
int dx = xposition_-X;
int dy = yposition_-Y;
if (!dx && !dy) return;
@@ -265,14 +288,23 @@ void Fl_Scroll::position(int X, int Y) {
void Fl_Scroll::hscrollbar_cb(Fl_Widget* o, void*) {
Fl_Scroll* s = (Fl_Scroll*)(o->parent());
- s->position(int(((Fl_Scrollbar*)o)->value()), s->yposition());
+ s->scroll_to(int(((Fl_Scrollbar*)o)->value()), s->yposition());
}
void Fl_Scroll::scrollbar_cb(Fl_Widget* o, void*) {
Fl_Scroll* s = (Fl_Scroll*)(o->parent());
- s->position(s->xposition(), int(((Fl_Scrollbar*)o)->value()));
+ s->scroll_to(s->xposition(), int(((Fl_Scrollbar*)o)->value()));
}
-
+/**
+ Creates a new Fl_Scroll widget using the given position,
+ size, and label string. The default boxtype is FL_NO_BOX.
+ The destructor also deletes all the children. This allows a
+ whole tree to be deleted at once, without having to keep a pointer to
+ all the children in the user code. A kludge has been done so the
+ Fl_Scroll and all of it's children can be automatic (local)
+ variables, but you must declare the Fl_Scrollfirst, so
+ that it is destroyed last.
+*/
Fl_Scroll::Fl_Scroll(int X,int Y,int W,int H,const char* L)
: Fl_Group(X,Y,W,H,L),
scrollbar(X+W-Fl::scrollbar_size(),Y,
@@ -293,5 +325,5 @@ int Fl_Scroll::handle(int event) {
}
//
-// End of "$Id: Fl_Scroll.cxx 5547 2006-11-16 23:17:13Z mike $".
+// End of "$Id: Fl_Scroll.cxx 6654 2009-02-08 18:47:37Z AlbrechtS $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Scrollbar.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Scrollbar.cxx
index 58d88d356..6b6cd2260 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Scrollbar.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Scrollbar.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Scrollbar.cxx 6042 2008-02-25 13:00:53Z matt $"
+// "$Id: Fl_Scrollbar.cxx 6683 2009-03-14 11:46:43Z engelsman $"
//
// Scroll bar widget for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2006 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,6 +25,7 @@
// http://www.fltk.org/str.php
//
+
#include
#include
#include
@@ -254,9 +255,12 @@ void Fl_Scrollbar::draw() {
}
}
+/**
+ Creates a new Fl_Scrollbar widget with given position, size, and label.
+ You need to do type(FL_HORIZONTAL) if you want a horizontal scrollbar.
+*/
Fl_Scrollbar::Fl_Scrollbar(int X, int Y, int W, int H, const char* L)
- : Fl_Slider(X, Y, W, H, L)
-{
+ : Fl_Slider(X, Y, W, H, L) {
box(FL_FLAT_BOX);
color(FL_DARK2);
slider(FL_UP_BOX);
@@ -265,13 +269,13 @@ Fl_Scrollbar::Fl_Scrollbar(int X, int Y, int W, int H, const char* L)
step(1);
}
-Fl_Scrollbar::~Fl_Scrollbar()
-{
+/** Destroys the Scrollbar. */
+Fl_Scrollbar::~Fl_Scrollbar() {
if (pushed_)
Fl::remove_timeout(timeout_cb, this);
}
//
-// End of "$Id: Fl_Scrollbar.cxx 6042 2008-02-25 13:00:53Z matt $".
+// End of "$Id: Fl_Scrollbar.cxx 6683 2009-03-14 11:46:43Z engelsman $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Shared_Image.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Shared_Image.cxx
index 3d29dc537..b32c572f1 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Shared_Image.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Shared_Image.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Shared_Image.cxx 5190 2006-06-09 16:16:34Z mike $"
+// "$Id: Fl_Shared_Image.cxx 6616 2009-01-01 21:28:26Z matt $"
//
// Shared image code for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -27,6 +27,7 @@
#include
#include
+#include
#include "flstring.h"
#include
@@ -57,12 +58,11 @@ extern "C" {
}
-// Static methods that really should be inline, but some WIN32 compilers
-// can't handle it...
+/** Returns the Fl_Shared_Image* array */
Fl_Shared_Image **Fl_Shared_Image::images() {
return images_;
}
-
+/** Returns the total number of shared images in the array. */
int Fl_Shared_Image::num_images() {
return num_images_;
}
@@ -85,10 +85,13 @@ Fl_Shared_Image::compare(Fl_Shared_Image **i0, // I - First image
}
-//
-// 'Fl_Shared_Image::Fl_Shared_Image()' - Basic constructor.
-//
-
+/**
+ Creates an empty shared image.
+ The constructors create a new shared image record in the image cache.
+
+ The constructors are protected and cannot be used directly
+ from a program. Use the get() method instead.
+*/
Fl_Shared_Image::Fl_Shared_Image() : Fl_Image(0,0,0) {
name_ = 0;
refcount_ = 1;
@@ -98,10 +101,13 @@ Fl_Shared_Image::Fl_Shared_Image() : Fl_Image(0,0,0) {
}
-//
-// 'Fl_Shared_Image::Fl_Shared_Image()' - Add an image to the image cache.
-//
-
+/**
+ Creates a shared image from its filename and its corresponding Fl_Image* img.
+ The constructors create a new shared image record in the image cache.
+
+
The constructors are protected and cannot be used directly
+ from a program. Use the get() method instead.
+*/
Fl_Shared_Image::Fl_Shared_Image(const char *n, // I - Filename
Fl_Image *img) // I - Image
: Fl_Image(0,0,0) {
@@ -164,11 +170,12 @@ Fl_Shared_Image::update() {
}
}
-
-//
-// 'Fl_Shared_Image::~Fl_Shared_Image()' - Destroy a shared image...
-//
-
+/**
+ The destructor free all memory and server resources that are
+ used by the image. The destructor is protected and cannot be
+ used directly from a program. Use the Fl_Shared_Image::release() method
+ instead.
+*/
Fl_Shared_Image::~Fl_Shared_Image() {
if (name_) delete[] (char *)name_;
if (alloc_image_) delete image_;
@@ -176,11 +183,11 @@ Fl_Shared_Image::~Fl_Shared_Image() {
//
-// 'Fl_Shared_Image::release()' - Release and possibly destroy a shared image.
-//
-
-void
-Fl_Shared_Image::release() {
+/**
+ Releases and possibly destroys (if refcount <=0) a shared image.
+ In the latter case, it will reorganize the shared image array so that no hole will occur.
+*/
+void Fl_Shared_Image::release() {
int i; // Looping var...
refcount_ --;
@@ -210,11 +217,8 @@ Fl_Shared_Image::release() {
//
-// 'Fl_Shared_Image::reload()' - Reload the shared image...
-//
-
-void
-Fl_Shared_Image::reload() {
+/** Reloads the shared image from disk */
+void Fl_Shared_Image::reload() {
// Load image from disk...
int i; // Looping var
FILE *fp; // File pointer
@@ -223,7 +227,7 @@ Fl_Shared_Image::reload() {
if (!name_) return;
- if ((fp = fopen(name_, "rb")) != NULL) {
+ if ((fp = fl_fopen(name_, "rb")) != NULL) {
fread(header, 1, sizeof(header), fp);
fclose(fp);
} else {
@@ -334,19 +338,15 @@ Fl_Shared_Image::draw(int X, int Y, int W, int H, int cx, int cy) {
// 'Fl_Shared_Image::uncache()' - Uncache the shared image...
//
-void
-Fl_Shared_Image::uncache()
+void Fl_Shared_Image::uncache()
{
if (image_) image_->uncache();
}
-//
-// 'Fl_Shared_Image::find()' - Find a shared image...
-//
-Fl_Shared_Image *
-Fl_Shared_Image::find(const char *n, int W, int H) {
+/** Finds a shared image from its named and size specifications */
+Fl_Shared_Image* Fl_Shared_Image::find(const char *n, int W, int H) {
Fl_Shared_Image *key, // Image key
**match; // Matching image
@@ -373,12 +373,14 @@ Fl_Shared_Image::find(const char *n, int W, int H) {
}
-//
-// 'Fl_Shared_Image::get()' - Get a shared image...
-//
-
-Fl_Shared_Image *
-Fl_Shared_Image::get(const char *n, int W, int H) {
+/**
+ Gets a shared image, if it exists already ; it will return it.
+ If it does not exist or if it exist but with other size,
+ then the existing image is deleted and replaced
+ by a new image from the n filename of the proper dimension.
+ If n is not a valid image filename, then get() will return NULL.
+*/
+Fl_Shared_Image* Fl_Shared_Image::get(const char *n, int W, int H) {
Fl_Shared_Image *temp; // Image
if ((temp = find(n, W, H)) != NULL) return temp;
@@ -403,12 +405,9 @@ Fl_Shared_Image::get(const char *n, int W, int H) {
}
-//
-// 'Fl_Shared_Image::add_handler()' - Add a shared image handler.
-//
-void
-Fl_Shared_Image::add_handler(Fl_Shared_Handler f) {
+/** Adds a shared image handler, which is basically a test function for adding new formats */
+void Fl_Shared_Image::add_handler(Fl_Shared_Handler f) {
int i; // Looping var...
Fl_Shared_Handler *temp; // New image handler array...
@@ -436,12 +435,9 @@ Fl_Shared_Image::add_handler(Fl_Shared_Handler f) {
}
-//
-// 'Fl_Shared_Image::remove_handler()' - Remove a shared image handler.
-//
-void
-Fl_Shared_Image::remove_handler(Fl_Shared_Handler f) {
+/** Removes a shared image handler */
+void Fl_Shared_Image::remove_handler(Fl_Shared_Handler f) {
int i; // Looping var...
// First see if the handler has been added...
@@ -463,5 +459,5 @@ Fl_Shared_Image::remove_handler(Fl_Shared_Handler f) {
//
-// End of "$Id: Fl_Shared_Image.cxx 5190 2006-06-09 16:16:34Z mike $".
+// End of "$Id: Fl_Shared_Image.cxx 6616 2009-01-01 21:28:26Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Single_Window.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Single_Window.cxx
index 433700216..e83a94709 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Single_Window.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Single_Window.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Single_Window.cxx 5190 2006-06-09 16:16:34Z mike $"
+// "$Id: Fl_Single_Window.cxx 6616 2009-01-01 21:28:26Z matt $"
//
// Single-buffered window for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -37,5 +37,5 @@ void Fl_Single_Window::show() {Fl_Window::show();}
void Fl_Single_Window::flush() {Fl_Window::flush();}
//
-// End of "$Id: Fl_Single_Window.cxx 5190 2006-06-09 16:16:34Z mike $".
+// End of "$Id: Fl_Single_Window.cxx 6616 2009-01-01 21:28:26Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Slider.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Slider.cxx
index 3ad4895ad..1a0f8e7e1 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Slider.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Slider.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Slider.cxx 5438 2006-09-17 14:58:25Z mike $"
+// "$Id: Fl_Slider.cxx 6683 2009-03-14 11:46:43Z engelsman $"
//
// Slider widget for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2006 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -36,14 +36,22 @@ void Fl_Slider::_Fl_Slider() {
slider_ = 0; // FL_UP_BOX;
}
-Fl_Slider::Fl_Slider(int X, int Y, int W, int H, const char* l)
-: Fl_Valuator(X, Y, W, H, l) {
+/**
+ Creates a new Fl_Slider widget using the given position,
+ size, and label string. The default boxtype is FL_DOWN_BOX.
+*/
+Fl_Slider::Fl_Slider(int X, int Y, int W, int H, const char* L)
+: Fl_Valuator(X, Y, W, H, L) {
box(FL_DOWN_BOX);
_Fl_Slider();
}
-Fl_Slider::Fl_Slider(uchar t, int X, int Y, int W, int H, const char* l)
- : Fl_Valuator(X, Y, W, H, l) {
+/**
+ Creates a new Fl_Slider widget using the given box type, position,
+ size, and label string.
+*/
+Fl_Slider::Fl_Slider(uchar t, int X, int Y, int W, int H, const char* L)
+ : Fl_Valuator(X, Y, W, H, L) {
type(t);
box(t==FL_HOR_NICE_SLIDER || t==FL_VERT_NICE_SLIDER ?
FL_FLAT_BOX : FL_DOWN_BOX);
@@ -59,6 +67,10 @@ void Fl_Slider::slider_size(double v) {
}
}
+/**
+ Sets the minimum (a) and maximum (b) values for the valuator widget.
+ if at least one of the values is changed, a partial redraw is asked.
+*/
void Fl_Slider::bounds(double a, double b) {
if (minimum() != a || maximum() != b) {
Fl_Valuator::bounds(a, b);
@@ -66,16 +78,20 @@ void Fl_Slider::bounds(double a, double b) {
}
}
-int Fl_Slider::scrollvalue(int p, int W, int t, int l) {
-// p = position, first line displayed
-// w = window, number of lines displayed
-// t = top, number of first line
-// l = length, total number of lines
+/**
+ Sets the size and position of the sliding knob in the box.
+ \param[in] pos position of first line displayed
+ \param[in] size size of window in lines
+ \param[in] first number of first line
+ \param[in] total total number of lines
+ Returns Fl_Valuator::value(p)
+ */
+int Fl_Slider::scrollvalue(int pos, int size, int first, int total) {
step(1, 1);
- if (p+W > t+l) l = p+W-t;
- slider_size(W >= l ? 1.0 : double(W)/double(l));
- bounds(t, l-W+t);
- return value(p);
+ if (pos+size > first+total) total = pos+size-first;
+ slider_size(size >= total ? 1.0 : double(size)/double(total));
+ bounds(first, total-size+first);
+ return value(pos);
}
// All slider interaction is done as though the slider ranges from
@@ -335,5 +351,5 @@ int Fl_Slider::handle(int event) {
}
//
-// End of "$Id: Fl_Slider.cxx 5438 2006-09-17 14:58:25Z mike $".
+// End of "$Id: Fl_Slider.cxx 6683 2009-03-14 11:46:43Z engelsman $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Sys_Menu_Bar.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Sys_Menu_Bar.cxx
index 99da8dbae..8fe6a2249 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Sys_Menu_Bar.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Sys_Menu_Bar.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Sys_Menu_Bar.cxx 6016 2008-01-09 21:32:40Z matt $"
+// "$Id: Fl_Sys_Menu_Bar.cxx 6616 2009-01-01 21:28:26Z matt $"
//
// MacOS system menu bar widget for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -330,5 +330,5 @@ int Fl_Menu_Bar::handle(int event) {
#endif /* __APPLE__ */
//
-// End of "$Id: Fl_Sys_Menu_Bar.cxx 6016 2008-01-09 21:32:40Z matt $".
+// End of "$Id: Fl_Sys_Menu_Bar.cxx 6616 2009-01-01 21:28:26Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Tabs.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Tabs.cxx
index 62cb71fb3..af05fd80f 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Tabs.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Tabs.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Tabs.cxx 5791 2007-05-01 20:20:21Z matt $"
+// "$Id: Fl_Tabs.cxx 6616 2009-01-01 21:28:26Z matt $"
//
// Tab widget for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,10 +25,11 @@
// http://www.fltk.org/str.php
//
+
// This is the "file card tabs" interface to allow you to put lots and lots
// of buttons and switches in a panel, as popularized by many toolkits.
-// Each child widget is a card, and it's label() is printed on the card tab.
+// Each child widget is a card, and its label() is printed on the card tab.
// Clicking the tab makes that card visible.
#include
@@ -42,7 +43,7 @@
// return the left edges of each tab (plus a fake left edge for a tab
// past the right-hand one). These position are actually of the left
-// edge of the slope. They are either seperated by the correct distance
+// edge of the slope. They are either separated by the correct distance
// or by EXTRASPACE or by zero.
// Return value is the index of the selected item.
@@ -248,10 +249,13 @@ int Fl_Tabs::push(Fl_Widget *o) {
return 1;
}
-// The value() is the first visible child (or the last child if none
-// are visible) and this also hides any other children.
-// This allows the tabs to be deleted, moved to other groups, and
-// show()/hide() called without it screwing up.
+/**
+ Gets the currently visible widget/tab.
+ The value() is the first visible child (or the last child if none
+ are visible) and this also hides any other children.
+ This allows the tabs to be deleted, moved to other groups, and
+ show()/hide() called without it screwing up.
+*/
Fl_Widget* Fl_Tabs::value() {
Fl_Widget* v = 0;
Fl_Widget*const* a = array();
@@ -264,8 +268,11 @@ Fl_Widget* Fl_Tabs::value() {
return v;
}
-// Setting the value hides all other children, and makes this one
-// visible, iff it is really a child:
+/**
+ Sets the widget to become the current visible widget/tab.
+ Setting the value hides all other children, and makes this one
+ visible, if it is really a child.
+*/
int Fl_Tabs::value(Fl_Widget *newvalue) {
Fl_Widget*const* a = array();
int ret = 0;
@@ -338,8 +345,8 @@ void Fl_Tabs::draw_tab(int x1, int x2, int W, int H, Fl_Widget* o, int what) {
if ((x2 < x1+W) && what == RIGHT) x1 = x2 - W;
if (H >= 0) {
- if (sel) fl_clip(x1, y(), x2 - x1, H + dh - dy);
- else fl_clip(x1, y(), x2 - x1, H);
+ if (sel) fl_push_clip(x1, y(), x2 - x1, H + dh - dy);
+ else fl_push_clip(x1, y(), x2 - x1, H);
H += dh;
@@ -364,8 +371,8 @@ void Fl_Tabs::draw_tab(int x1, int x2, int W, int H, Fl_Widget* o, int what) {
} else {
H = -H;
- if (sel) fl_clip(x1, y() + h() - H - dy, x2 - x1, H + dy);
- else fl_clip(x1, y() + h() - H, x2 - x1, H);
+ if (sel) fl_push_clip(x1, y() + h() - H - dy, x2 - x1, H + dy);
+ else fl_push_clip(x1, y() + h() - H, x2 - x1, H);
H += dh;
@@ -391,6 +398,23 @@ void Fl_Tabs::draw_tab(int x1, int x2, int W, int H, Fl_Widget* o, int what) {
fl_draw_shortcut = prev_draw_shortcut;
}
+/**
+ Creates a new Fl_Tabs widget using the given position, size,
+ and label string. The default boxtype is FL_THIN_UP_BOX.
+
+ Use add(Fl_Widget
+ *) to add each child, which are usually
+ Fl_Group widgets. The children should be sized to stay
+ away from the top or bottom edge of the Fl_Tabs widget,
+ which is where the tabs will be drawn.
+
+
The destructor also deletes all the children. This
+ allows a whole tree to be deleted at once, without having to
+ keep a pointer to all the children in the user code. A kludge
+ has been done so the Fl_Tabs and all of its children
+ can be automatic (local) variables, but you must declare the
+ Fl_Tabs widget first so that it is destroyed last.
+*/
Fl_Tabs::Fl_Tabs(int X,int Y,int W, int H, const char *l) :
Fl_Group(X,Y,W,H,l)
{
@@ -399,5 +423,5 @@ Fl_Tabs::Fl_Tabs(int X,int Y,int W, int H, const char *l) :
}
//
-// End of "$Id: Fl_Tabs.cxx 5791 2007-05-01 20:20:21Z matt $".
+// End of "$Id: Fl_Tabs.cxx 6616 2009-01-01 21:28:26Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Text_Buffer.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Text_Buffer.cxx
index 8872bdf24..ff36d20d5 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Text_Buffer.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Text_Buffer.cxx
@@ -1,7 +1,7 @@
//
-// "$Id: Fl_Text_Buffer.cxx 6011 2008-01-04 20:32:37Z matt $"
+// "$Id: Fl_Text_Buffer.cxx 6765 2009-04-15 08:35:28Z matt $"
//
-// Copyright 2001-2005 by Bill Spitzak and others.
+// Copyright 2001-2009 by Bill Spitzak and others.
// Original code Copyright Mark Edel. Permission to distribute under
// the LGPL for the FLTK library granted by Mark Edel.
//
@@ -27,44 +27,47 @@
#include
#include
+#include
#include "flstring.h"
#include
#include
#include
-#define PREFERRED_GAP_SIZE 1024
-/* Initial size for the buffer gap (empty space
-in the buffer where text might be inserted
-if the user is typing sequential chars ) */
-
-static void histogramCharacters( const char *string, int length, char hist[ 256 ],
- int init );
-static void subsChars( char *string, int length, char fromChar, char toChar );
-static char chooseNullSubsChar( char hist[ 256 ] );
-static void insertColInLine( const char *line, char *insLine, int column, int insWidth,
+static void histogramCharacters(const char *string, int length, char hist[ 256 ],
+ int init);
+static void subsChars(char *string, int length, char fromChar, char toChar);
+static char chooseNullSubsChar(char hist[ 256 ]);
+static void insertColInLine(const char *line, char *insLine, int column, int insWidth,
int tabDist, int useTabs, char nullSubsChar, char *outStr, int *outLen,
- int *endOffset );
-static void deleteRectFromLine( const char *line, int rectStart, int rectEnd,
+ int *endOffset);
+static void deleteRectFromLine(const char *line, int rectStart, int rectEnd,
int tabDist, int useTabs, char nullSubsChar, char *outStr, int *outLen,
- int *endOffset );
-static void overlayRectInLine( const char *line, char *insLine, int rectStart,
+ int *endOffset);
+static void overlayRectInLine(const char *line, char *insLine, int rectStart,
int rectEnd, int tabDist, int useTabs, char nullSubsChar, char *outStr,
- int *outLen, int *endOffset );
+ int *outLen, int *endOffset);
-static void addPadding( char *string, int startIndent, int toIndent,
- int tabDist, int useTabs, char nullSubsChar, int *charsAdded );
-static char *copyLine( const char* text, int *lineLen );
-static int countLines( const char *string );
-static int textWidth( const char *text, int tabDist, char nullSubsChar );
-static char *realignTabs( const char *text, int origIndent, int newIndent,
- int tabDist, int useTabs, char nullSubsChar, int *newLength );
-static char *expandTabs( const char *text, int startIndent, int tabDist,
- char nullSubsChar, int *newLen );
-static char *unexpandTabs( char *text, int startIndent, int tabDist,
- char nullSubsChar, int *newLen );
-static int max( int i1, int i2 );
-static int min( int i1, int i2 );
+static void addPadding(char *string, int startIndent, int toIndent,
+ int tabDist, int useTabs, char nullSubsChar, int *charsAdded);
+static char *copyLine(const char* text, int *lineLen);
+static int countLines(const char *string);
+static int textWidth(const char *text, int tabDist, char nullSubsChar);
+static char *realignTabs(const char *text, int origIndent, int newIndent,
+ int tabDist, int useTabs, char nullSubsChar, int *newLength);
+static char *expandTabs(const char *text, int startIndent, int tabDist,
+ char nullSubsChar, int *newLen);
+static char *unexpandTabs(char *text, int startIndent, int tabDist,
+ char nullSubsChar, int *newLen);
+#ifndef min
+static int max(int i1, int i2) {
+ return i1 >= i2 ? i1 : i2;
+}
+
+static int min(int i1, int i2) {
+ return i1 <= i2 ? i1 : i2;
+}
+#endif
static const char *ControlCodeTable[ 32 ] = {
"nul", "soh", "stx", "etx", "eot", "enq", "ack", "bel",
@@ -92,16 +95,22 @@ static void undobuffersize(int n) {
}
}
-/*
-** Create an empty text buffer of a pre-determined size (use this to
-** avoid unnecessary re-allocation if you know exactly how much the buffer
-** will need to hold
+/**
+ Create an empty text buffer of a pre-determined size.
+
+ \param requestedSize use this to avoid unnecessary re-allocation
+ if you know exactly how much the buffer will need to hold
+ \param preferredGapSize Initial size for the buffer gap (empty space
+ in the buffer where text might be inserted
+ if the user is typing sequential chars)
*/
-Fl_Text_Buffer::Fl_Text_Buffer( int requestedSize ) {
+/** Creates a new text buffer of the specified initial size.*/
+Fl_Text_Buffer::Fl_Text_Buffer(int requestedSize, int preferredGapSize) {
mLength = 0;
- mBuf = (char *)malloc( requestedSize + PREFERRED_GAP_SIZE );
+ mPreferredGapSize = preferredGapSize;
+ mBuf = (char *)malloc(requestedSize + mPreferredGapSize);
mGapStart = 0;
- mGapEnd = PREFERRED_GAP_SIZE;
+ mGapEnd = mPreferredGapSize;
mTabDist = 8;
mUseTabs = 1;
mPrimary.mSelected = 0;
@@ -127,40 +136,36 @@ Fl_Text_Buffer::Fl_Text_Buffer( int requestedSize ) {
#endif
}
-/*
-** Free a text buffer
-*/
+/** Frees a text buffer */
Fl_Text_Buffer::~Fl_Text_Buffer() {
- free( mBuf );
- if ( mNModifyProcs != 0 ) {
+ free(mBuf);
+ if (mNModifyProcs != 0) {
delete[] mNodifyProcs;
delete[] mCbArgs;
}
- if ( mNPredeleteProcs != 0 ) {
+ if (mNPredeleteProcs != 0) {
delete[] mPredeleteProcs;
delete[] mPredeleteCbArgs;
}
}
-/*
-** Get the entire contents of a text buffer. Memory is allocated to contain
-** the returned string, which the caller must free.
+/**
+ Get the entire contents of a text buffer. Memory is allocated to contain
+ the returned string, which the caller must free.
*/
char * Fl_Text_Buffer::text() {
char *t;
- t = (char *)malloc( mLength + 1 );
- memcpy( t, mBuf, mGapStart );
- memcpy( &t[ mGapStart ], &mBuf[ mGapEnd ],
- mLength - mGapStart );
+ t = (char *)malloc(mLength + 1);
+ memcpy(t, mBuf, mGapStart);
+ memcpy(&t[ mGapStart ], &mBuf[ mGapEnd ],
+ mLength - mGapStart);
t[ mLength ] = '\0';
return t;
}
-/*
-** Replace the entire contents of the text buffer
-*/
-void Fl_Text_Buffer::text( const char *t ) {
+/** Replaces the entire contents of the text buffer */
+void Fl_Text_Buffer::text(const char *t) {
int insertedLength, deletedLength;
const char *deletedText;
@@ -169,149 +174,151 @@ void Fl_Text_Buffer::text( const char *t ) {
/* Save information for redisplay, and get rid of the old buffer */
deletedText = text();
deletedLength = mLength;
- free( (void *)mBuf );
+ free((void *)mBuf);
- /* Start a new buffer with a gap of PREFERRED_GAP_SIZE in the center */
- insertedLength = strlen( t );
- mBuf = (char *)malloc( insertedLength + PREFERRED_GAP_SIZE );
+ /* Start a new buffer with a gap of mPreferredGapSize in the center */
+ insertedLength = strlen(t);
+ mBuf = (char *)malloc(insertedLength + mPreferredGapSize);
mLength = insertedLength;
mGapStart = insertedLength / 2;
- mGapEnd = mGapStart + PREFERRED_GAP_SIZE;
- memcpy( mBuf, t, mGapStart );
- memcpy( &mBuf[ mGapEnd ], &t[ mGapStart ], insertedLength - mGapStart );
+ mGapEnd = mGapStart + mPreferredGapSize;
+ memcpy(mBuf, t, mGapStart);
+ memcpy(&mBuf[ mGapEnd ], &t[ mGapStart ], insertedLength - mGapStart);
#ifdef PURIFY
-{ int i; for ( i = mGapStart; i < mGapEnd; i++ ) mBuf[ i ] = '.'; }
+{ int i; for (i = mGapStart; i < mGapEnd; i++) mBuf[ i ] = '.'; }
#endif
/* Zero all of the existing selections */
- update_selections( 0, deletedLength, 0 );
+ update_selections(0, deletedLength, 0);
/* Call the saved display routine(s) to update the screen */
- call_modify_callbacks( 0, deletedLength, insertedLength, 0, deletedText );
- free( (void *)deletedText );
+ call_modify_callbacks(0, deletedLength, insertedLength, 0, deletedText);
+ free((void *)deletedText);
}
-/*
-** Return a copy of the text between "start" and "end" character positions
-** from text buffer "buf". Positions start at 0, and the range does not
-** include the character pointed to by "end"
+/**
+ Return a copy of the text between \p start and \p end character positions
+ from text buffer \p buf. Positions start at 0, and the range does not
+ include the character pointed to by \p end.
+ When you are done with the text, free it using the free() function.
*/
-char * Fl_Text_Buffer::text_range( int start, int end ) {
- char * s;
+char * Fl_Text_Buffer::text_range(int start, int end) {
+ char * s = NULL;
int copiedLength, part1Length;
/* Make sure start and end are ok, and allocate memory for returned string.
If start is bad, return "", if end is bad, adjust it. */
- if ( start < 0 || start > mLength ) {
- s = (char *)malloc( 1 );
+ if (start < 0 || start > mLength) {
+ s = (char *)malloc(1);
s[ 0 ] = '\0';
return s;
}
- if ( end < start ) {
+ if (end < start) {
int temp = start;
start = end;
end = temp;
}
- if ( end > mLength )
+ if (end > mLength)
end = mLength;
copiedLength = end - start;
- s = (char *)malloc( copiedLength + 1 );
+ s = (char *)malloc(copiedLength + 1);
/* Copy the text from the buffer to the returned string */
- if ( end <= mGapStart ) {
- memcpy( s, &mBuf[ start ], copiedLength );
- } else if ( start >= mGapStart ) {
- memcpy( s, &mBuf[ start + ( mGapEnd - mGapStart ) ], copiedLength );
+ if (end <= mGapStart) {
+ memcpy(s, &mBuf[ start ], copiedLength);
+ } else if (start >= mGapStart) {
+ memcpy(s, &mBuf[ start + (mGapEnd - mGapStart) ], copiedLength);
} else {
part1Length = mGapStart - start;
- memcpy( s, &mBuf[ start ], part1Length );
- memcpy( &s[ part1Length ], &mBuf[ mGapEnd ], copiedLength - part1Length );
+ memcpy(s, &mBuf[ start ], part1Length);
+ memcpy(&s[ part1Length ], &mBuf[ mGapEnd ], copiedLength - part1Length);
}
s[ copiedLength ] = '\0';
return s;
}
-/*
-** Return the character at buffer position "pos". Positions start at 0.
-*/
-char Fl_Text_Buffer::character( int pos ) {
- if ( pos < 0 || pos >= mLength )
+/** Returns the character at the specified position pos in the buffer.
+ Positions start at 0 */
+char Fl_Text_Buffer::character(int pos) {
+ if (pos < 0 || pos >= mLength)
return '\0';
- if ( pos < mGapStart )
+ if (pos < mGapStart)
return mBuf[ pos ];
else
return mBuf[ pos + mGapEnd - mGapStart ];
}
-/*
-** Insert null-terminated string "text" at position "pos" in "buf"
-*/
-void Fl_Text_Buffer::insert( int pos, const char *s ) {
+/** Inserts null-terminated string \p text at position \p pos. */
+void Fl_Text_Buffer::insert(int pos, const char *text) {
int nInserted;
/* if pos is not contiguous to existing text, make it */
- if ( pos > mLength ) pos = mLength;
- if ( pos < 0 ) pos = 0;
+ if (pos > mLength) pos = mLength;
+ if (pos < 0) pos = 0;
/* Even if nothing is deleted, we must call these callbacks */
- call_predelete_callbacks( pos, 0 );
+ call_predelete_callbacks(pos, 0);
/* insert and redisplay */
- nInserted = insert_( pos, s );
+ nInserted = insert_(pos, text);
mCursorPosHint = pos + nInserted;
- call_modify_callbacks( pos, 0, nInserted, 0, NULL );
+ call_modify_callbacks(pos, 0, nInserted, 0, NULL);
}
-/*
-** Delete the characters between "start" and "end", and insert the
-** null-terminated string "text" in their place in in "buf"
+/**
+ Deletes the characters between \p start and \p end, and inserts the null-terminated string \p text in their place in the buffer.
*/
-void Fl_Text_Buffer::replace( int start, int end, const char *s ) {
+void Fl_Text_Buffer::replace(int start, int end, const char *text) {
const char * deletedText;
int nInserted;
// Range check...
- if (!s) return;
+ if (!text) return;
if (start < 0) start = 0;
if (end > mLength) end = mLength;
- call_predelete_callbacks( start, end-start );
- deletedText = text_range( start, end );
- remove_( start, end );
+ call_predelete_callbacks(start, end-start);
+ deletedText = text_range(start, end);
+ remove_(start, end);
//undoyankcut = undocut;
- nInserted = insert_( start, s );
+ nInserted = insert_(start, text);
mCursorPosHint = start + nInserted;
- call_modify_callbacks( start, end - start, nInserted, 0, deletedText );
- free( (void *)deletedText );
+ call_modify_callbacks(start, end - start, nInserted, 0, deletedText);
+ free((void *)deletedText);
}
-void Fl_Text_Buffer::remove( int start, int end ) {
+/** Deletes a range of characters in the buffer.*/
+void Fl_Text_Buffer::remove(int start, int end) {
const char * deletedText;
/* Make sure the arguments make sense */
- if ( start > end ) {
+ if (start > end) {
int temp = start;
start = end;
end = temp;
}
- if ( start > mLength ) start = mLength;
- if ( start < 0 ) start = 0;
- if ( end > mLength ) end = mLength;
- if ( end < 0 ) end = 0;
+ if (start > mLength) start = mLength;
+ if (start < 0) start = 0;
+ if (end > mLength) end = mLength;
+ if (end < 0) end = 0;
if (start == end) return;
- call_predelete_callbacks( start, end-start );
+ call_predelete_callbacks(start, end-start);
/* Remove and redisplay */
- deletedText = text_range( start, end );
- remove_( start, end );
+ deletedText = text_range(start, end);
+ remove_(start, end);
mCursorPosHint = start;
- call_modify_callbacks( start, end - start, 0, 0, deletedText );
- free( (void *)deletedText );
+ call_modify_callbacks(start, end - start, 0, 0, deletedText);
+ free((void *)deletedText);
}
-void Fl_Text_Buffer::copy( Fl_Text_Buffer *fromBuf, int fromStart,
- int fromEnd, int toPos ) {
+/**
+ Copies text from one buffer to this one; fromBuf may
+ be the same as this.
+*/
+void Fl_Text_Buffer::copy(Fl_Text_Buffer *fromBuf, int fromStart,
+ int fromEnd, int toPos) {
int copiedLength = fromEnd - fromStart;
int part1Length;
@@ -319,33 +326,33 @@ void Fl_Text_Buffer::copy( Fl_Text_Buffer *fromBuf, int fromStart,
the current buffer, just move the gap (if necessary) to where
the text should be inserted. If the new text is too large, reallocate
the buffer with a gap large enough to accomodate the new text and a
- gap of PREFERRED_GAP_SIZE */
- if ( copiedLength > mGapEnd - mGapStart )
- reallocate_with_gap( toPos, copiedLength + PREFERRED_GAP_SIZE );
- else if ( toPos != mGapStart )
- move_gap( toPos );
+ gap of mPreferredGapSize */
+ if (copiedLength > mGapEnd - mGapStart)
+ reallocate_with_gap(toPos, copiedLength + mPreferredGapSize);
+ else if (toPos != mGapStart)
+ move_gap(toPos);
/* Insert the new text (toPos now corresponds to the start of the gap) */
- if ( fromEnd <= fromBuf->mGapStart ) {
- memcpy( &mBuf[ toPos ], &fromBuf->mBuf[ fromStart ], copiedLength );
- } else if ( fromStart >= fromBuf->mGapStart ) {
- memcpy( &mBuf[ toPos ],
- &fromBuf->mBuf[ fromStart + ( fromBuf->mGapEnd - fromBuf->mGapStart ) ],
- copiedLength );
+ if (fromEnd <= fromBuf->mGapStart) {
+ memcpy(&mBuf[ toPos ], &fromBuf->mBuf[ fromStart ], copiedLength);
+ } else if (fromStart >= fromBuf->mGapStart) {
+ memcpy(&mBuf[ toPos ],
+ &fromBuf->mBuf[ fromStart + (fromBuf->mGapEnd - fromBuf->mGapStart) ],
+ copiedLength);
} else {
part1Length = fromBuf->mGapStart - fromStart;
- memcpy( &mBuf[ toPos ], &fromBuf->mBuf[ fromStart ], part1Length );
- memcpy( &mBuf[ toPos + part1Length ], &fromBuf->mBuf[ fromBuf->mGapEnd ],
- copiedLength - part1Length );
+ memcpy(&mBuf[ toPos ], &fromBuf->mBuf[ fromStart ], part1Length);
+ memcpy(&mBuf[ toPos + part1Length ], &fromBuf->mBuf[ fromBuf->mGapEnd ],
+ copiedLength - part1Length);
}
mGapStart += copiedLength;
mLength += copiedLength;
- update_selections( toPos, 0, copiedLength );
+ update_selections(toPos, 0, copiedLength);
}
-/*
-** remove text according to the undo variables or insert text
-** from the undo buffer
+/**
+ Undo text modification according to the undo variables or insert text
+ from the undo buffer
*/
int Fl_Text_Buffer::undo(int *cursorPos) {
if (undowidget != this || !undocut && !undoinsert &&!mCanUndo) return 0;
@@ -381,80 +388,78 @@ int Fl_Text_Buffer::undo(int *cursorPos) {
return 1;
}
-/*
-** let the undo system know if we can undo changes
-*/
+/** Lets the undo system know if we can undo changes */
void Fl_Text_Buffer::canUndo(char flag) {
mCanUndo = flag;
}
-/*
-** Insert "text" columnwise into buffer starting at displayed character
-** position "column" on the line beginning at "startPos". Opens a rectangular
-** space the width and height of "text", by moving all text to the right of
-** "column" right. If charsInserted and charsDeleted are not NULL, the
-** number of characters inserted and deleted in the operation (beginning
-** at startPos) are returned in these arguments
+/**
+ Insert \p s columnwise into buffer starting at displayed character
+ position \p column on the line beginning at \p startPos. Opens a rectangular
+ space the width and height of \p s, by moving all text to the right of
+ \p column right. If \p charsInserted and \p charsDeleted are not NULL, the
+ number of characters inserted and deleted in the operation (beginning
+ at \p startPos) are returned in these arguments.
*/
-void Fl_Text_Buffer::insert_column( int column, int startPos, const char *s,
- int *charsInserted, int *charsDeleted ) {
+void Fl_Text_Buffer::insert_column(int column, int startPos, const char *text,
+ int *charsInserted, int *charsDeleted) {
int nLines, lineStartPos, nDeleted, insertDeleted, nInserted;
const char *deletedText;
- nLines = countLines( s );
- lineStartPos = line_start( startPos );
- nDeleted = line_end( skip_lines( startPos, nLines ) ) -
+ nLines = countLines(text);
+ lineStartPos = line_start(startPos);
+ nDeleted = line_end(skip_lines(startPos, nLines)) -
lineStartPos;
- call_predelete_callbacks( lineStartPos, nDeleted );
- deletedText = text_range( lineStartPos, lineStartPos + nDeleted );
- insert_column_( column, lineStartPos, s, &insertDeleted, &nInserted,
- &mCursorPosHint );
- if ( nDeleted != insertDeleted )
+ call_predelete_callbacks(lineStartPos, nDeleted);
+ deletedText = text_range(lineStartPos, lineStartPos + nDeleted);
+ insert_column_(column, lineStartPos, text, &insertDeleted, &nInserted,
+ &mCursorPosHint);
+ if (nDeleted != insertDeleted)
Fl::error("Fl_Text_Buffer::insert_column(): internal consistency check ins1 failed");
- call_modify_callbacks( lineStartPos, nDeleted, nInserted, 0, deletedText );
- free( (void *) deletedText );
- if ( charsInserted != NULL )
+ call_modify_callbacks(lineStartPos, nDeleted, nInserted, 0, deletedText);
+ free((void *) deletedText);
+ if (charsInserted != NULL)
* charsInserted = nInserted;
- if ( charsDeleted != NULL )
+ if (charsDeleted != NULL)
* charsDeleted = nDeleted;
}
-/*
-** Overlay "text" between displayed character positions "rectStart" and
-** "rectEnd" on the line beginning at "startPos". If charsInserted and
-** charsDeleted are not NULL, the number of characters inserted and deleted
-** in the operation (beginning at startPos) are returned in these arguments.
+/**
+ Overlay \p text between displayed character positions \p rectStart and
+ \p rectEnd on the line beginning at \p startPos. If \p charsInserted and
+ \p charsDeleted are not NULL, the number of characters inserted and deleted
+ in the operation (beginning at \p startPos) are returned in these arguments.
*/
-void Fl_Text_Buffer::overlay_rectangular( int startPos, int rectStart,
- int rectEnd, const char *s, int *charsInserted, int *charsDeleted ) {
+void Fl_Text_Buffer::overlay_rectangular(int startPos, int rectStart,
+ int rectEnd, const char *text, int *charsInserted, int *charsDeleted) {
int nLines, lineStartPos, nDeleted, insertDeleted, nInserted;
const char *deletedText;
- nLines = countLines( s );
- lineStartPos = line_start( startPos );
- nDeleted = line_end( skip_lines( startPos, nLines ) ) -
+ nLines = countLines(text);
+ lineStartPos = line_start(startPos);
+ nDeleted = line_end(skip_lines(startPos, nLines)) -
lineStartPos;
- call_predelete_callbacks( lineStartPos, nDeleted );
- deletedText = text_range( lineStartPos, lineStartPos + nDeleted );
- overlay_rectangular_( lineStartPos, rectStart, rectEnd, s, &insertDeleted,
- &nInserted, &mCursorPosHint );
- if ( nDeleted != insertDeleted )
+ call_predelete_callbacks(lineStartPos, nDeleted);
+ deletedText = text_range(lineStartPos, lineStartPos + nDeleted);
+ overlay_rectangular_(lineStartPos, rectStart, rectEnd, text, &insertDeleted,
+ &nInserted, &mCursorPosHint);
+ if (nDeleted != insertDeleted)
Fl::error("Fl_Text_Buffer::overlay_rectangle(): internal consistency check ovly1 failed");
- call_modify_callbacks( lineStartPos, nDeleted, nInserted, 0, deletedText );
- free( (void *) deletedText );
- if ( charsInserted != NULL )
+ call_modify_callbacks(lineStartPos, nDeleted, nInserted, 0, deletedText);
+ free((void *) deletedText);
+ if (charsInserted != NULL)
* charsInserted = nInserted;
- if ( charsDeleted != NULL )
+ if (charsDeleted != NULL)
* charsDeleted = nDeleted;
}
-/*
-** Replace a rectangular area in buf, given by "start", "end", "rectStart",
-** and "rectEnd", with "text". If "text" is vertically longer than the
-** rectangle, add extra lines to make room for it.
+/**
+ Replaces a rectangular area in the buffer, given by \p start, \p end,
+ \p rectStart, and \p rectEnd, with \p text. If \p text is vertically
+ longer than the rectangle, add extra lines to make room for it.
*/
-void Fl_Text_Buffer::replace_rectangular( int start, int end, int rectStart,
- int rectEnd, const char *s ) {
+void Fl_Text_Buffer::replace_rectangular(int start, int end, int rectStart,
+ int rectEnd, const char *text) {
char *insPtr;
const char *deletedText;
char *insText = (char *)"";
@@ -464,10 +469,10 @@ void Fl_Text_Buffer::replace_rectangular( int start, int end, int rectStart,
/* Make sure start and end refer to complete lines, since the
columnar delete and insert operations will replace whole lines */
- start = line_start( start );
- end = line_end( end );
+ start = line_start(start);
+ end = line_end(end);
- call_predelete_callbacks( start, end-start );
+ call_predelete_callbacks(start, end-start);
/* If more lines will be deleted than inserted, pad the inserted text
with newlines to make it as long as the number of deleted lines. This
@@ -475,122 +480,126 @@ void Fl_Text_Buffer::replace_rectangular( int start, int end, int rectStart,
column. If more lines will be inserted than deleted, insert extra
lines in the buffer at the end of the rectangle to make room for the
additional lines in "text" */
- nInsertedLines = countLines( s );
- nDeletedLines = count_lines( start, end );
- if ( nInsertedLines < nDeletedLines ) {
- insLen = strlen( s );
- insText = (char *)malloc( insLen + nDeletedLines - nInsertedLines + 1 );
- strcpy( insText, s );
+ nInsertedLines = countLines(text);
+ nDeletedLines = count_lines(start, end);
+ if (nInsertedLines < nDeletedLines) {
+ insLen = strlen(text);
+ insText = (char *)malloc(insLen + nDeletedLines - nInsertedLines + 1);
+ strcpy(insText, text);
insPtr = insText + insLen;
- for ( i = 0; i < nDeletedLines - nInsertedLines; i++ )
+ for (i = 0; i < nDeletedLines - nInsertedLines; i++)
*insPtr++ = '\n';
*insPtr = '\0';
- } else if ( nDeletedLines < nInsertedLines ) {
+ } else if (nDeletedLines < nInsertedLines) {
linesPadded = nInsertedLines - nDeletedLines;
- for ( i = 0; i < linesPadded; i++ )
- insert_( end, "\n" );
+ for (i = 0; i < linesPadded; i++)
+ insert_(end, "\n");
} /* else nDeletedLines == nInsertedLines; */
/* Save a copy of the text which will be modified for the modify CBs */
- deletedText = text_range( start, end );
+ deletedText = text_range(start, end);
/* Delete then insert */
- remove_rectangular_( start, end, rectStart, rectEnd, &deleteInserted, &hint );
- insert_column_( rectStart, start, insText, &insertDeleted, &insertInserted,
- &mCursorPosHint );
+ remove_rectangular_(start, end, rectStart, rectEnd, &deleteInserted, &hint);
+ insert_column_(rectStart, start, insText, &insertDeleted, &insertInserted,
+ &mCursorPosHint);
/* Figure out how many chars were inserted and call modify callbacks */
- if ( insertDeleted != deleteInserted + linesPadded )
+ if (insertDeleted != deleteInserted + linesPadded)
Fl::error("Fl_Text_Buffer::replace_rectangular(): internal consistency check repl1 failed");
- call_modify_callbacks( start, end - start, insertInserted, 0, deletedText );
- free( (void *) deletedText );
- if ( nInsertedLines < nDeletedLines )
- free( (void *) insText );
+ call_modify_callbacks(start, end - start, insertInserted, 0, deletedText);
+ free((void *) deletedText);
+ if (nInsertedLines < nDeletedLines)
+ free((void *) insText);
}
-/*
-** Remove a rectangular swath of characters between character positions start
-** and end and horizontal displayed-character offsets rectStart and rectEnd.
+/**
+ Removes a rectangular swath of characters between character positions start
+ and end and horizontal displayed-character offsets rectStart and rectEnd.
*/
-void Fl_Text_Buffer::remove_rectangular( int start, int end, int rectStart,
- int rectEnd ) {
+void Fl_Text_Buffer::remove_rectangular(int start, int end, int rectStart,
+ int rectEnd) {
const char * deletedText;
int nInserted;
- start = line_start( start );
- end = line_end( end );
- call_predelete_callbacks( start, end-start );
- deletedText = text_range( start, end );
- remove_rectangular_( start, end, rectStart, rectEnd, &nInserted,
- &mCursorPosHint );
- call_modify_callbacks( start, end - start, nInserted, 0, deletedText );
- free( (void *) deletedText );
+ start = line_start(start);
+ end = line_end(end);
+ call_predelete_callbacks(start, end-start);
+ deletedText = text_range(start, end);
+ remove_rectangular_(start, end, rectStart, rectEnd, &nInserted,
+ &mCursorPosHint);
+ call_modify_callbacks(start, end - start, nInserted, 0, deletedText);
+ free((void *) deletedText);
}
-/*
-** Clear a rectangular "hole" out of the buffer between character positions
-** start and end and horizontal displayed-character offsets rectStart and
-** rectEnd.
+/**
+ Clears text in the specified area.
+ It clears a rectangular "hole" out of the buffer between character positions
+ start and end and horizontal displayed-character offsets rectStart and
+ rectEnd.
*/
-void Fl_Text_Buffer::clear_rectangular( int start, int end, int rectStart,
- int rectEnd ) {
+void Fl_Text_Buffer::clear_rectangular(int start, int end, int rectStart,
+ int rectEnd) {
int i, nLines;
char *newlineString;
- nLines = count_lines( start, end );
- newlineString = (char *)malloc( nLines + 1 );
- for ( i = 0; i < nLines; i++ )
+ nLines = count_lines(start, end);
+ newlineString = (char *)malloc(nLines + 1);
+ for (i = 0; i < nLines; i++)
newlineString[ i ] = '\n';
newlineString[ i ] = '\0';
- overlay_rectangular( start, rectStart, rectEnd, newlineString,
- NULL, NULL );
- free( (void *) newlineString );
+ overlay_rectangular(start, rectStart, rectEnd, newlineString,
+ NULL, NULL);
+ free((void *) newlineString);
}
-
-char * Fl_Text_Buffer::text_in_rectangle( int start, int end,
- int rectStart, int rectEnd ) {
+/**
+ Returns the text from the given rectangle. When you are done
+ with the text, free it using the free() function.
+*/
+char * Fl_Text_Buffer::text_in_rectangle(int start, int end,
+ int rectStart, int rectEnd) {
int lineStart, selLeft, selRight, len;
char *textOut, *outPtr, *retabbedStr;
const char *textIn;
- start = line_start( start );
- end = line_end( end );
- textOut = (char *)malloc( ( end - start ) + 1 );
+ start = line_start(start);
+ end = line_end(end);
+ textOut = (char *)malloc((end - start) + 1);
lineStart = start;
outPtr = textOut;
- while ( lineStart <= end ) {
- rectangular_selection_boundaries( lineStart, rectStart, rectEnd,
- &selLeft, &selRight );
- textIn = text_range( selLeft, selRight );
+ while (lineStart <= end) {
+ rectangular_selection_boundaries(lineStart, rectStart, rectEnd,
+ &selLeft, &selRight);
+ textIn = text_range(selLeft, selRight);
len = selRight - selLeft;
- memcpy( outPtr, textIn, len );
- free( (void *) textIn );
+ memcpy(outPtr, textIn, len);
+ free((void *) textIn);
outPtr += len;
- lineStart = line_end( selRight ) + 1;
+ lineStart = line_end(selRight) + 1;
*outPtr++ = '\n';
}
- if ( outPtr != textOut )
+ if (outPtr != textOut)
outPtr--; /* don't leave trailing newline */
*outPtr = '\0';
/* If necessary, realign the tabs in the selection as if the text were
positioned at the left margin */
- retabbedStr = realignTabs( textOut, rectStart, 0, mTabDist,
- mUseTabs, mNullSubsChar, &len );
- free( (void *) textOut );
+ retabbedStr = realignTabs(textOut, rectStart, 0, mTabDist,
+ mUseTabs, mNullSubsChar, &len);
+ free((void *) textOut);
return retabbedStr;
}
-/*
-** Set the hardware tab distance used by all displays for this buffer,
-** and used in computing offsets for rectangular selection operations.
+/**
+ Set the hardware tab distance (width) used by all displays for this buffer,
+ and used in computing offsets for rectangular selection operations.
*/
-void Fl_Text_Buffer::tab_distance( int tabDist ) {
+void Fl_Text_Buffer::tab_distance(int tabDist) {
const char * deletedText;
/* First call the pre-delete callbacks with the previous tab setting
still active. */
- call_predelete_callbacks( 0, mLength );
+ call_predelete_callbacks(0, mLength);
/* Change the tab setting */
mTabDist = tabDist;
@@ -598,153 +607,180 @@ void Fl_Text_Buffer::tab_distance( int tabDist ) {
/* Force any display routines to redisplay everything (unfortunately,
this means copying the whole buffer contents to provide "deletedText" */
deletedText = text();
- call_modify_callbacks( 0, mLength, mLength, 0, deletedText );
- free( (void *) deletedText );
+ call_modify_callbacks(0, mLength, mLength, 0, deletedText);
+ free((void *) deletedText);
}
-void Fl_Text_Buffer::select( int start, int end ) {
+/** Selects a range of characters in the buffer.*/
+void Fl_Text_Buffer::select(int start, int end) {
Fl_Text_Selection oldSelection = mPrimary;
- mPrimary.set( start, end );
- redisplay_selection( &oldSelection, &mPrimary );
+ mPrimary.set(start, end);
+ redisplay_selection(&oldSelection, &mPrimary);
}
-
+/** Cancels any previous selection on the primary text selection object */
void Fl_Text_Buffer::unselect() {
Fl_Text_Selection oldSelection = mPrimary;
mPrimary.mSelected = 0;
- redisplay_selection( &oldSelection, &mPrimary );
+ redisplay_selection(&oldSelection, &mPrimary);
}
-
-void Fl_Text_Buffer::select_rectangular( int start, int end, int rectStart,
- int rectEnd ) {
+/** Achieves a rectangular selection on the primary text selection object */
+void Fl_Text_Buffer::select_rectangular(int start, int end, int rectStart,
+ int rectEnd) {
Fl_Text_Selection oldSelection = mPrimary;
- mPrimary.set_rectangular( start, end, rectStart, rectEnd );
- redisplay_selection( &oldSelection, &mPrimary );
+ mPrimary.set_rectangular(start, end, rectStart, rectEnd);
+ redisplay_selection(&oldSelection, &mPrimary);
}
-int Fl_Text_Buffer::selection_position( int *start, int *end
- ) {
- return mPrimary.position( start, end );
-}
-
-int Fl_Text_Buffer::selection_position( int *start, int *end,
- int *isRect, int *rectStart, int *rectEnd ) {
- return mPrimary.position( start, end, isRect, rectStart,
- rectEnd );
+/** Gets the selection position */
+int Fl_Text_Buffer::selection_position(int *start, int *end
+ ) {
+ return mPrimary.position(start, end);
+}
+/** Gets the selection position, and rectangular selection info */
+int Fl_Text_Buffer::selection_position(int *start, int *end,
+ int *isRect, int *rectStart, int *rectEnd) {
+ return mPrimary.position(start, end, isRect, rectStart,
+ rectEnd);
}
+/**
+ Returns the currently selected text. When you are done with
+ the text, free it using the free() function.
+*/
char * Fl_Text_Buffer::selection_text() {
- return selection_text_( &mPrimary );
+ return selection_text_(&mPrimary);
}
+/** Removes the text in the primary selection.*/
void Fl_Text_Buffer::remove_selection() {
- remove_selection_( &mPrimary );
+ remove_selection_(&mPrimary);
+}
+/** Replaces the text in the primary selection.*/
+void Fl_Text_Buffer::replace_selection(const char *text) {
+ replace_selection_(&mPrimary, text);
}
-void Fl_Text_Buffer::replace_selection( const char *s ) {
- replace_selection_( &mPrimary, s );
-}
-
-void Fl_Text_Buffer::secondary_select( int start, int end ) {
+/** Selects a range of characters in the secondary selection.*/
+void Fl_Text_Buffer::secondary_select(int start, int end) {
Fl_Text_Selection oldSelection = mSecondary;
- mSecondary.set( start, end );
- redisplay_selection( &oldSelection, &mSecondary );
+ mSecondary.set(start, end);
+ redisplay_selection(&oldSelection, &mSecondary);
}
-
+/** Cancels any previous selection on the primary text selection object */
void Fl_Text_Buffer::secondary_unselect() {
Fl_Text_Selection oldSelection = mSecondary;
mSecondary.mSelected = 0;
- redisplay_selection( &oldSelection, &mSecondary );
+ redisplay_selection(&oldSelection, &mSecondary);
}
-void Fl_Text_Buffer::secondary_select_rectangular( int start, int end,
- int rectStart, int rectEnd ) {
+/** Achieves a rectangular selection on the secondary text selection object */
+void Fl_Text_Buffer::secondary_select_rectangular(int start, int end,
+ int rectStart, int rectEnd) {
Fl_Text_Selection oldSelection = mSecondary;
- mSecondary.set_rectangular( start, end, rectStart, rectEnd );
- redisplay_selection( &oldSelection, &mSecondary );
-}
-
-int Fl_Text_Buffer::secondary_selection_position( int *start, int *end
- ) {
- return mSecondary.position( start, end );
-}
-
-int Fl_Text_Buffer::secondary_selection_position( int *start, int *end,
- int *isRect, int *rectStart, int *rectEnd ) {
- return mSecondary.position( start, end, isRect, rectStart,
- rectEnd );
+ mSecondary.set_rectangular(start, end, rectStart, rectEnd);
+ redisplay_selection(&oldSelection, &mSecondary);
+}
+/** Returns the current selection in the secondary text selection object.*/
+int Fl_Text_Buffer::secondary_selection_position(int *start, int *end
+ ) {
+ return mSecondary.position(start, end);
+}
+/** Returns the current selection in the secondary text selection object.*/
+int Fl_Text_Buffer::secondary_selection_position(int *start, int *end,
+ int *isRect, int *rectStart, int *rectEnd) {
+ return mSecondary.position(start, end, isRect, rectStart,
+ rectEnd);
}
+/**
+ Returns the text in the secondary selection. When you are
+ done with the text, free it using the free() function.
+*/
char * Fl_Text_Buffer::secondary_selection_text() {
- return selection_text_( &mSecondary );
+ return selection_text_(&mSecondary);
}
-
+/** Removes the text from the buffer corresponding to the secondary text selection object.*/
void Fl_Text_Buffer::remove_secondary_selection() {
- remove_selection_( &mSecondary );
+ remove_selection_(&mSecondary);
+}
+/** Replaces the text from the buffer corresponding to the secondary
+ text selection object with the new string \p text.*/
+void Fl_Text_Buffer::replace_secondary_selection(const char *text) {
+ replace_selection_(&mSecondary, text);
}
-void Fl_Text_Buffer::replace_secondary_selection( const char *s ) {
- replace_selection_( &mSecondary, s );
-}
-
-void Fl_Text_Buffer::highlight( int start, int end ) {
+/** Highlights the specified text within the buffer.*/
+void Fl_Text_Buffer::highlight(int start, int end) {
Fl_Text_Selection oldSelection = mHighlight;
- mHighlight.set( start, end );
- redisplay_selection( &oldSelection, &mHighlight );
+ mHighlight.set(start, end);
+ redisplay_selection(&oldSelection, &mHighlight);
}
+/** Unhighlights text in the buffer.*/
void Fl_Text_Buffer::unhighlight() {
Fl_Text_Selection oldSelection = mHighlight;
mHighlight.mSelected = 0;
- redisplay_selection( &oldSelection, &mHighlight );
+ redisplay_selection(&oldSelection, &mHighlight);
}
-
-void Fl_Text_Buffer::highlight_rectangular( int start, int end,
- int rectStart, int rectEnd ) {
+/** Highlights a rectangular selection in the buffer */
+void Fl_Text_Buffer::highlight_rectangular(int start, int end,
+ int rectStart, int rectEnd) {
Fl_Text_Selection oldSelection = mHighlight;
- mHighlight.set_rectangular( start, end, rectStart, rectEnd );
- redisplay_selection( &oldSelection, &mHighlight );
+ mHighlight.set_rectangular(start, end, rectStart, rectEnd);
+ redisplay_selection(&oldSelection, &mHighlight);
+}
+/** Highlights the specified text between \p start and \p end within the buffer.*/
+int Fl_Text_Buffer::highlight_position(int *start, int *end
+ ) {
+ return mHighlight.position(start, end);
+}
+/** Highlights the specified rectangle of text within the buffer.*/
+int Fl_Text_Buffer::highlight_position(int *start, int *end,
+ int *isRect, int *rectStart, int *rectEnd) {
+ return mHighlight.position(start, end, isRect, rectStart,
+ rectEnd);
}
-int Fl_Text_Buffer::highlight_position( int *start, int *end
- ) {
- return mHighlight.position( start, end );
-}
-
-int Fl_Text_Buffer::highlight_position( int *start, int *end,
- int *isRect, int *rectStart, int *rectEnd ) {
- return mHighlight.position( start, end, isRect, rectStart,
- rectEnd );
-}
-
-char * Fl_Text_Buffer::highlight_text() {
- return selection_text_( &mHighlight );
-}
-
-/*
-** Add a callback routine to be called when the buffer is modified
+/**
+ Returns the highlighted text. When you are done with the
+ text, free it using the free() function.
*/
-void Fl_Text_Buffer::add_modify_callback( Fl_Text_Modify_Cb bufModifiedCB,
- void *cbArg ) {
+char * Fl_Text_Buffer::highlight_text() {
+ return selection_text_(&mHighlight);
+}
+
+/**
+ Adds a callback function that is called whenever the text buffer is
+ modified. The callback function is declared as follows:
+
+ \code
+ typedef void (*Fl_Text_Modify_Cb)(int pos, int nInserted, int nDeleted,
+ int nRestyled, const char* deletedText,
+ void* cbArg);
+ \endcode
+*/
+void Fl_Text_Buffer::add_modify_callback(Fl_Text_Modify_Cb bufModifiedCB,
+ void *cbArg) {
Fl_Text_Modify_Cb * newModifyProcs;
void **newCBArgs;
int i;
newModifyProcs = new Fl_Text_Modify_Cb [ mNModifyProcs + 1 ];
newCBArgs = new void * [ mNModifyProcs + 1 ];
- for ( i = 0; i < mNModifyProcs; i++ ) {
+ for (i = 0; i < mNModifyProcs; i++) {
newModifyProcs[ i + 1 ] = mNodifyProcs[ i ];
newCBArgs[ i + 1 ] = mCbArgs[ i ];
}
- if ( mNModifyProcs != 0 ) {
+ if (mNModifyProcs != 0) {
delete [] mNodifyProcs;
delete [] mCbArgs;
}
@@ -754,21 +790,21 @@ void Fl_Text_Buffer::add_modify_callback( Fl_Text_Modify_Cb bufModifiedCB,
mNodifyProcs = newModifyProcs;
mCbArgs = newCBArgs;
}
-
-void Fl_Text_Buffer::remove_modify_callback( Fl_Text_Modify_Cb bufModifiedCB,
- void *cbArg ) {
+/** Removes a modify callback.*/
+void Fl_Text_Buffer::remove_modify_callback(Fl_Text_Modify_Cb bufModifiedCB,
+ void *cbArg) {
int i, toRemove = -1;
Fl_Text_Modify_Cb *newModifyProcs;
void **newCBArgs;
/* find the matching callback to remove */
- for ( i = 0; i < mNModifyProcs; i++ ) {
- if ( mNodifyProcs[ i ] == bufModifiedCB && mCbArgs[ i ] == cbArg ) {
+ for (i = 0; i < mNModifyProcs; i++) {
+ if (mNodifyProcs[ i ] == bufModifiedCB && mCbArgs[ i ] == cbArg) {
toRemove = i;
break;
}
}
- if ( toRemove == -1 ) {
+ if (toRemove == -1) {
Fl::error("Fl_Text_Buffer::remove_modify_callback(): Can't find modify CB to remove");
return;
}
@@ -776,7 +812,7 @@ void Fl_Text_Buffer::remove_modify_callback( Fl_Text_Modify_Cb bufModifiedCB,
/* Allocate new lists for remaining callback procs and args (if
any are left) */
mNModifyProcs--;
- if ( mNModifyProcs == 0 ) {
+ if (mNModifyProcs == 0) {
mNModifyProcs = 0;
delete[] mNodifyProcs;
mNodifyProcs = NULL;
@@ -788,11 +824,11 @@ void Fl_Text_Buffer::remove_modify_callback( Fl_Text_Modify_Cb bufModifiedCB,
newCBArgs = new void * [ mNModifyProcs ];
/* copy out the remaining members and free the old lists */
- for ( i = 0; i < toRemove; i++ ) {
+ for (i = 0; i < toRemove; i++) {
newModifyProcs[ i ] = mNodifyProcs[ i ];
newCBArgs[ i ] = mCbArgs[ i ];
}
- for ( ; i < mNModifyProcs; i++ ) {
+ for (; i < mNModifyProcs; i++) {
newModifyProcs[ i ] = mNodifyProcs[ i + 1 ];
newCBArgs[ i ] = mCbArgs[ i + 1 ];
}
@@ -802,9 +838,7 @@ void Fl_Text_Buffer::remove_modify_callback( Fl_Text_Modify_Cb bufModifiedCB,
mCbArgs = newCBArgs;
}
-/*
-** Add a callback routine to be called before text is deleted from the buffer.
-*/
+/** Adds a callback routine to be called before text is deleted from the buffer. */
void Fl_Text_Buffer::add_predelete_callback(Fl_Text_Predelete_Cb bufPreDeleteCB,
void *cbArg) {
Fl_Text_Predelete_Cb *newPreDeleteProcs;
@@ -813,7 +847,7 @@ void Fl_Text_Buffer::add_predelete_callback(Fl_Text_Predelete_Cb bufPreDeleteCB,
newPreDeleteProcs = new Fl_Text_Predelete_Cb[ mNPredeleteProcs + 1 ];
newCBArgs = new void * [ mNPredeleteProcs + 1 ];
- for ( i = 0; i < mNPredeleteProcs; i++ ) {
+ for (i = 0; i < mNPredeleteProcs; i++) {
newPreDeleteProcs[i + 1] = mPredeleteProcs[i];
newCBArgs[i + 1] = mPredeleteCbArgs[i];
}
@@ -827,7 +861,8 @@ void Fl_Text_Buffer::add_predelete_callback(Fl_Text_Predelete_Cb bufPreDeleteCB,
mPredeleteProcs = newPreDeleteProcs;
mPredeleteCbArgs = newCBArgs;
}
-
+/** Removes a callback routine \p bufPreDeleteCB associated with argument \p cbArg
+ to be called before text is deleted from the buffer. */
void Fl_Text_Buffer::remove_predelete_callback(
Fl_Text_Predelete_Cb bufPreDeleteCB, void *cbArg) {
int i, toRemove = -1;
@@ -835,7 +870,7 @@ void Fl_Text_Buffer::remove_predelete_callback(
void **newCBArgs;
/* find the matching callback to remove */
- for ( i = 0; i < mNPredeleteProcs; i++) {
+ for (i = 0; i < mNPredeleteProcs; i++) {
if (mPredeleteProcs[i] == bufPreDeleteCB &&
mPredeleteCbArgs[i] == cbArg) {
toRemove = i;
@@ -862,11 +897,11 @@ void Fl_Text_Buffer::remove_predelete_callback(
newCBArgs = new void * [ mNPredeleteProcs ];
/* copy out the remaining members and free the old lists */
- for ( i = 0; i < toRemove; i++) {
+ for (i = 0; i < toRemove; i++) {
newPreDeleteProcs[i] = mPredeleteProcs[i];
newCBArgs[i] = mPredeleteCbArgs[i];
}
- for ( ; i < mNPredeleteProcs; i++) {
+ for (; i < mNPredeleteProcs; i++) {
newPreDeleteProcs[i] = mPredeleteProcs[i+1];
newCBArgs[i] = mPredeleteCbArgs[i+1];
}
@@ -876,92 +911,115 @@ void Fl_Text_Buffer::remove_predelete_callback(
mPredeleteCbArgs = newCBArgs;
}
-/*
-** Return the text from the entire line containing position "pos"
+/**
+ Returns the text from the entire line containing the specified
+ character position. When you are done with the text, free it
+ using the free() function.
*/
-char * Fl_Text_Buffer::line_text( int pos ) {
- return text_range( line_start( pos ), line_end( pos ) );
+char * Fl_Text_Buffer::line_text(int pos) {
+ return text_range(line_start(pos), line_end(pos));
}
-/*
-** Find the position of the start of the line containing position "pos"
-*/
-int Fl_Text_Buffer::line_start( int pos ) {
- if ( !findchar_backward( pos, '\n', &pos ) )
+/** Returns the position of the start of the line containing position \p pos. */
+int Fl_Text_Buffer::line_start(int pos) {
+ if (!findchar_backward(pos, '\n', &pos))
return 0;
return pos + 1;
}
-/*
-** Find the position of the end of the line containing position "pos"
-** (which is either a pointer to the newline character ending the line,
-** or a pointer to one character beyond the end of the buffer)
+/** Finds and returns the position of the end of the line containing position \p pos
+ (which is either a pointer to the newline character ending the line,
+ or a pointer to one character beyond the end of the buffer)
*/
-int Fl_Text_Buffer::line_end( int pos ) {
- if ( !findchar_forward( pos, '\n', &pos ) )
+int Fl_Text_Buffer::line_end(int pos) {
+ if (!findchar_forward(pos, '\n', &pos))
pos = mLength;
return pos;
}
-
-int Fl_Text_Buffer::word_start( int pos ) {
- while ( pos && ( isalnum( character( pos ) ) || character( pos ) == '_' ) ) {
+/** Returns the position corresponding to the start of the word */
+int Fl_Text_Buffer::word_start(int pos) {
+ while (pos && (isalnum(character(pos)) || character(pos) == '_')) {
pos--;
}
- if ( !( isalnum( character( pos ) ) || character( pos ) == '_' ) ) pos++;
+ if (!(isalnum(character(pos)) || character(pos) == '_')) pos++;
return pos;
}
-int Fl_Text_Buffer::word_end( int pos ) {
- while (pos < length() && (isalnum(character(pos)) || character(pos) == '_' )) {
+/** Returns the position corresponding to the end of the word.*/
+int Fl_Text_Buffer::word_end(int pos) {
+ while (pos < length() && (isalnum(character(pos)) || character(pos) == '_')) {
pos++;
}
return pos;
}
-/*
-** Get a character from the text buffer expanded into it's screen
-** representation (which may be several characters for a tab or a
-** control code). Returns the number of characters written to "outStr".
-** "indent" is the number of characters from the start of the line
-** for figuring tabs. Output string is guranteed to be shorter or
-** equal in length to FL_TEXT_MAX_EXP_CHAR_LEN
+/**
+ Expands the given character to a displayable format. Tabs and
+ other control characters are given special treatment.
+ Get a character from the text buffer expanded into its screen
+ representation (which may be several characters for a tab or a
+ control code). Returns the number of characters written to \p outStr.
+ \p indent is the number of characters from the start of the line
+ for figuring tabs. Output string is guranteed to be shorter or
+ equal in length to FL_TEXT_MAX_EXP_CHAR_LEN
*/
-int Fl_Text_Buffer::expand_character( int pos, int indent, char *outStr ) {
- return expand_character( character( pos ), indent, outStr,
- mTabDist, mNullSubsChar );
+int Fl_Text_Buffer::expand_character(int pos, int indent, char *outStr) {
+ int ret;
+ char c = character(pos);
+ ret = expand_character(c, indent, outStr,
+ mTabDist, mNullSubsChar);
+ if (ret > 1 && (c & 0x80)) {
+ int i;
+ i = fl_utf8len(c);
+ while (i > 1) {
+ i--;
+ pos++;
+ outStr++;
+ *outStr = character(pos);
+ }
+ }
+
+ return ret;
}
-/*
-** Expand a single character from the text buffer into it's screen
-** representation (which may be several characters for a tab or a
-** control code). Returns the number of characters added to "outStr".
-** "indent" is the number of characters from the start of the line
-** for figuring tabs. Output string is guranteed to be shorter or
-** equal in length to FL_TEXT_MAX_EXP_CHAR_LEN
+/**
+ Expand a single character \p c from the text buffer into it's displayable
+ screen representation (which may be several characters for a tab or a
+ control code). Returns the number of characters added to \p outStr.
+ \p indent is the number of characters from the start of the line
+ for figuring tabs of length \p tabDist. Output string is guaranteed
+ to be shorter or equal in length to FL_TEXT_MAX_EXP_CHAR_LEN
+ Tabs and other control characters are given special treatment.
+ \p nulSubsChar represent the null character to be transformed in \
*/
-int Fl_Text_Buffer::expand_character( char c, int indent, char *outStr, int tabDist,
- char nullSubsChar ) {
+int Fl_Text_Buffer::expand_character(char c, int indent, char *outStr, int tabDist,
+ char nullSubsChar) {
int i, nSpaces;
/* Convert tabs to spaces */
- if ( c == '\t' ) {
- nSpaces = tabDist - ( indent % tabDist );
- for ( i = 0; i < nSpaces; i++ )
+ if (c == '\t') {
+ nSpaces = tabDist - (indent % tabDist);
+ for (i = 0; i < nSpaces; i++)
outStr[ i ] = ' ';
return nSpaces;
}
/* Convert control codes to readable character sequences */
/*... is this safe with international character sets? */
- if ( ( ( unsigned char ) c ) <= 31 ) {
- sprintf( outStr, "<%s>", ControlCodeTable[ ( unsigned char ) c ] );
- return strlen( outStr );
- } else if ( c == 127 ) {
- sprintf( outStr, "" );
+ if (((unsigned char) c) <= 31) {
+ sprintf(outStr, "<%s>", ControlCodeTable[ (unsigned char) c ]);
+ return strlen(outStr);
+ } else if (c == 127) {
+ sprintf(outStr, "");
return 5;
- } else if ( c == nullSubsChar ) {
- sprintf( outStr, "" );
+ } else if (c == nullSubsChar) {
+ sprintf(outStr, "");
return 5;
+ } else if ((c & 0x80) && !(c & 0x40)) {
+ return 0;
+ } else if (c & 0x80) {
+ *outStr = c;
+ return fl_utf8len(c);
}
/* Otherwise, just return the character */
@@ -969,139 +1027,143 @@ int Fl_Text_Buffer::expand_character( char c, int indent, char *outStr, int tabD
return 1;
}
-/*
-** Return the length in displayed characters of character "c" expanded
-** for display (as discussed above in BufGetExpandedChar). If the
-** buffer for which the character width is being measured is doing null
-** substitution, nullSubsChar should be passed as that character (or nul
-** to ignore).
+/**
+ Return the length in displayed characters of character \p c expanded
+ for display (as discussed above in expand_character() ). If the
+ buffer for which the character width is being measured is doing null
+ substitution, nullSubsChar should be passed as that character (or nul
+ to ignore).
*/
-int Fl_Text_Buffer::character_width( char c, int indent, int tabDist, char nullSubsChar ) {
+int Fl_Text_Buffer::character_width(char c, int indent, int tabDist, char nullSubsChar) {
/* Note, this code must parallel that in Fl_Text_Buffer::ExpandCharacter */
- if ( c == '\t' )
- return tabDist - ( indent % tabDist );
- else if ( ( ( unsigned char ) c ) <= 31 )
- return strlen( ControlCodeTable[ ( unsigned char ) c ] ) + 2;
- else if ( c == 127 )
+ if (c == '\t')
+ return tabDist - (indent % tabDist);
+ else if (((unsigned char) c) <= 31)
+ return strlen(ControlCodeTable[ (unsigned char) c ]) + 2;
+ else if (c == 127)
return 5;
- else if ( c == nullSubsChar )
+ else if (c == nullSubsChar)
return 5;
+ else if ((c & 0x80) && !(c & 0x40))
+ return 0;
+ else if (c & 0x80) {
+ return fl_utf8len(c);
+ }
return 1;
}
-/*
-** Count the number of displayed characters between buffer position
-** "lineStartPos" and "targetPos". (displayed characters are the characters
-** shown on the screen to represent characters in the buffer, where tabs and
-** control characters are expanded)
+/**
+ Count the number of displayed characters between buffer position
+ \p lineStartPos and \p targetPos. (displayed characters are the characters
+ shown on the screen to represent characters in the buffer, where tabs and
+ control characters are expanded)
*/
-int Fl_Text_Buffer::count_displayed_characters( int lineStartPos, int targetPos ) {
+int Fl_Text_Buffer::count_displayed_characters(int lineStartPos, int targetPos) {
int pos, charCount = 0;
char expandedChar[ FL_TEXT_MAX_EXP_CHAR_LEN ];
pos = lineStartPos;
- while ( pos < targetPos )
- charCount += expand_character( pos++, charCount, expandedChar );
+ while (pos < targetPos)
+ charCount += expand_character(pos++, charCount, expandedChar);
return charCount;
}
-/*
-** Count forward from buffer position "startPos" in displayed characters
-** (displayed characters are the characters shown on the screen to represent
-** characters in the buffer, where tabs and control characters are expanded)
+/**
+ Count forward from buffer position \p startPos in displayed characters
+ (displayed characters are the characters shown on the screen to represent
+ characters in the buffer, where tabs and control characters are expanded)
*/
-int Fl_Text_Buffer::skip_displayed_characters( int lineStartPos, int nChars ) {
+int Fl_Text_Buffer::skip_displayed_characters(int lineStartPos, int nChars) {
int pos, charCount = 0;
char c;
pos = lineStartPos;
- while ( charCount < nChars && pos < mLength ) {
- c = character( pos );
- if ( c == '\n' )
+ while (charCount < nChars && pos < mLength) {
+ c = character(pos);
+ if (c == '\n')
return pos;
- charCount += character_width( c, charCount, mTabDist, mNullSubsChar );
+ charCount += character_width(c, charCount, mTabDist, mNullSubsChar);
pos++;
}
return pos;
}
-/*
-** Count the number of newlines between startPos and endPos in buffer "buf".
-** The character at position "endPos" is not counted.
+/**
+ Counts the number of newlines between \p startPos and \p endPos in buffer.
+ The character at position \p endPos is not counted.
*/
-int Fl_Text_Buffer::count_lines( int startPos, int endPos ) {
+int Fl_Text_Buffer::count_lines(int startPos, int endPos) {
int pos, gapLen = mGapEnd - mGapStart;
int lineCount = 0;
pos = startPos;
- while ( pos < mGapStart ) {
- if ( pos == endPos )
+ while (pos < mGapStart) {
+ if (pos == endPos)
return lineCount;
- if ( mBuf[ pos++ ] == '\n' )
+ if (mBuf[ pos++ ] == '\n')
lineCount++;
}
- while ( pos < mLength ) {
- if ( pos == endPos )
+ while (pos < mLength) {
+ if (pos == endPos)
return lineCount;
- if ( mBuf[ pos++ + gapLen ] == '\n' )
+ if (mBuf[ pos++ + gapLen ] == '\n')
lineCount++;
}
return lineCount;
}
-/*
-** Find the first character of the line "nLines" forward from "startPos"
-** in "buf" and return its position
+/**
+ Finds the first character of the line \p nLines forward from \p startPos
+ in the buffer and returns its position
*/
-int Fl_Text_Buffer::skip_lines( int startPos, int nLines ) {
+int Fl_Text_Buffer::skip_lines(int startPos, int nLines) {
int pos, gapLen = mGapEnd - mGapStart;
int lineCount = 0;
- if ( nLines == 0 )
+ if (nLines == 0)
return startPos;
pos = startPos;
- while ( pos < mGapStart ) {
- if ( mBuf[ pos++ ] == '\n' ) {
+ while (pos < mGapStart) {
+ if (mBuf[ pos++ ] == '\n') {
lineCount++;
- if ( lineCount == nLines )
+ if (lineCount == nLines)
return pos;
}
}
- while ( pos < mLength ) {
- if ( mBuf[ pos++ + gapLen ] == '\n' ) {
+ while (pos < mLength) {
+ if (mBuf[ pos++ + gapLen ] == '\n') {
lineCount++;
- if ( lineCount >= nLines )
+ if (lineCount >= nLines)
return pos;
}
}
return pos;
}
-/*
-** Find the position of the first character of the line "nLines" backwards
-** from "startPos" (not counting the character pointed to by "startpos" if
-** that is a newline) in "buf". nLines == 0 means find the beginning of
-** the line
+/**
+ Finds and returns the position of the first character of the line \p nLines backwards
+ from \p startPos (not counting the character pointed to by \p startpos if
+ that is a newline) in the buffer. \p nLines == 0 means find the beginning of the line
*/
-int Fl_Text_Buffer::rewind_lines( int startPos, int nLines ) {
+int Fl_Text_Buffer::rewind_lines(int startPos, int nLines) {
int pos, gapLen = mGapEnd - mGapStart;
int lineCount = -1;
pos = startPos - 1;
- if ( pos <= 0 )
+ if (pos <= 0)
return 0;
- while ( pos >= mGapStart ) {
- if ( mBuf[ pos + gapLen ] == '\n' ) {
- if ( ++lineCount >= nLines )
+ while (pos >= mGapStart) {
+ if (mBuf[ pos + gapLen ] == '\n') {
+ if (++lineCount >= nLines)
return pos + 1;
}
pos--;
}
- while ( pos >= 0 ) {
- if ( mBuf[ pos ] == '\n' ) {
- if ( ++lineCount >= nLines )
+ while (pos >= 0) {
+ if (mBuf[ pos ] == '\n') {
+ if (++lineCount >= nLines)
return pos + 1;
}
pos--;
@@ -1109,13 +1171,13 @@ int Fl_Text_Buffer::rewind_lines( int startPos, int nLines ) {
return 0;
}
-/*
-** Search forwards in buffer for string "searchString", starting with the
-** character "startPos", and returning the result in "foundPos"
-** returns 1 if found, 0 if not.
+/**
+ Search forwards in buffer for string \p searchString, starting with the
+ character \p startPos, and returning the result in \p foundPos
+ returns 1 if found, 0 if not.
*/
-int Fl_Text_Buffer::search_forward( int startPos, const char *searchString,
- int *foundPos, int matchCase )
+int Fl_Text_Buffer::search_forward(int startPos, const char *searchString,
+ int *foundPos, int matchCase)
{
if (!searchString) return 0;
int bp;
@@ -1133,13 +1195,13 @@ int Fl_Text_Buffer::search_forward( int startPos, const char *searchString,
return 0;
}
-/*
-** Search backwards in buffer for string "searchString", starting with the
-** character BEFORE "startPos", returning the result in "foundPos"
-** returns 1 if found, 0 if not.
+/**
+ Search backwards in buffer for string searchCharssearchString, starting with the
+ character BEFORE \p startPos, returning the result in \p foundPos
+ returns 1 if found, 0 if not.
*/
-int Fl_Text_Buffer::search_backward( int startPos, const char *searchString,
- int *foundPos, int matchCase )
+int Fl_Text_Buffer::search_backward(int startPos, const char *searchString,
+ int *foundPos, int matchCase)
{
if (!searchString) return 0;
int bp;
@@ -1157,29 +1219,30 @@ int Fl_Text_Buffer::search_backward( int startPos, const char *searchString,
return 0;
}
-/*
-** Search forwards in buffer for characters in "searchChars", starting
-** with the character "startPos", and returning the result in "foundPos"
-** returns 1 if found, 0 if not.
+/**
+ Finds the next occurrence of the specified characters.
+ Search forwards in buffer for characters in \p searchChars, starting
+ with the character \p startPos, and returning the result in \p foundPos
+ returns 1 if found, 0 if not.
*/
-int Fl_Text_Buffer::findchars_forward( int startPos, const char *searchChars,
- int *foundPos ) {
+int Fl_Text_Buffer::findchars_forward(int startPos, const char *searchChars,
+ int *foundPos) {
int pos, gapLen = mGapEnd - mGapStart;
const char *c;
pos = startPos;
- while ( pos < mGapStart ) {
- for ( c = searchChars; *c != '\0'; c++ ) {
- if ( mBuf[ pos ] == *c ) {
+ while (pos < mGapStart) {
+ for (c = searchChars; *c != '\0'; c++) {
+ if (mBuf[ pos ] == *c) {
*foundPos = pos;
return 1;
}
}
pos++;
}
- while ( pos < mLength ) {
- for ( c = searchChars; *c != '\0'; c++ ) {
- if ( mBuf[ pos + gapLen ] == *c ) {
+ while (pos < mLength) {
+ for (c = searchChars; *c != '\0'; c++) {
+ if (mBuf[ pos + gapLen ] == *c) {
*foundPos = pos;
return 1;
}
@@ -1190,33 +1253,34 @@ int Fl_Text_Buffer::findchars_forward( int startPos, const char *searchChars,
return 0;
}
-/*
-** Search backwards in buffer for characters in "searchChars", starting
-** with the character BEFORE "startPos", returning the result in "foundPos"
-** returns 1 if found, 0 if not.
+/**
+ Finds the previous occurrence of the specified characters.
+ Search backwards in buffer for characters in \p searchChars, starting
+ with the character BEFORE \p startPos, returning the result in \p foundPos
+ returns 1 if found, 0 if not.
*/
-int Fl_Text_Buffer::findchars_backward( int startPos, const char *searchChars,
- int *foundPos ) {
+int Fl_Text_Buffer::findchars_backward(int startPos, const char *searchChars,
+ int *foundPos) {
int pos, gapLen = mGapEnd - mGapStart;
const char *c;
- if ( startPos == 0 ) {
+ if (startPos == 0) {
*foundPos = 0;
return 0;
}
pos = startPos == 0 ? 0 : startPos - 1;
- while ( pos >= mGapStart ) {
- for ( c = searchChars; *c != '\0'; c++ ) {
- if ( mBuf[ pos + gapLen ] == *c ) {
+ while (pos >= mGapStart) {
+ for (c = searchChars; *c != '\0'; c++) {
+ if (mBuf[ pos + gapLen ] == *c) {
*foundPos = pos;
return 1;
}
}
pos--;
}
- while ( pos >= 0 ) {
- for ( c = searchChars; *c != '\0'; c++ ) {
- if ( mBuf[ pos ] == *c ) {
+ while (pos >= 0) {
+ for (c = searchChars; *c != '\0'; c++) {
+ if (mBuf[ pos ] == *c) {
*foundPos = pos;
return 1;
}
@@ -1228,146 +1292,146 @@ int Fl_Text_Buffer::findchars_backward( int startPos, const char *searchChars,
}
/*
-** A horrible design flaw in NEdit (from the very start, before we knew that
-** NEdit would become so popular), is that it uses C NULL terminated strings
-** to hold text. This means editing text containing NUL characters is not
-** possible without special consideration. Here is the special consideration.
-** The routines below maintain a special substitution-character which stands
-** in for a null, and translates strings an buffers back and forth from/to
-** the substituted form, figure out what to substitute, and figure out
-** when we're in over our heads and no translation is possible.
+ A horrible design flaw in NEdit (from the very start, before we knew that
+ NEdit would become so popular), is that it uses C NULL terminated strings
+ to hold text. This means editing text containing NUL characters is not
+ possible without special consideration. Here is the special consideration.
+ The routines below maintain a special substitution-character which stands
+ in for a null, and translates strings an buffers back and forth from/to
+ the substituted form, figure out what to substitute, and figure out
+ when we're in over our heads and no translation is possible.
*/
-/*
-** The primary routine for integrating new text into a text buffer with
-** substitution of another character for ascii nuls. This substitutes null
-** characters in the string in preparation for being copied or replaced
-** into the buffer, and if neccessary, adjusts the buffer as well, in the
-** event that the string contains the character it is currently using for
-** substitution. Returns 0, if substitution is no longer possible
-** because all non-printable characters are already in use.
+/**
+ The primary routine for integrating new text into a text buffer with
+ substitution of another character for ascii nuls. This substitutes null
+ characters in the string in preparation for being copied or replaced
+ into the buffer, and if necessary, adjusts the buffer as well, in the
+ event that the string contains the character it is currently using for
+ substitution. Returns 0, if substitution is no longer possible
+ because all non-printable characters are already in use.
*/
-int Fl_Text_Buffer::substitute_null_characters( char *string, int len ) {
+int Fl_Text_Buffer::substitute_null_characters(char *string, int len) {
char histogram[ 256 ];
/* Find out what characters the string contains */
- histogramCharacters( string, len, histogram, 1 );
+ histogramCharacters(string, len, histogram, 1);
/* Does the string contain the null-substitute character? If so, re-
histogram the buffer text to find a character which is ok in both the
string and the buffer, and change the buffer's null-substitution
character. If none can be found, give up and return 0 */
- if ( histogram[ ( unsigned char ) mNullSubsChar ] != 0 ) {
+ if (histogram[ (unsigned char) mNullSubsChar ] != 0) {
char * bufString;
char newSubsChar;
bufString = (char*)text();
- histogramCharacters( bufString, mLength, histogram, 0 );
- newSubsChar = chooseNullSubsChar( histogram );
- if ( newSubsChar == '\0' )
+ histogramCharacters(bufString, mLength, histogram, 0);
+ newSubsChar = chooseNullSubsChar(histogram);
+ if (newSubsChar == '\0')
return 0;
- subsChars( bufString, mLength, mNullSubsChar, newSubsChar );
- remove_( 0, mLength );
- insert_( 0, bufString );
- free( (void *) bufString );
+ subsChars(bufString, mLength, mNullSubsChar, newSubsChar);
+ remove_(0, mLength);
+ insert_(0, bufString);
+ free((void *) bufString);
mNullSubsChar = newSubsChar;
}
/* If the string contains null characters, substitute them with the
buffer's null substitution character */
- if ( histogram[ 0 ] != 0 )
- subsChars( string, len, '\0', mNullSubsChar );
+ if (histogram[ 0 ] != 0)
+ subsChars(string, len, '\0', mNullSubsChar);
return 1;
}
-/*
-** Convert strings obtained from buffers which contain null characters, which
-** have been substituted for by a special substitution character, back to
-** a null-containing string. There is no time penalty for calling this
-** routine if no substitution has been done.
+/**
+ Converts strings obtained from buffers which contain null characters, which
+ have been substituted for by a special substitution character, back to
+ a null-containing string. There is no time penalty for calling this
+ routine if no substitution has been done.
*/
-void Fl_Text_Buffer::unsubstitute_null_characters( char *string ) {
+void Fl_Text_Buffer::unsubstitute_null_characters(char *string) {
register char * c, subsChar = mNullSubsChar;
- if ( subsChar == '\0' )
+ if (subsChar == '\0')
return;
- for ( c = string; *c != '\0'; c++ )
- if ( *c == subsChar )
+ for (c = string; *c != '\0'; c++)
+ if (*c == subsChar)
* c = '\0';
}
-/*
-** Create a pseudo-histogram of the characters in a string (don't actually
-** count, because we don't want overflow, just mark the character's presence
-** with a 1). If init is true, initialize the histogram before acumulating.
-** if not, add the new data to an existing histogram.
+/**
+ Creates a pseudo-histogram of the characters in a string (don't actually
+ count, because we don't want overflow, just mark the character's presence
+ with a 1). If init is true, initialize the histogram before acumulating.
+ if not, add the new data to an existing histogram.
*/
-static void histogramCharacters( const char *string, int length, char hist[ 256 ],
- int init ) {
+static void histogramCharacters(const char *string, int length, char hist[ 256 ],
+ int init) {
int i;
const char *c;
- if ( init )
- for ( i = 0; i < 256; i++ )
+ if (init)
+ for (i = 0; i < 256; i++)
hist[ i ] = 0;
- for ( c = string; c < &string[ length ]; c++ )
- hist[ *( ( unsigned char * ) c ) ] |= 1;
+ for (c = string; c < &string[ length ]; c++)
+ hist[ *((unsigned char *) c) ] |= 1;
}
-/*
-** Substitute fromChar with toChar in string.
+/**
+ Substitute fromChar with toChar in string.
*/
-static void subsChars( char *string, int length, char fromChar, char toChar ) {
+static void subsChars(char *string, int length, char fromChar, char toChar) {
char * c;
- for ( c = string; c < &string[ length ]; c++ )
- if ( *c == fromChar ) * c = toChar;
+ for (c = string; c < &string[ length ]; c++)
+ if (*c == fromChar) * c = toChar;
}
-/*
-** Search through ascii control characters in histogram in order of least
-** likelihood of use, find an unused character to use as a stand-in for a
-** null. If the character set is full (no available characters outside of
-** the printable set, return the null character.
+/**
+ Search through ascii control characters in histogram in order of least
+ likelihood of use, find an unused character to use as a stand-in for a
+ null. If the character set is full (no available characters outside of
+ the printable set, return the null character.
*/
-static char chooseNullSubsChar( char hist[ 256 ] ) {
+static char chooseNullSubsChar(char hist[ 256 ]) {
#define N_REPLACEMENTS 25
static char replacements[ N_REPLACEMENTS ] = {1, 2, 3, 4, 5, 6, 14, 15, 16, 17, 18, 19,
20, 21, 22, 23, 24, 25, 26, 28, 29, 30, 31, 11, 7};
int i;
- for ( i = 0; i < N_REPLACEMENTS; i++ )
- if ( hist[ replacements[ i ] ] == 0 )
+ for (i = 0; i < N_REPLACEMENTS; i++)
+ if (hist[ replacements[ i ] ] == 0)
return replacements[ i ];
return '\0';
}
-/*
-** Internal (non-redisplaying) version of BufInsert. Returns the length of
-** text inserted (this is just strlen(text), however this calculation can be
-** expensive and the length will be required by any caller who will continue
-** on to call redisplay). pos must be contiguous with the existing text in
-** the buffer (i.e. not past the end).
+/**
+ Internal (non-redisplaying) version of BufInsert. Returns the length of
+ text inserted (this is just strlen(\p text), however this calculation can be
+ expensive and the length will be required by any caller who will continue
+ on to call redisplay). \p pos must be contiguous with the existing text in
+ the buffer (i.e. not past the end).
*/
-int Fl_Text_Buffer::insert_( int pos, const char *s ) {
- int insertedLength = strlen( s );
+int Fl_Text_Buffer::insert_(int pos, const char *text) {
+ int insertedLength = strlen(text);
/* Prepare the buffer to receive the new text. If the new text fits in
the current buffer, just move the gap (if necessary) to where
the text should be inserted. If the new text is too large, reallocate
the buffer with a gap large enough to accomodate the new text and a
- gap of PREFERRED_GAP_SIZE */
- if ( insertedLength > mGapEnd - mGapStart )
- reallocate_with_gap( pos, insertedLength + PREFERRED_GAP_SIZE );
- else if ( pos != mGapStart )
- move_gap( pos );
+ gap of mPreferredGapSize */
+ if (insertedLength > mGapEnd - mGapStart)
+ reallocate_with_gap(pos, insertedLength + mPreferredGapSize);
+ else if (pos != mGapStart)
+ move_gap(pos);
/* Insert the new text (pos now corresponds to the start of the gap) */
- memcpy( &mBuf[ pos ], s, insertedLength );
+ memcpy(&mBuf[ pos ], text, insertedLength);
mGapStart += insertedLength;
mLength += insertedLength;
- update_selections( pos, 0, insertedLength );
+ update_selections(pos, 0, insertedLength);
if (mCanUndo) {
- if ( undowidget==this && undoat==pos && undoinsert ) {
+ if (undowidget==this && undoat==pos && undoinsert) {
undoinsert += insertedLength;
}
else {
@@ -1382,18 +1446,18 @@ int Fl_Text_Buffer::insert_( int pos, const char *s ) {
return insertedLength;
}
-/*
-** Internal (non-redisplaying) version of BufRemove. Removes the contents
-** of the buffer between start and end (and moves the gap to the site of
-** the delete).
+/**
+ Internal (non-redisplaying) version of BufRemove. Removes the contents
+ of the buffer between start and end (and moves the gap to the site of
+ the delete).
*/
-void Fl_Text_Buffer::remove_( int start, int end ) {
+void Fl_Text_Buffer::remove_(int start, int end) {
/* if the gap is not contiguous to the area to remove, move it there */
if (mCanUndo) {
- if ( undowidget==this && undoat==end && undocut ) {
- undobuffersize( undocut+end-start+1 );
- memmove( undobuffer+end-start, undobuffer, undocut );
+ if (undowidget==this && undoat==end && undocut) {
+ undobuffersize(undocut+end-start+1);
+ memmove(undobuffer+end-start, undobuffer, undocut);
undocut += end-start;
}
else {
@@ -1406,21 +1470,21 @@ void Fl_Text_Buffer::remove_( int start, int end ) {
undowidget = this;
}
- if ( start > mGapStart ) {
+ if (start > mGapStart) {
if (mCanUndo)
- memcpy( undobuffer, mBuf+(mGapEnd-mGapStart)+start, end-start );
- move_gap( start );
+ memcpy(undobuffer, mBuf+(mGapEnd-mGapStart)+start, end-start);
+ move_gap(start);
}
- else if ( end < mGapStart ) {
+ else if (end < mGapStart) {
if (mCanUndo)
- memcpy( undobuffer, mBuf+start, end-start );
- move_gap( end );
+ memcpy(undobuffer, mBuf+start, end-start);
+ move_gap(end);
}
else {
int prelen = mGapStart - start;
if (mCanUndo) {
- memcpy( undobuffer, mBuf+start, prelen );
- memcpy( undobuffer+prelen, mBuf+mGapEnd, end-start-prelen);
+ memcpy(undobuffer, mBuf+start, prelen);
+ memcpy(undobuffer+prelen, mBuf+mGapEnd, end-start-prelen);
}
}
@@ -1432,20 +1496,20 @@ void Fl_Text_Buffer::remove_( int start, int end ) {
mLength -= end - start;
/* fix up any selections which might be affected by the change */
- update_selections( start, end - start, 0 );
+ update_selections(start, end - start, 0);
}
-/*
-** Insert a column of text without calling the modify callbacks. Note that
-** in some pathological cases, inserting can actually decrease the size of
-** the buffer because of spaces being coalesced into tabs. "nDeleted" and
-** "nInserted" return the number of characters deleted and inserted beginning
-** at the start of the line containing "startPos". "endPos" returns buffer
-** position of the lower left edge of the inserted column (as a hint for
-** routines which need to set a cursor position).
+/**
+ Inserts a column of text without calling the modify callbacks. Note that
+ in some pathological cases, inserting can actually decrease the size of
+ the buffer because of spaces being coalesced into tabs. \p nDeleted and
+ \p nInserted return the number of characters deleted and inserted beginning
+ at the start of the line containing \p startPos. \p endPos returns buffer
+ position of the lower left edge of the inserted column (as a hint for
+ routines which need to set a cursor position).
*/
-void Fl_Text_Buffer::insert_column_( int column, int startPos, const char *insText,
- int *nDeleted, int *nInserted, int *endPos ) {
+void Fl_Text_Buffer::insert_column_(int column, int startPos, const char *insText,
+ int *nDeleted, int *nInserted, int *endPos) {
int nLines, start, end, insWidth, lineStart, lineEnd;
int expReplLen, expInsLen, len, endOffset;
char *c, *outStr, *outPtr, *expText, *insLine;
@@ -1453,7 +1517,7 @@ void Fl_Text_Buffer::insert_column_( int column, int startPos, const char *insTe
const char *replText;
const char *insPtr;
- if ( column < 0 )
+ if (column < 0)
column = 0;
/* Allocate a buffer for the replacement string large enough to hold
@@ -1466,20 +1530,20 @@ void Fl_Text_Buffer::insert_column_( int column, int startPos, const char *insTe
the text beyond the inserted column. (Space for additional
newlines if the inserted text extends beyond the end of the buffer
is counted with the length of insText) */
- start = line_start( startPos );
- nLines = countLines( insText ) + 1;
- insWidth = textWidth( insText, mTabDist, mNullSubsChar );
- end = line_end( skip_lines( start, nLines - 1 ) );
- replText = text_range( start, end );
- expText = expandTabs( replText, 0, mTabDist, mNullSubsChar,
- &expReplLen );
- free( (void *) replText );
- free( (void *) expText );
- expText = expandTabs( insText, 0, mTabDist, mNullSubsChar,
- &expInsLen );
- free( (void *) expText );
- outStr = (char *)malloc( expReplLen + expInsLen +
- nLines * ( column + insWidth + FL_TEXT_MAX_EXP_CHAR_LEN ) + 1 );
+ start = line_start(startPos);
+ nLines = countLines(insText) + 1;
+ insWidth = textWidth(insText, mTabDist, mNullSubsChar);
+ end = line_end(skip_lines(start, nLines - 1));
+ replText = text_range(start, end);
+ expText = expandTabs(replText, 0, mTabDist, mNullSubsChar,
+ &expReplLen);
+ free((void *) replText);
+ free((void *) expText);
+ expText = expandTabs(insText, 0, mTabDist, mNullSubsChar,
+ &expInsLen);
+ free((void *) expText);
+ outStr = (char *)malloc(expReplLen + expInsLen +
+ nLines * (column + insWidth + FL_TEXT_MAX_EXP_CHAR_LEN) + 1);
/* Loop over all lines in the buffer between start and end removing the
text between rectStart and rectEnd and padding appropriately. Trim
@@ -1489,46 +1553,46 @@ void Fl_Text_Buffer::insert_column_( int column, int startPos, const char *insTe
lineStart = start;
insPtr = insText;
for (;;) {
- lineEnd = line_end( lineStart );
- line = text_range( lineStart, lineEnd );
- insLine = copyLine( insPtr, &len );
+ lineEnd = line_end(lineStart);
+ line = text_range(lineStart, lineEnd);
+ insLine = copyLine(insPtr, &len);
insPtr += len;
- insertColInLine( line, insLine, column, insWidth, mTabDist,
- mUseTabs, mNullSubsChar, outPtr, &len, &endOffset );
- free( (void *) line );
- free( (void *) insLine );
- for ( c = outPtr + len - 1; c > outPtr && isspace( *c ); c-- )
+ insertColInLine(line, insLine, column, insWidth, mTabDist,
+ mUseTabs, mNullSubsChar, outPtr, &len, &endOffset);
+ free((void *) line);
+ free((void *) insLine);
+ for (c = outPtr + len - 1; c > outPtr && isspace(*c); c--)
len--;
outPtr += len;
*outPtr++ = '\n';
lineStart = lineEnd < mLength ? lineEnd + 1 : mLength;
- if ( *insPtr == '\0' )
+ if (*insPtr == '\0')
break;
insPtr++;
}
- if ( outPtr != outStr )
+ if (outPtr != outStr)
outPtr--; /* trim back off extra newline */
*outPtr = '\0';
/* replace the text between start and end with the new stuff */
- remove_( start, end );
- insert_( start, outStr );
+ remove_(start, end);
+ insert_(start, outStr);
*nInserted = outPtr - outStr;
*nDeleted = end - start;
- *endPos = start + ( outPtr - outStr ) - len + endOffset;
- free( (void *) outStr );
+ *endPos = start + (outPtr - outStr) - len + endOffset;
+ free((void *) outStr);
}
-/*
-** Delete a rectangle of text without calling the modify callbacks. Returns
-** the number of characters replacing those between start and end. Note that
-** in some pathological cases, deleting can actually increase the size of
-** the buffer because of tab expansions. "endPos" returns the buffer position
-** of the point in the last line where the text was removed (as a hint for
-** routines which need to position the cursor after a delete operation)
+/**
+ Deletes a rectangle of text without calling the modify callbacks. Returns
+ the number of characters replacing those between \p start and \p end. Note that
+ in some pathological cases, deleting can actually increase the size of
+ the buffer because of tab expansions. \p endPos returns the buffer position
+ of the point in the last line where the text was removed (as a hint for
+ routines which need to position the cursor after a delete operation)
*/
-void Fl_Text_Buffer::remove_rectangular_( int start, int end, int rectStart,
- int rectEnd, int *replaceLen, int *endPos ) {
+void Fl_Text_Buffer::remove_rectangular_(int start, int end, int rectStart,
+ int rectEnd, int *replaceLen, int *endPos) {
int nLines, lineStart, lineEnd, len, endOffset;
char *outStr, *outPtr, *expText;
const char *s, *line;
@@ -1537,53 +1601,53 @@ void Fl_Text_Buffer::remove_rectangular_( int start, int end, int rectStart,
possibly expanded tabs as well as an additional FL_TEXT_MAX_EXP_CHAR_LEN * 2
characters per line for padding where tabs and control characters cross
the edges of the selection */
- start = line_start( start );
- end = line_end( end );
- nLines = count_lines( start, end ) + 1;
- s = text_range( start, end );
- expText = expandTabs( s, 0, mTabDist, mNullSubsChar, &len );
- free( (void *) s );
- free( (void *) expText );
- outStr = (char *)malloc( len + nLines * FL_TEXT_MAX_EXP_CHAR_LEN * 2 + 1 );
+ start = line_start(start);
+ end = line_end(end);
+ nLines = count_lines(start, end) + 1;
+ s = text_range(start, end);
+ expText = expandTabs(s, 0, mTabDist, mNullSubsChar, &len);
+ free((void *) s);
+ free((void *) expText);
+ outStr = (char *)malloc(len + nLines * FL_TEXT_MAX_EXP_CHAR_LEN * 2 + 1);
/* loop over all lines in the buffer between start and end removing
the text between rectStart and rectEnd and padding appropriately */
lineStart = start;
outPtr = outStr;
endOffset = 0;
- while ( lineStart <= mLength && lineStart <= end ) {
- lineEnd = line_end( lineStart );
- line = text_range( lineStart, lineEnd );
- deleteRectFromLine( line, rectStart, rectEnd, mTabDist,
- mUseTabs, mNullSubsChar, outPtr, &len, &endOffset );
- free( (void *) line );
+ while (lineStart <= mLength && lineStart <= end) {
+ lineEnd = line_end(lineStart);
+ line = text_range(lineStart, lineEnd);
+ deleteRectFromLine(line, rectStart, rectEnd, mTabDist,
+ mUseTabs, mNullSubsChar, outPtr, &len, &endOffset);
+ free((void *) line);
outPtr += len;
*outPtr++ = '\n';
lineStart = lineEnd + 1;
}
- if ( outPtr != outStr )
+ if (outPtr != outStr)
outPtr--; /* trim back off extra newline */
*outPtr = '\0';
/* replace the text between start and end with the newly created string */
- remove_( start, end );
- insert_( start, outStr );
+ remove_(start, end);
+ insert_(start, outStr);
*replaceLen = outPtr - outStr;
- *endPos = start + ( outPtr - outStr ) - len + endOffset;
- free( (void *) outStr );
+ *endPos = start + (outPtr - outStr) - len + endOffset;
+ free((void *) outStr);
}
-/*
-** Overlay a rectangular area of text without calling the modify callbacks.
-** "nDeleted" and "nInserted" return the number of characters deleted and
-** inserted beginning at the start of the line containing "startPos".
-** "endPos" returns buffer position of the lower left edge of the inserted
-** column (as a hint for routines which need to set a cursor position).
+/**
+ Overlay a rectangular area of text without calling the modify callbacks.
+ \p nDeleted and \p nInserted return the number of characters deleted and
+ inserted beginning at the start of the line containing \p startPos.
+ \p endPos returns buffer position of the lower left edge of the inserted
+ column (as a hint for routines which need to set a cursor position).
*/
void Fl_Text_Buffer::overlay_rectangular_(int startPos, int rectStart,
int rectEnd, const char *insText,
int *nDeleted, int *nInserted,
- int *endPos ) {
+ int *endPos) {
int nLines, start, end, lineStart, lineEnd;
int expInsLen, len, endOffset;
char *c, *outStr, *outPtr, *expText, *insLine;
@@ -1599,14 +1663,14 @@ void Fl_Text_Buffer::overlay_rectangular_(int startPos, int rectStart,
must be padded to align the text beyond the inserted column. (Space
for additional newlines if the inserted text extends beyond the end
of the buffer is counted with the length of insText) */
- start = line_start( startPos );
- nLines = countLines( insText ) + 1;
- end = line_end( skip_lines( start, nLines - 1 ) );
- expText = expandTabs( insText, 0, mTabDist, mNullSubsChar,
- &expInsLen );
- free( (void *) expText );
- outStr = (char *)malloc( end - start + expInsLen +
- nLines * ( rectEnd + FL_TEXT_MAX_EXP_CHAR_LEN ) + 1 );
+ start = line_start(startPos);
+ nLines = countLines(insText) + 1;
+ end = line_end(skip_lines(start, nLines - 1));
+ expText = expandTabs(insText, 0, mTabDist, mNullSubsChar,
+ &expInsLen);
+ free((void *) expText);
+ outStr = (char *)malloc(end - start + expInsLen +
+ nLines * (rectEnd + FL_TEXT_MAX_EXP_CHAR_LEN) + 1);
/* Loop over all lines in the buffer between start and end overlaying the
text between rectStart and rectEnd and padding appropriately. Trim
@@ -1616,47 +1680,47 @@ void Fl_Text_Buffer::overlay_rectangular_(int startPos, int rectStart,
lineStart = start;
insPtr = insText;
for (;;) {
- lineEnd = line_end( lineStart );
- line = text_range( lineStart, lineEnd );
- insLine = copyLine( insPtr, &len );
+ lineEnd = line_end(lineStart);
+ line = text_range(lineStart, lineEnd);
+ insLine = copyLine(insPtr, &len);
insPtr += len;
- overlayRectInLine( line, insLine, rectStart, rectEnd, mTabDist,
- mUseTabs, mNullSubsChar, outPtr, &len, &endOffset );
- free( (void *) line );
- free( (void *) insLine );
- for ( c = outPtr + len - 1; c > outPtr && isspace( *c ); c-- )
+ overlayRectInLine(line, insLine, rectStart, rectEnd, mTabDist,
+ mUseTabs, mNullSubsChar, outPtr, &len, &endOffset);
+ free((void *) line);
+ free((void *) insLine);
+ for (c = outPtr + len - 1; c > outPtr && isspace(*c); c--)
len--;
outPtr += len;
*outPtr++ = '\n';
lineStart = lineEnd < mLength ? lineEnd + 1 : mLength;
- if ( *insPtr == '\0' )
+ if (*insPtr == '\0')
break;
insPtr++;
}
- if ( outPtr != outStr )
+ if (outPtr != outStr)
outPtr--; /* trim back off extra newline */
*outPtr = '\0';
/* replace the text between start and end with the new stuff */
- remove_( start, end );
- insert_( start, outStr );
+ remove_(start, end);
+ insert_(start, outStr);
*nInserted = outPtr - outStr;
*nDeleted = end - start;
- *endPos = start + ( outPtr - outStr ) - len + endOffset;
- free( (void *) outStr );
+ *endPos = start + (outPtr - outStr) - len + endOffset;
+ free((void *) outStr);
}
-/*
-** Insert characters from single-line string "insLine" in single-line string
-** "line" at "column", leaving "insWidth" space before continuing line.
-** "outLen" returns the number of characters written to "outStr", "endOffset"
-** returns the number of characters from the beginning of the string to
-** the right edge of the inserted text (as a hint for routines which need
-** to position the cursor).
+/**
+ Inserts characters from single-line string \p insLine in single-line string
+ \p line at \p column, leaving \p insWidth space before continuing line.
+ \p outLen returns the number of characters written to \p outStr, \p endOffset
+ returns the number of characters from the beginning of the string to
+ the right edge of the inserted text (as a hint for routines which need
+ to position the cursor).
*/
-static void insertColInLine( const char *line, char *insLine, int column, int insWidth,
+static void insertColInLine(const char *line, char *insLine, int column, int insWidth,
int tabDist, int useTabs, char nullSubsChar, char *outStr, int *outLen,
- int *endOffset ) {
+ int *endOffset) {
char * c, *outPtr, *retabbedStr;
const char *linePtr;
int indent, toIndent, len, postColIndent;
@@ -1664,9 +1728,9 @@ static void insertColInLine( const char *line, char *insLine, int column, int in
/* copy the line up to "column" */
outPtr = outStr;
indent = 0;
- for ( linePtr = line; *linePtr != '\0'; linePtr++ ) {
- len = Fl_Text_Buffer::character_width( *linePtr, indent, tabDist, nullSubsChar );
- if ( indent + len > column )
+ for (linePtr = line; *linePtr != '\0'; linePtr++) {
+ len = Fl_Text_Buffer::character_width(*linePtr, indent, tabDist, nullSubsChar);
+ if (indent + len > column)
break;
indent += len;
*outPtr++ = *linePtr;
@@ -1676,9 +1740,9 @@ static void insertColInLine( const char *line, char *insLine, int column, int in
tab, leave it off and leave the indent short and it will get padded
later. If it's a control character, insert it and adjust indent
accordingly. */
- if ( indent < column && *linePtr != '\0' ) {
+ if (indent < column && *linePtr != '\0') {
postColIndent = indent + len;
- if ( *linePtr == '\t' )
+ if (*linePtr == '\t')
linePtr++;
else {
*outPtr++ = *linePtr++;
@@ -1688,33 +1752,33 @@ static void insertColInLine( const char *line, char *insLine, int column, int in
postColIndent = indent;
/* If there's no text after the column and no text to insert, that's all */
- if ( *insLine == '\0' && *linePtr == '\0' ) {
+ if (*insLine == '\0' && *linePtr == '\0') {
*outLen = *endOffset = outPtr - outStr;
return;
}
/* pad out to column if text is too short */
- if ( indent < column ) {
- addPadding( outPtr, indent, column, tabDist, useTabs, nullSubsChar, &len );
+ if (indent < column) {
+ addPadding(outPtr, indent, column, tabDist, useTabs, nullSubsChar, &len);
outPtr += len;
indent = column;
}
/* Copy the text from "insLine" (if any), recalculating the tabs as if
the inserted string began at column 0 to its new column destination */
- if ( *insLine != '\0' ) {
- retabbedStr = realignTabs( insLine, 0, indent, tabDist, useTabs,
- nullSubsChar, &len );
- for ( c = retabbedStr; *c != '\0'; c++ ) {
+ if (*insLine != '\0') {
+ retabbedStr = realignTabs(insLine, 0, indent, tabDist, useTabs,
+ nullSubsChar, &len);
+ for (c = retabbedStr; *c != '\0'; c++) {
*outPtr++ = *c;
- len = Fl_Text_Buffer::character_width( *c, indent, tabDist, nullSubsChar );
+ len = Fl_Text_Buffer::character_width(*c, indent, tabDist, nullSubsChar);
indent += len;
}
- free( (void *) retabbedStr );
+ free((void *) retabbedStr);
}
/* If the original line did not extend past "column", that's all */
- if ( *linePtr == '\0' ) {
+ if (*linePtr == '\0') {
*outLen = *endOffset = outPtr - outStr;
return;
}
@@ -1722,31 +1786,31 @@ static void insertColInLine( const char *line, char *insLine, int column, int in
/* Pad out to column + width of inserted text + (additional original
offset due to non-breaking character at column) */
toIndent = column + insWidth + postColIndent - column;
- addPadding( outPtr, indent, toIndent, tabDist, useTabs, nullSubsChar, &len );
+ addPadding(outPtr, indent, toIndent, tabDist, useTabs, nullSubsChar, &len);
outPtr += len;
indent = toIndent;
/* realign tabs for text beyond "column" and write it out */
- retabbedStr = realignTabs( linePtr, postColIndent, indent, tabDist,
- useTabs, nullSubsChar, &len );
- strcpy( outPtr, retabbedStr );
- free( (void *) retabbedStr );
+ retabbedStr = realignTabs(linePtr, postColIndent, indent, tabDist,
+ useTabs, nullSubsChar, &len);
+ strcpy(outPtr, retabbedStr);
+ free((void *) retabbedStr);
*endOffset = outPtr - outStr;
- *outLen = ( outPtr - outStr ) + len;
+ *outLen = (outPtr - outStr) + len;
}
-/*
-** Remove characters in single-line string "line" between displayed positions
-** "rectStart" and "rectEnd", and write the result to "outStr", which is
-** assumed to be large enough to hold the returned string. Note that in
-** certain cases, it is possible for the string to get longer due to
-** expansion of tabs. "endOffset" returns the number of characters from
-** the beginning of the string to the point where the characters were
-** deleted (as a hint for routines which need to position the cursor).
+/**
+ Removes characters in single-line string \p line between displayed positions
+ \p rectStart and \p rectEnd, and write the result to \p outStr, which is
+ assumed to be large enough to hold the returned string. Note that in
+ certain cases, it is possible for the string to get longer due to
+ expansion of tabs. \p endOffset returns the number of characters from
+ the beginning of the string to the point where the characters were
+ deleted (as a hint for routines which need to position the cursor).
*/
-static void deleteRectFromLine( const char *line, int rectStart, int rectEnd,
+static void deleteRectFromLine(const char *line, int rectStart, int rectEnd,
int tabDist, int useTabs, char nullSubsChar, char *outStr, int *outLen,
- int *endOffset ) {
+ int *endOffset) {
int indent, preRectIndent, postRectIndent, len;
const char *c;
char *retabbedStr, *outPtr;
@@ -1754,11 +1818,11 @@ static void deleteRectFromLine( const char *line, int rectStart, int rectEnd,
/* copy the line up to rectStart */
outPtr = outStr;
indent = 0;
- for ( c = line; *c != '\0'; c++ ) {
- if ( indent > rectStart )
+ for (c = line; *c != '\0'; c++) {
+ if (indent > rectStart)
break;
- len = Fl_Text_Buffer::character_width( *c, indent, tabDist, nullSubsChar );
- if ( indent + len > rectStart && ( indent == rectStart || *c == '\t' ) )
+ len = Fl_Text_Buffer::character_width(*c, indent, tabDist, nullSubsChar);
+ if (indent + len > rectStart && (indent == rectStart || *c == '\t'))
break;
indent += len;
*outPtr++ = *c;
@@ -1766,12 +1830,12 @@ static void deleteRectFromLine( const char *line, int rectStart, int rectEnd,
preRectIndent = indent;
/* skip the characters between rectStart and rectEnd */
- for ( ; *c != '\0' && indent < rectEnd; c++ )
- indent += Fl_Text_Buffer::character_width( *c, indent, tabDist, nullSubsChar );
+ for (; *c != '\0' && indent < rectEnd; c++)
+ indent += Fl_Text_Buffer::character_width(*c, indent, tabDist, nullSubsChar);
postRectIndent = indent;
/* If the line ended before rectEnd, there's nothing more to do */
- if ( *c == '\0' ) {
+ if (*c == '\0') {
*outPtr = '\0';
*outLen = *endOffset = outPtr - outStr;
return;
@@ -1779,33 +1843,33 @@ static void deleteRectFromLine( const char *line, int rectStart, int rectEnd,
/* fill in any space left by removed tabs or control characters
which straddled the boundaries */
- indent = max( rectStart + postRectIndent - rectEnd, preRectIndent );
- addPadding( outPtr, preRectIndent, indent, tabDist, useTabs, nullSubsChar,
- &len );
+ indent = max(rectStart + postRectIndent - rectEnd, preRectIndent);
+ addPadding(outPtr, preRectIndent, indent, tabDist, useTabs, nullSubsChar,
+ &len);
outPtr += len;
/* Copy the rest of the line. If the indentation has changed, preserve
the position of non-whitespace characters by converting tabs to
spaces, then back to tabs with the correct offset */
- retabbedStr = realignTabs( c, postRectIndent, indent, tabDist, useTabs,
- nullSubsChar, &len );
- strcpy( outPtr, retabbedStr );
- free( (void *) retabbedStr );
+ retabbedStr = realignTabs(c, postRectIndent, indent, tabDist, useTabs,
+ nullSubsChar, &len);
+ strcpy(outPtr, retabbedStr);
+ free((void *) retabbedStr);
*endOffset = outPtr - outStr;
- *outLen = ( outPtr - outStr ) + len;
+ *outLen = (outPtr - outStr) + len;
}
-/*
-** Overlay characters from single-line string "insLine" on single-line string
-** "line" between displayed character offsets "rectStart" and "rectEnd".
-** "outLen" returns the number of characters written to "outStr", "endOffset"
-** returns the number of characters from the beginning of the string to
-** the right edge of the inserted text (as a hint for routines which need
-** to position the cursor).
+/**
+ Overlay characters from single-line string \p insLine on single-line string
+ \p line between displayed character offsets \p rectStart and \p rectEnd.
+ \p outLen returns the number of characters written to \p outStr, \p endOffset
+ returns the number of characters from the beginning of the string to
+ the right edge of the inserted text (as a hint for routines which need
+ to position the cursor).
*/
-static void overlayRectInLine( const char *line, char *insLine, int rectStart,
+static void overlayRectInLine(const char *line, char *insLine, int rectStart,
int rectEnd, int tabDist, int useTabs, char nullSubsChar, char *outStr,
- int *outLen, int *endOffset ) {
+ int *outLen, int *endOffset) {
char * c, *outPtr, *retabbedStr;
int inIndent, outIndent, len, postRectIndent;
const char *linePtr;
@@ -1813,9 +1877,9 @@ static void overlayRectInLine( const char *line, char *insLine, int rectStart,
/* copy the line up to "rectStart" */
outPtr = outStr;
inIndent = outIndent = 0;
- for ( linePtr = line; *linePtr != '\0'; linePtr++ ) {
- len = Fl_Text_Buffer::character_width( *linePtr, inIndent, tabDist, nullSubsChar );
- if ( inIndent + len > rectStart )
+ for (linePtr = line; *linePtr != '\0'; linePtr++) {
+ len = Fl_Text_Buffer::character_width(*linePtr, inIndent, tabDist, nullSubsChar);
+ if (inIndent + len > rectStart)
break;
inIndent += len;
outIndent += len;
@@ -1826,8 +1890,8 @@ static void overlayRectInLine( const char *line, char *insLine, int rectStart,
is a tab, leave it off and leave the outIndent short and it will get
padded later. If it's a control character, insert it and adjust
outIndent accordingly. */
- if ( inIndent < rectStart && *linePtr != '\0' ) {
- if ( *linePtr == '\t' ) {
+ if (inIndent < rectStart && *linePtr != '\0') {
+ if (*linePtr == '\t') {
linePtr++;
inIndent += len;
} else {
@@ -1839,9 +1903,9 @@ static void overlayRectInLine( const char *line, char *insLine, int rectStart,
/* skip the characters between rectStart and rectEnd */
postRectIndent = rectEnd;
- for ( ; *linePtr != '\0'; linePtr++ ) {
- inIndent += Fl_Text_Buffer::character_width( *linePtr, inIndent, tabDist, nullSubsChar );
- if ( inIndent >= rectEnd ) {
+ for (; *linePtr != '\0'; linePtr++) {
+ inIndent += Fl_Text_Buffer::character_width(*linePtr, inIndent, tabDist, nullSubsChar);
+ if (inIndent >= rectEnd) {
linePtr++;
postRectIndent = inIndent;
break;
@@ -1849,60 +1913,60 @@ static void overlayRectInLine( const char *line, char *insLine, int rectStart,
}
/* If there's no text after rectStart and no text to insert, that's all */
- if ( *insLine == '\0' && *linePtr == '\0' ) {
+ if (*insLine == '\0' && *linePtr == '\0') {
*outLen = *endOffset = outPtr - outStr;
return;
}
/* pad out to rectStart if text is too short */
- if ( outIndent < rectStart ) {
- addPadding( outPtr, outIndent, rectStart, tabDist, useTabs, nullSubsChar,
- &len );
+ if (outIndent < rectStart) {
+ addPadding(outPtr, outIndent, rectStart, tabDist, useTabs, nullSubsChar,
+ &len);
outPtr += len;
}
outIndent = rectStart;
/* Copy the text from "insLine" (if any), recalculating the tabs as if
the inserted string began at column 0 to its new column destination */
- if ( *insLine != '\0' ) {
- retabbedStr = realignTabs( insLine, 0, rectStart, tabDist, useTabs,
- nullSubsChar, &len );
- for ( c = retabbedStr; *c != '\0'; c++ ) {
+ if (*insLine != '\0') {
+ retabbedStr = realignTabs(insLine, 0, rectStart, tabDist, useTabs,
+ nullSubsChar, &len);
+ for (c = retabbedStr; *c != '\0'; c++) {
*outPtr++ = *c;
- len = Fl_Text_Buffer::character_width( *c, outIndent, tabDist, nullSubsChar );
+ len = Fl_Text_Buffer::character_width(*c, outIndent, tabDist, nullSubsChar);
outIndent += len;
}
- free( (void *) retabbedStr );
+ free((void *) retabbedStr);
}
/* If the original line did not extend past "rectStart", that's all */
- if ( *linePtr == '\0' ) {
+ if (*linePtr == '\0') {
*outLen = *endOffset = outPtr - outStr;
return;
}
/* Pad out to rectEnd + (additional original offset
due to non-breaking character at right boundary) */
- addPadding( outPtr, outIndent, postRectIndent, tabDist, useTabs,
- nullSubsChar, &len );
+ addPadding(outPtr, outIndent, postRectIndent, tabDist, useTabs,
+ nullSubsChar, &len);
outPtr += len;
outIndent = postRectIndent;
/* copy the text beyond "rectEnd" */
- strcpy( outPtr, linePtr );
+ strcpy(outPtr, linePtr);
*endOffset = outPtr - outStr;
- *outLen = ( outPtr - outStr ) + strlen( linePtr );
+ *outLen = (outPtr - outStr) + strlen(linePtr);
}
-void Fl_Text_Selection::set( int startpos, int endpos ) {
+void Fl_Text_Selection::set(int startpos, int endpos) {
mSelected = startpos != endpos;
mRectangular = 0;
- mStart = min( startpos, endpos );
- mEnd = max( startpos, endpos );
+ mStart = min(startpos, endpos);
+ mEnd = max(startpos, endpos);
}
-void Fl_Text_Selection::set_rectangular( int startpos, int endpos,
- int rectStart, int rectEnd ) {
+void Fl_Text_Selection::set_rectangular(int startpos, int endpos,
+ int rectStart, int rectEnd) {
mSelected = rectStart < rectEnd;
mRectangular = 1;
mStart = startpos;
@@ -1911,8 +1975,8 @@ void Fl_Text_Selection::set_rectangular( int startpos, int endpos,
mRectEnd = rectEnd;
}
-int Fl_Text_Selection::position( int *startpos, int *endpos ) {
- if ( !mSelected )
+int Fl_Text_Selection::position(int *startpos, int *endpos) {
+ if (!mSelected)
return 0;
*startpos = mStart;
*endpos = mEnd;
@@ -1920,97 +1984,99 @@ int Fl_Text_Selection::position( int *startpos, int *endpos ) {
return 1;
}
-int Fl_Text_Selection::position( int *startpos, int *endpos,
- int *isRect, int *rectStart, int *rectEnd ) {
- if ( !mSelected )
+int Fl_Text_Selection::position(int *startpos, int *endpos,
+ int *isRect, int *rectStart, int *rectEnd) {
+ if (!mSelected)
return 0;
*isRect = mRectangular;
*startpos = mStart;
*endpos = mEnd;
- if ( mRectangular ) {
+ if (mRectangular) {
*rectStart = mRectStart;
*rectEnd = mRectEnd;
}
return 1;
}
-/*
-** Return true if position "pos" with indentation "dispIndex" is in
-** the Fl_Text_Selection.
+/**
+ Return true if position \p pos with indentation \p dispIndex is in
+ the Fl_Text_Selection.
*/
int Fl_Text_Selection::includes(int pos, int lineStartPos, int dispIndex) {
return selected() &&
- ( (!rectangular() && pos >= start() && pos < end()) ||
+ ((!rectangular() && pos >= start() && pos < end()) ||
(rectangular() && pos >= start() && lineStartPos <= end() &&
dispIndex >= rect_start() && dispIndex < rect_end())
- );
+ );
}
-char * Fl_Text_Buffer::selection_text_( Fl_Text_Selection *sel ) {
+char * Fl_Text_Buffer::selection_text_(Fl_Text_Selection *sel) {
int start, end, isRect, rectStart, rectEnd;
char *s;
/* If there's no selection, return an allocated empty string */
- if ( !sel->position( &start, &end, &isRect, &rectStart, &rectEnd ) ) {
- s = (char *)malloc( 1 );
+ if (!sel->position(&start, &end, &isRect, &rectStart, &rectEnd)) {
+ s = (char *)malloc(1);
*s = '\0';
return s;
}
/* If the selection is not rectangular, return the selected range */
- if ( isRect )
- return text_in_rectangle( start, end, rectStart, rectEnd );
+ if (isRect)
+ return text_in_rectangle(start, end, rectStart, rectEnd);
else
- return text_range( start, end );
+ return text_range(start, end);
}
-
-void Fl_Text_Buffer::remove_selection_( Fl_Text_Selection *sel ) {
+/** Removes the text from the buffer corresponding to \p sel.*/
+void Fl_Text_Buffer::remove_selection_(Fl_Text_Selection *sel) {
int start, end;
int isRect, rectStart, rectEnd;
- if ( !sel->position( &start, &end, &isRect, &rectStart, &rectEnd ) )
+ if (!sel->position(&start, &end, &isRect, &rectStart, &rectEnd))
return;
- if ( isRect )
- remove_rectangular( start, end, rectStart, rectEnd );
+ if (isRect)
+ remove_rectangular(start, end, rectStart, rectEnd);
else {
- remove( start, end );
+ remove(start, end);
//undoyankcut = undocut;
}
}
-void Fl_Text_Buffer::replace_selection_( Fl_Text_Selection *sel, const char *s ) {
+/** Replaces the \p text in selection \p sel.*/
+
+void Fl_Text_Buffer::replace_selection_(Fl_Text_Selection *sel, const char *text) {
int start, end, isRect, rectStart, rectEnd;
Fl_Text_Selection oldSelection = *sel;
/* If there's no selection, return */
- if ( !sel->position( &start, &end, &isRect, &rectStart, &rectEnd ) )
+ if (!sel->position(&start, &end, &isRect, &rectStart, &rectEnd))
return;
/* Do the appropriate type of replace */
- if ( isRect )
- replace_rectangular( start, end, rectStart, rectEnd, s );
+ if (isRect)
+ replace_rectangular(start, end, rectStart, rectEnd, text);
else
- replace( start, end, s );
+ replace(start, end, text);
/* Unselect (happens automatically in BufReplace, but BufReplaceRect
can't detect when the contents of a selection goes away) */
sel->mSelected = 0;
- redisplay_selection( &oldSelection, sel );
+ redisplay_selection(&oldSelection, sel);
}
-static void addPadding( char *string, int startIndent, int toIndent,
- int tabDist, int useTabs, char nullSubsChar, int *charsAdded ) {
+static void addPadding(char *string, int startIndent, int toIndent,
+ int tabDist, int useTabs, char nullSubsChar, int *charsAdded) {
char * outPtr;
int len, indent;
indent = startIndent;
outPtr = string;
- if ( useTabs ) {
- while ( indent < toIndent ) {
- len = Fl_Text_Buffer::character_width( '\t', indent, tabDist, nullSubsChar );
- if ( len > 1 && indent + len <= toIndent ) {
+ if (useTabs) {
+ while (indent < toIndent) {
+ len = Fl_Text_Buffer::character_width('\t', indent, tabDist, nullSubsChar);
+ if (len > 1 && indent + len <= toIndent) {
*outPtr++ = '\t';
indent += len;
} else {
@@ -2019,7 +2085,7 @@ static void addPadding( char *string, int startIndent, int toIndent,
}
}
} else {
- while ( indent < toIndent ) {
+ while (indent < toIndent) {
*outPtr++ = ' ';
indent++;
}
@@ -2027,22 +2093,22 @@ static void addPadding( char *string, int startIndent, int toIndent,
*charsAdded = outPtr - string;
}
-/*
-** Call the stored modify callback procedure(s) for this buffer to update the
-** changed area(s) on the screen and any other listeners.
+/**
+ Calls the stored modify callback procedure(s) for this buffer to update the
+ changed area(s) on the screen and any other listeners.
*/
-void Fl_Text_Buffer::call_modify_callbacks( int pos, int nDeleted,
- int nInserted, int nRestyled, const char *deletedText ) {
+void Fl_Text_Buffer::call_modify_callbacks(int pos, int nDeleted,
+ int nInserted, int nRestyled, const char *deletedText) {
int i;
- for ( i = 0; i < mNModifyProcs; i++ )
- ( *mNodifyProcs[ i ] ) ( pos, nInserted, nDeleted, nRestyled,
- deletedText, mCbArgs[ i ] );
+ for (i = 0; i < mNModifyProcs; i++)
+ (*mNodifyProcs[ i ]) (pos, nInserted, nDeleted, nRestyled,
+ deletedText, mCbArgs[ i ]);
}
-/*
-** Call the stored pre-delete callback procedure(s) for this buffer to update
-** the changed area(s) on the screen and any other listeners.
+/**
+ Calls the stored pre-delete callback procedure(s) for this buffer to update
+ the changed area(s) on the screen and any other listeners.
*/
void Fl_Text_Buffer::call_predelete_callbacks(int pos, int nDeleted) {
int i;
@@ -2051,12 +2117,12 @@ void Fl_Text_Buffer::call_predelete_callbacks(int pos, int nDeleted) {
(*mPredeleteProcs[i])(pos, nDeleted, mPredeleteCbArgs[i]);
}
-/*
-** Call the stored redisplay procedure(s) for this buffer to update the
-** screen for a change in a selection.
+/**
+ Calls the stored redisplay procedure(s) for this buffer to update the
+ screen for a change in a selection.
*/
-void Fl_Text_Buffer::redisplay_selection( Fl_Text_Selection *oldSelection,
- Fl_Text_Selection *newSelection ) {
+void Fl_Text_Buffer::redisplay_selection(Fl_Text_Selection *oldSelection,
+ Fl_Text_Selection *newSelection) {
int oldStart, oldEnd, newStart, newEnd, ch1Start, ch1End, ch2Start, ch2End;
/* If either selection is rectangular, add an additional character to
@@ -2066,146 +2132,147 @@ void Fl_Text_Buffer::redisplay_selection( Fl_Text_Selection *oldSelection,
newStart = newSelection->mStart;
oldEnd = oldSelection->mEnd;
newEnd = newSelection->mEnd;
- if ( oldSelection->mRectangular )
+ if (oldSelection->mRectangular)
oldEnd++;
- if ( newSelection->mRectangular )
+ if (newSelection->mRectangular)
newEnd++;
/* If the old or new selection is unselected, just redisplay the
single area that is (was) selected and return */
- if ( !oldSelection->mSelected && !newSelection->mSelected )
+ if (!oldSelection->mSelected && !newSelection->mSelected)
return;
- if ( !oldSelection->mSelected ) {
- call_modify_callbacks( newStart, 0, 0, newEnd - newStart, NULL );
+ if (!oldSelection->mSelected) {
+ call_modify_callbacks(newStart, 0, 0, newEnd - newStart, NULL);
return;
}
- if ( !newSelection->mSelected ) {
- call_modify_callbacks( oldStart, 0, 0, oldEnd - oldStart, NULL );
+ if (!newSelection->mSelected) {
+ call_modify_callbacks(oldStart, 0, 0, oldEnd - oldStart, NULL);
return;
}
/* If the selection changed from normal to rectangular or visa versa, or
if a rectangular selection changed boundaries, redisplay everything */
- if ( ( oldSelection->mRectangular && !newSelection->mRectangular ) ||
- ( !oldSelection->mRectangular && newSelection->mRectangular ) ||
- ( oldSelection->mRectangular && (
- ( oldSelection->mRectStart != newSelection->mRectStart ) ||
- ( oldSelection->mRectEnd != newSelection->mRectEnd ) ) ) ) {
- call_modify_callbacks( min( oldStart, newStart ), 0, 0,
- max( oldEnd, newEnd ) - min( oldStart, newStart ), NULL );
+ if ((oldSelection->mRectangular && !newSelection->mRectangular) ||
+ (!oldSelection->mRectangular && newSelection->mRectangular) ||
+ (oldSelection->mRectangular && (
+ (oldSelection->mRectStart != newSelection->mRectStart) ||
+ (oldSelection->mRectEnd != newSelection->mRectEnd)))) {
+ call_modify_callbacks(min(oldStart, newStart), 0, 0,
+ max(oldEnd, newEnd) - min(oldStart, newStart), NULL);
return;
}
/* If the selections are non-contiguous, do two separate updates
and return */
- if ( oldEnd < newStart || newEnd < oldStart ) {
- call_modify_callbacks( oldStart, 0, 0, oldEnd - oldStart, NULL );
- call_modify_callbacks( newStart, 0, 0, newEnd - newStart, NULL );
+ if (oldEnd < newStart || newEnd < oldStart) {
+ call_modify_callbacks(oldStart, 0, 0, oldEnd - oldStart, NULL);
+ call_modify_callbacks(newStart, 0, 0, newEnd - newStart, NULL);
return;
}
/* Otherwise, separate into 3 separate regions: ch1, and ch2 (the two
changed areas), and the unchanged area of their intersection,
and update only the changed area(s) */
- ch1Start = min( oldStart, newStart );
- ch2End = max( oldEnd, newEnd );
- ch1End = max( oldStart, newStart );
- ch2Start = min( oldEnd, newEnd );
- if ( ch1Start != ch1End )
- call_modify_callbacks( ch1Start, 0, 0, ch1End - ch1Start, NULL );
- if ( ch2Start != ch2End )
- call_modify_callbacks( ch2Start, 0, 0, ch2End - ch2Start, NULL );
+ ch1Start = min(oldStart, newStart);
+ ch2End = max(oldEnd, newEnd);
+ ch1End = max(oldStart, newStart);
+ ch2Start = min(oldEnd, newEnd);
+ if (ch1Start != ch1End)
+ call_modify_callbacks(ch1Start, 0, 0, ch1End - ch1Start, NULL);
+ if (ch2Start != ch2End)
+ call_modify_callbacks(ch2Start, 0, 0, ch2End - ch2Start, NULL);
}
-void Fl_Text_Buffer::move_gap( int pos ) {
+void Fl_Text_Buffer::move_gap(int pos) {
int gapLen = mGapEnd - mGapStart;
- if ( pos > mGapStart )
- memmove( &mBuf[ mGapStart ], &mBuf[ mGapEnd ],
- pos - mGapStart );
+ if (pos > mGapStart)
+ memmove(&mBuf[ mGapStart ], &mBuf[ mGapEnd ],
+ pos - mGapStart);
else
- memmove( &mBuf[ pos + gapLen ], &mBuf[ pos ], mGapStart - pos );
+ memmove(&mBuf[ pos + gapLen ], &mBuf[ pos ], mGapStart - pos);
mGapEnd += pos - mGapStart;
mGapStart += pos - mGapStart;
}
-/*
-** reallocate the text storage in "buf" to have a gap starting at "newGapStart"
-** and a gap size of "newGapLen", preserving the buffer's current contents.
+/**
+ Reallocates the text storage in the buffer to have a gap starting at \p newGapStart
+ and a gap size of \p newGapLen, preserving the buffer's current contents.
*/
-void Fl_Text_Buffer::reallocate_with_gap( int newGapStart, int newGapLen ) {
+void Fl_Text_Buffer::reallocate_with_gap(int newGapStart, int newGapLen) {
char * newBuf;
int newGapEnd;
- newBuf = (char *)malloc( mLength + newGapLen );
+ newBuf = (char *)malloc(mLength + newGapLen);
newGapEnd = newGapStart + newGapLen;
- if ( newGapStart <= mGapStart ) {
- memcpy( newBuf, mBuf, newGapStart );
- memcpy( &newBuf[ newGapEnd ], &mBuf[ newGapStart ],
- mGapStart - newGapStart );
- memcpy( &newBuf[ newGapEnd + mGapStart - newGapStart ],
- &mBuf[ mGapEnd ], mLength - mGapStart );
+ if (newGapStart <= mGapStart) {
+ memcpy(newBuf, mBuf, newGapStart);
+ memcpy(&newBuf[ newGapEnd ], &mBuf[ newGapStart ],
+ mGapStart - newGapStart);
+ memcpy(&newBuf[ newGapEnd + mGapStart - newGapStart ],
+ &mBuf[ mGapEnd ], mLength - mGapStart);
} else { /* newGapStart > mGapStart */
- memcpy( newBuf, mBuf, mGapStart );
- memcpy( &newBuf[ mGapStart ], &mBuf[ mGapEnd ],
- newGapStart - mGapStart );
- memcpy( &newBuf[ newGapEnd ],
+ memcpy(newBuf, mBuf, mGapStart);
+ memcpy(&newBuf[ mGapStart ], &mBuf[ mGapEnd ],
+ newGapStart - mGapStart);
+ memcpy(&newBuf[ newGapEnd ],
&mBuf[ mGapEnd + newGapStart - mGapStart ],
- mLength - newGapStart );
+ mLength - newGapStart);
}
- free( (void *) mBuf );
+ free((void *) mBuf);
mBuf = newBuf;
mGapStart = newGapStart;
mGapEnd = newGapEnd;
#ifdef PURIFY
-{int i; for ( i = mGapStart; i < mGapEnd; i++ ) mBuf[ i ] = '.'; }
+{int i; for (i = mGapStart; i < mGapEnd; i++) mBuf[ i ] = '.'; }
#endif
}
-/*
-** Update all of the selections in "buf" for changes in the buffer's text
+/**
+ Updates all of the selections in the buffer for changes in the buffer's text
*/
-void Fl_Text_Buffer::update_selections( int pos, int nDeleted,
- int nInserted ) {
- mPrimary.update( pos, nDeleted, nInserted );
- mSecondary.update( pos, nDeleted, nInserted );
- mHighlight.update( pos, nDeleted, nInserted );
+void Fl_Text_Buffer::update_selections(int pos, int nDeleted,
+ int nInserted) {
+ mPrimary.update(pos, nDeleted, nInserted);
+ mSecondary.update(pos, nDeleted, nInserted);
+ mHighlight.update(pos, nDeleted, nInserted);
}
-/*
-** Update an individual selection for changes in the corresponding text
+/**
+ Updates an individual selection for changes in the corresponding text
*/
-void Fl_Text_Selection::update( int pos, int nDeleted,
- int nInserted ) {
- if ( !mSelected || pos > mEnd )
+void Fl_Text_Selection::update(int pos, int nDeleted,
+ int nInserted) {
+ if (!mSelected || pos > mEnd)
return;
- if ( pos + nDeleted <= mStart ) {
+ if (pos + nDeleted <= mStart) {
mStart += nInserted - nDeleted;
mEnd += nInserted - nDeleted;
- } else if ( pos <= mStart && pos + nDeleted >= mEnd ) {
+ } else if (pos <= mStart && pos + nDeleted >= mEnd) {
mStart = pos;
mEnd = pos;
mSelected = 0;
- } else if ( pos <= mStart && pos + nDeleted < mEnd ) {
+ } else if (pos <= mStart && pos + nDeleted < mEnd) {
mStart = pos;
mEnd = nInserted + mEnd - nDeleted;
- } else if ( pos < mEnd ) {
+ } else if (pos < mEnd) {
mEnd += nInserted - nDeleted;
- if ( mEnd <= mStart )
+ if (mEnd <= mStart)
mSelected = 0;
}
}
-/*
-** Search forwards in buffer "buf" for character "searchChar", starting
-** with the character "startPos", and returning the result in "foundPos"
-** returns 1 if found, 0 if not. (The difference between this and
-** BufSearchForward is that it's optimized for single characters. The
-** overall performance of the text widget is dependent on its ability to
-** count lines quickly, hence searching for a single character: newline)
+/**
+ Finds the next occurrence of the specified character.
+ Search forwards in buffer for character \p searchChar, starting
+ with the character \p startPos, and returning the result in \p foundPos
+ returns 1 if found, 0 if not. (The difference between this and
+ BufSearchForward is that it's optimized for single characters. The
+ overall performance of the text widget is dependent on its ability to
+ count lines quickly, hence searching for a single character: newline)
*/
-int Fl_Text_Buffer::findchar_forward( int startPos, char searchChar,
- int *foundPos ) {
+int Fl_Text_Buffer::findchar_forward(int startPos, char searchChar,
+ int *foundPos) {
int pos, gapLen = mGapEnd - mGapStart;
if (startPos < 0 || startPos >= mLength) {
@@ -2214,15 +2281,15 @@ int Fl_Text_Buffer::findchar_forward( int startPos, char searchChar,
}
pos = startPos;
- while ( pos < mGapStart ) {
- if ( mBuf[ pos ] == searchChar ) {
+ while (pos < mGapStart) {
+ if (mBuf[ pos ] == searchChar) {
*foundPos = pos;
return 1;
}
pos++;
}
- while ( pos < mLength ) {
- if ( mBuf[ pos + gapLen ] == searchChar ) {
+ while (pos < mLength) {
+ if (mBuf[ pos + gapLen ] == searchChar) {
*foundPos = pos;
return 1;
}
@@ -2232,32 +2299,32 @@ int Fl_Text_Buffer::findchar_forward( int startPos, char searchChar,
return 0;
}
-/*
-** Search backwards in buffer "buf" for character "searchChar", starting
-** with the character BEFORE "startPos", returning the result in "foundPos"
-** returns 1 if found, 0 if not. (The difference between this and
-** BufSearchBackward is that it's optimized for single characters. The
-** overall performance of the text widget is dependent on its ability to
-** count lines quickly, hence searching for a single character: newline)
+/**
+ Search backwards in buffer \p buf for character \p searchChar, starting
+ with the character BEFORE \p startPos, returning the result in \p foundPos
+ returns 1 if found, 0 if not. (The difference between this and
+ BufSearchBackward is that it's optimized for single characters. The
+ overall performance of the text widget is dependent on its ability to
+ count lines quickly, hence searching for a single character: newline)
*/
-int Fl_Text_Buffer::findchar_backward( int startPos, char searchChar,
- int *foundPos ) {
+int Fl_Text_Buffer::findchar_backward(int startPos, char searchChar,
+ int *foundPos) {
int pos, gapLen = mGapEnd - mGapStart;
- if ( startPos <= 0 || startPos > mLength ) {
+ if (startPos <= 0 || startPos > mLength) {
*foundPos = 0;
return 0;
}
pos = startPos - 1;
- while ( pos >= mGapStart ) {
- if ( mBuf[ pos + gapLen ] == searchChar ) {
+ while (pos >= mGapStart) {
+ if (mBuf[ pos + gapLen ] == searchChar) {
*foundPos = pos;
return 1;
}
pos--;
}
- while ( pos >= 0 ) {
- if ( mBuf[ pos ] == searchChar ) {
+ while (pos >= 0) {
+ if (mBuf[ pos ] == searchChar) {
*foundPos = pos;
return 1;
}
@@ -2268,82 +2335,82 @@ int Fl_Text_Buffer::findchar_backward( int startPos, char searchChar,
}
/*
-** Copy from "text" to end up to but not including newline (or end of "text")
-** and return the copy as the function value, and the length of the line in
-** "lineLen"
+ Copies from \p text to end up to but not including newline (or end of \p text)
+ and return the copy as the function value, and the length of the line in
+ \p lineLen
*/
-static char *copyLine( const char *text, int *lineLen ) {
+static char *copyLine(const char *text, int *lineLen) {
int len = 0;
const char *c;
char *outStr;
- for ( c = text; *c != '\0' && *c != '\n'; c++ )
+ for (c = text; *c != '\0' && *c != '\n'; c++)
len++;
- outStr = (char *)malloc( len + 1 );
- strlcpy( outStr, text, len + 1);
+ outStr = (char *)malloc(len + 1);
+ strlcpy(outStr, text, len + 1);
*lineLen = len;
return outStr;
}
/*
-** Count the number of newlines in a null-terminated text string;
+ Counts the number of newlines in a null-terminated text string;
*/
-static int countLines( const char *string ) {
+static int countLines(const char *string) {
const char * c;
int lineCount = 0;
- for ( c = string; *c != '\0'; c++ )
- if ( *c == '\n' ) lineCount++;
+ for (c = string; *c != '\0'; c++)
+ if (*c == '\n') lineCount++;
return lineCount;
}
/*
-** Measure the width in displayed characters of string "text"
+ Measures the width in displayed characters of string \p text
*/
-static int textWidth( const char *text, int tabDist, char nullSubsChar ) {
+static int textWidth(const char *text, int tabDist, char nullSubsChar) {
int width = 0, maxWidth = 0;
const char *c;
- for ( c = text; *c != '\0'; c++ ) {
- if ( *c == '\n' ) {
- if ( width > maxWidth )
+ for (c = text; *c != '\0'; c++) {
+ if (*c == '\n') {
+ if (width > maxWidth)
maxWidth = width;
width = 0;
} else
- width += Fl_Text_Buffer::character_width( *c, width, tabDist, nullSubsChar );
+ width += Fl_Text_Buffer::character_width(*c, width, tabDist, nullSubsChar);
}
- if ( width > maxWidth )
+ if (width > maxWidth)
return width;
return maxWidth;
}
-/*
-** Find the first and last character position in a line within a rectangular
-** selection (for copying). Includes tabs which cross rectStart, but not
-** control characters which do so. Leaves off tabs which cross rectEnd.
-**
-** Technically, the calling routine should convert tab characters which
-** cross the right boundary of the selection to spaces which line up with
-** the edge of the selection. Unfortunately, the additional memory
-** management required in the parent routine to allow for the changes
-** in string size is not worth all the extra work just for a couple of
-** shifted characters, so if a tab protrudes, just lop it off and hope
-** that there are other characters in the selection to establish the right
-** margin for subsequent columnar pastes of this data.
+/**
+ Finds the first and last character position in a line within a rectangular
+ selection (for copying). Includes tabs which cross rectStart, but not
+ control characters which do so. Leaves off tabs which cross rectEnd.
+
+ Technically, the calling routine should convert tab characters which
+ cross the right boundary of the selection to spaces which line up with
+ the edge of the selection. Unfortunately, the additional memory
+ management required in the parent routine to allow for the changes
+ in string size is not worth all the extra work just for a couple of
+ shifted characters, so if a tab protrudes, just lop it off and hope
+ that there are other characters in the selection to establish the right
+ margin for subsequent columnar pastes of this data.
*/
-void Fl_Text_Buffer::rectangular_selection_boundaries( int lineStartPos,
- int rectStart, int rectEnd, int *selStart, int *selEnd ) {
+void Fl_Text_Buffer::rectangular_selection_boundaries(int lineStartPos,
+ int rectStart, int rectEnd, int *selStart, int *selEnd) {
int pos, width, indent = 0;
char c;
/* find the start of the selection */
- for ( pos = lineStartPos; pos < mLength; pos++ ) {
- c = character( pos );
- if ( c == '\n' )
+ for (pos = lineStartPos; pos < mLength; pos++) {
+ c = character(pos);
+ if (c == '\n')
break;
- width = Fl_Text_Buffer::character_width( c, indent, mTabDist, mNullSubsChar );
- if ( indent + width > rectStart ) {
- if ( indent != rectStart && c != '\t' ) {
+ width = Fl_Text_Buffer::character_width(c, indent, mTabDist, mNullSubsChar);
+ if (indent + width > rectStart) {
+ if (indent != rectStart && c != '\t') {
pos++;
indent += width;
}
@@ -2354,14 +2421,14 @@ void Fl_Text_Buffer::rectangular_selection_boundaries( int lineStartPos,
*selStart = pos;
/* find the end */
- for ( ; pos < mLength; pos++ ) {
- c = character( pos );
- if ( c == '\n' )
+ for (; pos < mLength; pos++) {
+ c = character(pos);
+ if (c == '\n')
break;
- width = Fl_Text_Buffer::character_width( c, indent, mTabDist, mNullSubsChar );
+ width = Fl_Text_Buffer::character_width(c, indent, mTabDist, mNullSubsChar);
indent += width;
- if ( indent > rectEnd ) {
- if ( indent - width != rectEnd && c != '\t' )
+ if (indent > rectEnd) {
+ if (indent - width != rectEnd && c != '\t')
pos++;
break;
}
@@ -2370,78 +2437,78 @@ void Fl_Text_Buffer::rectangular_selection_boundaries( int lineStartPos,
}
/*
-** Adjust the space and tab characters from string "text" so that non-white
-** characters remain stationary when the text is shifted from starting at
-** "origIndent" to starting at "newIndent". Returns an allocated string
-** which must be freed by the caller with XtFree.
+ Adjust the space and tab characters from string \p text so that non-white
+ characters remain stationary when the text is shifted from starting at
+ \p origIndent to starting at \p newIndent. Returns an allocated string
+ which must be freed by the caller with XtFree.
*/
-static char *realignTabs( const char *text, int origIndent, int newIndent,
- int tabDist, int useTabs, char nullSubsChar, int *newLength ) {
+static char *realignTabs(const char *text, int origIndent, int newIndent,
+ int tabDist, int useTabs, char nullSubsChar, int *newLength) {
char * expStr, *outStr;
int len;
/* If the tabs settings are the same, retain original tabs */
- if ( origIndent % tabDist == newIndent % tabDist ) {
- len = strlen( text );
- outStr = (char *)malloc( len + 1 );
- strcpy( outStr, text );
+ if (origIndent % tabDist == newIndent % tabDist) {
+ len = strlen(text);
+ outStr = (char *)malloc(len + 1);
+ strcpy(outStr, text);
*newLength = len;
return outStr;
}
/* If the tab settings are not the same, brutally convert tabs to
spaces, then back to tabs in the new position */
- expStr = expandTabs( text, origIndent, tabDist, nullSubsChar, &len );
- if ( !useTabs ) {
+ expStr = expandTabs(text, origIndent, tabDist, nullSubsChar, &len);
+ if (!useTabs) {
*newLength = len;
return expStr;
}
- outStr = unexpandTabs( expStr, newIndent, tabDist, nullSubsChar, newLength );
- free( (void *) expStr );
+ outStr = unexpandTabs(expStr, newIndent, tabDist, nullSubsChar, newLength);
+ free((void *) expStr);
return outStr;
}
/*
-** Expand tabs to spaces for a block of text. The additional parameter
-** "startIndent" if nonzero, indicates that the text is a rectangular selection
-** beginning at column "startIndent"
+ Expand tabs to spaces for a block of text. The additional parameter
+ \p startIndent if nonzero, indicates that the text is a rectangular selection
+ beginning at column \p startIndent
*/
-static char *expandTabs( const char *text, int startIndent, int tabDist,
- char nullSubsChar, int *newLen ) {
+static char *expandTabs(const char *text, int startIndent, int tabDist,
+ char nullSubsChar, int *newLen) {
char * outStr, *outPtr;
const char *c;
int indent, len, outLen = 0;
/* rehearse the expansion to figure out length for output string */
indent = startIndent;
- for ( c = text; *c != '\0'; c++ ) {
- if ( *c == '\t' ) {
- len = Fl_Text_Buffer::character_width( *c, indent, tabDist, nullSubsChar );
+ for (c = text; *c != '\0'; c++) {
+ if (*c == '\t') {
+ len = Fl_Text_Buffer::character_width(*c, indent, tabDist, nullSubsChar);
outLen += len;
indent += len;
- } else if ( *c == '\n' ) {
+ } else if (*c == '\n') {
indent = startIndent;
outLen++;
} else {
- indent += Fl_Text_Buffer::character_width( *c, indent, tabDist, nullSubsChar );
+ indent += Fl_Text_Buffer::character_width(*c, indent, tabDist, nullSubsChar);
outLen++;
}
}
/* do the expansion */
- outStr = (char *)malloc( outLen + 1 );
+ outStr = (char *)malloc(outLen + 1);
outPtr = outStr;
indent = startIndent;
- for ( c = text; *c != '\0'; c++ ) {
- if ( *c == '\t' ) {
- len = Fl_Text_Buffer::expand_character( *c, indent, outPtr, tabDist, nullSubsChar );
+ for (c = text; *c != '\0'; c++) {
+ if (*c == '\t') {
+ len = Fl_Text_Buffer::expand_character(*c, indent, outPtr, tabDist, nullSubsChar);
outPtr += len;
indent += len;
- } else if ( *c == '\n' ) {
+ } else if (*c == '\n') {
indent = startIndent;
*outPtr++ = *c;
} else {
- indent += Fl_Text_Buffer::character_width( *c, indent, tabDist, nullSubsChar );
+ indent += Fl_Text_Buffer::character_width(*c, indent, tabDist, nullSubsChar);
*outPtr++ = *c;
}
}
@@ -2451,23 +2518,23 @@ static char *expandTabs( const char *text, int startIndent, int tabDist,
}
/*
-** Convert sequences of spaces into tabs. The threshold for conversion is
-** when 3 or more spaces can be converted into a single tab, this avoids
-** converting double spaces after a period withing a block of text.
+ Convert sequences of spaces into tabs. The threshold for conversion is
+ when 3 or more spaces can be converted into a single tab, this avoids
+ converting double spaces after a period withing a block of text.
*/
-static char *unexpandTabs( char *text, int startIndent, int tabDist,
- char nullSubsChar, int *newLen ) {
+static char *unexpandTabs(char *text, int startIndent, int tabDist,
+ char nullSubsChar, int *newLen) {
char * outStr, *outPtr, *c, expandedChar[ FL_TEXT_MAX_EXP_CHAR_LEN ];
int indent, len;
- outStr = (char *)malloc( strlen( text ) + 1 );
+ outStr = (char *)malloc(strlen(text) + 1);
outPtr = outStr;
indent = startIndent;
- for ( c = text; *c != '\0'; ) {
- if ( *c == ' ' ) {
- len = Fl_Text_Buffer::expand_character( '\t', indent, expandedChar, tabDist,
- nullSubsChar );
- if ( len >= 3 && !strncmp( c, expandedChar, len ) ) {
+ for (c = text; *c != '\0';) {
+ if (*c == ' ') {
+ len = Fl_Text_Buffer::expand_character('\t', indent, expandedChar, tabDist,
+ nullSubsChar);
+ if (len >= 3 && !strncmp(c, expandedChar, len)) {
c += len;
*outPtr++ = '\t';
indent += len;
@@ -2475,7 +2542,7 @@ static char *unexpandTabs( char *text, int startIndent, int tabDist,
*outPtr++ = *c++;
indent++;
}
- } else if ( *c == '\n' ) {
+ } else if (*c == '\n') {
indent = startIndent;
*outPtr++ = *c++;
} else {
@@ -2488,18 +2555,16 @@ static char *unexpandTabs( char *text, int startIndent, int tabDist,
return outStr;
}
-static int max( int i1, int i2 ) {
- return i1 >= i2 ? i1 : i2;
-}
-
-static int min( int i1, int i2 ) {
- return i1 <= i2 ? i1 : i2;
-}
-
int
+/**
+ Inserts a file at the specified position. Returns 0 on success,
+ non-zero on error (strerror() contains reason). 1 indicates open
+ for read failed (no data loaded). 2 indicates error occurred
+ while reading data (data was partially loaded).
+*/
Fl_Text_Buffer::insertfile(const char *file, int pos, int buflen) {
FILE *fp; int r;
- if (!(fp = fopen(file, "r"))) return 1;
+ if (!(fp = fl_fopen(file, "r"))) return 1;
char *buffer = new char[buflen];
for (; (r = fread(buffer, 1, buflen - 1, fp)) > 0; pos += r) {
buffer[r] = (char)0;
@@ -2513,9 +2578,15 @@ Fl_Text_Buffer::insertfile(const char *file, int pos, int buflen) {
}
int
+/**
+ Writes the specified portions of the file to a file. Returns 0 on success, non-zero
+ on error (strerror() contains reason). 1 indicates open for write failed
+ (no data saved). 2 indicates error occurred while writing data
+ (data was partially saved).
+*/
Fl_Text_Buffer::outputfile(const char *file, int start, int end, int buflen) {
FILE *fp;
- if (!(fp = fopen(file, "w"))) return 1;
+ if (!(fp = fl_fopen(file, "w"))) return 1;
for (int n; (n = min(end - start, buflen)); start += n) {
const char *p = text_range(start, start + n);
int r = fwrite(p, 1, n, fp);
@@ -2530,5 +2601,5 @@ Fl_Text_Buffer::outputfile(const char *file, int start, int end, int buflen) {
//
-// End of "$Id: Fl_Text_Buffer.cxx 6011 2008-01-04 20:32:37Z matt $".
+// End of "$Id: Fl_Text_Buffer.cxx 6765 2009-04-15 08:35:28Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Text_Display.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Text_Display.cxx
index 3b2f7b4ac..abdd2ef1a 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Text_Display.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Text_Display.cxx
@@ -1,7 +1,7 @@
//
-// "$Id: Fl_Text_Display.cxx 6105 2008-04-21 21:03:22Z matt $"
+// "$Id: Fl_Text_Display.cxx 6765 2009-04-15 08:35:28Z matt $"
//
-// Copyright 2001-2006 by Bill Spitzak and others.
+// Copyright 2001-2009 by Bill Spitzak and others.
// Original code Copyright Mark Edel. Permission to distribute under
// the LGPL for the FLTK library granted by Mark Edel.
//
@@ -27,6 +27,7 @@
#include
#include
+#include
#include "flstring.h"
#include
#include
@@ -76,6 +77,7 @@ static int scroll_x = 0;
// CET - FIXME
#define TMPFONTWIDTH 6
+/** Creates a new text display widget.*/
Fl_Text_Display::Fl_Text_Display(int X, int Y, int W, int H, const char* l)
: Fl_Group(X, Y, W, H, l) {
int i;
@@ -85,12 +87,14 @@ Fl_Text_Display::Fl_Text_Display(int X, int Y, int W, int H, const char* l)
damage_range2_start = damage_range2_end = -1;
dragPos = dragType = dragging = 0;
display_insert_position_hint = 0;
+ shortcut_ = 0;
color(FL_BACKGROUND2_COLOR, FL_SELECTION_COLOR);
box(FL_DOWN_FRAME);
- textsize((uchar)FL_NORMAL_SIZE);
+ textsize(FL_NORMAL_SIZE);
textcolor(FL_FOREGROUND_COLOR);
textfont(FL_HELVETICA);
+ set_flag(SHORTCUT_LABEL);
text_area.x = 0;
text_area.y = 0;
@@ -148,10 +152,9 @@ Fl_Text_Display::Fl_Text_Display(int X, int Y, int W, int H, const char* l)
mSuppressResync = mNLinesDeleted = mModifyingTabDistance = 0;
}
-/*
-** Free a text display and release its associated memory. Note, the text
-** BUFFER that the text display displays is a separate entity and is not
-** freed, nor are the style buffer or style table.
+/** Free a text display and release its associated memory. Note, the text
+ BUFFER that the text display displays is a separate entity and is not
+ freed, nor are the style buffer or style table.
*/
Fl_Text_Display::~Fl_Text_Display() {
if (scroll_direction) {
@@ -165,8 +168,8 @@ Fl_Text_Display::~Fl_Text_Display() {
if (mLineStarts) delete[] mLineStarts;
}
-/*
-** Attach a text buffer to display, replacing the current buffer (if any)
+/**
+ Attach a text buffer to display, replacing the current buffer (if any)
*/
void Fl_Text_Display::buffer( Fl_Text_Buffer *buf ) {
/* If the text display is already displaying a buffer, clear it off
@@ -194,21 +197,20 @@ void Fl_Text_Display::buffer( Fl_Text_Buffer *buf ) {
resize(x(), y(), w(), h());
}
-/*
-** Attach (or remove) highlight information in text display and redisplay.
-** Highlighting information consists of a style buffer which parallels the
-** normal text buffer, but codes font and color information for the display;
-** a style table which translates style buffer codes (indexed by buffer
-** character - 'A') into fonts and colors; and a callback mechanism for
-** as-needed highlighting, triggered by a style buffer entry of
-** "unfinishedStyle". Style buffer can trigger additional redisplay during
-** a normal buffer modification if the buffer contains a primary Fl_Text_Selection
-** (see extendRangeForStyleMods for more information on this protocol).
-**
-** Style buffers, tables and their associated memory are managed by the caller.
+/**
+ Attach (or remove) highlight information in text display and redisplay.
+ Highlighting information consists of a style buffer which parallels the
+ normal text buffer, but codes font and color information for the display;
+ a style table which translates style buffer codes (indexed by buffer
+ character - 'A') into fonts and colors; and a callback mechanism for
+ as-needed highlighting, triggered by a style buffer entry of
+ "unfinishedStyle". Style buffer can trigger additional redisplay during
+ a normal buffer modification if the buffer contains a primary Fl_Text_Selection
+ (see extendRangeForStyleMods for more information on this protocol).
+
+ Style buffers, tables and their associated memory are managed by the caller.
*/
-void
-Fl_Text_Display::highlight_data(Fl_Text_Buffer *styleBuffer,
+void Fl_Text_Display::highlight_data(Fl_Text_Buffer *styleBuffer,
const Style_Table_Entry *styleTable,
int nStyles, char unfinishedStyle,
Unfinished_Style_Cb unfinishedHighlightCB,
@@ -232,8 +234,8 @@ Fl_Text_Display::highlight_data(Fl_Text_Buffer *styleBuffer,
#if 0
// FIXME: this is in nedit code -- is it needed?
-/*
-** Change the (non highlight) font
+/**
+ Change the (non highlight) font
*/
void TextDSetFont(textDisp *textD, XFontStruct *fontStruct) {
Display *display = XtDisplay(textD->w);
@@ -355,8 +357,8 @@ int Fl_Text_Display::longest_vline() {
return longest;
}
-/*
-** Change the size of the displayed text area
+/**
+ Change the size of the displayed text area
*/
void Fl_Text_Display::resize(int X, int Y, int W, int H) {
#ifdef DEBUG
@@ -375,7 +377,7 @@ void Fl_Text_Display::resize(int X, int Y, int W, int H) {
H -= Fl::box_dh(box());
text_area.x = X+LEFT_MARGIN;
- text_area.y = Y+BOTTOM_MARGIN;
+ text_area.y = Y+TOP_MARGIN;
text_area.w = W-LEFT_MARGIN-RIGHT_MARGIN;
text_area.h = H-TOP_MARGIN-BOTTOM_MARGIN;
int i;
@@ -519,9 +521,9 @@ void Fl_Text_Display::resize(int X, int Y, int W, int H) {
update_h_scrollbar();
}
-/*
-** Refresh a rectangle of the text display. left and top are in coordinates of
-** the text drawing window
+/**
+ Refresh a rectangle of the text display. left and top are in coordinates of
+ the text drawing window
*/
void Fl_Text_Display::draw_text( int left, int top, int width, int height ) {
int fontHeight, firstLine, lastLine, line;
@@ -544,7 +546,25 @@ void Fl_Text_Display::draw_text( int left, int top, int width, int height ) {
fl_pop_clip();
}
+/** Marks text from start to end as needing a redraw.*/
void Fl_Text_Display::redisplay_range(int startpos, int endpos) {
+ int ok = 0;
+ while (!ok && startpos > 0) {
+ char c = buffer()->character( startpos );
+ if (!((c & 0x80) && !(c & 0x40))) {
+ ok = 1;
+ } else {
+ startpos--;
+ }
+ }
+ while (!ok && endpos < buffer()->length()) {
+ char c = buffer()->character( endpos );
+ if (!((c & 0x80) && !(c & 0x40))) {
+ ok = 1;
+ } else {
+ endpos++;
+ }
+ }
if (damage_range1_start == -1 && damage_range1_end == -1) {
damage_range1_start = startpos;
damage_range1_end = endpos;
@@ -561,12 +581,12 @@ void Fl_Text_Display::redisplay_range(int startpos, int endpos) {
}
damage(FL_DAMAGE_SCROLL);
}
-/*
-** Refresh all of the text between buffer positions "start" and "end"
-** not including the character at the position "end".
-** If end points beyond the end of the buffer, refresh the whole display
-** after pos, including blank lines which are not technically part of
-** any range of characters.
+/**
+ Refresh all of the text between buffer positions "start" and "end"
+ not including the character at the position "end".
+ If end points beyond the end of the buffer, refresh the whole display
+ after pos, including blank lines which are not technically part of
+ any range of characters.
*/
void Fl_Text_Display::draw_range(int startpos, int endpos) {
int i, startLine, lastLine, startIndex, endIndex;
@@ -623,9 +643,7 @@ void Fl_Text_Display::draw_range(int startpos, int endpos) {
draw_vline( lastLine, 0, INT_MAX, 0, endIndex );
}
-/*
-** Set the position of the text insertion cursor for text display
-*/
+/** Sets the position of the text insertion cursor for text display */
void Fl_Text_Display::insert_position( int newPos ) {
/* make sure new position is ok, do nothing if it hasn't changed */
if ( newPos == mCursorPos )
@@ -637,24 +655,46 @@ void Fl_Text_Display::insert_position( int newPos ) {
mCursorPreferredCol = -1;
/* erase the cursor at it's previous position */
- redisplay_range(mCursorPos - 1, mCursorPos + 1);
+ redisplay_range(mCursorPos - 1, mCursorPos + 1); // FIXME utf8
mCursorPos = newPos;
/* draw cursor at its new position */
- redisplay_range(mCursorPos - 1, mCursorPos + 1);
+ redisplay_range(mCursorPos - 1, mCursorPos + 1); // FIXME utf8
}
-
+/** Shows the text cursor */
void Fl_Text_Display::show_cursor(int b) {
mCursorOn = b;
- redisplay_range(mCursorPos - 1, mCursorPos + 1);
+ redisplay_range(mCursorPos - 1, mCursorPos + 1); // FIXME utf8
}
+/**
+ Sets the text cursor style to one of the following:
+
+
+
+ - Fl_Text_Display::NORMAL_CURSOR - Shows an I beam.
+
+
- Fl_Text_Display::CARET_CURSOR - Shows a caret under the text.
+
+
- Fl_Text_Display::DIM_CURSOR - Shows a dimmed I beam.
+
+
- Fl_Text_Display::BLOCK_CURSOR - Shows an unfilled box around the current
+ character.
+
+
- Fl_Text_Display::HEAVY_CURSOR - Shows a thick I beam.
+
+
+*/
void Fl_Text_Display::cursor_style(int style) {
mCursorStyle = style;
if (mCursorOn) show_cursor();
}
+/**
+ If mode is not zero, this call enables automatic word wrapping at column pos.
+ Word-wrapping does not change the text buffer itself, only the way that the text is displayed.
+*/
void Fl_Text_Display::wrap_mode(int wrap, int wrapMargin) {
mWrapMargin = wrapMargin;
mContinuousWrap = wrap;
@@ -685,11 +725,11 @@ void Fl_Text_Display::wrap_mode(int wrap, int wrapMargin) {
resize(x(), y(), w(), h());
}
-/*
-** Insert "text" at the current cursor location. This has the same
-** effect as inserting the text into the buffer using BufInsert and
-** then moving the insert position after the newly inserted text, except
-** that it's optimized to do less redrawing.
+/**
+ Inserts "text" at the current cursor location. This has the same
+ effect as inserting the text into the buffer using BufInsert and
+ then moving the insert position after the newly inserted text, except
+ that it's optimized to do less redrawing.
*/
void Fl_Text_Display::insert(const char* text) {
int pos = mCursorPos;
@@ -699,10 +739,7 @@ void Fl_Text_Display::insert(const char* text) {
mCursorToHint = NO_HINT;
}
-/*
-** Insert "text" (which must not contain newlines), overstriking the current
-** cursor location.
-*/
+/** Replaces text at the current insert position.*/
void Fl_Text_Display::overstrike(const char* text) {
int startPos = mCursorPos;
Fl_Text_Buffer *buf = mBuffer;
@@ -753,12 +790,12 @@ void Fl_Text_Display::overstrike(const char* text) {
delete [] paddedText;
}
-/*
-** Translate a buffer text position to the XY location where the top left
-** of the cursor would be positioned to point to that character. Returns
-** 0 if the position is not displayed because it is VERTICALLY out
-** of view. If the position is horizontally out of view, returns the
-** X coordinate where the position would be if it were visible.
+/**
+ Translate a buffer text position to the XY location where the top left
+ of the cursor would be positioned to point to that character. Returns
+ 0 if the position is not displayed because it is VERTICALLY out
+ of view. If the position is horizontally out of view, returns the
+ X coordinate where the position would be if it were visible.
*/
int Fl_Text_Display::position_to_xy( int pos, int* X, int* Y ) {
@@ -812,6 +849,15 @@ int Fl_Text_Display::position_to_xy( int pos, int* X, int* Y ) {
for ( charIndex = 0; charIndex < lineLen && charIndex < pos - lineStartPos; charIndex++ ) {
charLen = Fl_Text_Buffer::expand_character( lineStr[ charIndex ], outIndex, expandedChar,
mBuffer->tab_distance(), mBuffer->null_substitution_character() );
+ if (charLen > 1 && (lineStr[ charIndex ] & 0x80)) {
+ int i, ii = 0;;
+ i = fl_utf8len(lineStr[ charIndex ]);
+ while (i > 1) {
+ i--;
+ ii++;
+ expandedChar[ii] = lineStr[ charIndex + ii];
+ }
+ }
charStyle = position_style( lineStartPos, lineLen, charIndex,
outIndex );
xStep += string_width( expandedChar, charLen, charStyle );
@@ -822,13 +868,13 @@ int Fl_Text_Display::position_to_xy( int pos, int* X, int* Y ) {
return 1;
}
-/*
-** Find the line number of position "pos". Note: this only works for
-** displayed lines. If the line is not displayed, the function returns
-** 0 (without the mLineStarts array it could turn in to very long
-** calculation involving scanning large amounts of text in the buffer).
-** If continuous wrap mode is on, returns the absolute line number (as opposed
-** to the wrapped line number which is used for scrolling).
+/**
+ Find the line number of position "pos". Note: this only works for
+ displayed lines. If the line is not displayed, the function returns
+ 0 (without the mLineStarts array it could turn in to very long
+ calculation involving scanning large amounts of text in the buffer).
+ If continuous wrap mode is on, returns the absolute line number (as opposed
+ to the wrapped line number which is used for scrolling).
*/
int Fl_Text_Display::position_to_linecol( int pos, int* lineNum, int* column ) {
int retVal;
@@ -855,12 +901,21 @@ int Fl_Text_Display::position_to_linecol( int pos, int* lineNum, int* column ) {
return retVal;
}
-/*
-** Return 1 if position (X, Y) is inside of the primary Fl_Text_Selection
+/**
+ Return 1 if position (X, Y) is inside of the primary Fl_Text_Selection
*/
int Fl_Text_Display::in_selection( int X, int Y ) {
int row, column, pos = xy_to_position( X, Y, CHARACTER_POS );
Fl_Text_Buffer *buf = mBuffer;
+ int ok = 0;
+ while (!ok) {
+ char c = buffer()->character( pos );
+ if (!((c & 0x80) && !(c & 0x40))) {
+ ok = 1;
+ } else {
+ pos++;
+ }
+ }
xy_to_rowcol( X, Y, &row, &column, CHARACTER_POS );
if (range_touches_selection(buf->primary_selection(), mFirstChar, mLastChar))
@@ -868,15 +923,15 @@ int Fl_Text_Display::in_selection( int X, int Y ) {
return buf->primary_selection()->includes(pos, buf->line_start( pos ), column);
}
-/*
-** Correct a column number based on an unconstrained position (as returned by
-** TextDXYToUnconstrainedPosition) to be relative to the last actual newline
-** in the buffer before the row and column position given, rather than the
-** last line start created by line wrapping. This is an adapter
-** for rectangular selections and code written before continuous wrap mode,
-** which thinks that the unconstrained column is the number of characters
-** from the last newline. Obviously this is time consuming, because it
-** invloves character re-counting.
+/**
+ Correct a column number based on an unconstrained position (as returned by
+ TextDXYToUnconstrainedPosition) to be relative to the last actual newline
+ in the buffer before the row and column position given, rather than the
+ last line start created by line wrapping. This is an adapter
+ for rectangular selections and code written before continuous wrap mode,
+ which thinks that the unconstrained column is the number of characters
+ from the last newline. Obviously this is time consuming, because it
+ invloves character re-counting.
*/
int Fl_Text_Display::wrapped_column(int row, int column) {
int lineStart, dispLineStart;
@@ -891,12 +946,12 @@ int Fl_Text_Display::wrapped_column(int row, int column) {
+ buffer()->count_displayed_characters(lineStart, dispLineStart);
}
-/*
-** Correct a row number from an unconstrained position (as returned by
-** TextDXYToUnconstrainedPosition) to a straight number of newlines from the
-** top line of the display. Because rectangular selections are based on
-** newlines, rather than display wrapping, and anywhere a rectangular selection
-** needs a row, it needs it in terms of un-wrapped lines.
+/**
+ Correct a row number from an unconstrained position (as returned by
+ TextDXYToUnconstrainedPosition) to a straight number of newlines from the
+ top line of the display. Because rectangular selections are based on
+ newlines, rather than display wrapping, and anywhere a rectangular selection
+ needs a row, it needs it in terms of un-wrapped lines.
*/
int Fl_Text_Display::wrapped_row(int row) {
if (!mContinuousWrap || row < 0 || row > mNVisibleLines)
@@ -904,13 +959,13 @@ int Fl_Text_Display::wrapped_row(int row) {
return buffer()->count_lines(mFirstChar, mLineStarts[row]);
}
-/*
-** Scroll the display to bring insertion cursor into view.
+/**
+ Scroll the display to bring insertion cursor into view.
**
-** Note: it would be nice to be able to do this without counting lines twice
-** (scroll_() counts them too) and/or to count from the most efficient
-** starting point, but the efficiency of this routine is not as important to
-** the overall performance of the text display.
+ Note: it would be nice to be able to do this without counting lines twice
+ (scroll_() counts them too) and/or to count from the most efficient
+ starting point, but the efficiency of this routine is not as important to
+ the overall performance of the text display.
*/
void Fl_Text_Display::display_insert() {
int hOffset, topLine, X, Y;
@@ -952,28 +1007,43 @@ void Fl_Text_Display::display_insert() {
scroll_(topLine, hOffset);
}
+/** Scrolls the text buffer to show the current insert position.*/
void Fl_Text_Display::show_insert_position() {
display_insert_position_hint = 1;
resize(x(), y(), w(), h());
}
/*
-** Cursor movement functions
+ Cursor movement functions
*/
+/** Moves the current insert position right one character.*/
int Fl_Text_Display::move_right() {
+ int ok = 0;
+ while (!ok) {
if ( mCursorPos >= mBuffer->length() )
return 0;
insert_position( mCursorPos + 1 );
+ int pos = insert_position();
+ char c = buffer()->character( pos );
+ if (!((c & 0x80) && !(c & 0x40))) ok = 1;
+ }
return 1;
}
-
+/** Moves the current insert position left one character.*/
int Fl_Text_Display::move_left() {
+ int ok = 0;
+ while (!ok) {
if ( mCursorPos <= 0 )
return 0;
insert_position( mCursorPos - 1 );
+ int pos = insert_position();
+ char c = buffer()->character( pos );
+ if (!((c & 0x80) && !(c & 0x40))) ok = 1;
+ }
return 1;
}
+/** Moves the current insert position up one line.*/
int Fl_Text_Display::move_up() {
int lineStartPos, column, prevLineStartPos, newPos, visLineNum;
@@ -1004,11 +1074,23 @@ int Fl_Text_Display::move_up() {
/* move the cursor */
insert_position( newPos );
+ int ok = 0;
+ while (!ok) {
+ int pos = insert_position();
+ char c = buffer()->character( pos );
+ if (!((c & 0x80) && !(c & 0x40))) {
+ ok = 1;
+ } else {
+ insert_position( mCursorPos + 1 );
+ }
+ }
+
/* if a preferred column wasn't aleady established, establish it */
mCursorPreferredCol = column;
return 1;
}
+/** Moves the current insert position down one line.*/
int Fl_Text_Display::move_down() {
int lineStartPos, column, nextLineStartPos, newPos, visLineNum;
@@ -1028,15 +1110,25 @@ int Fl_Text_Display::move_down() {
newPos = min(newPos, line_end(nextLineStartPos, true));
insert_position( newPos );
+ int ok = 0;
+ while (!ok) {
+ int pos = insert_position();
+ char c = buffer()->character( pos );
+ if (!((c & 0x80) && !(c & 0x40))) {
+ ok = 1;
+ } else {
+ insert_position( mCursorPos + 1 );
+ }
+ }
mCursorPreferredCol = column;
return 1;
}
-/*
-** Same as BufCountLines, but takes in to account wrapping if wrapping is
-** turned on. If the caller knows that startPos is at a line start, it
-** can pass "startPosIsLineStart" as True to make the call more efficient
-** by avoiding the additional step of scanning back to the last newline.
+/**
+ Same as BufCountLines, but takes in to account wrapping if wrapping is
+ turned on. If the caller knows that startPos is at a line start, it
+ can pass "startPosIsLineStart" as True to make the call more efficient
+ by avoiding the additional step of scanning back to the last newline.
*/
int Fl_Text_Display::count_lines(int startPos, int endPos,
bool startPosIsLineStart) {
@@ -1063,11 +1155,11 @@ int Fl_Text_Display::count_lines(int startPos, int endPos,
return retLines;
}
-/*
-** Same as BufCountForwardNLines, but takes in to account line breaks when
-** wrapping is turned on. If the caller knows that startPos is at a line start,
-** it can pass "startPosIsLineStart" as True to make the call more efficient
-** by avoiding the additional step of scanning back to the last newline.
+/**
+ Same as BufCountForwardNLines, but takes in to account line breaks when
+ wrapping is turned on. If the caller knows that startPos is at a line start,
+ it can pass "startPosIsLineStart" as True to make the call more efficient
+ by avoiding the additional step of scanning back to the last newline.
*/
int Fl_Text_Display::skip_lines(int startPos, int nLines,
bool startPosIsLineStart) {
@@ -1088,21 +1180,21 @@ int Fl_Text_Display::skip_lines(int startPos, int nLines,
return retPos;
}
-/*
-** Same as BufEndOfLine, but takes in to account line breaks when wrapping
-** is turned on. If the caller knows that startPos is at a line start, it
-** can pass "startPosIsLineStart" as True to make the call more efficient
-** by avoiding the additional step of scanning back to the last newline.
+/**
+ Same as BufEndOfLine, but takes in to account line breaks when wrapping
+ is turned on. If the caller knows that startPos is at a line start, it
+ can pass "startPosIsLineStart" as True to make the call more efficient
+ by avoiding the additional step of scanning back to the last newline.
**
-** Note that the definition of the end of a line is less clear when continuous
-** wrap is on. With continuous wrap off, it's just a pointer to the newline
-** that ends the line. When it's on, it's the character beyond the last
-** DISPLAYABLE character on the line, where a whitespace character which has
-** been "converted" to a newline for wrapping is not considered displayable.
-** Also note that, a line can be wrapped at a non-whitespace character if the
-** line had no whitespace. In this case, this routine returns a pointer to
-** the start of the next line. This is also consistent with the model used by
-** visLineLength.
+ Note that the definition of the end of a line is less clear when continuous
+ wrap is on. With continuous wrap off, it's just a pointer to the newline
+ that ends the line. When it's on, it's the character beyond the last
+ DISPLAYABLE character on the line, where a whitespace character which has
+ been "converted" to a newline for wrapping is not considered displayable.
+ Also note that, a line can be wrapped at a non-whitespace character if the
+ line had no whitespace. In this case, this routine returns a pointer to
+ the start of the next line. This is also consistent with the model used by
+ visLineLength.
*/
int Fl_Text_Display::line_end(int pos, bool startPosIsLineStart) {
int retLines, retPos, retLineStart, retLineEnd;
@@ -1119,9 +1211,9 @@ int Fl_Text_Display::line_end(int pos, bool startPosIsLineStart) {
return retLineEnd;
}
-/*
-** Same as BufStartOfLine, but returns the character after last wrap point
-** rather than the last newline.
+/**
+ Same as BufStartOfLine, but returns the character after last wrap point
+ rather than the last newline.
*/
int Fl_Text_Display::line_start(int pos) {
int retLines, retPos, retLineStart, retLineEnd;
@@ -1135,9 +1227,9 @@ int Fl_Text_Display::line_start(int pos) {
return retLineStart;
}
-/*
-** Same as BufCountBackwardNLines, but takes in to account line breaks when
-** wrapping is turned on.
+/**
+ Same as BufCountBackwardNLines, but takes in to account line breaks when
+ wrapping is turned on.
*/
int Fl_Text_Display::rewind_lines(int startPos, int nLines) {
Fl_Text_Buffer *buf = buffer();
@@ -1167,6 +1259,7 @@ static inline int fl_isseparator(int c) {
return c != '$' && c != '_' && (isspace(c) || ispunct(c));
}
+/** Moves the current insert position right one word.*/
void Fl_Text_Display::next_word() {
int pos = insert_position();
while (pos < buffer()->length() && !fl_isseparator(buffer()->character(pos))) {
@@ -1179,6 +1272,7 @@ void Fl_Text_Display::next_word() {
insert_position( pos );
}
+/** Moves the current insert position left one word.*/
void Fl_Text_Display::previous_word() {
int pos = insert_position();
if (pos==0) return;
@@ -1194,13 +1288,13 @@ void Fl_Text_Display::previous_word() {
insert_position( pos );
}
-/*
-** Callback attached to the text buffer to receive delete information before
-** the modifications are actually made.
+/**
+ Callback attached to the text buffer to receive delete information before
+ the modifications are actually made.
*/
void Fl_Text_Display::buffer_predelete_cb(int pos, int nDeleted, void *cbArg) {
Fl_Text_Display *textD = (Fl_Text_Display *)cbArg;
- if (textD->mContinuousWrap &&
+ if (textD->mContinuousWrap &&
(textD->mFixedFontWidth == -1 || textD->mModifyingTabDistance))
/* Note: we must perform this measurement, even if there is not a
single character deleted; the number of "deleted" lines is the
@@ -1215,8 +1309,8 @@ void Fl_Text_Display::buffer_predelete_cb(int pos, int nDeleted, void *cbArg) {
textD->mSuppressResync = 0; /* Probably not needed, but just in case */
}
-/*
-** Callback attached to the text buffer to receive modification information
+/**
+ Callback attached to the text buffer to receive modification information
*/
void Fl_Text_Display::buffer_modified_cb( int pos, int nInserted, int nDeleted,
int nRestyled, const char *deletedText, void *cbArg ) {
@@ -1332,27 +1426,27 @@ void Fl_Text_Display::buffer_modified_cb( int pos, int nInserted, int nDeleted,
textD->extend_range_for_styles( &startDispPos, &endDispPos );
/* Redisplay computed range */
- textD->redisplay_range( startDispPos, endDispPos );
+ textD->redisplay_range( startDispPos, endDispPos ); // FIXME utf8
}
-/*
-** In continuous wrap mode, internal line numbers are calculated after
-** wrapping. A separate non-wrapped line count is maintained when line
-** numbering is turned on. There is some performance cost to maintaining this
-** line count, so normally absolute line numbers are not tracked if line
-** numbering is off. This routine allows callers to specify that they still
-** want this line count maintained (for use via TextDPosToLineAndCol).
-** More specifically, this allows the line number reported in the statistics
-** line to be calibrated in absolute lines, rather than post-wrapped lines.
+/**
+ In continuous wrap mode, internal line numbers are calculated after
+ wrapping. A separate non-wrapped line count is maintained when line
+ numbering is turned on. There is some performance cost to maintaining this
+ line count, so normally absolute line numbers are not tracked if line
+ numbering is off. This routine allows callers to specify that they still
+ want this line count maintained (for use via TextDPosToLineAndCol).
+ More specifically, this allows the line number reported in the statistics
+ line to be calibrated in absolute lines, rather than post-wrapped lines.
*/
void Fl_Text_Display::maintain_absolute_top_line_number(int state) {
mNeedAbsTopLineNum = state;
reset_absolute_top_line_number();
}
-/*
-** Returns the absolute (non-wrapped) line number of the first line displayed.
-** Returns 0 if the absolute top line number is not being maintained.
+/**
+ Returns the absolute (non-wrapped) line number of the first line displayed.
+ Returns 0 if the absolute top line number is not being maintained.
*/
int Fl_Text_Display::get_absolute_top_line_number() {
if (!mContinuousWrap)
@@ -1362,8 +1456,8 @@ int Fl_Text_Display::get_absolute_top_line_number() {
return 0;
}
-/*
-** Re-calculate absolute top line number for a change in scroll position.
+/**
+ Re-calculate absolute top line number for a change in scroll position.
*/
void Fl_Text_Display::absolute_top_line_number(int oldFirstChar) {
if (maintaining_absolute_top_line_number()) {
@@ -1374,28 +1468,28 @@ void Fl_Text_Display::absolute_top_line_number(int oldFirstChar) {
}
}
-/*
-** Return true if a separate absolute top line number is being maintained
-** (for displaying line numbers or showing in the statistics line).
+/**
+ Return true if a separate absolute top line number is being maintained
+ (for displaying line numbers or showing in the statistics line).
*/
int Fl_Text_Display::maintaining_absolute_top_line_number() {
return mContinuousWrap &&
(mLineNumWidth != 0 || mNeedAbsTopLineNum);
}
-/*
-** Count lines from the beginning of the buffer to reestablish the
-** absolute (non-wrapped) top line number. If mode is not continuous wrap,
-** or the number is not being maintained, does nothing.
+/**
+ Count lines from the beginning of the buffer to reestablish the
+ absolute (non-wrapped) top line number. If mode is not continuous wrap,
+ or the number is not being maintained, does nothing.
*/
void Fl_Text_Display::reset_absolute_top_line_number() {
mAbsTopLineNum = 1;
absolute_top_line_number(0);
}
-/*
-** Find the line number of position "pos" relative to the first line of
-** displayed text. Returns 0 if the line is not displayed.
+/**
+ Find the line number of position "pos" relative to the first line of
+ displayed text. Returns 0 if the line is not displayed.
*/
int Fl_Text_Display::position_to_line( int pos, int *lineNum ) {
int i;
@@ -1427,12 +1521,12 @@ int Fl_Text_Display::position_to_line( int pos, int *lineNum ) {
return 0; /* probably never be reached */
}
-/*
-** Draw the text on a single line represented by "visLineNum" (the
-** number of lines down from the top of the display), limited by
-** "leftClip" and "rightClip" window coordinates and "leftCharIndex" and
-** "rightCharIndex" character positions (not including the character at
-** position "rightCharIndex").
+/**
+ Draw the text on a single line represented by "visLineNum" (the
+ number of lines down from the top of the display), limited by
+ "leftClip" and "rightClip" window coordinates and "leftCharIndex" and
+ "rightCharIndex" character positions (not including the character at
+ position "rightCharIndex").
*/
void Fl_Text_Display::draw_vline(int visLineNum, int leftClip, int rightClip,
int leftCharIndex, int rightCharIndex) {
@@ -1476,7 +1570,7 @@ void Fl_Text_Display::draw_vline(int visLineNum, int leftClip, int rightClip,
stdCharWidth = TMPFONTWIDTH; //mFontStruct->max_bounds.width;
if ( stdCharWidth <= 0 ) {
Fl::error("Fl_Text_Display::draw_vline(): bad font measurement");
- free((void *)lineStr);
+ if (lineStr) free((void *)lineStr);
return;
}
@@ -1509,6 +1603,16 @@ void Fl_Text_Display::draw_vline(int visLineNum, int leftClip, int rightClip,
charLen = charIndex >= lineLen ? 1 :
Fl_Text_Buffer::expand_character( lineStr[ charIndex ], outIndex,
expandedChar, buf->tab_distance(), buf->null_substitution_character() );
+ if (charIndex < lineLen && charLen > 1 && (lineStr[ charIndex ] & 0x80)) {
+ int i, ii = 0;;
+ i = fl_utf8len(lineStr[ charIndex ]);
+ while (i > 1) {
+ i--;
+ ii++;
+ expandedChar[ii] = lineStr[ charIndex + ii];
+ }
+ }
+
style = position_style( lineStartPos, lineLen, charIndex,
outIndex + dispIndexOffset );
charWidth = charIndex >= lineLen ? stdCharWidth :
@@ -1537,6 +1641,15 @@ void Fl_Text_Display::draw_vline(int visLineNum, int leftClip, int rightClip,
charLen = charIndex >= lineLen ? 1 :
Fl_Text_Buffer::expand_character( lineStr[ charIndex ], outIndex, expandedChar,
buf->tab_distance(), buf->null_substitution_character() );
+ if (charIndex < lineLen && charLen > 1 && (lineStr[ charIndex ] & 0x80)) {
+ int i, ii = 0;;
+ i = fl_utf8len(lineStr[ charIndex ]);
+ while (i > 1) {
+ i--;
+ ii++;
+ expandedChar[ii] = lineStr[ charIndex + ii];
+ }
+ }
charStyle = position_style( lineStartPos, lineLen, charIndex,
outIndex + dispIndexOffset );
for ( i = 0; i < charLen; i++ ) {
@@ -1551,7 +1664,11 @@ void Fl_Text_Display::draw_vline(int visLineNum, int leftClip, int rightClip,
}
if ( charIndex < lineLen ) {
*outPtr = expandedChar[ i ];
- charWidth = string_width( &expandedChar[ i ], 1, charStyle );
+ int l = 1;
+ if (*outPtr & 0x80) {
+ l = fl_utf8len(*outPtr);
+ }
+ charWidth = string_width( &expandedChar[ i ], l, charStyle );
} else
charWidth = stdCharWidth;
outPtr++;
@@ -1571,6 +1688,15 @@ void Fl_Text_Display::draw_vline(int visLineNum, int leftClip, int rightClip,
charLen = charIndex >= lineLen ? 1 :
Fl_Text_Buffer::expand_character( lineStr[ charIndex ], outIndex, expandedChar,
buf->tab_distance(), buf->null_substitution_character() );
+ if (charIndex < lineLen && charLen > 1 && (lineStr[ charIndex ] & 0x80)) {
+ int i, ii = 0;;
+ i = fl_utf8len(lineStr[ charIndex ]);
+ while (i > 1) {
+ i--;
+ ii++;
+ expandedChar[ii] = lineStr[ charIndex + ii];
+ }
+ }
charStyle = position_style( lineStartPos, lineLen, charIndex,
outIndex + dispIndexOffset );
for ( i = 0; i < charLen; i++ ) {
@@ -1585,7 +1711,11 @@ void Fl_Text_Display::draw_vline(int visLineNum, int leftClip, int rightClip,
}
if ( charIndex < lineLen ) {
*outPtr = expandedChar[ i ];
- charWidth = string_width( &expandedChar[ i ], 1, charStyle );
+ int l = 1;
+ if (*outPtr & 0x80) {
+ l = fl_utf8len(*outPtr);
+ }
+ charWidth = string_width( &expandedChar[ i ], l, charStyle );
} else
charWidth = stdCharWidth;
outPtr++;
@@ -1624,13 +1754,13 @@ void Fl_Text_Display::draw_vline(int visLineNum, int leftClip, int rightClip,
free((void *)lineStr);
}
-/*
-** Draw a string or blank area according to parameter "style", using the
-** appropriate colors and drawing method for that style, with top left
-** corner at X, y. If style says to draw text, use "string" as source of
-** characters, and draw "nChars", if style is FILL, erase
-** rectangle where text would have drawn from X to toX and from Y to
-** the maximum Y extent of the current font(s).
+/**
+ Draw a string or blank area according to parameter "style", using the
+ appropriate colors and drawing method for that style, with top left
+ corner at X, y. If style says to draw text, use "string" as source of
+ characters, and draw "nChars", if style is FILL, erase
+ rectangle where text would have drawn from X to toX and from Y to
+ the maximum Y extent of the current font(s).
*/
void Fl_Text_Display::draw_string( int style, int X, int Y, int toX,
const char *string, int nChars ) {
@@ -1714,8 +1844,8 @@ void Fl_Text_Display::draw_string( int style, int X, int Y, int toX,
}
-/*
-** Clear a rectangle with the appropriate background color for "style"
+/**
+ Clear a rectangle with the appropriate background color for "style"
*/
void Fl_Text_Display::clear_rect( int style, int X, int Y,
int width, int height ) {
@@ -1742,8 +1872,8 @@ void Fl_Text_Display::clear_rect( int style, int X, int Y,
}
-/*
-** Draw a cursor with top center at X, y.
+/**
+ Draw a cursor with top center at X, y.
*/
void Fl_Text_Display::draw_cursor( int X, int Y ) {
typedef struct {
@@ -1810,21 +1940,21 @@ void Fl_Text_Display::draw_cursor( int X, int Y ) {
}
}
-/*
-** Determine the drawing method to use to draw a specific character from "buf".
-** "lineStartPos" gives the character index where the line begins, "lineIndex",
-** the number of characters past the beginning of the line, and "dispIndex",
-** the number of displayed characters past the beginning of the line. Passing
-** lineStartPos of -1 returns the drawing style for "no text".
+/**
+ Determine the drawing method to use to draw a specific character from "buf".
+ "lineStartPos" gives the character index where the line begins, "lineIndex",
+ the number of characters past the beginning of the line, and "dispIndex",
+ the number of displayed characters past the beginning of the line. Passing
+ lineStartPos of -1 returns the drawing style for "no text".
**
-** Why not just: position_style(pos)? Because style applies to blank areas
-** of the window beyond the text boundaries, and because this routine must also
-** decide whether a position is inside of a rectangular Fl_Text_Selection, and do
-** so efficiently, without re-counting character positions from the start of the
-** line.
+ Why not just: position_style(pos)? Because style applies to blank areas
+ of the window beyond the text boundaries, and because this routine must also
+ decide whether a position is inside of a rectangular Fl_Text_Selection, and do
+ so efficiently, without re-counting character positions from the start of the
+ line.
**
-** Note that style is a somewhat incorrect name, drawing method would
-** be more appropriate.
+ Note that style is a somewhat incorrect name, drawing method would
+ be more appropriate.
*/
int Fl_Text_Display::position_style( int lineStartPos,
int lineLen, int lineIndex, int dispIndex ) {
@@ -1856,8 +1986,8 @@ int Fl_Text_Display::position_style( int lineStartPos,
return style;
}
-/*
-** Find the width of a string in the font of a particular style
+/**
+ Find the width of a string in the font of a particular style
*/
int Fl_Text_Display::string_width( const char *string, int length, int style ) {
Fl_Font font;
@@ -1879,12 +2009,12 @@ int Fl_Text_Display::string_width( const char *string, int length, int style ) {
return ( int ) ( fl_width( string, length ) );
}
-/*
-** Translate window coordinates to the nearest (insert cursor or character
-** cell) text position. The parameter posType specifies how to interpret the
-** position: CURSOR_POS means translate the coordinates to the nearest cursor
-** position, and CHARACTER_POS means return the position of the character
-** closest to (X, Y).
+/**
+ Translate window coordinates to the nearest (insert cursor or character
+ cell) text position. The parameter posType specifies how to interpret the
+ position: CURSOR_POS means translate the coordinates to the nearest cursor
+ position, and CHARACTER_POS means return the position of the character
+ closest to (X, Y).
*/
int Fl_Text_Display::xy_to_position( int X, int Y, int posType ) {
int charIndex, lineStart, lineLen, fontHeight;
@@ -1918,6 +2048,15 @@ int Fl_Text_Display::xy_to_position( int X, int Y, int posType ) {
for ( charIndex = 0; charIndex < lineLen; charIndex++ ) {
charLen = Fl_Text_Buffer::expand_character( lineStr[ charIndex ], outIndex, expandedChar,
mBuffer->tab_distance(), mBuffer->null_substitution_character() );
+ if (charLen > 1 && (lineStr[ charIndex ] & 0x80)) {
+ int i, ii = 0;;
+ i = fl_utf8len(lineStr[ charIndex ]);
+ while (i > 1) {
+ i--;
+ ii++;
+ expandedChar[ii] = lineStr[ charIndex + ii];
+ }
+ }
charStyle = position_style( lineStart, lineLen, charIndex, outIndex );
charWidth = string_width( expandedChar, charLen, charStyle );
if ( X < xStep + ( posType == CURSOR_POS ? charWidth / 2 : charWidth ) ) {
@@ -1934,13 +2073,13 @@ int Fl_Text_Display::xy_to_position( int X, int Y, int posType ) {
return lineStart + lineLen;
}
-/*
-** Translate window coordinates to the nearest row and column number for
-** positioning the cursor. This, of course, makes no sense when the font is
-** proportional, since there are no absolute columns. The parameter posType
-** specifies how to interpret the position: CURSOR_POS means translate the
-** coordinates to the nearest position between characters, and CHARACTER_POS
-** means translate the position to the nearest character cell.
+/**
+ Translate window coordinates to the nearest row and column number for
+ positioning the cursor. This, of course, makes no sense when the font is
+ proportional, since there are no absolute columns. The parameter posType
+ specifies how to interpret the position: CURSOR_POS means translate the
+ coordinates to the nearest position between characters, and CHARACTER_POS
+ means translate the position to the nearest character cell.
*/
void Fl_Text_Display::xy_to_rowcol( int X, int Y, int *row,
int *column, int posType ) {
@@ -1956,12 +2095,12 @@ void Fl_Text_Display::xy_to_rowcol( int X, int Y, int *row,
if ( *column < 0 ) * column = 0;
}
-/*
-** Offset the line starts array, mTopLineNum, mFirstChar and lastChar, for a new
-** vertical scroll position given by newTopLineNum. If any currently displayed
-** lines will still be visible, salvage the line starts values, otherwise,
-** count lines from the nearest known line start (start or end of buffer, or
-** the closest value in the mLineStarts array)
+/**
+ Offset the line starts array, mTopLineNum, mFirstChar and lastChar, for a new
+ vertical scroll position given by newTopLineNum. If any currently displayed
+ lines will still be visible, salvage the line starts values, otherwise,
+ count lines from the nearest known line start (start or end of buffer, or
+ the closest value in the mLineStarts array)
*/
void Fl_Text_Display::offset_line_starts( int newTopLineNum ) {
int oldTopLineNum = mTopLineNum;
@@ -2014,11 +2153,11 @@ void Fl_Text_Display::offset_line_starts( int newTopLineNum ) {
absolute_top_line_number(oldFirstChar);
}
-/*
-** Update the line starts array, mTopLineNum, mFirstChar and lastChar for text
-** display "textD" after a modification to the text buffer, given by the
-** position where the change began "pos", and the nmubers of characters
-** and lines inserted and deleted.
+/**
+ Update the line starts array, mTopLineNum, mFirstChar and lastChar for text
+ display "textD" after a modification to the text buffer, given by the
+ position where the change began "pos", and the nmubers of characters
+ and lines inserted and deleted.
*/
void Fl_Text_Display::update_line_starts( int pos, int charsInserted,
int charsDeleted, int linesInserted, int linesDeleted, int *scrolled ) {
@@ -2110,13 +2249,13 @@ void Fl_Text_Display::update_line_starts( int pos, int charsInserted,
*scrolled = 0;
}
-/*
-** Scan through the text in the "textD"'s buffer and recalculate the line
-** starts array values beginning at index "startLine" and continuing through
-** (including) "endLine". It assumes that the line starts entry preceding
-** "startLine" (or mFirstChar if startLine is 0) is good, and re-counts
-** newlines to fill in the requested entries. Out of range values for
-** "startLine" and "endLine" are acceptable.
+/**
+ Scan through the text in the "textD"'s buffer and recalculate the line
+ starts array values beginning at index "startLine" and continuing through
+ (including) "endLine". It assumes that the line starts entry preceding
+ "startLine" (or mFirstChar if startLine is 0) is good, and re-counts
+ newlines to fill in the requested entries. Out of range values for
+ "startLine" and "endLine" are acceptable.
*/
void Fl_Text_Display::calc_line_starts( int startLine, int endLine ) {
int startPos, bufLen = mBuffer->length();
@@ -2171,9 +2310,9 @@ void Fl_Text_Display::calc_line_starts( int startLine, int endLine ) {
lineStarts[ line ] = -1;
}
-/*
-** Given a Fl_Text_Display with a complete, up-to-date lineStarts array, update
-** the lastChar entry to point to the last buffer position displayed.
+/**
+ Given a Fl_Text_Display with a complete, up-to-date lineStarts array, update
+ the lastChar entry to point to the last buffer position displayed.
*/
void Fl_Text_Display::calc_last_char() {
int i;
@@ -2181,6 +2320,7 @@ void Fl_Text_Display::calc_last_char() {
mLastChar = i < 0 ? 0 : line_end(mLineStarts[i], true);
}
+/** Scrolls the current buffer to start at the specified line and column.*/
void Fl_Text_Display::scroll(int topLineNum, int horizOffset) {
mTopLineNumHint = topLineNum;
mHorizOffsetHint = horizOffset;
@@ -2213,9 +2353,9 @@ void Fl_Text_Display::scroll_(int topLineNum, int horizOffset) {
damage(FL_DAMAGE_EXPOSE);
}
-/*
-** Update the minimum, maximum, slider size, page increment, and value
-** for vertical scroll bar.
+/**
+ Update the minimum, maximum, slider size, page increment, and value
+ for vertical scroll bar.
*/
void Fl_Text_Display::update_v_scrollbar() {
/* The Vert. scroll bar value and slider size directly represent the top
@@ -2232,17 +2372,17 @@ void Fl_Text_Display::update_v_scrollbar() {
mVScrollBar->linesize(3);
}
-/*
-** Update the minimum, maximum, slider size, page increment, and value
-** for the horizontal scroll bar.
+/**
+ Update the minimum, maximum, slider size, page increment, and value
+ for the horizontal scroll bar.
*/
void Fl_Text_Display::update_h_scrollbar() {
int sliderMax = max(longest_vline(), text_area.w + mHorizOffset);
mHScrollBar->value( mHorizOffset, text_area.w, 0, sliderMax );
}
-/*
-** Callbacks for drag or valueChanged on scroll bars
+/**
+ Callbacks for drag or valueChanged on scroll bars
*/
void Fl_Text_Display::v_scrollbar_cb(Fl_Scrollbar* b, Fl_Text_Display* textD) {
if (b->value() == textD->mTopLineNum) return;
@@ -2254,11 +2394,11 @@ void Fl_Text_Display::h_scrollbar_cb(Fl_Scrollbar* b, Fl_Text_Display* textD) {
textD->scroll(textD->mTopLineNum, b->value());
}
-/*
-** Refresh the line number area. If clearAll is False, writes only over
-** the character cell areas. Setting clearAll to True will clear out any
-** stray marks outside of the character cell area, which might have been
-** left from before a resize or font change.
+/**
+ Refresh the line number area. If clearAll is False, writes only over
+ the character cell areas. Setting clearAll to True will clear out any
+ stray marks outside of the character cell area, which might have been
+ left from before a resize or font change.
*/
void Fl_Text_Display::draw_line_numbers(bool /*clearAll*/) {
#if 0
@@ -2322,8 +2462,8 @@ static int min( int i1, int i2 ) {
return i1 <= i2 ? i1 : i2;
}
-/*
-** Count the number of newlines in a null-terminated text string;
+/**
+ Count the number of newlines in a null-terminated text string;
*/
static int countlines( const char *string ) {
const char * c;
@@ -2336,8 +2476,8 @@ static int countlines( const char *string ) {
return lineCount;
}
-/*
-** Return the width in pixels of the displayed line pointed to by "visLineNum"
+/**
+ Return the width in pixels of the displayed line pointed to by "visLineNum"
*/
int Fl_Text_Display::measure_vline( int visLineNum ) {
int i, width = 0, len, style, lineLen = vline_length( visLineNum );
@@ -2376,17 +2516,17 @@ int Fl_Text_Display::measure_vline( int visLineNum ) {
return width;
}
-/*
-** Return true if there are lines visible with no corresponding buffer text
+/**
+ Return true if there are lines visible with no corresponding buffer text
*/
int Fl_Text_Display::empty_vlines() {
return mNVisibleLines > 0 &&
mLineStarts[ mNVisibleLines - 1 ] == -1;
}
-/*
-** Return the length of a line (number of displayable characters) by examining
-** entries in the line starts array rather than by scanning for newlines
+/**
+ Return the length of a line (number of displayable characters) by examining
+ entries in the line starts array rather than by scanning for newlines
*/
int Fl_Text_Display::vline_length( int visLineNum ) {
int nextLineStart, lineStartPos;
@@ -2408,14 +2548,14 @@ int Fl_Text_Display::vline_length( int visLineNum ) {
return nextLineStart - lineStartPos;
}
-/*
-** When continuous wrap is on, and the user inserts or deletes characters,
-** wrapping can happen before and beyond the changed position. This routine
-** finds the extent of the changes, and counts the deleted and inserted lines
-** over that range. It also attempts to minimize the size of the range to
-** what has to be counted and re-displayed, so the results can be useful
-** both for delimiting where the line starts need to be recalculated, and
-** for deciding what part of the text to redisplay.
+/**
+ When continuous wrap is on, and the user inserts or deletes characters,
+ wrapping can happen before and beyond the changed position. This routine
+ finds the extent of the changes, and counts the deleted and inserted lines
+ over that range. It also attempts to minimize the size of the range to
+ what has to be counted and re-displayed, so the results can be useful
+ both for delimiting where the line starts need to be recalculated, and
+ for deciding what part of the text to redisplay.
*/
void Fl_Text_Display::find_wrap_range(const char *deletedText, int pos,
int nInserted, int nDeleted, int *modRangeStart, int *modRangeEnd,
@@ -2558,17 +2698,17 @@ void Fl_Text_Display::find_wrap_range(const char *deletedText, int pos,
mSuppressResync = 0;
}
-/*
-** This is a stripped-down version of the findWrapRange() function above,
-** intended to be used to calculate the number of "deleted" lines during
-** a buffer modification. It is called _before_ the modification takes place.
-**
-** This function should only be called in continuous wrap mode with a
-** non-fixed font width. In that case, it is impossible to calculate
-** the number of deleted lines, because the necessary style information
-** is no longer available _after_ the modification. In other cases, we
-** can still perform the calculation afterwards (possibly even more
-** efficiently).
+/**
+ This is a stripped-down version of the findWrapRange() function above,
+ intended to be used to calculate the number of "deleted" lines during
+ a buffer modification. It is called _before_ the modification takes place.
+
+ This function should only be called in continuous wrap mode with a
+ non-fixed font width. In that case, it is impossible to calculate
+ the number of deleted lines, because the necessary style information
+ is no longer available _after_ the modification. In other cases, we
+ can still perform the calculation afterwards (possibly even more
+ efficiently).
*/
void Fl_Text_Display::measure_deleted_lines(int pos, int nDeleted) {
int retPos, retLines, retLineStart, retLineEnd;
@@ -2576,7 +2716,7 @@ void Fl_Text_Display::measure_deleted_lines(int pos, int nDeleted) {
int nVisLines = mNVisibleLines;
int *lineStarts = mLineStarts;
int countFrom, lineStart;
- int nLines = 0, i;
+ int visLineNum = 0, nLines = 0, i;
/*
** Determine where to begin searching: either the previous newline, or
** if possible, limit to the start of the (original) previous displayed
@@ -2586,8 +2726,11 @@ void Fl_Text_Display::measure_deleted_lines(int pos, int nDeleted) {
for (i=nVisLines-1; i>0; i--)
if (lineStarts[i] != -1 && pos >= lineStarts[i])
break;
- if (i > 0) countFrom = lineStarts[i-1];
- else countFrom = buf->line_start(pos);
+ if (i > 0) {
+ countFrom = lineStarts[i-1];
+ visLineNum = i-1;
+ } else
+ countFrom = buf->line_start(pos);
} else
countFrom = buf->line_start(pos);
@@ -2631,22 +2774,22 @@ void Fl_Text_Display::measure_deleted_lines(int pos, int nDeleted) {
mSuppressResync = 1;
}
-/*
-** Count forward from startPos to either maxPos or maxLines (whichever is
-** reached first), and return all relevant positions and line count.
-** The provided textBuffer may differ from the actual text buffer of the
-** widget. In that case it must be a (partial) copy of the actual text buffer
-** and the styleBufOffset argument must indicate the starting position of the
-** copy, to take into account the correct style information.
+/**
+ Count forward from startPos to either maxPos or maxLines (whichever is
+ reached first), and return all relevant positions and line count.
+ The provided textBuffer may differ from the actual text buffer of the
+ widget. In that case it must be a (partial) copy of the actual text buffer
+ and the styleBufOffset argument must indicate the starting position of the
+ copy, to take into account the correct style information.
**
-** Returned values:
+ Returned values:
**
-** retPos: Position where counting ended. When counting lines, the
-** position returned is the start of the line "maxLines"
-** lines beyond "startPos".
-** retLines: Number of line breaks counted
-** retLineStart: Start of the line where counting ended
-** retLineEnd: End position of the last line traversed
+ retPos: Position where counting ended. When counting lines, the
+ position returned is the start of the line "maxLines"
+ lines beyond "startPos".
+ retLines: Number of line breaks counted
+ retLineStart: Start of the line where counting ended
+ retLineEnd: End position of the last line traversed
*/
void Fl_Text_Display::wrapped_line_counter(Fl_Text_Buffer *buf, int startPos,
int maxPos, int maxLines, bool startPosIsLineStart, int styleBufOffset,
@@ -2775,19 +2918,19 @@ void Fl_Text_Display::wrapped_line_counter(Fl_Text_Buffer *buf, int startPos,
*retLineEnd = buf->length();
}
-/*
-** Measure the width in pixels of a character "c" at a particular column
-** "colNum" and buffer position "pos". This is for measuring characters in
-** proportional or mixed-width highlighting fonts.
+/**
+ Measure the width in pixels of a character "c" at a particular column
+ "colNum" and buffer position "pos". This is for measuring characters in
+ proportional or mixed-width highlighting fonts.
**
-** A note about proportional and mixed-width fonts: the mixed width and
-** proportional font code in nedit does not get much use in general editing,
-** because nedit doesn't allow per-language-mode fonts, and editing programs
-** in a proportional font is usually a bad idea, so very few users would
-** choose a proportional font as a default. There are still probably mixed-
-** width syntax highlighting cases where things don't redraw properly for
-** insertion/deletion, though static display and wrapping and resizing
-** should now be solid because they are now used for online help display.
+ A note about proportional and mixed-width fonts: the mixed width and
+ proportional font code in nedit does not get much use in general editing,
+ because nedit doesn't allow per-language-mode fonts, and editing programs
+ in a proportional font is usually a bad idea, so very few users would
+ choose a proportional font as a default. There are still probably mixed-
+ width syntax highlighting cases where things don't redraw properly for
+ insertion/deletion, though static display and wrapping and resizing
+ should now be solid because they are now used for online help display.
*/
int Fl_Text_Display::measure_proportional_character(char c, int colNum, int pos) {
int charLen, style;
@@ -2809,15 +2952,15 @@ int Fl_Text_Display::measure_proportional_character(char c, int colNum, int pos)
return string_width(expChar, charLen, style);
}
-/*
-** Finds both the end of the current line and the start of the next line. Why?
-** In continuous wrap mode, if you need to know both, figuring out one from the
-** other can be expensive or error prone. The problem comes when there's a
-** trailing space or tab just before the end of the buffer. To translate an
-** end of line value to or from the next lines start value, you need to know
-** whether the trailing space or tab is being used as a line break or just a
-** normal character, and to find that out would otherwise require counting all
-** the way back to the beginning of the line.
+/**
+ Finds both the end of the current line and the start of the next line. Why?
+ In continuous wrap mode, if you need to know both, figuring out one from the
+ other can be expensive or error prone. The problem comes when there's a
+ trailing space or tab just before the end of the buffer. To translate an
+ end of line value to or from the next lines start value, you need to know
+ whether the trailing space or tab is being used as a line break or just a
+ normal character, and to find that out would otherwise require counting all
+ the way back to the beginning of the line.
*/
void Fl_Text_Display::find_line_end(int startPos, bool startPosIsLineStart,
int *lineEnd, int *nextLineStart) {
@@ -2837,21 +2980,21 @@ void Fl_Text_Display::find_line_end(int startPos, bool startPosIsLineStart,
return;
}
-/*
-** Line breaks in continuous wrap mode usually happen at newlines or
-** whitespace. This line-terminating character is not included in line
-** width measurements and has a special status as a non-visible character.
-** However, lines with no whitespace are wrapped without the benefit of a
-** line terminating character, and this distinction causes endless trouble
-** with all of the text display code which was originally written without
-** continuous wrap mode and always expects to wrap at a newline character.
+/**
+ Line breaks in continuous wrap mode usually happen at newlines or
+ whitespace. This line-terminating character is not included in line
+ width measurements and has a special status as a non-visible character.
+ However, lines with no whitespace are wrapped without the benefit of a
+ line terminating character, and this distinction causes endless trouble
+ with all of the text display code which was originally written without
+ continuous wrap mode and always expects to wrap at a newline character.
**
-** Given the position of the end of the line, as returned by TextDEndOfLine
-** or BufEndOfLine, this returns true if there is a line terminating
-** character, and false if there's not. On the last character in the
-** buffer, this function can't tell for certain whether a trailing space was
-** used as a wrap point, and just guesses that it wasn't. So if an exact
-** accounting is necessary, don't use this function.
+ Given the position of the end of the line, as returned by TextDEndOfLine
+ or BufEndOfLine, this returns true if there is a line terminating
+ character, and false if there's not. On the last character in the
+ buffer, this function can't tell for certain whether a trailing space was
+ used as a wrap point, and just guesses that it wasn't. So if an exact
+ accounting is necessary, don't use this function.
*/
int Fl_Text_Display::wrap_uses_character(int lineEndPos) {
char c;
@@ -2864,9 +3007,9 @@ int Fl_Text_Display::wrap_uses_character(int lineEndPos) {
lineEndPos + 1 != buffer()->length());
}
-/*
-** Return true if the selection "sel" is rectangular, and touches a
-** buffer position withing "rangeStart" to "rangeEnd"
+/**
+ Return true if the selection "sel" is rectangular, and touches a
+ buffer position withing "rangeStart" to "rangeEnd"
*/
int Fl_Text_Display::range_touches_selection(Fl_Text_Selection *sel,
int rangeStart, int rangeEnd) {
@@ -2874,10 +3017,10 @@ int Fl_Text_Display::range_touches_selection(Fl_Text_Selection *sel,
sel->start() <= rangeEnd;
}
-/*
-** Extend the range of a redraw request (from *start to *end) with additional
-** redraw requests resulting from changes to the attached style buffer (which
-** contains auxiliary information for coloring or styling text).
+/**
+ Extend the range of a redraw request (from *start to *end) with additional
+ redraw requests resulting from changes to the attached style buffer (which
+ contains auxiliary information for coloring or styling text).
*/
void Fl_Text_Display::extend_range_for_styles( int *startpos, int *endpos ) {
Fl_Text_Selection * sel = mStyleBuffer->primary_selection();
@@ -3136,6 +3279,15 @@ int Fl_Text_Display::handle(int event) {
if (Fl::event_state()&FL_SHIFT) return handle(FL_DRAG);
dragging = 1;
int pos = xy_to_position(Fl::event_x(), Fl::event_y(), CURSOR_POS);
+ int ok = 0;
+ while (!ok) {
+ char c = buffer()->character( pos );
+ if (!((c & 0x80) && !(c & 0x40))) {
+ ok = 1;
+ } else {
+ pos++;
+ }
+ }
dragType = Fl::event_clicks();
dragPos = pos;
if (dragType == DRAG_CHAR)
@@ -3155,7 +3307,7 @@ int Fl_Text_Display::handle(int event) {
case FL_DRAG: {
if (dragType < 0) return 1;
- int X = Fl::event_x(), Y = Fl::event_y(), pos;
+ int X = Fl::event_x(), Y = Fl::event_y(), pos = 0;
// if we leave the text_area, we start a timer event
// that will take care of scrolling and selecting
if (Y < text_area.y) {
@@ -3192,8 +3344,17 @@ int Fl_Text_Display::handle(int event) {
scroll_direction = 0;
}
pos = xy_to_position(X, Y, CURSOR_POS);
- fl_text_drag_me(pos, this);
+ int ok = 0;
+ while (!ok) {
+ char c = buffer()->character( pos );
+ if (!((c & 0x80) && !(c & 0x40))) {
+ ok = 1;
+ } else {
+ pos++;
+ }
+ }
}
+ fl_text_drag_me(pos, this);
return 1;
}
@@ -3261,6 +3422,16 @@ int Fl_Text_Display::handle(int event) {
if (mHScrollBar->handle(event)) return 1;
break;
+
+ case FL_SHORTCUT:
+ if (!(shortcut() ? Fl::test_shortcut(shortcut()) : test_shortcut()))
+ return 0;
+ if (Fl::visible_focus() && handle(FL_FOCUS)) {
+ Fl::focus(this);
+ return 1;
+ }
+ break;
+
}
return 0;
@@ -3268,5 +3439,5 @@ int Fl_Text_Display::handle(int event) {
//
-// End of "$Id: Fl_Text_Display.cxx 6105 2008-04-21 21:03:22Z matt $".
+// End of "$Id: Fl_Text_Display.cxx 6765 2009-04-15 08:35:28Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Text_Editor.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Text_Editor.cxx
index b8cbfc678..5e5ea41af 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Text_Editor.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Text_Editor.cxx
@@ -1,7 +1,7 @@
//
-// "$Id: Fl_Text_Editor.cxx 5671 2007-02-08 07:58:47Z matt $"
+// "$Id: Fl_Text_Editor.cxx 6765 2009-04-15 08:35:28Z matt $"
//
-// Copyright 2001-2006 by Bill Spitzak and others.
+// Copyright 2001-2009 by Bill Spitzak and others.
// Original code Copyright Mark Edel. Permission to distribute under
// the LGPL for the FLTK library granted by Mark Edel.
//
@@ -35,6 +35,48 @@
#include
+/* Keyboard Control Matrix
+
+key\modifier plain Ctrl Alt Meta
+ left 1/1 13/9 0/13 0/9
+ right 2/2 14/10 0/14 0/10
+ up 3/19 21/7 0/15 0/17
+ down 4/20 22/8 0/16 0/18
+ home 9/5 17/0 0/0 0/0
+ end 10/6 18/0 0/0 0/0
+ page up 11/7 23/0 0/11 0/0
+ page down 12/8 24/0 0/12 0/0
+ (FLTK action / OS X action)
+ (adding the shift key extends the selection, all other combinations are no-op)
+
+ 0: no-op
+ 1: move cursor to the left, at line beginning wrap to end of prev line, at doc start no-op
+ 2: move cursor to the right, at line end move to beginning of the next line, at doc end no-op
+ 3: move cursor up, at doc top no-op
+ 4: move cursor down, at doc bottom no-op
+ 5: scroll display to top of text (cursor unchanged)
+ 6: scroll display to end of text (cursor unchanged)
+ 7: scroll text down one page (cursor unchanged)
+ 8: scroll text up one page (cursor unchanged)
+ 9: move cursor to beginning of line
+ 10: move cursor to end of line
+ 11: move cursor up one page and scroll down
+ 12: move cursor down one page and scroll up
+ 13: move to the beginning of the word or the previous word
+ 14: move to the end of the word or the next word
+ 15: if start of line: start of prev line, else start of this line
+ 16: if end of line: end of next line, else end of this line
+ 17: move cursor to the beginning of the document
+ 18: move cursor to the end of the document
+ 19: move cursor up, at doc top: home, at doc start: no-op)
+ 20: move cursor down, at doc bot: end, at doc end: no-op)
+ 21: scroll text down one line (cursor unchanged)
+ 22: scroll text up one line (cursor unchanged)
+ 23: move cursor to the beginning of the top of the screen
+ 24: move cursor to the beginning of the bottom of the window
+*/
+
+/** The constructor creates a new text editor widget.*/
Fl_Text_Editor::Fl_Text_Editor(int X, int Y, int W, int H, const char* l)
: Fl_Text_Display(X, Y, W, H, l) {
mCursorOn = 1;
@@ -48,7 +90,9 @@ Fl_Text_Editor::Fl_Text_Editor(int X, int Y, int W, int H, const char* l)
default_key_function(kf_default);
}
+#ifndef FL_DOXYGEN
Fl_Text_Editor::Key_Binding* Fl_Text_Editor::global_key_bindings = 0;
+#endif
// These are the default key bindings every widget should start with
static struct {
@@ -117,6 +161,7 @@ static struct {
{ 0, 0, 0 }
};
+/** Adds all of the default editor key bindings to the specified key binding list.*/
void Fl_Text_Editor::add_default_key_bindings(Key_Binding** list) {
for (int i = 0; default_key_bindings[i].key; i++) {
add_key_binding(default_key_bindings[i].key,
@@ -126,8 +171,8 @@ void Fl_Text_Editor::add_default_key_bindings(Key_Binding** list) {
}
}
-Fl_Text_Editor::Key_Func
-Fl_Text_Editor::bound_key_function(int key, int state, Key_Binding* list) {
+/** Returns the function associated with a key binding.*/
+Fl_Text_Editor::Key_Func Fl_Text_Editor::bound_key_function(int key, int state, Key_Binding* list) {
Key_Binding* cur;
for (cur = list; cur; cur = cur->next)
if (cur->key == key)
@@ -137,8 +182,8 @@ Fl_Text_Editor::bound_key_function(int key, int state, Key_Binding* list) {
return cur->function;
}
-void
-Fl_Text_Editor::remove_all_key_bindings(Key_Binding** list) {
+/** Removes all of the key bindings associated with the text editor or list.*/
+void Fl_Text_Editor::remove_all_key_bindings(Key_Binding** list) {
Key_Binding *cur, *next;
for (cur = *list; cur; cur = next) {
next = cur->next;
@@ -147,8 +192,8 @@ Fl_Text_Editor::remove_all_key_bindings(Key_Binding** list) {
*list = 0;
}
-void
-Fl_Text_Editor::remove_key_binding(int key, int state, Key_Binding** list) {
+/** Removes the key binding associated with the key "key" of state "state" */
+void Fl_Text_Editor::remove_key_binding(int key, int state, Key_Binding** list) {
Key_Binding *cur, *last = 0;
for (cur = *list; cur; last = cur, cur = cur->next)
if (cur->key == key && cur->state == state) break;
@@ -157,9 +202,8 @@ Fl_Text_Editor::remove_key_binding(int key, int state, Key_Binding** list) {
else *list = cur->next;
delete cur;
}
-
-void
-Fl_Text_Editor::add_key_binding(int key, int state, Key_Func function,
+/** Adds a key of state "state" with the function "function" */
+void Fl_Text_Editor::add_key_binding(int key, int state, Key_Func function,
Key_Binding** list) {
Key_Binding* kb = new Key_Binding;
kb->key = key;
@@ -180,6 +224,7 @@ static void kill_selection(Fl_Text_Editor* e) {
}
}
+/** Inserts the text associated with the key */
int Fl_Text_Editor::kf_default(int c, Fl_Text_Editor* e) {
if (!c || (!isprint(c) && c != '\t')) return 0;
char s[2] = "\0";
@@ -193,13 +238,20 @@ int Fl_Text_Editor::kf_default(int c, Fl_Text_Editor* e) {
return 1;
}
+/** Ignores the keypress */
int Fl_Text_Editor::kf_ignore(int, Fl_Text_Editor*) {
return 0; // don't handle
}
-
+/** Does a backspace in the current buffer.*/
int Fl_Text_Editor::kf_backspace(int, Fl_Text_Editor* e) {
- if (!e->buffer()->selected() && e->move_left())
- e->buffer()->select(e->insert_position(), e->insert_position()+1);
+ if (!e->buffer()->selected() && e->move_left()) {
+ int l = 1;
+ char c = e->buffer()->character(e->insert_position());
+ if (c & 0x80 && c & 0x40) {
+ l = fl_utf8len(c);
+ }
+ e->buffer()->select(e->insert_position(), e->insert_position()+l);
+ }
kill_selection(e);
e->show_insert_position();
e->set_changed();
@@ -207,6 +259,7 @@ int Fl_Text_Editor::kf_backspace(int, Fl_Text_Editor* e) {
return 1;
}
+/** Inserts a newline at the current cursor position */
int Fl_Text_Editor::kf_enter(int, Fl_Text_Editor* e) {
kill_selection(e);
e->insert("\n");
@@ -217,7 +270,7 @@ int Fl_Text_Editor::kf_enter(int, Fl_Text_Editor* e) {
}
extern void fl_text_drag_me(int pos, Fl_Text_Display* d);
-
+/** Moves the text cursor in the direction indicated by key c.*/
int Fl_Text_Editor::kf_move(int c, Fl_Text_Editor* e) {
int i;
int selected = e->buffer()->selected();
@@ -254,12 +307,13 @@ int Fl_Text_Editor::kf_move(int c, Fl_Text_Editor* e) {
return 1;
}
+/** Extends the current selection in the direction of key c.*/
int Fl_Text_Editor::kf_shift_move(int c, Fl_Text_Editor* e) {
kf_move(c, e);
fl_text_drag_me(e->insert_position(), e);
return 1;
}
-
+/** Moves the current text cursor in the direction indicated by control key */
int Fl_Text_Editor::kf_ctrl_move(int c, Fl_Text_Editor* e) {
if (!e->buffer()->selected())
e->dragPos = e->insert_position();
@@ -298,53 +352,68 @@ int Fl_Text_Editor::kf_ctrl_move(int c, Fl_Text_Editor* e) {
return 1;
}
+/** Extends the current selection in the direction indicated by control key c. */
int Fl_Text_Editor::kf_c_s_move(int c, Fl_Text_Editor* e) {
kf_ctrl_move(c, e);
fl_text_drag_me(e->insert_position(), e);
return 1;
}
+/** Moves the text cursor to the beginning of the current line.*/
int Fl_Text_Editor::kf_home(int, Fl_Text_Editor* e) {
return kf_move(FL_Home, e);
}
+/** Moves the text cursor to the end of the current line.*/
int Fl_Text_Editor::kf_end(int, Fl_Text_Editor* e) {
return kf_move(FL_End, e);
}
+/** Moves the text cursor one character to the left.*/
int Fl_Text_Editor::kf_left(int, Fl_Text_Editor* e) {
return kf_move(FL_Left, e);
}
+/** Moves the text cursor one line up.*/
int Fl_Text_Editor::kf_up(int, Fl_Text_Editor* e) {
return kf_move(FL_Up, e);
}
+/** Moves the text cursor one character to the right.*/
int Fl_Text_Editor::kf_right(int, Fl_Text_Editor* e) {
return kf_move(FL_Right, e);
}
-
+/** Moves the text cursor one line down.*/
int Fl_Text_Editor::kf_down(int, Fl_Text_Editor* e) {
return kf_move(FL_Down, e);
}
+/** Moves the text cursor up one page.*/
int Fl_Text_Editor::kf_page_up(int, Fl_Text_Editor* e) {
return kf_move(FL_Page_Up, e);
}
+/** Moves the text cursor down one page.*/
int Fl_Text_Editor::kf_page_down(int, Fl_Text_Editor* e) {
return kf_move(FL_Page_Down, e);
}
-
-
+/** Toggles the insert mode in the text editor.*/
int Fl_Text_Editor::kf_insert(int, Fl_Text_Editor* e) {
e->insert_mode(e->insert_mode() ? 0 : 1);
return 1;
}
+/** Does a delete of selected text or the current character in the current buffer.*/
int Fl_Text_Editor::kf_delete(int, Fl_Text_Editor* e) {
- if (!e->buffer()->selected())
- e->buffer()->select(e->insert_position(), e->insert_position()+1);
+ if (!e->buffer()->selected()) {
+ int l = 1;
+ char c = e->buffer()->character(e->insert_position());
+ if (c & 0x80 && c & 0x40) {
+ l = fl_utf8len(c);
+ }
+ e->buffer()->select(e->insert_position(), e->insert_position()+l);
+ }
+
kill_selection(e);
e->show_insert_position();
e->set_changed();
@@ -352,6 +421,7 @@ int Fl_Text_Editor::kf_delete(int, Fl_Text_Editor* e) {
return 1;
}
+/** Does a copy of selected text or the current character in the current buffer.*/
int Fl_Text_Editor::kf_copy(int, Fl_Text_Editor* e) {
if (!e->buffer()->selected()) return 1;
const char *copy = e->buffer()->selection_text();
@@ -361,6 +431,7 @@ int Fl_Text_Editor::kf_copy(int, Fl_Text_Editor* e) {
return 1;
}
+/** Does a cut of selected text in the current buffer.*/
int Fl_Text_Editor::kf_cut(int c, Fl_Text_Editor* e) {
kf_copy(c, e);
kill_selection(e);
@@ -369,6 +440,7 @@ int Fl_Text_Editor::kf_cut(int c, Fl_Text_Editor* e) {
return 1;
}
+/** Does a paste of selected text in the current buffer.*/
int Fl_Text_Editor::kf_paste(int, Fl_Text_Editor* e) {
kill_selection(e);
Fl::paste(*e, 1);
@@ -378,11 +450,12 @@ int Fl_Text_Editor::kf_paste(int, Fl_Text_Editor* e) {
return 1;
}
+/** Selects all text in the current buffer.*/
int Fl_Text_Editor::kf_select_all(int, Fl_Text_Editor* e) {
e->buffer()->select(0, e->buffer()->length());
return 1;
}
-
+/** Undo last edit in the current buffer. Also deselect previous selection. */
int Fl_Text_Editor::kf_undo(int , Fl_Text_Editor* e) {
e->buffer()->unselect();
int crsr;
@@ -394,12 +467,13 @@ int Fl_Text_Editor::kf_undo(int , Fl_Text_Editor* e) {
return ret;
}
+/** Handles a key press in the editor */
int Fl_Text_Editor::handle_key() {
// Call FLTK's rules to try to turn this into a printing character.
// This uses the right-hand ctrl key as a "compose prefix" and returns
// the changes that should be made to the text, as a number of
// bytes to delete and a string to insert:
- int del;
+ int del = 0;
if (Fl::compose(del)) {
if (del) buffer()->select(insert_position()-del, insert_position());
kill_selection(this);
@@ -423,6 +497,7 @@ int Fl_Text_Editor::handle_key() {
return 0;
}
+/** does or does not a callback according to changed() and when() settings */
void Fl_Text_Editor::maybe_do_callback() {
// printf("Fl_Text_Editor::maybe_do_callback()\n");
// printf("changed()=%d, when()=%x\n", changed(), when());
@@ -482,11 +557,20 @@ int Fl_Text_Editor::handle(int event) {
return 1;
}
break;
+
+ case FL_SHORTCUT:
+ if (!(shortcut() ? Fl::test_shortcut(shortcut()) : test_shortcut()))
+ return 0;
+ if (Fl::visible_focus() && handle(FL_FOCUS)) {
+ Fl::focus(this);
+ return 1;
+ }
+ break;
}
return Fl_Text_Display::handle(event);
}
//
-// End of "$Id: Fl_Text_Editor.cxx 5671 2007-02-08 07:58:47Z matt $".
+// End of "$Id: Fl_Text_Editor.cxx 6765 2009-04-15 08:35:28Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Tile.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Tile.cxx
index c1d0cf6a7..762ea7d37 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Tile.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Tile.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Tile.cxx 5606 2007-01-18 10:01:24Z matt $"
+// "$Id: Fl_Tile.cxx 6616 2009-01-01 21:28:26Z matt $"
//
// Tile widget for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,6 +25,7 @@
// http://www.fltk.org/str.php
//
+
// Group of 2 or 4 "tiles" that can be resized by dragging border
// The size of the first child determines where the resize border is.
// The resizebox is used to limit where the border can be dragged to.
@@ -36,10 +37,13 @@
// Drag the edges that were initially at oldx,oldy to newx,newy:
// pass zero as oldx or oldy to disable drag in that direction:
-
+/**
+ Drag the intersection at from_x,from_y to to_x,to_y.
+ This redraws all the necessary children.
+*/
void Fl_Tile::position(int oix, int oiy, int newx, int newy) {
Fl_Widget*const* a = array();
- short* p = sizes();
+ int *p = sizes();
p += 8; // skip group & resizable's saved size
for (int i=children(); i--; p += 4) {
Fl_Widget* o = *a++;
@@ -73,7 +77,7 @@ void Fl_Tile::resize(int X,int Y,int W,int H) {
int dy = Y-y();
int dw = W-w();
int dh = H-h();
- short* p = sizes();
+ int *p = sizes();
// resize this (skip the Fl_Group resize):
Fl_Widget::resize(X,Y,W,H);
// find bottom-right of resiable:
@@ -132,14 +136,17 @@ int Fl_Tile::handle(int event) {
case FL_MOVE:
case FL_ENTER:
- case FL_PUSH: {
+ case FL_PUSH:
+ // don't potentially change the mouse cursor if inactive:
+ if (!active()) break; // will cascade inherited handle()
+ {
int mindx = 100;
int mindy = 100;
int oldx = 0;
int oldy = 0;
Fl_Widget*const* a = array();
- short* q = sizes();
- short* p = q+8;
+ int *q = sizes();
+ int *p = q+8;
for (int i=children(); i--; p += 4) {
Fl_Widget* o = *a++;
if (o == resizable()) continue;
@@ -203,5 +210,5 @@ int Fl_Tile::handle(int event) {
}
//
-// End of "$Id: Fl_Tile.cxx 5606 2007-01-18 10:01:24Z matt $".
+// End of "$Id: Fl_Tile.cxx 6616 2009-01-01 21:28:26Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Tiled_Image.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Tiled_Image.cxx
index 222d9e627..3646d60d5 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Tiled_Image.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Tiled_Image.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Tiled_Image.cxx 5190 2006-06-09 16:16:34Z mike $"
+// "$Id: Fl_Tiled_Image.cxx 6616 2009-01-01 21:28:26Z matt $"
//
// Tiled image code for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,17 +25,15 @@
// http://www.fltk.org/str.php
//
+
#include
#include
#include
-
-//
-// 'Fl_Tiled_Image::Fl_Tiled_Image()' - Constructor.
-//
-// Use a width and height of 0 to tile the whole window/widget.
-//
-
+/**
+ The constructors create a new tiled image containing the specified image.
+ Use a width and height of 0 to tile the whole window/widget.
+*/
Fl_Tiled_Image::Fl_Tiled_Image(Fl_Image *i, // I - Image to tile
int W, // I - Width of tiled area
int H) : // I - Height of tiled area
@@ -46,13 +44,11 @@ Fl_Tiled_Image::Fl_Tiled_Image(Fl_Image *i, // I - Image to tile
if (W == 0) w(Fl::w());
if (H == 0) h(Fl::h());
}
-
-
-//
-// 'Fl_Tiled_Image::~Fl_Tiled_Image()' - Destructor.
-//
-
-Fl_Tiled_Image::~Fl_Tiled_Image() {
+/**
+ The destructor frees all memory and server resources that are used by
+ the tiled image.
+*/
+ Fl_Tiled_Image::~Fl_Tiled_Image() {
if (alloc_image_) delete image_;
}
@@ -115,7 +111,7 @@ Fl_Tiled_Image::draw(int X, // I - Starting X position
if (W == 0) W = Fl::w();
if (H == 0) H = Fl::h();
- fl_clip(X, Y, W, H);
+ fl_push_clip(X, Y, W, H);
X += cx;
Y += cy;
@@ -135,5 +131,5 @@ Fl_Tiled_Image::draw(int X, // I - Starting X position
//
-// End of "$Id: Fl_Tiled_Image.cxx 5190 2006-06-09 16:16:34Z mike $".
+// End of "$Id: Fl_Tiled_Image.cxx 6616 2009-01-01 21:28:26Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Tooltip.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Tooltip.cxx
index 37313771f..683c3e989 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Tooltip.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Tooltip.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Tooltip.cxx 5848 2007-05-20 16:18:31Z mike $"
+// "$Id: Fl_Tooltip.cxx 6712 2009-03-22 19:21:34Z AlbrechtS $"
//
// Tooltip source file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -38,21 +38,25 @@ unsigned Fl_Tooltip::color_ = fl_color_cube(FL_NUM_RED - 1,
FL_NUM_GREEN - 1,
FL_NUM_BLUE - 2);
unsigned Fl_Tooltip::textcolor_ = FL_BLACK;
-int Fl_Tooltip::font_ = FL_HELVETICA;
-int Fl_Tooltip::size_ = FL_NORMAL_SIZE;
+Fl_Font Fl_Tooltip::font_ = FL_HELVETICA;
+Fl_Fontsize Fl_Tooltip::size_ = FL_NORMAL_SIZE;
#define MAX_WIDTH 400
static const char* tip;
-
+/**
+ This widget creates a tooltip box window, with no caption.
+*/
class Fl_TooltipBox : public Fl_Menu_Window {
public:
+ /** Creates the box window */
Fl_TooltipBox() : Fl_Menu_Window(0, 0) {
set_override();
end();
}
void draw();
void layout();
+ /** Shows the tooltip windows only if a tooltip text is available. */
void show() {
if (tip) Fl_Menu_Window::show();
}
@@ -135,14 +139,16 @@ static void tooltip_timeout(void*) {
recursion = 0;
}
-// If this widget or one of it's parents has a tooltip, enter it. This
-// will do nothing if this is the current widget (even if the mouse moved
-// out so an exit() was done and then moved back in). If no tooltip can
-// be found do Fl_Tooltip::exit_(). If you don't want this behavior (for instance
-// if you want the tooltip to reappear when the mouse moves back in)
-// call the fancier enter_area() below.
-void
-Fl_Tooltip::enter_(Fl_Widget* w) {
+/**
+ This method is called when the mouse pointer enters a widget.
+ If this widget or one of it's parents has a tooltip, enter it. This
+ will do nothing if this is the current widget (even if the mouse moved
+ out so an exit() was done and then moved back in). If no tooltip can
+ be found do Fl_Tooltip::exit_(). If you don't want this behavior (for instance
+ if you want the tooltip to reappear when the mouse moves back in)
+ call the fancier enter_area() below.
+*/
+void Fl_Tooltip::enter_(Fl_Widget* w) {
#ifdef DEBUG
printf("Fl_Tooltip::enter_(w=%p)\n", w);
printf(" window=%p\n", window);
@@ -158,11 +164,13 @@ Fl_Tooltip::enter_(Fl_Widget* w) {
}
enter_area(w, 0, 0, w->w(), w->h(), tw->tooltip());
}
-
-// Acts as though enter(widget) was done but does not pop up a
-// tooltip. This is useful to prevent a tooltip from reappearing when
-// a modal overlapping window is deleted. FLTK does this automatically
-// when you click the mouse button.
+/**
+ Sets the current widget target.
+ Acts as though enter(widget) was done but does not pop up a
+ tooltip. This is useful to prevent a tooltip from reappearing when
+ a modal overlapping window is deleted. FLTK does this automatically
+ when you click the mouse button.
+*/
void Fl_Tooltip::current(Fl_Widget* w) {
#ifdef DEBUG
printf("Fl_Tooltip::current(w=%p)\n", w);
@@ -181,14 +189,14 @@ void Fl_Tooltip::current(Fl_Widget* w) {
}
// Hide any visible tooltip.
-void
-Fl_Tooltip::exit_(Fl_Widget *w) {
+/** This method is called when the mouse pointer leaves a widget. */
+void Fl_Tooltip::exit_(Fl_Widget *w) {
#ifdef DEBUG
printf("Fl_Tooltip::exit_(w=%p)\n", w);
printf(" widget=%p, window=%p\n", widget_, window);
#endif // DEBUG
- if (!widget_ || w == window) return;
+ if (!widget_ || (w && w == window)) return;
widget_ = 0;
Fl::remove_timeout(tooltip_timeout);
Fl::remove_timeout(recent_timeout);
@@ -201,10 +209,20 @@ Fl_Tooltip::exit_(Fl_Widget *w) {
// Get ready to display a tooltip. The widget and the xywh box inside
// it define an area the tooltip is for, this along with the current
-// mouse position places the tooltip (the mouse is assummed to point
+// mouse position places the tooltip (the mouse is assumed to point
// inside or near the box).
-void
-Fl_Tooltip::enter_area(Fl_Widget* wid, int x,int y,int w,int h, const char* t)
+/**
+ You may be able to use this to provide tooltips for internal pieces
+ of your widget. Call this after setting Fl::belowmouse() to
+ your widget (because that calls the above enter() method). Then figure
+ out what thing the mouse is pointing at, and call this with the widget
+ (this pointer is used to remove the tooltip if the widget is deleted
+ or hidden, and to locate the tooltip), the rectangle surrounding the
+ area, relative to the top-left corner of the widget (used to calculate
+ where to put the tooltip), and the text of the tooltip (which must be
+ a pointer to static data as it is not copied).
+*/
+void Fl_Tooltip::enter_area(Fl_Widget* wid, int x,int y,int w,int h, const char* t)
{
(void)x;
(void)w;
@@ -259,5 +277,5 @@ void Fl_Widget::tooltip(const char *tt) {
}
//
-// End of "$Id: Fl_Tooltip.cxx 5848 2007-05-20 16:18:31Z mike $".
+// End of "$Id: Fl_Tooltip.cxx 6712 2009-03-22 19:21:34Z AlbrechtS $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Valuator.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Valuator.cxx
index 1d6a32dd2..d636d5e58 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Valuator.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Valuator.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Valuator.cxx 5190 2006-06-09 16:16:34Z mike $"
+// "$Id: Fl_Valuator.cxx 6616 2009-01-01 21:28:26Z matt $"
//
// Valuator widget for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,6 +25,7 @@
// http://www.fltk.org/str.php
//
+
// Base class for sliders and all other one-value "knobs"
#include
@@ -34,7 +35,11 @@
#include "flstring.h"
Fl_Valuator::Fl_Valuator(int X, int Y, int W, int H, const char* L)
- : Fl_Widget(X,Y,W,H,L) {
+/**
+ Creates a new Fl_Valuator widget using the given position,
+ size, and label string. The default boxtype is FL_NO_BOX.
+*/
+: Fl_Widget(X,Y,W,H,L) {
align(FL_ALIGN_BOTTOM);
when(FL_WHEN_CHANGED);
value_ = 0;
@@ -47,6 +52,7 @@ Fl_Valuator::Fl_Valuator(int X, int Y, int W, int H, const char* L)
const double epsilon = 4.66e-10;
+/** See double Fl_Valuator::step() const */
void Fl_Valuator::step(double s) {
if (s < 0) s = -s;
A = rint(s);
@@ -54,13 +60,24 @@ void Fl_Valuator::step(double s) {
while (fabs(s-A/B) > epsilon && B<=(0x7fffffff/10)) {B *= 10; A = rint(s*B);}
}
+/** Sets the step value to 1/10digits.*/
void Fl_Valuator::precision(int p) {
A = 1.0;
for (B = 1; p--;) B *= 10;
}
-
+/** Asks for partial redraw */
void Fl_Valuator::value_damage() {damage(FL_DAMAGE_EXPOSE);} // by default do partial-redraw
+/**
+ Sets the current value. The new value is not
+ clamped or otherwise changed before storing it. Use
+ clamp() or round() to modify the value before
+ calling value(). The widget is redrawn if the new value
+ is different than the current one. The initial value is zero.
+ changed() will return true if the user has moved the slider,
+ but it will be turned off by value(x) and just before doing a callback
+ (the callback can turn it back on if desired).
+*/
int Fl_Valuator::value(double v) {
clear_changed();
if (v == value_) return 0;
@@ -68,7 +85,7 @@ int Fl_Valuator::value(double v) {
value_damage();
return 1;
}
-
+/** Clamps the value, but accepts v if the previous value is not already out of range */
double Fl_Valuator::softclamp(double v) {
int which = (min<=max);
double p = previous_value_;
@@ -78,7 +95,7 @@ double Fl_Valuator::softclamp(double v) {
}
// inline void Fl_Valuator::handle_push() {previous_value_ = value_;}
-
+/** Called during a drag operation, after an FL_WHEN_CHANGED event is received and before the callback. */
void Fl_Valuator::handle_drag(double v) {
if (v != value_) {
value_ = v;
@@ -87,7 +104,7 @@ void Fl_Valuator::handle_drag(double v) {
if (when() & FL_WHEN_CHANGED) do_callback();
}
}
-
+/** Called after an FL_WHEN_RELEASE event is received and before the callback. */
void Fl_Valuator::handle_release() {
if (when()&FL_WHEN_RELEASE) {
// insure changed() is off even if no callback is done. It may have
@@ -101,23 +118,53 @@ void Fl_Valuator::handle_release() {
}
}
+/**
+ Round the passed value to the nearest step increment. Does
+ nothing if step is zero.
+*/
double Fl_Valuator::round(double v) {
if (A) return rint(v*B/A)*A/B;
else return v;
}
+/** Clamps the passed value to the valuator range.*/
double Fl_Valuator::clamp(double v) {
if ((vmax)==(min<=max)) return max;
else return v;
}
+/**
+ Adds n times the step value to the passed value. If
+ step was set to zero it uses fabs(maximum() - minimum()) /
+ 100.
+*/
double Fl_Valuator::increment(double v, int n) {
if (!A) return v+n*(max-min)/100;
if (min > max) n = -n;
return (rint(v*B/A)+n)*A/B;
}
+/**
+ Uses internal rules to format the fields numerical value into
+ the character array pointed to by the passed parameter.
+
+ The actual format used depends on the current step value. If
+ the step value has been set to zero then a %g format is used.
+ If the step value is non-zero, then a %.*f format is used,
+ where the precision is calculated to show sufficient digits
+ for the current step value. An integer step value, such as 1
+ or 1.0, gives a precision of 0, so the formatted value will
+ appear as an integer.
+
+ This method is used by the Fl_Value_... group of widgets to
+ format the current value into a text string.
+ The return value is the length of the formatted text.
+ The formatted value is written into in buffer.
+ buffer should have space for at least 128 bytes.
+
+ You may override this function to create your own text formatting.
+*/
int Fl_Valuator::format(char* buffer) {
double v = value();
// MRS: THIS IS A HACK - RECOMMEND ADDING BUFFER SIZE ARGUMENT
@@ -145,5 +192,5 @@ int Fl_Valuator::format(char* buffer) {
}
//
-// End of "$Id: Fl_Valuator.cxx 5190 2006-06-09 16:16:34Z mike $".
+// End of "$Id: Fl_Valuator.cxx 6616 2009-01-01 21:28:26Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Value_Input.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Value_Input.cxx
index d9d19c416..b8faa69db 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Value_Input.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Value_Input.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Value_Input.cxx 5190 2006-06-09 16:16:34Z mike $"
+// "$Id: Fl_Value_Input.cxx 6664 2009-02-18 09:27:54Z AlbrechtS $"
//
// Value input widget for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -52,7 +52,7 @@ void Fl_Value_Input::draw() {
if (damage()&~FL_DAMAGE_CHILD) input.clear_damage(FL_DAMAGE_ALL);
input.box(box());
input.color(color(), selection_color());
- input.draw();
+ Fl_Widget *i = &input; i->draw(); // calls protected input.draw()
input.clear_damage();
}
@@ -106,6 +106,8 @@ int Fl_Value_Input::handle(int event) {
return 1;
case FL_FOCUS:
return input.take_focus();
+ case FL_SHORTCUT:
+ return input.handle(event);
default:
DEFAULT:
input.type(((step() - floor(step()))>0.0 || step() == 0.0) ? FL_FLOAT_INPUT : FL_INT_INPUT);
@@ -113,6 +115,11 @@ int Fl_Value_Input::handle(int event) {
}
}
+/**
+ Creates a new Fl_Value_Input widget using the given
+ position, size, and label string. The default boxtype is
+ FL_DOWN_BOX.
+*/
Fl_Value_Input::Fl_Value_Input(int X, int Y, int W, int H, const char* l)
: Fl_Valuator(X, Y, W, H, l), input(X, Y, W, H, 0) {
soft_ = 0;
@@ -126,8 +133,15 @@ Fl_Value_Input::Fl_Value_Input(int X, int Y, int W, int H, const char* l)
selection_color(input.selection_color());
align(FL_ALIGN_LEFT);
value_damage();
+ set_flag(SHORTCUT_LABEL);
+}
+
+Fl_Value_Input::~Fl_Value_Input() {
+
+ if (input.parent() == (Fl_Group *)this)
+ input.parent(0); // *revert* ctor kludge!
}
//
-// End of "$Id: Fl_Value_Input.cxx 5190 2006-06-09 16:16:34Z mike $".
+// End of "$Id: Fl_Value_Input.cxx 6664 2009-02-18 09:27:54Z AlbrechtS $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Value_Output.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Value_Output.cxx
index 8a1f13c8d..fb9f1ab9b 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Value_Output.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Value_Output.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Value_Output.cxx 5190 2006-06-09 16:16:34Z mike $"
+// "$Id: Fl_Value_Output.cxx 6616 2009-01-01 21:28:26Z matt $"
//
// Value output widget for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -88,16 +88,21 @@ int Fl_Value_Output::handle(int event) {
}
}
+/**
+ Creates a new Fl_Value_Output widget using the given
+ position, size, and label string. The default boxtype is FL_NO_BOX.
+
Inherited destructor destroys the Valuator.
+*/
Fl_Value_Output::Fl_Value_Output(int X, int Y, int W, int H,const char *l)
: Fl_Valuator(X,Y,W,H,l) {
box(FL_NO_BOX);
align(FL_ALIGN_LEFT);
textfont_ = FL_HELVETICA;
- textsize_ = (uchar)FL_NORMAL_SIZE;
+ textsize_ = FL_NORMAL_SIZE;
textcolor_ = FL_FOREGROUND_COLOR;
soft_ = 0;
}
//
-// End of "$Id: Fl_Value_Output.cxx 5190 2006-06-09 16:16:34Z mike $".
+// End of "$Id: Fl_Value_Output.cxx 6616 2009-01-01 21:28:26Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Value_Slider.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Value_Slider.cxx
index b8203267a..e5d0e4388 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Value_Slider.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Value_Slider.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Value_Slider.cxx 5190 2006-06-09 16:16:34Z mike $"
+// "$Id: Fl_Value_Slider.cxx 6616 2009-01-01 21:28:26Z matt $"
//
// Value slider widget for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -30,6 +30,10 @@
#include
#include
+/**
+ Creates a new Fl_Value_Slider widget using the given
+ position, size, and label string. The default boxtype is FL_DOWN_BOX.
+*/
Fl_Value_Slider::Fl_Value_Slider(int X, int Y, int W, int H, const char*l)
: Fl_Slider(X,Y,W,H,l) {
step(1,100);
@@ -78,5 +82,5 @@ int Fl_Value_Slider::handle(int event) {
}
//
-// End of "$Id: Fl_Value_Slider.cxx 5190 2006-06-09 16:16:34Z mike $".
+// End of "$Id: Fl_Value_Slider.cxx 6616 2009-01-01 21:28:26Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Widget.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Widget.cxx
index b20d8df6b..97a4f5413 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Widget.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Widget.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Widget.cxx 5190 2006-06-09 16:16:34Z mike $"
+// "$Id: Fl_Widget.cxx 6716 2009-03-24 01:40:44Z fabien $"
//
// Base widget class for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -35,9 +35,9 @@
////////////////////////////////////////////////////////////////
-// for compatability with Forms, all widgets without callbacks are
+// for compatibility with Forms, all widgets without callbacks are
// inserted into a "queue" when they are activated, and the forms
-// compatability interaction functions (fl_do_events, etc) will
+// compatibility interaction functions (fl_do_events, etc.) will
// read one widget at a time from this queue and return it:
const int QUEUE_SIZE = 20;
@@ -47,7 +47,7 @@ static int obj_head, obj_tail;
void Fl_Widget::default_callback(Fl_Widget *o, void * /*v*/) {
#if 0
- // This is necessary for strict forms compatability but is confusing.
+ // This is necessary for strict forms compatibility but is confusing.
// Use the parent's callback if this widget does not have one.
for (Fl_Widget *p = o->parent(); p; p = p->parent())
if (p->callback() != default_callback) {
@@ -62,7 +62,11 @@ void Fl_Widget::default_callback(Fl_Widget *o, void * /*v*/) {
if (obj_tail >= QUEUE_SIZE) obj_tail = 0;
}
}
-
+/**
+ All Fl_Widgets that don't have a callback defined use a
+ default callback that puts a pointer to the widget in this queue,
+ and this method reads the oldest widget out of this queue.
+*/
Fl_Widget *Fl::readqueue() {
if (obj_tail==obj_head) return 0;
Fl_Widget *o = obj_queue[obj_tail++];
@@ -76,7 +80,8 @@ int Fl_Widget::handle(int) {
return 0;
}
-int FL_NORMAL_SIZE = 14;
+/** Default font size for widgets */
+Fl_Fontsize FL_NORMAL_SIZE = 14;
Fl_Widget::Fl_Widget(int X, int Y, int W, int H, const char* L) {
@@ -87,7 +92,7 @@ Fl_Widget::Fl_Widget(int X, int Y, int W, int H, const char* L) {
label_.deimage = 0;
label_.type = FL_NORMAL_LABEL;
label_.font = FL_HELVETICA;
- label_.size = (uchar)FL_NORMAL_SIZE;
+ label_.size = FL_NORMAL_SIZE;
label_.color = FL_FOREGROUND_COLOR;
tooltip_ = 0;
callback_ = default_callback;
@@ -128,18 +133,26 @@ int Fl_Widget::take_focus() {
extern void fl_throw_focus(Fl_Widget*); // in Fl_x.cxx
-// Destruction does not remove from any parent group! And groups when
-// destroyed destroy all their children. This is convienent and fast.
-// However, it is only legal to destroy a "root" such as an Fl_Window,
-// and automatic destructors may be called.
+/**
+ Destroys the widget, taking care of throwing focus before if any.
+ Destruction removes the widget from any parent group! And groups when
+ destroyed destroy all their children. This is convenient and fast.
+*/
Fl_Widget::~Fl_Widget() {
Fl::clear_widget_pointer(this);
if (flags() & COPIED_LABEL) free((void *)(label_.value));
+ // remove from parent group
+ if (parent_) parent_->remove(this);
+#ifdef DEBUG_DELETE
+ if (parent_) { // this should never happen
+ printf("*** Fl_Widget: parent_->remove(this) failed [%p,%p]\n",parent_,this);
+ }
+#endif // DEBUG_DELETE
parent_ = 0; // Don't throw focus to a parent widget.
fl_throw_focus(this);
}
-// draw a focus box for the widget...
+/** Draws a focus box for the widget at the given position and size */
void
Fl_Widget::draw_focus(Fl_Boxtype B, int X, int Y, int W, int H) const {
if (!Fl::visible_focus()) return;
@@ -156,7 +169,12 @@ Fl_Widget::draw_focus(Fl_Boxtype B, int X, int Y, int W, int H) const {
fl_color(fl_contrast(FL_BLACK, color()));
-#if defined(WIN32) || defined(__APPLE_QD__)
+#if defined(USE_X11) || defined(__APPLE_QUARTZ__)
+ fl_line_style(FL_DOT);
+ fl_rect(X + Fl::box_dx(B), Y + Fl::box_dy(B),
+ W - Fl::box_dw(B) - 1, H - Fl::box_dh(B) - 1);
+ fl_line_style(FL_SOLID);
+#elif defined(WIN32)
// Windows 95/98/ME do not implement the dotted line style, so draw
// every other pixel around the focus area...
//
@@ -175,10 +193,7 @@ Fl_Widget::draw_focus(Fl_Boxtype B, int X, int Y, int W, int H) const {
for (xx = W; xx > 0; xx --, i ++) if (i & 1) fl_point(X + xx, Y + H);
for (yy = H; yy > 0; yy --, i ++) if (i & 1) fl_point(X, Y + yy);
#else
- fl_line_style(FL_DOT);
- fl_rect(X + Fl::box_dx(B), Y + Fl::box_dy(B),
- W - Fl::box_dw(B) - 1, H - Fl::box_dh(B) - 1);
- fl_line_style(FL_SOLID);
+# error unsupported platform
#endif // WIN32
}
@@ -278,7 +293,23 @@ Fl_Widget::copy_label(const char *a) {
redraw_label();
}
+/** Calls the widget callback.
+
+ Causes a widget to invoke its callback function with arbitrary arguments.
+
+ \param[in] o call the callback with \p o as the widget argument
+ \param[in] arg use \p arg as the user data argument
+ \see callback()
+*/
+void
+Fl_Widget::do_callback(Fl_Widget* o,void* arg) {
+ Fl_Widget_Tracker wp(o);
+ callback_(o,arg);
+ if (wp.deleted()) return;
+ if (callback_ != default_callback)
+ clear_changed();
+}
//
-// End of "$Id: Fl_Widget.cxx 5190 2006-06-09 16:16:34Z mike $".
+// End of "$Id: Fl_Widget.cxx 6716 2009-03-24 01:40:44Z fabien $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Window.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Window.cxx
index 43c9f7fb3..c0fa1a945 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Window.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Window.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Window.cxx 5251 2006-06-28 10:23:33Z matt $"
+// "$Id: Fl_Window.cxx 6669 2009-02-25 08:44:54Z AlbrechtS $"
//
// Window widget class for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -29,7 +29,7 @@
// This is the system-independent portions. The huge amount of
// crap you need to do to communicate with X is in Fl_x.cxx, the
// equivalent (but totally different) crap for MSWindows is in Fl_win32.cxx
-
+#include "config.h"
#include
#include
#include
@@ -85,13 +85,13 @@ Fl_Window *Fl_Widget::window() const {
if (o->type() >= FL_WINDOW) return (Fl_Window*)o;
return 0;
}
-
+/** Gets the x position of the window on the screen */
int Fl_Window::x_root() const {
Fl_Window *p = window();
if (p) return p->x_root() + x();
return x();
}
-
+/** Gets the y position of the window on the screen */
int Fl_Window::y_root() const {
Fl_Window *p = window();
if (p) return p->y_root() + y();
@@ -99,14 +99,16 @@ int Fl_Window::y_root() const {
}
void Fl_Window::draw() {
- const char *savelabel = label();
- int saveflags = flags();
- int savex = x(); x(0);
- int savey = y(); y(0);
- // Make sure we don't draw the window title in the window background...
- clear_flag(COPIED_LABEL); // do not free copied labels!
- Fl_Widget::label(0);
- Fl_Group::draw();
+
+ // The following is similar to Fl_Group::draw(), but ...
+ // - we draw the box with x=0 and y=0 instead of x() and y()
+ // - we don't draw a label
+
+ if (damage() & ~FL_DAMAGE_CHILD) { // draw the entire thing
+ draw_box(box(),0,0,w(),h(),color()); // draw box with x/y = 0
+ }
+ draw_children();
+
#ifdef __APPLE_QUARTZ__
if (!parent() && resizable() && (!size_range_set || minh!=maxh || minw!=maxw)) {
int dx = Fl::box_dw(box())-Fl::box_dx(box());
@@ -127,11 +129,10 @@ void Fl_Window::draw() {
}
}
#endif
- // Restore the label...
- Fl_Widget::label(savelabel);
- set_flag(saveflags);
- y(savey);
- x(savex);
+
+# if defined(USE_CAIRO)
+ Fl::cairo_make_current(this); // checkout if an update is necessary
+# endif
}
void Fl_Window::label(const char *name) {
@@ -150,30 +151,33 @@ void Fl_Window::copy_label(const char *a) {
void Fl_Window::iconlabel(const char *iname) {
+ // FIXME: 'flags' is 32 bit large!
uchar saveflags = flags();
label(label(), iname);
set_flag(saveflags);
}
-// the Fl::atclose pointer is provided for back compatability. You
+// the Fl::atclose pointer is provided for back compatibility. You
// can now just change the callback for the window instead.
+/** Default callback for window widgets. It hides the window and then calls the default widget callback. */
void Fl::default_atclose(Fl_Window* window, void* v) {
window->hide();
Fl_Widget::default_callback(window, v); // put on Fl::read_queue()
}
-
+/** Back compatibility: default window callback handler \see Fl::set_atclose() */
void (*Fl::atclose)(Fl_Window*, void*) = default_atclose;
-
+/** Back compatibility: Sets the default callback v for win to call on close event */
void Fl_Window::default_callback(Fl_Window* win, void* v) {
Fl::atclose(win, v);
}
+/** Returns the last window that was made current. \see Fl_Window::make_current() */
Fl_Window *Fl_Window::current() {
return current_;
}
//
-// End of "$Id: Fl_Window.cxx 5251 2006-06-28 10:23:33Z matt $".
+// End of "$Id: Fl_Window.cxx 6669 2009-02-25 08:44:54Z AlbrechtS $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Window_fullscreen.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Window_fullscreen.cxx
index cc30ad1a4..67f9877c8 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Window_fullscreen.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Window_fullscreen.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Window_fullscreen.cxx 5190 2006-06-09 16:16:34Z mike $"
+// "$Id: Fl_Window_fullscreen.cxx 6660 2009-02-15 18:58:03Z AlbrechtS $"
//
// Fullscreen window support for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -30,7 +30,7 @@
// manager. Fullscreen still works on some window managers (fvwm is one)
// because they allow the border to be placed off-screen.
-// Unfortunatly most X window managers ignore changes to the border
+// Unfortunately most X window managers ignore changes to the border
// and refuse to position the border off-screen, so attempting to make
// the window full screen will lose the size of the border off the
// bottom and right.
@@ -38,9 +38,7 @@
#include
#include
-#ifdef __APPLE__
#include
-#endif
void Fl_Window::border(int b) {
if (b) {
@@ -50,15 +48,15 @@ void Fl_Window::border(int b) {
if (!border()) return;
set_flag(FL_NOBORDER);
}
-#ifdef WIN32
+#if defined(USE_X11)
+ if (shown()) Fl_X::i(this)->sendxjunk();
+#elif defined(WIN32)
// not yet implemented, but it's possible
// for full fullscreen we have to make the window topmost as well
-#elif defined(__APPLE_QD__)
- // warning: not implemented in Quickdraw/Carbon
#elif defined(__APPLE_QUARTZ__)
// warning: not implemented in Quartz/Carbon
#else
- if (shown()) Fl_X::i(this)->sendxjunk();
+# error unsupported platform
#endif
}
@@ -93,5 +91,5 @@ void Fl_Window::fullscreen_off(int X,int Y,int W,int H) {
}
//
-// End of "$Id: Fl_Window_fullscreen.cxx 5190 2006-06-09 16:16:34Z mike $".
+// End of "$Id: Fl_Window_fullscreen.cxx 6660 2009-02-15 18:58:03Z AlbrechtS $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Window_hotspot.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Window_hotspot.cxx
index a551ce8ee..120a79854 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Window_hotspot.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Window_hotspot.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Window_hotspot.cxx 5697 2007-02-13 14:38:43Z matt $"
+// "$Id: Fl_Window_hotspot.cxx 6616 2009-01-01 21:28:26Z matt $"
//
// Common hotspot routines for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -96,5 +96,5 @@ void Fl_Window::hotspot(const Fl_Widget *o, int offscreen) {
//
-// End of "$Id: Fl_Window_hotspot.cxx 5697 2007-02-13 14:38:43Z matt $".
+// End of "$Id: Fl_Window_hotspot.cxx 6616 2009-01-01 21:28:26Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Window_iconize.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Window_iconize.cxx
index 5ad32f174..112f5512a 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Window_iconize.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Window_iconize.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Window_iconize.cxx 5190 2006-06-09 16:16:34Z mike $"
+// "$Id: Fl_Window_iconize.cxx 6616 2009-01-01 21:28:26Z matt $"
//
// Window minification code for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -45,5 +45,5 @@ void Fl_Window::iconize() {
}
//
-// End of "$Id: Fl_Window_iconize.cxx 5190 2006-06-09 16:16:34Z mike $".
+// End of "$Id: Fl_Window_iconize.cxx 6616 2009-01-01 21:28:26Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Wizard.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Wizard.cxx
index 1a22d3175..1a0f001e8 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Wizard.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Wizard.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Wizard.cxx 5190 2006-06-09 16:16:34Z mike $"
+// "$Id: Fl_Wizard.cxx 6616 2009-01-01 21:28:26Z matt $"
//
// Fl_Wizard widget routines.
//
-// Copyright 1997-2005 by Easy Software Products.
+// Copyright 1997-2009 by Easy Software Products.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,6 +25,7 @@
// http://www.fltk.org/str.php
//
// Contents:
+
//
// Fl_Wizard::Fl_Wizard() - Create an Fl_Wizard widget.
// Fl_Wizard::draw() - Draw the wizard border and visible child.
@@ -47,6 +48,11 @@
// 'Fl_Wizard::Fl_Wizard()' - Create an Fl_Wizard widget.
//
+/**
+ The constructor creates the Fl_Wizard widget at the specified
+ position and size.
+ The inherited destructor destroys the widget and its children.
+*/
Fl_Wizard::Fl_Wizard(int xx, // I - Lefthand position
int yy, // I - Upper position
int ww, // I - Width
@@ -61,12 +67,8 @@ Fl_Wizard::Fl_Wizard(int xx, // I - Lefthand position
//
-// 'Fl_Wizard::draw()' - Draw the wizard border and visible child.
-//
-
-void
-Fl_Wizard::draw()
-{
+/** Draws the wizard border and visible child. */
+void Fl_Wizard::draw() {
Fl_Widget *kid; // Visible child
@@ -89,13 +91,11 @@ Fl_Wizard::draw()
}
-//
-// 'Fl_Wizard::next()' - Show the next child.
-//
-
-void
-Fl_Wizard::next()
-{
+/**
+ This method shows the next child of the wizard. If the last child
+ is already visible, this function does nothing.
+*/
+void Fl_Wizard::next() {
int num_kids;
Fl_Widget * const *kids;
@@ -111,14 +111,8 @@ Fl_Wizard::next()
value(kids[1]);
}
-
-//
-// 'Fl_Wizard::prev()' - Show the previous child.
-//
-
-
-void
-Fl_Wizard::prev()
+/** Shows the previous child.*/
+void Fl_Wizard::prev()
{
int num_kids;
Fl_Widget * const *kids;
@@ -135,13 +129,8 @@ Fl_Wizard::prev()
value(kids[-1]);
}
-
-//
-// 'Fl_Wizard::value()' - Return the current visible child.
-//
-
-Fl_Widget *
-Fl_Wizard::value()
+/** Gets the current visible child widget. */
+Fl_Widget* Fl_Wizard::value()
{
int num_kids;
Fl_Widget * const *kids;
@@ -172,13 +161,8 @@ Fl_Wizard::value()
return (kid);
}
-
-//
-// 'Fl_Wizard::value()' - Set the visible child.
-//
-
-void
-Fl_Wizard::value(Fl_Widget *kid)
+/** Sets the child widget that is visible.*/
+void Fl_Wizard::value(Fl_Widget *kid)
{
int num_kids;
Fl_Widget * const *kids;
@@ -205,6 +189,7 @@ Fl_Wizard::value(Fl_Widget *kid)
}
+
//
-// End of "$Id: Fl_Wizard.cxx 5190 2006-06-09 16:16:34Z mike $".
+// End of "$Id: Fl_Wizard.cxx 6616 2009-01-01 21:28:26Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_XBM_Image.cxx b/plugins/zynaddsubfx/fltk/src/Fl_XBM_Image.cxx
index ce66683a6..7503806da 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_XBM_Image.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_XBM_Image.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_XBM_Image.cxx 5190 2006-06-09 16:16:34Z mike $"
+// "$Id: Fl_XBM_Image.cxx 6616 2009-01-01 21:28:26Z matt $"
//
// Fl_XBM_Image routines.
//
-// Copyright 1997-2005 by Bill Spitzak and others.
+// Copyright 1997-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -37,17 +37,23 @@
#include
#include
#include
+#include
#include "flstring.h"
//
// 'Fl_XBM_Image::Fl_XBM_Image()' - Load an XBM file.
//
+/**
+ The constructor loads the named XBM file from the given name filename.
+ The destructor free all memory and server resources that are used by
+ the image.
+*/
Fl_XBM_Image::Fl_XBM_Image(const char *name) : Fl_Bitmap((const char *)0,0,0) {
FILE *f;
uchar *ptr;
- if ((f = fopen(name, "rb")) == NULL) return;
+ if ((f = fl_fopen(name, "rb")) == NULL) return;
char buffer[1024];
char junk[1024];
@@ -102,5 +108,5 @@ Fl_XBM_Image::Fl_XBM_Image(const char *name) : Fl_Bitmap((const char *)0,0,0) {
//
-// End of "$Id: Fl_XBM_Image.cxx 5190 2006-06-09 16:16:34Z mike $".
+// End of "$Id: Fl_XBM_Image.cxx 6616 2009-01-01 21:28:26Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_XColor.H b/plugins/zynaddsubfx/fltk/src/Fl_XColor.H
index c0f893cd9..16cb36671 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_XColor.H
+++ b/plugins/zynaddsubfx/fltk/src/Fl_XColor.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_XColor.H 4288 2005-04-16 00:13:17Z mike $"
+// "$Id: Fl_XColor.H 6616 2009-01-01 21:28:26Z matt $"
//
// X-specific color definitions for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2001 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -42,5 +42,5 @@ extern unsigned char fl_redmask, fl_greenmask, fl_bluemask;
extern int fl_redshift, fl_greenshift, fl_blueshift, fl_extrashift;
//
-// End of "$Id: Fl_XColor.H 4288 2005-04-16 00:13:17Z mike $".
+// End of "$Id: Fl_XColor.H 6616 2009-01-01 21:28:26Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_XPM_Image.cxx b/plugins/zynaddsubfx/fltk/src/Fl_XPM_Image.cxx
index b50535f57..2d7326aa2 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_XPM_Image.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_XPM_Image.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_XPM_Image.cxx 5190 2006-06-09 16:16:34Z mike $"
+// "$Id: Fl_XPM_Image.cxx 6616 2009-01-01 21:28:26Z matt $"
//
// Fl_XPM_Image routines.
//
-// Copyright 1997-2005 by Bill Spitzak and others.
+// Copyright 1997-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -36,6 +36,7 @@
#include
#include
#include
+#include
#include "flstring.h"
@@ -52,11 +53,15 @@ static int hexdigit(int x) { // I - Hex digit...
#define MAXSIZE 2048
#define INITIALLINES 256
-
+/**
+ The constructor loads the XPM image from the name filename.
+ The destructor free all memory and server resources that are used by
+ the image.
+*/
Fl_XPM_Image::Fl_XPM_Image(const char *name) : Fl_Pixmap((char *const*)0) {
FILE *f;
- if ((f = fopen(name, "rb")) == NULL) return;
+ if ((f = fl_fopen(name, "rb")) == NULL) return;
// read all the c-strings out of the file:
char** new_data = new char *[INITIALLINES];
@@ -127,5 +132,5 @@ Fl_XPM_Image::Fl_XPM_Image(const char *name) : Fl_Pixmap((char *const*)0) {
//
-// End of "$Id: Fl_XPM_Image.cxx 5190 2006-06-09 16:16:34Z mike $".
+// End of "$Id: Fl_XPM_Image.cxx 6616 2009-01-01 21:28:26Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_abort.cxx b/plugins/zynaddsubfx/fltk/src/Fl_abort.cxx
index cc6571d2a..807092a8c 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_abort.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_abort.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_abort.cxx 5190 2006-06-09 16:16:34Z mike $"
+// "$Id: Fl_abort.cxx 6616 2009-01-01 21:28:26Z matt $"
//
// Warning/error message code for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,7 +25,7 @@
// http://www.fltk.org/str.php
//
-// This method is in it's own source file so that stdlib and stdio
+// This method is in its own source file so that stdlib and stdio
// do not need to be included in Fl.cxx:
// You can also override this by redefining all of these.
@@ -98,5 +98,5 @@ void (*Fl::error)(const char* format, ...) = ::error;
void (*Fl::fatal)(const char* format, ...) = ::fatal;
//
-// End of "$Id: Fl_abort.cxx 5190 2006-06-09 16:16:34Z mike $".
+// End of "$Id: Fl_abort.cxx 6616 2009-01-01 21:28:26Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_add_idle.cxx b/plugins/zynaddsubfx/fltk/src/Fl_add_idle.cxx
index 9321dd572..1d3d47d35 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_add_idle.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_add_idle.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_add_idle.cxx 5190 2006-06-09 16:16:34Z mike $"
+// "$Id: Fl_add_idle.cxx 6616 2009-01-01 21:28:26Z matt $"
//
// Idle routine support for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -49,6 +49,23 @@ static void call_idle() {
p->cb(p->data); // this may call add_idle() or remove_idle()!
}
+/**
+ Adds a callback function that is called every time by Fl::wait() and also
+ makes it act as though the timeout is zero (this makes Fl::wait() return
+ immediately, so if it is in a loop it is called repeatedly, and thus the
+ idle fucntion is called repeatedly). The idle function can be used to get
+ background processing done.
+
+ You can have multiple idle callbacks. To remove an idle callback use
+ Fl::remove_idle().
+
+ Fl::wait() and Fl::check() call idle callbacks, but Fl::ready() does not.
+
+ The idle callback can call any FLTK functions, including Fl::wait(),
+ Fl::check(), and Fl::ready().
+
+ FLTK will not recursively call the idle callback.
+*/
void Fl::add_idle(void (*cb)(void*), void* data) {
idle_cb* p = freelist;
if (p) freelist = p->next;
@@ -66,6 +83,9 @@ void Fl::add_idle(void (*cb)(void*), void* data) {
}
}
+/**
+ Returns true if the specified idle callback is currently installed.
+*/
int Fl::has_idle(void (*cb)(void*), void* data) {
idle_cb* p = first;
if (!p) return 0;
@@ -75,6 +95,9 @@ int Fl::has_idle(void (*cb)(void*), void* data) {
}
}
+/**
+ Removes the specified idle callback, if it is installed.
+*/
void Fl::remove_idle(void (*cb)(void*), void* data) {
idle_cb* p = first;
if (!p) return;
@@ -96,5 +119,5 @@ void Fl::remove_idle(void (*cb)(void*), void* data) {
}
//
-// End of "$Id: Fl_add_idle.cxx 5190 2006-06-09 16:16:34Z mike $".
+// End of "$Id: Fl_add_idle.cxx 6616 2009-01-01 21:28:26Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_arg.cxx b/plugins/zynaddsubfx/fltk/src/Fl_arg.cxx
index b94ccc45e..ebf0a6645 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_arg.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_arg.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_arg.cxx 5190 2006-06-09 16:16:34Z mike $"
+// "$Id: Fl_arg.cxx 6712 2009-03-22 19:21:34Z AlbrechtS $"
//
// Optional argument initialization code for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -67,7 +67,13 @@ extern const char *fl_fg;
extern const char *fl_bg;
extern const char *fl_bg2;
-// consume a switch from argv. Returns number of words eaten, 0 on error:
+/**
+ Consume a single switch from argv, starting at word i.
+ Returns the number of words eaten (1 or 2, or 0 if it is not
+ recognized) and adds the same value to i. You can use this
+ function if you prefer to control the incrementing through the
+ arguments yourself.
+*/
int Fl::arg(int argc, char **argv, int &i) {
arg_called = 1;
const char *s = argv[i];
@@ -82,6 +88,13 @@ int Fl::arg(int argc, char **argv, int &i) {
if (s[0] != '-' || s[1] == '-' || !s[1]) {return_i = 1; return 0;}
s++; // point after the dash
+#ifdef __APPLE__
+ if (!strncmp(s, "psn", 3)) {
+ // Skip process serial number...
+ i++;
+ }
+ else
+#endif // __APPLE__
if (fl_match(s, "iconic")) {
fl_show_iconic = 1;
i++;
@@ -160,11 +173,116 @@ int Fl::arg(int argc, char **argv, int &i) {
return 2;
}
-// consume all switches from argv. Returns number of words eaten.
-// Returns zero on error. 'i' will either point at first word that
-// does not start with '-', at the error word, or after a '--', or at
-// argc. If your program does not take any word arguments you can
-// report an error if i < argc.
+
+/**
+ Consume all switches from argv. Returns number of words eaten
+ Returns zero on error. 'i' will either point at first word that
+ does not start with '-', at the error word, or after a '--', or at
+ argc. If your program does not take any word arguments you can
+ report an error if i < argc.
+
+
FLTK provides an entirely optional command-line switch parser.
+ You don't have to call it if you don't like them! Everything it can do
+ can be done with other calls to FLTK.
+
+
To use the switch parser, call Fl::args(...) near the start
+ of your program. This does not open the display, instead
+ switches that need the display open are stashed into static variables.
+ Then you must display your first window by calling
+ window->show(argc,argv), which will do anything stored in the
+ static variables.
+
+
callback lets you define your own switches. It is called
+ with the same argc and argv, and with i the
+ index of each word. The callback should return zero if the switch is
+ unrecognized, and not change i. It should return non-zero if
+ the switch is recognized, and add at least 1 to i (it can add
+ more to consume words after the switch). This function is called
+ before any other tests, so you can override any FLTK
+ switch (this is why FLTK can use very short switches instead of
+ the long ones all other toolkits force you to use).
+
+
On return i is set to the index of the first non-switch.
+ This is either:
+
+
+ - The first word that does not start with '-'.
+ - The word '-' (used by many programs to name stdin as a file)
+ - The first unrecognized switch (return value is 0).
+ - argc
+
+
+ The return value is i unless an unrecognized switch is found,
+ in which case it is zero. If your program takes no arguments other
+ than switches you should produce an error if the return value is less
+ than argc.
+
+
All switches except -bg2 may be abbreviated one letter and case is ignored:
+
+
+
+ - -bg color or -background color
+
+
Sets the background color using Fl::background().
+
+ - -bg2 color or -background2 color
+
+
Sets the secondary background color using Fl::background2().
+
+ - -display host:n.n
+
+
Sets the X display to use; this option is silently
+ ignored under WIN32 and MacOS.
+
+ - -dnd and -nodnd
+
+
Enables or disables drag and drop text operations
+ using Fl::dnd_text_ops().
+
+ - -fg color or -foreground color
+
+
Sets the foreground color using Fl::foreground().
+
+ - -geometry WxH+X+Y
+
+
Sets the initial window position and size according
+ the the standard X geometry string.
+
+ - -iconic
+
+
Iconifies the window using Fl_Window::iconize().
+
+ - -kbd and -nokbd
+
+
Enables or disables visible keyboard focus for
+ non-text widgets using Fl::visible_focus().
+
+ - -name string
+
+
Sets the window class using Fl_Window::xclass().
+
+ - -scheme string
+
+
Sets the widget scheme using Fl::scheme().
+
+ - -title string
+
+
Sets the window title using Fl_Window::label().
+
+ - -tooltips and -notooltips
+
+
Enables or disables tooltips using Fl_Tooltip::enable().
+
+
+
+ The second form of Fl::args() is useful if your program does
+ not have command line switches of its own. It parses all the switches,
+ and if any are not recognized it calls Fl::abort(Fl::help).
+
+
A usage string is displayed if Fl::args() detects an invalid
+ argument on the command-line. You can change the message by setting the
+ Fl::help pointer.
+*/
int Fl::args(int argc, char** argv, int& i, int (*cb)(int,char**,int&)) {
arg_called = 1;
@@ -218,7 +336,7 @@ void Fl_Window::show(int argc, char **argv) {
// if (mh > gh) gh = mh;
Fl_Widget *r = resizable();
if (!r) resizable(this);
- // for WIN32 we assumme window is not mapped yet:
+ // for WIN32 we assume window is not mapped yet:
if (fl & (XValue | YValue))
x(-1), resize(gx,gy,gw,gh);
else
@@ -276,7 +394,7 @@ static const char * const helpmsg =
" -to[oltips]";
const char * const Fl::help = helpmsg+13;
-
+/** See Fl::args(int argc, char **argv, int& i, int (*cb)(int,char**,int&)) */
void Fl::args(int argc, char **argv) {
int i; if (Fl::args(argc,argv,i) < argc) Fl::error(helpmsg);
}
@@ -420,5 +538,5 @@ int XParseGeometry(const char* string, int* x, int* y,
#endif // ifdef WIN32
//
-// End of "$Id: Fl_arg.cxx 5190 2006-06-09 16:16:34Z mike $".
+// End of "$Id: Fl_arg.cxx 6712 2009-03-22 19:21:34Z AlbrechtS $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_compose.cxx b/plugins/zynaddsubfx/fltk/src/Fl_compose.cxx
index 422f4e37d..e0f4eb9ca 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_compose.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_compose.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_compose.cxx 5211 2006-06-19 07:43:39Z matt $"
+// "$Id: Fl_compose.cxx 6616 2009-01-01 21:28:26Z matt $"
//
// Character compose processing for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -85,8 +85,28 @@ static char dead_keys[] = {
};
#endif // !WIN32 && OLD_DEAD_KEY_CODE
+#ifndef FL_DOXYGEN
int Fl::compose_state = 0;
+#endif
+/** Any text editing widget should call this for each FL_KEYBOARD event.
+ Use of this function is very simple.
+
+
If true is returned, then it has modified the
+ Fl::event_text() and Fl::event_length() to a set of bytes to
+ insert (it may be of zero length!). In will also set the "del"
+ parameter to the number of bytes to the left of the cursor to
+ delete, this is used to delete the results of the previous call to
+ Fl::compose().
+
+
If false is returned, the keys should be treated as function
+ keys, and del is set to zero. You could insert the text anyways, if
+ you don't know what else to do.
+
+
Though the current implementation returns immediately, future
+ versions may take quite awhile, as they may pop up a window or do
+ other user-interface things to allow characters to be selected.
+*/
int Fl::compose(int& del) {
del = 0;
@@ -119,9 +139,13 @@ int Fl::compose(int& del) {
if (ascii == ' ') { // space turns into nbsp
#ifdef __APPLE__
- e_text[0] = char(0xCA);
-#else
- e_text[0] = char(0xA0);
+ int len = fl_utf8encode(0xCA, e_text);
+ e_text[len] = '\0';
+ e_length = len;
+ #else
+ int len = fl_utf8encode(0xA0, e_text);
+ e_text[len] = '\0';
+ e_length = len;
#endif
compose_state = 0;
return 1;
@@ -131,9 +155,14 @@ int Fl::compose(int& del) {
}
// see if it is either character of any pair:
- for (const char *p = compose_pairs; *p; p += 2)
+ for (const char *p = compose_pairs; *p; p += 2)
if (p[0] == ascii || p[1] == ascii) {
- if (p[1] == ' ') e_text[0] = (p-compose_pairs)/2+0x80;
+ if (p[1] == ' ') {
+ int len = fl_utf8encode((p-compose_pairs)/2+0xA0, e_text);
+ e_text[len] = '\0';
+ e_length = len;
+ }
+
compose_state = ascii;
return 1;
}
@@ -162,7 +191,9 @@ int Fl::compose(int& del) {
// now search for the pair in either order:
for (const char *p = compose_pairs; *p; p += 2) {
if (p[0] == ascii && p[1] == c1 || p[1] == ascii && p[0] == c1) {
- e_text[0] = (p-compose_pairs)/2+0x80;
+ int len = fl_utf8encode((p-compose_pairs)/2+0xA0, e_text);
+ e_text[len] = '\0';
+ e_length = len;
del = 1; // delete the old character and insert new one
compose_state = 0;
return 1;
@@ -203,7 +234,7 @@ int Fl::compose(int& del) {
ascii = e_text[0];
for (const char *p = compose_pairs; *p; p += 2)
if (p[0] == ascii ||
- (p[1] == ' ' && (p - compose_pairs) / 2 + 0x80 == ascii)) {
+ (p[1] == ' ' && (p - compose_pairs) / 2 + 0xA0 == ascii)) {
compose_state = p[0];
return 1;
}
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_display.cxx b/plugins/zynaddsubfx/fltk/src/Fl_display.cxx
index 7ba19f7ac..09d74c7c0 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_display.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_display.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_display.cxx 5190 2006-06-09 16:16:34Z mike $"
+// "$Id: Fl_display.cxx 6616 2009-01-01 21:28:26Z matt $"
//
// Display function for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -32,6 +32,12 @@
#include
#include "flstring.h"
+/**
+ Sets the X display to use for all windows. Actually this just sets
+ the environment variable $DISPLAY to the passed string, so this only
+ works before you show() the first window or otherwise open the display,
+ and does nothing useful under WIN32.
+*/
void Fl::display(const char *d) {
#if defined(__APPLE__) || defined(WIN32)
(void)d;
@@ -50,5 +56,5 @@ void Fl::display(const char *d) {
}
//
-// End of "$Id: Fl_display.cxx 5190 2006-06-09 16:16:34Z mike $".
+// End of "$Id: Fl_display.cxx 6616 2009-01-01 21:28:26Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_get_key.cxx b/plugins/zynaddsubfx/fltk/src/Fl_get_key.cxx
index 4b8d505bf..065ccda34 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_get_key.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_get_key.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_get_key.cxx 5190 2006-06-09 16:16:34Z mike $"
+// "$Id: Fl_get_key.cxx 6616 2009-01-01 21:28:26Z matt $"
//
// Keyboard state routines for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -65,5 +65,5 @@ int Fl::get_key(int k) {
#endif
//
-// End of "$Id: Fl_get_key.cxx 5190 2006-06-09 16:16:34Z mike $".
+// End of "$Id: Fl_get_key.cxx 6616 2009-01-01 21:28:26Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_get_key_mac.cxx b/plugins/zynaddsubfx/fltk/src/Fl_get_key_mac.cxx
index d0c740204..12f19dc54 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_get_key_mac.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_get_key_mac.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_get_key_mac.cxx 5190 2006-06-09 16:16:34Z mike $"
+// "$Id: Fl_get_key_mac.cxx 6755 2009-04-12 13:48:03Z matt $"
//
// MacOS keyboard state routines for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -54,7 +54,7 @@ static const struct {unsigned short vk, fltk;} vktab[] = {
{ 107, FL_Scroll_Lock }, { 53, FL_Escape }, { 0x73, FL_Home }, { 123, FL_Left },
{ 126, FL_Up }, { 124, FL_Right }, { 125, FL_Down }, { 0x74, FL_Page_Up },
{ 0x79, FL_Page_Down }, { 119, FL_End }, { 0x71, FL_Print }, { 127, FL_Insert },
- { 0x6e, FL_Menu }, { 114, FL_Help }, { 0x47, FL_Num_Lock },
+ { 0x6e, FL_Menu }, { 114, FL_Help }, /*{ 0x47, FL_Num_Lock },*/
{ 76, FL_KP_Enter }, { 67, FL_KP+'*' }, { 69, FL_KP+'+'}, { 78, FL_KP+'-' }, { 65, FL_KP+'.' }, { 75, FL_KP+'/' },
{ 82, FL_KP+'0' }, { 83, FL_KP+'1' }, { 84, FL_KP+'2' }, { 85, FL_KP+'3' },
{ 86, FL_KP+'4' }, { 87, FL_KP+'5' }, { 88, FL_KP+'6' }, { 89, FL_KP+'7' },
@@ -64,7 +64,7 @@ static const struct {unsigned short vk, fltk;} vktab[] = {
{ 0x65, FL_F+9 }, { 0x6D, FL_F+10 }, { 0x67, FL_F+11 }, { 0x6f, FL_F+12 },
{ 56, FL_Shift_L }, { 56, FL_Shift_R }, { 59, FL_Control_L }, { 59, FL_Control_R },
{ 57, FL_Caps_Lock }, { 55, FL_Meta_L }, { 55, FL_Meta_R },
- { 58, FL_Alt_L }, { 58, FL_Alt_R }, { 0x75, FL_Delete },
+ { 58, FL_Alt_L }, { 58, FL_Alt_R }, /*{ 0x75, FL_Delete },*/ { 0x47, FL_Delete },
};
static int fltk2mac(int fltk) {
@@ -106,5 +106,5 @@ int Fl::get_key(int k) {
}
//
-// End of "$Id: Fl_get_key_mac.cxx 5190 2006-06-09 16:16:34Z mike $".
+// End of "$Id: Fl_get_key_mac.cxx 6755 2009-04-12 13:48:03Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_get_key_win32.cxx b/plugins/zynaddsubfx/fltk/src/Fl_get_key_win32.cxx
index 3153fdbfc..1f14b4cda 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_get_key_win32.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_get_key_win32.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_get_key_win32.cxx 5190 2006-06-09 16:16:34Z mike $"
+// "$Id: Fl_get_key_win32.cxx 6616 2009-01-01 21:28:26Z matt $"
//
// WIN32 keyboard state routines for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -134,5 +134,5 @@ int Fl::get_key(int k) {
}
//
-// End of "$Id: Fl_get_key_win32.cxx 5190 2006-06-09 16:16:34Z mike $".
+// End of "$Id: Fl_get_key_win32.cxx 6616 2009-01-01 21:28:26Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_get_system_colors.cxx b/plugins/zynaddsubfx/fltk/src/Fl_get_system_colors.cxx
index 094f9c89c..938f82936 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_get_system_colors.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_get_system_colors.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_get_system_colors.cxx 5699 2007-02-20 17:02:41Z matt $"
+// "$Id: Fl_get_system_colors.cxx 6616 2009-01-01 21:28:26Z matt $"
//
// System color support for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2006 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -29,6 +29,7 @@
#include
#include
#include
+#include
#include "flstring.h"
#include
#include
@@ -50,7 +51,12 @@ static char fl_bg_set = 0;
static char fl_bg2_set = 0;
static char fl_fg_set = 0;
-
+/**
+ Changes fl_color(FL_BACKGROUND_COLOR) to the given color,
+ and changes the gray ramp from 32 to 56 to black to white. These are
+ the colors used as backgrounds by almost all widgets and used to draw
+ the edges of all the boxtypes.
+*/
void Fl::background(uchar r, uchar g, uchar b) {
fl_bg_set = 1;
@@ -69,13 +75,19 @@ void Fl::background(uchar r, uchar g, uchar b) {
uchar(pow(gray,powb)*255+.5));
}
}
-
+/** Changes fl_color(FL_FOREGROUND_COLOR). */
void Fl::foreground(uchar r, uchar g, uchar b) {
fl_fg_set = 1;
Fl::set_color(FL_FOREGROUND_COLOR,r,g,b);
}
+/**
+ Changes the alternative background color. This color is used as a
+ background by Fl_Input and other text widgets.
+ This call may change fl_color(FL_FOREGROUND_COLOR) if it
+ does not provide sufficient contrast to FL_BACKGROUND2_COLOR.
+*/
void Fl::background2(uchar r, uchar g, uchar b) {
fl_bg2_set = 1;
@@ -131,7 +143,18 @@ int fl_parse_color(const char* p, uchar& r, uchar& g, uchar& b) {
} else return 0;
}
#endif // WIN32 || __APPLE__
-
+/** \fn Fl::get_system_colors()
+ Read the user preference colors from the system and use them to call
+ Fl::foreground(), Fl::background(), and
+ Fl::background2(). This is done by
+ Fl_Window::show(argc,argv) before applying the -fg and -bg
+ switches.
+
+
On X this reads some common values from the Xdefaults database.
+ KDE users can set these values by running the "krdb" program, and
+ newer versions of KDE set this automatically if you check the "apply
+ style to other X programs" switch in their control panel.
+*/
#if defined(WIN32)
static void
getsyscolor(int what, const char* arg, void (*func)(uchar,uchar,uchar))
@@ -240,11 +263,32 @@ extern void fl_down_frame(int, int, int, int, Fl_Color);
extern void fl_thin_up_frame(int, int, int, int, Fl_Color);
extern void fl_thin_down_frame(int, int, int, int, Fl_Color);
-const char *Fl::scheme_ = (const char *)0;
-Fl_Image *Fl::scheme_bg_ = (Fl_Image *)0;
+#ifndef FL_DOXYGEN
+const char *Fl::scheme_ = (const char *)0; // current scheme
+Fl_Image *Fl::scheme_bg_ = (Fl_Image *)0; // current background image for the scheme
+#endif
static Fl_Pixmap tile(tile_xpm);
+/**
+ Gets or sets the current widget scheme. NULL will use
+ the scheme defined in the FLTK_SCHEME environment
+ variable or the scheme resource under X11. Otherwise,
+ any of the following schemes can be used:
+
+
+
+ - "none" - This is the default look-n-feel which resembles old
+ Windows (95/98/Me/NT/2000) and old GTK/KDE
+
+ - "plastic" - This scheme is inspired by the Aqua user interface
+ on Mac OS X
+
+ - "gtk+" - This scheme is inspired by the Red Hat Bluecurve
+ theme
+
+
+*/
int Fl::scheme(const char *s) {
if (!s) {
if ((s = getenv("FLTK_SCHEME")) == NULL) {
@@ -382,5 +426,5 @@ int Fl::reload_scheme() {
//
-// End of "$Id: Fl_get_system_colors.cxx 5699 2007-02-20 17:02:41Z matt $".
+// End of "$Id: Fl_get_system_colors.cxx 6616 2009-01-01 21:28:26Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_grab.cxx b/plugins/zynaddsubfx/fltk/src/Fl_grab.cxx
index 7a735e2ab..706cb3a64 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_grab.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_grab.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_grab.cxx 5190 2006-06-09 16:16:34Z mike $"
+// "$Id: Fl_grab.cxx 6616 2009-01-01 21:28:26Z matt $"
//
// Grab/release code for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -102,5 +102,5 @@ void Fl::grab(Fl_Window* win) {
}
//
-// End of "$Id: Fl_grab.cxx 5190 2006-06-09 16:16:34Z mike $".
+// End of "$Id: Fl_grab.cxx 6616 2009-01-01 21:28:26Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_lock.cxx b/plugins/zynaddsubfx/fltk/src/Fl_lock.cxx
index 688dc3db5..1d2b617d1 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_lock.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_lock.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_lock.cxx 5950 2007-10-07 10:44:28Z matt $"
+// "$Id: Fl_lock.cxx 6787 2009-05-14 20:16:09Z engelsman $"
//
// Multi-threading support code for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2007 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -67,17 +67,20 @@
returns the most recent value!
*/
+#ifndef FL_DOXYGEN
Fl_Awake_Handler *Fl::awake_ring_;
void **Fl::awake_data_;
int Fl::awake_ring_size_;
int Fl::awake_ring_head_;
int Fl::awake_ring_tail_;
-static const int AWAKE_RING_SIZE = 1024;
+#endif
+static const int AWAKE_RING_SIZE = 1024;
static void lock_ring();
static void unlock_ring();
+/** Adds an awake handler for use in awake(). */
int Fl::add_awake_handler_(Fl_Awake_Handler func, void *data)
{
int ret = 0;
@@ -100,7 +103,7 @@ int Fl::add_awake_handler_(Fl_Awake_Handler func, void *data)
unlock_ring();
return ret;
}
-
+/** Gets the last stored awake handler for use in awake(). */
int Fl::get_awake_handler_(Fl_Awake_Handler &func, void *&data)
{
int ret = 0;
@@ -119,9 +122,11 @@ int Fl::get_awake_handler_(Fl_Awake_Handler &func, void *&data)
}
//
-// 'Fl::awake()' - Let the main thread know an update is pending
-// and have it cal a specific function
-//
+/**
+ Let the main thread know an update is pending
+ and have it call a specific function
+ See void awake(void* message=0).
+*/
int Fl::awake(Fl_Awake_Handler func, void *data) {
int ret = add_awake_handler_(func, data);
Fl::awake();
@@ -130,6 +135,57 @@ int Fl::awake(Fl_Awake_Handler func, void *data) {
////////////////////////////////////////////////////////////////
// Windows threading...
+/** \fn void Fl::lock()
+ The lock() method blocks the current thread until it
+ can safely access FLTK widgets and data. Child threads should
+ call this method prior to updating any widgets or accessing
+ data. The main thread must call lock() to initialize
+ the threading support in FLTK.
+
+ Child threads must call unlock() when they are done
+ accessing FLTK.
+
+ When the wait() method is waiting
+ for input or timeouts, child threads are given access to FLTK.
+ Similarly, when the main thread needs to do processing, it will
+ wait until all child threads have called unlock() before processing
+ additional data.
+
+ See also: \ref advanced_multithreading
+*/
+/** \fn void Fl::unlock()
+ The unlock() method releases the lock that was set
+ using the lock() method. Child
+ threads should call this method as soon as they are finished
+ accessing FLTK.
+
+ See also: \ref advanced_multithreading
+*/
+/** \fn void Fl::awake(void* msg)
+ The awake() method sends a message pointer to the main thread,
+ causing any pending Fl::wait() call to
+ terminate so that the main thread can retrieve the message and any pending
+ redraws can be processed.
+
+ Multiple calls to Fl::awake() will queue multiple pointers
+ for the main thread to process, up to a system-defined (typically several
+ thousand) depth. The default message handler saves the last message which
+ can be accessed using the
+ Fl::thread_message() function.
+
+ The second form of awake() registers a function that will be
+ called by the main thread during the next message handling cycle.
+ awake() will return 0 if the callback function was registered,
+ and -1 if registration failed. Over a thousand awake callbacks can be
+ registered simultaneously.
+
+ In the context of a threaded application, a call to Fl::awake() with no
+ argument will trigger event loop handling in the main thread. Since
+ it is not possible to call Fl::flush() from a subsidiary thread,
+ Fl::awake() is the best (and only, really) substitute.
+
+ See also: \ref advanced_multithreading
+*/
#ifdef WIN32
# include
# include
@@ -174,10 +230,6 @@ static void lock_function() {
EnterCriticalSection(&cs);
}
-//
-// 'Fl::lock()' - Lock access to FLTK data structures...
-//
-
void Fl::lock() {
if (!main_thread) InitializeCriticalSection(&cs);
@@ -190,21 +242,10 @@ void Fl::lock() {
}
}
-//
-// 'Fl::unlock()' - Unlock access to FLTK data structures...
-//
-
void Fl::unlock() {
unlock_function();
}
-
-//
-// 'Fl::awake()' - Let the main thread know an update is pending.
-//
-// When called from a thread, it causes FLTK to awake from Fl::wait()...
-//
-
void Fl::awake(void* msg) {
PostThreadMessage( main_thread, fl_wake_msg, (WPARAM)msg, 0);
}
@@ -354,5 +395,5 @@ void Fl::awake(void*) {
#endif // WIN32
//
-// End of "$Id: Fl_lock.cxx 5950 2007-10-07 10:44:28Z matt $".
+// End of "$Id: Fl_lock.cxx 6787 2009-05-14 20:16:09Z engelsman $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_mac.cxx b/plugins/zynaddsubfx/fltk/src/Fl_mac.cxx
index 47b2daee1..5e181fc6c 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_mac.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_mac.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_mac.cxx 6033 2008-02-20 18:17:34Z matt $"
+// "$Id: Fl_mac.cxx 6758 2009-04-13 07:32:01Z matt $"
//
// MacOS specific code for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2007 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -43,9 +43,16 @@
// to implement clipping. This should be changed into pure
// Quartz calls in the near future.
+// FIXME moving away from Carbon, I am replacing the Scrap manager calls with Pasteboard
+// calls that support utf8 encoding. As soon as these unction haven proven working
+// the Scrap manager calls should be removed
+#define USE_PASTEBOARD 1
+
// we don't need the following definition because we deliver only
// true mouse moves. On very slow systems however, this flag may
// still be useful.
+#ifndef FL_DOXYGEN
+
#define CONSOLIDATE_MOTION 0
extern "C" {
#include
@@ -82,6 +89,8 @@ extern void fl_fix_focus();
static void handleUpdateEvent( WindowPtr xid );
//+ int fl_handle(const EventRecord &event);
static int FSSpec2UnixPath( FSSpec *fs, char *dst );
+// converting cr lf converter function
+static void convert_crlf(char * string, size_t len);
// public variables
int fl_screen;
@@ -115,6 +124,19 @@ extern Fl_Window* fl_xmousewin;
enum { kEventClassFLTK = 'fltk' };
enum { kEventFLTKBreakLoop = 1, kEventFLTKDataReady };
+/* fltk-utf8 placekeepers */
+void fl_reset_spot()
+{
+}
+
+void fl_set_spot(int font, int size, int X, int Y, int W, int H, Fl_Window *win)
+{
+}
+
+void fl_set_status(int x, int y, int w, int h)
+{
+}
+
/**
* Mac keyboard lookup table
*/
@@ -134,7 +156,7 @@ static unsigned short macKeyLookUp[128] =
0/*FL_Shift_L*/, 0/*FL_Caps_Lock*/, 0/*FL_Alt_L*/, 0/*FL_Control_L*/,
0/*FL_Shift_R*/, 0/*FL_Alt_R*/, 0/*FL_Control_R*/, 0,
- 0, FL_KP+'.', FL_Right, FL_KP+'*', 0, FL_KP+'+', FL_Left, FL_Num_Lock,
+ 0, FL_KP+'.', FL_Right, FL_KP+'*', 0, FL_KP+'+', FL_Left, FL_Delete,
FL_Down, 0, 0, FL_KP+'/', FL_KP_Enter, FL_Up, FL_KP+'-', 0,
0, FL_KP+'=', FL_KP+'0', FL_KP+'1', FL_KP+'2', FL_KP+'3', FL_KP+'4', FL_KP+'5',
@@ -150,7 +172,7 @@ static unsigned short macKeyLookUp[128] =
/**
* convert the current mouse chord into the FLTK modifier state
*/
-static void mods_to_e_state( UInt32 mods )
+static unsigned int mods_to_e_state( UInt32 mods )
{
long state = 0;
if ( mods & kEventKeyModifierNumLockMask ) state |= FL_NUM_LOCK;
@@ -159,8 +181,10 @@ static void mods_to_e_state( UInt32 mods )
if ( mods & (controlKey|rightControlKey) ) state |= FL_CTRL;
if ( mods & (shiftKey|rightShiftKey) ) state |= FL_SHIFT;
if ( mods & alphaLock ) state |= FL_CAPS_LOCK;
- Fl::e_state = ( Fl::e_state & 0xff000000 ) | state;
+ unsigned int ret = ( Fl::e_state & 0xff000000 ) | state;
+ Fl::e_state = ret;
//printf( "State 0x%08x (%04x)\n", Fl::e_state, mods );
+ return ret;
}
@@ -542,8 +566,11 @@ static pascal OSStatus carbonDispatchHandler( EventHandlerCallRef nextHandler, E
switch (GetEventKind( event ) )
{
case kEventCommandProcess:
- GetEventParameter( event, kEventParamDirectObject, typeHICommand, NULL, sizeof(HICommand), NULL, &cmd );
- ret = HandleMenu( &cmd );
+ ret = GetEventParameter( event, kEventParamDirectObject, typeHICommand, NULL, sizeof(HICommand), NULL, &cmd );
+ if (ret == noErr && (cmd.attributes & kHICommandFromMenu) != 0)
+ ret = HandleMenu( &cmd );
+ else
+ ret = eventNotHandledErr;
break;
}
break;
@@ -663,7 +690,7 @@ static pascal void do_timer(EventLoopTimerRef timer, void* data)
*/
static double do_queued_events( double time = 0.0 )
{
- static bool been_here = 0;
+ static bool been_here = false;
static RgnHandle rgn;
// initialize events and a region that enables mouse move events
@@ -673,7 +700,7 @@ static double do_queued_events( double time = 0.0 )
GetMouse(&mp);
SetRectRgn(rgn, mp.h, mp.v, mp.h, mp.v);
SetEventMask(everyEvent);
- been_here = 1;
+ been_here = true;
}
OSStatus ret;
static EventTargetRef target = 0;
@@ -1078,18 +1105,181 @@ static unsigned short keycode_to_sym( UInt32 keyCode, UInt32 mods, unsigned shor
return deflt;
}
+/*
+ * keycode_function for post-10.5 systems, allows more sophisticated decoding of keys
+ */
+static int keycodeToUnicode(
+ char * uniChars, int maxChars,
+ EventKind eKind,
+ UInt32 keycode, UInt32 modifiers,
+ UInt32 * deadKeyStatePtr,
+ unsigned char, // not used in this function
+ unsigned short) // not used in this function
+{
+ // first get the keyboard mapping in a post 10.2 way
+
+ Ptr resource;
+ TextEncoding encoding;
+ static TextEncoding lastEncoding = kTextEncodingMacRoman;
+ int len = 0;
+ KeyboardLayoutRef currentLayout = NULL;
+ static KeyboardLayoutRef lastLayout = NULL;
+ SInt32 currentLayoutId = 0;
+ static SInt32 lastLayoutId;
+ int hasLayoutChanged = false;
+ static Ptr uchr = NULL;
+ static Ptr KCHR = NULL;
+ // ScriptCode currentKeyScript;
+
+ KLGetCurrentKeyboardLayout(¤tLayout);
+ if (currentLayout) {
+ KLGetKeyboardLayoutProperty(currentLayout, kKLIdentifier, (const void**)¤tLayoutId);
+ if ( (lastLayout != currentLayout) || (lastLayoutId != currentLayoutId) ) {
+ lastLayout = currentLayout;
+ lastLayoutId = currentLayoutId;
+ uchr = NULL;
+ KCHR = NULL;
+ if ((KLGetKeyboardLayoutProperty(currentLayout, kKLuchrData, (const void**)&uchr) == noErr) && (uchr != NULL)) {
+ // done
+ } else if ((KLGetKeyboardLayoutProperty(currentLayout, kKLKCHRData, (const void**)&KCHR) == noErr) && (KCHR != NULL)) {
+ // done
+ }
+ // FIXME No Layout property found. Now we have a problem.
+ }
+ }
+ if (hasLayoutChanged) {
+ //deadKeyStateUp = deadKeyStateDown = 0;
+ if (KCHR != NULL) {
+ // FIXME this must not happen
+ } else if (uchr == NULL) {
+ KCHR = (Ptr) GetScriptManagerVariable(smKCHRCache);
+ }
+ }
+ if (uchr != NULL) {
+ // this is what I expect
+ resource = uchr;
+ } else {
+ resource = KCHR;
+ encoding = lastEncoding;
+ // this is actually not supported by the following code and will likely crash
+ }
+
+ // now apply that keyboard mapping to our keycode
+
+ int action;
+ //OptionBits options = 0;
+ // not used yet: OptionBits options = kUCKeyTranslateNoDeadKeysMask;
+ unsigned long keyboardType;
+ keycode &= 0xFF;
+ modifiers = (modifiers >> 8) & 0xFF;
+ keyboardType = LMGetKbdType();
+ OSStatus status;
+ UniCharCount actuallength;
+ UniChar utext[10];
+
+ switch(eKind) {
+ case kEventRawKeyDown: action = kUCKeyActionDown; break;
+ case kEventRawKeyUp: action = kUCKeyActionUp; break;
+ case kEventRawKeyRepeat: action = kUCKeyActionAutoKey; break;
+ default: return 0;
+ }
+
+ UInt32 deadKeyState = *deadKeyStatePtr;
+ if ((action==kUCKeyActionUp)&&(*deadKeyStatePtr))
+ deadKeyStatePtr = &deadKeyState;
+
+ status = UCKeyTranslate(
+ (const UCKeyboardLayout *) uchr,
+ keycode, action, modifiers, keyboardType,
+ 0, deadKeyStatePtr,
+ 10, &actuallength, utext);
+
+ if (noErr != status) {
+ fprintf(stderr,"UCKeyTranslate failed: %d\n", (int) status);
+ actuallength = 0;
+ }
+
+ // convert the list of unicode chars into utf8
+ // FIXME no bounds check (see maxchars)
+ unsigned i;
+ for (i=0; i= FL_KP && sym <= FL_KP_Last) || !(sym & 0xff00) ||
+ sym == FL_Tab || sym == FL_Enter) {
+ buffer[0] = key;
+ return 1;
+ } else {
+ buffer[0] = 0;
+ return 0;
+ }
+} /* keycode_wrap_old */
+/*
+ * Stub pointer to select appropriate keycode_function per operating system version. This function pointer
+ * is initialised in fl_open_display, based on the runtime identification of the host OS version. This is
+ * intended to allow us to utilise 10.5 services dynamically to improve Unicode handling, whilst still
+ * allowing code to run satisfactorily on older systems.
+ */
+static int (*keycode_function)(char*, int, EventKind, UInt32, UInt32, UInt32*, unsigned char, unsigned short) = keycode_wrap_old;
+
+
+// EXPERIMENTAL!
+pascal OSStatus carbonTextHandler(
+ EventHandlerCallRef nextHandler, EventRef event, void *userData )
+{
+ Fl_Window *window = (Fl_Window*)userData;
+ Fl::first_window(window);
+ fl_lock_function();
+ //int kind = GetEventKind(event);
+ unsigned short buf[200];
+ ByteCount size;
+ GetEventParameter( event, kEventParamTextInputSendText, typeUnicodeText,
+ NULL, 100, &size, &buf );
+// printf("TextEvent: %02x %02x %02x %02x\n", buf[0], buf[1], buf[2], buf[3]);
+ // FIXME: oversimplified!
+ unsigned ucs = buf[0];
+ char utf8buf[20];
+ int len = fl_utf8encode(ucs, utf8buf);
+ Fl::e_length = len;
+ Fl::e_text = utf8buf;
+ while (window->parent()) window = window->window();
+ Fl::handle(FL_KEYBOARD, window);
+ fl_unlock_function();
+ fl_lock_function();
+ Fl::handle(FL_KEYUP, window);
+ fl_unlock_function();
+ // for some reason, the window does not redraw until the next mouse move or button push
+ // sending a 'redraw()' or 'awake()' does not solve the issue!
+ Fl::flush();
+ return noErr;
+}
+
/**
* handle carbon keyboard events
*/
pascal OSStatus carbonKeyboardHandler(
EventHandlerCallRef nextHandler, EventRef event, void *userData )
{
- static char buffer[5];
+ static char buffer[32];
int sendEvent = 0;
Fl_Window *window = (Fl_Window*)userData;
Fl::first_window(window);
UInt32 mods;
- static UInt32 prevMods = 0xffffffff;
+ static UInt32 prevMods = mods_to_e_state( GetCurrentKeyModifiers() );
fl_lock_function();
@@ -1098,10 +1288,9 @@ pascal OSStatus carbonKeyboardHandler(
// get the modifiers for any of the events
GetEventParameter( event, kEventParamKeyModifiers, typeUInt32,
NULL, sizeof(UInt32), NULL, &mods );
- if ( prevMods == 0xffffffff ) prevMods = mods;
// get the key code only for key events
- UInt32 keyCode = 0;
+ UInt32 keyCode = 0, maskedKeyCode = 0;
unsigned char key = 0;
unsigned short sym = 0;
if (kind!=kEventRawKeyModifiersChanged) {
@@ -1110,7 +1299,12 @@ pascal OSStatus carbonKeyboardHandler(
GetEventParameter( event, kEventParamKeyMacCharCodes, typeChar,
NULL, sizeof(char), NULL, &key );
}
- /* output a human readbale event identifier for debugging
+ // extended keyboards can also send sequences on key-up to generate Kanji etc. codes.
+ // Some observed prefixes are 0x81 to 0x83, followed by an 8 bit keycode.
+ // In this mode, there seem to be no key-down codes
+// printf("%08x %08x %08x\n", keyCode, mods, key);
+ maskedKeyCode = keyCode & 0x7f;
+ /* output a human readable event identifier for debugging
const char *ev = "";
switch (kind) {
case kEventRawKeyDown: ev = "kEventRawKeyDown"; break;
@@ -1125,6 +1319,8 @@ pascal OSStatus carbonKeyboardHandler(
{
case kEventRawKeyDown:
case kEventRawKeyRepeat:
+/*
+ // FIXME Matt: For 10.5, the keycode_function will handle all this. This is untested for ealier versions of OS X.
// When the user presses a "dead key", no information is send about
// which dead key symbol was created. So we need to trick Carbon into
// giving us the code by sending a "space" after the "dead key".
@@ -1139,6 +1335,7 @@ pascal OSStatus carbonKeyboardHandler(
} else {
Fl::e_state &= 0xbfffffff; // clear the deadkey flag
}
+*/
sendEvent = FL_KEYBOARD;
// fall through
case kEventRawKeyUp:
@@ -1148,31 +1345,29 @@ pascal OSStatus carbonKeyboardHandler(
}
// if the user pressed alt/option, event_key should have the keycap,
// but event_text should generate the international symbol
+ sym = macKeyLookUp[maskedKeyCode];
if ( isalpha(key) )
sym = tolower(key);
- else if ( Fl::e_state&FL_CTRL && key<32 )
+ else if ( Fl::e_state&FL_CTRL && key<32 && sym<0xff00)
sym = key+96;
- else if ( Fl::e_state&FL_ALT ) // find the keycap of this key
- sym = keycode_to_sym( keyCode & 0x7f, 0, macKeyLookUp[ keyCode & 0x7f ] );
- else
- sym = macKeyLookUp[ keyCode & 0x7f ];
+ else if ( Fl::e_state&FL_ALT && sym<0xff00) // find the keycap of this key
+ sym = keycode_to_sym( maskedKeyCode, 0, macKeyLookUp[ maskedKeyCode ] );
Fl::e_keysym = Fl::e_original_keysym = sym;
// Handle FL_KP_Enter on regular keyboards and on Powerbooks
- if ( keyCode==0x4c || keyCode==0x34) key=0x0d;
+ if ( maskedKeyCode==0x4c || maskedKeyCode==0x34) key=0x0d;
+ // Handle the Delete key on the keypad
// Matt: the Mac has no concept of a NumLock key, or at least not visible
// Matt: to Carbon. The kEventKeyModifierNumLockMask is only set when
// Matt: a numeric keypad key is pressed and does not correspond with
// Matt: the NumLock light in PowerBook keyboards.
- if ( (sym >= FL_KP && sym <= FL_KP_Last) || !(sym & 0xff00) ||
- sym == FL_Tab || sym == FL_Enter) {
- buffer[0] = key;
- Fl::e_length = 1;
- } else {
- buffer[0] = 0;
- Fl::e_length = 0;
- }
+
+ // Matt: attempt to get the correct Unicode character(s) from our keycode
+ // imm: keycode_function function pointer added to allow us to use different functions
+ // imm: depending on which OS version we are running on (tested and set in fl_open_display)
+ static UInt32 deadKeyState = 0; // must be cleared when losing focus
+ Fl::e_length = (*keycode_function)(buffer, 31, kind, keyCode, mods, &deadKeyState, key, sym);
Fl::e_text = buffer;
- // insert UnicodeHandling here!
+ buffer[Fl::e_length] = 0; // just in case...
break;
case kEventRawKeyModifiersChanged: {
UInt32 tMods = prevMods ^ mods;
@@ -1337,12 +1532,31 @@ void fl_open_display() {
CFRelease(execUrl);
}
+ // imm: keycode handler stub setting - use Gestalt to determine the running system version,
+ // then set the keycode_function pointer accordingly
+ SInt32 MacVersion;
+ if (Gestalt(gestaltSystemVersion, &MacVersion) == noErr)
+ {
+// SInt32 maj, min, fix;
+// Gestalt(gestaltSystemVersionMajor, &maj); // e.g. 10
+// Gestalt(gestaltSystemVersionMinor, &min); // e.g. 4
+// Gestalt(gestaltSystemVersionBugFix, &fix); // e.g. 11
+ if(MacVersion >= 0x1050) { // 10.5.0 or later
+ keycode_function = keycodeToUnicode;
+ }
+ else {
+ keycode_function = keycode_wrap_old; // pre-10.5 mechanism
+ }
+ }
+ // else our default handler will be used (keycode_wrap_old)
+
+
if( !bundle )
{
// Earlier versions of this code tried to use weak linking, however it
- // appears that this does not work on 10.2. Since 10.3 and higher provide
- // both TransformProcessType and CPSEnableForegroundOperation, the following
- // conditional code compiled on 10.2 will still work on newer releases...
+ // appears that this does not work on 10.2. Since 10.3 and higher provide
+ // both TransformProcessType and CPSEnableForegroundOperation, the following
+ // conditional code compiled on 10.2 will still work on newer releases...
OSErr err;
#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_2
@@ -1439,15 +1653,8 @@ unsigned short mac2fltk(ulong macKey)
void Fl_X::flush()
{
w->flush();
-#ifdef __APPLE_QD__
- GrafPtr port;
- GetPort( &port );
- if ( port )
- QDFlushPortBuffer( port, 0 );
-#elif defined (__APPLE_QUARTZ__)
if (fl_gc)
CGContextFlush(fl_gc);
-#endif
SetOrigin( 0, 0 );
}
@@ -1488,6 +1695,46 @@ void handleUpdateEvent( WindowPtr xid )
SetPort( oldPort );
}
+// Gets the border sizes and the titlebar size
+static void get_window_frame_sizes(int &bx, int &by, int &bt) {
+#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_2
+ static HIRect contentRect = { {50,50}, {100,100} }; // a rect to stand in for the content rect of a real window
+ static HIThemeWindowDrawInfo metrics= {0,
+ kThemeStateActive, kThemeDocumentWindow,
+ kThemeWindowHasFullZoom + kThemeWindowHasCloseBox +
+ kThemeWindowHasCollapseBox + kThemeWindowHasTitleText,
+ 0, 0};
+ HIShapeRef shape1=0, shape2=0, shape3=0;
+ HIRect rect1, rect2, rect3;
+ OSStatus status;
+ status = HIThemeGetWindowShape(&contentRect, &metrics, kWindowStructureRgn, &shape1);
+ status |= HIThemeGetWindowShape(&contentRect, &metrics, kWindowContentRgn, &shape2);
+ status |= HIThemeGetWindowShape(&contentRect, &metrics, kWindowTitleBarRgn, &shape3);
+
+ if (!status)
+ {
+ HIShapeGetBounds(shape1, &rect1);
+ HIShapeGetBounds(shape2, &rect2);
+ HIShapeGetBounds(shape3, &rect3);
+ bt = rect3.size.height;
+ bx = rect2.origin.x - rect1.origin.x;
+ by = rect2.origin.y - rect1.origin.y - bt;
+ // fprintf(stderr, "HIThemeGetWindowShape succeeded bx=%d by=%d bt=%d\n", bx, by, bt);
+ }
+ else
+#endif // MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_2
+ {
+ // sets default dimensions
+ bx = by = 6;
+ bt = 22;
+ // fprintf(stderr, "HIThemeGetWindowShape failed, bx=%d by=%d bt=%d\n", bx, by, bt);
+ }
+#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_2
+ CFRelease(shape1); // we must free HIThemeGetWindowShape() (copied) handles
+ CFRelease(shape2);
+ CFRelease(shape3);
+#endif // MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_2
+}
/**
* \todo this is a leftover from OS9 times. Please check how much applies to Carbon!
@@ -1498,14 +1745,19 @@ int Fl_X::fake_X_wm(const Fl_Window* w,int &X,int &Y, int &bt,int &bx, int &by)
if (w->border() && !w->parent()) {
if (w->maxw != w->minw || w->maxh != w->minh) {
ret = 2;
- bx = 6; // \todo Mac : GetSystemMetrics(SM_CXSIZEFRAME);
- by = 6; // \todo Mac : get Mac window frame size GetSystemMetrics(SM_CYSIZEFRAME);
+ get_window_frame_sizes(bx, by, bt);
+ /*
+ bx = 6; // \todo Mac : GetSystemMetrics(SM_CXSIZEFRAME);
+ by = 6; // \todo Mac : get Mac window frame size GetSystemMetrics(SM_CYSIZEFRAME);
+ */
} else {
ret = 1;
- bx = 6; // \todo Mac : GetSystemMetrics(SM_CXFIXEDFRAME);
- by = 6; // \todo Mac : GetSystemMetrics(SM_CYFIXEDFRAME);
+ get_window_frame_sizes(bx, by, bt);
+ /*
+ bx = 6; // \todo Mac : GetSystemMetrics(SM_CXFIXEDFRAME);
+ by = 6; // \todo Mac : GetSystemMetrics(SM_CYFIXEDFRAME);
+ */
}
- bt = 22; // \todo Mac : GetSystemMetrics(SM_CYCAPTION);
}
//The coordinates of the whole window, including non-client area
xoff = bx;
@@ -1599,6 +1851,12 @@ static int FSSpec2UnixPath( FSSpec *fs, char *dst )
FSRefMakePath( &fsRef, (UInt8*)dst, 1024 );
return strlen(dst);
}
+static void convert_crlf(char * s, size_t len)
+{
+ // turn all \r characters into \n:
+ for (size_t x = 0; x < len; x++) if (s[x] == '\r') s[x] = '\n';
+}
+
static DragReference currDragRef = 0;
static char *currDragData = 0L;
@@ -1631,19 +1889,36 @@ static OSErr fillCurrentDragData(DragReference dragRef)
FlavorFlags flags;
Size itemSize, size = 0;
CountDragItems( dragRef, &nItem );
+
for ( i = 1; i <= nItem; i++ )
{
GetDragItemReferenceNumber( dragRef, i, &itemRef );
+ ret = GetFlavorFlags( dragRef, itemRef, 'utf8', &flags );
+ if ( ret == noErr )
+ {
+ GetFlavorDataSize( dragRef, itemRef, 'utf8', &itemSize );
+ size += itemSize;
+ continue;
+ }
+ ret = GetFlavorFlags( dragRef, itemRef, 'utxt', &flags );
+ if ( ret == noErr )
+ {
+ GetFlavorDataSize( dragRef, itemRef, 'utxt', &itemSize );
+ size += itemSize;
+ continue;
+ }
ret = GetFlavorFlags( dragRef, itemRef, 'TEXT', &flags );
if ( ret == noErr )
{
GetFlavorDataSize( dragRef, itemRef, 'TEXT', &itemSize );
size += itemSize;
+ continue;
}
ret = GetFlavorFlags( dragRef, itemRef, 'hfs ', &flags );
if ( ret == noErr )
{
size += 1024; //++ ouch! We should create the full pathname and figure out its length
+ continue;
}
}
@@ -1659,24 +1934,45 @@ static OSErr fillCurrentDragData(DragReference dragRef)
for ( i = 1; i <= nItem; i++ )
{
GetDragItemReferenceNumber( dragRef, i, &itemRef );
+ ret = GetFlavorFlags( dragRef, itemRef, 'utf8', &flags );
+ if ( ret == noErr )
+ {
+ GetFlavorDataSize( dragRef, itemRef, 'utf8', &itemSize );
+ GetFlavorData( dragRef, itemRef, 'utf8', dst, &itemSize, 0L );
+ dst += itemSize;
+ *dst++ = '\n'; // add our element separator
+ continue;
+ }
+ GetDragItemReferenceNumber( dragRef, i, &itemRef );
+ ret = GetFlavorFlags( dragRef, itemRef, 'utxt', &flags );
+ if ( ret == noErr )
+ {
+ GetFlavorDataSize( dragRef, itemRef, 'utxt', &itemSize );
+ GetFlavorData( dragRef, itemRef, 'utxt', dst, &itemSize, 0L );
+ dst += itemSize;
+ *dst++ = '\n'; // add our element separator
+ continue;
+ }
ret = GetFlavorFlags( dragRef, itemRef, 'TEXT', &flags );
if ( ret == noErr )
{
GetFlavorDataSize( dragRef, itemRef, 'TEXT', &itemSize );
GetFlavorData( dragRef, itemRef, 'TEXT', dst, &itemSize, 0L );
dst += itemSize;
- *dst++ = '\n'; // add our element seperator
+ *dst++ = '\n'; // add our element separator
+ continue;
}
ret = GetFlavorFlags( dragRef, itemRef, 'hfs ', &flags );
if ( ret == noErr )
{
HFSFlavor hfs; itemSize = sizeof( hfs );
GetFlavorData( dragRef, itemRef, 'hfs ', &hfs, &itemSize, 0L );
- itemSize = FSSpec2UnixPath( &hfs.fileSpec, dst );
+ itemSize = FSSpec2UnixPath( &hfs.fileSpec, dst ); // return the path name in UTF8
dst += itemSize;
if ( itemSize>1 && ( hfs.fileType=='fold' || hfs.fileType=='disk' ) )
*dst++ = '/';
- *dst++ = '\n'; // add our element seperator
+ *dst++ = '\n'; // add our element separator
+ continue;
}
}
@@ -1788,7 +2084,24 @@ static pascal OSErr dndReceiveHandler( WindowPtr w, void *userData, DragReferenc
breakMacEventLoop();
return noErr;
}
-
+// fc:
+static void q_set_window_title(Window xid, const char * name ) {
+#if 1
+ CFStringRef utf8_title = CFStringCreateWithCString(NULL, (name ? name : ""), kCFStringEncodingUTF8);
+ SetWindowTitleWithCFString(xid, utf8_title);
+ CFRelease(utf8_title);
+#else // old non-utf8 code to remove after new utf8 code approval :
+ Str255 pTitle;
+ if (name) {
+ if (strlen(name) > 255) pTitle[0] = 255;
+ else pTitle[0] = strlen(name);
+ memcpy(pTitle+1, name, pTitle[0]);
+ }
+ else
+ pTitle[0] = 0;
+ SetWTitle(xid, pTitle);
+#endif
+}
/**
* go ahead, create that (sub)window
@@ -1900,13 +2213,6 @@ void Fl_X::make(Fl_Window* w)
wRect.right = w->x() + w->w(); if (wRect.right<=wRect.left) wRect.right = wRect.left+1;
const char *name = w->label();
- Str255 pTitle;
- if (name) {
- if (strlen(name) > 255) pTitle[0] = 255;
- else pTitle[0] = strlen(name);
-
- memcpy(pTitle+1, name, pTitle[0]);
- } else pTitle[0] = 0;
Fl_X* x = new Fl_X;
x->other_xid = 0; // room for doublebuffering image map. On OS X this is only used by overlay windows
@@ -1919,7 +2225,7 @@ void Fl_X::make(Fl_Window* w)
winattr &= GetAvailableWindowAttributes( winclass ); // make sure that the window will open
CreateNewWindow( winclass, winattr, &wRect, &(x->xid) );
- SetWTitle(x->xid, pTitle);
+ q_set_window_title(x->xid, name);
MoveWindow(x->xid, wRect.left, wRect.top, 1); // avoid Carbon Bug on old OS
if (w->non_modal() && !w->modal()) {
// Major kludge: this is to have the regular look, but stay above the document windows
@@ -1956,6 +2262,7 @@ void Fl_X::make(Fl_Window* w)
{ kEventClassMouse, kEventMouseMoved },
{ kEventClassMouse, kEventMouseDragged } };
ret = InstallWindowEventHandler( x->xid, mouseHandler, 4, mouseEvents, w, 0L );
+
EventHandlerUPP keyboardHandler = NewEventHandlerUPP( carbonKeyboardHandler ); // will not be disposed by Carbon...
static EventTypeSpec keyboardEvents[] = {
{ kEventClassKeyboard, kEventRawKeyDown },
@@ -1963,6 +2270,12 @@ void Fl_X::make(Fl_Window* w)
{ kEventClassKeyboard, kEventRawKeyUp },
{ kEventClassKeyboard, kEventRawKeyModifiersChanged } };
ret = InstallWindowEventHandler( x->xid, keyboardHandler, 4, keyboardEvents, w, 0L );
+
+ EventHandlerUPP textHandler = NewEventHandlerUPP( carbonTextHandler ); // will not be disposed by Carbon...
+ static EventTypeSpec textEvents[] = {
+ { kEventClassTextInput, kEventTextInputUnicodeForKeyEvent } };
+ ret = InstallWindowEventHandler( x->xid, textHandler, 1, textEvents, w, 0L );
+
EventHandlerUPP windowHandler = NewEventHandlerUPP( carbonWindowHandler ); // will not be disposed by Carbon...
static EventTypeSpec windowEvents[] = {
{ kEventClassWindow, kEventWindowDrawContent },
@@ -2056,12 +2369,10 @@ const char *fl_filename_name( const char *name )
*/
void Fl_Window::label(const char *name,const char */*iname*/) {
Fl_Widget::label(name);
- Str255 pTitle;
- if (name) { pTitle[0] = strlen(name); memcpy(pTitle+1, name, pTitle[0]); }
- else pTitle[0] = 0;
-
- if (shown() || i) SetWTitle(fl_xid(this), pTitle);
+ if (shown() || i) {
+ q_set_window_title(fl_xid(this), name);
+ }
}
@@ -2183,17 +2494,25 @@ void Fl_Window::make_current()
fl_gc = i->gc;
CGContextSaveGState(fl_gc);
Fl_X::q_fill_context();
+#if defined(USE_CAIRO) && defined (__APPLE_QUARTZ__)
+ if (Fl::cairo_autolink_context()) Fl::cairo_make_current(this); // capture gc changes automatically to update the cairo context adequately
+#endif
+
#endif
fl_clip_region( 0 );
SetPortClipRegion( GetWindowPort(i->xid), fl_window_region );
- return;
+
+#if defined(__APPLE_QUARTZ__) && defined(USE_CAIRO)
+ // update the cairo_t context
+ if (Fl::cairo_autolink_context()) Fl::cairo_make_current(this);
+#endif
}
// helper function to manage the current CGContext fl_gc
#ifdef __APPLE_QUARTZ__
extern Fl_Color fl_color_;
-extern class Fl_FontSize *fl_fontsize;
-extern void fl_font(class Fl_FontSize*);
+extern class Fl_Font_Descriptor *fl_fontsize;
+extern void fl_font(class Fl_Font_Descriptor*);
extern void fl_quartz_restore_line_style_();
// FLTK has only one global graphics state. This function copies the FLTK state into the
@@ -2234,6 +2553,9 @@ void Fl_X::q_release_context(Fl_X *x) {
fprintf(stderr, "Error %d in QDEndCGContext\n", (int)err);
}
fl_gc = 0;
+#if defined(USE_CAIRO) && defined (__APPLE_QUARTZ__)
+ if (Fl::cairo_autolink_context()) Fl::cairo_make_current((Fl_Window*) 0); // capture gc changes automatically to update the cairo context adequately
+#endif
}
void Fl_X::q_begin_image(CGRect &rect, int cx, int cy, int w, int h) {
@@ -2258,13 +2580,38 @@ void Fl_X::q_end_image() {
#endif
////////////////////////////////////////////////////////////////
-// Cut & paste.
+// Copy & Paste fltk implementation.
+////////////////////////////////////////////////////////////////
+// fltk 1.3 clipboard support constant definitions:
+const CFStringRef flavorNames[] = {
+ CFSTR("public.utf16-plain-text"),
+ CFSTR("public.utf8-plain-text"),
+ CFSTR("com.apple.traditional-mac-plain-text") };
+const CFStringEncoding encodings[] = {
+ kCFStringEncodingUTF16,
+ kCFStringEncodingUTF8,
+ kCFStringEncodingMacRoman};
+const size_t handledFlavorsCount = sizeof(encodings)/sizeof(CFStringEncoding);
+
+// clipboard variables definitions :
Fl_Widget *fl_selection_requestor = 0;
char *fl_selection_buffer[2];
int fl_selection_length[2];
-int fl_selection_buffer_length[2];
+static int fl_selection_buffer_length[2];
+
+#ifdef USE_PASTEBOARD
+static PasteboardRef myPasteboard = 0;
+static void allocatePasteboard() {
+ if (!myPasteboard)
+ PasteboardCreate(kPasteboardClipboard, &myPasteboard);
+}
+#else
+#endif
+
+#ifndef USE_PASTEBOARD
static ScrapRef myScrap = 0;
+#endif
/**
* create a selection
@@ -2283,9 +2630,21 @@ void Fl::copy(const char *stuff, int len, int clipboard) {
fl_selection_buffer[clipboard][len] = 0; // needed for direct paste
fl_selection_length[clipboard] = len;
if (clipboard) {
- ClearCurrentScrap();
- OSStatus ret = GetCurrentScrap( &myScrap );
- if ( ret != noErr ) {
+#ifdef USE_PASTEBOARD
+ // FIXME no error checking done yet!
+ allocatePasteboard();
+ OSStatus err = PasteboardClear(myPasteboard);
+ if (err!=noErr) return; // clear did not work, maybe not owner of clipboard.
+ PasteboardSynchronize(myPasteboard);
+ CFDataRef text = CFDataCreate(kCFAllocatorDefault, (UInt8*)fl_selection_buffer[1], len);
+ if (text==NULL) return; // there was a pb creating the object, abort.
+ err=PasteboardPutItemFlavor(myPasteboard, (PasteboardItemID)1, CFSTR("public.utf8-plain-text"), text, 0);
+ CFRelease(text);
+#else
+ OSStatus err = ClearCurrentScrap(); // whatever happens we should clear the current scrap.
+ if(err!=noErr) {myScrap=0; return;} // don't get current scrap if a prev err occured.
+ err = GetCurrentScrap( &myScrap );
+ if ( err != noErr ) {
myScrap = 0;
return;
}
@@ -2294,38 +2653,92 @@ void Fl::copy(const char *stuff, int len, int clipboard) {
// needed. Check to see if this is necessary on OS/X.
PutScrapFlavor( myScrap, kScrapFlavorTypeText, 0,
len, fl_selection_buffer[1] );
+#endif
}
}
// Call this when a "paste" operation happens:
void Fl::paste(Fl_Widget &receiver, int clipboard) {
- if (clipboard) {
- // see if we own the selection, if not go get it:
- ScrapRef scrap = 0;
- Size len = 0;
- if (GetCurrentScrap(&scrap) == noErr && scrap != myScrap &&
- GetScrapFlavorSize(scrap, kScrapFlavorTypeText, &len) == noErr) {
- if ( len >= fl_selection_buffer_length[1] ) {
- fl_selection_buffer_length[1] = len + 32;
- delete[] fl_selection_buffer[1];
- fl_selection_buffer[1] = new char[len + 32];
- }
- fl_selection_length[1] = len; len++;
- GetScrapFlavorData( scrap, kScrapFlavorTypeText, &len,
- fl_selection_buffer[1] );
- fl_selection_buffer[1][fl_selection_length[1]] = 0;
- // turn all \r characters into \n:
- for (int x = 0; x < len; x++) {
- if (fl_selection_buffer[1][x] == '\r')
- fl_selection_buffer[1][x] = '\n';
- }
+ if (clipboard) {
+ // see if we own the selection, if not go get it:
+ fl_selection_length[1] = 0;
+#ifdef USE_PASTEBOARD
+ OSStatus err = noErr;
+ Boolean found = false;
+ CFDataRef flavorData = NULL;
+ CFStringEncoding encoding = 0;
+
+ allocatePasteboard();
+ PasteboardSynchronize(myPasteboard);
+ ItemCount nFlavor = 0, i, j;
+ err = PasteboardGetItemCount(myPasteboard, &nFlavor);
+ if (err==noErr) {
+ for (i=1; i<=nFlavor; i++) {
+ PasteboardItemID itemID = 0;
+ CFArrayRef flavorTypeArray = NULL;
+ found = false;
+ err = PasteboardGetItemIdentifier(myPasteboard, i, &itemID);
+ if (err!=noErr) continue;
+ err = PasteboardCopyItemFlavors(myPasteboard, itemID, &flavorTypeArray);
+ if (err!=noErr) {
+ if (flavorTypeArray) {CFRelease(flavorTypeArray); flavorTypeArray = NULL;}
+ continue;
+ }
+ CFIndex flavorCount = CFArrayGetCount(flavorTypeArray);
+ for (j = 0; j < handledFlavorsCount; j++) {
+ for (CFIndex flavorIndex=0; flavorIndex= fl_selection_buffer_length[1] ) {
+ fl_selection_buffer_length[1] = len;
+ delete[] fl_selection_buffer[1];
+ fl_selection_buffer[1] = new char[len];
+ }
+ CFStringGetCString(mycfs, fl_selection_buffer[1], len, kCFStringEncodingUTF8);
+ CFRelease(mycfs);
+ len = strlen(fl_selection_buffer[1]);
+ fl_selection_length[1] = len;
+ convert_crlf(fl_selection_buffer[1],len); // turn all \r characters into \n:
+ }
+ }
+#else
+ ScrapRef scrap = 0;
+ if (GetCurrentScrap(&scrap) == noErr && scrap != myScrap &&
+ GetScrapFlavorSize(scrap, kScrapFlavorTypeText, &len) == noErr) {
+ if ( len >= fl_selection_buffer_length[1] ) {
+ fl_selection_buffer_length[1] = len + 32;
+ delete[] fl_selection_buffer[1];
+ fl_selection_buffer[1] = new char[len + 32];
+ }
+ fl_selection_length[1] = len; len++;
+ GetScrapFlavorData( scrap, kScrapFlavorTypeText, &len,
+ fl_selection_buffer[1] );
+ fl_selection_buffer[1][fl_selection_length[1]] = 0;
+ convert_crlf(fl_selection_buffer[1],len);
+ }
+#endif
}
- }
- Fl::e_text = fl_selection_buffer[clipboard];
- Fl::e_length = fl_selection_length[clipboard];
- if (!Fl::e_text) Fl::e_text = (char *)"";
- receiver.handle(FL_PASTE);
- return;
+ Fl::e_text = fl_selection_buffer[clipboard];
+ Fl::e_length = fl_selection_length[clipboard];
+ if (!Fl::e_text) Fl::e_text = (char *)"";
+ receiver.handle(FL_PASTE);
}
void Fl::add_timeout(double time, Fl_Timeout_Handler cb, void* data)
@@ -2465,7 +2878,8 @@ void MacUnmapWindow(Fl_Window *w, WindowPtr p) {
if (w && Fl_X::i(w))
MacUnlinkWindow(Fl_X::i(w));
}
+#endif // FL_DOXYGEN
//
-// End of "$Id: Fl_mac.cxx 6033 2008-02-20 18:17:34Z matt $".
+// End of "$Id: Fl_mac.cxx 6758 2009-04-13 07:32:01Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_own_colormap.cxx b/plugins/zynaddsubfx/fltk/src/Fl_own_colormap.cxx
index b0df4bbd6..17b7bfeeb 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_own_colormap.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_own_colormap.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_own_colormap.cxx 5190 2006-06-09 16:16:34Z mike $"
+// "$Id: Fl_own_colormap.cxx 6616 2009-01-01 21:28:26Z matt $"
//
// Private colormap support for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -37,6 +37,13 @@
#include
#include
+/** \fn Fl::own_colormap()
+ Makes FLTK use its own colormap. This may make FLTK display better
+ and will reduce conflicts with other programs that want lots of colors.
+ However the colors may flash as you move the cursor between windows.
+
+ This does nothing if the current visual is not colormapped.
+*/
#ifdef WIN32
// There is probably something relevant to do on MSWindows 8-bit displays
// but I don't know what it is
@@ -79,5 +86,5 @@ void Fl::own_colormap() {
#endif
//
-// End of "$Id: Fl_own_colormap.cxx 5190 2006-06-09 16:16:34Z mike $".
+// End of "$Id: Fl_own_colormap.cxx 6616 2009-01-01 21:28:26Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_visual.cxx b/plugins/zynaddsubfx/fltk/src/Fl_visual.cxx
index b0c954461..7daf75d3b 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_visual.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_visual.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_visual.cxx 5190 2006-06-09 16:16:34Z mike $"
+// "$Id: Fl_visual.cxx 6616 2009-01-01 21:28:26Z matt $"
//
// Visual support for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -31,6 +31,40 @@
#include
#include
+/** \fn Fl::visual(int flags)
+ Selects a visual so that your graphics are drawn correctly. This is
+ only allowed before you call show() on any windows. This does nothing
+ if the default visual satisfies the capabilities, or if no visual
+ satisfies the capabilities, or on systems that don't have such
+ brain-dead notions.
+
+ Only the following combinations do anything useful:
+
+
+ - Fl::visual(FL_RGB)
+
Full/true color (if there are several depths FLTK chooses the
+ largest). Do this if you use fl_draw_image
+ for much better (non-dithered) output.
+
+ - Fl::visual(FL_RGB8)
+
Full color with at least 24 bits of color. FL_RGB will
+ always pick this if available, but if not it will happily return a
+ less-than-24 bit deep visual. This call fails if 24 bits are not
+ available.
+
+ - Fl::visual(FL_DOUBLE|FL_INDEX)
+
Hardware double buffering. Call this if you are going to use
+ Fl_Double_Window.
+
+ - Fl::visual(FL_DOUBLE|FL_RGB)
+ - Fl::visual(FL_DOUBLE|FL_RGB8)
+
Hardware double buffering and full color.
+
+
+ This returns true if the system has the capabilities by default or
+ FLTK suceeded in turing them on. Your program will still work even if
+ this returns false (it just won't look as good).
+*/
#ifdef WIN32
int Fl::visual(int flags) {
fl_GetDC(0);
@@ -117,5 +151,5 @@ int Fl::visual(int flags) {
#endif
//
-// End of "$Id: Fl_visual.cxx 5190 2006-06-09 16:16:34Z mike $".
+// End of "$Id: Fl_visual.cxx 6616 2009-01-01 21:28:26Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_win32.cxx b/plugins/zynaddsubfx/fltk/src/Fl_win32.cxx
index 78ce234ec..3b9fe186d 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_win32.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_win32.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_win32.cxx 6017 2008-01-10 21:53:34Z matt $"
+// "$Id: Fl_win32.cxx 6668 2009-02-21 10:18:47Z AlbrechtS $"
//
// WIN32-specific code for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2007 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -29,9 +29,12 @@
// in. Search other files for "WIN32" or filenames ending in _win32.cxx
// for other system-specific code.
+#ifndef FL_DOXYGEN
#include
#include
+#include
#include
+#include
#include
#include
#include "flstring.h"
@@ -44,42 +47,148 @@
# include
# include
#else
+# if !defined(USE_WSOCK1)
+# include
+#else
# include
+# endif
+#endif
+#if !defined(USE_WSOCK1)
+# define WSCK_DLL_NAME "WS2_32.DLL"
+#else
+# define WSCK_DLL_NAME "WSOCK32.DLL"
#endif
#include
#include
+#if defined(__GNUC__) && __GNUC__ >= 3
+# include
+#endif
+
// The following include files require GCC 3.x or a non-GNU compiler...
#if !defined(__GNUC__) || __GNUC__ >= 3
# include
# include
#endif // !__GNUC__ || __GNUC__ >= 3
+#include "aimm.h"
//
// USE_ASYNC_SELECT - define it if you have WSAAsyncSelect()...
+// USE_ASYNC_SELECT is OBSOLETED in 1.3 for the following reasons:
+/*
+ This feature was supposed to provide an efficient alternative to the current
+ polling method, but as it has been discussed (Thanks Albrecht!) :
+ - the async mode would imply to change the socket to non blocking mode.
+ This can have unexpected side effects for 3rd party apps, especially
+ if it is set on-the-fly when socket service is really needed, as it is
+ done today and on purpose, but still the 3rd party developer wouldn't easily
+ control the sequencing of socket operations.
+ - Finer granularity of events furthered by the async select is a plus only
+ for socket 3rd party impl., it is simply not needed for the 'light' fltk
+ use we make of wsock, so here it would also be a bad point, because of all
+ the logic add-ons necessary for using this functionality, without a clear
+ benefit.
+
+ So async mode select would not add benefits to fltk, worse, it can slowdown
+ fltk because of this finer granularity and instrumentation code to be added
+ for async mode proper operation, not mentioning the side effects...
+*/
+
+// dynamic wsock dll handling api:
+#if defined(__CYGWIN__) && !defined(SOCKET)
+# define SOCKET int
+#endif
+typedef int (WINAPI* fl_wsk_select_f)(int, fd_set*, fd_set*, fd_set*, const struct timeval*);
+typedef int (WINAPI* fl_wsk_fd_is_set_f)(SOCKET, fd_set *);
+typedef int (WINAPI* fl_wsk_async_select_f)(SOCKET,HWND,u_int,long);
+static HMODULE s_wsock_mod = 0;
+static fl_wsk_select_f s_wsock_select=0;
+static fl_wsk_fd_is_set_f fl_wsk_fd_is_set=0;
+static fl_wsk_async_select_f fl_wsk_async_select=0;
+
+static HMODULE get_wsock_mod() {
+ if (!s_wsock_mod) {
+ s_wsock_mod = LoadLibrary(WSCK_DLL_NAME);
+ if (s_wsock_mod==NULL)
+ Fl::fatal("FLTK Lib Error: %s file not found! Please check your winsock dll accessibility.\n",WSCK_DLL_NAME);
+ s_wsock_select = (fl_wsk_select_f) GetProcAddress(s_wsock_mod, "select");
+ fl_wsk_fd_is_set = (fl_wsk_fd_is_set_f) GetProcAddress(s_wsock_mod, "__WSAFDIsSet");
+ fl_wsk_async_select = (fl_wsk_async_select_f) GetProcAddress(s_wsock_mod, "WSAAsyncSelect");
+ }
+ return s_wsock_mod;
+}
+
+/*
+ * Dynamic linking of imm32.dll
+ * This library is only needed for a hand full (four ATM) functions relating to
+ * international text rendering and locales. Dynamically loading reduces initial
+ * size and link dependencies.
+ */
+static HMODULE s_imm_module = 0;
+typedef HIMC (WINAPI* flTypeImmGetContext)(HWND);
+static flTypeImmGetContext flImmGetContext = 0;
+typedef BOOL (WINAPI* flTypeImmSetCompositionWindow)(HIMC, LPCOMPOSITIONFORM);
+static flTypeImmSetCompositionWindow flImmSetCompositionWindow = 0;
+typedef BOOL (WINAPI* flTypeImmReleaseContext)(HWND, HIMC);
+static flTypeImmReleaseContext flImmReleaseContext = 0;
+typedef BOOL (WINAPI* flTypeImmIsIME)(HKL);
+static flTypeImmIsIME flImmIsIME = 0;
+
+static HMODULE get_imm_module() {
+ if (!s_imm_module) {
+ s_imm_module = LoadLibrary("IMM32.DLL");
+ if (!s_imm_module)
+ Fl::fatal("FLTK Lib Error: IMM32.DLL file not found!\n\n"
+ "Please check your input method manager library accessibility.");
+ flImmGetContext = (flTypeImmGetContext)GetProcAddress(s_imm_module, "ImmGetContext");
+ flImmSetCompositionWindow = (flTypeImmSetCompositionWindow)GetProcAddress(s_imm_module, "ImmSetCompositionWindow");
+ flImmReleaseContext = (flTypeImmReleaseContext)GetProcAddress(s_imm_module, "ImmReleaseContext");
+ flImmIsIME = (flTypeImmIsIME)GetProcAddress(s_imm_module, "ImmIsIME");
+ }
+ return s_imm_module;
+}
+
+// USE_TRACK_MOUSE - define NO_TRACK_MOUSE if you don't have
+// TrackMouseEvent()...
//
-// This currently doesn't appear to work; needs to be fixed!
+// Now (Dec. 2008) we can assume that current Cygwin/MinGW versions
+// support the TrackMouseEvent() function, but WinCE obviously doesn't
+// support it (STR 2095). Therefore, USE_TRACK_MOUSE is enabled by
+// default, but you can disable it by defining NO_TRACK_MOUSE.
//
-
-//#define USE_ASYNC_SELECT
-
-
-//
-// USE_TRACK_MOUSE - define it if you have TrackMouseEvent()...
-//
-// Apparently, at least some versions of Cygwin/MingW don't provide
-// the TrackMouseEvent() function. You can define this by hand
-// if you have it - this is only needed to support subwindow
-// enter/leave notification under Windows.
+// TrackMouseEvent is only used to support window leave notifications
+// under Windows. It can be used to get FL_LEAVE events, when the
+// mouse leaves the _main_ application window (FLTK detects subwindow
+// leave events by using normal move events).
//
+// Implementation note: If the mouse cursor leaves one subwindow and
+// enters another window, then Windows sends a WM_MOUSEMOVE message to
+// the new window before it sends a WM_MOUSELEAVE message to the old
+// (just left) window. We save the current mouse window in a static variable,
+// and if we get a WM_MOUSELEAVE event for the current mouse window, this
+// means that the top level window has been left (otherwise we would have
+// got another WM_MOUSEMOVE message before).
-//#define USE_TRACK_MOUSE
+// #define NO_TRACK_MOUSE
-#if !defined(__GNUC__)
-# define USE_TRACK_MOUSE
-#endif // !__GNUC__
+#if !defined(NO_TRACK_MOUSE)
+# define USE_TRACK_MOUSE
+#endif // NO_TRACK_MOUSE
+static Fl_Window *track_mouse_win=0; // current TrackMouseEvent() window
+
+// USE_CAPTURE_MOUSE_WIN - this must be defined for TrackMouseEvent to work
+// correctly with subwindows - otherwise a single mouse click and release
+// (without a move) would generate phantom leave events.
+// This defines, if the current mouse window (maybe a subwindow) or the
+// main window should get mouse events after pushing (and holding) a mouse
+// button, i.e. when dragging the mouse. This is done by calling SetCapture
+// (see below).
+
+#ifdef USE_TRACK_MOUSE
+#define USE_CAPTURE_MOUSE_WIN
+#endif // USE_TRACK_MOUSE
//
// WM_SYNCPAINT is an "undocumented" message, which is finally defined in
@@ -122,13 +231,11 @@
// select function that sends a WIN32 message when the select condition
// exists...
static int maxfd = 0;
-#ifndef USE_ASYNC_SELECT
static fd_set fdsets[3];
-#endif // !USE_ASYNC_SELECT
-#define POLLIN 1
-#define POLLOUT 4
-#define POLLERR 8
+# define POLLIN 1
+# define POLLOUT 4
+# define POLLERR 8
#if !defined(__GNUC__) || __GNUC__ >= 3
extern IDropTarget *flIDropTarget;
@@ -143,6 +250,36 @@ static struct FD {
void* arg;
} *fd = 0;
+extern unsigned int fl_codepage;
+
+void fl_reset_spot()
+{
+}
+
+void fl_set_spot(int font, int size, int X, int Y, int W, int H, Fl_Window *win)
+{
+ if (!win) return;
+ Fl_Window* tw = win;
+ while (tw->parent()) tw = tw->window(); // find top level window
+
+ get_imm_module();
+ HIMC himc = flImmGetContext(fl_xid(tw));
+
+ if (himc) {
+ COMPOSITIONFORM cfs;
+ cfs.dwStyle = CFS_POINT;
+ cfs.ptCurrentPos.x = X;
+ cfs.ptCurrentPos.y = Y - tw->labelsize();
+ MapWindowPoints(fl_xid(win), fl_xid(tw), &cfs.ptCurrentPos, 1);
+ flImmSetCompositionWindow(himc, &cfs);
+ flImmReleaseContext(fl_xid(tw), himc);
+ }
+}
+
+void fl_set_status(int x, int y, int w, int h)
+{
+}
+
void Fl::add_fd(int n, int events, void (*cb)(int, void*), void *v) {
remove_fd(n,events);
int i = nfds++;
@@ -155,18 +292,10 @@ void Fl::add_fd(int n, int events, void (*cb)(int, void*), void *v) {
fd[i].cb = cb;
fd[i].arg = v;
-#ifdef USE_ASYNC_SELECT
- int mask = 0;
- if (events & POLLIN) mask |= FD_READ;
- if (events & POLLOUT) mask |= FD_WRITE;
- if (events & POLLERR) mask |= FD_CLOSE;
- WSAAsyncSelect(n, fl_window, WM_FLSELECT, mask);
-#else
if (events & POLLIN) FD_SET((unsigned)n, &fdsets[0]);
if (events & POLLOUT) FD_SET((unsigned)n, &fdsets[1]);
if (events & POLLERR) FD_SET((unsigned)n, &fdsets[2]);
if (n > maxfd) maxfd = n;
-#endif // USE_ASYNC_SELECT
}
void Fl::add_fd(int fd, void (*cb)(int, void*), void* v) {
@@ -189,13 +318,9 @@ void Fl::remove_fd(int n, int events) {
}
nfds = j;
-#ifdef USE_ASYNC_SELECT
- WSAAsyncSelect(n, 0, 0, 0);
-#else
if (events & POLLIN) FD_CLR(unsigned(n), &fdsets[0]);
if (events & POLLOUT) FD_CLR(unsigned(n), &fdsets[1]);
if (events & POLLERR) FD_CLR(unsigned(n), &fdsets[2]);
-#endif // USE_ASYNC_SELECT
}
void Fl::remove_fd(int n) {
@@ -214,6 +339,7 @@ void* Fl::thread_message() {
return r;
}
+IActiveIMMApp *fl_aimm = NULL;
MSG fl_msg;
// This is never called with time_to_wait < 0.0.
@@ -234,7 +360,6 @@ int fl_wait(double time_to_wait) {
in_idle = 0;
}
-#ifndef USE_ASYNC_SELECT
if (nfds) {
// For WIN32 we need to poll for socket input FIRST, since
// the event queue is not something we can select() on...
@@ -243,17 +368,15 @@ int fl_wait(double time_to_wait) {
t.tv_usec = 0;
fd_set fdt[3];
- fdt[0] = fdsets[0];
- fdt[1] = fdsets[1];
- fdt[2] = fdsets[2];
- if (::select(maxfd+1,&fdt[0],&fdt[1],&fdt[2],&t)) {
+ memcpy(fdt, fdsets, sizeof fdt); // one shot faster fdt init
+ if (get_wsock_mod()&& s_wsock_select(maxfd+1,&fdt[0],&fdt[1],&fdt[2],&t)) {
// We got something - do the callback!
for (int i = 0; i < nfds; i ++) {
- int f = fd[i].fd;
+ SOCKET f = fd[i].fd;
short revents = 0;
- if (FD_ISSET(f,&fdt[0])) revents |= POLLIN;
- if (FD_ISSET(f,&fdt[1])) revents |= POLLOUT;
- if (FD_ISSET(f,&fdt[2])) revents |= POLLERR;
+ if (fl_wsk_fd_is_set(f, &fdt[0])) revents |= POLLIN;
+ if (fl_wsk_fd_is_set(f, &fdt[1])) revents |= POLLOUT;
+ if (fl_wsk_fd_is_set(f, &fdt[2])) revents |= POLLERR;
if (fd[i].events & revents) fd[i].cb(f, fd[i].arg);
}
time_to_wait = 0.0; // just peek for any messages
@@ -262,13 +385,12 @@ int fl_wait(double time_to_wait) {
if (time_to_wait > .001) time_to_wait = .001;
}
}
-#endif // USE_ASYNC_SELECT
if (Fl::idle || Fl::damage())
time_to_wait = 0.0;
// if there are no more windows and this timer is set
- // to FOREVER, continue through or look up indefinetely
+ // to FOREVER, continue through or look up indefinitely
if (!Fl::first_window() && time_to_wait==1e20)
time_to_wait = 0.0;
@@ -281,21 +403,10 @@ int fl_wait(double time_to_wait) {
fl_lock_function();
// Execute the message we got, and all other pending messages:
- have_message = PeekMessage(&fl_msg, NULL, 0, 0, PM_REMOVE);
+ // have_message = PeekMessage(&fl_msg, NULL, 0, 0, PM_REMOVE);
+ have_message = PeekMessageW(&fl_msg, NULL, 0, 0, PM_REMOVE);
if (have_message > 0) {
while (have_message != 0 && have_message != -1) {
-#ifdef USE_ASYNC_SELECT
- if (fl_msg.message == WM_FLSELECT) {
- // Got notification for socket
- for (int i = 0; i < nfds; i ++)
- if (fd[i].fd == (int)fl_msg.wParam) {
- (fd[i].cb)(fd[i].fd, fd[i].arg);
- break;
- }
- // looks like it is best to do the dispatch-message anyway:
- }
-#endif
-
if (fl_msg.message == fl_wake_msg) {
// Used for awaking wait() from another thread
thread_message_ = (void*)fl_msg.wParam;
@@ -307,8 +418,8 @@ int fl_wait(double time_to_wait) {
}
TranslateMessage(&fl_msg);
- DispatchMessage(&fl_msg);
- have_message = PeekMessage(&fl_msg, NULL, 0, 0, PM_REMOVE);
+ DispatchMessageW(&fl_msg);
+ have_message = PeekMessageW(&fl_msg, NULL, 0, 0, PM_REMOVE);
}
}
Fl::flush();
@@ -320,18 +431,13 @@ int fl_wait(double time_to_wait) {
// fl_ready() is just like fl_wait(0.0) except no callbacks are done:
int fl_ready() {
if (PeekMessage(&fl_msg, NULL, 0, 0, PM_NOREMOVE)) return 1;
-#ifdef USE_ASYNC_SELECT
- return 0;
-#else
+ if (!nfds) return 0;
timeval t;
t.tv_sec = 0;
t.tv_usec = 0;
fd_set fdt[3];
- fdt[0] = fdsets[0];
- fdt[1] = fdsets[1];
- fdt[2] = fdsets[2];
- return ::select(0,&fdt[0],&fdt[1],&fdt[2],&t);
-#endif // USE_ASYNC_SELECT
+ memcpy(fdt, fdsets, sizeof fdt);
+ return get_wsock_mod() ? s_wsock_select(0,&fdt[0],&fdt[1],&fdt[2],&t) : 0;
}
////////////////////////////////////////////////////////////////
@@ -383,6 +489,13 @@ int fl_selection_length[2];
int fl_selection_buffer_length[2];
char fl_i_own_selection[2];
+UINT fl_get_lcid_codepage(LCID id)
+{
+ char buf[8];
+ buf[GetLocaleInfo(id, LOCALE_IDEFAULTANSICODEPAGE, buf, 8)] = 0;
+ return atol(buf);
+}
+
// Convert \n -> \r\n
class Lf2CrlfConvert {
char *out;
@@ -441,11 +554,17 @@ void Fl::copy(const char *stuff, int len, int clipboard) {
fl_selection_length[clipboard] = len;
if (clipboard) {
// set up for "delayed rendering":
- if (OpenClipboard(fl_xid(Fl::first_window()))) {
+ if (OpenClipboard(NULL)) {
// if the system clipboard works, use it
+ int utf16_len = fl_utf8toUtf16(fl_selection_buffer[clipboard], fl_selection_length[clipboard], 0, 0);
EmptyClipboard();
- SetClipboardData(CF_TEXT, NULL);
+ HGLOBAL hMem = GlobalAlloc(GHND, utf16_len * 2 + 2); // moveable and zero'ed mem alloc.
+ LPVOID memLock = GlobalLock(hMem);
+ fl_utf8toUtf16(fl_selection_buffer[clipboard], fl_selection_length[clipboard], (unsigned short*) memLock, utf16_len * 2);
+ GlobalUnlock(hMem);
+ SetClipboardData(CF_UNICODETEXT, hMem);
CloseClipboard();
+ GlobalFree(hMem);
fl_i_own_selection[clipboard] = 0;
} else {
// only if it fails, instruct paste() to use the internal buffers
@@ -480,30 +599,53 @@ void Fl::paste(Fl_Widget &receiver, int clipboard) {
Fl::e_text = 0;
} else {
if (!OpenClipboard(NULL)) return;
- HANDLE h = GetClipboardData(CF_TEXT);
+ HANDLE h = GetClipboardData(CF_UNICODETEXT);
if (h) {
- Fl::e_text = (LPSTR)GlobalLock(h);
+ wchar_t *memLock = (wchar_t*) GlobalLock(h);
+ int utf16_len = wcslen(memLock);
+ Fl::e_text = (char*) malloc (utf16_len * 4 + 1);
+ int utf8_len = fl_utf8fromwc(Fl::e_text, utf16_len * 4, memLock, utf16_len);
+ *(Fl::e_text + utf8_len) = 0;
LPSTR a,b;
a = b = Fl::e_text;
while (*a) { // strip the CRLF pairs ($%$#@^)
- if (*a == '\r' && a[1] == '\n') a++;
- else *b++ = *a++;
+ if (*a == '\r' && a[1] == '\n') a++;
+ else *b++ = *a++;
}
*b = 0;
Fl::e_length = b - Fl::e_text;
receiver.handle(FL_PASTE);
GlobalUnlock(h);
+ free(Fl::e_text);
+ Fl::e_text = 0;
}
CloseClipboard();
}
}
////////////////////////////////////////////////////////////////
+char fl_is_ime = 0;
+void fl_get_codepage()
+{
+ HKL hkl = GetKeyboardLayout(0);
+ TCHAR ld[8];
+
+ GetLocaleInfo (LOWORD(hkl), LOCALE_IDEFAULTANSICODEPAGE, ld, 6);
+ DWORD ccp = atol(ld);
+ fl_is_ime = 0;
+
+ fl_codepage = ccp;
+ if (fl_aimm) {
+ fl_aimm->GetCodePageA(GetKeyboardLayout(0), &fl_codepage);
+ } else if (get_imm_module() && flImmIsIME(hkl)) {
+ fl_is_ime = 1;
+ }
+}
HWND fl_capture;
static int mouse_event(Fl_Window *window, int what, int button,
- WPARAM wParam, LPARAM lParam)
+ WPARAM wParam, LPARAM lParam)
{
static int px, py, pmx, pmy;
POINT pt;
@@ -512,6 +654,9 @@ static int mouse_event(Fl_Window *window, int what, int button,
ClientToScreen(fl_xid(window), &pt);
Fl::e_x_root = pt.x;
Fl::e_y_root = pt.y;
+#ifdef USE_CAPTURE_MOUSE_WIN
+ Fl_Window *mouse_window = window; // save "mouse window"
+#endif
while (window->parent()) {
Fl::e_x += window->x();
Fl::e_y += window->y();
@@ -535,7 +680,11 @@ static int mouse_event(Fl_Window *window, int what, int button,
case 0: // single-click
Fl::e_clicks = 0;
J1:
- if (!fl_capture) SetCapture(fl_xid(window));
+#ifdef USE_CAPTURE_MOUSE_WIN
+ if (!fl_capture) SetCapture(fl_xid(mouse_window)); // use mouse window
+#else
+ if (!fl_capture) SetCapture(fl_xid(window)); // use main window
+#endif
Fl::e_keysym = FL_Button + button;
Fl::e_is_click = 1;
px = pmx = Fl::e_x_root; py = pmy = Fl::e_y_root;
@@ -633,9 +782,9 @@ extern HPALETTE fl_select_palette(void); // in fl_color_win32.cxx
struct Win32Timer
{
- UINT_PTR handle;
- Fl_Timeout_Handler callback;
- void *data;
+ UINT_PTR handle;
+ Fl_Timeout_Handler callback;
+ void *data;
};
static Win32Timer* win32_timers;
static int win32_timer_alloc;
@@ -644,22 +793,22 @@ static HWND s_TimerWnd;
static void realloc_timers()
{
- if (win32_timer_alloc == 0) {
- win32_timer_alloc = 8;
- }
- win32_timer_alloc *= 2;
- Win32Timer* new_timers = new Win32Timer[win32_timer_alloc];
- memset(new_timers, 0, sizeof(Win32Timer) * win32_timer_used);
- memcpy(new_timers, win32_timers, sizeof(Win32Timer) * win32_timer_used);
- Win32Timer* delete_me = win32_timers;
- win32_timers = new_timers;
- delete [] delete_me;
+ if (win32_timer_alloc == 0) {
+ win32_timer_alloc = 8;
+ }
+ win32_timer_alloc *= 2;
+ Win32Timer* new_timers = new Win32Timer[win32_timer_alloc];
+ memset(new_timers, 0, sizeof(Win32Timer) * win32_timer_used);
+ memcpy(new_timers, win32_timers, sizeof(Win32Timer) * win32_timer_used);
+ Win32Timer* delete_me = win32_timers;
+ win32_timers = new_timers;
+ delete [] delete_me;
}
static void delete_timer(Win32Timer& t)
{
- KillTimer(s_TimerWnd, t.handle);
- memset(&t, 0, sizeof(Win32Timer));
+ KillTimer(s_TimerWnd, t.handle);
+ memset(&t, 0, sizeof(Win32Timer));
}
/// END TIMERS
@@ -755,20 +904,26 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPar
case WM_MOUSEMOVE:
#ifdef USE_TRACK_MOUSE
- if (Fl::belowmouse() != window) {
+ if (track_mouse_win != window) {
TRACKMOUSEEVENT tme;
tme.cbSize = sizeof(TRACKMOUSEEVENT);
tme.dwFlags = TME_LEAVE;
tme.hwndTrack = hWnd;
_TrackMouseEvent(&tme);
+ track_mouse_win = window;
}
#endif // USE_TRACK_MOUSE
mouse_event(window, 3, 0, wParam, lParam);
return 0;
case WM_MOUSELEAVE:
- Fl::belowmouse(0);
- if (!window->parent()) Fl::handle(FL_LEAVE, window);
+ if (track_mouse_win == window) { // we left the top level window !
+ Fl_Window *tw = window;
+ while (tw->parent()) tw = tw->window(); // find top level window
+ Fl::belowmouse(0);
+ Fl::handle(FL_LEAVE, tw);
+ }
+ track_mouse_win = 0; // force TrackMouseEvent() restart
break;
case WM_SETFOCUS:
@@ -807,6 +962,19 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPar
}
break;
+ case WM_INPUTLANGCHANGE:
+ fl_get_codepage();
+ break;
+ case WM_IME_COMPOSITION:
+// if (!fl_is_nt4() && lParam & GCS_RESULTCLAUSE) {
+// HIMC himc = ImmGetContext(hWnd);
+// wlen = ImmGetCompositionStringW(himc, GCS_RESULTSTR,
+// wbuf, sizeof(wbuf)) / sizeof(short);
+// if (wlen < 0) wlen = 0;
+// wbuf[wlen] = 0;
+// ImmReleaseContext(hWnd, himc);
+// }
+ break;
case WM_KEYDOWN:
case WM_SYSKEYDOWN:
case WM_KEYUP:
@@ -814,7 +982,8 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPar
// save the keysym until we figure out the characters:
Fl::e_keysym = Fl::e_original_keysym = ms2fltk(wParam,lParam&(1<<24));
// See if TranslateMessage turned it into a WM_*CHAR message:
- if (PeekMessage(&fl_msg, hWnd, WM_CHAR, WM_SYSDEADCHAR, PM_REMOVE)) {
+ if (PeekMessageW(&fl_msg, hWnd, WM_CHAR, WM_SYSDEADCHAR, PM_REMOVE))
+ {
uMsg = fl_msg.message;
wParam = fl_msg.wParam;
lParam = fl_msg.lParam;
@@ -841,10 +1010,15 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPar
}
if (GetKeyState(VK_SCROLL)) state |= FL_SCROLL_LOCK;
Fl::e_state = state;
- static char buffer[2];
+ static char buffer[1024];
if (uMsg == WM_CHAR || uMsg == WM_SYSCHAR) {
- buffer[0] = char(wParam);
- Fl::e_length = 1;
+
+ xchar u = (xchar) wParam;
+// Fl::e_length = fl_unicode2utf(&u, 1, buffer);
+ Fl::e_length = fl_utf8fromwc(buffer, 1024, &u, 1);
+ buffer[Fl::e_length] = 0;
+
+
} else if (Fl::e_keysym >= FL_KP && Fl::e_keysym <= FL_KP_Last) {
if (state & FL_NUM_LOCK) {
// Convert to regular keypress...
@@ -980,14 +1154,20 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPar
OpenClipboard(NULL);
// fall through...
case WM_RENDERFORMAT: {
- HANDLE h = GlobalAlloc(GHND, fl_selection_length[1]+1);
+ HANDLE h;
+
+// int l = fl_utf_nb_char((unsigned char*)fl_selection_buffer[1], fl_selection_length[1]);
+ int l = fl_utf8toUtf16(fl_selection_buffer[1], fl_selection_length[1], NULL, 0); // Pass NULL buffer to query length required
+ h = GlobalAlloc(GHND, (l+1) * sizeof(unsigned short));
if (h) {
- LPSTR p = (LPSTR)GlobalLock(h);
- memcpy(p, fl_selection_buffer[1], fl_selection_length[1]);
- p[fl_selection_length[1]] = 0;
+ unsigned short *g = (unsigned short*) GlobalLock(h);
+// fl_utf2unicode((unsigned char *)fl_selection_buffer[1], fl_selection_length[1], (xchar*)g);
+ l = fl_utf8toUtf16(fl_selection_buffer[1], fl_selection_length[1], g, (l+1));
+ g[l] = 0;
GlobalUnlock(h);
- SetClipboardData(CF_TEXT, h);
+ SetClipboardData(CF_UNICODETEXT, h);
}
+
// Windoze also seems unhappy if I don't do this. Documentation very
// unclear on what is correct:
if (fl_msg.message == WM_RENDERALLFORMATS) CloseClipboard();
@@ -998,7 +1178,8 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPar
break;
}
- return DefWindowProc(hWnd, uMsg, wParam, lParam);
+
+ return DefWindowProcW(hWnd, uMsg, wParam, lParam);
}
////////////////////////////////////////////////////////////////
@@ -1154,7 +1335,7 @@ void Fl_Window::resize(int X,int Y,int W,int H) {
/*
* This silly little class remembers the name of all window classes
* we register to avoid double registration. It has the added bonus
- * of freeing everything on application colse as well.
+ * of freeing everything on application close as well.
*/
class NameList {
public:
@@ -1211,30 +1392,42 @@ Fl_X* Fl_X::make(Fl_Window* w) {
first_class_name = class_name;
}
+ const wchar_t* class_namew = L"FLTK";
+ const wchar_t* message_namew = L"FLTK::ThreadWakeup";
if (!class_name_list.has_name(class_name)) {
WNDCLASSEX wc;
+ WNDCLASSEXW wcw;
+
memset(&wc, 0, sizeof(wc));
wc.cbSize = sizeof(WNDCLASSEX);
+ memset(&wcw, 0, sizeof(wcw));
+ wcw.cbSize = sizeof(WNDCLASSEXW);
+
// Documentation states a device context consumes about 800 bytes
// of memory... so who cares? If 800 bytes per window is what it
// takes to speed things up, I'm game.
//wc.style = CS_HREDRAW | CS_VREDRAW | CS_CLASSDC | CS_DBLCLKS;
- wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC | CS_DBLCLKS;
- wc.lpfnWndProc = (WNDPROC)WndProc;
- wc.hInstance = fl_display;
+ wcw.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC | CS_DBLCLKS;
+ wcw.lpfnWndProc = (WNDPROC)WndProc;
+ wcw.cbClsExtra = wcw.cbWndExtra = 0;
+ wcw.hInstance = fl_display;
if (!w->icon())
w->icon((void *)LoadIcon(NULL, IDI_APPLICATION));
- wc.hIcon = wc.hIconSm = (HICON)w->icon();
- wc.hCursor = fl_default_cursor = LoadCursor(NULL, IDC_ARROW);
+ wcw.hIcon = wcw.hIconSm = (HICON)w->icon();
+ wcw.hCursor = fl_default_cursor = LoadCursor(NULL, IDC_ARROW);
//uchar r,g,b; Fl::get_color(FL_GRAY,r,g,b);
//wc.hbrBackground = (HBRUSH)CreateSolidBrush(RGB(r,g,b));
- wc.lpszClassName = class_name;
- RegisterClassEx(&wc);
- class_name_list.add_name(class_name);
+ wcw.hbrBackground = NULL;
+ wcw.lpszMenuName = NULL;
+ wcw.lpszClassName = class_namew;
+ wcw.cbSize = sizeof(WNDCLASSEXW);
+ RegisterClassExW(&wcw);
+ class_name_list.add_name((const char *)class_namew);
}
- const char* message_name = "FLTK::ThreadWakeup";
- if (!fl_wake_msg) fl_wake_msg = RegisterWindowMessage(message_name);
+ // const char* message_name = "FLTK::ThreadWakeup";
+ // if (!fl_wake_msg) fl_wake_msg = RegisterWindowMessage(message_name);
+ if (!fl_wake_msg) fl_wake_msg = RegisterWindowMessageW(message_namew);
HWND parent;
DWORD style = WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
@@ -1308,15 +1501,31 @@ Fl_X* Fl_X::make(Fl_Window* w) {
x->region = 0;
x->private_dc = 0;
x->cursor = fl_default_cursor;
- x->xid = CreateWindowEx(
+ if (!fl_codepage) fl_get_codepage();
+
+ WCHAR *lab = NULL;
+ if (w->label()) {
+ int l = strlen(w->label());
+// lab = (WCHAR*) malloc((l + 1) * sizeof(short));
+// l = fl_utf2unicode((unsigned char*)w->label(), l, (xchar*)lab);
+// lab[l] = 0;
+ unsigned wlen = fl_utf8toUtf16(w->label(), l, NULL, 0); // Pass NULL to query length
+ wlen++;
+ lab = (WCHAR *) malloc(sizeof(WCHAR)*wlen);
+ wlen = fl_utf8toUtf16(w->label(), l, (unsigned short*)lab, wlen);
+ lab[wlen] = 0;
+ }
+ x->xid = CreateWindowExW(
styleEx,
- class_name, w->label(), style,
+ class_namew, lab, style,
xp, yp, wp, hp,
parent,
NULL, // menu
fl_display,
NULL // creation parameters
- );
+ );
+ if (lab) free(lab);
+
x->next = Fl_X::first;
Fl_X::first = x;
@@ -1341,6 +1550,16 @@ Fl_X* Fl_X::make(Fl_Window* w) {
if (!oleInitialized) { OleInitialize(0L); oleInitialized=1; }
RegisterDragDrop(x->xid, flIDropTarget);
+ if (!fl_aimm) {
+ static char been_here = 0;
+ if (!been_here && !oleInitialized) CoInitialize(NULL);
+ been_here = 1;
+ CoCreateInstance(CLSID_CActiveIMM, NULL, CLSCTX_INPROC_SERVER,
+ IID_IActiveIMMApp, (void**) &fl_aimm);
+ if (fl_aimm) {
+ fl_aimm->Activate(TRUE);
+ }
+ }
#endif // !__GNUC__ || __GNUC__ >= 3
if (w->modal()) {Fl::modal_ = w; fl_fix_focus();}
@@ -1358,104 +1577,104 @@ Fl_X* Fl_X::make(Fl_Window* w) {
static LRESULT CALLBACK s_TimerProc(HWND hwnd, UINT msg,
WPARAM wParam, LPARAM lParam)
{
- switch (msg) {
- case WM_TIMER:
- {
- unsigned int id = wParam - 1;
- if (id < (unsigned int)win32_timer_used && win32_timers[id].handle) {
- Fl_Timeout_Handler cb = win32_timers[id].callback;
- void* data = win32_timers[id].data;
- delete_timer(win32_timers[id]);
- if (cb) {
- (*cb)(data);
- }
- }
+ switch (msg) {
+ case WM_TIMER:
+ {
+ unsigned int id = wParam - 1;
+ if (id < (unsigned int)win32_timer_used && win32_timers[id].handle) {
+ Fl_Timeout_Handler cb = win32_timers[id].callback;
+ void* data = win32_timers[id].data;
+ delete_timer(win32_timers[id]);
+ if (cb) {
+ (*cb)(data);
}
- return 0;
-
- default:
- break;
+ }
}
+ return 0;
- return DefWindowProc(hwnd, msg, wParam, lParam);
+ default:
+ break;
+ }
+
+ return DefWindowProc(hwnd, msg, wParam, lParam);
}
void Fl::add_timeout(double time, Fl_Timeout_Handler cb, void* data)
{
- repeat_timeout(time, cb, data);
+ repeat_timeout(time, cb, data);
}
void Fl::repeat_timeout(double time, Fl_Timeout_Handler cb, void* data)
{
- int timer_id = -1;
- for (int i = 0; i < win32_timer_used; ++i) {
- if ( !win32_timers[i].handle ) {
- timer_id = i;
- break;
- }
+ int timer_id = -1;
+ for (int i = 0; i < win32_timer_used; ++i) {
+ if ( !win32_timers[i].handle ) {
+ timer_id = i;
+ break;
}
- if (timer_id == -1) {
- if (win32_timer_used == win32_timer_alloc) {
- realloc_timers();
- }
- timer_id = win32_timer_used++;
+ }
+ if (timer_id == -1) {
+ if (win32_timer_used == win32_timer_alloc) {
+ realloc_timers();
}
- unsigned int elapsed = (unsigned int)(time * 1000);
+ timer_id = win32_timer_used++;
+ }
+ unsigned int elapsed = (unsigned int)(time * 1000);
- if ( !s_TimerWnd ) {
- const char* timer_class = "FLTimer";
- WNDCLASSEX wc;
- memset(&wc, 0, sizeof(wc));
- wc.cbSize = sizeof (wc);
- wc.style = CS_CLASSDC;
- wc.lpfnWndProc = (WNDPROC)s_TimerProc;
- wc.hInstance = fl_display;
- wc.lpszClassName = timer_class;
- /*ATOM atom =*/ RegisterClassEx(&wc);
- // create a zero size window to handle timer events
- s_TimerWnd = CreateWindowEx(WS_EX_LEFT | WS_EX_TOOLWINDOW,
- timer_class, "",
- WS_POPUP,
- 0, 0, 0, 0,
- NULL, NULL, fl_display, NULL);
- // just in case this OS won't let us create a 0x0 size window:
- if (!s_TimerWnd)
- s_TimerWnd = CreateWindowEx(WS_EX_LEFT | WS_EX_TOOLWINDOW,
- timer_class, "",
- WS_POPUP,
- 0, 0, 1, 1,
- NULL, NULL, fl_display, NULL);
- ShowWindow(s_TimerWnd, SW_SHOWNOACTIVATE);
- }
+ if ( !s_TimerWnd ) {
+ const char* timer_class = "FLTimer";
+ WNDCLASSEX wc;
+ memset(&wc, 0, sizeof(wc));
+ wc.cbSize = sizeof (wc);
+ wc.style = CS_CLASSDC;
+ wc.lpfnWndProc = (WNDPROC)s_TimerProc;
+ wc.hInstance = fl_display;
+ wc.lpszClassName = timer_class;
+ /*ATOM atom =*/ RegisterClassEx(&wc);
+ // create a zero size window to handle timer events
+ s_TimerWnd = CreateWindowEx(WS_EX_LEFT | WS_EX_TOOLWINDOW,
+ timer_class, "",
+ WS_POPUP,
+ 0, 0, 0, 0,
+ NULL, NULL, fl_display, NULL);
+ // just in case this OS won't let us create a 0x0 size window:
+ if (!s_TimerWnd)
+ s_TimerWnd = CreateWindowEx(WS_EX_LEFT | WS_EX_TOOLWINDOW,
+ timer_class, "",
+ WS_POPUP,
+ 0, 0, 1, 1,
+ NULL, NULL, fl_display, NULL);
+ ShowWindow(s_TimerWnd, SW_SHOWNOACTIVATE);
+ }
- win32_timers[timer_id].callback = cb;
- win32_timers[timer_id].data = data;
+ win32_timers[timer_id].callback = cb;
+ win32_timers[timer_id].data = data;
- win32_timers[timer_id].handle =
- SetTimer(s_TimerWnd, timer_id + 1, elapsed, NULL);
+ win32_timers[timer_id].handle =
+ SetTimer(s_TimerWnd, timer_id + 1, elapsed, NULL);
}
int Fl::has_timeout(Fl_Timeout_Handler cb, void* data)
{
- for (int i = 0; i < win32_timer_used; ++i) {
- Win32Timer& t = win32_timers[i];
- if (t.handle && t.callback == cb && t.data == data) {
- return 1;
- }
+ for (int i = 0; i < win32_timer_used; ++i) {
+ Win32Timer& t = win32_timers[i];
+ if (t.handle && t.callback == cb && t.data == data) {
+ return 1;
}
- return 0;
+ }
+ return 0;
}
void Fl::remove_timeout(Fl_Timeout_Handler cb, void* data)
{
- int i;
- for (i = 0; i < win32_timer_used; ++i) {
- Win32Timer& t = win32_timers[i];
- if (t.handle && t.callback == cb &&
- (t.data == data || data == NULL)) {
- delete_timer(t);
- }
+ int i;
+ for (i = 0; i < win32_timer_used; ++i) {
+ Win32Timer& t = win32_timers[i];
+ if (t.handle && t.callback == cb &&
+ (t.data == data || data == NULL)) {
+ delete_timer(t);
}
+ }
}
/// END TIMERS
@@ -1511,9 +1730,16 @@ void Fl_Window::label(const char *name,const char *iname) {
iconlabel_ = iname;
if (shown() && !parent()) {
if (!name) name = "";
- SetWindowText(i->xid, name);
- // if (!iname) iname = fl_filename_name(name);
- // should do something with iname here...
+ int l = strlen(name);
+// WCHAR *lab = (WCHAR*) malloc((l + 1) * sizeof(short));
+// l = fl_utf2unicode((unsigned char*)name, l, (xchar*)lab);
+ unsigned wlen = fl_utf8toUtf16(name, l, NULL, 0); // Pass NULL to query length
+ wlen++;
+ unsigned short * lab = (unsigned short*)malloc(sizeof(unsigned short)*wlen);
+ wlen = fl_utf8toUtf16(name, l, lab, wlen);
+ lab[wlen] = 0;
+ SetWindowTextW(i->xid, (WCHAR *)lab);
+ free(lab);
}
}
@@ -1570,6 +1796,7 @@ HDC fl_GetDC(HWND w) {
// calling GetDC seems to always reset these: (?)
SetTextAlign(fl_gc, TA_BASELINE|TA_LEFT);
SetBkMode(fl_gc, TRANSPARENT);
+
return fl_gc;
}
@@ -1588,6 +1815,8 @@ void Fl_Window::make_current() {
current_ = this;
fl_clip_region(0);
+
+
}
/* Make sure that all allocated fonts are released. This works only if
@@ -1595,11 +1824,11 @@ void Fl_Window::make_current() {
will not automatically free any fonts. */
void fl_free_fonts(void)
{
-// remove the Fl_FontSize chains
+// remove the Fl_Font_Descriptor chains
int i;
Fl_Fontdesc * s;
- Fl_FontSize * f;
- Fl_FontSize * ff;
+ Fl_Font_Descriptor * f;
+ Fl_Font_Descriptor * ff;
for (i=0; ifirst; f; f=ff) {
@@ -1684,8 +1913,8 @@ void fl_cleanup_dc_list(void) { // clean up the list
t = win_DC_list;
} while(t);
}
-
+#endif // FL_DOXYGEN
//
-// End of "$Id: Fl_win32.cxx 6017 2008-01-10 21:53:34Z matt $".
+// End of "$Id: Fl_win32.cxx 6668 2009-02-21 10:18:47Z AlbrechtS $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_x.cxx b/plugins/zynaddsubfx/fltk/src/Fl_x.cxx
index a1fff05a5..9cb834a4b 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_x.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_x.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_x.cxx 5914 2007-06-18 13:08:57Z matt $"
+// "$Id: Fl_x.cxx 6767 2009-04-16 22:23:36Z AlbrechtS $"
//
// X specific code for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2007 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -29,21 +29,27 @@
//# include "Fl_win32.cxx"
#elif defined(__APPLE__)
//# include "Fl_mac.cxx"
-#else
+#elif !defined(FL_DOXYGEN)
# define CONSOLIDATE_MOTION 1
/**** Define this if your keyboard lacks a backspace key... ****/
/* #define BACKSPACE_HACK 1 */
+# include
# include
# include
# include
+# include
# include
+# include
# include
# include
# include "flstring.h"
# include
# include
+# include
+# include
+# include
////////////////////////////////////////////////////////////////
// interface to poll/select call:
@@ -249,6 +255,7 @@ int fl_wait(double time_to_wait) {
// fl_ready() is just like fl_wait(0.0) except no callbacks are done:
int fl_ready() {
if (XQLength(fl_display)) return 1;
+ if (!nfds) return 0; // nothing to select or poll
# if USE_POLL
return ::poll(pollfds, nfds, 0);
# else
@@ -266,10 +273,14 @@ int fl_ready() {
////////////////////////////////////////////////////////////////
Display *fl_display;
-Window fl_message_window;
+Window fl_message_window = 0;
int fl_screen;
XVisualInfo *fl_visual;
Colormap fl_colormap;
+XIM fl_xim_im = 0;
+XIC fl_xim_ic = 0;
+char fl_is_over_the_spot = 0;
+static XRectangle status_area;
static Atom WM_DELETE_WINDOW;
static Atom WM_PROTOCOLS;
@@ -288,7 +299,8 @@ Atom fl_XdndActionCopy;
Atom fl_XdndFinished;
//Atom fl_XdndProxy;
Atom fl_XdndURIList;
-
+Atom fl_XaUtf8String;
+Atom fl_XaTextUriList;
static void fd_callback(int,void *) {
do_queued_events();
@@ -310,9 +322,227 @@ extern "C" {
}
}
+extern char *fl_get_font_xfld(int fnum, int size);
+
+void fl_new_ic()
+{
+ XVaNestedList preedit_attr = NULL;
+ XVaNestedList status_attr = NULL;
+ static XFontSet fs = NULL;
+ char *fnt;
+ bool must_free_fnt = true;
+ char **missing_list;
+ int missing_count;
+ char *def_string;
+ static XRectangle spot;
+ int predit = 0;
+ int sarea = 0;
+ XIMStyles* xim_styles = NULL;
+
+#if USE_XFT
+
+#if defined(__GNUC__)
+#warning XFT support here
+#endif /*__GNUC__*/
+
+ if (!fs) {
+ fnt = NULL;//fl_get_font_xfld(0, 14);
+ if (!fnt) {fnt = "-misc-fixed-*";must_free_fnt=false;}
+ fs = XCreateFontSet(fl_display, fnt, &missing_list,
+ &missing_count, &def_string);
+ }
+#else
+ if (!fs) {
+ fnt = fl_get_font_xfld(0, 14);
+ if (!fnt) {fnt = "-misc-fixed-*";must_free_fnt=false;}
+ fs = XCreateFontSet(fl_display, fnt, &missing_list,
+ &missing_count, &def_string);
+ }
+#endif
+ preedit_attr = XVaCreateNestedList(0,
+ XNSpotLocation, &spot,
+ XNFontSet, fs, NULL);
+ status_attr = XVaCreateNestedList(0,
+ XNAreaNeeded, &status_area,
+ XNFontSet, fs, NULL);
+
+ if (!XGetIMValues(fl_xim_im, XNQueryInputStyle,
+ &xim_styles, NULL, NULL)) {
+ int i;
+ XIMStyle *style;
+ for (i = 0, style = xim_styles->supported_styles;
+ i < xim_styles->count_styles; i++, style++) {
+ if (*style == (XIMPreeditPosition | XIMStatusArea)) {
+ sarea = 1;
+ predit = 1;
+ } else if (*style == (XIMPreeditPosition | XIMStatusNothing)) {
+ predit = 1;
+ }
+ }
+ }
+ XFree(xim_styles);
+
+ if (sarea) {
+ fl_xim_ic = XCreateIC(fl_xim_im,
+ XNInputStyle, (XIMPreeditPosition | XIMStatusArea),
+ XNPreeditAttributes, preedit_attr,
+ XNStatusAttributes, status_attr,
+ NULL);
+ }
+
+ if (!fl_xim_ic && predit) {
+ fl_xim_ic = XCreateIC(fl_xim_im,
+ XNInputStyle, (XIMPreeditPosition | XIMStatusNothing),
+ XNPreeditAttributes, preedit_attr,
+ NULL);
+ }
+ XFree(preedit_attr);
+ XFree(status_attr);
+ if (!fl_xim_ic) {
+ fl_is_over_the_spot = 0;
+ fl_xim_ic = XCreateIC(fl_xim_im,
+ XNInputStyle, (XIMPreeditNothing | XIMStatusNothing),
+ NULL);
+ } else {
+ fl_is_over_the_spot = 1;
+ XVaNestedList status_attr = NULL;
+ status_attr = XVaCreateNestedList(0, XNAreaNeeded, &status_area, NULL);
+
+ XGetICValues(fl_xim_ic, XNStatusAttributes, status_attr, NULL);
+ XFree(status_attr);
+ }
+}
+
+
+static XRectangle spot;
+static int spotf = -1;
+static int spots = -1;
+
+void fl_reset_spot(void)
+{
+ spot.x = -1;
+ spot.y = -1;
+ //if (fl_xim_ic) XUnsetICFocus(fl_xim_ic);
+}
+
+void fl_set_spot(int font, int size, int X, int Y, int W, int H, Fl_Window *win)
+{
+ int change = 0;
+ XVaNestedList preedit_attr;
+ static XFontSet fs = NULL;
+ char **missing_list;
+ int missing_count;
+ char *def_string;
+ char *fnt = NULL;
+ bool must_free_fnt =true;
+
+ static XIC ic = NULL;
+
+ if (!fl_xim_ic || !fl_is_over_the_spot) return;
+ //XSetICFocus(fl_xim_ic);
+ if (X != spot.x || Y != spot.y) {
+ spot.x = X;
+ spot.y = Y;
+ spot.height = H;
+ spot.width = W;
+ change = 1;
+ }
+ if (font != spotf || size != spots) {
+ spotf = font;
+ spots = size;
+ change = 1;
+ if (fs) {
+ XFreeFontSet(fl_display, fs);
+ }
+#if USE_XFT
+
+#if defined(__GNUC__)
+#warning XFT support here
+#endif /*__GNUC__*/
+
+ fnt = NULL; // fl_get_font_xfld(font, size);
+ if (!fnt) {fnt = "-misc-fixed-*";must_free_fnt=false;}
+ fs = XCreateFontSet(fl_display, fnt, &missing_list,
+ &missing_count, &def_string);
+#else
+ fnt = fl_get_font_xfld(font, size);
+ if (!fnt) {fnt = "-misc-fixed-*";must_free_fnt=false;}
+ fs = XCreateFontSet(fl_display, fnt, &missing_list,
+ &missing_count, &def_string);
+#endif
+ }
+ if (fl_xim_ic != ic) {
+ ic = fl_xim_ic;
+ change = 1;
+ }
+
+ if (fnt && must_free_fnt) free(fnt);
+ if (!change) return;
+
+
+ preedit_attr = XVaCreateNestedList(0,
+ XNSpotLocation, &spot,
+ XNFontSet, fs, NULL);
+ XSetICValues(fl_xim_ic, XNPreeditAttributes, preedit_attr, NULL);
+ XFree(preedit_attr);
+}
+
+void fl_set_status(int x, int y, int w, int h)
+{
+ XVaNestedList status_attr;
+ status_area.x = x;
+ status_area.y = y;
+ status_area.width = w;
+ status_area.height = h;
+ if (!fl_xim_ic) return;
+ status_attr = XVaCreateNestedList(0, XNArea, &status_area, NULL);
+
+ XSetICValues(fl_xim_ic, XNStatusAttributes, status_attr, NULL);
+ XFree(status_attr);
+}
+
+void fl_init_xim()
+{
+ //XIMStyle *style;
+ XIMStyles *xim_styles;
+ if (!fl_display) return;
+ if (fl_xim_im) return;
+
+ fl_xim_im = XOpenIM(fl_display, NULL, NULL, NULL);
+ xim_styles = NULL;
+ fl_xim_ic = NULL;
+
+ if (fl_xim_im) {
+ XGetIMValues (fl_xim_im, XNQueryInputStyle,
+ &xim_styles, NULL, NULL);
+ } else {
+ Fl::warning("XOpenIM() failed\n");
+ return;
+ }
+
+ if (xim_styles && xim_styles->count_styles) {
+ fl_new_ic();
+ } else {
+ Fl::warning("No XIM style found\n");
+ XCloseIM(fl_xim_im);
+ fl_xim_im = NULL;
+ return;
+ }
+ if (!fl_xim_ic) {
+ Fl::warning("XCreateIC() failed\n");
+ XCloseIM(fl_xim_im);
+ XFree(xim_styles);
+ fl_xim_im = NULL;
+ }
+}
+
+
void fl_open_display() {
if (fl_display) return;
+ setlocale(LC_CTYPE, "");
+ XSetLocaleModifiers("");
+
XSetIOErrorHandler(io_error_handler);
XSetErrorHandler(xerror_handler);
@@ -325,24 +555,26 @@ void fl_open_display() {
void fl_open_display(Display* d) {
fl_display = d;
- WM_DELETE_WINDOW = XInternAtom(d, "WM_DELETE_WINDOW", 0);
- WM_PROTOCOLS = XInternAtom(d, "WM_PROTOCOLS", 0);
- fl_MOTIF_WM_HINTS = XInternAtom(d, "_MOTIF_WM_HINTS", 0);
- TARGETS = XInternAtom(d, "TARGETS", 0);
- CLIPBOARD = XInternAtom(d, "CLIPBOARD", 0);
- fl_XdndAware = XInternAtom(d, "XdndAware", 0);
- fl_XdndSelection = XInternAtom(d, "XdndSelection", 0);
- fl_XdndEnter = XInternAtom(d, "XdndEnter", 0);
- fl_XdndTypeList = XInternAtom(d, "XdndTypeList", 0);
- fl_XdndPosition = XInternAtom(d, "XdndPosition", 0);
- fl_XdndLeave = XInternAtom(d, "XdndLeave", 0);
- fl_XdndDrop = XInternAtom(d, "XdndDrop", 0);
- fl_XdndStatus = XInternAtom(d, "XdndStatus", 0);
- fl_XdndActionCopy = XInternAtom(d, "XdndActionCopy", 0);
- fl_XdndFinished = XInternAtom(d, "XdndFinished", 0);
- //fl_XdndProxy = XInternAtom(d, "XdndProxy", 0);
- fl_XdndEnter = XInternAtom(d, "XdndEnter", 0);
- fl_XdndURIList = XInternAtom(d, "text/uri-list", 0);
+ WM_DELETE_WINDOW = XInternAtom(d, "WM_DELETE_WINDOW", 0);
+ WM_PROTOCOLS = XInternAtom(d, "WM_PROTOCOLS", 0);
+ fl_MOTIF_WM_HINTS = XInternAtom(d, "_MOTIF_WM_HINTS", 0);
+ TARGETS = XInternAtom(d, "TARGETS", 0);
+ CLIPBOARD = XInternAtom(d, "CLIPBOARD", 0);
+ fl_XdndAware = XInternAtom(d, "XdndAware", 0);
+ fl_XdndSelection = XInternAtom(d, "XdndSelection", 0);
+ fl_XdndEnter = XInternAtom(d, "XdndEnter", 0);
+ fl_XdndTypeList = XInternAtom(d, "XdndTypeList", 0);
+ fl_XdndPosition = XInternAtom(d, "XdndPosition", 0);
+ fl_XdndLeave = XInternAtom(d, "XdndLeave", 0);
+ fl_XdndDrop = XInternAtom(d, "XdndDrop", 0);
+ fl_XdndStatus = XInternAtom(d, "XdndStatus", 0);
+ fl_XdndActionCopy = XInternAtom(d, "XdndActionCopy", 0);
+ fl_XdndFinished = XInternAtom(d, "XdndFinished", 0);
+ //fl_XdndProxy = XInternAtom(d, "XdndProxy", 0);
+ fl_XdndEnter = XInternAtom(d, "XdndEnter", 0);
+ fl_XdndURIList = XInternAtom(d, "text/uri-list", 0);
+ fl_XaUtf8String = XInternAtom(d, "UTF8_STRING", 0);
+ fl_XaTextUriList = XInternAtom(d, "text/uri-list", 0);
Fl::add_fd(ConnectionNumber(d), POLLIN, fd_callback);
@@ -356,6 +588,7 @@ void fl_open_display(Display* d) {
templt.visualid = XVisualIDFromVisual(DefaultVisual(d, fl_screen));
fl_visual = XGetVisualInfo(d, VisualIDMask, &templt, &num);
fl_colormap = DefaultColormap(d, fl_screen);
+ fl_init_xim();
#if !USE_COLORMAP
Fl::visual(FL_RGB);
@@ -380,9 +613,9 @@ static void fl_init_workarea() {
if (XGetWindowProperty(fl_display, RootWindow(fl_display, fl_screen),
_NET_WORKAREA, 0, 4 * sizeof(unsigned), False,
- XA_CARDINAL, &actual, &format, &count, &remaining,
- (unsigned char **)&xywh) || !xywh || !xywh[2] ||
- !xywh[3])
+ XA_CARDINAL, &actual, &format, &count, &remaining,
+ (unsigned char **)&xywh) || !xywh || !xywh[2] ||
+ !xywh[3])
{
fl_workarea_xywh[0] = 0;
fl_workarea_xywh[1] = 0;
@@ -435,7 +668,7 @@ Fl_Widget *fl_selection_requestor;
char *fl_selection_buffer[2];
int fl_selection_length[2];
int fl_selection_buffer_length[2];
-char fl_i_own_selection[2];
+char fl_i_own_selection[2] = {0,0};
// Call this when a "paste" operation happens:
void Fl::paste(Fl_Widget &receiver, int clipboard) {
@@ -452,8 +685,8 @@ void Fl::paste(Fl_Widget &receiver, int clipboard) {
// otherwise get the window server to return it:
fl_selection_requestor = &receiver;
Atom property = clipboard ? CLIPBOARD : XA_PRIMARY;
- XConvertSelection(fl_display, property, XA_STRING, property,
- fl_xid(Fl::first_window()), fl_event_time);
+ XConvertSelection(fl_display, property, fl_XaUtf8String, property,
+ fl_xid(Fl::first_window()), fl_event_time);
}
Window fl_dnd_source_window;
@@ -566,6 +799,69 @@ int fl_handle(const XEvent& thisevent)
XEvent xevent = thisevent;
fl_xevent = &thisevent;
Window xid = xevent.xany.window;
+ int filtered = 0;
+ static Window xim_win = 0;
+
+ if (fl_xim_ic && xevent.type == DestroyNotify &&
+ xid != xim_win && !fl_find(xid))
+ {
+ XIM xim_im;
+ xim_im = XOpenIM(fl_display, NULL, NULL, NULL);
+ if (!xim_im) {
+ /* XIM server has crashed */
+ XSetLocaleModifiers("@im=");
+ fl_xim_im = NULL;
+ fl_init_xim();
+ } else {
+ XCloseIM(xim_im); // see STR 2185 for comment
+ }
+ return 0;
+ }
+
+ if (fl_xim_ic && (xevent.type == FocusIn))
+ {
+#define POOR_XIM
+#ifdef POOR_XIM
+ if (xim_win != xid)
+ {
+ xim_win = xid;
+ XDestroyIC(fl_xim_ic);
+ fl_xim_ic = NULL;
+ fl_new_ic();
+ XSetICValues(fl_xim_ic,
+ XNFocusWindow, xevent.xclient.window,
+ XNClientWindow, xid,
+ NULL);
+ }
+ fl_set_spot(spotf, spots, spot.x, spot.y, spot.width, spot.height);
+#else
+ if (Fl::first_window() && Fl::first_window()->modal()) {
+ Window x = fl_xid(Fl::first_window());
+ if (x != xim_win) {
+ xim_win = x;
+ XSetICValues(fl_xim_ic,
+ XNFocusWindow, xim_win,
+ XNClientWindow, xim_win,
+ NULL);
+ fl_set_spot(spotf, spots, spot.x, spot.y, spot.width, spot.height);
+ }
+ } else if (xim_win != xid && xid) {
+ xim_win = xid;
+ XSetICValues(fl_xim_ic,
+ XNFocusWindow, xevent.xclient.window,
+ XNClientWindow, xid,
+ //XNFocusWindow, xim_win,
+ //XNClientWindow, xim_win,
+ NULL);
+ fl_set_spot(spotf, spots, spot.x, spot.y, spot.width, spot.height);
+ }
+#endif
+ }
+
+ filtered = XFilterEvent((XEvent *)&xevent, 0);
+ if (filtered) {
+ return 1;
+ }
switch (xevent.type) {
@@ -579,7 +875,7 @@ int fl_handle(const XEvent& thisevent)
case SelectionNotify: {
if (!fl_selection_requestor) return 0;
- static unsigned char* buffer;
+ static unsigned char* buffer = 0;
if (buffer) {XFree(buffer); buffer = 0;}
long bytesread = 0;
if (fl_xevent->xselection.property) for (;;) {
@@ -589,19 +885,20 @@ int fl_handle(const XEvent& thisevent)
Atom actual; int format; unsigned long count, remaining;
unsigned char* portion;
if (XGetWindowProperty(fl_display,
- fl_xevent->xselection.requestor,
- fl_xevent->xselection.property,
- bytesread/4, 65536, 1, 0,
- &actual, &format, &count, &remaining,
- &portion)) break; // quit on error
+ fl_xevent->xselection.requestor,
+ fl_xevent->xselection.property,
+ bytesread/4, 65536, 1, 0,
+ &actual, &format, &count, &remaining,
+ &portion)) break; // quit on error
if (bytesread) { // append to the accumulated buffer
- buffer = (unsigned char*)realloc(buffer, bytesread+count*format/8+remaining);
- memcpy(buffer+bytesread, portion, count*format/8);
- XFree(portion);
- } else { // Use the first section without moving the memory:
- buffer = portion;
+ buffer = (unsigned char*)realloc(buffer, bytesread+count*format/8+remaining);
+ memcpy(buffer+bytesread, portion, count*format/8);
+ XFree(portion);
+ } else { // Use the first section without moving the memory:
+ buffer = portion;
}
bytesread += count*format/8;
+ buffer[bytesread] = 0;
if (!remaining) break;
}
Fl::e_text = buffer ? (char*)buffer : (char *)"";
@@ -614,7 +911,7 @@ int fl_handle(const XEvent& thisevent)
// clear if this has to be delayed until now or if it can be done
// immediatly after calling XConvertSelection.
if (fl_xevent->xselection.property == XA_SECONDARY &&
- fl_dnd_source_window) {
+ fl_dnd_source_window) {
fl_sendClientMessage(fl_dnd_source_window, fl_XdndFinished,
fl_xevent->xselection.requestor);
fl_dnd_source_window = 0; // don't send a second time
@@ -636,14 +933,14 @@ int fl_handle(const XEvent& thisevent)
e.time = fl_xevent->xselectionrequest.time;
e.property = fl_xevent->xselectionrequest.property;
if (e.target == TARGETS) {
- Atom a = XA_STRING;
+ Atom a = fl_XaUtf8String; //XA_STRING;
XChangeProperty(fl_display, e.requestor, e.property,
- XA_ATOM, sizeof(Atom)*8, 0, (unsigned char*)&a, 1);
+ XA_ATOM, sizeof(Atom)*8, 0, (unsigned char*)&a, 1);
} else if (/*e.target == XA_STRING &&*/ fl_selection_length[clipboard]) {
XChangeProperty(fl_display, e.requestor, e.property,
- e.target, 8, 0,
- (unsigned char *)fl_selection_buffer[clipboard],
- fl_selection_length[clipboard]);
+ e.target, 8, 0,
+ (unsigned char *)fl_selection_buffer[clipboard],
+ fl_selection_length[clipboard]);
} else {
// char* x = XGetAtomName(fl_display,e.target);
// fprintf(stderr,"selection request of %s\n",x);
@@ -686,27 +983,28 @@ int fl_handle(const XEvent& thisevent)
// version number is data[1]>>24
// printf("XdndEnter, version %ld\n", data[1] >> 24);
if (data[1]&1) {
- // get list of data types:
- Atom actual; int format; unsigned long count, remaining;
- unsigned char *buffer = 0;
- XGetWindowProperty(fl_display, fl_dnd_source_window, fl_XdndTypeList,
- 0, 0x8000000L, False, XA_ATOM, &actual, &format,
- &count, &remaining, &buffer);
- if (actual != XA_ATOM || format != 32 || count<4 || !buffer)
- goto FAILED;
- delete [] fl_dnd_source_types;
- fl_dnd_source_types = new Atom[count+1];
- for (unsigned i = 0; i < count; i++)
- fl_dnd_source_types[i] = ((Atom*)buffer)[i];
- fl_dnd_source_types[count] = 0;
+ // get list of data types:
+ Atom actual; int format; unsigned long count, remaining;
+ unsigned char *buffer = 0;
+ XGetWindowProperty(fl_display, fl_dnd_source_window, fl_XdndTypeList,
+ 0, 0x8000000L, False, XA_ATOM, &actual, &format,
+ &count, &remaining, &buffer);
+ if (actual != XA_ATOM || format != 32 || count<4 || !buffer)
+ goto FAILED;
+ delete [] fl_dnd_source_types;
+ fl_dnd_source_types = new Atom[count+1];
+ for (unsigned i = 0; i < count; i++) {
+ fl_dnd_source_types[i] = ((Atom*)buffer)[i];
+ }
+ fl_dnd_source_types[count] = 0;
} else {
FAILED:
- // less than four data types, or if the above messes up:
- if (!fl_dnd_source_types) fl_dnd_source_types = new Atom[4];
- fl_dnd_source_types[0] = data[2];
- fl_dnd_source_types[1] = data[3];
- fl_dnd_source_types[2] = data[4];
- fl_dnd_source_types[3] = 0;
+ // less than four data types, or if the above messes up:
+ if (!fl_dnd_source_types) fl_dnd_source_types = new Atom[4];
+ fl_dnd_source_types[0] = data[2];
+ fl_dnd_source_types[1] = data[3];
+ fl_dnd_source_types[2] = data[4];
+ fl_dnd_source_types[3] = 0;
}
// Loop through the source types and pick the first text type...
@@ -715,12 +1013,12 @@ int fl_handle(const XEvent& thisevent)
for (i = 0; fl_dnd_source_types[i]; i ++)
{
// printf("fl_dnd_source_types[%d] = %ld (%s)\n", i,
-// fl_dnd_source_types[i],
-// XGetAtomName(fl_display, fl_dnd_source_types[i]));
+// fl_dnd_source_types[i],
+// XGetAtomName(fl_display, fl_dnd_source_types[i]));
if (!strncmp(XGetAtomName(fl_display, fl_dnd_source_types[i]),
- "text/", 5))
- break;
+ "text/", 5))
+ break;
}
if (fl_dnd_source_types[i])
@@ -740,8 +1038,8 @@ int fl_handle(const XEvent& thisevent)
Fl::e_x_root = data[2]>>16;
Fl::e_y_root = data[2]&0xFFFF;
if (window) {
- Fl::e_x = Fl::e_x_root-window->x();
- Fl::e_y = Fl::e_y_root-window->y();
+ Fl::e_x = Fl::e_x_root-window->x();
+ Fl::e_y = Fl::e_y_root-window->y();
}
fl_event_time = data[3];
fl_dnd_source_action = data[4];
@@ -773,17 +1071,17 @@ int fl_handle(const XEvent& thisevent)
Fl::e_text = unknown;
Fl::e_length = unknown_len;
if (Fl::handle(FL_DND_RELEASE, window)) {
- fl_selection_requestor = Fl::belowmouse();
- XConvertSelection(fl_display, fl_XdndSelection,
- fl_dnd_type, XA_SECONDARY,
- to_window, fl_event_time);
+ fl_selection_requestor = Fl::belowmouse();
+ XConvertSelection(fl_display, fl_XdndSelection,
+ fl_dnd_type, XA_SECONDARY,
+ to_window, fl_event_time);
} else {
- // Send the finished message if I refuse the drop.
- // It is not clear whether I can just send finished always,
- // or if I have to wait for the SelectionNotify event as the
- // code is currently doing.
- fl_sendClientMessage(fl_dnd_source_window, fl_XdndFinished, to_window);
- fl_dnd_source_window = 0;
+ // Send the finished message if I refuse the drop.
+ // It is not clear whether I can just send finished always,
+ // or if I have to wait for the SelectionNotify event as the
+ // code is currently doing.
+ fl_sendClientMessage(fl_dnd_source_window, fl_XdndFinished, to_window);
+ fl_dnd_source_window = 0;
}
return 1;
@@ -805,14 +1103,16 @@ int fl_handle(const XEvent& thisevent)
case GraphicsExpose:
window->damage(FL_DAMAGE_EXPOSE, xevent.xexpose.x, xevent.xexpose.y,
- xevent.xexpose.width, xevent.xexpose.height);
+ xevent.xexpose.width, xevent.xexpose.height);
return 1;
case FocusIn:
+ if (fl_xim_ic) XSetICFocus(fl_xim_ic);
event = FL_FOCUS;
break;
case FocusOut:
+ if (fl_xim_ic) XUnsetICFocus(fl_xim_ic);
event = FL_UNFOCUS;
break;
@@ -821,20 +1121,46 @@ int fl_handle(const XEvent& thisevent)
KEYPRESS:
int keycode = xevent.xkey.keycode;
fl_key_vector[keycode/8] |= (1 << (keycode%8));
- static char buffer[21];
+ static char *buffer = NULL;
+ static int buffer_len = 0;
int len;
KeySym keysym;
+ if (buffer_len == 0) {
+ buffer_len = 4096;
+ buffer = (char*) malloc(buffer_len);
+ }
if (xevent.type == KeyPress) {
event = FL_KEYDOWN;
+ int len = 0;
+
+ if (fl_xim_ic) {
+ if (!filtered) {
+ Status status;
+ len = XUtf8LookupString(fl_xim_ic, (XKeyPressedEvent *)&xevent.xkey,
+ buffer, buffer_len, &keysym, &status);
+
+ while (status == XBufferOverflow && buffer_len < 50000) {
+ buffer_len = buffer_len * 5 + 1;
+ buffer = (char*)realloc(buffer, buffer_len);
+ len = XUtf8LookupString(fl_xim_ic, (XKeyPressedEvent *)&xevent.xkey,
+ buffer, buffer_len, &keysym, &status);
+ }
+ } else {
+ keysym = XKeycodeToKeysym(fl_display, keycode, 0);
+ }
+ } else {
//static XComposeStatus compose;
len = XLookupString((XKeyEvent*)&(xevent.xkey),
- buffer, 20, &keysym, 0/*&compose*/);
+ buffer, buffer_len, &keysym, 0/*&compose*/);
if (keysym && keysym < 0x400) { // a character in latin-1,2,3,4 sets
- // force it to type a character (not sure if this ever is needed):
- if (!len) {buffer[0] = char(keysym); len = 1;}
- // ignore all effects of shift on the keysyms, which makes it a lot
- // easier to program shortcuts and is Windoze-compatable:
- keysym = XKeycodeToKeysym(fl_display, keycode, 0);
+ // force it to type a character (not sure if this ever is needed):
+ // if (!len) {buffer[0] = char(keysym); len = 1;}
+ len = fl_utf8encode(XKeysymToUcs(keysym), buffer);
+ if (len < 1) len = 1;
+ // ignore all effects of shift on the keysyms, which makes it a lot
+ // easier to program shortcuts and is Windoze-compatable:
+ keysym = XKeycodeToKeysym(fl_display, keycode, 0);
+ }
}
// MRS: Can't use Fl::event_state(FL_CTRL) since the state is not
// set until set_event_xy() is called later...
@@ -844,13 +1170,13 @@ int fl_handle(const XEvent& thisevent)
Fl::e_length = len;
} else {
// Stupid X sends fake key-up events when a repeating key is held
- // down, probably due to some back compatability problem. Fortunately
+ // down, probably due to some back compatibility problem. Fortunately
// we can detect this because the repeating KeyPress event is in
// the queue, get it and execute it instead:
XEvent temp;
if (XCheckIfEvent(fl_display,&temp,fake_keyup_test,(char*)(&xevent))){
- xevent = temp;
- goto KEYPRESS;
+ xevent = temp;
+ goto KEYPRESS;
}
event = FL_KEYUP;
fl_key_vector[keycode/8] &= ~(1 << (keycode%8));
@@ -870,7 +1196,7 @@ int fl_handle(const XEvent& thisevent)
// Attempt to fix keyboards that send "delete" for the key in the
// upper-right corner of the main keyboard. But it appears that
// very few of these remain?
- static int got_backspace;
+ static int got_backspace = 0;
if (!got_backspace) {
if (keysym == FL_Delete) keysym = FL_BackSpace;
else if (keysym == FL_BackSpace) got_backspace = 1;
@@ -887,18 +1213,18 @@ int fl_handle(const XEvent& thisevent)
Fl::e_original_keysym = (int)(keysym1 | FL_KP);
if ((xevent.xkey.state & Mod2Mask) &&
(keysym1 <= 0x7f || (keysym1 > 0xff9f && keysym1 <= FL_KP_Last))) {
- // Store ASCII numeric keypad value...
- keysym = keysym1 | FL_KP;
- buffer[0] = char(keysym1) & 0x7F;
- len = 1;
+ // Store ASCII numeric keypad value...
+ keysym = keysym1 | FL_KP;
+ buffer[0] = char(keysym1) & 0x7F;
+ len = 1;
} else {
- // Map keypad to special key...
- static const unsigned short table[15] = {
- FL_F+1, FL_F+2, FL_F+3, FL_F+4,
- FL_Home, FL_Left, FL_Up, FL_Right,
- FL_Down, FL_Page_Up, FL_Page_Down, FL_End,
- 0xff0b/*XK_Clear*/, FL_Insert, FL_Delete};
- keysym = table[keysym-0xff91];
+ // Map keypad to special key...
+ static const unsigned short table[15] = {
+ FL_F+1, FL_F+2, FL_F+3, FL_F+4,
+ FL_Home, FL_Left, FL_Up, FL_Right,
+ FL_Down, FL_Page_Up, FL_Page_Down, FL_End,
+ 0xff0b/*XK_Clear*/, FL_Insert, FL_Delete};
+ keysym = table[keysym-0xff91];
}
} else {
// Store this so we can later know if the KP was used
@@ -1005,9 +1331,9 @@ int fl_handle(const XEvent& thisevent)
//ReparentNotify gives the new position of the window relative to
//the new parent. FLTK cares about the position on the root window.
XTranslateCoordinates(fl_display, xevent.xreparent.parent,
- XRootWindow(fl_display, fl_screen),
- xevent.xreparent.x, xevent.xreparent.y,
- &xpos, &ypos, &junk);
+ XRootWindow(fl_display, fl_screen),
+ xevent.xreparent.x, xevent.xreparent.y,
+ &xpos, &ypos, &junk);
// tell Fl_Window about it and set flag to prevent echoing:
resize_bug_fix = window;
@@ -1043,9 +1369,9 @@ void Fl_Window::resize(int X,int Y,int W,int H) {
if (is_a_resize) {
if (!resizable()) size_range(w(),h(),w(),h());
if (is_a_move) {
- XMoveResizeWindow(fl_display, i->xid, X, Y, W>0 ? W : 1, H>0 ? H : 1);
+ XMoveResizeWindow(fl_display, i->xid, X, Y, W>0 ? W : 1, H>0 ? H : 1);
} else {
- XResizeWindow(fl_display, i->xid, W>0 ? W : 1, H>0 ? H : 1);
+ XResizeWindow(fl_display, i->xid, W>0 ? W : 1, H>0 ? H : 1);
}
} else
XMoveWindow(fl_display, i->xid, X, Y);
@@ -1078,7 +1404,7 @@ Fl_X* Fl_X::set_xid(Fl_Window* win, Window winxid) {
// normally. The global variables like fl_show_iconic are so that
// subclasses of *that* class may change the behavior...
-char fl_show_iconic; // hack for iconize()
+char fl_show_iconic; // hack for iconize()
int fl_background_pixel = -1; // hack to speed up bg box drawing
int fl_disable_transient_for; // secret method of removing TRANSIENT_FOR
@@ -1117,7 +1443,7 @@ void Fl_X::make_xid(Fl_Window* win, XVisualInfo *visual, Colormap colormap)
if (win->border()) {
// ensure border is on screen:
- // (assumme extremely minimal dimensions for this border)
+ // (assume extremely minimal dimensions for this border)
const int top = 20;
const int left = 1;
const int right = 1;
@@ -1168,13 +1494,13 @@ void Fl_X::make_xid(Fl_Window* win, XVisualInfo *visual, Colormap colormap)
Fl_X* xp =
set_xid(win, XCreateWindow(fl_display,
- root,
- X, Y, W, H,
- 0, // borderwidth
- visual->depth,
- InputOutput,
- visual->visual,
- mask, &attr));
+ root,
+ X, Y, W, H,
+ 0, // borderwidth
+ visual->depth,
+ InputOutput,
+ visual->visual,
+ mask, &attr));
int showit = 1;
if (!win->parent() && !attr.override_redirect) {
@@ -1183,7 +1509,7 @@ void Fl_X::make_xid(Fl_Window* win, XVisualInfo *visual, Colormap colormap)
win->label(win->label(), win->iconlabel());
XChangeProperty(fl_display, xp->xid, WM_PROTOCOLS,
- XA_ATOM, 32, 0, (uchar*)&WM_DELETE_WINDOW, 1);
+ XA_ATOM, 32, 0, (uchar*)&WM_DELETE_WINDOW, 1);
// send size limits and border:
xp->sendxjunk();
@@ -1200,7 +1526,7 @@ void Fl_X::make_xid(Fl_Window* win, XVisualInfo *visual, Colormap colormap)
*p = toupper(*q++); if (*p++ == 'X') *p++ = toupper(*q++);
while ((*p++ = *q++));
XChangeProperty(fl_display, xp->xid, XA_WM_CLASS, XA_STRING, 8, 0,
- (unsigned char *)buffer, p-buffer-1);
+ (unsigned char *)buffer, p-buffer-1);
}
if (win->non_modal() && xp->next && !fl_disable_transient_for) {
@@ -1215,14 +1541,14 @@ void Fl_X::make_xid(Fl_Window* win, XVisualInfo *visual, Colormap colormap)
if (!win->border()) {
Atom net_wm_state = XInternAtom (fl_display, "_NET_WM_STATE", 0);
Atom net_wm_state_skip_taskbar = XInternAtom (fl_display, "_NET_WM_STATE_SKIP_TASKBAR", 0);
- XChangeProperty (fl_display, xp->xid, net_wm_state, XA_ATOM, 32,
+ XChangeProperty (fl_display, xp->xid, net_wm_state, XA_ATOM, 32,
PropModeAppend, (unsigned char*) &net_wm_state_skip_taskbar, 1);
}
// Make it receptive to DnD:
long version = 4;
XChangeProperty(fl_display, xp->xid, fl_XdndAware,
- XA_ATOM, sizeof(int)*8, 0, (unsigned char*)&version, 1);
+ XA_ATOM, sizeof(int)*8, 0, (unsigned char*)&version, 1);
XWMHints *hints = XAllocWMHints();
hints->input = True;
@@ -1288,7 +1614,7 @@ void Fl_X::sendxjunk() {
hints->min_height != hints->max_height) { // resizable
hints->flags = PMinSize|PWinGravity;
if (hints->max_width >= hints->min_width ||
- hints->max_height >= hints->min_height) {
+ hints->max_height >= hints->min_height) {
hints->flags = PMinSize|PMaxSize|PWinGravity;
// unfortunately we can't set just one maximum size. Guess a
// value for the other one. Some window managers will make the
@@ -1323,8 +1649,8 @@ void Fl_X::sendxjunk() {
XSetWMNormalHints(fl_display, xid, hints);
XChangeProperty(fl_display, xid,
- fl_MOTIF_WM_HINTS, fl_MOTIF_WM_HINTS,
- 32, 0, (unsigned char *)prop, 5);
+ fl_MOTIF_WM_HINTS, fl_MOTIF_WM_HINTS,
+ 32, 0, (unsigned char *)prop, 5);
XFree(hints);
}
@@ -1349,10 +1675,10 @@ void Fl_Window::label(const char *name,const char *iname) {
if (shown() && !parent()) {
if (!name) name = "";
XChangeProperty(fl_display, i->xid, XA_WM_NAME,
- XA_STRING, 8, 0, (uchar*)name, strlen(name));
+ fl_XaUtf8String, 8, 0, (uchar*)name, strlen(name));
if (!iname) iname = fl_filename_name(name);
- XChangeProperty(fl_display, i->xid, XA_WM_ICON_NAME,
- XA_STRING, 8, 0, (uchar*)iname, strlen(iname));
+ XChangeProperty(fl_display, i->xid, XA_WM_ICON_NAME,
+ fl_XaUtf8String, 8, 0, (uchar*)iname, strlen(iname));
}
}
@@ -1366,7 +1692,7 @@ void Fl_Window::label(const char *name,const char *iname) {
//
// On XFree86 (and prehaps all X's) this has a problem if the window
// is resized while a save-behind window is atop it. The previous
-// contents are restored to the area, but this assummes the area
+// contents are restored to the area, but this assumes the area
// is cleared to background color. So this is disabled in this version.
// Fl_Window *fl_boxcheat;
static inline int can_boxcheat(uchar b) {return (b==1 || (b&2) && b<=15);}
@@ -1398,16 +1724,22 @@ GC fl_gc;
// make X drawing go into this window (called by subclass flush() impl.)
void Fl_Window::make_current() {
- static GC gc; // the GC used by all X windows
+ static GC gc; // the GC used by all X windows
if (!gc) gc = XCreateGC(fl_display, i->xid, 0, 0);
fl_window = i->xid;
fl_gc = gc;
current_ = this;
fl_clip_region(0);
+
+#ifdef USE_CAIRO
+ // update the cairo_t context
+ if (Fl::cairo_autolink_context()) Fl::cairo_make_current(this);
+#endif
+
}
#endif
//
-// End of "$Id: Fl_x.cxx 5914 2007-06-18 13:08:57Z matt $".
+// End of "$Id: Fl_x.cxx 6767 2009-04-16 22:23:36Z AlbrechtS $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/aimm.h b/plugins/zynaddsubfx/fltk/src/aimm.h
new file mode 100644
index 000000000..2acd5d96f
--- /dev/null
+++ b/plugins/zynaddsubfx/fltk/src/aimm.h
@@ -0,0 +1,428 @@
+// Standard dialog header file for the UTF-8 Fast Light Tool Kit (FLTK-UTF8).
+//
+// Copyright 2009 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version
+// with exceptions that allow sub-classing and static linking in
+// non-LGPL compliant software. These exceptions are subject to
+// conditions, see the FLTK License for more details.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the FLTK
+// License for more details.
+//
+// You should have received a copy of the FLTK License along with
+// this library; if not, write to OksiD Software, Jean-Marc Lienher,
+// Rue de la Cheminee 1, CH-2065 Savagnier, Switzerland.
+//
+// Please report all bugs and problems to "oksid@bluewin.ch".
+//
+
+#ifndef AIMM_H
+# define AIMM_H
+//# define HANDLE_PTR HANDLE*
+//# define DWORD_PTR DWORD*
+//# define CLSCTX_INPROC_SERVER 0x1
+const GUID IID_IActiveIMMApp = { 0x8c0e040, 0x62d1, 0x11d1, {0x93, 0x26, 0x00, 0x60, 0xb0, 0x67, 0xb8, 0x6e}};
+const GUID CLSID_CActiveIMM = { 0x4955dd33, 0xb159, 0x11d0, {0x8f, 0xcf, 0x00, 0xaa, 0x00, 0x6b, 0xcc, 0x59}};
+/*
+ class IUnknown
+ {
+ public:
+
+ virtual long __stdcall QueryInterface(
+ const GUID & riid,
+ void **ppvObject) = 0;
+
+ virtual ULONG __stdcall AddRef( void) = 0;
+
+ virtual ULONG __stdcall Release( void) = 0;
+ };
+
+extern "C" __declspec(dllimport) long __stdcall CoInitialize(void far *pvReserved);
+extern "C" __declspec(dllimport) long __stdcall CoCreateInstance(const GUID & rclsid, IUnknown * pUnkOuter,
+ DWORD dwClsContext, const GUID & riid, LPVOID FAR* ppv);
+
+*/
+
+ class IActiveIMMApp : public IUnknown
+ {
+ public:
+ virtual long __stdcall AssociateContext(
+ HWND hWnd,
+ HIMC hIME,
+ HIMC *phPrev) = 0;
+
+ virtual long __stdcall ConfigureIMEA(
+ HKL hKL,
+ HWND hWnd,
+ DWORD dwMode,
+ void *pData) = 0;
+
+ virtual long __stdcall ConfigureIMEW(
+ HKL hKL,
+ HWND hWnd,
+ DWORD dwMode,
+ void *pData) = 0;
+
+ virtual long __stdcall CreateContext(
+ HIMC *phIMC) = 0;
+
+ virtual long __stdcall DestroyContext(
+ HIMC hIME) = 0;
+
+ virtual long __stdcall EnumRegisterWordA(
+ HKL hKL,
+ LPSTR szReading,
+ DWORD dwStyle,
+ LPSTR szRegister,
+ LPVOID pData,
+ void **pEnum) = 0;
+
+ virtual long __stdcall EnumRegisterWordW(
+ HKL hKL,
+ LPWSTR szReading,
+ DWORD dwStyle,
+ LPWSTR szRegister,
+ LPVOID pData,
+ void **pEnum) = 0;
+
+ virtual long __stdcall EscapeA(
+ HKL hKL,
+ HIMC hIMC,
+ UINT uEscape,
+ /* [out][in] */ LPVOID pData,
+ LRESULT *plResult) = 0;
+
+ virtual long __stdcall EscapeW(
+ HKL hKL,
+ HIMC hIMC,
+ UINT uEscape,
+ /* [out][in] */ LPVOID pData,
+ LRESULT *plResult) = 0;
+
+ virtual long __stdcall GetCandidateListA(
+ HIMC hIMC,
+ DWORD dwIndex,
+ UINT uBufLen,
+ void *pCandList,
+ UINT *puCopied) = 0;
+
+ virtual long __stdcall GetCandidateListW(
+ HIMC hIMC,
+ DWORD dwIndex,
+ UINT uBufLen,
+ void *pCandList,
+ UINT *puCopied) = 0;
+
+ virtual long __stdcall GetCandidateListCountA(
+ HIMC hIMC,
+ DWORD *pdwListSize,
+ DWORD *pdwBufLen) = 0;
+
+ virtual long __stdcall GetCandidateListCountW(
+ HIMC hIMC,
+ DWORD *pdwListSize,
+ DWORD *pdwBufLen) = 0;
+
+ virtual long __stdcall GetCandidateWindow(
+ HIMC hIMC,
+ DWORD dwIndex,
+ void *pCandidate) = 0;
+
+ virtual long __stdcall GetCompositionFontA(
+ HIMC hIMC,
+ LOGFONTA *plf) = 0;
+
+ virtual long __stdcall GetCompositionFontW(
+ HIMC hIMC,
+ LOGFONTW *plf) = 0;
+
+ virtual long __stdcall GetCompositionStringA(
+ HIMC hIMC,
+ DWORD dwIndex,
+ DWORD dwBufLen,
+ LONG *plCopied,
+ LPVOID pBuf) = 0;
+
+ virtual long __stdcall GetCompositionStringW(
+ HIMC hIMC,
+ DWORD dwIndex,
+ DWORD dwBufLen,
+ LONG *plCopied,
+ LPVOID pBuf) = 0;
+
+ virtual long __stdcall GetCompositionWindow(
+ HIMC hIMC,
+ void *pCompForm) = 0;
+
+ virtual long __stdcall GetContext(
+ HWND hWnd,
+ HIMC *phIMC) = 0;
+
+ virtual long __stdcall GetConversionListA(
+ HKL hKL,
+ HIMC hIMC,
+ LPSTR pSrc,
+ UINT uBufLen,
+ UINT uFlag,
+ void *pDst,
+ UINT *puCopied) = 0;
+
+ virtual long __stdcall GetConversionListW(
+ HKL hKL,
+ HIMC hIMC,
+ LPWSTR pSrc,
+ UINT uBufLen,
+ UINT uFlag,
+ void *pDst,
+ UINT *puCopied) = 0;
+
+ virtual long __stdcall GetConversionStatus(
+ HIMC hIMC,
+ DWORD *pfdwConversion,
+ DWORD *pfdwSentence) = 0;
+
+ virtual long __stdcall GetDefaultIMEWnd(
+ HWND hWnd,
+ HWND *phDefWnd) = 0;
+
+ virtual long __stdcall GetDescriptionA(
+ HKL hKL,
+ UINT uBufLen,
+ LPSTR szDescription,
+ UINT *puCopied) = 0;
+
+ virtual long __stdcall GetDescriptionW(
+ HKL hKL,
+ UINT uBufLen,
+ LPWSTR szDescription,
+ UINT *puCopied) = 0;
+
+ virtual long __stdcall GetGuideLineA(
+ HIMC hIMC,
+ DWORD dwIndex,
+ DWORD dwBufLen,
+ LPSTR pBuf,
+ DWORD *pdwResult) = 0;
+
+ virtual long __stdcall GetGuideLineW(
+ HIMC hIMC,
+ DWORD dwIndex,
+ DWORD dwBufLen,
+ LPWSTR pBuf,
+ DWORD *pdwResult) = 0;
+
+ virtual long __stdcall GetIMEFileNameA(
+ HKL hKL,
+ UINT uBufLen,
+ LPSTR szFileName,
+ UINT *puCopied) = 0;
+
+ virtual long __stdcall GetIMEFileNameW(
+ HKL hKL,
+ UINT uBufLen,
+ LPWSTR szFileName,
+ UINT *puCopied) = 0;
+
+ virtual long __stdcall GetOpenStatus(
+ HIMC hIMC) = 0;
+
+ virtual long __stdcall GetProperty(
+ HKL hKL,
+ DWORD fdwIndex,
+ DWORD *pdwProperty) = 0;
+
+ virtual long __stdcall GetRegisterWordStyleA(
+ HKL hKL,
+ UINT nItem,
+ STYLEBUFA *pStyleBuf,
+ UINT *puCopied) = 0;
+
+ virtual long __stdcall GetRegisterWordStyleW(
+ HKL hKL,
+ UINT nItem,
+ STYLEBUFW *pStyleBuf,
+ UINT *puCopied) = 0;
+
+ virtual long __stdcall GetStatusWindowPos(
+ HIMC hIMC,
+ POINT *pptPos) = 0;
+
+ virtual long __stdcall GetVirtualKey(
+ HWND hWnd,
+ UINT *puVirtualKey) = 0;
+
+ virtual long __stdcall InstallIMEA(
+ LPSTR szIMEFileName,
+ LPSTR szLayoutText,
+ HKL *phKL) = 0;
+
+ virtual long __stdcall InstallIMEW(
+ LPWSTR szIMEFileName,
+ LPWSTR szLayoutText,
+ HKL *phKL) = 0;
+
+ virtual long __stdcall IsIME(
+ HKL hKL) = 0;
+
+ virtual long __stdcall IsUIMessageA(
+ HWND hWndIME,
+ UINT msg,
+ WPARAM wParam,
+ LPARAM lParam) = 0;
+
+ virtual long __stdcall IsUIMessageW(
+ HWND hWndIME,
+ UINT msg,
+ WPARAM wParam,
+ LPARAM lParam) = 0;
+
+ virtual long __stdcall NotifyIME(
+ HIMC hIMC,
+ DWORD dwAction,
+ DWORD dwIndex,
+ DWORD dwValue) = 0;
+
+ virtual long __stdcall RegisterWordA(
+ HKL hKL,
+ LPSTR szReading,
+ DWORD dwStyle,
+ LPSTR szRegister) = 0;
+
+ virtual long __stdcall RegisterWordW(
+ HKL hKL,
+ LPWSTR szReading,
+ DWORD dwStyle,
+ LPWSTR szRegister) = 0;
+
+ virtual long __stdcall ReleaseContext(
+ HWND hWnd,
+ HIMC hIMC) = 0;
+
+ virtual long __stdcall SetCandidateWindow(
+ HIMC hIMC,
+ void *pCandidate) = 0;
+
+ virtual long __stdcall SetCompositionFontA(
+ HIMC hIMC,
+ LOGFONTA *plf) = 0;
+
+ virtual long __stdcall SetCompositionFontW(
+ HIMC hIMC,
+ LOGFONTW *plf) = 0;
+
+ virtual long __stdcall SetCompositionStringA(
+ HIMC hIMC,
+ DWORD dwIndex,
+ LPVOID pComp,
+ DWORD dwCompLen,
+ LPVOID pRead,
+ DWORD dwReadLen) = 0;
+
+ virtual long __stdcall SetCompositionStringW(
+ HIMC hIMC,
+ DWORD dwIndex,
+ LPVOID pComp,
+ DWORD dwCompLen,
+ LPVOID pRead,
+ DWORD dwReadLen) = 0;
+
+ virtual long __stdcall SetCompositionWindow(
+ HIMC hIMC,
+ void *pCompForm) = 0;
+
+ virtual long __stdcall SetConversionStatus(
+ HIMC hIMC,
+ DWORD fdwConversion,
+ DWORD fdwSentence) = 0;
+
+ virtual long __stdcall SetOpenStatus(
+ HIMC hIMC,
+ BOOL fOpen) = 0;
+
+ virtual long __stdcall SetStatusWindowPos(
+ HIMC hIMC,
+ POINT *pptPos) = 0;
+
+ virtual long __stdcall SimulateHotKey(
+ HWND hWnd,
+ DWORD dwHotKeyID) = 0;
+
+ virtual long __stdcall UnregisterWordA(
+ HKL hKL,
+ LPSTR szReading,
+ DWORD dwStyle,
+ LPSTR szUnregister) = 0;
+
+ virtual long __stdcall UnregisterWordW(
+ HKL hKL,
+ LPWSTR szReading,
+ DWORD dwStyle,
+ LPWSTR szUnregister) = 0;
+
+ virtual long __stdcall Activate(
+ BOOL fRestoreLayout) = 0;
+
+ virtual long __stdcall Deactivate( void) = 0;
+
+ virtual long __stdcall OnDefWindowProc(
+ HWND hWnd,
+ UINT Msg,
+ WPARAM wParam,
+ LPARAM lParam,
+ LRESULT *plResult) = 0;
+
+ virtual long __stdcall FilterClientWindows(
+ ATOM *aaClassList,
+ UINT uSize) = 0;
+
+ virtual long __stdcall GetCodePageA(
+ HKL hKL,
+ UINT *uCodePage) = 0;
+
+ virtual long __stdcall GetLangId(
+ HKL hKL,
+ WORD *plid) = 0;
+
+ virtual long __stdcall AssociateContextEx(
+ HWND hWnd,
+ HIMC hIMC,
+ DWORD dwFlags) = 0;
+
+ virtual long __stdcall DisableIME(
+ DWORD idThread) = 0;
+
+ virtual long __stdcall GetImeMenuItemsA(
+ HIMC hIMC,
+ DWORD dwFlags,
+ DWORD dwType,
+ void *pImeParentMenu,
+ void *pImeMenu,
+ DWORD dwSize,
+ DWORD *pdwResult) = 0;
+
+ virtual long __stdcall GetImeMenuItemsW(
+ HIMC hIMC,
+ DWORD dwFlags,
+ DWORD dwType,
+ void *pImeParentMenu,
+ void *pImeMenu,
+ DWORD dwSize,
+ DWORD *pdwResult) = 0;
+
+ virtual long __stdcall EnumInputContext(
+ DWORD idThread,
+ void **ppEnum) = 0;
+
+ };
+
+#endif
+
+/*
+ * End of "$Id$".
+ */
diff --git a/plugins/zynaddsubfx/fltk/src/filename_absolute.cxx b/plugins/zynaddsubfx/fltk/src/filename_absolute.cxx
index 13135a58b..3423f1e10 100644
--- a/plugins/zynaddsubfx/fltk/src/filename_absolute.cxx
+++ b/plugins/zynaddsubfx/fltk/src/filename_absolute.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: filename_absolute.cxx 6102 2008-04-21 19:54:34Z matt $"
+// "$Id: filename_absolute.cxx 6691 2009-03-15 21:16:34Z AlbrechtS $"
//
// Filename expansion routines for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -32,19 +32,14 @@
*/
#include
+#include
#include
#include "flstring.h"
#include
#if defined(WIN32) && !defined(__CYGWIN__)
# include
-// Visual C++ 2005 incorrectly displays a warning about the use of POSIX APIs
-// on Windows, which is supposed to be POSIX compliant...
-# define getcwd _getcwd
#else
# include
-# ifdef __EMX__
-# define getcwd _getcwd2
-# endif
#endif
#if defined(WIN32) || defined(__EMX__) && !defined(__CYGWIN__)
@@ -53,6 +48,13 @@ inline int isdirsep(char c) {return c=='/' || c=='\\';}
#define isdirsep(c) ((c)=='/')
#endif
+/**
+ * Makes a filename absolute from a relative filename.
+ * \param[out] to resulting absolute filename
+ * \param[in] tolen size of the absolute filename buffer
+ * \param[in] from relative filename
+ * \return 0 if no change, non zero otherwise
+ */
int fl_filename_absolute(char *to, int tolen, const char *from) {
if (isdirsep(*from) || *from == '|'
#if defined(WIN32) || defined(__EMX__) && !defined(__CYGWIN__)
@@ -67,7 +69,7 @@ int fl_filename_absolute(char *to, int tolen, const char *from) {
char *temp = new char[tolen];
const char *start = from;
- a = getcwd(temp, tolen);
+ a = fl_getcwd(temp, tolen);
if (!a) {
strlcpy(to, from, tolen);
delete[] temp;
@@ -106,10 +108,13 @@ int fl_filename_absolute(char *to, int tolen, const char *from) {
return 1;
}
-/*
- * 'fl_filename_relative()' - Make a filename relative to the current working directory.
+/**
+ * Makes a filename relative to the current working directory.
+ * \param[out] to resulting relative filename
+ * \param[in] tolen size of the relative filename buffer
+ * \param[in] from absolute filename
+ * \return 0 if no change, non zero otherwise
*/
-
int // O - 0 if no change, 1 if changed
fl_filename_relative(char *to, // O - Relative filename
int tolen, // I - Size of "to" buffer
@@ -120,7 +125,7 @@ fl_filename_relative(char *to, // O - Relative filename
char *cwd = cwd_buf;
- // return if "from" is not an absolue path
+ // return if "from" is not an absolute path
#if defined(WIN32) || defined(__EMX__)
if (from[0] == '\0' ||
(!isdirsep(*from) && !isalpha(*from) && from[1] != ':' &&
@@ -133,7 +138,7 @@ fl_filename_relative(char *to, // O - Relative filename
}
// get the current directory and return if we can't
- if (!getcwd(cwd_buf, sizeof(cwd_buf))) {
+ if (!fl_getcwd(cwd_buf, sizeof(cwd_buf))) {
strlcpy(to, from, tolen);
return 0;
}
@@ -151,6 +156,7 @@ fl_filename_relative(char *to, // O - Relative filename
// test for the same drive. Return the absolute path if not
if (tolower(*from & 255) != tolower(*cwd & 255)) {
+ // Not the same drive...
strlcpy(to, from, tolen);
return 0;
}
@@ -208,5 +214,5 @@ fl_filename_relative(char *to, // O - Relative filename
//
-// End of "$Id: filename_absolute.cxx 6102 2008-04-21 19:54:34Z matt $".
+// End of "$Id: filename_absolute.cxx 6691 2009-03-15 21:16:34Z AlbrechtS $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/filename_expand.cxx b/plugins/zynaddsubfx/fltk/src/filename_expand.cxx
index a308a8de6..50b6ebbfe 100644
--- a/plugins/zynaddsubfx/fltk/src/filename_expand.cxx
+++ b/plugins/zynaddsubfx/fltk/src/filename_expand.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: filename_expand.cxx 5190 2006-06-09 16:16:34Z mike $"
+// "$Id: filename_expand.cxx 6641 2009-01-20 11:10:29Z fabien $"
//
// Filename expansion routines for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -31,9 +31,11 @@
*/
#include
+#include
#include
#include "flstring.h"
#if defined(WIN32) && !defined(__CYGWIN__)
+#include
#else
# include
# include
@@ -45,6 +47,13 @@ static inline int isdirsep(char c) {return c=='/' || c=='\\';}
#define isdirsep(c) ((c)=='/')
#endif
+/**
+ * Expands a filename coontaining shell variables.
+ * \param[out] to resulting expanded filename
+ * \param[in] tolen size of the expanded filename buffer
+ * \param[in] from filename containing shell variables
+ * \return 0 if no change, non zero otherwise
+ */
int fl_filename_expand(char *to,int tolen, const char *from) {
char *temp = new char[tolen];
@@ -60,7 +69,7 @@ int fl_filename_expand(char *to,int tolen, const char *from) {
switch (*a) {
case '~': // a home directory name
if (e <= a+1) { // current user's directory
- value = getenv("HOME");
+ value = fl_getenv("HOME");
#ifndef WIN32
} else { // another user's directory
struct passwd *pwd;
@@ -72,7 +81,7 @@ int fl_filename_expand(char *to,int tolen, const char *from) {
}
break;
case '$': /* an environment variable */
- {char t = *e; *(char *)e = 0; value = getenv(a+1); *(char *)e = t;}
+ {char t = *e; *(char *)e = 0; value = fl_getenv(a+1); *(char *)e = t;}
break;
}
if (value) {
@@ -106,5 +115,5 @@ int fl_filename_expand(char *to,int tolen, const char *from) {
//
-// End of "$Id: filename_expand.cxx 5190 2006-06-09 16:16:34Z mike $".
+// End of "$Id: filename_expand.cxx 6641 2009-01-20 11:10:29Z fabien $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/filename_ext.cxx b/plugins/zynaddsubfx/fltk/src/filename_ext.cxx
index 464827392..d583d8127 100644
--- a/plugins/zynaddsubfx/fltk/src/filename_ext.cxx
+++ b/plugins/zynaddsubfx/fltk/src/filename_ext.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: filename_ext.cxx 5190 2006-06-09 16:16:34Z mike $"
+// "$Id: filename_ext.cxx 6641 2009-01-20 11:10:29Z fabien $"
//
// Filename extension routines for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -29,6 +29,11 @@
#include
+/**
+ Gets the extensions of a filename
+ \param[in] buf the filename to be parsed
+ \return a pointer to the extension (including '.') if any or NULL otherwise
+ */
const char *fl_filename_ext(const char *buf) {
const char *q = 0;
const char *p = buf;
@@ -43,5 +48,5 @@ const char *fl_filename_ext(const char *buf) {
}
//
-// End of "$Id: filename_ext.cxx 5190 2006-06-09 16:16:34Z mike $".
+// End of "$Id: filename_ext.cxx 6641 2009-01-20 11:10:29Z fabien $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/filename_isdir.cxx b/plugins/zynaddsubfx/fltk/src/filename_isdir.cxx
index afa4c7103..5d62dcb57 100644
--- a/plugins/zynaddsubfx/fltk/src/filename_isdir.cxx
+++ b/plugins/zynaddsubfx/fltk/src/filename_isdir.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: filename_isdir.cxx 5948 2007-10-07 10:12:32Z matt $"
+// "$Id: filename_isdir.cxx 6641 2009-01-20 11:10:29Z fabien $"
//
// Directory detection routines for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -32,6 +32,7 @@
#include
#include