summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAaron M. Ucko <ucko@debian.org>2005-04-05 20:24:55 +0000
committerAaron M. Ucko <ucko@debian.org>2005-04-05 20:24:55 +0000
commit190e20c801ad73f1b6d6fe02ffa5de135ae0f8d5 (patch)
treeaf7ff99d797be5e989e84f9a6ef4b9026c5abe9a /src
parent2fb75f144b320c4d82fb20b2ca8c11dee0ae443d (diff)
Load fltk-1.1.5rc2 into branches/upstream/current.
Diffstat (limited to 'src')
-rw-r--r--src/Fl_Browser.cxx71
-rw-r--r--src/Fl_Browser_.cxx11
-rw-r--r--src/Fl_Button.cxx22
-rw-r--r--src/Fl_Choice.cxx11
-rw-r--r--src/Fl_Color_Chooser.cxx6
-rw-r--r--src/Fl_Counter.cxx5
-rw-r--r--src/Fl_File_Chooser2.cxx98
-rw-r--r--src/Fl_File_Icon.cxx12
-rw-r--r--src/Fl_File_Input.cxx5
-rw-r--r--src/Fl_Gl_Choice.cxx11
-rw-r--r--src/Fl_Help_Dialog.cxx16
-rw-r--r--src/Fl_Help_Dialog.fl15
-rw-r--r--src/Fl_Help_View.cxx32
-rw-r--r--src/Fl_Input_.cxx13
-rw-r--r--src/Fl_Menu.cxx16
-rw-r--r--src/Fl_Menu_.cxx5
-rw-r--r--src/Fl_Menu_Bar.cxx6
-rw-r--r--src/Fl_Pack.cxx21
-rw-r--r--src/Fl_Positioner.cxx10
-rw-r--r--src/Fl_Scroll.cxx7
-rw-r--r--src/Fl_Scrollbar.cxx5
-rw-r--r--src/Fl_Tabs.cxx15
-rw-r--r--src/Fl_Text_Buffer.cxx11
-rw-r--r--src/Fl_Text_Display.cxx191
-rw-r--r--src/Fl_Text_Editor.cxx61
-rw-r--r--src/Fl_Tile.cxx5
-rw-r--r--src/Fl_Valuator.cxx9
-rw-r--r--src/Fl_Value_Input.cxx12
-rw-r--r--src/Fl_get_key_mac.cxx8
-rw-r--r--src/Fl_get_system_colors.cxx8
-rw-r--r--src/Fl_mac.cxx96
-rw-r--r--src/Fl_win32.cxx7
-rw-r--r--src/Fl_x.cxx31
-rw-r--r--src/Makefile44
-rw-r--r--src/fl_file_dir.cxx10
-rw-r--r--src/fl_read_image.cxx18
-rw-r--r--src/fl_symbols.cxx53
-rw-r--r--src/forms_timer.cxx5
-rw-r--r--src/gl_draw.cxx45
39 files changed, 661 insertions, 366 deletions
diff --git a/src/Fl_Browser.cxx b/src/Fl_Browser.cxx
index 6e495a2..0556f0f 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.9 2004/04/11 04:38:57 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).
//
@@ -216,8 +216,9 @@ int Fl_Browser::item_height(void* lv) const {
if (hh > hmax) hmax = hh;
}
else {
+ const int* i = column_widths();
// do each column separately as they may all set different fonts:
- for (char* str = l->txt; *str; str++) {
+ for (char* str = l->txt; str && *str; str++) {
Fl_Font font = textfont(); // default font
int tsize = textsize(); // default size
while (*str==format_char()) {
@@ -239,12 +240,13 @@ int Fl_Browser::item_height(void* lv) const {
}
END_FORMAT:
char* ptr = str;
- for(;*str && (*str!=column_char()); str++) ;
- if (ptr < str) {
+ if (ptr && *i++) str = strchr(str, column_char());
+ else str = NULL;
+ if((!str && *ptr) || (str && ptr < str)) {
fl_font(font, tsize); int hh = fl_height();
if (hh > hmax) hmax = hh;
}
- if (!*str) str --;
+ if (!str || !*str) break;
}
}
@@ -258,8 +260,8 @@ int Fl_Browser::item_width(void* v) const {
while (*i) { // add up all tab-seperated fields
char* e;
- for (e = str; *e && *e != column_char(); e++);
- if (!*e) break; // last one occupied by text
+ e = strchr(str, column_char());
+ if (!e) break; // last one occupied by text
str = e+1;
ww += *i++;
}
@@ -284,6 +286,7 @@ int Fl_Browser::item_width(void* v) const {
case 'S': tsize = strtol(str, &str, 10); break;
case '.':
done = 1;
+ break;
case '@':
str--;
done = 1;
@@ -316,8 +319,8 @@ void Fl_Browser::item_draw(void* v, int X, int Y, int W, int H) const {
int w1 = W; // width for this field
char* e = 0; // pointer to end of field or null if none
if (*i) { // find end of field and temporarily replace with 0
- for (e = str; *e && *e != column_char(); e++);
- if (*e) {*e = 0; w1 = *i++;} else e = 0;
+ e = strchr(str, column_char());
+ if (e) {*e = 0; w1 = *i++;}
}
int tsize = textsize();
Fl_Font font = textfont();
@@ -494,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.9 2004/04/11 04:38:57 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_Browser_.cxx b/src/Fl_Browser_.cxx
index f0e7392..dd01249 100644
--- a/src/Fl_Browser_.cxx
+++ b/src/Fl_Browser_.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Browser_.cxx,v 1.10.2.16.2.20 2004/04/11 04:38:57 easysw Exp $"
+// "$Id: Fl_Browser_.cxx,v 1.10.2.16.2.21 2004/07/27 16:02:19 easysw Exp $"
//
// Base Browser widget class for the Fast Light Tool Kit (FLTK).
//
@@ -510,7 +510,10 @@ int Fl_Browser_::select(void* l, int i, int docallbacks) {
display(l);
}
}
- if (docallbacks) do_callback();
+ if (docallbacks) {
+ set_changed();
+ do_callback();
+ }
return 1;
}
@@ -687,8 +690,8 @@ int Fl_Browser_::handle(int event) {
void* t = selection_; deselect(); selection_ = t;
}
if (change) {
+ set_changed();
if (when() & FL_WHEN_RELEASE) do_callback();
- else if (!(when()&FL_WHEN_CHANGED)) set_changed();
} else {
if (when() & FL_WHEN_NOT_CHANGED) do_callback();
}
@@ -758,5 +761,5 @@ void Fl_Browser_::item_select(void*, int) {}
int Fl_Browser_::item_selected(void* l) const {return l==selection_;}
//
-// End of "$Id: Fl_Browser_.cxx,v 1.10.2.16.2.20 2004/04/11 04:38:57 easysw Exp $".
+// End of "$Id: Fl_Browser_.cxx,v 1.10.2.16.2.21 2004/07/27 16:02:19 easysw Exp $".
//
diff --git a/src/Fl_Button.cxx b/src/Fl_Button.cxx
index 9309173..b4b05c1 100644
--- a/src/Fl_Button.cxx
+++ b/src/Fl_Button.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Button.cxx,v 1.4.2.6.2.22 2004/04/11 04:38:57 easysw Exp $"
+// "$Id: Fl_Button.cxx,v 1.4.2.6.2.23 2004/07/27 16:02:20 easysw Exp $"
//
// Button widget for the Fast Light Tool Kit (FLTK).
//
@@ -81,6 +81,7 @@ int Fl_Button::handle(int event) {
newval = oldval;
if (newval != value_) {
value_ = newval;
+ set_changed();
redraw();
if (when() & FL_WHEN_CHANGED) do_callback();
}
@@ -90,15 +91,14 @@ int Fl_Button::handle(int event) {
if (when() & FL_WHEN_NOT_CHANGED) do_callback();
return 1;
}
- if (type() == FL_RADIO_BUTTON)
- setonly();
- else if (type() == FL_TOGGLE_BUTTON)
- oldval = value_;
+ set_changed();
+ if (type() == FL_RADIO_BUTTON) setonly();
+ else if (type() == FL_TOGGLE_BUTTON) oldval = value_;
else {
value(oldval);
if (when() & FL_WHEN_CHANGED) do_callback();
}
- if (when() & FL_WHEN_RELEASE) do_callback(); else set_changed();
+ if (when() & FL_WHEN_RELEASE) do_callback();
return 1;
case FL_SHORTCUT:
if (!(shortcut() ?
@@ -108,12 +108,13 @@ int Fl_Button::handle(int event) {
if (type() == FL_RADIO_BUTTON && !value_) {
setonly();
+ set_changed();
if (when() & FL_WHEN_CHANGED) do_callback();
} else if (type() == FL_TOGGLE_BUTTON) {
value(!value());
+ set_changed();
if (when() & FL_WHEN_CHANGED) do_callback();
- }
- if (when() & FL_WHEN_RELEASE) do_callback(); else set_changed();
+ } else if (when() & FL_WHEN_RELEASE) do_callback();
return 1;
case FL_FOCUS :
case FL_UNFOCUS :
@@ -131,6 +132,7 @@ int Fl_Button::handle(int event) {
case FL_KEYBOARD :
if (Fl::focus() == this && Fl::event_key() == ' ' &&
!(Fl::event_state() & (FL_SHIFT | FL_CTRL | FL_ALT | FL_META))) {
+ set_changed();
if (type() == FL_RADIO_BUTTON && !value_) {
setonly();
if (when() & FL_WHEN_CHANGED) do_callback();
@@ -138,7 +140,7 @@ int Fl_Button::handle(int event) {
value(!value());
if (when() & FL_WHEN_CHANGED) do_callback();
}
- if (when() & FL_WHEN_RELEASE) do_callback(); else set_changed();
+ if (when() & FL_WHEN_RELEASE) do_callback();
return 1;
}
default:
@@ -156,5 +158,5 @@ Fl_Button::Fl_Button(int X, int Y, int W, int H, const char *l)
}
//
-// End of "$Id: Fl_Button.cxx,v 1.4.2.6.2.22 2004/04/11 04:38:57 easysw Exp $".
+// End of "$Id: Fl_Button.cxx,v 1.4.2.6.2.23 2004/07/27 16:02:20 easysw Exp $".
//
diff --git a/src/Fl_Choice.cxx b/src/Fl_Choice.cxx
index 7cdcd88..090e069 100644
--- a/src/Fl_Choice.cxx
+++ b/src/Fl_Choice.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Choice.cxx,v 1.10.2.5.2.16 2004/04/11 04:38:57 easysw Exp $"
+// "$Id: Fl_Choice.cxx,v 1.10.2.5.2.17 2004/04/29 02:47:09 easysw Exp $"
//
// Choice widget for the Fast Light Tool Kit (FLTK).
//
@@ -106,6 +106,13 @@ Fl_Choice::Fl_Choice(int X, int Y, int W, int H, const char *l)
color(FL_BACKGROUND2_COLOR);
}
+int Fl_Choice::value(const Fl_Menu_Item *v) {
+ if (!v) return 0;
+ if (!Fl_Menu_::value(v)) return 0;
+ redraw();
+ return 1;
+}
+
int Fl_Choice::value(int v) {
if (v < 0 || v >= (size() - 1)) return 0;
if (!Fl_Menu_::value(v)) return 0;
@@ -152,5 +159,5 @@ int Fl_Choice::handle(int e) {
}
//
-// End of "$Id: Fl_Choice.cxx,v 1.10.2.5.2.16 2004/04/11 04:38:57 easysw Exp $".
+// End of "$Id: Fl_Choice.cxx,v 1.10.2.5.2.17 2004/04/29 02:47:09 easysw Exp $".
//
diff --git a/src/Fl_Color_Chooser.cxx b/src/Fl_Color_Chooser.cxx
index 8684540..b54d395 100644
--- a/src/Fl_Color_Chooser.cxx
+++ b/src/Fl_Color_Chooser.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Color_Chooser.cxx,v 1.7.2.4.2.7 2004/04/11 04:38:57 easysw Exp $"
+// "$Id: Fl_Color_Chooser.cxx,v 1.7.2.4.2.8 2004/07/27 16:02:20 easysw Exp $"
//
// Color chooser for the Fast Light Tool Kit (FLTK).
//
@@ -125,6 +125,7 @@ int Fl_Color_Chooser::rgb(double R, double G, double B) {
double pv = value_;
rgb2hsv(R,G,B,hue_,saturation_,value_);
set_valuators();
+ set_changed();
if (value_ != pv) {
#ifdef UPDATE_HUE_BOX
huebox.damage(FL_DAMAGE_SCROLL);
@@ -157,6 +158,7 @@ int Fl_Color_Chooser::hsv(double H, double S, double V) {
}
hsv2rgb(H,S,V,r_,g_,b_);
set_valuators();
+ set_changed();
return 1;
}
@@ -521,5 +523,5 @@ int fl_color_chooser(const char* name, uchar& r, uchar& g, uchar& b) {
}
//
-// End of "$Id: Fl_Color_Chooser.cxx,v 1.7.2.4.2.7 2004/04/11 04:38:57 easysw Exp $".
+// End of "$Id: Fl_Color_Chooser.cxx,v 1.7.2.4.2.8 2004/07/27 16:02:20 easysw Exp $".
//
diff --git a/src/Fl_Counter.cxx b/src/Fl_Counter.cxx
index 6157efe..43aa96d 100644
--- a/src/Fl_Counter.cxx
+++ b/src/Fl_Counter.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Counter.cxx,v 1.8.2.3.2.14 2004/04/11 04:38:57 easysw Exp $"
+// "$Id: Fl_Counter.cxx,v 1.8.2.3.2.15 2004/07/23 21:12:24 easysw Exp $"
//
// Counter widget for the Fast Light Tool Kit (FLTK).
//
@@ -33,6 +33,7 @@ void Fl_Counter::draw() {
boxtype[0] = box();
if (boxtype[0] == FL_UP_BOX) boxtype[0] = FL_DOWN_BOX;
+ if (boxtype[0] == FL_THIN_UP_BOX) boxtype[0] = FL_THIN_DOWN_BOX;
for (i=1; i<5; i++)
if (mouseobj == i)
boxtype[i] = fl_down(box());
@@ -188,5 +189,5 @@ Fl_Counter::Fl_Counter(int X, int Y, int W, int H, const char* l)
}
//
-// End of "$Id: Fl_Counter.cxx,v 1.8.2.3.2.14 2004/04/11 04:38:57 easysw Exp $".
+// End of "$Id: Fl_Counter.cxx,v 1.8.2.3.2.15 2004/07/23 21:12:24 easysw Exp $".
//
diff --git a/src/Fl_File_Chooser2.cxx b/src/Fl_File_Chooser2.cxx
index 6bbbe68..3fa961a 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_File_Icon.cxx b/src/Fl_File_Icon.cxx
index 540b916..230db3c 100644
--- a/src/Fl_File_Icon.cxx
+++ b/src/Fl_File_Icon.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_File_Icon.cxx,v 1.1.2.16 2004/04/11 04:38:57 easysw Exp $"
+// "$Id: Fl_File_Icon.cxx,v 1.1.2.17 2004/06/14 15:58:52 easysw Exp $"
//
// Fl_File_Icon routines.
//
@@ -298,11 +298,11 @@ Fl_File_Icon::draw(int x, // I - Upper-lefthand X
break;
case POLYGON :
- fl_end_polygon();
+ fl_end_complex_polygon();
break;
case OUTLINEPOLYGON :
- fl_end_polygon();
+ fl_end_complex_polygon();
oc = (Fl_Color)((((unsigned short *)prim)[1] << 16) |
((unsigned short *)prim)[2]);
@@ -368,13 +368,13 @@ Fl_File_Icon::draw(int x, // I - Upper-lefthand X
case POLYGON :
prim = d;
d ++;
- fl_begin_polygon();
+ fl_begin_complex_polygon();
break;
case OUTLINEPOLYGON :
prim = d;
d += 3;
- fl_begin_polygon();
+ fl_begin_complex_polygon();
break;
case VERTEX :
@@ -477,5 +477,5 @@ Fl_File_Icon::labeltype(const Fl_Label *o, // I - Label data
//
-// End of "$Id: Fl_File_Icon.cxx,v 1.1.2.16 2004/04/11 04:38:57 easysw Exp $".
+// End of "$Id: Fl_File_Icon.cxx,v 1.1.2.17 2004/06/14 15:58:52 easysw Exp $".
//
diff --git a/src/Fl_File_Input.cxx b/src/Fl_File_Input.cxx
index e4dbe43..1192756 100644
--- a/src/Fl_File_Input.cxx
+++ b/src/Fl_File_Input.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_File_Input.cxx,v 1.1.2.11 2004/04/11 04:38:57 easysw Exp $"
+// "$Id: Fl_File_Input.cxx,v 1.1.2.12 2004/07/27 16:02:20 easysw Exp $"
//
// File_Input header file for the Fast Light Tool Kit (FLTK).
//
@@ -262,6 +262,7 @@ Fl_File_Input::handle_button(int event) // I - Event
value(newvalue, start - newvalue);
// Then do the callbacks, if necessary...
+ set_changed();
if (when() & FL_WHEN_CHANGED) do_callback();
}
@@ -270,5 +271,5 @@ Fl_File_Input::handle_button(int event) // I - Event
//
-// End of "$Id: Fl_File_Input.cxx,v 1.1.2.11 2004/04/11 04:38:57 easysw Exp $".
+// End of "$Id: Fl_File_Input.cxx,v 1.1.2.12 2004/07/27 16:02:20 easysw Exp $".
//
diff --git a/src/Fl_Gl_Choice.cxx b/src/Fl_Gl_Choice.cxx
index 9b55f82..e827682 100644
--- a/src/Fl_Gl_Choice.cxx
+++ b/src/Fl_Gl_Choice.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Gl_Choice.cxx,v 1.5.2.7.2.17 2004/04/11 04:38:57 easysw Exp $"
+// "$Id: Fl_Gl_Choice.cxx,v 1.5.2.7.2.19 2004/05/15 22:58:18 easysw Exp $"
//
// OpenGL visual selection code for the Fast Light Tool Kit (FLTK).
//
@@ -30,6 +30,7 @@
# include <FL/x.H>
# include <stdlib.h>
# include "Fl_Gl_Choice.H"
+# include <FL/gl_draw.H>
# include "flstring.h"
# ifdef __APPLE__
@@ -178,8 +179,11 @@ Fl_Gl_Choice *Fl_Gl_Choice::find(int m, const int *alistp) {
if ((m & FL_STENCIL) && !pfd.cStencilBits) continue;
// see if better than the one we have already:
if (pixelformat) {
+ // offering non-generic rendering is better (read: hardware accelleration)
+ if (!(chosen_pfd.dwFlags & PFD_GENERIC_FORMAT) &&
+ (pfd.dwFlags & PFD_GENERIC_FORMAT)) continue;
// offering overlay is better:
- if (!(chosen_pfd.bReserved & 15) && (pfd.bReserved & 15)) {}
+ else if (!(chosen_pfd.bReserved & 15) && (pfd.bReserved & 15)) {}
// otherwise more bit planes is better:
else if (chosen_pfd.cColorBits > pfd.cColorBits) continue;
else if (chosen_pfd.cDepthBits > pfd.cDepthBits) continue;
@@ -242,6 +246,7 @@ static void del_context(GLContext ctx) {
break;
}
}
+ if (!nContext) gl_remove_displaylist_fonts();
}
# ifdef WIN32
@@ -347,5 +352,5 @@ void fl_delete_gl_context(GLContext context) {
//
-// End of "$Id: Fl_Gl_Choice.cxx,v 1.5.2.7.2.17 2004/04/11 04:38:57 easysw Exp $".
+// End of "$Id: Fl_Gl_Choice.cxx,v 1.5.2.7.2.19 2004/05/15 22:58:18 easysw Exp $".
//
diff --git a/src/Fl_Help_Dialog.cxx b/src/Fl_Help_Dialog.cxx
index aadee54..5d03cc7 100644
--- a/src/Fl_Help_Dialog.cxx
+++ b/src/Fl_Help_Dialog.cxx
@@ -114,7 +114,7 @@ inline void Fl_Help_Dialog::cb_find__i(Fl_Input*, void*) {
find_pos_ = view_->find(find_->value(), find_pos_);
}
void Fl_Help_Dialog::cb_find_(Fl_Input* o, void* v) {
- ((Fl_Help_Dialog*)(o->parent()->user_data()))->cb_find__i(o,v);
+ ((Fl_Help_Dialog*)(o->parent()->parent()->user_data()))->cb_find__i(o,v);
}
Fl_Help_Dialog::Fl_Help_Dialog() {
@@ -164,9 +164,17 @@ Fl_Help_Dialog::Fl_Help_Dialog() {
o->labelsize(16);
o->callback((Fl_Callback*)cb_larger_);
}
- { Fl_Input* o = find_ = new Fl_Input(10, 350, 265, 25);
- o->callback((Fl_Callback*)cb_find_);
- o->when(FL_WHEN_ENTER_KEY_ALWAYS);
+ { Fl_Group* o = new Fl_Group(10, 350, 265, 25);
+ o->box(FL_DOWN_BOX);
+ o->color(FL_BACKGROUND2_COLOR);
+ { Fl_Input* o = find_ = new Fl_Input(35, 352, 238, 21, "@search");
+ o->tooltip("find text in document");
+ o->box(FL_FLAT_BOX);
+ o->labelsize(13);
+ o->callback((Fl_Callback*)cb_find_);
+ o->when(FL_WHEN_ENTER_KEY_ALWAYS);
+ }
+ o->end();
}
o->end();
}
diff --git a/src/Fl_Help_Dialog.fl b/src/Fl_Help_Dialog.fl
index 7647aaa..4524cbd 100644
--- a/src/Fl_Help_Dialog.fl
+++ b/src/Fl_Help_Dialog.fl
@@ -17,7 +17,7 @@ class FL_EXPORT Fl_Help_Dialog {open
} {
Fl_Window window_ {
label {Help Dialog} open
- private xywh {398 65 530 385} type Double hide resizable
+ private xywh {398 65 530 385} type Double resizable visible
} {
Fl_Group view_ {
callback {if (view_->changed())
@@ -48,7 +48,7 @@ else if (view_->filename())
{
strlcpy(file_[index_], view_->filename(), sizeof(file_[0]));
line_[index_] = view_->topline();
-}} open selected
+}} open
private xywh {10 10 510 330} box DOWN_BOX selection_color 15 resizable
code0 {\#include <FL/Fl_Help_View.H>}
class Fl_Help_View
@@ -115,9 +115,14 @@ if (view_->textsize() >= 18)
smaller_->activate();}
private tooltip {Make the help text larger.} xywh {320 350 25 25} labelfont 1 labelsize 16
}
- Fl_Input find_ {
- callback {find_pos_ = view_->find(find_->value(), find_pos_);}
- private xywh {10 350 265 25} when 10
+ Fl_Group {} {open
+ xywh {10 350 265 25} box DOWN_BOX color 7
+ } {
+ Fl_Input find_ {
+ label {@search}
+ callback {find_pos_ = view_->find(find_->value(), find_pos_);} selected
+ private tooltip {find text in document} xywh {35 352 238 21} box FLAT_BOX labelsize 13 when 10
+ }
}
}
code {back_->deactivate();
diff --git a/src/Fl_Help_View.cxx b/src/Fl_Help_View.cxx
index d1d1052..5882377 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.49 2004/04/11 04:38:57 easysw Exp $"
+// "$Id: Fl_Help_View.cxx,v 1.1.2.53 2004/07/27 16:02:20 easysw Exp $"
//
// Fl_Help_View widget routines.
//
@@ -782,8 +782,8 @@ Fl_Help_View::find(const char *s, // I - String to find
*sp; // Search string pointer
- // Range check input...
- if (!s) return -1;
+ // Range check input and value...
+ if (!s || !value_) return -1;
if (p < 0 || p >= (int)strlen(value_)) p = 0;
else if (p > 0) p ++;
@@ -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;
@@ -1368,6 +1372,7 @@ Fl_Help_View::format()
needspace = 0;
line = 0;
newalign = get_align(attrs, tolower(buf[1]) == 'h' ? CENTER : LEFT);
+ talign = newalign;
cells[column] = block - blocks_;
@@ -1568,8 +1573,19 @@ Fl_Help_View::format()
}
}
- topline(topline_);
- leftline(leftline_);
+ // Reset scrolling if it needs to be...
+ if (scrollbar_.visible()) {
+ int temph = h() - 8;
+ if (hscrollbar_.visible()) temph -= 16;
+ if ((topline_ + temph) > size_) topline(size_ - temph);
+ else topline(topline_);
+ } else topline(0);
+
+ if (hscrollbar_.visible()) {
+ int tempw = w() - 24;
+ if ((leftline_ + tempw) > hsize_) leftline(hsize_ - tempw);
+ else leftline(leftline_);
+ } else leftline(0);
}
@@ -1942,7 +1958,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;
}
@@ -2591,8 +2607,8 @@ Fl_Help_View::topline(int t) // I - Top line number
scrollbar_.value(topline_, h() - 24, 0, size_);
+ set_changed();
do_callback();
- clear_changed();
redraw();
}
@@ -2795,5 +2811,5 @@ hscrollbar_callback(Fl_Widget *s, void *)
//
-// End of "$Id: Fl_Help_View.cxx,v 1.1.2.49 2004/04/11 04:38:57 easysw Exp $".
+// End of "$Id: Fl_Help_View.cxx,v 1.1.2.53 2004/07/27 16:02:20 easysw Exp $".
//
diff --git a/src/Fl_Input_.cxx b/src/Fl_Input_.cxx
index 03e3045..f9378f6 100644
--- a/src/Fl_Input_.cxx
+++ b/src/Fl_Input_.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Input_.cxx,v 1.21.2.11.2.29 2004/04/11 04:38:57 easysw Exp $"
+// "$Id: Fl_Input_.cxx,v 1.21.2.11.2.30 2004/07/27 16:02:21 easysw Exp $"
//
// Common input widget routines for the Fast Light Tool Kit (FLTK).
//
@@ -599,7 +599,8 @@ int Fl_Input_::replace(int b, int e, const char* text, int ilen) {
mark_ = position_ = undoat;
- if (when()&FL_WHEN_CHANGED) do_callback(); else set_changed();
+ set_changed();
+ if (when()&FL_WHEN_CHANGED) do_callback();
return 1;
}
@@ -636,7 +637,8 @@ int Fl_Input_::undo() {
position_ = b;
minimal_update(b1);
- if (when()&FL_WHEN_CHANGED) do_callback(); else set_changed();
+ set_changed();
+ if (when()&FL_WHEN_CHANGED) do_callback();
return 1;
}
@@ -649,7 +651,8 @@ int Fl_Input_::copy_cuts() {
void Fl_Input_::maybe_do_callback() {
if (changed() || (when()&FL_WHEN_NOT_CHANGED)) {
- clear_changed(); do_callback();}
+ do_callback();
+ }
}
int Fl_Input_::handletext(int event, int X, int Y, int W, int H) {
@@ -852,5 +855,5 @@ Fl_Input_::~Fl_Input_() {
}
//
-// End of "$Id: Fl_Input_.cxx,v 1.21.2.11.2.29 2004/04/11 04:38:57 easysw Exp $".
+// End of "$Id: Fl_Input_.cxx,v 1.21.2.11.2.30 2004/07/27 16:02:21 easysw Exp $".
//
diff --git a/src/Fl_Menu.cxx b/src/Fl_Menu.cxx
index a39db67..7a62f0a 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.30 2004/04/11 04:38:57 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).
//
@@ -53,6 +53,7 @@ const Fl_Menu_Item* Fl_Menu_Item::next(int n) const {
if (n < 0) return 0; // this is so selected==-1 returns NULL
const Fl_Menu_Item* m = this;
int nest = 0;
+ if (!m->visible()) n++;
while (n>0) {
if (!m->text) {
if (!nest) return m;
@@ -239,6 +240,7 @@ menuwindow::menuwindow(const Fl_Menu_Item* m, int X, int Y, int Wp, int Hp,
set_modal();
clear_border();
menu = m;
+ if (m) m = m->first(); // find the first item that needs to be rendered
drawn_selected = -1;
if (button) {
box(button->box());
@@ -379,7 +381,7 @@ void menuwindow::draw() {
fl_draw_box(box(), 0, 0, w(), h(), color());
if (menu) {
const Fl_Menu_Item* m; int j;
- for (m=menu, j=0; m->text; j++, m = m->next()) drawentry(m, j, 0);
+ for (m=menu->first(), j=0; m->text; j++, m = m->next()) drawentry(m, j, 0);
}
} else {
if (damage() & FL_DAMAGE_CHILD && selected!=drawn_selected) { // change selection
@@ -403,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;
+ 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;
@@ -421,7 +423,7 @@ int menuwindow::find_selected(int mx, int my) {
int menuwindow::titlex(int n) {
const Fl_Menu_Item* m;
int xx = 3;
- for (m=menu; n--; m = m->next()) xx += m->measure(0, button) + 16;
+ for (m=menu->first(); n--; m = m->next()) xx += m->measure(0, button) + 16;
return xx;
}
@@ -754,7 +756,7 @@ Fl_Menu_Item::popup(
// Search only the top level menu for a shortcut. Either &x in the
// label or the shortcut fields are used:
const Fl_Menu_Item* Fl_Menu_Item::find_shortcut(int* ip) const {
- const Fl_Menu_Item* m = this;
+ const Fl_Menu_Item* m = first();
if (m) for (int ii = 0; m->text; m = m->next(), ii++) {
if (m->activevisible()) {
if (Fl::test_shortcut(m->shortcut_)
@@ -770,7 +772,7 @@ const Fl_Menu_Item* Fl_Menu_Item::find_shortcut(int* ip) const {
// Recursive search of all submenus for anything with this key as a
// shortcut. Only uses the shortcut field, ignores &x in the labels:
const Fl_Menu_Item* Fl_Menu_Item::test_shortcut() const {
- const Fl_Menu_Item* m = this;
+ const Fl_Menu_Item* m = first();
const Fl_Menu_Item* ret = 0;
if (m) for (; m->text; m = m->next()) {
if (m->activevisible()) {
@@ -789,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.30 2004/04/11 04:38:57 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_Menu_.cxx b/src/Fl_Menu_.cxx
index e84b0b5..748e6bf 100644
--- a/src/Fl_Menu_.cxx
+++ b/src/Fl_Menu_.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Menu_.cxx,v 1.7.2.8.2.9 2004/04/11 04:38:57 easysw Exp $"
+// "$Id: Fl_Menu_.cxx,v 1.7.2.8.2.10 2004/07/27 16:02:21 easysw Exp $"
//
// Common menu code for the Fast Light Tool Kit (FLTK).
//
@@ -138,7 +138,6 @@ const Fl_Menu_Item* Fl_Menu_::picked(const Fl_Menu_Item* v) {
value_ = v;
if (when()&(FL_WHEN_CHANGED|FL_WHEN_RELEASE)) {
if (changed() || when()&FL_WHEN_NOT_CHANGED) {
- clear_changed();
if (value_ && value_->callback_) value_->do_callback((Fl_Widget*)this);
else do_callback();
}
@@ -225,5 +224,5 @@ void Fl_Menu_::clear() {
}
//
-// End of "$Id: Fl_Menu_.cxx,v 1.7.2.8.2.9 2004/04/11 04:38:57 easysw Exp $".
+// End of "$Id: Fl_Menu_.cxx,v 1.7.2.8.2.10 2004/07/27 16:02:21 easysw Exp $".
//
diff --git a/src/Fl_Menu_Bar.cxx b/src/Fl_Menu_Bar.cxx
index 7161dca..d2d38bc 100644
--- a/src/Fl_Menu_Bar.cxx
+++ b/src/Fl_Menu_Bar.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Menu_Bar.cxx,v 1.7.2.6.2.4 2004/04/11 04:38:58 easysw Exp $"
+// "$Id: Fl_Menu_Bar.cxx,v 1.7.2.6.2.5 2004/06/07 19:23:12 matthiaswm Exp $"
//
// Menu bar widget for the Fast Light Tool Kit (FLTK).
//
@@ -32,7 +32,7 @@ void Fl_Menu_Bar::draw() {
if (!menu() || !menu()->text) return;
const Fl_Menu_Item* m;
int X = x()+6;
- for (m=menu(); m->text; m = m->next()) {
+ for (m=menu()->first(); m->text; m = m->next()) {
int W = m->measure(0,this) + 16;
m->draw(X, y(), W, h(), this);
X += W;
@@ -72,5 +72,5 @@ int Fl_Menu_Bar::handle(int event) {
}
//
-// End of "$Id: Fl_Menu_Bar.cxx,v 1.7.2.6.2.4 2004/04/11 04:38:58 easysw Exp $".
+// End of "$Id: Fl_Menu_Bar.cxx,v 1.7.2.6.2.5 2004/06/07 19:23:12 matthiaswm Exp $".
//
diff --git a/src/Fl_Pack.cxx b/src/Fl_Pack.cxx
index cfaf198..f827288 100644
--- a/src/Fl_Pack.cxx
+++ b/src/Fl_Pack.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Pack.cxx,v 1.6.2.4.2.6 2004/04/11 04:38:58 easysw Exp $"
+// "$Id: Fl_Pack.cxx,v 1.6.2.4.2.7 2004/04/25 01:39:36 easysw Exp $"
//
// Packing widget for the Fast Light Tool Kit (FLTK).
//
@@ -45,7 +45,7 @@ void Fl_Pack::draw() {
int tw = w()-Fl::box_dw(box());
int th = h()-Fl::box_dh(box());
int rw, rh;
- int current_position = horizontal() ? tx : ty;
+ int current_position = (horizontal() ? tx : ty) + spacing_ / 2;
int maximum_position = current_position;
uchar d = damage();
Fl_Widget*const* a = array();
@@ -102,7 +102,10 @@ void Fl_Pack::draw() {
o->resize(X,Y,W,H);
o->clear_damage(FL_DAMAGE_ALL);
}
- if (d&FL_DAMAGE_ALL) draw_child(*o); else update_child(*o);
+ if (d&FL_DAMAGE_ALL) {
+ draw_child(*o);
+ draw_outside_label(*o);
+ } else update_child(*o);
// child's draw() can change it's size, so use new size:
current_position += (horizontal() ? o->w() : o->h());
if (current_position > maximum_position)
@@ -127,10 +130,16 @@ void Fl_Pack::draw() {
tw += Fl::box_dw(box()); if (tw <= 0) tw = 1;
th += Fl::box_dh(box()); if (th <= 0) th = 1;
- if (tw != w() || th != h()) {Fl_Widget::resize(x(),y(),tw,th); d = FL_DAMAGE_ALL;}
- if (d&FL_DAMAGE_ALL) draw_box();
+ if (tw != w() || th != h()) {
+ Fl_Widget::resize(x(),y(),tw,th);
+ d = FL_DAMAGE_ALL;
+ }
+ if (d&FL_DAMAGE_ALL) {
+ draw_box();
+ draw_label();
+ }
}
//
-// End of "$Id: Fl_Pack.cxx,v 1.6.2.4.2.6 2004/04/11 04:38:58 easysw Exp $".
+// End of "$Id: Fl_Pack.cxx,v 1.6.2.4.2.7 2004/04/25 01:39:36 easysw Exp $".
//
diff --git a/src/Fl_Positioner.cxx b/src/Fl_Positioner.cxx
index 0540b64..1c356ee 100644
--- a/src/Fl_Positioner.cxx
+++ b/src/Fl_Positioner.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Positioner.cxx,v 1.4.2.3.2.4 2004/04/11 04:38:58 easysw Exp $"
+// "$Id: Fl_Positioner.cxx,v 1.4.2.3.2.5 2004/07/27 16:02:21 easysw Exp $"
//
// Positioner widget for the Fast Light Tool Kit (FLTK).
//
@@ -89,9 +89,11 @@ int Fl_Positioner::handle(int event, int X, int Y, int W, int H) {
if (yy > ymax) yy = ymax;
if (value(xx, yy)) set_changed();}
if (!(when() & FL_WHEN_CHANGED ||
- when() & FL_WHEN_RELEASE && event == FL_RELEASE)) return 1;
+ (when() & FL_WHEN_RELEASE && event == FL_RELEASE))) return 1;
if (changed() || when()&FL_WHEN_NOT_CHANGED) {
- clear_changed(); do_callback();}
+ if (event == FL_RELEASE) clear_changed();
+ do_callback();
+ }
return 1;
default:
return 0;
@@ -129,5 +131,5 @@ void Fl_Positioner::ybounds(double a, double b) {
}
//
-// End of "$Id: Fl_Positioner.cxx,v 1.4.2.3.2.4 2004/04/11 04:38:58 easysw Exp $".
+// End of "$Id: Fl_Positioner.cxx,v 1.4.2.3.2.5 2004/07/27 16:02:21 easysw Exp $".
//
diff --git a/src/Fl_Scroll.cxx b/src/Fl_Scroll.cxx
index 76041ce..1aa9767 100644
--- a/src/Fl_Scroll.cxx
+++ b/src/Fl_Scroll.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Scroll.cxx,v 1.7.2.6.2.11 2004/04/11 04:38:58 easysw Exp $"
+// "$Id: Fl_Scroll.cxx,v 1.7.2.6.2.12 2004/05/15 22:58:18 easysw Exp $"
//
// Scroll widget for the Fast Light Tool Kit (FLTK).
//
@@ -257,7 +257,8 @@ void Fl_Scroll::position(int X, int Y) {
if (o == &hscrollbar || o == &scrollbar) continue;
o->position(o->x()+dx, o->y()+dy);
}
- damage(FL_DAMAGE_SCROLL);
+ if (parent() == (Fl_Group *)window() && Fl::scheme_bg_) damage(FL_DAMAGE_ALL);
+ else damage(FL_DAMAGE_SCROLL);
}
void Fl_Scroll::hscrollbar_cb(Fl_Widget* o, void*) {
@@ -290,5 +291,5 @@ int Fl_Scroll::handle(int event) {
}
//
-// End of "$Id: Fl_Scroll.cxx,v 1.7.2.6.2.11 2004/04/11 04:38:58 easysw Exp $".
+// End of "$Id: Fl_Scroll.cxx,v 1.7.2.6.2.12 2004/05/15 22:58:18 easysw Exp $".
//
diff --git a/src/Fl_Scrollbar.cxx b/src/Fl_Scrollbar.cxx
index 238a14a..d006eb8 100644
--- a/src/Fl_Scrollbar.cxx
+++ b/src/Fl_Scrollbar.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Scrollbar.cxx,v 1.7.2.14.2.16 2004/04/11 04:38:58 easysw Exp $"
+// "$Id: Fl_Scrollbar.cxx,v 1.7.2.14.2.17 2004/07/27 16:02:21 easysw Exp $"
//
// Scroll bar widget for the Fast Light Tool Kit (FLTK).
//
@@ -176,6 +176,7 @@ int Fl_Scrollbar::handle(int event) {
if (v != value()) {
Fl_Slider::value(v);
value_damage();
+ set_changed();
do_callback();
}
return 1;}
@@ -242,5 +243,5 @@ Fl_Scrollbar::Fl_Scrollbar(int X, int Y, int W, int H, const char* L)
}
//
-// End of "$Id: Fl_Scrollbar.cxx,v 1.7.2.14.2.16 2004/04/11 04:38:58 easysw Exp $".
+// End of "$Id: Fl_Scrollbar.cxx,v 1.7.2.14.2.17 2004/07/27 16:02:21 easysw Exp $".
//
diff --git a/src/Fl_Tabs.cxx b/src/Fl_Tabs.cxx
index bc8a143..9448f66 100644
--- a/src/Fl_Tabs.cxx
+++ b/src/Fl_Tabs.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Tabs.cxx,v 1.6.2.10.2.19 2004/04/11 04:38:58 easysw Exp $"
+// "$Id: Fl_Tabs.cxx,v 1.6.2.10.2.20 2004/07/27 16:02:21 easysw Exp $"
//
// Tab widget for the Fast Light Tool Kit (FLTK).
//
@@ -133,8 +133,13 @@ int Fl_Tabs::handle(int event) {
case FL_DRAG:
case FL_RELEASE:
o = which(Fl::event_x(), Fl::event_y());
- if (event == FL_RELEASE) {push(0); if (o && value(o)) do_callback();}
- else push(o);
+ if (event == FL_RELEASE) {
+ push(0);
+ if (o && value(o)) {
+ set_changed();
+ do_callback();
+ }
+ } else push(o);
if (Fl::visible_focus() && event == FL_RELEASE) Fl::focus(this);
return 1;
case FL_FOCUS:
@@ -160,6 +165,7 @@ int Fl_Tabs::handle(int event) {
for (i = 1; i < children(); i ++)
if (child(i)->visible()) break;
value(child(i - 1));
+ set_changed();
do_callback();
return 1;
case FL_Right:
@@ -167,6 +173,7 @@ int Fl_Tabs::handle(int event) {
for (i = 0; i < children(); i ++)
if (child(i)->visible()) break;
value(child(i + 1));
+ set_changed();
do_callback();
return 1;
case FL_Down:
@@ -302,5 +309,5 @@ Fl_Tabs::Fl_Tabs(int X,int Y,int W, int H, const char *l) :
}
//
-// End of "$Id: Fl_Tabs.cxx,v 1.6.2.10.2.19 2004/04/11 04:38:58 easysw Exp $".
+// End of "$Id: Fl_Tabs.cxx,v 1.6.2.10.2.20 2004/07/27 16:02:21 easysw Exp $".
//
diff --git a/src/Fl_Text_Buffer.cxx b/src/Fl_Text_Buffer.cxx
index 558ff7f..e5e4e17 100644
--- a/src/Fl_Text_Buffer.cxx
+++ b/src/Fl_Text_Buffer.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Text_Buffer.cxx,v 1.9.2.20 2004/04/11 04:38:58 easysw Exp $"
+// "$Id: Fl_Text_Buffer.cxx,v 1.9.2.21 2004/06/01 20:33:26 easysw Exp $"
//
// Copyright 2001-2004 by Bill Spitzak and others.
// Original code Copyright Mark Edel. Permission to distribute under
@@ -268,6 +268,11 @@ void Fl_Text_Buffer::replace( int start, int end, const char *s ) {
const char * deletedText;
int nInserted;
+ // Range check...
+ if (!s) return;
+ if (start < 0) start = 0;
+ if (end > mLength) end = mLength;
+
call_predelete_callbacks( start, end-start );
deletedText = text_range( start, end );
remove_( start, end );
@@ -292,6 +297,8 @@ void Fl_Text_Buffer::remove( int start, int end ) {
if ( end > mLength ) end = mLength;
if ( end < 0 ) end = 0;
+ if (start == end) return;
+
call_predelete_callbacks( start, end-start );
/* Remove and redisplay */
deletedText = text_range( start, end );
@@ -2510,5 +2517,5 @@ Fl_Text_Buffer::outputfile(const char *file, int start, int end, int buflen) {
//
-// End of "$Id: Fl_Text_Buffer.cxx,v 1.9.2.20 2004/04/11 04:38:58 easysw Exp $".
+// End of "$Id: Fl_Text_Buffer.cxx,v 1.9.2.21 2004/06/01 20:33:26 easysw Exp $".
//
diff --git a/src/Fl_Text_Display.cxx b/src/Fl_Text_Display.cxx
index 0d6c9da..78a55ac 100644
--- a/src/Fl_Text_Display.cxx
+++ b/src/Fl_Text_Display.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Text_Display.cxx,v 1.12.2.51 2004/04/11 04:38:58 easysw Exp $"
+// "$Id: Fl_Text_Display.cxx,v 1.12.2.56 2004/07/27 18:40:29 easysw Exp $"
//
// Copyright 2001-2004 by Bill Spitzak and others.
// Original code Copyright Mark Edel. Permission to distribute under
@@ -47,11 +47,13 @@
/* Masks for text drawing methods. These are or'd together to form an
integer which describes what drawing calls to use to draw a string */
-#define FILL_MASK 0x100
-#define SECONDARY_MASK 0x200
-#define PRIMARY_MASK 0x400
-#define HIGHLIGHT_MASK 0x800
-#define STYLE_LOOKUP_MASK 0xff
+#define FILL_MASK 0x0100
+#define SECONDARY_MASK 0x0200
+#define PRIMARY_MASK 0x0400
+#define HIGHLIGHT_MASK 0x0800
+#define BG_ONLY_MASK 0x1000
+#define TEXT_ONLY_MASK 0x2000
+#define STYLE_LOOKUP_MASK 0xff
/* Maximum displayable line length (how many characters will fit across the
widest window). This amount of memory is temporarily allocated from the
@@ -114,7 +116,7 @@ Fl_Text_Display::Fl_Text_Display(int X, int Y, int W, int H, const char* l)
mCursor_color = FL_BLACK;
- mFixedFontWidth = TMPFONTWIDTH;// CET - FIXME
+ mFixedFontWidth = -1;
mStyleBuffer = 0;
mStyleTable = 0;
mNStyles = 0;
@@ -343,7 +345,14 @@ int Fl_Text_Display::longest_vline() {
** Change the size of the displayed text area
*/
void Fl_Text_Display::resize(int X, int Y, int W, int H) {
+#ifdef DEBUG
+ printf("Fl_Text_Display::resize(X=%d, Y=%d, W=%d, H=%d)\n", X, Y, W, H);
+#endif // DEBUG
const int oldWidth = w();
+#ifdef DEBUG
+ printf(" oldWidth=%d, mContinuousWrap=%d, mWrapMargin=%d\n", oldWidth,
+ mContinuousWrap, mWrapMargin);
+#endif // DEBUG
Fl_Widget::resize(X,Y,W,H);
if (!buffer()) return;
X += Fl::box_dx(box());
@@ -376,10 +385,14 @@ void Fl_Text_Display::resize(int X, int Y, int W, int H) {
the top character no longer pointing at a valid line start */
if (mContinuousWrap && !mWrapMargin && W!=oldWidth) {
int oldFirstChar = mFirstChar;
- mNBufferLines = count_lines(0, buffer()->length(), true);
- mFirstChar = line_start(mFirstChar);
- mTopLineNum = count_lines(0, mFirstChar, true)+1;
- absolute_top_line_number(oldFirstChar);
+ mNBufferLines = count_lines(0, buffer()->length(), true);
+ mFirstChar = line_start(mFirstChar);
+ mTopLineNum = count_lines(0, mFirstChar, true)+1;
+ absolute_top_line_number(oldFirstChar);
+
+#ifdef DEBUG
+ printf(" mNBufferLines=%d\n", mNBufferLines);
+#endif // DEBUG
}
/* reallocate and update the line starts array, which may have changed
@@ -390,10 +403,11 @@ void Fl_Text_Display::resize(int X, int Y, int W, int H) {
mNVisibleLines = nvlines;
if (mLineStarts) delete[] mLineStarts;
mLineStarts = new int [mNVisibleLines];
- calc_line_starts(0, mNVisibleLines);
- calc_last_char();
}
+ calc_line_starts(0, mNVisibleLines);
+ calc_last_char();
+
// figure the scrollbars
if (scrollbar_width()) {
/* Decide if the vertical scroll bar needs to be visible */
@@ -483,7 +497,7 @@ void Fl_Text_Display::resize(int X, int Y, int W, int H) {
display_insert_position_hint = 0;
if (mContinuousWrap ||
- hscrollbarvisible != mHScrollBar->visible() ||
+ hscrollbarvisible != mHScrollBar->visible() ||
vscrollbarvisible != mVScrollBar->visible())
redraw();
@@ -628,39 +642,24 @@ void Fl_Text_Display::cursor_style(int style) {
}
void Fl_Text_Display::wrap_mode(int wrap, int wrapMargin) {
- mWrapMargin = wrapMargin;
- mContinuousWrap = wrap;
-
- /* wrapping can change change the total number of lines, re-count */
- mNBufferLines = count_lines(0, buffer()->length(), true);
-
- /* changing wrap margins wrap or changing from wrapped mode to non-wrapped
- can leave the character at the top no longer at a line start, and/or
- change the line number */
- mFirstChar = line_start(mFirstChar);
- mTopLineNum = count_lines(0, mFirstChar, true) + 1;
- reset_absolute_top_line_number();
-
- /* update the line starts array */
- calc_line_starts(0, mNVisibleLines);
- calc_last_char();
-
-#if 0
- // FIXME!
- /* Update the scroll bar page increment size (as well as other scroll
- bar parameters) */
- updateVScrollBarRange(textD);
- updateHScrollBarRange(textD);
-
- /* Decide if the horizontal scroll bar needs to be visible */
- hideOrShowHScrollBar(textD);
-
- /* Do a full redraw */
- TextDRedisplayRect(textD, 0, textD->top, textD->width + textD->left,
- textD->height);
-#else
- resize(x(), y(), w(), h());
-#endif
+ mWrapMargin = wrapMargin;
+ mContinuousWrap = wrap;
+
+ /* wrapping can change change the total number of lines, re-count */
+ mNBufferLines = count_lines(0, buffer()->length(), true);
+
+ /* changing wrap margins wrap or changing from wrapped mode to non-wrapped
+ can leave the character at the top no longer at a line start, and/or
+ change the line number */
+ mFirstChar = line_start(mFirstChar);
+ mTopLineNum = count_lines(0, mFirstChar, true) + 1;
+ reset_absolute_top_line_number();
+
+ /* update the line starts array */
+ calc_line_starts(0, mNVisibleLines);
+ calc_last_char();
+
+ resize(x(), y(), w(), h());
}
/*
@@ -796,7 +795,7 @@ int Fl_Text_Display::position_to_xy( int pos, int* X, int* Y ) {
outIndex += charLen;
}
*X = xStep;
- delete [] (char *)lineStr;
+ free((char *)lineStr);
return 1;
}
@@ -1015,7 +1014,12 @@ int Fl_Text_Display::move_down() {
int Fl_Text_Display::count_lines(int startPos, int endPos,
bool startPosIsLineStart) {
int retLines, retPos, retLineStart, retLineEnd;
-
+
+#ifdef DEBUG
+ printf("Fl_Text_Display::count_line(startPos=%d, endPos=%d, startPosIsLineStart=%d\n",
+ startPos, endPos, startPosIsLineStart);
+#endif // DEBUG
+
/* If we're not wrapping use simple (and more efficient) BufCountLines */
if (!mContinuousWrap)
return buffer()->count_lines(startPos, endPos);
@@ -1023,6 +1027,12 @@ int Fl_Text_Display::count_lines(int startPos, int endPos,
wrapped_line_counter(buffer(), startPos, endPos, INT_MAX,
startPosIsLineStart, 0, &retPos, &retLines, &retLineStart,
&retLineEnd);
+
+#ifdef DEBUG
+ printf("retPos=%d, retLines=%d, retLineStart=%d, retLineEnd=%d\n",
+ retPos, retLines, retLineStart, retLineEnd);
+#endif // DEBUG
+
return retLines;
}
@@ -1489,6 +1499,43 @@ void Fl_Text_Display::draw_vline(int visLineNum, int leftClip, int rightClip,
draw parts whenever the style changes (also note if the cursor is on
this line, and where it should be drawn to take advantage of the x
position which we've gone to so much trouble to calculate) */
+ /* since characters between style may overlap, we draw the full
+ background first */
+ int sX = startX;
+ outPtr = outStr;
+ outIndex = outStartIndex;
+ X = startX;
+ for ( charIndex = startIndex; charIndex < rightCharIndex; charIndex++ ) {
+ charLen = charIndex >= lineLen ? 1 :
+ Fl_Text_Buffer::expand_character( lineStr[ charIndex ], outIndex, expandedChar,
+ buf->tab_distance(), buf->null_substitution_character() );
+ charStyle = position_style( lineStartPos, lineLen, charIndex,
+ outIndex + dispIndexOffset );
+ for ( i = 0; i < charLen; i++ ) {
+ if ( i != 0 && charIndex < lineLen && lineStr[ charIndex ] == '\t' )
+ charStyle = position_style( lineStartPos, lineLen,
+ charIndex, outIndex + dispIndexOffset );
+ if ( charStyle != style ) {
+ draw_string( style|BG_ONLY_MASK, sX, Y, X, outStr, outPtr - outStr );
+ outPtr = outStr;
+ sX = X;
+ style = charStyle;
+ }
+ if ( charIndex < lineLen ) {
+ *outPtr = expandedChar[ i ];
+ charWidth = string_width( &expandedChar[ i ], 1, charStyle );
+ } else
+ charWidth = stdCharWidth;
+ outPtr++;
+ X += charWidth;
+ outIndex++;
+ }
+ if ( outPtr - outStr + FL_TEXT_MAX_EXP_CHAR_LEN >= MAX_DISP_LINE_LEN || X >= rightClip )
+ break;
+ }
+ draw_string( style|BG_ONLY_MASK, sX, Y, X, outStr, outPtr - outStr );
+
+ /* now draw the text over the previously erased background */
outPtr = outStr;
outIndex = outStartIndex;
X = startX;
@@ -1503,7 +1550,7 @@ void Fl_Text_Display::draw_vline(int visLineNum, int leftClip, int rightClip,
charStyle = position_style( lineStartPos, lineLen,
charIndex, outIndex + dispIndexOffset );
if ( charStyle != style ) {
- draw_string( style, startX, Y, X, outStr, outPtr - outStr );
+ draw_string( style|TEXT_ONLY_MASK, startX, Y, X, outStr, outPtr - outStr );
outPtr = outStr;
startX = X;
style = charStyle;
@@ -1522,7 +1569,7 @@ void Fl_Text_Display::draw_vline(int visLineNum, int leftClip, int rightClip,
}
/* Draw the remaining style segment */
- draw_string( style, startX, Y, X, outStr, outPtr - outStr );
+ draw_string( style|TEXT_ONLY_MASK, startX, Y, X, outStr, outPtr - outStr );
/* Draw the cursor if part of it appeared on the redisplayed part of
this line. Also check for the cases which are not caught as the
@@ -1563,6 +1610,7 @@ void Fl_Text_Display::draw_string( int style, int X, int Y, int toX,
/* Draw blank area rather than text, if that was the request */
if ( style & FILL_MASK ) {
+ if (style & TEXT_ONLY_MASK) return;
clear_rect( style, X, Y, toX - X, mMaxsize );
return;
}
@@ -1601,11 +1649,15 @@ void Fl_Text_Display::draw_string( int style, int X, int Y, int toX,
background = color();
}
- fl_color( background );
- fl_rectf( X, Y, toX - X, mMaxsize );
- fl_color( foreground );
- fl_font( font, fsize );
- fl_draw( string, nChars, X, Y + mMaxsize - fl_descent());
+ if (!(style & TEXT_ONLY_MASK)) {
+ fl_color( background );
+ fl_rectf( X, Y, toX - X, mMaxsize );
+ }
+ if (!(style & BG_ONLY_MASK)) {
+ fl_color( foreground );
+ fl_font( font, fsize );
+ fl_draw( string, nChars, X, Y + mMaxsize - fl_descent());
+ }
// CET - FIXME
/* If any space around the character remains unfilled (due to use of
@@ -1637,7 +1689,11 @@ void Fl_Text_Display::clear_rect( int style, int X, int Y,
return;
if ( Fl::focus() != this ) {
- fl_color( color() );
+ if (style & (HIGHLIGHT_MASK | PRIMARY_MASK)) {
+ fl_color(fl_color_average(color(), selection_color(), 0.5f));
+ } else {
+ fl_color( color() );
+ }
fl_rectf( X, Y, width, height );
} else if ( style & HIGHLIGHT_MASK ) {
fl_color( fl_contrast(textcolor(), color()) );
@@ -1841,7 +1897,7 @@ int Fl_Text_Display::xy_to_position( int X, int Y, int posType ) {
/* If the X position was beyond the end of the line, return the position
of the newline at the end of the line */
- delete [] (char *)lineStr;
+ free((char *)lineStr);
return lineStart + lineLen;
}
@@ -2133,6 +2189,12 @@ void Fl_Text_Display::update_v_scrollbar() {
line number, and the number of visible lines respectively. The scroll
bar maximum value is chosen to generally represent the size of the whole
buffer, with minor adjustments to keep the scroll bar widget happy */
+#ifdef DEBUG
+ printf("Fl_Text_Display::update_v_scrollbar():\n"
+ " mTopLineNum=%d, mNVisibleLines=%d, mNBufferLines=%d\n",
+ mTopLineNum, mNVisibleLines, mNBufferLines);
+#endif // DEBUG
+
mVScrollBar->value(mTopLineNum, mNVisibleLines, 1, mNBufferLines+2);
mVScrollBar->linesize(3);
}
@@ -2824,6 +2886,8 @@ void Fl_Text_Display::draw(void) {
// don't even try if there is no associated text buffer!
if (!buffer()) { draw_box(); return; }
+ fl_push_clip(x(),y(),w(),h()); // prevent drawing outside widget area
+
// draw the non-text, non-scrollbar areas.
if (damage() & FL_DAMAGE_ALL) {
// printf("drawing all (box = %d)\n", box());
@@ -2930,6 +2994,7 @@ void Fl_Text_Display::draw(void) {
mCursorOldY = Y;
fl_pop_clip();
}
+ fl_pop_clip();
}
// this processes drag events due to mouse for Fl_Text_Display and
@@ -2969,7 +3034,7 @@ int Fl_Text_Display::handle(int event) {
// This isn't very elegant!
if (!Fl::event_inside(text_area.x, text_area.y, text_area.w, text_area.h) &&
!dragging && event != FL_LEAVE && event != FL_ENTER &&
- event != FL_MOVE) {
+ event != FL_MOVE && event != FL_FOCUS && event != FL_UNFOCUS) {
return Fl_Group::handle(event);
}
@@ -3056,9 +3121,9 @@ int Fl_Text_Display::handle(int event) {
case FL_FOCUS:
case FL_UNFOCUS:
- if (buffer()->primary_selection()->start() !=
- buffer()->primary_selection()->end()) redraw(); // Redraw selections...
- break;
+ if (buffer()->selected()) redraw();
+
+ return 1;
}
return 0;
@@ -3066,5 +3131,5 @@ int Fl_Text_Display::handle(int event) {
//
-// End of "$Id: Fl_Text_Display.cxx,v 1.12.2.51 2004/04/11 04:38:58 easysw Exp $".
+// End of "$Id: Fl_Text_Display.cxx,v 1.12.2.56 2004/07/27 18:40:29 easysw Exp $".
//
diff --git a/src/Fl_Text_Editor.cxx b/src/Fl_Text_Editor.cxx
index 0b14258..decc121 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.18 2004/04/11 04:38:58 easysw Exp $"
+// "$Id: Fl_Text_Editor.cxx,v 1.9.2.21 2004/07/27 16:02:21 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 }
@@ -187,8 +185,8 @@ int Fl_Text_Editor::kf_default(int c, Fl_Text_Editor* e) {
if (e->insert_mode()) e->insert(s);
else e->overstrike(s);
e->show_insert_position();
+ e->set_changed();
if (e->when()&FL_WHEN_CHANGED) e->do_callback();
- else e->set_changed();
return 1;
}
@@ -201,7 +199,8 @@ int Fl_Text_Editor::kf_backspace(int, Fl_Text_Editor* e) {
e->buffer()->select(e->insert_position(), e->insert_position()+1);
kill_selection(e);
e->show_insert_position();
- if (e->when()&FL_WHEN_CHANGED) e->do_callback(); else e->set_changed();
+ e->set_changed();
+ if (e->when()&FL_WHEN_CHANGED) e->do_callback();
return 1;
}
@@ -209,7 +208,8 @@ int Fl_Text_Editor::kf_enter(int, Fl_Text_Editor* e) {
kill_selection(e);
e->insert("\n");
e->show_insert_position();
- if (e->when()&FL_WHEN_CHANGED) e->do_callback(); else e->set_changed();
+ e->set_changed();
+ if (e->when()&FL_WHEN_CHANGED) e->do_callback();
return 1;
}
@@ -301,20 +301,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);
}
@@ -358,7 +344,8 @@ int Fl_Text_Editor::kf_delete(int, Fl_Text_Editor* e) {
e->buffer()->select(e->insert_position(), e->insert_position()+1);
kill_selection(e);
e->show_insert_position();
- if (e->when()&FL_WHEN_CHANGED) e->do_callback(); else e->set_changed();
+ e->set_changed();
+ if (e->when()&FL_WHEN_CHANGED) e->do_callback();
return 1;
}
@@ -374,7 +361,8 @@ int Fl_Text_Editor::kf_copy(int, Fl_Text_Editor* e) {
int Fl_Text_Editor::kf_cut(int c, Fl_Text_Editor* e) {
kf_copy(c, e);
kill_selection(e);
- if (e->when()&FL_WHEN_CHANGED) e->do_callback(); else e->set_changed();
+ e->set_changed();
+ if (e->when()&FL_WHEN_CHANGED) e->do_callback();
return 1;
}
@@ -382,7 +370,8 @@ int Fl_Text_Editor::kf_paste(int, Fl_Text_Editor* e) {
kill_selection(e);
Fl::paste(*e, 1);
e->show_insert_position();
- if (e->when()&FL_WHEN_CHANGED) e->do_callback(); else e->set_changed();
+ e->set_changed();
+ if (e->when()&FL_WHEN_CHANGED) e->do_callback();
return 1;
}
@@ -397,7 +386,8 @@ int Fl_Text_Editor::kf_undo(int , Fl_Text_Editor* e) {
int ret = e->buffer()->undo(&crsr);
e->insert_position(crsr);
e->show_insert_position();
- if (e->when()&FL_WHEN_CHANGED) e->do_callback(); else e->set_changed();
+ e->set_changed();
+ if (e->when()&FL_WHEN_CHANGED) e->do_callback();
return ret;
}
@@ -415,8 +405,8 @@ int Fl_Text_Editor::handle_key() {
else overstrike(Fl::event_text());
}
show_insert_position();
+ set_changed();
if (when()&FL_WHEN_CHANGED) do_callback();
- else set_changed();
return 1;
}
@@ -433,8 +423,7 @@ int Fl_Text_Editor::handle_key() {
void Fl_Text_Editor::maybe_do_callback() {
// printf("Fl_Text_Editor::maybe_do_callback()\n");
// printf("changed()=%d, when()=%x\n", changed(), when());
- if (changed() || (when()&FL_WHEN_NOT_CHANGED)) {
- clear_changed(); do_callback();}
+ if (changed() || (when()&FL_WHEN_NOT_CHANGED)) do_callback();
}
int Fl_Text_Editor::handle(int event) {
@@ -444,22 +433,21 @@ int Fl_Text_Editor::handle(int event) {
dragType = -1;
Fl::paste(*this, 0);
Fl::focus(this);
- if (when()&FL_WHEN_CHANGED) do_callback(); else set_changed();
+ set_changed();
+ if (when()&FL_WHEN_CHANGED) do_callback();
return 1;
}
switch (event) {
case FL_FOCUS:
show_cursor(mCursorOn); // redraws the cursor
- if (buffer()->primary_selection()->start() !=
- buffer()->primary_selection()->end()) redraw(); // Redraw selections...
+ if (buffer()->selected()) redraw(); // Redraw selections...
Fl::focus(this);
return 1;
case FL_UNFOCUS:
show_cursor(mCursorOn); // redraws the cursor
- if (buffer()->primary_selection()->start() !=
- buffer()->primary_selection()->end()) redraw(); // Redraw selections...
+ if (buffer()->selected()) redraw(); // Redraw selections...
case FL_HIDE:
if (when() & FL_WHEN_RELEASE) maybe_do_callback();
return 1;
@@ -476,7 +464,8 @@ int Fl_Text_Editor::handle(int event) {
if (insert_mode()) insert(Fl::event_text());
else overstrike(Fl::event_text());
show_insert_position();
- if (when()&FL_WHEN_CHANGED) do_callback(); else set_changed();
+ set_changed();
+ if (when()&FL_WHEN_CHANGED) do_callback();
return 1;
case FL_ENTER:
@@ -490,5 +479,5 @@ int Fl_Text_Editor::handle(int event) {
}
//
-// End of "$Id: Fl_Text_Editor.cxx,v 1.9.2.18 2004/04/11 04:38:58 easysw Exp $".
+// End of "$Id: Fl_Text_Editor.cxx,v 1.9.2.21 2004/07/27 16:02:21 easysw Exp $".
//
diff --git a/src/Fl_Tile.cxx b/src/Fl_Tile.cxx
index 0bf4b67..863412a 100644
--- a/src/Fl_Tile.cxx
+++ b/src/Fl_Tile.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Tile.cxx,v 1.5.2.5.2.6 2004/04/11 04:38:58 easysw Exp $"
+// "$Id: Fl_Tile.cxx,v 1.5.2.5.2.7 2004/07/27 16:02:21 easysw Exp $"
//
// Tile widget for the Fast Light Tool Kit (FLTK).
//
@@ -187,6 +187,7 @@ int Fl_Tile::handle(int event) {
} else
newy = sy;
position(sx,sy,newx,newy);
+ if (event == FL_DRAG) set_changed();
do_callback();
return 1;}
@@ -196,5 +197,5 @@ int Fl_Tile::handle(int event) {
}
//
-// End of "$Id: Fl_Tile.cxx,v 1.5.2.5.2.6 2004/04/11 04:38:58 easysw Exp $".
+// End of "$Id: Fl_Tile.cxx,v 1.5.2.5.2.7 2004/07/27 16:02:21 easysw Exp $".
//
diff --git a/src/Fl_Valuator.cxx b/src/Fl_Valuator.cxx
index fb7192c..54a5797 100644
--- a/src/Fl_Valuator.cxx
+++ b/src/Fl_Valuator.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Valuator.cxx,v 1.5.2.4.2.8 2004/04/11 04:38:58 easysw Exp $"
+// "$Id: Fl_Valuator.cxx,v 1.5.2.4.2.9 2004/07/27 16:02:21 easysw Exp $"
//
// Valuator widget for the Fast Light Tool Kit (FLTK).
//
@@ -80,8 +80,8 @@ void Fl_Valuator::handle_drag(double v) {
if (v != value_) {
value_ = v;
value_damage();
+ set_changed();
if (when() & FL_WHEN_CHANGED) do_callback();
- else set_changed();
}
}
@@ -92,8 +92,9 @@ void Fl_Valuator::handle_release() {
// initial position:
clear_changed();
// now do the callback only if slider in new position or always is on:
- if (value_ != previous_value_ || when() & FL_WHEN_NOT_CHANGED)
+ if (value_ != previous_value_ || when() & FL_WHEN_NOT_CHANGED) {
do_callback();
+ }
}
}
@@ -125,5 +126,5 @@ int Fl_Valuator::format(char* buffer) {
}
//
-// End of "$Id: Fl_Valuator.cxx,v 1.5.2.4.2.8 2004/04/11 04:38:58 easysw Exp $".
+// End of "$Id: Fl_Valuator.cxx,v 1.5.2.4.2.9 2004/07/27 16:02:21 easysw Exp $".
//
diff --git a/src/Fl_Value_Input.cxx b/src/Fl_Value_Input.cxx
index 17bfc3c..8a17431 100644
--- a/src/Fl_Value_Input.cxx
+++ b/src/Fl_Value_Input.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Value_Input.cxx,v 1.6.2.5.2.9 2004/04/11 04:38:58 easysw Exp $"
+// "$Id: Fl_Value_Input.cxx,v 1.6.2.5.2.10 2004/07/27 16:02:21 easysw Exp $"
//
// Value input widget for the Fast Light Tool Kit (FLTK).
//
@@ -41,12 +41,8 @@ void Fl_Value_Input::input_cb(Fl_Widget*, void* v) {
else nv = strtol(t.input.value(), 0, 0);
if (nv != t.value() || t.when() & FL_WHEN_NOT_CHANGED) {
t.set_value(nv);
- if (t.when()) {
- t.clear_changed();
- t.do_callback();
- } else {
- t.set_changed();
- }
+ t.set_changed();
+ if (t.when()) t.do_callback();
}
}
@@ -131,5 +127,5 @@ Fl_Value_Input::Fl_Value_Input(int X, int Y, int W, int H, const char* l)
}
//
-// End of "$Id: Fl_Value_Input.cxx,v 1.6.2.5.2.9 2004/04/11 04:38:58 easysw Exp $".
+// End of "$Id: Fl_Value_Input.cxx,v 1.6.2.5.2.10 2004/07/27 16:02:21 easysw Exp $".
//
diff --git a/src/Fl_get_key_mac.cxx b/src/Fl_get_key_mac.cxx
index f92bf92..d992a25 100644
--- a/src/Fl_get_key_mac.cxx
+++ b/src/Fl_get_key_mac.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_get_key_mac.cxx,v 1.1.2.8 2004/04/11 04:38:59 easysw Exp $"
+// "$Id: Fl_get_key_mac.cxx,v 1.1.2.9 2004/06/19 01:50:31 matthiaswm Exp $"
//
// MacOS keyboard state routines for the Fast Light Tool Kit (FLTK).
//
@@ -51,7 +51,7 @@ static const struct {unsigned short vk, fltk;} vktab[] = {
{ 107, FL_Scroll_Lock }, { 53, FL_Escape }, { 0x73, FL_Home }, { 123, FL_Left },
{ 126, FL_Up }, { 124, FL_Right }, { 125, FL_Down }, { 0x74, FL_Page_Up },
{ 0x79, FL_Page_Down }, { 119, FL_End }, { 0x71, FL_Print }, { 127, FL_Insert },
- { 127, FL_Menu }, { 114, FL_Help }, { 0x47, FL_Num_Lock },
+ { 0x6e, FL_Menu }, { 114, FL_Help }, { 0x47, FL_Num_Lock },
{ 76, FL_KP_Enter }, { 67, FL_KP+'*' }, { 69, FL_KP+'+'}, { 78, FL_KP+'-' }, { 65, FL_KP+'.' }, { 75, FL_KP+'/' },
{ 82, FL_KP+'0' }, { 83, FL_KP+'1' }, { 84, FL_KP+'2' }, { 85, FL_KP+'3' },
{ 86, FL_KP+'4' }, { 87, FL_KP+'5' }, { 88, FL_KP+'6' }, { 89, FL_KP+'7' },
@@ -61,7 +61,7 @@ static const struct {unsigned short vk, fltk;} vktab[] = {
{ 0x65, FL_F+9 }, { 0x6D, FL_F+10 }, { 0x67, FL_F+11 }, { 0x6f, FL_F+12 },
{ 56, FL_Shift_L }, { 56, FL_Shift_R }, { 59, FL_Control_L }, { 59, FL_Control_R },
{ 57, FL_Caps_Lock }, { 55, FL_Meta_L }, { 55, FL_Meta_R },
- { 58, FL_Alt_L }, { 58, FL_Alt_R },
+ { 58, FL_Alt_L }, { 58, FL_Alt_R }, { 0x75, FL_Delete },
};
static int fltk2mac(int fltk) {
@@ -99,5 +99,5 @@ int Fl::get_key(int k) {
}
//
-// End of "$Id: Fl_get_key_mac.cxx,v 1.1.2.8 2004/04/11 04:38:59 easysw Exp $".
+// End of "$Id: Fl_get_key_mac.cxx,v 1.1.2.9 2004/06/19 01:50:31 matthiaswm Exp $".
//
diff --git a/src/Fl_get_system_colors.cxx b/src/Fl_get_system_colors.cxx
index 77b3e3b..bc3faff 100644
--- a/src/Fl_get_system_colors.cxx
+++ b/src/Fl_get_system_colors.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_get_system_colors.cxx,v 1.6.2.7.2.25 2004/04/11 04:38:59 easysw Exp $"
+// "$Id: Fl_get_system_colors.cxx,v 1.6.2.7.2.26 2004/05/25 21:06:19 easysw Exp $"
//
// System color support for the Fast Light Tool Kit (FLTK).
//
@@ -263,7 +263,9 @@ int Fl::reload_scheme() {
uchar r, g, b;
int nr, ng, nb;
int i;
- static uchar levels[3] = { 0xff, 0xef, 0xe8 };
+// static uchar levels[3] = { 0xff, 0xef, 0xe8 };
+ // OSX 10.3 and higher use a background with less contrast...
+ static uchar levels[3] = { 0xff, 0xf8, 0xf4 };
get_color(FL_GRAY, r, g, b);
@@ -332,5 +334,5 @@ int Fl::reload_scheme() {
//
-// End of "$Id: Fl_get_system_colors.cxx,v 1.6.2.7.2.25 2004/04/11 04:38:59 easysw Exp $".
+// End of "$Id: Fl_get_system_colors.cxx,v 1.6.2.7.2.26 2004/05/25 21:06:19 easysw Exp $".
//
diff --git a/src/Fl_mac.cxx b/src/Fl_mac.cxx
index 4a18aeb..a0b1a67 100644
--- a/src/Fl_mac.cxx
+++ b/src/Fl_mac.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_mac.cxx,v 1.1.2.54 2004/04/11 04:38:59 easysw Exp $"
+// "$Id: Fl_mac.cxx,v 1.1.2.56 2004/06/19 01:50:31 matthiaswm Exp $"
//
// MacOS specific code for the Fast Light Tool Kit (FLTK).
//
@@ -131,7 +131,7 @@ static unsigned short macKeyLookUp[128] =
FL_KP+'6', FL_KP+'7', 0, FL_KP+'8', FL_KP+'9', 0, 0, 0,
FL_F+5, FL_F+6, FL_F+7, FL_F+3, FL_F+8, FL_F+9, 0, FL_F+11,
- 0, 0, FL_Print, FL_Scroll_Lock, 0, FL_F+10, 0, FL_F+12,
+ 0, 0, FL_Print, FL_Scroll_Lock, 0, FL_F+10, FL_Menu, FL_F+12,
0, FL_Pause, FL_Help, FL_Home, FL_Page_Up, FL_Delete, FL_F+4, FL_End,
FL_F+2, FL_Page_Down, FL_F+1, FL_Left, FL_Right, FL_Down, FL_Up, 0,
@@ -936,6 +936,7 @@ static void mods_to_e_keysym( UInt32 mods )
else if ( mods & rightShiftKey ) Fl::e_keysym = FL_Shift_R;
else if ( mods & alphaLock ) Fl::e_keysym = FL_Caps_Lock;
else Fl::e_keysym = 0;
+ //printf( "to sym 0x%08x (%04x)\n", Fl::e_keysym, mods );
}
/**
@@ -960,7 +961,8 @@ static unsigned short keycode_to_sym( UInt32 keyCode, UInt32 mods, unsigned shor
/**
* handle carbon keyboard events
*/
-pascal OSStatus carbonKeyboardHandler( EventHandlerCallRef nextHandler, EventRef event, void *userData )
+pascal OSStatus carbonKeyboardHandler(
+ EventHandlerCallRef nextHandler, EventRef event, void *userData )
{
static char buffer[5];
int sendEvent = 0;
@@ -970,15 +972,35 @@ pascal OSStatus carbonKeyboardHandler( EventHandlerCallRef nextHandler, EventRef
fl_lock_function();
- GetEventParameter( event, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &mods );
+ int kind = GetEventKind(event);
+
+ // get the modifiers for any of the events
+ GetEventParameter( event, kEventParamKeyModifiers, typeUInt32,
+ NULL, sizeof(UInt32), NULL, &mods );
if ( prevMods == 0xffffffff ) prevMods = mods;
- UInt32 keyCode;
- GetEventParameter( event, kEventParamKeyCode, typeUInt32, NULL, sizeof(UInt32), NULL, &keyCode );
- unsigned char key;
- GetEventParameter( event, kEventParamKeyMacCharCodes, typeChar, NULL, sizeof(char), NULL, &key );
- unsigned short sym;
-
- switch ( GetEventKind( event ) )
+
+ // get the key code only for key events
+ UInt32 keyCode = 0;
+ unsigned char key = 0;
+ unsigned short sym = 0;
+ if (kind!=kEventRawKeyModifiersChanged) {
+ GetEventParameter( event, kEventParamKeyCode, typeUInt32,
+ NULL, sizeof(UInt32), NULL, &keyCode );
+ GetEventParameter( event, kEventParamKeyMacCharCodes, typeChar,
+ NULL, sizeof(char), NULL, &key );
+ }
+ /* output a human readbale event identifier for debugging
+ const char *ev = "";
+ switch (kind) {
+ case kEventRawKeyDown: ev = "kEventRawKeyDown"; break;
+ case kEventRawKeyRepeat: ev = "kEventRawKeyRepeat"; break;
+ case kEventRawKeyUp: ev = "kEventRawKeyUp"; break;
+ case kEventRawKeyModifiersChanged: ev = "kEventRawKeyModifiersChanged"; break;
+ default: ev = "unknown";
+ }
+ printf("%08x %08x %08x '%c' %s \n", mods, keyCode, key, key, ev);
+ */
+ switch (kind)
{
case kEventRawKeyDown:
case kEventRawKeyRepeat:
@@ -986,18 +1008,24 @@ pascal OSStatus carbonKeyboardHandler( EventHandlerCallRef nextHandler, EventRef
// fall through
case kEventRawKeyUp:
if ( !sendEvent ) sendEvent = FL_KEYUP;
- // if the user pressed alt/option, event_key should have the keycap, but event_text should generate the international symbol
+ // if the user pressed alt/option, event_key should have the keycap,
+ // but event_text should generate the international symbol
if ( isalpha(key) )
sym = tolower(key);
else if ( Fl::e_state&FL_CTRL && key<32 )
sym = key+96;
- else if ( Fl::e_state&FL_ALT )
- sym = keycode_to_sym( keyCode & 0x7f, 0, macKeyLookUp[ keyCode & 0x7f ] ); // find the keycap of this key
+ else if ( Fl::e_state&FL_ALT ) // find the keycap of this key
+ sym = keycode_to_sym( keyCode & 0x7f, 0, macKeyLookUp[ keyCode & 0x7f ] );
else
sym = macKeyLookUp[ keyCode & 0x7f ];
Fl::e_keysym = sym;
if ( keyCode==0x4c ) key=0x0d;
- if ( ( (sym>=FL_KP) && (sym<=FL_KP_Last) ) || ((sym&0xff00)==0) || (sym==FL_Tab) || (sym==FL_Enter) ) {
+ // Matt: the Mac has no concept of a NumLock key, or at least not visible
+ // Matt: to Carbon. The kEventKeyModifierNumLockMask is only set when
+ // Matt: a numeric keypad key is pressed and does not correspond with
+ // Matt: the NumLock light in PowerBook keyboards.
+ if ( (sym >= FL_KP && sym <= FL_KP_Last) || !(sym & 0xff00) ||
+ sym == FL_Tab || sym == FL_Enter) {
buffer[0] = key;
Fl::e_length = 1;
} else {
@@ -1023,13 +1051,14 @@ pascal OSStatus carbonKeyboardHandler( EventHandlerCallRef nextHandler, EventRef
}
while (window->parent()) window = window->window();
if (sendEvent && Fl::handle(sendEvent,window)) {
- fl_unlock_function();
-
+ fl_unlock_function();
return noErr; // return noErr if FLTK handled the event
} else {
fl_unlock_function();
-
- return CallNextEventHandler( nextHandler, event );;
+ //return CallNextEventHandler( nextHandler, event );;
+ // Matt: I had better results (no duplicate events) always returning
+ // Matt: 'noErr'. System keyboard events still seem to work just fine.
+ return noErr;
}
}
@@ -1320,33 +1349,6 @@ static int FSSpec2UnixPath( FSSpec *fs, char *dst )
FSpMakeFSRef( fs, &fsRef );
FSRefMakePath( &fsRef, (UInt8*)dst, 1024 );
return strlen(dst);
-/* keep the code below. The above function is only implemented in OS X, so we might need the other code for OS 9 and friends
- short offset = 0;
- if ( fs->parID != fsRtParID )
- {
- FSSpec parent;
- OSErr ret = FSMakeFSSpec( fs->vRefNum, fs->parID, 0, &parent );
- if ( ret != noErr ) return 0;
- offset = FSSpec2UnixPath( &parent, dst );
- }
-
- if ( fs->parID == fsRtParID && fs->vRefNum == -100 ) //+ bad hack: we assume that volume -100 is mounted as root
- {
- memcpy( dst, "/", 2 );
- return 1; // don't add anything to the filename - we are fine already
- }
-
- short len = fs->name[0];
- if ( fs->parID == fsRtParID ) { // assume tat all other volumes are in this directory (international name WILL vary!)
- memcpy( dst, "/Volumes", 8 );
- offset = 8;
- }
-
- if ( offset!=1 ) dst[ offset++ ] = '/'; // avoid double '/'
- memcpy( dst+offset, fs->name+1, len );
- dst[ len+offset ] = 0;
- return len+offset;
-*/
}
Fl_Window *fl_dnd_target_window = 0;
@@ -1920,6 +1922,6 @@ void Fl::paste(Fl_Widget &receiver, int clipboard) {
//
-// End of "$Id: Fl_mac.cxx,v 1.1.2.54 2004/04/11 04:38:59 easysw Exp $".
+// End of "$Id: Fl_mac.cxx,v 1.1.2.56 2004/06/19 01:50:31 matthiaswm Exp $".
//
diff --git a/src/Fl_win32.cxx b/src/Fl_win32.cxx
index ecd4651..d054276 100644
--- a/src/Fl_win32.cxx
+++ b/src/Fl_win32.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_win32.cxx,v 1.33.2.37.2.48 2004/04/11 04:38:59 easysw Exp $"
+// "$Id: Fl_win32.cxx,v 1.33.2.37.2.49 2004/06/01 01:08:50 easysw Exp $"
//
// WIN32-specific code for the Fast Light Tool Kit (FLTK).
//
@@ -726,7 +726,8 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPar
if (uMsg == WM_CHAR || uMsg == WM_SYSCHAR) {
buffer[0] = char(wParam);
Fl::e_length = 1;
- } else if (Fl::e_keysym >= FL_KP && Fl::e_keysym <= FL_KP_Last) {
+ } else if (Fl::e_keysym >= FL_KP && Fl::e_keysym <= FL_KP_Last &&
+ (state & FL_NUM_LOCK)) {
buffer[0] = Fl::e_keysym-FL_KP;
Fl::e_length = 1;
} else {
@@ -1195,5 +1196,5 @@ void Fl_Window::make_current() {
}
//
-// End of "$Id: Fl_win32.cxx,v 1.33.2.37.2.48 2004/04/11 04:38:59 easysw Exp $".
+// End of "$Id: Fl_win32.cxx,v 1.33.2.37.2.49 2004/06/01 01:08:50 easysw Exp $".
//
diff --git a/src/Fl_x.cxx b/src/Fl_x.cxx
index c028d43..60567aa 100644
--- a/src/Fl_x.cxx
+++ b/src/Fl_x.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_x.cxx,v 1.24.2.24.2.33 2004/04/11 04:38:59 easysw Exp $"
+// "$Id: Fl_x.cxx,v 1.24.2.24.2.37 2004/06/01 01:08:50 easysw Exp $"
//
// X specific code for the Fast Light Tool Kit (FLTK).
//
@@ -764,7 +764,7 @@ int fl_handle(const XEvent& thisevent)
Fl::e_length = len;
} else {
// Stupid X sends fake key-up events when a repeating key is held
- // down, probably due to some back compatability problem. Fortunatley
+ // down, probably due to some back compatability problem. Fortunately
// we can detect this because the repeating KeyPress event is in
// the queue, get it and execute it instead:
XEvent temp;
@@ -800,18 +800,17 @@ int fl_handle(const XEvent& thisevent)
// not produced on Windoze and thus case statements tend not to check
// for them. There are 15 of these in the range 0xff91 ... 0xff9f
if (keysym >= 0xff91 && keysym <= 0xff9f) {
- // Try to make them turn into FL_KP+'c' so that NumLock is
- // irrelevant, by looking at the shifted code. This matches the
- // behavior of the translator in Fl_win32.cxx, and IMHO is the
- // user-friendly result:
+ // Map keypad keysym to character or keysym depending on
+ // numlock state...
unsigned long keysym1 = XKeycodeToKeysym(fl_display, keycode, 1);
- if (keysym1 <= 0x7f || keysym1 > 0xff9f && keysym1 <= FL_KP_Last) {
+ if ((xevent.xkey.state & Mod2Mask) &&
+ (keysym1 <= 0x7f || (keysym1 > 0xff9f && keysym1 <= FL_KP_Last))) {
+ // Store ASCII numeric keypad value...
keysym = keysym1 | FL_KP;
buffer[0] = char(keysym1) & 0x7F;
len = 1;
} else {
- // If that failed to work, just translate them to the matching
- // normal function keys:
+ // Map keypad to special key...
static const unsigned short table[15] = {
FL_F+1, FL_F+2, FL_F+3, FL_F+4,
FL_Home, FL_Left, FL_Up, FL_Right,
@@ -921,6 +920,7 @@ int fl_handle(const XEvent& thisevent)
////////////////////////////////////////////////////////////////
void Fl_Window::resize(int X,int Y,int W,int H) {
+ int is_a_move = (X != x() || Y != y());
int is_a_resize = (W != w() || H != h());
int resize_from_program = (this != resize_bug_fix);
if (!resize_from_program) resize_bug_fix = 0;
@@ -932,10 +932,19 @@ void Fl_Window::resize(int X,int Y,int W,int H) {
} else {
x(X); y(Y);
}
+
+ if (resize_from_program && is_a_resize && !resizable()) {
+ size_range(w(), h(), w(), h());
+ }
+
if (resize_from_program && shown()) {
if (is_a_resize) {
if (!resizable()) size_range(w(),h(),w(),h());
- XMoveResizeWindow(fl_display, i->xid, X, Y, W>0 ? W : 1, H>0 ? H : 1);
+ if (is_a_move) {
+ XMoveResizeWindow(fl_display, i->xid, X, Y, W>0 ? W : 1, H>0 ? H : 1);
+ } else {
+ XResizeWindow(fl_display, i->xid, W>0 ? W : 1, H>0 ? H : 1);
+ }
} else
XMoveWindow(fl_display, i->xid, X, Y);
}
@@ -1270,5 +1279,5 @@ void Fl_Window::make_current() {
#endif
//
-// End of "$Id: Fl_x.cxx,v 1.24.2.24.2.33 2004/04/11 04:38:59 easysw Exp $".
+// End of "$Id: Fl_x.cxx,v 1.24.2.24.2.37 2004/06/01 01:08:50 easysw Exp $".
//
diff --git a/src/Makefile b/src/Makefile
index b24d28f..afb0370 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -1,5 +1,5 @@
#
-# "$Id: Makefile,v 1.18.2.14.2.56 2004/04/11 04:38:59 easysw Exp $"
+# "$Id: Makefile,v 1.18.2.14.2.57 2004/07/23 19:26:26 easysw Exp $"
#
# Library makefile for the Fast Light Tool Kit (FLTK).
#
@@ -195,20 +195,20 @@ all: $(LIBNAME) $(DSONAME) \
$(LIBNAME): $(OBJECTS)
echo $(LIBCOMMAND) $@ ...
- -$(RM) $@
+ $(RM) $@
$(LIBCOMMAND) $@ $(OBJECTS)
$(RANLIB) $@
libfltk.so.1.1: $(OBJECTS)
echo $(DSOCOMMAND) $@ ...
$(DSOCOMMAND) $@ $(OBJECTS)
- -$(RM) libfltk.so
+ $(RM) libfltk.so
$(LN) libfltk.so.1.1 libfltk.so
libfltk.sl.1.1: $(OBJECTS)
echo $(DSOCOMMAND) $@ ...
$(DSOCOMMAND) $@ $(OBJECTS)
- -$(RM) libfltk.sl
+ $(RM) libfltk.sl
$(LN) libfltk.sl.1.1 libfltk.sl
libfltk.1.1.dylib: $(OBJECTS)
@@ -218,33 +218,33 @@ libfltk.1.1.dylib: $(OBJECTS)
-current_version 1.1.4 \
-compatibility_version 1.1.0 \
$(OBJECTS) $(LDLIBS)
- -$(RM) libfltk.dylib
+ $(RM) libfltk.dylib
$(LN) libfltk.1.1.dylib libfltk.dylib
libfltk_s.a: $(OBJECTS)
echo $(DSOCOMMAND) libfltk_s.o ...
$(DSOCOMMAND) libfltk_s.o $(OBJECTS) $(IMAGELIBS)
echo $(LIBCOMMAND) libfltk_s.a libfltk_s.o
- -$(RM) $@
+ $(RM) $@
$(LIBCOMMAND) libfltk_s.a libfltk_s.o
$(CHMOD) +x libfltk_s.a
$(FLLIBNAME): $(FLOBJECTS)
echo $(LIBCOMMAND) $@ ...
- -$(RM) $@
+ $(RM) $@
$(LIBCOMMAND) $@ $(FLOBJECTS)
$(RANLIB) $@
libfltk_forms.so.1.1: $(FLOBJECTS) libfltk.so.1.1
echo $(DSOCOMMAND) $@ ...
$(DSOCOMMAND) $@ $(FLOBJECTS) -L. -lfltk
- -$(RM) libfltk_forms.so
+ $(RM) libfltk_forms.so
$(LN) libfltk_forms.so.1.1 libfltk_forms.so
libfltk_forms.sl.1.1: $(FLOBJECTS) libfltk.sl.1.1
echo $(DSOCOMMAND) $@ ...
$(DSOCOMMAND) $@ $(FLOBJECTS) -L. -lfltk
- -$(RM) libfltk_forms.sl
+ $(RM) libfltk_forms.sl
$(LN) libfltk_forms.sl.1.1 libfltk_forms.sl
libfltk_forms.1.1.dylib: $(FLOBJECTS) libfltk.1.1.dylib
@@ -254,33 +254,33 @@ libfltk_forms.1.1.dylib: $(FLOBJECTS) libfltk.1.1.dylib
-current_version 1.1.4 \
-compatibility_version 1.1.0 \
$(FLOBJECTS) $(LDLIBS) -L. -lfltk
- -$(RM) libfltk_forms.dylib
+ $(RM) libfltk_forms.dylib
$(LN) libfltk_forms.1.1.dylib libfltk_forms.dylib
libfltk_forms_s.a: $(FLOBJECTS)
echo $(DSOCOMMAND) libfltk_forms_s.o ...
$(DSOCOMMAND) libfltk_forms_s.o $(FLOBJECTS)
echo $(LIBCOMMAND) libfltk_forms_s.a libfltk_forms_s.o
- -$(RM) $@
+ $(RM) $@
$(LIBCOMMAND) libfltk_forms_s.a libfltk_forms_s.o
$(CHMOD) +x libfltk_forms_s.a
$(GLLIBNAME): $(GLOBJECTS)
echo $(LIBCOMMAND) $@ ...
- -$(RM) $@
+ $(RM) $@
$(LIBCOMMAND) $@ $(GLOBJECTS)
$(RANLIB) $@
libfltk_gl.so.1.1: $(GLOBJECTS) libfltk.so.1.1
echo $(DSOCOMMAND) $@ ...
$(DSOCOMMAND) $@ $(GLOBJECTS) -L. -lfltk
- -$(RM) libfltk_gl.so
+ $(RM) libfltk_gl.so
$(LN) libfltk_gl.so.1.1 libfltk_gl.so
libfltk_gl.sl.1.1: $(GLOBJECTS) libfltk.sl.1.1
echo $(DSOCOMMAND) $@ ...
$(DSOCOMMAND) $@ $(GLOBJECTS) -L. -lfltk
- -$(RM) libfltk_gl.sl
+ $(RM) libfltk_gl.sl
$(LN) libfltk_gl.sl.1.1 libfltk_gl.sl
libfltk_gl.1.1.dylib: $(GLOBJECTS) libfltk.1.1.dylib
@@ -290,33 +290,33 @@ libfltk_gl.1.1.dylib: $(GLOBJECTS) libfltk.1.1.dylib
-current_version 1.1.4 \
-compatibility_version 1.1.0 \
$(GLOBJECTS) $(GLDLIBS) -L. -lfltk
- -$(RM) libfltk_gl.dylib
+ $(RM) libfltk_gl.dylib
$(LN) libfltk_gl.1.1.dylib libfltk_gl.dylib
libfltk_gl_s.a: $(GLOBJECTS)
echo $(DSOCOMMAND) libfltk_gl_s.o ...
$(DSOCOMMAND) libfltk_gl_s.o $(GLOBJECTS)
echo $(LIBCOMMAND) libfltk_gl_s.a libfltk_gl_s.o
- -$(RM) $@
+ $(RM) $@
$(LIBCOMMAND) libfltk_gl_s.a libfltk_gl_s.o
$(CHMOD) +x libfltk_gl_s.a
$(IMGLIBNAME): $(IMGOBJECTS)
echo $(LIBCOMMAND) $@ ...
- -$(RM) $@
+ $(RM) $@
$(LIBCOMMAND) $@ $(IMGOBJECTS)
$(RANLIB) $@
libfltk_images.so.1.1: $(IMGOBJECTS) libfltk.so.1.1
echo $(DSOCOMMAND) $@ ...
$(DSOCOMMAND) $@ $(IMGOBJECTS) $(IMAGELIBS) -L. -lfltk
- -$(RM) libfltk_images.so
+ $(RM) libfltk_images.so
$(LN) libfltk_images.so.1.1 libfltk_images.so
libfltk_images.sl.1.1: $(IMGOBJECTS) libfltk.sl.1.1
echo $(DSOCOMMAND) $@ ...
$(DSOCOMMAND) $@ $(IMGOBJECTS) $(IMAGELIBS) -L. -lfltk
- -$(RM) libfltk_images.sl
+ $(RM) libfltk_images.sl
$(LN) libfltk_images.sl.1.1 libfltk_images.sl
libfltk_images.1.1.dylib: $(IMGOBJECTS) libfltk.1.1.dylib
@@ -326,14 +326,14 @@ libfltk_images.1.1.dylib: $(IMGOBJECTS) libfltk.1.1.dylib
-current_version 1.1.4 \
-compatibility_version 1.1.0 \
$(IMGOBJECTS) $(LDLIBS) $(IMAGELIBS) -L. -lfltk
- -$(RM) libfltk_images.dylib
+ $(RM) libfltk_images.dylib
$(LN) libfltk_images.1.1.dylib libfltk_images.dylib
libfltk_images_s.a: $(IMGOBJECTS)
echo $(DSOCOMMAND) libfltk_images_s.o ...
$(DSOCOMMAND) libfltk_images_s.o $(IMGOBJECTS)
echo $(LIBCOMMAND) libfltk_images_s.a libfltk_images_s.o
- -$(RM) $@
+ $(RM) $@
$(LIBCOMMAND) libfltk_images_s.a libfltk_images_s.o
$(CHMOD) +x libfltk_images_s.a
@@ -583,5 +583,5 @@ uninstall:
#
-# End of "$Id: Makefile,v 1.18.2.14.2.56 2004/04/11 04:38:59 easysw Exp $".
+# End of "$Id: Makefile,v 1.18.2.14.2.57 2004/07/23 19:26:26 easysw Exp $".
#
diff --git a/src/fl_file_dir.cxx b/src/fl_file_dir.cxx
index 89f436f..d0142e8 100644
--- a/src/fl_file_dir.cxx
+++ b/src/fl_file_dir.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: fl_file_dir.cxx,v 1.1.2.15 2004/04/11 04:39:00 easysw Exp $"
+// "$Id: fl_file_dir.cxx,v 1.1.2.16 2004/07/23 21:12:24 easysw Exp $"
//
// File chooser widget for the Fast Light Tool Kit (FLTK).
//
@@ -114,16 +114,16 @@ fl_dir_chooser(const char *message, // I - Message for titlebar
{
static char retname[1024]; // Returned directory name
- if (!fname || !*fname) fname = ".";
-
if (!fc) {
+ if (!fname || !*fname) fname = ".";
+
fc = new Fl_File_Chooser(fname, "*", Fl_File_Chooser::CREATE |
Fl_File_Chooser::DIRECTORY, message);
fc->callback(callback, 0);
} else {
fc->type(Fl_File_Chooser::CREATE | Fl_File_Chooser::DIRECTORY);
fc->filter("*");
- fc->value(fname);
+ if (fname && *fname) fc->value(fname);
fc->label(message);
}
@@ -142,5 +142,5 @@ fl_dir_chooser(const char *message, // I - Message for titlebar
//
-// End of "$Id: fl_file_dir.cxx,v 1.1.2.15 2004/04/11 04:39:00 easysw Exp $".
+// End of "$Id: fl_file_dir.cxx,v 1.1.2.16 2004/07/23 21:12:24 easysw Exp $".
//
diff --git a/src/fl_read_image.cxx b/src/fl_read_image.cxx
index 493f87c..c6c382d 100644
--- a/src/fl_read_image.cxx
+++ b/src/fl_read_image.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: fl_read_image.cxx,v 1.1.2.3 2004/04/11 04:39:00 easysw Exp $"
+// "$Id: fl_read_image.cxx,v 1.1.2.5 2004/04/25 01:22:56 easysw Exp $"
//
// X11 image reading routines for the Fast Light Tool Kit (FLTK).
//
@@ -41,6 +41,10 @@
# include <X11/extensions/readdisplay.h>
# endif // __sgi
+// Defined in fl_color.cxx
+extern uchar fl_redmask, fl_greenmask, fl_bluemask;
+extern int fl_redshift, fl_greenshift, fl_blueshift, fl_extrashift;
+
//
// 'fl_read_image()' - Read an image from the current window.
//
@@ -117,8 +121,16 @@ fl_read_image(uchar *p, // I - Pixel buffer or NULL to allocate
// Initialize the default colors/alpha in the whole image...
memset(p, alpha, w * h * d);
+ // Check that we have valid mask/shift values...
+ if (!image->red_mask && image->bits_per_pixel > 12) {
+ // Greater than 12 bits must be TrueColor...
+ image->red_mask = fl_redmask << fl_redshift;
+ image->green_mask = fl_greenmask << fl_greenshift;
+ image->blue_mask = fl_bluemask << fl_blueshift;
+ }
+
// Check if we have colormap image...
- if (image->red_mask == 0) {
+ if (!image->red_mask) {
// Get the colormap entries for this window...
maxindex = fl_visual->visual->map_entries;
@@ -393,5 +405,5 @@ fl_read_image(uchar *p, // I - Pixel buffer or NULL to allocate
#endif
//
-// End of "$Id: fl_read_image.cxx,v 1.1.2.3 2004/04/11 04:39:00 easysw Exp $".
+// End of "$Id: fl_read_image.cxx,v 1.1.2.5 2004/04/25 01:22:56 easysw Exp $".
//
diff --git a/src/fl_symbols.cxx b/src/fl_symbols.cxx
index 1c1456a..b35fc32 100644
--- a/src/fl_symbols.cxx
+++ b/src/fl_symbols.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: fl_symbols.cxx,v 1.8.2.3.2.8 2004/04/11 04:39:00 easysw Exp $"
+// "$Id: fl_symbols.cxx,v 1.8.2.3.2.10 2004/07/04 23:21:52 easysw Exp $"
//
// Symbol drawing code for the Fast Light Tool Kit (FLTK).
//
@@ -151,6 +151,8 @@ int fl_draw_symbol(const char *label,int x,int y,int w,int h,Fl_Color col) {
#define BP fl_begin_polygon()
#define EP fl_end_polygon()
+#define BCP fl_begin_complex_polygon()
+#define ECP fl_end_complex_polygon()
#define BL fl_begin_line()
#define EL fl_end_line()
#define BC fl_begin_loop()
@@ -171,6 +173,51 @@ static void rectangle(double x,double y,double x2,double y2,Fl_Color col) {
/* The drawing routines */
+static void draw_fltk(Fl_Color col)
+{
+ fl_color(col);
+ // F fill
+ BCP; vv(-2.0, -0.5); vv(-1.0, -0.5); vv(-1.0, -0.3); vv(-1.8, -0.3);
+ vv(-1.8, -0.1); vv(-1.2, -0.1); vv(-1.2, 0.1); vv(-1.8, 0.1);
+ vv(-1.8, 0.5); vv(-2.0, 0.5); ECP;
+ // L fill
+ BCP; vv(-1.0, -0.5); vv(-0.8, -0.5); vv(-0.8, 0.3); vv(0.0, 0.3);
+ vv(0.0, 0.5); vv(-1.0, 0.5); ECP;
+ // T outline
+ BCP; vv(-0.1, -0.5); vv(1.1, -0.5); vv(1.1, -0.3); vv(0.6, -0.3);
+ vv(0.6, 0.5); vv(0.4, 0.5); vv(0.4, -0.3); vv(-0.1, -0.3); ECP;
+ // K outline
+ BCP; vv(1.1, -0.5); vv(1.3, -0.5); vv(1.3, -0.15); vv(1.70, -0.5);
+ vv(2.0, -0.5); vv(1.43, 0.0); vv(2.0, 0.5); vv(1.70, 0.5);
+ vv(1.3, 0.15); vv(1.3, 0.5); vv(1.1, 0.5); ECP;
+ set_outline_color(col);
+ // F outline
+ BC; vv(-2.0, -0.5); vv(-1.0, -0.5); vv(-1.0, -0.3); vv(-1.8, -0.3);
+ vv(-1.8, -0.1); vv(-1.2, -0.1); vv(-1.2, 0.1); vv(-1.8, 0.1);
+ vv(-1.8, 0.5); vv(-2.0, 0.5); EC;
+ // L outline
+ BC; vv(-1.0, -0.5); vv(-0.8, -0.5); vv(-0.8, 0.3); vv(0.0, 0.3);
+ vv(0.0, 0.5); vv(-1.0, 0.5); EC;
+ // T outline
+ BC; vv(-0.1, -0.5); vv(1.1, -0.5); vv(1.1, -0.3); vv(0.6, -0.3);
+ vv(0.6, 0.5); vv(0.4, 0.5); vv(0.4, -0.3); vv(-0.1, -0.3); EC;
+ // K outline
+ BC; vv(1.1, -0.5); vv(1.3, -0.5); vv(1.3, -0.15); vv(1.70, -0.5);
+ vv(2.0, -0.5); vv(1.43, 0.0); vv(2.0, 0.5); vv(1.70, 0.5);
+ vv(1.3, 0.15); vv(1.3, 0.5); vv(1.1, 0.5); EC;
+}
+
+static void draw_search(Fl_Color col)
+{
+ fl_color(col);
+ BP; vv(.4, .13); vv(1.0, .73); vv(.73, 1.0); vv(.13, .4); EP;
+ set_outline_color(col);
+ fl_line_style(FL_SOLID, 3, 0);
+ BC; fl_circle(-.2, -.2, .8); EC;
+ fl_line_style(FL_SOLID, 1, 0);
+ BC; vv(.4, .13); vv(1.0, .73); vv(.73, 1.0); vv(.13, .4); EC;
+}
+
static void draw_arrow1(Fl_Color col)
{
fl_color(col);
@@ -358,8 +405,10 @@ static void fl_init_symbols(void) {
fl_add_symbol("UpArrow", draw_uparrow, 1);
fl_add_symbol("DnArrow", draw_downarrow, 1);
fl_add_symbol("||", draw_doublebar, 1);
+ fl_add_symbol("search", draw_search, 1);
+ fl_add_symbol("FLTK", draw_fltk, 1);
}
//
-// End of "$Id: fl_symbols.cxx,v 1.8.2.3.2.8 2004/04/11 04:39:00 easysw Exp $".
+// End of "$Id: fl_symbols.cxx,v 1.8.2.3.2.10 2004/07/04 23:21:52 easysw Exp $".
//
diff --git a/src/forms_timer.cxx b/src/forms_timer.cxx
index 1d41301..eb08cb6 100644
--- a/src/forms_timer.cxx
+++ b/src/forms_timer.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: forms_timer.cxx,v 1.4.2.3.2.6 2004/04/11 04:39:00 easysw Exp $"
+// "$Id: forms_timer.cxx,v 1.4.2.3.2.7 2004/07/27 16:02:21 easysw Exp $"
//
// Forms timer object for the Fast Light Tool Kit (FLTK).
//
@@ -111,6 +111,7 @@ void Fl_Timer::step() {
redraw();
Fl::add_timeout(FL_TIMER_BLINKRATE, stepcb, this);
}
+ set_changed();
do_callback();
} else {
if (type() == FL_VALUE_TIMER) redraw();
@@ -162,5 +163,5 @@ void Fl_Timer::suspended(char d) {
}
//
-// End of "$Id: forms_timer.cxx,v 1.4.2.3.2.6 2004/04/11 04:39:00 easysw Exp $".
+// End of "$Id: forms_timer.cxx,v 1.4.2.3.2.7 2004/07/27 16:02:21 easysw Exp $".
//
diff --git a/src/gl_draw.cxx b/src/gl_draw.cxx
index 50599dc..6bbdb5a 100644
--- a/src/gl_draw.cxx
+++ b/src/gl_draw.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: gl_draw.cxx,v 1.7.2.5.2.12 2004/04/11 04:39:00 easysw Exp $"
+// "$Id: gl_draw.cxx,v 1.7.2.5.2.13 2004/05/15 22:58:19 easysw Exp $"
//
// OpenGL drawing support routines for the Fast Light Tool Kit (FLTK).
//
@@ -74,6 +74,47 @@ void gl_font(int fontid, int size) {
glListBase(fl_fontsize->listbase);
}
+
+void gl_remove_displaylist_fonts()
+{
+# if HAVE_GL
+
+ // clear variables used mostly in fl_font
+ fl_font_ = 0;
+ fl_size_ = 0;
+
+ for (int j = 0 ; j < FL_FREE_FONT ; ++j)
+ {
+ Fl_FontSize* past = 0;
+ Fl_Fontdesc* s = fl_fonts + j ;
+ Fl_FontSize* f = s->first;
+ while (f != 0) {
+ if(f->listbase) {
+ if(f == s->first) {
+ s->first = f->next;
+ }
+ else {
+ past->next = f->next;
+ }
+
+ // It would be nice if this next line was in a descturctor somewhere
+ glDeleteLists(f->listbase, 256);
+
+ Fl_FontSize* tmp = f;
+ f = f->next;
+ delete tmp;
+ }
+ else {
+ past = f;
+ f = f->next;
+ }
+ }
+ }
+
+#endif
+}
+
+
void gl_draw(const char* str, int n) {
glCallLists(n, GL_UNSIGNED_BYTE, str);
}
@@ -166,5 +207,5 @@ void gl_draw_image(const uchar* b, int x, int y, int w, int h, int d, int ld) {
#endif
//
-// End of "$Id: gl_draw.cxx,v 1.7.2.5.2.12 2004/04/11 04:39:00 easysw Exp $".
+// End of "$Id: gl_draw.cxx,v 1.7.2.5.2.13 2004/05/15 22:58:19 easysw Exp $".
//