2 Configuration
Phedit can be configured by:
- using the Phedit Menu Editor to make your own menubar with your own
submenus;
- using the Options window (available through the
Settings ... option of the Options menu);
- creating your own macros by recording keystrokes as you do them and
assigning keys to activate those macros;
- creating your own mscros by editing the macro and key files directly.
2.1 Phedit Files
Phedit deals with the following types of files:
-
Configuration Files - These include the older QWEdit
QWEdit.cfg file and the newer .phedit.cfg file. The
QWEdit.cfg file contains configuration information, macros and key
bindings for those macros. The 0.01 version of the .phedit.cfg file
is pretty much the same as the QWEdit.cfg file. The 0.02 version of
the .phedit.cfg file contains only configuration information.
Everything in this file can be set from within Phedit. Be very
careful if you edit this file directly.
-
Macro Files - This is the .phedit.mac file. It contains only
macros. When Phedit starts up it is read in. When Phedit terminates
it saves all macros back to this file.
-
Key Files - This is the .phedit.key file. It is actually a
macro file which contains only one macro. All that this macro does
is make calls to the AddKeyBinding() primitive in order to bind
keys to primitives and macros. When Phedit is started up
this file is loaded in, the macro in it is run and then the macro
is deleted from memory. When Phedit terminates it saves almost all
key bindings back to this file. The only key bindings it does not
save are ones that come from a menu file.
-
Menu Files - This is the .phedit.mnu file or the file that
you specify with the -u option when you start up Phedit. It
contains the details for all of the menus for a single menubar. This is
simply an easy to read and relatively easy to write text file. It is the
file that is created when you use the Phedit Menu Editor.
2.2 Startup Search Order
When Phedit starts up it has to read in settings from configuration
files, macro files, key files, menu files and the command line. The
order in which these things are read in is given below:
-
[UserPath] is:
-
if the p= option is given then this is [UserPath] otherwise ...
-
the contents of the HOME environment variable are used.
-
[CfgPath] is:
-
if the PHEDIT_PATH environment variable exists then this is
[CfgPath] otherwise ...
-
if the directory /usr/lib/phedit exists then this is used otherwise ...
-
the directory that the phedit executable file was loaded from is used.
Key bindings to macros can be read in from:
-
the QWEdit.cfg files or .phedit.mac files,
-
keyboard files (.key) and
-
menu files (.mnu)
The order above is important in that if duplicates are found then
the last one found is the one used. The rational for putting
menu files at the end of the sequence is that they are what the
user sees as hotkeys displayed in the menus and therefore must
be correct.
The p= option is examined first in order to help establish
[UserPath] as explained above.
-
Configuration and Macro Files
The following is the search order for finding configuration and
macro files. In the search order below once the configuration
has been found in one file then search stops. The same is true
of macros.
-
[UserPath]/.phedit.cfg is searched for
-
[CfgPath]/.phedit.cfg is searched for
-
[UserPath]/.phedit.mac is searched for
-
[CfgPath]/.phedit.mac is searched for
-
If .phedit.cfg was not read in above then the configuration
portion of QWEdit.cfg is sought after.
-
[UserPath]/windows/QWEdit.cfg is searched for
-
[CfgPath]/QWEdit.cfg is searched for
-
If .phedit.mac was not read in above then the macro portion
of QWEdit.cfg is sought after.
-
[UserPath]/windows/QWEdit.cfg is searched for
-
[CfgPath]/QWEdit.cfg is searched for
-
Factory defaults are used.
Command line options that may affect configuration are done
next which means that they override whatever is found in the
configuration files.
-
Keyboard Files
The following is the search order for finding keyboard files.
In the search order below once the keyboard file has been
found then search stops.
-
[UserPath]/.phedit.key is searched for
-
[CfgPath]/.phedit.key is searched for
-
Menu Files
In the search order once the menu has been found in one file then
search stops even if there is an error reading in the file.
-
if the -u option is given from the command line then that menu
file is used
-
if the +e option is given then the builtin embedded menu is used
-
[UserPath]/.phedit.mnu is searched for
-
[CfgPath]/.phedit.mnu is searched for
-
the default builtin menu is used
-
Printer Filter File
-
If the given filename begins with a '/' (slash) then
it has been given the full path for the file and
looks no further otherwise ...
-
it looks in [UserPath]. If it doesn't find it there then ...
-
it looks in [CfgPath].
-
Font List File
-
It first looks in [UserPath]. If it doesn't find it there then ...
-
it looks in [CfgPath].
2.3 Temporary Files
Temporary files are created by Phedit for various things. The format
of temporary filenames, when they are used and where they are
located are discussed below.
The format of a temporary filename depends on what the temporary
file is being used for. All temporary files have some parts in
common. The format of a temporary filename is as follows:
phe. + prefix + . + DDHHMM + . node_id +
. + process_id
where:
- prefix is dependent on what the temporary file is being used for.
The prefix for each usage is given below where the various uses for
temporary files are listed.
- DDHHMM is the day of the month with leading zero followed by the
hour in 24 hour format with leading zero followed by the minute with leading
zero.
- node_id is the node that Phedit is running on.
- process_id is Phedit's process id.
An example of a temporary filename used when saving a file that you are
editing is:
phe.f1.hello.c.051004.2.6742
Phedit uses temporary files under the circumstances listed below.
- Two temporary files are used when saving the text files that you are
editing (prefix is f1. + filename). During saving of your
files Phedit does not actually write to your file. Instead it writes to a
temporary file and when completely done replaces your file with the
temporary file. Even during the replacement Phedit does not take chances.
Once your text has been successfully written to a temporary file, Phedit
then renames the last version of your file to another temporary file
(prefix is fb1. + filename). It then renames the first
temporary filename to the name of your file. Only once that is successful
does it remove your file.
The end result of all this is that if something causes the save
to fail you should not loose your file.
These temporary files are located in the same directory that your
text file is in.
-
Two temporary files are used when saving your macro files (prefixes are
mac. and macb.). The details of these two files are
that same as described above for saving the text files that you
are editing.
-
Two temporary files are used when saving your key files (prefixes are
key. and keyb.). The details of these two files are
that same as described above for saving the text files that you
are editing.
-
A temporary file is used when saving your entire file or just a
marked block of your file to a temporary file so that a process of
your choosing can alter it (prefix is parse).
This happens when you use the RunSpellBlockOrFile() and
RunReformatBlockOrFile() primitives.
-
A temporary file is used when using a print filter during printing
(prefix is filter).
-
Two temporary files are used when sorting using the RunSortBlock()
and RunSortClipboard() primitives to sort a block of text and to
sort the contents of the clipboard (prefixes are sortfr and
sortto).
With the exception of your text files, macro files and key files all other
temporary files are located in a directory determined using the
search order given below. Just where these other temporary
files are located is dependent on whether or not
you have certain environment variables set. The search order for
where to locate the temporary files is as follows:
- if the TMPDIR environment variable is set then they are located
in the TMPDIR directory,
- if the HOME environment variable is set then they are located
in the HOME directory,
- if neither of the above are set then they are located in the
directory that the Phedit executable came from.
2.4 QWEdit Concerns
Efforts have been made to maintain backward compatability with QWEdit.
However, the way Phedit is configured by default makes it different
than QWEdit. To make Phedit look and behave more like QWEdit it is
necessary to do some configuration. QWEdit compatability issues are
discussed in the sections that follow.
QWEdit Menus
The default Phedit menus are different than the QWEdit menus. The
embedded menus are the same and can still be accessed using the +e
option.
A menu file is provided that is the same as the QWEdit menus. It is
in /usr/lib/phedit and is called qwedit.mnu. You can
make use of it
by starting up phedit with the option: -u/usr/lib/phedit/qwedit.mnu.
BackTab
The BackTab keyboard shortcut is now simply Shift+Tab. When
reading in a macro file Phedit will accept BackTab as a keyboard
shortcut. Also when filling in the Define Macro dialog Phedit will
accept BackTab as a keyboard shortcut.
When your macros are saved back to the macro file by default Phedit will
store the keyboard shortcut as Shift+Tab. If you want it to
be stored as BackTab then you must have started Phedit with the
-qh option (the QWEdit Hotkeys option).
Plus (+) Sign in Key Combinations
It seems to be a Photon convention that key combinations where two keys
should be held down at the same time should be displayed with a plus (+) sign
between the keys. For example, Ctrl+S. QWEdit would display
this as CtrlS.
Phedit understands Ctrl+S, CtrlS and Ctrl-S. By
default Phedit will save key files and display the Custom window with
a plus (+) sign in key combinations. If you want Phedit to save
and display with no plus sign (ie; the QWEdit way) then start Phedit
with the -qh option (the QWEdit Hotkeys option).
QWEdit Style Statusbar
The statusbar is now at the bottom of Phedit's window whereas in QWEdit
it was beside the menubar. This is because the menus in Phedit are 100%
customizable. There may not be enough room beside the menubar for status
information.
If you want the QWEdit style statusbar beside the menubar then you must
start Phedit with the -b2 option.
The setting you choose with this option is written to the configuration
file. If you are always using the same setting then you need only
do it once to get it into the configuration file.
Automatically Saving Macros and Keys on Exitting
By default Phedit no longer saves your macros and keys when you
exit. To tell Phedit to save them when you exit turn on the
Save macros and keys on exit option in the Options window.
This setting is saved for each time you start up Phedit so you'll only
need to do it once.
In keeping with most editors there is now an option in the
Options menu called Save All Macros and Keys which you can
use whenever you want to save any changes to macros and keys (ie; you've
added or deleted some).
The name of the primitive for saving all macros and keys is called:
Primitive Names in Macros
Phedit's names for primitives have been changed for more clarity and
consistency. Phedit understands both QWEdit names and Phedit names.
However, by default Phedit saves macro and key files using the
Phedit names.
If you want your macro files to be saved with QWEdit names instead then
start Phedit with the -qp option (the QWEdit Primitive names option).
The following is a table of QWEdit versus Phedit primitive names.
QWEdit Name |
Phedit Name |
Status |
About |
AboutDisplay |
|
AutoSave |
AutoSavePrompt |
|
Backspace |
Backspace |
No Change |
Capitalize |
Capitalize |
No Change |
CharLeft |
ScrollCharLeft |
|
CharRight |
ScrollCharRight |
|
CtrlDel |
CopyBlockToClip |
|
CtrlIns |
PasteClipToCursor |
|
CtrlLeft |
WordLeft |
|
CtrlRight |
WordRight |
|
Custom |
CustomDisplay |
|
Del |
DelCharOrCutBlockToClip |
|
DeleteDir |
DeleteDirPrompt |
|
DeleteFile |
DeleteFilePrompt |
|
DeleteLine |
DeleteLine |
No Change |
Down |
Down |
No Change |
End |
EndOfLine |
|
EndMacro |
MacroRecordingEndPrompt |
|
Execute |
RunProgram |
|
Font |
FontPrompt |
|
GoToLine |
GotoLineN |
|
Help |
Help |
No Change |
Home |
BeginningOfLine |
|
Left |
Left |
No Change |
LineDown |
ScrollLineDown |
|
LineUp |
ScrollLineUp |
|
Lower |
Lower |
No Change |
MakeDir |
MakeDirPrompt |
|
MatchBracket |
MatchBracket |
No Change |
New |
NewFile |
|
Open |
OpenFilePrompt |
|
OpenAnother |
OpenAnotherPrompt |
|
PageBottom |
EndOfFile |
|
PageEnd |
ScrollToEndOfLine |
|
PageHome |
ScrollToBegOfLine |
|
PageLeft |
ScrollPageLeft |
|
PageRight |
ScrollPageRight |
|
PageTop |
BeginningOfFile |
|
PasteFile |
PasteFileToCursorPrompt |
|
Pattern |
PatternPrompt |
|
PgDn |
NextPage |
|
PgUp |
PrevPage |
|
PrintFile |
PrintFilePrompt |
|
Quit |
Quit |
No Change |
RecordMacro |
MacroRecordingStart |
|
ReformatDocument |
RunReformatBlockOrFile |
|
Replace |
ReplaceAtCursor |
|
ReplaceAll |
ReplaceNext |
|
ResetOptions |
OptionsPrompt |
|
Return |
Newline |
|
Right |
Right |
No Change |
Save |
SaveCurFile |
|
SaveAs |
SaveCurFileAsPrompt |
|
Search |
SearchNext |
|
SearchReplace |
SearchNextReplace |
|
Sort |
RunSortBlock |
|
SortClipboard |
RunSortClipboard |
|
SpellDocument |
RunSpellBlockOrFile |
|
ToggleInsert |
ToggleInsert |
|
ToggleParagraph |
SetParaBlocking |
|
ToggleRectangle |
SetColumnBlocking |
|
Up |
Up |
No Change |
Upper |
Upper |
No Change |
|
AddKeyBinding |
New
|
|
CharChartDisplay |
New
|
|
FormatBlock |
New
|
|
FormatCurParagraph |
New
|
|
FormatFile |
New
|
|
HTLinkToCurFile |
New
|
|
HTLookUp |
New
|
|
HTRemoveLink |
New
|
|
InsertString |
New
|
|
RepeatPrevious |
New
|
|
RunProgramPrompt |
New
|
|
SaveAllMacrosAndKeys |
New
|
|
Unblock |
New
|
|
WriteBlockToFilePrompt |
New
|