Hello,

As the title says, this patch delete a bit more code from lyx_gui.[Ch]. This is going in now.

There's two remaining functions in frontends/lyx_gui.C:

/**
 * set up GUI parameters. At this point lyxrc may
 * be used.
 */
void parse_lyxrc();


This is not used nor implemented so I think I will just delete the method if there's no objection.


/**
 * return the status flag for a given action. This can be used to tell
 * that a given lfun is not implemented by a frontend
 */
FuncStatus getStatus(FuncRequest const & ev);

This one was supposed to be different for each frontend but none of the existing one made use of it. Right now the code is:

        FuncStatus flag;
        switch (ev.action) {
        case LFUN_TOOLTIPS_TOGGLE:
                flag.unknown(true);
                break;
        default:
                break;
        }

        return flag;


And it used only once in "src/lyxfunc.C(371)":

FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
        ...
        flag |= lyx_gui::getStatus(cmd);

So I am tempted to deleted the method and transfer the code there...
or, if there is an objection to transfer it to Application as a pure virtual method.

Opinion?

Abdel.
Index: frontends/lyx_gui.C
===================================================================
--- frontends/lyx_gui.C (revision 15211)
+++ frontends/lyx_gui.C (working copy)
@@ -45,30 +45,4 @@
 }
 
 
-string const roman_font_name()
-{
-       if (!use_gui)
-               return "serif";
-
-       return theApp->romanFontName();
-}
-
-
-string const sans_font_name()
-{
-       if (!use_gui)
-               return "sans";
-
-       return theApp->sansFontName();
-}
-
-
-string const typewriter_font_name()
-{
-       if (!use_gui)
-               return "monospace";
-
-       return theApp->typewriterFontName();
-}
-
 }; // namespace lyx_gui
Index: frontends/lyx_gui.h
===================================================================
--- frontends/lyx_gui.h (revision 15211)
+++ frontends/lyx_gui.h (working copy)
@@ -36,15 +36,6 @@
 /// are we using the GUI at all
 extern bool use_gui;
 
-/// return a suitable serif font name (called from non-gui context too !)
-std::string const roman_font_name();
-
-/// return a suitable sans serif font name (called from non-gui context too !)
-std::string const sans_font_name();
-
-/// return a suitable monospaced font name (called from non-gui context too !)
-std::string const typewriter_font_name();
-
 /**
  * set up GUI parameters. At this point lyxrc may
  * be used.
Index: frontends/qt3/QPrefs.C
===================================================================
--- frontends/qt3/QPrefs.C      (revision 15206)
+++ frontends/qt3/QPrefs.C      (working copy)
@@ -439,13 +439,13 @@
 
        QFont font;
 
-       if (family == lyx_gui::roman_font_name()) {
+       if (family == theApp->romanFontName()) {
                font.setStyleHint(QFont::Serif);
                font.setFamily(family.c_str());
-       } else if (family == lyx_gui::sans_font_name()) {
+       } else if (family == theApp->sansFontName()) {
                font.setStyleHint(QFont::SansSerif);
                font.setFamily(family.c_str());
-       } else if (family == lyx_gui::typewriter_font_name()) {
+       } else if (family == theApp->typewriterFontName()) {
                font.setStyleHint(QFont::TypeWriter);
                font.setFamily(family.c_str());
        } else {
Index: frontends/qt3/QViewSource.C
===================================================================
--- frontends/qt3/QViewSource.C (revision 15206)
+++ frontends/qt3/QViewSource.C (working copy)
@@ -40,7 +40,7 @@
        dialog_->viewSourceTV->setReadOnly(true);
        dialog_->viewSourceTV->setTextFormat(Qt::PlainText);
        // this is personal. I think source code should be in fixed-size font
-       QFont font(toqstr(lyx_gui::typewriter_font_name()));
+       QFont font(toqstr(theApp->typewriterFontName()));
        font.setFixedPitch(true);
        font.setStyleHint(QFont::TypeWriter);
        dialog_->viewSourceTV->setFont(font);
Index: frontends/qt4/QPrefsDialog.C
===================================================================
--- frontends/qt4/QPrefsDialog.C        (revision 15206)
+++ frontends/qt4/QPrefsDialog.C        (working copy)
@@ -130,13 +130,13 @@
 
        QFont font;
 
-       if (family == lyx_gui::roman_font_name()) {
+       if (family == theApp->romanFontName()) {
                font.setStyleHint(QFont::Serif);
                font.setFamily(family.c_str());
-       } else if (family == lyx_gui::sans_font_name()) {
+       } else if (family == theApp->sansFontName()) {
                font.setStyleHint(QFont::SansSerif);
                font.setFamily(family.c_str());
-       } else if (family == lyx_gui::typewriter_font_name()) {
+       } else if (family == theApp->typewriterFontName()) {
                font.setStyleHint(QFont::TypeWriter);
                font.setFamily(family.c_str());
        } else {
Index: frontends/qt4/QViewSource.C
===================================================================
--- frontends/qt4/QViewSource.C (revision 15206)
+++ frontends/qt4/QViewSource.C (working copy)
@@ -14,8 +14,9 @@
 #include "QViewSource.h"
 #include "QViewSourceDialog.h"
 #include "qt_helpers.h"
-#include "lyx_gui.h"
 
+#include "frontends/Application.h"
+
 #include "controllers/ControlViewSource.h"
 
 #include <sstream>
@@ -90,7 +91,7 @@
        dialog_->viewSourceTV->setReadOnly(true);
        ///dialog_->viewSourceTV->setAcceptRichText(false);
        // this is personal. I think source code should be in fixed-size font
-       QFont font(toqstr(lyx_gui::typewriter_font_name()));
+       QFont font(toqstr(theApp->typewriterFontName()));
        font.setFixedPitch(true);
        font.setStyleHint(QFont::TypeWriter);
        dialog_->viewSourceTV->setFont(font);
Index: lyx_main.C
===================================================================
--- lyx_main.C  (revision 15211)
+++ lyx_main.C  (working copy)
@@ -499,11 +499,16 @@
        }
 
        if (lyxrc.roman_font_name.empty())
-               lyxrc.roman_font_name = lyx_gui::roman_font_name();
+               lyxrc.roman_font_name = 
+                       lyx_gui::use_gui? theApp->romanFontName(): "serif";
+
        if (lyxrc.sans_font_name.empty())
-               lyxrc.sans_font_name = lyx_gui::sans_font_name();
+               lyxrc.sans_font_name =
+                       lyx_gui::use_gui? theApp->sansFontName(): "sans";
+
        if (lyxrc.typewriter_font_name.empty())
-               lyxrc.typewriter_font_name = lyx_gui::typewriter_font_name();
+               lyxrc.typewriter_font_name =
+                       lyx_gui::use_gui? theApp->typewriterFontName(): 
"monospace";
 
        //
        // Read configuration files

Reply via email to