home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
linuxmafia.com 2016
/
linuxmafia.com.tar
/
linuxmafia.com
/
pub
/
palmos
/
progect-src-0.20.tar.gz
/
progect-src-0.20.tar
/
progect-0.20
/
progect.h
< prev
next >
Wrap
C/C++ Source or Header
|
2000-10-26
|
9KB
|
333 lines
/* -*-Mode:C; tab-width:4; indent-tabs-mode:t; c-file-style:"bsd";-*- */
// $Id: progect.h,v 1.15 2000/10/22 18:35:27 burgbach Exp $
#ifndef __PROJECT_H__
#define __PROJECT_H__
#include <PalmOS.h>
// LinkMaster supports
#include "linkaware.h"
// WARNING : this one is also defined in Makefile !!!
// both MUST match
// 'lbPG' is a registred palm creator ID
// owned by L. Burgbacher, the creator of Progect Manager
// If you intend to modify this code, please register your
// own creator ID at www.palm.com
#define CREATOR 'lbPG'
#define gPrepend "lbPG-"
#define VERSION "0.20"
// code sections support
#define UISECT __attribute__ ((section ("uisect")))
#define TASKSECT __attribute__ ((section ("tasksect")))
#define DEBUG1(A) FrmCustomAlert(AltEmpty, (A), "", "")
#define DEBUG2(A, B) FrmCustomAlert(AltEmpty, (A), (B), "")
#define DEBUG3(A, B, C) FrmCustomAlert(AltEmpty, (A), (B), (C))
#define DEBUGVAL(A, B) StrIToA(gDebugVal, (B)); FrmCustomAlert(AltEmpty, (A), gDebugVal, "");
Char gDebugVal[20];
typedef enum {pgOK, pgError} pgErr;
typedef enum {
normalView,
flatView,
noteView // not used yet
} viewType;
typedef enum {noSort, sortDateFirst, sortPriorityFirst} SortType;
typedef enum {memoLink, addressLink, progectLink} AppLinkType;
typedef enum {
frmTaskEditReturnFromNote,
frmTaskEditReturnFromIconSelect,
} TaskFrmUpdateType;
// choose the function of the choosename form before calling it
typedef enum {
ChooseNameCreate,
ChooseNameRename,
ChooseNameDuplicate,
ChooseNameDoc
} ChooseNameFunctionType;
typedef struct {
// OS version feature
UInt16 ver30:1;
UInt16 ver31:1;
UInt16 ver32:1;
UInt16 ver33:1;
UInt16 ver34:1;
UInt16 ver35:1;
// display type feature
UInt32 nScreenWidth;
UInt32 nScreenHeight;
UInt32 nScreenDepth;
Boolean enableColor;
} OSCaps_t;
// TaskRecordType V0.4, 22.08.2000
// note is packed behind description
// not used, just to know how it is implemented
typedef struct {
UInt16 level:8;
UInt16 hasNext:1;
UInt16 hasChild:1;
UInt16 opened:1;
UInt16 hasPrev:1;
UInt16 reserved:4;
} TaskAttrType;
typedef struct {
UInt16 hasStartDate:1;
UInt16 hasPred:1;
UInt16 hasDuration:1;
UInt16 hasDueDate:1;
UInt16 hasToDo:1;
UInt16 hasNote:1;
UInt16 hasLink:1;
UInt16 isMemo:1;
UInt16 isContact:1;
UInt16 isAppointement:1;
UInt16 isToDo:1;
UInt16 extendedType:1; // use TaskExtendedRecordType or TaskRecordType
UInt16 isProject:1;
UInt16 newTask:1; // newly created task, a cancel removes it
UInt16 newFormat:1;
UInt16 nextFormat:1; // true -> next is also a format (to be able to add
// more features);
} TaskFormatType;
typedef struct {
UInt8 priority;
UInt8 completed;
DateType dueDate;
Char description;
Char reserved;
} TaskStandardFields;
typedef struct {
UInt32 uniqueID; // high byte is the application
UInt8 reserve;
Char dbName; // must be zero if don't use.
} TaskLinkField;
typedef struct {
union {
TaskAttrType bits;
UInt16 allBits;
} attr;
union {
TaskFormatType bits;
UInt16 allBits;
} format;
union {
TaskStandardFields task; // like a TaskRecordType
TaskLinkField link; // link to a record in another app
} fields;
} TaskExtendedRecordType;
typedef struct {
union {
TaskAttrType bits;
UInt16 allBits;
} attr;
union {
TaskFormatType bits;
UInt16 allBits;
} format;
UInt8 priority;
UInt8 completed;
DateType dueDate;
Char description;
Char reserved; // compiler alignement thing
} TaskRecordType;
typedef struct {
union {
TaskAttrType bits;
UInt16 allBits;
} attr;
union {
TaskFormatType bits;
UInt16 allBits;
} format;
UInt8 priority;
UInt8 completed;
DateType dueDate;
Char *description;
Char *note;
} TaskType;
#define levelMask 0x00FF
#define hasNextMask 0x0100
#define hasChildMask 0x0200
#define openedMask 0x0400
#define hasPrevMask 0x0800
// + 1 for the note \0
//#define TaskRecordTypeSize (sizeof(TaskRecordType) + 1)
#define TaskRecordTypeSize (sizeof(TaskRecordType))
typedef TaskType* TaskTypePtr;
typedef struct {
Char openDBName[32];
Boolean openDB;
viewType view;
Int32 topTask;
UInt16 actualTask;
UInt16 parentTask;
UInt8 refLevel;
UInt8 reserved; // alignment
} CurrentPrefsType;
typedef struct {
Boolean deleteWarn; // warn before deleting a single task
} SavedPrefsType;
typedef struct {
UInt8 format; // format of the records
UInt8 reserved;
Boolean hideDoneTasks; // hide done tasks in project form
Boolean displayDueDates; // draw the due dates on project form
Boolean displayPriorities; // draw the priority on project form
Boolean displayYear; // draw the year with due date on project form
Boolean useFatherStatus; // use father's due date and priority
// new in 0.15
Boolean autoSyncToDo; // sync the todos on opening
// new in 0.16 : flat filter details
Boolean flatHideDone;
UInt8 flatDated;
UInt8 flatMinPriority;
Boolean flatOr;
Boolean flatMin; // 0.17
// new in 0.17 : display preferences
UInt8 boldMinPriority;
UInt8 boldMinDays; // 0 = no, 1 = overdue, 2 = today...
Boolean strikeDoneTasks;
Boolean hideDoneProgress;
Boolean hideProgress;
TaskType taskDefaults;
// new in 0.18 : sort in flat view
SortType flatSorted;
UInt8 flatDateLimit; // 0 = no, 1 = overdue, 2 = today...
// new in 0.20 : record completion date
Boolean completionDate; // true = record completion date
} ProjectPrefsType;
typedef struct
{
AppInfoType appInfo;
ProjectPrefsType pref;
} DBInfoType;
typedef struct {
Boolean exportDone;
Boolean exportProgress;
Boolean exportDueDate;
Boolean exportPriority;
Boolean exportNote;
Boolean exportFlat;
} MemoExportOptionsType;
// old formats
typedef struct {
Boolean hasNext;
Boolean hasChild;
Boolean opened;
Boolean firstChild;
UInt8 level;
UInt8 priority;
UInt8 completed;
DateType dueDate;
Char description;
} TaskRecordTypeV011;
typedef struct {
Boolean hasNext;
Boolean hasChild;
Boolean opened;
Boolean firstChild;
UInt8 level;
UInt8 priority;
UInt8 completed;
DateType dueDate;
Char* description;
} TaskTypeV011;
typedef struct {
Boolean hideDoneTasks; // hide done tasks in project form
Boolean displayDueDates; // draw the due dates on project form
Boolean displayPriorities; // draw the priority on project form
Boolean displayYear; // draw the year with due date on project form
Boolean useFatherStatus; // use father's due date and priority when creating a child
} ProjectPrefsTypeV011;
// Globals
extern DmOpenRef gdbP; // actual database
extern DmOpenRef gClip; // clipboard database
extern UInt16 gActualTask; // selected task
extern UInt16 gLastSelected; // last selected task
extern TaskType gEmptyTask;
extern DateType gNoDate;
extern Char gDateStr[]; // to store a date string
extern UInt8 gLevelOffset; // for horizontal scroll and subtree viewing
extern UInt16 gParentTask; // the parent of all tasks for viewing purposes only
extern UInt8 gRefLevel; // level of gParentTask;
extern LocalID gdbID; // id of opened database (set by OpenDB and CloseDB)
extern DateType gToday;
extern UInt32 gTodayDays; // to speed up day comparaisons calculations
extern UInt8 gLimits[];
extern OSCaps_t OSCaps;
extern MemoExportOptionsType gMemoExportPrefs;
extern Char* docName; // use by FrmChooseName
extern UInt8 ChooseNameFunction;
// Preferences
extern DateFormatType gDateFormat; // actual date format (from palm in StartApplication)
extern ProjectPrefsType gProjectPrefs;
extern CurrentPrefsType gCurrentPrefs; // current prefs, used to restore after switching to another program
extern SavedPrefsType gSavedPrefs; // saved prefs, used to restore global application prefs
// prototypes
// general
MemPtr GetObjectPtr(UInt16 ObjID) UISECT;
DateType Today(void);
Boolean DateInLimit(DateType date, UInt8 offset);
void PrintDueDate(TaskRecordType *p, UInt16 *datePos, UInt16 y) UISECT;
void SetFormTitle (FormPtr frm, Char *title) UISECT;
UInt16 ConfirmCustom(UInt16 idAction, UInt16 id);
void MessageBox(UInt16 id);
UInt16 GetLastInSub(UInt16 parent);
typedef enum {scrollUp, scrollDown, scrollTop} scrollType;
// forms general
void DrawTruncText(Char *c, UInt16 x, UInt16 y, UInt16 limit) UISECT;
void ProjectDrawExtendedItemDesc(TaskExtendedRecordType *p, UInt16 x, UInt16 y) UISECT;
void ProjectDrawItemDesc(TaskRecordType *p, UInt16 x, UInt16 y) UISECT;
void ProjectItemDraw(MemPtr table, UInt16 row, UInt16 column, RectanglePtr bounds) UISECT;
void ProjectTableUpdate(void) UISECT;
void Scroll(scrollType s, UInt8 step) UISECT;
void FrmTaskEditUpdateDateTrigger(MemPtr trigger, DateType p) UISECT;
void SelectActualTask(Boolean move) UISECT;
// forms init
void ProjectTableInit(void) UISECT;
void InitFrmTaskEdit(void) UISECT;
void CleanUpFrmTaskEdit(void) UISECT;
void InitFrmNoteEdit(void) UISECT;
void CleanUpFrmNoteEdit(void) UISECT;
void FrmProjectListInit(void) UISECT;
void FrmProjectListCleanUp(void) UISECT;
#endif