/usr/lib/lazarus/0.9.30.4/lcl/lclintf.pas is in lazarus-src-0.9.30.4 0.9.30.4-6.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 | { $Id: lclintf.pas 27661 2010-10-12 09:54:03Z sekelsenmat $ }
{
/***************************************************************************
LCLIntf.pas
-----------
Component Library Windows Controls
Initial Revision : Fri Jul 23 20:00:00 PDT 1999
***************************************************************************/
*****************************************************************************
* *
* This file is part of the Lazarus Component Library (LCL) *
* *
* See the file COPYING.modifiedLGPL.txt, included in this distribution, *
* for details about the copyright. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* *
*****************************************************************************
}
{
@author(Curtis White <cwhite@aracnet.com>)
@created(17-Oct-1999)
This unit is being created specifically for compatibility with Delphi. It
contains selected functions that are included in the Delphi Windows unit.
These functions are mostly abstract and implemented by the LCL interfaces.
For LCL users:
The functions can be used to make porting of Delphi applications easier
and are not 100% emulating winapi functions, not even under windows. They were
implemented and tested with some common Delphi libraries.
The LCL contains many extra functions that the Delphi VCL does not have.
For example:
Instead of using the common windows functions SaveDC and RestoreDC use instead
the Canvas.SaveHandleState and Canvas.RestoreHandleState.
}
unit LCLIntf;
{$mode objfpc}{$H+}
{$inline on}
interface
uses
{$IFDEF Windows}Windows, {$ifndef ver2_2_0}ShellApi, {$ENDIF}{$ENDIF}
{$IFDEF UNIX}Unix, {$ENDIF}
{$IFDEF Darwin}MacOSAll, {$ENDIF}
Types, Math, Classes, SysUtils, LCLType, LCLProc, GraphType, InterfaceBase,
LResources, FileUtil, UTF8Process, Maps, LMessages;
{$ifdef Trace}
{$ASSERTIONS ON}
{$endif}
{$DEFINE ClientRectBugFix}
// All winapi related stuff (Delphi compatible)
{$I winapih.inc}
// All interface communication (Our additions)
{$I lclintfh.inc}
function PredefinedClipboardFormat(
AFormat: TPredefinedClipboardFormat): TClipboardFormat;
function MsgKeyDataToShiftState(KeyData: Longint): TShiftState;
{$IFDEF WINDOWS}
{$IFDEF MSWindows}
function GetTickCount:DWORD; stdcall; external 'kernel32.dll' name 'GetTickCount';
{$ELSE}
function GetTickCount:DWORD; stdcall; external KernelDLL name 'GetTickCount';
{$ENDIF}
{$ELSE}
function GetTickCount: DWord;
{$ENDIF}
{$IFDEF DebugLCL}
function GetTickStep: DWord;
{$ENDIF}
// Functions in the include file sysenvapis.inc
function FindDefaultBrowser(out ABrowser, AParams: String): Boolean;
function OpenURL(AURL: String): Boolean;
function OpenDocument(APath: String): Boolean;
implementation
type
{ TTimerID }
TTimerID = class
procedure TimerNotify;
end;
PTimerInfo = ^TTimerInfo;
TTimerInfo = record
Wnd: HWND;
IDEvent: UINT_PTR;
TimerProc: TTimerProc;
Handle: THandle;
end;
var
MTimerMap: TMap = nil; // hWnd + nIDEvent -> ID
MTimerInfo: TMap = nil; // ID -> TTimerInfo
MTimerSeq: Cardinal;
FPredefinedClipboardFormats:
array[TPredefinedClipboardFormat] of TClipboardFormat;
LowerCaseChars: array[char] of char;
UpperCaseChars: array[char] of char;
{ TTimerMap }
procedure TTimerID.TimerNotify;
var
Info: PTimerInfo;
ID: Cardinal;
begin
if MTimerInfo = nil then Exit;
// this is a bit of a hack.
// to pass the ID if the timer, it is passed as an cast to self
// So there isn't realy an instance of TTimerID
ID := PtrUInt(Self);
Info := MTimerInfo.GetDataPtr(ID);
if Info = nil then Exit;
if Info^.TimerProc = nil
then begin
// send message
PostMessage(Info^.Wnd, LM_TIMER, Info^.IDEvent, 0);
end
else begin
// a timerproc was passed
Info^.TimerProc(Info^.Wnd, LM_TIMER, Info^.IDEvent, GetTickCount);
end;
end;
{$IFNDEF WINDOWS}
function GetTickCount: DWord;
begin
Result := DWord(Trunc(Now * 24 * 60 * 60 * 1000));
end;
{$ENDIF}
{$IFDEF DebugLCL}
var
LastTickValid: boolean;
LastTick: DWord;
function GetTickStep: DWord;
var
CurTick: DWord;
begin
CurTick:=GetTickCount;
if LastTickValid then begin
if LastTick<=CurTick then
Result:=CurTick-LastTick
else begin
// tick counter has restarted
Result:=CurTick+(DWord($FFFFFFFF)-LastTick+1);
end;
end else begin
Result:=0;
end;
LastTickValid:=true;
LastTick:=CurTick;
end;
{$ENDIF}
function PredefinedClipboardFormat(AFormat: TPredefinedClipboardFormat
): TClipboardFormat;
begin
if FPredefinedClipboardFormats[AFormat]=0 then
FPredefinedClipboardFormats[AFormat]:=
ClipboardRegisterFormat(PredefinedClipboardMimeTypes[AFormat]);
Result:=FPredefinedClipboardFormats[AFormat];
end;
function MsgKeyDataToShiftState(KeyData: Longint): TShiftState;
begin
Result := [];
if GetKeyState(VK_SHIFT) < 0 then Include(Result, ssShift);
if GetKeyState(VK_CONTROL) < 0 then Include(Result, ssCtrl);
if GetKeyState(VK_LWIN) < 0 then Include(Result, ssMeta);
if KeyData and $20000000 <> 0 then Include(Result, ssAlt);
end;
{$I winapi.inc}
{$I lclintf.inc}
// System APIs which have an operating-system specific implementation
// They should be moved to FPC eventually
{$I sysenvapis.inc}
{$ifdef Windows}
{$I sysenvapis_win.inc}
{$endif}
{$ifdef UNIX}
{$ifdef darwin}
{$I sysenvapis_mac.inc}
{$else}
{$I sysenvapis_unix.inc}
{$endif}
{$endif}
procedure InternalInit;
var
AClipboardFormat: TPredefinedClipboardFormat;
c: char;
s: string;
begin
for AClipboardFormat:=Low(TPredefinedClipboardFormat) to
High(TPredefinedClipboardFormat) do
FPredefinedClipboardFormats[AClipboardFormat]:=0;
for c:=Low(char) to High(char) do begin
s:=lowercase(c);
LowerCaseChars[c]:=s[1];
UpperCaseChars[c]:=upcase(c);
end;
{$IFDEF DebugLCL}
LastTickValid:=false;
{$ENDIF}
end;
initialization
InternalInit;
finalization
FreeAndNil(MTimerMap);
FreeAndNil(MTimerInfo);
end.
|