1
1
forked from 0ad/0ad

Even more Linuxness

This was SVN commit r547.
This commit is contained in:
Ykkrosh 2004-06-19 12:56:09 +00:00
parent 5da9ecd1b0
commit 9bc8559c49
17 changed files with 116 additions and 28 deletions

View File

@ -243,6 +243,9 @@
<File
RelativePath=".\stdafx.h">
</File>
<File
RelativePath=".\version.h">
</File>
<File
RelativePath=".\wxconfig.h">
</File>

View File

@ -1,4 +1,6 @@
// $Id: filemanip.h,v 1.1 2004/06/17 19:32:04 philip Exp $
// $Id: filemanip.h,v 1.2 2004/06/19 12:56:09 philip Exp $
#include "wx/ffile.h"
#include <set>

View File

@ -1,7 +1,9 @@
// $Id: font.cpp,v 1.1 2004/06/17 19:32:04 philip Exp $
// $Id: font.cpp,v 1.2 2004/06/19 12:56:09 philip Exp $
#include "stdafx.h"
#include "wx/wx.h"
#include "font.h"
#include <math.h>

View File

@ -191,6 +191,13 @@
<FileConfiguration
Name="Release|Win32"/>
</File>
<File
RelativePath=".\version.h">
<FileConfiguration
Name="Debug|Win32"/>
<FileConfiguration
Name="Release|Win32"/>
</File>
<File
RelativePath=".\FontBuilder.ico">
<FileConfiguration

View File

@ -1,9 +1,11 @@
// $Id: packer.cpp,v 1.1 2004/06/17 19:32:04 philip Exp $
// $Id: packer.cpp,v 1.2 2004/06/19 12:56:09 philip Exp $
#include "stdafx.h"
#include "packer.h"
#include "wx/log.h"
#include <list>
#include <vector>

View File

@ -1,7 +1,9 @@
// $Id: packer.h,v 1.1 2004/06/17 19:32:04 philip Exp $
// $Id: packer.h,v 1.2 2004/06/19 12:56:09 philip Exp $
#include "font.h"
#include "wx/string.h"
#include <set>
class PackedFont

View File

@ -1,4 +1,6 @@
// $Id: fontselect.h,v 1.3 2004/06/18 22:50:34 philip Exp $
// $Id: fontselect.h,v 1.4 2004/06/19 12:56:09 philip Exp $
#include "wx/dialog.h"
#ifdef _WIN32
class FontSelectorDialog : public wxDialog

View File

@ -1,4 +1,12 @@
// $Id: fontselect.cpp,v 1.2 2004/06/18 22:50:34 philip Exp $
// $Id: fontselect.cpp,v 1.3 2004/06/19 12:56:09 philip Exp $
/************
This attempt at completely separating the platform-dependent
parts failed. Need to think about it more carefully in the
future.
************/
#include "stdafx.h"

View File

@ -1,9 +1,15 @@
// $Id: fontselect.cpp,v 1.1 2004/06/17 19:32:04 philip Exp $
// $Id: fontselect.cpp,v 1.2 2004/06/19 12:56:09 philip Exp $
#include "stdafx.h"
#include "../fontselect.h"
#include "wx/sizer.h"
#include "wx/listbox.h"
#include "wx/stattext.h"
#include "wx/button.h"
#include "wx/regex.h"
#include "wx/msw/registry.h"
enum

View File

@ -1,7 +1,13 @@
// $Id: stdafx.h,v 1.3 2004/06/18 22:50:34 philip Exp $
// $Id: stdafx.h,v 1.4 2004/06/19 12:56:09 philip Exp $
// Precompiled headers
#ifdef _WIN32
# define HAVE_PCH
#endif
#ifdef HAVE_PCH
// Exclude rarely-used stuff from Windows headers
#define WIN32_LEAN_AND_MEAN
@ -48,8 +54,6 @@
#define new new(_NORMAL_BLOCK ,__FILE__, __LINE__)
#endif
const wxString version = wxT("v0.9");
// Don't care about copy constructors / assignment operators
#pragma warning (disable: 4511 4512)
@ -57,3 +61,7 @@ const wxString version = wxT("v0.9");
// Disable some of the excessively pedantic warnings again
#pragma warning (disable: 193 373 444 981 383 1418)
#endif
#endif // HAVE_PCH
#include "wx/defs.h"

View File

@ -0,0 +1 @@
const wxString version = L"v0.9";

View File

@ -1,10 +1,14 @@
// $Id: wxapp.cpp,v 1.2 2004/06/18 22:05:58 philip Exp $
// $Id: wxapp.cpp,v 1.3 2004/06/19 12:56:09 philip Exp $
#include "stdafx.h"
#include "wx/app.h"
#include "wxframe.h"
#include "wxconfig.h"
#include "version.h"
class FontBuilderApp : public wxApp
{
public:

View File

@ -1,7 +1,10 @@
// $Id: wxconfig.cpp,v 1.1 2004/06/17 19:32:04 philip Exp $
// $Id: wxconfig.cpp,v 1.2 2004/06/19 12:56:09 philip Exp $
#include "stdafx.h"
#include "wx/config.h"
#include "wx/filename.h"
#include "wxconfig.h"
void ConfigInit()

View File

@ -1,4 +1,6 @@
// $Id: wxconfig.h,v 1.1 2004/06/17 19:32:04 philip Exp $
// $Id: wxconfig.h,v 1.2 2004/06/19 12:56:09 philip Exp $
#include "wx/string.h"
void ConfigInit();
wxString ConfigGet(wxString key);

View File

@ -1,7 +1,22 @@
// $Id: wxframe.cpp,v 1.3 2004/06/18 22:52:34 philip Exp $
// $Id: wxframe.cpp,v 1.4 2004/06/19 12:56:09 philip Exp $
#include "stdafx.h"
#include "wx/menu.h"
#include "wx/config.h"
#include "wx/sizer.h"
#include "wx/stattext.h"
#include "wx/button.h"
#include "wx/textctrl.h"
#include "wx/filedlg.h"
#include "wx/msgdlg.h"
#include "wx/image.h"
#include "wx/wxexpr.h"
#include "wx/log.h"
#include "wx/filename.h"
#include "wx/progdlg.h"
#include "wx/dcbuffer.h"
#include "wxframe.h"
#include "wxconfig.h"
#include "wxspinner.h"
@ -13,6 +28,8 @@
#include "packer.h"
#include "filemanip.h"
#include "version.h"
bool Changes = false;
enum
@ -247,19 +264,23 @@ void MainFrame::LoadSettings(wxString& filename)
Settings->GetAttributeValue(wxT("Tracking"), t); TrackingCtrl->SetValue(t);
Settings->GetAttributeValue(wxT("Leading"), t); LeadingCtrl->SetValue(t);
wxString PreviewTextUTF;
Settings->GetAttributeValue(wxT("PreviewText"), PreviewTextUTF);
// Unpleasant conversion from UTF8 (pretending to be UTF16) into UTF16:
char* buffer = new char[PreviewTextUTF.length()+1];
for (size_t i=0; i<PreviewTextUTF.length(); ++i)
buffer[i] = (char)PreviewTextUTF.GetChar(i);
buffer[PreviewTextUTF.length()] = 0;
wxString PreviewText (buffer, wxConvUTF8);
delete[] buffer;
// Convert back to UTF16 from hex, because wxExpr doesn't like non-ASCII
wxString PreviewTextHex;
Settings->GetAttributeValue(wxT("PreviewText"), PreviewTextHex);
wxString PreviewText;
for (size_t i=0; i<PreviewTextHex.Length(); i += 4)
{
wchar_t b[5];
memcpy(b, &PreviewTextHex[i], sizeof(wchar_t)*4);
b[4] = 0;
PreviewText += (wxChar)wcstoul(b, NULL, 16);
}
PreviewTextCtrl->SetValue(PreviewText);
Changes = false;
}
@ -287,9 +308,17 @@ void MainFrame::SaveSettings(wxString& filename)
Settings->AddAttributeValue(wxT("Tracking"), (long)TrackingCtrl->GetValidValue());
Settings->AddAttributeValue(wxT("Leading"), (long)LeadingCtrl->GetValidValue());
// Convert into UTF8 and pretend it's ASCII, because wxExprDatabase doesn't like Unicode
wxCharBuffer PreviewTextUTF = PreviewTextCtrl->GetValue().mb_str(wxConvUTF8);
Settings->AddAttributeValueString(wxT("PreviewText"), wxString::FromAscii(PreviewTextUTF));
// Convert UTF16 to hex, because wxExpr doesn't like non-ASCII
wxString PreviewText = PreviewTextCtrl->GetValue();
wxString PreviewTextHex;
for (size_t i=0; i<PreviewText.Length(); ++i)
{
wchar_t b[5];
swprintf(b, wxT("%04x"), PreviewText[i]);
PreviewTextHex += wxString(b, 4);
}
Settings->AddAttributeValueString(wxT("PreviewText"), PreviewTextHex);
db.Append(Settings);

View File

@ -1,4 +1,9 @@
// $Id: wxframe.h,v 1.1 2004/06/17 19:32:04 philip Exp $
// $Id: wxframe.h,v 1.2 2004/06/19 12:56:09 philip Exp $
#include "wx/panel.h"
#include "wx/bitmap.h"
#include "wx/frame.h"
#include "wx/docview.h"
class BitmapPanel : public wxPanel
{

View File

@ -1,4 +1,6 @@
// $Id: wxspinner.h,v 1.1 2004/06/17 19:32:04 philip Exp $
// $Id: wxspinner.h,v 1.2 2004/06/19 12:56:09 philip Exp $
#include "wx/spinctrl.h"
class StyleSpinCtrl : public wxSpinCtrl
{