* The window title now uses B_TRUNCATE_MIDDLE instead of *_END.
* Cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26954 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -2312,7 +2312,7 @@ TWindowView::Draw(BRect update)
|
|||||||
|
|
||||||
if (stringWidth > maxWidth) {
|
if (stringWidth > maxWidth) {
|
||||||
// window title is too long, need to truncate
|
// window title is too long, need to truncate
|
||||||
TruncateString(&title, B_TRUNCATE_END, maxWidth);
|
TruncateString(&title, B_TRUNCATE_MIDDLE, maxWidth);
|
||||||
stringWidth = maxWidth;
|
stringWidth = maxWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -158,8 +158,8 @@ DefaultDecorator::SetTitle(const char* string, BRegion* updateRegion)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
DefaultDecorator::SetLook(DesktopSettings& settings,
|
DefaultDecorator::SetLook(DesktopSettings& settings, window_look look,
|
||||||
window_look look, BRegion* updateRegion)
|
BRegion* updateRegion)
|
||||||
{
|
{
|
||||||
// TODO: we could be much smarter about the update region
|
// TODO: we could be much smarter about the update region
|
||||||
|
|
||||||
@@ -350,7 +350,8 @@ DefaultDecorator::ResizeBy(BPoint pt, BRegion* dirty)
|
|||||||
|
|
||||||
if (fLook != kLeftTitledWindowLook && tabSize != fTabRect.Width()) {
|
if (fLook != kLeftTitledWindowLook && tabSize != fTabRect.Width()) {
|
||||||
fTabRect.right = fTabRect.left + tabSize;
|
fTabRect.right = fTabRect.left + tabSize;
|
||||||
} else if (fLook == kLeftTitledWindowLook && tabSize != fTabRect.Height()) {
|
} else if (fLook == kLeftTitledWindowLook
|
||||||
|
&& tabSize != fTabRect.Height()) {
|
||||||
fTabRect.bottom = fTabRect.top + tabSize;
|
fTabRect.bottom = fTabRect.top + tabSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -387,7 +388,8 @@ DefaultDecorator::SetTabLocation(float location, BRegion* updateRegion)
|
|||||||
if (location < 0)
|
if (location < 0)
|
||||||
location = 0;
|
location = 0;
|
||||||
|
|
||||||
float maxLocation = fRightBorder.right - fLeftBorder.left - fTabRect.Width();
|
float maxLocation
|
||||||
|
= fRightBorder.right - fLeftBorder.left - fTabRect.Width();
|
||||||
if (location > maxLocation)
|
if (location > maxLocation)
|
||||||
location = maxLocation;
|
location = maxLocation;
|
||||||
|
|
||||||
@@ -467,17 +469,21 @@ DefaultDecorator::Draw()
|
|||||||
|
|
||||||
void
|
void
|
||||||
DefaultDecorator::GetSizeLimits(int32* minWidth, int32* minHeight,
|
DefaultDecorator::GetSizeLimits(int32* minWidth, int32* minHeight,
|
||||||
int32* maxWidth, int32* maxHeight) const
|
int32* maxWidth, int32* maxHeight) const
|
||||||
{
|
{
|
||||||
if (fTabRect.IsValid())
|
if (fTabRect.IsValid()) {
|
||||||
*minWidth = (int32)roundf(max_c(*minWidth, fMinTabSize - 2 * fBorderWidth));
|
*minWidth = (int32)roundf(max_c(*minWidth,
|
||||||
if (fResizeRect.IsValid())
|
fMinTabSize - 2 * fBorderWidth));
|
||||||
*minHeight = (int32)roundf(max_c(*minHeight, fResizeRect.Height() - fBorderWidth));
|
}
|
||||||
|
if (fResizeRect.IsValid()) {
|
||||||
|
*minHeight = (int32)roundf(max_c(*minHeight,
|
||||||
|
fResizeRect.Height() - fBorderWidth));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
DefaultDecorator::GetFootprint(BRegion *region)
|
DefaultDecorator::GetFootprint(BRegion* region)
|
||||||
{
|
{
|
||||||
STRACE(("DefaultDecorator: Get Footprint\n"));
|
STRACE(("DefaultDecorator: Get Footprint\n"));
|
||||||
// This function calculates the decorator's footprint in coordinates
|
// This function calculates the decorator's footprint in coordinates
|
||||||
@@ -556,8 +562,8 @@ DefaultDecorator::Clicked(BPoint pt, int32 buttons, int32 modifiers)
|
|||||||
|| fLook == B_FLOATING_WINDOW_LOOK
|
|| fLook == B_FLOATING_WINDOW_LOOK
|
||||||
|| fLook == B_MODAL_WINDOW_LOOK
|
|| fLook == B_MODAL_WINDOW_LOOK
|
||||||
|| fLook == kLeftTitledWindowLook)) {
|
|| fLook == kLeftTitledWindowLook)) {
|
||||||
BRect temp(BPoint(fBottomBorder.right - 18, fBottomBorder.bottom - 18),
|
BRect temp(BPoint(fBottomBorder.right - 18,
|
||||||
fBottomBorder.RightBottom());
|
fBottomBorder.bottom - 18), fBottomBorder.RightBottom());
|
||||||
if (temp.Contains(pt))
|
if (temp.Contains(pt))
|
||||||
return DEC_RESIZE;
|
return DEC_RESIZE;
|
||||||
}
|
}
|
||||||
@@ -1032,7 +1038,7 @@ DefaultDecorator::_DrawTitle(BRect r)
|
|||||||
titlePos);
|
titlePos);
|
||||||
}
|
}
|
||||||
|
|
||||||
// _DrawZoom
|
|
||||||
void
|
void
|
||||||
DefaultDecorator::_DrawZoom(BRect rect)
|
DefaultDecorator::_DrawZoom(BRect rect)
|
||||||
{
|
{
|
||||||
@@ -1050,7 +1056,7 @@ DefaultDecorator::_DrawZoom(BRect rect)
|
|||||||
_DrawButtonBitmap(bitmap, rect);
|
_DrawButtonBitmap(bitmap, rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
// _SetFocus
|
|
||||||
void
|
void
|
||||||
DefaultDecorator::_SetFocus()
|
DefaultDecorator::_SetFocus()
|
||||||
{
|
{
|
||||||
@@ -1088,7 +1094,7 @@ DefaultDecorator::_SetColors()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
DefaultDecorator::_DrawButtonBitmap(ServerBitmap *bitmap, BRect rect)
|
DefaultDecorator::_DrawButtonBitmap(ServerBitmap* bitmap, BRect rect)
|
||||||
{
|
{
|
||||||
if (bitmap == NULL)
|
if (bitmap == NULL)
|
||||||
return;
|
return;
|
||||||
@@ -1108,7 +1114,7 @@ DefaultDecorator::_DrawButtonBitmap(ServerBitmap *bitmap, BRect rect)
|
|||||||
\param down The rectangle should be drawn recessed or not
|
\param down The rectangle should be drawn recessed or not
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
DefaultDecorator::_DrawBlendedRect(DrawingEngine *engine, BRect rect,
|
DefaultDecorator::_DrawBlendedRect(DrawingEngine* engine, BRect rect,
|
||||||
bool down, bool focus)
|
bool down, bool focus)
|
||||||
{
|
{
|
||||||
// Actually just draws a blended square
|
// Actually just draws a blended square
|
||||||
@@ -1153,7 +1159,7 @@ DefaultDecorator::_DrawBlendedRect(DrawingEngine *engine, BRect rect,
|
|||||||
focus ? fFocusFrameColors[1] : fNonFocusFrameColors[1]);
|
focus ? fFocusFrameColors[1] : fNonFocusFrameColors[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// _GetButtonSizeAndOffset
|
|
||||||
void
|
void
|
||||||
DefaultDecorator::_GetButtonSizeAndOffset(const BRect& tabRect, float* _offset,
|
DefaultDecorator::_GetButtonSizeAndOffset(const BRect& tabRect, float* _offset,
|
||||||
float* _size, float* _inset) const
|
float* _size, float* _inset) const
|
||||||
@@ -1174,7 +1180,7 @@ DefaultDecorator::_GetButtonSizeAndOffset(const BRect& tabRect, float* _offset,
|
|||||||
*_size = tabSize - 2 * *_offset + *_inset;
|
*_size = tabSize - 2 * *_offset + *_inset;
|
||||||
}
|
}
|
||||||
|
|
||||||
// _LayoutTabItems
|
|
||||||
void
|
void
|
||||||
DefaultDecorator::_LayoutTabItems(const BRect& tabRect)
|
DefaultDecorator::_LayoutTabItems(const BRect& tabRect)
|
||||||
{
|
{
|
||||||
@@ -1220,14 +1226,14 @@ DefaultDecorator::_LayoutTabItems(const BRect& tabRect)
|
|||||||
size = (fZoomRect.top - fCloseRect.bottom) - fTextOffset * 2 + inset;
|
size = (fZoomRect.top - fCloseRect.bottom) - fTextOffset * 2 + inset;
|
||||||
|
|
||||||
fTruncatedTitle = Title();
|
fTruncatedTitle = Title();
|
||||||
fDrawState.Font().TruncateString(&fTruncatedTitle, B_TRUNCATE_END, size);
|
fDrawState.Font().TruncateString(&fTruncatedTitle, B_TRUNCATE_MIDDLE, size);
|
||||||
fTruncatedTitleLength = fTruncatedTitle.Length();
|
fTruncatedTitleLength = fTruncatedTitle.Length();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ServerBitmap *
|
ServerBitmap*
|
||||||
DefaultDecorator::_GetBitmapForButton(int32 item, bool down, bool focus,
|
DefaultDecorator::_GetBitmapForButton(int32 item, bool down, bool focus,
|
||||||
int32 width, int32 height, DefaultDecorator *object)
|
int32 width, int32 height, DefaultDecorator* object)
|
||||||
{
|
{
|
||||||
// TODO: the list of shared bitmaps is never freed
|
// TODO: the list of shared bitmaps is never freed
|
||||||
struct decorator_bitmap {
|
struct decorator_bitmap {
|
||||||
@@ -1236,16 +1242,16 @@ DefaultDecorator::_GetBitmapForButton(int32 item, bool down, bool focus,
|
|||||||
bool focus;
|
bool focus;
|
||||||
int32 width;
|
int32 width;
|
||||||
int32 height;
|
int32 height;
|
||||||
UtilityBitmap * bitmap;
|
UtilityBitmap* bitmap;
|
||||||
decorator_bitmap * next;
|
decorator_bitmap* next;
|
||||||
};
|
};
|
||||||
|
|
||||||
static BLocker sBitmapListLock("decorator lock", true);
|
static BLocker sBitmapListLock("decorator lock", true);
|
||||||
static decorator_bitmap *sBitmapList = NULL;
|
static decorator_bitmap* sBitmapList = NULL;
|
||||||
BAutolock locker(sBitmapListLock);
|
BAutolock locker(sBitmapListLock);
|
||||||
|
|
||||||
// search our list for a matching bitmap
|
// search our list for a matching bitmap
|
||||||
decorator_bitmap *current = sBitmapList;
|
decorator_bitmap* current = sBitmapList;
|
||||||
while (current) {
|
while (current) {
|
||||||
if (current->item == item && current->down == down
|
if (current->item == item && current->down == down
|
||||||
&& current->focus == focus && current->width == width
|
&& current->focus == focus && current->width == width
|
||||||
@@ -1256,7 +1262,7 @@ DefaultDecorator::_GetBitmapForButton(int32 item, bool down, bool focus,
|
|||||||
current = current->next;
|
current = current->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
static BitmapDrawingEngine *sBitmapDrawingEngine = NULL;
|
static BitmapDrawingEngine* sBitmapDrawingEngine = NULL;
|
||||||
|
|
||||||
// didn't find any bitmap, create a new one
|
// didn't find any bitmap, create a new one
|
||||||
if (sBitmapDrawingEngine == NULL)
|
if (sBitmapDrawingEngine == NULL)
|
||||||
@@ -1294,13 +1300,13 @@ DefaultDecorator::_GetBitmapForButton(int32 item, bool down, bool focus,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
UtilityBitmap *bitmap = sBitmapDrawingEngine->ExportToBitmap(width, height,
|
UtilityBitmap* bitmap = sBitmapDrawingEngine->ExportToBitmap(width, height,
|
||||||
B_RGB32);
|
B_RGB32);
|
||||||
if (bitmap == NULL)
|
if (bitmap == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
// bitmap ready, put it into the list
|
// bitmap ready, put it into the list
|
||||||
decorator_bitmap *entry = new(std::nothrow) decorator_bitmap;
|
decorator_bitmap* entry = new(std::nothrow) decorator_bitmap;
|
||||||
if (entry == NULL) {
|
if (entry == NULL) {
|
||||||
delete bitmap;
|
delete bitmap;
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|||||||
Reference in New Issue
Block a user