[haiku-commits] r40589 - haiku/trunk/src/apps/charactermap

  • From: stpere@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Mon, 21 Feb 2011 02:56:01 +0100 (CET)

Author: stpere
Date: 2011-02-21 02:56:00 +0100 (Mon, 21 Feb 2011)
New Revision: 40589
Changeset: http://dev.haiku-os.org/changeset/40589
Ticket: http://dev.haiku-os.org/ticket/4020

Modified:
   haiku/trunk/src/apps/charactermap/CharacterWindow.cpp
   haiku/trunk/src/apps/charactermap/CharacterWindow.h
Log:
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


Modified: haiku/trunk/src/apps/charactermap/CharacterWindow.cpp
===================================================================
--- haiku/trunk/src/apps/charactermap/CharacterWindow.cpp       2011-02-20 
22:42:30 UTC (rev 40588)
+++ haiku/trunk/src/apps/charactermap/CharacterWindow.cpp       2011-02-21 
01:56:00 UTC (rev 40589)
@@ -1,5 +1,6 @@
 /*
  * Copyright 2009-2010, Axel Dörfler, axeld@xxxxxxxxxxxxxxxxx
+ * Copyright 2011, Philippe Saint-Pierre, stpere@xxxxxxxxxx
  * Distributed under the terms of the MIT License.
  */
 
@@ -156,6 +157,10 @@
        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 @@
                        .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 @@
                                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 @@
        font.SetFamilyAndStyle(family, style);
 
        fCharacterView->SetCharacterFont(font);
+       fGlyphView->SetFont(&font, B_FONT_FAMILY_AND_STYLE);
 }
 
 

Modified: haiku/trunk/src/apps/charactermap/CharacterWindow.h
===================================================================
--- haiku/trunk/src/apps/charactermap/CharacterWindow.h 2011-02-20 22:42:30 UTC 
(rev 40588)
+++ haiku/trunk/src/apps/charactermap/CharacterWindow.h 2011-02-21 01:56:00 UTC 
(rev 40589)
@@ -1,5 +1,6 @@
 /*
  * Copyright 2009, Axel Dörfler, axeld@xxxxxxxxxxxxxxxxx
+ * Copyright 2011, Philippe Saint-Pierre, stpere@xxxxxxxxxx
  * Distributed under the terms of the MIT License.
  */
 #ifndef CHARACTER_WINDOW_H
@@ -42,6 +43,7 @@
                        CharacterView*  fCharacterView;
                        BMenuItem*              fSelectedFontItem;
                        BSlider*                fFontSizeSlider;
+                       BStringView*    fGlyphView;
                        BStringView*    fCodeView;
 };
 


Other related posts:

  • » [haiku-commits] r40589 - haiku/trunk/src/apps/charactermap - stpere