the qtclean-2 patch with some very small changes

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5447 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2002-10-20 01:48:28 +00:00
parent c6e27f082c
commit 814b819451
197 changed files with 1593 additions and 1482 deletions

View File

@ -1,3 +1,11 @@
2002-10-20 Lars Gullik Bjønnes <larsbj@gullik.net>
* LyXKeySym.h: move operator== out of class. Separate
implementations for xforms and qt.
* Liason.[Ch]: get rid of setMinibuffer, where used call message
directly through LyXView::message instead.
2002-09-25 Angus Leeming <leeming@lyx.org> 2002-09-25 Angus Leeming <leeming@lyx.org>
* Dialogs.C: doxygen fix. * Dialogs.C: doxygen fix.

View File

@ -87,7 +87,7 @@ bool printBuffer(Buffer * buffer, PrinterParams const & pp)
command += tostr(pp.count_copies); command += tostr(pp.count_copies);
command += ' '; command += ' ';
} }
if (pp.reverse_order) { if (pp.reverse_order) {
command += lyxrc.print_reverse_flag + ' '; command += lyxrc.print_reverse_flag + ' ';
} }
@ -154,11 +154,4 @@ bool printBuffer(Buffer * buffer, PrinterParams const & pp)
return res == 0; return res == 0;
} }
void setMinibuffer(LyXView * lv, string const & msg)
{
lyx::Assert(lv);
lv->message(msg);
}
} // namespace Liason } // namespace Liason

View File

@ -52,8 +52,6 @@ namespace Liason {
PrinterParams getPrinterParams(Buffer *); PrinterParams getPrinterParams(Buffer *);
/// print the current buffer /// print the current buffer
bool printBuffer(Buffer *, PrinterParams const &); bool printBuffer(Buffer *, PrinterParams const &);
/// set the minibuffer
void setMinibuffer(LyXView *, string const & msg);
//@} //@}
} // namespace Liason } // namespace Liason

View File

@ -45,14 +45,15 @@ public:
* This relies on user to use the right encoding. * This relies on user to use the right encoding.
*/ */
virtual char getISOEncoded() const = 0; virtual char getISOEncoded() const = 0;
/**
* We need to be able to equality compare these for the
* sake of the keymap business.
*/
virtual bool operator==(LyXKeySym const & k) const = 0;
}; };
/**
* We need to be able to equality compare these for the
* sake of the keymap business.
*/
bool operator==(LyXKeySym const & k1, LyXKeySym const & k1);
typedef boost::shared_ptr<LyXKeySym> LyXKeySymPtr; typedef boost::shared_ptr<LyXKeySym> LyXKeySymPtr;
#endif #endif

View File

@ -1,3 +1,13 @@
2002-10-20 Lars Gullik Bjønnes <larsbj@gullik.net>
* ControlCharacter.C (apply): setMinibuffer change
* ControlDocument.C (apply): ditto
(classApply): ditto
* ControlThesaurus.C (replace): ditto
* ControlSearch.C (find): ditto
(replace): ditto
* ControlPreamble.C (apply): ditto
* ControlParagraph.C (apply): ditto
2002-10-14 André Pönitz <poenitz@gmx.net> 2002-10-14 André Pönitz <poenitz@gmx.net>
@ -8,7 +18,7 @@
* ControlDocument.h: * ControlDocument.h:
* ControlDocument.C: * ControlDocument.C:
* Makefile.am: New document parameters controller * Makefile.am: New document parameters controller
2002-09-24 Lars Gullik Bjønnes <larsbj@gullik.net> 2002-09-24 Lars Gullik Bjønnes <larsbj@gullik.net>
* Makefile.am (INCLUDES): loose SIGC_INCLUDES * Makefile.am (INCLUDES): loose SIGC_INCLUDES

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 Angus Leeming * \author Angus Leeming
* *
* Full author contact details are available in file CREDITS * Full author contact details are available in file CREDITS
*/ */
@ -24,11 +24,8 @@
#include "gettext.h" #include "gettext.h"
#include "language.h" #include "language.h"
#include "frontends/Liason.h"
#include "frontends/LyXView.h" #include "frontends/LyXView.h"
using Liason::setMinibuffer;
ControlCharacter::ControlCharacter(LyXView & lv, Dialogs & d) ControlCharacter::ControlCharacter(LyXView & lv, Dialogs & d)
: ControlDialogBD(lv, d), : ControlDialogBD(lv, d),
@ -68,7 +65,7 @@ void ControlCharacter::apply()
toggleAndShow(bufferview(), *(font_.get()), toggleall_); toggleAndShow(bufferview(), *(font_.get()), toggleall_);
lv_.view_state_changed(); lv_.view_state_changed();
buffer()->markDirty(); buffer()->markDirty();
setMinibuffer(&lv_, _("Character set")); lv_.message(_("Character set"));
} }

View File

@ -4,7 +4,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
*/ */
@ -29,15 +29,12 @@
#include "lyxtextclasslist.h" #include "lyxtextclasslist.h"
#include "CutAndPaste.h" #include "CutAndPaste.h"
#include "frontends/Liason.h"
#include "frontends/LyXView.h" #include "frontends/LyXView.h"
#include "frontends/Alert.h" #include "frontends/Alert.h"
#include "support/lstrings.h" #include "support/lstrings.h"
#include "support/filetools.h" #include "support/filetools.h"
using Liason::setMinibuffer;
ControlDocument::ControlDocument(LyXView & lv, Dialogs & d) ControlDocument::ControlDocument(LyXView & lv, Dialogs & d)
: ControlDialogBD(lv, d), bp_(0) : ControlDialogBD(lv, d), bp_(0)
@ -58,27 +55,30 @@ BufferParams & ControlDocument::params()
return *bp_; return *bp_;
} }
LyXTextClass ControlDocument::textClass() LyXTextClass ControlDocument::textClass()
{ {
return textclasslist[bp_->textclass]; return textclasslist[bp_->textclass];
} }
void ControlDocument::apply() void ControlDocument::apply()
{ {
if (!bufferIsAvailable()) if (!bufferIsAvailable())
return; return;
setLanguage(); setLanguage();
bool succes = classApply();
lv_.view()->redoCurrentBuffer(); // FIXME: do we need to use return value from classApply() here? (Lgb)
classApply();
lv_.view()->redoCurrentBuffer();
view().apply(); view().apply();
buffer()->params = *bp_; buffer()->params = *bp_;
buffer()->markDirty(); buffer()->markDirty();
Liason::setMinibuffer(&lv_, _("Document Settings Applied")); lv_.message(_("Document Settings Applied"));
} }
@ -86,7 +86,7 @@ void ControlDocument::setParams()
{ {
if (!bp_.get()) if (!bp_.get())
bp_.reset(new BufferParams()); bp_.reset(new BufferParams());
/// Set the buffer parameters /// Set the buffer parameters
*bp_ = buffer()->params; *bp_ = buffer()->params;
} }
@ -95,7 +95,7 @@ void ControlDocument::setLanguage()
{ {
Language const * oldL = buffer()->params.language; Language const * oldL = buffer()->params.language;
Language const * newL = bp_->language; Language const * newL = bp_->language;
if (oldL != newL if (oldL != newL
&& oldL->RightToLeft() == newL->RightToLeft() && oldL->RightToLeft() == newL->RightToLeft()
&& !lv_.buffer()->isMultiLingual()) && !lv_.buffer()->isMultiLingual())
@ -105,7 +105,7 @@ void ControlDocument::setLanguage()
bool ControlDocument::classApply() bool ControlDocument::classApply()
{ {
BufferParams &params = lv_.buffer()->params; BufferParams & params = lv_.buffer()->params;
unsigned int const old_class = bp_->textclass; unsigned int const old_class = bp_->textclass;
// exit if nothing changes // exit if nothing changes
if (params.textclass == old_class) if (params.textclass == old_class)
@ -120,10 +120,9 @@ bool ControlDocument::classApply()
_("Reverting to original document class.")); _("Reverting to original document class."));
return false; return false;
} }
// successfully loaded // successfully loaded
Liason::setMinibuffer(&lv_, lv_.message(_("Converting document to new document class..."));
_("Converting document to new document class..."));
int ret = CutAndPaste::SwitchLayoutsBetweenClasses( int ret = CutAndPaste::SwitchLayoutsBetweenClasses(
old_class, params.textclass, old_class, params.textclass,
&*(lv_.buffer()->paragraphs.begin()), &*(lv_.buffer()->paragraphs.begin()),
@ -146,7 +145,7 @@ bool ControlDocument::classApply()
void ControlDocument::saveAsDefault() void ControlDocument::saveAsDefault()
{ {
lv_.buffer()->params.preamble = bp_->preamble; lv_.buffer()->params.preamble = bp_->preamble;
string const fname = AddName(AddPath(user_lyxdir, "templates/"), string const fname = AddName(AddPath(user_lyxdir, "templates/"),
"defaults.lyx"); "defaults.lyx");
Buffer defaults(fname); Buffer defaults(fname);
@ -156,7 +155,7 @@ void ControlDocument::saveAsDefault()
Paragraph * par = new Paragraph; Paragraph * par = new Paragraph;
par->layout(params().getLyXTextClass().defaultLayout()); par->layout(params().getLyXTextClass().defaultLayout());
defaults.paragraphs.set(par); defaults.paragraphs.set(par);
defaults.writeFile(defaults.fileName()); defaults.writeFile(defaults.fileName());
} }

View File

@ -32,6 +32,7 @@ class ControlDocument : public ControlDialogBD {
public: public:
/// ///
ControlDocument(LyXView &, Dialogs &); ControlDocument(LyXView &, Dialogs &);
///
~ControlDocument(); ~ControlDocument();
/// show latex preamble /// show latex preamble
void showPreamble(); void showPreamble();
@ -43,9 +44,8 @@ public:
BufferParams & params(); BufferParams & params();
/// ///
void saveAsDefault(); void saveAsDefault();
/// ///
bool classApply(); bool classApply();
private: private:
/// apply settings /// apply settings
void apply(); void apply();
@ -56,5 +56,3 @@ private:
}; };
#endif // CONTROLDOCUMENT_H #endif // CONTROLDOCUMENT_H

View File

@ -4,7 +4,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
*/ */
@ -26,12 +26,10 @@
#include "lyxtext.h" #include "lyxtext.h"
#include "ParagraphParameters.h" #include "ParagraphParameters.h"
#include "frontends/Liason.h" #include "frontends/LyXView.h"
#include "support/LAssert.h" #include "support/LAssert.h"
using Liason::setMinibuffer;
ControlParagraph::ControlParagraph(LyXView & lv, Dialogs & d) ControlParagraph::ControlParagraph(LyXView & lv, Dialogs & d)
: ControlDialogBD(lv, d), pp_(0), ininset_(false) : ControlDialogBD(lv, d), pp_(0), ininset_(false)
@ -89,7 +87,7 @@ void ControlParagraph::apply()
buffer()->markDirty(); buffer()->markDirty();
setMinibuffer(&lv_, _("Paragraph layout set")); lv_.message(_("Paragraph layout set"));
} }

View File

@ -21,7 +21,7 @@
#include "buffer.h" #include "buffer.h"
#include "gettext.h" #include "gettext.h"
#include "frontends/Liason.h" #include "frontends/LyXView.h"
ControlPreamble::ControlPreamble(LyXView & lv, Dialogs & d) ControlPreamble::ControlPreamble(LyXView & lv, Dialogs & d)
@ -39,7 +39,7 @@ void ControlPreamble::apply()
buffer()->params.preamble = params(); buffer()->params.preamble = params();
buffer()->markDirty(); buffer()->markDirty();
Liason::setMinibuffer(&lv_, _("LaTeX preamble set")); lv_.message(_("LaTeX preamble set"));
} }

View File

@ -19,12 +19,10 @@
#include "gettext.h" #include "gettext.h"
#include "lyxfind.h" #include "lyxfind.h"
#include "frontends/Liason.h" #include "frontends/LyXView.h"
#include "support/lstrings.h" #include "support/lstrings.h"
using Liason::setMinibuffer;
ControlSearch::ControlSearch(LyXView & lv, Dialogs & d) ControlSearch::ControlSearch(LyXView & lv, Dialogs & d)
: ControlDialogBD(lv, d) : ControlDialogBD(lv, d)
@ -39,7 +37,7 @@ void ControlSearch::find(string const & search,
matchword); matchword);
if (!found) if (!found)
setMinibuffer(&lv_, _("String not found!")); lv_.message(_("String not found!"));
} }
@ -56,14 +54,14 @@ void ControlSearch::replace(string const & search, string const & replace,
matchword, all, once); matchword, all, once);
if (replace_count == 0) { if (replace_count == 0) {
setMinibuffer(&lv_, _("String not found!")); lv_.message(_("String not found!"));
} else { } else {
if (replace_count == 1) { if (replace_count == 1) {
setMinibuffer(&lv_, _("String has been replaced.")); lv_.message(_("String has been replaced."));
} else { } else {
string str = tostr(replace_count); string str = tostr(replace_count);
str += _(" strings have been replaced."); str += _(" strings have been replaced.");
setMinibuffer(&lv_, str.c_str()); lv_.message(str.c_str());
} }
} }
} }

View File

@ -19,10 +19,7 @@
#include "gettext.h" #include "gettext.h"
#include "lyxfind.h" #include "lyxfind.h"
#include "frontends/Liason.h" #include "frontends/LyXView.h"
using Liason::setMinibuffer;
ControlThesaurus::ControlThesaurus(LyXView & lv, Dialogs & d) ControlThesaurus::ControlThesaurus(LyXView & lv, Dialogs & d)
@ -50,9 +47,9 @@ void ControlThesaurus::replace(string const & newstr)
oldstr_ = newstr; oldstr_ = newstr;
if (replace_count == 0) if (replace_count == 0)
setMinibuffer(&lv_, _("String not found!")); lv_.message(_("String not found!"));
else else
setMinibuffer(&lv_, _("String has been replaced.")); lv_.message(_("String has been replaced."));
} }

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 John Levon * \author John Levon
* *
* Full author contact details are available in file CREDITS * Full author contact details are available in file CREDITS
*/ */
@ -29,9 +29,11 @@
using std::pair; using std::pair;
using std::make_pair; using std::make_pair;
void alert_pimpl(string const & s1, string const & s2, string const & s3) void alert_pimpl(string const & s1, string const & s2, string const & s3)
{ {
QMessageBox::warning(0, "LyX", (s1 + "\n" + "\n" + s2 + "\n" + s3).c_str()); QMessageBox::warning(0, "LyX",
(s1 + "\n" + "\n" + s2 + "\n" + s3).c_str());
} }
@ -49,7 +51,8 @@ int askConfirmation_pimpl(string const & s1, string const & s2, string const & s
} }
pair<bool, string> const askForText_pimpl(string const & msg, string const & dflt) pair<bool, string> const
askForText_pimpl(string const & msg, string const & dflt)
{ {
string title = _("LyX: "); string title = _("LyX: ");
title += msg; title += msg;

View File

@ -22,52 +22,53 @@
#include "ui/BulletsModuleBase.h" #include "ui/BulletsModuleBase.h"
#include "QBrowseBox.h" #include "QBrowseBox.h"
BulletsModule::BulletsModule( QWidget* parent, const char* name, WFlags fl )
BulletsModule::BulletsModule(QWidget * parent, char const * name, WFlags fl)
: BulletsModuleBase(parent, name, fl) : BulletsModuleBase(parent, name, fl)
{ {
standard = new QBrowseBox(6,6); standard = new QBrowseBox(6, 6);
standard->insertItem(QPixmap("standard.xpm")); standard->insertItem(QPixmap("standard.xpm"));
maths = new QBrowseBox(6,6); maths = new QBrowseBox(6, 6);
maths->insertItem(QPixmap("amssymb.xpm")); maths->insertItem(QPixmap("amssymb.xpm"));
QPopupMenu * pm = new QPopupMenu(); QPopupMenu * pm = new QPopupMenu;
QPopupMenu * pm1 = new QPopupMenu(pm);
pm1->insertItem(standard);
QPopupMenu * pm2 = new QPopupMenu(pm); QPopupMenu * pm1 = new QPopupMenu(pm);
pm2->insertItem(maths); pm1->insertItem(standard);
QPopupMenu * pm2 = new QPopupMenu(pm);
pm->insertItem("Standard",pm1); pm2->insertItem(maths);
pm->insertItem("Maths",pm2);
pm->insertItem("Ding 1"); pm->insertItem("Standard", pm1);
pm->insertItem("Ding 2"); pm->insertItem("Maths", pm2);
pm->insertItem("Ding 3"); pm->insertItem("Ding 1");
pm->insertItem("Ding 4"); pm->insertItem("Ding 2");
pm->insertItem("Ding 3");
setbullet1TB->setPopup(pm); pm->insertItem("Ding 4");
setbullet1TB->setPopup(pm);
connect(standard, SIGNAL(selected(int, int)),
this, SLOT(checkThis(int, int)));
connect( standard, SIGNAL( selected(int,int) ),
this , SLOT( checkThis(int,int) ) );
} }
BulletsModule::~BulletsModule() BulletsModule::~BulletsModule()
{ {
delete standard; delete standard;
delete maths; delete maths;
} }
void BulletsModule::setLevel1() void BulletsModule::setLevel1()
{ {
qWarning("no setLevel1() yet"); qWarning("no setLevel1() yet");
} }
void BulletsModule::checkThis(int x, int y) void BulletsModule::checkThis(int x, int y)
{ {
qWarning("Check, x: %d y: %d ",x,y); qWarning("Check, x: %d y: %d ", x, y);
} }

View File

@ -18,21 +18,18 @@
#include "ui/BulletsModuleBase.h" #include "ui/BulletsModuleBase.h"
#include "LString.h" #include "LString.h"
class QBrowseBox; class QBrowseBox;
class BulletsModule : public BulletsModuleBase class BulletsModule : public BulletsModuleBase {
{
Q_OBJECT Q_OBJECT
public: public:
BulletsModule(QWidget* parent = 0, const char* name = 0,
BulletsModule( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); WFlags fl = 0);
~BulletsModule(); ~BulletsModule();
public slots: public slots:
void checkThis(int,int); void checkThis(int,int);
void setLevel1(); void setLevel1();
private: private:
QBrowseBox * standard; QBrowseBox * standard;
QBrowseBox * maths; QBrowseBox * maths;

View File

@ -1,3 +1,84 @@
2002-10-20 Lars Gullik Bjønnes <larsbj@gullik.net>
* Toolbar_pimpl.C (setLayout): initialize i to 0, don't
reinitialize.
* README: add a comment about the strange moc behaviour.
* QWrap.C (apply): local ref to params
(update_contents): ditto
(numtostr): use erase to clear string
* QWorkArea.C (setScrollbarParams): use explicit std::max
* QURL.C (update_contents): local ref to params
(apply): ditto
* QRef.C (update_contents): local ref to params
(apply): ditto
* QPreambleDialog.C (editClicked): no need to explicitly
initialize an std::string.
(editClicked): read file with smaller overhead.
* QParagraph.C (apply): local ref to params
(update_contents): ditto
* QMinipage.C (apply): local ref to params
(update_contents): ditto
(update_contents): handle InsetMinipage::top in switch
* QMath.C (createMathPanel): use "new Type" not "new Type()"
* QLyXKeySym.h: adda key_ accessor key().
* QLyXKeySym.C (operator=): out of class version.
* QLog.C (update_contents): use a simpler and faster way to fill
the log dialog.
* QLPopupMenu.C (getLabel): use subst directly on mi.label()
* QLPainter.C (QLPainter): use "new Type" not "new Type()"
(lines): put int i inside for scope
(fillPolygon): put j insize for scope
* QInclude.C (update_contents): local ref to params
(apply): ditto
* QGraphics.C (update_contents): initialize item to 0
(apply): use erase to clear string
* QFloat.C (update_contents): local ref to params
(apply): ditto
* QExternal.C (update_contents): local ref to params
(helpText): ditto
(apply): ditto
* QERT.C (apply): local reference to params
* QDocument.C (apply): have a local reference to the params
(update_contents): ditto
* QCommandEdit.C: add missing include config.h
* QCommandBuffer.C (QCommandBuffer): call method directly on
unnamed pointer objects.
(complete): use "new Type", not "new Type()"
(complete): use explict std::max
* QCharacter.C (update_contents): use a local reference as
controller cache
(apply): ditto
* QBibtex.C (update_contents): use erase to clear a string.
* QAbout.C (build_dialog): fill the credits view in a bit more
elegant way
* almost all files: clean up formatting and indenting.
2002-10-19 Lars Gullik Bjønnes <larsbj@gullik.net> 2002-10-19 Lars Gullik Bjønnes <larsbj@gullik.net>
* qfont_loader.C (update): move loop vars into for scopes. * qfont_loader.C (update): move loop vars into for scopes.

View File

@ -5,7 +5,7 @@
* Licence details can be found in the file COPYING. * Licence details can be found in the file COPYING.
* *
* \author Allan Rae * \author Allan Rae
* \author Angus Leeming * \author Angus Leeming
* *
* Full author contact details are available in file CREDITS * Full author contact details are available in file CREDITS
*/ */

View File

@ -5,7 +5,7 @@
* Licence details can be found in the file COPYING. * Licence details can be found in the file COPYING.
* *
* \author Allan Rae * \author Allan Rae
* \author Angus Leeming * \author Angus Leeming
* *
* Full author contact details are available in file CREDITS * Full author contact details are available in file CREDITS
*/ */
@ -18,6 +18,7 @@
#include "Dialogs_impl.h" #include "Dialogs_impl.h"
void Dialogs::showAboutlyx() void Dialogs::showAboutlyx()
{ {
pimpl_->aboutlyx.controller().show(); pimpl_->aboutlyx.controller().show();
@ -215,11 +216,11 @@ void Dialogs::showSpellchecker()
} }
void Dialogs::showTabular(InsetTabular * it) void Dialogs::showTabular(InsetTabular *)
{} {}
void Dialogs::updateTabular(InsetTabular * it) void Dialogs::updateTabular(InsetTabular *)
{} {}

View File

@ -223,20 +223,20 @@ WrapDialog;
struct Dialogs::Impl { struct Dialogs::Impl {
Impl(LyXView & lv, Dialogs & d); Impl(LyXView & lv, Dialogs & d);
AboutlyxDialog aboutlyx; AboutlyxDialog aboutlyx;
BibitemDialog bibitem; BibitemDialog bibitem;
BibtexDialog bibtex; BibtexDialog bibtex;
CharacterDialog character; CharacterDialog character;
CitationDialog citation; CitationDialog citation;
DocumentDialog document; DocumentDialog document;
ErrorDialog error; ErrorDialog error;
ERTDialog ert; ERTDialog ert;
ExternalDialog external; ExternalDialog external;
FileDialog file; FileDialog file;
FloatDialog floats; FloatDialog floats;
GraphicsDialog graphics; GraphicsDialog graphics;
IncludeDialog include; IncludeDialog include;
IndexDialog index; IndexDialog index;
LogFileDialog logfile; LogFileDialog logfile;
MinipageDialog minipage; MinipageDialog minipage;
ParagraphDialog paragraph; ParagraphDialog paragraph;

View File

@ -29,12 +29,15 @@ 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;
@ -48,14 +51,18 @@ FileDialog::~FileDialog()
} }
FileDialog::Result const FileDialog::Select(string const & path, string const & mask, string const & suggested) FileDialog::Result const FileDialog::Select(string const & path,
string const & mask,
string const & suggested)
{ {
string filter = mask; string filter(mask);
if (mask.empty()) if (mask.empty())
filter = _("*|All files"); filter = _("*|All files");
LyXFileDialog dlg(path, filter, title_, private_->b1, private_->b2); LyXFileDialog dlg(path, filter, title_, private_->b1, private_->b2);
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);

View File

@ -28,20 +28,22 @@
namespace { namespace {
/// return the Qt form of the label
string const getLabel(string const & str) { /// return the Qt form of the label
string label; string const getLabel(string const & str) {
string sc(split(str, label, '|')); string label;
if (sc.length() < 2) string sc(split(str, label, '|'));
return label; if (sc.length() < 2)
string::size_type pos = label.find(sc[1]);
if (pos == string::npos)
return label;
label.insert(pos, "&");
return label; return label;
} string::size_type pos = label.find(sc[1]);
if (pos == string::npos)
return label;
label.insert(pos, "&");
return label;
} }
} // namespace anon
LyXFileDialog::LyXFileDialog(string const & p, string const & m, LyXFileDialog::LyXFileDialog(string const & p, string const & m,
string const & t, string const & t,

View File

@ -27,11 +27,10 @@ class LyXFileDialog : public QFileDialog
Q_OBJECT Q_OBJECT
public: public:
LyXFileDialog(string const & p, string const & m, string const & t, 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);
public slots: public slots:
void buttonClicked(); void buttonClicked();
private: private:
QToolButton * b1_; QToolButton * b1_;
string b1_dir_; string b1_dir_;

View File

@ -9,7 +9,7 @@
*/ */
#include <config.h> #include <config.h>
#ifdef __GNUG__ #ifdef __GNUG__
#pragma implementation #pragma implementation
#endif #endif
@ -24,5 +24,5 @@ LyXKeySym * create()
{ {
return new QLyXKeySym(); return new QLyXKeySym();
} }
} } // namespace LyXKeySymFactory

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 John Levon * \author John Levon
* *
* Full author contact details are available in file CREDITS * Full author contact details are available in file CREDITS
*/ */
@ -26,4 +26,4 @@ LyXScreen * create(WorkArea & owner)
return new QScreen(static_cast<QWorkArea &>(owner)); return new QScreen(static_cast<QWorkArea &>(owner));
} }
} } // namespace LyXScreenFactory

View File

@ -10,8 +10,6 @@
#include <config.h> #include <config.h>
#include <algorithm>
#ifdef __GNUG__ #ifdef __GNUG__
#pragma implementation #pragma implementation
#endif #endif
@ -34,6 +32,8 @@
#include <qmenubar.h> #include <qmenubar.h>
#include <qcursor.h> #include <qcursor.h>
#include <algorithm>
using std::endl; using std::endl;
using std::vector; using std::vector;
using std::max; using std::max;
@ -41,6 +41,7 @@ using std::min;
using std::for_each; using std::for_each;
using std::pair; using std::pair;
Menubar::Pimpl::Pimpl(LyXView * view, MenuBackend const & mbe) Menubar::Pimpl::Pimpl(LyXView * view, MenuBackend const & mbe)
: owner_(static_cast<QtView*>(view)), menubackend_(mbe) : owner_(static_cast<QtView*>(view)), menubackend_(mbe)
{ {

View File

@ -35,7 +35,7 @@ public:
void openByName(string const &); void openByName(string const &);
/// update the state of the menuitems - not needed /// update the state of the menuitems - not needed
void update() {}; void update() {}
/// return the owning view /// return the owning view
QtView * view() { return owner_; } QtView * view() { return owner_; }

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 Kalle Dalheimer * \author Kalle Dalheimer
* *
* Full author contact details are available in file CREDITS * Full author contact details are available in file CREDITS
*/ */
@ -21,7 +21,7 @@
#include "LyXView.h" #include "LyXView.h"
#include "ButtonControllerBase.h" #include "ButtonControllerBase.h"
#include "ControlAboutlyx.h" #include "ControlAboutlyx.h"
#include <qlabel.h> #include <qlabel.h>
#include <qpushbutton.h> #include <qpushbutton.h>
#include <qtextview.h> #include <qtextview.h>
@ -34,6 +34,7 @@ using std::getline;
typedef Qt2CB<ControlAboutlyx, Qt2DB<QAboutDialog> > base_class; typedef Qt2CB<ControlAboutlyx, Qt2DB<QAboutDialog> > base_class;
QAbout::QAbout() QAbout::QAbout()
: base_class(_("About LyX")) : base_class(_("About LyX"))
{ {
@ -42,7 +43,7 @@ QAbout::QAbout()
void QAbout::build_dialog() void QAbout::build_dialog()
{ {
dialog_.reset(new QAboutDialog()); dialog_.reset(new QAboutDialog);
connect(dialog_.get()->closePB, SIGNAL(clicked()), connect(dialog_.get()->closePB, SIGNAL(clicked()),
this, SLOT(slotClose())); this, SLOT(slotClose()));
@ -54,32 +55,59 @@ void QAbout::build_dialog()
dialog_->versionLA->setText(controller().getVersion().c_str()); dialog_->versionLA->setText(controller().getVersion().c_str());
stringstream in; // The code below should depend on a autoconf test. (Lgb)
#if 0
// There are a lot of buggy stringstream implementations..., but the
// code below will work on all of them (I hope). The drawback with
// this solutions os the extra copying. (Lgb)
ostringstream in;
controller().getCredits(in); controller().getCredits(in);
istringstream ss(in.str().c_str()); istringstream ss(in.str().c_str());
string s; string s;
string out; ostringstream out;
while (getline(ss, s)) { while (getline(ss, s)) {
if (prefixIs(s, "@b")) if (prefixIs(s, "@b"))
out += "<b>" + s.substr(2) + "</b>"; out << "<b>" << s.substr(2) << "</b>";
else if (prefixIs(s, "@i")) else if (prefixIs(s, "@i"))
out += "<i>" + s.substr(2) + "</i>"; out << "<i>" << s.substr(2) << "</i>";
else else
out += s; out << s;
out += "<br>"; out << "<br>";
} }
#else
// Good stringstream implementations can handle this. It avoids
// some copying, and should thus be faster and use less memory. (Lgb)
// I'll make this the default for a short while to see if anyone
// see the error...
stringstream in;
controller().getCredits(in);
in.seekg(0);
string s;
ostringstream out;
dialog_->creditsTV->setText(out.c_str()); while (getline(in, s)) {
if (prefixIs(s, "@b"))
out << "<b>" << s.substr(2) << "</b>";
else if (prefixIs(s, "@i"))
out << "<i>" << s.substr(2) << "</i>";
else
out << s;
out << "<br>";
}
#endif
dialog_->creditsTV->setText(out.str().c_str());
// try to resize to a good size // try to resize to a good size
dialog_->copyright->hide(); dialog_->copyright->hide();
dialog_->setMinimumSize(dialog_->copyright->sizeHint()); dialog_->setMinimumSize(dialog_->copyright->sizeHint());
dialog_->copyright->show(); dialog_->copyright->show();
dialog_->setMinimumSize(dialog_->sizeHint()); dialog_->setMinimumSize(dialog_->sizeHint());
// Manage the cancel/close button // Manage the cancel/close button
bc().setCancel(dialog_->closePB); bc().setCancel(dialog_->closePB);
bc().refresh(); bc().refresh();

View File

@ -26,7 +26,6 @@ class QAbout
{ {
public: public:
QAbout(); QAbout();
private: private:
/// not needed /// not needed
virtual void apply() {} virtual void apply() {}

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 Kalle Dalheimer * \author Kalle Dalheimer
* *
* Full author contact details are available in file CREDITS * Full author contact details are available in file CREDITS
*/ */
@ -16,7 +16,9 @@
#include "QAboutDialog.h" #include "QAboutDialog.h"
QAboutDialog::QAboutDialog(QWidget * parent, const char * name, bool modal, WFlags fl)
QAboutDialog::QAboutDialog(QWidget * parent, char const * name,
bool modal, WFlags fl)
: QAboutDialogBase(parent, name, modal, fl) : QAboutDialogBase(parent, name, modal, fl)
{ {
} }

View File

@ -18,11 +18,11 @@
#include "ui/QAboutDialogBase.h" #include "ui/QAboutDialogBase.h"
class QAboutDialog : public QAboutDialogBase class QAboutDialog : public QAboutDialogBase {
{ Q_OBJECT
Q_OBJECT
public: public:
QAboutDialog(QWidget * parent = 0, const char * name = 0, bool modal = FALSE, WFlags fl = 0); QAboutDialog(QWidget * parent = 0, const char * name = 0,
bool modal = FALSE, WFlags fl = 0);
~QAboutDialog(); ~QAboutDialog();
}; };

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 John Levon * \author John Levon
* *
* Full author contact details are available in file CREDITS * Full author contact details are available in file CREDITS
*/ */
@ -26,9 +26,10 @@
#include "QBibitemDialog.h" #include "QBibitemDialog.h"
#include "QBibitem.h" #include "QBibitem.h"
#include "Qt2BC.h" #include "Qt2BC.h"
typedef Qt2CB<ControlBibitem, Qt2DB<QBibitemDialog> > base_class; typedef Qt2CB<ControlBibitem, Qt2DB<QBibitemDialog> > base_class;
QBibitem::QBibitem() QBibitem::QBibitem()
: base_class(_("Bibliography Item")) : base_class(_("Bibliography Item"))
{ {

View File

@ -21,17 +21,15 @@
class ControlBibitem; class ControlBibitem;
class QBibitemDialog; class QBibitemDialog;
class QBibitem : class QBibitem
public Qt2CB<ControlBibitem, Qt2DB<QBibitemDialog> > : public Qt2CB<ControlBibitem, Qt2DB<QBibitemDialog> >
{ {
public:
friend class QBibitemDialog; friend class QBibitemDialog;
public:
QBibitem(); QBibitem();
protected: protected:
virtual bool isValid(); virtual bool isValid();
private: private:
/// Apply changes /// Apply changes
virtual void apply(); virtual void apply();

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 John Levon * \author John Levon
* *
* Full author contact details are available in file CREDITS * Full author contact details are available in file CREDITS
*/ */
@ -21,7 +21,8 @@
#include "QBibitemDialog.h" #include "QBibitemDialog.h"
#include "QBibitem.h" #include "QBibitem.h"
QBibitemDialog::QBibitemDialog(QBibitem * form) QBibitemDialog::QBibitemDialog(QBibitem * form)
: QBibitemDialogBase(0, 0, false, 0), : QBibitemDialogBase(0, 0, false, 0),
form_(form) form_(form)

View File

@ -20,19 +20,14 @@
class QBibitem; class QBibitem;
class QBibitemDialog : public QBibitemDialogBase class QBibitemDialog : public QBibitemDialogBase {
{ Q_OBJECT Q_OBJECT
public: public:
QBibitemDialog(QBibitem * form); QBibitemDialog(QBibitem * form);
protected slots: protected slots:
virtual void change_adaptor(); virtual void change_adaptor();
protected: protected:
virtual void closeEvent(QCloseEvent * e); virtual void closeEvent(QCloseEvent * e);
private: private:
QBibitem * form_; QBibitem * form_;
}; };

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 John Levon * \author John Levon
* *
* Full author contact details are available in file CREDITS * Full author contact details are available in file CREDITS
*/ */
@ -19,8 +19,10 @@
#include "ControlBibtex.h" #include "ControlBibtex.h"
#include "gettext.h" #include "gettext.h"
#include "debug.h" #include "debug.h"
#include "support/filetools.h" // ChangeExtension #include "support/filetools.h" // ChangeExtension
#include "support/lstrings.h" // getVectorFromString #include "support/lstrings.h" // getVectorFromString
#include <qlineedit.h> #include <qlineedit.h>
#include <qcombobox.h> #include <qcombobox.h>
#include <qpushbutton.h> #include <qpushbutton.h>
@ -35,6 +37,7 @@ using std::vector;
typedef Qt2CB<ControlBibtex, Qt2DB<QBibtexDialog> > base_class; typedef Qt2CB<ControlBibtex, Qt2DB<QBibtexDialog> > base_class;
QBibtex::QBibtex() QBibtex::QBibtex()
: base_class(_("BibTeX")) : base_class(_("BibTeX"))
{ {
@ -82,7 +85,7 @@ void QBibtex::update_contents()
if (contains(bibstyle,',')) if (contains(bibstyle,','))
bibstyle = split(bibstyle, bibtotoc, ','); bibstyle = split(bibstyle, bibtotoc, ',');
else else
bibstyle = ""; bibstyle.erase();
} else } else
dialog_->bibtocCB->setChecked(false); dialog_->bibtocCB->setChecked(false);
@ -91,7 +94,7 @@ void QBibtex::update_contents()
controller().getBibStyles(),"\n"); controller().getBibStyles(),"\n");
for (vector<string>::const_iterator it = str.begin(); for (vector<string>::const_iterator it = str.begin();
it != str.end(); ++it) { it != str.end(); ++it) {
dialog_->styleCB->insertItem(ChangeExtension(*it,"").c_str()); dialog_->styleCB->insertItem(ChangeExtension(*it, "").c_str());
} }
dialog_->styleCB->insertItem(bibstyle.c_str(),0); dialog_->styleCB->insertItem(bibstyle.c_str(),0);
} }

View File

@ -21,17 +21,15 @@
class ControlBibtex; class ControlBibtex;
class QBibtexDialog; class QBibtexDialog;
class QBibtex : class QBibtex
public Qt2CB<ControlBibtex, Qt2DB<QBibtexDialog> > : public Qt2CB<ControlBibtex, Qt2DB<QBibtexDialog> >
{ {
public:
friend class QBibtexDialog; friend class QBibtexDialog;
public:
QBibtex(); QBibtex();
protected: protected:
virtual bool isValid(); virtual bool isValid();
private: private:
/// Apply changes /// Apply changes
virtual void apply(); virtual void apply();

View File

@ -14,7 +14,6 @@
#pragma implementation #pragma implementation
#endif #endif
#include <vector>
#include "ControlBibtex.h" #include "ControlBibtex.h"
#include "gettext.h" #include "gettext.h"
#include "debug.h" #include "debug.h"
@ -32,6 +31,9 @@
#include "QBibtexDialog.h" #include "QBibtexDialog.h"
#include "QBibtex.h" #include "QBibtex.h"
#include <vector>
QBibtexDialog::QBibtexDialog(QBibtex * form) QBibtexDialog::QBibtexDialog(QBibtex * form)
: QBibtexDialogBase(0, 0, false, 0), : QBibtexDialogBase(0, 0, false, 0),
form_(form) form_(form)
@ -90,7 +92,7 @@ void QBibtexDialog::deletePressed()
} }
void QBibtexDialog::styleChanged(const QString & sel) void QBibtexDialog::styleChanged(QString const & sel)
{ {
styleCB->insertItem(sel,0); styleCB->insertItem(sel,0);
} }

View File

@ -20,13 +20,10 @@
class QBibtex; class QBibtex;
class QBibtexDialog : public QBibtexDialogBase class QBibtexDialog : public QBibtexDialogBase {
{
Q_OBJECT Q_OBJECT
public: public:
QBibtexDialog(QBibtex * form); QBibtexDialog(QBibtex * form);
protected slots: protected slots:
virtual void change_adaptor(); virtual void change_adaptor();
virtual void browsePressed(); virtual void browsePressed();
@ -34,10 +31,8 @@ protected slots:
virtual void deletePressed(); virtual void deletePressed();
virtual void styleChanged(const QString &); virtual void styleChanged(const QString &);
virtual void databaseChanged(); virtual void databaseChanged();
protected: protected:
virtual void closeEvent(QCloseEvent * e); virtual void closeEvent(QCloseEvent * e);
private: private:
QBibtex * form_; QBibtex * form_;
}; };

View File

@ -2,13 +2,14 @@
* \file QBrowseBox.C * \file QBrowseBox.C
* *
* Original file taken from klyx 0.10 sources: * Original file taken from klyx 0.10 sources:
* $Id: QBrowseBox.C,v 1.5 2002/10/17 13:31:04 leeming Exp $ * $Id: QBrowseBox.C,v 1.6 2002/10/20 01:48:27 larsbj Exp $
* *
* \author Kalle Dalheimer ? * \author Kalle Dalheimer ?
* *
* Full author contact details are available in file CREDITS * Full author contact details are available in file CREDITS
*/ */
#include <config.h>
#include <qstring.h> #include <qstring.h>
#include <qpixmap.h> #include <qpixmap.h>
@ -19,11 +20,11 @@
#include <qstyle.h> #include <qstyle.h>
#include <qimage.h> #include <qimage.h>
#include <stdio.h>
#include <math.h>
#include "QBrowseBox.h" #include "QBrowseBox.h"
#include <cstdio>
#include <cmath>
QBrowseBox::QBrowseBox(int rows, int cols) QBrowseBox::QBrowseBox(int rows, int cols)
: QGridView() : QGridView()
@ -182,19 +183,19 @@ void QBrowseBox::paintCell(QPainter * painter, int row, int col)
if (activecell_.x() == row && activecell_.y() == col) { if (activecell_.x() == row && activecell_.y() == col) {
if (ispixmap) if (ispixmap)
qDrawShadeRect(painter, 0, 0, cellWidth(), qDrawShadeRect(painter, 0, 0, cellWidth(),
cellHeight(), colorGroup(), false, 1); cellHeight(), colorGroup(), false, 1);
else else
qDrawShadePanel(painter, 0, 0, cellWidth(), qDrawShadePanel(painter, 0, 0, cellWidth(),
cellHeight(), colorGroup(), false, 1); cellHeight(), colorGroup(), false, 1);
} else { } else {
qDrawPlainRect(painter, 0, 0, cellWidth(), qDrawPlainRect(painter, 0, 0, cellWidth(),
cellHeight(), colorGroup().background(), 1); cellHeight(), colorGroup().background(), 1);
} }
if (!texts_[coordsToIndex(row, col)].isEmpty()) { if (!texts_[coordsToIndex(row, col)].isEmpty()) {
painter->drawText(0, 0, cellWidth(), painter->drawText(0, 0, cellWidth(),
cellHeight(), AlignLeft, cellHeight(), AlignLeft,
texts_[coordsToIndex(row, col)]); texts_[coordsToIndex(row, col)]);
} }
painter->setClipping(false); painter->setClipping(false);
} }
@ -290,4 +291,3 @@ void QBrowseBox::moveDown()
updateCell(x, activecell_.y()); updateCell(x, activecell_.y());
updateCell(activecell_.x(), activecell_.y()); updateCell(activecell_.x(), activecell_.y());
} }

View File

@ -3,7 +3,7 @@
* \file QBrowseBox.h * \file QBrowseBox.h
* *
* Original file taken from klyx 0.10 sources: * Original file taken from klyx 0.10 sources:
* $Id: QBrowseBox.h,v 1.3 2002/10/17 13:31:04 leeming Exp $ * $Id: QBrowseBox.h,v 1.4 2002/10/20 01:48:27 larsbj Exp $
* *
* \author Kalle Dalheimer ? * \author Kalle Dalheimer ?
* *
@ -25,52 +25,49 @@ class QPixmap;
class QBrowseBox : public QGridView class QBrowseBox : public QGridView
{ {
Q_OBJECT Q_OBJECT
public: public:
QBrowseBox(int rows, int cols); QBrowseBox(int rows, int cols);
~QBrowseBox(); ~QBrowseBox();
void insertItem(QString const & text, int x, int y); void insertItem(QString const & text, int x, int y);
void insertItem(char const * text, int x, int y); void insertItem(char const * text, int x, int y);
void insertItem(QPixmap pixmap, int x, int y); void insertItem(QPixmap pixmap, int x, int y);
void insertItem(QPixmap pixmap); void insertItem(QPixmap pixmap);
void removeItem(int x, int y); void removeItem(int x, int y);
void clear(); void clear();
QString text(int x, int y); QString text(int x, int y);
QPixmap pixmap(int x, int y); QPixmap pixmap(int x, int y);
// int exec(QPoint const & pos); // int exec(QPoint const & pos);
// int exec(int x, int y); // int exec(int x, int y);
// int exec(QWidget * trigger); // int exec(QWidget * trigger);
signals: signals:
void selected(int, int); void selected(int, int);
protected: protected:
virtual void keyPressEvent(QKeyEvent * e); virtual void keyPressEvent(QKeyEvent * e);
virtual void resizeEvent(QResizeEvent * e); virtual void resizeEvent(QResizeEvent * e);
virtual void mouseReleaseEvent(QMouseEvent * e); virtual void mouseReleaseEvent(QMouseEvent * e);
// virtual void closeEvent(QCloseEvent * e); // virtual void closeEvent(QCloseEvent * e);
virtual void mouseMoveEvent(QMouseEvent * e); virtual void mouseMoveEvent(QMouseEvent * e);
virtual void paintCell(QPainter *, int x, int y); virtual void paintCell(QPainter *, int x, int y);
private: private:
// make sure the automatically generated one is not used // make sure the automatically generated one is not used
QBrowseBox & operator=(QBrowseBox const &); QBrowseBox & operator=(QBrowseBox const &);
void moveLeft(); void moveLeft();
void moveRight(); void moveRight();
void moveUp(); void moveUp();
void moveDown(); void moveDown();
int coordsToIndex(int x, int y); int coordsToIndex(int x, int y);
QString * texts_; QString * texts_;
QPixmap* pixmaps_; QPixmap* pixmaps_;
QPoint activecell_; QPoint activecell_;
}; };
#endif #endif

View File

@ -34,6 +34,7 @@ using std::vector;
typedef Qt2CB<ControlCharacter, Qt2DB<QCharacterDialog> > base_class; typedef Qt2CB<ControlCharacter, Qt2DB<QCharacterDialog> > base_class;
QCharacter::QCharacter() QCharacter::QCharacter()
: base_class(_("Character")) : base_class(_("Character"))
{ {
@ -56,6 +57,7 @@ void QCharacter::build_dialog()
cit != family.end(); ++cit) { cit != family.end(); ++cit) {
dialog_->familyCO->insertItem(cit->first.c_str(), -1); dialog_->familyCO->insertItem(cit->first.c_str(), -1);
} }
for (vector<SeriesPair>::const_iterator cit = series.begin(); for (vector<SeriesPair>::const_iterator cit = series.begin();
cit != series.end(); ++cit) { cit != series.end(); ++cit) {
dialog_->seriesCO->insertItem(cit->first.c_str(), -1); dialog_->seriesCO->insertItem(cit->first.c_str(), -1);
@ -117,27 +119,34 @@ int findPos2nd(vector<std::pair<A,B> > const & vec, B const & val)
void QCharacter::update_contents() void QCharacter::update_contents()
{ {
dialog_->familyCO->setCurrentItem(findPos2nd(family, controller().getFamily())); ControlCharacter const & ctrl = controller();
dialog_->seriesCO->setCurrentItem(findPos2nd(series, controller().getSeries()));
dialog_->shapeCO->setCurrentItem(findPos2nd(shape, controller().getShape()));
dialog_->sizeCO->setCurrentItem(findPos2nd(size, controller().getSize()));
dialog_->miscCO->setCurrentItem(findPos2nd(bar, controller().getBar()));
dialog_->colorCO->setCurrentItem(findPos2nd(color, controller().getColor()));
dialog_->langCO->setCurrentItem(findPos2nd(language, controller().getLanguage()));
dialog_->toggleallCB->setChecked(controller().getToggleAll()); dialog_->familyCO->setCurrentItem(findPos2nd(family,
ctrl.getFamily()));
dialog_->seriesCO->setCurrentItem(findPos2nd(series,
ctrl.getSeries()));
dialog_->shapeCO->setCurrentItem(findPos2nd(shape, ctrl.getShape()));
dialog_->sizeCO->setCurrentItem(findPos2nd(size, ctrl.getSize()));
dialog_->miscCO->setCurrentItem(findPos2nd(bar, ctrl.getBar()));
dialog_->colorCO->setCurrentItem(findPos2nd(color, ctrl.getColor()));
dialog_->langCO->setCurrentItem(findPos2nd(language,
ctrl.getLanguage()));
dialog_->toggleallCB->setChecked(ctrl.getToggleAll());
} }
void QCharacter::apply() void QCharacter::apply()
{ {
controller().setFamily(family[dialog_->familyCO->currentItem()].second); ControlCharacter & ctrl = controller();
controller().setSeries(series[dialog_->seriesCO->currentItem()].second);
controller().setShape(shape[dialog_->shapeCO->currentItem()].second);
controller().setSize(size[dialog_->sizeCO->currentItem()].second);
controller().setBar(bar[dialog_->miscCO->currentItem()].second);
controller().setColor(color[dialog_->colorCO->currentItem()].second);
controller().setLanguage(language[dialog_->langCO->currentItem()].second);
controller().setToggleAll(dialog_->toggleallCB->isChecked()); ctrl.setFamily(family[dialog_->familyCO->currentItem()].second);
ctrl.setSeries(series[dialog_->seriesCO->currentItem()].second);
ctrl.setShape(shape[dialog_->shapeCO->currentItem()].second);
ctrl.setSize(size[dialog_->sizeCO->currentItem()].second);
ctrl.setBar(bar[dialog_->miscCO->currentItem()].second);
ctrl.setColor(color[dialog_->colorCO->currentItem()].second);
ctrl.setLanguage(language[dialog_->langCO->currentItem()].second);
ctrl.setToggleAll(dialog_->toggleallCB->isChecked());
} }

View File

@ -22,6 +22,7 @@
#include "controllers/frnt_lang.h" #include "controllers/frnt_lang.h"
#include "LString.h" #include "LString.h"
#include <vector> #include <vector>
@ -29,14 +30,13 @@ class ControlCharacter;
class QCharacterDialog; class QCharacterDialog;
class QCharacter : class QCharacter
public Qt2CB<ControlCharacter, Qt2DB<QCharacterDialog> > : public Qt2CB<ControlCharacter, Qt2DB<QCharacterDialog> >
{ {
public:
friend class QCharacterDialog; friend class QCharacterDialog;
public:
QCharacter(); QCharacter();
private: private:
/// Apply changes /// Apply changes
virtual void apply(); virtual void apply();

View File

@ -21,6 +21,7 @@
#include <qpushbutton.h> #include <qpushbutton.h>
#include <qgroupbox.h> #include <qgroupbox.h>
QCharacterDialog::QCharacterDialog(QCharacter * form) QCharacterDialog::QCharacterDialog(QCharacter * form)
: QCharacterDialogBase(0, 0, false, 0), : QCharacterDialogBase(0, 0, false, 0),
form_(form) form_(form)

View File

@ -26,18 +26,14 @@
class LyXFont; class LyXFont;
class QCharacterDialog : public QCharacterDialogBase class QCharacterDialog : public QCharacterDialogBase {
{ Q_OBJECT Q_OBJECT
public: public:
QCharacterDialog(QCharacter * form); QCharacterDialog(QCharacter * form);
protected: protected:
void closeEvent(QCloseEvent * e); void closeEvent(QCloseEvent * e);
private: private:
QCharacter * form_; QCharacter * form_;
protected slots: protected slots:
void change_adaptor(); void change_adaptor();
}; };

View File

@ -3,8 +3,8 @@
* 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 Angus Leeming * \author Angus Leeming
* \author Kalle Dalheimer * \author Kalle Dalheimer
* *
* Full author contact details are available in file CREDITS * Full author contact details are available in file CREDITS
*/ */
@ -43,6 +43,7 @@ using std::vector;
typedef Qt2CB<ControlCitation, Qt2DB<QCitationDialog> > base_class; typedef Qt2CB<ControlCitation, Qt2DB<QCitationDialog> > base_class;
QCitation::QCitation() QCitation::QCitation()
: base_class(_("Citation")) : base_class(_("Citation"))
{} {}
@ -63,7 +64,7 @@ void QCitation::apply()
controller().params().setCmdName(command); controller().params().setCmdName(command);
controller().params().setContents(getStringFromVector(citekeys)); controller().params().setContents(getStringFromVector(citekeys));
string const after = dialog_->textAfterED->text().latin1(); string const after = dialog_->textAfterED->text().latin1();
controller().params().setOptions(after); controller().params().setOptions(after);
} }
@ -174,7 +175,7 @@ void QCitation::update_contents()
} }
void QCitation::updateBrowser(QListBox* browser, void QCitation::updateBrowser(QListBox * browser,
vector<string> const & keys) const vector<string> const & keys) const
{ {
browser->clear(); browser->clear();

View File

@ -24,14 +24,13 @@ class ControlCitation;
class QCitationDialog; class QCitationDialog;
class QCitation : public Qt2CB<ControlCitation, Qt2DB<QCitationDialog> > class QCitation
: public Qt2CB<ControlCitation, Qt2DB<QCitationDialog> >
{ {
friend class QCitationDialog;
public: public:
friend class QCitationDialog;
/// ///
QCitation(); QCitation();
private: private:
/// ///
enum State { enum State {

View File

@ -36,6 +36,7 @@ using std::vector;
using std::find; using std::find;
using std::max; using std::max;
QCitationDialog::QCitationDialog(QCitation * form) QCitationDialog::QCitationDialog(QCitation * form)
: QCitationDialogBase(0, 0, false, 0), : QCitationDialogBase(0, 0, false, 0),
form_(form) form_(form)

View File

@ -21,13 +21,11 @@
class QCitation; class QCitation;
class QCitationDialog : public QCitationDialogBase class QCitationDialog : public QCitationDialogBase {
{ Q_OBJECT Q_OBJECT
public: public:
QCitationDialog(QCitation * form); QCitationDialog(QCitation * form);
~QCitationDialog(); ~QCitationDialog();
protected slots: protected slots:
virtual void slotBibHighlighted(int sel); virtual void slotBibHighlighted(int sel);
virtual void slotBibSelected(int sel); virtual void slotBibSelected(int sel);
@ -39,10 +37,8 @@ protected slots:
virtual void slotPreviousClicked(); virtual void slotPreviousClicked();
virtual void slotNextClicked(); virtual void slotNextClicked();
virtual void changed_adaptor(); virtual void changed_adaptor();
private: private:
void doFind(biblio::Direction dir); void doFind(biblio::Direction dir);
private: private:
QCitation * form_; QCitation * form_;
}; };

View File

@ -38,14 +38,13 @@ class QTempListBox : public QListBox {
public: public:
QTempListBox() QTempListBox()
: QListBox(0, 0, : QListBox(0, 0,
WType_Modal | WType_Popup | WDestructiveClose) { WType_Modal | WType_Popup | WDestructiveClose) {
setHScrollBarMode(AlwaysOff); setHScrollBarMode(AlwaysOff);
} }
protected: protected:
void mouseReleaseEvent(QMouseEvent * e) { void mouseReleaseEvent(QMouseEvent * e) {
if (e->x() < 0 || e->y() < 0 if (e->x() < 0 || e->y() < 0
|| e->x() > width() || e->y() > height()) { || e->x() > width() || e->y() > height()) {
hide(); hide();
} else { } else {
emit selected(currentText()); emit selected(currentText());
@ -61,7 +60,8 @@ protected:
} }
}; };
} } // end of anon
QCommandBuffer::QCommandBuffer(QtView * view, ControlCommandBuffer & control) QCommandBuffer::QCommandBuffer(QtView * view, ControlCommandBuffer & control)
: QToolBar(view), view_(view), controller_(control) : QToolBar(view), view_(view), controller_(control)
@ -70,11 +70,8 @@ QCommandBuffer::QCommandBuffer(QtView * view, ControlCommandBuffer & control)
QPixmap qp(LibFileSearch("images", "unknown", "xpm").c_str()); QPixmap qp(LibFileSearch("images", "unknown", "xpm").c_str());
QToolButton * upb = new QToolButton(qp, _("Up"), "", this, SLOT(up()), this); (new QToolButton(qp, _("Up"), "", this, SLOT(up()), this))->show();
upb->show(); (new QToolButton(qp, _("Down"), "", this, SLOT(down()), this))->show();
QToolButton * downb = new QToolButton(qp, _("Down"), "", this, SLOT(down()), this);
downb->show();
edit_ = new QCommandEdit(this); edit_ = new QCommandEdit(this);
edit_->setMinimumSize(edit_->sizeHint()); edit_->setMinimumSize(edit_->sizeHint());
@ -132,7 +129,7 @@ void QCommandBuffer::complete()
edit_->setText(new_input.c_str()); edit_->setText(new_input.c_str());
QTempListBox * list = new QTempListBox(); QTempListBox * list = new QTempListBox;
// For some reason the scrollview's contents are larger // For some reason the scrollview's contents are larger
// than the number of actual items... // than the number of actual items...
@ -147,9 +144,9 @@ void QCommandBuffer::complete()
list->resize(list->sizeHint()); list->resize(list->sizeHint());
QPoint pos(edit_->mapToGlobal(QPoint(0, 0))); QPoint pos(edit_->mapToGlobal(QPoint(0, 0)));
int y = pos.y() - list->height();
if (y < 0) int y = std::max(0, pos.y() - list->height());
y = 0;
list->move(pos.x(), y); list->move(pos.x(), y);
connect(list, SIGNAL(selected(const QString &)), connect(list, SIGNAL(selected(const QString &)),
@ -160,7 +157,7 @@ void QCommandBuffer::complete()
} }
void QCommandBuffer::complete_selected(const QString & str) void QCommandBuffer::complete_selected(QString const & str)
{ {
edit_->setText(str + " "); edit_->setText(str + " ");
QWidget const * widget = static_cast<QWidget const *>(sender()); QWidget const * widget = static_cast<QWidget const *>(sender());
@ -170,7 +167,7 @@ void QCommandBuffer::complete_selected(const QString & str)
void QCommandBuffer::up() void QCommandBuffer::up()
{ {
string const input = edit_->text().latin1(); string const input(edit_->text().latin1());
string const h(controller_.historyUp()); string const h(controller_.historyUp());
if (h.empty()) { if (h.empty()) {
@ -183,7 +180,7 @@ void QCommandBuffer::up()
void QCommandBuffer::down() void QCommandBuffer::down()
{ {
string const input = edit_->text().latin1(); string const input(edit_->text().latin1());
string const h(controller_.historyDown()); string const h(controller_.historyDown());
if (h.empty()) { if (h.empty()) {

View File

@ -26,12 +26,10 @@ class ControlCommandBuffer;
class QCommandBuffer : public QToolBar { class QCommandBuffer : public QToolBar {
Q_OBJECT Q_OBJECT
public: public:
QCommandBuffer(QtView * view, ControlCommandBuffer & control); QCommandBuffer(QtView * view, ControlCommandBuffer & control);
/// focus the edit widget /// focus the edit widget
void focus_command(); void focus_command();
public slots: public slots:
/// cancel command compose /// cancel command compose
void cancel(); void cancel();
@ -40,12 +38,11 @@ public slots:
/// tab-complete /// tab-complete
void complete(); void complete();
/// select-complete /// select-complete
void complete_selected(const QString & str); void complete_selected(QString const & str);
/// up /// up
void up(); void up();
/// down /// down
void down(); void down();
private: private:
/// owning view /// owning view
QtView * view_; QtView * view_;

View File

@ -3,44 +3,47 @@
* 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 John Levon * \author John Levon
* *
* Full author contact details are available in file CREDITS * Full author contact details are available in file CREDITS
*/ */
#include <config.h>
#include "QCommandEdit.h" #include "QCommandEdit.h"
QCommandEdit::QCommandEdit(QWidget * parent) QCommandEdit::QCommandEdit(QWidget * parent)
: QLineEdit(parent) : QLineEdit(parent)
{ {
setFocusPolicy(QWidget::ClickFocus); setFocusPolicy(QWidget::ClickFocus);
} }
void QCommandEdit::keyPressEvent(QKeyEvent * e) void QCommandEdit::keyPressEvent(QKeyEvent * e)
{ {
switch (e->key()) { switch (e->key()) {
case Key_Escape: case Key_Escape:
emit escapePressed(); emit escapePressed();
break; break;
case Key_Up: case Key_Up:
emit upPressed(); emit upPressed();
break; break;
case Key_Down: case Key_Down:
emit downPressed(); emit downPressed();
break; break;
case Key_Right: case Key_Right:
if (cursorPosition() == text().length()) if (cursorPosition() == text().length())
emit rightPressed(); emit rightPressed();
else else
QLineEdit::keyPressEvent(e);
break;
default:
QLineEdit::keyPressEvent(e); QLineEdit::keyPressEvent(e);
break; break;
default:
QLineEdit::keyPressEvent(e);
break;
} }
} }

View File

@ -17,9 +17,7 @@
class QCommandEdit : public QLineEdit { class QCommandEdit : public QLineEdit {
Q_OBJECT Q_OBJECT
public: public:
QCommandEdit(QWidget * parent); QCommandEdit(QWidget * parent);
signals: signals:
/// cancel /// cancel
void escapePressed(); void escapePressed();
@ -32,7 +30,6 @@ signals:
/// complete /// complete
void rightPressed(); void rightPressed();
protected: protected:
virtual void keyPressEvent(QKeyEvent * e); virtual void keyPressEvent(QKeyEvent * e);
}; };

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 John Levon * \author John Levon
* *
* Full author contact details are available in file CREDITS * Full author contact details are available in file CREDITS
*/ */
@ -24,11 +24,11 @@
#include <qpainter.h> #include <qpainter.h>
#include <qtimer.h> #include <qtimer.h>
#include <qapplication.h> #include <qapplication.h>
using std::endl; using std::endl;
namespace { namespace {
/// return the LyX key state from Qt's /// return the LyX key state from Qt's
key_modifier::state q_key_state(Qt::ButtonState state) key_modifier::state q_key_state(Qt::ButtonState state)
{ {
@ -42,6 +42,7 @@ key_modifier::state q_key_state(Qt::ButtonState state)
return k; return k;
} }
/// return the LyX mouse button state from Qt's /// return the LyX mouse button state from Qt's
mouse_button::state q_button_state(Qt::ButtonState button) mouse_button::state q_button_state(Qt::ButtonState button)
{ {
@ -61,8 +62,8 @@ mouse_button::state q_button_state(Qt::ButtonState button)
} }
return b; return b;
} }
/// return the LyX mouse button state from Qt's /// return the LyX mouse button state from Qt's
mouse_button::state q_motion_state(Qt::ButtonState state) mouse_button::state q_motion_state(Qt::ButtonState state)
{ {
@ -77,28 +78,28 @@ mouse_button::state q_motion_state(Qt::ButtonState state)
} }
} // namespace anon } // namespace anon
QContentPane::QContentPane(QWorkArea * parent) QContentPane::QContentPane(QWorkArea * parent)
: QWidget(parent, "content_pane", WRepaintNoErase), : QWidget(parent, "content_pane", WRepaintNoErase),
wa_(parent) wa_(parent)
{ {
setFocusPolicy(QWidget::WheelFocus); setFocusPolicy(QWidget::WheelFocus);
setFocus(); setFocus();
// stupid moc strikes again // stupid moc strikes again
connect(wa_->scrollbar_, SIGNAL(valueChanged(int)), connect(wa_->scrollbar_, SIGNAL(valueChanged(int)),
this, SLOT(scrollBarChanged(int))); this, SLOT(scrollBarChanged(int)));
} }
void QContentPane::scrollBarChanged(int val) void QContentPane::scrollBarChanged(int val)
{ {
wa_->scrollDocView(val); wa_->scrollDocView(val);
} }
void QContentPane::mousePressEvent(QMouseEvent * e) void QContentPane::mousePressEvent(QMouseEvent * e)
{ {
if (dc_event_.active && dc_event_ == *e) { if (dc_event_.active && dc_event_ == *e) {
@ -109,21 +110,21 @@ void QContentPane::mousePressEvent(QMouseEvent * e)
wa_->dispatch(cmd); wa_->dispatch(cmd);
return; return;
} }
FuncRequest cmd FuncRequest cmd(LFUN_MOUSE_PRESS, e->x(), e->y(),
(LFUN_MOUSE_PRESS, e->x(), e->y(), q_button_state(e->button())); q_button_state(e->button()));
wa_->dispatch(cmd); wa_->dispatch(cmd);
} }
void QContentPane::mouseReleaseEvent(QMouseEvent * e) void QContentPane::mouseReleaseEvent(QMouseEvent * e)
{ {
FuncRequest cmd FuncRequest cmd(LFUN_MOUSE_RELEASE, e->x(), e->y(),
(LFUN_MOUSE_RELEASE, e->x(), e->y(), q_button_state(e->button())); q_button_state(e->button()));
wa_->dispatch(cmd); wa_->dispatch(cmd);
} }
void QContentPane::mouseMoveEvent(QMouseEvent * e) void QContentPane::mouseMoveEvent(QMouseEvent * e)
{ {
FuncRequest cmd FuncRequest cmd
@ -142,14 +143,14 @@ void QContentPane::keyPressEvent(QKeyEvent * e)
wa_->workAreaKeyPress(LyXKeySymPtr(sym), q_key_state(e->state())); wa_->workAreaKeyPress(LyXKeySymPtr(sym), q_key_state(e->state()));
} }
void QContentPane::doubleClickTimeout() void QContentPane::doubleClickTimeout()
{ {
if (!dc_event_.active) if (!dc_event_.active)
return; return;
dc_event_.active = false; dc_event_.active = false;
FuncRequest cmd(LFUN_MOUSE_DOUBLE, FuncRequest cmd(LFUN_MOUSE_DOUBLE,
dc_event_.x, dc_event_.y, dc_event_.x, dc_event_.y,
q_button_state(dc_event_.state)); q_button_state(dc_event_.state));
@ -165,8 +166,8 @@ void QContentPane::mouseDoubleClickEvent(QMouseEvent * e)
QTimer::singleShot(int(QApplication::doubleClickInterval() / 1.5), QTimer::singleShot(int(QApplication::doubleClickInterval() / 1.5),
this, SLOT(doubleClickTimeout())); this, SLOT(doubleClickTimeout()));
} }
void QContentPane::resizeEvent(QResizeEvent *) void QContentPane::resizeEvent(QResizeEvent *)
{ {
if (!pixmap_.get()) { if (!pixmap_.get()) {
@ -177,7 +178,7 @@ void QContentPane::resizeEvent(QResizeEvent *)
wa_->workAreaResize(); wa_->workAreaResize();
} }
void QContentPane::paintEvent(QPaintEvent * e) void QContentPane::paintEvent(QPaintEvent * e)
{ {
if (!pixmap_.get()) { if (!pixmap_.get()) {
@ -187,11 +188,11 @@ void QContentPane::paintEvent(QPaintEvent * e)
} }
QRect r(e->rect()); QRect r(e->rect());
lyxerr[Debug::GUI] << "repainting " << r.x() lyxerr[Debug::GUI] << "repainting " << r.x()
<< "," << r.y() << " " << r.width() << "," << r.y() << " " << r.width()
<< "," << r.height() << endl; << "," << r.height() << endl;
QPainter q(this); QPainter q(this);
q.drawPixmap(QPoint(r.x(), r.y()), q.drawPixmap(QPoint(r.x(), r.y()),
*pixmap_.get(), r); *pixmap_.get(), r);
} }

View File

@ -19,6 +19,7 @@
#include <qwidget.h> #include <qwidget.h>
#include <qevent.h> #include <qevent.h>
#include <qpixmap.h> #include <qpixmap.h>
#include <boost/scoped_ptr.hpp> #include <boost/scoped_ptr.hpp>
class QWorkArea; class QWorkArea;
@ -43,18 +44,17 @@ struct double_click {
state(e->button()), active(true) {} state(e->button()), active(true) {}
}; };
/** /**
* Widget for actually drawing the document on * Widget for actually drawing the document on
*/ */
class QContentPane : public QWidget { class QContentPane : public QWidget {
Q_OBJECT Q_OBJECT
public: public:
QContentPane(QWorkArea * parent); QContentPane(QWorkArea * parent);
/// return the backing pixmap /// return the backing pixmap
QPixmap * pixmap() const { return pixmap_.get(); } QPixmap * pixmap() const { return pixmap_.get(); }
protected: protected:
/// repaint part of the widget /// repaint part of the widget
void paintEvent(QPaintEvent * e); void paintEvent(QPaintEvent * e);
@ -72,12 +72,10 @@ protected:
/// key press /// key press
void keyPressEvent(QKeyEvent * e); void keyPressEvent(QKeyEvent * e);
public slots: public slots:
void doubleClickTimeout(); void doubleClickTimeout();
void scrollBarChanged(int); void scrollBarChanged(int);
private: private:
/// owning widget /// owning widget
QWorkArea * wa_; QWorkArea * wa_;

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 John Levon * \author John Levon
* *
* Full author contact details are available in file CREDITS * Full author contact details are available in file CREDITS
*/ */
@ -17,52 +17,68 @@
#include "support/filetools.h" #include "support/filetools.h"
#include "gettext.h" #include "gettext.h"
#include "debug.h" #include "debug.h"
#include "QMath.h" #include "QMath.h"
#include "QDelimiterDialog.h" #include "QDelimiterDialog.h"
#include "iconpalette.h" #include "iconpalette.h"
#include <qlabel.h> #include <qlabel.h>
#include <qpixmap.h> #include <qpixmap.h>
#include <qpushbutton.h> #include <qpushbutton.h>
#include <qcheckbox.h> #include <qcheckbox.h>
namespace {
char const * delim[] = {
"(", ")", "{", "}", "[", "]",
"lceil", "rceil", "lfloor", "rfloor", "langle", "rangle",
"uparrow", "Uparrow", "downarrow", "Downarrow",
"|", "Vert", "slash", "backslash", ""
};
string do_match(string str) { namespace {
if (str == "(") return ")";
if (str == ")") return "("; char const * delim[] = {
if (str == "[") return "]"; "(", ")", "{", "}", "[", "]",
if (str == "]") return "["; "lceil", "rceil", "lfloor", "rfloor", "langle", "rangle",
if (str == "{") return "}"; "uparrow", "Uparrow", "downarrow", "Downarrow",
if (str == "}") return "{"; "|", "Vert", "slash", "backslash", ""
if (str == "l") return "r"; };
if (str == "rceil") return "lceil";
if (str == "lceil") return "rceil";
if (str == "rfloor") return "lfloor"; string do_match(string const & str)
if (str == "lfloor") return "rfloor"; {
if (str == "rangle") return "langle"; if (str == "(") return ")";
if (str == "langle") return "rangle"; if (str == ")") return "(";
if (str == "backslash") return "slash"; if (str == "[") return "]";
if (str == "slash") return "backslash"; if (str == "]") return "[";
return str; if (str == "{") return "}";
} if (str == "}") return "{";
if (str == "l") return "r";
if (str == "rceil") return "lceil";
if (str == "lceil") return "rceil";
if (str == "rfloor") return "lfloor";
if (str == "lfloor") return "rfloor";
if (str == "rangle") return "langle";
if (str == "langle") return "rangle";
if (str == "backslash") return "slash";
if (str == "slash") return "backslash";
return str;
} }
string fix_name(string const & str)
{
if (str == "slash")
return "/";
if (str == "backslash")
return "\\";
if (str == "empty")
return ".";
return str;
}
} // namespace anon
QDelimiterDialog::QDelimiterDialog(QMath * form) QDelimiterDialog::QDelimiterDialog(QMath * form)
: QDelimiterDialogBase(0, 0, false, 0), : QDelimiterDialogBase(0, 0, false, 0),
form_(form) form_(form)
{ {
setCaption(_("LyX: Delimiters")); setCaption(_("LyX: Delimiters"));
for (int i = 0; *delim[i]; ++i) { for (int i = 0; *delim[i]; ++i) {
string xpm_name = LibFileSearch("images/math/", delim[i], "xpm"); string xpm_name = LibFileSearch("images/math/", delim[i], "xpm");
leftIP->add(QPixmap(xpm_name.c_str()), delim[i], delim[i]); leftIP->add(QPixmap(xpm_name.c_str()), delim[i], delim[i]);
@ -80,25 +96,13 @@ QDelimiterDialog::QDelimiterDialog(QMath * form)
rdelim_clicked(")"); rdelim_clicked(")");
} }
namespace {
string fix_name(string const & str) {
if (str == "slash")
return "/";
if (str == "backslash")
return "\\";
if (str == "empty")
return ".";
return str;
}
}
void QDelimiterDialog::insertClicked() void QDelimiterDialog::insertClicked()
{ {
form_->insertDelim(fix_name(left_) + " " + fix_name(right_)); form_->insertDelim(fix_name(left_) + " " + fix_name(right_));
} }
void QDelimiterDialog::set_label(QLabel * label, string const & str) void QDelimiterDialog::set_label(QLabel * label, string const & str)
{ {
string xpm_name = LibFileSearch("images/math/", str, "xpm"); string xpm_name = LibFileSearch("images/math/", str, "xpm");
@ -108,11 +112,11 @@ void QDelimiterDialog::set_label(QLabel * label, string const & str)
label->update(); label->update();
} }
void QDelimiterDialog::ldelim_clicked(string str) void QDelimiterDialog::ldelim_clicked(string str)
{ {
left_ = str; left_ = str;
set_label(leftPI, left_); set_label(leftPI, left_);
if (matchCB->isChecked()) { if (matchCB->isChecked()) {
right_ = do_match(left_); right_ = do_match(left_);
@ -124,7 +128,7 @@ void QDelimiterDialog::ldelim_clicked(string str)
void QDelimiterDialog::rdelim_clicked(string str) void QDelimiterDialog::rdelim_clicked(string str)
{ {
right_ = str; right_ = str;
set_label(rightPI, right_); set_label(rightPI, right_);
if (matchCB->isChecked()) { if (matchCB->isChecked()) {
left_ = do_match(right_); left_ = do_match(right_);

View File

@ -23,21 +23,16 @@ class QMath;
class IconPalette; class IconPalette;
class QLabel; class QLabel;
class QDelimiterDialog : public QDelimiterDialogBase class QDelimiterDialog : public QDelimiterDialogBase {
{
Q_OBJECT Q_OBJECT
public: public:
QDelimiterDialog(QMath * form); QDelimiterDialog(QMath * form);
public slots: public slots:
void ldelim_clicked(string str); void ldelim_clicked(string str);
void rdelim_clicked(string str); void rdelim_clicked(string str);
void insertClicked(); void insertClicked();
protected: protected:
//needed ? virtual void closeEvent(QCloseEvent * e); //needed ? virtual void closeEvent(QCloseEvent * e);
private: private:
void set_label(QLabel * label, string const & str); void set_label(QLabel * label, string const & str);

View File

@ -16,7 +16,6 @@
#include "gettext.h" #include "gettext.h"
#include "ControlDocument.h" #include "ControlDocument.h"
#include "QDocument.h" #include "QDocument.h"
#include "QDocumentDialog.h" #include "QDocumentDialog.h"
@ -49,6 +48,7 @@ using std::vector;
typedef Qt2CB<ControlDocument, Qt2DB<QDocumentDialog> > base_class; typedef Qt2CB<ControlDocument, Qt2DB<QDocumentDialog> > base_class;
QDocument::QDocument() QDocument::QDocument()
: base_class(_("Document Settings")) : base_class(_("Document Settings"))
{ {
@ -56,16 +56,17 @@ QDocument::QDocument()
lang_ = getSecond(langs); lang_ = getSecond(langs);
} }
void QDocument::build_dialog() void QDocument::build_dialog()
{ {
dialog_.reset(new QDocumentDialog(this)); dialog_.reset(new QDocumentDialog(this));
/* biblio */ // biblio
dialog_->biblioModule->citeStyleCO->insertItem(_("Author-year")); dialog_->biblioModule->citeStyleCO->insertItem(_("Author-year"));
dialog_->biblioModule->citeStyleCO->insertItem(_("Numerical")); dialog_->biblioModule->citeStyleCO->insertItem(_("Numerical"));
dialog_->biblioModule->citeStyleCO->setCurrentItem(0); dialog_->biblioModule->citeStyleCO->setCurrentItem(0);
/* language & quotes */ // language & quotes
vector<frnt::LanguagePair> const langs = frnt::getLanguageData(false); vector<frnt::LanguagePair> const langs = frnt::getLanguageData(false);
vector<frnt::LanguagePair>::const_iterator lit = langs.begin(); vector<frnt::LanguagePair>::const_iterator lit = langs.begin();
vector<frnt::LanguagePair>::const_iterator lend = langs.end(); vector<frnt::LanguagePair>::const_iterator lend = langs.end();
@ -81,7 +82,7 @@ void QDocument::build_dialog()
dialog_->langModule->quoteStyleCO->insertItem(_("«text»")); dialog_->langModule->quoteStyleCO->insertItem(_("«text»"));
dialog_->langModule->quoteStyleCO->insertItem(_("»text«")); dialog_->langModule->quoteStyleCO->insertItem(_("»text«"));
/* packages */ // packages
char const * items[] = {"default","auto","latin1","latin2", char const * items[] = {"default","auto","latin1","latin2",
"latin3","latin4","latin5","latin9", "latin3","latin4","latin5","latin9",
"koi8-r","koi8-u","cp866","cp1251", "koi8-r","koi8-u","cp866","cp1251",
@ -89,27 +90,27 @@ void QDocument::build_dialog()
dialog_->packagesModule->encodingCO->insertStrList(items); dialog_->packagesModule->encodingCO->insertStrList(items);
dialog_->packagesModule->lspacingCO->insertItem( dialog_->packagesModule->lspacingCO->insertItem(
_("Single"),Spacing::Single); _("Single"), Spacing::Single);
dialog_->packagesModule->lspacingCO->insertItem( dialog_->packagesModule->lspacingCO->insertItem(
_("OneHalf"),Spacing::Onehalf); _("OneHalf"), Spacing::Onehalf);
dialog_->packagesModule->lspacingCO->insertItem( dialog_->packagesModule->lspacingCO->insertItem(
_("Double"),Spacing::Double); _("Double"), Spacing::Double);
dialog_->packagesModule->lspacingCO->insertItem( dialog_->packagesModule->lspacingCO->insertItem(
_("Custom"),Spacing::Other); _("Custom"), Spacing::Other);
for (int n = 0; tex_graphics[n][0]; ++n) { for (int 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);
} }
/* paper */ // paper
QStringList papersize_; QStringList papersize_;
papersize_ << _("Default") << _("Custom") << _("US letter") << _("US legal") papersize_ << _("Default") << _("Custom") << _("US letter") << _("US legal")
<< _("US executive") << _("A3") << _("A4") << _("A5") << _("US executive") << _("A3") << _("A4") << _("A5")
<< _("B3") << _("B4") << _("B5"); << _("B3") << _("B4") << _("B5");
dialog_->paperModule->papersizeCO->insertStringList(papersize_); dialog_->paperModule->papersizeCO->insertStringList(papersize_);
/* layout */ // layout
for (LyXTextClassList::const_iterator cit = textclasslist.begin(); for (LyXTextClassList::const_iterator cit = textclasslist.begin();
cit != textclasslist.end(); ++cit) { cit != textclasslist.end(); ++cit) {
dialog_->layoutModule->classCO->insertItem(cit->description().c_str()); dialog_->layoutModule->classCO->insertItem(cit->description().c_str());
@ -136,12 +137,11 @@ void QDocument::build_dialog()
dialog_->layoutModule->pagestyleCO->insertItem(_("headings")); dialog_->layoutModule->pagestyleCO->insertItem(_("headings"));
dialog_->layoutModule->pagestyleCO->insertItem(_("fancy")); dialog_->layoutModule->pagestyleCO->insertItem(_("fancy"));
/* margins */ // margins
dialog_->setMargins(0); dialog_->setMargins(0);
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);
// 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);
@ -153,21 +153,23 @@ void QDocument::build_dialog()
void QDocument::apply() void QDocument::apply()
{ {
/* preamble */ BufferParams & params = controller().params();
controller().params().preamble =
// preamble
params.preamble =
dialog_->preambleModule->preambleMLE->text().latin1(); dialog_->preambleModule->preambleMLE->text().latin1();
/* biblio */ // biblio
controller().params().use_natbib = params.use_natbib =
dialog_->biblioModule->natbibCB->isChecked(); dialog_->biblioModule->natbibCB->isChecked();
controller().params().use_numerical_citations = params.use_numerical_citations =
dialog_->biblioModule->citeStyleCO->currentItem(); dialog_->biblioModule->citeStyleCO->currentItem();
/* language & quotes */ // language & quotes
if (dialog_->langModule->singleQuoteRB->isChecked()) if (dialog_->langModule->singleQuoteRB->isChecked())
controller().params().quotes_times = InsetQuotes::SingleQ; params.quotes_times = InsetQuotes::SingleQ;
else else
controller().params().quotes_times = InsetQuotes::DoubleQ; params.quotes_times = InsetQuotes::DoubleQ;
InsetQuotes::quote_language lga = InsetQuotes::EnglishQ; InsetQuotes::quote_language lga = InsetQuotes::EnglishQ;
@ -191,74 +193,74 @@ void QDocument::apply()
lga = InsetQuotes::DanishQ; lga = InsetQuotes::DanishQ;
break; break;
} }
controller().params().quotes_language = lga; params.quotes_language = lga;
int const pos = dialog_->langModule->languageCO->currentItem(); int const pos = dialog_->langModule->languageCO->currentItem();
controller().params().language = languages.getLanguage(lang_[pos]); params.language = languages.getLanguage(lang_[pos]);
/* numbering */ // numbering
controller().params().secnumdepth = params.secnumdepth =
dialog_->numberingModule->tocDepthSB->value(); dialog_->numberingModule->tocDepthSB->value();
controller().params().tocdepth = params.tocdepth =
dialog_->numberingModule->sectionnrDepthSB->value(); dialog_->numberingModule->sectionnrDepthSB->value();
/* packages */ // packages
switch (dialog_->packagesModule->lspacingCO->currentItem()) { switch (dialog_->packagesModule->lspacingCO->currentItem()) {
case 0: case 0:
controller().params().spacing.set(Spacing::Single); params.spacing.set(Spacing::Single);
break; break;
case 1: case 1:
controller().params().spacing.set(Spacing::Onehalf); params.spacing.set(Spacing::Onehalf);
break; break;
case 2: case 2:
controller().params().spacing.set(Spacing::Double); params.spacing.set(Spacing::Double);
break; break;
case 3: case 3:
controller().params().spacing.set(Spacing::Other, params.spacing.set(Spacing::Other,
dialog_->packagesModule-> dialog_->packagesModule->
lspacingLE->text().toFloat() lspacingLE->text().toFloat()
); );
break; break;
} }
controller().params().graphicsDriver = params.graphicsDriver =
dialog_->packagesModule->psdriverCO->currentText().latin1(); dialog_->packagesModule->psdriverCO->currentText().latin1();
controller().params().use_amsmath = params.use_amsmath =
dialog_->packagesModule->amsCB->isChecked(); dialog_->packagesModule->amsCB->isChecked();
controller().params().inputenc = params.inputenc =
dialog_->packagesModule->encodingCO->currentText().latin1(); dialog_->packagesModule->encodingCO->currentText().latin1();
/* layout */ // layout
controller().params().textclass = params.textclass =
dialog_->layoutModule->classCO->currentItem(); dialog_->layoutModule->classCO->currentItem();
//bool succes = controller().classApply(); //bool succes = controller().classApply();
controller().params().fonts = params.fonts =
dialog_->layoutModule->fontsCO->currentText().latin1(); dialog_->layoutModule->fontsCO->currentText().latin1();
controller().params().fontsize = params.fontsize =
dialog_->layoutModule->fontsizeCO->currentText().latin1(); dialog_->layoutModule->fontsizeCO->currentText().latin1();
controller().params().pagestyle = params.pagestyle =
dialog_->layoutModule->pagestyleCO->currentText().latin1(); dialog_->layoutModule->pagestyleCO->currentText().latin1();
if (dialog_->layoutModule->indentRB->isChecked()) if (dialog_->layoutModule->indentRB->isChecked())
controller().params().paragraph_separation = BufferParams::PARSEP_INDENT; params.paragraph_separation = BufferParams::PARSEP_INDENT;
else else
controller().params().paragraph_separation = BufferParams::PARSEP_SKIP; params.paragraph_separation = BufferParams::PARSEP_SKIP;
switch (dialog_->layoutModule->skipCO->currentItem()) { switch (dialog_->layoutModule->skipCO->currentItem()) {
case 0: case 0:
controller().params().setDefSkip(VSpace(VSpace::SMALLSKIP)); params.setDefSkip(VSpace(VSpace::SMALLSKIP));
break; break;
case 1: case 1:
controller().params().setDefSkip(VSpace(VSpace::MEDSKIP)); params.setDefSkip(VSpace(VSpace::MEDSKIP));
break; break;
case 2: case 2:
controller().params().setDefSkip(VSpace(VSpace::BIGSKIP)); params.setDefSkip(VSpace(VSpace::BIGSKIP));
break; break;
case 3: case 3:
{ {
@ -268,102 +270,103 @@ void QDocument::apply()
double length = double length =
dialog_->layoutModule->skipLE->text().toDouble(); dialog_->layoutModule->skipLE->text().toDouble();
VSpace vs = VSpace(LyXGlueLength(LyXLength(length,unit))); VSpace vs = VSpace(LyXGlueLength(LyXLength(length,unit)));
controller().params().setDefSkip(vs); params.setDefSkip(vs);
break; break;
} }
default: default:
// DocumentDefskipCB assures that this never happens // DocumentDefskipCB assures that this never happens
controller().params().setDefSkip(VSpace(VSpace::MEDSKIP)); params.setDefSkip(VSpace(VSpace::MEDSKIP));
break; break;
} }
controller().params().options = params.options =
dialog_->layoutModule->optionsLE->text().latin1(); dialog_->layoutModule->optionsLE->text().latin1();
controller().params().float_placement = params.float_placement =
dialog_->layoutModule->floatPlacementLE->text().latin1(); dialog_->layoutModule->floatPlacementLE->text().latin1();
/* paper */ // paper
controller().params().papersize2 = params.papersize2 =
dialog_->paperModule->papersizeCO->currentItem(); dialog_->paperModule->papersizeCO->currentItem();
controller().params().paperwidth = params.paperwidth =
LyXLength(dialog_->paperModule->paperwidthLE->text().toDouble(), LyXLength(dialog_->paperModule->paperwidthLE->text().toDouble(),
dialog_->paperModule->paperwidthUnitCO->currentLengthItem() dialog_->paperModule->paperwidthUnitCO->currentLengthItem()
).asString(); ).asString();
controller().params().paperheight = params.paperheight =
LyXLength(dialog_->paperModule->paperheightLE->text().toDouble(), LyXLength(dialog_->paperModule->paperheightLE->text().toDouble(),
dialog_->paperModule->paperheightUnitCO->currentLengthItem() dialog_->paperModule->paperheightUnitCO->currentLengthItem()
).asString(); ).asString();
if (dialog_->paperModule->twoColumnCB->isChecked()) if (dialog_->paperModule->twoColumnCB->isChecked())
controller().params().columns = 2; params.columns = 2;
else else
controller().params().columns = 1; params.columns = 1;
if (dialog_->paperModule->facingPagesCB->isChecked()) if (dialog_->paperModule->facingPagesCB->isChecked())
controller().params().sides = LyXTextClass::TwoSides; params.sides = LyXTextClass::TwoSides;
else else
controller().params().sides = LyXTextClass::OneSide; params.sides = LyXTextClass::OneSide;
if (dialog_->paperModule->landscapeRB->isChecked()) if (dialog_->paperModule->landscapeRB->isChecked())
controller().params().orientation = BufferParams::ORIENTATION_LANDSCAPE; params.orientation = BufferParams::ORIENTATION_LANDSCAPE;
else else
controller().params().orientation = BufferParams::ORIENTATION_PORTRAIT; params.orientation = BufferParams::ORIENTATION_PORTRAIT;
/* margins */ // margins
controller().params().use_geometry = params.use_geometry =
dialog_->marginsModule->marginCO->currentItem()==1; (dialog_->marginsModule->marginCO->currentItem() == 1);
int margin = dialog_->marginsModule->marginCO->currentItem(); int margin = dialog_->marginsModule->marginCO->currentItem();
if (margin>0) { if (margin > 0) {
margin = margin - 1; margin = margin - 1;
} }
controller().params().paperpackage = char(margin); params.paperpackage = char(margin);
controller().params().leftmargin = params.leftmargin =
LyXLength(dialog_->marginsModule->innerLE->text().toDouble(), LyXLength(dialog_->marginsModule->innerLE->text().toDouble(),
dialog_->marginsModule->innerUnit->currentLengthItem() dialog_->marginsModule->innerUnit->currentLengthItem()
).asString(); ).asString();
controller().params().topmargin = params.topmargin =
LyXLength(dialog_->marginsModule->topLE->text().toDouble(), LyXLength(dialog_->marginsModule->topLE->text().toDouble(),
dialog_->marginsModule->topUnit->currentLengthItem() dialog_->marginsModule->topUnit->currentLengthItem()
).asString(); ).asString();
controller().params().rightmargin = params.rightmargin =
LyXLength(dialog_->marginsModule->outerLE->text().toDouble(), LyXLength(dialog_->marginsModule->outerLE->text().toDouble(),
dialog_->marginsModule->outerUnit->currentLengthItem() dialog_->marginsModule->outerUnit->currentLengthItem()
).asString(); ).asString();
controller().params().bottommargin = params.bottommargin =
LyXLength(dialog_->marginsModule->bottomLE->text().toDouble(), LyXLength(dialog_->marginsModule->bottomLE->text().toDouble(),
dialog_->marginsModule->bottomUnit->currentLengthItem() dialog_->marginsModule->bottomUnit->currentLengthItem()
).asString(); ).asString();
controller().params().headheight = params.headheight =
LyXLength(dialog_->marginsModule->headheightLE->text().toDouble(), LyXLength(dialog_->marginsModule->headheightLE->text().toDouble(),
dialog_->marginsModule->headheightUnit->currentLengthItem() dialog_->marginsModule->headheightUnit->currentLengthItem()
).asString(); ).asString();
controller().params().headsep = params.headsep =
LyXLength(dialog_->marginsModule->headsepLE->text().toDouble(), LyXLength(dialog_->marginsModule->headsepLE->text().toDouble(),
dialog_->marginsModule->headsepUnit->currentLengthItem() dialog_->marginsModule->headsepUnit->currentLengthItem()
).asString(); ).asString();
controller().params().footskip = params.footskip =
LyXLength(dialog_->marginsModule->footskipLE->text().toDouble(), LyXLength(dialog_->marginsModule->footskipLE->text().toDouble(),
dialog_->marginsModule->footskipUnit->currentLengthItem() dialog_->marginsModule->footskipUnit->currentLengthItem()
).asString(); ).asString();
} }
namespace { namespace {
/** Return the position of val in the vector if found. /** Return the position of val in the vector if found.
@ -382,41 +385,44 @@ findPos(std::vector<A> const & vec, A const & val)
} // namespace anom } // namespace anom
void QDocument::update_contents() void QDocument::update_contents()
{ {
if (!dialog_.get()) if (!dialog_.get())
return; return;
/* preamble */ BufferParams const & params = controller().params();
QString preamble = controller().params().preamble.c_str();
// preamble
QString preamble = params.preamble.c_str();
dialog_->preambleModule->preambleMLE->setText(preamble); dialog_->preambleModule->preambleMLE->setText(preamble);
/* biblio */ // biblio
dialog_->biblioModule->natbibCB->setChecked( dialog_->biblioModule->natbibCB->setChecked(
controller().params().use_natbib); params.use_natbib);
dialog_->biblioModule->citeStyleCO->setCurrentItem( dialog_->biblioModule->citeStyleCO->setCurrentItem(
controller().params().use_numerical_citations ? 1 : 0); params.use_numerical_citations ? 1 : 0);
/* language & quotes */ // language & quotes
dialog_->langModule->singleQuoteRB->setChecked( dialog_->langModule->singleQuoteRB->setChecked(
controller().params().quotes_times == InsetQuotes::SingleQ); params.quotes_times == InsetQuotes::SingleQ);
dialog_->langModule->doubleQuoteRB->setChecked( dialog_->langModule->doubleQuoteRB->setChecked(
controller().params().quotes_times == InsetQuotes::DoubleQ); params.quotes_times == InsetQuotes::DoubleQ);
int const pos = int(findPos(lang_, int const pos = int(findPos(lang_,
controller().params().language->lang())); params.language->lang()));
dialog_->langModule->languageCO->setCurrentItem(pos); dialog_->langModule->languageCO->setCurrentItem(pos);
dialog_->langModule->quoteStyleCO->setCurrentItem( dialog_->langModule->quoteStyleCO->setCurrentItem(
controller().params().quotes_language); params.quotes_language);
/* numbering */ // numbering
dialog_->numberingModule->tocDepthSB->setValue( dialog_->numberingModule->tocDepthSB->setValue(
controller().params().secnumdepth); params.secnumdepth);
dialog_->numberingModule->sectionnrDepthSB->setValue( dialog_->numberingModule->sectionnrDepthSB->setValue(
controller().params().tocdepth); params.tocdepth);
/* packages */ // packages
QStringList enc; QStringList enc;
enc << "default" << "auto" << "latin1" << "latin2" << "latin3" << enc << "default" << "auto" << "latin1" << "latin2" << "latin3" <<
"latin4" << "latin5" << "latin9" << "koi8-r" << "koi8-u" << "latin4" << "latin5" << "latin9" << "koi8-r" << "koi8-u" <<
@ -424,14 +430,14 @@ void QDocument::update_contents()
int pos2 = 0; int pos2 = 0;
for (QStringList::Iterator it = enc.begin(); for (QStringList::Iterator it = enc.begin();
it!=enc.end(); ++it) { it!=enc.end(); ++it) {
if (*it==controller().params().inputenc.c_str()) { if (*it == params.inputenc.c_str()) {
dialog_->packagesModule->encodingCO->setCurrentItem(pos2); dialog_->packagesModule->encodingCO->setCurrentItem(pos2);
} }
++pos2; ++pos2;
} }
QString text = controller().params().graphicsDriver.c_str(); QString text = 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];
@ -442,20 +448,19 @@ void QDocument::update_contents()
dialog_->packagesModule->amsCB->setChecked( dialog_->packagesModule->amsCB->setChecked(
controller().params().use_amsmath); params.use_amsmath);
dialog_->packagesModule->lspacingCO-> dialog_->packagesModule->lspacingCO->
setCurrentItem(controller().params().spacing.getSpace()); setCurrentItem(params.spacing.getSpace());
if (controller().params().spacing.getSpace()== if (params.spacing.getSpace() == Spacing::Other) {
Spacing::Other) {
dialog_->packagesModule->lspacingLE->setText( dialog_->packagesModule->lspacingLE->setText(
tostr(controller().params().spacing.getValue()).c_str()); tostr(params.spacing.getValue()).c_str());
dialog_->setLSpacing(3); dialog_->setLSpacing(3);
} }
/* layout */ // layout
for (int n = 0; n<dialog_->layoutModule->classCO->count(); ++n) { for (int n = 0; n<dialog_->layoutModule->classCO->count(); ++n) {
if (dialog_->layoutModule->classCO->text(n)== if (dialog_->layoutModule->classCO->text(n) ==
controller().textClass().description().c_str()) { controller().textClass().description().c_str()) {
dialog_->layoutModule->classCO->setCurrentItem(n); dialog_->layoutModule->classCO->setCurrentItem(n);
break; break;
@ -463,19 +468,19 @@ void QDocument::update_contents()
} }
dialog_->updateFontsize(controller().textClass().opt_fontsize(), dialog_->updateFontsize(controller().textClass().opt_fontsize(),
controller().params().fontsize); params.fontsize);
dialog_->updatePagestyle(controller().textClass().opt_pagestyle(), dialog_->updatePagestyle(controller().textClass().opt_pagestyle(),
controller().params().pagestyle); 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] == params.fonts) {
dialog_->layoutModule->fontsCO->setCurrentItem(n); dialog_->layoutModule->fontsCO->setCurrentItem(n);
break; break;
} }
} }
if (controller().params().paragraph_separation if (params.paragraph_separation
== BufferParams::PARSEP_INDENT) { == BufferParams::PARSEP_INDENT) {
dialog_->layoutModule->indentRB->setChecked(true); dialog_->layoutModule->indentRB->setChecked(true);
} else { } else {
@ -483,7 +488,7 @@ void QDocument::update_contents()
} }
int skip = 0; int skip = 0;
switch (controller().params().getDefSkip().kind()) { switch (params.getDefSkip().kind()) {
case VSpace::SMALLSKIP: case VSpace::SMALLSKIP:
skip = 0; skip = 0;
break; break;
@ -496,7 +501,7 @@ void QDocument::update_contents()
case VSpace::LENGTH: case VSpace::LENGTH:
{ {
skip = 3; skip = 3;
string const length = controller().params().getDefSkip().asLyXCommand(); string const length = params.getDefSkip().asLyXCommand();
dialog_->layoutModule->skipLengthCO->setCurrentItem(LyXLength(length).unit()); dialog_->layoutModule->skipLengthCO->setCurrentItem(LyXLength(length).unit());
dialog_->layoutModule->skipLE->setText(tostr(LyXLength(length).value()).c_str()); dialog_->layoutModule->skipLE->setText(tostr(LyXLength(length).value()).c_str());
break; break;
@ -508,45 +513,45 @@ void QDocument::update_contents()
dialog_->layoutModule->skipCO->setCurrentItem(skip); dialog_->layoutModule->skipCO->setCurrentItem(skip);
dialog_->setSkip(skip); dialog_->setSkip(skip);
if (!controller().params().options.empty()) { if (!params.options.empty()) {
dialog_->layoutModule->optionsLE->setText( dialog_->layoutModule->optionsLE->setText(
controller().params().options.c_str()); params.options.c_str());
} else { } else {
dialog_->layoutModule->optionsLE->setText(""); dialog_->layoutModule->optionsLE->setText("");
} }
/* paper */ // paper
int const psize = controller().params().papersize2; int const psize = params.papersize2;
dialog_->paperModule->papersizeCO->setCurrentItem(psize); dialog_->paperModule->papersizeCO->setCurrentItem(psize);
dialog_->setMargins(psize); dialog_->setMargins(psize);
dialog_->setCustomPapersize(psize); dialog_->setCustomPapersize(psize);
bool const landscape = bool const landscape =
controller().params().orientation == BufferParams::ORIENTATION_LANDSCAPE; params.orientation == BufferParams::ORIENTATION_LANDSCAPE;
dialog_->paperModule->landscapeRB->setChecked(landscape); dialog_->paperModule->landscapeRB->setChecked(landscape);
dialog_->paperModule->portraitRB->setChecked(!landscape); dialog_->paperModule->portraitRB->setChecked(!landscape);
dialog_->paperModule->facingPagesCB->setChecked( dialog_->paperModule->facingPagesCB->setChecked(
controller().params().sides == LyXTextClass::TwoSides); params.sides == LyXTextClass::TwoSides);
dialog_->paperModule->twoColumnCB->setChecked( dialog_->paperModule->twoColumnCB->setChecked(
controller().params().columns == 2); params.columns == 2);
dialog_->paperModule->paperwidthUnitCO->setCurrentItem( dialog_->paperModule->paperwidthUnitCO->setCurrentItem(
LyXLength(controller().params().paperwidth).unit()); LyXLength(params.paperwidth).unit());
dialog_->paperModule->paperwidthLE->setText( dialog_->paperModule->paperwidthLE->setText(
tostr(LyXLength(controller().params().paperwidth).value()).c_str()); tostr(LyXLength(params.paperwidth).value()).c_str());
dialog_->paperModule->paperheightUnitCO->setCurrentItem( dialog_->paperModule->paperheightUnitCO->setCurrentItem(
LyXLength(controller().params().paperheight).unit()); LyXLength(params.paperheight).unit());
dialog_->paperModule->paperheightLE->setText( dialog_->paperModule->paperheightLE->setText(
tostr(LyXLength(controller().params().paperheight).value()).c_str()); tostr(LyXLength(params.paperheight).value()).c_str());
/* margins */ // margins
int item = controller().params().paperpackage; int item = params.paperpackage;
if (controller().params().use_geometry) { if (params.use_geometry) {
item = 1; item = 1;
} else if (item > 0) { } else if (item > 0) {
item = item + 1; item = item + 1;
@ -555,39 +560,37 @@ void QDocument::update_contents()
dialog_->setCustomMargins(item); dialog_->setCustomMargins(item);
dialog_->marginsModule->topUnit->setCurrentItem( dialog_->marginsModule->topUnit->setCurrentItem(
LyXLength(controller().params().topmargin).unit()); LyXLength(params.topmargin).unit());
dialog_->marginsModule->topLE->setText( dialog_->marginsModule->topLE->setText(
tostr(LyXLength(controller().params().topmargin).value()).c_str()); tostr(LyXLength(params.topmargin).value()).c_str());
dialog_->marginsModule->bottomUnit->setCurrentItem( dialog_->marginsModule->bottomUnit->setCurrentItem(
LyXLength(controller().params().bottommargin).unit()); LyXLength(params.bottommargin).unit());
dialog_->marginsModule->bottomLE->setText( dialog_->marginsModule->bottomLE->setText(
tostr(LyXLength(controller().params().bottommargin).value()).c_str()); tostr(LyXLength(params.bottommargin).value()).c_str());
dialog_->marginsModule->innerUnit->setCurrentItem( dialog_->marginsModule->innerUnit->setCurrentItem(
LyXLength(controller().params().leftmargin).unit()); LyXLength(params.leftmargin).unit());
dialog_->marginsModule->innerLE->setText( dialog_->marginsModule->innerLE->setText(
tostr(LyXLength(controller().params().leftmargin).value()).c_str()); tostr(LyXLength(params.leftmargin).value()).c_str());
dialog_->marginsModule->outerUnit->setCurrentItem( dialog_->marginsModule->outerUnit->setCurrentItem(
LyXLength(controller().params().rightmargin).unit()); LyXLength(params.rightmargin).unit());
dialog_->marginsModule->outerLE->setText( dialog_->marginsModule->outerLE->setText(
tostr(LyXLength(controller().params().rightmargin).value()).c_str()); tostr(LyXLength(params.rightmargin).value()).c_str());
dialog_->marginsModule->headheightUnit->setCurrentItem( dialog_->marginsModule->headheightUnit->setCurrentItem(
LyXLength(controller().params().headheight).unit()); LyXLength(params.headheight).unit());
dialog_->marginsModule->headheightLE->setText( dialog_->marginsModule->headheightLE->setText(
tostr(LyXLength(controller().params().headheight).value()).c_str()); tostr(LyXLength(params.headheight).value()).c_str());
dialog_->marginsModule->headsepUnit->setCurrentItem( dialog_->marginsModule->headsepUnit->setCurrentItem(
LyXLength(controller().params().headsep).unit()); LyXLength(params.headsep).unit());
dialog_->marginsModule->headsepLE->setText( dialog_->marginsModule->headsepLE->setText(
tostr(LyXLength(controller().params().headsep).value()).c_str()); tostr(LyXLength(params.headsep).value()).c_str());
dialog_->marginsModule->footskipUnit->setCurrentItem( dialog_->marginsModule->footskipUnit->setCurrentItem(
LyXLength(controller().params().footskip).unit()); LyXLength(params.footskip).unit());
dialog_->marginsModule->footskipLE->setText( dialog_->marginsModule->footskipLE->setText(
tostr(LyXLength(controller().params().footskip).value()).c_str()); tostr(LyXLength(params.footskip).value()).c_str());
} }

View File

@ -30,10 +30,10 @@ class QDocument
: public Qt2CB<ControlDocument, Qt2DB<QDocumentDialog> > : public Qt2CB<ControlDocument, Qt2DB<QDocumentDialog> >
{ {
public: public:
///
QDocument();
/// ///
friend class QDocumentDialog; friend class QDocumentDialog;
///
QDocument();
private: private:
/// Apply changes /// Apply changes
void apply(); void apply();

View File

@ -51,9 +51,11 @@
#include <qcheckbox.h> #include <qcheckbox.h>
#include <qspinbox.h> #include <qspinbox.h>
#include "lengthcombo.h" #include "lengthcombo.h"
/*
* Constructs a DocumentDialog which is a child of 'parent', with the
* name 'name' and widget flags set to 'f' /*
* Constructs a DocumentDialog which is a child of 'parent', with the
* name 'name' and widget flags set to 'f'
* *
* The dialog will by default be modeless, unless you set 'modal' to * The dialog will by default be modeless, unless you set 'modal' to
* TRUE to construct a modal dialog. * TRUE to construct a modal dialog.
@ -69,7 +71,7 @@ QDocumentDialog::QDocumentDialog( QDocument * form)
form, SLOT(slotClose())); form, SLOT(slotClose()));
connect(restorePB, SIGNAL(clicked()), connect(restorePB, SIGNAL(clicked()),
form, SLOT(slotRestore())); form, SLOT(slotRestore()));
moduleLB->clear(); moduleLB->clear();
moduleLB->insertItem( _("Layout"), LAYOUT ); moduleLB->insertItem( _("Layout"), LAYOUT );
moduleLB->insertItem( _("Packages"), PACKAGES ); moduleLB->insertItem( _("Packages"), PACKAGES );
@ -101,7 +103,7 @@ QDocumentDialog::QDocumentDialog( QDocument * form)
moduleStack->addWidget(numberingModule,NUMBERING); moduleStack->addWidget(numberingModule,NUMBERING);
moduleStack->addWidget(biblioModule,BIBLIOGRAPHY); moduleStack->addWidget(biblioModule,BIBLIOGRAPHY);
moduleStack->addWidget(preambleModule,PREAMBLE); moduleStack->addWidget(preambleModule,PREAMBLE);
moduleStack->raiseWidget(LAYOUT); moduleStack->raiseWidget(LAYOUT);
//QPixmap image("standard.xpm"); //QPixmap image("standard.xpm");
@ -112,7 +114,7 @@ QDocumentDialog::QDocumentDialog( QDocument * form)
f.setWeight( QFont::Bold ); f.setWeight( QFont::Bold );
titleL->setFont( f ); titleL->setFont( f );
setTitle(LAYOUT); setTitle(LAYOUT);
/* preamble */ /* preamble */
connect( preambleModule->preambleMLE, SIGNAL( textChanged() ), connect( preambleModule->preambleMLE, SIGNAL( textChanged() ),
this , SLOT( change_adaptor() ) ); this , SLOT( change_adaptor() ) );
@ -177,18 +179,18 @@ QDocumentDialog::QDocumentDialog( QDocument * form)
this , SLOT( change_adaptor() ) ); this , SLOT( change_adaptor() ) );
connect( layoutModule->skipLengthCO, SIGNAL( activated(int) ), connect( layoutModule->skipLengthCO, SIGNAL( activated(int) ),
this , SLOT( change_adaptor() ) ); this , SLOT( change_adaptor() ) );
connect( layoutModule->classCO, SIGNAL( activated(int) ), connect( layoutModule->classCO, SIGNAL( activated(int) ),
this , SLOT( classChanged() ) ); this , SLOT( classChanged() ) );
connect( layoutModule->skipCO, SIGNAL( activated(int) ), connect( layoutModule->skipCO, SIGNAL( activated(int) ),
this , SLOT( setSkip(int) ) ); this , SLOT( setSkip(int) ) );
connect( layoutModule->skipRB, SIGNAL( toggled(bool) ), connect( layoutModule->skipRB, SIGNAL( toggled(bool) ),
this , SLOT( enableSkip(bool) ) ); this , SLOT( enableSkip(bool) ) );
/* margins */ /* margins */
connect( marginsModule->marginCO, SIGNAL( activated(int) ), connect( marginsModule->marginCO, SIGNAL( activated(int) ),
this , SLOT( setCustomMargins(int) ) ); this , SLOT( setCustomMargins(int) ) );
connect( marginsModule->marginCO, SIGNAL( activated(int) ), connect( marginsModule->marginCO, SIGNAL( activated(int) ),
this , SLOT( change_adaptor() ) ); this , SLOT( change_adaptor() ) );
connect( marginsModule->topLE, SIGNAL( textChanged(const QString&) ), connect( marginsModule->topLE, SIGNAL( textChanged(const QString&) ),
@ -219,7 +221,7 @@ QDocumentDialog::QDocumentDialog( QDocument * form)
this , SLOT( change_adaptor() ) ); this , SLOT( change_adaptor() ) );
connect( marginsModule->footskipUnit, SIGNAL( activated(int) ), connect( marginsModule->footskipUnit, SIGNAL( activated(int) ),
this , SLOT( change_adaptor() ) ); this , SLOT( change_adaptor() ) );
/* paper */ /* paper */
connect( paperModule->papersizeCO, SIGNAL( activated(int) ), connect( paperModule->papersizeCO, SIGNAL( activated(int) ),
this , SLOT( setMargins(int) ) ); this , SLOT( setMargins(int) ) );
@ -227,7 +229,7 @@ QDocumentDialog::QDocumentDialog( QDocument * form)
this , SLOT( setCustomPapersize(int) ) ); this , SLOT( setCustomPapersize(int) ) );
connect( paperModule->papersizeCO, SIGNAL( activated(int) ), connect( paperModule->papersizeCO, SIGNAL( activated(int) ),
this , SLOT( setCustomPapersize(int) ) ); this , SLOT( setCustomPapersize(int) ) );
connect( paperModule->papersizeCO, SIGNAL( activated(int) ), connect( paperModule->papersizeCO, SIGNAL( activated(int) ),
this , SLOT( change_adaptor() ) ); this , SLOT( change_adaptor() ) );
connect( paperModule->paperheightLE, SIGNAL( textChanged(const QString&) ), connect( paperModule->paperheightLE, SIGNAL( textChanged(const QString&) ),
@ -246,9 +248,10 @@ QDocumentDialog::QDocumentDialog( QDocument * form)
this , SLOT( change_adaptor() ) ); this , SLOT( change_adaptor() ) );
connect( paperModule->facingPagesCB, SIGNAL( toggled(bool) ), connect( paperModule->facingPagesCB, SIGNAL( toggled(bool) ),
this , SLOT( change_adaptor() ) ); this , SLOT( change_adaptor() ) );
} }
void QDocumentDialog::showPreamble() void QDocumentDialog::showPreamble()
{ {
moduleStack->raiseWidget(PREAMBLE); moduleStack->raiseWidget(PREAMBLE);
@ -256,7 +259,8 @@ void QDocumentDialog::showPreamble()
QDocumentDialogBase::show(); QDocumentDialogBase::show();
} }
/*
/*
* Destroys the object and frees any allocated resources * Destroys the object and frees any allocated resources
*/ */
QDocumentDialog::~QDocumentDialog() QDocumentDialog::~QDocumentDialog()
@ -264,7 +268,8 @@ QDocumentDialog::~QDocumentDialog()
// no need to delete child widgets, Qt does it all for us // no need to delete child widgets, Qt does it all for us
} }
/*
/*
* public slot * public slot
*/ */
@ -301,51 +306,59 @@ void QDocumentDialog::setTitle(int item)
} }
} }
/*
/*
* public slot * public slot
*/ */
void QDocumentDialog::saveDocDefault() void QDocumentDialog::saveDocDefault()
{} {}
/*
/*
* public slot * public slot
*/ */
void QDocumentDialog::restore() void QDocumentDialog::restore()
{ {
qWarning( "DocumentDialog::restore() not yet implemented!" ); qWarning( "DocumentDialog::restore() not yet implemented!" );
} }
/*
/*
* public slot * public slot
*/ */
void QDocumentDialog::useClassDefaults() void QDocumentDialog::useClassDefaults()
{ {
qWarning( "DocumentDialog::useClassDefaults() not yet implemented!" ); qWarning( "DocumentDialog::useClassDefaults() not yet implemented!" );
} }
void QDocumentDialog::change_adaptor() void QDocumentDialog::change_adaptor()
{ {
form_->changed(); form_->changed();
} }
void QDocumentDialog::closeEvent(QCloseEvent * e) void QDocumentDialog::closeEvent(QCloseEvent * e)
{ {
form_->slotWMHide(); form_->slotWMHide();
e->accept(); e->accept();
} }
void QDocumentDialog::setLSpacing(int item) void QDocumentDialog::setLSpacing(int item)
{ {
packagesModule->lspacingLE->setEnabled(item==3); packagesModule->lspacingLE->setEnabled(item == 3);
} }
void QDocumentDialog::setSkip(int item) void QDocumentDialog::setSkip(int item)
{ {
bool enable = (item==3); bool enable = (item == 3);
layoutModule->skipLE->setEnabled(enable); layoutModule->skipLE->setEnabled(enable);
layoutModule->skipLengthCO->setEnabled(enable); layoutModule->skipLengthCO->setEnabled(enable);
} }
void QDocumentDialog::enableSkip(bool skip) void QDocumentDialog::enableSkip(bool skip)
{ {
layoutModule->skipCO->setEnabled(skip); layoutModule->skipCO->setEnabled(skip);
@ -355,6 +368,7 @@ void QDocumentDialog::enableSkip(bool skip)
setSkip(layoutModule->skipCO->currentItem()); setSkip(layoutModule->skipCO->currentItem());
} }
void QDocumentDialog::setMargins(int papersize) void QDocumentDialog::setMargins(int papersize)
{ {
QStringList a4only; QStringList a4only;
@ -362,7 +376,7 @@ void QDocumentDialog::setMargins(int papersize)
a4only << _("Small Margins") << _( "Very small Margins") a4only << _("Small Margins") << _( "Very small Margins")
<< _("Very wide Margins "); << _("Very wide Margins ");
normal << _("Default") << _("Custom"); normal << _("Default") << _("Custom");
int olditem = marginsModule->marginCO->currentItem(); int olditem = marginsModule->marginCO->currentItem();
marginsModule->marginCO->clear(); marginsModule->marginCO->clear();
marginsModule->marginCO->insertStringList(normal); marginsModule->marginCO->insertStringList(normal);
@ -376,8 +390,8 @@ void QDocumentDialog::setMargins(int papersize)
void QDocumentDialog::setCustomPapersize(int papersize) void QDocumentDialog::setCustomPapersize(int papersize)
{ {
bool const custom = (papersize==1); bool const custom = (papersize == 1);
paperModule->paperwidthL->setEnabled(custom); paperModule->paperwidthL->setEnabled(custom);
paperModule->paperwidthLE->setEnabled(custom); paperModule->paperwidthLE->setEnabled(custom);
paperModule->paperwidthUnitCO->setEnabled(custom); paperModule->paperwidthUnitCO->setEnabled(custom);
@ -390,8 +404,8 @@ void QDocumentDialog::setCustomPapersize(int papersize)
void QDocumentDialog::setCustomMargins(int margin) void QDocumentDialog::setCustomMargins(int margin)
{ {
bool const custom = (margin==1); bool const custom = (margin == 1);
marginsModule->topL->setEnabled(custom); marginsModule->topL->setEnabled(custom);
marginsModule->topLE->setEnabled(custom); marginsModule->topLE->setEnabled(custom);
marginsModule->topUnit->setEnabled(custom); marginsModule->topUnit->setEnabled(custom);
@ -422,11 +436,12 @@ void QDocumentDialog::setCustomMargins(int margin)
} }
void QDocumentDialog::updateFontsize(string const & items, string const & sel) void QDocumentDialog::updateFontsize(string const & items, string const & sel)
{ {
layoutModule->fontsizeCO->clear(); layoutModule->fontsizeCO->clear();
layoutModule->fontsizeCO->insertItem("default"); layoutModule->fontsizeCO->insertItem("default");
for (int n=0; !token(items,'|',n).empty(); ++n) for (int n=0; !token(items,'|',n).empty(); ++n)
layoutModule->fontsizeCO-> layoutModule->fontsizeCO->
insertItem(token(items,'|',n).c_str()); insertItem(token(items,'|',n).c_str());
@ -439,6 +454,7 @@ void QDocumentDialog::updateFontsize(string const & items, string const & sel)
} }
} }
void QDocumentDialog::updatePagestyle(string const & items, string const & sel) void QDocumentDialog::updatePagestyle(string const & items, string const & sel)
{ {
layoutModule->pagestyleCO->clear(); layoutModule->pagestyleCO->clear();
@ -456,14 +472,13 @@ void QDocumentDialog::updatePagestyle(string const & items, string const & sel)
} }
} }
void QDocumentDialog::classChanged() void QDocumentDialog::classChanged()
{ {
updateFontsize(form_->controller().textClass().opt_fontsize(), updateFontsize(form_->controller().textClass().opt_fontsize(),
form_->controller().params().fontsize); form_->controller().params().fontsize);
updatePagestyle(form_->controller().textClass().opt_pagestyle(), updatePagestyle(form_->controller().textClass().opt_pagestyle(),
form_->controller().params().pagestyle); form_->controller().params().pagestyle);
} }

View File

@ -33,34 +33,27 @@
class QDocument; class QDocument;
class QDocumentDialog : public QDocumentDialogBase class QDocumentDialog : public QDocumentDialogBase {
{
Q_OBJECT Q_OBJECT
public: public:
friend class QDocument;
QDocumentDialog( QDocument * );
QDocumentDialog(QDocument *);
~QDocumentDialog(); ~QDocumentDialog();
void showPreamble(); void showPreamble();
friend class QDocument;
void updateFontsize(string const & , string const & ); void updateFontsize(string const & , string const &);
void updatePagestyle(string const & , string const & ); void updatePagestyle(string const & , string const &);
public slots: public slots:
void setTitle(int); void setTitle(int);
void change_adaptor(); void change_adaptor();
void saveDocDefault(); void saveDocDefault();
void restore(); void restore();
void useClassDefaults(); void useClassDefaults();
protected slots: protected slots:
void setLSpacing(int); void setLSpacing(int);
void setMargins(int); void setMargins(int);
void setCustomPapersize(int); void setCustomPapersize(int);
@ -68,11 +61,8 @@ protected slots:
void setSkip(int); void setSkip(int);
void enableSkip(bool); void enableSkip(bool);
void classChanged(); void classChanged();
protected: protected:
void closeEvent(QCloseEvent * e); void closeEvent(QCloseEvent * e);
private: private:
enum Module { enum Module {
LAYOUT, LAYOUT,
@ -85,7 +75,7 @@ private:
BIBLIOGRAPHY, BIBLIOGRAPHY,
PREAMBLE PREAMBLE
}; };
ClassModuleBase * layoutModule; ClassModuleBase * layoutModule;
PackagesModuleBase * packagesModule; PackagesModuleBase * packagesModule;
PaperModuleBase * paperModule; PaperModuleBase * paperModule;

View File

@ -26,6 +26,7 @@
typedef Qt2CB<ControlERT, Qt2DB<QERTDialog> > base_class; typedef Qt2CB<ControlERT, Qt2DB<QERTDialog> > base_class;
QERT::QERT() QERT::QERT()
: base_class(_("LaTeX ERT")) : base_class(_("LaTeX ERT"))
{ {
@ -43,12 +44,14 @@ void QERT::build_dialog()
void QERT::apply() void QERT::apply()
{ {
ERTParams & params = controller().params();
if (dialog_->openRB->isChecked()) if (dialog_->openRB->isChecked())
controller().params().status = InsetERT::Open; params.status = InsetERT::Open;
else if (dialog_->inlineRB->isChecked()) else if (dialog_->inlineRB->isChecked())
controller().params().status = InsetERT::Inlined; params.status = InsetERT::Inlined;
else else
controller().params().status = InsetERT::Collapsed; params.status = InsetERT::Collapsed;
} }

View File

@ -21,15 +21,13 @@
class ControlERT; class ControlERT;
class QERTDialog; class QERTDialog;
class QERT
class QERT : : public Qt2CB<ControlERT, Qt2DB<QERTDialog> >
public Qt2CB<ControlERT, Qt2DB<QERTDialog> >
{ {
public:
friend class QERTDialog; friend class QERTDialog;
public:
QERT(); QERT();
private: private:
/// Apply changes /// Apply changes
virtual void apply(); virtual void apply();

View File

@ -19,6 +19,7 @@
#include <qpushbutton.h> #include <qpushbutton.h>
QERTDialog::QERTDialog(QERT * form) QERTDialog::QERTDialog(QERT * form)
: QERTDialogBase(0, 0, false, 0), : QERTDialogBase(0, 0, false, 0),
form_(form) form_(form)

View File

@ -20,18 +20,14 @@
class QERT; class QERT;
class QERTDialog : public QERTDialogBase class QERTDialog : public QERTDialogBase {
{ Q_OBJECT Q_OBJECT
public: public:
QERTDialog(QERT * form); QERTDialog(QERT * form);
protected slots: protected slots:
virtual void change_adaptor(); virtual void change_adaptor();
protected: protected:
virtual void closeEvent(QCloseEvent * e); virtual void closeEvent(QCloseEvent * e);
private: private:
QERT * form_; QERT * form_;
}; };

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 John Levon * \author John Levon
* *
* Full author contact details are available in file CREDITS * Full author contact details are available in file CREDITS
*/ */
@ -23,9 +23,10 @@
#include "QErrorDialog.h" #include "QErrorDialog.h"
#include "QError.h" #include "QError.h"
#include "Qt2BC.h" #include "Qt2BC.h"
typedef Qt2CB<ControlError, Qt2DB<QErrorDialog> > base_class; typedef Qt2CB<ControlError, Qt2DB<QErrorDialog> > base_class;
QError::QError() QError::QError()
: base_class(_("LaTeX Error")) : base_class(_("LaTeX Error"))
{ {

View File

@ -22,17 +22,16 @@ class ControlError;
class QErrorDialog; class QErrorDialog;
class QError : class QError
public Qt2CB<ControlError, Qt2DB<QErrorDialog> > : public Qt2CB<ControlError, Qt2DB<QErrorDialog> >
{ {
public:
friend class QErrorDialog; friend class QErrorDialog;
public:
QError(); QError();
private: private:
/// Apply changes /// Apply changes
virtual void apply() {}; virtual void apply() {}
/// update /// update
virtual void update_contents(); virtual void update_contents();
/// build the dialog /// build the dialog

View File

@ -3,24 +3,25 @@
* 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 John Levon * \author John Levon
* *
* Full author contact details are available in file CREDITS * Full author contact details are available in file CREDITS
*/ */
#include <config.h> #include <config.h>
#ifdef __GNUG__ #ifdef __GNUG__
#pragma implementation #pragma implementation
#endif #endif
#include "QError.h" #include "QError.h"
#include <qwidget.h> #include <qwidget.h>
#include <qpushbutton.h> #include <qpushbutton.h>
#include "QErrorDialog.h" #include "QErrorDialog.h"
QErrorDialog::QErrorDialog(QError * form) QErrorDialog::QErrorDialog(QError * form)
: QErrorDialogBase(0, 0, false, 0), : QErrorDialogBase(0, 0, false, 0),
form_(form) form_(form)

View File

@ -20,15 +20,12 @@
class QError; class QError;
class QErrorDialog : public QErrorDialogBase class QErrorDialog : public QErrorDialogBase {
{ Q_OBJECT Q_OBJECT
public: public:
QErrorDialog(QError * form); QErrorDialog(QError * form);
protected: protected:
virtual void closeEvent(QCloseEvent * e); virtual void closeEvent(QCloseEvent * e);
private: private:
QError * form_; QError * form_;
}; };

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 John Levon * \author John Levon
* *
* Full author contact details are available in file CREDITS * Full author contact details are available in file CREDITS
*/ */
@ -14,8 +14,6 @@
#pragma implementation #pragma implementation
#endif #endif
#include <vector>
#include "ControlExternal.h" #include "ControlExternal.h"
#include "gettext.h" #include "gettext.h"
@ -27,9 +25,12 @@
#include "QExternalDialog.h" #include "QExternalDialog.h"
#include "QExternal.h" #include "QExternal.h"
#include "Qt2BC.h" #include "Qt2BC.h"
#include <vector>
typedef Qt2CB<ControlExternal, Qt2DB<QExternalDialog> > base_class; typedef Qt2CB<ControlExternal, Qt2DB<QExternalDialog> > base_class;
QExternal::QExternal() QExternal::QExternal()
: base_class(_("External")) : base_class(_("External"))
{ {
@ -64,26 +65,28 @@ void QExternal::update_contents()
dialog_->paramsED->setText(params.parameters.c_str()); dialog_->paramsED->setText(params.parameters.c_str());
dialog_->externalCO->setCurrentItem(controller().getTemplateNumber(params.templ.lyxName)); dialog_->externalCO->setCurrentItem(controller().getTemplateNumber(params.templ.lyxName));
dialog_->externalTV->setText(controller().params().templ.helpText.c_str()); dialog_->externalTV->setText(params.templ.helpText.c_str());
isValid(); isValid();
} }
string const & QExternal::helpText() string const & QExternal::helpText()
{ {
controller().params().templ = controller().getTemplate(dialog_->externalCO->currentItem() + 1); InsetExternal::Params & params = controller().params();
return controller().params().templ.helpText;
params.templ = controller().getTemplate(dialog_->externalCO->currentItem() + 1);
return params.templ.helpText;
} }
void QExternal::apply() void QExternal::apply()
{ {
controller().params().filename = InsetExternal::Params & params = controller().params();
string(dialog_->fileED->text().latin1());
controller().params().parameters =
string(dialog_->paramsED->text().latin1());
controller().params().templ = controller().getTemplate(dialog_->externalCO->currentItem() + 1); params.filename = dialog_->fileED->text().latin1();
params.parameters = dialog_->paramsED->text().latin1();
params.templ = controller().getTemplate(dialog_->externalCO->currentItem() + 1);
} }

View File

@ -21,17 +21,15 @@
class ControlExternal; class ControlExternal;
class QExternalDialog; class QExternalDialog;
class QExternal : class QExternal
public Qt2CB<ControlExternal, Qt2DB<QExternalDialog> > : public Qt2CB<ControlExternal, Qt2DB<QExternalDialog> >
{ {
public:
friend class QExternalDialog; friend class QExternalDialog;
public:
QExternal(); QExternal();
protected: protected:
virtual bool isValid(); virtual bool isValid();
private: private:
/// Apply changes /// Apply changes
virtual void apply(); virtual void apply();

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 John Levon * \author John Levon
* *
* Full author contact details are available in file CREDITS * Full author contact details are available in file CREDITS
*/ */
@ -16,7 +16,7 @@
#include "gettext.h" #include "gettext.h"
#include "ControlExternal.h" #include "ControlExternal.h"
#include <qwidget.h> #include <qwidget.h>
#include <qpushbutton.h> #include <qpushbutton.h>
#include <qfiledialog.h> #include <qfiledialog.h>
@ -27,6 +27,7 @@
#include "QExternalDialog.h" #include "QExternalDialog.h"
#include "QExternal.h" #include "QExternal.h"
QExternalDialog::QExternalDialog(QExternal * form) QExternalDialog::QExternalDialog(QExternal * form)
: QExternalDialogBase(0, 0, false, 0), : QExternalDialogBase(0, 0, false, 0),
form_(form) form_(form)
@ -44,7 +45,7 @@ void QExternalDialog::show()
fileED->setFocus(); fileED->setFocus();
} }
void QExternalDialog::change_adaptor() void QExternalDialog::change_adaptor()
{ {
form_->changed(); form_->changed();
@ -81,8 +82,11 @@ void QExternalDialog::updateClicked()
void QExternalDialog::browseClicked() void QExternalDialog::browseClicked()
{ {
QString file = QFileDialog::getOpenFileName(QString::null, QString file =
_("External material (*)"), this, 0, _("Select external material")); QFileDialog::getOpenFileName(QString::null,
_("External material (*)"),
this, 0,
_("Select external material"));
if (!file.isNull()) { if (!file.isNull()) {
fileED->setText(file.latin1()); fileED->setText(file.latin1());
form_->changed(); form_->changed();

View File

@ -20,14 +20,12 @@
class QExternal; class QExternal;
class QExternalDialog : public QExternalDialogBase class QExternalDialog : public QExternalDialogBase {
{ Q_OBJECT Q_OBJECT
public: public:
QExternalDialog(QExternal * form); QExternalDialog(QExternal * form);
virtual void show(); virtual void show();
protected slots: protected slots:
virtual void change_adaptor(); virtual void change_adaptor();
virtual void editClicked(); virtual void editClicked();
@ -35,10 +33,8 @@ protected slots:
virtual void updateClicked(); virtual void updateClicked();
virtual void browseClicked(); virtual void browseClicked();
virtual void templateChanged(); virtual void templateChanged();
protected: protected:
virtual void closeEvent(QCloseEvent * e); virtual void closeEvent(QCloseEvent * e);
private: private:
QExternal * form_; QExternal * form_;
}; };

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
*/ */
@ -27,6 +27,7 @@
typedef Qt2CB<ControlFloat, Qt2DB<QFloatDialog> > base_class; typedef Qt2CB<ControlFloat, Qt2DB<QFloatDialog> > base_class;
QFloat::QFloat() QFloat::QFloat()
: base_class(_("Float Settings")) : base_class(_("Float Settings"))
{ {
@ -63,7 +64,9 @@ void QFloat::update_contents()
bool force = false; bool force = false;
bool here_definitely = false; bool here_definitely = false;
string const placement(controller().params().placement); FloatParams const & params = controller().params();
string const & placement = params.placement;
if (placement.empty()) { if (placement.empty()) {
def_placement = true; def_placement = true;
@ -86,7 +89,7 @@ void QFloat::update_contents()
here = true; here = true;
} }
} }
dialog_->defaultsCB->setChecked(def_placement); dialog_->defaultsCB->setChecked(def_placement);
dialog_->topCB->setChecked(top); dialog_->topCB->setChecked(top);
dialog_->bottomCB->setChecked(bottom); dialog_->bottomCB->setChecked(bottom);
@ -95,25 +98,27 @@ void QFloat::update_contents()
dialog_->ignoreCB->setChecked(force); dialog_->ignoreCB->setChecked(force);
dialog_->ignoreCB->setEnabled(top || bottom || page || here); dialog_->ignoreCB->setEnabled(top || bottom || page || here);
dialog_->heredefinitelyCB->setChecked(here_definitely); dialog_->heredefinitelyCB->setChecked(here_definitely);
if (controller().params().wide) { if (params.wide) {
dialog_->herepossiblyCB->setChecked(false); dialog_->herepossiblyCB->setChecked(false);
dialog_->bottomCB->setChecked(false); dialog_->bottomCB->setChecked(false);
} }
dialog_->spanCB->setChecked(controller().params().wide); dialog_->spanCB->setChecked(params.wide);
} }
void QFloat::apply() void QFloat::apply()
{ {
controller().params().wide = dialog_->spanCB->isChecked(); FloatParams & params = controller().params();
params.wide = dialog_->spanCB->isChecked();
if (dialog_->defaultsCB->isChecked()) { if (dialog_->defaultsCB->isChecked()) {
controller().params().placement = ""; params.placement.erase();
return; return;
} }
string placement; string placement;
if (dialog_->heredefinitelyCB->isChecked()) { if (dialog_->heredefinitelyCB->isChecked()) {
@ -135,5 +140,5 @@ void QFloat::apply()
placement += "h"; placement += "h";
} }
} }
controller().params().placement = placement; params.placement = placement;
} }

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
*/ */
@ -23,7 +23,8 @@
#include "QFloatDialog.h" #include "QFloatDialog.h"
#include "QFloat.h" #include "QFloat.h"
QFloatDialog::QFloatDialog(QFloat * form) QFloatDialog::QFloatDialog(QFloat * form)
: QFloatDialogBase(0, 0, false, 0), : QFloatDialogBase(0, 0, false, 0),
form_(form) form_(form)
@ -60,7 +61,7 @@ void QFloatDialog::tbhpClicked()
allow |= herepossiblyCB->isChecked(); allow |= herepossiblyCB->isChecked();
ignoreCB->setEnabled(allow); ignoreCB->setEnabled(allow);
} }
void QFloatDialog::heredefinitelyClicked() void QFloatDialog::heredefinitelyClicked()
{ {
@ -80,13 +81,13 @@ void QFloatDialog::spanClicked()
bool const span(spanCB->isChecked()); bool const span(spanCB->isChecked());
if (!defaultsCB->isChecked()) { if (!defaultsCB->isChecked()) {
herepossiblyCB->setEnabled(!span); herepossiblyCB->setEnabled(!span);
heredefinitelyCB->setEnabled(!span); heredefinitelyCB->setEnabled(!span);
} }
if (!span) if (!span)
return; return;
herepossiblyCB->setChecked(false); herepossiblyCB->setChecked(false);
heredefinitelyCB->setChecked(false); heredefinitelyCB->setChecked(false);
} }

View File

@ -20,21 +20,17 @@
class QFloat; class QFloat;
class QFloatDialog : public QFloatDialogBase class QFloatDialog : public QFloatDialogBase {
{ Q_OBJECT Q_OBJECT
public: public:
QFloatDialog(QFloat * form); QFloatDialog(QFloat * form);
protected slots: protected slots:
virtual void change_adaptor(); virtual void change_adaptor();
virtual void tbhpClicked(); virtual void tbhpClicked();
virtual void heredefinitelyClicked(); virtual void heredefinitelyClicked();
virtual void spanClicked(); virtual void spanClicked();
protected: protected:
virtual void closeEvent(QCloseEvent * e); virtual void closeEvent(QCloseEvent * e);
private: private:
QFloat * form_; QFloat * form_;
}; };

View File

@ -3,8 +3,8 @@
* 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 John Levon * \author John Levon
* \author Edwin Leuven * \author Edwin Leuven
* *
* Full author contact details are available in file CREDITS * Full author contact details are available in file CREDITS
*/ */
@ -43,6 +43,7 @@
typedef Qt2CB<ControlGraphics, Qt2DB<QGraphicsDialog> > base_class; typedef Qt2CB<ControlGraphics, Qt2DB<QGraphicsDialog> > base_class;
QGraphics::QGraphics() QGraphics::QGraphics()
: base_class(_("Graphics")) : base_class(_("Graphics"))
{ {
@ -103,15 +104,19 @@ void QGraphics::update_contents()
string unit = "cm"; string unit = "cm";
switch (lyxrc.default_papersize) { switch (lyxrc.default_papersize) {
case BufferParams::PAPER_DEFAULT: break; case BufferParams::PAPER_DEFAULT: break;
case BufferParams::PAPER_USLETTER: case BufferParams::PAPER_USLETTER:
case BufferParams::PAPER_LEGALPAPER: case BufferParams::PAPER_LEGALPAPER:
case BufferParams::PAPER_EXECUTIVEPAPER: unit = "in"; break; case BufferParams::PAPER_EXECUTIVEPAPER:
unit = "in";
break;
case BufferParams::PAPER_A3PAPER: case BufferParams::PAPER_A3PAPER:
case BufferParams::PAPER_A4PAPER: case BufferParams::PAPER_A4PAPER:
case BufferParams::PAPER_A5PAPER: case BufferParams::PAPER_A5PAPER:
case BufferParams::PAPER_B5PAPER: unit = "cm"; break; case BufferParams::PAPER_B5PAPER:
unit = "cm";
break;
} }
dialog_->filename->setText(igp.filename.c_str()); dialog_->filename->setText(igp.filename.c_str());
@ -148,7 +153,7 @@ void QGraphics::update_contents()
dialog_->subfigure->setChecked(igp.subcaption); dialog_->subfigure->setChecked(igp.subcaption);
dialog_->subcaption->setText(igp.subcaptionText.c_str()); dialog_->subcaption->setText(igp.subcaptionText.c_str());
int item; int item = 0;
switch (igp.display) { switch (igp.display) {
case grfx::DefaultDisplay: item = 0; break; case grfx::DefaultDisplay: item = 0; break;
case grfx::MonochromeDisplay: item = 1; break; case grfx::MonochromeDisplay: item = 1; break;
@ -187,7 +192,7 @@ void QGraphics::apply()
igp.filename = dialog_->filename->text(); igp.filename = dialog_->filename->text();
if (!controller().bbChanged) { if (!controller().bbChanged) {
igp.bb = string(); igp.bb.erase();
} else { } else {
string bb; string bb;
string lbX(dialog_->lbX->text()); string lbX(dialog_->lbX->text());
@ -230,7 +235,7 @@ void QGraphics::apply()
if (!dialog_->displayCB->isChecked()) if (!dialog_->displayCB->isChecked())
igp.display = grfx::NoDisplay; igp.display = grfx::NoDisplay;
string value(dialog_->width->text()); string value(dialog_->width->text());
igp.width = LyXLength(strToDbl(value), dialog_->widthUnit->currentLengthItem()); igp.width = LyXLength(strToDbl(value), dialog_->widthUnit->currentLengthItem());
value = string(dialog_->height->text()); value = string(dialog_->height->text());
@ -239,7 +244,7 @@ void QGraphics::apply()
igp.keepAspectRatio = dialog_->aspectratio->isChecked(); igp.keepAspectRatio = dialog_->aspectratio->isChecked();
igp.noUnzip = dialog_->unzipCB->isChecked(); igp.noUnzip = dialog_->unzipCB->isChecked();
igp.lyxscale = strToInt(string(dialog_->displayscale->text())); igp.lyxscale = strToInt(string(dialog_->displayscale->text()));
igp.rotateAngle = strToDbl(string(dialog_->angle->text())); igp.rotateAngle = strToDbl(string(dialog_->angle->text()));
@ -251,7 +256,7 @@ void QGraphics::apply()
if ((dialog_->origin->currentItem()) > 0) if ((dialog_->origin->currentItem()) > 0)
igp.rotateOrigin = dialog_->origin->currentText(); igp.rotateOrigin = dialog_->origin->currentText();
else else
igp.rotateOrigin = string(); igp.rotateOrigin.erase();
igp.special = dialog_->latexoptions->text(); igp.special = dialog_->latexoptions->text();
} }
@ -284,6 +289,6 @@ void QGraphics::get()
bool QGraphics::isValid() bool QGraphics::isValid()
{ {
// FIXME: we need more here. // FIXME: we need more here.
return !string(dialog_->filename->text().latin1()).empty(); return !string(dialog_->filename->text().latin1()).empty();
} }

View File

@ -31,10 +31,8 @@ public:
friend class QGraphicsDialog; friend class QGraphicsDialog;
/// ///
QGraphics(); QGraphics();
protected: protected:
virtual bool isValid(); virtual bool isValid();
private: private:
/// Apply changes /// Apply changes
virtual void apply(); virtual void apply();

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 John Levon * \author John Levon
* *
* Full author contact details are available in file CREDITS * Full author contact details are available in file CREDITS
*/ */
@ -14,8 +14,6 @@
#pragma implementation #pragma implementation
#endif #endif
#include <vector>
#include "ControlGraphics.h" #include "ControlGraphics.h"
#include "debug.h" #include "debug.h"
#include "LString.h" #include "LString.h"
@ -28,6 +26,9 @@
#include "QGraphicsDialog.h" #include "QGraphicsDialog.h"
#include "QGraphics.h" #include "QGraphics.h"
#include <vector>
QGraphicsDialog::QGraphicsDialog(QGraphics * form) QGraphicsDialog::QGraphicsDialog(QGraphics * form)
: QGraphicsDialogBase(0, 0, false, 0), : QGraphicsDialogBase(0, 0, false, 0),
form_(form) form_(form)
@ -44,12 +45,12 @@ QGraphicsDialog::QGraphicsDialog(QGraphics * form)
void QGraphicsDialog::show() void QGraphicsDialog::show()
{ {
QGraphicsDialogBase::show(); QGraphicsDialogBase::show();
filename->setFocus(); filename->setFocus();
} }
void QGraphicsDialog::change_adaptor() void QGraphicsDialog::change_adaptor()
{ {
form_->changed(); form_->changed();

View File

@ -20,22 +20,18 @@
class QGraphics; class QGraphics;
class QGraphicsDialog : public QGraphicsDialogBase class QGraphicsDialog : public QGraphicsDialogBase {
{ Q_OBJECT Q_OBJECT
public: public:
QGraphicsDialog(QGraphics * form); QGraphicsDialog(QGraphics * form);
virtual void show(); virtual void show();
protected slots: protected slots:
virtual void change_adaptor(); virtual void change_adaptor();
virtual void browse_clicked(); virtual void browse_clicked();
virtual void get_clicked(); virtual void get_clicked();
protected: protected:
virtual void closeEvent(QCloseEvent * e); virtual void closeEvent(QCloseEvent * e);
private: private:
QGraphics * form_; QGraphics * form_;
}; };

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 John Levon * \author John Levon
* *
* Full author contact details are available in file CREDITS * Full author contact details are available in file CREDITS
*/ */
@ -17,7 +17,7 @@
#include "ControlInclude.h" #include "ControlInclude.h"
#include "gettext.h" #include "gettext.h"
#include "debug.h" #include "debug.h"
#include "QIncludeDialog.h" #include "QIncludeDialog.h"
#include "QInclude.h" #include "QInclude.h"
#include "Qt2BC.h" #include "Qt2BC.h"
@ -27,8 +27,10 @@
#include <qcheckbox.h> #include <qcheckbox.h>
#include <qcombobox.h> #include <qcombobox.h>
typedef Qt2CB<ControlInclude, Qt2DB<QIncludeDialog> > base_class; typedef Qt2CB<ControlInclude, Qt2DB<QIncludeDialog> > base_class;
QInclude::QInclude() QInclude::QInclude()
: base_class(_("Include")) : base_class(_("Include"))
{ {
@ -50,9 +52,11 @@ void QInclude::build_dialog()
void QInclude::update_contents() void QInclude::update_contents()
{ {
dialog_->filenameED->setText(controller().params().cparams.getContents().c_str()); InsetInclude::Params const & params = controller().params();
string const cmdname = controller().params().cparams.getCmdName(); dialog_->filenameED->setText(params.cparams.getContents().c_str());
string const & cmdname = params.cparams.getCmdName();
dialog_->visiblespaceCB->setChecked(false); dialog_->visiblespaceCB->setChecked(false);
dialog_->visiblespaceCB->setEnabled(false); dialog_->visiblespaceCB->setEnabled(false);
@ -71,19 +75,20 @@ void QInclude::update_contents()
void QInclude::apply() void QInclude::apply()
{ {
controller().params().cparams. InsetInclude::Params & params = controller().params();
setContents(dialog_->filenameED->text().latin1());
params.cparams.setContents(dialog_->filenameED->text().latin1());
int const item = dialog_->typeCO->currentItem(); int const item = dialog_->typeCO->currentItem();
if (item == 0) if (item == 0)
controller().params().flag = InsetInclude::INPUT; params.flag = InsetInclude::INPUT;
else if (item == 1) else if (item == 1)
controller().params().flag = InsetInclude::INCLUDE; params.flag = InsetInclude::INCLUDE;
else { else {
if (dialog_->visiblespaceCB->isChecked()) if (dialog_->visiblespaceCB->isChecked())
controller().params().flag = InsetInclude::VERBAST; params.flag = InsetInclude::VERBAST;
else else
controller().params().flag = InsetInclude::VERB; params.flag = InsetInclude::VERB;
} }
} }
@ -93,9 +98,9 @@ void QInclude::browse()
ControlInclude::Type type; ControlInclude::Type type;
int const item = dialog_->typeCO->currentItem(); int const item = dialog_->typeCO->currentItem();
if (item==0) if (item == 0)
type = ControlInclude::INPUT; type = ControlInclude::INPUT;
else if (item==1) else if (item == 1)
type = ControlInclude::INCLUDE; type = ControlInclude::INCLUDE;
else else
type = ControlInclude::VERBATIM; type = ControlInclude::VERBATIM;

View File

@ -30,10 +30,8 @@ public:
friend class QIncludeDialog; friend class QIncludeDialog;
/// ///
QInclude(); QInclude();
protected: protected:
virtual bool isValid(); virtual bool isValid();
private: private:
/// Apply changes /// Apply changes
virtual void apply(); virtual void apply();

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 John Levon * \author John Levon
* *
* Full author contact details are available in file CREDITS * Full author contact details are available in file CREDITS
*/ */
@ -14,8 +14,6 @@
#pragma implementation #pragma implementation
#endif #endif
#include <vector>
#include "ControlInclude.h" #include "ControlInclude.h"
#include "debug.h" #include "debug.h"
#include "LString.h" #include "LString.h"
@ -28,6 +26,9 @@
#include "QIncludeDialog.h" #include "QIncludeDialog.h"
#include "QInclude.h" #include "QInclude.h"
#include <vector>
QIncludeDialog::QIncludeDialog(QInclude * form) QIncludeDialog::QIncludeDialog(QInclude * form)
: QIncludeDialogBase(0, 0, false, 0), : QIncludeDialogBase(0, 0, false, 0),
form_(form) form_(form)
@ -43,8 +44,8 @@ void QIncludeDialog::show()
{ {
QIncludeDialogBase::show(); QIncludeDialogBase::show();
filenameED->setFocus(); filenameED->setFocus();
} }
void QIncludeDialog::change_adaptor() void QIncludeDialog::change_adaptor()
{ {

View File

@ -20,25 +20,21 @@
class QInclude; class QInclude;
class QIncludeDialog : public QIncludeDialogBase class QIncludeDialog : public QIncludeDialogBase {
{ Q_OBJECT Q_OBJECT
public: public:
QIncludeDialog(QInclude * form); QIncludeDialog(QInclude * form);
void updateLists(); void updateLists();
virtual void show(); virtual void show();
protected slots: protected slots:
virtual void change_adaptor(); virtual void change_adaptor();
virtual void loadClicked(); virtual void loadClicked();
virtual void browseClicked(); virtual void browseClicked();
virtual void typeChanged(int v); virtual void typeChanged(int v);
protected: protected:
virtual void closeEvent(QCloseEvent * e); virtual void closeEvent(QCloseEvent * e);
private: private:
QInclude * form_; QInclude * form_;
}; };

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 John Levon * \author John Levon
* *
* Full author contact details are available in file CREDITS * Full author contact details are available in file CREDITS
*/ */
@ -25,6 +25,7 @@
typedef Qt2CB<ControlIndex, Qt2DB<QIndexDialog> > base_class; typedef Qt2CB<ControlIndex, Qt2DB<QIndexDialog> > base_class;
QIndex::QIndex() QIndex::QIndex()
: base_class(_("Index")) : base_class(_("Index"))
{ {

View File

@ -26,14 +26,12 @@ class QIndexDialog;
class QIndex : class QIndex :
public Qt2CB<ControlIndex, Qt2DB<QIndexDialog> > public Qt2CB<ControlIndex, Qt2DB<QIndexDialog> >
{ {
public:
friend class QIndexDialog; friend class QIndexDialog;
public:
QIndex(); QIndex();
protected: protected:
virtual bool isValid(); virtual bool isValid();
private: private:
/// Apply changes /// Apply changes
virtual void apply(); virtual void apply();

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 John Levon * \author John Levon
* *
* Full author contact details are available in file CREDITS * Full author contact details are available in file CREDITS
*/ */
@ -18,11 +18,12 @@
#include "QIndex.h" #include "QIndex.h"
#include "QIndexDialog.h" #include "QIndexDialog.h"
#include <qpushbutton.h> #include <qpushbutton.h>
#include <qlineedit.h> #include <qlineedit.h>
#include <qwhatsthis.h> #include <qwhatsthis.h>
QIndexDialog::QIndexDialog(QIndex * form) QIndexDialog::QIndexDialog(QIndex * form)
: QIndexDialogBase(0, 0, false, 0), : QIndexDialogBase(0, 0, false, 0),
form_(form) form_(form)
@ -51,11 +52,11 @@ QIndexDialog::QIndexDialog(QIndex * form)
void QIndexDialog::show() void QIndexDialog::show()
{ {
QIndexDialogBase::show(); QIndexDialogBase::show();
keywordED->setFocus(); keywordED->setFocus();
} }
void QIndexDialog::change_adaptor() void QIndexDialog::change_adaptor()
{ {
form_->changed(); form_->changed();

View File

@ -20,20 +20,16 @@
class QIndex; class QIndex;
class QIndexDialog : public QIndexDialogBase class QIndexDialog : public QIndexDialogBase {
{ Q_OBJECT Q_OBJECT
public: public:
QIndexDialog(QIndex * form); QIndexDialog(QIndex * form);
virtual void show(); virtual void show();
protected slots: protected slots:
virtual void change_adaptor(); virtual void change_adaptor();
protected: protected:
virtual void closeEvent(QCloseEvent * e); virtual void closeEvent(QCloseEvent * e);
private: private:
QIndex * form_; QIndex * form_;
}; };

View File

@ -4,7 +4,7 @@
* Licence details can be found in the file COPYING. * Licence details can be found in the file COPYING.
* *
* \author Angus Leeming * \author Angus Leeming
* \author John Levon * \author John Levon
* *
* Full author contact details are available in file CREDITS * Full author contact details are available in file CREDITS
*/ */
@ -46,7 +46,7 @@ Image::ImagePtr QLImage::newImage()
Image::FormatList QLImage::loadableFormats() Image::FormatList QLImage::loadableFormats()
{ {
static FormatList fmts; static FormatList fmts;
if (!fmts.empty()) if (!fmts.empty())
return fmts; return fmts;
@ -58,14 +58,14 @@ Image::FormatList QLImage::loadableFormats()
<< "\nThe image loader can load the following directly:\n"; << "\nThe image loader can load the following directly:\n";
QStrList qt_formats = QImageIO::inputFormats(); QStrList qt_formats = QImageIO::inputFormats();
QStrListIterator it(qt_formats); QStrListIterator it(qt_formats);
for (; it.current(); ++it) { for (; it.current(); ++it) {
lyxerr[Debug::GRAPHICS] << it.current() << endl; lyxerr[Debug::GRAPHICS] << it.current() << endl;
string ext = lowercase(it.current()); string ext = lowercase(it.current());
// special case // special case
if (ext == "jpeg") if (ext == "jpeg")
ext = "jpg"; ext = "jpg";
@ -99,7 +99,8 @@ QLImage::QLImage()
QLImage::QLImage(QLImage const & other) QLImage::QLImage(QLImage const & other)
: Image(other), pixmap_(other.pixmap_), xformed_pixmap_(other.xformed_pixmap_) : Image(other), pixmap_(other.pixmap_),
xformed_pixmap_(other.xformed_pixmap_)
{ {
} }
@ -142,11 +143,11 @@ void QLImage::load(string const & filename)
finishedLoading(false); finishedLoading(false);
return; return;
} }
lyxerr[Debug::GRAPHICS] << "just Loaded." << endl; lyxerr[Debug::GRAPHICS] << "just Loaded." << endl;
xformed_pixmap_ = pixmap_; xformed_pixmap_ = pixmap_;
lyxerr[Debug::GRAPHICS] << "pixmap isNull " << pixmap_.isNull() lyxerr[Debug::GRAPHICS] << "pixmap isNull " << pixmap_.isNull()
<< " xformed_pixmap_ isNull " << xformed_pixmap_.isNull() << endl; << " xformed_pixmap_ isNull " << xformed_pixmap_.isNull() << endl;
finishedLoading(true); finishedLoading(true);
} }
@ -158,9 +159,9 @@ bool QLImage::setPixmap(Params const & params)
return false; return false;
lyxerr[Debug::GRAPHICS] << "setPixmap()" << endl; lyxerr[Debug::GRAPHICS] << "setPixmap()" << endl;
// FIXME // FIXME
#if 0 #if 0
int color_key; int color_key;
switch (params.display) { switch (params.display) {
case MonochromeDisplay: case MonochromeDisplay:
@ -187,7 +188,7 @@ bool QLImage::setPixmap(Params const & params)
flimage_replace_pixel(image_, image_->fill_color, fill); flimage_replace_pixel(image_, image_->fill_color, fill);
image_->fill_color = fill; image_->fill_color = fill;
} }
#endif #endif
return true; return true;
} }
@ -239,7 +240,7 @@ void QLImage::rotate(Params const & params)
// degree units. // degree units.
lyxerr[Debug::GRAPHICS] << "rotating image by " << params.angle << " degrees" << endl; lyxerr[Debug::GRAPHICS] << "rotating image by " << params.angle << " degrees" << endl;
QWMatrix m; QWMatrix m;
m.rotate(-params.angle); m.rotate(-params.angle);
xformed_pixmap_ = xformed_pixmap_.xForm(m); xformed_pixmap_ = xformed_pixmap_.xForm(m);

View File

@ -23,8 +23,7 @@
namespace grfx { namespace grfx {
class QLImage : public Image class QLImage : public Image {
{
public: public:
/// Access to this class is through this static method. /// Access to this class is through this static method.
static ImagePtr newImage(); static ImagePtr newImage();
@ -71,7 +70,6 @@ public:
/// Scale the image using params. /// Scale the image using params.
virtual void scale(Params const & params); virtual void scale(Params const & params);
private: private:
/// Access to the class is through newImage() and clone. /// Access to the class is through newImage() and clone.
QLImage(); QLImage();

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 John Levon * \author John Levon
* *
* Full author contact details are available in file CREDITS * Full author contact details are available in file CREDITS
*/ */
@ -14,11 +14,8 @@
#pragma implementation #pragma implementation
#endif #endif
#include <iostream>
#include <boost/scoped_array.hpp>
#include "font_metrics.h" #include "font_metrics.h"
#include "support/lstrings.h" #include "support/lstrings.h"
#include "lyxrc.h" #include "lyxrc.h"
#include "debug.h" #include "debug.h"
#include "LyXView.h" #include "LyXView.h"
@ -29,17 +26,22 @@
#include "qfont_loader.h" #include "qfont_loader.h"
#include "QLPainter.h" #include "QLPainter.h"
#include "QLImage.h" #include "QLImage.h"
#include <boost/scoped_array.hpp>
#include <qpainter.h> #include <qpainter.h>
#include <qbrush.h> #include <qbrush.h>
#include <qcolor.h> #include <qcolor.h>
#include <iostream>
using std::endl; using std::endl;
QLPainter::QLPainter(QWorkArea & qwa) QLPainter::QLPainter(QWorkArea & qwa)
: Painter(), owner_(qwa), paint_check_(0) : Painter(), owner_(qwa), paint_check_(0)
{ {
qp_.reset(new QPainter()); qp_.reset(new QPainter);
} }
@ -49,7 +51,7 @@ void QLPainter::start()
qp_->begin(owner_.getPixmap()); qp_->begin(owner_.getPixmap());
} }
void QLPainter::end() void QLPainter::end()
{ {
if (paint_check_ == 0) { if (paint_check_ == 0) {
@ -59,7 +61,7 @@ void QLPainter::end()
} }
} }
int QLPainter::paperWidth() const int QLPainter::paperWidth() const
{ {
return owner_.workWidth(); return owner_.workWidth();
@ -71,29 +73,29 @@ int QLPainter::paperHeight() const
return owner_.workHeight(); return owner_.workHeight();
} }
QPainter & QLPainter::setPen(LColor::color c, QPainter & QLPainter::setPen(LColor::color c,
Painter::line_style ls, Painter::line_width lw) Painter::line_style ls, Painter::line_width lw)
{ {
QPen pen = qp_->pen(); QPen pen = qp_->pen();
pen.setColor(lcolor.getX11Name(c).c_str()); pen.setColor(lcolor.getX11Name(c).c_str());
switch (ls) { switch (ls) {
case line_solid: pen.setStyle(QPen::SolidLine); break; case line_solid: pen.setStyle(QPen::SolidLine); break;
case line_onoffdash: pen.setStyle(QPen::DotLine); break; case line_onoffdash: pen.setStyle(QPen::DotLine); break;
} }
switch (lw) { switch (lw) {
case line_thin: pen.setWidth(0); break; case line_thin: pen.setWidth(0); break;
case line_thick: pen.setWidth(3); break; case line_thick: pen.setWidth(3); break;
} }
qp_->setPen(pen); qp_->setPen(pen);
return *qp_; return *qp_;
} }
Painter & QLPainter::point(int x, int y, LColor::color c) Painter & QLPainter::point(int x, int y, LColor::color c)
{ {
setPen(c).drawPoint(x, y); setPen(c).drawPoint(x, y);
@ -101,7 +103,7 @@ Painter & QLPainter::point(int x, int y, LColor::color c)
} }
Painter & QLPainter::line(int x1, int y1, Painter & QLPainter::line(int x1, int y1,
int x2, int y2, int x2, int y2,
LColor::color col, LColor::color col,
line_style ls, line_style ls,
@ -112,7 +114,7 @@ Painter & QLPainter::line(int x1, int y1,
} }
Painter & QLPainter::lines(int const * xp, int const * yp, Painter & QLPainter::lines(int const * xp, int const * yp,
int np, int np,
LColor::color col, LColor::color col,
line_style ls, line_style ls,
@ -123,9 +125,7 @@ Painter & QLPainter::lines(int const * xp, int const * yp,
// Must use new as np is not known at compile time. // Must use new as np is not known at compile time.
boost::scoped_array<QCOORD> points(new QCOORD[np * 2]); boost::scoped_array<QCOORD> points(new QCOORD[np * 2]);
int j = 0; for (int i = 0, j = 0; i < np; ++i) {
for (int i = 0; i < np; ++i) {
points[j++] = xp[i]; points[j++] = xp[i];
points[j++] = yp[i]; points[j++] = yp[i];
} }
@ -136,51 +136,50 @@ Painter & QLPainter::lines(int const * xp, int const * yp,
} }
Painter & QLPainter::rectangle(int x, int y, Painter & QLPainter::rectangle(int x, int y,
int w, int h, int w, int h,
LColor::color col, LColor::color col,
line_style ls, line_style ls,
line_width lw) line_width lw)
{ {
//lyxerr << "rectangle " << x<<","<<y << " " <<w<<","<<h<<endl; //lyxerr << "rectangle " << x<<","<<y << " " <<w<<","<<h<<endl;
setPen(col, ls, lw).drawRect(x, y, w, h); setPen(col, ls, lw).drawRect(x, y, w, h);
return *this; return *this;
} }
Painter & QLPainter::fillRectangle(int x, int y, Painter & QLPainter::fillRectangle(int x, int y,
int w, int h, int w, int h,
LColor::color col) LColor::color col)
{ {
//lyxerr << "fillRectangle " << x<<","<<y << " " <<w<<","<<h<<endl; //lyxerr << "fillRectangle " << x<<","<<y << " " <<w<<","<<h<<endl;
qp_->fillRect(x, y, w, h, QColor(lcolor.getX11Name(col).c_str())); qp_->fillRect(x, y, w, h, QColor(lcolor.getX11Name(col).c_str()));
return *this; return *this;
} }
Painter & QLPainter::fillPolygon(int const * xp, int const * yp, Painter & QLPainter::fillPolygon(int const * xp, int const * yp,
int np, LColor::color col) int np, LColor::color col)
{ {
// Must use new as np is not known at compile time. // Must use new as np is not known at compile time.
boost::scoped_array<QCOORD> points(new QCOORD[np * 2]); boost::scoped_array<QCOORD> points(new QCOORD[np * 2]);
//if (1) return *this; //if (1) return *this;
int j = 0;
for (int i = 0, j = 0; i < np; ++i) {
for (int i = 0; i < np; ++i) {
points[j++] = xp[i]; points[j++] = xp[i];
points[j++] = yp[i]; points[j++] = yp[i];
} }
setPen(col); setPen(col);
qp_->setBrush(lcolor.getX11Name(col).c_str()); qp_->setBrush(lcolor.getX11Name(col).c_str());
qp_->drawPolygon(QPointArray(np, points.get())); qp_->drawPolygon(QPointArray(np, points.get()));
qp_->setBrush(Qt::NoBrush); qp_->setBrush(Qt::NoBrush);
return *this; return *this;
} }
Painter & QLPainter::arc(int x, int y, Painter & QLPainter::arc(int x, int y,
unsigned int w, unsigned int h, unsigned int w, unsigned int h,
int a1, int a2, LColor::color col) int a1, int a2, LColor::color col)
@ -188,13 +187,13 @@ Painter & QLPainter::arc(int x, int y,
lyxerr[Debug::GUI] << "arc: " << x<<","<<y lyxerr[Debug::GUI] << "arc: " << x<<","<<y
<< " " << w<<","<<h << ", angles " << " " << w<<","<<h << ", angles "
<< a1 << " - " << a2 << endl; << a1 << " - " << a2 << endl;
// LyX usings 1/64ths degree, Qt usings 1/16th // LyX usings 1/64ths degree, Qt usings 1/16th
setPen(col).drawArc(x, y, w, h, a1 / 4, a2 / 4); setPen(col).drawArc(x, y, w, h, a1 / 4, a2 / 4);
return *this; return *this;
} }
Painter & QLPainter::image(int x, int y, Painter & QLPainter::image(int x, int y,
int w, int h, int w, int h,
grfx::Image const & i) grfx::Image const & i)
{ {
@ -203,14 +202,14 @@ Painter & QLPainter::image(int x, int y,
} }
Painter & QLPainter::text(int x, int y, Painter & QLPainter::text(int x, int y,
string const & s, LyXFont const & f) string const & s, LyXFont const & f)
{ {
return text(x, y, s.data(), s.length(), f); return text(x, y, s.data(), s.length(), f);
} }
Painter & QLPainter::text(int x, int y, Painter & QLPainter::text(int x, int y,
char c, LyXFont const & f) char c, LyXFont const & f)
{ {
char s[2] = { c, '\0' }; char s[2] = { c, '\0' };
@ -228,7 +227,7 @@ void QLPainter::smallCapsText(int x, int y,
QFont const & qsmallfont = fontloader.get(smallfont); QFont const & qsmallfont = fontloader.get(smallfont);
QFontMetrics const & qfontm = QFontMetrics(qfont); QFontMetrics const & qfontm = QFontMetrics(qfont);
QFontMetrics const & qsmallfontm = QFontMetrics(qsmallfont); QFontMetrics const & qsmallfontm = QFontMetrics(qsmallfont);
int tmpx = x; int tmpx = x;
size_t ls = s.length(); size_t ls = s.length();
for (size_t i = 0; i < ls; ++i) { for (size_t i = 0; i < ls; ++i) {
@ -245,8 +244,8 @@ void QLPainter::smallCapsText(int x, int y,
} }
} }
Painter & QLPainter::text(int x, int y, Painter & QLPainter::text(int x, int y,
char const * s, size_t ls, char const * s, size_t ls,
LyXFont const & f) LyXFont const & f)
{ {
@ -263,7 +262,7 @@ Painter & QLPainter::text(int x, int y,
str[i] = QChar(encoding->ucs(s[i])); str[i] = QChar(encoding->ucs(s[i]));
// HACK: QT3 refuses to show single compose characters // HACK: QT3 refuses to show single compose characters
if (ls = 1 && str[0].unicode() >= 0x05b0 && str[0].unicode() <= 0x05c2) if (ls = 1 && str[0].unicode() >= 0x05b0 && str[0].unicode() <= 0x05c2)
str = ' '+str; str = ' ' + str;
#else #else
for (size_t i = 0; i < ls; ++i) for (size_t i = 0; i < ls; ++i)
str += QChar(encoding->ucs(s[i])); str += QChar(encoding->ucs(s[i]));
@ -285,6 +284,6 @@ Painter & QLPainter::text(int x, int y,
if (f.underbar() == LyXFont::ON) { if (f.underbar() == LyXFont::ON) {
underline(f, x, y, font_metrics::width(s, ls, f)); underline(f, x, y, font_metrics::width(s, ls, f));
} }
return *this; return *this;
} }

View File

@ -119,7 +119,6 @@ public:
/// draw a char at position x, y (y is the baseline) /// draw a char at position x, y (y is the baseline)
virtual Painter & text(int x, int y, virtual Painter & text(int x, int y,
char c, LyXFont const & f); char c, LyXFont const & f);
private: private:
/// draw small caps text /// draw small caps text
void smallCapsText(int x, int y, void smallCapsText(int x, int y,

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 John Levon * \author John Levon
* *
* Full author contact details are available in file CREDITS * Full author contact details are available in file CREDITS
*/ */
@ -17,49 +17,49 @@
#include "MenuBackend.h" #include "MenuBackend.h"
#include "lyxfunc.h" #include "lyxfunc.h"
#include "debug.h" #include "debug.h"
#include "QtView.h" #include "QtView.h"
#include "QLPopupMenu.h" #include "QLPopupMenu.h"
#include "support/lstrings.h" #include "support/lstrings.h"
using std::pair; using std::pair;
using std::make_pair; using std::make_pair;
namespace { namespace {
string const getLabel(MenuItem const & mi) string const getLabel(MenuItem const & mi)
{ {
string const shortcut = mi.shortcut(); string const shortcut = mi.shortcut();
string label = mi.label(); string label = subst(mi.label(), "&", "&&");
label = subst(label, "&", "&&");
if (shortcut.empty()) if (shortcut.empty())
return label; return label;
string::size_type pos = label.find(shortcut); string::size_type pos = label.find(shortcut);
if (pos == string::npos) if (pos == string::npos)
return label; return label;
label.insert(pos, "&"); label.insert(pos, "&");
return label; return label;
} }
} } // namespace anon
pair<int, QLPopupMenu *> createMenu(QMenuData * parent, MenuItem const * item, Menubar::Pimpl * owner, bool is_toplevel) pair<int, QLPopupMenu *>
createMenu(QMenuData * parent, MenuItem const * item, Menubar::Pimpl * owner, bool is_toplevel)
{ {
// FIXME: leaks ?? // FIXME: leaks ??
QLPopupMenu * pm = new QLPopupMenu(owner, item->submenuname(), is_toplevel); QLPopupMenu * pm = new QLPopupMenu(owner, item->submenuname(), is_toplevel);
int id = parent->insertItem(getLabel(*item).c_str(), pm); int id = parent->insertItem(getLabel(*item).c_str(), pm);
return make_pair(id, pm); return make_pair(id, pm);
} }
QLPopupMenu::QLPopupMenu(Menubar::Pimpl * owner, string const & name, bool toplevel) QLPopupMenu::QLPopupMenu(Menubar::Pimpl * owner,
string const & name, bool toplevel)
: owner_(owner), name_(name) : owner_(owner), name_(name)
{ {
if (toplevel) if (toplevel)
@ -67,27 +67,29 @@ QLPopupMenu::QLPopupMenu(Menubar::Pimpl * owner, string const & name, bool tople
connect(this, SIGNAL(activated(int)), connect(this, SIGNAL(activated(int)),
owner_->view(), SLOT(activated(int))); owner_->view(), SLOT(activated(int)));
} }
bool QLPopupMenu::disabled(Menu * menu) bool QLPopupMenu::disabled(Menu * menu)
{ {
bool disable = true; bool disable = true;
Menu::const_iterator m = menu->begin(); Menu::const_iterator m = menu->begin();
Menu::const_iterator end = menu->end(); Menu::const_iterator end = menu->end();
for (; m != end; ++m) { for (; m != end; ++m) {
if (m->kind() == MenuItem::Submenu && !disabled(m->submenu())) { if (m->kind() == MenuItem::Submenu
&& !disabled(m->submenu())) {
disable = false; disable = false;
} else { } else {
FuncStatus const status = FuncStatus const status =
owner_->view()->getLyXFunc().getStatus(m->action()); owner_->view()->getLyXFunc()
.getStatus(m->action());
if (!status.disabled()) if (!status.disabled())
disable = false; disable = false;
} }
} }
return disable; return disable;
} }
void QLPopupMenu::populate(Menu * menu) void QLPopupMenu::populate(Menu * menu)
{ {
@ -112,12 +114,12 @@ void QLPopupMenu::populate(Menu * menu)
} }
} }
void QLPopupMenu::showing() void QLPopupMenu::showing()
{ {
clear(); clear();
Menu tomenu; Menu tomenu;
Menu const frommenu = owner_->backend().getMenu(name_); Menu const frommenu = owner_->backend().getMenu(name_);
owner_->backend().expand(frommenu, tomenu, owner_->view()->buffer()); owner_->backend().expand(frommenu, tomenu, owner_->view()->buffer());
populate(&tomenu); populate(&tomenu);
} }

View File

@ -30,21 +30,21 @@ class QLPopupMenu;
/// create a sub-menu /// create a sub-menu
std::pair<int, QLPopupMenu *> std::pair<int, QLPopupMenu *>
createMenu(QMenuData * parent, MenuItem const * item, Menubar::Pimpl * owner, bool is_toplevel = false); createMenu(QMenuData * parent, MenuItem const * item,
Menubar::Pimpl * owner, bool is_toplevel = false);
/// a submenu /// a submenu
class QLPopupMenu : public QPopupMenu { class QLPopupMenu : public QPopupMenu {
Q_OBJECT Q_OBJECT
public: public:
QLPopupMenu(Menubar::Pimpl * owner, string const & name, bool toplevel); QLPopupMenu(Menubar::Pimpl * owner,
string const & name, bool toplevel);
/// populate the menu /// populate the menu
void populate(Menu * menu); void populate(Menu * menu);
public slots: public slots:
/// populate the toplevel menu and all children /// populate the toplevel menu and all children
void showing(); void showing();
private: private:
/// return true if the given submenu is disabled /// return true if the given submenu is disabled
bool disabled(Menu * menu); bool disabled(Menu * menu);

View File

@ -3,13 +3,12 @@
* 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 John Levon * \author John Levon
* *
* Full author contact details are available in file CREDITS * Full author contact details are available in file CREDITS
*/ */
#include <config.h> #include <config.h>
#include <fstream>
#ifdef __GNUG__ #ifdef __GNUG__
#pragma implementation #pragma implementation
@ -18,6 +17,7 @@
#include "LyXView.h" #include "LyXView.h"
#include "gettext.h" #include "gettext.h"
#include "ControlLog.h" #include "ControlLog.h"
#include "Lsstream.h"
#include <qtextview.h> #include <qtextview.h>
#include <qpushbutton.h> #include <qpushbutton.h>
@ -26,6 +26,8 @@
#include "QLog.h" #include "QLog.h"
#include "Qt2BC.h" #include "Qt2BC.h"
#include <fstream>
using std::ifstream; using std::ifstream;
using std::getline; using std::getline;
@ -47,7 +49,8 @@ void QLog::build_dialog()
void QLog::update_contents() void QLog::update_contents()
{ {
std::pair<Buffer::LogType, string> const logfile = controller().logfile(); std::pair<Buffer::LogType, string> const & logfile =
controller().logfile();
if (logfile.first == Buffer::buildlog) if (logfile.first == Buffer::buildlog)
dialog_->setCaption(_("Build log")); dialog_->setCaption(_("Build log"));
@ -65,11 +68,8 @@ void QLog::update_contents()
return; return;
} }
string text; ostringstream ost;
string line; ost << ifstr.rdbuf();
while (getline(ifstr, line)) dialog_->logTV->setText(ost.str().c_str());
text += line + "\n";
dialog_->logTV->setText(text.c_str());
} }

View File

@ -30,10 +30,9 @@ public:
friend class QLogDialog; friend class QLogDialog;
/// ///
QLog(); QLog();
private: private:
/// Apply changes /// Apply changes
virtual void apply() {}; virtual void apply() {}
/// update /// update
virtual void update_contents(); virtual void update_contents();
/// build the dialog /// build the dialog

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 John Levon * \author John Levon
* *
* Full author contact details are available in file CREDITS * Full author contact details are available in file CREDITS
*/ */
@ -14,17 +14,18 @@
#pragma implementation #pragma implementation
#endif #endif
#include <vector>
#include "LyXView.h" #include "LyXView.h"
#include "ControlLog.h" #include "ControlLog.h"
#include <qpushbutton.h> #include <qpushbutton.h>
#include <qtextview.h> #include <qtextview.h>
#include "QLogDialog.h" #include "QLogDialog.h"
#include "QLog.h" #include "QLog.h"
#include <vector>
QLogDialog::QLogDialog(QLog * form) QLogDialog::QLogDialog(QLog * form)
: QLogDialogBase(0, 0, false, 0), : QLogDialogBase(0, 0, false, 0),
form_(form) form_(form)

View File

@ -20,18 +20,14 @@
class QLog; class QLog;
class QLogDialog : public QLogDialogBase class QLogDialog : public QLogDialogBase {
{ Q_OBJECT Q_OBJECT
public: public:
QLogDialog(QLog * form); QLogDialog(QLog * form);
protected slots: protected slots:
virtual void updateClicked(); virtual void updateClicked();
protected: protected:
virtual void closeEvent(QCloseEvent * e); virtual void closeEvent(QCloseEvent * e);
private: private:
QLog * form_; QLog * form_;
}; };

View File

@ -4,7 +4,7 @@
* Licence details can be found in the file COPYING. * Licence details can be found in the file COPYING.
* *
* \author Asger and Juergen * \author Asger and Juergen
* \author John Levon * \author John Levon
* *
* Full author contact details are available in file CREDITS * Full author contact details are available in file CREDITS
*/ */
@ -18,23 +18,24 @@
#include "QLyXKeySym.h" #include "QLyXKeySym.h"
#include "qlkey.h" #include "qlkey.h"
#include "debug.h" #include "debug.h"
#include <qevent.h> #include <qevent.h>
using std::endl; using std::endl;
QLyXKeySym::QLyXKeySym() QLyXKeySym::QLyXKeySym()
: LyXKeySym(), key_(0) : LyXKeySym(), key_(0)
{ {
} }
void QLyXKeySym::set(QKeyEvent * ev) void QLyXKeySym::set(QKeyEvent * ev)
{ {
key_ = ev->key(); key_ = ev->key();
text_ = ev->text(); text_ = ev->text();
} }
void QLyXKeySym::init(string const & symbolname) void QLyXKeySym::init(string const & symbolname)
{ {
@ -43,12 +44,12 @@ void QLyXKeySym::init(string const & symbolname)
lyxerr[Debug::KEY] << "Init key to " << key_ << ", " << text_ << endl; lyxerr[Debug::KEY] << "Init key to " << key_ << ", " << text_ << endl;
} }
bool QLyXKeySym::isOK() const bool QLyXKeySym::isOK() const
{ {
return ! key_ == 0; return ! key_ == 0;
} }
bool QLyXKeySym::isModifier() const bool QLyXKeySym::isModifier() const
{ {
@ -68,17 +69,20 @@ string QLyXKeySym::getSymbolName() const
return sym; return sym;
} }
char QLyXKeySym::getISOEncoded() const char QLyXKeySym::getISOEncoded() const
{ {
lyxerr[Debug::KEY] << "getISO returning " << text_.latin1()[0] << endl; lyxerr[Debug::KEY] << "getISO returning " << text_.latin1()[0] << endl;
return text_.latin1()[0]; return text_.latin1()[0];
} }
bool QLyXKeySym::operator==(LyXKeySym const & k) const
bool operator==(LyXKeySym const & k1, LyXKeySym const & k2)
{ {
QLyXKeySym const & o = static_cast<QLyXKeySym const &>(k); // note we ignore text_ here (non-strict ==), because
// ignore text_ ! // text_ is not filled out by keymap initialisation
return o.key_ == key_;
return static_cast<QLyXKeySym const &>(k1).key()
== static_cast<QLyXKeySym const &>(k2).key();
} }

View File

@ -56,9 +56,10 @@ public:
* This relies on user to use the right encoding. * This relies on user to use the right encoding.
*/ */
virtual char getISOEncoded() const; virtual char getISOEncoded() const;
///
virtual bool operator==(LyXKeySym const & k) const; int key() const {
return key_;
}
private: private:
/// the Qt sym value /// the Qt sym value
int key_; int key_;

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 John Levon * \author John Levon
* *
* Full author contact details are available in file CREDITS * Full author contact details are available in file CREDITS
*/ */
@ -15,29 +15,33 @@
#endif #endif
#include "debug.h" #include "debug.h"
#include "commandtags.h" #include "commandtags.h"
#include "funcrequest.h" #include "funcrequest.h"
#include "LyXView.h" #include "LyXView.h"
#include "BufferView.h" #include "BufferView.h"
#include "QMathDialog.h" #include "QMathDialog.h"
#include "QMath.h" #include "QMath.h"
#include "iconpalette.h" #include "iconpalette.h"
// FIXME temporary HACK ! // needless to say, this can't last for long
extern BufferView * current_view;
// FIXME temporary HACK !
void createMathPanel() void createMathPanel()
{ {
static QMath * dialog = 0; static QMath * dialog = 0;
if (!dialog) { if (!dialog) {
dialog = new QMath(); dialog = new QMath;
dialog->build_dialog(); dialog->build_dialog();
} }
dialog->do_show(); dialog->do_show();
} }
QMath::QMath() QMath::QMath()
{ {
} }
@ -47,16 +51,13 @@ void QMath::do_show()
{ {
dialog_->show(); dialog_->show();
} }
void QMath::build_dialog() void QMath::build_dialog()
{ {
dialog_ = new QMathDialog(this); dialog_ = new QMathDialog(this);
} }
// needless to say, this can't last for long
extern BufferView * current_view;
void QMath::subscript() void QMath::subscript()
{ {
@ -74,7 +75,7 @@ void QMath::insert(string const & name)
{ {
current_view->owner()->dispatch(FuncRequest(LFUN_INSERT_MATH, '\\' + name)); current_view->owner()->dispatch(FuncRequest(LFUN_INSERT_MATH, '\\' + name));
} }
void QMath::insertCubeRoot() void QMath::insertCubeRoot()
{ {
@ -89,13 +90,13 @@ void QMath::insertMatrix()
current_view->owner()->dispatch(FuncRequest(LFUN_INSERT_MATRIX, "2 2")); current_view->owner()->dispatch(FuncRequest(LFUN_INSERT_MATRIX, "2 2"));
} }
void QMath::insertDelim(string const & str) void QMath::insertDelim(string const & str)
{ {
current_view->owner()->dispatch(FuncRequest(LFUN_MATH_DELIM, str)); current_view->owner()->dispatch(FuncRequest(LFUN_MATH_DELIM, str));
} }
void QMath::toggleDisplay() void QMath::toggleDisplay()
{ {
current_view->owner()->dispatch(FuncRequest(LFUN_MATH_DISPLAY)); current_view->owner()->dispatch(FuncRequest(LFUN_MATH_DISPLAY));

Some files were not shown because too many files have changed in this diff Show More