mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-12 13:37:00 -04:00
Lots of miscellaneous fixes, also added basic VCS framework
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1416 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -12,7 +12,7 @@ echo "
|
|||||||
AUTOMAKE_OPTIONS = subdir-objects
|
AUTOMAKE_OPTIONS = subdir-objects
|
||||||
|
|
||||||
bin_PROGRAMS = magicseteditor
|
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)
|
AM_LDFLAGS = @WX_LIBS@ \$(BOOST_LDFLAGS)
|
||||||
|
|
||||||
magicseteditor_LDADD = \$(BOOST_REGEX_LIB)
|
magicseteditor_LDADD = \$(BOOST_REGEX_LIB)
|
||||||
|
|||||||
+21
-15
@@ -64,6 +64,7 @@ am_magicseteditor_OBJECTS = ./src/util/version.$(OBJEXT) \
|
|||||||
./src/util/spec_sort.$(OBJEXT) \
|
./src/util/spec_sort.$(OBJEXT) \
|
||||||
./src/util/io/get_member.$(OBJEXT) \
|
./src/util/io/get_member.$(OBJEXT) \
|
||||||
./src/util/io/package_manager.$(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/writer.$(OBJEXT) ./src/util/io/reader.$(OBJEXT) \
|
||||||
./src/util/io/package.$(OBJEXT) \
|
./src/util/io/package.$(OBJEXT) \
|
||||||
./src/util/action_stack.$(OBJEXT) ./src/util/error.$(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:
|
# This flag allows us to use subdirectories:
|
||||||
AUTOMAKE_OPTIONS = subdir-objects
|
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)
|
AM_LDFLAGS = @WX_LIBS@ $(BOOST_LDFLAGS)
|
||||||
magicseteditor_LDADD = $(BOOST_REGEX_LIB)
|
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/tagged_string.cpp ./src/util/spell_checker.cpp \
|
||||||
./src/util/regex.cpp ./src/util/spec_sort.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/get_member.cpp ./src/util/io/package_manager.cpp \
|
||||||
./src/util/io/writer.cpp ./src/util/io/reader.cpp \
|
./src/util/io/subversion.cpp ./src/util/io/writer.cpp \
|
||||||
./src/util/io/package.cpp ./src/util/action_stack.cpp \
|
./src/util/io/reader.cpp ./src/util/io/package.cpp \
|
||||||
./src/util/error.cpp ./src/util/age.cpp \
|
./src/util/action_stack.cpp ./src/util/error.cpp \
|
||||||
./src/util/file_utils.cpp ./src/util/string.cpp \
|
./src/util/age.cpp ./src/util/file_utils.cpp \
|
||||||
./src/gfx/color.cpp ./src/gfx/mask_image.cpp \
|
./src/util/string.cpp ./src/gfx/color.cpp \
|
||||||
./src/gfx/rotate_image.cpp ./src/gfx/image_effects.cpp \
|
./src/gfx/mask_image.cpp ./src/gfx/rotate_image.cpp \
|
||||||
./src/gfx/resample_text.cpp ./src/gfx/combine_image.cpp \
|
./src/gfx/image_effects.cpp ./src/gfx/resample_text.cpp \
|
||||||
./src/gfx/polynomial.cpp ./src/gfx/bezier.cpp \
|
./src/gfx/combine_image.cpp ./src/gfx/polynomial.cpp \
|
||||||
./src/gfx/generated_image.cpp ./src/gfx/resample_image.cpp \
|
./src/gfx/bezier.cpp ./src/gfx/generated_image.cpp \
|
||||||
./src/gfx/blend_image.cpp ./src/main.cpp \
|
./src/gfx/resample_image.cpp ./src/gfx/blend_image.cpp \
|
||||||
./src/render/card/viewer.cpp ./src/render/text/compound.cpp \
|
./src/main.cpp ./src/render/card/viewer.cpp \
|
||||||
./src/render/text/symbol.cpp ./src/render/text/font.cpp \
|
./src/render/text/compound.cpp ./src/render/text/symbol.cpp \
|
||||||
./src/render/text/viewer.cpp ./src/render/text/element.cpp \
|
./src/render/text/font.cpp ./src/render/text/viewer.cpp \
|
||||||
./src/render/symbol/filter.cpp ./src/render/symbol/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/multiple_choice.cpp \
|
||||||
./src/render/value/symbol.cpp ./src/render/value/color.cpp \
|
./src/render/value/symbol.cpp ./src/render/value/color.cpp \
|
||||||
./src/render/value/package_choice.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/$(DEPDIR)/$(am__dirstamp)
|
||||||
./src/util/io/package_manager.$(OBJEXT): src/util/io/$(am__dirstamp) \
|
./src/util/io/package_manager.$(OBJEXT): src/util/io/$(am__dirstamp) \
|
||||||
src/util/io/$(DEPDIR)/$(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/writer.$(OBJEXT): src/util/io/$(am__dirstamp) \
|
||||||
src/util/io/$(DEPDIR)/$(am__dirstamp)
|
src/util/io/$(DEPDIR)/$(am__dirstamp)
|
||||||
./src/util/io/reader.$(OBJEXT): src/util/io/$(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.$(OBJEXT)
|
||||||
-rm -f ./src/util/io/package_manager.$(OBJEXT)
|
-rm -f ./src/util/io/package_manager.$(OBJEXT)
|
||||||
-rm -f ./src/util/io/reader.$(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/io/writer.$(OBJEXT)
|
||||||
-rm -f ./src/util/regex.$(OBJEXT)
|
-rm -f ./src/util/regex.$(OBJEXT)
|
||||||
-rm -f ./src/util/rotation.$(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.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)/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)/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@
|
@AMDEP_TRUE@@am__include@ @am__quote@./src/util/io/$(DEPDIR)/writer.Po@am__quote@
|
||||||
|
|
||||||
.cpp.o:
|
.cpp.o:
|
||||||
|
|||||||
@@ -2368,6 +2368,9 @@ am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'
|
|||||||
|
|
||||||
|
|
||||||
# Checks for programs.
|
# Checks for programs.
|
||||||
|
if test -n "${CXXFLAGS}"; then
|
||||||
|
user_set_cxxflags=yes
|
||||||
|
fi
|
||||||
ac_ext=cpp
|
ac_ext=cpp
|
||||||
ac_cpp='$CXXCPP $CPPFLAGS'
|
ac_cpp='$CXXCPP $CPPFLAGS'
|
||||||
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
|
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
|
||||||
@@ -3160,6 +3163,10 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
if test X$user_set_cxxflags != Xyes; then
|
||||||
|
CXXFLAGS="-g -O0"
|
||||||
|
fi
|
||||||
|
|
||||||
# Checks for libraries.
|
# Checks for libraries.
|
||||||
ac_ext=c
|
ac_ext=c
|
||||||
ac_cpp='$CPP $CPPFLAGS'
|
ac_cpp='$CPP $CPPFLAGS'
|
||||||
@@ -4790,15 +4797,15 @@ fi
|
|||||||
WX_VERSION=""
|
WX_VERSION=""
|
||||||
|
|
||||||
min_wx_version=2.8.0
|
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 "$as_me:$LINENO: checking for wxWidgets version >= $min_wx_version" >&5
|
||||||
$as_echo_n "checking for wxWidgets version >= $min_wx_version... " >&6; }
|
$as_echo_n "checking for wxWidgets version >= $min_wx_version... " >&6; }
|
||||||
else
|
else
|
||||||
{ $as_echo "$as_me:$LINENO: checking for wxWidgets version >= $min_wx_version ()" >&5
|
{ $as_echo "$as_me:$LINENO: checking for wxWidgets version >= $min_wx_version (--debug)" >&5
|
||||||
$as_echo_n "checking for wxWidgets version >= $min_wx_version ()... " >&6; }
|
$as_echo_n "checking for wxWidgets version >= $min_wx_version (--debug)... " >&6; }
|
||||||
fi
|
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_VERSION=`$WX_CONFIG_WITH_ARGS --version 2>/dev/null`
|
||||||
wx_config_major_version=`echo $WX_VERSION | \
|
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:$LINENO: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
|
{ $as_echo "$as_me:$LINENO: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
|
||||||
$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
|
$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
|
||||||
fi
|
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*
|
||||||
|
|||||||
+14
-2
@@ -1,6 +1,6 @@
|
|||||||
#+----------------------------------------------------------------------------+
|
#+----------------------------------------------------------------------------+
|
||||||
#| Description: Magic Set Editor - Program to make Magic (tm) cards |
|
#| 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) |
|
#| 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])
|
AM_INIT_AUTOMAKE([-Wall foreign])
|
||||||
|
|
||||||
# Checks for programs.
|
# Checks for programs.
|
||||||
|
if test -n "${CXXFLAGS}"; then
|
||||||
|
user_set_cxxflags=yes
|
||||||
|
fi
|
||||||
AC_PROG_CXX
|
AC_PROG_CXX
|
||||||
|
if test X$user_set_cxxflags != Xyes; then
|
||||||
|
CXXFLAGS="-g -O0"
|
||||||
|
fi
|
||||||
|
|
||||||
# Checks for libraries.
|
# Checks for libraries.
|
||||||
AC_CHECK_LIB([hunspell],[Hunspell_create])
|
AC_CHECK_LIB([hunspell],[Hunspell_create])
|
||||||
|
|
||||||
@@ -25,7 +32,7 @@ BOOST_REGEX_LIB="-Wl,-Bstatic $BOOST_REGEX_LIB -Wl,-Bdynamic"
|
|||||||
|
|
||||||
# Check for wxWidgets
|
# Check for wxWidgets
|
||||||
AM_OPTIONS_WXCONFIG
|
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
|
if test "$wxWin" != 1; then
|
||||||
AC_MSG_ERROR([
|
AC_MSG_ERROR([
|
||||||
wxWindows must be installed on your system
|
wxWindows must be installed on your system
|
||||||
@@ -95,3 +102,8 @@ fi
|
|||||||
AC_OUTPUT([
|
AC_OUTPUT([
|
||||||
Makefile
|
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*
|
||||||
|
*******************************************************************************"
|
||||||
@@ -168,6 +168,7 @@ ChoiceStyle::ChoiceStyle(const ChoiceFieldP& field)
|
|||||||
, combine(COMBINE_NORMAL)
|
, combine(COMBINE_NORMAL)
|
||||||
, alignment(ALIGN_STRETCH)
|
, alignment(ALIGN_STRETCH)
|
||||||
, thumbnails(nullptr)
|
, thumbnails(nullptr)
|
||||||
|
, content_width(0.0), content_height(0.0)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
ChoiceStyle::~ChoiceStyle() {
|
ChoiceStyle::~ChoiceStyle() {
|
||||||
|
|||||||
@@ -276,6 +276,9 @@ void CardsPanel::onUpdateUI(wxUpdateUIEvent& ev) {
|
|||||||
collapse_notes->SetHelpText(collapse ? _HELP_("collapse notes") : _HELP_("expand notes"));
|
collapse_notes->SetHelpText(collapse ? _HELP_("collapse notes") : _HELP_("expand notes"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#if 0 //ifdef __WXGTK__ //crashes on GTK
|
||||||
|
case ID_INSERT_SYMBOL: ev.Enable(false); break;
|
||||||
|
#else
|
||||||
case ID_INSERT_SYMBOL: {
|
case ID_INSERT_SYMBOL: {
|
||||||
wxMenu* menu = editor->getMenu(ID_INSERT_SYMBOL);
|
wxMenu* menu = editor->getMenu(ID_INSERT_SYMBOL);
|
||||||
ev.Enable(menu);
|
ev.Enable(menu);
|
||||||
@@ -285,17 +288,21 @@ void CardsPanel::onUpdateUI(wxUpdateUIEvent& ev) {
|
|||||||
insertSymbolMenu->SetSubMenu(menu);
|
insertSymbolMenu->SetSubMenu(menu);
|
||||||
menuFormat->Append(insertSymbolMenu);
|
menuFormat->Append(insertSymbolMenu);
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CardsPanel::onCommand(int id) {
|
void CardsPanel::onCommand(int id) {
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case ID_CARD_PREV:
|
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;
|
break;
|
||||||
case ID_CARD_NEXT:
|
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;
|
break;
|
||||||
case ID_CARD_ADD:
|
case ID_CARD_ADD:
|
||||||
set->actions.addAction(new AddCardAction(*set));
|
set->actions.addAction(new AddCardAction(*set));
|
||||||
|
|||||||
@@ -26,7 +26,8 @@ struct TextViewer::Line {
|
|||||||
bool justifying; ///< Is the text justified? Only true when *really* justifying.
|
bool justifying; ///< Is the text justified? Only true when *really* justifying.
|
||||||
|
|
||||||
Line()
|
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
|
/// The position (just beyond) the bottom of this line
|
||||||
|
|||||||
+13
-4
@@ -244,6 +244,7 @@ String Package::nameOut(const String& file) {
|
|||||||
if (it == files.end()) {
|
if (it == files.end()) {
|
||||||
// new file
|
// new file
|
||||||
it = addFile(name);
|
it = addFile(name);
|
||||||
|
it->second.created = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// return stream
|
// return stream
|
||||||
@@ -271,7 +272,8 @@ FileName Package::newFileName(const String& prefix, const String& suffix) {
|
|||||||
FileInfos::iterator it = files.find(name);
|
FileInfos::iterator it = files.find(name);
|
||||||
if (it == files.end()) {
|
if (it == files.end()) {
|
||||||
// name doesn't exist yet
|
// name doesn't exist yet
|
||||||
addFile(name);
|
it = addFile(name);
|
||||||
|
it->second.created = true;
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -320,7 +322,7 @@ InputStreamP Package::openAbsoluteFile(const String& name) {
|
|||||||
// ----------------------------------------------------------------------------- : Package : private
|
// ----------------------------------------------------------------------------- : Package : private
|
||||||
|
|
||||||
Package::FileInfo::FileInfo()
|
Package::FileInfo::FileInfo()
|
||||||
: keep(false), zipEntry(nullptr)
|
: keep(false), created(false), zipEntry(nullptr)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
Package::FileInfo::~FileInfo() {
|
Package::FileInfo::~FileInfo() {
|
||||||
@@ -379,11 +381,12 @@ void Package::openZipfile() {
|
|||||||
|
|
||||||
void Package::saveToDirectory(const String& saveAs, bool remove_unused, bool is_copy) {
|
void Package::saveToDirectory(const String& saveAs, bool remove_unused, bool is_copy) {
|
||||||
// write to a directory
|
// write to a directory
|
||||||
|
VCSP vcs = getVCS();
|
||||||
FOR_EACH(f, files) {
|
FOR_EACH(f, files) {
|
||||||
if (!f.second.keep && remove_unused) {
|
if (!f.second.keep && remove_unused) {
|
||||||
// remove files that are not to be kept
|
// remove files that are not to be kept
|
||||||
// ignore failure (new file that is not kept)
|
// ignore failure (new file that is not kept)
|
||||||
wxRemoveFile(saveAs+_("/")+f.first);
|
vcs->removeFile(saveAs+_("/")+f.first);
|
||||||
} else if (f.second.wasWritten()) {
|
} else if (f.second.wasWritten()) {
|
||||||
// move files that were updated
|
// move files that were updated
|
||||||
wxRemoveFile(saveAs+_("/")+f.first);
|
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))) {
|
: wxRenameFile(f.second.tempName, saveAs+_("/")+f.first))) {
|
||||||
throw PackageError(_ERROR_("unable to store file"));
|
throw PackageError(_ERROR_("unable to store file"));
|
||||||
}
|
}
|
||||||
|
if (f.second.created) {
|
||||||
|
vcs->addFile(saveAs+_("/")+f.first);
|
||||||
|
f.second.created = false;
|
||||||
|
}
|
||||||
} else if (filename != saveAs) {
|
} else if (filename != saveAs) {
|
||||||
// save as, copy old filess
|
// save as, copy old filess
|
||||||
if (!wxCopyFile(filename+_("/")+f.first, saveAs+_("/")+f.first)) {
|
if (!wxCopyFile(filename+_("/")+f.first, saveAs+_("/")+f.first)) {
|
||||||
throw PackageError(_ERROR_("unable to store file"));
|
throw PackageError(_ERROR_("unable to store file"));
|
||||||
}
|
}
|
||||||
|
vcs->addFile(saveAs+_("/")+f.first);
|
||||||
} else {
|
} else {
|
||||||
// old file, just keep it
|
// old file, just keep it
|
||||||
}
|
}
|
||||||
@@ -462,7 +470,7 @@ DateTime Package::modificationTime(const pair<String, FileInfo>& fi) const {
|
|||||||
} else if (wxFileExists(filename+_("/")+fi.first)) {
|
} else if (wxFileExists(filename+_("/")+fi.first)) {
|
||||||
return wxFileName(filename+_("/")+fi.first).GetModificationTime();
|
return wxFileName(filename+_("/")+fi.first).GetModificationTime();
|
||||||
} else {
|
} else {
|
||||||
return DateTime();
|
return DateTime((wxLongLong)0ul);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -505,6 +513,7 @@ IMPLEMENT_REFLECTION(Packaged) {
|
|||||||
Packaged::Packaged()
|
Packaged::Packaged()
|
||||||
: position_hint(100000)
|
: position_hint(100000)
|
||||||
, fully_loaded(true)
|
, fully_loaded(true)
|
||||||
|
, vcs(nullptr)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
InputStreamP Packaged::openIconFile() {
|
InputStreamP Packaged::openIconFile() {
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
#include <util/dynamic_arg.hpp>
|
#include <util/dynamic_arg.hpp>
|
||||||
#include <util/error.hpp>
|
#include <util/error.hpp>
|
||||||
#include <util/file_utils.hpp>
|
#include <util/file_utils.hpp>
|
||||||
|
#include <util/io/vcs.hpp>
|
||||||
|
|
||||||
class Package;
|
class Package;
|
||||||
class wxFileInputStream;
|
class wxFileInputStream;
|
||||||
@@ -141,6 +142,10 @@ class Package : public IntrusivePtrVirtualBase {
|
|||||||
writer.handle(obj);
|
writer.handle(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// TODO: I dislike this very much. There ought to be a better way.
|
||||||
|
virtual VCSP getVCS() { return new_intrusive<VCS>(); }
|
||||||
|
|
||||||
// --------------------------------------------------- : Private stuff
|
// --------------------------------------------------- : Private stuff
|
||||||
private:
|
private:
|
||||||
|
|
||||||
@@ -149,6 +154,7 @@ class Package : public IntrusivePtrVirtualBase {
|
|||||||
FileInfo();
|
FileInfo();
|
||||||
~FileInfo();
|
~FileInfo();
|
||||||
bool keep; ///< Should this file be kept in the package? (as opposed to deleting it)
|
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
|
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
|
wxZipEntry* zipEntry; ///< Entry in the zip file for this file
|
||||||
/// Is this file changed, and therefore written to a temporary 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
|
String icon_filename; ///< Filename of icon to use in package lists
|
||||||
vector<PackageDependencyP> dependencies; ///< Dependencies of this package
|
vector<PackageDependencyP> dependencies; ///< Dependencies of this package
|
||||||
int position_hint; ///< A hint for the package list
|
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
|
/// Get an input stream for the package icon, if there is any
|
||||||
InputStreamP openIconFile();
|
InputStreamP openIconFile();
|
||||||
@@ -236,6 +243,10 @@ class Packaged : public Package {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
virtual VCSP getVCS() {
|
||||||
|
return vcs;
|
||||||
|
}
|
||||||
|
|
||||||
/// filename of the data file, and extension of the package file
|
/// filename of the data file, and extension of the package file
|
||||||
virtual String typeName() const = 0;
|
virtual String typeName() const = 0;
|
||||||
/// Can be overloaded to do validation after loading
|
/// Can be overloaded to do validation after loading
|
||||||
|
|||||||
Reference in New Issue
Block a user