small cleanup and removal of warnings

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5446 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2002-10-19 10:32:57 +00:00
parent e47acda4ea
commit c6e27f082c
9 changed files with 83 additions and 46 deletions

View File

@ -1,7 +1,28 @@
2002-10-19 Lars Gullik Bjønnes <larsbj@gullik.net>
* 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 <j.spitzmueller@gmx.de> 2002-10-17 Juergen Spitzmueller <j.spitzmueller@gmx.de>
* ui/QSendtoDialog.ui: fix layout * ui/QSendtoDialog.ui: fix layout
2002-10-17 Angus Leeming <leeming@lyx.org> 2002-10-17 Angus Leeming <leeming@lyx.org>
* lyx_gui.C (getDPI): use an average of DpiX and DpiY. * lyx_gui.C (getDPI): use an average of DpiX and DpiY.
@ -56,7 +77,7 @@
2002-10-12 Dekel Tsur <dekelts@tau.ac.il> 2002-10-12 Dekel Tsur <dekelts@tau.ac.il>
* qfont_loader.C (available): Implemented. * qfont_loader.C (available): Implemented.
2002-10-09 Edwin Leuven <leuven@fee.uva.nl> 2002-10-09 Edwin Leuven <leuven@fee.uva.nl>
* QDocument.C: Brand new document dialog * QDocument.C: Brand new document dialog

View File

@ -13,28 +13,29 @@
#endif #endif
#include <config.h> #include <config.h>
#include <gettext.h>
#include <utility>
#include "commandtags.h" #include "commandtags.h"
#include "LString.h" #include "LString.h"
#include "frontends/FileDialog.h" #include "frontends/FileDialog.h"
#include "FileDialog_private.h" #include "FileDialog_private.h"
#include "debug.h" #include "debug.h"
#include "gettext.h"
#include <qapplication.h> #include <qapplication.h>
#include <utility>
using std::make_pair; using std::make_pair;
using std::pair; using std::pair;
using std::endl; using std::endl;
struct FileDialog::Private { struct FileDialog::Private {
Button b1; Button b1;
Button b2; Button b2;
}; };
FileDialog::FileDialog(LyXView *lv, string const & t, kb_action s, 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_->b1 = b1;
private_->b2 = b2; 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; lyxerr[Debug::GUI] << "Select with path \"" << path << "\", mask \"" << filter << "\", suggested \"" << suggested << endl;
dlg.setMode(QFileDialog::AnyFile); dlg.setMode(QFileDialog::AnyFile);
if (!suggested.empty()) if (!suggested.empty())
dlg.setSelection(suggested.c_str()); dlg.setSelection(suggested.c_str());
// This code relies on DestructiveClose which is broken // This code relies on DestructiveClose which is broken
// in Qt < 3.0.5. So we just don't allow it for now. // in Qt < 3.0.5. So we just don't allow it for now.
//if (success_ == LFUN_SELECT_FILE_SYNC) { //if (success_ == LFUN_SELECT_FILE_SYNC) {
FileDialog::Result result; FileDialog::Result result;
lyxerr[Debug::GUI] << "Synchronous FileDialog : " << endl; lyxerr[Debug::GUI] << "Synchronous FileDialog : " << endl;
result.first = FileDialog::Chosen; result.first = FileDialog::Chosen;

View File

@ -14,17 +14,19 @@
#pragma implementation #pragma implementation
#endif #endif
#include <qapplication.h>
#include <qtoolbutton.h>
#include "FileDialog_private.h"
#include "QtLyXView.h" #include "QtLyXView.h"
#include "debug.h" #include "debug.h"
#include "funcrequest.h" #include "funcrequest.h"
#include "lyxfunc.h" #include "lyxfunc.h"
#include "FileDialog_private.h"
#include "support/lstrings.h" #include "support/lstrings.h"
#include <qapplication.h>
#include <qfiledialog.h>
#include <qtoolbutton.h>
namespace { namespace {
/// return the Qt form of the label /// return the Qt form of the label
string const getLabel(string const & str) { 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) 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) b1_(0), b2_(0)
{ {
setCaption(t.c_str()); setCaption(t.c_str());

View File

@ -101,7 +101,10 @@ namespace {
template<class A, class B> template<class A, class B>
int findPos2nd(vector<std::pair<A,B> > const & vec, B const & val) int findPos2nd(vector<std::pair<A,B> > const & vec, B const & val)
{ {
vector<std::pair<A,B> >::const_iterator cit = vec.begin(); typedef typename vector<std::pair<A, B> >::const_iterator
const_iterator;
const_iterator cit = vec.begin();
for (; cit != vec.end(); ++cit) { for (; cit != vec.end(); ++cit) {
if (cit->second == val) if (cit->second == val)
return int(cit - vec.begin()); return int(cit - vec.begin());

View File

@ -97,8 +97,7 @@ void QDocument::build_dialog()
dialog_->packagesModule->lspacingCO->insertItem( dialog_->packagesModule->lspacingCO->insertItem(
_("Custom"),Spacing::Other); _("Custom"),Spacing::Other);
int n; for (int n = 0; tex_graphics[n][0]; ++n) {
for (n=0; tex_graphics[n][0]; ++n) {
QString enc = tex_graphics[n]; QString enc = tex_graphics[n];
dialog_->packagesModule->psdriverCO->insertItem(enc); dialog_->packagesModule->psdriverCO->insertItem(enc);
} }
@ -116,7 +115,7 @@ void QDocument::build_dialog()
dialog_->layoutModule->classCO->insertItem(cit->description().c_str()); 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]; QString font = tex_fonts[n];
dialog_->layoutModule->fontsCO->insertItem(font); dialog_->layoutModule->fontsCO->insertItem(font);
} }
@ -142,7 +141,7 @@ void QDocument::build_dialog()
string const bmtablefile = LibFileSearch("images", "standard", "xpm"); string const bmtablefile = LibFileSearch("images", "standard", "xpm");
QString s = bmtablefile.c_str(); QString s = bmtablefile.c_str();
qWarning("%d",s); qWarning("%d", s);
// Manage the restore, ok, apply, restore and cancel/close buttons // Manage the restore, ok, apply, restore and cancel/close buttons
bc().setOK(dialog_->okPB); bc().setOK(dialog_->okPB);
@ -434,9 +433,9 @@ void QDocument::update_contents()
QString text = controller().params().graphicsDriver.c_str(); QString text = controller().params().graphicsDriver.c_str();
int nitem = dialog_->packagesModule->psdriverCO->count(); int nitem = dialog_->packagesModule->psdriverCO->count();
for (int n=0; n<nitem ; ++n) { for (int n = 0; n < nitem ; ++n) {
QString enc = tex_graphics[n]; QString enc = tex_graphics[n];
if (enc==text) { if (enc == text) {
dialog_->packagesModule->psdriverCO->setCurrentItem(n); dialog_->packagesModule->psdriverCO->setCurrentItem(n);
} }
} }
@ -469,8 +468,7 @@ void QDocument::update_contents()
dialog_->updatePagestyle(controller().textClass().opt_pagestyle(), dialog_->updatePagestyle(controller().textClass().opt_pagestyle(),
controller().params().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) { if (tex_fonts[n]==controller().params().fonts) {
dialog_->layoutModule->fontsCO->setCurrentItem(n); dialog_->layoutModule->fontsCO->setCurrentItem(n);
break; break;
@ -550,7 +548,7 @@ void QDocument::update_contents()
int item = controller().params().paperpackage; int item = controller().params().paperpackage;
if (controller().params().use_geometry) { if (controller().params().use_geometry) {
item = 1; item = 1;
} else if (item>0) { } else if (item > 0) {
item = item + 1; item = item + 1;
} }
dialog_->marginsModule->marginCO->setCurrentItem(item); dialog_->marginsModule->marginCO->setCurrentItem(item);

View File

@ -54,7 +54,7 @@ void QERT::apply()
void QERT::update_contents() void QERT::update_contents()
{ {
QRadioButton * rb; QRadioButton * rb = 0;
switch (controller().params().status) { switch (controller().params().status) {
case InsetERT::Open: rb = dialog_->openRB; break; case InsetERT::Open: rb = dialog_->openRB; break;

View File

@ -3,7 +3,7 @@
* This file is part of LyX, the document processor. * This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING. * Licence details can be found in the file COPYING.
* *
* \author Edwin Leuven * \author Edwin Leuven
* *
* Full author contact details are available in file CREDITS * Full author contact details are available in file CREDITS
*/ */
@ -223,7 +223,7 @@ void setWidgetsFromVSpace(VSpace const & space,
value->setEnabled(false); value->setEnabled(false);
unit->setEnabled(false); unit->setEnabled(false);
int item; int item = 0;
switch (space.kind()) { switch (space.kind()) {
case VSpace::NONE: case VSpace::NONE:
item = 0; item = 0;

View File

@ -40,14 +40,10 @@ qfont_loader::~qfont_loader()
void qfont_loader::update() void qfont_loader::update()
{ {
int i1,i2,i3,i4; for (int i1 = 0; i1 < LyXFont::NUM_FAMILIES; ++i1) {
for (int i2 = 0; i1 < 2; ++i2) {
// fuck this ! for (int i3 = 0; i1 < 4; ++i3) {
for (int i4 = 0; i1 < 10; ++i4) {
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) {
fontinfo_[i1][i2][i3][i4].reset(0); fontinfo_[i1][i2][i3][i4].reset(0);
} }
} }
@ -62,8 +58,12 @@ QFont const & qfont_loader::get(LyXFont const & f)
if (lyxerr.debugging(Debug::FONT)) { if (lyxerr.debugging(Debug::FONT)) {
lyxerr[Debug::FONT] << "Font '" << f.stateText(0) 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; return ret;
} }
@ -128,6 +128,16 @@ qfont_loader::font_info::font_info(LyXFont const & f)
break; 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); 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(); font_info * fi = fontinfo_[f.family()][f.series()][f.realShape()][f.size()].get();
if (fi) { if (!fi) {
return fi;
} else {
fi = new font_info(f); fi = new font_info(f);
fontinfo_[f.family()][f.series()][f.realShape()][f.size()].reset(fi); fontinfo_[f.family()][f.series()][f.realShape()][f.size()].reset(fi);
return fi;
} }
return fi;
} }

View File

@ -301,7 +301,7 @@ XFontStruct * xfont_loader::doLoad(LyXFont::FONT_FAMILY family,
if (font == "fixed") { if (font == "fixed") {
lyxerr << "We're doomed. Can't get 'fixed' font." << endl; lyxerr << "We're doomed. Can't get 'fixed' font." << endl;
} else { } else {
lyxerr << "Could not get font '" << font lyxerr << "Could not get font '" << font
<< "'. Using 'fixed'." << endl; << "'. Using 'fixed'." << endl;
fs = XLoadQueryFont(fl_get_display(), "fixed"); fs = XLoadQueryFont(fl_get_display(), "fixed");
} }