ardour
element_importer.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2008 Paul Davis
3  Author: Sakari Bergen
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program; if not, write to the Free Software
17  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 
19 */
20 
21 #ifndef __ardour_element_importer_h__
22 #define __ardour_element_importer_h__
23 
24 #include <string>
25 #include <utility>
26 
27 #include "pbd/signals.h"
29 #include "ardour/types.h"
30 
31 class XMLTree;
32 namespace ARDOUR {
33 
34 class Session;
35 class ImportStatus;
36 
39 {
40  public:
41 
42  ElementImporter (XMLTree const & source, ARDOUR::Session & session);
43  virtual ~ElementImporter ();
44 
48  virtual std::string get_name () const { return name; };
49 
53  virtual std::string get_info () const = 0;
54 
56  virtual ImportStatus * get_import_status () { return 0; }
57 
62  bool prepare_move ();
63 
67  void cancel_move ();
68 
70  void move ();
71 
73  bool broken () { return _broken; }
74 
76  static PBD::Signal2<std::pair<bool, std::string>,std::string, std::string> Rename;
77 
79  static PBD::Signal1<bool,std::string> Prompt;
80 
81  protected:
82 
87  virtual void _move () = 0;
88 
95  virtual bool _prepare_move () = 0;
96 
98  virtual void _cancel_move () = 0;
99 
101  XMLTree const & source;
102 
105 
107  bool queued () { return _queued; }
108 
110  std::string name;
111 
114 
116  std::string timecode_to_string (Timecode::Time & time) const;
117 
119  framecnt_t rate_convert_samples (framecnt_t samples) const;
120 
122  std::string rate_convert_samples (std::string const & samples) const;
123 
125  void set_broken () { _broken = true; }
126 
127  private:
128  bool _queued;
129  bool _broken;
130 };
131 
132 } // namespace ARDOUR
133 
134 #endif
framecnt_t sample_rate
The sample rate of the session from which we are importing.
std::string name
Name of element.
ARDOUR::Session & session
Target session.
static PBD::Signal2< std::pair< bool, std::string >, std::string, std::string > Rename
Signal that requests for anew name.
Definition: xml++.h:55
Virtual interface class for element importers.
bool queued()
Ture if the element has been prepared and queued for importing.
int64_t framecnt_t
Definition: types.h:76
virtual ImportStatus * get_import_status()
Definition: amp.h:29
#define LIBARDOUR_API
const char * name
XMLTree const & source
Source XML-tree.
virtual std::string get_name() const
void set_broken()
Set element broken.
static PBD::Signal1< bool, std::string > Prompt
Signal for ok/cancel prompting.
bool broken()
Check if element is broken. Cannot be moved if broken.