From dc85736c7f6eda0f6f8ba56166ac6845653062d0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=BCrgen=20Spitzm=C3=BCller?= Date: Tue, 15 Jul 2003 12:48:24 +0000 Subject: [PATCH] The QNote dialog git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7280 a592a061-630c-0410-9148-cb99ea01b6c8 --- lib/CREDITS | 2 +- lib/ChangeLog | 4 + po/POTFILES.in | 1 + src/frontends/qt2/ChangeLog | 9 ++ src/frontends/qt2/Dialogs.C | 8 +- src/frontends/qt2/Makefile.am | 1 + src/frontends/qt2/Makefile.dialogs | 2 + src/frontends/qt2/QNote.C | 71 +++++++++++ src/frontends/qt2/QNote.h | 39 ++++++ src/frontends/qt2/QNoteDialog.C | 41 +++++++ src/frontends/qt2/QNoteDialog.h | 32 +++++ src/frontends/qt2/ui/QNoteDialogBase.ui | 156 ++++++++++++++++++++++++ 12 files changed, 364 insertions(+), 2 deletions(-) create mode 100644 src/frontends/qt2/QNote.C create mode 100644 src/frontends/qt2/QNote.h create mode 100644 src/frontends/qt2/QNoteDialog.C create mode 100644 src/frontends/qt2/QNoteDialog.h create mode 100644 src/frontends/qt2/ui/QNoteDialogBase.ui diff --git a/lib/CREDITS b/lib/CREDITS index 7ccb62639e..06919d4518 100644 --- a/lib/CREDITS +++ b/lib/CREDITS @@ -229,7 +229,7 @@ vertical spaces @bJürgen Spitzmüller @iE-mail: j.spitzmueller@gmx.de - Many improvements to xforms dialogs + Qt frontend, bugfixes @bBen Stanley @iE-mail: bds02@uow.edu.au fix bugs with error insets placement diff --git a/lib/ChangeLog b/lib/ChangeLog index 5c7261b538..34d3f2456b 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,7 @@ +2003-07-09 Juergen Spitzmueller + + * CREDITS: update. + 2003-07-10 John Levon * ui/classic.ui: fix toolbars to new scheme, fix space inserts diff --git a/po/POTFILES.in b/po/POTFILES.in index 4d5e6015dc..38c15f31f8 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -60,6 +60,7 @@ src/frontends/qt2/QMath.C src/frontends/qt2/QMathDialog.C src/frontends/qt2/QMathMatrixDialog.C src/frontends/qt2/QMinipage.C +src/frontends/qt2/QNote.C src/frontends/qt2/QParagraph.C src/frontends/qt2/QPrefs.C src/frontends/qt2/QPrefsDialog.C diff --git a/src/frontends/qt2/ChangeLog b/src/frontends/qt2/ChangeLog index 1f35ca7735..8946df0dc3 100644 --- a/src/frontends/qt2/ChangeLog +++ b/src/frontends/qt2/ChangeLog @@ -4,6 +4,15 @@ sure that it is initialized to some reasonable value, so that the (ugly) Qt/Mac code can do its magic (conditionally on Q_WS_MAC). +2003-07-09 Juergen Spitzmueller + + * ui/QNoteDialog.ui: + * QNoteDialog.[Ch]: + * QNote.[Ch]: + * Makefile.dialogs: + * Dialogs.C: + * Dialogs2.C: New Annotation (Note) dialog + 2003-07-11 André Pönitz * Alert_pimpl.C: diff --git a/src/frontends/qt2/Dialogs.C b/src/frontends/qt2/Dialogs.C index d42278dab8..16109a9106 100644 --- a/src/frontends/qt2/Dialogs.C +++ b/src/frontends/qt2/Dialogs.C @@ -27,6 +27,7 @@ #include "ControlLog.h" #include "ControlMath.h" #include "ControlMinipage.h" +#include "ControlNote.h" #include "ControlParagraph.h" #include "ControlRef.h" #include "ControlShowFile.h" @@ -57,6 +58,7 @@ #include "QLog.h" #include "QMath.h" #include "QMinipage.h" +#include "QNote.h" #include "QParagraph.h" #include "QRef.h" #include "QShowFile.h" @@ -84,7 +86,7 @@ char const * const dialognames[] = { "aboutlyx", "bibitem", "bibtex", "changes", "character", "citation", "error", "errorlist", "ert", "external", "file", "float", "graphics", "include", "index", "label", "latexlog", "mathpanel", "mathdelimiter", "mathmatrix", -"minipage", "paragraph", "ref", "tabular", "tabularcreate", "texinfo", +"minipage", "note", "paragraph", "ref", "tabular", "tabularcreate", "texinfo", #ifdef HAVE_LIBAIKSAURUS "thesaurus", @@ -207,6 +209,10 @@ Dialog * Dialogs::build(string const & name) dialog->setController(new ControlMinipage(*dialog)); dialog->setView(new QMinipage(*dialog)); dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy); + } else if (name == "note") { + dialog->setController(new ControlNote(*dialog)); + dialog->setView(new QNote(*dialog)); + dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy); } else if (name == "paragraph") { dialog->setController(new ControlParagraph(*dialog)); dialog->setView(new QParagraph(*dialog)); diff --git a/src/frontends/qt2/Makefile.am b/src/frontends/qt2/Makefile.am index a4c269600d..d111884f76 100644 --- a/src/frontends/qt2/Makefile.am +++ b/src/frontends/qt2/Makefile.am @@ -47,6 +47,7 @@ libqt2_la_SOURCES = \ QLyXKeySym.C QLyXKeySym.h \ QMath.C QMath.h \ QMinipage.C QMinipage.h \ + QNote.C QNote.h \ QParagraph.C QParagraph.h \ QPrefs.C QPrefs.h \ QPrint.C QPrint.h \ diff --git a/src/frontends/qt2/Makefile.dialogs b/src/frontends/qt2/Makefile.dialogs index bbbc547f75..50e400a9b5 100644 --- a/src/frontends/qt2/Makefile.dialogs +++ b/src/frontends/qt2/Makefile.dialogs @@ -33,6 +33,7 @@ UIFILES = \ QMathDialogBase.ui \ QMathMatrixDialogBase.ui \ QMinipageDialogBase.ui \ + QNoteDialogBase.ui \ QParagraphDialogBase.ui \ QPrefAsciiModule.ui \ QPrefColorsModule.ui \ @@ -100,6 +101,7 @@ MOCFILES = \ QMathDialog.C QMathDialog.h \ QMathMatrixDialog.C QMathMatrixDialog.h \ QMinipageDialog.C QMinipageDialog.h \ + QNoteDialog.C QNoteDialog.h \ QParagraphDialog.C QParagraphDialog.h \ QPrefsDialog.C QPrefsDialog.h \ QRefDialog.C QRefDialog.h \ diff --git a/src/frontends/qt2/QNote.C b/src/frontends/qt2/QNote.C new file mode 100644 index 0000000000..5fba9fa456 --- /dev/null +++ b/src/frontends/qt2/QNote.C @@ -0,0 +1,71 @@ +/** + * \file QNote.C + * This file is part of LyX, the document processor. + * Licence details can be found in the file COPYING. + * + * \author Juergen Spitzmueller + * + * Full author contact details are available in file CREDITS + */ + +#include + +#include "ControlNote.h" +#include "qt_helpers.h" +#include "insets/insetnote.h" + +#include +#include + +#include "QNoteDialog.h" +#include "QNote.h" +#include "Qt2BC.h" + + +typedef QController > base_class; + + +QNote::QNote(Dialog & parent) + : base_class(parent, _("LyX: Annotation Settings")) +{} + + +void QNote::build_dialog() +{ + dialog_.reset(new QNoteDialog(this)); + + bcview().setOK(dialog_->okPB); + bcview().setCancel(dialog_->closePB); +} + + +void QNote::update_contents() +{ + QRadioButton * rb = 0; + string type(controller().params().type); + + if (type == "Note") + rb = dialog_->noteRB; + else if (type == "Comment") + rb = dialog_->commentRB; + else if (type == "Greyedout") + rb = dialog_->greyedoutRB; + + rb->setChecked(true); +} + + +void QNote::apply() +{ + string type; + + if (dialog_->greyedoutRB->isChecked()) + type = "Greyedout"; + else if (dialog_->commentRB->isChecked()) + type = "Comment"; + else + type = "Note"; + + controller().params().type = type; +} + diff --git a/src/frontends/qt2/QNote.h b/src/frontends/qt2/QNote.h new file mode 100644 index 0000000000..33ea418b9d --- /dev/null +++ b/src/frontends/qt2/QNote.h @@ -0,0 +1,39 @@ +// -*- C++ -*- +/** + * \file QNote.h + * This file is part of LyX, the document processor. + * Licence details can be found in the file COPYING. + * + * \author Juergen Spitzmueller + * + * Full author contact details are available in file CREDITS + */ + +#ifndef QNOTE_H +#define QNOTE_H + +#include "QDialogView.h" + + +class ControlNote; +class QNoteDialog; + +/** This class provides a QT implementation of the Note Dialog. + */ +class QNote : public QController > +{ +public: + friend class QNoteDialog; + + /// Constructor + QNote(Dialog &); +private: + /// Apply changes + virtual void apply(); + /// Build the dialog + virtual void build_dialog(); + /// Update dialog before showing it + virtual void update_contents(); +}; + +#endif // QNOTE_H diff --git a/src/frontends/qt2/QNoteDialog.C b/src/frontends/qt2/QNoteDialog.C new file mode 100644 index 0000000000..540688d079 --- /dev/null +++ b/src/frontends/qt2/QNoteDialog.C @@ -0,0 +1,41 @@ +/** + * \file QNoteDialog.C + * This file is part of LyX, the document processor. + * Licence details can be found in the file COPYING. + * + * \author Juergen Spitzmueller + * + * Full author contact details are available in file CREDITS + */ + +#include + + +#include "QNote.h" +#include "QNoteDialog.h" + +#include + + +QNoteDialog::QNoteDialog(QNote * form) + : QNoteDialogBase(0, 0, false, 0), + form_(form) +{ + connect(okPB, SIGNAL(clicked()), + form, SLOT(slotOK())); + connect(closePB, SIGNAL(clicked()), + form, SLOT(slotClose())); +} + + +void QNoteDialog::closeEvent(QCloseEvent * e) +{ + form_->slotWMHide(); + e->accept(); +} + + +void QNoteDialog::change_adaptor() +{ + form_->changed(); +} diff --git a/src/frontends/qt2/QNoteDialog.h b/src/frontends/qt2/QNoteDialog.h new file mode 100644 index 0000000000..8ca4693ff9 --- /dev/null +++ b/src/frontends/qt2/QNoteDialog.h @@ -0,0 +1,32 @@ +// -*- C++ -*- +/** + * \file QNoteDialog.h + * This file is part of LyX, the document processor. + * Licence details can be found in the file COPYING. + * + * \author Juergen Spitzmueller + * + * Full author contact details are available in file CREDITS + */ + +#ifndef QNOTEDIALOG_H +#define QNOTEDIALOG_H + +#include "ui/QNoteDialogBase.h" + + +class QNote; + +class QNoteDialog : public QNoteDialogBase { + Q_OBJECT +public: + QNoteDialog(QNote * form); +protected slots: + virtual void change_adaptor(); +protected: + virtual void closeEvent(QCloseEvent * e); +private: + QNote * form_; +}; + +#endif // QNOTEDIALOG_H diff --git a/src/frontends/qt2/ui/QNoteDialogBase.ui b/src/frontends/qt2/ui/QNoteDialogBase.ui new file mode 100644 index 0000000000..fc9df7470d --- /dev/null +++ b/src/frontends/qt2/ui/QNoteDialogBase.ui @@ -0,0 +1,156 @@ + +QNoteDialogBase +config.h +qt_helpers.h + + QDialog + + name + QNoteDialogBase + + + geometry + + 0 + 0 + 188 + 146 + + + + caption + Annotation Settings + + + sizeGripEnabled + true + + + + margin + 11 + + + spacing + 6 + + + QPushButton + + name + okPB + + + text + OK + + + default + false + + + + QPushButton + + name + closePB + + + text + &Close + + + default + true + + + + QButtonGroup + + name + NoteBG + + + title + Type + + + + margin + 11 + + + spacing + 6 + + + QRadioButton + + name + noteRB + + + text + &Note + + + toolTip + LyX internal only + + + + QRadioButton + + name + commentRB + + + text + C&omment + + + toolTip + Export to LaTeX but don't print + + + + QRadioButton + + name + greyedoutRB + + + text + &Greyed out + + + toolTip + Print as grey text + + + + + + + + + noteRB + toggled(bool) + QNoteDialogBase + change_adaptor() + + + greyedoutRB + toggled(bool) + QNoteDialogBase + change_adaptor() + + + commentRB + toggled(bool) + QNoteDialogBase + change_adaptor() + + change_adaptor() + + -- 2.39.2