MG: removed ClientRectBugfix defines

git-svn-id: trunk@1850 -
This commit is contained in:
lazarus 2002-08-17 15:45:36 +00:00
parent 0280402696
commit 6be96de0d3
13 changed files with 78 additions and 123 deletions

View File

@ -63,7 +63,6 @@ interface
uses
{$IFDEF SYN_LAZARUS}
{$DEFINE ClientRectBugFix}
LCLLinux,
LCLType, GraphType,
{$ELSE}
@ -85,12 +84,7 @@ const
ALPHA_LC = ['a'..'z'];
{$IFDEF SYN_LAZARUS}
{$IFDEF ClientRectBugFix}
ScrollBarWidth=0;
{$ELSE}
// workaround till clientwidth/height is working correctly with scrollbars
ScrollBarWidth=18;
{$ENDIF}
{$ENDIF}
{$IFNDEF SYN_COMPILER_3_UP}

View File

@ -43,7 +43,6 @@ uses
LCLLinux, LMessages, Controls, ComCtrls, ExtCtrls, PropEdits, TypInfo,
Messages, LResources, Laz_XMLCfg, Menus, Dialogs;
{$DEFINE ClientRectBugFix}
type
EObjectInspectorException = class(Exception);
@ -318,12 +317,7 @@ const
implementation
const
{$IFDEF ClientRectBugFix}
ScrollBarWidth=0;
{$ELSE}
// workaround till clientwidth/height is working correctly with scrollbars
ScrollBarWidth=19;
{$ENDIF}
{ TOIPropertyGrid }

View File

@ -34,7 +34,6 @@ unit ComCtrls;
{$mode objfpc}
{$H+}
{$DEFINE ClientRectBugFix}
interface
@ -1512,12 +1511,7 @@ const
ButtonStyles: array[TToolButtonStyle] of Word = (TBSTYLE_BUTTON, TBSTYLE_CHECK,
TBSTYLE_DROPDOWN, TBSTYLE_SEP, TBSTYLE_SEP);
{$IFDEF ClientRectBugFix}
ScrollBarWidth=0;
{$ELSE}
// workaround till clientwidth/height is working correctly with scrollbars
ScrollBarWidth=19;
{$ENDIF}
{ Toolbar menu support }
@ -1564,6 +1558,9 @@ end.
{ =============================================================================
$Log$
Revision 1.37 2002/08/17 15:45:31 lazarus
MG: removed ClientRectBugfix defines
Revision 1.36 2002/05/28 14:58:29 lazarus
MG: added scrollbars for TListView

View File

@ -35,7 +35,6 @@ interface
{$ASSERTIONS ON}
{$endif}
{$DEFINE ClientRectBugFix}
uses
Classes, Controls, VCLGlobals, SysUtils, GraphType, Graphics, Menus,
@ -127,12 +126,8 @@ type
procedure DoHide; dynamic;
procedure DoShow; dynamic;
procedure GetChildren(Proc: TGetChildProc; Root: TComponent); override;
{$IFDEF ClientRectBugFix}
// Delphi needed GetClientRect for window specific things, LCL not
// Function GetClientRect : TRect ; Override;
{$ELSE}
Function GetClientRect : TRect ; Override;
{$ENDIF}
Procedure Notification(AComponent: TComponent; Operation : TOperation);override;
procedure Paint; dynamic;
Procedure PaintWindow(dc : Hdc); override;

View File

@ -400,25 +400,6 @@ begin
end;
end;
{$IFDEF ClientRectBugFix}
{$ELSE}
{------------------------------------------------------------------------------
Method: TCustomForm.GetClientRect
Params: none
Returns: TRect
Calls user handler
------------------------------------------------------------------------------}
Function TCustomForm.GetClientRect :TRect;
Begin
SetRect(Result,0,0,0,0);
AdjustWindowRectEx(Result,GetWindowLong(Handle,GWL_STYLE),Menu <> nil
,GetWindowLong(Handle,GWL_EXSTYLE));
SetRect(Result,0,0, Width - Result.Right + Result.Left
, Height - Result.Bottom + Result.Top);
end;
{$ENDIF}
{------------------------------------------------------------------------------
Method: TCustomForm.Paint
Params: none
@ -1044,6 +1025,9 @@ end;
{ =============================================================================
$Log$
Revision 1.50 2002/08/17 15:45:32 lazarus
MG: removed ClientRectBugfix defines
Revision 1.49 2002/07/05 09:09:20 lazarus
MG: fixed TCustomForm.ShowModal reacting to ModalResult

View File

@ -13,19 +13,6 @@
* *
*****************************************************************************
}
{$IFDEF ClientRectBugFix}
{$ELSE}
{------------------------------------------------------------------------------}
{ function TCustomGroupBox.AdjustClientRect }
{------------------------------------------------------------------------------}
procedure TCustomGroupBox.AdjustClientRect(var Rect: TRect);
begin
if HandleAllocated then
LCLLinux.GetClientRect(Handle,Rect)
else
inherited;
end;
{$ENDIF}
{------------------------------------------------------------------------------}
{ function TCustomGroupBox.Create }
@ -41,6 +28,9 @@ end;
{
$Log$
Revision 1.7 2002/08/17 15:45:32 lazarus
MG: removed ClientRectBugfix defines
Revision 1.6 2002/05/10 06:05:51 lazarus
MG: changed license to LGPL

View File

@ -110,6 +110,7 @@ begin
// create as many TRadioButton as needed
while (FButtonList.Count<FItems.Count) do begin
Temp := TRadioButton.Create (self);
Temp.Name:='RadioButton'+IntToStr(FButtonList.Count);
Temp.Parent := Self;
Temp.OnClick := @Clicked;
FButtonList.Add(Temp);
@ -335,6 +336,9 @@ end;
{
$Log$
Revision 1.12 2002/08/17 15:45:32 lazarus
MG: removed ClientRectBugfix defines
Revision 1.11 2002/05/13 14:47:00 lazarus
MG: fixed client rectangles, TRadioGroup, RecreateWnd

View File

@ -409,12 +409,10 @@ begin
Result := InterfaceObject.GetWindowRect(Handle, Rect);
end;
{$IFDEF ClientRectBugFix}
Function GetWindowSize(Handle : hwnd; var Width, Height: integer): boolean;
begin
Result := InterfaceObject.GetWindowSize(Handle, Width, Height);
end;
{$ENDIF}
Function GetWindowOrgEx(dc : hdc; var P : TPoint): Integer;
begin
@ -1191,6 +1189,9 @@ end;
{ =============================================================================
$Log$
Revision 1.42 2002/08/17 15:45:32 lazarus
MG: removed ClientRectBugfix defines
Revision 1.41 2002/08/15 15:46:49 lazarus
MG: added changes from Andrew (Clipping)

View File

@ -118,9 +118,7 @@ function GetTextExtentPoint(DC: HDC; Str: PChar; Count: Integer; var Size: TSize
function GetTextMetrics(DC: HDC; var TM: TTextMetric): Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
function GetWindowLong(Handle : hwnd; int : Integer): Longint; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
function GetWindowRect(Handle : hwnd; var Rect : TRect): Integer; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
{$IFDEF ClientRectBugFix}
Function GetWindowSize(Handle : hwnd; var Width, Height: integer): boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
{$ENDIF}
function GetWindowOrgEx(dc : hdc; var P : TPoint): Integer; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
function HideCaret(hWnd: HWND): Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
@ -286,6 +284,9 @@ function UnionRect(var DestRect: TRect; const SrcRect1, SrcRect2: TRect): Boolea
{ =============================================================================
$Log$
Revision 1.36 2002/08/17 15:45:33 lazarus
MG: removed ClientRectBugfix defines
Revision 1.35 2002/08/15 15:46:49 lazarus
MG: added changes from Andrew (Clipping)

View File

@ -21,9 +21,20 @@
const
DblClickTime = 250;//250 miliseconds or less between clicks is a double click
type
TLastMouseClick = record
Down: boolean;
TheTime: TDateTime;
Component: TComponent;
end;
const
EmptyLastMouseClick: TLastMouseClick =
(Down: false; TheTime: -1; Component: nil);
var
LMouseButtonDown,MMouseButtonDown,RMouseButtonDown : Boolean; //used to track the mouse buttons
LLastClick, RLastClick, MLastClick : TDateTime;
LastLeft, LastMiddle, LastRight: TLastMouseClick;
LastFileSelectRow : gint;
@ -612,24 +623,22 @@ var
HiddenLCLObject: TObject;
{ $DEFINE VerboseMouseBugfix}
function CheckMouseButtonDown(var ButtonDown: boolean;
var LastClick: TDateTime;
function CheckMouseButtonDown(var LastMouse: TLastMouseClick;
BtnKey, MsgNormal, MsgDouble, MsgTriple: longint): boolean;
begin
if (ButtonDown) and
(not ((Event^.theType = gdk_2button_press)
or (Event^.theType = gdk_3button_press)))
if (LastMouse.Down) and
(not (Event^.theType in [gdk_2button_press,gdk_3button_press]))
then begin
Result:=false;
Exit;
end;
MessI.Keys := MessI.Keys or BtnKey;
if ((now - LLastClick) <= ((1/86400)*(DblClickTime/1000)))
if ((now - LastMouse.TheTime) <= ((1/86400)*(DblClickTime/1000)))
and (not (Event^.theType = gdk_3button_press))
then
Event^.theType := gdk_2Button_press;
LLastClick := Now;
LastMouse.TheTime := Now;
if event^.thetype = gdk_button_press then
MessI.Msg := MsgNormal
@ -637,16 +646,17 @@ var
if event^.thetype = gdk_2button_press then
begin
MessI.Msg := MsgDouble;
LLastClick := -1;
LastMouse.TheTime := -1;
end
else
if event^.thetype = gdk_3button_press then
begin
MessI.Msg := MsgTriple;
LLastClick := -1;
LastMouse.TheTime := -1;
end;
ButtonDown := True;
LastMouse.Down := True;
LastMouse.Component:=TComponent(Data);
Result:=true;
end;
@ -727,15 +737,15 @@ begin
MessI.Keys := 0;
case event^.Button of
1: if not CheckMouseButtonDown(LMouseButtonDown, LLastClick,
1: if not CheckMouseButtonDown(LastLeft,
MK_LBUTTON, LM_LBUTTONDOWN, LM_LBUTTONDBLCLK, LM_LBUTTONTRIPLECLK)
then exit;
2: if not CheckMouseButtonDown(MMouseButtonDown, MLastClick,
2: if not CheckMouseButtonDown(LastMiddle,
MK_MBUTTON, LM_MBUTTONDOWN, LM_MBUTTONDBLCLK, LM_MBUTTONTRIPLECLK)
then exit;
3: if not CheckMouseButtonDown(RMouseButtonDown, RLastClick,
3: if not CheckMouseButtonDown(LastRight,
MK_RBUTTON, LM_RBUTTONDOWN, LM_RBUTTONDBLCLK, LM_RBUTTONTRIPLECLK)
then exit;
@ -796,13 +806,28 @@ var
ShiftState: TShiftState;
MappedXY: TPoint;
HiddenLCLObject: TObject;
function CheckMouseButtonUp(var LastMouse: TLastMouseClick;
MsgUp: integer): boolean;
begin
if not (LastMouse.Down) then
Result:=false
else
begin
MessI.Msg := MsgUp;
LastMouse.Down := False;
Result:=true;
end;
LastMouse.Component:=nil;
end;
begin
Result:=true;
{$IFDEF VerboseMouseBugfix}
writeln('[gtkMouseBtnRelease] A ',
TControl(Data).Name,':',TObject(Data).ClassName,' ',
Trunc(Event^.X),',',Trunc(Event^.Y));
Trunc(Event^.X),',',Trunc(Event^.Y),' Btn=',event^.Button);
{$ENDIF}
//writeln('EEE1 MouseRelease Widget=',HexStr(Cardinal(Widget),8),
@ -818,12 +843,6 @@ begin
end;
end;
{$IFDEF VerboseMouseBugfix}
writeln('[gtkMouseBtnRelease] ',
TControl(Data).Name,':',TObject(Data).ClassName,' ',
Trunc(Event^.X),',',Trunc(Event^.Y));
{$ENDIF}
if csDesigning in TControl(Data).ComponentState then begin
// stop the signal, so that the widget does not auto react
if TControl(Data).FCompStyle<>csNotebook then
@ -838,31 +857,13 @@ begin
case event^.Button of
1:
if not(LMouseButtonDown) then
Exit
else
begin
MessI.Msg := LM_LBUTTONUP;
LMouseButtonDown := False;
end;
if not CheckMouseButtonUp(LastLeft,LM_LBUTTONUP) then Exit;
2:
if not(MMouseButtonDown) then
Exit
else
begin
MessI.Msg := LM_MBUTTONUP;
MMouseButtonDown := False;
end;
if not CheckMouseButtonUp(LastMiddle,LM_MBUTTONUP) then Exit;
3:
if not(RMouseButtonDown) then
Exit
else
begin
MessI.Msg := LM_RBUTTONUP;
RMouseButtonDown := False;
end;
if not CheckMouseButtonUp(LastRight,LM_RBUTTONUP) then Exit;
else
begin
@ -2142,6 +2143,9 @@ end;
{ =============================================================================
$Log$
Revision 1.99 2002/08/17 15:45:33 lazarus
MG: removed ClientRectBugfix defines
Revision 1.98 2002/08/17 07:57:05 lazarus
MG: added TPopupMenu.OnPopup and SourceEditor PopupMenu checks

View File

@ -2430,7 +2430,6 @@ begin
ClientWidget := GetFixedWidget(Widget);
if (ClientWidget <> nil) then
Widget := ClientWidget;
{$IFDEF ClientRectBugFix}
if (Widget <> nil) then begin
ARect.Right:=Widget^.Allocation.Width;
ARect.Bottom:=Widget^.Allocation.Height;
@ -2438,14 +2437,6 @@ begin
ARect.Right:=0;
ARect.Bottom:=0;
end;
{$ELSE}
if (Widget <> nil) and (Widget^.Window<>nil) then begin
gdk_window_get_size(Widget^.Window, @ARect.Right, @ARect.Bottom);
end else begin
ARect.Bottom:=0;
ARect.Right:=0;
end;
{$ENDIF}
{$IFDEF VerboseGetClientRect}
if ClientWidget<>nil then begin
writeln('GetClientRect Widget=',HexStr(Cardinal(handle),8),
@ -3418,7 +3409,6 @@ begin
end;
end;
{$IFDEF ClientRectBugFix}
{------------------------------------------------------------------------------
Function: GetWindowSize
Params: Handle : hwnd;
@ -3436,7 +3426,6 @@ begin
end else
Result:=false;
end;
{$ENDIF}
{------------------------------------------------------------------------------
Function: HideCaret
@ -5336,7 +5325,7 @@ var
end;
function ScaleBuffer(ScaleGC:PGDKGC) : Boolean;
{$Ifdef enable_gdkpixbuf}
{$Ifndef NoGdkPixbufLib}
var
ScaleSrc, ScaleDest : PGDKPixbuf;
ShrinkWidth,
@ -5374,7 +5363,7 @@ var
gdk_pixbuf_render_pixmap_and_mask(ScaleDest,@Scale^.GDIPixmapObject, nil,0);
GDK_Pixbuf_Unref(ScaleDest);
Result := True;
{$Else}
{$Else not NoGdkPixbufLib}
begin
WriteLn('WARNING: [TgtkObject.StretchBlt] GDKPixbuf support has been disabled, no stretching is available!');
Result := True;
@ -5791,6 +5780,9 @@ end;
{ =============================================================================
$Log$
Revision 1.94 2002/08/17 15:45:34 lazarus
MG: removed ClientRectBugfix defines
Revision 1.93 2002/08/15 15:46:50 lazarus
MG: added changes from Andrew (Clipping)

View File

@ -97,9 +97,7 @@ function GetTextMetrics(DC: HDC; var TM: TTextMetric): Boolean; override;
Function GetWindowLong(Handle : hwnd; int: Integer): Longint; override;
Function GetWindowOrgEx(dc : hdc; var P: TPoint): Integer; override;
Function GetWindowRect(Handle : hwnd; var ARect: TRect): Integer; override;
{$IFDEF ClientRectBugFix}
Function GetWindowSize(Handle : hwnd; var Width, Height: integer): boolean; override;
{$ENDIF}
function HideCaret(hWnd: HWND): Boolean; override;
@ -172,6 +170,9 @@ Function WindowFromPoint(Point : TPoint) : HWND; override;
{ =============================================================================
$Log$
Revision 1.40 2002/08/17 15:45:36 lazarus
MG: removed ClientRectBugfix defines
Revision 1.39 2002/08/15 15:46:50 lazarus
MG: added changes from Andrew (Clipping)

View File

@ -35,7 +35,6 @@ unit StdCtrls;
interface
{$DEFINE ClientRectBugFix}
uses
VCLGlobals, Classes, SysUtils, Graphics, GraphType, LMessages, Controls,
@ -122,10 +121,6 @@ type
TCustomGroupBox = class (TWinControl) {class(TCustomControl) }
protected
{$IFDEF ClientRectBugFix}
{$ELSE}
procedure AdjustClientRect(var Rect: TRect); override;
{$ENDIF}
public
constructor Create(AOwner : TComponent); Override;
end;
@ -594,6 +589,9 @@ end.
{ =============================================================================
$Log$
Revision 1.32 2002/08/17 15:45:32 lazarus
MG: removed ClientRectBugfix defines
Revision 1.31 2002/07/23 07:40:51 lazarus
MG: fixed get widget position for inherited gdkwindows