[BUG_FIXED] Restore zoom settings saving for both scintilla controls.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@644 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
Don Ho 2010-07-27 15:59:20 +00:00
parent a3d71483ef
commit 4eeff970ab
9 changed files with 66 additions and 67 deletions

View File

@ -23,7 +23,7 @@ Web sites:
***********
Notepad++ official site:
http://notepad-plus.sourceforge.net/
http://notepad-plus-plus.org/
Notepad++ project site:
http://sourceforge.net/projects/notepad-plus/
@ -41,4 +41,4 @@ Notepad++ channel:
Notepad++ team:
***************
http://sourceforge.net/project/memberlist.php?group_id=95717
http://notepad-plus-plus.org/members

View File

@ -173,8 +173,7 @@ LRESULT Notepad_plus::init(HWND hwnd)
_mainWindowStatus = WindowMainActive;
_activeView = MAIN_VIEW;
const ScintillaViewParams & svp1 = pNppParam->getSVP(SCIV_PRIMARY);
//const ScintillaViewParams & svp2 = pNppParam->getSVP(SCIV_SECOND);
const ScintillaViewParams & svp1 = pNppParam->getSVP();
int tabBarStatus = nppGUI._tabStatus;
_toReduceTabBar = ((tabBarStatus & TAB_REDUCE) != 0);
@ -241,7 +240,7 @@ LRESULT Notepad_plus::init(HWND hwnd)
_zoomOriginalValue = _pEditView->execute(SCI_GETZOOM);
_mainEditView.execute(SCI_SETZOOM, svp1._zoom);
_subEditView.execute(SCI_SETZOOM, svp1._zoom);
_subEditView.execute(SCI_SETZOOM, svp1._zoom2);
::SendMessage(hwnd, NPPM_INTERNAL_SETMULTISELCTION, 0, 0);
@ -1999,8 +1998,8 @@ void Notepad_plus::specialCmd(int id/*, int param*/)
case IDM_SETTING_EDGE_SIZE :
{
ValueDlg nbColumnEdgeDlg;
//ScintillaViewParams & svp = (ScintillaViewParams &)pNppParam->getSVP(param == 1?SCIV_PRIMARY:SCIV_SECOND);
ScintillaViewParams & svp = (ScintillaViewParams &)pNppParam->getSVP(SCIV_PRIMARY);
ScintillaViewParams & svp = (ScintillaViewParams &)pNppParam->getSVP();
nbColumnEdgeDlg.init(_pPublicInterface->getHinst(), _preference.getHSelf(), svp._edgeNbColumn, TEXT("Nb of column:"));
nbColumnEdgeDlg.setNBNumber(3);
@ -3180,11 +3179,13 @@ bool Notepad_plus::doStreamComment()
return true;
}
bool Notepad_plus::saveScintillaParams(bool whichOne)
bool Notepad_plus::saveScintillaParams()
{
NppParameters * pNppParam = NppParameters::getInstance();
ScintillaViewParams & svp = (ScintillaViewParams &)pNppParam->getSVP(SCIV_PRIMARY);
return (NppParameters::getInstance())->writeScintillaParams(svp, whichOne);
ScintillaViewParams & svp = (ScintillaViewParams &)pNppParam->getSVP();
svp._zoom = int(_mainEditView.execute(SCI_GETZOOM));
svp._zoom2 = int(_subEditView.execute(SCI_GETZOOM));
return (NppParameters::getInstance())->writeScintillaParams(svp);
}
bool Notepad_plus::addCurrentMacro()

View File

@ -231,7 +231,7 @@ public:
bool isFileSession(const TCHAR * filename);
void filePrint(bool showDialog);
bool saveScintillaParams(bool whichOne);
bool saveScintillaParams();
bool saveGUIParams();
void saveDockingParams();

View File

@ -1374,7 +1374,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
saveFindHistory();
_lastRecentFileList.saveLRFL();
saveScintillaParams(SCIV_PRIMARY);
saveScintillaParams();
saveGUIParams();
saveUserDefineLangs();
saveShortcuts();

View File

@ -3403,14 +3403,9 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
else if (!lstrcmp(nm, TEXT("ScintillaPrimaryView")))
{
feedScintillaParam(SCIV_PRIMARY, element);
feedScintillaParam(element);
}
/*
else if (!lstrcmp(nm, TEXT("ScintillaSecondaryView")))
{
feedScintillaParam(SCIV_SECOND, element);
}
*/
else if (!lstrcmp(nm, TEXT("Backup")))
{
int i;
@ -3565,7 +3560,7 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
}
}
void NppParameters::feedScintillaParam(bool whichOne, TiXmlNode *node)
void NppParameters::feedScintillaParam(TiXmlNode *node)
{
TiXmlElement *element = node->ToElement();
@ -3574,9 +3569,9 @@ void NppParameters::feedScintillaParam(bool whichOne, TiXmlNode *node)
if (nm)
{
if (!lstrcmp(nm, TEXT("show")))
_svp[whichOne]._lineNumberMarginShow = true;
_svp._lineNumberMarginShow = true;
else if (!lstrcmp(nm, TEXT("hide")))
_svp[whichOne]._lineNumberMarginShow = false;
_svp._lineNumberMarginShow = false;
}
// Bookmark Margin
@ -3585,9 +3580,9 @@ void NppParameters::feedScintillaParam(bool whichOne, TiXmlNode *node)
{
if (!lstrcmp(nm, TEXT("show")))
_svp[whichOne]._bookMarkMarginShow = true;
_svp._bookMarkMarginShow = true;
else if (!lstrcmp(nm, TEXT("hide")))
_svp[whichOne]._bookMarkMarginShow = false;
_svp._bookMarkMarginShow = false;
}
/*
// doc change state Margin
@ -3596,9 +3591,9 @@ void NppParameters::feedScintillaParam(bool whichOne, TiXmlNode *node)
{
if (!lstrcmp(nm, TEXT("show")))
_svp[whichOne]._docChangeStateMarginShow = true;
_svp._docChangeStateMarginShow = true;
else if (!lstrcmp(nm, TEXT("hide")))
_svp[whichOne]._docChangeStateMarginShow = false;
_svp._docChangeStateMarginShow = false;
}
*/
// Indent GuideLine
@ -3606,9 +3601,9 @@ void NppParameters::feedScintillaParam(bool whichOne, TiXmlNode *node)
if (nm)
{
if (!lstrcmp(nm, TEXT("show")))
_svp[whichOne]._indentGuideLineShow = true;
_svp._indentGuideLineShow = true;
else if (!lstrcmp(nm, TEXT("hide")))
_svp[whichOne]._indentGuideLineShow= false;
_svp._indentGuideLineShow= false;
}
// Folder Mark Style
@ -3616,15 +3611,15 @@ void NppParameters::feedScintillaParam(bool whichOne, TiXmlNode *node)
if (nm)
{
if (!lstrcmp(nm, TEXT("box")))
_svp[whichOne]._folderStyle = FOLDER_STYLE_BOX;
_svp._folderStyle = FOLDER_STYLE_BOX;
else if (!lstrcmp(nm, TEXT("circle")))
_svp[whichOne]._folderStyle = FOLDER_STYLE_CIRCLE;
_svp._folderStyle = FOLDER_STYLE_CIRCLE;
else if (!lstrcmp(nm, TEXT("arrow")))
_svp[whichOne]._folderStyle = FOLDER_STYLE_ARROW;
_svp._folderStyle = FOLDER_STYLE_ARROW;
else if (!lstrcmp(nm, TEXT("simple")))
_svp[whichOne]._folderStyle = FOLDER_STYLE_SIMPLE;
_svp._folderStyle = FOLDER_STYLE_SIMPLE;
else if (!lstrcmp(nm, TEXT("none")))
_svp[whichOne]._folderStyle = FOLDER_STYLE_NONE;
_svp._folderStyle = FOLDER_STYLE_NONE;
}
// Line Wrap method
@ -3632,11 +3627,11 @@ void NppParameters::feedScintillaParam(bool whichOne, TiXmlNode *node)
if (nm)
{
if (!lstrcmp(nm, TEXT("default")))
_svp[whichOne]._lineWrapMethod = LINEWRAP_DEFAULT;
_svp._lineWrapMethod = LINEWRAP_DEFAULT;
else if (!lstrcmp(nm, TEXT("aligned")))
_svp[whichOne]._lineWrapMethod = LINEWRAP_ALIGNED;
_svp._lineWrapMethod = LINEWRAP_ALIGNED;
else if (!lstrcmp(nm, TEXT("indent")))
_svp[whichOne]._lineWrapMethod = LINEWRAP_INDENT;
_svp._lineWrapMethod = LINEWRAP_INDENT;
}
// Current Line Highlighting State
@ -3644,9 +3639,9 @@ void NppParameters::feedScintillaParam(bool whichOne, TiXmlNode *node)
if (nm)
{
if (!lstrcmp(nm, TEXT("show")))
_svp[whichOne]._currentLineHilitingShow = true;
_svp._currentLineHilitingShow = true;
else if (!lstrcmp(nm, TEXT("hide")))
_svp[whichOne]._currentLineHilitingShow = false;
_svp._currentLineHilitingShow = false;
}
// Current wrap symbol visibility State
@ -3654,9 +3649,9 @@ void NppParameters::feedScintillaParam(bool whichOne, TiXmlNode *node)
if (nm)
{
if (!lstrcmp(nm, TEXT("show")))
_svp[whichOne]._wrapSymbolShow = true;
_svp._wrapSymbolShow = true;
else if (!lstrcmp(nm, TEXT("hide")))
_svp[whichOne]._wrapSymbolShow = false;
_svp._wrapSymbolShow = false;
}
// Do Wrap
@ -3664,9 +3659,9 @@ void NppParameters::feedScintillaParam(bool whichOne, TiXmlNode *node)
if (nm)
{
if (!lstrcmp(nm, TEXT("yes")))
_svp[whichOne]._doWrap = true;
_svp._doWrap = true;
else if (!lstrcmp(nm, TEXT("no")))
_svp[whichOne]._doWrap = false;
_svp._doWrap = false;
}
// Do Edge
@ -3674,24 +3669,30 @@ void NppParameters::feedScintillaParam(bool whichOne, TiXmlNode *node)
if (nm)
{
if (!lstrcmp(nm, TEXT("background")))
_svp[whichOne]._edgeMode = EDGE_BACKGROUND;
_svp._edgeMode = EDGE_BACKGROUND;
else if (!lstrcmp(nm, TEXT("line")))
_svp[whichOne]._edgeMode = EDGE_LINE;
_svp._edgeMode = EDGE_LINE;
else
_svp[whichOne]._edgeMode = EDGE_NONE;
_svp._edgeMode = EDGE_NONE;
}
int val;
nm = element->Attribute(TEXT("edgeNbColumn"), &val);
if (nm)
{
_svp[whichOne]._edgeNbColumn = val;
_svp._edgeNbColumn = val;
}
nm = element->Attribute(TEXT("zoom"), &val);
if (nm)
{
_svp[whichOne]._zoom = val;
_svp._zoom = val;
}
nm = element->Attribute(TEXT("zoom2"), &val);
if (nm)
{
_svp._zoom2 = val;
}
// White Space visibility State
@ -3699,9 +3700,9 @@ void NppParameters::feedScintillaParam(bool whichOne, TiXmlNode *node)
if (nm)
{
if (!lstrcmp(nm, TEXT("show")))
_svp[whichOne]._whiteSpaceShow = true;
_svp._whiteSpaceShow = true;
else if (!lstrcmp(nm, TEXT("hide")))
_svp[whichOne]._whiteSpaceShow = false;
_svp._whiteSpaceShow = false;
}
// EOL visibility State
@ -3709,9 +3710,9 @@ void NppParameters::feedScintillaParam(bool whichOne, TiXmlNode *node)
if (nm)
{
if (!lstrcmp(nm, TEXT("show")))
_svp[whichOne]._eolShow = true;
_svp._eolShow = true;
else if (!lstrcmp(nm, TEXT("hide")))
_svp[whichOne]._eolShow = false;
_svp._eolShow = false;
}
}
@ -3800,11 +3801,11 @@ void NppParameters::feedDockingManager(TiXmlNode *node)
}
}
bool NppParameters::writeScintillaParams(const ScintillaViewParams & svp, bool whichOne)
bool NppParameters::writeScintillaParams(const ScintillaViewParams & svp)
{
if (!_pXmlUserDoc) return false;
const TCHAR *pViewName = (whichOne == SCIV_PRIMARY)?TEXT("ScintillaPrimaryView"):TEXT("ScintillaSecondaryView");
const TCHAR *pViewName = TEXT("ScintillaPrimaryView");
TiXmlNode *nppRoot = _pXmlUserDoc->FirstChild(TEXT("NotepadPlus"));
if (!nppRoot) return false;
@ -3841,6 +3842,7 @@ bool NppParameters::writeScintillaParams(const ScintillaViewParams & svp, bool w
(scintNode->ToElement())->SetAttribute(TEXT("edge"), edgeStr);
(scintNode->ToElement())->SetAttribute(TEXT("edgeNbColumn"), svp._edgeNbColumn);
(scintNode->ToElement())->SetAttribute(TEXT("zoom"), svp._zoom);
(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"));

View File

@ -95,10 +95,6 @@ const int COPYDATA_PARAMS = 0;
const int COPYDATA_FILENAMESA = 1;
const int COPYDATA_FILENAMESW = 2;
const bool SCIV_PRIMARY = false;
const bool SCIV_SECOND = true;
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");
@ -766,6 +762,7 @@ struct ScintillaViewParams
int _edgeMode;
int _edgeNbColumn;
int _zoom;
int _zoom2;
bool _whiteSpaceShow;
bool _eolShow;
@ -1160,8 +1157,8 @@ public:
int getNbMaxFile() const {return _nbMaxFile;};
const ScintillaViewParams & getSVP(bool whichOne) const {
return _svp[whichOne];
const ScintillaViewParams & getSVP() const {
return _svp;
};
bool writeNbHistoryFile(int nb) {
@ -1182,7 +1179,7 @@ public:
TiXmlNode * getChildElementByAttribut(TiXmlNode *pere, const TCHAR *childName,\
const TCHAR *attributName, const TCHAR *attributVal) const;
bool writeScintillaParams(const ScintillaViewParams & svp, bool whichOne);
bool writeScintillaParams(const ScintillaViewParams & svp);
bool writeGUIParams();
@ -1446,7 +1443,7 @@ private:
vector<TiXmlDocument *> _pXmlExternalLexerDoc;
NppGUI _nppGUI;
ScintillaViewParams _svp[2];
ScintillaViewParams _svp;
Lang *_langList[NB_LANG];
int _nbLang;
@ -1553,7 +1550,7 @@ private:
void feedGUIParameters(TiXmlNode *node);
void feedKeyWordsParameters(TiXmlNode *node);
void feedFileListParameters(TiXmlNode *node);
void feedScintillaParam(bool whichOne, TiXmlNode *node);
void feedScintillaParam(TiXmlNode *node);
void feedDockingManager(TiXmlNode *node);
void feedFindHistoryParameters(TiXmlNode *node);

View File

@ -1099,7 +1099,7 @@ void ScintillaEditView::defineDocType(LangType typeDoc)
}
NppParameters *pNppParam = NppParameters::getInstance();
ScintillaViewParams & svp = (ScintillaViewParams &)pNppParam->getSVP(SCIV_PRIMARY);
ScintillaViewParams & svp = (ScintillaViewParams &)pNppParam->getSVP();
if (svp._folderStyle != FOLDER_STYLE_NONE)
showMargin(_SC_MARGE_FOLDER, isNeededFolderMarge(typeDoc));
@ -2040,7 +2040,7 @@ void ScintillaEditView::performGlobalStyles()
foldfgColor = style._bgColor;
foldbgColor = style._fgColor;
}
ScintillaViewParams & svp = (ScintillaViewParams &)_pParameter->getSVP(SCIV_PRIMARY);
ScintillaViewParams & svp = (ScintillaViewParams &)_pParameter->getSVP();
for (int j = 0 ; j < NB_FOLDER_STATE ; j++)
defineMarker(_markersArray[FOLDER_TYPE][j], _markersArray[svp._folderStyle][j], foldfgColor, foldbgColor);
/*

View File

@ -332,7 +332,7 @@ BOOL CALLBACK BarsDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM)
void MarginsDlg::initScintParam()
{
NppParameters *pNppParam = NppParameters::getInstance();
const ScintillaViewParams & svp = pNppParam->getSVP(SCIV_PRIMARY);
const ScintillaViewParams & svp = pNppParam->getSVP();
::SendDlgItemMessage(_hSelf, IDC_RADIO_BOX, BM_SETCHECK, FALSE, 0);
::SendDlgItemMessage(_hSelf, IDC_RADIO_CIRCLE, BM_SETCHECK, FALSE, 0);
@ -442,7 +442,7 @@ BOOL CALLBACK MarginsDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM)
case WM_COMMAND :
{
ScintillaViewParams & svp = (ScintillaViewParams &)pNppParam->getSVP(SCIV_PRIMARY);
ScintillaViewParams & svp = (ScintillaViewParams &)pNppParam->getSVP();
int iView = 1;
switch (wParam)
{

View File

@ -21,7 +21,6 @@
<!-- For the secodary scintilla view,
2 status for Attribut lineNumberMargin, bookMarkMargin, indentGuideLine and currentLineHilitingShow: "show" or "hide"
4 status for Attribut folderMarkStyle : "simple", "arrow", "circle" and "box" -->
<GUIConfig name="ScintillaSecondaryView" lineNumberMargin="show" bookMarkMargin="show" folderMarkStyle="box" indentGuideLine="show" currentLineHilitingShow="show" Wrap="no" edge="no" edgeNbColumn="80" wrapSymbolShow="hide" zoom="0" whiteSpaceShow="hide" eolShow="hide" />
<GUIConfig name="Auto-detection">yes</GUIConfig>
<GUIConfig name="CheckHistoryFiles">no</GUIConfig>
<GUIConfig name="TrayIcon">no</GUIConfig>