00001 #include "edl.h"
00002 #include "filexml.h"
00003 #include "plugin.h"
00004 #include "sharedlocation.h"
00005 #include "track.h"
00006 #include "tracks.h"
00007 #include "transportque.h"
00008
00009
00010
00011
00012 #include <string.h>
00013
00014 #include <libintl.h>
00015 #define _(String) gettext(String)
00016 #define gettext_noop(String) String
00017 #define N_(String) gettext_noop (String)
00018
00019
00020 SharedLocation::SharedLocation()
00021 {
00022 this->module = -1;
00023 this->plugin = -1;
00024 }
00025
00026 SharedLocation::SharedLocation(int module, int plugin)
00027 {
00028 this->module = module;
00029 this->plugin = plugin;
00030 }
00031
00032 void SharedLocation::save(FileXML *file)
00033 {
00034 file->tag.set_title("SHARED_LOCATION");
00035 if(module >= 0) file->tag.set_property("SHARED_MODULE", (int64_t)module);
00036 if(plugin >= 0) file->tag.set_property("SHARED_PLUGIN", (int64_t)plugin);
00037 file->append_tag();
00038 file->tag.set_title("/SHARED_LOCATION");
00039 file->append_tag();
00040 file->append_newline();
00041 }
00042
00043 void SharedLocation::load(FileXML *file)
00044 {
00045 module = -1;
00046 plugin = -1;
00047
00048 module = file->tag.get_property("SHARED_MODULE", (int64_t)module);
00049 plugin = file->tag.get_property("SHARED_PLUGIN", (int64_t)plugin);
00050 }
00051
00052 int SharedLocation::get_type()
00053 {
00054 if(plugin < 0)
00055 return PLUGIN_SHAREDMODULE;
00056 else
00057 return PLUGIN_SHAREDPLUGIN;
00058 }
00059
00060
00061 int SharedLocation::operator==(const SharedLocation &that)
00062 {
00063 if(
00064 module == that.module &&
00065 plugin == that.plugin
00066 ) return 1;
00067 else
00068 return 0;
00069 }
00070
00071 SharedLocation& SharedLocation::operator=(const SharedLocation &that)
00072 {
00073 this->plugin = that.plugin;
00074 this->module = that.module;
00075 return *this;
00076 }
00077
00078 void SharedLocation::calculate_title(char *string,
00079 EDL *edl,
00080 double position,
00081 int convert_units,
00082 int plugin_type,
00083 int use_nudge)
00084 {
00085 if(plugin_type == PLUGIN_SHAREDPLUGIN)
00086 {
00087 Track *track = 0;
00088 Plugin *plugin = 0;
00089
00090 track = edl->tracks->get_item_number(module);
00091 if(track && this->plugin >= 0)
00092 {
00093 plugin = track->get_current_plugin(position,
00094 this->plugin,
00095 PLAY_FORWARD,
00096 convert_units,
00097 use_nudge);
00098 }
00099
00100 char track_title[BCTEXTLEN];
00101 char plugin_title[BCTEXTLEN];
00102
00103 if(track)
00104 strcpy(track_title, track->title);
00105 else
00106 sprintf(track_title, _("None"));
00107
00108 if(plugin)
00109 strcpy(plugin_title, _(plugin->title));
00110 else
00111 sprintf(plugin_title, _("None"));
00112
00113 sprintf(string, "%s: %s", track_title, plugin_title);
00114 }
00115 else
00116 if(plugin_type == PLUGIN_SHAREDMODULE)
00117 {
00118 Track *track = 0;
00119 track = edl->tracks->get_item_number(module);
00120
00121 if(track)
00122 strcpy(string, track->title);
00123 else
00124 sprintf(string, _("None"));
00125
00126 }
00127 }
00128
00129
00130