Fix strange characters and pango warnings with LC_ALL=fr@euro. Patch & testing by...
[synfig.git] / synfig-core / trunk / src / tool / main.cpp
index 90d7cf8..fbff491 100644 (file)
@@ -1125,6 +1125,7 @@ int main(int argc, char *argv[])
 
 #ifdef ENABLE_NLS
        bindtextdomain("synfig", LOCALEDIR);
+       bind_textdomain_codeset("synfig", "UTF-8");
        textdomain("synfig");
 #endif
 
@@ -1174,12 +1175,19 @@ int main(int argc, char *argv[])
                          return ret;
 
                        // Open the composition
-                       String errors;
-                       job_list.front().root=open_canvas(job_list.front().filename, errors);
+                       String errors, warnings;
+                       try
+                       {
+                               job_list.front().root=open_canvas(job_list.front().filename, errors, warnings);
+                       }
+                       catch(runtime_error x)
+                       {
+                               job_list.front().root = 0;
+                       }
 
                        if(!job_list.front().root)
                        {
-                               cerr<<_("Unable to open ")<<job_list.front().filename<<"."<<endl;
+                               cerr<<_("Unable to load '")<<job_list.front().filename<<"'."<<endl;
                                cerr<<_("Throwing out job...")<<endl;
                                job_list.pop_front();
                                continue;
@@ -1199,7 +1207,8 @@ int main(int argc, char *argv[])
                        {
                                try
                                {
-                                       job_list.front().canvas=job_list.front().root->find_canvas(canvasid);
+                                       String warnings;
+                                       job_list.front().canvas=job_list.front().root->find_canvas(canvasid, warnings);
                                }
                                catch(Exception::IDNotFound)
                                {
@@ -1235,10 +1244,13 @@ int main(int argc, char *argv[])
                                extract_append(imageargs,composite_file);
                                if(!composite_file.empty())
                                {
-                                       String errors;
-                                       Canvas::Handle composite(open_canvas(composite_file, errors));
+                                       String errors, warnings;
+                                       Canvas::Handle composite(open_canvas(composite_file, errors, warnings));
                                        if(!composite)
+                                       {
+                                               cerr<<_("Unable to append '")<<composite_file<<"'."<<endl;
                                                break;
+                                       }
                                        Canvas::reverse_iterator iter;
                                        for(iter=composite->rbegin();iter!=composite->rend();++iter)
                                        {