Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

First commit

  • Loading branch information...
commit 7dafc86a306b7077efed47b5bd279176cc725624 0 parents
@cbeust authored
13 .bankerconfig
@@ -0,0 +1,13 @@
+mainwindow 1
+automatic 1
+list 1
+getEntry 1
+
+autosave 2
+
+dateFormat %d-%m-%y
+defaultDate CDN
+
+displayFormat "b" date "n | $" amount " | " transaction
+printFormat date amount transaction "F"
+exportFormat date amount transaction "F"
BIN  Banker
Binary file not shown
BIN  Banker.info
Binary file not shown
33 FILES
@@ -0,0 +1,33 @@
+Banker
+Banker.info
+.bankerconfig
+Readme.mui
+README
+TODO
+FILES
+Catalogs/Fran�ais/banker.catalog
+Catalogs/Italiano/banker.catalog
+Catalogs/Italiano/banker.catalog
+Catalogs/Nederlands/banker.catalog
+Catalogs/Deutsch/banker.catalog
+Catalogs/Dansk/banker.catalog
+Docs/banker.doc
+Docs/banker.guide
+Docs/font_engine.doc
+Examples/File.bank
+Examples/File.bank.info
+Src/smakefile
+Src/SCOPTIONS
+Src/automatic.c
+Src/menu.c
+Src/list.c
+Src/database.c
+Src/database.h
+Src/locale_strings.h
+Src/main.c
+Src/common.h
+Src/io.c
+Src/common2.c
+Src/getentry.c
+Src/gui.c
+Src/common.c
40 README
@@ -0,0 +1,40 @@
+
+Banker is a program designed to help you keep an accurate track of your bank accounts.
+
+
+Banker's main features include :
+
+ . Entries can be entered as you choose it. 'Amount' and 'Dates' are
+ the only fields that are obligatory. You are free to enter the
+ other ones if you wish
+
+ . Handler "automatic" entries (i.e. entries that occur regularly)
+
+ . Three output formats are available : Display Format, Print Format
+ and Export Format (*note Output Formats::.). You might want to
+ display on your screen only a limited number of information, but
+ may want to print the database fully (on a 132 columns printer for
+ example) and be able to save your file under another form
+ understandable by another program...
+
+ . Full 2.0 graphic user interface. I put a strong effort in this
+ because I feel deeply that a pleasant graphic interface makes the
+ difference between a program you use daily and one that is very
+ powerful but that you dare not even launch... gadtools is
+ brilliant, not perfect but hey! it's all we've got, so let's stick
+ to it! Banker is fully localized too (i.e. can speak several
+ languages, *note Installing Banker::.).
+
+ . Maximum use of the 2.0 OS features : IffParse(), ReadArgs(),
+ amigaguide.library, etc...
+
+ . User-definable autosave. No more data wasted because of an
+ unexpected power loss : Banker will save your file automatically.
+
+ . A lot more...
+
+For more information, read the documentation in the Docs/ directory.
+
+
+C�dric BEUST
+beust@sa.inria.fr
34 ReadMe.mui
@@ -0,0 +1,34 @@
+ This small file has to be included in every application that uses MUI:
+
+--- cut here ---------------------------------------------- cut here ---
+
+ This application uses
+
+
+ MUI - MagicUserInterface
+
+ (c) Copyright 1993 by Stefan Stuntz
+
+
+MUI is a system to generate and maintain graphical user interfaces. With
+the aid of a preferences program, the user of an application has the
+ability to customize the outfit according to his personal taste.
+
+MUI is distributed as shareware. To obtain a complete package containing
+lots of examples and more information about registration please look for
+a file called "muiXX.lha" (XX means the latest version number) on your
+local bulletin boards or on public domain disks.
+
+ If you want to register directly, feel free to send
+
+
+ DM 20.- or US$ 15.-
+
+ to
+
+ Stefan Stuntz
+ Eduard-Spranger-Stra�e 7
+ 80935 M�nchen
+ GERMANY
+
+--- cut here ---------------------------------------------- cut here ---
55 TODO
@@ -0,0 +1,55 @@
+- --> done
+* --> to do
+
+ Features
+ --------
+
+* Separate preferences editor
+- Use of a backdrop window so that menus are always active
+* Several filenames to save, print, export
+- Add a sort function
+- Indicate the current file
+- Provide a CLEAR
+- Format of the options file
+- Save window configuration
+- Avoid garbage when editing an automatic entry for the first time
+* Double-click
+- Automatic backup
+- Workbench support
+- Locale support for dates
+* Export WKS format
+* Intermediate sum
+* Delayed debit
+* Arexx port
+
+
+ Bugs
+ ----
+
+- Make OK/Cancel mean what they are supposed to
+- Better handle GetMsg()'s
+- Menus
+* Configuration save
+- Correct totals
+* Signal the %D bug in the documentation
+* Validate changes the order of the list
+* Adjust the sizes of the gadgets for other locales
+
+
+ Improvements
+ ------------
+
+- Better sort algorithm!!!
+- Use Exec functions when possible (NewList, AddTail, etc...)
+- Save buildDataBase() whenever possible
+- Free the previous minList before allocating a new one
+- Divide handling code by two (group GADGETUP and VANILLAKEY)
+* Provide resizable windows
+- Position the listview gadget at the end
+- Automatic : 'NEW' must insert the date
+* Getentry : better design
+* Better error handling
+* Display the basename of the file in the title window
+* Indicate the overwite mode in the windows in the documentation
+* Use AllocRemember() and strdup() whenever possible
+* Update the documentation regarding the date format and notices to 2.0 users
BIN  catalogs/dansk/banker.catalog
Binary file not shown
BIN  catalogs/deutsch/banker.catalog
Binary file not shown
BIN  catalogs/fran軋is/banker.catalog
Binary file not shown
BIN  catalogs/italiano/banker.catalog
Binary file not shown
BIN  catalogs/nederlands/banker.catalog
Binary file not shown
472 docs/banker.doc
@@ -0,0 +1,472 @@
+
+
+*
+
+Welcome to Banker!!!
+********************
+
+
+Overview
+*********
+
+ This manual describes *Banker*. Banker is a program designed to
+help you keep an accurate track of your bank accounts. Before going any
+further, if you are reading the file 'banker.doc', I must tell you that
+there is a much more comfortable to read this documentation : use the
+Amigaguide format. As you may have noticed, in the same directory is a
+file 'banker.guide'. If you have an Amigaguide reader (the most
+powerful is Amigaguide but if you don't have it, see your public domain
+library for this, there are plenty of them in there!), you will enjoy
+immensely the ability to browse through this documentation using
+Hypertext...
+
+ Banker's main features include :
+
+ 1. Entries can be entered as you choose it. 'Amount' and 'Dates' are
+ the only fields that are obligatory. You are free to enter the
+ other ones if you wish (*note The New Entry Window::.).
+
+ 2. Three output formats are available : Display Format, Print Format
+ and Export Format (*note Output Formats::.). You might want to
+ display on your screen only a limited number of information, but
+ may want to print the database fully (on a 132 columns printer for
+ example) and be able to save your file under another form
+ understandable by another program...
+
+ 3. Full 2.0 graphic user interface using MUI, the Magic User Interface
+
+ 4. Banker is fully localized (i.e. can speak several languages :
+ French, English, Italian, Dutch, etc... *note Installing
+ Banker::.).
+
+ 5. Maximum use of the 2.0 OS features : IffParse(), ReadArgs(),
+ amigaguide.library, etc...
+
+ 6. User-definable autosave. No more data wasted because of an
+ unexpected power loss : Banker will save your file automatically.
+
+
+
+Banker's legal status
+**********************
+
+ This program is shareware and (C)1992 by C�dric BEUST. You may
+redistribute it freely provided :
+
+ 1. No benefits are made on it, and that the price asked doesn't
+ exceed the price of shipping and handling plus the one of the
+ supporting media.
+
+ 2. The distribution is given with every single file present and
+ unaltered. See the file Banker/FILES for a list of these files.
+ My name and copyright notices must remain intact.
+
+ 3. If you find this program useful and have been using it for more
+ than a month, you are morally forced (we know what this means...)
+ to send me a reasonable amount of money ($10 seems fine to me, but
+ if you send more you will enter my "privileged users" list).
+ Please send dollars or French francs unless you really can't do
+ otherwise. I can be reached to the following address :
+
+
+ C�dric BEUST
+"Les Ducs de Savoie"
+1, rue Roger Martin du Gard
+06000 NICE
+FRANCE
+email: beust@sa.inria.fr
+
+
+Installing Banker
+******************
+
+ The operations needed to install Banker are very simple :
+
+ * From CLI : Copy the files Banker and Banker.info into your
+ favorite directory, and copy the configuration file in your `s:'
+ directory :
+
+ 1> copy Banker <dest>
+ 1> copy Banker.info <dest>
+ 1> copy s/.bankerconfig s:
+
+ * From Workbench : Simply drag the Banker icon into your favorite
+ directory. For the configuration file, it's hardly trickier :
+
+ 1. Select Window/Show all files from the Workbench menu
+
+ 2. Open the `s' drawer
+
+ 3. Double-click on the file `.bankerconfig' and replace
+ `.bankerconfig' with `copy .bankerconfig S:'
+
+
+The graphic interface
+**********************
+
+ Banker uses MUI, the Magic User Interface by Stefan Stuntz for its
+interface. Thus, you must have the MUI package in order to be able to
+use Banker. It can be retrieved on aminet, or directly from the author
+if you have no net access. Read the file "Readme.mui" for more
+information on MUI.
+
+ All you have to know of *gadtools* and *MUI* in order to use Banker
+is the following :
+
+ * In string gadgets, all the characters are allowed. Hitting
+ *RETURN* will deactivate the string gadgets. Then you can use the
+ shortcuts if any are present (see below)
+
+ * When you are in a string gadget, hit *TAB* to take the cursor to
+ the following string gadget (*Shift-TAB* will take you to the
+ previous one). When you reach the last one in the window, you are
+ taken back to the first (respectively the first to the last).
+
+ * When all the gadgets are deactivated (i.e. the cursor doesn't
+ appear in any string gadgets), you are free to use the mouse or
+ the shortcuts. They are indicated by a word with a letter
+ underlined. You can press the underlined letter to obtain the same
+ result as if you had pressed the gadget with the mouse.
+
+ * In every window, there are shortcuts that are always valid, even
+ though not clearly indicated. These are
+
+ * *ESC* will make the window disappear (same as selecting the
+ gadget *Cancel* (NB : the name will be different if you chose
+ to use another language)
+
+
+Launching Banker
+*****************
+
+ You can execute Banker either from CLI or from the Workbench. You
+have the possibility in either case to give arguments that give Banker
+different directives.
+
+
+From Cli
+=========
+
+ If you launch Banker with a single quotation mark as argument, you
+will have the following template :
+
+1> banker ?
+Language/K,File/K,OptionsFile/K:
+
+ The meaning of these options is :
+
+ * LANGUAGE : Specify the language you wish to use, in case it is
+ different from the default locale. Note : this option will only
+ work if you're running Workbench 2.1 or higher (*note Notes for
+ 2.1 users::.).
+
+ * FILE : Specify the file you want to load initially in Banker.
+
+ * OPTIONSFILE : Specify an alternate name for the default
+ configuration file (default is `s:.bankerconfig')
+
+ For example, you might call Banker from CLI with the following
+syntax :
+
+1> banker FILE account.bank LANGUAGE italiano
+
+ or
+
+1> banker OPTIONSFILE CFG:Banker.cfg
+
+From Workbench
+===============
+
+Specifying arguments for Banker in the Workbench is accomplished through
+the `info' file. Click once on the Banker icon in order to activate it
+and then select Icon/Information from the menu (or press Right-Amiga
+I). A list of tooltypes appears. To add one, simply click on *Add* and
+type it in the activated string gadget. To modify an existing one,
+select it and do the same. See your Workbench Manual for more details.
+
+ The tooltypes understood by Banker are the following :
+
+ * LANGUAGE=<name> Specify the language you wish to use, in case
+ it is different from the default locale. Note : this option will
+ only work if you're running Workbench 2.1 or higher (*note Notes
+ for 2.1 users::.).
+
+ * FILE=<path> Specify the file you want to load initially in
+ Banker.
+
+ * OPTIONSFILE=<path> Specify an alternate name for the default
+ configuration file (default is `s:.bankerconfig'
+
+
+The main window
+****************
+
+ This is the window that allows you to choose among the several
+features of Banker. It has menus and buttons.
+
+
+Menus
+======
+
+ The menus are the following
+
+ 1. The File menu
+ * Open Open a new file. Its name will be indicated in
+ the title bar of the main window. If there is already a file
+ present in memory and if it has been modified, Banker will
+ issue a warning telling you you're about to lose data. If
+ it's not your intention, cancel the Open order, save your
+ file and then you can Open safely.
+
+ * Save Save current file to disk. If no name had been
+ given yet, a file requester appears.
+
+ * Save as Save the current file under a name queried
+ through the file requester.
+
+ * Print Print the current file through a file
+ requester (suggesting `PRT:' by default) using the format
+ specified in the *PrintFormat* variable (*note The
+ Configuration File::.).
+
+ * Export Export the current database to a format
+ specified in the *ExportFormat* variable (*note The
+ Configuration File::.).
+
+ * Quit Quit Banker. If there is already a file present
+ in memory and if it has been modified, Banker will issue a
+ warning telling you you're about to lose data. If it's not
+ your intention, cancel the Quit order, save your file and
+ then you can Quit safely.
+
+ 2. The Preferences menu
+ * Save Will allow you to save the current settings to
+ the configuration file (*note The Configuration File::.),
+ mainly the positions of all the windows. Next time Banker is
+ started, the windows will be automatically positioned at the
+ place where you last moved them.
+
+
+Buttons
+========
+
+ The buttons perform the following actions :
+
+ * New Entry If you wish to add an entry to the current database,
+ select this button (*note The New Entry Window::.).
+
+ * List Entries Will take you to the List window in order to see
+ the contents of the current database, or to edit it (*note The
+ List Window::.).
+
+ * Automatic credit/debit If you wish to add a new Automatic entry
+ (that is : an entry that will be entered repeatedly and
+ automatically in the database), select this button (*note The
+ Automatic Entry Window::.).
+
+ * Clear File Will clear the current file, in order to start a new
+ one.
+
+
+The List window
+****************
+
+ This window gives you the full listing of your account until today.
+
+The list
+========
+
+ The appearance of what you see will depend on the variable
+*DisplayFormat* (*note The Configuration File::.). The only constant
+thing is the character displayed on the first column, which is one of :
+
+ * '+' Indicate a line that was generated by an automatic entry
+ (*note The Automatic Entry window::.).
+
+ * '*' Indicate an entry that has not been validated by your
+ bank.
+
+ * ' ' When no character is present, this entry was validated by
+ the bank
+
+Validate/Edit/Delete
+====================
+
+ The cycle gadget at the bottom of the window can alternate between
+three states. Depending on its value, clicking on one of the displayed
+lines will have a different behavior :
+
+ * Validate Validate this entry. The 'Validated total' gadget at the
+ bottom will be updated accordingly immediately.
+
+ * Edit Edit this entry. If you click on a regular entry, you
+ will be taken to the window editing a new entry (*note The New
+ Entry Window::.) but if this entry was generated by an automatic
+ entry, you are actually asking to edit the automatic entry (*note
+ The Automatic Entry Window::.).
+
+ * Delete Delete this entry. A warning will appear so you can
+ confirm your action. If you select an automatic entry, you're
+ actually asking the automatic entry to be removed, and therefore
+ all the generated entries. Use this option with great care!
+
+The total
+=========
+
+ Down on the right are two figures that represent the state of your
+account.
+
+ * Validated All the entries that were validated by your bank.
+ After you correctly updated these entries, the figure indicated
+ must match the one your bank is giving you.
+
+ * Total This is the actual total of what your account is (that
+ is, the validated total plus the new entries that were not
+ validated yet)
+
+
+The New Entry window
+*********************
+
+ This window allows you to enter a new entry. Its use is rather
+straightforward. The only mandatory fields are "Date" and "Amount". You
+can fill in the other fields depending on the value of your format
+variables (*note The Configuration File::.).
+
+ To specify a debit in your account, enter a negative figure in the
+"Amount" gadget.
+
+
+The New Automatic Entry window
+*******************************
+
+ This window allows you to enter a new automatic entry. Automatic
+entries are used when an amount is regularly credited (or debited) to
+your account. In this window, you can specify :
+
+ * The amount (may be negative to specify a debit)
+
+ * The delay between two entries
+
+ * The fields defining the Reason and the Imputation of the generated
+ entry. You're free not to fill these fields.
+
+ These automatic entries will generate entries that will be
+ signaled by a '+' in the List Window (*note The list window::.).
+
+
+The configuration file
+***********************
+
+ Banker can be customized in a simple yet flexible way.
+
+
+Output formats
+***************
+
+ There are three output formats controlled by three variables :
+ * listformat Control the entries displayed in the List Window
+ (*note THE LIST WINDOW::.)
+
+ * printformat Control how the entries are printed (*note Menus::.)
+
+ * exportformat Control how the entries are exported(*note Menus::.)
+
+ These three variables must respect a certain syntax. Each string
+ that you wish to include as is must be enclosed in quotation marks
+ ("). Any words not enclosed in quotation marks must be one of the
+ following :
+
+ * Date, Imputation, Reason, Amount, Transaction
+
+ * Any valid escape sequence from MUI's font engine
+
+ In order to have the list of these sequences, read the file
+ font_engine.doc in the Docs/ directory.
+
+ Example :
+
+ displayformat "<ESC>b" date "<ESC>n | $" amount " | " reason
+
+ will display the date in bold, followed by a vertical bar, then a
+ dollar, the amount, another bar and the reason field.
+
+ NOTE: <ESC> must be replaced with a *real* ESC character
+
+
+Date formats
+*************
+
+ You can ask Banker to display dates in many different formats.
+Depending on your Workbench version, not all the formats will be
+available.
+
+ * Workbench 2.0
+
+ * Workbench 2.1 and 3.0
+
+
+Windows open
+*************
+
+ Here you specify which windows you want to find open when you start
+Banker. For example :
+
+ mainwindow 1
+automatic 1
+list 1
+getEntry 0
+will display all the windows except the one where you enter a new entry.
+
+
+Autosave
+*********
+
+ Set the autosave interval in minutes. For example :
+
+ autosave 2
+
+Notes for 2.1 users
+********************
+
+
+Future enhancements
+********************
+
+Whereas primarily written for my own use, Banker quickly appeared as a
+program that might beneficiate from an intensive work and become a very
+powerful tool. Depending on the level of interest of this first version,
+next versions of Banker will incorporate the following features :
+
+
+Index
+******
+
+* Menu:
+
+* Arguments: LAUNCHING BANKER.
+* Changing the configuration file name: FROM WORKBENCH.
+* Changing the configuration file name: FROM CLI.
+* Export: Menus.
+* File menu: Menus.
+* gadtools: OVERVIEW.
+* gadtools: THE GRAPHIC INTERFACE.
+* Installation: INSTALLING BANKER.
+* Introduction: OVERVIEW.
+* Invisible shortcuts: THE GRAPHIC INTERFACE.
+* Launching from CLI: LAUNCHING BANKER.
+* Launching from Workbench: LAUNCHING BANKER.
+* locale: OVERVIEW.
+* Open: Menus.
+* Overview: OVERVIEW.
+* Print: Menus.
+* Quit: Menus.
+* Save: Menus.
+* Save as: Menus.
+* Shortcuts: THE GRAPHIC INTERFACE.
+* Specifying an initial file: FROM CLI.
+* Specifying the language: FROM CLI.
+* String gadgets: THE GRAPHIC INTERFACE.
+* TAB: THE GRAPHIC INTERFACE.
+* Tooltypes: LAUNCHING BANKER.
+
619 docs/banker.guide
@@ -0,0 +1,619 @@
+@database banker.guide
+
+@Master banker.texinfo
+
+@Width 72
+
+
+This is the AmigaGuide� file banker.guide, produced by Makeinfo-1.49 from
+the input file banker.texinfo.
+
+
+@Node Main "banker.guide"
+
+
+
+Welcome to Banker!!!
+**********************
+
+
+
+ @{" Overview " Link "Overview"} What is Banker?
+ @{" Banker status " Link "Banker status"} The legal status for Banker
+ @{" Installing banker " Link "Installing banker"} What you must do to install banker
+ @{" The graphic interface " Link "The graphic interface"} The bases of Amiga's graphic interface
+ @{" Launching banker " Link "Launching banker"} From Workbench or CLI
+ @{" The main window " Link "The main window"} How to select your action
+ @{" The list window " Link "The list window"} Display your account
+ @{" The New Entry window " Link "The New Entry window"} Enter a new entry
+ @{" The Automatic Entry window " Link "The Automatic Entry window"} Enter a new automatic entry
+ @{" The configuration file " Link "The configuration file"} How to customize Banker
+ @{" Notes for 2.1 users " Link "Notes for 2.1 users"} Special information for 2.1 users
+ @{" Future enhancements " Link "Future enhancements"} What is planned for the future
+ @{" Index " Link "Index"} Index
+
+
+@EndNode
+
+@Node "OVERVIEW" "banker.guide/OVERVIEW"
+@Toc "Main"
+
+Overview
+********
+
+ This manual describes *Banker*. Banker is a program designed to
+help you keep an accurate track of your bank accounts. Before going any
+further, if you are reading the file 'banker.doc', I must tell you that
+there is a much more comfortable to read this documentation : use the
+Amigaguide format. As you may have noticed, in the same directory is a
+file 'banker.guide'. If you have an Amigaguide reader (the most
+powerful is Amigaguide but if you don't have it, see your public domain
+library for this, there are plenty of them in there!), you will enjoy
+immensely the ability to browse through this documentation using
+Hypertext...
+
+ Banker's main features include :
+
+ 1. Entries can be entered as you choose it. 'Amount' and 'Dates' are
+ the only fields that are obligatory. You are free to enter the
+ other ones if you wish (see @{"The New Entry Window" Link "The New Entry Window"}).
+
+ 2. Three output formats are available : Display Format, Print Format
+ and Export Format (see @{"Output Formats" Link "Output Formats"}). You might want to
+ display on your screen only a limited number of information, but
+ may want to print the database fully (on a 132 columns printer for
+ example) and be able to save your file under another form
+ understandable by another program...
+
+ 3. Full 2.0 graphic user interface using MUI, the Magic User Interface
+
+ 4. Banker is fully localized (i.e. can speak several languages :
+ French, English, Italian, Dutch, etc... see @{"Installing Banker" Link "Installing Banker"}).
+
+ 5. Maximum use of the 2.0 OS features : IffParse(), ReadArgs(),
+ amigaguide.library, etc...
+
+ 6. User-definable autosave. No more data wasted because of an
+ unexpected power loss : Banker will save your file automatically.
+
+
+
+@EndNode
+
+@Node "BANKER STATUS" "banker.guide/BANKER STATUS"
+@Toc "Main"
+
+Banker's legal status
+*********************
+
+ This program is shareware and (C)1992 by C�dric BEUST. You may
+redistribute it freely provided :
+
+ 1. No benefits are made on it, and that the price asked doesn't
+ exceed the price of shipping and handling plus the one of the
+ supporting media.
+
+ 2. The distribution is given with every single file present and
+ unaltered. See the file Banker/FILES for a list of these files.
+ My name and copyright notices must remain intact.
+
+ 3. If you find this program useful and have been using it for more
+ than a month, you are morally forced (we know what this means...)
+ to send me a reasonable amount of money ($10 seems fine to me, but
+ if you send more you will enter my "privileged users" list).
+ Please send dollars or French francs unless you really can't do
+ otherwise. I can be reached to the following address :
+
+
+ C�dric BEUST
+"Les Ducs de Savoie"
+1, rue Roger Martin du Gard
+06000 NICE
+FRANCE
+email: beust@sa.inria.fr
+
+
+@EndNode
+
+@Node "INSTALLING BANKER" "banker.guide/INSTALLING BANKER"
+@Toc "Main"
+
+Installing Banker
+*****************
+
+ The operations needed to install Banker are very simple :
+
+ * From CLI : Copy the files Banker and Banker.info into your
+ favorite directory, and copy the configuration file in your `s:'
+ directory :
+
+ 1> copy Banker <dest>
+ 1> copy Banker.info <dest>
+ 1> copy s/.bankerconfig s:
+
+ * From Workbench : Simply drag the Banker icon into your favorite
+ directory. For the configuration file, it's hardly trickier :
+
+ 1. Select Window/Show all files from the Workbench menu
+
+ 2. Open the `s' drawer
+
+ 3. Double-click on the file `.bankerconfig' and replace
+ `.bankerconfig' with `copy .bankerconfig S:'
+
+
+@EndNode
+
+@Node "THE GRAPHIC INTERFACE" "banker.guide/THE GRAPHIC INTERFACE"
+@Toc "Main"
+
+The graphic interface
+*********************
+
+ Banker uses MUI, the Magic User Interface by Stefan Stuntz for its
+interface. Thus, you must have the MUI package in order to be able to
+use Banker. It can be retrieved on aminet, or directly from the author
+if you have no net access. Read the file "Readme.mui" for more
+information on MUI.
+
+ All you have to know of *gadtools* and *MUI* in order to use Banker
+is the following :
+
+ * In string gadgets, all the characters are allowed. Hitting
+ *RETURN* will deactivate the string gadgets. Then you can use the
+ shortcuts if any are present (see below)
+
+ * When you are in a string gadget, hit *TAB* to take the cursor to
+ the following string gadget (*Shift-TAB* will take you to the
+ previous one). When you reach the last one in the window, you are
+ taken back to the first (respectively the first to the last).
+
+ * When all the gadgets are deactivated (i.e. the cursor doesn't
+ appear in any string gadgets), you are free to use the mouse or
+ the shortcuts. They are indicated by a word with a letter
+ underlined. You can press the underlined letter to obtain the same
+ result as if you had pressed the gadget with the mouse.
+
+ * In every window, there are shortcuts that are always valid, even
+ though not clearly indicated. These are
+
+ * *ESC* will make the window disappear (same as selecting the
+ gadget *Cancel* (NB : the name will be different if you chose
+ to use another language)
+
+
+@EndNode
+
+@Node "LAUNCHING BANKER" "banker.guide/LAUNCHING BANKER"
+@Toc "Main"
+
+Launching Banker
+****************
+
+ You can execute Banker either from CLI or from the Workbench. You
+have the possibility in either case to give arguments that give Banker
+different directives.
+
+
+ @{" From CLI " Link "From CLI"} Launching from CLI
+ @{" From Workbench " Link "From Workbench"} Launching from Workbench
+
+
+@EndNode
+
+@Node "FROM CLI" "banker.guide/FROM CLI"
+@Toc "Launching Banker"
+
+From Cli
+========
+
+ If you launch Banker with a single quotation mark as argument, you
+will have the following template :
+
+1> banker ?
+Language/K,File/K,OptionsFile/K:
+
+ The meaning of these options is :
+
+ * LANGUAGE : Specify the language you wish to use, in case it is
+ different from the default locale. Note : this option will only
+ work if you're running Workbench 2.1 or higher (see
+ @{"Notes for 2.1 users" Link "Notes for 2.1 users"}).
+
+ * FILE : Specify the file you want to load initially in Banker.
+
+ * OPTIONSFILE : Specify an alternate name for the default
+ configuration file (default is `s:.bankerconfig')
+
+ For example, you might call Banker from CLI with the following
+syntax :
+
+1> banker FILE account.bank LANGUAGE italiano
+
+ or
+
+1> banker OPTIONSFILE CFG:Banker.cfg
+
+@EndNode
+
+@Node "FROM WORKBENCH" "banker.guide/FROM WORKBENCH"
+@Toc "Launching Banker"
+
+From Workbench
+==============
+
+Specifying arguments for Banker in the Workbench is accomplished through
+the `info' file. Click once on the Banker icon in order to activate it
+and then select Icon/Information from the menu (or press Right-Amiga
+I). A list of tooltypes appears. To add one, simply click on *Add* and
+type it in the activated string gadget. To modify an existing one,
+select it and do the same. See your Workbench Manual for more details.
+
+ The tooltypes understood by Banker are the following :
+
+ * LANGUAGE=<name> Specify the language you wish to use, in case
+ it is different from the default locale. Note : this option will
+ only work if you're running Workbench 2.1 or higher (see
+ @{"Notes for 2.1 users" Link "Notes for 2.1 users"}).
+
+ * FILE=<path> Specify the file you want to load initially in
+ Banker.
+
+ * OPTIONSFILE=<path> Specify an alternate name for the default
+ configuration file (default is `s:.bankerconfig'
+
+
+@EndNode
+
+@Node "THE MAIN WINDOW" "banker.guide/THE MAIN WINDOW"
+@Toc "Main"
+
+The main window
+***************
+
+ This is the window that allows you to choose among the several
+features of Banker. It has menus and buttons.
+
+
+ @{" Menus " Link "Menus"} Using the menus
+ @{" Buttons " Link "Buttons"} Using the buttons
+
+
+@EndNode
+
+@Node "Menus" "banker.guide/Menus"
+@Toc "The Main Window"
+
+Menus
+=====
+
+ The menus are the following
+
+ 1. The File menu
+ * Open Open a new file. Its name will be indicated in
+ the title bar of the main window. If there is already a file
+ present in memory and if it has been modified, Banker will
+ issue a warning telling you you're about to lose data. If
+ it's not your intention, cancel the Open order, save your
+ file and then you can Open safely.
+
+ * Save Save current file to disk. If no name had been
+ given yet, a file requester appears.
+
+ * Save as Save the current file under a name queried
+ through the file requester.
+
+ * Print Print the current file through a file
+ requester (suggesting `PRT:' by default) using the format
+ specified in the *PrintFormat* variable (see
+ @{"The Configuration File" Link "The Configuration File"}).
+
+ * Export Export the current database to a format
+ specified in the *ExportFormat* variable (see
+ @{"The Configuration File" Link "The Configuration File"}).
+
+ * Quit Quit Banker. If there is already a file present
+ in memory and if it has been modified, Banker will issue a
+ warning telling you you're about to lose data. If it's not
+ your intention, cancel the Quit order, save your file and
+ then you can Quit safely.
+
+ 2. The Preferences menu
+ * Save Will allow you to save the current settings to
+ the configuration file (see @{"The Configuration File" Link "The Configuration File"}), mainly
+ the positions of all the windows. Next time Banker is
+ started, the windows will be automatically positioned at the
+ place where you last moved them.
+
+
+@EndNode
+
+@Node "Buttons" "banker.guide/Buttons"
+@Toc "The Main Window"
+
+Buttons
+=======
+
+ The buttons perform the following actions :
+
+ * New Entry If you wish to add an entry to the current database,
+ select this button (see @{"The New Entry Window" Link "The New Entry Window"}).
+
+ * List Entries Will take you to the List window in order to see
+ the contents of the current database, or to edit it (see
+ @{"The List Window" Link "The List Window"}).
+
+ * Automatic credit/debit If you wish to add a new Automatic entry
+ (that is : an entry that will be entered repeatedly and
+ automatically in the database), select this button (see
+ @{"The Automatic Entry Window" Link "The Automatic Entry Window"}).
+
+ * Clear File Will clear the current file, in order to start a new
+ one.
+
+
+@EndNode
+
+@Node "THE LIST WINDOW" "banker.guide/THE LIST WINDOW"
+@Toc "Main"
+
+The List window
+***************
+
+ This window gives you the full listing of your account until today.
+
+The list
+========
+
+ The appearance of what you see will depend on the variable
+*DisplayFormat* (see @{"The Configuration File" Link "The Configuration File"}). The only constant thing
+is the character displayed on the first column, which is one of :
+
+ * '+' Indicate a line that was generated by an automatic entry
+ (see @{"The Automatic Entry window" Link "The Automatic Entry window"}).
+
+ * '*' Indicate an entry that has not been validated by your
+ bank.
+
+ * ' ' When no character is present, this entry was validated by
+ the bank
+
+Validate/Edit/Delete
+====================
+
+ The cycle gadget at the bottom of the window can alternate between
+three states. Depending on its value, clicking on one of the displayed
+lines will have a different behavior :
+
+ * Validate Validate this entry. The 'Validated total' gadget at the
+ bottom will be updated accordingly immediately.
+
+ * Edit Edit this entry. If you click on a regular entry, you
+ will be taken to the window editing a new entry (see
+ @{"The New Entry Window" Link "The New Entry Window"}) but if this entry was generated by an
+ automatic entry, you are actually asking to edit the automatic
+ entry (see @{"The Automatic Entry Window" Link "The Automatic Entry Window"}).
+
+ * Delete Delete this entry. A warning will appear so you can
+ confirm your action. If you select an automatic entry, you're
+ actually asking the automatic entry to be removed, and therefore
+ all the generated entries. Use this option with great care!
+
+The total
+=========
+
+ Down on the right are two figures that represent the state of your
+account.
+
+ * Validated All the entries that were validated by your bank.
+ After you correctly updated these entries, the figure indicated
+ must match the one your bank is giving you.
+
+ * Total This is the actual total of what your account is (that
+ is, the validated total plus the new entries that were not
+ validated yet)
+
+
+@EndNode
+
+@Node "THE NEW ENTRY WINDOW" "banker.guide/THE NEW ENTRY WINDOW"
+@Toc "Main"
+
+The New Entry window
+********************
+
+ This window allows you to enter a new entry. Its use is rather
+straightforward. The only mandatory fields are "Date" and "Amount". You
+can fill in the other fields depending on the value of your format
+variables (see @{"The Configuration File" Link "The Configuration File"}).
+
+ To specify a debit in your account, enter a negative figure in the
+"Amount" gadget.
+
+
+@EndNode
+
+@Node "THE AUTOMATIC ENTRY WINDOW" "banker.guide/THE AUTOMATIC ENTRY WINDOW"
+@Toc "Main"
+
+The New Automatic Entry window
+******************************
+
+ This window allows you to enter a new automatic entry. Automatic
+entries are used when an amount is regularly credited (or debited) to
+your account. In this window, you can specify :
+
+ * The amount (may be negative to specify a debit)
+
+ * The delay between two entries
+
+ * The fields defining the Reason and the Imputation of the generated
+ entry. You're free not to fill these fields.
+
+ These automatic entries will generate entries that will be
+ signaled by a '+' in the List Window (see @{"The list window" Link "The list window"}).
+
+
+@EndNode
+
+@Node "THE CONFIGURATION FILE" "banker.guide/THE CONFIGURATION FILE"
+@Toc "Main"
+
+The configuration file
+**********************
+
+ Banker can be customized in a simple yet flexible way.
+
+
+ @{" Output formats " Link "Output formats"} How to change the representation of what you see and get
+ @{" Date formats " Link "Date formats"} To choose between several representations of dates
+ @{" Windows open " Link "Windows open"} Indicate which windows you want to be open on start
+ @{" Autosave " Link "Autosave"} Set the autosave interval
+
+
+@EndNode
+
+@Node "Output formats" "banker.guide/Output formats"
+@Toc "The configuration file"
+
+Output formats
+**************
+
+ There are three output formats controlled by three variables :
+ * listformat Control the entries displayed in the List Window
+ (see @{"THE LIST WINDOW" Link "THE LIST WINDOW"})
+
+ * printformat Control how the entries are printed (see @{"Menus" Link "Menus"})
+
+ * exportformat Control how the entries are exported(see @{"Menus" Link "Menus"})
+
+ These three variables must respect a certain syntax. Each string
+ that you wish to include as is must be enclosed in quotation marks
+ ("). Any words not enclosed in quotation marks must be one of the
+ following :
+
+ * Date, Imputation, Reason, Amount, Transaction
+
+ * Any valid escape sequence from MUI's font engine
+
+ In order to have the list of these sequences, read the file
+ font_engine.doc in the Docs/ directory.
+
+ Example :
+
+ displayformat "<ESC>b" date "<ESC>n | $" amount " | " reason
+
+ will display the date in bold, followed by a vertical bar, then a
+ dollar, the amount, another bar and the reason field.
+
+ NOTE: <ESC> must be replaced with a *real* ESC character
+
+
+@EndNode
+
+@Node "Date formats" "banker.guide/Date formats"
+@Toc "The configuration file"
+
+Date formats
+************
+
+ You can ask Banker to display dates in many different formats.
+Depending on your Workbench version, not all the formats will be
+available.
+
+ * Workbench 2.0
+
+ * Workbench 2.1 and 3.0
+
+
+@EndNode
+
+@Node "Windows open" "banker.guide/Windows open"
+@Toc "The configuration file"
+
+Windows open
+************
+
+ Here you specify which windows you want to find open when you start
+Banker. For example :
+
+ mainwindow 1
+automatic 1
+list 1
+getEntry 0
+will display all the windows except the one where you enter a new entry.
+
+
+@EndNode
+
+@Node "Autosave" "banker.guide/Autosave"
+@Toc "The configuration file"
+
+Autosave
+********
+
+ Set the autosave interval in minutes. For example :
+
+ autosave 2
+
+@EndNode
+
+@Node "NOTES FOR 2.1 USERS" "banker.guide/NOTES FOR 2.1 USERS"
+@Toc "Main"
+
+Notes for 2.1 users
+*******************
+
+
+@EndNode
+
+@Node "FUTURE ENHANCEMENTS" "banker.guide/FUTURE ENHANCEMENTS"
+@Toc "Main"
+
+Future enhancements
+*******************
+
+Whereas primarily written for my own use, Banker quickly appeared as a
+program that might beneficiate from an intensive work and become a very
+powerful tool. Depending on the level of interest of this first version,
+next versions of Banker will incorporate the following features :
+
+
+@EndNode
+
+@Node "INDEX" "banker.guide/INDEX"
+@Toc "Main"
+
+Index
+*****
+
+
+
+ @{" Arguments " Link "LAUNCHING BANKER"} LAUNCHING BANKER
+ @{" Changing the configuration file name " Link "FROM WORKBENCH"} FROM WORKBENCH
+ @{" Changing the configuration file name " Link "FROM CLI"} FROM CLI
+ @{" Export " Link "Menus"} Menus
+ @{" File menu " Link "Menus"} Menus
+ @{" gadtools " Link "OVERVIEW"} OVERVIEW
+ @{" gadtools " Link "THE GRAPHIC INTERFACE"} THE GRAPHIC INTERFACE
+ @{" Installation " Link "INSTALLING BANKER"} INSTALLING BANKER
+ @{" Introduction " Link "OVERVIEW"} OVERVIEW
+ @{" Invisible shortcuts " Link "THE GRAPHIC INTERFACE"} THE GRAPHIC INTERFACE
+ @{" Launching from CLI " Link "LAUNCHING BANKER"} LAUNCHING BANKER
+ @{" Launching from Workbench " Link "LAUNCHING BANKER"} LAUNCHING BANKER
+ @{" locale " Link "OVERVIEW"} OVERVIEW
+ @{" Open " Link "Menus"} Menus
+ @{" Overview " Link "OVERVIEW"} OVERVIEW
+ @{" Print " Link "Menus"} Menus
+ @{" Quit " Link "Menus"} Menus
+ @{" Save " Link "Menus"} Menus
+ @{" Save as " Link "Menus"} Menus
+ @{" Shortcuts " Link "THE GRAPHIC INTERFACE"} THE GRAPHIC INTERFACE
+ @{" Specifying an initial file " Link "FROM CLI"} FROM CLI
+ @{" Specifying the language " Link "FROM CLI"} FROM CLI
+ @{" String gadgets " Link "THE GRAPHIC INTERFACE"} THE GRAPHIC INTERFACE
+ @{" TAB " Link "THE GRAPHIC INTERFACE"} THE GRAPHIC INTERFACE
+ @{" Tooltypes " Link "LAUNCHING BANKER"} LAUNCHING BANKER
+
+@EndNode
+
52 docs/font_engine.doc
@@ -0,0 +1,52 @@
+NOTE: THIS FILE IS AN EXCERPT FROM THE FILE MUI_text.doc, in the MUI
+developer's distribution.
+
+----------------------------------------------------------------------
+
+
+ Whenever MUI prints strings, they may contain some special
+ character sequences defining format, color and style of the text.
+
+ '\n' Start a new line. With this character you can e.g. create
+ multi line buttons.
+
+ ESC - Disable text engine, following chars will be printed
+ without further parsing.
+
+ ESC u Set the soft style to underline.
+
+ ESC b Set the soft style to bold.
+
+ ESC i Set the soft style to italic.
+
+ ESC n Set the soft style back to normal.
+
+ ESC <n> Use pen number n (0..9) as front pen. n must be a valid
+ DrawInfo pen as specified in "intuition/screens.h".
+
+ ESC c Center current (and following) line(s).
+ This sequence is only valid at the beginning of a
+ string or after a newline character.
+
+ ESC r Right justify current (and following) line(s).
+ This sequence is only valid at the beginning of a
+ string or after a newline character.
+
+ ESC l Left justify current (and following) line(s).
+ This sequence is only valid at the beginning of a
+ string or after a newline character.
+
+ ESC I[s] Draw MUI image with specification <s>.
+
+ Note: These rules apply to all MUI strings, not only to
+ a text objects contents. You can e.g. format the
+ columns of a listview or include images in a cycle
+ gadgets entries.
+
+ EXAMPLE
+ ...
+ MUIA_Text_Contents, "\33c\33bMUI\33n\nis magic"
+ ...
+
+ would look like | MUI | <-- bold
+ | is magic | <-- normal
BIN  examples/File.bank.info
Binary file not shown
BIN  examples/file.bank
Binary file not shown
10 src/SCOPTIONS
@@ -0,0 +1,10 @@
+ANSI
+IGNORE=217
+IGNORE=93
+IGNORE=154
+IGNORE=161
+IGNORE=88
+IGNORE=93
+IGNORE=84
+IGNORE=100
+MultipleCharaCtercONStants
206 src/automatic.c
@@ -0,0 +1,206 @@
+/*
+ * automatic.c
+ */
+
+/* $Id: automatic.c,v 1.4 1993/09/03 00:17:28 beust Exp beust $ */
+
+#include "common.h"
+#include "locale_strings.h"
+
+static struct _Automatic LastSelectedAutomatic;
+
+/********************************************************************************
+ * Private part
+ ********************************************************************************/
+
+static Automatic
+getAutomaticFromGadgets(Gui_t gui)
+{
+ Automatic result;
+ char *fromBuffer, *toBuffer, *amountBuffer, *daysBuffer, *weeksBuffer,
+ *monthsBuffer, *yearsBuffer, *transactionBuffer, *imputationBuffer;
+
+ NEW(result, struct _Automatic);
+
+ get(gui -> auFrom, MUIA_String_Contents, & fromBuffer);
+ get(gui -> auTo, MUIA_String_Contents, & toBuffer);
+ get(gui -> auAmount, MUIA_String_Contents, & amountBuffer);
+ get(gui -> auDays, MUIA_String_Contents, & daysBuffer);
+ get(gui -> auWeeks, MUIA_String_Contents, & weeksBuffer);
+ get(gui -> auMonths, MUIA_String_Contents, & monthsBuffer);
+ get(gui -> auYears, MUIA_String_Contents, & yearsBuffer);
+ get(gui -> auReason, MUIA_String_Contents, & transactionBuffer);
+ get(gui -> auImputation, MUIA_String_Contents, & imputationBuffer);
+
+ result -> first = *myStrToDate(fromBuffer);
+ result -> last = *myStrToDate(toBuffer);
+ result -> repeatDays = atoi(daysBuffer);
+ result -> repeatWeeks = atoi(weeksBuffer);
+ result -> repeatMonths = atoi(monthsBuffer);
+ result -> repeatYears = atoi(yearsBuffer);
+ strcpy(result -> transaction, transactionBuffer);
+ strcpy(result -> imputation, imputationBuffer);
+ strcpy(result -> amount, amountBuffer);
+
+ return result;
+}
+
+static void
+setAutomaticGadgetsToAuto(Gui_t gui, Automatic aut)
+{
+ struct DateStamp current;
+ int windowOpen;
+
+ get(gui -> automaticWindowObject, MUIA_Window_Open, & windowOpen);
+ if (windowOpen) {
+ set(gui -> automaticWindowObject, MUIA_Window_Open, TRUE);
+ DateStamp(& current);
+ if (aut == NULL) {
+ set(gui -> auFrom, MUIA_String_Contents, myDateToStr(& current));
+ set(gui -> auTo, MUIA_String_Contents, "");
+ set(gui -> auAmount, MUIA_String_Contents, "");
+ set(gui -> auDays, MUIA_String_Contents, 0);
+ set(gui -> auWeeks, MUIA_String_Contents, 0);
+ set(gui -> auMonths, MUIA_String_Contents, 0);
+ set(gui -> auYears, MUIA_String_Contents, 0);
+ set(gui -> auReason, MUIA_String_Contents, "");
+ set(gui -> auImputation, MUIA_String_Contents, "");
+ }
+ else {
+ char days[8], weeks[8], months[8], years[8];
+ sprintf(days, "%d", aut -> repeatDays);
+ sprintf(weeks, "%d", aut -> repeatWeeks);
+ sprintf(months, "%d", aut -> repeatMonths);
+ sprintf(years, "%d", aut -> repeatYears);
+ set(gui -> auFrom, MUIA_String_Contents, myDateToStr(& aut -> first));
+ set(gui -> auTo, MUIA_String_Contents, myDateToStr(& aut -> last));
+ set(gui -> auAmount, MUIA_String_Contents, aut -> amount);
+ set(gui -> auDays, MUIA_String_Contents, days);
+ set(gui -> auWeeks, MUIA_String_Contents, weeks);
+ set(gui -> auMonths, MUIA_String_Contents, months);
+ set(gui -> auYears, MUIA_String_Contents, years);
+ set(gui -> auReason, MUIA_String_Contents, aut -> transaction);
+ set(gui -> auImputation, MUIA_String_Contents, aut -> imputation);
+ }
+ }
+}
+
+/********************************************************************************
+ * Public part
+ ********************************************************************************/
+
+
+void
+clearAutomaticGadgets(Gui_t gui)
+{
+ setAutomaticGadgetsToAuto(gui, NULL);
+ set(gui -> auNew, MUIA_Disabled, FALSE);
+ set(gui -> auAdd, MUIA_Disabled, FALSE);
+ set(gui -> auReplace, MUIA_Disabled, TRUE);
+ set(gui -> auDelete, MUIA_Disabled, TRUE);
+}
+
+
+void
+openAutomaticWindow(Gui_t gui, Entries entries)
+{
+ struct MinList *ml;
+ struct Node *node;
+
+ /* Open the window */
+ set(gui -> automaticWindowObject, MUIA_Window_Open, TRUE);
+
+ /* Fill the gadgets */
+ buildList(gui, entries, FALSE, TRUE, & gui -> autoSA);
+ /* an automatic, want it sorted */
+ setAutomaticGadgetsToAuto(gui, NULL);
+
+/*@@ running the list
+ printf("auto list:\n");
+ for (node = ml -> lh_Head; node -> ln_Succ; node = node -> ln_Succ) {
+ printf("node: '%s'\n", node -> ln_Name);
+ }
+*/
+}
+
+void
+newAutomatic(Gui_t gui, Entries entries)
+{
+ clearAutomaticGadgets(gui);
+}
+
+void
+replaceAutomatic(Gui_t gui, Entries entries)
+{
+ Automatic new, old;
+ new = getAutomaticFromGadgets(gui);
+ old = & LastSelectedAutomatic;
+
+ /* Replace the old entry */
+ DB_ReplaceEntry((DataBase) entries -> automatic, old, new);
+
+ buildList(gui, entries, FALSE, TRUE, & gui -> autoSA);
+ /* an automatic, want it sorted */
+ fullDisplayList(gui, entries);
+ FileModified = 1;
+ clearAutomaticGadgets(gui);
+
+}
+
+void
+addAutomatic(Gui_t gui, Entries entries)
+{
+ Automatic aut;
+ aut = getAutomaticFromGadgets(gui);
+
+ /* Add this entry */
+ DB_AddEntry((DataBase) entries -> automatic, aut);
+
+ FileModified = 1;
+
+ /* update the main list window */
+ buildList(gui, entries, FALSE, TRUE, & gui -> autoSA);
+ /* an automatic, want it sorted */
+
+ fullDisplayList(gui, entries);
+
+ clearAutomaticGadgets(gui);
+
+}
+
+void
+deleteAutomatic(Gui_t gui, Entries entries, Automatic aut)
+{
+ int n;
+ if (aut == NULL) {
+ get(gui -> auListObject, MUIA_List_Active, &n);
+ aut = DB_NthEntry(entries -> automatic, n);
+ }
+
+ /* Delete this entry */
+ DB_RemoveEntry((DataBase) entries -> automatic, aut);
+ FileModified = 1;
+
+ buildList(gui, entries, FALSE, TRUE, & gui -> autoSA);
+ fullDisplayList(gui, entries);
+ clearAutomaticGadgets(gui);
+}
+
+void
+editAutomatic(Gui_t gui, Automatic automatic)
+{
+ set(gui -> auNew, MUIA_Disabled, FALSE);
+ set(gui -> auAdd, MUIA_Disabled, FALSE);
+
+ setAutomaticGadgetsToAuto(gui, automatic);
+ if (automatic) {
+ LastSelectedAutomatic = *automatic;
+ set(gui -> auReplace, MUIA_Disabled, FALSE);
+ set(gui -> auDelete, MUIA_Disabled, FALSE);
+ }
+ else {
+ set(gui -> auReplace, MUIA_Disabled, TRUE);
+ set(gui -> auDelete, MUIA_Disabled, TRUE);
+ }
+}
+
555 src/common.c
@@ -0,0 +1,555 @@
+/*
+ * common.c
+ */
+
+/* $Id: common.c,v 1.5 1993/09/03 00:17:28 beust Exp beust $ */
+
+#define STRINGARRAY
+
+#include "common.h"
+
+BOOL FileModified; /* True if file was modified */
+char FileName[128]; /* last accessed filename */
+char ExportFileName[128]; /* exported file name */
+char PrintFileName[128]; /* print filename */
+char Pattern[128]; /* pattern for file requester */
+char ExportPattern[128]; /* pattern for export requester */
+char PrintPattern[128]; /* pattern for print requester */
+
+
+/* The console window used for output */
+FILE *BankerWindow = stderr;
+
+struct IconBase *IconBase = NULL;
+struct IFFParseBase *IFFParseBase = NULL;
+struct GadToolsBase *GadToolsBase = NULL;
+struct UtilityBase *UtilityBase = NULL;
+struct IntuitionBase* IntuitionBase = NULL;
+struct GfxBase* GfxBase = NULL;
+struct LocaleBase *LocaleBase = NULL;
+struct DOSBase *DOSBase= NULL;
+
+struct Locale *MyLocale = NULL;
+struct Catalog *MyCatalog = NULL;
+
+Entries MainList;
+
+/* Used to parse date with respect to locale */
+#define LOCALEDATEBUFFERSIZE 100
+char LocaleDateBuffer[LOCALEDATEBUFFERSIZE];
+int LocaleDateBufferPos = 0;
+
+/* Command line */
+char *CL_Usage = "Language/K,File/K,OptionsFile/K";
+struct CommandLineStruct CL_Struct;
+
+/* Options file */
+struct OptionsFileStruct OF_Struct;
+
+/* Format variables */
+struct StringAspect PrintFormatStructure, ExportFormatStructure,
+ DisplayFormatStructure;
+
+struct ListEntry DisplayEntryFormat[MAX_FIELDS];
+
+/* Automatic backup */
+struct timerequest *AutosaveTR = NULL; /* autosave time request */
+LONG AutosaveSignal;
+struct MsgPort *AutosavePort = NULL;
+
+/* Asl */
+struct AslBase *AslBase = NULL;
+
+/* Gadtools */
+struct Screen *MyScreen;
+struct Window *GlobalWindow, *BDWindow, /* backdrop window */
+ *GetentryWindow, *AutomaticWindow, *ListWindow;
+char ScreenTitle[128];
+
+int UniqueID = 0;
+
+/***********
+ * Private
+ ***********/
+
+
+void
+freeEntry(Entry entry)
+{
+}
+
+void
+freeAutomatic(Automatic aut)
+{
+}
+
+
+char
+getSignificantCharacter(int n)
+{
+ char result, *s = GetCatalogStr(MyCatalog, n, AppStrings[n].as_Str), *p;
+
+ result = s[0];
+ p = s;
+ while (*p && *p != '_') p++;
+ if (*p && *(p+1)) result = *(p+1);
+ result = ToLower(result);
+
+ return result;
+}
+
+char *
+getString(int n)
+{
+ char *result = (char *) GetCatalogStr(MyCatalog, n, AppStrings[n].as_Str), *p;
+ result = strdup(result);
+ p = result;
+ while (*p && *p != '_') p++;
+ if (*p == '_') {
+ while (*p != '\0') { *p = *(p+1); p++; }
+ }
+ return result;
+/*
+ char *result;
+
+ STRPTR s;
+
+ s = AppStrings[n].as_Str;
+ if (MyCatalog)
+ result = GetCatalogStr(MyCatalog, n, s);
+ else
+ result = s;
+
+ return result;
+*/
+}
+
+void
+openLocale(char *locale)
+{
+ if ((LocaleBase = (struct LocaleBase *)
+ OpenLibrary("locale.library", 38L)) == NULL) {
+ myMsg1("couldn't open locale.library, using default language");
+ }
+ else {
+ if (LocaleBase == NULL ||
+ (LocaleBase && LocaleBase -> lb_LibNode.lib_Revision < 27)) {
+ myMsg1(getString(MSG_BETA_VERSION));
+ }
+
+ MyCatalog = OpenCatalog(NULL, "banker.catalog",
+ OC_BuiltInLanguage, "english",
+/*
+ OC_Language, locale,
+*/
+ TAG_DONE);
+ printf("string = '%s'\n",
+ GetCatalogStr(MyCatalog, MSG_MENU_FILE, "engllish"));
+ if (MyCatalog == NULL)
+ myMsg3("OpenCatalog NULL", "IoErr():", IoErr());
+ } /* else */
+}
+
+/*********
+ * General
+ *********/
+
+void
+myMsg1(char *s1)
+{
+ fprintf(BankerWindow, "%s\n", s1);
+}
+
+void
+myMsg2(char *s1, char *s2)
+{
+ fprintf(BankerWindow, "%s : %s\n", s1, s2);
+}
+
+void
+myMsg3(char *s1, char *s2, int n)
+{
+ fprintf(BankerWindow, "%s : %s (%d)\n", s1, s2, n);
+}
+
+void
+closeAll()
+{
+
+/* Delete autosave stuff */
+ if (AutosaveTR) {
+ if (OF_Struct.autoSave > 0) AbortIO(AutosaveTR);
+ CloseDevice((struct IORequest *) AutosaveTR);
+ DeleteExtIO((struct IORequest *) AutosaveTR);
+ }
+ DeletePort(AutosavePort);
+
+/* Delete the crash file */
+ DeleteFile(crashFileName(FileName));
+
+/* Close the screen */
+ if (MyScreen) CloseScreen(MyScreen); MyScreen = NULL;
+
+/* And the possible output window */
+ if (BankerWindow != stderr)
+ fclose(BankerWindow);
+
+/* And all the libraries */
+ if (AslBase) CloseLibrary(AslBase); AslBase = NULL;
+ if (GfxBase) CloseLibrary(GfxBase); GfxBase = NULL;
+ if (IFFParseBase) CloseLibrary(IFFParseBase); IFFParseBase = NULL;
+ if (GadToolsBase) CloseLibrary(GadToolsBase); GadToolsBase = NULL;
+ if (UtilityBase) CloseLibrary(UtilityBase); UtilityBase = NULL;
+ if (IconBase) CloseLibrary(IconBase); IconBase = NULL;
+
+}
+
+void
+openLibraries(Entries *entries)
+{
+ ULONG error;
+
+ DOSBase = (struct DOSBase *) OpenLibrary("dos.library", 37L);
+ if (! DOSBase) {
+ myMsg1("couldn't open dos.library");
+ closeAll();
+ }
+
+ IntuitionBase = (struct IntuitionBase *) OpenLibrary("intuition.library", 37L);
+ if (! IntuitionBase) {
+ myMsg1("couldn't open intuition.library");
+ closeAll();
+ }
+
+ LocaleBase = (struct LocaleBase *) OpenLibrary("locale.library", 38L);
+ if (! LocaleBase) {
+ myMsg1("couldn't open locale.library, using default language");
+ }
+ else {
+ if (LocaleBase -> lb_LibNode.lib_Revision < 27) {
+ myMsg1(getString(MSG_BETA_VERSION));
+ }
+ MyCatalog = OpenCatalog(NULL, "banker.catalog",
+ OC_BuiltInLanguage, "english",
+ TAG_DONE);
+ if (MyCatalog == NULL)
+ myMsg3("OpenCatalog NULL", "IoErr():", IoErr());
+ } /* else */
+
+ AslBase = (struct AslBase *) OpenLibrary("asl.library", 37L);
+ if (! AslBase) {
+ myMsg1("couldn't open asl.library");
+ closeAll();
+ }
+
+ GfxBase= (struct GfxBase*) OpenLibrary("graphics.library", 37L);
+ if (! GfxBase) {
+ myMsg1("couldn't open graphics.library");
+ closeAll();
+ }
+
+ IFFParseBase = (struct IFFParseBase *) OpenLibrary("iffparse.library", 0L);
+ if (! IFFParseBase) {
+ myMsg1("couldn't open iffparse.library");
+ closeAll();
+ }
+
+ GadToolsBase = (struct GadToolsBase*) OpenLibrary("gadtools.library", 37L);
+ if (! GadToolsBase) {
+ myMsg1("couldn't open gadtools.library");
+ closeAll();
+ }
+
+ UtilityBase= (struct UtilityBase*) OpenLibrary("utility.library", 37L);
+ if (! UtilityBase) {
+ myMsg1("couldn't open utility.library");
+ closeAll();
+ }
+
+ IconBase= (struct IconBase*) OpenLibrary("icon.library", 37L);
+ if (! IconBase) {
+ myMsg1("couldn't open icon.library");
+ closeAll();
+ }
+
+ NEW(*entries, struct _Entries);
+
+ (*entries) -> list = (Entry *)
+ DB_NewDataBase(sizeof(struct _Entry), freeEntry);
+ (*entries) -> automatic =(Automatic*)
+ DB_NewDataBase(sizeof(struct _Automatic), freeAutomatic);
+
+/* Global variables changing through the execution */
+ strcpy(FileName, getString(MSG_NO_FILE_LOADED));
+ ExportFileName[0] = '\0';
+ strcpy(PrintFileName, "PRT:");
+ strcpy(Pattern, "#?.bank");
+ strcpy(PrintPattern, "");
+ strcpy(ExportPattern, "");
+
+/* Allocate structures for autosave */
+ AutosavePort = (struct MsgPort *) CreatePort(0, 0);
+ if (! AutosavePort) {
+ myMsg1("*** couldn't allocate autosave port");
+ closeAll();
+ }
+
+ AutosaveSignal = 1 << AutosavePort -> mp_SigBit;
+
+ AutosaveTR = (struct timerequest *)
+ CreateExtIO(AutosavePort, sizeof(struct timerequest));
+
+ if (! AutosaveTR) {
+ myMsg1("*** couldn't allocate time request");
+ closeAll();
+ }
+
+ error = OpenDevice(TIMERNAME, UNIT_VBLANK, (struct IORequest*) AutosaveTR, 0L);
+ if (error) {
+ myMsg3("*** couldn't open device", TIMERNAME, error);
+ closeAll();
+ }
+
+/* Initialize windows */
+ GetentryWindow = NULL;
+ AutomaticWindow = NULL;
+ ListWindow = NULL;
+
+/* The file hasn't been modified yet */
+ FileModified = 0;
+
+/* Defaults values for options */
+ OF_Struct.mainWindow.isOpen = TRUE;
+ OF_Struct.list.isOpen = FALSE;
+ OF_Struct.automatic.isOpen = FALSE;
+ OF_Struct.getEntry.isOpen = FALSE;
+
+ OF_Struct.dateFormat = "%D"; /* default extended date %m/%d/%y */
+ OF_Struct.defaultDate = "CDN"; /* default poor-man's-date mm-dd-yy */
+ OF_Struct.autoSave = 1; /* 1 minute */
+
+ OF_Struct.displayFormat = "date amount transaction \"F\""; /* default %m/%d/%y */
+ OF_Struct.exportFormat = "date amount transaction \"F\""; /* default %m/%d/%y */
+ OF_Struct.printFormat = "date amount transaction \"F\""; /* default %m/%d/%y */
+ readOptionsFile();
+}
+
+char *
+crashFileName(char *filename)
+{
+ char *result = (char *) malloc(strlen(filename) + 10);
+ strcpy(result, filename);
+ strcat(result, ".crash");
+ return result;
+}
+
+void
+readEnvironment(int argc, char **argv)
+{
+ struct CSource cs;
+ struct RDArgs rda, *rda2;
+ struct CommandLineStruct result;
+ char language[64];
+
+ result.filename = NULL;
+ result.language = NULL;
+ result.optionsFile= NULL;
+
+ if (argc) { /* called from CLI */
+ BankerWindow = stderr;
+ rda2 = ReadArgs(CL_Usage, & result, NULL);
+
+ /* We have to copy any returned value, its reference is not safe */
+ if (result.filename) {
+ CL_Struct.filename = (char *) malloc(strlen(result.filename) + 2);
+ strcpy(CL_Struct.filename, result.filename);
+ }
+
+ if (result.language) {
+ CL_Struct.language = (char *) malloc(strlen(result.language) + 2);
+ strcpy(CL_Struct.language, result.language);
+ }
+
+ if (result.optionsFile) {
+ CL_Struct.optionsFile = (char *) malloc(strlen(result.optionsFile) + 2);
+ strcpy(CL_Struct.optionsFile, result.optionsFile);
+ }
+
+ FreeArgs(rda2);
+ }
+
+ else { /* called from Workbench */
+ struct WBStartup *wbs;
+ struct WBArg *wba;
+ struct DiskObject *dobj;
+ char **array, *s;
+ int i;
+
+ BankerWindow = fopen(BANKEROUTPUTWINDOW, "w");
+
+ wbs = (struct WBStartup *) argv; /* cast argc into WBStartup */
+ wba = & wbs -> sm_ArgList[0]; /* retrieve argv[0] (ourselves) */
+ myMsg2("getting disk object", wba -> wa_Name);
+ dobj = GetDiskObject(wba -> wa_Name); /* and find the disk object */
+
+ /* Retrieve all the tooltypes for myself */
+ array = (char **) dobj -> do_ToolTypes;
+ if (array) { /* there are tooltypes */
+ if ((s = FindToolType(array, "FILE"))) {
+ CL_Struct.filename = strdup(s);
+ }
+ if ((s = FindToolType(array, "OPTIONSFILE"))) {
+ CL_Struct.optionsFile = strdup(s);
+ }
+ if ((s = FindToolType(array, "LANGUAGE"))) {
+ CL_Struct.language = strdup(s);
+ }
+ }
+
+ /* Parse all the files that were possibly multi-selected with me */
+ for (i = 1; i < wbs -> sm_NumArgs; i++) { /* read all the icons */
+ wba = & wbs -> sm_ArgList[i];
+ if (wba -> wa_Lock != NULL && *wba -> wa_Name)
+ CurrentDir(wba -> wa_Lock); /* change to this directory */
+ }
+ }
+
+ MyLocale = OpenLocale(CL_Struct.language);
+
+}
+
+void __saveds __asm putCharFunc(register __a0 struct Hook *h,
+ register __a2 void *object,
+ register __a1 char c)
+{
+ if (LocaleDateBufferPos < LOCALEDATEBUFFERSIZE)
+ ((char *)h->h_Data)[LocaleDateBufferPos++] = c;
+}
+
+struct Hook putCharHook = {
+ {NULL, NULL},
+ (unsigned long (*) ()) putCharFunc,
+ NULL,
+ LocaleDateBuffer
+};
+
+unsigned long __saveds __asm getCharFunc(register __a0 struct Hook *h,
+ register __a2 void *object,
+ register __a1 void *locale)
+{
+ unsigned long result;
+
+ if (LocaleDateBufferPos < LOCALEDATEBUFFERSIZE)
+ result = (((char *)h->h_Data)[LocaleDateBufferPos++]) & 0xff;
+
+ return result;
+}
+
+struct Hook getCharHook = {
+ {NULL, NULL},
+ (unsigned long (*) ()) getCharFunc,
+ NULL,
+ LocaleDateBuffer
+};
+
+
+char *
+myDateToStr(struct DateStamp *ds)
+{
+ int fullFunctionalities = 1;
+ STRPTR format;
+ char *result, time[64];
+ struct DateTime dt;
+ BOOL bool;
+
+/*
+ format = MyLocale -> loc_ShortDateFormat; /* short date format *
+*/
+ if (LocaleBase == NULL) fullFunctionalities = 0;
+ if (LocaleBase && LocaleBase -> lb_LibNode.lib_Revision < 27)
+ fullFunctionalities = 0;
+
+ if (fullFunctionalities) {
+ format = OF_Struct.dateFormat;
+ LocaleDateBufferPos = 0;
+ FormatDate(MyLocale, format, ds, &putCharHook);
+ sprintf(time,"%12s", LocaleDateBuffer); /* Reformatting */
+ strcpy(LocaleDateBuffer, time);
+ result = LocaleDateBuffer;
+ }
+ else {
+ if (ds -> ds_Days == 0) return "";
+ result = (char *) malloc(64);
+ dt.dat_Stamp = *ds;
+ dt.dat_StrDate = result;
+ dt.dat_StrTime = NULL;
+ dt.dat_StrDay = NULL;
+ dt.dat_Format = FORMAT_CDN;
+ if (STREQUAL(OF_Struct.defaultDate, "DOS")) dt.dat_Format = FORMAT_DOS;
+ else if (STREQUAL(OF_Struct.defaultDate, "CDN")) dt.dat_Format = FORMAT_CDN;
+ else if (STREQUAL(OF_Struct.defaultDate, "INT")) dt.dat_Format = FORMAT_INT;
+ else if (STREQUAL(OF_Struct.defaultDate, "USA")) dt.dat_Format = FORMAT_USA;
+ else {
+ myMsg2("Unknown defaultDate keyword (using CDN) : ", OF_Struct.defaultDate);
+ dt.dat_Format = FORMAT_CDN;
+ }
+ dt.dat_Flags = NULL; /* could be DTF_SUBST to have Monday when possible */
+ bool = DateToStr(& dt);
+ if (! bool) result = "ErrDateStr";
+ }
+ while (*result == ' ') result++;
+ return result;
+}
+
+
+struct DateStamp *
+myStrToDate(char *dateString)
+{
+
+ int fullFunctionalities = 1;
+ struct DateTime *dt;
+ struct DateStamp *result;
+ char *format;
+ int bool;
+
+ dt = (struct DateTime *) malloc(sizeof *dt);
+ result = & dt -> dat_Stamp;
+
+ result -> ds_Days = 0;
+ result -> ds_Minute = 0;
+ result -> ds_Tick = 0;
+
+ if (dateString == NULL || (dateString && *dateString == '\0'))
+ return result;
+
+ if (LocaleBase == NULL) fullFunctionalities = 0;
+ if (LocaleBase && LocaleBase -> lb_LibNode.lib_Revision < 27)
+ fullFunctionalities = 0;
+
+ if (! fullFunctionalities) {
+ if (STREQUAL(OF_Struct.defaultDate, "CDN")) dt -> dat_Format = FORMAT_CDN;
+ else if (STREQUAL(OF_Struct.defaultDate, "INT")) dt->dat_Format= FORMAT_INT;
+ else if (STREQUAL(OF_Struct.defaultDate, "DOS")) dt->dat_Format= FORMAT_DOS;
+ else if (STREQUAL(OF_Struct.defaultDate, "USA")) dt->dat_Format= FORMAT_USA;
+ else {
+ myMsg2("unknown defaultdate token (using CDN)", OF_Struct.defaultDate);
+ dt -> dat_Format = FORMAT_CDN;
+ }
+ dt -> dat_StrDay = NULL;
+ dt -> dat_StrDate = dateString;
+ dt -> dat_StrTime = NULL;
+ dt -> dat_Flags = 0;
+ StrToDate(dt);
+ result = & dt -> dat_Stamp;
+ }
+ else {
+ format = OF_Struct.dateFormat;
+ LocaleDateBufferPos = 0;
+ strcpy(LocaleDateBuffer, dateString);
+ bool = ParseDate(MyLocale, result, format, & getCharHook);
+ }
+
+ return result;
+
+}
+
535 src/common.h
@@ -0,0 +1,535 @@
+/*
+ * common.h
+ */
+
+/* $Id: common.h,v 1.4 1993/08/28 19:39:39 beust Exp $ */
+
+#include <stdio.h>
+#include <exec/types.h>
+#include <strings.h>
+#include <libraries/mui.h>
+
+
+/* Libraries definitions */
+#include <libraries/locale.h>
+#include <libraries/gadtools.h>
+
+/* Graphics */
+#include <graphics/displayinfo.h>
+#include <intuition/gadgetclass.h>
+#include <workbench/startup.h>
+#include <workbench/workbench.h>
+
+/* Prototypes */
+#include <clib/locale_protos.h>
+#include <clib/exec_protos.h>
+#include <clib/intuition_protos.h>
+#include <clib/gadtools_protos.h>
+#include <clib/dos_protos.h>
+#include <clib/iffparse_protos.h>
+#include <clib/utility_protos.h>
+#include <clib/wb_protos.h>
+#include <clib/icon_protos.h>
+#include <clib/muimaster_protos.h>
+
+/* Pragmas */
+#include <pragmas/muimaster_pragmas.h>
+
+/* Personal includes */
+#include "locale_strings.h"
+#include "database.h"
+
+/* Icon */
+extern struct IconBase *IconBase;
+
+/* Locale */
+extern struct LocaleBase *LocaleBase;
+extern struct Locale *MyLocale;
+extern struct Catalog *MyCatalog;
+
+/* General definitions */
+#define NEW(v, t) v = (t *) malloc(sizeof(t))
+#define STREQUAL(s1, s2) (strcmp(s1, s2) == 0)
+
+#define isblank(c) (c == ' ' || c == '\t')
+#define myAssert(p)
+#ifdef cedric
+#define D(x) { printf("%s:%d--- ", __FILE__, __LINE__); x; }
+#else
+#define D(x)
+#endif
+
+
+/* The main structure */
+#define ENTRYFORMATSTRING "%c %8s|%8s| %-6.2f |%8s|%8s|%35s"
+#define AUTOFORMATSTRING "%c %8s %3d %3d %3d %3d %30s"
+
+#define DATEL sizeof(struct DateStamp)
+#define TRANSACTIONL 80
+#define AMOUNTL 32
+#define CHECKNUMBERL 20
+#define IMPUTATIONL 80
+#define REASONL 80
+
+typedef struct _Automatic {
+ char *formattedString; /* the entry once it is formatted */
+ struct DateStamp first; /* first occurring for this automatic entry */
+ struct DateStamp last; /* last... */
+ ULONG repeatDays; /* repeat each days */
+ ULONG repeatWeeks; /* ... weeks */
+ ULONG repeatMonths; /* ... months */
+ ULONG repeatYears; /* ... years */
+ char transaction[REASONL]; /* reason to give */
+ char imputation[IMPUTATIONL]; /* category where this automatic falls into */
+ char amount[AMOUNTL]; /* the amount of the transaction */
+} *Automatic;
+
+typedef struct _Entry {
+ char *formattedString; /* the entry once it is formatted */
+ struct DateStamp date;
+ char transaction[TRANSACTIONL];
+ char checkNumber[CHECKNUMBERL];
+ char amount[AMOUNTL]; /* the amount of the transaction */
+ char imputation[IMPUTATIONL]; /* category where this automatic falls into */
+ char reason[REASONL]; /* reason to give */
+ char validated; /* boolean actually */
+ Automatic generatedBy; /* if this entry comes from an automatic */
+ char fake; /* if true, this entry was generated automatically */
+ char pad[3]; /* pad the rest for a long aligned struct */
+
+} *Entry;
+
+#define ENTRY_SIZE DATEL+TRANSACTIONL+AMOUNTL+CHECKNUMBERL+IMPUTATIONL+REASONL+4
+#define AUTO_SIZE sizeof(struct DateStamp) * 2 + sizeof(ULONG) * 4 +\
+ AMOUNTL + IMPUTATIONL + REASONL
+
+typedef struct _Entries {
+ Entry *list;
+ Automatic *automatic;
+} *Entries;
+
+typedef float TotalType;
+
+/* This structure to hold the names of my listview */
+/* Since a list can be displayed several times, I must do smart allocation */
+/* here (e.g. see if there's enough room in the previous list for the new */
+/* one, else allocate another one). Initialize it to NULL and pass it to */
+/* buildList() */
+
+struct SmartAlloc {
+ int count;
+ char **strings;
+};
+
+/*****************
+ * The format structures
+ *****************/
+
+enum Fields {
+ DATEFIELD = 1 << 0, AMOUNTFIELD = 1 << 1, TRANSACTIONFIELD = 1 << 2,
+ REASONFIELD = 1 << 3, CHECKNUMBERFIELD = 1 << 4, IMPUTATIONFIELD = 1 << 5
+};
+
+/*
+ ** A column in the list view is represented by the following structure
+ ** The first field is the list of the selected fields, coded as
+ ** a string (e.g. "\01\03" = DATE REASON. numberOfFields would be 2 for
+ ** this column.
+ */
+
+
+#define MAX_FIELDS 6
+#define MAX_COLUMNS 20
+
+
+struct ColumnListEntry {
+ char fields[MAX_FIELDS + 1]; /* the fields for this column */
+ int numberOfFields;
+ char *format;
+};
+
+struct ListEntry {
+ int numberOfColumns;
+ struct ColumnListEntry col[MAX_COLUMNS];
+ char *after;
+};
+
+extern struct ListEntry DisplayEntryFormat[]; /* common.c */
+
+struct StringAspect {
+ enum Fields field[6]; /* what field */
+ char *format[6]; /* string in printf format */
+ char *after; /* the possible trailing string */
+ int numberOfFields; /* number of fields the user wants */
+};
+
+extern struct StringAspect PrintFormatStructure,
+ ExportFormatStructure,
+ DisplayFormatStructure; /* common.c */
+
+/*********
+ * The GUI structure
+ *********/
+
+/*
+typedef void (*MenuCallbackPointer_t)() ;
+*/
+
+#define MENU_ITEM_COUNT 20
+#define MENU_CALLBACK(f) void f(Gui_t gui, Entries entries)
+
+typedef struct _Gui {
+ APTR app;
+ APTR mainWindowObject, getEntryWindowObject,
+ automaticWindowObject, clearWindowObject, listWindowObject;
+ APTR geDate, geCheckNumber, geTransaction, geImputation, geAmount,
+ geReplace, geReason;
+ APTR auFrom, auTo, auAmount, auDays, auWeeks, auMonths, auYears,
+ auReason, auImputation, auListviewObject, auListObject,
+ auNew, auAdd, auReplace, auDelete;
+ APTR liCycleObject, liListviewObject, liListObject,
+ liValidatedObject, liTotalObject;
+
+ struct SmartAlloc entrySA, autoSA;
+ void **menuFunctions;
+} *Gui_t;
+
+extern struct _Gui Gui; /* gui.c */
+extern struct Library *MUIMasterBase; /* gui.c */
+
+
+
+/*********
+ * Time variables
+ *********/
+
+extern struct timerequest *AutosaveTR; /* (common.c) */
+extern LONG AutosaveSignal; /* (common.c) */
+extern struct MsgPort *AutosavePort; /* (common.c) */
+
+
+/*********
+ * IFF defines
+ *********/
+
+#define ID_FTXT MAKE_ID('F','T','X','T')
+#define ID_CHRS MAKE_ID('C','H','R','S')
+#define ID_AUTO MAKE_ID('A','U','T','O')
+
+/*********
+ * The output
+ *********/
+
+#define BANKEROUTPUTWINDOW "CON:0/10/640/100"
+extern FILE *BankerWindow; /* common.c */
+
+
+/*********
+ * Command line parsing
+ *********/
+
+/* Command line structure (passed to ReadArgs()) */
+#define OPTIONSFILENAME "s:.bankerconfig" /* default name for the config file */
+
+struct CommandLineStruct {
+ char *language;
+ char *filename;
+ char *optionsFile;
+};
+extern struct CommandLineStruct CL_Struct; /* (common.c) */
+extern char *CL_Usage; /* (common.c) */
+
+/* The fields in the options file */
+struct WindowDesc {
+ BOOL isOpen;
+};
+
+
+/*********
+ * Options file parsing
+ *********/
+
+struct OptionsFileStruct {
+ struct WindowDesc mainWindow;
+ struct WindowDesc automatic;
+ struct WindowDesc getEntry;
+ struct WindowDesc list;
+ int autoSave;
+ char *defaultDate;
+ char *dateFormat;
+ char *displayFormat;
+ char *exportFormat;
+ char *printFormat;
+};
+extern struct OptionsFileStruct OF_Struct; /* (common.c) */
+
+extern int UniqueID;
+
+double atof();
+#define STRINGTOTOTAL(s) atof(s)
+
+extern struct _Entry LastSelectedEntry; /* getentry.c */
+extern BOOL CanReplace; /* getentry.c */
+
+extern Entries MainList; /* the big Database (main.c) */
+
+extern BOOL FileModified; /* true if file has been modified (common.c) */
+
+/*
+ ** common.c
+ */
+
+extern BOOL FileModified; /* True if file was modified */
+extern char FileName[128]; /* last accessed filename */
+extern char ExportFileName[128]; /* exported file name */
+extern char PrintFileName[128]; /* print filename */
+extern char Pattern[128]; /* pattern for file requester */
+extern char ExportPattern[128]; /* pattern for export requester */
+extern char PrintPattern[128]; /* pattern for print requester */
+
+
+
+/*********
+ * MUI
+ *********/
+
+#define ID_MAINWINDOW 0x4489
+#define ID_GETENTRYWINDOW 0x448a
+#define ID_AUTOMATICWINDOW 0x448b
+#define ID_LISTWINDOW 0x448c
+
+/*********
+ * Prototypes
+ *********/
+
+
+/*
+ * gui.c
+ */
+
+int
+buildGui(Gui_t gs, Entries entries, struct OptionsFileStruct *ofStruct);
+/* Build the GUI and main loop for the events */
+
+
+/*
+ * automatic.c
+ */
+
+void
+openAutomaticWindow(Gui_t gui, Entries entries);
+/* Open the automatic window and set the gadgets to default value */
+
+void
+clearAutomaticGadgets(Gui_t gui);
+/* Set the gadgets to their default values */
+
+void
+newAutomatic(Gui_t gui, Entries entries);
+/* Clear the gadgets to enter a new automatic */
+
+void
+replaceAutomatic(Gui_t gui, Entries entries);
+/* Replace the previously selected automatic with the one in the gadgets */
+
+void
+addAutomatic(Gui_t gui, Entries entries);
+/* Add the automatic in the gadgets to the database */
+
+void
+deleteAutomatic(Gui_t gui, Entries entries, Automatic automatic);
+/* If automatic == NULL, retrieve the automatic from the gadgets */
+
+void
+editAutomatic(Gui_t gui, Automatic automatic);
+/* Edit an automatic entry, open the window if necessary */
+
+
+/*
+ * getentry.c
+ */
+
+void
+openEntryWindow(Gui_t gui, Entries entries);
+/* Open the getentry window and set the gadgets to default value */
+
+Entry
+getEntryFromGadgets(Gui_t gui);
+/* Return the entry currently in the gadgets */
+
+void
+clearGetentryGadgets(Gui_t gui);
+/* Clear the gadgets */
+
+void
+addEntry(Gui_t gui, Entries entries);
+/* Add the entry currently in the gadgets to the database */
+
+void
+replaceEntry(Gui_t gui, Entries entries);
+/* Replace the latest selected entry with the one in the gadgets */
+
+void
+editEntry(Gui_t gui, Entry entry);
+/* Edit the selected entry */
+
+
+/*
+ * list.c
+ */
+
+
+void
+openListWindow(Gui_t gui, Entries entries);
+/* Open the list window */
+
+void
+simpleDisplayList(Gui_t gui, Entries entry);
+/* Display the database in the listview */
+
+void
+fullDisplayList(Gui_t gui, Entries entry);
+/* Display the database in the listview */
+
+void
+handleValidate(Gui_t gui, Entries entries, Entry entry);
+/* Validate the specified entry */
+
+void
+handleEdit(Gui_t gui, Entries entries, Entry entry);
+/* Edit the specified entry, open the getentry window if necessary */
+
+void
+handleDelete(Gui_t gui, Entries entries, Entry entry);
+/* Delete the specified entry */
+
+
+/*
+ * io.c
+ */
+
+void
+openFile(Gui_t gui, Entries entries, char *file);
+
+void
+saveFile(Entries entries, char *filename);
+
+void
+writeOptionsFile(Gui_t gui);
+/* Get the window configuration and write it to disk */
+
+void
+writeTextFile(Entries entries, char *file, struct StringAspect *sa);
+
+void
+readOptionsFile();
+
+/*
+ * common.c
+ */
+
+void
+closeAll();
+
+void
+openLibraries(Entries *entries);
+
+char
+getSignificantCharacter(int n);
+
+char *
+getString(int n);
+
+void
+myMsg1(char *s1);
+
+void
+myMsg2(char *s1, char *s2);
+
+void
+myMsg3(char *s1, char *s2, int n);
+
+char *
+crashFileName(char *filename);
+
+void
+readEnvironment(int argc, char **argv);
+/* Read the command line (or the WBMessage), and take appropriate actions */
+/* (open file, etc...) */
+
+struct DateStamp *
+myStrToDate(char *dateString);
+
+char *
+myDateToStr(struct DateStamp *ds);
+
+/*
+ * common2.c
+ */
+
+void
+addEntryDatabase(Entries entries, Entry entry, char fake, Automatic generatedBy);
+
+TotalType
+computeValidatedTotal(Entries list);
+
+TotalType
+computeTotal(Entries list);
+
+void
+buildDataBase(Entries entries);
+
+char *
+returnFormattedString(struct StringAspect *sa, Entry entry);
+
+void
+sortList(Entries list);
+
+int
+daysInNYears(ULONG days, ULONG n, ULONG year);
+
+int
+daysInNMonths(ULONG days, ULONG n, ULONG month, ULONG year);
+
+char *
+printEntry(Entries list, int number, char *s);
+
+void
+printEntries(Entries list);
+