Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

854 lines
22 KiB

  1. //
  2. // intlmenu.cpp
  3. //
  4. #include "private.h"
  5. #include "regstr.h"
  6. #include "resource.h"
  7. #include "globals.h"
  8. #include "tipbar.h"
  9. #include "cuimenu.h"
  10. #include "intlmenu.h"
  11. #include "balloon.h"
  12. #include "xstring.h"
  13. #include "helpers.h"
  14. #include "cmydc.h"
  15. #include "cresstr.h"
  16. #include "cregkey.h"
  17. #include "iconlib.h"
  18. #include "delay.h"
  19. #include "utbdlgs.h"
  20. extern HINSTANCE g_hInst;
  21. const TCHAR c_szCTFMon[] = TEXT("CTFMON.EXE");
  22. //////////////////////////////////////////////////////////////////////////////
  23. //
  24. // misc func
  25. //
  26. //////////////////////////////////////////////////////////////////////////////
  27. //+---------------------------------------------------------------------------
  28. //
  29. // GetBitmapFromItem
  30. //
  31. //----------------------------------------------------------------------------
  32. BOOL GetBitmapFromItem(CTipbarItem *pItem, HBITMAP *phbmp, HBITMAP *phbmpMask)
  33. {
  34. CTipbarButtonItem *plbiButton = NULL;
  35. CTipbarBitmapButtonItem *plbiBitmapButton = NULL;
  36. CTipbarBitmapItem *plbiBitmap = NULL;
  37. CTipbarBalloonItem *plbiBalloon = NULL;
  38. HBITMAP hbmp = NULL;
  39. HBITMAP hbmpMask = NULL;
  40. BOOL bRet = FALSE;
  41. *phbmp = NULL;
  42. *phbmpMask = NULL;
  43. if (FAILED(pItem->QueryInterface(IID_PRIV_BUTTONITEM,
  44. (void **)&plbiButton)) &&
  45. FAILED(pItem->QueryInterface(IID_PRIV_BITMAPBUTTONITEM,
  46. (void **)&plbiBitmapButton)) &&
  47. FAILED(pItem->QueryInterface(IID_PRIV_BITMAPITEM,
  48. (void **)&plbiBitmap)) &&
  49. FAILED(pItem->QueryInterface(IID_PRIV_BALLOONITEM,
  50. (void **)&plbiBalloon)))
  51. {
  52. goto Exit;
  53. }
  54. if (plbiButton)
  55. {
  56. HICON hIcon;
  57. int cxSmIcon;
  58. int cySmIcon;
  59. #ifdef SCALE_ICON
  60. cxSmIcon = cySmIcon = GetMenuIconHeight(NULL);
  61. #else
  62. cxSmIcon = 16;
  63. cySmIcon = 16;
  64. #endif
  65. SIZE size = {cxSmIcon, cySmIcon};
  66. if (SUCCEEDED(plbiButton->GetLangBarItem()->GetIcon(&hIcon)))
  67. {
  68. if (hIcon)
  69. {
  70. HICON hSmIcon = (HICON)CopyImage(hIcon,
  71. IMAGE_ICON,
  72. cxSmIcon, cySmIcon,
  73. LR_COPYFROMRESOURCE);
  74. GetIconBitmaps(hSmIcon ? hSmIcon : hIcon, &hbmp, &hbmpMask, &size);
  75. if (hSmIcon)
  76. DestroyIcon(hSmIcon);
  77. DestroyIcon(hIcon);
  78. }
  79. }
  80. }
  81. else if (plbiBitmapButton)
  82. {
  83. SIZE sizeDef = {32,16};
  84. SIZE size;
  85. plbiBitmapButton->GetLangBarItem()->GetPreferredSize(&sizeDef, &size);
  86. plbiBitmapButton->GetLangBarItem()->DrawBitmap(size.cx, size.cy, 0, &hbmp, &hbmpMask);
  87. }
  88. else if (plbiBitmap)
  89. {
  90. SIZE sizeDef = {32,16};
  91. SIZE size;
  92. plbiBitmap->GetLangBarItem()->GetPreferredSize(&sizeDef, &size);
  93. plbiBitmap->GetLangBarItem()->DrawBitmap(size.cx, size.cy, 0, &hbmp, &hbmpMask);
  94. }
  95. else if (plbiBalloon)
  96. {
  97. goto Exit;
  98. }
  99. if (hbmp)
  100. {
  101. bRet = TRUE;
  102. *phbmp = hbmp;
  103. *phbmpMask = hbmpMask;
  104. }
  105. else
  106. {
  107. if (hbmpMask)
  108. DeleteObject(hbmpMask);
  109. }
  110. Exit:
  111. SafeRelease(plbiButton);
  112. SafeRelease(plbiBitmapButton);
  113. SafeRelease(plbiBitmap);
  114. SafeRelease(plbiBalloon);
  115. return bRet;
  116. }
  117. //+---------------------------------------------------------------------------
  118. //
  119. // IsFELangId
  120. //
  121. //----------------------------------------------------------------------------
  122. BOOL IsFELangId(LANGID langid)
  123. {
  124. if ((langid == 0x411) ||
  125. (langid == 0x404) ||
  126. (langid == 0x412) ||
  127. (langid == 0x804))
  128. {
  129. return TRUE;
  130. }
  131. return FALSE;
  132. }
  133. //+---------------------------------------------------------------------------
  134. //
  135. // CheckCloseMenuAvailable
  136. //
  137. //----------------------------------------------------------------------------
  138. BOOL CheckCloseMenuAvailable()
  139. {
  140. ITfInputProcessorProfiles *ppip = NULL;
  141. BOOL bRet = FALSE;
  142. LANGID *plangid = NULL;
  143. ULONG ulCnt;
  144. ULONG ul;
  145. //
  146. // If g_bShowCloseMenu is on, show "Close" menu item anyway....
  147. //
  148. if (g_bShowCloseMenu)
  149. {
  150. bRet = TRUE;
  151. goto Exit;
  152. }
  153. if (FAILED(TF_CreateInputProcessorProfiles(&ppip)))
  154. goto Exit;
  155. if (FAILED(ppip->GetLanguageList(&plangid, &ulCnt)))
  156. goto Exit;
  157. //
  158. // If two or more languages are registered, don't show "Close" menu item.
  159. //
  160. for (ul = 0; ul < ulCnt; ul++)
  161. {
  162. //
  163. // If the languages is FE, don't show "Close" menu item.
  164. //
  165. if (IsFELangId(plangid[ul]))
  166. goto Exit;
  167. }
  168. bRet = TRUE;
  169. Exit:
  170. if (plangid)
  171. CoTaskMemFree(plangid);
  172. SafeRelease(ppip);
  173. return bRet;
  174. }
  175. //////////////////////////////////////////////////////////////////////////////
  176. //
  177. // CUTBIntelliMenu
  178. //
  179. //////////////////////////////////////////////////////////////////////////////
  180. //+---------------------------------------------------------------------------
  181. //
  182. // ctor
  183. //
  184. //----------------------------------------------------------------------------
  185. CUTBIntelliMenu::CUTBIntelliMenu(CTipbarWnd *ptw)
  186. {
  187. _ptw = ptw;
  188. }
  189. //+---------------------------------------------------------------------------
  190. //
  191. // dtor
  192. //
  193. //----------------------------------------------------------------------------
  194. CUTBIntelliMenu::~CUTBIntelliMenu()
  195. {
  196. }
  197. //+---------------------------------------------------------------------------
  198. //
  199. // Init
  200. //
  201. //----------------------------------------------------------------------------
  202. BOOL CUTBIntelliMenu::Init()
  203. {
  204. int nCnt;
  205. int i;
  206. BOOL bRet = FALSE;
  207. DWORD dwThreadId;
  208. _rgItem.Clear();
  209. _ptt = _ptw->GetFocusThread();
  210. if (!_ptt)
  211. goto Exit;
  212. dwThreadId = _ptt->_dwThreadId;
  213. // _ptt->UpdateItems();
  214. nCnt = _ptt->_rgItem.Count();
  215. for (i = 0; i < nCnt; i++)
  216. {
  217. CTipbarItem *pItem = _ptt->_rgItem.Get(i);
  218. if (!pItem->IsHiddenStatusControl())
  219. {
  220. CTipbarItem **ppItem = _rgItem.Append(1);
  221. if (ppItem)
  222. *ppItem = pItem;
  223. }
  224. }
  225. bRet = TRUE;
  226. Exit:
  227. return bRet;
  228. }
  229. //+---------------------------------------------------------------------------
  230. //
  231. // ShowUI
  232. //
  233. //----------------------------------------------------------------------------
  234. UINT CUTBIntelliMenu::ShowPopup(CUIFWindow *pcuiWndParent, const POINT pt, const RECT *prcArea)
  235. {
  236. if (_pCuiMenu)
  237. return 0;
  238. _pCuiMenu = CreateMenuUI();
  239. if (!_pCuiMenu)
  240. return 0;
  241. UINT uRet = _pCuiMenu->ShowModalPopup(pcuiWndParent, prcArea, TRUE);
  242. delete _pCuiMenu;
  243. _pCuiMenu = NULL;
  244. return uRet;
  245. }
  246. //+---------------------------------------------------------------------------
  247. //
  248. // CreateMenuUI
  249. //
  250. //----------------------------------------------------------------------------
  251. CUTBMenuWnd *CUTBIntelliMenu::CreateMenuUI()
  252. {
  253. CUTBMenuWnd *pCuiMenu;
  254. CUTBMenuItem *pCuiItem;
  255. int i;
  256. BOOL fInsertedItem = FALSE;
  257. DWORD dwCat = -1;
  258. if (!_ptw)
  259. {
  260. Assert(0);
  261. return NULL;
  262. }
  263. pCuiMenu = new CUTBMenuWnd(g_hInst, g_dwMenuStyle, 0);
  264. if (!pCuiMenu)
  265. return NULL;
  266. pCuiMenu->Initialize();
  267. if (!_ptw->IsInDeskBand() || !_ptw->IsSFNoExtraIcon())
  268. {
  269. for (i = 0; i < _rgItem.Count(); i++)
  270. {
  271. CTipbarItem *pItem = _rgItem.Get(i);
  272. HBITMAP hbmp = NULL;
  273. HBITMAP hbmpMask = NULL;
  274. CItemSortScore *pscore = pItem->GetItemSortScore();
  275. if (!GetBitmapFromItem(pItem, &hbmp, &hbmpMask))
  276. continue;
  277. pCuiItem = new CUTBMenuItem(pCuiMenu);
  278. if (!pCuiItem)
  279. break;
  280. if (dwCat != pscore->GetCat())
  281. {
  282. if (dwCat != -1)
  283. {
  284. pCuiMenu->InsertSeparator();
  285. }
  286. }
  287. dwCat = pscore->GetCat();
  288. pCuiItem->Initialize();
  289. pCuiItem->Init(i, pItem->GetDescriptionRef());
  290. if (pItem->IsVisibleInToolbar())
  291. pCuiItem->Check(TRUE);
  292. if (hbmp)
  293. pCuiItem->SetBitmap(hbmp);
  294. if (hbmpMask)
  295. pCuiItem->SetBitmapMask(hbmpMask);
  296. pCuiMenu->InsertItem(pCuiItem);
  297. fInsertedItem = TRUE;
  298. }
  299. if (fInsertedItem)
  300. pCuiMenu->InsertSeparator();
  301. }
  302. if (_ptw->IsInDeskBand())
  303. {
  304. if (!_ptw->IsSFNoExtraIcon())
  305. {
  306. pCuiItem = InsertItem(pCuiMenu,
  307. IDM_NONOTIFICATIONICONS,
  308. IDS_NOTIFICATIONICONS);
  309. if (pCuiItem)
  310. pCuiItem->Check(TRUE);
  311. }
  312. else
  313. {
  314. pCuiItem = InsertItem(pCuiMenu, IDM_NOTIFICATIONICONS, IDS_NOTIFICATIONICONS);
  315. }
  316. //
  317. // Always show the extra additional icons in case of single keyboard
  318. // layout.
  319. //
  320. if (_ptw->IsSingleKeyboardLayout())
  321. {
  322. if (pCuiItem)
  323. {
  324. pCuiItem->Check(TRUE);
  325. pCuiItem->Gray(TRUE);
  326. }
  327. }
  328. else
  329. {
  330. if (pCuiItem)
  331. pCuiItem->Gray(FALSE);
  332. }
  333. InsertItem(pCuiMenu, IDM_ADJUSTLANGBAND, IDS_ADJUSTLANGBAND);
  334. }
  335. if (pCuiItem = new CUTBMenuItem(pCuiMenu))
  336. {
  337. pCuiItem->Initialize();
  338. pCuiItem->Init(IDM_SHOWINPUTCPL, CRStr(IDS_SHOWINPUTCPL));
  339. pCuiMenu->InsertItem(pCuiItem);
  340. }
  341. if (pCuiItem = new CUTBMenuItem(pCuiMenu))
  342. {
  343. pCuiItem->Initialize();
  344. pCuiItem->Init(IDM_RESTOREDEFAULTS, CRStr(IDS_RESTOREDEFAULTS));
  345. pCuiMenu->InsertItem(pCuiItem);
  346. }
  347. return pCuiMenu;
  348. }
  349. //+---------------------------------------------------------------------------
  350. //
  351. // SelectMenuItem
  352. //
  353. //----------------------------------------------------------------------------
  354. BOOL CUTBIntelliMenu::SelectMenuItem(UINT uId)
  355. {
  356. UINT uCnt = _rgItem.Count();
  357. CTipbarItem *pItem = NULL;
  358. if (uId == IDM_SHOWINPUTCPL)
  359. {
  360. TF_RunInputCPL();
  361. }
  362. else if (uId == IDM_RESTOREDEFAULTS)
  363. {
  364. if (_ptw)
  365. _ptw->ClearLBItemList();
  366. }
  367. else if (uId == IDM_NOTIFICATIONICONS)
  368. {
  369. if (_ptw)
  370. {
  371. _ptw->ClearDeskbandSizeAdjusted();
  372. _ptw->GetLangBarMgr()->ShowFloating(TF_SFT_EXTRAICONSONMINIMIZED);
  373. }
  374. }
  375. else if (uId == IDM_NONOTIFICATIONICONS)
  376. {
  377. if (_ptw)
  378. {
  379. _ptw->ClearDeskbandSizeAdjusted();
  380. _ptw->GetLangBarMgr()->ShowFloating(TF_SFT_NOEXTRAICONSONMINIMIZED);
  381. }
  382. }
  383. else if (uId == IDM_ADJUSTLANGBAND)
  384. {
  385. if (_ptw)
  386. _ptw->AdjustDeskBandSize(TRUE);
  387. }
  388. else if (IDM_ADDREMOVESTART <= uId)
  389. {
  390. pItem = _ptt->_rgItem.Get(uId - IDM_ADDREMOVESTART);
  391. }
  392. else if (uCnt > uId)
  393. {
  394. pItem = _rgItem.Get(uId);
  395. }
  396. if (pItem)
  397. {
  398. LBDemoteLevel lbdl = pItem->IsVisibleInToolbar() ? DL_HIDDENLEVEL2 : DL_SHOWN;
  399. if (lbdl != DL_SHOWN)
  400. {
  401. BOOL fFound = FALSE;
  402. int i;
  403. CMyRegKey key;
  404. for (i = 0; i < _ptt->_rgItem.Count(); i++)
  405. {
  406. CTipbarItem *pItemTmp = _ptt->_rgItem.Get(i);
  407. if (pItemTmp)
  408. {
  409. if (pItemTmp == pItem)
  410. continue;
  411. if (pItemTmp->IsHideOnNoOtherItems())
  412. continue;
  413. if (!pItemTmp->IsVisibleInToolbar())
  414. continue;
  415. fFound = TRUE;
  416. break;
  417. }
  418. }
  419. if (!fFound)
  420. {
  421. int nRet = MessageBox(_ptt->_ptw->GetWnd(),
  422. CRStr2(IDS_NOMOREITEM),
  423. CRStr(IDS_LANGBAR),
  424. MB_YESNO);
  425. if (nRet != IDYES)
  426. return TRUE;
  427. //
  428. // we close language bar instead of hiding the item.
  429. //
  430. _ptt->_ptw->GetLangBarMgr()->ShowFloating(TF_SFT_HIDDEN);
  431. if (key.Open(HKEY_CURRENT_USER, REGSTR_PATH_RUN, KEY_ALL_ACCESS) == S_OK)
  432. key.DeleteValue(c_szCTFMon);
  433. return TRUE;
  434. }
  435. }
  436. _ptw->_itemList.SetDemoteLevel(*pItem->GetGUID(), lbdl);
  437. if (lbdl == DL_SHOWN)
  438. _ptw->_itemList.StartDemotingTimer(*pItem->GetGUID(), TRUE);
  439. //
  440. // we adjust the deskband if Item is added or removed by
  441. // the end user. But we don't want to adjust if there is a room
  442. // to draw all items.
  443. //
  444. _ptw->ClearDeskbandSizeAdjusted();
  445. _ptw->SetAdjustDeskbandIfNoRoom();
  446. pItem->AddRemoveMeToUI(lbdl == DL_SHOWN);
  447. }
  448. return TRUE;
  449. }
  450. //////////////////////////////////////////////////////////////////////////////
  451. //
  452. // CUTBContextMenu
  453. //
  454. //////////////////////////////////////////////////////////////////////////////
  455. //+---------------------------------------------------------------------------
  456. //
  457. // ctor
  458. //
  459. //----------------------------------------------------------------------------
  460. CUTBContextMenu::CUTBContextMenu(CTipbarWnd *ptw)
  461. {
  462. _ptw = ptw;
  463. }
  464. //+---------------------------------------------------------------------------
  465. //
  466. // dtor
  467. //
  468. //----------------------------------------------------------------------------
  469. CUTBContextMenu::~CUTBContextMenu()
  470. {
  471. }
  472. //+---------------------------------------------------------------------------
  473. //
  474. // Init
  475. //
  476. //----------------------------------------------------------------------------
  477. BOOL CUTBContextMenu::Init()
  478. {
  479. BOOL bRet = FALSE;
  480. DWORD dwThreadId;
  481. _ptt = _ptw->GetFocusThread();
  482. if (!_ptt)
  483. return FALSE;
  484. dwThreadId = _ptt->_dwThreadId;
  485. return TRUE;
  486. }
  487. //+---------------------------------------------------------------------------
  488. //
  489. // ShowUI
  490. //
  491. //----------------------------------------------------------------------------
  492. UINT CUTBContextMenu::ShowPopup(CUIFWindow *pcuiWndParent, const POINT pt, const RECT *prcArea, BOOL fExtendMenuItems)
  493. {
  494. if (g_bWinLogon)
  495. return 0;
  496. if (_pCuiMenu)
  497. return CUI_MENU_UNSELECTED;
  498. if (!(_pCuiMenu = CreateMenuUI(fExtendMenuItems)))
  499. return 0;
  500. UINT uRet = _pCuiMenu->ShowModalPopup(pcuiWndParent, prcArea, TRUE);
  501. delete _pCuiMenu;
  502. _pCuiMenu = NULL;
  503. return uRet;
  504. }
  505. //+---------------------------------------------------------------------------
  506. //
  507. // IsTransparecyAvailable
  508. //
  509. //----------------------------------------------------------------------------
  510. BOOL IsTransparecyAvailable()
  511. {
  512. HDC hdc;
  513. BOOL bRet;
  514. if (!IsOnNT5())
  515. return FALSE;
  516. hdc = GetDC(NULL);
  517. if (!hdc)
  518. return FALSE;
  519. bRet = (GetDeviceCaps(hdc, BITSPIXEL ) > 8) ? TRUE : FALSE;
  520. ReleaseDC(NULL, hdc);
  521. return bRet;
  522. }
  523. //+---------------------------------------------------------------------------
  524. //
  525. // CreateMenuUI
  526. //
  527. //----------------------------------------------------------------------------
  528. CUTBMenuWnd *CUTBContextMenu::CreateMenuUI(BOOL fExtendMenuItems)
  529. {
  530. CUTBMenuWnd *pCuiMenu;
  531. BOOL fInsertedItem = FALSE;
  532. DWORD dwCat = -1;
  533. DWORD dwStatus;
  534. CUTBMenuItem *pMenuItem;
  535. if (FAILED(_ptw->GetLangBarMgr()->GetShowFloatingStatus(&dwStatus)))
  536. return NULL;
  537. pCuiMenu = new CUTBMenuWnd(g_hInst, g_dwMenuStyle, 0);
  538. if (!pCuiMenu)
  539. return NULL;
  540. pCuiMenu->Initialize();
  541. if (dwStatus & (TF_SFT_MINIMIZED | TF_SFT_DESKBAND))
  542. {
  543. pMenuItem = InsertItem(pCuiMenu, IDM_RESTORE, IDS_RESTORE);
  544. if (pMenuItem && !_ptw->_fIsItemShownInFloatingToolbar)
  545. pMenuItem->Gray(TRUE);
  546. }
  547. else
  548. {
  549. InsertItem(pCuiMenu, IDM_MINIMIZE, IDS_MINIMIZE);
  550. if (fExtendMenuItems)
  551. {
  552. if (IsTransparecyAvailable())
  553. {
  554. if (dwStatus & TF_SFT_NOTRANSPARENCY)
  555. {
  556. InsertItem(pCuiMenu, IDM_TRANSPARENCYON, IDS_TRANSPARENCY);
  557. }
  558. else
  559. {
  560. pMenuItem = InsertItem(pCuiMenu, IDM_TRANSPARENCYOFF, IDS_TRANSPARENCY);
  561. if (pMenuItem)
  562. pMenuItem->Check(TRUE);
  563. }
  564. }
  565. if (dwStatus & TF_SFT_LABELS)
  566. {
  567. pMenuItem = InsertItem(pCuiMenu, IDM_HIDELABEL, IDS_TEXTLABEL);
  568. if (pMenuItem)
  569. pMenuItem->Check(TRUE);
  570. }
  571. else
  572. {
  573. InsertItem(pCuiMenu, IDM_SHOWLABEL, IDS_TEXTLABEL);
  574. }
  575. pMenuItem = InsertItem(pCuiMenu, IDM_VERTICAL, IDS_VERTICAL);
  576. if (pMenuItem)
  577. pMenuItem->Check(_ptw->IsVertical());
  578. }
  579. }
  580. if (fExtendMenuItems)
  581. {
  582. if (dwStatus & TF_SFT_EXTRAICONSONMINIMIZED)
  583. {
  584. pMenuItem = InsertItem(pCuiMenu,
  585. IDM_NONOTIFICATIONICONS,
  586. IDS_NOTIFICATIONICONS);
  587. if (pMenuItem)
  588. pMenuItem->Check(TRUE);
  589. }
  590. else
  591. {
  592. pMenuItem = InsertItem(pCuiMenu, IDM_NOTIFICATIONICONS, IDS_NOTIFICATIONICONS);
  593. }
  594. //
  595. // Always show the extra additional icons in case of single keyboard
  596. // layout.
  597. //
  598. if (_ptw->IsSingleKeyboardLayout())
  599. {
  600. if (pMenuItem)
  601. {
  602. pMenuItem->Check(TRUE);
  603. pMenuItem->Gray(TRUE);
  604. }
  605. }
  606. else
  607. {
  608. if (pMenuItem)
  609. pMenuItem->Gray(FALSE);
  610. }
  611. if (dwStatus & TF_SFT_DESKBAND)
  612. InsertItem(pCuiMenu, IDM_ADJUSTLANGBAND, IDS_ADJUSTLANGBAND);
  613. InsertItem(pCuiMenu, IDM_SHOWINPUTCPL, IDS_SHOWINPUTCPL);
  614. if (CheckCloseMenuAvailable())
  615. InsertItem(pCuiMenu, IDM_CLOSE, IDS_CLOSE);
  616. }
  617. return pCuiMenu;
  618. }
  619. //+---------------------------------------------------------------------------
  620. //
  621. // SelectMenuItem
  622. //
  623. //----------------------------------------------------------------------------
  624. BOOL CUTBContextMenu::SelectMenuItem(UINT uId)
  625. {
  626. CUTBCloseLangBarDlg *pDlg;
  627. CUTBMinimizeLangBarDlg *pMinimizeDlg;
  628. CMyRegKey key;
  629. switch (uId)
  630. {
  631. case IDM_MINIMIZE:
  632. //
  633. // Use Deskband object instead of system tray icon on NT51
  634. //
  635. if (IsOnNT51())
  636. {
  637. DWORD dwStatus;
  638. _ptw->GetLangBarMgr()->GetShowFloatingStatus(&dwStatus);
  639. if (!(dwStatus & TF_SFT_DESKBAND))
  640. {
  641. _ptw->GetLangBarMgr()->ShowFloating(TF_SFT_DESKBAND);
  642. if (pMinimizeDlg = new CUTBMinimizeLangBarDlg)
  643. {
  644. pMinimizeDlg->DoModal(_ptw->GetWnd());
  645. pMinimizeDlg->_Release();
  646. }
  647. }
  648. break;
  649. }
  650. else
  651. {
  652. _ptw->GetLangBarMgr()->ShowFloating(TF_SFT_MINIMIZED);
  653. if (pMinimizeDlg = new CUTBMinimizeLangBarDlg)
  654. {
  655. pMinimizeDlg->DoModal(_ptw->GetWnd());
  656. pMinimizeDlg->_Release();
  657. }
  658. break;
  659. }
  660. case IDM_RESTORE:
  661. _ptw->GetLangBarMgr()->ShowFloating(TF_SFT_SHOWNORMAL);
  662. break;
  663. case IDM_VERTICAL:
  664. _ptw->SetVertical(!_ptw->IsVertical());
  665. break;
  666. case IDM_CLOSE:
  667. if (pDlg = new CUTBCloseLangBarDlg)
  668. {
  669. int nRet = pDlg->DoModal(_ptw->GetWnd());
  670. pDlg->_Release();
  671. if (!nRet)
  672. {
  673. //
  674. // if we don't show the dialog box,
  675. // we close the language bar now.
  676. //
  677. DoCloseLangbar();
  678. }
  679. }
  680. break;
  681. case IDM_TRANSPARENCYON:
  682. _ptw->GetLangBarMgr()->ShowFloating(TF_SFT_LOWTRANSPARENCY);
  683. break;
  684. case IDM_TRANSPARENCYOFF:
  685. _ptw->GetLangBarMgr()->ShowFloating(TF_SFT_NOTRANSPARENCY);
  686. break;
  687. case IDM_SHOWLABEL:
  688. _ptw->GetLangBarMgr()->ShowFloating(TF_SFT_LABELS);
  689. break;
  690. case IDM_HIDELABEL:
  691. _ptw->GetLangBarMgr()->ShowFloating(TF_SFT_NOLABELS);
  692. break;
  693. case IDM_SHOWINPUTCPL:
  694. TF_RunInputCPL();
  695. break;
  696. case IDM_NOTIFICATIONICONS:
  697. _ptw->ClearDeskbandSizeAdjusted();
  698. _ptw->GetLangBarMgr()->ShowFloating(TF_SFT_EXTRAICONSONMINIMIZED);
  699. break;
  700. case IDM_NONOTIFICATIONICONS:
  701. _ptw->ClearDeskbandSizeAdjusted();
  702. _ptw->GetLangBarMgr()->ShowFloating(TF_SFT_NOEXTRAICONSONMINIMIZED);
  703. break;
  704. case IDM_ADJUSTLANGBAND:
  705. _ptw->AdjustDeskBandSize(TRUE);
  706. break;
  707. }
  708. return TRUE;
  709. }