Fixes Atlas error when using the map open/save dialog on Linux, based on patch by njm, fixes #2858

This was SVN commit r15885.
This commit is contained in:
historic_bruno
2014-10-18 01:53:06 +00:00
parent 3c33a8a072
commit 1631b8de14
4 changed files with 13 additions and 10 deletions
@@ -1,4 +1,4 @@
/* Copyright (C) 2013 Wildfire Games.
/* Copyright (C) 2014 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -35,12 +35,12 @@ enum {
static const wxString scenarioPath(L"maps/scenarios/");
static const wxString skirmishPath(L"maps/skirmishes/");
MapDialog::MapDialog(wxWindow* parent, MapDialogType type)
MapDialog::MapDialog(wxWindow* parent, MapDialogType type, const wxIcon& icon)
: wxDialog(parent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(600,400), wxCAPTION|wxRESIZE_BORDER|wxCLOSE_BOX|wxSYSTEM_MENU), m_Type(type)
{
Freeze();
SetIcon(wxIcon(_T("ICON_ScenarioEditor"))); // load from atlas.rc
SetIcon(icon);
if (m_Type == MAPDIALOG_OPEN)
SetTitle(_("Choose map to open"));
@@ -1,4 +1,4 @@
/* Copyright (C) 2013 Wildfire Games.
/* Copyright (C) 2014 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -31,7 +31,7 @@ enum MapDialogType { MAPDIALOG_OPEN, MAPDIALOG_SAVE };
class MapDialog : public wxDialog
{
public:
MapDialog(wxWindow* parent, MapDialogType type);
MapDialog(wxWindow* parent, MapDialogType type, const wxIcon& icon);
/**
* Returns VFS path of selected map with .xml extension, else empty string
@@ -380,15 +380,16 @@ ScenarioEditor::ScenarioEditor(wxWindow* parent)
SetOpenFilename(_T(""));
#if defined(__WXMSW__)
SetIcon(wxIcon(_T("ICON_ScenarioEditor"))); // load from atlas.rc
m_Icon = wxIcon(_T("ICON_ScenarioEditor")); // load from atlas.rc
#else
{
const wxString relativePath (_T("tools/atlas/icons/ScenarioEditor.ico"));
wxFileName filename (relativePath, wxPATH_UNIX);
filename.MakeAbsolute(Datafile::GetDataDirectory());
SetIcon(wxIcon(filename.GetFullPath(), wxBITMAP_TYPE_ICO));
m_Icon = wxIcon(filename.GetFullPath(), wxBITMAP_TYPE_ICO);
}
#endif
SetIcon(m_Icon);
wxToolTip::Enable(true);
@@ -663,7 +664,7 @@ bool ScenarioEditor::OpenFile(const wxString& name, const wxString& filename)
void ScenarioEditor::OnOpen(wxCommandEvent& WXUNUSED(event))
{
MapDialog dlg (NULL, MAPDIALOG_OPEN);
MapDialog dlg (NULL, MAPDIALOG_OPEN, m_Icon);
if (dlg.ShowModal() == wxID_OK)
{
wxString filename = dlg.GetFilename();
@@ -740,7 +741,7 @@ void ScenarioEditor::OnSave(wxCommandEvent& event)
void ScenarioEditor::OnSaveAs(wxCommandEvent& WXUNUSED(event))
{
MapDialog dlg(NULL, MAPDIALOG_SAVE);
MapDialog dlg(NULL, MAPDIALOG_SAVE, m_Icon);
if (dlg.ShowModal() == wxID_OK)
{
wxString filename(dlg.GetFilename());
@@ -1,4 +1,4 @@
/* Copyright (C) 2011 Wildfire Games.
/* Copyright (C) 2014 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -86,6 +86,8 @@ private:
wxString m_OpenFilename;
FileHistory m_FileHistory;
wxIcon m_Icon;
DECLARE_EVENT_TABLE();
};