44 DIALOG_SHIM( aParent, wxID_ANY,
_(
"Remote Symbol Settings" ), wxDefaultPosition,
45 wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER ),
55 wxBoxSizer* topSizer =
new wxBoxSizer( wxVERTICAL );
57 wxStaticText* intro =
new wxStaticText(
this, wxID_ANY,
58 _(
"Configure where downloaded remote libraries are stored and how they are named." ) );
59 intro->Wrap( FromDIP( 420 ) );
60 topSizer->Add( intro, 0, wxALL | wxEXPAND, FromDIP( 10 ) );
62 wxFlexGridSizer* gridSizer =
new wxFlexGridSizer( 2, FromDIP( 6 ), FromDIP( 6 ) );
63 gridSizer->AddGrowableCol( 1, 1 );
65 gridSizer->Add(
new wxStaticText(
this, wxID_ANY,
_(
"Destination directory:" ) ),
66 0, wxALIGN_CENTER_VERTICAL );
68 wxBoxSizer* destSizer =
new wxBoxSizer( wxHORIZONTAL );
71 m_destinationCtrl->SetToolTip(
_(
"Directory where downloaded symbol, footprint, and 3D model data will be written." ) );
76 gridSizer->Add( destSizer, 1, wxEXPAND );
78 gridSizer->Add(
new wxStaticText(
this, wxID_ANY,
_(
"Library prefix:" ) ),
79 0, wxALIGN_CENTER_VERTICAL );
81 m_prefixCtrl->SetToolTip(
_(
"Prefix that will be applied to the generated libraries." ) );
84 gridSizer->AddSpacer( 0 );
85 m_prefixHint =
new wxStaticText(
this, wxID_ANY, wxString() );
89 gridSizer->Add(
new wxStaticText(
this, wxID_ANY,
_(
"Add libraries to:" ) ),
90 0, wxALIGN_CENTER_VERTICAL );
92 wxBoxSizer* radioSizer =
new wxBoxSizer( wxHORIZONTAL );
93 m_projectRadio =
new wxRadioButton(
this, wxID_ANY,
_(
"Project library table" ),
94 wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
95 m_projectRadio->SetToolTip(
_(
"Adds the generated libraries to the project's library tables." ) );
96 radioSizer->Add(
m_projectRadio, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, FromDIP( 12 ) );
98 m_globalRadio =
new wxRadioButton(
this, wxID_ANY,
_(
"Global library table" ) );
99 m_globalRadio->SetToolTip(
_(
"Adds the generated libraries to the global library tables." ) );
100 radioSizer->Add(
m_globalRadio, 0, wxALIGN_CENTER_VERTICAL );
102 gridSizer->Add( radioSizer, 0, wxEXPAND );
104 topSizer->Add( gridSizer, 0, wxALL | wxEXPAND, FromDIP( 10 ) );
106 m_resetButton =
new wxButton(
this, wxID_ANY,
_(
"Reset to Defaults" ) );
107 m_resetButton->SetToolTip(
_(
"Restore the default destination and prefix." ) );
108 topSizer->Add(
m_resetButton, 0, wxLEFT | wxBOTTOM, FromDIP( 10 ) );
110 wxStdDialogButtonSizer* buttonSizer = CreateStdDialogButtonSizer( wxOK | wxCANCEL );
111 topSizer->Add( buttonSizer, 0, wxALL | wxEXPAND, FromDIP( 10 ) );
113 SetSizer( topSizer );
114 topSizer->Fit(
this );
146 destination.Trim(
true ).Trim(
false );
147 prefix.Trim(
true ).Trim(
false );
149 if( destination.IsEmpty() )
151 wxMessageBox(
_(
"Please choose a destination directory." ), GetTitle(), wxOK | wxICON_WARNING,
this );
156 if( prefix.IsEmpty() )
158 wxMessageBox(
_(
"Please enter a library prefix." ), GetTitle(), wxOK | wxICON_WARNING,
this );
169 m_settings->m_RemoteSymbol.destination_dir = destination;
170 m_settings->m_RemoteSymbol.library_prefix = prefix;
179 wxUnusedVar( aEvent );
183 if( initialPath.IsEmpty() )
185 if(
Prj().IsNullProject() )
191 wxDirDialog dlg(
this,
_(
"Select Destination Directory" ), initialPath );
193 if( dlg.ShowModal() != wxID_OK )
196 wxString
path = dlg.GetPath();
198 if( !
Prj().IsNullProject() )
202 wxFileName selectedDir = wxFileName::DirName(
path );
204 if( selectedDir.MakeRelativeTo( projectRoot ) )
206 wxString relative = selectedDir.GetFullPath();
208 if( relative.IsEmpty() || relative == wxS(
"." ) )
209 path = wxS(
"${KIPRJMOD}" );
211 path = wxString::Format( wxS(
"${KIPRJMOD}/%s" ), relative );
215 path.Replace( wxS(
"\\" ), wxS(
"/" ) );
DIALOG_SHIM(wxWindow *aParent, wxWindowID id, const wxString &title, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxDEFAULT_FRAME_STYLE|wxRESIZE_BORDER, const wxString &name=wxDialogNameStr)