+2005-01-05 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
+
+ * lyxrc.[Ch]: store all float values as strings.
+ use int (not float) for lyxrc.dpi.
+
2005-01-04 Angus Leeming <leeming@lyx.org>
* lyx_cb.C (Reconfigure):
bool finished = false;
/// estimate DPI from X server
-float getDPI()
+int getDPI()
{
Screen * scr = ScreenOfDisplay(fl_get_display(), fl_screen);
- return ((HeightOfScreen(scr) * 25.4 / HeightMMOfScreen(scr)) +
- (WidthOfScreen(scr) * 25.4 / WidthMMOfScreen(scr))) / 2;
+ return int(((HeightOfScreen(scr) * 25.4 / HeightMMOfScreen(scr)) +
+ (WidthOfScreen(scr) * 25.4 / WidthMMOfScreen(scr))) / 2);
}
-2005-04-01 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
+2005-01-04 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
+
+ * xftFontLoader.C: lyxrc.font_sizes is a string now.
+
+2005-01-04 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
* GGraphics.C: more precise checks for the value strings.
/// estimate DPI from X server
-float getDPI()
+int getDPI()
{
Screen * scr = ScreenOfDisplay(getDisplay(), getScreen());
- return ((HeightOfScreen(scr) * 25.4 / HeightMMOfScreen(scr)) +
- (WidthOfScreen(scr) * 25.4 / WidthMMOfScreen(scr))) / 2;
+ return int(((HeightOfScreen(scr) * 25.4 / HeightMMOfScreen(scr)) +
+ (WidthOfScreen(scr) * 25.4 / WidthMMOfScreen(scr))) / 2);
}
#include "frontends/LyXView.h"
#include "frontends/lyx_gui.h"
+#include "support/lstrings.h"
#include "support/systemcall.h"
#include "support/filetools.h"
#include <cmath> // fabs()
#include <vector>
+using lyx::support::strToDbl;
using std::endl;
using std::string;
string ffamily;
int fweight;
int fslant;
- double fsize = lyxrc.font_sizes[size] * lyxrc.zoom / 100.0;
+ double fsize = strToDbl(lyxrc.font_sizes[size]) * lyxrc.zoom / 100.0;
XftPattern *fpat = XftPatternCreate();
ffamily = familyString(family);
+2005-01-05 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
+
+ * QPrefs.C: store all float/double values as strings.
+ lyxrc.dpi is an int value now.
+
+ * QFontLoader.C: lyxrc.font_sizes is a string now.
+
2005-01-05 Lars Gullik Bjonnes <larsbj@gullik.net>
* ui/Makefile.am (libqt2ui_la_LINK): Improve the trick to avoid
#include "lyxfont.h"
#include "support/lstrings.h"
-#include "support/tostr.h"
#include "controllers/ControlPrefs.h"
#include "controllers/frnt_lang.h"
rc.zoom = fontmod->screenZoomSB->value();
rc.dpi = fontmod->screenDpiSB->value();
- rc.font_sizes[LyXFont::SIZE_TINY] = strToDbl(fromqstr(fontmod->screenTinyED->text()));
- rc.font_sizes[LyXFont::SIZE_SCRIPT] = strToDbl(fromqstr(fontmod->screenSmallestED->text()));
- rc.font_sizes[LyXFont::SIZE_FOOTNOTE] = strToDbl(fromqstr(fontmod->screenSmallerED->text()));
- rc.font_sizes[LyXFont::SIZE_SMALL] = strToDbl(fromqstr(fontmod->screenSmallED->text()));
- rc.font_sizes[LyXFont::SIZE_NORMAL] = strToDbl(fromqstr(fontmod->screenNormalED->text()));
- rc.font_sizes[LyXFont::SIZE_LARGE] = strToDbl(fromqstr(fontmod->screenLargeED->text()));
- rc.font_sizes[LyXFont::SIZE_LARGER] = strToDbl(fromqstr(fontmod->screenLargerED->text()));
- rc.font_sizes[LyXFont::SIZE_LARGEST] = strToDbl(fromqstr(fontmod->screenLargestED->text()));
- rc.font_sizes[LyXFont::SIZE_HUGE] = strToDbl(fromqstr(fontmod->screenHugeED->text()));
- rc.font_sizes[LyXFont::SIZE_HUGER] = strToDbl(fromqstr(fontmod->screenHugerED->text()));
+ rc.font_sizes[LyXFont::SIZE_TINY] = fromqstr(fontmod->screenTinyED->text());
+ rc.font_sizes[LyXFont::SIZE_SCRIPT] = fromqstr(fontmod->screenSmallestED->text());
+ rc.font_sizes[LyXFont::SIZE_FOOTNOTE] = fromqstr(fontmod->screenSmallerED->text());
+ rc.font_sizes[LyXFont::SIZE_SMALL] = fromqstr(fontmod->screenSmallED->text());
+ rc.font_sizes[LyXFont::SIZE_NORMAL] = fromqstr(fontmod->screenNormalED->text());
+ rc.font_sizes[LyXFont::SIZE_LARGE] = fromqstr(fontmod->screenLargeED->text());
+ rc.font_sizes[LyXFont::SIZE_LARGER] = fromqstr(fontmod->screenLargerED->text());
+ rc.font_sizes[LyXFont::SIZE_LARGEST] = fromqstr(fontmod->screenLargestED->text());
+ rc.font_sizes[LyXFont::SIZE_HUGE] = fromqstr(fontmod->screenHugeED->text());
+ rc.font_sizes[LyXFont::SIZE_HUGER] = fromqstr(fontmod->screenHugerED->text());
if (rc.font_sizes != oldrc.font_sizes
|| rc.roman_font_name != oldrc.roman_font_name
dialog_->select_typewriter(fontmod->screenTypewriterCO->currentText());
fontmod->screenZoomSB->setValue(rc.zoom);
- fontmod->screenDpiSB->setValue(int(rc.dpi));
- fontmod->screenTinyED->setText(toqstr(tostr(rc.font_sizes[LyXFont::SIZE_TINY])));
- fontmod->screenSmallestED->setText(toqstr(tostr(rc.font_sizes[LyXFont::SIZE_SCRIPT])));
- fontmod->screenSmallerED->setText(toqstr(tostr(rc.font_sizes[LyXFont::SIZE_FOOTNOTE])));
- fontmod->screenSmallED->setText(toqstr(tostr(rc.font_sizes[LyXFont::SIZE_SMALL])));
- fontmod->screenNormalED->setText(toqstr(tostr(rc.font_sizes[LyXFont::SIZE_NORMAL])));
- fontmod->screenLargeED->setText(toqstr(tostr(rc.font_sizes[LyXFont::SIZE_LARGE])));
- fontmod->screenLargerED->setText(toqstr(tostr(rc.font_sizes[LyXFont::SIZE_LARGER])));
- fontmod->screenLargestED->setText(toqstr(tostr(rc.font_sizes[LyXFont::SIZE_LARGEST])));
- fontmod->screenHugeED->setText(toqstr(tostr(rc.font_sizes[LyXFont::SIZE_HUGE])));
- fontmod->screenHugerED->setText(toqstr(tostr(rc.font_sizes[LyXFont::SIZE_HUGER])));
+ fontmod->screenDpiSB->setValue(rc.dpi);
+ fontmod->screenTinyED->setText(toqstr(rc.font_sizes[LyXFont::SIZE_TINY]));
+ fontmod->screenSmallestED->setText(toqstr(rc.font_sizes[LyXFont::SIZE_SCRIPT]));
+ fontmod->screenSmallerED->setText(toqstr(rc.font_sizes[LyXFont::SIZE_FOOTNOTE]));
+ fontmod->screenSmallED->setText(toqstr(rc.font_sizes[LyXFont::SIZE_SMALL]));
+ fontmod->screenNormalED->setText(toqstr(rc.font_sizes[LyXFont::SIZE_NORMAL]));
+ fontmod->screenLargeED->setText(toqstr(rc.font_sizes[LyXFont::SIZE_LARGE]));
+ fontmod->screenLargerED->setText(toqstr(rc.font_sizes[LyXFont::SIZE_LARGER]));
+ fontmod->screenLargestED->setText(toqstr(rc.font_sizes[LyXFont::SIZE_LARGEST]));
+ fontmod->screenHugeED->setText(toqstr(rc.font_sizes[LyXFont::SIZE_HUGE]));
+ fontmod->screenHugerED->setText(toqstr(rc.font_sizes[LyXFont::SIZE_HUGER]));
dialog_->updateFormats();
dialog_->updateConverters();
namespace {
-float getDPI()
+int getDPI()
{
QWidget w;
QPaintDeviceMetrics pdm(&w);
- return 0.5 * (pdm.logicalDpiX() + pdm.logicalDpiY());
+ return int(0.5 * (pdm.logicalDpiX() + pdm.logicalDpiY()));
}
map<int, shared_ptr<socket_callback> > socket_callbacks;
using lyx::support::OnlyPath;
using lyx::support::QuoteName;
using lyx::support::Systemcall;
+using lyx::support::strToDbl;
using std::endl;
using std::make_pair;
}
}
- font.setPointSizeFloat(lyxrc.font_sizes[f.size()]
+ font.setPointSizeFloat(strToDbl(lyxrc.font_sizes[f.size()])
* lyxrc.zoom / 100.0);
switch (f.series()) {
+2005-01-05 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
+
+ * FormPreferences.C: store all float/double values as strings.
+ lyxrc.dpi is an int value now.
+
+ * xfont_loader.C: lyxrc.font_sizes is a string now.
+
2005-01-04 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
* FormExternal.C: store all float/double values as strings.
#include "lyxfont.h"
#include "support/lstrings.h"
-#include "support/tostr.h"
#include "support/path_defines.h"
#include "support/filetools.h"
rc.dpi = ivalue;
}
- double dvalue = strToDbl(fl_get_input(dialog_->input_tiny));
+ string dvalue = fl_get_input(dialog_->input_tiny);
if (rc.font_sizes[LyXFont::SIZE_TINY] != dvalue) {
changed = true;
rc.font_sizes[LyXFont::SIZE_TINY] = dvalue;
}
- dvalue = strToDbl(fl_get_input(dialog_->input_script));
+ dvalue = fl_get_input(dialog_->input_script);
if (rc.font_sizes[LyXFont::SIZE_SCRIPT] != dvalue) {
changed = true;
rc.font_sizes[LyXFont::SIZE_SCRIPT] = dvalue;
}
- dvalue = strToDbl(fl_get_input(dialog_->input_footnote));
+ dvalue = fl_get_input(dialog_->input_footnote);
if (rc.font_sizes[LyXFont::SIZE_FOOTNOTE] != dvalue) {
changed = true;
rc.font_sizes[LyXFont::SIZE_FOOTNOTE] = dvalue;
}
- dvalue = strToDbl(fl_get_input(dialog_->input_small));
+ dvalue = fl_get_input(dialog_->input_small);
if (rc.font_sizes[LyXFont::SIZE_SMALL] != dvalue) {
changed = true;
rc.font_sizes[LyXFont::SIZE_SMALL] = dvalue;
}
- dvalue = strToDbl(fl_get_input(dialog_->input_normal));
+ dvalue = fl_get_input(dialog_->input_normal);
if (rc.font_sizes[LyXFont::SIZE_NORMAL] != dvalue) {
changed = true;
rc.font_sizes[LyXFont::SIZE_NORMAL] = dvalue;
}
- dvalue = strToDbl(fl_get_input(dialog_->input_large));
+ dvalue = fl_get_input(dialog_->input_large);
if (rc.font_sizes[LyXFont::SIZE_LARGE] != dvalue) {
changed = true;
rc.font_sizes[LyXFont::SIZE_LARGE] = dvalue;
}
- dvalue = strToDbl(fl_get_input(dialog_->input_larger));
+ dvalue = fl_get_input(dialog_->input_larger);
if (rc.font_sizes[LyXFont::SIZE_LARGER] != dvalue) {
changed = true;
rc.font_sizes[LyXFont::SIZE_LARGER] = dvalue;
}
- dvalue = strToDbl(fl_get_input(dialog_->input_largest));
+ dvalue = fl_get_input(dialog_->input_largest);
if (rc.font_sizes[LyXFont::SIZE_LARGEST] != dvalue) {
changed = true;
rc.font_sizes[LyXFont::SIZE_LARGEST] = dvalue;
}
- dvalue = strToDbl(fl_get_input(dialog_->input_huge));
+ dvalue = fl_get_input(dialog_->input_huge);
if (rc.font_sizes[LyXFont::SIZE_HUGE] != dvalue) {
changed = true;
rc.font_sizes[LyXFont::SIZE_HUGE] = dvalue;
}
- dvalue = strToDbl(fl_get_input(dialog_->input_huger));
+ dvalue = fl_get_input(dialog_->input_huger);
if (rc.font_sizes[LyXFont::SIZE_HUGER] != dvalue) {
changed = true;
rc.font_sizes[LyXFont::SIZE_HUGER] = dvalue;
fl_set_counter_value(dialog_->counter_zoom, rc.zoom);
fl_set_counter_value(dialog_->counter_dpi, rc.dpi);
fl_set_input(dialog_->input_tiny,
- tostr(rc.font_sizes[LyXFont::SIZE_TINY]).c_str());
+ rc.font_sizes[LyXFont::SIZE_TINY].c_str());
fl_set_input(dialog_->input_script,
- tostr(rc.font_sizes[LyXFont::SIZE_SCRIPT]).c_str());
+ rc.font_sizes[LyXFont::SIZE_SCRIPT].c_str());
fl_set_input(dialog_->input_footnote,
- tostr(rc.font_sizes[LyXFont::SIZE_FOOTNOTE]).c_str());
+ rc.font_sizes[LyXFont::SIZE_FOOTNOTE].c_str());
fl_set_input(dialog_->input_small,
- tostr(rc.font_sizes[LyXFont::SIZE_SMALL]).c_str());
+ rc.font_sizes[LyXFont::SIZE_SMALL].c_str());
fl_set_input(dialog_->input_normal,
- tostr(rc.font_sizes[LyXFont::SIZE_NORMAL]).c_str());
+ rc.font_sizes[LyXFont::SIZE_NORMAL].c_str());
fl_set_input(dialog_->input_large,
- tostr(rc.font_sizes[LyXFont::SIZE_LARGE]).c_str());
+ rc.font_sizes[LyXFont::SIZE_LARGE].c_str());
fl_set_input(dialog_->input_larger,
- tostr(rc.font_sizes[LyXFont::SIZE_LARGER]).c_str());
+ rc.font_sizes[LyXFont::SIZE_LARGER].c_str());
fl_set_input(dialog_->input_largest,
- tostr(rc.font_sizes[LyXFont::SIZE_LARGEST]).c_str());
+ rc.font_sizes[LyXFont::SIZE_LARGEST].c_str());
fl_set_input(dialog_->input_huge,
- tostr(rc.font_sizes[LyXFont::SIZE_HUGE]).c_str());
+ rc.font_sizes[LyXFont::SIZE_HUGE].c_str());
fl_set_input(dialog_->input_huger,
- tostr(rc.font_sizes[LyXFont::SIZE_HUGER]).c_str());
+ rc.font_sizes[LyXFont::SIZE_HUGER].c_str());
}
bool finished = false;
/// estimate DPI from X server
-float getDPI()
+int getDPI()
{
Screen * scr = ScreenOfDisplay(fl_get_display(), fl_screen);
- return ((HeightOfScreen(scr) * 25.4 / HeightMMOfScreen(scr)) +
- (WidthOfScreen(scr) * 25.4 / WidthMMOfScreen(scr))) / 2;
+ return int(((HeightOfScreen(scr) * 25.4 / HeightMMOfScreen(scr)) +
+ (WidthOfScreen(scr) * 25.4 / WidthMMOfScreen(scr))) / 2);
}
#include "frontends/lyx_gui.h"
#include "support/filetools.h"
+#include "support/lstrings.h"
#include "support/systemcall.h"
#include "lyx_forms.h"
namespace lyx {
using support::LibFileSearch;
+using support::strToDbl;
using support::OnlyPath;
using support::Systemcall;
getFontinfo(family, series, shape);
// FIXME! CHECK! Should we use 72.0 or 72.27? (Lgb)
- int fsize = int((lyxrc.font_sizes[size] * lyxrc.dpi *
+ int fsize = int((strToDbl(lyxrc.font_sizes[size]) * lyxrc.dpi *
(lyxrc.zoom/100.0)) / 72.27 + 0.5);
string font = fontinfo[family][series][shape]->getFontname(fsize);
+2005-01-04 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
+
+ * PreviewLoader.C: lyxrc.preview_scale_factor is a string now.
+
2004-11-25 Lars Gullik Bjonnes <larsbj@gullik.net>
* rename a lot of InsetOld to InsetBase
: parent_(p), buffer_(b), font_scaling_factor_(0.0)
{
font_scaling_factor_ = 0.01 * lyxrc.dpi * lyxrc.zoom *
- lyxrc.preview_scale_factor;
+ support::strToDbl(lyxrc.preview_scale_factor);
lyxerr[Debug::GRAPHICS] << "The font scaling factor is "
<< font_scaling_factor_ << endl;
zoom = 150;
wheel_jump = 5;
// Default LaTeX font size:
- font_sizes[LyXFont::SIZE_TINY] = 5.0;
- font_sizes[LyXFont::SIZE_SCRIPT] = 7.0;
- font_sizes[LyXFont::SIZE_FOOTNOTE] = 8.0;
- font_sizes[LyXFont::SIZE_SMALL] = 9.0;
- font_sizes[LyXFont::SIZE_NORMAL] = 10.0;
- font_sizes[LyXFont::SIZE_LARGE] = 12.0;
- font_sizes[LyXFont::SIZE_LARGER] = 14.4;
- font_sizes[LyXFont::SIZE_LARGEST] = 17.26;
- font_sizes[LyXFont::SIZE_HUGE] = 20.74;
- font_sizes[LyXFont::SIZE_HUGER] = 24.88;
+ font_sizes[LyXFont::SIZE_TINY] = "5.0";
+ font_sizes[LyXFont::SIZE_SCRIPT] = "7.0";
+ font_sizes[LyXFont::SIZE_FOOTNOTE] = "8.0";
+ font_sizes[LyXFont::SIZE_SMALL] = "9.0";
+ font_sizes[LyXFont::SIZE_NORMAL] = "10.0";
+ font_sizes[LyXFont::SIZE_LARGE] = "12.0";
+ font_sizes[LyXFont::SIZE_LARGER] = "14.4";
+ font_sizes[LyXFont::SIZE_LARGEST] = "17.26";
+ font_sizes[LyXFont::SIZE_HUGE] = "20.74";
+ font_sizes[LyXFont::SIZE_HUGER] = "24.88";
use_scalable_fonts = true;
roman_font_name = "";
sans_font_name = "";
label_init_length = 3;
preview = PREVIEW_OFF;
preview_hashed_labels = false;
- preview_scale_factor = 0.9;
+ preview_scale_factor = "0.9";
user_name = lyx::support::user_name();
case RC_SCREEN_FONT_SIZES:
if (lexrc.next()) {
font_sizes[LyXFont::SIZE_TINY] =
- lexrc.getFloat();
+ lexrc.getString();
}
if (lexrc.next()) {
font_sizes[LyXFont::SIZE_SCRIPT] =
- lexrc.getFloat();
+ lexrc.getString();
}
if (lexrc.next()) {
font_sizes[LyXFont::SIZE_FOOTNOTE] =
- lexrc.getFloat();
+ lexrc.getString();
}
if (lexrc.next()) {
font_sizes[LyXFont::SIZE_SMALL] =
- lexrc.getFloat();
+ lexrc.getString();
}
if (lexrc.next()) {
font_sizes[LyXFont::SIZE_NORMAL] =
- lexrc.getFloat();
+ lexrc.getString();
}
if (lexrc.next()) {
font_sizes[LyXFont::SIZE_LARGE] =
- lexrc.getFloat();
+ lexrc.getString();
}
if (lexrc.next()) {
font_sizes[LyXFont::SIZE_LARGER] =
- lexrc.getFloat();
+ lexrc.getString();
}
if (lexrc.next()) {
font_sizes[LyXFont::SIZE_LARGEST] =
- lexrc.getFloat();
+ lexrc.getString();
}
if (lexrc.next()) {
font_sizes[LyXFont::SIZE_HUGE] =
- lexrc.getFloat();
+ lexrc.getString();
}
if (lexrc.next()) {
font_sizes[LyXFont::SIZE_HUGER] =
- lexrc.getFloat();
+ lexrc.getString();
}
break;
case RC_PREVIEW_SCALE_FACTOR:
if (lexrc.next()) {
- preview_scale_factor = lexrc.getFloat();
+ preview_scale_factor = lexrc.getString();
}
break;
/// parameter for button_4 and button_5 (scrollwheel)
unsigned int wheel_jump;
/// Screen font sizes in points for each font size
- float font_sizes[10];
+ std::string font_sizes[10];
/// Allow the use of scalable fonts? Default is yes.
bool use_scalable_fonts;
/// DPI of monitor
- float dpi;
+ unsigned int dpi;
///
std::string fontenc;
///
///
bool preview_hashed_labels;
///
- float preview_scale_factor;
+ std::string preview_scale_factor;
/// user name
std::string user_name;
/// user email