[NEW_FEATURE] Make orange indicator on the top of tab lighter when the view loss the focus.

Fix the multi-line tab height display problem while adding/removing the document.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository@117 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
donho 2008-01-25 22:55:14 +00:00
parent 4b4e1f9967
commit d88fa6236d
5 changed files with 36 additions and 7 deletions

View File

@ -4524,9 +4524,9 @@ int Notepad_plus::switchEditViewTo(int gid)
//checkDocState();
setTitleWith(_pEditView->getCurrentTitle());
//setLangStatus(_pEditView->getCurrentDocType());
//updateStatusBar();
//dynamicCheckMenuAndTB();
::InvalidateRect(_mainDocTab.getHSelf(), NULL, TRUE);
::InvalidateRect(_subDocTab.getHSelf(), NULL, TRUE);
::SendMessage(_hSelf, NPPM_INTERNAL_DOCSWITCHIN, 0, 0);
return oldView;
}
@ -7250,6 +7250,13 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
{
return _mainDocTab.getHideTabBarStatus();
}
case NPPM_INTERNAL_ISFOCUSEDTAB :
{
ScintillaEditView *cv = getCurrentEditView();
HWND pMainTB = (_mainDocTab.getView() == cv)?_mainDocTab.getHSelf():_subDocTab.getHSelf();
return (HWND)lParam == pMainTB;
}
default:
{

View File

@ -41,7 +41,6 @@ char * DocTabView::newDocInit()
// create a new (the first) sub tab then hightlight it
TabBar::insertAtEnd(newTitle);
return newTitle;
}
@ -64,10 +63,13 @@ const char * DocTabView::newDoc(const char *fn)
if (fn[i] == '\0')
break;
}
//fnConformToTab[j] = '\0';
TabBar::insertAtEnd(fnConformToTab);
TabBar::activateAt(_nbItem - 1);
if (_isMultiLine)
{
::SendMessage(_hParent, WM_SIZE, 0, 0);
}
return (const char *)completName;
}
@ -80,6 +82,11 @@ const char * DocTabView::newDoc(Buffer & buf)
// for the title of sub tab
TabBar::insertAtEnd(PathFindFileName(completName));
TabBar::activateAt(_nbItem - 1);
if (_isMultiLine)
{
::SendMessage(_hParent, WM_SIZE, 0, 0);
}
return completName;
}
@ -121,6 +128,12 @@ const char * DocTabView::closeCurrentDoc()
TabBar::activateAt(i2activate);
}
if (_isMultiLine)
{
::SendMessage(_hParent, WM_SIZE, 0, 0);
}
return _pView->getCurrentTitle();
}

View File

@ -87,6 +87,10 @@ public :
_pView->reSizeTo(rc);
}
};
const ScintillaEditView * getView() const {
return _pView;
};
private :
static unsigned short _nbNewTitle;

View File

@ -515,7 +515,11 @@ void TabBarPlus::drawItem(DRAWITEMSTRUCT *pDrawItemStruct)
rect.top += 2;
}
hBrush = ::CreateSolidBrush(RGB(250, 170, 60));
if (::SendMessage(_hParent, NPPM_INTERNAL_ISFOCUSEDTAB, 0, (LPARAM)_hSelf))
hBrush = ::CreateSolidBrush(RGB(250, 170, 60)); // #FAAA3C
else
hBrush = ::CreateSolidBrush(RGB(250, 210, 150)); // #FAD296
::FillRect(hDC, &barRect, hBrush);
::DeleteObject((HGDIOBJ)hBrush);
}

View File

@ -283,6 +283,7 @@
#define NPPM_INTERNAL_DOCSWITCHOFF (NOTEPADPLUS_USER_INTERNAL + 10)
#define NPPM_INTERNAL_DOCSWITCHIN (NOTEPADPLUS_USER_INTERNAL + 11)
#define NPPM_INTERNAL_ISTABBARREDUCED (NOTEPADPLUS_USER_INTERNAL + 12)
#define NPPM_INTERNAL_ISFOCUSEDTAB (NOTEPADPLUS_USER_INTERNAL + 13)
// See Notepad_plus_msgs.h
//#define NOTEPADPLUS_USER (WM_USER + 1000)
#define SCINTILLA_USER (WM_USER + 2000)