* Reverted r30529 as this was pretty much bogus (sorry stpere, but the size of
the window was already set with its constructor). * Fixed the actual cause of bug #3752 instead: the fCharacterHeight and fTitleHeight members were not initialized when MinSize() was called. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30629 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
0b218f6dd7
commit
f7b4d19dc4
@ -33,6 +33,8 @@ CharacterView::CharacterView(const char* name)
|
||||
{
|
||||
fTitleTops = new int32[kNumUnicodeBlocks];
|
||||
fCharacterFont.SetSize(fCharacterFont.Size() * 1.5f);
|
||||
|
||||
_UpdateFontSize();
|
||||
}
|
||||
|
||||
|
||||
@ -479,12 +481,8 @@ CharacterView::_GetCharacterAt(BPoint point, uint32& character, BRect* _frame)
|
||||
|
||||
|
||||
void
|
||||
CharacterView::_UpdateSize()
|
||||
CharacterView::_UpdateFontSize()
|
||||
{
|
||||
// Compute data rect
|
||||
|
||||
BRect bounds = Bounds();
|
||||
|
||||
font_height fontHeight;
|
||||
GetFontHeight(&fontHeight);
|
||||
fTitleHeight = (int32)ceilf(fontHeight.ascent + fontHeight.descent
|
||||
@ -510,6 +508,17 @@ CharacterView::_UpdateSize()
|
||||
|
||||
fCharacterHeight += fGap;
|
||||
fTitleGap = fGap * 3;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CharacterView::_UpdateSize()
|
||||
{
|
||||
// Compute data rect
|
||||
|
||||
BRect bounds = Bounds();
|
||||
|
||||
_UpdateFontSize();
|
||||
|
||||
fDataRect.right = bounds.Width();
|
||||
fDataRect.bottom = 0;
|
||||
@ -583,7 +592,7 @@ BRect
|
||||
CharacterView::_FrameFor(uint32 character)
|
||||
{
|
||||
// find block containing the character
|
||||
|
||||
|
||||
// TODO: could use binary search here
|
||||
|
||||
for (uint32 i = 0; i < kNumUnicodeBlocks; i++) {
|
||||
|
@ -59,6 +59,7 @@ private:
|
||||
int32 _BlockAt(BPoint point);
|
||||
bool _GetCharacterAt(BPoint point, uint32& character,
|
||||
BRect* _frame = NULL);
|
||||
void _UpdateFontSize();
|
||||
void _UpdateSize();
|
||||
bool _GetTopmostCharacter(uint32& character,
|
||||
int32& offset);
|
||||
|
@ -52,7 +52,7 @@ public:
|
||||
{
|
||||
SetModificationMessage(message);
|
||||
}
|
||||
|
||||
|
||||
protected:
|
||||
const char* UpdateText() const
|
||||
{
|
||||
@ -126,9 +126,6 @@ CharacterWindow::CharacterWindow()
|
||||
if (settings.FindRect("window frame", &frame) == B_OK) {
|
||||
MoveTo(frame.LeftTop());
|
||||
ResizeTo(frame.Width(), frame.Height());
|
||||
} else {
|
||||
MoveTo(BPoint(100, 100));
|
||||
ResizeTo(600, 450);
|
||||
}
|
||||
|
||||
// create GUI
|
||||
@ -315,7 +312,7 @@ CharacterWindow::MessageReceived(BMessage* message)
|
||||
fSelectedFontItem = item;
|
||||
|
||||
_SetFont(item->Menu()->Name(), item->Label());
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@ -339,7 +336,7 @@ CharacterWindow::MessageReceived(BMessage* message)
|
||||
if (message->FindPointer("source", (void**)&item) != B_OK
|
||||
|| item == NULL)
|
||||
break;
|
||||
|
||||
|
||||
item->SetMarked(!item->IsMarked());
|
||||
|
||||
fCharacterView->ShowPrivateBlocks(item->IsMarked());
|
||||
@ -353,7 +350,7 @@ CharacterWindow::MessageReceived(BMessage* message)
|
||||
if (message->FindPointer("source", (void**)&item) != B_OK
|
||||
|| item == NULL)
|
||||
break;
|
||||
|
||||
|
||||
item->SetMarked(!item->IsMarked());
|
||||
|
||||
fCharacterView->ShowContainedBlocksOnly(item->IsMarked());
|
||||
@ -434,11 +431,11 @@ CharacterWindow::_SaveSettings()
|
||||
status = settings.AddBool("show contained blocks only",
|
||||
fCharacterView->IsShowingContainedBlocksOnly());
|
||||
}
|
||||
|
||||
|
||||
if (status == B_OK) {
|
||||
BFont font = fCharacterView->CharacterFont();
|
||||
status = settings.AddInt32("font size", font.Size());
|
||||
|
||||
|
||||
font_family family;
|
||||
font_style style;
|
||||
if (status == B_OK)
|
||||
|
Loading…
Reference in New Issue
Block a user