diff options
| author | Michael R Sweet <michael.r.sweet@gmail.com> | 2004-07-26 20:52:52 +0000 |
|---|---|---|
| committer | Michael R Sweet <michael.r.sweet@gmail.com> | 2004-07-26 20:52:52 +0000 |
| commit | a529510e5b8f84b15aacd103936df89bb767bb29 (patch) | |
| tree | 48fed13b2239bc7de94c680ab1efa3b16c41c432 | |
| parent | dd193b3820f9b59233834d0f4bc020cd91168f58 (diff) | |
More documentation updates...
Fl_File_Chooser did not handle some cases for filename
completion (STR #376)
Fl_Help_View didn't properly compute the default maximum width
of the page properly, resulting in non-wrapped text in table
cells (STR #464)
Fl_Text_Editor no longer tries to emulate the Emacs CTRL-A
shortcut to move to the first column, since there is a key for
that and the widget does not emulate any other Emacs keys (STR
#421)
Fl_File_Chooser always disabled the OK button when the user
pressed DELETE or BACKSPACE (STR #397)
Added Fl_Browser::swap() methods (STR #459)
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@3698 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
| -rw-r--r-- | CHANGES | 15 | ||||
| -rw-r--r-- | FL/Fl_Browser.H | 6 | ||||
| -rw-r--r-- | documentation/Fl_Browser.html | 7 | ||||
| -rw-r--r-- | documentation/Fl_Input_.html | 7 | ||||
| -rw-r--r-- | documentation/Fl_Preferences.html | 2 | ||||
| -rw-r--r-- | documentation/osissues.html | 20 | ||||
| -rw-r--r-- | src/Fl_Browser.cxx | 52 | ||||
| -rw-r--r-- | src/Fl_File_Chooser2.cxx | 98 | ||||
| -rw-r--r-- | src/Fl_Help_View.cxx | 10 | ||||
| -rw-r--r-- | src/Fl_Menu.cxx | 8 | ||||
| -rw-r--r-- | src/Fl_Text_Editor.cxx | 24 | ||||
| -rw-r--r-- | test/browser.cxx | 32 | ||||
| -rw-r--r-- | test/help.cxx | 6 |
13 files changed, 188 insertions, 99 deletions
@@ -1,6 +1,19 @@ CHANGES IN FLTK 1.1.5rc2 - - Documentation updates (STR #365, STR #399, STR #412) + - Documentation updates (STR #365, STR #399, STR #407, + STR #412, STR #414, STR #462) + - Fl_File_Chooser did not handle some cases for filename + completion (STR #376) + - Fl_Help_View didn't properly compute the default + maximum width of the page properly, resulting in + non-wrapped text in table cells (STR #464) + - Fl_Text_Editor no longer tries to emulate the Emacs + CTRL-A shortcut to move to the first column, since + there is a key for that and the widget does not + emulate any other Emacs keys (STR #421) + - Fl_File_Chooser always disabled the OK button when the + user pressed DELETE or BACKSPACE (STR #397) + - Added Fl_Browser::swap() methods (STR #459) - Fl_Counter didn't use a thin down box for the text field if the box type was set to FL_THIN_UP_BOX (STR #467) diff --git a/FL/Fl_Browser.H b/FL/Fl_Browser.H index 8c4f72972..c007b7fcc 100644 --- a/FL/Fl_Browser.H +++ b/FL/Fl_Browser.H @@ -1,5 +1,5 @@ // -// "$Id: Fl_Browser.H,v 1.8.2.7.2.6 2004/04/11 04:38:54 easysw Exp $" +// "$Id: Fl_Browser.H,v 1.8.2.7.2.7 2004/07/26 20:52:50 easysw Exp $" // // Browser header file for the Fast Light Tool Kit (FLTK). // @@ -64,6 +64,7 @@ protected: FL_BLINE* _remove(int) ; void insert(int, FL_BLINE*); int lineno(void*) const ; + void swap(FL_BLINE *a, FL_BLINE *b); public: @@ -72,6 +73,7 @@ public: void insert(int, const char*, void* = 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;} @@ -124,5 +126,5 @@ public: #endif // -// End of "$Id: Fl_Browser.H,v 1.8.2.7.2.6 2004/04/11 04:38:54 easysw Exp $". +// End of "$Id: Fl_Browser.H,v 1.8.2.7.2.7 2004/07/26 20:52:50 easysw Exp $". // diff --git a/documentation/Fl_Browser.html b/documentation/Fl_Browser.html index bf439dfce..8db61d937 100644 --- a/documentation/Fl_Browser.html +++ b/documentation/Fl_Browser.html @@ -81,8 +81,13 @@ subclass of <TT>Fl_Browser_</TT>. </P> </TD><TD align=left valign=top> <UL> <LI><A href=#Fl_Browser.size>size</A></LI> +<LI><A href=#Fl_Browser.swap>swap</A></LI> <LI><A href=#Fl_Browser.text>text</A></LI> <LI><A href=#Fl_Browser.topline>topline</A></LI> +</UL> +</TD> +<TD align=left valign=top> +<UL> <LI><A href=#Fl_Browser.visible>visible</A></LI> </UL> </TD></TR> @@ -192,6 +197,8 @@ will always return 0. <H4><A name=Fl_Browser.size>int Fl_Browser::size() const</A></H4> Returns how many lines are in the browser. The last line number is equal to this. +<H4><A name=Fl_Browser.swap>void Fl_Browser::swap(int a, int b)</A></H4> +Swaps two lines in the browser. <H4><A name=Fl_Browser.text>const char *Fl_Browser::text(int n) const <BR> void Fl_Browser::text(int n, const char *)</A></H4> The first form returns the text for line <TT>n</TT>. If <TT>n</TT> is diff --git a/documentation/Fl_Input_.html b/documentation/Fl_Input_.html index 5123405f3..b6b4ef307 100644 --- a/documentation/Fl_Input_.html +++ b/documentation/Fl_Input_.html @@ -120,13 +120,14 @@ const</A></H4> already been erased to <TT>color()</TT>. Otherwise it does minimal update and erases the area itself. -<H4><A name="Fl_Input_.handletext">void Fl_Input_::handletext(int +<H4><A name="Fl_Input_.handletext">int Fl_Input_::handletext(int e,int,int,int,int)</A></H4> <P>Default handler for all event types. Your <TT>handle()</TT> method should call this for all events that it does not handle -completely. You must pass it the same bounding box as passed to -<TT>draw()</TT>. Handles <TT>FL_PUSH</TT>, <TT>FL_DRAG</TT>, +completely. You must pass it the same bounding box as you do +when calling <TT>drawtext()</TT> from your <tt>draw()</tt> +method. Handles <TT>FL_PUSH</TT>, <TT>FL_DRAG</TT>, <TT>FL_RELEASE</TT> to select text, handles <TT>FL_FOCUS</TT> and <TT>FL_UNFOCUS</TT> to show and hide the cursor. diff --git a/documentation/Fl_Preferences.html b/documentation/Fl_Preferences.html index b5ce6a4b0..fc5c723d4 100644 --- a/documentation/Fl_Preferences.html +++ b/documentation/Fl_Preferences.html @@ -128,7 +128,7 @@ entry names. The index must be within the range given by the base preference group. This function is rarely used as deleting the base preferences flushes automatically. -<H4><a name="Fl_Preferences.getUserdataPath">int Fl_Preferences::getUserdataPath(char *path)</a></H4> +<H4><a name="Fl_Preferences.getUserdataPath">int Fl_Preferences::getUserdataPath(char *path, int path_size)</a></H4> <P>Creates a path that is related to the preferences file and that is usable for application data beyond what is covered by diff --git a/documentation/osissues.html b/documentation/osissues.html index 692a2ac38..a140dc6b8 100644 --- a/documentation/osissues.html +++ b/documentation/osissues.html @@ -340,18 +340,36 @@ is shown using the <TT>Fl_Window::icon()</TT> method. <P>Sets the icon for the window to the passed pointer. You will need to cast the icon <TT>Pixmap</TT> to a <TT>char *</TT> when -calling this method. To set the icon using a bitmap compiled +calling this method. To set a monochrome icon using a bitmap compiled with your application use: <UL><PRE> #include "icon.xbm" +fl_opendisplay(); // needed if display has not been previously opened + Pixmap p = XCreateBitmapFromData(fl_display, DefaultRootWindow(fl_display), icon_bits, icon_width, icon_height); window->icon((char *)p); </PRE></UL> +<P>To use a multi-colored icon, the XPM format and library +should be used as follows: + +<UL><PRE> +#include "icon.xpm" + +fl_opendisplay(); // needed if display has not been previously opened + +Pixmap p, mask; + +XpmCreatePixmapFromData(fl_display, DefaultRootWindow(fl_display), + icon_xpm, &p, &mask, NULL); + +window->icon((char *)p); +</PRE></UL> + <CENTER><TABLE WIDTH="90%" BORDER="1" CELLPADDING="5" CELLSPACING="0" BGCOLOR="#cccccc"> <TR> <TD><B>NOTE:</B> diff --git a/src/Fl_Browser.cxx b/src/Fl_Browser.cxx index 9dd964990..0556f0fc6 100644 --- a/src/Fl_Browser.cxx +++ b/src/Fl_Browser.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Browser.cxx,v 1.9.2.12.2.11 2004/05/16 02:18:13 easysw Exp $" +// "$Id: Fl_Browser.cxx,v 1.9.2.12.2.12 2004/07/26 20:52:50 easysw Exp $" // // Browser widget for the Fast Light Tool Kit (FLTK). // @@ -497,6 +497,54 @@ int Fl_Browser::value() const { return lineno(selection()); } +// SWAP TWO LINES +void Fl_Browser::swap(FL_BLINE *a, FL_BLINE *b) { + + if ( a == b || !a || !b) return; // nothing to do + FL_BLINE *aprev = a->prev; + FL_BLINE *anext = a->next; + FL_BLINE *bprev = b->prev; + FL_BLINE *bnext = b->next; + if ( b->prev == a ) { // A ADJACENT TO B + if ( aprev ) aprev->next = b; else first = b; + b->next = a; + a->next = bnext; + b->prev = aprev; + a->prev = b; + if ( bnext ) bnext->prev = a; else last = a; + } else if ( a->prev == b ) { // B ADJACENT TO A + if ( bprev ) bprev->next = a; else first = a; + a->next = b; + b->next = anext; + a->prev = bprev; + b->prev = a; + if ( anext ) anext->prev = b; else last = b; + } else { // A AND B NOT ADJACENT + // handle prev's + b->prev = aprev; + if ( anext ) anext->prev = b; else last = b; + a->prev = bprev; + if ( bnext ) bnext->prev = a; else last = a; + // handle next's + if ( aprev ) aprev->next = b; else first = b; + b->next = anext; + if ( bprev ) bprev->next = a; else first = a; + a->next = bnext; + } + // Disable cache -- we played around with positions + cacheline = 0; + // Redraw modified lines + redraw_line(a); + redraw_line(b); +} + +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); +} + // -// End of "$Id: Fl_Browser.cxx,v 1.9.2.12.2.11 2004/05/16 02:18:13 easysw Exp $". +// End of "$Id: Fl_Browser.cxx,v 1.9.2.12.2.12 2004/07/26 20:52:50 easysw Exp $". // diff --git a/src/Fl_File_Chooser2.cxx b/src/Fl_File_Chooser2.cxx index 6bbbe6890..3fa961a6b 100644 --- a/src/Fl_File_Chooser2.cxx +++ b/src/Fl_File_Chooser2.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_File_Chooser2.cxx,v 1.1.2.36 2004/04/11 04:38:57 easysw Exp $" +// "$Id: Fl_File_Chooser2.cxx,v 1.1.2.37 2004/07/26 20:52:51 easysw Exp $" // // More Fl_File_Chooser routines. // @@ -475,12 +475,13 @@ Fl_File_Chooser::fileNameCB() #if (defined(WIN32) && !defined(__CYGWIN__)) || defined(__EMX__) if (directory_[0] != '\0' && filename[0] != '/' && filename[0] != '\\' && - !(isalpha(filename[0]) && (!filename[1] || filename[1] == ':'))) { + !(isalpha(filename[0] & 255) && (!filename[1] || filename[1] == ':'))) { #else if (directory_[0] != '\0' && filename[0] != '/') { #endif /* WIN32 || __EMX__ */ fl_filename_absolute(pathname, sizeof(pathname), filename); value(pathname); + fileName->mark(fileName->position()); // no selection after expansion } else if (filename != pathname) { // Finally, make sure that we have a writable copy... strlcpy(pathname, filename, sizeof(pathname)); @@ -489,11 +490,10 @@ Fl_File_Chooser::fileNameCB() filename = pathname; // Now process things according to the key pressed... - if (Fl::event_key() == FL_Enter || Fl::event_key() == FL_KP_Enter) - { + if (Fl::event_key() == FL_Enter || Fl::event_key() == FL_KP_Enter) { // Enter pressed - select or change directory... #if (defined(WIN32) && ! defined(__CYGWIN__)) || defined(__EMX__) - if ((strlen(pathname) == 2 && pathname[1] == ':') || + if ((isalpha(pathname[0] & 255) && pathname[1] == ':' && !pathname[2]) || fl_filename_isdir(pathname)) { #else if (fl_filename_isdir(pathname)) { @@ -513,75 +513,68 @@ Fl_File_Chooser::fileNameCB() // Hide the window to signal things are done... window->hide(); - } - else - { + } else { // File doesn't exist, so beep at and alert the user... fl_alert(existing_file_label); } } else if (Fl::event_key() != FL_Delete && - Fl::event_key() != FL_BackSpace) - { + Fl::event_key() != FL_BackSpace) { // Check to see if the user has entered a directory... if ((slash = strrchr(pathname, '/')) == NULL) slash = strrchr(pathname, '\\'); - if (slash != NULL) - { - // Yes, change directories if necessary... - *slash++ = '\0'; - filename = slash; + if (!slash) return; + + // Yes, change directories if necessary... + *slash++ = '\0'; + filename = slash; #if defined(WIN32) || defined(__EMX__) - if (strcasecmp(pathname, directory_) && - (pathname[0] || strcasecmp("/", directory_))) { + if (strcasecmp(pathname, directory_) && + (pathname[0] || strcasecmp("/", directory_))) { #else - if (strcmp(pathname, directory_) && - (pathname[0] || strcasecmp("/", directory_))) { + if (strcmp(pathname, directory_) && + (pathname[0] || strcasecmp("/", directory_))) { #endif // WIN32 || __EMX__ - int p = fileName->position(); - int m = fileName->mark(); - - directory(pathname); + int p = fileName->position(); + int m = fileName->mark(); - if (filename[0]) { - char tempname[1024]; + directory(pathname); - snprintf(tempname, sizeof(tempname), "%s/%s", directory_, filename); - fileName->value(tempname); - } + if (filename[0]) { + char tempname[1024]; - fileName->position(p, m); + snprintf(tempname, sizeof(tempname), "%s/%s", directory_, filename); + fileName->value(tempname); + strlcpy(pathname, tempname, sizeof(pathname)); } + + fileName->position(p, m); } // Other key pressed - do filename completion as possible... num_files = fileList->size(); min_match = strlen(filename); - max_match = 100000; + max_match = min_match + 1; first_line = 0; - for (i = 1; i <= num_files && max_match > min_match; i ++) - { + for (i = 1; i <= num_files && max_match > min_match; i ++) { file = fileList->text(i); #if (defined(WIN32) && ! defined(__CYGWIN__)) || defined(__EMX__) - if (strnicmp(filename, file, min_match) == 0) + if (strnicmp(filename, file, min_match) == 0) { #else - if (strncmp(filename, file, min_match) == 0) + if (strncmp(filename, file, min_match) == 0) { #endif // WIN32 || __EMX__ - { // OK, this one matches; check against the previous match - if (max_match == 100000) - { + if (!first_line) { // First match; copy stuff over... strlcpy(matchname, file, sizeof(matchname)); max_match = strlen(matchname); // Strip trailing /, if any... - if (matchname[max_match - 1] == '/') - { + if (matchname[max_match - 1] == '/') { max_match --; matchname[max_match] = '\0'; } @@ -589,9 +582,7 @@ Fl_File_Chooser::fileNameCB() // And then make sure that the item is visible fileList->topline(i); first_line = i; - } - else - { + } else { // Succeeding match; compare to find maximum string match... while (max_match > min_match) #if (defined(WIN32) && ! defined(__CYGWIN__)) || defined(__EMX__) @@ -616,9 +607,7 @@ Fl_File_Chooser::fileNameCB() fileList->deselect(0); fileList->select(first_line); fileList->redraw(); - } - else if (max_match > min_match && max_match != 100000) - { + } else if (max_match > min_match && first_line) { // Add the matching portion... fileName->replace(filename - pathname, filename - pathname + min_match, matchname); @@ -628,23 +617,28 @@ Fl_File_Chooser::fileNameCB() // (Tab and End also do this for both cases.) fileName->position(filename - pathname + max_match, filename - pathname + min_match); - } - else if (max_match == 0) { + } else if (max_match == 0) { fileList->deselect(0); fileList->redraw(); } // See if we need to enable the OK button... - if ((type_ & CREATE || access(fileName->value(), 0) == 0) && - (!fl_filename_isdir(fileName->value()) || type_ & DIRECTORY)) + if (((type_ & CREATE) || !access(fileName->value(), 0)) && + (!fl_filename_isdir(fileName->value()) || (type_ & DIRECTORY))) { okButton->activate(); - else + } else { okButton->deactivate(); + } } else { // FL_Delete or FL_BackSpace fileList->deselect(0); fileList->redraw(); - okButton->deactivate(); + if (((type_ & CREATE) || !access(fileName->value(), 0)) && + (!fl_filename_isdir(fileName->value()) || (type_ & DIRECTORY))) { + okButton->activate(); + } else { + okButton->deactivate(); + } } } @@ -1164,5 +1158,5 @@ unquote_pathname(char *dst, // O - Destination string // -// End of "$Id: Fl_File_Chooser2.cxx,v 1.1.2.36 2004/04/11 04:38:57 easysw Exp $". +// End of "$Id: Fl_File_Chooser2.cxx,v 1.1.2.37 2004/07/26 20:52:51 easysw Exp $". // diff --git a/src/Fl_Help_View.cxx b/src/Fl_Help_View.cxx index 36ae551f3..b8a0da47f 100644 --- a/src/Fl_Help_View.cxx +++ b/src/Fl_Help_View.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Help_View.cxx,v 1.1.2.51 2004/07/23 21:12:24 easysw Exp $" +// "$Id: Fl_Help_View.cxx,v 1.1.2.52 2004/07/26 20:52:51 easysw Exp $" // // Fl_Help_View widget routines. // @@ -1125,6 +1125,10 @@ Fl_Help_View::format() format_table(&table_width, columns, start); if ((xx + table_width) > hsize_) { +#ifdef DEBUG + printf("xx=%d, table_width=%d, hsize_=%d\n", xx, table_width, + hsize_); +#endif // DEBUG hsize_ = xx + table_width; done = 0; break; @@ -1953,7 +1957,7 @@ Fl_Help_View::format_table(int *table_width, // O - Total table width int scale_width = *table_width; if (scale_width == 0) { - if (width > hsize_) scale_width = hsize_; + if (width > (hsize_ - 24)) scale_width = hsize_ - 24; else scale_width = width; } @@ -2806,5 +2810,5 @@ hscrollbar_callback(Fl_Widget *s, void *) // -// End of "$Id: Fl_Help_View.cxx,v 1.1.2.51 2004/07/23 21:12:24 easysw Exp $". +// End of "$Id: Fl_Help_View.cxx,v 1.1.2.52 2004/07/26 20:52:51 easysw Exp $". // diff --git a/src/Fl_Menu.cxx b/src/Fl_Menu.cxx index e901e7817..7a62f0a2d 100644 --- a/src/Fl_Menu.cxx +++ b/src/Fl_Menu.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Menu.cxx,v 1.18.2.12.2.32 2004/06/08 14:11:59 easysw Exp $" +// "$Id: Fl_Menu.cxx,v 1.18.2.12.2.33 2004/07/26 20:52:51 easysw Exp $" // // Menu code for the Fast Light Tool Kit (FLTK). // @@ -240,7 +240,7 @@ menuwindow::menuwindow(const Fl_Menu_Item* m, int X, int Y, int Wp, int Hp, set_modal(); clear_border(); menu = m; - m = m->first(); // find the first item that needs to be rendered + if (m) m = m->first(); // find the first item that needs to be rendered drawn_selected = -1; if (button) { box(button->box()); @@ -405,7 +405,7 @@ int menuwindow::find_selected(int mx, int my) { if (my < 0 || my >= h()) return -1; if (!itemheight) { // menubar int xx = 3; int n = 0; - const Fl_Menu_Item* m = menu->first(); + const Fl_Menu_Item* m = menu ? menu->first() : 0; for (; ; m = m->next(), n++) { if (!m->text) return -1; xx += m->measure(0, button) + 16; @@ -791,5 +791,5 @@ const Fl_Menu_Item* Fl_Menu_Item::test_shortcut() const { } // -// End of "$Id: Fl_Menu.cxx,v 1.18.2.12.2.32 2004/06/08 14:11:59 easysw Exp $". +// End of "$Id: Fl_Menu.cxx,v 1.18.2.12.2.33 2004/07/26 20:52:51 easysw Exp $". // diff --git a/src/Fl_Text_Editor.cxx b/src/Fl_Text_Editor.cxx index 6454bfc8a..be96e2a66 100644 --- a/src/Fl_Text_Editor.cxx +++ b/src/Fl_Text_Editor.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Text_Editor.cxx,v 1.9.2.19 2004/05/26 02:42:10 easysw Exp $" +// "$Id: Fl_Text_Editor.cxx,v 1.9.2.20 2004/07/26 20:52:52 easysw Exp $" // // Copyright 2001-2004 by Bill Spitzak and others. // Original code Copyright Mark Edel. Permission to distribute under @@ -47,8 +47,6 @@ Fl_Text_Editor::Fl_Text_Editor(int X, int Y, int W, int H, const char* l) Fl_Text_Editor::Key_Binding* Fl_Text_Editor::global_key_bindings = 0; -static int ctrl_a(int, Fl_Text_Editor* e); - // These are the default key bindings every widget should start with static struct { int key; @@ -102,7 +100,7 @@ static struct { { FL_Insert, FL_CTRL, Fl_Text_Editor::kf_copy }, { 'v', FL_CTRL, Fl_Text_Editor::kf_paste }, { FL_Insert, FL_SHIFT, Fl_Text_Editor::kf_paste }, - { 'a', FL_CTRL, ctrl_a }, + { 'a', FL_CTRL, Fl_Text_Editor::kf_select_all }, #ifdef __APPLE__ // Define CMD+key accelerators... @@ -110,7 +108,7 @@ static struct { { 'x', FL_COMMAND, Fl_Text_Editor::kf_cut }, { 'c', FL_COMMAND, Fl_Text_Editor::kf_copy }, { 'v', FL_COMMAND, Fl_Text_Editor::kf_paste }, - { 'a', FL_COMMAND, ctrl_a }, + { 'a', FL_COMMAND, Fl_Text_Editor::kf_select_all }, #endif // __APPLE__ { 0, 0, 0 } @@ -301,20 +299,6 @@ int Fl_Text_Editor::kf_c_s_move(int c, Fl_Text_Editor* e) { return 1; } -static int ctrl_a(int, Fl_Text_Editor* e) { - // make 2+ ^A's in a row toggle select-all: - int i = e->buffer()->line_start(e->insert_position()); - if (i != e->insert_position()) - return Fl_Text_Editor::kf_move(FL_Home, e); - else { - if (e->buffer()->selected()) - e->buffer()->unselect(); - else - Fl_Text_Editor::kf_select_all(0, e); - } - return 1; -} - int Fl_Text_Editor::kf_home(int, Fl_Text_Editor* e) { return kf_move(FL_Home, e); } @@ -488,5 +472,5 @@ int Fl_Text_Editor::handle(int event) { } // -// End of "$Id: Fl_Text_Editor.cxx,v 1.9.2.19 2004/05/26 02:42:10 easysw Exp $". +// End of "$Id: Fl_Text_Editor.cxx,v 1.9.2.20 2004/07/26 20:52:52 easysw Exp $". // diff --git a/test/browser.cxx b/test/browser.cxx index 054bc0dfa..446a8ebf6 100644 --- a/test/browser.cxx +++ b/test/browser.cxx @@ -1,5 +1,5 @@ // -// "$Id: browser.cxx,v 1.5.2.6.2.6 2004/04/11 04:39:00 easysw Exp $" +// "$Id: browser.cxx,v 1.5.2.6.2.7 2004/07/26 20:52:52 easysw Exp $" // // Browser test program for the Fast Light Tool Kit (FLTK). // @@ -74,7 +74,8 @@ Fl_Select_Browser *browser; Fl_Button *top, *bottom, *middle, - *visible; + *visible, + *swap; Fl_Int_Input *field; void b_cb(Fl_Widget* o, void*) { @@ -101,6 +102,19 @@ void show_cb(Fl_Widget *o, void *) { browser->make_visible(line); } +void swap_cb(Fl_Widget *o, void *) { + int a = -1, b = -1; + for ( int t=0; t<browser->size(); t++ ) { // find two selected items + if ( browser->selected(t) ) { + if ( a < 0 ) + { a = t; } + else + { b = t; break; } + } + } + browser->swap(a, b); // swap them +} + int main(int argc, char **argv) { int i; if (!Fl::args(argc,argv,i)) Fl::fatal(Fl::help); @@ -139,24 +153,28 @@ int main(int argc, char **argv) { field = new Fl_Int_Input(50, 350, 350, 25, "Line #:"); field->callback(show_cb); - top = new Fl_Button(0, 375, 100, 25, "Top"); + top = new Fl_Button(0, 375, 80, 25, "Top"); top->callback(show_cb); - bottom = new Fl_Button(100, 375, 100, 25, "Bottom"); + bottom = new Fl_Button(80, 375, 80, 25, "Bottom"); bottom->callback(show_cb); - middle = new Fl_Button(200, 375, 100, 25, "Middle"); + middle = new Fl_Button(160, 375, 80, 25, "Middle"); middle->callback(show_cb); - visible = new Fl_Button(300, 375, 100, 25, "Make Vis."); + visible = new Fl_Button(240, 375, 80, 25, "Make Vis."); visible->callback(show_cb); + swap = new Fl_Button(320, 375, 80, 25, "Swap"); + swap->callback(swap_cb); + swap->tooltip("Swaps two selected lines\n(Use CTRL-click to select two lines)"); + window.resizable(browser); window.show(argc,argv); return Fl::run(); } // -// End of "$Id: browser.cxx,v 1.5.2.6.2.6 2004/04/11 04:39:00 easysw Exp $". +// End of "$Id: browser.cxx,v 1.5.2.6.2.7 2004/07/26 20:52:52 easysw Exp $". // diff --git a/test/help.cxx b/test/help.cxx index bec9660d9..fed6b050e 100644 --- a/test/help.cxx +++ b/test/help.cxx @@ -1,5 +1,5 @@ // -// "$Id: help.cxx,v 1.1.2.10 2004/04/11 04:39:01 easysw Exp $" +// "$Id: help.cxx,v 1.1.2.11 2004/07/26 20:52:52 easysw Exp $" // // Fl_Help_Dialog test program. // @@ -52,7 +52,7 @@ main(int argc, // I - Number of command-line arguments else help->load(argv[1]); - help->show(argc, argv); + help->show(1, argv); Fl::run(); @@ -63,5 +63,5 @@ main(int argc, // I - Number of command-line arguments // -// End of "$Id: help.cxx,v 1.1.2.10 2004/04/11 04:39:01 easysw Exp $". +// End of "$Id: help.cxx,v 1.1.2.11 2004/07/26 20:52:52 easysw Exp $". // |
