void CClickWindowController::Finalize ()
{
	if (m_pViacamController->GetMainWindow())
	{
		m_pViacamController->GetMainWindow()->Disconnect 
			(ID_WVIACAM, wxEVT_SHOW, wxShowEventHandler(CClickWindow::OnMainWindowShow), NULL, m_pWindowText);
		m_pViacamController->GetMainWindow()->Disconnect 
			(ID_WVIACAM, wxEVT_SHOW, wxShowEventHandler(CClickWindow::OnMainWindowShow), NULL, m_pWindowBitmap);
		m_pViacamController->GetMainWindow()->Disconnect 
			(ID_WVIACAM, wxEVT_SHOW, wxShowEventHandler(CClickWindow::OnMainWindowShow), NULL, m_pWindowBitmapVertical);
		m_pViacamController->GetMainWindow()->Disconnect 
			(ID_WVIACAM, wxEVT_SHOW, wxShowEventHandler(CClickWindow::OnMainWindowShow), NULL, m_pWindowTextVertical);
	
	}
	if (m_pWindow)
	{
		m_pWindowText->Show(false);
		m_pWindowText->Destroy ();
		m_pWindowText= NULL;
		m_pWindowBitmap->Show(false);
		m_pWindowBitmap->Destroy ();
		m_pWindowBitmap= NULL;
		m_pWindowBitmapVertical->Show(false);
		m_pWindowBitmapVertical->Destroy ();
		m_pWindowBitmapVertical= NULL;
		m_pWindowTextVertical->Show(false);
		m_pWindowTextVertical->Destroy ();
		m_pWindowTextVertical= NULL;
		m_pWindow= NULL;
	}	
}
Ejemplo n.º 2
0
GEUIDialog::GEUIDialog(wxWindow *pparent, wxWindowID id, wxAuiManager *auimgr, int tbitem, gecomapi_pi *ppi)
      :wxPanel(pparent, id, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE, _T("GoogleEarth"))
{
      pPlugIn = ppi;
      LogDebugMessage(_T("Constructing the GE plugin window"));
      m_pauimgr = auimgr;
      m_toolbar_item_id = tbitem;
      m_ballowStart = false;
      m_bshouldcatchup = true;
      m_bbusy = false;

      m_pfocusedwindow = FindFocus();
      GEParentHwnd = NULL;

      this->SetSizeHints( wxDefaultSize, wxDefaultSize );

      itemBoxSizer = new wxBoxSizer(wxVERTICAL);
      SetSizerAndFit(itemBoxSizer);

      m_panel1 = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
	itemBoxSizer->Add( m_panel1, 1, wxEXPAND | wxALL, 5 );

      itemBoxSizer1 = new wxBoxSizer(wxHORIZONTAL);
      itemBoxSizer->Add(itemBoxSizer1, 0, wxEXPAND);

      m_cbConnected = new wxCheckBox( this, wxID_ANY, _("Connected to chart viewport"), wxDefaultPosition, wxDefaultSize, 0 );
	itemBoxSizer1->Add( m_cbConnected, 0, wxALIGN_RIGHT|wxALL, 10 );

      m_buttonSave = new wxButton( this, wxID_ANY, _("Save view..."), wxDefaultPosition, wxDefaultSize, 0 );
      itemBoxSizer1->Add( m_buttonSave, 0, wxALIGN_RIGHT|wxBOTTOM|wxLEFT|wxRIGHT|wxTOP, 5 );
	
	this->Layout();
	
	this->Centre( wxBOTH );

      Connect(this->GetId(), wxEVT_SIZE, wxSizeEventHandler(GEUIDialog::OnSize));
      Connect(this->GetId(), wxEVT_SHOW, wxShowEventHandler(GEUIDialog::OnShow));
      
      app = NULL;

      m_bgeisuseable = false;
      m_binitializing = false;
      m_bclosed = false;
      m_bisfollowingboat = false;

      //LogDebugMessage(_T("GE plugin window created, going to start GE"));
      //GEInitialize();
      m_buttonSave->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GEUIDialog::SaveView ), NULL, this );
      m_cbConnected->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( GEUIDialog::ConnectedClicked ), NULL, this );

      ConnectToGE();

      m_stopwatch.Start();
      m_stopwatch_boat.Start();
      m_pPositions = new PositionsList();
      m_sEnvelopeKmlFilename = wxStandardPaths::Get().GetTempDir() + _T("\\gecomapi.kml");
      m_sLiveKmlFilename = wxStandardPaths::Get().GetTempDir() + _T("\\gecomapilive.kml");

      m_pdialog = new GESaveViewDlgImpl(this,  wxID_ANY, _("Save view"), wxDefaultPosition, wxSize( -1,-1 ), wxDEFAULT_DIALOG_STYLE );
}
CClickWindowController::CClickWindowController(CViacamController & pViacamController)
{
	m_pViacamController= &pViacamController;

	// Create text window
	m_pWindowText= new CClickWindowText (NULL);	
	m_pWindowText->SetController (*this);	
	
	// Create bitmap window
	m_pWindowBitmap= new CClickWindowBitmap (NULL);
	m_pWindowBitmap->SetController (*this);	
	
	// Create bitmap vertical window
	m_pWindowBitmapVertical= new CClickWindowBitmapVertical (NULL);
	m_pWindowBitmapVertical->SetController (*this);	
	
	// Create text vertical window
	m_pWindowTextVertical= new CClickWindowTextVertical (NULL);
	m_pWindowTextVertical->SetController (*this);	
	
	// Set current window
	m_pWindow= m_pWindowBitmap;
	
	// FIXME: implement this using the observer pattern
	m_pViacamController->GetMainWindow()->Connect 
			(ID_WVIACAM, wxEVT_SHOW, wxShowEventHandler(CClickWindow::OnMainWindowShow), NULL, m_pWindow);
	
	InitDefaults();

	Reset();	
}
// Select appropiate window taking into account design and location
void CClickWindowController::SelectAppropiateWindow (EDesign design, ELocation location)
{
	bool isAutohide= m_autohide;
	bool isHorizontal=
		(location == FLOATING_HORIZONTAL || location == TOP_DOCKED || location == BOTTOM_DOCKED);
		
	WXAppBar::EDocking oldDocking= m_pWindow->GetDockingMode();
	
	if (design == CClickWindowController::NORMAL) {
		if (isHorizontal)
			m_pWindow= m_pWindowBitmap;
		else
			m_pWindow= m_pWindowBitmapVertical;
	}
	else {
		if (isHorizontal)
			m_pWindow= m_pWindowText;
		else
			m_pWindow= m_pWindowTextVertical;
	}
	
	// FIXME: implement this using the observer pattern
	m_pViacamController->GetMainWindow()->Connect 
			(ID_WVIACAM, wxEVT_SHOW, wxShowEventHandler(CClickWindow::OnMainWindowShow), NULL, m_pWindow);
	
	m_pWindow->SetDockingMode(oldDocking);
	SetAutohide(isAutohide);
}
Ejemplo n.º 5
0
// Note: according to documentation, this event is only available under wxMSW, wxGTK, and wxOS2
void CCManager::OnAutocompleteHide(wxShowEvent& event)
{
    event.Skip();
    DoHidePopup();
    wxObject* evtObj = event.GetEventObject();
    if (evtObj)
        static_cast<wxWindow*>(evtObj)->Disconnect(wxEVT_SHOW, wxShowEventHandler(CCManager::OnAutocompleteHide), nullptr, this);
    if (m_CallTipActive != wxSCI_INVALID_POSITION && !m_AutoLaunchTimer.IsRunning())
        m_CallTipTimer.Start(CALLTIP_REFRESH_DELAY, wxTIMER_ONE_SHOT);
}
Ejemplo n.º 6
0
obabelUIDialogBase::~obabelUIDialogBase()
{
	// Disconnect Events
	this->Disconnect( wxEVT_SHOW, wxShowEventHandler( obabelUIDialogBase::OnShow ) );
	this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( obabelUIDialogBase::OnClose ) );
	this->Disconnect( wxEVT_SIZE, wxSizeEventHandler( obabelUIDialogBase::OnSize ) );

	m_locatebabel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( obabelUIDialogBase::LocateBabel ), NULL, this );
	m_button32->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( obabelUIDialogBase::ShowOptions ), NULL, this );
	m_button33->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( obabelUIDialogBase::About ), NULL, this );

	m_sendbabelclip->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( obabelUIDialogBase::SendBabelClip), NULL, this );
	m_sendbabelfile->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( obabelUIDialogBase::SendBabelFile), NULL, this );
	m_clip->Disconnect( wxEVT_RIGHT_UP, wxMouseEventHandler( obabelUIDialogBase::OnPaste ), NULL, this );

}
Ejemplo n.º 7
0
void CCManager::OnAutocompleteSelect(wxListEvent& event)
{
    event.Skip();
    m_AutocompSelectTimer.Start(AUTOCOMP_SELECT_DELAY, wxTIMER_ONE_SHOT);
    wxObject* evtObj = event.GetEventObject();
#ifdef __WXMSW__
    m_pAutocompPopup = static_cast<wxListView*>(evtObj);
#endif // __WXMSW__
    if (!evtObj)
        return;
    wxWindow* evtWin = static_cast<wxWindow*>(evtObj)->GetParent();
    if (!evtWin)
        return;
    m_DocPos = m_pPopup->GetParent()->ScreenToClient(evtWin->GetScreenPosition());
    m_DocPos.x += evtWin->GetSize().x;
    cbEditor* ed = Manager::Get()->GetEditorManager()->GetBuiltinActiveEditor();
    wxRect edRect = ed->GetRect();
    if (!m_pPopup->IsShown())
    {
        cbStyledTextCtrl* stc = ed->GetControl();
        int acMaxHeight = stc->AutoCompGetMaxHeight() + 1;
        int textHeight = stc->TextHeight(stc->GetCurrentLine());
        m_DocSize.x = edRect.width * 5 / 12;
        m_DocSize.y = acMaxHeight * textHeight;
        evtWin->Connect(wxEVT_SHOW, wxShowEventHandler(CCManager::OnAutocompleteHide), nullptr, this);

        const int idx = wxDisplay::GetFromWindow(evtWin);
        m_WindowBound = m_DocPos.x + m_DocSize.x;
        if (idx != wxNOT_FOUND)
        {
            const wxPoint& corner = m_pPopup->GetParent()->ScreenToClient(wxDisplay(idx).GetGeometry().GetBottomRight());
            m_DocSize.y = std::max(9 * textHeight,      std::min(m_DocSize.y, corner.y - m_DocPos.y - 2));
            m_DocSize.x = std::max(m_DocSize.y * 2 / 3, std::min(m_DocSize.x, corner.x - m_DocPos.x - 2));
            m_WindowBound = std::min(corner.x - 2, m_WindowBound);
        }
    }
    if ((m_DocPos.x + m_DocSize.x) > m_WindowBound)
        m_DocPos.x -= evtWin->GetSize().x + m_DocSize.x; // show to the left instead
    else
        m_DocSize.x = std::min(m_WindowBound - m_DocPos.x, edRect.width * 5 / 12);
}
Ejemplo n.º 8
0
obabelUIDialogBase::obabelUIDialogBase( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
{
	this->SetSizeHints( wxDefaultSize, wxDefaultSize );
	
	wxBoxSizer* bSizer1;
	bSizer1 = new wxBoxSizer( wxVERTICAL );
	
	wxStaticBoxSizer* sbSizer3;
	sbSizer3 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, wxT("GPSBabel") ), wxHORIZONTAL );
	
	m_textCtrl1 = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition,  wxSize( 180,-1 ), wxTE_READONLY|wxSIMPLE_BORDER );
	sbSizer3->Add( m_textCtrl1, 0, wxALL|wxEXPAND, 5 );
	
	sbSizer3->Add( 0, 0, 1, wxEXPAND, 5 );

	m_locatebabel = new wxButton( this, wxID_ANY , _("Locate GPSBabel"), wxDefaultPosition, wxSize( 100,-1 ), 0 );
	m_locatebabel->SetToolTip(_("Select location of GPSBabel"));	
	sbSizer3->Add( m_locatebabel, 0, wxALL, 5 );

	sbSizer3->Add( 0, 0, 1, wxEXPAND, 5 );

	// Start About Information Button
	m_button33 = new wxButton( this, wxID_ANY , wxT("???"), wxDefaultPosition, wxSize( 40,-1 ), 0 );
	m_button33->SetToolTip(wxT("About oBabel"));	
	sbSizer3->Add( m_button33, 0, wxALL, 5 );

	sbSizer3->Add( 0, 0, 1, wxEXPAND, 5 );

	bSizer1->Add( sbSizer3, 0, wxEXPAND, 5 );
	
	wxStaticBoxSizer* sbSizer4;
	sbSizer4 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, wxT("Options") ), wxHORIZONTAL );
	
	wxString m_deviceChoices[] = { wxT("garmin"), wxT("nmea") };
	int m_deviceNChoices = sizeof( m_deviceChoices ) / sizeof( wxString );
	m_device = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_deviceNChoices, m_deviceChoices, 0 );
	m_device->SetSelection( 0 );
	sbSizer4->Add( m_device, 0, wxALL, 5 );
	
	
	sbSizer4->Add( 0, 0, 1, wxEXPAND, 5 );
	
	m_waypoint = new wxCheckBox( this, wxID_ANY, wxT("Wayoints"), wxDefaultPosition, wxDefaultSize, 0 );
	m_waypoint->SetValue(false); 
	sbSizer4->Add( m_waypoint, 0, wxALL, 5 );
	
	
	sbSizer4->Add( 0, 0, 1, wxEXPAND, 5 );
	
	m_route = new wxCheckBox( this, wxID_ANY, wxT("Routes"), wxDefaultPosition, wxDefaultSize, 0 );
	m_waypoint->SetValue(false); 
	sbSizer4->Add( m_route, 0, wxALL, 5 );
	
	
	sbSizer4->Add( 0, 0, 1, wxEXPAND, 5 );
	
	m_track = new wxCheckBox( this, wxID_ANY, wxT("Tracks"), wxDefaultPosition, wxDefaultSize, 0 );
	m_waypoint->SetValue(false); 
	sbSizer4->Add( m_track, 0, wxALL, 5 );
	
	bSizer1->Add( sbSizer4, 0, wxEXPAND, 5 );

	wxStaticBoxSizer* sbSizer2;
	sbSizer2 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, wxT("Finalise") ), wxHORIZONTAL );
	
	sbSizer2->SetMinSize( wxSize( 215, -1 ) ); 

	wxArrayString m_choice1Choices ;
	m_choice1 = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choice1Choices, 0);	
		
	sbSizer2->Add( m_choice1, 0, wxEXPAND, 5 );

	sbSizer2->Add( 0, 0, 1, wxEXPAND, 5 );

	wxString m_formatChoices[] = { wxT("oGPX"), wxT("KML"),wxT("GPX")};
	int m_formatNChoices = sizeof( m_formatChoices ) / sizeof( wxString );
	m_format = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_formatNChoices, m_formatChoices, 0 );
	m_format->SetSelection( 0 );
	sbSizer2->Add( m_format, 0, wxALL, 5 );

	m_button32 = new wxButton( this, wxID_ANY , wxT("Chosen Options"), wxDefaultPosition, wxSize( 120,-1 ), 0 );
	m_button32->SetToolTip(wxT("Show options for the transfer"));	
	sbSizer2->Add( m_button32, 0, wxALL, 5 );
	
	bSizer1->Add( sbSizer2, 0,  wxEXPAND, 5 );

	wxStaticBoxSizer* bSizer2;
	bSizer2 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, wxT("Source and Send") ), wxHORIZONTAL );
	
	m_sendbabelclip = new wxButton( this, 6, wxT("Clipboard->GPSBabel"), wxDefaultPosition, wxSize( 160,-1 ), 0 );
	bSizer2->Add( m_sendbabelclip, 0, wxALL, 5 );
	
   	
	m_sendbabelfile = new wxButton( this, 0 , wxT("File->GPSBabel"), wxDefaultPosition, wxSize( 160,-1 ), 0 );
	bSizer2->Add( m_sendbabelfile, 0, wxALL, 5 );
	bSizer1->Add( bSizer2, 0,  wxEXPAND, 5 );

	wxStaticBoxSizer* Clipboard;
	Clipboard = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, wxT("Clipboard") ), wxVERTICAL );
	
	m_clip = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_WORDWRAP|wxVSCROLL );
	m_clip->SetMinSize( wxSize( 30,100 ) );
	
	Clipboard->Add( m_clip, 100, wxALL|wxEXPAND, 5 );
	
	bSizer1->Add( Clipboard, 1, wxEXPAND, 5 );

	this->SetSizer( bSizer1 );
	this->Layout();
	bSizer1->Fit( this );
	
	this->Centre( wxBOTH );
	
	// Connect Events
	
	this->Connect( wxEVT_SHOW, wxShowEventHandler( obabelUIDialogBase::OnShow ) );
	this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( obabelUIDialogBase::OnClose ) );
	this->Connect( wxEVT_SIZE, wxSizeEventHandler( obabelUIDialogBase::OnSize ) );
	
	m_locatebabel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( obabelUIDialogBase::LocateBabel), NULL, this );
	m_button32->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( obabelUIDialogBase::ShowOptions ), NULL, this );
	m_button33->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( obabelUIDialogBase::About ), NULL, this );

	m_sendbabelclip->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( obabelUIDialogBase::SendBabelClip), NULL, this );
	m_sendbabelfile->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( obabelUIDialogBase::SendBabelFile), NULL, this );

	m_clip->Connect( wxEVT_RIGHT_UP, wxMouseEventHandler( obabelUIDialogBase::OnPaste ), NULL, this );

}