move the title_ string to the base class Dialog::View

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7003 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Alfredo Braunstein 2003-05-22 15:42:50 +00:00
parent 81a967c573
commit 0062cd3408
43 changed files with 145 additions and 70 deletions

View File

@ -1,6 +1,11 @@
2003-05-21 Alfredo Braunstein <abraunst@libero.it>
* ViewBase.h:
* Dialog.h (setTitle): added
2003-05-20 Alfredo Braunstein <abraunst@libero.it>
ControlErrorList.[Ch]: small bugs fixed, use ErrorList
* ControlErrorList.[Ch]: small bugs fixed, use ErrorList
2003-05-13 André Pönitz <poenitz@gmx.net>

View File

@ -162,6 +162,18 @@ Dialog::View & Dialog::view() const
}
void Dialog::View::setTitle(string const & newtitle)
{
title_ = newtitle;
}
string const & Dialog::View::getTitle() const
{
return title_;
}
void Dialog::setController(Controller * i)
{
lyx::Assert(i && !controller_ptr_.get());

View File

@ -179,7 +179,7 @@ private:
*/
class Dialog::View : boost::noncopyable {
public:
View(Dialog & parent) : p_(parent) {}
View(Dialog & parent, string title) : p_(parent), title_(title) {}
virtual ~View() {}
//@{
@ -225,6 +225,11 @@ public:
Dialog & dialog() { return p_; }
Dialog const & dialog() const { return p_; }
/// sets the title of the dialog (window caption)
void setTitle(string const &);
/// gets the title of the dialog (window caption)
string const & getTitle() const;
protected:
Kernel & kernel() { return p_.kernel(); }
Kernel const & kernel() const { return p_.kernel(); }
@ -239,6 +244,8 @@ protected:
private:
///
Dialog & p_;
///
string title_;
};

View File

@ -15,8 +15,8 @@
#include "support/LAssert.h"
ViewBase::ViewBase()
: controller_ptr_(0)
ViewBase::ViewBase(string const & t)
: controller_ptr_(0), title_(t)
{}
@ -26,6 +26,18 @@ void ViewBase::setController(ControlButtons & c)
}
void ViewBase::setTitle(string const & newtitle)
{
title_ = newtitle;
}
string const & ViewBase::getTitle() const
{
return title_;
}
ControlButtons & ViewBase::getController()
{
lyx::Assert(controller_ptr_);

View File

@ -20,7 +20,7 @@ class ButtonController;
class ViewBase : boost::noncopyable {
public:
///
ViewBase();
ViewBase(string const &);
///
virtual ~ViewBase() {}
@ -56,9 +56,18 @@ public:
ControlButtons const & getController() const;
///
ButtonController & bc();
/// sets the title of the dialog (window caption)
void setTitle(string const &);
/// gets the title of the dialog
string const & getTitle() const;
protected:
/// We don't own this.
ControlButtons * controller_ptr_;
private:
string title_;
};
#endif // VIEWBASE_H

View File

@ -1,3 +1,35 @@
2003-05-21 Alfredo Braunstein <abraunst@libero.it>
* Qt2Base.[Ch]:
* QDialogView.[Ch] (setTitle): added
* QAbout.C:
* QBibitem.C:
* QBibtex.C:
* QChanges.C:
* QCharacter.C:
* QCitation.C:
* QERT.C:
* QError.C:
* QErrorList.C:
* QErrorListDialog.C:
* QExternal.C:
* QFloat.C:
* QGraphics.C:
* QInclude.C:
* QLog.C:
* QMinipage.C:
* QParagraph.C:
* QRef.C:
* QShowFile.C:
* QTabular.C:
* QTabularCreate.C:
* QThesaurus.C:
* QToc.C:
* QURL.C:
* QVCLog.C:
* QWrap.C: the argument to Dialog::View ctor is now a string. use
setTitle instead of setCaption when appropriate
2003-05-22 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* QErrorListDialog.C: remove include for <qtextedit.h>

View File

@ -33,7 +33,7 @@ typedef QController<ControlAboutlyx, QView<QAboutDialog> > base_class;
QAbout::QAbout(Dialog & parent)
: base_class(parent, qt_("About LyX"))
: base_class(parent, _("About LyX"))
{
}

View File

@ -28,7 +28,7 @@ typedef QController<ControlCommand, QView<QBibitemDialog> > base_class;
QBibitem::QBibitem(Dialog & parent)
: base_class(parent, qt_("LyX: Bibliography Item Settings"))
: base_class(parent, _("LyX: Bibliography Item Settings"))
{
}

View File

@ -38,7 +38,7 @@ typedef QController<ControlBibtex, QView<QBibtexDialog> > base_class;
QBibtex::QBibtex(Dialog & parent)
: base_class(parent, qt_("BibTeX"))
: base_class(parent, _("BibTeX"))
{
}

View File

@ -24,7 +24,7 @@ typedef QController<ControlChanges, QView<QChangesDialog> > base_class;
QChanges::QChanges(Dialog & parent)
: base_class(parent, qt_("LyX: Merge Changes"))
: base_class(parent, _("LyX: Merge Changes"))
{
}

View File

@ -33,7 +33,7 @@ typedef QController<ControlCharacter, QView<QCharacterDialog> > base_class;
QCharacter::QCharacter(Dialog & parent)
: base_class(parent, qt_("LyX: Change Text Style"))
: base_class(parent, _("LyX: Change Text Style"))
{
}

View File

@ -43,7 +43,7 @@ typedef QController<ControlCitation, QView<QCitationDialog> > base_class;
QCitation::QCitation(Dialog & parent)
: base_class(parent, qt_("LyX: Citation Reference"))
: base_class(parent, _("LyX: Citation Reference"))
{}

View File

@ -15,6 +15,7 @@
#include <qapplication.h>
#include "debug.h"
#include "qt_helpers.h"
#include "QtLyXView.h"
#include "QDialogView.h"
#include "Qt2BC.h"
@ -22,8 +23,8 @@
#include "support/LAssert.h"
QDialogView::QDialogView(Dialog & parent, QString const & t)
: Dialog::View(parent), updating_(false), title_(t)
QDialogView::QDialogView(Dialog & parent, string const & t)
: Dialog::View(parent,t), updating_(false)
{}
@ -55,10 +56,11 @@ void QDialogView::show()
update(); // make sure its up-to-date
form()->setCaption(toqstr(getTitle()));
if (form()->isVisible()) {
form()->raise();
} else {
form()->setCaption(title_);
form()->show();
}
}

View File

@ -29,12 +29,11 @@ class QDialogView : public QObject, public Dialog::View {
Q_OBJECT
public:
///
QDialogView(Dialog &, QString const &);
QDialogView(Dialog &, string const &);
///
virtual ~QDialogView() {}
///
bool readOnly() const;
protected:
/// build the actual dialog
virtual void build_dialog() = 0;
@ -78,10 +77,6 @@ protected slots:
private:
/// Pointer to the actual instantiation of the Qt dialog
virtual QDialog * form() const = 0;
private:
/// dialog title, displayed by WM.
QString title_;
};

View File

@ -25,7 +25,7 @@ typedef QController<ControlERT, QView<QERTDialog> > base_class;
QERT::QERT(Dialog & parent)
: base_class(parent, qt_("LyX: TeX Code Settings"))
: base_class(parent, _("LyX: TeX Code Settings"))
{
}

View File

@ -25,7 +25,7 @@ typedef QController<ControlError, QView<QErrorDialog> > base_class;
QError::QError(Dialog & parent)
: base_class(parent, qt_("LyX: LaTeX Error"))
: base_class(parent, _("LyX: LaTeX Error"))
{
}

View File

@ -48,7 +48,7 @@ void QErrorList::select(int item)
void QErrorList::update_contents()
{
dialog_->setCaption(toqstr(controller().name()));
setTitle(controller().name());
dialog_->errorsLB->clear();
dialog_->descriptionTB->setText(QString());

View File

@ -29,7 +29,7 @@ typedef QController<ControlExternal, QView<QExternalDialog> > base_class;
QExternal::QExternal(Dialog & parent)
: base_class(parent, qt_("LyX: External Material"))
: base_class(parent, _("LyX: External Material"))
{
}

View File

@ -27,7 +27,7 @@ typedef QController<ControlFloat, QView<QFloatDialog> > base_class;
QFloat::QFloat(Dialog & parent)
: base_class(parent, qt_("LyX: Float Settings"))
: base_class(parent, _("LyX: Float Settings"))
{
}

View File

@ -47,7 +47,7 @@ typedef QController<ControlGraphics, QView<QGraphicsDialog> > base_class;
QGraphics::QGraphics(Dialog & parent)
: base_class(parent, qt_("LyX: Graphics"))
: base_class(parent, _("LyX: Graphics"))
{
}

View File

@ -29,7 +29,7 @@ typedef QController<ControlInclude, QView<QIncludeDialog> > base_class;
QInclude::QInclude(Dialog & parent)
: base_class(parent, qt_("LyX: Child Document"))
: base_class(parent, _("LyX: Child Document"))
{}

View File

@ -31,7 +31,7 @@ using std::getline;
typedef QController<ControlLog, QView<QLogDialog> > base_class;
QLog::QLog(Dialog & parent)
: base_class(parent, qt_("LyX: LaTeX Log"))
: base_class(parent, _("LyX: LaTeX Log"))
{
}
@ -50,9 +50,9 @@ void QLog::update_contents()
controller().logfile();
if (logfile.first == Buffer::buildlog)
dialog_->setCaption(qt_("Build log"));
setTitle(_("Build log"));
else
dialog_->setCaption(qt_("LaTeX log"));
setTitle(_("LaTeX log"));
dialog_->logTV->setText("");

View File

@ -30,7 +30,7 @@ typedef QController<ControlMinipage, QView<QMinipageDialog> > base_class;
QMinipage::QMinipage(Dialog & parent)
: base_class(parent, qt_("LyX: Minipage Settings"))
: base_class(parent, _("LyX: Minipage Settings"))
{
}

View File

@ -43,7 +43,7 @@ typedef QController<ControlParagraph, QView<QParagraphDialog> > base_class;
QParagraph::QParagraph(Dialog & parent)
: base_class(parent, qt_("LyX: Paragraph Settings"))
: base_class(parent, _("LyX: Paragraph Settings"))
{}

View File

@ -39,7 +39,7 @@ typedef QController<ControlRef, QView<QRefDialog> > base_class;
QRef::QRef(Dialog & parent)
: base_class(parent, qt_("LyX: Cross-reference")),
: base_class(parent, _("LyX: Cross-reference")),
sort_(false), at_ref_(false)
{
}

View File

@ -25,7 +25,7 @@ typedef QController<ControlShowFile, QView<QShowFileDialog> > base_class;
QShowFile::QShowFile(Dialog & parent)
: base_class(parent, qt_("LyX: Show File"))
: base_class(parent, _("LyX: Show File"))
{
}

View File

@ -34,7 +34,7 @@
typedef QController<ControlTabular, QView<QTabularDialog> > base_class;
QTabular::QTabular(Dialog & parent)
: base_class(parent, qt_("LyX: Table Settings"))
: base_class(parent, _("LyX: Table Settings"))
{
}

View File

@ -25,7 +25,7 @@ typedef QController<ControlTabularCreate, QView<QTabularCreateDialog> > base_cla
QTabularCreate::QTabularCreate(Dialog & parent)
: base_class(parent, qt_("LyX: Insert Table"))
: base_class(parent, _("LyX: Insert Table"))
{
}

View File

@ -25,7 +25,7 @@ typedef QController<ControlThesaurus, QView<QThesaurusDialog> > base_class;
QThesaurus::QThesaurus(Dialog & parent)
: base_class(parent, qt_("LyX: Thesaurus"))
: base_class(parent, _("LyX: Thesaurus"))
{
}

View File

@ -36,7 +36,7 @@ using std::vector;
typedef QController<ControlToc, QView<QTocDialog> > base_class;
QToc::QToc(Dialog & parent)
: base_class(parent, qt_("LyX: Table of Contents")), depth_(1)
: base_class(parent, _("LyX: Table of Contents")), depth_(1)
{}
@ -61,7 +61,7 @@ void QToc::updateType()
dialog_->typeCO->insertItem(toqstr(*it));
if (*it == type) {
dialog_->typeCO->setCurrentItem(it - choice.begin());
dialog_->setCaption(toqstr(type));
setTitle(type);
}
}
}

View File

@ -26,7 +26,7 @@
typedef QController<ControlCommand, QView<QURLDialog> > base_class;
QURL::QURL(Dialog & parent)
: base_class(parent, qt_("LyX: URL"))
: base_class(parent, _("LyX: URL"))
{
}

View File

@ -13,6 +13,7 @@
#include "Lsstream.h"
#include "qt_helpers.h"
#include "support/lstrings.h"
#include "LyXView.h"
#include "ControlVCLog.h"
@ -29,7 +30,7 @@ typedef QController<ControlVCLog, QView<QVCLogDialog> > base_class;
QVCLog::QVCLog(Dialog & parent)
: base_class(parent, qt_("LyX: Version Control Log"))
: base_class(parent, _("LyX: Version Control Log"))
{
}
@ -44,11 +45,9 @@ void QVCLog::build_dialog()
void QVCLog::update_contents()
{
#if USE_BOOST_FORMAT
dialog_->setCaption(toqstr(boost::io::str(boost::format(_("Version control log for %1$s")) % controller().getBufferFileName())));
#else
dialog_->setCaption(toqstr(string(_("Version control log for ")) + controller().getBufferFileName()));
#endif
setTitle(bformat(_("Version control log for %1$s"),
controller().getBufferFileName()));
dialog_->vclogTV->setText("");
ostringstream ss;

View File

@ -33,7 +33,7 @@ typedef QController<ControlWrap, QView<QWrapDialog> > base_class;
QWrap::QWrap(Dialog & parent)
: base_class(parent, qt_("LyX: Text Wrap Settings"))
: base_class(parent, _("LyX: Text Wrap Settings"))
{
}

View File

@ -14,6 +14,7 @@
#include <qapplication.h>
#include "debug.h"
#include "qt_helpers.h"
#include "QtLyXView.h"
#include "Qt2Base.h"
#include "Qt2BC.h"
@ -22,8 +23,8 @@
#include "support/LAssert.h"
Qt2Base::Qt2Base(QString const & t)
: ViewBase(), updating_(false), title_(t)
Qt2Base::Qt2Base(string const & t)
: ViewBase(t), updating_(false)
{}
@ -50,10 +51,11 @@ void Qt2Base::show()
update(); // make sure its up-to-date
form()->setCaption(toqstr(getTitle()));
if (form()->isVisible()) {
form()->raise();
} else {
form()->setCaption(title_);
form()->show();
}
}

View File

@ -29,7 +29,7 @@ class Qt2Base : public QObject, public ViewBase {
Q_OBJECT
public:
///
Qt2Base(QString const &);
Qt2Base(string const &);
///
virtual ~Qt2Base() {}
protected:
@ -73,10 +73,6 @@ protected slots:
private:
/// Pointer to the actual instantiation of the Qt dialog
virtual QDialog * form() const = 0;
private:
/// dialog title, displayed by WM.
QString title_;
};

View File

@ -1,3 +1,11 @@
2003-05-21 Alfredo Braunstein <abraunst@libero.it>
* FormBase.[Ch]:
* FormDialogView.[Ch] (setTitle): added
* FormErrorList.C:
* FormLog.C:
* FormShowFile.C: use setTitle
2003-05-20 Alfredo Braunstein <abraunst@libero.it>
* FormErrorList.[Ch]: small bugs fixed

View File

@ -46,10 +46,10 @@ static int C_PrehandlerCB(FL_OBJECT *, int, FL_Coord, FL_Coord, int, void *);
FormBase::FormBase(string const & t, bool allowResize)
: ViewBase(),
: ViewBase(t),
warning_posted_(false), message_widget_(0),
minw_(0), minh_(0), allow_resize_(allowResize),
title_(t), icon_pixmap_(0), icon_mask_(0),
icon_pixmap_(0), icon_mask_(0),
tooltips_(new Tooltips())
{}
@ -102,7 +102,7 @@ void FormBase::prepare_to_show()
// set the title for the minimized form
if (!getController().IconifyWithMain())
fl_winicontitle(form()->window, title_.c_str());
fl_winicontitle(form()->window, getTitle().c_str());
// assign an icon to the form
string const iconname = LibFileSearch("images", "lyx", "xpm");
@ -155,7 +155,7 @@ void FormBase::show()
if (!allow_resize_)
fl_set_form_maxsize(form(), minw_, minh_);
string const maximize_title = "LyX: " + title_;
string const maximize_title = "LyX: " + getTitle();
int const iconify_policy =
getController().IconifyWithMain() ? FL_TRANSIENT : 0;

View File

@ -124,8 +124,6 @@ private:
int minh_;
/// Can the dialog be resized after it has been created?
bool allow_resize_;
/// dialog title, displayed by the window manager.
string title_;
/// Passed to the window manager to give a pretty little symbol ;-)
Pixmap icon_pixmap_;
///

View File

@ -48,10 +48,10 @@ static int C_PrehandlerCB(FL_OBJECT *, int, FL_Coord, FL_Coord, int, void *);
FormDialogView::FormDialogView(Dialog & parent,
string const & t, bool allowResize)
: Dialog::View(parent),
: Dialog::View(parent, t),
warning_posted_(false), message_widget_(0),
minw_(0), minh_(0), allow_resize_(allowResize),
title_(t), icon_pixmap_(0), icon_mask_(0),
icon_pixmap_(0), icon_mask_(0),
tooltips_(new Tooltips())
{}
@ -104,7 +104,7 @@ void FormDialogView::prepare_to_show()
// set the title for the minimized form
if (!lyxrc.dialogs_iconify_with_main)
fl_winicontitle(form()->window, title_.c_str());
fl_winicontitle(form()->window, getTitle().c_str());
// assign an icon to the form
string const iconname = LibFileSearch("images", "lyx", "xpm");
@ -157,7 +157,7 @@ void FormDialogView::show()
if (!allow_resize_)
fl_set_form_maxsize(form(), minw_, minh_);
string const maximize_title = "LyX: " + title_;
string const maximize_title = "LyX: " + getTitle();
int const iconify_policy = lyxrc.dialogs_iconify_with_main ?
FL_TRANSIENT : 0;

View File

@ -123,8 +123,6 @@ private:
int minh_;
/// Can the dialog be resized after it has been created?
bool allow_resize_;
/// dialog title, displayed by the window manager.
string title_;
/// Passed to the window manager to give a pretty little symbol ;-)
Pixmap icon_pixmap_;
///

View File

@ -39,7 +39,7 @@ void FormErrorList::build()
void FormErrorList::update()
{
fl_set_form_title(dialog_->form, controller().name().c_str());
setTitle(controller().name());
updateContents();
}

View File

@ -30,7 +30,7 @@ void FormLog::update()
string const title = buildlog ?
_("LyX: LaTeX Log") :
_("LyX: Literate Programming Build Log");
fl_set_form_title(dialog_->form, title.c_str());
setTitle(title);
fl_clear_browser(dialog_->browser);
int const valid = fl_load_browser(dialog_->browser,

View File

@ -33,7 +33,7 @@ void FormShowFile::update()
fl_set_browser_fontstyle(dialog_->browser,FL_FIXED_STYLE);
string const title = "LyX: " + controller().getFileName();
fl_set_form_title(dialog_->form, title.c_str());
setTitle(title);
string const contents = controller().getFileContents();
if (contents.empty())