In CharacterMap:

Separate the CodeView (info section at the bottom of the window)
in 2 sections, one with the character itself, the other with the
remaining infos (hex code, etc..)

The idea behind this is that if the font in the CharacterView above
is different than the default font used in that CodeView, it might
happen that a glyph doesn't show in the CodeView below but was shown
in the CharacterView above, or vice-versa.


Fixes ticket #4020


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40589 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Philippe Saint-Pierre 2011-02-21 01:56:00 +00:00
parent 9473d287b3
commit 2905062e64
2 changed files with 17 additions and 3 deletions

View File

@ -1,5 +1,6 @@
/*
* Copyright 2009-2010, Axel Dörfler, axeld@pinc-software.de.
* Copyright 2011, Philippe Saint-Pierre, stpere@gmail.com.
* Distributed under the terms of the MIT License.
*/
@ -156,6 +157,10 @@ CharacterWindow::CharacterWindow()
fCharacterView = new CharacterView("characters");
fCharacterView->SetTarget(this, kMsgCharacterChanged);
fGlyphView = new BStringView("glyph", "");
fGlyphView->SetExplicitMaxSize(BSize(B_SIZE_UNSET,
fGlyphView->PreferredSize().Height()));
// TODO: have a context object shared by CharacterView/UnicodeBlockView
bool show;
if (settings.FindBool("show private blocks", &show) == B_OK) {
@ -210,7 +215,9 @@ CharacterWindow::CharacterWindow()
.Add(BGroupLayoutBuilder(B_VERTICAL, 10)
.Add(characterScroller)
.Add(fFontSizeSlider)
.Add(fCodeView))
.Add(BGroupLayoutBuilder(B_HORIZONTAL, 0)
.Add(fGlyphView)
.Add(fCodeView)))
.SetInsets(10, 10, 10, 10)));
// Add menu
@ -310,9 +317,13 @@ CharacterWindow::MessageReceived(BMessage* message)
sizeof(utf8Hex));
char text[128];
snprintf(text, sizeof(text), "'%s' %s: %#lx (%ld), UTF-8: %s",
utf8, B_TRANSLATE("Code"), character, character, utf8Hex);
snprintf(text, sizeof(text), " %s: %#lx (%ld), UTF-8: %s",
B_TRANSLATE("Code"), character, character, utf8Hex);
char glyph[20];
snprintf(glyph, sizeof(glyph), "'%s'", utf8);
fGlyphView->SetText(glyph);
fCodeView->SetText(text);
break;
}
@ -487,6 +498,7 @@ CharacterWindow::_SetFont(const char* family, const char* style)
font.SetFamilyAndStyle(family, style);
fCharacterView->SetCharacterFont(font);
fGlyphView->SetFont(&font, B_FONT_FAMILY_AND_STYLE);
}

View File

@ -1,5 +1,6 @@
/*
* Copyright 2009, Axel Dörfler, axeld@pinc-software.de.
* Copyright 2011, Philippe Saint-Pierre, stpere@gmail.com.
* Distributed under the terms of the MIT License.
*/
#ifndef CHARACTER_WINDOW_H
@ -42,6 +43,7 @@ private:
CharacterView* fCharacterView;
BMenuItem* fSelectedFontItem;
BSlider* fFontSizeSlider;
BStringView* fGlyphView;
BStringView* fCodeView;
};