From e349d8299c3d1242bcb05b12835fe348ae23f42d Mon Sep 17 00:00:00 2001 From: Pierre Dumuid Date: Mon, 25 Sep 2006 08:15:07 +0000 Subject: [PATCH] r899: autogrouptypes given better names in xml; Decibels / video fade units need not be more than 1 decimal place; automation_{min,max} need not be saved anymore, (need to delete from code completely) --- cinelerra/automation.inc | 3 ++ cinelerra/localsession.C | 80 ++++++++++++++++++++++++++++++------------------ cinelerra/zoombar.C | 2 +- 3 files changed, 54 insertions(+), 31 deletions(-) diff --git a/cinelerra/automation.inc b/cinelerra/automation.inc index 6cec50ce..d3e3afa8 100644 --- a/cinelerra/automation.inc +++ b/cinelerra/automation.inc @@ -29,6 +29,9 @@ enum // Automation group types (used by the gui to control the ranges) + +// These must match the following arrays: +// xml_autogrouptypes_* in localsession.C enum { AUTOGROUPTYPE_AUDIO_FADE, diff --git a/cinelerra/localsession.C b/cinelerra/localsession.C index 69eaa69c..884edfd2 100644 --- a/cinelerra/localsession.C +++ b/cinelerra/localsession.C @@ -6,8 +6,35 @@ #include "localsession.h" - - +static char *xml_autogrouptypes_titlesmax[] = +{ + "AUTOGROUPTYPE_AUDIO_FADE_MAX", + "AUTOGROUPTYPE_VIDEO_FADE_MAX", + "AUTOGROUPTYPE_ZOOM_MAX", + "AUTOGROUPTYPE_X_MAX", + "AUTOGROUPTYPE_Y_MAX", + "AUTOGROUPTYPE_INT255_MAX" +}; + +static char *xml_autogrouptypes_titlesmin[] = +{ + "AUTOGROUPTYPE_AUDIO_FADE_MIN", + "AUTOGROUPTYPE_VIDEO_FADE_MIN", + "AUTOGROUPTYPE_ZOOM_MIN", + "AUTOGROUPTYPE_X_MIN", + "AUTOGROUPTYPE_Y_MIN", + "AUTOGROUPTYPE_INT255_MIN" +}; + +static int xml_autogrouptypes_save[] = +{ + 1, + 1, + 1, + 1, + 1, + 0 +}; LocalSession::LocalSession(EDL *edl) { @@ -119,15 +146,13 @@ void LocalSession::save_xml(FileXML *file, double start) file->tag.set_property("RED", red); file->tag.set_property("GREEN", green); file->tag.set_property("BLUE", blue); - char tmp[20]; + for (int i = 0; i < AUTOGROUPTYPE_COUNT; i++) { - sprintf(tmp,"AUTOGROUPTYPE%02d_MINS",i); - file->tag.set_property(tmp,automation_mins[i]); - sprintf(tmp,"AUTOGROUPTYPE%02d_MAXS",i); - file->tag.set_property(tmp,automation_maxs[i]); + if (xml_autogrouptypes_save[i]) { + file->tag.set_property(xml_autogrouptypes_titlesmin[i],automation_mins[i]); + file->tag.set_property(xml_autogrouptypes_titlesmax[i],automation_maxs[i]); + } } - file->tag.set_property("AUTOMATION_MIN", automation_min); - file->tag.set_property("AUTOMATION_MAX", automation_max); file->append_tag(); file->tag.set_title("/LOCALSESSION"); file->append_tag(); @@ -172,15 +197,13 @@ void LocalSession::load_xml(FileXML *file, unsigned long load_flags) red = file->tag.get_property("RED", red); green = file->tag.get_property("GREEN", green); blue = file->tag.get_property("BLUE", blue); - char tmp[20]; + for (int i = 0; i < AUTOGROUPTYPE_COUNT; i++) { - sprintf(tmp,"AUTOGROUPTYPE%02d_MINS",i); - automation_mins[i] = file->tag.get_property(tmp,automation_mins[i]); - sprintf(tmp,"AUTOGROUPTYPE%02d_MAXS",i); - automation_maxs[i] = file->tag.get_property(tmp,automation_maxs[i]); + if (xml_autogrouptypes_save[i]) { + automation_mins[i] = file->tag.get_property(xml_autogrouptypes_titlesmin[i],automation_mins[i]); + automation_maxs[i] = file->tag.get_property(xml_autogrouptypes_titlesmax[i],automation_maxs[i]); + } } - automation_min = file->tag.get_property("AUTOMATION_MIN", automation_min); - automation_max = file->tag.get_property("AUTOMATION_MAX", automation_max); } @@ -221,15 +244,14 @@ int LocalSession::load_defaults(BC_Hash *defaults) red = defaults->get("RED", 0.0); green = defaults->get("GREEN", 0.0); blue = defaults->get("BLUE", 0.0); - char tmp[20]; + for (int i = 0; i < AUTOGROUPTYPE_COUNT; i++) { - sprintf(tmp,"AUTOGROUPTYPE%02d_MINS",i); - automation_mins[i] = defaults->get(tmp, automation_mins[i]); - sprintf(tmp,"AUTOGROUPTYPE%02d_MAXS",i); - automation_maxs[i] = defaults->get(tmp, automation_maxs[i]); + if (xml_autogrouptypes_save[i]) { + automation_mins[i] = defaults->get(xml_autogrouptypes_titlesmin[i], automation_mins[i]); + automation_maxs[i] = defaults->get(xml_autogrouptypes_titlesmax[i], automation_maxs[i]); + } } - automation_min = defaults->get("AUTOMATION_MIN", automation_min); - automation_max = defaults->get("AUTOMATION_MAX", automation_max); + return 0; } @@ -248,16 +270,14 @@ int LocalSession::save_defaults(BC_Hash *defaults) defaults->update("RED", red); defaults->update("GREEN", green); defaults->update("BLUE", blue); - char tmp[20]; + for (int i = 0; i < AUTOGROUPTYPE_COUNT; i++) { - sprintf(tmp,"AUTOGROUPTYPE%02d_MINS",i); - defaults->update(tmp, automation_mins[i]); - sprintf(tmp,"AUTOGROUPTYPE%02d_MAXS",i); - defaults->update(tmp, automation_maxs[i]); + if (xml_autogrouptypes_save[i]) { + defaults->update(xml_autogrouptypes_titlesmin[i], automation_mins[i]); + defaults->update(xml_autogrouptypes_titlesmax[i], automation_maxs[i]); + } } - defaults->update("AUTOMATION_MIN", automation_min); - defaults->update("AUTOMATION_MAX", automation_max); return 0; } diff --git a/cinelerra/zoombar.C b/cinelerra/zoombar.C index c7f2149a..d91f9213 100644 --- a/cinelerra/zoombar.C +++ b/cinelerra/zoombar.C @@ -140,7 +140,7 @@ void ZoomBar::update_autozoom() switch (mwindow->edl->local_session->zoombar_showautotype) { case AUTOGROUPTYPE_AUDIO_FADE: case AUTOGROUPTYPE_VIDEO_FADE: - sprintf(string, "%0.02f to %0.02f\n", + sprintf(string, "%0.01f to %0.01f\n", mwindow->edl->local_session->automation_mins[mwindow->edl->local_session->zoombar_showautotype], mwindow->edl->local_session->automation_maxs[mwindow->edl->local_session->zoombar_showautotype]); break; -- 2.11.4.GIT