📄 .#progect.h.1.47
字号:
/* -*-Mode:C; tab-width:4; indent-tabs-mode:t; c-file-style:"bsd";-*- */// $Id: progect.h,v 1.47 2003/11/04 02:15:42 rick_price 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.28b"#define DBVERSION 23#define EXTENSION ".pgt"// 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, "");// hcc, 5.5.2001// Define which method to use to get printf-style debug output.// 0 = Debug output disabled (not compiled in)// 1 = Debug messages sent via DbgMessage to an attached debugger.// WARNING: Use only on Palm Emulator. It will lock a hardware Palm,// requiring soft reset, unless a debugger is serially attached.// 2 = Debug messages sent via HostTraceOutputT from Palm Emulator to// Palm Reporter on Windows. Debug is ignored on Palm hardware device.//// These are possible future methods, not implemented yet.// 3 = Debug written to Stream database. Suitable for use on hardware device.// 4 = Debug written to MemoPad database.#define DEBUGMETHOD 2#if DEBUGMETHOD == 0 // Debug Messages disabledChar gDebugVal[20];#define DBGMSG(A)#endif#if DEBUGMETHOD == 1 // Debug Messages to debugger via DbgMessage()#define DBB gDebugValChar gDebugVal[200];// Write printf-style debug message to debugger console.// The macro takes the same args as StrPrintF, but must be specified// within double-parentheses so that cpp thinks they are one argument.// The dummy while loop produces no code but allows multiple statements// in the macro to be treated as one so that the following works:// if(a > 5)// DBGMSG((gDebugVal, "%d\n", a));#define DBGMSG(A) do { StrPrintF A; DbgMessage(gDebugVal); } while(0)#endif // DEBUGMETHOD == 1#if DEBUGMETHOD == 2 // Debug Messages to Palm Reporter via HostTraceOutputChar gDebugVal[20];// HostControl.h defines the HostTrace... system calls. It must be the// very recent (as of 4 May 2001) version included with POSE 3.1.// The one in PalmOS SDK 3.5 does not define these functions, so// the application will not link.// Rename the HostControl.h in SDK 3.5, and replace it with the one// that is bundled with POSE 3.1.#ifndef __HOSTCONTROL_H__#include <HostControl.h>#endif#define DBB 0x8000 // appErrorClass#define DBGMSG(A) HostTraceOutputTL A#define DBGMSGBIN(A) HostTraceOutputB A#endif // DEBUGMETHOD == 2typedef enum {pgOK, pgError} pgErr;typedef enum { normalView, flatView, noteView // not used yet} viewType;// this one is stored in 5 bits !!! Check TaskFormatTypetypedef enum { progressType, numericType, actionType, informativeType, extendedType, linkType,} ItemType;typedef enum { noSort, sortDateFirst, sortPriorityFirst} SortType;typedef enum { memoLink, addressLink, progectLink, datebookLink, toDoLink} AppLinkType;typedef enum { frmTaskEditReturnFromNote, frmTaskEditReturnFromIconSelect,} TaskFrmUpdateType;// choose the function of the choosename form before calling ittypedef 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; UInt16 handera:1; UInt16 clieHR:1; // display type feature UInt32 nScreenDepth; Boolean enableColor; UInt32 nOldScreenDepth; UInt16 screenWidth; UInt16 screenHeight; UInt16 refNum; // CLIE HR refnum} OSCaps_t;// TaskRecordType V0.4, 22.08.2000// note is packed behind description// not used, just to know how it is implementedtypedef 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; // actually, this is used only for Linkmaster link, but // we need to extend it for items that have progect's // builtin' links // NEWS : the five isXXX are not needed anymore in 0.23, because we want // to store an enum for the type of items. This enum will be store here, // in place of these isXXX. // The extendedType info is not needed too, because we store the type, so // we can always use the TaskExtendedRecordType to access a record. This // will need some changes in the rest of the code. UInt16 itemType:5; // That make 32 different types, should be much more than needed. // Note that we still have 2 bits at the end of this struct which are not // used and could be recuperated. //UInt16 isMemo:1; // -> directMemo //UInt16 isContact:1; // -> directAddress //UInt16 isAppointement:1; // -> directDateBook //UInt16 isToDo:1; // -> directToDo //UInt16 extendedType:1; // -> extendedType // actually, extendedType is set to 1 by : // AddLinkRecord (link.c) // used by : // ProjectItemDraw (progect.c) : // to ignore ToDo link in flatview for extended // to select between ProjectDrawExtendedItemDesc // (no word wrap ??) and ProjectDrawItemDesc // FrmFlatHandleEvent (progect.c) : // don't try to ToDoLink an extended (why ?) // Search (progect.c) : // ignore extended in search (why ?) // TaskGetDescriptionByTaskPtr (task.c) // special way of getting desc for extended // TaskGetExtraBlockHeadPtr (task.c) // returns fields.link.dbname if extended // This is not needed and immediately removed to put the hasXB field //UInt16 isProject:1; UInt16 hasXB:1; // new since 0.23, this item has an XB, use ExtraBlockFields // to get its size and access normal fields // end of NEWS UInt16 newTask:1; // newly created task, a cancel removes it // This one is used at creation time only. So we can // move it around. UInt16 newFormat:1; // TODO : it is set in progectdb.c, but never read. // was probably for conversion between 0.8 -> 0.10 UInt16 nextFormat:1; // true -> next is also a format (to be able to add // more features); // TODO : Is this really needed ? If not, we could // get two bits more here (newTask and nextFormat)} TaskFormatType;typedef struct { UInt16 hasStartDate:1; // not used for conversion UInt16 hasPred:1; // not used for conversion UInt16 hasDuration:1; // not used for conversion UInt16 hasDueDate:1; // not used for conversion UInt16 hasToDo:1; // not used for conversion UInt16 hasNote:1; // not used for conversion UInt16 hasLink:1; // not used for conversion UInt16 isMemo:1; // -> directMemo UInt16 isContact:1; // -> directAddress UInt16 isAppointement:1; // -> directDateBook UInt16 isToDo:1; // -> directToDo UInt16 extendedType:1; // -> extendedType UInt16 isProject:1; // not used for conversion UInt16 newTask:1; // not used for conversion UInt16 newFormat:1; // not used for conversion UInt16 nextFormat:1; // not used for conversion} TaskFormatTypeV018; // old format, used by conversion routine#define NO_PRIORITY 6typedef struct { UInt8 priority; UInt8 completed; DateType dueDate; Char description; Char reserved;} TaskStandardFields;typedef struct { UInt16 builtin:1;// builtin link type UInt16 dbID:15; // index of db in db array UInt32 uniqueID; // uniqueID of the item to link to, high byte == 0} LinkItemFields;// here if hasXB is settypedef struct { UInt16 size; UInt8 data[0]; // Task(Standard|Link)Fields @ data[size] UInt8 align; // padding byte} ExtraBlockFields;typedef struct { union { TaskAttrType bits; UInt16 allBits; } attr; union { TaskFormatType bits; UInt16 allBits; } format; union { TaskStandardFields task; // like a TaskRecordType // TODO : get rid of the next one (TaskLinkFields) LinkItemFields link; // new link to a record ExtraBlockFields XB; // XB header } fields;} TaskExtendedRecordType;typedef struct { union { TaskAttrType bits; UInt16 allBits; } attr; union { TaskFormatType bits; UInt16 allBits; } format; UInt8 priority; UInt8 completed; // progress : 0-10 // action (ACTION) : 0 = unchecked, 10 = checked // informative (INFORMATIVE) - // numeric progress (NUMERIC) (extrablock) : 0-10 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#define TaskRecordTypeSize (sizeof(TaskRecordType))typedef TaskType* TaskTypePtr;typedef struct { Char openDBName[dmDBNameLength]; 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 // new in 0.21 UInt16 flatCategories; // new in 0.22 UInt8 wordWrapLines; UInt8 drawTreeLines; // Used as Boolean now. May become enum} ProjectPrefsType;typedef struct{ AppInfoType appInfo; ProjectPrefsType pref;} DBInfoType;typedef struct { Boolean exportDone; Boolean exportProgress; Boolean exportDueDate; Boolean exportPriority; Boolean exportNote; Boolean exportFlat; UInt8 exportDocFormat;} MemoExportOptionsType;// Globalsextern DmOpenRef gdbP; // actual databaseextern DmOpenRef gClip; // clipboard databaseextern UInt16 gActualTask; // selected taskextern UInt16 gLastSelected; // last selected taskextern TaskType gEmptyTask;extern DateType gNoDate;extern Char gDateStr[]; // to store a date stringextern UInt8 gLevelOffset; // for horizontal scroll and subtree viewingextern UInt16 gParentTask; // the parent of all tasks for viewing purposes onlyextern 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 calculationsextern UInt8 gLimits[];extern OSCaps_t OSCaps;extern MemoExportOptionsType gMemoExportPrefs;extern Char* docName; // use by FrmChooseNameextern UInt8 ChooseNameFunction;extern UInt16 gNumDeleted;// Preferencesextern DateFormatType gDateFormat; // actual date format (from palm in StartApplication)extern ProjectPrefsType gProjectPrefs;extern CurrentPrefsType gCurrentPrefs; // current prefs, used to restore after switching to another programextern SavedPrefsType gSavedPrefs; // saved prefs, used to restore global application prefs// prototypes// generalvoid SafeCopy(Char* dest,const Char *src, UInt16 size);MemPtr GetObjectPtr(UInt16 ObjID) UISECT;DateType Today(void);Boolean DateInLimit(DateType date, UInt8 offset);void PrintDueDate(TaskStandardFields *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);void ViewCreateNewTask(void);typedef enum {scrollUp, scrollDown, scrollTop} scrollType;// forms generalvoid DrawTruncText(Char *c, UInt16 x, UInt16 y, UInt16 limit) UISECT;void ProjectDrawExtendedItemDesc(TaskExtendedRecordType *p, UInt16 x, UInt16 y) UISECT;UInt8 ProjectDrawItemDesc(TaskExtendedRecordType *p, UInt16 x, UInt16 y, UInt8 lineLimit) 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 initvoid ProjectTableInit(void) UISECT;void InitFrmTaskEdit(void) UISECT;Boolean CleanUpFrmTaskEdit(void) UISECT;void InitFrmNoteEdit(void) UISECT;void CleanUpFrmNoteEdit(void) UISECT;void FrmProjectListInit(void) UISECT;void FrmProjectListCleanUp(void) UISECT;void switchView(viewType view) UISECT;Boolean DeleteTask(DmOpenRef dbP, UInt16 taskToDelete) UISECT;#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -