diff --git a/src/frontends/qt2/ChangeLog b/src/frontends/qt2/ChangeLog index eaab34edac..e4f94a5331 100644 --- a/src/frontends/qt2/ChangeLog +++ b/src/frontends/qt2/ChangeLog @@ -1,7 +1,28 @@ +2002-10-19 Lars Gullik Bjønnes + + * qfont_loader.C (update): move loop vars into for scopes. + (get): add some debug msg. + (font_info): ditto + (getfontinfo): simplify slightly + + * QParagraph.C (setWidgetsFromVSpace): initilize item + + * QERT.C (update_contents): initialize rb + + * QDocument.C (build_dialog): move int n inside for scope. + + * QCharacter.C (findPos2nd): add a typedef + + * FileDialog_private.C: include order changed. + (LyXFileDialog): some reformat + + * FileDialog.C: include order changed. + (FileDialog): fix wrong use of new. + 2002-10-17 Juergen Spitzmueller - - * ui/QSendtoDialog.ui: fix layout - + + * ui/QSendtoDialog.ui: fix layout + 2002-10-17 Angus Leeming * lyx_gui.C (getDPI): use an average of DpiX and DpiY. @@ -56,7 +77,7 @@ 2002-10-12 Dekel Tsur * qfont_loader.C (available): Implemented. - + 2002-10-09 Edwin Leuven * QDocument.C: Brand new document dialog diff --git a/src/frontends/qt2/FileDialog.C b/src/frontends/qt2/FileDialog.C index 0aad7f0e39..a09eed329f 100644 --- a/src/frontends/qt2/FileDialog.C +++ b/src/frontends/qt2/FileDialog.C @@ -13,28 +13,29 @@ #endif #include -#include -#include #include "commandtags.h" #include "LString.h" #include "frontends/FileDialog.h" #include "FileDialog_private.h" #include "debug.h" +#include "gettext.h" #include - + +#include + using std::make_pair; using std::pair; using std::endl; -struct FileDialog::Private { +struct FileDialog::Private { Button b1; Button b2; }; - + FileDialog::FileDialog(LyXView *lv, string const & t, kb_action s, Button b1, Button b2) - : private_(new FileDialog::Private()), lv_(lv), title_(t), success_(s) + : private_(new FileDialog::Private), lv_(lv), title_(t), success_(s) { private_->b1 = b1; private_->b2 = b2; @@ -57,14 +58,14 @@ FileDialog::Result const FileDialog::Select(string const & path, string const & lyxerr[Debug::GUI] << "Select with path \"" << path << "\", mask \"" << filter << "\", suggested \"" << suggested << endl; dlg.setMode(QFileDialog::AnyFile); - + if (!suggested.empty()) dlg.setSelection(suggested.c_str()); // This code relies on DestructiveClose which is broken // in Qt < 3.0.5. So we just don't allow it for now. //if (success_ == LFUN_SELECT_FILE_SYNC) { - + FileDialog::Result result; lyxerr[Debug::GUI] << "Synchronous FileDialog : " << endl; result.first = FileDialog::Chosen; diff --git a/src/frontends/qt2/FileDialog_private.C b/src/frontends/qt2/FileDialog_private.C index 8f68d8caca..60d0f054a5 100644 --- a/src/frontends/qt2/FileDialog_private.C +++ b/src/frontends/qt2/FileDialog_private.C @@ -14,17 +14,19 @@ #pragma implementation #endif -#include -#include - -#include "FileDialog_private.h" - #include "QtLyXView.h" #include "debug.h" #include "funcrequest.h" #include "lyxfunc.h" +#include "FileDialog_private.h" + #include "support/lstrings.h" +#include +#include +#include + + namespace { /// return the Qt form of the label string const getLabel(string const & str) { @@ -40,9 +42,12 @@ namespace { } } -LyXFileDialog::LyXFileDialog(string const & p, string const & m, string const & t, + +LyXFileDialog::LyXFileDialog(string const & p, string const & m, + string const & t, FileDialog::Button const & b1, FileDialog::Button const & b2) - : QFileDialog(p.c_str(), m.c_str(), qApp->mainWidget(), t.c_str(), true), + : QFileDialog(p.c_str(), m.c_str(), + qApp->mainWidget(), t.c_str(), true), b1_(0), b2_(0) { setCaption(t.c_str()); diff --git a/src/frontends/qt2/QCharacter.C b/src/frontends/qt2/QCharacter.C index aa3ac5ef3a..6812350db5 100644 --- a/src/frontends/qt2/QCharacter.C +++ b/src/frontends/qt2/QCharacter.C @@ -101,7 +101,10 @@ namespace { template int findPos2nd(vector > const & vec, B const & val) { - vector >::const_iterator cit = vec.begin(); + typedef typename vector >::const_iterator + const_iterator; + + const_iterator cit = vec.begin(); for (; cit != vec.end(); ++cit) { if (cit->second == val) return int(cit - vec.begin()); diff --git a/src/frontends/qt2/QDocument.C b/src/frontends/qt2/QDocument.C index 74c54ff77a..ab70d9e47a 100644 --- a/src/frontends/qt2/QDocument.C +++ b/src/frontends/qt2/QDocument.C @@ -97,8 +97,7 @@ void QDocument::build_dialog() dialog_->packagesModule->lspacingCO->insertItem( _("Custom"),Spacing::Other); - int n; - for (n=0; tex_graphics[n][0]; ++n) { + for (int n = 0; tex_graphics[n][0]; ++n) { QString enc = tex_graphics[n]; dialog_->packagesModule->psdriverCO->insertItem(enc); } @@ -116,7 +115,7 @@ void QDocument::build_dialog() dialog_->layoutModule->classCO->insertItem(cit->description().c_str()); } - for (n=0; tex_fonts[n][0]; ++n) { + for (int n = 0; tex_fonts[n][0]; ++n) { QString font = tex_fonts[n]; dialog_->layoutModule->fontsCO->insertItem(font); } @@ -142,7 +141,7 @@ void QDocument::build_dialog() string const bmtablefile = LibFileSearch("images", "standard", "xpm"); QString s = bmtablefile.c_str(); - qWarning("%d",s); + qWarning("%d", s); // Manage the restore, ok, apply, restore and cancel/close buttons bc().setOK(dialog_->okPB); @@ -434,9 +433,9 @@ void QDocument::update_contents() QString text = controller().params().graphicsDriver.c_str(); int nitem = dialog_->packagesModule->psdriverCO->count(); - for (int n=0; npackagesModule->psdriverCO->setCurrentItem(n); } } @@ -469,8 +468,7 @@ void QDocument::update_contents() dialog_->updatePagestyle(controller().textClass().opt_pagestyle(), controller().params().pagestyle); - - for (int n=0; tex_fonts[n][0]; ++n) { + for (int n = 0; tex_fonts[n][0]; ++n) { if (tex_fonts[n]==controller().params().fonts) { dialog_->layoutModule->fontsCO->setCurrentItem(n); break; @@ -550,7 +548,7 @@ void QDocument::update_contents() int item = controller().params().paperpackage; if (controller().params().use_geometry) { item = 1; - } else if (item>0) { + } else if (item > 0) { item = item + 1; } dialog_->marginsModule->marginCO->setCurrentItem(item); diff --git a/src/frontends/qt2/QERT.C b/src/frontends/qt2/QERT.C index b26e7e1a7f..7507382aea 100644 --- a/src/frontends/qt2/QERT.C +++ b/src/frontends/qt2/QERT.C @@ -54,7 +54,7 @@ void QERT::apply() void QERT::update_contents() { - QRadioButton * rb; + QRadioButton * rb = 0; switch (controller().params().status) { case InsetERT::Open: rb = dialog_->openRB; break; diff --git a/src/frontends/qt2/QParagraph.C b/src/frontends/qt2/QParagraph.C index 49850a40b0..fe15456411 100644 --- a/src/frontends/qt2/QParagraph.C +++ b/src/frontends/qt2/QParagraph.C @@ -3,7 +3,7 @@ * This file is part of LyX, the document processor. * Licence details can be found in the file COPYING. * - * \author Edwin Leuven + * \author Edwin Leuven * * Full author contact details are available in file CREDITS */ @@ -223,7 +223,7 @@ void setWidgetsFromVSpace(VSpace const & space, value->setEnabled(false); unit->setEnabled(false); - int item; + int item = 0; switch (space.kind()) { case VSpace::NONE: item = 0; diff --git a/src/frontends/qt2/qfont_loader.C b/src/frontends/qt2/qfont_loader.C index 2f61d67e1f..462f485536 100644 --- a/src/frontends/qt2/qfont_loader.C +++ b/src/frontends/qt2/qfont_loader.C @@ -40,14 +40,10 @@ qfont_loader::~qfont_loader() void qfont_loader::update() { - int i1,i2,i3,i4; - - // fuck this ! - - for (i1 = 0; i1 < LyXFont::NUM_FAMILIES; ++i1) { - for (i2 = 0; i1 < 2; ++i2) { - for (i3 = 0; i1 < 4; ++i3) { - for (i4 = 0; i1 < 10; ++i4) { + for (int i1 = 0; i1 < LyXFont::NUM_FAMILIES; ++i1) { + for (int i2 = 0; i1 < 2; ++i2) { + for (int i3 = 0; i1 < 4; ++i3) { + for (int i4 = 0; i1 < 10; ++i4) { fontinfo_[i1][i2][i3][i4].reset(0); } } @@ -62,8 +58,12 @@ QFont const & qfont_loader::get(LyXFont const & f) if (lyxerr.debugging(Debug::FONT)) { lyxerr[Debug::FONT] << "Font '" << f.stateText(0) - << "' matched by\n" << ret.rawName().latin1() << endl; + << "' matched by\n" << ret.rawName() << endl; } + + lyxerr[Debug::FONT] << "The font has size: " + << ret.pointSizeFloat() << endl; + return ret; } @@ -128,6 +128,16 @@ qfont_loader::font_info::font_info(LyXFont const & f) break; } + // 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: " << font.rawName() << endl; + metrics = QFontMetrics(font); } @@ -139,13 +149,12 @@ qfont_loader::font_info const * qfont_loader::getfontinfo(LyXFont const & f) } font_info * fi = fontinfo_[f.family()][f.series()][f.realShape()][f.size()].get(); - if (fi) { - return fi; - } else { + if (!fi) { fi = new font_info(f); fontinfo_[f.family()][f.series()][f.realShape()][f.size()].reset(fi); - return fi; } + + return fi; } diff --git a/src/frontends/xforms/xfont_loader.C b/src/frontends/xforms/xfont_loader.C index 32b5bd0909..1e4305ebe7 100644 --- a/src/frontends/xforms/xfont_loader.C +++ b/src/frontends/xforms/xfont_loader.C @@ -301,7 +301,7 @@ XFontStruct * xfont_loader::doLoad(LyXFont::FONT_FAMILY family, if (font == "fixed") { lyxerr << "We're doomed. Can't get 'fixed' font." << endl; } else { - lyxerr << "Could not get font '" << font + lyxerr << "Could not get font '" << font << "'. Using 'fixed'." << endl; fs = XLoadQueryFont(fl_get_display(), "fixed"); }