- Increase max size for stacked tabs.
- Use more title space in stacked tabs. - Fix tab movement in stacked mode. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38475 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -218,10 +218,7 @@ SATDecorator::_DoLayout()
|
|||||||
if (hasTab) {
|
if (hasTab) {
|
||||||
// distance from one item of the tab bar to another.
|
// distance from one item of the tab bar to another.
|
||||||
// In this case the text and close/zoom rects
|
// In this case the text and close/zoom rects
|
||||||
if (fStackedMode && false)
|
fTextOffset = (fLook == B_FLOATING_WINDOW_LOOK
|
||||||
fTextOffset = 5;
|
|
||||||
else
|
|
||||||
fTextOffset = (fLook == B_FLOATING_WINDOW_LOOK
|
|
||||||
|| fLook == kLeftTitledWindowLook) ? 10 : 18;
|
|| fLook == kLeftTitledWindowLook) ? 10 : 18;
|
||||||
|
|
||||||
font_height fontHeight;
|
font_height fontHeight;
|
||||||
@@ -396,8 +393,26 @@ SATDecorator::_LayoutTabItems(const BRect& tabRect)
|
|||||||
fZoomRect.Set(0, 0, 0, 0);
|
fZoomRect.Set(0, 0, 0, 0);
|
||||||
size = (fTabRect.right - fCloseRect.right) - fTextOffset * 2 + inset;
|
size = (fTabRect.right - fCloseRect.right) - fTextOffset * 2 + inset;
|
||||||
}
|
}
|
||||||
|
uint8 truncateMode = B_TRUNCATE_MIDDLE;
|
||||||
|
if (fStackedMode)
|
||||||
|
truncateMode = B_TRUNCATE_END;
|
||||||
|
|
||||||
|
if (fStackedMode) {
|
||||||
|
float titleWidth = fDrawState.Font().StringWidth(Title(),
|
||||||
|
BString(Title()).Length());
|
||||||
|
if (size < titleWidth) {
|
||||||
|
float oldTextOffset = fTextOffset;
|
||||||
|
fTextOffset -= (titleWidth - size) / 2;
|
||||||
|
const float kMinTextOffset = 5.;
|
||||||
|
if (fTextOffset < kMinTextOffset)
|
||||||
|
fTextOffset = kMinTextOffset;
|
||||||
|
size += oldTextOffset * 2;
|
||||||
|
size -= fTextOffset * 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fTruncatedTitle = Title();
|
fTruncatedTitle = Title();
|
||||||
fDrawState.Font().TruncateString(&fTruncatedTitle, B_TRUNCATE_MIDDLE, size);
|
fDrawState.Font().TruncateString(&fTruncatedTitle, truncateMode, size);
|
||||||
fTruncatedTitleLength = fTruncatedTitle.Length();
|
fTruncatedTitleLength = fTruncatedTitle.Length();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -475,6 +490,47 @@ SATDecorator::_DrawTab(BRect invalid)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
SATDecorator::_SetTabLocation(float location, BRegion* updateRegion)
|
||||||
|
{
|
||||||
|
STRACE(("DefaultDecorator: Set Tab Location(%.1f)\n", location));
|
||||||
|
if (!fTabRect.IsValid())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (location < 0)
|
||||||
|
location = 0;
|
||||||
|
|
||||||
|
float maxLocation = 0.;
|
||||||
|
if (fStackedMode)
|
||||||
|
maxLocation = fRightBorder.right - fLeftBorder.left - fStackedTabLength;
|
||||||
|
else
|
||||||
|
maxLocation = fRightBorder.right - fLeftBorder.left - fTabRect.Width();
|
||||||
|
if (location > maxLocation)
|
||||||
|
location = maxLocation;
|
||||||
|
|
||||||
|
float delta = location - fTabOffset;
|
||||||
|
if (delta == 0.0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// redraw old rect (1 pix on the border also must be updated)
|
||||||
|
BRect trect(fTabRect);
|
||||||
|
trect.bottom++;
|
||||||
|
updateRegion->Include(trect);
|
||||||
|
|
||||||
|
fTabRect.OffsetBy(delta, 0);
|
||||||
|
fTabOffset = (int32)location;
|
||||||
|
_LayoutTabItems(fTabRect);
|
||||||
|
|
||||||
|
fTabLocation = maxLocation > 0.0 ? fTabOffset / maxLocation : 0.0;
|
||||||
|
|
||||||
|
// redraw new rect as well
|
||||||
|
trect = fTabRect;
|
||||||
|
trect.bottom++;
|
||||||
|
updateRegion->Include(trect);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
extern "C" DecorAddOn* (instantiate_decor_addon)(image_id id, const char* name)
|
extern "C" DecorAddOn* (instantiate_decor_addon)(image_id id, const char* name)
|
||||||
{
|
{
|
||||||
return new (std::nothrow)SATDecorAddOn(id, name);
|
return new (std::nothrow)SATDecorAddOn(id, name);
|
||||||
|
|||||||
@@ -56,6 +56,8 @@ protected:
|
|||||||
void _DrawTab(BRect r);
|
void _DrawTab(BRect r);
|
||||||
void _LayoutTabItems(const BRect& tabRect);
|
void _LayoutTabItems(const BRect& tabRect);
|
||||||
|
|
||||||
|
bool _SetTabLocation(float location,
|
||||||
|
BRegion* updateRegion = NULL);
|
||||||
private:
|
private:
|
||||||
bool fTabHighlighted;
|
bool fTabHighlighted;
|
||||||
bool fBordersHighlighted;
|
bool fBordersHighlighted;
|
||||||
|
|||||||
@@ -28,6 +28,9 @@
|
|||||||
using namespace BPrivate;
|
using namespace BPrivate;
|
||||||
|
|
||||||
|
|
||||||
|
const float kMaxTabWidth = 135.;
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
StackingEventHandler::HandleMessage(SATWindow* sender,
|
StackingEventHandler::HandleMessage(SATWindow* sender,
|
||||||
BPrivate::ServerLink& link)
|
BPrivate::ServerLink& link)
|
||||||
@@ -358,8 +361,6 @@ SATStacking::_AdjustWindowTabs()
|
|||||||
|
|
||||||
BRect frame = fSATWindow->CompleteWindowFrame();
|
BRect frame = fSATWindow->CompleteWindowFrame();
|
||||||
|
|
||||||
const float kMaxTabWidth = 120.;
|
|
||||||
|
|
||||||
const SATWindowList& stackedWindows = area->WindowList();
|
const SATWindowList& stackedWindows = area->WindowList();
|
||||||
|
|
||||||
float zoomOffset = decorator->GetZoomOffsetToRight();
|
float zoomOffset = decorator->GetZoomOffsetToRight();
|
||||||
|
|||||||
Reference in New Issue
Block a user