[BUG_FIXED] A toolbar tip crash is fixed by Jocelyn Legault (to be confirmed).

[NEW_BEHAVIOUR] "-nosession" parameter's behaviour changed : not only none of session is loaded, but also none of session is saved.
[BUG_FIXED] A docking feature crash issue is fixed.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@530 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
Don Ho 2009-09-09 22:56:15 +00:00
parent 0c490dc55a
commit c75618ad6c
6 changed files with 96 additions and 8 deletions

View File

@ -67,7 +67,7 @@ Notepad_plus::Notepad_plus(): Window(), _mainWindowStatus(0), _pDocTab(NULL), _p
_recordingMacro(false), _pTrayIco(NULL), _isUDDocked(false), _isRTL(false),
_linkTriggered(true), _isDocModifing(false), _isHotspotDblClicked(false), _sysMenuEntering(false),
_autoCompleteMain(&_mainEditView), _autoCompleteSub(&_subEditView), _smartHighlighter(&_findReplaceDlg),
_nativeLangEncoding(CP_ACP), _isFileOpening(false)
_nativeLangEncoding(CP_ACP), _isFileOpening(false), _rememberThisSession(true)
{
ZeroMemory(&_prevSelectedRange, sizeof(_prevSelectedRange));
_winVersion = (NppParameters::getInstance())->getWinVersion();
@ -276,6 +276,7 @@ void Notepad_plus::init(HINSTANCE hInst, HWND parent, const TCHAR *cmdLine, CmdL
::SendMessage(_hSelf, NPPM_HIDETABBAR, 0, TRUE);
}
_rememberThisSession = !cmdLineParams->_isNoSession;
if (nppGUI._rememberLastSession && !cmdLineParams->_isNoSession)
{
loadLastSession();
@ -2650,14 +2651,16 @@ BOOL Notepad_plus::notify(SCNotification *notification)
LPTOOLTIPTEXT lpttt;
lpttt = (LPTOOLTIPTEXT)notification;
lpttt->hinst = _hInst;
//Joce's fix
lpttt->hinst = NULL;
POINT p;
::GetCursorPos(&p);
::ScreenToClient(_hSelf, &p);
HWND hWin = ::RealChildWindowFromPoint(_hSelf, p);
const int tipMaxLen = 1024;
static TCHAR tip[tipMaxLen];
/*static */TCHAR tip[tipMaxLen];
tip[0] = '\0';
generic_string tipTmp(TEXT(""));
int id = int(lpttt->hdr.idFrom);
@ -8031,7 +8034,9 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
{
case COPYDATA_PARAMS :
{
pNppParam->setCmdlineParam(*((CmdLineParams *)pCopyData->lpData));
CmdLineParams *cmdLineParam = (CmdLineParams *)pCopyData->lpData;
pNppParam->setCmdlineParam(*cmdLineParam);
_rememberThisSession = !cmdLineParam->_isNoSession;
break;
}
@ -8956,7 +8961,7 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
saveGUIParams();
saveUserDefineLangs();
saveShortcuts();
if (nppgui._rememberLastSession)
if (nppgui._rememberLastSession && _rememberThisSession)
saveSession(currentSession);

View File

@ -385,6 +385,7 @@ private:
vector<pair<int, int> > _hideLinesMarks;
StyleArray _hotspotStyles;
bool _rememberThisSession; // always true. except -nosession is indicated on the launch time
static LRESULT CALLBACK Notepad_plus_Proc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam);
LRESULT runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam);

View File

@ -2063,6 +2063,84 @@ void ScintillaEditView::setMultiSelections(const ColumnModeInfos & cmi)
}
}
pair<int, int> ScintillaEditView::getSelectionLinesRange() const
{
pair<int, int> range(-1, -1);
if (execute(SCI_GETSELECTIONS) > 1)
return range;
int start = execute(SCI_GETSELECTIONSTART);
int end = execute(SCI_GETSELECTIONEND);
range.first = execute(SCI_LINEFROMPOSITION, start);
range.second = execute(SCI_LINEFROMPOSITION, end);
if (range.first > range.second)
range.swap(range);
return range;
}
void ScintillaEditView::currentLinesUp() const
{
pair<int, int> lineRange = getSelectionLinesRange();
if ((lineRange.first == -1 || lineRange.first == 0))
return;
int nbSelLines = lineRange.second - lineRange.first + 1;
int line2swap = lineRange.first - 1;
int nbChar = execute(SCI_LINELENGTH, line2swap);
int posStart = execute(SCI_POSITIONFROMLINE, lineRange.first);
int posEnd = execute(SCI_GETLINEENDPOSITION, lineRange.second);
execute(SCI_BEGINUNDOACTION);
execute(SCI_GOTOLINE, line2swap);
for (int i = 0 ; i < nbSelLines ; i++)
{
/*
execute(SCI_GOTOLINE, line2swap);
execute(SCI_LINETRANSPOSE);
line2swap++;
*/
currentLineDown();
}
execute(SCI_ENDUNDOACTION);
execute(SCI_SETSELECTIONSTART, posStart - nbChar);
execute(SCI_SETSELECTIONEND, posEnd - nbChar);
}
void ScintillaEditView::currentLinesDown() const
{
pair<int, int> lineRange = getSelectionLinesRange();
if ((lineRange.first == -1 || lineRange.first == 0))
return;
int nbSelLines = lineRange.second - lineRange.first + 1;
int line2swap = lineRange.first - 1;
int nbChar = execute(SCI_LINELENGTH, line2swap);
execute(SCI_BEGINUNDOACTION);
execute(SCI_GOTOLINE, line2swap);
for (int i = 0 ; i < nbSelLines ; i++)
{
/*
execute(SCI_GOTOLINE, line2swap);
execute(SCI_LINETRANSPOSE);
line2swap++;
*/
currentLineDown();
}
execute(SCI_ENDUNDOACTION);
execute(SCI_SETSELECTIONSTART, lineRange.first - nbChar);
execute(SCI_SETSELECTIONEND, lineRange.second - nbChar);
}
void ScintillaEditView::convertSelectedTextTo(bool Case)
{
unsigned int codepage = _codepage;

View File

@ -479,6 +479,9 @@ public:
execute(SCI_ENDUNDOACTION);
}
};
pair<int, int> getSelectionLinesRange() const;
void currentLinesUp() const;
void currentLinesDown() const;
void currentLineDown() const {
int currentLine = getCurrentLineNumber();

View File

@ -1332,7 +1332,7 @@ void DockingCont::SelectTab(int iTab)
for (int iItem = 0; iItem < iItemCnt; iItem++)
{
generic_string szText(TEXT(""));
if (iItem == iTab)
if (iItem == iTab && pszMaxTxt)
{
// fake here an icon before text ...
szText = TEXT(" ");

View File

@ -642,7 +642,8 @@ void DockingManager::createDockableDlg(tTbData data, int iCont, bool isVisible)
}
}
/* attach toolbar */
// attach toolbar
if (_vContainer.size() > (size_t)iCont && _vContainer[iCont] != NULL)
_vContainer[iCont]->createToolbar(data);
/* notify client app */