Update of /cvsroot/mahogany/M/src/util
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31530/src/util

Modified Files:
        ColourNames.cpp 
Log Message:
give more detailed message when a colour name can't be parsed (related to bug 745)

Index: ColourNames.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/util/ColourNames.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -b -u -2 -r1.2 -r1.3
--- ColourNames.cpp     21 Mar 2004 02:26:12 -0000      1.2
+++ ColourNames.cpp     19 Sep 2004 10:43:36 -0000      1.3
@@ -32,5 +32,5 @@
 {
    if ( name.empty() )
-      return FALSE;
+      return false;
 
    wxString customColourString(wxGetTranslation(rgbSpecificationString));
@@ -49,5 +49,5 @@
       wxColour col = wxTheColourDatabase->Find(name);
       if ( !col.Ok() )
-         return FALSE;
+         return false;
 
       if ( colour )
@@ -56,5 +56,5 @@
       wxColour *col = wxTheColourDatabase->FindColour(name);
       if ( !col )
-         return FALSE;
+         return false;
 
       if ( colour )
@@ -63,5 +63,5 @@
    }
 
-   return TRUE;
+   return true;
 }
 
@@ -87,5 +87,5 @@
 
 // get the colour by name and warn the user if it failed
-void GetColourByName(wxColour *colour,
+bool GetColourByName(wxColour *colour,
                      const String& name,
                      const String& def)
@@ -93,8 +93,9 @@
    if ( !ParseColourString(name, colour) )
    {
-      wxLogError(_("Cannot find a colour named '%s', using default instead.\n"
-                   "(please check the settings)"), name.c_str());
       *colour = def;
+      return false;
    }
+
+   return true;
 }
 
@@ -104,4 +105,11 @@
 
    const String value = GetOptionValue(profile, opt).GetTextValue();
-   GetColourByName(col, value, GetStringDefault(opt));
+
+   if ( !GetColourByName(col, value, GetStringDefault(opt)) )
+   {
+      wxLogError(_("Cannot find a colour named \"%s\", using default instead "
+                   "(please check the value of option \"%s\")"),
+                 value.c_str(),
+                 GetOptionName(opt));
+   }
 }



-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php
_______________________________________________
Mahogany-cvsupdates mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates

Reply via email to