home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga MA Magazine 1998 #3
/
amigamamagazinepolishissue1998.iso
/
bazy
/
db3.4
/
db.h
< prev
next >
Wrap
C/C++ Source or Header
|
1996-08-15
|
9KB
|
318 lines
/* Headerfile for the db project */
#include <exec/lists.h>
#include <dos.h> /* FMSIZE and FNSIZE */
#include <stdio.h> /* FILE */
#include <exec/nodes.h>
#include <exec/lists.h>
#include <exec/types.h>
#include <libraries/locale.h>
#include <proto/locale.h>
#define CATCOMP_NUMBERS
#include "db_strings.h"
#include "Select.h"
/**********************************************************************/
/* Defines */
/**********************************************************************/
#define TOGGLE_LED *(UBYTE *)0xbfe001 ^= 2
/* Locale */
#define GetAppStr(index) (GetString(&LocaleInfo,(index)))
#define DSIZE 25
#define TEXTFIELD_KIND 4711
/* Rawkeycodes + 128 for upkey codes */
#define RAW_TAB (0x42)
#define RAW_ESC (0x45)
#define RAW_HELP (0x5f)
#define RAW_UP (0x4c)
#define RAW_DOWN (0x4d)
#define RAW_LEFT (0x4f)
#define RAW_RIGHT (0x4e)
#define RAW_F1 (0x50)
#define RAW_F10 (0x59)
#define VANILLA_DEL (0x7f)
#define VANILLA_ESC (0x1b)
#define SEP_SPACE (' ')
#define SEP_TAB ('\t')
/* Layout defines */
#define DEFTABSIZE 6
#define STRGADFRAMESWIDTH 14
#define STRGADFRAMESHEIGHT 6
#define LATER NULL
#define MODE_NORMAL 0
#define MODE_FIND 1
#define MODE_SORT 2
#define MODE_FILTER 3
/* Limits */
#define FIELDNAMELENGTH 50
#define LAYOUTNAMELENGTH 50
#define WINDOWTITLELENGTH 80
#define DEFMAXFLDLEN 200
#define LOADBUFFERSIZE 65536 /* This restricts the recordlength */
#define NOTMODIFIED 0
#define RECMODIFIED 1
#define PROMODIFIED 2
/* For the ASL file requester */
#define MYLEFTEDGE 50
#define MYTOPEDGE 50
#define MYWIDTH 300
#define MYHEIGHT 300
/* Savemodes for Save() */
#define SAVE_PRO 0
#define SAVE_VIEW 1
#define SAVE_VIEW_WN 2
#define SAVE_TAB_ASCII 3
#define SAVE_COMMA_ASCII 4
#define SORT_DIR_AZ 0
#define SORT_DIR_ZA 1
/* Codes returned by LoadField */
#define BUFSIZE_ERR 0
#define FLD_OK 1
#define REC_OK 2
#define END_OF_FILE 3
/* Error codes from various functions */
#define MEM_ERR -1
#define RFF_ERR -2
#define FILE_ERR -3
#define GAD_ERR -4
#define WIN_ERR -5
#define MENU_ERR -6
#define WINSIZE_ERR -7
enum arguments { FILES, DEVICE, UNIT, DIALPREFIX, DIALPOSTFIX, AREACODE,
PUBSCREEN, FONTNAME, FONTSIZE, NOICONS, NOSPEEDRENDER, NORETURNSTEP, NOSERIAL,
HORIZBAR, ESCQUIT, TONEDIAL, TONEDIALSPEED, CCITT5, MAKEBACKUP, LOCALESORT,
HIGHLABEL, NOBORDER };
enum serialerrors { OK, MSGPORTERR, IOEXTERR, DEVICEERR };
typedef char loadreturncode;
/**********************************************************************/
/* externs */
/**********************************************************************/
extern char EmptyString[];
extern struct Pro *CurrentPro;
/* This is from the DataIcon.c file created by IconEdit */
/* We will modify fields here before writing icons */
extern struct DiskObject DataIcon;
extern LONG MyArgArray[];
extern struct MsgPort *AWPort;
extern struct TextFont *UserTextFont;
extern struct LocaleInfo LocaleInfo;
extern LONG WinSig;
extern struct Gadget *NextGad; /* MyStrHook() sets this if tabcycling */
extern struct Library *RexxSysBase;
extern struct Library *LocaleBase;
extern struct Library *DiskfontBase;
extern struct Library *IFFParseBase;
extern struct Library *IconBase;
extern struct Library *CxBase;
extern struct Library *AslBase;
extern struct GfxBase *GfxBase;
extern struct IntuitionBase *IntuitionBase;
extern struct Library *GadToolsBase;
extern struct Library *UtilityBase;
extern struct Library *WorkbenchBase; /* For AppWindow */
/**********************************************************************/
/* structs */
/**********************************************************************/
typedef char *Field;
struct Space {
UWORD XOffset;
UWORD YOffset;
WORD Width;
WORD Height;
};
struct Rec {
struct Rec *Next;
struct Rec *Prev;
Field *Fields;
short FldSum;
};
struct FldInfo {
struct FldInfo *Next;
struct MinList FldTags;
char Name[FIELDNAMELENGTH];
int Len; /* Max length of field (excluding '\0') */
char Type; /* String, Checkbox, Cycle.. */
};
struct VisFldInfo {
struct VisFldInfo *Next;
struct MinList VisTags;
char Name[FIELDNAMELENGTH];
struct Gadget *Gadget; /* Corresponding gadget in window */
struct Space Pos; /* Gadget position */
struct IntuiText Label; /* For textfield gadget */
short Offset; /* Field offset in database */
unsigned char VisLen; /* Visual length in chars */
char Format; /* Visual format: Caps, ALL CAPS... */
char FTyp; /* Fieldtype */
int Code; /* Active choice in cyclegadget so we don't use v39 func. */
char **CEnt; /* Pointer to Cyclechoices */
char NEnt; /* Number of entries in cyclegad */
char VisSep; /* Visual separator: Space, TAB or NewLine */
};
struct RxInfo { /* Rexx menu item data */
struct RxInfo *Next;
struct MinList RxTags;
/* char Name[FIELDNAMELENGTH]; */
};
struct SR {
struct SR *Next;
APTR GadgetRender;
};
/*
* Layout is the internal name for a View in db. (The name "View"is used by the OS)
*/
struct Layout {
struct Layout *NextLayout;
struct MinList LayTags;
char Name[LAYOUTNAMELENGTH];
char Title[WINDOWTITLELENGTH]; /* WindowTitle */
struct Window *Window;
WORD XPos, YPos;
struct AppWindow *AppWin;
struct Gadget *GList;
struct Gadget *DragGad;
Select *Browser;
struct SR *FirstSR; /* SpeedRender struct that holds gadget borders */
struct VisFldInfo *FirstVisFldInfo;
struct VisFldInfo *FirstUndoVisFldInfo;
BOOL ComplexGadgets;
};
struct SoftMenu {
struct MenuItem *Items; /* The variable menuitems */
struct NewMenu *NewItems; /* Stores NewMenu structs for Items */
int NewItemsNum; /* For deallocation */
};
struct Pro {
struct Pro *NextPro;
struct MinList ProTags;
struct MinList UnknownLines;
char Name[FNSIZE];
char Drawer[FMSIZE];
char OutputName[FMSIZE];
char OutputDrawer[FMSIZE];
char ARexxName[FMSIZE];
char ARexxDrawer[FMSIZE];
struct Rec *FirstRec;
int RecSum;
struct Rec *CurrentRec;
int RecNum;
struct Rec *FindRec;
struct Rec *SortRec;
struct Rec **Recpp; /* Points to either CurrentRec, FindRec or SortRec */
struct FldInfo *FirstFldInfo;
struct RxInfo *FirstRxInfo; /* The rxmenu RFF line */
struct Layout *FirstLayout;
struct Layout *CurrentLayout;
struct Menu *Menu; /* Same menustrip for the whole project */
struct SoftMenu ViewMenu;
struct SoftMenu ARexxMenu;
char Mode;
BOOL IsSorted;
char Sep; /* Separator: ; , space or tab */
char Modified; /* bit 0 = Record modified, bit 1 = project modified */
BOOL Quiet; /* Rexx stuff. Don't update GUI */
short CurrentFldOffset; /* Rexx stuff */
};
/**********************************************************************/
/* functions */
/**********************************************************************/
STRPTR __asm GetString(register __a0 struct LocaleInfo *li,
register __d0 LONG stringNum);
int DoDial(char *phonenumber);
int DB_CUT(void);
int DB_COPY(void);
int DB_PASTE(void);
BOOL PasteFromClipboard(struct Pro *Pr, struct Rec *crp);
int ChangeView(struct Layout *lay);
void UpdateRecord(struct Pro *Pr);
BOOL UpdateFld(struct Rec *crp, short offset, char *s);
void UpdateWindow(struct Pro *Pr);
void UpdateDragBar(struct Pro *Pr);
void UpdateGadgets(struct Pro *Pr);
struct Rec *FindRecord(struct Pro *Pr, int StartRec, int Dir);
void DoSort(struct Pro *Pr, short offset);
BOOL JumpList(struct Pro *Pr, int delta);
char *ReadVisFld(struct Pro *Pr, struct VisFldInfo *vf);
LONG EasyLocRequest(struct Window *w, struct EasyStruct *es, ULONG *idcmp,
APTR arg1, ...);
void SetProMode(struct Pro *Pr, char Mode);
BOOL IsInputBlocked(void);
BOOL BlockInput(struct Window *Win, BOOL Delay);
void FreeInput(struct Window *Win);
Field GetFld(struct Rec *crp, short Offset);
extern void ShowError(int errnum, char *text);
extern void RFFDelete(struct Pro *);
extern struct RFFTag *FindTag(struct MinList *list, short int id);
extern void DeleteTag(struct RFFTag *ot);
extern void DeleteRFFLine(struct RFFLine *ol);
extern struct VisFldInfo *GetVisFldInfo(struct Layout *Lay, struct Gadget *g);
extern struct FldInfo *GetFldInfo(struct Pro *, short);
extern BOOL SpeedRenderOn(struct Layout *Lay);
extern void SpeedRenderOff(struct Layout *Lay);
extern void ByeBye(void);
extern struct Layout *NewLayout(struct Pro *Pr);