[NEW_FEATURE] Move document to another instance of Notepad++ via DnD doc tab.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository@329 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
donho 2008-09-26 21:52:06 +00:00
parent ab5c0fab62
commit f63a7529ad
3 changed files with 50 additions and 5 deletions

View File

@ -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);

View File

@ -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)

View File

@ -110,7 +110,7 @@
IntermediateDirectory="Release"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops;.\no_ms_shit.vsprops"
CharacterSet="2"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
@ -607,10 +607,6 @@
RelativePath="..\src\MISC\RegExt\regExtDlgRc.h"
>
</File>
<File
RelativePath="..\src\WinControls\Preference\resource.h"
>
</File>
<File
RelativePath="..\src\resource.h"
>