- Timestamp:
- Jul 19, 2008, 9:03:01 PM (16 years ago)
- Location:
- trunk/ab5.0/abdev
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ab5.0/abdev/BasicCompiler_Common/src/Program.cpp
r634 r697 66 66 // 親エディタのウィンドウ ハンドル 67 67 isKickedFromEditor = true; 68 sscanf( cmdLine.GetParameter().c_str(), "% 08x", &hOwnerEditor );68 sscanf( cmdLine.GetParameter().c_str(), "%p", &hOwnerEditor ); 69 69 } 70 70 else if( cmdLine.GetCommand() == "show_dlg" ) -
trunk/ab5.0/abdev/abdev/Common.h
r681 r697 345 345 }; 346 346 347 struct FILEIDENTITY{ 348 DWORD VolumeSerialNumber; 349 DWORD FileIndexHigh; 350 DWORD FileIndexLow; 351 }; 352 353 inline bool IsFileIdentityValid(FILEIDENTITY const& fi){ 354 return fi.VolumeSerialNumber != 0 355 && fi.FileIndexHigh != 0 356 && fi.FileIndexLow != 0; 357 } 358 359 inline bool operator ==(FILEIDENTITY const& lhs, FILEIDENTITY const& rhs) 360 { 361 return lhs.VolumeSerialNumber == rhs.VolumeSerialNumber 362 && lhs.FileIndexHigh == rhs.FileIndexHigh 363 && lhs.FileIndexLow == rhs.FileIndexLow; 364 } 365 347 366 struct MDIINFO{ 348 367 HWND hwnd; … … 350 369 std::string title; 351 370 std::string path; 371 FILEIDENTITY FileIdentity; 352 372 353 373 union{ … … 577 597 void ResetState_DocMenu(void); 578 598 void DuplicateTitleCheck(char *lpszTitle); 579 HWND NewTextEditWindow(char *filepath,_int8 DocumentType,COLORREF TabColor=TABCOLOR_GRAY);599 HWND NewTextEditWindow(char const *filepath,_int8 DocumentType,COLORREF TabColor=TABCOLOR_GRAY); 580 600 void CloseDocWindow(int WndNum); 581 601 void ResizeTextEditWnd(HWND hwnd,int cx,int cy); -
trunk/ab5.0/abdev/abdev/FileOperation.cpp
r651 r697 298 298 299 299 // TODO: 300 char *OpenFileName = const_cast<char *>(filePath.c_str());300 char const *OpenFileName = filePath.c_str(); 301 301 302 302 i=GetFileExtension(OpenFileName); -
trunk/ab5.0/abdev/abdev/abdev.cpp
r655 r697 3 3 #include "abdev.h" 4 4 5 #ifdef _DEBUG 6 #include <crtdbg.h> 7 #endif 5 8 6 9 #if defined HeapAlloc … … 731 734 } 732 735 } 733 HWND NewTextEditWindow(char *filepath,_int8 DocumentType,COLORREF TabColor) 736 737 //たぶんこれでは全然足りない 738 inline void PathNormalize(char *buf, size_t bufSize, const char *path) 739 { 740 DWORD shortFilepathLen = GetShortPathName(path, buf, bufSize); 741 std::replace(buf, buf + shortFilepathLen, '/', '\\'); 742 } 743 744 HWND NewTextEditWindow(const char *filepath,_int8 DocumentType,COLORREF TabColor) 734 745 { 735 746 int i; … … 739 750 int iCharCode=NKF_SHIFT_JIS; 740 751 int iLfCode=LFCODE_CRLF; 752 FILEIDENTITY fileIdentity = {0}; 741 753 742 754 if(filepath){ 755 HANDLE hFile=CreateFile(filepath,GENERIC_READ,FILE_SHARE_READ|FILE_SHARE_WRITE,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL); 756 if(hFile==INVALID_HANDLE_VALUE){ 757 sprintf(str,STRING_ERROR_CANT_FILEOPEN,filepath); 758 ::MessageBox(hOwner,str,STRING_ERROR,MB_OK|MB_ICONEXCLAMATION); 759 return 0; 760 } 761 DWORD length; 762 763 typedef BOOL WINAPI GFIBH(HANDLE, LPBY_HANDLE_FILE_INFORMATION); 764 BY_HANDLE_FILE_INFORMATION fi; 765 GFIBH *const pgfibh = reinterpret_cast<GFIBH*>( 766 GetProcAddress(GetModuleHandle("kernel32"), "GetFileInformationByHandle")); 767 if(pgfibh && pgfibh(hFile, &fi)){ 768 fileIdentity.VolumeSerialNumber = fi.dwVolumeSerialNumber; 769 fileIdentity.FileIndexHigh = fi.nFileIndexHigh; 770 fileIdentity.FileIndexLow = fi.nFileIndexLow; 771 length=fi.nFileSizeLow; 772 } 773 else{ 774 length=GetFileSize(hFile,NULL); 775 } 743 776 744 777 //すでに指定されたファイルが開かれている場合 745 778 hChild=::GetWindow(hClient,GW_CHILD); 779 char shortFilepath[MAX_PATH]; 780 PathNormalize(shortFilepath, MAX_PATH, filepath); 746 781 while(hChild){ 747 782 i=GetWndNum(hChild); 748 783 if(IS_DOCUMENT_TEXT(MdiInfo[i]->DocType)){ 749 if(lstrcmpi(MdiInfo[i]->path.c_str(),filepath)==0) break; 784 if(IsFileIdentityValid(fileIdentity)&&IsFileIdentityValid(MdiInfo[i]->FileIdentity) 785 && fileIdentity==MdiInfo[i]->FileIdentity) 786 { 787 break; 788 } 789 else{ 790 char shortPathnameDoc[MAX_PATH]; 791 PathNormalize(shortPathnameDoc, MAX_PATH, MdiInfo[i]->path.c_str()); 792 if(_strcmpi(shortFilepath,shortPathnameDoc)==0) 793 break; 794 } 750 795 } 751 796 hChild=::GetNextWindow(hChild,GW_HWNDNEXT); … … 761 806 //ファイル読み込み(正常に読み込めるかの確認も含む) 762 807 ////////////////////////////////////////////////////// 763 764 HANDLE hFile;765 hFile=CreateFile(filepath,GENERIC_READ,FILE_SHARE_READ|FILE_SHARE_WRITE,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);766 if(hFile==INVALID_HANDLE_VALUE){767 sprintf(str,STRING_ERROR_CANT_FILEOPEN,filepath);768 ::MessageBox(hOwner,str,STRING_ERROR,MB_OK|MB_ICONEXCLAMATION);769 return 0;770 }771 int length;772 length=GetFileSize(hFile,NULL);773 808 774 809 char *temp; … … 882 917 883 918 mdic.style |= WS_VISIBLE | WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_SYSMENU | WS_CAPTION | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX; 884 hChild=(HWND)SendMessage(hClient,WM_MDICREATE,0, (long)&mdic); //ウィンドウ作成919 hChild=(HWND)SendMessage(hClient,WM_MDICREATE,0,reinterpret_cast<LPARAM>(&mdic)); //ウィンドウ作成 885 920 886 921 //TextEditorコントロールを設置 … … 893 928 894 929 //ウィンドウのID登録 895 MdiInfo.push_back( new MDIINFO() ); 930 MDIINFO *pmi = new MDIINFO(); 931 MdiInfo.push_back( pmi ); 896 932 i = MdiInfo.size()-1; 897 MdiInfo[i]->hwnd=hChild;898 MdiInfo[i]->DocType=DocumentType;933 pmi->hwnd=hChild; 934 pmi->DocType=DocumentType; 899 935 DuplicateTitleCheck(str); 900 MdiInfo[i]->title = str; 936 pmi->title = str; 937 pmi->FileIdentity = fileIdentity; 901 938 if(filepath) 902 939 { 903 MdiInfo[i]->path = filepath;940 pmi->path = filepath; 904 941 } 905 942 else 906 943 { 907 MdiInfo[i]->path = "";908 } 909 910 MdiInfo[i]->pMdiTextEdit = new CMdiTextEdit( MdiInfo[i] );911 912 MdiInfo[i]->pMdiTextEdit->hEdit=hEdit;913 MdiInfo[i]->pMdiTextEdit->pobj_WebResult=new CWebResult(hChild);914 MdiInfo[i]->pMdiTextEdit->pobj_Ruler=new CRuler(hChild,MdiInfo[i]);915 MdiInfo[i]->pMdiTextEdit->hIcon=shfi.hIcon;916 MdiInfo[i]->pMdiTextEdit->buffer=buffer;917 MdiInfo[i]->pMdiTextEdit->pColorRef=(COLORREF *)HeapAlloc(hHeap,HEAP_ZERO_MEMORY,sizeof(COLORREF)*lstrlen(buffer));918 MdiInfo[i]->pMdiTextEdit->iUnderStart=-1;919 MdiInfo[i]->pMdiTextEdit->iUnderEnd=-1;920 MdiInfo[i]->pMdiTextEdit->StartCaretPos.x=0;921 MdiInfo[i]->pMdiTextEdit->StartCaretPos.y=0;922 MdiInfo[i]->pMdiTextEdit->EndCaretPos.x=0;923 MdiInfo[i]->pMdiTextEdit->EndCaretPos.y=0;924 MdiInfo[i]->pMdiTextEdit->Temp_UpDown_CaretXPos=-1;925 MdiInfo[i]->pMdiTextEdit->bAutoScroll=0;926 MdiInfo[i]->pMdiTextEdit->iWidth_ControlTabSpace=927 GetControlTabSpace(i,& MdiInfo[i]->pMdiTextEdit->iLineNumberTextCount);928 MdiInfo[i]->pMdiTextEdit->iCharCode=iCharCode;929 MdiInfo[i]->pMdiTextEdit->iLfCode=iLfCode;930 MdiInfo[i]->IndentStr=0;944 pmi->path = ""; 945 } 946 947 pmi->pMdiTextEdit = new CMdiTextEdit( MdiInfo[i] ); 948 949 pmi->pMdiTextEdit->hEdit=hEdit; 950 pmi->pMdiTextEdit->pobj_WebResult=new CWebResult(hChild); 951 pmi->pMdiTextEdit->pobj_Ruler=new CRuler(hChild,pmi); 952 pmi->pMdiTextEdit->hIcon=shfi.hIcon; 953 pmi->pMdiTextEdit->buffer=buffer; 954 pmi->pMdiTextEdit->pColorRef=(COLORREF *)HeapAlloc(hHeap,HEAP_ZERO_MEMORY,sizeof(COLORREF)*lstrlen(buffer)); 955 pmi->pMdiTextEdit->iUnderStart=-1; 956 pmi->pMdiTextEdit->iUnderEnd=-1; 957 pmi->pMdiTextEdit->StartCaretPos.x=0; 958 pmi->pMdiTextEdit->StartCaretPos.y=0; 959 pmi->pMdiTextEdit->EndCaretPos.x=0; 960 pmi->pMdiTextEdit->EndCaretPos.y=0; 961 pmi->pMdiTextEdit->Temp_UpDown_CaretXPos=-1; 962 pmi->pMdiTextEdit->bAutoScroll=0; 963 pmi->pMdiTextEdit->iWidth_ControlTabSpace= 964 GetControlTabSpace(i,&pmi->pMdiTextEdit->iLineNumberTextCount); 965 pmi->pMdiTextEdit->iCharCode=iCharCode; 966 pmi->pMdiTextEdit->iLfCode=iLfCode; 967 pmi->IndentStr=0; 931 968 932 969 … … 1453 1490 return RegisterClassEx(&wcl); 1454 1491 } 1455 int PASCAL WinMain(HINSTANCE hThisInst,HINSTANCE hPrevInst,LPSTR lpCmdLine,int ShowCmd){ 1492 int PASCAL WinMain(HINSTANCE hThisInst,HINSTANCE,LPSTR lpCmdLine,int ShowCmd){ 1493 #ifdef _DEBUG 1494 _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_CHECK_ALWAYS_DF | _CRTDBG_DELAY_FREE_MEM_DF | _CRTDBG_LEAK_CHECK_DF); 1495 #endif 1456 1496 int i,i2,IsStr; 1457 1497 char str[MAX_PATH],str2[MAX_PATH],dummy[1024]; -
trunk/ab5.0/abdev/abdev/include/MainFrame.h
r629 r697 34 34 35 35 // 生成された 36 ::LRESULT OnCreate( :: UINT msg, ::WPARAM wParam, ::LPARAM lParam, ::BOOL& handled);36 ::LRESULT OnCreate( ::CREATESTRUCT const* ); 37 37 38 38 // OSが終了する … … 255 255 // メッセージマップ 256 256 BEGIN_MSG_MAP( MainFrame ) 257 M ESSAGE_HANDLER( WM_CREATE,OnCreate )257 MSG_WM_CREATE( OnCreate ) 258 258 MSG_WM_SIZE( OnSize ) 259 259 MSG_WM_QUERYENDSESSION( OnQueryEndSession ) -
trunk/ab5.0/abdev/abdev/include/ProjectManager/ProjectManager.h
r655 r697 14 14 } 15 15 16 void Load( char *path );16 void Load( char const *path ); 17 17 void Save(); 18 18 bool Close(); -
trunk/ab5.0/abdev/abdev/src/MainFrame.cpp
r655 r697 171 171 } 172 172 173 ::LRESULT MainFrame::OnCreate( :: UINT msg, ::WPARAM wParam, ::LPARAM lParam, ::BOOL& handled)173 ::LRESULT MainFrame::OnCreate( ::CREATESTRUCT const* ) 174 174 { 175 175 // ウィンドウエリアマネージャに親ウィンドウを登録 … … 207 207 extern WNDPROC oldMainFrameWndProc; 208 208 oldMainFrameWndProc = (WNDPROC)::GetWindowLong( hOwner, GWL_WNDPROC ); 209 ::SetWindowLong ( hOwner, GWL_WNDPROC, (LONG)WindowFunc);209 ::SetWindowLongPtr( hOwner, GWL_WNDPROC, reinterpret_cast<LONG_PTR>(WindowFunc) ); 210 210 211 211 SetupWindow(hOwner); … … 517 517 void MainFrame::OnDropFiles( HDROP hDropInfo ) 518 518 { 519 int max = DragQueryFile(hDropInfo, -1,0,0);519 int max = DragQueryFile(hDropInfo,static_cast<DWORD>(-1),0,0); 520 520 for(int i=0;i<max;i++){ 521 521 char temporary[1024]; … … 526 526 } 527 527 528 void MainFrame::OnPaint( HDC dummy)528 void MainFrame::OnPaint( HDC ) 529 529 { 530 530 PAINTSTRUCT ps; … … 1096 1096 void CreateProcessWithStdHandle( const std::string &appPath, const std::string &cmdLine) 1097 1097 { 1098 std::string argsStr = (std::string)"\"" + appPath + "\" " + cmdLine;1098 std::string argsStr = "\"" + appPath + "\" " + cmdLine; 1099 1099 STARTUPINFO si; 1100 1100 PROCESS_INFORMATION pi; … … 1143 1143 1144 1144 if(IsNeedCompileForProject(1)) 1145 sprintf(temporary,"\"%s\" \"%s\" /debug /run /wnd:% 08x",temp2,temp3,m_hWnd);1145 sprintf(temporary,"\"%s\" \"%s\" /debug /run /wnd:%p",temp2,temp3,m_hWnd); 1146 1146 else 1147 sprintf(temporary,"\"%s\" \"%s\" /run /wnd:% 08x",temp2,temp3,m_hWnd);1147 sprintf(temporary,"\"%s\" \"%s\" /run /wnd:%p",temp2,temp3,m_hWnd); 1148 1148 1149 1149 // DLLオプション … … 1169 1169 if(!SetRunning(hChild)) return; 1170 1170 if(IsNeedCompile(MdiInfo[GetWndNum(hChild)]->path,1)) 1171 sprintf(temporary,"\"%s\" /debug /run /wnd:% 08x",MdiInfo[GetWndNum(hChild)]->path.c_str(),m_hWnd);1171 sprintf(temporary,"\"%s\" /debug /run /wnd:%p",MdiInfo[GetWndNum(hChild)]->path.c_str(),m_hWnd); 1172 1172 else 1173 sprintf(temporary,"\"%s\" /run /wnd:% 08x",MdiInfo[GetWndNum(hChild)]->path.c_str(),m_hWnd);1173 sprintf(temporary,"\"%s\" /run /wnd:%p",MdiInfo[GetWndNum(hChild)]->path.c_str(),m_hWnd); 1174 1174 1175 1175 //ブレークポイントをセーブ … … 1220 1220 lstrcpy( temp3, projectInfo.GetWorkDir().GetFullPath( temp3 ).c_str() ); 1221 1221 1222 sprintf(temporary,"\"%s\" \"%s\" /debug /wnd:% 08x",temp2,temp3,m_hWnd);1222 sprintf(temporary,"\"%s\" \"%s\" /debug /wnd:%p",temp2,temp3,m_hWnd); 1223 1223 1224 1224 //DLLオプション … … 1240 1240 //単独ソースコード 1241 1241 if(!SetRunning(hChild)) return; 1242 sprintf(temporary,"\"%s\" /debug /wnd:% 08x",MdiInfo[GetWndNum(hChild)]->path.c_str(),m_hWnd);1242 sprintf(temporary,"\"%s\" /debug /wnd:%p",MdiInfo[GetWndNum(hChild)]->path.c_str(),m_hWnd); 1243 1243 } 1244 1244 … … 1282 1282 if(idProcess==0) return; 1283 1283 1284 sprintf(temporary,"/attach:%08x /wnd:% 08x",idProcess,m_hWnd);1284 sprintf(temporary,"/attach:%08x /wnd:%p",idProcess,m_hWnd); 1285 1285 1286 1286 //コンパイルビューをクリップするかどうか … … 1340 1340 lstrcpy( temp3, projectInfo.GetWorkDir().GetFullPath( temp3 ).c_str() ); 1341 1341 1342 sprintf(temporary,"\"%s\" \"%s\" /wnd:% 08x",temp2,temp3,m_hWnd);1342 sprintf(temporary,"\"%s\" \"%s\" /wnd:%p",temp2,temp3,m_hWnd); 1343 1343 1344 1344 //DLLオプション … … 1360 1360 //単独ソースコード 1361 1361 if(!SetRunning(hChild)) return; 1362 sprintf(temporary,"\"%s\" /wnd:% 08x",MdiInfo[GetWndNum(hChild)]->path.c_str(),m_hWnd);1362 sprintf(temporary,"\"%s\" /wnd:%p",MdiInfo[GetWndNum(hChild)]->path.c_str(),m_hWnd); 1363 1363 } 1364 1364 … … 1707 1707 { 1708 1708 HWND hChild=::GetWindow(hClient,GW_CHILD); 1709 int WndNum=GetWndNum(hChild);1710 1709 1711 1710 TC_ITEM tcItem; -
trunk/ab5.0/abdev/abdev/src/ProjectManager/ProjectManager.cpp
r655 r697 5 5 void OpenWorkfile( const std::string &path ); 6 6 7 void Project::Load( char *path )7 void Project::Load( char const *path ) 8 8 { 9 9 extern HANDLE hHeap;
Note:
See TracChangeset
for help on using the changeset viewer.