Develop and Download Open Source Software

Browse CVS Repository

Contents of /satellite/neuromanager/neuromanager/NeuroManagerView.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.2 - (show annotations) (download) (as text)
Mon Mar 20 07:24:14 2006 UTC (18 years ago) by orrisroot
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +11 -4 lines
File MIME type: text/x-c++src
added menubar update samples.

1 /* --------------------------------------------------------------------- */
2 /* NeuroManager - A spike train analysis tool */
3 /* Copyright (c) 2005-2006 RIKEN, Japan. All rights reserved. */
4 /* http://satellite.sourceforge.jp/ */
5 /* --------------------------------------------------------------------- */
6 /* This program is free software; you can redistribute it and/or */
7 /* modify it under the terms of the GNU General Public License */
8 /* as published by the Free Software Foundation; either version 2 */
9 /* of the License, or (at your option) any later version. */
10 /* */
11 /* This program is distributed in the hope that it will be useful, */
12 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
13 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
14 /* GNU General Public License for more details. */
15 /* */
16 /* You should have received a copy of the GNU General Public License */
17 /* along with this program; see the file COPYING.txt. If not, write */
18 /* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth */
19 /* Floor, Boston, MA 02110-1301, USA. */
20 /* --------------------------------------------------------------------- */
21
22 /* $Id: NeuroManagerView.cpp,v 1.1 2006/02/04 13:38:16 orrisroot Exp $ */
23
24 // NeuroManagerView.cpp : implementation of the CNeuroManagerView class
25 //
26
27 #include "stdafx.h"
28 #include "NeuroManager.h"
29
30 #include "NeuroManagerDoc.h"
31 #include "NeuroManagerView.h"
32
33 #ifdef _DEBUG
34 #define new DEBUG_NEW
35 #endif
36
37
38 // CNeuroManagerView
39
40 IMPLEMENT_DYNCREATE( CNeuroManagerView, CView )
41
42 BEGIN_MESSAGE_MAP( CNeuroManagerView, CView )
43 ON_WM_ERASEBKGND()
44 ON_WM_DESTROY()
45 // Standard printing commands
46 ON_COMMAND( ID_FILE_PRINT, CView::OnFilePrint )
47 ON_COMMAND( ID_FILE_PRINT_DIRECT, CView::OnFilePrint )
48 ON_COMMAND( ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview )
49 END_MESSAGE_MAP()
50
51 // CNeuroManagerView construction/destruction
52
53 CNeuroManagerView::CNeuroManagerView()
54 {
55 // TODO: add construction code here
56 m_bInitilized = FALSE;
57 m_hOldBkgndBrush = 0;
58 }
59
60 CNeuroManagerView::~CNeuroManagerView()
61 {}
62
63 BOOL CNeuroManagerView::PreCreateWindow( CREATESTRUCT& cs )
64 {
65 // TODO: Modify the Window class or styles here by modifying
66 // the CREATESTRUCT cs
67 return CView::PreCreateWindow( cs );
68 }
69
70
71 // CNeuroManagerView drawing
72
73 void CNeuroManagerView::OnDraw( CDC* pDC )
74 {
75 CNeuroManagerDoc * pDoc = GetDocument();
76 ASSERT_VALID( pDoc );
77 if ( !pDoc )
78 return ;
79
80 // TODO: add draw code for native data here
81
82 }
83
84
85 // CNeuroManagerView printing
86
87 BOOL CNeuroManagerView::OnPreparePrinting( CPrintInfo* pInfo )
88 {
89 // default preparation
90 return DoPreparePrinting( pInfo );
91 }
92
93 void CNeuroManagerView::OnBeginPrinting( CDC* /*pDC*/, CPrintInfo* /*pInfo*/ )
94 {
95 // TODO: add extra initialization before printing
96 }
97
98 void CNeuroManagerView::OnEndPrinting( CDC* /*pDC*/, CPrintInfo* /*pInfo*/ )
99 {
100 // TODO: add cleanup after printing
101 }
102
103
104 // CNeuroManagerView diagnostics
105
106 #ifdef _DEBUG
107 void CNeuroManagerView::AssertValid() const
108 {
109 CView::AssertValid();
110 }
111
112 void CNeuroManagerView::Dump( CDumpContext& dc ) const
113 {
114 CView::Dump( dc );
115 }
116
117 CNeuroManagerDoc* CNeuroManagerView::GetDocument() const // non-debug version is inline
118 {
119 ASSERT( m_pDocument->IsKindOf( RUNTIME_CLASS( CNeuroManagerDoc ) ) );
120 return ( CNeuroManagerDoc* ) m_pDocument;
121 }
122 #endif //_DEBUG
123
124
125 BOOL CNeuroManagerView::OnEraseBkgnd( CDC* pDC )
126 {
127 BOOL ret = CView::OnEraseBkgnd( pDC );
128
129 pDC->SetBkColor( GetSysColor( COLOR_APPWORKSPACE ) ); // for background color of TextOut()
130
131 return ret;
132 }
133
134 void CNeuroManagerView::OnDestroy()
135 {
136 // resotore brush color
137 if ( m_bInitilized )
138 {
139 SetClassLongPtr( GetSafeHwnd(), GCL_HBRBACKGROUND, ( LONG_PTR ) m_hOldBkgndBrush );
140 m_hOldBkgndBrush = 0;
141 m_BkgndBrush.DeleteObject();
142 }
143
144 CView::OnDestroy();
145 }
146
147 void CNeuroManagerView::OnInitialUpdate()
148 {
149 CView::OnInitialUpdate();
150
151 if ( m_bInitilized == FALSE )
152 {
153 // create and change background brush color
154 m_BkgndBrush.CreateSolidBrush( GetSysColor( COLOR_APPWORKSPACE ) ); // color of MDI workspace
155 m_hOldBkgndBrush = ( HBRUSH ) SetClassLongPtr(
156 GetSafeHwnd(),
157 GCL_HBRBACKGROUND,
158 ( LONG_PTR ) m_BkgndBrush.m_hObject
159 );
160 // update plugin menus
161 CNeuroManagerDoc* pDoc = GetDocument();
162 CMenu *ParentMenu = GetParentFrame() ->GetMenu();
163 pDoc->SetPlguinMenu( ParentMenu );
164 // set initialized flag
165 m_bInitilized = TRUE;
166 }
167 }

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26