*Fixes ticket #4415.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35120 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
f0bddd1112
commit
deed298ba4
|
@ -94,11 +94,11 @@ InitializeBFSEditor::PartitionNameChanged(const char* name)
|
|||
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)",
|
||||
|
|
|
@ -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@gmx.de>
|
||||
* Bryce Groff <bgroff@hawaii.edu>
|
||||
* Karsten Heimrich. <host.haiku@gmx.de>
|
||||
*/
|
||||
|
||||
#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 @@ private:
|
|||
CreateParamsPanel* fPanel;
|
||||
};
|
||||
|
||||
|
||||
// #pragma mark -
|
||||
|
||||
|
||||
|
@ -149,10 +150,7 @@ CreateParamsPanel::Go(off_t& offset, off_t& size, BString& name,
|
|||
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 @@ CreateParamsPanel::_CreateViewControls(BPartition* parent, off_t offset,
|
|||
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 @@ CreateParamsPanel::_CreateViewControls(BPartition* parent, off_t offset,
|
|||
|
||||
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 @@ CreateParamsPanel::_CreateViewControls(BPartition* parent, off_t offset,
|
|||
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))
|
||||
|
||||
// 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);
|
||||
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);
|
||||
|
||||
AddToSubset(fWindow);
|
||||
layout->View()->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||
}
|
||||
|
|
|
@ -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 @@ public:
|
|||
private:
|
||||
void _CreateViewControls(BPartition* parent,
|
||||
off_t offset, off_t size);
|
||||
|
||||
|
||||
class EscapeFilter;
|
||||
EscapeFilter* fEscapeFilter;
|
||||
sem_id fExitSemaphore;
|
||||
|
@ -46,13 +45,11 @@ private:
|
|||
int32 fReturnValue;
|
||||
|
||||
BPartitionParameterEditor* fEditor;
|
||||
|
||||
|
||||
BPopUpMenu* fTypePopUpMenu;
|
||||
BMenuField* fTypeMenuField;
|
||||
BTextControl* fNameTextControl;
|
||||
SizeSlider* fSizeSlider;
|
||||
BButton* fOKButton;
|
||||
BButton* fCancelButton;
|
||||
};
|
||||
|
||||
#endif // CREATE_PARAMS_PANEL_H
|
||||
|
|
|
@ -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@gmx.de>
|
||||
* Karsten Heimrich. <host.haiku@gmx.de>
|
||||
*/
|
||||
|
||||
#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 @@ InitParamsPanel::InitParamsPanel(BWindow* window, const BString& diskSystem,
|
|||
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
|
||||
.Add(fEditor->View())
|
||||
|
||||
// controls
|
||||
.AddGroup(B_HORIZONTAL, 10)
|
||||
.Add(BSpaceLayoutItem::CreateHorizontalStrut(5))
|
||||
.AddGlue()
|
||||
.Add(cancelButton)
|
||||
.Add(okButton)
|
||||
.Add(BSpaceLayoutItem::CreateHorizontalStrut(5))
|
||||
.End()
|
||||
|
||||
.Add(BSpaceLayoutItem::CreateVerticalStrut(5))
|
||||
;
|
||||
|
||||
SetLayout(new BGroupLayout(B_HORIZONTAL));
|
||||
AddChild(rootView);
|
||||
const float spacing = be_control_look->DefaultItemSpacing();
|
||||
AddChild(BGroupLayoutBuilder(B_VERTICAL, spacing)
|
||||
.Add(fEditor->View())
|
||||
.AddGroup(B_HORIZONTAL, spacing)
|
||||
.AddGlue()
|
||||
.Add(new BButton("Cancel", new BMessage(MSG_CANCEL)))
|
||||
.Add(okButton)
|
||||
.End()
|
||||
.SetInsets(spacing, spacing, spacing, spacing)
|
||||
);
|
||||
|
||||
SetDefaultButton(okButton);
|
||||
|
||||
// If the partition had a previous name, set to that name.
|
||||
|
@ -168,10 +155,7 @@ InitParamsPanel::Go(BString& name, BString& parameters)
|
|||
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();
|
||||
|
|
Loading…
Reference in New Issue