Skip to content

Commit

Permalink
Truncate Background image name to avoid layout problem
Browse files Browse the repository at this point in the history
Fixes #7406

Signed-off-by: Siarzhuk Zharski <zharik@gmx.li>
  • Loading branch information
przemub authored and siarzhuk committed Jan 13, 2013
1 parent fef016c commit b4fdcd5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
12 changes: 11 additions & 1 deletion src/preferences/backgrounds/BackgroundImage.cpp
Expand Up @@ -561,7 +561,17 @@ Image::Image(BPath path)
fBitmap(NULL),
fPath(path)
{
name = path.Leaf();
const int32 kMaxWidth = 40;
fName = path.Leaf();
int extra = fName.Length() - kMaxWidth;
if (extra > 0) {
int offset = fName.FindLast('.');
if (offset > 0) {
offset++;
fName.Truncate(offset - extra) << B_UTF8_ELLIPSIS;
fName.Append(path.Leaf() + offset);
}
}
}


Expand Down
6 changes: 3 additions & 3 deletions src/preferences/backgrounds/BackgroundImage.h
Expand Up @@ -165,13 +165,13 @@ class Image {
~Image();

void UnloadBitmap();
const char* GetName() {return name.String();}
const char* GetName() { return fName.String(); }
BBitmap* GetBitmap();
BPath GetPath() {return fPath;}
BPath GetPath() { return fPath; }
private:
BBitmap* fBitmap;
BPath fPath;
BString name;
BString fName;
};

#endif
Expand Down

0 comments on commit b4fdcd5

Please sign in to comment.