]> git.sesse.net Git - vlc/blobdiff - modules/gui/beos/MessagesWindow.cpp
Removes trailing spaces. Removes tabs.
[vlc] / modules / gui / beos / MessagesWindow.cpp
index a3f957d0e31b4a507f4b905d049a67e2be81de3e..7884d55da7f681d5dc3ef7ba770b770c274251f6 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  * MessagesWindow.cpp: beos interface
  *****************************************************************************
- * Copyright (C) 1999, 2000, 2001 VideoLAN
+ * Copyright (C) 1999, 2000, 2001 the VideoLAN team
  * $Id$
  *
  * Authors: Eric Petit <titer@videolan.org>
@@ -18,7 +18,7 @@
  *
  * 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.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
 /* BeOS headers */
@@ -27,7 +27,7 @@
 
 /* VLC headers */
 #include <vlc/vlc.h>
-#include <vlc/intf.h>
+#include <vlc_interface.h>
 
 /* BeOS module headers */
 #include "InterfaceWindow.h"
@@ -38,7 +38,6 @@
  *****************************************************************************/
 void MessagesView::Pulse()
 {
-#if 0
     bool isScrolling = false;
     if( fScrollBar->LockLooper() )
     {
@@ -95,14 +94,14 @@ void MessagesView::Pulse()
             if( LockLooper() )
             {
                 oldLength = TextLength();
-               BString string;
-               string << p_sub->p_msg[i_start].psz_module
-                   << " " << psz_module_type << " : "
-                   << p_sub->p_msg[i_start].psz_msg << "\n";
-               Insert( TextLength(), string.String(), strlen( string.String() ) );
-               SetFontAndColor( oldLength, TextLength(), NULL, 0, &color );
-               Draw( Bounds() );
-                   UnlockLooper();
+                BString string;
+                string << p_sub->p_msg[i_start].psz_module
+                    << " " << psz_module_type << " : "
+                    << p_sub->p_msg[i_start].psz_msg << "\n";
+                Insert( TextLength(), string.String(), strlen( string.String() ) );
+                SetFontAndColor( oldLength, TextLength(), NULL, 0, &color );
+                Draw( Bounds() );
+                UnlockLooper();
             }
         }
 
@@ -123,37 +122,37 @@ void MessagesView::Pulse()
     }
 
     BTextView::Pulse();
-#endif
 }
 
 /*****************************************************************************
  * MessagesWindow::MessagesWindow
  *****************************************************************************/
-MessagesWindow::MessagesWindow( intf_thread_t * p_intf,
+MessagesWindow::MessagesWindow( intf_thread_t * _p_intf,
                                 BRect frame, const char * name )
-       : BWindow( frame, name, B_FLOATING_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
-               B_NOT_ZOOMABLE )
+    : BWindow( frame, name, B_FLOATING_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
+               B_NOT_ZOOMABLE ),
+    p_intf(_p_intf)
 {
-       this->p_intf = p_intf;
-
     SetSizeLimits( 400, 2000, 200, 2000 );
-       
-       BRect rect, textRect;
-
-       rect = Bounds();
-       rect.right -= B_V_SCROLL_BAR_WIDTH;
-       textRect = rect;
-       textRect.InsetBy( 5, 5 );
-       fMessagesView = new MessagesView( p_intf,
-                                         rect, "messages", textRect,
-                                         B_FOLLOW_ALL, B_WILL_DRAW );
-       fMessagesView->MakeEditable( false );
-       fMessagesView->SetStylable( true );
-       fScrollView = new BScrollView( "scrollview", fMessagesView, B_WILL_DRAW,
-                                      B_FOLLOW_ALL, false, true );
-       fMessagesView->fScrollBar = fScrollView->ScrollBar( B_VERTICAL );
-       AddChild( fScrollView );
-       
+
+    p_sub = msg_Subscribe( p_intf, MSG_QUEUE_NORMAL );
+    BRect rect, textRect;
+
+    rect = Bounds();
+    rect.right -= B_V_SCROLL_BAR_WIDTH;
+    textRect = rect;
+    textRect.InsetBy( 5, 5 );
+    fMessagesView = new MessagesView( p_sub,
+                                      rect, "messages", textRect,
+                                      B_FOLLOW_ALL, B_WILL_DRAW );
+    fMessagesView->MakeEditable( false );
+    fMessagesView->SetStylable( true );
+    fScrollView = new BScrollView( "scrollview", fMessagesView, B_WILL_DRAW,
+                                   B_FOLLOW_ALL, false, true );
+    fMessagesView->fScrollBar = fScrollView->ScrollBar( B_VERTICAL );
+    AddChild( fScrollView );
     /* start window thread in hidden state */
     Hide();
     Show();
@@ -164,6 +163,7 @@ MessagesWindow::MessagesWindow( intf_thread_t * p_intf,
  *****************************************************************************/
 MessagesWindow::~MessagesWindow()
 {
+     msg_Unsubscribe( p_intf, p_sub );
 }
 
 /*****************************************************************************