summaryrefslogtreecommitdiff
path: root/UChecksumDruid.pas
diff options
context:
space:
mode:
authorTomas Bzatek <tbzatek@redhat.com>2024-12-24 12:41:48 +0100
committerTomas Bzatek <tbzatek@redhat.com>2025-11-27 19:39:51 +0100
commit1b2b4bb4f3ecc034a6e9364d8768e50b167a9680 (patch)
tree065ddde53b64f7957a30b7dc9d83a748f309868c /UChecksumDruid.pas
parentb9703b29819b619037cc282d719c187e51bacd30 (diff)
downloadtuxcmd-1b2b4bb4f3ecc034a6e9364d8768e50b167a9680.tar.xz
Rough GTK3 port
Diffstat (limited to 'UChecksumDruid.pas')
-rw-r--r--UChecksumDruid.pas95
1 files changed, 55 insertions, 40 deletions
diff --git a/UChecksumDruid.pas b/UChecksumDruid.pas
index 90df615..fc62347 100644
--- a/UChecksumDruid.pas
+++ b/UChecksumDruid.pas
@@ -22,8 +22,8 @@ unit UChecksumDruid;
interface
uses
- lazglib2, gdk2, gtk2, SysUtils, Classes, Variants, GTKControls, GTKForms, GTKStdCtrls, GTKExtCtrls, GTKConsts,
- GTKUtils, UEngines;
+ SysUtils, Classes, lazglib2, lazgdk3, lazgtk3, GTKControls, GTKForms, GTKStdCtrls, GTKExtCtrls,
+ UEngines;
type
TFChecksumDruid = class(TGTKDialog)
@@ -49,7 +49,7 @@ type
procedure SeparateFileCheckBoxToggled(Sender: TObject);
procedure FormKeyDown(Sender: TObject; Key: Word; Shift: TShiftState; var Accept: boolean);
private
- ColorFG, ColorBG, ColorGray: PGdkColor;
+// ColorFG, ColorBG, ColorGray: PGdkColor;
CurrentPage: integer;
Processing, Stop, StopBreak: boolean;
Buffer: Pointer;
@@ -91,17 +91,19 @@ begin
OnDestroy := @FormDestroy;
OnResponse := @FormResponse;
FileNames := TStringList.Create;
- ShowSeparator := False;
Buttons := [];
ActionArea.SetSizeRequest(0, 0);
DruidArea := TGTKVBox.Create(Self);
DruidArea.BorderWidth := 2;
ClientArea.AddControlEx(DruidArea, True, True, 0);
- CancelButton := TGTKButton.CreateFromStock(Self, 'gtk-cancel');
+ CancelButton := TGTKButton.CreateFromIconName(Self, 'gtk-cancel');
+ CancelButton.Caption := 'Cancel';
CancelButton.OnClick := @CancelButtonClick;
- BackButton := TGTKButton.CreateFromStock(Self, 'gtk-go-back');
+ BackButton := TGTKButton.CreateFromIconName(Self, 'gtk-go-back');
+ BackButton.Caption := 'Back';
BackButton.OnClick := @BackButtonClick;
- ForwardButton := TGTKButton.CreateFromStock(Self, 'gtk-go-forward');
+ ForwardButton := TGTKButton.CreateFromIconName(Self, 'gtk-go-forward');
+ ForwardButton.Caption := 'Forward';
ForwardButton.OnClick := @ForwardButtonClick;
ButtonBox := TGTKHButtonBox.Create(Self);
ButtonBox.Layout := blEnd;
@@ -111,20 +113,24 @@ begin
ButtonBox.AddControlEx(BackButton, False, False, 0);
ButtonBox.AddControlEx(ForwardButton, False, False, 0);
ClientArea.AddControlEndEx(ButtonBox, False, False, 0);
- ColorFG := GetDefaultForegroundColor(3);
- ColorBG := GetDefaultBackgroundColor(3);
- ColorGray := GetDefaultBackgroundColor(2);
+// ColorFG := GetDefaultForegroundColor(3);
+// ColorBG := GetDefaultBackgroundColor(3);
+// ColorGray := GetDefaultBackgroundColor(2);
TitleLabel := TGTKLabel.Create(Self);
TitleLabelBox := TGTKEventBox.Create(Self);
TitleLabelBox.AddControl(TitleLabel);
TitleLabelBox.BorderWidth := 0;
- TitleLabel.SetAlignment(0, 0.5);
- TitleLabel.SetPadding(5, 5);
- TitleLabel.SetForegroundColor(ColorFG);
- TitleLabelBox.SetBackgroundColor(ColorBG);
+ TitleLabel.XAlign := 0;
+ TitleLabel.XAlign := 0.5;
+ TitleLabel.MarginStart := 5;
+ TitleLabel.MarginEnd := 5;
+ TitleLabel.MarginTop := 5;
+ TitleLabel.MarginBottom := 5;
+// TitleLabel.SetForegroundColor(ColorFG);
+// TitleLabelBox.SetBackgroundColor(ColorBG);
DruidArea.AddControlEx(TitleLabelBox, False, False, 0);
PageAreaColor := TGTKEventBox.Create(Self);
- PageAreaColor.SetBackgroundColor(ColorGray);
+// PageAreaColor.SetBackgroundColor(ColorGray);
PageArea := TGTKVBox.Create(Self);
PageAreaColor.AddControl(PageArea);
DruidArea.AddControlEx(PageAreaColor, True, True, 0);
@@ -147,8 +153,8 @@ end;
procedure TFChecksumDruid.FormKeyDown(Sender: TObject; Key: Word; Shift: TShiftState; var Accept: boolean);
begin
-// if Key = GDK_ESCAPE then ModalResult := mbCancel;
- if (Key = GDK_RETURN) or (Key = GDK_KP_ENTER) then ForwardButtonClick(Sender);
+// if Key = GDK_KEY_Escape then ModalResult := mbCancel;
+ if (Key = GDK_KEY_Return) or (Key = GDK_KEY_KP_Enter) then ForwardButtonClick(Sender);
end;
procedure TFChecksumDruid.CreatePages;
@@ -156,20 +162,21 @@ begin
Page1 := TGTKHBox.Create(Self);
Page1.Homogeneous := False;
LeftSpacer := TGTKEventBox.Create(Self);
- LeftSpacer.SetBackgroundColor(ColorBG);
+// LeftSpacer.SetBackgroundColor(ColorBG);
LeftSpacer.SetSizeRequest(100, -1);
Page1Label := TGTKLabel.Create(Self);
Page1Label.LineWrap := True;
- Page1Label.SetAlignment(0.5, 0.5);
+ Page1Label.XAlign := 0.5;
+ Page1Label.YAlign := 0.5;
Page1Label.Caption := LANGCCHKSUMPage1Text;
Page1.AddControlEx(LeftSpacer, False, False, 0);
Page1.AddControlEx(Page1Label, True, True, 0);
Page2 := TGTKEventBox.Create(Self);
- Page2.SetBackgroundColor(0, 0, 0);
+// Page2.SetBackgroundColor(0, 0, 0);
Page2Color := TGTKEventBox.Create(Self);
Page2Color.BorderWidth := 1;
- Page2Color.SetBackgroundColor(ColorGray);
+// Page2Color.SetBackgroundColor(ColorGray);
Page2.AddControl(Page2Color);
Page2ClientArea := TGTKVBox.Create(Self);
Page2Color.AddControl(Page2ClientArea);
@@ -184,10 +191,10 @@ begin
Page2ClientArea.BorderWidth := 30;
Page3 := TGTKEventBox.Create(Self);
- Page3.SetBackgroundColor(0, 0, 0);
+// Page3.SetBackgroundColor(0, 0, 0);
Page3Color := TGTKEventBox.Create(Self);
Page3Color.BorderWidth := 1;
- Page3Color.SetBackgroundColor(ColorGray);
+// Page3Color.SetBackgroundColor(ColorGray);
Page3.AddControl(Page3Color);
Page3ClientArea := TGTKVBox.Create(Self);
Page3Color.AddControl(Page3ClientArea);
@@ -214,30 +221,33 @@ begin
Page3ClientArea.AddControlEx(SeparateFileCheckHBox, False, False, 5);
Page4 := TGTKEventBox.Create(Self);
- Page4.SetBackgroundColor(0, 0, 0);
+// Page4.SetBackgroundColor(0, 0, 0);
Page4Color := TGTKEventBox.Create(Self);
Page4Color.BorderWidth := 1;
- Page4Color.SetBackgroundColor(ColorGray);
+// Page4Color.SetBackgroundColor(ColorGray);
Page4.AddControl(Page4Color);
Page4Label := TGTKLabel.Create(Self);
Page4Label.LineWrap := True;
- Page4Label.SetAlignment(0.5, 0.5);
+ Page4Label.XAlign := 0.5;
+ Page4Label.YAlign := 0.5;
Page4Label.Caption := LANGCCHKSUMPage4Text;
Page4Color.AddControl(Page4Label);
Page5 := TGTKEventBox.Create(Self);
- Page5.SetBackgroundColor(0, 0, 0);
+// Page5.SetBackgroundColor(0, 0, 0);
Page5Color := TGTKEventBox.Create(Self);
Page5Color.BorderWidth := 1;
- Page5Color.SetBackgroundColor(ColorGray);
+// Page5Color.SetBackgroundColor(ColorGray);
Page5.AddControl(Page5Color);
Page5ClientArea := TGTKVBox.Create(Self);
Page5Color.AddControl(Page5ClientArea);
ProcessingLabel := TGTKLabel.Create(Self);
ProcessingLabel.Caption := Format(LANGCCHKSUMNowProcessingFileS, ['---']);
- ProcessingLabel.XPadding := 20;
+ ProcessingLabel.MarginStart := 20;
+ ProcessingLabel.MarginEnd := 20;
+ ProcessingLabel.MarginTop := 10;
+ ProcessingLabel.MarginBottom := 10;
ProcessingLabel.XAlign := 0;
- ProcessingLabel.YPadding := 10;
ProcessingLabel.SetSizeRequest(10, -1);
Page5ClientArea.AddControlEx(ProcessingLabel, False, False, 10);
ProgressHBox := TGTKHBox.Create(Self);
@@ -247,14 +257,14 @@ begin
Page5ClientArea.AddControlEx(TGTKLabel.Create(Self), True, True, 0);
Page6 := TGTKEventBox.Create(Self);
- Page6.SetBackgroundColor(0, 0, 0);
+// Page6.SetBackgroundColor(0, 0, 0);
Page6Color := TGTKEventBox.Create(Self);
Page6Color.BorderWidth := 1;
- Page6Color.SetBackgroundColor(ColorGray);
+// Page6Color.SetBackgroundColor(ColorGray);
Page6.AddControl(Page6Color);
Page6Label := TGTKLabel.Create(Self);
Page6Label.LineWrap := True;
- Page6Label.SetAlignment(0.5, 0.4);
+// Page6Label.SetAlignment(0.5, 0.4);
Page6Label.Caption := LANGCCHKSUMPage6Text;
Page6Label.UseMarkup := True;
Page6Label.XAlign := 0.05;
@@ -267,8 +277,12 @@ begin
Page6Color.AddControl(Page6ClientArea);
ErrorLabel := TGTKLabel.Create(Self);
ErrorLabel.Selectable := True;
- ErrorLabel.SetAlignment(0, 0);
- ErrorLabel.SetPadding(2, 2);
+ ErrorLabel.XAlign := 0;
+ ErrorLabel.YAlign := 0;
+ ErrorLabel.MarginStart := 2;
+ ErrorLabel.MarginEnd := 2;
+ ErrorLabel.MarginTop := 2;
+ ErrorLabel.MarginBottom := 2;
ErrorLabel.Alignment := taLeftJustify;
ErrorLabelScrolledWindow := TGTKScrolledWindow.Create(Self);
ErrorLabelScrolledWindow.HorizScrollBarPolicy := sbAutomatic;
@@ -281,11 +295,12 @@ begin
Page7 := TGTKHBox.Create(Self);
Page7.Homogeneous := False;
LeftSpacer7 := TGTKEventBox.Create(Self);
- LeftSpacer7.SetBackgroundColor(ColorBG);
+// LeftSpacer7.SetBackgroundColor(ColorBG);
LeftSpacer7.SetSizeRequest(100, -1);
Page7Label := TGTKLabel.Create(Self);
Page7Label.LineWrap := True;
- Page1Label.SetAlignment(0.5, 0.5);
+ Page7Label.XAlign := 0.5;
+ Page7Label.YAlign := 0.5;
Page7Label.Caption := LANGCCHKSUMPage7Text;
Page7.AddControlEx(LeftSpacer7, False, False, 0);
Page7.AddControlEx(Page7Label, True, True, 0);
@@ -348,10 +363,10 @@ begin
BackButton.Enabled := CurrentPage > 1;
ForwardButton.Enabled := CurrentPage < NumPages;
if CurrentPage < NumPages then begin
- if not ForwardButton.UseStock then ForwardButton.Caption := 'gtk-go-forward';
- ForwardButton.UseStock := True;
+ // FIXME: show the icon, if hidden
+ ForwardButton.Caption := 'Forward';
end else begin
- ForwardButton.UseStock := False;
+ // FIXME: hide the icon
ForwardButton.Caption := LANGCCHKSUMFinishCaption;
end;
// after page changed