Commit eb7c0af4 authored by coppro's avatar coppro

Updates to make things work.

Some trivial things that are required to make it work on Linux.
Also updated build scripts to use Boost. You have to use
./configure --with-boost-regex=<libname, suitable for -l>
parent d100ba4d
......@@ -12,8 +12,8 @@ echo "
AUTOMAKE_OPTIONS = subdir-objects
bin_PROGRAMS = magicseteditor
AM_CXXFLAGS = @WX_CXXFLAGS@ -DUNICODE -I . -Wall
AM_LDFLAGS = @WX_LIBS@
AM_CXXFLAGS = @WX_CXXFLAGS@ \$(BOOST_CXXFLAGS) -DUNICODE -I . -Wall
AM_LDFLAGS = @WX_LIBS@ \$(BOOST_LDFLAGS) \$(BOOST_REGEX_LIB)
magicseteditor_SOURCES =
......
......@@ -11,8 +11,8 @@
AUTOMAKE_OPTIONS = subdir-objects
bin_PROGRAMS = magicseteditor
AM_CXXFLAGS = @WX_CXXFLAGS@ -DUNICODE -I . -Wall
AM_LDFLAGS = @WX_LIBS@
AM_CXXFLAGS = @WX_CXXFLAGS@ $(BOOST_CXXFLAGS) -DUNICODE -I . -Wall
AM_LDFLAGS = @WX_LIBS@ $(BOOST_LDFLAGS) $(BOOST_REGEX_LIB)
magicseteditor_SOURCES =
......@@ -21,6 +21,7 @@ magicseteditor_SOURCES += ./src/util/version.cpp
magicseteditor_SOURCES += ./src/util/alignment.cpp
magicseteditor_SOURCES += ./src/util/rotation.cpp
magicseteditor_SOURCES += ./src/util/tagged_string.cpp
magicseteditor_SOURCES += ./src/util/regex.cpp
magicseteditor_SOURCES += ./src/util/spec_sort.cpp
magicseteditor_SOURCES += ./src/util/io/get_member.cpp
magicseteditor_SOURCES += ./src/util/io/package_manager.cpp
......@@ -62,6 +63,7 @@ magicseteditor_SOURCES += ./src/render/value/information.cpp
magicseteditor_SOURCES += ./src/render/value/choice.cpp
magicseteditor_SOURCES += ./src/render/value/image.cpp
magicseteditor_SOURCES += ./src/script/scriptable.cpp
magicseteditor_SOURCES += ./src/script/profiler.cpp
magicseteditor_SOURCES += ./src/script/script_manager.cpp
magicseteditor_SOURCES += ./src/script/functions/english.cpp
magicseteditor_SOURCES += ./src/script/functions/basic.cpp
......
......@@ -59,7 +59,7 @@ PROGRAMS = $(bin_PROGRAMS)
am__dirstamp = $(am__leading_dot)dirstamp
am_magicseteditor_OBJECTS = ./src/util/version.$(OBJEXT) \
./src/util/alignment.$(OBJEXT) ./src/util/rotation.$(OBJEXT) \
./src/util/tagged_string.$(OBJEXT) \
./src/util/tagged_string.$(OBJEXT) ./src/util/regex.$(OBJEXT) \
./src/util/spec_sort.$(OBJEXT) \
./src/util/io/get_member.$(OBJEXT) \
./src/util/io/package_manager.$(OBJEXT) \
......@@ -95,6 +95,7 @@ am_magicseteditor_OBJECTS = ./src/util/version.$(OBJEXT) \
./src/render/value/choice.$(OBJEXT) \
./src/render/value/image.$(OBJEXT) \
./src/script/scriptable.$(OBJEXT) \
./src/script/profiler.$(OBJEXT) \
./src/script/script_manager.$(OBJEXT) \
./src/script/functions/english.$(OBJEXT) \
./src/script/functions/basic.$(OBJEXT) \
......@@ -232,6 +233,9 @@ AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BOOST_CPPFLAGS = @BOOST_CPPFLAGS@
BOOST_LDFLAGS = @BOOST_LDFLAGS@
BOOST_REGEX_LIB = @BOOST_REGEX_LIB@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
......@@ -327,35 +331,37 @@ top_srcdir = @top_srcdir@
# This flag allows us to use subdirectories:
AUTOMAKE_OPTIONS = subdir-objects
AM_CXXFLAGS = @WX_CXXFLAGS@ -DUNICODE -I . -Wall
AM_LDFLAGS = @WX_LIBS@
AM_CXXFLAGS = @WX_CXXFLAGS@ $(BOOST_CXXFLAGS) -DUNICODE -I . -Wall
AM_LDFLAGS = @WX_LIBS@ $(BOOST_LDFLAGS) $(BOOST_REGEX_LIB)
# The script used to generate is MakeAM.sh
magicseteditor_SOURCES = ./src/util/version.cpp \
./src/util/alignment.cpp ./src/util/rotation.cpp \
./src/util/tagged_string.cpp ./src/util/spec_sort.cpp \
./src/util/io/get_member.cpp ./src/util/io/package_manager.cpp \
./src/util/io/writer.cpp ./src/util/io/reader.cpp \
./src/util/io/package.cpp ./src/util/action_stack.cpp \
./src/util/error.cpp ./src/util/age.cpp \
./src/util/file_utils.cpp ./src/util/string.cpp \
./src/gfx/color.cpp ./src/gfx/mask_image.cpp \
./src/gfx/rotate_image.cpp ./src/gfx/image_effects.cpp \
./src/gfx/resample_text.cpp ./src/gfx/combine_image.cpp \
./src/gfx/polynomial.cpp ./src/gfx/bezier.cpp \
./src/gfx/generated_image.cpp ./src/gfx/resample_image.cpp \
./src/gfx/blend_image.cpp ./src/main.cpp \
./src/render/card/viewer.cpp ./src/render/text/compound.cpp \
./src/render/text/symbol.cpp ./src/render/text/font.cpp \
./src/render/text/viewer.cpp ./src/render/text/element.cpp \
./src/render/symbol/filter.cpp ./src/render/symbol/viewer.cpp \
./src/util/tagged_string.cpp ./src/util/regex.cpp \
./src/util/spec_sort.cpp ./src/util/io/get_member.cpp \
./src/util/io/package_manager.cpp ./src/util/io/writer.cpp \
./src/util/io/reader.cpp ./src/util/io/package.cpp \
./src/util/action_stack.cpp ./src/util/error.cpp \
./src/util/age.cpp ./src/util/file_utils.cpp \
./src/util/string.cpp ./src/gfx/color.cpp \
./src/gfx/mask_image.cpp ./src/gfx/rotate_image.cpp \
./src/gfx/image_effects.cpp ./src/gfx/resample_text.cpp \
./src/gfx/combine_image.cpp ./src/gfx/polynomial.cpp \
./src/gfx/bezier.cpp ./src/gfx/generated_image.cpp \
./src/gfx/resample_image.cpp ./src/gfx/blend_image.cpp \
./src/main.cpp ./src/render/card/viewer.cpp \
./src/render/text/compound.cpp ./src/render/text/symbol.cpp \
./src/render/text/font.cpp ./src/render/text/viewer.cpp \
./src/render/text/element.cpp ./src/render/symbol/filter.cpp \
./src/render/symbol/viewer.cpp \
./src/render/value/multiple_choice.cpp \
./src/render/value/symbol.cpp ./src/render/value/color.cpp \
./src/render/value/package_choice.cpp \
./src/render/value/viewer.cpp ./src/render/value/text.cpp \
./src/render/value/information.cpp \
./src/render/value/choice.cpp ./src/render/value/image.cpp \
./src/script/scriptable.cpp ./src/script/script_manager.cpp \
./src/script/scriptable.cpp ./src/script/profiler.cpp \
./src/script/script_manager.cpp \
./src/script/functions/english.cpp \
./src/script/functions/basic.cpp \
./src/script/functions/construction.cpp \
......@@ -519,6 +525,8 @@ src/util/$(DEPDIR)/$(am__dirstamp):
src/util/$(DEPDIR)/$(am__dirstamp)
./src/util/tagged_string.$(OBJEXT): src/util/$(am__dirstamp) \
src/util/$(DEPDIR)/$(am__dirstamp)
./src/util/regex.$(OBJEXT): src/util/$(am__dirstamp) \
src/util/$(DEPDIR)/$(am__dirstamp)
./src/util/spec_sort.$(OBJEXT): src/util/$(am__dirstamp) \
src/util/$(DEPDIR)/$(am__dirstamp)
src/util/io/$(am__dirstamp):
......@@ -654,6 +662,8 @@ src/script/$(DEPDIR)/$(am__dirstamp):
@: > src/script/$(DEPDIR)/$(am__dirstamp)
./src/script/scriptable.$(OBJEXT): src/script/$(am__dirstamp) \
src/script/$(DEPDIR)/$(am__dirstamp)
./src/script/profiler.$(OBJEXT): src/script/$(am__dirstamp) \
src/script/$(DEPDIR)/$(am__dirstamp)
./src/script/script_manager.$(OBJEXT): src/script/$(am__dirstamp) \
src/script/$(DEPDIR)/$(am__dirstamp)
src/script/functions/$(am__dirstamp):
......@@ -1139,6 +1149,7 @@ mostlyclean-compile:
-rm -f ./src/script/functions/regex.$(OBJEXT)
-rm -f ./src/script/image.$(OBJEXT)
-rm -f ./src/script/parser.$(OBJEXT)
-rm -f ./src/script/profiler.$(OBJEXT)
-rm -f ./src/script/script.$(OBJEXT)
-rm -f ./src/script/script_manager.$(OBJEXT)
-rm -f ./src/script/scriptable.$(OBJEXT)
......@@ -1153,6 +1164,7 @@ mostlyclean-compile:
-rm -f ./src/util/io/package_manager.$(OBJEXT)
-rm -f ./src/util/io/reader.$(OBJEXT)
-rm -f ./src/util/io/writer.$(OBJEXT)
-rm -f ./src/util/regex.$(OBJEXT)
-rm -f ./src/util/rotation.$(OBJEXT)
-rm -f ./src/util/spec_sort.$(OBJEXT)
-rm -f ./src/util/string.$(OBJEXT)
......@@ -1298,6 +1310,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./src/script/$(DEPDIR)/dependency.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./src/script/$(DEPDIR)/image.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./src/script/$(DEPDIR)/parser.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./src/script/$(DEPDIR)/profiler.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./src/script/$(DEPDIR)/script.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./src/script/$(DEPDIR)/script_manager.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./src/script/$(DEPDIR)/scriptable.Po@am__quote@
......@@ -1314,6 +1327,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./src/util/$(DEPDIR)/alignment.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./src/util/$(DEPDIR)/error.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./src/util/$(DEPDIR)/file_utils.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./src/util/$(DEPDIR)/regex.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./src/util/$(DEPDIR)/rotation.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./src/util/$(DEPDIR)/spec_sort.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./src/util/$(DEPDIR)/string.Po@am__quote@
......
......@@ -2,7 +2,7 @@
BASEDIR=~/.magicseteditor/resource
rm -r $BASEDIR/resource
rm -rf $BASEDIR
for DIR in $BASEDIR $BASEDIR/icon $BASEDIR/tool $BASEDIR/cursor
do
......
This diff is collapsed.
......@@ -18,7 +18,10 @@ AC_PROG_CXX
# Do not pass -O2, because that causes failures for now.
CXXFLAGS=-g
# Checks for libraries.
# TODO: Check for boost
# Check for Boost
AX_BOOST_BASE([1.36.0])
AX_BOOST_REGEX
# Check for wxWidgets
AM_OPTIONS_WXCONFIG
......
......@@ -3,6 +3,9 @@
/* Define to 1 if you have the `floor' function. */
#undef HAVE_FLOOR
/* Define if compiler provides atomic builtins */
#undef HAVE_GCC_ATOMIC_BUILTINS
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
......
......@@ -47,8 +47,7 @@ WelcomeWindow::WelcomeWindow()
#endif
wxControl* open_last = nullptr;
if (!settings.recent_sets.empty()) {
wxFileName n(settings.recent_sets.front());
if (n.FileExists() || n.DirExists())
if (wxFileName::FileExists(settings.recent_sets.front()) || wxFileName::DirExists(settings.recent_sets.front()+_("/")))
#ifdef USE_HOVERBUTTON
open_last = new HoverButtonExt(this, ID_FILE_RECENT, load_resource_image(_("welcome_last")), _BUTTON_("last opened set"), _HELP_1_("last opened set", n.GetName()));
#else
......@@ -102,7 +101,12 @@ void WelcomeWindow::onNewSet(wxCommandEvent&) {
void WelcomeWindow::onOpenLast(wxCommandEvent&) {
wxBusyCursor wait;
assert(!settings.recent_sets.empty());
close( open_package<Set>(settings.recent_sets.front()) );
try {
close( open_package<Set>(settings.recent_sets.front()) );
} catch (PackageNotFoundError& e) {
handle_error(_("Cannot find package ") + e.what() + _(" to open."));
settings.recent_sets.clear();
}
}
void WelcomeWindow::onCheckUpdates(wxCommandEvent&) {
......
......@@ -35,7 +35,16 @@ DECLARE_POINTER_TYPE(FunctionProfile);
return i.QuadPart;
}
#else
#error "No Timer implementation, can't use profiler"
// clock() has nanosecond resolution on Linux
// on any other platform, stil the best way.
typedef clock_t ProfileTime;
inline ProfileTime timer_now() {
return clock();
}
inline ProfileTime timer_resolution() {
return CLOCKS_PER_SEC;
}
#endif
/// Simple execution timer
......
......@@ -6,7 +6,7 @@
// ----------------------------------------------------------------------------- : Includes
#include <util/prec.hpp>
#include <util/prec.hpp>
#include <util/file_utils.hpp>
#include <wx/filename.h>
#include <wx/dir.h>
......@@ -84,7 +84,7 @@ bool resolve_filename_conflicts(wxFileName& fn, FilenameConflicts conflicts, set
// ----------------------------------------------------------------------------- : Directories
bool create_parent_dirs(const String& file) {
for (size_t pos = file.find_first_of(_("\\/")) ;
for (size_t pos = file.find_first_of(_("\\/"), 1) ;
pos != String::npos ;
pos = file.find_first_of(_("\\/"),pos+1)) {
String part = file.substr(0,pos);
......
......@@ -31,6 +31,10 @@ PackageManager package_manager;
void PackageManager::init() {
local.init(true);
global.init(false);
if (!(local.valid() || global.valid()))
throw Error(_("The MSE data files can not be found, there should be a directory called 'data' with these files. ")
_("The expected place to find it in was either ") + wxStandardPaths::Get().GetDataDir() + _(" or ") +
wxStandardPaths::Get().GetUserDataDir());
}
void PackageManager::destroy() {
loaded_packages.clear();
......@@ -186,15 +190,19 @@ void PackageDirectory::init(bool local) {
String d = dir;
dir = wxPathOnly(dir);
if (d == dir) {
// we are at the root -> 'data' not found anywhere in the path -> fatal error
throw Error(_("The global MSE data files can not be found, there should be a directory called 'data' with these files. The expected place to find it in was ") + wxStandardPaths::Get().GetDataDir());
// we are at the root -> 'data' not found anywhere in the path
dir = wxStandardPaths::Get().GetDataDir();
break;
}
}
init(dir + _("/data"));
}
}
void PackageDirectory::init(const String& dir) {
directory = dir;
if (wxDirExists(dir))
directory = dir;
else
directory.clear();
}
String PackageDirectory::name(const String& name) const {
......
......@@ -63,6 +63,8 @@ class PackageDirectory {
void init(bool local);
void init(const String& dir);
bool valid() const { return !directory.empty(); }
/// Name of a package in this directory
String name(const String& name) const;
/// Does a package with the given name exist?
......
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