Author: matt
Date: 2011-05-24 13:17:48 -0700 (Tue, 24 May 2011)
New Revision: 8737
Log:
123: ported all filename functions into nemaspace. 94 variable and function
names left to port ;-)
Modified:
branches/branch-3.0/fltk3/FileBrowser.h
branches/branch-3.0/fltk3/filename.h
branches/branch-3.0/fluid/Fl_Function_Type.cxx
branches/branch-3.0/fluid/Fluid_Image.cxx
branches/branch-3.0/fluid/code.cxx
branches/branch-3.0/fluid/fluid.cxx
branches/branch-3.0/fluid/template_panel.cxx
branches/branch-3.0/src/Fl_File_Browser.cxx
branches/branch-3.0/src/Fl_File_Chooser2.cxx
branches/branch-3.0/src/Fl_File_Icon.cxx
branches/branch-3.0/src/Fl_File_Icon2.cxx
branches/branch-3.0/src/Fl_Help_View.cxx
branches/branch-3.0/src/Fl_Native_File_Chooser_MAC.mm
branches/branch-3.0/src/Fl_Preferences.cxx
branches/branch-3.0/src/Fl_arg.cxx
branches/branch-3.0/src/Fl_cocoa.mm
branches/branch-3.0/src/Fl_mac.cxx
branches/branch-3.0/src/Fl_win32.cxx
branches/branch-3.0/src/Fl_x.cxx
branches/branch-3.0/src/filename_absolute.cxx
branches/branch-3.0/src/filename_expand.cxx
branches/branch-3.0/src/filename_ext.cxx
branches/branch-3.0/src/filename_isdir.cxx
branches/branch-3.0/src/filename_list.cxx
branches/branch-3.0/src/filename_match.cxx
branches/branch-3.0/src/filename_setext.cxx
branches/branch-3.0/src/fl_file_dir.cxx
branches/branch-3.0/src/fl_open_uri.cxx
branches/branch-3.0/src/forms_fselect.cxx
branches/branch-3.0/src/numericsort.cxx
branches/branch-3.0/test/demo.cxx
branches/branch-3.0/test/file_chooser.cxx
branches/branch-3.0/test/pixmap_browser.cxx
Modified: branches/branch-3.0/fltk3/FileBrowser.h
===================================================================
--- branches/branch-3.0/fltk3/FileBrowser.h 2011-05-24 20:00:56 UTC (rev
8736)
+++ branches/branch-3.0/fltk3/FileBrowser.h 2011-05-24 20:17:48 UTC (rev
8737)
@@ -75,13 +75,13 @@
/**
Sets or gets the filename filter. The pattern matching uses
- the fl_filename_match()
+ the fltk3::filename_match()
function in FLTK.
*/
void filter(const char *pattern);
/**
Sets or gets the filename filter. The pattern matching uses
- the fl_filename_match()
+ the fltk3::filename_match()
function in FLTK.
*/
const char *filter() const { return (pattern_); };
@@ -91,9 +91,9 @@
loaded then the correct icon is associated with each file in the list.
<P>The sort argument specifies a sort function to be used with
- fl_filename_list().
+ fltk3::filename_list().
*/
- int load(const char *directory, fltk3::FileSortF *sort =
fl_numericsort);
+ int load(const char *directory, fltk3::FileSortF *sort =
fltk3::numericsort);
fltk3::Fontsize textsize() const { return fltk3::Browser::textsize(); };
void textsize(fltk3::Fontsize s) {
fltk3::Browser::textsize(s); iconsize_ = (uchar)(3 * s / 2); };
Modified: branches/branch-3.0/fltk3/filename.h
===================================================================
--- branches/branch-3.0/fltk3/filename.h 2011-05-24 20:00:56 UTC (rev
8736)
+++ branches/branch-3.0/fltk3/filename.h 2011-05-24 20:17:48 UTC (rev
8737)
@@ -43,50 +43,49 @@
/** \addtogroup filenames File names and URI utility functions
File names and URI functions defined in <fltk3/filename.h>
- @{ */
+ @{ */
#ifdef _MAX_PATH
const unsigned int FLTK3_PATH_MAX = _MAX_PATH;
+#elif defined(MAX_PATH)
+const unsigned int FLTK3_PATH_MAX = MAX_PATH;
#else
const unsigned int FLTK3_PATH_MAX = 2048; /**< all path buffers should use
this length */
#endif
-/** Gets the file name from a path.
- Similar to basename(3), exceptions shown below.
- \code
- #include <fltk3/filename.h>
- [..]
- const char *out;
- out = fl_filename_name("/usr/lib"); // out="lib"
- out = fl_filename_name("/usr/"); // out="" (basename(3)
returns "usr" instead)
- out = fl_filename_name("/usr"); // out="usr"
- out = fl_filename_name("/"); // out="" (basename(3)
returns "/" instead)
- out = fl_filename_name("."); // out="."
- out = fl_filename_name(".."); // out=".."
- \endcode
- \return a pointer to the char after the last slash, or to \p filename if
there is none.
- */
-FLTK3_EXPORT const char *fl_filename_name(const char * filename);
-FLTK3_EXPORT const char *fl_filename_ext(const char *buf);
-FLTK3_EXPORT char *fl_filename_setext(char *to, int tolen, const char *ext);
-FLTK3_EXPORT int fl_filename_expand(char *to, int tolen, const char *from);
-FLTK3_EXPORT int fl_filename_absolute(char *to, int tolen, const char *from);
-FLTK3_EXPORT int fl_filename_relative(char *to, int tolen, const char *from);
-FLTK3_EXPORT int fl_filename_match(const char *name, const char *pattern);
-FLTK3_EXPORT int fl_filename_isdir(const char *name);
+namespace fltk3 {
+
+ /** Gets the file name from a path.
+ Similar to basename(3), exceptions shown below.
+ \code
+ #include <fltk3/filename.h>
+ [..]
+ const char *out;
+ out = fltk3::filename_name("/usr/lib"); // out="lib"
+ out = fltk3::filename_name("/usr/"); // out="" (basename(3)
returns "usr" instead)
+ out = fltk3::filename_name("/usr"); // out="usr"
+ out = fltk3::filename_name("/"); // out="" (basename(3)
returns "/" instead)
+ out = fltk3::filename_name("."); // out="."
+ out = fltk3::filename_name(".."); // out=".."
+ \endcode
+ \return a pointer to the char after the last slash, or to \p filename if
there is none.
+ */
+ FLTK3_EXPORT const char *filename_name(const char * filename);
+ FLTK3_EXPORT const char *filename_ext(const char *buf);
+ FLTK3_EXPORT char *filename_setext(char *to, int tolen, const char *ext);
+ FLTK3_EXPORT int filename_expand(char *to, int tolen, const char *from);
+ FLTK3_EXPORT int filename_absolute(char *to, int tolen, const char *from);
+ FLTK3_EXPORT int filename_relative(char *to, int tolen, const char *from);
+ FLTK3_EXPORT int filename_match(const char *name, const char *pattern);
+ FLTK3_EXPORT int filename_isdir(const char *name);
+
+ inline char *filename_setext(char *to, const char *ext) { return
filename_setext(to, FLTK3_PATH_MAX, ext); }
+ inline int filename_expand(char *to, const char *from) { return
filename_expand(to, FLTK3_PATH_MAX, from); }
+ inline int filename_absolute(char *to, const char *from) { return
filename_absolute(to, FLTK3_PATH_MAX, from); }
+ FLTK3_EXPORT int filename_relative(char *to, int tolen, const char *from,
const char *cwd);
+ inline int filename_relative(char *to, const char *from) { return
filename_relative(to, FLTK3_PATH_MAX, from); }
+
+}
-# if defined(__cplusplus) && !defined(FLTK3_DOXYGEN)
-/*
- * Under WIN32, we include filename.h from numericsort.c; this should probably
change...
- */
-
-inline char *fl_filename_setext(char *to, const char *ext) { return
fl_filename_setext(to, FLTK3_PATH_MAX, ext); }
-inline int fl_filename_expand(char *to, const char *from) { return
fl_filename_expand(to, FLTK3_PATH_MAX, from); }
-inline int fl_filename_absolute(char *to, const char *from) { return
fl_filename_absolute(to, FLTK3_PATH_MAX, from); }
-FLTK3_EXPORT int fl_filename_relative(char *to, int tolen, const char *from,
const char *cwd);
-inline int fl_filename_relative(char *to, const char *from) { return
fl_filename_relative(to, FLTK3_PATH_MAX, from); }
-# endif /* __cplusplus */
-
-
# if defined(WIN32) && !defined(__CYGWIN__) && !defined(__WATCOMC__)
struct dirent {char d_name[1];};
@@ -116,53 +115,46 @@
# undef fl_dirent_h_cyclic_include
# endif
-# if defined (__cplusplus)
-extern "C" {
-# endif /* __cplusplus */
-
-# if !defined(FLTK3_DOXYGEN)
-FLTK3_EXPORT int fl_alphasort(struct dirent **, struct dirent **);
-FLTK3_EXPORT int fl_casealphasort(struct dirent **, struct dirent **);
-FLTK3_EXPORT int fl_casenumericsort(struct dirent **, struct dirent **);
-FLTK3_EXPORT int fl_numericsort(struct dirent **, struct dirent **);
-# endif
-
- namespace fltk3 {
- typedef int (FileSortF)(struct dirent **, struct dirent **); /**< File
sorting function. \see fl_filename_list() */
- }
-
-# if defined(__cplusplus)
-}
-
-/*
- * Portable "scandir" function. Ugly but necessary...
- */
-
-FLTK3_EXPORT int fl_filename_list(const char *d, struct dirent ***l,
- fltk3::FileSortF *s = fl_numericsort);
-FLTK3_EXPORT void fl_filename_free_list(struct dirent ***l, int n);
-
-/*
- * Generic function to open a Uniform Resource Identifier (URI) using a
- * system-defined program (added in FLTK 1.1.8)
- */
-
-FLTK3_EXPORT int fl_open_uri(const char *uri, char *msg = (char *)0,
+namespace fltk3 {
+
+#if !defined(FLTK3_DOXYGEN)
+ FLTK3_EXPORT int alphasort(struct dirent **, struct dirent **);
+ FLTK3_EXPORT int casealphasort(struct dirent **, struct dirent **);
+ FLTK3_EXPORT int casenumericsort(struct dirent **, struct dirent **);
+ FLTK3_EXPORT int numericsort(struct dirent **, struct dirent **);
+#endif
+
+ typedef int (FileSortF)(struct dirent **, struct dirent **); /**< File
sorting function. \see fltk3::filename_list() */
+
+ /*
+ * Portable "scandir" function. Ugly but necessary...
+ */
+
+ FLTK3_EXPORT int filename_list(const char *d, struct dirent ***l,
+ fltk3::FileSortF *s = fltk3::numericsort);
+ FLTK3_EXPORT void filename_free_list(struct dirent ***l, int n);
+
+ /*
+ * Generic function to open a Uniform Resource Identifier (URI) using a
+ * system-defined program (added in FLTK 1.1.8)
+ */
+
+ FLTK3_EXPORT int open_uri(const char *uri, char *msg = (char *)0,
int msglen = 0);
-
+
# ifndef FLTK3_DOXYGEN
-/*
- * _fl_filename_isdir_quick() is a private function that checks for a
- * trailing slash and assumes that the passed name is a directory if
- * it finds one. This function is used by fltk3::FileBrowser and
- * fltk3::FileChooser to avoid extra stat() calls, but is not supported
- * outside of FLTK...
- */
-int _fl_filename_isdir_quick(const char *name);
+ /*
+ * fltk3::_filename_isdir_quick() is a private function that checks for a
+ * trailing slash and assumes that the passed name is a directory if
+ * it finds one. This function is used by fltk3::FileBrowser and
+ * fltk3::FileChooser to avoid extra stat() calls, but is not supported
+ * outside of FLTK...
+ */
+ int _filename_isdir_quick(const char *name);
# endif
+
+}
-# endif /* __cplusplus */
-
#endif /* FLtk3_FILENAME_H */
/** @} */
Modified: branches/branch-3.0/fluid/Fl_Function_Type.cxx
===================================================================
--- branches/branch-3.0/fluid/Fl_Function_Type.cxx 2011-05-24 20:00:56 UTC
(rev 8736)
+++ branches/branch-3.0/fluid/Fl_Function_Type.cxx 2011-05-24 20:17:48 UTC
(rev 8737)
@@ -421,7 +421,7 @@
if (rtype && !return_type) return 0;
if (!name()) return 0;
if ( (rtype==0L || strcmp(return_type, rtype)==0)
- && fl_filename_match(name(), sig)) {
+ && fltk3::filename_match(name(), sig)) {
return 1;
}
return 0;
Modified: branches/branch-3.0/fluid/Fluid_Image.cxx
===================================================================
--- branches/branch-3.0/fluid/Fluid_Image.cxx 2011-05-24 20:00:56 UTC (rev
8736)
+++ branches/branch-3.0/fluid/Fluid_Image.cxx 2011-05-24 20:17:48 UTC (rev
8737)
@@ -61,7 +61,7 @@
pixmap_header_written = write_number;
}
write_c("static const char *%s[] = {\n",
- unique_id(this, "idata", fl_filename_name(name()), 0));
+ unique_id(this, "idata", fltk3::filename_name(name()), 0));
write_cstring(img->data()[0], strlen(img->data()[0]));
int i;
@@ -84,8 +84,8 @@
}
write_c("\n};\n");
write_c("static fltk3::Pixmap %s(%s);\n",
- unique_id(this, "image", fl_filename_name(name()), 0),
- unique_id(this, "idata", fl_filename_name(name()), 0));
+ unique_id(this, "image", fltk3::filename_name(name()), 0),
+ unique_id(this, "idata", fltk3::filename_name(name()), 0));
} else if (img->d() == 0) {
// Write Bitmap data...
write_c("\n");
@@ -94,14 +94,14 @@
bitmap_header_written = write_number;
}
write_c("static unsigned char %s[] =\n",
- unique_id(this, "idata", fl_filename_name(name()), 0));
+ unique_id(this, "idata", fltk3::filename_name(name()), 0));
write_cdata(img->data()[0], ((img->w() + 7) / 8) * img->h());
write_c(";\n");
write_c("static fltk3::Bitmap %s(%s, %d, %d);\n",
- unique_id(this, "image", fl_filename_name(name()), 0),
- unique_id(this, "idata", fl_filename_name(name()), 0),
+ unique_id(this, "image", fltk3::filename_name(name()), 0),
+ unique_id(this, "idata", fltk3::filename_name(name()), 0),
img->w(), img->h());
- } else if (strcmp(fl_filename_ext(name()), ".jpg")==0) {
+ } else if (strcmp(fltk3::filename_ext(name()), ".jpg")==0) {
// Write jpeg image data...
write_c("\n");
if (jpeg_header_written != write_number) {
@@ -109,7 +109,7 @@
jpeg_header_written = write_number;
}
write_c("static unsigned char %s[] =\n",
- unique_id(this, "idata", fl_filename_name(name()), 0));
+ unique_id(this, "idata", fltk3::filename_name(name()), 0));
FILE *f = fltk3::fopen(name(), "rb");
if (!f) {
@@ -129,9 +129,9 @@
write_c(";\n");
write_c("static fltk3::JPEGImage %s(\"%s\", %s);\n",
- unique_id(this, "image", fl_filename_name(name()), 0),
- fl_filename_name(name()),
- unique_id(this, "idata", fl_filename_name(name()), 0));
+ unique_id(this, "image", fltk3::filename_name(name()), 0),
+ fltk3::filename_name(name()),
+ unique_id(this, "idata", fltk3::filename_name(name()), 0));
} else {
// Write image data...
write_c("\n");
@@ -140,12 +140,12 @@
image_header_written = write_number;
}
write_c("static unsigned char %s[] =\n",
- unique_id(this, "idata", fl_filename_name(name()), 0));
+ unique_id(this, "idata", fltk3::filename_name(name()), 0));
write_cdata(img->data()[0], (img->w() * img->d() + img->ld()) * img->h());
write_c(";\n");
write_c("static fltk3::RGBImage %s(%s, %d, %d, %d, %d);\n",
- unique_id(this, "image", fl_filename_name(name()), 0),
- unique_id(this, "idata", fl_filename_name(name()), 0),
+ unique_id(this, "image", fltk3::filename_name(name()), 0),
+ unique_id(this, "idata", fltk3::filename_name(name()), 0),
img->w(), img->h(), img->d(), img->ld());
}
}
@@ -153,7 +153,7 @@
void Fluid_Image::write_code(const char *var, int inactive) {
if (!img) return;
write_c("%s%s->%s(%s);\n", indent(), var, inactive ? "deimage" : "image",
- unique_id(this, "image", fl_filename_name(name()), 0));
+ unique_id(this, "image", fltk3::filename_name(name()), 0));
}
Modified: branches/branch-3.0/fluid/code.cxx
===================================================================
--- branches/branch-3.0/fluid/code.cxx 2011-05-24 20:00:56 UTC (rev 8736)
+++ branches/branch-3.0/fluid/code.cxx 2011-05-24 20:17:48 UTC (rev 8737)
@@ -387,7 +387,7 @@
fprintf(code_file, hdr, FL_VERSION);
{char define_name[102];
- const char* a = fl_filename_name(t);
+ const char* a = fltk3::filename_name(t);
char* b = define_name;
if (!isalpha(*a)) {*b++ = '_';}
while (*a) {*b++ = isalnum(*a) ? *a : '_'; a++;}
@@ -416,7 +416,7 @@
}
if (t && include_H_from_C) {
if (*header_file_name == '.' && strchr(header_file_name, '/') == NULL) {
- write_c("#include \"%s\"\n", fl_filename_name(t));
+ write_c("#include \"%s\"\n", fltk3::filename_name(t));
} else {
write_c("#include \"%s\"\n", t);
}
Modified: branches/branch-3.0/fluid/fluid.cxx
===================================================================
--- branches/branch-3.0/fluid/fluid.cxx 2011-05-24 20:00:56 UTC (rev 8736)
+++ branches/branch-3.0/fluid/fluid.cxx 2011-05-24 20:17:48 UTC (rev 8737)
@@ -130,7 +130,7 @@
void goto_source_dir() {
if (in_source_dir) return;
if (!filename || !*filename) return;
- const char *p = fl_filename_name(filename);
+ const char *p = fltk3::filename_name(filename);
if (p <= filename) return; // it is in the current directory
char buffer[FLTK3_PATH_MAX];
strlcpy(buffer, filename, sizeof(buffer));
@@ -661,17 +661,17 @@
}
char cname[FLTK3_PATH_MAX];
char hname[FLTK3_PATH_MAX];
- strlcpy(i18n_program, fl_filename_name(filename), sizeof(i18n_program));
- fl_filename_setext(i18n_program, sizeof(i18n_program), "");
+ strlcpy(i18n_program, fltk3::filename_name(filename), sizeof(i18n_program));
+ fltk3::filename_setext(i18n_program, sizeof(i18n_program), "");
if (*code_file_name == '.' && strchr(code_file_name, '/') == NULL) {
- strlcpy(cname, fl_filename_name(filename), sizeof(cname));
- fl_filename_setext(cname, sizeof(cname), code_file_name);
+ strlcpy(cname, fltk3::filename_name(filename), sizeof(cname));
+ fltk3::filename_setext(cname, sizeof(cname), code_file_name);
} else {
strlcpy(cname, code_file_name, sizeof(hname));
}
if (*header_file_name == '.' && strchr(header_file_name, '/') == NULL) {
- strlcpy(hname, fl_filename_name(filename), sizeof(hname));
- fl_filename_setext(hname, sizeof(hname), header_file_name);
+ strlcpy(hname, fltk3::filename_name(filename), sizeof(hname));
+ fltk3::filename_setext(hname, sizeof(hname), header_file_name);
} else {
strlcpy(hname, header_file_name, sizeof(hname));
}
@@ -698,8 +698,8 @@
if (!filename) return;
}
char sname[FLTK3_PATH_MAX];
- strlcpy(sname, fl_filename_name(filename), sizeof(sname));
- fl_filename_setext(sname, sizeof(sname), exts[i18n_type]);
+ strlcpy(sname, fltk3::filename_name(filename), sizeof(sname));
+ fltk3::filename_setext(sname, sizeof(sname), exts[i18n_type]);
if (!compile_only) goto_source_dir();
int x = write_strings(sname);
if (!compile_only) leave_source_dir();
@@ -906,14 +906,14 @@
"</body></html>"
);
} else if (strcmp(name, "license.html")==0) {
- fl_open_uri("http://www.fltk.org/doc-1.3/license.html");
+ fltk3::open_uri("http://www.fltk.org/doc-1.3/license.html");
return;
} else if (strcmp(name, "index.html")==0) {
- fl_open_uri("http://www.fltk.org/doc-1.3/index.html");
+ fltk3::open_uri("http://www.fltk.org/doc-1.3/index.html");
return;
} else {
snprintf(helpname, sizeof(helpname), "http://www.fltk.org/%s", name);
- fl_open_uri(helpname);
+ fltk3::open_uri(helpname);
return;
}
}
@@ -1857,7 +1857,7 @@
fluid_prefs.get( fltk3::Preferences::Name("file%d", i),
absolute_history[i], "", sizeof(absolute_history[i]));
if (absolute_history[i][0]) {
// Make a relative version of the filename for the menu...
- fl_filename_relative(relative_history[i], sizeof(relative_history[i]),
+ fltk3::filename_relative(relative_history[i],
sizeof(relative_history[i]),
absolute_history[i]);
if (i == 9) history_item[i].flags = fltk3::MENU_DIVIDER;
@@ -1881,7 +1881,7 @@
fluid_prefs.get("recent_files", max_files, 5);
if (max_files > 10) max_files = 10;
- fl_filename_absolute(absolute, sizeof(absolute), flname);
+ fltk3::filename_absolute(absolute, sizeof(absolute), flname);
for (i = 0; i < max_files; i ++)
#if defined(WIN32) || defined(__APPLE__)
@@ -1903,7 +1903,7 @@
// Put the new file at the top...
strlcpy(absolute_history[0], absolute, sizeof(absolute_history[0]));
- fl_filename_relative(relative_history[0], sizeof(relative_history[0]),
+ fltk3::filename_relative(relative_history[0], sizeof(relative_history[0]),
absolute_history[0]);
// Update the menu items as needed...
@@ -2225,8 +2225,8 @@
strlcat(sv_header_filename, "source_view_tmp.h", FLTK3_PATH_MAX);
}
- strlcpy(i18n_program, fl_filename_name(sv_source_filename),
sizeof(i18n_program));
- fl_filename_setext(i18n_program, sizeof(i18n_program), "");
+ strlcpy(i18n_program, fltk3::filename_name(sv_source_filename),
sizeof(i18n_program));
+ fltk3::filename_setext(i18n_program, sizeof(i18n_program), "");
const char *code_file_name_bak = code_file_name;
code_file_name = sv_source_filename;
const char *header_file_name_bak = header_file_name;
Modified: branches/branch-3.0/fluid/template_panel.cxx
===================================================================
--- branches/branch-3.0/fluid/template_panel.cxx 2011-05-24 20:00:56 UTC
(rev 8736)
+++ branches/branch-3.0/fluid/template_panel.cxx 2011-05-24 20:17:48 UTC
(rev 8737)
@@ -229,10 +229,10 @@
fluid_prefs.getUserdataPath(path, sizeof(path));
strlcat(path, "templates", sizeof(path));
- num_files = fl_filename_list(path, &files);
+ num_files = fltk3::filename_list(path, &files);
for (i = 0; i < num_files; i ++) {
- if (fl_filename_match(files[i]->d_name, "*.fl")) {
+ if (fltk3::filename_match(files[i]->d_name, "*.fl")) {
// Format the name as the filename with "_" replaced with " "
// and without the trailing ".fl"...
strlcpy(name, files[i]->d_name, sizeof(name));
Modified: branches/branch-3.0/src/Fl_File_Browser.cxx
===================================================================
--- branches/branch-3.0/src/Fl_File_Browser.cxx 2011-05-24 20:00:56 UTC (rev
8736)
+++ branches/branch-3.0/src/Fl_File_Browser.cxx 2011-05-24 20:17:48 UTC (rev
8737)
@@ -589,9 +589,9 @@
else if (filename[i] != '/' && filename[i] != '\\')
strlcat(filename, "/", sizeof(filename));
- num_files = fl_filename_list(filename, &files, sort);
+ num_files = fltk3::filename_list(filename, &files, sort);
#else
- num_files = fl_filename_list(directory_, &files, sort);
+ num_files = fltk3::filename_list(directory_, &files, sort);
#endif /* WIN32 || __EMX__ */
if (num_files <= 0)
@@ -604,11 +604,11 @@
icon = fltk3::FileIcon::find(filename);
if ((icon && icon->type() == fltk3::FileIcon::DIRECTORY) ||
- _fl_filename_isdir_quick(filename)) {
+ fltk3::_filename_isdir_quick(filename)) {
num_dirs ++;
insert(num_dirs, files[i]->d_name, icon);
} else if (filetype_ == FILES &&
- fl_filename_match(files[i]->d_name, pattern_)) {
+ fltk3::filename_match(files[i]->d_name, pattern_)) {
add(files[i]->d_name, icon);
}
}
Modified: branches/branch-3.0/src/Fl_File_Chooser2.cxx
===================================================================
--- branches/branch-3.0/src/Fl_File_Chooser2.cxx 2011-05-24 20:00:56 UTC
(rev 8736)
+++ branches/branch-3.0/src/Fl_File_Chooser2.cxx 2011-05-24 20:17:48 UTC
(rev 8737)
@@ -104,7 +104,7 @@
</TR>
<TR>
<TD>sort</TD>
- <TD>fl_numericsort</TD>
+ <TD>fltk3::numericsort</TD>
</TR>
</TABLE></CENTER>
@@ -140,7 +140,7 @@
pattern to the end of the string you pass if you do not provide
one. The first filter in the string is the default filter.
- See the FLTK documentation on fl_filename_match()
+ See the FLTK documentation on fltk3::filename_match()
for the kinds of pattern strings that are supported.
The type argument can be one of the following:
@@ -185,7 +185,7 @@
/** \fn void fltk3::FileChooser::filter(const char *pattern)
Sets or gets the current filename filter patterns. The filter
- patterns use fl_filename_match().
+ patterns use fltk3::filename_match().
Multiple patterns can be used by separating them with tabs, like
<tt>"*.jpg\t*.png\t*.gif\t*"</tt>. In addition, you can provide
human-readable labels with the patterns inside parenthesis, like
@@ -397,7 +397,7 @@
const char *fltk3::FileChooser::save_label = "Save";
const char *fltk3::FileChooser::show_label = "Show:";
const char *fltk3::FileChooser::hidden_label = "Show hidden files";
-fltk3::FileSortF *fltk3::FileChooser::sort = fl_numericsort;
+fltk3::FileSortF *fltk3::FileChooser::sort = fltk3::numericsort;
//
@@ -485,7 +485,7 @@
#else
if (d[0] != '/' && d[0] != '\\')
#endif /* WIN32 || __EMX__ */
- fl_filename_absolute(directory_, d);
+ fltk3::filename_absolute(directory_, d);
else
strlcpy(directory_, d, sizeof(directory_));
@@ -714,9 +714,9 @@
if (fltk3::event_clicks()) {
#if (defined(WIN32) && ! defined(__CYGWIN__)) || defined(__EMX__)
if ((strlen(pathname) == 2 && pathname[1] == ':') ||
- _fl_filename_isdir_quick(pathname))
+ fltk3::_filename_isdir_quick(pathname))
#else
- if (_fl_filename_isdir_quick(pathname))
+ if (fltk3::_filename_isdir_quick(pathname))
#endif /* WIN32 || __EMX__ */
{
// Change directories...
@@ -780,7 +780,7 @@
if (callback_) (*callback_)(this, data_);
// Activate the OK button as needed...
- if (!_fl_filename_isdir_quick(pathname) || (type_ & DIRECTORY))
+ if (!fltk3::_filename_isdir_quick(pathname) || (type_ & DIRECTORY))
okButton->activate();
else
okButton->deactivate();
@@ -819,7 +819,7 @@
// Expand ~ and $ variables as needed...
if (strchr(filename, '~') || strchr(filename, '$')) {
- fl_filename_expand(pathname, sizeof(pathname), filename);
+ fltk3::filename_expand(pathname, sizeof(pathname), filename);
filename = pathname;
value(pathname);
}
@@ -832,7 +832,7 @@
#else
if (directory_[0] != '\0' && filename[0] != '/') {
#endif /* WIN32 || __EMX__ */
- fl_filename_absolute(pathname, sizeof(pathname), filename);
+ fltk3::filename_absolute(pathname, sizeof(pathname), filename);
value(pathname);
fileName->mark(fileName->position()); // no selection after expansion
} else if (filename != pathname) {
@@ -847,15 +847,15 @@
// Enter pressed - select or change directory...
#if (defined(WIN32) && ! defined(__CYGWIN__)) || defined(__EMX__)
if ((isalpha(pathname[0] & 255) && pathname[1] == ':' && !pathname[2]) ||
- (_fl_filename_isdir_quick(pathname) &&
+ (fltk3::_filename_isdir_quick(pathname) &&
compare_dirnames(pathname, directory_))) {
#else
- if (_fl_filename_isdir_quick(pathname) &&
+ if (fltk3::_filename_isdir_quick(pathname) &&
compare_dirnames(pathname, directory_)) {
#endif /* WIN32 || __EMX__ */
directory(pathname);
} else if ((type_ & CREATE) || access(pathname, 0) == 0) {
- if (!_fl_filename_isdir_quick(pathname) || (type_ & DIRECTORY)) {
+ if (!fltk3::_filename_isdir_quick(pathname) || (type_ & DIRECTORY)) {
// Update the preview box...
update_preview();
@@ -976,7 +976,7 @@
// See if we need to enable the OK button...
if (((type_ & CREATE) || !access(fileName->value(), 0)) &&
- (!fl_filename_isdir(fileName->value()) || (type_ & DIRECTORY))) {
+ (!fltk3::filename_isdir(fileName->value()) || (type_ & DIRECTORY))) {
okButton->activate();
} else {
okButton->deactivate();
@@ -986,7 +986,7 @@
fileList->deselect(0);
fileList->redraw();
if (((type_ & CREATE) || !access(fileName->value(), 0)) &&
- (!fl_filename_isdir(fileName->value()) || (type_ & DIRECTORY))) {
+ (!fltk3::filename_isdir(fileName->value()) || (type_ & DIRECTORY))) {
okButton->activate();
} else {
okButton->deactivate();
@@ -1310,7 +1310,7 @@
if (filename == NULL) {
// no file name at all, so we have an empty preview
set = 1;
- } else if (fl_filename_isdir(filename)) {
+ } else if (fltk3::filename_isdir(filename)) {
// filename is a directory, show a folder icon
newlabel = "@fileopen";
set = 1;
@@ -1538,11 +1538,11 @@
#endif // WIN32
// See if there is a directory in there...
- fl_filename_absolute(pathname, sizeof(pathname), filename);
+ fltk3::filename_absolute(pathname, sizeof(pathname), filename);
if ((slash = strrchr(pathname, '/')) != NULL) {
// Yes, change the display to the directory...
- if (!fl_filename_isdir(pathname)) *slash++ = '\0';
+ if (!fltk3::filename_isdir(pathname)) *slash++ = '\0';
directory(pathname);
if (*slash == '/') slash = pathname;
Modified: branches/branch-3.0/src/Fl_File_Icon.cxx
===================================================================
--- branches/branch-3.0/src/Fl_File_Icon.cxx 2011-05-24 20:00:56 UTC (rev
8736)
+++ branches/branch-3.0/src/Fl_File_Icon.cxx 2011-05-24 20:17:48 UTC (rev
8737)
@@ -203,7 +203,7 @@
#ifdef WIN32
if (filename[strlen(filename) - 1] == '/')
filetype = DIRECTORY;
- else if (fl_filename_isdir(filename))
+ else if (fltk3::filename_isdir(filename))
filetype = DIRECTORY;
else
filetype = PLAIN;
@@ -233,14 +233,14 @@
}
// Look at the base name in the filename
- name = fl_filename_name(filename);
+ name = fltk3::filename_name(filename);
// Loop through the available file types and return any match that
// is found...
for (current = first_; current != (fltk3::FileIcon *)0; current =
current->next_)
if ((current->type_ == filetype || current->type_ == ANY) &&
- (fl_filename_match(filename, current->pattern_) ||
- fl_filename_match(name, current->pattern_)))
+ (fltk3::filename_match(filename, current->pattern_) ||
+ fltk3::filename_match(name, current->pattern_)))
break;
// Return the match (if any)...
Modified: branches/branch-3.0/src/Fl_File_Icon2.cxx
===================================================================
--- branches/branch-3.0/src/Fl_File_Icon2.cxx 2011-05-24 20:00:56 UTC (rev
8736)
+++ branches/branch-3.0/src/Fl_File_Icon2.cxx 2011-05-24 20:17:48 UTC (rev
8737)
@@ -109,7 +109,7 @@
const char *ext; // File extension
- ext = fl_filename_ext(f);
+ ext = fltk3::filename_ext(f);
if (ext && strcmp(ext, ".fti") == 0)
i = load_fti(f);
@@ -815,13 +815,13 @@
entries = (dirent **)0;
- n = fl_filename_list(directory, &entries);
+ n = fltk3::filename_list(directory, &entries);
for (i = 0; i < n; i ++) {
if (entries[i]->d_name[0] != '.') {
snprintf(full, sizeof(full), "%s/%s", directory, entries[i]->d_name);
- if (fl_filename_isdir(full)) load_kde_icons(full, icondir);
+ if (fltk3::filename_isdir(full)) load_kde_icons(full, icondir);
else load_kde_mimelnk(full, icondir);
}
Modified: branches/branch-3.0/src/Fl_Help_View.cxx
===================================================================
--- branches/branch-3.0/src/Fl_Help_View.cxx 2011-05-24 20:00:56 UTC (rev
8736)
+++ branches/branch-3.0/src/Fl_Help_View.cxx 2011-05-24 20:17:48 UTC (rev
8737)
@@ -62,7 +62,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <fltk3/utf8.h>
-#include <fltk3/filename.h> // fl_open_uri()
+#include <fltk3/filename.h> // fltk3::open_uri()
#include "flstring.h"
#include <ctype.h>
#include <errno.h>
@@ -3126,7 +3126,7 @@
strncmp(f, "mailto:", 7) == 0 ||
strncmp(f, "news:", 5) == 0) {
char urimsg[FLTK3_PATH_MAX];
- if ( fl_open_uri(f, urimsg, sizeof(urimsg)) == 0 ) {
+ if ( fltk3::open_uri(f, urimsg, sizeof(urimsg)) == 0 ) {
clear_selection();
strlcpy(newname, f, sizeof(newname));
Modified: branches/branch-3.0/src/Fl_Native_File_Chooser_MAC.mm
===================================================================
--- branches/branch-3.0/src/Fl_Native_File_Chooser_MAC.mm 2011-05-24
20:00:56 UTC (rev 8736)
+++ branches/branch-3.0/src/Fl_Native_File_Chooser_MAC.mm 2011-05-24
20:17:48 UTC (rev 8737)
@@ -408,8 +408,8 @@
{
if ( [nspopup indexOfSelectedItem] == [nspopup numberOfItems] - 1) return
YES;
const char *pathname = [filename fileSystemRepresentation];
- if ( fl_filename_isdir(pathname) ) return YES;
- if ( fl_filename_match(pathname, filter_pattern[ [nspopup
indexOfSelectedItem] ]) ) return YES;
+ if ( fltk3::filename_isdir(pathname) ) return YES;
+ if ( fltk3::filename_match(pathname, filter_pattern[ [nspopup
indexOfSelectedItem] ]) ) return YES;
return NO;
}
@end
Modified: branches/branch-3.0/src/Fl_Preferences.cxx
===================================================================
--- branches/branch-3.0/src/Fl_Preferences.cxx 2011-05-24 20:00:56 UTC (rev
8736)
+++ branches/branch-3.0/src/Fl_Preferences.cxx 2011-05-24 20:17:48 UTC (rev
8737)
@@ -1786,10 +1786,10 @@
*/
int fltk3::PluginManager::loadAll(const char *filepath, const char *pattern) {
struct dirent **dir;
- int i, n = fl_filename_list(filepath, &dir);
+ int i, n = fltk3::filename_list(filepath, &dir);
for (i=0; i<n; i++) {
struct dirent *e = dir[i];
- if (pattern==0 || fl_filename_match(e->d_name, pattern)) {
+ if (pattern==0 || fltk3::filename_match(e->d_name, pattern)) {
load(fltk3::Preferences::Name("%s%s", filepath, e->d_name));
}
free(e);
Modified: branches/branch-3.0/src/Fl_arg.cxx
===================================================================
--- branches/branch-3.0/src/Fl_arg.cxx 2011-05-24 20:00:56 UTC (rev 8736)
+++ branches/branch-3.0/src/Fl_arg.cxx 2011-05-24 20:17:48 UTC (rev 8737)
@@ -347,7 +347,7 @@
// set the class, which is used by X version of get_system_colors:
if (name) {xclass(name); name = 0;}
- else if (!xclass()) xclass(fl_filename_name(argv[0]));
+ else if (!xclass()) xclass(fltk3::filename_name(argv[0]));
if (title) {label(title); title = 0;}
else if (!label()) label(xclass());
Modified: branches/branch-3.0/src/Fl_cocoa.mm
===================================================================
--- branches/branch-3.0/src/Fl_cocoa.mm 2011-05-24 20:00:56 UTC (rev 8736)
+++ branches/branch-3.0/src/Fl_cocoa.mm 2011-05-24 20:17:48 UTC (rev 8737)
@@ -47,6 +47,7 @@
#include <fltk3/run.h>
+#include <fltk3/filename.h>
#include <fltk3/x.h>
#include <fltk3/Window.h>
#include <fltk3/Tooltip.h>
@@ -2195,7 +2196,7 @@
/*
* returns pointer to the filename, or null if name ends with ':'
*/
-const char *fl_filename_name( const char *name )
+const char *fltk3::filename_name( const char *name )
{
const char *p, *q;
if (!name) return (0);
Modified: branches/branch-3.0/src/Fl_mac.cxx
===================================================================
--- branches/branch-3.0/src/Fl_mac.cxx 2011-05-24 20:00:56 UTC (rev 8736)
+++ branches/branch-3.0/src/Fl_mac.cxx 2011-05-24 20:17:48 UTC (rev 8737)
@@ -2336,7 +2336,7 @@
/**
* returns pointer to the filename, or null if name ends with ':'
*/
-const char *fl_filename_name( const char *name )
+const char *fltk3::filename_name( const char *name )
{
const char *p, *q;
if (!name) return (0);
Modified: branches/branch-3.0/src/Fl_win32.cxx
===================================================================
--- branches/branch-3.0/src/Fl_win32.cxx 2011-05-24 20:00:56 UTC (rev
8736)
+++ branches/branch-3.0/src/Fl_win32.cxx 2011-05-24 20:17:48 UTC (rev
8737)
@@ -1728,10 +1728,10 @@
////////////////////////////////////////////////////////////////
-#include <fltk3/filename.h> // need so FLTK3_EXPORT fl_filename_name works
+#include <fltk3/filename.h> // need so FLTK3_EXPORT fltk3::filename_name works
// returns pointer to the filename, or null if name ends with '/'
-const char *fl_filename_name(const char *name) {
+const char *fltk3::filename_name(const char *name) {
const char *p,*q;
if (!name) return (0);
q = name;
Modified: branches/branch-3.0/src/Fl_x.cxx
===================================================================
--- branches/branch-3.0/src/Fl_x.cxx 2011-05-24 20:00:56 UTC (rev 8736)
+++ branches/branch-3.0/src/Fl_x.cxx 2011-05-24 20:17:48 UTC (rev 8737)
@@ -1821,7 +1821,7 @@
////////////////////////////////////////////////////////////////
// returns pointer to the filename, or null if name ends with '/'
-const char *fl_filename_name(const char *name) {
+const char *fltk3::filename_name(const char *name) {
const char *p,*q;
if (!name) return (0);
for (p=q=name; *p;) if (*p++ == '/') q = p;
@@ -1834,7 +1834,7 @@
if (shown() && !parent()) {
if (!name) name = "";
int namelen = strlen(name);
- if (!iname) iname = fl_filename_name(name);
+ if (!iname) iname = fltk3::filename_name(name);
int inamelen = strlen(iname);
XChangeProperty(fl_display, i->xid, fl_NET_WM_NAME, fl_XaUtf8String,
8, 0, (uchar*)name, namelen); // utf8
XChangeProperty(fl_display, i->xid, XA_WM_NAME, XA_STRING,
8, 0, (uchar*)name, namelen); // non-utf8
Modified: branches/branch-3.0/src/filename_absolute.cxx
===================================================================
--- branches/branch-3.0/src/filename_absolute.cxx 2011-05-24 20:00:56 UTC
(rev 8736)
+++ branches/branch-3.0/src/filename_absolute.cxx 2011-05-24 20:17:48 UTC
(rev 8737)
@@ -53,16 +53,16 @@
#include <fltk3/filename.h>
[..]
chdir("/var/tmp");
- fl_filename_absolute(out, sizeof(out), "foo.txt"); //
out="/var/tmp/foo.txt"
- fl_filename_absolute(out, sizeof(out), "./foo.txt"); //
out="/var/tmp/foo.txt"
- fl_filename_absolute(out, sizeof(out), "../log/messages"); //
out="/var/log/messages"
+ fltk3::filename_absolute(out, sizeof(out), "foo.txt"); //
out="/var/tmp/foo.txt"
+ fltk3::filename_absolute(out, sizeof(out), "./foo.txt"); //
out="/var/tmp/foo.txt"
+ fltk3::filename_absolute(out, sizeof(out), "../log/messages"); //
out="/var/log/messages"
\endcode
\param[out] to resulting absolute filename
\param[in] tolen size of the absolute filename buffer
\param[in] from relative filename
\return 0 if no change, non zero otherwise
*/
-int fl_filename_absolute(char *to, int tolen, const char *from) {
+int fltk3::filename_absolute(char *to, int tolen, const char *from) {
if (isdirsep(*from) || *from == '|'
#if defined(WIN32) || defined(__EMX__) && !defined(__CYGWIN__)
|| from[1]==':'
@@ -122,11 +122,11 @@
chdir("/var/tmp/somedir"); // set cwd to /var/tmp/somedir
[..]
char out[FLTK3_PATH_MAX];
- fl_filename_relative(out, sizeof(out), "/var/tmp/somedir/foo.txt"); //
out="foo.txt", return=1
- fl_filename_relative(out, sizeof(out), "/var/tmp/foo.txt"); //
out="../foo.txt", return=1
- fl_filename_relative(out, sizeof(out), "foo.txt"); //
out="foo.txt", return=0 (no change)
- fl_filename_relative(out, sizeof(out), "./foo.txt"); //
out="./foo.txt", return=0 (no change)
- fl_filename_relative(out, sizeof(out), "../foo.txt"); //
out="../foo.txt", return=0 (no change)
+ fltk3::filename_relative(out, sizeof(out), "/var/tmp/somedir/foo.txt");
// out="foo.txt", return=1
+ fltk3::filename_relative(out, sizeof(out), "/var/tmp/foo.txt");
// out="../foo.txt", return=1
+ fltk3::filename_relative(out, sizeof(out), "foo.txt");
// out="foo.txt", return=0 (no change)
+ fltk3::filename_relative(out, sizeof(out), "./foo.txt");
// out="./foo.txt", return=0 (no change)
+ fltk3::filename_relative(out, sizeof(out), "../foo.txt");
// out="../foo.txt", return=0 (no change)
\endcode
\param[out] to resulting relative filename
\param[in] tolen size of the relative filename buffer
@@ -134,7 +134,7 @@
\return 0 if no change, non zero otherwise
*/
int // O - 0 if no change, 1 if changed
-fl_filename_relative(char *to, // O - Relative filename
+fltk3::filename_relative(char *to, // O - Relative filename
int tolen, // I - Size of "to" buffer
const char *from) // I - Absolute filename
{
@@ -144,7 +144,7 @@
strlcpy(to, from, tolen);
return 0;
}
- return fl_filename_relative(to, tolen, from, cwd_buf);
+ return fltk3::filename_relative(to, tolen, from, cwd_buf);
}
@@ -156,7 +156,7 @@
\return 0 if no change, non zero otherwise
*/
int // O - 0 if no change, 1 if changed
-fl_filename_relative(char *to, // O - Relative filename
+fltk3::filename_relative(char *to, // O - Relative filename
int tolen, // I - Size of "to" buffer
const char *from, // I - Absolute filename
const char *base) { // I - Find path relative to this path
Modified: branches/branch-3.0/src/filename_expand.cxx
===================================================================
--- branches/branch-3.0/src/filename_expand.cxx 2011-05-24 20:00:56 UTC (rev
8736)
+++ branches/branch-3.0/src/filename_expand.cxx 2011-05-24 20:17:48 UTC (rev
8737)
@@ -60,16 +60,16 @@
#include <fltk3/filename.h>
[..]
putenv("TMPDIR=/var/tmp");
- fl_filename_expand(out, sizeof(out), "~fred/.cshrc"); //
out="/usr/fred/.cshrc"
- fl_filename_expand(out, sizeof(out), "~/.cshrc"); //
out="/usr/<yourname>/.cshrc"
- fl_filename_expand(out, sizeof(out), "$TMPDIR/foo.txt"); //
out="/var/tmp/foo.txt"
+ fltk3::filename_expand(out, sizeof(out), "~fred/.cshrc"); //
out="/usr/fred/.cshrc"
+ fltk3::filename_expand(out, sizeof(out), "~/.cshrc"); //
out="/usr/<yourname>/.cshrc"
+ fltk3::filename_expand(out, sizeof(out), "$TMPDIR/foo.txt"); //
out="/var/tmp/foo.txt"
\endcode
\param[out] to resulting expanded filename
\param[in] tolen size of the expanded filename buffer
\param[in] from filename containing shell variables
\return 0 if no change, non zero otherwise
*/
-int fl_filename_expand(char *to,int tolen, const char *from) {
+int fltk3::filename_expand(char *to,int tolen, const char *from) {
char *temp = new char[tolen];
strlcpy(temp,from, tolen);
Modified: branches/branch-3.0/src/filename_ext.cxx
===================================================================
--- branches/branch-3.0/src/filename_ext.cxx 2011-05-24 20:00:56 UTC (rev
8736)
+++ branches/branch-3.0/src/filename_ext.cxx 2011-05-24 20:17:48 UTC (rev
8737)
@@ -34,13 +34,13 @@
#include <fltk3/filename.h>
[..]
const char *out;
- out = fl_filename_ext("/some/path/foo.txt"); // result: ".txt"
- out = fl_filename_ext("/some/path/foo"); // result: NULL
+ out = fltk3::filename_ext("/some/path/foo.txt"); // result: ".txt"
+ out = fltk3::filename_ext("/some/path/foo"); // result: NULL
\endcode
\param[in] buf the filename to be parsed
\return a pointer to the extension (including '.') if any or NULL otherwise
*/
-const char *fl_filename_ext(const char *buf) {
+const char *fltk3::filename_ext(const char *buf) {
const char *q = 0;
const char *p = buf;
for (p=buf; *p; p++) {
Modified: branches/branch-3.0/src/filename_isdir.cxx
===================================================================
--- branches/branch-3.0/src/filename_isdir.cxx 2011-05-24 20:00:56 UTC (rev
8736)
+++ branches/branch-3.0/src/filename_isdir.cxx 2011-05-24 20:17:48 UTC (rev
8737)
@@ -41,10 +41,10 @@
#define isdirsep(c) ((c)=='/')
#endif
-int _fl_filename_isdir_quick(const char* n) {
+int fltk3::_filename_isdir_quick(const char* n) {
// Do a quick optimization for filenames with a trailing slash...
if (*n && isdirsep(n[strlen(n) - 1])) return 1;
- return fl_filename_isdir(n);
+ return fltk3::filename_isdir(n);
}
/**
@@ -52,13 +52,13 @@
\code
#include <fltk3/filename.h>
[..]
- fl_filename_isdir("/etc"); // returns non-zero
- fl_filename_isdir("/etc/hosts"); // returns 0
+ fltk3::filename_isdir("/etc"); // returns non-zero
+ fltk3::filename_isdir("/etc/hosts"); // returns 0
\endcode
\param[in] n the filename to parse
\return non zero if file exists and is a directory, zero otherwise
*/
-int fl_filename_isdir(const char* n) {
+int fltk3::filename_isdir(const char* n) {
struct stat s;
char fn[FLTK3_PATH_MAX];
int length;
Modified: branches/branch-3.0/src/filename_list.cxx
===================================================================
--- branches/branch-3.0/src/filename_list.cxx 2011-05-24 20:00:56 UTC (rev
8736)
+++ branches/branch-3.0/src/filename_list.cxx 2011-05-24 20:17:48 UTC (rev
8737)
@@ -41,11 +41,11 @@
#endif
}
-int fl_alphasort(struct dirent **a, struct dirent **b) {
+int fltk3::alphasort(struct dirent **a, struct dirent **b) {
return strcmp((*a)->d_name, (*b)->d_name);
}
-int fl_casealphasort(struct dirent **a, struct dirent **b) {
+int fltk3::casealphasort(struct dirent **a, struct dirent **b) {
return strcasecmp((*a)->d_name, (*b)->d_name);
}
@@ -67,19 +67,19 @@
\param[in] d the name of the directory to list. It does not matter if it
has a trailing slash.
\param[out] list table containing the resulting directory listing
\param[in] sort sorting functor:
- - fl_alphasort: The files are sorted in ascending alphabetical order;
+ - fltk3::alphasort: The files are sorted in ascending alphabetical order;
upper and lowercase letters are compared according to their ASCII
ordering uppercase before lowercase.
- - fl_casealphasort: The files are sorted in ascending alphabetical order;
+ - fltk3::casealphasort: The files are sorted in ascending alphabetical
order;
upper and lowercase letters are compared equally case is not
significant.
- - fl_casenumericsort: The files are sorted in ascending "alphanumeric"
order, where an attempt is made
+ - fltk3::casenumericsort: The files are sorted in ascending "alphanumeric"
order, where an attempt is made
to put unpadded numbers in consecutive order; upper and lowercase
letters
are compared equally case is not significant.
- - fl_numericsort: The files are sorted in ascending "alphanumeric" order,
where an attempt is made
+ - fltk3::numericsort: The files are sorted in ascending "alphanumeric"
order, where an attempt is made
to put unpadded numbers in consecutive order; upper and lowercase
letters are compared
according to their ASCII ordering - uppercase before lowercase.
\return the number of entries if no error, a negative value otherwise.
*/
-int fl_filename_list(const char *d, dirent ***list,
+int fltk3::filename_list(const char *d, dirent ***list,
fltk3::FileSortF *sort) {
#if defined(WIN32) && !defined(__CYGWIN__) && !defined(HAVE_SCANDIR)
// For Windows we have a special scandir implementation that uses
@@ -161,7 +161,7 @@
if (de->d_name[len-1]!='/' && len<=FLTK3_PATH_MAX) {
// Use memcpy for speed since we already know the length of the string...
memcpy(name, de->d_name, len+1);
- if (fl_filename_isdir(fullname)) {
+ if (fltk3::filename_isdir(fullname)) {
char *dst = newde->d_name + newlen;
*dst++ = '/';
*dst = 0;
@@ -179,15 +179,15 @@
}
/**
- \brief Free the list of filenames that is generated by fl_filename_list().
+ \brief Free the list of filenames that is generated by fltk3::filename_list().
- Free everything that was allocated by a previous call to fl_filename_list().
+ Free everything that was allocated by a previous call to
fltk3::filename_list().
Use the return values as parameters for this function.
\param[in,out] list table containing the resulting directory listing
\param[in] n number of entries in the list
*/
-void fl_filename_free_list(struct dirent ***list, int n)
+void fltk3::filename_free_list(struct dirent ***list, int n)
{
if (n<0) return;
Modified: branches/branch-3.0/src/filename_match.cxx
===================================================================
--- branches/branch-3.0/src/filename_match.cxx 2011-05-24 20:00:56 UTC (rev
8736)
+++ branches/branch-3.0/src/filename_match.cxx 2011-05-24 20:17:48 UTC (rev
8737)
@@ -50,7 +50,7 @@
\param[in] p the string pattern
\return non zero if the string matches the pattern
*/
-int fl_filename_match(const char *s, const char *p) {
+int fltk3::filename_match(const char *s, const char *p) {
int matched;
for (;;) {
@@ -62,7 +62,7 @@
case '*' : // match 0-n of any characters
if (!*p) return 1; // do trailing * quickly
- while (!fl_filename_match(s, p)) if (!*s++) return 0;
+ while (!fltk3::filename_match(s, p)) if (!*s++) return 0;
return 1;
case '[': { // match one character in set of form [abc-d] or [^a-b]
@@ -86,7 +86,7 @@
case '{' : // {pattern1|pattern2|pattern3}
NEXTCASE:
- if (fl_filename_match(s,p)) return 1;
+ if (fltk3::filename_match(s,p)) return 1;
for (matched = 0;;) {
switch (*p++) {
case '\\': if (*p) p++; break;
Modified: branches/branch-3.0/src/filename_setext.cxx
===================================================================
--- branches/branch-3.0/src/filename_setext.cxx 2011-05-24 20:00:56 UTC (rev
8736)
+++ branches/branch-3.0/src/filename_setext.cxx 2011-05-24 20:17:48 UTC (rev
8737)
@@ -41,13 +41,13 @@
#include <fltk3/filename.h>
[..]
char buf[FLTK3_PATH_MAX] = "/path/myfile.cxx";
- fl_filename_setext(buf, sizeof(buf), ".txt"); // buf[] becomes
"/path/myfile.txt"
+ fltk3::filename_setext(buf, sizeof(buf), ".txt"); // buf[] becomes
"/path/myfile.txt"
\endcode
\return buf itself for calling convenience.
*/
-char *fl_filename_setext(char *buf, int buflen, const char *ext) {
- char *q = (char *)fl_filename_ext(buf);
+char *fltk3::filename_setext(char *buf, int buflen, const char *ext) {
+ char *q = (char *)fltk3::filename_ext(buf);
if (ext) {
strlcpy(q,ext,buflen - (q - buf));
} else *q = 0;
Modified: branches/branch-3.0/src/fl_file_dir.cxx
===================================================================
--- branches/branch-3.0/src/fl_file_dir.cxx 2011-05-24 20:00:56 UTC (rev
8736)
+++ branches/branch-3.0/src/fl_file_dir.cxx 2011-05-24 20:17:48 UTC (rev
8737)
@@ -129,7 +129,7 @@
strlcpy(retname, fc->value(), sizeof(retname));
else
*retname = 0;
- const char *n = fl_filename_name(retname);
+ const char *n = fltk3::filename_name(retname);
if (n) *((char*)n) = 0;
fc->value("");
fc->directory(retname);
@@ -145,7 +145,7 @@
fltk3::wait();
if (fc->value() && relative) {
- fl_filename_relative(retname, sizeof(retname), fc->value());
+ fltk3::filename_relative(retname, sizeof(retname), fc->value());
return retname;
} else if (fc->value()) return (char *)fc->value();
@@ -186,7 +186,7 @@
fltk3::wait();
if (fc->value() && relative) {
- fl_filename_relative(retname, sizeof(retname), fc->value());
+ fltk3::filename_relative(retname, sizeof(retname), fc->value());
return retname;
} else if (fc->value()) return (char *)fc->value();
Modified: branches/branch-3.0/src/fl_open_uri.cxx
===================================================================
--- branches/branch-3.0/src/fl_open_uri.cxx 2011-05-24 20:00:56 UTC (rev
8736)
+++ branches/branch-3.0/src/fl_open_uri.cxx 2011-05-24 20:17:48 UTC (rev
8737)
@@ -1,11 +1,11 @@
//
// "$Id$"
//
-// fl_open_uri() code for FLTK.
+// fltk3::open_uri() code for FLTK.
//
// Test with:
//
-// gcc -I/fltk/dir -I/fltk/dir/src -DTEST -o fl_open_uri fl_open_uri.cxx
-lfltk
+// gcc -I/fltk/dir -I/fltk/dir/src -DTEST -o fltk3::open_uri
fltk3::open_uri.cxx -lfltk
//
// Copyright 2003-2010 by Michael R Sweet
//
@@ -78,7 +78,7 @@
* #include <fltk3/filename.h>
* [..]
* char errmsg[512];
- * if ( !fl_open_uri("http://google.com/", errmsg, sizeof(errmsg)) ) {
+ * if ( !fltk3::open_uri("http://google.com/", errmsg, sizeof(errmsg)) ) {
* char warnmsg[768];
* sprintf(warnmsg, "Error: %s", errmsg);
* fltk3::alert(warnmsg);
@@ -92,7 +92,7 @@
*/
int
-fl_open_uri(const char *uri, char *msg, int msglen) {
+fltk3::open_uri(const char *uri, char *msg, int msglen) {
// Supported URI schemes...
static const char * const schemes[] = {
"file://",
@@ -366,11 +366,11 @@
if (argc != 2) {
- puts("Usage: fl_open_uri URI");
+ puts("Usage: fltk3::open_uri URI");
return 1;
}
- if (!fl_open_uri(argv[1], msg, sizeof(msg))) {
+ if (!fltk3::open_uri(argv[1], msg, sizeof(msg))) {
puts(msg);
return 1;
} else return 0;
Modified: branches/branch-3.0/src/forms_fselect.cxx
===================================================================
--- branches/branch-3.0/src/forms_fselect.cxx 2011-05-24 20:00:56 UTC (rev
8736)
+++ branches/branch-3.0/src/forms_fselect.cxx 2011-05-24 20:17:48 UTC (rev
8737)
@@ -49,7 +49,7 @@
const char *q = fltk3::file_chooser(message,fl_pattern,fl_directory);
if (!q) return 0;
strlcpy(fl_directory, q, sizeof(fl_directory));
- p = (char *)fl_filename_name(fl_directory);
+ p = (char *)fltk3::filename_name(fl_directory);
strlcpy(fl_filename, p, sizeof(fl_filename));
if (p > fl_directory+1) p--;
*p = 0;
Modified: branches/branch-3.0/src/numericsort.cxx
===================================================================
--- branches/branch-3.0/src/numericsort.cxx 2011-05-24 20:00:56 UTC (rev
8736)
+++ branches/branch-3.0/src/numericsort.cxx 2011-05-24 20:17:48 UTC (rev
8737)
@@ -57,7 +57,7 @@
* a case-insensitive comparison...
*/
-static int numericsort(struct dirent **A, struct dirent **B, int cs) {
+static int pNumericsort(struct dirent **A, struct dirent **B, int cs) {
const char* a = (*A)->d_name;
const char* b = (*B)->d_name;
int ret = 0;
@@ -91,19 +91,19 @@
}
/*
- * 'fl_casenumericsort()' - Compare directory entries with case-sensitivity.
+ * 'fltk3::casenumericsort()' - Compare directory entries with
case-sensitivity.
*/
-extern "C" int fl_casenumericsort(struct dirent **A, struct dirent **B) {
- return numericsort(A, B, 0);
+int fltk3::casenumericsort(struct dirent **A, struct dirent **B) {
+ return pNumericsort(A, B, 0);
}
/*
- * 'fl_numericsort()' - Compare directory entries with case-sensitivity.
+ * 'fltk3::numericsort()' - Compare directory entries with case-sensitivity.
*/
-extern "C" int fl_numericsort(struct dirent **A, struct dirent **B) {
- return numericsort(A, B, 1);
+int fltk3::numericsort(struct dirent **A, struct dirent **B) {
+ return pNumericsort(A, B, 1);
}
/*
Modified: branches/branch-3.0/test/demo.cxx
===================================================================
--- branches/branch-3.0/test/demo.cxx 2011-05-24 20:00:56 UTC (rev 8736)
+++ branches/branch-3.0/test/demo.cxx 2011-05-24 20:17:48 UTC (rev 8737)
@@ -304,10 +304,10 @@
if (arg) {
*arg = 0;
if (strcmp(cmd, "../fluid/fluid")==0) {
- fl_filename_absolute(path, 2048, "../../../../test/");
+ fltk3::filename_absolute(path, 2048, "../../../../test/");
sprintf(command, "open Fluid.app --args %s%s", path, arg+1);
} else {
- fl_filename_absolute(path, 2048, "../../../../test/");
+ fltk3::filename_absolute(path, 2048, "../../../../test/");
sprintf(command, "open %s.app --args %s%s", cmd, path, arg+1);
}
} else {
@@ -404,7 +404,7 @@
fltk3::filename_setext( buf, "" );
buf[ strlen(buf)-1 ] = 0;
#endif
- fl_filename_setext(buf,".menu");
+ fltk3::filename_setext(buf,".menu");
const char *fname = buf;
int i = 0;
if (!fltk3::args(argc,argv,i) || i < argc-1)
@@ -416,7 +416,7 @@
if (!load_the_menu(fname)) fltk3::fatal("Can't open %s",fname);
if (buf!=fname)
strcpy(buf,fname);
- const char *c = fl_filename_name(buf);
+ const char *c = fltk3::filename_name(buf);
if (c > buf) {
buf[c-buf] = 0;
if (chdir(buf)==-1) { /* ignore */ }
Modified: branches/branch-3.0/test/file_chooser.cxx
===================================================================
--- branches/branch-3.0/test/file_chooser.cxx 2011-05-24 20:00:56 UTC (rev
8736)
+++ branches/branch-3.0/test/file_chooser.cxx 2011-05-24 20:17:48 UTC (rev
8737)
@@ -374,7 +374,7 @@
if (!fc->value(i))
break;
- fl_filename_relative(relative, sizeof(relative), fc->value(i));
+ fltk3::filename_relative(relative, sizeof(relative), fc->value(i));
files->add(relative,
fltk3::FileIcon::find(fc->value(i), fltk3::FileIcon::PLAIN));
Modified: branches/branch-3.0/test/pixmap_browser.cxx
===================================================================
--- branches/branch-3.0/test/pixmap_browser.cxx 2011-05-24 20:00:56 UTC (rev
8736)
+++ branches/branch-3.0/test/pixmap_browser.cxx 2011-05-24 20:17:48 UTC (rev
8737)
@@ -47,7 +47,7 @@
img->release();
img = 0L;
}
- if (fl_filename_isdir(n)) {
+ if (fltk3::filename_isdir(n)) {
b->label("@fileopen"); // show a generic folder
b->labelsize(64);
b->labelcolor(fltk3::LIGHT2);
_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit