2008-03-14 18:17:51 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2009-11-21 15:39:50 +00:00
|
|
|
// Name: dialog_freeroute.cpp
|
2008-03-14 18:17:51 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#include "fctsys.h"
|
2009-02-04 15:25:03 +00:00
|
|
|
#include "appl_wxstruct.h"
|
2008-03-14 18:17:51 +00:00
|
|
|
#include "common.h"
|
2009-02-04 15:25:03 +00:00
|
|
|
#include "gestfich.h"
|
2008-03-14 18:17:51 +00:00
|
|
|
#include "pcbnew.h"
|
2009-07-30 11:04:07 +00:00
|
|
|
#include "wxPcbStruct.h"
|
2009-11-21 15:39:50 +00:00
|
|
|
#include "../common/dialog_display_info_HTML_base.h"
|
2008-03-14 18:17:51 +00:00
|
|
|
|
|
|
|
#include "dialog_freeroute_exchange.h"
|
|
|
|
|
|
|
|
|
|
|
|
#define FREEROUTE_URL_KEY wxT( "freeroute_url" )
|
|
|
|
#define FREEROUTE_RUN_KEY wxT( "freeroute_command" )
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************/
|
|
|
|
void WinEDA_PcbFrame::Access_to_External_Tool( wxCommandEvent& event )
|
|
|
|
/**********************************************************************/
|
|
|
|
|
|
|
|
/* Run an external tool (currently, only freeroute)
|
|
|
|
*/
|
|
|
|
{
|
2009-11-21 15:39:50 +00:00
|
|
|
DIALOG_FREEROUTE dialog( this );
|
2008-03-14 18:17:51 +00:00
|
|
|
|
|
|
|
dialog.ShowModal();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-11-21 15:39:50 +00:00
|
|
|
DIALOG_FREEROUTE::DIALOG_FREEROUTE( WinEDA_PcbFrame* parent ):
|
|
|
|
DIALOG_FREEROUTE_BASE( parent )
|
2008-03-14 18:17:51 +00:00
|
|
|
{
|
2009-11-21 15:39:50 +00:00
|
|
|
m_Parent = parent;
|
|
|
|
MyInit();
|
2009-11-23 17:24:33 +00:00
|
|
|
|
|
|
|
GetSizer()->SetSizeHints( this );
|
2008-03-14 18:17:51 +00:00
|
|
|
Centre();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-11-23 17:24:33 +00:00
|
|
|
/* Specific data initialisation
|
2008-03-14 18:17:51 +00:00
|
|
|
*/
|
|
|
|
|
2009-11-21 15:39:50 +00:00
|
|
|
void DIALOG_FREEROUTE::MyInit()
|
2008-03-14 18:17:51 +00:00
|
|
|
{
|
2009-11-21 15:39:50 +00:00
|
|
|
SetFocus();
|
2008-03-14 18:17:51 +00:00
|
|
|
m_FreeRouteSetupChanged = false;
|
|
|
|
|
|
|
|
wxString msg;
|
2008-12-08 15:27:13 +00:00
|
|
|
wxGetApp().m_EDA_Config->Read( FREEROUTE_URL_KEY, &msg );
|
2008-03-14 18:17:51 +00:00
|
|
|
if( msg.IsEmpty() )
|
|
|
|
m_FreerouteURLName->SetValue( wxT( "http://www.freerouting.net/" ) );
|
|
|
|
else
|
|
|
|
m_FreerouteURLName->SetValue( msg );
|
|
|
|
}
|
|
|
|
|
2009-11-21 15:39:50 +00:00
|
|
|
const char * s_FreeRouteHelpInfo =
|
|
|
|
#include "dialog_freeroute_exchange_help_html.h"
|
|
|
|
;
|
|
|
|
void DIALOG_FREEROUTE::OnHelpButtonClick( wxCommandEvent& event )
|
2008-03-14 18:17:51 +00:00
|
|
|
{
|
2009-11-21 15:39:50 +00:00
|
|
|
DIALOG_DISPLAY_HTML_TEXT_BASE help_Dlg( this, wxID_ANY,
|
|
|
|
_("Freeroute Help"),wxDefaultPosition, wxSize( 650,550 ) );
|
2008-03-14 18:17:51 +00:00
|
|
|
|
2009-11-21 15:39:50 +00:00
|
|
|
wxString msg = CONV_FROM_UTF8(s_FreeRouteHelpInfo);
|
|
|
|
help_Dlg.m_htmlWindow->AppendToPage( msg );
|
|
|
|
help_Dlg.ShowModal();
|
2008-03-14 18:17:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_CREATE_EXPORT_DSN_FILE
|
|
|
|
*/
|
|
|
|
|
2009-11-21 15:39:50 +00:00
|
|
|
void DIALOG_FREEROUTE::OnExportButtonClick( wxCommandEvent& event )
|
2008-03-14 18:17:51 +00:00
|
|
|
{
|
|
|
|
m_Parent->ExportToSpecctra( event );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_IMPORT_FREEROUTE_DSN_FILE
|
|
|
|
*/
|
|
|
|
|
2009-11-21 15:39:50 +00:00
|
|
|
void DIALOG_FREEROUTE::OnImportButtonClick( wxCommandEvent& event )
|
2008-03-14 18:17:51 +00:00
|
|
|
{
|
|
|
|
m_Parent->ImportSpecctraSession( event );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RUN_FREEROUTE
|
|
|
|
*/
|
|
|
|
|
2009-11-21 15:39:50 +00:00
|
|
|
void DIALOG_FREEROUTE::OnLaunchButtonClick( wxCommandEvent& event )
|
2008-03-14 18:17:51 +00:00
|
|
|
{
|
2008-03-20 21:32:25 +00:00
|
|
|
wxString FullFileName = FindKicadFile( wxT( "freeroute.jnlp" ) );
|
|
|
|
wxString command;
|
|
|
|
|
|
|
|
if( wxFileExists( FullFileName ) )
|
|
|
|
{
|
2009-02-18 14:23:17 +00:00
|
|
|
// Wrap FullFileName in double quotes in case it has C:\Program Files in it.
|
|
|
|
// The space is interpreted as an argument separator.
|
|
|
|
command << wxT("javaws") << wxChar(' ') << wxChar('"') << FullFileName << wxChar('"');
|
2008-04-24 16:55:35 +00:00
|
|
|
ProcessExecute( command );
|
2008-03-20 21:32:25 +00:00
|
|
|
return;
|
|
|
|
}
|
2008-03-14 18:17:51 +00:00
|
|
|
|
2008-03-20 21:32:25 +00:00
|
|
|
command = m_FreerouteURLName->GetValue() + wxT( "/java/freeroute.jnlp" );
|
2008-03-18 21:18:04 +00:00
|
|
|
|
2008-03-14 18:17:51 +00:00
|
|
|
wxLaunchDefaultBrowser( command );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON
|
|
|
|
*/
|
|
|
|
|
2009-11-21 15:39:50 +00:00
|
|
|
void DIALOG_FREEROUTE::OnVisitButtonClick( wxCommandEvent& event )
|
2008-03-14 18:17:51 +00:00
|
|
|
{
|
|
|
|
wxString command = m_FreerouteURLName->GetValue();
|
|
|
|
|
|
|
|
wxLaunchDefaultBrowser( command );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CLOSE
|
|
|
|
*/
|
|
|
|
|
2009-11-21 15:39:50 +00:00
|
|
|
void DIALOG_FREEROUTE::OnCancelButtonClick( wxCommandEvent& event )
|
2008-03-14 18:17:51 +00:00
|
|
|
{
|
2008-03-19 13:49:23 +00:00
|
|
|
D(printf("OnCancelClick\n");)
|
|
|
|
Close( true );
|
2008-03-14 18:17:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-11-21 15:39:50 +00:00
|
|
|
void DIALOG_FREEROUTE::OnOKButtonClick( wxCommandEvent& event )
|
2008-03-14 18:17:51 +00:00
|
|
|
{
|
|
|
|
if( m_FreeRouteSetupChanged ) // Save new config
|
|
|
|
{
|
2008-12-08 15:27:13 +00:00
|
|
|
wxGetApp().m_EDA_Config->Write( FREEROUTE_URL_KEY,
|
|
|
|
m_FreerouteURLName->GetValue() );
|
2008-03-14 18:17:51 +00:00
|
|
|
}
|
|
|
|
|
2008-03-19 13:49:23 +00:00
|
|
|
Destroy();
|
2008-03-14 18:17:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* wxEVT_COMMAND_TEXT_UPDATED event handler for ID_TEXT_EDIT_FR_URL
|
|
|
|
*/
|
|
|
|
|
2009-11-21 15:39:50 +00:00
|
|
|
void DIALOG_FREEROUTE::OnTextEditFrUrlUpdated( wxCommandEvent& event )
|
2008-03-14 18:17:51 +00:00
|
|
|
{
|
|
|
|
m_FreeRouteSetupChanged = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|