mirror of https://github.com/fltk/fltk
Fixed up the colors the browser draws when it is deactivated, it does not
change the background color, this fixes Jeff Meininger's demo. Fl_Input allows ^I, ^J, ^L, and ^M to be typed as control characters and inserted. If you type ^H or ^? they act like backspace and delete. Clicking on an input field no longer selects the whole thing, it inserts the cursor. My tests of Win32 to see what they did were wrong, this is a better simulation and more user friendly, too. Fixed divide-by-zer in the slider code? Better osf code for filename_list from Alexander Mai git-svn-id: file:///fltk/svn/fltk/branches/branch-1.0@1042 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
22418bb1e9
commit
ca15addad2
|
@ -1,5 +1,5 @@
|
|||
//
|
||||
// "$Id: Fl_Browser.cxx,v 1.9.2.8 2000/01/11 16:03:55 mike Exp $"
|
||||
// "$Id: Fl_Browser.cxx,v 1.9.2.9 2000/03/17 09:38:17 bill Exp $"
|
||||
//
|
||||
// Browser widget for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
|
@ -369,9 +369,9 @@ void Fl_Browser::item_draw(void* v, int x, int y, int w, int h) const {
|
|||
}
|
||||
BREAK:
|
||||
fl_font(font, size);
|
||||
if (!active_r()) lcol = inactive(lcol);
|
||||
if (((FL_BLINE*)v)->flags & SELECTED)
|
||||
lcol = contrast(lcol, selection_color());
|
||||
if (!active_r()) lcol = inactive(lcol);
|
||||
fl_color(lcol);
|
||||
fl_draw(str, x+3, y, w1-6, h, e ? Fl_Align(align|FL_ALIGN_CLIP) : align);
|
||||
if (!e) break; // no more fields...
|
||||
|
@ -493,5 +493,5 @@ int Fl_Browser::value() const {
|
|||
}
|
||||
|
||||
//
|
||||
// End of "$Id: Fl_Browser.cxx,v 1.9.2.8 2000/01/11 16:03:55 mike Exp $".
|
||||
// End of "$Id: Fl_Browser.cxx,v 1.9.2.9 2000/03/17 09:38:17 bill Exp $".
|
||||
//
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
//
|
||||
// "$Id: Fl_Browser_.cxx,v 1.10.2.9 2000/03/15 19:14:57 mike Exp $"
|
||||
// "$Id: Fl_Browser_.cxx,v 1.10.2.10 2000/03/17 09:38:18 bill Exp $"
|
||||
//
|
||||
// Base Browser widget class for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
|
@ -311,15 +311,14 @@ J1:
|
|||
fl_color(active_r() ? selection_color() : inactive(selection_color()));
|
||||
fl_rectf(X, yy+Y, W, hh);
|
||||
} else if (!(damage()&FL_DAMAGE_ALL)) {
|
||||
fl_color(active_r() ? color() : inactive(color()));
|
||||
fl_color(color());
|
||||
fl_rectf(X, yy+Y, W, hh);
|
||||
}
|
||||
if (type() == FL_MULTI_BROWSER && l == selection_) {
|
||||
item_draw(l, X-hposition_, yy+Y, W+hposition_, hh);
|
||||
if (l == selection_) {
|
||||
fl_color(active_r() ? textcolor() : inactive(textcolor()));
|
||||
fl_rect(X+1, yy+Y, W-2, hh);
|
||||
}
|
||||
item_draw(l, X-hposition_, yy+Y, W+hposition_, hh);
|
||||
if (l == selection_) fl_rect(X, yy+Y, W, hh);
|
||||
int w = item_width(l);
|
||||
if (w > max_width) {max_width = w; max_width_item = l;}
|
||||
}
|
||||
|
@ -327,7 +326,7 @@ J1:
|
|||
}
|
||||
// erase the area below last line:
|
||||
if (!(damage()&FL_DAMAGE_ALL) && yy < H) {
|
||||
fl_color(active_r() ? color() : inactive(color()));
|
||||
fl_color(color());
|
||||
fl_rectf(X, yy+Y, W, H-yy);
|
||||
}
|
||||
fl_pop_clip();
|
||||
|
@ -701,5 +700,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.9 2000/03/15 19:14:57 mike Exp $".
|
||||
// End of "$Id: Fl_Browser_.cxx,v 1.10.2.10 2000/03/17 09:38:18 bill Exp $".
|
||||
//
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
//
|
||||
// "$Id: Fl_Input.cxx,v 1.10.2.7 2000/02/22 00:56:53 bill Exp $"
|
||||
// "$Id: Fl_Input.cxx,v 1.10.2.8 2000/03/17 09:38:19 bill Exp $"
|
||||
//
|
||||
// Input widget for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
|
@ -100,9 +100,7 @@ int Fl_Input::handle_key() {
|
|||
case FL_End:
|
||||
ascii = ctrl('E'); break;
|
||||
case FL_BackSpace:
|
||||
if (mark() != position()) cut();
|
||||
else cut(-1);
|
||||
return 1;
|
||||
ascii = ctrl('H'); break;
|
||||
case FL_Enter:
|
||||
case FL_KP_Enter:
|
||||
if (when() & FL_WHEN_ENTER_KEY) {
|
||||
|
@ -135,6 +133,7 @@ int Fl_Input::handle_key() {
|
|||
case ctrl('C'): // copy
|
||||
return copy();
|
||||
case ctrl('D'):
|
||||
case ctrl('?'):
|
||||
if (mark() != position()) return cut();
|
||||
else return cut(1);
|
||||
case ctrl('E'):
|
||||
|
@ -145,6 +144,10 @@ int Fl_Input::handle_key() {
|
|||
return shift_position(i) + NORMAL_INPUT_MOVE;
|
||||
case ctrl('F'):
|
||||
return shift_position(position()+1) + NORMAL_INPUT_MOVE;
|
||||
case ctrl('H'):
|
||||
if (mark() != position()) cut();
|
||||
else cut(-1);
|
||||
return 1;
|
||||
case ctrl('K'):
|
||||
if (position()>=size()) return 0;
|
||||
if (type() == FL_MULTILINE_INPUT) {
|
||||
|
@ -181,6 +184,13 @@ int Fl_Input::handle_key() {
|
|||
case ctrl('Z'):
|
||||
case ctrl('_'):
|
||||
return undo();
|
||||
case ctrl('I'):
|
||||
case ctrl('J'):
|
||||
case ctrl('L'):
|
||||
case ctrl('M'):
|
||||
// insert a few selected control characters literally:
|
||||
if (type() != FL_FLOAT_INPUT || type() != FL_INT_INPUT)
|
||||
return replace(position(), mark(), &ascii, 1);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -222,11 +232,13 @@ int Fl_Input::handle(int event) {
|
|||
if (Fl::focus() != this) {
|
||||
Fl::focus(this);
|
||||
handle(FL_FOCUS);
|
||||
// Windoze-style: select everything on first click:
|
||||
#if 0 // Misguided attempt to simulate Windoze select-all-on-first-click
|
||||
// that it does for *some* (but not all) text fields:
|
||||
if (type() != FL_MULTILINE_INPUT) {
|
||||
position(size(), 0); // select everything
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
Fl::compose_reset();
|
||||
break;
|
||||
|
@ -253,5 +265,5 @@ Fl_Input::Fl_Input(int x, int y, int w, int h, const char *l)
|
|||
}
|
||||
|
||||
//
|
||||
// End of "$Id: Fl_Input.cxx,v 1.10.2.7 2000/02/22 00:56:53 bill Exp $".
|
||||
// End of "$Id: Fl_Input.cxx,v 1.10.2.8 2000/03/17 09:38:19 bill Exp $".
|
||||
//
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
//
|
||||
// "$Id: Fl_Scrollbar.cxx,v 1.7.2.7 2000/01/20 06:14:32 bill Exp $"
|
||||
// "$Id: Fl_Scrollbar.cxx,v 1.7.2.8 2000/03/17 09:38:19 bill Exp $"
|
||||
//
|
||||
// Scroll bar widget for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
|
@ -85,11 +85,8 @@ int Fl_Scrollbar::handle(int event) {
|
|||
int S = int(slider_size()*ww+.5);
|
||||
int T = (horizontal() ? H : W)/2+1;
|
||||
if (S < T) S = T;
|
||||
double val;
|
||||
if (minimum() == maximum())
|
||||
val = 0.5;
|
||||
else
|
||||
val = (value()-minimum())/(maximum()-minimum());
|
||||
double val =
|
||||
(maximum()-minimum()) ? (value()-minimum())/(maximum()-minimum()) : 0.5;
|
||||
int sliderx;
|
||||
if (val >= 1.0) sliderx = ww-S;
|
||||
else if (val <= 0.0) sliderx = 0;
|
||||
|
@ -239,5 +236,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.7 2000/01/20 06:14:32 bill Exp $".
|
||||
// End of "$Id: Fl_Scrollbar.cxx,v 1.7.2.8 2000/03/17 09:38:19 bill Exp $".
|
||||
//
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
//
|
||||
// "$Id: Fl_Slider.cxx,v 1.8.2.4 1999/12/07 17:53:09 bill Exp $"
|
||||
// "$Id: Fl_Slider.cxx,v 1.8.2.5 2000/03/17 09:38:20 bill Exp $"
|
||||
//
|
||||
// Slider widget for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
|
@ -185,8 +185,11 @@ int Fl_Slider::handle(int event, int x, int y, int w, int h) {
|
|||
int S = int(slider_size_*W+.5);
|
||||
int X;
|
||||
static int offcenter;
|
||||
|
||||
double val =
|
||||
(maximum()-minimum()) ? (value()-minimum())/(maximum()-minimum()) : 0.5;
|
||||
|
||||
if (type() == FL_HOR_FILL_SLIDER || type() == FL_VERT_FILL_SLIDER) {
|
||||
double val = (value()-minimum())/(maximum()-minimum());
|
||||
|
||||
if (val >= 1.0) X = W;
|
||||
else if (val <= 0.0) X = 0;
|
||||
|
@ -200,7 +203,6 @@ int Fl_Slider::handle(int event, int x, int y, int w, int h) {
|
|||
}
|
||||
S = 0;
|
||||
} else {
|
||||
double val = (value()-minimum())/(maximum()-minimum());
|
||||
|
||||
if (val >= 1.0) X = W-S;
|
||||
else if (val <= 0.0) X = 0;
|
||||
|
@ -249,5 +251,5 @@ int Fl_Slider::handle(int event) {
|
|||
}
|
||||
|
||||
//
|
||||
// End of "$Id: Fl_Slider.cxx,v 1.8.2.4 1999/12/07 17:53:09 bill Exp $".
|
||||
// End of "$Id: Fl_Slider.cxx,v 1.8.2.5 2000/03/17 09:38:20 bill Exp $".
|
||||
//
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
//
|
||||
// "$Id: filename_list.cxx,v 1.10.2.5 2000/03/05 06:51:06 bill Exp $"
|
||||
// "$Id: filename_list.cxx,v 1.10.2.6 2000/03/17 09:38:20 bill Exp $"
|
||||
//
|
||||
// Filename list routines for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
|
@ -43,7 +43,10 @@ int filename_list(const char *d, dirent ***list) {
|
|||
#if defined(__hpux)
|
||||
// HP-UX defines the comparison function like this:
|
||||
return scandir(d, list, 0, (int(*)(const dirent **, const dirent **))numericsort);
|
||||
#elif HAVE_SCANDIR && !defined(__sgi) && !defined(OSF1)
|
||||
#elif defined(__osf__)
|
||||
// OSF, DU 4.0x
|
||||
return scandir(d, list, 0, (int(*)(dirent **, dirent **))numericsort);
|
||||
#elif HAVE_SCANDIR && !defined(__sgi)
|
||||
// The vast majority of Unix systems want the sort function to have this
|
||||
// prototype, most likely so that it can be passed to qsort without any
|
||||
// changes:
|
||||
|
@ -56,5 +59,5 @@ int filename_list(const char *d, dirent ***list) {
|
|||
}
|
||||
|
||||
//
|
||||
// End of "$Id: filename_list.cxx,v 1.10.2.5 2000/03/05 06:51:06 bill Exp $".
|
||||
// End of "$Id: filename_list.cxx,v 1.10.2.6 2000/03/17 09:38:20 bill Exp $".
|
||||
//
|
||||
|
|
Loading…
Reference in New Issue