fix for F_sine segv, bunch of intl fixes
authorGood Guy <[email protected]>
Sun, 22 Oct 2017 22:43:05 +0000 (16:43 -0600)
committerGood Guy <[email protected]>
Sun, 22 Oct 2017 22:43:05 +0000 (16:43 -0600)
14 files changed:
cinelerra-5.1/cinelerra/channelinfo.C
cinelerra-5.1/cinelerra/dbwindow.C
cinelerra-5.1/cinelerra/exportedl.C
cinelerra-5.1/cinelerra/exportedl.h
cinelerra-5.1/cinelerra/keyframegui.C
cinelerra-5.1/cinelerra/performanceprefs.C
cinelerra-5.1/cinelerra/performanceprefs.h
cinelerra-5.1/cinelerra/pluginfclient.C
cinelerra-5.1/cinelerra/presetsgui.C [deleted file]
cinelerra-5.1/cinelerra/presetsgui.C.sav1 [new file with mode: 0644]
cinelerra-5.1/cinelerra/recordbatches.C
cinelerra-5.1/cinelerra/recordbatches.h
cinelerra-5.1/cinelerra/swindow.C
cinelerra-5.1/plugins/crikey/crikeywindow.C

index a044338e459e357445256cbcbf339958d87da1b5..4a5bdaadcc40b98c0efad98a6f777def20ccd9ea 100644 (file)
@@ -337,7 +337,7 @@ ChanSearchGUI::ChanSearchGUI(ChanSearch *cswindow)
        search_columns[1] = 1;
        search_columns[2] = 2;
        search_column_titles[0] = _("Source");
-       search_column_titles[1] = _("Title");
+       search_column_titles[1] = C_("Title");
        search_column_titles[2] = _("Start time");
        search_column_widths[0] = 120;
        search_column_widths[2] = 120;
index ec89045824f50c88ab07c571316ec6a48870c969..5d93549f12ccd6323d3cac4adefc544f190983ab 100644 (file)
@@ -588,7 +588,7 @@ DbWindowGUI(DbWindow *dwindow)
        search_column_titles[col_id] = _("Id");
        search_column_titles[col_length] = _("length");
        search_column_titles[col_source] = _("Source");
-       search_column_titles[col_title] = _("Title");
+       search_column_titles[col_title] = C_("Title");
        search_column_titles[col_start_time] = _("Start time");
        search_column_titles[col_access_time] = _("Access time");
        search_column_titles[col_access_count] = _("count");
index 7c8afaa24b6a9ef521b0f7677c7bf86faa2ebd33..8cbbbf3f238ae3950197d2cb57ff71e8f226bf22 100644 (file)
@@ -325,33 +325,31 @@ void ExportEDL::run()
 #define WIDTH 410
 #define HEIGHT 400
 
-static const char *list_titles[] =
+static const char *default_list_titles[] =
 {
        N_("No."),
        N_("Track name")
 };
 
-
-static int list_widths[] =
+static int default_list_widths[] =
 {
        40,
        200
 };
 
+
 ExportEDLWindow::ExportEDLWindow(MWindow *mwindow, ExportEDL *exportedl, ExportEDLAsset *exportasset)
  : BC_Window(_(PROGRAM_NAME ": Export EDL"),
        mwindow->gui->get_screen_w(1, 0) / 2 - WIDTH / 2,
        mwindow->gui->get_root_h(1) / 2 - HEIGHT / 2,
-       WIDTH,
-       HEIGHT,
-       (int)BC_INFINITY,
-       (int)BC_INFINITY,
-       0,
-       0,
-       1)
+       WIDTH, HEIGHT, (int)BC_INFINITY, (int)BC_INFINITY, 0, 0, 1)
 {
        this->mwindow = mwindow;
        this->exportasset = exportasset;
+       for( int i=0; i<2; ++i ) {
+               list_titles[i] = _(default_list_titles[i]);
+               list_widths[i] = default_list_widths[i];
+       }
 }
 
 ExportEDLWindow::~ExportEDLWindow()
@@ -411,7 +409,7 @@ void ExportEDLWindow::create_objects()
        }
 
 
-       add_subwindow(track_list = new ExportEDLWindowTrackList(this, x, y, 400, 200, items_tracks));
+       add_subwindow(track_list = new ExportEDLWindowTrackList(this, x, y, 400, 200));
 
        y += 5 + track_list->get_h();
        add_subwindow(new BC_Title(x, y, _("Currently only CMX 3600 format is supported")));
@@ -439,19 +437,11 @@ int ExportEDLPathText::handle_event()
 }
 
 ExportEDLWindowTrackList::ExportEDLWindowTrackList(ExportEDLWindow *window,
-       int x,
-       int y,
-       int w,
-       int h,
-       ArrayList<BC_ListBoxItem*> *track_list)
- : BC_ListBox(x,
-               y,
-               w,
-               h,
-               LISTBOX_TEXT,
-               track_list,
-               list_titles,
-               list_widths,
+       int x, int y, int w, int h)
+ : BC_ListBox(x, y, w, h, LISTBOX_TEXT,
+               window->items_tracks,
+               window->list_titles,
+               window->list_widths,
                2)
 {
        this->window = window;
index fdd183bb8d2d3c5e13449718c33728c0c12c0914..79e34be7c72bb97b915b35265afb9154560b889d 100644 (file)
@@ -122,8 +122,9 @@ public:
        ExportEDLPathText *path_textbox;
        BC_RecentList *path_recent;
        ExportEDLWindowTrackList *track_list;
-
        ArrayList<BC_ListBoxItem*> items_tracks[2];
+       const char *list_titles[2];
+       int list_widths[2];
 
        MWindow *mwindow;
 };
@@ -146,11 +147,7 @@ class ExportEDLWindowTrackList : public BC_ListBox
 {
 public:
        ExportEDLWindowTrackList(ExportEDLWindow *window,
-               int x,
-               int y,
-               int w,
-               int h,
-               ArrayList<BC_ListBoxItem*> *track_list);
+               int x, int y, int w, int h);
 
        int handle_event();
        ExportEDLWindow *window;
index d7d297411a7ed868a9519a26a5865bfedb2993e3..c60459c985cda012656ec4fcc90aebe390a79298 100644 (file)
@@ -479,7 +479,7 @@ void KeyFrameWindow::create_objects()
 
 
        add_subwindow(title1 = new BC_Title(theme->keyframe_list_x,
-               theme->keyframe_list_y - BC_Title::calculate_h(this, (char*)_("Py"), LARGEFONT) - 
+               theme->keyframe_list_y - BC_Title::calculate_h(this, (char*)"Py", LARGEFONT) - 
                        theme->widget_border, _("Keyframe parameters:"), LARGEFONT));
        add_subwindow(keyframe_list = new KeyFrameList(thread,
                this,
@@ -505,7 +505,7 @@ void KeyFrameWindow::create_objects()
 
 #endif
        add_subwindow(title4 = new BC_Title(theme->presets_list_x, theme->presets_list_y - 
-                       BC_Title::calculate_h(this, (char*)_("Py"), LARGEFONT) - 
+                       BC_Title::calculate_h(this, (char*)"Py", LARGEFONT) - 
                        theme->widget_border, _("Presets:"), LARGEFONT));
        add_subwindow(preset_list = new KeyFramePresetsList(thread, this,
                theme->presets_list_x, theme->presets_list_y,
@@ -796,7 +796,7 @@ KeyFramePresetsSave::KeyFramePresetsSave(KeyFrameThread *thread,
        KeyFrameWindow *window,
        int x,
        int y)
-: BC_GenericButton(x, y, _("Save"))
+: BC_GenericButton(x, y, C_("Save"))
 {
        this->thread = thread;
        this->window = window;
index 148670a07b33ef6292b1c16afa5577548f5f2f0b..e3c7e2ca7b424082c9230187f01bb2e33ff23eb3 100644 (file)
@@ -274,7 +274,7 @@ void PerformancePrefs::generate_node_list()
        }
 }
 
-static const char *titles[] =
+static const char *default_titles[] =
 {
        N_("On"),
        N_("Hostname"),
@@ -282,7 +282,7 @@ static const char *titles[] =
        N_("Framerate")
 };
 
-static int widths[] =
+static int default_widths[] =
 {
        30,
        150,
@@ -293,13 +293,13 @@ static int widths[] =
 
 void PerformancePrefs::update_node_list()
 {
-       node_list->update(nodes,
-                                               titles,
-                                               widths,
-                                               TOTAL_COLUMNS,
-                                               node_list->get_xposition(),
-                                               node_list->get_yposition(),
-                                               node_list->get_selection_number(0, 0));
+       node_list->update_list();
+}
+
+void PrefsRenderFarmNodes::update_list()
+{
+       update(subwindow->nodes, titles, widths, PerformancePrefs::TOTAL_COLUMNS,
+               get_xposition(), get_yposition(), get_selection_number(0, 0));
 }
 
 
@@ -546,19 +546,18 @@ int PrefsRenderFarmPort::handle_event()
 
 
 PrefsRenderFarmNodes::PrefsRenderFarmNodes(PreferencesWindow *pwindow,
-       PerformancePrefs *subwindow,
-       int x,
-       int y)
- : BC_ListBox(x,
-               y,
-               340,
-               230,
+       PerformancePrefs *subwindow, int x, int y)
+ : BC_ListBox(x, y, 340, 230,
                LISTBOX_TEXT,                         // Display text list or icons
                subwindow->nodes,
-               titles,
-               widths,
-               4)
+               0, //default_titles,
+               0, //default_widths,
+               PerformancePrefs::TOTAL_COLUMNS)
 {
+       for( int i=0; i<PerformancePrefs::TOTAL_COLUMNS; ++i ) {
+               titles[i] = _(default_titles[i]);
+               widths[i] = default_widths[i];
+       }
        this->subwindow = subwindow;
        this->pwindow = pwindow;
 }
@@ -568,7 +567,7 @@ PrefsRenderFarmNodes::~PrefsRenderFarmNodes()
 
 int PrefsRenderFarmNodes::column_resize_event()
 {
-       for(int i = 0; i < 3; i++)
+       for( int i=0; i<PerformancePrefs::TOTAL_COLUMNS; ++i )
                widths[i] = get_column_width(i);
        return 1;
 }
index b0d7e65f4a8b529b3106560888f5faaf7a6e12bd..6e1e99c80f6b81a3217717a41e6c2b8e4eeb0001 100644 (file)
@@ -56,7 +56,7 @@ public:
                TOTAL_COLUMNS
        };
 
-       ArrayList<BC_ListBoxItem*> nodes[4];
+       ArrayList<BC_ListBoxItem*> nodes[TOTAL_COLUMNS];
        PrefsRenderFarmEditNode *edit_node;
        PrefsRenderFarmPort *edit_port;
        PrefsRenderFarmNodes *node_list;
@@ -238,6 +238,10 @@ public:
        int handle_event();
        int selection_changed();
        int column_resize_event();
+       void update_list();
+
+       const char *titles[PerformancePrefs::TOTAL_COLUMNS];
+       int widths[PerformancePrefs::TOTAL_COLUMNS];
 
        PreferencesWindow *pwindow;
        PerformancePrefs *subwindow;
index 56b459587222e120a996a1cc2fb7f89995c77779..2a35e96c7539c2039e2914471d1926502f9e484e 100644 (file)
@@ -836,6 +836,11 @@ int PluginFAClient::process_buffer(int64_t size, Samples **buffer, int64_t start
        if( ret >= 0 ) {
                in_channels = get_inchannels();
                out_channels = get_outchannels();
+               frame->nb_samples = size;
+               frame->format = AV_SAMPLE_FMT_FLTP;
+               frame->channel_layout = (1<<in_channels)-1;
+               frame->sample_rate = sample_rate;
+               frame->pts = local_to_edl(filter_position);
        }
 
        int retry = 10;
@@ -846,11 +851,6 @@ int PluginFAClient::process_buffer(int64_t size, Samples **buffer, int64_t start
                for( int i=0; i<total_in; ++i )
                        read_samples(buffer[i], i, sample_rate, filter_position, size);
                filter_position += size;
-               frame->nb_samples = size;
-               frame->format = AV_SAMPLE_FMT_FLTP;
-               frame->channel_layout = (1<<in_channels)-1;
-               frame->sample_rate = sample_rate;
-               frame->pts = local_to_edl(filter_position);
                ret = av_frame_get_buffer(frame, 0);
                if( ret < 0 ) break;
                float **in_buffers = (float **)&frame->extended_data[0];
diff --git a/cinelerra-5.1/cinelerra/presetsgui.C b/cinelerra-5.1/cinelerra/presetsgui.C
deleted file mode 100644 (file)
index c5dbe8e..0000000
+++ /dev/null
@@ -1,508 +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, _("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, 
-       320, 
-       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
new file mode 100644 (file)
index 0000000..b3ad7ed
--- /dev/null
@@ -0,0 +1,508 @@
+
+/*
+ * 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, 
+       320, 
+       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
+
index df576ed175eb9060558d516f9f4749f4e1f7e164..0fe7d76b2f87919bc33d9b39effd83db26ba75bc 100644 (file)
@@ -18,7 +18,7 @@
 #include "timeentry.h"
 
 const char * RecordBatches::
-batch_titles[] = {
+default_batch_titles[] = {
        N_("On"), N_("Path"), N_("News"), N_("Start time"),
        N_("Duration"), N_("Source"), N_("Mode")
 };
@@ -37,6 +37,7 @@ load_defaults(ChannelDB * channeldb, Record * record)
        early_margin = defaults->get("RECORD_EARLY_MARGIN", early_margin);
        late_margin = defaults->get("RECORD_LATE_MARGIN", late_margin);
        for(int i = 0; i < BATCH_COLUMNS; i++) {
+               batch_titles[i] = _(default_batch_titles[i]);
                sprintf(string, "BATCH_COLUMNWIDTH_%d", i);
                column_widths[i] = defaults->get(string, default_columnwidth[i]);
        }
index b0a4be2b7558f10dc2b95840e4e0ac52c8c09e8e..c587281c4caa9ade69b0b431b3c3593cdb2a3160 100644 (file)
@@ -18,14 +18,15 @@ class RecordBatchesGUI;
 class RecordBatches
 {
 public:
-       static const char* batch_titles[];
-       static const int default_columnwidth[];
        RecordBatchesGUI *gui;
        MWindow *mwindow;
 //  Don't want to interrupt recording to edit a different batch.
        int current_item; // Current batch being recorded.
        int editing_item; // Current batch being edited.
        int batch_active;
+       static const char* default_batch_titles[];
+       const char *batch_titles[BATCH_COLUMNS];
+       static const int default_columnwidth[];
        int column_widths[BATCH_COLUMNS];
        ArrayList<BC_ListBoxItem*> data[BATCH_COLUMNS];
        ArrayList<Batch*> batches;
index ea052eebb2580a6684aa5552e6f08a736cd66184..fd173764f8eab5d61e4d4218c986e0a3af099422 100644 (file)
@@ -114,7 +114,7 @@ int SWindowLoadFile::handle_event()
 }
 
 SWindowSaveFile::SWindowSaveFile(SWindowGUI *gui, int x, int y)
- : BC_GenericButton(x, y, C_("Save"))
+ : BC_GenericButton(x, y, _("Save"))
 {
        this->sw_gui = gui;
 }
index c55b98c73016d607dcc75948240712847b58c023..a289a6d128a530ebb514e7b50138cf6c57e5cabd 100644 (file)
@@ -619,7 +619,7 @@ int CriKeyNewPoint::handle_event()
 }
 
 CriKeyDelPoint::CriKeyDelPoint(CriKeyWindow *gui, CriKey *plugin, int x, int y)
- : BC_GenericButton(x, y, 80, _("Del"))
+ : BC_GenericButton(x, y, 80, C_("Del"))
 {
        this->gui = gui;
        this->plugin = plugin;