Config->add_extra_xml (*node);
Config->save_state();
- XMLNode* enode = new XMLNode (static_cast<Stateful*>(editor)->get_state());
- XMLNode* mnode = new XMLNode (mixer->get_state());
+ XMLNode enode(static_cast<Stateful*>(editor)->get_state());
+ XMLNode mnode(mixer->get_state());
if (session) {
- session->add_instant_xml(*enode, session->path());
- session->add_instant_xml(*mnode, session->path());
+ session->add_instant_xml (enode, session->path());
+ session->add_instant_xml (mnode, session->path());
} else {
- Config->add_instant_xml(*enode, get_user_ardour_path());
- Config->add_instant_xml(*mnode, get_user_ardour_path());
+ Config->add_instant_xml (enode, get_user_ardour_path());
+ Config->add_instant_xml (mnode, get_user_ardour_path());
}
/* keybindings */
void
Editor::instant_save ()
{
- if (!constructed || !ARDOUR_UI::instance()->session_loaded) {
+ if (!constructed || !ARDOUR_UI::instance()->session_loaded) {
return;
}
char buf[32];
if (is_realized()) {
- Glib::RefPtr<Gdk::Window> win = get_window();
+ Glib::RefPtr<Gdk::Window> win = get_window();
int x, y, xoff, yoff, width, height;
win->get_root_origin(x, y);
_npan_buffers = howmany;
}
-void
-Session::add_instant_xml (XMLNode& node, const std::string& dir)
-{
- Stateful::add_instant_xml (node, dir);
- Config->add_instant_xml (node, get_user_ardour_path());
-}
-
int
Session::freeze (InterThreadInfo& itt)
{
return 0;
}
+
+void
+Session::add_instant_xml (XMLNode& node, const std::string& dir)
+{
+ Stateful::add_instant_xml (node, dir);
+ Config->add_instant_xml (node, get_user_ardour_path());
+}
string _filename;
XMLNode *_root;
int _compression;
- bool _initialized;
public:
XMLTree();
XMLTree(const XMLTree *);
~XMLTree();
- bool initialized() const { return _initialized; };
XMLNode *root() const { return _root; };
- XMLNode *set_root(XMLNode *n) { _initialized = true; return _root = n; };
+ XMLNode *set_root(XMLNode *n) { return _root = n; };
const string & filename() const { return _filename; };
const string & set_filename(const string &fn) { return _filename = fn; };
class XMLNode {
private:
- bool _initialized;
string _name;
bool _is_content;
string _content;
XMLNode(const XMLNode&);
~XMLNode();
- bool initialized() const { return _initialized; };
const string name() const { return _name; };
bool is_content() const { return _is_content; };
const string & content() const { return _content; };
- const string & set_content(const string &);
+ const string & set_content (const string &);
XMLNode *add_content(const string & = string());
- const XMLNodeList & children(const string & = string()) const;
- XMLNode *add_child(const char *);
- XMLNode *add_child_copy(const XMLNode&);
- void add_child_nocopy (XMLNode&);
+ const XMLNodeList & children (const string & = string()) const;
+ XMLNode *add_child (const char *);
+ XMLNode *add_child_copy (const XMLNode&);
+ void add_child_nocopy (XMLNode&);
const XMLPropertyList & properties() const { return _proplist; };
XMLProperty *property(const char * );
}
_instant_xml->remove_nodes_and_delete (node.name());
- _instant_xml->add_child_nocopy (node);
+ _instant_xml->add_child_copy (node);
XMLTree tree;
tree.set_filename(dir+"/instant.xml");
return 0;
}
-
XMLTree::XMLTree()
: _filename(),
- _root(),
- _compression(0),
- _initialized(false)
+ _root(0),
+ _compression(0)
{
}
XMLTree::XMLTree(const string &fn)
: _filename(fn),
_root(0),
- _compression(0),
- _initialized(false)
+ _compression(0)
{
read();
}
_filename = from->filename();
_root = new XMLNode(*from->root());
_compression = from->compression();
- _initialized = true;
}
XMLTree::~XMLTree()
{
- if (_initialized && _root)
+ if (_root) {
delete _root;
+ }
}
int
doc = xmlParseFile(_filename.c_str());
if (!doc) {
- _initialized = false;
return false;
}
_root = readnode(xmlDocGetRootElement(doc));
xmlFreeDoc(doc);
- _initialized = true;
return true;
}
doc = xmlParseMemory((char *) buffer.c_str(), buffer.length());
if (!doc) {
- _initialized = false;
return false;
}
_root = readnode(xmlDocGetRootElement(doc));
xmlFreeDoc(doc);
- _initialized = true;
return true;
}
XMLNode::XMLNode(const string & n)
: _name(n), _is_content(false), _content(string())
{
- if (_name.empty()) {
- _initialized = false;
- } else {
- _initialized = true;
- }
}
XMLNode::XMLNode(const string & n, const string & c)
:_name(n), _is_content(true), _content(c)
{
- _initialized = true;
}
XMLNode::XMLNode(const XMLNode& from)
- : _initialized(false)
{
XMLPropertyList props;
XMLPropertyIterator curprop;