mirror of
https://github.com/fltk/fltk.git
synced 2026-05-20 12:41:27 +08:00
Fix Fl_Window::show(argc, argv) so that it calls Fl::get_system_colors(),
and Fl::get_system_colors() so that it doesn't override user/program colors (STR #119) git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@3069 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
CHANGES IN FLTK 1.1.4
|
||||
|
||||
- Fl_Window::show(argc, argv) wasn't calling
|
||||
Fl::get_system_colors() as documented (STR #119)
|
||||
- DSO (shared library) building wasn't quite right for
|
||||
some platforms (STR #118)
|
||||
- OSX: some changes to make ProjectBuilder compiles
|
||||
possible.
|
||||
- OSX: FLTK would not know where a window was positioned
|
||||
|
||||
+19
-23
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: Fl_arg.cxx,v 1.5.2.8.2.15 2003/07/29 15:12:36 easysw Exp $"
|
||||
// "$Id: Fl_arg.cxx,v 1.5.2.8.2.16 2003/08/02 13:49:17 easysw Exp $"
|
||||
//
|
||||
// Optional argument initialization code for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@@ -174,38 +174,34 @@ int Fl::args(int argc, char** argv, int& i, int (*cb)(int,char**,int&)) {
|
||||
return i;
|
||||
}
|
||||
|
||||
|
||||
// show a main window, use any parsed arguments
|
||||
void Fl_Window::show(int argc, char **argv) {
|
||||
if (!argc) {show(); return;}
|
||||
if (!arg_called) {
|
||||
Fl::args(argc,argv);
|
||||
if (argc && !arg_called) Fl::args(argc,argv);
|
||||
|
||||
Fl::get_system_colors();
|
||||
|
||||
#if !defined(WIN32) && !defined(__APPLE__)
|
||||
// Get defaults for drag-n-drop and focus...
|
||||
const char *key = 0, *val;
|
||||
// Get defaults for drag-n-drop and focus...
|
||||
const char *key = 0, *val;
|
||||
|
||||
fl_open_display();
|
||||
if (Fl::first_window()) key = Fl::first_window()->xclass();
|
||||
if (!key) key = "fltk";
|
||||
|
||||
if (Fl::first_window()) key = Fl::first_window()->xclass();
|
||||
if (!key) key = "fltk";
|
||||
val = XGetDefault(fl_display, key, "dndTextOps");
|
||||
if (val) Fl::dnd_text_ops(strcasecmp(val, "true") == 0 ||
|
||||
strcasecmp(val, "on") == 0 ||
|
||||
strcasecmp(val, "yes") == 0);
|
||||
|
||||
val = XGetDefault(fl_display, key, "dndTextOps");
|
||||
if (val) Fl::dnd_text_ops(strcasecmp(val, "true") == 0 ||
|
||||
val = XGetDefault(fl_display, key, "tooltips");
|
||||
if (val) Fl_Tooltip::enable(strcasecmp(val, "true") == 0 ||
|
||||
strcasecmp(val, "on") == 0 ||
|
||||
strcasecmp(val, "yes") == 0);
|
||||
|
||||
val = XGetDefault(fl_display, key, "tooltips");
|
||||
if (val) Fl_Tooltip::enable(strcasecmp(val, "true") == 0 ||
|
||||
strcasecmp(val, "on") == 0 ||
|
||||
strcasecmp(val, "yes") == 0);
|
||||
|
||||
val = XGetDefault(fl_display, key, "visibleFocus");
|
||||
if (val) Fl::visible_focus(strcasecmp(val, "true") == 0 ||
|
||||
strcasecmp(val, "on") == 0 ||
|
||||
strcasecmp(val, "yes") == 0);
|
||||
val = XGetDefault(fl_display, key, "visibleFocus");
|
||||
if (val) Fl::visible_focus(strcasecmp(val, "true") == 0 ||
|
||||
strcasecmp(val, "on") == 0 ||
|
||||
strcasecmp(val, "yes") == 0);
|
||||
#endif // !WIN32 && !__APPLE__
|
||||
}
|
||||
|
||||
// set colors first, so background_pixel is correct:
|
||||
static char beenhere;
|
||||
@@ -420,5 +416,5 @@ int XParseGeometry(const char* string, int* x, int* y,
|
||||
#endif // ifdef WIN32
|
||||
|
||||
//
|
||||
// End of "$Id: Fl_arg.cxx,v 1.5.2.8.2.15 2003/07/29 15:12:36 easysw Exp $".
|
||||
// End of "$Id: Fl_arg.cxx,v 1.5.2.8.2.16 2003/08/02 13:49:17 easysw Exp $".
|
||||
//
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: Fl_get_system_colors.cxx,v 1.6.2.7.2.22 2003/07/29 02:12:36 easysw Exp $"
|
||||
// "$Id: Fl_get_system_colors.cxx,v 1.6.2.7.2.23 2003/08/02 13:49:17 easysw Exp $"
|
||||
//
|
||||
// System color support for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@@ -39,7 +39,14 @@ extern "C" int putenv(const char*);
|
||||
#endif // __APPLE__ && __MWERKS__
|
||||
|
||||
|
||||
static char fl_bg_set = 0;
|
||||
static char fl_bg2_set = 0;
|
||||
static char fl_fg_set = 0;
|
||||
|
||||
|
||||
void Fl::background(uchar r, uchar g, uchar b) {
|
||||
fl_bg_set = 1;
|
||||
|
||||
// replace the gray ramp so that FL_GRAY is this color
|
||||
if (!r) r = 1; else if (r==255) r = 254;
|
||||
double powr = log(r/255.0)/log((FL_GRAY-FL_GRAY_RAMP)/(FL_NUM_GRAY-1.0));
|
||||
@@ -57,10 +64,15 @@ void Fl::background(uchar r, uchar g, uchar b) {
|
||||
}
|
||||
|
||||
void Fl::foreground(uchar r, uchar g, uchar b) {
|
||||
fl_fg_set = 1;
|
||||
|
||||
Fl::set_color(FL_FOREGROUND_COLOR,r,g,b);
|
||||
}
|
||||
|
||||
void Fl::background2(uchar r, uchar g, uchar b) {
|
||||
fl_fg_set = 1;
|
||||
fl_bg2_set = 1;
|
||||
|
||||
Fl::set_color(FL_BACKGROUND2_COLOR,r,g,b);
|
||||
Fl::set_color(FL_FOREGROUND_COLOR,
|
||||
get_color(fl_contrast(FL_FOREGROUND_COLOR,FL_BACKGROUND2_COLOR)));
|
||||
@@ -131,9 +143,9 @@ getsyscolor(int what, const char* arg, void (*func)(uchar,uchar,uchar))
|
||||
}
|
||||
|
||||
void Fl::get_system_colors() {
|
||||
getsyscolor(COLOR_WINDOW, fl_bg2,Fl::background2);
|
||||
getsyscolor(COLOR_WINDOWTEXT, fl_fg, Fl::foreground);
|
||||
getsyscolor(COLOR_BTNFACE, fl_bg, Fl::background);
|
||||
if (!fl_bg2_set) getsyscolor(COLOR_WINDOW, fl_bg2,Fl::background2);
|
||||
if (!fl_fg_set) getsyscolor(COLOR_WINDOWTEXT, fl_fg, Fl::foreground);
|
||||
if (!fl_bg_set) getsyscolor(COLOR_BTNFACE, fl_bg, Fl::background);
|
||||
getsyscolor(COLOR_HIGHLIGHT, 0, set_selection_color);
|
||||
}
|
||||
|
||||
@@ -147,9 +159,9 @@ void Fl::get_system_colors()
|
||||
{
|
||||
fl_open_display();
|
||||
|
||||
foreground(0, 0, 0);
|
||||
background(0xd8, 0xd8, 0xd8);
|
||||
background2(0xff, 0xff, 0xff);
|
||||
if (!fl_bg2_set) background2(0xff, 0xff, 0xff);
|
||||
if (!fl_fg_set) foreground(0, 0, 0);
|
||||
if (!fl_bg_set) background(0xd8, 0xd8, 0xd8);
|
||||
set_selection_color(0x00, 0x00, 0x80);
|
||||
}
|
||||
#else
|
||||
@@ -183,9 +195,9 @@ void Fl::get_system_colors()
|
||||
const char* key1 = 0;
|
||||
if (Fl::first_window()) key1 = Fl::first_window()->xclass();
|
||||
if (!key1) key1 = "fltk";
|
||||
getsyscolor(key1, "background", fl_bg, "#c0c0c0", Fl::background);
|
||||
getsyscolor(key1, "foreground", fl_fg, "#000000", Fl::foreground);
|
||||
getsyscolor("Text","background", fl_bg2, "#ffffff", Fl::background2);
|
||||
if (!fl_bg2_set) getsyscolor("Text","background", fl_bg2, "#ffffff", Fl::background2);
|
||||
if (!fl_fg_set) getsyscolor(key1, "foreground", fl_fg, "#000000", Fl::foreground);
|
||||
if (!fl_bg_set) getsyscolor(key1, "background", fl_bg, "#c0c0c0", Fl::background);
|
||||
getsyscolor(key1, "selectBackground",0, "#000080", set_selection_color);
|
||||
}
|
||||
|
||||
@@ -321,5 +333,5 @@ int Fl::reload_scheme() {
|
||||
|
||||
|
||||
//
|
||||
// End of "$Id: Fl_get_system_colors.cxx,v 1.6.2.7.2.22 2003/07/29 02:12:36 easysw Exp $".
|
||||
// End of "$Id: Fl_get_system_colors.cxx,v 1.6.2.7.2.23 2003/08/02 13:49:17 easysw Exp $".
|
||||
//
|
||||
|
||||
+4
-4
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# "$Id: Makefile,v 1.18.2.14.2.52 2003/06/15 05:37:32 easysw Exp $"
|
||||
# "$Id: Makefile,v 1.18.2.14.2.53 2003/08/02 13:49:17 easysw Exp $"
|
||||
#
|
||||
# Library makefile for the Fast Light Tool Kit (FLTK).
|
||||
#
|
||||
@@ -308,13 +308,13 @@ $(IMGLIBNAME): $(IMGOBJECTS)
|
||||
|
||||
libfltk_images.so.1.1: $(IMGOBJECTS)
|
||||
echo $(DSOCOMMAND) $@ ...
|
||||
$(DSOCOMMAND) $@ $(IMGOBJECTS) $(IMGLIBS)
|
||||
$(DSOCOMMAND) $@ $(IMGOBJECTS) $(IMAGELIBS)
|
||||
-$(RM) libfltk_images.so
|
||||
$(LN) libfltk_images.so.1.1 libfltk_images.so
|
||||
|
||||
libfltk_images.sl.1.1: $(IMGOBJECTS)
|
||||
echo $(DSOCOMMAND) $@ ...
|
||||
$(DSOCOMMAND) $@ $(IMGOBJECTS) $(IMGLIBS)
|
||||
$(DSOCOMMAND) $@ $(IMGOBJECTS) $(IMAGELIBS)
|
||||
-$(RM) libfltk_images.sl
|
||||
$(LN) libfltk_images.sl.1.1 libfltk_images.sl
|
||||
|
||||
@@ -582,5 +582,5 @@ uninstall:
|
||||
|
||||
|
||||
#
|
||||
# End of "$Id: Makefile,v 1.18.2.14.2.52 2003/06/15 05:37:32 easysw Exp $".
|
||||
# End of "$Id: Makefile,v 1.18.2.14.2.53 2003/08/02 13:49:17 easysw Exp $".
|
||||
#
|
||||
|
||||
Reference in New Issue
Block a user