Solve the gamma problem (corrected locale when loading/saving settings file)
[synfig.git] / synfig-core / trunk / src / synfig / distance.cpp
index c1a7e65..0878d27 100644 (file)
@@ -1,20 +1,21 @@
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
 /*!    \file distance.cpp
 **     \brief Template File
 **
 **     $Id: distance.cpp,v 1.1.1.1 2005/01/04 01:23:14 darco Exp $
 **
 **     \legal
-**     Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**     Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
 **
-**     This software and associated documentation
-**     are CONFIDENTIAL and PROPRIETARY property of
-**     the above-mentioned copyright holder.
+**     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.
 **
-**     You may not copy, print, publish, or in any
-**     other way distribute this software without
-**     a prior written agreement with
-**     the copyright holder.
+**     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
 */
 /* ========================================================================= */
@@ -38,7 +39,7 @@
 
 using namespace std;
 using namespace etl;
-using namespace sinfg;
+using namespace synfig;
 
 /* === M A C R O S ========================================================= */
 
@@ -52,53 +53,53 @@ using namespace sinfg;
 
 /* === M E T H O D S ======================================================= */
 
-Distance::Distance(const sinfg::String& str)
+Distance::Distance(const synfig::String& str)
 {
        (*this)=str;
 /*     int i(0);
        float val;
        int ret(strscanf(str,"%f%n",&val,&i));
-       sinfg::info("Distance::Distance(): ret=%d, val=%f",ret,val);
+       synfig::info("Distance::Distance(): ret=%d, val=%f",ret,val);
        
        if(ret<=0)
        {
                // Error
-               sinfg::error("Distance::Distance(): Bad value \"%s\"",str.c_str());
+               synfig::error("Distance::Distance(): Bad value \"%s\"",str.c_str());
                value_=0;
        }
        else
                value_=val;
        
-       sinfg::info("Distance::Distance(): system=\"%s\"",String(str.begin()+i,str.end()).c_str());
+       synfig::info("Distance::Distance(): system=\"%s\"",String(str.begin()+i,str.end()).c_str());
        system_=ident_system(String(str.begin()+i,str.end()));
 */
 }
 
 Distance&
-Distance::operator=(const sinfg::String& str)
+Distance::operator=(const synfig::String& str)
 {
        int i(0);
        float val;
        int ret(strscanf(str,"%f%n",&val,&i));
-       sinfg::info("Distance::Distance(): ret=%d, val=%f",ret,val);
+       synfig::info("Distance::Distance(): ret=%d, val=%f",ret,val);
        
        if(ret<=0)
        {
                // Error
-               sinfg::error("Distance::Distance(): Bad value \"%s\"",str.c_str());
+               synfig::error("Distance::Distance(): Bad value \"%s\"",str.c_str());
                return *this;
        }
        else
                value_=val;
 
-       sinfg::String sys(str.begin()+i,str.end());
+       synfig::String sys(str.begin()+i,str.end());
 
        if(sys.size())
                system_=ident_system(sys);
        return *this;
 }
 
-sinfg::String
+synfig::String
 Distance::get_string(int digits)const
 {
        digits=min(9,max(0,digits));
@@ -183,16 +184,16 @@ Distance::meters_to_system(Real x,System target_system)
 }
 
 Distance::System // (static)
-Distance::ident_system(const sinfg::String& x)
+Distance::ident_system(const synfig::String& x)
 {
-       sinfg::String str;
+       synfig::String str;
 
        // Make it all upper case, and remove white space
        for(unsigned int i=0;i<x.size();i++)if(x[i]!=' ' && x[i]!='\t')str+=toupper(x[i]);
 
        // If it is plural, make it singular
        if(str[str.size()-1]=='S')
-               str=sinfg::String(str.begin(),str.end()-1);
+               str=synfig::String(str.begin(),str.end()-1);
        
        if(str.empty() || str=="U" || str=="UNIT")
                return SYSTEM_UNITS;
@@ -209,12 +210,12 @@ Distance::ident_system(const sinfg::String& x)
        if(str=="MM" || str=="MILLIMETER")
                return SYSTEM_MILLIMETERS;
        
-       sinfg::warning("Distance::ident_system(): Unknown distance system \"%s\"",x.c_str());
+       synfig::warning("Distance::ident_system(): Unknown distance system \"%s\"",x.c_str());
        
        return SYSTEM_UNITS;
 }
 
-sinfg::String  // (static)
+synfig::String  // (static)
 Distance::system_name(Distance::System system)
 {
        switch(system)
@@ -229,10 +230,10 @@ Distance::system_name(Distance::System system)
        
                default:                                throw BadSystem();
        }
-       return sinfg::String();
+       return synfig::String();
 }
 
-sinfg::String  // (static)
+synfig::String  // (static)
 Distance::system_local_name(Distance::System system)
 {
        switch(system)
@@ -247,5 +248,5 @@ Distance::system_local_name(Distance::System system)
        
                default:                                throw BadSystem();
        }
-       return sinfg::String();
+       return synfig::String();
 }