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
1d8af552
Commit
1d8af552
authored
Oct 26, 2006
by
twanvl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added dummy CardEditor, implemented Stylesheet loading
parent
f79492cb
Changes
23
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
252 additions
and
42 deletions
+252
-42
src/data/card.cpp
src/data/card.cpp
+3
-5
src/data/card.hpp
src/data/card.hpp
+0
-4
src/data/game.cpp
src/data/game.cpp
+2
-1
src/data/game.hpp
src/data/game.hpp
+6
-1
src/data/set.cpp
src/data/set.cpp
+10
-6
src/data/stylesheet.cpp
src/data/stylesheet.cpp
+62
-0
src/data/stylesheet.hpp
src/data/stylesheet.hpp
+26
-3
src/gui/control/card_editor.cpp
src/gui/control/card_editor.cpp
+21
-0
src/gui/control/card_editor.hpp
src/gui/control/card_editor.hpp
+29
-0
src/gui/control/card_viewer.cpp
src/gui/control/card_viewer.cpp
+6
-2
src/gui/control/card_viewer.hpp
src/gui/control/card_viewer.hpp
+1
-1
src/gui/set/cards_panel.cpp
src/gui/set/cards_panel.cpp
+6
-3
src/gui/set/cards_panel.hpp
src/gui/set/cards_panel.hpp
+4
-3
src/gui/set/window.cpp
src/gui/set/window.cpp
+9
-2
src/gui/set/window.hpp
src/gui/set/window.hpp
+4
-1
src/mse.vcproj
src/mse.vcproj
+6
-0
src/render/card/viewer.cpp
src/render/card/viewer.cpp
+21
-0
src/render/value/viewer.cpp
src/render/value/viewer.cpp
+5
-0
src/render/value/viewer.hpp
src/render/value/viewer.hpp
+12
-8
src/util/io/get_member.hpp
src/util/io/get_member.hpp
+2
-0
src/util/io/reader.cpp
src/util/io/reader.cpp
+10
-0
src/util/io/reader.hpp
src/util/io/reader.hpp
+5
-1
src/util/io/writer.hpp
src/util/io/writer.hpp
+2
-1
No files found.
src/data/card.cpp
View file @
1d8af552
...
...
@@ -16,13 +16,11 @@ DECLARE_TYPEOF_COLLECTION(FieldP);
// ----------------------------------------------------------------------------- : Card
IMPLEMENT_DYNAMIC_ARG
(
Game
*
,
game_for_new_cards
,
nullptr
);
Card
::
Card
()
{
if
(
!
game_for_
new_cards
())
{
throw
InternalError
(
_
(
"game_for_
new_cards
not set"
));
if
(
!
game_for_
reading
())
{
throw
InternalError
(
_
(
"game_for_
reading
not set"
));
}
data
.
init
(
game_for_
new_cards
()
->
card_fields
);
data
.
init
(
game_for_
reading
()
->
card_fields
);
}
Card
::
Card
(
const
Game
&
game
)
{
...
...
src/data/card.hpp
View file @
1d8af552
...
...
@@ -11,7 +11,6 @@
#include <util/string.hpp>
#include <util/reflect.hpp>
#include <util/dynamic_arg.hpp>
class
Game
;
DECLARE_POINTER_TYPE
(
Field
);
...
...
@@ -20,9 +19,6 @@ DECLARE_POINTER_TYPE(StyleSheet);
// ----------------------------------------------------------------------------- : Card
/// Game that is used for cards constructed with the default constructor
DECLARE_DYNAMIC_ARG
(
Game
*
,
game_for_new_cards
);
/// A card from a card Set
class
Card
{
public:
...
...
src/data/game.cpp
View file @
1d8af552
...
...
@@ -14,6 +14,8 @@
// ----------------------------------------------------------------------------- : Game
IMPLEMENT_DYNAMIC_ARG
(
Game
*
,
game_for_reading
,
nullptr
);
GameP
Game
::
byName
(
const
String
&
name
)
{
return
packages
.
open
<
Game
>
(
name
+
_
(
".mse-game"
));
}
...
...
@@ -35,7 +37,6 @@ InputStreamP Game::openIconFile() {
}
IMPLEMENT_REFLECTION
(
Game
)
{
// ioMseVersion(io, fileName, fileVersion);
REFLECT
(
full_name
);
REFLECT_N
(
"icon"
,
icon_filename
);
REFLECT
(
init_script
);
...
...
src/data/game.hpp
View file @
1d8af552
...
...
@@ -12,15 +12,20 @@
#include <util/prec.hpp>
#include <util/io/package.hpp>
#include <script/scriptable.hpp>
#include <util/dynamic_arg.hpp>
DECLARE_POINTER_TYPE
(
Field
);
DECLARE_POINTER_TYPE
(
Game
);
// ----------------------------------------------------------------------------- : Game
/// Game that is used for cards constructed with the default constructor, as well as for reading stylesheets
DECLARE_DYNAMIC_ARG
(
Game
*
,
game_for_reading
);
/// A description of a card game
class
Game
:
public
Packaged
{
public:
String
full_name
;
///< Name of this game for menus etc.
String
full_name
;
///< Name of this game
,
for menus etc.
String
icon_filename
;
///< Filename of icon to use in NewWindow
OptionalScript
init_script
;
///< Script of variables available to other scripts in this game
vector
<
FieldP
>
set_fields
;
///< Fields for set information
...
...
src/data/set.cpp
View file @
1d8af552
...
...
@@ -29,13 +29,17 @@ Set::Set(const StyleSheetP& stylesheet)
String
Set
::
typeName
()
const
{
return
_
(
"set"
);
}
IMPLEMENT_REFLECTION
(
Set
)
{
tag
.
addAlias
(
300
,
_
(
"style"
),
_
(
"stylesheet"
));
// < 0.3.0 used style instead of stylesheet
REFLECT
(
game
);
if
(
data
.
empty
()
&&
game
)
{
data
.
init
(
game
->
set_fields
);
}
REFLECT_N
(
"set_info"
,
data
);
WITH_DYNAMIC_ARG
(
game_for_new_cards
,
game
.
get
())
{
REFLECT
(
cards
);
if
(
game
)
{
if
(
tag
.
reading
())
{
data
.
init
(
game
->
set_fields
);
}
WITH_DYNAMIC_ARG
(
game_for_reading
,
game
.
get
())
{
REFLECT
(
stylesheet
);
REFLECT_N
(
"set_info"
,
data
);
REFLECT
(
cards
);
}
}
REFLECT
(
apprentice_code
);
}
...
...
src/data/stylesheet.cpp
View file @
1d8af552
...
...
@@ -7,8 +7,70 @@
// ----------------------------------------------------------------------------- : Includes
#include <data/stylesheet.hpp>
#include <data/game.hpp>
#include <data/field.hpp>
#include <util/io/package_manager.hpp>
// ----------------------------------------------------------------------------- : StyleSheet
StyleSheet
::
StyleSheet
()
:
card_width
(
100
),
card_height
(
100
)
,
card_dpi
(
96
),
card_background
(
*
wxWHITE
)
{}
StyleSheetP
StyleSheet
::
byGameAndName
(
const
Game
&
game
,
const
String
&
name
)
{
return
packages
.
open
<
StyleSheet
>
(
game
.
name
()
+
_
(
"-"
)
+
name
+
_
(
".mse-style"
));
}
String
StyleSheet
::
typeNameStatic
()
{
return
_
(
"style"
);
}
String
StyleSheet
::
typeName
()
const
{
return
_
(
"style"
);
}
String
StyleSheet
::
fullName
()
const
{
return
full_name
;
}
InputStreamP
StyleSheet
::
openIconFile
()
{
if
(
!
icon_filename
.
empty
())
{
return
openIn
(
icon_filename
);
}
else
{
return
game
->
openIconFile
();
// use game icon by default
}
}
IMPLEMENT_REFLECTION
(
StyleSheet
)
{
// < 0.3.0 didn't use card_ prefix
tag
.
addAlias
(
300
,
_
(
"width"
),
_
(
"card_width"
));
tag
.
addAlias
(
300
,
_
(
"height"
),
_
(
"card_height"
));
tag
.
addAlias
(
300
,
_
(
"dpi"
),
_
(
"card_dpi"
));
tag
.
addAlias
(
300
,
_
(
"background"
),
_
(
"card_background"
));
tag
.
addAlias
(
300
,
_
(
"info_style"
),
_
(
"set_info_style"
));
REFLECT
(
game
);
REFLECT
(
full_name
);
REFLECT_N
(
"icon"
,
icon_filename
);
REFLECT
(
init_script
);
REFLECT
(
card_width
);
REFLECT
(
card_height
);
REFLECT
(
card_dpi
);
REFLECT
(
card_background
);
if
(
game
)
{
if
(
tag
.
reading
())
{
card_style
.
init
(
game
->
card_fields
);
set_info_style
.
init
(
game
->
set_fields
);
}
REFLECT
(
card_style
);
REFLECT
(
set_info_style
);
}
// io(_("extra field"), extraSetFields);
// extraInfoStyle.init(extraSetFields);
// io(_("extra style"), extraInfoStyle);
}
// special behaviour of reading/writing StyleSheetPs: only read/write the name
void
Reader
::
handle
(
StyleSheetP
&
stylesheet
)
{
if
(
!
game_for_reading
())
{
throw
InternalError
(
_
(
"game_for_reading not set"
));
}
stylesheet
=
StyleSheet
::
byGameAndName
(
*
game_for_reading
(),
value
);
}
void
Writer
::
handle
(
const
StyleSheetP
&
stylesheet
)
{
handle
(
stylesheet
->
name
());
}
src/data/stylesheet.hpp
View file @
1d8af552
...
...
@@ -11,23 +11,46 @@
#include <util/prec.hpp>
#include <util/io/package.hpp>
#include <script/scriptable.hpp>
DECLARE_POINTER_TYPE
(
Game
);
DECLARE_POINTER_TYPE
(
StyleSheet
);
DECLARE_POINTER_TYPE
(
Field
);
DECLARE_POINTER_TYPE
(
Style
);
// ----------------------------------------------------------------------------- : StyleSheet
/// A collection of style information for card and set fields
class
StyleSheet
:
public
Packaged
{
public:
GameP
game
;
double
card_width
;
///< The width of a card in pixels
double
card_height
;
///< The height of a card in pixels
StyleSheet
();
GameP
game
;
///< The game this stylesheet is made for
String
full_name
;
///< Name of this game, for menus etc.
String
icon_filename
;
///< Filename of icon to use in NewWindow
OptionalScript
init_script
;
///< Script of variables available to other scripts in this stylesheet
double
card_width
;
///< The width of a card in pixels
double
card_height
;
///< The height of a card in pixels
double
card_dpi
;
///< The resolution of a card in dots per inch
Color
card_background
;
///< The background color of cards
/// The styling for card fields
/** The indices should correspond to the set_fields in the Game */
IndexMap
<
FieldP
,
StyleP
>
card_style
;
/// The styling for set info fields
/** The indices should correspond to the set_fields in the Game */
IndexMap
<
FieldP
,
StyleP
>
set_info_style
;
static
String
typeNameStatic
();
virtual
String
typeName
()
const
;
virtual
String
fullName
()
const
;
virtual
InputStreamP
openIconFile
();
/// Load a StyleSheet, given a Game and the name of the StyleSheet
static
StyleSheetP
byGameAndName
(
const
Game
&
game
,
const
String
&
name
);
/// name of the package without the game name
String
styleName
();
private:
DECLARE_REFLECTION
();
};
...
...
src/gui/control/card_editor.cpp
0 → 100644
View file @
1d8af552
//+----------------------------------------------------------------------------+
//| 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/control/card_editor.hpp>
// ----------------------------------------------------------------------------- : DataEditor
DataEditor
::
DataEditor
(
Window
*
parent
,
int
id
,
long
style
)
:
CardViewer
(
parent
,
id
,
style
)
{}
// ----------------------------------------------------------------------------- : Event table
BEGIN_EVENT_TABLE
(
DataEditor
,
CardViewer
)
END_EVENT_TABLE
()
src/gui/control/card_editor.hpp
0 → 100644
View file @
1d8af552
//+----------------------------------------------------------------------------+
//| 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_CONTROL_CARD_EDITOR
#define HEADER_GUI_CONTROL_CARD_EDITOR
// ----------------------------------------------------------------------------- : Includes
#include <util/prec.hpp>
#include <gui/control/card_viewer.hpp>
// ----------------------------------------------------------------------------- : DataEditor
/// An editor for data values (usually a card)
class
DataEditor
:
public
CardViewer
{
public:
DataEditor
(
Window
*
parent
,
int
id
,
long
style
=
0
);
private:
DECLARE_EVENT_TABLE
();
};
/// By default a DataEditor edits cards
typedef
DataEditor
CardEditor
;
// ----------------------------------------------------------------------------- : EOF
#endif
src/gui/control/card_viewer.cpp
View file @
1d8af552
...
...
@@ -12,13 +12,17 @@
// ----------------------------------------------------------------------------- : CardViewer
CardViewer
::
CardViewer
(
Window
*
parent
,
int
id
,
int
style
)
CardViewer
::
CardViewer
(
Window
*
parent
,
int
id
,
long
style
)
:
wxControl
(
parent
,
id
,
wxDefaultPosition
,
wxDefaultSize
,
style
)
{}
wxSize
CardViewer
::
DoGetBestSize
()
const
{
wxSize
ws
=
GetSize
(),
cs
=
GetClientSize
();
return
wxSize
(
set
->
stylesheet
->
card_width
,
set
->
stylesheet
->
card_height
)
+
ws
-
cs
;
if
(
set
&&
set
->
stylesheet
)
{
return
wxSize
(
set
->
stylesheet
->
card_width
,
set
->
stylesheet
->
card_height
)
+
ws
-
cs
;
}
else
{
return
cs
;
}
}
void
CardViewer
::
onPaint
(
wxPaintEvent
&
)
{
...
...
src/gui/control/card_viewer.hpp
View file @
1d8af552
...
...
@@ -17,7 +17,7 @@
/// A control to view a single card
class
CardViewer
:
public
wxControl
,
public
DataViewer
{
public:
CardViewer
(
Window
*
parent
,
int
id
,
int
style
);
CardViewer
(
Window
*
parent
,
int
id
,
long
style
=
0
);
protected:
/// Return the desired size of control
...
...
src/gui/set/cards_panel.cpp
View file @
1d8af552
...
...
@@ -8,6 +8,7 @@
#include <gui/set/cards_panel.hpp>
#include <gui/control/card_list.hpp>
#include <gui/control/card_editor.hpp>
#include <gui/icon_menu.hpp>
#include <data/set.hpp>
#include <data/action/set.hpp>
...
...
@@ -21,8 +22,9 @@ CardsPanel::CardsPanel(Window* parent, int id)
:
SetWindowPanel
(
parent
,
id
,
false
)
{
// init controls
// Panel* notesP
editor
=
new
CardEditor
(
this
,
ID_EDITOR
);
// splitter = new SplitterWindow(&this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0);
// card_list = new EditCardList(splitter, idCardList);
// card_list = new EditCardList(splitter, ID_CARD_LIST);
card_list
=
new
CardListBase
(
this
,
ID_CARD_LIST
);
// init splitter
...
...
@@ -37,6 +39,7 @@ CardsPanel::CardsPanel(Window* parent, int id)
SetSizer(s);
*/
wxSizer
*
s
=
new
wxBoxSizer
(
wxHORIZONTAL
);
s
->
Add
(
editor
,
0
,
wxRIGHT
,
2
);
s
->
Add
(
card_list
,
1
,
wxEXPAND
);
SetSizer
(
s
);
}
...
...
@@ -46,7 +49,7 @@ CardsPanel::~CardsPanel() {
}
void
CardsPanel
::
onChangeSet
()
{
//
editor->setSet(set);
editor
->
setSet
(
set
);
card_list
->
setSet
(
set
);
/* // resize editor
Sizer* s = sizer;
...
...
@@ -207,5 +210,5 @@ CardP CardsPanel::selectedCard() const {
}
void
CardsPanel
::
selectCard
(
const
CardP
&
card
)
{
card_list
->
setCard
(
card
);
// editor->setCard(
card);
editor
->
setCard
(
*
card
);
}
\ No newline at end of file
src/gui/set/cards_panel.hpp
View file @
1d8af552
...
...
@@ -14,6 +14,7 @@
class
wxSplitterWindow
;
class
CardListBase
;
class
DataEditor
;
// ----------------------------------------------------------------------------- : CardsPanel
...
...
@@ -92,9 +93,9 @@ class CardsPanel : public SetWindowPanel {
private:
// --------------------------------------------------- : Controls
wxSplitterWindow
*
splitter
;
//
Editor* editor;
CardListBase
*
card_list
;
// DataTextCtrl* notes;
Data
Editor
*
editor
;
CardListBase
*
card_list
;
// DataTextCtrl*
notes;
// --------------------------------------------------- : Menus & tools
wxMenu
*
cardMenu
,
formatMenu
;
...
...
src/gui/set/window.cpp
View file @
1d8af552
...
...
@@ -12,6 +12,7 @@
#include <gui/set/set_info_panel.hpp>
#include <gui/set/style_panel.hpp>
#include <gui/set/stats_panel.hpp>
#include <gui/control/card_list.hpp>
#include <gui/about_window.hpp>
#include <gui/new_window.hpp>
#include <gui/icon_menu.hpp>
...
...
@@ -540,12 +541,18 @@ void SetWindow::onHelpAbout(wxCommandEvent&) {
wnd
.
ShowModal
();
}
// ----------------------------------------------------------------------------- : Window events -
menu - for child panel
// ----------------------------------------------------------------------------- : Window events -
other
void
SetWindow
::
onChildMenu
(
wxCommandEvent
&
ev
)
{
current_panel
->
onCommand
(
ev
.
GetId
());
}
void
SetWindow
::
onCardSelect
(
CardSelectEvent
&
ev
)
{
FOR_EACH
(
p
,
panels
)
{
p
->
selectCard
(
ev
.
card
);
}
}
// ----------------------------------------------------------------------------- : Event table
BEGIN_EVENT_TABLE
(
SetWindow
,
wxFrame
)
...
...
@@ -586,5 +593,5 @@ BEGIN_EVENT_TABLE(SetWindow, wxFrame)
EVT_CLOSE
(
SetWindow
::
onClose
)
// EVT_TIMER (wxID_ANY, SetWindow::onTick)
// EVT_IDLE ( SetWindow::onIdle)
//
EVT_CARD_SELECT (wxID_ANY, SetWindow::onCardSelect)
EVT_CARD_SELECT
(
wxID_ANY
,
SetWindow
::
onCardSelect
)
END_EVENT_TABLE
()
src/gui/set/window.hpp
View file @
1d8af552
...
...
@@ -16,6 +16,7 @@
class
IconMenu
;
class
SetWindowPanel
;
class
wxFindDialogEvent
;
struct
CardSelectEvent
;
// ----------------------------------------------------------------------------- : SetWindow
...
...
@@ -150,9 +151,11 @@ class SetWindow : public wxFrame, public SetView {
void
onHelpIndex
(
wxCommandEvent
&
);
void
onHelpAbout
(
wxCommandEvent
&
);
// --------------------------------------------------- : Window events -
menu - for child panel
// --------------------------------------------------- : Window events -
other
void
onChildMenu
(
wxCommandEvent
&
);
void
onCardSelect
(
CardSelectEvent
&
);
};
// ----------------------------------------------------------------------------- : EOF
...
...
src/mse.vcproj
View file @
1d8af552
...
...
@@ -362,6 +362,12 @@
<Filter
Name=
"control"
Filter=
""
>
<File
RelativePath=
".\gui\control\card_editor.cpp"
>
</File>
<File
RelativePath=
".\gui\control\card_editor.hpp"
>
</File>
<File
RelativePath=
".\gui\control\card_list.cpp"
>
</File>
...
...
src/render/card/viewer.cpp
View file @
1d8af552
...
...
@@ -7,8 +7,14 @@
// ----------------------------------------------------------------------------- : Includes
#include <render/card/viewer.hpp>
#include <render/value/viewer.hpp>
#include <data/set.hpp>
#include <data/stylesheet.hpp>
#include <data/card.hpp>
#include <data/field.hpp>
DECLARE_TYPEOF_COLLECTION
(
ValueViewerP
);
// ----------------------------------------------------------------------------- : DataViewer
...
...
@@ -28,9 +34,24 @@ Value* DataViewer::focusedValue() const { return nullptr; }
// ----------------------------------------------------------------------------- : Setting data
void
DataViewer
::
setCard
(
Card
&
card
)
{
assert
(
set
);
setStyles
(
set
->
stylesheet
->
card_style
);
setData
(
card
.
data
);
}
// ----------------------------------------------------------------------------- : Viewers
void
DataViewer
::
setStyles
(
IndexMap
<
FieldP
,
StyleP
>&
styles
)
{
}
void
DataViewer
::
setData
(
IndexMap
<
FieldP
,
ValueP
>&
values
)
{
FOR_EACH
(
v
,
viewers
)
{
v
->
setValue
(
values
[
v
->
getField
()]);
}
}
ValueViewerP
DataViewer
::
makeViewer
(
const
StyleP
&
style
)
{
return
style
->
makeViewer
(
*
this
,
style
);
}
...
...
src/render/value/viewer.cpp
View file @
1d8af552
...
...
@@ -10,6 +10,11 @@
// ----------------------------------------------------------------------------- : ValueViewer
void
ValueViewer
::
setValue
(
const
ValueP
&
value
)
{
assert
(
value
->
fieldP
==
styleP
->
fieldP
);
// matching field
valueP
=
value
;
onValueChange
();
}
// ----------------------------------------------------------------------------- : Development/debug
...
...
src/render/value/viewer.hpp
View file @
1d8af552
...
...
@@ -12,6 +12,7 @@
#include <util/prec.hpp>
#include <util/rotation.hpp>
#include <util/real_point.hpp>
#include <data/field.hpp>
class
DataViewer
;
class
ValueAction
;
...
...
@@ -26,7 +27,12 @@ class ValueViewer {
public:
/// Construct a ValueViewer, set the value at a later time
ValueViewer
(
DataViewer
&
parent
,
const
StyleP
&
style
);
virtual
~
ValueViewer
();
virtual
~
ValueViewer
()
{}
/// Change the associated value
void
setValue
(
const
ValueP
&
);
/// Return the associated field
inline
const
FieldP
&
getField
()
const
{
return
styleP
->
fieldP
;
}
// Draw this value
virtual
void
draw
(
RotatedDC
&
dc
)
=
0
;
...
...
@@ -46,13 +52,10 @@ class ValueViewer {
/// Called when an action is performed on the associated value
virtual
void
onAction
(
const
ValueAction
&
,
bool
undone
)
{
onValueChange
();
}
/// Change the associated value
void
setValue
(
const
ValueP
&
);
protected:
DataViewer
&
viewer
;
///< Our parent object
StyleP
style
_
;
///< The style of this viewer
ValueP
value
_
;
///< The value we are currently viewing
StyleP
style
P
;
///< The style of this viewer
ValueP
value
P
;
///< The value we are currently viewing
/// Should this viewer render using a platform native look?
bool
nativeLook
()
const
;
...
...
@@ -70,8 +73,9 @@ class ValueViewer {
public
:
\
Type
(
DataViewer
&
parent
,
const
Type
##
StyleP
&
style
)
\
private
:
\
inline
Type
##
Style
style
()
const
{
return
*
value_
;
}
\
inline
Type
##
Value
value
()
const
{
return
*
value_
;
}
inline
Type
##
Style
&
style
()
const
{
return
*
styleP
;
}
\
inline
Type
##
Value
&
value
()
const
{
return
*
valueP
;
}
\
inline
Type
##
Field
&
field
()
const
{
return
styleP
->
field
();
}
// ----------------------------------------------------------------------------- : EOF
...
...
src/util/io/get_member.hpp
View file @
1d8af552
...
...
@@ -28,6 +28,7 @@ class GetDefaultMember {
/// Tell the reflection code we are not reading
inline
bool
reading
()
const
{
return
false
;
}
inline
bool
isComplex
()
const
{
return
false
;
}
inline
void
addAlias
(
int
,
const
Char
*
,
const
Char
*
)
{}
inline
void
handleAppVersion
()
{}
// no effect
...
...
@@ -68,6 +69,7 @@ class GetMember : private GetDefaultMember {
/// Tell the reflection code we are not reading
inline
bool
reading
()
const
{
return
false
;
}
inline
bool
isComplex
()
const
{
return
false
;
}
inline
void
addAlias
(
int
,
const
Char
*
,
const
Char
*
)
{}
/// The result, or script_nil if the member was not found
inline
ScriptValueP
result
()
{
return
gdm
.
result
();
}
...
...
src/util/io/reader.cpp
View file @
1d8af552
...
...
@@ -30,6 +30,11 @@ Reader::Reader(const String& filename)
moveNext
();
}
void
Reader
::
addAlias
(
Version
end_version
,
const
Char
*
a
,
const
Char
*
b
)
{
if
(
app_version
<
end_version
)
{
aliasses
[
a
]
=
b
;
}
}
void
Reader
::
handleAppVersion
()
{
if
(
enterBlock
(
_
(
"mse_version"
)))
{
...
...
@@ -113,6 +118,11 @@ void Reader::readLine() {
}
key
=
cannocial_name_form
(
trim
(
line
.
substr
(
indent
,
pos
-
indent
)));
value
=
pos
==
String
::
npos
?
_
(
""
)
:
trim_left
(
line
.
substr
(
pos
+
1
));
// aliasses?
map
<
String
,
String
>::
const_iterator
it
=
aliasses
.
find
(
key
);
if
(
it
!=
aliasses
.
end
())
{
key
=
it
->
second
;
}
}
void
Reader
::
unknownKey
()
{
...
...
src/util/io/reader.hpp
View file @
1d8af552
...
...
@@ -46,6 +46,8 @@ class Reader {
inline
bool
reading
()
const
{
return
true
;
}
/// Is the thing currently being read 'complex', i.e. does it have children
inline
bool
isComplex
()
const
{
return
value
.
empty
();
}
/// Add a as an alias for b, all keys a will be replaced with b, only if app_version < end_version
void
addAlias
(
Version
end_version
,
const
Char
*
a
,
const
Char
*
b
);
/// Read and check the application version
void
handleAppVersion
();
...
...
@@ -80,7 +82,7 @@ class Reader {
template
<
typename
T
>
void
handle
(
Scriptable
<
T
>&
);
// special behaviour
void
handle
(
GameP
&
);
void
handle
(
StyleSheet
&
);
void
handle
(
StyleSheet
P
&
);
// --------------------------------------------------- : Data
/// App version this file was made with
...
...
@@ -98,6 +100,8 @@ class Reader {
int
expected_indent
;
/// Did we just open a block (i.e. not read any more lines of it)?
bool
just_opened
;
/// Aliasses for compatability
map
<
String
,
String
>
aliasses
;
/// Filename for error messages
String
filename
;
...
...
src/util/io/writer.hpp
View file @
1d8af552
...
...
@@ -31,6 +31,7 @@ class Writer {
/// Tell the reflection code we are not reading
inline
bool
reading
()
const
{
return
false
;
}
inline
bool
isComplex
()
const
{
return
false
;
}
inline
void
addAlias
(
int
,
const
Char
*
,
const
Char
*
)
{}
/// Write the application version
void
handleAppVersion
();
...
...
@@ -65,7 +66,7 @@ class Writer {
template
<
typename
T
>
void
handle
(
const
Scriptable
<
T
>&
);
// special behaviour
void
handle
(
const
GameP
&
);
void
handle
(
const
StyleSheet
&
);
void
handle
(
const
StyleSheet
P
&
);
private:
// --------------------------------------------------- : Data
...
...
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