Ardour  9.0-pre0-582-g084a23a80d
element_importer.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2008-2009 Sakari Bergen <sakari.bergen@beatwaves.net>
3  * Copyright (C) 2009-2010 Carl Hetherington <carl@carlh.net>
4  * Copyright (C) 2009-2017 Paul Davis <paul@linuxaudiosystems.com>
5  * Copyright (C) 2009 David Robillard <d@drobilla.net>
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License along
18  * with this program; if not, write to the Free Software Foundation, Inc.,
19  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20  */
21 
22 #pragma once
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 
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::Signal<std::pair<bool, std::string>(std::string, std::string)> Rename;
77 
79  static PBD::Signal<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 
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 
Virtual interface class for element importers.
bool queued()
Ture if the element has been prepared and queued for importing.
virtual void _cancel_move()=0
Cancel move.
void move()
Moves the element to the taget session.
static PBD::Signal< std::pair< bool, std::string >std::string, std::string)> Rename
Signal that requests for anew name.
virtual bool _prepare_move()=0
std::string rate_convert_samples(std::string const &samples) const
Converts samples so that times match the sessions sample rate (for straight use in XML)
virtual std::string get_name() const
XMLTree const & source
Source XML-tree.
void set_broken()
Set element broken.
virtual std::string get_info() const =0
static PBD::Signal< bool(std::string)> Prompt
Signal for ok/cancel prompting.
samplecnt_t rate_convert_samples(samplecnt_t samples) const
Converts samples so that times match the sessions sample rate.
ARDOUR::Session & session
Target session.
samplecnt_t sample_rate
The sample rate of the session from which we are importing.
bool broken()
Check if element is broken. Cannot be moved if broken.
std::string name
Name of element.
virtual void _move()=0
ElementImporter(XMLTree const &source, ARDOUR::Session &session)
virtual ImportStatus * get_import_status()
std::string timecode_to_string(Timecode::Time &time) const
Converts timecode time to a string.
Definition: xml++.h:74
GtkImageIconNameData name
Definition: gtkimage.h:6
#define LIBARDOUR_API
void session(lua_State *L)
Temporal::samplecnt_t samplecnt_t