[vlc-devel] commit: mozilla: introduce new property text (Jean-Paul Saman )

git version control git at videolan.org
Fri Jul 10 14:04:10 CEST 2009


vlc | branch: master | Jean-Paul Saman <jean-paul.saman at m2x.nl> | Fri Apr 24 12:41:49 2009 +0200| [50b952d9421372f1a1163f2accc38d4719e57afd] | committer: Jean-Paul Saman 

mozilla: introduce new property text

The text "Waiting for video..." is no longer shown be default. One has to add it to the browser plugin properties before it is shown on the plugin area.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=50b952d9421372f1a1163f2accc38d4719e57afd
---

 projects/mozilla/test.html     |    1 +
 projects/mozilla/vlcplugin.cpp |    6 ++++++
 projects/mozilla/vlcplugin.h   |    1 +
 projects/mozilla/vlcshell.cpp  |   17 +++++++++--------
 4 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/projects/mozilla/test.html b/projects/mozilla/test.html
index 83377a0..79c6f4d 100644
--- a/projects/mozilla/test.html
+++ b/projects/mozilla/test.html
@@ -115,6 +115,7 @@ Insert VideoLAN.VLCPlugin.2
        width="640"
        height="480"
        toolbar="true"
+       text="Waiting for video"
        name="vlc">
 </EMBED>
 </OBJECT>
diff --git a/projects/mozilla/vlcplugin.cpp b/projects/mozilla/vlcplugin.cpp
index 0ed4a19..3a49e8e 100644
--- a/projects/mozilla/vlcplugin.cpp
+++ b/projects/mozilla/vlcplugin.cpp
@@ -45,6 +45,7 @@ VlcPlugin::VlcPlugin( NPP instance, uint16 mode ) :
     b_stream(0),
     b_autoplay(1),
     b_toolbar(0),
+    psz_text(NULL),
     psz_target(NULL),
     playlist_index(-1),
     libvlc_instance(NULL),
@@ -144,6 +145,10 @@ NPError VlcPlugin::init(int argc, char* const argn[], char* const argv[])
         {
             psz_target = argv[i];
         }
+        else if( !strcmp( argn[i], "text" ) )
+        {
+            psz_text = strdup( argv[i] );
+        }
         else if( !strcmp( argn[i], "autoplay")
               || !strcmp( argn[i], "autostart") )
         {
@@ -266,6 +271,7 @@ VlcPlugin::~VlcPlugin()
 {
     free(psz_baseURL);
     free(psz_target);
+    free(psz_text);
     if( libvlc_media_player )
         libvlc_media_player_release( libvlc_media_player );
     if( libvlc_media_list )
diff --git a/projects/mozilla/vlcplugin.h b/projects/mozilla/vlcplugin.h
index 97a9dea..201d94a 100644
--- a/projects/mozilla/vlcplugin.h
+++ b/projects/mozilla/vlcplugin.h
@@ -141,6 +141,7 @@ public:
     int      b_stream;
     int      b_autoplay;
     int      b_toolbar;
+    char *   psz_text;
     char *   psz_target;
 
     void playlist_play(libvlc_exception_t *ex)
diff --git a/projects/mozilla/vlcshell.cpp b/projects/mozilla/vlcshell.cpp
index 37243f7..c2228f9 100644
--- a/projects/mozilla/vlcshell.cpp
+++ b/projects/mozilla/vlcshell.cpp
@@ -47,8 +47,6 @@
 /* Enable/disable debugging printf's for X11 resizing */
 #undef X11_RESIZE_DEBUG
 
-#define WINDOW_TEXT "Waiting for video"
-
 /*****************************************************************************
  * Unix-only declarations
 ******************************************************************************/
@@ -243,7 +241,8 @@ int16 NPP_HandleEvent( NPP instance, void * event )
 
                     ForeColor(whiteColor);
                     MoveTo( (npwindow.width-80)/ 2  , npwindow.height / 2 );
-                    DrawText( WINDOW_TEXT , 0 , strlen(WINDOW_TEXT) );
+                    if( p_plugin->psz_text )
+                        DrawText( p_plugin->psz_text, 0, strlen(p_plugin->psz_text) );
                 }
             }
             return true;
@@ -746,8 +745,9 @@ static LRESULT CALLBACK Manage( HWND p_hwnd, UINT i_msg, WPARAM wpar, LPARAM lpa
             FillRect( hdc, &rect, (HBRUSH)GetStockObject(BLACK_BRUSH) );
             SetTextColor(hdc, RGB(255, 255, 255));
             SetBkColor(hdc, RGB(0, 0, 0));
-            DrawText( hdc, WINDOW_TEXT, strlen(WINDOW_TEXT), &rect,
-                      DT_CENTER|DT_VCENTER|DT_SINGLELINE);
+            if( p_plugin->psz_text )
+                DrawText( hdc, p_plugin->psz_text, strlen(p_plugin->psz_text), &rect,
+                          DT_CENTER|DT_VCENTER|DT_SINGLELINE);
 
             EndPaint( p_hwnd, &paintstruct );
             return 0L;
@@ -790,9 +790,10 @@ static void Redraw( Widget w, XtPointer closure, XEvent *event )
     gcv.foreground = WhitePixel( p_display, 0 );
     XChangeGC( p_display, gc, GCForeground, &gcv );
 
-    XDrawString( p_display, video, gc,
-                 window.width / 2 - 40, (window.height - i_control_height) / 2,
-                 WINDOW_TEXT, strlen(WINDOW_TEXT) );
+    if( p_plugin->psz_text )
+        XDrawString( p_display, video, gc,
+                     window.width / 2 - 40, (window.height - i_control_height) / 2,
+                     p_plugin->psz_text, strlen(p_plugin->psz_text) );
     XFreeGC( p_display, gc );
 
     p_plugin->redrawToolbar();




More information about the vlc-devel mailing list