From 3e2a84e6a0aafbe7e00bf1b575f9d2620af10a9a Mon Sep 17 00:00:00 2001 From: ice0 Date: Aug 26 2018 13:35:03 +0000 Subject: removed boost::format requirement --- diff --git a/synfig-core/src/synfig/main.cpp b/synfig-core/src/synfig/main.cpp index 74013d9..d68d63d 100644 --- a/synfig-core/src/synfig/main.cpp +++ b/synfig-core/src/synfig/main.cpp @@ -437,8 +437,9 @@ void synfig::error(const char *format,...) { va_list args; - va_start(args,format); - error(vstrprintf(format,args)); + va_start(args, format); + error(vstrprintf(format, args)); + va_end(args); } void @@ -455,6 +456,7 @@ synfig::warning(const char *format,...) va_list args; va_start(args,format); warning(vstrprintf(format,args)); + va_end(args); } void @@ -469,8 +471,9 @@ void synfig::info(const char *format,...) { va_list args; - va_start(args,format); - info(vstrprintf(format,args)); + va_start(args, format); + info(vstrprintf(format, args)); + va_end(args); } void diff --git a/synfig-core/src/tool/joblistprocessor.cpp b/synfig-core/src/tool/joblistprocessor.cpp index 36009a5..73196fc 100644 --- a/synfig-core/src/tool/joblistprocessor.cpp +++ b/synfig-core/src/tool/joblistprocessor.cpp @@ -37,7 +37,7 @@ #include #include -#include +//#include #include #include @@ -165,10 +165,11 @@ bool setup_job(Job& job, const TargetParam& target_parameters) // az: fixme if (access(get_absolute_path(job.outfilename + "/../").c_str(), W_OK) == -1) { - const std::string message = + /*const std::string message = (boost::format(_("Unable to create output for \"%s\": %s")) % job.filename % strerror(errno)).str(); - synfig::error(message.c_str()); + synfig::error(message.c_str());*/ + synfig::error(_("Unable to create output for \"%s\": %s"), job.filename, strerror(errno)); synfig::error(_("Throwing out job...")); return false; } @@ -185,12 +186,14 @@ bool setup_job(Job& job, const TargetParam& target_parameters) { if(!job.target) { - const std::string message = + /*const std::string message = (boost::format(_("Unknown target for \"%s\": %s")) % job.filename % strerror(errno)).str(); - synfig::error(message.c_str()); - synfig::error(_("Throwing out job...")); - return false; + synfig::error(message.c_str());*/ + + synfig::error(_("Unknown target for \"%s\": %s"), job.filename, strerror(errno)); + synfig::error(_("Throwing out job...")); + return false; } job.sifout=false; @@ -222,7 +225,10 @@ bool setup_job(Job& job, const TargetParam& target_parameters) void process_job (Job& job) { VERBOSE_OUT(3) << job.filename.c_str() << " -- " << std::endl; - VERBOSE_OUT(3) << '\t' + synfig::info("\tw: %d, h: %d, a: %d, pxaspect: %f, imaspect: %f, span: %f", + job.desc.get_w(), job.desc.get_h(), job.desc.get_antialias(), + job.desc.get_pixel_aspect(), job.desc.get_image_aspect(), job.desc.get_span()); + /*VERBOSE_OUT(3) << '\t' << boost::format("w:%d, h:%d, a:%d, pxaspect:%f, imaspect:%f, span:%f") % job.desc.get_w() % job.desc.get_h() @@ -230,9 +236,15 @@ void process_job (Job& job) % job.desc.get_pixel_aspect() % job.desc.get_image_aspect() % job.desc.get_span() - << std::endl; + << std::endl;*/ + + synfig::info("\ttl: [%f,%f], br: [%f,%f], focus: [%f,%f]", + job.desc.get_tl()[0], job.desc.get_tl()[1], + job.desc.get_br()[0], job.desc.get_br()[1], + job.desc.get_focus()[0], job.desc.get_focus()[1] + ); - VERBOSE_OUT(3) << '\t' + /*VERBOSE_OUT(3) << '\t' << boost::format("tl:[%f,%f], br:[%f,%f], focus:[%f,%f]") % job.desc.get_tl()[0] % job.desc.get_tl()[1] @@ -240,7 +252,7 @@ void process_job (Job& job) % job.desc.get_br()[1] % job.desc.get_focus()[0] % job.desc.get_focus()[1] - << std::endl; + << std::endl;*/ RenderProgress p; p.task(job.filename + " ==> " + job.outfilename); diff --git a/synfig-core/src/tool/main.cpp b/synfig-core/src/tool/main.cpp index c1aaa93..45f64fc 100644 --- a/synfig-core/src/tool/main.cpp +++ b/synfig-core/src/tool/main.cpp @@ -40,7 +40,7 @@ #include #include #include -#include +//#include #include @@ -154,7 +154,7 @@ int main(int argc, char* argv[]) ("height,h", height_arg_desc, _("Set the image height in pixels (Use zero for file default)")) ("span,s", span_arg_desc, _("Set the diagonal size of image window (Span)")) ("antialias,a", antialias_arg_desc, _("Set antialias amount for parametric renderer.")) - ("quality,Q", quality_arg_desc->default_value(DEFAULT_QUALITY), (boost::format(_("Specify image quality for accelerated renderer (Default: %d)")) % DEFAULT_QUALITY).str().c_str()) + ("quality,Q", quality_arg_desc->default_value(DEFAULT_QUALITY), etl::strprintf(_("Specify image quality for accelerated renderer (Default: %d)"), DEFAULT_QUALITY).c_str()) ("gamma,g", gamma_arg_desc, _("Gamma")) ("threads,T", threads_arg_desc, _("Enable multithreaded renderer using the specified number of threads")) ("input-file,i", input_file_arg_desc, _("Specify input filename")) diff --git a/synfig-core/src/tool/optionsprocessor.cpp b/synfig-core/src/tool/optionsprocessor.cpp index 0eb8340..ccd1442 100644 --- a/synfig-core/src/tool/optionsprocessor.cpp +++ b/synfig-core/src/tool/optionsprocessor.cpp @@ -30,7 +30,7 @@ #endif #include -#include +//#include #include #include @@ -339,23 +339,28 @@ RendDesc OptionsProcessor::extract_renddesc(const RendDesc& renddesc) int a; a = _vm["antialias"].as(); desc.set_antialias(a); - VERBOSE_OUT(1) << boost::format(_("Antialiasing set to %d, " + synfig::info(_("Antialiasing set to %d, " + "(%d samples per pixel)"), a, (a*a)); + /*VERBOSE_OUT(1) << boost::format(_("Antialiasing set to %d, " "(%d samples per pixel)")) % a % (a*a) - << std::endl; + << std::endl;*/ } if (_vm.count("span")) { span = _vm["span"].as(); - VERBOSE_OUT(1) << boost::format(_("Span set to %d units")) % span - << std::endl; + synfig::info(_("Span set to %d units"), span); + /*VERBOSE_OUT(1) << boost::format(_("Span set to %d units")) % span + << std::endl;*/ } if (_vm.count("fps")) { float fps; fps = _vm["fps"].as(); desc.set_frame_rate(fps); - VERBOSE_OUT(1) << boost::format(_("Frame rate set to %d frames per " - "second")) % fps << std::endl; + synfig::info(_("Frame rate set to %d frames per " + "second"), fps); + /*VERBOSE_OUT(1) << boost::format(_("Frame rate set to %d frames per " + "second")) % fps << std::endl;*/ } if (_vm.count("dpi")) { @@ -364,8 +369,10 @@ RendDesc OptionsProcessor::extract_renddesc(const RendDesc& renddesc) dots_per_meter = dpi * 39.3700787402; desc.set_x_res(dots_per_meter); desc.set_y_res(dots_per_meter); - VERBOSE_OUT(1) << boost::format(_("Physical resolution set to %f " - "dpi")) % dpi << std::endl; + synfig::info(_("Physical resolution set to %f " + "dpi"), dpi); + /*VERBOSE_OUT(1) << boost::format(_("Physical resolution set to %f " + "dpi")) % dpi << std::endl;*/ } if (_vm.count("dpi-x")) { @@ -373,8 +380,10 @@ RendDesc OptionsProcessor::extract_renddesc(const RendDesc& renddesc) dpi = _vm["dpi-x"].as(); dots_per_meter = dpi * 39.3700787402; desc.set_x_res(dots_per_meter); - VERBOSE_OUT(1) << boost::format(_("Physical X resolution set to %f " - "dpi")) % dpi << std::endl; + synfig::info(_("Physical X resolution set to %f " + "dpi"), dpi); + /*VERBOSE_OUT(1) << boost::format(_("Physical X resolution set to %f " + "dpi")) % dpi << std::endl;*/ } if (_vm.count("dpi-y")) { @@ -382,8 +391,10 @@ RendDesc OptionsProcessor::extract_renddesc(const RendDesc& renddesc) dpi = _vm["dpi-y"].as(); dots_per_meter = dpi * 39.3700787402; desc.set_y_res(dots_per_meter); - VERBOSE_OUT(1) << boost::format(_("Physical Y resolution set to %f " - "dpi")) % dpi << std::endl; + synfig::info(_("Physical Y resolution set to %f " + "dpi"), dpi); + /*VERBOSE_OUT(1) << boost::format(_("Physical Y resolution set to %f " + "dpi")) % dpi << std::endl;*/ } if (_vm.count("start-time")) { @@ -426,8 +437,7 @@ RendDesc OptionsProcessor::extract_renddesc(const RendDesc& renddesc) h = desc.get_h() * w / desc.get_w(); desc.set_wh(w, h); - VERBOSE_OUT(1) << boost::format(_("Resolution set to %dx%d.")) % w % h - << std::endl; + VERBOSE_OUT(1) << etl::strprintf(_("Resolution set to %dx%d."), w, h) << std::endl; } if(span) @@ -469,12 +479,10 @@ TargetParam OptionsProcessor::extract_targetparam() if (!found) { throw SynfigToolException(SYNFIGTOOL_UNKNOWNARGUMENT, - (boost::format(_("Video codec \"%s\" is not supported.")) - % params.video_codec).str()); + etl::strprintf(_("Video codec \"%s\" is not supported."), params.video_codec)); } - VERBOSE_OUT(1) << _("Target video codec set to: ") << params.video_codec - << std::endl; + VERBOSE_OUT(1) << _("Target video codec set to: ") << params.video_codec << std::endl; } if(_vm.count("video-bitrate")) { @@ -529,7 +537,7 @@ Job OptionsProcessor::extract_job() if(!job.canvas) { throw SynfigToolException(SYNFIGTOOL_FILENOTFOUND, - (boost::format(_("Unable to load file '%s'.")) % job.filename).str()); + etl::strprintf(_("Unable to load file '%s'."), job.filename)); } job.root->set_time(0); @@ -581,16 +589,16 @@ Job OptionsProcessor::extract_job() catch(Exception::IDNotFound&) { throw SynfigToolException(SYNFIGTOOL_INVALIDJOB, - (boost::format(_("Unable to find canvas with ID \"%s\" in %s.\n" - "Throwing out job...")) - % canvasid % job.filename).str()); + etl::strprintf(_("Unable to find canvas with ID \"%s\" in %s.\n" + "Throwing out job..."), + canvasid, job.filename)); } catch(Exception::BadLinkName&) { throw SynfigToolException(SYNFIGTOOL_INVALIDJOB, - (boost::format(_("Invalid canvas name \"%s\" in %s.\n" - "Throwing out job...")) - % canvasid % job.filename).str()); + etl::strprintf(_("Invalid canvas name \"%s\" in %s.\n" + "Throwing out job..."), + canvasid, job.filename)); // FIXME: is here must be canvasid nor canvasname? } // Later we need to set the other parameters for the jobs diff --git a/synfig-core/src/tool/renderprogress.cpp b/synfig-core/src/tool/renderprogress.cpp index 5abef9a..0a3c8c7 100644 --- a/synfig-core/src/tool/renderprogress.cpp +++ b/synfig-core/src/tool/renderprogress.cpp @@ -21,7 +21,8 @@ #include #include #include "renderprogress.h" -#include +//#include +#include #include RenderProgress::RenderProgress() @@ -74,8 +75,8 @@ bool RenderProgress::amount_complete(int current_frame, int frames_count) } outputStream << "\r" - << boost::format(_("%1%: Frame %2% of %3% (%4%%%). Remaining time: ")) - % taskname_ % current_frame % frames_count % percentage_completed; + << etl::strprintf(_("%s: Frame %d of %d (%d%%). Remaining time: "), + taskname_, current_frame, frames_count, percentage_completed); if (current_frame != last_frame_) {