lcl: gtk3: less hints

git-svn-id: trunk@65103 -
This commit is contained in:
mattias 2021-05-10 14:38:34 +00:00
parent 5e8a217e0d
commit 8a28cfb7aa
13 changed files with 60 additions and 62 deletions

View File

@ -29,7 +29,7 @@ type
frmPageSetup: TframePageSetup;
PanelButtons: TPanel;
procedure btnPrinterClick(Sender: TObject);
procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
procedure FormClose(Sender: TObject; var {%H-}CloseAction: TCloseAction);
procedure FormCreate(Sender: TObject);
procedure FormShow(Sender: TObject);
private

View File

@ -73,7 +73,7 @@ type
procedure FormActivate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure rbPortraitClick(Sender: TObject);
procedure cbPaperSizeKeypress(Sender: TObject; var Key: Char);
procedure cbPaperSizeKeypress(Sender: TObject; var {%H-}Key: Char);
procedure dlgpropertiesprinterCreate(Sender: TObject);
procedure dlgpropertiesprinterShow(Sender: TObject);
private

View File

@ -98,16 +98,16 @@ type
procedure btnPropCLICK(Sender: TObject);
procedure btnReducCLICK(Sender: TObject);
procedure cbPrintersCHANGE(Sender: TObject);
procedure cbPrintersDrawItem(Control: TWinControl; Index: Integer;
procedure cbPrintersDrawItem({%H-}Control: TWinControl; Index: Integer;
ARect: TRect; State: TOwnerDrawState);
procedure cbPrintersKEYPRESS(Sender: TObject; var Key: Char);
procedure cbPrintersKEYPRESS(Sender: TObject; var {%H-}Key: Char);
procedure cbReverseCLICK(Sender: TObject);
procedure cbTasktimeCHANGE(Sender: TObject);
procedure dlgSelectPrinterCREATE(Sender: TObject);
procedure dlgSelectPrinterSHOW(Sender: TObject);
procedure edCopiesChange(Sender: TObject);
procedure edRangeEnter(Sender: TObject);
procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
procedure FormClose(Sender: TObject; var {%H-}CloseAction: TCloseAction);
procedure FormDestroy(Sender: TObject);
procedure tkbPriorityCHANGE(Sender: TObject);
private

View File

@ -26,7 +26,7 @@ uses
{$ENDIF}
SysUtils, Classes, types, Math, FPImage,
// LazUtils
LazUtilities, LazLoggerBase, LazTracer, LazUTF8, IntegerList, GraphType,
LazLoggerBase, LazTracer, LazUTF8, IntegerList, GraphType, LazUtilities,
// LCL
LCLPlatformDef, InterfaceBase, LCLProc, LCLType, LMessages, LCLMessageGlue,
Controls, Forms, Graphics, GraphUtil, IntfGraphics,

View File

@ -199,7 +199,7 @@ var
ImageFormat: cairo_format_t;
ARowStride: PtrUInt;
x,y:integer;
src,dst,pdst,psrc,SrcRowPtr,DstRowPtr:pbyte;
src,dst,SrcRowPtr,DstRowPtr:pbyte;
ridx,gidx,bidx,aidx:byte;
begin
Result := False;
@ -420,7 +420,7 @@ function TGtk3WidgetSet.RawImage_DescriptionFromDevice(ADC: HDC; out
begin
Result := true;
FillStandardDescription(ADesc);
FillStandardDescription(ADesc{%H-});
(*
if IsValidDC(ADC)
then begin
@ -525,7 +525,7 @@ function RawImage_DescriptionFromDrawable(out
var
Visual: PGdkVisual;
Image: PGdkPixbuf;
Width, Height, Depth: integer;
Width, Height: integer;
IsBitmap: Boolean;
AMask: guint32;
AShift: gint;
@ -1193,8 +1193,8 @@ function TGtk3WidgetSet.AddEventHandler(AHandle: THandle; AFlags: dword;
//lEventHandler: PWaitHandleEventHandler;
begin
Result := nil;
(*
if AEventHandler = nil then exit;
(*
New(lEventHandler);
giochannel := g_io_channel_unix_new(AHandle);
lEventHandler^.Handle := AHandle;
@ -1310,8 +1310,8 @@ function TGtk3WidgetSet.AddProcessEventHandler(AHandle: THandle;
// lHandler: PChildSignalEventHandler;
begin
Result := nil;
(*
if AEventHandler = nil then exit(nil);
(*
New(lHandler);
lHandler^.PID := TPid(AHandle);
lHandler^.UserData := AData;
@ -1329,8 +1329,8 @@ procedure TGtk3WidgetSet.RemoveProcessEventHandler(var AHandler: PProcessEventHa
// var
// lHandler: PChildSignalEventHandler absolute AHandler;
begin
(*
if AHandler = nil then exit;
(*
if lHandler^.PrevHandler = nil then
FChildSignalHandlers := lHandler^.NextHandler
else

View File

@ -20,7 +20,7 @@ begin
end;
{hook into gtk3 main event loop, used for testing purposes only atm.}
procedure Gtk3MainEventLoop(AEvent: PGdkEvent; AData: gPointer); cdecl;
procedure Gtk3MainEventLoop(AEvent: PGdkEvent; {%H-}AData: gPointer); cdecl;
var
AList: PGList;
APt: TPoint;
@ -33,7 +33,6 @@ var
x2: Double;
y2: Double;
ARegion: Pcairo_region_t;
ARect: Tcairo_rectangle_int_t;
begin
{$IFDEF GTK3DEBUGCORE}
DebugLn('** TGtk3WidgetSet.Gtk3MainEventLoop **');
@ -70,7 +69,7 @@ begin
' window ',dbgHex(PtrUInt(AEvent^.expose.window)),
' extents ',Format('x %d y %d x2 %d y2 %d',[ARect.x, ARect.y, ARect.width, ARect.height]));
(* do not use this otherwise painting is corrupted !!!! testing purposes only
{ do not use this otherwise painting is corrupted !!!! testing purposes only
AContext := gdk_cairo_create(AEvent^.expose.window);
cairo_clip_extents(AContext, @x, @y, @x2, @y2);
DebugLn('Gtk3MainEventLoop*** EXPOSED ',dbgsName(TGtk3Widget(AWidget).LCLObject),
@ -79,7 +78,7 @@ begin
cairo_surface_flush(cairo_get_target(AContext));
cairo_surface_mark_dirty(cairo_get_target(AContext));
cairo_destroy(AContext);
*)
}
end;
end;
*)
@ -97,7 +96,7 @@ begin
AGtkThread := g_thread_self();
if not IsLibrary then
begin
AId := 'org.lcl.thread_' + dbgHex(PtrUInt(AGtkThread));
AId := 'org.lcl.thread_' + dbgHex({%H-}PtrUInt(AGtkThread));
FGtk3Application := TGtkApplication.new(PgChar(AId), G_APPLICATION_NON_UNIQUE);
// FGtk3Application^.set_application_id(PgChar(AId));
FGtk3Application^.register(nil, nil);
@ -120,7 +119,7 @@ procedure TGtk3WidgetSet.SetDefaultAppFontName;
var
AValue: TGValue;
begin
FillByte(AValue, SizeOf(AValue), 0);
FillByte(AValue{%H-}, SizeOf(AValue), 0);
AValue.init(G_TYPE_STRING);
g_object_get_property(gtk_settings_get_default, 'gtk-font-name', @AValue);
FDefaultAppFontName := AValue.get_string;
@ -185,8 +184,6 @@ begin
end;
procedure TGtk3WidgetSet.AddWindow(AWindow: PGtkWindow);
var
AList: PGList;
begin
if Assigned(FGtk3Application) then
FGtk3Application^.add_window(AWindow);
@ -319,7 +316,7 @@ begin
{$ENDIF}
CharSetEncodingList := TList.Create;
CreateDefaultCharsetEncodings;
FillByte(AValue, SizeOf(AValue), 0);
FillByte(AValue{%H-}, SizeOf(AValue), 0);
AValue.init(G_TYPE_BOOLEAN);
AValue.set_boolean(True);
g_object_set_property(gtk_settings_get_default,'gtk-button-images',@AValue);
@ -407,7 +404,7 @@ var
AValue: TGValue;
begin
ASettings := gtk_settings_get_default;
FillByte(AValue, SizeOf(AValue), 0);
FillByte(AValue{%H-}, SizeOf(AValue), 0);
AValue.init(G_TYPE_STRING);
ASettings^.get_property('gtk-theme-name', @AValue);
FThemeName := AValue.get_string;
@ -739,7 +736,7 @@ var
LogBrush: TLogBrush;
logPen : TLogPen;
begin
FillChar(LogBrush,SizeOf(TLogBrush),0);
FillChar(LogBrush{%H-},SizeOf(TLogBrush),0);
LogBrush.lbStyle := BS_NULL;
FStockNullBrush := CreateBrushIndirect(LogBrush);
TGtk3Brush(FStockNullBrush).Shared := True;

View File

@ -140,8 +140,8 @@ type
FHandle: Pcairo_region_t;
public
property Handle: Pcairo_region_t read FHandle write FHandle;
constructor Create(CreateHandle: Boolean); virtual; overload;
constructor Create(CreateHandle: Boolean; X1,Y1,X2,Y2: Integer); virtual; overload;
constructor Create({%H-}CreateHandle: Boolean); virtual; overload;
constructor Create({%H-}CreateHandle: Boolean; X1,Y1,X2,Y2: Integer); virtual; overload;
constructor Create(X1,Y1,X2,Y2,nW,nH: Integer); virtual; overload;
constructor CreateEllipse(X1,Y1,X2,Y2: Integer); virtual; overload;
function Select(ACtx:TGtk3DeviceContext):TGtk3ContextObject;override;

View File

@ -116,7 +116,7 @@ type
procedure InitializeWidget; virtual;
procedure DeInitializeWidget;
procedure RecreateWidget;
procedure DestroyNotify(AWidget: PGtkWidget); virtual;
procedure DestroyNotify({%H-}AWidget: PGtkWidget); virtual;
destructor Destroy; override;
function CanFocus: Boolean; virtual;
@ -4894,7 +4894,7 @@ begin
InitializeWidget;
end;
procedure Gtk3MenuItemActivated(AItem: PGtkMenuItem; AData: GPointer); cdecl;
procedure Gtk3MenuItemActivated({%H-}AItem: PGtkMenuItem; AData: GPointer); cdecl;
var
Msg: TLMessage;
begin
@ -4903,7 +4903,7 @@ begin
begin
inc(TGtk3MenuItem(AData).Lock);
try
FillChar(Msg, SizeOf(Msg), #0);
FillChar(Msg{%H-}, SizeOf(Msg), #0);
Msg.Msg := LM_ACTIVATE;
TGtk3MenuItem(AData).MenuItem.Dispatch(Msg);
finally
@ -5275,7 +5275,7 @@ end;
{ TGtk3ListBox }
procedure Gtk3ListBoxSelectionChanged(ASelection: PGtkTreeSelection; AData: GPointer); cdecl;
procedure Gtk3ListBoxSelectionChanged({%H-}ASelection: PGtkTreeSelection; AData: GPointer); cdecl;
var
Msg: TLMessage;
begin
@ -5729,8 +5729,8 @@ begin
if not Assigned(TGtk3ListView(AData).FPreselectedIndices) then
TGtk3ListView(AData).FPreselectedIndices := TFPList.Create;
if TGtk3ListView(AData).FPreselectedIndices.IndexOf(Pointer(PtrInt(gtk_tree_path_get_indices(path)^))) = -1 then
TGtk3ListView(AData).FPreselectedIndices.Add(Pointer(PtrInt(gtk_tree_path_get_indices(path)^)));
if TGtk3ListView(AData).FPreselectedIndices.IndexOf({%H-}Pointer(PtrInt(gtk_tree_path_get_indices(path)^))) = -1 then
TGtk3ListView(AData).FPreselectedIndices.Add({%H-}Pointer(PtrInt(gtk_tree_path_get_indices(path)^)));
end;
procedure Gtk3WS_ListViewItemSelected(ASelection: PGtkTreeSelection; AData: GPointer); cdecl;
@ -5758,7 +5758,7 @@ begin
FillChar(NM{%H-}, SizeOf(NM), 0);
NM.hdr.hwndfrom := HWND(TGtk3Widget(AData));
NM.hdr.code := LVN_ITEMCHANGED;
NM.iItem := PtrInt(TGtk3ListView(AData).FPreselectedIndices.Items[i]);
NM.iItem := {%H-}PtrInt(TGtk3ListView(AData).FPreselectedIndices.Items[i]);
NM.iSubItem := 0;
B := False;
for j := 0 to g_list_length(AList) - 1 do
@ -5767,7 +5767,7 @@ begin
if Path <> nil then
begin
Indices := gtk_tree_path_get_indices(Path)^;
B := Indices = PtrInt(TGtk3ListView(AData).FPreselectedIndices.Items[i]);
B := Indices = {%H-}PtrInt(TGtk3ListView(AData).FPreselectedIndices.Items[i]);
if B then
break;
end;
@ -6527,7 +6527,7 @@ begin
AComboWidget := PGtkComboBox(GetContainerWidget);
APrivate := PGtkComboBoxPrivate(AComboWidget^.priv3);
DebugLn('** COMBO DUMP OF PGtkComboBoxPrivate struct EVENT=',ADbgEvent);
DebugLn('BUTTON=',dbgHex(PtrUInt(APrivate^.button)),' ARROW=',dbgHex(PtrUInt(APrivate^.arrow)),
DebugLn('BUTTON=',dbgHex({%H-}PtrUInt(APrivate^.button)),' ARROW=',dbgHex({%H-}PtrUInt(APrivate^.arrow)),
' SCROLLEDWINDOW=',dbgHex({%H-}PtrUInt(APrivate^.scrolled_window)),
' CELLVIEW=',dbgHex({%H-}PtrUInt(APrivate^.cell_view)),
' CELLAREA=',dbgHex({%H-}PtrUInt(APrivate^.area)));

View File

@ -159,7 +159,6 @@ function TGtk3WidgetSet.ClipboardGetOwnerShip(ClipboardType: TClipboardType;
Formats: PClipboardFormat): boolean;
var
pclp:PGtkClipboard;
pc:pgchar;
pcname:PgdkAtom;
begin
case ClipboardType of
@ -180,7 +179,7 @@ end;
function TGtk3WidgetSet.ClipboardRegisterFormat(const AMimeType: string): TClipboardFormat;
begin
if Assigned(Application) then
Result := TClipboardFormat(TGdkAtom.intern(PChar(AMimeType), False))
Result := {%H-}TClipboardFormat(TGdkAtom.intern(PChar(AMimeType), False))
else
RaiseGDBException(
'ERROR: TGtk3WidgetSet.ClipboardRegisterFormat gdk not initialized');
@ -310,7 +309,6 @@ end;
function TGtk3WidgetSet.CreateBrushIndirect(const LogBrush: TLogBrush): HBRUSH;
var
ABrush: TGtk3Brush;
Color: TColor;
begin
Result := 0;
// DebugLn('TGtk3WidgetSet.CreateBrushIndirect color=',dbgs(logBrush.lbColor),' style=',dbgs(logBrush.lbStyle));
@ -412,10 +410,6 @@ begin
end;
function TGtk3WidgetSet.CreateIconIndirect(IconInfo: PIconInfo): HICON;
var
PixBuf: PGdkPixBuf;
W: gint;
H: gint;
begin
Result := 0;
if IsValidGDIObject(IconInfo^.hbmColor) then
@ -658,13 +652,13 @@ var
procedure DoCalcRect;
var
AP: TSize;
J, MaxWidth, DefHeight,
J, MaxWidth,
LineWidth, LineHeight: Integer;
begin
theRect := Rect;
MaxWidth := theRect.Right - theRect.Left;
DefHeight := theRect.Bottom - theRect.Top;
//DefHeight := theRect.Bottom - theRect.Top;
(*
if Flags and DT_CENTER <> 0then
@ -728,7 +722,7 @@ var
// do not break at word boundaries
TextExtentPoint(PChar(AStr), length(AStr), AP);
MaxWidth := AP.cX;
DefHeight := AP.cY;
//DefHeight := AP.cY;
end;
Gtk3WordWrap(DC, PChar(AStr), MaxWidth, Lines, NumLines);
@ -949,7 +943,7 @@ begin
Exit;
end;
SetLength(AStr,Count);
SetLength(AStr{%H-},Count);
if Count>0 then
System.Move(Str^,AStr[1],Count);
@ -1012,6 +1006,7 @@ begin
l:=StrLen(Lines[i]);
DrawLine(Lines[i], l, theRect.Top);
dec(pIndex,l+length(LineEnding));
Size:=default(TSize);
GetTextExtentPoint(DC, Lines[i], l, Size);
LineHeight := Size.cY;
end
@ -1355,7 +1350,6 @@ end;
function TGtk3WidgetSet.IntersectClipRect(dc: hdc; Left, Top, Right,Bottom: Integer): Integer;
var
ncorg,dcOrigin:TPoint;
rgn,clip:HRGN;
begin
{$IFDEF GTK3DEBUGNOTIMPLEMENTED}
@ -1373,6 +1367,7 @@ begin
{ ncorg:=Tgtk3DeviceContext(dc).fncOrigin;
GetWindowOrgEx(DC, @DCOrigin);
Result:=inherited IntersectClipRect(dc, Left, Top, Right, Bottom);}
Result:=0;
end;
@ -1684,7 +1679,7 @@ begin
begin
AData := g_object_get_data(AWidget, 'lclwidget');
// DebugLn('TGtk3WidgetSet.GetActiveWindow found window from data ...',dbgsName(TGtk3Widget(AData).LCLObject));
exit(HWND(AData));
exit({%H-}HWND(AData));
end;
for i := 0 to Screen.FormCount - 1 do
begin
@ -1921,11 +1916,11 @@ begin
end;
HORZSIZE : { Horizontal size in millimeters }
Result := RoundToInt((GetDeviceCaps(DC, HORZRES) * 100) /
Result := LazUtilities.RoundToInt((GetDeviceCaps(DC, HORZRES) * 100) /
(GetDeviceCaps(DC, LOGPIXELSX) * 25.4));
VERTSIZE : { Vertical size in millimeters }
Result := RoundToInt((GetDeviceCaps(DC, VERTRES) * 100) /
Result := LazUtilities.RoundToInt((GetDeviceCaps(DC, VERTRES) * 100) /
(GetDeviceCaps(DC, LOGPIXELSY) * 25.4));
BITSPIXEL:
@ -1939,12 +1934,12 @@ begin
SIZEPALETTE: Result := gdk_window_get_visual(gdk_get_default_root_window)^.get_colormap_size;
LOGPIXELSX : { Logical pixels per inch in X }
begin
Result := RoundToInt(gdk_screen_width / (gdk_screen_width_mm / 25.4));
Result := LazUtilities.RoundToInt(gdk_screen_width / (gdk_screen_width_mm / 25.4));
end;
LOGPIXELSY : { Logical pixels per inch in Y }
begin
Result := RoundToInt(gdk_screen_height / (gdk_screen_height_mm / 25.4));
Result := LazUtilities.RoundToInt(gdk_screen_height / (gdk_screen_height_mm / 25.4));
end;
end;
@ -2013,6 +2008,7 @@ begin
dpiY:=round(25.4*h/h_mm);
rr:=TGdkScreen.get_default^.get_resolution();
Result:=0;
//Result:=inherited GetDpiForMonitor(hmonitor, dpiType, dpiX, dpiY);
end;
@ -2612,7 +2608,6 @@ var
APangoMetrics: PPangoFontMetrics;
aRect: TPangoRectangle;
APangoWeight: TPangoWeight;
AList: PPangoAttrList;
begin
Result := False;
if IsValidDC(DC) then
@ -2772,10 +2767,14 @@ var
AWidget: TGtk3Widget;
APos: TPoint;
begin
Left:=0;
Top:=0;
if Handle = 0 then
exit(False);
AWidget := TGtk3Widget(Handle);
Result := AWidget.GetPosition(APos);
Left:=APos.X;
Top:=APos.Y;
end;
function TGtk3WidgetSet.GetWindowSize(Handle: hwnd; var Width, Height: integer
@ -3041,7 +3040,7 @@ begin
AMsg := TCustomGtk3Message(user_data^);
if AMsg.Handle <> 0 then
begin
FillChar(AMessage, SizeOf(AMessage), #0);
FillChar(AMessage{%H-}, SizeOf(AMessage), #0);
AMessage.Msg := AMsg.Msg;
AMessage.WParam := AMsg.AwParam;
AMessage.LParam := AMsg.AlParam;

View File

@ -25,7 +25,7 @@ uses
LazGtk3, LazGlib2, LazGdk3, LazGObject2, LazPango1,
// RTL, FCL and LCL
SysUtils, Classes, Graphics, Controls, Dialogs, ExtDlgs, LCLType,
LazFileUtils, LCLStrConsts, LCLProc, InterfaceBase,
LazFileUtils, LCLStrConsts, LCLProc,
// Widgetset
gtk3int, gtk3widgets,
WSDialogs;
@ -542,8 +542,8 @@ end;
This function is called, whenever a row is selected in a commondialog
-------------------------------------------------------------------------------}
function gtkDialogSelectRowCB(widget: PGtkWidget; Row, Column: gInt;
bevent: pgdkEventButton; data: gPointer): GBoolean; cdecl;
function gtkDialogSelectRowCB({%H-}widget: PGtkWidget; {%H-}Row, {%H-}Column: gInt;
{%H-}bevent: pgdkEventButton; {%H-}data: gPointer): GBoolean; cdecl;
(*
var
theDialog: TCommonDialog;
@ -786,7 +786,7 @@ begin
Files.Add(CurFilename);
end;
// inc(FileList);
// inc(rowNum);
inc(rowNum);
end;
// Dec(FileList, rowNum);
g_slist_free(FileList);
@ -1370,6 +1370,8 @@ begin
Button1 := GTK_STOCK_OPEN;
end;
if Button1<>'' then ;
if Action=0 then ;
Result := THandle(TGtk3FileDialog.Create(ACommonDialog));
// AFileDialog := PGtkFileChooserDialog(ADialog.Widget);
@ -1521,7 +1523,7 @@ begin
if not ACommonDialog.HandleAllocated then
exit;
AGtkWindow := TGtk3Dialog(ACommonDialog.Handle).Widget;
DebugLn('TGtk3WSCommonDialog.ShowModal widget ',dbgHex(PtrUInt(AGtkWindow)));
DebugLn('TGtk3WSCommonDialog.ShowModal widget ',dbgHex({%H-}PtrUInt(AGtkWindow)));
if not Gtk3IsWidget(AGtkWindow) then
raise Exception.Create('TGtk3WSCommonDialog.ShowModal error');
// ReleaseMouseCapture;

View File

@ -29,7 +29,7 @@ uses
// ExtDlgs,
////////////////////////////////////////////////////
Controls, LCLType,
gtk3int, gtk3widgets,
gtk3widgets,
WSExtDlgs, WSLCLClasses;
type

View File

@ -21,8 +21,8 @@ unit Gtk3WSMenus;
interface
uses
Classes, InterfaceBase, Types, LCLProc, LCLType,
LazGObject2, LazGlib2, LazGdk3, LazGtk3, gtk3int, gtk3procs,
Classes, Types, LCLProc, LCLType,
LazGObject2, LazGlib2, LazGdk3, LazGtk3, gtk3procs,
WSLCLClasses, WSMenus,
LMessages, Graphics, Menus, Forms, LCLIntf;

View File

@ -120,7 +120,7 @@ end;"/>
</BuildMacros>
<Other>
<CompilerMessages>
<IgnoredMessages idx5044="True"/>
<IgnoredMessages idx5044="True" idx5025="True"/>
</CompilerMessages>
<CustomOptions Value="$(IDEBuildOptions)"/>
</Other>