summaryrefslogtreecommitdiff
path: root/src/Fl_Browser.cxx
diff options
context:
space:
mode:
authorMichael R Sweet <michael.r.sweet@gmail.com>2004-07-26 20:52:52 +0000
committerMichael R Sweet <michael.r.sweet@gmail.com>2004-07-26 20:52:52 +0000
commita529510e5b8f84b15aacd103936df89bb767bb29 (patch)
tree48fed13b2239bc7de94c680ab1efa3b16c41c432 /src/Fl_Browser.cxx
parentdd193b3820f9b59233834d0f4bc020cd91168f58 (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
Diffstat (limited to 'src/Fl_Browser.cxx')
-rw-r--r--src/Fl_Browser.cxx52
1 files changed, 50 insertions, 2 deletions
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 $".
//