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
26 #include "sharedlocation.h"
29 #include "transportque.h"
38 SharedLocation::SharedLocation()
44 SharedLocation::SharedLocation(int module, int plugin)
46 this->module = module;
47 this->plugin = plugin;
50 void SharedLocation::save(FileXML *file)
52 file->tag.set_title("SHARED_LOCATION");
53 if(module >= 0) file->tag.set_property("SHARED_MODULE", (int64_t)module);
54 if(plugin >= 0) file->tag.set_property("SHARED_PLUGIN", (int64_t)plugin);
56 file->tag.set_title("/SHARED_LOCATION");
58 file->append_newline();
61 void SharedLocation::load(FileXML *file)
66 module = file->tag.get_property("SHARED_MODULE", (int64_t)module);
67 plugin = file->tag.get_property("SHARED_PLUGIN", (int64_t)plugin);
70 int SharedLocation::get_type()
73 return PLUGIN_SHAREDMODULE;
75 return PLUGIN_SHAREDPLUGIN;
79 int SharedLocation::operator==(const SharedLocation &that)
81 //printf("SharedLocation::operator== called\n");
83 module == that.module &&
90 int SharedLocation::equivalent(SharedLocation *that)
93 module == that->module &&
94 plugin == that->plugin
101 SharedLocation& SharedLocation::operator=(const SharedLocation &that)
103 //printf("SharedLocation::operator= called\n");
104 this->plugin = that.plugin;
105 this->module = that.module;
109 void SharedLocation::copy_from(SharedLocation *that)
111 this->plugin = that->plugin;
112 this->module = that->module;
116 void SharedLocation::calculate_title(char *string,
123 if(plugin_type == PLUGIN_SHAREDPLUGIN)
128 track = edl->tracks->get_item_number(module);
129 if(track && this->plugin >= 0)
131 plugin = track->get_current_plugin(position,
138 char track_title[BCTEXTLEN];
139 char plugin_title[BCTEXTLEN];
142 strcpy(track_title, track->title);
144 sprintf(track_title, _("None"));
147 strcpy(plugin_title, _(plugin->title));
149 sprintf(plugin_title, _("None"));
151 sprintf(string, "%s: %s", track_title, plugin_title);
154 if(plugin_type == PLUGIN_SHAREDMODULE)
157 track = edl->tracks->get_item_number(module);
160 strcpy(string, track->title);
162 sprintf(string, _("None"));
163 //printf("SharedLocation::calculate_title %p %s\n", string);