* 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:
@@ -33,6 +33,8 @@ CharacterView::CharacterView(const char* name)
|
|||||||
{
|
{
|
||||||
fTitleTops = new int32[kNumUnicodeBlocks];
|
fTitleTops = new int32[kNumUnicodeBlocks];
|
||||||
fCharacterFont.SetSize(fCharacterFont.Size() * 1.5f);
|
fCharacterFont.SetSize(fCharacterFont.Size() * 1.5f);
|
||||||
|
|
||||||
|
_UpdateFontSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -479,12 +481,8 @@ CharacterView::_GetCharacterAt(BPoint point, uint32& character, BRect* _frame)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
CharacterView::_UpdateSize()
|
CharacterView::_UpdateFontSize()
|
||||||
{
|
{
|
||||||
// Compute data rect
|
|
||||||
|
|
||||||
BRect bounds = Bounds();
|
|
||||||
|
|
||||||
font_height fontHeight;
|
font_height fontHeight;
|
||||||
GetFontHeight(&fontHeight);
|
GetFontHeight(&fontHeight);
|
||||||
fTitleHeight = (int32)ceilf(fontHeight.ascent + fontHeight.descent
|
fTitleHeight = (int32)ceilf(fontHeight.ascent + fontHeight.descent
|
||||||
@@ -510,6 +508,17 @@ CharacterView::_UpdateSize()
|
|||||||
|
|
||||||
fCharacterHeight += fGap;
|
fCharacterHeight += fGap;
|
||||||
fTitleGap = fGap * 3;
|
fTitleGap = fGap * 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
CharacterView::_UpdateSize()
|
||||||
|
{
|
||||||
|
// Compute data rect
|
||||||
|
|
||||||
|
BRect bounds = Bounds();
|
||||||
|
|
||||||
|
_UpdateFontSize();
|
||||||
|
|
||||||
fDataRect.right = bounds.Width();
|
fDataRect.right = bounds.Width();
|
||||||
fDataRect.bottom = 0;
|
fDataRect.bottom = 0;
|
||||||
@@ -583,7 +592,7 @@ BRect
|
|||||||
CharacterView::_FrameFor(uint32 character)
|
CharacterView::_FrameFor(uint32 character)
|
||||||
{
|
{
|
||||||
// find block containing the character
|
// find block containing the character
|
||||||
|
|
||||||
// TODO: could use binary search here
|
// TODO: could use binary search here
|
||||||
|
|
||||||
for (uint32 i = 0; i < kNumUnicodeBlocks; i++) {
|
for (uint32 i = 0; i < kNumUnicodeBlocks; i++) {
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ private:
|
|||||||
int32 _BlockAt(BPoint point);
|
int32 _BlockAt(BPoint point);
|
||||||
bool _GetCharacterAt(BPoint point, uint32& character,
|
bool _GetCharacterAt(BPoint point, uint32& character,
|
||||||
BRect* _frame = NULL);
|
BRect* _frame = NULL);
|
||||||
|
void _UpdateFontSize();
|
||||||
void _UpdateSize();
|
void _UpdateSize();
|
||||||
bool _GetTopmostCharacter(uint32& character,
|
bool _GetTopmostCharacter(uint32& character,
|
||||||
int32& offset);
|
int32& offset);
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ public:
|
|||||||
{
|
{
|
||||||
SetModificationMessage(message);
|
SetModificationMessage(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
const char* UpdateText() const
|
const char* UpdateText() const
|
||||||
{
|
{
|
||||||
@@ -126,9 +126,6 @@ CharacterWindow::CharacterWindow()
|
|||||||
if (settings.FindRect("window frame", &frame) == B_OK) {
|
if (settings.FindRect("window frame", &frame) == B_OK) {
|
||||||
MoveTo(frame.LeftTop());
|
MoveTo(frame.LeftTop());
|
||||||
ResizeTo(frame.Width(), frame.Height());
|
ResizeTo(frame.Width(), frame.Height());
|
||||||
} else {
|
|
||||||
MoveTo(BPoint(100, 100));
|
|
||||||
ResizeTo(600, 450);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// create GUI
|
// create GUI
|
||||||
@@ -315,7 +312,7 @@ CharacterWindow::MessageReceived(BMessage* message)
|
|||||||
fSelectedFontItem = item;
|
fSelectedFontItem = item;
|
||||||
|
|
||||||
_SetFont(item->Menu()->Name(), item->Label());
|
_SetFont(item->Menu()->Name(), item->Label());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -339,7 +336,7 @@ CharacterWindow::MessageReceived(BMessage* message)
|
|||||||
if (message->FindPointer("source", (void**)&item) != B_OK
|
if (message->FindPointer("source", (void**)&item) != B_OK
|
||||||
|| item == NULL)
|
|| item == NULL)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
item->SetMarked(!item->IsMarked());
|
item->SetMarked(!item->IsMarked());
|
||||||
|
|
||||||
fCharacterView->ShowPrivateBlocks(item->IsMarked());
|
fCharacterView->ShowPrivateBlocks(item->IsMarked());
|
||||||
@@ -353,7 +350,7 @@ CharacterWindow::MessageReceived(BMessage* message)
|
|||||||
if (message->FindPointer("source", (void**)&item) != B_OK
|
if (message->FindPointer("source", (void**)&item) != B_OK
|
||||||
|| item == NULL)
|
|| item == NULL)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
item->SetMarked(!item->IsMarked());
|
item->SetMarked(!item->IsMarked());
|
||||||
|
|
||||||
fCharacterView->ShowContainedBlocksOnly(item->IsMarked());
|
fCharacterView->ShowContainedBlocksOnly(item->IsMarked());
|
||||||
@@ -434,11 +431,11 @@ CharacterWindow::_SaveSettings()
|
|||||||
status = settings.AddBool("show contained blocks only",
|
status = settings.AddBool("show contained blocks only",
|
||||||
fCharacterView->IsShowingContainedBlocksOnly());
|
fCharacterView->IsShowingContainedBlocksOnly());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (status == B_OK) {
|
if (status == B_OK) {
|
||||||
BFont font = fCharacterView->CharacterFont();
|
BFont font = fCharacterView->CharacterFont();
|
||||||
status = settings.AddInt32("font size", font.Size());
|
status = settings.AddInt32("font size", font.Size());
|
||||||
|
|
||||||
font_family family;
|
font_family family;
|
||||||
font_style style;
|
font_style style;
|
||||||
if (status == B_OK)
|
if (status == B_OK)
|
||||||
|
|||||||
Reference in New Issue
Block a user