Версия для печати темы
Нажмите сюда для просмотра этой темы в оригинальном формате
Форум программистов > SynUniHighlighter and SynEdit (English Language) > mystix with unihighlighter 2.04 b


Автор: lookfar 1.12.2006, 10:25
Mystix with no JVCL:

http://www.autoitscript.com/fileman/users/lookfar/Mystix_editor_with_no_jvcl_uses_SynMix.zip

I can compile Mystix using SynMix and the UniHighLighter that is included with  Mystix 0.3.1 (highlighters have a *.xml extension and not *.hgl ) 
Then the editor will load a file with nice syntax highlight and codefolding ...
(what did he use to create the xml files?)



Mystix with no JVCL and using UniHighLighter 2.04b

however If I use Mystix with SynMix and the current Unihighlighter 2.04b I will get nice syntax highlight but no
code folding.
http://www.autoitscript.com/fileman/users/lookfar/Mystix_Editor_with_no_jvcl_using_unihighlighter_2.04_and_SynMix.zip

can anyone help ?

sorry I do not speak russian

Автор: Seldon 2.12.2006, 17:13
Цитата
however If I use Mystix with SynMix and the current Unihighlighter 2.04b I will get nice syntax highlight but no
code folding.
In file \Source\SynUniHighlighter.inc change line {.$DEFINE CODEFOLDING} to {$DEFINE CODEFOLDING}  

Цитата
what did he use to create the xml files?
Iterface to edit highlighter is in files \Source\SynUniDesignerForm.(dfm|pas). Also you can just compile \UniManager\HglEditor.dpr which use it files.

Автор: lookfar 3.12.2006, 02:06
Цитата(Seldon @ 2.12.2006,  17:13)
Цитата
however If I use Mystix with SynMix and the current Unihighlighter 2.04b I will get nice syntax highlight but no
code folding.
In file \Source\SynUniHighlighter.inc change line {.$DEFINE CODEFOLDING} to {$DEFINE CODEFOLDING}  

Цитата
what did he use to create the xml files?
Iterface to edit highlighter is in files \Source\SynUniDesignerForm.(dfm|pas). Also you can just compile \UniManager\HglEditor.dpr which use it files.

Yes {.$DEFINE CODEFOLDING} is of course set to {$DEFINE CODEFOLDING}

after compile of the  unimanager demo application , CodeFolding works fine but the simple demo and Light editor  CodeFolding will not work.
as well The Mystix editor I ported over will not fold.



not so important as above but when I try load the xml format files into the unimanager I get a "invalid file format" even if I rename to *.hgl


Автор: Seldon 3.12.2006, 03:30
Цитата(lookfar @  3.12.2006,  02:06 Найти цитируемый пост)
after compile of the  unimanager demo application , CodeFolding works fine but the simple demo and Light editor  CodeFolding will not work.as well The Mystix editor I ported over will not fold.
I didn't work with codefolding so I can't help you with it. 

Цитата(lookfar @  3.12.2006,  02:06 Найти цитируемый пост)
not so important as above but when I try load the xml format files into the unimanager I get a "invalid file format" even if I rename to *.hgl
File extension no matter. I have old version of Mystix (031 at 31.05.06) - it problem that his highlighters hasn't Info field. 
Mystix:
Код

<UniHighlighter>
 <Range Name="Root">
...

Must be:
Код

<UniHighlighter>
 <ImportantInfo>
  ******* Please read carefully *************************
  * Please, make any changes in this file very carefuly!*
  * It is much more convinient to use native designer!  *
  *******************************************************
 </ImportantInfo>
 <Info>
  <General>
   <Name>Assembler x86</Name>
   <FileTypeName>asm</FileTypeName>
   <Layout>Standard</Layout>
  </General>
  <Author>
   <Name>Vitaly Nevzorov</Name>
   <Email>[email protected]</Email>
   <Web>www.delphist.com</Web>
   <Copyright>Copyright (c) Vitaly Nevzorov, 2002</Copyright>
   <Company>N/A</Company>
   <Remark></Remark>
  </Author>
  <Version>
   <Version>1</Version>
   <Revision>0</Revision>
   <Date>37612.5260155903</Date>
   <Type>Beta</Type>
  </Version>
  <History>
  </History>
  <Sample>
   <S>; x86 assembly sample source</S>
   <S>  CODE    SEGMENT    BYTE PUBLIC</S>
   <S>    ASSUME    CS:CODE</S>
   <S>    PUSH SS</S>
   <S>    POP DS</S>
   <S>    MOV AX, AABBh</S>
   <S>    MOV BYTE PTR ES:[DI], 255</S>
   <S>    JMP SHORT AsmEnd</S>
   <S>    welcomeMsg DB 'Hello World', 0</S>
   <S>    AsmEnd:</S>
   <S>    MOV AX, 0</S>
   <S>    CODE    ENDS</S>
   <S>END</S>
   <S></S>
  </Sample>
 </Info>
 <Range Name="Root">
...

SynUniSyn expected integer numbers in \Info\Version\Version and \Info\Version\Revision tags. Other tags in the Info is not important and can be skipped. If you just add following code between <UniHighlighter> and <Range> tags all must be fine smile
Код

<Info>
  <Version>
    <Version>0</Version>
    <Revision>0</Revision>
  </Version>
</Info>

Or you can change TSynUniFormatNativeXml15.ImportInfo method in the SynUniFormatNativeXml15.pas.

Other problem that Mystix's files hasn't tag with highlighter name, so in the HglEditor you will see blank names for it.

Автор: lookfar 3.12.2006, 04:35
Цитата(Seldon @ 3.12.2006,  03:30)
Цитата(lookfar @  3.12.2006,  02:06 Найти цитируемый пост)
after compile of the  unimanager demo application , CodeFolding works fine but the simple demo and Light editor  CodeFolding will not work.as well The Mystix editor I ported over will not fold.
I didn't work with codefolding so I can't help you with it. 

Цитата(lookfar @  3.12.2006,  02:06 Найти цитируемый пост)
not so important as above but when I try load the xml format files into the unimanager I get a "invalid file format" even if I rename to *.hgl
File extension no matter. I have old version of Mystix (031 at 31.05.06) - it problem that his highlighters hasn't Info field. 
Mystix:
Код

<UniHighlighter>
 <Range Name="Root">
...

Must be:
Код

<UniHighlighter>
 <ImportantInfo>
  ******* Please read carefully *************************
  * Please, make any changes in this file very carefuly!*
  * It is much more convinient to use native designer!  *
  *******************************************************
 </ImportantInfo>
 <Info>
  <General>
   <Name>Assembler x86</Name>
   <FileTypeName>asm</FileTypeName>
   <Layout>Standard</Layout>
  </General>
  <Author>
   <Name>Vitaly Nevzorov</Name>
   <Email>[email protected]</Email>
   <Web>www.delphist.com</Web>
   <Copyright>Copyright (c) Vitaly Nevzorov, 2002</Copyright>
   <Company>N/A</Company>
   <Remark></Remark>
  </Author>
  <Version>
   <Version>1</Version>
   <Revision>0</Revision>
   <Date>37612.5260155903</Date>
   <Type>Beta</Type>
  </Version>
  <History>
  </History>
  <Sample>
   <S>; x86 assembly sample source</S>
   <S>  CODE    SEGMENT    BYTE PUBLIC</S>
   <S>    ASSUME    CS:CODE</S>
   <S>    PUSH SS</S>
   <S>    POP DS</S>
   <S>    MOV AX, AABBh</S>
   <S>    MOV BYTE PTR ES:[DI], 255</S>
   <S>    JMP SHORT AsmEnd</S>
   <S>    welcomeMsg DB 'Hello World', 0</S>
   <S>    AsmEnd:</S>
   <S>    MOV AX, 0</S>
   <S>    CODE    ENDS</S>
   <S>END</S>
   <S></S>
  </Sample>
 </Info>
 <Range Name="Root">
...

SynUniSyn expected integer numbers in \Info\Version\Version and \Info\Version\Revision tags. Other tags in the Info is not important and can be skipped. If you just add following code between <UniHighlighter> and <Range> tags all must be fine smile
Код

<Info>
  <Version>
    <Version>0</Version>
    <Revision>0</Revision>
  </Version>
</Info>

Or you can change TSynUniFormatNativeXml15.ImportInfo method in the SynUniFormatNativeXml15.pas.

Other problem that Mystix's files hasn't tag with highlighter name, so in the HglEditor you will see blank names for it.

Thank you for your help, 
The Mystix editor that uses the older unihighlighter in which for me the code folding works is no good to me because end user cannot easily change the syntax coloring or regions by using the UniManager.


But I do not understand this : using unihighlighter 2.0b4, The simple demo works with:

var
  FoldRegion: TFoldRegionItem;
begin
  FoldRegion := SynUni.FoldRegions.Add(rtChar, False, False, False, '{', '}', nil);
  Edit.InitCodeFolding;
  Edit.Repaint;
end;

but will not load the rules from the *.hgl file

Автор: Seldon 3.12.2006, 04:59
Цитата(lookfar @  3.12.2006,  04:35 Найти цитируемый пост)
but will not load the rules from the *.hgl file
from which hgl file? created by UniManager file or Mystix's file?

Автор: lookfar 3.12.2006, 05:48
Цитата(Seldon @ 3.12.2006,  04:59)
Цитата(lookfar @  3.12.2006,  04:35 Найти цитируемый пост)
but will not load the rules from the *.hgl file
from which hgl file? created by UniManager file or Mystix's file?

From the Unimanager file.
I have tried every version on the UniHighlighter web page, I completely remove and re-install between versions in both Delphi 6 and Delphi 7.
No matter what I do I cannot get code folding to work by loading from the *.hgl files.
I just tried the light demo in the form oncreate event:

Код

Edit.CodeFolding.FolderBarColor := clBtnFace;
edit.Gutter.Width := 16;
edit.CodeFolding.FolderBarColor := clScrollBar;
edit.CodeFolding.CollapsedCodeHint:=true;
edit.CodeFolding.CollapsedLineColor:=0;
edit.CodeFolding.HighlighterFoldRegions:=true;
edit.CodeFolding.HighlightIndentGuides:=true;
Edit.CodeFolding.Enabled := True;
edit.InitCodeFolding();


I am using *.hgl file which I have confirmed have fold regions, ie autoit261.hgl:

Код

<CodeFolding>
        <FoldRegion Name="if..endif" Type="1">
            <OpenToken Symbol="IF"/>
            <CloseToken Symbol="ENDIF"/>
            <Properties/>
            <SubRegions/>
        </FoldRegion>
        <FoldRegion Name="while..wend" Type="1">
            <OpenToken Symbol="WHILE"/>
            <CloseToken Symbol="WEND"/>
            <Properties/>
            <SubRegions/>
        </FoldRegion>
        <FoldRegion Name="select..endselect" Type="1">
            <OpenToken Symbol="SELECT"/>
            <CloseToken Symbol="ENDSELECT"/>
            <Properties AllowNoSubs="True"/>
            <SubRegions/>
        </FoldRegion>
    </CodeFolding>
    


I really have no idea of what to try next, I have been trying to make this work for 2 days with no joy


Автор: Seldon 3.12.2006, 16:12
hm, maybe codefolding broken in Unihighlighter 2.04b, I really don't known. CodeFolding actively discussed here http://forum.vingrad.ru/topic-106449.html, try links from it.

Автор: lookfar 4.12.2006, 04:30
Цитата(Seldon @ 3.12.2006,  16:12)
hm, maybe codefolding broken in Unihighlighter 2.04b, I really don't known. CodeFolding actively discussed here http://forum.vingrad.ru/topic-106449.html, try links from it.

I removed 2.0 b4 and installed 2.0 b1 and wala I had folding !
So to be sure I re-installed 2.0b4 and this time it worked ... 
however the demos would not work until I placed the next code in the Form OnCreate event:

Код

 {$IFDEF CODEFOLDING}
  Edit.Gutter.Width := 16;
  Edit.CodeFolding.Enabled := True;
  Edit.CodeFolding.CollapsedCodeHint := True;
  Edit.CodeFolding.CollapsingMarkStyle := msSquare;
  Edit.CodeFolding.FolderBarColor := clScrollBar;
  Edit.CodeFolding.FolderBarLinesColor := clBlack;
  Edit.InitCodeFolding();
  {$ENDIF}


If I remove the defines:

Код

  Edit.Gutter.Width := 16;
  Edit.CodeFolding.Enabled := True;
  Edit.CodeFolding.CollapsedCodeHint := True;
  Edit.CodeFolding.CollapsingMarkStyle := msSquare;
  Edit.CodeFolding.FolderBarColor := clScrollBar;
  Edit.CodeFolding.FolderBarLinesColor := clBlack;
  Edit.InitCodeFolding();


Then folding does not work. But I am Happy that it is working!

I will use it in my AutoIt Editor:
http://www.autoitscript.com/fileman/users/lookfar/

and later in Koda (the form Designer)

If anyone likes the AutoEd editor (see screenshots) which has parameter completion, autoProposal completion and code completion all with the dropdown in color .
ask and I will post source code for it.







Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)