Skip to content

Commit

Permalink
Minor fixes in samples
Browse files Browse the repository at this point in the history
  • Loading branch information
errorcalc committed Jan 9, 2017
1 parent 1ec12ce commit 45dc7f2
Show file tree
Hide file tree
Showing 11 changed files with 63 additions and 71 deletions.
4 changes: 4 additions & 0 deletions Samples/ActivityBar/uMain.dfm
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ object MainForm: TMainForm
PaddingWithImage = True
IsDrawHelper = True
TabOrder = 0
TextLayout = Top
Caption = 'Main'
DesignSize = (
201
Expand Down Expand Up @@ -222,6 +223,7 @@ object MainForm: TMainForm
PaddingWithImage = True
IsDrawHelper = True
TabOrder = 1
TextLayout = Top
Caption = 'Visual'
DesignSize = (
201
Expand Down Expand Up @@ -373,6 +375,7 @@ object MainForm: TMainForm
PaddingWithImage = True
IsDrawHelper = True
TabOrder = 2
TextLayout = Top
Caption = 'Animation'
DesignSize = (
201
Expand Down Expand Up @@ -504,6 +507,7 @@ object MainForm: TMainForm
Anchors = [akLeft, akTop, akRight]
AutoHide = True
Active = True
Placement = Top
Color = clWhite
ParentColor = False
TabOrder = 0
Expand Down
4 changes: 2 additions & 2 deletions Samples/BufferedChildrens/BufferedChildrens.dpr
Original file line number Diff line number Diff line change
Expand Up @@ -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.
36 changes: 18 additions & 18 deletions Samples/BufferedChildrens/BufferedChildrens.dproj
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
<MainSource>MainSource</MainSource>
</DelphiCompile>
<DCCReference Include="UnitMain.pas">
<Form>Form2</Form>
<Form>FormDemo</Form>
<FormType>dfm</FormType>
</DCCReference>
<BuildConfiguration Include="Release">
Expand Down Expand Up @@ -136,27 +136,12 @@
<Overwrite>true</Overwrite>
</Platform>
</DeployFile>
<DeployClass Name="DependencyModule">
<Platform Name="Win32">
<Operation>0</Operation>
<Extensions>.dll;.bpl</Extensions>
</Platform>
<DeployClass Name="ProjectiOSDeviceResourceRules">
<Platform Name="iOSDevice64">
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="OSX32">
<RemoteDir>Contents\MacOS</RemoteDir>
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="iOSDevice32">
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="iOSSimulator">
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
</DeployClass>
<DeployClass Name="ProjectOSXResource">
Expand Down Expand Up @@ -510,12 +495,27 @@
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectiOSDeviceResourceRules">
<DeployClass Name="DependencyModule">
<Platform Name="Win32">
<Operation>0</Operation>
<Extensions>.dll;.bpl</Extensions>
</Platform>
<Platform Name="iOSDevice64">
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="OSX32">
<RemoteDir>Contents\MacOS</RemoteDir>
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="iOSDevice32">
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="iOSSimulator">
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
</DeployClass>
<ProjectRoot Platform="iOSDevice64" Name="$(PROJECTNAME).app"/>
Expand Down
6 changes: 3 additions & 3 deletions Samples/BufferedChildrens/UnitMain.dfm
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
object Form2: TForm2
object FormDemo: TFormDemo
Left = 0
Top = 0
Caption = 'Form2'
Caption = 'Demo'
ClientHeight = 487
ClientWidth = 716
Color = clBtnFace
Expand Down Expand Up @@ -48482,7 +48482,7 @@ object Form2: TForm2
object CheckBoxBufferedChildrens: TCheckBox
Left = 8
Top = 8
Width = 97
Width = 114
Height = 17
Caption = 'BufferedChildrens'
TabOrder = 1
Expand Down
14 changes: 7 additions & 7 deletions Samples/BufferedChildrens/UnitMain.pas
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -55,7 +55,7 @@ TForm2 = class(TForm)
end;

var
Form2: TForm2;
FormDemo: TFormDemo;

implementation

Expand All @@ -64,21 +64,21 @@ 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')
else
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
Expand All @@ -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));
Expand Down
9 changes: 8 additions & 1 deletion Samples/Image/Main.dfm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -18343,7 +18350,7 @@ object MainForm: TMainForm
Left = 676
Top = 16
Bitmap = {
494C010107001800240020002000FFFFFFFF1910FFFFFFFFFFFFFFFF424D3600
494C010107001800280020002000FFFFFFFF1910FFFFFFFFFFFFFFFF424D3600
0000000000003600000028000000800000004000000001001800000000000060
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
Expand Down
2 changes: 2 additions & 0 deletions Samples/Image/Main.pas
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions Source/ES.Backend.Selection.pas
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 2 additions & 4 deletions Source/ES.Indicators.pas
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -374,6 +371,7 @@ procedure TEsActivityBar.DoPlacement;
Top := Parent.ClientHeight - Height;
end;
end;
end;
end;

function TEsActivityBar.GetStartPos: double;
Expand Down
11 changes: 4 additions & 7 deletions Source/ES.StyleImageEditor.dfm
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ object StyleImageEditor: TStyleImageEditor
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
Visible = True
OnCreate = FormCreate
OnDestroy = FormDestroy
OnShortCut = FormShortCut
Expand All @@ -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
Expand Down Expand Up @@ -81,6 +74,8 @@ object StyleImageEditor: TStyleImageEditor
BevelKind = bkFlat
BevelOuter = bvNone
TabOrder = 1
ExplicitLeft = 32
ExplicitTop = 306
DesignSize = (
485
37)
Expand Down Expand Up @@ -122,6 +117,8 @@ object StyleImageEditor: TStyleImageEditor
BevelKind = bkFlat
BevelOuter = bvNone
TabOrder = 2
ExplicitLeft = -16
ExplicitTop = 69
object PlusSpeedButton: TSpeedButton
Left = 125
Top = 5
Expand Down
41 changes: 12 additions & 29 deletions Source/ES.StyleImageEditor.pas
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -75,8 +60,6 @@ TStyleImageEditor = class(TForm)
property ImageMargins: TImageMargins read FImageMargins write SetImageMargins;
end;

var
StyleImageEditor: TStyleImageEditor;

implementation

Expand Down Expand Up @@ -194,27 +177,27 @@ 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,
// (Bitmap.Width - ImageMargins.Right) * Zoom, (Bitmap.Height - ImageMargins.Bottom) * Zoom),
// 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);
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 45dc7f2

Please sign in to comment.