|
@@ -24,6 +24,7 @@ type
|
|
|
CSSSynEdit: TSynEdit;
|
|
|
SynCssSyn1: TSynCssSyn;
|
|
|
procedure ApplyButtonClick(Sender: TObject);
|
|
|
+ procedure ApplySpeedButtonClick(Sender: TObject);
|
|
|
procedure ClearButtonClick(Sender: TObject);
|
|
|
procedure FormClose(Sender: TObject; var {%H-}CloseAction: TCloseAction);
|
|
|
procedure FormCreate(Sender: TObject);
|
|
@@ -32,8 +33,13 @@ type
|
|
|
procedure SortButtonClick(Sender: TObject);
|
|
|
private
|
|
|
FEditor: TPropertyEditor;
|
|
|
+ FOldValue: String;
|
|
|
+ FOldList: TStrings;
|
|
|
+ procedure OnCancelButtonClick(Sender: TObject);
|
|
|
+ procedure OnOkButtonClick(Sender: TObject);
|
|
|
procedure SetEditor(const AValue: TPropertyEditor);
|
|
|
public
|
|
|
+ destructor Destroy; override;
|
|
|
property Editor: TPropertyEditor read FEditor write SetEditor;
|
|
|
procedure Apply; virtual;
|
|
|
end;
|
|
@@ -57,6 +63,12 @@ begin
|
|
|
Apply;
|
|
|
end;
|
|
|
|
|
|
+procedure TStylePropEditDialog.ApplySpeedButtonClick(Sender: TObject);
|
|
|
+begin
|
|
|
+ if ApplySpeedButton.Down then
|
|
|
+ Apply;
|
|
|
+end;
|
|
|
+
|
|
|
procedure TStylePropEditDialog.FormClose(Sender: TObject;
|
|
|
var CloseAction: TCloseAction);
|
|
|
begin
|
|
@@ -69,9 +81,11 @@ begin
|
|
|
ApplySpeedButton.Caption := sccsTrEdtApply;
|
|
|
SortButton.Caption := oisSort;
|
|
|
SaveButton.Caption := oisSave;
|
|
|
+ BtnPanel.OKButton.OnClick:=@OnOkButtonClick;
|
|
|
+ BtnPanel.CancelButton.OnClick:=@OnCancelButtonClick;
|
|
|
|
|
|
CSSSynEdit.Font.Name := SynDefaultFontName;
|
|
|
- CSSSynEdit.Font.Height := SynDefaultFontHeight;
|
|
|
+ CSSSynEdit.Font.Height := {$IFDEF LCLCocoa}20{$ELSE}SynDefaultFontHeight{$ENDIF};
|
|
|
CSSSynEdit.Font.Pitch := SynDefaultFontPitch;
|
|
|
CSSSynEdit.Font.Quality := SynDefaultFontQuality;
|
|
|
|
|
@@ -131,21 +145,61 @@ begin
|
|
|
end;
|
|
|
|
|
|
procedure TStylePropEditDialog.SetEditor(const AValue: TPropertyEditor);
|
|
|
+var
|
|
|
+ aList: TStrings;
|
|
|
begin
|
|
|
if FEditor=AValue then Exit;
|
|
|
FEditor:=AValue;
|
|
|
+ if Editor=nil then exit;
|
|
|
+
|
|
|
if Editor is TStringPropertyEditor then
|
|
|
+ begin
|
|
|
+ FOldValue:=TStringPropertyEditor(Editor).GetStrValue;
|
|
|
+ CSSSynEdit.Text := FOldValue;
|
|
|
+ CSSSynEditChange(nil);
|
|
|
+ end
|
|
|
else if Editor is TClassPropertyEditor then
|
|
|
- else
|
|
|
+ begin
|
|
|
+ aList := TStrings(TClassPropertyEditor(Editor).GetObjectValue);
|
|
|
+ if FOldList=nil then FOldList:=TStringList.Create;
|
|
|
+ FOldList.Assign(aList);
|
|
|
+ CSSSynEdit.Text := aList.Text;
|
|
|
+ CSSSynEditChange(nil);
|
|
|
+ end else
|
|
|
raise Exception.Create('TStylePropEditDialog.SetEditor '+DbgSName(Editor));
|
|
|
end;
|
|
|
|
|
|
+destructor TStylePropEditDialog.Destroy;
|
|
|
+begin
|
|
|
+ FreeAndNil(FOldList);
|
|
|
+ inherited Destroy;
|
|
|
+end;
|
|
|
+
|
|
|
+procedure TStylePropEditDialog.OnOkButtonClick(Sender: TObject);
|
|
|
+begin
|
|
|
+ Apply;
|
|
|
+end;
|
|
|
+
|
|
|
+procedure TStylePropEditDialog.OnCancelButtonClick(Sender: TObject);
|
|
|
+var
|
|
|
+ aList: TStrings;
|
|
|
+begin
|
|
|
+ if Editor is TStringPropertyEditor then
|
|
|
+ TStringPropertyEditor(Editor).SetStrValue(FOldValue)
|
|
|
+ else if Editor is TClassPropertyEditor then
|
|
|
+ begin
|
|
|
+ aList := TStrings(TClassPropertyEditor(Editor).GetObjectValue);
|
|
|
+ aList.Assign(FOldList);
|
|
|
+ end;
|
|
|
+end;
|
|
|
+
|
|
|
procedure TStylePropEditDialog.Apply;
|
|
|
var
|
|
|
AString: String;
|
|
|
LineEndPos: SizeInt;
|
|
|
aList: TStrings;
|
|
|
begin
|
|
|
+ if csDestroying in ComponentState then exit;
|
|
|
AString := CSSSynEdit.Text;
|
|
|
LineEndPos := Length(AString) - Length(LineEnding) + 1;
|
|
|
// erase the last lineending if any
|