OSDN Git Service

BrowseRefs: Dont select current HEAD after change
[tortoisegit/TortoiseGitJp.git] / src / TortoiseProc / BrowseRefsDlg.cpp
1 // BrowseRefsDlg.cpp : implementation file\r
2 //\r
3 \r
4 #include "stdafx.h"\r
5 #include "TortoiseProc.h"\r
6 #include "BrowseRefsDlg.h"\r
7 #include "LogDlg.h"\r
8 #include "AddRemoteDlg.h"\r
9 #include "CreateBranchTagDlg.h"\r
10 #include "Settings\SettingGitRemote.h"\r
11 #include "SinglePropSheetDlg.h"\r
12 #include "ConfirmDelRefDlg.h"\r
13 #include "MessageBox.h"\r
14 \r
15 // CBrowseRefsDlg dialog\r
16 \r
17 IMPLEMENT_DYNAMIC(CBrowseRefsDlg, CResizableStandAloneDialog)\r
18 \r
19 CBrowseRefsDlg::CBrowseRefsDlg(CString cmdPath, CWnd* pParent /*=NULL*/)\r
20 :       CResizableStandAloneDialog(CBrowseRefsDlg::IDD, pParent),\r
21         m_cmdPath(cmdPath)\r
22 {\r
23 \r
24 }\r
25 \r
26 CBrowseRefsDlg::~CBrowseRefsDlg()\r
27 {\r
28 }\r
29 \r
30 void CBrowseRefsDlg::DoDataExchange(CDataExchange* pDX)\r
31 {\r
32         CDialog::DoDataExchange(pDX);\r
33         DDX_Control(pDX, IDC_TREE_REF,                  m_RefTreeCtrl);\r
34         DDX_Control(pDX, IDC_LIST_REF_LEAFS,    m_ListRefLeafs);\r
35 }\r
36 \r
37 \r
38 BEGIN_MESSAGE_MAP(CBrowseRefsDlg, CResizableStandAloneDialog)\r
39         ON_BN_CLICKED(IDOK, &CBrowseRefsDlg::OnBnClickedOk)\r
40         ON_NOTIFY(TVN_SELCHANGED, IDC_TREE_REF, &CBrowseRefsDlg::OnTvnSelchangedTreeRef)\r
41         ON_WM_CONTEXTMENU()\r
42 END_MESSAGE_MAP()\r
43 \r
44 \r
45 // CBrowseRefsDlg message handlers\r
46 \r
47 void CBrowseRefsDlg::OnBnClickedOk()\r
48 {\r
49         OnOK();\r
50 }\r
51 \r
52 BOOL CBrowseRefsDlg::OnInitDialog()\r
53 {\r
54         CResizableStandAloneDialog::OnInitDialog();\r
55 \r
56         AddAnchor(IDC_TREE_REF, TOP_LEFT, BOTTOM_LEFT);\r
57         AddAnchor(IDC_LIST_REF_LEAFS, TOP_LEFT, BOTTOM_RIGHT);\r
58 \r
59         m_ListRefLeafs.SetExtendedStyle(m_ListRefLeafs.GetExtendedStyle()|LVS_EX_FULLROWSELECT);\r
60         m_ListRefLeafs.InsertColumn(0,L"Name",0,150);\r
61         m_ListRefLeafs.InsertColumn(1,L"Date Last Commit",0,100);\r
62         m_ListRefLeafs.InsertColumn(2,L"Last Commit",0,300);\r
63         m_ListRefLeafs.InsertColumn(3,L"Hash",0,80);\r
64 \r
65         AddAnchor(IDOK,BOTTOM_RIGHT);\r
66         AddAnchor(IDCANCEL,BOTTOM_RIGHT);\r
67 \r
68         Refresh(true);\r
69 \r
70 \r
71         return TRUE;\r
72 }\r
73 \r
74 CShadowTree* CShadowTree::GetNextSub(CString& nameLeft, bool bCreateIfNotExist)\r
75 {\r
76         int posSlash=nameLeft.Find('/');\r
77         CString nameSub;\r
78         if(posSlash<0)\r
79         {\r
80                 nameSub=nameLeft;\r
81                 nameLeft.Empty();//Nothing left\r
82         }\r
83         else\r
84         {\r
85                 nameSub=nameLeft.Left(posSlash);\r
86                 nameLeft=nameLeft.Mid(posSlash+1);\r
87         }\r
88         if(nameSub.IsEmpty())\r
89                 return NULL;\r
90 \r
91         if(!bCreateIfNotExist && m_ShadowTree.find(nameSub)==m_ShadowTree.end())\r
92                 return NULL;\r
93 \r
94         CShadowTree& nextNode=m_ShadowTree[nameSub];\r
95         nextNode.m_csRefName=nameSub;\r
96         nextNode.m_pParent=this;\r
97         return &nextNode;\r
98 }\r
99 \r
100 typedef std::map<CString,CString> MAP_STRING_STRING;\r
101 \r
102 void CBrowseRefsDlg::Refresh(bool bSelectCurHead)\r
103 {\r
104 //      m_RefMap.clear();\r
105 //      g_Git.GetMapHashToFriendName(m_RefMap);\r
106                 \r
107         CString selectRef;\r
108         if(bSelectCurHead)\r
109         {\r
110                 g_Git.Run(L"git symbolic-ref HEAD",&selectRef,CP_UTF8);\r
111                 selectRef.Trim(L"\r\n\t ");\r
112         }\r
113         else\r
114         {\r
115                 POSITION pos=m_ListRefLeafs.GetFirstSelectedItemPosition();\r
116                 //List ctrl selection?\r
117                 if(pos)\r
118                 {\r
119                         CShadowTree* pTree=(CShadowTree*)m_ListRefLeafs.GetItemData(\r
120                                         m_ListRefLeafs.GetNextSelectedItem(pos));\r
121                         selectRef=pTree->GetRefName();\r
122                 }\r
123                 else\r
124                 {\r
125                         //Tree ctrl selection?\r
126                         HTREEITEM hTree=m_RefTreeCtrl.GetSelectedItem();\r
127                         if(hTree!=NULL)\r
128                         {\r
129                                 CShadowTree* pTree=(CShadowTree*)m_RefTreeCtrl.GetItemData(hTree);\r
130                                 selectRef=pTree->GetRefName();\r
131                         }\r
132                 }\r
133         }\r
134 \r
135         m_RefTreeCtrl.DeleteAllItems();\r
136         m_ListRefLeafs.DeleteAllItems();\r
137         m_TreeRoot.m_ShadowTree.clear();\r
138         m_TreeRoot.m_csRefName="refs";\r
139 //      m_TreeRoot.m_csShowName="Refs";\r
140         m_TreeRoot.m_hTree=m_RefTreeCtrl.InsertItem(L"Refs",NULL,NULL);\r
141         m_RefTreeCtrl.SetItemData(m_TreeRoot.m_hTree,(DWORD_PTR)&m_TreeRoot);\r
142 \r
143         CString allRefs;\r
144         g_Git.Run(L"git for-each-ref --format="\r
145                           L"%(refname)%04"\r
146                           L"%(objectname)%04"\r
147                           L"%(authordate:relative)%04"\r
148                           L"%(subject)%04"\r
149                           L"%(authorname)",\r
150                           &allRefs,CP_UTF8);\r
151 \r
152         int linePos=0;\r
153         CString singleRef;\r
154 \r
155         MAP_STRING_STRING refMap;\r
156 \r
157         //First sort on ref name\r
158         while(!(singleRef=allRefs.Tokenize(L"\r\n",linePos)).IsEmpty())\r
159         {\r
160                 int valuePos=0;\r
161                 CString refName=singleRef.Tokenize(L"\04",valuePos);\r
162                 CString refRest=singleRef.Mid(valuePos);\r
163                 refMap[refName]=refRest;\r
164         }\r
165 \r
166 \r
167 \r
168 //      for(MAP_HASH_NAME::iterator iterRef=m_RefMap.begin();iterRef!=m_RefMap.end();++iterRef)\r
169 //              for(STRING_VECTOR::iterator iterRefName=iterRef->second.begin();iterRefName!=iterRef->second.end();++iterRefName)\r
170 //                      refName[*iterRefName]=iterRef->first;\r
171 \r
172         //Populate ref tree\r
173         for(MAP_STRING_STRING::iterator iterRefMap=refMap.begin();iterRefMap!=refMap.end();++iterRefMap)\r
174         {\r
175                 CShadowTree& treeLeaf=GetTreeNode(iterRefMap->first,NULL,true);\r
176                 CString values=iterRefMap->second;\r
177 \r
178                 int valuePos=0;\r
179                 treeLeaf.m_csRefHash= values.Tokenize(L"\04",valuePos);\r
180                 treeLeaf.m_csDate=    values.Tokenize(L"\04",valuePos);\r
181                 treeLeaf.m_csSubject= values.Tokenize(L"\04",valuePos);\r
182                 treeLeaf.m_csAuthor=  values.Tokenize(L"\04",valuePos);\r
183         }\r
184 \r
185 \r
186         if(selectRef.IsEmpty() || !SelectRef(selectRef))\r
187                 //Probably not on a branch. Select root node.\r
188                 m_RefTreeCtrl.Expand(m_TreeRoot.m_hTree,TVE_EXPAND);\r
189 \r
190 }\r
191 \r
192 bool CBrowseRefsDlg::SelectRef(CString refName)\r
193 {\r
194         if(wcsnicmp(refName,L"refs/",5)!=0)\r
195                 return false; // Not a ref name\r
196 \r
197         CShadowTree& treeLeafHead=GetTreeNode(refName,NULL,false);\r
198         if(treeLeafHead.m_hTree != NULL)\r
199         {\r
200                 //Not a leaf. Select tree node and return\r
201                 m_RefTreeCtrl.Select(treeLeafHead.m_hTree,TVGN_CARET);\r
202                 return true;\r
203         }\r
204 \r
205         if(treeLeafHead.m_pParent==NULL)\r
206                 return false; //Weird... should not occur.\r
207 \r
208         //This is the current head.\r
209         m_RefTreeCtrl.Select(treeLeafHead.m_pParent->m_hTree,TVGN_CARET);\r
210 \r
211         for(int indexPos = 0; indexPos < m_ListRefLeafs.GetItemCount(); ++indexPos)\r
212         {\r
213                 CShadowTree* pCurrShadowTree = (CShadowTree*)m_ListRefLeafs.GetItemData(indexPos);\r
214                 if(pCurrShadowTree == &treeLeafHead)\r
215                 {\r
216                         m_ListRefLeafs.SetItemState(indexPos,LVIS_SELECTED,LVIS_SELECTED);\r
217                         m_ListRefLeafs.EnsureVisible(indexPos,FALSE);\r
218                 }\r
219         }\r
220 \r
221         return true;\r
222 }\r
223 \r
224 CShadowTree& CBrowseRefsDlg::GetTreeNode(CString refName, CShadowTree* pTreePos, bool bCreateIfNotExist)\r
225 {\r
226         if(pTreePos==NULL)\r
227         {\r
228                 if(wcsnicmp(refName,L"refs/",5)==0)\r
229                         refName=refName.Mid(5);\r
230                 pTreePos=&m_TreeRoot;\r
231         }\r
232         if(refName.IsEmpty())\r
233                 return *pTreePos;//Found leaf\r
234 \r
235         CShadowTree* pNextTree=pTreePos->GetNextSub(refName,bCreateIfNotExist);\r
236         if(pNextTree==NULL)\r
237         {\r
238                 //Should not occur when all ref-names are valid and bCreateIfNotExist is true.\r
239                 ASSERT(!bCreateIfNotExist);\r
240                 return *pTreePos;\r
241         }\r
242 \r
243         if(!refName.IsEmpty())\r
244         {\r
245                 //When the refName is not empty, this node is not a leaf, so lets add it to the tree control.\r
246                 //Leafs are for the list control.\r
247                 if(pNextTree->m_hTree==NULL)\r
248                 {\r
249                         //New tree. Create node in control.\r
250                         pNextTree->m_hTree=m_RefTreeCtrl.InsertItem(pNextTree->m_csRefName,pTreePos->m_hTree,NULL);\r
251                         m_RefTreeCtrl.SetItemData(pNextTree->m_hTree,(DWORD_PTR)pNextTree);\r
252                 }\r
253         }\r
254 \r
255         return GetTreeNode(refName, pNextTree, bCreateIfNotExist);\r
256 }\r
257 \r
258 \r
259 void CBrowseRefsDlg::OnTvnSelchangedTreeRef(NMHDR *pNMHDR, LRESULT *pResult)\r
260 {\r
261         LPNMTREEVIEW pNMTreeView = reinterpret_cast<LPNMTREEVIEW>(pNMHDR);\r
262         *pResult = 0;\r
263 \r
264         FillListCtrlForTreeNode(pNMTreeView->itemNew.hItem);\r
265 }\r
266 \r
267 void CBrowseRefsDlg::FillListCtrlForTreeNode(HTREEITEM treeNode)\r
268 {\r
269         m_ListRefLeafs.DeleteAllItems();\r
270 \r
271         CShadowTree* pTree=(CShadowTree*)(m_RefTreeCtrl.GetItemData(treeNode));\r
272         if(pTree==NULL)\r
273         {\r
274                 ASSERT(FALSE);\r
275                 return;\r
276         }\r
277         FillListCtrlForShadowTree(pTree,L"",true);\r
278 }\r
279 \r
280 void CBrowseRefsDlg::FillListCtrlForShadowTree(CShadowTree* pTree, CString refNamePrefix, bool isFirstLevel)\r
281 {\r
282         if(pTree->IsLeaf())\r
283         {\r
284                 int indexItem=m_ListRefLeafs.InsertItem(m_ListRefLeafs.GetItemCount(),L"");\r
285 \r
286                 m_ListRefLeafs.SetItemData(indexItem,(DWORD_PTR)pTree);\r
287                 m_ListRefLeafs.SetItemText(indexItem,0,refNamePrefix+pTree->m_csRefName);\r
288                 m_ListRefLeafs.SetItemText(indexItem,1,pTree->m_csDate);\r
289                 m_ListRefLeafs.SetItemText(indexItem,2,pTree->m_csSubject);\r
290                 m_ListRefLeafs.SetItemText(indexItem,3,pTree->m_csRefHash);\r
291         }\r
292         else\r
293         {\r
294 \r
295                 CString csThisName;\r
296                 if(!isFirstLevel)\r
297                         csThisName=refNamePrefix+pTree->m_csRefName+L"/";\r
298                 for(CShadowTree::TShadowTreeMap::iterator itSubTree=pTree->m_ShadowTree.begin(); itSubTree!=pTree->m_ShadowTree.end(); ++itSubTree)\r
299                 {\r
300                         FillListCtrlForShadowTree(&itSubTree->second,csThisName,false);\r
301                 }\r
302         }\r
303 }\r
304 \r
305 void CBrowseRefsDlg::OnContextMenu_ListRefLeafs(CPoint point)\r
306 {\r
307 \r
308         CPoint clientPoint=point;\r
309         m_RefTreeCtrl.ScreenToClient(&clientPoint);\r
310 \r
311 \r
312         std::vector<CShadowTree*> selectedTrees;\r
313         selectedTrees.reserve(m_ListRefLeafs.GetSelectedCount());\r
314         POSITION pos=m_ListRefLeafs.GetFirstSelectedItemPosition();\r
315         while(pos)\r
316         {\r
317                 selectedTrees.push_back(\r
318                         (CShadowTree*)m_ListRefLeafs.GetItemData(\r
319                                 m_ListRefLeafs.GetNextSelectedItem(pos)));\r
320         }\r
321 \r
322         CMenu popupMenu;\r
323         popupMenu.CreatePopupMenu();\r
324 \r
325         if(selectedTrees.size()==1)\r
326         {\r
327                 popupMenu.AppendMenu(MF_STRING,eCmd_ViewLog,L"View log");\r
328                 if(selectedTrees[0]->IsFrom(L"refs/heads"))\r
329                         popupMenu.AppendMenu(MF_STRING,eCmd_DeleteBranch,L"Delete Branch");\r
330                 else if(selectedTrees[0]->IsFrom(L"refs/tags"))\r
331                         popupMenu.AppendMenu(MF_STRING,eCmd_DeleteTag,L"Delete Tag");\r
332 \r
333 //              CShadowTree* pTree = (CShadowTree*)m_ListRefLeafs.GetItemData(pNMHDR->idFrom);\r
334 //              if(pTree==NULL)\r
335 //                      return;\r
336         }\r
337 \r
338 \r
339         eCmd cmd=(eCmd)popupMenu.TrackPopupMenuEx(TPM_LEFTALIGN|TPM_RETURNCMD, point.x, point.y, this, 0);\r
340         switch(cmd)\r
341         {\r
342         case eCmd_ViewLog:\r
343                 {\r
344                         CLogDlg dlg;\r
345                         dlg.SetStartRef(selectedTrees[0]->m_csRefHash);\r
346                         dlg.DoModal();\r
347                 }\r
348                 break;\r
349         case eCmd_DeleteBranch:\r
350                 {\r
351                         if(ConfirmDeleteRef(selectedTrees[0]->GetRefName()))\r
352                                 DoDeleteRef(selectedTrees[0]->GetRefName(), true);\r
353                         Refresh();\r
354                 }\r
355                 break;\r
356         case eCmd_DeleteTag:\r
357                 {\r
358                         if(ConfirmDeleteRef(selectedTrees[0]->GetRefName()))\r
359                                 DoDeleteRef(selectedTrees[0]->GetRefName(), true);\r
360                         Refresh();\r
361                 }\r
362                 break;\r
363         }\r
364 }\r
365 \r
366 bool CBrowseRefsDlg::ConfirmDeleteRef(CString completeRefName)\r
367 {\r
368         CString csMessage;\r
369         CString csTitle;\r
370 \r
371         UINT mbIcon=MB_ICONQUESTION;\r
372         csMessage=L"Are you sure you want to delete the ";\r
373         if(wcsncmp(completeRefName,L"refs/heads",10)==0)\r
374         {\r
375                 CString branchToDelete = completeRefName.Mid(11);\r
376                 csTitle.Format(L"Confirm deletion of branch %s", branchToDelete);\r
377                 csMessage += "branch:\r\n\r\n<b>";\r
378                 csMessage += branchToDelete;\r
379                 csMessage += "</b>";\r
380 \r
381                 //Check if branch is fully merged in HEAD\r
382                 CString branchHash = g_Git.GetHash(completeRefName);\r
383                 CString commonAncestor;\r
384                 CString cmd;\r
385                 cmd.Format(L"git.exe merge-base HEAD %s",completeRefName);\r
386                 g_Git.Run(cmd,&commonAncestor,CP_UTF8);\r
387 \r
388                 branchHash=branchHash.Left(40);\r
389                 commonAncestor=commonAncestor.Left(40);\r
390                 \r
391                 if(commonAncestor != branchHash)\r
392                 {\r
393                         csMessage += L"\r\n\r\n<b>Warning:\r\nThis branch is not fully merged into HEAD.</b>";\r
394                         mbIcon=MB_ICONWARNING;\r
395                 }\r
396         }\r
397         else if(wcsncmp(completeRefName,L"refs/tags",9)==0)\r
398         {\r
399                 CString tagToDelete = completeRefName.Mid(10);\r
400                 csTitle.Format(L"Confirm deletion of tag %s", tagToDelete);\r
401                 csMessage += "tag:\r\n\r\n<b>";\r
402                 csMessage += tagToDelete;\r
403                 csMessage += "</b>";\r
404         }\r
405 \r
406         return CMessageBox::Show(m_hWnd,csMessage,csTitle,MB_YESNO|mbIcon)==IDYES;\r
407 \r
408 }\r
409 \r
410 \r
411 bool CBrowseRefsDlg::DoDeleteRef(CString completeRefName, bool bForce)\r
412 {\r
413         if(wcsncmp(completeRefName,L"refs/heads",10)==0)\r
414         {\r
415                 CString branchToDelete = completeRefName.Mid(11);\r
416                 CString cmd;\r
417                 cmd.Format(L"git.exe branch -%c %s",bForce?L'D':L'd',branchToDelete);\r
418                 CString resultDummy;\r
419                 if(g_Git.Run(cmd,&resultDummy,CP_UTF8)!=0)\r
420                 {\r
421                         CString errorMsg;\r
422                         errorMsg.Format(L"Could not delete branch %s. Message from git:\r\n\r\n%s",branchToDelete,resultDummy);\r
423                         CMessageBox::Show(m_hWnd,errorMsg,L"Error deleting branch",MB_OK|MB_ICONERROR);\r
424                         return false;\r
425                 }\r
426         }\r
427         else if(wcsncmp(completeRefName,L"refs/tags",9)==0)\r
428         {\r
429                 CString tagToDelete = completeRefName.Mid(10);\r
430                 CString cmd;\r
431                 cmd.Format(L"git.exe tag -d %s",tagToDelete);\r
432                 CString resultDummy;\r
433                 if(g_Git.Run(cmd,&resultDummy,CP_UTF8)!=0)\r
434                 {\r
435                         CString errorMsg;\r
436                         errorMsg.Format(L"Could not delete tag %s. Message from git:\r\n\r\n%s",tagToDelete,resultDummy);\r
437                         CMessageBox::Show(m_hWnd,errorMsg,L"Error deleting tag",MB_OK|MB_ICONERROR);\r
438                         return false;\r
439                 }\r
440         }\r
441         return true;\r
442 }\r
443 \r
444 void CBrowseRefsDlg::OnContextMenu(CWnd* pWndFrom, CPoint point)\r
445 {\r
446         if(pWndFrom==&m_RefTreeCtrl)       OnContextMenu_RefTreeCtrl(point);\r
447         else if(pWndFrom==&m_ListRefLeafs) OnContextMenu_ListRefLeafs(point);\r
448 }\r
449 \r
450 void CBrowseRefsDlg::OnContextMenu_RefTreeCtrl(CPoint point)\r
451 {\r
452         CMenu popupMenu;\r
453         popupMenu.CreatePopupMenu();\r
454 \r
455         CPoint clientPoint=point;\r
456         m_RefTreeCtrl.ScreenToClient(&clientPoint);\r
457 \r
458         HTREEITEM hTreeItem=m_RefTreeCtrl.HitTest(clientPoint);\r
459         if(hTreeItem!=NULL)\r
460         {\r
461                 m_RefTreeCtrl.Select(hTreeItem,TVGN_CARET);\r
462                 CShadowTree* pTree=(CShadowTree*)m_RefTreeCtrl.GetItemData(hTreeItem);\r
463                 if(pTree->IsFrom(L"refs/remotes"))\r
464                 {\r
465 //                      popupMenu.AppendMenu(MF_STRING,eCmd_AddRemote,L"Add Remote");\r
466                         popupMenu.AppendMenu(MF_STRING,eCmd_ManageRemotes,L"Manage Remotes");\r
467                 }\r
468                 else if(pTree->IsFrom(L"refs/heads"))\r
469                         popupMenu.AppendMenu(MF_STRING,eCmd_CreateBranch,L"Create Branch");\r
470                 else if(pTree->IsFrom(L"refs/tags"))\r
471                         popupMenu.AppendMenu(MF_STRING,eCmd_CreateTag,L"Create Tag");\r
472         }\r
473 \r
474         eCmd cmd=(eCmd)popupMenu.TrackPopupMenuEx(TPM_LEFTALIGN|TPM_RETURNCMD, point.x, point.y, this, 0);\r
475         switch(cmd)\r
476         {\r
477         case eCmd_AddRemote:\r
478                 {\r
479                         CAddRemoteDlg(this).DoModal();\r
480                         Refresh();\r
481                 }\r
482                 break;\r
483         case eCmd_ManageRemotes:\r
484                 {\r
485                         CSinglePropSheetDlg(L"Git Remote Settings",new CSettingGitRemote(m_cmdPath),this).DoModal();\r
486 //                      CSettingGitRemote W_Remotes(m_cmdPath);\r
487 //                      W_Remotes.DoModal();\r
488                         Refresh();\r
489                 }\r
490                 break;\r
491         case eCmd_CreateBranch:\r
492                 {\r
493                         CCreateBranchTagDlg dlg(this);\r
494                         dlg.m_bIsTag=false;\r
495                         dlg.DoModal();\r
496                         Refresh();\r
497                 }\r
498                 break;\r
499         case eCmd_CreateTag:\r
500                 {\r
501                         CCreateBranchTagDlg dlg(this);\r
502                         dlg.m_bIsTag=true;\r
503                         dlg.DoModal();\r
504                         Refresh();\r
505                 }\r
506                 break;\r
507         }\r
508 }\r
509 \r
510 BOOL CBrowseRefsDlg::PreTranslateMessage(MSG* pMsg)\r
511 {\r
512         if (pMsg->message == WM_KEYDOWN)\r
513         {\r
514                 switch (pMsg->wParam)\r
515                 {\r
516 /*              case VK_RETURN:\r
517                         {\r
518                                 if (GetAsyncKeyState(VK_CONTROL)&0x8000)\r
519                                 {\r
520                                         if ( GetDlgItem(IDOK)->IsWindowEnabled() )\r
521                                         {\r
522                                                 PostMessage(WM_COMMAND, IDOK);\r
523                                         }\r
524                                         return TRUE;\r
525                                 }\r
526                         }\r
527                         break;\r
528 */              case VK_F5:\r
529                         {\r
530                                 Refresh();\r
531                         }\r
532                         break;\r
533                 }\r
534         }\r
535 \r
536 \r
537         return CResizableStandAloneDialog::PreTranslateMessage(pMsg);\r
538 }\r