diff options
| -rw-r--r-- | CHANGES | 5 | ||||
| -rw-r--r-- | configh.cmake.in | 2 | ||||
| -rw-r--r-- | src/Fl_Input.cxx | 7 | ||||
| -rw-r--r-- | src/Fl_Input_.cxx | 3 | ||||
| -rw-r--r-- | src/Fl_Text_Display.cxx | 18 | ||||
| -rw-r--r-- | src/filename_absolute.cxx | 31 | ||||
| -rw-r--r-- | test/hello.cxx | 2 |
7 files changed, 43 insertions, 25 deletions
@@ -4,6 +4,11 @@ CHANGES IN FLTK 1.3.0 CHANGES IN FLTK 1.1.9 + - Improved color contrast in secondary selection blocks + of Fl_Text_Display (STR #1917) + - Fixed regression in callback handling (STR #1918) + - Fixed wrong relative path when absolute path has a + trailing slash in fl_filename_relative (STR #1920) - Fixed multiple selction of files and directories in Fl_File_Chooser (STR #1913) - Fixed MSWindows crash when selecting umlauts diff --git a/configh.cmake.in b/configh.cmake.in index ee5b4605e..9f1948a3a 100644 --- a/configh.cmake.in +++ b/configh.cmake.in @@ -4,7 +4,7 @@ * Configuration file for the Fast Light Tool Kit (FLTK). * @configure_input@ * - * Copyright 1998-2005 by Bill Spitzak and others. + * Copyright 1998-2008 by Bill Spitzak and others. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public diff --git a/src/Fl_Input.cxx b/src/Fl_Input.cxx index 326b1fd66..ba10c0694 100644 --- a/src/Fl_Input.cxx +++ b/src/Fl_Input.cxx @@ -410,9 +410,10 @@ int Fl_Input::handle(int event) { copy(0); } - // perform the RELEASE callback - if (when() & FL_WHEN_RELEASE) - maybe_do_callback(); + // For output widgets, do the callback so the app knows the user + // did something with the mouse... + if (readonly()) do_callback(); + return 1; case FL_DND_ENTER: diff --git a/src/Fl_Input_.cxx b/src/Fl_Input_.cxx index e4ae2e9a6..4d96a3150 100644 --- a/src/Fl_Input_.cxx +++ b/src/Fl_Input_.cxx @@ -715,8 +715,7 @@ int Fl_Input_::handletext(int event, int X, int Y, int W, int H) { } else //if (Fl::selection_owner() != this) minimal_update(mark_, position_); case FL_HIDE: - if (!readonly() && - (when() & (FL_WHEN_RELEASE | FL_WHEN_NOT_CHANGED))) + if (!readonly() && (when() & FL_WHEN_RELEASE)) maybe_do_callback(); return 1; diff --git a/src/Fl_Text_Display.cxx b/src/Fl_Text_Display.cxx index 2fa424711..5ae5f6ff2 100644 --- a/src/Fl_Text_Display.cxx +++ b/src/Fl_Text_Display.cxx @@ -1664,19 +1664,19 @@ void Fl_Text_Display::draw_string( int style, int X, int Y, int toX, if (style & PRIMARY_MASK) { if (Fl::focus() == this) background = selection_color(); - else background = fl_color_average(color(), selection_color(), 0.5f); + else background = fl_color_average(color(), selection_color(), 0.4f); } else if (style & HIGHLIGHT_MASK) { - if (Fl::focus() == this) background = fl_color_average(color(), selection_color(), 0.8f); - else background = fl_color_average(color(), selection_color(), 0.9f); + if (Fl::focus() == this) background = fl_color_average(color(), selection_color(), 0.5f); + else background = fl_color_average(color(), selection_color(), 0.6f); } else background = color(); foreground = fl_contrast(styleRec->color, background); } else if (style & PRIMARY_MASK) { if (Fl::focus() == this) background = selection_color(); - else background = fl_color_average(color(), selection_color(), 0.5f); + else background = fl_color_average(color(), selection_color(), 0.4f); foreground = fl_contrast(textcolor(), background); } else if (style & HIGHLIGHT_MASK) { - if (Fl::focus() == this) background = fl_color_average(color(), selection_color(), 0.8f); - else background = fl_color_average(color(), selection_color(), 0.9f); + if (Fl::focus() == this) background = fl_color_average(color(), selection_color(), 0.5f); + else background = fl_color_average(color(), selection_color(), 0.6f); foreground = fl_contrast(textcolor(), background); } else { foreground = textcolor(); @@ -1727,13 +1727,13 @@ void Fl_Text_Display::clear_rect( int style, int X, int Y, if (Fl::focus()==this) { fl_color(selection_color()); } else { - fl_color(fl_color_average(color(), selection_color(), 0.5f)); + fl_color(fl_color_average(color(), selection_color(), 0.4f)); } } else if (style & HIGHLIGHT_MASK) { if (Fl::focus()==this) { - fl_color(fl_color_average(color(), selection_color(), 0.8f)); + fl_color(fl_color_average(color(), selection_color(), 0.5f)); } else { - fl_color(fl_color_average(color(), selection_color(), 0.9f)); + fl_color(fl_color_average(color(), selection_color(), 0.6f)); } } else { fl_color( color() ); diff --git a/src/filename_absolute.cxx b/src/filename_absolute.cxx index d4101cfec..58fbb6a66 100644 --- a/src/filename_absolute.cxx +++ b/src/filename_absolute.cxx @@ -116,9 +116,11 @@ fl_filename_relative(char *to, // O - Relative filename const char *from) {// I - Absolute filename char *newslash; // Directory separator const char *slash; // Directory separator - char cwd[1024]; // Current directory + char cwd_buf[1024]; // Current directory + char *cwd = cwd_buf; + // return if "from" is not an absolue path #if defined(WIN32) || defined(__EMX__) if (from[0] == '\0' || (!isdirsep(*from) && !isalpha(*from) && from[1] != ':' && @@ -130,35 +132,42 @@ fl_filename_relative(char *to, // O - Relative filename return 0; } - if (!getcwd(cwd, sizeof(cwd))) { + // get the current directory and return if we can't + if (!getcwd(cwd_buf, sizeof(cwd_buf))) { strlcpy(to, from, tolen); return 0; } #if defined(WIN32) || defined(__EMX__) + // convert all backslashes into forward slashes for (newslash = strchr(cwd, '\\'); newslash; newslash = strchr(newslash + 1, '\\')) *newslash = '/'; + // test for the exact same string and return "." if so if (!strcasecmp(from, cwd)) { strlcpy(to, ".", tolen); return (1); } + // test for the same drive. Return the absolute path if not if (tolower(*from & 255) != tolower(*cwd & 255)) { - // Not the same drive... strlcpy(to, from, tolen); return 0; } - for (slash = from + 2, newslash = cwd + 2; + + // compare the path name without the drive prefix + from += 2; cwd += 2; #else + // test for the exact same string and return "." if so if (!strcmp(from, cwd)) { strlcpy(to, ".", tolen); return (1); } +#endif // WIN32 || __EMX__ + // compare both path names until we find a difference for (slash = from, newslash = cwd; -#endif // WIN32 || __EMX__ - *slash != '\0' && *newslash != '\0'; + *slash != '\0' && *newslash != '\0'; slash ++, newslash ++) if (isdirsep(*slash) && isdirsep(*newslash)) continue; #if defined(WIN32) || defined(__EMX__) || defined(__APPLE__) @@ -167,25 +176,31 @@ fl_filename_relative(char *to, // O - Relative filename else if (*slash != *newslash) break; #endif // WIN32 || __EMX__ || __APPLE__ - if (*newslash == '\0' && *slash != '\0' && !isdirsep(*slash)) + // skip over trailing slashes + if ( *newslash == '\0' && *slash != '\0' && !isdirsep(*slash) + &&(newslash==cwd || !isdirsep(newslash[-1])) ) newslash--; + // now go back to the first character of the first differing paths segment while (!isdirsep(*slash) && slash > from) slash --; - if (isdirsep(*slash)) slash ++; + // do the same for the current dir if (*newslash != '\0') while (!isdirsep(*newslash) && newslash > cwd) newslash --; + // prepare the destination buffer to[0] = '\0'; to[tolen - 1] = '\0'; + // now add a "previous dir" sequence for every following slash in the cwd while (*newslash != '\0') { if (isdirsep(*newslash)) strlcat(to, "../", tolen); newslash ++; } + // finally add the differing path from "from" strlcat(to, slash, tolen); return 1; diff --git a/test/hello.cxx b/test/hello.cxx index 87918da26..1021bee1c 100644 --- a/test/hello.cxx +++ b/test/hello.cxx @@ -31,8 +31,6 @@ #include <FL/filename.H> int main(int argc, char **argv) { - char b[1024]; - fl_filename_relative(b, 1024, "/Users/matt/proj/source"); Fl_Window *window = new Fl_Window(300,180); Fl_Box *box = new Fl_Box(FL_UP_BOX,20,40,260,100,"Hello, World!"); box->labelfont(FL_BOLD+FL_ITALIC); |
