Hello,
Nothing controversial here. Just some renaming in preparation for
further cleanup.
Committed to trunk.
Abdel.
_______________________
Log:
Those classes (and their associated [Ch] files) are renamed :
QLAction -> Action
lcolorcache -> ColorCache
qfont_loader.C -> FontLoader
Index: Action.C
===================================================================
--- Action.C (revision 14133)
+++ Action.C (working copy)
@@ -1,5 +1,5 @@
/**
- * \file QLAction.C
+ * \file Action.C
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
@@ -22,7 +22,7 @@
#include "LyXView.h"
#include "qt_helpers.h"
-#include "QLAction.h"
+#include "Action.h"
#include "support/lstrings.h"
@@ -39,7 +39,7 @@
} // namespace anon
-QLAction::QLAction(LyXView & lyxView, string const & text,
+Action::Action(LyXView & lyxView, string const & text,
FuncRequest const & func, string const & tooltip)
: QAction(this), lyxView_(lyxView), func_(func)
{
@@ -50,7 +50,7 @@
this->setCheckable(true);
}
-QLAction::QLAction(LyXView & lyxView, string const & icon, string const & text,
+Action::Action(LyXView & lyxView, string const & icon, string const & text,
FuncRequest const & func, string const & tooltip)
: QAction(this), lyxView_(lyxView), func_(func)
{
@@ -63,13 +63,13 @@
}
/*
-void QLAction::setAction(FuncRequest const & func)
+void Action::setAction(FuncRequest const & func)
{
func_=func;
}
*/
-void QLAction::update()
+void Action::update()
{
FuncStatus const status = lyxView_.getLyXFunc().getStatus(func_);
@@ -78,7 +78,7 @@
}
-void QLAction::action()
+void Action::action()
{
// lyxerr[Debug::ACTION] << "calling LyXFunc::dispatch: func_: " << func_
<< endl;
@@ -88,4 +88,4 @@
} // namespace frontend
} // namespace lyx
-#include "QLAction_moc.cpp"
+#include "Action_moc.cpp"
Index: Action.h
===================================================================
--- Action.h (revision 14133)
+++ Action.h (working copy)
@@ -1,6 +1,6 @@
// -*- C++ -*-
/**
- * \file QLAction.h
+ * \file Action.h
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
@@ -9,8 +9,8 @@
* Full author contact details are available in file CREDITS.
*/
-#ifndef QLACTION_H
-#define QLACTION_H
+#ifndef ACTION_H
+#define ACTION_H
// Must be here because of moc.
#include <config.h>
@@ -28,18 +28,18 @@
namespace frontend {
/**
- * QLAction - Qt interface with LyX' FuncRequest.
+ * Action - Qt interface with LyX' FuncRequest.
*
- * QLAction can be used in LyX menubar and/or toolbars.
+ * Action can be used in LyX menubar and/or toolbars.
*/
-class QLAction: public QAction {
+class Action: public QAction {
Q_OBJECT
public:
- QLAction(LyXView & lyxView, std::string const & text,
+ Action(LyXView & lyxView, std::string const & text,
FuncRequest const & func, std::string const & tooltip="");
- QLAction(LyXView & lyxView, std::string const & icon, std::string const
& text,
+ Action(LyXView & lyxView, std::string const & icon, std::string const &
text,
FuncRequest const & func, std::string const & tooltip="");
void update();
@@ -59,4 +59,4 @@
} // namespace frontend
} // namespace lyx
-#endif // QLACTION_H
+#endif // ACTION_H
Index: ColorCache.C
===================================================================
--- ColorCache.C (revision 14133)
+++ ColorCache.C (working copy)
@@ -1,5 +1,5 @@
/**
- * \file lcolorcache.C
+ * \file ColorCache.C
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
@@ -11,11 +11,11 @@
#include <config.h>
#include "Color.h"
-#include "lcolorcache.h"
+#include "ColorCache.h"
#include "LColor.h"
-LColorCache lcolorcache;
+ColorCache lcolorcache;
const QColor grey40(0x66, 0x66, 0x66);
const QColor grey60(0x99, 0x99, 0x99);
@@ -24,11 +24,11 @@
const QColor none = Qt::black;
-LColorCache::LColorCache()
+ColorCache::ColorCache()
{
}
-QColor const & LColorCache::get(LColor_color col) const
+QColor const & ColorCache::get(LColor_color col) const
{
lcolor_map::const_iterator cit = colormap.find(col);
if (cit != colormap.end())
@@ -51,7 +51,7 @@
}
-void LColorCache::clear()
+void ColorCache::clear()
{
colormap.clear();
}
Index: ColorCache.h
===================================================================
--- ColorCache.h (revision 14133)
+++ ColorCache.h (working copy)
@@ -1,6 +1,6 @@
// -*- C++ -*-
/**
- * \file lcolorcache.h
+ * \file ColorCache.h
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
@@ -9,8 +9,8 @@
* Full author contact details are available in file CREDITS.
*/
-#ifndef LCOLORCACHE_H
-#define LCOLORCACHE_H
+#ifndef COLORCACHE_H
+#define COLORCACHE_H
#include "LColor.h"
@@ -29,9 +29,9 @@
/**
* Cache from LColor to QColor.
*/
-class LColorCache {
+class ColorCache {
public:
- LColorCache();
+ ColorCache();
/// get the given color
QColor const & get(LColor_color color) const;
@@ -46,8 +46,8 @@
};
/// singleton instance
-extern LColorCache lcolorcache;
+extern ColorCache lcolorcache;
///
QColor const rgb2qcolor(lyx::RGBColor const &);
-#endif // LCOLORCACHE_H
+#endif // COLORCACHE_H
Index: FontLoader.C
===================================================================
--- FontLoader.C (revision 14133)
+++ FontLoader.C (working copy)
@@ -11,7 +11,7 @@
#include <config.h>
-#include "qfont_loader.h"
+#include "FontLoader.h"
#include "qt_helpers.h"
#include "debug.h"
Index: FontLoader.h
===================================================================
--- FontLoader.h (revision 14133)
+++ FontLoader.h (working copy)
@@ -1,6 +1,6 @@
// -*- C++ -*-
/**
- * \file qfont_loader.h
+ * \file FontLoader.h
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
Index: lcolorcache.C
===================================================================
--- lcolorcache.C (revision 14133)
+++ lcolorcache.C (working copy)
@@ -1,63 +0,0 @@
-/**
- * \file lcolorcache.C
- * This file is part of LyX, the document processor.
- * Licence details can be found in the file COPYING.
- *
- * \author John Levon
- *
- * Full author contact details are available in file CREDITS.
- */
-
-#include <config.h>
-
-#include "Color.h"
-#include "lcolorcache.h"
-
-#include "LColor.h"
-
-LColorCache lcolorcache;
-
-const QColor grey40(0x66, 0x66, 0x66);
-const QColor grey60(0x99, 0x99, 0x99);
-const QColor grey80(0xcc, 0xcc, 0xcc);
-const QColor grey90(0xe5, 0xe5, 0xe5);
-const QColor none = Qt::black;
-
-
-LColorCache::LColorCache()
-{
-}
-
-QColor const & LColorCache::get(LColor_color col) const
-{
- lcolor_map::const_iterator cit = colormap.find(col);
- if (cit != colormap.end())
- return cit->second;
-
- if (lcolor.getX11Name(col) == "grey40")
- colormap[col] = grey40;
- else if (lcolor.getX11Name(col) == "grey60")
- colormap[col] = grey60;
- else if (lcolor.getX11Name(col) == "grey80")
- colormap[col] = grey80;
- else if (lcolor.getX11Name(col) == "grey90")
- colormap[col] = grey90;
- else if (lcolor.getX11Name(col) == "none")
- colormap[col] = none;
- else
- colormap[col] = QColor(lcolor.getX11Name(col).c_str());
-
- return colormap[col];
-}
-
-
-void LColorCache::clear()
-{
- colormap.clear();
-}
-
-
-QColor const rgb2qcolor(lyx::RGBColor const & rgb)
-{
- return QColor(rgb.r, rgb.g, rgb.b);
-}
Index: lcolorcache.h
===================================================================
--- lcolorcache.h (revision 14133)
+++ lcolorcache.h (working copy)
@@ -1,53 +0,0 @@
-// -*- C++ -*-
-/**
- * \file lcolorcache.h
- * This file is part of LyX, the document processor.
- * Licence details can be found in the file COPYING.
- *
- * \author John Levon
- *
- * Full author contact details are available in file CREDITS.
- */
-
-#ifndef LCOLORCACHE_H
-#define LCOLORCACHE_H
-
-#include "LColor.h"
-
-#include <map>
-
-#include <QColor>
-
-
-namespace lyx {
-struct RGBColor;
-}
-
-
-// FIXME: use a fixed-size array not a map ?
-
-/**
- * Cache from LColor to QColor.
- */
-class LColorCache {
-public:
- LColorCache();
-
- /// get the given color
- QColor const & get(LColor_color color) const;
-
- /// clear all colors
- void clear();
-
-private:
- typedef std::map<LColor_color, QColor> lcolor_map;
-
- mutable lcolor_map colormap;
-};
-
-/// singleton instance
-extern LColorCache lcolorcache;
-
-///
-QColor const rgb2qcolor(lyx::RGBColor const &);
-#endif // LCOLORCACHE_H
Index: lyx_gui.C
===================================================================
--- lyx_gui.C (revision 14133)
+++ lyx_gui.C (working copy)
@@ -43,8 +43,8 @@
#include <boost/shared_ptr.hpp>
#include "QtView.h"
-#include "lcolorcache.h"
-#include "qfont_loader.h"
+#include "ColorCache.h"
+#include "FontLoader.h"
#include "QLImage.h"
#include "qt_helpers.h"
#include "socket_callback.h"
Index: Makefile.am
===================================================================
--- Makefile.am (revision 14133)
+++ Makefile.am (working copy)
@@ -32,7 +32,9 @@
libqt4_la_SOURCES = \
QDialogView.C \
QDialogView.h \
+ Action.C Action.h \
Alert_pimpl.C \
+ ColorCache.h ColorCache.C \
Dialogs.C \
FileDialog.C \
LyXKeySymFactory.C \
@@ -56,7 +58,6 @@
QGraphics.C QGraphics.h \
QInclude.C QInclude.h \
QIndex.C QIndex.h \
- QLAction.C QLAction.h \
QLImage.C QLImage.h \
QLog.C QLog.h \
QViewSource.C QViewSource.h \
@@ -85,10 +86,9 @@
WorkAreaFactory.C \
checkedwidgets.C checkedwidgets.h \
lyx_gui.C \
- lcolorcache.h lcolorcache.C \
panelstack.h panelstack.C \
qfontexample.h qfontexample.C \
- qfont_loader.h qfont_loader.C \
+ FontLoader.h FontLoader.C \
qfont_metrics.C \
qlkey.h \
qt_helpers.h qt_helpers.C \
Index: Makefile.dialogs
===================================================================
--- Makefile.dialogs (revision 14133)
+++ Makefile.dialogs (working copy)
@@ -72,6 +72,7 @@
QWrapUi.ui
MOCFILES = \
+ Action.C Action.h \
BulletsModule.C BulletsModule.h \
emptytable.C emptytable.h \
FileDialog_private.C FileDialog_private.h \
@@ -100,7 +101,6 @@
QGraphicsDialog.C QGraphicsDialog.h \
QIncludeDialog.C QIncludeDialog.h \
QIndexDialog.C QIndexDialog.h \
- QLAction.C QLAction.h \
QLogDialog.C QLogDialog.h \
QViewSourceDialog.C QViewSourceDialog.h \
QViewSource.C QViewSource.h \
Index: QBranches.C
===================================================================
--- QBranches.C (revision 14133)
+++ QBranches.C (working copy)
@@ -13,7 +13,7 @@
#include "QBranches.h"
-#include "lcolorcache.h"
+#include "ColorCache.h"
#include "validators.h"
#include "qt_helpers.h"
Index: qfont_loader.C
===================================================================
--- qfont_loader.C (revision 14133)
+++ qfont_loader.C (working copy)
@@ -1,401 +0,0 @@
-/**
- * \file FontLoader.C
- * This file is part of LyX, the document processor.
- * Licence details can be found in the file COPYING.
- *
- * \author Asger Alstrup
- * \author John Levon
- *
- * Full author contact details are available in file CREDITS.
- */
-
-#include <config.h>
-
-#include "qfont_loader.h"
-#include "qt_helpers.h"
-
-#include "debug.h"
-#include "lyxrc.h"
-
-#include "frontends/lyx_gui.h"
-
-#include "support/convert.h"
-#include "support/filetools.h"
-#include "support/lstrings.h"
-#include "support/systemcall.h"
-
-#include <qfontinfo.h>
-
-#include <boost/tuple/tuple.hpp>
-
-#ifdef Q_WS_X11
-#include <qwidget.h>
-#include <X11/Xlib.h>
-#include <algorithm>
-#endif
-
-using lyx::support::contains;
-
-using std::endl;
-using std::make_pair;
-
-using std::pair;
-using std::vector;
-using std::string;
-
-#ifdef Q_WS_MACX
-#include <ApplicationServices/ApplicationServices.h>
-#endif
-
-#ifdef Q_WS_WIN
-#include "windows.h"
-#include "support/os.h"
-#include "support/package.h"
-#include "support/path.h"
-using lyx::support::addName;
-using lyx::support::addPath;
-using lyx::support::package;
-namespace os = lyx::support::os;
-string const win_fonts_truetype[] = {"cmex10", "cmmi10", "cmr10", "cmsy10",
- "eufm10", "msam10", "msbm10", "wasy10"};
-const int num_fonts_truetype = sizeof(win_fonts_truetype) /
sizeof(*win_fonts_truetype);
-#endif
-
-void FontLoader::initFontPath()
-{
-#ifdef Q_WS_MACX
- CFBundleRef myAppBundle = CFBundleGetMainBundle();
- CFURLRef myAppResourcesURL, FontsURL;
- FSRef fontDirRef;
- FSSpec fontDirSpec;
- CFStringRef filePath = CFStringCreateWithBytes(kCFAllocatorDefault,
- (UInt8 *) "Fonts", strlen("Fonts"),
- kCFStringEncodingISOLatin1, false);
-
- myAppResourcesURL = CFBundleCopyResourcesDirectoryURL(myAppBundle);
- FontsURL = CFURLCreateCopyAppendingPathComponent(kCFAllocatorDefault,
- myAppResourcesURL, filePath, true);
- if (lyxerr.debugging(Debug::FONT)) {
- UInt8 buf[255];
- if (CFURLGetFileSystemRepresentation(FontsURL, true, buf, 255))
- lyxerr << "Adding Fonts directory: " << buf << endl;
- }
- CFURLGetFSRef (FontsURL, &fontDirRef);
- OSStatus err = FSGetCatalogInfo (&fontDirRef, kFSCatInfoNone,
- NULL, NULL, &fontDirSpec, NULL);
- if (err)
- lyxerr << "FSGetCatalogInfo err = " << err << endl;
- err = FMActivateFonts (&fontDirSpec, NULL, NULL,
- kFMLocalActivationContext);
- if (err)
- lyxerr << "FMActivateFonts err = " << err << endl;
-#endif
-
-#ifdef Q_WS_WIN
- // Windows only: Add BaKoMa TrueType font resources
- string const fonts_dir = addPath(package().system_support(), "fonts");
-
- for (int i = 0 ; i < num_fonts_truetype ; ++i) {
- string const font_current =
- addName(fonts_dir, win_fonts_truetype[i] + ".ttf");
- AddFontResource(os::external_path(font_current).c_str());
- }
-#endif
-}
-
-FontLoader::~FontLoader() {
-#ifdef Q_WS_WIN
- // Windows only: Remove BaKoMa TrueType font resources
- string const fonts_dir = addPath(package().system_support(), "fonts");
-
- for(int i = 0 ; i < num_fonts_truetype ; ++i) {
- string const font_current =
- addName(fonts_dir, win_fonts_truetype[i] + ".ttf");
- RemoveFontResource(os::external_path(font_current).c_str());
- }
-#endif
-}
-
-namespace {
-
-struct symbol_font {
- LyXFont::FONT_FAMILY lyx_family;
- string family;
- string xlfd;
-};
-
-symbol_font symbol_fonts[] = {
- { LyXFont::SYMBOL_FAMILY,
- "symbol",
- "-*-symbol-*-*-*-*-*-*-*-*-*-*-adobe-fontspecific" },
-
- { LyXFont::CMR_FAMILY,
- "cmr10",
- "-*-cmr10-medium-*-*-*-*-*-*-*-*-*-*-*" },
-
- { LyXFont::CMSY_FAMILY,
- "cmsy10",
- "-*-cmsy10-*-*-*-*-*-*-*-*-*-*-*-*" },
-
- { LyXFont::CMM_FAMILY,
- "cmmi10",
- "-*-cmmi10-medium-*-*-*-*-*-*-*-*-*-*-*" },
-
- { LyXFont::CMEX_FAMILY,
- "cmex10",
- "-*-cmex10-*-*-*-*-*-*-*-*-*-*-*-*" },
-
- { LyXFont::MSA_FAMILY,
- "msam10",
- "-*-msam10-*-*-*-*-*-*-*-*-*-*-*-*" },
-
- { LyXFont::MSB_FAMILY,
- "msbm10",
- "-*-msbm10-*-*-*-*-*-*-*-*-*-*-*-*" },
-
- { LyXFont::EUFRAK_FAMILY,
- "eufm10",
- "-*-eufm10-medium-*-*-*-*-*-*-*-*-*-*-*" },
-
- { LyXFont::WASY_FAMILY,
- "wasy10",
- "-*-wasy10-medium-*-*-*-*-*-*-*-*-*-*-*" }
-};
-
-size_t const nr_symbol_fonts = sizeof(symbol_fonts) / sizeof(symbol_font);
-
-
-string getRawName(string const & family)
-{
- for (size_t i = 0; i < nr_symbol_fonts; ++i)
- if (family == symbol_fonts[i].family)
- return symbol_fonts[i].xlfd;
-
- lyxerr[Debug::FONT] << "BUG: family not found !" << endl;
- return string();
-}
-
-
-string const symbolFamily(LyXFont::FONT_FAMILY family)
-{
- for (size_t i = 0; i < nr_symbol_fonts; ++i) {
- if (family == symbol_fonts[i].lyx_family)
- return symbol_fonts[i].family;
- }
- return string();
-}
-
-
-bool isSymbolFamily(LyXFont::FONT_FAMILY family)
-{
- return family >= LyXFont::SYMBOL_FAMILY &&
- family <= LyXFont::WASY_FAMILY;
-}
-
-
-bool isChosenFont(QFont & font, string const & family)
-{
- lyxerr[Debug::FONT] << "raw: " << fromqstr(font.rawName()) << endl;
-
- QFontInfo fi(font);
-
- // Note Qt lies about family quite often
- lyxerr[Debug::FONT] << "alleged fi family: "
- << fromqstr(fi.family()) << endl;
-
- // So we check rawName first
- if (contains(fromqstr(font.rawName()), family)) {
- lyxerr[Debug::FONT] << " got it ";
- return true;
- }
-
- // Qt 3.2 beta1 returns "xft" for all xft fonts
- // Qt 4.1 returns "Multi" for all ? xft fonts
- if (font.rawName() == "xft" || font.rawName() == "Multi") {
- if (contains(fromqstr(fi.family()), family)) {
- lyxerr[Debug::FONT] << " got it (Xft) ";
- return true;
- }
- }
-
- return false;
-}
-
-
-pair<QFont, bool> const getSymbolFont(string const & family)
-{
- lyxerr[Debug::FONT] << "Looking for font family "
- << family << " ... ";
- string upper = family;
- upper[0] = toupper(family[0]);
-
- QFont font;
- font.setFamily(toqstr(family));
-
- if (isChosenFont(font, family)) {
- lyxerr[Debug::FONT] << "normal!" << endl;
- return make_pair<QFont, bool>(font, true);
- }
-
- font.setFamily(toqstr(upper));
-
- if (isChosenFont(font, upper)) {
- lyxerr[Debug::FONT] << "upper!" << endl;
- return make_pair<QFont, bool>(font, true);
- }
-
- // A simple setFamily() fails on Qt 2
-
- font.setRawName(toqstr(getRawName(family)));
-
- if (isChosenFont(font, family)) {
- lyxerr[Debug::FONT] << "raw version!" << endl;
- return make_pair<QFont, bool>(font, true);
- }
-
- lyxerr[Debug::FONT] << " FAILED :-(" << endl;
- return make_pair<QFont, bool>(font, false);
-}
-
-} // namespace anon
-
-
-FontLoader::FontLoader()
-{
- for (int i1 = 0; i1 < LyXFont::NUM_FAMILIES; ++i1)
- for (int i2 = 0; i2 < 2; ++i2)
- for (int i3 = 0; i3 < 4; ++i3)
- for (int i4 = 0; i4 < 10; ++i4)
- fontinfo_[i1][i2][i3][i4] = 0;
-}
-
-
-void FontLoader::update()
-{
- for (int i1 = 0; i1 < LyXFont::NUM_FAMILIES; ++i1)
- for (int i2 = 0; i2 < 2; ++i2)
- for (int i3 = 0; i3 < 4; ++i3)
- for (int i4 = 0; i4 < 10; ++i4) {
- delete fontinfo_[i1][i2][i3][i4];
- fontinfo_[i1][i2][i3][i4] = 0;
- }
-}
-
-
-/////////////////////////////////////////////////
-
-
-QLFontInfo::QLFontInfo(LyXFont const & f)
- : metrics(font)
-{
-
- string const pat = symbolFamily(f.family());
- if (!pat.empty()) {
- bool tmp;
- boost::tie(font, tmp) = getSymbolFont(pat);
- } else {
- switch (f.family()) {
- case LyXFont::ROMAN_FAMILY:
-
font.setFamily(toqstr(makeFontName(lyxrc.roman_font_name,
- lyxrc.roman_font_foundry)));
- break;
- case LyXFont::SANS_FAMILY:
- font.setFamily(toqstr(makeFontName(lyxrc.sans_font_name,
- lyxrc.sans_font_foundry)));
- break;
- case LyXFont::TYPEWRITER_FAMILY:
-
font.setFamily(toqstr(makeFontName(lyxrc.typewriter_font_name,
-
lyxrc.typewriter_font_foundry)));
- break;
- default:
- break;
- }
- }
-
- font.setPointSizeFloat(convert<double>(lyxrc.font_sizes[f.size()])
- * lyxrc.zoom / 100.0);
-
- switch (f.series()) {
- case LyXFont::MEDIUM_SERIES:
- font.setWeight(QFont::Normal);
- break;
- case LyXFont::BOLD_SERIES:
- font.setWeight(QFont::Bold);
- break;
- default:
- break;
- }
-
- switch (f.realShape()) {
- case LyXFont::ITALIC_SHAPE:
- case LyXFont::SLANTED_SHAPE:
- font.setItalic(true);
- break;
- default:
- break;
- }
-
- if (lyxerr.debugging(Debug::FONT)) {
- lyxerr[Debug::FONT] << "Font '" << f.stateText(0)
- << "' matched by\n" << (const char *) font.rawName() <<
endl;
- }
-
- lyxerr[Debug::FONT] << "The font has size: "
- << font.pointSizeFloat() << endl;
-
- // Is this an exact match?
- if (font.exactMatch())
- lyxerr[Debug::FONT] << "This font is an exact match" << endl;
- else
- lyxerr[Debug::FONT] << "This font is NOT an exact match"
- << endl;
-
- lyxerr[Debug::FONT] << "XFLD: " << (const char *) font.rawName() <<
endl;
-
- metrics = QFontMetrics(font);
-}
-
-
-int QLFontInfo::width(Uchar val)
-{
-// Starting with version 3.1.0, Qt/X11 does its own caching of
-// character width, so it is not necessary to provide ours.
-#if defined (USE_LYX_FONTCACHE)
- QLFontInfo::WidthCache::const_iterator cit = widthcache.find(val);
- if (cit != widthcache.end())
- return cit->second;
-
- int const w = metrics.width(QChar(val));
- widthcache[val] = w;
- return w;
-#else
- return metrics.width(QChar(val));
-#endif
-}
-
-
-bool FontLoader::available(LyXFont const & f)
-{
- if (!lyx_gui::use_gui)
- return false;
-
- static vector<int> cache_set(LyXFont::NUM_FAMILIES, false);
- static vector<int> cache(LyXFont::NUM_FAMILIES, false);
-
- LyXFont::FONT_FAMILY family = f.family();
- if (cache_set[family])
- return cache[family];
- cache_set[family] = true;
-
- string const pat = symbolFamily(family);
- if (pat.empty())
- // We don't care about non-symbol fonts
- return false;
-
- pair<QFont, bool> tmp = getSymbolFont(pat);
- if (!tmp.second)
- return false;
-
- cache[family] = true;
- return true;
-}
Index: qfont_loader.h
===================================================================
--- qfont_loader.h (revision 14133)
+++ qfont_loader.h (working copy)
@@ -1,102 +0,0 @@
-// -*- C++ -*-
-/**
- * \file qfont_loader.h
- * This file is part of LyX, the document processor.
- * Licence details can be found in the file COPYING.
- *
- * \author John Levon
- *
- * Full author contact details are available in file CREDITS.
- */
-
-#ifndef QFONTLOADER_H
-#define QFONTLOADER_H
-
-#include "encoding.h"
-#include "lyxfont.h"
-
-#include <QFont>
-#include <QFontMetrics>
-
-//#if QT_VERSION < 0x030100
-#define USE_LYX_FONTCACHE
-//#endif
-
-#if defined(USE_LYX_FONTCACHE)
-#include <map>
-#endif
-
-/**
- * Qt font loader for LyX. Matches LyXFonts against
- * actual QFont instances, and also caches metrics.
- */
-class QLFontInfo {
-public:
- QLFontInfo(LyXFont const & f);
-
- /// Return pixel width for the given unicode char
- int width(Uchar val);
-
- /// The font instance
- QFont font;
- /// Metrics on the font
- QFontMetrics metrics;
-
-#if defined(USE_LYX_FONTCACHE)
- typedef std::map<Uchar, int> WidthCache;
- /// Cache of char widths
- WidthCache widthcache;
-#endif
-};
-
-
-/// Hold info about a particular font
-class FontLoader {
-public:
- ///
- FontLoader();
-
- /// Destructor
- ~FontLoader();
-
- /// Update fonts after zoom, dpi, font names, or norm change
- void update();
-
- /// Do we have anything matching?
- bool available(LyXFont const & f);
-
- /// Get the QFont for this LyXFont
- QFont const & get(LyXFont const & f) {
- return fontinfo(f).font;
- }
-
- /// Get the QFont metrics for this LyXFont
- QFontMetrics const & metrics(LyXFont const & f) {
- return fontinfo(f).metrics;
- }
-
- /// Called before QApplication is initialized
- static void initFontPath();
-
- /// Called the first time when available() can't load a symbol font
- static void addToFontPath();
-
- /// Get font info (font + metrics) for the given LyX font.
- QLFontInfo & fontinfo(LyXFont const & f) {
- // fi is a reference to the pointer type (QLFontInfo *) in the
- // fontinfo_ table.
- QLFontInfo * & fi =
-
fontinfo_[f.family()][f.series()][f.realShape()][f.size()];
- if (!fi)
- fi = new QLFontInfo(f);
- return *fi;
- }
-
-private:
- /// BUTT ugly !
- QLFontInfo * fontinfo_[LyXFont::NUM_FAMILIES][2][4][10];
-};
-
-extern FontLoader fontloader;
-
-#endif // QFONT_LOADER_H
Index: qfont_metrics.C
===================================================================
--- qfont_metrics.C (revision 14133)
+++ qfont_metrics.C (working copy)
@@ -14,7 +14,7 @@
#include "frontends/font_metrics.h"
#include "frontends/lyx_gui.h"
-#include "qfont_loader.h"
+#include "FontLoader.h"
#include "language.h"
Index: qfontexample.C
===================================================================
--- qfontexample.C (revision 14133)
+++ qfontexample.C (working copy)
@@ -12,8 +12,7 @@
#include "qfontexample.h"
-#include <qpainter.h>
-//Added by qt3to4:
+#include <QPainter>
#include <QPaintEvent>
void QFontExample::set(QFont const & font, QString const & text)
Index: QLAction.C
===================================================================
--- QLAction.C (revision 14133)
+++ QLAction.C (working copy)
@@ -1,91 +0,0 @@
-/**
- * \file QLAction.C
- * This file is part of LyX, the document processor.
- * Licence details can be found in the file COPYING.
- *
- * \author Abdelrazak Younes
- *
- * Full author contact details are available in file CREDITS.
- */
-
-#include <config.h>
-
-#include "BufferView.h"
-#include "lyx_cb.h"
-#include "lyxfunc.h"
-#include "FuncStatus.h"
-
-#include "debug.h"
-
-#include <boost/bind.hpp>
-
-#include "LyXView.h"
-#include "qt_helpers.h"
-
-#include "QLAction.h"
-
-#include "support/lstrings.h"
-
-using std::string;
-using std::endl;
-
-namespace lyx {
-
-namespace frontend {
-
-namespace {
-
-int const statusbar_timer_value = 3000;
-
-} // namespace anon
-
-QLAction::QLAction(LyXView & lyxView, string const & text,
- FuncRequest const & func, string const & tooltip)
- : QAction(this), lyxView_(lyxView), func_(func)
-{
- setText(tr(toqstr(text)));
- setToolTip(tr(toqstr(tooltip)));
- setStatusTip(toqstr(tooltip));
- connect(this, SIGNAL(triggered()), this, SLOT(action()));
- this->setCheckable(true);
-}
-
-QLAction::QLAction(LyXView & lyxView, string const & icon, string const & text,
- FuncRequest const & func, string const & tooltip)
- : QAction(this), lyxView_(lyxView), func_(func)
-{
- setIcon(QPixmap(icon.c_str()));
- setText(tr(toqstr(text)));
- setToolTip(tr(toqstr(tooltip)));
- setStatusTip(toqstr(tooltip));
- connect(this, SIGNAL(triggered()), this, SLOT(action()));
- this->setCheckable(true);
-}
-
-/*
-void QLAction::setAction(FuncRequest const & func)
-{
- func_=func;
-}
-*/
-
-void QLAction::update()
-{
- FuncStatus const status = lyxView_.getLyXFunc().getStatus(func_);
-
- this->setChecked(status.onoff(true));
- this->setEnabled(status.enabled());
-}
-
-
-void QLAction::action()
-{
-// lyxerr[Debug::ACTION] << "calling LyXFunc::dispatch: func_: " << func_
<< endl;
-
- lyxView_.getLyXFunc().dispatch(func_);
-}
-
-} // namespace frontend
-} // namespace lyx
-
-#include "QLAction_moc.cpp"
Index: QLAction.h
===================================================================
--- QLAction.h (revision 14133)
+++ QLAction.h (working copy)
@@ -1,62 +0,0 @@
-// -*- C++ -*-
-/**
- * \file QLAction.h
- * This file is part of LyX, the document processor.
- * Licence details can be found in the file COPYING.
- *
- * \author Abdelrazak Younes
- *
- * Full author contact details are available in file CREDITS.
- */
-
-#ifndef QLACTION_H
-#define QLACTION_H
-
-// Must be here because of moc.
-#include <config.h>
-
-#include "frontends/LyXView.h"
-#include "funcrequest.h"
-
-#include <QAction>
-
-//class FuncRequest;
-
-//class string;
-
-namespace lyx {
-namespace frontend {
-
-/**
- * QLAction - Qt interface with LyX' FuncRequest.
- *
- * QLAction can be used in LyX menubar and/or toolbars.
- */
-class QLAction: public QAction {
- Q_OBJECT
-public:
-
- QLAction(LyXView & lyxView, std::string const & text,
- FuncRequest const & func, std::string const & tooltip="");
-
- QLAction(LyXView & lyxView, std::string const & icon, std::string const
& text,
- FuncRequest const & func, std::string const & tooltip="");
-
- void update();
-
-// void setAction(FuncRequest const & func);
-
-private slots:
- void action();
-
-private:
- FuncRequest const & func_ ;
- //FuncRequest func_ ;
- LyXView & lyxView_;
-};
-
-
-} // namespace frontend
-} // namespace lyx
-
-#endif // QLACTION_H
Index: QLPainter.C
===================================================================
--- QLPainter.C (revision 14133)
+++ QLPainter.C (working copy)
@@ -16,8 +16,8 @@
#include "QWorkArea.h"
#include "QLImage.h"
-#include "lcolorcache.h"
-#include "qfont_loader.h"
+#include "ColorCache.h"
+#include "FontLoader.h"
#include "debug.h"
#include "language.h"
Index: QLPopupMenu.C
===================================================================
--- QLPopupMenu.C (revision 14133)
+++ QLPopupMenu.C (working copy)
@@ -17,7 +17,7 @@
// All is well if the namespace is visible first.
#include "QtView.h"
-#include "QLAction.h"
+#include "Action.h"
#include "QLPopupMenu.h"
#include "QLMenubar.h"
#include "qt_helpers.h"
@@ -120,7 +120,7 @@
string label = getLabel(*m);
addBinding(label, *m);
- QLAction * action = new QLAction(*(owner_->view()),
label, m->func());
+ Action * action = new Action(*(owner_->view()), label,
m->func());
action->setEnabled(m->status().enabled());
action->setChecked(m->status().onoff(true));
// Actually insert the menu item
Index: QLToolbar.C
===================================================================
--- QLToolbar.C (revision 14133)
+++ QLToolbar.C (working copy)
@@ -26,7 +26,7 @@
#include "QtView.h"
#include "QLToolbar.h"
-#include "QLAction.h"
+#include "Action.h"
#include "qt_helpers.h"
#include "InsertTableWidget.h"
@@ -256,7 +256,7 @@
if (owner_.getLyXFunc().getStatus(func).unknown())
break;
- QLAction * action = new QLAction(owner_,
toolbarbackend.getIcon(func), "", func, tooltip);
+ Action * action = new Action(owner_,
toolbarbackend.getIcon(func), "", func, tooltip);
toolbar_->addAction(action);
ActionVector.push_back(action);
break;
Index: QLToolbar.h
===================================================================
--- QLToolbar.h (revision 14133)
+++ QLToolbar.h (working copy)
@@ -30,7 +30,7 @@
class QLayoutBox;
class QtView;
-class QLAction;
+class Action;
class QLayoutBox : public QObject, public LayoutBox {
@@ -76,7 +76,7 @@
private:
- std::vector<QLAction *> ActionVector;
+ std::vector<Action *> ActionVector;
QtView & owner_;
QToolBar * toolbar_;
Index: QPrefs.C
===================================================================
--- QPrefs.C (revision 14133)
+++ QPrefs.C (working copy)
@@ -13,7 +13,7 @@
#include "QPrefs.h"
#include "QPrefsDialog.h"
-#include "lcolorcache.h"
+#include "ColorCache.h"
#include "Qt2BC.h"
#include "qt_helpers.h"
Index: QPrefsDialog.C
===================================================================
--- QPrefsDialog.C (revision 14133)
+++ QPrefsDialog.C (working copy)
@@ -13,7 +13,7 @@
#include "debug.h"
#include "qt_helpers.h"
-#include "lcolorcache.h"
+#include "ColorCache.h"
#include "Qt2BC.h"
#include "qt_helpers.h"
@@ -40,7 +40,7 @@
#include "gettext.h"
#include "LColor.h"
-#include "lcolorcache.h"
+#include "ColorCache.h"
#include "controllers/ControlPrefs.h"
Index: QtView.C
===================================================================
--- QtView.C (revision 14133)
+++ QtView.C (working copy)
@@ -35,7 +35,7 @@
#include "QtView.h"
#include "QLMenubar.h"
-#include "qfont_loader.h"
+#include "FontLoader.h"
#include "QCommandBuffer.h"
#include "qt_helpers.h"
Index: QWorkArea.C
===================================================================
--- QWorkArea.C (revision 14133)
+++ QWorkArea.C (working copy)
@@ -18,7 +18,7 @@
#include "QLyXKeySym.h"
#include "QtView.h"
-#include "lcolorcache.h"
+#include "ColorCache.h"
#include "qt_helpers.h"
#include "BufferView.h"
#include "debug.h"