Ticket #3651: 3651-Enh9.patch

File 3651-Enh9.patch, 1.6 KB (added by dsizzle, 9 years ago)

patch for enhancement 9 (character view pane size changing rapidly)

  • src/apps/charactermap/CharacterWindow.cpp

    From 05ddc0f17e76e68b43e0d870d2bce60cb3347d3b Mon Sep 17 00:00:00 2001
    From: dsizzle <dcieslak@yahoo.com>
    Date: Tue, 25 Nov 2014 20:22:50 +0000
    Subject: [PATCH] 3651: Enhancement 9 - set explicit minimum width of character
     view to be a bit larger than fCodeView so that there isn't jumping of the
     pane sizes when fCodeView's contents are too long
    
    ---
     src/apps/charactermap/CharacterWindow.cpp | 13 +++++++++++++
     1 file changed, 13 insertions(+)
    
    diff --git a/src/apps/charactermap/CharacterWindow.cpp b/src/apps/charactermap/CharacterWindow.cpp
    index 1f860b8..bf7880b 100644
    a b  
    1515#include <Catalog.h>
    1616#include <File.h>
    1717#include <FindDirectory.h>
     18#include <Font.h>
    1819#include <LayoutBuilder.h>
    1920#include <ListView.h>
    2021#include <Menu.h>
    CharacterWindow::CharacterWindow()  
    210211    fCodeView->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED,
    211212        fCodeView->PreferredSize().Height()));
    212213
     214    // set minimum width for character pane to prevent UI
     215    // from jumping when longer code strings are displayed.
     216    // use 'w' character for sizing as it's likely the widest
     217    // character for a Latin font.  40 characters is a little
     218    // wider than needed so hopefully this covers other
     219    // non-Latin fonts that may be wider.
     220    BFont viewFont;
     221    fCodeView->GetFont(&viewFont);
     222    fCharacterView->SetExplicitMinSize(BSize(viewFont.StringWidth(
     223        "w") * 40,
     224        B_SIZE_UNSET));
     225       
    213226    BLayoutBuilder::Group<>(this, B_VERTICAL)
    214227        .Add(menuBar)
    215228        .AddGroup(B_HORIZONTAL)