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
892bf255
Commit
892bf255
authored
Dec 22, 2006
by
twanvl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
actions for changing styles
parent
5edd47df
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
0 deletions
+56
-0
src/data/action/set.cpp
src/data/action/set.cpp
+24
-0
src/data/action/set.hpp
src/data/action/set.hpp
+32
-0
No files found.
src/data/action/set.cpp
View file @
892bf255
...
...
@@ -77,3 +77,27 @@ void ReorderCardsAction::perform(bool to_undo) {
assert
(
card_id2
<
set
.
cards
.
size
());
swap
(
set
.
cards
[
card_id1
],
set
.
cards
[
card_id2
]);
}
// ----------------------------------------------------------------------------- : Change stylesheet
String
ChangeCardStyleAction
::
getName
(
bool
to_undo
)
const
{
return
_
(
"Change style"
);
}
void
ChangeCardStyleAction
::
perform
(
bool
to_undo
)
{
swap
(
card
->
stylesheet
,
stylesheet
);
}
String
ChangeSetStyleAction
::
getName
(
bool
to_undo
)
const
{
return
_
(
"Change style (all cards)"
);
}
void
ChangeSetStyleAction
::
perform
(
bool
to_undo
)
{
if
(
!
to_undo
)
{
stylesheet
=
set
.
stylesheet
;
set
.
stylesheet
=
card
->
stylesheet
;
card
->
stylesheet
=
StyleSheetP
();
}
else
{
card
->
stylesheet
=
set
.
stylesheet
;
set
.
stylesheet
=
stylesheet
;
}
}
src/data/action/set.hpp
View file @
892bf255
...
...
@@ -19,6 +19,7 @@
class
Set
;
DECLARE_POINTER_TYPE
(
Card
);
DECLARE_POINTER_TYPE
(
StyleSheet
);
// ----------------------------------------------------------------------------- : Add card
...
...
@@ -73,5 +74,36 @@ class ReorderCardsAction : public CardListAction {
const
size_t
card_id1
,
card_id2
;
///< Positions of the two cards to swap
};
// ----------------------------------------------------------------------------- : Change stylesheet
/// Changing the style of a a card
class
ChangeCardStyleAction
:
public
Action
{
public:
ChangeCardStyleAction
(
const
CardP
&
card
,
const
StyleSheetP
&
stylesheet
)
:
card
(
card
),
stylesheet
(
stylesheet
)
{}
virtual
String
getName
(
bool
to_undo
)
const
;
virtual
void
perform
(
bool
to_undo
);
//private:
CardP
card
;
///< The affected card
StyleSheetP
stylesheet
;
///< Its new stylesheet
};
/// Changing the style of a set to that of a card
class
ChangeSetStyleAction
:
public
Action
{
public:
ChangeSetStyleAction
(
Set
&
set
,
const
CardP
&
card
)
:
set
(
set
),
card
(
card
)
{}
virtual
String
getName
(
bool
to_undo
)
const
;
virtual
void
perform
(
bool
to_undo
);
private:
Set
&
set
;
///< The affected set
CardP
card
;
///< The card whos stylesheet is copied to the set
StyleSheetP
stylesheet
;
///< The old stylesheet of the set
};
// ----------------------------------------------------------------------------- : 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