[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(); //checkDocState();
setTitleWith(_pEditView->getCurrentTitle()); setTitleWith(_pEditView->getCurrentTitle());
//setLangStatus(_pEditView->getCurrentDocType());
//updateStatusBar(); ::InvalidateRect(_mainDocTab.getHSelf(), NULL, TRUE);
//dynamicCheckMenuAndTB(); ::InvalidateRect(_subDocTab.getHSelf(), NULL, TRUE);
::SendMessage(_hSelf, NPPM_INTERNAL_DOCSWITCHIN, 0, 0); ::SendMessage(_hSelf, NPPM_INTERNAL_DOCSWITCHIN, 0, 0);
return oldView; return oldView;
} }
@ -7251,6 +7251,13 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
return _mainDocTab.getHideTabBarStatus(); return _mainDocTab.getHideTabBarStatus();
} }
case NPPM_INTERNAL_ISFOCUSEDTAB :
{
ScintillaEditView *cv = getCurrentEditView();
HWND pMainTB = (_mainDocTab.getView() == cv)?_mainDocTab.getHSelf():_subDocTab.getHSelf();
return (HWND)lParam == pMainTB;
}
default: default:
{ {
if (Message == WDN_NOTIFY) if (Message == WDN_NOTIFY)

View File

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

View File

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

View File

@ -515,7 +515,11 @@ void TabBarPlus::drawItem(DRAWITEMSTRUCT *pDrawItemStruct)
rect.top += 2; 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); ::FillRect(hDC, &barRect, hBrush);
::DeleteObject((HGDIOBJ)hBrush); ::DeleteObject((HGDIOBJ)hBrush);
} }

View File

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