home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ARM Club 3
/
TheARMClub_PDCD3.iso
/
mag_discs
/
14
/
programs
/
quotes
/
!Quotes
/
!Help
< prev
next >
Wrap
Text File
|
1994-01-27
|
8KB
|
178 lines
Smart Quotes version 1.01
© Sam Kington 23rd December 1993
See end of file for conditions of distribution.
This program is freeware, *not* public domain - i.e., I retain copyright.
Warning: this program uses a major feature of RISC OS 3.10 (namely
post-filters), so will not run under RISC OS 2. If you haven’t upgraded to
RISC OS 3.10 yet, **DO SO!!** You are cutting yourself off from a lot of
nice free software (not just this)!
If you have RISC OS 3.00 or 3.10, but the program thinks you have RISC OS 2,
try typing *RMReinit FilterManager from the command line (type F12 or
Ctrl-F12 to get to the command line), then run the program.
This is a small utility to replace neutral quotes (e.g. "") by smart quotes
(e.g. “”), on the fly, as you type. It avoids having to resort to the
numeric keypad (ALT-148 and ALT-149 for open and closed double quotes
respectively) or other obscure key-combinations (CTRL-SHIFT-[ and ] in
Impression).
There are two parts to this utility: the module SmartQuotes, which
intercepts key-presses and parses them accordingly, and the WIMP front-end,
which provides an easier way of changing settings than entering *commands
(see below). Both of them are very small, but at a pinch the module will
work without the front-end (even though quitting the front-end automatically
kills the module).
The front-end installs itself to the left of the Palette icon: you will
rarely want to access it, so it stays out of the way. Clicking on the icon
will always open the settings box, even if it is iconised.
Operation of the program is (hopefully ;-) ) self-explanatory; the
principles behind it may not. What the program basically does is sit in the
background, and intercept all the key presses, substituting double and
single quotes according to the current settings. Double quotes are very
simple: it just substitutes neutral quotes (") by “ and ” alternatively,
which should be OK in the vast majority of cases (unless you are using lots
of nested quotations). The problem is single quotes.
Because SmartQuotes has no knowledge of what you have previously typed, it
doesn’t know, when you type an apostrophe, whether you are starting or
closing a quotation (e.g. ‘some text’), or whether the apostrophe is part of
a word (e.g. “don’t”). So, left to itself, it will often get it wrong. As
most people don’t use single quotes a lot, but use apostrophes all the time,
SmartQuotes will automatically substitute neutral single quotes by
apostrophes; however, there is an option to substitute neutral single quotes
alternatively with ‘ and ’. Of course, if you’re still not satisfied, you
can turn the whole thing off and stick to double quotes.
Default settings are stored in a file called “Choices” inside the
!SmartQuotes directory. You can save the settings via the menu (see below).
One last thing: if you modify the SmartQuotes settings from the command
line, the settings dialogue box will no longer be accurate, as the module
has no way of telling the front end the settings have changed. Clicking on most of
the icons to set all the settings by the dialogue box usually gets rid of
the discrepancy.
Menu structure
**************
There are four options on the iconbar:
Info : standard info dialogue box
Settings... : opens the Quotes Settings dialogue box
Save choices : saves the current settings, which will now be
the default settings when the program starts up.
Quit : quits the front end and the module, terminating quotes
substitution
Settings dialogue box
*********************
Substitute quotes: when selected, neutral double quotes will be substituted
by smart quotes (e.g. “”); otherwise, all quotes are unsubstituted ("").
Substitute single quotes: when selected, neutral single quotes will be
substituted according to the single quotes option (see below). When
unselected, neutral single quotes remain neutral.
Apostrophes only: when selected, neutral single quotes are replaced by
apostrophes (e.g. ’).
Both single quotes: when selected, neutral single quotes are replaced by
open and closed single quotes alternatively, like double quotes (e.g. ‘’).
Settings are changed immediately.
* commands
**********
QuotesOn: turns double quote substitution on. Equivalent to selecting
“Substitute quotes”.
QuotesOff: turns all substitution off. Equivalent to de-selecting
“Substitute quotes”.
SingleOn: turns single quote substitution on. Equivalent to selecting
“Substitute single quotes”.
SingleOff: turns single quote substitution off. Equivalent to de-selecting
“Substitute single quotes”.
OnlyApos: single quotes are substituted by apostrophes. Equivalent to
selecting “Apostrophes only”.
BothSingle: single quotes are substituted by alternate open and closed
single quotes. Equivalent to selecting “Both single quotes”.
Other comments
**************
I would like to thank Acorn for this nice machine, and especially the bit in
RISC OS 3.1 (the Filter Manager) that allows you to intercept other tasks’
events and muck about with them as you please. It is exceedingly useful
- look at all the other utilities around using filters! ;-).
I got the idea for this utility after reading a small news item in MacWorld
about a similar program for the Mac, that sat in the background and
substituted quotes for you. That one also substituted dashes for you - i.e.
replaced “--” by “—”. However, I couldn’t get that to work, and it isn’t
*that* important anyway.
Things that might be nice would be:
A code variable (SmartQuotes$Options for instance), to set settings from
the command line or (more usefully) an Obey or Desktop file. I was going to
rip off the code variable from Desktop+, but I decided it wouldn't be fair.
Changing the icon to reflect the status, i.e. show what the next
substituted " and ' will be.
Substituting dashes.
Substituting foreign characters (i.e. type ’e and it subsitutes a é).
Expanding whole expressions (as in Impression’s abbreviations and
Microsoft’s IntelliSense).
Adding/removing smart quotes from files dragged to the icon.
The first three I haven’t managed to do (I’m not an assembler programmer and
my hard disc isn’t working :-( so I can’t use C); the last one would
probably take up too much memory. The program is basically a quick hack,
hopefully an elegant one but not something I want to spend too much time on.
(Apart from writing this Help file, that is ;-)).
Programmers take note!!
***********************
If you forget to turn off Smart Quotes substitution, you may get strange
errors (“No such variable” or something), the cause of which may not be
immediately obvious, especially if you are programming with an outline font
rather than the System font. Replacing all spurious smart quotes with
standard neutral quotes does wonders ;-).
Boring legal message
********************
This application is freeware, that is, it can be distributed freely as long
as only reasonable charges are made for media and distribution. I retain
copyright on all program code and documentation.
If you use this at all, write to me or e-mail me (see below) telling me how
wonderful it is etc. :-) or how atrocious it is :-( (surely not?); anyway,
tell me. It would be nice to hear from people.
How to contact me
*****************
E-mail: modsk@dish.gla.ac.uk (guaranteed until June 1996)
Snail-mail : QM Hall (Term-time, until June 1994)
55 Bellshaugh Road
Glasgow G12 0SQ
SCOTLAND
Merlhiot (Home address, guaranteed)
24420 Savignac les Eglises
FRANCE