[haiku-commits] r35120 - in haiku/trunk/src: add-ons/disk_systems/bfs apps/drivesetup

  • From: host.haiku@xxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sun, 17 Jan 2010 17:45:44 +0100 (CET)

Author: julun
Date: 2010-01-17 17:45:43 +0100 (Sun, 17 Jan 2010)
New Revision: 35120
Changeset: http://dev.haiku-os.org/changeset/35120/haiku
Ticket: http://dev.haiku-os.org/ticket/4415

Modified:
   haiku/trunk/src/add-ons/disk_systems/bfs/InitializeParameterEditor.cpp
   haiku/trunk/src/apps/drivesetup/CreateParamsPanel.cpp
   haiku/trunk/src/apps/drivesetup/CreateParamsPanel.h
   haiku/trunk/src/apps/drivesetup/InitParamsPanel.cpp
Log:
*Fixes ticket #4415.


Modified: haiku/trunk/src/add-ons/disk_systems/bfs/InitializeParameterEditor.cpp
===================================================================
--- haiku/trunk/src/add-ons/disk_systems/bfs/InitializeParameterEditor.cpp      
2010-01-17 16:43:03 UTC (rev 35119)
+++ haiku/trunk/src/add-ons/disk_systems/bfs/InitializeParameterEditor.cpp      
2010-01-17 16:45:43 UTC (rev 35120)
@@ -94,11 +94,11 @@
 void
 InitializeBFSEditor::_CreateViewControls()
 {
-       fNameTC = new BTextControl("Name", "Haiku", NULL);
+       fNameTC = new BTextControl("Name:", "Haiku", NULL);
        // TODO find out what is the max length for this specific FS partition 
name
        fNameTC->TextView()->SetMaxBytes(31);
 
-       BPopUpMenu* blocksizeMenu = new BPopUpMenu("Blocksize");
+       BPopUpMenu* blocksizeMenu = new BPopUpMenu("Blocksize:");
        BMessage* message = new BMessage(MSG_BLOCK_SIZE);
        message->AddString("size", "1024");
        blocksizeMenu->AddItem(new BMenuItem("1024 (Mostly small files)",

Modified: haiku/trunk/src/apps/drivesetup/CreateParamsPanel.cpp
===================================================================
--- haiku/trunk/src/apps/drivesetup/CreateParamsPanel.cpp       2010-01-17 
16:43:03 UTC (rev 35119)
+++ haiku/trunk/src/apps/drivesetup/CreateParamsPanel.cpp       2010-01-17 
16:45:43 UTC (rev 35120)
@@ -1,20 +1,22 @@
 /*
- * Copyright 2008-2009 Haiku Inc. All rights reserved.
+ * Copyright 2008-20010 Haiku Inc. All rights reserved.
  * Distributed under the terms of the MIT license.
  *
  * Authors:
  *             Stephan Aßmus <superstippi@xxxxxx>
  *             Bryce Groff       <bgroff@xxxxxxxxxx>
+ *             Karsten Heimrich. <host.haiku@xxxxxx>
  */
 
 #include "CreateParamsPanel.h"
 #include "Support.h"
 
-#include <Box.h>
 #include <Button.h>
+#include <ControlLook.h>
 #include <DiskDeviceTypes.h>
+#include <GridLayoutBuilder.h>
+#include <GroupLayout.h>
 #include <GroupLayoutBuilder.h>
-#include <GroupView.h>
 #include <MenuField.h>
 #include <MenuItem.h>
 #include <Message.h>
@@ -22,8 +24,6 @@
 #include <PopUpMenu.h>
 #include <PartitionParameterEditor.h>
 #include <Partition.h>
-#include <Slider.h>
-#include <SpaceLayoutItem.h>
 #include <String.h>
 
 
@@ -64,6 +64,7 @@
        CreateParamsPanel*              fPanel;
 };
 
+
 // #pragma mark -
 
 
@@ -149,10 +150,7 @@
                return GO_CANCELED;
 
        // center the panel above the parent window
-       BRect frame = Frame();
-       BRect parentFrame = fWindow->Frame();
-       MoveTo((parentFrame.left + parentFrame.right - frame.Width()) / 2.0,
-               (parentFrame.top + parentFrame.bottom - frame.Height()) / 2.0);
+       CenterIn(fWindow->Frame());
 
        Show();
        Unlock();
@@ -222,7 +220,7 @@
                offset + size);
        fSizeSlider->SetPosition(1.0);
 
-       fNameTextControl = new BTextControl("Name Control", "Partition name",
+       fNameTextControl = new BTextControl("Name Control", "Partition name:",
                "", NULL);
        if (!parent->SupportsChildName())
                fNameTextControl->SetEnabled(false);
@@ -231,8 +229,7 @@
 
        int32 cookie = 0;
        BString supportedType;
-       while (parent->GetNextSupportedChildType(&cookie, &supportedType)
-               == B_OK) {
+       while (parent->GetNextSupportedChildType(&cookie, &supportedType) == 
B_OK) {
                BMessage* message = new BMessage(MSG_PARTITION_TYPE);
                message->AddString("type", supportedType);
                BMenuItem* item = new BMenuItem(supportedType, message);
@@ -242,70 +239,36 @@
                        item->SetMarked(true);
        }
 
-       fTypeMenuField = new BMenuField("Partition type", fTypePopUpMenu, NULL);
+       fTypeMenuField = new BMenuField("Partition type:", fTypePopUpMenu, 
NULL);
 
-       fOKButton = new BButton("Create", new BMessage(MSG_OK));
-       fCancelButton = new BButton("Cancel", new BMessage(MSG_CANCEL));
+       const float spacing = be_control_look->DefaultItemSpacing();
+       BGroupLayout* layout = new BGroupLayout(B_VERTICAL, spacing);
+       layout->SetInsets(spacing, spacing, spacing, spacing);
 
-       BView* infoView = BGroupLayoutBuilder(B_VERTICAL, 3)
+       SetLayout(layout);
+
+       AddChild(BGroupLayoutBuilder(B_VERTICAL, spacing)
                .Add(fSizeSlider)
-               .Add(fNameTextControl)
-               .Add(fTypeMenuField)
-       ;
-       BBox* infoBox = new BBox(B_FANCY_BORDER, infoView);
-       BView* rootView;
+               .Add(BGridLayoutBuilder(0.0, 5.0)
+                       .Add(fNameTextControl->CreateLabelLayoutItem(), 0, 0)
+                       .Add(fNameTextControl->CreateTextViewLayoutItem(), 1, 0)
+                       .Add(fTypeMenuField->CreateLabelLayoutItem(), 0, 1)
+                       .Add(fTypeMenuField->CreateMenuBarLayoutItem(), 1, 1)
+               )
+       );
 
        parent->GetChildCreationParameterEditor(NULL, &fEditor);
-       if (fEditor != NULL) {
-               BBox* parameterBox = new BBox(B_FANCY_BORDER, fEditor->View());
+       if (fEditor)
+               AddChild(fEditor->View());
 
-               rootView = BGroupLayoutBuilder(B_VERTICAL, 4)
-                       .Add(BSpaceLayoutItem::CreateVerticalStrut(5))
+       BButton* okButton = new BButton("Create", new BMessage(MSG_OK));
+       AddChild(BGroupLayoutBuilder(B_HORIZONTAL, spacing)
+               .AddGlue()
+               .Add(new BButton("Cancel", new BMessage(MSG_CANCEL)))
+               .Add(okButton)
+       );
+       SetDefaultButton(okButton);
 
-                       // slider and types
-                       .Add(infoBox)
-
-                       .Add(BSpaceLayoutItem::CreateVerticalStrut(10))
-
-                       // editor's view
-                       .Add(parameterBox)
-
-                       // controls
-                       .AddGroup(B_HORIZONTAL, 10)
-                               .Add(BSpaceLayoutItem::CreateHorizontalStrut(5))
-                               .AddGlue()
-                               .Add(fCancelButton)
-                               .Add(fOKButton)
-                               .Add(BSpaceLayoutItem::CreateHorizontalStrut(5))
-                       .End()
-
-                       .Add(BSpaceLayoutItem::CreateVerticalStrut(5))
-               ;
-       } else {
-               rootView = BGroupLayoutBuilder(B_VERTICAL, 4)
-                       .Add(BSpaceLayoutItem::CreateVerticalStrut(5))
-
-                       // slider and types
-                       .Add(infoBox)
-
-                       .Add(BSpaceLayoutItem::CreateVerticalStrut(10))
-
-                       // controls
-                       .AddGroup(B_HORIZONTAL, 10)
-                               .Add(BSpaceLayoutItem::CreateHorizontalStrut(5))
-                               .AddGlue()
-                               .Add(fCancelButton)
-                               .Add(fOKButton)
-                               .Add(BSpaceLayoutItem::CreateHorizontalStrut(5))
-                       .End()
-
-                       .Add(BSpaceLayoutItem::CreateVerticalStrut(5))
-               ;
-       }
-
-       SetLayout(new BGroupLayout(B_HORIZONTAL));
-       AddChild(rootView);
-       SetDefaultButton(fOKButton);
-
        AddToSubset(fWindow);
+       layout->View()->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
 }

Modified: haiku/trunk/src/apps/drivesetup/CreateParamsPanel.h
===================================================================
--- haiku/trunk/src/apps/drivesetup/CreateParamsPanel.h 2010-01-17 16:43:03 UTC 
(rev 35119)
+++ haiku/trunk/src/apps/drivesetup/CreateParamsPanel.h 2010-01-17 16:45:43 UTC 
(rev 35120)
@@ -9,7 +9,6 @@
 #ifndef CREATE_PARAMS_PANEL_H
 #define CREATE_PARAMS_PANEL_H
 
-#include "Support.h"
 
 #include <Window.h>
 #include <InterfaceKit.h>
@@ -38,7 +37,7 @@
 private:
                        void                            
_CreateViewControls(BPartition* parent,
                                                                        off_t 
offset, off_t size);
-                       
+
        class EscapeFilter;
                        EscapeFilter*           fEscapeFilter;
                        sem_id                          fExitSemaphore;
@@ -46,13 +45,11 @@
                        int32                           fReturnValue;
 
                        BPartitionParameterEditor*      fEditor;
-                       
+
                        BPopUpMenu*                     fTypePopUpMenu;
                        BMenuField*                     fTypeMenuField;
                        BTextControl*           fNameTextControl;
                        SizeSlider*                     fSizeSlider;
-                       BButton*                        fOKButton;
-                       BButton*                        fCancelButton;
 };
 
 #endif // CREATE_PARAMS_PANEL_H

Modified: haiku/trunk/src/apps/drivesetup/InitParamsPanel.cpp
===================================================================
--- haiku/trunk/src/apps/drivesetup/InitParamsPanel.cpp 2010-01-17 16:43:03 UTC 
(rev 35119)
+++ haiku/trunk/src/apps/drivesetup/InitParamsPanel.cpp 2010-01-17 16:45:43 UTC 
(rev 35120)
@@ -1,9 +1,10 @@
 /*
- * Copyright 2008-2009 Haiku Inc. All rights reserved.
+ * Copyright 2008-2010 Haiku Inc. All rights reserved.
  * Distributed under the terms of the MIT license.
  *
  * Authors:
  *             Stephan Aßmus <superstippi@xxxxxx>
+*              Karsten Heimrich. <host.haiku@xxxxxx>
  */
 
 #include "InitParamsPanel.h"
@@ -12,16 +13,11 @@
 #include <stdio.h>
 
 #include <Button.h>
-#include <GridLayoutBuilder.h>
+#include <ControlLook.h>
+#include <GroupLayout.h>
 #include <GroupLayoutBuilder.h>
-#include <GroupView.h>
-#include <MenuField.h>
-#include <MenuItem.h>
 #include <Message.h>
 #include <MessageFilter.h>
-#include <PopUpMenu.h>
-#include <TextControl.h>
-#include <SpaceLayoutItem.h>
 #include <String.h>
 
 
@@ -86,31 +82,22 @@
        AddCommonFilter(fEscapeFilter);
 
        BButton* okButton = new BButton("Initialize", new BMessage(MSG_OK));
-       BButton* cancelButton = new BButton("Cancel", new BMessage(MSG_CANCEL));
 
        partition->GetInitializationParameterEditor(diskSystem.String(),
                &fEditor);
 
-       BView* rootView = BGroupLayoutBuilder(B_VERTICAL, 5)
-               .Add(BSpaceLayoutItem::CreateVerticalStrut(10))
-
-               // test views
+       SetLayout(new BGroupLayout(B_HORIZONTAL));
+       const float spacing = be_control_look->DefaultItemSpacing();
+       AddChild(BGroupLayoutBuilder(B_VERTICAL, spacing)
                .Add(fEditor->View())
-
-               // controls
-               .AddGroup(B_HORIZONTAL, 10)
-                       .Add(BSpaceLayoutItem::CreateHorizontalStrut(5))
+               .AddGroup(B_HORIZONTAL, spacing)
                        .AddGlue()
-                       .Add(cancelButton)
+                       .Add(new BButton("Cancel", new BMessage(MSG_CANCEL)))
                        .Add(okButton)
-                       .Add(BSpaceLayoutItem::CreateHorizontalStrut(5))
                .End()
+               .SetInsets(spacing, spacing, spacing, spacing)
+       );
 
-               .Add(BSpaceLayoutItem::CreateVerticalStrut(5))
-       ;
-
-       SetLayout(new BGroupLayout(B_HORIZONTAL));
-       AddChild(rootView);
        SetDefaultButton(okButton);
 
        // If the partition had a previous name, set to that name.
@@ -168,10 +155,7 @@
                return GO_CANCELED;
 
        // center the panel above the parent window
-       BRect frame = Frame();
-       BRect parentFrame = fWindow->Frame();
-       MoveTo((parentFrame.left + parentFrame.right - frame.Width()) / 2.0,
-               (parentFrame.top + parentFrame.bottom - frame.Height()) / 2.0);
+       CenterIn(fWindow->Frame());
 
        Show();
        Unlock();


Other related posts:

  • » [haiku-commits] r35120 - in haiku/trunk/src: add-ons/disk_systems/bfs apps/drivesetup - host . haiku