Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 1.9.3, 2.0, and 2.0.1

hgtk cmenu: Consolidate "VistaOrLater" menu styling into reused function

This is taken from TortoiseSVN.

Changeset ad2c317d2d1e

Parent 3d363c94dc34

by Daniel Atallah

Changes to 2 files · Browse files at ad2c317d2d1e Showing diff from parent 3d363c94dc34 Diff from another changeset...

 
398
399
400
 
 
 
 
 
 
 
 
 
 
 
 
 
 
401
402
403
 
548
549
550
551
552
553
554
555
 
556
557
558
559
560
561
562
563
564
565
 
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
 
585
586
587
 
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
 
562
563
564
 
 
 
 
 
565
566
 
 
 
 
 
 
567
568
569
 
574
575
576
 
 
 
 
 
 
 
 
 
 
 
 
577
578
579
580
@@ -398,6 +398,20 @@
  return 0;  }   +void +CShellExtCMenu::TweakMenuForVista(HMENU hMenu) +{ + if (!SysInfo::Instance().IsVistaOrLater()) + return; + + MENUINFO MenuInfo = {}; + MenuInfo.cbSize = sizeof(MenuInfo); + MenuInfo.fMask = MIM_STYLE | MIM_APPLYTOSUBMENUS; + MenuInfo.dwStyle = MNS_CHECKORBMP; + + SetMenuInfo(hMenu, &MenuInfo); +} +  #define ResultFromShort(i) ResultFromScode(MAKE_SCODE(SEVERITY_SUCCESS, 0, (USHORT)(i)))    // IContextMenu @@ -548,18 +562,8 @@
  if (isSeparator && indexSubMenu > 0)   RemoveMenu(hSubMenu, indexSubMenu - 1, MF_BYPOSITION);   - if (SysInfo::Instance().IsVistaOrLater()) - { - MENUINFO MenuInfo; - - memset(&MenuInfo, 0, sizeof(MenuInfo)); + TweakMenuForVista(hSubMenu);   - MenuInfo.cbSize = sizeof(MenuInfo); - MenuInfo.fMask = MIM_STYLE | MIM_APPLYTOSUBMENUS; - MenuInfo.dwStyle = MNS_CHECKORBMP; - - SetMenuInfo(hSubMenu, &MenuInfo); - }   }     TDEBUG_TRACE(" CShellExtCMenu::QueryContextMenu: adding main THG menu"); @@ -570,18 +574,7 @@
    InitStatus::check();   - if (SysInfo::Instance().IsVistaOrLater()) - { - MENUINFO MenuInfo; - - memset(&MenuInfo, 0, sizeof(MenuInfo)); - - MenuInfo.cbSize = sizeof(MenuInfo); - MenuInfo.fMask = MIM_STYLE | MIM_APPLYTOSUBMENUS; - MenuInfo.dwStyle = MNS_CHECKORBMP; - - SetMenuInfo(hMenu, &MenuInfo); - } + TweakMenuForVista(hMenu);     return ResultFromShort(idCmd - idCmdFirst);  }
 
14
15
16
 
17
18
19
 
14
15
16
17
18
19
20
@@ -14,6 +14,7 @@
  std::string myFolder;     void DoHgtk(const std::string&); + void TweakMenuForVista(HMENU menu);    public:   explicit CShellExtCMenu(char dummy);