home *** CD-ROM | disk | FTP | other *** search
/ DTP Toolbox / DTPToolbox.iso / propage4.0 / arexx / calendar_1.pprx < prev    next >
Encoding:
Text File  |  1993-11-07  |  5.4 KB  |  166 lines

  1. /**************************************************/
  2. /*     CALENDAR GENIE FOR PROFESSIONAL PAGE       */
  3. /*                   by John White                */
  4. /*                  NOVEMBER 5, 1993              */
  5. /**************************************************/
  6.  
  7. /*------------- CHECK AND MAKE SURE A PAGE HAS BEEN CREATED ---*/
  8. fpage = ppm_DocFirstPage()
  9. if fpage = 0 
  10.     then choiceint = ppm_Inform(2,"You must create a page first!","CREATE","CANCEL")
  11.        if choiceint = 1 then exit
  12.             else 
  13.                 newpage = ppm_CreatePage(ppm_CurrentPage() + 1,1,0,0,0)
  14.             endif
  15.        endif
  16. call ppm_SetMagMode(50)
  17.  
  18. /* -----------CREATING MONTH AT TOP OF PAGE-----------*/
  19. call ppm_SetBoxOutlines(0)
  20. call AutoUpdate(0)
  21. FontSize = SetSize(58)
  22. cr = '0a'x
  23.     Monthtitle = DATE('Month')
  24.     year= word(DATE(),3)
  25. call SafeEndEdit.rexx()
  26.     form = "Month:"monthtitle||cr"Year:"year
  27.     form = ppm_GetForm("Spell out month...",10,form)
  28.     If form = "" then exit
  29.     parse var form monthtitle '0a'x year
  30.     monthtitle = UPPER(monthtitle)
  31.  
  32. /* ---------- PICK OUT YOUR FAVORITE TYPE FACE --------- */
  33. facelist = ppm_GetTypeFaceList()
  34. facelist = substr(facelist, pos('0a'x, facelist) +1) 
  35. face = ppm_SelectFromList("Select Typeface",32,18,0,facelist)
  36.         If face = "" then face = "(CG)Times"
  37.         call ppm_SetFont(face)
  38.  
  39. /*------------ PUT THE MONTH AND YEAR AT TOP OF CALENDAR ----*/
  40. boxid = CreateBox(.25,.25,7.75,1.3,0,monthbox)
  41. Boxid = SetEdit(monthbox)
  42. call ppm_SetJustification(2)
  43. Success = InsertText(monthtitle||" "||year)
  44. call SafeEndEdit.rexx()
  45.  
  46. /* -----------CREATING BOXES FOR DAYS OF THE WEEK-----*/
  47. call ppm_SetLineWeight(1)
  48.         t=0
  49.             do i = 0 to 6
  50.             boxid = DrawRect((t+.3),1,(t+1.4),1.3,daybox||(i))
  51.             t=t+1.1
  52.             end
  53.     
  54. /* ------------NOW PUTTING IN DAYS OF WEEK-----*/
  55. FontSize = SetSize(20)
  56. tick =0
  57. d=0
  58.     do i = 0 to 6
  59.             tick = i+1
  60.             day = WORD("SUN MON TUE WED THU FRI SAT",tick)
  61.                 boxid = CreateBox((d+.5),1.05,.75,.5,0,day)
  62.                 Boxid = SetEdit(day)
  63.                 Success = InsertText(day)
  64.                 d=d+1.1
  65.                 call SafeEndEdit.rexx()
  66.     end
  67.  
  68. /* ------------SETTING UP CALENDAR-----*/
  69. call ppm_ShowStatus("Drawing calendar... hold on!")
  70. If monthtitle = "JANUARY" then month =  "01 31"
  71. If monthtitle = "FEBRUARY" then month = "02 28"
  72. If monthtitle = "MARCH" then month =    "03 31"
  73. If monthtitle = "APRIL" then month =    "04 30"
  74. If monthtitle = "MAY" then month =      "05 31"
  75. If monthtitle = "JUNE" then month =     "06 30"
  76. If monthtitle = "JULY" then  month =    "07 31"
  77. If monthtitle = "AUGUST" then month =   "08 31"
  78. If monthtitle = "SEPTEMBER" then month ="09 30"
  79. If monthtitle = "OCTOBER" then month =  "10 31"
  80. If monthtitle = "NOVEMBER" then month = "11 30"
  81. If monthtitle = "DECEMBER" then month = "12 31"
  82.  
  83. /* -----------FIGURING OUT FIRST DAY OF MONTH-----*/
  84. amonth = WORD(month,1)
  85. tab = year||amonth||"01"
  86. firstday = DATE('w',(tab),'S')
  87.     If firstday = "Sunday" then firstday =    1
  88.     If firstday = "Monday" then firstday =    2
  89.     If firstday = "Tuesday" then firstday =   3
  90.     If firstday = "Wednesday" then firstday = 4
  91.     If firstday = "Thursday" then firstday =  5
  92.     If firstday = "Friday" then firstday =    6
  93.     If firstday = "Saturday" then firstday =  7
  94.  
  95. /* ----------DRAWING BOXES FOR DAYS-----*/
  96. days = WORD(month,2)
  97. d=0
  98. count = 1
  99. t=(firstday-1)*1.1
  100. days = days+firstday-1
  101.            do w = firstday to days
  102.                 If w = 8  then d = 1.7
  103.                 If w = 15 then d = 3.4
  104.                 If w = 22 then d = 5.1
  105.                 If w = 29 then d = 6.8
  106.            boxid=DrawRect((t+.3),(d+1.5),(t+1.4),(d+3.2),weekbox||(count))
  107.                 t =t+1.1
  108.                 if t = 7.7 then t=0
  109.                 count = count +1
  110.            end
  111. call ppm_ClearStatus()
  112.  
  113. /*------------PUTTING IN THE DATES-----*/
  114. FontSize = SetSize(24)
  115. e=0
  116. d=0
  117. count = 1
  118. /*click =0*/
  119. d=(firstday-1)*1.09
  120.        do i = firstday to days
  121.             If i = 8 then e = 1.7
  122.             If i = 15 then e =3.4
  123.             If i = 22 then e = 5.1
  124.             If i = 29 then e = 6.8
  125.          boxid = CreateBox((d+.4),(e+1.56),.75,.5,0,dayx||(count))
  126.          Boxid = SetEdit(dayx||(count))
  127.          call ppm_SetJustification(0)
  128.          Success = InsertText(count)
  129.             count = count +1
  130.             d=d+1.09
  131.             if d =7.63 then d =0
  132.             call SafeEndEdit.rexx()
  133.        end
  134.  
  135. /* ----------NOW LET'S PUT IN SOME IMPORTANT DATES---*/
  136. i=0
  137. call ppm_SetFont("(CG)Times")
  138. call ppm_SetJustification(0)
  139. FontSize = SetSize(10)
  140.                   
  141.     choiceint = Inform(2,"Add an important note...?","NO","YES")
  142.         If choiceint = 0  
  143.             then exit
  144.         else 
  145.        Do forever    
  146.           whichbox = ClickOnBox("Click on the day...")
  147.           if whichbox = 0 then leave
  148.             where = getBoxPosition(whichbox)
  149.             bname = GetBoxName(whichbox)
  150.             bname = substr(bname,8)
  151.             monthtitle = substr(monthtitle,1,3)
  152.             where1 = WORD(where,1)
  153.             where2 = WORD(where,2)
  154.             form = "Note:"
  155.             form = ppm_GetForm("Date picked: "||(monthtitle)||". "||(bname),24,form)
  156.             parse var form note
  157.             boxid = CreateBox(where1+.1,where2+.45,.85,1.25,0,datebox||(i))
  158.             boxid = SetEdit(datebox||(i))
  159.             success = InsertText(note)
  160.             call SafeEndEdit.rexx()
  161.             i=i+1                
  162.         end
  163.  endif
  164.  
  165.  
  166.