diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index 00a30c9ba..735d9de78 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -1934,6 +1934,40 @@ BOOL Notepad_plus::notify(SCNotification *notification) else docGotoAnotherEditView(TransferMove); } + else + { + generic_string quotFileName = TEXT("\""); + quotFileName += _pEditView->getCurrentBuffer()->getFilePath(); + quotFileName += TEXT("\""); + COPYDATASTRUCT fileNamesData; + fileNamesData.dwData = COPYDATA_FILENAMES; + fileNamesData.lpData = (void *)quotFileName.c_str(); + fileNamesData.cbData = long(quotFileName.length() + 1)*(sizeof(TCHAR)); + + HWND hWinParent = ::GetParent(hWin); + TCHAR className[MAX_PATH]; + ::GetClassName(hWinParent,className, sizeof(className)); + if (lstrcmp(className, _className) == 0 && hWinParent != _hSelf) + { + int index = _pDocTab->getCurrentTabIndex(); + BufferID bufferToClose = notifyDocTab->getBufferByIndex(index); + Buffer * buf = MainFileManager->getBufferByID(bufferToClose); + int iView = isFromPrimary?MAIN_VIEW:SUB_VIEW; + if (buf->isDirty()) + { + ::MessageBox(_hSelf, TEXT("Buffer can not be dirty"), TEXT(""), MB_OK); + } + else + { + //::SetActiveWindow(); + ::SendMessage(hWinParent, NPPM_INTERNAL_SWITCHVIEWFROMHWND, 0, (LPARAM)hWin); + ::SendMessage(hWinParent, WM_COPYDATA, (WPARAM)_hInst, (LPARAM)&fileNamesData); + fileClose(bufferToClose, iView); + } + + //printStr(TEXT("gogogo!!!")); + } + } } break; } @@ -7975,6 +8009,20 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa return TRUE; } + case NPPM_INTERNAL_SWITCHVIEWFROMHWND : + { + HWND handle = (HWND)lParam; + if (_mainEditView.getHSelf() == handle || _mainDocTab.getHSelf() == handle) + { + switchEditViewTo(MAIN_VIEW); + } + else if (_subEditView.getHSelf() == handle || _subDocTab.getHSelf() == handle) + { + switchEditViewTo(SUB_VIEW); + } + return TRUE; + } + case WM_INITMENUPOPUP: { _windowsMenu.initPopupMenu((HMENU)wParam, _pDocTab); diff --git a/PowerEditor/src/resource.h b/PowerEditor/src/resource.h index 1ea9925e7..97e23c705 100644 --- a/PowerEditor/src/resource.h +++ b/PowerEditor/src/resource.h @@ -297,6 +297,7 @@ #define NPPM_INTERNAL_SETCARETBLINKRATE (NOTEPADPLUS_USER_INTERNAL + 19) #define NPPM_INTERNAL_CLEARINDICATORTAGMATCH (NOTEPADPLUS_USER_INTERNAL + 20) #define NPPM_INTERNAL_CLEARINDICATORTAGATTR (NOTEPADPLUS_USER_INTERNAL + 21) + #define NPPM_INTERNAL_SWITCHVIEWFROMHWND (NOTEPADPLUS_USER_INTERNAL + 22) // See Notepad_plus_msgs.h //#define NOTEPADPLUS_USER (WM_USER + 1000) diff --git a/PowerEditor/visual.net/notepadPlus.vcproj b/PowerEditor/visual.net/notepadPlus.vcproj index 3f12bb6b2..b61a9a4c5 100644 --- a/PowerEditor/visual.net/notepadPlus.vcproj +++ b/PowerEditor/visual.net/notepadPlus.vcproj @@ -110,7 +110,7 @@ IntermediateDirectory="Release" ConfigurationType="1" InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops;.\no_ms_shit.vsprops" - CharacterSet="2" + CharacterSet="1" WholeProgramOptimization="1" > - -