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
031c8c62
Commit
031c8c62
authored
Aug 11, 2008
by
twanvl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Partial support for add multiple cards scripts, not visible to users yet
parent
f8d23544
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
138 additions
and
27 deletions
+138
-27
src/data/add_cards_script.cpp
src/data/add_cards_script.cpp
+52
-0
src/data/add_cards_script.hpp
src/data/add_cards_script.hpp
+38
-0
src/data/game.cpp
src/data/game.cpp
+2
-0
src/data/game.hpp
src/data/game.hpp
+2
-0
src/gui/set/cards_panel.cpp
src/gui/set/cards_panel.cpp
+6
-0
src/gui/set/cards_panel.hpp
src/gui/set/cards_panel.hpp
+2
-1
src/mse.vcproj
src/mse.vcproj
+6
-0
src/util/window_id.hpp
src/util/window_id.hpp
+30
-26
No files found.
src/data/add_cards_script.cpp
0 → 100644
View file @
031c8c62
//+----------------------------------------------------------------------------+
//| Description: Magic Set Editor - Program to make Magic (tm) cards |
//| Copyright: (C) 2001 - 2008 Twan van Laarhoven and "coppro" |
//| License: GNU General Public License 2 or later (see file COPYING) |
//+----------------------------------------------------------------------------+
// ----------------------------------------------------------------------------- : Includes
#include <util/prec.hpp>
#include <data/add_cards_script.hpp>
#include <data/action/set.hpp>
#include <data/set.hpp>
#include <data/card.hpp>
#include <data/stylesheet.hpp>
// ----------------------------------------------------------------------------- : AddCardsScript
IMPLEMENT_REFLECTION_NO_SCRIPT
(
AddCardsScript
)
{
REFLECT
(
name
);
REFLECT
(
description
);
REFLECT
(
enabled
);
REFLECT
(
script
);
}
void
AddCardsScript
::
perform
(
Set
&
set
,
vector
<
CardP
>&
out
)
{
// Perform script
Context
&
ctx
=
set
.
getContext
();
ScriptValueP
result
=
script
.
invoke
(
ctx
);
// Add cards to out
ScriptValueP
it
=
result
->
makeIterator
(
result
);
while
(
ScriptValueP
item
=
it
->
next
())
{
CardP
card
=
from_script
<
CardP
>
(
item
);
// is this a new card?
if
(
contains
(
set
.
cards
,
card
)
||
contains
(
out
,
card
))
{
// make copy
card
=
new_intrusive1
<
Card
>
(
*
card
);
}
out
.
push_back
(
card
);
}
}
void
AddCardsScript
::
perform
(
Set
&
set
)
{
// Perform script
vector
<
CardP
>
cards
;
perform
(
set
,
cards
);
// Add to set
if
(
!
cards
.
empty
())
{
// TODO: change the name of the action somehow
set
.
actions
.
addAction
(
new
AddCardAction
(
ADD
,
set
,
cards
));
}
}
src/data/add_cards_script.hpp
0 → 100644
View file @
031c8c62
//+----------------------------------------------------------------------------+
//| Description: Magic Set Editor - Program to make Magic (tm) cards |
//| Copyright: (C) 2001 - 2008 Twan van Laarhoven and "coppro" |
//| License: GNU General Public License 2 or later (see file COPYING) |
//+----------------------------------------------------------------------------+
#ifndef HEADER_DATA_ADD_CARDS_SCRIPT
#define HEADER_DATA_ADD_CARDS_SCRIPT
// ----------------------------------------------------------------------------- : Includes
#include <util/prec.hpp>
#include <script/scriptable.hpp>
class
Set
;
DECLARE_POINTER_TYPE
(
Card
);
// ----------------------------------------------------------------------------- : AddCardsScript
/// A script to add one or more cards to a set
class
AddCardsScript
:
public
IntrusivePtrBase
<
AddCardsScript
>
{
public:
String
name
;
String
description
;
Scriptable
<
bool
>
enabled
;
OptionalScript
script
;
/// Perform the script; return the cards (if any)
void
perform
(
Set
&
set
,
vector
<
CardP
>&
out
);
/// Perform the script; add cards to the set
void
perform
(
Set
&
set
);
DECLARE_REFLECTION
();
};
// ----------------------------------------------------------------------------- : EOF
#endif
src/data/game.cpp
View file @
031c8c62
...
...
@@ -14,6 +14,7 @@
#include <data/statistics.hpp>
#include <data/pack.hpp>
#include <data/word_list.hpp>
#include <data/add_cards_script.hpp>
#include <util/io/package_manager.hpp>
#include <script/script.hpp>
...
...
@@ -61,6 +62,7 @@ IMPLEMENT_REFLECTION(Game) {
REFLECT
(
keyword_parameter_types
);
REFLECT_NO_SCRIPT
(
keywords
);
REFLECT_NO_SCRIPT
(
word_lists
);
REFLECT_NO_SCRIPT
(
add_cards_scripts
);
REFLECT_NO_SCRIPT
(
auto_replaces
);
}
...
...
src/data/game.hpp
View file @
031c8c62
...
...
@@ -26,6 +26,7 @@ DECLARE_POINTER_TYPE(KeywordParam);
DECLARE_POINTER_TYPE
(
KeywordMode
);
DECLARE_POINTER_TYPE
(
Keyword
);
DECLARE_POINTER_TYPE
(
WordList
);
DECLARE_POINTER_TYPE
(
AddCardsScript
);
DECLARE_POINTER_TYPE
(
AutoReplace
);
// ----------------------------------------------------------------------------- : Game
...
...
@@ -48,6 +49,7 @@ class Game : public Packaged {
vector
<
PackItemP
>
pack_items
;
///< Types of cards in packs
vector
<
PackTypeP
>
pack_types
;
///< Types of random card packs to generate
vector
<
WordListP
>
word_lists
;
///< Word lists for editing with a drop down list
vector
<
AddCardsScriptP
>
add_cards_scripts
;
///< Scripts for adding multiple cards to the set
vector
<
AutoReplaceP
>
auto_replaces
;
///< Things to autoreplace in textboxes
bool
has_keywords
;
///< Does this game use keywords?
...
...
src/gui/set/cards_panel.cpp
View file @
031c8c62
...
...
@@ -17,7 +17,9 @@
#include <gui/icon_menu.hpp>
#include <gui/util.hpp>
#include <data/set.hpp>
#include <data/game.hpp>
#include <data/card.hpp>
#include <data/add_cards_script.hpp>
#include <data/action/set.hpp>
#include <data/settings.hpp>
#include <util/find_replace.hpp>
...
...
@@ -280,6 +282,10 @@ void CardsPanel::onCommand(int id) {
if
(
id
>=
ID_INSERT_SYMBOL_MENU_MIN
&&
id
<=
ID_INSERT_SYMBOL_MENU_MAX
)
{
// pass on to editor
editor
->
onCommand
(
id
);
}
else
if
(
id
>=
ID_ADD_CARDS_MENU_MIN
&&
id
<=
ID_ADD_CARDS_MENU_MAX
)
{
// add multiple cards
AddCardsScriptP
script
=
set
->
game
->
add_cards_scripts
.
at
(
id
-
ID_ADD_CARDS_MENU_MIN
);
script
->
perform
(
*
set
);
}
}
}
...
...
src/gui/set/cards_panel.hpp
View file @
031c8c62
...
...
@@ -90,7 +90,8 @@ class CardsPanel : public SetWindowPanel {
// --------------------------------------------------- : Menus & tools
IconMenu
*
menuCard
,
*
menuFormat
;
wxMenuItem
*
insertSymbolMenu
;
// owned by menuFormat, but submenu owned by SymbolFont
wxMenuItem
*
insertSymbolMenu
;
// owned by menuFormat, but submenu owned by SymbolFont
wxMenuItem
*
insertManyCardsMenu
;
// owned my menuCard, but submenu can be changed
};
// ----------------------------------------------------------------------------- : EOF
...
...
src/mse.vcproj
View file @
031c8c62
...
...
@@ -1853,6 +1853,12 @@
<Filter
Name=
"aux"
Filter=
""
>
<File
RelativePath=
".\data\add_cards_script.cpp"
>
</File>
<File
RelativePath=
".\data\add_cards_script.hpp"
>
</File>
<File
RelativePath=
".\data\draw_what.hpp"
>
</File>
...
...
src/util/window_id.hpp
View file @
031c8c62
...
...
@@ -90,11 +90,11 @@ enum MenuID {
/// Ids for menus on child panels (MainWindowPanel / SymbolEditorBase)
enum
ChildMenuID
{
ID_CHILD_MIN
=
1
000
,
ID_CHILD_MAX
=
3
999
ID_CHILD_MIN
=
6
000
,
ID_CHILD_MAX
=
16
999
// Cards menu
,
ID_CARD_ADD
=
1
001
,
ID_CARD_ADD
=
6
001
,
ID_CARD_ADD_MULT
,
ID_CARD_REMOVE
,
ID_CARD_PREV
...
...
@@ -108,27 +108,27 @@ enum ChildMenuID {
,
ID_SELECT_COLUMNS
// Keyword menu
,
ID_KEYWORD_ADD
=
1
101
,
ID_KEYWORD_ADD
=
6
101
,
ID_KEYWORD_REMOVE
,
ID_KEYWORD_PREV
,
ID_KEYWORD_NEXT
// Format menu
,
ID_FORMAT_BOLD
=
1
201
,
ID_FORMAT_BOLD
=
6
201
,
ID_FORMAT_ITALIC
,
ID_FORMAT_SYMBOL
,
ID_FORMAT_REMINDER
,
ID_INSERT_SYMBOL
// Graph menu
,
ID_GRAPH_PIE
=
1
301
// corresponds to GraphType
,
ID_GRAPH_PIE
=
6
301
// corresponds to GraphType
,
ID_GRAPH_BAR
,
ID_GRAPH_STACK
,
ID_GRAPH_SCATTER
,
ID_GRAPH_SCATTER_PIE
// SymbolSelectEditor toolbar/menu
,
ID_SYMBOL_COMBINE
=
2
001
,
ID_SYMBOL_COMBINE
=
7
001
,
ID_SYMBOL_COMBINE_MERGE
=
ID_SYMBOL_COMBINE
+
0
//SYMBOL_COMBINE_MERGE
,
ID_SYMBOL_COMBINE_SUBTRACT
=
ID_SYMBOL_COMBINE
+
1
//SYMBOL_COMBINE_SUBTRACT
,
ID_SYMBOL_COMBINE_INTERSECTION
=
ID_SYMBOL_COMBINE
+
2
//SYMBOL_COMBINE_INTERSECTION
...
...
@@ -143,18 +143,18 @@ enum ChildMenuID {
,
ID_VIEW_GRID_SNAP
// SymbolPointEditor toolbar/menu
,
ID_SEGMENT
=
2
101
,
ID_SEGMENT
=
7
101
,
ID_SEGMENT_LINE
=
ID_SEGMENT
+
0
//SEGMENT_LINE
,
ID_SEGMENT_CURVE
=
ID_SEGMENT
+
1
//SEGMENT_CURVE
,
ID_SEGMENT_MAX
,
ID_LOCK
=
2
151
,
ID_LOCK
=
7
151
,
ID_LOCK_FREE
=
ID_LOCK
+
0
//LOCK_FREE
,
ID_LOCK_DIR
=
ID_LOCK
+
1
//LOCK_DIR
,
ID_LOCK_SIZE
=
ID_LOCK
+
2
//LOCK_SIZE
,
ID_LOCK_MAX
// SymbolBasicShapeEditor toolbar/menu
,
ID_SHAPE
=
2
201
,
ID_SHAPE
=
7
201
,
ID_SHAPE_CIRCLE
=
ID_SHAPE
,
ID_SHAPE_RECTANGLE
,
ID_SHAPE_POLYGON
...
...
@@ -163,7 +163,7 @@ enum ChildMenuID {
,
ID_SIDES
// SymbolSymmetryEditor toolbar/menu
,
ID_SYMMETRY
=
2
301
,
ID_SYMMETRY
=
7
301
,
ID_SYMMETRY_ROTATION
=
ID_SYMMETRY
,
ID_SYMMETRY_REFLECTION
,
ID_SYMMETRY_MAX
...
...
@@ -172,33 +172,37 @@ enum ChildMenuID {
,
ID_COPIES
// On cards panel
,
ID_COLLAPSE_NOTES
=
3
001
,
ID_COLLAPSE_NOTES
=
8
001
// Style panel
,
ID_STYLE_USE_FOR_ALL
=
3
011
,
ID_STYLE_USE_FOR_ALL
=
8
011
,
ID_STYLE_USE_CUSTOM
// Keywords panel
,
ID_KEYWORD_ADD_PARAM
=
3
021
,
ID_KEYWORD_ADD_PARAM
=
8
021
,
ID_KEYWORD_REF_PARAM
,
ID_KEYWORD_MODE
,
ID_PARAM_TYPE_MIN
=
3
101
,
ID_PARAM_TYPE_MAX
=
3199
,
ID_PARAM_REF_MIN
=
3
201
,
ID_PARAM_REF_MAX
=
3299
,
ID_PARAM_TYPE_MIN
=
8
101
,
ID_PARAM_TYPE_MAX
=
8200
,
ID_PARAM_REF_MIN
=
8
201
,
ID_PARAM_REF_MAX
=
8300
// Statistics panel
,
ID_FIELD_LIST
=
303
1
,
ID_FIELD_LIST
=
830
1
// Random pack panel
,
ID_PACK_AMOUNT
=
304
1
,
ID_PACK_AMOUNT
=
811
1
,
ID_SEED_RANDOM
,
ID_SEED_FIXED
,
ID_GENERATE_PACK
// SymbolFont (Format menu)
,
ID_INSERT_SYMBOL_MENU_MIN
=
3301
,
ID_INSERT_SYMBOL_MENU_MAX
=
3999
,
ID_INSERT_SYMBOL_MENU_MIN
=
9001
,
ID_INSERT_SYMBOL_MENU_MAX
=
10000
// AddCardsScript (Card menu)
,
ID_ADD_CARDS_MENU_MIN
=
10001
,
ID_ADD_CARDS_MENU_MAX
=
11000
};
...
...
@@ -207,11 +211,11 @@ enum ChildMenuID {
/// Window ids for controls
enum
ControlID
{
ID_CONTROL_MIN
=
6
000
,
ID_CONTROL_MAX
=
6
999
ID_CONTROL_MIN
=
1
000
,
ID_CONTROL_MAX
=
1
999
// Controls
,
ID_VIEWER
=
6
001
,
ID_VIEWER
=
1
001
,
ID_EDITOR
,
ID_CONTROL
,
ID_TAB_BAR
...
...
@@ -234,7 +238,7 @@ enum ControlID {
// Card select
,
ID_SELECT_CARDS
,
ID_SELECTION_CHOICE
,
ID_SELECTION_CHOICE_MAX
=
ID_SELECTION_CHOICE
+
10
,
ID_SELECTION_CHOICE_MAX
=
ID_SELECTION_CHOICE
+
10
0
,
ID_SELECT_ALL
,
ID_SELECT_NONE
// Settings
...
...
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