Ardour
9.0-pre0-582-g084a23a80d
tempo_map_change.h
Go to the documentation of this file.
1
/*
2
Copyright (C) 2022 Paul Davis
3
4
This program is free software; you can redistribute it and/or modify
5
it under the terms of the GNU General Public License as published by
6
the Free Software Foundation; either version 2 of the License, or
7
(at your option) any later version.
8
9
This program is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
GNU General Public License for more details.
13
14
You should have received a copy of the GNU General Public License
15
along with this program; if not, write to the Free Software
16
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
*/
18
19
#include <string>
20
21
#include "
temporal/tempo.h
"
22
23
#include "
public_editor.h
"
24
25
/* RAII for tempo map edits. This object manages both Tempo map RCU stuff, plus
26
* reversible command state, removing the need for repeated boilerplate at each
27
* map edit site.
28
*
29
* One complication: GUI tempo map markers are all reassociated with the
30
* relevant points of the write-copy of the map during ::begin() (typically
31
* called in the constructor, unless it's begin argument is false). You must
32
* delay getting a reference on a point to edit until after the TempoMapChange
33
* object has called begin() (i.e. has been constructed), otherwise the
34
* reference will point to the "old" copy of the map.
35
*/
36
37
class
TempoMapChange
{
38
public
:
39
TempoMapChange
(
PublicEditor
& e, std::string
const
&
name
,
bool
update_on_commit
=
true
,
bool
begin
=
true
);
40
~TempoMapChange
();
41
42
void
begin
();
43
void
abort
();
44
void
use_new_map
(
Temporal::TempoMap::WritableSharedPtr
);
45
46
Temporal::TempoMap
&
map
()
const
{
return
*
writable_map
.get(); }
47
48
private
:
49
PublicEditor
&
editor
;
50
Temporal::TempoMap::WritableSharedPtr
writable_map
;
51
std::string
name
;
52
bool
aborted
;
53
bool
begun
;
54
bool
update_on_commit
;
55
XMLNode
*
before
;
56
};
PublicEditor
Representation of the interface of the Editor class.
Definition:
public_editor.h:127
TempoMapChange
Definition:
tempo_map_change.h:37
TempoMapChange::writable_map
Temporal::TempoMap::WritableSharedPtr writable_map
Definition:
tempo_map_change.h:50
TempoMapChange::editor
PublicEditor & editor
Definition:
tempo_map_change.h:49
TempoMapChange::use_new_map
void use_new_map(Temporal::TempoMap::WritableSharedPtr)
TempoMapChange::begin
void begin()
TempoMapChange::map
Temporal::TempoMap & map() const
Definition:
tempo_map_change.h:46
TempoMapChange::~TempoMapChange
~TempoMapChange()
TempoMapChange::aborted
bool aborted
Definition:
tempo_map_change.h:52
TempoMapChange::name
std::string name
Definition:
tempo_map_change.h:51
TempoMapChange::begun
bool begun
Definition:
tempo_map_change.h:53
TempoMapChange::abort
void abort()
TempoMapChange::TempoMapChange
TempoMapChange(PublicEditor &e, std::string const &name, bool update_on_commit=true, bool begin=true)
TempoMapChange::update_on_commit
bool update_on_commit
Definition:
tempo_map_change.h:54
TempoMapChange::before
XMLNode * before
Definition:
tempo_map_change.h:55
Temporal::TempoMap
Definition:
temporal/temporal/tempo.h:694
Temporal::TempoMap::WritableSharedPtr
std::shared_ptr< TempoMap > WritableSharedPtr
Definition:
temporal/temporal/tempo.h:734
XMLNode
Definition:
xml++.h:114
public_editor.h
tempo.h
gtk2_ardour
tempo_map_change.h
Generated on Wed Dec 25 2024 05:44:52 for Ardour by
1.9.1