* MediaControlView.cpp: beos interface
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
- * $Id: MediaControlView.cpp,v 1.14 2003/02/01 12:01:11 stippi Exp $
+ * $Id$
*
* Authors: Tony Castley <tony@castley.net>
* Stephan Aßmus <stippi@yellowbites.com>
/* VLC headers */
#include <vlc/vlc.h>
#include <vlc/intf.h>
+#include <vlc/input.h>
+extern "C"
+{
+ #include <audio_output.h>
+}
/* BeOS interface headers */
#include "VlcWrapper.h"
const rgb_color kSeekRedLight = (rgb_color){ 255, 152, 152, 255 };
const rgb_color kSeekRedShadow = (rgb_color){ 178, 0, 0, 255 };
-const char* kDisabledSeekMessage = "Drop files to play";
+#define DISABLED_SEEK_MESSAGE _("Drop files to play")
enum
{
: BBox(frame, NULL, B_FOLLOW_NONE, B_WILL_DRAW | B_FRAME_EVENTS | B_PULSE_NEEDED,
B_PLAIN_BORDER),
fScrubSem(B_ERROR),
- fCurrentRate(DEFAULT_RATE),
- fCurrentStatus(UNDEF_S),
+ fCurrentRate(INPUT_RATE_DEFAULT),
+ fCurrentStatus(-1),
fBottomControlHeight(0.0),
fIsEnabled( true )
{
BRect frame(0.0, 0.0, 10.0, 10.0);
// Seek Slider
- fSeekSlider = new SeekSlider(frame, "seek slider", this,
- 0, SEEKSLIDER_RANGE - 1);
+ fSeekSlider = new SeekSlider( frame, "seek slider", this,
+ 0, SEEKSLIDER_RANGE );
fSeekSlider->SetValue(0);
fSeekSlider->ResizeToPreferred();
AddChild( fSeekSlider );
kVolumeSliderBitmapHeight - 1.0),
"volume slider", 1, AOUT_VOLUME_MAX,
new BMessage(VOLUME_CHG));
- fVolumeSlider->SetValue(AOUT_VOLUME_DEFAULT);
+ fVolumeSlider->SetValue( config_GetInt( p_intf, "volume" ) );
AddChild( fVolumeSlider );
// Position Info View
fVolumeSlider->SetTarget(Window());
BRect r(_MinFrame());
- if (BMenuBar* menuBar = Window()->KeyMenuBar())
- r.bottom += menuBar->Bounds().Height();
+ if (BMenuBar* menuBar = Window()->KeyMenuBar()) {
+ float width, height;
+ menuBar->GetPreferredSize(&width, &height);
+// r.bottom += menuBar->Bounds().Height();
+ r.bottom += height;
+ // see that our calculated minimal width is not smaller than what
+ // the menubar can be
+printf("preferred: width: %f, height: %f - width: %f\n", width, height, r.Width());
+ width -= r.Width();
+ if (width > 0.0)
+ r.right += width;
+ }
Window()->SetSizeLimits(r.Width(), r.Width() * 1.8, r.Height(), r.Height() * 1.3);
if (!Window()->Bounds().Contains(r))
InterfaceWindow* window = dynamic_cast<InterfaceWindow*>(Window());
if (window && window->IsStopped())
fPlayPause->SetStopped();
+
+ unsigned short i_volume;
+ aout_VolumeGet( p_intf, (audio_volume_t*)&i_volume );
+ fVolumeSlider->SetValue( i_volume );
}
// SetProgress
switch( status )
{
case PLAYING_S:
- case FORWARD_S:
- case BACKWARD_S:
- case START_S:
fPlayPause->SetPlaying();
break;
case PAUSE_S:
fPlayPause->SetPaused();
break;
- case UNDEF_S:
- case NOT_STARTED_S:
default:
fPlayPause->SetStopped();
break;
if (rate != fCurrentRate)
{
fCurrentRate = rate;
- if ( rate < DEFAULT_RATE )
+ if ( rate < INPUT_RATE_DEFAULT )
{
// TODO: ...
}
SetHighColor(darkShadow);
SetLowColor(shadow);
// stripes
- float width = floorf(StringWidth(kDisabledSeekMessage));
+ float width = floorf(StringWidth(DISABLED_SEEK_MESSAGE));
float textPos = r.left + r.Width() / 2.0 - width / 2.0;
pattern stripes = {{ 0xc7, 0x8f, 0x1f, 0x3e, 0x7c, 0xf8, 0xf1, 0xe3 }};
BRect stripesRect(r);
SetLowColor(darkShadow);
font_height fh;
GetFontHeight(&fh);
- DrawString(kDisabledSeekMessage, BPoint(textPos, r.top + ceilf(fh.ascent) - 1.0));
+ DrawString(DISABLED_SEEK_MESSAGE, BPoint(textPos, r.top + ceilf(fh.ascent) - 1.0));
}
}
void
SeekSlider::ResizeToPreferred()
{
- float width = 15.0 + StringWidth(kDisabledSeekMessage) + 15.0;
+ float width = 15.0 + StringWidth(DISABLED_SEEK_MESSAGE) + 15.0;
ResizeTo(width, 17.0);
}
float height = ( r.Height() - timeHeight ) / 3.0;
SetFont( &tinyFont );
SetHighColor( 0, 180, 0, 255 );
- DrawString( "File", BPoint( r.left + 3.0, r.top + height ) );
- DrawString( "Title", BPoint( r.left + 3.0, r.top + 2.0 * height ) );
- DrawString( "Chapter", BPoint( r.left + 3.0, r.top + 3.0 * height ) );
+ DrawString( _("File"), BPoint( r.left + 3.0, r.top + height ) );
+ DrawString( _("Title"), BPoint( r.left + 3.0, r.top + 2.0 * height ) );
+ DrawString( _("Chapter"), BPoint( r.left + 3.0, r.top + 3.0 * height ) );
SetFont( &smallFont );
BString helper;
SetHighColor( 0, 255, 0, 255 );
PositionInfoView::_MakeString( BString& into, int32 index, int32 maxIndex ) const
{
into = "";
- if ( index >= 0)
+ if ( index >= 0 && maxIndex >= 0 )
into << index;
else
into << "-";
into << "/";
- if ( maxIndex >= 0)
+ if ( maxIndex >= 0 )
into << maxIndex;
else
into << "-";