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.

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@188 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
coppro
2007-01-30 04:03:22 +00:00
parent 27d5b2c94b
commit 28bcb1068c
23 changed files with 5206 additions and 2623 deletions
+1 -1
View File
@@ -63,7 +63,7 @@ void TextCtrl::setValue(String* value) {
void TextCtrl::valueChanged() {
if (!viewers.empty()) {
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();
}
onChange();
+8 -5
View File
@@ -6,7 +6,8 @@
// ----------------------------------------------------------------------------- : Includes
#include "icon_menu.hpp"
#include <gui/icon_menu.hpp>
#include <gui/util.hpp>
// ----------------------------------------------------------------------------- : generateDisabledImage
@@ -57,12 +58,14 @@ void IconMenu::Append(int id, const String& resource, const String& text, const
item->SetBitmaps(bitmap, bitmap);
item->SetDisabledBitmap(disabledImage);
wxMenu::Append(item);
#else
// load bitmap
#else
// load bitmap
Bitmap bitmap = load_resource_image(resource);
// add menu
wxMenuItem* item = new wxMenuItem(this, id, text, help, style, submenu);
// add menu
item->SetBitmap(bitmap);
wxMenu::Append(item);
#endif
}
+7 -6
View File
@@ -8,6 +8,7 @@
#include <gui/symbol/point_editor.hpp>
#include <gui/symbol/window.hpp>
#include <gui/util.hpp>
#include <gfx/bezier.hpp>
#include <data/action/symbol_part.hpp>
#include <util/window_id.hpp>
@@ -23,10 +24,10 @@ SymbolPointEditor::SymbolPointEditor(SymbolControl* control, const SymbolPartP&
, selection(SELECTED_NONE)
, hovering(SELECTED_NONE)
// Load gui stock
, pointSelect(_("CUR_POINT"), wxBITMAP_TYPE_CUR_RESOURCE)
, pointAdd (_("CUR_POINT_ADD"), wxBITMAP_TYPE_CUR_RESOURCE)
, pointCurve (_("CUR_POINT_CURVE"),wxBITMAP_TYPE_CUR_RESOURCE)
, pointMove (_("CUR_POINT_MOVE"), wxBITMAP_TYPE_CUR_RESOURCE)
, pointSelect(load_resource_image(_("CUR_POINT")))
, pointAdd (load_resource_image(_("CUR_POINT_ADD")))
, pointCurve (load_resource_image(_("CUR_POINT_CURVE")))
, pointMove (load_resource_image(_("CUR_POINT_MOVE")))
{
resetActions();
// // fix pen joins
@@ -526,6 +527,6 @@ SelectedHandle SymbolPointEditor::findHandle(const Vector2D& pos) {
}
bool SymbolPointEditor::inRange(const Vector2D& a, const Vector2D& b, double range) {
return abs(a.x - b.x) <= range &&
abs(a.y - b.y) <= range;
return fabs(a.x - b.x) <= range &&
fabs(a.y - b.y) <= range;
}
+3 -3
View File
@@ -20,9 +20,9 @@ DECLARE_TYPEOF_COLLECTION(SymbolPartP);
SymbolSelectEditor::SymbolSelectEditor(SymbolControl* control, bool rotate)
: SymbolEditorBase(control)
, rotate(rotate)
, cursorRotate(_("CUR_ROTATE"), wxBITMAP_TYPE_CUR_RESOURCE)
, cursorShearX(_("CUR_SHEAR_X"), wxBITMAP_TYPE_CUR_RESOURCE)
, cursorShearY(_("CUR_SHEAR_Y"), wxBITMAP_TYPE_CUR_RESOURCE)
, cursorRotate(load_resource_image(_("CUR_ROTATE")))
, cursorShearX(load_resource_image(_("CUR_SHEAR_X")))
, cursorShearY(load_resource_image(_("CUR_SHEAR_Y")))
{
// Load resource images
Image rot = load_resource_image(_("HANDLE_ROTATE"));
+1 -1
View File
@@ -17,7 +17,7 @@ DECLARE_TYPEOF_COLLECTION(pair_ThumbnailRequestP_Image);
String user_settings_dir();
String image_cache_dir() {
String dir = user_settings_dir() + _("/cache");
if (!wxDirExists(dir)) wxMkDir(dir);
if (!wxDirExists(dir)) wxMkDir(wxConvLocal.cWX2MB(dir), 0777);
return dir + _("/");
}
+14 -2
View File
@@ -9,13 +9,14 @@
#include <gui/util.hpp>
#include <util/error.hpp>
#include <util/rotation.hpp>
#include <wx/mstream.h>
#include <wx/renderer.h>
#include <wx/stdpaths.h>
#if wxUSE_UXTHEME && defined(__WXMSW__)
#include <wx/msw/uxtheme.h>
#include <tmschema.h>
#include <shlobj.h>
#include <wx/mstream.h>
#endif
// ----------------------------------------------------------------------------- : Window related
@@ -71,7 +72,7 @@ void draw_checker(RotatedDC& dc, const RealRect& rect) {
// ----------------------------------------------------------------------------- : Image related
Image load_resource_image(const String& name) {
#ifdef __WXMSW__
#if defined(__WXMSW__)
// Load resource
// based on wxLoadUserResource
// The image can be in an IMAGE resource, in any file format
@@ -87,6 +88,17 @@ Image load_resource_image(const String& name) {
int len = ::SizeofResource(wxGetInstance(), hResource);
wxMemoryInputStream stream(data, len);
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
}
+2 -1
View File
@@ -7,6 +7,7 @@
// ----------------------------------------------------------------------------- : Includes
#include <gui/value/text.hpp>
#include <gui/util.hpp>
#include <data/action/value.hpp>
#include <util/tagged_string.hpp>
#include <util/window_id.hpp>
@@ -258,7 +259,7 @@ wxCursor rotated_ibeam;
wxCursor TextValueEditor::cursor() const {
if (viewer.getRotation().sideways() ^ style().getRotation().sideways()) { // 90 or 270 degrees
if (!rotated_ibeam.Ok()) {
rotated_ibeam = wxCursor(_("CUR_ROT_IBEAM"));
rotated_ibeam = wxCursor(load_resource_image(_("CUR_ROT_IBEAM")));
}
return rotated_ibeam;
} else {
+7 -6
View File
@@ -26,12 +26,12 @@ WelcomeWindow::WelcomeWindow()
SetIcon(wxIcon(_("ICON_APP")));
// init controls
wxButton* new_set = new HoverButtonExt(this, ID_FILE_NEW, _("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* 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, load_resource_image(_("WELCOME_OPEN")), _BUTTON_("open set"), _HELP_("open set"));
wxButton* open_last = 0;
if (!settings.recent_sets.empty()) {
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);
@@ -105,19 +105,20 @@ END_EVENT_TABLE ()
// ----------------------------------------------------------------------------- : 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"))
, icon(load_resource_image(icon_name))
, icon(icon)
, label(label), sub_label(sub_label)
, font_large(14, wxSWISS, wxNORMAL, wxNORMAL, false, _("Arial"))
, font_small(8, wxSWISS, wxNORMAL, wxNORMAL, false, _("Arial"))
{}
void HoverButtonExt::draw(DC& dc) {
handle_error(Error(_("HEYA")));
// draw button
HoverButton::draw(dc);
// 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
dc.SetTextForeground(*wxBLACK);
dc.SetFont(font_large);
+1 -1
View File
@@ -51,7 +51,7 @@ class WelcomeWindow : public Frame {
/// An extended hover button, not only has base images, but also has two labels
class HoverButtonExt : public HoverButton {
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:
Bitmap icon;