diff --git a/lcl/asyncprocess.pp b/lcl/asyncprocess.pp index a82f29bd1c..b6ae76346b 100644 --- a/lcl/asyncprocess.pp +++ b/lcl/asyncprocess.pp @@ -25,6 +25,12 @@ unit AsyncProcess; {$mode objfpc}{$H+} +// FPC <= 2.0.2 compatibility code +// WINDOWS define was added after FPC 2.0.2 +{$ifdef win32} + {$define WINDOWS} +{$endif} + interface uses @@ -54,17 +60,22 @@ type implementation -{$ifdef WIN32} +{$ifdef WINDOWS} uses Windows; function TAsyncProcess.GetNumBytesAvailable: dword; begin +{$ifdef wince} + // Windows CE doesn´t have the API function PeekNamedPipe + Result := 0; +{$else} if not (poUsePipes in Options) then Result := 0 else if not PeekNamedPipe(Output.Handle, nil, 0, nil, @Result, nil) then Result := 0; +{$endif} end; {$else} diff --git a/lcl/calendar.pp b/lcl/calendar.pp index a798c63888..fda1ae2e79 100644 --- a/lcl/calendar.pp +++ b/lcl/calendar.pp @@ -30,6 +30,12 @@ unit Calendar; {$mode objfpc}{$H+} +// FPC <= 2.0.2 compatibility code +// WINDOWS define was added after FPC 2.0.2 +{$ifdef win32} + {$define WINDOWS} +{$endif} + interface uses @@ -222,13 +228,13 @@ begin end; procedure TCustomCalendar.SetDateTime(const AValue: TDateTime); -{$IFDEF WIN32} +{$IFDEF WINDOWS} var CalendarMinDate,CalendarMaxDate: integer; {$ENDIF} begin if AValue=FDate then exit; - {$IFDEF WIN32} // TODO: move this test to the win32 interface? + {$IFDEF WINDOWS} // TODO: move this test to the win32 interface? CalendarMinDate:=-53787;// 14 sep 1752, start of Gregorian calendar in England CalendarMaxDate:=trunc(MaxDateTime); if not ((AValue>=CalendarMinDate)and(AValue<=CalendarMaxDate)) then diff --git a/lcl/dbgrids.pas b/lcl/dbgrids.pas index 8f2a7dd4bd..9dcfb11745 100644 --- a/lcl/dbgrids.pas +++ b/lcl/dbgrids.pas @@ -34,6 +34,13 @@ unit DBGrids; {$mode objfpc}{$H+} {$define EnableIsSeq} + +// FPC <= 2.0.2 compatibility code +// WINDOWS define was added after FPC 2.0.2 +{$ifdef win32} + {$define WINDOWS} +{$endif} + interface uses @@ -1267,7 +1274,7 @@ begin //ScrollBarPosition(SB_VERT, aPos); FillChar(ScrollInfo, SizeOf(ScrollInfo), 0); ScrollInfo.cbSize := SizeOf(ScrollInfo); - {$ifdef WIN32} + {$ifdef WINDOWS} ScrollInfo.fMask := SIF_ALL or SIF_DISABLENOSCROLL; ScrollInfo.ntrackPos := 0; {$else} diff --git a/lcl/defaulttranslator.pas b/lcl/defaulttranslator.pas index 752d359002..f946f28d9b 100644 --- a/lcl/defaulttranslator.pas +++ b/lcl/defaulttranslator.pas @@ -32,11 +32,17 @@ localization found. } {$mode objfpc}{$H+} +// FPC <= 2.0.2 compatibility code +// WINDOWS define was added after FPC 2.0.2 +{$ifdef win32} + {$define WINDOWS} +{$endif} + interface uses Classes, SysUtils, LResources, GetText, Controls, typinfo - {$IFDEF MSWINDOWS},Windows{$ENDIF}; + {$IFDEF WINDOWS},Windows{$ENDIF}; {$IFDEF TRANSLATESTRING} type TDefaultTranslator=class(TAbstractTranslator) @@ -54,7 +60,7 @@ uses Menus; function FindLocaleFileName:string; var LANG,lng:string; i: Integer; - {$IFDEF Win32} + {$IFDEF WINDOWS} Buffer:array[1..4]of char; {$ENDIF} begin @@ -66,7 +72,7 @@ begin (paramstr(i)='-l') or (paramstr(i)='--lang') then LANG:=ParamStr(i+1); end; - {$IFDEF Win32} + {$IFDEF WINDOWS} //Modified code from lazconf.inc if LANG='' then begin diff --git a/lcl/dirsel.pas b/lcl/dirsel.pas index 0b9ac93d03..2e56a3df04 100644 --- a/lcl/dirsel.pas +++ b/lcl/dirsel.pas @@ -24,6 +24,12 @@ unit DirSel; {$mode objfpc}{$H+} +// FPC <= 2.0.2 compatibility code +// WINDOWS define was added after FPC 2.0.2 +{$ifdef win32} + {$define WINDOWS} +{$endif} + interface uses @@ -70,7 +76,7 @@ var implementation const - {$IFDEF Win32} + {$IFDEF WINDOWS} FindMask = '*.*'; {$ELSE} FindMask = '*'; diff --git a/lcl/fileutil.pas b/lcl/fileutil.pas index af72b0ec7e..4a1d56287b 100644 --- a/lcl/fileutil.pas +++ b/lcl/fileutil.pas @@ -23,6 +23,12 @@ unit FileUtil; {$mode objfpc}{$H+} +// FPC <= 2.0.2 compatibility code +// WINDOWS define was added after FPC 2.0.2 +{$ifdef win32} + {$define WINDOWS} +{$endif} + interface uses diff --git a/lcl/grids.pas b/lcl/grids.pas index 390d9bbb46..17daaf74dc 100644 --- a/lcl/grids.pas +++ b/lcl/grids.pas @@ -35,6 +35,13 @@ The log was moved to end of file, search for: The_Log {$define UseClipRect} {$define LooseCount} + +// FPC <= 2.0.2 compatibility code +// WINDOWS define was added after FPC 2.0.2 +{$ifdef win32} + {$define WINDOWS} +{$endif} + unit Grids; {$mode objfpc}{$H+} @@ -1565,7 +1572,7 @@ end; function TCustomGrid.InternalNeedBorder: boolean; begin - {$IFDEF WIN32} + {$IFDEF WINDOWS} result := FFlat and (FGridBorderStyle = bsSingle); {$ELSE} result := FGridBorderStyle = bsSingle; @@ -2184,7 +2191,7 @@ function TCustomGrid.ScrollBarIsVisible(Which: Integer): Boolean; begin Result:=false; if HandleAllocated then begin - {$IFNDEF WIN32} + {$IFNDEF WINDOWS} Result:= getScrollbarVisible(handle, Which); {$ELSE} // Is up to the widgetset to implement GetScrollbarvisible @@ -3450,7 +3457,7 @@ end; function TCustomGrid.GetSystemMetricsGapSize(const Index: Integer): Integer; begin - {$ifdef Win32} + {$ifdef WINDOWS} result := 0; {$else} result := 3; @@ -5245,7 +5252,7 @@ begin end; procedure TCustomGrid.EditorShowChar(Ch: Char); -{$ifndef win32} +{$ifndef WINDOWS} var msg: TGridMessage; {$endif} @@ -5255,7 +5262,7 @@ begin //DebugLn('Posting editor LM_CHAR, ch=',ch, ' ', InttoStr(Ord(ch))); if EditorCanProcessKey(ch) and not EditorIsReadOnly then begin EditorShow(true); - {$ifdef WIN32} + {$ifdef WINDOWS} // lcl win32 interface does a big mess with the message // as we only need the message to be handled by destination // then we send it directly to it bypassing the queue. diff --git a/lcl/include/customnotebook.inc b/lcl/include/customnotebook.inc index 1cd283b1f3..f2d66b5ed1 100644 --- a/lcl/include/customnotebook.inc +++ b/lcl/include/customnotebook.inc @@ -450,7 +450,7 @@ begin if PageIndex = -1 then FPageIndex := Index; - {$ifndef WIN32} + {$ifndef WINDOWS} // TODO: remove when gtk widgetset fixed to show tabpage tab upon // AddPage, instead of needing TabPage.Visible := true APage.Visible := true; diff --git a/lcl/interfaces/wince/winceint.pp b/lcl/interfaces/wince/winceint.pp index 55d2119680..7c3d71cdb3 100644 --- a/lcl/interfaces/wince/winceint.pp +++ b/lcl/interfaces/wince/winceint.pp @@ -43,7 +43,7 @@ Interface Uses Types, Classes, ComCtrls, Controls, Buttons, Dialogs, ExtCtrls, Forms, GraphMath, GraphType, InterfaceBase, LCLIntf, LCLType, - LMessages, StdCtrls, SysUtils, Graphics, Menus; + LMessages, StdCtrls, SysUtils, Graphics, Menus, Windows; Type { WinCE interface-object class } @@ -96,7 +96,7 @@ Uses // WinCEWSCheckLst, // WinCEWSCListBox, // WinCEWSComCtrls, - WinCEWSControls, +// WinCEWSControls, // WinCEWSDbCtrls, // WinCEWSDBGrids, // WinCEWSDialogs, @@ -105,7 +105,7 @@ Uses // WinCEWSExtCtrls, // WinCEWSExtDlgs, // WinCEWSFileCtrl, - WinCEWSForms, +// WinCEWSForms, // WinCEWSGrids, // WinCEWSImgList, // WinCEWSMaskEdit, diff --git a/lcl/interfaces/wince/wincelclintf.inc b/lcl/interfaces/wince/wincelclintf.inc index 1c6f84a760..40244d2500 100644 --- a/lcl/interfaces/wince/wincelclintf.inc +++ b/lcl/interfaces/wince/wincelclintf.inc @@ -33,7 +33,7 @@ ******************************************************************************} //##apiwiz##sps## // Do not remove -function TWinCEWidgetSet.DrawSplitter(DC: HDC; const ARect: TRect; +{function TWinCEWidgetSet.DrawSplitter(DC: HDC; const ARect: TRect; Horizontal: boolean): boolean; begin Result:=inherited DrawSplitter(DC, ARect, Horizontal); @@ -88,6 +88,6 @@ function TWinCEWidgetSet.ReplaceBitmapMask(var Image, Mask: HBitmap; begin Result:=inherited ReplaceBitmapMask(Image, Mask, NewMask); end; - +} //##apiwiz##epi## // Do not remove diff --git a/lcl/interfaces/wince/wincelclintfh.inc b/lcl/interfaces/wince/wincelclintfh.inc index 07e8299687..12b3c4031c 100644 --- a/lcl/interfaces/wince/wincelclintfh.inc +++ b/lcl/interfaces/wince/wincelclintfh.inc @@ -27,7 +27,7 @@ } //##apiwiz##sps## // Do not remove -function DrawSplitter(DC: HDC; const ARect: TRect; Horizontal: boolean): boolean; override; +{function DrawSplitter(DC: HDC; const ARect: TRect; Horizontal: boolean): boolean; override; function ExtUTF8Out(DC: HDC; X, Y: Integer; Options: Longint; Rect: PRect; Str: PChar; Count: Longint; Dx: PInteger): Boolean; override; @@ -43,6 +43,6 @@ function GetListBoxItemRect(ListBox: TComponent; Index: integer; var ARect: TRec function IntfSendsUTF8KeyPress: boolean; override; function ReplaceBitmapMask(var Image, Mask: HBitmap; NewMask: HBitmap): boolean; override; - +} //##apiwiz##eps## // Do not remove, no wizard declaration after this line diff --git a/lcl/interfaces/wince/winceobject.inc b/lcl/interfaces/wince/winceobject.inc index f27a7c6054..8557b7cf8d 100644 --- a/lcl/interfaces/wince/winceobject.inc +++ b/lcl/interfaces/wince/winceobject.inc @@ -26,13 +26,22 @@ { TWinCEWidgetSet } +{------------------------------------------------------------------------------ + Method: TWinCEWidgetSet.Create + Params: None + Returns: Nothing + + Constructor for the class. + ------------------------------------------------------------------------------} constructor TWinCEWidgetSet.Create; begin + Inherited Create; end; destructor TWinCEWidgetSet.Destroy; begin + inherited Destroy; end; @@ -73,9 +82,24 @@ begin end; -procedure TWinCEWidgetSet.AppProcessMessages; -begin +{------------------------------------------------------------------------------ + Method: TWinCEWidgetSet.AppProcessMessages + Params: None + Returns: Nothing + Handle all pending messages + ------------------------------------------------------------------------------} +procedure TWinCEWidgetSet.AppProcessMessages; +var + AMessage: TMsg; + AccelTable: HACCEL; + retVal, index: dword; +Begin + while Windows.PeekMessage(AMessage, HWnd(Nil), 0, 0,PM_REMOVE) do + begin + Windows.TranslateMessage(@AMessage); + Windows.DispatchMessage(@AMessage); + end; end; procedure TWinCEWidgetSet.AppWaitMessage; diff --git a/lcl/interfaces/wince/wincewinapi.inc b/lcl/interfaces/wince/wincewinapi.inc index d936613674..6fbc1d00e6 100644 --- a/lcl/interfaces/wince/wincewinapi.inc +++ b/lcl/interfaces/wince/wincewinapi.inc @@ -33,7 +33,7 @@ ******************************************************************************} //##apiwiz##sps## // Do not remove -function TWinCEWidgetSet.Arc(DC: HDC; Left, Top, width, height, angle1, +{function TWinCEWidgetSet.Arc(DC: HDC; Left, Top, width, height, angle1, angle2: Integer): Boolean; begin Result:=inherited Arc(DC, Left, Top, width, height, angle1, angle2); @@ -934,6 +934,6 @@ end; function TWinCEWidgetSet.WindowFromPoint(Point: TPoint): HWND; begin Result:=inherited WindowFromPoint(Point); -end; +end;} //##apiwiz##epi## // Do not remove diff --git a/lcl/interfaces/wince/wincewinapih.inc b/lcl/interfaces/wince/wincewinapih.inc index 1f6cc9caae..8df1437380 100644 --- a/lcl/interfaces/wince/wincewinapih.inc +++ b/lcl/interfaces/wince/wincewinapih.inc @@ -37,7 +37,7 @@ ******************************************************************************} //##apiwiz##sps## // Do not remove -function Arc(DC: HDC; Left,Top,width,height,angle1,angle2 : Integer): Boolean; override; +{function Arc(DC: HDC; Left,Top,width,height,angle1,angle2 : Integer): Boolean; override; function AngleChord(DC: HDC; x,y,width,height,angle1,angle2 : Integer): Boolean; override; function BeginPaint(Handle: hWnd; Var PS : TPaintStruct) : hdc; override; @@ -222,7 +222,7 @@ Function TextOut(DC: HDC; X,Y : Integer; Str : Pchar; Count: Integer) : Boolean; function VkKeyScan(AChar: Char): Short; override; Function WindowFromPoint(Point : TPoint) : HWND; override; - +} //##apiwiz##eps## // Do not remove, no wizard declaration after this line diff --git a/lcl/lclintf.pas b/lcl/lclintf.pas index d5d45e84d7..326a3254a7 100644 --- a/lcl/lclintf.pas +++ b/lcl/lclintf.pas @@ -39,6 +39,12 @@ unit LCLIntf; {$mode objfpc}{$H+} {$inline on} +// FPC <= 2.0.2 compatibility code +// WINDOWS define was added after FPC 2.0.2 +{$ifdef win32} + {$define WINDOWS} +{$endif} + interface uses @@ -68,8 +74,14 @@ function CharUpper(c: char): char; inline; function MsgKeyDataToShiftState(KeyData: Longint): TShiftState; -{$IFDEF win32} -function GetTickCount: DWord; stdcall; external 'kernel32.dll' name 'GetTickCount'; +{$IFDEF WINDOWS} + +{$IFDEF Win32} +function GetTickCount:DWORD; stdcall; external 'kernel32.dll' name 'GetTickCount'; +{$ELSE} +function GetTickCount:DWORD; stdcall; external KernelDLL name 'GetTickCount'; +{$ENDIF} + {$ELSE} function GetTickCount: DWord; {$ENDIF} @@ -87,7 +99,7 @@ var LowerCaseChars: array[char] of char; UpperCaseChars: array[char] of char; -{$IFNDEF Win32} +{$IFNDEF WINDOWS} function GetTickCount: DWord; begin Result := DWord(Trunc(Now * 24 * 60 * 60 * 1000)); diff --git a/lcl/lclproc.pas b/lcl/lclproc.pas index 195f8ee400..a41b9e32a2 100644 --- a/lcl/lclproc.pas +++ b/lcl/lclproc.pas @@ -27,6 +27,12 @@ unit LCLProc; {$mode objfpc}{$H+} {$inline on} +// FPC <= 2.0.2 compatibility code +// WINDOWS define was added after FPC 2.0.2 +{$ifdef win32} + {$define WINDOWS} +{$endif} + interface uses @@ -2129,7 +2135,7 @@ begin // fpc 2.1.1 stores string constants as array of char so maybe this // will work for without ifdef (once available in 2.0.x too): // move(lineending, dest^, sizeof(LineEnding)); -{$IFDEF win32} +{$IFDEF WINDOWS} begin move(lineending[1], dest^, length(LineEnding)); inc(dest^, length(LineEnding)-1); diff --git a/lcl/lcltype.pp b/lcl/lcltype.pp index 4fafcba607..e835e0bf9d 100644 --- a/lcl/lcltype.pp +++ b/lcl/lcltype.pp @@ -38,6 +38,12 @@ unit LCLType; {$mode objfpc}{$H+} +// FPC <= 2.0.2 compatibility code +// WINDOWS define was added after FPC 2.0.2 +{$ifdef win32} + {$define WINDOWS} +{$endif} + interface @@ -49,9 +55,9 @@ uses {$IFDEF USE_UTF8BIDI_LCL} UTF8BIDI, {$ENDIF USE_UTF8BIDI_LCL} -{$ifdef win32} +{$ifdef WINDOWS} windows, -{$endif win32} +{$endif WINDOWS} Classes, SysUtils; type @@ -76,7 +82,7 @@ type TRTLCriticalSection = pointer; -{$ifndef win32} +{$ifndef WINDOWS} {$IFDEF CPU64} // temp solution for 32bit system.Thandle THandle = type PtrInt; @@ -1461,7 +1467,7 @@ const SYS_COLOR_BASE = TColorRef($80000000); -{$ifndef win32} +{$ifndef WINDOWS} R2_BLACK = 0; R2_COPYPEN = 1; R2_MASKNOTPEN = 2; diff --git a/lcl/lmessages.pp b/lcl/lmessages.pp index c4745a7c22..38a99f0077 100644 --- a/lcl/lmessages.pp +++ b/lcl/lmessages.pp @@ -27,12 +27,18 @@ unit LMessages; {$mode objfpc}{$H+} +// FPC <= 2.0.2 compatibility code +// WINDOWS define was added after FPC 2.0.2 +{$ifdef win32} + {$define WINDOWS} +{$endif} + interface uses Classes, SysUtils, LCLType, GraphType - {$ifdef win32} + {$ifdef WINDOWS} ,messages - {$endif win32} + {$endif WINDOWS} ; const @@ -369,7 +375,7 @@ type Result: LRESULT; end; -{$ifndef win32} +{$ifndef WINDOWS} TLMNoParams = record Msg: Cardinal; Unused: array[0..1] of PtrInt; diff --git a/lcl/translations.pas b/lcl/translations.pas index 2e844533a1..38ce3ef43c 100644 --- a/lcl/translations.pas +++ b/lcl/translations.pas @@ -41,6 +41,12 @@ unit Translations; {$mode objfpc}{$H+}{$INLINE ON} +// FPC <= 2.0.2 compatibility code +// WINDOWS define was added after FPC 2.0.2 +{$ifdef win32} + {$define WINDOWS} +{$endif} + interface uses @@ -91,7 +97,7 @@ implementation // GetLanguageIDs is part of the fcl in 2.0.1 and later {$ifdef ver2_0_0} -{$ifdef win32} +{$ifdef WINDOWS} uses windows; procedure GetLanguageIDs(var Lang, FallbackLang: string);