Author: stippi Date: 2011-02-07 19:47:50 +0100 (Mon, 07 Feb 2011) New Revision: 40373 Changeset: http://dev.haiku-os.org/changeset/40373 Modified: haiku/trunk/src/preferences/filetypes/FileTypes.cpp haiku/trunk/src/preferences/filetypes/FileTypesWindow.cpp haiku/trunk/src/preferences/filetypes/FileTypesWindow.h Log: The left and right side of the FileTypes interface are now divided by a BSplitView. The layout weight is remembered in the settings. Modified: haiku/trunk/src/preferences/filetypes/FileTypes.cpp =================================================================== --- haiku/trunk/src/preferences/filetypes/FileTypes.cpp 2011-02-07 18:46:32 UTC (rev 40372) +++ haiku/trunk/src/preferences/filetypes/FileTypes.cpp 2011-02-07 18:47:50 UTC (rev 40373) @@ -122,6 +122,8 @@ fMessage.AddRect("app_types_frame", BRect(100.0f, 100.0f, 540.0f, 480.0f)); fMessage.AddBool("show_icons", true); fMessage.AddBool("show_rule", false); + fMessage.AddFloat("left_split_weight", 0.2); + fMessage.AddFloat("right_split_weight", 0.8); } @@ -156,6 +158,12 @@ if (message->FindBool("show_rule", &showRule) == B_OK) fMessage.ReplaceBool("show_rule", showRule); + float splitWeight; + if (message->FindFloat("left_split_weight", &splitWeight) == B_OK) + fMessage.ReplaceFloat("left_split_weight", splitWeight); + if (message->FindFloat("right_split_weight", &splitWeight) == B_OK) + fMessage.ReplaceFloat("right_split_weight", splitWeight); + fUpdated = true; } Modified: haiku/trunk/src/preferences/filetypes/FileTypesWindow.cpp =================================================================== --- haiku/trunk/src/preferences/filetypes/FileTypesWindow.cpp 2011-02-07 18:46:32 UTC (rev 40372) +++ haiku/trunk/src/preferences/filetypes/FileTypesWindow.cpp 2011-02-07 18:47:50 UTC (rev 40373) @@ -501,32 +501,45 @@ .SetInsets(padding, padding, padding, padding) .View()); + fMainSplitView = new BSplitView(B_HORIZONTAL, floorf(padding / 2)); + BLayoutBuilder::Group<>(this, B_VERTICAL, 0) .SetInsets(0, 0, 0, 0) .Add(menuBar) - .AddGroup(B_HORIZONTAL, padding) + .AddGroup(B_HORIZONTAL, 0) .SetInsets(padding, padding, padding, padding) - .AddGroup(B_VERTICAL, padding) - .Add(typeListScrollView) - .AddGroup(B_HORIZONTAL, padding) - .Add(addTypeButton) - .Add(fRemoveTypeButton) - .AddGlue() + .AddSplit(fMainSplitView) + .AddGroup(B_VERTICAL, padding) + .Add(typeListScrollView) + .AddGroup(B_HORIZONTAL, padding) + .Add(addTypeButton) + .Add(fRemoveTypeButton) + .AddGlue() + .End() .End() - .End() - // Right side - .AddGroup(B_VERTICAL, padding) - .AddGroup(B_HORIZONTAL, padding) - .Add(fIconBox, 1) - .Add(fRecognitionBox, 3) - .End() - .Add(fDescriptionBox) - .Add(fPreferredBox) - .Add(fAttributeBox, 5); + // Right side + .AddGroup(B_VERTICAL, padding) + .AddGroup(B_HORIZONTAL, padding) + .Add(fIconBox, 1) + .Add(fRecognitionBox, 3) + .End() + .Add(fDescriptionBox) + .Add(fPreferredBox) + .Add(fAttributeBox, 5); _SetType(NULL); _ShowSnifferRule(showRule); + float leftWeight; + float rightWeight; + if (settings.FindFloat("left_split_weight", &leftWeight) != B_OK + || settings.FindFloat("right_split_weight", &rightWeight) != B_OK) { + leftWeight = 0.2; + rightWeight = 1.0 - leftWeight; + } + fMainSplitView->SetItemWeight(0, leftWeight, false); + fMainSplitView->SetItemWeight(1, rightWeight, true); + BMimeType::StartWatching(this); } @@ -1055,8 +1068,9 @@ if (which == B_MIME_TYPE_DELETED || which == B_SUPPORTED_TYPES_CHANGED - || which == B_PREFERRED_APP_CHANGED) + || which == B_PREFERRED_APP_CHANGED) { _UpdatePreferredApps(&fCurrentType); + } } break; } @@ -1072,6 +1086,8 @@ { BMessage update(kMsgSettingsChanged); update.AddRect("file_types_frame", Frame()); + update.AddFloat("left_split_weight", fMainSplitView->ItemWeight(0L)); + update.AddFloat("right_split_weight", fMainSplitView->ItemWeight(1)); be_app_messenger.SendMessage(&update); be_app->PostMessage(kMsgTypesWindowClosed); Modified: haiku/trunk/src/preferences/filetypes/FileTypesWindow.h =================================================================== --- haiku/trunk/src/preferences/filetypes/FileTypesWindow.h 2011-02-07 18:46:32 UTC (rev 40372) +++ haiku/trunk/src/preferences/filetypes/FileTypesWindow.h 2011-02-07 18:47:50 UTC (rev 40373) @@ -16,6 +16,7 @@ class BMenuField; class BMimeType; class BOutlineListView; +class BSplitView; class BTextControl; class AttributeListView; @@ -47,6 +48,8 @@ private: BMimeType fCurrentType; + BSplitView* fMainSplitView; + MimeTypeListView* fTypeListView; BButton* fRemoveTypeButton;