Identation fixes.

git-svn-id: trunk@14169 -
This commit is contained in:
sekelsenmat 2008-02-17 16:38:20 +00:00
parent 7a50172ef9
commit a4166c0986

View File

@ -126,10 +126,10 @@ SPI_GETPLATFORMTYPE = 257;//roozbeh : should be moved to windows unit
function WStrCmp( W1, W2: PWideChar ): Integer; function WStrCmp( W1, W2: PWideChar ): Integer;
var var
counter: Integer; counter: Integer;
Begin begin
counter := 0; counter := 0;
While W1[counter] = W2[counter] do while W1[counter] = W2[counter] do
Begin begin
if (W2[counter] = #0) or (W1[counter] = #0) then if (W2[counter] = #0) or (W1[counter] = #0) then
break; break;
Inc(counter); Inc(counter);
@ -145,12 +145,13 @@ s:widestring;
begin begin
Result := false; Result := false;
if SystemParametersInfo(SPI_GETPLATFORMTYPE,sizeof(buf),@buf,0) then if SystemParametersInfo(SPI_GETPLATFORMTYPE,sizeof(buf),@buf,0) then
begin
if WStrCmp(@buf,PWideChar('SmartPhone')) = 0 then if WStrCmp(@buf,PWideChar('SmartPhone')) = 0 then
Result := true Result := true
else else
Result := false//roozbeh : either it is 'PocketPC' or something else :) Result := false;//roozbeh : either it is 'PocketPC' or something else :)
else end
if GetLastError=ERROR_ACCESS_DENIED then else if GetLastError=ERROR_ACCESS_DENIED then
Result := true; Result := true;
end; end;
@ -165,12 +166,14 @@ hPop : HMENU;
uIDNewItem : integer; uIDNewItem : integer;
begin begin
while RemoveMenu(dstMenu,0,MF_BYPOSITION) do ; while RemoveMenu(dstMenu,0,MF_BYPOSITION) do ;
i:=0; i:=0;
mi.cbSize:=SizeOf(mi); mi.cbSize:=SizeOf(mi);
mi.fMask:=MIIM_SUBMENU or MIIM_TYPE or MIIM_ID or MIIM_STATE; mi.fMask:=MIIM_SUBMENU or MIIM_TYPE or MIIM_ID or MIIM_STATE;
mi.dwTypeData:=@buf; mi.dwTypeData:=@buf;
while GetMenuItemInfo(srcMenu, i, True, mi) do begin while GetMenuItemInfo(srcMenu, i, True, mi) do
begin
buf[mi.cch]:=#0; buf[mi.cch]:=#0;
fState:=MF_STRING; fState:=MF_STRING;
if mi.fState and MFS_DISABLED <> 0 then if mi.fState and MFS_DISABLED <> 0 then
@ -235,24 +238,29 @@ begin
if (mbi.hwndMB = 0) or ( if (mbi.hwndMB = 0) or (
(not ((boolean(SendMessage (mbi.hwndMB, TB_COMMANDTOINDEX, MenuBarID_L, 0) + 1)) xor (hasLMenu))) and (not ((boolean(SendMessage (mbi.hwndMB, TB_COMMANDTOINDEX, MenuBarID_L, 0) + 1)) xor (hasLMenu))) and
(not ((boolean(SendMessage (mbi.hwndMB, TB_COMMANDTOINDEX, MenuBarID_R, 0) + 1)) xor (hasRMenu)))) (not ((boolean(SendMessage (mbi.hwndMB, TB_COMMANDTOINDEX, MenuBarID_R, 0) + 1)) xor (hasRMenu))))
then begin then
begin
if not SHCreateMenuBar(@mbi) then if not SHCreateMenuBar(@mbi) then
begin begin
//MsgBox('not ok',0); //MsgBox('not ok',0);
exit; exit;
end; end;
end; end;
while SendMessage(mbi.hwndMB, TB_DELETEBUTTON, 0, 0) <> 0 do ; while SendMessage(mbi.hwndMB, TB_DELETEBUTTON, 0, 0) <> 0 do ;
with mi do begin with mi do
begin
cbSize:=SizeOf(mi); cbSize:=SizeOf(mi);
fMask:=MIIM_SUBMENU or MIIM_TYPE or MIIM_ID or MIIM_STATE; fMask:=MIIM_SUBMENU or MIIM_TYPE or MIIM_ID or MIIM_STATE;
dwTypeData:=@buf; dwTypeData:=@buf;
end; end;
if Menu <> 0 then begin if Menu <> 0 then
begin
i:=0; i:=0;
while True do begin while True do
begin
mi.cch:=SizeOf(buf); mi.cch:=SizeOf(buf);
if not GetMenuItemInfo(Menu, i, True, @mi) then if not GetMenuItemInfo(Menu, i, True, @mi) then
break; break;
@ -326,7 +334,8 @@ begin
end; end;
function FindMenuItemAccelerator(const ACharCode: char; const AMenuHandle: HMENU): integer; function FindMenuItemAccelerator(const ACharCode: char; const AMenuHandle: HMENU): integer;
var MenuItemIndex: integer; var
MenuItemIndex: integer;
ItemInfo: MENUITEMINFO; ItemInfo: MENUITEMINFO;
FirstMenuItem: TMenuItem; FirstMenuItem: TMenuItem;
SiblingMenuItem: TmenuItem; SiblingMenuItem: TmenuItem;
@ -387,7 +396,8 @@ end;
(* Get the maximum length of the given string in pixels *) (* Get the maximum length of the given string in pixels *)
function StringSize(const aCaption: String; const aHDC: HDC; const aDecoration:TCaptionFlagsSet): TSize; function StringSize(const aCaption: String; const aHDC: HDC; const aDecoration:TCaptionFlagsSet): TSize;
var oldFont: HFONT; var
oldFont: HFONT;
newFont: HFONT; newFont: HFONT;
tmpRect: Windows.RECT; tmpRect: Windows.RECT;
wCaption : WideString; wCaption : WideString;
@ -503,7 +513,8 @@ begin
end; end;
procedure DrawMenuItemCheckMark(const aMenuItem: TMenuItem; const aHDC: HDC; const aRect: Windows.RECT; const aSelected: boolean); procedure DrawMenuItemCheckMark(const aMenuItem: TMenuItem; const aHDC: HDC; const aRect: Windows.RECT; const aSelected: boolean);
var checkMarkWidth: integer; var
checkMarkWidth: integer;
checkMarkHeight: integer; checkMarkHeight: integer;
hdcMem: HDC; hdcMem: HDC;
monoBitmap: HBITMAP; monoBitmap: HBITMAP;
@ -530,7 +541,8 @@ begin
end; end;
procedure DrawMenuItemText(const aMenuItem: TMenuItem; const aHDC: HDC; aRect: Windows.RECT; const aSelected: boolean); procedure DrawMenuItemText(const aMenuItem: TMenuItem; const aHDC: HDC; aRect: Windows.RECT; const aSelected: boolean);
var crText: COLORREF; var
crText: COLORREF;
crBkgnd: COLORREF; crBkgnd: COLORREF;
TmpLength: integer; TmpLength: integer;
TmpHeight: integer; TmpHeight: integer;
@ -545,8 +557,10 @@ begin
crBkgnd := BackgroundColorMenu(aSelected, aMenuItem.IsInMenuBar); crBkgnd := BackgroundColorMenu(aSelected, aMenuItem.IsInMenuBar);
SetTextColor(aHDC, crText); SetTextColor(aHDC, crText);
SetBkColor(aHDC, crBkgnd); SetBkColor(aHDC, crBkgnd);
if aMenuItem.Default then decoration := [cfBold] if aMenuItem.Default then decoration := [cfBold]
else decoration := []; else decoration := [];
newFont := getMenuItemFont(decoration); newFont := getMenuItemFont(decoration);
oldFont := SelectObject(aHDC, newFont); oldFont := SelectObject(aHDC, newFont);
ExtTextOutW(aHDC, 0, 0, ETO_OPAQUE, @aRect, PWideChar(''), 0, nil); ExtTextOutW(aHDC, 0, 0, ETO_OPAQUE, @aRect, PWideChar(''), 0, nil);
@ -569,7 +583,8 @@ begin
end; end;
procedure DrawMenuItemIcon(const aMenuItem: TMenuItem; const aHDC: HDC; const aRect: Windows.RECT; const aSelected: boolean); procedure DrawMenuItemIcon(const aMenuItem: TMenuItem; const aHDC: HDC; const aRect: Windows.RECT; const aSelected: boolean);
var hdcMem: HDC; var
hdcMem: HDC;
hbmpOld: HBITMAP; hbmpOld: HBITMAP;
begin begin
hdcMem := aMenuItem.Bitmap.Canvas.Handle; hdcMem := aMenuItem.Bitmap.Canvas.Handle;
@ -582,7 +597,8 @@ procedure DrawMenuItem(const aMenuItem: TMenuItem; const aHDC: HDC; const aRect:
begin begin
if aMenuItem.IsLine then if aMenuItem.IsLine then
DrawSeparator(aHDC, aRect) DrawSeparator(aHDC, aRect)
else begin else
begin
DrawMenuItemText(aMenuItem, aHDC, aRect, aSelected); DrawMenuItemText(aMenuItem, aHDC, aRect, aSelected);
if aMenuItem.Checked then if aMenuItem.Checked then
DrawMenuItemCheckMark(aMenuItem, aHDC, aRect, aSelected); DrawMenuItemCheckMark(aMenuItem, aHDC, aRect, aSelected);
@ -684,7 +700,8 @@ begin
if AMenuItem.Parent.Parent<>nil then if AMenuItem.Parent.Parent<>nil then
begin begin
ParentOfParent := AMenuItem.Parent.Parent.Handle; ParentOfParent := AMenuItem.Parent.Parent.Handle;
with MenuInfo do begin with MenuInfo do
begin
cbSize := menuiteminfosize; cbSize := menuiteminfosize;
fMask:=MIIM_SUBMENU; fMask:=MIIM_SUBMENU;
end; end;
@ -700,7 +717,6 @@ begin
end; end;
end; end;
begin
fState:=MF_STRING or MF_BYPOSITION; fState:=MF_STRING or MF_BYPOSITION;
if AMenuItem.Enabled then fState:=fState or MF_ENABLED else fstate:=fState or MF_GRAYED; if AMenuItem.Enabled then fState:=fState or MF_ENABLED else fstate:=fState or MF_GRAYED;
if AMenuItem.Checked then fState:=fState or MF_CHECKED; if AMenuItem.Checked then fState:=fState or MF_CHECKED;
@ -709,8 +725,9 @@ begin
begin begin
cmd := AMenuItem.Handle; cmd := AMenuItem.Handle;
fState := fState or MF_POPUP; fState := fState or MF_POPUP;
end else end
else
begin
if not AMenuItem.IsLine then if not AMenuItem.IsLine then
begin begin
//fState:=fState or MF_OWNERDRAW;//roozbeh:couldnt make ownerdrawn menus work so far! //fState:=fState or MF_OWNERDRAW;//roozbeh:couldnt make ownerdrawn menus work so far!
@ -721,6 +738,7 @@ begin
//if AMenuItem.RadioItem then fType := fType or MFT_RADIOCHECK; //if AMenuItem.RadioItem then fType := fType or MFT_RADIOCHECK;
//if AMenuItem.RightJustify then fType := fType or MFT_RIGHTJUSTIFY; //if AMenuItem.RightJustify then fType := fType or MFT_RIGHTJUSTIFY;
end; end;
//roozbeh..i really doubt this works! //roozbeh..i really doubt this works!
wCaption := AmenuItem.Caption; wCaption := AmenuItem.Caption;
@ -834,6 +852,7 @@ initialization
menuiteminfosize := sizeof(TMenuItemInfo); menuiteminfosize := sizeof(TMenuItemInfo);
MenuItemsList := TStringList.Create; MenuItemsList := TStringList.Create;
//////////////////////////////////////////////////// ////////////////////////////////////////////////////
// I M P O R T A N T // I M P O R T A N T
//////////////////////////////////////////////////// ////////////////////////////////////////////////////
@ -845,6 +864,9 @@ initialization
// RegisterWSComponent(TMainMenu, TWinCEWSMainMenu); // RegisterWSComponent(TMainMenu, TWinCEWSMainMenu);
RegisterWSComponent(TPopupMenu, TWinCEWSPopupMenu); RegisterWSComponent(TPopupMenu, TWinCEWSPopupMenu);
//////////////////////////////////////////////////// ////////////////////////////////////////////////////
finalization finalization
MenuItemsList.Free; MenuItemsList.Free;
end. end.