Ignore:
Timestamp:
Dec 30, 2006, 10:18:01 AM (18 years ago)
Author:
dai_9181
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ProjectEditor/TextEditor_UndoRedo.cpp

    r3 r24  
    99    if(MdiInfo[WndNum].IndentStr) CancelBeforeAutoIndent(WndNum);
    1010
    11     pUndoState=MdiInfo[WndNum].edit_undo;
     11    pUndoState=MdiInfo[WndNum].pMdiTextEdit->pTextEditUndoState;
    1212    i=pUndoState->NowPos-1;
    1313    if(i==-1) i=MAX_UNDONUM-1;
     
    1919
    2020    //選択範囲をセット
    21     GetCaretPosFromBufferIndex(MdiInfo[WndNum].pmti->buffer,
     21    GetCaretPosFromBufferIndex(MdiInfo[WndNum].pMdiTextEdit->buffer,
    2222        pUndoState->Range[pUndoState->NowPos].cpMin,
    23         &MdiInfo[WndNum].pmti->StartCaretPos);
    24     GetCaretPosFromBufferIndex(MdiInfo[WndNum].pmti->buffer,
     23        &MdiInfo[WndNum].pMdiTextEdit->StartCaretPos);
     24    GetCaretPosFromBufferIndex(MdiInfo[WndNum].pMdiTextEdit->buffer,
    2525        pUndoState->Range[pUndoState->NowPos].cpMax,
    26         &MdiInfo[WndNum].pmti->EndCaretPos);
     26        &MdiInfo[WndNum].pMdiTextEdit->EndCaretPos);
    2727
    2828    switch(pUndoState->Command[pUndoState->NowPos]){
     
    4141    //元に戻す、やり直しメニューをリセット
    4242    ResetState_UndoMenu();
     43
     44    //変更を通知
     45    MdiInfo[WndNum].pMdiTextEdit->NofityUndoRedoToModify();
    4346}
    4447void TextEdit_RedoCommand(int WndNum){
     
    4649    TEXTEDIT_UNDOSTATE *pUndoState;
    4750
    48     pUndoState=MdiInfo[WndNum].edit_undo;
     51    pUndoState=MdiInfo[WndNum].pMdiTextEdit->pTextEditUndoState;
    4952    if(!pUndoState->Command[pUndoState->NowPos]){
    5053        MessageBeep(0);
     
    5659        case TEXTEDIT_UNDO_PASTE:
    5760            //選択範囲をセット
    58             GetCaretPosFromBufferIndex(MdiInfo[WndNum].pmti->buffer,
     61            GetCaretPosFromBufferIndex(MdiInfo[WndNum].pMdiTextEdit->buffer,
    5962                pUndoState->Range[pUndoState->NowPos].cpMin,
    60                 &MdiInfo[WndNum].pmti->StartCaretPos);
    61             GetCaretPosFromBufferIndex(MdiInfo[WndNum].pmti->buffer,
     63                &MdiInfo[WndNum].pMdiTextEdit->StartCaretPos);
     64            GetCaretPosFromBufferIndex(MdiInfo[WndNum].pMdiTextEdit->buffer,
    6265                pUndoState->Range[pUndoState->NowPos].cpMin,
    63                 &MdiInfo[WndNum].pmti->EndCaretPos);
     66                &MdiInfo[WndNum].pMdiTextEdit->EndCaretPos);
    6467
    6568            TextEdit_Replace(WndNum,pUndoState->KeyStr[pUndoState->NowPos],1);
     
    6770        case TEXTEDIT_UNDO_SELKEY:
    6871            //選択範囲をセット
    69             GetCaretPosFromBufferIndex(MdiInfo[WndNum].pmti->buffer,
     72            GetCaretPosFromBufferIndex(MdiInfo[WndNum].pMdiTextEdit->buffer,
    7073                pUndoState->DelRange[pUndoState->NowPos].cpMin,
    71                 &MdiInfo[WndNum].pmti->StartCaretPos);
    72             GetCaretPosFromBufferIndex(MdiInfo[WndNum].pmti->buffer,
     74                &MdiInfo[WndNum].pMdiTextEdit->StartCaretPos);
     75            GetCaretPosFromBufferIndex(MdiInfo[WndNum].pMdiTextEdit->buffer,
    7376                pUndoState->DelRange[pUndoState->NowPos].cpMax,
    74                 &MdiInfo[WndNum].pmti->EndCaretPos);
     77                &MdiInfo[WndNum].pMdiTextEdit->EndCaretPos);
    7578
    7679            TextEdit_Replace(WndNum,pUndoState->KeyStr[pUndoState->NowPos],1);
     
    8689    //元に戻す、やり直しメニューをリセット
    8790    ResetState_UndoMenu();
     91
     92    //変更を通知
     93    MdiInfo[WndNum].pMdiTextEdit->NofityUndoRedoToModify();
    8894}
    8995
     
    102108    TEXTEDIT_UNDOSTATE *pUndoState;
    103109
    104     pUndoState=MdiInfo[WndNum].edit_undo;
     110    pUndoState=MdiInfo[WndNum].pMdiTextEdit->pTextEditUndoState;
    105111
    106112    //Redoされた場合の不要なデータを削除する
     
    108114        if(i==MAX_UNDONUM) i=0;
    109115        if(pUndoState->Command[i]==0) break;
    110         TextEdit_DeleteUndoData(WndNum,i);
     116        TextEdit_DeleteUndoData(pUndoState,i);
    111117    }
    112118
     
    141147    if(pUndoState->Command[pUndoState->NowPos]){
    142148        //一番古い情報を切り捨てる
    143         TextEdit_DeleteUndoData(WndNum,pUndoState->NowPos);
     149        TextEdit_DeleteUndoData(pUndoState,pUndoState->NowPos);
    144150    }
    145151
     
    148154}
    149155
    150 void TextEdit_DeleteUndoData(int WndNum,int pos){
    151     extern MDIINFO MdiInfo[MAX_WNDNUM];
    152     TEXTEDIT_UNDOSTATE *pUndoState;
    153 
    154     pUndoState=MdiInfo[WndNum].edit_undo;
     156void TextEdit_DeleteUndoData(TEXTEDIT_UNDOSTATE *pUndoState,int pos){
    155157    if(pUndoState->KeyStr[pos]) HeapDefaultFree(pUndoState->KeyStr[pos]);
    156158    if(pUndoState->DelStr[pos]) HeapDefaultFree(pUndoState->DelStr[pos]);
Note: See TracChangeset for help on using the changeset viewer.