fltk
1.3.5-source
About: FLTK (Fast Light Tool Kit) is a cross-platform C++ GUI toolkit for UNIX/Linux (X11), Microsoft Windows, and MacOS X. Fossies Dox: fltk-1.3.5-source.tar.bz2 ("inofficial" and yet experimental doxygen-generated source code documentation) 
|
Go to the documentation of this file. 357 #include <sys/types.h> 358 #include <sys/stat.h> 360 #if defined(WIN32) && ! defined (__CYGWIN__) 365 # define access _access 366 # define mkdir _mkdir 447 if (fcount)
return fcount;
473 if (strchr(d,
'\\')) {
475 strlcpy(fixpath, d,
sizeof(fixpath));
477 for (slash = strchr(fixpath,
'\\'); slash; slash = strchr(slash + 1,
'\\'))
487 #if (defined(WIN32) && ! defined(__CYGWIN__))|| defined(__EMX__) 488 if (d[0] !=
'/' && d[0] !=
'\\' && d[1] !=
':')
490 if (d[0] !=
'/' && d[0] !=
'\\')
498 if ((*dirptr ==
'/' || *dirptr ==
'\\') && dirptr >
directory_)
503 if (dirptr >=
directory_ && strcmp(dirptr,
"/..") == 0) {
507 if (*dirptr ==
'/')
break;
513 }
else if ((dirptr + 1) >=
directory_ && strcmp(dirptr + 1,
"/.") == 0) {
547 sprintf(menuname,
"favorite%02d", v);
589 for (i = 0; i < 100; i ++) {
591 sprintf(
name,
"favorite%02d", i);
596 if (!pathname[0])
break;
670 sprintf(
name,
"favorite%02d", i);
676 for (; i < 100; i ++) {
678 sprintf(
name,
"favorite%02d", i);
719 #if (defined(WIN32) && ! defined(__CYGWIN__)) || defined(__EMX__) 720 if ((strlen(pathname) == 2 && pathname[1] ==
':') ||
746 filename = pathname + strlen(pathname) - 1;
761 temp += strlen(temp) - 1;
762 if (*temp ==
'/')
break;
766 if (i <= fileList->size()) {
832 #if (defined(WIN32) && !defined(__CYGWIN__)) || defined(__EMX__) 852 #if (defined(WIN32) && ! defined(__CYGWIN__)) || defined(__EMX__) 853 if ((isalpha(pathname[0] & 255) && pathname[1] ==
':' && !pathname[2]) ||
861 }
else if ((
type_ &
CREATE) || access(pathname, 0) == 0) {
880 if ((slash = strrchr(pathname,
'/')) ==
NULL)
881 slash = strrchr(pathname,
'\\');
889 #if defined(WIN32) || defined(__EMX__) 895 #endif // WIN32 || __EMX__ 906 strlcpy(pathname, tempname,
sizeof(pathname));
915 max_match = min_match + 1;
918 for (i = 1; i <= num_files && max_match > min_match; i ++) {
921 #if (defined(WIN32) && ! defined(__CYGWIN__)) || defined(__EMX__) 922 if (strncasecmp(
filename, file, min_match) == 0) {
924 if (strncmp(
filename, file, min_match) == 0) {
925 #endif // WIN32 || __EMX__ 929 strlcpy(matchname, file,
sizeof(matchname));
930 max_match = (int) strlen(matchname);
933 if (matchname[max_match - 1] ==
'/') {
935 matchname[max_match] =
'\0';
943 while (max_match > min_match)
944 #if (defined(WIN32) && ! defined(__CYGWIN__)) || defined(__EMX__) 945 if (strncasecmp(file, matchname, max_match) == 0)
947 if (strncmp(file, matchname, max_match) == 0)
948 #endif // WIN32 || __EMX__ 954 matchname[max_match] =
'\0';
960 if (first_line > 0 && min_match == max_match &&
966 }
else if (max_match > min_match && first_line) {
970 (
int) (
filename - pathname + min_match),
977 (
int) (
filename - pathname + max_match),
978 (
int) (
filename - pathname + min_match));
979 }
else if (max_match == 0) {
1020 if (!
p || !*
p)
p =
"*";
1029 end = strchr(
start,
'\t');
1030 if (end) *end++ =
'\0';
1032 if (strcmp(
start,
"*") == 0) {
1038 if (strstr(
start,
"(*)") !=
NULL) allfiles = 1;
1069 #if (defined(WIN32) && ! defined (__CYGWIN__)) || defined(__EMX__) 1070 if (
dir[0] !=
'/' &&
dir[0] !=
'\\' &&
dir[1] !=
':')
1072 if (
dir[0] !=
'/' &&
dir[0] !=
'\\')
1079 #if defined(WIN32) && ! defined (__CYGWIN__) 1080 if (mkdir(pathname))
1082 if (mkdir(pathname, 0777))
1084 if (errno != EEXIST)
1105 int w =
p->w() * 2 / 3;
1147 if (pathname[0] && pathname[strlen(pathname) - 1] !=
'/') {
1148 strlcat(pathname,
"/",
sizeof(pathname));
1176 if (!fn || !*fn || fn[strlen(fn) - 1]==
'/') {
1183 strlcpy(pathname, fn,
sizeof(pathname));
1195 char *slash = strrchr(pathname,
'/');
1201 #
if defined(WIN32) || defined(__EMX__)
1205 #endif // WIN32 || __EMX__ 1243 }
else if ((patstart = strchr(item,
'(')) ==
NULL) {
1247 if ((patend = strrchr(
pattern_,
')')) !=
NULL) *patend =
'\0';
1284 for (i = 0; i < 100; i ++) {
1285 sprintf(menuname,
"favorite%02d", i);
1286 prefs_->
get(menuname, pathname,
"",
sizeof(pathname));
1287 if (!pathname[0])
break;
1307 const char *newlabel = 0;
1322 newlabel =
"@fileopen";
1327 if ((s.st_mode&S_IFMT)!=S_IFREG) {
1329 newlabel =
"@-3refresh";
1331 }
else if (s.st_size==0) {
1333 newlabel =
"<empty file>";
1353 if (oldimage) oldimage->release();
1381 if ( (c&0x80)==0 ) {
1382 if (!isprint(c&255) && !isspace(c&255))
break;
1383 }
else if ( (c&0xe0)==0xc0 ) {
1384 if (ptr[1] && (ptr[1]&0xc0)!=0x80)
break;
1386 }
else if ( (c&0xf0)==0xe0 ) {
1387 if (ptr[1] && (ptr[1]&0xc0)!=0x80)
break;
1389 if (ptr[1] && (ptr[1]&0xc0)!=0x80)
break;
1391 }
else if ( (c&0xf8)==0xf0 ) {
1392 if (ptr[1] && (ptr[1]&0xc0)!=0x80)
break;
1394 if (ptr[1] && (ptr[1]&0xc0)!=0x80)
break;
1396 if (ptr[1] && (ptr[1]&0xc0)!=0x80)
break;
1406 *ptr && (isprint(*ptr & 255) || isspace(*ptr & 255));
1419 if (size < 6) size = 6;
1428 }
else if (image && ( (image->
w() <= 0) ||
1429 (image->
h() <= 0) ||
1431 (image->
count() <= 0))) {
1442 if (image->
w() > pbw || image->
h() > pbh) {
1444 h = w * image->
h() / image->
w();
1448 w = h * image->
w() / image->
h();
1461 }
else if (newlabel) {
1550 for (slash = strchr(fixpath,
'\\'); slash; slash = strchr(slash + 1,
'\\'))
1560 if ((slash = strrchr(pathname,
'/')) !=
NULL) {
1565 if (*slash ==
'/') slash = pathname;
1572 if (slash > pathname) slash[-1] =
'/';
1584 for (i = 1; i <= fcount; i ++)
1585 #
if defined(WIN32) || defined(__EMX__)
1589 #endif // WIN32 || __EMX__ 1624 for(
int num =
count; num >= 1; num--) {
1641 alen = (int) (strlen(a) - 1);
1642 blen = (int) (strlen(
b) - 1);
1644 if (alen < 0 || blen < 0)
return alen - blen;
1647 if (a[alen] !=
'/') alen ++;
1648 if (
b[blen] !=
'/') blen ++;
1651 if (alen != blen)
return alen - blen;
1655 return strncasecmp(a,
b, alen);
1657 return strncmp(a,
b, alen);
1673 while (*src && dstsize > 1) {
1705 while (*src && dstsize > 0) {
1706 if (*src ==
'\\') src++;
1724 if (!home) home =
fl_getenv(
"UserProfile");
static const char * filesystems_label
static Fl_File_Sort_F * sort
void rescan_keep_filename()
const Fl_Align FL_ALIGN_LEFT
#define FL_Enter
The enter key.
#define FL_BackSpace
The backspace key.
static const char * all_files_label
static const char * custom_filter_label
Fl_Button * favDeleteButton
static int compare_dirnames(const char *a, const char *b)
Base class for image caching and drawing.
void hotspot(int x, int y, int offscreen=0)
virtual Fl_Image * copy(int W, int H)
static const char * hidden_label
static Fl_File_Chooser * fc
void insert(int line, FL_BLINE *item)
void favoritesCB(Fl_Widget *w)
#define FL_KP_Enter
The enter key on the keypad, same as Fl_KP+'\r'.
const Fl_Font FL_COURIER
Courier normal.
int fl_filename_isdir(const char *name)
const char * value(int f=1)
FILE * fl_fopen(const char *f, const char *mode)
void remove_hidden_files()
static const char * new_directory_tooltip
int deselect(int docallbacks=0)
static Fl_File_Icon * find(const char *filename, int filetype=ANY)
const Fl_Align FL_ALIGN_INSIDE
static const char * save_label
int fl_numericsort(struct dirent **, struct dirent **)
const char * text(int line) const
Fl_Button * favDownButton
Fl_Check_Button * previewButton
const char * fl_input(const char *label, const char *deflt=0,...)
#define FL_ALT
One of the alt keys is down.
Fl_Double_Window * favWindow
static const char * add_favorites_label
Fl_Menu_Button * favoritesButton
static const char * get_homedir()
utility header to pull drawing functions together
static const char * filename
const Fl_Font FL_HELVETICA
Helvetica (or Arial) normal (0)
int selected(int line) const
char get(const char *entry, int &value, int defaultValue)
FL_EXPORT void fl_cursor(Fl_Cursor)
char set(const char *entry, int value)
int fl_filename_absolute(char *to, int tolen, const char *from)
int fl_stat(const char *path, struct stat *buffer)
static void quote_pathname(char *, const char *, int)
static void remove_timeout(Fl_Timeout_Handler, void *=0)
char * fl_getenv(const char *name)
Fl_Fontsize FL_NORMAL_SIZE
normal font size
void(* callback_)(Fl_File_Chooser *, void *)
int _fl_filename_isdir_quick(const char *n)
static void unquote_pathname(char *, const char *, int)
int load(const char *directory, Fl_File_Sort_F *sort=fl_numericsort)
Fl_File_Browser * favList
Fl_Double_Window * window
int() Fl_File_Sort_F(struct dirent **, struct dirent **)
static int event_clicks()
static Fl_Shared_Image * get(const char *name, int W=0, int H=0)
void add(const char *newtext, void *d=0)
const Fl_Align FL_ALIGN_TOP
static void previewCB(Fl_File_Chooser *fc)
static void add_timeout(double t, Fl_Timeout_Handler, void *=0)
static const char * filename_label
Fl_Preferences provides methods to store user settings between application starts.
static const char * new_directory_label
void resize(int X, int Y, int W, int H)
static const char * existing_file_label
Fl_Return_Button * okButton
void(* Fl_Timeout_Handler)(void *data)
void filter(const char *pattern)
static Fl_Preferences * prefs_
void * data(int line) const
static const char * manage_favorites_label
int select(int line, int val=1)
static int start(Fl_RGB_Image *img, int XP, int YP, int WP, int HP, int w, int h, int &cx, int &cy, int &X, int &Y, int &W, int &H)
static const char * preview_label
Fl_File_Browser * fileList
int fl_filename_expand(char *to, int tolen, const char *from)
static const char * show_label
void fl_alert(const char *,...)
#define FL_Delete
The delete key.
static const char * favorites_label
Fl_Check_Button * showHiddenButton
const Fl_Align FL_ALIGN_CLIP
Fl_Return_Button * favOkButton