virtual_common_ch_control.cpp

Go to the documentation of this file.
00001 
00002 // Name:        virtual_common_ch_control.cpp
00003 // Purpose:     
00004 // Author:      NDA
00005 // Modified by: 
00006 // Created:     11/01/2007 15:09:37
00007 // RCS-ID:      
00008 // Copyright:   CAEN S.p.A All rights reserved.
00009 // Licence:     
00011 
00012 // Generated by DialogBlocks (unregistered), 11/01/2007 15:09:37
00013 
00014 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
00015 #pragma implementation "virtual_common_ch_control.h"
00016 #endif
00017 
00018 // For compilers that support precompilation, includes "wx/wx.h".
00019 #include "wx/wxprec.h"
00020 
00021 #ifdef __BORLANDC__
00022 #pragma hdrstop
00023 #endif
00024 
00025 #ifndef WX_PRECOMP
00026 #include "wx/wx.h"
00027 #endif
00028 
00031 
00032 #include "virtual_common_ch_control.h"
00033 #include "virtual_channel_def_dialog.h"
00034 
00037 
00042 IMPLEMENT_DYNAMIC_CLASS( VirtualCommonChControl, CommonChControlBase )
00043 
00044 
00048 BEGIN_EVENT_TABLE( VirtualCommonChControl, CommonChControlBase )
00049 
00051     EVT_TOGGLEBUTTON( ID_VIRTUAL_ENABLE_TOGGLEBUTTON, VirtualCommonChControl::OnVirtualEnableTogglebuttonClick )
00052 
00053     EVT_BUTTON( ID_VIRTUAL_BUTTON, VirtualCommonChControl::OnVirtualButtonClick )
00054 
00056 
00057 END_EVENT_TABLE()
00058 
00063 VirtualCommonChControl::VirtualCommonChControl( )
00064 {
00065 }
00066 
00067 VirtualCommonChControl::VirtualCommonChControl( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
00068 {
00069     Create(parent, id, pos, size, style);
00070 }
00071 
00076 bool VirtualCommonChControl::Create( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
00077 {
00079     m_main_sizer_text = NULL;
00080     m_ch_enable_control = NULL;
00081     m_medium_value_control = NULL;
00083 
00085     CommonChControlBase::Create( parent, id, pos, size, style );
00086 
00087     CreateControls();
00088     if (GetSizer())
00089     {
00090         GetSizer()->SetSizeHints(this);
00091     }
00092     Centre();
00094     return true;
00095 }
00096 
00101 void VirtualCommonChControl::CreateControls()
00102 {    
00104     // Generated by DialogBlocks, 16/01/2007 15:53:32 (unregistered)
00105 
00106     VirtualCommonChControl* itemCommonChControlBase1 = this;
00107 
00108     this->SetFont(wxFont(8, wxSWISS, wxNORMAL, wxNORMAL, false, _T("Verdana")));
00109     m_main_sizer_text = new wxStaticBox(itemCommonChControlBase1, wxID_ANY, _("???"));
00110     wxStaticBoxSizer* itemStaticBoxSizer2 = new wxStaticBoxSizer(m_main_sizer_text, wxVERTICAL);
00111     itemCommonChControlBase1->SetSizer(itemStaticBoxSizer2);
00112 
00113     m_ch_enable_control = new wxToggleButton( itemCommonChControlBase1, ID_VIRTUAL_ENABLE_TOGGLEBUTTON, _("???"), wxDefaultPosition, wxSize(65, -1), 0 );
00114     m_ch_enable_control->SetValue(true);
00115     m_ch_enable_control->SetHelpText(_("Enable/Disable channel"));
00116     if (ShowToolTips())
00117         m_ch_enable_control->SetToolTip(_("Enable/Disable channel"));
00118     m_ch_enable_control->SetFont(wxFont(8, wxSWISS, wxNORMAL, wxBOLD, false, _T("Verdana")));
00119     itemStaticBoxSizer2->Add(m_ch_enable_control, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 0);
00120 
00121     itemStaticBoxSizer2->Add(5, 10, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 1);
00122 
00123     wxButton* itemButton5 = new wxButton( itemCommonChControlBase1, ID_VIRTUAL_BUTTON, _("Define"), wxDefaultPosition, wxSize(65, -1), 0 );
00124     itemButton5->SetFont(wxFont(8, wxSWISS, wxNORMAL, wxBOLD, false, _T("Verdana")));
00125     itemStaticBoxSizer2->Add(itemButton5, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 0);
00126 
00127     itemStaticBoxSizer2->Add(5, 10, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 1);
00128 
00129     m_medium_value_control = new wxStaticText( itemCommonChControlBase1, wxID_STATIC, _("0"), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE );
00130     m_medium_value_control->SetHelpText(_("The samples' medium value"));
00131     if (ShowToolTips())
00132         m_medium_value_control->SetToolTip(_("The samples' medium value"));
00133     itemStaticBoxSizer2->Add(m_medium_value_control, 0, wxGROW|wxALL|wxADJUST_MINSIZE, 5);
00134 
00136 }
00137 
00142 void VirtualCommonChControl::OnVirtualEnableTogglebuttonClick( wxCommandEvent& /*event */)
00143 {
00144         this->m_p_board_channel->m_enabled= this->m_ch_enable_control->GetValue( )!= 0;
00145         this->m_ch_enable_control->SetLabel( this->m_ch_enable_control->GetValue( )? _("Disable"): _("Enable"));
00146         for( int i= 0; i< SCOPE_NUM_PANELS; i++)
00147         {
00148                 (this->m_p_board_channel->ScopeRefresh)( i, true);
00149         }
00150 }
00151 
00156 bool VirtualCommonChControl::ShowToolTips()
00157 {
00158     return true;
00159 }
00160 
00165 wxBitmap VirtualCommonChControl::GetBitmapResource( const wxString& name )
00166 {
00167     // Bitmap retrieval
00169     wxUnusedVar(name);
00170     return wxNullBitmap;
00172 }
00173 
00178 wxIcon VirtualCommonChControl::GetIconResource( const wxString& name )
00179 {
00180     // Icon retrieval
00182     wxUnusedVar(name);
00183     return wxNullIcon;
00185 }
00190 void VirtualCommonChControl::OnVirtualButtonClick( wxCommandEvent& /*event*/ )
00191 {
00192         VirtualChannelDefDialog dlg( this->m_p_board_channel, this);
00193         if( dlg.ShowModal()== wxOK)
00194         {
00195                 for( int i= 0; i< SCOPE_NUM_PANELS; i++)
00196                 {
00197                         (this->m_p_board_channel->ScopeRefresh)( i, false);
00198                 }
00199         }
00200 }
00201 
00202 
00203 bool VirtualCommonChControl::SetupBoard( GenericBoard* p_board, int ch_index, int ch_count)
00204 {
00205         this->m_p_board= p_board;
00206         this->m_ch_index= ch_index;
00207         this->m_ch_count= ch_count;
00208         if( ( size_t)this->m_ch_index>= this->m_p_board->m_virtual_channel_array.GetCount())
00209                 return false;
00210         this->m_p_board_channel= (VirtualBoardChannel*)this->m_p_board->m_virtual_channel_array[ this->m_ch_index];
00211         this->m_p_board_channel->m_p_common_ch_control= this;
00212 
00213         if( !this->UpdateControls())
00214                 return false;
00215         return true;
00216 }
00217 bool VirtualCommonChControl::UpdateControls( )
00218 {
00219         this->m_main_sizer_text->SetLabel( wxString::Format( "VIRT %d", this->m_ch_count));
00220         this->m_ch_enable_control->SetValue( this->m_p_board_channel->m_enabled);
00221         this->m_ch_enable_control->SetLabel( this->m_ch_enable_control->GetValue( )? _("Disable"): _("Enable"));
00222 
00223         return true;
00224 }
00225 void VirtualCommonChControl::SetMediumLabel( double value)
00226 {
00227         this->m_medium_value_control->SetLabel( wxString::Format( "%.3f", value));
00228 }
00229 void VirtualCommonChControl::SetOverloadBackground( const wxColor& /*color*/)
00230 {
00231         //this->m_overload_control->SetBackgroundColour( color);
00232         //this->m_overload_control->Refresh();
00233 }

Generated on Mon Mar 19 17:14:08 2007 for CAENScope by  doxygen 1.4.6-NO