diff --git a/src/prefs/media/Jamfile b/src/prefs/media/Jamfile index 9453ea84ae..4ccccb73c2 100644 --- a/src/prefs/media/Jamfile +++ b/src/prefs/media/Jamfile @@ -3,9 +3,8 @@ SubDir OBOS_TOP src prefs media ; UsePrivateHeaders media ; Preference Media : - MediaPrefsApp.cpp - MediaPrefsWindow.cpp - MediaPrefsView.cpp - MediaPrefsSlider.cpp ; + Media.cpp + MediaWindow.cpp + MediaViews.cpp LinkSharedOSLibs Media : be libmedia.so ; \ No newline at end of file diff --git a/src/prefs/media/Media.cpp b/src/prefs/media/Media.cpp new file mode 100644 index 0000000000..cc3f465c6d --- /dev/null +++ b/src/prefs/media/Media.cpp @@ -0,0 +1,72 @@ +/* + +Media by Sikosis + +(C)2003 + +*/ + +// Includes -------------------------------------------------------------------------------------------------- // +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "Media.h" +#include "MediaWindows.h" +#include "MediaViews.h" +#include "MediaConstants.h" +// ---------------------------------------------------------------------------------------------------------- // + +MediaWindow *ptrMediaWindow; + +// Media -- constructor +Media::Media() : BApplication (APP_SIGNATURE) +{ + // Default Window Size - even though we centre the form to the current screen size + BRect screenFrame = (BScreen(B_MAIN_SCREEN_ID).Frame()); + + float FormTopDefault = 0; + float FormLeftDefault = 0; + float FormWidthDefault = 654; + float FormHeightDefault = 392; + + BRect MediaWindowRect(FormTopDefault,FormLeftDefault,FormLeftDefault+FormWidthDefault,FormTopDefault+FormHeightDefault); + + ptrMediaWindow = new MediaWindow(MediaWindowRect); +} +// ---------------------------------------------------------------------------------------------------------- // + + +// Media::MessageReceived -- handles incoming messages +void Media::MessageReceived (BMessage *message) +{ + switch(message->what) + { + default: + BApplication::MessageReceived(message); // pass it along ... + break; + } +} +// ---------------------------------------------------------------------------------------------------------- // + +// Media Main +int main(void) +{ + Media theApp; + theApp.Run(); + return 0; +} +// end ------------------------------------------------------------------------------------------------------ // diff --git a/src/prefs/media/Media.h b/src/prefs/media/Media.h new file mode 100644 index 0000000000..0756334378 --- /dev/null +++ b/src/prefs/media/Media.h @@ -0,0 +1,24 @@ +/* + +Media Header by Sikosis + +(C)2003 + +*/ + +#ifndef __MEDIA_H__ +#define __MEDIA_H__ + +extern const char *APP_SIGNATURE; + +class Media : public BApplication +{ + public: + Media(); + virtual void MessageReceived(BMessage *message); + + private: + +}; + +#endif \ No newline at end of file diff --git a/src/prefs/media/MediaConstants.h b/src/prefs/media/MediaConstants.h new file mode 100644 index 0000000000..4495c31450 --- /dev/null +++ b/src/prefs/media/MediaConstants.h @@ -0,0 +1,16 @@ +/* + +Media Constants by Sikosis + +(C)2003 + +*/ + +#ifndef __MEDIACONSTANTS_H__ +#define __MEDIACONSTANTS_H__ + + +// Constants ------------------------------------------------------------------------------------------------- // +const char *APP_SIGNATURE = "application/x-vnd.OBOS.Media"; // Application Signature and Title + +#endif \ No newline at end of file diff --git a/src/prefs/media/MediaViews.cpp b/src/prefs/media/MediaViews.cpp new file mode 100644 index 0000000000..d97e3b930e --- /dev/null +++ b/src/prefs/media/MediaViews.cpp @@ -0,0 +1,36 @@ +/* + +MediaViews by Sikosis + +(C)2003 + +*/ + +// Includes -------------------------------------------------------------------------------------------------- // +#include +#include +#include +#include +#include +#include + +#include "MediaWindows.h" +#include "MediaViews.h" +//#include "MediaConstants.h" +// ------------------------------------------------------------------------------------------------------------- // + +// MediaView - Constructor +MediaView::MediaView (BRect frame) : BView (frame, "MediaView", B_FOLLOW_ALL_SIDES, B_WILL_DRAW ) +{ + SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); +} +// ---------------------------------------------------------------------------------------------------------- // + + +void MediaView::Draw(BRect updateRect) +{ + BRect r; + r = Bounds(); +} +// ---------------------------------------------------------------------------------------------------------- // + diff --git a/src/prefs/media/MediaViews.h b/src/prefs/media/MediaViews.h new file mode 100644 index 0000000000..677fb5b2e3 --- /dev/null +++ b/src/prefs/media/MediaViews.h @@ -0,0 +1,22 @@ +/* + +MediaViews Header by Sikosis + +(C)2002 + +*/ + +#ifndef __MEDIAVIEWS_H__ +#define __MEDIAVIEWS_H__ + +#include "Media.h" +#include "MediaWindows.h" + +class MediaView : public BView +{ + public: + MediaView(BRect frame); + virtual void Draw(BRect updateRect); +}; + +#endif diff --git a/src/prefs/media/MediaWindow.cpp b/src/prefs/media/MediaWindow.cpp new file mode 100644 index 0000000000..0018f34996 --- /dev/null +++ b/src/prefs/media/MediaWindow.cpp @@ -0,0 +1,104 @@ +/* + +Media - MediaWindow by Sikosis + +(C)2003 + +*/ + + +// Includes -------------------------------------------------------------------------------------------------- // +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "Media.h" +#include "MediaViews.h" +#include "MediaWindows.h" + +// CenterWindowOnScreen -- Centers the BWindow to the Current Screen +static void CenterWindowOnScreen(BWindow* w) +{ + BRect screenFrame = (BScreen(B_MAIN_SCREEN_ID).Frame()); + BPoint pt; + pt.x = screenFrame.Width()/2 - w->Bounds().Width()/2; + pt.y = screenFrame.Height()/2 - w->Bounds().Height()/2; + + if (screenFrame.Contains(pt)) + w->MoveTo(pt); +} +// ---------------------------------------------------------------------------------------------------------- // + + +// MediaWindow - Constructor +MediaWindow::MediaWindow(BRect frame) : BWindow (frame, "OBOS Media", B_TITLED_WINDOW, B_NORMAL_WINDOW_FEEL , 0) +{ + InitWindow(); + CenterWindowOnScreen(this); + Show(); +} + + +// MediaWindow - Destructor +MediaWindow::~MediaWindow() +{ + exit(0); +} + + +// MediaWindow::InitWindow -- Initialization Commands here +void MediaWindow::InitWindow(void) +{ + BRect r; + r = Bounds(); // the whole view + + // Create the Views + AddChild(ptrMediaView = new MediaView(r)); +} +// ---------------------------------------------------------------------------------------------------------- // + + +// MediaWindow::QuitRequested -- Post a message to the app to quit +bool MediaWindow::QuitRequested() +{ + be_app->PostMessage(B_QUIT_REQUESTED); + return true; +} +// ---------------------------------------------------------------------------------------------------------- // + + +// MediaWindow::FrameResized -- When the main frame is resized fix up the other views +void MediaWindow::FrameResized (float width, float height) +{ + // This makes sure our SideBar colours down to the bottom when resized + BRect r; + r = Bounds(); +} +// ---------------------------------------------------------------------------------------------------------- // + + +// MediaWindow::MessageReceived -- receives messages +void MediaWindow::MessageReceived (BMessage *message) +{ + switch(message->what) + { + default: + BWindow::MessageReceived(message); + break; + } +} +// ---------------------------------------------------------------------------------------------------------- // + + diff --git a/src/prefs/media/MediaWindows.h b/src/prefs/media/MediaWindows.h new file mode 100644 index 0000000000..8aa2832937 --- /dev/null +++ b/src/prefs/media/MediaWindows.h @@ -0,0 +1,31 @@ +/* + +Media Windows Header by Sikosis + +(C)2003 + +*/ + +#ifndef __MEDIAWINDOWS_H__ +#define __MEDIAWINDOWS_H__ + +#include "Media.h" +#include "MediaViews.h" + +class MediaView; + +class MediaWindow : public BWindow +{ + public: + MediaWindow(BRect frame); + ~MediaWindow(); + virtual bool QuitRequested(); + virtual void MessageReceived(BMessage *message); + virtual void FrameResized(float width, float height); + private: + void InitWindow(void); + + MediaView* ptrMediaView; +}; + +#endif diff --git a/src/prefs/media/media.rsrc b/src/prefs/media/media.rsrc new file mode 100644 index 0000000000..78aa5cf145 Binary files /dev/null and b/src/prefs/media/media.rsrc differ