Author: Diego Barrios Romero <[email protected]>
Date: Mon Feb 13 17:50:52 2012 +0100
Splitting job class methods
---
synfig-core/src/tool/job.cpp | 84 ++++++++++++++++++++++++++++++++++++++++++
synfig-core/src/tool/job.h | 72 ++++++++++-------------------------
2 files changed, 105 insertions(+), 51 deletions(-)
diff --git a/synfig-core/src/tool/job.cpp b/synfig-core/src/tool/job.cpp
new file mode 100644
index 0000000..211f92e
--- /dev/null
+++ b/synfig-core/src/tool/job.cpp
@@ -0,0 +1,84 @@
+/* === S Y N F I G ========================================================= */
+/*! \file tool/job.cpp
+** \brief Job class methods
+**
+** $Id$
+**
+** \legal
+** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
+** Copyright (c) 2007, 2008 Chris Moore
+** Copyright (c) 2009-2012 Diego Barrios Romero
+**
+** This package 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 package 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.
+** \endlegal
+*/
+/* ========================================================================= */
+
+#ifdef USING_PCH
+# include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <iostream>
+#include <string>
+#include <synfig/loadcanvas.h>
+#include <synfig/canvas.h>
+#include <synfig/target.h>
+#include "definitions.h"
+#include "job.h"
+#endif
+
+using namespace std;
+using namespace synfig;
+
+Job::Job()
+{
+ canvas_info = canvas_info_all = canvas_info_time_start =
+ canvas_info_time_end = canvas_info_frame_rate =
+ canvas_info_frame_start = canvas_info_frame_end =
+ canvas_info_w = canvas_info_h = canvas_info_image_aspect =
+ canvas_info_pw = canvas_info_ph = canvas_info_pixel_aspect =
+ canvas_info_tl = canvas_info_br = canvas_info_physical_w =
+ canvas_info_physical_h = canvas_info_x_res = canvas_info_y_res =
+ canvas_info_span = canvas_info_interlaced =
+ canvas_info_antialias = canvas_info_clamp = canvas_info_flags =
+ canvas_info_focus = canvas_info_bg_color = canvas_info_metadata
+ = false;
+}
+
+int Job::load_file (string _filename)
+{
+ filename = _filename;
+ // Open the composition
+ string errors, warnings;
+ try
+ {
+ root=open_canvas(filename, errors, warnings);
+ }
+ catch(runtime_error x)
+ {
+ root = 0;
+ }
+
+ canvas = root;
+
+ if(!canvas)
+ {
+ cerr << _("Unable to load '") << filename << "'."
+ << endl;
+
+ return SYNFIGTOOL_FILENOTFOUND;
+ }
+
+ return SYNFIGTOOL_OK;
+}
diff --git a/synfig-core/src/tool/job.h b/synfig-core/src/tool/job.h
index 071023f..cb2ae49 100644
--- a/synfig-core/src/tool/job.h
+++ b/synfig-core/src/tool/job.h
@@ -25,66 +25,36 @@
#ifndef __SYNFIG_JOB_H
#define __SYNFIG_JOB_H
-using namespace synfig;
-
-#include <synfig/string.h>
-#include <synfig/canvas.h>
-#include <synfig/target.h>
-#include "definitions.h"
-
struct Job
{
- String filename;
- String outfilename;
+ std::string filename;
+ std::string outfilename;
- RendDesc desc;
+ synfig::RendDesc desc;
- Canvas::Handle root;
- Canvas::Handle canvas;
- Target::Handle target;
+ synfig::Canvas::Handle root;
+ synfig::Canvas::Handle canvas;
+ synfig::Target::Handle target;
int quality;
bool sifout;
bool list_canvases;
- bool canvas_info, canvas_info_all, canvas_info_time_start,
canvas_info_time_end, canvas_info_frame_rate,
- canvas_info_frame_start, canvas_info_frame_end, canvas_info_w,
canvas_info_h, canvas_info_image_aspect,
- canvas_info_pw, canvas_info_ph, canvas_info_pixel_aspect,
canvas_info_tl, canvas_info_br,
- canvas_info_physical_w, canvas_info_physical_h,
canvas_info_x_res, canvas_info_y_res, canvas_info_span,
- canvas_info_interlaced, canvas_info_antialias,
canvas_info_clamp, canvas_info_flags, canvas_info_focus,
- canvas_info_bg_color, canvas_info_metadata;
-
- Job()
- {
- canvas_info = canvas_info_all = canvas_info_time_start =
canvas_info_time_end = canvas_info_frame_rate = canvas_info_frame_start =
canvas_info_frame_end = canvas_info_w = canvas_info_h =
canvas_info_image_aspect = canvas_info_pw = canvas_info_ph =
canvas_info_pixel_aspect = canvas_info_tl = canvas_info_br =
canvas_info_physical_w = canvas_info_physical_h = canvas_info_x_res =
canvas_info_y_res = canvas_info_span = canvas_info_interlaced =
canvas_info_antialias = canvas_info_clamp = canvas_info_flags =
canvas_info_focus = canvas_info_bg_color = canvas_info_metadata = false;
- };
-
- int load_file (string _filename)
- {
- filename = _filename;
- // Open the composition
- String errors, warnings;
- try
- {
- root=open_canvas(filename, errors, warnings);
- }
- catch(runtime_error x)
- {
- root = 0;
- }
-
- canvas = root;
-
- if(!canvas)
- {
- cerr << _("Unable to load '") << filename << "'."
- << endl;
-
- return SYNFIGTOOL_FILENOTFOUND;
- }
-
- return SYNFIGTOOL_OK;
- }
+ bool canvas_info, canvas_info_all, canvas_info_time_start,
+ canvas_info_time_end, canvas_info_frame_rate,
+ canvas_info_frame_start, canvas_info_frame_end,
+ canvas_info_w, canvas_info_h, canvas_info_image_aspect,
+ canvas_info_pw, canvas_info_ph, canvas_info_pixel_aspect,
+ canvas_info_tl, canvas_info_br, canvas_info_physical_w,
+ canvas_info_physical_h, canvas_info_x_res, canvas_info_y_res,
+ canvas_info_span, canvas_info_interlaced,
+ canvas_info_antialias, canvas_info_clamp, canvas_info_flags,
+ canvas_info_focus, canvas_info_bg_color,
+ canvas_info_metadata;
+
+ Job();
+
+ int load_file (std::string filename);
};
#endif
------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
Synfig-devl mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/synfig-devl