From 3fa594b2f97343faa74e7f51e11df73cf159fb79 Mon Sep 17 00:00:00 2001 From: Kalle Dalheimer Date: Fri, 16 Mar 2001 17:20:06 +0000 Subject: [PATCH] Compiles and links again Also integrates the citation dialog for the first time (not completely working yet and not transferred to new scheme either) git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1788 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt2/.cvsignore | 5 + src/frontends/qt2/ChangeLog | 11 + src/frontends/qt2/Dialogs.C | 85 ++- src/frontends/qt2/FormCharacter.h | 29 +- src/frontends/qt2/FormCitation.C | 196 +++++++ src/frontends/qt2/FormCitation.h | 96 ++++ src/frontends/qt2/FormCitationDialog.ui | 577 +++++++++++++++++++++ src/frontends/qt2/FormCitationDialogImpl.C | 190 +++++++ src/frontends/qt2/FormCitationDialogImpl.h | 33 ++ src/frontends/qt2/FormSearch.h | 4 +- src/frontends/qt2/FormSplash.h | 2 +- src/frontends/qt2/FormTabularCreate.h | 2 +- src/frontends/qt2/Makefile.am | 47 +- src/frontends/qt2/emptytable.h | 2 +- 14 files changed, 1185 insertions(+), 94 deletions(-) create mode 100644 src/frontends/qt2/FormCitation.C create mode 100644 src/frontends/qt2/FormCitation.h create mode 100644 src/frontends/qt2/FormCitationDialog.ui create mode 100644 src/frontends/qt2/FormCitationDialogImpl.C create mode 100644 src/frontends/qt2/FormCitationDialogImpl.h diff --git a/src/frontends/qt2/.cvsignore b/src/frontends/qt2/.cvsignore index 51e36fa7ad..334f280e30 100644 --- a/src/frontends/qt2/.cvsignore +++ b/src/frontends/qt2/.cvsignore @@ -5,3 +5,8 @@ Makefile .libs libqt2.la moc_*.C +*_moc.C +FormDocumentDialogBase.h +FormDocumentDialogBase.C +FormCitationDialog.h +FormCitationDialog.C diff --git a/src/frontends/qt2/ChangeLog b/src/frontends/qt2/ChangeLog index 797cf390a6..919637839f 100644 --- a/src/frontends/qt2/ChangeLog +++ b/src/frontends/qt2/ChangeLog @@ -1,3 +1,14 @@ +2001-03-16 Kalle Dalheimer + + * FormParagraph.C (apply): Only call SetParagraphExtraOpt() when + NO_PEXTRA is not defined (in line with XForms frontend) + + * Dialogs.C: Adapted to backend changes + + * Makefile.am: updated citation dialog + * Citation dialog added: FormCitation.{C,h}, + * FormCitationDialog.ui, FormCitationDialogImpl.{C,h} + 2001-03-15 Lars Gullik Bjønnes * several files: remove CXX_WORKING_NAMESPACES diff --git a/src/frontends/qt2/Dialogs.C b/src/frontends/qt2/Dialogs.C index 72d326a3ef..09e50d9fa8 100644 --- a/src/frontends/qt2/Dialogs.C +++ b/src/frontends/qt2/Dialogs.C @@ -11,78 +11,61 @@ #include +#ifdef __GNUG__ +#pragma implementation +#endif + #include "Dialogs.h" + #include "FormCharacter.h" #include "FormCitation.h" #include "FormCredits.h" -#include "FormCopyright.h" -#include "FormDocument.h" +//#include "FormCopyright.h" +//#include "FormDocument.h" #include "FormError.h" #include "FormGraphics.h" -#include "FormIndex.h" +//#include "FormIndex.h" #include "FormParagraph.h" #include "FormPreferences.h" #include "FormPrint.h" -#include "FormRef.h" +//#include "FormRef.h" #include "FormSearch.h" #include "FormSplash.h" #include "FormTabular.h" #include "FormTabularCreate.h" -#include "FormToc.h" -#include "FormUrl.h" - -#ifdef __GNUG__ -#pragma implementation -#endif +//#include "FormToc.h" +//#include "FormUrl.h" -using std::endl; // Signal enabling all visible popups to be redrawn if so desired. // E.g., when the GUI colours have been remapped. -Signal0 Dialogs::redrawGUI; +SigC::Signal0 Dialogs::redrawGUI; Dialogs::Dialogs(LyXView * lv) { - splash_ = new FormSplash(lv, this); - - dialogs_.push_back(new FormCharacter(lv, this)); - dialogs_.push_back(new FormCitation(lv, this)); - dialogs_.push_back(new FormCopyright(lv, this)); - dialogs_.push_back(new FormCredits(lv, this)); - dialogs_.push_back(new FormDocument(lv, this)); - dialogs_.push_back(new FormError(lv, this)); - dialogs_.push_back(new FormGraphics(lv, this)); - dialogs_.push_back(new FormIndex(lv, this)); - dialogs_.push_back(new FormParagraph(lv, this)); - dialogs_.push_back(new FormPreferences(lv, this)); - dialogs_.push_back(new FormPrint(lv, this)); - dialogs_.push_back(new FormRef(lv, this)); - dialogs_.push_back(new FormSearch(lv, this)); - dialogs_.push_back(new FormTabular(lv, this)); - dialogs_.push_back(new FormTabularCreate(lv, this)); - dialogs_.push_back(new FormToc(lv, this)); - dialogs_.push_back(new FormUrl(lv, this)); - - // reduce the number of connections needed in - // dialogs by a simple connection here. - hideAll.connect(hideBufferDependent.slot()); -} - - -Dialogs::~Dialogs() -{ - for (vector::iterator iter = dialogs_.begin(); - iter != dialogs_.end(); - ++iter) { - delete *iter; - } - delete splash_; + splash_.reset( new FormSplash(lv, this) ); + add( new FormCharacter(lv, this)); + add( new FormCitation(lv, this)); + // add(new FormCopyright(lv, this)); + add( new FormCredits(lv, this)); + // add(new FormDocument(lv, this)); + add(new FormError(lv, this)); + add(new FormGraphics(lv, this)); + // add(new FormIndex(lv, this)); + add(new FormParagraph(lv, this)); + add(new FormPreferences(lv, this)); + add(new FormPrint(lv, this)); + // add(new FormRef(lv, this)); + add(new FormSearch(lv, this)); + add(new FormTabular(lv, this)); + add(new FormTabularCreate(lv, this)); + // add(new FormToc(lv, this)); + // add(new FormUrl(lv, this)); + + // reduce the number of connections needed in + // dialogs by a simple connection here. + hideAll.connect(hideBufferDependent.slot()); } -void Dialogs::destroySplash() -{ - delete splash_; - splash_ = 0; -} diff --git a/src/frontends/qt2/FormCharacter.h b/src/frontends/qt2/FormCharacter.h index 4a09091e36..28e49ccd16 100644 --- a/src/frontends/qt2/FormCharacter.h +++ b/src/frontends/qt2/FormCharacter.h @@ -1,9 +1,9 @@ // -*- C++ -*- -/** +/** * \file FormCharacter.h * Copyright 2001 The LyX Team. * See the file COPYING. - * + * * \author Edwin Leuven */ @@ -12,7 +12,6 @@ #include "DialogBase.h" - class LyXView; class Dialogs; class CharDlgImpl; @@ -23,42 +22,42 @@ public: FormCharacter(LyXView *, Dialogs *); /// ~FormCharacter(); - + /// Apply changes. void apply(); /// Close connections. void close(); - - + + private: - + /// Show the dialog. void show(); /// Hide the dialog. void hide(); /// Update the dialog. void update(bool switched = false); - + /// Real GUI implementation. CharDlgImpl * dialog_; - + /// the LyXView we belong to. LyXView * lv_; - + /** Which Dialogs do we belong to? * Used so we can get at the signals we have to connect to. */ Dialogs * d_; - + /// is the buffer readonly? bool readonly; - + /// Hide connection. - Connection h_; + SigC::Connection h_; /// Update connection. - Connection u_; - + SigC::Connection u_; + }; #endif diff --git a/src/frontends/qt2/FormCitation.C b/src/frontends/qt2/FormCitation.C new file mode 100644 index 0000000000..4ee7fdc03b --- /dev/null +++ b/src/frontends/qt2/FormCitation.C @@ -0,0 +1,196 @@ +/* + * FormCitation.C + * (C) 2000 LyX Team + * John Levon, moz@compsoc.man.ac.uk + * Changed for Qt2 implementation by Kalle Dalheimer, kalle@klaralvdalens-datakonsult.se + */ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include + +#include +#include + +#include "FormCitationDialogImpl.h" +#undef emit + +#include "Dialogs.h" +#include "FormCitation.h" +#include "gettext.h" +#include "buffer.h" +#include "LyXView.h" +#include "lyxfunc.h" +#include "lyxfont.h" + +#include +#include +#include +#include + +using std::vector; +using std::pair; +using std::find; + +FormCitation::FormCitation(LyXView *v, Dialogs *d) + : dialog_(0), lv_(v), d_(d), inset_(0), ih_(0) +{ + // let the dialog be shown + // This is a permanent connection so we won't bother + // storing a copy because we won't be disconnecting. + d->showCitation.connect(slot(this, &FormCitation::showCitation)); + d->createCitation.connect(slot(this, &FormCitation::createCitation)); +} + +FormCitation::~FormCitation() +{ + delete dialog_; +} + + +void FormCitation::showCitation(InsetCommand * inset) +{ + if (inset == 0) return; // maybe we should Assert this? + + // If connected to another inset, disconnect from it. + if (inset_) + ih_.disconnect(); + + inset_ = inset; + params = inset->params(); + ih_ = inset->hideDialog.connect(slot(this, &FormCitation::hide)); + show(); +} + + +void FormCitation::createCitation(string const & arg) +{ + if (inset_) { + ih_.disconnect(); + inset_ = 0; + } + + params.setFromString(arg); + show(); +} + + +void FormCitation::hide() +{ + if( dialog_ ) + dialog_->hide(); +} + + + +void FormCitation::show() +{ + if (!dialog_) + dialog_ = new FormCitationDialogImpl(this, 0, _("LyX: Citation Reference"), false); + + dialog_->show(); + + update(); +} + + +void FormCitation::update() +{ + bibkeys.clear(); + bibkeysInfo.clear(); + + vector > blist = + lv_->buffer()->getBibkeyList(); + sort(blist.begin(), blist.end()); + + for (unsigned int i = 0; i < blist.size(); ++i) { + bibkeys.push_back(blist[i].first); + bibkeysInfo.push_back(blist[i].second); + } + blist.clear(); + + updateBrowser(dialog_->bibliographyKeysLB, bibkeys); + + // Ditto for the keys cited in this inset + citekeys.clear(); + string tmp, keys(params.getContents()); + keys = frontStrip(split(keys, tmp, ',')); + while (!tmp.empty()) { + citekeys.push_back(tmp); + keys = frontStrip(split(keys, tmp, ',')); + } + updateBrowser(dialog_->insetKeysLB, citekeys); + + // No keys have been selected yet, so... + dialog_->infoML->clear(); + setBibButtons(OFF); + setCiteButtons(OFF); + + dialog_->textAfterED->setText( params.getOptions().c_str() ); +} + + +void FormCitation::updateBrowser( QListBox* listbox, + vector const & keys) const +{ + listbox->clear(); + + for (unsigned int i = 0; i < keys.size(); ++i) + listbox->insertItem( keys[i].c_str() ); +} + + +void FormCitation::setBibButtons(State status) const +{ + dialog_->leftPB->setEnabled( status == ON ); +} + + +void FormCitation::setCiteButtons(State status) const +{ + int const sel = dialog_->insetKeysLB->currentItem(); + int const maxline = dialog_->insetKeysLB->count(); + + bool const activate = (status == ON); + bool const activate_up = (activate && sel != 1); + bool const activate_down = (activate && sel != maxline); + + dialog_->stopPB->setEnabled(activate); + dialog_->upPB->setEnabled(activate_up); + dialog_->downPB->setEnabled(activate_down); +} + + +void FormCitation::apply() +{ + if (lv_->buffer()->isReadonly()) return; + + string contents; + for (unsigned int i = 0; i < citekeys.size(); ++i) { + if (i > 0) contents += ","; + contents += citekeys[i]; + } + + params.setContents(contents); + params.setOptions( dialog_->textAfterED->text().latin1() ); + + if (inset_ != 0) { + // Only update if contents have changed + if (params != inset_->params()) { + inset_->setParams(params); + lv_->view()->updateInset(inset_, true); + } + } else { + lv_->getLyXFunc()->Dispatch(LFUN_CITATION_INSERT, + params.getAsString()); + } +} + + diff --git a/src/frontends/qt2/FormCitation.h b/src/frontends/qt2/FormCitation.h new file mode 100644 index 0000000000..583b31eeec --- /dev/null +++ b/src/frontends/qt2/FormCitation.h @@ -0,0 +1,96 @@ +/* FormCitation.h + * (C) 2000 LyX Team + * John Levon, moz@compsoc.man.ac.uk + * Changed for Qt2 port by Kalle Dalheimer, kalle@klaralvdalens-datakonsult.se + */ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef FORMCITATION_H +#define FORMCITATION_H + +#include "DialogBase.h" +#include "insets/insetcommand.h" + +#include + +class Dialogs; +class LyXView; +class FormCitationDialog; + +class QListBox; + +class FormCitation : public DialogBase { + friend class FormCitationDialogImpl; +public: + /**@name Constructors and Destructors */ + //@{ + /// + FormCitation(LyXView *, Dialogs *); + /// + ~FormCitation(); + //@} + + /// Apply changes + void apply(); +private: + /// + enum State { + ON, + /// + OFF + }; + /// Create the dialog if necessary, update it and display it. + void show(); + /// Hide the dialog. + void hide(); + /// Update the dialog. + void update(); + + void setBibButtons(State status) const; + void setCiteButtons(State status) const; + + /// create a Citation inset + void createCitation(string const &); + /// edit a Citation inset + void showCitation(InsetCommand * const); + + /// update a listbox + void updateBrowser( QListBox* listbox, + vector const & keys) const; + + /// Real GUI implementation. + FormCitationDialog * dialog_; + + /// the LyXView we belong to + LyXView * lv_; + + /** Which Dialogs do we belong to? + Used so we can get at the signals we have to connect to. + */ + Dialogs * d_; + /// pointer to the inset if any + InsetCommand * inset_; + /// insets params + InsetCommandParams params; + /// is the inset we are reading from a readonly buffer ? + bool readonly; + + /// Inset hide connection. + SigC::Connection ih_; + + std::vector citekeys; + /// + std::vector bibkeys; + /// + std::vector bibkeysInfo; +}; + +#endif diff --git a/src/frontends/qt2/FormCitationDialog.ui b/src/frontends/qt2/FormCitationDialog.ui new file mode 100644 index 0000000000..8b6dd589f1 --- /dev/null +++ b/src/frontends/qt2/FormCitationDialog.ui @@ -0,0 +1,577 @@ + +FormCitationDialog + + QDialog + + name + FormCitationDialog + + + geometry + + 0 + 0 + 388 + 482 + + + + caption + Citation + + + + margin + 11 + + + spacing + 6 + + + QLayoutWidget + + name + Layout24 + + + + margin + 0 + + + spacing + 6 + + + QLayoutWidget + + name + Layout1 + + + + margin + 0 + + + spacing + 6 + + + QPushButton + + name + leftPB + + + sizePolicy + + 0 + 0 + + + + text + + + + pixmap + image0 + + + + QPushButton + + name + stopPB + + + sizePolicy + + 0 + 0 + + + + text + + + + pixmap + image1 + + + + QPushButton + + name + upPB + + + sizePolicy + + 0 + 0 + + + + text + + + + pixmap + image2 + + + + QPushButton + + name + downPB + + + sizePolicy + + 0 + 0 + + + + text + + + + pixmap + image3 + + + + + + QLabel + + name + bibliographyKeysLA + + + text + Bibliography keys + + + + QLabel + + name + insetKeysLA + + + text + Inset keys + + + + QListBox + + + text + New Item + + + + name + bibliographyKeysLB + + + toolTip + Reference keys available + + + + QListBox + + + text + New Item + + + + name + insetKeysLB + + + selectionMode + Single + + + toolTip + Keys currently selected + + + + + + + name + Spacer2 + + + orientation + Vertical + + + sizeType + Expanding + + + sizeHint + + 20 + 20 + + + + + QLabel + + name + infoLA + + + text + Info + + + + QMultiLineEdit + + name + infoML + + + toolTip + Reference entry text + + + + + name + Spacer3 + + + orientation + Vertical + + + sizeType + Expanding + + + sizeHint + + 20 + 20 + + + + + QLayoutWidget + + name + Layout25 + + + + margin + 0 + + + spacing + 6 + + + QLabel + + name + citationStyleLA + + + text + Citation style + + + + QComboBox + + name + citationStyleCO + + + + + name + Spacer8 + + + orientation + Horizontal + + + sizeType + Expanding + + + sizeHint + + 20 + 20 + + + + + + + QLayoutWidget + + name + Layout9 + + + + margin + 0 + + + spacing + 6 + + + QLabel + + name + textBeforeLA + + + text + Text before + + + + QLabel + + name + textAfterLA + + + text + Text after + + + + QLineEdit + + name + textBeforeED + + + toolTip + Text to place before citation + + + + QLineEdit + + name + textAfterED + + + toolTip + Text to place after citation + + + + + + QLayoutWidget + + name + Layout6 + + + + margin + 0 + + + spacing + 6 + + + QPushButton + + name + restorePB + + + text + &Restore + + + + + name + Spacer4 + + + orientation + Horizontal + + + sizeType + Expanding + + + sizeHint + + 20 + 20 + + + + + QPushButton + + name + okPB + + + text + OK + + + default + true + + + + QPushButton + + name + applyPB + + + text + &Apply + + + + QPushButton + + name + cancelPB + + + text + Cancel + + + + + + + + + image0 + 789cad95c76e24371086ef7a8a81ea2618b54d363bc1d88372d64a1bb56bf8d04c8aa3388a86dfddd45f9c3eac6478163038d2e013ff228b95f46e6174b8bf3b5a7837773be927276ee48efb9bd182bf1b8f9ffef8f3fd5f73f35a8fd2471566a4e77f9b9b3f988cdc68eff222bc00df26a0a22c8aa27c61da19d880b706aea13fc9ac8b16fb4f99cba2c3fe24b3297a700f36c9be827e25b3291cf62f325785c7fe7666abe00f3b70359cff2db353f08736320725fe5c648e4af48be05a2925e7bbcc5ae1fd7499b95411fc98b9d20af6bb996b8de0f157709358e2739fb9d772ff4366ab713fdd815be535ee6702bbd255b0672d6c0b077bfe9159b9067c30b0bc673573e5103f12f629808837f9ccba92fdabcc5525ef7bce5cd7057833b3ab25bf9db02de53e1a8383f1b5dcdf0857ba96f8ad678e8d052f0bd75d8b7cf397ccbe95f3a43e42d37772df4de6d089ff92afd0aa4ef21532b7bdc4fb3ab3ed111f5acaec84b91d58f27124dca58861bf14b6dac97de7e058bb56e25f674e27607f4db8295ae917233cd89fbdb02a9ab2937aa984fbca4abc8fc1aa319dd48f1276d64b3cd04f4a4fede934b3c9e77d07979db1922f16b6c14b7fa09f94712af33eb872da4bbc223885cb497e106fd55993ebad0007df798937ea536baf3cf48c7ad6a5f55efcc77cd0668887057795aaa5be512fda4ef3cda837edaaae91f8239ea51afcfd084e022ff93b049baa6fa43e96857d29fef1077095e227fea1ffca66ca847956b64107f117fd5cfade3bb9ffb3f0b4df08f3c914a10c122fbcc7986082e8913fd34eeb81517f26d8d6c9fb31af2a9ff221fd8c7aad55133bf1ef13d824ffc47ff4671d7b6de53ce42765bbcbf5b997d959793fe647d375e94630eaa3717dca0818f3abf1c379e8c7267a1764fea23fda7278ffb9b08d5e784b38bd1ff5ca98076d1b4c44bd31e66bdb0d8c79d27a9f2cc098ffcec5228a7fe8371f6219e5fde88f18a38b51fef9ccbefe3f3d13f7b3eb93dab29b559fd49ec3acfaa48e7cc4c77c328b3ea94ff98ccf79cc17ffad4feacba4bee26bbee1db44d3f5a63efdfd0eea7b7ee0c7f4fd94e82cfd7ee6c5d7faa45e827a99577895d7789d377893b7789b7778f7677d52efa5575ef107dee783b456f9237fc2facc5ff8eb2bfd373ee4effc830b56acd32ad9e45571fdfafc64b1c80db7dcbd5810a71fa29e2cecdfd41f4cc891a74031a9141dd1319dd0299dd1398de9e2ed78d2255dd135ddd02d4de88eeeb11ee8919efe2d5fe98e675aa4255aa695d9ea2159acd21aadcf560fb0d8485e6dceae477489b666d7a73bb669e757f46faf5fd6fffdfbdc3f05fcbfcc + + + image1 + 789c959459531a411485dff91594f366a5ae3d5bf74ca5f2e0be44c10db7541e8659141557543495ff9edbe736132068923950c5479f7b397da78785f9e6c9ee4e737ea1f138c806bdbc995f640fcdf9e2a9df7ffdf6fdcb8fc65c1034f9a5753398fbd498db1b34f366ebf6a6b440e70c9ec205f62cfba5ca5406d6e0aae623cb81aa3973dc555df005b85495aac05dcb61e4f305beb31c9741160857969354ab58fc4370ae4a25f93a96d35c452edf8be5ac5281c266e8d67257456514810fc189d24afaa7605b2febcfc23a8c257f1b5c04dad7e0185cfa912ffe75cbb91f56a1ac3f09ebd4e51d80439d69f9bd081c457924ecd72c791fc1b12e740c6e81751c44e8ef61feb9318529b0fe004e8dd209780d9cc57c81cf1c5771080e84799e293871ecbbfd1a701e17b1ec6fd571e9faed804b1db8fa125c7559e015cb85d23a96fb1d0a1b63e4fedc80fd3aff3238d0a99bcf1238e2fdcb3cb71d97da8095b0c98cece7181c334bbe03b031a196f3f1159c30cbeff585139348bf45706a022d79f7c119e7953c5be06ecd6fe09ce72dfe0d70c1f539f8c4716e247f2e9c7413f1bf0aa72a91f95d3b0e13a9dfb55caabafe4a38d509e6eb9170c1c2fa1e38309591fbb7090e99a5ff25d8a4452af3b907a76995cafe0bcb5552b2c0a7e0a26203b807c6257f0effae693f79944dea233f7529a7624c255574fe9e9f2ed8dda34bd6155db3fa7443b774375ef1dbefdcf7f4c07aa4013db19ee98586e315233f92f4e895de588bb444cbb442abb446eb9315e2e75d4aef0d568f36698bbed236edf0e716b5c72b9c3fe3bd5dd22ef7ee417bb44f07ee738b0ea933e53f82ff98936c3ad709bf4ff97dc689fef4dbfe57a438f716f7eed53a237fa6dff6bf66ff32e7de476fab80b3b43ef0873c93ed3ab755c4ee78865fb3ff86e76e30139b3b71156d4a67e5f788fdcfdc6d94bbc5bd471533f2781edff9175eb3153e76d966f5d86bdd53f3e78a73fe66880a518c24ed49f7c4f919551c4ea833fbfc8c557426347cef7cd615d37af7fcbb8a297dfc3cfeeff3fb57ffcfcf8d5fe8202a15 + + + image2 + 789cc595494f24471085effc8a167143564c65d69ab27c60df06066665c6f2a17283665f9aad2dff7767bfc86e812c0f7db14cc1e1a35f6444bc88ac7eb734383ad81b2cbd5bb81bf5a3a11bb893fe76b0e4ef2f2e9e7fffe3b73f1716b51ea45f559403bdf8cbc2e2e168e006fb57976102c409a8288ba228c16733aec0a7336ec07d665d74e0ddcc6561c09b99aba2070fc1557a1cd866ae0b3f613699ad92fc04aea7e7719fd929e4e7bdcc4149fe9dcc5189de831ba5949c3fccac15fae5ebcca58a88dfc85c6b05decadc689845dbe036b1f87193b9d7927f9cd96ae9ff04dc29af25bff4e34a57239ee57c670b8778bec8ac5c0bde9cb1f4f33173ede01fbf07fb6420fce5abccba96cf1f32d735fae3d5cc4d5380bbccae113f47c2b6947cb40e0e956f24bff4136add887f6de6d85a7023dc98ae46fc6a66df497c2ddcf646f215998391fa657f42a78cf8759fb9ebc5af95ccb6177fbe6476992f672c7e56c22639062e85ad76b28fcfe0d8b84ee6b796399d00fd57e1b6e8e47e04e1593cea53455b1ad99727e1beb6b24fc760d55606fbc3636167bdf88bfd537a167f97b91266892f4d65655e9f846df0b81f8c7d55955399d18faa9df6e2d73238d9e5643eb81fcad82aef9be40bde78f84d71c25a7be5457f082eadf7b2fff05f57533ff81bd8d4aa9179fd00dbe9bc09f9b5ab4d2bfeeb09976a5a2fe17e9649e0657e0e5cd57d2bfbf124ec4ba98f6fc175f24feac37e96ed8c3f83bba083f8adc0bef74ef6f151787adf08f7a52a4219c42fdcefaa0a55907abf83bbd93e1c8083ed9cec03ee57edd33c24fe68c28d6aa3413d847d6caa549fd4bf0f8ebdb6721ef62d4ddbe4fdb4999d95fef1be6d8d4919c1a8bf757d9a0818ef9fd64fcf23f8d746ef82dc27ec6b574efbe70fc2367af163249cfa977d85bf5d17aa887d23bc8f3a33653e077b9f22f039d8b95844a90ffbe3432ca3cc03df1f314617a37cd9ccfffc5f7a26eee7d727b565c77e3e7d52078e7ccc273c7c5b9fd4a77cc6e77cc1977cc5d73fd727f50dd4b77cc723bee787d7395eeb93fa11ea277ee6718a58e6155e7d19f1529fd46b50aff3066ff2568ad8e61ddee5f7bcf74f7d52efa72e3ff0011ff247e83fa588cffc85bfa6aafad7faa4fec647fc9d7f70c18a758a2893bae29a1b6eb94b9f9b977a629afcf46489f99c1c790a14e9984e6898fedbd3299dfd9b9f744e177499f457744d3773f87f46b7133d6fd3dd9cfa11f477743f8f3ed5f3408ff4c4637aa6f11cfa655aa1555a4bcf3a6dbca5a74df6b445dbe96f8b7668f72dfdcf9fff5cffd7af0b7f0351a5bebb + + + image3 + 789ca5d3496f22311005e03bbfa295dcd068d2edde359a0359c8beef19cdc12e97034908244dc8a6f9efd3f50c8144dcd2e2d09f9e8d9f29b1d40c2e0e7683e652a31aea619702eae8c7a0699f7abdd73f7f7fbf3716940aea4f9a07d1c28fc6c2cf8082bdfe3dcb3bd7ef8b611c86612c1c819a9455c23e684c415678fc41ec3d19d3782e8214539a082b4f135221bc1a5391168663a644c233d02659160ab73c4b674ae1a6a77116fdf7414e6c86b4e599e725aeb03d6651a2c6f398bacc84a79e656190be09a330e7125fb503aa8c0b94bcf5cc9312e70ec0829ccd85bb609925053aef813a0b73dc2802a9ee8c5616b445a2b1f81174145bd4d8102a658cbfe03d18536253e11148f550b0f8521847f55ea443d05a63318535611ae98230410d26ba24d458053f86b20e5aca2cee7b21ccd82ac6de5761aec8315a2d83b1d1165778f024667005cc26e993e7646fcfd3469e4a581436655ce106e409dbc232b19a51b203e69356d7a0b6b95fdc15ead43a36c27390d839cce84568981387568742526c1cf61e8075e6709011d6150b87839c904397380c9484f5d2d4e1bf70073a47cee13f35f7f966b2387ee624da10d5139f93b8eb4ef7e6765e72d7bbef0fe6270f8fd5707ef234aa86cf9f135feae575540dde18cf24e1d6f2caea5a7b7da3dadcdaded9dddbff48eae8c01db68f8eabea6430383de39973b8757e71d9bfaaaad1d007d3067534eacf0433dd240aa7c16ceb3a8aa6c1a7df9a5b6a1a7c9e02b7a6c197f9f034f8ee4cbf26ff7e35fe03191b46e7 + + + + + insetKeysLB + selected(int) + FormCitationDialog + slotInsetSelected(int) + + + bibliographyKeysLB + selected(int) + FormCitationDialog + slotBibSelected(int) + + + leftPB + clicked() + FormCitationDialog + slotAddClicked() + + + stopPB + clicked() + FormCitationDialog + slotDelClicked() + + + upPB + clicked() + FormCitationDialog + slotIUpClicked() + + + downPB + clicked() + FormCitationDialog + slotDownClicked() + + + restorePB + clicked() + FormCitationDialog + slotRestoreClicked() + + + okPB + clicked() + FormCitationDialog + apply_adaptor() + + + okPB + clicked() + FormCitationDialog + close_adaptor() + + + applyPB + clicked() + FormCitationDialog + apply_adaptor() + + + cancelPB + clicked() + FormCitationDialog + close_adaptor() + + apply_adaptor() + close_adaptor() + slotAddClicked() + slotBibSelected(int) + slotDelClicked() + slotDownClicked() + slotIUpClicked() + slotInsetSelected(int) + slotRestoreClicked() + + diff --git a/src/frontends/qt2/FormCitationDialogImpl.C b/src/frontends/qt2/FormCitationDialogImpl.C new file mode 100644 index 0000000000..7e0c674cb0 --- /dev/null +++ b/src/frontends/qt2/FormCitationDialogImpl.C @@ -0,0 +1,190 @@ +/** + * $Id: FormCitationDialogImpl.C,v 1.1 2001/03/16 17:20:06 kalle Exp $ + */ + +#include "FormCitationDialogImpl.h" +#include "Dialogs.h" +#include "FormCitation.h" + +#include +#include +#undef emit + +#include +#include "LyXView.h" +#include "buffer.h" + +// PENDING(kalle) Wire text before and citaiton style + +/* + * Constructs a FormCitationDialogImpl 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 + * TRUE to construct a modal dialog. + */ +FormCitationDialogImpl::FormCitationDialogImpl( FormCitation* form, QWidget* parent, const char* name, bool modal, WFlags fl ) + : FormCitationDialog( parent, name, modal, fl ), + form_( form ) +{ +} + +/* + * Destroys the object and frees any allocated resources + */ +FormCitationDialogImpl::~FormCitationDialogImpl() +{ + // no need to delete child widgets, Qt does it all for us +} + + + +// These slots correspond to the XForms input() method. +void FormCitationDialogImpl::slotBibSelected( int sel ) +{ + insetKeysLB->clearSelection(); + + if( sel < 0 || sel > form_->bibkeys.size()-1) + return; + + // Put into browser_info the additional info associated with + // the selected browser_bib key + infoML->clear(); + infoML->append( form_->bibkeysInfo[sel].c_str() ); + + // Highlight the selected browser_bib key in browser_cite if present + vector::iterator it = + ::find(form_->citekeys.begin(), form_->citekeys.end(), form_->bibkeys[sel]); + + if (it != form_->citekeys.end()) { + int n = static_cast(it - form_->citekeys.begin()); + insetKeysLB->setSelected( n, true ); + } + + if (!form_->lv_->buffer()->isReadonly()) { + if (it != form_->citekeys.end()) { + form_->setBibButtons(FormCitation::OFF); + form_->setCiteButtons(FormCitation::ON); + } else { + form_->setBibButtons(FormCitation::ON); + form_->setCiteButtons(FormCitation::OFF); + } + } + +} + + +void FormCitationDialogImpl::slotInsetSelected( int sel ) +{ + if (sel < 0 || sel > form_->citekeys.size() -1 ) + return; + + if (!form_->lv_->buffer()->isReadonly()) { + form_->setBibButtons(FormCitation::OFF); + form_->setCiteButtons(FormCitation::ON); + } + + // Highlight the selected browser_cite key in browser_bib + vector::iterator it = + ::find(form_->bibkeys.begin(), form_->bibkeys.end(), form_->citekeys[sel]); + + if (it != form_->bibkeys.end()) { + int n = static_cast(it - form_->bibkeys.begin()); + bibliographyKeysLB->setSelected( n, true ); + + // Put into browser_info the additional info associated with + // the selected browser_cite key + infoML->clear(); + infoML->append( form_->bibkeysInfo[n].c_str() ); + } +} + + +void FormCitationDialogImpl::slotAddClicked() +{ + qDebug( "FormCitationDialogImpl::slotAddClicked()" ); + int sel = bibliographyKeysLB->currentItem(); + if (sel < 0 || sel > form_->bibkeys.size() -1 ) + return; + + qDebug( "sel = %d" ); + qDebug( "bibkeys.size() = %d", form_->bibkeys.size() ); + + // Add the selected browser_bib key to browser_cite + insetKeysLB->insertItem( form_->bibkeys[sel].c_str()); + form_->citekeys.push_back(form_->bibkeys[sel]); + + int n = static_cast(form_->citekeys.size()); + insetKeysLB->setSelected( n, true ); + + form_->setBibButtons(FormCitation::OFF); + form_->setCiteButtons(FormCitation::ON); +} + + +void FormCitationDialogImpl::slotDelClicked() +{ + int sel = insetKeysLB->currentItem(); + if (sel < 0 || sel > form_->citekeys.size()-1) + return; + + // Remove the selected key from browser_cite + insetKeysLB->removeItem( sel ); + form_->citekeys.erase(form_->citekeys.begin() + sel); + + form_->setBibButtons(FormCitation::ON); + form_->setCiteButtons(FormCitation::OFF); +} + + +void FormCitationDialogImpl::slotUpClicked() +{ + int sel = insetKeysLB->currentItem(); + if (sel < 1 || sel > form_->citekeys.size()-1) + return; + + // Move the selected key up one line + vector::iterator it = form_->citekeys.begin() + sel; + string tmp = *it; + + insetKeysLB->removeItem( sel ); + form_->citekeys.erase(it); + + insetKeysLB->insertItem( tmp.c_str(), sel-1 ); + insetKeysLB->setSelected( sel-1, true ); + form_->citekeys.insert(it-1, tmp); + form_->setCiteButtons(FormCitation::ON); +} + + +void FormCitationDialogImpl::slotDownClicked() +{ + int sel = insetKeysLB->currentItem(); + if (sel < 0 || sel > form_->citekeys.size()-2) + return; + + // Move the selected key down one line + vector::iterator it = form_->citekeys.begin() + sel; + string tmp = *it; + + insetKeysLB->removeItem( sel ); + form_->citekeys.erase(it); + + insetKeysLB->insertItem( tmp.c_str(), sel+1 ); + insetKeysLB->setSelected( sel+1, true ); + form_->citekeys.insert(it+1, tmp); + form_->setCiteButtons(FormCitation::ON); +} + + +void FormCitationDialogImpl::apply_adaptor() +{ + form_->apply(); +} + + +void FormCitationDialogImpl::close_adaptor() +{ + form_->close(); + hide(); +} diff --git a/src/frontends/qt2/FormCitationDialogImpl.h b/src/frontends/qt2/FormCitationDialogImpl.h new file mode 100644 index 0000000000..76bdc1cbab --- /dev/null +++ b/src/frontends/qt2/FormCitationDialogImpl.h @@ -0,0 +1,33 @@ +/** + * $Id: FormCitationDialogImpl.h,v 1.1 2001/03/16 17:20:06 kalle Exp $ + */ + +#ifndef FORMCITATIONDIALOGIMPL_H +#define FORMCITATIONDIALOGIMPL_H +#include "FormCitationDialog.h" + +class FormCitation; + +class FormCitationDialogImpl : public FormCitationDialog +{ + Q_OBJECT + +public: + FormCitationDialogImpl( FormCitation* form, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); + ~FormCitationDialogImpl(); + +protected slots: + virtual void slotBibSelected( int sel ); + virtual void slotInsetSelected( int sel ); + virtual void slotAddClicked(); + virtual void slotDelClicked(); + virtual void slotUpClicked(); + virtual void slotDownClicked(); + virtual void apply_adaptor(); + virtual void close_adaptor(); + +private: + FormCitation* form_; +}; + +#endif // FORMCITATIONDIALOGIMPL_H diff --git a/src/frontends/qt2/FormSearch.h b/src/frontends/qt2/FormSearch.h index 3ab63ac5b1..fdc5c13e01 100644 --- a/src/frontends/qt2/FormSearch.h +++ b/src/frontends/qt2/FormSearch.h @@ -54,10 +54,10 @@ private: Dialogs * d_; /// Hide connection. - Connection h_; + SigC::Connection h_; /// Update connection. - Connection u_; + SigC::Connection u_; }; diff --git a/src/frontends/qt2/FormSplash.h b/src/frontends/qt2/FormSplash.h index 5d9c87f7f2..387572e9fa 100644 --- a/src/frontends/qt2/FormSplash.h +++ b/src/frontends/qt2/FormSplash.h @@ -36,7 +36,7 @@ class FormSplash : public DialogBase { /// our container Dialogs * d_; /// the show connection - Connection c_; + SigC::Connection c_; }; #endif // FORMSPLASH_H diff --git a/src/frontends/qt2/FormTabularCreate.h b/src/frontends/qt2/FormTabularCreate.h index 9fa0223d88..2438cbaea3 100644 --- a/src/frontends/qt2/FormTabularCreate.h +++ b/src/frontends/qt2/FormTabularCreate.h @@ -56,7 +56,7 @@ private: Dialogs * d_; /// Hide connection. - Connection h_; + SigC::Connection h_; }; #endif diff --git a/src/frontends/qt2/Makefile.am b/src/frontends/qt2/Makefile.am index d0c6057263..8f5cf534c0 100644 --- a/src/frontends/qt2/Makefile.am +++ b/src/frontends/qt2/Makefile.am @@ -1,18 +1,19 @@ AUTOMAKE_OPTIONS = foreign 1.4 +DISTCLEANFILES= *.orig *.rej *~ *.bak core MAINTAINERCLEANFILES = $(srcdir)/Makefile.in noinst_LTLIBRARIES = libqt2.la BOOST_INCLUDES = -I$(top_srcdir)/boost INCLUDES = -I${top_srcdir}/src/ -I${top_srcdir}/src/frontends/ \ ${SIGC_CFLAGS} ${FRONTEND_INCLUDES} $(BOOST_INCLUDES) \ - -I${top_srcdir}/src/frontends/xforms -DEFINES = -DQT_CLEAN_NAMESPACE -CXXFLAGS= $(DEFINES) + -I${top_srcdir}/src/frontends/xforms \ + -I$(top_srcdir)/src/frontends/controllers +CXXFLAGS += -DQT_CLEAN_NAMESPACE -fno-rtti -fno-exceptions # moc generated files BUILTSOURCES = \ moc_FileDialog_private.C \ - moc_FormCopyrightDialogBase.C \ - moc_FormCopyrightDialog.C \ + moc_FormCitationDialog.C \ + moc_FormCitationDialogImpl.C \ moc_chardlg.C \ moc_chardlgimpl.C \ moc_paragraphdlg.C \ @@ -25,8 +26,6 @@ BUILTSOURCES = \ moc_tabularcreatedlgimpl.C \ moc_emptytable.C - - LYXDATADIRS = dlg DISTCLEANFILES = $(BUILTSOURCES) *.orig *.rej *~ *.bak core @@ -34,7 +33,8 @@ libqt2_la_OBJADD = \ ../xforms/ButtonController.lo \ ../xforms/Color.lo \ ../xforms/FormBase.lo \ - ../xforms/FormCitation.lo \ + ../xforms/FormBaseDeprecated.lo \ + ../xforms/FormCopyright.lo \ ../xforms/FormCredits.lo \ ../xforms/FormDocument.lo \ ../xforms/FormError.lo \ @@ -65,7 +65,8 @@ libqt2_la_OBJADD = \ ../xforms/form_toc.lo \ ../xforms/form_url.lo \ ../xforms/input_validators.lo \ - ../xforms/xforms_helpers.lo + ../xforms/xforms_helpers.lo \ + ../xforms/xformsBC.lo LIBS= LDFLAGS= $(libqt2_la_OBJADD) @@ -83,12 +84,12 @@ libqt2_la_SOURCES = \ chardlgimpl.h \ FileDialog.C \ FileDialog_private.C \ - FormCopyright.C \ - FormCopyright.h \ - FormCopyrightDialog.C \ - FormCopyrightDialog.h \ - FormCopyrightDialogBase.C \ - FormCopyrightDialogBase.h \ + FormCitation.C \ + FormCitation.h \ + FormCitationDialog.C \ + FormCitationDialog.h \ + FormCitationDialogImpl.C \ + FormCitationDialogImpl.h \ FormParagraph.C \ FormParagraph.h \ paragraphdlg.C \ @@ -134,16 +135,14 @@ dist-hook: done ; \ done -FormCopyright.C: FormCopyrightDialogBase.h -FormCopyrightDialogBase.h: FormCopyrightDialogBase.ui +FormCitation.C: FormCitationDialog.h +FormCitationDialog.h: FormCitationDialog.ui $(UIC) -o $@ $< -FormCopyrightDialogBase.C: FormCopyrightDialogBase.ui - $(UIC) -impl FormCopyrightDialogBase.h -o $@ $< -moc_FileDialog_private.C: FileDialog_private.h - $(MOC) -o $@ $< -moc_FormCopyrightDialogBase.C: FormCopyrightDialogBase.h +FormCitationDialog.C: FormCitationDialog.ui + $(UIC) -impl FormCitationDialog.h -o $@ $< +moc_FormCitationDialog.C: FormCitationDialog.h $(MOC) -o $@ $< -moc_FormCopyrightDialog.C: FormCopyrightDialog.h +moc_FormCitationDialogImpl.C: FormCitationDialogImpl.h $(MOC) -o $@ $< FormParagraph.C: paragraphdlg.h @@ -198,3 +197,5 @@ moc_searchdlg.C: searchdlg.h moc_searchdlgimpl.C: searchdlgimpl.h $(MOC) -o $@ $< +moc_FileDialog_private.C: FileDialog_private.h + $(MOC) -o $@ $< diff --git a/src/frontends/qt2/emptytable.h b/src/frontends/qt2/emptytable.h index e17807b399..518a705f75 100644 --- a/src/frontends/qt2/emptytable.h +++ b/src/frontends/qt2/emptytable.h @@ -25,7 +25,7 @@ * A simple widget for a quick "preview" in TabularCreateDialog. * The user can drag on the widget to change the table dimensions. */ -class EmptyTable : public QTableView, public noncopyable { +class EmptyTable : public QTableView { Q_OBJECT public: EmptyTable(QWidget * parent = 0, const char * name = 0); -- 2.39.2