mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-07 02:28:35 +00:00
ok, now we use qfontdatabase (thanks Dekel). Things seem good
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5664 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
1199867058
commit
627de563e1
@ -1,3 +1,12 @@
|
||||
2002-11-17 John Levon <levon@movementarian.org>
|
||||
|
||||
* ui/QPrefScreenFontsModule.ui:
|
||||
* QPrefsDialog.h:
|
||||
* QPrefsDialog.C:
|
||||
* QPrefs.C: use font families properly
|
||||
|
||||
* qfont_loader.C: and obey them
|
||||
|
||||
2002-11-17 John Levon <levon@movementarian.org>
|
||||
|
||||
* QPrefsDialog.C: partial fonts fix
|
||||
|
@ -230,9 +230,9 @@ void QPrefs::apply()
|
||||
|
||||
LyXRC const oldrc(rc);
|
||||
|
||||
rc.roman_font_name = fontmod->screenRomanED->text().latin1();
|
||||
rc.sans_font_name = fontmod->screenSansED->text().latin1();
|
||||
rc.typewriter_font_name = fontmod->screenTypewriterED->text().latin1();
|
||||
rc.roman_font_name = fontmod->screenRomanCO->currentText().latin1();
|
||||
rc.sans_font_name = fontmod->screenSansCO->currentText().latin1();
|
||||
rc.typewriter_font_name = fontmod->screenTypewriterCO->currentText().latin1();
|
||||
rc.zoom = fontmod->screenZoomSB->value();
|
||||
rc.dpi = fontmod->screenDpiSB->value();
|
||||
rc.font_sizes[LyXFont::SIZE_TINY] = strToDbl(fontmod->screenTinyED->text().latin1());
|
||||
@ -428,9 +428,31 @@ void QPrefs::update_contents()
|
||||
|
||||
QPrefScreenFontsModule * fontmod(dialog_->screenfontsModule);
|
||||
|
||||
fontmod->screenRomanED->setText(rc.roman_font_name.c_str());
|
||||
fontmod->screenSansED->setText(rc.sans_font_name.c_str());
|
||||
fontmod->screenTypewriterED->setText(rc.typewriter_font_name.c_str());
|
||||
QString roman(rc.roman_font_name.c_str());
|
||||
QString sans(rc.sans_font_name.c_str());
|
||||
QString typewriter(rc.typewriter_font_name.c_str());
|
||||
|
||||
for (int i = 0; i < fontmod->screenRomanCO->count(); ++i) {
|
||||
if (fontmod->screenRomanCO->text(i) == roman) {
|
||||
fontmod->screenRomanCO->setCurrentItem(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < fontmod->screenSansCO->count(); ++i) {
|
||||
if (fontmod->screenSansCO->text(i) == sans) {
|
||||
fontmod->screenSansCO->setCurrentItem(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < fontmod->screenTypewriterCO->count(); ++i) {
|
||||
if (fontmod->screenTypewriterCO->text(i) == typewriter) {
|
||||
fontmod->screenTypewriterCO->setCurrentItem(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
fontmod->screenZoomSB->setValue(rc.zoom);
|
||||
fontmod->screenDpiSB->setValue(int(rc.dpi));
|
||||
fontmod->screenTinyED->setText(tostr(rc.font_sizes[LyXFont::SIZE_TINY]).c_str());
|
||||
|
@ -47,7 +47,8 @@
|
||||
#include <qlineedit.h>
|
||||
#include <qcheckbox.h>
|
||||
#include <qcombobox.h>
|
||||
#include <qfontdialog.h>
|
||||
#include <qfontdatabase.h>
|
||||
#include <qstringlist.h>
|
||||
#include <qcolordialog.h>
|
||||
#include <qcolor.h>
|
||||
#include "qcoloritem.h"
|
||||
@ -179,6 +180,15 @@ QPrefsDialog::QPrefsDialog(QPrefs * form)
|
||||
colorsModule->lyxObjectsLB->insertItem(ci);
|
||||
}
|
||||
|
||||
QFontDatabase fontdb;
|
||||
QStringList families(fontdb.families());
|
||||
|
||||
for (QStringList::Iterator it = families.begin(); it != families.end(); ++it) {
|
||||
screenfontsModule->screenRomanCO->insertItem(*it);
|
||||
screenfontsModule->screenSansCO->insertItem(*it);
|
||||
screenfontsModule->screenTypewriterCO->insertItem(*it);
|
||||
}
|
||||
|
||||
connect(uiModule->uiFilePB, SIGNAL(clicked()), this, SLOT(select_ui()));
|
||||
connect(uiModule->bindFilePB, SIGNAL(clicked()), this, SLOT(select_bind()));
|
||||
|
||||
@ -193,10 +203,6 @@ QPrefsDialog::QPrefsDialog(QPrefs * form)
|
||||
connect(pathsModule->workingDirPB, SIGNAL(clicked()), this, SLOT(select_workingdir()));
|
||||
connect(pathsModule->lyxserverDirPB, SIGNAL(clicked()), this, SLOT(select_lyxpipe()));
|
||||
|
||||
connect(screenfontsModule->screenRomanPB, SIGNAL(clicked()), this, SLOT(change_roman()));
|
||||
connect(screenfontsModule->screenSansPB, SIGNAL(clicked()), this, SLOT(change_sans()));
|
||||
connect(screenfontsModule->screenTypewriterPB, SIGNAL(clicked()), this, SLOT(change_typewriter()));
|
||||
|
||||
connect(colorsModule->colorChangePB, SIGNAL(clicked()), this, SLOT(change_color()));
|
||||
connect(colorsModule->lyxObjectsLB, SIGNAL(selected(int)), this, SLOT(change_color()));
|
||||
|
||||
@ -279,9 +285,9 @@ QPrefsDialog::QPrefsDialog(QPrefs * form)
|
||||
connect(printerModule->printerExtraED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
|
||||
connect(printerModule->printerSpoolPrefixED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
|
||||
connect(printerModule->printerPaperSizeED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
|
||||
connect(screenfontsModule->screenRomanED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
|
||||
connect(screenfontsModule->screenSansED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
|
||||
connect(screenfontsModule->screenTypewriterED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
|
||||
connect(screenfontsModule->screenRomanCO, SIGNAL(activated(const QString&)), this, SLOT(change_adaptor()));
|
||||
connect(screenfontsModule->screenSansCO, SIGNAL(activated(const QString&)), this, SLOT(change_adaptor()));
|
||||
connect(screenfontsModule->screenTypewriterCO, SIGNAL(activated(const QString&)), this, SLOT(change_adaptor()));
|
||||
connect(screenfontsModule->screenZoomSB, SIGNAL(valueChanged(int)), this, SLOT(change_adaptor()));
|
||||
connect(screenfontsModule->screenDpiSB, SIGNAL(valueChanged(int)), this, SLOT(change_adaptor()));
|
||||
connect(screenfontsModule->screenTinyED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
|
||||
@ -566,62 +572,3 @@ void QPrefsDialog::select_lyxpipe()
|
||||
if (!file.empty())
|
||||
pathsModule->lyxserverDirED->setText(file.c_str());
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
QFont fontFromString(QString const & s) {
|
||||
QFont f;
|
||||
#if QT_VERSION >= 300
|
||||
f.fromString(s);
|
||||
return f;
|
||||
#else
|
||||
f.setRawName(s);
|
||||
return f;
|
||||
#endif
|
||||
}
|
||||
|
||||
QString const fontToString(QFont const & f) {
|
||||
#if QT_VERSION >= 300
|
||||
return f.toString();
|
||||
#else
|
||||
return f.rawName();
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void QPrefsDialog::change_roman()
|
||||
{
|
||||
QFont f(fontFromString(screenfontsModule->screenRomanED->text()));
|
||||
|
||||
// Qt designers hadn't heard of references
|
||||
bool ok;
|
||||
f = QFontDialog::getFont(&ok, f);
|
||||
if (ok)
|
||||
screenfontsModule->screenRomanED->setText(fontToString(f));
|
||||
}
|
||||
|
||||
|
||||
void QPrefsDialog::change_sans()
|
||||
{
|
||||
QFont f(fontFromString(screenfontsModule->screenSansED->text()));
|
||||
|
||||
// Qt designers hadn't heard of references
|
||||
bool ok;
|
||||
f = QFontDialog::getFont(&ok, f);
|
||||
if (ok)
|
||||
screenfontsModule->screenSansED->setText(fontToString(f));
|
||||
}
|
||||
|
||||
|
||||
void QPrefsDialog::change_typewriter()
|
||||
{
|
||||
QFont f(fontFromString(screenfontsModule->screenTypewriterED->text()));
|
||||
|
||||
// Qt designers hadn't heard of references
|
||||
bool ok;
|
||||
f = QFontDialog::getFont(&ok, f);
|
||||
if (ok)
|
||||
screenfontsModule->screenTypewriterED->setText(fontToString(f));
|
||||
}
|
||||
|
@ -70,10 +70,6 @@ public slots:
|
||||
|
||||
void change_color();
|
||||
|
||||
void change_roman();
|
||||
void change_sans();
|
||||
void change_typewriter();
|
||||
|
||||
void select_ui();
|
||||
void select_bind();
|
||||
void select_keymap1();
|
||||
|
@ -176,13 +176,13 @@ qfont_loader::font_info::font_info(LyXFont const & f)
|
||||
} else
|
||||
switch (f.family()) {
|
||||
case LyXFont::ROMAN_FAMILY:
|
||||
font.setFamily("times");
|
||||
font.setFamily(lyxrc.roman_font_name.c_str());
|
||||
break;
|
||||
case LyXFont::SANS_FAMILY:
|
||||
font.setFamily("helvetica");
|
||||
font.setFamily(lyxrc.sans_font_name.c_str());
|
||||
break;
|
||||
case LyXFont::TYPEWRITER_FAMILY:
|
||||
font.setFamily("courier");
|
||||
font.setFamily(lyxrc.typewriter_font_name.c_str());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -191,8 +191,6 @@ qfont_loader::font_info::font_info(LyXFont const & f)
|
||||
font.setPointSizeFloat(lyxrc.font_sizes[f.size()]
|
||||
* lyxrc.zoom / 100.0);
|
||||
|
||||
// FIXME: lyxrc, check for failure etc.
|
||||
|
||||
switch (f.series()) {
|
||||
case LyXFont::MEDIUM_SERIES:
|
||||
font.setWeight(QFont::Normal);
|
||||
|
@ -13,8 +13,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>203</width>
|
||||
<height>360</height>
|
||||
<width>270</width>
|
||||
<height>358</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
@ -34,9 +34,9 @@
|
||||
<class>QLayoutWidget</class>
|
||||
<property stdset="1">
|
||||
<name>name</name>
|
||||
<cstring>Layout17</cstring>
|
||||
<cstring>Layout4</cstring>
|
||||
</property>
|
||||
<grid>
|
||||
<hbox>
|
||||
<property stdset="1">
|
||||
<name>margin</name>
|
||||
<number>0</number>
|
||||
@ -45,106 +45,123 @@
|
||||
<name>spacing</name>
|
||||
<number>6</number>
|
||||
</property>
|
||||
<widget row="1" column="2" >
|
||||
<class>QPushButton</class>
|
||||
<widget>
|
||||
<class>QLayoutWidget</class>
|
||||
<property stdset="1">
|
||||
<name>name</name>
|
||||
<cstring>screenSansPB</cstring>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>text</name>
|
||||
<string>C&hoose...</string>
|
||||
<cstring>Layout4</cstring>
|
||||
</property>
|
||||
<grid>
|
||||
<property stdset="1">
|
||||
<name>margin</name>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>spacing</name>
|
||||
<number>6</number>
|
||||
</property>
|
||||
<widget row="0" column="1" >
|
||||
<class>QComboBox</class>
|
||||
<property stdset="1">
|
||||
<name>name</name>
|
||||
<cstring>screenRomanCO</cstring>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>duplicatesEnabled</name>
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget row="2" column="0" >
|
||||
<class>QLabel</class>
|
||||
<property stdset="1">
|
||||
<name>name</name>
|
||||
<cstring>screenSansLA</cstring>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>text</name>
|
||||
<string>Sa&ns Serif :</string>
|
||||
</property>
|
||||
<property>
|
||||
<name>buddy</name>
|
||||
<cstring>screenSansCO</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
<widget row="0" column="0" rowspan="2" colspan="1" >
|
||||
<class>QLabel</class>
|
||||
<property stdset="1">
|
||||
<name>name</name>
|
||||
<cstring>screenRomanLA</cstring>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>text</name>
|
||||
<string>&Roman :</string>
|
||||
</property>
|
||||
<property>
|
||||
<name>buddy</name>
|
||||
<cstring>screenRomanCO</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
<widget row="3" column="1" >
|
||||
<class>QComboBox</class>
|
||||
<property stdset="1">
|
||||
<name>name</name>
|
||||
<cstring>screenTypewriterCO</cstring>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>duplicatesEnabled</name>
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget row="1" column="1" rowspan="2" colspan="1" >
|
||||
<class>QComboBox</class>
|
||||
<property stdset="1">
|
||||
<name>name</name>
|
||||
<cstring>screenSansCO</cstring>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>duplicatesEnabled</name>
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget row="3" column="0" >
|
||||
<class>QLabel</class>
|
||||
<property stdset="1">
|
||||
<name>name</name>
|
||||
<cstring>screenTypewriterLA</cstring>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>text</name>
|
||||
<string>T&ypewriter :</string>
|
||||
</property>
|
||||
<property>
|
||||
<name>buddy</name>
|
||||
<cstring>screenTypewriterCO</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</grid>
|
||||
</widget>
|
||||
<widget row="2" column="1" >
|
||||
<class>QLineEdit</class>
|
||||
<property stdset="1">
|
||||
<spacer>
|
||||
<property>
|
||||
<name>name</name>
|
||||
<cstring>screenTypewriterED</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
<widget row="1" column="1" >
|
||||
<class>QLineEdit</class>
|
||||
<property stdset="1">
|
||||
<name>name</name>
|
||||
<cstring>screenSansED</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
<widget row="0" column="2" >
|
||||
<class>QPushButton</class>
|
||||
<property stdset="1">
|
||||
<name>name</name>
|
||||
<cstring>screenRomanPB</cstring>
|
||||
<cstring>Spacer3</cstring>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>text</name>
|
||||
<string>Ch&oose...</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget row="0" column="0" >
|
||||
<class>QLabel</class>
|
||||
<property stdset="1">
|
||||
<name>name</name>
|
||||
<cstring>screenRomanLA</cstring>
|
||||
<name>orientation</name>
|
||||
<enum>Horizontal</enum>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>text</name>
|
||||
<string>&Roman:</string>
|
||||
<name>sizeType</name>
|
||||
<enum>Expanding</enum>
|
||||
</property>
|
||||
<property>
|
||||
<name>buddy</name>
|
||||
<cstring>screenRomanED</cstring>
|
||||
<name>sizeHint</name>
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
<widget row="0" column="1" >
|
||||
<class>QLineEdit</class>
|
||||
<property stdset="1">
|
||||
<name>name</name>
|
||||
<cstring>screenRomanED</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
<widget row="2" column="0" >
|
||||
<class>QLabel</class>
|
||||
<property stdset="1">
|
||||
<name>name</name>
|
||||
<cstring>screenTypewriterLA</cstring>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>text</name>
|
||||
<string>T&ypewriter:</string>
|
||||
</property>
|
||||
<property>
|
||||
<name>buddy</name>
|
||||
<cstring>screenTypewriterED</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
<widget row="1" column="0" >
|
||||
<class>QLabel</class>
|
||||
<property stdset="1">
|
||||
<name>name</name>
|
||||
<cstring>screenSansLA</cstring>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>text</name>
|
||||
<string>Sa&ns Serif:</string>
|
||||
</property>
|
||||
<property>
|
||||
<name>buddy</name>
|
||||
<cstring>screenSansED</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
<widget row="2" column="2" >
|
||||
<class>QPushButton</class>
|
||||
<property stdset="1">
|
||||
<name>name</name>
|
||||
<cstring>screenTypewriterPB</cstring>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>text</name>
|
||||
<string>Choos&e...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</grid>
|
||||
</spacer>
|
||||
</hbox>
|
||||
</widget>
|
||||
<widget>
|
||||
<class>QLayoutWidget</class>
|
||||
@ -518,12 +535,6 @@
|
||||
</vbox>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>screenRomanED</tabstop>
|
||||
<tabstop>screenRomanPB</tabstop>
|
||||
<tabstop>screenSansED</tabstop>
|
||||
<tabstop>screenSansPB</tabstop>
|
||||
<tabstop>screenTypewriterED</tabstop>
|
||||
<tabstop>screenTypewriterPB</tabstop>
|
||||
<tabstop>screenZoomSB</tabstop>
|
||||
<tabstop>screenDpiSB</tabstop>
|
||||
<tabstop>screenTinyED</tabstop>
|
||||
|
Loading…
Reference in New Issue
Block a user