home *** CD-ROM | disk | FTP | other *** search
/ linuxmafia.com 2016 / linuxmafia.com.tar / linuxmafia.com / pub / palmos / happydays-src-1.37.tar.gz / happydays-src-1.37.tar / happydays-1.37 / happydays.h < prev    next >
C/C++ Source or Header  |  2000-10-02  |  5KB  |  164 lines

  1. /*
  2. HappyDays - A Birthdate displayer for the PalmPilot
  3. Copyright (C) 1999-2000 JaeMok Jeong
  4.  
  5. This program is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU General Public License
  7. as published by the Free Software Foundation; either version 2
  8. of the License, or (at your option) any later version.
  9.  
  10. This program is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13. GNU General Public License for more details.
  14.  
  15. You should have received a copy of the GNU General Public License
  16. along with this program; if not, write to the Free Software
  17. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  18. */
  19.  
  20. #ifndef _HAPPYDATE_H_
  21. #define _HAPPYDATE_H_
  22.  
  23. #define PREFSVERSION        11
  24.  
  25. #define AppErrStrLen        256
  26. #define DEFAULT_DURATION    5
  27. #define MAINTABLEAGEFIELD   24
  28.  
  29. #define MainAppID           'Jmje'
  30. #define MainDBType          'DATA'
  31. #define MainDBName          "HappyDaysDB-Jmje"
  32. #define PrefsDBType         'DATA'
  33. #define PrefsDBName         "HappyDaysPrefs-Jmje"
  34. #define DatebookAppID       'date'
  35. #define DatebookDBName      "DatebookDB"
  36. #define ToDoAppID           'todo'
  37. #define ToDoDBName          "ToDoDB"
  38. #define AddressAppID        'addr'
  39. #define AddressDBName       "AddressDB"
  40. #define MemoAppID           'memo'
  41. #define MemoDBName          "MemoDB"
  42.  
  43. #define DATEBK3_MEMO_STRING "DATEBK3\n"       // datebk3 icon in memo list
  44.  
  45. /* DateBook Notify Preferences */
  46. struct sDBNotifyPrefs 
  47. {
  48.     char alarm;             // alarm set?
  49.     char icon;              // icon?
  50.     char datebk3icon;       // datebook 3 icon
  51.     int  notifybefore;      // prenotify duration
  52.     int  duration;          // interval of notified records
  53.     TimeType when;          // no-time
  54.     char an_icon[5];        // action name icon?
  55. };
  56.  
  57. /* ToDo Notify Preferences */
  58. struct sTDNotifyPrefs 
  59. {
  60.     char priority;            // priority of TODO
  61.     char todoCategory[dmCategoryLength];
  62. };
  63.  
  64. struct sBirthPrefs 
  65. {
  66.     char custom[12+1];          // addr label length
  67.     char notifywith[5+1];       // notify with (HD)
  68.     char sort;                  // sorting order
  69.     char emphasize;             // emphasize lunar
  70.     char notifyformat;          // notify format list
  71.     char scannote;              // scan from notes?
  72.     Boolean sysdateover;        // override system date format
  73.     DateFormatType dateformat;  // if sysdateover is true
  74. };
  75.  
  76.  
  77. struct sPrefsR 
  78. {
  79.     char version;           // version number
  80.     char records;            // all or selected(0: all, 1: selected)
  81.     char existing;            // keep or modify(0: keep, 1: modify)
  82.     char private;            // (0: public, 1: private)
  83.  
  84.     struct sDBNotifyPrefs DBNotifyPrefs;
  85.     struct sTDNotifyPrefs TDNotifyPrefs;
  86.     struct sBirthPrefs    BirthPrefs;
  87.  
  88.     // HideSecretRecord in system global preference
  89.     Boolean gHideSecretRecord;
  90.     
  91.     char addrCategory[dmCategoryLength];
  92.     char adrcdate[4], adrmdate[4];      // address book create/modify date
  93.     char memcdate[4], memmdate[4];      // memo create/modify date
  94. };
  95.  
  96. typedef union 
  97. {
  98.     struct      
  99.     {
  100.         unsigned reserverd:10;
  101.         unsigned multiple_event:1;      // this is multiple event(for check)
  102.         unsigned year:1;                // date contains year field
  103.         unsigned priority_name1:1;      // name1 has priority?
  104.         unsigned lunar_leap :1;         // lunar leap month?
  105.         unsigned lunar      :1;         // lunar calendar?
  106.         unsigned solar      :1;         // solar calendar?
  107.     } bits;
  108.     Int16 allBits;          // 16 bit
  109. } BirthdateFlag;
  110.  
  111. typedef struct 
  112. {
  113.     UInt32 addrRecordNum;   // address book record number
  114.     DateType date;          // orignal address book birthdate 
  115.     BirthdateFlag flag;     // about birthdate flag
  116.     char *name1;
  117.     char *name2;
  118.     char *custom;
  119. } BirthDate;
  120.  
  121. typedef struct
  122. {
  123.     UInt32 addrRecordNum;
  124.     DateType date;
  125.     BirthdateFlag flag;
  126.     char name[1];           // actually may be longer than 1
  127. } PackedBirthDate;
  128.  
  129. #define INVALID_CONV_DATE       127
  130.  
  131. //
  132. // Table row item, used for sort
  133. typedef struct 
  134. {
  135.     UInt16 birthRecordNum;  // birthdate+ DB record num
  136.     DateType    date;       // converted date(the incoming birthday)
  137. } LineItemType;
  138.  
  139. typedef LineItemType* LineItemPtr;
  140.  
  141. #ifndef MAX
  142. #define MAX(_a,_b) ((_a)<(_b)?(_b):(_a))
  143. #endif
  144. #ifndef MIN
  145. #define MIN(_a,_b) ((_a)<(_b)?(_a):(_b))
  146. #endif
  147.  
  148. #define         ENONBIRTHDATEFIELD      -100
  149. #define         EDBCREATE               -101
  150.  
  151. // birthdate list
  152. extern MemHandle gTableRowHandle;
  153. extern struct sPrefsR *gPrefsR;
  154. extern Char gAppErrStr[AppErrStrLen];
  155. extern Boolean gPrefsRdirty;
  156. extern Boolean gSortByCompany;
  157. extern DmOpenRef MainDB;
  158. extern DmOpenRef AddressDB;
  159. extern UInt32 gDbcdate, gDbmdate, gAdcdate, gAdmdate;
  160. extern DateFormatType gPrefdfmts;  // global date format for Birthday field
  161. extern DateFormatType gDispdfmts;  // global date format for display
  162.  
  163. #endif
  164.