Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
wxViscaControlPanelButtons.cpp
1 #include "wxViscaControlPanelButtons.h"
2 #include <Gui/StringConv.hh>
3 #include <Base/Common/W32Compat.hh>
4 #include <wx/msgdlg.h>
5 #include <wx/artprov.h>
6 #include <img/Up.xpm>
7 #include <img/UpLeft.xpm>
8 #include <img/UpRight.xpm>
9 #include <img/Down.xpm>
10 #include <img/DownLeft.xpm>
11 #include <img/DownRight.xpm>
12 #include <img/Left.xpm>
13 #include <img/Right.xpm>
14 
15 
16 using namespace BIAS;
17 using namespace std;
18 
20 :
22 {
23  #ifdef WIN32
24  m_textCtrlDevice->SetValue(AsciiToWx("COM0"));
25  m_textCtrlDevice->SetEditable(true);
26  #endif
27  m_scrolledWindow1->Enable(false);
28 
29  m_bpButtonLeft->SetBitmapLabel(wxBitmap(Left_xpm));
30  m_bpButtonRight->SetBitmapLabel(wxBitmap(Right_xpm));
31  m_bpButtonUp->SetBitmapLabel(wxBitmap(Up_xpm));
32  m_bpButtonUpLeft->SetBitmapLabel(wxBitmap(UpLeft_xpm));
33  m_bpButtonUpRight->SetBitmapLabel(wxBitmap(UpRight_xpm));
34  m_bpButtonDown->SetBitmapLabel(wxBitmap(Down_xpm));
35  m_bpButtonDownLeft->SetBitmapLabel(wxBitmap(DownLeft_xpm));
36  m_bpButtonDownRight->SetBitmapLabel(wxBitmap(DownRight_xpm));
37 
38  m_bpButtonStop->SetBitmapLabel(wxBitmap(wxArtProvider::GetIcon(wxART_ERROR,wxART_BUTTON)));
39 }
40 
41 void wxViscaControlPanelButtons::OnScrollZoom( wxScrollEvent& event )
42 {
43  int step = viscaControl_.GetMaxZoom()/m_sliderZoom->GetMax();
44  cout<<"Setting zoom step:"<<step<<endl;
45  viscaControl_.ZoomDirect(short(m_sliderZoom->GetValue()*step));
46 }
47 
48 void wxViscaControlPanelButtons::OnButtonWide( wxCommandEvent& event )
49 {
51 }
52 
53 void wxViscaControlPanelButtons::OnButtonTele( wxCommandEvent& event )
54 {
56 }
57 
58 void wxViscaControlPanelButtons::OnButtonStop( wxCommandEvent& event )
59 {
61 }
62 
63 void wxViscaControlPanelButtons::OnProgressive( wxCommandEvent& event )
64 {
66  int sel = event.GetInt();
67  if(sel == 0){//interlaced
69  }
70  else if(sel == 1){ //progressive
72  }
73 
75  cout<<"CCD Scanning:"<<ret<<endl;
76 
77  }
78 }
79 
80 void wxViscaControlPanelButtons::OnButtonReset( wxCommandEvent& event )
81 {
83 }
84 
85 void wxViscaControlPanelButtons::OnOpenCam( wxCommandEvent& event )
86 {
88  viscaControl_.CamPower(true);
89  }
90 }
91 
92 void wxViscaControlPanelButtons::OnCloseCam( wxCommandEvent& event )
93 {
95  viscaControl_.CamPower(false);
96  }
97 }
98 
99 void wxViscaControlPanelButtons::OnUp( wxCommandEvent& event )
100 {
103  //viscaControl_.PanTiltPosInq();
104  stringstream txt; txt<<viscaControl_.GetTilt()<<"°; m_textTilt->SetLabel(AsciiToWx(txt.str())); } } void wxViscaControlPanelButtons::OnUpLeft( wxCommandEvent& event ) { if(viscaControl_.IsConnected()){ viscaControl_.MoveUpLeft(); //viscaControl_.PanTiltPosInq(); stringstream txt; txt<<viscaControl_.GetTilt()<<"°"; m_textTilt->SetLabel(AsciiToWx(txt.str())); } } void wxViscaControlPanelButtons::OnUpRight( wxCommandEvent& event ) { if(viscaControl_.IsConnected()){ viscaControl_.MoveUpRight(); //viscaControl_.PanTiltPosInq(); stringstream txt; txt<<viscaControl_.GetTilt()<<"°"; m_textTilt->SetLabel(AsciiToWx(txt.str())); } } void wxViscaControlPanelButtons::OnLeft( wxCommandEvent& event ) { if(viscaControl_.IsConnected()){ viscaControl_.MoveLeft(); //viscaControl_.PanTiltPosInq(); stringstream txt; txt<<viscaControl_.GetPan()<<"°"; m_textPan->SetLabel(AsciiToWx(txt.str())); } } void wxViscaControlPanelButtons::OnRight( wxCommandEvent& event ) { if(viscaControl_.IsConnected()){ viscaControl_.MoveRight(); //viscaControl_.PanTiltPosInq(); stringstream txt; txt<<viscaControl_.GetPan()<<"°"; m_textPan->SetLabel(AsciiToWx(txt.str())); } } void wxViscaControlPanelButtons::OnDown( wxCommandEvent& event ) { if(viscaControl_.IsConnected()){ viscaControl_.MoveDown(); //viscaControl_.PanTiltPosInq(); stringstream txt; txt<<viscaControl_.GetTilt()<<"°"; m_textTilt->SetLabel(AsciiToWx(txt.str())); } } void wxViscaControlPanelButtons::OnDownLeft( wxCommandEvent& event ) { if(viscaControl_.IsConnected()){ viscaControl_.MoveDownLeft(); //viscaControl_.PanTiltPosInq(); stringstream txt; txt<<viscaControl_.GetTilt()<<"°"; m_textTilt->SetLabel(AsciiToWx(txt.str())); } } void wxViscaControlPanelButtons::OnDownRight( wxCommandEvent& event ) { if(viscaControl_.IsConnected()){ viscaControl_.MoveDownRight(); //viscaControl_.PanTiltPosInq(); stringstream txt; txt<<viscaControl_.GetTilt()<<"°"; m_textTilt->SetLabel(AsciiToWx(txt.str())); } } void wxViscaControlPanelButtons::OnStop( wxCommandEvent& event ) { if(viscaControl_.IsConnected()){ viscaControl_.MoveStop(); } } void wxViscaControlPanelButtons::OnButtonHome( wxCommandEvent& event ){ if(viscaControl_.IsConnected()){ viscaControl_.MoveStop(); biassleep(1); viscaControl_.MoveHome(); } } void wxViscaControlPanelButtons::OnConnect( wxCommandEvent& event ) { bool ret = false; if(!viscaControl_.IsConnected()){ wxString dev = m_textCtrlDevice->GetValue(); ret = viscaControl_.InitPanTiltUnit(WxToAscii(dev)); if (!ret) { wxMessageDialog messageDialog(this, wxT("Initialising Visca pan-tilt unit failed!"), wxT("Visca Controller"), wxICON_ERROR | wxOK); messageDialog.ShowModal(); return; } } else{ ret = viscaControl_.ClosePanTiltUnit(); if (!ret) { wxMessageDialog messageDialog(this, wxT("Closing Visca pan-tilt unit failed!"), wxT("Visca Controller"), wxICON_ERROR | wxOK); messageDialog.ShowModal(); return; } } if(viscaControl_.IsConnected()){ m_buttonConnect->SetLabel(AsciiToWx("Disconnect")); m_scrolledWindow1->Enable(true); wxString text= wxT("Connected!"); } else{ m_buttonConnect->SetLabel(AsciiToWx("Connect")); m_scrolledWindow1->Enable(false); wxString text= wxT("Disonnected!"); } } void wxViscaControlPanelButtons::OnClose( wxCommandEvent& event ) { Show(false); } bool wxViscaControlPanelButtons::SetColour(const wxColour &colour){ m_panel2->SetBackgroundColour(colour); m_scrolledWindow1->SetBackgroundColour(colour); m_buttonReset->SetBackgroundColour(colour); m_buttonOpen->SetBackgroundColour(colour); m_buttonCloseCam->SetBackgroundColour(colour); m_sliderZoom->SetBackgroundColour(colour); m_buttonWide->SetBackgroundColour(colour); m_buttonTele->SetBackgroundColour(colour); m_buttonZoomStop->SetBackgroundColour(colour); m_radioBox1->SetBackgroundColour(colour); m_staticText03->SetBackgroundColour(colour); m_textPan->SetBackgroundColour(colour); m_staticText04->SetBackgroundColour(colour); m_textTilt->SetBackgroundColour(colour); m_bpButtonUp->SetBackgroundColour(colour); m_bpButtonUpLeft->SetBackgroundColour(colour); m_bpButtonUpRight->SetBackgroundColour(colour); m_bpButtonLeft->SetBackgroundColour(colour); m_bpButtonStop->SetBackgroundColour(colour); m_bpButtonRight->SetBackgroundColour(colour); m_bpButtonDown->SetBackgroundColour(colour); m_bpButtonDownLeft->SetBackgroundColour(colour); m_bpButtonDownRight->SetBackgroundColour(colour); m_buttonConnect->SetBackgroundColour(colour); m_textCtrlDevice->SetBackgroundColour(colour); m_buttonClose->SetBackgroundColour(colour); m_buttonHome->SetBackgroundColour(colour); m_panelPanTilt->SetBackgroundColour(colour); return this->SetBackgroundColour(colour); } ";
105  m_textTilt->SetLabel(AsciiToWx(txt.str()));
106  }
107 }
108 
109 void wxViscaControlPanelButtons::OnUpLeft( wxCommandEvent& event )
110 {
113  //viscaControl_.PanTiltPosInq();
114  stringstream txt; txt<<viscaControl_.GetTilt()<<"°; m_textTilt->SetLabel(AsciiToWx(txt.str())); } } void wxViscaControlPanelButtons::OnUpRight( wxCommandEvent& event ) { if(viscaControl_.IsConnected()){ viscaControl_.MoveUpRight(); //viscaControl_.PanTiltPosInq(); stringstream txt; txt<<viscaControl_.GetTilt()<<"°"; m_textTilt->SetLabel(AsciiToWx(txt.str())); } } void wxViscaControlPanelButtons::OnLeft( wxCommandEvent& event ) { if(viscaControl_.IsConnected()){ viscaControl_.MoveLeft(); //viscaControl_.PanTiltPosInq(); stringstream txt; txt<<viscaControl_.GetPan()<<"°"; m_textPan->SetLabel(AsciiToWx(txt.str())); } } void wxViscaControlPanelButtons::OnRight( wxCommandEvent& event ) { if(viscaControl_.IsConnected()){ viscaControl_.MoveRight(); //viscaControl_.PanTiltPosInq(); stringstream txt; txt<<viscaControl_.GetPan()<<"°"; m_textPan->SetLabel(AsciiToWx(txt.str())); } } void wxViscaControlPanelButtons::OnDown( wxCommandEvent& event ) { if(viscaControl_.IsConnected()){ viscaControl_.MoveDown(); //viscaControl_.PanTiltPosInq(); stringstream txt; txt<<viscaControl_.GetTilt()<<"°"; m_textTilt->SetLabel(AsciiToWx(txt.str())); } } void wxViscaControlPanelButtons::OnDownLeft( wxCommandEvent& event ) { if(viscaControl_.IsConnected()){ viscaControl_.MoveDownLeft(); //viscaControl_.PanTiltPosInq(); stringstream txt; txt<<viscaControl_.GetTilt()<<"°"; m_textTilt->SetLabel(AsciiToWx(txt.str())); } } void wxViscaControlPanelButtons::OnDownRight( wxCommandEvent& event ) { if(viscaControl_.IsConnected()){ viscaControl_.MoveDownRight(); //viscaControl_.PanTiltPosInq(); stringstream txt; txt<<viscaControl_.GetTilt()<<"°"; m_textTilt->SetLabel(AsciiToWx(txt.str())); } } void wxViscaControlPanelButtons::OnStop( wxCommandEvent& event ) { if(viscaControl_.IsConnected()){ viscaControl_.MoveStop(); } } void wxViscaControlPanelButtons::OnButtonHome( wxCommandEvent& event ){ if(viscaControl_.IsConnected()){ viscaControl_.MoveStop(); biassleep(1); viscaControl_.MoveHome(); } } void wxViscaControlPanelButtons::OnConnect( wxCommandEvent& event ) { bool ret = false; if(!viscaControl_.IsConnected()){ wxString dev = m_textCtrlDevice->GetValue(); ret = viscaControl_.InitPanTiltUnit(WxToAscii(dev)); if (!ret) { wxMessageDialog messageDialog(this, wxT("Initialising Visca pan-tilt unit failed!"), wxT("Visca Controller"), wxICON_ERROR | wxOK); messageDialog.ShowModal(); return; } } else{ ret = viscaControl_.ClosePanTiltUnit(); if (!ret) { wxMessageDialog messageDialog(this, wxT("Closing Visca pan-tilt unit failed!"), wxT("Visca Controller"), wxICON_ERROR | wxOK); messageDialog.ShowModal(); return; } } if(viscaControl_.IsConnected()){ m_buttonConnect->SetLabel(AsciiToWx("Disconnect")); m_scrolledWindow1->Enable(true); wxString text= wxT("Connected!"); } else{ m_buttonConnect->SetLabel(AsciiToWx("Connect")); m_scrolledWindow1->Enable(false); wxString text= wxT("Disonnected!"); } } void wxViscaControlPanelButtons::OnClose( wxCommandEvent& event ) { Show(false); } bool wxViscaControlPanelButtons::SetColour(const wxColour &colour){ m_panel2->SetBackgroundColour(colour); m_scrolledWindow1->SetBackgroundColour(colour); m_buttonReset->SetBackgroundColour(colour); m_buttonOpen->SetBackgroundColour(colour); m_buttonCloseCam->SetBackgroundColour(colour); m_sliderZoom->SetBackgroundColour(colour); m_buttonWide->SetBackgroundColour(colour); m_buttonTele->SetBackgroundColour(colour); m_buttonZoomStop->SetBackgroundColour(colour); m_radioBox1->SetBackgroundColour(colour); m_staticText03->SetBackgroundColour(colour); m_textPan->SetBackgroundColour(colour); m_staticText04->SetBackgroundColour(colour); m_textTilt->SetBackgroundColour(colour); m_bpButtonUp->SetBackgroundColour(colour); m_bpButtonUpLeft->SetBackgroundColour(colour); m_bpButtonUpRight->SetBackgroundColour(colour); m_bpButtonLeft->SetBackgroundColour(colour); m_bpButtonStop->SetBackgroundColour(colour); m_bpButtonRight->SetBackgroundColour(colour); m_bpButtonDown->SetBackgroundColour(colour); m_bpButtonDownLeft->SetBackgroundColour(colour); m_bpButtonDownRight->SetBackgroundColour(colour); m_buttonConnect->SetBackgroundColour(colour); m_textCtrlDevice->SetBackgroundColour(colour); m_buttonClose->SetBackgroundColour(colour); m_buttonHome->SetBackgroundColour(colour); m_panelPanTilt->SetBackgroundColour(colour); return this->SetBackgroundColour(colour); } ";
115  m_textTilt->SetLabel(AsciiToWx(txt.str()));
116  }
117 }
118 
119 void wxViscaControlPanelButtons::OnUpRight( wxCommandEvent& event )
120 {
123  //viscaControl_.PanTiltPosInq();
124  stringstream txt; txt<<viscaControl_.GetTilt()<<"°; m_textTilt->SetLabel(AsciiToWx(txt.str())); } } void wxViscaControlPanelButtons::OnLeft( wxCommandEvent& event ) { if(viscaControl_.IsConnected()){ viscaControl_.MoveLeft(); //viscaControl_.PanTiltPosInq(); stringstream txt; txt<<viscaControl_.GetPan()<<"°"; m_textPan->SetLabel(AsciiToWx(txt.str())); } } void wxViscaControlPanelButtons::OnRight( wxCommandEvent& event ) { if(viscaControl_.IsConnected()){ viscaControl_.MoveRight(); //viscaControl_.PanTiltPosInq(); stringstream txt; txt<<viscaControl_.GetPan()<<"°"; m_textPan->SetLabel(AsciiToWx(txt.str())); } } void wxViscaControlPanelButtons::OnDown( wxCommandEvent& event ) { if(viscaControl_.IsConnected()){ viscaControl_.MoveDown(); //viscaControl_.PanTiltPosInq(); stringstream txt; txt<<viscaControl_.GetTilt()<<"°"; m_textTilt->SetLabel(AsciiToWx(txt.str())); } } void wxViscaControlPanelButtons::OnDownLeft( wxCommandEvent& event ) { if(viscaControl_.IsConnected()){ viscaControl_.MoveDownLeft(); //viscaControl_.PanTiltPosInq(); stringstream txt; txt<<viscaControl_.GetTilt()<<"°"; m_textTilt->SetLabel(AsciiToWx(txt.str())); } } void wxViscaControlPanelButtons::OnDownRight( wxCommandEvent& event ) { if(viscaControl_.IsConnected()){ viscaControl_.MoveDownRight(); //viscaControl_.PanTiltPosInq(); stringstream txt; txt<<viscaControl_.GetTilt()<<"°"; m_textTilt->SetLabel(AsciiToWx(txt.str())); } } void wxViscaControlPanelButtons::OnStop( wxCommandEvent& event ) { if(viscaControl_.IsConnected()){ viscaControl_.MoveStop(); } } void wxViscaControlPanelButtons::OnButtonHome( wxCommandEvent& event ){ if(viscaControl_.IsConnected()){ viscaControl_.MoveStop(); biassleep(1); viscaControl_.MoveHome(); } } void wxViscaControlPanelButtons::OnConnect( wxCommandEvent& event ) { bool ret = false; if(!viscaControl_.IsConnected()){ wxString dev = m_textCtrlDevice->GetValue(); ret = viscaControl_.InitPanTiltUnit(WxToAscii(dev)); if (!ret) { wxMessageDialog messageDialog(this, wxT("Initialising Visca pan-tilt unit failed!"), wxT("Visca Controller"), wxICON_ERROR | wxOK); messageDialog.ShowModal(); return; } } else{ ret = viscaControl_.ClosePanTiltUnit(); if (!ret) { wxMessageDialog messageDialog(this, wxT("Closing Visca pan-tilt unit failed!"), wxT("Visca Controller"), wxICON_ERROR | wxOK); messageDialog.ShowModal(); return; } } if(viscaControl_.IsConnected()){ m_buttonConnect->SetLabel(AsciiToWx("Disconnect")); m_scrolledWindow1->Enable(true); wxString text= wxT("Connected!"); } else{ m_buttonConnect->SetLabel(AsciiToWx("Connect")); m_scrolledWindow1->Enable(false); wxString text= wxT("Disonnected!"); } } void wxViscaControlPanelButtons::OnClose( wxCommandEvent& event ) { Show(false); } bool wxViscaControlPanelButtons::SetColour(const wxColour &colour){ m_panel2->SetBackgroundColour(colour); m_scrolledWindow1->SetBackgroundColour(colour); m_buttonReset->SetBackgroundColour(colour); m_buttonOpen->SetBackgroundColour(colour); m_buttonCloseCam->SetBackgroundColour(colour); m_sliderZoom->SetBackgroundColour(colour); m_buttonWide->SetBackgroundColour(colour); m_buttonTele->SetBackgroundColour(colour); m_buttonZoomStop->SetBackgroundColour(colour); m_radioBox1->SetBackgroundColour(colour); m_staticText03->SetBackgroundColour(colour); m_textPan->SetBackgroundColour(colour); m_staticText04->SetBackgroundColour(colour); m_textTilt->SetBackgroundColour(colour); m_bpButtonUp->SetBackgroundColour(colour); m_bpButtonUpLeft->SetBackgroundColour(colour); m_bpButtonUpRight->SetBackgroundColour(colour); m_bpButtonLeft->SetBackgroundColour(colour); m_bpButtonStop->SetBackgroundColour(colour); m_bpButtonRight->SetBackgroundColour(colour); m_bpButtonDown->SetBackgroundColour(colour); m_bpButtonDownLeft->SetBackgroundColour(colour); m_bpButtonDownRight->SetBackgroundColour(colour); m_buttonConnect->SetBackgroundColour(colour); m_textCtrlDevice->SetBackgroundColour(colour); m_buttonClose->SetBackgroundColour(colour); m_buttonHome->SetBackgroundColour(colour); m_panelPanTilt->SetBackgroundColour(colour); return this->SetBackgroundColour(colour); } ";
125  m_textTilt->SetLabel(AsciiToWx(txt.str()));
126  }
127 }
128 
129 void wxViscaControlPanelButtons::OnLeft( wxCommandEvent& event )
130 {
133  //viscaControl_.PanTiltPosInq();
134  stringstream txt; txt<<viscaControl_.GetPan()<<"°; m_textPan->SetLabel(AsciiToWx(txt.str())); } } void wxViscaControlPanelButtons::OnRight( wxCommandEvent& event ) { if(viscaControl_.IsConnected()){ viscaControl_.MoveRight(); //viscaControl_.PanTiltPosInq(); stringstream txt; txt<<viscaControl_.GetPan()<<"°"; m_textPan->SetLabel(AsciiToWx(txt.str())); } } void wxViscaControlPanelButtons::OnDown( wxCommandEvent& event ) { if(viscaControl_.IsConnected()){ viscaControl_.MoveDown(); //viscaControl_.PanTiltPosInq(); stringstream txt; txt<<viscaControl_.GetTilt()<<"°"; m_textTilt->SetLabel(AsciiToWx(txt.str())); } } void wxViscaControlPanelButtons::OnDownLeft( wxCommandEvent& event ) { if(viscaControl_.IsConnected()){ viscaControl_.MoveDownLeft(); //viscaControl_.PanTiltPosInq(); stringstream txt; txt<<viscaControl_.GetTilt()<<"°"; m_textTilt->SetLabel(AsciiToWx(txt.str())); } } void wxViscaControlPanelButtons::OnDownRight( wxCommandEvent& event ) { if(viscaControl_.IsConnected()){ viscaControl_.MoveDownRight(); //viscaControl_.PanTiltPosInq(); stringstream txt; txt<<viscaControl_.GetTilt()<<"°"; m_textTilt->SetLabel(AsciiToWx(txt.str())); } } void wxViscaControlPanelButtons::OnStop( wxCommandEvent& event ) { if(viscaControl_.IsConnected()){ viscaControl_.MoveStop(); } } void wxViscaControlPanelButtons::OnButtonHome( wxCommandEvent& event ){ if(viscaControl_.IsConnected()){ viscaControl_.MoveStop(); biassleep(1); viscaControl_.MoveHome(); } } void wxViscaControlPanelButtons::OnConnect( wxCommandEvent& event ) { bool ret = false; if(!viscaControl_.IsConnected()){ wxString dev = m_textCtrlDevice->GetValue(); ret = viscaControl_.InitPanTiltUnit(WxToAscii(dev)); if (!ret) { wxMessageDialog messageDialog(this, wxT("Initialising Visca pan-tilt unit failed!"), wxT("Visca Controller"), wxICON_ERROR | wxOK); messageDialog.ShowModal(); return; } } else{ ret = viscaControl_.ClosePanTiltUnit(); if (!ret) { wxMessageDialog messageDialog(this, wxT("Closing Visca pan-tilt unit failed!"), wxT("Visca Controller"), wxICON_ERROR | wxOK); messageDialog.ShowModal(); return; } } if(viscaControl_.IsConnected()){ m_buttonConnect->SetLabel(AsciiToWx("Disconnect")); m_scrolledWindow1->Enable(true); wxString text= wxT("Connected!"); } else{ m_buttonConnect->SetLabel(AsciiToWx("Connect")); m_scrolledWindow1->Enable(false); wxString text= wxT("Disonnected!"); } } void wxViscaControlPanelButtons::OnClose( wxCommandEvent& event ) { Show(false); } bool wxViscaControlPanelButtons::SetColour(const wxColour &colour){ m_panel2->SetBackgroundColour(colour); m_scrolledWindow1->SetBackgroundColour(colour); m_buttonReset->SetBackgroundColour(colour); m_buttonOpen->SetBackgroundColour(colour); m_buttonCloseCam->SetBackgroundColour(colour); m_sliderZoom->SetBackgroundColour(colour); m_buttonWide->SetBackgroundColour(colour); m_buttonTele->SetBackgroundColour(colour); m_buttonZoomStop->SetBackgroundColour(colour); m_radioBox1->SetBackgroundColour(colour); m_staticText03->SetBackgroundColour(colour); m_textPan->SetBackgroundColour(colour); m_staticText04->SetBackgroundColour(colour); m_textTilt->SetBackgroundColour(colour); m_bpButtonUp->SetBackgroundColour(colour); m_bpButtonUpLeft->SetBackgroundColour(colour); m_bpButtonUpRight->SetBackgroundColour(colour); m_bpButtonLeft->SetBackgroundColour(colour); m_bpButtonStop->SetBackgroundColour(colour); m_bpButtonRight->SetBackgroundColour(colour); m_bpButtonDown->SetBackgroundColour(colour); m_bpButtonDownLeft->SetBackgroundColour(colour); m_bpButtonDownRight->SetBackgroundColour(colour); m_buttonConnect->SetBackgroundColour(colour); m_textCtrlDevice->SetBackgroundColour(colour); m_buttonClose->SetBackgroundColour(colour); m_buttonHome->SetBackgroundColour(colour); m_panelPanTilt->SetBackgroundColour(colour); return this->SetBackgroundColour(colour); } ";
135  m_textPan->SetLabel(AsciiToWx(txt.str()));
136  }
137 }
138 
139 void wxViscaControlPanelButtons::OnRight( wxCommandEvent& event )
140 {
143  //viscaControl_.PanTiltPosInq();
144  stringstream txt; txt<<viscaControl_.GetPan()<<"°; m_textPan->SetLabel(AsciiToWx(txt.str())); } } void wxViscaControlPanelButtons::OnDown( wxCommandEvent& event ) { if(viscaControl_.IsConnected()){ viscaControl_.MoveDown(); //viscaControl_.PanTiltPosInq(); stringstream txt; txt<<viscaControl_.GetTilt()<<"°"; m_textTilt->SetLabel(AsciiToWx(txt.str())); } } void wxViscaControlPanelButtons::OnDownLeft( wxCommandEvent& event ) { if(viscaControl_.IsConnected()){ viscaControl_.MoveDownLeft(); //viscaControl_.PanTiltPosInq(); stringstream txt; txt<<viscaControl_.GetTilt()<<"°"; m_textTilt->SetLabel(AsciiToWx(txt.str())); } } void wxViscaControlPanelButtons::OnDownRight( wxCommandEvent& event ) { if(viscaControl_.IsConnected()){ viscaControl_.MoveDownRight(); //viscaControl_.PanTiltPosInq(); stringstream txt; txt<<viscaControl_.GetTilt()<<"°"; m_textTilt->SetLabel(AsciiToWx(txt.str())); } } void wxViscaControlPanelButtons::OnStop( wxCommandEvent& event ) { if(viscaControl_.IsConnected()){ viscaControl_.MoveStop(); } } void wxViscaControlPanelButtons::OnButtonHome( wxCommandEvent& event ){ if(viscaControl_.IsConnected()){ viscaControl_.MoveStop(); biassleep(1); viscaControl_.MoveHome(); } } void wxViscaControlPanelButtons::OnConnect( wxCommandEvent& event ) { bool ret = false; if(!viscaControl_.IsConnected()){ wxString dev = m_textCtrlDevice->GetValue(); ret = viscaControl_.InitPanTiltUnit(WxToAscii(dev)); if (!ret) { wxMessageDialog messageDialog(this, wxT("Initialising Visca pan-tilt unit failed!"), wxT("Visca Controller"), wxICON_ERROR | wxOK); messageDialog.ShowModal(); return; } } else{ ret = viscaControl_.ClosePanTiltUnit(); if (!ret) { wxMessageDialog messageDialog(this, wxT("Closing Visca pan-tilt unit failed!"), wxT("Visca Controller"), wxICON_ERROR | wxOK); messageDialog.ShowModal(); return; } } if(viscaControl_.IsConnected()){ m_buttonConnect->SetLabel(AsciiToWx("Disconnect")); m_scrolledWindow1->Enable(true); wxString text= wxT("Connected!"); } else{ m_buttonConnect->SetLabel(AsciiToWx("Connect")); m_scrolledWindow1->Enable(false); wxString text= wxT("Disonnected!"); } } void wxViscaControlPanelButtons::OnClose( wxCommandEvent& event ) { Show(false); } bool wxViscaControlPanelButtons::SetColour(const wxColour &colour){ m_panel2->SetBackgroundColour(colour); m_scrolledWindow1->SetBackgroundColour(colour); m_buttonReset->SetBackgroundColour(colour); m_buttonOpen->SetBackgroundColour(colour); m_buttonCloseCam->SetBackgroundColour(colour); m_sliderZoom->SetBackgroundColour(colour); m_buttonWide->SetBackgroundColour(colour); m_buttonTele->SetBackgroundColour(colour); m_buttonZoomStop->SetBackgroundColour(colour); m_radioBox1->SetBackgroundColour(colour); m_staticText03->SetBackgroundColour(colour); m_textPan->SetBackgroundColour(colour); m_staticText04->SetBackgroundColour(colour); m_textTilt->SetBackgroundColour(colour); m_bpButtonUp->SetBackgroundColour(colour); m_bpButtonUpLeft->SetBackgroundColour(colour); m_bpButtonUpRight->SetBackgroundColour(colour); m_bpButtonLeft->SetBackgroundColour(colour); m_bpButtonStop->SetBackgroundColour(colour); m_bpButtonRight->SetBackgroundColour(colour); m_bpButtonDown->SetBackgroundColour(colour); m_bpButtonDownLeft->SetBackgroundColour(colour); m_bpButtonDownRight->SetBackgroundColour(colour); m_buttonConnect->SetBackgroundColour(colour); m_textCtrlDevice->SetBackgroundColour(colour); m_buttonClose->SetBackgroundColour(colour); m_buttonHome->SetBackgroundColour(colour); m_panelPanTilt->SetBackgroundColour(colour); return this->SetBackgroundColour(colour); } ";
145  m_textPan->SetLabel(AsciiToWx(txt.str()));
146  }
147 }
148 
149 void wxViscaControlPanelButtons::OnDown( wxCommandEvent& event )
150 {
153  //viscaControl_.PanTiltPosInq();
154  stringstream txt; txt<<viscaControl_.GetTilt()<<"°; m_textTilt->SetLabel(AsciiToWx(txt.str())); } } void wxViscaControlPanelButtons::OnDownLeft( wxCommandEvent& event ) { if(viscaControl_.IsConnected()){ viscaControl_.MoveDownLeft(); //viscaControl_.PanTiltPosInq(); stringstream txt; txt<<viscaControl_.GetTilt()<<"°"; m_textTilt->SetLabel(AsciiToWx(txt.str())); } } void wxViscaControlPanelButtons::OnDownRight( wxCommandEvent& event ) { if(viscaControl_.IsConnected()){ viscaControl_.MoveDownRight(); //viscaControl_.PanTiltPosInq(); stringstream txt; txt<<viscaControl_.GetTilt()<<"°"; m_textTilt->SetLabel(AsciiToWx(txt.str())); } } void wxViscaControlPanelButtons::OnStop( wxCommandEvent& event ) { if(viscaControl_.IsConnected()){ viscaControl_.MoveStop(); } } void wxViscaControlPanelButtons::OnButtonHome( wxCommandEvent& event ){ if(viscaControl_.IsConnected()){ viscaControl_.MoveStop(); biassleep(1); viscaControl_.MoveHome(); } } void wxViscaControlPanelButtons::OnConnect( wxCommandEvent& event ) { bool ret = false; if(!viscaControl_.IsConnected()){ wxString dev = m_textCtrlDevice->GetValue(); ret = viscaControl_.InitPanTiltUnit(WxToAscii(dev)); if (!ret) { wxMessageDialog messageDialog(this, wxT("Initialising Visca pan-tilt unit failed!"), wxT("Visca Controller"), wxICON_ERROR | wxOK); messageDialog.ShowModal(); return; } } else{ ret = viscaControl_.ClosePanTiltUnit(); if (!ret) { wxMessageDialog messageDialog(this, wxT("Closing Visca pan-tilt unit failed!"), wxT("Visca Controller"), wxICON_ERROR | wxOK); messageDialog.ShowModal(); return; } } if(viscaControl_.IsConnected()){ m_buttonConnect->SetLabel(AsciiToWx("Disconnect")); m_scrolledWindow1->Enable(true); wxString text= wxT("Connected!"); } else{ m_buttonConnect->SetLabel(AsciiToWx("Connect")); m_scrolledWindow1->Enable(false); wxString text= wxT("Disonnected!"); } } void wxViscaControlPanelButtons::OnClose( wxCommandEvent& event ) { Show(false); } bool wxViscaControlPanelButtons::SetColour(const wxColour &colour){ m_panel2->SetBackgroundColour(colour); m_scrolledWindow1->SetBackgroundColour(colour); m_buttonReset->SetBackgroundColour(colour); m_buttonOpen->SetBackgroundColour(colour); m_buttonCloseCam->SetBackgroundColour(colour); m_sliderZoom->SetBackgroundColour(colour); m_buttonWide->SetBackgroundColour(colour); m_buttonTele->SetBackgroundColour(colour); m_buttonZoomStop->SetBackgroundColour(colour); m_radioBox1->SetBackgroundColour(colour); m_staticText03->SetBackgroundColour(colour); m_textPan->SetBackgroundColour(colour); m_staticText04->SetBackgroundColour(colour); m_textTilt->SetBackgroundColour(colour); m_bpButtonUp->SetBackgroundColour(colour); m_bpButtonUpLeft->SetBackgroundColour(colour); m_bpButtonUpRight->SetBackgroundColour(colour); m_bpButtonLeft->SetBackgroundColour(colour); m_bpButtonStop->SetBackgroundColour(colour); m_bpButtonRight->SetBackgroundColour(colour); m_bpButtonDown->SetBackgroundColour(colour); m_bpButtonDownLeft->SetBackgroundColour(colour); m_bpButtonDownRight->SetBackgroundColour(colour); m_buttonConnect->SetBackgroundColour(colour); m_textCtrlDevice->SetBackgroundColour(colour); m_buttonClose->SetBackgroundColour(colour); m_buttonHome->SetBackgroundColour(colour); m_panelPanTilt->SetBackgroundColour(colour); return this->SetBackgroundColour(colour); } ";
155  m_textTilt->SetLabel(AsciiToWx(txt.str()));
156  }
157 }
158 void wxViscaControlPanelButtons::OnDownLeft( wxCommandEvent& event )
159 {
162  //viscaControl_.PanTiltPosInq();
163  stringstream txt; txt<<viscaControl_.GetTilt()<<"°; m_textTilt->SetLabel(AsciiToWx(txt.str())); } } void wxViscaControlPanelButtons::OnDownRight( wxCommandEvent& event ) { if(viscaControl_.IsConnected()){ viscaControl_.MoveDownRight(); //viscaControl_.PanTiltPosInq(); stringstream txt; txt<<viscaControl_.GetTilt()<<"°"; m_textTilt->SetLabel(AsciiToWx(txt.str())); } } void wxViscaControlPanelButtons::OnStop( wxCommandEvent& event ) { if(viscaControl_.IsConnected()){ viscaControl_.MoveStop(); } } void wxViscaControlPanelButtons::OnButtonHome( wxCommandEvent& event ){ if(viscaControl_.IsConnected()){ viscaControl_.MoveStop(); biassleep(1); viscaControl_.MoveHome(); } } void wxViscaControlPanelButtons::OnConnect( wxCommandEvent& event ) { bool ret = false; if(!viscaControl_.IsConnected()){ wxString dev = m_textCtrlDevice->GetValue(); ret = viscaControl_.InitPanTiltUnit(WxToAscii(dev)); if (!ret) { wxMessageDialog messageDialog(this, wxT("Initialising Visca pan-tilt unit failed!"), wxT("Visca Controller"), wxICON_ERROR | wxOK); messageDialog.ShowModal(); return; } } else{ ret = viscaControl_.ClosePanTiltUnit(); if (!ret) { wxMessageDialog messageDialog(this, wxT("Closing Visca pan-tilt unit failed!"), wxT("Visca Controller"), wxICON_ERROR | wxOK); messageDialog.ShowModal(); return; } } if(viscaControl_.IsConnected()){ m_buttonConnect->SetLabel(AsciiToWx("Disconnect")); m_scrolledWindow1->Enable(true); wxString text= wxT("Connected!"); } else{ m_buttonConnect->SetLabel(AsciiToWx("Connect")); m_scrolledWindow1->Enable(false); wxString text= wxT("Disonnected!"); } } void wxViscaControlPanelButtons::OnClose( wxCommandEvent& event ) { Show(false); } bool wxViscaControlPanelButtons::SetColour(const wxColour &colour){ m_panel2->SetBackgroundColour(colour); m_scrolledWindow1->SetBackgroundColour(colour); m_buttonReset->SetBackgroundColour(colour); m_buttonOpen->SetBackgroundColour(colour); m_buttonCloseCam->SetBackgroundColour(colour); m_sliderZoom->SetBackgroundColour(colour); m_buttonWide->SetBackgroundColour(colour); m_buttonTele->SetBackgroundColour(colour); m_buttonZoomStop->SetBackgroundColour(colour); m_radioBox1->SetBackgroundColour(colour); m_staticText03->SetBackgroundColour(colour); m_textPan->SetBackgroundColour(colour); m_staticText04->SetBackgroundColour(colour); m_textTilt->SetBackgroundColour(colour); m_bpButtonUp->SetBackgroundColour(colour); m_bpButtonUpLeft->SetBackgroundColour(colour); m_bpButtonUpRight->SetBackgroundColour(colour); m_bpButtonLeft->SetBackgroundColour(colour); m_bpButtonStop->SetBackgroundColour(colour); m_bpButtonRight->SetBackgroundColour(colour); m_bpButtonDown->SetBackgroundColour(colour); m_bpButtonDownLeft->SetBackgroundColour(colour); m_bpButtonDownRight->SetBackgroundColour(colour); m_buttonConnect->SetBackgroundColour(colour); m_textCtrlDevice->SetBackgroundColour(colour); m_buttonClose->SetBackgroundColour(colour); m_buttonHome->SetBackgroundColour(colour); m_panelPanTilt->SetBackgroundColour(colour); return this->SetBackgroundColour(colour); } ";
164  m_textTilt->SetLabel(AsciiToWx(txt.str()));
165  }
166 }
167 void wxViscaControlPanelButtons::OnDownRight( wxCommandEvent& event )
168 {
171  //viscaControl_.PanTiltPosInq();
172  stringstream txt; txt<<viscaControl_.GetTilt()<<"°; m_textTilt->SetLabel(AsciiToWx(txt.str())); } } void wxViscaControlPanelButtons::OnStop( wxCommandEvent& event ) { if(viscaControl_.IsConnected()){ viscaControl_.MoveStop(); } } void wxViscaControlPanelButtons::OnButtonHome( wxCommandEvent& event ){ if(viscaControl_.IsConnected()){ viscaControl_.MoveStop(); biassleep(1); viscaControl_.MoveHome(); } } void wxViscaControlPanelButtons::OnConnect( wxCommandEvent& event ) { bool ret = false; if(!viscaControl_.IsConnected()){ wxString dev = m_textCtrlDevice->GetValue(); ret = viscaControl_.InitPanTiltUnit(WxToAscii(dev)); if (!ret) { wxMessageDialog messageDialog(this, wxT("Initialising Visca pan-tilt unit failed!"), wxT("Visca Controller"), wxICON_ERROR | wxOK); messageDialog.ShowModal(); return; } } else{ ret = viscaControl_.ClosePanTiltUnit(); if (!ret) { wxMessageDialog messageDialog(this, wxT("Closing Visca pan-tilt unit failed!"), wxT("Visca Controller"), wxICON_ERROR | wxOK); messageDialog.ShowModal(); return; } } if(viscaControl_.IsConnected()){ m_buttonConnect->SetLabel(AsciiToWx("Disconnect")); m_scrolledWindow1->Enable(true); wxString text= wxT("Connected!"); } else{ m_buttonConnect->SetLabel(AsciiToWx("Connect")); m_scrolledWindow1->Enable(false); wxString text= wxT("Disonnected!"); } } void wxViscaControlPanelButtons::OnClose( wxCommandEvent& event ) { Show(false); } bool wxViscaControlPanelButtons::SetColour(const wxColour &colour){ m_panel2->SetBackgroundColour(colour); m_scrolledWindow1->SetBackgroundColour(colour); m_buttonReset->SetBackgroundColour(colour); m_buttonOpen->SetBackgroundColour(colour); m_buttonCloseCam->SetBackgroundColour(colour); m_sliderZoom->SetBackgroundColour(colour); m_buttonWide->SetBackgroundColour(colour); m_buttonTele->SetBackgroundColour(colour); m_buttonZoomStop->SetBackgroundColour(colour); m_radioBox1->SetBackgroundColour(colour); m_staticText03->SetBackgroundColour(colour); m_textPan->SetBackgroundColour(colour); m_staticText04->SetBackgroundColour(colour); m_textTilt->SetBackgroundColour(colour); m_bpButtonUp->SetBackgroundColour(colour); m_bpButtonUpLeft->SetBackgroundColour(colour); m_bpButtonUpRight->SetBackgroundColour(colour); m_bpButtonLeft->SetBackgroundColour(colour); m_bpButtonStop->SetBackgroundColour(colour); m_bpButtonRight->SetBackgroundColour(colour); m_bpButtonDown->SetBackgroundColour(colour); m_bpButtonDownLeft->SetBackgroundColour(colour); m_bpButtonDownRight->SetBackgroundColour(colour); m_buttonConnect->SetBackgroundColour(colour); m_textCtrlDevice->SetBackgroundColour(colour); m_buttonClose->SetBackgroundColour(colour); m_buttonHome->SetBackgroundColour(colour); m_panelPanTilt->SetBackgroundColour(colour); return this->SetBackgroundColour(colour); } ";
173  m_textTilt->SetLabel(AsciiToWx(txt.str()));
174  }
175 }
176 
177 void wxViscaControlPanelButtons::OnStop( wxCommandEvent& event )
178 {
181  }
182 }
183 
184 void wxViscaControlPanelButtons::OnButtonHome( wxCommandEvent& event ){
187  biassleep(1);
189  }
190 }
191 
192 void wxViscaControlPanelButtons::OnConnect( wxCommandEvent& event )
193 {
194  bool ret = false;
195 
196  if(!viscaControl_.IsConnected()){
197  wxString dev = m_textCtrlDevice->GetValue();
198  ret = viscaControl_.InitPanTiltUnit(WxToAscii(dev));
199  if (!ret) {
200  wxMessageDialog messageDialog(this,
201  wxT("Initialising Visca pan-tilt unit failed!"),
202  wxT("Visca Controller"), wxICON_ERROR | wxOK);
203  messageDialog.ShowModal();
204  return;
205  }
206  }
207  else{
209  if (!ret) {
210  wxMessageDialog messageDialog(this,
211  wxT("Closing Visca pan-tilt unit failed!"),
212  wxT("Visca Controller"), wxICON_ERROR | wxOK);
213  messageDialog.ShowModal();
214  return;
215  }
216  }
217 
219  m_buttonConnect->SetLabel(AsciiToWx("Disconnect"));
220  m_scrolledWindow1->Enable(true);
221  wxString text= wxT("Connected!");
222  }
223  else{
224  m_buttonConnect->SetLabel(AsciiToWx("Connect"));
225  m_scrolledWindow1->Enable(false);
226  wxString text= wxT("Disonnected!");
227  }
228 }
229 
230 void wxViscaControlPanelButtons::OnClose( wxCommandEvent& event )
231 {
232  Show(false);
233 }
234 
235 bool wxViscaControlPanelButtons::SetColour(const wxColour &colour){
236 
237  m_panel2->SetBackgroundColour(colour);
238  m_scrolledWindow1->SetBackgroundColour(colour);
239  m_buttonReset->SetBackgroundColour(colour);
240  m_buttonOpen->SetBackgroundColour(colour);
241  m_buttonCloseCam->SetBackgroundColour(colour);
242  m_sliderZoom->SetBackgroundColour(colour);
243  m_buttonWide->SetBackgroundColour(colour);
244  m_buttonTele->SetBackgroundColour(colour);
245  m_buttonZoomStop->SetBackgroundColour(colour);
246  m_radioBox1->SetBackgroundColour(colour);
247  m_staticText03->SetBackgroundColour(colour);
248  m_textPan->SetBackgroundColour(colour);
249  m_staticText04->SetBackgroundColour(colour);
250  m_textTilt->SetBackgroundColour(colour);
251  m_bpButtonUp->SetBackgroundColour(colour);
252  m_bpButtonUpLeft->SetBackgroundColour(colour);
253  m_bpButtonUpRight->SetBackgroundColour(colour);
254  m_bpButtonLeft->SetBackgroundColour(colour);
255  m_bpButtonStop->SetBackgroundColour(colour);
256  m_bpButtonRight->SetBackgroundColour(colour);
257  m_bpButtonDown->SetBackgroundColour(colour);
258  m_bpButtonDownLeft->SetBackgroundColour(colour);
259  m_bpButtonDownRight->SetBackgroundColour(colour);
260  m_buttonConnect->SetBackgroundColour(colour);
261  m_textCtrlDevice->SetBackgroundColour(colour);
262  m_buttonClose->SetBackgroundColour(colour);
263  m_buttonHome->SetBackgroundColour(colour);
264  m_panelPanTilt->SetBackgroundColour(colour);
265  return this->SetBackgroundColour(colour);
266 }
ViscaControl::VISCA_CONSTANT GetCCDScanningMode()
wxString AsciiToWx(const char *thestring)
Converts a C string to a wxString.
Definition: StringConv.hh:32
void ZoomDirect(short zoom)
Class wxViscaControlPanelButtonsInterface.
void CamPower(bool mode)
bool SetCCDScanningMode(VISCA_CONSTANT mode)
wxViscaControlPanelButtons(wxWindow *parent)
Constructor.
bool InitPanTiltUnit(std::string port)