4 * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 static const char *xml_titles[AUTOMATION_TOTAL] =
43 static int auto_defaults[AUTOMATION_TOTAL] =
59 int AutoConf::load_defaults(BC_Hash* defaults)
61 for(int i = 0; i < AUTOMATION_TOTAL; i++)
63 autos[i] = defaults->get(xml_titles[i], auto_defaults[i]);
65 transitions = defaults->get("SHOW_TRANSITIONS", 1);
66 plugins = defaults->get("SHOW_PLUGINS", 1);
70 void AutoConf::load_xml(FileXML *file)
72 for(int i = 0; i < AUTOMATION_TOTAL; i++)
74 autos[i] = file->tag.get_property(xml_titles[i], auto_defaults[i]);
76 transitions = file->tag.get_property("SHOW_TRANSITIONS", 1);
77 plugins = file->tag.get_property("SHOW_PLUGINS", 1);
80 int AutoConf::save_defaults(BC_Hash* defaults)
82 for(int i = 0; i < AUTOMATION_TOTAL; i++)
84 defaults->update(xml_titles[i], autos[i]);
86 defaults->update("SHOW_TRANSITIONS", transitions);
87 defaults->update("SHOW_PLUGINS", plugins);
91 void AutoConf::save_xml(FileXML *file)
93 for(int i = 0; i < AUTOMATION_TOTAL; i++)
95 file->tag.set_property(xml_titles[i], autos[i]);
97 file->tag.set_property("SHOW_TRANSITIONS", transitions);
98 file->tag.set_property("SHOW_PLUGINS", plugins);
101 int AutoConf::set_all(int value)
103 for(int i = 0; i < AUTOMATION_TOTAL; i++)
112 AutoConf& AutoConf::operator=(AutoConf &that)
118 void AutoConf::copy_from(AutoConf *src)
120 for(int i = 0; i < AUTOMATION_TOTAL; i++)
122 autos[i] = src->autos[i];
124 transitions = src->transitions;
125 plugins = src->plugins;