mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
MSE can now save cards in separate files (needs manual config editing still).
Trailing slashes are stripped from commandline arguments (because directory.mse-set/ should be accepted) git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1386 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
+4
-3
@@ -1,4 +1,4 @@
|
||||
# Makefile.in generated by automake 1.10.1 from Makefile.am.
|
||||
# Makefile.in generated by automake 1.10.2 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
@@ -329,6 +329,7 @@ sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
|
||||
@@ -338,7 +339,7 @@ AM_CXXFLAGS = @WX_CXXFLAGS@ $(BOOST_CXXFLAGS) -DUNICODE -I . -Wall
|
||||
AM_LDFLAGS = @WX_LIBS@ $(BOOST_LDFLAGS)
|
||||
magicseteditor_LDADD = $(BOOST_REGEX_LIB)
|
||||
|
||||
# The script used to generate is MakeAM.sh
|
||||
# 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/spell_checker.cpp \
|
||||
@@ -1374,7 +1375,7 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
mkid -fID $$unique
|
||||
tags: TAGS
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
/* src/config.h.in. Generated from configure.ac by autoheader. */
|
||||
|
||||
/* define if the Boost library is available */
|
||||
#undef HAVE_BOOST
|
||||
|
||||
/* define if the Boost::Regex library is available */
|
||||
#undef HAVE_BOOST_REGEX
|
||||
|
||||
/* Define to 1 if you have the `floor' function. */
|
||||
#undef HAVE_FLOOR
|
||||
|
||||
@@ -9,6 +15,9 @@
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#undef HAVE_INTTYPES_H
|
||||
|
||||
/* Define to 1 if you have the `hunspell' library (-lhunspell). */
|
||||
#undef HAVE_LIBHUNSPELL
|
||||
|
||||
/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
|
||||
to 0 otherwise. */
|
||||
#undef HAVE_MALLOC
|
||||
|
||||
+37
-1
@@ -180,7 +180,8 @@ IMPLEMENT_REFLECTION(Set) {
|
||||
if (stylesheet) {
|
||||
REFLECT_N("styling", styling_data);
|
||||
}
|
||||
REFLECT(cards);
|
||||
// Experimental: save each card to a different file
|
||||
reflect_cards(tag);
|
||||
REFLECT(keywords);
|
||||
REFLECT(pack_types);
|
||||
}
|
||||
@@ -188,6 +189,41 @@ IMPLEMENT_REFLECTION(Set) {
|
||||
REFLECT(apprentice_code);
|
||||
}
|
||||
|
||||
// TODO: this function sucks
|
||||
bool isnt_filename_safe (Char c) {
|
||||
return !((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'z') ||
|
||||
(c >= _('0') && c <= _('9')) || c == _(' '));
|
||||
}
|
||||
|
||||
// TODO: make this a more generic function to be used elsewhere
|
||||
template <typename Tag>
|
||||
void Set::reflect_cards (Tag& tag) {
|
||||
REFLECT(cards);
|
||||
}
|
||||
|
||||
template <>
|
||||
void Set::reflect_cards<Writer> (Writer& tag) {
|
||||
if (settings.save_cards_separately) {
|
||||
set<String> used;
|
||||
FOR_EACH(card, cards) {
|
||||
String filename = normalize_internal_filename(clean_filename(card->identification()));
|
||||
String full_name = filename;
|
||||
int i = 0;
|
||||
|
||||
while (used.find(full_name) != used.end()) {
|
||||
full_name = filename << _(".") << ++i;
|
||||
}
|
||||
used.insert(full_name);
|
||||
|
||||
Writer writer(openOut(full_name), app_version);
|
||||
writer.handle(_("card"), card);
|
||||
REFLECT_N("include file", full_name);
|
||||
}
|
||||
} else {
|
||||
REFLECT(cards);
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------- : Script utilities
|
||||
|
||||
ScriptValueP make_iterator(const Set& set) {
|
||||
|
||||
@@ -122,6 +122,8 @@ class Set : public Packaged {
|
||||
|
||||
private:
|
||||
DECLARE_REFLECTION();
|
||||
template <typename Tag>
|
||||
void reflect_cards (Tag& tag);
|
||||
|
||||
/// Object for managing and executing scripts
|
||||
scoped_ptr<SetScriptManager> script_manager;
|
||||
|
||||
@@ -249,6 +249,7 @@ IMPLEMENT_REFLECTION_NO_SCRIPT(Settings) {
|
||||
REFLECT(set_window_height);
|
||||
REFLECT(card_notes_height);
|
||||
REFLECT(open_sets_in_new_window);
|
||||
REFLECT(save_cards_separately);
|
||||
REFLECT(symbol_grid_size);
|
||||
REFLECT(symbol_grid);
|
||||
REFLECT(symbol_grid_snap);
|
||||
|
||||
@@ -145,6 +145,9 @@ class Settings {
|
||||
UInt set_window_height;
|
||||
UInt card_notes_height;
|
||||
bool open_sets_in_new_window;
|
||||
|
||||
// --------------------------------------------------- : Set saving
|
||||
bool save_cards_separately;
|
||||
|
||||
// --------------------------------------------------- : Symbol editor
|
||||
UInt symbol_grid_size;
|
||||
|
||||
@@ -70,7 +70,7 @@ void StylePanel::updateListSize() {
|
||||
// we only need enough columns to show all items
|
||||
int x_room = GetSize().x - editor->GetBestSize().x - 6;
|
||||
size_t need_columns = (size_t)ceil(list->requiredWidth() / (double)x_room);
|
||||
size_t column_count = max(1ul, min(fit_columns, need_columns));
|
||||
size_t column_count = max((size_t)1, min(fit_columns, need_columns));
|
||||
// change count
|
||||
if (column_count != list->column_count) {
|
||||
list->column_count = column_count;
|
||||
|
||||
+2
-2
@@ -93,9 +93,9 @@ int MSE::OnRun() {
|
||||
// interpret command line
|
||||
if (argc > 1) {
|
||||
try {
|
||||
// Command line argument, find its extension
|
||||
String arg = argv[1];
|
||||
wxFileName f(argv[1]);
|
||||
// Find the extension
|
||||
wxFileName f(arg.Mid(0,arg.find_last_not_of(_("\\/"))+1));
|
||||
if (f.GetExt() == _("mse-symbol")) {
|
||||
// Show the symbol editor
|
||||
Window* wnd = new SymbolWindow(nullptr, argv[1]);
|
||||
|
||||
@@ -245,6 +245,12 @@ String Package::nameOut(const String& file) {
|
||||
// new file
|
||||
it = addFile(name);
|
||||
}
|
||||
// New files should automatically be kept
|
||||
// NOTE: coppro discovered that this didn't match comments in
|
||||
// package.hpp. He could be wrong about this. Please change this
|
||||
// back and add a call to referenceFile in Set::reflect_cards if
|
||||
// this is wrong.
|
||||
it->second.keep = true;
|
||||
// return stream
|
||||
if (it->second.wasWritten()) {
|
||||
return it->second.tempName;
|
||||
|
||||
Reference in New Issue
Block a user