Old Media Stuff - will still be used - the slider looks nice ;)
Just putting this code aside for the meantime. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2789 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
4fcc31827d
commit
e0c1abb912
22
src/prefs/media/old/MediaPrefsApp.cpp
Normal file
22
src/prefs/media/old/MediaPrefsApp.cpp
Normal file
@ -0,0 +1,22 @@
|
||||
#include "MediaPrefsApp.h"
|
||||
|
||||
|
||||
MediaPrefsApp::MediaPrefsApp()
|
||||
: BApplication( "application/x-vnd.OBeOS.Media" )
|
||||
{
|
||||
BRect r;
|
||||
|
||||
r.Set( 100, 100, 200, 300 );
|
||||
window = new MediaPrefsWindow( r );
|
||||
window->Show();
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main( int argc, char **argv )
|
||||
{
|
||||
MediaPrefsApp app;
|
||||
|
||||
app.Run();
|
||||
return 0;
|
||||
}
|
12
src/prefs/media/old/MediaPrefsApp.h
Normal file
12
src/prefs/media/old/MediaPrefsApp.h
Normal file
@ -0,0 +1,12 @@
|
||||
#include <Application.h>
|
||||
|
||||
#include "MediaPrefsWindow.h"
|
||||
|
||||
class MediaPrefsApp : public BApplication {
|
||||
|
||||
public:
|
||||
MediaPrefsApp();
|
||||
|
||||
private:
|
||||
MediaPrefsWindow *window;
|
||||
};
|
9
src/prefs/media/old/MediaPrefsSlider.cpp
Normal file
9
src/prefs/media/old/MediaPrefsSlider.cpp
Normal file
@ -0,0 +1,9 @@
|
||||
#include "MediaPrefsSlider.h"
|
||||
//#include "VolumeControl.h"
|
||||
|
||||
|
||||
MediaPrefsSlider::MediaPrefsSlider( BRect r, const char *name, const char *label, BMessage *model,
|
||||
int32 channels, uint32 resize, uint32 flags )
|
||||
: BChannelSlider( r, name, label, model, B_VERTICAL, channels, resize, flags )
|
||||
{
|
||||
}
|
10
src/prefs/media/old/MediaPrefsSlider.h
Normal file
10
src/prefs/media/old/MediaPrefsSlider.h
Normal file
@ -0,0 +1,10 @@
|
||||
#include <ChannelSlider.h>
|
||||
|
||||
#define vI2F (float)(9.999 / 100)
|
||||
|
||||
class MediaPrefsSlider : public BChannelSlider {
|
||||
|
||||
public:
|
||||
MediaPrefsSlider( BRect r, const char *name, const char *label, BMessage *model,
|
||||
int32 channels, uint32 resize, uint32 flags );
|
||||
};
|
7
src/prefs/media/old/MediaPrefsView.cpp
Normal file
7
src/prefs/media/old/MediaPrefsView.cpp
Normal file
@ -0,0 +1,7 @@
|
||||
#include "MediaPrefsView.h"
|
||||
|
||||
|
||||
MediaPrefsView::MediaPrefsView( BRect r, char *name )
|
||||
: BView( r, name, B_FOLLOW_ALL_SIDES, B_WILL_DRAW )
|
||||
{
|
||||
}
|
8
src/prefs/media/old/MediaPrefsView.h
Normal file
8
src/prefs/media/old/MediaPrefsView.h
Normal file
@ -0,0 +1,8 @@
|
||||
#include <View.h>
|
||||
|
||||
class MediaPrefsView : public BView {
|
||||
|
||||
public:
|
||||
MediaPrefsView( BRect r, char *name );
|
||||
|
||||
};
|
65
src/prefs/media/old/MediaPrefsWindow.cpp
Normal file
65
src/prefs/media/old/MediaPrefsWindow.cpp
Normal file
@ -0,0 +1,65 @@
|
||||
#include "MediaPrefsApp.h"
|
||||
//#include "VolumeControl.h"
|
||||
|
||||
|
||||
MediaPrefsWindow::MediaPrefsWindow( BRect wRect )
|
||||
: BWindow( wRect, "Media", B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS )
|
||||
{
|
||||
float fLeft, fRight;
|
||||
int32 iLeft, iRight;
|
||||
|
||||
wRect.OffsetTo( B_ORIGIN );
|
||||
view = new MediaPrefsView( wRect, "MainView" );
|
||||
view->SetViewColor( ui_color( B_PANEL_BACKGROUND_COLOR ) );
|
||||
|
||||
this->AddChild( view );
|
||||
|
||||
slider = new MediaPrefsSlider( wRect, "MasterVol", "Master",
|
||||
new BMessage( 'mVol' ), 2,
|
||||
B_FOLLOW_LEFT|B_FOLLOW_TOP, B_WILL_DRAW );
|
||||
slider->SetLimits( 0, 100 );
|
||||
slider->SetLimitLabels( "0", "100" );
|
||||
|
||||
view->AddChild( slider );
|
||||
|
||||
// use private API
|
||||
// if ( MediaKitPrivate::GetMasterVolume( &fLeft, &fRight ) == B_OK ) {
|
||||
// // left,right range is 0..9.999
|
||||
// iLeft = (int32)( fLeft / vI2F );
|
||||
// iRight = (int32)( fRight / vI2F );
|
||||
// } else {
|
||||
iLeft = 0;
|
||||
iRight = 0;
|
||||
// }
|
||||
|
||||
slider->SetValueFor( 0, iLeft );
|
||||
slider->SetValueFor( 1, iRight );
|
||||
}
|
||||
|
||||
|
||||
bool MediaPrefsWindow::QuitRequested()
|
||||
{
|
||||
be_app->PostMessage( B_QUIT_REQUESTED );
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void MediaPrefsWindow::MessageReceived( BMessage *msg )
|
||||
{
|
||||
switch ( msg->what ) {
|
||||
case 'mVol':
|
||||
{
|
||||
int32 iLeft = slider->ValueFor( 0 );
|
||||
int32 iRight = slider->ValueFor( 1 );
|
||||
|
||||
float fLeft = float( iLeft ) * vI2F;
|
||||
float fRight = float( iRight ) * vI2F;
|
||||
|
||||
// MediaKitPrivate::SetMasterVolume( fLeft, fRight );
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
BWindow::MessageReceived( msg );
|
||||
}
|
||||
}
|
17
src/prefs/media/old/MediaPrefsWindow.h
Normal file
17
src/prefs/media/old/MediaPrefsWindow.h
Normal file
@ -0,0 +1,17 @@
|
||||
#include <Window.h>
|
||||
|
||||
#include "MediaPrefsView.h"
|
||||
#include "MediaPrefsSlider.h"
|
||||
|
||||
|
||||
class MediaPrefsWindow : public BWindow {
|
||||
|
||||
public:
|
||||
MediaPrefsWindow( BRect wRect );
|
||||
virtual bool QuitRequested();
|
||||
virtual void MessageReceived( BMessage *msg );
|
||||
|
||||
private:
|
||||
MediaPrefsView *view;
|
||||
MediaPrefsSlider *slider;
|
||||
};
|
Loading…
Reference in New Issue
Block a user