From ac1ade3e6c4c01e6e1137ab1514899e05169538e Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Fri, 10 Apr 2015 11:35:59 +0100 Subject: WinCE: fixes compilation errors for WinCE-ARM * Disabled OLE support for WinCE * Disabled Drag-n-Drop support for WinCE * Fixed PChar vs PWidechar types * Fixed IFDEF's. Differences between MSWINDOWS, WINDOWS and WINCE. --- src/corelib/fpg_base.pas | 2 +- src/corelib/fpg_imgfmt_png.pas | 6 +++--- src/corelib/gdi/fpg_gdi.pas | 37 ++++++++++++++++++++++++++++++++----- src/corelib/gdi/fpgui_toolkit.lpk | 2 ++ src/corelib/gdi/fpgui_toolkit.pas | 26 +++++++++++++------------- src/gui/fpg_dialogs.pas | 4 ++-- src/gui/fpg_iniutils.pas | 4 ++-- 7 files changed, 55 insertions(+), 26 deletions(-) (limited to 'src') diff --git a/src/corelib/fpg_base.pas b/src/corelib/fpg_base.pas index c110f3b0..9177e420 100644 --- a/src/corelib/fpg_base.pas +++ b/src/corelib/fpg_base.pas @@ -123,7 +123,7 @@ const var - {$IFDEF MSWINDOWS} + {$IFDEF WINDOWS} FPG_DEFAULT_FONT_DESC: string = 'Arial-8:antialias=true'; FPG_DEFAULT_SANS: string = 'Arial'; {$ENDIF} diff --git a/src/corelib/fpg_imgfmt_png.pas b/src/corelib/fpg_imgfmt_png.pas index 3148a5b4..c4ee504f 100644 --- a/src/corelib/fpg_imgfmt_png.pas +++ b/src/corelib/fpg_imgfmt_png.pas @@ -1,7 +1,7 @@ { fpGUI - Free Pascal GUI Toolkit - Copyright (C) 2006 - 2014 See the file AUTHORS.txt, included in this + Copyright (C) 2006 - 2015 See the file AUTHORS.txt, included in this distribution, for details of the copyright. See the file COPYING.modifiedLGPL, included in this distribution, @@ -32,7 +32,7 @@ uses function LoadImage_PNG(const AFileName: TfpgString): TfpgImage; overload; function LoadImage_PNG(AStream: TStream): TfpgImage; overload; function LoadImage_PNG(const AImageData: Pointer; const AImageDataSize: LongWord): TfpgImage; overload; -function LoadImage_PNG(AInstance: THandle; const AResName: String; AResType: PChar): TfpgImage; overload; +function LoadImage_PNG(AInstance: THandle; const AResName: String; AResType: {$IFNDEF WINCE} PChar {$ELSE} PWideChar{$ENDIF}): TfpgImage; overload; function LoadImage_PNGcrop(const AMaxWidth, AMaxHeight: integer; const AFileName: TfpgString): TfpgImage; @@ -134,7 +134,7 @@ begin end; end; -function LoadImage_PNG(AInstance: THandle; const AResName: String; AResType: PChar): TfpgImage; +function LoadImage_PNG(AInstance: THandle; const AResName: String; AResType: {$IFNDEF WINCE} PChar {$ELSE} PWideChar{$ENDIF}): TfpgImage; var res: TResourceStream; begin diff --git a/src/corelib/gdi/fpg_gdi.pas b/src/corelib/gdi/fpg_gdi.pas index a1d314f6..eb051fa7 100644 --- a/src/corelib/gdi/fpg_gdi.pas +++ b/src/corelib/gdi/fpg_gdi.pas @@ -1,7 +1,7 @@ { fpGUI - Free Pascal GUI Toolkit - Copyright (C) 2006 - 2014 See the file AUTHORS.txt, included in this + Copyright (C) 2006 - 2015 See the file AUTHORS.txt, included in this distribution, for details of the copyright. See the file COPYING.modifiedLGPL, included in this distribution, @@ -42,7 +42,9 @@ uses {$IFDEF DEBUG} ,fpg_dbugintf {$ENDIF DEBUG} + {$IFNDEF wince} ,fpg_OLEDragDrop + {$ENDIF} ; { Constants missing on windows unit } @@ -153,15 +155,19 @@ type TfpgGDIWindow = class(TfpgWindowBase) private + {$IFNDEF WINCE} FDropManager: TfpgOLEDropTarget; + {$ENDIF} FDropPos: TPoint; FUserMimeSelection: TfpgString; FUserAcceptDrag: Boolean; - function GetDropManager: TfpgOLEDropTarget; + {$IFNDEF WINCE} procedure HandleDNDLeave(Sender: TObject); procedure HandleDNDEnter(Sender: TObject; DataObj: IDataObject; KeyState: Longint; PT: TPoint; var Effect: DWORD); + function GetDropManager: TfpgOLEDropTarget; procedure HandleDNDPosition(Sender: TObject; KeyState: Longint; PT: TPoint; var Effect: TfpgOLEDragDropEffect); procedure HandleDNDDrop(Sender: TObject; DataObj: IDataObject; KeyState: Longint; PT: TPoint; Effect: TfpgOLEDragDropEffect); + {$ENDIF} private FMouseInWindow: boolean; FNonFullscreenRect: TfpgRect; @@ -171,7 +177,9 @@ type QueueAcceptDrops: boolean; function DoMouseEnterLeaveCheck(AWindow: TfpgGDIWindow; uMsg, wParam, lParam: Cardinal): Boolean; procedure WindowSetFullscreen(aFullScreen, aUpdate: boolean); + {$IFNDEF WINCE} property DropManager: TfpgOLEDropTarget read GetDropManager; + {$ENDIF} protected FWinHandle: TfpgWinHandle; FModalForWin: TfpgGDIWindow; @@ -1445,6 +1453,7 @@ var // this are required for Windows MouseEnter & MouseExit detection. uLastWindowHndl: TfpgWinHandle; +{$IFNDEF WINCE} procedure TfpgGDIWindow.HandleDNDLeave(Sender: TObject); var wg: TfpgWidget; @@ -1610,6 +1619,7 @@ begin end; Result := FDropManager; end; +{$ENDIF} function TfpgGDIWindow.DoMouseEnterLeaveCheck(AWindow: TfpgGDIWindow; uMsg, wParam, lParam: Cardinal): Boolean; var @@ -2016,6 +2026,7 @@ end; procedure TfpgGDIWindow.DoAcceptDrops(const AValue: boolean); begin + {$IFNDEF WINCE} if AValue then begin if HasHandle then @@ -2029,6 +2040,7 @@ begin DropManager.RevokeDragDrop; QueueAcceptDrops := False; end; + {$ENDIF} end; procedure TfpgGDIWindow.DoDragStartDetected; @@ -2066,7 +2078,9 @@ begin else begin + {$IFNDEF WINCE} placement.length:= sizeof(placement); + // This Windows function doesn't exist in WinCE if GetWindowPlacement(FWinHandle, placement) then begin case placement.ShowCmd of @@ -2074,6 +2088,7 @@ begin SW_SHOWMINIMIZED: result:= wsMinimized; end; end; + {$ENDIF} end; { case..else } end; { case } end; @@ -2082,7 +2097,9 @@ constructor TfpgGDIWindow.Create(AOwner: TComponent); begin inherited Create(AOwner); FWinHandle := 0; + {$IFNDEF WINCE} FDropManager := nil; + {$ENDIF} FDropPos.x := 0; FDropPos.y := 0; FFullscreenIsSet := false; @@ -2092,8 +2109,10 @@ end; destructor TfpgGDIWindow.Destroy; begin + {$IFNDEF WINCE} if Assigned(FDropManager) then FDropManager.Free; + {$ENDIF} inherited Destroy; end; @@ -3027,10 +3046,13 @@ var M: PStgMedium; itm: TfpgMimeDataItem; lEffects: DWORD; + {$IFNDEF WINCE} FDataObject: TfpgOLEDataObject; FDropSource: TfpgOLEDropSource; + {$ENDIF} lIsTranslated: boolean; begin + {$IFNDEF WINCE} if FDragging then begin {$IFDEF DND_DEBUG} @@ -3121,6 +3143,7 @@ begin // (FDropSource as IUnknown)._Release; // (FDataObject as IUnknown)._Release; end; + {$ENDIF} end; { TGDIDragManager } @@ -3164,18 +3187,22 @@ end; procedure TGDIDragManager.RegisterDragDrop; begin + {$IFNDEF WINCE} Activex.RegisterDragDrop(TfpgWidget(FDropTarget).WinHandle, self as IDropTarget) + {$ENDIF} end; procedure TGDIDragManager.RevokeDragDrop; begin + {$IFNDEF WINCE} ActiveX.RevokeDragDrop(TfpgWidget(FDropTarget).WinHandle); + {$ENDIF} end; {$IF FPC_FULLVERSION<20602} procedure TimerCallBackProc(hWnd: HWND; uMsg: UINT; idEvent: UINT; dwTime: DWORD); stdcall; {$ELSE} -procedure TimerCallBackProc(hWnd: HWND; uMsg: UINT; idEvent: UINT_PTR; dwTime: DWORD); stdcall; +procedure TimerCallBackProc(hWnd: HWND; uMsg: UINT; idEvent: UINT_PTR; dwTime: DWORD); {$IFNDEF WINCE} stdcall; {$ELSE} cdecl; {$ENDIF} {$IFEND} begin { idEvent contains the handle to the timer that got triggered } @@ -3240,12 +3267,12 @@ end; initialization wapplication := nil; MouseFocusedWH := 0; - NeedToUnitialize := Succeeded(OleInitialize(nil)); {$IFDEF WinCE} UnicodeEnabledOS := True; FontSmoothingType := DEFAULT_QUALITY; {$ELSE} + NeedToUnitialize := Succeeded(OleInitialize(nil)); WinVersion.dwOSVersionInfoSize := SizeOf(TOSVersionInfo); GetVersionEx(WinVersion); UnicodeEnabledOS := (WinVersion.dwPlatformID = VER_PLATFORM_WIN32_NT) or @@ -3256,11 +3283,11 @@ initialization FontSmoothingType := CLEARTYPE_QUALITY else FontSmoothingType := ANTIALIASED_QUALITY; -{$ENDIF} finalization if NeedToUnitialize then OleUninitialize; +{$ENDIF} end. diff --git a/src/corelib/gdi/fpgui_toolkit.lpk b/src/corelib/gdi/fpgui_toolkit.lpk index 3566dc09..b6766ebd 100644 --- a/src/corelib/gdi/fpgui_toolkit.lpk +++ b/src/corelib/gdi/fpgui_toolkit.lpk @@ -166,6 +166,7 @@ + @@ -422,6 +423,7 @@ + diff --git a/src/corelib/gdi/fpgui_toolkit.pas b/src/corelib/gdi/fpgui_toolkit.pas index 4704d56a..2cc8e7f0 100644 --- a/src/corelib/gdi/fpgui_toolkit.pas +++ b/src/corelib/gdi/fpgui_toolkit.pas @@ -2,27 +2,27 @@ This source is only used to compile and install the package. } -unit fpgui_toolkit; +unit fpgui_toolkit; interface uses - fpg_base, fpg_main, fpg_cmdlineparams, fpg_command_intf, fpg_constants, + fpg_base, fpg_main, fpg_cmdlineparams, fpg_command_intf, fpg_constants, fpg_extinterpolation, fpg_imagelist, fpg_imgfmt_bmp, fpg_pofiles, fpg_popupwindow, fpg_stdimages, fpg_stringhashlist, fpg_translations, fpg_stringutils, fpg_utils, fpg_widget, fpg_wuline, fpg_impl, fpg_gdi, - fpg_OLEDragDrop, fpg_animation, fpg_basegrid, fpg_button, fpg_checkbox, - fpg_combobox, fpg_customgrid, fpg_dialogs, fpg_editcombo, fpg_edit, - fpg_form, fpg_gauge, fpg_grid, fpg_hyperlink, fpg_iniutils, fpg_label, - fpg_listbox, fpg_listview, fpg_memo, fpg_menu, fpg_mru, fpg_panel, - fpg_popupcalendar, fpg_progressbar, fpg_radiobutton, fpg_scrollbar, - fpg_style, fpg_tab, fpg_trackbar, fpg_tree, fpgui_db, fpg_splitter, - fpg_hint, fpg_spinedit, fpg_extgraphics, fpg_ColorMapping, fpg_ColorWheel, - fpg_interface, fpg_editbtn, fpg_imgfmt_jpg, fpg_imgutils, fpg_stylemanager, - fpg_style_win2k, fpg_style_motif, fpg_style_clearlooks, fpg_style_bluecurve, + fpg_animation, fpg_basegrid, fpg_button, fpg_checkbox, fpg_combobox, + fpg_customgrid, fpg_dialogs, fpg_editcombo, fpg_edit, fpg_form, fpg_gauge, + fpg_grid, fpg_hyperlink, fpg_iniutils, fpg_label, fpg_listbox, fpg_listview, + fpg_memo, fpg_menu, fpg_mru, fpg_panel, fpg_popupcalendar, fpg_progressbar, + fpg_radiobutton, fpg_scrollbar, fpg_style, fpg_tab, fpg_trackbar, fpg_tree, + fpgui_db, fpg_splitter, fpg_hint, fpg_spinedit, fpg_extgraphics, + fpg_ColorMapping, fpg_ColorWheel, fpg_interface, fpg_editbtn, + fpg_imgfmt_jpg, fpg_imgutils, fpg_stylemanager, fpg_style_win2k, + fpg_style_motif, fpg_style_clearlooks, fpg_style_bluecurve, fpg_style_bitmap, fpg_readonly, fpg_imgfmt_png, U_Command, U_Pdf, U_Report, - U_ReportImages, U_Visu, fpg_trayicon, Agg2D, fpg_dbugintf, fpg_dbugmsg, - fpg_style_carbon, fpg_style_plastic, fpg_style_win8, fpg_toggle, + U_ReportImages, U_Visu, fpg_trayicon, fpg_dbugintf, fpg_dbugmsg, + fpg_style_carbon, fpg_style_plastic, fpg_style_win8, fpg_toggle, fpg_StringGridBuilder, fpg_CSVParser; implementation diff --git a/src/gui/fpg_dialogs.pas b/src/gui/fpg_dialogs.pas index 42f4752c..08d47eb0 100644 --- a/src/gui/fpg_dialogs.pas +++ b/src/gui/fpg_dialogs.pas @@ -1,7 +1,7 @@ { fpGUI - Free Pascal GUI Toolkit - Copyright (C) 2006 - 2014 See the file AUTHORS.txt, included in this + Copyright (C) 2006 - 2015 See the file AUTHORS.txt, included in this distribution, for details of the copyright. See the file COPYING.modifiedLGPL, included in this distribution, @@ -250,7 +250,7 @@ uses fpg_widget, fpg_utils, fpg_stringutils - {$IFDEF MSWINDOWS} + {$IFDEF WINDOWS} ,Windows // used by File Dialog & Select Dir Dialog {$ENDIF} ,DateUtils diff --git a/src/gui/fpg_iniutils.pas b/src/gui/fpg_iniutils.pas index 6bbe83bd..144b007e 100644 --- a/src/gui/fpg_iniutils.pas +++ b/src/gui/fpg_iniutils.pas @@ -203,7 +203,7 @@ begin // If the form is off screen (positioned outside all monitor screens) then // center the form on screen. - //{$IFDEF MSWINDOWS} + //{$IFDEF WINDOWS} //if (AForm.FormStyle <> fsMDIChild) {$IFNDEF FPC} and tiFormOffScreen(AForm) {$ENDIF} then //begin //if Assigned(Application.MainForm) and (Application.MainForm <> AForm) then @@ -211,7 +211,7 @@ begin //else //AForm.Position:= poScreenCenter; //end; - //{$ENDIF MSWINDOWS} + //{$ENDIF WINDOWS} end; // Do NOT localize -- cgit v1.2.3-70-g09d2