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
This commit is contained in:
Matthias Melcher 2008-04-22 18:11:51 +00:00
parent 232ef4e159
commit 6a143b1f61
7 changed files with 44 additions and 26 deletions

View File

@ -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

View File

@ -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

View File

@ -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:

View File

@ -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;

View File

@ -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() );

View File

@ -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);
}
for (slash = from, newslash = cwd;
#endif // WIN32 || __EMX__
*slash != '\0' && *newslash != '\0';
// compare both path names until we find a difference
for (slash = from, newslash = cwd;
*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;

View File

@ -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);