Commit 9ee5c170 authored by Eric Petit's avatar Eric Petit

modules/gui/beos/*: Partial fix for Preferences resizing

parent fee6852a
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* InterfaceWindow.cpp: beos interface * InterfaceWindow.cpp: beos interface
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN * Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: InterfaceWindow.cpp,v 1.35 2003/05/03 13:37:21 titer Exp $ * $Id: InterfaceWindow.cpp,v 1.36 2003/05/05 13:06:02 titer Exp $
* *
* Authors: Jean-Marc Dressler <polux@via.ecp.fr> * Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org> * Samuel Hocevar <sam@zoy.org>
...@@ -966,7 +966,12 @@ InterfaceWindow::_RestoreSettings() ...@@ -966,7 +966,12 @@ InterfaceWindow::_RestoreSettings()
if (fSettings->FindRect( "messages frame", &frame ) == B_OK ) if (fSettings->FindRect( "messages frame", &frame ) == B_OK )
set_window_pos( fMessagesWindow, frame ); set_window_pos( fMessagesWindow, frame );
if (fSettings->FindRect( "settings frame", &frame ) == B_OK ) if (fSettings->FindRect( "settings frame", &frame ) == B_OK )
{
/* FIXME: Preferences horizontal resizing doesn't work
correctly now */
frame.right = frame.left + fPreferencesWindow->Frame().Width();
set_window_pos( fPreferencesWindow, frame ); set_window_pos( fPreferencesWindow, frame );
}
bool showing; bool showing;
if ( fSettings->FindBool( "playlist showing", &showing ) == B_OK ) if ( fSettings->FindBool( "playlist showing", &showing ) == B_OK )
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* PreferencesWindow.cpp: beos interface * PreferencesWindow.cpp: beos interface
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN * Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: PreferencesWindow.cpp,v 1.15 2003/05/03 13:37:21 titer Exp $ * $Id: PreferencesWindow.cpp,v 1.16 2003/05/05 13:06:02 titer Exp $
* *
* Authors: Eric Petit <titer@videolan.org> * Authors: Eric Petit <titer@videolan.org>
* *
...@@ -56,7 +56,7 @@ ConfigView::ConfigView( BRect frame, const char * name, ...@@ -56,7 +56,7 @@ ConfigView::ConfigView( BRect frame, const char * name,
PreferencesWindow::PreferencesWindow( intf_thread_t * p_interface, PreferencesWindow::PreferencesWindow( intf_thread_t * p_interface,
BRect frame, const char * name ) BRect frame, const char * name )
: BWindow( frame, name, B_FLOATING_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL, : BWindow( frame, name, B_FLOATING_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
B_NOT_ZOOMABLE ), B_NOT_ZOOMABLE | B_NOT_H_RESIZABLE ),
fConfigScroll( NULL ), fConfigScroll( NULL ),
p_intf( p_interface ) p_intf( p_interface )
{ {
...@@ -75,8 +75,6 @@ PreferencesWindow::PreferencesWindow( intf_thread_t * p_interface, ...@@ -75,8 +75,6 @@ PreferencesWindow::PreferencesWindow( intf_thread_t * p_interface,
fOutline = new BOutlineListView( rect, "preferences tree", fOutline = new BOutlineListView( rect, "preferences tree",
B_SINGLE_SELECTION_LIST, B_SINGLE_SELECTION_LIST,
B_FOLLOW_LEFT | B_FOLLOW_TOP_BOTTOM ); B_FOLLOW_LEFT | B_FOLLOW_TOP_BOTTOM );
rect.right += B_V_SCROLL_BAR_WIDTH;
BScrollView * scrollview = new BScrollView( "scrollview", fOutline, BScrollView * scrollview = new BScrollView( "scrollview", fOutline,
B_FOLLOW_LEFT | B_FOLLOW_TOP_BOTTOM, B_FOLLOW_LEFT | B_FOLLOW_TOP_BOTTOM,
0, false, true ); 0, false, true );
...@@ -87,7 +85,7 @@ PreferencesWindow::PreferencesWindow( intf_thread_t * p_interface, ...@@ -87,7 +85,7 @@ PreferencesWindow::PreferencesWindow( intf_thread_t * p_interface,
/* Create a dummy view so we can correctly place the real config views later */ /* Create a dummy view so we can correctly place the real config views later */
rect.bottom -= 40; rect.bottom -= 40;
rect.left = rect.right + 15; rect.left = rect.right + 15 + B_V_SCROLL_BAR_WIDTH;
rect.right = Bounds().right - 15; rect.right = Bounds().right - 15;
fDummyView = new BView( rect, "", B_FOLLOW_ALL_SIDES, B_WILL_DRAW ); fDummyView = new BView( rect, "", B_FOLLOW_ALL_SIDES, B_WILL_DRAW );
fPrefsView->AddChild( fDummyView ); fPrefsView->AddChild( fDummyView );
...@@ -165,7 +163,7 @@ PreferencesWindow::PreferencesWindow( intf_thread_t * p_interface, ...@@ -165,7 +163,7 @@ PreferencesWindow::PreferencesWindow( intf_thread_t * p_interface,
sprintf( name, "s%s", p_item->psz_name ); sprintf( name, "s%s", p_item->psz_name );
textControl = new BTextControl( rect, name, p_item->psz_text, textControl = new BTextControl( rect, name, p_item->psz_text,
"", new BMessage(), "", new BMessage(),
B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP ); B_FOLLOW_NONE );
configView->AddChild( textControl ); configView->AddChild( textControl );
break; break;
...@@ -179,7 +177,7 @@ PreferencesWindow::PreferencesWindow( intf_thread_t * p_interface, ...@@ -179,7 +177,7 @@ PreferencesWindow::PreferencesWindow( intf_thread_t * p_interface,
sprintf( name, "i%s", p_item->psz_name ); sprintf( name, "i%s", p_item->psz_name );
textControl = new BTextControl( rect, name, p_item->psz_text, textControl = new BTextControl( rect, name, p_item->psz_text,
"", new BMessage(), "", new BMessage(),
B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP ); B_FOLLOW_NONE );
configView->AddChild( textControl ); configView->AddChild( textControl );
break; break;
...@@ -193,7 +191,7 @@ PreferencesWindow::PreferencesWindow( intf_thread_t * p_interface, ...@@ -193,7 +191,7 @@ PreferencesWindow::PreferencesWindow( intf_thread_t * p_interface,
sprintf( name, "f%s", p_item->psz_name ); sprintf( name, "f%s", p_item->psz_name );
textControl = new BTextControl( rect, name, p_item->psz_text, textControl = new BTextControl( rect, name, p_item->psz_text,
"", new BMessage(), "", new BMessage(),
B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP ); B_FOLLOW_NONE );
configView->AddChild( textControl ); configView->AddChild( textControl );
break; break;
...@@ -206,7 +204,7 @@ PreferencesWindow::PreferencesWindow( intf_thread_t * p_interface, ...@@ -206,7 +204,7 @@ PreferencesWindow::PreferencesWindow( intf_thread_t * p_interface,
memset( name, 0, 128 ); memset( name, 0, 128 );
sprintf( name, "b%s", p_item->psz_name ); sprintf( name, "b%s", p_item->psz_name );
checkBox = new BCheckBox( rect, name, p_item->psz_text, checkBox = new BCheckBox( rect, name, p_item->psz_text,
new BMessage(), B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP ); new BMessage(), B_FOLLOW_NONE );
configView->AddChild( checkBox ); configView->AddChild( checkBox );
break; break;
} }
...@@ -307,6 +305,18 @@ void PreferencesWindow::MessageReceived( BMessage * message ) ...@@ -307,6 +305,18 @@ void PreferencesWindow::MessageReceived( BMessage * message )
void PreferencesWindow::FrameResized( float width, float height ) void PreferencesWindow::FrameResized( float width, float height )
{ {
BWindow::FrameResized( width, height ); BWindow::FrameResized( width, height );
StringItemWithView * item;
ConfigView * view;
for( int i = 0; i < fOutline->CountItems(); i++ )
{
/* Fix ConfigView sizes */
item = (StringItemWithView*) fOutline->ItemAt( i );
view = item->fConfigView;
view->ResizeTo( fDummyView->Bounds().Width() - B_V_SCROLL_BAR_WIDTH,
fDummyView->Bounds().Height() );
}
UpdateScrollBar(); UpdateScrollBar();
} }
...@@ -352,17 +362,24 @@ void PreferencesWindow::UpdateScrollBar() ...@@ -352,17 +362,24 @@ void PreferencesWindow::UpdateScrollBar()
correctly simple BViews */ correctly simple BViews */
/* Get the current config view */ /* Get the current config view */
ConfigView * view;
if( fOutline->CurrentSelection() < 0 ) if( fOutline->CurrentSelection() < 0 )
return; return;
StringItemWithView * selectedItem = StringItemWithView * selectedItem =
(StringItemWithView*) fOutline->ItemAt( fOutline->CurrentSelection() ); (StringItemWithView*) fOutline->ItemAt( fOutline->CurrentSelection() );
view = selectedItem->fConfigView;
/* Get the available BRect for display */
BRect display = fConfigScroll->Bounds();
display.right -= B_V_SCROLL_BAR_WIDTH;
/* Fix the scrollbar */ /* Fix the scrollbar */
BRect visible = fConfigScroll->Bounds() & selectedItem->fConfigView->fRealBounds; BScrollBar * scrollBar;
BRect total = fConfigScroll->Bounds() | selectedItem->fConfigView->fRealBounds; long max;
BScrollBar * scrollBar = fConfigScroll->ScrollBar( B_VERTICAL ); BRect visible = display & view->fRealBounds;
long max = (long)( selectedItem->fConfigView->fRealBounds.Height() - BRect total = display | view->fRealBounds;
fConfigScroll->Bounds().Height() ); scrollBar = fConfigScroll->ScrollBar( B_VERTICAL );
max = (long)( view->fRealBounds.Height() - visible.Height() );
if( max < 0 ) max = 0; if( max < 0 ) max = 0;
scrollBar->SetRange( 0, max ); scrollBar->SetRange( 0, max );
scrollBar->SetProportion( visible.Height() / total.Height() ); scrollBar->SetProportion( visible.Height() / total.Height() );
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* PreferencesWindow.h * PreferencesWindow.h
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN * Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: PreferencesWindow.h,v 1.10 2003/05/03 13:37:21 titer Exp $ * $Id: PreferencesWindow.h,v 1.11 2003/05/05 13:06:02 titer Exp $
* *
* Authors: Eric Petit <titer@videolan.org> * Authors: Eric Petit <titer@videolan.org>
* *
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
#include <Window.h> #include <Window.h>
#define PREFS_WINDOW_WIDTH 600 #define PREFS_WINDOW_WIDTH 600
#define PREFS_WINDOW_HEIGHT 300 #define PREFS_WINDOW_HEIGHT 400
#define PREFS_ITEM_SELECTED 'pris' #define PREFS_ITEM_SELECTED 'pris'
#define PREFS_OK 'prok' #define PREFS_OK 'prok'
#define PREFS_REVERT 'prre' #define PREFS_REVERT 'prre'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment