mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 13:06:59 -04:00
CMake file
Update to C++ 11: std::shared_ptr, for each loops Update to wxWidgets 3.0+
This commit is contained in:
@@ -50,7 +50,7 @@ void AboutWindow::draw(DC& dc) {
|
||||
dc.SetTextBackground(Color(114,197,224));
|
||||
dc.SetTextForeground(Color(0,0,0));
|
||||
// draw version info
|
||||
dc.SetFont(wxFont(9, wxSWISS, wxNORMAL, wxNORMAL, false, _("Arial")));
|
||||
dc.SetFont(wxFont(9, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, _("Arial")));
|
||||
dc.DrawText(_("Version: ") + app_version.toString() + version_suffix, 34, 110);
|
||||
dc.DrawText(_("Copyright \xA9 2001-2011"), 34, 130);
|
||||
dc.DrawText(_(" Twan van Laarhoven,"), 34, 147);
|
||||
|
||||
@@ -258,11 +258,11 @@ void AutoReplaceWindow::refreshItem() {
|
||||
in_event = true;
|
||||
AutoReplaceP ar = list->getSelected();
|
||||
match ->Enable(ar && ar->custom);
|
||||
replace ->Enable(ar);
|
||||
replace ->Enable((bool)ar);
|
||||
matchL ->Enable(ar && ar->custom);
|
||||
replaceL ->Enable(ar);
|
||||
enabled ->Enable(ar);
|
||||
whole_word->Enable(ar);
|
||||
replaceL ->Enable((bool)ar);
|
||||
enabled ->Enable((bool)ar);
|
||||
whole_word->Enable((bool)ar);
|
||||
remove ->Enable(ar && ar->custom);
|
||||
if (ar) {
|
||||
match ->SetValue(ar->match);
|
||||
|
||||
@@ -956,7 +956,7 @@ void GraphValueAxis::draw(RotatedDC& dc, int current, DrawLayer layer) const {
|
||||
// highlight?
|
||||
if (i == highlight) {
|
||||
wxFont font(*wxNORMAL_FONT);
|
||||
font.SetWeight(wxBOLD);
|
||||
font.SetWeight(wxFONTWEIGHT_BOLD);
|
||||
dc.SetFont(font);
|
||||
dc.SetPen(fg);
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ void PackageList::drawItem(DC& dc, int x, int y, size_t item) {
|
||||
dc.DrawBitmap(d.image, x + int(align_delta_x(ALIGN_CENTER, item_size.x, d.image.GetWidth())), y + 3, true);
|
||||
}
|
||||
// draw short name
|
||||
dc.SetFont(wxFont(12,wxSWISS,wxNORMAL,wxBOLD,false,_("Arial")));
|
||||
dc.SetFont(wxFont(12,wxFONTFAMILY_SWISS,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_BOLD,false,_("Arial")));
|
||||
dc.GetTextExtent(capitalize(d.package->short_name), &w, &h);
|
||||
pos = align_in_rect(ALIGN_CENTER, RealSize(w,h), rect);
|
||||
dc.DrawText(capitalize(d.package->short_name), max(x+1,(int)pos.x), (int)pos.y + 110);
|
||||
|
||||
@@ -42,14 +42,15 @@ void PackageUpdateList::TreeItem::add(const InstallablePackageP& package, const
|
||||
String name = path.substr(0,pos);
|
||||
String rest = pos == String::npos ? _("") : path.substr(pos+1);
|
||||
// find/add child
|
||||
FOR_EACH(ti, children) {
|
||||
for (auto it = children.begin() ; it != children.end() ; ++it) {
|
||||
auto const& ti = *it;
|
||||
if (ti->label == name) {
|
||||
// already have this child
|
||||
if (pos == String::npos && ti->package) {
|
||||
// two packages with the same path
|
||||
TreeItemP ti2(new TreeItem);
|
||||
ti2->label = name;
|
||||
children.insert(ti_IT.first, ti2);
|
||||
children.insert(it, ti2);
|
||||
ti2->add(package, rest, level + 1);
|
||||
} else {
|
||||
ti->add(package, rest, level + 1);
|
||||
|
||||
@@ -125,7 +125,7 @@ void StylePanel::onAction(const Action& action, bool undone) {
|
||||
}
|
||||
}
|
||||
use_for_all->Enable(card && card->stylesheet);
|
||||
use_custom_options->Enable(card);
|
||||
use_custom_options->Enable((bool)card);
|
||||
use_custom_options->SetValue(card ? card->has_styling : false);
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ void StylePanel::selectCard(const CardP& card) {
|
||||
editor->showCard(card);
|
||||
list->select(set->stylesheetFor(card).name(), false);
|
||||
use_for_all->Enable(card && card->stylesheet);
|
||||
use_custom_options->Enable(card);
|
||||
use_custom_options->Enable((bool)card);
|
||||
use_custom_options->SetValue(card ? card->has_styling : false);
|
||||
}
|
||||
|
||||
|
||||
@@ -278,7 +278,7 @@ void SymbolControl::onUpdateUI(wxUpdateUIEvent& ev) {
|
||||
ev.Check(editor->modeToolId() == ev.GetId());
|
||||
if (ev.GetId() == ID_MODE_POINTS) {
|
||||
// can only edit points when a shape is available
|
||||
ev.Enable(selected_parts.getAShape());
|
||||
ev.Enable((bool)selected_parts.getAShape());
|
||||
}
|
||||
if (ev.GetId() == ID_MODE_SYMMETRY) {
|
||||
ev.Enable(!selected_parts.empty());
|
||||
|
||||
@@ -146,7 +146,7 @@ wxPen SymbolPointEditor::handlePen(WhichPen p, LockMode lock) {
|
||||
switch(p) {
|
||||
case PEN_NORMAL: return wxPen(col);
|
||||
case PEN_HOVER: return wxPen(col, 2);
|
||||
case PEN_LINE: return wxPen(col, 1, wxDOT);
|
||||
case PEN_LINE: return wxPen(col, 1, wxPENSTYLE_DOT);
|
||||
default: throw InternalError(_("SymbolPointEditor::handlePen"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ void SymbolSelectEditor::draw(DC& dc) {
|
||||
if (click_mode == CLICK_RECT) {
|
||||
// draw selection rectangle
|
||||
dc.SetBrush(*wxTRANSPARENT_BRUSH);
|
||||
dc.SetPen(wxPen(*wxCYAN,1,wxDOT));
|
||||
dc.SetPen(wxPen(*wxCYAN,1,wxPENSTYLE_DOT));
|
||||
//% TODO: use RotatedDC?
|
||||
RealRect rect = control.rotation.trRectToBB(RealRect(selection_rect_a, RealSize(selection_rect_b - selection_rect_a)));
|
||||
dc.DrawRectangle(rect);
|
||||
|
||||
@@ -37,7 +37,7 @@ void SymbolSymmetryEditor::draw(DC& dc) {
|
||||
Vector2D handle = control.rotation.tr(symmetry->center + symmetry->handle);
|
||||
if (symmetry->kind == SYMMETRY_REFLECTION) {
|
||||
// draw line to handle
|
||||
dc.SetPen(wxPen(color,1,wxDOT));
|
||||
dc.SetPen(wxPen(color,1,wxPENSTYLE_DOT));
|
||||
dc.DrawLine(int(center.x), int(center.y), int(handle.x), int(handle.y));
|
||||
// draw handle
|
||||
dc.SetPen(*wxBLACK_PEN);
|
||||
@@ -87,17 +87,17 @@ void SymbolSymmetryEditor::destroyUI(wxToolBar* tb, wxMenuBar* mb) {
|
||||
|
||||
void SymbolSymmetryEditor::onUpdateUI(wxUpdateUIEvent& ev) {
|
||||
if (ev.GetId() >= ID_SYMMETRY && ev.GetId() < ID_SYMMETRY_MAX) {
|
||||
ev.Enable(symmetry);
|
||||
ev.Enable((bool)symmetry);
|
||||
ev.Check(symmetry && symmetry->kind == ev.GetId() - ID_SYMMETRY);
|
||||
} else if (ev.GetId() == ID_COPIES) {
|
||||
ev.Enable(symmetry);
|
||||
ev.Enable((bool)symmetry);
|
||||
if (symmetry) {
|
||||
copies->SetValue(symmetry->copies);
|
||||
}
|
||||
} else if (ev.GetId() == ID_ADD_SYMMETRY) {
|
||||
ev.Enable(true);
|
||||
} else if (ev.GetId() == ID_REMOVE_SYMMETRY) {
|
||||
ev.Enable(symmetry);
|
||||
ev.Enable((bool)symmetry);
|
||||
} else {
|
||||
ev.Enable(false); // we don't know about this item
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include <util/error.hpp>
|
||||
#include <wx/filename.h>
|
||||
#include <wx/wfstream.h>
|
||||
#include <wx/spinctrl.h>
|
||||
|
||||
// ----------------------------------------------------------------------------- : Constructor
|
||||
|
||||
@@ -209,7 +210,7 @@ void SymbolWindow::onFileNew(wxCommandEvent& ev) {
|
||||
}
|
||||
|
||||
void SymbolWindow::onFileOpen(wxCommandEvent& ev) {
|
||||
String name = wxFileSelector(_("Open symbol"),settings.default_symbol_dir,_(""),_(""),_("Symbol files|*.mse-symbol;*.bmp|MSE2 symbol files (*.mse-symbol)|*.mse-symbol|Images/MSE1 symbol files|*.bmp;*.png;*.jpg;*.gif"),wxOPEN|wxFILE_MUST_EXIST, this);
|
||||
String name = wxFileSelector(_("Open symbol"),settings.default_symbol_dir,_(""),_(""),_("Symbol files|*.mse-symbol;*.bmp|MSE2 symbol files (*.mse-symbol)|*.mse-symbol|Images/MSE1 symbol files|*.bmp;*.png;*.jpg;*.gif"),wxFD_OPEN|wxFD_FILE_MUST_EXIST, this);
|
||||
if (!name.empty()) {
|
||||
settings.default_symbol_dir = wxPathOnly(name);
|
||||
wxFileName n(name);
|
||||
@@ -236,7 +237,7 @@ void SymbolWindow::onFileSave(wxCommandEvent& ev) {
|
||||
}
|
||||
|
||||
void SymbolWindow::onFileSaveAs(wxCommandEvent& ev) {
|
||||
String name = wxFileSelector(_("Save symbol"),settings.default_set_dir,_(""),_(""),_("Symbol files (*.mse-symbol)|*.mse-symbol"),wxSAVE, this);
|
||||
String name = wxFileSelector(_("Save symbol"),settings.default_set_dir,_(""),_(""),_("Symbol files (*.mse-symbol)|*.mse-symbol"),wxFD_SAVE, this);
|
||||
if (!name.empty()) {
|
||||
settings.default_set_dir = wxPathOnly(name);
|
||||
Writer writer(shared(new wxFileOutputStream(name)), file_version_symbol);
|
||||
@@ -345,7 +346,7 @@ BEGIN_EVENT_TABLE(SymbolWindow, wxFrame)
|
||||
EVT_TOOL_RANGE (ID_MODE_MIN, ID_MODE_MAX, SymbolWindow::onModeChange)
|
||||
EVT_TOOL_RANGE (ID_CHILD_MIN, ID_CHILD_MAX, SymbolWindow::onExtraTool)
|
||||
EVT_UPDATE_UI (wxID_ANY, SymbolWindow::onUpdateUI)
|
||||
EVT_COMMAND_RANGE(ID_CHILD_MIN, ID_CHILD_MAX, wxEVT_COMMAND_SPINCTRL_UPDATED, SymbolWindow::onExtraTool)
|
||||
EVT_COMMAND_RANGE(ID_CHILD_MIN, ID_CHILD_MAX, wxEVT_SPINCTRL, SymbolWindow::onExtraTool)
|
||||
|
||||
EVT_PART_SELECT (ID_PART_LIST, SymbolWindow::onSelectFromList)
|
||||
EVT_PART_ACTIVATE (ID_PART_LIST, SymbolWindow::onActivateFromList)
|
||||
|
||||
+13
-9
@@ -15,7 +15,11 @@
|
||||
|
||||
#if wxUSE_UXTHEME && defined(__WXMSW__)
|
||||
#include <wx/msw/uxtheme.h>
|
||||
#include <tmschema.h>
|
||||
#if defined(HAVE_VSSYM32)
|
||||
#include <vssym32.h>
|
||||
#else
|
||||
#include <tmschema.h>
|
||||
#endif
|
||||
#include <shlobj.h>
|
||||
#include <wx/mstream.h>
|
||||
#endif
|
||||
@@ -146,7 +150,7 @@ Image load_resource_image(const String& name) {
|
||||
// Load resource
|
||||
// based on wxLoadUserResource
|
||||
// The image can be in an IMAGE resource, in any file format
|
||||
HRSRC hResource = ::FindResource(wxGetInstance(), name, _("IMAGE"));
|
||||
HRSRC hResource = ::FindResource(wxGetInstance(), name.wc_str(), _("IMAGE"));
|
||||
if ( hResource == 0 ) throw InternalError(String::Format(_("Resource not found: %s"), name));
|
||||
|
||||
HGLOBAL hData = ::LoadResource(wxGetInstance(), hResource);
|
||||
@@ -242,7 +246,7 @@ void draw3DBorder(DC& dc, int x1, int y1, int x2, int y2) {
|
||||
}
|
||||
|
||||
void draw_control_box(Window* win, DC& dc, const wxRect& rect, bool focused, bool enabled) {
|
||||
#if wxUSE_UXTHEME && defined(__WXMSW__)
|
||||
#if wxUSE_UXTHEME && defined(__WXMSW__) && TODO_FIX_THEME_ENGINE
|
||||
RECT r;
|
||||
wxUxThemeEngine *themeEngine = wxUxThemeEngine::Get();
|
||||
if (themeEngine && themeEngine->IsAppThemed()) {
|
||||
@@ -270,7 +274,7 @@ void draw_control_box(Window* win, DC& dc, const wxRect& rect, bool focused, boo
|
||||
dc.SetBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
|
||||
dc.DrawRectangle(rect);
|
||||
// draw the border
|
||||
#if defined(__WXMSW__)
|
||||
#if defined(__WXMSW__) && TODO_FIX_THEME_ENGINE
|
||||
r.left = rect.x - 2;
|
||||
r.top = rect.y - 2;
|
||||
r.right = rect.x + rect.width + 2;
|
||||
@@ -283,7 +287,7 @@ void draw_control_box(Window* win, DC& dc, const wxRect& rect, bool focused, boo
|
||||
}
|
||||
|
||||
void draw_button(Window* win, DC& dc, const wxRect& rect, bool focused, bool down, bool enabled) {
|
||||
#if wxVERSION >= 2700
|
||||
#if wxVERSION_NUMBER >= 2700
|
||||
wxRendererNative& rn = wxRendererNative::GetDefault();
|
||||
rn.DrawPushButton(win, dc, rect, (focused ? wxCONTROL_FOCUSED : 0) | (down ? wxCONTROL_PRESSED : 0) | (enabled ? 0 : wxCONTROL_DISABLED));
|
||||
#else
|
||||
@@ -317,7 +321,7 @@ void draw_drop_down_arrow(Window* win, DC& dc, const wxRect& rect, bool active)
|
||||
if (w == -1) {
|
||||
w = wxSystemSettings::GetMetric(wxSYS_VSCROLL_X); // Try just the scrollbar, then.
|
||||
}
|
||||
rn.DrawComboBoxDropButton(win, dc,
|
||||
rn.DrawComboBoxDropButton(win, dc,
|
||||
wxRect(rect.x + rect.width - w, rect.y, w, rect.height)
|
||||
, active ? wxCONTROL_PRESSED : 0);
|
||||
}
|
||||
@@ -336,7 +340,7 @@ void draw_checkbox(Window* win, DC& dc, const wxRect& rect, bool checked, bool e
|
||||
}
|
||||
|
||||
void draw_radiobox(Window* win, DC& dc, const wxRect& rect, bool checked, bool enabled) {
|
||||
#if wxUSE_UXTHEME && defined(__WXMSW__)
|
||||
#if wxUSE_UXTHEME && defined(__WXMSW__) && TODO_FIX_THEME_ENGINE
|
||||
// TODO: Windows version?
|
||||
#endif
|
||||
// portable version
|
||||
@@ -357,7 +361,7 @@ void draw_radiobox(Window* win, DC& dc, const wxRect& rect, bool checked, bool e
|
||||
}
|
||||
|
||||
void draw_selection_rectangle(Window* win, DC& dc, const wxRect& rect, bool selected, bool focused, bool hot) {
|
||||
#if wxUSE_UXTHEME && defined(__WXMSW__)
|
||||
#if wxUSE_UXTHEME && defined(__WXMSW__) && TODO_FIX_THEME_ENGINE
|
||||
#if !defined(NTDDI_LONGHORN) || NTDDI_VERSION < NTDDI_LONGHORN
|
||||
#define LISS_NORMAL LIS_NORMAL
|
||||
#define LISS_SELECTED LIS_SELECTED
|
||||
@@ -390,7 +394,7 @@ void draw_selection_rectangle(Window* win, DC& dc, const wxRect& rect, bool sele
|
||||
}
|
||||
|
||||
void enable_themed_selection_rectangle(Window* win) {
|
||||
#if wxUSE_UXTHEME && defined(__WXMSW__)
|
||||
#if wxUSE_UXTHEME && defined(__WXMSW__) && TODO_FIX_THEME_ENGINE
|
||||
wxUxThemeEngine *themeEngine = wxUxThemeEngine::Get();
|
||||
if (themeEngine && themeEngine->IsAppThemed()) {
|
||||
themeEngine->SetWindowTheme((HWND)win->GetHWND(), L"Explorer", NULL);
|
||||
|
||||
@@ -21,7 +21,7 @@ IMPLEMENT_VALUE_EDITOR(Image) {}
|
||||
bool ImageValueEditor::onLeftDClick(const RealPoint&, wxMouseEvent&) {
|
||||
String filename = wxFileSelector(_("Open image file"), settings.default_image_dir, _(""), _(""),
|
||||
_("All images|*.bmp;*.jpg;*.png;*.gif|Windows bitmaps (*.bmp)|*.bmp|JPEG images (*.jpg;*.jpeg)|*.jpg;*.jpeg|PNG images (*.png)|*.png|GIF images (*.gif)|*.gif|TIFF images (*.tif;*.tiff)|*.tif;*.tiff"),
|
||||
wxOPEN, wxGetTopLevelParent(&editor()));
|
||||
wxFD_OPEN, wxGetTopLevelParent(&editor()));
|
||||
if (!filename.empty()) {
|
||||
settings.default_image_dir = wxPathOnly(filename);
|
||||
wxImage image;
|
||||
|
||||
@@ -24,7 +24,7 @@ void SymbolValueEditor::draw(RotatedDC& dc) {
|
||||
SymbolValueViewer::draw(dc);
|
||||
// draw helper text if there are no symbols
|
||||
if (symbols.empty()) {
|
||||
dc.SetFont(wxFont(10,wxSWISS,wxNORMAL,wxNORMAL));
|
||||
dc.SetFont(wxFont(10,wxFONTFAMILY_SWISS,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_NORMAL));
|
||||
dc.SetTextForeground(*wxBLACK);
|
||||
RealSize text_size = dc.GetTextExtent(_("double click to edit symbol"));
|
||||
dc.DrawText(_("double click to edit symbol"), align_in_rect(ALIGN_MIDDLE_CENTER, text_size, style().getInternalRect()));
|
||||
|
||||
@@ -733,7 +733,7 @@ bool TextValueEditor::containsPoint(const RealPoint& pos) const {
|
||||
RealPoint pos2(pos.x * style().getStretch(), pos.y);
|
||||
if (TextValueViewer::containsPoint(pos2)) return true;
|
||||
if (word_lists.empty()) return false;
|
||||
return findWordList(pos);
|
||||
return (bool) findWordList(pos);
|
||||
}
|
||||
RealRect TextValueEditor::boundingBox() const {
|
||||
if (word_lists.empty()) return ValueViewer::boundingBox();
|
||||
|
||||
@@ -92,7 +92,7 @@ void WelcomeWindow::draw(DC& dc) {
|
||||
dc.DrawBitmap(logo2, ws.GetWidth() - logo2.GetWidth(), ws.GetHeight() - logo2.GetHeight());
|
||||
#endif
|
||||
// draw version number
|
||||
dc.SetFont(wxFont(8, wxSWISS, wxNORMAL, wxNORMAL, false, _("Arial")));
|
||||
dc.SetFont(wxFont(8, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, _("Arial")));
|
||||
dc.SetTextForeground(Color(0,126,176));
|
||||
int tw,th;
|
||||
String version_string = _("version ") + app_version.toString() + version_suffix;
|
||||
@@ -159,8 +159,8 @@ HoverButtonExt::HoverButtonExt(Window* parent, int id, const wxImage& icon, cons
|
||||
: HoverButton(parent, id, _("btn"))
|
||||
, icon(icon)
|
||||
, label(label), sub_label(sub_label)
|
||||
, font_large(14, wxSWISS, wxNORMAL, wxNORMAL, false, _("Arial"))
|
||||
, font_small(8, wxSWISS, wxNORMAL, wxNORMAL, false, _("Arial"))
|
||||
, font_large(14, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, _("Arial"))
|
||||
, font_small(8, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, _("Arial"))
|
||||
{}
|
||||
|
||||
void HoverButtonExt::draw(DC& dc) {
|
||||
|
||||
Reference in New Issue
Block a user