mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-12 22:40:15 +02:00
Small improvement to wince debug info
git-svn-id: trunk@26855 -
This commit is contained in:
parent
d926fdf04a
commit
fb877424e0
@ -116,9 +116,6 @@ uses strutils;
|
|||||||
const
|
const
|
||||||
SpaceBetweenIcons = 5;
|
SpaceBetweenIcons = 5;
|
||||||
|
|
||||||
var
|
|
||||||
menuiteminfosize : DWORD = 0;
|
|
||||||
|
|
||||||
type
|
type
|
||||||
TCaptionFlags = (cfBold, cfUnderline);
|
TCaptionFlags = (cfBold, cfUnderline);
|
||||||
TCaptionFlagsSet = set of TCaptionFlags;
|
TCaptionFlagsSet = set of TCaptionFlags;
|
||||||
@ -326,6 +323,9 @@ begin
|
|||||||
// Careful that using TB_DELETEBUTTON doesnt work here
|
// Careful that using TB_DELETEBUTTON doesnt work here
|
||||||
while RemoveMenu(HMENU(tbbi.lParam), 0, MF_BYPOSITION) do DebugLn('[CeSetMenu] RemoveMenu');
|
while RemoveMenu(HMENU(tbbi.lParam), 0, MF_BYPOSITION) do DebugLn('[CeSetMenu] RemoveMenu');
|
||||||
|
|
||||||
|
{$ifdef VerboseWinCEMenu}
|
||||||
|
DebugLn(Format('[CeSetMenu] Installing %d Subitems', [LCLMenu.Items.Items[j].Count]));
|
||||||
|
{$endif}
|
||||||
for k := 0 to LCLMenu.Items.Items[j].Count - 1 do
|
for k := 0 to LCLMenu.Items.Items[j].Count - 1 do
|
||||||
TWinCEWSMenuItem.AttachMenuEx(
|
TWinCEWSMenuItem.AttachMenuEx(
|
||||||
LCLMenu.Items.Items[j].Items[k], HMENU(tbbi.lParam));
|
LCLMenu.Items.Items[j].Items[k], HMENU(tbbi.lParam));
|
||||||
@ -467,7 +467,7 @@ var
|
|||||||
begin
|
begin
|
||||||
Result := MakeLResult(0, 0);
|
Result := MakeLResult(0, 0);
|
||||||
MenuItemIndex := -1;
|
MenuItemIndex := -1;
|
||||||
ItemInfo.cbSize := menuiteminfosize;
|
ItemInfo.cbSize := SizeOf(MENUITEMINFO);
|
||||||
ItemInfo.fMask := MIIM_DATA;
|
ItemInfo.fMask := MIIM_DATA;
|
||||||
if not GetMenuItemInfo(AMenuHandle, 0, true, @ItemInfo) then Exit;
|
if not GetMenuItemInfo(AMenuHandle, 0, true, @ItemInfo) then Exit;
|
||||||
FirstMenuItem := TMenuItem(ItemInfo.dwItemData);
|
FirstMenuItem := TMenuItem(ItemInfo.dwItemData);
|
||||||
@ -503,7 +503,7 @@ var
|
|||||||
MenuInfo: MENUITEMINFO;
|
MenuInfo: MENUITEMINFO;
|
||||||
wCaption : WideString;
|
wCaption : WideString;
|
||||||
begin
|
begin
|
||||||
MenuInfo.cbSize := menuiteminfosize;
|
MenuInfo.cbSize := SizeOf(MENUITEMINFO);
|
||||||
MenuInfo.fMask := MIIM_TYPE;
|
MenuInfo.fMask := MIIM_TYPE;
|
||||||
MenuInfo.dwTypeData := nil; // don't retrieve caption
|
MenuInfo.dwTypeData := nil; // don't retrieve caption
|
||||||
GetMenuItemInfo(AMenuItem.Parent.Handle, AMenuItem.Command, false, @MenuInfo);
|
GetMenuItemInfo(AMenuItem.Parent.Handle, AMenuItem.Command, false, @MenuInfo);
|
||||||
@ -530,31 +530,29 @@ var
|
|||||||
begin
|
begin
|
||||||
wCaption := UTF8Decode(ACaption);
|
wCaption := UTF8Decode(ACaption);
|
||||||
FillChar(MenuInfo, SizeOf(MenuInfo), 0);
|
FillChar(MenuInfo, SizeOf(MenuInfo), 0);
|
||||||
with MenuInfo do
|
MenuInfo.cbsize := SizeOf(MenuInfo);
|
||||||
|
MenuInfo.fMask := MIIM_TYPE or MIIM_STATE;
|
||||||
|
if ACaption <> cLineCaption then
|
||||||
begin
|
begin
|
||||||
cbsize := menuiteminfosize;
|
MenuInfo.fType := MFT_STRING;
|
||||||
fMask := MIIM_TYPE or MIIM_STATE;
|
if AMenuItem.Enabled then MenuInfo.fState := MF_ENABLED
|
||||||
if ACaption <> cLineCaption then
|
else MenuInfo.fState := MF_GRAYED;
|
||||||
begin
|
{$ifdef win32}
|
||||||
fType := MFT_STRING;
|
MenuInfo.dwTypeData := PChar(PWideChar(wCaption));
|
||||||
if AMenuItem.Enabled then fState := MF_ENABLED
|
{$else}
|
||||||
else fState := MF_GRAYED;
|
MenuInfo.dwTypeData := PWideChar(wCaption);
|
||||||
{$ifdef win32}
|
{$endif}
|
||||||
dwTypeData:=PChar(PWideChar(wCaption));
|
MenuInfo.cch := Length(aCaption);
|
||||||
{$else}
|
end
|
||||||
dwTypeData:=PWideChar(wCaption);
|
else
|
||||||
{$endif}
|
begin
|
||||||
cch := Length(aCaption);
|
MenuInfo.fType := MFT_SEPARATOR;
|
||||||
end
|
MenuInfo.fState := MFS_DISABLED;
|
||||||
else
|
|
||||||
begin
|
|
||||||
fType := MFT_SEPARATOR;
|
|
||||||
fState := MFS_DISABLED;
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
{$ifdef VerboseWinCEMenu}
|
{$ifdef VerboseWinCEMenu}
|
||||||
DebugLn('[UpdateCaption] SetMenuItemInfo for ' + AMenuItem.Name +
|
DebugLn(Format('[UpdateCaption] SetMenuItemInfo for %s with ' +
|
||||||
' with ButtonID = AMenuItem.Command = ' + IntToStr(AMenuItem.Command));
|
'Caption: %s ButtonID = AMenuItem.Command = %d',
|
||||||
|
[AMenuItem.Name, AMenuItem.Caption, AMenuItem.Command]));
|
||||||
{$endif}
|
{$endif}
|
||||||
if not SetMenuItemInfo(AMenuItem.Parent.Handle, AMenuItem.Command, false, @MenuInfo) then
|
if not SetMenuItemInfo(AMenuItem.Parent.Handle, AMenuItem.Command, false, @MenuInfo) then
|
||||||
DebugLn('SetMenuItemInfo failed: ', GetLastErrorText(GetLastError));
|
DebugLn('SetMenuItemInfo failed: ', GetLastErrorText(GetLastError));
|
||||||
@ -570,7 +568,7 @@ var
|
|||||||
Index, fstate, cmd: integer;
|
Index, fstate, cmd: integer;
|
||||||
begin
|
begin
|
||||||
{$ifdef VerboseWinCEMenu}
|
{$ifdef VerboseWinCEMenu}
|
||||||
DebugLn('[TWinCEWSMenuItem.AttachMenuEx] Start');
|
DebugLn('[TWinCEWSMenuItem.AttachMenuEx] START');
|
||||||
{$endif}
|
{$endif}
|
||||||
|
|
||||||
FillChar(MenuInfo, SizeOf(MenuInfo), 0);
|
FillChar(MenuInfo, SizeOf(MenuInfo), 0);
|
||||||
@ -581,11 +579,10 @@ begin
|
|||||||
(Application.ApplicationType <> atKeyPadDevice) then
|
(Application.ApplicationType <> atKeyPadDevice) then
|
||||||
begin
|
begin
|
||||||
ParentOfParent := AMenuItem.Parent.Parent.Handle;
|
ParentOfParent := AMenuItem.Parent.Parent.Handle;
|
||||||
with MenuInfo do
|
|
||||||
begin
|
MenuInfo.cbSize := SizeOf(MENUITEMINFO);
|
||||||
cbSize := menuiteminfosize;
|
MenuInfo.fMask := MIIM_SUBMENU;
|
||||||
fMask := MIIM_SUBMENU;
|
|
||||||
end;
|
|
||||||
{$ifdef VerboseWinCEMenu}
|
{$ifdef VerboseWinCEMenu}
|
||||||
DebugLn('[TWinCEWSMenuItem.AttachMenuEx] GetMenuItemInfo for '
|
DebugLn('[TWinCEWSMenuItem.AttachMenuEx] GetMenuItemInfo for '
|
||||||
+ AMenuItem.Parent.Name + ' with ButtonID = AMenuItem.Parent.Command = ' + IntToStr(AMenuItem.Parent.Command));
|
+ AMenuItem.Parent.Name + ' with ButtonID = AMenuItem.Parent.Command = ' + IntToStr(AMenuItem.Parent.Command));
|
||||||
@ -751,7 +748,7 @@ begin
|
|||||||
{$ifndef Win32}
|
{$ifndef Win32}
|
||||||
AMenu := AMenuItem.GetParentMenu;
|
AMenu := AMenuItem.GetParentMenu;
|
||||||
{$ifdef VerboseWinCEMenu}
|
{$ifdef VerboseWinCEMenu}
|
||||||
DebugLn(Format('[TWinCEWSMenuItem.SetCaption] ACaption:%s ACommand:%d',
|
DebugLn(Format('START [TWinCEWSMenuItem.SetCaption] ACaption: %s ACommand: %d',
|
||||||
[AMenuItem.Caption, AMenuItem.Command]));
|
[AMenuItem.Caption, AMenuItem.Command]));
|
||||||
{$endif}
|
{$endif}
|
||||||
|
|
||||||
@ -792,6 +789,13 @@ begin
|
|||||||
DebugLn('[TWinCEWSMenuItem.SetCaption] TB_SETBUTTONINFO with ButtonID: ' + IntToStr(MenuBarRLID));
|
DebugLn('[TWinCEWSMenuItem.SetCaption] TB_SETBUTTONINFO with ButtonID: ' + IntToStr(MenuBarRLID));
|
||||||
{$endif}
|
{$endif}
|
||||||
SendMessageW(h, TB_SETBUTTONINFO, MenuBarRLID, LPARAM(@bi));
|
SendMessageW(h, TB_SETBUTTONINFO, MenuBarRLID, LPARAM(@bi));
|
||||||
|
end
|
||||||
|
// Second-Level menu items for atKeyPadDevice systems
|
||||||
|
else if (Application.ApplicationType = atKeyPadDevice) and
|
||||||
|
(AMenu <> nil) and (AMenu is TMainMenu) and
|
||||||
|
(AMenuItem.Parent.Parent = AMenu.Items) then
|
||||||
|
begin
|
||||||
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
{$endif}
|
{$endif}
|
||||||
@ -882,7 +886,6 @@ end;
|
|||||||
|
|
||||||
initialization
|
initialization
|
||||||
|
|
||||||
menuiteminfosize := SizeOf(TMenuItemInfo);
|
|
||||||
MenuItemsList := TStringList.Create;
|
MenuItemsList := TStringList.Create;
|
||||||
|
|
||||||
MenuHandleList := TFPList.Create;
|
MenuHandleList := TFPList.Create;
|
||||||
|
Loading…
Reference in New Issue
Block a user