[BUG_FIXED] Changing global stylers now affects the Finder window.

[BUG_FIXED] Changing current line background color of the search result styler now affects the Finder window.
[UPDATE] Some other updates regarding the finder styles.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository@427 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
yniq 2009-02-11 16:09:44 +00:00
parent e1c1a64b1f
commit 4e74b2dff4
4 changed files with 21 additions and 48 deletions

View File

@ -8212,6 +8212,7 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
_subEditView.defineDocType(_subEditView.getCurrentBuffer()->getLangType());
_mainEditView.performGlobalStyles();
_subEditView.performGlobalStyles();
_findReplaceDlg.updateFinderScintilla();
drawTabbarColoursFromStylerArray();
@ -8224,12 +8225,6 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
return TRUE;
}
case WM_UPDATEFINDERSCINTILLA :
{
_findReplaceDlg.updateFinderScintilla();
return TRUE;
}
case WM_QUERYENDSESSION:
case WM_CLOSE:
{

View File

@ -461,7 +461,7 @@ void Finder::DeleteResult()
int end = _scintView.execute(SCI_GETLINEENDPOSITION, lno);
if (start + 2 >= end) return; // avoid empty lines
setFinderStyle(); // Restore searchResult lexer in case the lexer was changed to SCLEX_NULL in GotoFoundLine()
_scintView.setLexer(SCLEX_SEARCHRESULT, L_SEARCHRESULT, 0); // Restore searchResult lexer in case the lexer was changed to SCLEX_NULL in GotoFoundLine()
if (_scintView.execute(SCI_GETFOLDLEVEL, lno) & SC_FOLDLEVELHEADERFLAG) // delete a folder
{
@ -1458,21 +1458,6 @@ void FindReplaceDlg::findAllIn(InWhat op)
// Subclass the ScintillaEditView for the Finder (Scintilla doesn't notify all key presses)
originalFinderProc = SetWindowLong( _pFinder->_scintView.getHSelf(), GWL_WNDPROC, (LONG) finderProc);
//_pFinder->_scintView.performGlobalStyles(); // yniq - needed?
// Set current line background color for the finder
TCHAR* lang = TEXT("searchResult");
NppParameters *_pParameter = NppParameters::getInstance();
LexerStylerArray & stylers = _pParameter->getLStylerArray();
LexerStyler *pStyler = stylers.getLexerStylerByName(lang);
int i = pStyler->getStylerIndexByID(SCE_SEARCHRESULT_CURRENT_LINE);
if (i != -1)
{
Style & style = pStyler->getStyler(i);
_pFinder->_scintView.execute(SCI_SETCARETLINEBACK, style._bgColor);
}
_pFinder->setFinderReadOnly(true);
_pFinder->_scintView.execute(SCI_SETCODEPAGE, SC_CP_DBCS);
_pFinder->_scintView.execute(SCI_USEPOPUP, FALSE);
@ -1480,7 +1465,9 @@ void FindReplaceDlg::findAllIn(InWhat op)
_pFinder->_scintView.execute(SCI_SETCARETLINEVISIBLE, 1);
_pFinder->_scintView.execute(SCI_SETCARETWIDTH, 0);
_pFinder->_scintView.showMargin(ScintillaEditView::_SC_MARGE_FOLDER, true);
//_pFinder->_scintView.execute(SCI_SETEOLMODE, SC_EOL_CRLF); // yniq - needed?
// Send the address of _MarkingsStruct to the lexer
char ptrword[sizeof(void*)*2+1];
sprintf(ptrword, "%p", &_pFinder->_MarkingsStruct);
_pFinder->_scintView.execute(SCI_SETKEYWORDS, 0, (LPARAM) ptrword);
@ -1613,19 +1600,24 @@ void FindReplaceDlg::getPatterns(vector<generic_string> & patternVect)
void Finder::setFinderStyle()
{
StyleArray & stylers = (_scintView.getParameter())->getMiscStylerArray();
int iStyleDefault = stylers.getStylerIndexByID(STYLE_DEFAULT);
if (iStyleDefault != -1)
// Set global styles for the finder
_scintView.performGlobalStyles();
// Set current line background color for the finder
const TCHAR * lexerName = ScintillaEditView::langNames[L_SEARCHRESULT].lexerName;
LexerStyler *pStyler = (_scintView._pParameter->getLStylerArray()).getLexerStylerByName(lexerName);
if (pStyler)
{
Style & styleDefault = stylers.getStyler(iStyleDefault);
styleDefault._colorStyle = COLORSTYLE_ALL; //All colors set
_scintView.setStyle(styleDefault);
int i = pStyler->getStylerIndexByID(SCE_SEARCHRESULT_CURRENT_LINE);
if (i != -1)
{
Style & style = pStyler->getStyler(i);
_scintView.execute(SCI_SETCARETLINEBACK, style._bgColor);
}
_scintView.execute(SCI_STYLECLEARALL);
_scintView.execute(SCI_SETSTYLEBITS, 5);
}
_scintView.setSearchResultLexer();
_scintView.execute(SCI_COLOURISE, 0, -1);
_scintView.execute(SCI_SETEOLMODE, SC_EOL_CRLF);
}
BOOL CALLBACK Finder::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam)

View File

@ -217,7 +217,6 @@ BOOL CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPar
_isDirty = false;
setVisualFromStyleList();
::SendMessage(_hParent, WM_UPDATESCINTILLAS, 0, 0);
::SendMessage(_hParent, WM_UPDATEFINDERSCINTILLA, 0, 0);
}
::EnableWindow(::GetDlgItem(_hSelf, IDC_SAVECLOSE_BUTTON), !_isSync);
display(false);
@ -707,17 +706,5 @@ void WordStyleDlg::apply()
::EnableWindow(::GetDlgItem(_hSelf, IDOK), FALSE);
//_isDirty = false;
_isSync = false;
TCHAR str[256] = TEXT("");
int i = ::SendDlgItemMessage(_hSelf, IDC_LANGUAGES_LIST, LB_GETCURSEL, 0, 0);
if (i == LB_ERR)
return;
::SendDlgItemMessage(_hSelf, IDC_LANGUAGES_LIST, LB_GETTEXT, i, (LPARAM)str);
int cmdid = 0;
if (lstrcmp(str, TEXT("Search result")) == 0)
cmdid = WM_UPDATEFINDERSCINTILLA;
else
cmdid = WM_UPDATESCINTILLAS;
::SendMessage(_hParent, cmdid, 0, 0);
::SendMessage(_hParent, WM_UPDATESCINTILLAS, 0, 0);
}

View File

@ -29,7 +29,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "resource.h"
#define WM_UPDATESCINTILLAS (WORDSTYLE_USER + 1) //GlobalStyleDlg's msg 2 send 2 its parent
#define WM_UPDATEFINDERSCINTILLA (WORDSTYLE_USER + 2) //the msg 2 notify the finder's styles changed
enum fontStyleType {BOLD_STATUS, ITALIC_STATUS, UNDERLINE_STATUS};