Commit 8de2185c authored by Aaron M. Ucko's avatar Aaron M. Ucko

[svn-upgrade] Integrating new upstream version, fltk1.1 (1.1.9)

parent d4a4aa45
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
in Fl_Help_View (STR #1912)
CHANGES IN FLTK 1.1.8
- Documentation fixes (STR #1454, STR #1455, STR #1456,
......
......@@ -7,7 +7,7 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.0)
# The FLTK version
SET(FLTK_VERSION_MAJOR "1")
SET(FLTK_VERSION_MINOR "1")
SET(FLTK_VERSION_PATCH "7")
SET(FLTK_VERSION_PATCH "9")
SET(FLTK_VERSION "${FLTK_VERSION_MAJOR}.${FLTK_VERSION_MINOR}")
SET(FLTK_VERSION_FULL "${FLTK_VERSION}.${FLTK_VERSION_PATCH}")
......
//
// "$Id: Enumerations.H 5834 2007-05-16 08:30:48Z matt $"
// "$Id: Enumerations.H 6096 2008-04-12 04:18:58Z mike $"
//
// Enumerations for the Fast Light Tool Kit (FLTK).
//
......@@ -47,7 +47,7 @@
#define FL_MAJOR_VERSION 1
#define FL_MINOR_VERSION 1
#define FL_PATCH_VERSION 8
#define FL_PATCH_VERSION 9
#define FL_VERSION ((double)FL_MAJOR_VERSION + \
(double)FL_MINOR_VERSION * 0.01 + \
(double)FL_PATCH_VERSION * 0.0001)
......@@ -452,5 +452,5 @@ enum Fl_Damage {
#endif
//
// End of "$Id: Enumerations.H 5834 2007-05-16 08:30:48Z matt $".
// End of "$Id: Enumerations.H 6096 2008-04-12 04:18:58Z mike $".
//
README - Fast Light Tool Kit (FLTK) Version 1.1.8
README - Fast Light Tool Kit (FLTK) Version 1.1.9
-------------------------------------------------
WHAT IS FLTK?
......
/*
* "$Id: configh.cmake.in 4454 2005-07-24 18:41:30Z matt $"
* "$Id: configh.cmake.in 6106 2008-04-21 21:10:47Z matt $"
*
* 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
......@@ -261,5 +261,5 @@
#endif
/*
* End of "$Id: configh.cmake.in 4454 2005-07-24 18:41:30Z matt $".
* End of "$Id: configh.cmake.in 6106 2008-04-21 21:10:47Z matt $".
*/
......@@ -1775,7 +1775,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
FL_MAJOR_VERSION=1
FL_MINOR_VERSION=1
FL_PATCH_VERSION=8
FL_PATCH_VERSION=9
FL_API_VERSION=${FL_MAJOR_VERSION}.${FL_MINOR_VERSION}
......
dnl -*- sh -*-
dnl the "configure" script is made from this by running GNU "autoconf"
dnl
dnl "$Id: configure.in 6051 2008-02-26 15:26:08Z matt $"
dnl "$Id: configure.in 6094 2008-04-11 16:53:01Z matt $"
dnl
dnl Configuration script for the Fast Light Tool Kit (FLTK).
dnl
......@@ -36,7 +36,7 @@ AC_INIT(src/Fl.cxx)
dnl FLTK library versions...
FL_MAJOR_VERSION=1
FL_MINOR_VERSION=1
FL_PATCH_VERSION=8
FL_PATCH_VERSION=9
FL_API_VERSION=${FL_MAJOR_VERSION}.${FL_MINOR_VERSION}
AC_SUBST(FL_MAJOR_VERSION)
......@@ -1156,5 +1156,5 @@ dnl Make sure the fltk-config script is executable...
chmod +x fltk-config
dnl
dnl End of "$Id: configure.in 6051 2008-02-26 15:26:08Z matt $".
dnl End of "$Id: configure.in 6094 2008-04-11 16:53:01Z matt $".
dnl
<HTML>
<HEAD>
<META NAME="robots" CONTENT="noindex">
<TITLE>FLTK 1.1.8 Programming Manual</TITLE>
<TITLE>FLTK 1.1.9 Programming Manual</TITLE>
</HEAD>
<BODY>
......@@ -10,9 +10,9 @@
<TD VALIGN="MIDDLE">
<IMG SRC="FL.gif" WIDTH="200" HEIGHT="100" ALIGN="ABSMIDDLE" ALT="FL"></TD>
<TD ALIGN="CENTER" VALIGN="MIDDLE">
<H1>FLTK 1.1.8 Programming Manual</H1>
<H1>FLTK 1.1.9 Programming Manual</H1>
<P>Revision 8 by Michael Sweet, Craig P. Earls,<br>Matthias Melcher, and Bill Spitzak<BR>
Copyright 1998-2007 by Bill Spitzak and others.</P>
Copyright 1998-2008 by Bill Spitzak and others.</P>
</TD>
</TR>
<TR>
......
<HTML>
<HEAD>
<META CONTENT="Written by Michael Sweet, Craig P. Earls, Matthias Melcher, and Bill Spitzak" NAME="Author">
<META CONTENT="Copyright 1998-2006 by Bill Spitzak and Others." NAME="Copyright">
<META CONTENT="Copyright 1998-2008 by Bill Spitzak and Others." NAME="Copyright">
<META CONTENT="Revision 8" NAME="DocNumber">
<TITLE>FLTK 1.1.8 Programming Manual</TITLE>
<TITLE>FLTK 1.1.9 Programming Manual</TITLE>
</HEAD>
<BODY>
<H1 ALIGN="RIGHT"><A NAME="preface">Preface</A></H1>
<P>This manual describes the Fast Light Tool Kit (&quot;FLTK&quot;)
version 1.1.8, a C++ Graphical User Interface
version 1.1.9, a C++ Graphical User Interface
(&quot;GUI&quot;) toolkit for UNIX, Microsoft Windows and MacOS. Each
of the chapters in this manual is designed as a tutorial for
using FLTK, while the appendices provide a convenient reference
......
......@@ -35,7 +35,7 @@ Version: %{version}
Release: %{release}
License: LGPL
Group: System Environment/Libraries
Source: ftp://ftp.easysw.com/pub/fltk/1.1.8/fltk-1.1.8-source.tar.bz2
Source: ftp://ftp.easysw.com/pub/fltk/1.1.9/fltk-1.1.9-source.tar.bz2
URL: http://www.fltk.org/
Packager: FLTK Developer <fltk@fltk.org>
# use BuildRoot so as not to disturb the version already installed
......
//
// "$Id: Fl_Window_Type.cxx 6012 2008-01-04 21:45:49Z matt $"
// "$Id: Fl_Window_Type.cxx 6098 2008-04-12 18:04:09Z matt $"
//
// Window type code for the Fast Light Tool Kit (FLTK).
//
......@@ -501,9 +501,15 @@ Fl_Window_Type Fl_Window_type;
// Resize from window manager...
void Overlay_Window::resize(int X,int Y,int W,int H) {
Fl_Widget* t = resizable(); resizable(0);
// do not set the mod flag if the window was not resized. In FLUID, all
// windows are opened without a given x/y position, so modifying x/y
// should not mark the project as dirty
if (W!=w() || H!=h())
set_modflag(1);
Fl_Overlay_Window::resize(X,Y,W,H);
resizable(t);
set_modflag(1);
update_xywh();
}
......@@ -1523,5 +1529,5 @@ void Fl_Window_Type::copy_properties() {
//
// End of "$Id: Fl_Window_Type.cxx 6012 2008-01-04 21:45:49Z matt $".
// End of "$Id: Fl_Window_Type.cxx 6098 2008-04-12 18:04:09Z matt $".
//
//
// "$Id: about_panel.cxx 5438 2006-09-17 14:58:25Z mike $"
// "$Id: about_panel.cxx 6094 2008-04-11 16:53:01Z matt $"
//
// About dialog for the Fast Light Tool Kit (FLTK).
//
......@@ -278,14 +278,14 @@ Fl_Double_Window* make_about_panel() {
{ Fl_Box* o = new Fl_Box(10, 10, 115, 120);
o->image(image_fluid);
} // Fl_Box* o
{ Fl_Box* o = new Fl_Box(135, 10, 170, 69, "FLTK User\nInterface Designer\nVersion 1.1.8");
{ Fl_Box* o = new Fl_Box(135, 10, 170, 69, "FLTK User\nInterface Designer\nVersion 1.1.9");
o->color((Fl_Color)12);
o->selection_color(FL_DARK1);
o->labelfont(1);
o->labelsize(18);
o->align(FL_ALIGN_TOP_LEFT|FL_ALIGN_INSIDE);
} // Fl_Box* o
{ Fl_Box* o = new Fl_Box(135, 89, 170, 42, "Copyright 1998-2006 by\nBill Spitzak and others");
{ Fl_Box* o = new Fl_Box(135, 89, 170, 42, "Copyright 1998-2008 by\nBill Spitzak and others");
o->align(132|FL_ALIGN_INSIDE);
} // Fl_Box* o
{ Fl_Button* o = new Fl_Button(89, 141, 123, 25, "View License...");
......@@ -302,5 +302,5 @@ Fl_Double_Window* make_about_panel() {
}
//
// End of "$Id: about_panel.cxx 5438 2006-09-17 14:58:25Z mike $".
// End of "$Id: about_panel.cxx 6094 2008-04-11 16:53:01Z matt $".
//
......@@ -3,7 +3,7 @@ version 1.0108
header_name {.h}
code_name {.cxx}
comment {//
// "$Id: about_panel.fl 5438 2006-09-17 14:58:25Z mike $"
// "$Id: about_panel.fl 6094 2008-04-11 16:53:01Z matt $"
//
// About dialog for the Fast Light Tool Kit (FLTK).
//
......@@ -38,7 +38,7 @@ Function {make_about_panel()} {open
} {
Fl_Window about_panel {
label {About FLUID} open
xywh {391 113 315 175} type Double color 50 selection_color 47 hotspot non_modal visible
xywh {390 162 315 175} type Double color 50 selection_color 47 hotspot non_modal visible
} {
Fl_Box {} {
image {icons/fluid-96.xpm} xywh {10 10 115 120}
......@@ -46,12 +46,12 @@ Function {make_about_panel()} {open
Fl_Box {} {
label {FLTK User
Interface Designer
Version 1.1.8} selected
Version 1.1.9}
xywh {135 10 170 69} color 12 selection_color 47 labelfont 1 labelsize 18 align 21
}
Fl_Box {} {
label {Copyright 1998-2006 by
Bill Spitzak and others}
label {Copyright 1998-2008 by
Bill Spitzak and others} selected
xywh {135 89 170 42} align 148
}
Fl_Button {} {
......@@ -69,6 +69,6 @@ Bill Spitzak and others}
comment {
//
// End of "$Id: about_panel.fl 5438 2006-09-17 14:58:25Z mike $".
// End of "$Id: about_panel.fl 6094 2008-04-11 16:53:01Z matt $".
//} {in_source in_header
}
//
// "$Id: Fl_File_Chooser.cxx 5704 2007-02-21 20:23:03Z matt $"
// "$Id: Fl_File_Chooser.cxx 6092 2008-04-11 12:57:37Z matt $"
//
// Fl_File_Chooser dialog for the Fast Light Tool Kit (FLTK).
//
......@@ -218,7 +218,7 @@ Fl_File_Chooser::Fl_File_Chooser(const char *d, const char *p, int t, const char
fileName->callback((Fl_Callback*)cb_fileName);
fileName->when(FL_WHEN_ENTER_KEY);
Fl_Group::current()->resizable(fileName);
fileName->when(FL_WHEN_CHANGED | FL_WHEN_ENTER_KEY_ALWAYS);
fileName->when(FL_WHEN_CHANGED | FL_WHEN_ENTER_KEY);
} // Fl_File_Input* fileName
{ Fl_Box* o = new Fl_Box(10, 310, 105, 25, "Filename:");
o->labelfont(1);
......@@ -440,5 +440,5 @@ int Fl_File_Chooser::visible() {
}
//
// End of "$Id: Fl_File_Chooser.cxx 5704 2007-02-21 20:23:03Z matt $".
// End of "$Id: Fl_File_Chooser.cxx 6092 2008-04-11 12:57:37Z matt $".
//
......@@ -3,7 +3,7 @@ version 1.0108
header_name {../FL/Fl_File_Chooser.H}
code_name {.cxx}
comment {//
// "$Id: Fl_File_Chooser.fl 5704 2007-02-21 20:23:03Z matt $"
// "$Id: Fl_File_Chooser.fl 6092 2008-04-11 12:57:37Z matt $"
//
// Fl_File_Chooser dialog for the Fast Light Tool Kit (FLTK).
//
......@@ -61,7 +61,7 @@ class FL_EXPORT Fl_File_Chooser {open
callback {fileName->value("");
fileList->deselect();
Fl::remove_timeout((Fl_Timeout_Handler)previewCB, this);
window->hide();}
window->hide();} open
private xywh {388 284 490 380} type Double resizable
code0 {if (title) window->label(title);}
code1 {\#include <stdio.h>}
......@@ -100,11 +100,11 @@ window->hide();}
code0 {\#include <FL/Fl_File_Browser.H>}
}
Fl_Box previewBox {
label {?}
label {?} selected
private xywh {305 45 175 225} box DOWN_BOX labelsize 100 align 80
}
}
Fl_Group {} {
Fl_Group {} {open
private xywh {10 275 470 95}
} {
Fl_Group {} {open
......@@ -123,7 +123,7 @@ window->hide();}
Fl_File_Input fileName {
callback {fileNameCB();}
private xywh {115 300 365 35} labelfont 1 when 8 resizable
code0 {fileName->when(FL_WHEN_CHANGED | FL_WHEN_ENTER_KEY_ALWAYS);}
code0 {fileName->when(FL_WHEN_CHANGED | FL_WHEN_ENTER_KEY);}
}
Fl_Box {} {
label {Filename:}
......@@ -220,8 +220,7 @@ type(t);
int e;
prefs_.get("preview", e, 1);
preview(e);
Fl_Group::current(prev_current);} {selected
}
Fl_Group::current(prev_current);} {}
}
Function {~Fl_File_Chooser()} {} {
code {Fl::remove_timeout((Fl_Timeout_Handler)previewCB, this);
......@@ -422,6 +421,6 @@ decl {FL_EXPORT void fl_file_chooser_ok_label(const char*l);} {public
comment {
//
// End of "$Id: Fl_File_Chooser.fl 5704 2007-02-21 20:23:03Z matt $".
// End of "$Id: Fl_File_Chooser.fl 6092 2008-04-11 12:57:37Z matt $".
//} {in_source in_header
}
//
// "$Id: Fl_File_Chooser2.cxx 5703 2007-02-21 20:08:07Z matt $"
// "$Id: Fl_File_Chooser2.cxx 6092 2008-04-11 12:57:37Z matt $"
//
// More Fl_File_Chooser routines.
//
......@@ -134,9 +134,12 @@ Fl_File_Chooser::count() {
for (i = 1, fcount = 0; i <= fileList->size(); i ++)
if (fileList->selected(i)) {
// See if this file is a directory...
filename = (char *)fileList->text(i);
// matt: why would we do that? It is perfectly legal to select multiple
// directories in a DIR chooser. They are visually selected and value(i)
// returns all of them as expected
//filename = (char *)fileList->text(i);
if (filename[strlen(filename) - 1] != '/')
//if (filename[strlen(filename) - 1] != '/')
fcount ++;
}
......@@ -505,8 +508,8 @@ Fl_File_Chooser::fileNameCB()
first_line; // First matching line
const char *file; // File from directory
// puts("fileNameCB()");
// printf("Event: %s\n", fl_eventnames[Fl::event()]);
// Get the filename from the text field...
filename = (char *)fileName->value();
......@@ -1301,5 +1304,5 @@ unquote_pathname(char *dst, // O - Destination string
//
// End of "$Id: Fl_File_Chooser2.cxx 5703 2007-02-21 20:08:07Z matt $".
// End of "$Id: Fl_File_Chooser2.cxx 6092 2008-04-11 12:57:37Z matt $".
//
//
// "$Id: Fl_Help_View.cxx 6029 2008-02-20 17:39:07Z matt $"
// "$Id: Fl_Help_View.cxx 6091 2008-04-11 11:12:16Z matt $"
//
// Fl_Help_View widget routines.
//
......@@ -2872,7 +2872,7 @@ void Fl_Help_View::end_selection(int clipboard)
*d++ = *src++;
}
c = src[-1];
p = isspace(c) ? ' ' : c;
p = isspace(c&255) ? ' ' : c;
}
continue;
}
......@@ -2888,7 +2888,7 @@ void Fl_Help_View::end_selection(int clipboard)
}
int n = s-value_;
if (n>selection_first && n<=selection_last) {
if (!pre && isspace(c)) c = ' ';
if (!pre && isspace(c&255)) c = ' ';
if (p!=' '||c!=' ')
*d++ = c;
p = c;
......@@ -3450,5 +3450,5 @@ hscrollbar_callback(Fl_Widget *s, void *)
//
// End of "$Id: Fl_Help_View.cxx 6029 2008-02-20 17:39:07Z matt $".
// End of "$Id: Fl_Help_View.cxx 6091 2008-04-11 11:12:16Z matt $".
//
//
// "$Id: Fl_Input.cxx 6031 2008-02-20 17:59:13Z matt $"
// "$Id: Fl_Input.cxx 6103 2008-04-21 20:42:51Z matt $"
//
// Input widget for the Fast Light Tool Kit (FLTK).
//
......@@ -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:
......@@ -469,5 +470,5 @@ Fl_Input::Fl_Input(int X, int Y, int W, int H, const char *l)
}
//
// End of "$Id: Fl_Input.cxx 6031 2008-02-20 17:59:13Z matt $".
// End of "$Id: Fl_Input.cxx 6103 2008-04-21 20:42:51Z matt $".
//
//
// "$Id: Fl_Input_.cxx 6031 2008-02-20 17:59:13Z matt $"
// "$Id: Fl_Input_.cxx 6104 2008-04-21 20:54:37Z matt $"
//
// Common input widget routines for the Fast Light Tool Kit (FLTK).
//
......@@ -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;
......@@ -904,5 +903,5 @@ Fl_Input_::~Fl_Input_() {
}
//
// End of "$Id: Fl_Input_.cxx 6031 2008-02-20 17:59:13Z matt $".
// End of "$Id: Fl_Input_.cxx 6104 2008-04-21 20:54:37Z matt $".
//
//
// "$Id: Fl_Text_Display.cxx 6011 2008-01-04 20:32:37Z matt $"
// "$Id: Fl_Text_Display.cxx 6105 2008-04-21 21:03:22Z matt $"
//
// Copyright 2001-2006 by Bill Spitzak and others.
// Original code Copyright Mark Edel. Permission to distribute under
......@@ -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() );
......@@ -3268,5 +3268,5 @@ int Fl_Text_Display::handle(int event) {
//
// End of "$Id: Fl_Text_Display.cxx 6011 2008-01-04 20:32:37Z matt $".
// End of "$Id: Fl_Text_Display.cxx 6105 2008-04-21 21:03:22Z matt $".
//
//
// "$Id: filename_absolute.cxx 5190 2006-06-09 16:16:34Z mike $"
// "$Id: filename_absolute.cxx 6102 2008-04-21 19:54:34Z matt $"
//
// Filename expansion routines for the Fast Light Tool Kit (FLTK).
//
......@@ -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;
......@@ -193,5 +208,5 @@ fl_filename_relative(char *to, // O - Relative filename
//
// End of "$Id: filename_absolute.cxx 5190 2006-06-09 16:16:34Z mike $".
// End of "$Id: filename_absolute.cxx 6102 2008-04-21 19:54:34Z matt $".
//
//
// "$Id: file_chooser.cxx 5845 2007-05-20 00:01:06Z mike $"
// "$Id: file_chooser.cxx 6092 2008-04-11 12:57:37Z matt $"
//
// File chooser test program.
//
......@@ -315,8 +315,9 @@ show_callback(void)
fc->show();
while (fc->visible())
while (fc->visible()) {
Fl::wait();
}
count = fc->count();
if (count > 0)
......@@ -340,5 +341,5 @@ show_callback(void)
//
// End of "$Id: file_chooser.cxx 5845 2007-05-20 00:01:06Z mike $".
// End of "$Id: file_chooser.cxx 6092 2008-04-11 12:57:37Z matt $".
//
//
// "$Id: hello.cxx 6036 2008-02-20 18:36:38Z matt $"
// "$Id: hello.cxx 6102 2008-04-21 19:54:34Z matt $"
//
// Hello, World! program for the Fast Light Tool Kit (FLTK).
//
......@@ -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);
......@@ -44,6 +42,6 @@ int main(int argc, char **argv) {
}
//
// End of "$Id: hello.cxx 6036 2008-02-20 18:36:38Z matt $".
// End of "$Id: hello.cxx 6102 2008-04-21 19:54:34Z matt $".
//
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment