00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #if !defined( __FILE_CMDS )
00013 #define __FILE_CMDS
00014
00019 const
00020
00021
00022
00023 int cmFileOpen = 1001,
00024 cmFileReplace = 1002,
00025 cmFileClear = 1003,
00026 cmFileInit = 1004,
00027 cmChangeDir = 1005,
00028 cmRevert = 1006,
00029 #ifndef __UNPATCHED
00030 cmDirSelection= 1007,
00031 #endif
00032
00033
00034
00035 cmFileFocused = 102,
00036 cmFileDoubleClicked
00037 = 103;
00038
00039 #endif // __FILE_CMDS
00040
00041 #if defined( Uses_TSearchRec ) && !defined( __TSearchRec )
00042 #define __TSearchRec
00043
00044 #include <limits.h>
00045
00046
00047
00048 #define FA_ARCH 0x01
00049 #define FA_DIREC 0x02
00050 #define FA_RDONLY 0x04
00051
00056 struct ftime {
00060 unsigned ft_tsec : 5;
00064 unsigned ft_min : 6;
00068 unsigned ft_hour : 5;
00072 unsigned ft_day : 5;
00076 unsigned ft_month : 4;
00080 unsigned ft_year : 7;
00081 };
00082
00088 struct TSearchRec
00089 {
00093 uchar attr;
00097 long time;
00101 long size;
00105 char name[PATH_MAX];
00106 };
00107
00108 #endif // Uses_TSearchRec
00109
00110 #if defined( Uses_TFileInputLine ) && !defined( __TFileInputLine )
00111 #define __TFileInputLine
00112
00113 class TRect;
00114 class TEvent;
00115
00124 class TFileInputLine : public TInputLine
00125 {
00126 public:
00133 TFileInputLine( const TRect& bounds, short aMaxLen );
00142 virtual void handleEvent( TEvent& event );
00143 private:
00144 virtual const char *streamableName() const
00145 { return name; }
00146 protected:
00150 TFileInputLine( StreamableInit );
00151 public:
00155 static const char * const name;
00159 static TStreamable *build();
00160 };
00161
00165 inline ipstream& operator >> ( ipstream& is, TFileInputLine& cl )
00166 { return is >> (TStreamable&)cl; }
00170 inline ipstream& operator >> ( ipstream& is, TFileInputLine*& cl )
00171 { return is >> (void *&)cl; }
00172
00176 inline opstream& operator << ( opstream& os, TFileInputLine& cl )
00177 { return os << (TStreamable&)cl; }
00181 inline opstream& operator << ( opstream& os, TFileInputLine* cl )
00182 { return os << (TStreamable *)cl; }
00183
00184 #endif // Uses_TFileInputLine
00185
00186 #if defined( Uses_TFileCollection ) && !defined( __TFileCollection )
00187 #define __TFileCollection
00188
00189 class TSearchRec;
00190
00196 class TFileCollection: public TSortedCollection
00197 {
00198 public:
00203 TFileCollection( ccIndex aLimit, ccIndex aDelta) :
00204 TSortedCollection( aLimit, aDelta ) {}
00209 TSearchRec *at( ccIndex index )
00210 { return (TSearchRec *)TSortedCollection::at( index ); }
00215 virtual ccIndex indexOf( TSearchRec *item )
00216 { return TSortedCollection::indexOf( item ); }
00221 void remove( TSearchRec *item )
00222 { TSortedCollection::remove( item ); }
00227 void free( TSearchRec *item )
00228 { TSortedCollection::free( item ); }
00237 void atInsert( ccIndex index, TSearchRec *item )
00238 { TSortedCollection::atInsert( index, item ); }
00242 void atPut( ccIndex index, TSearchRec *item )
00243 { TSortedCollection::atPut( index, item ); }
00251 virtual ccIndex insert( TSearchRec *item )
00252 { return TSortedCollection::insert( item ); }
00257 TSearchRec *firstThat( ccTestFunc Test, void *arg );
00263 TSearchRec *lastThat( ccTestFunc Test, void *arg );
00264 private:
00265 virtual void freeItem( void *item )
00266 { delete (TSearchRec *)item; }
00281 virtual int compare( void *key1, void *key2 );
00285 virtual const char *streamableName() const
00286 { return name; }
00291 virtual void *readItem( ipstream& );
00296 virtual void writeItem( void *, opstream& );
00297 protected:
00301 TFileCollection( StreamableInit ) : TSortedCollection ( streamableInit ) {}
00302 public:
00306 static const char * const name;
00310 static TStreamable *build();
00311 };
00312
00316 inline ipstream& operator >> ( ipstream& is, TFileCollection& cl )
00317 { return is >> (TStreamable&)cl; }
00321 inline ipstream& operator >> ( ipstream& is, TFileCollection*& cl )
00322 { return is >> (void *&)cl; }
00323
00327 inline opstream& operator << ( opstream& os, TFileCollection& cl )
00328 { return os << (TStreamable&)cl; }
00332 inline opstream& operator << ( opstream& os, TFileCollection* cl )
00333 { return os << (TStreamable *)cl; }
00334
00335 inline TSearchRec *TFileCollection::firstThat( ccTestFunc func, void *arg )
00336 {
00337 return (TSearchRec *)TSortedCollection::firstThat( ccTestFunc(func), arg );
00338 }
00339
00340 inline TSearchRec *TFileCollection::lastThat( ccTestFunc func, void *arg )
00341 {
00342 return (TSearchRec *)TSortedCollection::lastThat( ccTestFunc(func), arg );
00343 }
00344
00345 #endif // Uses_TFileCollection
00346
00347
00348 #if defined( Uses_TSortedListBox ) && !defined( __TSortedListBox )
00349 #define __TSortedListBox
00350
00351 class TRect;
00352 class TScrollBar;
00353 class TEvent;
00354 class TSortedCollection;
00355
00362 class TSortedListBox: public TListBox
00363 {
00364 public:
00374 TSortedListBox( const TRect& bounds,
00375 ushort aNumCols,
00376 TScrollBar *aScrollBar
00377 );
00382 virtual void handleEvent( TEvent& event );
00390 void newList( TSortedCollection *aList );
00391 #ifndef __UNPATCHED
00392 void *read( ipstream& is );
00393 #endif
00394
00405 TSortedCollection *list();
00406 protected:
00410 uchar shiftState;
00411 private:
00418 virtual void *getKey( const char *s );
00419 short searchPos;
00420 virtual const char *streamableName() const
00421 { return name; }
00422 protected:
00426 TSortedListBox( StreamableInit ) : TListBox ( streamableInit ) {}
00427 public:
00431 static const char * const name;
00435 static TStreamable *build();
00436 };
00437
00441 inline ipstream& operator >> ( ipstream& is, TSortedListBox& cl )
00442 { return is >> (TStreamable&)cl; }
00446 inline ipstream& operator >> ( ipstream& is, TSortedListBox*& cl )
00447 { return is >> (void *&)cl; }
00448
00452 inline opstream& operator << ( opstream& os, TSortedListBox& cl )
00453 { return os << (TStreamable&)cl; }
00457 inline opstream& operator << ( opstream& os, TSortedListBox* cl )
00458 { return os << (TStreamable *)cl; }
00459
00460 inline TSortedCollection *TSortedListBox::list()
00461 {
00462 return (TSortedCollection *)TListBox::list();
00463 }
00464
00465 #endif // Uses_TSortedListBox
00466
00467 #if defined( Uses_TFileList ) && !defined( __TFileList )
00468 #define __TFileList
00469
00470 class TRect;
00471 class TScrollBar;
00472 class TEvent;
00473
00491 class TFileList : public TSortedListBox
00492 {
00493 public:
00500 TFileList( const TRect& bounds,
00501 TScrollBar *aScrollBar
00502 );
00506 ~TFileList();
00511 virtual void focusItem( short item );
00515 virtual void selectItem( short item );
00521 virtual void getText( char *dest, short item, short maxLen );
00529 void newList( TFileCollection *aList );
00535 void readDirectory( const char *dir, const char *wildCard );
00547 void readDirectory( const char *wildCard );
00551 virtual ushort dataSize();
00555 virtual void getData( void *rec );
00559 virtual void setData( void *rec );
00565 TFileCollection *list();
00566 private:
00567 virtual void *getKey( const char *s );
00568 static const char * tooManyFiles;
00569 virtual const char *streamableName() const
00570 { return name; }
00571 protected:
00575 TFileList( StreamableInit ) : TSortedListBox ( streamableInit ) {}
00576 public:
00580 static const char * const name;
00584 static TStreamable *build();
00585 };
00586
00590 inline ipstream& operator >> ( ipstream& is, TFileList& cl )
00591 { return is >> (TStreamable&)cl; }
00595 inline ipstream& operator >> ( ipstream& is, TFileList*& cl )
00596 { return is >> (void *&)cl; }
00597
00601 inline opstream& operator << ( opstream& os, TFileList& cl )
00602 { return os << (TStreamable&)cl; }
00606 inline opstream& operator << ( opstream& os, TFileList* cl )
00607 { return os << (TStreamable *)cl; }
00608
00609 inline void TFileList::newList( TFileCollection *f )
00610 {
00611 TSortedListBox::newList( f );
00612 }
00613
00614 inline TFileCollection *TFileList::list()
00615 {
00616 return (TFileCollection *)TSortedListBox::list();
00617 }
00618
00619 #endif // Uses_TFileList
00620
00621
00622 #if defined( Uses_TFileInfoPane ) && !defined( __TFileInfoPane )
00623 #define __TFileInfoPane
00624
00625 class TRect;
00626 class TEvent;
00627
00634 class TFileInfoPane : public TView
00635 {
00636 public:
00644 TFileInfoPane( const TRect& bounds );
00649 virtual void draw();
00653 virtual TPalette& getPalette() const;
00659 virtual void handleEvent( TEvent& event );
00660 private:
00677 TSearchRec file_block;
00678 static const char * const months[13];
00679 static const char * pmText;
00680 static const char * amText;
00681 virtual const char *streamableName() const
00682 { return name; }
00683 protected:
00687 TFileInfoPane( StreamableInit ) : TView ( streamableInit ) {}
00688 public:
00692 static const char * const name;
00696 static TStreamable *build();
00697 };
00698
00702 inline ipstream& operator >> ( ipstream& is, TFileInfoPane& cl )
00703 { return is >> (TStreamable&)cl; }
00707 inline ipstream& operator >> ( ipstream& is, TFileInfoPane*& cl )
00708 { return is >> (void *&)cl; }
00709
00713 inline opstream& operator << ( opstream& os, TFileInfoPane& cl )
00714 { return os << (TStreamable&)cl; }
00718 inline opstream& operator << ( opstream& os, TFileInfoPane* cl )
00719 { return os << (TStreamable *)cl; }
00720
00721 #endif // Uses_TFileInfoPane
00722
00723 #if defined( Uses_TFileDialog ) && !defined( __TFileDialog )
00724 #define __TFileDialog
00725
00726 const
00727 int fdOKButton = 0x0001,
00728 fdOpenButton = 0x0002,
00729 fdReplaceButton = 0x0004,
00730 fdClearButton = 0x0008,
00731 fdHelpButton = 0x0010,
00732 fdNoLoadDir = 0x0100;
00733
00734
00735
00736
00737
00738 class TEvent;
00739 class TFileInputLine;
00740 class TFileList;
00741
00762 class TFileDialog : public TDialog
00763 {
00764 public:
00806 TFileDialog( const char *aWildCard, const char *aTitle,
00807 const char *inputName, ushort aOptions, uchar histId );
00811 ~TFileDialog();
00815 virtual void getData( void *rec );
00822 void getFileName( char *s );
00830 virtual void handleEvent( TEvent& event );
00834 virtual void setData( void *rec );
00845 virtual Boolean valid( ushort command );
00853 virtual void shutDown();
00857 TFileInputLine *fileName;
00861 TFileList *fileList;
00865 char wildCard[PATH_MAX];
00869 const char *directory;
00870 private:
00871 void readDirectory();
00872 Boolean checkDirectory( const char * );
00873 static const char * filesText;
00874 static const char * openText;
00875 static const char * okText;
00876 static const char * replaceText;
00877 static const char * clearText;
00878 static const char * cancelText;
00879 static const char * helpText;
00880 static const char * invalidDriveText;
00881 static const char * invalidFileText;
00882 virtual const char *streamableName() const
00883 { return name; }
00884 protected:
00888 TFileDialog( StreamableInit ) : TDialog ( streamableInit ),
00889 TWindowInit( TFileDialog::initFrame ) {}
00893 virtual void write( opstream& os );
00897 virtual void *read( ipstream& is );
00898 public:
00902 static const char * const name;
00906 static TStreamable *build();
00907 };
00908
00912 inline ipstream& operator >> ( ipstream& is, TFileDialog& cl )
00913 { return is >> (TStreamable&)cl; }
00917 inline ipstream& operator >> ( ipstream& is, TFileDialog*& cl )
00918 { return is >> (void *&)cl; }
00919
00923 inline opstream& operator << ( opstream& os, TFileDialog& cl )
00924 { return os << (TStreamable&)cl; }
00928 inline opstream& operator << ( opstream& os, TFileDialog* cl )
00929 { return os << (TStreamable *)cl; }
00930
00931 #endif // Uses_TFileDialog
00932
00933
00934 #if defined( Uses_TDirEntry ) && !defined( __TDirEntry )
00935 #define __TDirEntry
00936
00943 class TDirEntry
00944 {
00945 public:
00949 TDirEntry( const char *, const char * );
00953 ~TDirEntry();
00958 char *dir() { return directory; }
00963 char *text() { return displayText; }
00964 private:
00965 char *displayText;
00966 char *directory;
00967 };
00968
00969 inline TDirEntry::TDirEntry( const char *txt, const char *dir ) :
00970 displayText( newStr( txt ) ), directory( newStr( dir ) )
00971 {
00972 }
00973
00974 inline TDirEntry::~TDirEntry()
00975 {
00976 delete displayText;
00977 delete directory;
00978 }
00979
00980 #endif // Uses_TDirEntry
00981
00982 #if defined( Uses_TDirCollection ) && !defined( __TDirCollection )
00983 #define __TDirCollection
00984
00985 class TDirEntry;
00986
00995 class TDirCollection : public TCollection
00996 {
00997 public:
01002 TDirCollection( ccIndex aLimit, ccIndex aDelta) :
01003 TCollection( aLimit, aDelta ) {}
01009 TDirEntry *at( ccIndex index )
01010 { return (TDirEntry *)TCollection::at( index );}
01015 virtual ccIndex indexOf( TDirEntry *item )
01016 { return TCollection::indexOf( item ); }
01022 void remove( TDirEntry *item )
01023 { TCollection::remove( item ); }
01029 void free( TDirEntry *item )
01030 { TCollection::free( item ); }
01038 void atInsert( ccIndex index, TDirEntry *item )
01039 { TCollection::atInsert( index, item ); }
01044 void atPut( ccIndex index, TDirEntry *item )
01045 { TCollection::atPut( index, item ); }
01052 virtual ccIndex insert( TDirEntry *item )
01053 { return TCollection::insert( item ); }
01058 TDirEntry *firstThat( ccTestFunc Test, void *arg );
01065 TDirEntry *lastThat( ccTestFunc Test, void *arg );
01066 private:
01067 virtual void freeItem( void *item )
01068 { delete (TDirEntry *)item; }
01069 virtual const char *streamableName() const
01070 { return name; }
01080 virtual void *readItem( ipstream& );
01090 virtual void writeItem( void *, opstream& );
01091 protected:
01095 TDirCollection( StreamableInit ) : TCollection ( streamableInit ) {}
01096 public:
01100 static const char * const name;
01104 static TStreamable *build();
01105 };
01106
01110 inline ipstream& operator >> ( ipstream& is, TDirCollection& cl )
01111 { return is >> (TStreamable&)cl; }
01115 inline ipstream& operator >> ( ipstream& is, TDirCollection*& cl )
01116 { return is >> (void *&)cl; }
01117
01121 inline opstream& operator << ( opstream& os, TDirCollection& cl )
01122 { return os << (TStreamable&)cl; }
01126 inline opstream& operator << ( opstream& os, TDirCollection* cl )
01127 { return os << (TStreamable *)cl; }
01128
01129 inline TDirEntry *TDirCollection::firstThat( ccTestFunc func, void *arg )
01130 {
01131 return (TDirEntry *)TCollection::firstThat( ccTestFunc(func), arg );
01132 }
01133
01134 inline TDirEntry *TDirCollection::lastThat( ccTestFunc func, void *arg )
01135 {
01136 return (TDirEntry *)TCollection::lastThat( ccTestFunc(func), arg );
01137 }
01138
01139 #endif // Uses_TDirCollection
01140
01141
01142 #if defined( Uses_TDirListBox ) && !defined( __TDirListBox )
01143 #define __TDirListBox
01144
01145 class TRect;
01146 class TScrollBar;
01147 class TEvent;
01148 class TDirCollection;
01149
01159 class TDirListBox : public TListBox
01160 {
01161 public:
01167 TDirListBox( const TRect& bounds, TScrollBar *aScrollBar );
01172 ~TDirListBox();
01176 virtual void getText( char *dest, short item, short maxLen );
01184
01188 virtual Boolean isSelected( short item );
01192 virtual void selectItem( short item );
01199 void newDirectory( const char *aList );
01203 virtual void setState( ushort aState, Boolean enable );
01208 TDirCollection *list();
01212 static const char * pathDir;
01216 static const char * firstDir;
01220 static const char * middleDir;
01224 static const char * lastDir;
01228 static const char * graphics;
01229 private:
01230 void showDrives( TDirCollection * );
01231 void showDirs( TDirCollection * );
01232 char dir[PATH_MAX];
01233 ushort cur;
01234 static const char * drives;
01235 virtual const char *streamableName() const
01236 { return name; }
01237 protected:
01241 TDirListBox( StreamableInit ): TListBox( streamableInit ) {}
01242 public:
01246 static const char * const name;
01250 static TStreamable *build();
01251 };
01252
01256 inline ipstream& operator >> ( ipstream& is, TDirListBox& cl )
01257 { return is >> (TStreamable&)cl; }
01261 inline ipstream& operator >> ( ipstream& is, TDirListBox*& cl )
01262 { return is >> (void *&)cl; }
01263
01267 inline opstream& operator << ( opstream& os, TDirListBox& cl )
01268 { return os << (TStreamable&)cl; }
01272 inline opstream& operator << ( opstream& os, TDirListBox* cl )
01273 { return os << (TStreamable *)cl; }
01274
01275 inline TDirCollection *TDirListBox::list()
01276 {
01277 return (TDirCollection *)TListBox::list();
01278 }
01279
01280 #endif // Uses_TDirListBox
01281
01282 #if defined( Uses_TChDirDialog ) && !defined( __TChDirDialog )
01283 #define __TChDirDialog
01284
01285 const
01286 int cdNormal = 0x0000,
01287 cdNoLoadDir = 0x0001,
01288 cdHelpButton = 0x0002;
01289
01290 class TEvent;
01291 class TInputLine;
01292 class TDirListBox;
01293 class TButton;
01294
01326 class TChDirDialog : public TDialog
01327 {
01328 public:
01329 friend class TDirListBox;
01367 TChDirDialog( ushort aOptions, ushort histId );
01376 virtual ushort dataSize();
01385 virtual void getData( void *rec );
01393 virtual void handleEvent( TEvent& );
01402 virtual void setData( void *rec );
01412 virtual Boolean valid( ushort command );
01427 virtual void shutDown();
01428 private:
01429 void setUpDialog();
01430 TInputLine *dirInput;
01431 TDirListBox *dirList;
01432 TButton *okButton;
01433 TButton *chDirButton;
01434 static const char * changeDirTitle;
01435 static const char * dirNameText;
01436 static const char * dirTreeText;
01437 static const char * okText;
01438 static const char * chdirText;
01439 static const char * revertText;
01440 static const char * helpText;
01441 static const char * drivesText;
01442 static const char * invalidText;
01443 virtual const char *streamableName() const
01444 { return name; }
01445 protected:
01451 TChDirDialog( StreamableInit ) : TDialog( streamableInit ),
01452 TWindowInit( TChDirDialog::initFrame ) {}
01457 virtual void write( opstream& os );
01462 virtual void *read( ipstream& is );
01463 public:
01467 static const char * const name;
01473 static TStreamable *build();
01474 };
01475
01479 inline ipstream& operator >> ( ipstream& is, TChDirDialog& cl )
01480 { return is >> (TStreamable&)cl; }
01484 inline ipstream& operator >> ( ipstream& is, TChDirDialog*& cl )
01485 { return is >> (void *&)cl; }
01486
01490 inline opstream& operator << ( opstream& os, TChDirDialog& cl )
01491 { return os << (TStreamable&)cl; }
01495 inline opstream& operator << ( opstream& os, TChDirDialog* cl )
01496 { return os << (TStreamable *)cl; }
01497
01498 #endif // Uses_TChDirDialog