New file chooser.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@2286 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
5c17a15fd4
commit
861ad9769b
1
CHANGES
1
CHANGES
@ -1,6 +1,7 @@
|
||||
CHANGES IN FLTK 1.1.0rc3
|
||||
|
||||
- Documentation updates.
|
||||
- New file chooser from design contest.
|
||||
- Did some testing with Valgrind and fixed some memory
|
||||
problems in Fl_Help_View::Fl_HelpView,
|
||||
Fl_Menu_::remove(), Fl_Text_Display::draw_vline(), and
|
||||
|
@ -7,35 +7,63 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <FL/Fl_Group.H>
|
||||
#include <FL/Fl_Choice.H>
|
||||
#include <FL/Fl_Menu_Button.H>
|
||||
#include <FL/Fl_Button.H>
|
||||
#include <FL/fl_ask.H>
|
||||
#include <FL/Fl_Preferences.H>
|
||||
#include <FL/Fl_Tile.H>
|
||||
#include <FL/Fl_File_Browser.H>
|
||||
#include <FL/Fl_Box.H>
|
||||
#include <FL/Fl_Check_Button.H>
|
||||
#include <FL/Fl_File_Input.H>
|
||||
#include <FL/Fl_Return_Button.H>
|
||||
#include <FL/fl_ask.H>
|
||||
|
||||
class Fl_File_Chooser {
|
||||
public:
|
||||
enum { SINGLE = 0, MULTI = 1, CREATE = 2, DIRECTORY = 4 };
|
||||
private:
|
||||
static Fl_Preferences prefs_;
|
||||
void (*callback_)(Fl_File_Chooser*, void *);
|
||||
void *data_;
|
||||
char directory_[1024];
|
||||
char pattern_[1024];
|
||||
char preview_text_[2048];
|
||||
int type_;
|
||||
void favoritesButtonCB();
|
||||
void favoritesCB(Fl_Widget *w);
|
||||
void fileListCB();
|
||||
void fileNameCB();
|
||||
void newdir();
|
||||
static void previewCB(Fl_File_Chooser *fc);
|
||||
void showChoiceCB();
|
||||
void update_favorites();
|
||||
void update_preview();
|
||||
public:
|
||||
Fl_File_Chooser(const char *d, const char *p, int t, const char *title);
|
||||
private:
|
||||
Fl_Window *window;
|
||||
inline void cb_window_i(Fl_Window*, void*);
|
||||
static void cb_window(Fl_Window*, void*);
|
||||
Fl_Choice *dirMenu;
|
||||
inline void cb_dirMenu_i(Fl_Choice*, void*);
|
||||
static void cb_dirMenu(Fl_Choice*, void*);
|
||||
Fl_Button *upButton;
|
||||
inline void cb_upButton_i(Fl_Button*, void*);
|
||||
static void cb_upButton(Fl_Button*, void*);
|
||||
Fl_Choice *showChoice;
|
||||
inline void cb_showChoice_i(Fl_Choice*, void*);
|
||||
static void cb_showChoice(Fl_Choice*, void*);
|
||||
Fl_Menu_Button *favoritesButton;
|
||||
inline void cb_favoritesButton_i(Fl_Menu_Button*, void*);
|
||||
static void cb_favoritesButton(Fl_Menu_Button*, void*);
|
||||
Fl_Button *newButton;
|
||||
inline void cb_newButton_i(Fl_Button*, void*);
|
||||
static void cb_newButton(Fl_Button*, void*);
|
||||
inline void cb__i(Fl_Button*, void*);
|
||||
static void cb_(Fl_Button*, void*);
|
||||
inline void cb__i(Fl_Tile*, void*);
|
||||
static void cb_(Fl_Tile*, void*);
|
||||
Fl_File_Browser *fileList;
|
||||
inline void cb_fileList_i(Fl_File_Browser*, void*);
|
||||
static void cb_fileList(Fl_File_Browser*, void*);
|
||||
Fl_Box *previewBox;
|
||||
Fl_Check_Button *previewButton;
|
||||
inline void cb_previewButton_i(Fl_Check_Button*, void*);
|
||||
static void cb_previewButton(Fl_Check_Button*, void*);
|
||||
Fl_File_Input *fileName;
|
||||
inline void cb_fileName_i(Fl_File_Input*, void*);
|
||||
static void cb_fileName(Fl_File_Input*, void*);
|
||||
@ -44,16 +72,28 @@ private:
|
||||
static void cb_okButton(Fl_Return_Button*, void*);
|
||||
inline void cb_Cancel_i(Fl_Button*, void*);
|
||||
static void cb_Cancel(Fl_Button*, void*);
|
||||
void (*callback_)(Fl_File_Chooser*, void *);
|
||||
void *data_;
|
||||
char directory_[1024];
|
||||
int type_;
|
||||
void fileListCB();
|
||||
void fileNameCB();
|
||||
void newdir();
|
||||
void up();
|
||||
Fl_Window *favWindow;
|
||||
Fl_File_Browser *favList;
|
||||
inline void cb_favList_i(Fl_File_Browser*, void*);
|
||||
static void cb_favList(Fl_File_Browser*, void*);
|
||||
Fl_Button *favUpButton;
|
||||
inline void cb_favUpButton_i(Fl_Button*, void*);
|
||||
static void cb_favUpButton(Fl_Button*, void*);
|
||||
Fl_Button *favDeleteButton;
|
||||
inline void cb_favDeleteButton_i(Fl_Button*, void*);
|
||||
static void cb_favDeleteButton(Fl_Button*, void*);
|
||||
Fl_Button *favDownButton;
|
||||
inline void cb_favDownButton_i(Fl_Button*, void*);
|
||||
static void cb_favDownButton(Fl_Button*, void*);
|
||||
Fl_Button *favCancelButton;
|
||||
inline void cb_favCancelButton_i(Fl_Button*, void*);
|
||||
static void cb_favCancelButton(Fl_Button*, void*);
|
||||
Fl_Return_Button *favOkButton;
|
||||
inline void cb_favOkButton_i(Fl_Return_Button*, void*);
|
||||
static void cb_favOkButton(Fl_Return_Button*, void*);
|
||||
public:
|
||||
void callback(void (*cb)(Fl_File_Chooser *, void *), void *d);
|
||||
~Fl_File_Chooser();
|
||||
void callback(void (*cb)(Fl_File_Chooser *, void *), void *d = 0);
|
||||
void color(Fl_Color c);
|
||||
Fl_Color color();
|
||||
int count();
|
||||
@ -66,6 +106,8 @@ public:
|
||||
uchar iconsize();
|
||||
void label(const char *l);
|
||||
const char * label();
|
||||
void preview(int e);
|
||||
int preview() const { return previewButton->value(); };
|
||||
void rescan();
|
||||
void show();
|
||||
int shown();
|
||||
@ -80,9 +122,16 @@ public:
|
||||
const char *value(int f = 1);
|
||||
void value(const char *filename);
|
||||
int visible();
|
||||
static const char *directory_label;
|
||||
static const char *add_favorites_label;
|
||||
static const char *all_files_label;
|
||||
static const char *existing_file_label;
|
||||
static const char *favorites_label;
|
||||
static const char *filename_label;
|
||||
static const char *filter_label;
|
||||
static const char *filesystems_label;
|
||||
static const char *manage_favorites_label;
|
||||
static const char *new_directory_label;
|
||||
static const char *preview_label;
|
||||
static const char *show_label;
|
||||
static Fl_File_Sort_F *sort;
|
||||
};
|
||||
FL_EXPORT char *fl_dir_chooser(const char *message,const char *fname,int relative=0);
|
||||
|
12
FL/mac.H
12
FL/mac.H
@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: mac.H,v 1.1.2.7 2002/04/15 12:19:00 easysw Exp $"
|
||||
// "$Id: mac.H,v 1.1.2.8 2002/06/07 15:06:31 easysw Exp $"
|
||||
//
|
||||
// Mac header file for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@ -27,9 +27,9 @@
|
||||
// include this file if "__APPLE__" is defined. This is to encourage
|
||||
// portability of even the system-specific code...
|
||||
|
||||
|
||||
#ifndef FL_MAC_H
|
||||
# define FL_MAC_H
|
||||
#ifndef Fl_X_H
|
||||
# error "Never use <FL/mac.H> directly; include <FL/x.H> instead."
|
||||
#endif // !Fl_X_H
|
||||
|
||||
// Standard MacOS Carbon API includes...
|
||||
#include <Carbon/Carbon.h>
|
||||
@ -114,9 +114,7 @@ extern void fl_open_display();
|
||||
|
||||
extern FL_EXPORT int fl_parse_color(const char* p, uchar& r, uchar& g, uchar& b);
|
||||
|
||||
#endif // !FL_MAC_H
|
||||
|
||||
//
|
||||
// End of "$Id: mac.H,v 1.1.2.7 2002/04/15 12:19:00 easysw Exp $".
|
||||
// End of "$Id: mac.H,v 1.1.2.8 2002/06/07 15:06:31 easysw Exp $".
|
||||
//
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: win32.H,v 1.15.2.3.2.6 2002/04/15 12:19:00 easysw Exp $"
|
||||
// "$Id: win32.H,v 1.15.2.3.2.7 2002/06/07 15:06:31 easysw Exp $"
|
||||
//
|
||||
// WIN32 header file for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@ -27,6 +27,10 @@
|
||||
// include this file if WIN32 is defined. This is to encourage
|
||||
// portability of even the system-specific code...
|
||||
|
||||
#ifndef Fl_X_H
|
||||
# error "Never use <FL/win32.H> directly; include <FL/x.H> instead."
|
||||
#endif // !Fl_X_H
|
||||
|
||||
#include <windows.h>
|
||||
// In some of the distributions, the gcc header files are missing some stuff:
|
||||
#ifndef LPMINMAXINFO
|
||||
@ -130,5 +134,5 @@ extern FL_EXPORT void fl_delete_bitmask(Fl_Bitmask bm);
|
||||
extern FL_EXPORT int fl_parse_color(const char* p, uchar& r, uchar& g, uchar& b);
|
||||
|
||||
//
|
||||
// End of "$Id: win32.H,v 1.15.2.3.2.6 2002/04/15 12:19:00 easysw Exp $".
|
||||
// End of "$Id: win32.H,v 1.15.2.3.2.7 2002/06/07 15:06:31 easysw Exp $".
|
||||
//
|
||||
|
@ -25,35 +25,62 @@
|
||||
<P>The <CODE>Fl_File_Chooser</CODE> widget displays a standard file selection
|
||||
dialog that supports various selection modes.
|
||||
|
||||
<CENTER><IMG SRC="filechooser.gif" WIDTH="397" HEIGHT="322" ALT="Fl_File_Chooser widget"></CENTER>
|
||||
<CENTER><IMG SRC="Fl_File_Chooser.jpg" WIDTH="498" HEIGHT="408" ALT="Fl_File_Chooser widget"></CENTER>
|
||||
|
||||
<P>The <CODE>Fl_File_Chooser</CODE> class also exports several static values
|
||||
that may be used to localize or customize the appearance of all file chooser
|
||||
dialogs:
|
||||
|
||||
<UL>
|
||||
<CENTER><TABLE BORDER="1">
|
||||
<TR>
|
||||
<TH>Member</TH>
|
||||
<TH>Default value</TH>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD><TT>add_favorites_label</TT></TD>
|
||||
<TD>"Add to Favorites"</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD><TT>all_files_label</TT></TD>
|
||||
<TD>"All Files (*)"</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD><TT>existing_file_label</TT></TD>
|
||||
<TD>"Please choose an existing file!"</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD><TT>favorites_label</TT></TD>
|
||||
<TD>"Favorites"</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD><TT>filename_label</TT></TD>
|
||||
<TD>"Filename:"</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD><TT>filesystems_label</TT></TD>
|
||||
<TD>"My Computer" (WIN32)<BR>
|
||||
"File Systems" (all others)</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD><TT>manage_favorites_label</TT></TD>
|
||||
<TD>"Manage Favorites"</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD><TT>preview_label</TT></TD>
|
||||
<TD>"Preview"</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD><TT>show_label</TT></TD>
|
||||
<TD>"Show:"</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD><TT>sort</TT></TD>
|
||||
<TD>fl_numericsort</TD>
|
||||
</TR>
|
||||
</TABLE></CENTER>
|
||||
|
||||
<LI><TT>const char
|
||||
*Fl_File_Chooser::directory_label</TT> <P>The label used
|
||||
for the directory chooser at the top of the file
|
||||
chooser. The default value is "Directory:".</P></LI>
|
||||
|
||||
<LI><TT>const char *Fl_File_Chooser::filename_label</TT>
|
||||
<P>The label used for the filename field at the bottom
|
||||
of the file chooser. The default value is
|
||||
"Filename:".</P></LI>
|
||||
|
||||
<LI><TT>const char *Fl_File_Chooser::filter_label</TT>
|
||||
<P>The label used for the filter text field. The default
|
||||
value is "Filter:".</P></LI>
|
||||
|
||||
<LI><TT>Fl_File_Sort_F *Fl_File_Chooser::sort</TT>
|
||||
<P>The sort function used when loading the contents of a
|
||||
directory. The default value is <TT>fl_numericsort</TT>.
|
||||
Other values are described in the reference page for <A
|
||||
HREF="functions.html#fl_filename_list"><TT>fl_filename_list</TT></A></P></LI>
|
||||
|
||||
</UL>
|
||||
<P>The <TT>sort</TT> member specifies the sort function that is
|
||||
used when loading the contents of a directory.
|
||||
|
||||
<H3>Methods</H3>
|
||||
|
||||
@ -68,6 +95,7 @@ dialogs:
|
||||
<LI><A HREF="#Fl_File_Chooser.hide">hide</A>
|
||||
<LI><A HREF="#Fl_File_Chooser.iconsize">iconsize</A>
|
||||
<LI><A HREF="#Fl_File_Chooser.label">label</A>
|
||||
<LI><A HREF="#Fl_File_Chooser.preview">preview</A>
|
||||
<LI><A HREF="#Fl_File_Chooser.rescan">rescan</A>
|
||||
<LI><A HREF="#Fl_File_Chooser.show">show</A>
|
||||
<LI><A HREF="#Fl_File_Chooser.textcolor">textcolor</A>
|
||||
@ -88,10 +116,23 @@ complete file name (in which case the corresponding file is highlighted
|
||||
in the list and in the filename input field.)
|
||||
|
||||
<P>The <CODE>pattern</CODE> argument can be a <CODE>NULL</CODE>
|
||||
string or <CODE>"*"</CODE> to list all files. See the FLTK
|
||||
documentation on <A
|
||||
string or <CODE>"*"</CODE> to list all files, or it can be a
|
||||
series of descriptions and filter strings separated by tab
|
||||
characters (<TT>\t</TT>). The format of filters is either
|
||||
"Description text (patterns)" or just "patterns". A file chooser
|
||||
that provides filters for HTML and image files might look like:
|
||||
|
||||
<UL><PRE>
|
||||
"HTML Files (*.html)\tImage Files (*.{bmp,gif,jpg,png})"
|
||||
</PRE></UL>
|
||||
|
||||
<P>The file chooser will automatically add the "All Files (*)"
|
||||
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.
|
||||
|
||||
<P>See the FLTK documentation on <A
|
||||
HREF="functions.html#fl_filename_match"><CODE>fl_filename_match()</CODE></A>
|
||||
for other kinds of patterns.
|
||||
for the kinds of pattern strings that are supported.
|
||||
|
||||
<P>The <CODE>type</CODE> argument can be one of the following:
|
||||
|
||||
@ -147,6 +188,12 @@ const char *label()</A></H4>
|
||||
|
||||
<P>Sets or gets the title bar text for the <CODE>Fl_File_Chooser</CODE>.
|
||||
|
||||
<H4><A NAME="Fl_File_Chooser.preview">void preview(int e)<BR>
|
||||
int preview()</A></H4>
|
||||
|
||||
<P>The first form enables or disables the preview box in the file chooser.
|
||||
The second form returns the current state of the preview box.
|
||||
|
||||
<H4><A NAME="Fl_File_Chooser.rescan">void rescan()</A></H4>
|
||||
|
||||
<P>Reloads the current directory in the <CODE>Fl_File_Browser</CODE>.
|
||||
@ -185,8 +232,5 @@ const char *value()</A></H4>
|
||||
|
||||
<P>Returns 1 if the <CODE>Fl_File_Chooser</CODE> window is visible.
|
||||
|
||||
<HR>
|
||||
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
|
BIN
documentation/Fl_File_Chooser.jpg
Normal file
BIN
documentation/Fl_File_Chooser.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 30 KiB |
Binary file not shown.
Before Width: | Height: | Size: 20 KiB |
@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: Fluid_Image.cxx,v 1.7.2.9.2.9 2002/05/16 12:47:43 easysw Exp $"
|
||||
// "$Id: Fluid_Image.cxx,v 1.7.2.9.2.10 2002/06/07 15:06:32 easysw Exp $"
|
||||
//
|
||||
// Pixmap label support for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@ -210,7 +210,7 @@ Fluid_Image::~Fluid_Image() {
|
||||
const char *ui_find_image_name;
|
||||
Fluid_Image *ui_find_image(const char *oldname) {
|
||||
goto_source_dir();
|
||||
const char *name = fl_file_chooser("Image?","*.{bm|bmp|gif|jpg|pbm|pgm|png|ppm|xbm|xpm}",oldname);
|
||||
const char *name = fl_file_chooser("Image?","Image Files (*.{bm|bmp|gif|jpg|pbm|pgm|png|ppm|xbm|xpm})",oldname);
|
||||
ui_find_image_name = name;
|
||||
Fluid_Image *ret = (name && *name) ? Fluid_Image::find(name) : 0;
|
||||
leave_source_dir();
|
||||
@ -219,5 +219,5 @@ Fluid_Image *ui_find_image(const char *oldname) {
|
||||
|
||||
|
||||
//
|
||||
// End of "$Id: Fluid_Image.cxx,v 1.7.2.9.2.9 2002/05/16 12:47:43 easysw Exp $".
|
||||
// End of "$Id: Fluid_Image.cxx,v 1.7.2.9.2.10 2002/06/07 15:06:32 easysw Exp $".
|
||||
//
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: fluid.cxx,v 1.15.2.13.2.26 2002/05/16 12:47:43 easysw Exp $"
|
||||
// "$Id: fluid.cxx,v 1.15.2.13.2.27 2002/06/07 15:06:32 easysw Exp $"
|
||||
//
|
||||
// FLUID main entry for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@ -116,7 +116,7 @@ Fl_Window *main_window;
|
||||
void save_cb(Fl_Widget *, void *v) {
|
||||
const char *c = filename;
|
||||
if (v || !c || !*c) {
|
||||
if (!(c=fl_file_chooser("Save to:", "*.f[ld]", c))) return;
|
||||
if (!(c=fl_file_chooser("Save to:", "FLUID Files (*.f[ld])", c))) return;
|
||||
set_filename(c);
|
||||
}
|
||||
if (!write_file(c)) {
|
||||
@ -149,7 +149,7 @@ void open_cb(Fl_Widget *, void *v) {
|
||||
if (!v && modflag && !fl_ask("Discard changes?")) return;
|
||||
const char *c;
|
||||
const char *oldfilename;
|
||||
if (!(c = fl_file_chooser("Open:", "*.f[ld]", filename))) return;
|
||||
if (!(c = fl_file_chooser("Open:", "FLUID Files (*.f[ld])", filename))) return;
|
||||
oldfilename = filename;
|
||||
filename = NULL;
|
||||
set_filename(c);
|
||||
@ -192,7 +192,7 @@ void open_history_cb(Fl_Widget *, void *v) {
|
||||
void new_cb(Fl_Widget *, void *v) {
|
||||
if (!v && modflag && !fl_ask("Discard changes?")) return;
|
||||
const char *c;
|
||||
if (!(c = fl_file_chooser("New:", "*.f[ld]", 0))) return;
|
||||
if (!(c = fl_file_chooser("New:", "FLUID Files (*.f[ld])", 0))) return;
|
||||
delete_all();
|
||||
set_filename(c);
|
||||
modflag = 0;
|
||||
@ -795,5 +795,5 @@ int main(int argc,char **argv) {
|
||||
}
|
||||
|
||||
//
|
||||
// End of "$Id: fluid.cxx,v 1.15.2.13.2.26 2002/05/16 12:47:43 easysw Exp $".
|
||||
// End of "$Id: fluid.cxx,v 1.15.2.13.2.27 2002/06/07 15:06:32 easysw Exp $".
|
||||
//
|
||||
|
@ -97,11 +97,13 @@ Fluid_Image.o: ../FL/Fl_Wizard.H ../FL/Fl_Menu_.H ../FL/Fl_Menu_Button.H
|
||||
Fluid_Image.o: ../FL/Fl_Menu_.H ../FL/Fl_Choice.H ../FL/Fl_Menu_Bar.H
|
||||
Fluid_Image.o: ../src/flstring.h ../config.h ../FL/filename.H
|
||||
Fluid_Image.o: ../FL/Fl_File_Chooser.H ../FL/Fl_Window.H ../FL/Fl_Button.H
|
||||
Fluid_Image.o: ../FL/fl_ask.H ../FL/Fl_File_Browser.H ../FL/Fl_Browser.H
|
||||
Fluid_Image.o: ../FL/Fl_Browser_.H ../FL/Fl_Scrollbar.H ../FL/Fl_Slider.H
|
||||
Fluid_Image.o: ../FL/Fl_Valuator.H ../FL/Fl_File_Icon.H ../FL/Fl.H
|
||||
Fluid_Image.o: ../FL/filename.H ../FL/Fl_File_Input.H ../FL/Fl_Input.H
|
||||
Fluid_Image.o: ../FL/Fl_Input_.H ../FL/Fl_Return_Button.H ../FL/Fl_Button.H
|
||||
Fluid_Image.o: ../FL/Fl_Preferences.H ../FL/Fl_Tile.H ../FL/Fl_File_Browser.H
|
||||
Fluid_Image.o: ../FL/Fl_Browser.H ../FL/Fl_Browser_.H ../FL/Fl_Scrollbar.H
|
||||
Fluid_Image.o: ../FL/Fl_Slider.H ../FL/Fl_Valuator.H ../FL/Fl_File_Icon.H
|
||||
Fluid_Image.o: ../FL/Fl.H ../FL/filename.H ../FL/Fl_Box.H
|
||||
Fluid_Image.o: ../FL/Fl_Check_Button.H ../FL/Fl_Light_Button.H
|
||||
Fluid_Image.o: ../FL/Fl_File_Input.H ../FL/Fl_Input.H ../FL/Fl_Input_.H
|
||||
Fluid_Image.o: ../FL/Fl_Return_Button.H ../FL/Fl_Button.H ../FL/fl_ask.H
|
||||
code.o: ../src/flstring.h ../config.h ../FL/Fl.H ../FL/Enumerations.H
|
||||
code.o: ../FL/Fl_Export.H Fl_Type.h ../FL/Fl_Widget.H ../FL/Fl_Menu.H
|
||||
code.o: ../FL/Fl_Menu_Item.H Fluid_Image.h ../FL/Fl_Shared_Image.H
|
||||
@ -160,17 +162,17 @@ fluid.o: ../FL/Fl_Slider.H ../FL/Fl_Valuator.H ../FL/fl_draw.H
|
||||
fluid.o: ../FL/Fl_Shared_Image.H ../FL/Fl_Hold_Browser.H ../FL/Fl_Browser.H
|
||||
fluid.o: ../FL/Fl_Browser_.H ../FL/Fl_Menu_Bar.H ../FL/Fl_Menu_.H
|
||||
fluid.o: ../FL/Fl_Input.H ../FL/Fl_Input_.H ../FL/fl_ask.H ../FL/fl_draw.H
|
||||
fluid.o: ../FL/Fl_File_Chooser.H ../FL/Fl_Window.H ../FL/Fl_Choice.H
|
||||
fluid.o: ../FL/Fl_File_Browser.H ../FL/Fl_File_Icon.H ../FL/filename.H
|
||||
fluid.o: ../FL/Fl_File_Chooser.H ../FL/Fl_Window.H ../FL/Fl_Group.H
|
||||
fluid.o: ../FL/Fl_Choice.H ../FL/Fl_Menu_Button.H ../FL/Fl_Preferences.H
|
||||
fluid.o: ../FL/Fl_Tile.H ../FL/Fl_File_Browser.H ../FL/Fl_File_Icon.H
|
||||
fluid.o: ../FL/filename.H ../FL/Fl_Check_Button.H ../FL/Fl_Light_Button.H
|
||||
fluid.o: ../FL/Fl_File_Input.H ../FL/Fl_Return_Button.H ../FL/Fl_Button.H
|
||||
fluid.o: ../FL/fl_message.H ../FL/fl_ask.H ../FL/filename.H ../src/flstring.h
|
||||
fluid.o: ../config.h alignment_panel.h ../FL/Fl_Preferences.H
|
||||
fluid.o: ../FL/Fl_Tooltip.H ../FL/Fl_Widget.H ../FL/Fl_Tabs.H
|
||||
fluid.o: ../FL/Fl_Group.H ../FL/Fl_Light_Button.H ../FL/Fl_Check_Button.H
|
||||
fluid.o: ../FL/Fl_Light_Button.H ../FL/Fl_Browser.H about_panel.h Fl_Type.h
|
||||
fluid.o: ../FL/Fl_Menu.H ../FL/Fl_Menu_Item.H Fluid_Image.h
|
||||
fluid.o: ../FL/Fl_Shared_Image.H ../FL/Fl_Image.H ../FL/x.H ../FL/Fl_Pack.H
|
||||
fluid.o: ../FL/Fl_Wizard.H ../FL/Fl_Menu_.H ../FL/Fl_Menu_Button.H
|
||||
fluid.o: ../config.h alignment_panel.h ../FL/Fl_Tooltip.H ../FL/Fl_Widget.H
|
||||
fluid.o: ../FL/Fl_Tabs.H ../FL/Fl_Light_Button.H ../FL/Fl_Browser.H
|
||||
fluid.o: about_panel.h Fl_Type.h ../FL/Fl_Menu.H ../FL/Fl_Menu_Item.H
|
||||
fluid.o: Fluid_Image.h ../FL/Fl_Shared_Image.H ../FL/Fl_Image.H ../FL/x.H
|
||||
fluid.o: ../FL/Fl_Pack.H ../FL/Fl_Wizard.H ../FL/Fl_Menu_.H
|
||||
align_widget.o: ../FL/Fl.H ../FL/Enumerations.H ../FL/Fl_Export.H
|
||||
align_widget.o: Fl_Widget_Type.h Fl_Type.h ../FL/Fl_Widget.H ../FL/Fl_Menu.H
|
||||
align_widget.o: ../FL/Fl_Menu_Item.H Fluid_Image.h ../FL/Fl_Shared_Image.H
|
||||
|
@ -5,79 +5,66 @@
|
||||
inline void Fl_File_Chooser::cb_window_i(Fl_Window*, void*) {
|
||||
fileName->value(directory_);
|
||||
fileList->deselect();
|
||||
Fl::remove_timeout((Fl_Timeout_Handler)previewCB, this);
|
||||
window->hide();
|
||||
}
|
||||
void Fl_File_Chooser::cb_window(Fl_Window* o, void* v) {
|
||||
((Fl_File_Chooser*)(o->user_data()))->cb_window_i(o,v);
|
||||
}
|
||||
|
||||
inline void Fl_File_Chooser::cb_dirMenu_i(Fl_Choice*, void*) {
|
||||
char pathname[1024];
|
||||
int i;
|
||||
|
||||
pathname[0] = '\0';
|
||||
for (i = 1; i <= dirMenu->value(); i ++)
|
||||
strcat(pathname, dirMenu->text(i));
|
||||
directory(pathname);
|
||||
inline void Fl_File_Chooser::cb_showChoice_i(Fl_Choice*, void*) {
|
||||
showChoiceCB();
|
||||
}
|
||||
void Fl_File_Chooser::cb_dirMenu(Fl_Choice* o, void* v) {
|
||||
((Fl_File_Chooser*)(o->parent()->user_data()))->cb_dirMenu_i(o,v);
|
||||
void Fl_File_Chooser::cb_showChoice(Fl_Choice* o, void* v) {
|
||||
((Fl_File_Chooser*)(o->parent()->parent()->user_data()))->cb_showChoice_i(o,v);
|
||||
}
|
||||
|
||||
inline void Fl_File_Chooser::cb_upButton_i(Fl_Button*, void*) {
|
||||
up();
|
||||
inline void Fl_File_Chooser::cb_favoritesButton_i(Fl_Menu_Button*, void*) {
|
||||
favoritesButtonCB();
|
||||
}
|
||||
void Fl_File_Chooser::cb_upButton(Fl_Button* o, void* v) {
|
||||
((Fl_File_Chooser*)(o->parent()->user_data()))->cb_upButton_i(o,v);
|
||||
void Fl_File_Chooser::cb_favoritesButton(Fl_Menu_Button* o, void* v) {
|
||||
((Fl_File_Chooser*)(o->parent()->parent()->user_data()))->cb_favoritesButton_i(o,v);
|
||||
}
|
||||
|
||||
#include <FL/Fl_Bitmap.H>
|
||||
static unsigned char idata_up[] =
|
||||
"\0\0x\0\204\0\2\1""1\376y\200\375\200""1\200""1\200""1\200""1\200""1\200\1\
|
||||
\200\1\200\377\377\0\0";
|
||||
static Fl_Bitmap image_up(idata_up, 16, 16);
|
||||
|
||||
inline void Fl_File_Chooser::cb_newButton_i(Fl_Button*, void*) {
|
||||
newdir();
|
||||
}
|
||||
void Fl_File_Chooser::cb_newButton(Fl_Button* o, void* v) {
|
||||
((Fl_File_Chooser*)(o->parent()->user_data()))->cb_newButton_i(o,v);
|
||||
((Fl_File_Chooser*)(o->parent()->parent()->user_data()))->cb_newButton_i(o,v);
|
||||
}
|
||||
|
||||
#include <FL/Fl_Bitmap.H>
|
||||
static unsigned char idata_new[] =
|
||||
"\0\0x\0\204\0\2\1\1\376\1\200""1\200""1\200\375\200\375\200""1\200""1\200\1\
|
||||
\200\1\200\377\377\0\0";
|
||||
static Fl_Bitmap image_new(idata_new, 16, 16);
|
||||
|
||||
inline void Fl_File_Chooser::cb__i(Fl_Button*, void*) {
|
||||
const char *f;
|
||||
if ((f = fl_input(filter_label,
|
||||
fileList->filter())) != NULL)
|
||||
{
|
||||
fileList->filter(f);
|
||||
rescan();
|
||||
};
|
||||
inline void Fl_File_Chooser::cb__i(Fl_Tile*, void*) {
|
||||
update_preview();
|
||||
}
|
||||
void Fl_File_Chooser::cb_(Fl_Button* o, void* v) {
|
||||
void Fl_File_Chooser::cb_(Fl_Tile* o, void* v) {
|
||||
((Fl_File_Chooser*)(o->parent()->user_data()))->cb__i(o,v);
|
||||
}
|
||||
|
||||
static unsigned char idata_allfiles[] =
|
||||
"\374?\4 \4 \4 \204!\244%\304#\364/\364/\304#\244%\204!\4 \4 \4 \374?";
|
||||
static Fl_Bitmap image_allfiles(idata_allfiles, 16, 16);
|
||||
|
||||
inline void Fl_File_Chooser::cb_fileList_i(Fl_File_Browser*, void*) {
|
||||
fileListCB();
|
||||
}
|
||||
void Fl_File_Chooser::cb_fileList(Fl_File_Browser* o, void* v) {
|
||||
((Fl_File_Chooser*)(o->parent()->user_data()))->cb_fileList_i(o,v);
|
||||
((Fl_File_Chooser*)(o->parent()->parent()->user_data()))->cb_fileList_i(o,v);
|
||||
}
|
||||
|
||||
inline void Fl_File_Chooser::cb_previewButton_i(Fl_Check_Button*, void*) {
|
||||
preview(previewButton->value());
|
||||
}
|
||||
void Fl_File_Chooser::cb_previewButton(Fl_Check_Button* o, void* v) {
|
||||
((Fl_File_Chooser*)(o->parent()->parent()->parent()->user_data()))->cb_previewButton_i(o,v);
|
||||
}
|
||||
|
||||
inline void Fl_File_Chooser::cb_fileName_i(Fl_File_Input*, void*) {
|
||||
fileNameCB();
|
||||
}
|
||||
void Fl_File_Chooser::cb_fileName(Fl_File_Input* o, void* v) {
|
||||
((Fl_File_Chooser*)(o->parent()->user_data()))->cb_fileName_i(o,v);
|
||||
((Fl_File_Chooser*)(o->parent()->parent()->user_data()))->cb_fileName_i(o,v);
|
||||
}
|
||||
|
||||
inline void Fl_File_Chooser::cb_okButton_i(Fl_Return_Button*, void*) {
|
||||
@ -88,79 +75,191 @@ if (callback_)
|
||||
window->hide();
|
||||
}
|
||||
void Fl_File_Chooser::cb_okButton(Fl_Return_Button* o, void* v) {
|
||||
((Fl_File_Chooser*)(o->parent()->user_data()))->cb_okButton_i(o,v);
|
||||
((Fl_File_Chooser*)(o->parent()->parent()->parent()->user_data()))->cb_okButton_i(o,v);
|
||||
}
|
||||
|
||||
inline void Fl_File_Chooser::cb_Cancel_i(Fl_Button*, void*) {
|
||||
fileName->value(directory_);
|
||||
fileList->deselect();
|
||||
Fl::remove_timeout((Fl_Timeout_Handler)previewCB, this);
|
||||
window->hide();
|
||||
}
|
||||
void Fl_File_Chooser::cb_Cancel(Fl_Button* o, void* v) {
|
||||
((Fl_File_Chooser*)(o->parent()->user_data()))->cb_Cancel_i(o,v);
|
||||
((Fl_File_Chooser*)(o->parent()->parent()->parent()->user_data()))->cb_Cancel_i(o,v);
|
||||
}
|
||||
|
||||
inline void Fl_File_Chooser::cb_favList_i(Fl_File_Browser*, void*) {
|
||||
favoritesCB(favList);
|
||||
}
|
||||
void Fl_File_Chooser::cb_favList(Fl_File_Browser* o, void* v) {
|
||||
((Fl_File_Chooser*)(o->parent()->user_data()))->cb_favList_i(o,v);
|
||||
}
|
||||
|
||||
inline void Fl_File_Chooser::cb_favUpButton_i(Fl_Button*, void*) {
|
||||
favoritesCB(favUpButton);
|
||||
}
|
||||
void Fl_File_Chooser::cb_favUpButton(Fl_Button* o, void* v) {
|
||||
((Fl_File_Chooser*)(o->parent()->user_data()))->cb_favUpButton_i(o,v);
|
||||
}
|
||||
|
||||
inline void Fl_File_Chooser::cb_favDeleteButton_i(Fl_Button*, void*) {
|
||||
favoritesCB(favDeleteButton);
|
||||
}
|
||||
void Fl_File_Chooser::cb_favDeleteButton(Fl_Button* o, void* v) {
|
||||
((Fl_File_Chooser*)(o->parent()->user_data()))->cb_favDeleteButton_i(o,v);
|
||||
}
|
||||
|
||||
inline void Fl_File_Chooser::cb_favDownButton_i(Fl_Button*, void*) {
|
||||
favoritesCB(favDownButton);
|
||||
}
|
||||
void Fl_File_Chooser::cb_favDownButton(Fl_Button* o, void* v) {
|
||||
((Fl_File_Chooser*)(o->parent()->user_data()))->cb_favDownButton_i(o,v);
|
||||
}
|
||||
|
||||
inline void Fl_File_Chooser::cb_favCancelButton_i(Fl_Button*, void*) {
|
||||
favWindow->hide();
|
||||
}
|
||||
void Fl_File_Chooser::cb_favCancelButton(Fl_Button* o, void* v) {
|
||||
((Fl_File_Chooser*)(o->parent()->user_data()))->cb_favCancelButton_i(o,v);
|
||||
}
|
||||
|
||||
inline void Fl_File_Chooser::cb_favOkButton_i(Fl_Return_Button*, void*) {
|
||||
favoritesCB(favOkButton);
|
||||
}
|
||||
void Fl_File_Chooser::cb_favOkButton(Fl_Return_Button* o, void* v) {
|
||||
((Fl_File_Chooser*)(o->parent()->user_data()))->cb_favOkButton_i(o,v);
|
||||
}
|
||||
|
||||
Fl_File_Chooser::Fl_File_Chooser(const char *d, const char *p, int t, const char *title) {
|
||||
Fl_Window* w;
|
||||
{ Fl_Window* o = window = new Fl_Window(375, 325, "Pick a File");
|
||||
{ Fl_Window* o = window = new Fl_Window(490, 380, "Choose File");
|
||||
w = o;
|
||||
o->callback((Fl_Callback*)cb_window, (void*)(this));
|
||||
{ Fl_Choice* o = dirMenu = new Fl_Choice(95, 10, 180, 25, "Directory:");
|
||||
o->tooltip("Choose a parent directory.");
|
||||
{ Fl_Group* o = new Fl_Group(65, 10, 415, 25);
|
||||
{ Fl_Choice* o = showChoice = new Fl_Choice(65, 10, 215, 25, "Show:");
|
||||
o->down_box(FL_BORDER_BOX);
|
||||
o->callback((Fl_Callback*)cb_dirMenu);
|
||||
dirMenu->label(directory_label);
|
||||
o->callback((Fl_Callback*)cb_showChoice);
|
||||
Fl_Group::current()->resizable(o);
|
||||
showChoice->label(show_label);
|
||||
}
|
||||
{ Fl_Button* o = upButton = new Fl_Button(280, 10, 25, 25);
|
||||
o->tooltip("Show the parent directory.");
|
||||
o->image(image_up);
|
||||
o->labelsize(8);
|
||||
o->callback((Fl_Callback*)cb_upButton);
|
||||
{ Fl_Menu_Button* o = favoritesButton = new Fl_Menu_Button(290, 10, 155, 25, "Favorites");
|
||||
o->down_box(FL_BORDER_BOX);
|
||||
o->callback((Fl_Callback*)cb_favoritesButton);
|
||||
o->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
|
||||
favoritesButton->label(favorites_label);
|
||||
}
|
||||
{ Fl_Button* o = newButton = new Fl_Button(310, 10, 25, 25);
|
||||
{ Fl_Button* o = newButton = new Fl_Button(455, 10, 25, 25);
|
||||
o->tooltip("Create a new directory.");
|
||||
o->image(image_new);
|
||||
o->labelsize(8);
|
||||
o->callback((Fl_Callback*)cb_newButton);
|
||||
}
|
||||
{ Fl_Button* o = new Fl_Button(340, 10, 25, 25);
|
||||
o->tooltip("Change the filename filter.");
|
||||
o->image(image_allfiles);
|
||||
o->labelsize(28);
|
||||
o->labelcolor(4);
|
||||
o->callback((Fl_Callback*)cb_);
|
||||
o->align(FL_ALIGN_CENTER|FL_ALIGN_INSIDE);
|
||||
o->end();
|
||||
}
|
||||
{ Fl_File_Browser* o = fileList = new Fl_File_Browser(10, 45, 355, 180);
|
||||
{ Fl_Tile* o = new Fl_Tile(10, 45, 470, 225);
|
||||
o->callback((Fl_Callback*)cb_);
|
||||
{ Fl_File_Browser* o = fileList = new Fl_File_Browser(10, 45, 295, 225);
|
||||
o->type(2);
|
||||
o->callback((Fl_Callback*)cb_fileList);
|
||||
Fl_Group::current()->resizable(o);
|
||||
w->hotspot(o);
|
||||
}
|
||||
{ Fl_File_Input* o = fileName = new Fl_File_Input(10, 245, 355, 35, "Filename:");
|
||||
o->callback((Fl_Callback*)cb_fileName);
|
||||
o->align(FL_ALIGN_TOP_LEFT);
|
||||
o->when(FL_WHEN_ENTER_KEY);
|
||||
fileName->when(FL_WHEN_CHANGED | FL_WHEN_ENTER_KEY_ALWAYS);
|
||||
fileName->label(filename_label);
|
||||
{ Fl_Box* o = previewBox = new Fl_Box(305, 45, 175, 225, "?");
|
||||
o->box(FL_DOWN_BOX);
|
||||
o->labelsize(100);
|
||||
o->align(FL_ALIGN_CLIP|FL_ALIGN_INSIDE);
|
||||
}
|
||||
{ Fl_Return_Button* o = okButton = new Fl_Return_Button(200, 290, 75, 25, "OK");
|
||||
o->end();
|
||||
Fl_Group::current()->resizable(o);
|
||||
}
|
||||
{ Fl_Group* o = new Fl_Group(0, 275, 480, 95);
|
||||
{ Fl_Group* o = new Fl_Group(10, 275, 470, 20);
|
||||
{ Fl_Check_Button* o = previewButton = new Fl_Check_Button(405, 275, 75, 20, "Preview");
|
||||
o->down_box(FL_DOWN_BOX);
|
||||
o->value(1);
|
||||
o->shortcut(0x80070);
|
||||
o->callback((Fl_Callback*)cb_previewButton);
|
||||
previewButton->label(preview_label);
|
||||
}
|
||||
{ Fl_Box* o = new Fl_Box(10, 275, 395, 20);
|
||||
Fl_Group::current()->resizable(o);
|
||||
}
|
||||
o->end();
|
||||
}
|
||||
{ Fl_File_Input* o = fileName = new Fl_File_Input(85, 300, 395, 35);
|
||||
o->callback((Fl_Callback*)cb_fileName);
|
||||
o->when(FL_WHEN_ENTER_KEY);
|
||||
Fl_Group::current()->resizable(o);
|
||||
fileName->when(FL_WHEN_CHANGED | FL_WHEN_ENTER_KEY_ALWAYS);
|
||||
}
|
||||
{ Fl_Box* o = new Fl_Box(0, 310, 85, 25, "Filename:");
|
||||
o->align(FL_ALIGN_RIGHT|FL_ALIGN_INSIDE);
|
||||
o->label(filename_label);
|
||||
}
|
||||
{ Fl_Group* o = new Fl_Group(10, 345, 470, 25);
|
||||
{ Fl_Return_Button* o = okButton = new Fl_Return_Button(320, 345, 75, 25, "OK");
|
||||
o->callback((Fl_Callback*)cb_okButton);
|
||||
okButton->label(fl_ok);
|
||||
}
|
||||
{ Fl_Button* o = new Fl_Button(285, 290, 80, 25, "Cancel");
|
||||
{ Fl_Button* o = new Fl_Button(405, 345, 75, 25, "Cancel");
|
||||
o->callback((Fl_Callback*)cb_Cancel);
|
||||
o->label(fl_cancel);
|
||||
}
|
||||
{ Fl_Box* o = new Fl_Box(10, 345, 300, 25);
|
||||
Fl_Group::current()->resizable(o);
|
||||
}
|
||||
o->end();
|
||||
}
|
||||
o->end();
|
||||
}
|
||||
if (title) window->label(title);
|
||||
o->set_modal();
|
||||
o->end();
|
||||
}
|
||||
fileList->filter(p);
|
||||
type(t);
|
||||
value(d);
|
||||
{ Fl_Window* o = favWindow = new Fl_Window(355, 150, "Manage Favorites");
|
||||
w = o;
|
||||
o->user_data((void*)(this));
|
||||
{ Fl_File_Browser* o = favList = new Fl_File_Browser(10, 10, 300, 95);
|
||||
o->type(2);
|
||||
o->callback((Fl_Callback*)cb_favList);
|
||||
}
|
||||
{ Fl_Button* o = favUpButton = new Fl_Button(320, 10, 25, 25, "@8>");
|
||||
o->callback((Fl_Callback*)cb_favUpButton);
|
||||
}
|
||||
{ Fl_Button* o = favDeleteButton = new Fl_Button(320, 45, 25, 25, "X");
|
||||
o->labelfont(1);
|
||||
o->callback((Fl_Callback*)cb_favDeleteButton);
|
||||
}
|
||||
{ Fl_Button* o = favDownButton = new Fl_Button(320, 80, 25, 25, "@2>");
|
||||
o->callback((Fl_Callback*)cb_favDownButton);
|
||||
}
|
||||
{ Fl_Button* o = favCancelButton = new Fl_Button(270, 115, 75, 25, "Cancel");
|
||||
o->callback((Fl_Callback*)cb_favCancelButton);
|
||||
favCancelButton->label(fl_cancel);
|
||||
}
|
||||
{ Fl_Return_Button* o = favOkButton = new Fl_Return_Button(185, 115, 75, 25, "OK");
|
||||
o->callback((Fl_Callback*)cb_favOkButton);
|
||||
favOkButton->label(fl_ok);
|
||||
}
|
||||
favWindow->label(manage_favorites_label);
|
||||
o->set_modal();
|
||||
o->end();
|
||||
}
|
||||
callback_ = 0;
|
||||
data_ = 0;
|
||||
window->size_range(window->w(), window->h(), Fl::w(), Fl::h());
|
||||
filter(p);
|
||||
update_favorites();
|
||||
value(d);
|
||||
type(t);
|
||||
int e;
|
||||
prefs_.get("preview", e, 1);
|
||||
preview(e);
|
||||
}
|
||||
|
||||
Fl_File_Chooser::~Fl_File_Chooser() {
|
||||
Fl::remove_timeout((Fl_Timeout_Handler)previewCB, this);
|
||||
delete window;
|
||||
delete favWindow;
|
||||
}
|
||||
|
||||
void Fl_File_Chooser::callback(void (*cb)(Fl_File_Chooser *, void *), void *d ) {
|
||||
@ -180,11 +279,6 @@ char * Fl_File_Chooser::directory() {
|
||||
return directory_;
|
||||
}
|
||||
|
||||
void Fl_File_Chooser::filter(const char *p) {
|
||||
fileList->filter(p);
|
||||
rescan();
|
||||
}
|
||||
|
||||
const char * Fl_File_Chooser::filter() {
|
||||
return (fileList->filter());
|
||||
}
|
||||
|
@ -6,63 +6,100 @@ class Fl_File_Chooser {open
|
||||
} {
|
||||
decl {enum { SINGLE = 0, MULTI = 1, CREATE = 2, DIRECTORY = 4 };} {public
|
||||
}
|
||||
decl {static Fl_Preferences prefs_;} {}
|
||||
decl {void (*callback_)(Fl_File_Chooser*, void *);} {}
|
||||
decl {void *data_;} {}
|
||||
decl {char directory_[1024];} {}
|
||||
decl {char pattern_[1024];} {}
|
||||
decl {char preview_text_[2048];} {}
|
||||
decl {int type_;} {}
|
||||
decl {void favoritesButtonCB();} {}
|
||||
decl {void favoritesCB(Fl_Widget *w);} {}
|
||||
decl {void fileListCB();} {}
|
||||
decl {void fileNameCB();} {}
|
||||
decl {void newdir();} {}
|
||||
decl {static void previewCB(Fl_File_Chooser *fc);} {}
|
||||
decl {void showChoiceCB();} {}
|
||||
decl {void update_favorites();} {}
|
||||
decl {void update_preview();} {}
|
||||
Function {Fl_File_Chooser(const char *d, const char *p, int t, const char *title)} {open
|
||||
} {
|
||||
Fl_Window window {
|
||||
label {Pick a File}
|
||||
label {Choose File}
|
||||
callback {fileName->value(directory_);
|
||||
fileList->deselect();
|
||||
window->hide();} open selected
|
||||
private xywh {99 225 375 325} resizable
|
||||
Fl::remove_timeout((Fl_Timeout_Handler)previewCB, this);
|
||||
window->hide();} open
|
||||
private xywh {153 80 490 380} resizable
|
||||
code0 {if (title) window->label(title);}
|
||||
code1 {\#include <stdio.h>}
|
||||
code2 {\#include <stdlib.h>}
|
||||
code3 {\#include <string.h>} modal visible
|
||||
} {
|
||||
Fl_Choice dirMenu {
|
||||
label {Directory:}
|
||||
callback {char pathname[1024];
|
||||
int i;
|
||||
|
||||
pathname[0] = '\\0';
|
||||
for (i = 1; i <= dirMenu->value(); i ++)
|
||||
strcat(pathname, dirMenu->text(i));
|
||||
directory(pathname);} open
|
||||
private tooltip {Choose a parent directory.} xywh {95 10 180 25} down_box BORDER_BOX
|
||||
code0 {dirMenu->label(directory_label);}
|
||||
Fl_Group {} {open
|
||||
private xywh {65 10 415 25}
|
||||
} {
|
||||
Fl_Choice showChoice {
|
||||
label {Show:}
|
||||
callback {showChoiceCB();} open
|
||||
private xywh {65 10 215 25} down_box BORDER_BOX resizable
|
||||
code0 {showChoice->label(show_label);}
|
||||
} {}
|
||||
Fl_Menu_Button favoritesButton {
|
||||
label Favorites
|
||||
callback {favoritesButtonCB();} open
|
||||
private xywh {290 10 155 25} down_box BORDER_BOX align 20
|
||||
code0 {favoritesButton->label(favorites_label);}
|
||||
} {}
|
||||
Fl_Button upButton {
|
||||
callback {up();}
|
||||
private tooltip {Show the parent directory.} image {up.xbm} xywh {280 10 25 25} labelsize 8
|
||||
}
|
||||
Fl_Button newButton {
|
||||
callback {newdir();}
|
||||
private tooltip {Create a new directory.} image {new.xbm} xywh {310 10 25 25} labelsize 8
|
||||
private tooltip {Create a new directory.} image {new.xbm} xywh {455 10 25 25} labelsize 8
|
||||
code0 {\#include <FL/Fl_Preferences.H>}
|
||||
}
|
||||
Fl_Button {} {
|
||||
callback {const char *f;
|
||||
if ((f = fl_input(filter_label,
|
||||
fileList->filter())) != NULL)
|
||||
{
|
||||
fileList->filter(f);
|
||||
rescan();
|
||||
}}
|
||||
private tooltip {Change the filename filter.} image {allfiles.xbm} xywh {340 10 25 25} labelsize 28 labelcolor 4 align 16
|
||||
code0 {\#include <FL/fl_ask.H>}
|
||||
}
|
||||
Fl_Browser fileList {
|
||||
Fl_Tile {} {
|
||||
callback {update_preview();} open
|
||||
private xywh {10 45 470 225} resizable
|
||||
} {
|
||||
Fl_File_Browser fileList {
|
||||
callback {fileListCB();}
|
||||
private xywh {10 45 355 180} type Hold resizable hotspot
|
||||
private xywh {10 45 295 225} type Hold hotspot
|
||||
code0 {\#include <FL/Fl_File_Browser.H>}
|
||||
class Fl_File_Browser
|
||||
}
|
||||
Fl_Box previewBox {
|
||||
label {?}
|
||||
private xywh {305 45 175 225} box DOWN_BOX labelsize 100 align 80
|
||||
}
|
||||
}
|
||||
Fl_Group {} {open
|
||||
private xywh {0 275 480 95}
|
||||
} {
|
||||
Fl_Group {} {open
|
||||
private xywh {10 275 470 20}
|
||||
} {
|
||||
Fl_Check_Button previewButton {
|
||||
label Preview
|
||||
callback {preview(previewButton->value());}
|
||||
private xywh {405 275 75 20} down_box DOWN_BOX shortcut 0x80070 value 1
|
||||
code0 {previewButton->label(preview_label);}
|
||||
}
|
||||
Fl_Box {} {
|
||||
private xywh {10 275 395 20} resizable
|
||||
}
|
||||
}
|
||||
Fl_File_Input fileName {
|
||||
label {Filename:}
|
||||
callback {fileNameCB();}
|
||||
private xywh {10 245 355 35} align 5 when 8
|
||||
private xywh {85 300 395 35} when 8 resizable
|
||||
code0 {fileName->when(FL_WHEN_CHANGED | FL_WHEN_ENTER_KEY_ALWAYS);}
|
||||
code1 {fileName->label(filename_label);}
|
||||
}
|
||||
Fl_Box {} {
|
||||
label {Filename:}
|
||||
private xywh {0 310 85 25} align 24
|
||||
code0 {o->label(filename_label);}
|
||||
}
|
||||
Fl_Group {} {open
|
||||
private xywh {10 345 470 25}
|
||||
} {
|
||||
Fl_Return_Button okButton {
|
||||
label OK
|
||||
callback {// Do any callback that is registered...
|
||||
@ -70,7 +107,7 @@ if (callback_)
|
||||
(*callback_)(this, data_);
|
||||
|
||||
window->hide();}
|
||||
private xywh {200 290 75 25}
|
||||
private xywh {320 345 75 25}
|
||||
code0 {\#include <FL/fl_ask.H>}
|
||||
code1 {okButton->label(fl_ok);}
|
||||
}
|
||||
@ -78,26 +115,74 @@ window->hide();}
|
||||
label Cancel
|
||||
callback {fileName->value(directory_);
|
||||
fileList->deselect();
|
||||
Fl::remove_timeout((Fl_Timeout_Handler)previewCB, this);
|
||||
window->hide();}
|
||||
private xywh {285 290 80 25}
|
||||
private xywh {405 345 75 25}
|
||||
code0 {o->label(fl_cancel);}
|
||||
}
|
||||
Fl_Box {} {
|
||||
private xywh {10 345 300 25} resizable
|
||||
}
|
||||
code {fileList->filter(p);
|
||||
type(t);
|
||||
}
|
||||
}
|
||||
}
|
||||
Fl_Window favWindow {
|
||||
label {Manage Favorites} open
|
||||
private xywh {580 44 355 150}
|
||||
code0 {favWindow->label(manage_favorites_label);} modal visible
|
||||
} {
|
||||
Fl_File_Browser favList {
|
||||
callback {favoritesCB(favList);}
|
||||
private xywh {10 10 300 95} type Hold
|
||||
}
|
||||
Fl_Button favUpButton {
|
||||
label {@8>}
|
||||
callback {favoritesCB(favUpButton);}
|
||||
private xywh {320 10 25 25}
|
||||
}
|
||||
Fl_Button favDeleteButton {
|
||||
label X
|
||||
callback {favoritesCB(favDeleteButton);}
|
||||
private xywh {320 45 25 25} labelfont 1
|
||||
}
|
||||
Fl_Button favDownButton {
|
||||
label {@2>}
|
||||
callback {favoritesCB(favDownButton);}
|
||||
private xywh {320 80 25 25}
|
||||
}
|
||||
Fl_Button favCancelButton {
|
||||
label Cancel
|
||||
callback {favWindow->hide();}
|
||||
private xywh {270 115 75 25}
|
||||
code0 {favCancelButton->label(fl_cancel);}
|
||||
}
|
||||
Fl_Return_Button favOkButton {
|
||||
label OK
|
||||
callback {favoritesCB(favOkButton);}
|
||||
private xywh {185 115 75 25}
|
||||
code0 {\#include <FL/fl_ask.H>}
|
||||
code1 {favOkButton->label(fl_ok);}
|
||||
}
|
||||
}
|
||||
code {callback_ = 0;
|
||||
data_ = 0;
|
||||
window->size_range(window->w(), window->h(), Fl::w(), Fl::h());
|
||||
filter(p);
|
||||
update_favorites();
|
||||
value(d);
|
||||
callback_ = 0;
|
||||
data_ = 0;} {}
|
||||
type(t);
|
||||
int e;
|
||||
prefs_.get("preview", e, 1);
|
||||
preview(e);} {selected
|
||||
}
|
||||
decl {void (*callback_)(Fl_File_Chooser*, void *);} {}
|
||||
decl {void *data_;} {}
|
||||
decl {char directory_[1024];} {}
|
||||
decl {int type_;} {}
|
||||
decl {void fileListCB();} {}
|
||||
decl {void fileNameCB();} {}
|
||||
decl {void newdir();} {}
|
||||
decl {void up();} {}
|
||||
Function {callback(void (*cb)(Fl_File_Chooser *, void *), void *d)} {return_type void
|
||||
}
|
||||
Function {~Fl_File_Chooser()} {open
|
||||
} {
|
||||
code {Fl::remove_timeout((Fl_Timeout_Handler)previewCB, this);
|
||||
delete window;
|
||||
delete favWindow;} {}
|
||||
}
|
||||
Function {callback(void (*cb)(Fl_File_Chooser *, void *), void *d = 0)} {return_type void
|
||||
} {
|
||||
code {callback_ = cb;
|
||||
data_ = d;} {}
|
||||
@ -117,10 +202,7 @@ data_ = d;} {}
|
||||
} {
|
||||
code {return directory_;} {}
|
||||
}
|
||||
Function {filter(const char *p)} {return_type void
|
||||
} {
|
||||
code {fileList->filter(p);
|
||||
rescan();} {}
|
||||
decl {void filter(const char *p);} {public
|
||||
}
|
||||
Function {filter()} {return_type {const char *}
|
||||
} {
|
||||
@ -146,9 +228,13 @@ rescan();} {}
|
||||
} {
|
||||
code {return (window->label());} {}
|
||||
}
|
||||
decl {void preview(int e);} {public
|
||||
}
|
||||
decl {int preview() const { return previewButton->value(); }} {public
|
||||
}
|
||||
decl {void rescan();} {public
|
||||
}
|
||||
Function {show()} {open return_type void
|
||||
Function {show()} {return_type void
|
||||
} {
|
||||
code {window->hotspot(fileList);
|
||||
window->show();
|
||||
@ -210,11 +296,25 @@ else
|
||||
} {
|
||||
code {return window->visible();} {}
|
||||
}
|
||||
decl {static const char *directory_label;} {public
|
||||
decl {static const char *add_favorites_label;} {public
|
||||
}
|
||||
decl {static const char *all_files_label;} {public
|
||||
}
|
||||
decl {static const char *existing_file_label;} {public
|
||||
}
|
||||
decl {static const char *favorites_label;} {public
|
||||
}
|
||||
decl {static const char *filename_label;} {public
|
||||
}
|
||||
decl {static const char *filter_label;} {public
|
||||
decl {static const char *filesystems_label;} {public
|
||||
}
|
||||
decl {static const char *manage_favorites_label;} {public
|
||||
}
|
||||
decl {static const char *new_directory_label;} {public
|
||||
}
|
||||
decl {static const char *preview_label;} {public
|
||||
}
|
||||
decl {static const char *show_label;} {public
|
||||
}
|
||||
decl {static Fl_File_Sort_F *sort;} {public
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -72,27 +72,34 @@ Fl_File_Browser.o: ../FL/Fl_File_Icon.H ../FL/Fl.H ../FL/filename.H
|
||||
Fl_File_Browser.o: ../FL/fl_draw.H ../FL/filename.H flstring.h ../config.h
|
||||
Fl_File_Chooser.o: ../FL/Fl_File_Chooser.H ../FL/Fl.H ../FL/Enumerations.H
|
||||
Fl_File_Chooser.o: ../FL/Fl_Export.H ../FL/Fl_Window.H ../FL/Fl_Group.H
|
||||
Fl_File_Chooser.o: ../FL/Fl_Widget.H ../FL/Fl_Choice.H ../FL/Fl_Menu_.H
|
||||
Fl_File_Chooser.o: ../FL/Fl_Menu_Item.H ../FL/Fl_Button.H ../FL/fl_ask.H
|
||||
Fl_File_Chooser.o: ../FL/Fl_Widget.H ../FL/Fl_Group.H ../FL/Fl_Choice.H
|
||||
Fl_File_Chooser.o: ../FL/Fl_Menu_.H ../FL/Fl_Menu_Item.H
|
||||
Fl_File_Chooser.o: ../FL/Fl_Menu_Button.H ../FL/Fl_Button.H
|
||||
Fl_File_Chooser.o: ../FL/Fl_Preferences.H ../FL/Fl_Tile.H
|
||||
Fl_File_Chooser.o: ../FL/Fl_File_Browser.H ../FL/Fl_Browser.H
|
||||
Fl_File_Chooser.o: ../FL/Fl_Browser_.H ../FL/Fl_Scrollbar.H ../FL/Fl_Slider.H
|
||||
Fl_File_Chooser.o: ../FL/Fl_Valuator.H ../FL/Fl_File_Icon.H ../FL/Fl.H
|
||||
Fl_File_Chooser.o: ../FL/filename.H ../FL/Fl_File_Input.H ../FL/Fl_Input.H
|
||||
Fl_File_Chooser.o: ../FL/Fl_Input_.H ../FL/Fl_Return_Button.H
|
||||
Fl_File_Chooser.o: ../FL/Fl_Button.H ../FL/Fl_Bitmap.H ../FL/Fl_Image.H
|
||||
Fl_File_Chooser.o: ../FL/x.H ../FL/Fl_Window.H
|
||||
Fl_File_Chooser.o: ../FL/filename.H ../FL/Fl_Box.H ../FL/Fl_Check_Button.H
|
||||
Fl_File_Chooser.o: ../FL/Fl_Light_Button.H ../FL/Fl_Button.H
|
||||
Fl_File_Chooser.o: ../FL/Fl_File_Input.H ../FL/Fl_Input.H ../FL/Fl_Input_.H
|
||||
Fl_File_Chooser.o: ../FL/Fl_Return_Button.H ../FL/fl_ask.H ../FL/Fl_Bitmap.H
|
||||
Fl_File_Chooser.o: ../FL/Fl_Image.H ../FL/x.H ../FL/Fl_Window.H
|
||||
Fl_File_Chooser2.o: ../FL/Fl_File_Chooser.H ../FL/Fl.H ../FL/Enumerations.H
|
||||
Fl_File_Chooser2.o: ../FL/Fl_Export.H ../FL/Fl_Window.H ../FL/Fl_Group.H
|
||||
Fl_File_Chooser2.o: ../FL/Fl_Widget.H ../FL/Fl_Choice.H ../FL/Fl_Menu_.H
|
||||
Fl_File_Chooser2.o: ../FL/Fl_Menu_Item.H ../FL/Fl_Button.H ../FL/fl_ask.H
|
||||
Fl_File_Chooser2.o: ../FL/Fl_Widget.H ../FL/Fl_Group.H ../FL/Fl_Choice.H
|
||||
Fl_File_Chooser2.o: ../FL/Fl_Menu_.H ../FL/Fl_Menu_Item.H
|
||||
Fl_File_Chooser2.o: ../FL/Fl_Menu_Button.H ../FL/Fl_Button.H
|
||||
Fl_File_Chooser2.o: ../FL/Fl_Preferences.H ../FL/Fl_Tile.H
|
||||
Fl_File_Chooser2.o: ../FL/Fl_File_Browser.H ../FL/Fl_Browser.H
|
||||
Fl_File_Chooser2.o: ../FL/Fl_Browser_.H ../FL/Fl_Scrollbar.H
|
||||
Fl_File_Chooser2.o: ../FL/Fl_Slider.H ../FL/Fl_Valuator.H
|
||||
Fl_File_Chooser2.o: ../FL/Fl_File_Icon.H ../FL/Fl.H ../FL/filename.H
|
||||
Fl_File_Chooser2.o: ../FL/Fl_Box.H ../FL/Fl_Check_Button.H
|
||||
Fl_File_Chooser2.o: ../FL/Fl_Light_Button.H ../FL/Fl_Button.H
|
||||
Fl_File_Chooser2.o: ../FL/Fl_File_Input.H ../FL/Fl_Input.H ../FL/Fl_Input_.H
|
||||
Fl_File_Chooser2.o: ../FL/Fl_Return_Button.H ../FL/Fl_Button.H
|
||||
Fl_File_Chooser2.o: ../FL/filename.H ../FL/x.H ../FL/Fl_Window.H flstring.h
|
||||
Fl_File_Chooser2.o: ../config.h
|
||||
Fl_File_Chooser2.o: ../FL/Fl_Return_Button.H ../FL/fl_ask.H ../FL/filename.H
|
||||
Fl_File_Chooser2.o: ../FL/x.H ../FL/Fl_Window.H ../FL/Fl_Shared_Image.H
|
||||
Fl_File_Chooser2.o: ../FL/Fl_Image.H ../FL/x.H flstring.h ../config.h
|
||||
Fl_File_Icon.o: flstring.h ../config.h ../FL/Fl_File_Icon.H ../FL/Fl.H
|
||||
Fl_File_Icon.o: ../FL/Enumerations.H ../FL/Fl_Export.H ../FL/Fl_Widget.H
|
||||
Fl_File_Icon.o: ../FL/fl_draw.H ../FL/filename.H
|
||||
@ -342,13 +349,15 @@ fl_engraved_label.o: ../FL/Fl_Widget.H ../FL/fl_draw.H
|
||||
fl_file_dir.o: flstring.h ../config.h ../FL/filename.H
|
||||
fl_file_dir.o: ../FL/Fl_File_Chooser.H ../FL/Fl.H ../FL/Enumerations.H
|
||||
fl_file_dir.o: ../FL/Fl_Export.H ../FL/Fl_Window.H ../FL/Fl_Group.H
|
||||
fl_file_dir.o: ../FL/Fl_Widget.H ../FL/Fl_Choice.H ../FL/Fl_Menu_.H
|
||||
fl_file_dir.o: ../FL/Fl_Menu_Item.H ../FL/Fl_Button.H ../FL/fl_ask.H
|
||||
fl_file_dir.o: ../FL/Fl_Widget.H ../FL/Fl_Group.H ../FL/Fl_Choice.H
|
||||
fl_file_dir.o: ../FL/Fl_Menu_.H ../FL/Fl_Menu_Item.H ../FL/Fl_Menu_Button.H
|
||||
fl_file_dir.o: ../FL/Fl_Button.H ../FL/Fl_Preferences.H ../FL/Fl_Tile.H
|
||||
fl_file_dir.o: ../FL/Fl_File_Browser.H ../FL/Fl_Browser.H ../FL/Fl_Browser_.H
|
||||
fl_file_dir.o: ../FL/Fl_Scrollbar.H ../FL/Fl_Slider.H ../FL/Fl_Valuator.H
|
||||
fl_file_dir.o: ../FL/Fl_File_Icon.H ../FL/Fl.H ../FL/filename.H
|
||||
fl_file_dir.o: ../FL/Fl_File_Input.H ../FL/Fl_Input.H ../FL/Fl_Input_.H
|
||||
fl_file_dir.o: ../FL/Fl_Return_Button.H ../FL/Fl_Button.H
|
||||
fl_file_dir.o: ../FL/Fl_Box.H ../FL/Fl_Check_Button.H ../FL/Fl_Light_Button.H
|
||||
fl_file_dir.o: ../FL/Fl_Button.H ../FL/Fl_File_Input.H ../FL/Fl_Input.H
|
||||
fl_file_dir.o: ../FL/Fl_Input_.H ../FL/Fl_Return_Button.H ../FL/fl_ask.H
|
||||
fl_font.o: flstring.h ../config.h ../FL/Fl.H ../FL/Enumerations.H
|
||||
fl_font.o: ../FL/Fl_Export.H ../FL/fl_draw.H ../FL/x.H ../FL/Fl_Window.H
|
||||
fl_font.o: Fl_Font.H fl_font_x.cxx
|
||||
|
@ -1,9 +1,9 @@
|
||||
//
|
||||
// "$Id: file_chooser.cxx,v 1.4.2.3.2.4 2002/01/01 15:11:32 easysw Exp $"
|
||||
// "$Id: file_chooser.cxx,v 1.4.2.3.2.5 2002/06/07 15:06:32 easysw Exp $"
|
||||
//
|
||||
// File chooser test program for the Fast Light Tool Kit (FLTK).
|
||||
// File chooser test program.
|
||||
//
|
||||
// Copyright 1998-2002 by Bill Spitzak and others.
|
||||
// Copyright 1999-2002 by Michael Sweet.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Library General Public
|
||||
@ -22,39 +22,273 @@
|
||||
//
|
||||
// Please report all bugs and problems to "fltk-bugs@fltk.org".
|
||||
//
|
||||
// Contents:
|
||||
//
|
||||
// main() - Create a file chooser and wait for a selection to
|
||||
// be made.
|
||||
// close_callback() - Close the main window...
|
||||
// fc_callback() - Handle choices in the file chooser...
|
||||
// pdf_check() - Check for and load the first page of a PDF file.
|
||||
// ps_check() - Check for and load the first page of a PostScript
|
||||
// file.
|
||||
// show_callback() - Show the file chooser...
|
||||
//
|
||||
|
||||
#include <FL/Fl.H>
|
||||
#include <FL/Fl_Button.H>
|
||||
#include <FL/Fl_Window.H>
|
||||
#include <FL/Fl_Input.H>
|
||||
//
|
||||
// Include necessary headers...
|
||||
//
|
||||
|
||||
#include <stdio.h>
|
||||
#include <FL/Fl_File_Chooser.H>
|
||||
#include <FL/Fl_File_Icon.H>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <FL/Fl_Shared_Image.H>
|
||||
#include <FL/Fl_PNM_Image.H>
|
||||
#include "../src/flstring.h"
|
||||
|
||||
Fl_Input *pattern, *current;
|
||||
|
||||
void pickfile(Fl_Widget *) {
|
||||
const char *p;
|
||||
p = fl_file_chooser("Pick a file",pattern->value(),current->value());
|
||||
if (p) current->value(p);
|
||||
}
|
||||
//
|
||||
// Globals...
|
||||
//
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
Fl_Input *filter;
|
||||
Fl_File_Browser *files;
|
||||
Fl_File_Chooser *fc;
|
||||
Fl_Shared_Image *image = 0;
|
||||
|
||||
|
||||
//
|
||||
// Functions...
|
||||
//
|
||||
|
||||
void close_callback(void);
|
||||
void fc_callback(Fl_File_Chooser *, void *);
|
||||
Fl_Image *pdf_check(const char *, uchar *, int);
|
||||
Fl_Image *ps_check(const char *, uchar *, int);
|
||||
void show_callback(void);
|
||||
|
||||
|
||||
//
|
||||
// 'main()' - Create a file chooser and wait for a selection to be made.
|
||||
//
|
||||
|
||||
int // O - Exit status
|
||||
main(int argc, // I - Number of command-line arguments
|
||||
char *argv[]) // I - Command-line arguments
|
||||
{
|
||||
Fl_Window *window;// Main window
|
||||
Fl_Button *button;// Buttons
|
||||
Fl_File_Icon *icon; // New file icon
|
||||
|
||||
|
||||
// Make the file chooser...
|
||||
Fl::scheme(NULL);
|
||||
Fl_File_Icon::load_system_icons();
|
||||
Fl_Window window(310,110);
|
||||
pattern = new Fl_Input(100,10,200,25,"Pattern:");
|
||||
pattern->static_value("*");
|
||||
current = new Fl_Input(100,40,200,25,"Current:");
|
||||
Fl_Button button(200,75,100,25,"&Choose file");
|
||||
button.callback(pickfile);
|
||||
window.end();
|
||||
window.show(argc, argv);
|
||||
return Fl::run();
|
||||
|
||||
fc = new Fl_File_Chooser(".", "*", Fl_File_Chooser::MULTI, "Fl_File_Chooser Test");
|
||||
fc->callback(fc_callback);
|
||||
// fc->type(Fl_File_Chooser::MULTI);
|
||||
// fc->color((Fl_Color)196);
|
||||
|
||||
// Register the PS and PDF image types...
|
||||
Fl_Shared_Image::add_handler(pdf_check);
|
||||
Fl_Shared_Image::add_handler(ps_check);
|
||||
|
||||
// Make the main window...
|
||||
window = new Fl_Window(400, 200, "File Chooser Test");
|
||||
|
||||
filter = new Fl_Input(50, 10, 315, 25, "Filter:");
|
||||
if (argc > 1)
|
||||
filter->value(argv[1]);
|
||||
else
|
||||
filter->value("PDF Files (*.pdf)\t"
|
||||
"PostScript Files (*.ps)\t"
|
||||
"Image Files (*.{bmp,gif,jpg,png})\t"
|
||||
"C/C++ Source Files (*.{c,C,cc,cpp,cxx})");
|
||||
|
||||
button = new Fl_Button(365, 10, 25, 25);
|
||||
button->labelcolor(FL_YELLOW);
|
||||
button->callback((Fl_Callback *)show_callback);
|
||||
|
||||
icon = Fl_File_Icon::find(".", Fl_File_Icon::DIRECTORY);
|
||||
icon->label(button);
|
||||
|
||||
files = new Fl_File_Browser(50, 45, 340, 110, "Files:");
|
||||
files->align(FL_ALIGN_LEFT);
|
||||
|
||||
button = new Fl_Button(340, 165, 50, 25, "Close");
|
||||
button->callback((Fl_Callback *)close_callback);
|
||||
|
||||
window->end();
|
||||
window->show();
|
||||
|
||||
Fl::run();
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// End of "$Id: file_chooser.cxx,v 1.4.2.3.2.4 2002/01/01 15:11:32 easysw Exp $".
|
||||
// 'close_callback()' - Close the main window...
|
||||
//
|
||||
|
||||
void
|
||||
close_callback(void)
|
||||
{
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// 'fc_callback()' - Handle choices in the file chooser...
|
||||
//
|
||||
|
||||
void
|
||||
fc_callback(Fl_File_Chooser *fc, // I - File chooser
|
||||
void *data) // I - Data
|
||||
{
|
||||
const char *filename; // Current filename
|
||||
|
||||
|
||||
printf("fc_callback(fc = %p, data = %p)\n", fc, data);
|
||||
|
||||
filename = fc->value();
|
||||
|
||||
printf(" filename = \"%s\"\n", filename ? filename : "(null)");
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// 'pdf_check()' - Check for and load the first page of a PDF file.
|
||||
//
|
||||
|
||||
Fl_Image * // O - Page image or NULL
|
||||
pdf_check(const char *name, // I - Name of file
|
||||
uchar *header, // I - Header data
|
||||
int headerlen) // I - Length of header data
|
||||
{
|
||||
const char *home; // Home directory
|
||||
char preview[1024], // Preview filename
|
||||
command[1024]; // Command
|
||||
|
||||
|
||||
if (memcmp(header, "%PDF", 4) != 0)
|
||||
return 0;
|
||||
|
||||
home = getenv("HOME");
|
||||
snprintf(preview, sizeof(preview), "%s/.preview.ppm", home ? home : "");
|
||||
|
||||
snprintf(command, sizeof(command),
|
||||
"gs -r100 -dFIXED -sDEVICE=ppmraw -dQUIET -dNOPAUSE -dBATCH "
|
||||
"-sstdout=\"%%stderr\" -sOUTPUTFILE=\'%s\' "
|
||||
"-dFirstPage=1 -dLastPage=1 \'%s\' 2>/dev/null", preview, name);
|
||||
|
||||
if (system(command)) return 0;
|
||||
|
||||
return new Fl_PNM_Image(preview);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// 'ps_check()' - Check for and load the first page of a PostScript file.
|
||||
//
|
||||
|
||||
Fl_Image * // O - Page image or NULL
|
||||
ps_check(const char *name, // I - Name of file
|
||||
uchar *header, // I - Header data
|
||||
int headerlen) // I - Length of header data
|
||||
{
|
||||
const char *home; // Home directory
|
||||
char preview[1024], // Preview filename
|
||||
outname[1024], // Preview PS file
|
||||
command[1024]; // Command
|
||||
FILE *in, // Input file
|
||||
*out; // Output file
|
||||
int page; // Current page
|
||||
char line[256]; // Line from file
|
||||
|
||||
|
||||
if (memcmp(header, "%!", 2) != 0)
|
||||
return 0;
|
||||
|
||||
home = getenv("HOME");
|
||||
snprintf(preview, sizeof(preview), "%s/.preview.ppm", home ? home : "");
|
||||
|
||||
if (memcmp(header, "%!PS", 4) == 0) {
|
||||
// PS file has DSC comments; extract the first page...
|
||||
snprintf(outname, sizeof(outname), "%s/.preview.ps", home ? home : "");
|
||||
|
||||
if (strcmp(name, outname) != 0) {
|
||||
in = fopen(name, "rb");
|
||||
out = fopen(outname, "wb");
|
||||
page = 0;
|
||||
|
||||
while (fgets(line, sizeof(line), in) != NULL) {
|
||||
if (strncmp(line, "%%Page:", 7) == 0) {
|
||||
page ++;
|
||||
if (page > 1) break;
|
||||
}
|
||||
|
||||
fputs(line, out);
|
||||
}
|
||||
|
||||
fclose(in);
|
||||
fclose(out);
|
||||
}
|
||||
} else {
|
||||
// PS file doesn't have DSC comments; do the whole file...
|
||||
strlcpy(outname, name, sizeof(outname));
|
||||
}
|
||||
|
||||
snprintf(command, sizeof(command),
|
||||
"gs -r100 -dFIXED -sDEVICE=ppmraw -dQUIET -dNOPAUSE -dBATCH "
|
||||
"-sstdout=\"%%stderr\" -sOUTPUTFILE=\'%s\' \'%s\' 2>/dev/null",
|
||||
preview, outname);
|
||||
|
||||
if (system(command)) return 0;
|
||||
|
||||
return new Fl_PNM_Image(preview);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// 'show_callback()' - Show the file chooser...
|
||||
//
|
||||
|
||||
void
|
||||
show_callback(void)
|
||||
{
|
||||
int i; // Looping var
|
||||
int count; // Number of files selected
|
||||
char relative[1024]; // Relative filename
|
||||
|
||||
|
||||
fc->show();
|
||||
if (filter->value()[0])
|
||||
fc->filter(filter->value());
|
||||
|
||||
fc->show();
|
||||
|
||||
while (fc->visible())
|
||||
Fl::wait();
|
||||
|
||||
count = fc->count();
|
||||
if (count > 0)
|
||||
{
|
||||
files->clear();
|
||||
|
||||
for (i = 1; i <= count; i ++)
|
||||
{
|
||||
fl_filename_relative(relative, sizeof(relative), fc->value(i));
|
||||
|
||||
files->add(relative,
|
||||
Fl_File_Icon::find(fc->value(i), Fl_File_Icon::PLAIN));
|
||||
}
|
||||
|
||||
files->redraw();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// End of "$Id: file_chooser.cxx,v 1.4.2.3.2.5 2002/06/07 15:06:32 easysw Exp $".
|
||||
//
|
||||
|
@ -57,11 +57,12 @@ colbrowser.o: ../FL/Fl_Menu_Item.H ../FL/Fl_Clock.H ../FL/Fl_Counter.H
|
||||
colbrowser.o: ../FL/Fl_Dial.H ../FL/Fl_Free.H ../FL/fl_ask.H
|
||||
colbrowser.o: ../FL/fl_show_colormap.H ../FL/filename.H
|
||||
colbrowser.o: ../FL/Fl_File_Chooser.H ../FL/Fl.H ../FL/Fl_Window.H
|
||||
colbrowser.o: ../FL/Fl_Choice.H ../FL/Fl_Button.H ../FL/fl_ask.H
|
||||
colbrowser.o: ../FL/Fl_File_Browser.H ../FL/Fl_File_Icon.H
|
||||
colbrowser.o: ../FL/Fl_File_Input.H ../FL/Fl_Input.H ../FL/Fl_Input_.H
|
||||
colbrowser.o: ../FL/Fl_Return_Button.H ../FL/Fl_Input.H
|
||||
colbrowser.o: ../FL/Fl_Menu_Button.H ../FL/Fl_Positioner.H
|
||||
colbrowser.o: ../FL/Fl_Group.H ../FL/Fl_Choice.H ../FL/Fl_Menu_Button.H
|
||||
colbrowser.o: ../FL/Fl_Button.H ../FL/Fl_Preferences.H ../FL/Fl_Tile.H
|
||||
colbrowser.o: ../FL/Fl_File_Browser.H ../FL/Fl_File_Icon.H ../FL/Fl_Box.H
|
||||
colbrowser.o: ../FL/Fl_Check_Button.H ../FL/Fl_File_Input.H ../FL/Fl_Input.H
|
||||
colbrowser.o: ../FL/Fl_Input_.H ../FL/Fl_Return_Button.H ../FL/fl_ask.H
|
||||
colbrowser.o: ../FL/Fl_Input.H ../FL/Fl_Menu_Button.H ../FL/Fl_Positioner.H
|
||||
colbrowser.o: ../FL/Fl_Value_Slider.H ../FL/Fl_Timer.H
|
||||
color_chooser.o: ../FL/Fl.H ../FL/Enumerations.H ../FL/Fl_Export.H
|
||||
color_chooser.o: ../FL/Fl_Window.H ../FL/Fl_Group.H ../FL/Fl_Widget.H
|
||||
@ -106,27 +107,31 @@ doublebuffer.o: ../FL/Fl_Valuator.H ../FL/math.h
|
||||
editor.o: ../FL/Fl.H ../FL/Enumerations.H ../FL/Fl_Export.H ../FL/Fl_Group.H
|
||||
editor.o: ../FL/Fl_Double_Window.H ../FL/Fl_Window.H ../FL/Fl_Group.H
|
||||
editor.o: ../FL/Fl_Widget.H ../FL/fl_ask.H ../FL/Fl_File_Chooser.H
|
||||
editor.o: ../FL/Fl_Window.H ../FL/Fl_Choice.H ../FL/Fl_Button.H
|
||||
editor.o: ../FL/Fl_File_Browser.H ../FL/Fl_Browser.H ../FL/Fl_Browser_.H
|
||||
editor.o: ../FL/Fl_Scrollbar.H ../FL/Fl_Slider.H ../FL/Fl_Valuator.H
|
||||
editor.o: ../FL/Fl_File_Icon.H ../FL/Fl.H ../FL/filename.H
|
||||
editor.o: ../FL/Fl_File_Input.H ../FL/Fl_Input.H ../FL/Fl_Input_.H
|
||||
editor.o: ../FL/Fl_Return_Button.H ../FL/Fl_Button.H ../FL/Fl_Menu_Bar.H
|
||||
editor.o: ../FL/Fl_Menu_.H ../FL/Fl_Menu_Item.H ../FL/Fl_Text_Buffer.H
|
||||
editor.o: ../FL/Fl_Text_Editor.H ../FL/Fl_Text_Display.H ../FL/fl_draw.H
|
||||
editor.o: ../FL/Fl_Text_Buffer.H
|
||||
editor.o: ../FL/Fl_Window.H ../FL/Fl_Choice.H ../FL/Fl_Menu_Button.H
|
||||
editor.o: ../FL/Fl_Menu_.H ../FL/Fl_Menu_Item.H ../FL/Fl_Button.H
|
||||
editor.o: ../FL/Fl_Preferences.H ../FL/Fl_Tile.H ../FL/Fl_File_Browser.H
|
||||
editor.o: ../FL/Fl_Browser.H ../FL/Fl_Browser_.H ../FL/Fl_Scrollbar.H
|
||||
editor.o: ../FL/Fl_Slider.H ../FL/Fl_Valuator.H ../FL/Fl_File_Icon.H
|
||||
editor.o: ../FL/Fl.H ../FL/filename.H ../FL/Fl_Box.H ../FL/Fl_Check_Button.H
|
||||
editor.o: ../FL/Fl_Light_Button.H ../FL/Fl_Button.H ../FL/Fl_File_Input.H
|
||||
editor.o: ../FL/Fl_Input.H ../FL/Fl_Input_.H ../FL/Fl_Return_Button.H
|
||||
editor.o: ../FL/Fl_Menu_Bar.H ../FL/Fl_Text_Buffer.H ../FL/Fl_Text_Editor.H
|
||||
editor.o: ../FL/Fl_Text_Display.H ../FL/fl_draw.H ../FL/Fl_Text_Buffer.H
|
||||
fast_slow.o: fast_slow.h ../FL/Fl.H ../FL/Enumerations.H ../FL/Fl_Export.H
|
||||
fast_slow.o: ../FL/Fl_Window.H ../FL/Fl_Group.H ../FL/Fl_Widget.H
|
||||
fast_slow.o: ../FL/Fl_Slider.H ../FL/Fl_Valuator.H ../FL/Fl_Box.H
|
||||
file_chooser.o: ../FL/Fl.H ../FL/Enumerations.H ../FL/Fl_Export.H
|
||||
file_chooser.o: ../FL/Fl_Button.H ../FL/Fl_Window.H ../FL/Fl_Group.H
|
||||
file_chooser.o: ../FL/Fl_Widget.H ../FL/Fl_Input.H ../FL/Fl_Input_.H
|
||||
file_chooser.o: ../FL/Fl_File_Chooser.H ../FL/Fl_Choice.H ../FL/fl_ask.H
|
||||
file_chooser.o: ../FL/Fl_File_Chooser.H ../FL/Fl_Group.H ../FL/Fl_Choice.H
|
||||
file_chooser.o: ../FL/Fl_Menu_Button.H ../FL/Fl_Menu_.H ../FL/Fl_Menu_Item.H
|
||||
file_chooser.o: ../FL/Fl_Preferences.H ../FL/Fl_Tile.H
|
||||
file_chooser.o: ../FL/Fl_File_Browser.H ../FL/Fl_Browser.H
|
||||
file_chooser.o: ../FL/Fl_Browser_.H ../FL/Fl_Scrollbar.H ../FL/Fl_Slider.H
|
||||
file_chooser.o: ../FL/Fl_Valuator.H ../FL/Fl_File_Icon.H ../FL/Fl.H
|
||||
file_chooser.o: ../FL/filename.H ../FL/Fl_File_Input.H
|
||||
file_chooser.o: ../FL/Fl_Return_Button.H ../FL/Fl_Button.H
|
||||
file_chooser.o: ../FL/filename.H ../FL/Fl_Box.H ../FL/Fl_Check_Button.H
|
||||
file_chooser.o: ../FL/Fl_Light_Button.H ../FL/Fl_Button.H
|
||||
file_chooser.o: ../FL/Fl_File_Input.H ../FL/Fl_Return_Button.H ../FL/fl_ask.H
|
||||
file_chooser.o: ../FL/Fl_File_Icon.H
|
||||
fonts.o: ../FL/Fl.H ../FL/Enumerations.H ../FL/Fl_Export.H ../FL/Fl_Window.H
|
||||
fonts.o: ../FL/Fl_Group.H ../FL/Fl_Widget.H ../FL/Fl_Hold_Browser.H
|
||||
@ -144,10 +149,12 @@ forms.o: ../FL/Fl_Check_Button.H ../FL/Fl_Chart.H ../FL/Fl_Choice.H
|
||||
forms.o: ../FL/Fl_Menu_.H ../FL/Fl_Menu_Item.H ../FL/Fl_Clock.H
|
||||
forms.o: ../FL/Fl_Counter.H ../FL/Fl_Dial.H ../FL/Fl_Free.H ../FL/fl_ask.H
|
||||
forms.o: ../FL/fl_show_colormap.H ../FL/filename.H ../FL/Fl_File_Chooser.H
|
||||
forms.o: ../FL/Fl.H ../FL/Fl_Window.H ../FL/Fl_Choice.H ../FL/Fl_Button.H
|
||||
forms.o: ../FL/fl_ask.H ../FL/Fl_File_Browser.H ../FL/Fl_File_Icon.H
|
||||
forms.o: ../FL/Fl_File_Input.H ../FL/Fl_Input.H ../FL/Fl_Input_.H
|
||||
forms.o: ../FL/Fl_Return_Button.H ../FL/Fl_Input.H ../FL/Fl_Menu_Button.H
|
||||
forms.o: ../FL/Fl.H ../FL/Fl_Window.H ../FL/Fl_Group.H ../FL/Fl_Choice.H
|
||||
forms.o: ../FL/Fl_Menu_Button.H ../FL/Fl_Button.H ../FL/Fl_Preferences.H
|
||||
forms.o: ../FL/Fl_Tile.H ../FL/Fl_File_Browser.H ../FL/Fl_File_Icon.H
|
||||
forms.o: ../FL/Fl_Box.H ../FL/Fl_Check_Button.H ../FL/Fl_File_Input.H
|
||||
forms.o: ../FL/Fl_Input.H ../FL/Fl_Input_.H ../FL/Fl_Return_Button.H
|
||||
forms.o: ../FL/fl_ask.H ../FL/Fl_Input.H ../FL/Fl_Menu_Button.H
|
||||
forms.o: ../FL/Fl_Positioner.H ../FL/Fl_Value_Slider.H ../FL/Fl_Timer.H
|
||||
forms.o: srs.xbm
|
||||
fractals.o: ../config.h ../FL/glut.H ../FL/gl.h ../FL/Enumerations.H
|
||||
@ -257,13 +264,17 @@ pixmap_browser.o: ../FL/Fl.H ../FL/Enumerations.H ../FL/Fl_Export.H
|
||||
pixmap_browser.o: ../FL/Fl_Box.H ../FL/Fl_Window.H ../FL/Fl_Group.H
|
||||
pixmap_browser.o: ../FL/Fl_Widget.H ../FL/Fl_Button.H ../FL/Fl_Shared_Image.H
|
||||
pixmap_browser.o: ../FL/Fl_Image.H ../FL/x.H ../FL/Fl_Window.H
|
||||
pixmap_browser.o: ../FL/Fl_File_Chooser.H ../FL/Fl_Choice.H ../FL/fl_ask.H
|
||||
pixmap_browser.o: ../FL/Fl_File_Chooser.H ../FL/Fl_Group.H ../FL/Fl_Choice.H
|
||||
pixmap_browser.o: ../FL/Fl_Menu_Button.H ../FL/Fl_Menu_.H
|
||||
pixmap_browser.o: ../FL/Fl_Menu_Item.H ../FL/Fl_Preferences.H ../FL/Fl_Tile.H
|
||||
pixmap_browser.o: ../FL/Fl_File_Browser.H ../FL/Fl_Browser.H
|
||||
pixmap_browser.o: ../FL/Fl_Browser_.H ../FL/Fl_Scrollbar.H ../FL/Fl_Slider.H
|
||||
pixmap_browser.o: ../FL/Fl_Valuator.H ../FL/Fl_File_Icon.H ../FL/Fl.H
|
||||
pixmap_browser.o: ../FL/filename.H ../FL/Fl_File_Input.H ../FL/Fl_Input.H
|
||||
pixmap_browser.o: ../FL/Fl_Input_.H ../FL/Fl_Return_Button.H
|
||||
pixmap_browser.o: ../FL/Fl_Button.H ../FL/fl_message.H ../FL/fl_ask.H
|
||||
pixmap_browser.o: ../FL/filename.H ../FL/Fl_Check_Button.H
|
||||
pixmap_browser.o: ../FL/Fl_Light_Button.H ../FL/Fl_Button.H
|
||||
pixmap_browser.o: ../FL/Fl_File_Input.H ../FL/Fl_Input.H ../FL/Fl_Input_.H
|
||||
pixmap_browser.o: ../FL/Fl_Return_Button.H ../FL/fl_ask.H ../FL/fl_message.H
|
||||
pixmap_browser.o: ../FL/fl_ask.H
|
||||
pixmap.o: ../FL/Fl.H ../FL/Enumerations.H ../FL/Fl_Export.H ../FL/Fl_Window.H
|
||||
pixmap.o: ../FL/Fl_Group.H ../FL/Fl_Widget.H ../FL/Fl_Button.H
|
||||
pixmap.o: ../FL/Fl_Pixmap.H ../FL/Fl_Image.H ../FL/x.H ../FL/Fl_Window.H
|
||||
|
Loading…
Reference in New Issue
Block a user