1 #include "wxViscaControlPanelButtons.h"
2 #include <Gui/StringConv.hh>
3 #include <Base/Common/W32Compat.hh>
5 #include <wx/artprov.h>
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>
38 m_bpButtonStop->SetBitmapLabel(wxBitmap(wxArtProvider::GetIcon(wxART_ERROR,wxART_BUTTON)));
44 cout<<
"Setting zoom step:"<<step<<endl;
66 int sel =
event.GetInt();
75 cout<<
"CCD Scanning:"<<ret<<endl;
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);
}
";
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);
}
";
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);
}
";
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);
}
";
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);
}
";
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);
}
";
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);
}
";
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);
}
";
200 wxMessageDialog messageDialog(
this,
201 wxT(
"Initialising Visca pan-tilt unit failed!"),
202 wxT(
"Visca Controller"), wxICON_ERROR | wxOK);
203 messageDialog.ShowModal();
210 wxMessageDialog messageDialog(
this,
211 wxT(
"Closing Visca pan-tilt unit failed!"),
212 wxT(
"Visca Controller"), wxICON_ERROR | wxOK);
213 messageDialog.ShowModal();
221 wxString text= wxT(
"Connected!");
226 wxString text= wxT(
"Disonnected!");
237 m_panel2->SetBackgroundColour(colour);
265 return this->SetBackgroundColour(colour);
ViscaControl::VISCA_CONSTANT GetCCDScanningMode()
wxString AsciiToWx(const char *thestring)
Converts a C string to a wxString.
void ZoomDirect(short zoom)
bool SetCCDScanningMode(VISCA_CONSTANT mode)
bool InitPanTiltUnit(std::string port)