Changeset 80 in dev
- Timestamp:
- Mar 26, 2007, 6:33:06 AM (18 years ago)
- Files:
-
- 50 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
ProjectEditor/BREGEXP.H
r3 r80 64 64 PFUNC_BRegexpVersion BRegexpVersion; 65 65 66 char *compare(HWND hFindDlg,char *buffer,char *exp,BOOL IsBigSmall, int *pLength);66 char *compare(HWND hFindDlg,char *buffer,char *exp,BOOL IsBigSmall, bool isWordUnit, int *pLength); 67 67 char *GetPermuStr(HWND hFindDlg,char *buffer,char *exp,char *szPermu,BOOL IsBigSmall); 68 68 }; -
ProjectEditor/Common.h
r79 r80 14 14 #include <process.h> 15 15 #include <wininet.h> 16 17 #include <vector> 18 #include <string> 19 #include <fstream> 20 21 using namespace std; 22 16 23 #include "nkf_class.h" 17 24 #include "WebSearch.h" … … 706 713 707 714 class CSettingFile{ 708 BOOL GetDataLine(c har *name,char *parms);715 BOOL GetDataLine(const char *name,char *parms); 709 716 protected: 710 717 char *buffer; 711 718 712 BOOL GetWholeValue(char *name,int *pi32data); 719 BOOL GetWholeValue(const char *name,int *pi32data); 720 bool GetBoolean( const char *name,bool &b ); 713 721 BOOL Get3WholeValue(char *name,int *pd1,int *pd2,int *pd3); 714 722 BOOL GetRGBValue(char *name,COLORREF *prgb); … … 718 726 BOOL GetRebarBand(SAVEREBAR *psr,int num); 719 727 720 void SetWholeValue(char *name,long i32data); 728 void SetWholeValue( const char *name,long i32data); 729 void SetBoolean( const char *name,bool b); 721 730 void Set3WholeValue(char *name,long d1,long d2,long d3); 722 731 void SetRGBValue(char *name,COLORREF rgb); … … 775 784 void GetRelationalPath(char *path,char *dir); 776 785 void GetFullPath(char *path,char *dir); 777 void RemoveDirectoryStrong(const char *dir _path);786 void RemoveDirectoryStrong(const char *dirPath); 778 787 BOOL GetFilePathDialog(HWND hwnd,char *filename,LPSTR Filter,LPSTR Title,_int8 IsOpen); 779 788 BOOL GetFolder(HWND hWnd,char *folder,char *OpenFolderTitle); … … 838 847 BOOL IsCommandBackDelimitation(char *buffer,int pos); 839 848 BOOL IsCommandDelimitation(char *buffer,int p); 840 char *ComparisonString( char *str1,char *str2,BOOL bBigSmall);849 char *ComparisonString( char *str1, char *str2, bool isBigSmall, bool isWordUnit ); 841 850 int GetOneParameter(char *Parameter,int pos,char *retAns); 842 851 int GetStringInPare(char *buffer,char *ReadBuffer); … … 862 871 BOOL SetRunning(HWND hChild); 863 872 BOOL IsNeedCompile(char *FileName,BOOL bDebug); 873 string GetLastErrorString(); 864 874 865 875 //DocumentAdvice.cpp -
ProjectEditor/FileOperation.cpp
r24 r80 172 172 } 173 173 174 void RemoveDirectoryStrong(const char *dir_path){ 174 void RemoveDirectoryStrong(const char *dirPath){ 175 char tempDirPath[MAX_PATH]; 176 lstrcpy( tempDirPath, dirPath ); 177 178 if( tempDirPath[lstrlen(tempDirPath)-1] == '\\' ){ 179 tempDirPath[lstrlen(tempDirPath)-1] = 0; 180 } 181 175 182 HANDLE hFind; 176 183 WIN32_FIND_DATA wfd; 177 184 char temporary[MAX_PATH]; 178 sprintf(temporary,"%s *",dir_path);185 sprintf(temporary,"%s\\*",tempDirPath); 179 186 180 187 hFind=FindFirstFile(temporary,&wfd); … … 184 191 if(!(lstrcmp(wfd.cFileName,".")==0||lstrcmp(wfd.cFileName,"..")==0)){ 185 192 //ディレクトリのとき 186 sprintf(temporary,"%s %s\\",dir_path,wfd.cFileName);193 sprintf(temporary,"%s\\%s\\",tempDirPath,wfd.cFileName); 187 194 RemoveDirectoryStrong(temporary); 188 195 } … … 190 197 else{ 191 198 //ファイルのとき 192 sprintf(temporary,"%s %s",dir_path,wfd.cFileName);199 sprintf(temporary,"%s\\%s",tempDirPath,wfd.cFileName); 193 200 194 201 DeleteFile(temporary); 195 202 } 196 203 }while(FindNextFile(hFind,&wfd)); 197 } 198 199 RemoveDirectory(dir_path); 204 205 FindClose( hFind ); 206 } 207 208 if( !RemoveDirectory(tempDirPath) ){ 209 OutputDebugString( GetLastErrorString().c_str() ); 210 OutputDebugString( "\r\n" ); 211 OutputDebugString( "一時ディレクトリの削除に失敗\r\n" ); 212 } 200 213 } 201 214 -
ProjectEditor/NonVolatile.cpp
r24 r80 127 127 } 128 128 129 BOOL CSettingFile::GetDataLine( char *name,char *parms){129 BOOL CSettingFile::GetDataLine( const char *name,char *parms){ 130 130 int i,i2,length; 131 131 length=lstrlen(name); … … 150 150 } 151 151 152 BOOL CSettingFile::GetWholeValue( char *name,int *pi32data){152 BOOL CSettingFile::GetWholeValue( const char *name, int *pi32data ){ 153 153 char temporary[8192]; 154 154 if(!GetDataLine(name,temporary)) return 0; 155 155 *pi32data=atoi(temporary); 156 return 1; 157 } 158 bool CSettingFile::GetBoolean( const char *name,bool &b ){ 159 int i=0; 160 if( !GetWholeValue( name, &i ) ){ 161 return 0; 162 } 163 164 b = ( i != 0 ) ? true:false; 165 156 166 return 1; 157 167 } … … 402 412 if(!GetWholeValue("IsFindStrBigSmall",&bFindStrBigSmall)) bFindStrBigSmall=0; 403 413 414 // 単語単位で検索するか 415 if( !GetBoolean("isWordUnit",isWordUnit) ){ 416 isWordUnit = false; 417 } 418 404 419 //検索時に、正規表現を利用するかどうか 405 420 if(!GetWholeValue("IsRegExp",&bRegExp)) bRegExp=0; … … 612 627 } 613 628 614 void CSettingFile::SetWholeValue(c har *name,long i32data){629 void CSettingFile::SetWholeValue(const char *name,long i32data){ 615 630 sprintf(buffer+lstrlen(buffer),"%s=%d\r\n",name,i32data); 631 } 632 void CSettingFile::SetBoolean(const char *name,bool b){ 633 sprintf(buffer+lstrlen(buffer),"%s=%d\r\n",name,b?1:0); 616 634 } 617 635 void CSettingFile::Set3WholeValue(char *name,long d1,long d2,long d3){ … … 779 797 SetWholeValue("IsFindStrBigSmall",bFindStrBigSmall); 780 798 799 // 単語単位で検索するか 800 SetBoolean("isWordUnit",isWordUnit); 801 781 802 //検索時に、正規表現を利用するか 782 803 SetWholeValue("IsRegExp",bRegExp); -
ProjectEditor/NonVolatile.h
r3 r80 17 17 //大文字・小文字検索を見分けるかどうか 18 18 BOOL bFindStrBigSmall; 19 20 // 単語単位で検索するか 21 bool isWordUnit; 19 22 20 23 //正規表現検索を行うかどうか -
ProjectEditor/Search.cpp
r24 r80 4 4 int FindPosCounter; 5 5 6 char *CompareSuper(HWND hDlg,char *buffer,char *szFind,BOOL IsBigSmall, BOOL IsRegExp,int *pLength){6 char *CompareSuper(HWND hDlg,char *buffer,char *szFind,BOOL IsBigSmall,bool isWordUnit,BOOL IsRegExp,int *pLength ){ 7 7 char *pTemp; 8 8 … … 11 11 if(IsRegExp){ 12 12 //正規表現を有効にしながら検索 13 pTemp=obj_RegExp.compare(hDlg,buffer,szFind,IsBigSmall, pLength);13 pTemp=obj_RegExp.compare(hDlg,buffer,szFind,IsBigSmall, isWordUnit, pLength); 14 14 } 15 15 else{ 16 16 //通常の検索 17 pTemp=ComparisonString(buffer,szFind,IsBigSmall );17 pTemp=ComparisonString(buffer,szFind,IsBigSmall?true:false, isWordUnit ); 18 18 19 19 *pLength=lstrlen(szFind); … … 23 23 } 24 24 25 void SetSearchData(HWND hDlg,char *str,_int8 IsBigSmall ){25 void SetSearchData(HWND hDlg,char *str,_int8 IsBigSmall, bool isWordUnit){ 26 26 extern HANDLE hHeap; 27 27 extern MDIINFO MdiInfo[MAX_WNDNUM]; … … 46 46 i3=1; 47 47 while(1){ 48 FindStr=CompareSuper(hDlg,buffer+i,str,IsBigSmall, pobj_nv->bRegExp,&length);48 FindStr=CompareSuper(hDlg,buffer+i,str,IsBigSmall, isWordUnit, pobj_nv->bRegExp,&length); 49 49 if(FindStr==(char *)-1){ 50 50 //エラー … … 136 136 return 0; 137 137 } 138 BOOL StartSearch(HWND hDlg,char *FindString,_int8 IsBigSmall, BOOL IsShowMessage){138 BOOL StartSearch(HWND hDlg,char *FindString,_int8 IsBigSmall, bool isWordUnit, BOOL IsShowMessage){ 139 139 extern MDIINFO MdiInfo[MAX_WNDNUM]; 140 140 int i; … … 155 155 int length; 156 156 157 i=(int)CompareSuper(hDlg,pBuf+i,FindString,IsBigSmall, pobj_nv->bRegExp,&length);157 i=(int)CompareSuper(hDlg,pBuf+i,FindString,IsBigSmall, isWordUnit, pobj_nv->bRegExp,&length); 158 158 if(i==-1){ 159 159 //エラー … … 173 173 if(!IsShowMessage) return 0; 174 174 175 i=(int)CompareSuper(hDlg,pBuf,FindString,IsBigSmall, pobj_nv->bRegExp,&length);175 i=(int)CompareSuper(hDlg,pBuf,FindString,IsBigSmall, isWordUnit, pobj_nv->bRegExp,&length); 176 176 if(i==-1){ 177 177 //エラー … … 223 223 //大文字・小文字 224 224 if(pobj_nv->bFindStrBigSmall) SendDlgItemMessage(hwnd,IDC_ISBIGSMALL,BM_SETCHECK,BST_CHECKED,0); 225 226 // 単語単位 227 if( pobj_nv->isWordUnit ){ 228 SendDlgItemMessage( hwnd, IDC_ISWORDUNIT, BM_SETCHECK, BST_CHECKED, 0 ); 229 } 225 230 226 231 //正規表現 … … 263 268 else pobj_nv->bFindStrBigSmall=0; 264 269 270 // 単語単位 271 pobj_nv->isWordUnit = 272 ( SendDlgItemMessage( hwnd, IDC_ISWORDUNIT, BM_GETCHECK, 0, 0 ) != 0 ); 273 265 274 //正規表現 266 275 if(SendDlgItemMessage(hwnd,IDC_REGEXP,BM_GETCHECK,0,0)) pobj_nv->bRegExp=1; 267 276 else pobj_nv->bRegExp=0; 268 277 269 StartSearch(hwnd,temporary,pobj_nv->bFindStrBigSmall, 1);278 StartSearch(hwnd,temporary,pobj_nv->bFindStrBigSmall, pobj_nv->isWordUnit, 1); 270 279 return 1; 271 280 case IDC_FINDALL: … … 278 287 else pobj_nv->bFindStrBigSmall=0; 279 288 289 // 単語単位 290 pobj_nv->isWordUnit = 291 ( SendDlgItemMessage( hwnd, IDC_ISWORDUNIT, BM_GETCHECK, 0, 0 ) != 0 ); 292 280 293 //正規表現 281 294 if(SendDlgItemMessage(hwnd,IDC_REGEXP,BM_GETCHECK,0,0)) pobj_nv->bRegExp=1; … … 287 300 FindPosCounter=sizeof(long); 288 301 pFindPos=(long *)HeapAlloc(hHeap,0,FindPosCounter); 289 SetSearchData(FindAllDlg,temporary,pobj_nv->bFindStrBigSmall );302 SetSearchData(FindAllDlg,temporary,pobj_nv->bFindStrBigSmall, pobj_nv->isWordUnit ); 290 303 case IDCANCEL: 291 304 EndDialog(hwnd,0); … … 311 324 if(pobj_nv->bFindStrBigSmall) SendDlgItemMessage(hwnd,IDC_ISBIGSMALL,BM_SETCHECK,BST_CHECKED,0); 312 325 326 // 単語単位 327 if( pobj_nv->isWordUnit ){ 328 SendDlgItemMessage( hwnd, IDC_ISWORDUNIT, BM_SETCHECK, BST_CHECKED, 0 ); 329 } 330 313 331 //正規表現 314 332 if(pobj_nv->bRegExp) SendDlgItemMessage(hwnd,IDC_REGEXP,BM_SETCHECK,BST_CHECKED,0); … … 356 374 else pobj_nv->bFindStrBigSmall=0; 357 375 376 // 単語単位 377 pobj_nv->isWordUnit = 378 ( SendDlgItemMessage( hwnd, IDC_ISWORDUNIT, BM_GETCHECK, 0, 0 ) != 0 ); 379 358 380 //正規表現 359 381 if(SendDlgItemMessage(hwnd,IDC_REGEXP,BM_GETCHECK,0,0)) pobj_nv->bRegExp=1; … … 364 386 AddFindData(GetDlgItem(hwnd,IDC_FINDSTR),pobj_nv->FindStr,temporary); 365 387 366 StartSearch(hwnd,temporary,pobj_nv->bFindStrBigSmall, 1);388 StartSearch(hwnd,temporary,pobj_nv->bFindStrBigSmall, pobj_nv->isWordUnit, 1); 367 389 return 1; 368 390 case IDC_PERMUTATIONNEXT: … … 374 396 if(SendDlgItemMessage(hwnd,IDC_ISBIGSMALL,BM_GETCHECK,0,0)) pobj_nv->bFindStrBigSmall=1; 375 397 else pobj_nv->bFindStrBigSmall=0; 398 399 // 単語単位 400 pobj_nv->isWordUnit = 401 ( SendDlgItemMessage( hwnd, IDC_ISWORDUNIT, BM_GETCHECK, 0, 0 ) != 0 ); 376 402 377 403 //正規表現 … … 399 425 400 426 int length; 401 i=(int)CompareSuper(hwnd,pTemp,temporary,pobj_nv->bFindStrBigSmall, pobj_nv->bRegExp,&length);427 i=(int)CompareSuper(hwnd,pTemp,temporary,pobj_nv->bFindStrBigSmall, pobj_nv->isWordUnit, pobj_nv->bRegExp,&length); 402 428 if(i==-1){ 403 429 HeapDefaultFree(pTemp); … … 441 467 else pobj_nv->bFindStrBigSmall=0; 442 468 469 // 単語単位 470 pobj_nv->isWordUnit = 471 ( SendDlgItemMessage( hwnd, IDC_ISWORDUNIT, BM_GETCHECK, 0, 0 ) != 0 ); 472 443 473 //正規表現 444 474 if(SendDlgItemMessage(hwnd,IDC_REGEXP,BM_GETCHECK,0,0)) pobj_nv->bRegExp=1; … … 462 492 TextEdit_SetSel(WndNum,0,0,TRUE); 463 493 464 while(StartSearch(hwnd,temporary,pobj_nv->bFindStrBigSmall, 0)){494 while(StartSearch(hwnd,temporary,pobj_nv->bFindStrBigSmall, pobj_nv->isWordUnit, 0)){ 465 495 if(pobj_nv->bRegExp){ 466 496 //選択されている文字列を取得 -
ProjectEditor/SubOperation.cpp
r69 r80 183 183 } 184 184 185 char *ComparisonString(char *str1,char *str2,BOOL bBigSmall){ 186 int i,i2,i3,len1,len2; 187 len1=lstrlen(str1); 188 len2=lstrlen(str2); 189 for(i=0;i<len1-len2+1;i++){ 190 for(i2=0,i3=i;i2<len2;i2++,i3++){ 191 if(bBigSmall){ 192 if(str1[i3]!=str2[i2]) break; 185 char *ComparisonString( char *str1, char *str2, bool isBigSmall, bool isWordUnit ){ 186 char *temp1 = (char *)malloc( lstrlen( str1 ) +1 ); 187 char *temp2 = (char *)malloc( lstrlen( str2 ) +1 ); 188 189 lstrcpy( temp1, str1 ); 190 lstrcpy( temp2, str2 ); 191 192 if( isBigSmall == false ){ 193 // 大文字小文字を区別しない場合 194 // すべて大文字にしておく 195 CharUpper( temp1 ); 196 CharUpper( temp2 ); 197 } 198 199 int len2 = lstrlen( temp2 ); 200 201 const char *temp3 = strstr( temp1, temp2 ); 202 while( temp3 ){ 203 if( isWordUnit ){ 204 int pos = (int)temp3 - (int)temp1; 205 if( pos == 0 ){ 206 if( !IsVariableChar( temp1[len2] ) ){ 207 break; 208 } 193 209 } 194 210 else{ 195 if((char)CharUpper((LPTSTR)MAKELONG(str1[i3],0))!=(char)CharUpper((LPTSTR)MAKELONG(str2[i2],0))) break; 196 } 197 } 198 if(IsDBCSLeadByte(str1[i])) i++; 199 if(i2==len2) return str1+i3-i2; 200 } 201 return 0; 211 if( !IsVariableChar( temp1[pos-1] ) 212 && !IsVariableChar( temp1[pos+len2] ) ){ 213 break; 214 } 215 } 216 } 217 else{ 218 break; 219 } 220 221 temp3 = strstr( temp3 + 1, temp2 ); 222 } 223 224 char *result = NULL; 225 if( temp3 ){ 226 int pos = (int)temp3 - (int)temp1; 227 result = str1 + pos; 228 } 229 230 free( temp1 ); 231 free( temp2 ); 232 233 return result; 202 234 } 203 235 int GetOneParameter(char *Parameter,int pos,char *retAns){ … … 1469 1501 return 1; 1470 1502 } 1503 1504 string GetLastErrorString(){ 1505 char *lpMsgBuf; 1506 1507 FormatMessage( 1508 FORMAT_MESSAGE_ALLOCATE_BUFFER | 1509 FORMAT_MESSAGE_FROM_SYSTEM | 1510 FORMAT_MESSAGE_IGNORE_INSERTS, 1511 NULL, 1512 GetLastError(), 1513 MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // デフォルト言語 1514 (LPTSTR) &lpMsgBuf, 1515 0, 1516 NULL 1517 ); 1518 1519 string result = lpMsgBuf; 1520 1521 LocalFree( lpMsgBuf ); 1522 1523 return result; 1524 } -
ProjectEditor/reg_exp.cpp
r3 r80 20 20 } 21 21 22 char *CRegExp::compare(HWND hFindDlg,char *buffer,char *exp,BOOL IsBigSmall, int *pLength){22 char *CRegExp::compare(HWND hFindDlg,char *buffer,char *exp,BOOL IsBigSmall, bool isWordUnit ,int *pLength){ 23 23 BREGEXP *rxp=0; 24 24 char msg[255]; … … 58 58 if((*pLength)==0) return 0; 59 59 60 pTemp=ComparisonString(buffer,(char *)rxp->outp, 0);60 pTemp=ComparisonString(buffer,(char *)rxp->outp,false, isWordUnit); 61 61 62 62 if(rxp) BRegfree(rxp); -
res/res.rc
r72 r80 487 487 END 488 488 489 IDD_FIND DIALOG DISCARDABLE 0, 0, 235, 71489 IDD_FIND DIALOG DISCARDABLE 0, 0, 235, 89 490 490 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU 491 491 CAPTION "検索" … … 496 496 WS_VSCROLL | WS_TABSTOP 497 497 CONTROL "大文字小文字を区別する(&C)",IDC_ISBIGSMALL,"Button", 498 BS_AUTOCHECKBOX | WS_TABSTOP,7,33,98,10 498 BS_AUTOCHECKBOX | WS_TABSTOP,22,34,98,10 499 CONTROL "単語単位(&W)",IDC_ISWORDUNIT,"Button",BS_AUTOCHECKBOX | 500 WS_TABSTOP,22,48,53,10 501 CONTROL "正規表現(&E)",IDC_REGEXP,"Button",BS_AUTOCHECKBOX | 502 WS_TABSTOP,22,62,52,10 499 503 DEFPUSHBUTTON "次を検索(&F)",IDOK,178,7,50,14 500 504 PUSHBUTTON "すべて検索(&A)",IDC_FINDALL,178,23,50,14 501 PUSHBUTTON "キャンセル",IDCANCEL,178,50,50,14 502 CONTROL "正規表現",IDC_REGEXP,"Button",BS_AUTOCHECKBOX | 503 WS_TABSTOP,7,45,43,10 505 PUSHBUTTON "キャンセル",IDCANCEL,178,68,50,14 504 506 END 505 507 … … 532 534 END 533 535 534 IDD_PERMUTATION DIALOG DISCARDABLE 0, 0, 267, 95536 IDD_PERMUTATION DIALOG DISCARDABLE 0, 0, 267, 111 535 537 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU 536 538 CAPTION "置換" … … 543 545 COMBOBOX IDC_PERMUTATIONSTR,68,25,134,70,CBS_DROPDOWN | 544 546 CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP 545 CONTROL "大文字と小文字を区別する(&C)",IDC_ISBIGSMALL,"Button", 546 BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,7,51,103,10 547 CONTROL "大文字小文字を区別する(&C)",IDC_ISBIGSMALL,"Button", 548 BS_AUTOCHECKBOX | WS_TABSTOP,38,53,98,10 549 CONTROL "単語単位(&W)",IDC_ISWORDUNIT,"Button",BS_AUTOCHECKBOX | 550 WS_TABSTOP,38,67,53,10 551 CONTROL "正規表現(&E)",IDC_REGEXP,"Button",BS_AUTOCHECKBOX | 552 WS_TABSTOP,38,81,52,10 547 553 DEFPUSHBUTTON "次を検索(&F)",IDC_FIND,210,7,50,14,WS_GROUP 548 554 PUSHBUTTON "次を置換(&R)",IDC_PERMUTATIONNEXT,210,24,50,14 549 555 PUSHBUTTON "すべて置換(&A)",IDC_PERMUTATIONALL,210,41,50,14 550 PUSHBUTTON "閉じる",IDCANCEL,210,74,50,14 551 CONTROL "正規表現",IDC_REGEXP,"Button",BS_AUTOCHECKBOX | 552 WS_TABSTOP,7,63,43,10 556 PUSHBUTTON "閉じる",IDCANCEL,210,90,50,14 553 557 END 554 558 … … 1867 1871 RIGHTMARGIN, 228 1868 1872 TOPMARGIN, 7 1869 BOTTOMMARGIN, 641873 BOTTOMMARGIN, 82 1870 1874 END 1871 1875 … … 1888 1892 RIGHTMARGIN, 260 1889 1893 TOPMARGIN, 7 1890 BOTTOMMARGIN, 881894 BOTTOMMARGIN, 104 1891 1895 END 1892 1896 -
res/resource.h
r72 r80 468 468 #define IDC_PASTEINDENT 1492 469 469 #define IDC_UNICODE 1494 470 #define IDC_ISWORDUNIT 1496 470 471 #define IDM_EXIT 40001 471 472 #define IDM_NEW 40002 … … 615 616 #define _APS_NEXT_RESOURCE_VALUE 311 616 617 #define _APS_NEXT_COMMAND_VALUE 40195 617 #define _APS_NEXT_CONTROL_VALUE 149 6618 #define _APS_NEXT_CONTROL_VALUE 1497 618 619 #define _APS_NEXT_SYMED_VALUE 101 619 620 #endif
Note:
See TracChangeset
for help on using the changeset viewer.