Changeset 28708
- Timestamp:
- 11/20/08 19:17:59 (7 weeks ago)
- Location:
- haiku/trunk/src/preferences/appearance
- Files:
-
- 5 modified
-
APRView.cpp (modified) (5 diffs)
-
APRView.h (modified) (1 diff)
-
APRWindow.cpp (modified) (2 diffs)
-
AntialiasingSettingsView.cpp (modified) (2 diffs)
-
AntialiasingSettingsView.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
haiku/trunk/src/preferences/appearance/APRView.cpp
r28149 r28708 7 7 * Rene Gollent (rene@gollent.com) 8 8 */ 9 #include <OS.h> 9 #include "APRView.h" 10 11 #include <Alert.h> 10 12 #include <Directory.h> 11 #include <Alert.h>12 #include <Messenger.h>13 #include <storage/Path.h>14 13 #include <Entry.h> 15 14 #include <File.h> 15 #include <GroupLayoutBuilder.h> 16 #include <Messenger.h> 17 #include <Path.h> 18 #include <SpaceLayoutItem.h> 19 16 20 #include <stdio.h> 17 21 18 #include <InterfaceDefs.h>19 20 #include "APRView.h"21 22 #include "APRWindow.h" 22 23 #include "defs.h" … … 38 39 } 39 40 40 APRView::APRView(const BRect &frame, const char *name, int32 resize,int32 flags)41 : BView( frame,name,resize,flags),41 APRView::APRView(const char *name, uint32 flags) 42 : BView(name, flags), 42 43 fDefaultSet(ColorSet::DefaultColorSet()), 43 44 fDecorMenu(NULL) 44 45 { 45 46 SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); 46 47 BRect rect(Bounds().InsetByCopy(kBorderSpace,kBorderSpace));48 49 #ifdef HAIKU_TARGET_PLATFORM_HAIKU50 47 51 48 fDecorMenu = new BMenu("Window Style"); … … 58 55 continue; 59 56 fDecorMenu->AddItem(new BMenuItem(name.String(), 60 new BMessage(DECORATOR_CHANGED)));57 new BMessage(DECORATOR_CHANGED))); 61 58 } 62 59 63 BMenuField *field = new BMenuField(rect, "menufield", "Window Style", 64 fDecorMenu, B_FOLLOW_RIGHT | 65 B_FOLLOW_TOP); 66 AddChild(field); 67 field->SetDivider(be_plain_font->StringWidth("Window style: ") + 5); 68 field->ResizeToPreferred(); 69 field->MoveTo(Bounds().right - field->Bounds().Width(), 10); 70 rect = Bounds().InsetByCopy(10,10); 71 rect.OffsetTo(10, field->Frame().bottom + 10); 60 BMenuField *field = new BMenuField("Window Style", fDecorMenu); 61 // TODO: use this menu field. 72 62 } 73 63 BMenuItem *marked = fDecorMenu->ItemAt(BPrivate::get_decorator()); 74 64 if (marked) 75 65 marked->SetMarked(true); 76 else 77 { 66 else { 78 67 marked = fDecorMenu->FindItem("Default"); 79 68 if (marked) … … 81 70 } 82 71 83 #endif 84 85 // Set up list of color fAttributes 86 rect.right -= B_V_SCROLL_BAR_WIDTH; 87 rect.bottom = rect.top + 75; 88 fAttrList = new BListView(rect,"AttributeList", B_SINGLE_SELECTION_LIST, 89 B_FOLLOW_ALL_SIDES); 90 91 fScrollView = new BScrollView("ScrollView",fAttrList, B_FOLLOW_ALL_SIDES, 92 0, false, true); 93 AddChild(fScrollView); 72 // Set up list of color attributes 73 fAttrList = new BListView("AttributeList", B_SINGLE_SELECTION_LIST); 74 75 fScrollView = new BScrollView("ScrollView", fAttrList, 0, false, true); 94 76 fScrollView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); 95 77 96 fAttrList->SetSelectionMessage(new BMessage(ATTRIBUTE_CHOSEN));97 98 78 for (int32 i = 0; i < color_description_count(); i++) { 99 79 const ColorDescription& description = *get_color_description(i); … … 102 82 fAttrList->AddItem(new ColorWhichItem(text, which)); 103 83 } 104 105 rect = fScrollView->Frame(); 84 106 85 BRect wellrect(0, 0, 50, 50); 107 wellrect.OffsetBy(rect.left, rect.bottom + kBorderSpace); 108 fColorWell = new ColorWell(wellrect, new BMessage(COLOR_DROPPED), 109 B_FOLLOW_LEFT | B_FOLLOW_BOTTOM); 110 AddChild(fColorWell); 111 112 fPicker = new BColorControl(BPoint(wellrect.right + kBorderSpace, wellrect.top), 113 B_CELLS_32x8, 8.0, "fPicker", new BMessage(UPDATE_COLOR)); 114 fPicker->SetResizingMode(B_FOLLOW_LEFT | B_FOLLOW_BOTTOM); 115 AddChild(fPicker); 116 117 // bottom align ColorWell and ColorPicker 118 float bottom = Bounds().bottom - kBorderSpace; 119 float colorWellBottom = fColorWell->Frame().bottom; 120 float pickerBottom = fPicker->Frame().bottom; 121 float delta = bottom - max_c(colorWellBottom, pickerBottom); 122 fColorWell->MoveBy(0, delta); 123 fPicker->MoveBy(0, delta); 124 fScrollView->ResizeBy(0, delta); 125 // since this view is not attached to a window yet, 126 // we have to resize the fScrollView children too 127 fScrollView->ScrollBar(B_VERTICAL)->ResizeBy(0, delta); 128 fAttrList->ResizeBy(0, delta); 86 fColorWell = new ColorWell(wellrect, new BMessage(COLOR_DROPPED), 0); 87 fColorWell->SetExplicitAlignment(BAlignment(B_ALIGN_HORIZONTAL_CENTER, 88 B_ALIGN_BOTTOM)); 89 90 fPicker = new BColorControl(B_ORIGIN, B_CELLS_32x8, 8.0, 91 "picker", new BMessage(UPDATE_COLOR)); 92 93 SetLayout(new BGroupLayout(B_VERTICAL)); 94 95 // TODO: Make list view and scroller use all the additional height 96 // available! 97 AddChild(BGroupLayoutBuilder(B_VERTICAL, 0) 98 .Add(fScrollView) 99 .Add(BSpaceLayoutItem::CreateVerticalStrut(5)) 100 .Add(BGroupLayoutBuilder(B_HORIZONTAL) 101 .Add(fColorWell) 102 .Add(BSpaceLayoutItem::CreateHorizontalStrut(5)) 103 .Add(fPicker) 104 ) 105 .SetInsets(10, 10, 10, 10) 106 ); 107 108 fAttrList->SetSelectionMessage(new BMessage(ATTRIBUTE_CHOSEN)); 129 109 } 130 110 -
haiku/trunk/src/preferences/appearance/APRView.h
r27347 r28708 34 34 { 35 35 public: 36 APRView(const BRect &frame, const char *name, int32 resize, 37 int32 flags); 36 APRView(const char *name, uint32 flags); 38 37 ~APRView(void); 39 38 void AttachedToWindow(void); -
haiku/trunk/src/preferences/appearance/APRWindow.cpp
r27652 r28708 6 6 * DarkWyrm (darkwyrm@earthlink.net) 7 7 */ 8 #include "APRWindow.h" 8 9 9 10 #include <Button.h> 11 #include <GroupLayoutBuilder.h> 10 12 #include <Messenger.h> 13 #include <SpaceLayoutItem.h> 11 14 #include <TabView.h> 12 #include "APRWindow.h" 15 13 16 #include "APRView.h" 14 17 #include "defs.h" … … 18 21 19 22 APRWindow::APRWindow(BRect frame) 20 : BWindow(frame, "Appearance", B_TITLED_WINDOW, B_NOT_ZOOMABLE, 21 B_ALL_WORKSPACES) 23 : BWindow(frame, "Appearance", B_TITLED_WINDOW, 24 B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS, 25 B_ALL_WORKSPACES) 22 26 { 23 BRect rect = Bounds(); 24 BView* view = new BView(rect, "background", B_FOLLOW_ALL, B_WILL_DRAW); 25 view->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); 26 AddChild(view); 27 SetLayout(new BGroupLayout(B_HORIZONTAL)); 27 28 28 rect.left = 10; 29 rect.top = rect.bottom - 10; 30 fDefaultsButton = new BButton(rect, "defaults", "Defaults", 31 new BMessage(kMsgSetDefaults), B_FOLLOW_LEFT 32 | B_FOLLOW_BOTTOM, B_WILL_DRAW); 33 fDefaultsButton->ResizeToPreferred(); 34 fDefaultsButton->SetEnabled(false); 35 float buttonHeight = fDefaultsButton->Bounds().Height(); 36 fDefaultsButton->MoveBy(0, -buttonHeight); 37 view->AddChild(fDefaultsButton); 29 fDefaultsButton = new BButton("defaults", "Defaults", 30 new BMessage(kMsgSetDefaults), B_WILL_DRAW); 38 31 39 rect = fDefaultsButton->Frame();40 rect.OffsetBy(fDefaultsButton->Bounds().Width() + 10, 0);32 fRevertButton = new BButton("revert", "Revert", 33 new BMessage(kMsgRevert), B_WILL_DRAW); 41 34 42 fRevertButton = new BButton(rect, "revert", "Revert", 43 new BMessage(kMsgRevert), B_FOLLOW_LEFT | B_FOLLOW_BOTTOM, B_WILL_DRAW); 44 fRevertButton->ResizeToPreferred(); 45 fRevertButton->SetEnabled(false); 46 view->AddChild(fRevertButton); 35 BTabView* tabView = new BTabView("tabview", B_WIDTH_FROM_LABEL); 47 36 48 rect = Bounds(); 49 rect.top += 5; 50 rect.bottom -= 20 + buttonHeight; 51 rect.left += 5; 52 BTabView *tabView = new BTabView(rect, "tabview", B_WIDTH_FROM_LABEL); 53 54 rect = tabView->ContainerView()->Bounds().InsetByCopy(5, 8); 55 56 fAntialiasingSettings = new AntialiasingSettingsView(rect, "Antialiasing"); 57 fColorsView = new APRView(rect, "Colors", B_FOLLOW_ALL, B_WILL_DRAW); 37 fAntialiasingSettings = new AntialiasingSettingsView("Antialiasing"); 38 fColorsView = new APRView("Colors", B_WILL_DRAW); 58 39 59 40 tabView->AddTab(fColorsView); 60 41 tabView->AddTab(fAntialiasingSettings); 61 42 62 view->AddChild(tabView);63 fColorsView->ResizeToPreferred();64 fAntialiasingSettings->ResizeToPreferred();65 66 43 fDefaultsButton->SetEnabled(fColorsView->IsDefaultable() 67 44 || fAntialiasingSettings->IsDefaultable()); 68 fDefaultsButton->SetTarget(this); 69 fRevertButton->SetTarget(this); 45 fRevertButton->SetEnabled(false); 46 47 AddChild(BGroupLayoutBuilder(B_VERTICAL, 0) 48 .Add(tabView) 49 .Add(BSpaceLayoutItem::CreateVerticalStrut(5)) 50 .Add(BGroupLayoutBuilder(B_HORIZONTAL) 51 .Add(fRevertButton) 52 .AddGlue() 53 .Add(fDefaultsButton) 54 ) 55 .SetInsets(5, 5, 5, 5) 56 ); 70 57 } 71 58 -
haiku/trunk/src/preferences/appearance/AntialiasingSettingsView.cpp
r27653 r28708 54 54 55 55 56 AntialiasingSettingsView::AntialiasingSettingsView( BRect rect,const char* name)57 : BView( rect, name, B_FOLLOW_ALL, B_SUPPORTS_LAYOUT)56 AntialiasingSettingsView::AntialiasingSettingsView(const char* name) 57 : BView(name, 0) 58 58 { 59 59 // collect the current system settings … … 142 142 _SetCurrentHinting(); 143 143 _SetCurrentAverageWeight(); 144 145 // TODO: Remove once these two lines once the entire window uses146 // layout management.147 MoveTo(rect.LeftTop());148 ResizeTo(rect.Width(), rect.Height());149 144 } 150 145 -
haiku/trunk/src/preferences/appearance/AntialiasingSettingsView.h
r27634 r28708 17 17 class AntialiasingSettingsView : public BView { 18 18 public: 19 AntialiasingSettingsView(BRect rect, 20 const char* name); 19 AntialiasingSettingsView(const char* name); 21 20 virtual ~AntialiasingSettingsView(); 22 21
