hrev44246 adds 2 changesets to branch 'master' old head: 21c0a9529b2d28ae1971ee8c9d99cb5532f28589 new head: 7b2ba073264ddfbc7d59d988120a320d22272963 ---------------------------------------------------------------------------- 2ffea8e: Minor cleanup, no functional change. 7b2ba07: The size control now actually sets the size instead of the offset. * SizeSlider::MaxPartitionSize() also now returns the size instead of the end offset. * Renamed CreateParamsPanel::_UpdateTextControl() to _UpdateSizeTextControl(). * Removed code duplication, and instead just call _UpdateSizeTextControl() twice. * Minor other cleanup. [ Axel Dörfler <axeld@xxxxxxxxxxxxxxxx> ] ---------------------------------------------------------------------------- 6 files changed, 49 insertions(+), 40 deletions(-) .../disk_systems/intel/CreationParameterEditor.cpp | 17 +++--- .../disk_systems/intel/CreationParameterEditor.h | 2 +- .../disk_systems/intel/PartitionMapAddOn.cpp | 4 +- src/apps/drivesetup/CreateParamsPanel.cpp | 50 ++++++++-------- src/apps/drivesetup/CreateParamsPanel.h | 11 +++- src/apps/drivesetup/Support.cpp | 5 +- ############################################################################ Commit: 2ffea8e8a397928e323dd48d9fb244a77ffbfbe2 URL: http://cgit.haiku-os.org/haiku/commit/?id=2ffea8e Author: Axel Dörfler <axeld@xxxxxxxxxxxxxxxx> Date: Sun Jun 17 17:56:56 2012 UTC Minor cleanup, no functional change. ---------------------------------------------------------------------------- diff --git a/src/add-ons/disk_systems/intel/CreationParameterEditor.cpp b/src/add-ons/disk_systems/intel/CreationParameterEditor.cpp index 8d0c963..881a6e0 100644 --- a/src/add-ons/disk_systems/intel/CreationParameterEditor.cpp +++ b/src/add-ons/disk_systems/intel/CreationParameterEditor.cpp @@ -18,14 +18,12 @@ PrimaryPartitionEditor::PrimaryPartitionEditor() : - BPartitionParameterEditor(), - fView(NULL), - fActiveCB(NULL), fParameters(NULL) { - fActiveCB = new BCheckBox("active", B_TRANSLATE("Active partition"), NULL); + fActiveCheckBox = new BCheckBox("active", B_TRANSLATE("Active partition"), + NULL); fView = new BGroupView(B_VERTICAL); - fView->AddChild(fActiveCB); + fView->AddChild(fActiveCheckBox); } @@ -44,12 +42,13 @@ PrimaryPartitionEditor::View() bool PrimaryPartitionEditor::FinishedEditing() { - if (fActiveCB->IsEnabled()) { - if (fActiveCB->Value() == B_CONTROL_ON) + if (fActiveCheckBox->IsEnabled()) { + if (fActiveCheckBox->Value() == B_CONTROL_ON) fParameters.SetTo("active true ;"); else fParameters.SetTo("active false ;"); - } else fParameters.SetTo(""); + } else + fParameters.SetTo(""); return true; } @@ -69,6 +68,6 @@ PrimaryPartitionEditor::GetParameters(BString* parameters) status_t PrimaryPartitionEditor::PartitionTypeChanged(const char* type) { - fActiveCB->SetEnabled(strcmp(type, kPartitionTypeIntelExtended) != 0); + fActiveCheckBox->SetEnabled(strcmp(type, kPartitionTypeIntelExtended) != 0); return B_OK; } diff --git a/src/add-ons/disk_systems/intel/CreationParameterEditor.h b/src/add-ons/disk_systems/intel/CreationParameterEditor.h index b31dc57..ff2374d 100644 --- a/src/add-ons/disk_systems/intel/CreationParameterEditor.h +++ b/src/add-ons/disk_systems/intel/CreationParameterEditor.h @@ -26,7 +26,7 @@ public: private: BView* fView; - BCheckBox* fActiveCB; + BCheckBox* fActiveCheckBox; BString fParameters; }; diff --git a/src/add-ons/disk_systems/intel/PartitionMapAddOn.cpp b/src/add-ons/disk_systems/intel/PartitionMapAddOn.cpp index 4840af1..4dc6b2a 100644 --- a/src/add-ons/disk_systems/intel/PartitionMapAddOn.cpp +++ b/src/add-ons/disk_systems/intel/PartitionMapAddOn.cpp @@ -327,8 +327,10 @@ PartitionMapHandle::ValidateCreateChild(off_t* _offset, off_t* _size, if (!type.SetType(typeString) || type.IsEmpty()) return B_BAD_VALUE; - if (type.IsExtended() && fPartitionMap.ExtendedPartitionIndex() >= 0) + if (type.IsExtended() && fPartitionMap.ExtendedPartitionIndex() >= 0) { + // There can only be a single extended partition return B_BAD_VALUE; + } // check name if (name) ############################################################################ Revision: hrev44246 Commit: 7b2ba073264ddfbc7d59d988120a320d22272963 URL: http://cgit.haiku-os.org/haiku/commit/?id=7b2ba07 Author: Axel Dörfler <axeld@xxxxxxxxxxxxxxxx> Date: Sun Jun 17 18:01:42 2012 UTC The size control now actually sets the size instead of the offset. * SizeSlider::MaxPartitionSize() also now returns the size instead of the end offset. * Renamed CreateParamsPanel::_UpdateTextControl() to _UpdateSizeTextControl(). * Removed code duplication, and instead just call _UpdateSizeTextControl() twice. * Minor other cleanup. ---------------------------------------------------------------------------- diff --git a/src/apps/drivesetup/CreateParamsPanel.cpp b/src/apps/drivesetup/CreateParamsPanel.cpp index 337b0b5..deeee12 100644 --- a/src/apps/drivesetup/CreateParamsPanel.cpp +++ b/src/apps/drivesetup/CreateParamsPanel.cpp @@ -1,15 +1,15 @@ /* - * Copyright 2008-20011 Haiku Inc. All rights reserved. + * Copyright 2008-2012 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> + * Bryce Groff <bgroff@xxxxxxxxxx> + * Karsten Heimrich <host.haiku@xxxxxx> */ + #include "CreateParamsPanel.h" -#include "Support.h" #include <Button.h> #include <Catalog.h> @@ -28,6 +28,8 @@ #include <Partition.h> #include <String.h> +#include "Support.h" + #undef B_TRANSLATION_CONTEXT #define B_TRANSLATION_CONTEXT "CreateParamsPanel" @@ -36,7 +38,8 @@ class CreateParamsPanel::EscapeFilter : public BMessageFilter { public: EscapeFilter(CreateParamsPanel* target) - : BMessageFilter(B_ANY_DELIVERY, B_ANY_SOURCE), + : + BMessageFilter(B_ANY_DELIVERY, B_ANY_SOURCE), fPanel(target) { } @@ -85,7 +88,8 @@ enum { CreateParamsPanel::CreateParamsPanel(BWindow* window, BPartition* partition, off_t offset, off_t size) - : BWindow(BRect(300.0, 200.0, 600.0, 300.0), 0, B_MODAL_WINDOW_LOOK, + : + BWindow(BRect(300.0, 200.0, 600.0, 300.0), 0, B_MODAL_WINDOW_LOOK, B_MODAL_SUBSET_WINDOW_FEEL, B_ASYNCHRONOUS_CONTROLS | B_AUTO_UPDATE_SIZE_LIMITS), fEscapeFilter(new EscapeFilter(this)), @@ -140,20 +144,18 @@ CreateParamsPanel::MessageReceived(BMessage* message) fEditor->PartitionTypeChanged(type); } break; - + case MSG_SIZE_SLIDER: - _UpdateTextControl(); + _UpdateSizeTextControl(); break; - + case MSG_SIZE_TEXTCONTROL: { - BString sizeString; - sizeString = fSizeTextControl->Text(); - int32 sizeInt = atoi(sizeString.String()); - if (sizeInt >= 0 && sizeInt <= fSizeSlider->MaxPartitionSize()) - fSizeSlider->SetValue(sizeInt); + int32 size = atoi(fSizeTextControl->Text()); + if (size >= 0 && size <= fSizeSlider->MaxPartitionSize()) + fSizeSlider->SetValue(size + fSizeSlider->Offset()); else - _UpdateTextControl(); + _UpdateSizeTextControl(); break; } @@ -244,16 +246,15 @@ CreateParamsPanel::_CreateViewControls(BPartition* parent, off_t offset, offset, offset + size); fSizeSlider->SetPosition(1.0); fSizeSlider->SetModificationMessage(new BMessage(MSG_SIZE_SLIDER)); - - BString sizeText; - sizeText << fSizeSlider->Value(); - fSizeTextControl = new BTextControl("Size Control", - "", sizeText.String(), NULL); + + fSizeTextControl = new BTextControl("Size Control", "", "", NULL); for(int32 i = 0; i < 256; i++) fSizeTextControl->TextView()->DisallowChar(i); for(int32 i = '0'; i <= '9'; i++) fSizeTextControl->TextView()->AllowChar(i); - fSizeTextControl->SetModificationMessage(new BMessage(MSG_SIZE_TEXTCONTROL)); + _UpdateSizeTextControl(); + fSizeTextControl->SetModificationMessage( + new BMessage(MSG_SIZE_TEXTCONTROL)); fNameTextControl = new BTextControl("Name Control", B_TRANSLATE("Partition name:"), "", NULL); @@ -295,7 +296,8 @@ CreateParamsPanel::_CreateViewControls(BPartition* parent, off_t offset, ) ); - status_t err = parent->GetParameterEditor(B_CREATE_PARAMETER_EDITOR, &fEditor); + status_t err = parent->GetParameterEditor(B_CREATE_PARAMETER_EDITOR, + &fEditor); if (err == B_OK && fEditor != NULL) AddChild(fEditor->View()); else @@ -316,9 +318,9 @@ CreateParamsPanel::_CreateViewControls(BPartition* parent, off_t offset, void -CreateParamsPanel::_UpdateTextControl() +CreateParamsPanel::_UpdateSizeTextControl() { BString sizeString; - sizeString << fSizeSlider->Value(); + sizeString << fSizeSlider->Value() - fSizeSlider->Offset(); fSizeTextControl->SetText(sizeString.String()); } diff --git a/src/apps/drivesetup/CreateParamsPanel.h b/src/apps/drivesetup/CreateParamsPanel.h index 3896c0f..eef3cc2 100644 --- a/src/apps/drivesetup/CreateParamsPanel.h +++ b/src/apps/drivesetup/CreateParamsPanel.h @@ -1,5 +1,5 @@ /* - * Copyright 2008 Haiku Inc. All rights reserved. + * Copyright 2008-2012 Haiku Inc. All rights reserved. * Distributed under the terms of the MIT license. * * Authors: @@ -15,13 +15,15 @@ #include <PartitionParameterEditor.h> #include <Partition.h> + class BMenuField; class BTextControl; class SizeSlider; + class CreateParamsPanel : public BWindow { public: - CreateParamsPanel(BWindow* window, + CreateParamsPanel(BWindow* window, BPartition* parent, off_t offset, off_t size); virtual ~CreateParamsPanel(); @@ -38,9 +40,11 @@ private: void _CreateViewControls(BPartition* parent, off_t offset, off_t size); - void _UpdateTextControl(); + void _UpdateSizeTextControl(); +private: class EscapeFilter; + EscapeFilter* fEscapeFilter; sem_id fExitSemaphore; BWindow* fWindow; @@ -55,4 +59,5 @@ private: BTextControl* fSizeTextControl; }; + #endif // CREATE_PARAMS_PANEL_H diff --git a/src/apps/drivesetup/Support.cpp b/src/apps/drivesetup/Support.cpp index 23e19ac..3b4f45b 100644 --- a/src/apps/drivesetup/Support.cpp +++ b/src/apps/drivesetup/Support.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 Haiku Inc. All rights reserved. + * Copyright 2002-2012 Haiku Inc. All rights reserved. * Distributed under the terms of the MIT license. * * Authors: @@ -9,6 +9,7 @@ * Bryce Groff <bgroff@xxxxxxxxxx> */ + #include "Support.h" #include <stdio.h> @@ -100,7 +101,7 @@ SizeSlider::SizeSlider(const char* name, const char* label, B_HORIZONTAL, B_TRIANGLE_THUMB), fStartOffset(minValue), fEndOffset(maxValue), - fMaxPartitionSize(maxValue) + fMaxPartitionSize(maxValue - minValue) { rgb_color fillColor = ui_color(B_CONTROL_HIGHLIGHT_COLOR); UseFillColor(true, &fillColor);