formatting, cleanup

git-svn-id: trunk@13782 -
This commit is contained in:
paul 2008-01-17 06:09:24 +00:00
parent d675489e25
commit b0f4154cba
5 changed files with 258 additions and 241 deletions

View File

@ -1083,7 +1083,7 @@ begin
WinProcess := True;
NotifyUserInput := False;
Assert(False, 'Trace:WindowProc - Getting Object With Callback Procedure');
Assert(False, 'Trace:WindowProc - Getting Object with Callback Procedure');
WindowInfo := GetWindowInfo(Window);
if WindowInfo^.isChildEdit then
begin
@ -1202,7 +1202,7 @@ begin
CB_INSERTSTRING, LB_INSERTSTRING:
begin
PLMsg:=@LMInsertText;
With LMInsertText Do
with LMInsertText Do
begin
Msg := LM_INSERTTEXT;
Position := WParam;
@ -1568,7 +1568,7 @@ begin
begin
NotifyUserInput := True;
PLMsg:=@LMKey;
With LMKey Do
with LMKey Do
begin
Msg := CN_KEYDOWN;
KeyData := LParam;
@ -1583,7 +1583,7 @@ begin
begin
NotifyUserInput := True;
PLMsg:=@LMKey;
With LMKey Do
with LMKey Do
begin
Msg := CN_KEYUP;
KeyData := LParam;
@ -1606,7 +1606,7 @@ begin
begin
NotifyUserInput := True;
PLMsg:=@LMMouse;
With LMMouse Do
with LMMouse Do
begin
Msg := LM_LBUTTONDBLCLK;
XPos := GET_X_LPARAM(LParam);
@ -1636,7 +1636,7 @@ begin
GetCursorPos(MouseDownPos);
NotifyUserInput := True;
PLMsg:=@LMMouse;
With LMMouse Do
with LMMouse Do
begin
Msg := LM_LBUTTONDOWN;
XPos := GET_X_LPARAM(LParam);
@ -1659,7 +1659,7 @@ begin
MouseDownFocusStatus := mfFocusSense;
NotifyUserInput := True;
PLMsg:=@LMMouse;
With LMMouse Do
with LMMouse Do
begin
Msg := LM_LBUTTONUP;
XPos := GET_X_LPARAM(LParam);
@ -1671,7 +1671,7 @@ begin
begin
NotifyUserInput := True;
PLMsg:=@LMMouse;
With LMMouse Do
with LMMouse Do
begin
Msg := LM_MBUTTONDBLCLK;
XPos := GET_X_LPARAM(LParam);
@ -1683,7 +1683,7 @@ begin
begin
NotifyUserInput := True;
PLMsg:=@LMMouse;
With LMMouse Do
with LMMouse Do
begin
Msg := LM_MBUTTONDOWN;
XPos := GET_X_LPARAM(LParam);
@ -1695,7 +1695,7 @@ begin
begin
NotifyUserInput := True;
PLMsg:=@LMMouse;
With LMMouse Do
with LMMouse Do
begin
Msg := LM_MBUTTONUP;
XPos := GET_X_LPARAM(LParam);
@ -1717,7 +1717,7 @@ begin
begin
NotifyUserInput := True;
PLMsg:=@LMMouseMove;
With LMMouseMove Do
with LMMouseMove Do
begin
Msg := LM_MOUSEMOVE;
XPos := GET_X_LPARAM(LParam);
@ -1742,7 +1742,7 @@ begin
begin
NotifyUserInput := True;
PLMsg:=@LMMouseEvent;
With LMMouseEvent Do
with LMMouseEvent Do
begin
X := GET_X_LPARAM(LParam);
Y := GET_Y_LPARAM(LParam);
@ -1862,7 +1862,7 @@ begin
WinProcess := false;
lWinControl := WindowInfo^.WinControl;
PLMsg:=@LMMouse;
With LMMouse Do
with LMMouse Do
begin
Msg := LM_RBUTTONUP;
Pos := GetClientCursorPos(PNMHdr(LParam)^.hwndFrom);
@ -1873,7 +1873,7 @@ begin
end;
else
PLMsg:=@LMNotify;
With LMNotify Do
with LMNotify Do
begin
Msg := LM_NOTIFY;
IDCtrl := WParam;
@ -1930,7 +1930,7 @@ begin
begin
NotifyUserInput := True;
PLMsg:=@LMMouse;
With LMMouse Do
with LMMouse Do
begin
Msg := LM_RBUTTONDBLCLK;
XPos := GET_X_LPARAM(LParam);
@ -1942,7 +1942,7 @@ begin
begin
NotifyUserInput := True;
PLMsg:=@LMMouse;
With LMMouse Do
with LMMouse Do
begin
Msg := LM_RBUTTONDOWN;
XPos := GET_X_LPARAM(LParam);
@ -1956,7 +1956,7 @@ begin
NotifyUserInput := True;
WinProcess := false;
PLMsg:=@LMMouse;
With LMMouse Do
with LMMouse Do
begin
Msg := LM_RBUTTONUP;
XPos := GET_X_LPARAM(LParam);
@ -2010,7 +2010,7 @@ begin
WM_SHOWWINDOW:
begin
Assert(False, 'Trace:WindowProc - Got WM_SHOWWINDOW');
With TLMShowWindow(LMessage) Do
with TLMShowWindow(LMessage) Do
begin
Msg := LM_SHOWWINDOW;
Show := WParam <> 0;
@ -2031,7 +2031,7 @@ begin
WM_SYSCHAR:
begin
PLMsg:=@LMChar;
With LMChar Do
with LMChar Do
begin
Msg := CN_SYSCHAR;
KeyData := LParam;
@ -2049,7 +2049,7 @@ begin
begin
NotifyUserInput := True;
PLMsg:=@LMKey;
With LMKey Do
with LMKey Do
begin
Msg := CN_SYSKEYDOWN;
KeyData := LParam;
@ -2062,7 +2062,7 @@ begin
begin
NotifyUserInput := True;
PLMsg:=@LMKey;
With LMKey Do
with LMKey Do
begin
Msg := CN_SYSKEYUP;
KeyData := LParam;
@ -2160,7 +2160,7 @@ begin
WM_MOVE:
begin
PLMsg:=@LMMove;
With LMMove Do
with LMMove Do
begin
Msg := LM_MOVE;
// MoveType := WParam; WParam is not defined!
@ -2196,7 +2196,7 @@ begin
end;
WM_SIZE:
begin
With TLMSize(LMessage) Do
with TLMSize(LMessage) Do
begin
Msg := LM_SIZE;
SizeType := WParam or Size_SourceIsInterface;

View File

@ -208,23 +208,26 @@ end;
Applies a Message to the sender
------------------------------------------------------------------------------}
Procedure TWin32WidgetSet.SetCallback(Msg: LongInt; Sender: TObject);
Var
procedure TWin32WidgetSet.SetCallback(Msg: LongInt; Sender: TObject);
var
Window: HWnd;
Begin
begin
Assert(False, 'Trace:TWin32WidgetSet.SetCallback - Start');
Assert(False, Format('Trace:TWin32WidgetSet.SetCallback - Class Name --> %S', [Sender.ClassName]));
Assert(False, Format('Trace:TWin32WidgetSet.SetCallback - Message Name --> %S', [GetMessageName(Msg)]));
If Sender Is TControlCanvas Then
if Sender is TControlCanvas then
Window := TControlCanvas(Sender).Handle
Else If Sender Is TCustomForm Then
else
if Sender is TCustomForm then
Window := TCustomForm(Sender).Handle
Else
else
Window := TWinControl(Sender).Handle;
if Window=0 then exit;
if Window = 0 then Exit;
Assert(False, 'Trace:TWin32WidgetSet.SetCallback - Exit');
End;
end;
{------------------------------------------------------------------------------
Method: TWin32WidgetSet.RemoveCallbacks
@ -233,18 +236,20 @@ End;
Removes Call Back Signals from the sender
------------------------------------------------------------------------------}
Procedure TWin32WidgetSet.RemoveCallbacks(Sender: TObject);
Var
procedure TWin32WidgetSet.RemoveCallbacks(Sender: TObject);
var
Window: HWnd;
Begin
If Sender Is TControlCanvas Then
begin
if Sender is TControlCanvas then
Window := TControlCanvas(Sender).Handle
Else If Sender Is TCustomForm Then
else
if Sender is TCustomForm then
Window := TCustomForm(Sender).Handle
Else
else
Window := (Sender as TWinControl).Handle;
if Window=0 then exit;
End;
if Window = 0 then Exit;
end;
function TWin32WidgetSet.InitHintFont(HintFont: TObject): Boolean;
begin
@ -276,11 +281,12 @@ begin
DebugLn('[ProcessMessages] WaitHandleCount=', IntToStr(FWaitHandleCount),
', WaitHandle[0]=', IntToHex(FWaitHandles[0], 8));
{$endif}
pHandles := nil;
if FWaitHandleCount > 0 then
pHandles := @FWaitHandles[0];
pHandles := @FWaitHandles[0]
else
pHandles := nil;
retVal := Windows.MsgWaitForMultipleObjects(FWaitHandleCount,
pHandles, false, 0, QS_ALLINPUT);
pHandles, False, 0, QS_ALLINPUT);
if (WAIT_OBJECT_0 <= retVal) and (retVal < WAIT_OBJECT_0 + FWaitHandleCount) then
begin
index := retVal-WAIT_OBJECT_0;
@ -288,7 +294,7 @@ begin
end else
if retVal = WAIT_OBJECT_0 + FWaitHandleCount then
begin
while PeekMessage(AMessage, HWnd(Nil), 0, 0,PM_REMOVE) do
while PeekMessage(AMessage, HWnd(nil), 0, 0, PM_REMOVE) do
begin
AccelTable := GetWindowInfo(AMessage.HWnd)^.Accel;
if (AccelTable = HACCEL(nil))
@ -312,7 +318,7 @@ begin
break;
end;
until false;
End;
end;
procedure TWin32WidgetSet.CheckPipeEvents;
var
@ -353,7 +359,7 @@ end;
------------------------------------------------------------------------------}
procedure TWin32WidgetSet.AppWaitMessage;
var
timeout: dword;
timeout: DWord;
pHandles: Windows.LPHANDLE;
begin
RedrawMenus;
@ -362,13 +368,14 @@ begin
timeout := 100
else
timeout := INFINITE;
pHandles := nil;
if FWaitHandleCount > 0 then
pHandles := @FWaitHandles[0];
pHandles := @FWaitHandles[0]
else
pHandles := nil;
Windows.MsgWaitForMultipleObjects(FWaitHandleCount, pHandles,
false, timeout, QS_ALLINPUT);
Assert(False,'Trace:Leave wait message');
End;
end;
{------------------------------------------------------------------------------
Method: TWin32WidgetSet.AppTerminate
@ -377,10 +384,10 @@ End;
Tells Windows to halt and destroy
------------------------------------------------------------------------------}
Procedure TWin32WidgetSet.AppTerminate;
Begin
procedure TWin32WidgetSet.AppTerminate;
begin
Assert(False, 'Trace:TWin32WidgetSet.AppTerminate - Start');
End;
end;
procedure TWin32WidgetSet.AppSetTitle(const ATitle: string);
begin
@ -400,7 +407,7 @@ begin
end;
{------------------------------------------------------------------------------
Function: CreateTimer
function: CreateTimer
Params: Interval:
TimerFunc: Callback
Returns: a Timer id (use this ID to destroy timer)
@ -429,7 +436,7 @@ begin
end;
{------------------------------------------------------------------------------
Function: DestroyTimer
function: DestroyTimer
Params: TimerHandle
Returns:
------------------------------------------------------------------------------}
@ -485,11 +492,11 @@ end;
Registers the main window class
------------------------------------------------------------------------------}
Function TWin32WidgetSet.WinRegister: Boolean;
Var
function TWin32WidgetSet.WinRegister: Boolean;
var
WindowClass: WndClass;
WindowClassW: WndClassW;
Begin
begin
Assert(False, 'Trace:WinRegister - Start');
if UnicodeEnabledOS
then begin

View File

@ -915,7 +915,7 @@ begin
WinProcess := True;
NotifyUserInput := False;
Assert(False, 'Trace:WindowProc - Getting Object With Callback Procedure');
Assert(False, 'Trace:WindowProc - Getting Object with Callback Procedure');
WindowInfo := GetWindowInfo(Window);
//----------------------------------------
@ -990,25 +990,25 @@ begin
Case Msg Of
WM_NULL:
Begin
begin
CheckSynchronize;
TWinCEWidgetset(Widgetset).CheckPipeEvents;
End;
end;
WM_ACTIVATE:
Begin
begin
Case Lo(WParam) Of
WA_ACTIVE, WA_CLICKACTIVE:
Begin
begin
LMessage.Msg := LM_ACTIVATE
End;
end;
WA_INACTIVE:
Begin
begin
LMessage.Msg := LM_DEACTIVATE;
End;
End;
End;
end;
end;
end;
WM_ACTIVATEAPP:
Begin
begin
if Window = TWinCEWidgetSet(WidgetSet).AppHandle then
begin
if WParam <> 0 then
@ -1024,51 +1024,51 @@ begin
CallDefaultWindowProc(Application.MainForm.Handle, WM_NCACTIVATE, WParam, 0);
end;
end;
End;
end;
BM_SETCHECK:
Begin
begin
LMessage.Msg := LM_CHANGED;
End;
end;
WM_CAPTURECHANGED:
Begin
begin
LMessage.Msg := LM_CAPTURECHANGED;
End;
end;
CB_DELETESTRING, LB_DELETESTRING:
Begin
begin
LMessage.Msg := LM_DELETETEXT;
End;
end;
CB_INSERTSTRING, LB_INSERTSTRING:
Begin
begin
PLMsg:=@LMInsertText;
With LMInsertText Do
Begin
with LMInsertText Do
begin
Msg := LM_INSERTTEXT;
Position := WParam;
NewText := PChar(LParam);
Length := System.Length(NewText);
// UserData := Pointer(GetWindowLong(Window, GWL_USERDATA));
End;
End;
end;
end;
WM_CHAR:
Begin
begin
PLMsg:=@LMChar;
With LMChar Do
Begin
with LMChar Do
begin
Msg := CN_CHAR;
KeyData := LParam;
CharCode := Word(WParam);
Result := 0;
Assert(False,Format('WM_CHAR KeyData= %d CharCode= %d ',[KeyData,CharCode]));
End;
end;
WinProcess := false;
End;
end;
WM_MENUCHAR:
Begin
begin
PLMsg^.Result := FindMenuItemAccelerator(chr(LOWORD(WParam)), LParam);
WinProcess := false;
End;
end;
WM_CLOSE:
Begin
begin
if (Window = TWinCEWidgetSet(WidgetSet).AppHandle) and
(Application.MainForm <> nil) then
begin
@ -1078,9 +1078,9 @@ begin
end;
// default is to destroy window, inhibit
WinProcess := false;
End;
end;
WM_COMMAND:
Begin
begin
if Hi(WParam) < 2 then //1 for accelerator 0 for menu
TargetObject := GetMenuItemObject else // menuitem or shortcut
TargetObject := nil;
@ -1141,17 +1141,17 @@ begin
// no specific message found? try send a general msg
if (LMessage.Msg = LM_NULL) and (lWinControl <> nil) then
lWinControl.Perform(CN_COMMAND, WParam, LParam);
End;
end;
{
* Besides the fact that LCL does not respond to LM_CREATE, this code is
probably never reached anyway, as the callback is not set until after
window creation
WM_CREATE:
Begin
begin
Assert(False, 'Trace:WindowProc - Got WM_CREATE');
LMessage.Msg := LM_CREATE;
End;
end;
}
WM_CTLCOLORMSGBOX..WM_CTLCOLORSTATIC:
begin
@ -1203,15 +1203,15 @@ begin
LMessage.Msg := LM_CLEARSEL;
end;
WM_COPY:
Begin
begin
LMessage.Msg := LM_COPYTOCLIP;
End;
end;
WM_CUT:
Begin
begin
LMessage.Msg := LM_CUTTOCLIP;
End;
end;
WM_DESTROY:
Begin
begin
Assert(False, 'Trace:WindowProc - Got WM_DESTROY');
if lWinControl is TCheckListBox then
TWinCECheckListBoxStrings.DeleteItemRecords(Window);
@ -1222,9 +1222,9 @@ begin
if WindowInfo^.Overlay<>HWND(nil) then
Windows.DestroyWindow(WindowInfo^.Overlay);
LMessage.Msg := LM_DESTROY;
End;
end;
(* WM_DESTROYCLIPBOARD:
Begin
begin
if assigned(OnClipBoardRequest) then begin
{$IFDEF VerboseWin32Clipbrd}
debugln('WM_DESTROYCLIPBOARD');
@ -1233,7 +1233,7 @@ begin
OnClipBoardRequest := nil;
LMessage.Result := 0;
end;
End;*)
end;*)
WM_DRAWITEM:
begin
if (WParam = 0) and (PDrawItemStruct(LParam)^.ctlType = ODT_MENU) then
@ -1289,7 +1289,7 @@ begin
end;
end;
WM_ENABLE:
Begin
begin
If WParam <> 0 Then
LMessage.Msg := LM_SETEDITABLE;
If Window=TWinCEWidgetSet(WidgetSet).FAppHandle then
@ -1306,9 +1306,9 @@ begin
/// if not TWinCEWidgetSet(WidgetSet).ThemesActive
/// and (lWinControl is TCustomBitBtn)
/// then DrawBitBtnImage(TCustomBitBtn(lWinControl), PChar(TCustomBitBtn(lWinControl).Caption));
End;
end;
WM_ERASEBKGND:
Begin
begin
eraseBkgndCommand := TEraseBkgndCommand(EraseBkgndStack and EraseBkgndStackMask);
{$ifdef MSG_DEBUG}
case eraseBkgndCommand of
@ -1350,16 +1350,16 @@ begin
LMessage.Result := 1;
end;
WinProcess := false;
End;
end;
WM_EXITMENULOOP:
// is it a popup menu
if longbool(WPARAM) and assigned(WindowInfo^.PopupMenu) then
WindowInfo^.PopupMenu.Close;
WM_GETDLGCODE:
Begin
begin
LMessage.Result := DLGC_WANTALLKEYS;
WinProcess := false;
End;
end;
{
* TODO: make it work... icon does not show up yet, so better disable it
WM_GETICON:
@ -1376,61 +1376,61 @@ begin
WM_HSCROLL:
HandleScrollMessage(LM_HSCROLL);
WM_KEYDOWN:
Begin
begin
NotifyUserInput := True;
PLMsg:=@LMKey;
With LMKey Do
Begin
with LMKey Do
begin
Msg := CN_KEYDOWN;
KeyData := LParam;
CharCode := Word(WParam);
Result := 0;
Assert(False,Format('WM_KEYDOWN KeyData= %d CharCode= %d ',[KeyData,CharCode]));
Assert(False,' lWinControl= '+TComponent(lWinControl).Name+':'+lWinControl.ClassName);
End;
end;
WinProcess := false;
End;
end;
WM_KEYUP:
Begin
begin
NotifyUserInput := True;
PLMsg:=@LMKey;
With LMKey Do
Begin
with LMKey Do
begin
Msg := CN_KEYUP;
KeyData := LParam;
CharCode := Word(WParam);
Result := 0;
Assert(False,Format('WM_KEYUP KeyData= %d CharCode= %d ',[KeyData,CharCode]));
End;
end;
WinProcess := false;
End;
end;
WM_KILLFOCUS:
Begin
begin
{$ifdef DEBUG_CARET}
DebugLn('WM_KILLFOCUS received for window ', IntToHex(Window, 8));
{$endif}
LMessage.Msg := LM_KILLFOCUS;
LMessage.WParam := WParam;
End;
end;
//TODO:LM_KILLCHAR,LM_KILLWORD,LM_KILLLINE
WM_LBUTTONDBLCLK:
Begin
begin
NotifyUserInput := True;
PLMsg:=@LMMouse;
With LMMouse Do
Begin
with LMMouse Do
begin
Msg := LM_LBUTTONDBLCLK;
XPos := SmallInt(Lo(LParam));
YPos := SmallInt(Hi(LParam));
Keys := WParam;
End;
end;
// CheckListBox functionality
if lWinControl is TCheckListBox then
CheckListBoxLButtonDown;
End;
end;
WM_LBUTTONDOWN:
Begin
begin
// if mouse-click, focus-change, mouse-click, cursor hasn't moved:
// simulate double click, assume focus change due to first mouse-click
if (MouseDownFocusStatus = mfFocusChanged) and (MouseDownFocusWindow = Window)
@ -1459,13 +1459,13 @@ begin
GetCursorPos(MouseDownPos);
NotifyUserInput := True;
PLMsg:=@LMMouse;
With LMMouse Do
Begin
with LMMouse Do
begin
Msg := LM_LBUTTONDOWN;
XPos := SmallInt(Lo(LParam));
YPos := SmallInt(Hi(LParam));
Keys := WParam;
End;
end;
// CheckListBox functionality
if lWinControl is TCheckListBox then
@ -1475,73 +1475,73 @@ begin
((lWinControl = nil) or (lWinControl.CanFocus)) then
Windows.SetFocus(Window);
End;
end;
WM_LBUTTONUP:
Begin
begin
if (MouseDownWindow = Window) and (MouseDownFocusStatus = mfNone) then
MouseDownFocusStatus := mfFocusSense;
NotifyUserInput := True;
PLMsg:=@LMMouse;
With LMMouse Do
Begin
with LMMouse Do
begin
Msg := LM_LBUTTONUP;
XPos := SmallInt(Lo(LParam));
YPos := SmallInt(Hi(LParam));
Keys := WParam;
End;
End;
end;
end;
WM_MBUTTONDBLCLK:
Begin
begin
NotifyUserInput := True;
PLMsg:=@LMMouse;
With LMMouse Do
Begin
with LMMouse Do
begin
Msg := LM_MBUTTONDBLCLK;
XPos := SmallInt(Lo(LParam));
YPos := SmallInt(Hi(LParam));
Keys := WParam;
End;
End;
end;
end;
WM_MBUTTONDOWN:
Begin
begin
NotifyUserInput := True;
PLMsg:=@LMMouse;
With LMMouse Do
Begin
with LMMouse Do
begin
Msg := LM_MBUTTONDOWN;
XPos := SmallInt(Lo(LParam));
YPos := SmallInt(Hi(LParam));
Keys := WParam;
End;
End;
end;
end;
WM_MBUTTONUP:
Begin
begin
NotifyUserInput := True;
PLMsg:=@LMMouse;
With LMMouse Do
Begin
with LMMouse Do
begin
Msg := LM_MBUTTONUP;
XPos := SmallInt(Lo(LParam));
YPos := SmallInt(Hi(LParam));
Keys := WParam;
End;
End;
end;
end;
WM_MOUSEHOVER:
Begin
begin
NotifyUserInput := True;
LMessage.Msg := LM_ENTER;
End;
end;
WM_MOUSELEAVE:
Begin
begin
NotifyUserInput := True;
LMessage.Msg := LM_LEAVE;
End;
end;
WM_MOUSEMOVE:
Begin
begin
NotifyUserInput := True;
PLMsg:=@LMMouseMove;
With LMMouseMove Do
Begin
with LMMouseMove Do
begin
Msg := LM_MOUSEMOVE;
XPos := SmallInt(Lo(LParam));
YPos := SmallInt(Hi(LParam));
@ -1559,14 +1559,14 @@ begin
WindowInfo^.MouseX := XPos;
WindowInfo^.MouseY := YPos;
end;
End;
End;
end;
end;
WM_MOUSEWHEEL:
Begin
begin
NotifyUserInput := True;
PLMsg:=@LMMouseEvent;
With LMMouseEvent Do
Begin
with LMMouseEvent Do
begin
X := SmallInt(Lo(LParam));
Y := SmallInt(Hi(LParam));
// check if mouse cursor within this window, otherwise send message to window the mouse is hovering over
@ -1639,12 +1639,12 @@ begin
end;
end;
WM_NCLBUTTONDOWN:
Begin
begin
NotifyUserInput := True;
Assert(False, 'Trace:WindowProc - Got WM_NCLBUTTONDOWN');
End;
end;
WM_NOTIFY:
Begin
begin
WindowInfo := GetWindowInfo(PNMHdr(LParam)^.hwndFrom);
{$ifdef MSG_DEBUG}
DebugLn([MessageStackDepth, 'Notify code: ', PNMHdr(LParam)^.code]);
@ -1664,8 +1664,8 @@ begin
end;}
else
PLMsg:=@LMNotify;
With LMNotify Do
Begin
with LMNotify Do
begin
Msg := LM_NOTIFY;
IDCtrl := WParam;
NMHdr := PNMHDR(LParam);
@ -1683,65 +1683,65 @@ begin
end;
end;
WM_PAINT:
Begin
begin
SendPaintMessage;
// SendPaintMessage sets winprocess to false
End;
end;
WM_PASTE:
Begin
begin
LMessage.Msg := LM_PASTEFROMCLIP;
End;
end;
WM_RBUTTONDBLCLK:
Begin
begin
NotifyUserInput := True;
PLMsg:=@LMMouse;
With LMMouse Do
Begin
with LMMouse Do
begin
Msg := LM_RBUTTONDBLCLK;
XPos := SmallInt(Lo(LParam));
YPos := SmallInt(Hi(LParam));
Keys := WParam;
End;
End;
end;
end;
WM_RBUTTONDOWN:
Begin
begin
NotifyUserInput := True;
PLMsg:=@LMMouse;
With LMMouse Do
Begin
with LMMouse Do
begin
Msg := LM_RBUTTONDOWN;
XPos := SmallInt(Lo(LParam));
YPos := SmallInt(Hi(LParam));
Keys := WParam;
Result := 0;
End;
End;
end;
end;
WM_RBUTTONUP:
Begin
begin
NotifyUserInput := True;
WinProcess := false;
PLMsg:=@LMMouse;
With LMMouse Do
Begin
with LMMouse Do
begin
Msg := LM_RBUTTONUP;
XPos := SmallInt(Lo(LParam));
YPos := SmallInt(Hi(LParam));
Keys := WParam;
Result := 0;
End;
End;
end;
end;
WM_CONTEXTMENU:
begin
WinProcess := false;
NotifyUserInput := True;
PLMsg:=@LMMouse;
With LMMouse Do
Begin
with LMMouse Do
begin
Msg := LM_RBUTTONUP;
XPos := GET_X_LPARAM(LParam);
YPos := GET_Y_LPARAM(LParam);
Result := 0;
End;
end;
if (LMMouse.XPos<>-1) and (LMMouse.YPos<>-1) then
begin
P := SmallPointToPoint(LMMouse.Pos);
@ -1760,7 +1760,7 @@ begin
HandleSetCursor;
end;
WM_SETFOCUS:
Begin
begin
{$ifdef DEBUG_CARET}
DebugLn('WM_SETFOCUS received for window ', IntToHex(Window, 8));
{$endif}
@ -1776,16 +1776,16 @@ begin
// RadioButton functionality
if (lWinControl <> nil) and (lWinControl is TRadioButton) then
Windows.SendMessage(Window, BM_SETCHECK, BST_CHECKED, 0);
End;
end;
WM_SHOWWINDOW:
Begin
begin
Assert(False, 'Trace:WindowProc - Got WM_SHOWWINDOW');
With TLMShowWindow(LMessage) Do
Begin
with TLMShowWindow(LMessage) Do
begin
Msg := LM_SHOWWINDOW;
Show := WParam <> 0;
Status := LParam;
End;
end;
if assigned(lWinControl) and ((WParam<>0) or not lWinControl.Visible)
and ((WParam=0) or lWinControl.Visible)
@ -1797,70 +1797,70 @@ begin
Flags := SW_SHOWNOACTIVATE;
Windows.ShowWindow(TWinCEWidgetSet(WidgetSet).FAppHandle, Flags);
end;
End;
end;
WM_SYSCHAR:
Begin
begin
PLMsg:=@LMChar;
With LMChar Do
Begin
with LMChar Do
begin
Msg := CN_SYSCHAR;
KeyData := LParam;
CharCode := Word(WParam);
Result := 0;
Assert(False,Format('WM_CHAR KeyData= %d CharCode= %d ',[KeyData,CharCode]));
End;
end;
WinProcess := false;
End;
end;
WM_SYSCOMMAND:
begin
HandleSysCommand;
end;
WM_SYSKEYDOWN:
Begin
begin
NotifyUserInput := True;
PLMsg:=@LMKey;
With LMKey Do
Begin
with LMKey Do
begin
Msg := CN_SYSKEYDOWN;
KeyData := LParam;
CharCode := Word(WParam);
Result := 0;
End;
end;
WinProcess := false;
End;
end;
WM_SYSKEYUP:
Begin
begin
NotifyUserInput := True;
PLMsg:=@LMKey;
With LMKey Do
Begin
with LMKey Do
begin
Msg := CN_SYSKEYUP;
KeyData := LParam;
CharCode := Word(WParam);
Result := 0;
End;
end;
WinProcess := false;
End;
end;
WM_TIMER:
Begin
begin
LMessage.Msg := LM_TIMER;
LMessage.WParam := WParam;
LMessage.LParam := LParam;
End;
end;
WM_VSCROLL:
HandleScrollMessage(LM_VSCROLL);
WM_WINDOWPOSCHANGED:
Begin
With TLMWindowPosMsg(LMessage) Do
Begin
begin
with TLMWindowPosMsg(LMessage) Do
begin
Msg := LM_WINDOWPOSCHANGED;
Unused := WParam;
WindowPos := PWindowPos(LParam);
End;
end;
// cross-interface compatible: complete invalidate on resize
if (PWindowPos(LParam)^.flags and SWP_NOSIZE) = 0 then
Windows.InvalidateRect(Window, nil, true);
End;
end;
WM_MEASUREITEM:
begin
if WParam = 0 then
@ -1962,7 +1962,7 @@ begin
end;
WM_SIZE:
begin
With TLMSize(LMessage) Do
with TLMSize(LMessage) Do
begin
Msg := LM_SIZE;
SizeType := WParam or Size_SourceIsInterface;
@ -2217,7 +2217,7 @@ begin
else Result := PLMsg^.Result;
Assert(False, 'Trace:WindowProc - Exit');
End;
end;
{$ifdef MSG_DEBUG}

View File

@ -148,11 +148,10 @@ type
procedure AppBringToFront; override;
procedure AppProcessMessages; override;
procedure AppWaitMessage; override;
procedure AppTerminate; Override;
procedure AppTerminate; override;
procedure AppSetTitle(const ATitle: string); override;
//Function InitHintFont(HintFont: TObject): Boolean; override;
Procedure AttachMenuToWindow(AMenuObject: TComponent); override;
// procedure AppRun(const ALoop: TApplicationMainLoop); override;
procedure DCSetPixel(CanvasHandle: HDC; X, Y: integer; AColor: TGraphicsColor); override;
function DCGetPixel(CanvasHandle: HDC; X, Y: integer): TGraphicsColor; override;
procedure DCRedraw(CanvasHandle: HDC); override;

View File

@ -291,6 +291,7 @@ var
AMessage: TMsg;
AccelTable: HACCEL;
retVal, index: dword;
pHandles: Windows.LPHANDLE;
begin
repeat
{$ifdef DEBUG_ASYNCEVENTS}
@ -298,8 +299,13 @@ begin
DebugLn('[ProcessMessages] WaitHandleCount=', IntToStr(FWaitHandleCount),
', WaitHandle[0]=', IntToHex(FWaitHandles[0], 8));
{$endif}
if FWaitHandleCount > 0 then
pHandles := @FWaitHandles[0]
else
pHandles := nil;
retVal := Windows.MsgWaitForMultipleObjects(FWaitHandleCount,
FWaitHandles[0], false, 0, QS_ALLINPUT);
pHandles, False, 0, QS_ALLINPUT);
//roozbeh:added
if FWaitHandleCount = 0 then
@ -312,7 +318,7 @@ begin
end else
if retVal = WAIT_OBJECT_0 + FWaitHandleCount then
begin
while PeekMessage(AMessage, HWnd(Nil), 0, 0,PM_REMOVE) do
while PeekMessage(AMessage, HWnd(nil), 0, 0, PM_REMOVE) do
begin
AccelTable := GetWindowInfo(AMessage.HWnd)^.Accel;
if (AccelTable = HACCEL(nil))
@ -322,17 +328,21 @@ begin
DispatchMessage(@AMessage);
end;
end;
if FWaitHandleCount = 0 then
break;
end
else
if retVal = $FFFFFFFF then
begin
DebugLn('[TWinCEWidgetSet.AppProcessMessages] MsgWaitForMultipleObjects returned: ', IntToStr(GetLastError));
break;
end;
end else
if retVal = WAIT_TIMEOUT then
begin
// check for pending to-be synchronized methods
CheckSynchronize;
CheckPipeEvents;
break;
end else
if retVal = $FFFFFFFF then
begin
DebugLn('[TWinCEWidgetSet.AppProcessMessages] MsgWaitForMultipleObjects returned: ', IntToStr(GetLastError));
break;
end;
until false;
end;
@ -344,8 +354,8 @@ var
ChangedCount:integer;
begin
lHandler := FWaitPipeHandlers;
ChangedCount:=0;
while (lHandler <> nil) and (ChangedCount<10) do
ChangedCount := 0;
while (lHandler <> nil) and (ChangedCount < 10) do
begin
{
roozbeh : ooops not supported
@ -378,7 +388,8 @@ end;
//roozbeh:new update...whole procedure body is added.what is it?
procedure TWinCEWidgetSet.AppWaitMessage;
var
timeout,retVal: dword;
timeout, retVal: DWord;
pHandles: Windows.LPHANDLE;
begin
RedrawMenus;
Assert(False, 'Trace:TWinCEWidgetSet.WaitMessage - Start');
@ -387,8 +398,13 @@ begin
else
timeout := INFINITE;
if FWaitHandleCount > 0 then
pHandles := @FWaitHandles[0]
else
pHandles := nil;
//roozbeh...remove raise after testing!
retVal := Windows.MsgWaitForMultipleObjects(FWaitHandleCount, FWaitHandles[0],
retVal := Windows.MsgWaitForMultipleObjects(FWaitHandleCount, pHandles,
false, timeout, QS_ALLINPUT);
if retVal = $FFFFFFFF then
@ -408,10 +424,6 @@ end;
procedure TWinCEWidgetSet.AppTerminate;
begin
Assert(False, 'Trace:TWinCEWidgetSet.AppTerminate - Start');
// roozbeh
// not existed in win32
// AppTerminated := True;
// PostQuitMessage(0);
end;
@ -625,8 +637,7 @@ end;
Get the color of the specified pixel on the canvas
-----------------------------------------------------------------------------}
function TWinCEWidgetSet.DCGetPixel(CanvasHandle: HDC; X, Y: integer
): TGraphicsColor;
function TWinCEWidgetSet.DCGetPixel(CanvasHandle: HDC; X, Y: integer): TGraphicsColor;
begin
Result := Windows.GetPixel(CanvasHandle, X, Y);
end;