瀏覽代碼

designer: apply css while typing

mattias 1 天之前
父節點
當前提交
262bdc1252
共有 2 個文件被更改,包括 73 次插入71 次删除
  1. 65 66
      design/fresnel.stylepropedit.lfm
  2. 8 5
      design/fresnel.stylepropedit.pas

+ 65 - 66
design/fresnel.stylepropedit.lfm

@@ -1,18 +1,18 @@
 object StylePropEditDialog: TStylePropEditDialog
   Left = 480
-  Height = 414
+  Height = 432
   Top = 254
-  Width = 445
+  Width = 567
   ActiveControl = CSSSynEdit
   Caption = 'StylePropEditDialog'
-  ClientHeight = 414
-  ClientWidth = 445
+  ClientHeight = 432
+  ClientWidth = 567
   Constraints.MinHeight = 160
   Constraints.MinWidth = 180
+  Position = poScreenCenter
+  LCLVersion = '4.99.0.0'
   OnClose = FormClose
   OnCreate = FormCreate
-  Position = poScreenCenter
-  LCLVersion = '2.3.0.0'
   object TextGroupBox: TGroupBox
     AnchorSideLeft.Control = Owner
     AnchorSideTop.Control = Owner
@@ -20,22 +20,22 @@ object StylePropEditDialog: TStylePropEditDialog
     AnchorSideRight.Side = asrBottom
     AnchorSideBottom.Control = BtnPanel
     Left = 6
-    Height = 348
+    Height = 384
     Top = 6
-    Width = 433
+    Width = 555
     Align = alTop
     Anchors = [akTop, akLeft, akRight, akBottom]
     BorderSpacing.Around = 6
-    ClientHeight = 346
-    ClientWidth = 431
+    ClientHeight = 382
+    ClientWidth = 553
     TabOrder = 0
     object StatusLabel: TLabel
       AnchorSideBottom.Control = TextGroupBox
       AnchorSideBottom.Side = asrBottom
       Left = 9
-      Height = 15
-      Top = 325
-      Width = 63
+      Height = 16
+      Top = 360
+      Width = 70
       Anchors = [akLeft, akBottom]
       BorderSpacing.Around = 6
       Caption = 'StatusLabel'
@@ -45,15 +45,16 @@ object StylePropEditDialog: TStylePropEditDialog
       AnchorSideRight.Control = SortButton
       AnchorSideBottom.Control = StatusLabel
       Left = 6
-      Height = 319
+      Height = 354
       Top = 0
-      Width = 338
+      Width = 460
       BorderSpacing.Around = 6
       Anchors = [akTop, akLeft, akRight, akBottom]
       Font.Height = 13
       Font.Name = 'DejaVu Sans Mono'
       Font.Pitch = fpFixed
       Font.Quality = fqNonAntialiased
+      Font.Style = [fsBold]
       ParentColor = False
       ParentFont = False
       TabOrder = 0
@@ -487,35 +488,43 @@ object StylePropEditDialog: TStylePropEditDialog
       MouseTextActions = <>
       MouseSelActions = <>
       VisibleSpecialChars = [vscSpace, vscTabAtLast]
-      SelectedColor.BackPriority = 50
       SelectedColor.ForePriority = 50
+      SelectedColor.BackPriority = 50
       SelectedColor.FramePriority = 50
-      SelectedColor.BoldPriority = 50
-      SelectedColor.ItalicPriority = 50
-      SelectedColor.UnderlinePriority = 50
-      SelectedColor.StrikeOutPriority = 50
+      SelectedColor.BoldPriority = 0
+      SelectedColor.ItalicPriority = 0
+      SelectedColor.UnderlinePriority = 0
+      SelectedColor.StrikeOutPriority = 0
+      SelectedColor.ExtendPastEol = True
+      IncrementColor.ExtendPastEol = False
       BracketHighlightStyle = sbhsBoth
-      BracketMatchColor.Background = clNone
       BracketMatchColor.Foreground = clNone
+      BracketMatchColor.Background = clNone
       BracketMatchColor.Style = [fsBold]
-      FoldedCodeColor.Background = clNone
       FoldedCodeColor.Foreground = clGray
+      FoldedCodeColor.Background = clNone
       FoldedCodeColor.FrameColor = clGray
-      MouseLinkColor.Background = clNone
       MouseLinkColor.Foreground = clBlue
-      LineHighlightColor.Background = clNone
+      MouseLinkColor.Background = clNone
       LineHighlightColor.Foreground = clNone
+      LineHighlightColor.Background = clNone
       OnChange = CSSSynEditChange
       inline SynLeftGutterPartList1: TSynGutterPartList
         object SynGutterMarks1: TSynGutterMarks
           Width = 24
           MouseActions = <>
+          MaxExtraMarksColums = 0
+          Options = [sgmoDeDuplicateMarksOnOverflow]
+          MarkupInfo.Background = clBtnFace
+          MarkupInfoCurrentLine.Foreground = clNone
+          MarkupInfoCurrentLine.Background = clNone
         end
         object SynGutterLineNumber1: TSynGutterLineNumber
           Width = 17
           MouseActions = <>
           MarkupInfo.Background = clBtnFace
-          MarkupInfo.Foreground = clNone
+          MarkupInfoCurrentLine.Foreground = clNone
+          MarkupInfoCurrentLine.Background = clNone
           DigitCount = 2
           ShowOnlyLineNumbersMultiplesOf = 1
           ZeroStart = False
@@ -526,17 +535,24 @@ object StylePropEditDialog: TStylePropEditDialog
           MouseActions = <>
           ModifiedColor = 59900
           SavedColor = clGreen
+          MarkupInfo.Foreground = clGreen
+          MarkupInfo.FrameColor = 59900
+          MarkupInfoCurrentLine.Foreground = clNone
+          MarkupInfoCurrentLine.Background = clNone
         end
         object SynGutterSeparator1: TSynGutterSeparator
           Width = 2
           MouseActions = <>
-          MarkupInfo.Background = clWhite
           MarkupInfo.Foreground = clGray
+          MarkupInfo.Background = clWhite
+          MarkupInfoCurrentLine.Foreground = clNone
+          MarkupInfoCurrentLine.Background = clNone
         end
         object SynGutterCodeFolding1: TSynGutterCodeFolding
           MouseActions = <>
-          MarkupInfo.Background = clNone
           MarkupInfo.Foreground = clGray
+          MarkupInfoCurrentLine.Foreground = clNone
+          MarkupInfoCurrentLine.Background = clNone
           MouseActionsExpanded = <>
           MouseActionsCollapsed = <>
         end
@@ -545,80 +561,63 @@ object StylePropEditDialog: TStylePropEditDialog
     object SortButton: TButton
       AnchorSideLeft.Control = CSSSynEdit
       AnchorSideLeft.Side = asrBottom
-      AnchorSideTop.Control = ApplyButton
+      AnchorSideTop.Control = ApplySpeedButton
       AnchorSideTop.Side = asrBottom
       AnchorSideRight.Control = TextGroupBox
       AnchorSideRight.Side = asrBottom
-      Left = 350
-      Height = 31
-      Top = 43
+      Left = 472
+      Height = 30
+      Top = 32
       Width = 75
       Anchors = [akTop, akRight]
       AutoSize = True
       BorderSpacing.Around = 6
       Caption = 'Sort'
       Constraints.MinWidth = 75
-      OnClick = SortButtonClick
       TabOrder = 1
-    end
-    object ClearButton: TButton
-      AnchorSideLeft.Control = CSSSynEdit
-      AnchorSideLeft.Side = asrBottom
-      AnchorSideTop.Control = SortButton
-      AnchorSideTop.Side = asrBottom
-      AnchorSideRight.Control = SortButton
-      AnchorSideRight.Side = asrBottom
-      Left = 350
-      Height = 31
-      Top = 80
-      Width = 75
-      Anchors = [akTop, akLeft, akRight]
-      AutoSize = True
-      Caption = 'Clear'
-      OnClick = ClearButtonClick
-      TabOrder = 2
+      OnClick = SortButtonClick
     end
     object SaveButton: TButton
       AnchorSideLeft.Control = CSSSynEdit
       AnchorSideLeft.Side = asrBottom
-      AnchorSideTop.Control = ClearButton
+      AnchorSideTop.Control = SortButton
       AnchorSideTop.Side = asrBottom
       AnchorSideRight.Control = SortButton
       AnchorSideRight.Side = asrBottom
-      Left = 350
-      Height = 31
-      Top = 117
+      Left = 472
+      Height = 30
+      Top = 68
       Width = 75
       Anchors = [akTop, akLeft, akRight]
       AutoSize = True
       BorderSpacing.Top = 6
       Caption = 'Save'
+      TabOrder = 2
       OnClick = SaveButtonClick
-      TabOrder = 3
     end
-    object ApplyButton: TButton
+    object ApplySpeedButton: TSpeedButton
       AnchorSideLeft.Control = CSSSynEdit
       AnchorSideLeft.Side = asrBottom
-      AnchorSideTop.Control = TextGroupBox
-      AnchorSideRight.Control = SortButton
+      AnchorSideRight.Control = TextGroupBox
       AnchorSideRight.Side = asrBottom
-      Left = 350
-      Height = 31
-      Top = 6
+      Left = 472
+      Height = 26
+      Top = 0
       Width = 75
+      AllowAllUp = True
       Anchors = [akTop, akLeft, akRight]
       AutoSize = True
-      BorderSpacing.Top = 6
+      BorderSpacing.Right = 6
       Caption = 'Apply'
-      OnClick = ApplyButtonClick
-      TabOrder = 4
+      Down = True
+      GroupIndex = 1
     end
   end
   object BtnPanel: TButtonPanel
     Left = 6
-    Height = 48
-    Top = 360
-    Width = 433
+    Height = 30
+    Top = 396
+    Width = 555
     OKButton.Name = 'OKButton'
     OKButton.DefaultCaption = True
     HelpButton.Name = 'HelpButton'

+ 8 - 5
design/fresnel.stylepropedit.pas

@@ -5,19 +5,18 @@ unit Fresnel.StylePropEdit;
 interface
 
 uses
-  Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ButtonPanel, StdCtrls,
+  Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ButtonPanel, StdCtrls, Buttons,
   PropEdits, ObjInspStrConsts, IDEWindowIntf, TextTools, SynEdit,
-  SynHighlighterCss, LazUTF8, LazLoggerBase;
+  Fresnel.StrConsts, SynHighlighterCss, LazUTF8, LazLoggerBase;
 
 type
 
   { TStylePropEditDialog }
 
   TStylePropEditDialog = class(TForm)
+    ApplySpeedButton: TSpeedButton;
     BtnPanel: TButtonPanel;
-    ClearButton: TButton;
     SaveButton: TButton;
-    ApplyButton: TButton;
     SaveDialog1: TSaveDialog;
     StatusLabel: TLabel;
     SortButton: TButton;
@@ -67,8 +66,9 @@ end;
 procedure TStylePropEditDialog.FormCreate(Sender: TObject);
 begin
   StatusLabel.Caption := ois0Lines0Chars;
+  ApplySpeedButton.Caption := sccsTrEdtApply;
   SortButton.Caption := oisSort;
-  ClearButton.Caption := oisClear;
+  SaveButton.Caption := oisSave;
 
   CSSSynEdit.Font.Name := SynDefaultFontName;
   CSSSynEdit.Font.Height := SynDefaultFontHeight;
@@ -91,6 +91,9 @@ begin
     StatusLabel.Caption := Format(ois1LineDChars, [NumChars])
   else
     StatusLabel.Caption := Format(oisDLinesDChars, [CSSSynEdit.Lines.Count, NumChars]);
+
+  if ApplySpeedButton.Down then
+    Apply;
 end;
 
 procedure TStylePropEditDialog.SaveButtonClick(Sender: TObject);