diff --git a/components/rx/trunk/dcl_rxtools.lpk b/components/rx/trunk/dcl_rxtools.lpk
index e65d4e046..a38c73836 100644
--- a/components/rx/trunk/dcl_rxtools.lpk
+++ b/components/rx/trunk/dcl_rxtools.lpk
@@ -29,19 +29,22 @@
-
+
-
+
-
+
-
+
-
+
+
+
+
@@ -50,5 +53,8 @@
+
+ <_ExternHelp Items="Count"/>
+
diff --git a/components/rx/trunk/dcl_rxtools/rxtextholder_editor.lfm b/components/rx/trunk/dcl_rxtools/rxtextholder_editor.lfm
index 349b2a60d..e6ebff84f 100644
--- a/components/rx/trunk/dcl_rxtools/rxtextholder_editor.lfm
+++ b/components/rx/trunk/dcl_rxtools/rxtextholder_editor.lfm
@@ -1,20 +1,22 @@
object RxTextHolder_EditorForm: TRxTextHolder_EditorForm
- Left = 366
- Height = 592
- Top = 183
- Width = 806
+ Left = 466
+ Height = 618
+ Top = 209
+ Width = 742
Caption = 'RxTextHolder'
- ClientHeight = 592
- ClientWidth = 806
+ ClientHeight = 618
+ ClientWidth = 742
+ Constraints.MinHeight = 400
+ Constraints.MinWidth = 500
OnCloseQuery = FormCloseQuery
OnCreate = FormCreate
Position = poScreenCenter
LCLVersion = '2.1.0.0'
object ButtonPanel1: TButtonPanel
Left = 6
- Height = 46
- Top = 540
- Width = 794
+ Height = 42
+ Top = 570
+ Width = 730
OKButton.Name = 'OKButton'
OKButton.DefaultCaption = True
HelpButton.Name = 'HelpButton'
@@ -28,12 +30,13 @@ object RxTextHolder_EditorForm: TRxTextHolder_EditorForm
end
object Panel1: TPanel
Left = 0
- Height = 534
+ Height = 564
Top = 0
- Width = 170
+ Width = 267
Align = alLeft
- ClientHeight = 534
- ClientWidth = 170
+ ClientHeight = 564
+ ClientWidth = 267
+ Constraints.MinWidth = 215
TabOrder = 1
object ListBox1: TListBox
AnchorSideLeft.Control = Panel1
@@ -42,118 +45,676 @@ object RxTextHolder_EditorForm: TRxTextHolder_EditorForm
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = BitBtn1
Left = 1
- Height = 496
+ Height = 531
Top = 1
- Width = 168
+ Width = 265
Anchors = [akTop, akLeft, akRight, akBottom]
ItemHeight = 0
OnClick = ListBox1Click
OnSelectionChange = ListBox1SelectionChange
PopupMenu = PopupMenu1
- ScrollWidth = 166
+ ScrollWidth = 263
TabOrder = 0
TopIndex = -1
end
object BitBtn1: TBitBtn
AnchorSideLeft.Control = Panel1
- AnchorSideRight.Control = CLabel1
AnchorSideBottom.Control = Panel1
AnchorSideBottom.Side = asrBottom
Left = 1
- Height = 36
- Top = 497
- Width = 84
+ Height = 31
+ Top = 532
+ Width = 38
Action = itemAdd
- Anchors = [akLeft, akRight, akBottom]
+ Anchors = [akLeft, akBottom]
AutoSize = True
TabOrder = 1
end
object BitBtn2: TBitBtn
- AnchorSideLeft.Control = CLabel1
+ AnchorSideLeft.Control = BitBtn1
+ AnchorSideLeft.Side = asrBottom
AnchorSideRight.Control = Panel1
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = Panel1
AnchorSideBottom.Side = asrBottom
- Left = 85
- Height = 36
- Top = 497
- Width = 84
+ Left = 39
+ Height = 31
+ Top = 532
+ Width = 65
Action = itemRemove
- Anchors = [akLeft, akRight, akBottom]
+ Anchors = [akLeft, akBottom]
AutoSize = True
TabOrder = 2
end
- object CLabel1: TLabel
- AnchorSideLeft.Control = Panel1
- AnchorSideLeft.Side = asrCenter
- AnchorSideTop.Control = Panel1
- Left = 85
- Height = 1
- Top = 1
- Width = 1
- ParentColor = False
+ object BitBtn3: TBitBtn
+ AnchorSideLeft.Control = BitBtn2
+ AnchorSideLeft.Side = asrBottom
+ AnchorSideRight.Side = asrBottom
+ AnchorSideBottom.Control = Panel1
+ AnchorSideBottom.Side = asrBottom
+ Left = 116
+ Height = 31
+ Top = 532
+ Width = 30
+ Action = itemUp
+ Anchors = [akLeft, akBottom]
+ AutoSize = True
+ BorderSpacing.Left = 12
+ TabOrder = 3
+ end
+ object BitBtn4: TBitBtn
+ AnchorSideLeft.Control = BitBtn3
+ AnchorSideLeft.Side = asrBottom
+ AnchorSideRight.Side = asrBottom
+ AnchorSideBottom.Control = Panel1
+ AnchorSideBottom.Side = asrBottom
+ Left = 146
+ Height = 31
+ Top = 532
+ Width = 51
+ Action = itemDown
+ Anchors = [akLeft, akBottom]
+ AutoSize = True
+ TabOrder = 4
end
end
object Splitter1: TSplitter
- Left = 170
- Height = 534
+ Left = 267
+ Height = 564
Top = 0
Width = 5
end
object Panel2: TPanel
- Left = 175
- Height = 534
+ Left = 272
+ Height = 564
Top = 0
- Width = 631
+ Width = 470
Align = alClient
- ClientHeight = 534
- ClientWidth = 631
+ ClientHeight = 564
+ ClientWidth = 470
TabOrder = 3
- object Edit1: TEdit
- AnchorSideLeft.Control = Label1
- AnchorSideLeft.Side = asrBottom
- AnchorSideTop.Control = Panel2
- AnchorSideRight.Control = Panel2
- AnchorSideRight.Side = asrBottom
- Left = 55
- Height = 37
- Top = 1
- Width = 575
- Anchors = [akTop, akLeft, akRight]
- OnExit = Edit1Exit
+ object Panel3: TPanel
+ Left = 1
+ Height = 43
+ Top = 520
+ Width = 468
+ Align = alBottom
+ AutoSize = True
+ BevelOuter = bvNone
+ ClientHeight = 43
+ ClientWidth = 468
TabOrder = 0
+ object Label2: TLabel
+ AnchorSideLeft.Control = Panel3
+ AnchorSideBottom.Control = ComboBox1
+ AnchorSideBottom.Side = asrBottom
+ Left = 6
+ Height = 19
+ Top = 18
+ Width = 74
+ Anchors = [akLeft, akBottom]
+ BorderSpacing.Left = 6
+ Caption = 'Highlighter'
+ ParentColor = False
+ end
+ object ComboBox1: TComboBox
+ AnchorSideLeft.Control = Label2
+ AnchorSideLeft.Side = asrBottom
+ AnchorSideTop.Control = Panel3
+ AnchorSideRight.Control = Panel3
+ AnchorSideRight.Side = asrBottom
+ Left = 86
+ Height = 31
+ Top = 6
+ Width = 376
+ Anchors = [akTop, akLeft, akRight]
+ BorderSpacing.Around = 6
+ ItemHeight = 0
+ OnChange = ComboBox1Change
+ Style = csDropDownList
+ TabOrder = 0
+ end
end
- object Label1: TLabel
- AnchorSideLeft.Control = Panel2
- AnchorSideBottom.Control = Edit1
- AnchorSideBottom.Side = asrBottom
+ inline SynEdit1: TSynEdit
Left = 1
- Height = 20
- Top = 18
- Width = 48
- Anchors = [akLeft, akBottom]
- BorderSpacing.Right = 6
- Caption = 'Caption'
+ Height = 476
+ Top = 44
+ Width = 468
+ Align = alClient
+ Anchors = [akTop, akLeft, akRight]
+ Font.Height = -13
+ Font.Name = 'Courier New'
+ Font.Pitch = fpFixed
+ Font.Quality = fqNonAntialiased
ParentColor = False
- end
- object Memo1: TMemo
- AnchorSideLeft.Control = Panel2
- AnchorSideTop.Control = Edit1
- AnchorSideTop.Side = asrBottom
- AnchorSideRight.Control = Panel2
- AnchorSideRight.Side = asrBottom
- AnchorSideBottom.Control = Panel2
- AnchorSideBottom.Side = asrBottom
- Left = 1
- Height = 495
- Top = 38
- Width = 629
- Anchors = [akTop, akLeft, akRight, akBottom]
- Lines.Strings = (
- 'Memo1'
- )
- OnExit = Memo1Exit
+ ParentFont = False
TabOrder = 1
+ OnExit = SynEdit1Exit
+ Gutter.Width = 57
+ Gutter.MouseActions = <>
+ RightGutter.Width = 0
+ RightGutter.MouseActions = <>
+ Keystrokes = <
+ item
+ Command = ecUp
+ ShortCut = 38
+ end
+ item
+ Command = ecSelUp
+ ShortCut = 8230
+ end
+ item
+ Command = ecScrollUp
+ ShortCut = 16422
+ end
+ item
+ Command = ecDown
+ ShortCut = 40
+ end
+ item
+ Command = ecSelDown
+ ShortCut = 8232
+ end
+ item
+ Command = ecScrollDown
+ ShortCut = 16424
+ end
+ item
+ Command = ecLeft
+ ShortCut = 37
+ end
+ item
+ Command = ecSelLeft
+ ShortCut = 8229
+ end
+ item
+ Command = ecWordLeft
+ ShortCut = 16421
+ end
+ item
+ Command = ecSelWordLeft
+ ShortCut = 24613
+ end
+ item
+ Command = ecRight
+ ShortCut = 39
+ end
+ item
+ Command = ecSelRight
+ ShortCut = 8231
+ end
+ item
+ Command = ecWordRight
+ ShortCut = 16423
+ end
+ item
+ Command = ecSelWordRight
+ ShortCut = 24615
+ end
+ item
+ Command = ecPageDown
+ ShortCut = 34
+ end
+ item
+ Command = ecSelPageDown
+ ShortCut = 8226
+ end
+ item
+ Command = ecPageBottom
+ ShortCut = 16418
+ end
+ item
+ Command = ecSelPageBottom
+ ShortCut = 24610
+ end
+ item
+ Command = ecPageUp
+ ShortCut = 33
+ end
+ item
+ Command = ecSelPageUp
+ ShortCut = 8225
+ end
+ item
+ Command = ecPageTop
+ ShortCut = 16417
+ end
+ item
+ Command = ecSelPageTop
+ ShortCut = 24609
+ end
+ item
+ Command = ecLineStart
+ ShortCut = 36
+ end
+ item
+ Command = ecSelLineStart
+ ShortCut = 8228
+ end
+ item
+ Command = ecEditorTop
+ ShortCut = 16420
+ end
+ item
+ Command = ecSelEditorTop
+ ShortCut = 24612
+ end
+ item
+ Command = ecLineEnd
+ ShortCut = 35
+ end
+ item
+ Command = ecSelLineEnd
+ ShortCut = 8227
+ end
+ item
+ Command = ecEditorBottom
+ ShortCut = 16419
+ end
+ item
+ Command = ecSelEditorBottom
+ ShortCut = 24611
+ end
+ item
+ Command = ecToggleMode
+ ShortCut = 45
+ end
+ item
+ Command = ecCopy
+ ShortCut = 16429
+ end
+ item
+ Command = ecPaste
+ ShortCut = 8237
+ end
+ item
+ Command = ecDeleteChar
+ ShortCut = 46
+ end
+ item
+ Command = ecCut
+ ShortCut = 8238
+ end
+ item
+ Command = ecDeleteLastChar
+ ShortCut = 8
+ end
+ item
+ Command = ecDeleteLastChar
+ ShortCut = 8200
+ end
+ item
+ Command = ecDeleteLastWord
+ ShortCut = 16392
+ end
+ item
+ Command = ecUndo
+ ShortCut = 32776
+ end
+ item
+ Command = ecRedo
+ ShortCut = 40968
+ end
+ item
+ Command = ecLineBreak
+ ShortCut = 13
+ end
+ item
+ Command = ecSelectAll
+ ShortCut = 16449
+ end
+ item
+ Command = ecCopy
+ ShortCut = 16451
+ end
+ item
+ Command = ecBlockIndent
+ ShortCut = 24649
+ end
+ item
+ Command = ecLineBreak
+ ShortCut = 16461
+ end
+ item
+ Command = ecInsertLine
+ ShortCut = 16462
+ end
+ item
+ Command = ecDeleteWord
+ ShortCut = 16468
+ end
+ item
+ Command = ecBlockUnindent
+ ShortCut = 24661
+ end
+ item
+ Command = ecPaste
+ ShortCut = 16470
+ end
+ item
+ Command = ecCut
+ ShortCut = 16472
+ end
+ item
+ Command = ecDeleteLine
+ ShortCut = 16473
+ end
+ item
+ Command = ecDeleteEOL
+ ShortCut = 24665
+ end
+ item
+ Command = ecUndo
+ ShortCut = 16474
+ end
+ item
+ Command = ecRedo
+ ShortCut = 24666
+ end
+ item
+ Command = ecGotoMarker0
+ ShortCut = 16432
+ end
+ item
+ Command = ecGotoMarker1
+ ShortCut = 16433
+ end
+ item
+ Command = ecGotoMarker2
+ ShortCut = 16434
+ end
+ item
+ Command = ecGotoMarker3
+ ShortCut = 16435
+ end
+ item
+ Command = ecGotoMarker4
+ ShortCut = 16436
+ end
+ item
+ Command = ecGotoMarker5
+ ShortCut = 16437
+ end
+ item
+ Command = ecGotoMarker6
+ ShortCut = 16438
+ end
+ item
+ Command = ecGotoMarker7
+ ShortCut = 16439
+ end
+ item
+ Command = ecGotoMarker8
+ ShortCut = 16440
+ end
+ item
+ Command = ecGotoMarker9
+ ShortCut = 16441
+ end
+ item
+ Command = ecSetMarker0
+ ShortCut = 24624
+ end
+ item
+ Command = ecSetMarker1
+ ShortCut = 24625
+ end
+ item
+ Command = ecSetMarker2
+ ShortCut = 24626
+ end
+ item
+ Command = ecSetMarker3
+ ShortCut = 24627
+ end
+ item
+ Command = ecSetMarker4
+ ShortCut = 24628
+ end
+ item
+ Command = ecSetMarker5
+ ShortCut = 24629
+ end
+ item
+ Command = ecSetMarker6
+ ShortCut = 24630
+ end
+ item
+ Command = ecSetMarker7
+ ShortCut = 24631
+ end
+ item
+ Command = ecSetMarker8
+ ShortCut = 24632
+ end
+ item
+ Command = ecSetMarker9
+ ShortCut = 24633
+ end
+ item
+ Command = EcFoldLevel1
+ ShortCut = 41009
+ end
+ item
+ Command = EcFoldLevel2
+ ShortCut = 41010
+ end
+ item
+ Command = EcFoldLevel3
+ ShortCut = 41011
+ end
+ item
+ Command = EcFoldLevel4
+ ShortCut = 41012
+ end
+ item
+ Command = EcFoldLevel5
+ ShortCut = 41013
+ end
+ item
+ Command = EcFoldLevel6
+ ShortCut = 41014
+ end
+ item
+ Command = EcFoldLevel7
+ ShortCut = 41015
+ end
+ item
+ Command = EcFoldLevel8
+ ShortCut = 41016
+ end
+ item
+ Command = EcFoldLevel9
+ ShortCut = 41017
+ end
+ item
+ Command = EcFoldLevel0
+ ShortCut = 41008
+ end
+ item
+ Command = EcFoldCurrent
+ ShortCut = 41005
+ end
+ item
+ Command = EcUnFoldCurrent
+ ShortCut = 41003
+ end
+ item
+ Command = EcToggleMarkupWord
+ ShortCut = 32845
+ end
+ item
+ Command = ecNormalSelect
+ ShortCut = 24654
+ end
+ item
+ Command = ecColumnSelect
+ ShortCut = 24643
+ end
+ item
+ Command = ecLineSelect
+ ShortCut = 24652
+ end
+ item
+ Command = ecTab
+ ShortCut = 9
+ end
+ item
+ Command = ecShiftTab
+ ShortCut = 8201
+ end
+ item
+ Command = ecMatchBracket
+ ShortCut = 24642
+ end
+ item
+ Command = ecColSelUp
+ ShortCut = 40998
+ end
+ item
+ Command = ecColSelDown
+ ShortCut = 41000
+ end
+ item
+ Command = ecColSelLeft
+ ShortCut = 40997
+ end
+ item
+ Command = ecColSelRight
+ ShortCut = 40999
+ end
+ item
+ Command = ecColSelPageDown
+ ShortCut = 40994
+ end
+ item
+ Command = ecColSelPageBottom
+ ShortCut = 57378
+ end
+ item
+ Command = ecColSelPageUp
+ ShortCut = 40993
+ end
+ item
+ Command = ecColSelPageTop
+ ShortCut = 57377
+ end
+ item
+ Command = ecColSelLineStart
+ ShortCut = 40996
+ end
+ item
+ Command = ecColSelLineEnd
+ ShortCut = 40995
+ end
+ item
+ Command = ecColSelEditorTop
+ ShortCut = 57380
+ end
+ item
+ Command = ecColSelEditorBottom
+ ShortCut = 57379
+ end>
+ MouseActions = <>
+ MouseTextActions = <>
+ MouseSelActions = <>
+ Lines.Strings = (
+ 'SynEdit1'
+ )
+ VisibleSpecialChars = [vscSpace, vscTabAtLast]
+ SelectedColor.BackPriority = 50
+ SelectedColor.ForePriority = 50
+ SelectedColor.FramePriority = 50
+ SelectedColor.BoldPriority = 50
+ SelectedColor.ItalicPriority = 50
+ SelectedColor.UnderlinePriority = 50
+ SelectedColor.StrikeOutPriority = 50
+ BracketHighlightStyle = sbhsBoth
+ BracketMatchColor.Background = clNone
+ BracketMatchColor.Foreground = clNone
+ BracketMatchColor.Style = [fsBold]
+ FoldedCodeColor.Background = clNone
+ FoldedCodeColor.Foreground = clGray
+ FoldedCodeColor.FrameColor = clGray
+ MouseLinkColor.Background = clNone
+ MouseLinkColor.Foreground = clBlue
+ LineHighlightColor.Background = clNone
+ LineHighlightColor.Foreground = clNone
+ inline SynLeftGutterPartList1: TSynGutterPartList
+ object SynGutterMarks1: TSynGutterMarks
+ Width = 24
+ MouseActions = <>
+ end
+ object SynGutterLineNumber1: TSynGutterLineNumber
+ Width = 17
+ MouseActions = <>
+ MarkupInfo.Background = clBtnFace
+ MarkupInfo.Foreground = clNone
+ DigitCount = 2
+ ShowOnlyLineNumbersMultiplesOf = 1
+ ZeroStart = False
+ LeadingZeros = False
+ end
+ object SynGutterChanges1: TSynGutterChanges
+ Width = 4
+ MouseActions = <>
+ ModifiedColor = 59900
+ SavedColor = clGreen
+ end
+ object SynGutterSeparator1: TSynGutterSeparator
+ Width = 2
+ MouseActions = <>
+ MarkupInfo.Background = clWhite
+ MarkupInfo.Foreground = clGray
+ end
+ object SynGutterCodeFolding1: TSynGutterCodeFolding
+ MouseActions = <>
+ MarkupInfo.Background = clNone
+ MarkupInfo.Foreground = clGray
+ MouseActionsExpanded = <>
+ MouseActionsCollapsed = <>
+ end
+ end
+ end
+ object Panel4: TPanel
+ Left = 1
+ Height = 43
+ Top = 1
+ Width = 468
+ Align = alTop
+ AutoSize = True
+ BevelOuter = bvNone
+ ClientHeight = 43
+ ClientWidth = 468
+ TabOrder = 2
+ object Edit1: TEdit
+ AnchorSideLeft.Control = Label1
+ AnchorSideLeft.Side = asrBottom
+ AnchorSideTop.Control = Panel4
+ AnchorSideRight.Control = Panel4
+ AnchorSideRight.Side = asrBottom
+ Left = 63
+ Height = 31
+ Top = 6
+ Width = 399
+ Anchors = [akTop, akLeft, akRight]
+ BorderSpacing.Around = 6
+ OnExit = Edit1Exit
+ TabOrder = 0
+ end
+ object Label1: TLabel
+ AnchorSideLeft.Control = Panel4
+ AnchorSideBottom.Control = Edit1
+ AnchorSideBottom.Side = asrBottom
+ Left = 6
+ Height = 19
+ Top = 18
+ Width = 51
+ Anchors = [akLeft, akBottom]
+ BorderSpacing.Left = 6
+ Caption = 'Caption'
+ ParentColor = False
+ end
end
end
object PopupMenu1: TPopupMenu
@@ -165,6 +726,15 @@ object RxTextHolder_EditorForm: TRxTextHolder_EditorForm
object MenuItem2: TMenuItem
Action = itemRemove
end
+ object MenuItem4: TMenuItem
+ Caption = '-'
+ end
+ object MenuItem3: TMenuItem
+ Action = itemUp
+ end
+ object MenuItem5: TMenuItem
+ Action = itemDown
+ end
end
object ActionList1: TActionList
Left = 200
@@ -177,5 +747,13 @@ object RxTextHolder_EditorForm: TRxTextHolder_EditorForm
Caption = 'Remove'
OnExecute = itemRemoveExecute
end
+ object itemUp: TAction
+ Caption = 'Up'
+ OnExecute = itemUpExecute
+ end
+ object itemDown: TAction
+ Caption = 'Down'
+ OnExecute = itemDownExecute
+ end
end
end
diff --git a/components/rx/trunk/dcl_rxtools/rxtextholder_editor.pas b/components/rx/trunk/dcl_rxtools/rxtextholder_editor.pas
index a08b4dd2d..d7da9d2dc 100644
--- a/components/rx/trunk/dcl_rxtools/rxtextholder_editor.pas
+++ b/components/rx/trunk/dcl_rxtools/rxtextholder_editor.pas
@@ -36,13 +36,18 @@ interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ButtonPanel, ExtCtrls,
- StdCtrls, Menus, Buttons, ActnList, RxTextHolder;
+ StdCtrls, Menus, Buttons, ActnList, SynEdit, RxTextHolder, SynEditHighlighter;
type
{ TRxTextHolder_EditorForm }
TRxTextHolder_EditorForm = class(TForm)
+ itemUp: TAction;
+ itemDown: TAction;
+ BitBtn3: TBitBtn;
+ BitBtn4: TBitBtn;
+ ComboBox1: TComboBox;
Edit1: TEdit;
itemRemove: TAction;
itemAdd: TAction;
@@ -50,28 +55,38 @@ type
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
ButtonPanel1: TButtonPanel;
- CLabel1: TLabel;
Label1: TLabel;
+ Label2: TLabel;
ListBox1: TListBox;
- Memo1: TMemo;
+ MenuItem3: TMenuItem;
+ MenuItem4: TMenuItem;
+ MenuItem5: TMenuItem;
+ Panel4: TPanel;
+ SynEdit1: TSynEdit;
MenuItem1: TMenuItem;
MenuItem2: TMenuItem;
Panel1: TPanel;
Panel2: TPanel;
+ Panel3: TPanel;
PopupMenu1: TPopupMenu;
Splitter1: TSplitter;
+ procedure ComboBox1Change(Sender: TObject);
procedure Edit1Exit(Sender: TObject);
procedure FormCloseQuery(Sender: TObject; var CanClose: boolean);
procedure FormCreate(Sender: TObject);
procedure itemAddExecute(Sender: TObject);
+ procedure itemDownExecute(Sender: TObject);
procedure itemRemoveExecute(Sender: TObject);
+ procedure itemUpExecute(Sender: TObject);
procedure ListBox1Click(Sender: TObject);
procedure ListBox1SelectionChange(Sender: TObject; User: boolean);
- procedure Memo1Exit(Sender: TObject);
+ procedure SynEdit1Exit(Sender: TObject);
private
FTextHolder:TRxTextHolder;
FCurrentItem: TRxTextHolderItem;
+ FHighlighter: TSynCustomHighlighter;
procedure UpdateTextNames;
+ procedure UpdateHighlighter;
procedure Localize;
procedure UpdateCtrlState;
function MakeItemName(ABaseName:string):string;
@@ -79,10 +94,12 @@ type
end;
-
function ShowRxTextHolderEditorForm(ATextHolder:TRxTextHolder):boolean;
+
implementation
-uses rxconst;
+
+uses
+ rxconst, SynHighlighterSQL, SynHighlighterHTML, SynHighlighterXML;
function ShowRxTextHolderEditorForm(ATextHolder:TRxTextHolder):boolean;
var
@@ -91,6 +108,7 @@ begin
RxTextHolder_EditorForm:=TRxTextHolder_EditorForm.Create(Application);
RxTextHolder_EditorForm.FTextHolder.Assign(ATextHolder);
RxTextHolder_EditorForm.UpdateTextNames;
+ RxTextHolder_EditorForm.UpdateHighlighter;
Result:=RxTextHolder_EditorForm.ShowModal = mrOk;
if Result then
begin
@@ -106,6 +124,7 @@ end;
procedure TRxTextHolder_EditorForm.FormCreate(Sender: TObject);
begin
FTextHolder:=TRxTextHolder.Create(Self);
+ FHighlighter:=nil;
Localize;
end;
@@ -123,6 +142,42 @@ begin
ListBox1Click(nil);
end;
+procedure TRxTextHolder_EditorForm.itemUpExecute(Sender: TObject);
+var
+ I: Integer;
+begin
+ if Assigned(FCurrentItem) then
+ begin
+ I:=ListBox1.ItemIndex;
+ if (I>0) then
+ begin
+ FTextHolder.Items.Exchange(I, I-1);
+ ListBox1.Items.Exchange(I, I-1);
+ ListBox1.ItemIndex := I-1;
+
+ UpdateCtrlState;
+ end;
+ end;
+end;
+
+procedure TRxTextHolder_EditorForm.itemDownExecute(Sender: TObject);
+var
+ I: Integer;
+begin
+ if Assigned(FCurrentItem) then
+ begin
+ I:=ListBox1.ItemIndex;
+ if (I>=0) And (IOrd(FTextHolder.Highlighter) Then
+ begin
+ FTextHolder.Highlighter:=TRxTextHolderHighlighter(ComboBox1.ItemIndex);
+ UpdateHighlighter;
+ end;
+end;
+
procedure TRxTextHolder_EditorForm.FormCloseQuery(Sender: TObject;
var CanClose: boolean);
begin
if ModalResult = mrOk then
begin
Edit1Exit(nil);
- Memo1Exit(nil);
+ SynEdit1Exit(nil);
end;
end;
@@ -164,19 +228,14 @@ begin
begin
FCurrentItem:=FTextHolder.Items[ListBox1.ItemIndex];
Edit1.Text:=FCurrentItem.Caption;
- Memo1.Text:=FCurrentItem.Lines.Text;
+ SynEdit1.Text:=FCurrentItem.Lines.Text;
if Visible then
- begin
- Memo1.Enabled:=true;
- Memo1.SetFocus
- end
- else
- ActiveControl:=Memo1;
+ SynEdit1.Enabled:=true;
end
else
begin
FCurrentItem:=Nil;
- Memo1.Lines.Clear;
+ SynEdit1.Lines.Clear;
end;
UpdateCtrlState;
end;
@@ -187,10 +246,10 @@ begin
//
end;
-procedure TRxTextHolder_EditorForm.Memo1Exit(Sender: TObject);
+procedure TRxTextHolder_EditorForm.SynEdit1Exit(Sender: TObject);
begin
if Assigned(FCurrentItem) then
- FCurrentItem.Lines.Assign(Memo1.Lines);
+ FCurrentItem.Lines.Assign(SynEdit1.Lines);
end;
procedure TRxTextHolder_EditorForm.UpdateTextNames;
@@ -207,19 +266,53 @@ begin
ListBox1Click(nil);
end;
+procedure TRxTextHolder_EditorForm.UpdateHighlighter;
+begin
+ if assigned(FHighlighter) then
+ begin
+ SynEdit1.Highlighter:=nil;
+ FreeAndNil(FHighlighter);
+ end;
+
+ case FTextHolder.Highlighter of
+ rxSynXML: FHighlighter := TSynXMLSyn.Create(Self);
+ rxSynHTML: FHighlighter := TSynHTMLSyn.Create(Self);
+ rxSynSQL: FHighlighter := TSynSQLSyn.Create(Self);
+ end;
+
+ if Assigned(FHighlighter) then
+ SynEdit1.Highlighter := FHighlighter;
+
+ if ComboBox1.ItemIndex<>Ord(FTextHolder.Highlighter) Then
+ ComboBox1.ItemIndex := Ord(FTextHolder.Highlighter);
+end;
+
procedure TRxTextHolder_EditorForm.Localize;
begin
Caption:=sRxTextHolderEditor;
Label1.Caption:=sRxTextHolderTextCaption;
+ Label2.Caption:=sRxTextFolderSynHighlighter;
itemAdd.Caption:=sRxTextHolderAdd;
itemRemove.Caption:=sRxTextHolderRemove;
+ itemUp.Caption:=sRxTextHolderMoveUp;
+ itemDown.Caption:=sRxTextHolderMoveDown;
+
+ // contents must be added in order of declaration in TRxTextHolderHighlighter
+ ComboBox1.Items.Clear;
+ ComboBox1.Items.Add(sRxTextFolderSynNone);
+ ComboBox1.Items.Add(sRxTextFolderSynXML);
+ ComboBox1.Items.Add(sRxTextFolderSynHTML);
+ ComboBox1.Items.Add(sRxTextFolderSynSQL);
end;
procedure TRxTextHolder_EditorForm.UpdateCtrlState;
begin
itemRemove.Enabled:=(FTextHolder.Items.Count>0) and Assigned(FCurrentItem);
+ itemUp.Enabled:=itemRemove.Enabled and (ListBox1.ItemIndex>0);
+ itemDown.Enabled:=itemRemove.Enabled and (ListBox1.ItemIndex'
+ ''
+ 'Demo page'
+ ''
+ ''
+ 'Hello world!'
+ ''
+ '