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; frmPageSetup: TframePageSetup;
PanelButtons: TPanel; PanelButtons: TPanel;
procedure btnPrinterClick(Sender: TObject); procedure btnPrinterClick(Sender: TObject);
procedure FormClose(Sender: TObject; var CloseAction: TCloseAction); procedure FormClose(Sender: TObject; var {%H-}CloseAction: TCloseAction);
procedure FormCreate(Sender: TObject); procedure FormCreate(Sender: TObject);
procedure FormShow(Sender: TObject); procedure FormShow(Sender: TObject);
private private

View File

@ -73,7 +73,7 @@ type
procedure FormActivate(Sender: TObject); procedure FormActivate(Sender: TObject);
procedure FormDestroy(Sender: TObject); procedure FormDestroy(Sender: TObject);
procedure rbPortraitClick(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 dlgpropertiesprinterCreate(Sender: TObject);
procedure dlgpropertiesprinterShow(Sender: TObject); procedure dlgpropertiesprinterShow(Sender: TObject);
private private

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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