1 
2 #include "studiox_includes.h"
3 
4 #ifdef _DEBUG
5 #define new DEBUG_NEW
6 #endif
7 
8 IMPLEMENT_DYNCREATE(right_panel_frame, CWnd)
9 
10 BEGIN_MESSAGE_MAP(right_panel_frame, CWnd)
11     ON_WM_CREATE()
12     ON_WM_SIZE()
13 END_MESSAGE_MAP()
14 
15 extern CString target_class_name;
16 
right_panel_frame()17 right_panel_frame::right_panel_frame()
18 {
19     mp_resource_view = NULL;
20     mp_resource_header = NULL;
21 }
22 
~right_panel_frame()23 right_panel_frame::~right_panel_frame()
24 {
25     if (mp_resource_header)
26     {
27         delete mp_resource_header;
28     }
29 
30     // KGM: For some reason child views are automatically delete,
31     // but child windows are not.
32     /*
33     if (mp_resource_view)
34     {
35         delete mp_resource_view;
36     }
37     */
38 }
39 
PostNcDestroy()40 void right_panel_frame::PostNcDestroy()
41 {
42     delete this;
43 }
44 
OnCreate(LPCREATESTRUCT lpCreateStruct)45 int right_panel_frame::OnCreate(LPCREATESTRUCT lpCreateStruct)
46 {
47     RECT clientrect;
48     RECT childrect;
49 
50     CWnd::OnCreate(lpCreateStruct);
51 
52     GetClientRect(&clientrect);
53     childrect = clientrect;
54 
55     /* KGM we have removed this for now, but I'm leaving
56        it commented just in case it comes back
57     childrect.bottom = childrect.top + VIEW_HEADER_HEIGHT - 1;
58     mp_resource_header = new view_header("Resource View");
59     mp_resource_header->Create(NULL, NULL, WS_CHILD|WS_VISIBLE, childrect, this, 0, NULL);
60     */
61 
62     childrect.top = childrect.bottom;
63     childrect.bottom -= clientrect.bottom;
64     mp_resource_view = new resource_view();
65     mp_resource_view->Create(NULL, NULL, WS_CHILD, childrect, this, PROJECT_VIEW_ID, NULL);
66     mp_resource_view->ShowWindow(SW_SHOW);
67     return 0;
68 }
69 
OnSize(UINT ntype,int cx,int cy)70 void right_panel_frame::OnSize(UINT ntype, int cx, int cy)
71 {
72     CWnd::OnSize(ntype, cx, cy);
73     RECT childrect;
74 //    int bottom;
75 
76     if (mp_resource_view)
77     {
78         GetClientRect(&childrect);
79         /*
80         bottom = childrect.bottom;
81         childrect.bottom = childrect.top + VIEW_HEADER_HEIGHT - 1;
82         mp_resource_header->MoveWindow(&childrect);
83 
84         childrect.top = childrect.bottom;
85         childrect.bottom = bottom;
86         */
87 
88         mp_resource_view->MoveWindow(&childrect);
89     }
90 }
91 
92 /*
93 void right_panel_frame::OnDraw(CDC *pDC)
94 {
95     CView::OnDraw(pDC);
96 }
97 */