source: dev/ProjectEditor/MdiTextEdit.cpp@ 27

Last change on this file since 27 was 24, checked in by dai_9181, 18 years ago

保存されていないドキュメントのタブに(*)をつける機能に対応。
MDITEXTEDITINFOをCMdiTextEditに変更。今後、オブジェクト指向化を進める。

File size: 1.2 KB
Line 
1#include "common.h"
2
3CMdiTextEdit::CMdiTextEdit( MDIINFO *pMdiInfo ){
4 this->pMdiInfo = pMdiInfo;
5
6 isModified = false;
7
8 BaseNumOfUndoRedo = 0;
9
10 pTextEditUndoState = (TEXTEDIT_UNDOSTATE *)HeapAlloc( hHeap, HEAP_ZERO_MEMORY, sizeof( TEXTEDIT_UNDOSTATE ) );
11 pTextEditUndoState->NowPos = 0;
12}
13CMdiTextEdit::~CMdiTextEdit(){
14 for( int i=0; i<MAX_UNDONUM; i++ ){
15 if( pTextEditUndoState->Command[i] ){
16 TextEdit_DeleteUndoData( pTextEditUndoState, i );
17 }
18 }
19 HeapDefaultFree( pTextEditUndoState );
20}
21
22void CMdiTextEdit::Modify(){
23 //変更時
24 isModified = true;
25
26 //タブ文字列に変更を示すアスタリスクを付ける
27 pobj_MainTab->NofityModifyDocument( pMdiInfo->title );
28}
29void CMdiTextEdit::UnModify(){
30 //変更状態解除
31 isModified = false;
32
33 //アスタリスク表示を解除する
34 pobj_MainTab->NofityUnModifyDocument( pMdiInfo->title );
35
36 //アンドゥーリドゥーのベース番号を取得
37 BaseNumOfUndoRedo = pTextEditUndoState->NowPos;
38}
39bool CMdiTextEdit::IsModified(){
40 return isModified;
41}
42
43void CMdiTextEdit::NofityUndoRedoToModify(){
44 if( BaseNumOfUndoRedo == pTextEditUndoState->NowPos ){
45 //変更なし
46 if( IsModified() ){
47 UnModify();
48 }
49 }
50 else{
51 //変更あり
52 if( ! IsModified() ){
53 Modify();
54 }
55 }
56}
Note: See TracBrowser for help on using the repository browser.