[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [StrongED] Re: Rescan
In message <574130ca42Lists@xxxxxxxxxxx>
"Richard Torrens (lists)" <Lists@xxxxxxxxxxx> wrote:
> In article <1a809d3d57.fjgraute@xxxxxxxxx>,
> Fred Graute <fjgraute@xxxxxxxxx> wrote:
> > After a lot of experimentation I have managed to do what you want but in
> > quite a roundabout way. *** Important for this to work the view with the
> > input focus must in the mode that needs to be reparsed. ***
>
> > The Obey file that renames the two ModeFiles should end with:
>
> > Message StrongED_ExecCmds SetTmp() LoadOne("<StrongED$Tmp_ModePath>.ModeFile")
> > Filer_Run <pathname>
>
> > Where <pathname> points to a second Obey file that contains the line
>
> > Message StrongED_ExecCmds SaveKill()
>
>
> > What this does is that after renaming the two ModeFiles the one now
> > called 'ModeFile' gets loaded. The second Obey file will save it forcing
> > a reparse and then kills the text with the ModeFile.
>
> > We can't save it from the first Obey file as that would save the text
> > with the input focus not the freshly loaded ModeFile. This because SE
> > hasn't yet received the GainCaret event from the Wimp, the Filer_Run
> > allows for this to happen.
>
> Finally got around to trying this. It works - once!
>
> It swaps from the version in use to the other version - but not back again.
For me, it worked every time but I've realised that there is a flaw in
my concept; it assumes that the StrongED$Tmp_ keep pointing at the same
mode. Easily done during experimentation but not really practical during
actual use. So, I took a bit of time to come up with a better way.
Below is a description of what I ended up with. To keep things separate
I used a new mode (TestReparse) but the idea can be applied to any mode.
First make sure that the ModeFiles that need to be swapped are in
StrED_cfg.UserPrefs.Modes.<mode> and that the alternative ModeFile
is named ModeFileA. In there also create a directory called: 'Tools'.
Create an Obey file named SwapMF1 and save it in the Tools directory
(NB the LoadOne function should be on the same line as Message).
|*** Start of SwapMF1
Set SwapMF$Dir <StrongED$Tmp_WriteDir>Modes.<StrongED$Tmp_ModeName>
Rename <SwapMF$Dir>.ModeFile <SwapMF$Dir>.ModeFileB
Rename <SwapMF$Dir>.ModeFileA <SwapMF$Dir>.ModeFile
Rename <SwapMF$Dir>.ModeFileB <SwapMF$Dir>.ModeFileA
Message StrongED_ExecCmds SetTmp()
LoadOne("<StrongED$Tmp_ModePath>.ModeFile")
Filer_Run <StrongED$Tmp_ModePath>.Tools.SwapMF2
Unset SwapMF$Dir
|*** End of SwapMF1
Create a second Obey file, SwapMF2, also in Tools that contains this:
|*** Start of SwapMF2
Message StrongED_ExecCmds SaveKill()
|*** End of SwapMF2
Add a toolbar icon that runs the SwapMF1 to both ModeFiles:
Functions
Icon sm!edit
Select SetTmp() Run("Filer_Run <StrongED$Tmp_ModePath>.Tools.SwapMF1")
End
Clicking on the new toolbar icon should swap the ModeFiles and reparse
the one now called ModeFile.
To test if it worked I added a simple keyList to ModeFile:
KeyList
c-Q InsertStr("ModeFile")
End
The same for ModeFileA except that it inserts "ModeFileA".
After each click on the icon the inserted string changed, from
'ModeFile' to 'ModeFileA' then back to 'ModeFile' etc.
This is a much better way than my original scheme, sets StrongED$Tmp_
variables correctly and no need for another task to launch SwapMF1.
Please give it a try and let me know if it works.
Cheers,
Fred.
--
StrongED Developer
http://www.stronged.iconbar.com/
--
To unsubscribe send a mail to StrongED+unsubscribe@xxxxxxxxxxx
List archives and instructions at
http://stronged.torrens.org/index.html