Customizing Filer48



Introduction


Filer48 is completely customizable, you can run your own programs from inside Filer48, and you can use all the internal Functions, in addition to this each program can have a shortcut from the keyboard; this is accomplished by using a custom Menu which displays labels for each of your programs. If you pressinside Filer48, the program will try to find the F48.CST file, this file is used to create your custom Menu.


Structure of F48.CST


This is a list that specifies the Menu keys and hard key assignments. It is a list with one element for each Menu key. Each Menu key is represented by a list with three to five arguments.You can use an empty sublist as a separator.

The general structure is like this:

{

   {

      ( Item 1 )

      Name_Item

      Location_Item

      Action_Item

      [ Custom_Program ]

      [ Key_Shortcut ]

   }

   {

      ( Item 2 )

      ...

   }

   ...

}


Each of the elements in the sublists will be described below.


Name_Item


This specifies what will be displayed in the menu. It can be either a String, a Grob 21 x 8 or a program which when evaluated returns a String or a Grob 21 x 8


Location_Item


This allows you to control when the action bound to this menu can be executed. This is either a hex or a bint number. There are five possible values, which are listed in the table below.


Value Constant Meaning
0 fEverywhere The action can be run anywhere (VAR, PORT, BACKUP, LIB)
1 fVar The action can be run only if the user is browsing the HOME directory or one of its subdirectories.
2 fNoLib The action cannot be run if the user is browsing a library.
3 fNoBackup The action cannot be run if the user is browsing a backup object in a port.
4 fHomePort The action can only be run in the root of a port.
5 fVar&HomePort The action can run in HOME and in the root of a port.

NOTE: The Constant column lists the name of a constant that you should use when programming, this constants are listed in the Filer48.h file inside the custom directory.

Action_Item


This will define what will happen when the user presses the softkey corresponding to that menu or the hardkey assignment.

It can be either a hex or a bint number. It is possible to call a built-in Function of Filer48, or define your own. The table below lists all the built-in actions available, for this values you don't need to put a program inside the list:


Value Constant Action
0 cQUIT Exits the Filer.
1 cSORT Opens a dialog with options for sorting the variables.
2 cSELECT Opens a dialog with options for selecting the variables.
3 cVIEW Views the object in the most appropriate viewer.
4 cTREE Shows the directory tree.
5 cUp Moves the highlight up.
6 cMaxUp Moves the highlight to the first item.
7 cDown Moves the highlight down.
8 cMaxDown Moves the highlight to the last item.
9 cSelect Marks the selected variable.
10 cUpDir Goes to the parent directory.
11 cDownDir Enters the selected directory.
12 cPreviousMenu Displays previous menu page.
13 cNextMenu Displays next menu page.
14 cEVAL Evaluates the selected variable.
15 cChangeHeader Changes the header line.
24 cChangeMode Changes the Filer mode.
25 cEDIT Edits the selected object.
26 cCOPY Copies the selected objects.
27 cMOVE Moves the selected objects.
28 cRCL Recalls the selected objects to the stack.
29 cPURGE Purges the selected objects.
30 cRENAME Renames the selected object.
31 cNewObject Opens a dialog with options for making a new object.
32 cORDER Reorders the variables in the current directory.
33 cZIP If BZ is present opens a dialog with options for compressing the selected variable.
34 cLINK Opens a dialog with options for sending/receiving variables.
35 cCustom Change current menu with the one stored in F48.CST
36 cPageUp Scrolls the Filer one screen up.
37 cPageDown Scrolls the Filer one screen down.

To run a custom program, the Action_Item argument will be in the range 16-23 Each of these seven values specifies what will be in the stack and how your program is going to be called.

The table below lists the calling methods:


Value Constant Description
16 cPathOnly Recalls only the current path.
1: Path
17 cSingleObject Recalls the name and the contents of the currently selected object.
3: Path
2: Object
1: Name
18 cMultipleObjects Equivalent to above, but deals with multiple selected objects.
2n+2: Path
...
5: Object 2
4: Name 2
3: Object 1
2: Name 1
1: Number of objects (real number)
19 cProgramLoop The program is called once for each selected object. Each time the following arguments will be on the stack before running your program.
3: Path
2: Object
1: Name
20 cSingleName Recalls only the name for the currently selected object.
2: Path
1: Name
21 cMultipleNames Recalls all the selected names.
n+2: Path
...
3: Name 2
2: Name 1
1: Number of names (real number)
22 cStrSingle Recalls the current object only in a string of addresses.
2: Path
1: String
23 cStrMultiple Recalls the selected objects in a string of addresses.
2: Path
1: String

When the program is called on a Library at the root of a port, the name will be the library number as a real number

Explanation for the String (calls 22 & 23)

The string recalled by Filer48 is a list of addresses. You can only use it in Machine Language.

The string is something like:


Prolog

02A2C  Size  AdrName1  AdrObject1  AdrName2  AdrObject2...

Each address is on 5 Nibbles.

Custom_Program


When using a custom program, this element holds the program to be called. There are some additional features that can be useful:


1 If you launch the program from VAR, your program will start in the current browsed directory.
2 A program can only be called on a selected object.
3 If you want to force Filer48 to exit after your program is run, leave TakeOver in the stack, example:
{ "QUIT" fEverywhere cPathOnly :: DROP ' TakeOver ; }

Key_Shortcut


Use this argument to assign a program to a key. This argument can be either a hex or a bint number in the form # axx, where a is 1 or 0, meaning with alpha or without, respectively. xx is the key code plus optionally #40 for the Left Shift or #C0 for the Right Shift.

For example, if you want to assing your program to Left Shift + MTH, the number will be # 47h: #07 representing the MTH key, and #40 for the Left Shift.


NOTE: For Internal calls this argument must be the fourth of the list, and for Custom calls this argument must be the fifth of the list. Please check out all the examples supplied inside the Custom folder.

Warning: In order to save room, I use object pointers to keep track of each object inside the browser, so if you modify the directory structure in your programs (using STO, PURGE, etc) then NEVER use call 19 because the HP will crash big time! And if you are a very good experienced programmer you can use calls 22 and 23.