Skip to content

Commit

Permalink
Del AC, fix RMB locked button, fix test form
Browse files Browse the repository at this point in the history
  • Loading branch information
HemulGM committed Nov 30, 2022
1 parent 6cb6949 commit ff87533
Show file tree
Hide file tree
Showing 6 changed files with 3,145 additions and 22,774 deletions.
23,243 changes: 2,637 additions & 20,606 deletions CTS.Main.dfm

Large diffs are not rendered by default.

30 changes: 14 additions & 16 deletions CTS.Main.pas
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ interface
HGM.Controls.Labels, HGM.Controls.SpinEdit, HGM.Button,
HGM.Controls.PanelCollapsed, HGM.Controls.PanelExt, HexaColorPicker,
HSColorPicker, HSLRingPicker, HSLColorPicker, SLHColorPicker, HSVColorPicker,
Vcl.Themes, Vcl.Styles, Vcl.Graphics, Vcl.Menus, mbColorPickerControl, acPNG,
Vcl.Themes, Vcl.Styles, Vcl.Graphics, Vcl.Menus, mbColorPickerControl,
Vcl.WinXCtrls;

type
Expand Down Expand Up @@ -246,6 +246,7 @@ TFormMain = class(TForm)
procedure DownloadAndUpdateAsync(const Ver, Url: string);
procedure ShowUpdateError(const Url: string);
procedure ShowUpdateDone;
function ShapeIsLocked(Shape: TShape): Boolean;
public
procedure SetDataColor(dColor: TColor);
procedure AddColorToMix(aColor: TColor);
Expand All @@ -261,7 +262,7 @@ TFormMain = class(TForm)
DEFAULT_SHORTCUT = 'Ctrl+Shift';

const
Version = 'v1.22';
Version = 'v1.23';

var
FormMain: TFormMain;
Expand Down Expand Up @@ -1150,11 +1151,18 @@ procedure TFormMain.SetActiveShape(const Value: TShape);
Shape1MouseLeave(FActiveShape);
end;

function TFormMain.ShapeIsLocked(Shape: TShape): Boolean;
var
LockBtn: TComponent;
begin
LockBtn := FindComponent('ButtonFlatLock' + Shape.Tag.ToString);
Result := (Assigned(LockBtn) and (LockBtn is TButtonFlat)) and ((LockBtn as TButtonFlat).ImageIndex <> 6);
end;

procedure TFormMain.SetDataColor(dColor: TColor);
var
C, M, Y, K, R, G, B: Byte;
H, V, S: Double;
LockBtn: TComponent;
begin
FDataColor := ColorToRGB(dColor);
R := GetRValue(ColorToRGB(FDataColor));
Expand Down Expand Up @@ -1190,13 +1198,7 @@ procedure TFormMain.SetDataColor(dColor: TColor);

if Assigned(FActiveShape) then
begin
LockBtn := FindComponent('ButtonFlatLock' + FActiveShape.Tag.ToString);
if Assigned(LockBtn) and (LockBtn is TButtonFlat) then
begin
if (LockBtn as TButtonFlat).ImageIndex = 6 then
FActiveShape.Brush.Color := FDataColor;
end
else
if not ShapeIsLocked(FActiveShape) then
FActiveShape.Brush.Color := FDataColor;
end;
if Assigned(FormTest) then
Expand Down Expand Up @@ -1260,7 +1262,8 @@ procedure TFormMain.Shape1MouseUp(Sender: TObject; Button: TMouseButton; Shift:
end
else if Button = mbRight then
begin
(Sender as TShape).Brush.Color := FDataColor;
if not ShapeIsLocked(Sender as TShape) then
(Sender as TShape).Brush.Color := FDataColor;
end;
Shape1MouseLeave(OldShape);
end;
Expand Down Expand Up @@ -1329,11 +1332,6 @@ procedure TFormMain.SpeedButtonMixDoClick(Sender: TObject);

procedure TFormMain.ButtonFlatTestClick(Sender: TObject);
begin
if FIsDark then
begin
ShowMessage('Не работает с тёмной темой');
Exit;
end;
FormTest.Show;
end;

Expand Down
Loading

0 comments on commit ff87533

Please sign in to comment.