Ticket #190: diff.2.txt

File diff.2.txt, 27.6 KB (added by jalopeura, 10 years ago)

Incomplete Patch

Line 
1Index: ../../../src/preferences/media/MediaViews.h
2===================================================================
3--- ../../../src/preferences/media/MediaViews.h (revision 30132)
4+++ ../../../src/preferences/media/MediaViews.h (working copy)
5@@ -30,7 +30,8 @@
6 class BarView : public BView
7 {
8    public:
9-       BarView(BRect frame);
10+       //BarView(BRect frame);
11+       BarView();
12        virtual void    Draw(BRect updateRect);
13        bool    fDisplay;
14 };
15@@ -58,7 +59,8 @@
16 class SettingsView : public BView
17 {
18    public:
19-       SettingsView(BRect frame, bool isVideo);
20+       //SettingsView(BRect frame, bool isVideo);
21+       SettingsView(bool isVideo);
22        void AddNodes(BList &list, bool isInput);
23        void SetDefault(dormant_node_info &info, bool isInput, int32 outputID = -1);
24        BCheckBox       *fRealtimeCheckBox;
25Index: ../../../src/preferences/media/MediaWindow.cpp
26===================================================================
27--- ../../../src/preferences/media/MediaWindow.cpp  (revision 30132)
28+++ ../../../src/preferences/media/MediaWindow.cpp  (working copy)
29@@ -193,38 +193,51 @@
30    BRect barRect(titleRect.left, titleRect.bottom + 10,
31        titleRect.right - 2, titleRect.bottom + 11);
32 
33-   fListView = new BListView(menuRect, "media_list_view",
34-       B_SINGLE_SELECTION_LIST, B_FOLLOW_ALL_SIDES);
35+   //fListView = new BListView(menuRect, "media_list_view",
36+   //  B_SINGLE_SELECTION_LIST, B_FOLLOW_ALL_SIDES);
37+   fListView = new BListView("media_list_view",
38+       B_SINGLE_SELECTION_LIST);
39    fListView->SetSelectionMessage(new BMessage(ML_SELECTED_NODE));
40   
41    // Add ScrollView to Media Menu
42    BScrollView *scrollView = new BScrollView("listscroller",
43-       fListView, B_FOLLOW_LEFT|B_FOLLOW_TOP_BOTTOM, 0, false, false,
44+       fListView, 0, false, false,
45        B_FANCY_BORDER);
46    scrollView->SetExplicitMinSize(BSize(scrollWidth, B_SIZE_UNSET));
47    scrollView->SetExplicitMaxSize(BSize(scrollWidth, B_SIZE_UNSET));
48 
49    // Create the Views
50-   fBox = new BBox(bounds, "background", B_FOLLOW_ALL_SIDES,
51-       B_WILL_DRAW | B_FRAME_EVENTS, B_PLAIN_BORDER);
52+   //fBox = new BBox(bounds, "background", B_FOLLOW_ALL_SIDES,
53+   //  B_WILL_DRAW | B_FRAME_EVENTS, B_PLAIN_BORDER);
54+   fBox = new BBox("background", B_WILL_DRAW | B_FRAME_EVENTS,
55+       B_PLAIN_BORDER);
56    SetLayout(new BGroupLayout(B_HORIZONTAL));
57    GetLayout()->AddView(fBox);
58   
59    // StringViews
60    rgb_color titleFontColor = { 0,0,0,0 };
61-   fTitleView = new BStringView(titleRect, "AudioSettings",
62-       "Audio Settings", B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW);
63+   //fTitleView = new BStringView(titleRect, "AudioSettings",
64+   //  "Audio Settings", B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW);
65+   fTitleView = new BStringView("AudioSettings", "Audio Settings",
66+       B_WILL_DRAW);
67    fTitleView->SetFont(be_bold_font);
68    fTitleView->SetHighColor(titleFontColor);
69   
70-   fContentView = new BBox(availableRect, "contentView",
71-       B_FOLLOW_ALL_SIDES, B_WILL_DRAW | B_FRAME_EVENTS, B_NO_BORDER);
72+   //fContentView = new BBox(availableRect, "contentView",
73+   //  B_FOLLOW_ALL_SIDES, B_WILL_DRAW | B_FRAME_EVENTS, B_NO_BORDER);
74+   fContentView = new BBox("contentView", B_WILL_DRAW | B_FRAME_EVENTS,
75+       B_NO_BORDER);
76+   fContentView->SetExplicitMinSize(BSize(B_SIZE_UNSET, B_SIZE_UNSET));
77+   fContentView->SetExplicitMaxSize(BSize(B_SIZE_UNSET, B_SIZE_UNSET));
78   
79    BRect settingsRect(0, 0, availableRect.Width(), availableRect.Height());
80-   fAudioView = new SettingsView(settingsRect, false);
81-   fVideoView = new SettingsView(settingsRect, true);
82+   //fAudioView = new SettingsView(settingsRect, false);
83+   //fVideoView = new SettingsView(settingsRect, true);
84+   fAudioView = new SettingsView(false);
85+   fVideoView = new SettingsView(true);
86   
87-   fBar = new BarView(barRect);
88+   //fBar = new BarView(barRect);
89+   fBar = new BarView();
90    BGroupView* titleGroupView = new BGroupView(B_HORIZONTAL);
91    titleGroupView->GroupLayout()->AddView(fTitleView);
92    titleGroupView->GroupLayout()->AddItem(BSpaceLayoutItem::CreateGlue());
93@@ -621,7 +634,7 @@
94                    if (roster->GetParameterWebFor(*fCurrentNode, &fParamWeb)==B_OK
95                        && (paramView = BMediaTheme::PreferredTheme()->ViewFor(fParamWeb)) != NULL) {
96                        fContentView->AddChild(paramView);
97-                       paramView->ResizeTo(fContentView->Bounds().Width(), fContentView->Bounds().Height() - 10);
98+                       //paramView->ResizeTo(fContentView->Bounds().Width(), fContentView->Bounds().Height() - 10);
99                       
100                        roster->StartWatching(this, *fCurrentNode, B_MEDIA_WILDCARD);
101                    } else {
102Index: ../../../src/preferences/media/MediaViews.cpp
103===================================================================
104--- ../../../src/preferences/media/MediaViews.cpp   (revision 30132)
105+++ ../../../src/preferences/media/MediaViews.cpp   (working copy)
106@@ -31,8 +31,10 @@
107 
108 #include "MediaViews.h"
109 
110-BarView::BarView(BRect frame)
111- : BView (frame, "barView", B_FOLLOW_LEFT_RIGHT, B_WILL_DRAW ),
112+//BarView::BarView(BRect frame)
113+ //: BView (frame, "barView", B_FOLLOW_LEFT_RIGHT, B_WILL_DRAW ),
114+BarView::BarView()
115+ : BView ("barView", B_WILL_DRAW ),
116    fDisplay(true)
117 {
118 }
119@@ -56,18 +58,21 @@
120 }
121 
122 
123-SettingsView::SettingsView (BRect frame, bool isVideo)
124- : BView (frame, "SettingsView", B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW ),
125+//SettingsView::SettingsView (BRect frame, bool isVideo)
126+// : BView (frame, "SettingsView", B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW ),
127+SettingsView::SettingsView (bool isVideo)
128+ : BView ("SettingsView", B_WILL_DRAW ),
129    fIsVideo(isVideo)
130 {
131    SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
132 
133-   BRect rect(frame);
134-   rect.left += 10;
135-   rect.top += 12;
136-   rect.right -=21;
137-   rect.bottom = rect.top + 104;
138-   BBox *defaultsBox = new BBox(rect, "defaults");
139+// BRect rect(frame);
140+// rect.left += 10;
141+// rect.top += 12;
142+// rect.right -=21;
143+// rect.bottom = rect.top + 104;
144+// BBox *defaultsBox = new BBox(rect, "defaults");
145+   BBox *defaultsBox = new BBox("defaults");
146    defaultsBox->SetLabel(fIsVideo ? "Default Nodes" : "Defaults");
147   
148    // create the default box
149@@ -124,15 +129,17 @@
150    fRestartView->Hide();
151   
152    // create the realtime box
153-   rect.top = rect.bottom + 10;
154-   rect.bottom = rect.top + 162;
155-   BBox *realtimeBox = new BBox(rect, "realtime");
156+   //rect.top = rect.bottom + 10;
157+   //rect.bottom = rect.top + 162;
158+   //BBox *realtimeBox = new BBox(rect, "realtime");
159+   BBox *realtimeBox = new BBox("realtime");
160    realtimeBox->SetLabel("Real-Time");
161   
162    BMessage *message = new BMessage(ML_ENABLE_REAL_TIME);
163    message->AddBool("isVideo", fIsVideo);
164-   BRect rect2(22,20, frame.Width() - 22, 40);
165-   fRealtimeCheckBox = new BCheckBox(rect2, "realtimeCheckBox",
166+   //BRect rect2(22,20, frame.Width() - 22, 40);
167+   //fRealtimeCheckBox = new BCheckBox(rect2, "realtimeCheckBox",
168+   fRealtimeCheckBox = new BCheckBox("realtimeCheckBox",
169        fIsVideo ? "Enable Real-Time Video" : "Enable Real-Time Audio", message);
170   
171    uint32 flags;
172@@ -140,10 +147,11 @@
173    if (flags & (fIsVideo ? B_MEDIA_REALTIME_VIDEO : B_MEDIA_REALTIME_AUDIO))
174        fRealtimeCheckBox->SetValue(B_CONTROL_ON);
175       
176-   rect2.top += 26;
177-   rect2.bottom = rect.Height() - 5;
178-   BRect textRect(3, 3, rect2.Width() - 3, rect2.Height() - 3);
179-   BTextView *textView = new BTextView(rect2, "stringView", textRect, B_FOLLOW_ALL, B_WILL_DRAW);
180+   //rect2.top += 26;
181+   //rect2.bottom = rect.Height() - 5;
182+   //BRect textRect(3, 3, rect2.Width() - 3, rect2.Height() - 3);
183+   //BTextView *textView = new BTextView(rect2, "stringView", textRect, B_FOLLOW_ALL, B_WILL_DRAW);
184+   BTextView *textView = new BTextView("stringView", B_WILL_DRAW);
185    textView->Insert(fIsVideo ? "Enabling Real-Time Video allows system to perform video operations as fast and smoothly as possible.  It achieves optimum performance by using more RAM."
186        "\n\nOnly enable this feature if you need the lowest latency possible."
187        : "Enabling Real-time Audio allows system to record and play audio as fast as possible.  It achieves this performance by using more CPU and RAM."
188@@ -163,19 +171,21 @@
189 
190    // create the bottom line: volumen in deskbar checkbox and restart button
191    BGroupView* bottomView = new BGroupView(B_HORIZONTAL);
192-   rect.top = rect.bottom + 11;
193-   rect.bottom = rect.top + 20;
194-   rect.left = rect.right - StringWidth("Restart Media Services") - 20;
195-   BButton *restartButton = new BButton(rect, "restartButton",
196+   //rect.top = rect.bottom + 11;
197+   //rect.bottom = rect.top + 20;
198+   //rect.left = rect.right - StringWidth("Restart Media Services") - 20;
199+   //BButton *restartButton = new BButton(rect, "restartButton",
200+   BButton *restartButton = new BButton("restartButton",
201        "Restart Media Services", new BMessage(ML_RESTART_MEDIA_SERVER));
202   
203    if (!fIsVideo) {
204-       rect.right = rect.left - 10;
205-       rect.top += 4;
206-       rect.left = frame.left + 33;
207-       if (StringWidth("Show Volume Control on Deskbar") > rect.Width() - 30)
208-           rect.left -= 10;
209-       fVolumeCheckBox = new BCheckBox(rect, "volumeCheckBox",
210+       //rect.right = rect.left - 10;
211+       //rect.top += 4;
212+       //rect.left = frame.left + 33;
213+       //if (StringWidth("Show Volume Control on Deskbar") > rect.Width() - 30)
214+       //  rect.left -= 10;
215+       //fVolumeCheckBox = new BCheckBox(rect, "volumeCheckBox",
216+       fVolumeCheckBox = new BCheckBox("volumeCheckBox",
217            "Show Volume Control on Deskbar", new BMessage(ML_SHOW_VOLUME_CONTROL));
218        bottomView->GroupLayout()->AddView(fVolumeCheckBox);
219        if (BDeskbar().HasItem("MediaReplicant"))
220Index: ../../../src/kits/media/DefaultMediaTheme.cpp
221===================================================================
222--- ../../../src/kits/media/DefaultMediaTheme.cpp   (revision 30132)
223+++ ../../../src/kits/media/DefaultMediaTheme.cpp   (working copy)
224@@ -21,6 +21,10 @@
225 #include <TabView.h>
226 #include <TextControl.h>
227 #include <Window.h>
228+#include <GroupView.h>
229+#include <ScrollView.h>
230+#include <LayoutUtils.h>
231+#include <SpaceLayoutItem.h>
232 
233 #include "debug.h"
234 
235@@ -30,7 +34,7 @@
236 
237 namespace BPrivate {
238 
239-class DynamicScrollView : public BView {
240+class DynamicScrollView : public BGroupView {
241    public:
242        DynamicScrollView(const char *name, BView *target);
243        virtual ~DynamicScrollView();
244@@ -52,31 +56,20 @@
245        bool        fIsDocumentScroller;
246 };
247 
248-class GroupView : public BView {
249+class GroupView : public BGroupView {
250    public:
251-       GroupView(BRect frame, const char *name);
252+       GroupView(const char *name, enum orientation orientation, float spacing);
253        virtual ~GroupView();
254-
255-       virtual void AttachedToWindow();
256-       virtual void AllAttached();
257-       virtual void GetPreferredSize(float *_width, float *_height);
258-
259-       virtual BSize MinSize();
260-       virtual BSize MaxSize();
261-       virtual BSize PreferredSize();
262-
263-       void SetContentBounds(BRect bounds);
264-       BRect ContentBounds() const { return fContentBounds; }
265-
266-   private:
267-       BRect       fContentBounds;
268 };
269 
270 class TabView : public BTabView {
271    public:
272-       TabView(BRect frame, const char *name, button_width width = B_WIDTH_FROM_LABEL,
273-           uint32 resizingMode = B_FOLLOW_ALL, uint32 flags = B_FULL_UPDATE_ON_RESIZE
274-               | B_WILL_DRAW | B_NAVIGABLE_JUMP | B_FRAME_EVENTS | B_NAVIGABLE);
275+       //TabView(BRect frame, const char *name, button_width width = B_WIDTH_FROM_LABEL,
276+       //  uint32 resizingMode = B_FOLLOW_ALL, uint32 flags = B_FULL_UPDATE_ON_RESIZE
277+       //      | B_WILL_DRAW | B_NAVIGABLE_JUMP | B_FRAME_EVENTS | B_NAVIGABLE);
278+       TabView(const char *name, button_width width = B_WIDTH_FROM_LABEL,
279+           uint32 flags = B_FULL_UPDATE_ON_RESIZE | B_WILL_DRAW
280+               | B_NAVIGABLE_JUMP | B_FRAME_EVENTS | B_NAVIGABLE);
281 
282        virtual void FrameResized(float width, float height);
283        virtual void Select(int32 tab);
284@@ -88,18 +81,22 @@
285        virtual ~SeparatorView();
286 
287        virtual void Draw(BRect updateRect);
288+       virtual void GetPreferredSize(float *width, float *height);
289+       virtual BSize MaxSize();
290 
291    private:
292+       BRect   fBounds;
293        bool    fVertical;
294 };
295 
296 class TitleView : public BView {
297    public:
298-       TitleView(BRect frame, const char *title);
299+       TitleView(const char *title);
300        virtual ~TitleView();
301 
302        virtual void Draw(BRect updateRect);
303        virtual void GetPreferredSize(float *width, float *height);
304+       virtual BSize MaxSize();
305 
306    private:
307        const char *fTitle;
308@@ -169,16 +166,17 @@
309 
310 
311 DynamicScrollView::DynamicScrollView(const char *name, BView *target)
312-   : BView(target->Frame(), name, B_FOLLOW_ALL, B_WILL_DRAW | B_FRAME_EVENTS),
313+   //: BView(target->Frame(), name, B_FOLLOW_ALL, B_WILL_DRAW | B_FRAME_EVENTS),
314+   : BGroupView(B_VERTICAL, 0),   
315    fHorizontalScrollBar(NULL),
316    fVerticalScrollBar(NULL),
317    fTarget(target),
318    fIsDocumentScroller(false)
319 {
320-   fContentBounds.Set(-1, -1, -1, -1);
321+   SetName(name),
322+   SetFlags(B_WILL_DRAW | B_FRAME_EVENTS),
323    SetViewColor(fTarget->ViewColor());
324-   target->MoveTo(B_ORIGIN);
325-   AddChild(target);
326+   GetLayout()->AddView(target);
327 }
328 
329 
330@@ -206,6 +204,10 @@
331 void
332 DynamicScrollView::FrameResized(float width, float height)
333 {
334+   
335+   ERROR("DynamicScrollView frame resized in FrameResized to %010dx%010d\n",
336+       int(width), int(height)
337+   );
338    UpdateBars();
339 }
340 
341@@ -249,20 +251,28 @@
342    // it could have (without the space for the scroll bars)
343 
344    float width, height;
345-   if (fContentBounds == BRect(-1, -1, -1, -1))
346+   //if (fContentBounds == BRect(-1, -1, -1, -1))
347        fTarget->GetPreferredSize(&width, &height);
348-   else {
349-       width = fContentBounds.Width();
350-       height = fContentBounds.Height();
351-   }
352+   //else {
353+   //  width = fContentBounds.Width();
354+   //  height = fContentBounds.Height();
355+   //}
356 
357    BRect bounds = Bounds();
358+   
359+   ERROR("DynamicScrollView: Updating bars\n\tTarget:   %010dx%010d\n\tScroller: %010dx%010d\n",
360+       int(width), int(height),
361+       int(bounds.Width()), int(bounds.Height())
362+   );
363 
364    // do we have to remove a scroll bar?
365 
366    bool horizontal = width > bounds.Width();
367    bool vertical = height > bounds.Height();
368 
369+// for testing
370+vertical = true;
371+
372    if (!horizontal && fHorizontalScrollBar != NULL) {
373        RemoveChild(fHorizontalScrollBar);
374        delete fHorizontalScrollBar;
375@@ -355,10 +365,10 @@
376 
377 // #pragma mark -
378 
379-
380-GroupView::GroupView(BRect frame, const char *name)
381-   : BView(frame, name, B_FOLLOW_NONE, B_WILL_DRAW)
382+GroupView::GroupView(const char *name, enum orientation orientation, float spacing)
383+   : BGroupView(orientation, spacing)
384 {
385+   SetName(name);
386    SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
387 }
388 
389@@ -368,66 +378,6 @@
390 }
391 
392 
393-void
394-GroupView::AttachedToWindow()
395-{
396-   for (int32 i = CountChildren(); i-- > 0;) {
397-       BControl *control = dynamic_cast<BControl *>(ChildAt(i));
398-       if (control == NULL)
399-           continue;
400-
401-       control->SetTarget(control);
402-   }
403-}
404-
405-
406-void
407-GroupView::AllAttached()
408-{
409-}
410-
411-
412-void
413-GroupView::GetPreferredSize(float *_width, float *_height)
414-{
415-   if (_width)
416-       *_width = fContentBounds.Width();
417-
418-   if (_height)
419-       *_height = fContentBounds.Height();
420-}
421-
422-
423-BSize
424-GroupView::MinSize()
425-{
426-   return BSize(100, 100);
427-}
428-
429-
430-BSize
431-GroupView::PreferredSize()
432-{
433-   return MinSize();
434-}
435-
436-
437-BSize
438-GroupView::MaxSize()
439-{
440-   BSize max;
441-   GetPreferredSize(&max.width, &max.height);
442-   return max;
443-}
444-
445-
446-void
447-GroupView::SetContentBounds(BRect bounds)
448-{
449-   fContentBounds = bounds;
450-}
451-
452-
453 // #pragma mark -
454 
455 
456@@ -438,20 +388,39 @@
457  * selected (does not take their resize flags into account, though).
458  */
459 
460-TabView::TabView(BRect frame, const char *name, button_width width,
461-   uint32 resizingMode, uint32 flags)
462-   : BTabView(frame, name, width, resizingMode, flags)
463+//TabView::TabView(BRect frame, const char *name, button_width width,
464+// uint32 resizingMode, uint32 flags)
465+// : BTabView(frame, name, width, resizingMode, flags)
466+TabView::TabView(const char *name, button_width width, uint32 flags)
467+   : BTabView(name, width, flags)
468 {
469 }
470 
471 
472 void
473 TabView::FrameResized(float width, float height)
474-{
475+{ 
476    BRect rect = Bounds();
477    rect.top += TabHeight();
478    rect.InsetBy(3.0f, 3.0f);
479        //ContainerView is inseted by 3.0 in BTabView::_InitObject()
480+   
481+   ERROR("TabView container resized to %010dx%010d\n",
482+       int(rect.Width()), int(rect.Height())
483+   );
484+   
485+   BSize minSize = ContainerView()->MinSize();
486+   BSize maxSize = ContainerView()->MaxSize();
487+   
488+   ERROR("TabView min/max sizes:\n\t%010dx%010d\n\t%010dx%010d\n",
489+       int(minSize.width), int(minSize.height),
490+       int(maxSize.width), int(maxSize.height)
491+   );
492+   
493+   // for some reason, at this point MinSize has been set to something
494+   // far greater than available viewing rect - this resets it
495+   ContainerView()->SetExplicitMinSize(BSize(rect.Width(), rect.Height()));
496+   ContainerView()->SetExplicitMaxSize(BSize(rect.Width(), rect.Height()));
497 
498    ContainerView()->ResizeTo(rect.Width(), rect.Height());
499 }
500@@ -465,6 +434,20 @@
501    BView *view = ViewForTab(Selection());
502    if (view != NULL) {
503        BRect rect = ContainerView()->Bounds();
504+       
505+       // for some reason, the container view is getting resized after
506+       // FrameResized() - probably something to do with the layout -
507+       // system - and so the above line of code does not work; this
508+       // forces the correct bounds
509+       //BRect rect = Bounds();
510+       rect.top += TabHeight();
511+       rect.InsetBy(3.0f, 3.0f);
512+           //ContainerView is inseted by 3.0 in BTabView::_InitObject()
513+   
514+       ERROR("TabView ViewForTab resized to %010dx%010d\n",
515+           int(rect.Width()), int(rect.Height())
516+       );
517+       
518        view->ResizeTo(rect.Width(), rect.Height());
519    }
520 }
521@@ -474,9 +457,11 @@
522 
523 
524 SeparatorView::SeparatorView(BRect frame)
525-   : BView(frame, "-", B_FOLLOW_NONE, B_WILL_DRAW)
526+   : BView("-", B_WILL_DRAW)
527 {
528+   fBounds = frame;
529    fVertical = frame.Width() < frame.Height();
530+   
531    SetViewColor(B_TRANSPARENT_COLOR);
532 }
533 
534@@ -506,11 +491,33 @@
535 }
536 
537 
538+void
539+SeparatorView::GetPreferredSize(float *_width, float *_height)
540+{
541+   if (_width)
542+       *_width = fBounds.right - fBounds.left;
543+
544+   if (_height)
545+       *_height = fBounds.bottom - fBounds.top;
546+}
547+
548+
549+BSize
550+SeparatorView::MaxSize()
551+{
552+   float width, height;
553+   GetPreferredSize(&width, &height);
554+
555+   return BLayoutUtils::ComposeSize(BSize(width, height),
556+       BSize(width, height));
557+}
558+
559+
560 // #pragma mark -
561 
562 
563-TitleView::TitleView(BRect frame, const char *title)
564-   : BView(frame, title, B_FOLLOW_LEFT_RIGHT, B_WILL_DRAW)
565+TitleView::TitleView(const char *title)
566+   : BView(title, B_WILL_DRAW)
567 {
568    fTitle = strdup(title);
569    SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
570@@ -555,6 +562,17 @@
571 }
572 
573 
574+BSize
575+TitleView::MaxSize()
576+{
577+   float height;
578+   GetPreferredSize(NULL, &height);
579+
580+   return BLayoutUtils::ComposeSize(BSize(B_SIZE_UNLIMITED, height),
581+       BSize(B_SIZE_UNLIMITED, height));
582+}
583+
584+
585 // #pragma mark -
586 
587 
588@@ -798,70 +816,30 @@
589    if (web == NULL)
590        return NULL;
591 
592-   BRect rect;
593-   if (hintRect)
594-       rect = *hintRect;
595-       
596-   BRect bestRect;
597-
598-   // do we have more than one attached parameter group?
599-   // if so, use a tabbed view with a tab for each group
600-
601    TabView *tabView = NULL;
602 
603    if (web->CountGroups() > 1)
604-       tabView = new TabView(rect, "web");
605+       tabView = new TabView("web");
606 
607-   rect.OffsetTo(B_ORIGIN);
608-
609    for (int32 i = 0; i < web->CountGroups(); i++) {
610        BParameterGroup *group = web->GroupAt(i);
611        if (group == NULL)
612            continue;
613 
614-       BView *groupView = MakeViewFor(*group, hintRect ? &rect : NULL);
615+       BView *groupView = MakeViewFor(*group);
616        if (groupView == NULL)
617            continue;
618 
619-       if (GroupView *view = dynamic_cast<GroupView *>(groupView)) {
620-           // the top-level group views must not be larger than their hintRect,
621-           // but unlike their children, they should follow all sides when
622-           // their parent is resized
623-           if (hintRect != NULL)
624-               view->ResizeTo(rect.Width() - 10, rect.Height() - 10);
625-           view->SetResizingMode(B_FOLLOW_ALL);
626-       }
627-
628        if (tabView == NULL) {
629            // if we don't need a container to put that view into,
630-           // we're done here (but the groupView may span over the
631-           // whole hintRect)
632-           if (groupView->Frame().LeftTop() == BPoint(5, 5)) {
633-               // remove insets, as they are not needed
634-               groupView->MoveBy(-5, -5);
635-               groupView->ResizeBy(10, 10);
636-           }
637+           // we're done here
638 
639            return new DynamicScrollView(groupView->Name(), groupView);
640        }
641       
642-       DynamicScrollView *scrollView = new DynamicScrollView(groupView->Name(), groupView);       
643+       DynamicScrollView *scrollView = new DynamicScrollView(groupView->Name(), groupView);
644        tabView->AddTab(scrollView);
645-       
646-       if (!hintRect) {           
647-           bestRect = bestRect | scrollView->Bounds();         
648-       }   
649    }
650-   
651-   if (tabView != NULL) {     
652-       // this adjustment must be kept in sync with TabView::FrameResized
653-       bestRect.bottom += tabView->TabHeight();
654-       bestRect.InsetBy(-3.0,-3.0);   
655-       
656-       tabView->ResizeTo(bestRect.Width(), bestRect.Height());
657-       tabView->FrameResized(bestRect.Width(), bestRect.Height());
658-           //needed since we're not attached to a window yet
659-   }
660 
661    return tabView;
662 }
663@@ -871,29 +849,26 @@
664 DefaultMediaTheme::MakeViewFor(BParameterGroup& group, const BRect* hintRect)
665 {
666    CALLED();
667+   
668+   ERROR("MakeViewFor^2 called\n");
669 
670    if (group.Flags() & B_HIDDEN_PARAMETER)
671        return NULL;
672 
673-   BRect rect;
674-   if (hintRect != NULL)
675-       rect = *hintRect;
676+   BGroupView *view = new GroupView(group.Name(), B_VERTICAL, 5);
677+   
678+   BGroupLayout* viewLayout = view->GroupLayout();
679+   viewLayout->SetInsets(5,5,5,5);
680 
681-   GroupView *view = new GroupView(rect, group.Name());
682-
683    // Create the parameter views - but don't add them yet
684 
685-   rect.OffsetTo(B_ORIGIN);
686-   rect.InsetBySelf(5, 5);
687-
688    BList views;
689    for (int32 i = 0; i < group.CountParameters(); i++) {
690        BParameter *parameter = group.ParameterAt(i);
691        if (parameter == NULL)
692            continue;
693 
694-       BView *parameterView = MakeSelfHostingViewFor(*parameter,
695-           hintRect ? &rect : NULL);
696+       BView *parameterView = MakeSelfHostingViewFor(*parameter);
697        if (parameterView == NULL)
698            continue;
699 
700@@ -908,22 +883,17 @@
701 
702    TitleView *titleView = dynamic_cast<TitleView *>((BView *)views.ItemAt(0));
703    if (titleView != NULL) {
704-       view->AddChild(titleView);
705-       rect.OffsetBy(0, titleView->Bounds().Height());
706+       viewLayout->AddView(titleView);
707    }
708 
709    // Add the sub-group views
710 
711-   rect.right = rect.left + 20;
712-   rect.bottom = rect.top + 20;
713-   float lastHeight = 0;
714-
715    for (int32 i = 0; i < group.CountGroups(); i++) {
716        BParameterGroup *subGroup = group.GroupAt(i);
717        if (subGroup == NULL)
718            continue;
719 
720-       BView *groupView = MakeViewFor(*subGroup, &rect);
721+       BView *groupView = MakeViewFor(*subGroup);
722        if (groupView == NULL)
723            continue;
724 
725@@ -932,42 +902,23 @@
726            BRect separatorRect(groupView->Frame());
727            separatorRect.left -= 3;
728            separatorRect.right = separatorRect.left + 1;
729-           if (lastHeight > separatorRect.Height())
730-               separatorRect.bottom = separatorRect.top + lastHeight;
731 
732-           view->AddChild(new SeparatorView(separatorRect));
733+           viewLayout->AddView(new SeparatorView(separatorRect));
734        }
735 
736-       view->AddChild(groupView);
737-
738-       rect.OffsetBy(groupView->Bounds().Width() + 5, 0);
739-
740-       lastHeight = groupView->Bounds().Height();
741-       if (lastHeight > rect.Height())
742-           rect.bottom = rect.top + lastHeight - 1;
743+       viewLayout->AddView(groupView);
744    }
745 
746-   view->ResizeTo(rect.left + 10, rect.bottom + 5);
747-   view->SetContentBounds(view->Bounds());
748-
749    if (group.CountParameters() == 0)
750        return view;
751 
752    // add the parameter views part of the group
753 
754-   if (group.CountGroups() > 0) {
755-       rect.top = rect.bottom + 10;
756-       rect.bottom = rect.top + 20;
757-   }
758-
759    bool center = false;
760 
761    for (int32 i = 0; i < views.CountItems(); i++) {
762        BView *parameterView = static_cast<BView *>(views.ItemAt(i));
763 
764-       if (parameterView->Bounds().Width() + 5 > rect.Width())
765-           rect.right = parameterView->Bounds().Width() + rect.left + 5;
766-
767        // we don't need to add the title view again
768        if (parameterView == titleView)
769            continue;
770@@ -977,33 +928,10 @@
771        if (dynamic_cast<BChannelSlider *>(parameterView) != NULL)
772            center = true;
773 
774-       parameterView->MoveTo(parameterView->Frame().left, rect.top);
775-       view->AddChild(parameterView);
776-
777-       rect.OffsetBy(0, parameterView->Bounds().Height() + 5);
778+       viewLayout->AddView(parameterView);
779    }
780 
781-   if (views.CountItems() > (titleView != NULL ? 1 : 0))
782-       view->ResizeTo(rect.right + 5, rect.top + 5);
783-
784-   // center the parameter views if needed, and tweak some views
785-
786-   float width = view->Bounds().Width();
787-
788-   for (int32 i = 0; i < views.CountItems(); i++) {
789-       BView *subView = static_cast<BView *>(views.ItemAt(i));
790-       BRect frame = subView->Frame();
791-
792-       if (center)
793-           subView->MoveTo((width - frame.Width()) / 2, frame.top);
794-       else {
795-           // tweak the PopUp views to look better
796-           if (dynamic_cast<BOptionPopUp *>(subView) != NULL)
797-               subView->ResizeTo(width, frame.Height());
798-       }
799-   }
800-
801-   view->SetContentBounds(view->Bounds());
802+   viewLayout->AddItem(BSpaceLayoutItem::CreateGlue());
803    return view;
804 }
805 
806@@ -1019,7 +947,7 @@
807        || parameter_should_be_hidden(parameter))
808        return NULL;
809 
810-   BView *view = MakeViewFor(&parameter, hintRect);
811+   BView *view = MakeViewFor(&parameter);
812    if (view == NULL) {
813        // The MakeViewFor() method above returns a BControl - which we
814        // don't need for a null parameter; that's why it returns NULL.
815@@ -1030,15 +958,13 @@
816                // this is the first parameter in this group, so
817                // let's use a nice title view
818 
819-               TitleView *titleView = new TitleView(BRect(0, 0, 10, 10), parameter.Name());
820-               titleView->ResizeToPreferred();
821+               TitleView *titleView = new TitleView(parameter.Name());
822 
823                return titleView;
824            }
825-           BStringView *stringView = new BStringView(BRect(0, 0, 10, 10),
826-               parameter.Name(), parameter.Name());
827+           BStringView *stringView = new BStringView(parameter.Name(),
828+               parameter.Name());
829            stringView->SetAlignment(B_ALIGN_CENTER);
830-           stringView->ResizeToPreferred();
831 
832            return stringView;
833        }
834@@ -1058,10 +984,7 @@
835 DefaultMediaTheme::MakeViewFor(BParameter *parameter, const BRect *hintRect)
836 {
837    BRect rect;
838-   if (hintRect)
839-       rect = *hintRect;
840-   else
841-       rect.Set(0, 0, 50, 100);
842+   rect.Set(0, 0, 50, 100);
843 
844    switch (parameter->Type()) {
845        case BParameter::B_NULL_PARAMETER:
846@@ -1077,9 +1000,8 @@
847                || discrete.CountItems() == 0) {
848                // create a checkbox item
849 
850-               BCheckBox *checkBox = new BCheckBox(rect, discrete.Name(),
851+               BCheckBox *checkBox = new BCheckBox(discrete.Name(),
852                    discrete.Name(), NULL);
853-               checkBox->ResizeToPreferred();
854 
855                return checkBox;
856            } else {
857@@ -1100,14 +1022,13 @@
858                rect.right = rect.left + width;
859 
860                BOptionPopUp *popUp = new BOptionPopUp(rect, discrete.Name(),
861+               //BOptionPopUp *popUp = new BOptionPopUp(discrete.Name(),
862                    discrete.Name(), NULL);
863 
864                for (int32 i = 0; i < discrete.CountItems(); i++) {
865                    popUp->AddOption(discrete.ItemNameAt(i), discrete.ItemValueAt(i));
866                }
867 
868-               popUp->ResizeToPreferred();
869-
870                return popUp;
871            }
872        }
873@@ -1118,7 +1039,8 @@
874 
875            if (!strcmp(continuous.Kind(), B_MASTER_GAIN)
876                || !strcmp(continuous.Kind(), B_GAIN)) {
877-               BChannelSlider *slider = new BChannelSlider(rect, continuous.Name(),
878+               //BChannelSlider *slider = new BChannelSlider(rect, continuous.Name(),
879+               BChannelSlider *slider = new BChannelSlider(continuous.Name(),
880                    continuous.Name(), NULL, B_VERTICAL, continuous.CountChannels());
881 
882                char minLabel[64], maxLabel[64];
883@@ -1134,10 +1056,6 @@
884                }
885                slider->SetLimitLabels(minLabel, maxLabel);
886 
887-               float width, height;
888-               slider->GetPreferredSize(&width, &height);
889-               slider->ResizeTo(width, 190);
890-
891                // ToDo: take BContinuousParameter::GetResponse() & ValueStep() into account!
892 
893                for (int32 i = 0; i < continuous.CountChannels(); i++) {
894@@ -1149,12 +1067,9 @@
895            }
896 
897            BSlider *slider = new BSlider(rect, parameter->Name(), parameter->Name(),
898+           //BSlider *slider = new BSlider(parameter->Name(), parameter->Name(),
899                NULL, 0, 100);
900 
901-           float width, height;
902-           slider->GetPreferredSize(&width, &height);
903-           slider->ResizeTo(100, height);
904-
905            return slider;
906        }
907 
908Index: ../../../headers/private/media/DefaultMediaTheme.h
909===================================================================
910--- ../../../headers/private/media/DefaultMediaTheme.h  (revision 30132)
911+++ ../../../headers/private/media/DefaultMediaTheme.h  (working copy)
912@@ -27,8 +27,8 @@
913        virtual BView* MakeViewFor(BParameterWeb* web, const BRect* hintRect = NULL);
914 
915    private:
916-       BView* MakeViewFor(BParameterGroup& group, const BRect* hintRect);
917-       BView* MakeSelfHostingViewFor(BParameter& parameter, const BRect* hintRect);
918+       BView* MakeViewFor(BParameterGroup& group, const BRect* hintRect = NULL);
919+       BView* MakeSelfHostingViewFor(BParameter& parameter, const BRect* hintRect = NULL);
920 };
921 
922 }  // namespace BPrivate