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
f5b795ac
Commit
f5b795ac
authored
May 19, 2007
by
twanvl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
style specific fields are now editable&saveable
parent
25575707
Changes
16
Show whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
69 additions
and
11 deletions
+69
-11
data/magic-extended-art.mse-style/style
data/magic-extended-art.mse-style/style
+1
-0
data/magic-firepenguinmaster-flip.mse-style/style
data/magic-firepenguinmaster-flip.mse-style/style
+2
-0
data/magic-firepenguinmaster.mse-style/style
data/magic-firepenguinmaster.mse-style/style
+1
-0
data/magic-firepenguinmasterpromo.mse-style/style
data/magic-firepenguinmasterpromo.mse-style/style
+1
-0
data/magic-firepenguinmastersplit.mse-style/style
data/magic-firepenguinmastersplit.mse-style/style
+2
-0
data/magic-firepenguinmastertokens.mse-style/style
data/magic-firepenguinmastertokens.mse-style/style
+1
-0
data/magic-new-flip.mse-style/style
data/magic-new-flip.mse-style/style
+2
-1
data/magic-new-promo.mse-style/style
data/magic-new-promo.mse-style/style
+1
-0
data/magic-new-split.mse-style/style
data/magic-new-split.mse-style/style
+2
-1
data/magic-new.mse-style/style
data/magic-new.mse-style/style
+1
-0
data/magic-planeshifted.mse-style/style
data/magic-planeshifted.mse-style/style
+1
-0
src/data/card.cpp
src/data/card.cpp
+43
-0
src/data/card.hpp
src/data/card.hpp
+6
-3
src/data/stylesheet.cpp
src/data/stylesheet.cpp
+2
-2
src/render/card/viewer.cpp
src/render/card/viewer.cpp
+1
-2
src/script/script_manager.cpp
src/script/script_manager.cpp
+2
-2
No files found.
data/magic-extended-art.mse-style/style
View file @
f5b795ac
...
@@ -264,6 +264,7 @@ extra card field:
...
@@ -264,6 +264,7 @@ extra card field:
type: choice
type: choice
name: pt box
name: pt box
script: card.card_color
script: card.card_color
editable: false
extra card style:
extra card style:
pt box:
pt box:
...
...
data/magic-firepenguinmaster-flip.mse-style/style
View file @
f5b795ac
...
@@ -401,10 +401,12 @@ extra card field:
...
@@ -401,10 +401,12 @@ extra card field:
type: choice
type: choice
name: pt symbols
name: pt symbols
script: "shieldsword"
script: "shieldsword"
editable: false
extra card field:
extra card field:
type: choice
type: choice
name: pt symbols 2
name: pt symbols 2
script: "shieldsword"
script: "shieldsword"
editable: false
extra card style:
extra card style:
pt symbols:
pt symbols:
...
...
data/magic-firepenguinmaster.mse-style/style
View file @
f5b795ac
...
@@ -308,6 +308,7 @@ extra card field:
...
@@ -308,6 +308,7 @@ extra card field:
type: choice
type: choice
name: pt symbols
name: pt symbols
script: "shieldsword"
script: "shieldsword"
editable: false
extra card style:
extra card style:
pt symbols:
pt symbols:
...
...
data/magic-firepenguinmasterpromo.mse-style/style
View file @
f5b795ac
...
@@ -312,6 +312,7 @@ extra card field:
...
@@ -312,6 +312,7 @@ extra card field:
type: choice
type: choice
name: pt symbols
name: pt symbols
script: "shieldsword"
script: "shieldsword"
editable: false
extra card style:
extra card style:
pt symbols:
pt symbols:
...
...
data/magic-firepenguinmastersplit.mse-style/style
View file @
f5b795ac
...
@@ -471,10 +471,12 @@ extra card field:
...
@@ -471,10 +471,12 @@ extra card field:
type: choice
type: choice
name: pt symbols
name: pt symbols
script: "shieldsword"
script: "shieldsword"
editable: false
extra card field:
extra card field:
type: choice
type: choice
name: pt symbols 2
name: pt symbols 2
script: "shieldsword"
script: "shieldsword"
editable: false
extra card style:
extra card style:
pt symbols:
pt symbols:
...
...
data/magic-firepenguinmastertokens.mse-style/style
View file @
f5b795ac
...
@@ -337,6 +337,7 @@ extra card field:
...
@@ -337,6 +337,7 @@ extra card field:
type: choice
type: choice
name: pt symbols
name: pt symbols
script: "shieldsword"
script: "shieldsword"
editable: false
extra card style:
extra card style:
pt symbols:
pt symbols:
...
...
data/magic-new-flip.mse-style/style
View file @
f5b795ac
...
@@ -366,11 +366,12 @@ extra card field:
...
@@ -366,11 +366,12 @@ extra card field:
type: choice
type: choice
name: pt box
name: pt box
script: card.card_color
script: card.card_color
editable: false
extra card field:
extra card field:
type: choice
type: choice
name: pt box 2
name: pt box 2
script: card.card_color
script: card.card_color
editable: false
extra card style:
extra card style:
pt box:
pt box:
...
...
data/magic-new-promo.mse-style/style
View file @
f5b795ac
...
@@ -269,6 +269,7 @@ extra card field:
...
@@ -269,6 +269,7 @@ extra card field:
type: choice
type: choice
name: pt box
name: pt box
script: card.card_color
script: card.card_color
editable: false
extra card style:
extra card style:
pt box:
pt box:
...
...
data/magic-new-split.mse-style/style
View file @
f5b795ac
...
@@ -410,11 +410,12 @@ extra card field:
...
@@ -410,11 +410,12 @@ extra card field:
type: choice
type: choice
name: pt box
name: pt box
script: card.card_color
script: card.card_color
editable: false
extra card field:
extra card field:
type: choice
type: choice
name: pt box 2
name: pt box 2
script: card.card_color_2
script: card.card_color_2
editable: false
extra card style:
extra card style:
pt box:
pt box:
...
...
data/magic-new.mse-style/style
View file @
f5b795ac
...
@@ -312,6 +312,7 @@ extra card field:
...
@@ -312,6 +312,7 @@ extra card field:
type: choice
type: choice
name: pt box
name: pt box
script: card.card_color
script: card.card_color
editable: false
extra card style:
extra card style:
pt box:
pt box:
...
...
data/magic-planeshifted.mse-style/style
View file @
f5b795ac
...
@@ -277,6 +277,7 @@ extra card field:
...
@@ -277,6 +277,7 @@ extra card field:
type: choice
type: choice
name: pt box
name: pt box
script: card.card_color
script: card.card_color
editable: false
extra card style:
extra card style:
pt box:
pt box:
...
...
src/data/card.cpp
View file @
f5b795ac
...
@@ -12,6 +12,7 @@
...
@@ -12,6 +12,7 @@
#include <data/field.hpp>
#include <data/field.hpp>
#include <util/error.hpp>
#include <util/error.hpp>
#include <util/reflect.hpp>
#include <util/reflect.hpp>
#include <wx/sstream.h>
DECLARE_TYPEOF_COLLECTION
(
FieldP
);
DECLARE_TYPEOF_COLLECTION
(
FieldP
);
DECLARE_TYPEOF_NO_REV
(
IndexMap
<
FieldP
COMMA
ValueP
>
);
DECLARE_TYPEOF_NO_REV
(
IndexMap
<
FieldP
COMMA
ValueP
>
);
...
@@ -51,6 +52,48 @@ void mark_dependency_member(const Card& card, const String& name, const Dependen
...
@@ -51,6 +52,48 @@ void mark_dependency_member(const Card& card, const String& name, const Dependen
IMPLEMENT_REFLECTION
(
Card
)
{
IMPLEMENT_REFLECTION
(
Card
)
{
REFLECT
(
stylesheet
);
REFLECT
(
stylesheet
);
REFLECT
(
notes
);
REFLECT
(
notes
);
REFLECT_NO_SCRIPT
(
extra_data
);
REFLECT_NAMELESS
(
data
);
REFLECT_NAMELESS
(
data
);
}
}
// ----------------------------------------------------------------------------- : Styling
// TODO : this is practically the same as Set::Styling, maybe somehow abstract it
// Extra card data, for a specific stylesheet
/* The data is not read immediatly, because we do not know the stylesheet */
class
Card
::
Styling
:
public
IntrusivePtrBase
<
Card
::
Styling
>
{
public:
/// The values on the extra card fields of the card.
/** The indices should correspond to the extra_card_fields in the StyleSheet */
IndexMap
<
FieldP
,
ValueP
>
extra_data
;
/// Unparsed extra_data
String
unread_data
;
DECLARE_REFLECTION
();
};
IndexMap
<
FieldP
,
ValueP
>&
Card
::
extraDataFor
(
const
StyleSheet
&
stylesheet
)
{
StylingP
&
styling
=
extra_data
[
stylesheet
.
name
()];
if
(
!
styling
)
{
styling
=
new_intrusive
<
Styling
>
();
styling
->
extra_data
.
init
(
stylesheet
.
extra_card_fields
);
}
else
if
(
!
styling
->
unread_data
.
empty
()
||
(
styling
->
extra_data
.
empty
())
&&
!
stylesheet
.
extra_card_fields
.
empty
())
{
// we delayed the reading of the data, read it now
styling
->
extra_data
.
init
(
stylesheet
.
extra_card_fields
);
Reader
reader
(
new_shared1
<
wxStringInputStream
>
(
styling
->
unread_data
),
_
(
"extra card values for "
)
+
stylesheet
.
stylesheetName
());
reader
.
handle_greedy
(
styling
->
extra_data
);
styling
->
unread_data
.
clear
();
}
return
styling
->
extra_data
;
}
// custom reflection : read into unread_data
template
<>
void
Reader
::
handle
(
Card
::
Styling
&
s
)
{
handle
(
s
.
unread_data
);
}
template
<>
void
Writer
::
handle
(
const
Card
::
Styling
&
s
)
{
handle
(
s
.
extra_data
);
}
// for the love of god, don't depend on styling
template
<>
void
GetMember
::
handle
(
const
Card
::
Styling
&
s
)
{}
template
<>
void
GetDefaultMember
::
handle
(
const
Card
::
Styling
&
s
)
{}
src/data/card.hpp
View file @
f5b795ac
...
@@ -34,15 +34,18 @@ class Card : public IntrusivePtrVirtualBase {
...
@@ -34,15 +34,18 @@ class Card : public IntrusivePtrVirtualBase {
/// The values on the fields of the card.
/// The values on the fields of the card.
/** The indices should correspond to the card_fields in the Game */
/** The indices should correspond to the card_fields in the Game */
IndexMap
<
FieldP
,
ValueP
>
data
;
IndexMap
<
FieldP
,
ValueP
>
data
;
/// The values on the extra fields of the card.
/** The indices should correspond to the extra_card_fields in the StyleSheet */
IndexMap
<
FieldP
,
ValueP
>
extra_data
;
/// Notes for this card
/// Notes for this card
String
notes
;
String
notes
;
/// Alternative style to use for this card
/// Alternative style to use for this card
/** Optional; if not set use the card style from the set */
/** Optional; if not set use the card style from the set */
StyleSheetP
stylesheet
;
StyleSheetP
stylesheet
;
/// Extra values for specitic stylesheets, indexed by stylesheet name
DECLARE_POINTER_TYPE
(
Styling
);
map
<
String
,
StylingP
>
extra_data
;
/// Styling information for a particular stylesheet
IndexMap
<
FieldP
,
ValueP
>&
extraDataFor
(
const
StyleSheet
&
stylesheet
)
;
/// Get the identification of this card, an identification is something like a name, title, etc.
/// Get the identification of this card, an identification is something like a name, title, etc.
/** May return "" */
/** May return "" */
String
identification
()
const
;
String
identification
()
const
;
...
...
src/data/stylesheet.cpp
View file @
f5b795ac
...
@@ -85,9 +85,9 @@ IMPLEMENT_REFLECTION(StyleSheet) {
...
@@ -85,9 +85,9 @@ IMPLEMENT_REFLECTION(StyleSheet) {
REFLECT
(
extra_card_fields
);
REFLECT
(
extra_card_fields
);
REFLECT_IF_READING
{
REFLECT_IF_READING
{
if
(
extra_card_style
.
init
(
extra_card_fields
))
{
if
(
extra_card_style
.
init
(
extra_card_fields
))
{
//
make sure the extra_card_fields are not editable and savable
//
if a value is not editable, don't save it
FOR_EACH
(
f
,
extra_card_fields
)
{
FOR_EACH
(
f
,
extra_card_fields
)
{
f
->
editable
=
f
->
save_value
=
false
;
if
(
!
f
->
editable
)
f
->
save_value
=
false
;
}
}
}
}
}
}
...
...
src/render/card/viewer.cpp
View file @
f5b795ac
...
@@ -96,8 +96,7 @@ void DataViewer::setCard(const CardP& card, bool refresh) {
...
@@ -96,8 +96,7 @@ void DataViewer::setCard(const CardP& card, bool refresh) {
this
->
card
=
card
;
this
->
card
=
card
;
stylesheet
=
new_stylesheet
;
stylesheet
=
new_stylesheet
;
setStyles
(
stylesheet
,
stylesheet
->
card_style
,
&
stylesheet
->
extra_card_style
);
setStyles
(
stylesheet
,
stylesheet
->
card_style
,
&
stylesheet
->
extra_card_style
);
card
->
extra_data
.
init
(
stylesheet
->
extra_card_fields
);
// make sure extra_data is initialized
setData
(
card
->
data
,
&
card
->
extraDataFor
(
*
stylesheet
));
setData
(
card
->
data
,
&
card
->
extra_data
);
onChangeSize
();
onChangeSize
();
}
}
...
...
src/script/script_manager.cpp
View file @
f5b795ac
...
@@ -196,8 +196,8 @@ void SetScriptManager::updateStyles(const CardP& card) {
...
@@ -196,8 +196,8 @@ void SetScriptManager::updateStyles(const CardP& card) {
const
StyleSheet
&
stylesheet
=
set
.
stylesheetFor
(
card
);
const
StyleSheet
&
stylesheet
=
set
.
stylesheetFor
(
card
);
Context
&
ctx
=
getContext
(
card
);
Context
&
ctx
=
getContext
(
card
);
// update extra card fields
// update extra card fields
card
->
extra_data
.
init
(
stylesheet
.
extra_card_fields
);
IndexMap
<
FieldP
,
ValueP
>&
extra_data
=
card
->
extraDataFor
(
stylesheet
);
FOR_EACH
(
v
,
card
->
extra_data
)
{
FOR_EACH
(
v
,
extra_data
)
{
v
->
update
(
ctx
);
v
->
update
(
ctx
);
}
}
// update all styles
// update all styles
...
...
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