Commit 4a9a8422 authored by Tony Castley's avatar Tony Castley

src/misc/beos_specific.cpp:

- Implemented VlcApplication::RefsReceived()
- this added ability to open a file by dropping its icon onto the vlc icon
- this makes Open With... work as well
plugins/beos/intf_beos.cpp
- A message is sent to be_app when the interface is created
	(needed to support BApplication::RefsReceived())
plugins/beos/vout_beos.cpp
- reacts on Escape and Tab key to switch fullscreen/window mode
- blanks cursor when no activity
- Fixed a memory leak in VideoWindow::ScreenChanged()
- Fixed the ugly scrambled video content before any decoding actually begins
- Added selectable aspect ratio correction
- Added better error handling when setting the drawing mode
plugins/beos/InterfaceWindow.h/.cpp
- Implemented dynamic view layout
- Fixed crashes in MessageReceived() when no file was loaded
- Implemented disabling of menus when no file is loaded
- Added "Speed" menu
- Added ability to enable navigation menu items according to features of current stream
- Cleaned up code somewhat
- Changed parts of LanguageMenu::GetChannels() to show more user friendly and no invalid entries
- better support for muting and volume info
- better support for scrubbing and detection of stopped stream
plugins/beos/MediaControlView.h/.cpp
- Added dynamic layout of elements
- Exchanged rewind/fastforward buttons for skip buttons that skip to the next chapter if stream supports it.
- made nicer looking SeekSlider similar to BeOS MediaPlayer
- made VolumeSlider similar to BeOS MediaPlayer, plus additional features that one doesn't have (muted state)
- got rid of MediaSlider (no need for it anymore)
- detection of stopped stream
plugins/beos/Bitmaps.h
- Added bitmaps for VolumeSlider
plugins/beos/intf_vlc_wrapper.h/.cpp
- added set_volume() and is_muted() functions
- fixed a bug in toggle_muted()
parent a25aaff5
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -2,9 +2,10 @@ ...@@ -2,9 +2,10 @@
* DrawingTidbits.cpp * DrawingTidbits.cpp
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: DrawingTidbits.cpp,v 1.2 2001/03/21 13:42:33 sam Exp $ * $Id: DrawingTidbits.cpp,v 1.2.4.1 2002/09/03 12:00:24 tcastley 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
...@@ -27,6 +28,7 @@ ...@@ -27,6 +28,7 @@
#include "DrawingTidbits.h" #include "DrawingTidbits.h"
// ShiftComponent
inline uchar inline uchar
ShiftComponent(uchar component, float percent) ShiftComponent(uchar component, float percent)
{ {
...@@ -38,6 +40,7 @@ ShiftComponent(uchar component, float percent) ...@@ -38,6 +40,7 @@ ShiftComponent(uchar component, float percent)
return (uchar)(255 - percent * (255 - component)); return (uchar)(255 - percent * (255 - component));
} }
// ShiftColor
rgb_color rgb_color
ShiftColor(rgb_color color, float percent) ShiftColor(rgb_color color, float percent)
{ {
...@@ -51,6 +54,7 @@ ShiftColor(rgb_color color, float percent) ...@@ -51,6 +54,7 @@ ShiftColor(rgb_color color, float percent)
return result; return result;
} }
// CompareColors
static bool static bool
CompareColors(const rgb_color a, const rgb_color b) CompareColors(const rgb_color a, const rgb_color b)
{ {
...@@ -60,18 +64,21 @@ CompareColors(const rgb_color a, const rgb_color b) ...@@ -60,18 +64,21 @@ CompareColors(const rgb_color a, const rgb_color b)
&& a.alpha == b.alpha; && a.alpha == b.alpha;
} }
// ==
bool bool
operator==(const rgb_color &a, const rgb_color &b) operator==(const rgb_color &a, const rgb_color &b)
{ {
return CompareColors(a, b); return CompareColors(a, b);
} }
// !=
bool bool
operator!=(const rgb_color &a, const rgb_color &b) operator!=(const rgb_color &a, const rgb_color &b)
{ {
return !CompareColors(a, b); return !CompareColors(a, b);
} }
// ReplaceColor
void void
ReplaceColor(BBitmap *bitmap, rgb_color from, rgb_color to) ReplaceColor(BBitmap *bitmap, rgb_color from, rgb_color to)
{ {
...@@ -88,6 +95,7 @@ ReplaceColor(BBitmap *bitmap, rgb_color from, rgb_color to) ...@@ -88,6 +95,7 @@ ReplaceColor(BBitmap *bitmap, rgb_color from, rgb_color to)
bits[index] = toIndex; bits[index] = toIndex;
} }
// ReplaceTransparentColor
void void
ReplaceTransparentColor(BBitmap *bitmap, rgb_color with) ReplaceTransparentColor(BBitmap *bitmap, rgb_color with)
{ {
...@@ -103,3 +111,180 @@ ReplaceTransparentColor(BBitmap *bitmap, rgb_color with) ...@@ -103,3 +111,180 @@ ReplaceTransparentColor(BBitmap *bitmap, rgb_color with)
bits[index] = withIndex; bits[index] = withIndex;
} }
// convert_bitmap
status_t
convert_bitmap(BBitmap* inBitmap, BBitmap* outBitmap)
{
status_t status = B_BAD_VALUE;
/* // see that we got valid bitmaps
if (inBitmap && inBitmap->IsValid()
&& outBitmap && outBitmap->IsValid())
{
status = B_MISMATCHED_VALUES;
// see that bitmaps are compatible and that we support the conversion
if (inBitmap->Bounds().Width() == outBitmap->Bounds().Width()
&& inBitmap->Bounds().Height() == outBitmap->Bounds().Height()
&& (outBitmap->ColorSpace() == B_RGB32
|| outBitmap->ColorSpace() == B_RGBA32))
{
int32 width = inBitmap->Bounds().IntegerWidth() + 1;
int32 height = inBitmap->Bounds().IntegerHeight() + 1;
int32 srcBpr = inBitmap->BytesPerRow();
int32 dstBpr = outBitmap->BytesPerRow();
uint8* srcbits = (uint8*)inbitmap->bits();
uint8* dstbits = (uint8*)outbitmap->bits();
switch (inBitmap->ColorSpace())
{
case B_YCbCr422:
for (int32 y = 0; y < height; y ++)
{
for (int32 x = 0; x < width; x += 2)
{
uint8 y =
uint8 cb =
uint8 cr =
}
srcbits += srcBpr;
dstbits += dstBpr;
}
status = B_OK;
break;
case B_YCbCr420:
status = B_OK;
break;
case B_YUV422:
status = B_OK;
break;
case B_RGB32:
memcpy(dstBits, srcBits, inBitmap->BitsLength());
status = B_OK;
break;
default:
status = B_MISMATCHED_VALUES;
break;
}
}
}*/
return status;
}
// clip_float
inline uint8
clip_float(float value)
{
if (value < 0)
value = 0;
if (value > 255)
value = 255;
return (uint8)value;
}
// dim_bitmap
status_t
dim_bitmap(BBitmap* bitmap, rgb_color center, float dimLevel)
{
status_t status = B_BAD_VALUE;
if (bitmap && bitmap->IsValid())
{
switch (bitmap->ColorSpace())
{
case B_CMAP8:
{
BScreen screen(B_MAIN_SCREEN_ID);
if (screen.IsValid())
{
// iterate over each pixel, get the respective
// color from the screen object, find the distance
// to the "center" color and shorten the distance
// by "dimLevel"
int32 length = bitmap->BitsLength();
uint8* bits = (uint8*)bitmap->Bits();
for (int32 i = 0; i < length; i++)
{
// preserve transparent pixels
if (bits[i] != B_TRANSPARENT_MAGIC_CMAP8)
{
// get color for this index
rgb_color c = screen.ColorForIndex(bits[i]);
// red
float dist = (c.red - center.red) * dimLevel;
c.red = clip_float(center.red + dist);
// green
dist = (c.green - center.green) * dimLevel;
c.green = clip_float(center.green + dist);
// blue
dist = (c.blue - center.blue) * dimLevel;
c.blue = clip_float(center.blue + dist);
// write correct index of the dimmed color
// back into bitmap (and hope the match is close...)
bits[i] = screen.IndexForColor(c);
}
}
status = B_OK;
}
break;
}
case B_RGB32:
case B_RGBA32:
{
// iterate over each color component, find the distance
// to the "center" color and shorten the distance
// by "dimLevel"
uint8* bits = (uint8*)bitmap->Bits();
int32 bpr = bitmap->BytesPerRow();
int32 pixels = bitmap->Bounds().IntegerWidth() + 1;
int32 lines = bitmap->Bounds().IntegerHeight() + 1;
// iterate over color components
for (int32 y = 0; y < lines; y++) {
for (int32 x = 0; x < pixels; x++) {
int32 offset = 4 * x; // four bytes per pixel
// blue
float dist = (bits[offset + 0] - center.blue) * dimLevel;
bits[offset + 0] = clip_float(center.blue + dist);
// green
dist = (bits[offset + 1] - center.green) * dimLevel;
bits[offset + 1] = clip_float(center.green + dist);
// red
dist = (bits[offset + 2] - center.red) * dimLevel;
bits[offset + 2] = clip_float(center.red + dist);
// ignore alpha channel
}
// next line
bits += bpr;
}
status = B_OK;
break;
}
default:
status = B_ERROR;
break;
}
}
return status;
}
// dimmed_color_cmap8
rgb_color
dimmed_color_cmap8(rgb_color color, rgb_color center, float dimLevel)
{
BScreen screen(B_MAIN_SCREEN_ID);
if (screen.IsValid())
{
// red
float dist = (color.red - center.red) * dimLevel;
color.red = clip_float(center.red + dist);
// green
dist = (color.green - center.green) * dimLevel;
color.green = clip_float(center.green + dist);
// blue
dist = (color.blue - center.blue) * dimLevel;
color.blue = clip_float(center.blue + dist);
// get color index for dimmed color
int32 index = screen.IndexForColor(color);
// put color at index (closest match in palette
// to dimmed result) into returned color
color = screen.ColorForIndex(index);
}
return color;
}
...@@ -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.2 2001/03/21 13:42:33 sam Exp $ * $Id: DrawingTidbits.h,v 1.2.4.1 2002/09/03 12:00:25 tcastley 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
...@@ -51,5 +52,28 @@ const float kDimLevel = 0.6; ...@@ -51,5 +52,28 @@ 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);
// bitmaps need to be the same size, or this function will fail
// currently supported conversions:
// B_YCbCr422 -> B_RGB32
// B_YCbCr420 -> B_RGB32
// B_YUV422 -> B_RGB32
// B_RGB32 -> B_RGB32
//status_t convert_bitmap(BBitmap* inBitmap, BBitmap* outBitmap);
#endif // 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__
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.12.2.2 2002/07/13 11:33:11 tcastley Exp $ * $Id: InterfaceWindow.h,v 1.12.2.3 2002/09/03 12:00:25 tcastley 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,55 +23,88 @@ ...@@ -22,55 +23,88 @@
* 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_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(void);
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(void);
private:
intf_thread_t* p_intf;
int kind; int kind;
int GetChannels(); int GetChannels();
}; };
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 // standard window member
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: private:
intf_thread_t *p_intf; void _SetMenusEnabled(bool hasFile,
bool hasChapters = false,
bool hasTitles = false);
intf_thread_t* p_intf;
bool b_empty_playlist; bool b_empty_playlist;
BFilePanel *file_panel; BFilePanel* file_panel;
PlayListWindow* playlist_window; PlayListWindow* playlist_window;
BMenuItem *miOnTop; BMenuItem* miOnTop;
es_descriptor_t * p_audio_es; es_descriptor_t* p_audio_es;
es_descriptor_t * p_spu_es; es_descriptor_t* p_spu_es;
BMenuBar* fMenuBar;
BMenuItem* fNextTitleMI;
BMenuItem* fPrevTitleMI;
BMenuItem* fNextChapterMI;
BMenuItem* fPrevChapterMI;
BMenu* fAudioMenu;
BMenu* fNavigationMenu;
BMenu* fLanguageMenu;
BMenu* fSubtitlesMenu;
BMenu* fSpeedMenu;
bigtime_t fLastUpdateTime;
}; };
#endif // BEOS_INTERFACE_WINDOW_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.2 2001/09/12 01:31:37 tcastley Exp $ * $Id: MediaControlView.h,v 1.2.4.1 2002/09/03 12:00:25 tcastley 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,147 @@ ...@@ -20,73 +21,147 @@
* 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(); uint32 GetSeekTo() const;
uint32 GetVolume(); 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
...@@ -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.9.2.2 2002/07/13 11:33:11 tcastley Exp $ * $Id: MsgVals.h,v 1.9.2.3 2002/09/03 12:00:25 tcastley 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,39 @@ ...@@ -21,32 +22,39 @@
* 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_CHANNEL = 'CHAN'; 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 PREV_CHAPTER = 'prch';
const uint32 TOGGLE_ON_TOP = 'ONTP'; const uint32 NEXT_CHAPTER = 'nxch';
const uint32 TOGGLE_FULL_SCREEN = 'TGFS'; const uint32 TOGGLE_ON_TOP = 'ontp';
const uint32 RESIZE_100 = 'RSOR'; const uint32 TOGGLE_FULL_SCREEN = 'tgfs';
const uint32 RESIZE_200 = 'RSDB'; const uint32 RESIZE_100 = 'rsor';
const uint32 ASPECT_CORRECT = 'ASCO'; const uint32 RESIZE_200 = 'rsdb';
const uint32 VERT_SYNC = 'VSYN'; const uint32 RESIZE_TRUE = 'rstr';
const uint32 WINDOW_FEEL = 'WFEL'; const uint32 ASPECT_CORRECT = 'asco';
const uint32 VERT_SYNC = 'vsyn';
const uint32 WINDOW_FEEL = 'wfel';
const uint32 INTERFACE_CREATED = 'ifcr'; /* see VlcApplication::MessageReceived()
* in src/misc/beos_specific.cpp */
#endif // BEOS_MESSAGE_VALUES_H
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* 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.4.1 2002/06/01 10:12:10 tcastley Exp $ * $Id: PlayListWindow.h,v 1.1.4.2 2002/09/03 12:00:25 tcastley 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>
...@@ -22,7 +22,16 @@ ...@@ -22,7 +22,16 @@
* 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 BFilePanel;
class BListView;
class CDMenu; class CDMenu;
class PlayListWindow : public BWindow class PlayListWindow : public BWindow
{ {
public: public:
...@@ -42,4 +51,5 @@ private: ...@@ -42,4 +51,5 @@ private:
BFilePanel *file_panel; BFilePanel *file_panel;
}; };
#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.3 2001/03/21 13:42:33 sam Exp $ * $Id: TransportButton.cpp,v 1.3.4.1 2002/09/03 12:00:24 tcastley 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.3 2001/03/21 13:42:33 sam Exp $ * $Id: TransportButton.h,v 1.3.4.1 2002/09/03 12:00:25 tcastley 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__
...@@ -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.19.2.4 2002/07/11 12:24:45 tcastley Exp $ * $Id: VideoWindow.h,v 1.19.2.5 2002/09/03 12:00:25 tcastley 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,35 +58,58 @@ colorcombo colspace[]= ...@@ -50,35 +58,58 @@ colorcombo colspace[]=
class VLCView : public BView class VLCView : public BView
{ {
public: public:
VLCView( BRect bounds); VLCView( BRect bounds);
~VLCView(); virtual ~VLCView();
void MouseDown(BPoint point); virtual void AttachedToWindow();
void Draw(BRect updateRect); 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);
private:
bigtime_t fLastMouseMovedTime;
bool fCursorHidden;
bool fCursorInside;
}; };
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();
virtual 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;
...@@ -86,14 +117,28 @@ public: ...@@ -86,14 +117,28 @@ public:
BBitmap *overlaybitmap; 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:
status_t _AllocateBuffers(int width,
int height,
int* mode);
void _FreeBuffers();
void _BlankBitmap(BBitmap* bitmap) const;
void _SetVideoSize(uint32 mode);
struct vout_thread_s *p_vout; 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
...@@ -2,12 +2,13 @@ ...@@ -2,12 +2,13 @@
* intf_beos.cpp: beos interface * intf_beos.cpp: beos interface
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN * Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: intf_beos.cpp,v 1.38.2.1 2002/07/13 11:33:11 tcastley Exp $ * $Id: intf_beos.cpp,v 1.38.2.2 2002/09/03 12:00:24 tcastley 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>
extern "C" extern "C"
...@@ -44,6 +47,7 @@ extern "C" ...@@ -44,6 +47,7 @@ extern "C"
#include "InterfaceWindow.h" #include "InterfaceWindow.h"
#include "intf_vlc_wrapper.h" #include "intf_vlc_wrapper.h"
#include "MsgVals.h"
extern "C" extern "C"
{ {
...@@ -98,6 +102,10 @@ static int intf_Open( intf_thread_t *p_intf ) ...@@ -98,6 +102,10 @@ static int intf_Open( intf_thread_t *p_intf )
free( p_intf->p_sys ); free( p_intf->p_sys );
intf_ErrMsg( "error: cannot allocate memory for InterfaceWindow" ); intf_ErrMsg( "error: cannot allocate memory for 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->b_disabled_menus = 0;
p_intf->p_sys->i_saved_volume = VOLUME_DEFAULT; p_intf->p_sys->i_saved_volume = VOLUME_DEFAULT;
......
...@@ -2,11 +2,12 @@ ...@@ -2,11 +2,12 @@
* intf_vlc_wrapper.h: BeOS plugin for vlc (derived from MacOS X port ) * intf_vlc_wrapper.h: BeOS plugin for vlc (derived from MacOS X port )
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: intf_vlc_wrapper.cpp,v 1.1.2.1 2002/07/13 11:33:11 tcastley Exp $ * $Id: intf_vlc_wrapper.cpp,v 1.1.2.2 2002/09/03 12:00:24 tcastley Exp $
* *
* Authors: Florian G. Pflug <fgp@phlo.org> * Authors: Florian G. Pflug <fgp@phlo.org>
* Jon Lech Johansen <jon-vl@nanocrew.net> * Jon Lech Johansen <jon-vl@nanocrew.net>
* Tony Casltey <tony@castley.net> * Tony Casltey <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
...@@ -263,9 +264,38 @@ void Intf_VLCWrapper::volume_restore() ...@@ -263,9 +264,38 @@ void Intf_VLCWrapper::volume_restore()
p_aout_bank->pp_aout[0]->i_volume = p_aout_bank->pp_aout[0]->i_volume =
p_main->p_intf->p_sys->i_saved_volume; p_main->p_intf->p_sys->i_saved_volume;
p_main->p_intf->p_sys->i_saved_volume = 0;
p_main->p_intf->p_sys->b_mute = 0; p_main->p_intf->p_sys->b_mute = 0;
} }
void Intf_VLCWrapper::set_volume(int value)
{
if( p_aout_bank->pp_aout[0] == NULL ) return;
//printf("Intf_VLCWrapper::set_volume(%ld)\n", value);
// make sure value is within bounds
if (value < 0)
value = 0;
if (value > VOLUME_MAX)
value = VOLUME_MAX;
vlc_mutex_lock( &p_aout_bank->lock );
// unmute volume if muted
if (p_main->p_intf->p_sys->b_mute)
{
p_main->p_intf->p_sys->b_mute = 0;
// p_main->p_intf->p_sys->i_saved_volume = 0;
}
// set every stream to the given value
for(int i = 0 ; i < p_aout_bank->i_count ; i++ )
{
if (p_aout_bank->pp_aout[i])
{
// p_aout_bank->pp_aout[i]->i_savedvolume = 0;
p_aout_bank->pp_aout[i]->i_volume = value;
}
}
vlc_mutex_unlock( &p_aout_bank->lock );
}
void Intf_VLCWrapper::toggle_mute() void Intf_VLCWrapper::toggle_mute()
{ {
if( p_aout_bank->pp_aout[0] == NULL ) return; if( p_aout_bank->pp_aout[0] == NULL ) return;
...@@ -277,7 +307,13 @@ void Intf_VLCWrapper::toggle_mute() ...@@ -277,7 +307,13 @@ void Intf_VLCWrapper::toggle_mute()
{ {
Intf_VLCWrapper::volume_mute(); Intf_VLCWrapper::volume_mute();
} }
p_main->p_intf->p_sys->b_mute = !p_main->p_intf->p_sys->b_mute; // p_main->p_intf->p_sys->b_mute = !p_main->p_intf->p_sys->b_mute;
}
bool Intf_VLCWrapper::is_muted()
{
if( p_aout_bank->pp_aout[0] == NULL ) return false;
return p_main->p_intf->p_sys->b_mute;
} }
void Intf_VLCWrapper::maxvolume() void Intf_VLCWrapper::maxvolume()
......
...@@ -2,11 +2,12 @@ ...@@ -2,11 +2,12 @@
* intf_vlc_wrapper.h: BeOS plugin for vlc (derived from MacOS X port ) * intf_vlc_wrapper.h: BeOS plugin for vlc (derived from MacOS X port )
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: intf_vlc_wrapper.h,v 1.1.2.1 2002/07/13 11:33:11 tcastley Exp $ * $Id: intf_vlc_wrapper.h,v 1.1.2.2 2002/09/03 12:00:25 tcastley Exp $
* *
* Authors: Florian G. Pflug <fgp@phlo.org> * Authors: Florian G. Pflug <fgp@phlo.org>
* Jon Lech Johansen <jon-vl@nanocrew.net> * Jon Lech Johansen <jon-vl@nanocrew.net>
* Tony Casltey <tony@castley.net> * Tony Casltey <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
...@@ -61,7 +62,9 @@ public: ...@@ -61,7 +62,9 @@ public:
static void playFaster(); static void playFaster();
static void volume_mute(); static void volume_mute();
static void volume_restore(); static void volume_restore();
static void set_volume(int value);
static void toggle_mute(); static void toggle_mute();
static bool is_muted();
static void maxvolume(); static void maxvolume();
// static void fullscreen(); // static void fullscreen();
static void eject(); static void eject();
......
This diff is collapsed.
...@@ -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.18 2002/04/26 05:43:37 sam Exp $ * $Id: beos_specific.cpp,v 1.18.2.1 2002/09/03 12:00:24 tcastley Exp $
* *
* Authors: Jean-Marc Dressler <polux@via.ecp.fr> * Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* *
...@@ -24,6 +24,8 @@ ...@@ -24,6 +24,8 @@
#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() */
...@@ -44,6 +46,12 @@ public: ...@@ -44,6 +46,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;
}; };
/***************************************************************************** /*****************************************************************************
...@@ -54,6 +62,9 @@ static vlc_mutex_t app_lock; ...@@ -54,6 +62,9 @@ static vlc_mutex_t app_lock;
static vlc_cond_t app_wait; static vlc_cond_t app_wait;
static char *psz_program_path; static char *psz_program_path;
//const uint32 INTERFACE_CREATED = 'ifcr'; /* message sent from interface */
#include "../../plugins/beos/MsgVals.h"
extern "C" extern "C"
{ {
...@@ -131,7 +142,9 @@ static void system_AppThread( void * args ) ...@@ -131,7 +142,9 @@ static void system_AppThread( void * args )
* 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 */
} }
...@@ -142,6 +155,7 @@ VlcApplication::VlcApplication( char * psz_mimetype ) ...@@ -142,6 +155,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;
} }
/***************************************************************************** /*****************************************************************************
...@@ -177,3 +191,47 @@ void VlcApplication::ReadyToRun( ) ...@@ -177,3 +191,47 @@ void VlcApplication::ReadyToRun( )
vlc_mutex_unlock( &app_lock ); vlc_mutex_unlock( &app_lock );
} }
/*****************************************************************************
* 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