[CHANGE_BEHAVIOUR] Plugins loading from %APPDATA\Notepad++\plugins\% is enabled only if "NPP_INSTALLED_DIR\Notepad++\allowAppDataPlugins.xml" is present.
[NEW_FEATURE] Edit Zone border can be customizable via Preferences dialog. git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@846 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
parent
24a25a0b49
commit
49964f565d
@ -356,6 +356,9 @@ enum winVer{WV_UNKNOWN, WV_WIN32S, WV_95, WV_98, WV_ME, WV_NT, WV_W2K, WV_XP, WV
|
||||
// BOOL NPPM_ISDOCSWITCHERSHOWN(0, 0)
|
||||
// Check to see if doc switcher is shown.
|
||||
|
||||
#define NPPM_GETAPPDATAPLUGINSALLOWED (NPPMSG + 87)
|
||||
// BOOL NPPM_GETAPPDATAPLUGINSALLOWED(0, 0)
|
||||
// Check to see if loading plugins from "%APPDATA%\Notepad++\plugins" is allowed.
|
||||
|
||||
#define RUNCOMMAND_USER (WM_USER + 3000)
|
||||
#define NPPM_GETFULLCURRENTPATH (RUNCOMMAND_USER + FULL_CURRENT_PATH)
|
||||
|
@ -345,7 +345,7 @@ LRESULT Notepad_plus::init(HWND hwnd)
|
||||
// Load plugins firstly from "%APPDATA%/Notepad++/plugins"
|
||||
// if Notepad++ is not in localConf mode.
|
||||
// All the dll loaded are marked.
|
||||
bool isLoadFromAppDataAllow = true;
|
||||
bool isLoadFromAppDataAllow = ::SendMessage(_pPublicInterface->getHSelf(), NPPM_GETAPPDATAPLUGINSALLOWED, 0, 0) == TRUE;
|
||||
const TCHAR *appDataNpp = pNppParam->getAppDataNppDir();
|
||||
if (appDataNpp[0] && isLoadFromAppDataAllow)
|
||||
_pluginsManager.loadPlugins(appDataNpp);
|
||||
|
@ -18,7 +18,6 @@
|
||||
#ifndef NOTEPAD_PLUS_WINDOW_H
|
||||
#define NOTEPAD_PLUS_WINDOW_H
|
||||
|
||||
//#include "Window.h"
|
||||
#include "Notepad_plus.h"
|
||||
|
||||
class Notepad_plus_Window : public Window {
|
||||
|
@ -1834,6 +1834,19 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
|
||||
return _pFileSwitcherPanel->isVisible();
|
||||
}
|
||||
|
||||
case NPPM_GETAPPDATAPLUGINSALLOWED:
|
||||
{
|
||||
NppParameters *pNppParam = NppParameters::getInstance();
|
||||
const TCHAR *appDataNpp = pNppParam->getAppDataNppDir();
|
||||
if (appDataNpp[0])
|
||||
{
|
||||
generic_string allowAppDataPluginsPath(pNppParam->getNppPath());
|
||||
PathAppend(allowAppDataPluginsPath, allowAppDataPluginsFile);
|
||||
return ::PathFileExists(allowAppDataPluginsPath.c_str());
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
//
|
||||
// These are sent by Preferences Dialog
|
||||
//
|
||||
|
@ -3869,6 +3869,13 @@ void NppParameters::feedScintillaParam(TiXmlNode *node)
|
||||
else if (!lstrcmp(nm, TEXT("hide")))
|
||||
_svp._eolShow = false;
|
||||
}
|
||||
|
||||
nm = element->Attribute(TEXT("borderWidth"), &val);
|
||||
if (nm)
|
||||
{
|
||||
if (val > 0 || val <= 30)
|
||||
_svp._borderWidth = val;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -4000,7 +4007,7 @@ bool NppParameters::writeScintillaParams(const ScintillaViewParams & svp)
|
||||
(scintNode->ToElement())->SetAttribute(TEXT("zoom2"), svp._zoom2);
|
||||
(scintNode->ToElement())->SetAttribute(TEXT("whiteSpaceShow"), svp._whiteSpaceShow?TEXT("show"):TEXT("hide"));
|
||||
(scintNode->ToElement())->SetAttribute(TEXT("eolShow"), svp._eolShow?TEXT("show"):TEXT("hide"));
|
||||
|
||||
(scintNode->ToElement())->SetAttribute(TEXT("borderWidth"), svp._borderWidth);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -100,6 +100,7 @@ const int COPYDATA_FILENAMESW = 2;
|
||||
const TCHAR fontSizeStrs[][3] = {TEXT(""), 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")};
|
||||
|
||||
const TCHAR localConfFile[] = TEXT("doLocalConf.xml");
|
||||
const TCHAR allowAppDataPluginsFile[] = TEXT("allowAppDataPlugins.xml");
|
||||
const TCHAR notepadStyleFile[] = TEXT("asNotepad.xml");
|
||||
|
||||
void cutString(const TCHAR *str2cut, vector<generic_string> & patternVect);
|
||||
@ -755,7 +756,7 @@ struct NppGUI
|
||||
|
||||
struct ScintillaViewParams
|
||||
{
|
||||
ScintillaViewParams() : _lineNumberMarginShow(true), _bookMarkMarginShow(true),\
|
||||
ScintillaViewParams() : _lineNumberMarginShow(true), _bookMarkMarginShow(true),_borderWidth(2),\
|
||||
_folderStyle(FOLDER_STYLE_BOX), _foldMarginShow(true), _indentGuideLineShow(true),\
|
||||
_currentLineHilitingShow(true), _wrapSymbolShow(false), _doWrap(false), _edgeNbColumn(80),\
|
||||
_zoom(0), _zoom2(0), _whiteSpaceShow(false), _eolShow(false), _lineWrapMethod(LINEWRAP_ALIGNED){};
|
||||
@ -775,7 +776,7 @@ struct ScintillaViewParams
|
||||
int _zoom2;
|
||||
bool _whiteSpaceShow;
|
||||
bool _eolShow;
|
||||
|
||||
int _borderWidth;
|
||||
};
|
||||
|
||||
const int NB_LIST = 20;
|
||||
|
@ -147,16 +147,20 @@ void DocTabView::setBuffer(int index, BufferID id) {
|
||||
|
||||
void DocTabView::reSizeTo(RECT & rc)
|
||||
{
|
||||
int borderWidth = ((NppParameters::getInstance())->getSVP())._borderWidth;
|
||||
if (_hideTabBarStatus)
|
||||
{
|
||||
RECT rcTmp = rc;
|
||||
|
||||
TabBar::reSizeTo(rcTmp);
|
||||
_pView->reSizeTo(rc);
|
||||
}
|
||||
else
|
||||
{
|
||||
TabBar::reSizeTo(rc);
|
||||
rc.left += borderWidth;
|
||||
rc.right -= borderWidth * 2;
|
||||
rc.top += borderWidth;
|
||||
rc.bottom -= (borderWidth * 2);
|
||||
_pView->reSizeTo(rc);
|
||||
}
|
||||
}
|
@ -98,6 +98,10 @@ BEGIN
|
||||
CONTROL "Default",IDC_RADIO_LWDEF,"Button",BS_AUTORADIOBUTTON | WS_GROUP,309,61,59,10
|
||||
CONTROL "Aligned",IDC_RADIO_LWALIGN,"Button",BS_AUTORADIOBUTTON,309,75,60,10
|
||||
CONTROL "Indent",IDC_RADIO_LWINDENT,"Button",BS_AUTORADIOBUTTON,309,89,62,10
|
||||
|
||||
GROUPBOX "Border Width",IDC_BORDERWIDTH_STATIC,140,126,148,30,BS_CENTER
|
||||
CONTROL "",IDC_BORDERWIDTH_SLIDER,"msctls_trackbar32",TBS_AUTOTICKS | TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,154,139,67,13
|
||||
LTEXT "0",IDC_BORDERWIDTHVAL_STATIC,223,139,12,8
|
||||
END
|
||||
|
||||
IDD_PREFERENCE_SETTING_BOX DIALOGEX 0, 0, 455, 185
|
||||
|
@ -24,6 +24,10 @@ const int BLINKRATE_FASTEST = 50;
|
||||
const int BLINKRATE_SLOWEST = 2500;
|
||||
const int BLINKRATE_INTERVAL = 50;
|
||||
|
||||
const int BORDERWIDTH_SMALLEST = 0;
|
||||
const int BORDERWIDTH_LARGEST = 30;
|
||||
const int BORDERWIDTH_INTERVAL = 1;
|
||||
|
||||
// This int encoding array is built from "EncodingUnit encodings[]" (see EncodingMapper.cpp)
|
||||
// And DefaultNewDocDlg will use "int encoding array" to get more info from "EncodingUnit encodings[]"
|
||||
int encodings[] = {
|
||||
@ -452,7 +456,7 @@ void MarginsDlg::initScintParam()
|
||||
}
|
||||
|
||||
|
||||
BOOL CALLBACK MarginsDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM)
|
||||
BOOL CALLBACK MarginsDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
NppParameters *pNppParam = NppParameters::getInstance();
|
||||
NppGUI & nppGUI = (NppGUI &)pNppParam->getNppGUI();
|
||||
@ -479,6 +483,13 @@ BOOL CALLBACK MarginsDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM)
|
||||
int blinkRate = (nppGUI._caretBlinkRate==0)?BLINKRATE_SLOWEST:nppGUI._caretBlinkRate;
|
||||
::SendMessage(::GetDlgItem(_hSelf, IDC_CARETBLINKRATE_SLIDER),TBM_SETPOS, TRUE, blinkRate);
|
||||
|
||||
::SendMessage(::GetDlgItem(_hSelf, IDC_BORDERWIDTH_SLIDER),TBM_SETRANGEMIN, TRUE, BORDERWIDTH_SMALLEST);
|
||||
::SendMessage(::GetDlgItem(_hSelf, IDC_BORDERWIDTH_SLIDER),TBM_SETRANGEMAX, TRUE, BORDERWIDTH_LARGEST);
|
||||
::SendMessage(::GetDlgItem(_hSelf, IDC_BORDERWIDTH_SLIDER),TBM_SETPAGESIZE, 0, BLINKRATE_INTERVAL);
|
||||
const ScintillaViewParams & svp = pNppParam->getSVP();
|
||||
::SendMessage(::GetDlgItem(_hSelf, IDC_BORDERWIDTH_SLIDER),TBM_SETPOS, TRUE, svp._borderWidth);
|
||||
::SetDlgItemInt(_hSelf, IDC_BORDERWIDTHVAL_STATIC, svp._borderWidth, FALSE);
|
||||
|
||||
initScintParam();
|
||||
|
||||
ETDTProc enableDlgTheme = (ETDTProc)pNppParam->getEnableThemeDlgTexture();
|
||||
@ -489,12 +500,25 @@ BOOL CALLBACK MarginsDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM)
|
||||
|
||||
case WM_HSCROLL:
|
||||
{
|
||||
int blinkRate = (int)::SendMessage(::GetDlgItem(_hSelf, IDC_CARETBLINKRATE_SLIDER),TBM_GETPOS, 0, 0);
|
||||
HWND hCaretBlikRateSlider = ::GetDlgItem(_hSelf, IDC_CARETBLINKRATE_SLIDER);
|
||||
HWND hBorderWidthSlider = ::GetDlgItem(_hSelf, IDC_BORDERWIDTH_SLIDER);
|
||||
if ((HWND)lParam == hCaretBlikRateSlider)
|
||||
{
|
||||
int blinkRate = (int)::SendMessage(hCaretBlikRateSlider, TBM_GETPOS, 0, 0);
|
||||
if (blinkRate == BLINKRATE_SLOWEST)
|
||||
blinkRate = 0;
|
||||
nppGUI._caretBlinkRate = blinkRate;
|
||||
|
||||
::SendMessage(::GetParent(_hParent), NPPM_INTERNAL_SETCARETBLINKRATE, 0, 0);
|
||||
}
|
||||
else if ((HWND)lParam == hBorderWidthSlider)
|
||||
{
|
||||
int borderWidth = (int)::SendMessage(hBorderWidthSlider, TBM_GETPOS, 0, 0);
|
||||
ScintillaViewParams & svp = (ScintillaViewParams &)pNppParam->getSVP();
|
||||
svp._borderWidth = borderWidth;
|
||||
::SetDlgItemInt(_hSelf, IDC_BORDERWIDTHVAL_STATIC, borderWidth, FALSE);
|
||||
::SendMessage(::GetParent(_hParent), WM_SIZE, 0, 0);
|
||||
}
|
||||
return 0; //return zero when handled
|
||||
|
||||
}
|
||||
|
@ -90,6 +90,10 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
#define IDC_RADIO_LWALIGN (IDD_PREFERENCE_MARGEIN_BOX + 29)
|
||||
#define IDC_RADIO_LWINDENT (IDD_PREFERENCE_MARGEIN_BOX + 30)
|
||||
|
||||
#define IDC_BORDERWIDTH_STATIC (IDD_PREFERENCE_MARGEIN_BOX + 31)
|
||||
#define IDC_BORDERWIDTHVAL_STATIC (IDD_PREFERENCE_MARGEIN_BOX + 32)
|
||||
#define IDC_BORDERWIDTH_SLIDER (IDD_PREFERENCE_MARGEIN_BOX + 33)
|
||||
|
||||
#define IDD_PREFERENCE_SETTING_BOX 6300 //(IDD_PREFERENCE_BOX + 300)
|
||||
#define IDC_TABSETTING_GB_STATIC (IDD_PREFERENCE_SETTING_BOX + 1)
|
||||
#define IDC_CHECK_REPLACEBYSPACE (IDD_PREFERENCE_SETTING_BOX + 2)
|
||||
|
@ -181,7 +181,6 @@ void TabBar::reSizeTo(RECT & rc2Ajust)
|
||||
{
|
||||
RECT RowRect;
|
||||
int RowCount, TabsLength;
|
||||
const int marge = 2;
|
||||
|
||||
// Important to do that!
|
||||
// Otherwise, the window(s) it contains will take all the resouce of CPU
|
||||
@ -204,20 +203,16 @@ void TabBar::reSizeTo(RECT & rc2Ajust)
|
||||
TabsLength = RowCount * (RowRect.right - RowRect.left);
|
||||
TabsLength += GetSystemMetrics(SM_CXEDGE);
|
||||
|
||||
rc2Ajust.left += TabsLength + marge;
|
||||
rc2Ajust.right -= TabsLength + (marge * 2);
|
||||
rc2Ajust.top += marge;
|
||||
rc2Ajust.bottom -= (marge * 2);
|
||||
rc2Ajust.left += TabsLength;
|
||||
rc2Ajust.right -= TabsLength;
|
||||
}
|
||||
else
|
||||
{
|
||||
TabsLength = RowCount * (RowRect.bottom - RowRect.top);
|
||||
TabsLength += GetSystemMetrics(SM_CYEDGE);
|
||||
|
||||
rc2Ajust.top += TabsLength + marge;
|
||||
rc2Ajust.bottom -= TabsLength + (marge * 2);
|
||||
rc2Ajust.left += marge;
|
||||
rc2Ajust.right -= marge * 2;
|
||||
rc2Ajust.top += TabsLength;
|
||||
rc2Ajust.bottom -= TabsLength;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -359,7 +359,6 @@
|
||||
#define NPPM_INTERNAL_RECENTFILELIST_UPDATE (NOTEPADPLUS_USER_INTERNAL + 35)
|
||||
#define NPPM_INTERNAL_RECENTFILELIST_SWITCH (NOTEPADPLUS_USER_INTERNAL + 36)
|
||||
|
||||
|
||||
//wParam: 0
|
||||
//lParam: document new index
|
||||
// See Notepad_plus_msgs.h
|
||||
|
Loading…
Reference in New Issue
Block a user