[haiku-commits] haiku: hrev48464 - src/preferences/datatranslations

  • From: pulkomandy@xxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Tue, 9 Dec 2014 08:47:55 +0100 (CET)

hrev48464 adds 1 changeset to branch 'master'
old head: 4cec648e86c78dd4c93ab2ec0cc811dd8f63a301
new head: 4380baa4d72d9146e7b35baa2378272c6378c285
overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=4380baa+%5E4cec648

----------------------------------------------------------------------------

4380baa: DataTranslations: avoid layout jumping
  
  * Constrain the list and "right view" sizes so the layout doesn't change
  for each translator.
  * Fixes #6897.

                                 [ Adrien Destugues <pulkomandy@xxxxxxxxx> ]

----------------------------------------------------------------------------

Revision:    hrev48464
Commit:      4380baa4d72d9146e7b35baa2378272c6378c285
URL:         http://cgit.haiku-os.org/haiku/commit/?id=4380baa
Author:      Adrien Destugues <pulkomandy@xxxxxxxxx>
Date:        Tue Dec  9 07:47:09 2014 UTC

Ticket:      https://dev.haiku-os.org/ticket/6897

----------------------------------------------------------------------------

1 file changed, 10 insertions(+), 2 deletions(-)
.../datatranslations/DataTranslationsWindow.cpp          | 12 ++++++++++--

----------------------------------------------------------------------------

diff --git a/src/preferences/datatranslations/DataTranslationsWindow.cpp 
b/src/preferences/datatranslations/DataTranslationsWindow.cpp
index 7cf78d8..f09979f 100644
--- a/src/preferences/datatranslations/DataTranslationsWindow.cpp
+++ b/src/preferences/datatranslations/DataTranslationsWindow.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 2002-2010, Haiku, Inc.
+ * Copyright 2002-2014, Haiku, Inc.
  * Distributed under the terms of the MIT license.
  *
  * Authors:
@@ -12,6 +12,7 @@
 
 #include "DataTranslationsWindow.h"
 
+#include <algorithm>
 #include <stdio.h>
 
 #include <Alert.h>
@@ -90,6 +91,8 @@ DataTranslationsWindow::_PopulateListView()
        translator_id* translators = NULL;
        roster->GetAllTranslators(&translators, &numTranslators);
 
+       float maxWidth = 0;
+
        for (int32 i = 0; i < numTranslators; i++) {
                // Getting the first three Infos: Name, Info & Version
                int32 version;
@@ -97,8 +100,11 @@ DataTranslationsWindow::_PopulateListView()
                const char* info;
                roster->GetTranslatorInfo(translators[i], &name, &info, 
&version);
                fTranslatorListView->AddItem(new TranslatorItem(translators[i], 
name));
+               maxWidth = std::max(maxWidth, 
fTranslatorListView->StringWidth(name));
        }
 
+       fTranslatorListView->SetExplicitSize(BSize(maxWidth + 20, 
B_SIZE_UNSET));
+
        delete[] translators;
        return B_OK;
 }
@@ -208,13 +214,15 @@ DataTranslationsWindow::_SetupViews()
        fRightBox = new BBox("Right_Side");
        fRightBox->SetExplicitAlignment(BAlignment(B_ALIGN_USE_FULL_WIDTH,
                        B_ALIGN_USE_FULL_HEIGHT));
+       fRightBox->SetExplicitMinSize(BSize(350, 300));
 
        // Add the translator icon view
        fIconView = new IconView();
 
        // Add the translator info button
        fButton = new BButton("info", B_TRANSLATE("Info"),
-               new BMessage(kMsgTranslatorInfo), B_WILL_DRAW | B_FRAME_EVENTS 
| B_NAVIGABLE);
+               new BMessage(kMsgTranslatorInfo),
+               B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE);
        fButton->SetEnabled(false);
 
        // Populate the translators list view


Other related posts:

  • » [haiku-commits] haiku: hrev48464 - src/preferences/datatranslations - pulkomandy