#include "wavecache.h"
#include "wintv.h"
#include "wwindow.h"
+#include "x10tv.h"
#include "zoombar.h"
#include "zwindow.h"
#include "zwindowgui.h"
beeper = 0;
shuttle = 0;
wintv = 0;
+ x10tv = 0;
mixers_align = 0;
}
delete beeper;
delete create_bd; create_bd = 0;
delete create_dvd; create_dvd = 0;
+#ifdef HAVE_SHUTTLE
delete shuttle; shuttle = 0;
+#endif
#ifdef HAVE_WINTV
delete wintv; wintv = 0;
+#endif
+#ifdef HAVE_X10TV
+ delete x10tv; x10tv = 0;
#endif
delete batch_render; batch_render = 0;
delete convert_render; convert_render = 0;
int MWindow::init_ladspa_plugins(MWindow *mwindow, Preferences *preferences)
{
+#ifdef HAVE_LADSPA
char *path = getenv("LADSPA_PATH");
char ladspa_path[BCTEXTLEN];
if( !path ) {
}
fclose(fp);
}
+#endif
return 1;
}
char plugin_path[BCTEXTLEN];
sprintf(plugin_path, "%s/%s", plug_dir, plug_path);
FileSystem fs;
- fs.set_filter( "[*.plugin][*.so]" );
+ fs.set_filter( "[*.plugin][*.so][*.dll]" );
int result = fs.update(plugin_path);
if( result || !fs.dir_list.total ) return;
int vis_id = idx++;
wintv->start();
#endif
}
+void MWindow::init_x10tv()
+{
+#ifdef HAVE_X10TV
+ x10tv = X10TV::probe(this);
+ if( x10tv )
+ x10tv->start();
+#endif
+}
void MWindow::init_brender()
session->group_number += groups;
switch( edl_mode ) {
case LOADMODE_EDL_CLIP: {
- sprintf(new_edl->local_session->clip_title, _("Clip %d"),
- session->clip_number++);
- char string[BCSTRLEN];
- time_t t; time(&t);
- ctime_r(&t, string);
- snprintf(new_edl->local_session->clip_notes,
- sizeof(new_edl->local_session->clip_notes),
- +("%sFrom: %s"), string, filename);
+ strcpy(new_edl->local_session->clip_title,
+ filenames->get(i));
+ struct stat st;
+ time_t t = !stat(filenames->get(i),&st) ?
+ st.st_mtime : time(&t);
+ ctime_r(&t, new_edl->local_session->clip_notes);
switch( load_mode ) {
case LOADMODE_REPLACE:
case LOADMODE_REPLACE_CONCATENATE:
strcat(string, "/" FONT_SEARCHPATH);
BC_Resources::init_fontconfig(string);
if(debug) PRINT_TRACE
- init_wintv();
+// use if plugged
+ init_x10tv();
+ if( !x10tv )
+ init_wintv();
// Default project created here
init_edl();
{
keyframe_gui_lock->lock("MWindow::show_keyframe_gui");
// Find existing thread
- for(int i = 0; i < keyframe_threads->size(); i++)
- {
- if(keyframe_threads->get(i)->plugin == plugin)
- {
+ for( int i=0; i<keyframe_threads->size(); ++i ) {
+ int plugin_id = keyframe_threads->get(i)->plugin_id;
+ if( plugin_id == plugin->orig_id ) {
keyframe_threads->get(i)->start_window(plugin, 0);
keyframe_gui_lock->unlock();
return;
}
// Find unused thread
- for(int i = 0; i < keyframe_threads->size(); i++)
- {
- if(!keyframe_threads->get(i)->plugin)
- {
+ for( int i=0; i<keyframe_threads->size(); ++i ) {
+ if( keyframe_threads->get(i)->plugin_id < 0 ) {
keyframe_threads->get(i)->start_window(plugin, 0);
keyframe_gui_lock->unlock();
return;
KeyFrameThread *thread = new KeyFrameThread(this);
keyframe_threads->append(thread);
thread->start_window(plugin, 0);
-
keyframe_gui_lock->unlock();
}
//printf("MWindow::show_plugin %d\n", __LINE__);
SET_TRACE
-
plugin_gui_lock->lock("MWindow::show_plugin");
- for(int i = 0; i < plugin_guis->total; i++)
- {
-// Pointer comparison
- if(plugin_guis->get(i)->plugin == plugin)
- {
- plugin_guis->get(i)->raise_window();
+ for( int i=0; i<plugin_guis->total; ++i ) {
+// Pointer/id comparison
+ PluginServer *plugin_gui = plugin_guis->get(i);
+ if( plugin_gui->plugin_id == plugin->orig_id ) {
+ plugin_gui->raise_window();
done = 1;
break;
}
void MWindow::hide_plugin(Plugin *plugin, int lock)
{
plugin->show = 0;
+ return hide_plugin(plugin->orig_id, lock);
+}
+
+void MWindow::hide_plugin(int plugin_id, int lock)
+{
// Update the toggle
gui->lock_window("MWindow::hide_plugin");
gui->update(0, NORMAL_DRAW, 0, 0, 0, 0, 0);
gui->unlock_window();
if(lock) plugin_gui_lock->lock("MWindow::hide_plugin");
- for(int i = 0; i < plugin_guis->total; i++)
- {
- if(plugin_guis->get(i)->plugin == plugin)
- {
- PluginServer *ptr = plugin_guis->get(i);
- plugin_guis->remove(ptr);
+ for( int i=0; i<plugin_guis->total; ++i ) {
+ PluginServer *plugin_gui = plugin_guis->get(i);
+ if( plugin_gui->plugin_id == plugin_id ) {
+ plugin_guis->remove(plugin_gui);
if(lock) plugin_gui_lock->unlock();
// Last command executed in client side close
// Schedule for deletion
- ptr->hide_gui();
- delete_plugin(ptr);
+ plugin_gui->hide_gui();
+ delete_plugin(plugin_gui);
//sleep(1);
return;
}
void MWindow::hide_keyframe_gui(Plugin *plugin)
{
keyframe_gui_lock->lock("MWindow::hide_keyframe_gui");
- for(int i = 0; i < keyframe_threads->size(); i++)
- {
- if(keyframe_threads->get(i)->plugin == plugin)
- {
- keyframe_threads->get(i)->close_window();
+ for( int i = 0; i < keyframe_threads->size(); i++) {
+ KeyFrameThread *keyframe_gui = keyframe_threads->get(i);
+ if( keyframe_gui->plugin_id == plugin->orig_id ) {
+ keyframe_gui->close_window();
break;
}
}
{
// Send new configuration to keyframe GUI's
keyframe_gui_lock->lock("MWindow::update_keyframe_guis");
- for(int i = 0; i < keyframe_threads->size(); i++)
- {
- KeyFrameThread *ptr = keyframe_threads->get(i);
- if(edl->tracks->plugin_exists(ptr->plugin))
- ptr->update_gui(1);
+ for( int i=0; i<keyframe_threads->size(); ++i ) {
+ KeyFrameThread *keyframe_gui = keyframe_threads->get(i);
+ Plugin *plugin = edl->tracks->plugin_exists(keyframe_gui->plugin_id);
+ if( plugin )
+ keyframe_gui->update_gui(1);
else
- {
- ptr->close_window();
- }
+ keyframe_gui->close_window();
}
keyframe_gui_lock->unlock();
}
// Send new configuration to plugin GUI's
plugin_gui_lock->lock("MWindow::update_plugin_guis");
- for(int i = 0; i < plugin_guis->size(); i++)
- {
- PluginServer *ptr = plugin_guis->get(i);
- if(edl->tracks->plugin_exists(ptr->plugin))
- ptr->update_gui();
- else
- {
-// Schedule for deletion if no plugin
- plugin_guis->remove_number(i);
- i--;
-
- ptr->hide_gui();
- delete_plugin(ptr);
+ for( int i=0; i<plugin_guis->size(); ++i ) {
+ PluginServer *plugin_gui = plugin_guis->get(i);
+ Plugin *plugin = edl->tracks->plugin_exists(plugin_gui->plugin_id);
+ if( plugin && plugin->show )
+ plugin_gui->update_gui();
+ else {
+// Schedule for deletion if no plugin or not shown
+ plugin_guis->remove_number(i--);
+ plugin_gui->hide_gui();
+ delete_plugin(plugin_gui);
}
}
// Change plugin variable if not visible
Track *track = edl->tracks->first;
- while(track)
- {
- for(int i = 0; i < track->plugin_set.size(); i++)
- {
+ for( ; track; track=track->next ) {
+ for( int i=0; i < track->plugin_set.size(); ++i ) {
Plugin *plugin = (Plugin*)track->plugin_set[i]->first;
- while(plugin)
- {
+ for( ; plugin; plugin = (Plugin*)plugin->next ) {
int got_it = 0;
- for(int i = 0; i < plugin_guis->size(); i++)
- {
+ for( int i=0; i<plugin_guis->size(); ++i ) {
PluginServer *server = plugin_guis->get(i);
- if(server->plugin == plugin)
- {
+ if( server->plugin_id == plugin->orig_id ) {
got_it = 1;
break;
}
}
-
- if(!got_it) plugin->show = 0;
- plugin = (Plugin*)plugin->next;
+ if( !got_it ) plugin->show = 0;
}
}
-
- track = track->next;
}
plugin_gui_lock->unlock();
-
-
- if(do_keyframe_guis) update_keyframe_guis();
+ if( do_keyframe_guis )
+ update_keyframe_guis();
}
void MWindow::stop_plugin_guis()
plugin_gui_lock->lock("MWindow::stop_plugin_guis");
for( int i=0; i<plugin_guis->size(); ++i ) {
- PluginServer *ptr = plugin_guis->get(i);
- if( edl->tracks->plugin_exists(ptr->plugin) ) {
- ptr->render_stop();
- }
+ PluginServer *plugin_gui = plugin_guis->get(i);
+ plugin_gui->render_stop();
}
plugin_gui_lock->unlock();
}
void MWindow::update_plugin_states()
{
plugin_gui_lock->lock("MWindow::update_plugin_states");
- for(int i = 0; i < plugin_guis->total; i++)
- {
- int result = 0;
+ for( int i=0; i<plugin_guis->total; ++i ) {
// Get a plugin GUI
- Plugin *src_plugin = plugin_guis->get(i)->plugin;
PluginServer *src_plugingui = plugin_guis->get(i);
-
-// Search for plugin in EDL. Only the master EDL shows plugin GUIs.
- for(Track *track = edl->tracks->first;
- track && !result;
- track = track->next)
- {
- for(int j = 0;
- j < track->plugin_set.total && !result;
- j++)
- {
- PluginSet *plugin_set = track->plugin_set[j];
- for(Plugin *plugin = (Plugin*)plugin_set->first;
- plugin && !result;
- plugin = (Plugin*)plugin->next)
- {
- if(plugin == src_plugin &&
- !strcmp(plugin->title, src_plugingui->title)) result = 1;
- }
- }
- }
-
-
+ int plugin_id = src_plugingui->plugin_id;
+ Plugin *src_plugin = edl->tracks->plugin_exists(plugin_id);
// Doesn't exist anymore
- if(!result)
- {
- hide_plugin(src_plugin, 0);
- i--;
+ if( !src_plugin ) {
+ hide_plugin(plugin_id, 0);
+ --i;
}
}
plugin_gui_lock->unlock();
void MWindow::update_plugin_titles()
{
- for(int i = 0; i < plugin_guis->total; i++)
- {
+ for( int i=0; i<plugin_guis->total; ++i )
plugin_guis->get(i)->update_title();
- }
}
int MWindow::asset_to_edl(EDL *new_edl,
sprintf(string2, _("Couldn't open %s for writing."), backup_path);
gui->show_message(string2);
}
+ save_undo_data();
}
void MWindow::load_backup()
void MWindow::save_undo_data()
{
- undo_before();
- undo_after(_("perpetual session"), LOAD_ALL);
+ if( stack.size() > 0 ) return;
+ if( !preferences->perpetual_session ) return;
char perpetual_path[BCTEXTLEN];
snprintf(perpetual_path, sizeof(perpetual_path), "%s/%s",
File::get_config_path(), PERPETUAL_FILE);
void MWindow::load_undo_data()
{
+ if( stack.size() > 0 ) return;
+ if( !preferences->perpetual_session ) return;
char perpetual_path[BCTEXTLEN];
snprintf(perpetual_path, sizeof(perpetual_path), "%s/%s",
File::get_config_path(), PERPETUAL_FILE);
FILE *fp = fopen(perpetual_path,"r");
if( !fp ) return;
undo->load(fp);
+ undo_before();
+ undo_after(_("perpetual load"), LOAD_ALL);
fclose(fp);
}
+void MWindow::remove_undo_data()
+{
+ if( stack.size() > 0 ) return;
+ char perpetual_path[BCTEXTLEN];
+ snprintf(perpetual_path, sizeof(perpetual_path), "%s/%s",
+ File::get_config_path(), PERPETUAL_FILE);
+ ::remove(perpetual_path);
+}
int MWindow::copy_target(const char *path, const char *target)
{
char progress_title[BCTEXTLEN];
sprintf(progress_title, _("Saving to %s:\n"), dir);
int total_assets = save_edl->assets->total();
+ gui->lock_window("MWindow::save_project");
MainProgressBar *progress = mainprogress->start_progress(progress_title, total_assets);
+ gui->unlock_window();
+
int ret = 0;
Asset *current = save_edl->assets->first;
for( int i=0; !ret && current; ++i, current=NEXT ) {