home *** CD-ROM | disk | FTP | other *** search
- /*
- @BSmallCaps @P@ICopyright Gold Disk Inc., February, 1992
- This Genie will convert a block of text to smallcaps.
- */
- if ~show(l, "gdarexxsupport.library") then
- if ~(exists("libs:gdarexxsupport.library") & addlib("gdarexxsupport.library", 0, -30)) then
- exit_msg("Please install the gdarexxsupport.library in your libs: directory before running this Genie")
-
- if word(ppm_GetState(), 1) ~= "3" then
- exit_msg("This Genie works only in edit mode!!")
-
- text = ppm_GetBlockText(1)
- if text = '' then exit_msg("No block selected")
-
- lowersize = ppm_GetSize()
- capsize = 1.25 * lowersize
- captext = "\fs<"capsize">"
- lwrtext = "\fs<"lowersize">"
- cursize = lowersize
-
- i = 1
- len = length(text)
- caplen = length(captext)
- lwrlen = length(lwrtext)
-
- call ppm_ShowStatus("Working..")
-
- do while i < len
-
- i = skipcodes(text, i)
- curletter = substr(text, i, 1)
-
- if curletter = ' ' then
- do
- i = i + 1
- iterate
- end
-
-
- if datatype(curletter, l) then
- do
-
- text = overlay(upper(curletter), text, i)
-
- if cursize = capsize then
- do
- text = insert(lwrtext, text, i - 1)
- i = i + lwrlen
- len = len + lwrlen
- cursize = lowersize
- end
- end
- else if cursize = lowersize & ~datatype(curletter, l) then
- do
- cursize = capsize
- text = insert(captext, text, i - 1)
- i = i + caplen
- len = len + caplen
- end
-
- i = i + 1
-
- end
-
- call ppm_InsertText(text)
- call ppm_ClearStatus()
- exit
-
- exit_msg:
- do
- parse arg msg
-
- call ppm_ShowStatus(msg)
- exit
- end
-
-