home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Datafile PD-CD 3
/
PDCD_3.iso
/
pocketbk
/
utilsm
/
notepad
/
plugs
/
PLUGINS.DOC
Wrap
Text File
|
1993-01-07
|
8KB
|
200 lines
Notepad 3.x-4.x Plug-Ins Information
Notepad 4.x has a feature called Plug-Ins, that allows anyone to write
additional Plug In modules in Opl, to work with Notepad.
Notepad comes with an installer application to install Plug-Ins on to the
Notepad menu. This will also enable me to send out new modules without having
to send out an entire new version of Notepad.
Running Plug-Ins.app
Copy Plugins.app to the Series 3 \app directory. Press Psion<I> from the
system screen and install the application. If you have a Plug-In ready to
install just run the application. Plugins.app will show currently installed
Plug-Ins, Install new Plug-Ins, or remove a Plug-In.
Writing compatible Plug-Ins
The idea behind writing Plug-Ins is that you use different types of data
than the next guy. A Plug-In can automate the inputting of that data. See the
Npflight.opl sample Plug-In. It is a perfect example of how a Plug-In can
help to input data faster and more precise. There are lots of types of data
that we input into the S3 that is the same every time. Plug-Ins will help to
automate the process of inputting that data.
Plug-Ins will show up on the Notepad menu.
It is best when writing a Plug-In to start by creating your own window by
using something like this:
mywin%=gcreate(0,0,240,80,1)
or if you don't want screen blink,
mywin%=gcreate(0,0,240,80,0) rem use 0 at end
REm write info to screen
gvisible on
or you can just use
dinit"My module"
dtext ""," "
dialog
In this case you won't need to create a window since dinit does this for you.
This way when your Plug-In closes, it closes this window and makes a clean
exit. Next item to note is the format of a notepad file.
Notepad format:
1. Notes use logical drive d |Example: d.n$=header$+mydata$
append
gclose mywin%
c:
redraw%=1 :pos%=1 :top%=1
return
2. The open notepad has one field referred to as d.n$, which holds the note.
3. Notepad data has a 12byte header as the first 12 bytes of every note,
and thus the reason for d.n$=header$+mydata$. This could be customized in
your Plug-In easily by doing something like this:
Plug:
local d%,mydata$(255),list$(100),idb$(1),header$(12)
idb$=chr$(155)
header$="M0 " REm 10 of the 12 characters for header
list$="Hot,Warm,Luke Warm,Cool,Cold,Freezing"
dinit"Input new data"
dedit mydata$,"Edit:",14
dchoice d%,"Priority:",list$
if dialog
d.n$=idb$+fix$(d%,0,1)+header$+mydata$
rem idb$=id byte(1st byte) d%=priority(second byte)
append
c: Rem routine to get new count
top%=1 :redraw%=1 :pos%=1 Rem request a redraw
endif
return
endp
In fact ,this example, simple as it is , is a legitimate Plug-In.
Try it out.
5. Editing notepad data
The file must start out by saying
position pos%
Rem pos% is the variable containing record num being pointed to.
Now you're ready to do whatever you want to the current note.
1. Edit it
2. Set an alarm
3. Edit alarm time and date
4. Remove the alarm status
When editing , use
n$=mid$(d.n$,13,240) rem skip the header byte.
dinit"Edit note"
dedit n$,"Note:",14
if dialog
update
endif
Header information:
Each note has a 12 byte header in the front. The significance of each
is as follows.
Byte 1 - chr$(155) (NP 3-4.x id byte)
Byte 2 - priority byte (1-9) single digit string format
Byte 3 - Drive letter if expandable (M,A, or B)
Byte 4 - Length byte of expandable file name -- single digit # for length of filename
Byte 5-12 - File name for Project Manager -- file name to open when expanding - no extension
Notepad assumes and .exp extension, you don't have to worry about that.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Graphic representation of Header in front of each note
Default =
filename|no name here shows it's not expandable
\ / but the spaces must be there if the name isn't
chr$(155)+"1M0 "+ note$
| ||||||||||| | ---- ticks represent bytes in header
1 23456789
/ \ \
10 11 12
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Here are some of the built in routines that you can use:
Compress data file: Compress:(mode%) REm if mode%=0 (busy message shows)
Sort data file: Sort:
Get new count after append: C: ( that's the complete name)
Calculator xcalc:
Set priority Priority: (brings up the priority list)
(and return the number chosen)
Jump to agenda (English ver) Agenda:
Set alarm on current note: NS:
Reset alarm NY:
Remove an alarm NR:
All of these alarm routines will require using "Position pos%" to edit the
note being pointed to by the cursor.
Auto Parsing of the header:
There are 5 globals set to recieve parsed header info.
They are as follows:
1. idb$ - id byte first character of 12 byte header
2. prio$ - priority (2cd)
3. dr$ - drive letter (3rd)
4. lb$ - length byte of file name (4th)
5. fn$ - filename of expand file
Now, how to use these variables:
Call the procedure: split:(d.n$)
This procedure will automatically parse your note
and return the values of the header bytes to these
global variables, which you can use anytime, or change.
But, don't forget you must call
local n$(240)
position pos%
n$=mid$(d.n$,13,240)
split:(d.n$)
Ex: dinit"Edit note"
dedit n$,"Note:",14 rem or whatever width you want
if dialog
d.n$=idb$+prio$+dr$+lb$+fn$+n$ Rem ** all globals
update REm *** you dont have to declare globals
endif
Remember that now that the 12 bytes of the header are split,
you can easily edit them before putting them back together.
dinit
dedit dr$,"Drive:"
dialog
Note:
Don't get confused with the header info. It looks more complicated than it is.
The examples show how to add the string in front of every note to make it
a legitimate Np 3-4.x note. Remember that the header string must be 12 characters
exactly. Look at the sequence above to get the default and at least if you use
the default you will have a legal note. It your note needs to handle expandability
than you will need to insert the name of the file you want to expand to in the
5th thru 12th characters of the header string.
Don't hesitate to contact me if you have any problem.
Mark Esposito
Pelican Software Inc.
70713,1407
(713) 773-2803