2012-04-15 16:54:38 +00:00
// This file is part of Notepad++ project
// Copyright (C)2003 Don HO <don.h@free.fr>
2010-01-29 23:52:47 +00:00
//
2012-04-15 16:54:38 +00:00
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
2010-01-29 23:52:47 +00:00
//
2012-04-15 16:54:38 +00:00
// Note that the GPL places important restrictions on "derived works", yet
2015-08-06 09:03:57 +00:00
// it does not provide a detailed definition of that term. To avoid
// misunderstandings, we consider an application to constitute a
2012-04-15 16:54:38 +00:00
// "derivative work" for the purpose of this license if it does any of the
2015-08-06 09:03:57 +00:00
// following:
2012-04-15 16:54:38 +00:00
// 1. Integrates source code from Notepad++.
// 2. Integrates/includes/aggregates Notepad++ into a proprietary executable
// installer, such as those produced by InstallShield.
// 3. Links to a library or executes a program that does any of the above.
2010-01-29 23:52:47 +00:00
//
2012-04-15 16:54:38 +00:00
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
2015-06-02 16:01:47 +00:00
# include <memory>
# include <shlwapi.h>
2010-03-26 00:22:14 +00:00
# include "Notepad_plus_Window.h"
2010-01-29 23:52:47 +00:00
# include "EncodingMapper.h"
# include "ShortcutMapper.h"
# include "TaskListDlg.h"
2011-04-20 21:45:18 +00:00
# include "clipboardFormats.h"
2011-06-13 01:24:00 +00:00
# include "VerticalFileSwitcher.h"
2012-03-04 18:04:36 +00:00
# include "documentMap.h"
2013-06-04 23:46:24 +00:00
# include "functionListPanel.h"
2016-02-08 00:34:33 +00:00
# include "fileBrowser.h"
2015-05-17 17:18:43 +00:00
# include "Sorters.h"
2015-05-26 13:58:46 +00:00
# include "LongRunningOperation.h"
2011-03-11 00:57:06 +00:00
2015-05-31 20:40:07 +00:00
using namespace std ;
2014-06-12 23:30:28 +00:00
2010-08-15 18:52:55 +00:00
void Notepad_plus : : macroPlayback ( Macro macro )
{
2015-10-24 01:48:11 +00:00
LongRunningOperation op ;
2010-08-15 18:52:55 +00:00
_pEditView - > execute ( SCI_BEGINUNDOACTION ) ;
2013-07-07 21:33:19 +00:00
for ( Macro : : iterator step = macro . begin ( ) ; step ! = macro . end ( ) ; + + step )
2010-08-15 18:52:55 +00:00
{
if ( step - > isPlayable ( ) )
step - > PlayBack ( this - > _pPublicInterface , _pEditView ) ;
else
2016-06-05 18:29:21 +00:00
_findReplaceDlg . execSavedCommand ( step - > _message , step - > _lParameter , step - > _sParameter ) ;
2010-08-15 18:52:55 +00:00
}
_pEditView - > execute ( SCI_ENDUNDOACTION ) ;
}
2010-01-29 23:52:47 +00:00
2015-08-06 09:03:57 +00:00
void Notepad_plus : : command ( int id )
2010-01-29 23:52:47 +00:00
{
switch ( id )
{
case IDM_FILE_NEW :
2011-05-19 21:19:05 +00:00
{
2011-09-20 23:55:35 +00:00
fileNew ( ) ;
2011-05-19 21:19:05 +00:00
}
break ;
2010-01-29 23:52:47 +00:00
case IDM_FILE_OPEN :
2011-05-19 21:19:05 +00:00
{
2011-07-15 01:00:05 +00:00
fileOpen ( ) ;
2011-05-19 21:19:05 +00:00
}
break ;
2010-01-29 23:52:47 +00:00
2013-12-07 01:43:35 +00:00
case IDM_FILE_OPEN_FOLDER :
{
2016-03-29 13:49:58 +00:00
Command cmd ( TEXT ( " explorer /select, \" $(FULL_CURRENT_PATH) \ " " ) ) ;
2013-12-07 01:43:35 +00:00
cmd . run ( _pPublicInterface - > getHSelf ( ) ) ;
}
break ;
case IDM_FILE_OPEN_CMD :
{
Command cmd ( TEXT ( " cmd /K cd /d $(CURRENT_DIRECTORY) " )) ;
cmd . run ( _pPublicInterface - > getHSelf ( ) ) ;
}
break ;
2016-03-19 15:15:21 +00:00
case IDM_FILE_OPENFOLDERASWORSPACE :
{
generic_string folderPath = folderBrowser ( _pPublicInterface - > getHSelf ( ) , TEXT ( " Select a folder to add in Folder as Workspace panel " ) ) ;
if ( not folderPath . empty ( ) )
{
if ( _pFileBrowser = = nullptr ) // first launch, check in params to open folders
{
vector < generic_string > dummy ;
launchFileBrowser ( dummy ) ;
if ( _pFileBrowser ! = nullptr )
{
checkMenuItem ( IDM_VIEW_FILEBROWSER , true ) ;
_toolBar . setCheck ( IDM_VIEW_FILEBROWSER , true ) ;
_pFileBrowser - > setClosed ( false ) ;
}
else // problem
return ;
}
else
{
if ( _pFileBrowser - > isClosed ( ) )
{
_pFileBrowser - > display ( ) ;
_pFileBrowser - > setClosed ( false ) ;
}
}
_pFileBrowser - > addRootFolder ( folderPath ) ;
}
}
break ;
2013-12-07 01:43:35 +00:00
2010-01-29 23:52:47 +00:00
case IDM_FILE_RELOAD :
fileReload ( ) ;
break ;
2013-05-01 15:43:51 +00:00
case IDM_FILESWITCHER_FILESCLOSE :
case IDM_FILESWITCHER_FILESCLOSEOTHERS :
if ( _pFileSwitcherPanel )
{
vector < SwitcherFileInfo > files = _pFileSwitcherPanel - > getSelectedFiles ( id = = IDM_FILESWITCHER_FILESCLOSEOTHERS ) ;
2013-07-08 00:12:50 +00:00
for ( size_t i = 0 , len = files . size ( ) ; i < len ; + + i )
2013-05-01 15:43:51 +00:00
{
fileClose ( ( BufferID ) files [ i ] . _bufID , files [ i ] . _iView ) ;
}
if ( id = = IDM_FILESWITCHER_FILESCLOSEOTHERS )
{
// Get current buffer and its view
2015-06-08 10:11:10 +00:00
_pFileSwitcherPanel - > activateItem ( _pEditView - > getCurrentBufferID ( ) , currentView ( ) ) ;
2013-05-01 15:43:51 +00:00
}
}
break ;
2010-01-29 23:52:47 +00:00
case IDM_FILE_CLOSE :
2010-07-04 07:12:02 +00:00
if ( fileClose ( ) )
checkDocState ( ) ;
2010-01-29 23:52:47 +00:00
break ;
case IDM_FILE_DELETE :
2010-07-04 07:12:02 +00:00
if ( fileDelete ( ) )
checkDocState ( ) ;
2010-01-29 23:52:47 +00:00
break ;
case IDM_FILE_RENAME :
fileRename ( ) ;
break ;
case IDM_FILE_CLOSEALL :
2014-04-10 18:16:11 +00:00
{
2014-05-08 20:48:03 +00:00
bool isSnapshotMode = NppParameters : : getInstance ( ) - > getNppGUI ( ) . isSnapshotMode ( ) ;
2014-04-13 01:31:02 +00:00
fileCloseAll ( isSnapshotMode , false ) ;
2010-07-04 07:12:02 +00:00
checkDocState ( ) ;
2010-01-29 23:52:47 +00:00
break ;
2014-04-10 18:16:11 +00:00
}
2015-08-06 09:03:57 +00:00
2010-01-29 23:52:47 +00:00
case IDM_FILE_CLOSEALL_BUT_CURRENT :
fileCloseAllButCurrent ( ) ;
2010-07-04 07:12:02 +00:00
checkDocState ( ) ;
2010-01-29 23:52:47 +00:00
break ;
2013-08-03 23:40:07 +00:00
case IDM_FILE_CLOSEALL_TOLEFT :
fileCloseAllToLeft ( ) ;
checkDocState ( ) ;
break ;
case IDM_FILE_CLOSEALL_TORIGHT :
fileCloseAllToRight ( ) ;
checkDocState ( ) ;
break ;
2010-01-29 23:52:47 +00:00
case IDM_FILE_SAVE :
fileSave ( ) ;
break ;
case IDM_FILE_SAVEALL :
fileSaveAll ( ) ;
break ;
case IDM_FILE_SAVEAS :
fileSaveAs ( ) ;
break ;
case IDM_FILE_SAVECOPYAS :
fileSaveAs ( BUFFER_INVALID , true ) ;
break ;
case IDM_FILE_LOADSESSION :
fileLoadSession ( ) ;
break ;
case IDM_FILE_SAVESESSION :
fileSaveSession ( ) ;
break ;
case IDM_FILE_PRINTNOW :
filePrint ( false ) ;
break ;
case IDM_FILE_PRINT :
filePrint ( true ) ;
break ;
case IDM_FILE_EXIT :
2010-03-26 00:22:14 +00:00
: : SendMessage ( _pPublicInterface - > getHSelf ( ) , WM_CLOSE , 0 , 0 ) ;
2010-01-29 23:52:47 +00:00
break ;
case IDM_EDIT_UNDO :
2015-05-26 13:58:46 +00:00
{
LongRunningOperation op ;
2010-01-29 23:52:47 +00:00
_pEditView - > execute ( WM_UNDO ) ;
checkClipboard ( ) ;
checkUndoState ( ) ;
break ;
2015-05-26 13:58:46 +00:00
}
2010-01-29 23:52:47 +00:00
case IDM_EDIT_REDO :
2015-05-26 13:58:46 +00:00
{
LongRunningOperation op ;
2010-01-29 23:52:47 +00:00
_pEditView - > execute ( SCI_REDO ) ;
checkClipboard ( ) ;
checkUndoState ( ) ;
break ;
2015-05-26 13:58:46 +00:00
}
2010-01-29 23:52:47 +00:00
case IDM_EDIT_CUT :
_pEditView - > execute ( WM_CUT ) ;
checkClipboard ( ) ;
break ;
case IDM_EDIT_COPY :
_pEditView - > execute ( WM_COPY ) ;
checkClipboard ( ) ;
break ;
2011-03-15 01:36:55 +00:00
case IDM_EDIT_COPY_BINARY :
case IDM_EDIT_CUT_BINARY :
{
2016-06-05 18:29:21 +00:00
int textLen = static_cast < int32_t > ( _pEditView - > execute ( SCI_GETSELTEXT , 0 , 0 ) ) - 1 ;
2011-03-31 00:14:18 +00:00
if ( ! textLen )
return ;
2011-03-15 01:36:55 +00:00
char * pBinText = new char [ textLen + 1 ] ;
_pEditView - > getSelectedText ( pBinText , textLen + 1 ) ;
2011-03-31 00:14:18 +00:00
// Open the clipboard, and empty it.
if ( ! OpenClipboard ( NULL ) )
2011-03-15 01:36:55 +00:00
return ;
EmptyClipboard ( ) ;
2011-03-31 00:14:18 +00:00
// Allocate a global memory object for the text.
HGLOBAL hglbCopy = GlobalAlloc ( GMEM_MOVEABLE , ( textLen + 1 ) * sizeof ( unsigned char ) ) ;
if ( hglbCopy = = NULL )
{
CloseClipboard ( ) ;
return ;
}
// Lock the handle and copy the text to the buffer.
unsigned char * lpucharCopy = ( unsigned char * ) GlobalLock ( hglbCopy ) ;
memcpy ( lpucharCopy , pBinText , textLen * sizeof ( unsigned char ) ) ;
2011-03-15 01:36:55 +00:00
lpucharCopy [ textLen ] = 0 ; // null character
2015-08-06 09:03:57 +00:00
2011-03-31 00:14:18 +00:00
GlobalUnlock ( hglbCopy ) ;
2015-08-06 09:03:57 +00:00
2011-03-15 01:36:55 +00:00
// Place the handle on the clipboard.
SetClipboardData ( CF_TEXT , hglbCopy ) ;
2015-08-06 09:03:57 +00:00
2011-03-15 01:36:55 +00:00
// Allocate a global memory object for the text length.
2011-03-31 00:14:18 +00:00
HGLOBAL hglbLenCopy = GlobalAlloc ( GMEM_MOVEABLE , sizeof ( unsigned long ) ) ;
if ( hglbLenCopy = = NULL )
{
CloseClipboard ( ) ;
return ;
}
2015-08-06 09:03:57 +00:00
// Lock the handle and copy the text to the buffer.
unsigned long * lpLenCopy = ( unsigned long * ) GlobalLock ( hglbLenCopy ) ;
2011-03-15 01:36:55 +00:00
* lpLenCopy = textLen ;
2015-08-06 09:03:57 +00:00
GlobalUnlock ( hglbLenCopy ) ;
2011-03-15 01:36:55 +00:00
// Place the handle on the clipboard.
UINT f = RegisterClipboardFormat ( CF_NPPTEXTLEN ) ;
SetClipboardData ( f , hglbLenCopy ) ;
CloseClipboard ( ) ;
if ( id = = IDM_EDIT_CUT_BINARY )
_pEditView - > execute ( SCI_REPLACESEL , 0 , ( LPARAM ) " " ) ;
}
break ;
2010-01-29 23:52:47 +00:00
case IDM_EDIT_PASTE :
{
2015-05-30 08:16:19 +00:00
LongRunningOperation op ;
2010-01-29 23:52:47 +00:00
int eolMode = int ( _pEditView - > execute ( SCI_GETEOLMODE ) ) ;
_pEditView - > execute ( SCI_PASTE ) ;
_pEditView - > execute ( SCI_CONVERTEOLS , eolMode ) ;
}
break ;
2011-03-15 01:36:55 +00:00
case IDM_EDIT_PASTE_BINARY :
2015-08-06 09:03:57 +00:00
{
2015-05-30 08:16:19 +00:00
LongRunningOperation op ;
2011-03-15 01:36:55 +00:00
if ( ! IsClipboardFormatAvailable ( CF_TEXT ) )
return ;
if ( ! OpenClipboard ( NULL ) )
2015-08-06 09:03:57 +00:00
return ;
HGLOBAL hglb = GetClipboardData ( CF_TEXT ) ;
if ( hglb ! = NULL )
{
char * lpchar = ( char * ) GlobalLock ( hglb ) ;
if ( lpchar ! = NULL )
2011-03-15 01:36:55 +00:00
{
UINT cf_nppTextLen = RegisterClipboardFormat ( CF_NPPTEXTLEN ) ;
if ( IsClipboardFormatAvailable ( cf_nppTextLen ) )
{
2015-08-06 09:03:57 +00:00
HGLOBAL hglbLen = GetClipboardData ( cf_nppTextLen ) ;
if ( hglbLen ! = NULL )
{
unsigned long * lpLen = ( unsigned long * ) GlobalLock ( hglbLen ) ;
if ( lpLen ! = NULL )
2011-03-15 01:36:55 +00:00
{
_pEditView - > execute ( SCI_REPLACESEL , 0 , ( LPARAM ) " " ) ;
_pEditView - > execute ( SCI_ADDTEXT , * lpLen , ( LPARAM ) lpchar ) ;
2015-08-06 09:03:57 +00:00
GlobalUnlock ( hglb ) ;
2011-03-15 01:36:55 +00:00
}
}
}
else
{
_pEditView - > execute ( SCI_REPLACESEL , 0 , ( LPARAM ) lpchar ) ;
}
2015-08-06 09:03:57 +00:00
GlobalUnlock ( hglb ) ;
2011-03-15 01:36:55 +00:00
}
}
CloseClipboard ( ) ;
}
break ;
2011-03-11 00:57:06 +00:00
case IDM_EDIT_PASTE_AS_RTF :
case IDM_EDIT_PASTE_AS_HTML :
{
2015-05-30 08:16:19 +00:00
LongRunningOperation op ;
2011-03-11 00:57:06 +00:00
UINT f = RegisterClipboardFormat ( id = = IDM_EDIT_PASTE_AS_HTML ? CF_HTML : CF_RTF ) ;
2015-08-06 09:03:57 +00:00
if ( ! IsClipboardFormatAvailable ( f ) )
2011-03-11 00:57:06 +00:00
return ;
2015-08-06 09:03:57 +00:00
2011-03-11 00:57:06 +00:00
if ( ! OpenClipboard ( NULL ) )
2015-08-06 09:03:57 +00:00
return ;
HGLOBAL hglb = GetClipboardData ( f ) ;
if ( hglb ! = NULL )
{
LPSTR lptstr = ( LPSTR ) GlobalLock ( hglb ) ;
if ( lptstr ! = NULL )
{
// Call the application-defined ReplaceSelection
// function to insert the text and repaint the
// window.
2011-03-11 00:57:06 +00:00
_pEditView - > execute ( SCI_REPLACESEL , 0 , ( LPARAM ) lptstr ) ;
2015-08-06 09:03:57 +00:00
GlobalUnlock ( hglb ) ;
2011-03-11 00:57:06 +00:00
}
}
2015-08-06 09:03:57 +00:00
CloseClipboard ( ) ;
2011-03-11 00:57:06 +00:00
}
break ;
2013-06-09 08:52:15 +00:00
case IDM_EDIT_BEGINENDSELECT :
{
2015-03-14 22:55:03 +00:00
: : CheckMenuItem ( _mainMenuHandle , IDM_EDIT_BEGINENDSELECT , MF_BYCOMMAND | ( _pEditView - > beginEndSelectedIsStarted ( ) ? MF_UNCHECKED : MF_CHECKED ) ) ;
2013-09-17 20:22:32 +00:00
_pEditView - > beginOrEndSelect ( ) ;
2013-06-09 08:52:15 +00:00
}
break ;
2015-05-17 17:18:43 +00:00
case IDM_EDIT_SORTLINES_LEXICOGRAPHIC_ASCENDING :
case IDM_EDIT_SORTLINES_LEXICOGRAPHIC_DESCENDING :
case IDM_EDIT_SORTLINES_INTEGER_ASCENDING :
case IDM_EDIT_SORTLINES_INTEGER_DESCENDING :
case IDM_EDIT_SORTLINES_DECIMALCOMMA_ASCENDING :
case IDM_EDIT_SORTLINES_DECIMALCOMMA_DESCENDING :
case IDM_EDIT_SORTLINES_DECIMALDOT_ASCENDING :
case IDM_EDIT_SORTLINES_DECIMALDOT_DESCENDING :
2013-11-19 23:30:41 +00:00
{
2015-05-26 13:58:46 +00:00
LongRunningOperation op ;
2015-05-21 13:53:48 +00:00
size_t fromLine = 0 , toLine = 0 ;
size_t fromColumn = 0 , toColumn = 0 ;
2013-12-25 16:56:31 +00:00
2015-05-21 13:53:48 +00:00
bool hasLineSelection = false ;
if ( _pEditView - > execute ( SCI_GETSELECTIONS ) > 1 )
2013-12-25 16:56:31 +00:00
{
2015-05-21 13:53:48 +00:00
if ( _pEditView - > execute ( SCI_SELECTIONISRECTANGLE ) )
{
ColumnModeInfos colInfos = _pEditView - > getColumnModeSelectInfo ( ) ;
int leftPos = colInfos . begin ( ) - > _selLpos ;
int rightPos = colInfos . rbegin ( ) - > _selRpos ;
int startPos = min ( leftPos , rightPos ) ;
int endPos = max ( leftPos , rightPos ) ;
fromLine = _pEditView - > execute ( SCI_LINEFROMPOSITION , startPos ) ;
toLine = _pEditView - > execute ( SCI_LINEFROMPOSITION , endPos ) ;
fromColumn = _pEditView - > execute ( SCI_GETCOLUMN , leftPos ) ;
toColumn = _pEditView - > execute ( SCI_GETCOLUMN , rightPos ) ;
}
else
{
2013-12-25 16:56:31 +00:00
return ;
2015-05-21 13:53:48 +00:00
}
}
else
{
2016-06-05 18:29:21 +00:00
auto selStart = _pEditView - > execute ( SCI_GETSELECTIONSTART ) ;
auto selEnd = _pEditView - > execute ( SCI_GETSELECTIONEND ) ;
2015-05-21 13:53:48 +00:00
hasLineSelection = selStart ! = selEnd ;
if ( hasLineSelection )
{
pair < int , int > lineRange = _pEditView - > getSelectionLinesRange ( ) ;
// One single line selection is not allowed.
if ( lineRange . first = = lineRange . second )
{
return ;
}
fromLine = lineRange . first ;
toLine = lineRange . second ;
}
else
{
// No selection.
fromLine = 0 ;
toLine = _pEditView - > execute ( SCI_GETLINECOUNT ) - 1 ;
}
2013-12-25 16:56:31 +00:00
}
2015-05-17 17:18:43 +00:00
bool isDescending = id = = IDM_EDIT_SORTLINES_LEXICOGRAPHIC_DESCENDING | |
id = = IDM_EDIT_SORTLINES_INTEGER_DESCENDING | |
id = = IDM_EDIT_SORTLINES_DECIMALCOMMA_DESCENDING | |
id = = IDM_EDIT_SORTLINES_DECIMALDOT_DESCENDING ;
2013-11-19 23:30:41 +00:00
_pEditView - > execute ( SCI_BEGINUNDOACTION ) ;
2015-05-17 17:18:43 +00:00
std : : unique_ptr < ISorter > pSorter ;
if ( id = = IDM_EDIT_SORTLINES_LEXICOGRAPHIC_DESCENDING | | id = = IDM_EDIT_SORTLINES_LEXICOGRAPHIC_ASCENDING )
{
2015-05-21 13:53:48 +00:00
pSorter = std : : unique_ptr < ISorter > ( new LexicographicSorter ( isDescending , fromColumn , toColumn ) ) ;
2015-05-17 17:18:43 +00:00
}
else if ( id = = IDM_EDIT_SORTLINES_INTEGER_DESCENDING | | id = = IDM_EDIT_SORTLINES_INTEGER_ASCENDING )
{
2015-05-21 13:53:48 +00:00
pSorter = std : : unique_ptr < ISorter > ( new IntegerSorter ( isDescending , fromColumn , toColumn ) ) ;
2015-05-17 17:18:43 +00:00
}
else if ( id = = IDM_EDIT_SORTLINES_DECIMALCOMMA_DESCENDING | | id = = IDM_EDIT_SORTLINES_DECIMALCOMMA_ASCENDING )
{
2015-05-21 13:53:48 +00:00
pSorter = std : : unique_ptr < ISorter > ( new DecimalCommaSorter ( isDescending , fromColumn , toColumn ) ) ;
2015-05-17 17:18:43 +00:00
}
else
{
2015-05-21 13:53:48 +00:00
pSorter = std : : unique_ptr < ISorter > ( new DecimalDotSorter ( isDescending , fromColumn , toColumn ) ) ;
2015-05-17 17:18:43 +00:00
}
try
{
_pEditView - > sortLines ( fromLine , toLine , pSorter . get ( ) ) ;
}
catch ( size_t & failedLineIndex )
{
generic_string lineNo = std : : to_wstring ( 1 + fromLine + failedLineIndex ) ;
_nativeLangSpeaker . messageBox ( " SortingError " ,
_pPublicInterface - > getHSelf ( ) ,
TEXT ( " Unable to perform numeric sort due to line $STR_REPLACE$. " ) ,
TEXT ( " Sorting Error " ) ,
MB_OK | MB_ICONINFORMATION | MB_APPLMODAL ,
0 ,
lineNo . c_str ( ) ) ; // We don't use intInfo since it would require casting size_t -> int.
}
2013-11-19 23:30:41 +00:00
_pEditView - > execute ( SCI_ENDUNDOACTION ) ;
2013-12-25 16:56:31 +00:00
2015-05-21 13:53:48 +00:00
if ( hasLineSelection ) // there was 1 selection, so we restore it
2013-12-25 16:56:31 +00:00
{
2016-06-05 18:29:21 +00:00
auto posStart = _pEditView - > execute ( SCI_POSITIONFROMLINE , fromLine ) ;
auto posEnd = _pEditView - > execute ( SCI_GETLINEENDPOSITION , toLine ) ;
2013-12-25 16:56:31 +00:00
_pEditView - > execute ( SCI_SETSELECTIONSTART , posStart ) ;
_pEditView - > execute ( SCI_SETSELECTIONEND , posEnd ) ;
}
2013-11-19 23:30:41 +00:00
}
break ;
2013-08-01 19:44:11 +00:00
case IDM_EDIT_BLANKLINEABOVECURRENT :
{
_pEditView - > insertNewLineAboveCurrentLine ( ) ;
}
break ;
case IDM_EDIT_BLANKLINEBELOWCURRENT :
{
_pEditView - > insertNewLineBelowCurrentLine ( ) ;
}
break ;
2011-04-13 07:08:51 +00:00
case IDM_EDIT_CHAR_PANEL :
{
launchAnsiCharPanel ( ) ;
}
break ;
2011-04-20 21:45:18 +00:00
case IDM_EDIT_CLIPBOARDHISTORY_PANEL :
{
launchClipboardHistoryPanel ( ) ;
}
break ;
2011-05-19 21:19:05 +00:00
case IDM_VIEW_FILESWITCHER_PANEL :
{
launchFileSwitcherPanel ( ) ;
}
break ;
2011-09-20 23:55:35 +00:00
case IDM_VIEW_PROJECT_PANEL_1 :
2011-08-29 23:01:41 +00:00
{
2011-09-25 01:33:34 +00:00
launchProjectPanel ( id , & _pProjectPanel_1 , 0 ) ;
2011-09-20 23:55:35 +00:00
}
break ;
case IDM_VIEW_PROJECT_PANEL_2 :
{
2011-09-25 01:33:34 +00:00
launchProjectPanel ( id , & _pProjectPanel_2 , 1 ) ;
2011-09-20 23:55:35 +00:00
}
break ;
case IDM_VIEW_PROJECT_PANEL_3 :
{
2011-09-25 01:33:34 +00:00
launchProjectPanel ( id , & _pProjectPanel_3 , 2 ) ;
2011-08-29 23:01:41 +00:00
}
break ;
2016-02-02 18:06:23 +00:00
case IDM_VIEW_FILEBROWSER :
{
2016-02-08 00:34:33 +00:00
if ( _pFileBrowser = = nullptr ) // first launch, check in params to open folders
{
NppParameters * pNppParam = NppParameters : : getInstance ( ) ;
launchFileBrowser ( pNppParam - > getFileBrowserRoots ( ) ) ;
if ( _pFileBrowser ! = nullptr )
{
checkMenuItem ( IDM_VIEW_FILEBROWSER , true ) ;
_toolBar . setCheck ( IDM_VIEW_FILEBROWSER , true ) ;
_pFileBrowser - > setClosed ( false ) ;
}
}
else
{
if ( not _pFileBrowser - > isClosed ( ) )
{
_pFileBrowser - > display ( false ) ;
_pFileBrowser - > setClosed ( true ) ;
checkMenuItem ( IDM_VIEW_FILEBROWSER , false ) ;
_toolBar . setCheck ( IDM_VIEW_FILEBROWSER , false ) ;
}
else
{
vector < generic_string > dummy ;
launchFileBrowser ( dummy ) ;
checkMenuItem ( IDM_VIEW_FILEBROWSER , true ) ;
_toolBar . setCheck ( IDM_VIEW_FILEBROWSER , true ) ;
_pFileBrowser - > setClosed ( false ) ;
}
}
2016-02-02 18:06:23 +00:00
}
break ;
2012-01-30 00:00:50 +00:00
case IDM_VIEW_DOC_MAP :
{
2016-02-08 00:34:33 +00:00
if ( _pDocMap & & ( not _pDocMap - > isClosed ( ) ) )
2012-07-21 00:46:03 +00:00
{
_pDocMap - > display ( false ) ;
_pDocMap - > vzDlgDisplay ( false ) ;
2013-06-04 23:46:24 +00:00
_pDocMap - > setClosed ( true ) ;
2012-07-21 00:46:03 +00:00
checkMenuItem ( IDM_VIEW_DOC_MAP , false ) ;
2013-05-05 18:12:01 +00:00
_toolBar . setCheck ( IDM_VIEW_DOC_MAP , false ) ;
2012-07-21 00:46:03 +00:00
}
else
{
launchDocMap ( ) ;
2013-09-14 19:29:12 +00:00
if ( _pDocMap )
{
checkMenuItem ( IDM_VIEW_DOC_MAP , true ) ;
_toolBar . setCheck ( IDM_VIEW_DOC_MAP , true ) ;
_pDocMap - > setClosed ( false ) ;
}
2012-07-21 00:46:03 +00:00
}
2012-01-30 00:00:50 +00:00
}
break ;
2012-11-24 20:14:52 +00:00
case IDM_VIEW_FUNC_LIST :
{
2016-02-08 00:34:33 +00:00
if ( _pFuncList & & ( not _pFuncList - > isClosed ( ) ) )
2012-11-24 20:14:52 +00:00
{
2013-06-04 23:46:24 +00:00
_pFuncList - > display ( false ) ;
_pFuncList - > setClosed ( true ) ;
checkMenuItem ( IDM_VIEW_FUNC_LIST , false ) ;
_toolBar . setCheck ( IDM_VIEW_FUNC_LIST , false ) ;
2012-11-24 20:14:52 +00:00
}
else
{
2013-06-04 23:46:24 +00:00
checkMenuItem ( IDM_VIEW_FUNC_LIST , true ) ;
_toolBar . setCheck ( IDM_VIEW_FUNC_LIST , true ) ;
launchFunctionList ( ) ;
_pFuncList - > setClosed ( false ) ;
2012-11-24 20:14:52 +00:00
}
}
break ;
2015-08-06 09:03:57 +00:00
2013-08-03 00:19:06 +00:00
case IDM_VIEW_TAB1 :
case IDM_VIEW_TAB2 :
case IDM_VIEW_TAB3 :
case IDM_VIEW_TAB4 :
case IDM_VIEW_TAB5 :
case IDM_VIEW_TAB6 :
case IDM_VIEW_TAB7 :
case IDM_VIEW_TAB8 :
case IDM_VIEW_TAB9 :
{
const int index = id - IDM_VIEW_TAB1 ;
BufferID buf = _pDocTab - > getBufferByIndex ( index ) ;
if ( buf = = BUFFER_INVALID )
{
// No buffer at chosen index, select the very last buffer instead.
const int last_index = _pDocTab - > getItemCount ( ) - 1 ;
if ( last_index > 0 )
switchToFile ( _pDocTab - > getBufferByIndex ( last_index ) ) ;
}
else
switchToFile ( buf ) ;
}
break ;
case IDM_VIEW_TAB_NEXT :
{
const int current_index = _pDocTab - > getCurrentTabIndex ( ) ;
const int last_index = _pDocTab - > getItemCount ( ) - 1 ;
if ( current_index < last_index )
switchToFile ( _pDocTab - > getBufferByIndex ( current_index + 1 ) ) ;
else
switchToFile ( _pDocTab - > getBufferByIndex ( 0 ) ) ; // Loop around.
}
break ;
case IDM_VIEW_TAB_PREV :
{
const int current_index = _pDocTab - > getCurrentTabIndex ( ) ;
if ( current_index > 0 )
switchToFile ( _pDocTab - > getBufferByIndex ( current_index - 1 ) ) ;
else
{
const int last_index = _pDocTab - > getItemCount ( ) - 1 ;
switchToFile ( _pDocTab - > getBufferByIndex ( last_index ) ) ; // Loop around.
}
}
break ;
2012-11-24 20:14:52 +00:00
2010-01-29 23:52:47 +00:00
case IDM_EDIT_DELETE :
_pEditView - > execute ( WM_CLEAR ) ;
break ;
case IDM_MACRO_STARTRECORDINGMACRO :
case IDM_MACRO_STOPRECORDINGMACRO :
case IDC_EDIT_TOGGLEMACRORECORDING :
{
if ( _recordingMacro )
{
// STOP !!!
_mainEditView . execute ( SCI_STOPRECORD ) ;
_subEditView . execute ( SCI_STOPRECORD ) ;
2015-08-06 09:03:57 +00:00
2010-01-29 23:52:47 +00:00
_mainEditView . execute ( SCI_SETCURSOR , ( WPARAM ) SC_CURSORNORMAL ) ;
_subEditView . execute ( SCI_SETCURSOR , ( WPARAM ) SC_CURSORNORMAL ) ;
2015-08-06 09:03:57 +00:00
2010-01-29 23:52:47 +00:00
_recordingMacro = false ;
_runMacroDlg . initMacroList ( ) ;
}
else
{
_mainEditView . execute ( SCI_SETCURSOR , 9 ) ;
_subEditView . execute ( SCI_SETCURSOR , 9 ) ;
_macro . clear ( ) ;
// START !!!
_mainEditView . execute ( SCI_STARTRECORD ) ;
_subEditView . execute ( SCI_STARTRECORD ) ;
_recordingMacro = true ;
}
checkMacroState ( ) ;
break ;
}
case IDM_MACRO_PLAYBACKRECORDEDMACRO :
if ( ! _recordingMacro ) // if we're not currently recording, then playback the recorded keystrokes
2015-10-07 15:55:29 +00:00
{
_playingBackMacro = true ;
2010-08-15 18:52:55 +00:00
macroPlayback ( _macro ) ;
2015-10-07 15:55:29 +00:00
_playingBackMacro = false ;
}
2010-01-29 23:52:47 +00:00
break ;
case IDM_MACRO_RUNMULTIMACRODLG :
{
if ( ! _recordingMacro ) // if we're not currently recording, then playback the recorded keystrokes
{
bool isFirstTime = ! _runMacroDlg . isCreated ( ) ;
2010-03-05 00:15:06 +00:00
_runMacroDlg . doDialog ( _nativeLangSpeaker . isRTL ( ) ) ;
2015-08-06 09:03:57 +00:00
2010-01-29 23:52:47 +00:00
if ( isFirstTime )
{
2010-03-05 00:15:06 +00:00
_nativeLangSpeaker . changeDlgLang ( _runMacroDlg . getHSelf ( ) , " MultiMacro " ) ;
2010-01-29 23:52:47 +00:00
}
break ;
2015-08-06 09:03:57 +00:00
2010-01-29 23:52:47 +00:00
}
}
break ;
case IDM_MACRO_SAVECURRENTMACRO :
{
if ( addCurrentMacro ( ) )
_runMacroDlg . initMacroList ( ) ;
break ;
}
case IDM_EDIT_FULLPATHTOCLIP :
case IDM_EDIT_CURRENTDIRTOCLIP :
case IDM_EDIT_FILENAMETOCLIP :
{
Buffer * buf = _pEditView - > getCurrentBuffer ( ) ;
if ( id = = IDM_EDIT_FULLPATHTOCLIP )
{
str2Cliboard ( buf - > getFullPathName ( ) ) ;
}
else if ( id = = IDM_EDIT_CURRENTDIRTOCLIP )
{
generic_string dir ( buf - > getFullPathName ( ) ) ;
PathRemoveFileSpec ( dir ) ;
2015-06-01 16:47:24 +00:00
str2Cliboard ( dir ) ;
2010-01-29 23:52:47 +00:00
}
else if ( id = = IDM_EDIT_FILENAMETOCLIP )
{
str2Cliboard ( buf - > getFileName ( ) ) ;
}
}
break ;
case IDM_SEARCH_FIND :
case IDM_SEARCH_REPLACE :
2014-12-21 19:43:40 +00:00
case IDM_SEARCH_MARK :
2010-01-29 23:52:47 +00:00
{
const int strSize = FINDREPLACE_MAXLENGTH ;
TCHAR str [ strSize ] ;
bool isFirstTime = ! _findReplaceDlg . isCreated ( ) ;
2015-08-06 09:03:57 +00:00
2014-12-21 19:43:40 +00:00
DIALOG_TYPE dlgID = FIND_DLG ;
if ( id = = IDM_SEARCH_REPLACE )
dlgID = REPLACE_DLG ;
else if ( id = = IDM_SEARCH_MARK )
dlgID = MARK_DLG ;
_findReplaceDlg . doDialog ( dlgID , _nativeLangSpeaker . isRTL ( ) ) ;
2010-01-29 23:52:47 +00:00
_pEditView - > getGenericSelectedText ( str , strSize ) ;
_findReplaceDlg . setSearchText ( str ) ;
setFindReplaceFolderFilter ( NULL , NULL ) ;
if ( isFirstTime )
2010-03-05 00:15:06 +00:00
_nativeLangSpeaker . changeFindReplaceDlgLang ( _findReplaceDlg ) ;
2010-01-29 23:52:47 +00:00
break ;
}
2014-12-21 19:43:40 +00:00
case IDM_SEARCH_FINDINFILES :
2010-01-29 23:52:47 +00:00
{
2010-03-26 00:22:14 +00:00
: : SendMessage ( _pPublicInterface - > getHSelf ( ) , NPPM_LAUNCHFINDINFILESDLG , 0 , 0 ) ;
2010-01-29 23:52:47 +00:00
break ;
}
2014-12-24 02:03:52 +00:00
2010-01-29 23:52:47 +00:00
case IDM_SEARCH_FINDINCREMENT :
{
const int strSize = FINDREPLACE_MAXLENGTH ;
TCHAR str [ strSize ] ;
_pEditView - > getGenericSelectedText ( str , strSize , false ) ;
2014-12-21 19:43:40 +00:00
if ( 0 ! = str [ 0 ] ) // the selected text is not empty, then use it
_incrementFindDlg . setSearchText ( str , _pEditView - > getCurrentBuffer ( ) - > getUnicodeMode ( ) ! = uni8Bit ) ;
2010-01-29 23:52:47 +00:00
_incrementFindDlg . display ( ) ;
}
break ;
case IDM_SEARCH_FINDNEXT :
case IDM_SEARCH_FINDPREV :
{
if ( ! _findReplaceDlg . isCreated ( ) )
return ;
FindOption op = _findReplaceDlg . getCurrentOptions ( ) ;
op . _whichDirection = ( id = = IDM_SEARCH_FINDNEXT ? DIR_DOWN : DIR_UP ) ;
generic_string s = _findReplaceDlg . getText2search ( ) ;
2013-05-20 21:56:30 +00:00
FindStatus status = FSNoMessage ;
_findReplaceDlg . processFindNext ( s . c_str ( ) , & op , & status ) ;
if ( status = = FSEndReached )
_findReplaceDlg . setStatusbarMessage ( TEXT ( " Find: Found the 1st occurrence from the top. The end of document has been reached. " ) , FSEndReached ) ;
else if ( status = = FSTopReached )
_findReplaceDlg . setStatusbarMessage ( TEXT ( " Find: Found the 1st occurrence from the bottom. The begin of document has been reached. " ) , FSTopReached ) ;
2010-01-29 23:52:47 +00:00
break ;
}
break ;
case IDM_SEARCH_SETANDFINDNEXT :
case IDM_SEARCH_SETANDFINDPREV :
{
bool isFirstTime = ! _findReplaceDlg . isCreated ( ) ;
if ( isFirstTime )
2010-03-05 00:15:06 +00:00
_findReplaceDlg . doDialog ( FIND_DLG , _nativeLangSpeaker . isRTL ( ) , false ) ;
2010-01-29 23:52:47 +00:00
const int strSize = FINDREPLACE_MAXLENGTH ;
TCHAR str [ strSize ] ;
_pEditView - > getGenericSelectedText ( str , strSize ) ;
_findReplaceDlg . setSearchText ( str ) ;
2010-09-04 17:22:03 +00:00
_findReplaceDlg . _env - > _str2Search = str ;
2010-01-29 23:52:47 +00:00
setFindReplaceFolderFilter ( NULL , NULL ) ;
if ( isFirstTime )
2010-03-05 00:15:06 +00:00
_nativeLangSpeaker . changeFindReplaceDlgLang ( _findReplaceDlg ) ;
2010-01-29 23:52:47 +00:00
FindOption op = _findReplaceDlg . getCurrentOptions ( ) ;
op . _whichDirection = ( id = = IDM_SEARCH_SETANDFINDNEXT ? DIR_DOWN : DIR_UP ) ;
2013-05-20 21:56:30 +00:00
FindStatus status = FSNoMessage ;
_findReplaceDlg . processFindNext ( str , & op , & status ) ;
if ( status = = FSEndReached )
_findReplaceDlg . setStatusbarMessage ( TEXT ( " Find: Found the 1st occurrence from the top. The end of document has been reached. " ) , FSEndReached ) ;
else if ( status = = FSTopReached )
_findReplaceDlg . setStatusbarMessage ( TEXT ( " Find: Found the 1st occurrence from the bottom. The begin of document has been reached. " ) , FSTopReached ) ;
2010-01-29 23:52:47 +00:00
break ;
}
case IDM_SEARCH_GOTONEXTFOUND :
{
_findReplaceDlg . gotoNextFoundResult ( ) ;
break ;
}
case IDM_SEARCH_GOTOPREVFOUND :
{
_findReplaceDlg . gotoNextFoundResult ( - 1 ) ;
break ;
}
case IDM_FOCUS_ON_FOUND_RESULTS :
{
if ( GetFocus ( ) = = _findReplaceDlg . getHFindResults ( ) )
// focus already on found results, switch to current edit view
switchEditViewTo ( currentView ( ) ) ;
else
_findReplaceDlg . focusOnFinder ( ) ;
break ;
}
case IDM_SEARCH_VOLATILE_FINDNEXT :
case IDM_SEARCH_VOLATILE_FINDPREV :
{
TCHAR text2Find [ MAX_PATH ] ;
_pEditView - > getGenericSelectedText ( text2Find , MAX_PATH ) ;
FindOption op ;
op . _isWholeWord = false ;
op . _whichDirection = ( id = = IDM_SEARCH_VOLATILE_FINDNEXT ? DIR_DOWN : DIR_UP ) ;
2013-05-20 21:56:30 +00:00
FindStatus status = FSNoMessage ;
_findReplaceDlg . processFindNext ( text2Find , & op , & status ) ;
if ( status = = FSEndReached )
_findReplaceDlg . setStatusbarMessage ( TEXT ( " Find: Found the 1st occurrence from the top. The end of document has been reached. " ) , FSEndReached ) ;
else if ( status = = FSTopReached )
_findReplaceDlg . setStatusbarMessage ( TEXT ( " Find: Found the 1st occurrence from the bottom. The begin of document has been reached. " ) , FSTopReached ) ;
2010-01-29 23:52:47 +00:00
break ;
}
case IDM_SEARCH_MARKALLEXT1 :
case IDM_SEARCH_MARKALLEXT2 :
case IDM_SEARCH_MARKALLEXT3 :
case IDM_SEARCH_MARKALLEXT4 :
case IDM_SEARCH_MARKALLEXT5 :
{
int styleID ;
if ( id = = IDM_SEARCH_MARKALLEXT1 )
styleID = SCE_UNIVERSAL_FOUND_STYLE_EXT1 ;
else if ( id = = IDM_SEARCH_MARKALLEXT2 )
styleID = SCE_UNIVERSAL_FOUND_STYLE_EXT2 ;
else if ( id = = IDM_SEARCH_MARKALLEXT3 )
styleID = SCE_UNIVERSAL_FOUND_STYLE_EXT3 ;
else if ( id = = IDM_SEARCH_MARKALLEXT4 )
styleID = SCE_UNIVERSAL_FOUND_STYLE_EXT4 ;
else // (id == IDM_SEARCH_MARKALLEXT5)
styleID = SCE_UNIVERSAL_FOUND_STYLE_EXT5 ;
const int strSize = FINDREPLACE_MAXLENGTH ;
TCHAR text2Find [ strSize ] ;
2013-09-18 17:52:34 +00:00
TCHAR text2Find2 [ strSize ] ;
2010-01-29 23:52:47 +00:00
_pEditView - > getGenericSelectedText ( text2Find , strSize , false ) ;
2013-09-18 17:52:34 +00:00
_pEditView - > getGenericWordOnCaretPos ( text2Find2 , strSize ) ;
2010-01-29 23:52:47 +00:00
if ( text2Find [ 0 ] = = ' \0 ' )
{
2013-09-18 17:52:34 +00:00
_findReplaceDlg . markAll ( text2Find2 , styleID , true ) ;
2010-01-29 23:52:47 +00:00
}
2013-09-18 17:52:34 +00:00
else
{
_findReplaceDlg . markAll ( text2Find , styleID , lstrlen ( text2Find ) = = lstrlen ( text2Find2 ) ) ;
}
2010-01-29 23:52:47 +00:00
break ;
}
case IDM_SEARCH_UNMARKALLEXT1 :
case IDM_SEARCH_UNMARKALLEXT2 :
case IDM_SEARCH_UNMARKALLEXT3 :
case IDM_SEARCH_UNMARKALLEXT4 :
case IDM_SEARCH_UNMARKALLEXT5 :
{
int styleID ;
if ( id = = IDM_SEARCH_UNMARKALLEXT1 )
styleID = SCE_UNIVERSAL_FOUND_STYLE_EXT1 ;
else if ( id = = IDM_SEARCH_UNMARKALLEXT2 )
styleID = SCE_UNIVERSAL_FOUND_STYLE_EXT2 ;
else if ( id = = IDM_SEARCH_UNMARKALLEXT3 )
styleID = SCE_UNIVERSAL_FOUND_STYLE_EXT3 ;
else if ( id = = IDM_SEARCH_UNMARKALLEXT4 )
styleID = SCE_UNIVERSAL_FOUND_STYLE_EXT4 ;
else // (id == IDM_SEARCH_UNMARKALLEXT5)
styleID = SCE_UNIVERSAL_FOUND_STYLE_EXT5 ;
_pEditView - > clearIndicator ( styleID ) ;
break ;
}
case IDM_SEARCH_GONEXTMARKER1 :
case IDM_SEARCH_GONEXTMARKER2 :
case IDM_SEARCH_GONEXTMARKER3 :
case IDM_SEARCH_GONEXTMARKER4 :
case IDM_SEARCH_GONEXTMARKER5 :
case IDM_SEARCH_GONEXTMARKER_DEF :
{
int styleID ;
if ( id = = IDM_SEARCH_GONEXTMARKER1 )
styleID = SCE_UNIVERSAL_FOUND_STYLE_EXT1 ;
else if ( id = = IDM_SEARCH_GONEXTMARKER2 )
styleID = SCE_UNIVERSAL_FOUND_STYLE_EXT2 ;
else if ( id = = IDM_SEARCH_GONEXTMARKER3 )
styleID = SCE_UNIVERSAL_FOUND_STYLE_EXT3 ;
else if ( id = = IDM_SEARCH_GONEXTMARKER4 )
styleID = SCE_UNIVERSAL_FOUND_STYLE_EXT4 ;
else if ( id = = IDM_SEARCH_GONEXTMARKER5 )
styleID = SCE_UNIVERSAL_FOUND_STYLE_EXT5 ;
else // (id == IDM_SEARCH_GONEXTMARKER_DEF)
styleID = SCE_UNIVERSAL_FOUND_STYLE ;
goToNextIndicator ( styleID ) ;
break ;
}
2015-08-06 09:03:57 +00:00
2010-01-29 23:52:47 +00:00
case IDM_SEARCH_GOPREVMARKER1 :
case IDM_SEARCH_GOPREVMARKER2 :
case IDM_SEARCH_GOPREVMARKER3 :
case IDM_SEARCH_GOPREVMARKER4 :
case IDM_SEARCH_GOPREVMARKER5 :
case IDM_SEARCH_GOPREVMARKER_DEF :
{
int styleID ;
if ( id = = IDM_SEARCH_GOPREVMARKER1 )
styleID = SCE_UNIVERSAL_FOUND_STYLE_EXT1 ;
else if ( id = = IDM_SEARCH_GOPREVMARKER2 )
styleID = SCE_UNIVERSAL_FOUND_STYLE_EXT2 ;
else if ( id = = IDM_SEARCH_GOPREVMARKER3 )
styleID = SCE_UNIVERSAL_FOUND_STYLE_EXT3 ;
else if ( id = = IDM_SEARCH_GOPREVMARKER4 )
styleID = SCE_UNIVERSAL_FOUND_STYLE_EXT4 ;
else if ( id = = IDM_SEARCH_GOPREVMARKER5 )
styleID = SCE_UNIVERSAL_FOUND_STYLE_EXT5 ;
else // (id == IDM_SEARCH_GOPREVMARKER_DEF)
styleID = SCE_UNIVERSAL_FOUND_STYLE ;
goToPreviousIndicator ( styleID ) ;
break ;
}
case IDM_SEARCH_CLEARALLMARKS :
{
_pEditView - > clearIndicator ( SCE_UNIVERSAL_FOUND_STYLE_EXT1 ) ;
_pEditView - > clearIndicator ( SCE_UNIVERSAL_FOUND_STYLE_EXT2 ) ;
_pEditView - > clearIndicator ( SCE_UNIVERSAL_FOUND_STYLE_EXT3 ) ;
_pEditView - > clearIndicator ( SCE_UNIVERSAL_FOUND_STYLE_EXT4 ) ;
_pEditView - > clearIndicator ( SCE_UNIVERSAL_FOUND_STYLE_EXT5 ) ;
break ;
}
case IDM_SEARCH_GOTOLINE :
{
bool isFirstTime = ! _goToLineDlg . isCreated ( ) ;
2010-03-05 00:15:06 +00:00
_goToLineDlg . doDialog ( _nativeLangSpeaker . isRTL ( ) ) ;
2010-01-29 23:52:47 +00:00
if ( isFirstTime )
2010-03-05 00:15:06 +00:00
_nativeLangSpeaker . changeDlgLang ( _goToLineDlg . getHSelf ( ) , " GoToLine " ) ;
2010-01-29 23:52:47 +00:00
break ;
}
2011-05-19 21:19:05 +00:00
case IDM_SEARCH_FINDCHARINRANGE :
{
bool isFirstTime = ! _findCharsInRangeDlg . isCreated ( ) ;
_findCharsInRangeDlg . doDialog ( _nativeLangSpeaker . isRTL ( ) ) ;
if ( isFirstTime )
_nativeLangSpeaker . changeDlgLang ( _findCharsInRangeDlg . getHSelf ( ) , " FindCharsInRange " ) ;
break ;
}
2011-02-19 15:06:53 +00:00
case IDM_EDIT_COLUMNMODETIP :
{
_nativeLangSpeaker . messageBox ( " ColumnModeTip " ,
_pPublicInterface - > getHSelf ( ) ,
TEXT ( " Please use \" ALT+Mouse Selection \" or \" Alt+Shift+Arrow key \" to switch to column mode. " ) ,
2011-03-31 00:14:18 +00:00
TEXT ( " Column Mode Tip " ) ,
2011-02-19 15:06:53 +00:00
MB_OK | MB_APPLMODAL ) ;
break ;
}
2010-01-29 23:52:47 +00:00
case IDM_EDIT_COLUMNMODE :
{
bool isFirstTime = ! _colEditorDlg . isCreated ( ) ;
2010-03-05 00:15:06 +00:00
_colEditorDlg . doDialog ( _nativeLangSpeaker . isRTL ( ) ) ;
2010-01-29 23:52:47 +00:00
if ( isFirstTime )
2010-03-05 00:15:06 +00:00
_nativeLangSpeaker . changeDlgLang ( _colEditorDlg . getHSelf ( ) , " ColumnEditor " ) ;
2010-01-29 23:52:47 +00:00
break ;
}
case IDM_SEARCH_GOTOMATCHINGBRACE :
2013-08-01 18:50:39 +00:00
case IDM_SEARCH_SELECTMATCHINGBRACES :
2010-01-29 23:52:47 +00:00
{
int braceAtCaret = - 1 ;
int braceOpposite = - 1 ;
findMatchingBracePos ( braceAtCaret , braceOpposite ) ;
if ( braceOpposite ! = - 1 )
2013-08-01 18:50:39 +00:00
{
if ( id = = IDM_SEARCH_GOTOMATCHINGBRACE )
_pEditView - > execute ( SCI_GOTOPOS , braceOpposite ) ;
else
_pEditView - > execute ( SCI_SETSEL , min ( braceAtCaret , braceOpposite ) , max ( braceAtCaret , braceOpposite ) + 1 ) ; // + 1 so we always include the ending brace in the selection.
}
2010-01-29 23:52:47 +00:00
break ;
}
case IDM_SEARCH_TOGGLE_BOOKMARK :
bookmarkToggle ( - 1 ) ;
break ;
case IDM_SEARCH_NEXT_BOOKMARK :
bookmarkNext ( true ) ;
break ;
case IDM_SEARCH_PREV_BOOKMARK :
bookmarkNext ( false ) ;
break ;
case IDM_SEARCH_CLEAR_BOOKMARKS :
bookmarkClearAll ( ) ;
break ;
2015-08-06 09:03:57 +00:00
2012-09-28 21:04:16 +00:00
case IDM_LANG_USER_DLG :
2010-01-29 23:52:47 +00:00
{
bool isUDDlgVisible = false ;
2015-08-06 09:03:57 +00:00
2010-01-29 23:52:47 +00:00
UserDefineDialog * udd = _pEditView - > getUserDefineDlg ( ) ;
if ( ! udd - > isCreated ( ) )
{
2010-03-05 00:15:06 +00:00
_pEditView - > doUserDefineDlg ( true , _nativeLangSpeaker . isRTL ( ) ) ;
_nativeLangSpeaker . changeUserDefineLang ( udd ) ;
2010-01-29 23:52:47 +00:00
if ( _isUDDocked )
: : SendMessage ( udd - > getHSelf ( ) , WM_COMMAND , IDC_DOCK_BUTTON , 0 ) ;
}
else
{
isUDDlgVisible = udd - > isVisible ( ) ;
bool isUDDlgDocked = udd - > isDocked ( ) ;
if ( ( isUDDlgDocked ) & & ( isUDDlgVisible ) )
{
: : ShowWindow ( _pMainSplitter - > getHSelf ( ) , SW_HIDE ) ;
if ( bothActive ( ) )
_pMainWindow = & _subSplitter ;
else
_pMainWindow = _pDocTab ;
2010-03-26 00:22:14 +00:00
: : SendMessage ( _pPublicInterface - > getHSelf ( ) , WM_SIZE , 0 , 0 ) ;
2015-08-06 09:03:57 +00:00
2010-01-29 23:52:47 +00:00
udd - > display ( false ) ;
_mainWindowStatus & = ~ WindowUserActive ;
}
else if ( ( isUDDlgDocked ) & & ( ! isUDDlgVisible ) )
{
if ( ! _pMainSplitter )
{
_pMainSplitter = new SplitterContainer ;
2010-03-26 00:22:14 +00:00
_pMainSplitter - > init ( _pPublicInterface - > getHinst ( ) , _pPublicInterface - > getHSelf ( ) ) ;
2010-01-29 23:52:47 +00:00
Window * pWindow ;
if ( bothActive ( ) )
pWindow = & _subSplitter ;
else
pWindow = _pDocTab ;
2015-08-06 09:03:57 +00:00
_pMainSplitter - > create ( pWindow , ScintillaEditView : : getUserDefineDlg ( ) , 8 , SplitterMode : : RIGHT_FIX , 45 ) ;
2010-01-29 23:52:47 +00:00
}
_pMainWindow = _pMainSplitter ;
_pMainSplitter - > setWin0 ( ( bothActive ( ) ) ? ( Window * ) & _subSplitter : ( Window * ) _pDocTab ) ;
2010-03-26 00:22:14 +00:00
: : SendMessage ( _pPublicInterface - > getHSelf ( ) , WM_SIZE , 0 , 0 ) ;
2010-01-29 23:52:47 +00:00
_pMainWindow - > display ( ) ;
_mainWindowStatus | = WindowUserActive ;
}
else if ( ( ! isUDDlgDocked ) & & ( isUDDlgVisible ) )
{
udd - > display ( false ) ;
}
else //((!isUDDlgDocked)&&(!isUDDlgVisible))
udd - > display ( ) ;
}
2012-09-28 21:04:16 +00:00
checkMenuItem ( IDM_LANG_USER_DLG , ! isUDDlgVisible ) ;
_toolBar . setCheck ( IDM_LANG_USER_DLG , ! isUDDlgVisible ) ;
2010-01-29 23:52:47 +00:00
break ;
}
case IDM_EDIT_SELECTALL :
_pEditView - > execute ( SCI_SELECTALL ) ;
checkClipboard ( ) ;
break ;
case IDM_EDIT_INS_TAB :
_pEditView - > execute ( SCI_TAB ) ;
break ;
case IDM_EDIT_RMV_TAB :
_pEditView - > execute ( SCI_BACKTAB ) ;
break ;
case IDM_EDIT_DUP_LINE :
_pEditView - > execute ( SCI_LINEDUPLICATE ) ;
break ;
case IDM_EDIT_SPLIT_LINES :
_pEditView - > execute ( SCI_TARGETFROMSELECTION ) ;
2015-04-29 00:45:11 +00:00
if ( _pEditView - > execute ( SCI_GETEDGEMODE ) = = EDGE_NONE )
_pEditView - > execute ( SCI_LINESSPLIT ) ;
else
_pEditView - > execute ( SCI_LINESSPLIT , _pEditView - > execute ( SCI_TEXTWIDTH , STYLE_LINENUMBER , ( LPARAM ) " P " ) * _pEditView - > execute ( SCI_GETEDGECOLUMN ) ) ;
2010-01-29 23:52:47 +00:00
break ;
case IDM_EDIT_JOIN_LINES :
_pEditView - > execute ( SCI_TARGETFROMSELECTION ) ;
_pEditView - > execute ( SCI_LINESJOIN ) ;
break ;
case IDM_EDIT_LINE_UP :
_pEditView - > currentLinesUp ( ) ;
break ;
case IDM_EDIT_LINE_DOWN :
_pEditView - > currentLinesDown ( ) ;
break ;
2012-12-05 00:10:22 +00:00
case IDM_EDIT_REMOVEEMPTYLINES :
_pEditView - > execute ( SCI_BEGINUNDOACTION ) ;
removeEmptyLine ( false ) ;
_pEditView - > execute ( SCI_ENDUNDOACTION ) ;
break ;
case IDM_EDIT_REMOVEEMPTYLINESWITHBLANK :
_pEditView - > execute ( SCI_BEGINUNDOACTION ) ;
removeEmptyLine ( true ) ;
_pEditView - > execute ( SCI_ENDUNDOACTION ) ;
break ;
2010-01-29 23:52:47 +00:00
case IDM_EDIT_UPPERCASE :
_pEditView - > convertSelectedTextToUpperCase ( ) ;
break ;
case IDM_EDIT_LOWERCASE :
_pEditView - > convertSelectedTextToLowerCase ( ) ;
break ;
case IDM_EDIT_BLOCK_COMMENT :
doBlockComment ( cm_toggle ) ;
break ;
2015-08-06 09:03:57 +00:00
2010-01-29 23:52:47 +00:00
case IDM_EDIT_BLOCK_COMMENT_SET :
doBlockComment ( cm_comment ) ;
break ;
case IDM_EDIT_BLOCK_UNCOMMENT :
doBlockComment ( cm_uncomment ) ;
break ;
case IDM_EDIT_STREAM_COMMENT :
doStreamComment ( ) ;
break ;
2012-08-31 19:14:00 +00:00
case IDM_EDIT_STREAM_UNCOMMENT :
undoStreamComment ( ) ;
break ;
2010-01-29 23:52:47 +00:00
case IDM_EDIT_TRIMTRAILING :
2010-12-05 19:33:48 +00:00
_pEditView - > execute ( SCI_BEGINUNDOACTION ) ;
doTrim ( lineTail ) ;
_pEditView - > execute ( SCI_ENDUNDOACTION ) ;
break ;
case IDM_EDIT_TRIMLINEHEAD :
_pEditView - > execute ( SCI_BEGINUNDOACTION ) ;
doTrim ( lineHeader ) ;
_pEditView - > execute ( SCI_ENDUNDOACTION ) ;
break ;
case IDM_EDIT_TRIM_BOTH :
_pEditView - > execute ( SCI_BEGINUNDOACTION ) ;
doTrim ( lineTail ) ;
doTrim ( lineHeader ) ;
_pEditView - > execute ( SCI_ENDUNDOACTION ) ;
break ;
case IDM_EDIT_EOL2WS :
_pEditView - > execute ( SCI_BEGINUNDOACTION ) ;
2016-02-18 00:08:14 +00:00
_pEditView - > execute ( SCI_SETTARGETRANGE , 0 , _pEditView - > getCurrentDocLen ( ) ) ;
2010-12-05 19:33:48 +00:00
_pEditView - > execute ( SCI_LINESJOIN ) ;
_pEditView - > execute ( SCI_ENDUNDOACTION ) ;
break ;
case IDM_EDIT_TRIMALL :
_pEditView - > execute ( SCI_BEGINUNDOACTION ) ;
doTrim ( lineTail ) ;
doTrim ( lineHeader ) ;
2016-02-18 00:08:14 +00:00
_pEditView - > execute ( SCI_SETTARGETRANGE , 0 , _pEditView - > getCurrentDocLen ( ) ) ;
2010-12-05 19:33:48 +00:00
_pEditView - > execute ( SCI_LINESJOIN ) ;
_pEditView - > execute ( SCI_ENDUNDOACTION ) ;
break ;
case IDM_EDIT_TAB2SW :
2012-08-25 19:23:16 +00:00
wsTabConvert ( tab2Space ) ;
2010-12-05 19:33:48 +00:00
break ;
2012-08-25 19:23:16 +00:00
case IDM_EDIT_SW2TAB_LEADING :
wsTabConvert ( space2TabLeading ) ;
break ;
case IDM_EDIT_SW2TAB_ALL :
wsTabConvert ( space2TabAll ) ;
2010-01-29 23:52:47 +00:00
break ;
case IDM_EDIT_SETREADONLY :
{
Buffer * buf = _pEditView - > getCurrentBuffer ( ) ;
buf - > setUserReadOnly ( ! buf - > getUserReadOnly ( ) ) ;
}
break ;
case IDM_EDIT_CLEARREADONLY :
{
Buffer * buf = _pEditView - > getCurrentBuffer ( ) ;
2015-08-06 09:03:57 +00:00
2010-01-29 23:52:47 +00:00
DWORD dwFileAttribs = : : GetFileAttributes ( buf - > getFullPathName ( ) ) ;
2015-08-06 09:03:57 +00:00
dwFileAttribs ^ = FILE_ATTRIBUTE_READONLY ;
2010-01-29 23:52:47 +00:00
2015-08-06 09:03:57 +00:00
: : SetFileAttributes ( buf - > getFullPathName ( ) , dwFileAttribs ) ;
2010-01-29 23:52:47 +00:00
buf - > setFileReadOnly ( false ) ;
}
break ;
case IDM_SEARCH_CUTMARKEDLINES :
cutMarkedLines ( ) ;
break ;
case IDM_SEARCH_COPYMARKEDLINES :
copyMarkedLines ( ) ;
break ;
case IDM_SEARCH_PASTEMARKEDLINES :
pasteToMarkedLines ( ) ;
break ;
case IDM_SEARCH_DELETEMARKEDLINES :
2011-02-19 15:06:53 +00:00
deleteMarkedLines ( true ) ;
break ;
case IDM_SEARCH_DELETEUNMARKEDLINES :
deleteMarkedLines ( false ) ;
2010-01-29 23:52:47 +00:00
break ;
2010-05-27 00:05:51 +00:00
case IDM_SEARCH_INVERSEMARKS :
inverseMarks ( ) ;
break ;
2010-01-29 23:52:47 +00:00
case IDM_VIEW_FULLSCREENTOGGLE :
fullScreenToggle ( ) ;
break ;
case IDM_VIEW_ALWAYSONTOP :
{
int check = ( : : GetMenuState ( _mainMenuHandle , id , MF_BYCOMMAND ) = = MF_CHECKED ) ? MF_UNCHECKED : MF_CHECKED ;
: : CheckMenuItem ( _mainMenuHandle , id , MF_BYCOMMAND | check ) ;
2010-03-26 00:22:14 +00:00
SetWindowPos ( _pPublicInterface - > getHSelf ( ) , check = = MF_CHECKED ? HWND_TOPMOST : HWND_NOTOPMOST , 0 , 0 , 0 , 0 , SWP_NOMOVE | SWP_NOSIZE ) ;
2010-01-29 23:52:47 +00:00
}
break ;
case IDM_VIEW_FOLD_CURRENT :
case IDM_VIEW_UNFOLD_CURRENT :
_pEditView - > foldCurrentPos ( ( id = = IDM_VIEW_FOLD_CURRENT ) ? fold_collapse : fold_uncollapse ) ;
break ;
case IDM_VIEW_TOGGLE_FOLDALL :
case IDM_VIEW_TOGGLE_UNFOLDALL :
{
2012-05-25 23:40:44 +00:00
_isFolding = true ; // So we can ignore events while folding is taking place
2012-06-26 00:55:01 +00:00
bool doCollapse = ( id = = IDM_VIEW_TOGGLE_FOLDALL ) ? fold_collapse : fold_uncollapse ;
_pEditView - > foldAll ( doCollapse ) ;
if ( _pDocMap )
{
_pDocMap - > foldAll ( doCollapse ) ;
}
2012-05-25 23:40:44 +00:00
_isFolding = false ;
2010-01-29 23:52:47 +00:00
}
break ;
case IDM_VIEW_FOLD_1 :
case IDM_VIEW_FOLD_2 :
case IDM_VIEW_FOLD_3 :
case IDM_VIEW_FOLD_4 :
case IDM_VIEW_FOLD_5 :
case IDM_VIEW_FOLD_6 :
case IDM_VIEW_FOLD_7 :
case IDM_VIEW_FOLD_8 :
2012-05-25 23:40:44 +00:00
_isFolding = true ; // So we can ignore events while folding is taking place
_pEditView - > collapse ( id - IDM_VIEW_FOLD - 1 , fold_collapse ) ;
_isFolding = false ;
2010-01-29 23:52:47 +00:00
break ;
case IDM_VIEW_UNFOLD_1 :
case IDM_VIEW_UNFOLD_2 :
case IDM_VIEW_UNFOLD_3 :
case IDM_VIEW_UNFOLD_4 :
case IDM_VIEW_UNFOLD_5 :
case IDM_VIEW_UNFOLD_6 :
case IDM_VIEW_UNFOLD_7 :
case IDM_VIEW_UNFOLD_8 :
2012-05-25 23:40:44 +00:00
_isFolding = true ; // So we can ignore events while folding is taking place
_pEditView - > collapse ( id - IDM_VIEW_UNFOLD - 1 , fold_uncollapse ) ;
_isFolding = false ;
2010-01-29 23:52:47 +00:00
break ;
case IDM_VIEW_TOOLBAR_REDUCE :
{
toolBarStatusType state = _toolBar . getState ( ) ;
if ( state ! = TB_SMALL )
{
_toolBar . reduce ( ) ;
changeToolBarIcons ( ) ;
}
}
break ;
case IDM_VIEW_TOOLBAR_ENLARGE :
{
toolBarStatusType state = _toolBar . getState ( ) ;
if ( state ! = TB_LARGE )
{
_toolBar . enlarge ( ) ;
changeToolBarIcons ( ) ;
}
}
break ;
case IDM_VIEW_TOOLBAR_STANDARD :
{
toolBarStatusType state = _toolBar . getState ( ) ;
if ( state ! = TB_STANDARD )
{
_toolBar . setToUglyIcons ( ) ;
}
}
break ;
case IDM_VIEW_REDUCETABBAR :
{
_toReduceTabBar = ! _toReduceTabBar ;
//Resize the icon
2014-02-11 00:26:24 +00:00
int iconDpiDynamicalSize = NppParameters : : getInstance ( ) - > _dpiManager . scaleY ( _toReduceTabBar ? 12 : 18 ) ;
2010-01-29 23:52:47 +00:00
//Resize the tab height
2015-05-01 17:51:59 +00:00
int tabDpiDynamicalWidth = NppParameters : : getInstance ( ) - > _dpiManager . scaleX ( 45 ) ;
2015-09-22 18:33:28 +00:00
int tabDpiDynamicalHeight = NppParameters : : getInstance ( ) - > _dpiManager . scaleY ( _toReduceTabBar ? 22 : 25 ) ;
2015-05-01 17:51:59 +00:00
TabCtrl_SetItemSize ( _mainDocTab . getHSelf ( ) , tabDpiDynamicalWidth , tabDpiDynamicalHeight ) ;
TabCtrl_SetItemSize ( _subDocTab . getHSelf ( ) , tabDpiDynamicalWidth , tabDpiDynamicalHeight ) ;
2014-02-11 00:26:24 +00:00
_docTabIconList . setIconSize ( iconDpiDynamicalSize ) ;
2010-01-29 23:52:47 +00:00
//change the font
int stockedFont = _toReduceTabBar ? DEFAULT_GUI_FONT : SYSTEM_FONT ;
HFONT hf = ( HFONT ) : : GetStockObject ( stockedFont ) ;
if ( hf )
{
: : SendMessage ( _mainDocTab . getHSelf ( ) , WM_SETFONT , ( WPARAM ) hf , MAKELPARAM ( TRUE , 0 ) ) ;
: : SendMessage ( _subDocTab . getHSelf ( ) , WM_SETFONT , ( WPARAM ) hf , MAKELPARAM ( TRUE , 0 ) ) ;
}
2010-03-26 00:22:14 +00:00
: : SendMessage ( _pPublicInterface - > getHSelf ( ) , WM_SIZE , 0 , 0 ) ;
2010-01-29 23:52:47 +00:00
break ;
}
2015-08-06 09:03:57 +00:00
2010-01-29 23:52:47 +00:00
case IDM_VIEW_REFRESHTABAR :
{
2010-03-26 00:22:14 +00:00
: : SendMessage ( _pPublicInterface - > getHSelf ( ) , WM_SIZE , 0 , 0 ) ;
2010-01-29 23:52:47 +00:00
break ;
}
case IDM_VIEW_LOCKTABBAR :
{
bool isDrag = TabBarPlus : : doDragNDropOrNot ( ) ;
TabBarPlus : : doDragNDrop ( ! isDrag ) ;
break ;
}
case IDM_VIEW_DRAWTABBAR_INACIVETAB :
{
TabBarPlus : : setDrawInactiveTab ( ! TabBarPlus : : drawInactiveTab ( ) ) ;
break ;
}
case IDM_VIEW_DRAWTABBAR_TOPBAR :
{
TabBarPlus : : setDrawTopBar ( ! TabBarPlus : : drawTopBar ( ) ) ;
break ;
}
case IDM_VIEW_DRAWTABBAR_CLOSEBOTTUN :
{
TabBarPlus : : setDrawTabCloseButton ( ! TabBarPlus : : drawTabCloseButton ( ) ) ;
// This part is just for updating (redraw) the tabs
2016-07-18 00:08:29 +00:00
int tabDpiDynamicalHeight = NppParameters : : getInstance ( ) - > _dpiManager . scaleY ( TabBarPlus : : drawTabCloseButton ( ) ? 22 : 22 ) ;
int tabDpiDynamicalWidth = NppParameters : : getInstance ( ) - > _dpiManager . scaleX ( TabBarPlus : : drawTabCloseButton ( ) ? 60 : 45 ) ;
TabCtrl_SetItemSize ( _mainDocTab . getHSelf ( ) , tabDpiDynamicalWidth , tabDpiDynamicalHeight ) ;
TabCtrl_SetItemSize ( _subDocTab . getHSelf ( ) , tabDpiDynamicalWidth , tabDpiDynamicalHeight ) ;
2010-03-26 00:22:14 +00:00
: : SendMessage ( _pPublicInterface - > getHSelf ( ) , WM_SIZE , 0 , 0 ) ;
2010-01-29 23:52:47 +00:00
break ;
}
case IDM_VIEW_DRAWTABBAR_DBCLK2CLOSE :
{
TabBarPlus : : setDbClk2Close ( ! TabBarPlus : : isDbClk2Close ( ) ) ;
break ;
}
2015-08-06 09:03:57 +00:00
2010-01-29 23:52:47 +00:00
case IDM_VIEW_DRAWTABBAR_VERTICAL :
{
TabBarPlus : : setVertical ( ! TabBarPlus : : isVertical ( ) ) ;
2010-03-26 00:22:14 +00:00
: : SendMessage ( _pPublicInterface - > getHSelf ( ) , WM_SIZE , 0 , 0 ) ;
2010-01-29 23:52:47 +00:00
break ;
}
2015-08-06 09:03:57 +00:00
2010-01-29 23:52:47 +00:00
case IDM_VIEW_DRAWTABBAR_MULTILINE :
{
TabBarPlus : : setMultiLine ( ! TabBarPlus : : isMultiLine ( ) ) ;
2015-08-06 09:03:57 +00:00
: : SendMessage ( _pPublicInterface - > getHSelf ( ) , WM_SIZE , 0 , 0 ) ;
2010-01-29 23:52:47 +00:00
break ;
}
case IDM_VIEW_POSTIT :
{
postItToggle ( ) ;
}
break ;
case IDM_VIEW_TAB_SPACE :
{
bool isChecked = ! ( : : GetMenuState ( _mainMenuHandle , IDM_VIEW_TAB_SPACE , MF_BYCOMMAND ) = = MF_CHECKED ) ;
: : CheckMenuItem ( _mainMenuHandle , IDM_VIEW_EOL , MF_BYCOMMAND | MF_UNCHECKED ) ;
: : CheckMenuItem ( _mainMenuHandle , IDM_VIEW_ALL_CHARACTERS , MF_BYCOMMAND | MF_UNCHECKED ) ;
: : CheckMenuItem ( _mainMenuHandle , IDM_VIEW_TAB_SPACE , MF_BYCOMMAND | ( isChecked ? MF_CHECKED : MF_UNCHECKED ) ) ;
_toolBar . setCheck ( IDM_VIEW_ALL_CHARACTERS , false ) ;
2010-07-26 00:12:02 +00:00
_mainEditView . showEOL ( false ) ;
_mainEditView . showWSAndTab ( isChecked ) ;
_subEditView . showEOL ( false ) ;
_subEditView . showWSAndTab ( isChecked ) ;
2010-09-01 20:36:47 +00:00
ScintillaViewParams & svp1 = ( ScintillaViewParams & ) ( NppParameters : : getInstance ( ) ) - > getSVP ( ) ;
svp1 . _whiteSpaceShow = isChecked ;
svp1 . _eolShow = false ;
2010-01-29 23:52:47 +00:00
break ;
}
case IDM_VIEW_EOL :
{
bool isChecked = ! ( : : GetMenuState ( _mainMenuHandle , IDM_VIEW_EOL , MF_BYCOMMAND ) = = MF_CHECKED ) ;
: : CheckMenuItem ( _mainMenuHandle , IDM_VIEW_TAB_SPACE , MF_BYCOMMAND | MF_UNCHECKED ) ;
: : CheckMenuItem ( _mainMenuHandle , IDM_VIEW_EOL , MF_BYCOMMAND | ( isChecked ? MF_CHECKED : MF_UNCHECKED ) ) ;
: : CheckMenuItem ( _mainMenuHandle , IDM_VIEW_ALL_CHARACTERS , MF_BYCOMMAND | MF_UNCHECKED ) ;
_toolBar . setCheck ( IDM_VIEW_ALL_CHARACTERS , false ) ;
2010-07-26 00:12:02 +00:00
_mainEditView . showEOL ( isChecked ) ;
_subEditView . showEOL ( isChecked ) ;
_mainEditView . showWSAndTab ( false ) ;
_subEditView . showWSAndTab ( false ) ;
2010-09-01 20:36:47 +00:00
ScintillaViewParams & svp1 = ( ScintillaViewParams & ) ( NppParameters : : getInstance ( ) ) - > getSVP ( ) ;
svp1 . _whiteSpaceShow = false ;
svp1 . _eolShow = isChecked ;
2010-01-29 23:52:47 +00:00
break ;
}
case IDM_VIEW_ALL_CHARACTERS :
{
bool isChecked = ! ( : : GetMenuState ( _mainMenuHandle , id , MF_BYCOMMAND ) = = MF_CHECKED ) ;
: : CheckMenuItem ( _mainMenuHandle , IDM_VIEW_EOL , MF_BYCOMMAND | MF_UNCHECKED ) ;
: : CheckMenuItem ( _mainMenuHandle , IDM_VIEW_TAB_SPACE , MF_BYCOMMAND | MF_UNCHECKED ) ;
: : CheckMenuItem ( _mainMenuHandle , IDM_VIEW_ALL_CHARACTERS , MF_BYCOMMAND | ( isChecked ? MF_CHECKED : MF_UNCHECKED ) ) ;
2010-07-26 00:12:02 +00:00
_mainEditView . showInvisibleChars ( isChecked ) ;
_subEditView . showInvisibleChars ( isChecked ) ;
2010-01-29 23:52:47 +00:00
_toolBar . setCheck ( IDM_VIEW_ALL_CHARACTERS , isChecked ) ;
2010-09-01 20:36:47 +00:00
ScintillaViewParams & svp1 = ( ScintillaViewParams & ) ( NppParameters : : getInstance ( ) ) - > getSVP ( ) ;
svp1 . _whiteSpaceShow = isChecked ;
svp1 . _eolShow = isChecked ;
2010-01-29 23:52:47 +00:00
break ;
}
case IDM_VIEW_INDENT_GUIDE :
{
2010-07-26 00:12:02 +00:00
_mainEditView . showIndentGuideLine ( ! _pEditView - > isShownIndentGuide ( ) ) ;
_subEditView . showIndentGuideLine ( ! _pEditView - > isShownIndentGuide ( ) ) ;
2010-01-29 23:52:47 +00:00
_toolBar . setCheck ( IDM_VIEW_INDENT_GUIDE , _pEditView - > isShownIndentGuide ( ) ) ;
checkMenuItem ( IDM_VIEW_INDENT_GUIDE , _pEditView - > isShownIndentGuide ( ) ) ;
2010-09-01 20:36:47 +00:00
ScintillaViewParams & svp1 = ( ScintillaViewParams & ) ( NppParameters : : getInstance ( ) ) - > getSVP ( ) ;
svp1 . _indentGuideLineShow = _pEditView - > isShownIndentGuide ( ) ;
2010-01-29 23:52:47 +00:00
break ;
}
case IDM_VIEW_WRAP :
{
2012-03-07 02:17:16 +00:00
bool isWraped = ! _pEditView - > isWrap ( ) ;
2012-06-30 01:30:00 +00:00
//--FLS: ViewMoveAtWrappingDisableFix: Disable wrapping messes up visible lines. Therefore save view position before in IDM_VIEW_WRAP and restore after SCN_PAINTED, as Scintilla-Doc. says
if ( ! isWraped )
{
_mainEditView . saveCurrentPos ( ) ;
_mainEditView . setWrapRestoreNeeded ( true ) ;
_subEditView . saveCurrentPos ( ) ;
_subEditView . setWrapRestoreNeeded ( true ) ;
}
2012-03-07 02:17:16 +00:00
_mainEditView . wrap ( isWraped ) ;
_subEditView . wrap ( isWraped ) ;
_toolBar . setCheck ( IDM_VIEW_WRAP , isWraped ) ;
checkMenuItem ( IDM_VIEW_WRAP , isWraped ) ;
ScintillaViewParams & svp1 = ( ScintillaViewParams & ) ( NppParameters : : getInstance ( ) ) - > getSVP ( ) ;
svp1 . _doWrap = isWraped ;
if ( _pDocMap )
2012-03-04 18:04:36 +00:00
{
2012-03-14 02:07:45 +00:00
_pDocMap - > initWrapMap ( ) ;
_pDocMap - > wrapMap ( ) ;
2012-03-04 18:04:36 +00:00
}
2010-01-29 23:52:47 +00:00
break ;
}
case IDM_VIEW_WRAP_SYMBOL :
{
2010-07-26 00:12:02 +00:00
_mainEditView . showWrapSymbol ( ! _pEditView - > isWrapSymbolVisible ( ) ) ;
_subEditView . showWrapSymbol ( ! _pEditView - > isWrapSymbolVisible ( ) ) ;
2010-01-29 23:52:47 +00:00
checkMenuItem ( IDM_VIEW_WRAP_SYMBOL , _pEditView - > isWrapSymbolVisible ( ) ) ;
2010-09-01 20:36:47 +00:00
ScintillaViewParams & svp1 = ( ScintillaViewParams & ) ( NppParameters : : getInstance ( ) ) - > getSVP ( ) ;
svp1 . _wrapSymbolShow = _pEditView - > isWrapSymbolVisible ( ) ;
2010-01-29 23:52:47 +00:00
break ;
}
case IDM_VIEW_HIDELINES :
{
_pEditView - > hideLines ( ) ;
break ;
}
case IDM_VIEW_ZOOMIN :
{
_pEditView - > execute ( SCI_ZOOMIN ) ;
break ;
}
case IDM_VIEW_ZOOMOUT :
_pEditView - > execute ( SCI_ZOOMOUT ) ;
break ;
case IDM_VIEW_ZOOMRESTORE :
//Zoom factor of 0 points means default view
_pEditView - > execute ( SCI_SETZOOM , 0 ) ; //_zoomOriginalValue);
break ;
case IDM_VIEW_SYNSCROLLV :
{
2010-03-17 23:37:58 +00:00
bool isSynScollV = ! _syncInfo . _isSynScollV ;
2015-08-06 09:03:57 +00:00
2010-03-17 23:37:58 +00:00
checkMenuItem ( IDM_VIEW_SYNSCROLLV , isSynScollV ) ;
_toolBar . setCheck ( IDM_VIEW_SYNSCROLLV , isSynScollV ) ;
2010-01-29 23:52:47 +00:00
2010-03-17 23:37:58 +00:00
_syncInfo . _isSynScollV = isSynScollV ;
2010-01-29 23:52:47 +00:00
if ( _syncInfo . _isSynScollV )
{
2016-06-05 18:29:21 +00:00
int mainCurrentLine = static_cast < int32_t > ( _mainEditView . execute ( SCI_GETFIRSTVISIBLELINE ) ) ;
int subCurrentLine = static_cast < int32_t > ( _subEditView . execute ( SCI_GETFIRSTVISIBLELINE ) ) ;
2010-01-29 23:52:47 +00:00
_syncInfo . _line = mainCurrentLine - subCurrentLine ;
}
2015-08-06 09:03:57 +00:00
2010-01-29 23:52:47 +00:00
}
break ;
case IDM_VIEW_SYNSCROLLH :
{
2010-03-17 23:37:58 +00:00
bool isSynScollH = ! _syncInfo . _isSynScollH ;
checkMenuItem ( IDM_VIEW_SYNSCROLLH , isSynScollH ) ;
_toolBar . setCheck ( IDM_VIEW_SYNSCROLLH , isSynScollH ) ;
2010-01-29 23:52:47 +00:00
2010-03-17 23:37:58 +00:00
_syncInfo . _isSynScollH = isSynScollH ;
2010-01-29 23:52:47 +00:00
if ( _syncInfo . _isSynScollH )
{
2016-06-05 18:29:21 +00:00
int mxoffset = static_cast < int32_t > ( _mainEditView . execute ( SCI_GETXOFFSET ) ) ;
int pixel = static_cast < int32_t > ( _mainEditView . execute ( SCI_TEXTWIDTH , STYLE_DEFAULT , ( LPARAM ) " P " ) ) ;
2010-01-29 23:52:47 +00:00
int mainColumn = mxoffset / pixel ;
2016-06-05 18:29:21 +00:00
int sxoffset = static_cast < int32_t > ( _subEditView . execute ( SCI_GETXOFFSET ) ) ;
2010-01-29 23:52:47 +00:00
pixel = int ( _subEditView . execute ( SCI_TEXTWIDTH , STYLE_DEFAULT , ( LPARAM ) " P " ) ) ;
int subColumn = sxoffset / pixel ;
_syncInfo . _column = mainColumn - subColumn ;
}
}
break ;
2010-09-19 01:27:41 +00:00
case IDM_VIEW_SUMMARY :
{
generic_string characterNumber = TEXT ( " " ) ;
Buffer * curBuf = _pEditView - > getCurrentBuffer ( ) ;
int fileLen = curBuf - > getFileLength ( ) ;
if ( fileLen ! = - 1 )
{
TCHAR * filePathLabel = TEXT ( " Full file path: " ) ;
TCHAR * fileCreateTimeLabel = TEXT ( " Created: " ) ;
TCHAR * fileModifyTimeLabel = TEXT ( " Modified: " ) ;
TCHAR * fileLenLabel = TEXT ( " File length (in byte): " ) ;
characterNumber + = filePathLabel ;
characterNumber + = curBuf - > getFullPathName ( ) ;
characterNumber + = TEXT ( " \r " ) ;
characterNumber + = fileCreateTimeLabel ;
characterNumber + = curBuf - > getFileTime ( Buffer : : ft_created ) ;
characterNumber + = TEXT ( " \r " ) ;
characterNumber + = fileModifyTimeLabel ;
characterNumber + = curBuf - > getFileTime ( Buffer : : ft_modified ) ;
characterNumber + = TEXT ( " \r " ) ;
TCHAR fileLenStr [ 64 ] ;
2015-03-14 22:55:03 +00:00
generic_sprintf ( fileLenStr , TEXT ( " %I64u " ) , static_cast < UINT64 > ( fileLen ) ) ;
2010-09-19 01:27:41 +00:00
characterNumber + = fileLenLabel ;
characterNumber + = fileLenStr ;
characterNumber + = TEXT ( " \r " ) ;
characterNumber + = TEXT ( " \r " ) ;
}
TCHAR * nbCharLabel = TEXT ( " Characters (without blanks): " ) ;
2010-09-25 17:04:44 +00:00
TCHAR * nbWordLabel = TEXT ( " Words: " ) ;
TCHAR * nbLineLabel = TEXT ( " Lines: " ) ;
2010-09-19 01:27:41 +00:00
TCHAR * nbByteLabel = TEXT ( " Current document length: " ) ;
TCHAR * nbSelLabel1 = TEXT ( " selected characters ( " ) ;
TCHAR * nbSelLabel2 = TEXT ( " bytes) in " ) ;
TCHAR * nbRangeLabel = TEXT ( " ranges " ) ;
UniMode um = _pEditView - > getCurrentBuffer ( ) - > getUnicodeMode ( ) ;
2016-06-05 18:29:21 +00:00
auto nbChar = getCurrentDocCharCount ( um ) ;
2010-09-25 17:04:44 +00:00
int nbWord = wordCount ( ) ;
2016-06-05 18:29:21 +00:00
auto nbLine = _pEditView - > execute ( SCI_GETLINECOUNT ) ;
auto nbByte = _pEditView - > execute ( SCI_GETLENGTH ) ;
auto nbSel = getSelectedCharNumber ( um ) ;
auto nbSelByte = getSelectedBytes ( ) ;
auto nbRange = getSelectedAreas ( ) ;
2010-09-19 01:27:41 +00:00
2010-09-25 17:04:44 +00:00
TCHAR nbCharStr [ 32 ] ;
TCHAR nbWordStr [ 16 ] ;
TCHAR nbByteStr [ 32 ] ;
TCHAR nbLineStr [ 32 ] ;
TCHAR nbSelStr [ 32 ] ;
TCHAR nbSelByteStr [ 32 ] ;
2010-09-19 01:27:41 +00:00
TCHAR nbRangeStr [ 8 ] ;
generic_sprintf ( nbCharStr , TEXT ( " %d " ) , nbChar ) ;
characterNumber + = nbCharLabel ;
characterNumber + = nbCharStr ;
characterNumber + = TEXT ( " \r " ) ;
2010-09-25 17:04:44 +00:00
generic_sprintf ( nbWordStr , TEXT ( " %d " ) , nbWord ) ;
characterNumber + = nbWordLabel ;
characterNumber + = nbWordStr ;
2010-09-19 01:27:41 +00:00
characterNumber + = TEXT ( " \r " ) ;
2015-03-14 22:55:03 +00:00
generic_sprintf ( nbLineStr , TEXT ( " %d " ) , static_cast < int > ( nbLine ) ) ;
2010-09-19 01:27:41 +00:00
characterNumber + = nbLineLabel ;
characterNumber + = nbLineStr ;
characterNumber + = TEXT ( " \r " ) ;
2010-09-25 17:04:44 +00:00
generic_sprintf ( nbByteStr , TEXT ( " %d " ) , nbByte ) ;
characterNumber + = nbByteLabel ;
characterNumber + = nbByteStr ;
characterNumber + = TEXT ( " \r " ) ;
2010-09-19 01:27:41 +00:00
generic_sprintf ( nbSelStr , TEXT ( " %d " ) , nbSel ) ;
generic_sprintf ( nbSelByteStr , TEXT ( " %d " ) , nbSelByte ) ;
generic_sprintf ( nbRangeStr , TEXT ( " %d " ) , nbRange ) ;
characterNumber + = nbSelStr ;
characterNumber + = nbSelLabel1 ;
characterNumber + = nbSelByteStr ;
characterNumber + = nbSelLabel2 ;
characterNumber + = nbRangeStr ;
characterNumber + = nbRangeLabel ;
characterNumber + = TEXT ( " \r " ) ;
: : MessageBox ( _pPublicInterface - > getHSelf ( ) , characterNumber . c_str ( ) , TEXT ( " Summary " ) , MB_OK | MB_APPLMODAL ) ;
}
break ;
2016-04-24 03:29:05 +00:00
case IDM_VIEW_MONITORING :
{
static HANDLE hThread = nullptr ;
Buffer * curBuf = _pEditView - > getCurrentBuffer ( ) ;
if ( curBuf - > isMonitoringOn ( ) )
{
curBuf - > stopMonitoring ( ) ;
: : CloseHandle ( hThread ) ;
hThread = nullptr ;
checkMenuItem ( IDM_VIEW_MONITORING , false ) ;
_toolBar . setCheck ( IDM_VIEW_MONITORING , false ) ;
curBuf - > setUserReadOnly ( false ) ;
}
else
{
const TCHAR * longFileName = curBuf - > getFullPathName ( ) ;
if ( : : PathFileExists ( longFileName ) )
{
if ( curBuf - > isDirty ( ) )
{
: : MessageBox ( _pPublicInterface - > getHSelf ( ) , TEXT ( " The document is dirty. Please save the modification before monitoring it. " ) , TEXT ( " Monitoring problem " ) , MB_OK ) ;
}
else
{
curBuf - > startMonitoring ( ) ; // monitoring firstly for making monitoring icon
curBuf - > setUserReadOnly ( true ) ;
2016-05-11 00:18:04 +00:00
MonitorInfo * monitorInfo = new MonitorInfo ( curBuf , _pPublicInterface - > getHSelf ( ) ) ;
2016-04-24 03:29:05 +00:00
hThread = : : CreateThread ( NULL , 0 , monitorFileOnChange , ( void * ) monitorInfo , 0 , NULL ) ; // will be deallocated while quitting thread
checkMenuItem ( IDM_VIEW_MONITORING , true ) ;
_toolBar . setCheck ( IDM_VIEW_MONITORING , true ) ;
}
}
else
{
: : MessageBox ( _pPublicInterface - > getHSelf ( ) , TEXT ( " The file should exist to be monitored. " ) , TEXT ( " Monitoring problem " ) , MB_OK ) ;
}
}
break ;
}
2010-01-29 23:52:47 +00:00
case IDM_EXECUTE :
{
bool isFirstTime = ! _runDlg . isCreated ( ) ;
2010-03-05 00:15:06 +00:00
_runDlg . doDialog ( _nativeLangSpeaker . isRTL ( ) ) ;
2010-01-29 23:52:47 +00:00
if ( isFirstTime )
2010-03-05 00:15:06 +00:00
_nativeLangSpeaker . changeDlgLang ( _runDlg . getHSelf ( ) , " Run " ) ;
2010-01-29 23:52:47 +00:00
break ;
}
2015-08-14 12:57:19 +00:00
case IDM_FORMAT_TODOS :
case IDM_FORMAT_TOUNIX :
case IDM_FORMAT_TOMAC :
2010-01-29 23:52:47 +00:00
{
2015-10-27 14:35:19 +00:00
EolType newFormat = ( id = = IDM_FORMAT_TODOS )
? EolType : : windows
: ( id = = IDM_FORMAT_TOUNIX ) ? EolType : : unix : EolType : : macos ;
2010-01-29 23:52:47 +00:00
2015-08-14 12:57:19 +00:00
Buffer * buf = _pEditView - > getCurrentBuffer ( ) ;
2016-04-02 14:26:27 +00:00
if ( not buf - > isReadOnly ( ) )
{
LongRunningOperation op ;
buf - > setEolFormat ( newFormat ) ;
_pEditView - > execute ( SCI_CONVERTEOLS , static_cast < int > ( buf - > getEolFormat ( ) ) ) ;
}
2010-01-29 23:52:47 +00:00
break ;
}
case IDM_FORMAT_ANSI :
2015-08-06 09:03:57 +00:00
case IDM_FORMAT_UTF_8 :
2010-01-29 23:52:47 +00:00
case IDM_FORMAT_UCS_2BE :
case IDM_FORMAT_UCS_2LE :
case IDM_FORMAT_AS_UTF_8 :
{
Buffer * buf = _pEditView - > getCurrentBuffer ( ) ;
UniMode um ;
bool shoulBeDirty = true ;
switch ( id )
{
case IDM_FORMAT_AS_UTF_8 :
shoulBeDirty = buf - > getUnicodeMode ( ) ! = uni8Bit ;
um = uniCookie ;
break ;
2015-08-06 09:03:57 +00:00
2010-01-29 23:52:47 +00:00
case IDM_FORMAT_UTF_8 :
um = uniUTF8 ;
break ;
case IDM_FORMAT_UCS_2BE :
um = uni16BE ;
break ;
case IDM_FORMAT_UCS_2LE :
um = uni16LE ;
break ;
default : // IDM_FORMAT_ANSI
shoulBeDirty = buf - > getUnicodeMode ( ) ! = uniCookie ;
um = uni8Bit ;
}
if ( buf - > getEncoding ( ) ! = - 1 )
{
if ( buf - > isDirty ( ) )
{
2012-05-28 10:25:35 +00:00
int answer = _nativeLangSpeaker . messageBox ( " SaveCurrentModifWarning " ,
2011-01-19 21:05:40 +00:00
NULL ,
TEXT ( " You should save the current modification. \r All the saved modifications can not be undone. \r \r Continue? " ) ,
TEXT ( " Save Current Modification " ) ,
MB_YESNO ) ;
2010-01-29 23:52:47 +00:00
if ( answer = = IDYES )
{
fileSave ( ) ;
_pEditView - > execute ( SCI_EMPTYUNDOBUFFER ) ;
}
else
return ;
}
if ( _pEditView - > execute ( SCI_CANUNDO ) = = TRUE )
{
2011-01-19 21:05:40 +00:00
generic_string msg , title ;
2012-05-28 10:25:35 +00:00
int answer = _nativeLangSpeaker . messageBox ( " LoseUndoAbilityWarning " ,
2011-01-19 21:05:40 +00:00
NULL ,
TEXT ( " You should save the current modification. \r All the saved modifications can not be undone. \r \r Continue? " ) ,
TEXT ( " Lose Undo Ability Waning " ) ,
MB_YESNO ) ;
2010-01-29 23:52:47 +00:00
if ( answer = = IDYES )
{
// Do nothing
}
else
return ;
}
buf - > setEncoding ( - 1 ) ;
if ( um = = uni8Bit )
_pEditView - > execute ( SCI_SETCODEPAGE , CP_ACP ) ;
else
buf - > setUnicodeMode ( um ) ;
fileReload ( ) ;
}
else
{
if ( buf - > getUnicodeMode ( ) ! = um )
{
buf - > setUnicodeMode ( um ) ;
if ( shoulBeDirty )
buf - > setDirty ( true ) ;
}
}
break ;
}
case IDM_FORMAT_WIN_1250 :
case IDM_FORMAT_WIN_1251 :
case IDM_FORMAT_WIN_1252 :
case IDM_FORMAT_WIN_1253 :
case IDM_FORMAT_WIN_1254 :
case IDM_FORMAT_WIN_1255 :
case IDM_FORMAT_WIN_1256 :
case IDM_FORMAT_WIN_1257 :
case IDM_FORMAT_WIN_1258 :
case IDM_FORMAT_ISO_8859_1 :
case IDM_FORMAT_ISO_8859_2 :
case IDM_FORMAT_ISO_8859_3 :
case IDM_FORMAT_ISO_8859_4 :
case IDM_FORMAT_ISO_8859_5 :
case IDM_FORMAT_ISO_8859_6 :
case IDM_FORMAT_ISO_8859_7 :
case IDM_FORMAT_ISO_8859_8 :
case IDM_FORMAT_ISO_8859_9 :
case IDM_FORMAT_ISO_8859_10 :
case IDM_FORMAT_ISO_8859_11 :
case IDM_FORMAT_ISO_8859_13 :
case IDM_FORMAT_ISO_8859_14 :
case IDM_FORMAT_ISO_8859_15 :
case IDM_FORMAT_ISO_8859_16 :
case IDM_FORMAT_DOS_437 :
case IDM_FORMAT_DOS_720 :
case IDM_FORMAT_DOS_737 :
case IDM_FORMAT_DOS_775 :
case IDM_FORMAT_DOS_850 :
case IDM_FORMAT_DOS_852 :
case IDM_FORMAT_DOS_855 :
case IDM_FORMAT_DOS_857 :
case IDM_FORMAT_DOS_858 :
case IDM_FORMAT_DOS_860 :
case IDM_FORMAT_DOS_861 :
case IDM_FORMAT_DOS_862 :
case IDM_FORMAT_DOS_863 :
case IDM_FORMAT_DOS_865 :
case IDM_FORMAT_DOS_866 :
case IDM_FORMAT_DOS_869 :
case IDM_FORMAT_BIG5 :
case IDM_FORMAT_GB2312 :
case IDM_FORMAT_SHIFT_JIS :
case IDM_FORMAT_KOREAN_WIN :
case IDM_FORMAT_EUC_KR :
case IDM_FORMAT_TIS_620 :
2015-08-06 09:03:57 +00:00
case IDM_FORMAT_MAC_CYRILLIC :
2010-01-29 23:52:47 +00:00
case IDM_FORMAT_KOI8U_CYRILLIC :
case IDM_FORMAT_KOI8R_CYRILLIC :
{
int index = id - IDM_FORMAT_ENCODE ;
EncodingMapper * em = EncodingMapper : : getInstance ( ) ;
int encoding = em - > getEncodingFromIndex ( index ) ;
if ( encoding = = - 1 )
{
//printStr(TEXT("Encoding problem. Command is not added in encoding_table?"));
return ;
}
2015-08-14 11:32:38 +00:00
Buffer * buf = _pEditView - > getCurrentBuffer ( ) ;
2010-01-29 23:52:47 +00:00
if ( buf - > isDirty ( ) )
{
2011-01-19 21:05:40 +00:00
generic_string warning , title ;
2012-05-28 10:25:35 +00:00
int answer = _nativeLangSpeaker . messageBox ( " SaveCurrentModifWarning " ,
2011-01-19 21:05:40 +00:00
NULL ,
TEXT ( " You should save the current modification. \r All the saved modifications can not be undone. \r \r Continue? " ) ,
TEXT ( " Save Current Modification " ) ,
MB_YESNO ) ;
2010-01-29 23:52:47 +00:00
if ( answer = = IDYES )
{
fileSave ( ) ;
_pEditView - > execute ( SCI_EMPTYUNDOBUFFER ) ;
}
else
return ;
}
if ( _pEditView - > execute ( SCI_CANUNDO ) = = TRUE )
{
2011-01-19 21:05:40 +00:00
generic_string msg , title ;
2012-05-28 10:25:35 +00:00
int answer = _nativeLangSpeaker . messageBox ( " LoseUndoAbilityWarning " ,
2011-01-19 21:05:40 +00:00
NULL ,
TEXT ( " You should save the current modification. \r All the saved modifications can not be undone. \r \r Continue? " ) ,
TEXT ( " Lose Undo Ability Waning " ) ,
MB_YESNO ) ;
2015-08-06 09:03:57 +00:00
2015-08-14 11:32:38 +00:00
if ( answer ! = IDYES )
2010-01-29 23:52:47 +00:00
return ;
}
2015-08-14 11:32:38 +00:00
if ( not buf - > isDirty ( ) )
2010-01-29 23:52:47 +00:00
{
buf - > setEncoding ( encoding ) ;
buf - > setUnicodeMode ( uniCookie ) ;
fileReload ( ) ;
}
break ;
}
case IDM_FORMAT_CONV2_ANSI :
case IDM_FORMAT_CONV2_AS_UTF_8 :
case IDM_FORMAT_CONV2_UTF_8 :
2015-08-06 09:03:57 +00:00
case IDM_FORMAT_CONV2_UCS_2BE :
2010-01-29 23:52:47 +00:00
case IDM_FORMAT_CONV2_UCS_2LE :
{
int idEncoding = - 1 ;
Buffer * buf = _pEditView - > getCurrentBuffer ( ) ;
UniMode um = buf - > getUnicodeMode ( ) ;
int encoding = buf - > getEncoding ( ) ;
switch ( id )
{
case IDM_FORMAT_CONV2_ANSI :
{
if ( encoding ! = - 1 )
{
// do nothing
return ;
}
else
{
if ( um = = uni8Bit )
return ;
2015-08-06 09:03:57 +00:00
2010-01-29 23:52:47 +00:00
// set scintilla to ANSI
idEncoding = IDM_FORMAT_ANSI ;
}
break ;
}
case IDM_FORMAT_CONV2_AS_UTF_8 :
{
if ( encoding ! = - 1 )
{
buf - > setDirty ( true ) ;
buf - > setUnicodeMode ( uniCookie ) ;
buf - > setEncoding ( - 1 ) ;
return ;
}
idEncoding = IDM_FORMAT_AS_UTF_8 ;
if ( um = = uniCookie )
return ;
if ( um ! = uni8Bit )
{
2010-03-26 00:22:14 +00:00
: : SendMessage ( _pPublicInterface - > getHSelf ( ) , WM_COMMAND , idEncoding , 0 ) ;
2010-01-29 23:52:47 +00:00
_pEditView - > execute ( SCI_EMPTYUNDOBUFFER ) ;
return ;
}
break ;
}
case IDM_FORMAT_CONV2_UTF_8 :
{
if ( encoding ! = - 1 )
{
buf - > setDirty ( true ) ;
buf - > setUnicodeMode ( uniUTF8 ) ;
buf - > setEncoding ( - 1 ) ;
return ;
}
idEncoding = IDM_FORMAT_UTF_8 ;
if ( um = = uniUTF8 )
return ;
if ( um ! = uni8Bit )
{
2010-03-26 00:22:14 +00:00
: : SendMessage ( _pPublicInterface - > getHSelf ( ) , WM_COMMAND , idEncoding , 0 ) ;
2010-01-29 23:52:47 +00:00
_pEditView - > execute ( SCI_EMPTYUNDOBUFFER ) ;
return ;
}
break ;
}
2015-08-06 09:03:57 +00:00
2010-01-29 23:52:47 +00:00
case IDM_FORMAT_CONV2_UCS_2BE :
{
if ( encoding ! = - 1 )
{
buf - > setDirty ( true ) ;
buf - > setUnicodeMode ( uni16BE ) ;
buf - > setEncoding ( - 1 ) ;
return ;
}
idEncoding = IDM_FORMAT_UCS_2BE ;
if ( um = = uni16BE )
return ;
if ( um ! = uni8Bit )
{
2010-03-26 00:22:14 +00:00
: : SendMessage ( _pPublicInterface - > getHSelf ( ) , WM_COMMAND , idEncoding , 0 ) ;
2010-01-29 23:52:47 +00:00
_pEditView - > execute ( SCI_EMPTYUNDOBUFFER ) ;
return ;
}
break ;
}
2015-08-06 09:03:57 +00:00
2010-01-29 23:52:47 +00:00
case IDM_FORMAT_CONV2_UCS_2LE :
{
if ( encoding ! = - 1 )
{
buf - > setDirty ( true ) ;
buf - > setUnicodeMode ( uni16LE ) ;
buf - > setEncoding ( - 1 ) ;
return ;
}
idEncoding = IDM_FORMAT_UCS_2LE ;
if ( um = = uni16LE )
return ;
if ( um ! = uni8Bit )
{
2010-03-26 00:22:14 +00:00
: : SendMessage ( _pPublicInterface - > getHSelf ( ) , WM_COMMAND , idEncoding , 0 ) ;
2010-01-29 23:52:47 +00:00
_pEditView - > execute ( SCI_EMPTYUNDOBUFFER ) ;
return ;
}
break ;
}
}
if ( idEncoding ! = - 1 )
{
// Save the current clipboard content
2010-03-26 00:22:14 +00:00
: : OpenClipboard ( _pPublicInterface - > getHSelf ( ) ) ;
2010-01-29 23:52:47 +00:00
HANDLE clipboardData = : : GetClipboardData ( CF_TEXT ) ;
2016-06-05 18:29:21 +00:00
int len = static_cast < int32_t > ( : : GlobalSize ( clipboardData ) ) ;
2010-01-29 23:52:47 +00:00
LPVOID clipboardDataPtr = : : GlobalLock ( clipboardData ) ;
HANDLE allocClipboardData = : : GlobalAlloc ( GMEM_MOVEABLE , len ) ;
LPVOID clipboardData2 = : : GlobalLock ( allocClipboardData ) ;
: : memcpy ( clipboardData2 , clipboardDataPtr , len ) ;
2015-08-06 09:03:57 +00:00
: : GlobalUnlock ( clipboardData ) ;
: : GlobalUnlock ( allocClipboardData ) ;
2010-01-29 23:52:47 +00:00
: : CloseClipboard ( ) ;
_pEditView - > saveCurrentPos ( ) ;
// Cut all text
int docLen = _pEditView - > getCurrentDocLen ( ) ;
_pEditView - > execute ( SCI_COPYRANGE , 0 , docLen ) ;
_pEditView - > execute ( SCI_CLEARALL ) ;
// Change to the proper buffer, save buffer status
2015-08-06 09:03:57 +00:00
2010-03-26 00:22:14 +00:00
: : SendMessage ( _pPublicInterface - > getHSelf ( ) , WM_COMMAND , idEncoding , 0 ) ;
2010-01-29 23:52:47 +00:00
// Paste the texte, restore buffer status
_pEditView - > execute ( SCI_PASTE ) ;
_pEditView - > restoreCurrentPos ( ) ;
// Restore the previous clipboard data
2010-03-26 00:22:14 +00:00
: : OpenClipboard ( _pPublicInterface - > getHSelf ( ) ) ;
2015-08-06 09:03:57 +00:00
: : EmptyClipboard ( ) ;
2010-01-29 23:52:47 +00:00
: : SetClipboardData ( CF_TEXT , clipboardData2 ) ;
: : CloseClipboard ( ) ;
//Do not free anything, EmptyClipboard does that
_pEditView - > execute ( SCI_EMPTYUNDOBUFFER ) ;
}
break ;
}
case IDM_SETTING_IMPORTPLUGIN :
{
// get plugin source path
TCHAR * extFilterName = TEXT ( " Notepad++ plugin " ) ;
TCHAR * extFilter = TEXT ( " .dll " ) ;
TCHAR * destDir = TEXT ( " plugins " ) ;
vector < generic_string > copiedFiles = addNppComponents ( destDir , extFilterName , extFilter ) ;
// load plugin
vector < generic_string > dll2Remove ;
2013-07-08 00:12:50 +00:00
for ( size_t i = 0 , len = copiedFiles . size ( ) ; i < len ; + + i )
2010-01-29 23:52:47 +00:00
{
int index = _pluginsManager . loadPlugin ( copiedFiles [ i ] . c_str ( ) , dll2Remove ) ;
if ( _pluginsManager . getMenuHandle ( ) )
_pluginsManager . addInMenuFromPMIndex ( index ) ;
}
if ( ! _pluginsManager . getMenuHandle ( ) )
_pluginsManager . setMenu ( _mainMenuHandle , NULL ) ;
2010-03-26 00:22:14 +00:00
: : DrawMenuBar ( _pPublicInterface - > getHSelf ( ) ) ;
2010-01-29 23:52:47 +00:00
break ;
}
case IDM_SETTING_IMPORTSTYLETHEMS :
{
// get plugin source path
TCHAR * extFilterName = TEXT ( " Notepad++ style theme " ) ;
TCHAR * extFilter = TEXT ( " .xml " ) ;
TCHAR * destDir = TEXT ( " themes " ) ;
// load styler
NppParameters * pNppParams = NppParameters : : getInstance ( ) ;
ThemeSwitcher & themeSwitcher = pNppParams - > getThemeSwitcher ( ) ;
vector < generic_string > copiedFiles = addNppComponents ( destDir , extFilterName , extFilter ) ;
2013-07-08 00:12:50 +00:00
for ( size_t i = 0 , len = copiedFiles . size ( ) ; i < len ; + + i )
2010-01-29 23:52:47 +00:00
{
generic_string themeName ( themeSwitcher . getThemeFromXmlFileName ( copiedFiles [ i ] . c_str ( ) ) ) ;
2015-08-06 09:03:57 +00:00
if ( ! themeSwitcher . themeNameExists ( themeName . c_str ( ) ) )
2010-01-29 23:52:47 +00:00
{
themeSwitcher . addThemeFromXml ( copiedFiles [ i ] . c_str ( ) ) ;
if ( _configStyleDlg . isCreated ( ) )
{
_configStyleDlg . addLastThemeEntry ( ) ;
}
}
}
break ;
}
case IDM_SETTING_SHORTCUT_MAPPER :
2010-08-14 00:11:01 +00:00
case IDM_SETTING_SHORTCUT_MAPPER_MACRO :
case IDM_SETTING_SHORTCUT_MAPPER_RUN :
2010-01-29 23:52:47 +00:00
{
2010-08-14 00:11:01 +00:00
GridState st = id = = IDM_SETTING_SHORTCUT_MAPPER_MACRO ? STATE_MACRO : id = = IDM_SETTING_SHORTCUT_MAPPER_RUN ? STATE_USER : STATE_MENU ;
2010-01-29 23:52:47 +00:00
ShortcutMapper shortcutMapper ;
2010-08-14 00:11:01 +00:00
shortcutMapper . init ( _pPublicInterface - > getHinst ( ) , _pPublicInterface - > getHSelf ( ) , st ) ;
2010-03-05 00:15:06 +00:00
_nativeLangSpeaker . changeShortcutmapperLang ( & shortcutMapper ) ;
shortcutMapper . doDialog ( _nativeLangSpeaker . isRTL ( ) ) ;
2010-01-29 23:52:47 +00:00
shortcutMapper . destroy ( ) ;
break ;
}
case IDM_SETTING_PREFERECE :
{
bool isFirstTime = ! _preference . isCreated ( ) ;
2010-03-05 00:15:06 +00:00
_preference . doDialog ( _nativeLangSpeaker . isRTL ( ) ) ;
2015-08-06 09:03:57 +00:00
2010-01-29 23:52:47 +00:00
if ( isFirstTime )
{
2010-03-05 00:15:06 +00:00
_nativeLangSpeaker . changePrefereceDlgLang ( _preference ) ;
2010-01-29 23:52:47 +00:00
}
break ;
}
2010-10-22 21:14:04 +00:00
case IDM_SETTING_EDITCONTEXTMENU :
{
2010-10-24 23:49:07 +00:00
//if (contion)
{
2011-01-19 21:05:40 +00:00
generic_string warning , title ;
2012-05-28 10:25:35 +00:00
_nativeLangSpeaker . messageBox ( " ContextMenuXmlEditWarning " ,
2011-01-19 21:05:40 +00:00
_pPublicInterface - > getHSelf ( ) ,
2015-06-14 15:49:27 +00:00
TEXT ( " Editing contextMenu.xml allows you to modify your Notepad++ popup context menu on edit zone. \r You have to restart your Notepad++ to take effect after modifying contextMenu.xml. " ) ,
2011-01-19 21:05:40 +00:00
TEXT ( " Editing contextMenu " ) ,
MB_OK | MB_APPLMODAL ) ;
2010-10-24 23:49:07 +00:00
}
2010-10-22 21:14:04 +00:00
NppParameters * pNppParams = NppParameters : : getInstance ( ) ;
2015-08-06 11:49:14 +00:00
BufferID bufID = doOpen ( ( pNppParams - > getContextMenuPath ( ) ) ) ;
2010-10-24 23:49:07 +00:00
switchToFile ( bufID ) ;
2010-10-22 21:14:04 +00:00
break ;
}
2010-01-29 23:52:47 +00:00
case IDM_VIEW_GOTO_ANOTHER_VIEW :
docGotoAnotherEditView ( TransferMove ) ;
checkSyncState ( ) ;
break ;
case IDM_VIEW_CLONE_TO_ANOTHER_VIEW :
docGotoAnotherEditView ( TransferClone ) ;
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_OTHER_VIEW :
{
int view_to_focus ;
HWND wnd = GetFocus ( ) ;
if ( _pEditView - > getHSelf ( ) = = wnd )
{
view_to_focus = otherView ( ) ;
if ( ! viewVisible ( view_to_focus ) ) view_to_focus = _activeView ;
}
else
{
view_to_focus = currentView ( ) ;
}
switchEditViewTo ( view_to_focus ) ;
break ;
}
2015-12-06 22:20:14 +00:00
case IDM_DEBUGINFO :
{
_debugInfoDlg . doDialog ( ) ;
break ;
}
2010-01-29 23:52:47 +00:00
case IDM_ABOUT :
{
2012-01-01 19:29:31 +00:00
bool doAboutDlg = false ;
const int maxSelLen = 32 ;
2016-06-05 18:29:21 +00:00
auto textLen = _pEditView - > execute ( SCI_GETSELTEXT , 0 , 0 ) - 1 ;
2012-01-01 19:29:31 +00:00
if ( ! textLen )
doAboutDlg = true ;
if ( textLen > maxSelLen )
doAboutDlg = true ;
if ( ! doAboutDlg )
2010-01-29 23:52:47 +00:00
{
2012-01-01 19:29:31 +00:00
char author [ maxSelLen + 1 ] = " " ;
_pEditView - > getSelectedText ( author , maxSelLen + 1 ) ;
int iQuote = getQuoteIndexFrom ( author ) ;
2015-08-06 09:03:57 +00:00
2012-01-01 19:29:31 +00:00
if ( iQuote = = - 1 )
2010-01-29 23:52:47 +00:00
{
2012-01-01 19:29:31 +00:00
doAboutDlg = true ;
}
else if ( iQuote = = - 2 )
{
2014-12-01 22:39:08 +00:00
generic_string noEasterEggsPath ( ( NppParameters : : getInstance ( ) ) - > getNppPath ( ) ) ;
noEasterEggsPath . append ( TEXT ( " \\ noEasterEggs.xml " ) ) ;
if ( ! : : PathFileExists ( noEasterEggsPath . c_str ( ) ) )
showAllQuotes ( ) ;
2012-01-01 19:29:31 +00:00
return ;
}
if ( iQuote ! = - 1 )
{
2014-12-01 22:39:08 +00:00
generic_string noEasterEggsPath ( ( NppParameters : : getInstance ( ) ) - > getNppPath ( ) ) ;
noEasterEggsPath . append ( TEXT ( " \\ noEasterEggs.xml " ) ) ;
if ( ! : : PathFileExists ( noEasterEggsPath . c_str ( ) ) )
showQuoteFromIndex ( iQuote ) ;
2012-01-01 19:29:31 +00:00
return ;
2015-08-06 09:03:57 +00:00
}
2012-01-01 19:29:31 +00:00
}
if ( doAboutDlg )
{
bool isFirstTime = ! _aboutDlg . isCreated ( ) ;
_aboutDlg . doDialog ( ) ;
if ( isFirstTime & & _nativeLangSpeaker . getNativeLangA ( ) )
{
if ( _nativeLangSpeaker . getLangEncoding ( ) = = NPP_CP_BIG5 )
{
char * authorName = " <EFBFBD> J<EFBFBD> <EFBFBD> <EFBFBD> ^" ;
HWND hItem = : : GetDlgItem ( _aboutDlg . getHSelf ( ) , IDC_AUTHOR_NAME ) ;
2013-12-07 01:43:35 +00:00
2012-01-01 19:29:31 +00:00
WcharMbcsConvertor * wmc = WcharMbcsConvertor : : getInstance ( ) ;
const wchar_t * authorNameW = wmc - > char2wchar ( authorName , NPP_CP_BIG5 ) ;
: : SetWindowText ( hItem , authorNameW ) ;
}
2010-01-29 23:52:47 +00:00
}
}
break ;
}
case IDM_HELP :
{
generic_string tmp ( ( NppParameters : : getInstance ( ) ) - > getNppPath ( ) ) ;
generic_string nppHelpPath = tmp . c_str ( ) ;
2011-03-31 00:14:18 +00:00
nppHelpPath + = TEXT ( " \\ user.manual \\ documentation \\ notepad-online-document.html " ) ;
2010-01-29 23:52:47 +00:00
if ( : : PathFileExists ( nppHelpPath . c_str ( ) ) )
: : ShellExecute ( NULL , TEXT ( " open " ) , nppHelpPath . c_str ( ) , NULL , NULL , SW_SHOWNORMAL ) ;
else
{
generic_string msg = nppHelpPath ;
2011-01-19 21:05:40 +00:00
generic_string warning , title ;
2012-05-28 10:25:35 +00:00
if ( ! _nativeLangSpeaker . getMsgBoxLang ( " NppHelpAbsentWarning " , title , warning ) )
2011-01-19 21:05:40 +00:00
{
title = TEXT ( " File does not exist " ) ;
warning = TEXT ( " \r doesn't exist. Please download it on Notepad++ site. " ) ;
}
msg + = warning ;
: : MessageBox ( _pPublicInterface - > getHSelf ( ) , msg . c_str ( ) , title . c_str ( ) , MB_OK ) ;
2010-01-29 23:52:47 +00:00
}
}
break ;
case IDM_HOMESWEETHOME :
{
2015-05-22 19:11:08 +00:00
: : ShellExecute ( NULL , TEXT ( " open " ) , TEXT ( " https://notepad-plus-plus.org/ " ) , NULL , NULL , SW_SHOWNORMAL ) ;
2010-01-29 23:52:47 +00:00
break ;
}
case IDM_PROJECTPAGE :
{
2015-05-22 19:11:08 +00:00
: : ShellExecute ( NULL , TEXT ( " open " ) , TEXT ( " https://github.com/donho/notepad-plus-plus/ " ) , NULL , NULL , SW_SHOWNORMAL ) ;
2010-01-29 23:52:47 +00:00
break ;
}
case IDM_ONLINEHELP :
{
2015-05-23 12:14:33 +00:00
: : ShellExecute ( NULL , TEXT ( " open " ) , TEXT ( " http://docs.notepad-plus-plus.org/ " ) , NULL , NULL , SW_SHOWNORMAL ) ;
2010-01-29 23:52:47 +00:00
break ;
}
2014-03-05 22:09:57 +00:00
case IDM_CMDLINEARGUMENTS :
{
: : MessageBox ( NULL , COMMAND_ARG_HELP , TEXT ( " Notepad++ Command Argument Help " ) , MB_OK ) ;
break ;
}
2015-08-15 14:28:43 +00:00
2010-01-29 23:52:47 +00:00
case IDM_FORUM :
{
2015-08-15 14:28:43 +00:00
: : ShellExecute ( NULL , TEXT ( " open " ) , TEXT ( " https://notepad-plus-plus.org/community/ " ) , NULL , NULL , SW_SHOWNORMAL ) ;
2015-06-17 23:34:34 +00:00
break ;
}
2015-08-15 14:28:43 +00:00
2015-06-17 23:34:34 +00:00
case IDM_ONLINESUPPORT :
{
: : ShellExecute ( NULL , TEXT ( " open " ) , TEXT ( " https://gitter.im/notepad-plus-plus/notepad-plus-plus " ) , NULL , NULL , SW_SHOWNORMAL ) ;
2010-01-29 23:52:47 +00:00
break ;
}
case IDM_PLUGINSHOME :
{
2015-05-23 12:14:33 +00:00
: : ShellExecute ( NULL , TEXT ( " open " ) , TEXT ( " http://docs.notepad-plus-plus.org/index.php/Plugin_Central " ) , NULL , NULL , SW_SHOWNORMAL ) ;
2010-01-29 23:52:47 +00:00
break ;
}
case IDM_UPDATE_NPP :
2013-02-17 18:02:14 +00:00
case IDM_CONFUPDATERPROXY :
2010-01-29 23:52:47 +00:00
{
2015-05-22 19:11:08 +00:00
// wingup doesn't work with the obsolet security layer (API) under xp since downloadings are secured with SSL on notepad_plus_plus.org
winVer ver = NppParameters : : getInstance ( ) - > getWinVersion ( ) ;
if ( ver < = WV_XP )
{
2015-05-23 12:14:33 +00:00
long res = : : MessageBox ( NULL , TEXT ( " Notepad++ updater is not compatible with XP due to the obsolet security layer under XP. \r Do you want to go to Notepad++ page to download the latest version? " ) , TEXT ( " Notepad++ Updater " ) , MB_YESNO ) ;
2015-05-22 19:11:08 +00:00
if ( res = = IDYES )
{
: : ShellExecute ( NULL , TEXT ( " open " ) , TEXT ( " https://notepad-plus-plus.org/download/ " ) , NULL , NULL , SW_SHOWNORMAL ) ;
}
}
else
{
generic_string updaterDir = ( NppParameters : : getInstance ( ) ) - > getNppPath ( ) ;
PathAppend ( updaterDir , TEXT ( " updater " ) ) ;
2010-01-29 23:52:47 +00:00
2015-05-22 19:11:08 +00:00
generic_string updaterFullPath = updaterDir ;
PathAppend ( updaterFullPath , TEXT ( " gup.exe " ) ) ;
2013-02-17 18:02:14 +00:00
2015-05-22 19:11:08 +00:00
generic_string param = TEXT ( " -verbose -v " ) ;
param + = VERSION_VALUE ;
2013-02-17 18:02:14 +00:00
2015-05-22 19:11:08 +00:00
if ( id = = IDM_CONFUPDATERPROXY )
param = TEXT ( " -options " ) ;
Process updater ( updaterFullPath . c_str ( ) , param . c_str ( ) , updaterDir . c_str ( ) ) ;
updater . run ( ) ;
}
2010-01-29 23:52:47 +00:00
break ;
}
case IDM_EDIT_AUTOCOMPLETE :
showAutoComp ( ) ;
break ;
case IDM_EDIT_AUTOCOMPLETE_CURRENTFILE :
autoCompFromCurrentFile ( ) ;
break ;
2013-10-10 23:05:50 +00:00
case IDM_EDIT_AUTOCOMPLETE_PATH :
showPathCompletion ( ) ;
break ;
2010-01-29 23:52:47 +00:00
case IDM_EDIT_FUNCCALLTIP :
showFunctionComp ( ) ;
break ;
case IDM_LANGSTYLE_CONFIG_DLG :
{
bool isFirstTime = ! _configStyleDlg . isCreated ( ) ;
2010-03-05 00:15:06 +00:00
_configStyleDlg . doDialog ( _nativeLangSpeaker . isRTL ( ) ) ;
2010-01-29 23:52:47 +00:00
if ( isFirstTime )
2010-03-05 00:15:06 +00:00
_nativeLangSpeaker . changeConfigLang ( _configStyleDlg . getHSelf ( ) ) ;
2010-01-29 23:52:47 +00:00
break ;
}
case IDM_LANG_C :
case IDM_LANG_CPP :
case IDM_LANG_JAVA :
case IDM_LANG_CS :
case IDM_LANG_HTML :
case IDM_LANG_XML :
case IDM_LANG_JS :
2015-09-19 15:18:20 +00:00
case IDM_LANG_JSON :
2010-01-29 23:52:47 +00:00
case IDM_LANG_PHP :
case IDM_LANG_ASP :
case IDM_LANG_CSS :
case IDM_LANG_LUA :
case IDM_LANG_PERL :
case IDM_LANG_PYTHON :
case IDM_LANG_PASCAL :
case IDM_LANG_BATCH :
case IDM_LANG_OBJC :
case IDM_LANG_VB :
case IDM_LANG_SQL :
case IDM_LANG_ASCII :
case IDM_LANG_TEXT :
case IDM_LANG_RC :
case IDM_LANG_MAKEFILE :
case IDM_LANG_INI :
case IDM_LANG_TEX :
case IDM_LANG_FORTRAN :
2015-08-08 16:00:00 +00:00
case IDM_LANG_FORTRAN_77 :
2010-02-04 01:22:41 +00:00
case IDM_LANG_BASH :
2010-01-29 23:52:47 +00:00
case IDM_LANG_FLASH :
case IDM_LANG_NSIS :
case IDM_LANG_TCL :
case IDM_LANG_LISP :
case IDM_LANG_SCHEME :
case IDM_LANG_ASM :
case IDM_LANG_DIFF :
case IDM_LANG_PROPS :
case IDM_LANG_PS :
case IDM_LANG_RUBY :
case IDM_LANG_SMALLTALK :
case IDM_LANG_VHDL :
case IDM_LANG_KIX :
case IDM_LANG_CAML :
case IDM_LANG_ADA :
case IDM_LANG_VERILOG :
case IDM_LANG_MATLAB :
case IDM_LANG_HASKELL :
case IDM_LANG_AU3 :
case IDM_LANG_INNO :
case IDM_LANG_CMAKE :
case IDM_LANG_YAML :
case IDM_LANG_COBOL :
case IDM_LANG_D :
case IDM_LANG_GUI4CLI :
case IDM_LANG_POWERSHELL :
case IDM_LANG_R :
case IDM_LANG_JSP :
2013-09-14 19:35:34 +00:00
case IDM_LANG_COFFEESCRIPT :
2010-01-29 23:52:47 +00:00
case IDM_LANG_USER :
{
setLanguage ( menuID2LangType ( id ) ) ;
2014-07-27 14:19:19 +00:00
if ( _pDocMap )
{
_pDocMap - > setSyntaxHiliting ( ) ;
}
2010-01-29 23:52:47 +00:00
}
break ;
case IDC_PREV_DOC :
case IDC_NEXT_DOC :
{
2016-06-05 18:29:21 +00:00
size_t nbDoc = viewVisible ( MAIN_VIEW ) ? _mainDocTab . nbItem ( ) : 0 ;
2010-01-29 23:52:47 +00:00
nbDoc + = viewVisible ( SUB_VIEW ) ? _subDocTab . nbItem ( ) : 0 ;
2015-08-06 09:03:57 +00:00
2010-01-29 23:52:47 +00:00
bool doTaskList = ( ( NppParameters : : getInstance ( ) ) - > getNppGUI ( ) ) . _doTaskList ;
if ( nbDoc > 1 )
{
bool direction = ( id = = IDC_NEXT_DOC ) ? dirDown : dirUp ;
if ( ! doTaskList )
{
activateNextDoc ( direction ) ;
}
else
2015-08-06 09:03:57 +00:00
{
2010-01-29 23:52:47 +00:00
TaskListDlg tld ;
HIMAGELIST hImgLst = _docTabIconList . getHandle ( ) ;
2010-03-26 00:22:14 +00:00
tld . init ( _pPublicInterface - > getHinst ( ) , _pPublicInterface - > getHSelf ( ) , hImgLst , direction ) ;
2010-01-29 23:52:47 +00:00
tld . doDialog ( ) ;
}
}
_linkTriggered = true ;
}
break ;
2015-04-07 00:10:03 +00:00
case IDM_OPEN_ALL_RECENT_FILE :
{
2010-01-29 23:52:47 +00:00
BufferID lastOne = BUFFER_INVALID ;
int size = _lastRecentFileList . getSize ( ) ;
for ( int i = size - 1 ; i > = 0 ; i - - )
{
2015-08-06 11:49:14 +00:00
BufferID test = doOpen ( _lastRecentFileList . getIndex ( i ) ) ;
2010-01-29 23:52:47 +00:00
if ( test ! = BUFFER_INVALID )
lastOne = test ;
}
2015-04-07 00:10:03 +00:00
if ( lastOne ! = BUFFER_INVALID )
{
2010-01-29 23:52:47 +00:00
switchToFile ( lastOne ) ;
}
2015-04-07 00:10:03 +00:00
break ;
}
2010-01-29 23:52:47 +00:00
case IDM_CLEAN_RECENT_FILE_LIST :
_lastRecentFileList . clear ( ) ;
break ;
case IDM_EDIT_RTL :
case IDM_EDIT_LTR :
{
2014-12-07 16:43:31 +00:00
_pEditView - > changeTextDirection ( id = = IDM_EDIT_RTL ) ;
2014-12-09 23:16:48 +00:00
// Wrap then !wrap to fix problem of mirror characters
bool isWraped = _pEditView - > isWrap ( ) ;
2014-12-07 01:23:05 +00:00
_pEditView - > wrap ( ! isWraped ) ;
_pEditView - > wrap ( isWraped ) ;
2014-12-07 16:43:31 +00:00
if ( _pDocMap )
{
_pDocMap - > changeTextDirection ( id = = IDM_EDIT_RTL ) ;
}
2010-01-29 23:52:47 +00:00
}
break ;
case IDM_WINDOW_WINDOWS :
{
WindowsDlg _windowsDlg ;
2010-03-26 00:22:14 +00:00
_windowsDlg . init ( _pPublicInterface - > getHinst ( ) , _pPublicInterface - > getHSelf ( ) , _pDocTab ) ;
2015-08-06 09:03:57 +00:00
2010-03-05 00:15:06 +00:00
const TiXmlNodeA * nativeLangA = _nativeLangSpeaker . getNativeLangA ( ) ;
2010-01-29 23:52:47 +00:00
TiXmlNodeA * dlgNode = NULL ;
2010-03-05 00:15:06 +00:00
if ( nativeLangA )
2010-01-29 23:52:47 +00:00
{
2010-03-05 00:15:06 +00:00
dlgNode = nativeLangA - > FirstChild ( " Dialog " ) ;
2010-01-29 23:52:47 +00:00
if ( dlgNode )
2010-03-05 00:15:06 +00:00
dlgNode = _nativeLangSpeaker . searchDlgNode ( dlgNode , " Window " ) ;
2010-01-29 23:52:47 +00:00
}
_windowsDlg . doDialog ( dlgNode ) ;
}
break ;
case IDM_SYSTRAYPOPUP_NEWDOC :
{
NppGUI & nppGUI = ( NppGUI & ) ( ( NppParameters : : getInstance ( ) ) - > getNppGUI ( ) ) ;
2010-03-26 00:22:14 +00:00
: : ShowWindow ( _pPublicInterface - > getHSelf ( ) , nppGUI . _isMaximized ? SW_MAXIMIZE : SW_SHOW ) ;
2010-01-29 23:52:47 +00:00
fileNew ( ) ;
}
break ;
case IDM_SYSTRAYPOPUP_ACTIVATE :
{
NppGUI & nppGUI = ( NppGUI & ) ( ( NppParameters : : getInstance ( ) ) - > getNppGUI ( ) ) ;
2010-03-26 00:22:14 +00:00
: : ShowWindow ( _pPublicInterface - > getHSelf ( ) , nppGUI . _isMaximized ? SW_MAXIMIZE : SW_SHOW ) ;
2010-01-29 23:52:47 +00:00
}
break ;
case IDM_SYSTRAYPOPUP_NEW_AND_PASTE :
{
NppGUI & nppGUI = ( NppGUI & ) ( ( NppParameters : : getInstance ( ) ) - > getNppGUI ( ) ) ;
2010-03-26 00:22:14 +00:00
: : ShowWindow ( _pPublicInterface - > getHSelf ( ) , nppGUI . _isMaximized ? SW_MAXIMIZE : SW_SHOW ) ;
2010-01-29 23:52:47 +00:00
BufferID bufferID = _pEditView - > getCurrentBufferID ( ) ;
Buffer * buf = MainFileManager - > getBufferByID ( bufferID ) ;
if ( ! buf - > isUntitled ( ) | | buf - > docLength ( ) ! = 0 )
{
fileNew ( ) ;
2015-08-06 09:03:57 +00:00
}
2010-01-29 23:52:47 +00:00
command ( IDM_EDIT_PASTE ) ;
}
break ;
2015-08-06 09:03:57 +00:00
2010-01-29 23:52:47 +00:00
case IDM_SYSTRAYPOPUP_OPENFILE :
{
NppGUI & nppGUI = ( NppGUI & ) ( ( NppParameters : : getInstance ( ) ) - > getNppGUI ( ) ) ;
2010-03-26 00:22:14 +00:00
: : ShowWindow ( _pPublicInterface - > getHSelf ( ) , nppGUI . _isMaximized ? SW_MAXIMIZE : SW_SHOW ) ;
2010-01-29 23:52:47 +00:00
fileOpen ( ) ;
}
break ;
case IDM_SYSTRAYPOPUP_CLOSE :
{
2010-03-26 00:22:14 +00:00
_pPublicInterface - > setIsPrelaunch ( false ) ;
2010-01-29 23:52:47 +00:00
_pTrayIco - > doTrayIcon ( REMOVE ) ;
2010-03-26 00:22:14 +00:00
if ( ! : : IsWindowVisible ( _pPublicInterface - > getHSelf ( ) ) )
: : SendMessage ( _pPublicInterface - > getHSelf ( ) , WM_CLOSE , 0 , 0 ) ;
2010-01-29 23:52:47 +00:00
}
break ;
2015-04-07 00:10:03 +00:00
case IDM_FILE_RESTORELASTCLOSEDFILE :
{
generic_string lastOpenedFullPath = _lastRecentFileList . getFirstItem ( ) ;
2015-08-06 11:49:14 +00:00
if ( not lastOpenedFullPath . empty ( ) )
2015-04-07 00:10:03 +00:00
{
2015-08-06 11:49:14 +00:00
BufferID lastOpened = doOpen ( lastOpenedFullPath ) ;
2015-04-07 00:10:03 +00:00
if ( lastOpened ! = BUFFER_INVALID )
switchToFile ( lastOpened ) ;
}
}
break ;
2015-07-25 15:25:10 +00:00
case IDM_VIEW_LINENUMBER :
case IDM_VIEW_SYMBOLMARGIN :
case IDM_VIEW_DOCCHANGEMARGIN :
{
int margin ;
if ( id = = IDM_VIEW_LINENUMBER )
margin = ScintillaEditView : : _SC_MARGE_LINENUMBER ;
else //if (id == IDM_VIEW_SYMBOLMARGIN)
margin = ScintillaEditView : : _SC_MARGE_SYBOLE ;
if ( _mainEditView . hasMarginShowed ( margin ) )
{
_mainEditView . showMargin ( margin , false ) ;
_subEditView . showMargin ( margin , false ) ;
}
else
{
_mainEditView . showMargin ( margin ) ;
_subEditView . showMargin ( margin ) ;
}
}
break ;
case IDM_VIEW_FOLDERMAGIN_SIMPLE :
case IDM_VIEW_FOLDERMAGIN_ARROW :
case IDM_VIEW_FOLDERMAGIN_CIRCLE :
case IDM_VIEW_FOLDERMAGIN_BOX :
case IDM_VIEW_FOLDERMAGIN :
{
folderStyle fStyle = ( id = = IDM_VIEW_FOLDERMAGIN_SIMPLE ) ? FOLDER_STYLE_SIMPLE : \
( id = = IDM_VIEW_FOLDERMAGIN_ARROW ) ? FOLDER_STYLE_ARROW : \
( id = = IDM_VIEW_FOLDERMAGIN_CIRCLE ) ? FOLDER_STYLE_CIRCLE : \
( id = = IDM_VIEW_FOLDERMAGIN ) ? FOLDER_STYLE_NONE : FOLDER_STYLE_BOX ;
_mainEditView . setMakerStyle ( fStyle ) ;
_subEditView . setMakerStyle ( fStyle ) ;
}
break ;
case IDM_VIEW_CURLINE_HILITING :
{
COLORREF colour = ( NppParameters : : getInstance ( ) ) - > getCurLineHilitingColour ( ) ;
_mainEditView . setCurrentLineHiLiting ( ! _pEditView - > isCurrentLineHiLiting ( ) , colour ) ;
_subEditView . setCurrentLineHiLiting ( ! _pEditView - > isCurrentLineHiLiting ( ) , colour ) ;
}
break ;
case IDM_VIEW_EDGEBACKGROUND :
case IDM_VIEW_EDGELINE :
case IDM_VIEW_EDGENONE :
{
int mode ;
switch ( id )
{
case IDM_VIEW_EDGELINE :
{
mode = EDGE_LINE ;
break ;
}
case IDM_VIEW_EDGEBACKGROUND :
{
mode = EDGE_BACKGROUND ;
break ;
}
default :
mode = EDGE_NONE ;
}
_mainEditView . execute ( SCI_SETEDGEMODE , mode ) ;
_subEditView . execute ( SCI_SETEDGEMODE , mode ) ;
}
break ;
case IDM_VIEW_LWDEF :
case IDM_VIEW_LWALIGN :
case IDM_VIEW_LWINDENT :
{
int mode = ( id = = IDM_VIEW_LWALIGN ) ? SC_WRAPINDENT_SAME : \
( id = = IDM_VIEW_LWINDENT ) ? SC_WRAPINDENT_INDENT : SC_WRAPINDENT_FIXED ;
_mainEditView . execute ( SCI_SETWRAPINDENTMODE , mode ) ;
_subEditView . execute ( SCI_SETWRAPINDENTMODE , mode ) ;
}
break ;
2010-01-29 23:52:47 +00:00
default :
if ( id > IDM_FILEMENU_LASTONE & & id < ( IDM_FILEMENU_LASTONE + _lastRecentFileList . getMaxNbLRF ( ) + 1 ) )
{
2015-08-06 11:49:14 +00:00
BufferID lastOpened = doOpen ( _lastRecentFileList . getItem ( id ) ) ;
2015-04-07 00:10:03 +00:00
if ( lastOpened ! = BUFFER_INVALID )
{
2010-01-29 23:52:47 +00:00
switchToFile ( lastOpened ) ;
}
}
else if ( ( id > IDM_LANG_USER ) & & ( id < IDM_LANG_USER_LIMIT ) )
{
TCHAR langName [ langNameLenMax ] ;
: : GetMenuString ( _mainMenuHandle , id , langName , langNameLenMax , MF_BYCOMMAND ) ;
_pEditView - > getCurrentBuffer ( ) - > setLangType ( L_USER , langName ) ;
2015-10-25 01:41:56 +00:00
if ( _pDocMap )
{
_pDocMap - > setSyntaxHiliting ( ) ;
}
2010-01-29 23:52:47 +00:00
}
else if ( ( id > = IDM_LANG_EXTERNAL ) & & ( id < = IDM_LANG_EXTERNAL_LIMIT ) )
{
setLanguage ( ( LangType ) ( id - IDM_LANG_EXTERNAL + L_EXTERNAL ) ) ;
2015-10-25 01:41:56 +00:00
if ( _pDocMap )
{
_pDocMap - > setSyntaxHiliting ( ) ;
}
2010-01-29 23:52:47 +00:00
}
else if ( ( id > = ID_MACRO ) & & ( id < ID_MACRO_LIMIT ) )
{
int i = id - ID_MACRO ;
vector < MacroShortcut > & theMacros = ( NppParameters : : getInstance ( ) ) - > getMacroList ( ) ;
2015-08-06 09:03:57 +00:00
macroPlayback ( theMacros [ i ] . getMacro ( ) ) ;
2010-01-29 23:52:47 +00:00
}
else if ( ( id > = ID_USER_CMD ) & & ( id < ID_USER_CMD_LIMIT ) )
{
int i = id - ID_USER_CMD ;
vector < UserCommand > & theUserCommands = ( NppParameters : : getInstance ( ) ) - > getUserCommandList ( ) ;
UserCommand ucmd = theUserCommands [ i ] ;
Command cmd ( ucmd . getCmd ( ) ) ;
2010-03-26 00:22:14 +00:00
cmd . run ( _pPublicInterface - > getHSelf ( ) ) ;
2010-01-29 23:52:47 +00:00
}
else if ( ( id > = ID_PLUGINS_CMD ) & & ( id < ID_PLUGINS_CMD_LIMIT ) )
{
int i = id - ID_PLUGINS_CMD ;
_pluginsManager . runPluginCommand ( i ) ;
}
2010-09-13 23:10:24 +00:00
else if ( _pluginsManager . inDynamicRange ( id ) ) // in the dynamic range allocated with NPPM_ALLOCATECMDID
{
_pluginsManager . relayNppMessages ( WM_COMMAND , id , 0 ) ;
}
2015-08-06 09:03:57 +00:00
/*UNLOAD
2010-01-29 23:52:47 +00:00
else if ( ( id > = ID_PLUGINS_REMOVING ) & & ( id < ID_PLUGINS_REMOVING_END ) )
{
int i = id - ID_PLUGINS_REMOVING ;
2010-03-26 00:22:14 +00:00
_pluginsManager . unloadPlugin ( i , _pPublicInterface - > getHSelf ( ) ) ;
2010-01-29 23:52:47 +00:00
}
*/
else if ( ( id > = IDM_WINDOW_MRU_FIRST ) & & ( id < = IDM_WINDOW_MRU_LIMIT ) )
{
2015-08-06 09:03:57 +00:00
activateDoc ( id - IDM_WINDOW_MRU_FIRST ) ;
2010-01-29 23:52:47 +00:00
}
}
2015-08-06 09:03:57 +00:00
if ( _recordingMacro )
2010-01-29 23:52:47 +00:00
switch ( id )
{
case IDM_FILE_NEW :
case IDM_FILE_CLOSE :
case IDM_FILE_CLOSEALL :
case IDM_FILE_CLOSEALL_BUT_CURRENT :
2013-08-03 23:40:07 +00:00
case IDM_FILE_CLOSEALL_TOLEFT :
case IDM_FILE_CLOSEALL_TORIGHT :
2010-01-29 23:52:47 +00:00
case IDM_FILE_SAVE :
case IDM_FILE_SAVEALL :
case IDM_FILE_RELOAD :
case IDM_EDIT_UNDO :
case IDM_EDIT_REDO :
case IDM_EDIT_CUT :
case IDM_EDIT_COPY :
//case IDM_EDIT_PASTE:
case IDM_EDIT_DELETE :
case IDM_SEARCH_FINDNEXT :
case IDM_SEARCH_FINDPREV :
case IDM_SEARCH_SETANDFINDNEXT :
case IDM_SEARCH_SETANDFINDPREV :
case IDM_SEARCH_GOTOMATCHINGBRACE :
2013-08-01 18:50:39 +00:00
case IDM_SEARCH_SELECTMATCHINGBRACES :
2010-01-29 23:52:47 +00:00
case IDM_SEARCH_TOGGLE_BOOKMARK :
case IDM_SEARCH_NEXT_BOOKMARK :
case IDM_SEARCH_PREV_BOOKMARK :
case IDM_SEARCH_CLEAR_BOOKMARKS :
case IDM_EDIT_SELECTALL :
case IDM_EDIT_INS_TAB :
case IDM_EDIT_RMV_TAB :
case IDM_EDIT_DUP_LINE :
case IDM_EDIT_TRANSPOSE_LINE :
case IDM_EDIT_SPLIT_LINES :
case IDM_EDIT_JOIN_LINES :
case IDM_EDIT_LINE_UP :
case IDM_EDIT_LINE_DOWN :
2015-07-10 04:58:54 +00:00
case IDM_EDIT_REMOVEEMPTYLINES :
case IDM_EDIT_REMOVEEMPTYLINESWITHBLANK :
2010-01-29 23:52:47 +00:00
case IDM_EDIT_UPPERCASE :
case IDM_EDIT_LOWERCASE :
case IDM_EDIT_BLOCK_COMMENT :
case IDM_EDIT_BLOCK_COMMENT_SET :
case IDM_EDIT_BLOCK_UNCOMMENT :
case IDM_EDIT_STREAM_COMMENT :
case IDM_EDIT_TRIMTRAILING :
2010-12-05 19:33:48 +00:00
case IDM_EDIT_TRIMLINEHEAD :
case IDM_EDIT_TRIM_BOTH :
case IDM_EDIT_EOL2WS :
case IDM_EDIT_TRIMALL :
case IDM_EDIT_TAB2SW :
2012-08-25 19:23:16 +00:00
case IDM_EDIT_SW2TAB_ALL :
case IDM_EDIT_SW2TAB_LEADING :
2010-01-29 23:52:47 +00:00
case IDM_EDIT_SETREADONLY :
case IDM_EDIT_FULLPATHTOCLIP :
case IDM_EDIT_FILENAMETOCLIP :
case IDM_EDIT_CURRENTDIRTOCLIP :
case IDM_EDIT_CLEARREADONLY :
case IDM_EDIT_RTL :
case IDM_EDIT_LTR :
2013-07-02 18:19:46 +00:00
case IDM_EDIT_BEGINENDSELECT :
2015-05-17 17:18:43 +00:00
case IDM_EDIT_SORTLINES_LEXICOGRAPHIC_ASCENDING :
case IDM_EDIT_SORTLINES_LEXICOGRAPHIC_DESCENDING :
case IDM_EDIT_SORTLINES_INTEGER_ASCENDING :
case IDM_EDIT_SORTLINES_INTEGER_DESCENDING :
case IDM_EDIT_SORTLINES_DECIMALCOMMA_ASCENDING :
case IDM_EDIT_SORTLINES_DECIMALCOMMA_DESCENDING :
case IDM_EDIT_SORTLINES_DECIMALDOT_ASCENDING :
case IDM_EDIT_SORTLINES_DECIMALDOT_DESCENDING :
2013-08-01 19:44:11 +00:00
case IDM_EDIT_BLANKLINEABOVECURRENT :
case IDM_EDIT_BLANKLINEBELOWCURRENT :
2010-01-29 23:52:47 +00:00
case IDM_VIEW_FULLSCREENTOGGLE :
case IDM_VIEW_ALWAYSONTOP :
case IDM_VIEW_WRAP :
case IDM_VIEW_FOLD_CURRENT :
case IDM_VIEW_UNFOLD_CURRENT :
case IDM_VIEW_TOGGLE_FOLDALL :
case IDM_VIEW_TOGGLE_UNFOLDALL :
case IDM_VIEW_FOLD_1 :
case IDM_VIEW_FOLD_2 :
case IDM_VIEW_FOLD_3 :
case IDM_VIEW_FOLD_4 :
case IDM_VIEW_FOLD_5 :
case IDM_VIEW_FOLD_6 :
case IDM_VIEW_FOLD_7 :
case IDM_VIEW_FOLD_8 :
case IDM_VIEW_UNFOLD_1 :
case IDM_VIEW_UNFOLD_2 :
case IDM_VIEW_UNFOLD_3 :
case IDM_VIEW_UNFOLD_4 :
case IDM_VIEW_UNFOLD_5 :
case IDM_VIEW_UNFOLD_6 :
case IDM_VIEW_UNFOLD_7 :
case IDM_VIEW_UNFOLD_8 :
case IDM_VIEW_GOTO_ANOTHER_VIEW :
case IDM_VIEW_SYNSCROLLV :
case IDM_VIEW_SYNSCROLLH :
2015-08-06 09:03:57 +00:00
case IDM_VIEW_TAB1 :
case IDM_VIEW_TAB2 :
case IDM_VIEW_TAB3 :
case IDM_VIEW_TAB4 :
case IDM_VIEW_TAB5 :
case IDM_VIEW_TAB6 :
case IDM_VIEW_TAB7 :
case IDM_VIEW_TAB8 :
case IDM_VIEW_TAB9 :
2013-08-03 00:19:06 +00:00
case IDM_VIEW_TAB_NEXT :
case IDM_VIEW_TAB_PREV :
2010-01-29 23:52:47 +00:00
case IDC_PREV_DOC :
case IDC_NEXT_DOC :
case IDM_SEARCH_GOPREVMARKER1 :
case IDM_SEARCH_GOPREVMARKER2 :
case IDM_SEARCH_GOPREVMARKER3 :
case IDM_SEARCH_GOPREVMARKER4 :
case IDM_SEARCH_GOPREVMARKER5 :
case IDM_SEARCH_GOPREVMARKER_DEF :
case IDM_SEARCH_GONEXTMARKER1 :
case IDM_SEARCH_GONEXTMARKER2 :
case IDM_SEARCH_GONEXTMARKER3 :
case IDM_SEARCH_GONEXTMARKER4 :
case IDM_SEARCH_GONEXTMARKER5 :
case IDM_SEARCH_GONEXTMARKER_DEF :
case IDM_SEARCH_VOLATILE_FINDNEXT :
case IDM_SEARCH_VOLATILE_FINDPREV :
case IDM_SEARCH_CUTMARKEDLINES :
2011-02-19 15:06:53 +00:00
case IDM_SEARCH_COPYMARKEDLINES :
case IDM_SEARCH_PASTEMARKEDLINES :
case IDM_SEARCH_DELETEMARKEDLINES :
case IDM_SEARCH_DELETEUNMARKEDLINES :
2010-01-29 23:52:47 +00:00
case IDM_SEARCH_MARKALLEXT1 :
case IDM_SEARCH_UNMARKALLEXT1 :
case IDM_SEARCH_MARKALLEXT2 :
case IDM_SEARCH_UNMARKALLEXT2 :
case IDM_SEARCH_MARKALLEXT3 :
case IDM_SEARCH_UNMARKALLEXT3 :
case IDM_SEARCH_MARKALLEXT4 :
case IDM_SEARCH_UNMARKALLEXT4 :
case IDM_SEARCH_MARKALLEXT5 :
case IDM_SEARCH_UNMARKALLEXT5 :
case IDM_SEARCH_CLEARALLMARKS :
_macro . push_back ( recordedMacroStep ( id ) ) ;
break ;
}
}