From a24a97ed14944c642309d128ec90c1a13f3508ce Mon Sep 17 00:00:00 2001 From: Kalle Dalheimer Date: Thu, 29 Mar 2001 18:58:47 +0000 Subject: [PATCH] started moving citation dialog to MVC git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1856 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt2/Dialogs.C | 8 +- src/frontends/qt2/FormCitation.C | 426 ++++++++++++++------- src/frontends/qt2/FormCitation.h | 138 +++---- src/frontends/qt2/FormCitationDialog.ui | 165 +++++++- src/frontends/qt2/FormCitationDialogImpl.C | 5 +- src/frontends/qt2/FormDocumentDialog.ui | 14 +- src/frontends/qt2/qt2BC.C | 2 +- src/frontends/qt2/qt2BC.h | 5 +- 8 files changed, 520 insertions(+), 243 deletions(-) diff --git a/src/frontends/qt2/Dialogs.C b/src/frontends/qt2/Dialogs.C index 20d5e1e180..29d85dc15e 100644 --- a/src/frontends/qt2/Dialogs.C +++ b/src/frontends/qt2/Dialogs.C @@ -17,6 +17,7 @@ #include "Dialogs.h" +#include "FormCitationDialogImpl.h" #include "FormCopyrightDialogImpl.h" #undef emit @@ -41,8 +42,11 @@ //#include "FormUrl.h" #include "BufferView.h" +#include "buffer.h" +#include "controllers/ControlCitation.h" #include "controllers/ControlCopyright.h" + #include "GUI.h" #include "qt2BC.h" @@ -57,15 +61,13 @@ Dialogs::Dialogs(LyXView * lv) splash_.reset( new FormSplash(lv, this) ); // dialogs that have been converted to new scheme + add( new GUICitation( *lv, *this ) ); add( new GUICopyright( *lv, *this ) ); - // ------------------------------------------ // dialogs that are still old-style add( new FormCharacter(lv, this)); - add( new FormCitation(lv, this)); - // add(new FormCopyright(lv, this)); // REMOVED THIS UNTIL CHANGED TO NEW SCHEME -- Kalle, 2001-03-22 // add( new FormCredits(lv, this)); diff --git a/src/frontends/qt2/FormCitation.C b/src/frontends/qt2/FormCitation.C index 632e8452c6..ddaa65496d 100644 --- a/src/frontends/qt2/FormCitation.C +++ b/src/frontends/qt2/FormCitation.C @@ -1,198 +1,352 @@ -/* - * FormCitation.C - * (C) 2000 LyX Team - * John Levon, moz@compsoc.man.ac.uk - * Changed for Qt2 implementation by Kalle Dalheimer, kalle@klaralvdalens-datakonsult.se +// -*- C++ -*- +/* This file is part of + * ====================================================== + * + * LyX, The Document Processor + * + * Copyright 2000 The LyX Team. + * + * ====================================================== + * + * \author Angus Leeming */ -/*************************************************************************** - * * - * 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 +#ifdef __GNUG__ +#pragma implementation +#endif #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 #include -using SigC::slot; -using std::vector; -using std::pair; +#undef emit +#include "qt2BC.h" +#include "ControlCitation.h" +#include "gettext.h" +#include "support/lstrings.h" +#include "biblio.h" +#include "helper_funcs.h" + + using std::find; +using std::max; +using std::min; +using std::pair; using std::sort; +using std::vector; -FormCitation::FormCitation(LyXView *v, Dialogs *d) - : dialog_(0), lv_(v), d_(d), inset_(0), ih_(0) +typedef Qt2CB > base_class; + +FormCitation::FormCitation(ControlCitation & c) + : base_class(c, _("Citation")) +{} + + +void FormCitation::apply() { - // 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(); + controller().params().setCmdName("cite"); + controller().params().setContents(getStringFromVector(citekeys)); + + string const after = dialog_->textAfterED->text().latin1(); + controller().params().setOptions(after); } void FormCitation::hide() { - if( dialog_ ) - dialog_->hide(); + citekeys.clear(); + bibkeys.clear(); + + Qt2Base::hide(); } - -void FormCitation::show() +void FormCitation::build() { - if (!dialog_) - dialog_ = new FormCitationDialogImpl(this, 0, _("LyX: Citation Reference"), false); + // PENDING(kalle) Parent? + dialog_.reset( new FormCitationDialogImpl( this )); - dialog_->show(); + dialog_->searchTypePB->setOn( false ); + dialog_->searchTypePB->setText( _( "Simple" ) ); + + // Manage the ok, apply, restore and cancel/close buttons + bc().setOK(dialog_->okPB); + bc().setApply(dialog_->applyPB); + bc().setCancel(dialog_->cancelPB); + bc().setUndoAll(dialog_->restorePB); - update(); + bc().addReadOnly(dialog_->addPB); + bc().addReadOnly(dialog_->delPB); + bc().addReadOnly(dialog_->upPB); + bc().addReadOnly(dialog_->downPB); + bc().addReadOnly(dialog_->citationStyleCO); + bc().addReadOnly(dialog_->textBeforeED); + bc().addReadOnly(dialog_->textAfterED); + + bc().refresh(); +} + +#if K +ButtonPolicy::SMInput FormCitation::input(FL_OBJECT * ob, long) +{ + ButtonPolicy::SMInput activate = ButtonPolicy::SMI_NOOP; + + biblio::InfoMap const & theMap = controller().bibkeysInfo(); + + if (ob == dialog_->browser_bib) { + fl_deselect_browser(dialog_->browser_cite); + + unsigned int const sel = fl_get_browser(dialog_->browser_bib); + if (sel < 1 || sel > bibkeys.size()) + return ButtonPolicy::SMI_NOOP; + + // Put into browser_info the additional info associated with + // the selected browser_bib key + fl_clear_browser(dialog_->browser_info); + + string const tmp = formatted(biblio::getInfo(theMap, + bibkeys[sel-1]), + dialog_->browser_info->w-10 ); + fl_add_browser_line(dialog_->browser_info, tmp.c_str()); + + // Highlight the selected browser_bib key in browser_cite if + // present + vector::const_iterator cit = + find(citekeys.begin(), citekeys.end(), bibkeys[sel-1]); + + if (cit != citekeys.end()) { + int const n = int(cit - citekeys.begin()); + fl_select_browser_line(dialog_->browser_cite, n+1); + fl_set_browser_topline(dialog_->browser_cite, n+1); + } + + if (!controller().isReadonly()) { + if (cit != citekeys.end()) { + setBibButtons(OFF); + setCiteButtons(ON); + } else { + setBibButtons(ON); + setCiteButtons(OFF); + } + } + + } else if (ob == dialog_->browser_cite) { + unsigned int const sel = fl_get_browser(dialog_->browser_cite); + if (sel < 1 || sel > citekeys.size()) + return ButtonPolicy::SMI_NOOP; + + if (!controller().isReadonly()) { + setBibButtons(OFF); + setCiteButtons(ON); + } + + // Highlight the selected browser_cite key in browser_bib + vector::const_iterator cit = + find(bibkeys.begin(), bibkeys.end(), citekeys[sel-1]); + + if (cit != bibkeys.end()) { + int const n = int(cit - bibkeys.begin()); + fl_select_browser_line(dialog_->browser_bib, n+1); + fl_set_browser_topline(dialog_->browser_bib, n+1); + + // Put into browser_info the additional info associated + // with the selected browser_cite key + fl_clear_browser(dialog_->browser_info); + string const tmp = + formatted(biblio::getInfo(theMap, + bibkeys[sel-1]), + dialog_->browser_info->w-10); + fl_add_browser_line(dialog_->browser_info, tmp.c_str()); + } + + } else if (ob == dialog_->button_add) { + unsigned int const sel = fl_get_browser(dialog_->browser_bib); + if (sel < 1 || sel > bibkeys.size()) + return ButtonPolicy::SMI_NOOP; + + // Add the selected browser_bib key to browser_cite + fl_addto_browser(dialog_->browser_cite, + bibkeys[sel-1].c_str()); + citekeys.push_back(bibkeys[sel-1]); + + int const n = int(citekeys.size()); + fl_select_browser_line(dialog_->browser_cite, n); + + setBibButtons(OFF); + setCiteButtons(ON); + activate = ButtonPolicy::SMI_VALID; + + } else if (ob == dialog_->button_del) { + unsigned int const sel = fl_get_browser(dialog_->browser_cite); + if (sel < 1 || sel > citekeys.size()) + return ButtonPolicy::SMI_NOOP; + + // Remove the selected key from browser_cite + fl_delete_browser_line(dialog_->browser_cite, sel) ; + citekeys.erase(citekeys.begin() + sel-1); + + setBibButtons(ON); + setCiteButtons(OFF); + activate = ButtonPolicy::SMI_VALID; + + } else if (ob == dialog_->button_up) { + unsigned int const sel = fl_get_browser(dialog_->browser_cite); + if (sel < 2 || sel > citekeys.size()) + return ButtonPolicy::SMI_NOOP; + + // Move the selected key up one line + vector::iterator it = citekeys.begin() + sel-1; + string const tmp = *it; + + fl_delete_browser_line(dialog_->browser_cite, sel); + citekeys.erase(it); + + fl_insert_browser_line(dialog_->browser_cite, sel-1, tmp.c_str()); + fl_select_browser_line(dialog_->browser_cite, sel-1); + citekeys.insert(it-1, tmp); + setCiteButtons(ON); + activate = ButtonPolicy::SMI_VALID; + + } else if (ob == dialog_->button_down) { + unsigned int const sel = fl_get_browser(dialog_->browser_cite); + if (sel < 1 || sel > citekeys.size()-1) + return ButtonPolicy::SMI_NOOP; + + // Move the selected key down one line + vector::iterator it = citekeys.begin() + sel-1; + string const tmp = *it; + + fl_delete_browser_line(dialog_->browser_cite, sel); + citekeys.erase(it); + + fl_insert_browser_line(dialog_->browser_cite, sel+1, tmp.c_str()); + fl_select_browser_line(dialog_->browser_cite, sel+1); + citekeys.insert(it+1, tmp); + setCiteButtons(ON); + activate = ButtonPolicy::SMI_VALID; + + } else if (ob == dialog_->button_search_type) { + if (fl_get_button(dialog_->button_search_type)) + fl_set_object_label(dialog_->button_search_type, + _("Regex")); + else + fl_set_object_label(dialog_->button_search_type, + _("Simple")); + return ButtonPolicy::SMI_NOOP; + + } else if (ob == dialog_->button_previous || + ob == dialog_->button_next) { + + string const str = fl_get_input(dialog_->input_search); + + biblio::Direction const dir = + (ob == dialog_->button_previous) ? + biblio::BACKWARD : biblio::FORWARD; + + biblio::Search const type = + fl_get_button(dialog_->button_search_type) ? + biblio::REGEX : biblio::SIMPLE; + + vector::const_iterator start = bibkeys.begin(); + int const sel = fl_get_browser(dialog_->browser_bib); + if (sel >= 1 && sel <= int(bibkeys.size())) + start += sel-1; + + // Find the NEXT instance... + if (dir == biblio::FORWARD) + start += 1; + else + start -= 1; + + vector::const_iterator const cit = + biblio::searchKeys(theMap, bibkeys, str, + start, type, dir); + + if (cit == bibkeys.end()) + return ButtonPolicy::SMI_NOOP; + + int const found = int(cit - bibkeys.begin()) + 1; + if (found == sel) + return ButtonPolicy::SMI_NOOP; + + // Update the display + int const top = max(found-5, 1); + fl_set_browser_topline(dialog_->browser_bib, top); + fl_select_browser_line(dialog_->browser_bib, found); + input(dialog_->browser_bib, 0); + + } else if (ob == dialog_->choice_style || + ob == dialog_->input_before || + ob == dialog_->input_after) { + activate = ButtonPolicy::SMI_VALID; + } + + return activate; } +#endif 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); - + // Make the list of all available bibliography keys + bibkeys = biblio::getKeys(controller().bibkeysInfo()); + updateBrowser(dialog_->bibLB, 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); + citekeys = getVectorFromString(controller().params().getContents()); + updateBrowser(dialog_->citeLB, citekeys); // No keys have been selected yet, so... dialog_->infoML->clear(); setBibButtons(OFF); setCiteButtons(OFF); - dialog_->textAfterED->setText( params.getOptions().c_str() ); + int noKeys = int(max(bibkeys.size(), citekeys.size())); + + // Place bounds, so that 4 <= noKeys <= 10 + noKeys = max(4, min(10, noKeys)); + + dialog_->textAfterED->setText( controller().params().getOptions().c_str()); } -void FormCitation::updateBrowser( QListBox* listbox, +void FormCitation::updateBrowser( QListBox* browser, vector const & keys) const { - listbox->clear(); + browser->clear(); - for (unsigned int i = 0; i < keys.size(); ++i) - listbox->insertItem( keys[i].c_str() ); + for (vector::const_iterator it = keys.begin(); + it < keys.end(); ++it) { + string key = frontStrip(strip(*it)); + browser->insertItem( key.c_str() ); + } } void FormCitation::setBibButtons(State status) const { - dialog_->leftPB->setEnabled( status == ON ); + dialog_->addPB->setEnabled( (status == ON) ); } void FormCitation::setCiteButtons(State status) const { - int const sel = dialog_->insetKeysLB->currentItem(); - int const maxline = dialog_->insetKeysLB->count(); - + int const sel = dialog_->citeLB->currentItem(); + int const maxline = dialog_->citeLB->count()-1; bool const activate = (status == ON); - bool const activate_up = (activate && sel != 1); + bool const activate_up = (activate && sel != 0); 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()); - } + dialog_->delPB->setEnabled( activate ); + dialog_->upPB->setEnabled( activate_up ); + dialog_->downPB->setEnabled( activate_down ); } diff --git a/src/frontends/qt2/FormCitation.h b/src/frontends/qt2/FormCitation.h index cfb562c234..17d62785b8 100644 --- a/src/frontends/qt2/FormCitation.h +++ b/src/frontends/qt2/FormCitation.h @@ -1,96 +1,70 @@ -/* 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. * - * * - ***************************************************************************/ +// -*- C++ -*- +/* This file is part of + * ====================================================== + * + * LyX, The Document Processor + * + * Copyright 2000 The LyX Team. + * + * ====================================================== + * + * \author Angus Leeming + * \author Kalle Dalheimer +*/ #ifndef FORMCITATION_H #define FORMCITATION_H -#include "DialogBase.h" -#include "insets/insetcommand.h" - -#include - -class Dialogs; -class LyXView; -class FormCitationDialog; +#ifdef __GNUG__ +#pragma interface +#endif class QListBox; -class FormCitation : public DialogBase { - friend class FormCitationDialogImpl; -public: - /**@name Constructors and Destructors */ - //@{ +#include "Qt2Base.h" +#undef emit + +/** This class provides a Qt2 implementation of the Citation Dialog. + @author Kalle Dalheimer +*/ +class ControlCitation; +class FormCitationDialogImpl; + +class FormCitation : public Qt2CB > { +public: + /// + FormCitation(ControlCitation &); + +private: + /// + enum State { /// - FormCitation(LyXView *, Dialogs *); - /// - ~FormCitation(); - //@} - - /// Apply changes - void apply(); -private: + ON, /// - 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(); + OFF + }; - void setBibButtons(State status) const; - void setCiteButtons(State status) const; + /// Set the Params variable for the Controller. + virtual void apply(); + /// Build the dialog. + virtual void build(); + /// Hide the dialog. + virtual void hide(); + /// Update dialog before/whilst showing it. + virtual void update(); + // /// Filter the inputs on callback from xforms + // virtual ButtonPolicy::SMInput input(FL_OBJECT *, long); - /// create a Citation inset - void createCitation(string const &); - /// edit a Citation inset - void showCitation(InsetCommand* ); - - /// update a listbox - void updateBrowser( QListBox* listbox, - std::vector const & keys) const; - - /// Real GUI implementation. - FormCitationDialog * dialog_; + void updateBrowser(QListBox*, std::vector const &) const; + /// + void setBibButtons(State) const; + /// + void setCiteButtons(State) const; - /// 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; + /// + std::vector citekeys; + /// + std::vector bibkeys; }; -#endif +#endif // FORMCITATION_H diff --git a/src/frontends/qt2/FormCitationDialog.ui b/src/frontends/qt2/FormCitationDialog.ui index 8b6dd589f1..3b8743becd 100644 --- a/src/frontends/qt2/FormCitationDialog.ui +++ b/src/frontends/qt2/FormCitationDialog.ui @@ -11,8 +11,8 @@ 0 0 - 388 - 482 + 391 + 601 @@ -62,7 +62,7 @@ QPushButton name - leftPB + addPB sizePolicy @@ -84,7 +84,7 @@ QPushButton name - stopPB + delPB sizePolicy @@ -180,7 +180,7 @@ name - bibliographyKeysLB + bibLB toolTip @@ -197,7 +197,7 @@ name - insetKeysLB + citeLB selectionMode @@ -274,6 +274,151 @@ + + QGroupBox + + name + GroupBox4 + + + title + Search + + + + margin + 11 + + + spacing + 6 + + + QLayoutWidget + + name + Layout35 + + + + margin + 0 + + + spacing + 6 + + + QLineEdit + + name + searchED + + + + QPushButton + + name + PushButton14 + + + text + &Previous + + + + + + QLayoutWidget + + name + Layout36 + + + + margin + 0 + + + spacing + 6 + + + QPushButton + + name + searchTypePB + + + text + Simple + + + toggleButton + true + + + toggleButton + true + + + + + name + Spacer2_2 + + + orientation + Horizontal + + + sizeType + Expanding + + + sizeHint + + 20 + 20 + + + + + QPushButton + + name + PushButton15 + + + text + &Next + + + + + + + + + name + Spacer1 + + + orientation + Vertical + + + sizeType + Expanding + + + sizeHint + + 20 + 20 + + + QLayoutWidget @@ -499,25 +644,25 @@ - insetKeysLB + citeLB selected(int) FormCitationDialog slotInsetSelected(int) - bibliographyKeysLB + bibLB selected(int) FormCitationDialog slotBibSelected(int) - leftPB + addPB clicked() FormCitationDialog slotAddClicked() - stopPB + delPB clicked() FormCitationDialog slotDelClicked() diff --git a/src/frontends/qt2/FormCitationDialogImpl.C b/src/frontends/qt2/FormCitationDialogImpl.C index 2f3f6142d3..c1878ff61d 100644 --- a/src/frontends/qt2/FormCitationDialogImpl.C +++ b/src/frontends/qt2/FormCitationDialogImpl.C @@ -1,5 +1,5 @@ /** - * $Id: FormCitationDialogImpl.C,v 1.2 2001/03/26 19:34:45 kalle Exp $ + * $Id: FormCitationDialogImpl.C,v 1.3 2001/03/29 18:58:47 kalle Exp $ */ #include "FormCitationDialogImpl.h" @@ -41,7 +41,7 @@ FormCitationDialogImpl::~FormCitationDialogImpl() } - +#if 0 // These slots correspond to the XForms input() method. void FormCitationDialogImpl::slotBibSelected( int sel ) { @@ -191,3 +191,4 @@ void FormCitationDialogImpl::close_adaptor() form_->close(); hide(); } +#endif diff --git a/src/frontends/qt2/FormDocumentDialog.ui b/src/frontends/qt2/FormDocumentDialog.ui index d611ef8253..7c4d4018d4 100644 --- a/src/frontends/qt2/FormDocumentDialog.ui +++ b/src/frontends/qt2/FormDocumentDialog.ui @@ -50,11 +50,11 @@ margin - 11 + -1 spacing - 6 + -1 QLayoutWidget @@ -3724,7 +3724,7 @@ QToolButton name - bulletPanelDing4PB + bulletDing4PB geometry @@ -4100,7 +4100,7 @@ QLineEdit name - bulletLatexED + latexED maxLength @@ -4698,7 +4698,7 @@ slotClose() - bulletLatexED + latexED textChanged(const QString&) FormDocumentDialog slotBulletLaTeX(const QString&) @@ -4734,7 +4734,7 @@ slotBulletDing3() - bulletPanelDing4PB + bulletDing4PB clicked() FormDocumentDialog slotBulletDing4() @@ -4868,7 +4868,7 @@ postscriptDriverCO useAmsMathCB bulletSizeCO - bulletLatexED + latexED restorePB okPB applyPB diff --git a/src/frontends/qt2/qt2BC.C b/src/frontends/qt2/qt2BC.C index 270fc28ae1..834c269905 100644 --- a/src/frontends/qt2/qt2BC.C +++ b/src/frontends/qt2/qt2BC.C @@ -57,7 +57,7 @@ void qt2BC::refresh() bool enable = true; if (bp().isReadOnly()) enable = false; - for (std::list::iterator iter = read_only_.begin(); + for (std::list::iterator iter = read_only_.begin(); iter != read_only_.end(); ++iter) { (*iter)->setEnabled( enable ); } diff --git a/src/frontends/qt2/qt2BC.h b/src/frontends/qt2/qt2BC.h index d70f51f6f7..d2dec836e3 100644 --- a/src/frontends/qt2/qt2BC.h +++ b/src/frontends/qt2/qt2BC.h @@ -25,6 +25,7 @@ #pragma interface #endif +class QWidget; class QButton; #include "ButtonController.h" @@ -59,7 +60,7 @@ public: undo_all_ = obj; } /// - void addReadOnly(QButton * obj) { + void addReadOnly(QWidget * obj) { read_only_.push_front(obj); } /// @@ -81,7 +82,7 @@ private: /// QButton * undo_all_; /// List of items to be deactivated when in one of the read-only states - std::list read_only_; + std::list read_only_; }; #endif // XFORMSBC_H