Citation.h
CmdDef.h
Color.h
+ ColorSet.h
ColorCode.h
CompletionList.h
Converter.h
#include "buffer_funcs.h"
#include "Bullet.h"
#include "Color.h"
+#include "ColorSet.h"
#include "Encoding.h"
#include "Language.h"
#include "LaTeXFeatures.h"
#include <config.h>
#include "Color.h"
+#include "ColorSet.h"
#include "support/debug.h"
#include "support/gettext.h"
* Full author contact details are available in file CREDITS.
*/
-#ifndef LCOLOR_H
-#define LCOLOR_H
+#ifndef COLOR_H
+#define COLOR_H
#include "ColorCode.h"
#include "support/strfwd.h"
-#include <map>
-#include <string>
-
namespace lyx {
/**
std::ostream & operator<<(std::ostream & os, Color color);
-
-/**
- * \class ColorSet
- *
- * A class holding color definitions and associated names for
- * LaTeX, X11, the GUI, and LyX internally.
- *
- * A color can be one of the following kinds:
- *
- * - A real, predefined color, such as black, white, red or green.
- * - A logical color, such as no color, inherit, math
- */
-
-
-// made copyable for same reasons as LyXRC was made copyable. See there for
-// explanation.
-
-class ColorSet
-{
-public:
- ///
- ColorSet();
-
- /** set the given LyX color to the color defined by the X11 name given
- * \returns true if successful.
- */
- bool setColor(ColorCode col, std::string const & x11name);
-
- /** set the given LyX color to the color defined by the X11
- * name given \returns true if successful. A new color entry
- * is created if the color is unknown
- */
- bool setColor(std::string const & lyxname, std::string const & x11name);
-
- /// Get the GUI name of \c color.
- docstring const getGUIName(ColorCode c) const;
-
- /// Get the X11 name of \c color.
- std::string const getX11Name(ColorCode c) const;
-
- /// Get the LaTeX name of \c color.
- std::string const getLaTeXName(ColorCode c) const;
-
- /// Get the LyX name of \c color.
- std::string const getLyXName(ColorCode c) const;
-
- /// \returns the ColorCode associated with the LyX name.
- ColorCode getFromLyXName(std::string const & lyxname) const;
- /// \returns the ColorCode associated with the LaTeX name.
- ColorCode getFromLaTeXName(std::string const & latexname) const;
-
-private:
- ///
- void addColor(ColorCode c, std::string const & lyxname);
- ///
- class Information {
- public:
- /// the name as it appears in the GUI
- std::string guiname;
- /// the name used in LaTeX
- std::string latexname;
- /// the name for X11
- std::string x11name;
- /// the name for LyX
- std::string lyxname;
- };
-
- /// initialise a color entry
- struct ColorEntry;
- void fill(ColorEntry const & entry);
-
- ///
- typedef std::map<ColorCode, Information> InfoTab;
- /// the table of color Information
- InfoTab infotab;
-
- typedef std::map<std::string, ColorCode> Transform;
- /// the transform between LyX color name string and integer code.
- Transform lyxcolors;
- /// the transform between LaTeX color name string and integer code.
- Transform latexcolors;
-};
-
-
-/// the current color definitions
-extern ColorSet lcolor;
-/// the system color definitions
-extern ColorSet system_lcolor;
-
std::string const X11hexname(RGBColor const & col);
RGBColor rgbFromHexName(std::string const & x11hexname);
} // namespace lyx
-#endif
+#endif // COLOR_H
--- /dev/null
+// -*- C++ -*-
+/**
+ * \file ColorSet.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Asger Alstrup
+ * \author Lars Gullik Bjønnes
+ * \author Matthias Ettrich
+ * \author Jean-Marc Lasgouttes
+ * \author Angus Leeming
+ * \author John Levon
+ * \author André Pönitz
+ * \author Martin Vermeer
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#ifndef COLORSET_H
+#define COLORSET_H
+
+#include "Color.h"
+
+#include <map>
+#include <string>
+
+namespace lyx {
+
+/**
+ * \class ColorSet
+ *
+ * A class holding color definitions and associated names for
+ * LaTeX, X11, the GUI, and LyX internally.
+ *
+ * A color can be one of the following kinds:
+ *
+ * - A real, predefined color, such as black, white, red or green.
+ * - A logical color, such as no color, inherit, math
+ */
+
+
+// made copyable for same reasons as LyXRC was made copyable. See there for
+// explanation.
+
+class ColorSet
+{
+public:
+ ///
+ ColorSet();
+
+ /** set the given LyX color to the color defined by the X11 name given
+ * \returns true if successful.
+ */
+ bool setColor(ColorCode col, std::string const & x11name);
+
+ /** set the given LyX color to the color defined by the X11
+ * name given \returns true if successful. A new color entry
+ * is created if the color is unknown
+ */
+ bool setColor(std::string const & lyxname, std::string const & x11name);
+
+ /// Get the GUI name of \c color.
+ docstring const getGUIName(ColorCode c) const;
+
+ /// Get the X11 name of \c color.
+ std::string const getX11Name(ColorCode c) const;
+
+ /// Get the LaTeX name of \c color.
+ std::string const getLaTeXName(ColorCode c) const;
+
+ /// Get the LyX name of \c color.
+ std::string const getLyXName(ColorCode c) const;
+
+ /// \returns the ColorCode associated with the LyX name.
+ ColorCode getFromLyXName(std::string const & lyxname) const;
+ /// \returns the ColorCode associated with the LaTeX name.
+ ColorCode getFromLaTeXName(std::string const & latexname) const;
+
+private:
+ ///
+ void addColor(ColorCode c, std::string const & lyxname);
+ ///
+ class Information {
+ public:
+ /// the name as it appears in the GUI
+ std::string guiname;
+ /// the name used in LaTeX
+ std::string latexname;
+ /// the name for X11
+ std::string x11name;
+ /// the name for LyX
+ std::string lyxname;
+ };
+
+ /// initialise a color entry
+ struct ColorEntry;
+ void fill(ColorEntry const & entry);
+
+ ///
+ typedef std::map<ColorCode, Information> InfoTab;
+ /// the table of color Information
+ InfoTab infotab;
+
+ typedef std::map<std::string, ColorCode> Transform;
+ /// the transform between LyX color name string and integer code.
+ Transform lyxcolors;
+ /// the transform between LaTeX color name string and integer code.
+ Transform latexcolors;
+};
+
+
+/// the current color definitions
+extern ColorSet lcolor;
+/// the system color definitions
+extern ColorSet system_lcolor;
+
+} // namespace lyx
+
+#endif // COLORSET_H
#include "Font.h"
#include "BufferParams.h" // stateText
-#include "Color.h"
+#include "ColorSet.h"
#include "Encoding.h"
#include "Language.h"
#include "LaTeXFeatures.h"
FontState emph,
FontState underbar,
FontState noun,
- FontState number
- ): family_(family), series_(series), shape_(shape), size_(size),
+ FontState number)
+ : family_(family), series_(series), shape_(shape), size_(size),
color_(color), background_(background), paint_color_(), emph_(emph),
underbar_(underbar), noun_(noun), number_(number)
{}
private:
friend bool operator==(FontInfo const & lhs, FontInfo const & rhs);
- /// The color used for painting
- Color paint_color_;
-
///
FontFamily family_;
///
ColorCode color_;
///
ColorCode background_;
+ /// The color used for painting
+ Color paint_color_;
///
FontState emph_;
///
#include "LaTeXFeatures.h"
#include "Buffer.h"
-#include "Color.h"
#include "BufferParams.h"
+#include "ColorSet.h"
#include "Encoding.h"
#include "Floating.h"
#include "FloatList.h"
#include "Buffer.h"
#include "BufferList.h"
#include "CmdDef.h"
-#include "Color.h"
+#include "ColorSet.h"
#include "ConverterCache.h"
#include "Converter.h"
#include "CutAndPaste.h"
#include <config.h>
-#include <fstream>
-#include <iostream>
-
#include "LyXRC.h"
-#include "Color.h"
+#include "ColorSet.h"
#include "Converter.h"
#include "FontEnums.h"
#include "Format.h"
#include "support/os.h"
#include "support/userinfo.h"
+#include <fstream>
+#include <iostream>
+
using namespace std;
using namespace lyx::support;
CmdDef.h \
ColorCode.h \
Color.h \
+ ColorSet.h \
CompletionList.h \
ConverterCache.h \
Converter.h \
#include <config.h>
#include "BufferView.h"
-#include "Color.h"
+#include "ColorSet.h"
#include "MetricsInfo.h"
#include "insets/Inset.h"
#include "frontends/Painter.h"
#include "support/docstring.h"
-
#include "support/lassert.h"
using namespace std;
+
namespace lyx {
+/////////////////////////////////////////////////////////////////////////
+//
+// MetricsBase
+//
+/////////////////////////////////////////////////////////////////////////
MetricsBase::MetricsBase()
: bv(0), font(), style(LM_ST_TEXT), fontname("mathnormal"),
{}
+/////////////////////////////////////////////////////////////////////////
+//
+// MetricsInfo
+//
+/////////////////////////////////////////////////////////////////////////
+
MetricsInfo::MetricsInfo(BufferView * bv, FontInfo const & font, int textwidth,
MacroContext const & mc)
: base(bv, font, textwidth), macrocontext(mc)
{}
+/////////////////////////////////////////////////////////////////////////
+//
+// PainterInfo
+//
+/////////////////////////////////////////////////////////////////////////
+
PainterInfo::PainterInfo(BufferView * bv, lyx::frontend::Painter & painter)
: pain(painter), ltr_pos(false), change_(), selected(false),
full_repaint(true), background_color(Color_background)
}
+/////////////////////////////////////////////////////////////////////////
+//
+// ScriptChanger
+//
+/////////////////////////////////////////////////////////////////////////
+
Styles smallerScriptStyle(Styles st)
{
switch (st) {
}
}
+
ScriptChanger::ScriptChanger(MetricsBase & mb)
: StyleChanger(mb, smallerScriptStyle(mb.style))
{}
+/////////////////////////////////////////////////////////////////////////
+//
+// FracChanger
+//
+/////////////////////////////////////////////////////////////////////////
Styles smallerFracStyle(Styles st)
{
{}
+/////////////////////////////////////////////////////////////////////////
+//
+// ArrayChanger
+//
+/////////////////////////////////////////////////////////////////////////
ArrayChanger::ArrayChanger(MetricsBase & mb)
: StyleChanger(mb, mb.style == LM_ST_DISPLAY ? LM_ST_TEXT : mb.style)
{}
+/////////////////////////////////////////////////////////////////////////
+//
+// ShapeChanger
+//
+/////////////////////////////////////////////////////////////////////////
+
ShapeChanger::ShapeChanger(FontInfo & font, FontShape shape)
: Changer<FontInfo, FontShape>(font)
{
}
+/////////////////////////////////////////////////////////////////////////
+//
+// StyleChanger
+//
+/////////////////////////////////////////////////////////////////////////
StyleChanger::StyleChanger(MetricsBase & mb, Styles style)
- : Changer<MetricsBase>(mb)
+ : Changer<MetricsBase>(mb)
{
static const int diff[4][4] =
{ { 0, 0, -3, -5 },
}
+/////////////////////////////////////////////////////////////////////////
+//
+// FontSetChanger
+//
+/////////////////////////////////////////////////////////////////////////
FontSetChanger::FontSetChanger(MetricsBase & mb, char const * name)
- : Changer<MetricsBase>(mb)
+ : Changer<MetricsBase>(mb)
{
save_ = mb;
FontSize oldsize = save_.font.size();
FontSetChanger::FontSetChanger(MetricsBase & mb, docstring const & name)
- : Changer<MetricsBase>(mb)
+ : Changer<MetricsBase>(mb)
{
save_ = mb;
FontSize oldsize = save_.font.size();
}
+/////////////////////////////////////////////////////////////////////////
+//
+// WidthChanger
+//
+/////////////////////////////////////////////////////////////////////////
+
WidthChanger::WidthChanger(MetricsBase & mb, int w)
- : Changer<MetricsBase>(mb)
+ : Changer<MetricsBase>(mb)
{
save_ = mb;
mb.textwidth = w;
}
-
+/////////////////////////////////////////////////////////////////////////
+//
+// ColorChanger
+//
+/////////////////////////////////////////////////////////////////////////
ColorChanger::ColorChanger(FontInfo & font, string const & color)
: Changer<FontInfo, string>(font)
#include <config.h>
#include "ColorCache.h"
-
-#include "Color.h"
-
-#include <string>
-
+#include "ColorSet.h"
namespace lyx {
QColor base_color = get(color.baseColor).toRgb();
QColor merge_color = get(color.mergeColor).toRgb();
return QColor(
- (base_color.red() + merge_color.red())/2,
- (base_color.green() + merge_color.green())/2,
- (base_color.blue() + merge_color.blue())/2);
+ (base_color.red() + merge_color.red()) / 2,
+ (base_color.green() + merge_color.green()) / 2,
+ (base_color.blue() + merge_color.blue()) / 2);
}
// used by branches
return QColor(lcolor.getX11Name(color.baseColor).c_str());
#include "GuiApplication.h"
#include "ColorCache.h"
+#include "ColorSet.h"
#include "GuiClipboard.h"
#include "GuiImage.h"
#include "GuiKeySymbol.h"
#include "BufferList.h"
#include "Color.h"
+#include "ColorSet.h"
#include "ConverterCache.h"
#include "FontEnums.h"
#include "FuncRequest.h"
#include "BufferParams.h"
#include "BufferView.h"
#include "BranchList.h"
-#include "Color.h"
+#include "ColorSet.h"
#include "Counters.h"
#include "Cursor.h"
#include "DispatchResult.h"
#include "InsetLayout.h"
-#include "Color.h"
+#include "ColorSet.h"
#include "Font.h"
#include "Lexer.h"
#include "TextClass.h"
return InsetLayout::ILT_ERROR;
}
-}
+} // namespace anon
bool InsetLayout::read(Lexer & lex, TextClass const & tclass)
#include <config.h>
-#include "Color.h"
+#include "ColorSet.h"
#include "InsetMathColor.h"
#include "LaTeXFeatures.h"