[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 APPNAME "Notepad++"
!define APPNAMEANDVERSION "Notepad++ v4.6"
!define APPNAMEANDVERSION "Notepad++ v4.7"
!define VERSION_MAJOR 4
!define VERSION_MINOR 5
!define VERSION_MINOR 7
; Main Install settings
Name "${APPNAMEANDVERSION}"
InstallDir "$PROGRAMFILES\Notepad++"
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\HexEditorPlugin.dll"
Delete "$INSTDIR\plugins\NppSearchInFiles.dll"
Delete "$INSTDIR\plugins\ConvertExt.dll"
Delete "$INSTDIR\plugins\FunctionList.dll"
Delete "$INSTDIR\plugins\SpellChecker.dll"
CreateDirectory "$SMPROGRAMS\Notepad++"
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-HTMLValidator.htm"
SectionEnd
/*
Section "Function List" FunctionList
Delete "$INSTDIR\plugins\FunctionListPlugin.dll"
SetOutPath "$INSTDIR\plugins"
File "..\bin\plugins\FunctionList.dll"
SectionEnd
*/
Section "File Browser" FileBrowser
Delete "$INSTDIR\plugins\LightExplorer.dll"
SetOutPath "$INSTDIR\plugins"
@ -657,7 +660,7 @@ SubSection "Plugins" Plugins
SetOutPath "$INSTDIR\plugins"
File "..\bin\plugins\HexEditor.dll"
SectionEnd
/*
Section "ConvertExt" ConvertExt
SetOutPath "$INSTDIR\plugins"
File "..\bin\plugins\ConvertExt.dll"
@ -671,13 +674,15 @@ SubSection "Plugins" Plugins
File "..\bin\ConvertExt.ini"
File "..\bin\ConvertExt.enc"
File "..\bin\ConvertExt.lng"
SectionEnd
SectionEnd
*/
/*
Section "Spell-Checker" SpellChecker
Delete "$INSTDIR\plugins\SpellChecker.dll"
SetOutPath "$INSTDIR\plugins"
File "..\bin\plugins\SpellChecker.dll"
SectionEnd
*/
Section "NppExec" NppExec
Delete "$INSTDIR\plugins\NppExec.dll"
SetOutPath "$INSTDIR\plugins"
@ -847,12 +852,12 @@ SubSection un.Plugins
RMDir "$INSTDIR\plugins\NPPTextFX\"
RMDir "$INSTDIR\plugins\"
SectionEnd
/*
Section un.FunctionList
Delete "$INSTDIR\plugins\FunctionList.dll"
RMDir "$INSTDIR\plugins\"
SectionEnd
*/
Section un.FileBrowser
Delete "$INSTDIR\plugins\LightExplorer.dll"
Delete "$INSTDIR\lightExplorer.ini"
@ -863,7 +868,7 @@ SubSection un.Plugins
Delete "$INSTDIR\plugins\HexEditor.dll"
RMDir "$INSTDIR\plugins\"
SectionEnd
/*
Section un.ConvertExt
Delete "$INSTDIR\plugins\ConvertExt.dll"
@ -876,12 +881,13 @@ SubSection un.Plugins
RMDir "$INSTDIR\plugins\"
SectionEnd
*/
/*
Section un.SpellChecker
Delete "$INSTDIR\plugins\SpellChecker.dll"
RMDir "$INSTDIR\plugins\"
SectionEnd
*/
Section un.NppExec
Delete "$INSTDIR\plugins\NppExec.dll"
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),\
_isCmdScModified(false), _isMacrosScModified(false), _isUserCmdScModified(false),\
_isScintillaKeyModified(false), _isPluginCmdScModified(false), _isRTL(false), \
_linkTriggered(true), _isDocModifing(false), _isHotspotDblClicked(false)
_linkTriggered(true), _isDocModifing(false), _isHotspotDblClicked(false), _isSaving(false)
{
_winVersion = getWindowsVersion();
@ -1157,10 +1157,14 @@ bool Notepad_plus::fileSaveAs()
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);
if ((i == -1) || (i == _pEditView->getCurrentDocIndex()))
if ((i == -1) || (i == currentDocIndex))
{
doSave(pfn, _pEditView->getCurrentBuffer().getUnicodeMode());
_pEditView->setCurrentTitle(pfn);
@ -6177,6 +6181,8 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
CmdLineParams & cmdLineParams = pNppParam->getCmdLineParams();
LangType lt = cmdLineParams._langType;//LangType(pCopyData->dwData & LASTBYTEMASK);
int ln = cmdLineParams._line2go;
int currentDocIndex = _pEditView->getCurrentDocIndex();
int currentView = getCurrentView();
FileNameStringSplitter fnss((char *)pCopyData->lpData);
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);
}
//setLangStatus(_pEditView->getCurrentDocType());
if (_isSaving == true)
{
switchEditViewTo(currentView);
setTitleWith(_pDocTab->activate(currentDocIndex));
return true;
}
break;
}
}

View File

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

View File

@ -674,37 +674,32 @@ bool NppParameters::getSessionFromXmlTree(TiXmlDocument *pSessionDoc, Session *p
childNode ;
childNode = childNode->NextSibling("File") )
{
TiXmlNode *fnNode = childNode->FirstChild();
if (fnNode)
const char *fileName = (childNode->ToElement())->Attribute("filename");
if (fileName)
{
const char *fileName = fnNode->Value();
Position position;
(childNode->ToElement())->Attribute("firstVisibleLine", &position._firstVisibleLine);
(childNode->ToElement())->Attribute("xOffset", &position._xOffset);
(childNode->ToElement())->Attribute("startPos", &position._startPos);
(childNode->ToElement())->Attribute("endPos", &position._endPos);
(childNode->ToElement())->Attribute("selMode", &position._selMode);
if (fileName)
const char *langName;
langName = (childNode->ToElement())->Attribute( "lang" );
sessionFileInfo sfi( fileName, langName, position );
for (TiXmlNode *markNode = childNode->FirstChildElement("Mark");
markNode ;
markNode = markNode->NextSibling("Mark") )
{
Position position;
(childNode->ToElement())->Attribute("firstVisibleLine", &position._firstVisibleLine);
(childNode->ToElement())->Attribute("xOffset", &position._xOffset);
(childNode->ToElement())->Attribute("startPos", &position._startPos);
(childNode->ToElement())->Attribute("endPos", &position._endPos);
(childNode->ToElement())->Attribute("selMode", &position._selMode);
const char *langName;
langName = (childNode->ToElement())->Attribute( "lang" );
sessionFileInfo sfi( fileName, langName, position );
for (TiXmlNode *markNode = fnNode->NextSibling("Mark");
markNode ;
markNode = markNode->NextSibling("Mark") )
int lineNumber;
const char *lineNumberStr = (markNode->ToElement())->Attribute("line", &lineNumber);
if (lineNumberStr)
{
int lineNumber;
const char *lineNumberStr = (markNode->ToElement())->Attribute("line", &lineNumber);
if (lineNumberStr)
{
sfi.marks.push_back(lineNumber);
}
sfi.marks.push_back(lineNumber);
}
(*ptrSession)._mainViewFiles.push_back(sfi);
}
(*ptrSession)._mainViewFiles.push_back(sfi);
}
}
}
@ -774,15 +769,11 @@ void NppParameters::feedFileListParameters(TiXmlNode *node)
childNode && (_nbFile < NB_MAX_LRF_FILE);
childNode = childNode->NextSibling("File") )
{
TiXmlNode *node = childNode->FirstChild();
if (node)
const char *filePath = (childNode->ToElement())->Attribute("filename");
if (filePath)
{
const char *filePath = node->Value();
if (filePath)
{
_LRFileList[_nbFile] = new string(filePath);
_nbFile++;
}
_LRFileList[_nbFile] = new string(filePath);
_nbFile++;
}
}
}
@ -1149,8 +1140,7 @@ void NppParameters::writeSession(const Session & session, const char *fileName)
(fileNameNode->ToElement())->SetAttribute("selMode", session._mainViewFiles[i]._selMode);
(fileNameNode->ToElement())->SetAttribute("lang", session._mainViewFiles[i]._langName.c_str());
TiXmlText fileNameFullPath(session._mainViewFiles[i]._fileName.c_str());
fileNameNode->InsertEndChild(fileNameFullPath);
(fileNameNode->ToElement())->SetAttribute("filename", session._mainViewFiles[i]._fileName.c_str());
for (size_t j = 0 ; j < session._mainViewFiles[i].marks.size() ; j++)
{
size_t markLine = session._mainViewFiles[i].marks[j];
@ -1529,8 +1519,7 @@ bool NppParameters::writeHistory(const char *fullpath)
if (!historyNode) return false;
TiXmlElement recentFileNode("File");
TiXmlText fileNameFullPath(fullpath);
recentFileNode.InsertEndChild(fileNameFullPath);
(recentFileNode.ToElement())->SetAttribute("filename", fullpath);
(historyNode->ToElement())->InsertEndChild(recentFileNode);
return true;

View File

@ -17,6 +17,7 @@
#include <stdarg.h>
#include "FileDialog.h"
FileDialog *FileDialog::staticThis = NULL;
FileDialog::FileDialog(HWND hwnd, HINSTANCE hInst)
@ -47,7 +48,9 @@ FileDialog::FileDialog(HWND hwnd, HINSTANCE hInst)
_ofn.lpstrDefExt = NULL; // No default extension
_ofn.lCustData = 0;
_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.
@ -185,7 +188,7 @@ char * FileDialog::doSaveDlg()
_ofn.lpstrInitialDir = dir;
_ofn.Flags |= OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY;
_ofn.Flags |= OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY | OFN_ENABLESIZING;
_ofn.Flags |= OFN_ENABLEHOOK;
_ofn.lpfnHook = OFNHookProc;

View File

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

View File

@ -518,7 +518,7 @@ void TabBarPlus::drawItem(DRAWITEMSTRUCT *pDrawItemStruct)
if (isSelected)
{
COLORREF selectedColor = RGB(0, 0, 0);
COLORREF selectedColor = ::GetSysColor(COLOR_BTNTEXT);
::SetTextColor(hDC, selectedColor);
rect.top -= ::GetSystemMetrics(SM_CYEDGE);
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"
Name="Notepad++"
ProjectGUID="{FCF60E65-1B78-4D1D-AB59-4FC00AC8C248}"
RootNamespace="Notepad++"
Keyword="Win32Proj">
<Platforms>
<Platform
@ -36,7 +37,7 @@
AdditionalOptions="/fixed:no"
AdditionalDependencies="comctl32.lib shlwapi.lib shell32.lib"
ShowProgress="2"
OutputFile="$(OutDir)/notepadPlus_Debug.exe"
OutputFile="$(OutDir)/../../bin/notepad++Debug.exe"
Version="1.0"
LinkIncremental="1"
TypeLibraryFile="/TLBID"