diff --git a/MakeAM.sh b/MakeAM.sh index 7d300c7d..5e84cec2 100755 --- a/MakeAM.sh +++ b/MakeAM.sh @@ -12,7 +12,7 @@ echo " AUTOMAKE_OPTIONS = subdir-objects bin_PROGRAMS = magicseteditor -AM_CXXFLAGS = @WX_CXXFLAGS@ \$(BOOST_CXXFLAGS) -DUNICODE -I . -Wall +AM_CXXFLAGS = @WX_CXXFLAGS@ \$(BOOST_CXXFLAGS) -DUNICODE -I . -Wall -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC AM_LDFLAGS = @WX_LIBS@ \$(BOOST_LDFLAGS) magicseteditor_LDADD = \$(BOOST_REGEX_LIB) diff --git a/Makefile.in b/Makefile.in index 0f9d6e92..32c96d9f 100644 --- a/Makefile.in +++ b/Makefile.in @@ -64,6 +64,7 @@ am_magicseteditor_OBJECTS = ./src/util/version.$(OBJEXT) \ ./src/util/spec_sort.$(OBJEXT) \ ./src/util/io/get_member.$(OBJEXT) \ ./src/util/io/package_manager.$(OBJEXT) \ + ./src/util/io/subversion.$(OBJEXT) \ ./src/util/io/writer.$(OBJEXT) ./src/util/io/reader.$(OBJEXT) \ ./src/util/io/package.$(OBJEXT) \ ./src/util/action_stack.$(OBJEXT) ./src/util/error.$(OBJEXT) \ @@ -335,7 +336,7 @@ top_srcdir = @top_srcdir@ # This flag allows us to use subdirectories: AUTOMAKE_OPTIONS = subdir-objects -AM_CXXFLAGS = @WX_CXXFLAGS@ $(BOOST_CXXFLAGS) -DUNICODE -I . -Wall +AM_CXXFLAGS = @WX_CXXFLAGS@ $(BOOST_CXXFLAGS) -DUNICODE -I . -Wall -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC AM_LDFLAGS = @WX_LIBS@ $(BOOST_LDFLAGS) magicseteditor_LDADD = $(BOOST_REGEX_LIB) @@ -345,20 +346,21 @@ magicseteditor_SOURCES = ./src/util/version.cpp \ ./src/util/tagged_string.cpp ./src/util/spell_checker.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/util/io/subversion.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 \ @@ -547,6 +549,8 @@ src/util/io/$(DEPDIR)/$(am__dirstamp): src/util/io/$(DEPDIR)/$(am__dirstamp) ./src/util/io/package_manager.$(OBJEXT): src/util/io/$(am__dirstamp) \ src/util/io/$(DEPDIR)/$(am__dirstamp) +./src/util/io/subversion.$(OBJEXT): src/util/io/$(am__dirstamp) \ + src/util/io/$(DEPDIR)/$(am__dirstamp) ./src/util/io/writer.$(OBJEXT): src/util/io/$(am__dirstamp) \ src/util/io/$(DEPDIR)/$(am__dirstamp) ./src/util/io/reader.$(OBJEXT): src/util/io/$(am__dirstamp) \ @@ -1175,6 +1179,7 @@ mostlyclean-compile: -rm -f ./src/util/io/package.$(OBJEXT) -rm -f ./src/util/io/package_manager.$(OBJEXT) -rm -f ./src/util/io/reader.$(OBJEXT) + -rm -f ./src/util/io/subversion.$(OBJEXT) -rm -f ./src/util/io/writer.$(OBJEXT) -rm -f ./src/util/regex.$(OBJEXT) -rm -f ./src/util/rotation.$(OBJEXT) @@ -1352,6 +1357,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./src/util/io/$(DEPDIR)/package.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./src/util/io/$(DEPDIR)/package_manager.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./src/util/io/$(DEPDIR)/reader.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./src/util/io/$(DEPDIR)/subversion.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./src/util/io/$(DEPDIR)/writer.Po@am__quote@ .cpp.o: diff --git a/configure b/configure index 10b11f54..c19e8577 100755 --- a/configure +++ b/configure @@ -2368,6 +2368,9 @@ am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' # Checks for programs. +if test -n "${CXXFLAGS}"; then + user_set_cxxflags=yes +fi ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -3160,6 +3163,10 @@ else fi +if test X$user_set_cxxflags != Xyes; then + CXXFLAGS="-g -O0" +fi + # Checks for libraries. ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -4790,15 +4797,15 @@ fi WX_VERSION="" min_wx_version=2.8.0 - if test -z "" ; then + if test -z "--debug" ; then { $as_echo "$as_me:$LINENO: checking for wxWidgets version >= $min_wx_version" >&5 $as_echo_n "checking for wxWidgets version >= $min_wx_version... " >&6; } else - { $as_echo "$as_me:$LINENO: checking for wxWidgets version >= $min_wx_version ()" >&5 -$as_echo_n "checking for wxWidgets version >= $min_wx_version ()... " >&6; } + { $as_echo "$as_me:$LINENO: checking for wxWidgets version >= $min_wx_version (--debug)" >&5 +$as_echo_n "checking for wxWidgets version >= $min_wx_version (--debug)... " >&6; } fi - WX_CONFIG_WITH_ARGS="$WX_CONFIG_PATH $wx_config_args " + WX_CONFIG_WITH_ARGS="$WX_CONFIG_PATH $wx_config_args --debug " WX_VERSION=`$WX_CONFIG_WITH_ARGS --version 2>/dev/null` wx_config_major_version=`echo $WX_VERSION | \ @@ -8090,3 +8097,8 @@ if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi + +echo "******************************************************************************* +*DON'T YOU DARE SHIP THIS VERSION BECAUSE DEBUGGING IS ENABLED PLEASE DISABLE * +*IT FIRST BY REMOVING --debug FROM WX AND REMOVING LIBSTDCXX -D FROM MakeAM.sh* +*******************************************************************************" diff --git a/configure.ac b/configure.ac index b73e68e8..9c580a74 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,6 @@ #+----------------------------------------------------------------------------+ #| Description: Magic Set Editor - Program to make Magic (tm) cards | -#| Copyright: (C) 2001 - 2007 Twan van Laarhoven | +#| Copyright: (C) 2001 - 2007 Twan van Laarhoven and Sean "coppro" Hunt | #| License: GNU General Public License 2 or later (see file COPYING) | #+----------------------------------------------------------------------------+ @@ -14,7 +14,14 @@ AC_CONFIG_HEADER([src/config.h]) AM_INIT_AUTOMAKE([-Wall foreign]) # Checks for programs. +if test -n "${CXXFLAGS}"; then + user_set_cxxflags=yes +fi AC_PROG_CXX +if test X$user_set_cxxflags != Xyes; then + CXXFLAGS="-g -O0" +fi + # Checks for libraries. AC_CHECK_LIB([hunspell],[Hunspell_create]) @@ -25,7 +32,7 @@ BOOST_REGEX_LIB="-Wl,-Bstatic $BOOST_REGEX_LIB -Wl,-Bdynamic" # Check for wxWidgets AM_OPTIONS_WXCONFIG -AM_PATH_WXCONFIG(2.8.0,wxWin=1) +AM_PATH_WXCONFIG(2.8.0,wxWin=1,,,[--debug]) if test "$wxWin" != 1; then AC_MSG_ERROR([ wxWindows must be installed on your system @@ -95,3 +102,8 @@ fi AC_OUTPUT([ Makefile ]) + +echo "******************************************************************************* +*DON'T YOU DARE SHIP THIS VERSION BECAUSE DEBUGGING IS ENABLED PLEASE DISABLE * +*IT FIRST BY REMOVING --debug FROM WX AND REMOVING LIBSTDCXX -D FROM MakeAM.sh* +*******************************************************************************" \ No newline at end of file diff --git a/src/data/field/choice.cpp b/src/data/field/choice.cpp index 215a095d..4ecdc063 100644 --- a/src/data/field/choice.cpp +++ b/src/data/field/choice.cpp @@ -168,6 +168,7 @@ ChoiceStyle::ChoiceStyle(const ChoiceFieldP& field) , combine(COMBINE_NORMAL) , alignment(ALIGN_STRETCH) , thumbnails(nullptr) + , content_width(0.0), content_height(0.0) {} ChoiceStyle::~ChoiceStyle() { diff --git a/src/gui/set/cards_panel.cpp b/src/gui/set/cards_panel.cpp index f7e7d588..5a3ed2f3 100644 --- a/src/gui/set/cards_panel.cpp +++ b/src/gui/set/cards_panel.cpp @@ -276,6 +276,9 @@ void CardsPanel::onUpdateUI(wxUpdateUIEvent& ev) { collapse_notes->SetHelpText(collapse ? _HELP_("collapse notes") : _HELP_("expand notes")); break; } +#if 0 //ifdef __WXGTK__ //crashes on GTK + case ID_INSERT_SYMBOL: ev.Enable(false); break; +#else case ID_INSERT_SYMBOL: { wxMenu* menu = editor->getMenu(ID_INSERT_SYMBOL); ev.Enable(menu); @@ -285,17 +288,21 @@ void CardsPanel::onUpdateUI(wxUpdateUIEvent& ev) { insertSymbolMenu->SetSubMenu(menu); menuFormat->Append(insertSymbolMenu); } + break; } +#endif } } void CardsPanel::onCommand(int id) { switch (id) { case ID_CARD_PREV: - card_list->selectPrevious(); + // Note: Forwarded events may cause this to occur even at the top. + if (card_list->canSelectPrevious()) card_list->selectPrevious(); break; case ID_CARD_NEXT: - card_list->selectNext(); + // Note: Forwarded events may cause this to occur even at the bottom. + if (card_list->canSelectNext()) card_list->selectNext(); break; case ID_CARD_ADD: set->actions.addAction(new AddCardAction(*set)); diff --git a/src/render/text/viewer.cpp b/src/render/text/viewer.cpp index 728dc24b..48f4e633 100644 --- a/src/render/text/viewer.cpp +++ b/src/render/text/viewer.cpp @@ -26,7 +26,8 @@ struct TextViewer::Line { bool justifying; ///< Is the text justified? Only true when *really* justifying. Line() - : start(0), end_or_soft(0), top(0), line_height(0), break_after(BREAK_NO) + : start(0), end_or_soft(0), top(0), line_height(0) + , break_after(BREAK_NO), justifying(false) {} /// The position (just beyond) the bottom of this line diff --git a/src/util/io/package.cpp b/src/util/io/package.cpp index f5323b23..f5e27e6d 100644 --- a/src/util/io/package.cpp +++ b/src/util/io/package.cpp @@ -244,6 +244,7 @@ String Package::nameOut(const String& file) { if (it == files.end()) { // new file it = addFile(name); + it->second.created = true; } // return stream @@ -271,7 +272,8 @@ FileName Package::newFileName(const String& prefix, const String& suffix) { FileInfos::iterator it = files.find(name); if (it == files.end()) { // name doesn't exist yet - addFile(name); + it = addFile(name); + it->second.created = true; return name; } } @@ -320,7 +322,7 @@ InputStreamP Package::openAbsoluteFile(const String& name) { // ----------------------------------------------------------------------------- : Package : private Package::FileInfo::FileInfo() - : keep(false), zipEntry(nullptr) + : keep(false), created(false), zipEntry(nullptr) {} Package::FileInfo::~FileInfo() { @@ -379,11 +381,12 @@ void Package::openZipfile() { void Package::saveToDirectory(const String& saveAs, bool remove_unused, bool is_copy) { // write to a directory + VCSP vcs = getVCS(); FOR_EACH(f, files) { if (!f.second.keep && remove_unused) { // remove files that are not to be kept // ignore failure (new file that is not kept) - wxRemoveFile(saveAs+_("/")+f.first); + vcs->removeFile(saveAs+_("/")+f.first); } else if (f.second.wasWritten()) { // move files that were updated wxRemoveFile(saveAs+_("/")+f.first); @@ -391,11 +394,16 @@ void Package::saveToDirectory(const String& saveAs, bool remove_unused, bool is_ : wxRenameFile(f.second.tempName, saveAs+_("/")+f.first))) { throw PackageError(_ERROR_("unable to store file")); } + if (f.second.created) { + vcs->addFile(saveAs+_("/")+f.first); + f.second.created = false; + } } else if (filename != saveAs) { // save as, copy old filess if (!wxCopyFile(filename+_("/")+f.first, saveAs+_("/")+f.first)) { throw PackageError(_ERROR_("unable to store file")); } + vcs->addFile(saveAs+_("/")+f.first); } else { // old file, just keep it } @@ -462,7 +470,7 @@ DateTime Package::modificationTime(const pair& fi) const { } else if (wxFileExists(filename+_("/")+fi.first)) { return wxFileName(filename+_("/")+fi.first).GetModificationTime(); } else { - return DateTime(); + return DateTime((wxLongLong)0ul); } } @@ -505,6 +513,7 @@ IMPLEMENT_REFLECTION(Packaged) { Packaged::Packaged() : position_hint(100000) , fully_loaded(true) + , vcs(nullptr) {} InputStreamP Packaged::openIconFile() { diff --git a/src/util/io/package.hpp b/src/util/io/package.hpp index e02a7f6d..441c7563 100644 --- a/src/util/io/package.hpp +++ b/src/util/io/package.hpp @@ -13,6 +13,7 @@ #include #include #include +#include class Package; class wxFileInputStream; @@ -141,6 +142,10 @@ class Package : public IntrusivePtrVirtualBase { writer.handle(obj); } + protected: + // TODO: I dislike this very much. There ought to be a better way. + virtual VCSP getVCS() { return new_intrusive(); } + // --------------------------------------------------- : Private stuff private: @@ -149,6 +154,7 @@ class Package : public IntrusivePtrVirtualBase { FileInfo(); ~FileInfo(); bool keep; ///< Should this file be kept in the package? (as opposed to deleting it) + bool created; ///< Was this file just created (e.g. should the VCS add it?) String tempName; ///< Name of the temporary file where new contents of this file are placed wxZipEntry* zipEntry; ///< Entry in the zip file for this file /// Is this file changed, and therefore written to a temporary file? @@ -213,6 +219,7 @@ class Packaged : public Package { String icon_filename; ///< Filename of icon to use in package lists vector dependencies; ///< Dependencies of this package int position_hint; ///< A hint for the package list + VCSP vcs; ///< The version control system to use /// Get an input stream for the package icon, if there is any InputStreamP openIconFile(); @@ -236,6 +243,10 @@ class Packaged : public Package { } protected: + virtual VCSP getVCS() { + return vcs; + } + /// filename of the data file, and extension of the package file virtual String typeName() const = 0; /// Can be overloaded to do validation after loading