[haiku-commits] r40311 - in haiku/trunk/src/tests/kits/net/preflet: . InterfacesAddOn

  • From: kallisti5@xxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Fri, 28 Jan 2011 21:21:06 +0100 (CET)

Author: kallisti5
Date: 2011-01-28 21:21:06 +0100 (Fri, 28 Jan 2011)
New Revision: 40311
Changeset: http://dev.haiku-os.org/changeset/40311

Modified:
   haiku/trunk/src/tests/kits/net/preflet/InterfacesAddOn/InterfacesListView.cpp
   haiku/trunk/src/tests/kits/net/preflet/InterfacesAddOn/InterfacesListView.h
   haiku/trunk/src/tests/kits/net/preflet/Jamfile
   haiku/trunk/src/tests/kits/net/preflet/NetworkSetup.cpp
   haiku/trunk/src/tests/kits/net/preflet/NetworkSetupWindow.cpp
Log:
clean up calculations of ListViewItem positions in Interfaces add-on; remove 
delete profile option which doesn't make sense

Modified: 
haiku/trunk/src/tests/kits/net/preflet/InterfacesAddOn/InterfacesListView.cpp
===================================================================
--- 
haiku/trunk/src/tests/kits/net/preflet/InterfacesAddOn/InterfacesListView.cpp   
    2011-01-28 19:34:37 UTC (rev 40310)
+++ 
haiku/trunk/src/tests/kits/net/preflet/InterfacesAddOn/InterfacesListView.cpp   
    2011-01-28 20:21:06 UTC (rev 40311)
@@ -1,10 +1,11 @@
 /*
- * Copyright 2004-2009 Haiku Inc. All rights reserved.
+ * Copyright 2004-2011 Haiku Inc. All rights reserved.
  * Distributed under the terms of the MIT License.
  *
  * Authors:
  *             Philippe Houdoin
  *             Fredrik Modéen
+ *             Alexander von Gluck IV, <kallisti5@xxxxxxxxxxx>
  */
 
 
@@ -78,8 +79,14 @@
        font_height height;
        font->GetHeight(&height);
 
-       // TODO: take into account icon height, if he's taller...
-       SetHeight((height.ascent+height.descent+height.leading) * 3.0 + 8);
+       float lineHeight = ceilf(height.ascent) + ceilf(height.descent)
+               + ceilf(height.leading);
+
+       fFirstlineOffset = 2 + ceilf(height.ascent + height.leading / 2);
+       fSecondlineOffset = fFirstlineOffset + lineHeight;
+       fThirdlineOffset = fFirstlineOffset + (lineHeight * 2);
+
+       SetHeight(3 * lineHeight + 4);
 }
 
 
@@ -90,11 +97,7 @@
        if (!list)
                return;
 
-       font_height height;
-       BFont font;
-       owner->GetFont(&font);
-       font.GetHeight(&height);
-       float fntheight = height.ascent+height.descent+height.leading;
+       owner->PushState();
 
        BRect bounds = list->ItemFrame(list->IndexOf(this));
 
@@ -116,9 +119,9 @@
        owner->SetHighColor( oldcolor );
 
        BPoint iconPt = bounds.LeftTop() + BPoint(4,4);
-       BPoint namePt = iconPt + BPoint(32+8, fntheight);
-       BPoint driverPt = iconPt + BPoint(32+8, fntheight*2);
-       BPoint commentPt = iconPt + BPoint(32+8, fntheight*3);
+       BPoint namePt = BPoint(32+12, fFirstlineOffset);
+       BPoint driverPt = BPoint(32+12, fSecondlineOffset);
+       BPoint commentPt = BPoint(32+12, fThirdlineOffset);
 
        drawing_mode mode = owner->DrawingMode();
        if (fSettings->IsDisabled()) {
@@ -151,6 +154,8 @@
 
        owner->SetHighColor(oldcolor);
        owner->SetDrawingMode(mode);
+
+       owner->PopState();
 }
 
 

Modified: 
haiku/trunk/src/tests/kits/net/preflet/InterfacesAddOn/InterfacesListView.h
===================================================================
--- haiku/trunk/src/tests/kits/net/preflet/InterfacesAddOn/InterfacesListView.h 
2011-01-28 19:34:37 UTC (rev 40310)
+++ haiku/trunk/src/tests/kits/net/preflet/InterfacesAddOn/InterfacesListView.h 
2011-01-28 20:21:06 UTC (rev 40311)
@@ -44,6 +44,10 @@
        BBitmap*                                fIcon;
        BNetworkInterface               fInterface;
        Settings*                               fSettings;
+       float                                   fFirstlineOffset;
+       float                                   fSecondlineOffset;
+       float                                   fThirdlineOffset;
+       float                                   fStateWidth;
 };
 
 

Modified: haiku/trunk/src/tests/kits/net/preflet/Jamfile
===================================================================
--- haiku/trunk/src/tests/kits/net/preflet/Jamfile      2011-01-28 19:34:37 UTC 
(rev 40310)
+++ haiku/trunk/src/tests/kits/net/preflet/Jamfile      2011-01-28 20:21:06 UTC 
(rev 40311)
@@ -1,11 +1,12 @@
 SubDir HAIKU_TOP src tests kits net preflet ;
 
-SimpleTest NetworkSetup :
+Preference NetworkSetup :
        NetworkSetup.cpp
        NetworkSetupWindow.cpp
        NetworkSetupProfile.cpp
        NetworkSetupAddOn.cpp
        : be root $(TARGET_LIBSTDC++) $(HAIKU_LOCALE_LIBS)
+       : NetworkSetup.rdef
 ;
 
 SubInclude HAIKU_TOP src tests kits net preflet InterfacesAddOn ;

Modified: haiku/trunk/src/tests/kits/net/preflet/NetworkSetup.cpp
===================================================================
--- haiku/trunk/src/tests/kits/net/preflet/NetworkSetup.cpp     2011-01-28 
19:34:37 UTC (rev 40310)
+++ haiku/trunk/src/tests/kits/net/preflet/NetworkSetup.cpp     2011-01-28 
20:21:06 UTC (rev 40311)
@@ -8,7 +8,7 @@
 
 
 #define SOFTWARE_EDITOR                        "Haiku"
-#define NAME                                   "NetworkSettings"
+#define NAME                                   "NetworkSetup"
 #define SOFTWARE_VERSION_LABEL "0.1.0 alpha"
 
 #define APPLICATION_SIGNATURE  "application/x-vnd." SOFTWARE_EDITOR "-" NAME

Modified: haiku/trunk/src/tests/kits/net/preflet/NetworkSetupWindow.cpp
===================================================================
--- haiku/trunk/src/tests/kits/net/preflet/NetworkSetupWindow.cpp       
2011-01-28 19:34:37 UTC (rev 40310)
+++ haiku/trunk/src/tests/kits/net/preflet/NetworkSetupWindow.cpp       
2011-01-28 20:21:06 UTC (rev 40311)
@@ -27,9 +27,6 @@
        BWindow(BRect(100, 100, 300, 300), title, B_TITLED_WINDOW,
                B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE | 
B_AUTO_UPDATE_SIZE_LIMITS)
 {
-       BBox *topDivider = new BBox(B_EMPTY_STRING);
-       topDivider->SetBorder(B_PLAIN_BORDER);
-
        // ---- Profiles section
        BMenu *profilesPopup = new BPopUpMenu("<none>");
        _BuildProfilesMenu(profilesPopup, SELECT_PROFILE_MSG);
@@ -74,7 +71,6 @@
                        .AddGlue()
                        .Add(button)
                .End()
-               .Add(topDivider)
                .Add(fPanel)
                .Add(bottomDivider)
                .AddGroup(B_HORIZONTAL, 5)
@@ -87,7 +83,6 @@
 
        _BuildShowTabView(SHOW_MSG);
 
-       topDivider->SetExplicitMaxSize(BSize(B_SIZE_UNSET, 1));
        bottomDivider->SetExplicitMaxSize(BSize(B_SIZE_UNSET, 1));
        fPanel->SetExplicitMinSize(BSize(fMinAddonViewRect.Width(),
                        fMinAddonViewRect.Height()));
@@ -119,10 +114,6 @@
        case NEW_PROFILE_MSG:
                break;
 
-       case DELETE_PROFILE_MSG: {
-               break;
-       }
-
        case SELECT_PROFILE_MSG: {
                BPath name;
                const char *path;
@@ -206,8 +197,6 @@
        menu->AddSeparatorItem();
        menu->AddItem(new BMenuItem(B_TRANSLATE("New" B_UTF8_ELLIPSIS),
                new BMessage(NEW_PROFILE_MSG)));
-       menu->AddItem(new BMenuItem(B_TRANSLATE("Delete"),
-               new BMessage(DELETE_PROFILE_MSG)));
 
        if (strlen(current_profile)) {
                item = menu->FindItem(current_profile);


Other related posts: