Changeset 24 in dev for ProjectEditor/Caret.cpp
- Timestamp:
- Dec 30, 2006, 10:18:01 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
ProjectEditor/Caret.cpp
r3 r24 123 123 124 124 pCharRange->cpMin=GetBufferIndexFromCaretPos( 125 MdiInfo[WndNum].p mti->buffer,126 MdiInfo[WndNum].p mti->StartCaretPos.x,127 MdiInfo[WndNum].p mti->StartCaretPos.y);128 129 if(MdiInfo[WndNum].p mti->StartCaretPos.x==MdiInfo[WndNum].pmti->EndCaretPos.x&&130 MdiInfo[WndNum].p mti->StartCaretPos.y==MdiInfo[WndNum].pmti->EndCaretPos.y){125 MdiInfo[WndNum].pMdiTextEdit->buffer, 126 MdiInfo[WndNum].pMdiTextEdit->StartCaretPos.x, 127 MdiInfo[WndNum].pMdiTextEdit->StartCaretPos.y); 128 129 if(MdiInfo[WndNum].pMdiTextEdit->StartCaretPos.x==MdiInfo[WndNum].pMdiTextEdit->EndCaretPos.x&& 130 MdiInfo[WndNum].pMdiTextEdit->StartCaretPos.y==MdiInfo[WndNum].pMdiTextEdit->EndCaretPos.y){ 131 131 //選択されていないとき 132 132 pCharRange->cpMax=pCharRange->cpMin; … … 134 134 else{ 135 135 pCharRange->cpMax=GetBufferIndexFromCaretPos( 136 MdiInfo[WndNum].p mti->buffer,137 MdiInfo[WndNum].p mti->EndCaretPos.x,138 MdiInfo[WndNum].p mti->EndCaretPos.y);136 MdiInfo[WndNum].pMdiTextEdit->buffer, 137 MdiInfo[WndNum].pMdiTextEdit->EndCaretPos.x, 138 MdiInfo[WndNum].pMdiTextEdit->EndCaretPos.y); 139 139 } 140 140 … … 150 150 151 151 memcpy(buffer, 152 MdiInfo[WndNum].p mti->buffer+pCharRange->cpMin,152 MdiInfo[WndNum].pMdiTextEdit->buffer+pCharRange->cpMin, 153 153 pCharRange->cpMax-pCharRange->cpMin); 154 154 buffer[pCharRange->cpMax-pCharRange->cpMin]=0; … … 159 159 160 160 HWND hEdit; 161 hEdit=MdiInfo[WndNum].p mti->hEdit;161 hEdit=MdiInfo[WndNum].pMdiTextEdit->hEdit; 162 162 163 163 //垂直スクロールバーの位置 … … 195 195 196 196 GetCaretPosFromBufferIndex( 197 MdiInfo[WndNum].p mti->buffer,197 MdiInfo[WndNum].pMdiTextEdit->buffer, 198 198 StartIndex, 199 &MdiInfo[WndNum].p mti->StartCaretPos);199 &MdiInfo[WndNum].pMdiTextEdit->StartCaretPos); 200 200 201 201 GetCaretPosFromBufferIndex( 202 MdiInfo[WndNum].p mti->buffer,202 MdiInfo[WndNum].pMdiTextEdit->buffer, 203 203 EndIndex, 204 &MdiInfo[WndNum].p mti->EndCaretPos);204 &MdiInfo[WndNum].pMdiTextEdit->EndCaretPos); 205 205 206 206 HWND hEdit; … … 222 222 int iStartPos; 223 223 iStartPos=code_pos; 224 while(MdiInfo[WndNum].p mti->buffer[iStartPos]!='\n'&&iStartPos>0) iStartPos--;225 if(MdiInfo[WndNum].p mti->buffer[iStartPos]=='\n') iStartPos++;224 while(MdiInfo[WndNum].pMdiTextEdit->buffer[iStartPos]!='\n'&&iStartPos>0) iStartPos--; 225 if(MdiInfo[WndNum].pMdiTextEdit->buffer[iStartPos]=='\n') iStartPos++; 226 226 227 227 int iEndPos; 228 228 iEndPos=code_pos; 229 while(MdiInfo[WndNum].p mti->buffer[iEndPos]!='\r'&&MdiInfo[WndNum].pmti->buffer[iEndPos]!='\0') iEndPos++;229 while(MdiInfo[WndNum].pMdiTextEdit->buffer[iEndPos]!='\r'&&MdiInfo[WndNum].pMdiTextEdit->buffer[iEndPos]!='\0') iEndPos++; 230 230 231 231 TextEdit_SetSel(WndNum,iStartPos,iEndPos,bShowCenter); … … 239 239 GetCaretPos(&OldPos); 240 240 241 x=MdiInfo[WndNum].p mti->StartCaretPos.x;242 y=MdiInfo[WndNum].p mti->StartCaretPos.y;241 x=MdiInfo[WndNum].pMdiTextEdit->StartCaretPos.x; 242 y=MdiInfo[WndNum].pMdiTextEdit->StartCaretPos.y; 243 243 GetScrollBaseCaretPos(WndNum,&x,&y); 244 244 245 245 //エディタ画面左端のコントロールタブ 246 246 int iControlTabSpace; 247 iControlTabSpace=MdiInfo[WndNum].p mti->iWidth_ControlTabSpace;247 iControlTabSpace=MdiInfo[WndNum].pMdiTextEdit->iWidth_ControlTabSpace; 248 248 249 249 //コントロールタブ上にカーソルがきたときに、非表示にする 250 if(OldPos.x>=iControlTabSpace&&x<0) HideCaret(MdiInfo[WndNum].p mti->hEdit);251 else if(OldPos.x<iControlTabSpace&&x>=0) ShowCaret(MdiInfo[WndNum].p mti->hEdit);250 if(OldPos.x>=iControlTabSpace&&x<0) HideCaret(MdiInfo[WndNum].pMdiTextEdit->hEdit); 251 else if(OldPos.x<iControlTabSpace&&x>=0) ShowCaret(MdiInfo[WndNum].pMdiTextEdit->hEdit); 252 252 253 253 SetCaretPos( … … 263 263 if(IS_DOCUMENT_TEXT(MdiInfo[WndNum].DocType)){ 264 264 int start,end; 265 if(MdiInfo[WndNum].p mti->StartCaretPos.x==MdiInfo[WndNum].pmti->EndCaretPos.x&&266 MdiInfo[WndNum].p mti->StartCaretPos.y==MdiInfo[WndNum].pmti->EndCaretPos.y){265 if(MdiInfo[WndNum].pMdiTextEdit->StartCaretPos.x==MdiInfo[WndNum].pMdiTextEdit->EndCaretPos.x&& 266 MdiInfo[WndNum].pMdiTextEdit->StartCaretPos.y==MdiInfo[WndNum].pMdiTextEdit->EndCaretPos.y){ 267 267 //文字列を選択中でないとき 268 268 269 269 int sw=0; 270 270 if(bInputAndReset){ 271 if(MdiInfo[WndNum].p mti->StartCaretPos.x>1){272 MdiInfo[WndNum].p mti->StartCaretPos.x-=2;271 if(MdiInfo[WndNum].pMdiTextEdit->StartCaretPos.x>1){ 272 MdiInfo[WndNum].pMdiTextEdit->StartCaretPos.x-=2; 273 273 sw=1; 274 274 } … … 276 276 277 277 TextEdit_GetWordCaret( 278 MdiInfo[WndNum].p mti->hEdit,278 MdiInfo[WndNum].pMdiTextEdit->hEdit, 279 279 WndNum, 280 &MdiInfo[WndNum].p mti->StartCaretPos,280 &MdiInfo[WndNum].pMdiTextEdit->StartCaretPos, 281 281 &start,&end, 282 282 WORDCARET_BEFORE); 283 283 284 if(sw) MdiInfo[WndNum].p mti->StartCaretPos.x+=2;284 if(sw) MdiInfo[WndNum].pMdiTextEdit->StartCaretPos.x+=2; 285 285 286 286 //半角文字列を選択時の全角とのズレを修正 287 287 POINT pos; 288 GetCaretPosFromBufferIndex(MdiInfo[WndNum].p mti->buffer,start,&pos);289 start=GetBufferIndexFromCaretPos(MdiInfo[WndNum].p mti->buffer,pos.x,pos.y);290 GetCaretPosFromBufferIndex(MdiInfo[WndNum].p mti->buffer,end,&pos);291 end=GetBufferIndexFromCaretPos(MdiInfo[WndNum].p mti->buffer,pos.x,pos.y);288 GetCaretPosFromBufferIndex(MdiInfo[WndNum].pMdiTextEdit->buffer,start,&pos); 289 start=GetBufferIndexFromCaretPos(MdiInfo[WndNum].pMdiTextEdit->buffer,pos.x,pos.y); 290 GetCaretPosFromBufferIndex(MdiInfo[WndNum].pMdiTextEdit->buffer,end,&pos); 291 end=GetBufferIndexFromCaretPos(MdiInfo[WndNum].pMdiTextEdit->buffer,pos.x,pos.y); 292 292 } 293 293 else{ 294 294 //文字列を選択中のとき 295 295 start=GetBufferIndexFromCaretPos( 296 MdiInfo[WndNum].p mti->buffer,297 MdiInfo[WndNum].p mti->StartCaretPos.x,298 MdiInfo[WndNum].p mti->StartCaretPos.y);296 MdiInfo[WndNum].pMdiTextEdit->buffer, 297 MdiInfo[WndNum].pMdiTextEdit->StartCaretPos.x, 298 MdiInfo[WndNum].pMdiTextEdit->StartCaretPos.y); 299 299 end=GetBufferIndexFromCaretPos( 300 MdiInfo[WndNum].p mti->buffer,301 MdiInfo[WndNum].p mti->EndCaretPos.x,302 MdiInfo[WndNum].p mti->EndCaretPos.y);300 MdiInfo[WndNum].pMdiTextEdit->buffer, 301 MdiInfo[WndNum].pMdiTextEdit->EndCaretPos.x, 302 MdiInfo[WndNum].pMdiTextEdit->EndCaretPos.y); 303 303 } 304 304 … … 315 315 if(length<0) length=0; 316 316 pTemp=(char *)HeapAlloc(hHeap,0,length+1024); 317 memcpy(pTemp,MdiInfo[WndNum].p mti->buffer+start,length);317 memcpy(pTemp,MdiInfo[WndNum].pMdiTextEdit->buffer+start,length); 318 318 pTemp[length]=0; 319 319 … … 359 359 char *pTemp,temporary[VN_SIZE]; 360 360 361 i=GetBufferIndexFromCaretPos(MdiInfo[WndNum].p mti->buffer,362 MdiInfo[WndNum].p mti->StartCaretPos.x,363 MdiInfo[WndNum].p mti->StartCaretPos.y);361 i=GetBufferIndexFromCaretPos(MdiInfo[WndNum].pMdiTextEdit->buffer, 362 MdiInfo[WndNum].pMdiTextEdit->StartCaretPos.x, 363 MdiInfo[WndNum].pMdiTextEdit->StartCaretPos.y); 364 364 365 365 if(i<ComplementWndInfo.iPos||ComplementWndInfo.iPos+ComplementWndInfo.iLength<i){ … … 384 384 pTemp=(char *)HeapAlloc(hHeap,0,ComplementWndInfo.iLength+1); 385 385 memcpy(pTemp, 386 MdiInfo[WndNum].p mti->buffer+ComplementWndInfo.iPos,386 MdiInfo[WndNum].pMdiTextEdit->buffer+ComplementWndInfo.iPos, 387 387 ComplementWndInfo.iLength); 388 388 pTemp[ComplementWndInfo.iLength]=0; … … 437 437 pTemp=(char *)HeapAlloc(hHeap,0,ComplementWndInfo.iLength+1); 438 438 memcpy(pTemp, 439 MdiInfo[WndNum].p mti->buffer+ComplementWndInfo.iPos,439 MdiInfo[WndNum].pMdiTextEdit->buffer+ComplementWndInfo.iPos, 440 440 ComplementWndInfo.iLength); 441 441 pTemp[ComplementWndInfo.iLength]=0; … … 468 468 469 469 HWND hEdit; 470 hEdit=MdiInfo[WndNum].p mti->hEdit;471 472 x=MdiInfo[WndNum].p mti->StartCaretPos.x;473 y=MdiInfo[WndNum].p mti->StartCaretPos.y;470 hEdit=MdiInfo[WndNum].pMdiTextEdit->hEdit; 471 472 x=MdiInfo[WndNum].pMdiTextEdit->StartCaretPos.x; 473 y=MdiInfo[WndNum].pMdiTextEdit->StartCaretPos.y; 474 474 GetScrollBaseCaretPos(WndNum,&x,&y); 475 475 … … 544 544 if(loose_y<0) loose_y=0; 545 545 546 pBuf=MdiInfo[WndNum].p mti->buffer;546 pBuf=MdiInfo[WndNum].pMdiTextEdit->buffer; 547 547 548 548 // 行の確認 … … 668 668 669 669 POINT *pCaretPos; 670 pCaretPos=&MdiInfo[WndNum].p mti->StartCaretPos;670 pCaretPos=&MdiInfo[WndNum].pMdiTextEdit->StartCaretPos; 671 671 672 672 if(pCaretPos->x==0&&pCaretPos->y==0){ … … 675 675 } 676 676 677 pBuf=MdiInfo[WndNum].p mti->buffer;677 pBuf=MdiInfo[WndNum].pMdiTextEdit->buffer; 678 678 679 679 i=GetBufferIndexFromCaretPos(pBuf, … … 721 721 char *pBuf; 722 722 723 pBuf=MdiInfo[WndNum].p mti->buffer;723 pBuf=MdiInfo[WndNum].pMdiTextEdit->buffer; 724 724 725 725 i=GetBufferIndexFromCaretPos(pBuf, … … 779 779 780 780 //上下のキャレット移動時には、左右方向の位置を保持する 781 if(MdiInfo[WndNum].p mti->Temp_UpDown_CaretXPos==-1)782 MdiInfo[WndNum].p mti->Temp_UpDown_CaretXPos=pCaretPos->x;781 if(MdiInfo[WndNum].pMdiTextEdit->Temp_UpDown_CaretXPos==-1) 782 MdiInfo[WndNum].pMdiTextEdit->Temp_UpDown_CaretXPos=pCaretPos->x; 783 783 784 784 pCaretPos->y--; 785 785 786 786 CaretPos_LooseToNatural(WndNum, 787 MdiInfo[WndNum].p mti->Temp_UpDown_CaretXPos,787 MdiInfo[WndNum].pMdiTextEdit->Temp_UpDown_CaretXPos, 788 788 pCaretPos->y, 789 789 pCaretPos); … … 796 796 797 797 //上下のキャレット移動時には、左右方向の位置を保持する 798 if(MdiInfo[WndNum].p mti->Temp_UpDown_CaretXPos==-1)799 MdiInfo[WndNum].p mti->Temp_UpDown_CaretXPos=pCaretPos->x;798 if(MdiInfo[WndNum].pMdiTextEdit->Temp_UpDown_CaretXPos==-1) 799 MdiInfo[WndNum].pMdiTextEdit->Temp_UpDown_CaretXPos=pCaretPos->x; 800 800 801 801 pCaretPos->y++; 802 802 803 803 CaretPos_LooseToNatural(WndNum, 804 MdiInfo[WndNum].p mti->Temp_UpDown_CaretXPos,804 MdiInfo[WndNum].pMdiTextEdit->Temp_UpDown_CaretXPos, 805 805 pCaretPos->y, 806 806 pCaretPos); … … 818 818 819 819 //上下のキャレット移動時には、左右方向の位置を保持する 820 if(MdiInfo[WndNum].p mti->Temp_UpDown_CaretXPos==-1)821 MdiInfo[WndNum].p mti->Temp_UpDown_CaretXPos=pCaretPos->x;820 if(MdiInfo[WndNum].pMdiTextEdit->Temp_UpDown_CaretXPos==-1) 821 MdiInfo[WndNum].pMdiTextEdit->Temp_UpDown_CaretXPos=pCaretPos->x; 822 822 823 823 SCROLLINFO si; 824 824 si.cbSize=sizeof(SCROLLINFO); 825 825 si.fMask=SIF_PAGE; 826 GetScrollInfo(MdiInfo[WndNum].p mti->hEdit,SB_VERT,&si);826 GetScrollInfo(MdiInfo[WndNum].pMdiTextEdit->hEdit,SB_VERT,&si); 827 827 pCaretPos->y-=si.nPage; 828 828 if(pCaretPos->y<0) pCaretPos->y=0; 829 829 830 830 CaretPos_LooseToNatural(WndNum, 831 MdiInfo[WndNum].p mti->Temp_UpDown_CaretXPos,831 MdiInfo[WndNum].pMdiTextEdit->Temp_UpDown_CaretXPos, 832 832 pCaretPos->y, 833 833 pCaretPos); … … 840 840 841 841 //上下のキャレット移動時には、左右方向の位置を保持する 842 if(MdiInfo[WndNum].p mti->Temp_UpDown_CaretXPos==-1)843 MdiInfo[WndNum].p mti->Temp_UpDown_CaretXPos=pCaretPos->x;842 if(MdiInfo[WndNum].pMdiTextEdit->Temp_UpDown_CaretXPos==-1) 843 MdiInfo[WndNum].pMdiTextEdit->Temp_UpDown_CaretXPos=pCaretPos->x; 844 844 845 845 SCROLLINFO si; 846 846 si.cbSize=sizeof(SCROLLINFO); 847 847 si.fMask=SIF_PAGE; 848 GetScrollInfo(MdiInfo[WndNum].p mti->hEdit,SB_VERT,&si);848 GetScrollInfo(MdiInfo[WndNum].pMdiTextEdit->hEdit,SB_VERT,&si); 849 849 pCaretPos->y+=si.nPage; 850 850 851 851 CaretPos_LooseToNatural(WndNum, 852 MdiInfo[WndNum].p mti->Temp_UpDown_CaretXPos,852 MdiInfo[WndNum].pMdiTextEdit->Temp_UpDown_CaretXPos, 853 853 pCaretPos->y, 854 854 pCaretPos);
Note:
See TracChangeset
for help on using the changeset viewer.