Windows NT 4.0 source code leak
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.

83 lines
2.0 KiB

4 years ago
  1. /************************************************************************
  2. * *
  3. * HPJFRAME.CPP *
  4. * *
  5. * Copyright (C) Microsoft Corporation 1993-1995 *
  6. * All Rights reserved. *
  7. * *
  8. ************************************************************************/
  9. #include "stdafx.h"
  10. #include "resource.h"
  11. #pragma hdrstop
  12. #include "hpjframe.h"
  13. #include "hpjdoc.h"
  14. #include "hpjview.h"
  15. #include "cntview.h"
  16. #include "mainfrm.h"
  17. #include "logframe.h"
  18. #ifdef _DEBUG
  19. #undef THIS_FILE
  20. static char THIS_FILE[] = __FILE__;
  21. #endif
  22. IMPLEMENT_DYNCREATE(CHpjFrame, CLogFrame)
  23. CView* pLastCreatedView;
  24. BEGIN_MESSAGE_MAP(CHpjFrame, CLogFrame)
  25. //{{AFX_MSG_MAP(CHpjFrame)
  26. ON_WM_MDIACTIVATE()
  27. ON_WM_GETMINMAXINFO()
  28. //}}AFX_MSG_MAP
  29. END_MESSAGE_MAP()
  30. /////////////////////////////////////////////////////////////////////////////
  31. // CHpjFrame message handlers
  32. void CHpjFrame::OnMDIActivate(BOOL bActivate, CWnd* pActivateWnd, CWnd* pDeactivateWnd)
  33. {
  34. CMDIChildWnd::OnMDIActivate(bActivate, pActivateWnd, pDeactivateWnd);
  35. if (!bActivate)
  36. return;
  37. char szBuf[300];
  38. CDocument* pDoc = GetActiveDocument();
  39. if (!pDoc)
  40. return;
  41. strcpy(szBuf, pDoc->GetTitle());
  42. PSTR psz;
  43. if ((psz = StrRChr(szBuf, '.', _fDBCSSystem)))
  44. *psz = '\0';
  45. if ((psz = StrRChr(szBuf, ':', _fDBCSSystem)))
  46. *psz = '\0';
  47. if (!szBuf[0]) {
  48. strcpy(szBuf, pDoc->GetPathName());
  49. if ((psz = StrRChr(szBuf, '\\', _fDBCSSystem)))
  50. strcpy(szBuf, psz + 1); // remove the path portion
  51. }
  52. SetWindowText(szBuf);
  53. }
  54. void CHpjFrame::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI)
  55. {
  56. CMDIChildWnd::OnGetMinMaxInfo(lpMMI);
  57. enum MINSIZE ms = MS_CNT;
  58. // This frame class is used for both HPJ and CNT views, so we need
  59. // to find out which this is.
  60. CView *pView = GetActiveView();
  61. if (pView != NULL) {
  62. if (pView->GetRuntimeClass() != RUNTIME_CLASS(CCntEditView))
  63. ms = MS_HPJ;
  64. }
  65. // Call helper function to calculate the minimum size.
  66. CalcMinSize(lpMMI->ptMinTrackSize, ms, MSF_CAPTION | MSF_BORDER);
  67. }