mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-12 21:47:00 -04:00
A working configure&makefile; now in the process of getting it to build on gcc
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@182 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
+144
@@ -0,0 +1,144 @@
|
|||||||
|
#+----------------------------------------------------------------------------+
|
||||||
|
#| Description: Magic Set Editor - Program to make Magic (tm) cards |
|
||||||
|
#| Copyright: (C) 2001 - 2007 Twan van Laarhoven |
|
||||||
|
#| License: GNU General Public License 2 or later (see file COPYING) |
|
||||||
|
#+----------------------------------------------------------------------------+
|
||||||
|
|
||||||
|
# This flag allows us to use subdirectories:
|
||||||
|
AUTOMAKE_OPTIONS = subdir-objects
|
||||||
|
|
||||||
|
bin_PROGRAMS = magicseteditor
|
||||||
|
AM_CXXFLAGS = @WX_CXXFLAGS@ -DUNICODE -I . -Wall
|
||||||
|
AM_LDFLAGS = @WX_LIBS@
|
||||||
|
|
||||||
|
magicseteditor_SOURCES =
|
||||||
|
|
||||||
|
# List of source files, generated using:
|
||||||
|
# find . -name *.cpp | sed "s/\./magicseteditor_SOURCES += ./"
|
||||||
|
|
||||||
|
magicseteditor_SOURCES += ./src/gfx/color.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/gfx/bezier.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/gfx/blend_image.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/gfx/resample_image.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/gfx/resample_text.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/gfx/image_effects.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/gfx/rotate_image.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/gfx/combine_image.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/gfx/polynomial.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/gfx/mask_image.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/gui/set/stats_panel.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/gui/set/panel.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/gui/set/set_info_panel.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/gui/set/style_panel.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/gui/set/keywords_panel.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/gui/set/window.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/gui/set/cards_panel.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/gui/control/card_viewer.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/gui/control/filtered_card_list.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/gui/control/select_card_list.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/gui/control/package_list.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/gui/control/gallery_list.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/gui/control/graph.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/gui/control/image_card_list.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/gui/control/card_list.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/gui/control/card_list_column_select.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/gui/control/native_look_editor.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/gui/control/card_editor.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/gui/control/text_ctrl.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/gui/preferences_window.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/gui/drop_down_list.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/gui/card_select_window.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/gui/welcome_window.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/gui/value/color.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/gui/value/symbol.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/gui/value/multiple_choice.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/gui/value/choice.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/gui/value/text.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/gui/value/image.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/gui/value/editor.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/gui/image_slice_window.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/gui/thumbnail_thread.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/gui/print_window.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/gui/about_window.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/gui/symbol/point_editor.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/gui/symbol/basic_shape_editor.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/gui/symbol/control.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/gui/symbol/select_editor.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/gui/symbol/editor.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/gui/symbol/part_list.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/gui/symbol/window.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/gui/update_checker.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/gui/new_window.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/gui/icon_menu.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/gui/util.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/data/field.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/data/field/color.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/data/field/symbol.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/data/field/multiple_choice.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/data/field/choice.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/data/field/boolean.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/data/field/text.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/data/field/image.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/data/symbol.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/data/stylesheet.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/data/set.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/data/font.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/data/locale.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/data/symbol_font.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/data/action/symbol.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/data/action/set.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/data/action/symbol_part.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/data/action/value.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/data/card.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/data/format/html.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/data/format/apprentice.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/data/format/mtg_editor.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/data/format/formats.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/data/format/image.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/data/format/mws.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/data/format/mse1.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/data/format/mse2.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/data/format/clipboard.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/data/statistics.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/data/settings.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/data/keyword.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/data/game.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/util/io/package.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/util/io/writer.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/util/io/get_member.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/util/io/reader.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/util/io/package_manager.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/util/rotation.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/util/action_stack.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/util/alignment.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/util/version.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/util/string.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/util/tagged_string.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/util/age.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/util/error.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/main.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/code_template.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/render/card/viewer.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/render/text/symbol.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/render/text/font.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/render/text/compound.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/render/text/viewer.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/render/text/element.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/render/value/color.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/render/value/symbol.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/render/value/multiple_choice.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/render/value/choice.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/render/value/text.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/render/value/image.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/render/value/viewer.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/render/symbol/filter.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/render/symbol/viewer.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/script/parser.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/script/functions.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/script/image.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/script/dependency.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/script/value.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/script/script.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/script/context.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/script/script_manager.cpp
|
||||||
|
magicseteditor_SOURCES += ./src/script/scriptable.cpp
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,51 @@
|
|||||||
|
#+----------------------------------------------------------------------------+
|
||||||
|
#| Description: Magic Set Editor - Program to make Magic (tm) cards |
|
||||||
|
#| Copyright: (C) 2001 - 2007 Twan van Laarhoven |
|
||||||
|
#| License: GNU General Public License 2 or later (see file COPYING) |
|
||||||
|
#+----------------------------------------------------------------------------+
|
||||||
|
|
||||||
|
# Process this file with autoconf to produce a configure script.
|
||||||
|
|
||||||
|
AC_INIT(magicseteditor, 0.3.0, twanvl@users.sourceforge.net)
|
||||||
|
AC_CONFIG_SRCDIR([src/main.cpp])
|
||||||
|
# TODO: Actually use the config header
|
||||||
|
AC_CONFIG_HEADER([src/config.h])
|
||||||
|
|
||||||
|
AM_INIT_AUTOMAKE([-Wall foreign])
|
||||||
|
|
||||||
|
# Checks for programs.
|
||||||
|
AC_PROG_CXX
|
||||||
|
|
||||||
|
# Checks for libraries.
|
||||||
|
# TODO: Check for boost
|
||||||
|
|
||||||
|
# Check for wxWidgets
|
||||||
|
AM_OPTIONS_WXCONFIG
|
||||||
|
AM_PATH_WXCONFIG(2.6.0,wxWin=1)
|
||||||
|
if test "$wxWin" != 1; then
|
||||||
|
AC_MSG_ERROR([
|
||||||
|
wxWindows must be installed on your system
|
||||||
|
but wx-config script couldn't be found.
|
||||||
|
|
||||||
|
Please check that wx-config is in path, the directory
|
||||||
|
where wxWindows libraries are installed (returned by
|
||||||
|
'wx-config --libs' command) is in LD_LIBRARY_PATH or
|
||||||
|
equivalent variable and wxWindows version is 2.6.0 or above.
|
||||||
|
])
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Checks for header files.
|
||||||
|
|
||||||
|
# Checks for typedefs, structures, and compiler characteristics.
|
||||||
|
AC_TYPE_SIZE_T
|
||||||
|
AC_STRUCT_TM
|
||||||
|
|
||||||
|
# Checks for library functions.
|
||||||
|
AC_HEADER_STDC
|
||||||
|
AC_FUNC_MALLOC
|
||||||
|
AC_FUNC_SELECT_ARGTYPES
|
||||||
|
AC_CHECK_FUNCS([floor memset pow select sqrt])
|
||||||
|
|
||||||
|
AC_OUTPUT([
|
||||||
|
Makefile
|
||||||
|
])
|
||||||
@@ -0,0 +1,95 @@
|
|||||||
|
/* src/config.h.in. Generated from configure.ac by autoheader. */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `floor' function. */
|
||||||
|
#undef HAVE_FLOOR
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||||
|
#undef HAVE_INTTYPES_H
|
||||||
|
|
||||||
|
/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
|
||||||
|
to 0 otherwise. */
|
||||||
|
#undef HAVE_MALLOC
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <memory.h> header file. */
|
||||||
|
#undef HAVE_MEMORY_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `memset' function. */
|
||||||
|
#undef HAVE_MEMSET
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `pow' function. */
|
||||||
|
#undef HAVE_POW
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `select' function. */
|
||||||
|
#undef HAVE_SELECT
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `sqrt' function. */
|
||||||
|
#undef HAVE_SQRT
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <stdint.h> header file. */
|
||||||
|
#undef HAVE_STDINT_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||||
|
#undef HAVE_STDLIB_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <strings.h> header file. */
|
||||||
|
#undef HAVE_STRINGS_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <string.h> header file. */
|
||||||
|
#undef HAVE_STRING_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <sys/select.h> header file. */
|
||||||
|
#undef HAVE_SYS_SELECT_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <sys/socket.h> header file. */
|
||||||
|
#undef HAVE_SYS_SOCKET_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||||
|
#undef HAVE_SYS_STAT_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||||
|
#undef HAVE_SYS_TYPES_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <unistd.h> header file. */
|
||||||
|
#undef HAVE_UNISTD_H
|
||||||
|
|
||||||
|
/* Name of package */
|
||||||
|
#undef PACKAGE
|
||||||
|
|
||||||
|
/* Define to the address where bug reports for this package should be sent. */
|
||||||
|
#undef PACKAGE_BUGREPORT
|
||||||
|
|
||||||
|
/* Define to the full name of this package. */
|
||||||
|
#undef PACKAGE_NAME
|
||||||
|
|
||||||
|
/* Define to the full name and version of this package. */
|
||||||
|
#undef PACKAGE_STRING
|
||||||
|
|
||||||
|
/* Define to the one symbol short name of this package. */
|
||||||
|
#undef PACKAGE_TARNAME
|
||||||
|
|
||||||
|
/* Define to the version of this package. */
|
||||||
|
#undef PACKAGE_VERSION
|
||||||
|
|
||||||
|
/* Define to the type of arg 1 for `select'. */
|
||||||
|
#undef SELECT_TYPE_ARG1
|
||||||
|
|
||||||
|
/* Define to the type of args 2, 3 and 4 for `select'. */
|
||||||
|
#undef SELECT_TYPE_ARG234
|
||||||
|
|
||||||
|
/* Define to the type of arg 5 for `select'. */
|
||||||
|
#undef SELECT_TYPE_ARG5
|
||||||
|
|
||||||
|
/* Define to 1 if you have the ANSI C header files. */
|
||||||
|
#undef STDC_HEADERS
|
||||||
|
|
||||||
|
/* Define to 1 if your <sys/time.h> declares `struct tm'. */
|
||||||
|
#undef TM_IN_SYS_TIME
|
||||||
|
|
||||||
|
/* Version number of package */
|
||||||
|
#undef VERSION
|
||||||
|
|
||||||
|
/* Define to rpl_malloc if the replacement function should be used. */
|
||||||
|
#undef malloc
|
||||||
|
|
||||||
|
/* Define to `unsigned' if <sys/types.h> does not define. */
|
||||||
|
#undef size_t
|
||||||
@@ -50,7 +50,7 @@ ChoiceField::Choice::Choice()
|
|||||||
: first_id(0)
|
: first_id(0)
|
||||||
{}
|
{}
|
||||||
ChoiceField::Choice::Choice(const String& name)
|
ChoiceField::Choice::Choice(const String& name)
|
||||||
: first_id(0), name(name)
|
: name(name), first_id(0)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@@ -163,9 +163,9 @@ ChoiceStyle::ChoiceStyle(const ChoiceFieldP& field)
|
|||||||
: Style(field)
|
: Style(field)
|
||||||
, popup_style(POPUP_DROPDOWN)
|
, popup_style(POPUP_DROPDOWN)
|
||||||
, render_style(RENDER_TEXT)
|
, render_style(RENDER_TEXT)
|
||||||
|
, colors_card_list(false)
|
||||||
, combine(COMBINE_NORMAL)
|
, combine(COMBINE_NORMAL)
|
||||||
, alignment(ALIGN_STRETCH)
|
, alignment(ALIGN_STRETCH)
|
||||||
, colors_card_list(false)
|
|
||||||
, thumbnails(nullptr)
|
, thumbnails(nullptr)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|||||||
@@ -37,9 +37,9 @@ void linear_blend(Image& img1, const Image& img2, double x1,double y1, double x2
|
|||||||
// d = a * (w^2 x1 dx + h^2 y1 dy)
|
// d = a * (w^2 x1 dx + h^2 y1 dy)
|
||||||
if (x1==x2 && y1==y2) throw Error(_ERROR_("coordinates for blending overlap"));
|
if (x1==x2 && y1==y2) throw Error(_ERROR_("coordinates for blending overlap"));
|
||||||
double a = fixed / (sqr(width) * sqr(x1-x2) + sqr(height) * sqr(y1-y2));
|
double a = fixed / (sqr(width) * sqr(x1-x2) + sqr(height) * sqr(y1-y2));
|
||||||
int xm = (x2 - x1) * width * a;
|
int xm = to_int( (x2 - x1) * width * a );
|
||||||
int ym = (y2 - y1) * height * a;
|
int ym = to_int( (y2 - y1) * height * a );
|
||||||
int d = - (x1 * width * xm + y1 * width * ym);
|
int d = to_int( - (x1 * width * xm + y1 * width * ym) );
|
||||||
|
|
||||||
Byte *data1 = img1.GetData(), *data2 = img2.GetData();
|
Byte *data1 = img1.GetData(), *data2 = img2.GetData();
|
||||||
// blend pixels
|
// blend pixels
|
||||||
|
|||||||
+6
-6
@@ -11,9 +11,9 @@
|
|||||||
// ----------------------------------------------------------------------------- : Color utility functions
|
// ----------------------------------------------------------------------------- : Color utility functions
|
||||||
|
|
||||||
Color lerp(const Color& a, const Color& b, double t) {
|
Color lerp(const Color& a, const Color& b, double t) {
|
||||||
return Color(a.Red() + (b.Red() - a.Red() ) * t,
|
return Color(static_cast<int>( a.Red() + (b.Red() - a.Red() ) * t ),
|
||||||
a.Green() + (b.Green() - a.Green()) * t,
|
static_cast<int>( a.Green() + (b.Green() - a.Green()) * t ),
|
||||||
a.Blue() + (b.Blue() - a.Blue() ) * t);
|
static_cast<int>( a.Blue() + (b.Blue() - a.Blue() ) * t ));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -51,8 +51,8 @@ Color saturate(const Color& c, double amount) {
|
|||||||
int r = c.Red(), g = c.Green(), b = c.Blue();
|
int r = c.Red(), g = c.Green(), b = c.Blue();
|
||||||
double l = (r + g + b) / 3;
|
double l = (r + g + b) / 3;
|
||||||
return Color(
|
return Color(
|
||||||
col((r - amount * l) / (1 - amount)),
|
col(static_cast<int>( (r - amount * l) / (1 - amount) )),
|
||||||
col((g - amount * l) / (1 - amount)),
|
col(static_cast<int>( (g - amount * l) / (1 - amount) )),
|
||||||
col((b - amount * l) / (1 - amount))
|
col(static_cast<int>( (b - amount * l) / (1 - amount) ))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,10 +88,10 @@ void downsample_to_alpha(Image& img_in, Image& img_out) {
|
|||||||
// (wc,hc) = the corner where drawing should begin, (0,0) for top-left, (1,1) for bottom-right
|
// (wc,hc) = the corner where drawing should begin, (0,0) for top-left, (1,1) for bottom-right
|
||||||
void draw_resampled_text(DC& dc, const RealRect& rect, int wc, int hc, int angle, const String& text) {
|
void draw_resampled_text(DC& dc, const RealRect& rect, int wc, int hc, int angle, const String& text) {
|
||||||
// enlarge slightly
|
// enlarge slightly
|
||||||
int w = rect.width + 1, h = rect.height + 1;
|
int w = static_cast<int>(rect.width) + 1, h = static_cast<int>(rect.height) + 1;
|
||||||
// determine sub-pixel position
|
// determine sub-pixel position
|
||||||
int xi = rect.x, yi = rect.y;
|
int xi = static_cast<int>(rect.x), yi = static_cast<int>(rect.y);
|
||||||
int xsub = text_scaling * (rect.x - xi), ysub = text_scaling * (rect.y - yi);
|
int xsub = static_cast<int>(text_scaling * (rect.x - xi)), ysub = static_cast<int>(text_scaling * (rect.y - yi));
|
||||||
// draw text
|
// draw text
|
||||||
Bitmap buffer(w * text_scaling, h * text_scaling, 24); // should be initialized to black
|
Bitmap buffer(w * text_scaling, h * text_scaling, 24); // should be initialized to black
|
||||||
wxMemoryDC mdc;
|
wxMemoryDC mdc;
|
||||||
@@ -109,6 +109,6 @@ void draw_resampled_text(DC& dc, const RealRect& rect, int wc, int hc, int angle
|
|||||||
fill_image(img_small, dc.GetTextForeground());
|
fill_image(img_small, dc.GetTextForeground());
|
||||||
downsample_to_alpha(img_large, img_small);
|
downsample_to_alpha(img_large, img_small);
|
||||||
// step 3. draw to dc
|
// step 3. draw to dc
|
||||||
dc.DrawBitmap(img_small, xi + wc * (rect.width - w), yi + hc * (rect.height - h));
|
dc.DrawBitmap(img_small, xi + static_cast<int>(wc * (rect.width - w)), yi + static_cast<int>(hc * (rect.height - h)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -46,8 +46,8 @@ class GraphAxis {
|
|||||||
GraphAxis(const String& name, bool auto_color = true, bool numeric = false)
|
GraphAxis(const String& name, bool auto_color = true, bool numeric = false)
|
||||||
: name(name)
|
: name(name)
|
||||||
, auto_color(auto_color)
|
, auto_color(auto_color)
|
||||||
, max(0)
|
|
||||||
, numeric(numeric)
|
, numeric(numeric)
|
||||||
|
, max(0)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
String name; ///< Name/label of this axis
|
String name; ///< Name/label of this axis
|
||||||
@@ -91,6 +91,7 @@ class GraphData {
|
|||||||
/** It is rendered into a sub-rectangle of the screen */
|
/** It is rendered into a sub-rectangle of the screen */
|
||||||
class Graph {
|
class Graph {
|
||||||
public:
|
public:
|
||||||
|
virtual ~Graph() {}
|
||||||
/// Draw this graph, filling the internalRect() of the dc.
|
/// Draw this graph, filling the internalRect() of the dc.
|
||||||
virtual void draw(RotatedDC& dc, const vector<int>& current) const = 0;
|
virtual void draw(RotatedDC& dc, const vector<int>& current) const = 0;
|
||||||
/// Find the item at the given position, the rectangle gives the screen size
|
/// Find the item at the given position, the rectangle gives the screen size
|
||||||
|
|||||||
@@ -90,9 +90,9 @@ void CardsPanel::initUI(wxToolBar* tb, wxMenuBar* mb) {
|
|||||||
menuCard->AppendSeparator();
|
menuCard->AppendSeparator();
|
||||||
IconMenu* menuRotate = new IconMenu();
|
IconMenu* menuRotate = new IconMenu();
|
||||||
menuRotate->Append(ID_CARD_ROTATE_0, _("TOOL_CARD_ROTATE_0"), _("&Normal"), _("Display the card with the right side up"), wxITEM_CHECK);
|
menuRotate->Append(ID_CARD_ROTATE_0, _("TOOL_CARD_ROTATE_0"), _("&Normal"), _("Display the card with the right side up"), wxITEM_CHECK);
|
||||||
menuRotate->Append(ID_CARD_ROTATE_270, _("TOOL_CARD_ROTATE_270"), _("Rotated 90° &Clockwise"), _("Display the card rotated clockwise"), wxITEM_CHECK);
|
menuRotate->Append(ID_CARD_ROTATE_270, _("TOOL_CARD_ROTATE_270"), _("Rotated 90 &Clockwise"), _("Display the card rotated clockwise"), wxITEM_CHECK);
|
||||||
menuRotate->Append(ID_CARD_ROTATE_90, _("TOOL_CARD_ROTATE_90"), _("Rotated 90° C&ounter Clockwise"), _("Display the card rotated counter-clockwise (anti-clockwise for the British)"), wxITEM_CHECK);
|
menuRotate->Append(ID_CARD_ROTATE_90, _("TOOL_CARD_ROTATE_90"), _("Rotated 90 C&ounter Clockwise"), _("Display the card rotated counter-clockwise (anti-clockwise for the British)"), wxITEM_CHECK);
|
||||||
menuRotate->Append(ID_CARD_ROTATE_180, _("TOOL_CARD_ROTATE_180"), _("Rotated 180°, &Up Side Down"), _("Display the card up side down"), wxITEM_CHECK);
|
menuRotate->Append(ID_CARD_ROTATE_180, _("TOOL_CARD_ROTATE_180"), _("Rotated 180, &Up Side Down"), _("Display the card up side down"), wxITEM_CHECK);
|
||||||
menuCard->Append(wxID_ANY, _("TOOL_CARD_ROTATE"), _("&Orientation"), _("Orientation of the card display"), wxITEM_NORMAL, menuRotate);
|
menuCard->Append(wxID_ANY, _("TOOL_CARD_ROTATE"), _("&Orientation"), _("Orientation of the card display"), wxITEM_NORMAL, menuRotate);
|
||||||
menuCard->AppendSeparator();
|
menuCard->AppendSeparator();
|
||||||
// This probably belongs in the window menu, but there we can't remove the separator once it is added
|
// This probably belongs in the window menu, but there we can't remove the separator once it is added
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ void StatCategoryList::drawItem(DC& dc, int x, int y, size_t item, bool selected
|
|||||||
RealSize size = RealSize(w,h);
|
RealSize size = RealSize(w,h);
|
||||||
RealPoint pos = align_in_rect(ALIGN_MIDDLE_LEFT, size, rect);
|
RealPoint pos = align_in_rect(ALIGN_MIDDLE_LEFT, size, rect);
|
||||||
// draw_resampled_text(dc, RealRect(pos, size), 0, 0, 0, str);
|
// draw_resampled_text(dc, RealRect(pos, size), 0, 0, 0, str);
|
||||||
dc.DrawText(str, pos.x, pos.y);
|
dc.DrawText(str, (int)pos.x, (int)pos.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------- : StatsPanel
|
// ----------------------------------------------------------------------------- : StatsPanel
|
||||||
@@ -149,7 +149,7 @@ class StatsFilter : public CardListFilter {
|
|||||||
virtual bool keep(const CardP& card) {
|
virtual bool keep(const CardP& card) {
|
||||||
Context& ctx = set.getContext(card);
|
Context& ctx = set.getContext(card);
|
||||||
FOR_EACH(v, values) {
|
FOR_EACH(v, values) {
|
||||||
if (*v.first->script.invoke(ctx) != v.second) return false;
|
if ((String)*v.first->script.invoke(ctx) != v.second) return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -12,6 +12,6 @@
|
|||||||
|
|
||||||
// what a waste of a source file...
|
// what a waste of a source file...
|
||||||
|
|
||||||
volatile LONG Age::new_age;
|
AtomicInt Age::new_age(0);
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_ARG(long, last_update_age, 0);
|
IMPLEMENT_DYNAMIC_ARG(AtomicIntEquiv, last_update_age, 0);
|
||||||
|
|||||||
+6
-2
@@ -64,6 +64,10 @@
|
|||||||
class AtomicInt {
|
class AtomicInt {
|
||||||
public:
|
public:
|
||||||
AtomicInt(AtomicIntEquiv v) : v(v) {}
|
AtomicInt(AtomicIntEquiv v) : v(v) {}
|
||||||
|
AtomicInt(const AtomicInt& i) {
|
||||||
|
wxCriticalSectionLocker lock(i.cs);
|
||||||
|
v = i.v;
|
||||||
|
}
|
||||||
inline operator AtomicIntEquiv() const {
|
inline operator AtomicIntEquiv() const {
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
@@ -78,8 +82,8 @@
|
|||||||
return --v;
|
return --v;
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
AtomicIntEquiv v; ///< The value
|
AtomicIntEquiv v; ///< The value
|
||||||
wxCriticalSection cs; ///< Critical section protecting v
|
mutable wxCriticalSection cs; ///< Critical section protecting v
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -58,10 +58,10 @@ class Defaultable {
|
|||||||
inline bool operator != (const Defaultable& that) const { return value != that.value; }
|
inline bool operator != (const Defaultable& that) const { return value != that.value; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// Is this value in the default state?
|
|
||||||
bool is_default;
|
|
||||||
/// The value
|
/// The value
|
||||||
T value;
|
T value;
|
||||||
|
/// Is this value in the default state?
|
||||||
|
bool is_default;
|
||||||
|
|
||||||
friend class Reader;
|
friend class Reader;
|
||||||
friend class Writer;
|
friend class Writer;
|
||||||
|
|||||||
@@ -31,6 +31,7 @@
|
|||||||
#define TYPEOF_RIT(Value) __typeof(Value.rbegin())
|
#define TYPEOF_RIT(Value) __typeof(Value.rbegin())
|
||||||
#define TYPEOF_CRIT(Value) __typeof(Value.rbegin())
|
#define TYPEOF_CRIT(Value) __typeof(Value.rbegin())
|
||||||
#define TYPEOF_REF(Value) __typeof(*Value.begin())&
|
#define TYPEOF_REF(Value) __typeof(*Value.begin())&
|
||||||
|
#define TYPEOF_CREF(Value) __typeof(*Value.begin())&
|
||||||
|
|
||||||
#else
|
#else
|
||||||
/// Helper for typeof tricks
|
/// Helper for typeof tricks
|
||||||
|
|||||||
+21
-5
@@ -57,17 +57,33 @@ String tr(LocaleCategory cat, const String& key);
|
|||||||
#define _ERROR_(s) tr(LOCALE_CAT_ERROR, _(s))
|
#define _ERROR_(s) tr(LOCALE_CAT_ERROR, _(s))
|
||||||
|
|
||||||
/// A localized string for menus/toolbar buttons, with 1 argument (printf style)
|
/// A localized string for menus/toolbar buttons, with 1 argument (printf style)
|
||||||
#define _MENU_1_(s,a) String::Format(tr(LOCALE_CAT_MENU, _(s)), a)
|
#define _MENU_1_(s,a) format_string(tr(LOCALE_CAT_MENU, _(s)), a)
|
||||||
|
|
||||||
/// A localized string for tooltip text, with 1 argument (printf style)
|
/// A localized string for tooltip text, with 1 argument (printf style)
|
||||||
#define _TOOL_1_(s,a) String::Format(tr(LOCALE_CAT_TOOL, _(s)), a)
|
#define _TOOL_1_(s,a) format_string(tr(LOCALE_CAT_TOOL, _(s)), a)
|
||||||
|
|
||||||
/// A localized string for error messages, with 1 argument (printf style)
|
/// A localized string for error messages, with 1 argument (printf style)
|
||||||
#define _ERROR_1_(s,a) String::Format(tr(LOCALE_CAT_ERROR, _(s)), a)
|
#define _ERROR_1_(s,a) format_string(tr(LOCALE_CAT_ERROR, _(s)), a)
|
||||||
/// A localized string for error messages, with 2 argument (printf style)
|
/// A localized string for error messages, with 2 argument (printf style)
|
||||||
#define _ERROR_2_(s,a,b) String::Format(tr(LOCALE_CAT_ERROR, _(s)), a, b)
|
#define _ERROR_2_(s,a,b) format_string(tr(LOCALE_CAT_ERROR, _(s)), a, b)
|
||||||
/// A localized string for error messages, with 3 argument (printf style)
|
/// A localized string for error messages, with 3 argument (printf style)
|
||||||
#define _ERROR_3_(s,a,b,c) String::Format(tr(LOCALE_CAT_ERROR, _(s)), a, b, c)
|
#define _ERROR_3_(s,a,b,c) format_string(tr(LOCALE_CAT_ERROR, _(s)), a, b, c)
|
||||||
|
|
||||||
|
/// Format a string
|
||||||
|
/** Equivalent to sprintf / String::Format, but allows strings to be passed as arguments (gcc)
|
||||||
|
*/
|
||||||
|
inline String format_string(const String& format, ...) {
|
||||||
|
va_list args;
|
||||||
|
va_start(args, format);
|
||||||
|
return String::Format(format, args);
|
||||||
|
va_end(args);
|
||||||
|
}
|
||||||
|
inline String format_string(const String& format, const String& a0) {
|
||||||
|
return format_string(format, a0.c_str());
|
||||||
|
}
|
||||||
|
inline String format_string(const String& format, const String& a0, const String& a1) {
|
||||||
|
return format_string(format, a0.c_str(), a1.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------- : EOF
|
// ----------------------------------------------------------------------------- : EOF
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user