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 >
C/C++ Source or Header  |  2000-10-26  |  9KB  |  333 lines

  1. /* -*-Mode:C; tab-width:4; indent-tabs-mode:t; c-file-style:"bsd";-*- */
  2. // $Id: progect.h,v 1.15 2000/10/22 18:35:27 burgbach Exp $
  3.  
  4. #ifndef __PROJECT_H__
  5. #define __PROJECT_H__
  6.  
  7. #include <PalmOS.h>
  8.  
  9. // LinkMaster supports
  10. #include "linkaware.h"
  11.  
  12.  
  13. // WARNING : this one is also defined in Makefile !!!
  14. // both MUST match
  15. // 'lbPG' is a registred palm creator ID 
  16. // owned by L. Burgbacher, the creator of Progect Manager
  17. // If you intend to modify this code, please register your
  18. // own creator ID at www.palm.com
  19. #define CREATOR 'lbPG'
  20. #define gPrepend "lbPG-"
  21. #define VERSION "0.20"
  22.  
  23. // code sections support
  24. #define UISECT __attribute__ ((section ("uisect")))
  25. #define TASKSECT __attribute__ ((section ("tasksect")))
  26.  
  27. #define DEBUG1(A) FrmCustomAlert(AltEmpty, (A), "", "")
  28. #define DEBUG2(A, B) FrmCustomAlert(AltEmpty, (A), (B), "")
  29. #define DEBUG3(A, B, C) FrmCustomAlert(AltEmpty, (A), (B), (C))
  30. #define DEBUGVAL(A, B) StrIToA(gDebugVal, (B)); FrmCustomAlert(AltEmpty, (A), gDebugVal, "");
  31. Char gDebugVal[20];
  32.  
  33. typedef enum {pgOK, pgError} pgErr;
  34. typedef enum {
  35.     normalView, 
  36.     flatView,
  37.     noteView // not used yet
  38. } viewType;
  39.  
  40. typedef enum {noSort, sortDateFirst, sortPriorityFirst} SortType;
  41. typedef enum {memoLink, addressLink, progectLink} AppLinkType;
  42. typedef enum {
  43.     frmTaskEditReturnFromNote,
  44.     frmTaskEditReturnFromIconSelect,
  45. } TaskFrmUpdateType;
  46.  
  47. // choose the function of the choosename form before calling it
  48. typedef enum {
  49.     ChooseNameCreate, 
  50.     ChooseNameRename, 
  51.     ChooseNameDuplicate,
  52.     ChooseNameDoc
  53. } ChooseNameFunctionType;
  54.  
  55. typedef struct {
  56.     // OS version feature
  57.     UInt16 ver30:1;
  58.     UInt16 ver31:1;
  59.     UInt16 ver32:1;
  60.     UInt16 ver33:1;
  61.     UInt16 ver34:1;
  62.     UInt16 ver35:1;
  63.  
  64.     // display type feature
  65.     UInt32 nScreenWidth;
  66.     UInt32 nScreenHeight;
  67.     UInt32 nScreenDepth;
  68.     Boolean enableColor;
  69.  
  70. } OSCaps_t;
  71.  
  72. // TaskRecordType V0.4, 22.08.2000
  73. // note is packed behind description
  74.  
  75. // not used, just to know how it is implemented
  76. typedef struct {
  77.     UInt16 level:8;
  78.     UInt16 hasNext:1;
  79.     UInt16 hasChild:1;
  80.     UInt16 opened:1;
  81.     UInt16 hasPrev:1;
  82.     UInt16 reserved:4;
  83. } TaskAttrType;
  84.  
  85. typedef struct {
  86.     UInt16 hasStartDate:1;
  87.     UInt16 hasPred:1;
  88.     UInt16 hasDuration:1;
  89.     UInt16 hasDueDate:1;
  90.     UInt16 hasToDo:1;
  91.     UInt16 hasNote:1;
  92.     UInt16 hasLink:1;
  93.     UInt16 isMemo:1;
  94.     UInt16 isContact:1;
  95.     UInt16 isAppointement:1;
  96.     UInt16 isToDo:1;
  97.     UInt16 extendedType:1; // use TaskExtendedRecordType or TaskRecordType
  98.     UInt16 isProject:1;
  99.     UInt16 newTask:1;    // newly created task, a cancel removes it
  100.     UInt16 newFormat:1;
  101.     UInt16 nextFormat:1; // true -> next is also a format (to be able to add 
  102.                          // more features);
  103. } TaskFormatType;
  104.  
  105. typedef struct {
  106.     UInt8 priority;
  107.     UInt8 completed;
  108.     DateType dueDate;
  109.     Char description;
  110.     Char reserved;
  111. } TaskStandardFields;
  112.  
  113. typedef struct {
  114.     UInt32 uniqueID; // high byte is the application
  115.     UInt8 reserve;
  116.     Char dbName;     // must be zero if don't use.
  117. } TaskLinkField;
  118.  
  119. typedef struct {
  120.     union {
  121.         TaskAttrType bits;
  122.         UInt16 allBits;
  123.     } attr;
  124.     union {
  125.         TaskFormatType bits;
  126.         UInt16 allBits;
  127.     } format;
  128.     union {
  129.         TaskStandardFields task; // like a TaskRecordType
  130.         TaskLinkField link; // link to a record in another app
  131.     } fields;
  132. } TaskExtendedRecordType;
  133.  
  134. typedef struct {
  135.     union {
  136.         TaskAttrType bits;
  137.         UInt16 allBits;
  138.     } attr;
  139.     union {
  140.         TaskFormatType bits;
  141.         UInt16 allBits;
  142.     } format;
  143.     UInt8 priority;
  144.     UInt8 completed;
  145.     DateType dueDate;
  146.     Char description;
  147.     Char reserved; // compiler alignement thing
  148. } TaskRecordType;
  149.  
  150. typedef struct {
  151.     union {
  152.         TaskAttrType bits;
  153.         UInt16 allBits;
  154.     } attr;
  155.     union {
  156.         TaskFormatType bits;
  157.         UInt16 allBits;
  158.     } format;
  159.     UInt8 priority;
  160.     UInt8 completed;
  161.     DateType dueDate;
  162.     Char *description;
  163.     Char *note;
  164. } TaskType;
  165.  
  166. #define levelMask             0x00FF
  167. #define hasNextMask           0x0100
  168. #define hasChildMask          0x0200
  169. #define openedMask            0x0400
  170. #define hasPrevMask           0x0800
  171.  
  172. // + 1 for the note \0
  173. //#define TaskRecordTypeSize (sizeof(TaskRecordType) + 1)
  174. #define TaskRecordTypeSize (sizeof(TaskRecordType))
  175.  
  176. typedef TaskType* TaskTypePtr;
  177.  
  178. typedef struct {
  179.     Char openDBName[32];
  180.     Boolean openDB;
  181.     viewType view;
  182.     Int32 topTask;
  183.     UInt16 actualTask;
  184.     UInt16 parentTask;
  185.     UInt8 refLevel;
  186.     UInt8 reserved; // alignment
  187. } CurrentPrefsType;
  188.  
  189. typedef struct {
  190.     Boolean deleteWarn;        // warn before deleting a single task
  191. } SavedPrefsType;
  192.  
  193.  
  194. typedef struct {
  195.     UInt8 format;              // format of the records
  196.     UInt8 reserved;
  197.     Boolean hideDoneTasks;     // hide done tasks in project form
  198.     Boolean displayDueDates;   // draw the due dates on project form
  199.     Boolean displayPriorities; // draw the priority on project form
  200.     Boolean displayYear;       // draw the year with due date on project form
  201.     Boolean useFatherStatus;   // use father's due date and priority
  202.     // new in 0.15
  203.     Boolean autoSyncToDo;      // sync the todos on opening
  204.     // new in 0.16 : flat filter details
  205.     Boolean flatHideDone;
  206.     UInt8 flatDated;
  207.     UInt8 flatMinPriority;
  208.     Boolean flatOr;
  209.     Boolean flatMin; // 0.17
  210.     // new in 0.17 : display preferences
  211.     UInt8 boldMinPriority;
  212.     UInt8 boldMinDays; // 0 = no, 1 = overdue, 2 = today...
  213.     Boolean strikeDoneTasks;
  214.     Boolean hideDoneProgress;
  215.     Boolean hideProgress;
  216.     TaskType taskDefaults;
  217.     // new in 0.18 : sort in flat view
  218.     SortType flatSorted;
  219.     UInt8 flatDateLimit; // 0 = no, 1 = overdue, 2 = today...
  220.     // new in 0.20 : record completion date
  221.     Boolean completionDate; // true = record completion date
  222. } ProjectPrefsType;
  223.  
  224. typedef struct
  225. {
  226.     AppInfoType appInfo;
  227.     ProjectPrefsType pref;
  228. } DBInfoType;
  229.  
  230.  
  231. typedef struct {
  232.     Boolean exportDone;
  233.     Boolean exportProgress;
  234.     Boolean exportDueDate;
  235.     Boolean exportPriority;
  236.     Boolean exportNote;
  237.     Boolean exportFlat;
  238. } MemoExportOptionsType;
  239.  
  240. // old formats
  241. typedef struct {
  242.     Boolean hasNext;
  243.     Boolean hasChild;
  244.     Boolean opened;
  245.     Boolean firstChild;
  246.     UInt8 level;
  247.     UInt8 priority;
  248.     UInt8 completed;
  249.     DateType dueDate;
  250.     Char description;
  251. } TaskRecordTypeV011;
  252.  
  253. typedef struct {
  254.     Boolean hasNext;
  255.     Boolean hasChild;
  256.     Boolean opened;
  257.     Boolean firstChild;
  258.     UInt8 level;
  259.     UInt8 priority;
  260.     UInt8 completed;
  261.     DateType dueDate;
  262.     Char* description;
  263. } TaskTypeV011;
  264.  
  265. typedef struct {
  266.     Boolean hideDoneTasks;     // hide done tasks in project form
  267.     Boolean displayDueDates;   // draw the due dates on project form
  268.     Boolean displayPriorities; // draw the priority on project form
  269.     Boolean displayYear;       // draw the year with due date on project form
  270.     Boolean useFatherStatus;   // use father's due date and priority when creating a child
  271. } ProjectPrefsTypeV011;
  272.  
  273. // Globals
  274. extern DmOpenRef gdbP; // actual database
  275. extern DmOpenRef gClip; // clipboard database
  276. extern UInt16 gActualTask; // selected task
  277. extern UInt16 gLastSelected; // last selected task
  278. extern TaskType gEmptyTask;
  279. extern DateType gNoDate;
  280. extern Char gDateStr[]; // to store a date string
  281. extern UInt8 gLevelOffset; // for horizontal scroll and subtree viewing
  282. extern UInt16 gParentTask; // the parent of all tasks for viewing purposes only
  283. extern UInt8 gRefLevel; // level of gParentTask;
  284. extern LocalID gdbID; // id of opened database (set by OpenDB and CloseDB)
  285. extern DateType gToday;
  286. extern UInt32 gTodayDays; // to speed up day comparaisons calculations
  287. extern UInt8 gLimits[];
  288. extern OSCaps_t OSCaps;
  289. extern MemoExportOptionsType gMemoExportPrefs;
  290. extern Char* docName; // use by FrmChooseName
  291. extern UInt8 ChooseNameFunction;
  292.  
  293. // Preferences
  294. extern DateFormatType gDateFormat; // actual date format (from palm in StartApplication)
  295. extern ProjectPrefsType gProjectPrefs;
  296. extern CurrentPrefsType gCurrentPrefs; // current prefs, used to restore after switching to another program
  297. extern SavedPrefsType gSavedPrefs; // saved prefs, used to restore global application prefs
  298.  
  299. // prototypes
  300. // general
  301. MemPtr       GetObjectPtr(UInt16 ObjID) UISECT;
  302. DateType     Today(void);
  303. Boolean      DateInLimit(DateType date, UInt8 offset);
  304. void         PrintDueDate(TaskRecordType *p, UInt16 *datePos, UInt16 y) UISECT;
  305. void         SetFormTitle (FormPtr frm, Char *title) UISECT;
  306. UInt16       ConfirmCustom(UInt16 idAction, UInt16 id);
  307. void         MessageBox(UInt16 id);
  308. UInt16       GetLastInSub(UInt16 parent);
  309.  
  310.  
  311. typedef enum {scrollUp, scrollDown, scrollTop} scrollType;
  312.  
  313. // forms general
  314. void  DrawTruncText(Char *c, UInt16 x, UInt16 y, UInt16 limit) UISECT;
  315. void  ProjectDrawExtendedItemDesc(TaskExtendedRecordType *p, UInt16 x, UInt16 y) UISECT;
  316. void  ProjectDrawItemDesc(TaskRecordType *p, UInt16 x, UInt16 y) UISECT;
  317. void  ProjectItemDraw(MemPtr table, UInt16 row, UInt16 column, RectanglePtr bounds) UISECT;
  318. void         ProjectTableUpdate(void) UISECT;
  319. void         Scroll(scrollType s, UInt8 step) UISECT;
  320. void         FrmTaskEditUpdateDateTrigger(MemPtr trigger, DateType p) UISECT;
  321. void         SelectActualTask(Boolean move) UISECT;
  322.  
  323. // forms init
  324. void         ProjectTableInit(void) UISECT;
  325. void         InitFrmTaskEdit(void) UISECT;
  326. void         CleanUpFrmTaskEdit(void) UISECT;
  327. void         InitFrmNoteEdit(void) UISECT;
  328. void         CleanUpFrmNoteEdit(void) UISECT;
  329. void         FrmProjectListInit(void) UISECT;
  330. void         FrmProjectListCleanUp(void) UISECT;
  331.  
  332. #endif
  333.