From 15dc5fa5d666273e6de3b88aede0c4b42c21e4dc Mon Sep 17 00:00:00 2001 From: Angus Leeming Date: Tue, 16 Sep 2003 09:01:15 +0000 Subject: [PATCH] lyxfont.h no longer #includes LColor.h. Change the LyXFont setXYZ member functions to return void, not LyXFont &. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7765 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/ChangeLog | 13 +++++++++ src/frontends/controllers/ChangeLog | 4 +++ src/frontends/controllers/character.C | 1 + src/frontends/qt2/ChangeLog | 4 +++ src/frontends/qt2/QCharacter.C | 2 ++ src/frontends/qt2/QPrefs.C | 2 ++ src/frontends/qt2/lyx_gui.C | 1 + src/frontends/xforms/ChangeLog | 5 ++++ src/frontends/xforms/FormCharacter.C | 2 ++ src/frontends/xforms/FormPreferences.C | 3 ++- src/frontends/xforms/lyx_gui.C | 1 + src/frontends/xforms/xfont_loader.C | 1 + src/insets/ChangeLog | 5 ++++ src/insets/renderers.C | 3 ++- src/lyxfont.C | 35 +++++++++--------------- src/lyxfont.h | 37 ++++++++++---------------- src/lyxrc.C | 1 + src/mathed/ChangeLog | 9 +++++++ src/mathed/math_braceinset.C | 1 + src/mathed/math_data.C | 2 ++ src/mathed/math_exintinset.C | 1 + src/mathed/math_fboxinset.C | 1 + src/mathed/math_fracinset.C | 1 + src/mathed/math_frameboxinset.C | 1 + src/mathed/math_gridinset.C | 1 + src/mathed/math_hullinset.C | 11 +++++--- src/mathed/math_macrotemplate.C | 1 + src/mathed/math_nestinset.C | 5 ++-- src/mathed/math_rootinset.C | 1 + src/mathed/math_scriptinset.C | 1 + src/mathed/math_spaceinset.C | 1 + src/mathed/math_sqrtinset.C | 1 + src/mathed/math_support.C | 1 + src/rowpainter.C | 10 ++++--- 34 files changed, 113 insertions(+), 56 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 594b2ba80b..bf29aea765 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,16 @@ +2003-09-16 Angus Leeming + + * lyxfont.[Ch]: (setFamily, setSeries, setShape, setSize, setEmph, setUnderbar, + setNoun, setNumber, setColor, setLanguage): no longer return LyXFont &. + Store the FontBits::color variable as an int rather than as an LColor::color + so that we can move LColor.h out of the lyxfont.h header file. + + * rowpainter.C (paintAppendixStart, paintPageBreak, paintLengthMarker): + LyXFont::setColor, decSize no longer return a LyXFont &, so cannot string + calls together. + + * lyxrc.C: add #include "LColor.h". + 2003-09-15 Angus Leeming * bufferparams.[Ch]: store the pimpl_ as a copied_ptr, rather than as a cow_ptr. diff --git a/src/frontends/controllers/ChangeLog b/src/frontends/controllers/ChangeLog index d8248e26ed..a6e2c352c6 100644 --- a/src/frontends/controllers/ChangeLog +++ b/src/frontends/controllers/ChangeLog @@ -1,3 +1,7 @@ +2003-09-16 Angus Leeming + + * character.C: add #include "LColor.h". + 2003-09-15 Angus Leeming * ControlCharacter.C (setColor, getColor): diff --git a/src/frontends/controllers/character.C b/src/frontends/controllers/character.C index 1d32dfa406..cc3640f8e3 100644 --- a/src/frontends/controllers/character.C +++ b/src/frontends/controllers/character.C @@ -13,6 +13,7 @@ #include "gettext.h" #include "character.h" +#include "LColor.h" using std::vector; diff --git a/src/frontends/qt2/ChangeLog b/src/frontends/qt2/ChangeLog index 57556defeb..0b555dcc0a 100644 --- a/src/frontends/qt2/ChangeLog +++ b/src/frontends/qt2/ChangeLog @@ -1,3 +1,7 @@ +2003-09-16 Angus Leeming + + * QCharacter.C, QPrefs.C, lyx_gui.C: add #include "LColor.h". + 2003-09-15 Angus Leeming * QLPainter.C: add #include "LColor.h". diff --git a/src/frontends/qt2/QCharacter.C b/src/frontends/qt2/QCharacter.C index 8eb30caf0b..bb192bec5d 100644 --- a/src/frontends/qt2/QCharacter.C +++ b/src/frontends/qt2/QCharacter.C @@ -22,6 +22,8 @@ #include #include +#include "LColor.h" + using frnt::BarPair; using frnt::ColorPair; using frnt::FamilyPair; diff --git a/src/frontends/qt2/QPrefs.C b/src/frontends/qt2/QPrefs.C index 46f447f56b..c23b99cf0b 100644 --- a/src/frontends/qt2/QPrefs.C +++ b/src/frontends/qt2/QPrefs.C @@ -49,6 +49,8 @@ #include #include "qcoloritem.h" +#include "LColor.h" + using lyx::support::compare_no_case; using lyx::support::strToDbl; diff --git a/src/frontends/qt2/lyx_gui.C b/src/frontends/qt2/lyx_gui.C index 3d21b59fc3..d39173d205 100644 --- a/src/frontends/qt2/lyx_gui.C +++ b/src/frontends/qt2/lyx_gui.C @@ -25,6 +25,7 @@ #include "lyxrc.h" #include "lyxserver.h" #include "BufferView.h" +#include "LColor.h" // Dear Lord, deliver us from Evil, // aka the Qt headers diff --git a/src/frontends/xforms/ChangeLog b/src/frontends/xforms/ChangeLog index e0649d8775..80ff27dc40 100644 --- a/src/frontends/xforms/ChangeLog +++ b/src/frontends/xforms/ChangeLog @@ -1,3 +1,8 @@ +2003-09-16 Angus Leeming + + * FormCharacter.C, FormPreferences.C, lyx_gui.C, xfont_loader.C: + add #include "LColor.h". + 2003-09-15 Angus Leeming * Color.C: diff --git a/src/frontends/xforms/FormCharacter.C b/src/frontends/xforms/FormCharacter.C index 6071f51b6d..4e74f39204 100644 --- a/src/frontends/xforms/FormCharacter.C +++ b/src/frontends/xforms/FormCharacter.C @@ -20,6 +20,8 @@ #include "controllers/frnt_lang.h" #include "controllers/helper_funcs.h" +#include "LColor.h" + #include "support/lstrings.h" #include "lyx_forms.h" diff --git a/src/frontends/xforms/FormPreferences.C b/src/frontends/xforms/FormPreferences.C index b7f30e4173..f78b289b2a 100644 --- a/src/frontends/xforms/FormPreferences.C +++ b/src/frontends/xforms/FormPreferences.C @@ -20,11 +20,12 @@ #include "xformsBC.h" #include "controllers/helper_funcs.h" // getSecond +#include "controllers/frnt_lang.h" #include "buffer.h" #include "converter.h" #include "format.h" -#include "frnt_lang.h" +#include "LColor.h" #include "lyxfont.h" #include "support/lstrings.h" diff --git a/src/frontends/xforms/lyx_gui.C b/src/frontends/xforms/lyx_gui.C index 45c0f91707..c5a09dc7d2 100644 --- a/src/frontends/xforms/lyx_gui.C +++ b/src/frontends/xforms/lyx_gui.C @@ -22,6 +22,7 @@ #include "BufferView.h" #include "debug.h" #include "gettext.h" +#include "LColor.h" #include "lyx_main.h" #include "lyxfunc.h" #include "lyxrc.h" diff --git a/src/frontends/xforms/xfont_loader.C b/src/frontends/xforms/xfont_loader.C index 40367b9497..9dce83c0c8 100644 --- a/src/frontends/xforms/xfont_loader.C +++ b/src/frontends/xforms/xfont_loader.C @@ -14,6 +14,7 @@ #include "FontInfo.h" #include "debug.h" +#include "LColor.h" #include "lyxrc.h" // lyxrc.font_* #include "frontends/lyx_gui.h" diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index 8988e47c4a..2745135ad2 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,3 +1,8 @@ +2003-09-16 Angus Leeming + + * renderers.C: LyXFont::setColor no longer return a LyXFont &, so cannot string + calls together. + 2003-09-15 Angus Leeming * inset.[Ch] (setBackgroundColor, backgroundColor): diff --git a/src/insets/renderers.C b/src/insets/renderers.C index 59fa2e4509..fa2a33e1b2 100644 --- a/src/insets/renderers.C +++ b/src/insets/renderers.C @@ -98,7 +98,8 @@ void ButtonRenderer::draw(PainterInfo & pi, int x, int y) const // Draw it as a box with the LaTeX text LyXFont font(LyXFont::ALL_SANE); - font.setColor(LColor::command).decSize(); + font.setColor(LColor::command); + font.decSize(); if (editable_) { pi.pain.buttonText(x + 2, y, text_, font); diff --git a/src/lyxfont.C b/src/lyxfont.C index 9c4f2f5297..4dfe32f320 100644 --- a/src/lyxfont.C +++ b/src/lyxfont.C @@ -20,6 +20,7 @@ #include "debug.h" #include "gettext.h" #include "language.h" +#include "LColor.h" #include "lyxlex.h" #include "lyxrc.h" @@ -204,7 +205,7 @@ LyXFont::FONT_MISC_STATE LyXFont::underbar() const EnumLColor LyXFont::color() const { - return bits.color; + return LColor::color(bits.color); } @@ -233,73 +234,63 @@ bool LyXFont::isVisibleRightToLeft() const } -LyXFont & LyXFont::setFamily(LyXFont::FONT_FAMILY f) +void LyXFont::setFamily(LyXFont::FONT_FAMILY f) { bits.family = f; - return *this; } -LyXFont & LyXFont::setSeries(LyXFont::FONT_SERIES s) +void LyXFont::setSeries(LyXFont::FONT_SERIES s) { bits.series = s; - return *this; } -LyXFont & LyXFont::setShape(LyXFont::FONT_SHAPE s) +void LyXFont::setShape(LyXFont::FONT_SHAPE s) { bits.shape = s; - return *this; } -LyXFont & LyXFont::setSize(LyXFont::FONT_SIZE s) +void LyXFont::setSize(LyXFont::FONT_SIZE s) { bits.size = s; - return *this; } -LyXFont & LyXFont::setEmph(LyXFont::FONT_MISC_STATE e) +void LyXFont::setEmph(LyXFont::FONT_MISC_STATE e) { bits.emph = e; - return *this; } -LyXFont & LyXFont::setUnderbar(LyXFont::FONT_MISC_STATE u) +void LyXFont::setUnderbar(LyXFont::FONT_MISC_STATE u) { bits.underbar = u; - return *this; } -LyXFont & LyXFont::setNoun(LyXFont::FONT_MISC_STATE n) +void LyXFont::setNoun(LyXFont::FONT_MISC_STATE n) { bits.noun = n; - return *this; } -LyXFont & LyXFont::setColor(EnumLColor c) +void LyXFont::setColor(EnumLColor c) { - bits.color = c; - return *this; + bits.color = int(c); } -LyXFont & LyXFont::setLanguage(Language const * l) +void LyXFont::setLanguage(Language const * l) { lang = l; - return *this; } -LyXFont & LyXFont::setNumber(LyXFont::FONT_MISC_STATE n) +void LyXFont::setNumber(LyXFont::FONT_MISC_STATE n) { bits.number = n; - return *this; } diff --git a/src/lyxfont.h b/src/lyxfont.h index 19d66120c8..88f2a2f47c 100644 --- a/src/lyxfont.h +++ b/src/lyxfont.h @@ -15,8 +15,6 @@ #ifndef LYXFONT_H #define LYXFONT_H -#include "LColor.h" - #include "support/std_string.h" #include @@ -223,25 +221,16 @@ public: bool isSymbolFont() const; /// - LyXFont & setFamily(LyXFont::FONT_FAMILY f); - /// - LyXFont & setSeries(LyXFont::FONT_SERIES s); - /// - LyXFont & setShape(LyXFont::FONT_SHAPE s); - /// - LyXFont & setSize(LyXFont::FONT_SIZE s); - /// - LyXFont & setEmph(LyXFont::FONT_MISC_STATE e); - /// - LyXFont & setUnderbar(LyXFont::FONT_MISC_STATE u); - /// - LyXFont & setNoun(LyXFont::FONT_MISC_STATE n); - /// - LyXFont & setNumber(LyXFont::FONT_MISC_STATE n); - /// - LyXFont & setColor(EnumLColor c); - /// - LyXFont & setLanguage(Language const * l); + void setFamily(LyXFont::FONT_FAMILY f); + void setSeries(LyXFont::FONT_SERIES s); + void setShape(LyXFont::FONT_SHAPE s); + void setSize(LyXFont::FONT_SIZE s); + void setEmph(LyXFont::FONT_MISC_STATE e); + void setUnderbar(LyXFont::FONT_MISC_STATE u); + void setNoun(LyXFont::FONT_MISC_STATE n); + void setNumber(LyXFont::FONT_MISC_STATE n); + void setColor(EnumLColor c); + void setLanguage(Language const * l); /// Set family after LyX text format LyXFont & setLyXFamily(string const &); @@ -332,8 +321,10 @@ public: FONT_SHAPE shape; /// FONT_SIZE size; - /// - LColor::color color; + /** We store the LColor::color value as an int to get LColor.h out + * of the header file. + */ + int color; /// FONT_MISC_STATE emph; /// diff --git a/src/lyxrc.C b/src/lyxrc.C index 99c6b02a81..c2082dcf6b 100644 --- a/src/lyxrc.C +++ b/src/lyxrc.C @@ -25,6 +25,7 @@ #include "converter.h" #include "format.h" #include "gettext.h" +#include "LColor.h" #include "lyxlex.h" #include "lyxfont.h" diff --git a/src/mathed/ChangeLog b/src/mathed/ChangeLog index bc4cddabe2..22f2b69d3d 100644 --- a/src/mathed/ChangeLog +++ b/src/mathed/ChangeLog @@ -1,3 +1,12 @@ +2003-09-16 Angus Leeming + + * math_braceinset.C, math_data.C, math_fboxinset.C, math_frameboxinset.C, + math_gridinset.C, math_hullinset.C, math_macrotemplate.C, math_nestinset.C, + math_rootinset.C, math_spaceinset.C, math_sqrtinset.C, math_support.C: + add #include "LColor.h". + * math_data.C, math_scriptinset.C: add #include + * math_exintinset.C: add #include + 2003-09-15 Lars Gullik Bjønnes * command_inset.C diff --git a/src/mathed/math_braceinset.C b/src/mathed/math_braceinset.C index ecd1c0cef0..aa7b914896 100644 --- a/src/mathed/math_braceinset.C +++ b/src/mathed/math_braceinset.C @@ -14,6 +14,7 @@ #include "math_data.h" #include "math_mathmlstream.h" #include "math_support.h" +#include "LColor.h" #include "support/std_ostream.h" using std::max; diff --git a/src/mathed/math_data.C b/src/mathed/math_data.C index 0bb3b984e2..a7f606eb63 100644 --- a/src/mathed/math_data.C +++ b/src/mathed/math_data.C @@ -18,7 +18,9 @@ #include "math_support.h" #include "math_replace.h" #include "debug.h" +#include "LColor.h" #include "frontends/Painter.h" +#include using std::abs; using std::endl; diff --git a/src/mathed/math_exintinset.C b/src/mathed/math_exintinset.C index a6b96c9cbb..31dfe1655b 100644 --- a/src/mathed/math_exintinset.C +++ b/src/mathed/math_exintinset.C @@ -16,6 +16,7 @@ #include "math_streamstr.h" #include "math_symbolinset.h" #include "debug.h" +#include using std::auto_ptr; diff --git a/src/mathed/math_fboxinset.C b/src/mathed/math_fboxinset.C index 8039de58c8..cef9c1d6ed 100644 --- a/src/mathed/math_fboxinset.C +++ b/src/mathed/math_fboxinset.C @@ -15,6 +15,7 @@ #include "math_mathmlstream.h" #include "math_parser.h" #include "math_streamstr.h" +#include "LColor.h" #include "frontends/Painter.h" using std::auto_ptr; diff --git a/src/mathed/math_fracinset.C b/src/mathed/math_fracinset.C index ba0548c667..c08f062f5c 100644 --- a/src/mathed/math_fracinset.C +++ b/src/mathed/math_fracinset.C @@ -15,6 +15,7 @@ #include "math_data.h" #include "math_mathmlstream.h" #include "textpainter.h" +#include "LColor.h" #include "frontends/Painter.h" diff --git a/src/mathed/math_frameboxinset.C b/src/mathed/math_frameboxinset.C index c5b665ddde..d1cf3afb17 100644 --- a/src/mathed/math_frameboxinset.C +++ b/src/mathed/math_frameboxinset.C @@ -14,6 +14,7 @@ #include "math_data.h" #include "math_mathmlstream.h" #include "math_support.h" +#include "LColor.h" #include "frontends/Painter.h" using std::auto_ptr; diff --git a/src/mathed/math_gridinset.C b/src/mathed/math_gridinset.C index 1b4fb07eba..1b9e34db05 100644 --- a/src/mathed/math_gridinset.C +++ b/src/mathed/math_gridinset.C @@ -16,6 +16,7 @@ #include "math_streamstr.h" #include "debug.h" #include "funcrequest.h" +#include "LColor.h" #include "frontends/Painter.h" #include "support/std_sstream.h" diff --git a/src/mathed/math_hullinset.C b/src/mathed/math_hullinset.C index f307e21454..3cf949d4fa 100644 --- a/src/mathed/math_hullinset.C +++ b/src/mathed/math_hullinset.C @@ -17,15 +17,18 @@ #include "math_support.h" #include "math_extern.h" #include "math_charinset.h" -#include "debug.h" #include "textpainter.h" +#include "debug.h" #include "funcrequest.h" -#include "support/std_sstream.h" +#include "gettext.h" #include "LaTeXFeatures.h" +#include "LColor.h" +#include "lyxrc.h" #include "frontends/Alert.h" -#include "lyxrc.h" -#include "gettext.h" + +#include "support/std_sstream.h" + using lyx::support::trim; diff --git a/src/mathed/math_macrotemplate.C b/src/mathed/math_macrotemplate.C index 3c370383ee..52aedb0288 100644 --- a/src/mathed/math_macrotemplate.C +++ b/src/mathed/math_macrotemplate.C @@ -15,6 +15,7 @@ #include "math_parser.h" #include "frontends/Painter.h" #include "debug.h" +#include "LColor.h" using std::auto_ptr; using std::endl; diff --git a/src/mathed/math_nestinset.C b/src/mathed/math_nestinset.C index a1524bbfd3..7962164594 100644 --- a/src/mathed/math_nestinset.C +++ b/src/mathed/math_nestinset.C @@ -14,9 +14,10 @@ #include "math_cursor.h" #include "math_mathmlstream.h" #include "math_parser.h" -#include "funcrequest.h" -#include "debug.h" #include "BufferView.h" +#include "debug.h" +#include "funcrequest.h" +#include "LColor.h" #include "frontends/Painter.h" diff --git a/src/mathed/math_rootinset.C b/src/mathed/math_rootinset.C index bba8ddfbb1..98c214552a 100644 --- a/src/mathed/math_rootinset.C +++ b/src/mathed/math_rootinset.C @@ -14,6 +14,7 @@ #include "math_rootinset.h" #include "math_data.h" #include "math_mathmlstream.h" +#include "LColor.h" #include "frontends/Painter.h" diff --git a/src/mathed/math_scriptinset.C b/src/mathed/math_scriptinset.C index fad41bd229..40a4b79ce0 100644 --- a/src/mathed/math_scriptinset.C +++ b/src/mathed/math_scriptinset.C @@ -17,6 +17,7 @@ #include "math_symbolinset.h" #include "debug.h" #include "funcrequest.h" +#include using std::max; using std::auto_ptr; diff --git a/src/mathed/math_spaceinset.C b/src/mathed/math_spaceinset.C index 5b77f0cb59..c54ecc0ffb 100644 --- a/src/mathed/math_spaceinset.C +++ b/src/mathed/math_spaceinset.C @@ -15,6 +15,7 @@ #include "frontends/Painter.h" #include "math_mathmlstream.h" #include "LaTeXFeatures.h" +#include "LColor.h" using std::auto_ptr; diff --git a/src/mathed/math_sqrtinset.C b/src/mathed/math_sqrtinset.C index f02db6a954..00ecc675f0 100644 --- a/src/mathed/math_sqrtinset.C +++ b/src/mathed/math_sqrtinset.C @@ -14,6 +14,7 @@ #include "math_data.h" #include "math_mathmlstream.h" #include "textpainter.h" +#include "LColor.h" #include "frontends/Painter.h" using std::auto_ptr; diff --git a/src/mathed/math_support.C b/src/mathed/math_support.C index 802afbcc85..fea92dd6c3 100644 --- a/src/mathed/math_support.C +++ b/src/mathed/math_support.C @@ -18,6 +18,7 @@ #include "math_parser.h" #include "debug.h" +#include "LColor.h" #include "frontends/Painter.h" #include "frontends/font_metrics.h" diff --git a/src/rowpainter.C b/src/rowpainter.C index e380f3e468..18f92e9b17 100644 --- a/src/rowpainter.C +++ b/src/rowpainter.C @@ -596,7 +596,9 @@ int RowPainter::paintLengthMarker(string const & prefix, VSpace const & vsp, int int d = 0; LyXFont font; - font.setColor(LColor::added_space).decSize().decSize(); + font.setColor(LColor::added_space); + font.decSize(); + font.decSize(); font_metrics::rectText(str, font, w, a, d); pain_.rectText(leftx + 2 * arrow_size + 5, @@ -622,7 +624,8 @@ int RowPainter::paintLengthMarker(string const & prefix, VSpace const & vsp, int int RowPainter::paintPageBreak(string const & label, int y) { LyXFont pb_font; - pb_font.setColor(LColor::pagebreak).decSize(); + pb_font.setColor(LColor::pagebreak); + pb_font.decSize(); int w = 0; int a = 0; @@ -646,7 +649,8 @@ int RowPainter::paintPageBreak(string const & label, int y) int RowPainter::paintAppendixStart(int y) { LyXFont pb_font; - pb_font.setColor(LColor::appendix).decSize(); + pb_font.setColor(LColor::appendix); + pb_font.decSize(); string const label = _("Appendix"); int w = 0;