2012-04-15 09:50:22 +00:00
// This file is part of Notepad++ project
2021-01-23 03:23:47 +00:00
// Copyright (C)2021 Don HO <don.h@free.fr>
// 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 3 of the License, or
// at your option any later version.
2009-04-24 23:34:47 +00:00
//
2012-04-15 09:50:22 +00:00
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
2021-01-23 03:23:47 +00:00
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2012-04-15 09:50:22 +00:00
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
2021-01-23 03:23:47 +00:00
// along with this program. If not, see <https://www.gnu.org/licenses/>.
2009-04-24 23:34:47 +00:00
2016-11-11 17:11:19 +00:00
# pragma once
2009-09-04 00:10:01 +00:00
2009-04-24 23:34:47 +00:00
# include "ScintillaEditView.h"
# include "DocTabView.h"
# include "SplitterContainer.h"
# include "FindReplaceDlg.h"
# include "AboutDlg.h"
# include "RunDlg.h"
# include "StatusBar.h"
# include "lastRecentFileList.h"
# include "GoToLineDlg.h"
2011-05-19 21:19:05 +00:00
# include "FindCharsInRange.h"
2009-04-24 23:34:47 +00:00
# include "columnEditor.h"
# include "WordStyleDlg.h"
# include "trayIconControler.h"
# include "PluginsManager.h"
# include "preferenceDlg.h"
# include "WindowsDlg.h"
# include "RunMacroDlg.h"
# include "DockingManager.h"
2016-01-23 01:24:37 +00:00
# include "Processus.h"
2009-04-24 23:34:47 +00:00
# include "AutoCompletion.h"
# include "SmartHighlighter.h"
2009-09-04 00:10:01 +00:00
# include "ScintillaCtrls.h"
2009-12-13 23:54:02 +00:00
# include "lesDlgs.h"
2016-11-11 17:11:19 +00:00
# include "pluginsAdmin.h"
2018-02-28 01:31:22 +00:00
# include "localization.h"
# include "documentSnapshot.h"
# include "md5Dlgs.h"
2013-08-03 23:40:07 +00:00
# include <vector>
2015-06-30 00:02:13 +00:00
# include <iso646.h>
2011-05-19 21:19:05 +00:00
2010-03-05 00:15:06 +00:00
2009-04-24 23:34:47 +00:00
# define MENU 0x01
# define TOOLBAR 0x02
enum FileTransferMode {
TransferClone = 0x01 ,
TransferMove = 0x02
} ;
enum WindowStatus { //bitwise mask
WindowMainActive = 0x01 ,
WindowSubActive = 0x02 ,
WindowBothActive = 0x03 , //little helper shortcut
WindowUserActive = 0x04 ,
WindowMask = 0x07
} ;
2010-12-05 19:33:48 +00:00
enum trimOp {
lineHeader = 0 ,
lineTail = 1 ,
lineEol = 2
2009-04-24 23:34:47 +00:00
} ;
2010-01-29 23:52:47 +00:00
2012-08-25 19:23:16 +00:00
enum spaceTab {
tab2Space = 0 ,
space2TabLeading = 1 ,
space2TabAll = 2
} ;
2009-04-24 23:34:47 +00:00
struct TaskListInfo ;
2015-08-04 11:36:22 +00:00
struct VisibleGUIConf final
{
2021-04-07 16:02:30 +00:00
bool _isPostIt = false ;
bool _isFullScreen = false ;
2021-04-09 17:55:55 +00:00
bool _isDistractionFree = false ;
2015-07-15 12:09:31 +00:00
2021-04-13 01:38:40 +00:00
//Used by postit & fullscreen
2021-04-07 16:02:30 +00:00
bool _isMenuShown = true ;
DWORD_PTR _preStyle = ( WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN ) ;
2009-04-24 23:34:47 +00:00
2021-04-13 01:38:40 +00:00
//used by postit
2021-04-07 16:02:30 +00:00
bool _isTabbarShown = true ;
bool _isAlwaysOnTop = false ;
bool _isStatusbarShown = true ;
2009-04-24 23:34:47 +00:00
2021-04-13 01:38:40 +00:00
//used by fullscreen
2021-09-13 19:19:44 +00:00
WINDOWPLACEMENT _winPlace = { 0 } ;
2009-04-24 23:34:47 +00:00
2021-04-13 01:38:40 +00:00
//used by distractionFree
bool _was2ViewModeOn = false ;
2021-04-14 01:39:25 +00:00
std : : vector < DockingCont * > _pVisibleDockingContainers ;
2009-04-24 23:34:47 +00:00
} ;
2018-03-10 10:30:55 +00:00
struct QuoteParams
{
enum Speed { slow = 0 , rapid , speedOfLight } ;
QuoteParams ( ) { } ;
QuoteParams ( const wchar_t * quoter , Speed speed , bool shouldBeTrolling , int encoding , LangType lang , const wchar_t * quote ) :
_quoter ( quoter ) , _speed ( speed ) , _shouldBeTrolling ( shouldBeTrolling ) , _encoding ( encoding ) , _lang ( lang ) , _quote ( quote ) { }
void reset ( ) {
_quoter = nullptr ;
_speed = rapid ;
_shouldBeTrolling = false ;
_encoding = SC_CP_UTF8 ;
_lang = L_TEXT ;
_quote = nullptr ;
} ;
const wchar_t * _quoter = nullptr ;
Speed _speed = rapid ;
bool _shouldBeTrolling = false ;
int _encoding = SC_CP_UTF8 ;
LangType _lang = L_TEXT ;
const wchar_t * _quote = nullptr ;
} ;
2021-01-17 16:24:37 +00:00
class CustomFileDialog ;
2010-03-26 00:22:14 +00:00
class Notepad_plus_Window ;
2011-04-13 07:08:51 +00:00
class AnsiCharPanel ;
2011-05-19 21:19:05 +00:00
class ClipboardHistoryPanel ;
class VerticalFileSwitcher ;
2011-08-29 23:01:41 +00:00
class ProjectPanel ;
2012-01-30 00:00:50 +00:00
class DocumentMap ;
2012-11-24 20:14:52 +00:00
class FunctionListPanel ;
2016-01-23 01:24:37 +00:00
class FileBrowser ;
2018-03-10 10:30:55 +00:00
struct QuoteParams ;
2015-08-04 11:36:22 +00:00
class Notepad_plus final
2015-07-15 12:09:31 +00:00
{
2010-03-26 00:22:14 +00:00
friend class Notepad_plus_Window ;
2014-05-04 20:37:54 +00:00
friend class FileManager ;
2009-04-24 23:34:47 +00:00
public :
Notepad_plus ( ) ;
2015-08-04 11:36:22 +00:00
~ Notepad_plus ( ) ;
2010-03-26 00:22:14 +00:00
LRESULT init ( HWND hwnd ) ;
LRESULT process ( HWND hwnd , UINT Message , WPARAM wParam , LPARAM lParam ) ;
2010-02-13 01:12:17 +00:00
void killAllChildren ( ) ;
2009-04-24 23:34:47 +00:00
2010-03-26 00:22:14 +00:00
enum comment_mode { cm_comment , cm_uncomment , cm_toggle } ;
2009-04-24 23:34:47 +00:00
void setTitle ( ) ;
void getTaskListInfo ( TaskListInfo * tli ) ;
// For filtering the modeless Dialog message
2015-08-04 11:36:22 +00:00
//! \name File Operations
//@{
2009-04-24 23:34:47 +00:00
//The doXXX functions apply to a single buffer and dont need to worry about views, with the excpetion of doClose, since closing one view doesnt have to mean the document is gone
2018-05-31 13:32:44 +00:00
BufferID doOpen ( const generic_string & fileName , bool isRecursive = false , bool isReadOnly = false , int encoding = - 1 , const TCHAR * backupFileName = NULL , FILETIME fileNameTimestamp = { } ) ;
2009-04-24 23:34:47 +00:00
bool doReload ( BufferID id , bool alert = true ) ;
bool doSave ( BufferID , const TCHAR * filename , bool isSaveCopy = false ) ;
2014-03-31 01:01:54 +00:00
void doClose ( BufferID , int whichOne , bool doDeleteBackup = false ) ;
2009-04-24 23:34:47 +00:00
//bool doDelete(const TCHAR *fileName) const {return ::DeleteFile(fileName) != 0;};
void fileOpen ( ) ;
2010-11-13 11:15:06 +00:00
void fileNew ( ) ;
2015-08-04 11:36:22 +00:00
bool fileReload ( ) ;
2009-04-24 23:34:47 +00:00
bool fileClose ( BufferID id = BUFFER_INVALID , int curView = - 1 ) ; //use curView to override view to close from
2014-04-13 01:31:02 +00:00
bool fileCloseAll ( bool doDeleteBackup , bool isSnapshotMode = false ) ;
2009-04-24 23:34:47 +00:00
bool fileCloseAllButCurrent ( ) ;
2015-08-04 11:36:22 +00:00
bool fileCloseAllGiven ( const std : : vector < int > & krvecBufferIndexes ) ;
2013-08-03 23:40:07 +00:00
bool fileCloseAllToLeft ( ) ;
bool fileCloseAllToRight ( ) ;
2019-01-01 09:18:35 +00:00
bool fileCloseAllUnchanged ( ) ;
2009-04-24 23:34:47 +00:00
bool fileSave ( BufferID id = BUFFER_INVALID ) ;
2021-06-06 07:42:36 +00:00
bool fileSaveAllConfirm ( ) ;
2009-04-24 23:34:47 +00:00
bool fileSaveAll ( ) ;
2015-12-02 15:02:30 +00:00
bool fileSaveSpecific ( const generic_string & fileNameToSave ) ;
2009-04-24 23:34:47 +00:00
bool fileSaveAs ( BufferID id = BUFFER_INVALID , bool isSaveCopy = false ) ;
2009-07-04 11:33:17 +00:00
bool fileDelete ( BufferID id = BUFFER_INVALID ) ;
bool fileRename ( BufferID id = BUFFER_INVALID ) ;
2009-04-24 23:34:47 +00:00
bool switchToFile ( BufferID buffer ) ; //find buffer in active view then in other view.
2015-08-04 11:36:22 +00:00
//@}
2009-04-24 23:34:47 +00:00
bool isFileSession ( const TCHAR * filename ) ;
2015-06-13 15:10:02 +00:00
bool isFileWorkspace ( const TCHAR * filename ) ;
2009-04-24 23:34:47 +00:00
void filePrint ( bool showDialog ) ;
2016-10-23 01:50:41 +00:00
void saveScintillasZoom ( ) ;
2009-04-24 23:34:47 +00:00
2009-09-04 00:10:01 +00:00
bool saveGUIParams ( ) ;
2011-09-25 01:33:34 +00:00
bool saveProjectPanelsParams ( ) ;
2016-02-02 18:06:23 +00:00
bool saveFileBrowserParam ( ) ;
2009-09-04 00:10:01 +00:00
void saveDockingParams ( ) ;
2015-08-04 11:36:22 +00:00
void saveUserDefineLangs ( ) ;
void saveShortcuts ( ) ;
2009-09-04 00:10:01 +00:00
void saveSession ( const Session & session ) ;
2014-04-02 22:02:10 +00:00
void saveCurrentSession ( ) ;
2015-08-04 11:36:22 +00:00
void saveFindHistory ( ) ;
2014-04-02 22:02:10 +00:00
2015-08-04 11:36:22 +00:00
void getCurrentOpenedFiles ( Session & session , bool includUntitledDoc = false ) ;
2009-04-24 23:34:47 +00:00
2015-08-04 11:36:22 +00:00
bool fileLoadSession ( const TCHAR * fn = nullptr ) ;
Add "save Folder as Workspace in session" option in save session dialog
Save FileBrowser root folders if it is visible.
When loading a session file (from menu or via the command line),
launch a FileBrowser from scratch and add folders from the file to it.
When loading an auto-saved session, ignore saved FileBrowser folders.
Store roots and selected item of FileBrowser in a Session class.
Add "FileBrowser" node to session XML.
It containts "latestSelectedItem" attribute and "root" child nodes.
This structure corresponds to the one from "config.xml".
Current save session behavior for Folder as Workspace (FaW) is like this:
1. FaW isn't opened, checkbox is greyed-out -> FaW info is not saved in session
2. FaW is opened, checkbox isn't checked -> FaW info isn't saved in session
3. FaW is opened, checkbox is checked -> FaW info is saved in session
Load session behavior:
1. FaW isn't open, session without FaW info -> FaW isn't shown after loading
2. FaW isn't open, session with FaW info -> FaW is shown after loading
3. FaW is open, session without FaW info -> FaW is kept as is without changes
4. FaW is open, session with FaW info -> FaW is shown with new directories from session
Fix #9165, close #9286
2020-12-31 10:26:49 +00:00
const TCHAR * fileSaveSession ( size_t nbFile , TCHAR * * fileNames , const TCHAR * sessionFile2save , bool includeFileBrowser = false ) ;
2015-08-04 11:36:22 +00:00
const TCHAR * fileSaveSession ( size_t nbFile = 0 , TCHAR * * fileNames = nullptr ) ;
2009-04-24 23:34:47 +00:00
void changeToolBarIcons ( ) ;
bool doBlockComment ( comment_mode currCommentMode ) ;
bool doStreamComment ( ) ;
2017-02-06 19:58:37 +00:00
bool undoStreamComment ( bool tryBlockComment = true ) ;
2015-07-15 12:09:31 +00:00
2009-04-24 23:34:47 +00:00
bool addCurrentMacro ( ) ;
2010-08-15 18:52:55 +00:00
void macroPlayback ( Macro ) ;
2015-07-15 12:09:31 +00:00
2014-05-08 20:48:03 +00:00
void loadLastSession ( ) ;
Add "save Folder as Workspace in session" option in save session dialog
Save FileBrowser root folders if it is visible.
When loading a session file (from menu or via the command line),
launch a FileBrowser from scratch and add folders from the file to it.
When loading an auto-saved session, ignore saved FileBrowser folders.
Store roots and selected item of FileBrowser in a Session class.
Add "FileBrowser" node to session XML.
It containts "latestSelectedItem" attribute and "root" child nodes.
This structure corresponds to the one from "config.xml".
Current save session behavior for Folder as Workspace (FaW) is like this:
1. FaW isn't opened, checkbox is greyed-out -> FaW info is not saved in session
2. FaW is opened, checkbox isn't checked -> FaW info isn't saved in session
3. FaW is opened, checkbox is checked -> FaW info is saved in session
Load session behavior:
1. FaW isn't open, session without FaW info -> FaW isn't shown after loading
2. FaW isn't open, session with FaW info -> FaW is shown after loading
3. FaW is open, session without FaW info -> FaW is kept as is without changes
4. FaW is open, session with FaW info -> FaW is shown with new directories from session
Fix #9165, close #9286
2020-12-31 10:26:49 +00:00
bool loadSession ( Session & session , bool isSnapshotMode = false , bool shouldLoadFileBrowser = false ) ;
2015-07-15 12:09:31 +00:00
2017-02-24 22:47:19 +00:00
void prepareBufferChangedDialog ( Buffer * buffer ) ;
2009-04-24 23:34:47 +00:00
void notifyBufferChanged ( Buffer * buffer , int mask ) ;
2016-03-31 07:35:18 +00:00
bool findInFinderFiles ( FindersInfo * findInFolderInfo ) ;
2021-02-18 01:54:59 +00:00
bool createFilelistForFiles ( std : : vector < generic_string > & fileNames ) ;
bool createFilelistForProjects ( std : : vector < generic_string > & fileNames ) ;
2009-04-24 23:34:47 +00:00
bool findInFiles ( ) ;
2021-02-18 01:54:59 +00:00
bool findInProjects ( ) ;
bool findInFilelist ( std : : vector < generic_string > & fileList ) ;
2009-04-24 23:34:47 +00:00
bool replaceInFiles ( ) ;
2021-02-18 01:54:59 +00:00
bool replaceInProjects ( ) ;
bool replaceInFilelist ( std : : vector < generic_string > & fileList ) ;
2009-04-24 23:34:47 +00:00
void setFindReplaceFolderFilter ( const TCHAR * dir , const TCHAR * filters ) ;
2015-05-31 20:40:07 +00:00
std : : vector < generic_string > addNppComponents ( const TCHAR * destDir , const TCHAR * extFilterName , const TCHAR * extFilter ) ;
2018-11-17 18:01:24 +00:00
std : : vector < generic_string > addNppPlugins ( const TCHAR * extFilterName , const TCHAR * extFilter ) ;
2009-11-26 01:34:25 +00:00
int getHtmlXmlEncoding ( const TCHAR * fileName ) const ;
2019-10-13 19:48:27 +00:00
2014-08-02 11:28:42 +00:00
HACCEL getAccTable ( ) const {
2010-03-26 00:22:14 +00:00
return _accelerator . getAccTable ( ) ;
2019-10-13 19:48:27 +00:00
} ;
2019-06-13 15:54:42 +00:00
bool emergency ( const generic_string & emergencySavedDir ) ;
2019-10-13 19:48:27 +00:00
2015-08-04 11:36:22 +00:00
Buffer * getCurrentBuffer ( ) {
2014-03-27 01:30:31 +00:00
return _pEditView - > getCurrentBuffer ( ) ;
2019-10-13 19:48:27 +00:00
} ;
2014-03-27 01:30:31 +00:00
void launchDocumentBackupTask ( ) ;
2018-03-07 01:17:26 +00:00
int getQuoteIndexFrom ( const wchar_t * quoter ) const ;
2015-01-10 23:41:49 +00:00
void showQuoteFromIndex ( int index ) const ;
2018-03-10 10:30:55 +00:00
void showQuote ( const QuoteParams * quote ) const ;
2015-07-15 12:09:31 +00:00
2019-10-13 19:48:27 +00:00
generic_string getPluginListVerStr ( ) const {
return _pluginsAdminDlg . getPluginListVerStr ( ) ;
} ;
2015-08-04 11:36:22 +00:00
2020-10-22 02:28:57 +00:00
void minimizeDialogs ( ) ;
void restoreMinimizeDialogs ( ) ;
2021-07-28 12:12:24 +00:00
void refreshDarkMode ( bool resetStyle = false ) ;
2021-02-22 13:55:45 +00:00
2009-04-24 23:34:47 +00:00
private :
2021-09-13 19:19:44 +00:00
Notepad_plus_Window * _pPublicInterface = nullptr ;
Window * _pMainWindow = nullptr ;
2009-04-24 23:34:47 +00:00
DockingManager _dockingManager ;
2015-05-31 20:40:07 +00:00
std : : vector < int > _internalFuncIDs ;
2009-04-24 23:34:47 +00:00
AutoCompletion _autoCompleteMain ;
2015-08-04 11:36:22 +00:00
AutoCompletion _autoCompleteSub ; // each Scintilla has its own autoComplete
2009-04-24 23:34:47 +00:00
SmartHighlighter _smartHighlighter ;
2010-03-05 00:15:06 +00:00
NativeLangSpeaker _nativeLangSpeaker ;
2009-04-24 23:34:47 +00:00
DocTabView _mainDocTab ;
DocTabView _subDocTab ;
2015-08-04 11:36:22 +00:00
DocTabView * _pDocTab = nullptr ;
DocTabView * _pNonDocTab = nullptr ;
2009-04-24 23:34:47 +00:00
ScintillaEditView _subEditView ;
ScintillaEditView _mainEditView ;
2015-08-04 11:36:22 +00:00
ScintillaEditView _invisibleEditView ; // for searches
ScintillaEditView _fileEditView ; // for FileManager
ScintillaEditView * _pEditView = nullptr ;
ScintillaEditView * _pNonEditView = nullptr ;
2009-04-24 23:34:47 +00:00
2015-08-04 11:36:22 +00:00
SplitterContainer * _pMainSplitter = nullptr ;
2009-04-24 23:34:47 +00:00
SplitterContainer _subSplitter ;
2015-08-04 11:36:22 +00:00
ContextMenu _tabPopupMenu ;
ContextMenu _tabPopupDropMenu ;
ContextMenu _fileSwitcherMultiFilePopupMenu ;
2009-04-24 23:34:47 +00:00
ToolBar _toolBar ;
IconList _docTabIconList ;
2020-09-30 01:33:37 +00:00
IconList _docTabIconListAlt ;
2021-05-06 02:04:25 +00:00
IconList _docTabIconListDarkMode ;
2015-07-15 12:09:31 +00:00
2009-04-24 23:34:47 +00:00
StatusBar _statusBar ;
2015-08-04 11:36:22 +00:00
bool _toReduceTabBar = false ;
2009-04-24 23:34:47 +00:00
ReBar _rebarTop ;
ReBar _rebarBottom ;
// Dialog
FindReplaceDlg _findReplaceDlg ;
2016-03-31 07:35:18 +00:00
FindInFinderDlg _findInFinderDlg ;
2009-04-24 23:34:47 +00:00
FindIncrementDlg _incrementFindDlg ;
AboutDlg _aboutDlg ;
2015-12-06 22:20:14 +00:00
DebugInfoDlg _debugInfoDlg ;
2009-04-24 23:34:47 +00:00
RunDlg _runDlg ;
2018-12-16 19:14:30 +00:00
HashFromFilesDlg _md5FromFilesDlg ;
HashFromTextDlg _md5FromTextDlg ;
HashFromFilesDlg _sha2FromFilesDlg ;
HashFromTextDlg _sha2FromTextDlg ;
2009-04-24 23:34:47 +00:00
GoToLineDlg _goToLineDlg ;
ColumnEditorDlg _colEditorDlg ;
WordStyleDlg _configStyleDlg ;
PreferenceDlg _preference ;
2011-05-19 21:19:05 +00:00
FindCharsInRangeDlg _findCharsInRangeDlg ;
2016-11-11 17:11:19 +00:00
PluginsAdminDlg _pluginsAdminDlg ;
2017-05-15 07:22:31 +00:00
DocumentPeeker _documentPeeker ;
2015-07-15 12:09:31 +00:00
2009-04-24 23:34:47 +00:00
// a handle list of all the Notepad++ dialogs
2015-05-31 20:40:07 +00:00
std : : vector < HWND > _hModelessDlgs ;
2009-04-24 23:34:47 +00:00
LastRecentFileList _lastRecentFileList ;
WindowsMenu _windowsMenu ;
2015-08-04 11:36:22 +00:00
HMENU _mainMenuHandle = NULL ;
2009-04-24 23:34:47 +00:00
2015-08-04 11:36:22 +00:00
bool _sysMenuEntering = false ;
2015-07-15 12:09:31 +00:00
2016-06-02 20:47:13 +00:00
// make sure we don't recursively call doClose when closing the last file with -quitOnEmpty
bool _isAttemptingCloseOnQuit = false ;
2009-04-24 23:34:47 +00:00
2021-04-11 17:59:30 +00:00
// For FullScreen/PostIt/DistractionFree features
2009-04-24 23:34:47 +00:00
VisibleGUIConf _beforeSpecialView ;
void fullScreenToggle ( ) ;
void postItToggle ( ) ;
2021-04-09 17:55:55 +00:00
void distractionFreeToggle ( ) ;
2009-04-24 23:34:47 +00:00
// Keystroke macro recording and playback
Macro _macro ;
2015-08-04 11:36:22 +00:00
bool _recordingMacro = false ;
2015-10-07 15:55:29 +00:00
bool _playingBackMacro = false ;
2018-01-23 14:24:28 +00:00
bool _recordingSaved = false ;
2009-04-24 23:34:47 +00:00
RunMacroDlg _runMacroDlg ;
2016-07-11 23:24:05 +00:00
// For conflict detection when saving Macros or RunCommands
2021-09-13 19:19:44 +00:00
ShortcutMapper * _pShortcutMapper = nullptr ;
2016-07-11 23:24:05 +00:00
2009-04-24 23:34:47 +00:00
// For hotspot
2015-08-04 11:36:22 +00:00
bool _linkTriggered = true ;
bool _isFolding = false ;
2009-04-24 23:34:47 +00:00
//For Dynamic selection highlight
2019-05-08 09:13:21 +00:00
Sci_CharacterRange _prevSelectedRange ;
2009-04-24 23:34:47 +00:00
//Synchronized Scolling
2015-08-04 11:36:22 +00:00
struct SyncInfo final
2015-07-15 12:09:31 +00:00
{
2015-08-04 11:36:22 +00:00
int _line = 0 ;
int _column = 0 ;
bool _isSynScollV = false ;
bool _isSynScollH = false ;
bool doSync ( ) const { return ( _isSynScollV | | _isSynScollH ) ; }
2015-07-15 12:09:31 +00:00
}
_syncInfo ;
2009-04-24 23:34:47 +00:00
2015-08-04 11:36:22 +00:00
bool _isUDDocked = false ;
2009-04-24 23:34:47 +00:00
2015-08-04 11:36:22 +00:00
trayIconControler * _pTrayIco = nullptr ;
int _zoomOriginalValue = 0 ;
2009-04-24 23:34:47 +00:00
Accelerator _accelerator ;
ScintillaAccelerator _scintaccelerator ;
PluginsManager _pluginsManager ;
2009-12-13 23:54:02 +00:00
ButtonDlg _restoreButton ;
2009-04-24 23:34:47 +00:00
2015-08-04 11:36:22 +00:00
bool _isFileOpening = false ;
bool _isAdministrator = false ;
2009-04-24 23:34:47 +00:00
2020-02-24 02:57:15 +00:00
bool _isEndingSessionButNotReady = false ; // If Windows 10 update needs to restart
// and Notepad++ has one (some) dirty document(s)
// and "Enable session snapshot and periodic backup" is not enabled
// then WM_ENDSESSION is send with wParam == FALSE
// in this case this boolean is set true, so Notepad++ will quit and its current session will be saved
2009-09-04 00:10:01 +00:00
ScintillaCtrls _scintillaCtrls4Plugins ;
2009-04-24 23:34:47 +00:00
2015-05-31 20:40:07 +00:00
std : : vector < std : : pair < int , int > > _hideLinesMarks ;
2009-06-07 01:49:42 +00:00
StyleArray _hotspotStyles ;
2010-03-26 00:22:14 +00:00
2015-08-04 11:36:22 +00:00
AnsiCharPanel * _pAnsiCharPanel = nullptr ;
ClipboardHistoryPanel * _pClipboardHistoryPanel = nullptr ;
2021-07-26 17:07:38 +00:00
VerticalFileSwitcher * _pDocumentListPanel = nullptr ;
2015-08-04 11:36:22 +00:00
ProjectPanel * _pProjectPanel_1 = nullptr ;
ProjectPanel * _pProjectPanel_2 = nullptr ;
ProjectPanel * _pProjectPanel_3 = nullptr ;
2009-04-24 23:34:47 +00:00
2016-01-23 01:24:37 +00:00
FileBrowser * _pFileBrowser = nullptr ;
2015-08-04 11:36:22 +00:00
DocumentMap * _pDocMap = nullptr ;
FunctionListPanel * _pFuncList = nullptr ;
2012-01-30 00:00:50 +00:00
2020-10-22 02:28:57 +00:00
std : : vector < HWND > _sysTrayHiddenHwnd ;
2009-04-24 23:34:47 +00:00
BOOL notify ( SCNotification * notification ) ;
void command ( int id ) ;
//Document management
2015-08-04 11:36:22 +00:00
UCHAR _mainWindowStatus = 0 ; //For 2 views and user dialog if docked
int _activeView = MAIN_VIEW ;
2009-04-24 23:34:47 +00:00
//User dialog docking
void dockUserDlg ( ) ;
void undockUserDlg ( ) ;
//View visibility
void showView ( int whichOne ) ;
bool viewVisible ( int whichOne ) ;
void hideView ( int whichOne ) ;
void hideCurrentView ( ) ;
bool bothActive ( ) { return ( _mainWindowStatus & WindowBothActive ) = = WindowBothActive ; } ;
bool reloadLang ( ) ;
bool loadStyles ( ) ;
2016-05-11 00:18:04 +00:00
int currentView ( ) {
2009-04-24 23:34:47 +00:00
return _activeView ;
2015-07-15 12:09:31 +00:00
}
2009-09-04 00:10:01 +00:00
2021-07-04 02:29:27 +00:00
int otherView ( ) {
2009-04-24 23:34:47 +00:00
return ( _activeView = = MAIN_VIEW ? SUB_VIEW : MAIN_VIEW ) ;
2015-07-15 12:09:31 +00:00
}
2009-09-04 00:10:01 +00:00
2021-07-04 02:29:27 +00:00
int otherFromView ( int whichOne ) {
2009-04-24 23:34:47 +00:00
return ( whichOne = = MAIN_VIEW ? SUB_VIEW : MAIN_VIEW ) ;
2015-07-15 12:09:31 +00:00
}
2009-09-04 00:10:01 +00:00
2009-04-24 23:34:47 +00:00
bool canHideView ( int whichOne ) ; //true if view can safely be hidden (no open docs etc)
2016-06-02 20:47:13 +00:00
bool isEmpty ( ) ; // true if we have 1 view with 1 clean, untitled doc
2009-04-24 23:34:47 +00:00
int switchEditViewTo ( int gid ) ; //activate other view (set focus etc)
void docGotoAnotherEditView ( FileTransferMode mode ) ; //TransferMode
void docOpenInNewInstance ( FileTransferMode mode , int x = 0 , int y = 0 ) ;
void loadBufferIntoView ( BufferID id , int whichOne , bool dontClose = false ) ; //Doesnt _activate_ the buffer
2011-06-13 01:24:00 +00:00
bool removeBufferFromView ( BufferID id , int whichOne ) ; //Activates alternative of possible, or creates clean document if not clean already
2009-04-24 23:34:47 +00:00
bool activateBuffer ( BufferID id , int whichOne ) ; //activate buffer in that view if found
void notifyBufferActivated ( BufferID bufid , int view ) ;
void performPostReload ( int whichOne ) ;
//END: Document management
2019-07-03 07:41:35 +00:00
int doSaveOrNot ( const TCHAR * fn , bool isMulti = false ) ;
2009-09-04 00:10:01 +00:00
int doReloadOrNot ( const TCHAR * fn , bool dirty ) ;
int doCloseOrNot ( const TCHAR * fn ) ;
int doDeleteOrNot ( const TCHAR * fn ) ;
2021-08-22 15:49:35 +00:00
int doSaveAll ( ) ;
2009-04-24 23:34:47 +00:00
2009-09-04 00:10:01 +00:00
void enableMenu ( int cmdID , bool doEnable ) const ;
2009-04-24 23:34:47 +00:00
void enableCommand ( int cmdID , bool doEnable , int which ) const ;
void checkClipboard ( ) ;
void checkDocState ( ) ;
void checkUndoState ( ) ;
void checkMacroState ( ) ;
void checkSyncState ( ) ;
2020-10-21 20:50:24 +00:00
void setupColorSampleBitmapsOnMainMenuItems ( ) ;
2009-04-24 23:34:47 +00:00
void dropFiles ( HDROP hdrop ) ;
Enhance "File status Auto-Detection" to avoid switching editing tab off behaviour
Fix a long waiting issue about file auto change detection, by adding a new option to avoid an annoying behaviour:
If file content is changed outside of Notepad++, while focus back to Notepad++, the current editing tab will be switched off, the changed file will be switched to and user will be asked to reload the file in question.
The new option remains the editing tab. User will be asked to reload it only if the changed file is switched in.
Fix #1087, Fix #3349, Fix #3333, Fix #3528, Fix #3138, Fix #3934, Fix #3160, Fix #1822, Fix #745, Fix #3599, Fix #4329, Fix #3971, Fix #4592, Fix #1116, Fix #2082
Close #4180, Close #5386, Close #4189, Close #1995, Close #2867, Close #3306, Close #2776, Close #2724, Close #2405, Close #4072, Close #4747
Close #5389
2019-03-06 16:21:49 +00:00
void checkModifiedDocument ( bool bCheckOnlyCurrentBuffer ) ;
2009-04-24 23:34:47 +00:00
void getMainClientRect ( RECT & rc ) const ;
2010-07-26 00:12:02 +00:00
void staticCheckMenuAndTB ( ) const ;
2009-04-24 23:34:47 +00:00
void dynamicCheckMenuAndTB ( ) const ;
2015-10-27 14:35:19 +00:00
void enableConvertMenuItems ( EolType f ) const ;
2009-12-01 01:20:13 +00:00
void checkUnicodeMenuItems ( ) const ;
2009-04-24 23:34:47 +00:00
2011-06-18 21:53:14 +00:00
generic_string getLangDesc ( LangType langType , bool getName = false ) ;
2009-04-24 23:34:47 +00:00
2015-08-04 11:36:22 +00:00
void setLangStatus ( LangType langType ) ;
2009-04-24 23:34:47 +00:00
2015-10-27 14:35:19 +00:00
void setDisplayFormat ( EolType f ) ;
2009-11-22 01:52:07 +00:00
void setUniModeText ( ) ;
2009-04-24 23:34:47 +00:00
void checkLangsMenu ( int id ) const ;
2009-07-04 11:33:17 +00:00
void setLanguage ( LangType langType ) ;
2017-02-16 23:35:28 +00:00
LangType menuID2LangType ( int cmdID ) ;
2009-04-24 23:34:47 +00:00
2015-02-06 03:46:15 +00:00
BOOL processIncrFindAccel ( MSG * msg ) const ;
2016-12-18 16:37:43 +00:00
BOOL processFindAccel ( MSG * msg ) const ;
2015-02-06 03:46:15 +00:00
2009-04-24 23:34:47 +00:00
void checkMenuItem ( int itemID , bool willBeChecked ) const {
: : CheckMenuItem ( _mainMenuHandle , itemID , MF_BYCOMMAND | ( willBeChecked ? MF_CHECKED : MF_UNCHECKED ) ) ;
2015-07-15 12:09:31 +00:00
}
2014-11-12 02:14:45 +00:00
bool isConditionExprLine ( int lineNumber ) ;
2014-11-17 00:36:36 +00:00
int findMachedBracePos ( size_t startPos , size_t endPos , char targetSymbol , char matchedSymbol ) ;
2014-11-12 02:14:45 +00:00
void maintainIndentation ( TCHAR ch ) ;
2015-07-15 12:09:31 +00:00
2020-05-13 17:00:44 +00:00
void addHotSpot ( ScintillaEditView * view = NULL ) ;
2009-04-24 23:34:47 +00:00
2021-07-04 02:29:27 +00:00
void bookmarkAdd ( int lineno ) const {
2009-04-24 23:34:47 +00:00
if ( lineno = = - 1 )
2016-06-05 18:29:21 +00:00
lineno = static_cast < int32_t > ( _pEditView - > getCurrentLineNumber ( ) ) ;
2009-04-24 23:34:47 +00:00
if ( ! bookmarkPresent ( lineno ) )
_pEditView - > execute ( SCI_MARKERADD , lineno , MARK_BOOKMARK ) ;
2015-07-15 12:09:31 +00:00
}
2021-07-04 02:29:27 +00:00
void bookmarkDelete ( int lineno ) const {
2009-04-24 23:34:47 +00:00
if ( lineno = = - 1 )
2016-06-05 18:29:21 +00:00
lineno = static_cast < int32_t > ( _pEditView - > getCurrentLineNumber ( ) ) ;
2016-09-28 15:59:52 +00:00
while ( bookmarkPresent ( lineno ) )
2009-04-24 23:34:47 +00:00
_pEditView - > execute ( SCI_MARKERDELETE , lineno , MARK_BOOKMARK ) ;
2015-07-15 12:09:31 +00:00
}
2021-07-04 02:29:27 +00:00
bool bookmarkPresent ( int lineno ) const {
2009-04-24 23:34:47 +00:00
if ( lineno = = - 1 )
2016-06-05 18:29:21 +00:00
lineno = static_cast < int32_t > ( _pEditView - > getCurrentLineNumber ( ) ) ;
2009-04-24 23:34:47 +00:00
LRESULT state = _pEditView - > execute ( SCI_MARKERGET , lineno ) ;
return ( ( state & ( 1 < < MARK_BOOKMARK ) ) ! = 0 ) ;
2015-07-15 12:09:31 +00:00
}
2021-07-04 02:29:27 +00:00
void bookmarkToggle ( int lineno ) const {
2009-04-24 23:34:47 +00:00
if ( lineno = = - 1 )
2016-06-05 18:29:21 +00:00
lineno = static_cast < int32_t > ( _pEditView - > getCurrentLineNumber ( ) ) ;
2009-04-24 23:34:47 +00:00
if ( bookmarkPresent ( lineno ) )
bookmarkDelete ( lineno ) ;
else
2015-07-15 12:09:31 +00:00
bookmarkAdd ( lineno ) ;
}
2009-04-24 23:34:47 +00:00
void bookmarkNext ( bool forwardScan ) ;
2021-07-04 02:29:27 +00:00
void bookmarkClearAll ( ) const {
2009-04-24 23:34:47 +00:00
_pEditView - > execute ( SCI_MARKERDELETEALL , MARK_BOOKMARK ) ;
2015-07-15 12:09:31 +00:00
}
2009-04-24 23:34:47 +00:00
2009-09-04 00:10:01 +00:00
void copyMarkedLines ( ) ;
void cutMarkedLines ( ) ;
2011-02-19 15:06:53 +00:00
void deleteMarkedLines ( bool isMarked ) ;
2009-09-04 00:10:01 +00:00
void pasteToMarkedLines ( ) ;
void deleteMarkedline ( int ln ) ;
2010-05-27 00:05:51 +00:00
void inverseMarks ( ) ;
2009-09-04 00:10:01 +00:00
void replaceMarkedline ( int ln , const TCHAR * str ) ;
generic_string getMarkedLine ( int ln ) ;
2009-04-24 23:34:47 +00:00
void findMatchingBracePos ( int & braceAtCaret , int & braceOpposite ) ;
2009-12-01 01:20:13 +00:00
bool braceMatch ( ) ;
2009-04-24 23:34:47 +00:00
void activateNextDoc ( bool direction ) ;
2016-06-05 18:29:21 +00:00
void activateDoc ( size_t pos ) ;
2009-04-24 23:34:47 +00:00
void updateStatusBar ( ) ;
2010-09-19 01:27:41 +00:00
size_t getSelectedCharNumber ( UniMode ) ;
size_t getCurrentDocCharCount ( UniMode u ) ;
2016-06-05 18:29:21 +00:00
size_t getSelectedAreas ( ) ;
2009-10-04 13:13:45 +00:00
size_t getSelectedBytes ( ) ;
bool isFormatUnicode ( UniMode ) ;
int getBOMSize ( UniMode ) ;
2009-04-24 23:34:47 +00:00
void showAutoComp ( ) ;
void autoCompFromCurrentFile ( bool autoInsert = true ) ;
void showFunctionComp ( ) ;
2013-10-10 23:05:50 +00:00
void showPathCompletion ( ) ;
2009-04-24 23:34:47 +00:00
2010-03-05 00:15:06 +00:00
//void changeStyleCtrlsLang(HWND hDlg, int *idArray, const char **translatedText);
2020-09-28 00:15:19 +00:00
void setCodePageForInvisibleView ( Buffer const * pBuffer ) ;
2013-05-11 20:55:09 +00:00
bool replaceInOpenedFiles ( ) ;
2009-04-24 23:34:47 +00:00
bool findInOpenedFiles ( ) ;
2020-06-13 20:53:43 +00:00
bool findInCurrentFile ( bool isEntireDoc ) ;
2009-04-24 23:34:47 +00:00
2021-12-20 17:10:13 +00:00
void getMatchedFileNames ( const TCHAR * dir , size_t level , const std : : vector < generic_string > & patterns , std : : vector < generic_string > & fileNames , bool isRecursive , bool isInHiddenDir ) ;
2009-04-24 23:34:47 +00:00
void doSynScorll ( HWND hW ) ;
2009-09-04 00:10:01 +00:00
void setWorkingDir ( const TCHAR * dir ) ;
2015-06-01 16:47:24 +00:00
bool str2Cliboard ( const generic_string & str2cpy ) ;
2009-04-24 23:34:47 +00:00
bool getIntegralDockingData ( tTbData & dockData , int & iCont , bool & isVisible ) ;
2009-09-04 00:10:01 +00:00
int getLangFromMenuName ( const TCHAR * langName ) ;
generic_string getLangFromMenu ( const Buffer * buf ) ;
2009-04-24 23:34:47 +00:00
2020-05-30 14:50:59 +00:00
generic_string exts2Filters ( const generic_string & exts , int maxExtsLen = - 1 ) const ; // maxExtsLen default value -1 makes no limit of whole exts length
2021-01-17 16:24:37 +00:00
int setFileOpenSaveDlgFilters ( CustomFileDialog & fDlg , bool showAllExt , int langType = - 1 ) ; // showAllExt should be true if it's used for open file dialog - all set exts should be used for filtering files
2009-09-04 00:10:01 +00:00
Style * getStyleFromName ( const TCHAR * styleName ) ;
2009-04-24 23:34:47 +00:00
bool dumpFiles ( const TCHAR * outdir , const TCHAR * fileprefix = TEXT ( " " ) ) ; //helper func
void drawTabbarColoursFromStylerArray ( ) ;
2021-08-21 14:07:34 +00:00
void drawDocumentMapColoursFromStylerArray ( ) ;
2009-04-24 23:34:47 +00:00
2021-07-04 02:29:27 +00:00
std : : vector < generic_string > loadCommandlineParams ( const TCHAR * commandLine , const CmdLineParams * pCmdParams ) {
2018-07-02 18:48:40 +00:00
const CmdLineParamsDTO dto = CmdLineParamsDTO : : FromCmdLineParams ( * pCmdParams ) ;
2019-06-25 11:37:48 +00:00
return loadCommandlineParams ( commandLine , & dto ) ;
2018-07-02 18:48:40 +00:00
}
2019-06-25 11:37:48 +00:00
std : : vector < generic_string > loadCommandlineParams ( const TCHAR * commandLine , const CmdLineParamsDTO * pCmdParams ) ;
2009-09-04 00:10:01 +00:00
bool noOpenedDoc ( ) const ;
2009-11-15 17:01:52 +00:00
bool goToPreviousIndicator ( int indicID2Search , bool isWrap = true ) const ;
bool goToNextIndicator ( int indicID2Search , bool isWrap = true ) const ;
2010-09-25 17:04:44 +00:00
int wordCount ( ) ;
2015-07-15 12:09:31 +00:00
2012-08-25 19:23:16 +00:00
void wsTabConvert ( spaceTab whichWay ) ;
2010-12-05 19:33:48 +00:00
void doTrim ( trimOp whichPart ) ;
2012-11-24 20:14:52 +00:00
void removeEmptyLine ( bool isBlankContained ) ;
2019-02-01 00:00:36 +00:00
void removeDuplicateLines ( ) ;
2011-04-13 07:08:51 +00:00
void launchAnsiCharPanel ( ) ;
2011-04-20 21:45:18 +00:00
void launchClipboardHistoryPanel ( ) ;
2021-07-26 17:07:38 +00:00
void launchDocumentListPanel ( ) ;
2020-07-06 14:21:50 +00:00
void checkProjectMenuItem ( ) ;
2011-09-25 01:33:34 +00:00
void launchProjectPanel ( int cmdID , ProjectPanel * * pProjPanel , int panelID ) ;
2012-01-30 00:00:50 +00:00
void launchDocMap ( ) ;
2012-11-24 20:14:52 +00:00
void launchFunctionList ( ) ;
2020-09-18 22:36:03 +00:00
void launchFileBrowser ( const std : : vector < generic_string > & folders , const generic_string & selectedItemPath , bool fromScratch = false ) ;
2012-01-01 19:29:31 +00:00
void showAllQuotes ( ) const ;
static DWORD WINAPI threadTextPlayer ( void * text2display ) ;
static DWORD WINAPI threadTextTroller ( void * params ) ;
static int getRandomAction ( int ranNum ) ;
static bool deleteBack ( ScintillaEditView * pCurrentView , BufferID targetBufID ) ;
static bool deleteForward ( ScintillaEditView * pCurrentView , BufferID targetBufID ) ;
static bool selectBack ( ScintillaEditView * pCurrentView , BufferID targetBufID ) ;
2015-07-15 12:09:31 +00:00
2021-07-04 02:29:27 +00:00
static int getRandomNumber ( int rangeMax = - 1 ) {
2012-01-01 19:29:31 +00:00
int randomNumber = rand ( ) ;
if ( rangeMax = = - 1 )
return randomNumber ;
return ( rand ( ) % rangeMax ) ;
2015-07-15 12:09:31 +00:00
}
2014-03-27 01:30:31 +00:00
static DWORD WINAPI backupDocument ( void * params ) ;
2016-04-24 03:29:05 +00:00
static DWORD WINAPI monitorFileOnChange ( void * params ) ;
struct MonitorInfo final {
2016-05-11 00:18:04 +00:00
MonitorInfo ( Buffer * buf , HWND nppHandle ) :
_buffer ( buf ) , _nppHandle ( nppHandle ) { } ;
2016-04-24 03:29:05 +00:00
Buffer * _buffer = nullptr ;
2016-05-11 00:18:04 +00:00
HWND _nppHandle = nullptr ;
2016-04-24 03:29:05 +00:00
} ;
2018-10-03 13:53:30 +00:00
void monitoringStartOrStopAndUpdateUI ( Buffer * pBuf , bool isStarting ) ;
2020-08-11 14:27:03 +00:00
void updateCommandShortcuts ( ) ;
2009-04-24 23:34:47 +00:00
} ;