diff options
| author | Matthias Melcher <fltk@matthiasm.com> | 2008-04-22 18:11:51 +0000 |
|---|---|---|
| committer | Matthias Melcher <fltk@matthiasm.com> | 2008-04-22 18:11:51 +0000 |
| commit | 6a143b1f61533c03ef20a8f2b82d2c90180055bc (patch) | |
| tree | bae9eeabf06ddfb84d0f01f341d32743a8ab4e31 /src | |
| parent | 232ef4e1599b22e6d1426147ea594193d64f01a1 (diff) | |
Applying 1.1.9 changes to the 1.3 branch.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@6108 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
| -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 |
4 files changed, 37 insertions, 22 deletions
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; |
