00001 // 00002 // ExDocument.cpp : インプリメンテーション ファイル 00003 // 00004 00005 #include "ExDocument.h" 00006 00007 00008 #ifdef _DEBUG 00009 #define new DEBUG_NEW 00010 #undef THIS_FILE 00011 static char THIS_FILE[] = __FILE__; 00012 #endif 00013 00014 00015 using namespace jbxwl; 00016 00017 00018 00020 // CExDocument 00021 00022 IMPLEMENT_DYNCREATE(CExDocument, CDocument) 00023 00024 00025 CExDocument::CExDocument() 00026 { 00027 //DEBUG_WARN("CExDocument::CExDocument Start\n"); 00028 00029 init_CmnHead(&infHead); 00030 msGraph.init(); 00031 cmnHead.init(); 00032 00033 hasReadData = FALSE; // データを正常に読み込み,保持しているか. 00034 hasViewData = FALSE; // 読み込んだデータから表示用データを作成したか. 00035 ctrlCntrst = FALSE; // 表示用データ作成時に(画素値が255以下でも)強制的にコントラストを調整を行う. 00036 multiSliceData = FALSE; // TRUE ならマルチスライス読み込みモード 00037 notFreeMSGraph = FALSE; // メモリ管理無しの場合,このオブジェクトが msGraph のメモリを開放するのは禁止. 00038 notFreeCmnHead = FALSE; // メモリ管理無しの場合,このオブジェクトが cmnHead のメモリを開放するのは禁止. 00039 00040 pView = NULL; 00041 pFrame = NULL; 00042 pApp = NULL; 00043 anyData = NULL; 00044 00045 Title = _T(""); 00046 preTitle = _T(""); 00047 pstTitle = _T(""); 00048 00049 startNo = 0; 00050 endNo = 0; 00051 vMax = 0; 00052 vMin = 0; 00053 colorMode = GRAPH_COLOR_MONO; 00054 base = 0; 00055 00056 //DEBUG_WARN("CExDocument::CExDocument End\n"); 00057 } 00058 00059 00060 00061 CExDocument::~CExDocument() 00062 { 00063 DEBUG_INFO("DESTRUCTOR: CExDocument\n"); 00064 00065 if (pApp!=NULL) pApp->DocumentDestructor(this); // 上位アプリケーションに通知 00066 00067 if (notFreeCmnHead) cmnHead.mfree(); 00068 else cmnHead.free(); 00069 if (notFreeMSGraph) msGraph.mfree(); 00070 else msGraph.free(); 00071 00072 if (!isNull(pView)) pView->pDoc = NULL; 00073 if (!isNull(pFrame)) pFrame->pDoc = NULL; 00074 pView = NULL; 00075 pFrame = NULL; 00076 } 00077 00078 00079 00080 BEGIN_MESSAGE_MAP(CExDocument, CDocument) 00081 //{{AFX_MSG_MAP(CExDocument) 00082 // メモ - ClassWizard はこの位置にマッピング用のマクロを追加または削除します. 00083 //}}AFX_MSG_MAP 00084 END_MESSAGE_MAP() 00085 00086 00087 00089 // CExDocument 診断 00090 00091 #ifdef _DEBUG 00092 void CExDocument::AssertValid() const 00093 { 00094 CDocument::AssertValid(); 00095 } 00096 00097 00098 // 00099 void CExDocument::Dump(CDumpContext& dc) const 00100 { 00101 CDocument::Dump(dc); 00102 } 00103 #endif //_DEBUG 00104 00105 00106 00108 // CExDocument シリアライズ 00109 00110 void CExDocument::Serialize(CArchive& ar) 00111 { 00112 if (ar.IsStoring()) 00113 { 00114 // TODO: この位置に保存用のコードを追加してください 00115 } 00116 else 00117 { 00118 // TODO: この位置に読み込み用のコードを追加してください 00119 } 00120 } 00121 00122 00123 00124 00126 // CExDocument コマンド 00127 00128 BOOL CExDocument::OnNewDocument() 00129 { 00130 //DEBUG_INFO("CExDocument::OnNewDocument(): START\n"); 00131 00132 if (!hasReadData) return FALSE; 00133 00134 if (!hasViewData) hasViewData = MakeViewData(); 00135 if (!hasViewData) return FALSE; 00136 00137 //DEBUG_INFO("CExDocument::OnNewDocument(): END\n"); 00138 return TRUE; 00139 } 00140 00141 00142 // 00143 BOOL CExDocument::OnOpenDocument(LPCTSTR lpszPathName) 00144 { 00145 //DEBUG_INFO("CExDocument::OnOpenDocument(): START\n"); 00146 00147 if (!hasReadData) hasReadData = ReadDataFile(lpszPathName); 00148 if (!hasReadData) return FALSE; 00149 00150 if (!hasViewData) hasViewData = MakeViewData(); 00151 if (!hasViewData) return FALSE; 00152 00153 //DEBUG_INFO("CExDocument::OnOpenDocument(): END\n"); 00154 return TRUE; 00155 } 00156 00157 00158 // 00159 CExView* CExDocument::GetView() 00160 { 00161 if (pView==NULL) { 00162 POSITION pos = GetFirstViewPosition(); 00163 while (pos!=NULL) { 00164 CExView* pview = (CExView*)GetNextView(pos); 00165 if (this==pview->GetDocument()) return pview; 00166 } 00167 return NULL; 00168 } 00169 return pView; 00170 } 00171 00172 00173 00180 BOOL CExDocument::ReadDataFile(LPCTSTR str) 00181 { 00182 return TRUE; 00183 } 00184 00185 00186 // 00187 // 読み込んだデータから表示用のデータを作る. 00188 // オーバーライド用 00189 // 00190 BOOL CExDocument::MakeViewData() 00191 { 00192 return TRUE; 00193 } 00194 00195 00196 // 00197 // データを書き込む. 00198 // オーバーライド用 00199 // 00200 BOOL CExDocument::WriteDataFile(LPCTSTR fname) 00201 { 00202 return TRUE; 00203 } 00204 00205