                ********************************************

                STRIPSTYLE --  VERSION 236 4th January 2005

                ********************************************

See the end of this file to understand what the program is actually for - this
section just tells you how to use it.

This program supports Acorn's interactive (try altering a few of the settings with !Help still running) !Help.
It should work from an archive.  This has not been tested.

-------------------------------------------------------------------------
A QUICK GUIDE

Take an Impression DDF file (saved 'with styles') and drag it onto the iconbar or the box marked 'Drop file here' in the main window.   Click on the 'OK' icon.   The main window closes.   After a while an alert box comes up to tell you that Stripstyle has finally finished.   The main window re-opens.    That's it.   Your stripped file will have been saved under the default name 'Output' in the directory from which it came.   Now read the rest of this helpfile.

-------------------------------------------------------------------------

THE MAIN MENU

'Info' and 'Quit' do the usual things....
Stripstyle's choices are set from the main window.   The only option on the menu is one you may wish to change while the program is working and the main window is closed - 'Show working'.   This toggles on/off the display of the small 'Progress' window.   'Abort' will stop the program at whatever stage it has reached.   It cannot delete files already processed or half-finished files.
-------------------------------------------------------------------------

THE MAIN WINDOW

This is displayed when the program first loads, and re-displayed when a file is dragged to the Stripstyle iconbar icon, and when processing has finished.
'Directory containing file(s)'; type in the path of the relevant directory.
'Name of input file'; type in the name of the file to strip.

'Drop file here to set defaults'
Dropping a file on this icon will set both the icons above.   If you plan to process a group of numbered files (see below) drop any one of them here.

'Name of output file'; type in the name under which to resave.
Remember to change this if stripping several files individually - Stripstyle will happily save them all on top of each other!

'Process numbered files'
This is the most complicated part - what the whole program was written to do, really....
In order to use this you need your DDF files to have been saved out of Impression with the names Name1,Name2,Name3 etc. ('Name' is just an example-  they could be called anything and need not start from 1!)   If this is not the case you could rename them. There must not be any missing numbers in the sequence, since you can only specify an inclusive range of numbered suffixes.   Harder to explain than to do....

When you select this option any numbers on the filename in the 'Input' icon will disappear, showing that the program will now process all files starting with that name - providing they fall within the range shown below, which will have been extended to include this filename.

You will also see the greyed-out icons below re-appear.

'from 1   to  1'
These icons can only be altered if the 'Process numbered files' option is on.   Type in numbers or click on the 'bump' arrows to alter the range of files which will be stripped.   They automatically update to include the currently dragged file as soon as the 'numbered files' option is activated.
Note that you cannot exceed 99 files!

'Multitasking'
If you know what multitasking is, then it's obvious that these icons toggle its selection.
Otherwise, this can be considered, when selected, to be an option to speed up the program at the cost of a temporary desktop freeze.

'Create/use subdirectory'
This helps you keep your output separate from your input.   Selecting this option will un-grey the icon containing the default name and allow you to edit it.   If the directory named already exists inside the directory containing your files then the stripped files will be resaved inside it.   If it doesn't exist, it will first be created, then used.

There is no option to save output files to other directories - just to sub-directories of the original.

'OK'
This is the default icon - pressing RETURN when the caret is in a Stripstyle window (ie the titlebar is yellow) will set the program to work.   If you haven't given it input and/or output paths it may abort immediately.   

-------------------------------------------------------------------------
THE PROGRESS WINDOW

The purpose of this window is merely to confirm that Stripstyle is in fact doing something, and to show which file of a group it has reached.   'Show working' from the main menu will toggle it open and shut, even while the program is processing files.

-------------------------------------------------------------------------
THE INFO WINDOW

Chris Coe is entirely innocent of anything to do with this program, other than writing the WIMP library of which I have used parts.   However, he asks to be credited with this 'somewhere visible to the user' and I can't find anywhere else to do it, so sorry, Mr Coe, you get equal star billing.

-------------------------------------------------------------------------
TECHNICAL STUFF

Stripstyle is a null-polling task.   As a result, it
 (a) slows down dramatically in the presence of other null-polling tasks, like my screensaver 'Horizon'.
 (b) may slow your desktop, depending on the speed of your computer.   I'm using an ARM250 and have no discernable problems...
 
The cure for both is to use the non-multi-tasking mode - unless you are stripping vast numbers of files, you'll find this takes no longer anyway than, say, waiting for Impression to load.

On a really serious error - one that causes the program to quit immediately - Stripstyle will issue a CLOSE#0 to clear up after itself.   'Normal' errors only close files opened by Stripstyle.

Identifying DDF files
First Stripstyle checks if they are text files, then if they start with a '{' character and finally searches for '}' not at the end of a line (i.e. the end of the last style definition) before stripping from that point.   Any file not meeting these conditions will (eventually) be rejected.   Any files which meet these conditions will be stripped whether they are DDF files or not.
A side-effect is that feeding Stripstyle its own output will result in its stripping the file down to its first {"style" on} statement.

-------------------------------------------------------------------------

There are no thanks, because they are boring and meaningless to anyone but
the author.
If I get hold of Ben Summers' HelpReader application and use it, I shall put
in an acknowledgement here... otherwise you'll have to read this in a text editor.

If anyone other than me ever reads this, the program Stripstyle is FREEWARE.
Feel free to delete any bits you don't need - like this file for example!
Passing it on to other people without any helpfile is not very friendly, though....


--------------------------------------------------------------------------------

This program is of use only to users of Impression Publisher (or Style) or Impression II.   It is designed to remove the style definitions from the head of a document saved in Computer Concepts' 'DDF format' -- that is, one saved as text 'with styles' so that italics, headings etc will be preserved when it is dropped back into an Impression document.
   If you actually examine one of these text files you will find that they start with a hundred or so lines of style definitions, often followed by a much smaller quantity of text!   In many cases these definitions are unnecessary since the eventual destination Impression document will already contain all the styles used and there will be no need to redefine them from the DDF file.   Also, many of the styles may not actually have been used in the document itself -- for example, unless you have deleted these styles, all Impression documents (and hence DDF files) contain the styles "Table" and "Hanging indent", though most documents have not used them.
   I can envisage two main cases where this application would come in useful -- the one for which I designed it, where many 'chapters' of a document are generated (or collated from a selection of magazine articles etc.) and saved in DDF format, only the first chapter needing to retain the style information for when they are eventually compiled into chapters of a single Impression document, and the (frequent) case when documents contain no 'user-defined styles', or only commonly used 'house styles' which are already contained in a standard blank copy of the newsletter or whatever for which these excerpts are destined.

I also find Stripstyle useful when attempting to print out documents created on another machine whose master pages are the wrong dimensions for my printer.   Altering the original master page ought to work, but often gives rise to further problems -- I find it more convenient to save out all the chapters as stripped DDF files, then drop them into a document with my own default master pages, dealing manually with any formatting errors caused by the pages' now being a different size.

   Note that Stripstyle'd documents are of no use at all on their own -- their only purpose is eventually to be fed back into Impression, meanwhile reducing storage space....

   "Stripstyle" supports interactive help.

 *************************************************************************

      Why use Stripstyle rather than saving documents in Impression format or as plain text without styles?

Some statistics:
Impression 'application' style document        28506 bytes
Impression Publisher single file document      28036 bytes
Impression II style DDF document               18197 bytes
Impression Publisher style DDF document        18851 bytes
Plain text file                                14711 bytes

Same document Stripstyle'd                     15743 bytes

   As you can see above, for a single chapter document, using the default A4 master page, with no extra frames on any of the pages (that is, one where there is no information which cannot be contained in a DDF file) a DDF file is considerably smaller than the original document - which means you can fit a lot more of them on a disc.   In fact, for short files, the 'overheads' of an Impression document are often larger than the textual content of the file itself!
   In this case, you can also see that 28% of the DDF file consists of style information rather than text.   This file was one of a series of (20!) articles in 'Archive' magazine -- assuming that you wished, as I did, to reassemble the lot into a reference document for your own use, you can see that only one copy of this information would be needed, rather than 20....
   After passing through "Stripstyle", the document now contains only 7% style information -- but, dropped onto an Impression document which already contains all the styles (i.e. the previous 19 chapters!), it will produce exactly the same result as the original DDF file.   A side effect of being Stripstyle'd is that the DDF file becomes a lot more 'tweakable' in "Edit" -- in this particular file, 118 lines out of 362 are taken up by the initial style definitions, since these lines are disproportionately short;  rather a lot to scroll through before you can check the content of the file!

   (All the above is just justification for having written the program;  my real motive was simply to avoid having to delete the incredibly long list of unused styles from other parts of the magazine that were being added to my style list every time I appended a new article to my document!)

   If you drop a Stripstyle'd file onto a document which does not contain all the styles used in it, any extra styles will be created and added to the style list for you as 'null styles' which currently do nothing -- but all the places where they apply are recorded, and you can restore any missing formatting by editing them back to their original form.   And if an original document does contain some graphics, you can always save them out separately as Draw files before saving your text 'with styles' and Stripstyling it, then put them back into the eventual destination document.

   To summarise:  Stripstyle is of most use to people like me who save large numbers of short DDF files all sharing an identical set of styles, and who are paranoid about 'wasting space' on their floppy discs or 40/80Mb hard drive, and always delete unused styles from their Impression documents... probably a subset of one, i.e only me.   That's all right, I wrote it for my own use.

   Incidentally, the original 2k BASIC file Stripstyle inside this application can perform all the functions of the 65k application except for multitasking and checking for stupid input -- the only reason for WIMPifying it was to show off -- so if you want to be consistent in your paranoia, delete the main application, edit the variables at the beginning of the BASIC program (or put in some INPUT statements) and use that instead!

Harriet Bazley 30th January 1998

--------------------------------------------------------------------------------
Recent updates (2005)

Fixed little bug which caused the program to hang up at the start of the first file processed, due to a failure of its state machine after the 'dummy' procedure was commented out...!

Combined old 'Help' and 'Readme' files.

Removed dependence on IfThereIs - programmer now being aware that *CDir does not cause an error if said directory already exists...!

Upgraded the application to require RISC OS 3 (oo-err Missus) in order to provide interactive menu help as well as help on windows, since I couldn't, off-hand, remember what the menu entries actually did....

Added 'Help' entry to main menu in accordance with Castle's very sensible guidelines (did Castle Technology even exist when I wrote this program, I wonder?)

Increased height of icons in the info window to make them more readable in the 3D format to which I had, at some heady point, updated them.

