[haiku-commits] haiku: hrev53438 - src/kits/tracker/infowindow

  • From: Adrien Destugues <pulkomandy@xxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sat, 31 Aug 2019 11:16:57 -0400 (EDT)

hrev53438 adds 2 changesets to branch 'master'
old head: 349ab0050a7038378f9d17b4e6d9083284d9efc6
new head: 5f996be3c6f7aaec9bc4d4e35b3da46cae13d9f1
overview: 
https://git.haiku-os.org/haiku/log/?qt=range&q=5f996be3c6f7+%5E349ab0050a70

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

72ce59475397: InfoWindow: allow some resizing of attribute columns
  
  Fixes #15319

5f996be3c6f7: InfoWindow: more window sizing improvements
  
  Fixes #15310 and other problem mentioned in comments threrein.

                             [ Adrien Destugues <pulkomandy@xxxxxxxxxxxxx> ]

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

2 files changed, 32 insertions(+), 9 deletions(-)
src/kits/tracker/infowindow/AttributesView.cpp  | 19 +++++++++++-------
src/kits/tracker/infowindow/GeneralInfoView.cpp | 22 +++++++++++++++++++--

############################################################################

Commit:      72ce5947539702efca8c860303b9f45051a1a5e8
URL:         https://git.haiku-os.org/haiku/commit/?id=72ce59475397
Author:      Adrien Destugues <pulkomandy@xxxxxxxxxxxxx>
Date:        Sat Aug 31 15:16:53 2019 UTC

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

InfoWindow: allow some resizing of attribute columns

Fixes #15319

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

diff --git a/src/kits/tracker/infowindow/AttributesView.cpp 
b/src/kits/tracker/infowindow/AttributesView.cpp
index 4a11b58b7d..3f35893e44 100644
--- a/src/kits/tracker/infowindow/AttributesView.cpp
+++ b/src/kits/tracker/infowindow/AttributesView.cpp
@@ -21,25 +21,30 @@ int kTypeColumn = 2;
 AttributesView::AttributesView(Model* model)
        :
        BGroupView(B_VERTICAL, 0),
-       fListView(new BColumnListView("attrs", 0, B_PLAIN_BORDER))
+       fListView(new BColumnListView("attrs", 0, B_PLAIN_BORDER, false))
 {
        SetName("Attributes");
        AddChild(fListView);
 
        float nameWidth = StringWidth("SYS:PACKAGE_FILE") + 16;
-       float typeWidth = StringWidth("Double-precision floating point number") 
+ 16;
-       float valueWidth = StringWidth("W") * 64 + 16;
+       float typeMaxWidth = StringWidth("Double-precision floating point 
number") + 16;
+       float typeWidth = StringWidth("64-bit unsigned integer") + 16;
+       float valueMaxWidth = StringWidth("W") * 64 + 16;
+       float valueWidth = StringWidth("(94.00, 95.00) (1920, 1080)") + 16;
        BStringColumn* nameColumn = new BStringColumn("Name", nameWidth, 
nameWidth,
-               nameWidth, nameWidth);
+               nameWidth, 0);
        BStringColumn* typeColumn = new BStringColumn("Type", typeWidth, 
typeWidth,
-               typeWidth, typeWidth);
+               typeMaxWidth, 0);
        BStringColumn* valueColumn = new BStringColumn("Value", valueWidth,
-               valueWidth, valueWidth, valueWidth);
+               valueWidth, valueMaxWidth, 0);
 
        fListView->AddColumn(nameColumn, 0);
        fListView->AddColumn(valueColumn, 1);
        fListView->AddColumn(typeColumn, 2);
 
+       SetExplicitMinSize(BSize(typeWidth + valueWidth + nameWidth + 40,
+               B_SIZE_UNSET));
+
        BNode* node = model->Node();
 
        node->RewindAttrs();
@@ -134,7 +139,7 @@ AttributesView::AttributesView(Model* model)
                                if (info.size == sizeof(BRect)) {
                                        BRect value;
                                        node->ReadAttr(name, info.type, 0, 
&value, sizeof(value));
-                                       representation.SetToFormat("(%f,%f) 
(%f,%f)", value.left,
+                                       representation.SetToFormat("(%g,%g) 
(%g,%g)", value.left,
                                                value.top, value.right, 
value.bottom);
                                } else {
                                        representation.SetToFormat("<%" 
B_PRIdOFF " rectangles>",

############################################################################

Revision:    hrev53438
Commit:      5f996be3c6f7aaec9bc4d4e35b3da46cae13d9f1
URL:         https://git.haiku-os.org/haiku/commit/?id=5f996be3c6f7
Author:      Adrien Destugues <pulkomandy@xxxxxxxxxxxxx>
Date:        Sat Aug 31 15:17:23 2019 UTC

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

InfoWindow: more window sizing improvements

Fixes #15310 and other problem mentioned in comments threrein.

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

diff --git a/src/kits/tracker/infowindow/GeneralInfoView.cpp 
b/src/kits/tracker/infowindow/GeneralInfoView.cpp
index b071f56f81..c436e9039b 100644
--- a/src/kits/tracker/infowindow/GeneralInfoView.cpp
+++ b/src/kits/tracker/infowindow/GeneralInfoView.cpp
@@ -165,6 +165,21 @@ GeneralInfoView::GeneralInfoView(Model* model)
        fCurrentLinkColorWhich(B_LINK_TEXT_COLOR),
        fCurrentPathColorWhich(fCurrentLinkColorWhich)
 {
+       const char* fieldNames[] = {
+               B_TRANSLATE("Description:"),
+               B_TRANSLATE("Location:"),
+               B_TRANSLATE("Opens with:"),
+               B_TRANSLATE("Capacity:"),
+               B_TRANSLATE("Size:"),
+               B_TRANSLATE("Created:"),
+               B_TRANSLATE("Modified:"),
+               B_TRANSLATE("Kind:"),
+               B_TRANSLATE("Link to:"),
+               B_TRANSLATE("Version:"),
+               NULL
+       };
+
+
        SetFlags(Flags() | B_WILL_DRAW | B_PULSE_NEEDED | B_FRAME_EVENTS);
        SetName(B_TRANSLATE("Information"));
        // Set view color to standard background grey
@@ -182,8 +197,9 @@ GeneralInfoView::GeneralInfoView(Model* model)
 
        // The widest string depends on the locale. We should check them all, 
this
        // is only an approximation that works for English and French.
-       float width = currentFont.StringWidth(B_TRANSLATE("Description:"));
-       width = std::max(width, 
currentFont.StringWidth(B_TRANSLATE("Location:")));
+       float width = 0;
+       for (int i = 0; fieldNames[i] != 0; i++)
+               width = std::max(width, StringWidth(fieldNames[i]));
        fDivider = width + kBorderMargin + 1;
 
        // Keep some free space for the stuff we print ourselves
@@ -191,6 +207,8 @@ GeneralInfoView::GeneralInfoView(Model* model)
        int lineCount = 7;
        if (model->IsSymLink())
                lineCount += 1; // Add space for "Link to" line
+       if (model->IsExecutable())
+               lineCount += 2; // Add space for "Version" and "Description" 
lines
        GroupLayout()->SetInsets(kBorderMargin, lineHeight * lineCount,
                B_USE_WINDOW_SPACING, B_USE_WINDOW_SPACING);
 


Other related posts:

  • » [haiku-commits] haiku: hrev53438 - src/kits/tracker/infowindow - Adrien Destugues