Using old thread https://lists.cinelerra-gg.org/pipermail/cin/2019-May/000671.html
I added vaapi proxying script to our doc/ directory (really not fan of retyping scripts from manual ...) and removed near-empty "whats new" from 2.1 era and removed few 'sav' backup copies from tree and moved old 1.1.0 release notes and TODOs from svn era into new old/ directory. see if you like those changes, apply accordingly!
From 9a42ecc5c72cea3a2314c6e12cd4c4b3c10aa5e7 Mon Sep 17 00:00:00 2001 From: Andrew Randrianasulu <[email protected]> Date: Thu, 3 Nov 2022 15:54:33 +0300 Subject: [PATCH 1/4] Andrey Spitsyn's hw proxier script --- cinelerra-5.1/doc/vaapi_proxy.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 cinelerra-5.1/doc/vaapi_proxy.sh diff --git a/cinelerra-5.1/doc/vaapi_proxy.sh b/cinelerra-5.1/doc/vaapi_proxy.sh new file mode 100644 index 00000000..9672a239 --- /dev/null +++ b/cinelerra-5.1/doc/vaapi_proxy.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +filename="$1" +fileout="${filename%.*}" +proxy="6" +# Hardware encode AMD +ffmpeg -threads 2 -hwaccel vaapi -vaapi_device /dev/dri/renderD128 \ + -i "$1" -c:v h264_vaapi -vf "format=nv12,hwupload,scale_vaapi=iw/'$proxy':ih/'$proxy'" \ + -vcodec h264_vaapi -preset fast -c:a copy \ + -bf 0 -profile:v 66 "$fileout".proxy"$proxy"-mp4.mp4 \ No newline at end of file -- 2.38.1
From 3093305c9e45e31d71149d3e49821727e0657d28 Mon Sep 17 00:00:00 2001 From: Andrew Randrianasulu <[email protected]> Date: Thu, 3 Nov 2022 16:41:00 +0300 Subject: [PATCH 4/4] move old todos andvrelease notes to toplevel old --- cinelerra-5.1/{cinelerra => old}/RELEASE_NOTES | 0 cinelerra-5.1/{cinelerra => old}/TODO | 0 cinelerra-5.1/{cinelerra => old}/TODO.mine | 0 cinelerra-5.1/{cinelerra => old}/TODO.r1027 | 0 cinelerra-5.1/{cinelerra => old}/TODO.r1040 | 0 5 files changed, 0 insertions(+), 0 deletions(-) rename cinelerra-5.1/{cinelerra => old}/RELEASE_NOTES (100%) rename cinelerra-5.1/{cinelerra => old}/TODO (100%) rename cinelerra-5.1/{cinelerra => old}/TODO.mine (100%) rename cinelerra-5.1/{cinelerra => old}/TODO.r1027 (100%) rename cinelerra-5.1/{cinelerra => old}/TODO.r1040 (100%) diff --git a/cinelerra-5.1/cinelerra/RELEASE_NOTES b/cinelerra-5.1/old/RELEASE_NOTES similarity index 100% rename from cinelerra-5.1/cinelerra/RELEASE_NOTES rename to cinelerra-5.1/old/RELEASE_NOTES diff --git a/cinelerra-5.1/cinelerra/TODO b/cinelerra-5.1/old/TODO similarity index 100% rename from cinelerra-5.1/cinelerra/TODO rename to cinelerra-5.1/old/TODO diff --git a/cinelerra-5.1/cinelerra/TODO.mine b/cinelerra-5.1/old/TODO.mine similarity index 100% rename from cinelerra-5.1/cinelerra/TODO.mine rename to cinelerra-5.1/old/TODO.mine diff --git a/cinelerra-5.1/cinelerra/TODO.r1027 b/cinelerra-5.1/old/TODO.r1027 similarity index 100% rename from cinelerra-5.1/cinelerra/TODO.r1027 rename to cinelerra-5.1/old/TODO.r1027 diff --git a/cinelerra-5.1/cinelerra/TODO.r1040 b/cinelerra-5.1/old/TODO.r1040 similarity index 100% rename from cinelerra-5.1/cinelerra/TODO.r1040 rename to cinelerra-5.1/old/TODO.r1040 -- 2.38.1
From 6759231b8ba16adbee5f1585945139dac112fe15 Mon Sep 17 00:00:00 2001 From: Andrew Randrianasulu <[email protected]> Date: Thu, 3 Nov 2022 16:33:47 +0300 Subject: [PATCH 2/4] remove useless doc/whatsnew_2_1.html --- cinelerra-5.1/doc/whatsnew_2_1.html | 4 ---- 1 file changed, 4 deletions(-) delete mode 100644 cinelerra-5.1/doc/whatsnew_2_1.html diff --git a/cinelerra-5.1/doc/whatsnew_2_1.html b/cinelerra-5.1/doc/whatsnew_2_1.html deleted file mode 100644 index 6c202f61..00000000 --- a/cinelerra-5.1/doc/whatsnew_2_1.html +++ /dev/null @@ -1,4 +0,0 @@ -<H1>What's new in Cinelerra 2.1</H1> - -So many big things happened in 2.1 that a simple CHANGELOG won't do. - -- 2.38.1
From d0a5c93aaedb980f907cad892009a915e6fcd4d4 Mon Sep 17 00:00:00 2001 From: Andrew Randrianasulu <[email protected]> Date: Thu, 3 Nov 2022 16:39:03 +0300 Subject: [PATCH 3/4] Remove few "sav" backup files --- cinelerra-5.1/cinelerra/presets.C.sav | 410 ----------------- cinelerra-5.1/cinelerra/presets.h.sav | 108 ----- cinelerra-5.1/cinelerra/presets.inc.sav | 32 -- cinelerra-5.1/cinelerra/presetsgui.C.sav | 504 --------------------- cinelerra-5.1/cinelerra/presetsgui.C.sav1 | 503 -------------------- cinelerra-5.1/cinelerra/presetsgui.h.sav | 170 ------- cinelerra-5.1/cinelerra/presetsgui.inc.sav | 33 -- 7 files changed, 1760 deletions(-) delete mode 100644 cinelerra-5.1/cinelerra/presets.C.sav delete mode 100644 cinelerra-5.1/cinelerra/presets.h.sav delete mode 100644 cinelerra-5.1/cinelerra/presets.inc.sav delete mode 100644 cinelerra-5.1/cinelerra/presetsgui.C.sav delete mode 100644 cinelerra-5.1/cinelerra/presetsgui.C.sav1 delete mode 100644 cinelerra-5.1/cinelerra/presetsgui.h.sav delete mode 100644 cinelerra-5.1/cinelerra/presetsgui.inc.sav diff --git a/cinelerra-5.1/cinelerra/presets.C.sav b/cinelerra-5.1/cinelerra/presets.C.sav deleted file mode 100644 index d97dfb2b..00000000 --- a/cinelerra-5.1/cinelerra/presets.C.sav +++ /dev/null @@ -1,410 +0,0 @@ - -/* - * CINELERRA - * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#include "bcsignals.h" -#include "bcwindowbase.inc" -#include "cstrdup.h" -#include "file.h" -#include "filesystem.h" -#include "filexml.h" -#include "keyframe.h" -#include "messages.inc" -#include "mwindow.h" -#include "pluginserver.h" -#include "preferences.inc" -#include "presets.h" - -#include <errno.h> -#include <string.h> - -PresetsDB::PresetsDB() -{ -} - - -void PresetsDB::clear() -{ - plugins.remove_all_objects(); -} - -void PresetsDB::load() -{ - clear(); - - FileXML file; - char path[BCTEXTLEN]; - char string[BCTEXTLEN]; - sprintf(path, "%s/%s", File::get_config_path(), PRESETS_FILE); - FileSystem fs; - fs.complete_path(path); - file.read_from_file(path); - int result = 0; - - do - { - result = file.read_tag(); - if(!result) - { - if(file.tag.title_is("PLUGIN")) - { - PresetsDBPlugin *plugin = 0; - sprintf(string, "Unknown"); - const char *title = file.tag.get_property("TITLE", string); - -// Search for existing plugin - for(int i = 0; i < plugins.size(); i++) - { - if(!strcasecmp(plugins.get(i)->title, title)) - { - plugin = plugins.get(i); - break; - } - } - -// Create new plugin - if(!plugin) - { - plugin = new PresetsDBPlugin(title); - plugins.append(plugin); - } - - plugin->load(&file); - } - } - }while(!result); -} - -void PresetsDB::save() -{ - FileXML file; - for(int i = 0; i < plugins.size(); i++) - { - PresetsDBPlugin *plugin = plugins.get(i); - plugin->save(&file); - } - file.terminate_string(); - - char path[BCTEXTLEN]; - sprintf(path, "%s/%s", File::get_config_path(), PRESETS_FILE); - FileSystem fs; - fs.complete_path(path); - file.write_to_file(path); -} - - -int PresetsDB::get_total_presets(char *plugin_title) -{ - for(int i = 0; i < plugins.size(); i++) - { - PresetsDBPlugin *plugin = plugins.get(i); - if(!strcasecmp(plugin->title, plugin_title)) - { - return plugin->keyframes.size(); - } - } - - return 0; -} - -char* PresetsDB::get_preset_title(char *plugin_title, int number) -{ - for(int i = 0; i < plugins.size(); i++) - { - PresetsDBPlugin *plugin = plugins.get(i); - if(!strcasecmp(plugin->title, plugin_title)) - { - if(number < plugin->keyframes.size()) - { - return plugin->keyframes.get(number)->title; - } - else - { - printf("PresetsDB::get_preset_title %d buffer overrun\n", __LINE__); - } - break; - } - } - return 0; -} - -char* PresetsDB::get_preset_data(char *plugin_title, int number) -{ - for(int i = 0; i < plugins.size(); i++) - { - PresetsDBPlugin *plugin = plugins.get(i); - if(!strcasecmp(plugin->title, plugin_title)) - { - if(number < plugin->keyframes.size()) - { - return plugin->keyframes.get(number)->data; - } - else - { - printf("PresetsDB::get_preset_data %d buffer overrun\n", __LINE__); - } - break; - } - } - return 0; -} - -PresetsDBPlugin* PresetsDB::get_plugin(const char *plugin_title) -{ - for(int i = 0; i < plugins.size(); i++) - { - PresetsDBPlugin *plugin = plugins.get(i); - if(!strcasecmp(plugin->title, plugin_title)) - { - return plugin; - } - } - return 0; -} - -PresetsDBPlugin* PresetsDB::new_plugin(const char *plugin_title) -{ - PresetsDBPlugin *result = new PresetsDBPlugin(plugin_title); - plugins.append(result); - return result; -} - - -void PresetsDB::save_preset(const char *plugin_title, const char *preset_title, char *data) -{ - PresetsDBPlugin *plugin = get_plugin(plugin_title); - if(!plugin) plugin = new_plugin(plugin_title); - PresetsDBKeyframe *keyframe = plugin->get_keyframe(preset_title); - if(!keyframe) keyframe = plugin->new_keyframe(preset_title); - keyframe->set_data(data); - save(); - -} - - -void PresetsDB::delete_preset(const char *plugin_title, const char *preset_title) -{ - PresetsDBPlugin *plugin = get_plugin(plugin_title); - if(plugin) - { - plugin->delete_keyframe(preset_title); - } - save(); -} - -void PresetsDB::load_preset(const char *plugin_title, const char *preset_title, KeyFrame *keyframe) -{ - PresetsDBPlugin *plugin = get_plugin(plugin_title); - if(plugin) - { - plugin->load_preset(preset_title, keyframe); - } -} - -int PresetsDB::preset_exists(const char *plugin_title, const char *preset_title) -{ - PresetsDBPlugin *plugin = get_plugin(plugin_title); - if(plugin) - { - return plugin->preset_exists(preset_title); - } - return 0; -} - - - - -PresetsDBKeyframe::PresetsDBKeyframe(const char *title) -{ - this->title = cstrdup(title); - data = 0; -} - -PresetsDBKeyframe::~PresetsDBKeyframe() -{ - delete [] title; - delete [] data; -} - -void PresetsDBKeyframe::set_data(char *data) -{ - delete [] this->data; - this->data = cstrdup(data); -} - - - -PresetsDBPlugin::PresetsDBPlugin(const char *title) -{ - this->title = cstrdup(title); -} - -PresetsDBPlugin::~PresetsDBPlugin() -{ - keyframes.remove_all_objects(); - delete [] title; -} - -void PresetsDBPlugin::load(FileXML *file) -{ - int result = 0; - char string[BCTEXTLEN]; - - do - { - result = file->read_tag(); - if(!result) - { - if(file->tag.title_is("/PLUGIN")) break; - else - if(file->tag.title_is("KEYFRAME")) - { - sprintf(string, "Unknown"); - const char *keyframe_title = file->tag.get_property("TITLE", string); - PresetsDBKeyframe *keyframe = new PresetsDBKeyframe(keyframe_title); - - char data[MESSAGESIZE]; - int len = file->read_data_until("/KEYFRAME", data, MESSAGESIZE-1); - data[len] = 0; - keyframe->set_data(data); - keyframes.append(keyframe); - - } - } - }while(!result); - - -} - -void PresetsDBPlugin::save(FileXML *file) -{ - file->tag.set_title("PLUGIN"); - file->tag.set_property("TITLE", title); - file->append_tag(); - file->append_newline(); - - for(int j = 0; j < keyframes.size(); j++) - { - PresetsDBKeyframe *keyframe = keyframes.get(j); - file->tag.set_title("KEYFRAME"); - file->tag.set_property("TITLE", keyframe->title); - file->append_tag(); - file->append_text(keyframe->data); - file->tag.set_title("/KEYFRAME"); - file->append_tag(); - file->append_newline(); - } - - file->tag.set_title("/PLUGIN"); - file->append_tag(); - file->append_newline(); -} - -PresetsDBKeyframe* PresetsDBPlugin::get_keyframe(const char *title) -{ - for(int i = 0; i < keyframes.size(); i++) - { - PresetsDBKeyframe *keyframe = keyframes.get(i); - if(!strcasecmp(keyframe->title, title)) return keyframe; - } - return 0; -} - -void PresetsDBPlugin::delete_keyframe(const char *title) -{ - for(int i = 0; i < keyframes.size(); i++) - { - PresetsDBKeyframe *keyframe = keyframes.get(i); - if(!strcasecmp(keyframe->title, title)) - { - keyframes.remove_object_number(i); - return; - } - } -} - - -PresetsDBKeyframe* PresetsDBPlugin::new_keyframe(const char *title) -{ - PresetsDBKeyframe *keyframe = new PresetsDBKeyframe(title); - keyframes.append(keyframe); - return keyframe; -} - -void PresetsDBPlugin::load_preset(const char *preset_title, KeyFrame *keyframe) -{ - PresetsDBKeyframe *src = get_keyframe(preset_title); - if(src) - { - keyframe->set_data(src->data); -// Save as the plugin's default -// Need the path -//printf("PresetsDBPlugin::load_preset %d %s\n", __LINE__, title); - PluginServer *server = MWindow::scan_plugindb(title, -1); - if(!server) - { - } - else - { - char path[BCTEXTLEN]; - server->get_defaults_path(path); - FileSystem fs; - fs.complete_path(path); - - FILE *fd = fopen(path, "w"); - if(fd) - { - if(!fwrite(src->data, strlen(src->data), 1, fd)) - { - fprintf(stderr, "PresetsDBPlugin::load_preset %d \"%s\": %s\n", - __LINE__, - path, - strerror(errno)); - } - - fclose(fd); - } - else - { - fprintf(stderr, "PresetsDBPlugin::load_preset %d \"%s\": %s\n", - __LINE__, - path, - strerror(errno)); - } - } - } -} - -int PresetsDBPlugin::preset_exists(const char *preset_title) -{ - PresetsDBKeyframe *src = get_keyframe(preset_title); - if(src) - { - return 1; - } - return 0; -} - - - - - - - diff --git a/cinelerra-5.1/cinelerra/presets.h.sav b/cinelerra-5.1/cinelerra/presets.h.sav deleted file mode 100644 index 99d3c10b..00000000 --- a/cinelerra-5.1/cinelerra/presets.h.sav +++ /dev/null @@ -1,108 +0,0 @@ - -/* - * CINELERRA - * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#ifndef PRESETS_H -#define PRESETS_H - - -#include "arraylist.h" -#include "filexml.inc" -#include "keyframe.inc" - - -// Front end for a DB of presets for all plugins - -// A single preset -class PresetsDBKeyframe -{ -public: - PresetsDBKeyframe(const char *title); - ~PresetsDBKeyframe(); - - void set_data(char *data); - - char *title; - char *data; -}; - -// Presets for a single plugin -class PresetsDBPlugin -{ -public: - PresetsDBPlugin(const char *title); - ~PresetsDBPlugin(); - - - void load(FileXML *file); - void save(FileXML *file); - -// Get a preset by name - PresetsDBKeyframe* get_keyframe(const char *title); -// Create a new keyframe - PresetsDBKeyframe* new_keyframe(const char *title); - void delete_keyframe(const char *title); -// Load a preset into the keyframe - void load_preset(const char *preset_title, KeyFrame *keyframe); - int preset_exists(const char *preset_title); - - ArrayList<PresetsDBKeyframe*> keyframes; - char *title; -}; - -class PresetsDB -{ -public: - PresetsDB(); - -// Load the database from the file. - void load(); -// Save the database to the file. - void save(); - -// Get the total number of presets for a plugin - int get_total_presets(char *plugin_title); -// Get the title of a preset - char* get_preset_title(char *plugin_title, int number); -// Get the data for a preset - char* get_preset_data(char *plugin_title, int number); -// Get a pluginDB by name - PresetsDBPlugin* get_plugin(const char *plugin_title); -// Create a pluginDB - PresetsDBPlugin* new_plugin(const char *plugin_title); - void save_preset(const char *plugin_title, const char *preset_title, char *data); - void delete_preset(const char *plugin_title, const char *preset_title); -// Load a preset into the keyframe - void load_preset(const char *plugin_title, const char *preset_title, KeyFrame *keyframe); - int preset_exists(const char *plugin_title, const char *preset_title); - -private: -// Remove all plugin data - void clear(); - - ArrayList<PresetsDBPlugin*> plugins; -}; - - - -#endif - - - diff --git a/cinelerra-5.1/cinelerra/presets.inc.sav b/cinelerra-5.1/cinelerra/presets.inc.sav deleted file mode 100644 index 3718d19a..00000000 --- a/cinelerra-5.1/cinelerra/presets.inc.sav +++ /dev/null @@ -1,32 +0,0 @@ - -/* - * CINELERRA - * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#ifndef PRESETS_INC -#define PRESETS_INC - - -class PresetsDB; - -#endif - - - - diff --git a/cinelerra-5.1/cinelerra/presetsgui.C.sav b/cinelerra-5.1/cinelerra/presetsgui.C.sav deleted file mode 100644 index 48abf86f..00000000 --- a/cinelerra-5.1/cinelerra/presetsgui.C.sav +++ /dev/null @@ -1,504 +0,0 @@ - -/* - * CINELERRA - * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#if 0 - - - - -#include "edl.h" -#include "keyframe.h" -#include "keys.h" -#include "language.h" -#include "localsession.h" -#include "mainsession.h" -#include "mainundo.h" -#include "mwindow.h" -#include "mwindowgui.h" -#include "plugin.h" -#include "presets.h" -#include "presetsgui.h" -#include "theme.h" -#include "trackcanvas.h" -#include "tracks.h" - - - - - - - - - - - -PresetsThread::PresetsThread(MWindow *mwindow) - : BC_DialogThread() -{ - this->mwindow = mwindow; - plugin = 0; - data = new ArrayList<BC_ListBoxItem*>; - presets_db = new PresetsDB; - plugin_title[0] = 0; - window_title[0] = 0; -} - -PresetsThread::~PresetsThread() -{ - close_window(); - delete data; -} - -void PresetsThread::calculate_list() -{ - data->remove_all_objects(); - int total_presets = presets_db->get_total_presets(plugin_title); - for(int i = 0; i < total_presets; i++) - { - data->append(new BC_ListBoxItem(presets_db->get_preset_title( - plugin_title, - i))); - } -} - - -void PresetsThread::start_window(Plugin *plugin) -{ - if(!BC_DialogThread::is_running()) - { - this->plugin = plugin; - plugin->calculate_title(plugin_title, 0); - sprintf(window_title, _(PROGRAM_NAME ": %s Presets"), plugin_title); - - -// Calculate database - presets_db->load(); - calculate_list(); - - - mwindow->gui->unlock_window(); - BC_DialogThread::start(); - mwindow->gui->lock_window("PresetsThread::start_window"); - } -} - -BC_Window* PresetsThread::new_gui() -{ - mwindow->gui->lock_window("PresetsThread::new_gui"); - int x = mwindow->gui->get_abs_cursor_x(0) - - mwindow->session->plugindialog_w / 2; - int y = mwindow->gui->get_abs_cursor_y(0) - - mwindow->session->plugindialog_h / 2; - - PresetsWindow *window = new PresetsWindow(mwindow, - this, - x, - y, - window_title); - - window->create_objects(); - mwindow->gui->unlock_window(); - return window; -} - -void PresetsThread::handle_done_event(int result) -{ -// Apply the preset - if(!result) - { - char *title = ((PresetsWindow*)get_gui())->title_text->get_text(); - apply_preset(title); - } -} - -void PresetsThread::handle_close_event(int result) -{ -} - -void PresetsThread::save_preset(char *title) -{ - get_gui()->unlock_window(); - mwindow->gui->lock_window("PresetsThread::save_preset"); - -// Test EDL for plugin existence - if(!mwindow->edl->tracks->plugin_exists(plugin)) - { - mwindow->gui->unlock_window(); - get_gui()->lock_window("PresetsThread::save_preset 2"); - return; - } - - -// Get current plugin keyframe - EDL *edl = mwindow->edl; - Track *track = plugin->track; - KeyFrame *keyframe = plugin->get_prev_keyframe( - track->to_units(edl->local_session->get_selectionstart(1), 0), - PLAY_FORWARD); - -// Send to database - presets_db->save_preset(plugin_title, title, keyframe->get_data()); - - mwindow->gui->unlock_window(); - get_gui()->lock_window("PresetsThread::save_preset 2"); - - -// Update list - calculate_list(); - ((PresetsWindow*)get_gui())->list->update(data, - 0, - 0, - 1); -} - -void PresetsThread::delete_preset(char *title) -{ - get_gui()->unlock_window(); - mwindow->gui->lock_window("PresetsThread::save_preset"); - -// Test EDL for plugin existence - if(!mwindow->edl->tracks->plugin_exists(plugin)) - { - mwindow->gui->unlock_window(); - get_gui()->lock_window("PresetsThread::delete_preset 1"); - return; - } - - presets_db->delete_preset(plugin_title, title); - - mwindow->gui->unlock_window(); - get_gui()->lock_window("PresetsThread::delete_preset 2"); - - -// Update list - calculate_list(); - ((PresetsWindow*)get_gui())->list->update(data, - 0, - 0, - 1); -} - - -void PresetsThread::apply_preset(char *title) -{ - if(presets_db->preset_exists(plugin_title, title)) - { - get_gui()->unlock_window(); - mwindow->gui->lock_window("PresetsThread::apply_preset"); - -// Test EDL for plugin existence - if(!mwindow->edl->tracks->plugin_exists(plugin)) - { - mwindow->gui->unlock_window(); - get_gui()->lock_window("PresetsThread::delete_preset 1"); - return; - } - - mwindow->undo->update_undo_before(); - KeyFrame *keyframe = plugin->get_keyframe(); - presets_db->load_preset(plugin_title, title, keyframe); - mwindow->save_backup(); - mwindow->undo->update_undo_after(_("apply preset"), LOAD_AUTOMATION); - - mwindow->update_plugin_guis(); - mwindow->gui->canvas->draw_overlays(); - mwindow->gui->canvas->flash(); - mwindow->sync_parameters(CHANGE_PARAMS); - - mwindow->gui->unlock_window(); - get_gui()->lock_window("PresetsThread::apply_preset"); - } -} - - - - - -PresetsList::PresetsList(PresetsThread *thread, - PresetsWindow *window, - int x, - int y, - int w, - int h) - : BC_ListBox(x, - y, - w, - h, - LISTBOX_TEXT, - thread->data) -{ - this->thread = thread; - this->window = window; -} - -int PresetsList::selection_changed() -{ - window->title_text->update( - thread->data->get(get_selection_number(0, 0))->get_text()); - return 0; -} - -int PresetsList::handle_event() -{ - window->set_done(0); - return 0; -} - - - - - - - - - - -PresetsText::PresetsText(PresetsThread *thread, - PresetsWindow *window, - int x, - int y, - int w) - : BC_TextBox(x, - y, - w, - 1, - "") -{ - this->thread = thread; - this->window = window; -} - -int PresetsText::handle_event() -{ - return 0; -} - - - - - - - - - - - - - - - - - -PresetsDelete::PresetsDelete(PresetsThread *thread, - PresetsWindow *window, - int x, - int y) - : BC_GenericButton(x, y, _("Delete")) -{ - this->thread = thread; - this->window = window; -} - -int PresetsDelete::handle_event() -{ - thread->delete_preset(window->title_text->get_text()); - return 1; -} - - - - - - - -PresetsSave::PresetsSave(PresetsThread *thread, - PresetsWindow *window, - int x, - int y) -: BC_GenericButton(x, y, _("Save")) -{ - this->thread = thread; - this->window = window; -} - -int PresetsSave::handle_event() -{ - thread->save_preset(window->title_text->get_text()); - return 1; -} - - - - - - - - -PresetsApply::PresetsApply(PresetsThread *thread, - PresetsWindow *window, - int x, - int y) - : BC_GenericButton(x, y, _("Apply")) -{ - this->thread = thread; - this->window = window; -} - -int PresetsApply::handle_event() -{ - thread->apply_preset(window->title_text->get_text()); - return 1; -} - - - -PresetsOK::PresetsOK(PresetsThread *thread, - PresetsWindow *window) - : BC_OKButton(window) -{ - this->thread = thread; - this->window = window; -} - -int PresetsOK::keypress_event() -{ - if(get_keypress() == RETURN) - { -printf("PresetsOK::keypress_event %d\n", __LINE__); - if(thread->presets_db->preset_exists(thread->plugin_title, - window->title_text->get_text())) - { -printf("PresetsOK::keypress_event %d\n", __LINE__); - window->set_done(0); - return 1; - } - else - { -printf("PresetsOK::keypress_event %d\n", __LINE__); - thread->save_preset(window->title_text->get_text()); - return 1; - } - } - return 0; -} - - - - - - - - - - -PresetsWindow::PresetsWindow(MWindow *mwindow, - PresetsThread *thread, - int x, - int y, - char *title_string) - : BC_Window(title_string, - x, y, - mwindow->session->presetdialog_w, - mwindow->session->presetdialog_h, - xS(320), yS(240), 1, 0, 1) -{ - this->mwindow = mwindow; - this->thread = thread; -} - -void PresetsWindow::create_objects() -{ - Theme *theme = mwindow->theme; - - lock_window("PresetsWindow::create_objects"); - theme->get_presetdialog_sizes(this); - - add_subwindow(title1 = new BC_Title(theme->presets_list_x, - theme->presets_list_y - BC_Title::calculate_h(this, "P") - theme->widget_border, - _("Saved presets:"))); - add_subwindow(list = new PresetsList(thread, - this, - theme->presets_list_x, - theme->presets_list_y, - theme->presets_list_w, - theme->presets_list_h)); - add_subwindow(title2 = new BC_Title(theme->presets_text_x, - theme->presets_text_y - BC_Title::calculate_h(this, "P") - theme->widget_border, - _("Preset title:"))); - add_subwindow(title_text = new PresetsText(thread, - this, - theme->presets_text_x, - theme->presets_text_y, - theme->presets_text_w)); - add_subwindow(delete_button = new PresetsDelete(thread, - this, - theme->presets_delete_x, - theme->presets_delete_y)); - add_subwindow(save_button = new PresetsSave(thread, - this, - theme->presets_save_x, - theme->presets_save_y)); - add_subwindow(apply_button = new PresetsApply(thread, - this, - theme->presets_apply_x, - theme->presets_apply_y)); - - add_subwindow(new PresetsOK(thread, this)); - add_subwindow(new BC_CancelButton(this)); - - show_window(); - unlock_window(); -} - -int PresetsWindow::resize_event(int w, int h) -{ - Theme *theme = mwindow->theme; - mwindow->session->presetdialog_w = w; - mwindow->session->presetdialog_h = h; - theme->get_presetdialog_sizes(this); - - title1->reposition_window(theme->presets_list_x, - theme->presets_list_y - BC_Title::calculate_h(this, "P") - theme->widget_border); - title2->reposition_window(theme->presets_text_x, - theme->presets_text_y - BC_Title::calculate_h(this, "P") - theme->widget_border); - list->reposition_window(theme->presets_list_x, - theme->presets_list_y, - theme->presets_list_w, - theme->presets_list_h); - title_text->reposition_window(theme->presets_text_x, - theme->presets_text_y, - theme->presets_text_w); - delete_button->reposition_window(theme->presets_delete_x, - theme->presets_delete_y); - save_button->reposition_window(theme->presets_save_x, - theme->presets_save_y); - apply_button->reposition_window(theme->presets_apply_x, - theme->presets_apply_y); - return 0; -} - - - - - - -#endif - diff --git a/cinelerra-5.1/cinelerra/presetsgui.C.sav1 b/cinelerra-5.1/cinelerra/presetsgui.C.sav1 deleted file mode 100644 index 43c4c39e..00000000 --- a/cinelerra-5.1/cinelerra/presetsgui.C.sav1 +++ /dev/null @@ -1,503 +0,0 @@ - -/* - * CINELERRA - * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#if 0 - - - - -#include "edl.h" -#include "keyframe.h" -#include "keys.h" -#include "language.h" -#include "localsession.h" -#include "mainsession.h" -#include "mainundo.h" -#include "mwindow.h" -#include "mwindowgui.h" -#include "plugin.h" -#include "presets.h" -#include "presetsgui.h" -#include "theme.h" -#include "trackcanvas.h" -#include "tracks.h" - - - - - - - - - - - -PresetsThread::PresetsThread(MWindow *mwindow) - : BC_DialogThread() -{ - this->mwindow = mwindow; - plugin = 0; - data = new ArrayList<BC_ListBoxItem*>; - presets_db = new PresetsDB; - plugin_title[0] = 0; - window_title[0] = 0; -} - -PresetsThread::~PresetsThread() -{ - delete data; -} - -void PresetsThread::calculate_list() -{ - data->remove_all_objects(); - int total_presets = presets_db->get_total_presets(plugin_title); - for(int i = 0; i < total_presets; i++) - { - data->append(new BC_ListBoxItem(presets_db->get_preset_title( - plugin_title, - i))); - } -} - - -void PresetsThread::start_window(Plugin *plugin) -{ - if(!BC_DialogThread::is_running()) - { - this->plugin = plugin; - plugin->calculate_title(plugin_title, 0); - sprintf(window_title, PROGRAM_NAME ": %s Presets", plugin_title); - - -// Calculate database - presets_db->load(); - calculate_list(); - - - mwindow->gui->unlock_window(); - BC_DialogThread::start(); - mwindow->gui->lock_window("PresetsThread::start_window"); - } -} - -BC_Window* PresetsThread::new_gui() -{ - mwindow->gui->lock_window("PresetsThread::new_gui"); - int x = mwindow->gui->get_abs_cursor_x(0) - - mwindow->session->plugindialog_w / 2; - int y = mwindow->gui->get_abs_cursor_y(0) - - mwindow->session->plugindialog_h / 2; - - PresetsWindow *window = new PresetsWindow(mwindow, - this, - x, - y, - window_title); - - window->create_objects(); - mwindow->gui->unlock_window(); - return window; -} - -void PresetsThread::handle_done_event(int result) -{ -// Apply the preset - if(!result) - { - char *title = ((PresetsWindow*)get_gui())->title_text->get_text(); - apply_preset(title); - } -} - -void PresetsThread::handle_close_event(int result) -{ -} - -void PresetsThread::save_preset(char *title) -{ - get_gui()->unlock_window(); - mwindow->gui->lock_window("PresetsThread::save_preset"); - -// Test EDL for plugin existence - if(!mwindow->edl->tracks->plugin_exists(plugin)) - { - mwindow->gui->unlock_window(); - get_gui()->lock_window("PresetsThread::save_preset 2"); - return; - } - - -// Get current plugin keyframe - EDL *edl = mwindow->edl; - Track *track = plugin->track; - KeyFrame *keyframe = plugin->get_prev_keyframe( - track->to_units(edl->local_session->get_selectionstart(1), 0), - PLAY_FORWARD); - -// Send to database - presets_db->save_preset(plugin_title, title, keyframe->get_data()); - - mwindow->gui->unlock_window(); - get_gui()->lock_window("PresetsThread::save_preset 2"); - - -// Update list - calculate_list(); - ((PresetsWindow*)get_gui())->list->update(data, - 0, - 0, - 1); -} - -void PresetsThread::delete_preset(char *title) -{ - get_gui()->unlock_window(); - mwindow->gui->lock_window("PresetsThread::save_preset"); - -// Test EDL for plugin existence - if(!mwindow->edl->tracks->plugin_exists(plugin)) - { - mwindow->gui->unlock_window(); - get_gui()->lock_window("PresetsThread::delete_preset 1"); - return; - } - - presets_db->delete_preset(plugin_title, title); - - mwindow->gui->unlock_window(); - get_gui()->lock_window("PresetsThread::delete_preset 2"); - - -// Update list - calculate_list(); - ((PresetsWindow*)get_gui())->list->update(data, - 0, - 0, - 1); -} - - -void PresetsThread::apply_preset(char *title) -{ - if(presets_db->preset_exists(plugin_title, title)) - { - get_gui()->unlock_window(); - mwindow->gui->lock_window("PresetsThread::apply_preset"); - -// Test EDL for plugin existence - if(!mwindow->edl->tracks->plugin_exists(plugin)) - { - mwindow->gui->unlock_window(); - get_gui()->lock_window("PresetsThread::delete_preset 1"); - return; - } - - mwindow->undo->update_undo_before(); - KeyFrame *keyframe = plugin->get_keyframe(); - presets_db->load_preset(plugin_title, title, keyframe); - mwindow->save_backup(); - mwindow->undo->update_undo_after(_("apply preset"), LOAD_AUTOMATION); - - mwindow->update_plugin_guis(); - mwindow->gui->canvas->draw_overlays(); - mwindow->gui->canvas->flash(); - mwindow->sync_parameters(CHANGE_PARAMS); - - mwindow->gui->unlock_window(); - get_gui()->lock_window("PresetsThread::apply_preset"); - } -} - - - - - -PresetsList::PresetsList(PresetsThread *thread, - PresetsWindow *window, - int x, - int y, - int w, - int h) - : BC_ListBox(x, - y, - w, - h, - LISTBOX_TEXT, - thread->data) -{ - this->thread = thread; - this->window = window; -} - -int PresetsList::selection_changed() -{ - window->title_text->update( - thread->data->get(get_selection_number(0, 0))->get_text()); - return 0; -} - -int PresetsList::handle_event() -{ - window->set_done(0); - return 0; -} - - - - - - - - - - -PresetsText::PresetsText(PresetsThread *thread, - PresetsWindow *window, - int x, - int y, - int w) - : BC_TextBox(x, - y, - w, - 1, - "") -{ - this->thread = thread; - this->window = window; -} - -int PresetsText::handle_event() -{ - return 0; -} - - - - - - - - - - - - - - - - - -PresetsDelete::PresetsDelete(PresetsThread *thread, - PresetsWindow *window, - int x, - int y) - : BC_GenericButton(x, y, _("Delete")) -{ - this->thread = thread; - this->window = window; -} - -int PresetsDelete::handle_event() -{ - thread->delete_preset(window->title_text->get_text()); - return 1; -} - - - - - - - -PresetsSave::PresetsSave(PresetsThread *thread, - PresetsWindow *window, - int x, - int y) -: BC_GenericButton(x, y, C_("Save")) -{ - this->thread = thread; - this->window = window; -} - -int PresetsSave::handle_event() -{ - thread->save_preset(window->title_text->get_text()); - return 1; -} - - - - - - - - -PresetsApply::PresetsApply(PresetsThread *thread, - PresetsWindow *window, - int x, - int y) - : BC_GenericButton(x, y, _("Apply")) -{ - this->thread = thread; - this->window = window; -} - -int PresetsApply::handle_event() -{ - thread->apply_preset(window->title_text->get_text()); - return 1; -} - - - -PresetsOK::PresetsOK(PresetsThread *thread, - PresetsWindow *window) - : BC_OKButton(window) -{ - this->thread = thread; - this->window = window; -} - -int PresetsOK::keypress_event() -{ - if(get_keypress() == RETURN) - { -printf("PresetsOK::keypress_event %d\n", __LINE__); - if(thread->presets_db->preset_exists(thread->plugin_title, - window->title_text->get_text())) - { -printf("PresetsOK::keypress_event %d\n", __LINE__); - window->set_done(0); - return 1; - } - else - { -printf("PresetsOK::keypress_event %d\n", __LINE__); - thread->save_preset(window->title_text->get_text()); - return 1; - } - } - return 0; -} - - - - - - - - - - -PresetsWindow::PresetsWindow(MWindow *mwindow, - PresetsThread *thread, - int x, - int y, - char *title_string) - : BC_Window(title_string, - x, y, - mwindow->session->presetdialog_w, - mwindow->session->presetdialog_h, - xS(320), yS(240), 1, 0, 1) -{ - this->mwindow = mwindow; - this->thread = thread; -} - -void PresetsWindow::create_objects() -{ - Theme *theme = mwindow->theme; - - lock_window("PresetsWindow::create_objects"); - theme->get_presetdialog_sizes(this); - - add_subwindow(title1 = new BC_Title(theme->presets_list_x, - theme->presets_list_y - BC_Title::calculate_h(this, "P") - theme->widget_border, - _("Saved presets:"))); - add_subwindow(list = new PresetsList(thread, - this, - theme->presets_list_x, - theme->presets_list_y, - theme->presets_list_w, - theme->presets_list_h)); - add_subwindow(title2 = new BC_Title(theme->presets_text_x, - theme->presets_text_y - BC_Title::calculate_h(this, "P") - theme->widget_border, - _("Preset title:"))); - add_subwindow(title_text = new PresetsText(thread, - this, - theme->presets_text_x, - theme->presets_text_y, - theme->presets_text_w)); - add_subwindow(delete_button = new PresetsDelete(thread, - this, - theme->presets_delete_x, - theme->presets_delete_y)); - add_subwindow(save_button = new PresetsSave(thread, - this, - theme->presets_save_x, - theme->presets_save_y)); - add_subwindow(apply_button = new PresetsApply(thread, - this, - theme->presets_apply_x, - theme->presets_apply_y)); - - add_subwindow(new PresetsOK(thread, this)); - add_subwindow(new BC_CancelButton(this)); - - show_window(); - unlock_window(); -} - -int PresetsWindow::resize_event(int w, int h) -{ - Theme *theme = mwindow->theme; - mwindow->session->presetdialog_w = w; - mwindow->session->presetdialog_h = h; - theme->get_presetdialog_sizes(this); - - title1->reposition_window(theme->presets_list_x, - theme->presets_list_y - BC_Title::calculate_h(this, "P") - theme->widget_border); - title2->reposition_window(theme->presets_text_x, - theme->presets_text_y - BC_Title::calculate_h(this, "P") - theme->widget_border); - list->reposition_window(theme->presets_list_x, - theme->presets_list_y, - theme->presets_list_w, - theme->presets_list_h); - title_text->reposition_window(theme->presets_text_x, - theme->presets_text_y, - theme->presets_text_w); - delete_button->reposition_window(theme->presets_delete_x, - theme->presets_delete_y); - save_button->reposition_window(theme->presets_save_x, - theme->presets_save_y); - apply_button->reposition_window(theme->presets_apply_x, - theme->presets_apply_y); - return 0; -} - - - - - - -#endif - diff --git a/cinelerra-5.1/cinelerra/presetsgui.h.sav b/cinelerra-5.1/cinelerra/presetsgui.h.sav deleted file mode 100644 index 52d2cf5c..00000000 --- a/cinelerra-5.1/cinelerra/presetsgui.h.sav +++ /dev/null @@ -1,170 +0,0 @@ - -/* - * CINELERRA - * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#ifndef PRESETSGUI_H -#define PRESETSGUI_H - - -// Presets for effects & transitions -#if 0 - -#include "bcdialog.h" -#include "guicast.h" -#include "mwindow.inc" -#include "plugin.inc" -#include "presets.inc" - -class PresetsWindow; - - - - - -class PresetsThread : public BC_DialogThread -{ -public: - PresetsThread(MWindow *mwindow); - ~PresetsThread(); - - void calculate_list(); - void start_window(Plugin *plugin); - BC_Window* new_gui(); - void handle_done_event(int result); - void handle_close_event(int result); - void save_preset(char *title); - void delete_preset(char *title); - void apply_preset(char *title); - - char window_title[BCTEXTLEN]; - char plugin_title[BCTEXTLEN]; - MWindow *mwindow; - Plugin *plugin; - ArrayList<BC_ListBoxItem*> *data; - PresetsDB *presets_db; -}; - -class PresetsList : public BC_ListBox -{ -public: - PresetsList(PresetsThread *thread, - PresetsWindow *window, - int x, - int y, - int w, - int h); - int selection_changed(); - int handle_event(); - PresetsThread *thread; - PresetsWindow *window; -}; - -class PresetsText : public BC_TextBox -{ -public: - PresetsText(PresetsThread *thread, - PresetsWindow *window, - int x, - int y, - int w); - int handle_event(); - PresetsThread *thread; - PresetsWindow *window; -}; - - -class PresetsDelete : public BC_GenericButton -{ -public: - PresetsDelete(PresetsThread *thread, - PresetsWindow *window, - int x, - int y); - int handle_event(); - PresetsThread *thread; - PresetsWindow *window; -}; - -class PresetsSave : public BC_GenericButton -{ -public: - PresetsSave(PresetsThread *thread, - PresetsWindow *window, - int x, - int y); - int handle_event(); - PresetsThread *thread; - PresetsWindow *window; -}; - -class PresetsApply : public BC_GenericButton -{ -public: - PresetsApply(PresetsThread *thread, - PresetsWindow *window, - int x, - int y); - int handle_event(); - PresetsThread *thread; - PresetsWindow *window; -}; - -class PresetsOK : public BC_OKButton -{ -public: - PresetsOK(PresetsThread *thread, - PresetsWindow *window); - int keypress_event(); - PresetsThread *thread; - PresetsWindow *window; -}; - - -class PresetsWindow : public BC_Window -{ -public: - PresetsWindow(MWindow *mwindow, - PresetsThread *thread, - int x, - int y, - char *title_string); - - void create_objects(); - int resize_event(int w, int h); - - PresetsList *list; - PresetsText *title_text; - PresetsDelete *delete_button; - PresetsSave *save_button; - PresetsApply *apply_button; - BC_Title *title1; - BC_Title *title2; - MWindow *mwindow; - PresetsThread *thread; -}; - - - -#endif - -#endif - - - diff --git a/cinelerra-5.1/cinelerra/presetsgui.inc.sav b/cinelerra-5.1/cinelerra/presetsgui.inc.sav deleted file mode 100644 index 641cd17c..00000000 --- a/cinelerra-5.1/cinelerra/presetsgui.inc.sav +++ /dev/null @@ -1,33 +0,0 @@ - -/* - * CINELERRA - * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#ifndef PRESETSGUI_INC -#define PRESETSGUI_INC - - -class PresetsThread; -class PresetsWindow; - -#endif - - - - -- 2.38.1
-- Cin mailing list [email protected] https://lists.cinelerra-gg.org/mailman/listinfo/cin

