Commit bf2f5b00 authored by Eric Petit's avatar Eric Petit

Attempt to port new BeOS features from the stable branch.

Playlist is yet broken (maybe others things too)
parent 370ab2b0
...@@ -128,7 +128,7 @@ case "x${target_os}" in ...@@ -128,7 +128,7 @@ case "x${target_os}" in
CXXFLAGS_save="${CXXFLAGS_save} -Wno-multichar -Wno-ctor-dtor-privacy -Woverloaded-virtual"; CXXFLAGS="${CXXFLAGS_save}" CXXFLAGS_save="${CXXFLAGS_save} -Wno-multichar -Wno-ctor-dtor-privacy -Woverloaded-virtual"; CXXFLAGS="${CXXFLAGS_save}"
LDFLAGS_vlc="${LDFLAGS_vlc} -lbe" LDFLAGS_vlc="${LDFLAGS_vlc} -lbe"
LDFLAGS_plugins="${LDFLAGS_plugins} -nostart" LDFLAGS_plugins="${LDFLAGS_plugins} -nostart"
LDFLAGS_beos="${LDFLAGS_beos} -lbe -lgame -lroot -ltracker -lstdc++.r4" LDFLAGS_beos="${LDFLAGS_beos} -lbe -lgame -lroot -ltracker -lstdc++.r4 -ltranslation"
LDFLAGS_ipv4="${LDFLAGS_ipv4} -lbind" LDFLAGS_ipv4="${LDFLAGS_ipv4} -lbind"
;; ;;
x*) x*)
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* render.c : SPU renderer * render.c : SPU renderer
***************************************************************************** *****************************************************************************
* Copyright (C) 2000-2001 VideoLAN * Copyright (C) 2000-2001 VideoLAN
* $Id: render.c,v 1.1 2002/08/16 03:07:56 sam Exp $ * $Id: render.c,v 1.2 2002/09/30 18:30:26 titer Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* Rudolf Cornelissen <rag.cornelissen@inter.nl.net> * Rudolf Cornelissen <rag.cornelissen@inter.nl.net>
...@@ -356,12 +356,12 @@ void E_(RenderSPU)( vout_thread_t *p_vout, picture_t *p_pic, ...@@ -356,12 +356,12 @@ void E_(RenderSPU)( vout_thread_t *p_vout, picture_t *p_pic,
case VLC_FOURCC('Y','U','Y','2'): case VLC_FOURCC('Y','U','Y','2'):
p_dest = p_pic->p->p_pixels + p_dest = p_pic->p->p_pixels +
(p_spu->i_x + p_spu->i_width + + ( p_spu->i_y + p_spu->i_height ) * p_pic->p->i_pitch // * bytes per line
p_vout->output.i_width * ( p_spu->i_y + p_spu->i_height )) * 2; + ( p_spu->i_x + p_spu->i_width ) * 2; // * bytes per pixel
/* Draw until we reach the bottom of the subtitle */ /* Draw until we reach the bottom of the subtitle */
for( i_y = p_spu->i_height * p_vout->output.i_width; for( i_y = p_spu->i_height * p_pic->p->i_pitch / 2;
i_y ; i_y ;
i_y -= p_vout->output.i_width ) i_y -= p_pic->p->i_pitch / 2 )
{ {
/* Draw until we reach the end of the line */ /* Draw until we reach the end of the line */
for( i_x = p_spu->i_width ; i_x ; ) for( i_x = p_spu->i_width ; i_x ; )
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* beos.cpp : BeOS plugin for vlc * beos.cpp : BeOS plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN * Copyright (C) 2000, 2001 VideoLAN
* $Id: BeOS.cpp,v 1.1 2002/08/04 17:23:43 sam Exp $ * $Id: BeOS.cpp,v 1.2 2002/09/30 18:30:27 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>
...@@ -57,4 +57,3 @@ vlc_module_begin(); ...@@ -57,4 +57,3 @@ vlc_module_begin();
set_capability( "audio output", 100 ); set_capability( "audio output", 100 );
set_callbacks( E_(OpenAudio), E_(CloseAudio) ); set_callbacks( E_(OpenAudio), E_(CloseAudio) );
vlc_module_end(); vlc_module_end();
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
...@@ -2,9 +2,10 @@ ...@@ -2,9 +2,10 @@
* DrawingTidbits.h * DrawingTidbits.h
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: DrawingTidbits.h,v 1.1 2002/08/04 17:23:43 sam Exp $ * $Id: DrawingTidbits.h,v 1.2 2002/09/30 18:30:27 titer Exp $
* *
* Authors: Tony Castley <tcastley@mail.powerup.com.au> * Authors: Tony Castley <tcastley@mail.powerup.com.au>
* Stephan Aßmus <stippi@yellowbites.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
...@@ -52,4 +53,37 @@ const float kDimLevel = 0.6; ...@@ -52,4 +53,37 @@ const float kDimLevel = 0.6;
void ReplaceColor(BBitmap *bitmap, rgb_color from, rgb_color to); void ReplaceColor(BBitmap *bitmap, rgb_color from, rgb_color to);
void ReplaceTransparentColor(BBitmap *bitmap, rgb_color with); void ReplaceTransparentColor(BBitmap *bitmap, rgb_color with);
#endif // function can be used to scale the upper left part of
// a bitmap to fill the entire bitmap, ie fromWidth
// and fromHeight must be smaller or equal to the bitmaps size!
// only supported colorspaces are B_RGB32 and B_RGBA32
status_t scale_bitmap( BBitmap* bitmap,
uint32 fromWidth, uint32 fromHeight );
// bitmaps need to be the same size, or this function will fail
// currently supported conversions:
// B_YCbCr422 -> B_RGB32
// B_RGB32 -> B_RGB32
// B_RGB16 -> B_RGB32
// not yet implemented conversions:
// B_YCbCr420 -> B_RGB32
// B_YUV422 -> B_RGB32
status_t convert_bitmap(BBitmap* inBitmap, BBitmap* outBitmap);
// dims bitmap (in place) by finding the distance of
// the color at each pixel to the provided "center" color
// and shortens that distance by dimLevel
// (dimLevel < 1 -> less contrast)
// (dimLevel > 1 -> more contrast)
// (dimLevel < 0 -> inverted colors)
// currently supported colorspaces:
// B_RGB32
// B_RGBA32
// B_CMAP8
status_t dim_bitmap(BBitmap* bitmap, rgb_color center,
float dimLevel);
rgb_color dimmed_color_cmap8(rgb_color color, rgb_color center,
float dimLevel);
#endif // __DRAWING_TIBITS__
/***************************************************************************** /*****************************************************************************
* intf.cpp: beos interface * intf_beos.cpp: beos interface
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN * Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: Interface.cpp,v 1.1 2002/08/04 17:23:43 sam Exp $ * $Id: Interface.cpp,v 1.2 2002/09/30 18:30:27 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>
* Tony Castley <tony@castley.net> * Tony Castley <tony@castley.net>
* Richard Shepherd <richard@rshepherd.demon.co.uk> * Richard Shepherd <richard@rshepherd.demon.co.uk>
* Stephan Aßmus <stippi@yellowbites.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
...@@ -30,6 +31,8 @@ ...@@ -30,6 +31,8 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> /* malloc(), free() */ #include <stdlib.h> /* malloc(), free() */
#include <InterfaceKit.h> #include <InterfaceKit.h>
#include <Application.h>
#include <Message.h>
#include <string.h> #include <string.h>
#include <vlc/vlc.h> #include <vlc/vlc.h>
...@@ -37,6 +40,7 @@ ...@@ -37,6 +40,7 @@
#include "VlcWrapper.h" #include "VlcWrapper.h"
#include "InterfaceWindow.h" #include "InterfaceWindow.h"
#include "MsgVals.h"
/***************************************************************************** /*****************************************************************************
* Local prototype * Local prototype
...@@ -44,7 +48,7 @@ ...@@ -44,7 +48,7 @@
static void Run ( intf_thread_t *p_intf ); static void Run ( intf_thread_t *p_intf );
/***************************************************************************** /*****************************************************************************
* OpenIntf: initialize interface * intf_Open: initialize interface
*****************************************************************************/ *****************************************************************************/
int E_(OpenIntf) ( vlc_object_t *p_this ) int E_(OpenIntf) ( vlc_object_t *p_this )
{ {
...@@ -65,7 +69,7 @@ int E_(OpenIntf) ( vlc_object_t *p_this ) ...@@ -65,7 +69,7 @@ int E_(OpenIntf) ( vlc_object_t *p_this )
msg_Err( p_intf, "out of memory" ); msg_Err( p_intf, "out of memory" );
return( 1 ); return( 1 );
} }
// p_intf->p_sys->p_sub = msg_Subscribe( p_intf );
p_intf->p_sys->p_input = NULL; p_intf->p_sys->p_input = NULL;
p_intf->pf_run = Run; p_intf->pf_run = Run;
...@@ -79,13 +83,21 @@ int E_(OpenIntf) ( vlc_object_t *p_this ) ...@@ -79,13 +83,21 @@ int E_(OpenIntf) ( vlc_object_t *p_this )
free( p_intf->p_sys ); free( p_intf->p_sys );
msg_Err( p_intf, "cannot allocate InterfaceWindow" ); msg_Err( p_intf, "cannot allocate InterfaceWindow" );
return( 1 ); return( 1 );
} else {
BMessage message(INTERFACE_CREATED);
message.AddPointer("window", p_intf->p_sys->p_window);
be_app->PostMessage(&message);
} }
p_intf->p_sys->b_disabled_menus = 0;
p_intf->p_sys->i_saved_volume = AOUT_VOLUME_DEFAULT;
p_intf->p_sys->b_loop = 0;
p_intf->p_sys->b_mute = 0;
return( 0 ); return( 0 );
} }
/***************************************************************************** /*****************************************************************************
* CloseIntf: destroy interface * intf_Close: destroy dummy interface
*****************************************************************************/ *****************************************************************************/
void E_(CloseIntf) ( vlc_object_t *p_this ) void E_(CloseIntf) ( vlc_object_t *p_this )
{ {
...@@ -96,8 +108,6 @@ void E_(CloseIntf) ( vlc_object_t *p_this ) ...@@ -96,8 +108,6 @@ void E_(CloseIntf) ( vlc_object_t *p_this )
vlc_object_release( p_intf->p_sys->p_input ); vlc_object_release( p_intf->p_sys->p_input );
} }
// msg_Unsubscribe( p_intf, p_intf->p_sys->p_sub );
/* Destroy the interface window */ /* Destroy the interface window */
p_intf->p_sys->p_window->Lock(); p_intf->p_sys->p_window->Lock();
p_intf->p_sys->p_window->Quit(); p_intf->p_sys->p_window->Quit();
...@@ -108,7 +118,7 @@ void E_(CloseIntf) ( vlc_object_t *p_this ) ...@@ -108,7 +118,7 @@ void E_(CloseIntf) ( vlc_object_t *p_this )
/***************************************************************************** /*****************************************************************************
* Run: event loop * intf_Run: event loop
*****************************************************************************/ *****************************************************************************/
static void Run( intf_thread_t *p_intf ) static void Run( intf_thread_t *p_intf )
{ {
...@@ -133,11 +143,7 @@ static void Run( intf_thread_t *p_intf ) ...@@ -133,11 +143,7 @@ static void Run( intf_thread_t *p_intf )
FIND_ANYWHERE ); FIND_ANYWHERE );
} }
/* Wait a bit */ /* Wait a bit */
msleep( INTF_IDLE_SLEEP ); msleep( INTF_IDLE_SLEEP );
} }
} }
This diff is collapsed.
...@@ -2,11 +2,12 @@ ...@@ -2,11 +2,12 @@
* InterfaceWindow.h: BeOS interface window class prototype * InterfaceWindow.h: BeOS interface window class prototype
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN * Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: InterfaceWindow.h,v 1.1 2002/08/04 17:23:43 sam Exp $ * $Id: InterfaceWindow.h,v 1.2 2002/09/30 18:30:27 titer Exp $
* *
* Authors: Jean-Marc Dressler <polux@via.ecp.fr> * Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Tony Castley <tcastley@mail.powerup.com.au> * Tony Castley <tcastley@mail.powerup.com.au>
* Richard Shepherd <richard@rshepherd.demon.co.uk> * Richard Shepherd <richard@rshepherd.demon.co.uk>
* Stephan Aßmus <stippi@yellowbites.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
...@@ -22,56 +23,134 @@ ...@@ -22,56 +23,134 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/ *****************************************************************************/
/*****************************************************************************
* intf_sys_t: description and status of FB interface #ifndef BEOS_INTERFACE_WINDOW_H
*****************************************************************************/ #define BEOS_INTERFACE_WINDOW_H
#include <Menu.h>
#include <Window.h>
class BMenuBar;
class MediaControlView; class MediaControlView;
class PlayListWindow; class PlayListWindow;
class BFilePanel;
class CDMenu : public BMenu class CDMenu : public BMenu
{ {
public: public:
CDMenu(const char *name); CDMenu( const char* name );
~CDMenu(); virtual ~CDMenu();
void AttachedToWindow(void);
private: virtual void AttachedToWindow();
int GetCD(const char *directory);
private:
int GetCD( const char* directory );
}; };
class LanguageMenu : public BMenu class LanguageMenu : public BMenu
{ {
public: public:
LanguageMenu(const char *name, int menu_kind, LanguageMenu( const char* name,
intf_thread_t *p_interface); int menu_kind,
~LanguageMenu(); intf_thread_t* p_interface );
void AttachedToWindow(void); virtual ~LanguageMenu();
private:
intf_thread_t *p_intf; virtual void AttachedToWindow();
private:
void _GetChannels();
intf_thread_t* p_intf;
int kind; int kind;
int GetChannels();
}; };
class TitleMenu : public BMenu
{
public:
TitleMenu( const char* name, intf_thread_t *p_interface );
virtual ~TitleMenu();
virtual void AttachedToWindow();
intf_thread_t *p_intf;
};
class ChapterMenu : public BMenu
{
public:
ChapterMenu( const char* name, intf_thread_t *p_interface );
virtual ~ChapterMenu();
virtual void AttachedToWindow();
intf_thread_t *p_intf;
};
class InterfaceWindow : public BWindow class InterfaceWindow : public BWindow
{ {
public: public:
InterfaceWindow( BRect frame, const char *name, InterfaceWindow( BRect frame,
intf_thread_t *p_interface ); const char* name,
~InterfaceWindow(); intf_thread_t* p_interface );
virtual ~InterfaceWindow();
// standard window member // BWindow
virtual void FrameResized( float width, float height );
virtual void MessageReceived( BMessage* message );
virtual bool QuitRequested(); virtual bool QuitRequested();
virtual void MessageReceived(BMessage *message);
// InterfaceWindow
void updateInterface(); void updateInterface();
bool IsStopped() const;
MediaControlView *p_mediaControl; MediaControlView* p_mediaControl;
private:
void _UpdatePlaylist();
void _SetMenusEnabled( bool hasFile,
bool hasChapters = false,
bool hasTitles = false );
void _UpdateSpeedMenu( int rate );
void _InputStreamChanged();
status_t _LoadSettings( BMessage* message,
const char* fileName,
const char* subFolder = NULL );
status_t _SaveSettings( BMessage* message,
const char* fileName,
const char* subFolder = NULL );
void _RestoreSettings();
void _StoreSettings();
intf_thread_t* p_intf;
es_descriptor_t* p_audio_es;
es_descriptor_t* p_spu_es;
input_thread_t* fInputThread;
bool fPlaylistIsEmpty;
BFilePanel* fFilePanel;
PlayListWindow* fPlaylistWindow;
BMenuBar* fMenuBar;
BMenuItem* fNextTitleMI;
BMenuItem* fPrevTitleMI;
BMenuItem* fNextChapterMI;
BMenuItem* fPrevChapterMI;
BMenuItem* fOnTopMI;
BMenuItem* fSlowerMI;
BMenuItem* fNormalMI;
BMenuItem* fFasterMI;
BMenu* fAudioMenu;
BMenu* fNavigationMenu;
BMenu* fTitleMenu;
BMenu* fChapterMenu;
BMenu* fLanguageMenu;
BMenu* fSubtitlesMenu;
BMenu* fSpeedMenu;
bigtime_t fLastUpdateTime;
BMessage* fSettings; // we keep the message arround
// for forward compatibility
private:
intf_thread_t *p_intf;
bool b_empty_playlist;
bool b_mute;
BFilePanel *file_panel;
PlayListWindow* playlist_window;
BMenuItem *miOnTop;
Intf_VLCWrapper * p_vlc_wrapper; Intf_VLCWrapper * p_vlc_wrapper;
}; };
#endif // BEOS_INTERFACE_WINDOW_H
This diff is collapsed.
/*****************************************************************************
* ListViews.h: BeOS interface list view class prototype
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: ListViews.h,v 1.1 2002/09/30 18:30:27 titer Exp $
*
* Authors: Stephan Aßmus <stippi@yellowbites.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#ifndef LIST_VIEWS_H
#define LIST_VIEWS_H
#include <ListItem.h>
#include <ListView.h>
class InterfaceWindow;
// PlaylistItem
class PlaylistItem : public BStringItem
{
public:
PlaylistItem( const char* name );
virtual ~PlaylistItem();
virtual void Draw( BView* owner, BRect frame,
bool tintedLine,
bool active = false,
bool playing = false );
};
// DragSortableListView
class DragSortableListView : public BListView
{
public:
DragSortableListView( BRect frame,
const char* name,
list_view_type type
= B_SINGLE_SELECTION_LIST,
uint32 resizingMode
= B_FOLLOW_LEFT
| B_FOLLOW_TOP,
uint32 flags
= B_WILL_DRAW
| B_NAVIGABLE
| B_FRAME_EVENTS );
virtual ~DragSortableListView();
// BListView
virtual void Draw( BRect updateRect );
virtual bool InitiateDrag( BPoint point, int32 index,
bool wasSelected );
virtual void MessageReceived( BMessage* message );
virtual void MouseMoved( BPoint where, uint32 transit,
const BMessage* dragMessage );
virtual void MouseUp( BPoint where );
virtual void WindowActivated( bool active );
virtual void DrawItem( BListItem *item, BRect itemFrame,
bool complete = false);
// DragSortableListView
virtual BListItem* CloneItem( int32 atIndex ) const = 0;
virtual void DrawListItem( BView* owner, int32 index,
BRect itemFrame ) const = 0;
virtual void MakeDragMessage( BMessage* message ) const = 0;
private:
int32 fDropIndex;
};
// PlaylistView
class PlaylistView : public DragSortableListView
{
public:
PlaylistView( BRect frame,
InterfaceWindow* mainWindow );
~PlaylistView();
// BListView
virtual void AttachedToWindow();
virtual void MouseDown( BPoint where );
virtual void KeyDown( const char* bytes, int32 numBytes );
virtual void Pulse();
// DragSortableListView
virtual BListItem* CloneItem( int32 atIndex ) const;
virtual void DrawListItem( BView* owner, int32 index,
BRect itemFrame ) const;
virtual void MakeDragMessage( BMessage* message ) const;
// PlaylistView
void SetCurrent( int32 index );
void SetPlaying( bool playing );
private:
int32 fCurrentIndex;
bool fPlaying;
InterfaceWindow* fMainWindow;
};
#endif // LIST_VIEWS_H
This diff is collapsed.
...@@ -2,9 +2,10 @@ ...@@ -2,9 +2,10 @@
* MediaControlView.h: beos interface * MediaControlView.h: beos interface
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN * Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: MediaControlView.h,v 1.1 2002/08/04 17:23:43 sam Exp $ * $Id: MediaControlView.h,v 1.2 2002/09/30 18:30:27 titer Exp $
* *
* Authors: Tony Castley <tony@castley.net> * Authors: Tony Castley <tony@castley.net>
* Stephan Aßmus <stippi@yellowbites.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
...@@ -20,73 +21,148 @@ ...@@ -20,73 +21,148 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/ *****************************************************************************/
#define HORZ_SPACE 5.0
#define VERT_SPACE 5.0
#ifndef BEOS_MEDIA_CONTROL_VIEW_H
#define BEOS_MEDIA_CONTROL_VIEW_H
class TransportButton; #include <Box.h>
#include <Control.h>
class BBitmap;
class PlayPauseButton; class PlayPauseButton;
class MediaSlider;
class SeekSlider; class SeekSlider;
class TransportButton;
class VolumeSlider;
class MediaControlView : public BBox class MediaControlView : public BBox
{ {
public: public:
MediaControlView( BRect frame ); MediaControlView( BRect frame );
~MediaControlView(); virtual ~MediaControlView();
// BBox
virtual void AttachedToWindow();
virtual void FrameResized(float width, float height);
virtual void GetPreferredSize(float* width, float* height);
virtual void MessageReceived(BMessage* message);
virtual void Pulse(); // detect stopped stream
virtual void MessageReceived(BMessage *message); // MediaControlView
void SetProgress(uint64 seek, uint64 size); void SetProgress(uint64 seek, uint64 size);
void SetStatus(int status, int rate); void SetStatus(int status, int rate);
void SetEnabled(bool); void SetEnabled(bool enable);
uint32 GetSeekTo(); void SetAudioEnabled(bool enable);
uint32 GetVolume(); uint32 GetSeekTo() const;
uint32 GetVolume() const;
void SetSkippable(bool backward,
bool forward);
void SetMuted(bool mute);
sem_id fScrubSem; sem_id fScrubSem;
bool fSeeking;
private: private:
MediaSlider * p_vol; void _LayoutControls(BRect frame) const;
SeekSlider * p_seek; BRect _MinFrame() const;
TransportButton* p_slow; void _LayoutControl(BView* view,
PlayPauseButton* p_play; BRect frame,
TransportButton* p_fast; bool resize = false) const;
TransportButton* p_stop;
TransportButton* p_mute;
VolumeSlider* fVolumeSlider;
int current_rate; SeekSlider* fSeekSlider;
int current_status; TransportButton* fSkipBack;
TransportButton* fSkipForward;
TransportButton* fRewind;
TransportButton* fForward;
PlayPauseButton* fPlayPause;
TransportButton* fStop;
TransportButton* fMute;
int fCurrentRate;
int fCurrentStatus;
float fBottomControlHeight;
BRect fOldBounds;
}; };
class MediaSlider : public BSlider class SeekSlider : public BControl
{ {
public: public:
MediaSlider(BRect frame, SeekSlider(BRect frame,
BMessage *message, const char* name,
MediaControlView* owner,
int32 minValue, int32 minValue,
int32 maxValue); int32 maxValue);
~MediaSlider();
virtual void DrawThumb(void);
};
virtual ~SeekSlider();
class SeekSlider : public MediaSlider // BControl
{ virtual void AttachedToWindow();
public: virtual void Draw(BRect updateRect);
SeekSlider(BRect frame, virtual void MouseDown(BPoint where);
MediaControlView *owner, virtual void MouseMoved(BPoint where, uint32 transit,
int32 minValue, const BMessage* dragMessage);
int32 maxValue, virtual void MouseUp(BPoint where);
thumb_style thumbType = B_TRIANGLE_THUMB); virtual void ResizeToPreferred();
// SeekSlider
void SetPosition(float position);
~SeekSlider();
uint32 seekTo;
virtual void MouseDown(BPoint);
virtual void MouseUp(BPoint pt);
virtual void MouseMoved(BPoint pt, uint32 c, const BMessage *m);
private: private:
int32 _ValueFor(float x) const;
void _StrokeFrame(BRect frame,
rgb_color left,
rgb_color top,
rgb_color right,
rgb_color bottom);
void _BeginSeek();
void _Seek();
void _EndSeek();
MediaControlView* fOwner; MediaControlView* fOwner;
bool fMouseDown; bool fTracking;
int32 fMinValue;
int32 fMaxValue;
}; };
class VolumeSlider : public BControl
{
public:
VolumeSlider(BRect frame,
const char* name,
int32 minValue,
int32 maxValue,
BMessage* message = NULL,
BHandler* target = NULL);
virtual ~VolumeSlider();
// BControl
virtual void AttachedToWindow();
virtual void SetValue(int32 value);
virtual void SetEnabled(bool enable);
virtual void Draw(BRect updateRect);
virtual void MouseDown(BPoint where);
virtual void MouseMoved(BPoint where, uint32 transit,
const BMessage* dragMessage);
virtual void MouseUp(BPoint where);
// VolumeSlider
bool IsValid() const;
void SetMuted(bool mute);
private:
void _MakeBitmaps();
void _DimBitmap(BBitmap* bitmap);
int32 _ValueFor(float xPos) const;
BBitmap* fLeftSideBits;
BBitmap* fRightSideBits;
BBitmap* fKnobBits;
bool fTracking;
bool fMuted;
int32 fMinValue;
int32 fMaxValue;
};
#endif // BEOS_MEDIA_CONTROL_VIEW_H
...@@ -4,6 +4,7 @@ SOURCES_beos = \ ...@@ -4,6 +4,7 @@ SOURCES_beos = \
modules/gui/beos/VideoOutput.cpp \ modules/gui/beos/VideoOutput.cpp \
modules/gui/beos/Interface.cpp \ modules/gui/beos/Interface.cpp \
modules/gui/beos/InterfaceWindow.cpp \ modules/gui/beos/InterfaceWindow.cpp \
modules/gui/beos/ListViews.cpp \
modules/gui/beos/DrawingTidbits.cpp \ modules/gui/beos/DrawingTidbits.cpp \
modules/gui/beos/TransportButton.cpp \ modules/gui/beos/TransportButton.cpp \
modules/gui/beos/PlayListWindow.cpp \ modules/gui/beos/PlayListWindow.cpp \
...@@ -14,6 +15,7 @@ noinst_HEADERS += \ ...@@ -14,6 +15,7 @@ noinst_HEADERS += \
modules/gui/beos/Bitmaps.h \ modules/gui/beos/Bitmaps.h \
modules/gui/beos/DrawingTidbits.h \ modules/gui/beos/DrawingTidbits.h \
modules/gui/beos/InterfaceWindow.h \ modules/gui/beos/InterfaceWindow.h \
modules/gui/beos/ListViews.h \
modules/gui/beos/MediaControlView.h \ modules/gui/beos/MediaControlView.h \
modules/gui/beos/MsgVals.h \ modules/gui/beos/MsgVals.h \
modules/gui/beos/PlayListWindow.h \ modules/gui/beos/PlayListWindow.h \
......
...@@ -2,9 +2,10 @@ ...@@ -2,9 +2,10 @@
* MsgVals.h * MsgVals.h
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: MsgVals.h,v 1.1 2002/08/04 17:23:43 sam Exp $ * $Id: MsgVals.h,v 1.2 2002/09/30 18:30:27 titer Exp $
* *
* Authors: Tony Castley <tcastley@mail.powerup.com.au> * Authors: Tony Castley <tcastley@mail.powerup.com.au>
* Stephan Aßmus <stippi@yellowbites.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
...@@ -21,32 +22,47 @@ ...@@ -21,32 +22,47 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/ *****************************************************************************/
/* MsgVals.h */ #ifndef BEOS_MESSAGE_VALUES_H
#define BEOS_MESSAGE_VALUES_H
#define PLAYING 0 #define PLAYING 0
#define PAUSED 1 #define PAUSED 1
const uint32 OPEN_FILE = 'OPFL'; const uint32 OPEN_FILE = 'opfl';
const uint32 OPEN_DVD = 'OPDV'; const uint32 OPEN_DVD = 'opdv';
const uint32 OPEN_PLAYLIST = 'OPPL'; const uint32 OPEN_PLAYLIST = 'oppl';
const uint32 STOP_PLAYBACK = 'STPL'; const uint32 STOP_PLAYBACK = 'stpl';
const uint32 START_PLAYBACK = 'PLAY'; const uint32 START_PLAYBACK = 'play';
const uint32 PAUSE_PLAYBACK = 'PAPL'; const uint32 PAUSE_PLAYBACK = 'papl';
const uint32 FASTER_PLAY = 'FAPL'; const uint32 FASTER_PLAY = 'fapl';
const uint32 SLOWER_PLAY = 'SLPL'; const uint32 SLOWER_PLAY = 'slpl';
const uint32 SEEK_PLAYBACK = 'SEEK'; const uint32 NORMAL_PLAY = 'nrpl';
const uint32 VOLUME_CHG = 'VOCH'; const uint32 SEEK_PLAYBACK = 'seek';
const uint32 VOLUME_MUTE = 'MUTE'; const uint32 VOLUME_CHG = 'voch';
const uint32 SELECT_AUDIO = 'AUDI'; const uint32 VOLUME_MUTE = 'mute';
const uint32 SELECT_SUBTITLE = 'SUBT'; const uint32 SELECT_CHANNEL = 'chan';
const uint32 PREV_TITLE = 'PRTI'; const uint32 SELECT_SUBTITLE = 'subt';
const uint32 NEXT_TITLE = 'NXTI'; const uint32 PREV_TITLE = 'prti';
const uint32 PREV_CHAPTER = 'PRCH'; const uint32 NEXT_TITLE = 'nxti';
const uint32 NEXT_CHAPTER = 'NXCH'; const uint32 TOGGLE_TITLE = 'tgti';
const uint32 TOGGLE_ON_TOP = 'ONTP'; const uint32 PREV_CHAPTER = 'prch';
const uint32 TOGGLE_FULL_SCREEN = 'TGFS'; const uint32 NEXT_CHAPTER = 'nxch';
const uint32 RESIZE_100 = 'RSOR'; const uint32 TOGGLE_CHAPTER = 'tgch';
const uint32 RESIZE_200 = 'RSDB'; const uint32 PREV_FILE = 'prfl';
const uint32 ASPECT_CORRECT = 'ASCO'; const uint32 NEXT_FILE = 'nxfl';
const uint32 VERT_SYNC = 'VSYN'; const uint32 NAVIGATE_PREV = 'navp'; // could be chapter, title or file
const uint32 WINDOW_FEEL = 'WFEL'; const uint32 NAVIGATE_NEXT = 'navn'; // could be chapter, title or file
const uint32 TOGGLE_ON_TOP = 'ontp';
const uint32 TOGGLE_FULL_SCREEN = 'tgfs';
const uint32 RESIZE_50 = 'rshl';
const uint32 RESIZE_100 = 'rsor';
const uint32 RESIZE_200 = 'rsdb';
const uint32 RESIZE_TRUE = 'rstr';
const uint32 ASPECT_CORRECT = 'asco';
const uint32 VERT_SYNC = 'vsyn';
const uint32 WINDOW_FEEL = 'wfel';
const uint32 SCREEN_SHOT = 'scrn';
const uint32 INTERFACE_CREATED = 'ifcr'; /* see VlcApplication::MessageReceived()
* in src/misc/beos_specific.cpp */
#endif // BEOS_MESSAGE_VALUES_H
This diff is collapsed.
...@@ -2,11 +2,12 @@ ...@@ -2,11 +2,12 @@
* PlayListWindow.h: BeOS interface window class prototype * PlayListWindow.h: BeOS interface window class prototype
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN * Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: PlayListWindow.h,v 1.1 2002/08/04 17:23:43 sam Exp $ * $Id: PlayListWindow.h,v 1.2 2002/09/30 18:30:27 titer Exp $
* *
* Authors: Jean-Marc Dressler <polux@via.ecp.fr> * Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Tony Castley <tcastley@mail.powerup.com.au> * Tony Castley <tcastley@mail.powerup.com.au>
* Richard Shepherd <richard@rshepherd.demon.co.uk> * Richard Shepherd <richard@rshepherd.demon.co.uk>
* Stephan Aßmus <stippi@yellowbites.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
...@@ -22,24 +23,43 @@ ...@@ -22,24 +23,43 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/ *****************************************************************************/
#ifndef BEOS_PLAY_LIST_WINDOW_H
#define BEOS_PLAY_LIST_WINDOW_H
#include <Window.h>
class BListView;
class CDMenu; class CDMenu;
class InterfaceWindow;
class PlaylistView;
class PlayListWindow : public BWindow class PlayListWindow : public BWindow
{ {
public: public:
static PlayListWindow *getPlayList(BRect frame, const char *name, PlayListWindow(BRect frame,
playlist_t *p_pl); const char* name,
~PlayListWindow(); playlist_t* playlist,
bool QuitRequested(); InterfaceWindow* mainWindow );
void ReallyQuit(); virtual ~PlayListWindow();
// standard window member // BWindow
virtual bool QuitRequested();
virtual void MessageReceived(BMessage *message); virtual void MessageReceived(BMessage *message);
virtual void FrameResized(float width, float height);
// PlayListWindow
void ReallyQuit();
void UpdatePlaylist( bool rebuild = false );
private:
private: playlist_t* fPlaylist;
PlayListWindow( BRect frame, const char *name, playlist_t *p_pl); PlaylistView* fListView;
playlist_t *p_playlist; BView* fBackgroundView;
BListView *p_listview; BMenuBar* fMenuBar;
BFilePanel *file_panel; InterfaceWindow* fMainWindow;
}; };
#endif // BEOS_PLAY_LIST_WINDOW_H
...@@ -2,9 +2,10 @@ ...@@ -2,9 +2,10 @@
* TransportButton.cpp * TransportButton.cpp
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: TransportButton.cpp,v 1.1 2002/08/04 17:23:43 sam Exp $ * $Id: TransportButton.cpp,v 1.2 2002/09/30 18:30:27 titer Exp $
* *
* Authors: Tony Castley <tcastley@mail.powerup.com.au> * Authors: Tony Castley <tcastley@mail.powerup.com.au>
* Stephan Aßmus <stippi@yellowbites.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
...@@ -246,10 +247,8 @@ TransportButton::AttachedToWindow() ...@@ -246,10 +247,8 @@ TransportButton::AttachedToWindow()
void void
TransportButton::DetachedFromWindow() TransportButton::DetachedFromWindow()
{ {
if (keyPressFilter) { if (keyPressFilter)
Window()->RemoveCommonFilter(keyPressFilter); Window()->RemoveCommonFilter(keyPressFilter);
delete keyPressFilter;
}
_inherited::DetachedFromWindow(); _inherited::DetachedFromWindow();
} }
...@@ -260,6 +259,7 @@ TransportButton::~TransportButton() ...@@ -260,6 +259,7 @@ TransportButton::~TransportButton()
delete pressingMessage; delete pressingMessage;
delete donePressingMessage; delete donePressingMessage;
delete bitmaps; delete bitmaps;
delete keyPressFilter;
} }
void void
...@@ -274,9 +274,11 @@ TransportButton::WindowActivated(bool state) ...@@ -274,9 +274,11 @@ TransportButton::WindowActivated(bool state)
void void
TransportButton::SetEnabled(bool on) TransportButton::SetEnabled(bool on)
{ {
if (on != IsEnabled()) {
_inherited::SetEnabled(on); _inherited::SetEnabled(on);
if (!on) if (!on)
ShortcutKeyUp(); ShortcutKeyUp();
}
} }
const unsigned char * const unsigned char *
...@@ -300,11 +302,31 @@ TransportButton::BitsForMask(uint32 mask) const ...@@ -300,11 +302,31 @@ TransportButton::BitsForMask(uint32 mask) const
BBitmap * BBitmap *
TransportButton::MakeBitmap(uint32 mask) TransportButton::MakeBitmap(uint32 mask)
{ {
BBitmap *result = new BBitmap(Bounds(), B_COLOR_8_BIT); BRect r(Bounds());
result->SetBits(BitsForMask(mask), (Bounds().Width() + 1) * (Bounds().Height() + 1), BBitmap *result = new BBitmap(r, B_CMAP8);
0, B_COLOR_8_BIT);
uint8* src = (uint8*)BitsForMask(mask);
if (src && result && result->IsValid()) {
int32 width = r.IntegerWidth() + 1;
int32 height = r.IntegerHeight() + 1;
int32 bpr = result->BytesPerRow();
uint8* dst = (uint8*)result->Bits();
// copy source bits into bitmap line by line,
// taking possible alignment into account
// since the source data has been generated
// by QuickRes, it still contains aligment too
// (hence skipping bpr and not width bytes)
for (int32 y = 0; y < height; y++) {
memcpy(dst, src, bpr);
src += bpr;
dst += bpr;
}
ReplaceTransparentColor(result, Parent()->ViewColor()); ReplaceTransparentColor(result, Parent()->ViewColor());
} else {
delete result;
result = NULL;
}
return result; return result;
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* TransportButton.h * TransportButton.h
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: TransportButton.h,v 1.1 2002/08/04 17:23:43 sam Exp $ * $Id: TransportButton.h,v 1.2 2002/09/30 18:30:27 titer Exp $
* *
* Authors: Tony Castley <tcastley@mail.powerup.com.au> * Authors: Tony Castley <tcastley@mail.powerup.com.au>
* *
...@@ -180,4 +180,4 @@ private: ...@@ -180,4 +180,4 @@ private:
typedef TransportButton _inherited; typedef TransportButton _inherited;
}; };
#endif #endif // __MEDIA_BUTTON__
This diff is collapsed.
...@@ -2,11 +2,12 @@ ...@@ -2,11 +2,12 @@
* VideoWindow.h: BeOS video window class prototype * VideoWindow.h: BeOS video window class prototype
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN * Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: VideoWindow.h,v 1.1 2002/08/04 17:23:43 sam Exp $ * $Id: VideoWindow.h,v 1.2 2002/09/30 18:30:27 titer Exp $
* *
* Authors: Jean-Marc Dressler <polux@via.ecp.fr> * Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Tony Castley <tcastley@mail.powerup.com.au> * Tony Castley <tcastley@mail.powerup.com.au>
* Richard Shepherd <richard@rshepherd.demon.co.uk> * Richard Shepherd <richard@rshepherd.demon.co.uk>
* Stephan Aßmus <stippi@yellowbites.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
...@@ -22,6 +23,13 @@ ...@@ -22,6 +23,13 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/ *****************************************************************************/
#ifndef BEOS_VIDEO_WINDOW_H
#define BEOS_VIDEO_WINDOW_H
#include <View.h>
#include <Window.h>
#define BITMAP 0 #define BITMAP 0
#define OVERLAY 1 #define OVERLAY 1
#define OPENGL 2 #define OPENGL 2
...@@ -50,48 +58,102 @@ colorcombo colspace[]= ...@@ -50,48 +58,102 @@ colorcombo colspace[]=
class VLCView : public BView class VLCView : public BView
{ {
public: public:
VLCView( BRect bounds); VLCView( BRect bounds);
~VLCView(); virtual ~VLCView();
virtual void AttachedToWindow();
virtual void MouseDown(BPoint where);
virtual void MouseMoved(BPoint where, uint32 transit,
const BMessage* dragMessage);
virtual void Pulse();
virtual void Draw(BRect updateRect);
virtual void KeyDown(const char* bytes, int32 numBytes);
void MouseDown(BPoint point); private:
void Draw(BRect updateRect); bigtime_t fLastMouseMovedTime;
bool fCursorHidden;
bool fCursorInside;
bool fIgnoreDoubleClick;
}; };
class VideoWindow : public BWindow class VideoWindow : public BWindow
{ {
public: public:
// standard constructor and destructor VideoWindow(int v_width,
VideoWindow( int v_width, int v_height, int v_height,
BRect frame); BRect frame);
~VideoWindow(); virtual ~VideoWindow();
// BWindow
virtual void MessageReceived(BMessage* message);
virtual void Zoom(BPoint origin,
float width, float height);
virtual void FrameResized(float width, float height);
virtual void FrameMoved(BPoint origin);
virtual void ScreenChanged(BRect frame,
color_space mode);
virtual void WindowActivated(bool active);
void Zoom(BPoint origin, float width, float height); // VideoWindow
void FrameResized(float width, float height);
void FrameMoved(BPoint origin);
void ScreenChanged(BRect frame, color_space mode);
void drawBuffer(int bufferIndex); void drawBuffer(int bufferIndex);
void WindowActivated(bool active);
int SelectDrawingMode(int width, int height); void ToggleInterfaceShowing();
void MessageReceived(BMessage *message); void SetInterfaceShowing(bool showIt);
void SetCorrectAspectRatio(bool doIt);
inline bool CorrectAspectRatio() const
{ return fCorrectAspect; }
inline status_t InitCheck() const
{ return fInitStatus; }
// this is the hook controling direct screen connection // this is the hook controling direct screen connection
int32 i_width; // incomming bitmap size int32 i_width; // aspect corrected bitmap size
int32 i_height; int32 i_height;
BRect winSize; // current window size BRect winSize; // current window size
bool is_zoomed, vsync; bool is_zoomed, vsync;
BBitmap *bitmap[3]; BBitmap *bitmap[3];
BBitmap *overlaybitmap;
VLCView *view; VLCView *view;
int i_buffer; int i_buffer;
bool teardownwindow; volatile bool teardownwindow;
thread_id fDrawThreadID; thread_id fDrawThreadID;
int mode; int mode;
int colspace_index; int colspace_index;
private: private:
vout_thread_t *p_vout; status_t _AllocateBuffers(int width,
int height,
int* mode);
void _FreeBuffers();
void _BlankBitmap(BBitmap* bitmap) const;
void _SetVideoSize(uint32 mode);
void _SaveScreenShot( BBitmap* bitmap,
char* path,
uint32 translatorID ) const;
static int32 _save_screen_shot( void* cookie );
struct screen_shot_info
{
BBitmap* bitmap;
char* path;
uint32 translatorID;
int32 width;
int32 height;
};
struct vout_thread_s *p_vout;
int32 fTrueWidth; // incomming bitmap size
int32 fTrueHeight;
bool fCorrectAspect;
window_feel fCachedFeel;
bool fInterfaceShowing;
status_t fInitStatus;
}; };
#endif // BEOS_VIDEO_WINDOW_H
This diff is collapsed.
This diff is collapsed.
No preview for this file type
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* beos_init.cpp: Initialization for BeOS specific features * beos_init.cpp: Initialization for BeOS specific features
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2001 VideoLAN * Copyright (C) 1999-2001 VideoLAN
* $Id: beos_specific.cpp,v 1.25 2002/08/29 23:53:22 massiot Exp $ * $Id: beos_specific.cpp,v 1.26 2002/09/30 18:30:28 titer Exp $
* *
* Authors: Jean-Marc Dressler <polux@via.ecp.fr> * Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* *
...@@ -24,6 +24,9 @@ ...@@ -24,6 +24,9 @@
#include <Roster.h> #include <Roster.h>
#include <Path.h> #include <Path.h>
#include <Alert.h> #include <Alert.h>
#include <Message.h>
#include <Window.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> /* strdup() */ #include <string.h> /* strdup() */
#include <malloc.h> /* free() */ #include <malloc.h> /* free() */
...@@ -46,6 +49,12 @@ public: ...@@ -46,6 +49,12 @@ public:
virtual void ReadyToRun(); virtual void ReadyToRun();
virtual void AboutRequested(); virtual void AboutRequested();
virtual void RefsReceived(BMessage* message);
virtual void MessageReceived(BMessage* message);
private:
BWindow* fInterfaceWindow;
BMessage* fRefsMessage;
}; };
/***************************************************************************** /*****************************************************************************
...@@ -53,6 +62,9 @@ public: ...@@ -53,6 +62,9 @@ public:
*****************************************************************************/ *****************************************************************************/
static char * psz_program_path; static char * psz_program_path;
//const uint32 INTERFACE_CREATED = 'ifcr'; /* message sent from interface */
#include "../../modules/gui/beos/MsgVals.h"
extern "C" extern "C"
{ {
...@@ -125,7 +137,9 @@ static void AppThread( vlc_object_t * p_this ) ...@@ -125,7 +137,9 @@ static void AppThread( vlc_object_t * p_this )
* VlcApplication: application constructor * VlcApplication: application constructor
*****************************************************************************/ *****************************************************************************/
VlcApplication::VlcApplication( char * psz_mimetype ) VlcApplication::VlcApplication( char * psz_mimetype )
:BApplication( psz_mimetype ) :BApplication( psz_mimetype ),
fInterfaceWindow( NULL ),
fRefsMessage( NULL )
{ {
/* Nothing to do, we use the default constructor */ /* Nothing to do, we use the default constructor */
} }
...@@ -136,6 +150,7 @@ VlcApplication::VlcApplication( char * psz_mimetype ) ...@@ -136,6 +150,7 @@ VlcApplication::VlcApplication( char * psz_mimetype )
VlcApplication::~VlcApplication( ) VlcApplication::~VlcApplication( )
{ {
/* Nothing to do, we use the default destructor */ /* Nothing to do, we use the default destructor */
delete fRefsMessage;
} }
/***************************************************************************** /*****************************************************************************
...@@ -168,3 +183,48 @@ void VlcApplication::ReadyToRun( ) ...@@ -168,3 +183,48 @@ void VlcApplication::ReadyToRun( )
/* Tell the main thread we are finished initializing the BApplication */ /* Tell the main thread we are finished initializing the BApplication */
vlc_thread_ready( p_this ); vlc_thread_ready( p_this );
} }
/*****************************************************************************
* RefsReceived: called when files are sent to our application
* (for example when the user drops fils onto our icon)
*****************************************************************************/
void VlcApplication::RefsReceived(BMessage* message)
{
if (fInterfaceWindow)
fInterfaceWindow->PostMessage(message);
else {
delete fRefsMessage;
fRefsMessage = new BMessage(*message);
}
}
/*****************************************************************************
* MessageReceived: a BeOS applications main message loop
* Since VlcApplication and interface are separated
* in the vlc binary and the interface plugin,
* we use this method to "stick" them together.
* The interface will post a message to the global
* "be_app" pointer when the interface is created
* containing a pointer to the interface window.
* In this way, we can keep a B_REFS_RECEIVED message
* in store for the interface window to handle later.
*****************************************************************************/
void VlcApplication::MessageReceived(BMessage* message)
{
switch (message->what) {
case INTERFACE_CREATED: {
BWindow* interfaceWindow;
if (message->FindPointer("window", (void**)&interfaceWindow) == B_OK) {
fInterfaceWindow = interfaceWindow;
if (fRefsMessage) {
fInterfaceWindow->PostMessage(fRefsMessage);
delete fRefsMessage;
fRefsMessage = NULL;
}
}
break;
}
default:
BApplication::MessageReceived(message);
}
}
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