ZynAddSubFX/FLTK: updated to SVN revision 6826

Updated FLTK to SVN revision 6826 of branch-1.3:

- Corrected const methods of Fl_Text_{Buffer|Display|Selection}
  to be declared const, corrected an Fl_Text_Buffer attrib. typo
- Fixed OpenGL shared context handling (STR #2135)
- Fixed gray-scale images with alpha channel (STR #2105)
- Fixed unexpected shortcut behavior for Win32 (STR #2199)
- Fixed documentation for Fl_Progress (STR #2209)

Signed-off-by: Tobias Doerffel <tobias.doerffel@gmail.com>
(cherry picked from commit 0de2949aed)
This commit is contained in:
Tobias Doerffel
2009-07-07 02:08:34 +02:00
parent c0f221e984
commit a0b198fb38
15 changed files with 390 additions and 467 deletions

View File

@@ -1,5 +1,11 @@
CHANGES IN FLTK 1.3.0
- Corrected const methods of Fl_Text_{Buffer|Display|Selection}
to be declared const, corrected an Fl_Text_Buffer attrib. typo
- Fixed OpenGL shared context handling (STR #2135)
- Fixed gray-scale images with alpha channel (STR #2105)
- Fixed unexpected shortcut behavior for Win32 (STR #2199)
- Fixed documentation for Fl_Progress (STR #2209)
- Fluid printing used wrong colors under Windows (STR #2195)
- Updated documentation for Fl_Input_
- Fixed fl_draw_image to obey the alpha channel, hoping that

View File

@@ -42,7 +42,7 @@
#define FL_DIGITAL_CLOCK FL_SQUARE_CLOCK /**< Not yet implemented */
// fabien: Please keep the horizontal formatting of both images in class desc,
// don't loose vert. space for nothing!
// don't lose vert. space for nothing!
/**
\class Fl_Clock_Output
@@ -109,7 +109,7 @@ public:
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.
You can choose the rounded or square type of the clock with type(), see below.
\htmlonly <BR> <table align=CENTER border=1 cellpadding=5 >
<caption align=bottom>type() FL_SQUARE_CLOCK and FL_ROUND_CLOCK </caption> <TR><TD> \endhtmlonly
\image html clock.gif

View File

@@ -51,20 +51,20 @@ class FL_EXPORT Fl_Text_Selection {
void set(int start, int end);
void set_rectangular(int start, int end, int rectStart, int rectEnd);
void update(int pos, int nDeleted, int nInserted);
char rectangular() { return mRectangular; }
int start() { return mStart; }
int end() { return mEnd; }
int rect_start() { return mRectStart; }
int rect_end() { return mRectEnd; }
char rectangular() const { return mRectangular; }
int start() const { return mStart; }
int end() const { return mEnd; }
int rect_start() const { return mRectStart; }
int rect_end() const { return mRectEnd; }
/**
Returns a non-zero number if any text has been selected, or 0
if no text is selected.
*/
char selected() { return mSelected; }
char selected() const { return mSelected; }
void selected(char b) { mSelected = b; }
int includes(int pos, int lineStartPos, int dispIndex);
int position(int* start, int* end);
int position(int* start, int* end, int* isRect, int* rectStart, int* rectEnd);
int includes(int pos, int lineStartPos, int dispIndex) const;
int position(int* start, int* end) const;
int position(int* start, int* end, int* isRect, int* rectStart, int* rectEnd) const;
protected:
@@ -101,12 +101,12 @@ class FL_EXPORT Fl_Text_Buffer {
~Fl_Text_Buffer();
/** Returns the number of characters in the buffer. */
int length() { return mLength; }
char* text();
int length() const { return mLength; }
char* text() const;
void text(const char* text);
char* text_range(int start, int end);
char character(int pos);
char* text_in_rectangle(int start, int end, int rectStart, int rectEnd);
char* text_range(int start, int end) const;
char character(int pos) const;
char* text_in_rectangle(int start, int end, int rectStart, int rectEnd) const;
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); }
@@ -145,11 +145,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; }
int tab_distance() const { 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(); }
int selected() const { return mPrimary.selected(); }
void unselect();
void select_rectangular(int start, int end, int rectStart, int rectEnd);
int selection_position(int* start, int* end);
@@ -210,48 +210,50 @@ class FL_EXPORT Fl_Text_Buffer {
*/
void call_predelete_callbacks() { call_predelete_callbacks(0, 0); }
char* line_text(int pos);
int line_start(int pos);
int line_end(int pos);
int word_start(int pos);
int word_end(int pos);
int expand_character(int pos, int indent, char *outStr);
char* line_text(int pos) const;
int line_start(int pos) const;
int line_end(int pos) const;
int word_start(int pos) const;
int word_end(int pos) const;
int expand_character(int pos, int indent, char *outStr) const;
static int expand_character(char c, int indent, char* outStr, int tabDist,
char nullSubsChar);
static int character_width(char c, int indent, int tabDist, char nullSubsChar);
int count_displayed_characters(int lineStartPos, int targetPos);
int count_displayed_characters(int lineStartPos, int targetPos) const;
int skip_displayed_characters(int lineStartPos, int nChars);
int count_lines(int startPos, int endPos);
int count_lines(int startPos, int endPos) const;
int skip_lines(int startPos, int nLines);
int rewind_lines(int startPos, int nLines);
int findchar_forward(int startPos, char searchChar, int* foundPos);
int findchar_backward(int startPos, char searchChar, int* foundPos);
int findchars_forward(int startPos, const char* searchChars, int* foundPos);
int findchars_backward(int startPos, const char* searchChars, int* foundPos);
int findchar_forward(int startPos, char searchChar, int* foundPos) const;
int findchar_backward(int startPos, char searchChar, int* foundPos) const;
int findchars_forward(int startPos, const char* searchChars, int* foundPos) const;
int findchars_backward(int startPos, const char* searchChars, int* foundPos) const;
int search_forward(int startPos, const char* searchString, int* foundPos,
int matchCase = 0);
int matchCase = 0) const;
int search_backward(int startPos, const char* searchString, int* foundPos,
int matchCase = 0);
int matchCase = 0) const;
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; }
char null_substitution_character() const { return mNullSubsChar; }
/** Returns the primary selection. */
const Fl_Text_Selection* primary_selection() const { return &mPrimary; }
/** Returns the primary selection. */
Fl_Text_Selection* primary_selection() { return &mPrimary; }
/** Returns the secondary selection. */
Fl_Text_Selection* secondary_selection() { return &mSecondary; }
const Fl_Text_Selection* secondary_selection() const { return &mSecondary; }
/** Returns the current highlight selection. */
Fl_Text_Selection* highlight_selection() { return &mHighlight; }
const Fl_Text_Selection* highlight_selection() const { return &mHighlight; }
protected:
void call_modify_callbacks(int pos, int nDeleted, int nInserted,
int nRestyled, const char* deletedText);
void call_predelete_callbacks(int pos, int nDeleted);
int nRestyled, const char* deletedText) const;
void call_predelete_callbacks(int pos, int nDeleted) const;
int insert_(int pos, const char* text);
void remove_(int start, int end);
@@ -267,17 +269,17 @@ class FL_EXPORT Fl_Text_Buffer {
int* nInserted, int* endPos);
void redisplay_selection(Fl_Text_Selection* oldSelection,
Fl_Text_Selection* newSelection);
Fl_Text_Selection* newSelection) const;
void move_gap(int pos);
void reallocate_with_gap(int newGapStart, int newGapLen);
char* selection_text_(Fl_Text_Selection* sel);
char* selection_text_(Fl_Text_Selection* sel) const;
void remove_selection_(Fl_Text_Selection* sel);
void replace_selection_(Fl_Text_Selection* sel, const char* text);
void rectangular_selection_boundaries(int lineStartPos, int rectStart,
int rectEnd, int* selStart,
int* selEnd);
int* selEnd) const;
void update_selections(int pos, int nDeleted, int nInserted);
@@ -297,7 +299,7 @@ class FL_EXPORT Fl_Text_Buffer {
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 */
mModifyProcs; /**< 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 */

View File

@@ -98,23 +98,23 @@ class FL_EXPORT Fl_Text_Display: public Fl_Group {
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; }
Fl_Text_Buffer* buffer() const { 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);
int insert_position() const { return mCursorPos; }
int in_selection(int x, int y) const;
void show_insert_position();
int move_right();
int move_left();
int move_up();
int move_down();
int count_lines(int start, int end, bool start_pos_is_line_start);
int line_start(int pos);
int line_end(int pos, bool start_pos_is_line_start);
int count_lines(int start, int end, bool start_pos_is_line_start) const;
int line_start(int pos) const;
int line_end(int pos, bool start_pos_is_line_start) const;
int skip_lines(int startPos, int nLines, bool startPosIsLineStart);
int rewind_lines(int startPos, int nLines);
void next_word(void);
@@ -128,17 +128,17 @@ class FL_EXPORT Fl_Text_Display: public Fl_Group {
/** 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_; }
int scrollbar_width() const { return scrollbar_width_; }
/** 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_; }
Fl_Align scrollbar_align() const { 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); }
int word_start(int pos) const { 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); }
int word_end(int pos) const { return buffer()->word_end(pos); }
void highlight_data(Fl_Text_Buffer *styleBuffer,
@@ -148,7 +148,7 @@ class FL_EXPORT Fl_Text_Display: public Fl_Group {
void *cbArg);
int position_style(int lineStartPos, int lineLen, int lineIndex,
int dispIndex);
int dispIndex) const;
/** \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_;}
@@ -169,8 +169,8 @@ class FL_EXPORT Fl_Text_Display: public Fl_Group {
/** Sets the default color of text in the widget. */
void textcolor(unsigned n) {textcolor_ = n;}
int wrapped_column(int row, int column);
int wrapped_row(int row);
int wrapped_column(int row, int column) const;
int wrapped_row(int row) const;
void wrap_mode(int wrap, int wrap_margin);
virtual void resize(int X, int Y, int W, int H);
@@ -206,8 +206,8 @@ class FL_EXPORT Fl_Text_Display: public Fl_Group {
void calc_last_char();
int position_to_line( int pos, int* lineNum );
int string_width(const char* string, int length, int style);
int position_to_line( int pos, int* lineNum ) const;
int string_width(const char* string, int length, int style) const;
static void scroll_timer_cb(void*);
@@ -220,22 +220,22 @@ class FL_EXPORT Fl_Text_Display: public Fl_Group {
static void v_scrollbar_cb( Fl_Scrollbar* w, Fl_Text_Display* d);
void update_v_scrollbar();
void update_h_scrollbar();
int measure_vline(int visLineNum);
int longest_vline();
int empty_vlines();
int vline_length(int visLineNum);
int xy_to_position(int x, int y, int PosType = CHARACTER_POS);
int measure_vline(int visLineNum) const;
int longest_vline() const;
int empty_vlines() const;
int vline_length(int visLineNum) const;
int xy_to_position(int x, int y, int PosType = CHARACTER_POS) const;
void xy_to_rowcol(int x, int y, int* row, int* column,
int PosType = CHARACTER_POS);
int PosType = CHARACTER_POS) const;
int position_to_xy(int pos, int* x, int* y);
int position_to_xy(int pos, int* x, int* y) const;
void maintain_absolute_top_line_number(int state);
int get_absolute_top_line_number();
int get_absolute_top_line_number() const;
void absolute_top_line_number(int oldFirstChar);
int maintaining_absolute_top_line_number();
int maintaining_absolute_top_line_number() const;
void reset_absolute_top_line_number();
int position_to_linecol(int pos, int* lineNum, int* column);
int position_to_linecol(int pos, int* lineNum, int* column) const;
void scroll_(int topLineNum, int horizOffset);
void extend_range_for_styles(int* start, int* end);
@@ -248,13 +248,13 @@ class FL_EXPORT Fl_Text_Display: public Fl_Group {
int maxLines, bool startPosIsLineStart,
int styleBufOffset, int *retPos, int *retLines,
int *retLineStart, int *retLineEnd,
bool countLastLineMissingNewLine = true);
bool countLastLineMissingNewLine = true) const;
void find_line_end(int pos, bool start_pos_is_line_start, int *lineEnd,
int *nextLineStart);
int measure_proportional_character(char c, int colNum, int pos);
int wrap_uses_character(int lineEndPos);
int range_touches_selection(Fl_Text_Selection *sel, int rangeStart,
int rangeEnd);
int *nextLineStart) const;
int measure_proportional_character(char c, int colNum, int pos) const;
int wrap_uses_character(int lineEndPos) const;
int range_touches_selection(const Fl_Text_Selection *sel, int rangeStart,
int rangeEnd) const;
#ifndef FL_DOXYGEN
int damage_range1_start, damage_range1_end;
int damage_range2_start, damage_range2_end;

View File

@@ -465,7 +465,7 @@ void Fl_RGB_Image::draw(int XP, int YP, int WP, int HP, int cx, int cy) {
CGDataProviderRelease(src);
#elif defined(WIN32)
id = fl_create_offscreen(w(), h());
if (d() == 2 || d() == 4 && fl_can_do_alpha_blending()) {
if ((d() == 2 || d() == 4) && fl_can_do_alpha_blending()) {
fl_begin_offscreen((Fl_Offscreen)id);
fl_draw_image(array, 0, 0, w(), h(), d()|FL_IMAGE_WITH_ALPHA, ld());
fl_end_offscreen();

View File

@@ -43,9 +43,9 @@ extern void fl_draw(const char*, int, float, float);
////////////////////////////////////////////////////////////////
/** \internal
Convert a given text segment into the text that will be rendered on screen.
Converts 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 <tt>^X</tt>
This copies the text from \p p to \p buf, replacing characters with <tt>^X</tt>
and <tt>\\nnn</tt> as necessary.
The destination buffer is limited to \c MAXBUF (currently at 1024). All
@@ -109,7 +109,7 @@ const char* Fl_Input_::expand(const char* p, char* buf) const {
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.
the width of the string when rendered with the given font.
\param [in] p pointer to the start of the original string
\param [in] e pointer to the end of the original string
@@ -149,10 +149,10 @@ double Fl_Input_::expandpos(
////////////////////////////////////////////////////////////////
/** \internal
Mark a range of characters for update.
Marks 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
text buffer for update. At least these characters
will be redrawn in the next update cycle.
Characters from \p mu_p to end of widget are redrawn.
@@ -175,9 +175,9 @@ void Fl_Input_::minimal_update(int p) {
}
/** \internal
Mark a range of characters for update.
Marks a range of characters for update.
This call marks a text range for update. At least all chracters
This call marks a text range for update. At least all characters
from \p p to \p q will be redrawn in the next update cycle.
\param [in] p start of update range
@@ -190,21 +190,21 @@ void Fl_Input_::minimal_update(int p, int q) {
////////////////////////////////////////////////////////////////
/* Horizontal cursor position in pixels while movin up or down. */
/* Horizontal cursor position in pixels while moving up or down. */
double Fl_Input_::up_down_pos = 0;
/* Flag to remeber last cursor move. */
/* Flag to remember last cursor move. */
int Fl_Input_::was_up_down = 0;
/**
Set the current font and font size.
Sets the current font and font size.
*/
void Fl_Input_::setfont() const {
fl_font(textfont(), textsize());
}
/**
Draw the text in the passed bounding box.
Draws the text in the passed bounding box.
If <tt>damage() & FL_DAMAGE_ALL</tt> is true, this assumes the
area has already been erased to color(). Otherwise it does
@@ -391,7 +391,7 @@ void Fl_Input_::drawtext(int X, int Y, int W, int H) {
}
/** \internal
Simple function that determins if a charcter could be part of a word.
Simple function that determines if a character could be part of a word.
\todo This function is not ucs4-aware.
*/
static int isword(char c) {
@@ -491,7 +491,7 @@ int Fl_Input_::line_start(int i) const {
}
/**
Handle mouse clicks and mouse moves.
Handles 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) {
@@ -571,8 +571,8 @@ void Fl_Input_::handle_mouse(int X, int Y, int /*W*/, int /*H*/, int drag) {
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
\e position (\c p) is where the cursor is. The
\e mark (\c m) 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).
@@ -633,7 +633,7 @@ int Fl_Input_::position(int p, int m) {
}
/**
Move the cursor to the column given by \p up_down_pos.
Moves 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
@@ -667,12 +667,12 @@ int Fl_Input_::up_down_position(int i, int keepmark) {
Put the current selection into the clipboard.
This function copies the current selection between mark() and
position() into the specified clipboard. This does not
position() into the specified \c 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
\param clipboard the clipboard destination 0 or 1
\return 0 if no text is selected, 1 if the selection was copied
\see Fl::copy(const char *, int, int)
*/
@@ -719,11 +719,10 @@ static void undobuffersize(int n) {
at that point and moves the mark() and
position() to the end of the insertion. Does the callback if
<tt>when() & FL_WHEN_CHANGED</tt> 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.
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
@@ -732,8 +731,7 @@ static void undobuffersize(int n) {
\p b and \p e are clamped to the
<tt>0..size()</tt> range, so it is safe to pass any values.
cut() and insert() are just inline
functions that call replace().
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
@@ -837,7 +835,7 @@ int Fl_Input_::replace(int b, int e, const char* text, int ilen) {
}
/**
Undo previous changes to the text buffer.
Undoes previous changes to the text buffer.
This call undoes a number of previous calls to replace().
@@ -884,10 +882,10 @@ int Fl_Input_::undo() {
}
/**
Copy the \e yank buffer to the clipboard.
Copies the \e yank buffer to the clipboard.
Copy all the previous contiguous cuts from the undo
information to the clipboard. This function implemnts
This method copies all the previous contiguous cuts from the undo
information to the clipboard. This function implements
the \c ^K shortcut key.
\return 0 if the operation did not change the clipboard
@@ -901,7 +899,7 @@ int Fl_Input_::copy_cuts() {
}
/** \internal
Check the when() field and do a callback if indicated.
Checks the when() field and does a callback if indicated.
*/
void Fl_Input_::maybe_do_callback() {
if (changed() || (when()&FL_WHEN_NOT_CHANGED)) {
@@ -910,9 +908,9 @@ void Fl_Input_::maybe_do_callback() {
}
/**
Handle all kinds of text field related events.
Handles all kinds of text field related events.
This is calle by derived classes.
This is called by derived classes.
\todo Add comment and parameters
*/
int Fl_Input_::handletext(int event, int X, int Y, int W, int H) {
@@ -1034,8 +1032,8 @@ 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.
This function creates a new Fl_Input_ widget and adds it to the current
Fl_Group. The value() is set to \c NULL.
The default boxtype is \c FL_DOWN_BOX.
\param X, Y, W, H the dimensions of the new widget
@@ -1061,7 +1059,7 @@ Fl_Input_::Fl_Input_(int X, int Y, int W, int H, const char* l)
}
/**
Copy the value from a possibly static entry into the internal buffer.
Copies the value from a possibly static entry into the internal buffer.
\param [in] len size of the current text
*/
@@ -1103,7 +1101,7 @@ void Fl_Input_::put_in_buffer(int len) {
/**
Changes the widget text.
This function change the text and set the mark and the point to
This function changes the text and sets 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
@@ -1151,7 +1149,7 @@ int Fl_Input_::static_value(const char* str, int len) {
/**
Changes the widget text.
This function change the text and set the mark and the point to
This function changes the text and sets 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
@@ -1203,7 +1201,7 @@ int Fl_Input_::value(const char* str) {
}
/**
Change the size of the widget.
Changes 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)
@@ -1226,7 +1224,7 @@ Fl_Input_::~Fl_Input_() {
}
/** \internal
Return the number of lines displayed on a single page.
Returns the number of lines displayed on a single page.
\return widget height divided by the font height
*/
int Fl_Input_::linesPerPage() {
@@ -1242,9 +1240,9 @@ int Fl_Input_::linesPerPage() {
/**
Returns the character at index \p i.
This function returns the utf8 character at \p i
This function returns the UTF-8 character at \p i
as a ucs4 character code.
\param [in] i index into the value field
\return the character at index \p i
*/

View File

@@ -28,10 +28,10 @@
// These are for Forms emulation and for dynamically changing the
// menus. They are in this source file so they are not linked in if
// not used, which is what will happen if the the program only uses
// not used, which is what will happen if the program only uses
// constant menu tables.
// Not at all guaranteed to be Forms compatable, especially with any
// Not at all guaranteed to be Forms compatible, especially with any
// string with a % sign in it!
#include <FL/Fl_Menu_.H>

View File

@@ -47,7 +47,7 @@
//
// 'Fl_Progress::draw()' - Draw the check button.
// 'Fl_Progress::draw()' - Draw the progress bar.
//
/** Draws the progress bar. */
@@ -76,10 +76,10 @@ void Fl_Progress::draw()
// Draw the box and label...
if (progress > 0) {
Fl_Color c = labelcolor();
labelcolor(fl_contrast(labelcolor(), color2()));
labelcolor(fl_contrast(labelcolor(), selection_color()));
fl_push_clip(x(), y(), progress + bx, h());
draw_box(box(), x(), y(), w(), h(), active_r() ? color2() : fl_inactive(color2()));
draw_box(box(), x(), y(), w(), h(), active_r() ? selection_color() : fl_inactive(selection_color()));
draw_label(tx, y() + by, tw, h() - bh);
fl_pop_clip();
@@ -99,12 +99,16 @@ void Fl_Progress::draw()
/**
The constructor creates the progress bar using the position,
size, and label.
<P> The inherited destructor removes the progress bar.
The constructor creates the progress bar using the position, size, and label.
You can set the background color with color() and the
progress bar color with selection_color(), or you can set both colors
together with color(unsigned bg, unsigned sel).
The default colors are FL_BACKGROUND2_COLOR and FL_YELLOW, resp.
*/
Fl_Progress::Fl_Progress(int X, int Y, int W, int H, const char* l)
: Fl_Widget(X, Y, W, H, l) {
Fl_Progress::Fl_Progress(int X, int Y, int W, int H, const char* L)
: Fl_Widget(X, Y, W, H, L) {
align(FL_ALIGN_INSIDE);
box(FL_DOWN_BOX);
color(FL_BACKGROUND2_COLOR, FL_YELLOW);

File diff suppressed because it is too large Load Diff

View File

@@ -350,7 +350,7 @@ int TextDMaxFontWidth(textDisp *textD, Boolean considerStyles) {
}
#endif
int Fl_Text_Display::longest_vline() {
int Fl_Text_Display::longest_vline() const {
int longest = 0;
for (int i = 0; i < mNVisibleLines; i++)
longest = max(longest, measure_vline(i));
@@ -798,7 +798,7 @@ void Fl_Text_Display::overstrike(const char* text) {
X coordinate where the position would be if it were visible.
*/
int Fl_Text_Display::position_to_xy( int pos, int* X, int* Y ) {
int Fl_Text_Display::position_to_xy( int pos, int* X, int* Y ) const {
int charIndex, lineStartPos, fontHeight, lineLen;
int visLineNum, charLen, outIndex, xStep, charStyle;
char expandedChar[ FL_TEXT_MAX_EXP_CHAR_LEN ];
@@ -876,7 +876,7 @@ int Fl_Text_Display::position_to_xy( int pos, int* X, int* Y ) {
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 Fl_Text_Display::position_to_linecol( int pos, int* lineNum, int* column ) const {
int retVal;
/* In continuous wrap mode, the absolute (non-wrapped) line count is
@@ -904,7 +904,7 @@ int Fl_Text_Display::position_to_linecol( int pos, int* lineNum, int* column ) {
/**
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 Fl_Text_Display::in_selection( int X, int Y ) const {
int row, column, pos = xy_to_position( X, Y, CHARACTER_POS );
Fl_Text_Buffer *buf = mBuffer;
int ok = 0;
@@ -933,7 +933,7 @@ int Fl_Text_Display::in_selection( int X, int Y ) {
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 Fl_Text_Display::wrapped_column(int row, int column) const {
int lineStart, dispLineStart;
if (!mContinuousWrap || row < 0 || row > mNVisibleLines)
@@ -953,7 +953,7 @@ int Fl_Text_Display::wrapped_column(int row, int column) {
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) {
int Fl_Text_Display::wrapped_row(int row) const{
if (!mContinuousWrap || row < 0 || row > mNVisibleLines)
return row;
return buffer()->count_lines(mFirstChar, mLineStarts[row]);
@@ -1131,7 +1131,7 @@ int Fl_Text_Display::move_down() {
by avoiding the additional step of scanning back to the last newline.
*/
int Fl_Text_Display::count_lines(int startPos, int endPos,
bool startPosIsLineStart) {
bool startPosIsLineStart) const {
int retLines, retPos, retLineStart, retLineEnd;
#ifdef DEBUG
@@ -1196,7 +1196,7 @@ int Fl_Text_Display::skip_lines(int startPos, int nLines,
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 Fl_Text_Display::line_end(int pos, bool startPosIsLineStart) const {
int retLines, retPos, retLineStart, retLineEnd;
/* If we're not wrapping use more efficien BufEndOfLine */
@@ -1215,7 +1215,7 @@ int Fl_Text_Display::line_end(int pos, bool startPosIsLineStart) {
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 Fl_Text_Display::line_start(int pos) const {
int retLines, retPos, retLineStart, retLineEnd;
/* If we're not wrapping, use the more efficient BufStartOfLine */
@@ -1448,7 +1448,7 @@ void Fl_Text_Display::maintain_absolute_top_line_number(int state) {
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() {
int Fl_Text_Display::get_absolute_top_line_number() const {
if (!mContinuousWrap)
return mTopLineNum;
if (maintaining_absolute_top_line_number())
@@ -1472,7 +1472,7 @@ 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).
*/
int Fl_Text_Display::maintaining_absolute_top_line_number() {
int Fl_Text_Display::maintaining_absolute_top_line_number() const {
return mContinuousWrap &&
(mLineNumWidth != 0 || mNeedAbsTopLineNum);
}
@@ -1491,7 +1491,7 @@ void Fl_Text_Display::reset_absolute_top_line_number() {
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 Fl_Text_Display::position_to_line( int pos, int *lineNum ) const {
int i;
*lineNum = 0;
@@ -1957,7 +1957,7 @@ void Fl_Text_Display::draw_cursor( int X, int Y ) {
be more appropriate.
*/
int Fl_Text_Display::position_style( int lineStartPos,
int lineLen, int lineIndex, int dispIndex ) {
int lineLen, int lineIndex, int dispIndex ) const {
Fl_Text_Buffer * buf = mBuffer;
Fl_Text_Buffer *styleBuf = mStyleBuffer;
int pos, style = 0;
@@ -1989,7 +1989,7 @@ int Fl_Text_Display::position_style( int lineStartPos,
/**
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 ) {
int Fl_Text_Display::string_width( const char *string, int length, int style ) const {
Fl_Font font;
int fsize;
@@ -2016,7 +2016,7 @@ int Fl_Text_Display::string_width( const char *string, int length, int style ) {
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 Fl_Text_Display::xy_to_position( int X, int Y, int posType ) const {
int charIndex, lineStart, lineLen, fontHeight;
int charWidth, charLen, charStyle, visLineNum, xStep, outIndex;
char expandedChar[ FL_TEXT_MAX_EXP_CHAR_LEN ];
@@ -2082,7 +2082,7 @@ int Fl_Text_Display::xy_to_position( int X, int Y, int posType ) {
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 ) {
int *column, int posType ) const {
int fontHeight = mMaxsize;
int fontWidth = TMPFONTWIDTH; //mFontStruct->max_bounds.width;
@@ -2479,7 +2479,7 @@ static int countlines( const char *string ) {
/**
Return the width in pixels of the displayed line pointed to by "visLineNum"
*/
int Fl_Text_Display::measure_vline( int visLineNum ) {
int Fl_Text_Display::measure_vline( int visLineNum ) const {
int i, width = 0, len, style, lineLen = vline_length( visLineNum );
int charCount = 0, lineStartPos = mLineStarts[ visLineNum ];
char expandedChar[ FL_TEXT_MAX_EXP_CHAR_LEN ];
@@ -2519,7 +2519,7 @@ int Fl_Text_Display::measure_vline( int visLineNum ) {
/**
Return true if there are lines visible with no corresponding buffer text
*/
int Fl_Text_Display::empty_vlines() {
int Fl_Text_Display::empty_vlines() const {
return mNVisibleLines > 0 &&
mLineStarts[ mNVisibleLines - 1 ] == -1;
}
@@ -2528,7 +2528,7 @@ int Fl_Text_Display::empty_vlines() {
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 Fl_Text_Display::vline_length( int visLineNum ) const {
int nextLineStart, lineStartPos;
if (visLineNum < 0 || visLineNum >= mNVisibleLines)
@@ -2794,7 +2794,7 @@ void Fl_Text_Display::measure_deleted_lines(int pos, int nDeleted) {
void Fl_Text_Display::wrapped_line_counter(Fl_Text_Buffer *buf, int startPos,
int maxPos, int maxLines, bool startPosIsLineStart, int styleBufOffset,
int *retPos, int *retLines, int *retLineStart, int *retLineEnd,
bool countLastLineMissingNewLine) {
bool countLastLineMissingNewLine) const {
int lineStart, newLineStart = 0, b, p, colNum, wrapMargin;
int maxWidth, i, foundBreak, width;
bool countPixels;
@@ -2932,7 +2932,7 @@ void Fl_Text_Display::wrapped_line_counter(Fl_Text_Buffer *buf, int startPos,
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 Fl_Text_Display::measure_proportional_character(char c, int colNum, int pos) const {
int charLen, style;
char expChar[ FL_TEXT_MAX_EXP_CHAR_LEN ];
Fl_Text_Buffer *styleBuf = mStyleBuffer;
@@ -2963,7 +2963,7 @@ int Fl_Text_Display::measure_proportional_character(char c, int colNum, int pos)
the way back to the beginning of the line.
*/
void Fl_Text_Display::find_line_end(int startPos, bool startPosIsLineStart,
int *lineEnd, int *nextLineStart) {
int *lineEnd, int *nextLineStart) const {
int retLines, retLineStart;
/* if we're not wrapping use more efficient BufEndOfLine */
@@ -2996,7 +2996,7 @@ void Fl_Text_Display::find_line_end(int startPos, bool startPosIsLineStart,
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) {
int Fl_Text_Display::wrap_uses_character(int lineEndPos) const {
char c;
if (!mContinuousWrap || lineEndPos == buffer()->length())
@@ -3011,8 +3011,8 @@ int Fl_Text_Display::wrap_uses_character(int lineEndPos) {
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) {
int Fl_Text_Display::range_touches_selection(const Fl_Text_Selection *sel,
int rangeStart, int rangeEnd) const {
return sel->selected() && sel->rectangular() && sel->end() >= rangeStart &&
sel->start() <= rangeEnd;
}

View File

@@ -246,7 +246,7 @@ int Fl::arg(int argc, char **argv, int &i) {
<LI>-geometry WxH+X+Y
<P>Sets the initial window position and size according
the the standard X geometry string.</LI>
to the standard X geometry string.</LI>
<LI>-iconic

View File

@@ -178,7 +178,7 @@ void fl_color(uchar r,uchar g,uchar b) {
}
////////////////////////////////////////////////////////////////
// Get a color out of the the fltk colormap. Again for truecolor
// Get a color out of the fltk colormap. Again for truecolor
// visuals this is easy. For colormap this actually tries to allocate
// an X color, and does a least-squares match to find the closest
// color if X cannot allocate that color.

View File

@@ -153,7 +153,7 @@ static void innards(const uchar *buf, int X, int Y, int W, int H,
bmi.bmiColors[i].rgbBlue = (uchar)i;
bmi.bmiColors[i].rgbGreen = (uchar)i;
bmi.bmiColors[i].rgbRed = (uchar)i;
bmi.bmiColors[i].rgbReserved = (uchar)i;
bmi.bmiColors[i].rgbReserved = (uchar)0; // must be zero
}
}
bmi.bmiHeader.biWidth = w;
@@ -164,6 +164,10 @@ static void innards(const uchar *buf, int X, int Y, int W, int H,
bmi.bmiHeader.biBitCount = depth*8;
int pixelsize = depth;
#endif
if (depth==2) { // special case: gray with alpha
bmi.bmiHeader.biBitCount = 32;
pixelsize = 4;
}
int linesize = (pixelsize*w+3)&~3;
static U32* buffer;
@@ -218,9 +222,13 @@ static void innards(const uchar *buf, int X, int Y, int W, int H,
for (i=w; i--; from += delta) *to++ = *from;
break;
case 2:
for (i=w; i--; from += delta) {
*to++ = *from;
*to++ = *from;
for (i=w; i--; from += delta, to += 4) {
uchar a = from[1];
uchar gray = (from[0]*a)>>8;
to[0] = gray;
to[1] = gray;
to[2] = gray;
to[3] = a;
}
break;
case 3:

View File

@@ -305,6 +305,10 @@ char Fl_Widget::label_shortcut(const char *t) {
}
int Fl_Widget::test_shortcut(const char *t) {
#ifdef WIN32
// on MSWindows, users expect shortcuts to work only when the Alt modifier is pressed
if (Fl::event_state(FL_ALT)==0) return 0;
#endif
char c = Fl::event_text()[0];
if (!c || !t) return 0;
if (c == label_shortcut(t))

View File

@@ -105,7 +105,7 @@ static unsigned short cp1252[32] = {
/*! Decode a single UTF-8 encoded character starting at \e p. The
resulting Unicode value (in the range 0-0x10ffff) is returned,
and \e len is set the the number of bytes in the UTF-8 encoding
and \e len is set to the number of bytes in the UTF-8 encoding
(adding \e len to \e p will point at the next character).
If \p p points at an illegal UTF-8 encoding, including one that