1
2 #include "studiox_includes.h"
3
4 #ifdef _DEBUG
5 #define new DEBUG_NEW
6 #endif
7
IMPLEMENT_DYNCREATE(left_top_panel_frame,CWnd)8 IMPLEMENT_DYNCREATE(left_top_panel_frame, CWnd)
9
10 BEGIN_MESSAGE_MAP(left_top_panel_frame, CWnd)
11 ON_WM_CREATE()
12 ON_WM_SIZE()
13 ON_WM_SETTINGCHANGE()
14 END_MESSAGE_MAP()
15
16 left_top_panel_frame::left_top_panel_frame()
17 {
18 mp_project_view = NULL;
19 mp_project_header = NULL;
20
21 SetControlSize();
22 }
23
PostNcDestroy()24 void left_top_panel_frame::PostNcDestroy()
25 {
26 delete this;
27 }
~left_top_panel_frame()28 left_top_panel_frame::~left_top_panel_frame()
29 {
30 // KGM: For some reason child views are automatically
31 // deleted, but child windows are not. Go figure.
32
33 /*
34 if (mp_project_view)
35 {
36 delete mp_project_view;
37 }
38 */
39 if (mp_project_header)
40 {
41 delete mp_project_header;
42 }
43 }
44
SetControlSize()45 void left_top_panel_frame::SetControlSize()
46 {
47 int dpi = GetSystemDPI();
48 int text_scaler = GetTextScaler();
49 m_header_height = GetScaledValue(VIEW_HEADER_HEIGHT, dpi, text_scaler);
50 }
51
OnCreate(LPCREATESTRUCT lpCreateStruct)52 int left_top_panel_frame::OnCreate(LPCREATESTRUCT lpCreateStruct)
53 {
54 RECT clientrect;
55 RECT childrect;
56
57 CWnd::OnCreate(lpCreateStruct);
58
59 GetClientRect(&clientrect);
60 childrect = clientrect;
61
62 childrect.bottom = childrect.top + m_header_height - 1;
63 mp_project_header = new view_header("Project View", IDB_PROJECT_VIEW);
64 mp_project_header->Create(NULL, NULL, WS_CHILD|WS_VISIBLE, childrect, this, 0, NULL);
65
66 childrect.top = childrect.bottom;
67 childrect.bottom -= (clientrect.bottom - clientrect.top) / 2;
68 mp_project_view = new project_view();
69 mp_project_view->Create(NULL, NULL, WS_CHILD, childrect, this, PROJECT_VIEW_ID, NULL);
70 mp_project_view->ShowWindow(SW_SHOW);
71 return 0;
72 }
73
PositionChildren()74 void left_top_panel_frame::PositionChildren()
75 {
76 RECT childrect;
77 int bottom;
78
79 if (mp_project_view && mp_project_header)
80 {
81 GetClientRect(&childrect);
82 bottom = childrect.bottom;
83 childrect.bottom = childrect.top + m_header_height - 1;
84 mp_project_header->MoveWindow(&childrect);
85
86 childrect.top = childrect.bottom;
87 childrect.bottom = bottom;
88 mp_project_view->MoveWindow(&childrect);
89 }
90 }
91
OnSize(UINT ntype,int cx,int cy)92 void left_top_panel_frame::OnSize(UINT ntype, int cx, int cy)
93 {
94 CWnd::OnSize(ntype, cx, cy);
95 PositionChildren();
96 }
97
98
OnSettingChange(UINT uFlags,LPCTSTR lpszSection)99 void left_top_panel_frame::OnSettingChange(UINT uFlags, LPCTSTR lpszSection)
100 {
101 CWnd::OnSettingChange(uFlags, lpszSection);
102
103 SetControlSize();
104 PositionChildren();
105 }
106
107
IMPLEMENT_DYNCREATE(left_bottom_panel_frame,CWnd)108 IMPLEMENT_DYNCREATE(left_bottom_panel_frame, CWnd)
109
110 BEGIN_MESSAGE_MAP(left_bottom_panel_frame, CWnd)
111 ON_WM_CREATE()
112 ON_WM_SIZE()
113 ON_WM_SETTINGCHANGE()
114 END_MESSAGE_MAP()
115
116 left_bottom_panel_frame::left_bottom_panel_frame()
117 {
118 mp_props_header = NULL;
119 mp_properties_win = NULL;
120
121 SetControlSize();
122 }
123
PostNcDestroy()124 void left_bottom_panel_frame::PostNcDestroy()
125 {
126 delete this;
127 }
~left_bottom_panel_frame()128 left_bottom_panel_frame::~left_bottom_panel_frame()
129 {
130 if (mp_properties_win)
131 {
132 delete mp_properties_win;
133 }
134 if (mp_props_header)
135 {
136 delete mp_props_header;
137 }
138 }
139
SetControlSize()140 void left_bottom_panel_frame::SetControlSize()
141 {
142 int dpi = GetSystemDPI();
143 int text_scaler = GetTextScaler();
144 m_header_height = GetScaledValue(VIEW_HEADER_HEIGHT, dpi, text_scaler);
145 }
146
OnCreate(LPCREATESTRUCT lpCreateStruct)147 int left_bottom_panel_frame::OnCreate(LPCREATESTRUCT lpCreateStruct)
148 {
149 RECT clientrect;
150 RECT childrect;
151
152 CWnd::OnCreate(lpCreateStruct);
153
154 GetClientRect(&clientrect);
155 childrect = clientrect;
156
157 childrect.top = childrect.top;
158 childrect.bottom = childrect.top + m_header_height - 1;
159 mp_props_header = new view_header("Properties View", IDB_PROPS_VIEW);
160 mp_props_header->Create(NULL, NULL, WS_CHILD | WS_VISIBLE, childrect, this, 0, NULL);
161
162 childrect.top = childrect.bottom + 1;
163 childrect.bottom = clientrect.bottom;
164 mp_properties_win = new properties_win();
165 mp_properties_win->Create(IDD_PROPS_TEMPLATE, this);
166 mp_properties_win->ShowWindow(SW_SHOW);
167 return 0;
168 }
169
PositionChildren()170 void left_bottom_panel_frame::PositionChildren()
171 {
172 RECT childrect;
173 int bottom;
174
175 if (mp_props_header && mp_properties_win)
176 {
177 GetClientRect(&childrect);
178 bottom = childrect.bottom;
179
180 childrect.bottom = childrect.top + m_header_height - 1;
181 mp_props_header->MoveWindow(&childrect);
182
183 childrect.top = childrect.bottom;
184 childrect.bottom = bottom;
185 mp_properties_win->MoveWindow(&childrect);
186 }
187 }
188
OnSize(UINT ntype,int cx,int cy)189 void left_bottom_panel_frame::OnSize(UINT ntype, int cx, int cy)
190 {
191 CWnd::OnSize(ntype, cx, cy);
192 PositionChildren();
193 }
194
OnSettingChange(UINT uFlags,LPCTSTR lpszSection)195 void left_bottom_panel_frame::OnSettingChange(UINT uFlags, LPCTSTR lpszSection)
196 {
197 CWnd::OnSettingChange(uFlags, lpszSection);
198
199 SetControlSize();
200 PositionChildren();
201 }