home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fish 'n' More 2
/
fishmore-publicdomainlibraryvol.ii1991xetec.iso
/
fish
/
code_examples
/
filewindow_464
/
filewindow2.doc
< prev
next >
Wrap
Text File
|
1991-03-09
|
9KB
|
221 lines
****************************************************************************
* FileWindow2.doc B.Schied, Dec.12th, 1990 *
****************************************************************************
INTRODUCTION
------------
FileWindow was created by Anders Bjerin first and was distributed as
public domain (AmigaLibDisk336).
This type of FileRequester shows some great advantages like
--- quick reading of directories
--- selective reading of files by input of an extention
--- possibility of deleting of files
--- convenient length of source code (9996 Bytes, compiled with
Lattice-C-Compiler v5.04 using -O option)
One one hand I was faszinated by Anders results, one the other hand I
felt that there could be introduced some improvements to upgrade
FileWindow's performance.
My main goal was to get
+++ more device gadgets,
+++ a possibility for renaming files and directories,
+++ an alternative choice of using the RETURN-key for accepting and
the ESC-key for aborting actions,
+++ an improvement in logical structure, especially in
+++ usage of the system requester for logical mistakes only,
+++ ANSI-C transformed source code.
Nevertheless object code length should not increase more than 20%.
Additionaly the new FileWindow should also be as easy as possible to use
again.
I think I accomplished this task by modifying FileWindow to
F i l e W i n d o w 2 .
---------------------------------------
****************************************************************************
WHAT'S NEW?
-----------
All FileWindow2's NEW FEATURES are compiled here:
--- 3 more device gadgets, totaly:
ram: df0: df1: dh0: dh1: dh2:
--- A RENAME gadget
--- DELETE- or RENAME-actions can be completed by using OKAY gadget or
RETURN key. Automatically scince starting these options non sensefull
gadgets will be blocked up to the point where clicking them is
sensefull again.
--- FileWindow2 destinguishes between handling mistakes of the user and
handling advices.
handling mistakes will be answered by a system requester, handling
advices will be given on the drag bar in case of deleting or renaming
a file or a directory.
--- Selecting a file will now be accompanied by highlighting its name.
--- The ABORT gadget can either be used to abort a rename/delete action or
to close FileWindow2. Instead of using the ABORT gadget the ESC key can
be used too.
--- The TAKE gadget also acts in two ways:
- for picking a file name for your main program or
- to confirm a delete/rename action
--- I changed the name of some gadgets parallel to their slightly changed
meanings:
FileWindow FileWindow2
----------------------------------- -----------------------------------
|#| TITLE |##|##| | TITLE |##|##|
----------------------------------- -----------------------------------
| df0: | df1: | dh0: | Ext:XXXXXX | | ram: | df0: | df1: | |
|---------------------------------| |---------------------------------|
| Drawer: XXXXXXXXXXXXXXXXXXXX | <| | dh0: | dh1: | dh2: | Ext:XXXXXX |
----------------------------------- -----------------------------------
| |XX| | Drawer: XXXXXXXXXXXXXXXXXXXX | <|
| |XX| -----------------------------------
| |XX| | |XX|
| |XX| | |XX|
| FILE DISPLAY |XX| | FILE DISPLAY |XX|
| |xx| | |XX|
| |xx| | |XX|
| |xx| | |xx|
|---------------------------------| | |xx|
| File: XXXXXXXXXXXXXXXXXXXXXXXXX | | |xx|
|---------------------------------| |---------------------------------|
| LOAD | SAVE | DELETE | CANCEL | | File: XXXXXXXXXXXXXXXXXXXXXXXXX |
----------------------------------- -----------------------------------
| TAKE | ABORT | DELETE | RENAME |
-----------------------------------
There are still some more features which have been described in Anders's
source code file "FileWindow/Example.c" on AmigaLibDisk 336.
****************************************************************************
ASSUMPTIONS FOR THE USE OF FILEWINDOW2'S SOURCE- OR OBJECT CODE
---------------------------------------------------------------
You may use 'FileWindow2' in your own programs, comercial or not.
Additionally you may alter the source code to fit your needs, and you
may spread it to anyone you like.
But in all these cases you MUST INCLUDE a short info about the work of
Anders Bjerin and my efforts visible for all users in your software.
IGNORING THIS YOUR PROGRAM CONTAINS STOLEN SOURCE CODE!
If you have any questions, ideas, programs (PD or your own) etc, or just
want to say hello, PLEASE WRITE TO ME or Anders Bjerin (Anders, I hope
your adress is still being correct):
Anders Bjerin Bernd Schied
Tulevagen 22 Vogelsbergstr. 1
181 41 LIDINGO D-6200 Wiesbaden 68
SWEDEN Germany
****************************************************************************
HOW TO USE FileWindow2 FOR YOUR PROGRAMS
----------------------------------------
operation = FileWindow2( title, extension, x, y, screen, file );
USHORT operation: a variable which will contain a flag FileWindow2
returned: TAKE=500, ABORT=900, PANIC=1000
STRPTR title: string containing the name of the FileWindow2
written on its drag bar
STRPTR extension: string to be used as a file extension
int x: x position of the FileWindow2
int y: y position of the FileWindow2
struct Screen *screen: pointer to a screen if there exist one.
STRPTR file: a string which will contain the file name
together with the entire path.
(For example: "df0:letters/payments.doc"
for example:
operation = FileWindow2("Load IFF file", 100, 40, NULL, "ram:")
The source code is distributed with the program so you can alter it to fit
your needs.
There are no Image structures in the code, so FileWindow2 does not need
to be in the CHIP memory.
Title is a string which will appear on the drag gadget. Write NULL if
you do not want any string there.
Extension is a 7 character long string. 6 letters and '\0' sign.
If you give FileWindow2 a string, the program will only display the
files which endings match with your string. (Directories will always
be displayed.) If you do not want to use a file extension you simply
write NULL.
The width of the window is 320 pixels which means that if you are using
a low resolution display (320 pixels) x should be initialized to be 0.
If you are using a high resolution display (640 pixels) x can be
between 0 and 320.
Because of the FileWindow2's heighth of 180 pixels y can be between 0 and
20 on a NTSC screen (200 lines) or between 0 and 76 on a PAL screen
(256 lines).
If your program is using a CUSTOM SCREEN you should give FileWindow2 a
pointer to your screen. Otherwise, if you are using a WBENCH SCREEN you
simply write NULL.
File is a string which can already contain a file name with path if you
want. If the string is empty, FileWindow2 will start to display the
current directory.
Please notice that no image data have been created. I used prototypes in
the source code. Thus FileWindow2.c can be compiled with -rr option of the
Lattice 5.04 compiler:
lc -rr -O FileWindow2.c
In case of using _main(void) and no IO to CLI window FileWindow2.o can
be linked to your main program (i.e. FileWindow2-Demo.o) with lcr.lib
instead of lc.lib plus amiga.lib, use:
BLINK WITH FileWindow2-Demo.lnk
which contains:
FROM LIB:c.o+FileWindow2-Demo.o+FileWindow2.o
TO FileWindow2-Demo
LIB LIB:lcm.lib+LIB:lcr.lib
ND SC SD
and get the following results:
FileWindow2.c 60098 Bytes
FileWindow2.o 11612 or 11748 Bytes without -rr option
FileWindow2-Demo.c 7923 Bytes
FileWindow2-Demo.o 3068 Bytes
FileWindow2-Demo 14020 Bytes
Alternatively you can also use
FileWindow2.make and FileWindow2-Demo.make
which do the same with additional compiling into
ram:MISTAKES1 and ram:MISTAKES2.
Then the text displayer MuchMore will be invoked and the Linker will
finalize the work.
************************************************************************
TRY TO GENERATE ONE WAVE BY THROWING A STONE INTO THE WATER AND YOU
WILL IMEDIATELY CREAT THOUSENDS OF NEW WAVES STARTING AT EACH POINT OF
THE INITIAL CIRCLE. TRY TO BE THE STONE.
Bernd Schied