Reverse unwanted commits.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@28388 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Vincent van Ravesteijn 2009-02-08 01:11:27 +00:00
parent f694cf7135
commit 814a8411eb
15 changed files with 47 additions and 143 deletions

View File

@ -54,9 +54,9 @@ bool Change::isSimilarTo(Change const & change) const
}
Color Change::color() const
ColorCode Change::color() const
{
Color color = Color_none;
ColorCode color = Color_none;
switch (author % 5) {
case 0:
color = Color_changedtextauthor1;
@ -74,10 +74,6 @@ Color Change::color() const
color = Color_changedtextauthor5;
break;
}
if (deleted())
color.mergeColor = Color_white;
return color;
}

View File

@ -15,7 +15,7 @@
#ifndef CHANGES_H
#define CHANGES_H
#include "Color.h"
#include "ColorCode.h"
#include "support/strfwd.h"
#include "support/types.h"
@ -45,7 +45,7 @@ public:
/// is the change similar to the given change such that both can be merged?
bool isSimilarTo(Change const & change) const;
/// The color of this change on screen
Color color() const;
ColorCode color() const;
///
bool changed() const { return type != UNCHANGED; }
///

View File

@ -84,45 +84,6 @@ RGBColor rgbFromHexName(string const & x11hexname)
}
Color::Color(ColorCode base_color) : baseColor(base_color),
mergeColor(Color_ignore)
{}
bool Color::operator==(Color const & color) const
{
return baseColor == color.baseColor;
}
bool Color::operator!=(Color const & color) const
{
return baseColor != color.baseColor;
}
bool Color::operator<(Color const & color) const
{
return baseColor < color.baseColor;
}
bool Color::operator<=(Color const & color) const
{
return baseColor <= color.baseColor;
}
std::ostream & operator<<(std::ostream & os, Color color)
{
os << to_ascii(lcolor.getGUIName(color.baseColor));
if (color.mergeColor != Color_ignore)
os << "[merged with:"
<< to_ascii(lcolor.getGUIName(color.mergeColor)) << "]";
return os;
}
ColorSet::ColorSet()
{
char const * grey40 = "#666666";

View File

@ -28,41 +28,6 @@
namespace lyx {
/**
* \class Color
*
* A class holding a definition of a certain color.
*
* A color can be one of the following kinds:
*
* - a single color, then mergeColor = Color_ignore
* - a merged color, i.e. the average of the base and merge colors.
*/
class Color
{
public:
///
Color(ColorCode base_color = Color_none);
/// comparison operators.
//@{
bool operator==(Color const & color) const;
bool operator!=(Color const & color) const;
bool operator<(Color const & color) const;
bool operator<=(Color const & color) const;
//@}
/// the base color
ColorCode baseColor;
/// The color that is merged with the base color. Set
/// mergeColor to Color_ignore if no merging is wanted.
ColorCode mergeColor;
};
std::ostream & operator<<(std::ostream & os, Color color);
/**
* \class ColorSet
*

View File

@ -278,10 +278,8 @@ bool FontInfo::resolved() const
}
Color FontInfo::realColor() const
ColorCode FontInfo::realColor() const
{
if (draw_color_ != Color_none)
return draw_color_;
if (color_ == Color_none)
return Color_foreground;
return color_;

View File

@ -19,7 +19,6 @@
#include "tex2lyx/Font.h"
#else
#include "Color.h"
#include "ColorCode.h"
#include "FontEnums.h"
@ -75,8 +74,6 @@ public:
void setColor(ColorCode c) { color_ = c; }
ColorCode background() const { return background_; }
void setBackground(ColorCode b) { background_ = b; }
Color drawColor() const { return draw_color_; }
void setDrawColor(Color c) { draw_color_ = c; }
///@}
///
@ -92,7 +89,7 @@ public:
bool resolved() const;
///
Color realColor() const;
ColorCode realColor() const;
/// Converts logical attributes to concrete shape attribute
/// Try hard to inline this as it shows up with 4.6 % in the profiler.
@ -138,8 +135,6 @@ private:
///
ColorCode background_;
///
Color draw_color_;
///
FontState emph_;
///
FontState underbar_;

View File

@ -13,7 +13,7 @@
#ifndef PAINTER_H
#define PAINTER_H
#include "Color.h"
#include "ColorCode.h"
#include "support/strfwd.h"
@ -78,7 +78,7 @@ public:
virtual ~Painter() {}
/// draw a line from point to point
virtual void line(int x1, int y1, int x2, int y2, Color,
virtual void line(int x1, int y1, int x2, int y2, ColorCode,
line_style = line_solid, line_width = line_thin) = 0;
/**
@ -87,22 +87,22 @@ public:
* @param yp array of points' y co-ords
* @param np size of the points array
*/
virtual void lines(int const * xp, int const * yp, int np, Color,
virtual void lines(int const * xp, int const * yp, int np, ColorCode,
line_style = line_solid, line_width = line_thin) = 0;
/// draw a rectangle
virtual void rectangle(int x, int y, int w, int h, Color,
virtual void rectangle(int x, int y, int w, int h, ColorCode,
line_style = line_solid, line_width = line_thin) = 0;
/// draw a filled rectangle
virtual void fillRectangle(int x, int y, int w, int h, Color) = 0;
virtual void fillRectangle(int x, int y, int w, int h, ColorCode) = 0;
/// draw an arc
virtual void arc(int x, int y, unsigned int w, unsigned int h,
int a1, int a2, Color) = 0;
int a1, int a2, ColorCode) = 0;
/// draw a pixel
virtual void point(int x, int y, Color) = 0;
virtual void point(int x, int y, ColorCode) = 0;
/// draw a filled rectangle with the shape of a 3D button
virtual void button(int x, int y, int w, int h, bool mouseHover) = 0;
@ -136,7 +136,7 @@ public:
* around the text with the given color.
*/
virtual void rectText(int x, int baseline, docstring const & str,
FontInfo const & font, Color back, Color frame) = 0;
FontInfo const & font, ColorCode back, ColorCode frame) = 0;
/// draw a string and enclose it inside a button frame
virtual void buttonText(int x, int baseline, docstring const & s,
@ -147,8 +147,8 @@ public:
char_type c, FontInfo const & f, preedit_style style) = 0;
/// start monochrome painting mode, i.e. map every color into [min,max]
virtual void enterMonochromeMode(Color const & min,
Color const & max) = 0;
virtual void enterMonochromeMode(ColorCode const & min,
ColorCode const & max) = 0;
/// leave monochrome painting mode
virtual void leaveMonochromeMode() = 0;

View File

@ -28,22 +28,14 @@ void ColorCache::init()
/// get the given color
QColor ColorCache::get(Color color) const
QColor ColorCache::get(ColorCode color) const
{
if (!initialized_)
const_cast<ColorCache *>(this)->init();
if (color <= Color_ignore && color.mergeColor == Color_ignore)
return lcolors_[color.baseColor];
if (color.mergeColor != Color_ignore) {
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);
}
if (color <= Color_ignore)
return lcolors_[color];
// used by branches
return QColor(lcolor.getX11Name(color.baseColor).c_str());
return QColor(lcolor.getX11Name(color).c_str());
}

View File

@ -12,7 +12,7 @@
#ifndef COLORCACHE_H
#define COLORCACHE_H
#include "Color.h"
#include "ColorCode.h"
#include <QColor>
@ -29,7 +29,7 @@ public:
ColorCache() : initialized_(false) {}
/// get the given color
QColor get(Color color) const;
QColor get(ColorCode color) const;
/// clear all colors
void clear() { initialized_ = false; }

View File

@ -112,7 +112,7 @@ QString GuiPainter::generateStringSignature(QString const & str, FontInfo const
}
QColor GuiPainter::computeColor(Color col)
QColor GuiPainter::computeColor(ColorCode col)
{
return filterColor(guiApp->colorCache().get(col));
}
@ -144,7 +144,7 @@ QColor GuiPainter::filterColor(QColor const & col)
}
void GuiPainter::enterMonochromeMode(Color const & min, Color const & max)
void GuiPainter::enterMonochromeMode(ColorCode const & min, ColorCode const & max)
{
QColor qmin = filterColor(guiApp->colorCache().get(min));
QColor qmax = filterColor(guiApp->colorCache().get(max));
@ -161,7 +161,7 @@ void GuiPainter::leaveMonochromeMode()
}
void GuiPainter::point(int x, int y, Color col)
void GuiPainter::point(int x, int y, ColorCode col)
{
if (!isDrawingEnabled())
return;
@ -172,7 +172,7 @@ void GuiPainter::point(int x, int y, Color col)
void GuiPainter::line(int x1, int y1, int x2, int y2,
Color col,
ColorCode col,
line_style ls,
line_width lw)
{
@ -189,7 +189,7 @@ void GuiPainter::line(int x1, int y1, int x2, int y2,
void GuiPainter::lines(int const * xp, int const * yp, int np,
Color col,
ColorCode col,
line_style ls,
line_width lw)
{
@ -217,7 +217,7 @@ void GuiPainter::lines(int const * xp, int const * yp, int np,
void GuiPainter::rectangle(int x, int y, int w, int h,
Color col,
ColorCode col,
line_style ls,
line_width lw)
{
@ -229,7 +229,7 @@ void GuiPainter::rectangle(int x, int y, int w, int h,
}
void GuiPainter::fillRectangle(int x, int y, int w, int h, Color col)
void GuiPainter::fillRectangle(int x, int y, int w, int h, ColorCode col)
{
if (!isDrawingEnabled())
return;
@ -239,7 +239,7 @@ void GuiPainter::fillRectangle(int x, int y, int w, int h, Color col)
void GuiPainter::arc(int x, int y, unsigned int w, unsigned int h,
int a1, int a2, Color col)
int a1, int a2, ColorCode col)
{
if (!isDrawingEnabled())
return;
@ -450,7 +450,7 @@ void GuiPainter::buttonFrame(int x, int y, int w, int h)
void GuiPainter::rectText(int x, int y, docstring const & str,
FontInfo const & font, Color back, Color frame)
FontInfo const & font, ColorCode back, ColorCode frame)
{
int width;
int ascent;

View File

@ -13,8 +13,6 @@
#ifndef GUIPAINTER_H
#define GUIPAINTER_H
#include "Color.h"
#include "frontends/Painter.h"
#include <QPainter>
@ -40,7 +38,7 @@ public:
virtual void line(
int x1, int y1,
int x2, int y2,
Color,
ColorCode,
line_style = line_solid,
line_width = line_thin);
@ -54,7 +52,7 @@ public:
int const * xp,
int const * yp,
int np,
Color,
ColorCode,
line_style = line_solid,
line_width = line_thin);
@ -62,7 +60,7 @@ public:
virtual void rectangle(
int x, int y,
int w, int h,
Color,
ColorCode,
line_style = line_solid,
line_width = line_thin);
@ -70,17 +68,17 @@ public:
virtual void fillRectangle(
int x, int y,
int w, int h,
Color);
ColorCode);
/// draw an arc
virtual void arc(
int x, int y,
unsigned int w, unsigned int h,
int a1, int a2,
Color);
ColorCode);
/// draw a pixel
virtual void point(int x, int y, Color);
virtual void point(int x, int y, ColorCode);
/// draw an image from the image cache
virtual void image(int x, int y, int w, int h,
@ -98,8 +96,8 @@ public:
FontInfo const & font, bool mouseHover);
/// start monochrome painting mode, i.e. map every color into [min,max]
virtual void enterMonochromeMode(Color const & min,
Color const & max);
virtual void enterMonochromeMode(ColorCode const & min,
ColorCode const & max);
/// leave monochrome painting mode
virtual void leaveMonochromeMode();
@ -110,7 +108,7 @@ public:
* around the text with the given color.
*/
virtual void rectText(int x, int baseline, docstring const & str,
FontInfo const & font, Color back, Color frame);
FontInfo const & font, ColorCode back, ColorCode frame);
/// draw a filled rectangle with the shape of a 3D button
virtual void button(int x, int y, int w, int h, bool mouseHover);
@ -152,7 +150,7 @@ private:
///
std::stack<QColor> monochrome_max_;
/// convert into Qt color, possibly applying the monochrome mode
QColor computeColor(Color col);
QColor computeColor(ColorCode col);
/// possibly apply monochrome mode
QColor filterColor(QColor const & col);
///

View File

@ -1634,8 +1634,7 @@ bool InsetMathNest::interpretChar(Cursor & cur, char_type const c)
// try auto-correction
if (lyxrc.autocorrection_math && cur.autocorrect() && cur.pos() != 0
&& math_autocorrect(cur.prevAtom(), c))
if (lyxrc.autocorrection_math && cur.autocorrect() && cur.pos() != 0 && math_autocorrect(cur.prevAtom(), c))
return true;
// no special circumstances, so insert the character without any fuss

View File

@ -170,7 +170,7 @@ void initAutoCorrect()
} // namespace anon
bool math_autocorrect(MathAtom & at, char_type c)
bool math_autocorrect(MathAtom & at, char c)
{
static bool initialized = false;

View File

@ -17,7 +17,7 @@ namespace lyx {
class MathAtom;
// make "corrections" according to file lib/autocorrect
bool math_autocorrect(MathAtom & at, char_type c);
bool math_autocorrect(MathAtom & at, char c);
} // namespace lyx

View File

@ -304,9 +304,9 @@ void RowPainter::paintChars(pos_type & vpos, FontInfo const & font,
FontInfo copy = font;
if (change_running.changed())
copy.setDrawColor(change_running.color());
copy.setColor(change_running.color());
else if (selection)
copy.setDrawColor(Color_selectiontext);
copy.setColor(Color_selectiontext);
x_ += pi_.pain.text(int(x_), yo_, s, copy);
}
@ -595,7 +595,7 @@ void RowPainter::paintLast()
FontMetrics const & fm =
theFontMetrics(pi_.base.bv->buffer().params().getFont());
int const length = fm.maxAscent() / 2;
Color col = change.color();
ColorCode col = change.color();
pi_.pain.line(int(x_) + 1, yo_ + 2, int(x_) + 1, yo_ + 2 - length, col,
Painter::line_solid, Painter::line_thick);