[RELEASE_V42]

1. Fix User Define Language extension recognition problem for sensitive case (now it's insensitive). 
2. Add a menu entry to access to notepad++ plugins project page. 
3. Enhance file open dialog (add all supported extensions in the filters list). 
4. Fix bug of Run macro until EOF. 

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository@5 f5eea248-9336-0410-98b8-ebc06183d4e3
pull/343/head^2
donho 2007-08-12 23:21:25 +00:00
parent 98e9f1f971
commit 2322694649
14 changed files with 402 additions and 260 deletions

View File

@ -8,13 +8,15 @@ v4.2 fixed bugs and added features (from v4.1.2) :
6. Fix TeX syntax highlighting corruption problem while switching off then switching back to current document.
7. Fix User Define Language extension recognition problem for sensitive case (now it's insensitive).
8. Add a menu entry to access to notepad++ plugins project page.
9. Enhance file open dialog (add all supported extensions in the filters list).
10. Fix bug of Run macro until EOF.
Plugins included in v4.2 :
1. TexFX v0.24a
2. Function list v1.2
3. ConvertExt v1.1
4. NppExec v0.2 beta 3
4. NppExec v0.2 beta 4
5. Spell checker v1.1
6. Quick text v0.02
7. Explorer v1.4

View File

@ -17,13 +17,13 @@
; Define the application name
!define APPNAME "Notepad++"
!define APPNAMEANDVERSION "Notepad++ v4.1.2"
!define APPNAMEANDVERSION "Notepad++ v4.2"
; Main Install settings
Name "${APPNAMEANDVERSION}"
InstallDir "$PROGRAMFILES\Notepad++"
InstallDirRegKey HKLM "Software\${APPNAME}" ""
OutFile "..\bin\npp.4.1.2.Installer.exe"
OutFile "..\bin\npp.4.2.Installer.exe"
@ -175,7 +175,7 @@ OutFile "..\bin\npp.4.1.2.Installer.exe"
!insertmacro MUI_LANGUAGE "PortugueseBR"
!insertmacro MUI_LANGUAGE "Ukrainian"
!insertmacro MUI_LANGUAGE "Turkish"
!insertmacro MUI_LANGUAGE "Catalan"
;!insertmacro MUI_LANGUAGE "Catalan"
!insertmacro MUI_LANGUAGE "Arabic"
!insertmacro MUI_LANGUAGE "Lithuanian"
!insertmacro MUI_LANGUAGE "Finnish"
@ -642,7 +642,7 @@ SubSection "Plugins" Plugins
SetOutPath "$INSTDIR\plugins"
File "..\bin\plugins\FunctionList.dll"
SectionEnd
/*
Section "File Browser" FileBrowser
Delete "$INSTDIR\plugins\ExplorerPlugin.dll"
SetOutPath "$INSTDIR\plugins"
@ -654,7 +654,7 @@ SubSection "Plugins" Plugins
SetOutPath "$INSTDIR\plugins"
File "..\bin\plugins\HexEditor.dll"
SectionEnd
*/
Section "ConvertExt" ConvertExt
SetOutPath "$INSTDIR\plugins"
File "..\bin\plugins\ConvertExt.dll"
@ -842,7 +842,7 @@ SubSection un.Plugins
Delete "$INSTDIR\plugins\FunctionList.dll"
RMDir "$INSTDIR\plugins\"
SectionEnd
/*
Section un.FileBrowser
Delete "$INSTDIR\plugins\Explorer.dll"
Delete "$INSTDIR\plugins\Config\Explorer.ini"
@ -854,7 +854,7 @@ SubSection un.Plugins
Delete "$INSTDIR\plugins\HexEditor.dll"
RMDir "$INSTDIR\plugins\"
SectionEnd
*/
Section un.ConvertExt
Delete "$INSTDIR\plugins\ConvertExt.dll"

View File

@ -486,26 +486,110 @@ bool Notepad_plus::doOpen(const char *fileName, bool isReadOnly)
return false;
}
}
string exts2Filters(string exts) {
const char *extStr = exts.c_str();
char aExt[MAX_PATH];
string filters("");
int j = 0;
bool stop = false;
for (size_t i = 0 ; i < exts.length() ; i++)
{
if (extStr[i] == ' ')
{
if (!stop)
{
aExt[j] = '\0';
stop = true;
if (aExt[0])
{
filters += "*.";
filters += aExt;
filters += ";";
}
j = 0;
}
}
else
{
aExt[j] = extStr[i];
stop = false;
j++;
}
}
if (j > 0)
{
aExt[j] = '\0';
if (aExt[0])
{
filters += "*.";
filters += aExt;
filters += ";";
}
}
// remove the last ';'
filters = filters.substr(0, filters.length()-1);
return filters;
};
void Notepad_plus::fileOpen()
{
FileDialog fDlg(_hSelf, _hInst);
fDlg.setExtFilter("All types", ".*", NULL);
fDlg.setExtFilter("All types", ".*", NULL);
fDlg.setExtFilter("c/c++ src file", ".c", ".cpp", ".cxx", ".cc", ".h", NULL);
fDlg.setExtFilter("Window Resource File", ".rc", NULL);
NppParameters *pNppParam = NppParameters::getInstance();
NppGUI & nppGUI = (NppGUI & )pNppParam->getNppGUI();
int i = 0;
Lang *l = NppParameters::getInstance()->getLangFromIndex(i++);
while (l)
{
LangType lid = l->getLangID();
bool inExcludedList = false;
for (size_t j = 0 ; j < nppGUI._excludedLangList.size() ; j++)
{
if (lid == nppGUI._excludedLangList[j]._langType)
{
inExcludedList = true;
break;
}
}
if (!inExcludedList)
{
const char *defList = l->getDefaultExtList();
const char *userList = NULL;
LexerStylerArray &lsa = (NppParameters::getInstance())->getLStylerArray();
const char *lName = l->getLangName();
LexerStyler *pLS = lsa.getLexerStylerByName(lName);
if (pLS)
userList = pLS->getLexerUserExt();
std::string list("");
if (defList)
list += defList;
if (userList)
{
list += " ";
list += userList;
}
string stringFilters = exts2Filters(list);
const char *filters = stringFilters.c_str();
if (filters[0])
fDlg.setExtsFilter(getLangDesc(lid, true).c_str(), filters);
}
l = (NppParameters::getInstance())->getLangFromIndex(i++);
}
fDlg.setExtFilter("Java src file", ".java", NULL);
fDlg.setExtFilter("HTML file", ".html", ".htm", NULL);
fDlg.setExtFilter("XML file", ".xml", NULL);
fDlg.setExtFilter("Makefile", "makefile", "GNUmakefile", ".makefile", NULL);
fDlg.setExtFilter("php file", ".php", ".php3", ".phtml", NULL);
fDlg.setExtFilter("asp file", ".asp", NULL);
fDlg.setExtFilter("ini file", ".ini", NULL);
fDlg.setExtFilter("nfo file", ".nfo", NULL);
fDlg.setExtFilter("VB/VBS file", ".vb", ".vbs", NULL);
fDlg.setExtFilter("SQL file", ".sql", NULL);
fDlg.setExtFilter("Objective C file", ".m", ".h", NULL);
if (stringVector *pfns = fDlg.doOpenMultiFilesDlg())
{
int sz = int(pfns->size());
@ -1123,166 +1207,167 @@ void Notepad_plus::checkLangsMenu(int id) const
}
::CheckMenuRadioItem(::GetMenu(_hSelf), IDM_LANG_C, IDM_LANG_USER_LIMIT, id, MF_BYCOMMAND);
}
void Notepad_plus::setLangStatus(LangType langType)
string Notepad_plus::getLangDesc(LangType langType, bool shortDesc)
{
string str2Show;
switch (langType)
{
case L_C:
str2Show = "c source file"; break;
case L_C:
str2Show = (shortDesc)?"C":"C source file"; break;
case L_CPP:
str2Show = "c++ source file"; break;
case L_CPP:
str2Show = (shortDesc)?"C++":"C++ source file"; break;
case L_OBJC:
str2Show = "Objective C source file"; break;
case L_OBJC:
str2Show = (shortDesc)?"Objective-C":"Objective-C source file"; break;
case L_JAVA:
str2Show = "Java source file"; break;
case L_JAVA:
str2Show = (shortDesc)?"Java":"Java source file"; break;
case L_CS:
str2Show = "C# source file"; break;
case L_CS:
str2Show = (shortDesc)?"C#":"C# source file"; break;
case L_RC :
str2Show = "Windows Resource file"; break;
case L_MAKEFILE:
str2Show = "Makefile"; break;
case L_RC :
str2Show = (shortDesc)?"RC":"Windows Resource file"; break;
case L_MAKEFILE:
str2Show = "Makefile"; break;
case L_HTML:
str2Show = "Hyper Text Markup Language file"; break;
case L_HTML:
str2Show = (shortDesc)?"HTML":"Hyper Text Markup Language file"; break;
case L_XML:
str2Show = "eXtensible Markup Language file"; break;
case L_XML:
str2Show = (shortDesc)?"XML":"eXtensible Markup Language file"; break;
case L_JS:
str2Show = "Javascript file"; break;
case L_JS:
str2Show = (shortDesc)?"JavaScript":"JavaScript file"; break;
case L_PHP:
str2Show = "PHP Hypertext Preprocessor file"; break;
case L_PHP:
str2Show = (shortDesc)?"PHP":"PHP Hypertext Preprocessor file"; break;
case L_ASP:
str2Show = "Active Server Pages script file"; break;
case L_ASP:
str2Show = (shortDesc)?"ASP":"Active Server Pages script file"; break;
case L_CSS:
str2Show = "Cascade Style Sheets File"; break;
case L_CSS:
str2Show = (shortDesc)?"CSS":"Cascade Style Sheets File"; break;
case L_LUA:
str2Show = "Lua source File"; break;
case L_LUA:
str2Show = (shortDesc)?"Lua":"Lua source File"; break;
case L_NFO:
str2Show = "MSDOS Style"; break;
case L_NFO:
str2Show = (shortDesc)?"NFO":"MSDOS Style"; break;
case L_SQL:
str2Show = "Structure Query Language file"; break;
case L_SQL:
str2Show = (shortDesc)?"SQL":"Structure Query Language file"; break;
case L_VB:
str2Show = "Visual Basic file"; break;
case L_VB:
str2Show =(shortDesc)?"VB": "Visual Basic file"; break;
case L_BATCH :
str2Show = "Batch file"; break;
case L_BATCH :
str2Show = (shortDesc)?"Batch":"Batch file"; break;
case L_PASCAL :
str2Show = "Pascal source file"; break;
case L_PASCAL :
str2Show = (shortDesc)?"Pascal":"Pascal source file"; break;
case L_PERL :
str2Show = "Perl source file"; break;
case L_PERL :
str2Show = (shortDesc)?"Perl":"Perl source file"; break;
case L_PYTHON :
str2Show = "Python file"; break;
case L_PYTHON :
str2Show = (shortDesc)?"Python":"Python file"; break;
case L_TEX :
str2Show = "TeX file"; break;
case L_TEX :
str2Show = (shortDesc)?"TeX":"TeX file"; break;
case L_FORTRAN :
str2Show = "Fortran source file"; break;
case L_FORTRAN :
str2Show = (shortDesc)?"Fortran":"Fortran source file"; break;
case L_BASH :
str2Show = "Unix script file"; break;
case L_BASH :
str2Show = (shortDesc)?"Shell":"Unix script file"; break;
case L_FLASH :
str2Show = "Flash Action script file"; break;
case L_FLASH :
str2Show = (shortDesc)?"Flash Action":"Flash Action script file"; break;
case L_NSIS :
str2Show = "Nullsoft Scriptable Install System script file"; break;
case L_NSIS :
str2Show = (shortDesc)?"NSIS":"Nullsoft Scriptable Install System script file"; break;
case L_TCL :
str2Show = "Tool Command Language file"; break;
case L_TCL :
str2Show = (shortDesc)?"TCL":"Tool Command Language file"; break;
case L_LISP :
str2Show = "List Processing language file"; break;
case L_LISP :
str2Show = (shortDesc)?"Lisp":"List Processing language file"; break;
case L_SCHEME :
str2Show = "Sheme file"; break;
case L_SCHEME :
str2Show = (shortDesc)?"Scheme":"Scheme file"; break;
case L_ASM :
str2Show = "Assembler file"; break;
case L_ASM :
str2Show = (shortDesc)?"Assembler":"Assembler file"; break;
case L_DIFF :
str2Show = "Diff file"; break;
case L_DIFF :
str2Show = (shortDesc)?"Diff":"Diff file"; break;
case L_PROPS :
str2Show = "Properties file"; break;
case L_PROPS :
str2Show = "Properties file"; break;
case L_PS :
str2Show = "Postscript file"; break;
case L_PS :
str2Show = (shortDesc)?"Postscript":"Postscript file"; break;
case L_RUBY :
str2Show = "Ruby file"; break;
case L_RUBY :
str2Show = (shortDesc)?"Ruby":"Ruby file"; break;
case L_SMALLTALK :
str2Show = "Smalltalk file"; break;
case L_SMALLTALK :
str2Show = (shortDesc)?"Smalltalk":"Smalltalk file"; break;
case L_VHDL :
str2Show = "VHSIC Hardware Description Language file"; break;
case L_VHDL :
str2Show = (shortDesc)?"VHDL":"VHSIC Hardware Description Language file"; break;
case L_VERILOG :
str2Show = "Verilog file"; break;
case L_VERILOG :
str2Show = (shortDesc)?"Verilog":"Verilog file"; break;
case L_KIX :
str2Show = "KiXtart file"; break;
case L_KIX :
str2Show = (shortDesc)?"KiXtart":"KiXtart file"; break;
case L_ADA :
str2Show = "Ada file"; break;
case L_ADA :
str2Show = (shortDesc)?"Ada":"Ada file"; break;
case L_CAML :
str2Show = "Categorical Abstract Machine Language"; break;
case L_CAML :
str2Show = (shortDesc)?"CAML":"Categorical Abstract Machine Language"; break;
case L_AU3 :
str2Show = "AutoIt"; break;
case L_AU3 :
str2Show = (shortDesc)?"AutoIt":"AutoIt"; break;
case L_MATLAB :
str2Show = "MATrix LABoratory"; break;
case L_MATLAB :
str2Show = (shortDesc)?"MATLAB":"MATrix LABoratory"; break;
case L_HASKELL :
str2Show = "Haskell"; break;
case L_HASKELL :
str2Show = "Haskell"; break;
case L_INNO :
str2Show = "Inno Setup script"; break;
case L_INNO :
str2Show = (shortDesc)?"Inno":"Inno Setup script"; break;
case L_CMAKE :
str2Show = "CMAKEFILE"; break;
case L_CMAKE :
str2Show = "CMAKEFILE"; break;
case L_USER:
{
str2Show = "User Define File";
Buffer & currentBuf = _pEditView->getCurrentBuffer();
if (currentBuf.isUserDefineLangExt())
case L_USER:
{
str2Show += " - ";
str2Show += currentBuf.getUserDefineLangName();
str2Show = "User Define File";
Buffer & currentBuf = _pEditView->getCurrentBuffer();
if (currentBuf.isUserDefineLangExt())
{
str2Show += " - ";
str2Show += currentBuf.getUserDefineLangName();
}
break;
}
break;
}
default:
str2Show = "Normal text file";
default:
str2Show = "Normal text file";
}
_statusBar.setText(str2Show.c_str(), STATUSBAR_DOC_TYPE);
return str2Show;
}
void Notepad_plus::getApiFileName(LangType langType, string &fn)
{
@ -5760,6 +5845,7 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
const char *dir = NULL;
char currentDir[MAX_PATH];
const char *fltr;
if (wParam)
dir = (const char *)wParam;
@ -5768,10 +5854,10 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
::GetCurrentDirectory(MAX_PATH, currentDir);
dir = currentDir;
}
if (lParam)
{
const char *filtre = (const char *)lParam;
_findReplaceDlg.setFindInFilesDirFilter(dir, filtre);
fltr = (const char *)lParam;
}
else
{
@ -5788,12 +5874,12 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
filtres += "*.";
filtres += vStr[i] + " ";
}
//::SetDlgItemText(_hSelf, IDD_FINDINFILES_FILTERS_COMBO, filtres.c_str());
_findReplaceDlg.setFindInFilesDirFilter(currentDir, filtres.c_str());
fltr = filtres.c_str();
}
else
_findReplaceDlg.setFindInFilesDirFilter(currentDir, "*.*");
fltr = "*.*";
}
_findReplaceDlg.setFindInFilesDirFilter(dir, fltr);
return TRUE;
}
@ -6256,6 +6342,8 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
int lastLine = int(_pEditView->execute(SCI_GETLINECOUNT)) - 1;
int currLine = _pEditView->getCurrentLineNumber();
int indexMacro = _runMacroDlg.getMacro2Exec();
int deltaLastLine = 0;
int deltaCurrLine = 0;
Macro m = _macro;
@ -6278,14 +6366,25 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
}
else // run until eof
{
if ( currLine == _pEditView->getCurrentLineNumber() ) // line no. not changed?
bool cursorMovedUp = deltaCurrLine < 0;
deltaLastLine = int(_pEditView->execute(SCI_GETLINECOUNT)) - 1 - lastLine;
deltaCurrLine = _pEditView->getCurrentLineNumber() - currLine;
if (( deltaCurrLine == 0 ) // line no. not changed?
&& (deltaLastLine >= 0)) // and no lines removed?
break; // exit
// Update the line count, but only if the number of lines is shrinking.
// Otherwise, the macro playback may never end.
if (deltaLastLine < 0)
lastLine += deltaLastLine;
// save current line
currLine = _pEditView->getCurrentLineNumber();
currLine += deltaCurrLine;
// eof?
if ((currLine >= lastLine) || (currLine <= 0))
if ((currLine >= lastLine) || (currLine < 0)
|| ((deltaCurrLine == 0) && (currLine == 0) && ((deltaLastLine >= 0) || cursorMovedUp)))
break;
}
}

View File

@ -613,7 +613,11 @@ private:
void synchronise();
void setLangStatus(LangType langType);
string getLangDesc(LangType langType, bool shortDesc = false);
void setLangStatus(LangType langType){
_statusBar.setText(getLangDesc(langType).c_str(), STATUSBAR_DOC_TYPE);
};
void setDisplayFormat(formatType f) {
std::string str;

View File

@ -2760,6 +2760,9 @@ int NppParameters::langTypeToCommandID(LangType lt) const
case L_CMAKE :
id = IDM_LANG_CMAKE; break;
case L_SEARCHRESULT :
id = -1; break;
case L_TXT :
id = IDM_LANG_TEXT; break;
default :

View File

@ -338,6 +338,10 @@ BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
addText2Combo(str2Search.c_str(), hFindCombo, isUnicode);
processFindNext(str2Search.c_str());
}
else if (_currentStatus == FINDINFILES_DLG)
{
::SendMessage(_hSelf, WM_COMMAND, IDD_FINDINFILES_FIND_BUTTON, (LPARAM)_hSelf);
}
}
return TRUE;
@ -1077,7 +1081,7 @@ void FindReplaceDlg::enableReplaceFunc(bool isEnable)
RECT *pClosePos = isEnable?&_replaceClosePos:&_findClosePos;
//::EnableWindow(::GetDlgItem(_hSelf, IDD_FINDINFILES_FIND_BUTTON), FALSE);
::EnableWindow(::GetDlgItem(_hSelf, IDOK), TRUE);
//::EnableWindow(::GetDlgItem(_hSelf, IDOK), TRUE);
enableFindInFilesControls(false);
// replce controls

View File

@ -331,7 +331,7 @@ private :
void enableFindInFilesFunc() {
enableFindInFilesControls();
::EnableWindow(::GetDlgItem(_hSelf, IDOK), FALSE);
//::EnableWindow(::GetDlgItem(_hSelf, IDOK), FALSE);
_currentStatus = FINDINFILES_DLG;
gotoCorrectTab();

View File

@ -73,7 +73,7 @@ BOOL CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPar
::SendDlgItemMessage(_hSelf, IDC_LANGUAGES_LIST, LB_ADDSTRING, 0, (LPARAM)_lsArray.getLexerDescFromIndex(i));
}
_hStyleList = ::GetDlgItem(_hSelf, IDC_STYLES_LIST);
//_hStyleList = ::GetDlgItem(_hSelf, IDC_STYLES_LIST);
_hCheckBold = ::GetDlgItem(_hSelf, IDC_BOLD_CHECK);
_hCheckItalic = ::GetDlgItem(_hSelf, IDC_ITALIC_CHECK);
_hCheckUnderline = ::GetDlgItem(_hSelf, IDC_UNDERLINE_CHECK);
@ -407,7 +407,7 @@ void WordStyleDlg::setStyleListFromLexer(int index)
// Fill out Styles listbox
// Before filling out, we clean it
::SendMessage(_hStyleList, LB_RESETCONTENT, 0, 0);
::SendDlgItemMessage(_hSelf, IDC_STYLES_LIST, LB_RESETCONTENT, 0, 0);
if (index)
{
@ -416,7 +416,6 @@ void WordStyleDlg::setStyleListFromLexer(int index)
const char *userExt = (_lsArray.getLexerStylerByName(langName))->getLexerUserExt();
::SendDlgItemMessage(_hSelf, IDC_DEF_EXT_EDIT, WM_SETTEXT, 0, (LPARAM)(ext));
::SendDlgItemMessage(_hSelf, IDC_USER_EXT_EDIT, WM_SETTEXT, 0, (LPARAM)(userExt));
//::SetWindowText(::GetDlgItem(_hSelf, IDC_USER_EXT_EDIT), userExt);
}
::ShowWindow(::GetDlgItem(_hSelf, IDC_DEF_EXT_EDIT), index?SW_SHOW:SW_HIDE);
::ShowWindow(::GetDlgItem(_hSelf, IDC_DEF_EXT_STATIC), index?SW_SHOW:SW_HIDE);
@ -429,9 +428,9 @@ void WordStyleDlg::setStyleListFromLexer(int index)
for (int i = 0 ; i < lexerStyler.getNbStyler() ; i++)
{
Style & style = lexerStyler.getStyler(i);
::SendMessage(_hStyleList, LB_ADDSTRING, 0, (LPARAM)style._styleDesc);
::SendDlgItemMessage(_hSelf, IDC_STYLES_LIST, LB_ADDSTRING, 0, (LPARAM)style._styleDesc);
}
::SendMessage(_hStyleList, LB_SETCURSEL, 0, 0);
::SendDlgItemMessage(_hSelf, IDC_STYLES_LIST, LB_SETCURSEL, 0, 0);
setVisualFromStyleList();
}

View File

@ -53,7 +53,6 @@ public :
private :
COLORREF _colour;
WNDPROC _oldProc;
//HFONT _hFont;
static BOOL CALLBACK staticProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam){
ColourStaticTextHooker *pColourStaticTextHooker = reinterpret_cast<ColourStaticTextHooker *>(::GetWindowLong(hwnd, GWL_USERDATA));
@ -95,7 +94,6 @@ private :
int _currentLexerIndex;
HWND _hStyleList;
HWND _hCheckBold;
HWND _hCheckItalic;
HWND _hCheckUnderline;
@ -121,7 +119,7 @@ private :
Style & getCurrentStyler() {
int styleIndex = int(::SendMessage(_hStyleList, LB_GETCURSEL, 0, 0));
int styleIndex = ::SendDlgItemMessage(_hSelf, IDC_STYLES_LIST, LB_GETCURSEL, 0, 0);
if (_currentLexerIndex == 0)
return _globalStyles.getStyler(styleIndex);
else

View File

@ -100,6 +100,27 @@ void FileDialog::setExtFilter(const char *extText, const char *ext, ...)
_nbCharFileExt += exts.length() + 1;
}
void FileDialog::setExtsFilter(const char *extText, const char *exts)
{
// fill out the ext array for save as file dialog
if (_nbExt < nbExtMax)
strcpy(_extArray[_nbExt++], exts);
//
std::string extFilter = extText;
extFilter += " (";
extFilter += exts;
extFilter += ")";
char *pFileExt = _fileExt + _nbCharFileExt;
memcpy(pFileExt, extFilter.c_str(), extFilter.length() + 1);
_nbCharFileExt += extFilter.length() + 1;
pFileExt = _fileExt + _nbCharFileExt;
memcpy(pFileExt, exts, strlen(exts) + 1);
_nbCharFileExt += strlen(exts) + 1;
}
char * FileDialog::doOpenSingleFileDlg()
{
char dir[MAX_PATH];

View File

@ -37,6 +37,8 @@ class FileDialog
public:
FileDialog(HWND hwnd, HINSTANCE hInst);
void setExtFilter(const char *, const char *, ...);
void setExtsFilter(const char *extText, const char *exts);
void setDefFileName(const char *fn){strcpy(_fileName, fn);}
char * doSaveDlg();
@ -76,9 +78,8 @@ protected :
private:
char _fileName[MAX_PATH*8];
char _fileExt[MAX_PATH*2];
char _fileExt[MAX_PATH*10];
int _nbCharFileExt;
//bool _isMultiSel;
stringVector _fileNames;
OPENFILENAME _ofn;

View File

@ -627,7 +627,7 @@ BOOL CALLBACK DefaultNewDocDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM
//if ((LangType)i != L_END)
{
int cmdID = pNppParam->langTypeToCommandID((LangType)i);
if (getNameStrFromCmd(cmdID, str) == TYPE_CMD)
if ((cmdID != -1) && (getNameStrFromCmd(cmdID, str) == TYPE_CMD))
{
_langList.push_back(LangID_Name((LangType)i, str));
::SendDlgItemMessage(_hSelf, IDC_COMBO_DEFAULTLANG, CB_ADDSTRING, 0, (LPARAM)str.c_str());

View File

@ -1,117 +1,115 @@
//this file is part of notepad++
//Copyright (C)2003 Don HO ( donho@altern.org )
//
//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.
//
//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.
// created by Daniel Volk mordorpost@volkarts.com
#include "RunMacroDlg.h"
#include "ScintillaEditView.h"
#include "Notepad_plus_msgs.h"
#include "constant.h"
BOOL CALLBACK RunMacroDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_INITDIALOG :
{
initMacroList();
char str[512];
ltoa(m_Times, str, 10);
::SetDlgItemText(_hSelf, IDC_M_RUN_TIMES, str);
switch ( m_Mode )
{
case RM_RUN_MULTI:
check(IDC_M_RUN_MULTI);
break;
case RM_RUN_EOF:
check(IDC_M_RUN_EOF);
break;
}
::SendDlgItemMessage(_hSelf, IDC_M_RUN_TIMES, EM_LIMITTEXT, 4, 0);
goToCenter();
return TRUE;
}
case WM_COMMAND :
{
if (HIWORD(wParam) == EN_CHANGE)
{
switch (LOWORD(wParam))
{
case IDC_M_RUN_TIMES:
check(IDC_M_RUN_MULTI);
return TRUE;
default:
return FALSE;
}
}
switch (wParam)
{
case IDCANCEL :
::ShowWindow(_hSelf, SW_HIDE);
return TRUE;
case IDOK :
if ( isCheckedOrNot(IDC_M_RUN_MULTI) )
{
//char str[512];
m_Mode = RM_RUN_MULTI;
m_Times = ::GetDlgItemInt(_hSelf, IDC_M_RUN_TIMES, NULL, FALSE);
}
else if ( isCheckedOrNot(IDC_M_RUN_EOF) )
{
m_Mode = RM_RUN_EOF;
}
if (::SendDlgItemMessage(_hSelf, IDC_MACRO_COMBO, CB_GETCOUNT, 0, 0))
::SendMessage(_hParent, WM_MACRODLGRUNMACRO, 0, 0);
return TRUE;
//this file is part of notepad++
//Copyright (C)2003 Don HO ( donho@altern.org )
//
//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.
//
//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.
// created by Daniel Volk mordorpost@volkarts.com
#include "RunMacroDlg.h"
#include "ScintillaEditView.h"
#include "Notepad_plus_msgs.h"
#include "constant.h"
BOOL CALLBACK RunMacroDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_INITDIALOG :
{
initMacroList();
char str[512];
ltoa(m_Times, str, 10);
::SetDlgItemText(_hSelf, IDC_M_RUN_TIMES, str);
switch ( m_Mode )
{
case RM_RUN_MULTI:
check(IDC_M_RUN_MULTI);
break;
case RM_RUN_EOF:
check(IDC_M_RUN_EOF);
break;
}
::SendDlgItemMessage(_hSelf, IDC_M_RUN_TIMES, EM_LIMITTEXT, 4, 0);
goToCenter();
return TRUE;
}
case WM_COMMAND :
{
if (HIWORD(wParam) == EN_CHANGE)
{
switch (LOWORD(wParam))
{
case IDC_M_RUN_TIMES:
check(IDC_M_RUN_MULTI);
return TRUE;
default:
return FALSE;
}
}
switch (wParam)
{
case IDCANCEL :
::ShowWindow(_hSelf, SW_HIDE);
return TRUE;
case IDOK :
if ( isCheckedOrNot(IDC_M_RUN_MULTI) )
{
m_Mode = RM_RUN_MULTI;
m_Times = ::GetDlgItemInt(_hSelf, IDC_M_RUN_TIMES, NULL, FALSE);
}
else if ( isCheckedOrNot(IDC_M_RUN_EOF) )
{
m_Mode = RM_RUN_EOF;
}
if (::SendDlgItemMessage(_hSelf, IDC_MACRO_COMBO, CB_GETCOUNT, 0, 0))
::SendMessage(_hParent, WM_MACRODLGRUNMACRO, 0, 0);
return TRUE;
default:
if ((HIWORD(wParam) == CBN_SELCHANGE) && (LOWORD(wParam) == IDC_MACRO_COMBO))
{
m_macroIndex = ::SendDlgItemMessage(_hSelf, IDC_MACRO_COMBO, CB_GETCURSEL, 0, 0);
return TRUE;
}
}
}
}
return FALSE;
}
void RunMacroDlg::check(int id)
{
// IDC_M_RUN_MULTI
if ( id == IDC_M_RUN_MULTI )
::SendDlgItemMessage(_hSelf, IDC_M_RUN_MULTI, BM_SETCHECK, BST_CHECKED, 0);
else
::SendDlgItemMessage(_hSelf, IDC_M_RUN_MULTI, BM_SETCHECK, BST_UNCHECKED, 0);
// IDC_M_RUN_EOF
if ( id == IDC_M_RUN_EOF )
::SendDlgItemMessage(_hSelf, IDC_M_RUN_EOF, BM_SETCHECK, BST_CHECKED, 0);
else
::SendDlgItemMessage(_hSelf, IDC_M_RUN_EOF, BM_SETCHECK, BST_UNCHECKED, 0);
}
}
}
}
}
return FALSE;
}
void RunMacroDlg::check(int id)
{
// IDC_M_RUN_MULTI
if ( id == IDC_M_RUN_MULTI )
::SendDlgItemMessage(_hSelf, IDC_M_RUN_MULTI, BM_SETCHECK, BST_CHECKED, 0);
else
::SendDlgItemMessage(_hSelf, IDC_M_RUN_MULTI, BM_SETCHECK, BST_UNCHECKED, 0);
// IDC_M_RUN_EOF
if ( id == IDC_M_RUN_EOF )
::SendDlgItemMessage(_hSelf, IDC_M_RUN_EOF, BM_SETCHECK, BST_CHECKED, 0);
else
::SendDlgItemMessage(_hSelf, IDC_M_RUN_EOF, BM_SETCHECK, BST_UNCHECKED, 0);
}

View File

@ -382,5 +382,18 @@ void recordedMacroStep::PlayBack(Window* pNotepad, ScintillaEditView *pEditView)
if (MacroType == mtUseSParameter)
lParam = reinterpret_cast<long>(sParameter.c_str());
pEditView->execute(message, wParameter, lParam);
if ( (message == SCI_SETTEXT)
|| (message == SCI_REPLACESEL)
|| (message == SCI_ADDTEXT)
|| (message == SCI_ADDSTYLEDTEXT)
|| (message == SCI_INSERTTEXT)
|| (message == SCI_APPENDTEXT) ) {
SCNotification scnN;
scnN.nmhdr.code = SCN_CHARADDED;
scnN.nmhdr.hwndFrom = pEditView->getHSelf();
scnN.nmhdr.idFrom = 0;
scnN.ch = sParameter.at(0);
::SendMessage(pNotepad->getHSelf(), WM_NOTIFY, 0, reinterpret_cast<LPARAM>(&scnN));
}
}
}