From: boca4711 <boc...@us...> - 2004-10-20 16:31:44
|
Update of /cvsroot/anyedit/AnyEditToolkit/GuiLib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11965/GuiLib Modified Files: GuiMDITabbed.cpp GuiMDITabbed.h Log Message: - Caption shows filename only - Pathname is shown as tooltip Index: GuiMDITabbed.cpp =================================================================== RCS file: /cvsroot/anyedit/AnyEditToolkit/GuiLib/GuiMDITabbed.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** GuiMDITabbed.cpp 15 Oct 2004 14:01:50 -0000 1.3 --- GuiMDITabbed.cpp 20 Oct 2004 16:31:35 -0000 1.4 *************** *** 34,42 **** END_MESSAGE_MAP() - - - - - LRESULT CGuiMDITabbed::OnSizeParent(WPARAM, LPARAM lParam) { --- 34,37 ---- *************** *** 140,193 **** } void CGuiMDITabbed::UpdateWindows() { ! CFrameWnd* pParent = STATIC_DOWNCAST(CFrameWnd, AfxGetMainWnd()); ! ! SetTimer(1,200,NULL); ! CWnd* pWnd=CWnd::FromHandle(::GetTopWindow(GetParentFrame()->GetSafeHwnd())); TCHAR ClassName[32]; while (pWnd != NULL) { ! ::GetClassName(pWnd->GetSafeHwnd(),ClassName,32); ! CString szClassName=ClassName; ! if(szClassName=="MDIClient") break; ! pWnd=pWnd->GetNextWindow(); } ASSERT(::IsWindow(pWnd->GetSafeHwnd())); //primero adicionar los nuevos ! ! CWnd* pChild= CWnd::FromHandle(::GetTopWindow(pWnd->GetSafeHwnd())); ! ! while(pChild != NULL) { ! CString m_Caption; ! pChild->GetWindowText(m_Caption); ! if (!m_Caption.IsEmpty()) { - if (!FindItem(pChild->GetSafeHwnd())) { ! Addtab(pChild,m_Caption,-1); SetTabMenu(hMenu); } else ! UpdateCaption(pChild,m_Caption); ! } pChild= CWnd::FromHandle(::GetNextWindow(pChild->GetSafeHwnd(), GW_HWNDNEXT)); - } //---eliminar las ventanas borradas ! int nNumtabs=GetCount(); ! for (int i=0; i< nNumtabs; i++) { CWnd* pWnd=GetNumWnd(i); --- 135,194 ---- } + /// Update all tab captions. + /// Tab captions show file name. void CGuiMDITabbed::UpdateWindows() { + CFrameWnd* pParent = STATIC_DOWNCAST(CFrameWnd, AfxGetMainWnd()); ! SetTimer(1, 200, NULL); ! CWnd* pWnd = CWnd::FromHandle(::GetTopWindow(GetParentFrame()->GetSafeHwnd())); TCHAR ClassName[32]; while (pWnd != NULL) { ! ::GetClassName(pWnd->GetSafeHwnd(), ClassName, 32); ! CString szClassName = ClassName; ! if(szClassName == "MDIClient") break; ! pWnd = pWnd->GetNextWindow(); } ASSERT(::IsWindow(pWnd->GetSafeHwnd())); //primero adicionar los nuevos + CWnd* pChild = CWnd::FromHandle(::GetTopWindow(pWnd->GetSafeHwnd())); ! CString strCaption; ! CString strTooltip; while(pChild != NULL) { ! pChild->GetWindowText(strCaption); ! int y = strCaption.ReverseFind('\\'); ! strCaption = strCaption.Right(strCaption.GetLength() - 1 - y); ! if (!strCaption.IsEmpty()) { if (!FindItem(pChild->GetSafeHwnd())) { + strTooltip.Empty(); + CMDIChildWnd* pChildWnd = (CMDIChildWnd*) FromHandlePermanent(pChild->GetSafeHwnd()); + CDocument* pDoc=((CMDIChildWnd*)pChildWnd)->GetActiveDocument(); + if(pDoc != NULL) + strTooltip = pDoc->GetPathName(); ! if(strTooltip.IsEmpty()) ! strTooltip = strCaption; ! ! Addtab(pChild, strCaption, -1, strTooltip); SetTabMenu(hMenu); } else ! UpdateCaption(pChild, strCaption); } pChild= CWnd::FromHandle(::GetNextWindow(pChild->GetSafeHwnd(), GW_HWNDNEXT)); } //---eliminar las ventanas borradas ! int nNumtabs = GetCount(); ! for (int i=0; i < nNumtabs; i++) { CWnd* pWnd=GetNumWnd(i); *************** *** 199,206 **** } } ! SetTimer(1,100,NULL); ! } - - --- 200,204 ---- } } ! SetTimer(1, 100, NULL); } Index: GuiMDITabbed.h =================================================================== RCS file: /cvsroot/anyedit/AnyEditToolkit/GuiLib/GuiMDITabbed.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** GuiMDITabbed.h 15 Oct 2004 14:01:50 -0000 1.2 --- GuiMDITabbed.h 20 Oct 2004 16:31:35 -0000 1.3 *************** *** 44,47 **** //}}AFX_MSG DECLARE_MESSAGE_MAP(); - }; --- 44,46 ---- |