update po files, plus a few fixes and improvements
[goodguy/history.git] / cinelerra-5.1 / cinelerra / assetedit.C
index 9d3e6869b3cec69fbc4bd5e36514250dbacee221..eb76149b3b1eca5364e460a2165a4054ad36bc50 100644 (file)
@@ -108,6 +108,17 @@ void AssetEdit::edit_asset(Indexable *indexable)
        BC_DialogThread::start();
 }
 
+void AssetEdit::handle_done_event(int result)
+{
+       if( !result ) {
+               changed_params->tcstart = ceil(indexable->get_frame_rate() *
+                       (atoi(window->tc_hours_textbox->get_text()) * 3600 +
+                        atoi(window->tc_minutes_textbox->get_text()) * 60 +
+                        atoi(window->tc_seconds_textbox->get_text()))) +
+                        atoi(window->tc_rest_textbox->get_text());
+       }
+}
+
 void AssetEdit::handle_close_event(int result)
 {
        if(!result)
@@ -143,7 +154,7 @@ void AssetEdit::handle_close_event(int result)
 // happening when new_asset was created but not be happening anymore.
                        if(asset)
                        {
-                       mwindow->remove_asset_from_caches(asset);
+                               mwindow->remove_asset_from_caches(asset);
 //printf("AssetEdit::handle_close_event %d %f\n", __LINE__, asset->get_frame_rate());
                                asset->copy_from(changed_params, 0);
 //printf("AssetEdit::handle_close_event %d %d %d\n", __LINE__, changed_params->bits, asset->bits);
@@ -506,7 +517,7 @@ void AssetEditWindow::create_objects()
 
                add_subwindow(new BC_Title(x, y, _("Frame rate:")));
                x = x2;
-               sprintf(string, "%.2f", asset_edit->changed_params->frame_rate);
+               sprintf(string, "%.4f", asset_edit->changed_params->frame_rate);
 
 //printf("AssetEditWindow::create_objects %d %f\n", __LINE__, asset_edit->changed_params->frame_rate);
                if(asset)
@@ -609,39 +620,24 @@ void AssetEditWindow::create_objects()
                x = x2;
 
 // Calculate values to enter into textboxes
-               char tc[12];
-
-               Units::totext(tc,
-                       asset->tcstart / asset->frame_rate,
-                       TIME_HMSF,
-                       asset->sample_rate,
-                       asset->frame_rate);
-
-               char *tc_hours = tc;
-               char *tc_minutes = strchr(tc, ':') + 1;
-               *(tc_minutes - 1) = 0;
-               char *tc_seconds = strchr(tc_minutes, ':') + 1;
-               *(tc_seconds - 1) = 0;
-               char *tc_rest = strchr(tc_seconds, ':') + 1;
-               *(tc_rest - 1) = 0;
-
-               add_subwindow(new AssetEditTCStartTextBox(this, atoi(tc_hours), x, y,
-                       (int) (asset->frame_rate * 60 * 60)));
-               x += 30;
-               add_subwindow(new BC_Title(x, y, ":"));
-               x += 10;
-               add_subwindow(new AssetEditTCStartTextBox(this, atoi(tc_minutes), x, y,
-                       (int) (asset->frame_rate * 60)));
-               x += 30;
-               add_subwindow(new BC_Title(x, y, ":"));
-               x += 10;
-               add_subwindow(new AssetEditTCStartTextBox(this, atoi(tc_seconds), x, y,
-                       (int) (asset->frame_rate)));
-               x += 30;
-               add_subwindow(new BC_Title(x, y, ":"));
-               x += 10;
-               add_subwindow(new AssetEditTCStartTextBox(this, atoi(tc_rest), x, y, 1));
-
+               char text[32], *tc = text;
+               Units::totext(tc, asset->tcstart / asset->frame_rate,
+                       TIME_HMSF, asset->sample_rate, asset->frame_rate);
+
+               const char *tc_hours = tc, *tc_minutes, *tc_seconds, *tc_rest;
+               tc = strchr(tc, ':');  *tc++ = 0;  tc_minutes = tc;
+               tc = strchr(tc, ':');  *tc++ = 0;  tc_seconds = tc;
+               tc = strchr(tc, ':');  *tc++ = 0;  tc_rest = tc;
+
+               int padw = BC_Title::calculate_w(this, ":", MEDIUMFONT);
+               int fldw = BC_Title::calculate_w(this, "00", MEDIUMFONT) + 5;
+               add_subwindow(tc_hours_textbox = new BC_TextBox(x, y, fldw, 1, tc_hours));
+               add_subwindow(new BC_Title(x += tc_hours_textbox->get_w(), y, ":"));
+               add_subwindow(tc_minutes_textbox = new BC_TextBox(x += padw, y, fldw, 1, tc_minutes));
+               add_subwindow(new BC_Title(x += tc_minutes_textbox->get_w(), y, ":"));
+               add_subwindow(tc_seconds_textbox = new BC_TextBox(x += padw, y , fldw, 1, tc_seconds));
+               add_subwindow(new BC_Title(x += tc_seconds_textbox->get_w(), y, ":"));
+               add_subwindow(tc_rest_textbox = new BC_TextBox(x += 10, y, fldw, 1, tc_rest));
 
                y += 30;
        }
@@ -1090,7 +1086,7 @@ void DetailAssetThread::run()
 
 
 AssetEditReelName::AssetEditReelName(AssetEditWindow *fwindow, int x, int y)
- : BC_TextBox(x, y, 300, 1,
+ : BC_TextBox(x, y, 220, 1,
        ((Asset *)fwindow->asset_edit->indexable)->reel_name,
        1, MEDIUMFONT, 1)
 {
@@ -1127,25 +1123,3 @@ int AssetEditReelNumber::handle_event()
 
 
 
-
-
-AssetEditTCStartTextBox::AssetEditTCStartTextBox(AssetEditWindow *fwindow, int value, int x, int y, int multiplier)
- : BC_TextBox(x, y, 30, 1, value)
-{
-       this->fwindow = fwindow;
-       this->multiplier = multiplier;
-       previous = value;
-}
-AssetEditTCStartTextBox::~AssetEditTCStartTextBox()
-{
-}
-int AssetEditTCStartTextBox::handle_event()
-{
-       Asset *asset = fwindow->asset_edit->changed_params;
-       asset->tcstart -= previous * multiplier;
-       asset->tcstart += atoi(get_text()) * multiplier;
-       previous = atoi(get_text());
-       return 1;
-}
-
-