Commit 5abb38f0 authored by coppro's avatar coppro

Compiled Linux version. The welcome screen doesn't display the icon images,...

Compiled Linux version. The welcome screen doesn't display the icon images, and the buttons don't work. Data is found at *prefix*/Magic Set Editor/data and the images at *prefix*/Magic Set Editor/resource. On Ubuntu, *prefix* is /usr/local/share. Resource files are all the image files from resource. I haven't configured them, because I haven't made it past the welcome screen.
parent 6c74f12d
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -10,6 +10,7 @@ AC_INIT(magicseteditor, 0.3.0, twanvl@users.sourceforge.net) ...@@ -10,6 +10,7 @@ AC_INIT(magicseteditor, 0.3.0, twanvl@users.sourceforge.net)
AC_CONFIG_SRCDIR([src/main.cpp]) AC_CONFIG_SRCDIR([src/main.cpp])
# TODO: Actually use the config header # TODO: Actually use the config header
AC_CONFIG_HEADER([src/config.h]) AC_CONFIG_HEADER([src/config.h])
CXXFLAGS = [-g3 -O0]
AM_INIT_AUTOMAKE([-Wall foreign]) AM_INIT_AUTOMAKE([-Wall foreign])
......
#!/bin/sh
# install - install a program, script, or datafile
scriptversion=2005-05-14.22
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
# following copyright and license.
#
# Copyright (C) 1994 X Consortium
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# Except as contained in this notice, the name of the X Consortium shall not
# be used in advertising or otherwise to promote the sale, use or other deal-
# ings in this Software without prior written authorization from the X Consor-
# tium.
#
#
# FSF changes to this file are in the public domain.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# `make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch. It can only install one file at a time, a restriction
# shared with many OS's install programs.
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit="${DOITPROG-}"
# put in absolute paths if you don't have them in your path; or use env. vars.
mvprog="${MVPROG-mv}"
cpprog="${CPPROG-cp}"
chmodprog="${CHMODPROG-chmod}"
chownprog="${CHOWNPROG-chown}"
chgrpprog="${CHGRPPROG-chgrp}"
stripprog="${STRIPPROG-strip}"
rmprog="${RMPROG-rm}"
mkdirprog="${MKDIRPROG-mkdir}"
chmodcmd="$chmodprog 0755"
chowncmd=
chgrpcmd=
stripcmd=
rmcmd="$rmprog -f"
mvcmd="$mvprog"
src=
dst=
dir_arg=
dstarg=
no_target_directory=
usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
or: $0 [OPTION]... SRCFILES... DIRECTORY
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
or: $0 [OPTION]... -d DIRECTORIES...
In the 1st form, copy SRCFILE to DSTFILE.
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
In the 4th, create DIRECTORIES.
Options:
-c (ignored)
-d create directories instead of installing files.
-g GROUP $chgrpprog installed files to GROUP.
-m MODE $chmodprog installed files to MODE.
-o USER $chownprog installed files to USER.
-s $stripprog installed files.
-t DIRECTORY install into DIRECTORY.
-T report an error if DSTFILE is a directory.
--help display this help and exit.
--version display version info and exit.
Environment variables override the default commands:
CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG
"
while test -n "$1"; do
case $1 in
-c) shift
continue;;
-d) dir_arg=true
shift
continue;;
-g) chgrpcmd="$chgrpprog $2"
shift
shift
continue;;
--help) echo "$usage"; exit $?;;
-m) chmodcmd="$chmodprog $2"
shift
shift
continue;;
-o) chowncmd="$chownprog $2"
shift
shift
continue;;
-s) stripcmd=$stripprog
shift
continue;;
-t) dstarg=$2
shift
shift
continue;;
-T) no_target_directory=true
shift
continue;;
--version) echo "$0 $scriptversion"; exit $?;;
*) # When -d is used, all remaining arguments are directories to create.
# When -t is used, the destination is already specified.
test -n "$dir_arg$dstarg" && break
# Otherwise, the last argument is the destination. Remove it from $@.
for arg
do
if test -n "$dstarg"; then
# $@ is not empty: it contains at least $arg.
set fnord "$@" "$dstarg"
shift # fnord
fi
shift # arg
dstarg=$arg
done
break;;
esac
done
if test -z "$1"; then
if test -z "$dir_arg"; then
echo "$0: no input file specified." >&2
exit 1
fi
# It's OK to call `install-sh -d' without argument.
# This can happen when creating conditional directories.
exit 0
fi
for src
do
# Protect names starting with `-'.
case $src in
-*) src=./$src ;;
esac
if test -n "$dir_arg"; then
dst=$src
src=
if test -d "$dst"; then
mkdircmd=:
chmodcmd=
else
mkdircmd=$mkdirprog
fi
else
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if test ! -f "$src" && test ! -d "$src"; then
echo "$0: $src does not exist." >&2
exit 1
fi
if test -z "$dstarg"; then
echo "$0: no destination specified." >&2
exit 1
fi
dst=$dstarg
# Protect names starting with `-'.
case $dst in
-*) dst=./$dst ;;
esac
# If destination is a directory, append the input filename; won't work
# if double slashes aren't ignored.
if test -d "$dst"; then
if test -n "$no_target_directory"; then
echo "$0: $dstarg: Is a directory" >&2
exit 1
fi
dst=$dst/`basename "$src"`
fi
fi
# This sed command emulates the dirname command.
dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'`
# Make sure that the destination directory exists.
# Skip lots of stat calls in the usual case.
if test ! -d "$dstdir"; then
defaultIFS='
'
IFS="${IFS-$defaultIFS}"
oIFS=$IFS
# Some sh's can't handle IFS=/ for some reason.
IFS='%'
set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
shift
IFS=$oIFS
pathcomp=
while test $# -ne 0 ; do
pathcomp=$pathcomp$1
shift
if test ! -d "$pathcomp"; then
$mkdirprog "$pathcomp"
# mkdir can fail with a `File exist' error in case several
# install-sh are creating the directory concurrently. This
# is OK.
test -d "$pathcomp" || exit
fi
pathcomp=$pathcomp/
done
fi
if test -n "$dir_arg"; then
$doit $mkdircmd "$dst" \
&& { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \
&& { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \
&& { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \
&& { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; }
else
dstfile=`basename "$dst"`
# Make a couple of temp file names in the proper directory.
dsttmp=$dstdir/_inst.$$_
rmtmp=$dstdir/_rm.$$_
# Trap to clean up those temp files at exit.
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
trap '(exit $?); exit' 1 2 13 15
# Copy the file name to the temp name.
$doit $cpprog "$src" "$dsttmp" &&
# and set any options; do chmod last to preserve setuid bits.
#
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $cpprog $src $dsttmp" command.
#
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
&& { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
&& { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
&& { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } &&
# Now rename the file to the real destination.
{ $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \
|| {
# The rename failed, perhaps because mv can't rename something else
# to itself, or perhaps because mv is so ancient that it does not
# support -f.
# Now remove or move aside any old file at destination location.
# We try this two ways since rm can't unlink itself on some
# systems and the destination file might be busy for other
# reasons. In this case, the final cleanup might fail but the new
# file should still install successfully.
{
if test -f "$dstdir/$dstfile"; then
$doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \
|| $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \
|| {
echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
(exit 1); exit 1
}
else
:
fi
} &&
# Now rename the file to the real destination.
$doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
}
}
fi || { (exit 1); exit 1; }
done
# The final little trick to "correctly" pass the exit status to the exit trap.
{
(exit 0); exit 0
}
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End:
This diff is collapsed.
...@@ -88,8 +88,8 @@ Settings::Settings() ...@@ -88,8 +88,8 @@ Settings::Settings()
, set_window_width (790) , set_window_width (790)
, set_window_height (300) , set_window_height (300)
, card_notes_height (40) , card_notes_height (40)
, check_updates (CHECK_IF_CONNECTED)
, updates_url (_("http://magicseteditor.sourceforge.net/updates")) , updates_url (_("http://magicseteditor.sourceforge.net/updates"))
, check_updates (CHECK_IF_CONNECTED)
{} {}
void Settings::addRecentFile(const String& filename) { void Settings::addRecentFile(const String& filename) {
...@@ -136,7 +136,7 @@ StyleSheetSettings& Settings::stylesheetSettingsFor(const StyleSheet& stylesheet ...@@ -136,7 +136,7 @@ StyleSheetSettings& Settings::stylesheetSettingsFor(const StyleSheet& stylesheet
/// Retrieve the directory to use for settings and other data files /// Retrieve the directory to use for settings and other data files
String user_settings_dir() { String user_settings_dir() {
String dir = wxStandardPaths::Get().GetUserDataDir(); String dir = wxStandardPaths::Get().GetUserDataDir();
if (!wxDirExists(dir)) wxMkDir(dir); if (!wxDirExists(dir)) wxMkDir(wxConvLocal.cWX2MB(dir), 0777);
return dir + _("/"); return dir + _("/");
} }
......
...@@ -63,7 +63,7 @@ void TextCtrl::setValue(String* value) { ...@@ -63,7 +63,7 @@ void TextCtrl::setValue(String* value) {
void TextCtrl::valueChanged() { void TextCtrl::valueChanged() {
if (!viewers.empty()) { if (!viewers.empty()) {
TextValue& tv = static_cast<TextValue&>(*viewers.front()->getValue()); TextValue& tv = static_cast<TextValue&>(*viewers.front()->getValue());
tv.value.assign(value ? *value : wxEmptyString); tv.value.assign(value ? String(*value) : String(wxEmptyString));
viewers.front()->onValueChange(); viewers.front()->onValueChange();
} }
onChange(); onChange();
......
...@@ -6,7 +6,8 @@ ...@@ -6,7 +6,8 @@
// ----------------------------------------------------------------------------- : Includes // ----------------------------------------------------------------------------- : Includes
#include "icon_menu.hpp" #include <gui/icon_menu.hpp>
#include <gui/util.hpp>
// ----------------------------------------------------------------------------- : generateDisabledImage // ----------------------------------------------------------------------------- : generateDisabledImage
...@@ -57,12 +58,14 @@ void IconMenu::Append(int id, const String& resource, const String& text, const ...@@ -57,12 +58,14 @@ void IconMenu::Append(int id, const String& resource, const String& text, const
item->SetBitmaps(bitmap, bitmap); item->SetBitmaps(bitmap, bitmap);
item->SetDisabledBitmap(disabledImage); item->SetDisabledBitmap(disabledImage);
wxMenu::Append(item); wxMenu::Append(item);
#else #else
// load bitmap
Bitmap bitmap = loadResourceImage(resource); // load bitmap
Bitmap bitmap = load_resource_image(resource);
// add menu // add menu
wxMenuItem* item = new wxMenuItem(this, id, text, help, style, submenu); wxMenuItem* item = new wxMenuItem(this, id, text, help, style, submenu);
item->SetBitmaps(bitmap); item->SetBitmap(bitmap);
wxMenu::Append(item); wxMenu::Append(item);
#endif #endif
} }
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include <gui/symbol/point_editor.hpp> #include <gui/symbol/point_editor.hpp>
#include <gui/symbol/window.hpp> #include <gui/symbol/window.hpp>
#include <gui/util.hpp>
#include <gfx/bezier.hpp> #include <gfx/bezier.hpp>
#include <data/action/symbol_part.hpp> #include <data/action/symbol_part.hpp>
#include <util/window_id.hpp> #include <util/window_id.hpp>
...@@ -23,10 +24,10 @@ SymbolPointEditor::SymbolPointEditor(SymbolControl* control, const SymbolPartP& ...@@ -23,10 +24,10 @@ SymbolPointEditor::SymbolPointEditor(SymbolControl* control, const SymbolPartP&
, selection(SELECTED_NONE) , selection(SELECTED_NONE)
, hovering(SELECTED_NONE) , hovering(SELECTED_NONE)
// Load gui stock // Load gui stock
, pointSelect(_("CUR_POINT"), wxBITMAP_TYPE_CUR_RESOURCE) , pointSelect(load_resource_image(_("CUR_POINT")))
, pointAdd (_("CUR_POINT_ADD"), wxBITMAP_TYPE_CUR_RESOURCE) , pointAdd (load_resource_image(_("CUR_POINT_ADD")))
, pointCurve (_("CUR_POINT_CURVE"),wxBITMAP_TYPE_CUR_RESOURCE) , pointCurve (load_resource_image(_("CUR_POINT_CURVE")))
, pointMove (_("CUR_POINT_MOVE"), wxBITMAP_TYPE_CUR_RESOURCE) , pointMove (load_resource_image(_("CUR_POINT_MOVE")))
{ {
resetActions(); resetActions();
// // fix pen joins // // fix pen joins
...@@ -526,6 +527,6 @@ SelectedHandle SymbolPointEditor::findHandle(const Vector2D& pos) { ...@@ -526,6 +527,6 @@ SelectedHandle SymbolPointEditor::findHandle(const Vector2D& pos) {
} }
bool SymbolPointEditor::inRange(const Vector2D& a, const Vector2D& b, double range) { bool SymbolPointEditor::inRange(const Vector2D& a, const Vector2D& b, double range) {
return abs(a.x - b.x) <= range && return fabs(a.x - b.x) <= range &&
abs(a.y - b.y) <= range; fabs(a.y - b.y) <= range;
} }
...@@ -20,9 +20,9 @@ DECLARE_TYPEOF_COLLECTION(SymbolPartP); ...@@ -20,9 +20,9 @@ DECLARE_TYPEOF_COLLECTION(SymbolPartP);
SymbolSelectEditor::SymbolSelectEditor(SymbolControl* control, bool rotate) SymbolSelectEditor::SymbolSelectEditor(SymbolControl* control, bool rotate)
: SymbolEditorBase(control) : SymbolEditorBase(control)
, rotate(rotate) , rotate(rotate)
, cursorRotate(_("CUR_ROTATE"), wxBITMAP_TYPE_CUR_RESOURCE) , cursorRotate(load_resource_image(_("CUR_ROTATE")))
, cursorShearX(_("CUR_SHEAR_X"), wxBITMAP_TYPE_CUR_RESOURCE) , cursorShearX(load_resource_image(_("CUR_SHEAR_X")))
, cursorShearY(_("CUR_SHEAR_Y"), wxBITMAP_TYPE_CUR_RESOURCE) , cursorShearY(load_resource_image(_("CUR_SHEAR_Y")))
{ {
// Load resource images // Load resource images
Image rot = load_resource_image(_("HANDLE_ROTATE")); Image rot = load_resource_image(_("HANDLE_ROTATE"));
......
...@@ -17,7 +17,7 @@ DECLARE_TYPEOF_COLLECTION(pair_ThumbnailRequestP_Image); ...@@ -17,7 +17,7 @@ DECLARE_TYPEOF_COLLECTION(pair_ThumbnailRequestP_Image);
String user_settings_dir(); String user_settings_dir();
String image_cache_dir() { String image_cache_dir() {
String dir = user_settings_dir() + _("/cache"); String dir = user_settings_dir() + _("/cache");
if (!wxDirExists(dir)) wxMkDir(dir); if (!wxDirExists(dir)) wxMkDir(wxConvLocal.cWX2MB(dir), 0777);
return dir + _("/"); return dir + _("/");
} }
......
...@@ -9,13 +9,14 @@ ...@@ -9,13 +9,14 @@
#include <gui/util.hpp> #include <gui/util.hpp>
#include <util/error.hpp> #include <util/error.hpp>
#include <util/rotation.hpp> #include <util/rotation.hpp>
#include <wx/mstream.h>
#include <wx/renderer.h> #include <wx/renderer.h>
#include <wx/stdpaths.h>
#if wxUSE_UXTHEME && defined(__WXMSW__) #if wxUSE_UXTHEME && defined(__WXMSW__)
#include <wx/msw/uxtheme.h> #include <wx/msw/uxtheme.h>
#include <tmschema.h> #include <tmschema.h>
#include <shlobj.h> #include <shlobj.h>
#include <wx/mstream.h>
#endif #endif
// ----------------------------------------------------------------------------- : Window related // ----------------------------------------------------------------------------- : Window related
...@@ -71,7 +72,7 @@ void draw_checker(RotatedDC& dc, const RealRect& rect) { ...@@ -71,7 +72,7 @@ void draw_checker(RotatedDC& dc, const RealRect& rect) {
// ----------------------------------------------------------------------------- : Image related // ----------------------------------------------------------------------------- : Image related
Image load_resource_image(const String& name) { Image load_resource_image(const String& name) {
#ifdef __WXMSW__ #if defined(__WXMSW__)
// Load resource // Load resource
// based on wxLoadUserResource // based on wxLoadUserResource
// The image can be in an IMAGE resource, in any file format // The image can be in an IMAGE resource, in any file format
...@@ -87,6 +88,17 @@ Image load_resource_image(const String& name) { ...@@ -87,6 +88,17 @@ Image load_resource_image(const String& name) {
int len = ::SizeofResource(wxGetInstance(), hResource); int len = ::SizeofResource(wxGetInstance(), hResource);
wxMemoryInputStream stream(data, len); wxMemoryInputStream stream(data, len);
return wxImage(stream); return wxImage(stream);
#elif defined(__linux__)
static String path = wxStandardPaths::Get().GetDataDir() + _("/resource/");
String file = path + name.Lower();
wxImage resource (file + _(".png"), wxBITMAP_TYPE_PNG);
if (!resource.Ok()) resource.LoadFile (file + _(".bmp"), wxBITMAP_TYPE_BMP);
if (!resource.Ok()) resource.LoadFile (file + _(".ico"), wxBITMAP_TYPE_ICO);
if (!resource.Ok()) resource.LoadFile (file + _(".cur"), wxBITMAP_TYPE_CUR);
if (!resource.Ok()) throw InternalError(String::Format(_("Resource not found: %s"), name.c_str()));
return resource;
#else
#error Handling of resource loading needs to be declared.
#endif #endif
} }
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
// ----------------------------------------------------------------------------- : Includes // ----------------------------------------------------------------------------- : Includes
#include <gui/value/text.hpp> #include <gui/value/text.hpp>
#include <gui/util.hpp>
#include <data/action/value.hpp> #include <data/action/value.hpp>
#include <util/tagged_string.hpp> #include <util/tagged_string.hpp>
#include <util/window_id.hpp> #include <util/window_id.hpp>
...@@ -258,7 +259,7 @@ wxCursor rotated_ibeam; ...@@ -258,7 +259,7 @@ wxCursor rotated_ibeam;
wxCursor TextValueEditor::cursor() const { wxCursor TextValueEditor::cursor() const {
if (viewer.getRotation().sideways() ^ style().getRotation().sideways()) { // 90 or 270 degrees if (viewer.getRotation().sideways() ^ style().getRotation().sideways()) { // 90 or 270 degrees
if (!rotated_ibeam.Ok()) { if (!rotated_ibeam.Ok()) {
rotated_ibeam = wxCursor(_("CUR_ROT_IBEAM")); rotated_ibeam = wxCursor(load_resource_image(_("CUR_ROT_IBEAM")));
} }
return rotated_ibeam; return rotated_ibeam;
} else { } else {
......
...@@ -26,12 +26,12 @@ WelcomeWindow::WelcomeWindow() ...@@ -26,12 +26,12 @@ WelcomeWindow::WelcomeWindow()
SetIcon(wxIcon(_("ICON_APP"))); SetIcon(wxIcon(_("ICON_APP")));
// init controls // init controls
wxButton* new_set = new HoverButtonExt(this, ID_FILE_NEW, _("WELCOME_NEW"), _BUTTON_("new set"), _HELP_("new set")); wxButton* new_set = new HoverButtonExt(this, ID_FILE_NEW, load_resource_image(_("WELCOME_NEW")), _BUTTON_("new set"), _HELP_("new set"));
wxButton* open_set = new HoverButtonExt(this, ID_FILE_OPEN, _("WELCOME_OPEN"), _BUTTON_("open set"), _HELP_("open set")); wxButton* open_set = new HoverButtonExt(this, ID_FILE_OPEN, load_resource_image(_("WELCOME_OPEN")), _BUTTON_("open set"), _HELP_("open set"));
wxButton* open_last = 0; wxButton* open_last = 0;
if (!settings.recent_sets.empty()) { if (!settings.recent_sets.empty()) {
wxFileName n(settings.recent_sets.front()); wxFileName n(settings.recent_sets.front());
open_last = new HoverButtonExt(this, ID_FILE_RECENT, _("WELCOME_LAST"), _BUTTON_("last opened set"), _("Open '") + n.GetName() + _("'")); open_last = new HoverButtonExt(this, ID_FILE_RECENT, load_resource_image(_("WELCOME_LAST")), _BUTTON_("last opened set"), _("Open '") + n.GetName() + _("'"));
} }
wxSizer* s1 = new wxBoxSizer(wxHORIZONTAL); wxSizer* s1 = new wxBoxSizer(wxHORIZONTAL);
...@@ -105,19 +105,20 @@ END_EVENT_TABLE () ...@@ -105,19 +105,20 @@ END_EVENT_TABLE ()
// ----------------------------------------------------------------------------- : Hover button with label // ----------------------------------------------------------------------------- : Hover button with label
HoverButtonExt::HoverButtonExt(Window* parent, int id, const String& icon_name, const String& label, const String& sub_label) HoverButtonExt::HoverButtonExt(Window* parent, int id, const wxImage& icon, const String& label, const String& sub_label)
: HoverButton(parent, id, _("BTN")) : HoverButton(parent, id, _("BTN"))
, icon(load_resource_image(icon_name)) , icon(icon)
, label(label), sub_label(sub_label) , label(label), sub_label(sub_label)
, font_large(14, wxSWISS, wxNORMAL, wxNORMAL, false, _("Arial")) , font_large(14, wxSWISS, wxNORMAL, wxNORMAL, false, _("Arial"))
, font_small(8, wxSWISS, wxNORMAL, wxNORMAL, false, _("Arial")) , font_small(8, wxSWISS, wxNORMAL, wxNORMAL, false, _("Arial"))
{} {}
void HoverButtonExt::draw(DC& dc) { void HoverButtonExt::draw(DC& dc) {
handle_error(Error(_("HEYA")));
// draw button // draw button
HoverButton::draw(dc); HoverButton::draw(dc);
// icon // icon
if (icon.Ok()) dc.DrawBitmap(icon, 7, 7); if (icon.Ok()) dc.DrawBitmap(icon, 7, 7); else handle_error(Error(_("Error drawing button bitmaps")));
// text // text
dc.SetTextForeground(*wxBLACK); dc.SetTextForeground(*wxBLACK);
dc.SetFont(font_large); dc.SetFont(font_large);
......
...@@ -51,7 +51,7 @@ class WelcomeWindow : public Frame { ...@@ -51,7 +51,7 @@ class WelcomeWindow : public Frame {
/// An extended hover button, not only has base images, but also has two labels /// An extended hover button, not only has base images, but also has two labels
class HoverButtonExt : public HoverButton { class HoverButtonExt : public HoverButton {
public: public:
HoverButtonExt(Window* parent, int id, const String& icon_name, const String& label, const String& sub_label); HoverButtonExt(Window* parent, int id, const wxImage& icon_name, const String& label, const String& sub_label);
private: private:
Bitmap icon; Bitmap icon;
......
...@@ -392,8 +392,8 @@ bool equal(const ScriptValue& a, const ScriptValue& b) { ...@@ -392,8 +392,8 @@ bool equal(const ScriptValue& a, const ScriptValue& b) {
// HACK for ScriptObject<shared_ptr<X> > // HACK for ScriptObject<shared_ptr<X> >
// assumes different types are layed out the same, and that // assumes different types are layed out the same, and that
// should be void*, but then we need getMember for void // should be void*, but then we need getMember for void
const ScriptObject<int*>& av = reinterpret_cast<const ScriptObject<int*>&>(a); const ScriptObject<int*>& av = dynamic_cast<const ScriptObject<int*>&>(a);
const ScriptObject<int*>& bv = reinterpret_cast<const ScriptObject<int*>&>(b); const ScriptObject<int*>& bv = dynamic_cast<const ScriptObject<int*>&>(b);
return av.getValue() == bv.getValue(); return av.getValue() == bv.getValue();
} }
return &a == &b; return &a == &b;
...@@ -565,7 +565,7 @@ ScriptValueP ScriptBuildin_combined_editor::dependencies(Context& ctx, const Dep ...@@ -565,7 +565,7 @@ ScriptValueP ScriptBuildin_combined_editor::dependencies(Context& ctx, const Dep
} }
} }
} }
SCRIPT_RETURN(dependency_dummy); return dependency_dummy;
} }
......
...@@ -64,22 +64,22 @@ void Script::addInstruction(InstructionType t) { ...@@ -64,22 +64,22 @@ void Script::addInstruction(InstructionType t) {
// // optimize: push x ; member_v --> member x // // optimize: push x ; member_v --> member x
// instructions.back().instr = I_MEMBER; // instructions.back().instr = I_MEMBER;
//} else { //} else {
Instruction i = {t, 0}; Instruction i = {t, {0}};
instructions.push_back(i); instructions.push_back(i);
//} //}
} }
void Script::addInstruction(InstructionType t, unsigned int d) { void Script::addInstruction(InstructionType t, unsigned int d) {
Instruction i = {t, d}; Instruction i = {t, {d}};
instructions.push_back(i); instructions.push_back(i);
} }
void Script::addInstruction(InstructionType t, const ScriptValueP& c) { void Script::addInstruction(InstructionType t, const ScriptValueP& c) {
constants.push_back(c); constants.push_back(c);
Instruction i = {t, (unsigned int)constants.size() - 1}; Instruction i = {t, {(unsigned int)constants.size() - 1}};
instructions.push_back(i); instructions.push_back(i);
} }
void Script::addInstruction(InstructionType t, const String& s) { void Script::addInstruction(InstructionType t, const String& s) {
constants.push_back(toScript(s)); constants.push_back(toScript(s));
Instruction i = {t, (unsigned int)constants.size() - 1}; Instruction i = {t, {(unsigned int)constants.size() - 1}};
instructions.push_back(i); instructions.push_back(i);
} }
......
...@@ -132,7 +132,6 @@ class Scriptable { ...@@ -132,7 +132,6 @@ class Scriptable {
DECLARE_REFLECTION(); DECLARE_REFLECTION();
}; };
// we need some custom io, because the behaviour is different for each of Reader/Writer/GetMember // we need some custom io, because the behaviour is different for each of Reader/Writer/GetMember
template <typename T> template <typename T>
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include <util/prec.hpp> #include <util/prec.hpp>
#include <util/reflect.hpp> #include <util/reflect.hpp>
#include <util/error.hpp> #include <util/error.hpp>
#include <util/io/get_member.hpp>
class Context; class Context;
class Dependency; class Dependency;
......
...@@ -11,9 +11,9 @@ ...@@ -11,9 +11,9 @@
#include <script/value.hpp> #include <script/value.hpp>
#include <script/script.hpp> #include <script/script.hpp>
// ----------------------------------------------------------------------------- : GetDefaultMember // ---------------------------------------------------------------------------- : GetDefaultMember
template <> void GetDefaultMember::handle(const Char* const& v) { value = toScript(v); } void GetDefaultMember::handle(const Char* v) { value = toScript(v); }
template <> void GetDefaultMember::handle(const String& v) { value = toScript(v); } template <> void GetDefaultMember::handle(const String& v) { value = toScript(v); }
template <> void GetDefaultMember::handle(const FileName& v) { value = toScript(v); } template <> void GetDefaultMember::handle(const FileName& v) { value = toScript(v); }
template <> void GetDefaultMember::handle(const int& v) { value = toScript(v); } template <> void GetDefaultMember::handle(const int& v) { value = toScript(v); }
......
...@@ -10,7 +10,9 @@ ...@@ -10,7 +10,9 @@
// ----------------------------------------------------------------------------- : Includes // ----------------------------------------------------------------------------- : Includes
#include <util/prec.hpp> #include <util/prec.hpp>
#include <script/value.hpp>
class Script;
class ScriptValue;
DECLARE_INTRUSIVE_POINTER_TYPE(ScriptValue); DECLARE_INTRUSIVE_POINTER_TYPE(ScriptValue);
DECLARE_INTRUSIVE_POINTER_TYPE(Script); DECLARE_INTRUSIVE_POINTER_TYPE(Script);
...@@ -39,13 +41,14 @@ class GetDefaultMember { ...@@ -39,13 +41,14 @@ class GetDefaultMember {
/// Handle an object: we don't match things with a name /// Handle an object: we don't match things with a name
template <typename T> template <typename T>
void handle(const Char* name, const T& object) {} void handle(const Char* name, const T& object) {}
/// Handle an object: investigate children, or store it if we know how /// Handle an object: investigate children, or store it if we know how
void handle(const Char *);
template <typename T> void handle(const T&); template <typename T> void handle(const T&);
/// Handle a Defaultable: investigate children /// Handle a Defaultable: investigate children
template <typename T> void handle(const Defaultable<T>&); template <typename T> void handle(const Defaultable<T>&);
template <typename T> void handle(const Scriptable<T>&); template <typename T> void handle(const Scriptable<T>& );
template <typename T> void handle(const vector<T>& c) { value = toScript(&c); } template <typename T> void handle(const vector<T>& c) { value = toScript(&c); }
template <typename K, typename V> void handle(const map<K,V>& c) { value = toScript(&c); } template <typename K, typename V> void handle(const map<K,V>& c) { value = toScript(&c); }
template <typename K, typename V> void handle(const IndexMap<K,V>& c) { value = toScript(&c); } template <typename K, typename V> void handle(const IndexMap<K,V>& c) { value = toScript(&c); }
......
...@@ -137,7 +137,7 @@ inline shared_ptr<T> new_shared7(const A0& a0, const A1& a1, const A2& a2, const ...@@ -137,7 +137,7 @@ inline shared_ptr<T> new_shared7(const A0& a0, const A1& a1, const A2& a2, const
class IntrusivePtrBase { class IntrusivePtrBase {
public: public:
virtual ~IntrusivePtrBase(); virtual ~IntrusivePtrBase() {};
protected: protected:
/// Delete this object /// Delete this object
virtual void destroy() { virtual void destroy() {
......
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