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
ec72c537
Commit
ec72c537
authored
Jan 09, 2009
by
twanvl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change the time_modified of cards in actions, and restore it on undo
parent
a53551e5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
2 deletions
+17
-2
src/data/action/value.cpp
src/data/action/value.cpp
+11
-1
src/data/action/value.hpp
src/data/action/value.hpp
+6
-1
No files found.
src/data/action/value.cpp
View file @
ec72c537
...
...
@@ -16,6 +16,7 @@
#include <data/field/image.hpp>
#include <data/field/symbol.hpp>
#include <data/field/package_choice.hpp>
#include <data/card.hpp>
#include <util/tagged_string.hpp>
#include <data/set.hpp> // for ValueActionPerformer
...
...
@@ -25,8 +26,14 @@ String ValueAction::getName(bool to_undo) const {
return
_ACTION_1_
(
"change"
,
valueP
->
fieldP
->
name
);
}
void
ValueAction
::
perform
(
bool
to_undo
)
{
if
(
card
)
{
swap
(
const_cast
<
Card
*>
(
card
)
->
time_modified
,
old_time_modified
);
}
}
void
ValueAction
::
isOnCard
(
Card
*
card
)
{
const_cast
<
ValueAction
*>
(
this
)
->
card
=
card
;
this
->
card
=
card
;
}
// ----------------------------------------------------------------------------- : Simple
...
...
@@ -52,6 +59,7 @@ class SimpleValueAction : public ValueAction {
{}
virtual
void
perform
(
bool
to_undo
)
{
ValueAction
::
perform
(
to_undo
);
swap_value
(
static_cast
<
T
&>
(
*
valueP
),
new_value
);
valueP
->
onAction
(
*
this
,
to_undo
);
// notify value
}
...
...
@@ -95,6 +103,7 @@ TextValueAction::TextValueAction(const TextValueP& value, size_t start, size_t e
String
TextValueAction
::
getName
(
bool
to_undo
)
const
{
return
name
;
}
void
TextValueAction
::
perform
(
bool
to_undo
)
{
ValueAction
::
perform
(
to_undo
);
swap_value
(
value
(),
new_value
);
swap
(
selection_end
,
new_selection_end
);
valueP
->
onAction
(
*
this
,
to_undo
);
// notify value
...
...
@@ -197,6 +206,7 @@ String TextToggleReminderAction::getName(bool to_undo) const {
}
void
TextToggleReminderAction
::
perform
(
bool
to_undo
)
{
ValueAction
::
perform
(
to_undo
);
TextValue
&
value
=
static_cast
<
TextValue
&>
(
*
valueP
);
String
&
val
=
value
.
value
.
mutate
();
assert
(
pos
+
4
<
val
.
size
());
...
...
src/data/action/value.hpp
View file @
ec72c537
...
...
@@ -36,15 +36,20 @@ DECLARE_POINTER_TYPE(PackageChoiceValue);
/// An Action the changes a Value
class
ValueAction
:
public
Action
{
public:
inline
ValueAction
(
const
ValueP
&
value
)
:
valueP
(
value
),
card
(
nullptr
)
{}
inline
ValueAction
(
const
ValueP
&
value
)
:
valueP
(
value
),
card
(
nullptr
),
old_time_modified
(
wxDateTime
::
Now
())
{}
virtual
String
getName
(
bool
to_undo
)
const
;
virtual
void
perform
(
bool
to_undo
);
/// We know that the value is on the given card, add that information
void
isOnCard
(
Card
*
card
);
const
ValueP
valueP
;
///< The modified value
const
Card
*
card
;
///< The card the value is on, or null if it is not a card value
private:
wxDateTime
old_time_modified
;
};
// ----------------------------------------------------------------------------- : Simple
...
...
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