From 033b6e70c2b04fbf2ee87ddb817f411e20d3123e Mon Sep 17 00:00:00 2001 From: Ykkrosh Date: Fri, 18 Jun 2004 22:50:34 +0000 Subject: [PATCH] Sort-of-working Linuxness This was SVN commit r544. --- .../tools/fontbuilder/platform/fontselect.h | 10 ++++--- .../fontbuilder/platform/linux/fontselect.cpp | 23 +++++++++++++--- source/tools/fontbuilder/stdafx.h | 7 ++++- source/tools/fontbuilder/wxframe.cpp | 26 ++++++++++++++++++- 4 files changed, 58 insertions(+), 8 deletions(-) diff --git a/source/tools/fontbuilder/platform/fontselect.h b/source/tools/fontbuilder/platform/fontselect.h index aa8d3476c6..c0daf33b22 100755 --- a/source/tools/fontbuilder/platform/fontselect.h +++ b/source/tools/fontbuilder/platform/fontselect.h @@ -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); diff --git a/source/tools/fontbuilder/platform/linux/fontselect.cpp b/source/tools/fontbuilder/platform/linux/fontselect.cpp index 185aaa9b1f..ab16df2398 100755 --- a/source/tools/fontbuilder/platform/linux/fontselect.cpp +++ b/source/tools/fontbuilder/platform/linux/fontselect.cpp @@ -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) { diff --git a/source/tools/fontbuilder/stdafx.h b/source/tools/fontbuilder/stdafx.h index 97d93fdd17..d86e366a6c 100755 --- a/source/tools/fontbuilder/stdafx.h +++ b/source/tools/fontbuilder/stdafx.h @@ -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) diff --git a/source/tools/fontbuilder/wxframe.cpp b/source/tools/fontbuilder/wxframe.cpp index e44c4614ba..b919dd1aa1 100755 --- a/source/tools/fontbuilder/wxframe.cpp +++ b/source/tools/fontbuilder/wxframe.cpp @@ -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)