1
0
forked from 0ad/0ad

Sort-of-working Linuxness

This was SVN commit r544.
This commit is contained in:
Ykkrosh 2004-06-18 22:50:34 +00:00
parent 09a56c1dfc
commit 033b6e70c2
4 changed files with 58 additions and 8 deletions

View File

@ -1,12 +1,14 @@
// $Id: fontselect.h,v 1.2 2004/06/18 22:05:58 philip Exp $
// $Id: fontselect.h,v 1.3 2004/06/18 22:50:34 philip Exp $
#ifdef _WIN32
class FontSelectorDialog : public wxDialog
#else
class FontSelectorDialog : public wxFileDialog
#endif
{
public:
FontSelectorDialog(wxWindow* parent);
#ifdef _WIN32
~FontSelectorDialog();
#endif
wxString FontName;
wxString FontFilename;
@ -14,6 +16,8 @@ public:
#ifdef _WIN32
void OnFontSelect(wxCommandEvent& event);
void OnOK(wxCommandEvent& event);
//#else
// void OnInit(wxInitDialogEvent& event);
#endif
static void DefaultFonts(wxString& Name0, wxString& Filename0, wxString& Name1, wxString& Filename1);

View File

@ -1,13 +1,23 @@
// $Id: fontselect.cpp,v 1.1 2004/06/18 22:05:58 philip Exp $
// $Id: fontselect.cpp,v 1.2 2004/06/18 22:50:34 philip Exp $
#include "stdafx.h"
#include "../fontselect.h"
BEGIN_EVENT_TABLE(FontSelectorDialog, wxFileDialog)
// EVT_INIT_DIALOG(FontSelectorDialog::OnInit)
END_EVENT_TABLE()
FontSelectorDialog::FontSelectorDialog(wxWindow* parent)
: wxDialog(parent, -1, wxString(wxT("Font selector")), wxDefaultPosition, wxSize(400, 200), wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
//: wxFileDialog(parent, wxT("Font selector"), wxEmptyString, wxEmptyString, wxOPEN | wxHIDE_READONLY)
: wxFileDialog(parent, wxT("Select a font file"), wxEmptyString, wxEmptyString, wxT("TTF files (*.ttf)|*.ttf|All files (*.*)|*.*"), wxOPEN | wxHIDE_READONLY)
{
wxFileDialog Dlg (this, wxT("Select a font file"), wxEmptyString, wxEmptyString, wxT("TTF files (*.ttf)|*.ttf|All files (*.*)|*.*"), wxOPEN | wxHIDE_READONLY)
}
/*
void FontSelectorDialog::OnDestroy(wxInitDialogEvent& WXUNUSED(event))
{
wxFileDialog Dlg (this, wxT("Select a font file"), wxEmptyString, wxEmptyString, wxT("TTF files (*.ttf)|*.ttf|All files (*.*)|*.*"), wxOPEN | wxHIDE_READONLY);
if (Dlg.ShowModal() == wxID_OK)
{
FontName = Dlg.GetFilename();
@ -19,6 +29,13 @@ FontSelectorDialog::FontSelectorDialog(wxWindow* parent)
EndModal(wxID_CANCEL);
}
}
*/
FontSelectorDialog::~FontSelectorDialog()
{
FontName = GetFilename();
FontFilename = GetPath();
}
void FontSelectorDialog::DefaultFonts(wxString& Name0, wxString& Filename0, wxString& Name1, wxString& Filename1)
{

View File

@ -1,4 +1,4 @@
// $Id: stdafx.h,v 1.2 2004/06/18 22:05:58 philip Exp $
// $Id: stdafx.h,v 1.3 2004/06/18 22:50:34 philip Exp $
// Precompiled headers
@ -16,6 +16,10 @@
// Include relevant wx headers
#include "wx/wxprec.h"
#include "wx/wx.h"
#include "wx/menu.h"
#include "wx/filedlg.h"
#include "wx/button.h"
#include "wx/image.h"
#include "wx/spinctrl.h"
#include "wx/regex.h"
@ -27,6 +31,7 @@
#include "wx/config.h"
#include "wx/filename.h"
#include "wx/config.h"
#include "wx/log.h"
#pragma warning (pop)

View File

@ -1,4 +1,4 @@
// $Id: wxframe.cpp,v 1.1 2004/06/17 19:32:04 philip Exp $
// $Id: wxframe.cpp,v 1.2 2004/06/18 22:50:34 philip Exp $
#include "stdafx.h"
@ -212,6 +212,7 @@ void MainFrame::OnClose(wxCloseEvent& event)
void MainFrame::LoadSettings(wxString& filename)
{
/*
wxExprDatabase db;
db.Read(filename);
@ -261,10 +262,12 @@ void MainFrame::LoadSettings(wxString& filename)
PreviewTextCtrl->SetValue(PreviewText);
Changes = false;
*/
}
void MainFrame::SaveSettings(wxString& filename)
{
/*
wxExprDatabase db;
wxTextCtrl* PreviewTextCtrl = (wxTextCtrl*)wxWindow::FindWindowById(ID_PreviewText);
@ -296,6 +299,7 @@ void MainFrame::SaveSettings(wxString& filename)
db.Write(filename);
Changes = false;
*/
}
@ -533,6 +537,7 @@ void MainFrame::GenerateTexture(wxString TextureFilename, wxString FontDefnFilen
void MainFrame::OnFontSelect0(wxCommandEvent& event)
{
#ifdef _WIN32
FontSelectorDialog Dlg(this);
if (Dlg.ShowModal() == wxID_OK)
{
@ -540,10 +545,20 @@ void MainFrame::OnFontSelect0(wxCommandEvent& event)
FontName0 = Dlg.FontName;
((wxButton*)event.GetEventObject()) -> SetLabel(FontName0);
}
#else
wxFileDialog Dlg (this, wxT("Select a font file"), wxEmptyString, wxEmptyString, wxT("TTF files (*.ttf)|*.ttf|All files (*.*)|*.*"), wxOPEN | wxHIDE_READONLY);
if (Dlg.ShowModal() == wxID_OK)
{
FontFilename0 = Dlg.GetPath();
FontName0 = Dlg.GetFilename();
((wxButton*)event.GetEventObject()) -> SetLabel(FontName0);
}
#endif
}
void MainFrame::OnFontSelect1(wxCommandEvent& event)
{
#ifdef _WIN32
FontSelectorDialog Dlg(this);
if (Dlg.ShowModal() == wxID_OK)
{
@ -551,6 +566,15 @@ void MainFrame::OnFontSelect1(wxCommandEvent& event)
FontName1 = Dlg.FontName;
((wxButton*)event.GetEventObject()) -> SetLabel(FontName1);
}
#else
wxFileDialog Dlg (this, wxT("Select a font file"), wxEmptyString, wxEmptyString, wxT("TTF files (*.ttf)|*.ttf|All files (*.*)|*.*"), wxOPEN | wxHIDE_READONLY);
if (Dlg.ShowModal() == wxID_OK)
{
FontFilename1 = Dlg.GetPath();
FontName1 = Dlg.GetFilename();
((wxButton*)event.GetEventObject()) -> SetLabel(FontName1);
}
#endif
}
void MainFrame::OnCharSelect(wxCommandEvent& event)