|
@@ -7,7 +7,7 @@ interface
|
|
|
uses
|
|
|
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ButtonPanel, StdCtrls,
|
|
|
PropEdits, ObjInspStrConsts, IDEWindowIntf, TextTools, SynEdit,
|
|
|
- SynHighlighterCss, LazUTF8;
|
|
|
+ SynHighlighterCss, LazUTF8, LazLoggerBase;
|
|
|
|
|
|
type
|
|
|
|
|
@@ -32,8 +32,10 @@ type
|
|
|
procedure SaveButtonClick(Sender: TObject);
|
|
|
procedure SortButtonClick(Sender: TObject);
|
|
|
private
|
|
|
+ FEditor: TPropertyEditor;
|
|
|
+ procedure SetEditor(const AValue: TPropertyEditor);
|
|
|
public
|
|
|
- Editor: TStringPropertyEditor;
|
|
|
+ property Editor: TPropertyEditor read FEditor write SetEditor;
|
|
|
procedure Apply; virtual;
|
|
|
end;
|
|
|
|
|
@@ -64,7 +66,6 @@ end;
|
|
|
|
|
|
procedure TStylePropEditDialog.FormCreate(Sender: TObject);
|
|
|
begin
|
|
|
- Caption := 'CSS Inline Style Editor';
|
|
|
StatusLabel.Caption := ois0Lines0Chars;
|
|
|
SortButton.Caption := oisSort;
|
|
|
ClearButton.Caption := oisClear;
|
|
@@ -126,17 +127,35 @@ begin
|
|
|
CSSSynEdit.Lines.Text := NewSortedText;
|
|
|
end;
|
|
|
|
|
|
+procedure TStylePropEditDialog.SetEditor(const AValue: TPropertyEditor);
|
|
|
+begin
|
|
|
+ if FEditor=AValue then Exit;
|
|
|
+ FEditor:=AValue;
|
|
|
+ if Editor is TStringPropertyEditor then
|
|
|
+ else if Editor is TClassPropertyEditor then
|
|
|
+ else
|
|
|
+ raise Exception.Create('TStylePropEditDialog.SetEditor '+DbgSName(Editor));
|
|
|
+end;
|
|
|
+
|
|
|
procedure TStylePropEditDialog.Apply;
|
|
|
var
|
|
|
AString: String;
|
|
|
LineEndPos: SizeInt;
|
|
|
+ aList: TStrings;
|
|
|
begin
|
|
|
AString := CSSSynEdit.Text;
|
|
|
LineEndPos := Length(AString) - Length(LineEnding) + 1;
|
|
|
// erase the last lineending if any
|
|
|
if Copy(AString, LineEndPos, Length(LineEnding)) = LineEnding then
|
|
|
Delete(AString, LineEndPos, Length(LineEnding));
|
|
|
- Editor.SetStrValue(AString);
|
|
|
+
|
|
|
+ if Editor is TStringPropertyEditor then
|
|
|
+ Editor.SetStrValue(AString)
|
|
|
+ else if Editor is TClassPropertyEditor then
|
|
|
+ begin
|
|
|
+ aList := TStrings(Editor.GetObjectValue);
|
|
|
+ aList.Text:=AString;
|
|
|
+ end;
|
|
|
end;
|
|
|
|
|
|
end.
|