From 45dc7f2c6f28613c798f0bcfc2115fb7a4a7097c Mon Sep 17 00:00:00 2001 From: Error Date: Mon, 9 Jan 2017 04:23:06 +0300 Subject: [PATCH] Minor fixes in samples --- Samples/ActivityBar/uMain.dfm | 4 ++ .../BufferedChildrens/BufferedChildrens.dpr | 4 +- .../BufferedChildrens/BufferedChildrens.dproj | 36 ++++++++-------- Samples/BufferedChildrens/UnitMain.dfm | 6 +-- Samples/BufferedChildrens/UnitMain.pas | 14 +++---- Samples/Image/Main.dfm | 9 +++- Samples/Image/Main.pas | 2 + Source/ES.Backend.Selection.pas | 1 + Source/ES.Indicators.pas | 6 +-- Source/ES.StyleImageEditor.dfm | 11 ++--- Source/ES.StyleImageEditor.pas | 41 ++++++------------- 11 files changed, 63 insertions(+), 71 deletions(-) diff --git a/Samples/ActivityBar/uMain.dfm b/Samples/ActivityBar/uMain.dfm index 7927a7a..13d595a 100644 --- a/Samples/ActivityBar/uMain.dfm +++ b/Samples/ActivityBar/uMain.dfm @@ -72,6 +72,7 @@ object MainForm: TMainForm PaddingWithImage = True IsDrawHelper = True TabOrder = 0 + TextLayout = Top Caption = 'Main' DesignSize = ( 201 @@ -222,6 +223,7 @@ object MainForm: TMainForm PaddingWithImage = True IsDrawHelper = True TabOrder = 1 + TextLayout = Top Caption = 'Visual' DesignSize = ( 201 @@ -373,6 +375,7 @@ object MainForm: TMainForm PaddingWithImage = True IsDrawHelper = True TabOrder = 2 + TextLayout = Top Caption = 'Animation' DesignSize = ( 201 @@ -504,6 +507,7 @@ object MainForm: TMainForm Anchors = [akLeft, akTop, akRight] AutoHide = True Active = True + Placement = Top Color = clWhite ParentColor = False TabOrder = 0 diff --git a/Samples/BufferedChildrens/BufferedChildrens.dpr b/Samples/BufferedChildrens/BufferedChildrens.dpr index 266f021..632daa6 100644 --- a/Samples/BufferedChildrens/BufferedChildrens.dpr +++ b/Samples/BufferedChildrens/BufferedChildrens.dpr @@ -6,13 +6,13 @@ uses Vcl.Forms, Vcl.Themes, Vcl.Styles, - UnitMain in 'UnitMain.pas' {Form2}; + UnitMain in 'UnitMain.pas' {FormDemo}; {$R *.res} begin Application.Initialize; Application.MainFormOnTaskbar := True; - Application.CreateForm(TForm2, Form2); + Application.CreateForm(TFormDemo, FormDemo); Application.Run; end. diff --git a/Samples/BufferedChildrens/BufferedChildrens.dproj b/Samples/BufferedChildrens/BufferedChildrens.dproj index 5bede70..f9ad8ba 100644 --- a/Samples/BufferedChildrens/BufferedChildrens.dproj +++ b/Samples/BufferedChildrens/BufferedChildrens.dproj @@ -99,7 +99,7 @@ MainSource -
Form2
+
FormDemo
dfm
@@ -136,27 +136,12 @@ true - - - 0 - .dll;.bpl - + 1 - .dylib - - - Contents\MacOS - 1 - .dylib 1 - .dylib - - - 1 - .dylib @@ -510,12 +495,27 @@ 1 - + + + 0 + .dll;.bpl + 1 + .dylib + + + Contents\MacOS + 1 + .dylib 1 + .dylib + + + 1 + .dylib diff --git a/Samples/BufferedChildrens/UnitMain.dfm b/Samples/BufferedChildrens/UnitMain.dfm index faf3477..2f2e9e8 100644 --- a/Samples/BufferedChildrens/UnitMain.dfm +++ b/Samples/BufferedChildrens/UnitMain.dfm @@ -1,7 +1,7 @@ -object Form2: TForm2 +object FormDemo: TFormDemo Left = 0 Top = 0 - Caption = 'Form2' + Caption = 'Demo' ClientHeight = 487 ClientWidth = 716 Color = clBtnFace @@ -48482,7 +48482,7 @@ object Form2: TForm2 object CheckBoxBufferedChildrens: TCheckBox Left = 8 Top = 8 - Width = 97 + Width = 114 Height = 17 Caption = 'BufferedChildrens' TabOrder = 1 diff --git a/Samples/BufferedChildrens/UnitMain.pas b/Samples/BufferedChildrens/UnitMain.pas index 2e1e524..ed600d1 100644 --- a/Samples/BufferedChildrens/UnitMain.pas +++ b/Samples/BufferedChildrens/UnitMain.pas @@ -8,7 +8,7 @@ interface Vcl.Buttons, Vcl.ComCtrls, Vcl.Imaging.pngimage; type - TForm2 = class(TForm) + TFormDemo = class(TForm) EsLayout: TEsLayout; CheckBoxBufferedChildrens: TCheckBox; Label1: TLabel; @@ -55,7 +55,7 @@ TForm2 = class(TForm) end; var - Form2: TForm2; + FormDemo: TFormDemo; implementation @@ -64,13 +64,13 @@ implementation uses Styles, Themes; -procedure TForm2.CheckBoxBufferedChildrensClick(Sender: TObject); +procedure TFormDemo.CheckBoxBufferedChildrensClick(Sender: TObject); begin EsLayout.Invalidate; EsLayout.BufferedChildrens := TCheckBox(Sender).Checked; end; -procedure TForm2.CheckBoxUseThemeClick(Sender: TObject); +procedure TFormDemo.CheckBoxUseThemeClick(Sender: TObject); begin if TCheckBox(Sender).Checked then TStyleManager.TrySetStyle('Windows10') @@ -78,7 +78,7 @@ procedure TForm2.CheckBoxUseThemeClick(Sender: TObject); TStyleManager.TrySetStyle('Windows'); end; -procedure TForm2.EsLayoutPaint(Sender: TObject; Canvas: TCanvas; Rect: TRect); +procedure TFormDemo.EsLayoutPaint(Sender: TObject; Canvas: TCanvas; Rect: TRect); begin Canvas.Pen.Width := 1; if TEsLayout(EsLayout).BufferedChildrens then @@ -93,10 +93,10 @@ procedure TForm2.EsLayoutPaint(Sender: TObject; Canvas: TCanvas; Rect: TRect); end; Canvas.Rectangle(Rect); Canvas.Font.Color := clBlue; - Canvas.TextOut(500, 2, 'TEsCustomControl <- TEsLayot'); + Canvas.TextOut(300, 150, 'TEsCustomControl <- TEsBaseLayout <- TEsCustomLayout <- TEsLayot'); end; -procedure TForm2.TimerRepaintTimer(Sender: TObject); +procedure TFormDemo.TimerRepaintTimer(Sender: TObject); begin Label1.Caption := 'Label' + IntToStr(Random(100000)); Label2.Caption := 'Label' + IntToStr(Random(100000)); diff --git a/Samples/Image/Main.dfm b/Samples/Image/Main.dfm index e0d8b27..8d17941 100644 --- a/Samples/Image/Main.dfm +++ b/Samples/Image/Main.dfm @@ -7645,6 +7645,13 @@ object MainForm: TMainForm Height = 13 Caption = '6' end + object LabelIndex: TLabel + Left = 78 + Top = 120 + Width = 53 + Height = 13 + Caption = 'LabelIndex' + end object Memo1: TMemo Left = 6 Top = 296 @@ -18343,7 +18350,7 @@ object MainForm: TMainForm Left = 676 Top = 16 Bitmap = { - 494C010107001800240020002000FFFFFFFF1910FFFFFFFFFFFFFFFF424D3600 + 494C010107001800280020002000FFFFFFFF1910FFFFFFFFFFFFFFFF424D3600 0000000000003600000028000000800000004000000001001800000000000060 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 diff --git a/Samples/Image/Main.pas b/Samples/Image/Main.pas index ed4397e..02aa706 100644 --- a/Samples/Image/Main.pas +++ b/Samples/Image/Main.pas @@ -101,6 +101,7 @@ TMainForm = class(TForm) TrackBar1: TTrackBar; Timer2: TTimer; EsImage22: TEsImage; + LabelIndex: TLabel; procedure Timer1Timer(Sender: TObject); procedure EsImageControl14Click(Sender: TObject); procedure Timer2Timer(Sender: TObject); @@ -129,6 +130,7 @@ procedure TMainForm.Timer1Timer(Sender: TObject); ImageListTestImage.ImageIndex := ImageListTestImage.ImageIndex + 1; if ImageListTestImage.ImageIndex >= ImageList.Count then ImageListTestImage.ImageIndex := 0; + LabelIndex.Caption := IntToStr(ImageListTestImage.ImageIndex); end; procedure TMainForm.Timer2Timer(Sender: TObject); diff --git a/Source/ES.Backend.Selection.pas b/Source/ES.Backend.Selection.pas index a4d83af..a0fa4c0 100644 --- a/Source/ES.Backend.Selection.pas +++ b/Source/ES.Backend.Selection.pas @@ -55,6 +55,7 @@ TProportionalRange = class(TRange) property Kind: TProportionalKind read FKind write SetKind; end; + // only internal use TBackendSelection = class(TBackendControl) private const DefaultGrips = [TGripKind.TopLeft, TGripKind.TopRight, TGripKind.BottomLeft, TGripKind.BottomRight, diff --git a/Source/ES.Indicators.pas b/Source/ES.Indicators.pas index daedffa..c7bb776 100644 --- a/Source/ES.Indicators.pas +++ b/Source/ES.Indicators.pas @@ -339,11 +339,8 @@ procedure TEsActivityBar.DoPlacement; if (Parent = nil) or (csLoading in ComponentState) then Exit; - if Placement = TActivityPlacement.None then + if Placement <> TActivityPlacement.None then begin - Align := alNone; - Inherited Anchors := [akTop, akLeft]; - end else if FDisplayMode = TActivityDisplayMode.Overlay then begin Inherited Align := alNone; @@ -374,6 +371,7 @@ procedure TEsActivityBar.DoPlacement; Top := Parent.ClientHeight - Height; end; end; + end; end; function TEsActivityBar.GetStartPos: double; diff --git a/Source/ES.StyleImageEditor.dfm b/Source/ES.StyleImageEditor.dfm index c8ecf39..cfe9344 100644 --- a/Source/ES.StyleImageEditor.dfm +++ b/Source/ES.StyleImageEditor.dfm @@ -14,7 +14,6 @@ object StyleImageEditor: TStyleImageEditor Font.Name = 'Tahoma' Font.Style = [] OldCreateOrder = False - Visible = True OnCreate = FormCreate OnDestroy = FormDestroy OnShortCut = FormShortCut @@ -38,12 +37,6 @@ object StyleImageEditor: TStyleImageEditor Padding.Bottom = 2 ParentColor = False TabOrder = 0 - object Shape1: TShape - Left = 158 - Top = 113 - Width = 118 - Height = 48 - end object Panel1: TPanel Left = 0 Top = 0 @@ -81,6 +74,8 @@ object StyleImageEditor: TStyleImageEditor BevelKind = bkFlat BevelOuter = bvNone TabOrder = 1 + ExplicitLeft = 32 + ExplicitTop = 306 DesignSize = ( 485 37) @@ -122,6 +117,8 @@ object StyleImageEditor: TStyleImageEditor BevelKind = bkFlat BevelOuter = bvNone TabOrder = 2 + ExplicitLeft = -16 + ExplicitTop = 69 object PlusSpeedButton: TSpeedButton Left = 125 Top = 5 diff --git a/Source/ES.StyleImageEditor.pas b/Source/ES.StyleImageEditor.pas index 930b238..3ffd174 100644 --- a/Source/ES.StyleImageEditor.pas +++ b/Source/ES.StyleImageEditor.pas @@ -5,23 +5,11 @@ interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ExtCtrls, Vcl.StdCtrls, Vcl.Buttons, Vcl.ToolWin, - Vcl.ComCtrls, Es.CfxClasses, Vcl.Imaging.PngImage, Es.Backend.Selection, Es.Vcl.Images; + Vcl.ComCtrls, Es.CfxClasses, Vcl.Imaging.PngImage, Es.Backend.Selection, Es.Images; {$SCOPEDENUMS on} type - TA = class - public type - T = (a, b); - end; - - TB = class - public type - T = (a, b); - end; - - TPaintBox = class(TEsImageControl); - TStyleImageEditor = class(TForm) CancelButton: TButton; OkButton: TButton; @@ -35,7 +23,6 @@ TStyleImageEditor = class(TForm) LoadButton: TButton; Panel1: TPanel; Disp: TPaintBox; - Shape1: TShape; procedure PlusSpeedButtonClick(Sender: TObject); procedure MinusSpeedButtonClick(Sender: TObject); procedure FormShortCut(var Msg: TWMKey; var Handled: Boolean); @@ -51,8 +38,6 @@ TStyleImageEditor = class(TForm) FBitmap: TBitmap; d: THeaderStyle; FImageMargins: TImageMargins; - A: TA.T; - B: TB.T; procedure SetBitmap(const Value: TBitmap); procedure ChangeSelection(Sender: TObject); procedure SetImageMargins(const Value: TImageMargins); @@ -75,8 +60,6 @@ TStyleImageEditor = class(TForm) property ImageMargins: TImageMargins read FImageMargins write SetImageMargins; end; -var - StyleImageEditor: TStyleImageEditor; implementation @@ -194,7 +177,7 @@ procedure TStyleImageEditor.DispPaint(Sender: TObject); State: ICanvasSaver; begin Caption := Random(100000).toString; - TEsImageControl(Sender).Canvas.StretchDraw(Rect(0, 0, TEsImageControl(Sender).Width, TEsImageControl(Sender).Height), Bitmap); + TPaintBox(Sender).Canvas.StretchDraw(Rect(0, 0, TEsImageControl(Sender).Width, TEsImageControl(Sender).Height), Bitmap); // TPaintBox(Sender).Canvas.DrawTransparentFrame( // Rect((0 + ImageMargins.Left) * Zoom, (0 + ImageMargins.Top) * Zoom, @@ -202,19 +185,19 @@ procedure TStyleImageEditor.DispPaint(Sender: TObject); // RGB(0, 0, 0), RGB(255, 255, 255), 200, '12 21 '); //TPaintBox(Sender).Canvas.DrawChessFrame(Rect((0 + ImageMargins.Left) * Zoom, (0 + ImageMargins.Top) * Zoom, // (Bitmap.Width - ImageMargins.Right) * Zoom, (Bitmap.Height - ImageMargins.Bottom) * Zoom), clBlack, clWhite); - State := TEsImageControl(Sender).Canvas.SaveState([TBrush, TPen]); - TEsImageControl(Sender).Canvas.Pen.Style := psDot; - TEsImageControl(Sender).Canvas.Pen.Mode := pmNot; - TEsImageControl(Sender).Canvas.Brush.Style := bsClear; + State := TPaintBox(Sender).Canvas.SaveState([TBrush, TPen]); + TPaintBox(Sender).Canvas.Pen.Style := psDot; + TPaintBox(Sender).Canvas.Pen.Mode := pmNot; + TPaintBox(Sender).Canvas.Brush.Style := bsClear; // TPaintBox(Sender).Canvas.Rectangle(Rect((0 + ImageMargins.Left) * Zoom, (0 + ImageMargins.Top) * Zoom, // (Bitmap.Width - ImageMargins.Right) * Zoom, (Bitmap.Height - ImageMargins.Bottom) * Zoom)); - TEsImageControl(Sender).Canvas.Line(Selection.Selection.Left * Zoom, 0, Selection.Selection.Left * Zoom, Bitmap.Height * Zoom); + TPaintBox(Sender).Canvas.Line(Selection.Selection.Left * Zoom, 0, Selection.Selection.Left * Zoom, Bitmap.Height * Zoom); if Selection.Selection.Left <> Selection.Selection.Right then - TEsImageControl(Sender).Canvas.Line(Selection.Selection.Right * Zoom - 1, 0, Selection.Selection.Right * Zoom - 1, Bitmap.Height * Zoom); - TEsImageControl(Sender).Canvas.Line(0, Selection.Selection.Top * Zoom, Bitmap.Width * Zoom, Selection.Selection.Top * Zoom); + TPaintBox(Sender).Canvas.Line(Selection.Selection.Right * Zoom - 1, 0, Selection.Selection.Right * Zoom - 1, Bitmap.Height * Zoom); + TPaintBox(Sender).Canvas.Line(0, Selection.Selection.Top * Zoom, Bitmap.Width * Zoom, Selection.Selection.Top * Zoom); if Selection.Selection.Top <> Selection.Selection.Bottom then - TEsImageControl(Sender).Canvas.Line(0, Selection.Selection.Bottom * Zoom - 1, Bitmap.Width * Zoom, Selection.Selection.Bottom * Zoom - 1); - TEsImageControl(Sender).Canvas.RestoreState(State); + TPaintBox(Sender).Canvas.Line(0, Selection.Selection.Bottom * Zoom - 1, Bitmap.Width * Zoom, Selection.Selection.Bottom * Zoom - 1); + TPaintBox(Sender).Canvas.RestoreState(State); // DrawBox(TPaintBox(Sender).Canvas, // Selection.Selection.Left * Zoom, Selection.Selection.Top * Zoom, 4); @@ -357,7 +340,7 @@ procedure TStyleImageEditor.SetImageMargins(const Value: TImageMargins); procedure TStyleImageEditor.SetZoom(const Value: Integer); begin Selection.Numerator := Value; - TEsImageControl(Disp).RecreateBitmap; + // TEsImageControl(Disp).RecreateBitmap; end; procedure TStyleImageEditor.ZoomComboBoxChange(Sender: TObject);