home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 3 / PDCD_3.iso / pocketbk / utilsm / notepad / plugs / PLUGINS.DOC
Text File  |  1993-01-07  |  8KB  |  200 lines

  1.  
  2. Notepad 3.x-4.x Plug-Ins Information
  3.  
  4. Notepad 4.x has a feature called Plug-Ins, that allows anyone to write
  5. additional Plug In modules in Opl, to work with Notepad.
  6. Notepad comes with an installer application to install Plug-Ins on to the
  7. Notepad menu. This will also enable me to send out new modules without having
  8. to send out an entire new version of Notepad.
  9.  
  10. Running Plug-Ins.app
  11.  
  12. Copy Plugins.app to the Series 3 \app directory. Press Psion<I> from the
  13. system screen and install the application. If you have a Plug-In ready to
  14. install just run the application. Plugins.app will show currently installed
  15. Plug-Ins, Install new Plug-Ins, or remove a Plug-In.
  16.  
  17. Writing compatible Plug-Ins
  18.  
  19. The idea behind writing Plug-Ins is that you use different types of data
  20. than the next guy. A Plug-In can automate the inputting of that data. See the
  21. Npflight.opl sample Plug-In. It is a perfect example of how a Plug-In can
  22. help to input data faster and more precise. There are lots of types of data
  23. that we input into the S3 that is the same every time. Plug-Ins will help to
  24. automate the process of inputting that data.
  25.  
  26. Plug-Ins will show up on the Notepad menu.
  27.  
  28. It is best when writing a Plug-In to start by creating your own window by
  29. using something like this:
  30.  
  31. mywin%=gcreate(0,0,240,80,1)
  32.         or if you don't want screen blink,
  33.                 mywin%=gcreate(0,0,240,80,0) rem use 0 at end
  34.                   REm write info to screen
  35.                    gvisible on
  36.  
  37.         or you can just use
  38.  
  39. dinit"My module"
  40. dtext ""," "
  41. dialog
  42.  
  43. In this case you won't need to create a window since dinit does this for you.
  44.  
  45. This way when your Plug-In closes, it closes this window and makes a clean
  46. exit. Next item to note is the format of a notepad file.
  47.  
  48. Notepad format:
  49.  
  50. 1. Notes use logical drive d |Example:   d.n$=header$+mydata$
  51.                                          append
  52.                                          gclose mywin%
  53.                                          c:
  54.                                          redraw%=1 :pos%=1 :top%=1
  55.                                          return
  56.  
  57. 2. The open notepad has one field referred to as d.n$, which holds the note.
  58.  
  59. 3. Notepad data has a 12byte header as the first 12 bytes of every note,
  60.    and thus the reason for d.n$=header$+mydata$. This could be customized in
  61.    your Plug-In easily by doing something like this:
  62.  
  63.                         Plug:
  64.                         local d%,mydata$(255),list$(100),idb$(1),header$(12)
  65.                         idb$=chr$(155)
  66.                         header$="M0        "  REm 10 of the 12 characters for header
  67.                         list$="Hot,Warm,Luke Warm,Cool,Cold,Freezing"
  68.                         dinit"Input new data"
  69.                         dedit mydata$,"Edit:",14
  70.                         dchoice d%,"Priority:",list$
  71.                         if dialog
  72.                          d.n$=idb$+fix$(d%,0,1)+header$+mydata$
  73.                          rem idb$=id byte(1st byte)  d%=priority(second byte)
  74.                          append
  75.                         c:        Rem routine to get new count
  76.                         top%=1 :redraw%=1 :pos%=1   Rem request a redraw
  77.                         endif
  78.                         return
  79.                         endp
  80.  
  81. In fact ,this example, simple as it is , is a legitimate Plug-In.
  82. Try it out.
  83.  
  84. 5. Editing notepad data
  85.  
  86.         The file must start out by saying
  87.  
  88.                 position pos%
  89.  
  90.         Rem pos% is the variable containing record num being pointed to.
  91.  
  92.         Now you're ready to do whatever you want to the current note.
  93.                 1. Edit it
  94.                 2. Set an alarm
  95.                 3. Edit alarm time and date
  96.                 4. Remove the alarm status
  97.  
  98.         When editing , use
  99.                 n$=mid$(d.n$,13,240)  rem skip the header byte.
  100.                 dinit"Edit note"
  101.                 dedit n$,"Note:",14
  102.                 if dialog
  103.                  update
  104.                 endif
  105.  
  106. Header information:
  107.         Each note has a 12 byte header in the front. The significance of each
  108. is as follows.
  109.  
  110. Byte 1 - chr$(155) (NP 3-4.x id byte)
  111. Byte 2 - priority byte (1-9)        single digit string format
  112. Byte 3 - Drive letter if expandable     (M,A, or B)
  113. Byte 4 - Length byte of expandable file name   -- single digit # for length of filename
  114. Byte 5-12 - File name for Project Manager -- file name to open when expanding - no extension
  115.             Notepad assumes and .exp extension, you don't have to worry about that.
  116.  
  117. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  118. Graphic representation of Header in front of each note
  119.  
  120. Default =
  121.                     filename|no name here shows it's not expandable
  122.                          \  / but the spaces must be there if the name isn't
  123.           chr$(155)+"1M0        "+ note$
  124.             |        |||||||||||     |   ---- ticks represent bytes in header
  125.             1        23456789
  126.                             /  \ \
  127.                            10  11 12
  128.  
  129. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  130. Here are some of the built in routines that you can use:
  131.  
  132. Compress data file:             Compress:(mode%)    REm if mode%=0 (busy message shows)
  133. Sort data file:                 Sort:
  134. Get new count after append:     C:   ( that's the complete name)
  135. Calculator                      xcalc:
  136. Set priority                    Priority:      (brings up the priority list)
  137.                                                 (and return the number chosen)
  138. Jump to agenda (English ver)    Agenda:
  139.  
  140. Set alarm on current note:      NS:
  141. Reset alarm                     NY:
  142. Remove an alarm                 NR:
  143.  
  144.  
  145.  
  146. All of these alarm routines will require using "Position pos%" to edit the
  147. note being pointed to by the cursor.
  148.  
  149. Auto Parsing of the header:
  150. There are 5 globals set to recieve parsed header info.
  151. They are as follows:
  152.  
  153.         1. idb$ - id byte first character of 12 byte header
  154.         2. prio$ - priority (2cd)
  155.         3. dr$   - drive letter  (3rd)
  156.         4. lb$  - length byte of file name  (4th)
  157.         5. fn$  - filename of expand file
  158.  
  159. Now, how to use these variables:
  160.  
  161.                 Call the procedure: split:(d.n$)
  162.                 This procedure will automatically parse your note
  163.                 and return the values of the header bytes to these
  164.                 global variables, which you can use anytime, or change.
  165.                 But, don't forget you must call
  166.  
  167.                         local n$(240)
  168.                         position pos%
  169.                         n$=mid$(d.n$,13,240)
  170.                         split:(d.n$)
  171.                 Ex:     dinit"Edit note"
  172.                         dedit n$,"Note:",14  rem or whatever width you want
  173.                         if dialog
  174.                          d.n$=idb$+prio$+dr$+lb$+fn$+n$   Rem ** all globals
  175.                          update           REm ***  you dont have to declare globals
  176.                         endif
  177.                 Remember that now that the 12 bytes of the header are split,
  178.                 you can easily edit them before putting them back together.
  179.  
  180.                 dinit
  181.                 dedit dr$,"Drive:"
  182.                 dialog
  183.  
  184. Note:
  185.  
  186. Don't get confused with the header info. It looks more complicated than it is.
  187. The examples show how to add the string in front of every note to make it
  188. a legitimate Np 3-4.x note. Remember that the header string must be 12 characters
  189. exactly. Look at the sequence above to get the default and at least if you use
  190. the default you will have a legal note. It your note needs to handle expandability
  191. than you will need to insert the name of the file you want to expand to in the
  192. 5th thru 12th characters of the header string.
  193.  
  194. Don't hesitate to contact me if you have any problem.
  195.  
  196.                                 Mark Esposito
  197.                              Pelican Software Inc.
  198.                                  70713,1407
  199.                                (713) 773-2803
  200.