diff options
| author | Tomas Bzatek <tbzatek@redhat.com> | 2024-12-23 23:59:45 +0100 |
|---|---|---|
| committer | Tomas Bzatek <tbzatek@redhat.com> | 2025-11-27 19:36:10 +0100 |
| commit | b9703b29819b619037cc282d719c187e51bacd30 (patch) | |
| tree | bd6d73e5fb6bcb6eb307844103b3dff185f2ac9a /UPreferences.pas | |
| parent | a9634b933f71a9045e61d29c486f2d51d39fd1e2 (diff) | |
| download | tuxcmd-b9703b29819b619037cc282d719c187e51bacd30.tar.xz | |
Port to g-i generated glib2 bindings
Includes switch to FPC -Mobjfpc and related pointer style fixes.
Diffstat (limited to 'UPreferences.pas')
| -rw-r--r-- | UPreferences.pas | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/UPreferences.pas b/UPreferences.pas index c65e3db..008ecf5 100644 --- a/UPreferences.pas +++ b/UPreferences.pas @@ -22,9 +22,9 @@ unit UPreferences; interface uses - glib2, gtk2, pango, SysUtils, Types, Classes, Variants, GTKControls, GTKForms, GTKStdCtrls, GTKExtCtrls, GTKConsts, GTKView, + gtk2, pango, SysUtils, Classes, GTKControls, GTKForms, GTKStdCtrls, GTKExtCtrls, GTKUtils, GTKDialogs, GTKPixbuf, GTKClasses, GTKMenus, ULibc, - UCoreClasses, UGnome; + UGnome; type TFPreferences = class(TGTKDialog) @@ -106,7 +106,7 @@ var implementation -uses ULocale, UFileAssoc, UCoreUtils, UConfig; +uses ULocale, UCoreUtils, UConfig; procedure TFPreferences.FormCreate(Sender: TObject); @@ -203,7 +203,7 @@ begin RowHeightLabel.FocusControl := RowHeightSpinEdit; RowHeightLabel.UseUnderline := True; DefaultRowHeightCheckBox := TGTKCheckButton.CreateWithLabel(Self, LANGPreferences_Default); - DefaultRowHeightCheckBox.OnToggled := DefaultRowHeightCheckBoxToggled; + DefaultRowHeightCheckBox.OnToggled := @DefaultRowHeightCheckBoxToggled; Table2.AddControlEx(1, 5, 1, 1, RowHeightLabel, [taoShrink, taoFill], [taoShrink, taoExpand, taoFill], 0, 2); Table2.AddControlEx(2, 5, 1, 1, RowHeightSpinEdit, [taoFill, taoExpand], [taoShrink, taoExpand, taoFill], 10, 2); Table2.AddControlEx(3, 5, 1, 1, DefaultRowHeightCheckBox, [taoFill, taoExpand], [taoShrink, taoExpand, taoFill], 10, 2); @@ -273,14 +273,14 @@ begin Item := TGTKMenuItem.CreateTyped(Self, itLabel); Item.Caption := LANGPreferences_Custom; DateFormatOptionMenu.Items.Add(Item); - DateFormatOptionMenu.OnChanged := DateTimeFormatOptionMenuChanged; + DateFormatOptionMenu.OnChanged := @DateTimeFormatOptionMenuChanged; Table2.AddControlEx(1, 9, 1, 1, DateFormatLabel, [taoShrink, taoFill], [taoShrink, taoExpand, taoFill], 0, 2); Table2.AddControlEx(2, 9, 2, 1, DateFormatOptionMenu, [taoShrink, taoFill], [taoShrink, taoExpand, taoFill], 10, 2); CustomDateFormatEntry := TGTKEntry.Create(Self); CustomDateFormatEntry.Enabled := False; CustomDateFormatEntry.Tooltip := LANGPreferences_CustomDateFormatEntry_Tooltip; - CustomDateFormatEntry.OnChanged := DateTimeFormatOptionMenuChanged; + CustomDateFormatEntry.OnChanged := @DateTimeFormatOptionMenuChanged; Table2.AddControlEx(2, 10, 2, 1, CustomDateFormatEntry, [taoShrink], [taoShrink], 10, 2); TimeFormatLabel := TGTKLabel.Create(Self); @@ -300,14 +300,14 @@ begin Item := TGTKMenuItem.CreateTyped(Self, itLabel); Item.Caption := LANGPreferences_Custom; TimeFormatOptionMenu.Items.Add(Item); - TimeFormatOptionMenu.OnChanged := DateTimeFormatOptionMenuChanged; + TimeFormatOptionMenu.OnChanged := @DateTimeFormatOptionMenuChanged; Table2.AddControlEx(1, 11, 1, 1, TimeFormatLabel, [taoShrink, taoFill], [taoShrink, taoExpand, taoFill], 0, 2); Table2.AddControlEx(2, 11, 2, 1, TimeFormatOptionMenu, [taoShrink, taoFill], [taoShrink, taoExpand, taoFill], 10, 2); CustomTimeFormatEntry := TGTKEntry.Create(Self); CustomTimeFormatEntry.Enabled := False; CustomTimeFormatEntry.Tooltip := LANGPreferences_CustomTimeFormatEntry_Tooltip; - CustomTimeFormatEntry.OnChanged := DateTimeFormatOptionMenuChanged; + CustomTimeFormatEntry.OnChanged := @DateTimeFormatOptionMenuChanged; Table2.AddControlEx(2, 12, 2, 1, CustomTimeFormatEntry, [taoShrink], [taoShrink], 10, 2); DateTimeFormatLabel := TGTKLabel.Create(Self); @@ -436,14 +436,14 @@ begin ViewerCombo.Items.Append(ConfViewersApps[i]); ViewerBrowseButton := TGTKButton.Create(Self); ViewerBrowseButton.Caption := Format(' %s ', [LANGBrowseButton_Caption]); - ViewerBrowseButton.OnClick := ViewerBrowseButtonClick; + ViewerBrowseButton.OnClick := @ViewerBrowseButtonClick; ViewerLabel2 := TGTKLabel.Create(Self); ViewerLabel2.Caption := LANGPreferencesCommandSC; ViewerLabel2.XAlign := 0; ViewerLabel2.FocusControl := ViewerCombo.Entry; ViewerLabel2.UseUnderline := True; UseInternalViewerCheckBox := TGTKCheckButton.CreateWithLabel(Self, LANGPreferencesUseInternalViewer); - UseInternalViewerCheckBox.OnToggled := UseInternalViewerCheckBoxToggled; + UseInternalViewerCheckBox.OnToggled := @UseInternalViewerCheckBoxToggled; ViewerOptionMenu := TGTKOptionMenu.Create(Self); miViewerTerminalDetect := TGTKMenuItem.CreateTyped(Self, itLabel); miViewerTerminalDetect.Caption := LANGPreferencesAutodetectXApp; @@ -476,7 +476,7 @@ begin EditorCombo.Items.Append(ConfEditorApps[i]); EditorBrowseButton := TGTKButton.Create(Self); EditorBrowseButton.Caption := Format(' %s ', [LANGBrowseButton_Caption]); - EditorBrowseButton.OnClick := ViewerBrowseButtonClick; + EditorBrowseButton.OnClick := @ViewerBrowseButtonClick; EditorLabel2 := TGTKLabel.Create(Self); EditorLabel2.Caption := LANGPreferencesCommandSC; EditorLabel2.XAlign := 0; @@ -513,7 +513,7 @@ begin TerminalCombo.Items.Append(ConfTerminalApps[i]); TerminalBrowseButton := TGTKButton.Create(Self); TerminalBrowseButton.Caption := Format(' %s ', [LANGBrowseButton_Caption]); - TerminalBrowseButton.OnClick := ViewerBrowseButtonClick; + TerminalBrowseButton.OnClick := @ViewerBrowseButtonClick; TerminalLabel2 := TGTKLabel.Create(Self); TerminalLabel2.Caption := LANGPreferencesCommandSC; TerminalLabel2.XAlign := 0; @@ -569,9 +569,9 @@ begin ListFontFrame.AddControl(ListFontPreview); ChangeFontButton := TGTKButton.Create(Self); ChangeFontButton.Caption := LANGPreferences_Change; - ChangeFontButton.OnClick := ChangeFontButtonClick; + ChangeFontButton.OnClick := @ChangeFontButtonClick; DefaultFontCheckBox := TGTKCheckButton.CreateWithLabel(Self, LANGPreferences_UseDefaultFont); - DefaultFontCheckBox.OnToggled := DefaultFontCheckBoxToggled; + DefaultFontCheckBox.OnToggled := @DefaultFontCheckBoxToggled; Table3.AddControlEx(0, 0, 1, 1, TGTKVBox.Create(Self), [taoShrink], [taoShrink, taoExpand, taoFill], 12, 2); Table3.AddControlEx(1, 0, 1, 1, ListFontLabel, [taoShrink, taoFill], [taoShrink, taoExpand, taoFill], 5, 2); @@ -609,7 +609,7 @@ begin NormalItemBGColorButton.SetSizeRequest(30, -1); NormalItemFGColorDefault := TGTKCheckButton.CreateWithLabel(Self, LANGPreferences_Default); NormalItemFGColorDefault.Tooltip := LANGPreferences_SetToDefaultToUseGTKThemeColors; - NormalItemFGColorDefault.OnToggled := ColorButtonDefaultsToggled; + NormalItemFGColorDefault.OnToggled := @ColorButtonDefaultsToggled; Table4.AddControl(0, 1, 1, 1, NormalItemFGColorLabel, 30, 2); Table4.AddControl(2, 1, 1, 1, NormalItemFGColorButton, 5, 2); Table4.AddControl(5, 1, 1, 1, NormalItemBGColorButton, 5, 2); @@ -622,7 +622,7 @@ begin ActiveItemBGColorButton := TGnomeColorButton.Create(Self); ActiveItemFGColorDefault := TGTKCheckButton.CreateWithLabel(Self, LANGPreferences_Default); ActiveItemFGColorDefault.Tooltip := LANGPreferences_SetToDefaultToUseGTKThemeColors; - ActiveItemFGColorDefault.OnToggled := ColorButtonDefaultsToggled; + ActiveItemFGColorDefault.OnToggled := @ColorButtonDefaultsToggled; Table4.AddControl(0, 2, 1, 1, ActiveItemFGColorLabel, 30, 2); Table4.AddControl(2, 2, 1, 1, ActiveItemFGColorButton, 5, 2); Table4.AddControl(5, 2, 1, 1, ActiveItemBGColorButton, 5, 2); @@ -635,7 +635,7 @@ begin InactiveItemBGColorButton := TGnomeColorButton.Create(Self); InactiveItemFGColorDefault := TGTKCheckButton.CreateWithLabel(Self, LANGPreferences_Default); InactiveItemFGColorDefault.Tooltip := LANGPreferences_SetToDefaultToUseGTKThemeColors; - InactiveItemFGColorDefault.OnToggled := ColorButtonDefaultsToggled; + InactiveItemFGColorDefault.OnToggled := @ColorButtonDefaultsToggled; Table4.AddControl(0, 3, 1, 1, InactiveItemFGColorLabel, 30, 2); Table4.AddControl(2, 3, 1, 1, InactiveItemFGColorButton, 5, 2); Table4.AddControl(5, 3, 1, 1, InactiveItemBGColorButton, 5, 2); @@ -654,7 +654,7 @@ begin LinkItemFGColorButton := TGnomeColorButton.Create(Self); LinkItemFGColorDefault := TGTKCheckButton.CreateWithLabel(Self, LANGPreferences_Default); LinkItemFGColorDefault.Tooltip := LANGPreferences_LinkItemHint; - LinkItemFGColorDefault.OnToggled := ColorButtonDefaultsToggled; + LinkItemFGColorDefault.OnToggled := @ColorButtonDefaultsToggled; Table4.AddControl(0, 5, 1, 1, LinkItemFGColorLabel, 30, 2); Table4.AddControl(2, 5, 1, 1, LinkItemFGColorButton, 5, 2); Table4.AddControl(7, 5, 1, 1, LinkItemFGColorDefault, 10, 2); @@ -665,7 +665,7 @@ begin DotFileItemFGColorButton := TGnomeColorButton.Create(Self); DotFileItemFGColorDefault := TGTKCheckButton.CreateWithLabel(Self, LANGPreferences_Default); DotFileItemFGColorDefault.Tooltip := LANGPreferences_DotFileItemHint; - DotFileItemFGColorDefault.OnToggled := ColorButtonDefaultsToggled; + DotFileItemFGColorDefault.OnToggled := @ColorButtonDefaultsToggled; Table4.AddControl(0, 6, 1, 1, DotFileItemFGColorLabel, 30, 2); Table4.AddControl(2, 6, 1, 1, DotFileItemFGColorButton, 5, 2); Table4.AddControl(7, 6, 1, 1, DotFileItemFGColorDefault, 10, 2); @@ -718,8 +718,8 @@ begin // ****************** - OnKeyDown := FormKeyDown; - OnDestroy := FormDestroy; + OnKeyDown := @FormKeyDown; + OnDestroy := @FormDestroy; end; procedure TFPreferences.FormKeyDown(Sender: TObject; Key: Word; Shift: TShiftState; var Accept: boolean); @@ -782,7 +782,7 @@ begin gtk_widget_modify_font(ListFontPreview.FWidget, nil); ListFontPreview.Caption := Format(LANGPreferences_DefaultS, [DefaultGTKFont]); end else begin - FontDesc := pango_font_description_from_string(StringToPgchar(LocalListFont)); + FontDesc := pango_font_description_from_string(PChar(LocalListFont)); gtk_widget_modify_font(ListFontPreview.FWidget, FontDesc); ListFontPreview.Caption := LocalListFont; end; @@ -799,7 +799,7 @@ procedure TFPreferences.ChangeFontButtonClick(Sender: TObject); Dialog.FontName := ToControl.Caption; if Byte(Dialog.Run) = 251 then begin ToControl.Caption := Dialog.FontName; - FontDesc := pango_font_description_from_string(StringToPgchar(Dialog.FontName)); + FontDesc := pango_font_description_from_string(PChar(Dialog.FontName)); gtk_widget_modify_font(ToControl.FWidget, FontDesc); // g_object_unref(FontDesc); // *** - cannot unref, causes SIGSEGV LocalListFont := Dialog.FontName; |
