Commit a0764279 authored by Eric Petit's avatar Eric Petit
Browse files

* modules/gui/beos/MessagesWindow.cpp: fixed a nasty bug

 * modules/gui/beos/PreferencesWindow.*: now you can save preferences
parent 2aa9dde7
......@@ -2,7 +2,7 @@
* MessagesWindow.cpp: beos interface
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: MessagesWindow.cpp,v 1.7 2003/02/10 15:23:46 titer Exp $
* $Id: MessagesWindow.cpp,v 1.8 2003/05/07 17:27:30 titer Exp $
*
* Authors: Eric Petit <titer@videolan.org>
*
......@@ -45,9 +45,11 @@ MessagesWindow::MessagesWindow( intf_thread_t * p_intf,
B_NOT_ZOOMABLE )
{
this->p_intf = p_intf;
SetSizeLimits( 200, 2000, 200, 2000 );
BRect rect, textRect;
rect = Bounds();
rect.right -= B_V_SCROLL_BAR_WIDTH;
textRect = rect;
......@@ -55,6 +57,7 @@ MessagesWindow::MessagesWindow( intf_thread_t * p_intf,
fMessagesView = new BTextView( rect, "messages", textRect,
B_FOLLOW_ALL, B_WILL_DRAW );
fMessagesView->MakeEditable( false );
fMessagesView->MakeSelectable( false );
fMessagesView->SetStylable( true );
fScrollView = new BScrollView( "scrollview", fMessagesView, B_WILL_DRAW,
B_FOLLOW_ALL, false, true );
......@@ -183,6 +186,7 @@ static int UpdateMessages( intf_thread_t * p_intf )
}
/* Scroll at the end */
if( scrollBar->LockLooper() )
{
float min, max;
......
......@@ -2,7 +2,7 @@
* PreferencesWindow.cpp: beos interface
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: PreferencesWindow.cpp,v 1.17 2003/05/07 16:47:10 titer Exp $
* $Id: PreferencesWindow.cpp,v 1.18 2003/05/07 17:27:30 titer Exp $
*
* Authors: Eric Petit <titer@videolan.org>
*
......@@ -82,6 +82,9 @@ PreferencesWindow::PreferencesWindow( intf_thread_t * p_interface,
fConfigScroll( NULL ),
p_intf( p_interface )
{
SetSizeLimits( PREFS_WINDOW_WIDTH, PREFS_WINDOW_WIDTH,
200, 2000 );
BRect rect;
/* The "background" view */
......@@ -272,15 +275,20 @@ PreferencesWindow::PreferencesWindow( intf_thread_t * p_interface,
rect.InsetBy( 10, 10 );
rect.left = rect.right - 80;
rect.top = rect.bottom - 25;
button = new BButton( rect, "", _("OK"), new BMessage( PREFS_OK ),
button = new BButton( rect, "", _("Close"), new BMessage( PREFS_CLOSE ),
B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM );
button->MakeDefault( true );
fPrefsView->AddChild( button );
rect.OffsetBy( -90, 0 );
button = new BButton( rect, "", _("Revert"), new BMessage( PREFS_REVERT ),
button = new BButton( rect, "", _("Apply"), new BMessage( PREFS_APPLY ),
B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM );
fPrefsView->AddChild( button );
rect.OffsetBy( -90, 0 );
button = new BButton( rect, "", _("Apply"), new BMessage( PREFS_APPLY ),
button = new BButton( rect, "", _("Save"), new BMessage( PREFS_SAVE ),
B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM );
fPrefsView->AddChild( button );
rect.OffsetBy( -90, 0 );
button = new BButton( rect, "", _("Revert"), new BMessage( PREFS_REVERT ),
B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM );
fPrefsView->AddChild( button );
......@@ -316,8 +324,7 @@ void PreferencesWindow::MessageReceived( BMessage * message )
Update();
break;
case PREFS_OK:
ApplyChanges( true );
case PREFS_CLOSE:
PostMessage( B_QUIT_REQUESTED );
break;
......@@ -328,6 +335,10 @@ void PreferencesWindow::MessageReceived( BMessage * message )
case PREFS_APPLY:
ApplyChanges( true );
break;
case PREFS_SAVE:
SaveChanges();
break;
default:
BWindow::MessageReceived( message );
......@@ -484,6 +495,15 @@ void PreferencesWindow::ApplyChanges( bool doIt )
}
}
/*****************************************************************************
* PreferencesWindow::SaveChanges
*****************************************************************************/
void PreferencesWindow::SaveChanges()
{
ApplyChanges( true );
config_SaveConfigFile( p_intf, NULL );
}
/*****************************************************************************
* PreferencesWindow::ReallyQuit
*****************************************************************************/
......
......@@ -2,7 +2,7 @@
* PreferencesWindow.h
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: PreferencesWindow.h,v 1.11 2003/05/05 13:06:02 titer Exp $
* $Id: PreferencesWindow.h,v 1.12 2003/05/07 17:27:30 titer Exp $
*
* Authors: Eric Petit <titer@videolan.org>
*
......@@ -29,9 +29,10 @@
#define PREFS_WINDOW_WIDTH 600
#define PREFS_WINDOW_HEIGHT 400
#define PREFS_ITEM_SELECTED 'pris'
#define PREFS_OK 'prok'
#define PREFS_CLOSE 'prcl'
#define PREFS_REVERT 'prre'
#define PREFS_APPLY 'prap'
#define PREFS_SAVE 'prsa'
#define TEXT_HEIGHT 16
class ConfigView : public BView
......@@ -70,6 +71,7 @@ class PreferencesWindow : public BWindow
void Update();
void UpdateScrollBar();
void ApplyChanges( bool doIt );
void SaveChanges();
void ReallyQuit();
......
Supports Markdown
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