#include "folderdlg.h"
#include "reposdlg.h"
#include "docsystem.h"
-#include "symbols.h"
#ifdef __WXMSW__
#include "wx/msw/winundef.h"
{
// ecAboutDialog dialog(this, ecID_ABOUT_DIALOG, _("About eCos Configuration Tool"));
// dialog.ShowModal();
- wxString msg;
- msg.Printf("eCos Configuration Tool %s (%s %s)\n\nCopyright (c) Red Hat, Inc. 1998-2002\nCopyright (c) John Dallaway 2003", ecCONFIGURATION_TOOL_VERSION, __DATE__, __TIME__);
- wxMessageBox(msg, _("About eCos Configuration Tool"), wxICON_INFORMATION | wxOK);
+ wxMessageBox(_("eCos Configuration Tool 2.12.net (eCos 2.0b1)\n\nCopyright (c) Red Hat, Inc. 1998-2002\nCopyright (c) John Dallaway 2003"), _("About eCos Configuration Tool"), wxICON_INFORMATION | wxOK);
}
void ecMainFrame::OnSize(wxSizeEvent& WXUNUSED(event))
if (!doc)
return;
- // add the current build tools dir to the drop-down list box
+ // Add all the paths from the bin dirs to the path array,
+ // making the default path the appropriate target prefix
+ wxString defaultPath;
+ const wxString strPrefix(doc->GetCurrentTargetPrefix());
wxArrayString arstrPaths;
- if (!wxGetApp().GetSettings().m_buildToolsDir.IsEmpty())
- arstrPaths.Add(wxGetApp().GetSettings().m_buildToolsDir);
- // also add the sub-directory containing tools for the current command prefix
- wxString value;
wxStringToStringMap& map = wxGetApp().GetSettings().GetBinDirs();
- const wxString strPrefix(doc->GetCurrentTargetPrefix());
- if (map.Find(strPrefix, value) && (wxNOT_FOUND == arstrPaths.Index(value)))
+ map.BeginFind();
+ wxString key, value;
+ bool hasDefaultDir = FALSE;
+ while (map.Next(key, value))
+ {
arstrPaths.Add(value);
-
+ if (key == strPrefix)
+ defaultPath = value;
+ if (value == wxGetApp().GetSettings().m_buildToolsDir)
+ hasDefaultDir = TRUE;
+ }
+ if (!wxGetApp().GetSettings().m_buildToolsDir.IsEmpty() && !hasDefaultDir)
+ {
+ arstrPaths.Add(wxGetApp().GetSettings().m_buildToolsDir);
+ }
+
wxString msg;
msg.Printf(_("Enter the location of the %s build tools\n"
- "folder. You can type in a path or use the\n"
- "Browse button to navigate to a folder."),
- (const wxChar*) (strPrefix.IsEmpty() ? wxString(wxT("native")) : strPrefix));
+ "folder, which should contain %sgcc. You can\n"
+ "type in a path or use the Browse button to\n"
+ "navigate to a folder."),
+ (const wxChar*) (strPrefix.IsEmpty() ? wxString(wxT("native")) : strPrefix),
+ (const wxChar*) (strPrefix.IsEmpty() ? wxString(wxT("")) : strPrefix + wxT("-"))
+ );
wxString caption(_("Build Tools Path"));
- ecFolderDialog dialog(wxGetApp().GetSettings().m_buildToolsDir, arstrPaths, msg, this, ecID_BUILD_TOOLS_DIALOG, caption);
+ ecFolderDialog dialog(defaultPath, arstrPaths, msg, this, ecID_BUILD_TOOLS_DIALOG, caption);
if (dialog.ShowModal() == wxID_OK)
{
- wxString path (dialog.GetPath());
+ ecFileName strExe;
- // look for *objcopy under the user-specified build tools directory
- wxArrayString objcopyFiles;
- wxString objcopyFileSpec(wxT("objcopy"));
#ifdef __WXMSW__
- objcopyFileSpec += wxT(".exe");
+ wxString exeSuffix(wxT(".exe"));
+#else
+ wxString exeSuffix(wxEmptyString);
#endif
- size_t objcopyCount = wxDir::GetAllFiles(path, &objcopyFiles, wxT("*") + objcopyFileSpec, wxDIR_FILES | wxDIR_DIRS);
- bool bPrefixFound = false;
- for (int count=0; count < objcopyCount; count++)
- {
- wxFileName file (objcopyFiles [count]);
- wxString new_prefix (file.GetFullName().Left (file.GetFullName().Find(objcopyFileSpec)));
- if ((! new_prefix.IsEmpty()) && ('-' == new_prefix.Last()))
- new_prefix = new_prefix.Left (new_prefix.Len() - 1); // strip off trailing hyphen
- if (new_prefix == strPrefix)
- bPrefixFound = true;
- }
+ wxString path(dialog.GetPath());
+ strExe.Printf(wxT("%s%c%s%sgcc%s"), (const wxChar*) path, wxFILE_SEP_PATH, (const wxChar*) strPrefix,
+ (const wxChar*) strPrefix.IsEmpty() ? wxT("") : wxT("-"), (const wxChar*) exeSuffix);
wxString msg;
msg.Printf(wxT("%s does not appear to contain the build tools - use this folder anyway?"), (const wxChar*) path);
- if(bPrefixFound ||
- (wxYES == wxMessageBox(msg, wxGetApp().GetSettings().GetAppName(), wxICON_QUESTION|wxYES_NO)))
+ if(strExe.Exists() ||
+ (wxID_YES == wxMessageBox(msg, wxGetApp().GetSettings().GetAppName(), wxICON_QUESTION|wxYES_NO)))
{
- for (int count=0; count < objcopyCount; count++)
- {
- wxFileName file (objcopyFiles [count]);
- wxString new_prefix (file.GetFullName().Left (file.GetFullName().Find(objcopyFileSpec)));
- if ((! new_prefix.IsEmpty()) && ('-' == new_prefix.Last()))
- new_prefix = new_prefix.Left (new_prefix.Len() - 1); // strip off trailing hyphen
- map.Set(new_prefix, file.GetPath(wxPATH_GET_VOLUME));
- }
- wxGetApp().GetSettings().m_buildToolsDir = path;
+ map.Set(strPrefix, path);
+ if (!hasDefaultDir)
+ wxGetApp().GetSettings().m_buildToolsDir = path;
}
}
}
msg.Printf(wxT("%s does not appear to contain the user tools - use this folder anyway?"), (const wxChar*) path);
if(strFile.Exists() ||
- (wxYES == wxMessageBox(msg, wxGetApp().GetSettings().GetAppName(), wxICON_QUESTION|wxYES_NO)))
+ (wxID_YES == wxMessageBox(msg, wxGetApp().GetSettings().GetAppName(), wxICON_QUESTION|wxYES_NO)))
{
wxGetApp().GetSettings().m_userToolsDir = path;
}
if (& event == s_lastEvent)
return FALSE;
- if (event.IsCommandEvent() && !event.IsKindOf(CLASSINFO(wxChildFocusEvent)))
+ if (event.IsCommandEvent())
{
s_lastEvent = & event;