Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
magicseteditor
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
magicseteditor
Commits
9ca309c6
Commit
9ca309c6
authored
Oct 07, 2006
by
twanvl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
settings get read&written
parent
f3924ec8
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
102 additions
and
25 deletions
+102
-25
src/data/game.cpp
src/data/game.cpp
+12
-0
src/data/game.hpp
src/data/game.hpp
+10
-3
src/data/set.cpp
src/data/set.cpp
+9
-0
src/data/set.hpp
src/data/set.hpp
+9
-0
src/gui/set/panel.hpp
src/gui/set/panel.hpp
+3
-1
src/gui/set/stats_panel.cpp
src/gui/set/stats_panel.cpp
+4
-0
src/gui/set/stats_panel.hpp
src/gui/set/stats_panel.hpp
+6
-0
src/gui/set/window.cpp
src/gui/set/window.cpp
+20
-16
src/gui/set/window.hpp
src/gui/set/window.hpp
+1
-1
src/main.cpp
src/main.cpp
+11
-4
src/mse.vcproj
src/mse.vcproj
+9
-0
src/util/io/reader.cpp
src/util/io/reader.cpp
+5
-0
src/util/io/writer.cpp
src/util/io/writer.cpp
+3
-0
No files found.
src/data/game.cpp
View file @
9ca309c6
...
...
@@ -7,9 +7,21 @@
// ----------------------------------------------------------------------------- : Includes
#include <data/game.hpp>
#include <util/io/package_manager.hpp>
// ----------------------------------------------------------------------------- : Game
GameP
Game
::
byName
(
const
String
&
name
)
{
return
packages
.
open
<
Game
>
(
name
+
_
(
".mse-game"
));
}
bool
Game
::
isMagic
()
const
{
return
name
()
==
_
(
"magic"
);
}
String
Game
::
typeName
()
const
{
return
_
(
"game"
);
}
IMPLEMENT_REFLECTION
(
Game
)
{
REFLECT_N
(
"full name"
,
fullName
);
REFLECT_N
(
"icon"
,
iconFilename
);
}
\ No newline at end of file
src/data/game.hpp
View file @
9ca309c6
...
...
@@ -12,9 +12,8 @@
#include <util/prec.hpp>
#include <util/io/package.hpp>
#ifndef HEADER_DATA_CARD
DECLARE_POINTER_TYPE
(
Field
);
#endif
DECLARE_POINTER_TYPE
(
Game
);
// ----------------------------------------------------------------------------- : Game
...
...
@@ -25,8 +24,16 @@ class Game : public Packaged {
vector
<
FieldP
>
setFields
;
vector
<
FieldP
>
cardFields
;
// Is this Magic the Gathering?
/// Loads the game with a particular name, for example "magic"
static
GameP
byName
(
const
String
&
name
);
/// Is this Magic the Gathering?
bool
isMagic
()
const
;
protected:
String
typeName
()
const
;
DECLARE_REFLECTION
();
};
// ----------------------------------------------------------------------------- : EOF
...
...
src/data/set.cpp
View file @
9ca309c6
...
...
@@ -11,12 +11,21 @@
// ----------------------------------------------------------------------------- : Set
Set
::
Set
(
const
GameP
&
game
)
:
game
(
game
)
{}
Set
::
Set
()
{}
String
Set
::
typeName
()
const
{
return
_
(
"set"
);
}
IMPLEMENT_REFLECTION
(
Set
)
{
WITH_DYNAMIC_ARG
(
game_for_new_cards
,
game
.
get
())
{
REFLECT_N
(
"card"
,
cards
);
}
}
// ----------------------------------------------------------------------------- : SetView
SetView
::
SetView
()
{}
...
...
src/data/set.hpp
View file @
9ca309c6
...
...
@@ -23,6 +23,9 @@ DECLARE_POINTER_TYPE(Game);
/// A set of cards
class
Set
:
public
Packaged
{
public:
/// Create a set using the given game
Set
(
const
GameP
&
game
);
/// The game this set uses
GameP
game
;
/// The cards in the set
...
...
@@ -30,6 +33,12 @@ class Set : public Packaged {
/// Actions performed on this set and the cards in it
ActionStack
actions
;
protected:
String
typeName
()
const
;
// default constructor accessible to Reader
Set
();
DECLARE_REFLECTION
();
};
...
...
src/gui/set/panel.hpp
View file @
9ca309c6
...
...
@@ -24,7 +24,7 @@ class SetWindowPanel : public wxPanel, public SetView {
SetWindowPanel
(
Window
*
parent
,
int
id
,
bool
autoTabbing
=
false
);
/// We will probably want to respond to set changes
virtual
void
onSetChange
()
;
virtual
void
onSetChange
()
{}
// --------------------------------------------------- : Meta information
...
...
@@ -50,6 +50,8 @@ class SetWindowPanel : public wxPanel, public SetView {
/// Should return true if this panel wants to get focus to show an action
virtual
bool
wantsToHandle
(
const
Action
&
)
{
return
false
;
}
/// Handle an action that changes the current set
virtual
void
onAction
(
const
Action
&
)
{}
/// The settings for rendering cards have changed, refresh card viewers/editors
virtual
void
onRenderSettingsChange
()
{}
...
...
src/gui/set/stats_panel.cpp
View file @
9ca309c6
...
...
@@ -9,3 +9,7 @@
#include <gui/set/stats_panel.hpp>
// ----------------------------------------------------------------------------- : StatsPanel
StatsPanel
::
StatsPanel
(
Window
*
parent
,
int
id
)
:
SetWindowPanel
(
parent
,
id
)
{}
src/gui/set/stats_panel.hpp
View file @
9ca309c6
...
...
@@ -14,6 +14,12 @@
// ----------------------------------------------------------------------------- : StatsPanel
class
StatsPanel
:
public
SetWindowPanel
{
public:
StatsPanel
(
Window
*
parent
,
int
id
);
};
// ----------------------------------------------------------------------------- : EOF
#endif
src/gui/set/window.cpp
View file @
9ca309c6
...
...
@@ -24,7 +24,7 @@ DECLARE_TYPEOF_COLLECTION(SetWindowPanel*);
// ----------------------------------------------------------------------------- : Constructor
SetWindow
::
SetWindow
(
Window
*
parent
)
SetWindow
::
SetWindow
(
Window
*
parent
,
const
SetP
&
set
)
:
wxFrame
(
parent
,
wxID_ANY
,
_
(
"Magic Set Editor"
),
wxDefaultPosition
,
wxDefaultSize
,
wxDEFAULT_FRAME_STYLE
|
wxNO_FULL_REPAINT_ON_RESIZE
)
,
currentPanel
(
nullptr
)
,
findDialog
(
nullptr
)
...
...
@@ -120,13 +120,16 @@ SetWindow::SetWindow(Window* parent)
// addPanel(menuWindow, tabBar, new StatsPanel (this, wxID_ANY), 3, _("F9"));
//addPanel(*s, *menuWindow, *tabBar, new DraftPanel (&this, wxID_ANY), 4, _("F10"))
// selectPanel(idWindowMin + 4); // select cards panel
addPanel
(
menuWindow
,
tabBar
,
new
StatsPanel
(
this
,
wxID_ANY
),
0
,
_
(
"F9"
));
selectPanel
(
ID_WINDOW_MIN
);
// test
// loose ends
tabBar
->
Realize
();
// setSize(settings.SetWindowWidth, settings.S
etWindowHeight);
// if (settings.S
etWindowMaximized) {
// m
aximize();
//
}
SetSize
(
settings
.
setWindowWidth
,
settings
.
s
etWindowHeight
);
if
(
settings
.
s
etWindowMaximized
)
{
M
aximize
();
}
// SetWindows.push_back(&this); // register this window
// timer.owner = &this;
// timer.start(10);
...
...
@@ -134,20 +137,22 @@ SetWindow::SetWindow(Window* parent)
// note: this still sends events for menu and toolbar items!
wxUpdateUIEvent
::
SetMode
(
wxUPDATE_UI_PROCESS_SPECIFIED
);
SetExtraStyle
(
wxWS_EX_PROCESS_UI_UPDATES
);
setSet
(
set
);
}
SetWindow
::~
SetWindow
()
{
// store window size in settings
// wxSize s = g
etSize();
// settings.SetWindowMaximized = i
sMaximized();
// if (!i
sMaximized()) {
// settings.S
etWindowWidth = s.GetWidth();
// settings.S
etWindowHeight = s.GetHeight();
//
}
//
// destroy ui of selected panel
//
currentPanel->destroyUI(GetToolBar(), GetMenuBar());
wxSize
s
=
G
etSize
();
settings
.
setWindowMaximized
=
I
sMaximized
();
if
(
!
I
sMaximized
())
{
settings
.
s
etWindowWidth
=
s
.
GetWidth
();
settings
.
s
etWindowHeight
=
s
.
GetHeight
();
}
// destroy ui of selected panel
currentPanel
->
destroyUI
(
GetToolBar
(),
GetMenuBar
());
// cleanup (see find stuff)
//
delete findDialog;
delete
findDialog
;
// remove from list of main windows
// SetWindows.erase(remove(SetWindows.begin(), SetWindows.end(), &this));
// stop updating
...
...
@@ -511,8 +516,7 @@ void SetWindow::onEditPreferences(wxCommandEvent&) {
// ----------------------------------------------------------------------------- : Window events - menu - window
void
SetWindow
::
onWindowNewWindow
(
wxCommandEvent
&
)
{
SetWindow
*
newWindow
=
new
SetWindow
(
nullptr
);
newWindow
->
setSet
(
set
);
SetWindow
*
newWindow
=
new
SetWindow
(
nullptr
,
set
);
newWindow
->
Show
();
}
...
...
src/gui/set/window.hpp
View file @
9ca309c6
...
...
@@ -25,7 +25,7 @@ class wxFindDialogEvent;
class
SetWindow
:
public
wxFrame
,
public
SetView
{
public:
/// Construct a SetWindow
SetWindow
(
Window
*
parent
);
SetWindow
(
Window
*
parent
,
const
SetP
&
set
);
~
SetWindow
();
// --------------------------------------------------- : Set actions
...
...
src/main.cpp
View file @
9ca309c6
...
...
@@ -6,7 +6,12 @@
// ----------------------------------------------------------------------------- : Includes
#include "util/prec.hpp"
#include <util/prec.hpp>
#include <data/game.hpp>
#include <data/set.hpp>
#include <data/settings.hpp>
#include <data/format/formats.hpp>
#include <gui/set/window.hpp>
#include <gui/symbol/window.hpp>
// ----------------------------------------------------------------------------- : Main function/class
...
...
@@ -30,8 +35,10 @@ IMPLEMENT_APP(MSE)
bool
MSE
::
OnInit
()
{
wxInitAllImageHandlers
();
//initFileFilters()
Window
*
wnd
=
new
SymbolWindow
(
0
);
initFileFormats
();
settings
.
read
();
//Window* wnd = new SymbolWindow(nullptr);
Window
*
wnd
=
new
SetWindow
(
nullptr
,
new_shared1
<
Set
>
(
Game
::
byName
(
_
(
"magic"
))));
wnd
->
Show
();
return
true
;
}
...
...
@@ -39,7 +46,7 @@ bool MSE::OnInit() {
// ----------------------------------------------------------------------------- : Exit
int
MSE
::
OnExit
()
{
//
settings.write();
settings
.
write
();
return
0
;
}
...
...
src/mse.vcproj
View file @
9ca309c6
...
...
@@ -328,6 +328,9 @@
<File
RelativePath=
".\gui\set\cards_panel.hpp"
>
</File>
<File
RelativePath=
".\gui\set\panel.cpp"
>
</File>
<File
RelativePath=
".\gui\set\panel.hpp"
>
</File>
...
...
@@ -768,6 +771,12 @@
<File
RelativePath=
".\util\io\package.hpp"
>
</File>
<File
RelativePath=
".\util\io\package_manager.cpp"
>
</File>
<File
RelativePath=
".\util\io\package_manager.hpp"
>
</File>
<File
RelativePath=
".\util\io\reader.cpp"
>
<FileConfiguration
...
...
src/util/io/reader.cpp
View file @
9ca309c6
...
...
@@ -111,6 +111,11 @@ template <> void Reader::handle(int& i) {
value
.
ToLong
(
&
l
);
i
=
l
;
}
template
<>
void
Reader
::
handle
(
unsigned
int
&
i
)
{
long
l
=
0
;
value
.
ToLong
(
&
l
);
i
=
abs
(
l
);
// abs, because it will seem strange if -1 comes out as MAX_INT
}
template
<>
void
Reader
::
handle
(
double
&
d
)
{
value
.
ToDouble
(
&
d
);
}
...
...
src/util/io/writer.cpp
View file @
9ca309c6
...
...
@@ -92,6 +92,9 @@ void Writer::handle(const String& value) {
template
<>
void
Writer
::
handle
(
const
int
&
value
)
{
handle
(
String
()
<<
value
);
}
template
<>
void
Writer
::
handle
(
const
unsigned
int
&
value
)
{
handle
(
String
()
<<
value
);
}
template
<>
void
Writer
::
handle
(
const
double
&
value
)
{
handle
(
String
()
<<
value
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment