]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/xforms/ColorHandler.C
Change glob() API to accept a dir parameter.
[lyx.git] / src / frontends / xforms / ColorHandler.C
index 343922c5857f48842555b2777f92b812481f566d..e4309fe78cfc488c685d859807984f6ab73ecc18 100644 (file)
 
 #include <config.h>
 
-
 #include "ColorHandler.h"
-#include "LColor.h"
-#include "gettext.h"
+
 #include "debug.h"
+#include "gettext.h"
+#include "LColor.h"
 
-#include <boost/scoped_array.hpp>
-#include "support/tostr.h"
 #include "support/lstrings.h"
+#include "support/tostr.h"
 
-#include <cmath>
+#include "lyx_forms.h"
 
-using namespace lyx::support;
+#include <boost/scoped_array.hpp>
+
+#include <cmath>
 
 #ifndef CXX_GLOBAL_CSTD
 using std::pow;
 #endif
 
 using std::endl;
+using std::string;
 
-#include "lyx_forms.h"
+namespace lyx {
 
+namespace support {
 namespace {
 
        string tostr(XColor const & col)
        {
                return bformat("(%1$s,%2$s,%3$s)",
-                       ::tostr(col.red), ::tostr(col.green), ::tostr(col.blue));
+                              ::tostr(col.red),
+                              ::tostr(col.green),
+                              ::tostr(col.blue));
        }
 
-}
+} // namespace
+} // namespace support
+
+using support::bformat;
+using support::tostr;
+
 
+namespace frontend {
 
 LyXColorHandler::LyXColorHandler()
                : colorGCcache(LColor::ignore + 1)
@@ -53,7 +64,7 @@ LyXColorHandler::LyXColorHandler()
 
        colormap = fl_state[fl_get_vclass()].colormap;
        // Clear the GC cache
-       for (int i = 0; i < colorGCcache.size(); ++i) {
+       for (string::size_type i = 0; i < colorGCcache.size(); ++i) {
                colorGCcache[i] = 0;
        }
 }
@@ -75,7 +86,7 @@ LyXColorHandler::~LyXColorHandler()
 }
 
 
-unsigned long LyXColorHandler::colorPixel(LColor::color c)
+unsigned long LyXColorHandler::colorPixel(LColor_color c)
 {
        XGCValues val;
        XGetGCValues(display, getGCForeground(c), GCForeground, &val);
@@ -150,7 +161,7 @@ GC LyXColorHandler::getGCForeground(string const & s)
                lyxerr << bformat(
                                _("     Using closest allocated color with (r,g,b)=%1$s instead.\n"
                          "Pixel [%2$s] is used."),
-                       tostr(cmap[closest_pixel]), tostr(closest_pixel)) << endl;
+                       tostr(cmap[closest_pixel]), ::tostr(closest_pixel)) << endl;
 
                val.foreground = cmap[closest_pixel].pixel;
        }
@@ -158,10 +169,10 @@ GC LyXColorHandler::getGCForeground(string const & s)
        return XCreateGC(display, drawable,
                                           GCForeground | GCFunction, &val);
 }
-               
+
 // Gets GC according to color
 // Uses caching
-GC LyXColorHandler::getGCForeground(LColor::color c)
+GC LyXColorHandler::getGCForeground(LColor_color c)
 {
        if (static_cast<unsigned>(c) >= colorGCcache.size()) {
                colorGCcache.resize(c + 1, 0);
@@ -186,7 +197,7 @@ GC LyXColorHandler::getGCForeground(LColor::color c)
 
 // Gets GC for line
 GC LyXColorHandler::getGCLinepars(Painter::line_style ls,
-                                 Painter::line_width lw, LColor::color c)
+                                 Painter::line_width lw, LColor_color c)
 {
        //if (lyxerr.debugging()) {
        //      lyxerr << "Painter drawable: " << drawable() << endl;
@@ -232,7 +243,7 @@ GC LyXColorHandler::getGCLinepars(Painter::line_style ls,
 
 
 // update GC cache after color redefinition
-void LyXColorHandler::updateColor (LColor::color c)
+void LyXColorHandler::updateColor (LColor_color c)
 {
        // color GC cache
        GC gc = colorGCcache[c];
@@ -261,3 +272,6 @@ void LyXColorHandler::updateColor (LColor::color c)
 
 //
 boost::scoped_ptr<LyXColorHandler> lyxColorHandler;
+
+} // namespace frontend
+} // namespace lyx