2012-04-15 16:54:38 +00:00
// This file is part of Notepad++ project
// Copyright (C)2003 Don HO <don.h@free.fr>
2009-04-24 23:34: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.
2009-04-24 23:34:47 +00:00
//
2012-04-15 16:54:38 +00:00
// Note that the GPL places important restrictions on "derived works", yet
2015-08-14 19:47:47 +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-14 19:47:47 +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
2015-08-14 19:47:47 +00:00
// installer, such as those produced by InstallShield.
2012-04-15 16:54:38 +00:00
// 3. Links to a library or executes a program that does any of the above.
2009-04-24 23:34: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.
2017-03-13 01:10:34 +00:00
2015-08-14 19:47:47 +00:00
# pragma once
2009-04-24 23:34:47 +00:00
# include "tinyxmlA.h"
# include "tinyxml.h"
# include "Scintilla.h"
# include "ScintillaRef.h"
# include "ToolBar.h"
# include "UserDefineLangReference.h"
# include "colors.h"
# include "shortcut.h"
# include "ContextMenu.h"
2014-02-11 00:26:24 +00:00
# include "dpiManager.h"
2015-05-31 13:57:17 +00:00
# include <assert.h>
2012-09-28 21:04:16 +00:00
# include <tchar.h>
2011-01-19 21:05:40 +00:00
class NativeLangSpeaker ;
2009-04-24 23:34:47 +00:00
const bool POS_VERTICAL = true ;
const bool POS_HORIZOTAL = false ;
2015-08-14 19:47:47 +00:00
const int UDD_SHOW = 1 ; // 0000 0001
2009-04-24 23:34:47 +00:00
const int UDD_DOCKED = 2 ; // 0000 0010
// 0 : 0000 0000 hide & undocked
// 1 : 0000 0001 show & undocked
// 2 : 0000 0010 hide & docked
// 3 : 0000 0011 show & docked
2016-09-11 09:45:56 +00:00
const int TAB_DRAWTOPBAR = 1 ; //0000 0000 0001
const int TAB_DRAWINACTIVETAB = 2 ; //0000 0000 0010
const int TAB_DRAGNDROP = 4 ; //0000 0000 0100
const int TAB_REDUCE = 8 ; //0000 0000 1000
const int TAB_CLOSEBUTTON = 16 ; //0000 0001 0000
const int TAB_DBCLK2CLOSE = 32 ; //0000 0010 0000
const int TAB_VERTICAL = 64 ; //0000 0100 0000
const int TAB_MULTILINE = 128 ; //0000 1000 0000
const int TAB_HIDE = 256 ; //0001 0000 0000
const int TAB_QUITONEMPTY = 512 ; //0010 0000 0000
2009-04-24 23:34:47 +00:00
2015-08-14 12:57:19 +00:00
2015-10-27 14:35:19 +00:00
enum class EolType : std : : uint8_t
2015-08-14 12:57:19 +00:00
{
windows ,
macos ,
unix ,
// special values
unknown , // can not be the first value for legacy code
osdefault = windows ,
} ;
/*!
* * \ brief Convert an int into a FormatType
* * \ param value An arbitrary int
* * \ param defvalue The default value to use if an invalid value is provided
*/
2015-10-27 14:35:19 +00:00
EolType convertIntToFormatType ( int value , EolType defvalue = EolType : : osdefault ) ;
2015-08-14 12:57:19 +00:00
2009-04-29 18:07:30 +00:00
enum UniMode { uni8Bit = 0 , uniUTF8 = 1 , uni16BE = 2 , uni16LE = 3 , uniCookie = 4 , uni7Bit = 5 , uni16BE_NoBOM = 6 , uni16LE_NoBOM = 7 , uniEnd } ;
2009-04-24 23:34:47 +00:00
enum ChangeDetect { cdDisabled = 0 , cdEnabled = 1 , cdAutoUpdate = 2 , cdGo2end = 3 , cdAutoUpdateGo2end = 4 } ;
enum BackupFeature { bak_none = 0 , bak_simple = 1 , bak_verbose = 2 } ;
enum OpenSaveDirSetting { dir_followCurrent = 0 , dir_last = 1 , dir_userDef = 2 } ;
2013-07-17 22:35:34 +00:00
enum MultiInstSetting { monoInst = 0 , multiInstOnSession = 1 , multiInst = 2 } ;
2009-04-24 23:34:47 +00:00
const int LANG_INDEX_INSTR = 0 ;
const int LANG_INDEX_INSTR2 = 1 ;
const int LANG_INDEX_TYPE = 2 ;
const int LANG_INDEX_TYPE2 = 3 ;
const int LANG_INDEX_TYPE3 = 4 ;
const int LANG_INDEX_TYPE4 = 5 ;
const int LANG_INDEX_TYPE5 = 6 ;
const int COPYDATA_PARAMS = 0 ;
const int COPYDATA_FILENAMESA = 1 ;
const int COPYDATA_FILENAMESW = 2 ;
2015-08-14 19:47:47 +00:00
# define PURE_LC_NONE 0
# define PURE_LC_BOL 1
# define PURE_LC_WSP 2
2013-01-27 01:03:53 +00:00
2015-08-14 19:47:47 +00:00
# define DECSEP_DOT 0
# define DECSEP_COMMA 1
# define DECSEP_BOTH 2
2013-01-27 01:03:53 +00:00
2014-06-02 07:02:46 +00:00
# define DROPBOX_AVAILABLE 1
# define ONEDRIVE_AVAILABLE 2
# define GOOGLEDRIVE_AVAILABLE 4
2012-08-12 00:09:35 +00:00
const TCHAR fontSizeStrs [ ] [ 3 ] = { TEXT ( " " ) , TEXT ( " 5 " ) , TEXT ( " 6 " ) , TEXT ( " 7 " ) , TEXT ( " 8 " ) , TEXT ( " 9 " ) , TEXT ( " 10 " ) , TEXT ( " 11 " ) , TEXT ( " 12 " ) , TEXT ( " 14 " ) , TEXT ( " 16 " ) , TEXT ( " 18 " ) , TEXT ( " 20 " ) , TEXT ( " 22 " ) , TEXT ( " 24 " ) , TEXT ( " 26 " ) , TEXT ( " 28 " ) } ;
2009-04-24 23:34:47 +00:00
const TCHAR localConfFile [ ] = TEXT ( " doLocalConf.xml " ) ;
const TCHAR notepadStyleFile [ ] = TEXT ( " asNotepad.xml " ) ;
2018-11-21 01:20:36 +00:00
const TCHAR pluginsForAllUsersFile [ ] = TEXT ( " pluginsForAllUsers.xml " ) ;
2009-04-24 23:34:47 +00:00
2015-05-31 20:40:07 +00:00
void cutString ( const TCHAR * str2cut , std : : vector < generic_string > & patternVect ) ;
2013-04-20 23:10:07 +00:00
2009-04-24 23:34:47 +00:00
struct Position
2015-08-14 19:47:47 +00:00
{
int _firstVisibleLine = 0 ;
int _startPos = 0 ;
int _endPos = 0 ;
int _xOffset = 0 ;
int _selMode = 0 ;
int _scrollWidth = 1 ;
2009-04-24 23:34:47 +00:00
} ;
2015-08-14 19:47:47 +00:00
2017-03-13 01:10:34 +00:00
struct MapPosition
{
2017-04-25 07:28:24 +00:00
int32_t _firstVisibleDisplayLine = - 1 ;
int32_t _firstVisibleDocLine = - 1 ; // map
int32_t _lastVisibleDocLine = - 1 ; // map
int32_t _nbLine = - 1 ; // map
int32_t _higherPos = - 1 ; // map
2017-04-17 23:31:41 +00:00
int32_t _width = - 1 ;
int32_t _height = - 1 ;
int32_t _wrapIndentMode = - 1 ;
2017-05-17 08:01:28 +00:00
int64_t _KByteInDoc = _maxPeekLenInKB ;
2017-04-17 23:31:41 +00:00
bool _isWrap = false ;
2017-05-17 08:01:28 +00:00
bool isValid ( ) const { return ( _firstVisibleDisplayLine ! = - 1 ) ; } ;
bool canScroll ( ) const { return ( _KByteInDoc < _maxPeekLenInKB ) ; } ; // _nbCharInDoc < _maxPeekLen : Don't scroll the document for the performance issue
private :
int64_t _maxPeekLenInKB = 512 ; // 512 KB
2017-03-13 01:10:34 +00:00
} ;
2015-08-14 19:47:47 +00:00
struct sessionFileInfo : public Position
{
2018-05-31 13:32:44 +00:00
sessionFileInfo ( const TCHAR * fn , const TCHAR * ln , int encoding , Position pos , const TCHAR * backupFilePath , FILETIME originalFileLastModifTimestamp , const MapPosition & mapPos ) :
2017-03-13 01:10:34 +00:00
_encoding ( encoding ) , Position ( pos ) , _originalFileLastModifTimestamp ( originalFileLastModifTimestamp ) , _mapPos ( mapPos )
2015-08-14 19:47:47 +00:00
{
2009-04-24 23:34:47 +00:00
if ( fn ) _fileName = fn ;
if ( ln ) _langName = ln ;
2014-03-31 01:01:54 +00:00
if ( backupFilePath ) _backupFilePath = backupFilePath ;
2015-08-14 19:47:47 +00:00
}
sessionFileInfo ( generic_string fn ) : _fileName ( fn ) { }
2009-04-24 23:34:47 +00:00
generic_string _fileName ;
generic_string _langName ;
2015-05-31 20:40:07 +00:00
std : : vector < size_t > _marks ;
std : : vector < size_t > _foldStates ;
2015-08-14 19:47:47 +00:00
int _encoding = - 1 ;
2014-03-31 01:01:54 +00:00
generic_string _backupFilePath ;
2018-05-31 13:32:44 +00:00
FILETIME _originalFileLastModifTimestamp = { } ;
2017-03-13 01:10:34 +00:00
MapPosition _mapPos ;
2009-04-24 23:34:47 +00:00
} ;
2015-08-14 19:47:47 +00:00
struct Session
{
2009-04-24 23:34:47 +00:00
size_t nbMainFiles ( ) const { return _mainViewFiles . size ( ) ; } ;
size_t nbSubFiles ( ) const { return _subViewFiles . size ( ) ; } ;
2015-08-14 19:47:47 +00:00
size_t _activeView = 0 ;
size_t _activeMainIndex = 0 ;
size_t _activeSubIndex = 0 ;
2015-05-31 20:40:07 +00:00
std : : vector < sessionFileInfo > _mainViewFiles ;
std : : vector < sessionFileInfo > _subViewFiles ;
2009-04-24 23:34:47 +00:00
} ;
2015-08-14 19:47:47 +00:00
struct CmdLineParams
{
bool _isNoPlugin = false ;
bool _isReadOnly = false ;
bool _isNoSession = false ;
bool _isNoTab = false ;
bool _isPreLaunch = false ;
bool _showLoadingTime = false ;
bool _alwaysOnTop = false ;
int _line2go = - 1 ;
int _column2go = - 1 ;
2016-04-19 18:00:55 +00:00
int _pos2go = - 1 ;
2015-08-14 19:47:47 +00:00
POINT _point ;
bool _isPointXValid = false ;
bool _isPointYValid = false ;
bool _isSessionFile = false ;
bool _isRecursive = false ;
LangType _langType = L_EXTERNAL ;
2013-07-25 17:41:25 +00:00
generic_string _localizationPath ;
2015-01-10 23:41:49 +00:00
generic_string _easterEggName ;
2015-08-14 19:47:47 +00:00
unsigned char _quoteType = ' \0 ' ;
2018-03-10 10:30:55 +00:00
int _ghostTypingSpeed = - 1 ; // -1: initial value 1: slow 2: fast 3: speed of light
2015-08-14 19:47:47 +00:00
CmdLineParams ( )
{
_point . x = 0 ;
_point . y = 0 ;
}
bool isPointValid ( ) const
{
return _isPointXValid & & _isPointYValid ;
}
2009-04-24 23:34:47 +00:00
} ;
2018-07-02 18:48:40 +00:00
// A POD class to send CmdLineParams through WM_COPYDATA and to Notepad_plus::loadCommandlineParams
struct CmdLineParamsDTO
{
bool _isReadOnly ;
bool _isNoSession ;
bool _isSessionFile ;
bool _isRecursive ;
int _line2go ;
int _column2go ;
int _pos2go ;
LangType _langType ;
static CmdLineParamsDTO FromCmdLineParams ( const CmdLineParams & params )
{
CmdLineParamsDTO dto ;
dto . _isReadOnly = params . _isReadOnly ;
dto . _isNoSession = params . _isNoSession ;
dto . _isSessionFile = params . _isSessionFile ;
dto . _isRecursive = params . _isRecursive ;
dto . _line2go = params . _line2go ;
dto . _column2go = params . _column2go ;
dto . _pos2go = params . _pos2go ;
dto . _langType = params . _langType ;
return dto ;
}
} ;
2015-08-14 19:47:47 +00:00
struct FloatingWindowInfo
{
2009-04-24 23:34:47 +00:00
int _cont ;
RECT _pos ;
2015-08-14 19:47:47 +00:00
FloatingWindowInfo ( int cont , int x , int y , int w , int h )
: _cont ( cont )
{
2009-04-24 23:34:47 +00:00
_pos . left = x ;
_pos . top = y ;
_pos . right = w ;
_pos . bottom = h ;
2015-08-14 19:47:47 +00:00
}
2009-04-24 23:34:47 +00:00
} ;
2015-08-14 19:47:47 +00:00
struct PluginDlgDockingInfo final
{
2009-08-03 00:37:30 +00:00
generic_string _name ;
2015-08-14 19:47:47 +00:00
int _internalID = - 1 ;
2009-04-24 23:34:47 +00:00
2015-08-14 19:47:47 +00:00
int _currContainer = - 1 ;
int _prevContainer = - 1 ;
bool _isVisible = false ;
2009-04-24 23:34:47 +00:00
2015-08-14 19:47:47 +00:00
PluginDlgDockingInfo ( const TCHAR * pluginName , int id , int curr , int prev , bool isVis )
: _internalID ( id ) , _currContainer ( curr ) , _prevContainer ( prev ) , _isVisible ( isVis ) , _name ( pluginName )
{ }
2009-04-24 23:34:47 +00:00
2015-08-14 19:47:47 +00:00
bool operator = = ( const PluginDlgDockingInfo & rhs ) const
{
return _internalID = = rhs . _internalID and _name = = rhs . _name ;
}
2009-04-24 23:34:47 +00:00
} ;
2015-08-14 19:47:47 +00:00
struct ContainerTabInfo final
{
int _cont = 0 ;
int _activeTab = 0 ;
2009-04-24 23:34:47 +00:00
ContainerTabInfo ( int cont , int activeTab ) : _cont ( cont ) , _activeTab ( activeTab ) { } ;
} ;
2015-08-14 19:47:47 +00:00
struct DockingManagerData final
{
int _leftWidth = 200 ;
int _rightWidth = 200 ;
int _topHeight = 200 ;
int _bottomHight = 200 ;
2009-04-24 23:34:47 +00:00
2015-08-14 19:47:47 +00:00
std : : vector < FloatingWindowInfo > _flaotingWindowInfo ;
std : : vector < PluginDlgDockingInfo > _pluginDockInfo ;
std : : vector < ContainerTabInfo > _containerTabInfo ;
2009-04-24 23:34:47 +00:00
2015-08-14 19:47:47 +00:00
bool getFloatingRCFrom ( int floatCont , RECT & rc ) const
{
2013-07-08 00:12:50 +00:00
for ( size_t i = 0 , fwiLen = _flaotingWindowInfo . size ( ) ; i < fwiLen ; + + i )
2009-04-24 23:34:47 +00:00
{
if ( _flaotingWindowInfo [ i ] . _cont = = floatCont )
2015-08-14 19:47:47 +00:00
{
rc . left = _flaotingWindowInfo [ i ] . _pos . left ;
rc . top = _flaotingWindowInfo [ i ] . _pos . top ;
rc . right = _flaotingWindowInfo [ i ] . _pos . right ;
rc . bottom = _flaotingWindowInfo [ i ] . _pos . bottom ;
2011-09-21 01:05:24 +00:00
return true ;
2015-08-14 19:47:47 +00:00
}
2011-09-21 01:05:24 +00:00
}
return false ;
2009-04-24 23:34:47 +00:00
}
} ;
2015-08-14 19:47:47 +00:00
2012-09-28 21:04:16 +00:00
const int FONTSTYLE_NONE = 0 ;
2009-04-24 23:34:47 +00:00
const int FONTSTYLE_BOLD = 1 ;
const int FONTSTYLE_ITALIC = 2 ;
const int FONTSTYLE_UNDERLINE = 4 ;
2012-11-06 01:34:40 +00:00
const int STYLE_NOT_USED = - 1 ;
2009-04-24 23:34:47 +00:00
const int COLORSTYLE_FOREGROUND = 0x01 ;
const int COLORSTYLE_BACKGROUND = 0x02 ;
const int COLORSTYLE_ALL = COLORSTYLE_FOREGROUND | COLORSTYLE_BACKGROUND ;
2015-08-14 19:47:47 +00:00
2009-04-24 23:34:47 +00:00
struct Style
{
2015-08-14 19:47:47 +00:00
int _styleID = - 1 ;
const TCHAR * _styleDesc = nullptr ;
COLORREF _fgColor = COLORREF ( STYLE_NOT_USED ) ;
COLORREF _bgColor = COLORREF ( STYLE_NOT_USED ) ;
int _colorStyle = COLORSTYLE_ALL ;
const TCHAR * _fontName = nullptr ;
int _fontStyle = FONTSTYLE_NONE ;
int _fontSize = STYLE_NOT_USED ;
int _nesting = FONTSTYLE_NONE ;
int _keywordClass = STYLE_NOT_USED ;
generic_string * _keywords = nullptr ;
2009-04-24 23:34:47 +00:00
2015-08-14 19:47:47 +00:00
Style ( ) = default ;
Style ( const Style & style )
2009-04-24 23:34:47 +00:00
{
2015-08-14 19:47:47 +00:00
_styleID = style . _styleID ;
_styleDesc = style . _styleDesc ;
_fgColor = style . _fgColor ;
_bgColor = style . _bgColor ;
_colorStyle = style . _colorStyle ;
_fontName = style . _fontName ;
_fontSize = style . _fontSize ;
_fontStyle = style . _fontStyle ;
2009-04-24 23:34:47 +00:00
_keywordClass = style . _keywordClass ;
2015-08-14 19:47:47 +00:00
_nesting = style . _nesting ;
_keywords = ( style . _keywords ) ? new generic_string ( * ( style . _keywords ) ) : nullptr ;
}
2009-04-24 23:34:47 +00:00
2015-08-14 19:47:47 +00:00
~ Style ( )
{
delete _keywords ;
}
Style & operator = ( const Style & style )
{
2009-04-24 23:34:47 +00:00
if ( this ! = & style )
{
2015-08-14 19:47:47 +00:00
_styleID = style . _styleID ;
_styleDesc = style . _styleDesc ;
_fgColor = style . _fgColor ;
_bgColor = style . _bgColor ;
_colorStyle = style . _colorStyle ;
_fontName = style . _fontName ;
_fontSize = style . _fontSize ;
_fontStyle = style . _fontStyle ;
_keywordClass = style . _keywordClass ;
_nesting = style . _nesting ;
if ( ! ( _keywords ) & & style . _keywords )
_keywords = new generic_string ( * ( style . _keywords ) ) ;
else if ( _keywords & & style . _keywords )
_keywords - > assign ( * ( style . _keywords ) ) ;
else if ( _keywords & & ! ( style . _keywords ) )
2009-04-24 23:34:47 +00:00
{
2015-08-14 19:47:47 +00:00
delete ( _keywords ) ;
_keywords = nullptr ;
2009-04-24 23:34:47 +00:00
}
}
return * this ;
2015-08-14 19:47:47 +00:00
}
2009-04-24 23:34:47 +00:00
2015-08-14 19:47:47 +00:00
void setKeywords ( const TCHAR * str )
{
2009-04-24 23:34:47 +00:00
if ( ! _keywords )
_keywords = new generic_string ( str ) ;
else
* _keywords = str ;
2015-08-14 19:47:47 +00:00
}
2009-04-24 23:34:47 +00:00
} ;
2015-08-14 19:47:47 +00:00
struct GlobalOverride final
2009-04-24 23:34:47 +00:00
{
2015-08-14 19:47:47 +00:00
bool isEnable ( ) const { return ( enableFg | | enableBg | | enableFont | | enableFontSize | | enableBold | | enableItalic | | enableUnderLine ) ; }
bool enableFg = false ;
bool enableBg = false ;
bool enableFont = false ;
bool enableFontSize = false ;
bool enableBold = false ;
bool enableItalic = false ;
bool enableUnderLine = false ;
2009-04-24 23:34:47 +00:00
} ;
2015-08-14 19:47:47 +00:00
2009-04-24 23:34:47 +00:00
struct StyleArray
{
public :
2015-08-14 19:47:47 +00:00
StyleArray & operator = ( const StyleArray & sa )
{
if ( this ! = & sa )
{
this - > _nbStyler = sa . _nbStyler ;
for ( int i = 0 ; i < _nbStyler ; + + i )
{
this - > _styleArray [ i ] = sa . _styleArray [ i ] ;
}
}
return * this ;
}
int getNbStyler ( ) const { return _nbStyler ; } ;
2009-04-24 23:34:47 +00:00
void setNbStyler ( int nb ) { _nbStyler = nb ; } ;
2016-06-05 18:29:21 +00:00
Style & getStyler ( size_t index )
2015-08-14 19:47:47 +00:00
{
2016-06-05 18:29:21 +00:00
assert ( index < SCE_STYLE_ARRAY_SIZE ) ;
2009-08-11 23:55:57 +00:00
return _styleArray [ index ] ;
2015-08-14 19:47:47 +00:00
}
2009-04-24 23:34:47 +00:00
2015-08-14 19:47:47 +00:00
bool hasEnoughSpace ( ) { return ( _nbStyler < SCE_STYLE_ARRAY_SIZE ) ; } ;
void addStyler ( int styleID , TiXmlNode * styleNode ) ;
2009-04-24 23:34:47 +00:00
2015-08-14 19:47:47 +00:00
void addStyler ( int styleID , const TCHAR * styleName )
{
2012-09-28 21:04:16 +00:00
_styleArray [ styleID ] . _styleID = styleID ;
_styleArray [ styleID ] . _styleDesc = styleName ;
_styleArray [ styleID ] . _fgColor = black ;
_styleArray [ styleID ] . _bgColor = white ;
2013-07-08 00:12:50 +00:00
+ + _nbStyler ;
2015-08-14 19:47:47 +00:00
}
2009-04-24 23:34:47 +00:00
2015-08-14 19:47:47 +00:00
int getStylerIndexByID ( int id )
{
for ( int i = 0 ; i < _nbStyler ; + + i )
{
if ( _styleArray [ i ] . _styleID = = id )
return i ;
}
return - 1 ;
}
2009-04-24 23:34:47 +00:00
2015-08-14 19:47:47 +00:00
int getStylerIndexByName ( const TCHAR * name ) const
{
2009-04-24 23:34:47 +00:00
if ( ! name )
return - 1 ;
2015-08-14 19:47:47 +00:00
for ( int i = 0 ; i < _nbStyler ; + + i )
{
2009-04-24 23:34:47 +00:00
if ( ! lstrcmp ( _styleArray [ i ] . _styleDesc , name ) )
2015-08-14 19:47:47 +00:00
return i ;
}
return - 1 ;
}
2009-04-24 23:34:47 +00:00
protected :
2012-10-07 21:49:52 +00:00
Style _styleArray [ SCE_STYLE_ARRAY_SIZE ] ;
2015-08-14 19:47:47 +00:00
int _nbStyler = 0 ;
2009-04-24 23:34:47 +00:00
} ;
2015-08-14 19:47:47 +00:00
2009-04-24 23:34:47 +00:00
struct LexerStyler : public StyleArray
{
2015-08-14 19:47:47 +00:00
public :
LexerStyler & operator = ( const LexerStyler & ls )
{
if ( this ! = & ls )
{
2016-07-10 00:21:15 +00:00
* ( static_cast < StyleArray * > ( this ) ) = ls ;
2015-08-14 19:47:47 +00:00
this - > _lexerName = ls . _lexerName ;
2009-08-03 00:37:30 +00:00
this - > _lexerDesc = ls . _lexerDesc ;
this - > _lexerUserExt = ls . _lexerUserExt ;
2015-08-14 19:47:47 +00:00
}
return * this ;
}
void setLexerName ( const TCHAR * lexerName )
{
_lexerName = lexerName ;
}
void setLexerDesc ( const TCHAR * lexerDesc )
{
_lexerDesc = lexerDesc ;
}
2009-04-24 23:34:47 +00:00
void setLexerUserExt ( const TCHAR * lexerUserExt ) {
2015-08-14 19:47:47 +00:00
_lexerUserExt = lexerUserExt ;
} ;
2009-04-24 23:34:47 +00:00
2015-08-14 19:47:47 +00:00
const TCHAR * getLexerName ( ) const { return _lexerName . c_str ( ) ; } ;
2009-08-03 00:37:30 +00:00
const TCHAR * getLexerDesc ( ) const { return _lexerDesc . c_str ( ) ; } ;
2015-08-14 19:47:47 +00:00
const TCHAR * getLexerUserExt ( ) const { return _lexerUserExt . c_str ( ) ; } ;
2009-04-24 23:34:47 +00:00
private :
2009-08-03 00:37:30 +00:00
generic_string _lexerName ;
generic_string _lexerDesc ;
generic_string _lexerUserExt ;
2009-04-24 23:34:47 +00:00
} ;
2015-08-14 19:47:47 +00:00
Add new languages support
Connect Scintilla Lexers to npp : SCLEX_ASN1 (Abstract Syntax Notation One), SCLEX_AVS (AviSynth), SCLEX_BLITZBASIC, SCLEX_PUREBASIC, SCLEX_FREEBASIC, SCLEX_CSOUND, SCLEX_ERLANG, SCLEX_ESCRIPT, SCLEX_FORTH, SCLEX_LATEX, SCLEX_MMIXAL, SCLEX_NIMROD, SCLEX_NNCRONTAB, SCLEX_OSCRIPT, SCLEX_REBOL, SCLEX_REGISTRY, SCLEX_RUST, SCLEX_SPICE, SCLEX_TXT2TAGS
Connect Scintilla Lexers to npp :
asn1 (Abstract Syntax Notation One) : https://fr.wikipedia.org/wiki/ASN.1#Exemple
avs (AviSynth) : http://avisynth.nl/index.php/Script_examples
blitzbasic : http://www.blitzbasic.com/bmdocs/command.php?name=Mid&ref=2d_cat
http://www.blitzbasic.com/codearcs/codearcs.php?cat=8"
csound : http://www.csounds.com/manual/html/PrefaceGettingStarted.html
erlang : http://erlang.org/doc/man/file.html
http://erlang.org/documentation/doc-5.3.6.13/doc/getting_started/getting_started.html"
escript : http://erlang.org/doc/man/escript.html
forth : http://wiki.c2.com/?ExampleForthCode
freebasic : http://www.freebasic.net/
latex : http://physics.clarku.edu/sip/tutorials/TeX/intro.html (Sample LaTeX file)
mmixal : http://mmix.cs.hm.edu/examples/hello.html
nimrod : http://www.csse.monash.edu.au/~nimrod/nimrodportal/manual/planfileexamples.shtml
nncrontab : http://www.nncron.ru/help/EN/working/cron-format.htm
oscript : http://www.oscriptadventures.com/
purebasic : https://www.purebasic.com/documentation/reference/ide_form.html
rebol : http://www.rebol.net/cookbook/recipes/0031.html
registry : windows registry file
rust : http://rustbyexample.com/std_misc/file/open.html
spice : http://www.seas.upenn.edu/~jan/spice/spice.overview.html
txt2tags : https://github.com/txt2tags/txt2tags/blob/master/samples/sample.t2t
2016-11-13 18:42:23 +00:00
const int MAX_LEXER_STYLE = 100 ;
2009-04-24 23:34:47 +00:00
struct LexerStylerArray
{
public :
LexerStylerArray ( ) : _nbLexerStyler ( 0 ) { } ;
2015-08-14 19:47:47 +00:00
LexerStylerArray & operator = ( const LexerStylerArray & lsa )
{
if ( this ! = & lsa )
{
this - > _nbLexerStyler = lsa . _nbLexerStyler ;
for ( int i = 0 ; i < this - > _nbLexerStyler ; + + i )
this - > _lexerStylerArray [ i ] = lsa . _lexerStylerArray [ i ] ;
}
return * this ;
}
int getNbLexer ( ) const { return _nbLexerStyler ; } ;
LexerStyler & getLexerFromIndex ( int index )
{
return _lexerStylerArray [ index ] ;
} ;
const TCHAR * getLexerNameFromIndex ( int index ) const { return _lexerStylerArray [ index ] . getLexerName ( ) ; }
2009-04-24 23:34:47 +00:00
const TCHAR * getLexerDescFromIndex ( int index ) const { return _lexerStylerArray [ index ] . getLexerDesc ( ) ; }
2015-08-14 19:47:47 +00:00
LexerStyler * getLexerStylerByName ( const TCHAR * lexerName ) {
2009-04-24 23:34:47 +00:00
if ( ! lexerName ) return NULL ;
2015-08-14 19:47:47 +00:00
for ( int i = 0 ; i < _nbLexerStyler ; + + i )
{
if ( ! lstrcmp ( _lexerStylerArray [ i ] . getLexerName ( ) , lexerName ) )
return & ( _lexerStylerArray [ i ] ) ;
}
return NULL ;
} ;
bool hasEnoughSpace ( ) { return ( _nbLexerStyler < MAX_LEXER_STYLE ) ; } ;
void addLexerStyler ( const TCHAR * lexerName , const TCHAR * lexerDesc , const TCHAR * lexerUserExt , TiXmlNode * lexerNode ) ;
2009-04-24 23:34:47 +00:00
void eraseAll ( ) ;
private :
LexerStyler _lexerStylerArray [ MAX_LEXER_STYLE ] ;
int _nbLexerStyler ;
} ;
2015-08-14 12:57:19 +00:00
struct NewDocDefaultSettings final
2009-04-24 23:34:47 +00:00
{
2015-10-27 14:35:19 +00:00
EolType _format = EolType : : osdefault ;
2015-08-14 12:57:19 +00:00
UniMode _unicodeMode = uniCookie ;
bool _openAnsiAsUtf8 = true ;
LangType _lang = L_TEXT ;
int _codepage = - 1 ; // -1 when not using
2009-04-24 23:34:47 +00:00
} ;
2015-08-14 12:57:19 +00:00
2017-01-01 17:28:25 +00:00
struct LangMenuItem final
2015-08-14 12:57:19 +00:00
{
2009-04-24 23:34:47 +00:00
LangType _langType ;
int _cmdID ;
generic_string _langName ;
LangMenuItem ( LangType lt , int cmdID = 0 , generic_string langName = TEXT ( " " ) ) :
_langType ( lt ) , _cmdID ( cmdID ) , _langName ( langName ) { } ;
} ;
2017-01-01 17:28:25 +00:00
struct PrintSettings final {
bool _printLineNumber = true ;
int _printOption = SC_PRINT_COLOURONWHITE ;
2015-08-14 19:47:47 +00:00
2009-04-24 23:34:47 +00:00
generic_string _headerLeft ;
generic_string _headerMiddle ;
generic_string _headerRight ;
generic_string _headerFontName ;
2017-01-01 17:28:25 +00:00
int _headerFontStyle = 0 ;
int _headerFontSize = 0 ;
2015-08-14 19:47:47 +00:00
2009-04-24 23:34:47 +00:00
generic_string _footerLeft ;
generic_string _footerMiddle ;
generic_string _footerRight ;
generic_string _footerFontName ;
2017-01-01 17:28:25 +00:00
int _footerFontStyle = 0 ;
int _footerFontSize = 0 ;
2009-04-24 23:34:47 +00:00
RECT _marge ;
2017-01-01 17:28:25 +00:00
PrintSettings ( ) {
_marge . left = 0 ; _marge . top = 0 ; _marge . right = 0 ; _marge . bottom = 0 ;
} ;
2009-04-24 23:34:47 +00:00
bool isHeaderPresent ( ) const {
return ( ( _headerLeft ! = TEXT ( " " ) ) | | ( _headerMiddle ! = TEXT ( " " ) ) | | ( _headerRight ! = TEXT ( " " ) ) ) ;
} ;
bool isFooterPresent ( ) const {
return ( ( _footerLeft ! = TEXT ( " " ) ) | | ( _footerMiddle ! = TEXT ( " " ) ) | | ( _footerRight ! = TEXT ( " " ) ) ) ;
} ;
bool isUserMargePresent ( ) const {
return ( ( _marge . left ! = 0 ) | | ( _marge . top ! = 0 ) | | ( _marge . right ! = 0 ) | | ( _marge . bottom ! = 0 ) ) ;
} ;
} ;
2015-08-14 19:47:47 +00:00
class Date final
{
2009-08-12 01:13:29 +00:00
public :
2015-08-14 19:47:47 +00:00
Date ( ) = default ;
Date ( unsigned long year , unsigned long month , unsigned long day )
: _year ( year )
, _month ( month )
, _day ( day )
{
assert ( year > 0 & & year < = 9999 ) ; // I don't think Notepad++ will last till AD 10000 :)
assert ( month > 0 & & month < = 12 ) ;
assert ( day > 0 & & day < = 31 ) ;
assert ( ! ( month = = 2 & & day > 29 ) & &
! ( month = = 4 & & day > 30 ) & &
! ( month = = 6 & & day > 30 ) & &
! ( month = = 9 & & day > 30 ) & &
! ( month = = 11 & & day > 30 ) ) ;
}
2016-07-18 00:08:29 +00:00
explicit Date ( const TCHAR * dateStr ) ;
2015-08-14 19:47:47 +00:00
// The constructor which makes the date of number of days from now
// nbDaysFromNow could be negative if user want to make a date in the past
// if the value of nbDaysFromNow is 0 then the date will be now
2015-05-31 13:57:17 +00:00
Date ( int nbDaysFromNow ) ;
2009-08-12 01:13:29 +00:00
2015-08-14 19:47:47 +00:00
void now ( ) ;
generic_string toString ( ) const // Return Notepad++ date format : YYYYMMDD
{
TCHAR dateStr [ 16 ] ;
wsprintf ( dateStr , TEXT ( " %04u%02u%02u " ) , _year , _month , _day ) ;
return dateStr ;
}
bool operator < ( const Date & compare ) const
{
if ( this - > _year ! = compare . _year )
return ( this - > _year < compare . _year ) ;
if ( this - > _month ! = compare . _month )
return ( this - > _month < compare . _month ) ;
return ( this - > _day < compare . _day ) ;
}
bool operator > ( const Date & compare ) const
{
if ( this - > _year ! = compare . _year )
return ( this - > _year > compare . _year ) ;
if ( this - > _month ! = compare . _month )
return ( this - > _month > compare . _month ) ;
return ( this - > _day > compare . _day ) ;
}
bool operator = = ( const Date & compare ) const
{
if ( this - > _year ! = compare . _year )
return false ;
if ( this - > _month ! = compare . _month )
return false ;
return ( this - > _day = = compare . _day ) ;
}
bool operator ! = ( const Date & compare ) const
{
if ( this - > _year ! = compare . _year )
return true ;
if ( this - > _month ! = compare . _month )
return true ;
return ( this - > _day ! = compare . _day ) ;
}
2009-08-12 01:13:29 +00:00
private :
2015-08-14 19:47:47 +00:00
unsigned long _year = 2008 ;
unsigned long _month = 4 ;
unsigned long _day = 26 ;
2009-08-12 01:13:29 +00:00
} ;
2015-08-14 19:47:47 +00:00
class MatchedPairConf final
{
public :
bool hasUserDefinedPairs ( ) const { return _matchedPairs . size ( ) ! = 0 ; }
bool hasDefaultPairs ( ) const { return _doParentheses | | _doBrackets | | _doCurlyBrackets | | _doQuotes | | _doDoubleQuotes | | _doHtmlXmlTag ; }
bool hasAnyPairsPair ( ) const { return hasUserDefinedPairs ( ) | | hasDefaultPairs ( ) ; }
public :
std : : vector < std : : pair < char , char > > _matchedPairs ;
std : : vector < std : : pair < char , char > > _matchedPairsInit ; // used only on init
bool _doHtmlXmlTag = false ;
bool _doParentheses = false ;
bool _doBrackets = false ;
bool _doCurlyBrackets = false ;
bool _doQuotes = false ;
bool _doDoubleQuotes = false ;
2013-09-02 09:05:37 +00:00
} ;
2015-08-14 19:47:47 +00:00
struct NppGUI final
2009-04-24 23:34:47 +00:00
{
2015-08-14 19:47:47 +00:00
NppGUI ( )
{
2009-04-24 23:34:47 +00:00
_appPos . left = 0 ;
_appPos . top = 0 ;
2016-10-23 01:50:41 +00:00
_appPos . right = 1100 ;
_appPos . bottom = 700 ;
2009-04-24 23:34:47 +00:00
_defaultDir [ 0 ] = 0 ;
_defaultDirExp [ 0 ] = 0 ;
2015-08-14 19:47:47 +00:00
}
2016-10-23 01:50:41 +00:00
toolBarStatusType _toolBarStatus = TB_STANDARD ;
2015-08-14 19:47:47 +00:00
bool _toolbarShow = true ;
bool _statusBarShow = true ;
bool _menuBarShow = true ;
2009-04-24 23:34:47 +00:00
2015-08-14 19:47:47 +00:00
// 1st bit : draw top bar;
2009-04-24 23:34:47 +00:00
// 2nd bit : draw inactive tabs
// 3rd bit : enable drag & drop
// 4th bit : reduce the height
// 5th bit : enable vertical
// 6th bit : enable multiline
// 0:don't draw; 1:draw top bar 2:draw inactive tabs 3:draw both 7:draw both+drag&drop
2016-10-23 01:50:41 +00:00
int _tabStatus = ( TAB_DRAWTOPBAR | TAB_DRAWINACTIVETAB | TAB_DRAGNDROP | TAB_REDUCE | TAB_CLOSEBUTTON ) ;
2009-04-24 23:34:47 +00:00
2016-10-23 01:50:41 +00:00
bool _splitterPos = POS_VERTICAL ;
2015-08-14 19:47:47 +00:00
int _userDefineDlgStatus = UDD_DOCKED ;
2009-04-24 23:34:47 +00:00
2016-10-23 01:50:41 +00:00
int _tabSize = 4 ;
2015-08-14 19:47:47 +00:00
bool _tabReplacedBySpace = false ;
2009-04-24 23:34:47 +00:00
2015-08-14 19:47:47 +00:00
ChangeDetect _fileAutoDetection = cdEnabled ;
ChangeDetect _fileAutoDetectionOriginalValue = cdEnabled ;
2016-10-23 01:50:41 +00:00
bool _checkHistoryFiles = false ;
2009-04-24 23:34:47 +00:00
RECT _appPos ;
2015-08-14 19:47:47 +00:00
bool _isMaximized = false ;
bool _isMinimizedToTray = false ;
bool _rememberLastSession = true ; // remember next session boolean will be written in the settings
bool _isCmdlineNosessionActivated = false ; // used for if -nosession is indicated on the launch time
bool _detectEncoding = true ;
bool _doTaskList = true ;
bool _maitainIndent = true ;
bool _enableSmartHilite = true ;
2016-10-13 00:01:09 +00:00
2015-08-14 19:47:47 +00:00
bool _smartHiliteCaseSensitive = false ;
2016-10-13 00:01:09 +00:00
bool _smartHiliteWordOnly = true ;
bool _smartHiliteUseFindSettings = false ;
2016-10-28 09:47:36 +00:00
bool _smartHiliteOnAnotherView = false ;
2016-09-09 17:31:46 +00:00
2015-08-14 19:47:47 +00:00
bool _disableSmartHiliteTmp = false ;
bool _enableTagsMatchHilite = true ;
bool _enableTagAttrsHilite = true ;
bool _enableHiliteNonHTMLZone = false ;
bool _styleMRU = true ;
char _leftmostDelimiter = ' ( ' ;
char _rightmostDelimiter = ' ) ' ;
bool _delimiterSelectionOnEntireDocument = false ;
bool _backSlashIsEscapeCharacterForSql = true ;
2013-06-08 23:17:59 +00:00
2017-01-15 21:16:17 +00:00
bool _isWordCharDefault = true ;
std : : string _customWordChars ;
2009-04-24 23:34:47 +00:00
// 0 : do nothing
// 1 : don't draw underline
// 2 : draw underline
2017-02-17 09:12:20 +00:00
int _styleURL = 2 ;
2009-04-24 23:34:47 +00:00
NewDocDefaultSettings _newDocDefaultSettings ;
2015-08-14 19:47:47 +00:00
2009-04-24 23:34:47 +00:00
void setTabReplacedBySpace ( bool b ) { _tabReplacedBySpace = b ; } ;
const NewDocDefaultSettings & getNewDocDefaultSettings ( ) const { return _newDocDefaultSettings ; } ;
2015-05-31 20:40:07 +00:00
std : : vector < LangMenuItem > _excludedLangList ;
2017-01-17 01:08:54 +00:00
bool _isLangMenuCompact = true ;
2009-04-24 23:34:47 +00:00
PrintSettings _printSettings ;
2015-08-14 19:47:47 +00:00
BackupFeature _backup = bak_none ;
bool _useDir = false ;
2009-08-03 00:37:30 +00:00
generic_string _backupDir ;
2009-04-24 23:34:47 +00:00
DockingManagerData _dockingData ;
GlobalOverride _globalOverride ;
2014-02-16 02:13:05 +00:00
enum AutocStatus { autoc_none , autoc_func , autoc_word , autoc_both } ;
2015-08-14 19:47:47 +00:00
AutocStatus _autocStatus = autoc_both ;
size_t _autocFromLen = 1 ;
2016-10-07 13:17:55 +00:00
bool _autocIgnoreNumbers = true ;
2017-02-18 01:04:59 +00:00
bool _funcParams = true ;
2013-09-02 09:05:37 +00:00
MatchedPairConf _matchedPairConf ;
2009-04-24 23:34:47 +00:00
generic_string _definedSessionExt ;
2015-06-13 15:10:02 +00:00
generic_string _definedWorkspaceExt ;
2009-04-24 23:34:47 +00:00
2015-08-14 19:47:47 +00:00
struct AutoUpdateOptions
{
2016-10-23 01:50:41 +00:00
bool _doAutoUpdate = true ;
int _intervalDays = 15 ;
2015-08-14 19:47:47 +00:00
Date _nextUpdateDate ;
2016-10-23 01:50:41 +00:00
AutoUpdateOptions ( ) : _nextUpdateDate ( Date ( ) ) { } ;
2015-08-14 19:47:47 +00:00
}
_autoUpdateOpt ;
bool _doesExistUpdater = false ;
2017-02-18 01:04:59 +00:00
int _caretBlinkRate = 600 ;
2015-08-14 19:47:47 +00:00
int _caretWidth = 1 ;
bool _enableMultiSelection = false ;
bool _shortTitlebar = false ;
OpenSaveDirSetting _openSaveDir = dir_followCurrent ;
2009-04-24 23:34:47 +00:00
TCHAR _defaultDir [ MAX_PATH ] ;
TCHAR _defaultDirExp [ MAX_PATH ] ; //expanded environment variables
generic_string _themeName ;
2015-08-14 19:47:47 +00:00
MultiInstSetting _multiInstSetting = monoInst ;
bool _fileSwitcherWithoutExtColumn = false ;
2014-05-17 15:35:09 +00:00
bool isSnapshotMode ( ) const { return _isSnapshotMode & & _rememberLastSession & & ! _isCmdlineNosessionActivated ; } ;
2015-08-14 19:47:47 +00:00
bool _isSnapshotMode = true ;
size_t _snapshotBackupTiming = 7000 ;
2015-07-06 17:06:46 +00:00
generic_string _cloudPath ; // this option will never be read/written from/to config.xml
2015-08-14 19:47:47 +00:00
unsigned char _availableClouds = ' \0 ' ; // this option will never be read/written from/to config.xml
2015-11-26 18:09:40 +00:00
bool _useNewStyleSaveDlg = false ;
2016-08-28 22:13:28 +00:00
enum SearchEngineChoice { se_custom = 0 , se_duckDuckGo = 1 , se_google = 2 , se_bing = 3 , se_yahoo = 4 } ;
SearchEngineChoice _searchEngineChoice = se_google ;
generic_string _searchEngineCustom ;
2016-09-13 21:12:36 +00:00
bool _isFolderDroppedOpenFiles = false ;
2017-04-27 11:03:31 +00:00
2017-06-11 14:52:03 +00:00
bool _isDocPeekOnTab = false ;
2017-05-14 18:26:23 +00:00
bool _isDocPeekOnMap = false ;
2009-04-24 23:34:47 +00:00
} ;
struct ScintillaViewParams
{
2015-11-26 18:09:40 +00:00
bool _lineNumberMarginShow = true ;
bool _bookMarkMarginShow = true ;
folderStyle _folderStyle = FOLDER_STYLE_BOX ; //"simple", "arrow", "circle", "box" and "none"
lineWrapMethod _lineWrapMethod = LINEWRAP_ALIGNED ;
bool _foldMarginShow = true ;
bool _indentGuideLineShow = true ;
bool _currentLineHilitingShow = true ;
bool _wrapSymbolShow = false ;
bool _doWrap = false ;
int _edgeMode = EDGE_NONE ;
int _edgeNbColumn = 80 ;
int _zoom = 0 ;
int _zoom2 = 0 ;
bool _whiteSpaceShow = false ;
2017-08-01 17:02:01 +00:00
bool _eolShow = false ;
2015-11-26 18:09:40 +00:00
int _borderWidth = 2 ;
2016-06-30 01:31:13 +00:00
bool _scrollBeyondLastLine = false ;
2015-11-26 18:09:40 +00:00
bool _disableAdvancedScrolling = false ;
bool _doSmoothFont = false ;
2015-12-04 18:01:28 +00:00
bool _showBorderEdge = true ;
2009-04-24 23:34:47 +00:00
} ;
const int NB_LIST = 20 ;
const int NB_MAX_LRF_FILE = 30 ;
const int NB_MAX_USER_LANG = 30 ;
const int NB_MAX_EXTERNAL_LANG = 30 ;
2010-05-24 01:03:51 +00:00
const int NB_MAX_IMPORTED_UDL = 50 ;
2009-04-24 23:34:47 +00:00
2015-08-14 19:47:47 +00:00
const int NB_MAX_FINDHISTORY_FIND = 30 ;
2009-04-24 23:34:47 +00:00
const int NB_MAX_FINDHISTORY_REPLACE = 30 ;
2015-08-14 19:47:47 +00:00
const int NB_MAX_FINDHISTORY_PATH = 30 ;
2009-04-24 23:34:47 +00:00
const int NB_MAX_FINDHISTORY_FILTER = 20 ;
2009-08-08 13:30:13 +00:00
const int MASK_ReplaceBySpc = 0x80 ;
const int MASK_TabSize = 0x7F ;
2015-08-14 19:47:47 +00:00
struct Lang final
2009-04-24 23:34:47 +00:00
{
2015-08-14 19:47:47 +00:00
LangType _langID = L_TEXT ;
2009-08-03 00:37:30 +00:00
generic_string _langName ;
2015-08-14 19:47:47 +00:00
const TCHAR * _defaultExtList = nullptr ;
2009-04-24 23:34:47 +00:00
const TCHAR * _langKeyWordList [ NB_LIST ] ;
2015-08-14 19:47:47 +00:00
const TCHAR * _pCommentLineSymbol = nullptr ;
const TCHAR * _pCommentStart = nullptr ;
const TCHAR * _pCommentEnd = nullptr ;
bool _isTabReplacedBySpace = false ;
int _tabSize = - 1 ;
Lang ( )
{
2013-07-08 00:12:50 +00:00
for ( int i = 0 ; i < NB_LIST ; _langKeyWordList [ i ] = NULL , + + i ) ;
2015-08-14 19:47:47 +00:00
}
2015-10-11 19:04:22 +00:00
Lang ( LangType langID , const TCHAR * name ) : _langID ( langID ) , _langName ( name ? name : TEXT ( " " ) )
2015-08-14 19:47:47 +00:00
{
for ( int i = 0 ; i < NB_LIST ; _langKeyWordList [ i ] = NULL , + + i ) ;
}
~ Lang ( ) = default ;
2009-04-24 23:34:47 +00:00
void setDefaultExtList ( const TCHAR * extLst ) {
_defaultExtList = extLst ;
2015-08-14 19:47:47 +00:00
}
2009-04-24 23:34:47 +00:00
void setCommentLineSymbol ( const TCHAR * commentLine ) {
_pCommentLineSymbol = commentLine ;
2015-08-14 19:47:47 +00:00
}
2009-04-24 23:34:47 +00:00
void setCommentStart ( const TCHAR * commentStart ) {
_pCommentStart = commentStart ;
2015-08-14 19:47:47 +00:00
}
2009-04-24 23:34:47 +00:00
void setCommentEnd ( const TCHAR * commentEnd ) {
_pCommentEnd = commentEnd ;
2015-08-14 19:47:47 +00:00
}
2009-04-24 23:34:47 +00:00
2015-08-14 19:47:47 +00:00
void setTabInfo ( int tabInfo )
{
if ( tabInfo ! = - 1 & & tabInfo & MASK_TabSize )
{
_isTabReplacedBySpace = ( tabInfo & MASK_ReplaceBySpc ) ! = 0 ;
_tabSize = tabInfo & MASK_TabSize ;
}
}
2009-08-08 13:30:13 +00:00
2009-04-24 23:34:47 +00:00
const TCHAR * getDefaultExtList ( ) const {
return _defaultExtList ;
2015-08-14 19:47:47 +00:00
}
2009-04-24 23:34:47 +00:00
void setWords ( const TCHAR * words , int index ) {
_langKeyWordList [ index ] = words ;
2015-08-14 19:47:47 +00:00
}
2009-04-24 23:34:47 +00:00
const TCHAR * getWords ( int index ) const {
return _langKeyWordList [ index ] ;
2015-08-14 19:47:47 +00:00
}
2009-04-24 23:34:47 +00:00
LangType getLangID ( ) const { return _langID ; } ;
2009-08-03 00:37:30 +00:00
const TCHAR * getLangName ( ) const { return _langName . c_str ( ) ; } ;
2009-08-08 13:30:13 +00:00
2015-08-14 19:47:47 +00:00
int getTabInfo ( ) const
{
if ( _tabSize = = - 1 ) return - 1 ;
return ( _isTabReplacedBySpace ? 0x80 : 0x00 ) | _tabSize ;
}
2009-04-24 23:34:47 +00:00
} ;
2015-08-14 19:47:47 +00:00
class UserLangContainer final
{
public :
2017-07-02 19:19:19 +00:00
UserLangContainer ( ) : _name ( TEXT ( " new user define " ) ) , _ext ( TEXT ( " " ) ) , _udlVersion ( TEXT ( " " ) )
2015-08-14 19:47:47 +00:00
{
2017-07-02 19:19:19 +00:00
init ( ) ;
2015-08-14 19:47:47 +00:00
}
UserLangContainer ( const TCHAR * name , const TCHAR * ext , const TCHAR * udlVer ) : _name ( name ) , _ext ( ext ) , _udlVersion ( udlVer )
{
2017-07-02 19:19:19 +00:00
init ( ) ;
2015-08-14 19:47:47 +00:00
}
2009-04-24 23:34:47 +00:00
2015-08-14 19:47:47 +00:00
UserLangContainer & operator = ( const UserLangContainer & ulc )
{
2009-04-24 23:34:47 +00:00
if ( this ! = & ulc )
2015-08-14 19:47:47 +00:00
{
2009-04-24 23:34:47 +00:00
this - > _name = ulc . _name ;
this - > _ext = ulc . _ext ;
2012-09-28 21:04:16 +00:00
this - > _udlVersion = ulc . _udlVersion ;
2009-04-24 23:34:47 +00:00
this - > _isCaseIgnored = ulc . _isCaseIgnored ;
this - > _styleArray = ulc . _styleArray ;
2012-09-28 21:04:16 +00:00
this - > _allowFoldOfComments = ulc . _allowFoldOfComments ;
2013-01-27 01:03:53 +00:00
this - > _forcePureLC = ulc . _forcePureLC ;
this - > _decimalSeparator = ulc . _decimalSeparator ;
2012-09-28 21:04:16 +00:00
this - > _foldCompact = ulc . _foldCompact ;
2009-04-24 23:34:47 +00:00
int nbStyler = this - > _styleArray . getNbStyler ( ) ;
2013-07-08 00:12:50 +00:00
for ( int i = 0 ; i < nbStyler ; + + i )
2009-04-24 23:34:47 +00:00
{
Style & st = this - > _styleArray . getStyler ( i ) ;
if ( st . _bgColor = = COLORREF ( - 1 ) )
st . _bgColor = white ;
if ( st . _fgColor = = COLORREF ( - 1 ) )
st . _fgColor = black ;
}
2015-08-14 19:47:47 +00:00
2013-07-08 00:12:50 +00:00
for ( int i = 0 ; i < SCE_USER_KWLIST_TOTAL ; + + i )
2012-09-28 21:04:16 +00:00
lstrcpy ( this - > _keywordLists [ i ] , ulc . _keywordLists [ i ] ) ;
2013-01-27 01:03:53 +00:00
2013-07-08 00:12:50 +00:00
for ( int i = 0 ; i < SCE_USER_TOTAL_KEYWORD_GROUPS ; + + i )
2015-08-14 19:47:47 +00:00
_isPrefix [ i ] = ulc . _isPrefix [ i ] ;
2009-04-24 23:34:47 +00:00
}
return * this ;
2015-08-14 19:47:47 +00:00
}
2009-04-24 23:34:47 +00:00
const TCHAR * getName ( ) { return _name . c_str ( ) ; } ;
const TCHAR * getExtention ( ) { return _ext . c_str ( ) ; } ;
2012-09-28 21:04:16 +00:00
const TCHAR * getUdlVersion ( ) { return _udlVersion . c_str ( ) ; } ;
2009-04-24 23:34:47 +00:00
private :
2012-09-28 21:04:16 +00:00
StyleArray _styleArray ;
2009-04-24 23:34:47 +00:00
generic_string _name ;
generic_string _ext ;
2012-09-28 21:04:16 +00:00
generic_string _udlVersion ;
2009-04-24 23:34:47 +00:00
2012-09-28 21:04:16 +00:00
TCHAR _keywordLists [ SCE_USER_KWLIST_TOTAL ] [ max_char ] ;
2013-01-27 01:03:53 +00:00
bool _isPrefix [ SCE_USER_TOTAL_KEYWORD_GROUPS ] ;
2009-04-24 23:34:47 +00:00
bool _isCaseIgnored ;
2012-09-28 21:04:16 +00:00
bool _allowFoldOfComments ;
2013-01-27 01:03:53 +00:00
int _forcePureLC ;
2015-08-14 19:47:47 +00:00
int _decimalSeparator ;
2012-09-28 21:04:16 +00:00
bool _foldCompact ;
2015-08-14 19:47:47 +00:00
// nakama zone
friend class Notepad_plus ;
friend class ScintillaEditView ;
friend class NppParameters ;
friend class SharedParametersDialog ;
friend class FolderStyleDialog ;
friend class KeyWordsStyleDialog ;
friend class CommentStyleDialog ;
friend class SymbolsStyleDialog ;
friend class UserDefineDialog ;
friend class StylerDlg ;
2017-07-02 19:19:19 +00:00
void init ( )
{
_forcePureLC = PURE_LC_NONE ;
_decimalSeparator = DECSEP_DOT ;
_foldCompact = false ;
_isCaseIgnored = false ;
_allowFoldOfComments = false ;
for ( int i = 0 ; i < SCE_USER_KWLIST_TOTAL ; + + i )
* _keywordLists [ i ] = ' \0 ' ;
for ( int i = 0 ; i < SCE_USER_TOTAL_KEYWORD_GROUPS ; + + i )
_isPrefix [ i ] = false ;
}
2009-04-24 23:34:47 +00:00
} ;
# define MAX_EXTERNAL_LEXER_NAME_LEN 16
# define MAX_EXTERNAL_LEXER_DESC_LEN 32
2015-08-14 19:47:47 +00:00
class ExternalLangContainer final
2009-04-24 23:34:47 +00:00
{
public :
TCHAR _name [ MAX_EXTERNAL_LEXER_NAME_LEN ] ;
TCHAR _desc [ MAX_EXTERNAL_LEXER_DESC_LEN ] ;
2015-08-14 19:47:47 +00:00
ExternalLangContainer ( const TCHAR * name , const TCHAR * desc )
{
2009-04-24 23:34:47 +00:00
generic_strncpy ( _name , name , MAX_EXTERNAL_LEXER_NAME_LEN ) ;
generic_strncpy ( _desc , desc , MAX_EXTERNAL_LEXER_DESC_LEN ) ;
2015-08-14 19:47:47 +00:00
}
2009-04-24 23:34:47 +00:00
} ;
2015-08-14 19:47:47 +00:00
struct FindHistory final
{
2009-04-24 23:34:47 +00:00
enum searchMode { normal , extended , regExpr } ;
enum transparencyMode { none , onLossingFocus , persistant } ;
2018-02-01 09:09:24 +00:00
bool _isSearch2ButtonsMode = false ;
2015-08-14 19:47:47 +00:00
int _nbMaxFindHistoryPath = 10 ;
int _nbMaxFindHistoryFilter = 10 ;
int _nbMaxFindHistoryFind = 10 ;
int _nbMaxFindHistoryReplace = 10 ;
std : : vector < generic_string > _findHistoryPaths ;
2015-05-31 20:40:07 +00:00
std : : vector < generic_string > _findHistoryFilters ;
std : : vector < generic_string > _findHistoryFinds ;
std : : vector < generic_string > _findHistoryReplaces ;
2009-04-24 23:34:47 +00:00
2015-08-14 19:47:47 +00:00
bool _isMatchWord = false ;
bool _isMatchCase = false ;
bool _isWrap = true ;
bool _isDirectionDown = true ;
bool _dotMatchesNewline = false ;
bool _isFifRecuisive = true ;
bool _isFifInHiddenFolder = false ;
searchMode _searchMode = normal ;
transparencyMode _transparencyMode = onLossingFocus ;
int _transparency = 150 ;
bool _isDlgAlwaysVisible = false ;
bool _isFilterFollowDoc = false ;
bool _isFolderFollowDoc = false ;
2009-04-24 23:34:47 +00:00
} ;
2015-08-14 19:47:47 +00:00
class LocalizationSwitcher final
{
friend class NppParameters ;
public :
struct LocalizationDefinition
{
2018-02-05 14:27:32 +00:00
const wchar_t * _langName ;
const wchar_t * _xmlFileName ;
2009-04-24 23:34:47 +00:00
} ;
2015-05-31 20:40:07 +00:00
bool addLanguageFromXml ( std : : wstring xmlFullPath ) ;
std : : wstring getLangFromXmlFileName ( const wchar_t * fn ) const ;
2009-04-24 23:34:47 +00:00
2015-05-31 20:40:07 +00:00
std : : wstring getXmlFilePathFromLangName ( const wchar_t * langName ) const ;
2018-02-05 14:27:32 +00:00
bool switchToLang ( const wchar_t * lang2switch ) const ;
2009-04-24 23:34:47 +00:00
2015-08-14 19:47:47 +00:00
size_t size ( ) const
{
2009-04-24 23:34:47 +00:00
return _localizationList . size ( ) ;
2015-08-14 19:47:47 +00:00
}
2009-04-24 23:34:47 +00:00
2015-08-14 19:47:47 +00:00
std : : pair < std : : wstring , std : : wstring > getElementFromIndex ( size_t index ) const
{
2009-04-24 23:34:47 +00:00
if ( index > = _localizationList . size ( ) )
2015-08-14 19:47:47 +00:00
return std : : pair < std : : wstring , std : : wstring > ( std : : wstring ( ) , std : : wstring ( ) ) ;
2009-04-24 23:34:47 +00:00
return _localizationList [ index ] ;
2015-08-14 19:47:47 +00:00
}
2009-04-24 23:34:47 +00:00
2015-08-14 19:47:47 +00:00
void setFileName ( const char * fn )
{
if ( fn )
_fileName = fn ;
}
2009-12-04 00:27:29 +00:00
2015-08-14 19:47:47 +00:00
std : : string getFileName ( ) const
{
return _fileName ;
}
2009-12-04 00:27:29 +00:00
2015-08-14 19:47:47 +00:00
private :
2015-05-31 20:40:07 +00:00
std : : vector < std : : pair < std : : wstring , std : : wstring > > _localizationList ;
std : : wstring _nativeLangPath ;
std : : string _fileName ;
2009-04-24 23:34:47 +00:00
} ;
2015-08-14 19:47:47 +00:00
class ThemeSwitcher final
{
friend class NppParameters ;
2009-04-24 23:34:47 +00:00
2015-08-14 19:47:47 +00:00
public :
void addThemeFromXml ( generic_string xmlFullPath )
{
2015-05-31 20:40:07 +00:00
_themeList . push_back ( std : : pair < generic_string , generic_string > ( getThemeFromXmlFileName ( xmlFullPath . c_str ( ) ) , xmlFullPath ) ) ;
2015-08-14 19:47:47 +00:00
}
2009-04-24 23:34:47 +00:00
2015-08-14 19:47:47 +00:00
void addDefaultThemeFromXml ( generic_string xmlFullPath )
{
2015-05-31 20:40:07 +00:00
_themeList . push_back ( std : : pair < generic_string , generic_string > ( TEXT ( " Default (stylers.xml) " ) , xmlFullPath ) ) ;
2015-08-14 19:47:47 +00:00
}
2009-04-24 23:34:47 +00:00
generic_string getThemeFromXmlFileName ( const TCHAR * fn ) const ;
2015-08-14 19:47:47 +00:00
generic_string getXmlFilePathFromThemeName ( const TCHAR * themeName ) const
{
2009-04-24 23:34:47 +00:00
if ( ! themeName | | themeName [ 0 ] )
2015-08-14 19:47:47 +00:00
return generic_string ( ) ;
2009-04-24 23:34:47 +00:00
generic_string themePath = _stylesXmlPath ;
return themePath ;
2015-08-14 19:47:47 +00:00
}
2009-04-24 23:34:47 +00:00
2015-08-14 19:47:47 +00:00
bool themeNameExists ( const TCHAR * themeName )
{
2013-07-08 00:12:50 +00:00
for ( size_t i = 0 ; i < _themeList . size ( ) ; + + i )
2009-04-24 23:34:47 +00:00
{
2015-08-14 19:47:47 +00:00
if ( ! ( getElementFromIndex ( i ) ) . first . compare ( themeName ) )
return true ;
2009-04-24 23:34:47 +00:00
}
return false ;
}
2015-08-14 19:47:47 +00:00
size_t size ( ) const
{
2009-04-24 23:34:47 +00:00
return _themeList . size ( ) ;
2015-08-14 19:47:47 +00:00
}
2009-04-24 23:34:47 +00:00
2015-08-14 19:47:47 +00:00
std : : pair < generic_string , generic_string > & getElementFromIndex ( size_t index )
{
assert ( index < _themeList . size ( ) ) ;
2009-04-24 23:34:47 +00:00
return _themeList [ index ] ;
2015-08-14 19:47:47 +00:00
}
2009-04-24 23:34:47 +00:00
2015-08-14 19:47:47 +00:00
private :
std : : vector < std : : pair < generic_string , generic_string > > _themeList ;
2009-04-24 23:34:47 +00:00
generic_string _stylesXmlPath ;
} ;
2015-08-14 19:47:47 +00:00
class PluginList final
{
2009-10-02 18:47:27 +00:00
public :
2015-08-14 19:47:47 +00:00
void add ( generic_string fn , bool isInBL )
{
2015-05-31 20:40:07 +00:00
_list . push_back ( std : : pair < generic_string , bool > ( fn , isInBL ) ) ;
2015-08-14 19:47:47 +00:00
}
private :
2015-05-31 20:40:07 +00:00
std : : vector < std : : pair < generic_string , bool > > _list ;
2009-10-02 18:47:27 +00:00
} ;
2009-04-24 23:34:47 +00:00
2015-08-14 19:47:47 +00:00
Add new languages support
Connect Scintilla Lexers to npp : SCLEX_ASN1 (Abstract Syntax Notation One), SCLEX_AVS (AviSynth), SCLEX_BLITZBASIC, SCLEX_PUREBASIC, SCLEX_FREEBASIC, SCLEX_CSOUND, SCLEX_ERLANG, SCLEX_ESCRIPT, SCLEX_FORTH, SCLEX_LATEX, SCLEX_MMIXAL, SCLEX_NIMROD, SCLEX_NNCRONTAB, SCLEX_OSCRIPT, SCLEX_REBOL, SCLEX_REGISTRY, SCLEX_RUST, SCLEX_SPICE, SCLEX_TXT2TAGS
Connect Scintilla Lexers to npp :
asn1 (Abstract Syntax Notation One) : https://fr.wikipedia.org/wiki/ASN.1#Exemple
avs (AviSynth) : http://avisynth.nl/index.php/Script_examples
blitzbasic : http://www.blitzbasic.com/bmdocs/command.php?name=Mid&ref=2d_cat
http://www.blitzbasic.com/codearcs/codearcs.php?cat=8"
csound : http://www.csounds.com/manual/html/PrefaceGettingStarted.html
erlang : http://erlang.org/doc/man/file.html
http://erlang.org/documentation/doc-5.3.6.13/doc/getting_started/getting_started.html"
escript : http://erlang.org/doc/man/escript.html
forth : http://wiki.c2.com/?ExampleForthCode
freebasic : http://www.freebasic.net/
latex : http://physics.clarku.edu/sip/tutorials/TeX/intro.html (Sample LaTeX file)
mmixal : http://mmix.cs.hm.edu/examples/hello.html
nimrod : http://www.csse.monash.edu.au/~nimrod/nimrodportal/manual/planfileexamples.shtml
nncrontab : http://www.nncron.ru/help/EN/working/cron-format.htm
oscript : http://www.oscriptadventures.com/
purebasic : https://www.purebasic.com/documentation/reference/ide_form.html
rebol : http://www.rebol.net/cookbook/recipes/0031.html
registry : windows registry file
rust : http://rustbyexample.com/std_misc/file/open.html
spice : http://www.seas.upenn.edu/~jan/spice/spice.overview.html
txt2tags : https://github.com/txt2tags/txt2tags/blob/master/samples/sample.t2t
2016-11-13 18:42:23 +00:00
const int NB_LANG = 100 ;
2009-04-24 23:34:47 +00:00
const bool DUP = true ;
const bool FREE = false ;
2011-06-26 02:09:56 +00:00
const int RECENTFILES_SHOWFULLPATH = - 1 ;
const int RECENTFILES_SHOWONLYFILENAME = 0 ;
2015-08-14 19:47:47 +00:00
class NppParameters final
2009-04-24 23:34:47 +00:00
{
public :
2015-08-14 19:47:47 +00:00
static NppParameters * getInstance ( ) { return _pSelf ; } ;
2009-04-24 23:34:47 +00:00
static LangType getLangIDFromStr ( const TCHAR * langName ) ;
2013-07-25 17:41:25 +00:00
static generic_string getLocPathFromStr ( const generic_string & localizationCode ) ;
2015-08-14 19:47:47 +00:00
2009-04-24 23:34:47 +00:00
bool load ( ) ;
bool reloadLang ( ) ;
2016-10-23 01:50:41 +00:00
bool reloadStylers ( TCHAR * stylePath = nullptr ) ;
2015-08-14 19:47:47 +00:00
void destroyInstance ( ) ;
2014-06-02 07:02:46 +00:00
generic_string getSettingsFolder ( ) ;
2009-04-24 23:34:47 +00:00
2016-10-23 01:50:41 +00:00
bool _isTaskListRBUTTONUP_Active = false ;
2009-04-24 23:34:47 +00:00
int L_END ;
const NppGUI & getNppGUI ( ) const {
2015-08-14 19:47:47 +00:00
return _nppGUI ;
}
const TCHAR * getWordList ( LangType langID , int typeIndex ) const
{
Lang * pLang = getLangFromID ( langID ) ;
if ( ! pLang ) return nullptr ;
2009-04-24 23:34:47 +00:00
2015-08-14 19:47:47 +00:00
return pLang - > getWords ( typeIndex ) ;
}
2009-04-24 23:34:47 +00:00
2015-08-14 19:47:47 +00:00
Lang * getLangFromID ( LangType langID ) const
{
2013-07-08 00:12:50 +00:00
for ( int i = 0 ; i < _nbLang ; + + i )
2009-04-24 23:34:47 +00:00
{
2017-06-14 09:33:35 +00:00
if ( _langList [ i ] & & _langList [ i ] - > _langID = = langID )
2009-04-24 23:34:47 +00:00
return _langList [ i ] ;
}
2015-08-14 19:47:47 +00:00
return nullptr ;
}
2009-04-24 23:34:47 +00:00
2016-06-05 18:29:21 +00:00
Lang * getLangFromIndex ( size_t i ) const {
return ( i < size_t ( _nbLang ) ) ? _langList [ i ] : nullptr ;
2015-08-14 19:47:47 +00:00
}
2009-04-24 23:34:47 +00:00
int getNbLang ( ) const { return _nbLang ; } ;
2015-08-14 19:47:47 +00:00
2009-11-26 01:34:25 +00:00
LangType getLangFromExt ( const TCHAR * ext ) ;
2009-04-24 23:34:47 +00:00
2015-08-14 19:47:47 +00:00
const TCHAR * getLangExtFromName ( const TCHAR * langName ) const
{
2013-07-08 00:12:50 +00:00
for ( int i = 0 ; i < _nbLang ; + + i )
2009-04-24 23:34:47 +00:00
{
2009-08-03 00:37:30 +00:00
if ( _langList [ i ] - > _langName = = langName )
2009-04-24 23:34:47 +00:00
return _langList [ i ] - > _defaultExtList ;
}
2015-08-14 19:47:47 +00:00
return nullptr ;
}
2009-04-24 23:34:47 +00:00
2015-08-14 19:47:47 +00:00
const TCHAR * getLangExtFromLangType ( LangType langType ) const
{
2013-07-08 00:12:50 +00:00
for ( int i = 0 ; i < _nbLang ; + + i )
2009-04-24 23:34:47 +00:00
{
if ( _langList [ i ] - > _langID = = langType )
return _langList [ i ] - > _defaultExtList ;
}
2015-08-14 19:47:47 +00:00
return nullptr ;
}
2009-04-24 23:34:47 +00:00
2011-06-26 02:09:56 +00:00
int getNbLRFile ( ) const { return _nbRecentFile ; } ;
2009-04-24 23:34:47 +00:00
generic_string * getLRFile ( int index ) const {
return _LRFileList [ index ] ;
} ;
2011-06-26 02:09:56 +00:00
void setNbMaxRecentFile ( int nb ) {
_nbMaxRecentFile = nb ;
} ;
int getNbMaxRecentFile ( ) const { return _nbMaxRecentFile ; } ;
void setPutRecentFileInSubMenu ( bool doSubmenu ) {
_putRecentFileInSubMenu = doSubmenu ;
2015-08-14 19:47:47 +00:00
}
2011-06-26 02:09:56 +00:00
2011-06-27 01:23:58 +00:00
bool putRecentFileInSubMenu ( ) const { return _putRecentFileInSubMenu ; } ;
2011-06-26 02:09:56 +00:00
void setRecentFileCustomLength ( int len ) {
_recentFileCustomLength = len ;
2015-08-14 19:47:47 +00:00
}
2009-04-24 23:34:47 +00:00
2011-06-26 02:09:56 +00:00
int getRecentFileCustomLength ( ) const { return _recentFileCustomLength ; } ;
2009-04-24 23:34:47 +00:00
2015-08-14 19:47:47 +00:00
const ScintillaViewParams & getSVP ( ) const {
return _svp ;
}
2009-04-24 23:34:47 +00:00
2011-06-27 01:23:58 +00:00
bool writeRecentFileHistorySettings ( int nbMaxFile = - 1 ) const ;
2009-04-24 23:34:47 +00:00
bool writeHistory ( const TCHAR * fullpath ) ;
2011-09-25 01:33:34 +00:00
bool writeProjectPanelsSettings ( ) const ;
2016-02-02 18:06:23 +00:00
bool writeFileBrowserSettings ( const std : : vector < generic_string > & rootPath , const generic_string & latestSelectedItemPath ) const ;
2011-09-25 01:33:34 +00:00
2015-08-14 19:47:47 +00:00
TiXmlNode * getChildElementByAttribut ( TiXmlNode * pere , const TCHAR * childName , const TCHAR * attributName , const TCHAR * attributVal ) const ;
2009-04-24 23:34:47 +00:00
2016-10-23 01:50:41 +00:00
bool writeScintillaParams ( ) ;
void createXmlTreeFromGUIParams ( ) ;
2009-04-24 23:34:47 +00:00
void writeStyles ( LexerStylerArray & lexersStylers , StyleArray & globalStylers ) ;
2015-08-14 19:47:47 +00:00
bool insertTabInfo ( const TCHAR * langName , int tabInfo ) ;
2009-04-24 23:34:47 +00:00
2015-08-14 19:47:47 +00:00
LexerStylerArray & getLStylerArray ( ) { return _lexerStylerArray ; } ;
StyleArray & getGlobalStylers ( ) { return _widgetStyleArray ; } ;
2009-04-24 23:34:47 +00:00
2015-08-14 19:47:47 +00:00
StyleArray & getMiscStylerArray ( ) { return _widgetStyleArray ; } ;
2009-04-24 23:34:47 +00:00
GlobalOverride & getGlobalOverrideStyle ( ) { return _nppGUI . _globalOverride ; } ;
2015-08-14 19:47:47 +00:00
COLORREF getCurLineHilitingColour ( ) ;
void setCurLineHilitingColour ( COLORREF colour2Set ) ;
2009-04-24 23:34:47 +00:00
void setFontList ( HWND hWnd ) ;
2015-08-20 00:35:38 +00:00
bool isInFontList ( const generic_string fontName2Search ) const ;
2015-08-14 19:47:47 +00:00
const std : : vector < generic_string > & getFontList ( ) const { return _fontlist ; }
int getNbUserLang ( ) const { return _nbUserLang ; }
2016-06-05 18:29:21 +00:00
UserLangContainer & getULCFromIndex ( size_t i ) { return * _userLangArray [ i ] ; } ;
2015-08-14 19:47:47 +00:00
UserLangContainer * getULCFromName ( const TCHAR * userLangName ) ;
2009-04-24 23:34:47 +00:00
int getNbExternalLang ( ) const { return _nbExternalLang ; } ;
2015-08-14 19:47:47 +00:00
int getExternalLangIndexFromName ( const TCHAR * externalLangName ) const ;
2009-04-24 23:34:47 +00:00
ExternalLangContainer & getELCFromIndex ( int i ) { return * _externalLangArray [ i ] ; } ;
bool ExternalLangHasRoom ( ) const { return _nbExternalLang < NB_MAX_EXTERNAL_LANG ; } ;
void getExternalLexerFromXmlTree ( TiXmlDocument * doc ) ;
2015-05-31 20:40:07 +00:00
std : : vector < TiXmlDocument * > * getExternalLexerDoc ( ) { return & _pXmlExternalLexerDoc ; } ;
2009-04-24 23:34:47 +00:00
void writeUserDefinedLang ( ) ;
void writeShortcuts ( ) ;
void writeSession ( const Session & session , const TCHAR * fileName = NULL ) ;
bool writeFindHistory ( ) ;
2015-08-14 19:47:47 +00:00
bool isExistingUserLangName ( const TCHAR * newName ) const
{
2009-04-24 23:34:47 +00:00
if ( ( ! newName ) | | ( ! newName [ 0 ] ) )
return true ;
2013-07-08 00:12:50 +00:00
for ( int i = 0 ; i < _nbUserLang ; + + i )
2009-04-24 23:34:47 +00:00
{
if ( ! lstrcmp ( _userLangArray [ i ] - > _name . c_str ( ) , newName ) )
return true ;
}
return false ;
2015-08-14 19:47:47 +00:00
}
2009-04-24 23:34:47 +00:00
2015-08-14 19:47:47 +00:00
const TCHAR * getUserDefinedLangNameFromExt ( TCHAR * ext , TCHAR * fullName ) const ;
2009-04-24 23:34:47 +00:00
int addUserLangToEnd ( const UserLangContainer & userLang , const TCHAR * newName ) ;
2016-06-05 18:29:21 +00:00
void removeUserLang ( size_t index ) ;
2009-04-24 23:34:47 +00:00
2015-08-14 19:47:47 +00:00
bool isExistingExternalLangName ( const TCHAR * newName ) const ;
2009-04-24 23:34:47 +00:00
int addExternalLangToEnd ( ExternalLangContainer * externalLang ) ;
TiXmlDocumentA * getNativeLangA ( ) const { return _pXmlNativeLangDocA ; } ;
TiXmlDocument * getToolIcons ( ) const { return _pXmlToolIconsDoc ; } ;
bool isTransparentAvailable ( ) const {
return ( _transparentFuncAddr ! = NULL ) ;
2015-08-14 19:47:47 +00:00
}
2009-04-24 23:34:47 +00:00
2012-01-30 00:00:50 +00:00
// 0 <= percent < 256
// if (percent == 255) then opacq
2015-08-14 19:47:47 +00:00
void SetTransparent ( HWND hwnd , int percent ) ;
2009-04-24 23:34:47 +00:00
2015-08-14 19:47:47 +00:00
void removeTransparent ( HWND hwnd ) ;
2009-04-24 23:34:47 +00:00
2018-07-02 18:48:40 +00:00
void setCmdlineParam ( const CmdLineParamsDTO & cmdLineParams )
2015-08-14 19:47:47 +00:00
{
2009-04-24 23:34:47 +00:00
_cmdLineParams = cmdLineParams ;
2015-08-14 19:47:47 +00:00
}
2018-07-02 18:48:40 +00:00
const CmdLineParamsDTO & getCmdLineParams ( ) const { return _cmdLineParams ; } ;
2009-04-24 23:34:47 +00:00
void setFileSaveDlgFilterIndex ( int ln ) { _fileSaveDlgFilterIndex = ln ; } ;
int getFileSaveDlgFilterIndex ( ) const { return _fileSaveDlgFilterIndex ; } ;
bool isRemappingShortcut ( ) const { return _shortcuts . size ( ) ! = 0 ; } ;
2015-05-31 20:40:07 +00:00
std : : vector < CommandShortcut > & getUserShortcuts ( ) { return _shortcuts ; } ;
2016-07-23 09:37:58 +00:00
std : : vector < size_t > & getUserModifiedShortcuts ( ) { return _customizedShortcuts ; } ;
void addUserModifiedIndex ( size_t index ) ;
2009-04-24 23:34:47 +00:00
2015-05-31 20:40:07 +00:00
std : : vector < MacroShortcut > & getMacroList ( ) { return _macros ; } ;
std : : vector < UserCommand > & getUserCommandList ( ) { return _userCommands ; } ;
std : : vector < PluginCmdShortcut > & getPluginCommandList ( ) { return _pluginCommands ; } ;
2016-07-23 09:37:58 +00:00
std : : vector < size_t > & getPluginModifiedKeyIndices ( ) { return _pluginCustomizedCmds ; } ;
void addPluginModifiedIndex ( size_t index ) ;
2009-04-24 23:34:47 +00:00
2015-05-31 20:40:07 +00:00
std : : vector < ScintillaKeyMap > & getScintillaKeyList ( ) { return _scintillaKeyCommands ; } ;
std : : vector < int > & getScintillaModifiedKeyIndices ( ) { return _scintillaModifiedKeyIndices ; } ;
2009-04-24 23:34:47 +00:00
void addScintillaModifiedIndex ( int index ) ;
2015-05-31 20:40:07 +00:00
std : : vector < MenuItemUnit > & getContextMenuItems ( ) { return _contextMenuItems ; } ;
2009-04-24 23:34:47 +00:00
const Session & getSession ( ) const { return _session ; } ;
2013-02-18 23:13:18 +00:00
2009-04-24 23:34:47 +00:00
bool hasCustomContextMenu ( ) const { return ! _contextMenuItems . empty ( ) ; } ;
void setAccelerator ( Accelerator * pAccel ) { _pAccelerator = pAccel ; } ;
Accelerator * getAccelerator ( ) { return _pAccelerator ; } ;
void setScintillaAccelerator ( ScintillaAccelerator * pScintAccel ) { _pScintAccelerator = pScintAccel ; } ;
2015-08-14 19:47:47 +00:00
ScintillaAccelerator * getScintillaAccelerator ( ) { return _pScintAccelerator ; } ;
2009-04-24 23:34:47 +00:00
2009-08-03 00:37:30 +00:00
generic_string getNppPath ( ) const { return _nppPath ; } ;
2015-08-14 19:47:47 +00:00
generic_string getContextMenuPath ( ) const { return _contextMenuPath ; } ;
2009-08-11 23:55:57 +00:00
const TCHAR * getAppDataNppDir ( ) const { return _appdataNppDir . c_str ( ) ; } ;
2018-11-07 21:39:36 +00:00
const TCHAR * getPluginRootDir ( ) const { return _pluginRootDir . c_str ( ) ; } ;
2009-08-11 23:55:57 +00:00
const TCHAR * getWorkingDir ( ) const { return _currentDirectory . c_str ( ) ; } ;
2016-02-02 18:06:23 +00:00
const TCHAR * getWorkSpaceFilePath ( int i ) const {
2015-08-14 19:47:47 +00:00
if ( i < 0 | | i > 2 ) return nullptr ;
2011-09-25 01:33:34 +00:00
return _workSpaceFilePathes [ i ] . c_str ( ) ;
2018-11-07 21:39:36 +00:00
} ;
2016-02-02 18:06:23 +00:00
const std : : vector < generic_string > getFileBrowserRoots ( ) const { return _fileBrowserRoot ; } ;
2015-08-14 19:47:47 +00:00
void setWorkSpaceFilePath ( int i , const TCHAR * wsFile ) ;
2011-09-25 01:33:34 +00:00
2009-04-24 23:34:47 +00:00
void setWorkingDir ( const TCHAR * newPath ) ;
2017-08-05 22:03:18 +00:00
void setStartWithLocFileName ( generic_string locPath ) {
2013-07-25 17:41:25 +00:00
_startWithLocFileName = locPath ;
2017-08-05 22:03:18 +00:00
} ;
void setFunctionListExportBoolean ( bool doIt ) {
_doFunctionListExport = doIt ;
} ;
bool doFunctionListExport ( ) const {
return _doFunctionListExport ;
} ;
2013-07-25 17:41:25 +00:00
2017-08-06 22:01:12 +00:00
void setPrintAndExitBoolean ( bool doIt ) {
_doPrintAndExit = doIt ;
} ;
bool doPrintAndExit ( ) const {
return _doPrintAndExit ;
} ;
2009-04-24 23:34:47 +00:00
bool loadSession ( Session & session , const TCHAR * sessionFileName ) ;
int langTypeToCommandID ( LangType lt ) const ;
WNDPROC getEnableThemeDlgTexture ( ) const { return _enableThemeDialogTextureFuncAddr ; } ;
2011-01-19 21:05:40 +00:00
2016-02-02 18:06:23 +00:00
struct FindDlgTabTitiles final {
2009-04-24 23:34:47 +00:00
generic_string _find ;
generic_string _replace ;
generic_string _findInFiles ;
2011-01-19 21:05:40 +00:00
generic_string _mark ;
2009-04-24 23:34:47 +00:00
} ;
FindDlgTabTitiles & getFindDlgTabTitiles ( ) { return _findDlgTabTitiles ; } ;
bool asNotepadStyle ( ) const { return _asNotepadStyle ; } ;
2016-02-02 18:06:23 +00:00
bool reloadPluginCmds ( ) {
2009-04-24 23:34:47 +00:00
return getPluginCmdsFromXmlTree ( ) ;
}
2010-10-30 15:38:51 +00:00
bool getContextMenuFromXmlTree ( HMENU mainMenuHadle , HMENU pluginsMenu ) ;
bool reloadContextMenuFromXmlTree ( HMENU mainMenuHadle , HMENU pluginsMenu ) ;
2015-12-06 22:20:14 +00:00
winVer getWinVersion ( ) const { return _winVersion ; } ;
generic_string getWinVersionStr ( ) const ;
2017-02-10 11:49:04 +00:00
generic_string getWinVerBitStr ( ) const ;
2009-04-24 23:34:47 +00:00
FindHistory & getFindHistory ( ) { return _findHistory ; } ;
2016-10-23 01:50:41 +00:00
bool _isFindReplacing = false ; // an on the fly variable for find/replace functions
2010-11-01 16:08:43 +00:00
void safeWow64EnableWow64FsRedirection ( BOOL Wow64FsEnableRedirection ) ;
2015-08-14 19:47:47 +00:00
2009-04-24 23:34:47 +00:00
LocalizationSwitcher & getLocalizationSwitcher ( ) {
return _localizationSwitcher ;
2015-08-14 19:47:47 +00:00
}
2014-07-16 11:20:58 +00:00
2009-04-24 23:34:47 +00:00
ThemeSwitcher & getThemeSwitcher ( ) {
return _themeSwitcher ;
2015-08-14 19:47:47 +00:00
}
2009-04-24 23:34:47 +00:00
2015-05-31 20:40:07 +00:00
std : : vector < generic_string > & getBlackList ( ) { return _blacklist ; } ;
2015-08-14 19:47:47 +00:00
bool isInBlackList ( TCHAR * fn ) const
{
for ( auto & element : _blacklist )
{
if ( element = = fn )
return true ;
}
return false ;
}
PluginList & getPluginList ( ) { return _pluginList ; } ;
bool importUDLFromFile ( generic_string sourceFile ) ;
2016-06-05 18:29:21 +00:00
bool exportUDLToFile ( size_t langIndex2export , generic_string fileName2save ) ;
2015-08-14 19:47:47 +00:00
NativeLangSpeaker * getNativeLangSpeaker ( ) {
2011-01-22 23:53:35 +00:00
return _pNativeLangSpeaker ;
2015-08-14 19:47:47 +00:00
}
2011-01-22 23:53:35 +00:00
void setNativeLangSpeaker ( NativeLangSpeaker * nls ) {
_pNativeLangSpeaker = nls ;
2015-08-14 19:47:47 +00:00
}
2009-10-02 18:47:27 +00:00
2011-11-16 23:24:11 +00:00
bool isLocal ( ) const {
return _isLocal ;
} ;
2015-08-14 19:47:47 +00:00
void saveConfig_xml ( ) ;
2012-08-23 22:43:07 +00:00
2013-01-18 01:48:30 +00:00
generic_string getUserPath ( ) const {
return _userPath ;
2015-08-14 19:47:47 +00:00
}
2013-01-18 01:48:30 +00:00
2015-07-06 17:06:46 +00:00
bool writeSettingsFilesOnCloudForThe1stTime ( const generic_string & cloudSettingsPath ) ;
void setCloudChoice ( const TCHAR * pathChoice ) ;
void removeCloudChoice ( ) ;
bool isCloudPathChanged ( ) const ;
2016-06-16 23:10:32 +00:00
bool isx64 ( ) const { return _isx64 ; } ;
2014-07-16 11:20:58 +00:00
COLORREF getCurrentDefaultBgColor ( ) const {
return _currentDefaultBgColor ;
2015-08-14 19:47:47 +00:00
}
2014-07-16 11:20:58 +00:00
COLORREF getCurrentDefaultFgColor ( ) const {
return _currentDefaultFgColor ;
2015-08-14 19:47:47 +00:00
}
2014-07-16 11:20:58 +00:00
void setCurrentDefaultBgColor ( COLORREF c ) {
_currentDefaultBgColor = c ;
2015-08-14 19:47:47 +00:00
}
2014-07-16 11:20:58 +00:00
void setCurrentDefaultFgColor ( COLORREF c ) {
_currentDefaultFgColor = c ;
2015-08-14 19:47:47 +00:00
}
2014-07-16 11:20:58 +00:00
2015-11-26 18:09:40 +00:00
bool useNewStyleSaveDlg ( ) const {
return _nppGUI . _useNewStyleSaveDlg ;
}
void setUseNewStyleSaveDlg ( bool v ) {
_nppGUI . _useNewStyleSaveDlg = v ;
}
2014-02-11 00:26:24 +00:00
DPIManager _dpiManager ;
2017-02-09 23:08:29 +00:00
generic_string static getSpecialFolderLocation ( int folderKind ) ;
2015-08-14 19:47:47 +00:00
2009-04-24 23:34:47 +00:00
private :
2015-08-14 19:47:47 +00:00
NppParameters ( ) ;
2009-04-24 23:34:47 +00:00
~ NppParameters ( ) ;
2015-08-14 19:47:47 +00:00
static NppParameters * _pSelf ;
2009-04-24 23:34:47 +00:00
2016-10-23 01:50:41 +00:00
TiXmlDocument * _pXmlDoc = nullptr ;
TiXmlDocument * _pXmlUserDoc = nullptr ;
TiXmlDocument * _pXmlUserStylerDoc = nullptr ;
TiXmlDocument * _pXmlUserLangDoc = nullptr ;
TiXmlDocument * _pXmlToolIconsDoc = nullptr ;
TiXmlDocument * _pXmlShortcutDoc = nullptr ;
TiXmlDocument * _pXmlSessionDoc = nullptr ;
TiXmlDocument * _pXmlBlacklistDoc = nullptr ;
2010-05-24 01:03:51 +00:00
TiXmlDocument * _importedULD [ NB_MAX_IMPORTED_UDL ] ;
2016-10-23 01:50:41 +00:00
TiXmlDocumentA * _pXmlNativeLangDocA = nullptr ;
TiXmlDocumentA * _pXmlContextMenuDocA = nullptr ;
2010-05-24 01:03:51 +00:00
int _nbImportedULD ;
2015-08-14 19:47:47 +00:00
2016-10-23 01:50:41 +00:00
2009-04-24 23:34:47 +00:00
2015-05-31 20:40:07 +00:00
std : : vector < TiXmlDocument * > _pXmlExternalLexerDoc ;
2009-04-24 23:34:47 +00:00
NppGUI _nppGUI ;
2010-07-27 15:59:20 +00:00
ScintillaViewParams _svp ;
2009-04-24 23:34:47 +00:00
Lang * _langList [ NB_LANG ] ;
2016-10-23 01:50:41 +00:00
int _nbLang = 0 ;
2009-04-24 23:34:47 +00:00
2011-06-26 02:09:56 +00:00
// Recent File History
2009-04-24 23:34:47 +00:00
generic_string * _LRFileList [ NB_MAX_LRF_FILE ] ;
2016-10-23 01:50:41 +00:00
int _nbRecentFile = 0 ;
int _nbMaxRecentFile = 10 ;
bool _putRecentFileInSubMenu = false ;
int _recentFileCustomLength = RECENTFILES_SHOWFULLPATH ; // <0: Full File Path Name
// =0: Only File Name
// >0: Custom Entry Length
2009-04-24 23:34:47 +00:00
FindHistory _findHistory ;
UserLangContainer * _userLangArray [ NB_MAX_USER_LANG ] ;
2016-10-23 01:50:41 +00:00
int _nbUserLang = 0 ;
2009-08-11 23:55:57 +00:00
generic_string _userDefineLangPath ;
2009-04-24 23:34:47 +00:00
ExternalLangContainer * _externalLangArray [ NB_MAX_EXTERNAL_LANG ] ;
2016-10-23 01:50:41 +00:00
int _nbExternalLang = 0 ;
2009-04-24 23:34:47 +00:00
2018-07-02 18:48:40 +00:00
CmdLineParamsDTO _cmdLineParams ;
2009-04-24 23:34:47 +00:00
2016-10-23 01:50:41 +00:00
int _fileSaveDlgFilterIndex = - 1 ;
2009-04-24 23:34:47 +00:00
2015-08-14 19:47:47 +00:00
// All Styles (colours & fonts)
2009-04-24 23:34:47 +00:00
LexerStylerArray _lexerStylerArray ;
2015-08-14 19:47:47 +00:00
StyleArray _widgetStyleArray ;
2009-04-24 23:34:47 +00:00
2015-05-31 20:40:07 +00:00
std : : vector < generic_string > _fontlist ;
std : : vector < generic_string > _blacklist ;
2015-08-14 19:47:47 +00:00
PluginList _pluginList ;
2009-04-24 23:34:47 +00:00
2016-10-23 01:50:41 +00:00
HMODULE _hUXTheme = nullptr ;
2009-04-24 23:34:47 +00:00
2016-10-23 01:50:41 +00:00
WNDPROC _transparentFuncAddr = nullptr ;
WNDPROC _enableThemeDialogTextureFuncAddr = nullptr ;
2011-11-16 23:24:11 +00:00
bool _isLocal ;
2016-06-16 23:10:32 +00:00
bool _isx64 = false ; // by default 32-bit
2009-04-24 23:34:47 +00:00
2015-08-29 19:49:49 +00:00
public :
void setShortcutDirty ( ) { _isAnyShortcutModified = true ; } ;
private :
bool _isAnyShortcutModified = false ;
2015-05-31 20:40:07 +00:00
std : : vector < CommandShortcut > _shortcuts ; //main menu shortuts. Static size
2016-07-23 09:37:58 +00:00
std : : vector < size_t > _customizedShortcuts ; //altered main menu shortcuts. Indices static. Needed when saving alterations
2015-05-31 20:40:07 +00:00
std : : vector < MacroShortcut > _macros ; //macro shortcuts, dynamic size, defined on loading macros and adding/deleting them
std : : vector < UserCommand > _userCommands ; //run shortcuts, dynamic size, defined on loading run commands and adding/deleting them
std : : vector < PluginCmdShortcut > _pluginCommands ; //plugin commands, dynamic size, defined on loading plugins
2016-07-23 09:37:58 +00:00
std : : vector < size_t > _pluginCustomizedCmds ; //plugincommands that have been altered. Indices determined after loading ALL plugins. Needed when saving alterations
2009-04-24 23:34:47 +00:00
2015-05-31 20:40:07 +00:00
std : : vector < ScintillaKeyMap > _scintillaKeyCommands ; //scintilla keycommands. Static size
std : : vector < int > _scintillaModifiedKeyIndices ; //modified scintilla keys. Indices static, determined by searching for commandId. Needed when saving alterations
2013-07-25 17:41:25 +00:00
2009-04-24 23:34:47 +00:00
LocalizationSwitcher _localizationSwitcher ;
2013-07-25 17:41:25 +00:00
generic_string _startWithLocFileName ;
2017-08-05 22:03:18 +00:00
bool _doFunctionListExport = false ;
2017-08-06 22:01:12 +00:00
bool _doPrintAndExit = false ;
2013-07-25 17:41:25 +00:00
2009-04-24 23:34:47 +00:00
ThemeSwitcher _themeSwitcher ;
//vector<generic_string> _noMenuCmdNames;
2015-05-31 20:40:07 +00:00
std : : vector < MenuItemUnit > _contextMenuItems ;
2009-04-24 23:34:47 +00:00
Session _session ;
2009-08-11 23:55:57 +00:00
generic_string _shortcutsPath ;
generic_string _contextMenuPath ;
generic_string _sessionPath ;
2015-08-14 19:47:47 +00:00
generic_string _blacklistPath ;
2009-08-03 00:37:30 +00:00
generic_string _nppPath ;
2009-08-11 23:55:57 +00:00
generic_string _userPath ;
generic_string _stylerPath ;
generic_string _appdataNppDir ; // sentinel of the absence of "doLocalConf.xml" : (_appdataNppDir == TEXT(""))?"doLocalConf.xml present":"doLocalConf.xml absent"
2018-11-07 21:39:36 +00:00
generic_string _pluginRootDir ;
2009-08-11 23:55:57 +00:00
generic_string _currentDirectory ;
2011-09-25 01:33:34 +00:00
generic_string _workSpaceFilePathes [ 3 ] ;
2009-04-24 23:34:47 +00:00
2016-02-02 18:06:23 +00:00
std : : vector < generic_string > _fileBrowserRoot ;
2009-04-24 23:34:47 +00:00
Accelerator * _pAccelerator ;
ScintillaAccelerator * _pScintAccelerator ;
FindDlgTabTitiles _findDlgTabTitiles ;
2016-10-23 01:50:41 +00:00
bool _asNotepadStyle = false ;
2009-04-24 23:34:47 +00:00
winVer _winVersion ;
2017-02-10 11:49:04 +00:00
Platform _platForm ;
2009-04-24 23:34:47 +00:00
2016-10-23 01:50:41 +00:00
NativeLangSpeaker * _pNativeLangSpeaker = nullptr ;
2011-01-19 21:05:40 +00:00
2014-07-16 11:20:58 +00:00
COLORREF _currentDefaultBgColor ;
COLORREF _currentDefaultFgColor ;
2015-07-06 17:06:46 +00:00
generic_string _initialCloudChoice ;
2018-09-13 21:07:22 +00:00
generic_string _wingupFullPath ;
generic_string _wingupParams ;
generic_string _wingupDir ;
2018-11-24 15:26:24 +00:00
bool _isElevationRequired = false ;
2018-09-13 21:07:22 +00:00
public :
generic_string getWingupFullPath ( ) const { return _wingupFullPath ; } ;
generic_string getWingupParams ( ) const { return _wingupParams ; } ;
generic_string getWingupDir ( ) const { return _wingupDir ; } ;
2018-11-24 15:26:24 +00:00
bool shouldDoUAC ( ) const { return _isElevationRequired ; } ;
2018-09-13 21:07:22 +00:00
void setWingupFullPath ( const generic_string & val2set ) { _wingupFullPath = val2set ; } ;
void setWingupParams ( const generic_string & val2set ) { _wingupParams = val2set ; } ;
void setWingupDir ( const generic_string & val2set ) { _wingupDir = val2set ; } ;
2018-11-24 15:26:24 +00:00
void setElevationRequired ( bool val2set ) { _isElevationRequired = val2set ; } ;
2018-09-13 21:07:22 +00:00
private :
2009-04-24 23:34:47 +00:00
void getLangKeywordsFromXmlTree ( ) ;
bool getUserParametersFromXmlTree ( ) ;
bool getUserStylersFromXmlTree ( ) ;
2010-05-08 22:44:45 +00:00
bool getUserDefineLangsFromXmlTree ( TiXmlDocument * tixmldoc ) ;
2015-08-14 19:47:47 +00:00
bool getUserDefineLangsFromXmlTree ( )
{
return getUserDefineLangsFromXmlTree ( _pXmlUserLangDoc ) ;
}
2010-05-08 22:44:45 +00:00
2009-04-24 23:34:47 +00:00
bool getShortcutsFromXmlTree ( ) ;
bool getMacrosFromXmlTree ( ) ;
bool getUserCmdsFromXmlTree ( ) ;
bool getPluginCmdsFromXmlTree ( ) ;
bool getScintKeysFromXmlTree ( ) ;
bool getSessionFromXmlTree ( TiXmlDocument * pSessionDoc = NULL , Session * session = NULL ) ;
2015-08-14 19:47:47 +00:00
bool getBlackListFromXmlTree ( ) ;
2009-04-24 23:34:47 +00:00
void feedGUIParameters ( TiXmlNode * node ) ;
void feedKeyWordsParameters ( TiXmlNode * node ) ;
void feedFileListParameters ( TiXmlNode * node ) ;
2015-08-14 19:47:47 +00:00
void feedScintillaParam ( TiXmlNode * node ) ;
2009-04-24 23:34:47 +00:00
void feedDockingManager ( TiXmlNode * node ) ;
void feedFindHistoryParameters ( TiXmlNode * node ) ;
2011-09-25 01:33:34 +00:00
void feedProjectPanelsParameters ( TiXmlNode * node ) ;
2016-02-02 18:06:23 +00:00
void feedFileBrowserParameters ( TiXmlNode * node ) ;
2009-04-24 23:34:47 +00:00
bool feedStylerArray ( TiXmlNode * node ) ;
2010-05-08 22:44:45 +00:00
bool feedUserLang ( TiXmlNode * node ) ;
2009-04-24 23:34:47 +00:00
void feedUserStyles ( TiXmlNode * node ) ;
void feedUserKeywordList ( TiXmlNode * node ) ;
void feedUserSettings ( TiXmlNode * node ) ;
void feedShortcut ( TiXmlNode * node ) ;
void feedMacros ( TiXmlNode * node ) ;
void feedUserCmds ( TiXmlNode * node ) ;
void feedPluginCustomizedCmds ( TiXmlNode * node ) ;
void feedScintKeys ( TiXmlNode * node ) ;
2015-08-14 19:47:47 +00:00
bool feedBlacklist ( TiXmlNode * node ) ;
2009-04-24 23:34:47 +00:00
void getActions ( TiXmlNode * node , Macro & macro ) ;
bool getShortcuts ( TiXmlNode * node , Shortcut & sc ) ;
2015-08-14 19:47:47 +00:00
void writeStyle2Element ( Style & style2Write , Style & style2Sync , TiXmlElement * element ) ;
2009-04-24 23:34:47 +00:00
void insertUserLang2Tree ( TiXmlNode * node , UserLangContainer * userLang ) ;
void insertCmd ( TiXmlNode * cmdRoot , const CommandShortcut & cmd ) ;
void insertMacro ( TiXmlNode * macrosRoot , const MacroShortcut & macro ) ;
void insertUserCmd ( TiXmlNode * userCmdRoot , const UserCommand & userCmd ) ;
void insertScintKey ( TiXmlNode * scintKeyRoot , const ScintillaKeyMap & scintKeyMap ) ;
void insertPluginCmd ( TiXmlNode * pluginCmdRoot , const PluginCmdShortcut & pluginCmd ) ;
void stylerStrOp ( bool op ) ;
TiXmlElement * insertGUIConfigBoolNode ( TiXmlNode * r2w , const TCHAR * name , bool bVal ) ;
void insertDockingParamNode ( TiXmlNode * GUIRoot ) ;
void writeExcludedLangList ( TiXmlElement * element ) ;
void writePrintSetting ( TiXmlElement * element ) ;
void initMenuKeys ( ) ; //initialise menu keys and scintilla keys. Other keys are initialized on their own
void initScintillaKeys ( ) ; //these functions have to be called first before any modifications are loaded
2015-06-14 15:49:27 +00:00
int getCmdIdFromMenuEntryItemName ( HMENU mainMenuHadle , generic_string menuEntryName , generic_string menuItemName ) ; // return -1 if not found
int getPluginCmdIdFromMenuEntryItemName ( HMENU pluginsMenu , generic_string pluginName , generic_string pluginCmdName ) ; // return -1 if not found
2017-02-10 11:49:04 +00:00
winVer getWindowsVersion ( ) ;
2018-09-13 21:07:22 +00:00
2009-04-24 23:34:47 +00:00
} ;