Skip to content

Commit

Permalink
FileIcon, FileBrowser, FileChooser stuff.
Browse files Browse the repository at this point in the history
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@1517 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
  • Loading branch information
michaelrsweet committed Aug 2, 2001
1 parent 836d2fa commit 75b6b22
Show file tree
Hide file tree
Showing 15 changed files with 1,471 additions and 1,051 deletions.
6 changes: 4 additions & 2 deletions FL/Enumerations.H
@@ -1,5 +1,5 @@
//
// "$Id: Enumerations.H,v 1.18.2.14.2.1 2001/08/01 21:24:48 easysw Exp $"
// "$Id: Enumerations.H,v 1.18.2.14.2.2 2001/08/02 16:17:04 easysw Exp $"
//
// Enumerations for the Fast Light Tool Kit (FLTK).
//
Expand Down Expand Up @@ -212,6 +212,8 @@ enum Fl_Labeltype { // labeltypes:
_FL_PIXMAP_LABEL,
_FL_IMAGE_LABEL,
_FL_MULTI_LABEL,
_FL_ICON_LABEL,

FL_FREE_LABELTYPE
};
extern Fl_Labeltype FL_EXPORT define_FL_SYMBOL_LABEL();
Expand Down Expand Up @@ -372,5 +374,5 @@ enum Fl_Damage {
#endif

//
// End of "$Id: Enumerations.H,v 1.18.2.14.2.1 2001/08/01 21:24:48 easysw Exp $".
// End of "$Id: Enumerations.H,v 1.18.2.14.2.2 2001/08/02 16:17:04 easysw Exp $".
//
33 changes: 13 additions & 20 deletions FL/Fl_FileBrowser.H
@@ -1,9 +1,9 @@
//
// "$Id: Fl_FileBrowser.H,v 1.4 2000/01/16 07:44:20 robertk Exp $"
// "$Id: Fl_FileBrowser.H,v 1.4.2.1 2001/08/02 16:17:04 easysw Exp $"
//
// Fl_FileBrowser definitions for the Fast Light Tool Kit (FLTK).
// FileBrowser definitions.
//
// Copyright 1997-1999 by Easy Software Products.
// Copyright 1999-2001 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
Expand All @@ -20,30 +20,31 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA.
//
// Please report all bugs and problems to "fltk-bugs@easysw.com".
// Please report all bugs and problems to "fltk-bugs@fltk.org".
//

//
// Include necessary header files...
//

#ifndef _FL_FILEBROWSER_H_
# define _FL_FILEBROWSER_H_
#ifndef _Fl_FileBrowser_H_
# define _Fl_FileBrowser_H_

# include <FL/Fl_Browser.H>
# include <FL/Fl_FileIcon.H>
# include "Fl_Browser.H"
# include "Fl_FileIcon.H"


//
// Fl_FileBrowser class...
//

class FL_API Fl_FileBrowser : public Fl_Browser
class Fl_FileBrowser : public Fl_Browser
{
const char *directory_;
uchar iconsize_;
const char *pattern_;

int full_height() const;
int item_height(void *) const;
int item_width(void *) const;
void item_draw(void *, int, int, int, int) const;
Expand All @@ -55,26 +56,18 @@ public:
uchar iconsize() const { return (iconsize_); };
void iconsize(uchar s) { iconsize_ = s; redraw(); };

void directory(const char *directory) { load(directory); }
const char *directory(void) const { return (directory_); }

void filter(const char *pattern);
const char *filter() const { return (pattern_); };

int load(const char *directory);

#ifdef FLTK_2
unsigned textsize() const { return (Fl_Browser::text_size()); };
void textsize(unsigned s) { Fl_Browser::text_size(s); };
#else
uchar textsize() const { return (Fl_Browser::textsize()); };
void textsize(uchar s) { Fl_Browser::textsize(s); };
#endif
void textsize(uchar s) { Fl_Browser::textsize(s); iconsize_ = 3 * s / 2; };

};

#endif // !_FL_FILEBROWSER_H_
#endif // !_Fl_FileBrowser_H_

//
// End of "$Id: Fl_FileBrowser.H,v 1.4 2000/01/16 07:44:20 robertk Exp $".
// End of "$Id: Fl_FileBrowser.H,v 1.4.2.1 2001/08/02 16:17:04 easysw Exp $".
//
56 changes: 28 additions & 28 deletions FL/Fl_FileChooser.H
@@ -1,49 +1,49 @@
// generated by Fast Light User Interface Designer (fluid) version 2.0000
// generated by Fast Light User Interface Designer (fluid) version 1.0100

#ifndef Fl_FileChooser_h
#define Fl_FileChooser_h
#ifndef Fl_FileChooser_H
#define Fl_FileChooser_H
#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <FL/Fl_Choice.H>
#include <FL/Fl_Button.H>
#include "filename.H"
#include <FL/Fl_FileBrowser.H>
#include <FL/Fl_FileInput.H>
#include <FL/Fl_Button.H>
#include <FL/Fl_Return_Button.H>
#include <FL/Fl_Input.H>
#include <FL/Fl_Choice.H>
#include <FL/fl_ask.H>

class FL_API Fl_FileChooser {
class Fl_FileChooser {
public:
enum { SINGLE, MULTI, CREATE };
Fl_FileChooser(const char *d, const char *p, int t, const char *title);
Fl_Window *window;
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_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*);
Fl_FileBrowser *fileList;
inline void cb_fileList_i(Fl_FileBrowser*, void*);
static void cb_fileList(Fl_FileBrowser*, void*);
Fl_FileInput *fileName;
inline void cb_fileName_i(Fl_FileInput*, void*);
static void cb_fileName(Fl_FileInput*, void*);
inline void cb_Cancel_i(Fl_Button*, void*);
static void cb_Cancel(Fl_Button*, void*);
Fl_Return_Button *okButton;
inline void cb_okButton_i(Fl_Return_Button*, void*);
static void cb_okButton(Fl_Return_Button*, void*);
inline void cb_Cancel_i(Fl_Button*, void*);
static void cb_Cancel(Fl_Button*, void*);
Fl_Input *fileName;
inline void cb_fileName_i(Fl_Input*, void*);
static void cb_fileName(Fl_Input*, void*);
Fl_Button *upButton;
inline void cb_upButton_i(Fl_Button*, void*);
static void cb_upButton(Fl_Button*, void*);
Fl_Button *newButton;
inline void cb_newButton_i(Fl_Button*, void*);
static void cb_newButton(Fl_Button*, void*);
Fl_Choice *dirMenu;
inline void cb_dirMenu_i(Fl_Choice*, void*);
static void cb_dirMenu(Fl_Choice*, void*);
inline void cb_allfiles_i(Fl_Button*, void*);
static void cb_allfiles(Fl_Button*, void*);
char directory_[1024];
int type_;
void fileListCB();
Expand All @@ -56,7 +56,6 @@ public:
int count();
void directory(const char *d);
char * directory();
void exec();
void filter(const char *p);
const char * filter();
void hide();
Expand All @@ -65,10 +64,11 @@ public:
void label(const char *l);
const char * label();
void rescan();
void show();
void textcolor(Fl_Color c);
Fl_Color textcolor();
void textfont(Fl_Font f);
Fl_Font textfont();
void textfont(uchar f);
uchar textfont();
void textsize(uchar s);
uchar textsize();
void type(int t);
Expand Down
26 changes: 12 additions & 14 deletions FL/Fl_FileIcon.H
@@ -1,9 +1,9 @@
//
// "$Id: Fl_FileIcon.H,v 1.1 2000/01/08 22:14:13 vincent Exp $"
// "$Id: Fl_FileIcon.H,v 1.1.2.1 2001/08/02 16:17:04 easysw Exp $"
//
// Fl_FileIcon definitions for the Fast Light Tool Kit (FLTK).
// Fl_FileIcon definitions.
//
// Copyright 1997-1999 by Easy Software Products.
// Copyright 1999-2001 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
Expand All @@ -20,24 +20,24 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA.
//
// Please report all bugs and problems to "fltk-bugs@easysw.com".
// Please report all bugs and problems to "fltk-bugs@fltk.org".
//

//
// Include necessary header files...
//

#ifndef _FL_FILEICON_H_
# define _FL_FILEICON_H_
#ifndef _Fl_Fl_FileIcon_H_
# define _Fl_Fl_FileIcon_H_

# include <FL/Fl.H>
# include "Fl.H"


//
// Fl_FileIcon class...
//

class FL_API Fl_FileIcon //// Icon data
class Fl_FileIcon //// Icon data
{
static Fl_FileIcon *first_; // Pointer to first icon/filetype
Fl_FileIcon *next_; // Pointer to next icon/filetype
Expand All @@ -56,7 +56,7 @@ class FL_API Fl_FileIcon //// Icon data
FIFO, // Only named pipes
DEVICE, // Only character and block devices
LINK, // Only symbolic links
DIR // Only directories
DIRECTORY // Only directories
};

enum // Data opcodes
Expand Down Expand Up @@ -84,7 +84,7 @@ class FL_API Fl_FileIcon //// Icon data
void clear() { num_data_ = 0; }
void draw(int x, int y, int w, int h, Fl_Color ic, int active = 1);
void label(Fl_Widget *w);
// static void labeltype(const Fl_Label *o, int x, int y, int w, int h, Fl_Align a);
static void labeltype(const Fl_Label *o, int x, int y, int w, int h, Fl_Align a);
void load(const char *f);
void load_fti(const char *fti);
void load_xpm(const char *xpm);
Expand All @@ -98,10 +98,8 @@ class FL_API Fl_FileIcon //// Icon data
static void load_system_icons(void);
};

//#define _FL_ICON_LABEL FL_FREE_LABELTYPE

#endif // !_FL_FILEICON_H_
#endif // !_Fl_Fl_FileIcon_H_

//
// End of "$Id: Fl_FileIcon.H,v 1.1 2000/01/08 22:14:13 vincent Exp $".
// End of "$Id: Fl_FileIcon.H,v 1.1.2.1 2001/08/02 16:17:04 easysw Exp $".
//
15 changes: 11 additions & 4 deletions fluid/code.cxx
@@ -1,5 +1,5 @@
//
// "$Id: code.cxx,v 1.9.2.9 2001/01/22 15:13:39 easysw Exp $"
// "$Id: code.cxx,v 1.9.2.9.2.1 2001/08/02 16:17:04 easysw Exp $"
//
// Code output routines for the Fast Light Tool Kit (FLTK).
//
Expand Down Expand Up @@ -254,6 +254,8 @@ static Fl_Type* write_code(Fl_Type* p) {
return q;
}

extern const char* header_file_name;

int write_code(const char *s, const char *t) {
write_number++;
delete id_root; id_root = 0;
Expand Down Expand Up @@ -303,8 +305,13 @@ int write_code(const char *s, const char *t) {
}
}
}
if (t && include_H_from_C)
write_c("#include \"%s\"\n", filename_name(t));
if (t && include_H_from_C) {
if (*header_file_name == '.' && strchr(header_file_name, '/') == NULL) {
write_c("#include \"%s\"\n", filename_name(t));
} else {
write_c("#include \"%s\"\n", t);
}
}
for (Fl_Type* p = Fl_Type::first; p;) {
// write all static data for this & all children first
p->write_static();
Expand Down Expand Up @@ -405,5 +412,5 @@ void Fl_Type::write_code1() {
void Fl_Type::write_code2() {}

//
// End of "$Id: code.cxx,v 1.9.2.9 2001/01/22 15:13:39 easysw Exp $".
// End of "$Id: code.cxx,v 1.9.2.9.2.1 2001/08/02 16:17:04 easysw Exp $".
//
10 changes: 5 additions & 5 deletions fluid/fluid.cxx
@@ -1,5 +1,5 @@
//
// "$Id: fluid.cxx,v 1.15.2.13 2001/03/15 22:39:56 easysw Exp $"
// "$Id: fluid.cxx,v 1.15.2.13.2.1 2001/08/02 16:17:04 easysw Exp $"
//
// FLUID main entry for the Fast Light Tool Kit (FLTK).
//
Expand Down Expand Up @@ -181,13 +181,13 @@ void write_cb(Fl_Widget *, void *) {
char hname[1024];
strcpy(i18n_program, filename_name(filename));
filename_setext(i18n_program, "");
if (*code_file_name == '.') {
if (*code_file_name == '.' && strchr(code_file_name, '/') == NULL) {
strcpy(cname,filename_name(filename));
filename_setext(cname, code_file_name);
} else {
strcpy(cname, code_file_name);
}
if (*header_file_name == '.') {
if (*header_file_name == '.' && strchr(header_file_name, '/') == NULL) {
strcpy(hname,filename_name(filename));
filename_setext(hname, header_file_name);
} else {
Expand All @@ -196,7 +196,7 @@ void write_cb(Fl_Widget *, void *) {
if (!compile_only) goto_source_dir();
int x = write_code(cname,hname);
if (!compile_only) leave_source_dir();
strcat(cname, "/"); strcat(cname,header_file_name);
strcat(cname, " and "); strcat(cname,hname);
if (compile_only) {
if (!x) {fprintf(stderr,"%s : %s\n",cname,strerror(errno)); exit(1);}
} else {
Expand Down Expand Up @@ -474,5 +474,5 @@ int main(int argc,char **argv) {
}

//
// End of "$Id: fluid.cxx,v 1.15.2.13 2001/03/15 22:39:56 easysw Exp $".
// End of "$Id: fluid.cxx,v 1.15.2.13.2.1 2001/08/02 16:17:04 easysw Exp $".
//

0 comments on commit 75b6b22

Please sign in to comment.