Commit bdb5da44 authored by twanvl's avatar twanvl

Changes to make it work in windows again;

New header util/platform.hpp for platform specific stuff that doesn't go elsewhere;
Changed resource names from "CURSOR_SOMETHING" to "cursor/something", so it matches the filenames (in progress for other resource types).
parent 030c6b49
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
#include <data/game.hpp> #include <data/game.hpp>
#include <data/field.hpp> #include <data/field.hpp>
#include <util/error.hpp> #include <util/error.hpp>
#include <script/value.hpp> #include <util/reflect.hpp>
DECLARE_TYPEOF_COLLECTION(FieldP); DECLARE_TYPEOF_COLLECTION(FieldP);
typedef IndexMap<FieldP,ValueP> IndexMap_FieldP_ValueP; typedef IndexMap<FieldP,ValueP> IndexMap_FieldP_ValueP;
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
#include <data/statistics.hpp> #include <data/statistics.hpp>
#include <util/io/package_manager.hpp> #include <util/io/package_manager.hpp>
#include <script/script.hpp> #include <script/script.hpp>
#include <script/value.hpp>
DECLARE_TYPEOF_COLLECTION(FieldP); DECLARE_TYPEOF_COLLECTION(FieldP);
DECLARE_TYPEOF_COLLECTION(StatsDimensionP); DECLARE_TYPEOF_COLLECTION(StatsDimensionP);
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
#include <data/locale.hpp> #include <data/locale.hpp>
#include <util/io/package_manager.hpp> #include <util/io/package_manager.hpp>
#include <script/value.hpp> #include <script/to_value.hpp>
// ----------------------------------------------------------------------------- : Locale class // ----------------------------------------------------------------------------- : Locale class
......
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
#include <data/field/text.hpp> // for 0.2.7 fix #include <data/field/text.hpp> // for 0.2.7 fix
#include <util/tagged_string.hpp> // for 0.2.7 fix #include <util/tagged_string.hpp> // for 0.2.7 fix
#include <util/order_cache.hpp> #include <util/order_cache.hpp>
#include <script/value.hpp>
#include <script/script_manager.hpp> #include <script/script_manager.hpp>
#include <wx/sstream.h> #include <wx/sstream.h>
......
...@@ -11,9 +11,9 @@ ...@@ -11,9 +11,9 @@
#include <data/stylesheet.hpp> #include <data/stylesheet.hpp>
#include <data/field.hpp> #include <data/field.hpp>
#include <util/reflect.hpp> #include <util/reflect.hpp>
#include <util/platform.hpp>
#include <util/io/reader.hpp> #include <util/io/reader.hpp>
#include <util/io/writer.hpp> #include <util/io/writer.hpp>
#include <script/value.hpp>
#include <wx/filename.h> #include <wx/filename.h>
#include <wx/wfstream.h> #include <wx/wfstream.h>
#include <wx/stdpaths.h> #include <wx/stdpaths.h>
...@@ -136,7 +136,7 @@ StyleSheetSettings& Settings::stylesheetSettingsFor(const StyleSheet& stylesheet ...@@ -136,7 +136,7 @@ StyleSheetSettings& Settings::stylesheetSettingsFor(const StyleSheet& stylesheet
/// Retrieve the directory to use for settings and other data files /// Retrieve the directory to use for settings and other data files
String user_settings_dir() { String user_settings_dir() {
String dir = wxStandardPaths::Get().GetUserDataDir(); String dir = wxStandardPaths::Get().GetUserDataDir();
if (!wxDirExists(dir)) wxMkDir(wxConvLocal.cWX2MB(dir), 0777); if (!wxDirExists(dir)) wxMkDir(dir);
return dir + _("/"); return dir + _("/");
} }
......
...@@ -7,8 +7,8 @@ ...@@ -7,8 +7,8 @@
// ----------------------------------------------------------------------------- : Includes // ----------------------------------------------------------------------------- : Includes
#include <data/symbol.hpp> #include <data/symbol.hpp>
#include <script/to_value.hpp>
#include <gfx/bezier.hpp> #include <gfx/bezier.hpp>
#include <script/value.hpp>
DECLARE_TYPEOF_COLLECTION(SymbolPartP); DECLARE_TYPEOF_COLLECTION(SymbolPartP);
DECLARE_TYPEOF_COLLECTION(ControlPointP); DECLARE_TYPEOF_COLLECTION(ControlPointP);
......
...@@ -24,10 +24,10 @@ SymbolPointEditor::SymbolPointEditor(SymbolControl* control, const SymbolPartP& ...@@ -24,10 +24,10 @@ SymbolPointEditor::SymbolPointEditor(SymbolControl* control, const SymbolPartP&
, selection(SELECTED_NONE) , selection(SELECTED_NONE)
, hovering(SELECTED_NONE) , hovering(SELECTED_NONE)
// Load gui stock // Load gui stock
, pointSelect(load_resource_image(_("CUR_POINT"))) , pointSelect(load_resource_cursor(_("point")))
, pointAdd (load_resource_image(_("CUR_POINT_ADD"))) , pointAdd (load_resource_cursor(_("point_add")))
, pointCurve (load_resource_image(_("CUR_POINT_CURVE"))) , pointCurve (load_resource_cursor(_("curve")))
, pointMove (load_resource_image(_("CUR_POINT_MOVE"))) , pointMove (load_resource_cursor(_("point_move")))
{ {
resetActions(); resetActions();
// // fix pen joins // // fix pen joins
......
...@@ -20,9 +20,9 @@ DECLARE_TYPEOF_COLLECTION(SymbolPartP); ...@@ -20,9 +20,9 @@ DECLARE_TYPEOF_COLLECTION(SymbolPartP);
SymbolSelectEditor::SymbolSelectEditor(SymbolControl* control, bool rotate) SymbolSelectEditor::SymbolSelectEditor(SymbolControl* control, bool rotate)
: SymbolEditorBase(control) : SymbolEditorBase(control)
, rotate(rotate) , rotate(rotate)
, cursorRotate(load_resource_image(_("CUR_ROTATE"))) , cursorRotate(load_resource_cursor(_("rotate")))
, cursorShearX(load_resource_image(_("CUR_SHEAR_X"))) , cursorShearX(load_resource_cursor(_("shear_x")))
, cursorShearY(load_resource_image(_("CUR_SHEAR_Y"))) , cursorShearY(load_resource_cursor(_("shear_y")))
{ {
// Load resource images // Load resource images
Image rot = load_resource_image(_("HANDLE_ROTATE")); Image rot = load_resource_image(_("HANDLE_ROTATE"));
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
// ----------------------------------------------------------------------------- : Includes // ----------------------------------------------------------------------------- : Includes
#include <gui/thumbnail_thread.hpp> #include <gui/thumbnail_thread.hpp>
#include <util/platform.hpp>
#include <wx/thread.h> #include <wx/thread.h>
typedef pair<ThumbnailRequestP,Image> pair_ThumbnailRequestP_Image; typedef pair<ThumbnailRequestP,Image> pair_ThumbnailRequestP_Image;
...@@ -17,7 +18,7 @@ DECLARE_TYPEOF_COLLECTION(pair_ThumbnailRequestP_Image); ...@@ -17,7 +18,7 @@ DECLARE_TYPEOF_COLLECTION(pair_ThumbnailRequestP_Image);
String user_settings_dir(); String user_settings_dir();
String image_cache_dir() { String image_cache_dir() {
String dir = user_settings_dir() + _("/cache"); String dir = user_settings_dir() + _("/cache");
if (!wxDirExists(dir)) wxMkDir(wxConvLocal.cWX2MB(dir), 0777); if (!wxDirExists(dir)) wxMkDir(dir);
return dir + _("/"); return dir + _("/");
} }
......
...@@ -69,7 +69,7 @@ void draw_checker(RotatedDC& dc, const RealRect& rect) { ...@@ -69,7 +69,7 @@ void draw_checker(RotatedDC& dc, const RealRect& rect) {
} }
} }
// ----------------------------------------------------------------------------- : Image related // ----------------------------------------------------------------------------- : Resource related
Image load_resource_image(const String& name) { Image load_resource_image(const String& name) {
#if defined(__WXMSW__) #if defined(__WXMSW__)
...@@ -102,6 +102,14 @@ Image load_resource_image(const String& name) { ...@@ -102,6 +102,14 @@ Image load_resource_image(const String& name) {
#endif #endif
} }
wxCursor load_resource_cursor(const String& name) {
#if defined(__WXMSW__)
return wxCursor(_("cursor/") + name, wxBITMAP_TYPE_CUR_RESOURCE);
#else
return wxCursor(load_resource_image(_("cursor/") + name));
#endif
}
// ----------------------------------------------------------------------------- : Platform look // ----------------------------------------------------------------------------- : Platform look
// Draw a basic 3D border // Draw a basic 3D border
......
...@@ -39,6 +39,9 @@ void draw_checker(RotatedDC& dc, const RealRect&); ...@@ -39,6 +39,9 @@ void draw_checker(RotatedDC& dc, const RealRect&);
/// Load an image from a resource /// Load an image from a resource
Image load_resource_image(const String& name); Image load_resource_image(const String& name);
/// Load a cursor from a resource
wxCursor load_resource_cursor(const String& name);
// ----------------------------------------------------------------------------- : Platform look // ----------------------------------------------------------------------------- : Platform look
/// Draws a border for a control *around* a rect /// Draws a border for a control *around* a rect
......
...@@ -259,7 +259,7 @@ wxCursor rotated_ibeam; ...@@ -259,7 +259,7 @@ wxCursor rotated_ibeam;
wxCursor TextValueEditor::cursor() const { wxCursor TextValueEditor::cursor() const {
if (viewer.getRotation().sideways() ^ style().getRotation().sideways()) { // 90 or 270 degrees if (viewer.getRotation().sideways() ^ style().getRotation().sideways()) { // 90 or 270 degrees
if (!rotated_ibeam.Ok()) { if (!rotated_ibeam.Ok()) {
rotated_ibeam = wxCursor(load_resource_image(_("CUR_ROT_IBEAM"))); rotated_ibeam = wxCursor(load_resource_cursor(_("rot_text")));
} }
return rotated_ibeam; return rotated_ibeam;
} else { } else {
......
...@@ -1645,6 +1645,9 @@ ...@@ -1645,6 +1645,9 @@
<File <File
RelativePath=".\util\order_cache.hpp"> RelativePath=".\util\order_cache.hpp">
</File> </File>
<File
RelativePath=".\util\platform.hpp">
</File>
<File <File
RelativePath=".\util\prec.hpp"> RelativePath=".\util\prec.hpp">
</File> </File>
...@@ -2132,6 +2135,9 @@ ...@@ -2132,6 +2135,9 @@
<File <File
RelativePath=".\script\scriptable.hpp"> RelativePath=".\script\scriptable.hpp">
</File> </File>
<File
RelativePath=".\script\to_value.hpp">
</File>
<File <File
RelativePath=".\script\value.cpp"> RelativePath=".\script\value.cpp">
</File> </File>
...@@ -2630,6 +2636,9 @@ ...@@ -2630,6 +2636,9 @@
<File <File
RelativePath=".\code_template.hpp"> RelativePath=".\code_template.hpp">
</File> </File>
<File
RelativePath="..\conversion-todo.txt">
</File>
<File <File
RelativePath="..\data\en.mse-locale\locale"> RelativePath="..\data\en.mse-locale\locale">
</File> </File>
......
...@@ -17,7 +17,7 @@ ICON_SYMBOL ICON "icon/symbol.ico" ...@@ -17,7 +17,7 @@ ICON_SYMBOL ICON "icon/symbol.ico"
// -------------------------------------------------------- : Toolbar // -------------------------------------------------------- : Toolbar
CUR_ROT_IBEAM CURSOR "cursor/rot_text.cur" cursor/rot_text CURSOR "cursor/rot_text.cur"
TOOL_NEW BITMAP "tool/file_new.bmp" TOOL_NEW BITMAP "tool/file_new.bmp"
TOOL_OPEN BITMAP "tool/file_open.bmp" TOOL_OPEN BITMAP "tool/file_open.bmp"
...@@ -52,13 +52,13 @@ TOOL_HELP BITMAP "tool/help.bmp" ...@@ -52,13 +52,13 @@ TOOL_HELP BITMAP "tool/help.bmp"
// -------------------------------------------------------- : Symbol editor // -------------------------------------------------------- : Symbol editor
CUR_POINT CURSOR "cursor/point.cur" cursor/point CURSOR "cursor/point.cur"
CUR_POINT_ADD CURSOR "cursor/point_add.cur" cursor/point_add CURSOR "cursor/point_add.cur"
CUR_POINT_MOVE CURSOR "cursor/point_move.cur" cursor/point_move CURSOR "cursor/point_move.cur"
CUR_POINT_CURVE CURSOR "cursor/curve.cur" cursor/curve CURSOR "cursor/curve.cur"
CUR_ROTATE CURSOR "cursor/rotate.cur" cursor/rotate CURSOR "cursor/rotate.cur"
CUR_SHEAR_X CURSOR "cursor/shear_x.cur" cursor/shear_x CURSOR "cursor/shear_x.cur"
CUR_SHEAR_Y CURSOR "cursor/shear_y.cur" cursor/shear_y CURSOR "cursor/shear_y.cur"
TOOL_LINE BITMAP "tool/line.bmp" TOOL_LINE BITMAP "tool/line.bmp"
TOOL_CURVE BITMAP "tool/curve.bmp" TOOL_CURVE BITMAP "tool/curve.bmp"
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
// ----------------------------------------------------------------------------- : Includes // ----------------------------------------------------------------------------- : Includes
#include <script/context.hpp> #include <script/context.hpp>
#include <script/to_value.hpp>
#include <util/error.hpp> #include <util/error.hpp>
#include <iostream> #include <iostream>
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
// ----------------------------------------------------------------------------- : Includes // ----------------------------------------------------------------------------- : Includes
#include <script/context.hpp> #include <script/context.hpp>
#include <script/to_value.hpp>
#include <util/error.hpp> #include <util/error.hpp>
#include <queue> #include <queue>
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
// ----------------------------------------------------------------------------- : Includes // ----------------------------------------------------------------------------- : Includes
#include <script/value.hpp> #include <script/to_value.hpp>
#include <script/context.hpp> #include <script/context.hpp>
#include <script/dependency.hpp> #include <script/dependency.hpp>
#include <util/tagged_string.hpp> #include <util/tagged_string.hpp>
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include <script/image.hpp> #include <script/image.hpp>
#include <script/context.hpp> #include <script/context.hpp>
#include <script/to_value.hpp>
#include <util/dynamic_arg.hpp> #include <util/dynamic_arg.hpp>
#include <util/io/package.hpp> #include <util/io/package.hpp>
// for functions: // for functions:
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include <script/script.hpp> #include <script/script.hpp>
#include <script/parser.hpp> #include <script/parser.hpp>
#include <script/to_value.hpp>
#include <util/error.hpp> #include <util/error.hpp>
#include <util/io/package_manager.hpp> // for "include file" semi hack #include <util/io/package_manager.hpp> // for "include file" semi hack
#include <stack> #include <stack>
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include <script/script.hpp> #include <script/script.hpp>
#include <script/context.hpp> #include <script/context.hpp>
#include <script/to_value.hpp>
#include <util/error.hpp> #include <util/error.hpp>
// ----------------------------------------------------------------------------- : Variables // ----------------------------------------------------------------------------- : Variables
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
// ----------------------------------------------------------------------------- : Includes // ----------------------------------------------------------------------------- : Includes
#include <script/script_manager.hpp> #include <script/script_manager.hpp>
#include <script/to_value.hpp>
#include <data/set.hpp> #include <data/set.hpp>
#include <data/stylesheet.hpp> #include <data/stylesheet.hpp>
#include <data/game.hpp> #include <data/game.hpp>
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include <script/script.hpp> #include <script/script.hpp>
#include <script/context.hpp> #include <script/context.hpp>
#include <script/parser.hpp> #include <script/parser.hpp>
#include <script/to_value.hpp>
DECLARE_INTRUSIVE_POINTER_TYPE(Script); DECLARE_INTRUSIVE_POINTER_TYPE(Script);
...@@ -86,9 +87,6 @@ class OptionalScript { ...@@ -86,9 +87,6 @@ class OptionalScript {
template <typename T> friend class Scriptable; template <typename T> friend class Scriptable;
}; };
template <typename T>
inline ScriptValueP toScript(const Defaultable<T>& v) { return toScript(v()); }
// ----------------------------------------------------------------------------- : StringScript // ----------------------------------------------------------------------------- : StringScript
/// An optional script which is parsed in string mode /// An optional script which is parsed in string mode
......
This diff is collapsed.
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
// ----------------------------------------------------------------------------- : Includes // ----------------------------------------------------------------------------- : Includes
#include <script/value.hpp> #include <script/value.hpp>
#include <script/to_value.hpp>
#include <util/error.hpp> #include <util/error.hpp>
#include <boost/pool/singleton_pool.hpp> #include <boost/pool/singleton_pool.hpp>
......
This diff is collapsed.
...@@ -8,8 +8,8 @@ ...@@ -8,8 +8,8 @@
#include <util/io/get_member.hpp> #include <util/io/get_member.hpp>
#include <util/vector2d.hpp> #include <util/vector2d.hpp>
#include <script/value.hpp>
#include <script/script.hpp> #include <script/script.hpp>
#include <script/to_value.hpp>
// ---------------------------------------------------------------------------- : GetDefaultMember // ---------------------------------------------------------------------------- : GetDefaultMember
......
...@@ -10,11 +10,9 @@ ...@@ -10,11 +10,9 @@
// ----------------------------------------------------------------------------- : Includes // ----------------------------------------------------------------------------- : Includes
#include <util/prec.hpp> #include <util/prec.hpp>
#include <script/value.hpp>
class Script; class Script;
class ScriptValue;
DECLARE_INTRUSIVE_POINTER_TYPE(ScriptValue);
DECLARE_INTRUSIVE_POINTER_TYPE(Script); DECLARE_INTRUSIVE_POINTER_TYPE(Script);
template <typename T> class Defaultable; template <typename T> class Defaultable;
......
//+----------------------------------------------------------------------------+
//| Description: Magic Set Editor - Program to make Magic (tm) cards |
//| Copyright: (C) 2001 - 2006 Twan van Laarhoven |
//| License: GNU General Public License 2 or later (see file COPYING) |
//+----------------------------------------------------------------------------+
#ifndef HEADER_UTIL_PREC
#define HEADER_UTIL_PREC
/** @file util/platform.hpp
*
* @brief Platform specific hacks
*/
// ----------------------------------------------------------------------------- : Includes
#include <util/prec.hpp>
// ----------------------------------------------------------------------------- : Windows
// ----------------------------------------------------------------------------- : Linux
#ifdef __linux__
inline void wxMkDir(const String& str) {
wxMkDir(wxConvLocal.cWX2MB(dir), 0777);
}
#endif
// ----------------------------------------------------------------------------- : EOF
#endif
...@@ -14,9 +14,9 @@ ...@@ -14,9 +14,9 @@
// ----------------------------------------------------------------------------- : Includes // ----------------------------------------------------------------------------- : Includes
#include "io/reader.hpp" #include <util/io/reader.hpp>
#include "io/writer.hpp" #include <util/io/writer.hpp>
#include "io/get_member.hpp" #include <util/io/get_member.hpp>
// ----------------------------------------------------------------------------- : Declaring reflection // ----------------------------------------------------------------------------- : Declaring reflection
......
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
#include <util/version.hpp> #include <util/version.hpp>
#include <util/reflect.hpp> #include <util/reflect.hpp>
#include <script/value.hpp>
// ----------------------------------------------------------------------------- : Version // ----------------------------------------------------------------------------- : Version
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment