Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 1.0, 1.0.1, and 1.0.2

shellext: replace tabs with spaces in CShellExtCMenu.cpp

Changeset 5c9682fb8cd7

Parent 3ce6960d9c85

by Adrian Buehlmann

Changes to one file · Browse files at 5c9682fb8cd7 Showing diff from parent 3ce6960d9c85 Diff from another changeset...

 
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
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
262
263
264
 
271
272
273
274
275
 
 
276
277
278
 
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
312
313
314
 
482
483
484
485
486
487
488
489
 
 
 
 
 
490
491
492
493
494
495
496
 
 
 
 
 
 
497
498
499
 
504
505
506
507
508
509
 
 
 
510
511
 
512
513
514
515
 
 
 
516
517
518
 
 
519
520
521
 
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
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
 
271
272
273
 
 
274
275
276
277
278
 
280
281
282
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
 
482
483
484
 
 
 
 
 
485
486
487
488
489
490
 
 
 
 
 
 
491
492
493
494
495
496
497
498
499
 
504
505
506
 
 
 
507
508
509
510
 
511
512
 
 
 
513
514
515
516
 
 
517
518
519
520
521
@@ -222,43 +222,43 @@
  HMENU hMenu, UINT indexMenu, UINT idCmd,   const std::wstring& menuText, const std::string& iconName)  { - MENUITEMINFOW mi; - memset(&mi, 0, sizeof(mi)); + MENUITEMINFOW mi; + memset(&mi, 0, sizeof(mi));   mi.cbSize = sizeof(mi);   mi.dwTypeData = const_cast<wchar_t*>(menuText.c_str());   mi.cch = static_cast<UINT>(menuText.length());   mi.wID = idCmd;   mi.fType = MFT_STRING;   - if (SysInfo::Instance().IsVistaOrLater()) - { - TDEBUG_TRACE(" InsertMenuItemWithIcon1: Vista or later detected, using modern context menu style"); - HBITMAP hBmp = GetTortoiseIconBitmap(iconName); - if (hBmp) - { - mi.fMask = MIIM_STRING | MIIM_FTYPE | MIIM_ID | MIIM_BITMAP; - mi.hbmpItem = hBmp; - } - else - { - TDEBUG_TRACE(" InsertMenuItemWithIcon1: can't find " + iconName); - mi.fMask = MIIM_TYPE | MIIM_ID; - } - } - else - { - HICON h = GetTortoiseIcon(iconName); - if (h) - { - mi.fMask = MIIM_STRING | MIIM_FTYPE | MIIM_ID | MIIM_BITMAP | MIIM_DATA; - mi.dwItemData = (ULONG_PTR) h; - mi.hbmpItem = HBMMENU_CALLBACK; - } - else - { - TDEBUG_TRACE(" InsertMenuItemWithIcon1: can't find " + iconName); - mi.fMask = MIIM_TYPE | MIIM_ID; - } + if (SysInfo::Instance().IsVistaOrLater()) + { + TDEBUG_TRACE(" InsertMenuItemWithIcon1: Vista or later detected, using modern context menu style"); + HBITMAP hBmp = GetTortoiseIconBitmap(iconName); + if (hBmp) + { + mi.fMask = MIIM_STRING | MIIM_FTYPE | MIIM_ID | MIIM_BITMAP; + mi.hbmpItem = hBmp; + } + else + { + TDEBUG_TRACE(" InsertMenuItemWithIcon1: can't find " + iconName); + mi.fMask = MIIM_TYPE | MIIM_ID; + } + } + else + { + HICON h = GetTortoiseIcon(iconName); + if (h) + { + mi.fMask = MIIM_STRING | MIIM_FTYPE | MIIM_ID | MIIM_BITMAP | MIIM_DATA; + mi.dwItemData = (ULONG_PTR) h; + mi.hbmpItem = HBMMENU_CALLBACK; + } + else + { + TDEBUG_TRACE(" InsertMenuItemWithIcon1: can't find " + iconName); + mi.fMask = MIIM_TYPE | MIIM_ID; + }   }   InsertMenuItemW(hMenu, indexMenu, TRUE, &mi);   @@ -271,8 +271,8 @@
  HMENU hMenu, HMENU hSubMenu, UINT indexMenu, UINT idCmd,   const std::wstring& menuText, const std::string& iconName)  { - MENUITEMINFOW mi; - memset(&mi, 0, sizeof(mi)); + MENUITEMINFOW mi; + memset(&mi, 0, sizeof(mi));   mi.cbSize = sizeof(mi);   mi.fType = MFT_STRING;   mi.dwTypeData = const_cast<wchar_t*>(menuText.c_str()); @@ -280,35 +280,35 @@
  mi.wID = idCmd;   mi.hSubMenu = hSubMenu;   - if (SysInfo::Instance().IsVistaOrLater()) - { - TDEBUG_TRACE(" InsertMenuItemWithIcon1: Vista or later detected, using modern context menu style"); - HBITMAP hBmp = GetTortoiseIconBitmap(iconName); - if (hBmp) - { - mi.fMask = MIIM_SUBMENU | MIIM_STRING | MIIM_FTYPE | MIIM_ID | MIIM_BITMAP; - mi.hbmpItem = hBmp; - } - else - { - TDEBUG_TRACE(" InsertSubMenuItemWithIcon2: can't find " + iconName); - mi.fMask = MIIM_TYPE | MIIM_ID; - } - } - else - { - HICON h = GetTortoiseIcon(iconName); - if (h) - { - mi.fMask = MIIM_SUBMENU | MIIM_STRING | MIIM_ID; - mi.dwItemData = (ULONG_PTR) h; - mi.hbmpItem = HBMMENU_CALLBACK; - } - else - { - TDEBUG_TRACE(" InsertSubMenuItemWithIcon2: can't find " + iconName); - mi.fMask = MIIM_TYPE | MIIM_ID; - } + if (SysInfo::Instance().IsVistaOrLater()) + { + TDEBUG_TRACE(" InsertMenuItemWithIcon1: Vista or later detected, using modern context menu style"); + HBITMAP hBmp = GetTortoiseIconBitmap(iconName); + if (hBmp) + { + mi.fMask = MIIM_SUBMENU | MIIM_STRING | MIIM_FTYPE | MIIM_ID | MIIM_BITMAP; + mi.hbmpItem = hBmp; + } + else + { + TDEBUG_TRACE(" InsertSubMenuItemWithIcon2: can't find " + iconName); + mi.fMask = MIIM_TYPE | MIIM_ID; + } + } + else + { + HICON h = GetTortoiseIcon(iconName); + if (h) + { + mi.fMask = MIIM_SUBMENU | MIIM_STRING | MIIM_ID; + mi.dwItemData = (ULONG_PTR) h; + mi.hbmpItem = HBMMENU_CALLBACK; + } + else + { + TDEBUG_TRACE(" InsertSubMenuItemWithIcon2: can't find " + iconName); + mi.fMask = MIIM_TYPE | MIIM_ID; + }   }     InsertMenuItemW(hMenu, indexMenu, TRUE, &mi); @@ -482,18 +482,18 @@
  if (isSeparator && indexSubMenu > 0)   RemoveMenu(hSubMenu, indexSubMenu - 1, MF_BYPOSITION);   - if (SysInfo::Instance().IsVistaOrLater()) - { - MENUINFO MenuInfo; - - memset(&MenuInfo, 0, sizeof(MenuInfo)); + 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(hSubMenu, &MenuInfo); - } + 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"); @@ -504,18 +504,18 @@
    InitStatus::check();   - if (SysInfo::Instance().IsVistaOrLater()) - { - MENUINFO MenuInfo; + if (SysInfo::Instance().IsVistaOrLater()) + { + MENUINFO MenuInfo;   - memset(&MenuInfo, 0, sizeof(MenuInfo)); + memset(&MenuInfo, 0, sizeof(MenuInfo));   - MenuInfo.cbSize = sizeof(MenuInfo); - MenuInfo.fMask = MIM_STYLE | MIM_APPLYTOSUBMENUS; - MenuInfo.dwStyle = MNS_CHECKORBMP; + MenuInfo.cbSize = sizeof(MenuInfo); + MenuInfo.fMask = MIM_STYLE | MIM_APPLYTOSUBMENUS; + MenuInfo.dwStyle = MNS_CHECKORBMP;   - SetMenuInfo(hMenu, &MenuInfo); - } + SetMenuInfo(hMenu, &MenuInfo); + }     return ResultFromShort(idCmd - idCmdFirst);  }