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
e00fadbe
Commit
e00fadbe
authored
Oct 19, 2006
by
twanvl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added multiple choice field
parent
54adf711
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
137 additions
and
6 deletions
+137
-6
src/data/field/boolean.cpp
src/data/field/boolean.cpp
+3
-3
src/data/field/choice.cpp
src/data/field/choice.cpp
+3
-0
src/data/field/choice.hpp
src/data/field/choice.hpp
+4
-3
src/data/field/multiple_choice.cpp
src/data/field/multiple_choice.cpp
+58
-0
src/data/field/multiple_choice.hpp
src/data/field/multiple_choice.hpp
+69
-0
No files found.
src/data/field/boolean.cpp
View file @
e00fadbe
...
@@ -11,9 +11,9 @@
...
@@ -11,9 +11,9 @@
// ----------------------------------------------------------------------------- : BooleanField
// ----------------------------------------------------------------------------- : BooleanField
BooleanField
::
BooleanField
()
{
BooleanField
::
BooleanField
()
{
//
choices->choices.push_back(new_shared1<Choice>(_("yes")));
choices
->
choices
.
push_back
(
new_shared1
<
Choice
>
(
_
(
"yes"
)));
//
choices->choices.push_back(new_shared1<Choice>(_("no")));
choices
->
choices
.
push_back
(
new_shared1
<
Choice
>
(
_
(
"no"
)));
//
choices->initIds();
choices
->
initIds
();
}
}
StyleP
BooleanField
::
newStyle
(
const
FieldP
&
thisP
)
const
{
StyleP
BooleanField
::
newStyle
(
const
FieldP
&
thisP
)
const
{
...
...
src/data/field/choice.cpp
View file @
e00fadbe
...
@@ -43,6 +43,9 @@ IMPLEMENT_REFLECTION(ChoiceField) {
...
@@ -43,6 +43,9 @@ IMPLEMENT_REFLECTION(ChoiceField) {
ChoiceField
::
Choice
::
Choice
()
ChoiceField
::
Choice
::
Choice
()
:
first_id
(
0
)
:
first_id
(
0
)
{}
{}
ChoiceField
::
Choice
::
Choice
(
const
String
&
name
)
:
first_id
(
0
),
name
(
name
)
{}
bool
ChoiceField
::
Choice
::
isGroup
()
const
{
bool
ChoiceField
::
Choice
::
isGroup
()
const
{
...
...
src/data/field/choice.hpp
View file @
e00fadbe
...
@@ -42,6 +42,9 @@ class ChoiceField : public Field {
...
@@ -42,6 +42,9 @@ class ChoiceField : public Field {
/// An item that can be chosen for this field
/// An item that can be chosen for this field
class
ChoiceField
::
Choice
{
class
ChoiceField
::
Choice
{
public:
public:
Choice
();
Choice
(
const
String
&
name
);
String
name
;
///< Name/value of the item
String
name
;
///< Name/value of the item
String
default_name
;
///< A default item, if this is a group and default_name.empty() there is no default
String
default_name
;
///< A default item, if this is a group and default_name.empty() there is no default
vector
<
ChoiceP
>
choices
;
///< Choices and sub groups in this group
vector
<
ChoiceP
>
choices
;
///< Choices and sub groups in this group
...
@@ -50,9 +53,7 @@ class ChoiceField::Choice {
...
@@ -50,9 +53,7 @@ class ChoiceField::Choice {
* The top level group has first_id 0.
* The top level group has first_id 0.
*/
*/
int
first_id
;
int
first_id
;
Choice
();
/// Is this a group?
/// Is this a group?
bool
isGroup
()
const
;
bool
isGroup
()
const
;
/// Can this Choice itself be chosen?
/// Can this Choice itself be chosen?
...
...
src/data/field/multiple_choice.cpp
0 → 100644
View file @
e00fadbe
//+----------------------------------------------------------------------------+
//| 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 <data/field/multiple_choice.hpp>
// ----------------------------------------------------------------------------- : MultipleChoiceField
MultipleChoiceField
::
MultipleChoiceField
()
:
minimum_selection
(
0
)
,
maximum_selection
(
1000000
)
{}
StyleP
MultipleChoiceField
::
newStyle
(
const
FieldP
&
thisP
)
const
{
return
new_shared
<
MultipleChoiceStyle
>
();
}
ValueP
MultipleChoiceField
::
newValue
(
const
FieldP
&
thisP
)
const
{
return
new_shared
<
MultipleChoiceValue
>
();
}
String
MultipleChoiceField
::
typeName
()
const
{
return
_
(
"multiple choice"
);
}
IMPLEMENT_REFLECTION
(
MultipleChoiceField
)
{
REFLECT_BASE
(
ChoiceField
);
REFLECT
(
minimum_selection
);
REFLECT
(
maximum_selection
);
}
// ----------------------------------------------------------------------------- : MultipleChoiceStyle
MultipleChoiceStyle
::
MultipleChoiceStyle
()
:
direction
(
HORIZONTAL
)
,
spacing
(
0
)
{}
IMPLEMENT_REFLECTION_ENUM
(
Direction
)
{
VALUE_N
(
"horizontal"
,
HORIZONTAL
);
VALUE_N
(
"vertical"
,
VERTICAL
);
}
IMPLEMENT_REFLECTION
(
MultipleChoiceStyle
)
{
REFLECT_BASE
(
ChoiceStyle
);
REFLECT
(
direction
);
REFLECT
(
spacing
);
}
// ----------------------------------------------------------------------------- : MultipleChoiceValue
IMPLEMENT_REFLECTION_NAMELESS
(
MultipleChoiceValue
)
{
REFLECT_BASE
(
ChoiceValue
);
}
src/data/field/multiple_choice.hpp
0 → 100644
View file @
e00fadbe
//+----------------------------------------------------------------------------+
//| 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_DATA_FIELD_MULTIPLE_CHOICE
#define HEADER_DATA_FIELD_MULTIPLE_CHOICE
// ----------------------------------------------------------------------------- : Includes
#include <util/prec.hpp>
#include <data/field/choice.hpp>
// ----------------------------------------------------------------------------- : MultipleChoiceField
/// A ChoiceField where multiple choices can be selected simultaniously
class
MultipleChoiceField
:
public
ChoiceField
{
public:
MultipleChoiceField
();
UInt
minimum_selection
,
maximum_selection
;
///< How many choices can be selected simultaniously?
virtual
ValueP
newValue
(
const
FieldP
&
thisP
)
const
;
virtual
StyleP
newStyle
(
const
FieldP
&
thisP
)
const
;
virtual
String
typeName
()
const
;
private:
DECLARE_REFLECTION
();
};
// ----------------------------------------------------------------------------- : MultipleChoiceStyle
enum
Direction
{
HORIZONTAL
,
VERTICAL
};
/// The Style for a MultipleChoiceField
class
MultipleChoiceStyle
:
public
ChoiceStyle
{
public:
MultipleChoiceStyle
();
Direction
direction
;
///< In what direction are choices layed out?
double
spacing
;
///< Spacing between choices (images) in pixels
private:
DECLARE_REFLECTION
();
};
// ----------------------------------------------------------------------------- : MultipleChoiceValue
/// The Value in a MultipleChoiceField
/** The value is stored as "<choice>, <choice>, <choice>"
* The choices must be ordered by id
*/
class
MultipleChoiceValue
:
public
ChoiceValue
{
public:
// no extra data
/// Splits the value, stores the selected choices in the out parameter
void
get
(
vector
<
String
>&
out
);
private:
DECLARE_REFLECTION
();
};
// ----------------------------------------------------------------------------- : EOF
#endif
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