mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-24 13:48:59 +00:00
399e6e788c
* src/frontends/xforms/Color.[Ch]: move to src * src/Color.[Ch] (getRGBColor): move to src/frontends/*/lyx_gui.C * src/BranchList.h (Branch::color_): change type to lyx::RGBColor * src/BranchList.[Ch] (Branch): new constrcutor, set color_ to LColor::background (getColor, setColor): adapt to type change of color_ * src/bufferparams.C (BufferParams::writeFile): adapt to type change of branch color * src/frontends/lyx_gui.h * src/frontends/gtk/lyx_gui.C * src/frontends/qt2/lyx_gui.C * src/frontends/qt4/lyx_gui.C * src/frontends/xforms/lyx_gui.C (getRGBColor): move from src/Color.[Ch] here * src/frontends/gtk/lyx_gui.C * src/frontends/xforms/lyx_gui.C (hexname): use getRGBColor * src/frontends/gtk/GDocument.C (update): adapt to type change of branch color (apply): add comment about color chooser * src/frontends/qt2/QDocumentDialog.C (updateBranchView): adapt to type change of branch color (toggleBranchColor): ditto * src/frontends/qt2/lcolorcache.[Ch] * src/frontends/qt4/lcolorcache.[Ch] (rgb2qcolor): new utility function * src/frontends/qt4/QBranches.C (QBranches::update): adapt to type change of branch color (QBranches::on_colorPB_clicked): ditto * src/frontends/xforms/FormDocument.C (get_current_color): adapt to type change of branch color (FormDocument::branch_update): * src/frontends/xforms/FormPreferences.C (FormPreferences::Colors::LoadBrowse): adapt to RGBColor changes * src/frontends/xforms/FormPreferences.h: remove unneeded RGBColor forward declaration * src/frontends/xforms/XWorkArea.C (XWorkArea::XWorkArea): adapt to RGBColor changes * src/frontends/xforms/Makefile.am: remove Color.[Ch] * src/frontends/xforms/FormColorpicker.[Ch]: adapt to RGBColor changes * src/frontends/xforms/xformsImage.C: adapt to RGBColor changes * src/frontends/controllers/ControlDocument.C (ControlDocument::dispatchParams): adapt to type change of branch color * src/Makefile.am: add Color.[Ch] git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13466 a592a061-630c-0410-9148-cb99ea01b6c8
75 lines
1.6 KiB
C++
75 lines
1.6 KiB
C++
// -*- C++ -*-
|
|
/**
|
|
* \file Color.h
|
|
* 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 <string>
|
|
|
|
namespace lyx {
|
|
|
|
struct RGBColor;
|
|
/// returns a string of form #rrggbb, given an RGBColor struct
|
|
std::string const X11hexname(RGBColor const & col);
|
|
|
|
struct HSVColor {
|
|
double h;
|
|
double s;
|
|
double v;
|
|
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 RGBColor {
|
|
unsigned int r;
|
|
unsigned int g;
|
|
unsigned int b;
|
|
RGBColor() : r(0), g(0), b(0) {}
|
|
RGBColor(unsigned int red, unsigned int green, unsigned int blue)
|
|
: r(red), g(green), b(blue) {}
|
|
RGBColor(HSVColor const &);
|
|
/// \param x11hexname is of the form "#ffa071"
|
|
RGBColor(std::string const & x11hexname);
|
|
};
|
|
|
|
struct NamedColor : public RGBColor {
|
|
std::string lyxname;
|
|
std::string guiname;
|
|
NamedColor() : RGBColor() {}
|
|
NamedColor(std::string const & lyx, std::string const & gui,
|
|
RGBColor const & c)
|
|
: RGBColor(c), lyxname(lyx), guiname(gui) {}
|
|
RGBColor const & color() const { return *this; }
|
|
};
|
|
|
|
inline
|
|
bool operator==(RGBColor const & c1, RGBColor const & c2)
|
|
{
|
|
return (c1.r == c2.r && c1.g == c2.g && c1.b == c2.b);
|
|
}
|
|
|
|
|
|
inline
|
|
bool operator!=(RGBColor const & c1, RGBColor const & c2)
|
|
{
|
|
return !(c1 == c2);
|
|
}
|
|
|
|
} // namespace lyx
|
|
|
|
#endif
|