From 1aa6c4fed823e74ded911a134065e2619ad53bf1 Mon Sep 17 00:00:00 2001 From: Matthias Melcher Date: Thu, 2 Feb 2023 20:54:19 +0100 Subject: [PATCH] Fix position() methods that shadow Fl_Widget::position() * `FL_DEPRECATED` macro to mark `position()` method that shadow `Fl_Widget::position()` #69 (#666) --- CMake/fl_create_example.cmake | 4 +- FL/Fl_Browser_.H | 11 ++- FL/Fl_Input_.H | 26 ++++-- FL/Fl_Text_Buffer.H | 4 +- FL/Fl_Tile.H | 5 +- FL/fl_attr.h | 169 +++++++++++++++++++++++++--------- FL/forms.H | 6 +- fltk-options/CMakeLists.txt | 1 + fluid/CMakeLists.txt | 1 + fluid/Fl_Type.cxx | 2 +- fluid/widget_browser.cxx | 8 +- src/Fl_Browser.cxx | 2 +- src/Fl_Browser_.cxx | 28 +++--- src/Fl_File_Chooser2.cxx | 10 +- src/Fl_Input.cxx | 118 ++++++++++++------------ src/Fl_Input_.cxx | 36 ++++---- src/Fl_Screen_Driver.cxx | 2 +- src/Fl_Text_Buffer.cxx | 14 +-- src/Fl_Tile.cxx | 4 +- src/Fl_Value_Input.cxx | 2 +- test/browser.cxx | 2 +- test/glpuzzle.cxx | 4 +- test/input.cxx | 2 +- test/keyboard.cxx | 4 +- test/line_style.cxx | 6 +- test/unittest_unicode.cxx | 2 +- 26 files changed, 286 insertions(+), 187 deletions(-) diff --git a/CMake/fl_create_example.cmake b/CMake/fl_create_example.cmake index 1e3f28e13..303b5ea41 100644 --- a/CMake/fl_create_example.cmake +++ b/CMake/fl_create_example.cmake @@ -138,8 +138,10 @@ function (CREATE_EXAMPLE NAME SOURCES LIBRARIES) "${CMAKE_CURRENT_SOURCE_DIR}/mac-resources/${PLIST}") endif() + string(REPLACE "_" "-" FLTK_BUNDLE_ID "org.fltk.${TARGET_NAME}") set_target_properties (${TARGET_NAME} PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "${TARGET_NAME}") - set_target_properties (${TARGET_NAME} PROPERTIES MACOSX_BUNDLE_GUI_IDENTIFIER "org.fltk.${TARGET_NAME}") + set_target_properties (${TARGET_NAME} PROPERTIES MACOSX_BUNDLE_GUI_IDENTIFIER "${FLTK_BUNDLE_ID}") + set_target_properties (${TARGET_NAME} PROPERTIES XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER "${FLTK_BUNDLE_ID}") if (ICON_NAME) set_target_properties (${TARGET_NAME} PROPERTIES MACOSX_BUNDLE_ICON_FILE ${ICON_NAME}) diff --git a/FL/Fl_Browser_.H b/FL/Fl_Browser_.H index 03550b67a..207bd7082 100644 --- a/FL/Fl_Browser_.H +++ b/FL/Fl_Browser_.H @@ -243,8 +243,15 @@ public: 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 + int vposition() const { return position_; } + FL_DEPRECATED("Please use vposition() instead.", + int position() const) { return vposition(); } + + void vposition(int pos); // scroll to here + FL_DEPRECATED("Please use vposition(pos) instead.", + void position(int pos)) { return vposition(pos); } + void position(int x, int y) { Fl_Group::position(x, y); } + /** 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 diff --git a/FL/Fl_Input_.H b/FL/Fl_Input_.H index 7d3f90cc3..6c1a3eea4 100644 --- a/FL/Fl_Input_.H +++ b/FL/Fl_Input_.H @@ -282,31 +282,37 @@ public: /** Gets the position of the text cursor. \return the cursor position as an index in the range 0..size() - \see position(int, int) + \see insert_position(int, int) */ - int position() const {return position_;} + int insert_position() const { return position_; } + FL_DEPRECATED("Please use insert_position() instead.", + int position() const ) { return insert_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); + int insert_position(int p, int m); + FL_DEPRECATED("Please use insert_position(p, m) or Fl_Widget::position(x, y) instead.", + int position(int p, int m)) { return insert_position(p, m); } /** Sets 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) + \see insert_position(int, int), insert_position(), mark(int) */ - int position(int p) {return position(p, p);} + int insert_position(int p) { return insert_position(p, p); } + FL_DEPRECATED("Please use insert_position(p) instead.", + int position(int p)) { return insert_position(p); } /** Sets the current selection mark. - mark(n) is the same as position(position(),n). + mark(n) is the same as insert_position(insert_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);} + \see insert_position(), insert_position(int, int) */ + int mark(int m) {return insert_position(insert_position(), m);} /* Deletes text from \p b to \p e and inserts the new string \p text. */ int replace(int b, int e, const char *text, int ilen=0); @@ -321,7 +327,7 @@ public: \return 0 if no data was copied */ - int cut() {return replace(position(), mark(), 0);} + int cut() {return replace(insert_position(), mark(), 0);} /** Deletes the next \p n bytes rounded to characters before or after the cursor. @@ -335,7 +341,7 @@ public: 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);} + int cut(int n) {return replace(insert_position(), insert_position()+n, 0);} /** Deletes all characters between index \p a and \p b. diff --git a/FL/Fl_Text_Buffer.H b/FL/Fl_Text_Buffer.H index 727b2a65d..b4e65f8f8 100644 --- a/FL/Fl_Text_Buffer.H +++ b/FL/Fl_Text_Buffer.H @@ -164,7 +164,9 @@ public: int includes(int pos) const; // Returns true if selected() and the positions of this selection. - int position(int *startpos, int *endpos) const; + int selected(int *startpos, int *endpos) const; + FL_DEPRECATED("Please use selected(startpos, endpos) instead.", + int position(int *startpos, int *endpos) const) { return selected(startpos, endpos); } protected: diff --git a/FL/Fl_Tile.H b/FL/Fl_Tile.H index 52d14210c..d6003c286 100644 --- a/FL/Fl_Tile.H +++ b/FL/Fl_Tile.H @@ -29,7 +29,10 @@ public: int handle(int event) FL_OVERRIDE; Fl_Tile(int X, int Y, int W, int H, const char *L=0); void resize(int X, int Y, int W, int H) FL_OVERRIDE; - void position(int oldx, int oldy, int newx, int newy); + void move_intersection(int oldx, int oldy, int newx, int newy); + FL_DEPRECATED("Please use move_intersection(p) instead.", + void position(int oldx, int oldy, int newx, int newy)) { return move_intersection(oldx, oldy, newx, newy); } + void position(int x, int y) { Fl_Group::position(x, y); } }; #endif diff --git a/FL/fl_attr.h b/FL/fl_attr.h index b8f7d24c4..a75f0c0d8 100644 --- a/FL/fl_attr.h +++ b/FL/fl_attr.h @@ -22,13 +22,14 @@ #ifndef _FL_fl_attr_h_ #define _FL_fl_attr_h_ -#ifdef FL_DOXYGEN /** - This macro makes it safe to use the C++11 keyword \c override with - older compilers. -*/ -#define FL_OVERRIDE override + This section lists macros for Doxygen documentation only. The next section + will define the actual macros based on the compile used and based on the + capabilities of the version of that compiler. + */ +#ifdef FL_DOXYGEN + /** To be used in prototypes with a variable list of arguments. This macro helps detection of mismatches between format string and @@ -38,67 +39,143 @@ */ #define __fl_attr(x) +/** + This macro makes it safe to use the C++11 keyword \c override with + older compilers. +*/ +#define FL_OVERRIDE override + +/** + Enclosing a function or method in FL_DEPRECATED marks it as no longer + recommended. This macro syntax can not be used if the return type contains + a comma, which is not the case in FLTK. + + \code + FL_DEPRECATED("Outdated, don't use", int position()) { return position_; } + \endcode + */ +#define FL_DEPRECATED(msg, func) [[deprecated(msg)]] func + + #else /* - The GNUC-specific attribute appearing below in prototypes with a variable - list of arguments helps detection of mismatches between format string and - argument list at compilation time. + Declare macros specific to Visual Studio. - Examples: see fl_ask.H -*/ + Visual Studio defines __cplusplus = '199711L' in all its versions which is + not helpful for us here. For VS version number encoding see: + https://learn.microsoft.com/en-us/cpp/preprocessor/predefined-macros + */ -#ifdef __GNUC__ -# define __fl_attr(x) __attribute__ (x) -#else -# define __fl_attr(x) -#endif - - -#ifdef __cplusplus - -// Visual Studio defines __cplusplus = '199711L' which is not helpful. -// We assume that Visual Studio 2015 (1900) and later support the -// 'override' keyword. For VS version number encoding see: -// https://learn.microsoft.com/en-us/cpp/preprocessor/predefined-macros - -#if defined(_MSC_VER) && (_MSC_VER >= 1900) +#if defined(_MSC_VER) +#if (_MSC_VER >= 1900) // Visual Studio 2015 (14.0) +#ifndef FL_OVERRIDE #define FL_OVERRIDE override - -#else // not Visual Studio or an older version - -#if (__cplusplus >= 202002L) -// put here definitions applying to C++20 and above #endif +#endif // Visual Studio 2015 (14.0) -#if (__cplusplus >= 201703L) -// put here definitions applying to C++17 and above +#if (_MSC_VER >= 1400) // Visual Studio 2005 (8.0) +#ifndef FL_DEPRECATED +#define FL_DEPRECATED(msg, func) __declspec(deprecated(msg)) func #endif +#endif // Visual Studio 2005 (8.0) -#if (__cplusplus >= 201402L) -// put here definitions applying to C++14 and above +#if (_MSC_VER >= 1310) // Visual Studio .NET 2003 (7.1) +#ifndef FL_DEPRECATED +#define FL_DEPRECATED(msg, func) __declspec(deprecated) func #endif +#endif // Visual Studio .NET 2003 (7.1) -#if (__cplusplus >= 201103L) -// put here definitions applying to C++11 and above +#endif // Visual Studio + + +/* + Declare macros specific to the C++ standard used. + + Macros may have been declared already in previous sections. + */ +#if (__cplusplus >= 202002L) // C++20 +#endif // C++20 + +#if (__cplusplus >= 201703L) // C++17 +#endif // C++17 + +#if (__cplusplus >= 201402L) // C++14 +#ifndef FL_DEPRECATED +#define FL_DEPRECATED(msg, func) [[deprecated(msg)]] func +#endif +#endif // C++14 + +#if (__cplusplus >= 201103L) // C++11 +#ifndef FL_OVERRIDE #define FL_OVERRIDE override -#else -// replace non-existing `override` with no-op +#endif +#endif // C+11 + +#if (__cplusplus >= 199711L) // C++89 +#endif // C++89 + + +/* + Declare macros specific to clang + + Macros may have been declared already in previous sections. + */ +#if defined(__clang__) + +#define FL_CLANG_VERSION (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__) + +// -- nothing yet -- + +#endif // __clang__ + + +/* + Declare macros specific to gcc. + + Macros may have been declared already in previous sections. + */ +#if defined(__GNUC__) + +#define FL_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) + +#ifndef __fl_attr +#define __fl_attr(x) __attribute__ (x) +#endif + +#if FL_GCC_VERSION > 40500 // gcc 4.5.0 +#ifndef FL_DEPRECATED +#define FL_DEPRECATED(msg, func) func __attribute__((deprecated(msg))) +#endif +#endif // gcc 4.5.0 + +#if FL_GCC_VERSION > 30100 // gcc 3.1.0 +#ifndef FL_DEPRECATED +#define FL_DEPRECATED(msg, func) func __attribute__((deprecated)) +#endif +#endif // gcc 3.1.0 + +#endif // __GNUC__ + + +/* + If a macro was not defined in any of the sections above, set it to no-op here. + */ + +#ifndef __fl_attr +#define __fl_attr(x) +#endif + +#ifndef FL_OVERRIDE #define FL_OVERRIDE #endif -#if (__cplusplus >= 199711L) -// put here definitions applying to C++98 and above +#ifndef FL_DEPRECATED +#define FL_DEPRECATED(msg, func) func #endif -#endif /* not Visual Studio */ - -#else -/* C, not C++ */ - -#endif /* __cplusplus */ #endif /* FL_DOXYGEN */ diff --git a/FL/forms.H b/FL/forms.H index a25a1c936..594ef0c6d 100644 --- a/FL/forms.H +++ b/FL/forms.H @@ -682,7 +682,7 @@ inline void fl_set_input_color(Fl_Widget* o, Fl_Color a, Fl_Color b) { } // inline void fl_set_input_scroll(Fl_Widget*, int); inline void fl_set_input_cursorpos(Fl_Widget* o, int x, int /*y*/) { - ((Fl_Input*)o)->position(x);} + ((Fl_Input*)o)->insert_position(x);} // inline void fl_set_input_selected(Fl_Widget*, int); // inline void fl_set_input_selected_range(Fl_Widget*, int, int); // inline void fl_set_input_maxchars(Fl_Widget*, int); @@ -695,7 +695,7 @@ inline void fl_set_input_cursorpos(Fl_Widget* o, int x, int /*y*/) { // inline int fl_get_input_topline(Fl_Widget*); // inline int fl_get_input_screenlines(Fl_Widget*); inline int fl_get_input_cursorpos(Fl_Widget* o, int*x, int*y) { - *x = ((Fl_Input*)o)->position(); *y = 0; return *x;} + *x = ((Fl_Input*)o)->insert_position(); *y = 0; return *x;} // inline int fl_get_input_numberoflines(Fl_Widget*); // inline void fl_get_input_format(Fl_Widget*, int*, int*); inline const char* fl_get_input(Fl_Widget* o) {return ((Fl_Input*)o)->value();} @@ -721,7 +721,7 @@ inline void fl_delete_menu_item(Fl_Widget* o, int i) { inline void fl_set_menu_item_shortcut(Fl_Widget* o, int i, const char* s) { ((Fl_Menu_Button*)o)->shortcut(i-1,fl_old_shortcut(s));} inline void fl_set_menu_item_mode(Fl_Widget* o, int i, long x) { - ((Fl_Menu_Button*)o)->mode(i-1,x);} + ((Fl_Menu_Button*)o)->mode(i-1,(int)x);} inline void fl_show_menu_symbol(Fl_Widget*, int ) { /* ((Fl_Menu_Button*)o)->show_menu_symbol(i); */} // inline void fl_set_menu_popup(Fl_Widget*, int); diff --git a/fltk-options/CMakeLists.txt b/fltk-options/CMakeLists.txt index 40825cd60..7f289ab92 100644 --- a/fltk-options/CMakeLists.txt +++ b/fltk-options/CMakeLists.txt @@ -96,6 +96,7 @@ if (APPLE AND (NOT OPTION_APPLE_X11)) # create bundle set_target_properties (fltk-options PROPERTIES MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/fltk-options.plist") set_target_properties (fltk-options PROPERTIES MACOSX_BUNDLE_ICON_FILE ${ICON_NAME}) + set_target_properties (fltk-options PROPERTIES XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER "org.fltk.fltk-options") # The line below would wrongly install /Applications/fltk-options.icns # ## set_target_properties (fltk-options PROPERTIES RESOURCE ${ICON_PATH}) diff --git a/fluid/CMakeLists.txt b/fluid/CMakeLists.txt index 50983c149..a7a0d08df 100644 --- a/fluid/CMakeLists.txt +++ b/fluid/CMakeLists.txt @@ -158,6 +158,7 @@ if (APPLE AND (NOT OPTION_APPLE_X11)) # create bundle set_target_properties (fluid PROPERTIES MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/fluid.plist") set_target_properties (fluid PROPERTIES MACOSX_BUNDLE_ICON_FILE ${ICON_NAME}) + set_target_properties (fluid PROPERTIES XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER "org.fltk.fluid") # The line below would wrongly install /Applications/fluid.icns # ## set_target_properties (fluid PROPERTIES RESOURCE ${ICON_PATH}) diff --git a/fluid/Fl_Type.cxx b/fluid/Fl_Type.cxx index a662dbb93..c3b1cbbf4 100644 --- a/fluid/Fl_Type.cxx +++ b/fluid/Fl_Type.cxx @@ -192,7 +192,7 @@ void delete_all(int selected_only) { shell_prefs_get(); shell_settings_write(); widget_browser->hposition(0); - widget_browser->position(0); + widget_browser->vposition(0); } selection_changed(0); widget_browser->redraw(); diff --git a/fluid/widget_browser.cxx b/fluid/widget_browser.cxx index ec59d7d25..089184511 100644 --- a/fluid/widget_browser.cxx +++ b/fluid/widget_browser.cxx @@ -512,7 +512,7 @@ int Widget_Browser::handle(int e) { */ void Widget_Browser::save_scroll_position() { saved_h_scroll_ = hposition(); - saved_v_scroll_ = position(); + saved_v_scroll_ = vposition(); } /** @@ -520,7 +520,7 @@ void Widget_Browser::save_scroll_position() { */ void Widget_Browser::restore_scroll_position() { hposition(saved_h_scroll_); - position(saved_v_scroll_); + vposition(saved_v_scroll_); } /** @@ -546,7 +546,7 @@ void Widget_Browser::display(Fl_Type *inNode) { return; } // remeber our current scroll position - int currentV = position(), newV = currentV; + int currentV = vposition(), newV = currentV; int nodeV = 0; // find the inNode in the tree and check, if it is already visible Fl_Type *p=Fl_Type::first; @@ -571,6 +571,6 @@ void Widget_Browser::display(Fl_Type *inNode) { newV = 0; } if (newV!=currentV) - position(newV); + vposition(newV); } diff --git a/src/Fl_Browser.cxx b/src/Fl_Browser.cxx index 80d6af811..e78ccee30 100644 --- a/src/Fl_Browser.cxx +++ b/src/Fl_Browser.cxx @@ -634,7 +634,7 @@ void Fl_Browser::lineposition(int line, Fl_Line_Position pos) { } if (final > (full_height() - H)) final = full_height() -H; - position(final); + vposition(final); } /** diff --git a/src/Fl_Browser_.cxx b/src/Fl_Browser_.cxx index 29d3fada9..d2dcbc39e 100644 --- a/src/Fl_Browser_.cxx +++ b/src/Fl_Browser_.cxx @@ -49,7 +49,7 @@ */ static void scrollbar_callback(Fl_Widget* s, void*) { - ((Fl_Browser_*)(s->parent()))->position(int(((Fl_Scrollbar*)s)->value())); + ((Fl_Browser_*)(s->parent()))->vposition(int(((Fl_Scrollbar*)s)->value())); } static void hscrollbar_callback(Fl_Widget* s, void*) { @@ -181,7 +181,7 @@ void Fl_Browser_::update_top() { } } -// Change position(), top() will update when update_top() is called +// Change vposition(), top() will update when update_top() is called // (probably by draw() or handle()): /** Sets the vertical scroll position of the list to pixel position \p pos. @@ -189,9 +189,9 @@ void Fl_Browser_::update_top() { 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() + \see vposition(), hposition() */ -void Fl_Browser_::position(int pos) { +void Fl_Browser_::vposition(int pos) { if (pos < 0) pos = 0; if (pos == position_) return; position_ = pos; @@ -204,7 +204,7 @@ void Fl_Browser_::position(int pos) { 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() + \see vposition(), hposition() */ void Fl_Browser_::hposition(int pos) { if (pos < 0) pos = 0; @@ -244,7 +244,7 @@ void Fl_Browser_::display(void* item) { // First special case - want to display first item in the list? update_top(); - if (item == item_first()) {position(0); return;} + if (item == item_first()) { vposition(0); return; } int X, Y, W, H, Yp; bbox(X, Y, W, H); void* l = top_; @@ -252,11 +252,11 @@ void Fl_Browser_::display(void* item) { int h1; // 2nd special case - want to display item already displayed at top of browser? - if (l == item) {position(real_position_+Y); return;} // scroll up a bit + if (l == item) { vposition(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 == item) {position(real_position_+Y-item_quick_height(lp)); return;} + if (lp == item) { vposition(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, @@ -268,9 +268,9 @@ void Fl_Browser_::display(void* item) { 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 + if (Y > 0) vposition(real_position_+Y); // scroll down a bit } else { - position(real_position_+Y-(H-h1)/2); // center it + vposition(real_position_+Y-(H-h1)/2); // center it } return; } @@ -281,8 +281,8 @@ void Fl_Browser_::display(void* item) { h1 = item_quick_height(lp); Yp -= h1; if (lp == item) { - if ((Yp + h1) >= 0) position(real_position_+Yp); - else position(real_position_+Yp-(H-h1)/2); + if ((Yp + h1) >= 0) vposition(real_position_+Yp); + else vposition(real_position_+Yp-(H-h1)/2); return; } lp = item_prev(lp); @@ -871,12 +871,12 @@ J1: if (my < Y && my < py) { int p = real_position_+my-Y; if (p<0) p = 0; - position(p); + vposition(p); } else if (my > (Y+H) && my > py) { int p = real_position_+my-(Y+H); int hh = full_height()-H; if (p > hh) p = hh; if (p<0) p = 0; - position(p); + vposition(p); } if (type() == FL_NORMAL_BROWSER || !top_) ; diff --git a/src/Fl_File_Chooser2.cxx b/src/Fl_File_Chooser2.cxx index 037598c85..c73938f5e 100644 --- a/src/Fl_File_Chooser2.cxx +++ b/src/Fl_File_Chooser2.cxx @@ -801,7 +801,7 @@ Fl_File_Chooser::fileNameCB() if (dirIsRelative) { fl_filename_absolute(pathname, sizeof(pathname), filename); value(pathname); - fileName->mark(fileName->position()); // no selection after expansion + fileName->mark(fileName->insert_position()); // no selection after expansion } else if (filename != pathname) { // Finally, make sure that we have a writable copy... strlcpy(pathname, filename, sizeof(pathname)); @@ -848,7 +848,7 @@ Fl_File_Chooser::fileNameCB() int condition = Fl::system_driver()->case_insensitive_filenames() ? strcasecmp(pathname, directory_) : strcmp(pathname, directory_); if (condition && (pathname[0] || strcmp("/", directory_))) { - int p = fileName->position(); + int p = fileName->insert_position(); int m = fileName->mark(); directory(pathname); @@ -861,7 +861,7 @@ Fl_File_Chooser::fileNameCB() strlcpy(pathname, tempname, sizeof(pathname)); } - fileName->position(p, m); + fileName->insert_position(p, m); } // Other key pressed - do filename completion as possible... @@ -922,7 +922,7 @@ Fl_File_Chooser::fileNameCB() // Highlight it with the cursor at the end of the selection so // s/he can press the right arrow to accept the selection // (Tab and End also do this for both cases.) - fileName->position( + fileName->insert_position( (int) (filename - pathname + max_match), (int) (filename - pathname + min_match)); } else if (max_match == 0) { @@ -1527,7 +1527,7 @@ Fl_File_Chooser::value(const char *filename) if (slash > pathname) slash[-1] = '/'; fileName->value(pathname); - fileName->position(0, (int) strlen(pathname)); + fileName->insert_position(0, (int) strlen(pathname)); okButton->activate(); // Then find the file in the file list and select it... diff --git a/src/Fl_Input.cxx b/src/Fl_Input.cxx index 5edbc37cc..c191bfc6e 100644 --- a/src/Fl_Input.cxx +++ b/src/Fl_Input.cxx @@ -54,7 +54,7 @@ void Fl_Input::draw() { // kludge so shift causes selection to extend: int Fl_Input::shift_position(int p) { - return position(p, Fl::event_state(FL_SHIFT) ? mark() : p); + return insert_position(p, Fl::event_state(FL_SHIFT) ? mark() : p); } int Fl_Input::shift_up_down_position(int p) { @@ -93,7 +93,7 @@ static const char *legal_fp_chars = ".eE+-"; // If OPTION_ARROW_FOCUS is disabled, return 1 to prevent focus navigation. // int Fl_Input::kf_lines_up(int repeat_num) { - int i = position(); + int i = insert_position(); if (!line_start(i)) { //UNNEEDED if (input_type()==FL_MULTILINE_INPUT && !Fl::option(Fl::OPTION_ARROW_FOCUS)) return 1; return NORMAL_INPUT_MOVE; @@ -111,7 +111,7 @@ int Fl_Input::kf_lines_up(int repeat_num) { // If OPTION_ARROW_FOCUS is disabled, return 1 to prevent focus navigation. // int Fl_Input::kf_lines_down(int repeat_num) { - int i = position(); + int i = insert_position(); if (line_end(i) >= size()) { //UNNEEDED if (input_type()==FL_MULTILINE_INPUT && !Fl::option(Fl::OPTION_ARROW_FOCUS)) return 1; return NORMAL_INPUT_MOVE; @@ -144,66 +144,66 @@ int Fl_Input::kf_insert_toggle() { // Delete word right int Fl_Input::kf_delete_word_right() { if (readonly()) { fl_beep(); return 1; } - if (mark() != position()) return cut(); - cut(position(), word_end(position())); + if (mark() != insert_position()) return cut(); + cut(insert_position(), word_end(insert_position())); return 1; } // Delete word left int Fl_Input::kf_delete_word_left() { if (readonly()) { fl_beep(); return 1; } - if (mark() != position()) return cut(); - cut(word_start(position()), position()); + if (mark() != insert_position()) return cut(); + cut(word_start(insert_position()), insert_position()); return 1; } // Delete to start of line int Fl_Input::kf_delete_sol() { if (readonly()) { fl_beep(); return 1; } - if (mark() != position()) return cut(); - cut(line_start(position()), position()); + if (mark() != insert_position()) return cut(); + cut(line_start(insert_position()), insert_position()); return 1; } // Delete to end of line int Fl_Input::kf_delete_eol() { if (readonly()) { fl_beep(); return 1; } - if (mark() != position()) return cut(); - cut(position(), line_end(position())); + if (mark() != insert_position()) return cut(); + cut(insert_position(), line_end(insert_position())); return 1; } int Fl_Input::kf_delete_char_right() { if (readonly()) { fl_beep(); return 1; } - if (mark() != position()) cut(); + if (mark() != insert_position()) cut(); else cut(1); return 1; } int Fl_Input::kf_delete_char_left() { if (readonly()) { fl_beep(); return 1; } - if (mark() != position()) cut(); + if (mark() != insert_position()) cut(); else cut(-1); return 1; } // Move cursor to start of line int Fl_Input::kf_move_sol() { - return shift_position(line_start(position())) + NORMAL_INPUT_MOVE; + return shift_position(line_start(insert_position())) + NORMAL_INPUT_MOVE; } // Move cursor to end of line int Fl_Input::kf_move_eol() { - return shift_position(line_end(position())) + NORMAL_INPUT_MOVE; + return shift_position(line_end(insert_position())) + NORMAL_INPUT_MOVE; } // Clear to end of line int Fl_Input::kf_clear_eol() { if (readonly()) { fl_beep(); return 1; } - if (position()>=size()) return 0; - int i = line_end(position()); - if (i == position() && i < size()) i++; - cut(position(), i); + if (insert_position()>=size()) return 0; + int i = line_end(insert_position()); + if (i == insert_position() && i < size()) i++; + cut(insert_position(), i); return copy_cuts(); } @@ -211,7 +211,7 @@ int Fl_Input::kf_clear_eol() { // If OPTION_ARROW_FOCUS is disabled, return 1 to prevent focus navigation. // int Fl_Input::kf_move_char_left() { - int i = shift_position(position()-1) + NORMAL_INPUT_MOVE; + int i = shift_position(insert_position()-1) + NORMAL_INPUT_MOVE; return Fl::option(Fl::OPTION_ARROW_FOCUS) ? i : 1; } @@ -219,36 +219,36 @@ int Fl_Input::kf_move_char_left() { // If OPTION_ARROW_FOCUS is disabled, return 1 to prevent focus navigation. // int Fl_Input::kf_move_char_right() { - int i = shift_position(position()+1) + NORMAL_INPUT_MOVE; + int i = shift_position(insert_position()+1) + NORMAL_INPUT_MOVE; return Fl::option(Fl::OPTION_ARROW_FOCUS) ? i : 1; } // Move cursor word-left int Fl_Input::kf_move_word_left() { - shift_position(word_start(position())); + shift_position(word_start(insert_position())); return 1; } // Move cursor word-right int Fl_Input::kf_move_word_right() { - shift_position(word_end(position())); + shift_position(word_end(insert_position())); return 1; } // Move cursor up one line and to the start of line (paragraph up) int Fl_Input::kf_move_up_and_sol() { - if (line_start(position())==position() && position()>0) - return shift_position(line_start(position()-1)) + NORMAL_INPUT_MOVE; + if (line_start(insert_position())==insert_position() && insert_position()>0) + return shift_position(line_start(insert_position()-1)) + NORMAL_INPUT_MOVE; else - return shift_position(line_start(position())) + NORMAL_INPUT_MOVE; + return shift_position(line_start(insert_position())) + NORMAL_INPUT_MOVE; } // Move cursor down one line and to the end of line (paragraph down) int Fl_Input::kf_move_down_and_eol() { - if (line_end(position())==position() && position()= '0' && ascii <= '9') @@ -358,18 +358,18 @@ int Fl_Input::handle_key() { || (input_type()==FL_FLOAT_INPUT && ascii && strchr(legal_fp_chars, ascii))) { if (readonly()) fl_beep(); - else replace(position(), mark(), &ascii, 1); + else replace(insert_position(), mark(), &ascii, 1); } return 1; } if (del || Fl::event_length()) { if (readonly()) fl_beep(); - else replace(position(), del ? position()-del : mark(), + else replace(insert_position(), del ? insert_position()-del : mark(), Fl::event_text(), Fl::event_length()); } if (Fl::screen_driver()->has_marked_text() && Fl::compose_state) { - this->mark( this->position() - Fl::compose_state ); + this->mark( this->insert_position() - Fl::compose_state ); } return 1; } @@ -408,11 +408,11 @@ int Fl_Input::handle_key() { case FL_Enter: case FL_KP_Enter: if (when() & FL_WHEN_ENTER_KEY) { - position(size(), 0); + insert_position(size(), 0); maybe_do_callback(); return 1; } else if (multiline && !readonly()) { - return replace(position(), mark(), "\n", 1); + return replace(insert_position(), mark(), "\n", 1); } return 0; // reserved for shortcuts case FL_Tab: @@ -455,7 +455,7 @@ int Fl_Input::handle_key() { if (readonly()) { fl_beep(); return 1; } // insert a few selected control characters literally: if (input_type() != FL_FLOAT_INPUT && input_type() != FL_INT_INPUT) - return replace(position(), mark(), &ascii, 1); + return replace(insert_position(), mark(), &ascii, 1); break; } @@ -468,17 +468,17 @@ int Fl_Input::handle(int event) { switch (event) { case FL_UNFOCUS: if (Fl::screen_driver()->has_marked_text() && Fl::compose_state) { - this->mark( this->position() ); + this->mark( this->insert_position() ); fl_reset_spot(); } break; case FL_FOCUS: switch (Fl::event_key()) { case FL_Right: - position(0); + insert_position(0); break; case FL_Left: - position(size()); + insert_position(size()); break; case FL_Down: up_down_position(0); @@ -487,10 +487,10 @@ int Fl_Input::handle(int event) { up_down_position(line_start(size())); break; case FL_Tab: - position(size(),0); + insert_position(size(),0); break; default: - position(position(),mark());// turns off the saved up/down arrow position + insert_position(insert_position(),mark());// turns off the saved up/down arrow position break; } break; @@ -505,12 +505,12 @@ int Fl_Input::handle(int event) { && !tab_nav() // with tab navigation disabled? && input_type() == FL_MULTILINE_INPUT // with a multiline input? && size() > 0 // non-empty field? - && ((mark()==0 && position()==size()) || (position()==0 && mark()==size()))) {// while entire field selected? + && ((mark()==0 && insert_position()==size()) || (insert_position()==0 && mark()==size()))) {// while entire field selected? // Set cursor to the end of the selection... - if (mark() > position()) - position(mark()); + if (mark() > insert_position()) + insert_position(mark()); else - position(position()); + insert_position(insert_position()); return (1); } else { if (active_r() && window() && this == Fl::belowmouse()) @@ -521,15 +521,15 @@ int Fl_Input::handle(int event) { case FL_PUSH: if (Fl::dnd_text_ops()) { - int oldpos = position(), oldmark = mark(); + int oldpos = insert_position(), oldmark = mark(); Fl_Boxtype b = box(); Fl_Input_::handle_mouse(x()+Fl::box_dx(b), y()+Fl::box_dy(b), w()-Fl::box_dw(b), h()-Fl::box_dh(b), 0); - newpos = position(); - position( oldpos, oldmark ); + newpos = insert_position(); + insert_position( oldpos, oldmark ); if (Fl::focus()==this && !Fl::event_state(FL_SHIFT) && input_type()!=FL_SECRET_INPUT && - ( (newpos >= mark() && newpos < position()) || - (newpos >= position() && newpos < mark()) ) ) { + ( (newpos >= mark() && newpos < insert_position()) || + (newpos >= insert_position() && newpos < mark()) ) ) { // user clicked in the selection, may be trying to drag drag_start = newpos; return 1; @@ -548,7 +548,7 @@ int Fl_Input::handle(int event) { if (drag_start >= 0) { if (Fl::event_is_click()) return 1; // debounce the mouse // save the position because sometimes we don't get DND_ENTER: - dnd_save_position = position(); + dnd_save_position = insert_position(); dnd_save_mark = mark(); dnd_save_focus = this; // drag the data: @@ -568,7 +568,7 @@ int Fl_Input::handle(int event) { copy(0); } else if (Fl::event_is_click() && drag_start >= 0) { // user clicked in the field and wants to reset the cursor position... - position(drag_start, drag_start); + insert_position(drag_start, drag_start); drag_start = -1; } else if (Fl::event_clicks()) { // user double or triple clicked to select word or whole text @@ -584,7 +584,7 @@ int Fl_Input::handle(int event) { case FL_DND_ENTER: Fl::belowmouse(this); // send the leave events first if (dnd_save_focus != this) { - dnd_save_position = position(); + dnd_save_position = insert_position(); dnd_save_mark = mark(); dnd_save_focus = Fl::focus(); Fl::focus(this); @@ -608,7 +608,7 @@ int Fl_Input::handle(int event) { return 1; case FL_DND_LEAVE: - position(dnd_save_position, dnd_save_mark); + insert_position(dnd_save_position, dnd_save_mark); #ifdef DND_OUT_XXXX if (!focused()) #endif @@ -624,7 +624,7 @@ int Fl_Input::handle(int event) { if (dnd_save_focus == this) { // if the dragged text comes from the same widget if (!readonly()) { // remove the selected text - int old_position = position(); + int old_position = insert_position(); if (dnd_save_mark > dnd_save_position) { int tmp = dnd_save_mark; dnd_save_mark = dnd_save_position; @@ -632,9 +632,9 @@ int Fl_Input::handle(int event) { } replace(dnd_save_mark, dnd_save_position, NULL, 0); if (old_position > dnd_save_position) - position(old_position - (dnd_save_position - dnd_save_mark)); + insert_position(old_position - (dnd_save_position - dnd_save_mark)); else - position(old_position); + insert_position(old_position); } // !readonly() } // from the same widget else if (dnd_save_focus) { @@ -715,7 +715,7 @@ Fl_Secret_Input::Fl_Secret_Input(int X,int Y,int W,int H,const char *l) int Fl_Secret_Input::handle(int event) { int retval = Fl_Input::handle(event); if (event == FL_KEYBOARD && Fl::screen_driver()->has_marked_text() && Fl::compose_state) { - this->mark( this->position() ); // don't underline marked text + this->mark( this->insert_position() ); // don't underline marked text } return retval; } diff --git a/src/Fl_Input_.cxx b/src/Fl_Input_.cxx index 88093bffe..a8f168b0e 100644 --- a/src/Fl_Input_.cxx +++ b/src/Fl_Input_.cxx @@ -261,10 +261,10 @@ void Fl_Input_::drawtext(int X, int Y, int W, int H) { int selstart, selend; if (Fl::focus()!=this && /*Fl::selection_owner()!=this &&*/ Fl::pushed()!=this) selstart = selend = 0; - else if (position() <= mark()) { - selstart = position(); selend = mark(); + else if (insert_position() <= mark()) { + selstart = insert_position(); selend = mark(); } else { - selend = position(); selstart = mark(); + selend = insert_position(); selstart = mark(); } setfont(); @@ -279,8 +279,8 @@ void Fl_Input_::drawtext(int X, int Y, int W, int H) { int curx, cury; for (p=value(), curx=cury=lines=0; ;) { e = expand(p, buf); - if (position() >= p-value() && position() <= e-value()) { - curx = int(expandpos(p, value()+position(), buf, 0)+.5); + if (insert_position() >= p-value() && insert_position() <= e-value()) { + curx = int(expandpos(p, value()+insert_position(), buf, 0)+.5); if (Fl::focus()==this && !was_up_down) up_down_pos = curx; cury = lines*height; int newscroll = xscroll_; @@ -405,10 +405,10 @@ void Fl_Input_::drawtext(int X, int Y, int W, int H) { if (Fl::focus() == this && ( (Fl::screen_driver()->has_marked_text() && Fl::compose_state) || selstart == selend) && - position() >= p-value() && position() <= e-value()) { + insert_position() >= p-value() && insert_position() <= e-value()) { fl_color(cursor_color()); // cursor position may need to be recomputed (see STR #2486) - curx = int(expandpos(p, value()+position(), buf, 0)+.5); + curx = int(expandpos(p, value()+insert_position(), buf, 0)+.5); if (readonly()) { // Draw '^' caret cursor fl_line((int)(xpos+curx-2.5f), Y+ypos+height-1, @@ -629,14 +629,14 @@ void Fl_Input_::handle_mouse(int X, int Y, int /*W*/, int /*H*/, int drag) { } // if the multiple click does not increase the selection, revert // to single-click behavior: - if (!drag && (mark() > position() ? - (newmark >= position() && newpos <= mark()) : - (newmark >= mark() && newpos <= position()))) { + if (!drag && (mark() > insert_position() ? + (newmark >= insert_position() && newpos <= mark()) : + (newmark >= mark() && newpos <= insert_position()))) { Fl::event_clicks(0); newmark = newpos = (int) (l-value()); } } - position(newpos, newmark); + insert_position(newpos, newmark); } /** @@ -656,7 +656,7 @@ void Fl_Input_::handle_mouse(int X, int Y, int /*W*/, int /*H*/, int drag) { \return 0 if no positions changed \see position(int), position(), mark(int) */ -int Fl_Input_::position(int p, int m) { +int Fl_Input_::insert_position(int p, int m) { int is_same = 0; was_up_down = 0; if (p<0) p = 0; @@ -730,7 +730,7 @@ int Fl_Input_::up_down_position(int i, int keepmark) { if (f <= up_down_pos) l = t; else r = t-1; } int j = (int) (l-value()); - j = position(j, keepmark ? mark_ : j); + j = insert_position(j, keepmark ? mark_ : j); was_up_down = 1; return j; } @@ -749,10 +749,10 @@ int Fl_Input_::up_down_position(int i, int keepmark) { \see Fl::copy(const char *, int, int) */ int Fl_Input_::copy(int clipboard) { - int b = position(); + int b = insert_position(); int e = mark(); if (b != e) { - if (b > e) {b = mark(); e = position();} + if (b > e) {b = mark(); e = insert_position();} if (input_type() == FL_SECRET_INPUT) e = b; Fl::copy(value()+b, e-b, clipboard); return 1; @@ -780,7 +780,7 @@ int Fl_Input_::append(const char* t, int l, char keep_selection) int om = mark_, op = position_; int ret = replace(end, end, t, l); if (keep_selection) { - position(op, om); + insert_position(op, om); } return ret; } @@ -1125,7 +1125,7 @@ int Fl_Input_::handletext(int event, int X, int Y, int W, int H) { return 1; } else return replace(0, size(), t, (int) (e-t)); } - return replace(position(), mark(), t, (int) (e-t));} + return replace(insert_position(), mark(), t, (int) (e-t));} case FL_SHORTCUT: if (!(shortcut() ? Fl::test_shortcut(shortcut()) : test_shortcut())) @@ -1259,7 +1259,7 @@ int Fl_Input_::static_value(const char* str, int len) { xscroll_ = yscroll_ = 0; minimal_update(0); } - position(readonly() ? 0 : size()); + insert_position(readonly() ? 0 : size()); return 1; } diff --git a/src/Fl_Screen_Driver.cxx b/src/Fl_Screen_Driver.cxx index 30481ba8e..4d5e5e856 100644 --- a/src/Fl_Screen_Driver.cxx +++ b/src/Fl_Screen_Driver.cxx @@ -281,7 +281,7 @@ int Fl_Screen_Driver::input_widget_handle_key(int key, unsigned mods, unsigned s { switch (key) { case FL_Delete: { - int selected = (input->position() != input->mark()) ? 1 : 0; + int selected = (input->insert_position() != input->mark()) ? 1 : 0; if (mods==0 && shift && selected) return input->kf_copy_cut(); // Shift-Delete with selection (WP,NP,WOW,GE,KE,OF) if (mods==0 && shift && !selected) diff --git a/src/Fl_Text_Buffer.cxx b/src/Fl_Text_Buffer.cxx index 4733fc177..638a3d023 100644 --- a/src/Fl_Text_Buffer.cxx +++ b/src/Fl_Text_Buffer.cxx @@ -581,7 +581,7 @@ void Fl_Text_Buffer::unselect() */ int Fl_Text_Buffer::selection_position(int *start, int *end) { - return mPrimary.position(start, end); + return mPrimary.selected(start, end); } @@ -642,7 +642,7 @@ void Fl_Text_Buffer::secondary_unselect() */ int Fl_Text_Buffer::secondary_selection_position(int *start, int *end) { - return mSecondary.position(start, end); + return mSecondary.selected(start, end); } @@ -703,7 +703,7 @@ void Fl_Text_Buffer::unhighlight() */ int Fl_Text_Buffer::highlight_position(int *start, int *end) { - return mHighlight.position(start, end); + return mHighlight.selected(start, end); } @@ -1325,7 +1325,7 @@ void Fl_Text_Selection::set(int startpos, int endpos) \see selected(), start(), end() */ -int Fl_Text_Selection::position(int *startpos, int *endpos) const { +int Fl_Text_Selection::selected(int *startpos, int *endpos) const { if (!mSelected) { *startpos = 0; *endpos = 0; @@ -1355,7 +1355,7 @@ char *Fl_Text_Buffer::selection_text_(Fl_Text_Selection * sel) const { int start, end; /* If there's no selection, return an allocated empty string */ - if (!sel->position(&start, &end)) + if (!sel->selected(&start, &end)) { char *s = (char *) malloc(1); *s = '\0'; @@ -1375,7 +1375,7 @@ void Fl_Text_Buffer::remove_selection_(Fl_Text_Selection * sel) { int start, end; - if (!sel->position(&start, &end)) + if (!sel->selected(&start, &end)) return; remove(start, end); //undoyankcut = undocut; @@ -1393,7 +1393,7 @@ void Fl_Text_Buffer::replace_selection_(Fl_Text_Selection * sel, /* If there's no selection, return */ int start, end; - if (!sel->position(&start, &end)) + if (!sel->selected(&start, &end)) return; /* Do the appropriate type of replace */ diff --git a/src/Fl_Tile.cxx b/src/Fl_Tile.cxx index dd02d3757..a5de6039d 100644 --- a/src/Fl_Tile.cxx +++ b/src/Fl_Tile.cxx @@ -93,7 +93,7 @@ Pass zero as \p oldx or \p oldy to disable drag in that direction. */ -void Fl_Tile::position(int oldx, int oldy, int newx, int newy) { +void Fl_Tile::move_intersection(int oldx, int oldy, int newx, int newy) { Fl_Widget*const* a = array(); Fl_Rect *p = bounds(); p += 2; // skip group & resizable's saved size @@ -268,7 +268,7 @@ int Fl_Tile::handle(int event) { else if (newy > r->y()+r->h()) newy = r->y()+r->h(); } else newy = sy; - position(sx,sy,newx,newy); + move_intersection(sx, sy, newx, newy); if (event == FL_DRAG) { set_changed(); do_callback(FL_REASON_DRAGGED); diff --git a/src/Fl_Value_Input.cxx b/src/Fl_Value_Input.cxx index 4139c1ac4..37be93e80 100644 --- a/src/Fl_Value_Input.cxx +++ b/src/Fl_Value_Input.cxx @@ -54,7 +54,7 @@ void Fl_Value_Input::value_damage() { char buf[128]; format(buf); input.value(buf); - input.mark(input.position()); // turn off selection highlight + input.mark(input.insert_position()); // turn off selection highlight } int Fl_Value_Input::handle(int event) { diff --git a/test/browser.cxx b/test/browser.cxx index b4b8cdbb0..d269f0d57 100644 --- a/test/browser.cxx +++ b/test/browser.cxx @@ -174,7 +174,7 @@ int main(int argc, char **argv) { browser->add("@bBold text"); browser->add("@iItalic text"); } - browser->position(0); + browser->vposition(0); field = new Fl_Int_Input(55, 350, window.w()-55, 25, "Line #:"); field->callback(show_cb); diff --git a/test/glpuzzle.cxx b/test/glpuzzle.cxx index 1c1f8b4e4..2e8a307d5 100644 --- a/test/glpuzzle.cxx +++ b/test/glpuzzle.cxx @@ -1130,7 +1130,7 @@ Reshape(int width, int height) W = width; H = height; - glViewport(0, 0, W, H); + glViewport(0, 0, (GLsizei)W, (GLsizei)H); glGetIntegerv(GL_VIEWPORT, viewport); } @@ -1453,7 +1453,7 @@ main(int argc, char **argv) } } - glutInitWindowSize(W, H); + glutInitWindowSize((int)W, (int)H); if (doubleBuffer) { glutInitDisplayMode(GLUT_DEPTH | GLUT_RGB | GLUT_DOUBLE | GLUT_MULTISAMPLE); } else { diff --git a/test/input.cxx b/test/input.cxx index 2b6e15c06..70c47c852 100644 --- a/test/input.cxx +++ b/test/input.cxx @@ -49,7 +49,7 @@ void test(Fl_Input *i) { if (i->changed()) { i->clear_changed(); G_tty->printf("%s '%s'\n",i->label(),i->value()); char utf8buf[10]; - int last = fl_utf8encode(i->index(i->position()), utf8buf); + int last = fl_utf8encode(i->index(i->insert_position()), utf8buf); utf8buf[last] = 0; G_tty->printf("Symbol at cursor position: %s\n", utf8buf); } diff --git a/test/keyboard.cxx b/test/keyboard.cxx index a3603cabf..46ba6142f 100644 --- a/test/keyboard.cxx +++ b/test/keyboard.cxx @@ -97,14 +97,14 @@ int main(int argc, char** argv) { for (int c = 0; c < window->children(); c++) { Fl_Widget* b = window->child(c); if (b->callback() == (Fl_Callback*)key_cb) { - int i = b->argument(); + int i = (int)b->argument(); if (!i) i = b->label()[0]; Fl_Button *btn = ((Fl_Button*)b); int state = Fl::event_key(i); if (btn->value()!=state) btn->value(state); } else if (b->callback() == (Fl_Callback*)shift_cb) { - int i = b->argument(); + int i = (int)b->argument(); Fl_Button *btn = ((Fl_Button*)b); int state = Fl::event_state(i); if (btn->value()!=state) diff --git a/test/line_style.cxx b/test/line_style.cxx index f1517ee86..67b1fde08 100644 --- a/test/line_style.cxx +++ b/test/line_style.cxx @@ -47,10 +47,10 @@ void test_box::draw() { dashes[3] = char(sliders[8]->value()); dashes[4] = 0; fl_line_style( - choice[0]->mvalue()->argument() + + (int)(choice[0]->mvalue()->argument() + choice[1]->mvalue()->argument() + - choice[2]->mvalue()->argument(), - long(sliders[3]->value()), // width + choice[2]->mvalue()->argument()), + (int)(sliders[3]->value()), // width dashes); // draw the defined fl_rect and fl_vertex first and then diff --git a/test/unittest_unicode.cxx b/test/unittest_unicode.cxx index 0f6865a6b..a1a4db812 100644 --- a/test/unittest_unicode.cxx +++ b/test/unittest_unicode.cxx @@ -71,7 +71,7 @@ class Ut_Unicode_Box_Test : public Fl_Group { int fontsize = (int)fontsize_slider->value(); textdisplay->textsize(fontsize); multilineinput->textsize(fontsize); - multilineinput->position(0); // keep scrolled to top + multilineinput->insert_position(0); // keep scrolled to top parent()->redraw(); } static void font_size_slider_cb(Fl_Widget*, void *userdata) {