MainFrm.cpp 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. /*
  2. ** Command & Conquer Renegade(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. // MainFrm.cpp : implementation of the CMainFrame class
  19. //
  20. #include "stdafx.h"
  21. #include "SimpleGraph.h"
  22. #include "MainFrm.h"
  23. #include "RangeDialog.h"
  24. #ifdef _DEBUG
  25. #define new DEBUG_NEW
  26. #undef THIS_FILE
  27. static char THIS_FILE[] = __FILE__;
  28. #endif
  29. /////////////////////////////////////////////////////////////////////////////
  30. // CMainFrame
  31. IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)
  32. BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
  33. //{{AFX_MSG_MAP(CMainFrame)
  34. ON_WM_CREATE()
  35. ON_COMMAND(IDM_SET_RANGES, OnSetRanges)
  36. //}}AFX_MSG_MAP
  37. END_MESSAGE_MAP()
  38. static UINT indicators[] =
  39. {
  40. ID_SEPARATOR, // status line indicator
  41. ID_INDICATOR_CAPS,
  42. ID_INDICATOR_NUM,
  43. ID_INDICATOR_SCRL,
  44. };
  45. /////////////////////////////////////////////////////////////////////////////
  46. // CMainFrame construction/destruction
  47. CMainFrame::CMainFrame()
  48. {
  49. // TODO: add member initialization code here
  50. }
  51. CMainFrame::~CMainFrame()
  52. {
  53. }
  54. int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
  55. {
  56. if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
  57. return -1;
  58. if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
  59. | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
  60. !m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
  61. {
  62. TRACE0("Failed to create toolbar\n");
  63. return -1; // fail to create
  64. }
  65. if (!m_wndStatusBar.Create(this) ||
  66. !m_wndStatusBar.SetIndicators(indicators,
  67. sizeof(indicators)/sizeof(UINT)))
  68. {
  69. TRACE0("Failed to create status bar\n");
  70. return -1; // fail to create
  71. }
  72. // TODO: Delete these three lines if you don't want the toolbar to
  73. // be dockable
  74. m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
  75. EnableDocking(CBRS_ALIGN_ANY);
  76. DockControlBar(&m_wndToolBar);
  77. return 0;
  78. }
  79. BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
  80. {
  81. if( !CFrameWnd::PreCreateWindow(cs) )
  82. return FALSE;
  83. // TODO: Modify the Window class or styles here by modifying
  84. // the CREATESTRUCT cs
  85. return TRUE;
  86. }
  87. /////////////////////////////////////////////////////////////////////////////
  88. // CMainFrame diagnostics
  89. #ifdef _DEBUG
  90. void CMainFrame::AssertValid() const
  91. {
  92. CFrameWnd::AssertValid();
  93. }
  94. void CMainFrame::Dump(CDumpContext& dc) const
  95. {
  96. CFrameWnd::Dump(dc);
  97. }
  98. #endif //_DEBUG
  99. /////////////////////////////////////////////////////////////////////////////
  100. //
  101. // OnSetRanges
  102. //
  103. /////////////////////////////////////////////////////////////////////////////
  104. void
  105. CMainFrame::OnSetRanges (void)
  106. {
  107. CRangeDialog dialog (this);
  108. dialog.DoModal ();
  109. return ;
  110. }