]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/xforms/Color.h
Yet more dialog tweaking from Rob.
[lyx.git] / src / frontends / xforms / Color.h
index 50ca142571c72a73f26cc0a88f220fe360b935eb..98965b454a4f0ca29a13a7601b0706d6edb3e0db 100644 (file)
@@ -1,66 +1,68 @@
 // -*- C++ -*-
-/* This file is part of
- * ======================================================
- * 
- *           LyX, The Document Processor
- *      
- *         Copyright 1995 Matthias Ettrich
- *          Copyright 1995-2000 The LyX Team.
+/**
+ * \file Color.h
+ * Copyright 1995 Matthias Ettrich
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
  *
- *======================================================*/
+ * \author Angus Leeming 
+ *
+ * Full author contact details are available in file CREDITS
+ */
+
+/* structs RGBColor and HSVColor to enable simple conversion between
+ * color spaces.
+ */
 
 #ifndef COLOR_H
 #define COLOR_H
 
-#include<utility> // for pair
-
-#ifdef __GNUG_
+#ifdef __GNUG__
 #pragma interface
 #endif
 
 #include "LString.h"
 
-class HSV;
-class RGB;
+struct RGBColor;
 
-struct HSV {
+struct HSVColor {
        double h;
        double s;
        double v;
-       HSV() : h(0.0), s(0.0), v(0.0) {}
-       HSV(double hue, double sat, double val) : h(hue), s(sat), v(val) {}
-       HSV( RGB const & );
+       HSVColor() : h(0.0), s(0.0), v(0.0) {}
+       HSVColor(double hue, double sat, double val)
+               : h(hue), s(sat), v(val) {}
+       HSVColor(RGBColor const &);
 };
 
-struct RGB {
+struct RGBColor {
        int r;
        int g;
        int b;
-       RGB() : r(0), g(0), b(0) {}
-       RGB(int red, int green, int blue) : r(red), g(green), b(blue) {}
-       RGB( HSV const & );
+       RGBColor() : r(0), g(0), b(0) {}
+       RGBColor(int red, int green, int blue)
+               : r(red), g(green), b(blue) {}
+       RGBColor(HSVColor const &);
 };
 
-typedef std::pair<string, RGB> X11Color;
-
-/// struct holding xform-specific colors
-struct XFormColor {
+struct NamedColor : public RGBColor {
        string name;
-       int colorID;
-       RGB col;
-       XFormColor() : colorID(0) {}
-       string const getname() { return name; }
+       NamedColor() : RGBColor() {}
+       NamedColor(string const & n, RGBColor const & c)
+               : RGBColor(c), name(n) {}
+       RGBColor const & color() const { return *this; }
+       string const & getname() const { return name; }
 };
 
 inline
-bool operator==(RGB const & c1, RGB const & c2)
+bool operator==(RGBColor const & c1, RGBColor const & c2)
 {
        return (c1.r == c2.r && c1.g == c2.g && c1.b == c2.b);
 }
 
 
 inline
-bool operator!=(RGB const & c1, RGB const & c2)
+bool operator!=(RGBColor const & c1, RGBColor const & c2)
 {
        return !(c1 == c2);
 }