histogram fix, use_thumbnails fix, zoom popup width tweak, cut/paste for mixer apply...
authorGood Guy <good1.2guy@gmail.com>
Mon, 25 Mar 2019 00:00:10 +0000 (18:00 -0600)
committerGood Guy <good1.2guy@gmail.com>
Mon, 25 Mar 2019 00:00:10 +0000 (18:00 -0600)
cinelerra-5.1/cinelerra/mixersalign.C
cinelerra-5.1/cinelerra/preferences.C
cinelerra-5.1/cinelerra/theme.C
cinelerra-5.1/cinelerra/zoompanel.C
cinelerra-5.1/plugins/histogram/histogram.C
cinelerra-5.1/plugins/histogram/histogramwindow.C
cinelerra-5.1/plugins/histogram/histogramwindow.h

index 2cdf5275ae97c09fda43b386c4d09ffff0527fb1..188782c1a09e3c69c8d85bb821c7c9ff4ff58240 100644 (file)
@@ -26,6 +26,7 @@
 #include "edit.h"
 #include "edits.h"
 #include "edl.h"
+#include "edlsession.h"
 #include "localsession.h"
 #include "mainerror.h"
 #include "mainprogress.h"
@@ -580,6 +581,7 @@ void MixersAlign::apply()
 {
        int idx = ma_gui->mtrack_list->get_selection_number(0, 0);
        int midx = -1, mid = mixer_of(mtracks[idx]->track, midx);
+       EDL *edl = mwindow->edl;
        
        for( int m, i=0; (m=ma_gui->mixer_list->get_selection_number(0,i))>=0; ++i ) {
                if( m == mid ) continue;  // master does not move
@@ -587,15 +589,27 @@ void MixersAlign::apply()
                Mixer *mixer = mix->mixer;
                for( int i=0; i<mixer->mixer_ids.size(); ++i ) {
                        int id = mixer->mixer_ids[i];
-                       Track *track = mwindow->edl->tracks->first;
+                       Track *track = edl->tracks->first;
                        while( track && track->mixer_id != id ) track = track->next;
                        if( !track ) continue;
-                       int64_t dt = track->to_units(mix->nudge, 0);
-                       for( Edit *edit=track->edits->first; edit; edit=edit->next )
-                               edit->startproject += dt;
-                       track->optimize();
+                       double nudge = mix->nudge;
+                       int record = track->record;  track->record = 1;
+                       if( nudge < 0 ) {
+                               edl->clear(0, -nudge,
+                                       edl->session->labels_follow_edits,
+                                       edl->session->plugins_follow_edits,
+                                       edl->session->autos_follow_edits);
+                       }
+                       else if( nudge > 0 ) {
+                               edl->paste_silence(0, nudge,
+                                       edl->session->labels_follow_edits,
+                                       edl->session->plugins_follow_edits,
+                                       edl->session->autos_follow_edits);
+                       }
+                       track->record = record;
                }
        }
+       edl->optimize();
 
        mwindow->gui->lock_window("MixersAlign::handle_done_event");
        mwindow->update_gui(1);
@@ -628,6 +642,11 @@ void MixersAlignThread::run()
 
 void MixersAlign::handle_done_event(int result)
 {
+       if( thread->running() ) {
+               failed = -1;
+               thread->join();
+               return;
+       }
        if( !result ) {
                EDL *edl = mwindow->edl;
                mwindow->edl = undo_edl;
@@ -635,10 +654,6 @@ void MixersAlign::handle_done_event(int result)
                mwindow->edl = edl;
                mwindow->undo_after(_("align mixers"), LOAD_ALL);
        }
-       else if( thread->running() ) {
-               failed = -1;
-               thread->join();
-       }
 }
 
 void MixersAlign::handle_close_event(int result)
index 1f6bb04a72a04f7568e4836788d1fd09cb3d3667..6e7ffc914d72f2a3bc33c9737cbc81f84a27dcd0 100644 (file)
@@ -315,6 +315,7 @@ int Preferences::load_defaults(BC_Hash *defaults)
        defaults->get("INDEX_DIRECTORY", index_directory);
        index_size = defaults->get("INDEX_SIZE", index_size);
        index_count = defaults->get("INDEX_COUNT", index_count);
+       use_thumbnails = defaults->get("USE_THUMBNAILS", use_thumbnails);
        keyframe_reticle = defaults->get("KEYFRAME_RETICLE", keyframe_reticle);
        perpetual_session = defaults->get("PERPETUAL_SESSION", perpetual_session);
        strcpy(lv2_path, DEFAULT_LV2_PATH);
index 55e2cbc051c65cf5120bf79561e7bf920ac38d14..946eb37e9fabd2f8b42b9d6afa131e24dae1511b 100644 (file)
@@ -94,7 +94,7 @@ Theme::Theme()
        preferences_category_overlap = 0;
 
        loadmode_w = 350;
-       czoom_w = 80;
+       czoom_w = 110;
 
 #include "data/about_bg_png.h"
        about_bg = new VFramePng(about_bg_png);
index e826e30bd837e7f8f39d9ea869292a56ae9deb8b..fb5a9fbaee1bd967c911a7ea22f92d8855ad88bf 100644 (file)
@@ -106,7 +106,7 @@ void ZoomPanel::calculate_menu()
 
 int ZoomPanel::calculate_w(int menu_w)
 {
-       return BC_PopupMenu::calculate_w(menu_w) + BC_Tumbler::calculate_w();
+       return BC_PopupMenu::calculate_w(-1, menu_w, 1) + BC_Tumbler::calculate_w();
 }
 
 void ZoomPanel::update_menu()
index da67c208694425820ffdc42af07f0949562086d7..1d24200135994d351b7620d087c85760f0b58b0e 100644 (file)
@@ -280,7 +280,8 @@ float HistogramMain::calculate_level(float input,
 // Scale to input range
        if(!EQUIV(config.high_input[mode], config.low_input[mode]))
        {
-               output = (input - config.low_input[mode]) /
+               output = input < config.low_input[mode] ? 0 :
+                   (input - config.low_input[mode]) /
                        (config.high_input[mode] - config.low_input[mode]);
        }
        else
index 1dcc592eaf6f2f91507c3606c6aa12a5a6f345af..9529b6e17fdc2532f57e9c2d0843b98387df2e04 100644 (file)
@@ -167,82 +167,44 @@ void HistogramWindow::create_objects()
 
 //     add_subwindow(title = new BC_Title(x, y, _("Input:")));
 //     x += title->get_w() + margin;
-       low_input = new HistogramText(plugin,
-               this,
-               x,
-               y);
+       low_input = new HistogramText(plugin, this, x, y);
        low_input->create_objects();
 
        x = get_w() / 2 - low_input->get_w() / 2;
-       gamma = new HistogramText(plugin,
-               this,
-               x,
-               y);
+       gamma = new HistogramText(plugin, this, x, y, 0.01, 100.);
        gamma->create_objects();
 
-
        x = get_w() - low_input->get_w() - margin;
-       high_input = new HistogramText(plugin,
-               this,
-               x,
-               y);
+       high_input = new HistogramText(plugin, this, x, y);
        high_input->create_objects();
 
-
        y += high_input->get_h() + margin;
        x = x1;
 
-
-
-       add_subwindow(output = new HistogramSlider(plugin,
-               this,
-               canvas->get_x(),
-               y,
-               canvas->get_w(),
-               20,
-               0));
+       add_subwindow(output = new HistogramSlider(plugin, this,
+               canvas->get_x(), y, canvas->get_w(), 20, 0));
        output->update();
 
 // Output border
-       draw_3d_border(output->get_x() - 2,
-               output->get_y() - 2,
-               output->get_w() + 4,
-               output->get_h() + 4,
-               get_bg_color(),
-               BLACK,
-               MDGREY,
-               get_bg_color());
-
-
+       draw_3d_border(output->get_x() - 2, output->get_y() - 2,
+               output->get_w() + 4, output->get_h() + 4,
+               get_bg_color(), BLACK, MDGREY, get_bg_color());
        y += output->get_h();
 
-
-
        add_subwindow(low_output_carrot = new HistogramCarrot(plugin,
-               this,
-               margin,
-               y));
+               this, margin, y));
 
        add_subwindow(high_output_carrot = new HistogramCarrot(plugin,
-               this,
-               canvas->get_x() +
-                       canvas->get_w() -
-                       low_output_carrot->get_w() / 2,
-               y));
+               this, canvas->get_x() + canvas->get_w() -
+                       low_output_carrot->get_w() / 2, y));
        y += high_output_carrot->get_h() + margin;
 
-
 //     add_subwindow(title = new BC_Title(x, y, _("Output:")));
 //     x += title->get_w() + margin;
-       low_output = new HistogramText(plugin,
-               this,
-               x,
-               y);
+       low_output = new HistogramText(plugin, this, x, y);
        low_output->create_objects();
-       high_output = new HistogramText(plugin,
-               this,
-               get_w() - low_output->get_w() - margin,
-               y);
+       high_output = new HistogramText(plugin, this,
+               get_w() - low_output->get_w() - margin, y);
        high_output->create_objects();
 
        x = x1;
@@ -251,35 +213,25 @@ void HistogramWindow::create_objects()
        add_subwindow(bar = new BC_Bar(x, y, get_w() - margin * 2));
        y += bar->get_h() + margin;
 
-       add_subwindow(automatic = new HistogramAuto(plugin,
-               x,
-               y));
+       add_subwindow(automatic = new HistogramAuto(plugin, x, y));
 
        //int y1 = y;
        x = 200;
        add_subwindow(threshold_title = new BC_Title(x, y, _("Threshold:")));
        x += threshold_title->get_w() + margin;
-       threshold = new HistogramText(plugin,
-               this,
-               x,
-               y);
+       threshold = new HistogramText(plugin, this, x, y);
        threshold->create_objects();
 
        x = get_w() / 2;
        add_subwindow(reset = new HistogramReset(plugin,
-               x,
-               y + threshold->get_h() + margin));
+               x, y + threshold->get_h() + margin));
 
        x = x1;
        y += automatic->get_h() + margin;
-       add_subwindow(plot = new HistogramPlot(plugin,
-               x,
-               y));
+       add_subwindow(plot = new HistogramPlot(plugin, x, y));
 
        y += plot->get_h() + 5;
-       add_subwindow(split = new HistogramSplit(plugin,
-               x,
-               y));
+       add_subwindow(split = new HistogramSplit(plugin, x, y));
 
        update(1, 1, 1, 1);
 
@@ -1020,16 +972,8 @@ int HistogramMode::handle_event()
 
 
 HistogramText::HistogramText(HistogramMain *plugin,
-       HistogramWindow *gui,
-       int x,
-       int y)
- : BC_TumbleTextBox(gui,
-               0.0,
-               (float)HIST_MIN_INPUT,
-               (float)HIST_MAX_INPUT,
-               x,
-               y,
-               70)
+       HistogramWindow *gui, int x, int y, float hist_min, float hist_max)
+ : BC_TumbleTextBox(gui, 0.0, hist_min, hist_max, x, y, 70)
 {
        this->plugin = plugin;
        this->gui = gui;
index 6262ee8ad3c1945fb937e5369cdff449a7dfa20d..f21363e34d63f2754ad5ef2700478240d94bde14 100644 (file)
@@ -152,9 +152,9 @@ class HistogramText : public BC_TumbleTextBox
 {
 public:
        HistogramText(HistogramMain *plugin,
-               HistogramWindow *gui,
-               int x,
-               int y);
+               HistogramWindow *gui, int x, int y,
+               float hist_min = HIST_MIN_INPUT,
+               float hist_max = HIST_MAX_INPUT);
 
        int handle_event();
        void update();