[NEW_FEATURE] Add "Doc go to new instance" and "Doc open in new instance" feature.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository@320 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
donho 2008-09-15 01:01:51 +00:00
parent 5ef6a4a5b4
commit cc263ceda3
5 changed files with 30 additions and 7 deletions

View File

@ -1931,7 +1931,6 @@ BOOL Notepad_plus::notify(SCNotification *notification)
else
docGotoAnotherEditView(TransferMove);
}
//else on fout rien!!! // It's non view group
}
break;
}
@ -3918,6 +3917,14 @@ void Notepad_plus::command(int id)
checkSyncState();
break;
case IDM_VIEW_GOTO_NEW_INSTANCE :
docOpenInNewInstance(TransferMove);
break;
case IDM_VIEW_LOAD_IN_NEW_INSTANCE:
docOpenInNewInstance(TransferClone);
break;
case IDM_VIEW_SWITCHTO_MAIN:
switchEditViewTo(MAIN_VIEW);
break;
@ -4800,6 +4807,13 @@ void Notepad_plus::undockUserDlg()
(ScintillaEditView::getUserDefineDlg())->display();
//(_pEditView->getUserDefineDlg())->display();
}
void Notepad_plus::docOpenInNewInstance(FileTransferMode mode)
{
Command cmd(TEXT("$(NPP_DIRECTORY)\\notepad++.exe $(FULL_CURRENT_PATH) -multiInst -nosession"));
cmd.run(_hSelf);
if (mode == TransferMove)
doClose(_pEditView->getCurrentBufferID(), currentView());
}
void Notepad_plus::docGotoAnotherEditView(FileTransferMode mode)
{
@ -4808,9 +4822,12 @@ void Notepad_plus::docGotoAnotherEditView(FileTransferMode mode)
BufferID current = _pEditView->getCurrentBufferID();
int viewToGo = otherView();
int indexFound = _pNonDocTab->getIndexByBuffer(current);
if (indexFound != -1) { //activate it
if (indexFound != -1) //activate it
{
activateBuffer(current, otherView());
} else { //open the document, also copying the position
}
else //open the document, also copying the position
{
loadBufferIntoView(current, viewToGo);
Buffer * buf = MainFileManager->getBufferByID(current);
_pEditView->saveCurrentPos(); //allow copying of position
@ -4826,7 +4843,8 @@ void Notepad_plus::docGotoAnotherEditView(FileTransferMode mode)
}
//Close the document if we transfered the document instead of cloning it
if (mode == TransferMove) {
if (mode == TransferMove)
{
//just close the activate document, since thats the one we moved (no search)
doClose(_pEditView->getCurrentBufferID(), currentView());
} // else it was cone, so leave it

View File

@ -376,6 +376,7 @@ private:
int switchEditViewTo(int gid); //activate other view (set focus etc)
void docGotoAnotherEditView(FileTransferMode mode); //TransferMode
void docOpenInNewInstance(FileTransferMode mode);
void loadBufferIntoView(BufferID id, int whichOne, bool dontClose = false); //Doesnt _activate_ the buffer
void removeBufferFromView(BufferID id, int whichOne); //Activates alternative of possible, or creates clean document if not clean already

View File

@ -319,6 +319,8 @@ BEGIN
MENUITEM "Clone to another view", IDM_VIEW_CLONE_TO_ANOTHER_VIEW
MENUITEM "Activate main view", IDM_VIEW_SWITCHTO_MAIN
MENUITEM "Activate sub view", IDM_VIEW_SWITCHTO_SUB
MENUITEM "Go to new instance", IDM_VIEW_GOTO_NEW_INSTANCE
MENUITEM "Open to new instance", IDM_VIEW_LOAD_IN_NEW_INSTANCE
MENUITEM SEPARATOR
MENUITEM "Synchronize Vertical Scrolling", IDM_VIEW_SYNSCROLLV
MENUITEM "Synchronize Horizontal Scrolling", IDM_VIEW_SYNSCROLLH

View File

@ -180,6 +180,8 @@
#define IDM_VIEW_GOTO_ANOTHER_VIEW 10001
#define IDM_VIEW_CLONE_TO_ANOTHER_VIEW 10002
#define IDM_VIEW_GOTO_NEW_INSTANCE 10003
#define IDM_VIEW_LOAD_IN_NEW_INSTANCE 10004
#define IDM_VIEW_SWITCHTO_MAIN (IDM_VIEW + 70)
#define IDM_VIEW_SWITCHTO_SUB (IDM_VIEW + 71)

View File

@ -132,7 +132,7 @@
Name="VCCLCompilerTool"
Optimization="3"
InlineFunctionExpansion="0"
FavorSizeOrSpeed="2"
FavorSizeOrSpeed="1"
OmitFramePointers="false"
WholeProgramOptimization="false"
AdditionalIncludeDirectories="..\src\WinControls\AboutDlg;..\..\scintilla\include;..\include;..\src\WinControls;..\src\WinControls\ImageListSet;..\src\WinControls\OpenSaveFileDialog;..\src\WinControls\SplitterContainer;..\src\WinControls\StaticDialog;..\src\WinControls\TabBar;..\src\WinControls\ToolBar;..\src\MISC\Process;..\src\ScitillaComponent;..\src\MISC;..\src\MISC\SysMsg;..\src\WinControls\StatusBar;..\src;..\src\WinControls\StaticDialog\RunDlg;..\src\tinyxml;..\src\WinControls\ColourPicker;..\src\Win32Explr;..\src\MISC\RegExt;..\src\WinControls\TrayIcon;..\src\WinControls\shortcut;..\src\WinControls\Grid;..\src\WinControls\ContextMenu;..\src\MISC\PluginsManager;..\src\WinControls\Preference;..\src\WinControls\WindowsDlg;..\src\WinControls\TaskList;..\src\WinControls\DockingWnd;..\src\WinControls\ToolTip;..\src\MISC\Exception;..\src\MISC\Common"