]> git.sesse.net Git - vlc/commitdiff
mozilla: introduce new property text
authorJean-Paul Saman <jean-paul.saman@m2x.nl>
Fri, 24 Apr 2009 10:41:49 +0000 (12:41 +0200)
committerJean-Paul Saman <jean-paul.saman@m2x.nl>
Fri, 10 Jul 2009 11:47:09 +0000 (13:47 +0200)
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.

projects/mozilla/test.html
projects/mozilla/vlcplugin.cpp
projects/mozilla/vlcplugin.h
projects/mozilla/vlcshell.cpp

index 83377a03f2beb68edd4f3e04fc634424403e4ad0..79c6f4d7344c27c725d75870afd44dd5ce3b86cd 100644 (file)
@@ -115,6 +115,7 @@ Insert VideoLAN.VLCPlugin.2
        width="640"\r
        height="480"\r
        toolbar="true"\r
+       text="Waiting for video"\r
        name="vlc">\r
 </EMBED>\r
 </OBJECT>\r
index 0ed4a19a9e6483a1e2b13d9d1c0ee978e668e194..3a49e8e4c7f6e04aa98465ccf09b58ff874ad82f 100644 (file)
@@ -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 )
index 97a9dea61726e6ac1e9860f3d284fa8d0ccb3663..201d94a0f6f73c31f3bb3fcaea2118d361e33dd1 100644 (file)
@@ -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)
index 37243f7200010abfe875dfe5c9ac775ac8349935..c2228f9ee25cd1b5626bd6ec5d185d2bc6043631 100644 (file)
@@ -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();