1 /*****************************************************************************
\r
2 * messages.cpp: log window.
\r
3 *****************************************************************************
\r
4 * Copyright (C) 2002 VideoLAN
\r
6 * Authors: Olivier Teuliere <ipkiss@via.ecp.fr>
\r
8 * This program is free software; you can redistribute it and/or modify
\r
9 * it under the terms of the GNU General Public License as published by
\r
10 * the Free Software Foundation; either version 2 of the License, or
\r
11 * (at your option) any later version.
\r
13 * This program is distributed in the hope that it will be useful,
\r
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
16 * GNU General Public License for more details.
\r
18 * You should have received a copy of the GNU General Public License
\r
19 * along with this program; if not, write to the Free Software
\r
20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
\r
21 *****************************************************************************/
\r
26 #include <videolan/vlc.h>
\r
28 #include "interface.h"
\r
30 #include "win32_common.h"
\r
31 #include "messages.h"
\r
33 //---------------------------------------------------------------------------
\r
34 #pragma package(smart_init)
\r
35 #pragma resource "*.dfm"
\r
37 extern struct intf_thread_s *p_intfGlobal;
\r
39 //---------------------------------------------------------------------------
\r
40 __fastcall TMessagesDlg::TMessagesDlg( TComponent* Owner )
\r
43 Icon = p_intfGlobal->p_sys->p_window->Icon;
\r
45 //---------------------------------------------------------------------------
\r
46 void __fastcall TMessagesDlg::ButtonOKClick( TObject *Sender )
\r
50 //---------------------------------------------------------------------------
\r
51 void __fastcall TMessagesDlg::FormHide( TObject *Sender )
\r
53 p_intfGlobal->p_sys->p_window->MenuMessages->Checked = false;
\r
55 //---------------------------------------------------------------------------
\r
56 void __fastcall TMessagesDlg::FormShow( TObject *Sender )
\r
58 p_intfGlobal->p_sys->p_window->MenuMessages->Checked = true;
\r
60 //---------------------------------------------------------------------------
\r
61 void __fastcall TMessagesDlg::UpdateLog()
\r
63 intf_subscription_t *p_sub = p_intfGlobal->p_sys->p_sub;
\r
67 vlc_mutex_lock( p_sub->p_lock );
\r
68 i_stop = *p_sub->pi_stop;
\r
69 vlc_mutex_unlock( p_sub->p_lock );
\r
71 if( p_sub->i_start != i_stop )
\r
73 for( i_start = p_sub->i_start;
\r
75 i_start = (i_start+1) % INTF_MSG_QSIZE )
\r
77 /* Append all messages to log window */
\r
78 switch( p_sub->p_msg[i_start].i_type )
\r
81 RichEditMessages->SelAttributes->Color = clRed;
\r
84 RichEditMessages->SelAttributes->Color = clBlack;
\r
87 RichEditMessages->SelAttributes->Color = clBlue;
\r
91 RichEditMessages->Lines->Add( p_sub->p_msg[i_start].psz_msg );
\r
94 vlc_mutex_lock( p_sub->p_lock );
\r
95 p_sub->i_start = i_start;
\r
96 vlc_mutex_unlock( p_sub->p_lock );
\r
99 //---------------------------------------------------------------------------
\r