[BUG_FIXED] fix a bug where a file with 2 or more consecutive spaces gives problems with sessions and history.

fixes problem where opening a file when in save as dialog saves the wrong file.
Change the main Notepad++ icon.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository@90 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
donho 2007-12-29 03:44:56 +00:00
parent 3fb08ce731
commit 64fbc8a627
9 changed files with 72 additions and 60 deletions

View File

@ -17,16 +17,16 @@
; Define the application name ; Define the application name
!define APPNAME "Notepad++" !define APPNAME "Notepad++"
!define APPNAMEANDVERSION "Notepad++ v4.6" !define APPNAMEANDVERSION "Notepad++ v4.7"
!define VERSION_MAJOR 4 !define VERSION_MAJOR 4
!define VERSION_MINOR 5 !define VERSION_MINOR 7
; Main Install settings ; Main Install settings
Name "${APPNAMEANDVERSION}" Name "${APPNAMEANDVERSION}"
InstallDir "$PROGRAMFILES\Notepad++" InstallDir "$PROGRAMFILES\Notepad++"
InstallDirRegKey HKLM "Software\${APPNAME}" "" InstallDirRegKey HKLM "Software\${APPNAME}" ""
OutFile "..\bin\npp.4.6.Installer.exe" OutFile "..\bin\npp.4.7.Installer.exe"
@ -504,6 +504,9 @@ ALL_XML:
Delete "$INSTDIR\plugins\HexEditor.dll" Delete "$INSTDIR\plugins\HexEditor.dll"
Delete "$INSTDIR\plugins\HexEditorPlugin.dll" Delete "$INSTDIR\plugins\HexEditorPlugin.dll"
Delete "$INSTDIR\plugins\NppSearchInFiles.dll" Delete "$INSTDIR\plugins\NppSearchInFiles.dll"
Delete "$INSTDIR\plugins\ConvertExt.dll"
Delete "$INSTDIR\plugins\FunctionList.dll"
Delete "$INSTDIR\plugins\SpellChecker.dll"
CreateDirectory "$SMPROGRAMS\Notepad++" CreateDirectory "$SMPROGRAMS\Notepad++"
CreateShortCut "$SMPROGRAMS\Notepad++\Uninstall.lnk" "$INSTDIR\uninstall.exe" CreateShortCut "$SMPROGRAMS\Notepad++\Uninstall.lnk" "$INSTDIR\uninstall.exe"
@ -639,13 +642,13 @@ SubSection "Plugins" Plugins
File "..\bin\plugins\NPPTextFX\W3C-CSSValidator.htm" File "..\bin\plugins\NPPTextFX\W3C-CSSValidator.htm"
File "..\bin\plugins\NPPTextFX\W3C-HTMLValidator.htm" File "..\bin\plugins\NPPTextFX\W3C-HTMLValidator.htm"
SectionEnd SectionEnd
/*
Section "Function List" FunctionList Section "Function List" FunctionList
Delete "$INSTDIR\plugins\FunctionListPlugin.dll" Delete "$INSTDIR\plugins\FunctionListPlugin.dll"
SetOutPath "$INSTDIR\plugins" SetOutPath "$INSTDIR\plugins"
File "..\bin\plugins\FunctionList.dll" File "..\bin\plugins\FunctionList.dll"
SectionEnd SectionEnd
*/
Section "File Browser" FileBrowser Section "File Browser" FileBrowser
Delete "$INSTDIR\plugins\LightExplorer.dll" Delete "$INSTDIR\plugins\LightExplorer.dll"
SetOutPath "$INSTDIR\plugins" SetOutPath "$INSTDIR\plugins"
@ -657,7 +660,7 @@ SubSection "Plugins" Plugins
SetOutPath "$INSTDIR\plugins" SetOutPath "$INSTDIR\plugins"
File "..\bin\plugins\HexEditor.dll" File "..\bin\plugins\HexEditor.dll"
SectionEnd SectionEnd
/*
Section "ConvertExt" ConvertExt Section "ConvertExt" ConvertExt
SetOutPath "$INSTDIR\plugins" SetOutPath "$INSTDIR\plugins"
File "..\bin\plugins\ConvertExt.dll" File "..\bin\plugins\ConvertExt.dll"
@ -672,12 +675,14 @@ SubSection "Plugins" Plugins
File "..\bin\ConvertExt.enc" File "..\bin\ConvertExt.enc"
File "..\bin\ConvertExt.lng" File "..\bin\ConvertExt.lng"
SectionEnd SectionEnd
*/
/*
Section "Spell-Checker" SpellChecker Section "Spell-Checker" SpellChecker
Delete "$INSTDIR\plugins\SpellChecker.dll" Delete "$INSTDIR\plugins\SpellChecker.dll"
SetOutPath "$INSTDIR\plugins" SetOutPath "$INSTDIR\plugins"
File "..\bin\plugins\SpellChecker.dll" File "..\bin\plugins\SpellChecker.dll"
SectionEnd SectionEnd
*/
Section "NppExec" NppExec Section "NppExec" NppExec
Delete "$INSTDIR\plugins\NppExec.dll" Delete "$INSTDIR\plugins\NppExec.dll"
SetOutPath "$INSTDIR\plugins" SetOutPath "$INSTDIR\plugins"
@ -847,12 +852,12 @@ SubSection un.Plugins
RMDir "$INSTDIR\plugins\NPPTextFX\" RMDir "$INSTDIR\plugins\NPPTextFX\"
RMDir "$INSTDIR\plugins\" RMDir "$INSTDIR\plugins\"
SectionEnd SectionEnd
/*
Section un.FunctionList Section un.FunctionList
Delete "$INSTDIR\plugins\FunctionList.dll" Delete "$INSTDIR\plugins\FunctionList.dll"
RMDir "$INSTDIR\plugins\" RMDir "$INSTDIR\plugins\"
SectionEnd SectionEnd
*/
Section un.FileBrowser Section un.FileBrowser
Delete "$INSTDIR\plugins\LightExplorer.dll" Delete "$INSTDIR\plugins\LightExplorer.dll"
Delete "$INSTDIR\lightExplorer.ini" Delete "$INSTDIR\lightExplorer.ini"
@ -863,7 +868,7 @@ SubSection un.Plugins
Delete "$INSTDIR\plugins\HexEditor.dll" Delete "$INSTDIR\plugins\HexEditor.dll"
RMDir "$INSTDIR\plugins\" RMDir "$INSTDIR\plugins\"
SectionEnd SectionEnd
/*
Section un.ConvertExt Section un.ConvertExt
Delete "$INSTDIR\plugins\ConvertExt.dll" Delete "$INSTDIR\plugins\ConvertExt.dll"
@ -876,12 +881,13 @@ SubSection un.Plugins
RMDir "$INSTDIR\plugins\" RMDir "$INSTDIR\plugins\"
SectionEnd SectionEnd
*/
/*
Section un.SpellChecker Section un.SpellChecker
Delete "$INSTDIR\plugins\SpellChecker.dll" Delete "$INSTDIR\plugins\SpellChecker.dll"
RMDir "$INSTDIR\plugins\" RMDir "$INSTDIR\plugins\"
SectionEnd SectionEnd
*/
Section un.NppExec Section un.NppExec
Delete "$INSTDIR\plugins\NppExec.dll" Delete "$INSTDIR\plugins\NppExec.dll"
Delete "$INSTDIR\plugins\doc\NppExec.txt" Delete "$INSTDIR\plugins\doc\NppExec.txt"

View File

@ -61,7 +61,7 @@ Notepad_plus::Notepad_plus(): Window(), _mainWindowStatus(0), _pDocTab(NULL), _p
_recordingMacro(false), _pTrayIco(NULL), _isUDDocked(false),\ _recordingMacro(false), _pTrayIco(NULL), _isUDDocked(false),\
_isCmdScModified(false), _isMacrosScModified(false), _isUserCmdScModified(false),\ _isCmdScModified(false), _isMacrosScModified(false), _isUserCmdScModified(false),\
_isScintillaKeyModified(false), _isPluginCmdScModified(false), _isRTL(false), \ _isScintillaKeyModified(false), _isPluginCmdScModified(false), _isRTL(false), \
_linkTriggered(true), _isDocModifing(false), _isHotspotDblClicked(false) _linkTriggered(true), _isDocModifing(false), _isHotspotDblClicked(false), _isSaving(false)
{ {
_winVersion = getWindowsVersion(); _winVersion = getWindowsVersion();
@ -1157,10 +1157,14 @@ bool Notepad_plus::fileSaveAs()
fDlg.setDefFileName(PathFindFileName(str)); fDlg.setDefFileName(PathFindFileName(str));
if (char *pfn = fDlg.doSaveDlg()) int currentDocIndex = _pEditView->getCurrentDocIndex();
_isSaving = true;
char *pfn = fDlg.doSaveDlg();
_isSaving = false;
if (pfn)
{ {
int i = _pEditView->findDocIndexByName(pfn); int i = _pEditView->findDocIndexByName(pfn);
if ((i == -1) || (i == _pEditView->getCurrentDocIndex())) if ((i == -1) || (i == currentDocIndex))
{ {
doSave(pfn, _pEditView->getCurrentBuffer().getUnicodeMode()); doSave(pfn, _pEditView->getCurrentBuffer().getUnicodeMode());
_pEditView->setCurrentTitle(pfn); _pEditView->setCurrentTitle(pfn);
@ -6177,6 +6181,8 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
CmdLineParams & cmdLineParams = pNppParam->getCmdLineParams(); CmdLineParams & cmdLineParams = pNppParam->getCmdLineParams();
LangType lt = cmdLineParams._langType;//LangType(pCopyData->dwData & LASTBYTEMASK); LangType lt = cmdLineParams._langType;//LangType(pCopyData->dwData & LASTBYTEMASK);
int ln = cmdLineParams._line2go; int ln = cmdLineParams._line2go;
int currentDocIndex = _pEditView->getCurrentDocIndex();
int currentView = getCurrentView();
FileNameStringSplitter fnss((char *)pCopyData->lpData); FileNameStringSplitter fnss((char *)pCopyData->lpData);
char *pFn = NULL; char *pFn = NULL;
@ -6192,7 +6198,13 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
} }
_pEditView->execute(SCI_GOTOLINE, ln-1); _pEditView->execute(SCI_GOTOLINE, ln-1);
} }
//setLangStatus(_pEditView->getCurrentDocType());
if (_isSaving == true)
{
switchEditViewTo(currentView);
setTitleWith(_pDocTab->activate(currentDocIndex));
return true;
}
break; break;
} }
} }

View File

@ -419,6 +419,7 @@ private:
bool _linkTriggered; bool _linkTriggered;
bool _isDocModifing; bool _isDocModifing;
bool _isHotspotDblClicked; bool _isHotspotDblClicked;
bool _isSaving;
struct ActivateAppInfo { struct ActivateAppInfo {
bool _isActivated; bool _isActivated;

View File

@ -674,11 +674,7 @@ bool NppParameters::getSessionFromXmlTree(TiXmlDocument *pSessionDoc, Session *p
childNode ; childNode ;
childNode = childNode->NextSibling("File") ) childNode = childNode->NextSibling("File") )
{ {
TiXmlNode *fnNode = childNode->FirstChild(); const char *fileName = (childNode->ToElement())->Attribute("filename");
if (fnNode)
{
const char *fileName = fnNode->Value();
if (fileName) if (fileName)
{ {
Position position; Position position;
@ -692,7 +688,7 @@ bool NppParameters::getSessionFromXmlTree(TiXmlDocument *pSessionDoc, Session *p
langName = (childNode->ToElement())->Attribute( "lang" ); langName = (childNode->ToElement())->Attribute( "lang" );
sessionFileInfo sfi( fileName, langName, position ); sessionFileInfo sfi( fileName, langName, position );
for (TiXmlNode *markNode = fnNode->NextSibling("Mark"); for (TiXmlNode *markNode = childNode->FirstChildElement("Mark");
markNode ; markNode ;
markNode = markNode->NextSibling("Mark") ) markNode = markNode->NextSibling("Mark") )
{ {
@ -707,7 +703,6 @@ bool NppParameters::getSessionFromXmlTree(TiXmlDocument *pSessionDoc, Session *p
} }
} }
} }
}
TiXmlNode *subviewRoot = sessionRoot->FirstChildElement("subView"); TiXmlNode *subviewRoot = sessionRoot->FirstChildElement("subView");
if (subviewRoot) if (subviewRoot)
@ -774,10 +769,7 @@ void NppParameters::feedFileListParameters(TiXmlNode *node)
childNode && (_nbFile < NB_MAX_LRF_FILE); childNode && (_nbFile < NB_MAX_LRF_FILE);
childNode = childNode->NextSibling("File") ) childNode = childNode->NextSibling("File") )
{ {
TiXmlNode *node = childNode->FirstChild(); const char *filePath = (childNode->ToElement())->Attribute("filename");
if (node)
{
const char *filePath = node->Value();
if (filePath) if (filePath)
{ {
_LRFileList[_nbFile] = new string(filePath); _LRFileList[_nbFile] = new string(filePath);
@ -785,7 +777,6 @@ void NppParameters::feedFileListParameters(TiXmlNode *node)
} }
} }
} }
}
void NppParameters::feedShortcut(TiXmlNode *node) void NppParameters::feedShortcut(TiXmlNode *node)
{ {
@ -1149,8 +1140,7 @@ void NppParameters::writeSession(const Session & session, const char *fileName)
(fileNameNode->ToElement())->SetAttribute("selMode", session._mainViewFiles[i]._selMode); (fileNameNode->ToElement())->SetAttribute("selMode", session._mainViewFiles[i]._selMode);
(fileNameNode->ToElement())->SetAttribute("lang", session._mainViewFiles[i]._langName.c_str()); (fileNameNode->ToElement())->SetAttribute("lang", session._mainViewFiles[i]._langName.c_str());
TiXmlText fileNameFullPath(session._mainViewFiles[i]._fileName.c_str()); (fileNameNode->ToElement())->SetAttribute("filename", session._mainViewFiles[i]._fileName.c_str());
fileNameNode->InsertEndChild(fileNameFullPath);
for (size_t j = 0 ; j < session._mainViewFiles[i].marks.size() ; j++) for (size_t j = 0 ; j < session._mainViewFiles[i].marks.size() ; j++)
{ {
size_t markLine = session._mainViewFiles[i].marks[j]; size_t markLine = session._mainViewFiles[i].marks[j];
@ -1529,8 +1519,7 @@ bool NppParameters::writeHistory(const char *fullpath)
if (!historyNode) return false; if (!historyNode) return false;
TiXmlElement recentFileNode("File"); TiXmlElement recentFileNode("File");
TiXmlText fileNameFullPath(fullpath); (recentFileNode.ToElement())->SetAttribute("filename", fullpath);
recentFileNode.InsertEndChild(fileNameFullPath);
(historyNode->ToElement())->InsertEndChild(recentFileNode); (historyNode->ToElement())->InsertEndChild(recentFileNode);
return true; return true;

View File

@ -17,6 +17,7 @@
#include <stdarg.h> #include <stdarg.h>
#include "FileDialog.h" #include "FileDialog.h"
FileDialog *FileDialog::staticThis = NULL; FileDialog *FileDialog::staticThis = NULL;
FileDialog::FileDialog(HWND hwnd, HINSTANCE hInst) FileDialog::FileDialog(HWND hwnd, HINSTANCE hInst)
@ -47,7 +48,9 @@ FileDialog::FileDialog(HWND hwnd, HINSTANCE hInst)
_ofn.lpstrDefExt = NULL; // No default extension _ofn.lpstrDefExt = NULL; // No default extension
_ofn.lCustData = 0; _ofn.lCustData = 0;
_ofn.Flags = OFN_PATHMUSTEXIST | OFN_EXPLORER | OFN_LONGNAMES | DS_CENTER | OFN_HIDEREADONLY; _ofn.Flags = OFN_PATHMUSTEXIST | OFN_EXPLORER | OFN_LONGNAMES | DS_CENTER | OFN_HIDEREADONLY;
//_ofn.pvReserved = NULL;
//_ofn.dwReserved = 0;
//_ofn.FlagsEx = 0;
} }
// This function set and concatenate the filter into the list box of FileDialog. // This function set and concatenate the filter into the list box of FileDialog.
@ -185,7 +188,7 @@ char * FileDialog::doSaveDlg()
_ofn.lpstrInitialDir = dir; _ofn.lpstrInitialDir = dir;
_ofn.Flags |= OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY; _ofn.Flags |= OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY | OFN_ENABLESIZING;
_ofn.Flags |= OFN_ENABLEHOOK; _ofn.Flags |= OFN_ENABLEHOOK;
_ofn.lpfnHook = OFNHookProc; _ofn.lpfnHook = OFNHookProc;

View File

@ -18,10 +18,10 @@
#ifndef FILE_DIALOG_H #ifndef FILE_DIALOG_H
#define FILE_DIALOG_H #define FILE_DIALOG_H
//#define _WIN32_WINNT 0x0600
#include <shlwapi.h> #include <shlwapi.h>
#include <windows.h> #include <windows.h>
//#include <shlobj.h>
#include <vector> #include <vector>
#include <string> #include <string>
#include "SysMsg.h" #include "SysMsg.h"

View File

@ -518,7 +518,7 @@ void TabBarPlus::drawItem(DRAWITEMSTRUCT *pDrawItemStruct)
if (isSelected) if (isSelected)
{ {
COLORREF selectedColor = RGB(0, 0, 0); COLORREF selectedColor = ::GetSysColor(COLOR_BTNTEXT);
::SetTextColor(hDC, selectedColor); ::SetTextColor(hDC, selectedColor);
rect.top -= ::GetSystemMetrics(SM_CYEDGE); rect.top -= ::GetSystemMetrics(SM_CYEDGE);
rect.top += 1; rect.top += 1;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.2 KiB

After

Width:  |  Height:  |  Size: 31 KiB

View File

@ -4,6 +4,7 @@
Version="7.10" Version="7.10"
Name="Notepad++" Name="Notepad++"
ProjectGUID="{FCF60E65-1B78-4D1D-AB59-4FC00AC8C248}" ProjectGUID="{FCF60E65-1B78-4D1D-AB59-4FC00AC8C248}"
RootNamespace="Notepad++"
Keyword="Win32Proj"> Keyword="Win32Proj">
<Platforms> <Platforms>
<Platform <Platform
@ -36,7 +37,7 @@
AdditionalOptions="/fixed:no" AdditionalOptions="/fixed:no"
AdditionalDependencies="comctl32.lib shlwapi.lib shell32.lib" AdditionalDependencies="comctl32.lib shlwapi.lib shell32.lib"
ShowProgress="2" ShowProgress="2"
OutputFile="$(OutDir)/notepadPlus_Debug.exe" OutputFile="$(OutDir)/../../bin/notepad++Debug.exe"
Version="1.0" Version="1.0"
LinkIncremental="1" LinkIncremental="1"
TypeLibraryFile="/TLBID" TypeLibraryFile="/TLBID"