mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
added AboutWindow
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@45 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -0,0 +1,107 @@
|
||||
//+----------------------------------------------------------------------------+
|
||||
//| Description: Magic Set Editor - Program to make Magic (tm) cards |
|
||||
//| Copyright: (C) 2001 - 2006 Twan van Laarhoven |
|
||||
//| License: GNU General Public License 2 or later (see file COPYING) |
|
||||
//+----------------------------------------------------------------------------+
|
||||
|
||||
// ----------------------------------------------------------------------------- : Includes
|
||||
|
||||
#include <gui/about_window.hpp>
|
||||
#include <gui/util.hpp>
|
||||
#include <util/version.hpp>
|
||||
#include <wx/dcbuffer.h>
|
||||
|
||||
// ----------------------------------------------------------------------------- : About window
|
||||
|
||||
AboutWindow::AboutWindow(Window* parent)
|
||||
: wxDialog(parent, wxID_ANY, _("About Magic Set Editor"), wxDefaultPosition, wxSize(510,340), wxCLIP_CHILDREN | wxDEFAULT_DIALOG_STYLE)
|
||||
, logo (load_resource_image(_("ABOUT")))
|
||||
, logo2(load_resource_image(_("TWO")))
|
||||
{
|
||||
// init controls
|
||||
wxButton* ok_button = new HoverButton(this, wxID_OK, _("BTN_OK"));
|
||||
wxSize bs = ok_button->GetSize(), ws = GetClientSize();
|
||||
ok_button->Move(ws.GetWidth() - bs.GetWidth(), ws.GetHeight() - bs.GetHeight()); // align bottom right
|
||||
}
|
||||
|
||||
void AboutWindow::onPaint(wxPaintEvent& ev) {
|
||||
wxBufferedPaintDC dc(this);
|
||||
dc.BeginDrawing();
|
||||
draw(dc);
|
||||
dc.EndDrawing();
|
||||
}
|
||||
|
||||
void AboutWindow::draw(DC& dc) {
|
||||
wxSize ws = GetClientSize();
|
||||
// draw background
|
||||
dc.SetPen (*wxTRANSPARENT_PEN);
|
||||
dc.SetBrush(Color(240,247,255));
|
||||
dc.DrawRectangle(0, 0, ws.GetWidth(), ws.GetHeight());
|
||||
// draw logo
|
||||
dc.DrawBitmap(logo, (ws.GetWidth() - logo.GetWidth()) / 2, 5);
|
||||
dc.DrawBitmap(logo2, ws.GetWidth() - logo2.GetWidth(), ws.GetHeight() - logo2.GetHeight());
|
||||
// draw version box
|
||||
dc.SetPen (wxPen(Color(184,29,19), 2));
|
||||
dc.SetBrush(Color(114,197,224));
|
||||
dc.DrawRectangle(28, 104, 245, 133);
|
||||
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.DrawText(_("Version: ") + app_version.toString() + version_suffix, 34, 110);
|
||||
dc.DrawText(_("This is a development version!"), 34, 130);
|
||||
dc.DrawText(_(" it probably contains lots bugs,"), 34, 147);
|
||||
dc.DrawText(_(" it misses some very important features,"), 34, 164);
|
||||
dc.DrawText(_(" don't use it for anything important"), 34, 181);
|
||||
dc.DrawText(_("Copyright \xA9 2006 Twan van Laarhoven"), 34, 214);
|
||||
}
|
||||
|
||||
BEGIN_EVENT_TABLE(AboutWindow, wxDialog)
|
||||
EVT_PAINT (AboutWindow::onPaint)
|
||||
END_EVENT_TABLE ()
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------- : Button with image and hover effect
|
||||
|
||||
|
||||
HoverButton::HoverButton(Window* parent, int id, const String& name)
|
||||
: normal(load_resource_image(name + _("_NORMAL")))
|
||||
, hover (load_resource_image(name + _("_HOVER")))
|
||||
{
|
||||
Create(parent, id, normal, wxDefaultPosition, wxSize(normal.GetWidth(), normal.GetHeight()), 0);
|
||||
}
|
||||
|
||||
void HoverButton::onMouseEnter(wxMouseEvent&) {
|
||||
SetBitmapLabel(hover);
|
||||
Refresh(false);
|
||||
}
|
||||
void HoverButton::onMouseLeave(wxMouseEvent&) {
|
||||
SetBitmapLabel(normal);
|
||||
Refresh(false);
|
||||
}
|
||||
void HoverButton::onFocus(wxFocusEvent&) {}
|
||||
void HoverButton::onKillFocus(wxFocusEvent&) {}
|
||||
|
||||
void HoverButton::onPaint(wxPaintEvent&) {
|
||||
wxPaintDC dc(this);
|
||||
dc.BeginDrawing();
|
||||
draw(dc);
|
||||
dc.EndDrawing();
|
||||
}
|
||||
void HoverButton::draw(DC& dc) {
|
||||
// clear background (for transparent button images)
|
||||
wxSize ws = GetClientSize();
|
||||
dc.SetPen(*wxTRANSPARENT_PEN);
|
||||
dc.SetBrush(Color(240,247,255));
|
||||
dc.DrawRectangle(0, 0, ws.GetWidth(), ws.GetHeight());
|
||||
// draw button
|
||||
dc.DrawBitmap(GetBitmapLabel(), 0, 0);
|
||||
}
|
||||
|
||||
BEGIN_EVENT_TABLE(HoverButton, wxBitmapButton)
|
||||
EVT_ENTER_WINDOW (HoverButton::onMouseEnter)
|
||||
EVT_LEAVE_WINDOW (HoverButton::onMouseLeave)
|
||||
EVT_PAINT (HoverButton::onPaint)
|
||||
EVT_SET_FOCUS (HoverButton::onFocus)
|
||||
EVT_KILL_FOCUS (HoverButton::onKillFocus)
|
||||
END_EVENT_TABLE ()
|
||||
@@ -0,0 +1,55 @@
|
||||
//+----------------------------------------------------------------------------+
|
||||
//| Description: Magic Set Editor - Program to make Magic (tm) cards |
|
||||
//| Copyright: (C) 2001 - 2006 Twan van Laarhoven |
|
||||
//| License: GNU General Public License 2 or later (see file COPYING) |
|
||||
//+----------------------------------------------------------------------------+
|
||||
|
||||
#ifndef HEADER_GUI_ABOUT_WINDOW
|
||||
#define HEADER_GUI_ABOUT_WINDOW
|
||||
|
||||
// ----------------------------------------------------------------------------- : Includes
|
||||
|
||||
#include <util/prec.hpp>
|
||||
|
||||
// ----------------------------------------------------------------------------- : About window
|
||||
|
||||
/// Nice about dialog
|
||||
class AboutWindow : public wxDialog {
|
||||
public:
|
||||
AboutWindow(Window* parent);
|
||||
|
||||
private:
|
||||
DECLARE_EVENT_TABLE();
|
||||
|
||||
// graphics
|
||||
Bitmap logo, logo2;
|
||||
|
||||
void onPaint(wxPaintEvent& e);
|
||||
void draw(DC& dc);
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------- : Button with image and hover effect
|
||||
|
||||
// A button that changes images on mouseenter/leave
|
||||
class HoverButton : public wxBitmapButton {
|
||||
public:
|
||||
HoverButton(Window* parent, int id, const String& name);
|
||||
|
||||
private:
|
||||
DECLARE_EVENT_TABLE();
|
||||
|
||||
Bitmap normal, hover; /// Bitmaps for the states of the button
|
||||
|
||||
void onMouseEnter(wxMouseEvent&);
|
||||
void onMouseLeave(wxMouseEvent&);
|
||||
void onFocus (wxFocusEvent& ev);
|
||||
void onKillFocus (wxFocusEvent& ev);
|
||||
void onPaint (wxPaintEvent&);
|
||||
|
||||
protected:
|
||||
virtual void draw(DC& dc);
|
||||
};
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------- : EOF
|
||||
#endif
|
||||
@@ -51,9 +51,14 @@ void CardListBase::onChangeSet() {
|
||||
|
||||
void CardListBase::onAction(const Action& action, bool undone) {
|
||||
TYPE_CASE(action, AddCardAction) {
|
||||
// select the new card
|
||||
selectCard(action.card, false /*list will be refreshed anyway*/);
|
||||
refreshList();
|
||||
if (undone) {
|
||||
refreshList();
|
||||
selectCardPos((long)sorted_card_list.size() - 1, true);
|
||||
} else {
|
||||
// select the new card
|
||||
selectCard(action.card, false /*list will be refreshed anyway*/);
|
||||
refreshList();
|
||||
}
|
||||
}
|
||||
TYPE_CASE(action, RemoveCardAction) {
|
||||
if (undone) {
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
#include <gui/set/set_info_panel.hpp>
|
||||
#include <gui/set/style_panel.hpp>
|
||||
#include <gui/set/stats_panel.hpp>
|
||||
#include <gui/about_window.hpp>
|
||||
#include <gui/new_window.hpp>
|
||||
#include <gui/icon_menu.hpp>
|
||||
#include <util/window_id.hpp>
|
||||
#include <data/game.hpp>
|
||||
@@ -535,8 +537,8 @@ void SetWindow::onHelpIndex(wxCommandEvent&) {
|
||||
}
|
||||
|
||||
void SetWindow::onHelpAbout(wxCommandEvent&) {
|
||||
// AboutWindow wnd(this);
|
||||
// wnd.ShowModal();
|
||||
AboutWindow wnd(this);
|
||||
wnd.ShowModal();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------- : Window events - menu - for child panel
|
||||
|
||||
@@ -545,6 +545,28 @@
|
||||
RelativePath=".\gui\symbol\window.hpp">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="other"
|
||||
Filter="">
|
||||
<File
|
||||
RelativePath=".\gui\about_window.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\gui\about_window.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\gui\new_window.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\gui\new_window.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\gui\welcome_window.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\gui\welcome_window.hpp">
|
||||
</File>
|
||||
</Filter>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="resource"
|
||||
|
||||
Reference in New Issue
Block a user