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!' + '' + '' + ) + end + item + Caption = 'XML' + Lines.Strings = ( + '' + '' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + '' + '' + '' + ) end> Left = 16 Top = 16 diff --git a/components/rx/trunk/demos/RxTextHolder/unit1.pas b/components/rx/trunk/demos/RxTextHolder/unit1.pas index 6f1e9ce5b..ee4f92085 100644 --- a/components/rx/trunk/demos/RxTextHolder/unit1.pas +++ b/components/rx/trunk/demos/RxTextHolder/unit1.pas @@ -17,12 +17,18 @@ type Button2: TButton; Button3: TButton; Button4: TButton; + Button5: TButton; + Button6: TButton; + Button7: TButton; Memo1: TMemo; RxTextHolder1: TRxTextHolder; procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); procedure Button3Click(Sender: TObject); procedure Button4Click(Sender: TObject); + procedure Button5Click(Sender: TObject); + procedure Button6Click(Sender: TObject); + procedure Button7Click(Sender: TObject); private public @@ -58,5 +64,20 @@ begin Memo1.Text:=RxTextHolder1['Line 4']; end; +procedure TForm1.Button5Click(Sender: TObject); +begin + Memo1.Text:=RxTextHolder1['SQL']; +end; + +procedure TForm1.Button6Click(Sender: TObject); +begin + Memo1.Text:=RxTextHolder1['HTML']; +end; + +procedure TForm1.Button7Click(Sender: TObject); +begin + Memo1.Text:=RxTextHolder1['XML']; +end; + end. diff --git a/components/rx/trunk/docs/readmy.txt b/components/rx/trunk/docs/readmy.txt index 438d4e0fa..9f2c25d63 100644 --- a/components/rx/trunk/docs/readmy.txt +++ b/components/rx/trunk/docs/readmy.txt @@ -24,6 +24,7 @@ rtn - from freepascal.ru kit - from freepascal.ru linux-man + Michael Thompson Component icon images: zoltanleo aka Док diff --git a/components/rx/trunk/languages/rxconst.es.po b/components/rx/trunk/languages/rxconst.es.po index 4b855ce4c..e2fbfb920 100644 --- a/components/rx/trunk/languages/rxconst.es.po +++ b/components/rx/trunk/languages/rxconst.es.po @@ -26,6 +26,7 @@ msgid "Button align" msgstr "Alineaci?n de Botones" #: rxconst.sbuttonalign1 +msgctxt "rxconst.sbuttonalign1" msgid "None" msgstr "Ninguno" @@ -187,6 +188,28 @@ msgstr "" msgid "Item " msgstr "" +#: rxconst.srxtextfoldersynhighlighter +msgid "Highlighter" +msgstr "" + +#: rxconst.srxtextfoldersynhtml +msgid "HTML" +msgstr "" + +#: rxconst.srxtextfoldersynnone +#, fuzzy +msgctxt "rxconst.srxtextfoldersynnone" +msgid "None" +msgstr "Ninguno" + +#: rxconst.srxtextfoldersynsql +msgid "SQL" +msgstr "" + +#: rxconst.srxtextfoldersynxml +msgid "XML" +msgstr "" + #: rxconst.srxtextholderadd msgid "Add" msgstr "" @@ -195,6 +218,14 @@ msgstr "" msgid "RxTextHolder editor" msgstr "" +#: rxconst.srxtextholdermovedown +msgid "Down" +msgstr "" + +#: rxconst.srxtextholdermoveup +msgid "Up" +msgstr "" + #: rxconst.srxtextholderremove msgid "Remove" msgstr "" diff --git a/components/rx/trunk/languages/rxconst.po b/components/rx/trunk/languages/rxconst.po index 808dc2897..b23f459b5 100644 --- a/components/rx/trunk/languages/rxconst.po +++ b/components/rx/trunk/languages/rxconst.po @@ -26,6 +26,7 @@ msgid "Button align" msgstr "" #: rxconst.sbuttonalign1 +msgctxt "rxconst.sbuttonalign1" msgid "None" msgstr "" @@ -185,6 +186,27 @@ msgstr "" msgid "Item " msgstr "" +#: rxconst.srxtextfoldersynhighlighter +msgid "Highlighter" +msgstr "" + +#: rxconst.srxtextfoldersynhtml +msgid "HTML" +msgstr "" + +#: rxconst.srxtextfoldersynnone +msgctxt "rxconst.srxtextfoldersynnone" +msgid "None" +msgstr "" + +#: rxconst.srxtextfoldersynsql +msgid "SQL" +msgstr "" + +#: rxconst.srxtextfoldersynxml +msgid "XML" +msgstr "" + #: rxconst.srxtextholderadd msgid "Add" msgstr "" @@ -193,6 +215,14 @@ msgstr "" msgid "RxTextHolder editor" msgstr "" +#: rxconst.srxtextholdermovedown +msgid "Down" +msgstr "" + +#: rxconst.srxtextholdermoveup +msgid "Up" +msgstr "" + #: rxconst.srxtextholderremove msgid "Remove" msgstr "" diff --git a/components/rx/trunk/languages/rxconst.ru.po b/components/rx/trunk/languages/rxconst.ru.po index a1a8168d0..c80ad7872 100644 --- a/components/rx/trunk/languages/rxconst.ru.po +++ b/components/rx/trunk/languages/rxconst.ru.po @@ -1,5 +1,15 @@ msgid "" -msgstr "Content-Type: text/plain; charset=UTF-8" +msgstr "" +"Content-Type: text/plain; charset=UTF-8\n" +"Project-Id-Version: \n" +"POT-Creation-Date: \n" +"PO-Revision-Date: \n" +"Last-Translator: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: ru\n" +"X-Generator: Poedit 2.2\n" #: rxconst.sabout msgid "About" @@ -26,6 +36,7 @@ msgid "Button align" msgstr "Выравнивание кнопок" #: rxconst.sbuttonalign1 +msgctxt "rxconst.sbuttonalign1" msgid "None" msgstr "Нет" @@ -185,6 +196,27 @@ msgstr "Редактор RxStrHolder" msgid "Item " msgstr "Строка " +#: rxconst.srxtextfoldersynhighlighter +msgid "Highlighter" +msgstr "Подсветка синтаксиса" + +#: rxconst.srxtextfoldersynhtml +msgid "HTML" +msgstr "Синтаксис HTML" + +#: rxconst.srxtextfoldersynnone +msgctxt "rxconst.srxtextfoldersynnone" +msgid "None" +msgstr "Нет" + +#: rxconst.srxtextfoldersynsql +msgid "SQL" +msgstr "Синтаксис SQL" + +#: rxconst.srxtextfoldersynxml +msgid "XML" +msgstr "Синтаксис XML" + #: rxconst.srxtextholderadd msgid "Add" msgstr "Добавить" @@ -193,6 +225,14 @@ msgstr "Добавить" msgid "RxTextHolder editor" msgstr "Редактор RxTextHolder" +#: rxconst.srxtextholdermovedown +msgid "Down" +msgstr "Вниз" + +#: rxconst.srxtextholdermoveup +msgid "Up" +msgstr "Вверх" + #: rxconst.srxtextholderremove msgid "Remove" msgstr "Удалить" @@ -292,4 +332,3 @@ msgstr "Интерфейс : " #: rxconst.swindowsicofiles msgid "Windows Ico files (*.ico)|*.ico|All files (*.*)|*.*" msgstr "Файлы иконок Windows (*.ico)|*.ico|Все файлы (*.*)|*.*" - diff --git a/components/rx/trunk/languages/rxconst.uk.po b/components/rx/trunk/languages/rxconst.uk.po index 801cf1bde..688c9347f 100644 --- a/components/rx/trunk/languages/rxconst.uk.po +++ b/components/rx/trunk/languages/rxconst.uk.po @@ -35,6 +35,7 @@ msgid "Button align" msgstr "Вирівнювання кнопок" #: rxconst.sbuttonalign1 +msgctxt "rxconst.sbuttonalign1" msgid "None" msgstr "Ні" @@ -200,6 +201,28 @@ msgstr "" msgid "Item " msgstr "" +#: rxconst.srxtextfoldersynhighlighter +msgid "Highlighter" +msgstr "" + +#: rxconst.srxtextfoldersynhtml +msgid "HTML" +msgstr "" + +#: rxconst.srxtextfoldersynnone +#, fuzzy +msgctxt "rxconst.srxtextfoldersynnone" +msgid "None" +msgstr "Ні" + +#: rxconst.srxtextfoldersynsql +msgid "SQL" +msgstr "" + +#: rxconst.srxtextfoldersynxml +msgid "XML" +msgstr "" + #: rxconst.srxtextholderadd msgid "Add" msgstr "" @@ -208,6 +231,14 @@ msgstr "" msgid "RxTextHolder editor" msgstr "" +#: rxconst.srxtextholdermovedown +msgid "Down" +msgstr "" + +#: rxconst.srxtextholdermoveup +msgid "Up" +msgstr "" + #: rxconst.srxtextholderremove msgid "Remove" msgstr "" diff --git a/components/rx/trunk/rxtools/rxconst.pas b/components/rx/trunk/rxtools/rxconst.pas index ed0ad26c8..f4f866c04 100644 --- a/components/rx/trunk/rxtools/rxconst.pas +++ b/components/rx/trunk/rxtools/rxconst.pas @@ -136,12 +136,20 @@ resourcestring { TRxTextHolder } sRxTextHolderTextEditor = 'Rx text holder editor'; - sRxStrHolderTextEditor = 'Rx string holder editor'; + sRxStrHolderTextEditor = 'Rx string holder editor'; sRxTextHolderEditor = 'RxTextHolder editor'; sRxTextHolderTextCaption = 'Caption'; sRxTextHolderAdd = 'Add'; sRxTextHolderRemove = 'Remove'; + sRxTextHolderMoveUp = 'Up'; + sRxTextHolderMoveDown = 'Down'; sRxTextFolderItem = 'Item '; + sRxTextFolderSynHighlighter = 'Highlighter'; + sRxTextFolderSynNone = 'None'; + sRxTextFolderSynXML = 'XML'; + sRxTextFolderSynHTML = 'HTML'; + sRxTextFolderSynSQL = 'SQL'; + implementation diff --git a/components/rx/trunk/rxtools/rxtextholder.pas b/components/rx/trunk/rxtools/rxtextholder.pas index ac27786f2..42854f085 100644 --- a/components/rx/trunk/rxtools/rxtextholder.pas +++ b/components/rx/trunk/rxtools/rxtextholder.pas @@ -38,7 +38,7 @@ interface uses Classes, SysUtils; type - + TRxTextHolderHighlighter = (rxSynNone, rxSynXML, rxSynHTML, rxSynSQL); { TRxTextHolderItem } TRxTextHolderItem = class(TCollectionItem) @@ -70,6 +70,7 @@ type TRxTextHolder = class(TComponent) private + FHighlighter: TRxTextHolderHighlighter; FItems:TRxTextHolderItems; function GetText(ACaption: string): string; procedure SetItems(AValue: TRxTextHolderItems); @@ -82,6 +83,7 @@ type function IndexByName(ACaption:string):integer; property Text[ACaption:string]:string read GetText write SetText; default; published + property Highlighter: TRxTextHolderHighlighter read FHighlighter write FHighlighter; property Items:TRxTextHolderItems read FItems write SetItems; end; @@ -138,6 +140,7 @@ begin if (Dest is TRxTextHolder) then begin TRxTextHolder(Dest).Items.Assign(Items); + TRxTextHolder(Dest).Highlighter:=Highlighter; end else inherited AssignTo(Dest); @@ -147,6 +150,7 @@ constructor TRxTextHolder.Create(TheOwner: TComponent); begin inherited Create(TheOwner); FItems:=TRxTextHolderItems.Create(Self, TRxTextHolderItem); + FHighlighter:=rxSynNone; end; destructor TRxTextHolder.Destroy;