patch from John Levon, fixes to kde

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1022 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2000-09-15 15:32:07 +00:00
parent 525c430bc7
commit b2b9fd9c89
12 changed files with 216 additions and 142 deletions

View File

@ -1,3 +1,24 @@
2000-09-15 John Levon <moz@compsoc.man.ac.uk>
* acconfig.h
* configure.in: remove unused KDE/GTKGUI define
* src/frontends/kde/FormRef.C
* src/frontends/kde/FormRef.h
* src/frontends/kde/formrefdialog.C
* src/frontends/kde/formrefdialog.h: double click will
go to reference, now it is possible to change a cross-ref
after the fact
* src/frontends/kde/FormToc.C
* src/frontends/kde/FormToc.h
* src/frontends/kde/formtocdialog.C
* src/frontends/kde/formtocdialog.h: add a depth
slider
* src/frontends/kde/Makefile.am: add QtLyXView.h
to the sources list
2000-09-15 Angus Leeming <a.leeming@ic.ac.uk> 2000-09-15 Angus Leeming <a.leeming@ic.ac.uk>
* src/frontends/kde/FormCitation.h: added some using directives. * src/frontends/kde/FormCitation.h: added some using directives.

View File

@ -40,11 +40,6 @@
e.g. <xpm.h> */ e.g. <xpm.h> */
#undef XPM_H_LOCATION #undef XPM_H_LOCATION
/* here are the defines for what Toolkit to use (default is XForms) */
#undef KDEGUI
#undef GTKGUI
#undef HAVE_LIBSM #undef HAVE_LIBSM
#undef USE_PSPELL #undef USE_PSPELL

View File

@ -168,8 +168,7 @@ case "$lyx_use_frontend" in
FRONTEND_GUILIB="\${top_builddir}/src/frontends/kde/libkde.la" FRONTEND_GUILIB="\${top_builddir}/src/frontends/kde/libkde.la"
FRONTEND_LDFLAGS="\$(QT_LDFLAGS) \$(KDE_LDFLAGS)" FRONTEND_LDFLAGS="\$(QT_LDFLAGS) \$(KDE_LDFLAGS)"
FRONTEND_INCLUDES="-I\${srcdir}/kde \$(QT_INCLUDES) \$(KDE_INCLUDES)" FRONTEND_INCLUDES="-I\${srcdir}/kde \$(QT_INCLUDES) \$(KDE_INCLUDES)"
FRONTEND_LIBS="\$(KDE_LIBS)" FRONTEND_LIBS="\$(KDE_LIBS)";;
AC_DEFINE(KDEGUI);;
xforms) xforms)
# for now don't set it for xforms as this is always entered # for now don't set it for xforms as this is always entered
FRONTEND="" FRONTEND=""
@ -183,8 +182,7 @@ case "$lyx_use_frontend" in
FRONTEND_GUILIB="\${top_builddir}/src/frontends/gnome/libgnome.la" FRONTEND_GUILIB="\${top_builddir}/src/frontends/gnome/libgnome.la"
FRONTEND_LDFLAGS="\$(GNOMEMM_LIBDIR)" FRONTEND_LDFLAGS="\$(GNOMEMM_LIBDIR)"
FRONTEND_INCLUDES="-I\${srcdir}/gnome \$(GNOMEMM_INCLUDEDIR) \$(GTKMM_CFLAGS)" FRONTEND_INCLUDES="-I\${srcdir}/gnome \$(GNOMEMM_INCLUDEDIR) \$(GTKMM_CFLAGS)"
FRONTEND_LIBS="\$(GNOMEMM_LIBS) \$(GTKMM_LIBS)" FRONTEND_LIBS="\$(GNOMEMM_LIBS) \$(GTKMM_LIBS)";;
AC_DEFINE(GTKGUI);;
*) *)
LYX_ERROR(Unknown frontend $lyx_use_frontend);; LYX_ERROR(Unknown frontend $lyx_use_frontend);;
esac esac

View File

@ -66,10 +66,15 @@ void FormRef::createRef(string const & arg)
void FormRef::select(const char *text) void FormRef::select(const char *text)
{ {
params.setContents(text); highlight(text);
lv_->getLyXFunc()->Dispatch(LFUN_REF_BACK); goto_ref();
gotowhere = GOTOREF; }
dialog_->buttonGoto->setText(_("&Goto reference"));
void FormRef::highlight(const char *text)
{
if (gotowhere==GOTOBACK)
goto_ref();
dialog_->buttonGoto->setEnabled(true); dialog_->buttonGoto->setEnabled(true);
if (!readonly) { if (!readonly) {
dialog_->type->setEnabled(true); dialog_->type->setEnabled(true);
@ -91,12 +96,12 @@ void FormRef::goto_ref()
{ {
switch (gotowhere) { switch (gotowhere) {
case GOTOREF: case GOTOREF:
lv_->getLyXFunc()->Dispatch(LFUN_REF_GOTO, params.getContents().c_str()); lv_->getLyXFunc()->Dispatch(LFUN_REF_GOTO, dialog_->reference->text());
gotowhere=GOTOBACK; gotowhere=GOTOBACK;
dialog_->buttonGoto->setText(_("&Go back")); dialog_->buttonGoto->setText(_("&Go back"));
break; break;
case GOTOBACK: case GOTOBACK:
lv_->getLyXFunc()->Dispatch(LFUN_REF_BACK, params.getContents().c_str()); lv_->getLyXFunc()->Dispatch(LFUN_REF_BACK);
gotowhere=GOTOREF; gotowhere=GOTOREF;
dialog_->buttonGoto->setText(_("&Goto reference")); dialog_->buttonGoto->setText(_("&Goto reference"));
break; break;
@ -105,8 +110,19 @@ void FormRef::goto_ref()
void FormRef::updateRefs() void FormRef::updateRefs()
{ {
// list will be re-done, should go back if necessary
if (gotowhere==GOTOBACK) {
lv_->getLyXFunc()->Dispatch(LFUN_REF_BACK);
gotowhere = GOTOREF;
dialog_->buttonGoto->setText(_("&Goto reference"));
}
dialog_->refs->setAutoUpdate(false); dialog_->refs->setAutoUpdate(false);
// need this because Qt will send a highlight() here for
// the first item inserted
string tmp(dialog_->reference->text());
for (vector< string >::const_iterator iter = refs.begin(); for (vector< string >::const_iterator iter = refs.begin();
iter != refs.end(); ++iter) { iter != refs.end(); ++iter) {
if (sort) if (sort)
@ -114,19 +130,34 @@ void FormRef::updateRefs()
else else
dialog_->refs->insertItem(iter->c_str()); dialog_->refs->insertItem(iter->c_str());
} }
dialog_->reference->setText(tmp.c_str());
for (unsigned int i = 0; i < dialog_->refs->count(); ++i) {
if (!strcmp(dialog_->reference->text(),dialog_->refs->text(i)))
dialog_->refs->setCurrentItem(i);
}
dialog_->refs->setAutoUpdate(true); dialog_->refs->setAutoUpdate(true);
dialog_->refs->update(); dialog_->refs->update();
} }
void FormRef::do_ref_update()
{
refs.clear();
dialog_->refs->clear();
refs = lv_->buffer()->getLabelList();
if (!refs.empty())
dialog_->sort->setEnabled(true);
updateRefs();
}
void FormRef::update() void FormRef::update()
{ {
dialog_->reference->setText(params.getContents().c_str()); dialog_->reference->setText(params.getContents().c_str());
dialog_->refname->setText(params.getOptions().c_str()); dialog_->refname->setText(params.getOptions().c_str());
if (params.getCmdName()=="prettyref") { if (params.getCmdName()=="pageref") {
type = PRETTYREF;
dialog_->type->setCurrentItem(4);
} else if (params.getCmdName()=="pageref") {
type = PAGEREF; type = PAGEREF;
dialog_->type->setCurrentItem(1); dialog_->type->setCurrentItem(1);
} else if (params.getCmdName()=="vref") { } else if (params.getCmdName()=="vref") {
@ -135,6 +166,9 @@ void FormRef::update()
} else if (params.getCmdName()=="vpageref") { } else if (params.getCmdName()=="vpageref") {
type = VPAGEREF; type = VPAGEREF;
dialog_->type->setCurrentItem(3); dialog_->type->setCurrentItem(3);
} else if (params.getCmdName()=="prettyref") {
type = PRETTYREF;
dialog_->type->setCurrentItem(4);
} else { } else {
type = REF; type = REF;
dialog_->type->setCurrentItem(0); dialog_->type->setCurrentItem(0);
@ -146,46 +180,20 @@ void FormRef::update()
dialog_->sort->setChecked(sort); dialog_->sort->setChecked(sort);
dialog_->refs->clear(); do_ref_update();
dialog_->type->setEnabled(false);
if (inset_) {
// FIXME: should totally remove and re-size dialog,
// but doesn't seem easily possible
dialog_->refs->hide();
dialog_->labelrefs->hide();
dialog_->sort->hide();
dialog_->buttonUpdate->hide();
dialog_->buttonGoto->setEnabled(true);
} else {
dialog_->refs->show();
dialog_->labelrefs->show();
dialog_->sort->show();
dialog_->buttonUpdate->show();
refs = lv_->buffer()->getLabelList();
if (!refs.empty())
dialog_->sort->setEnabled(true);
updateRefs();
}
if (params.getContents()=="") {
dialog_->buttonGoto->setEnabled(false);
dialog_->buttonOk->setEnabled(false);
} else {
dialog_->buttonGoto->setEnabled(true);
dialog_->buttonOk->setEnabled(true);
}
if (readonly) { dialog_->buttonGoto->setEnabled(params.getContents()!="");
dialog_->type->setEnabled(false); dialog_->buttonOk->setEnabled(params.getContents()!="");
dialog_->buttonOk->setEnabled(false);
dialog_->buttonUpdate->setEnabled(false); dialog_->type->setEnabled(!readonly);
dialog_->sort->setEnabled(!readonly);
dialog_->refs->setEnabled(!readonly);
dialog_->buttonOk->setEnabled(!readonly);
dialog_->buttonUpdate->setEnabled(!readonly);
if (readonly)
dialog_->buttonCancel->setText(_("&Close")); dialog_->buttonCancel->setText(_("&Close"));
} else { else
dialog_->type->setEnabled(true);
dialog_->buttonUpdate->setEnabled(true);
dialog_->buttonCancel->setText(_("&Cancel")); dialog_->buttonCancel->setText(_("&Cancel"));
}
} }
void FormRef::apply() void FormRef::apply()
@ -216,6 +224,7 @@ void FormRef::apply()
lyxerr[Debug::GUI] << "Unknown Ref Type" << endl; lyxerr[Debug::GUI] << "Unknown Ref Type" << endl;
} }
params.setContents(dialog_->reference->text());
params.setOptions(dialog_->refname->text()); params.setOptions(dialog_->refname->text());
if (inset_ != 0) { if (inset_ != 0) {

View File

@ -34,14 +34,18 @@ public:
~FormRef(); ~FormRef();
//@} //@}
/// select a ref /// double-click a ref
void select(const char *); void select(const char *);
/// highlight a ref
void highlight(const char *);
/// set sort /// set sort
void set_sort(bool); void set_sort(bool);
/// goto a ref (or back) /// goto a ref (or back)
void goto_ref(); void goto_ref();
/// update dialog /// update dialog
void update(); void update();
/// update just the refs
void do_ref_update();
/// Apply changes /// Apply changes
void apply(); void apply();
/// close the connections /// close the connections

View File

@ -3,7 +3,7 @@
* (C) 2000 LyX Team * (C) 2000 LyX Team
* John Levon, moz@compsoc.man.ac.uk * John Levon, moz@compsoc.man.ac.uk
*/ */
/*************************************************************************** /***************************************************************************
* * * *
* This program is free software; you can redistribute it and/or modify * * This program is free software; you can redistribute it and/or modify *
@ -16,25 +16,25 @@
#include <config.h> #include <config.h>
#include <stack> #include <stack>
#include "formtocdialog.h" #include "formtocdialog.h"
#include "Dialogs.h" #include "Dialogs.h"
#include "FormToc.h" #include "FormToc.h"
#include "gettext.h" #include "gettext.h"
#include "buffer.h" #include "buffer.h"
#include "support/lstrings.h" #include "support/lstrings.h"
#include "QtLyXView.h" #include "QtLyXView.h"
#include "lyxfunc.h" #include "lyxfunc.h"
#include "debug.h" #include "debug.h"
using std::vector; using std::vector;
using std::pair; using std::pair;
using std::stack; using std::stack;
FormToc::FormToc(LyXView *v, Dialogs *d) FormToc::FormToc(LyXView *v, Dialogs *d)
: dialog_(0), lv_(v), d_(d), inset_(0), h_(0), u_(0), ih_(0), : dialog_(0), lv_(v), d_(d), inset_(0), h_(0), u_(0), ih_(0),
toclist(0), type(Buffer::TOC_TOC) toclist(0), type(Buffer::TOC_TOC), depth(1)
{ {
// let the dialog be shown // let the dialog be shown
// This is a permanent connection so we won't bother // This is a permanent connection so we won't bother
@ -60,17 +60,17 @@ void FormToc::showTOC(InsetCommand * const inset)
show(); show();
} }
void FormToc::createTOC(string const & arg) void FormToc::createTOC(string const & arg)
{ {
if (inset_) if (inset_)
close(); close();
params.setFromString(arg); params.setFromString(arg);
show(); show();
} }
void FormToc::updateToc() void FormToc::updateToc(int newdepth)
{ {
if (!lv_->view()->available()) { if (!lv_->view()->available()) {
toclist.clear(); toclist.clear();
@ -82,49 +82,53 @@ void FormToc::updateToc()
lv_->view()->buffer()->getTocList(); lv_->view()->buffer()->getTocList();
// Check if all elements are the same. // Check if all elements are the same.
if (toclist.size() == tmp[type].size()) { if (newdepth==depth && toclist.size() == tmp[type].size()) {
unsigned int i = 0; unsigned int i = 0;
for (; i < toclist.size(); ++i) { for (; i < toclist.size(); ++i) {
if (toclist[i] != tmp[type][i]) if (toclist[i] != tmp[type][i])
break; break;
} }
if (i >= toclist.size()) if (i >= toclist.size())
return; return;
} }
depth=newdepth;
toclist = tmp[type]; toclist = tmp[type];
dialog_->tree->clear(); dialog_->tree->clear();
if (toclist.empty())
return;
dialog_->tree->setUpdatesEnabled(false); dialog_->tree->setUpdatesEnabled(false);
int depth = 0; int curdepth = 0;
stack< pair< QListViewItem *, QListViewItem *> > istack; stack< pair< QListViewItem *, QListViewItem *> > istack;
QListViewItem *last = 0; QListViewItem *last = 0;
QListViewItem *parent = 0; QListViewItem *parent = 0;
QListViewItem *item; QListViewItem *item;
// Yes, it is this ugly. Two reasons - root items must have a QListView parent, // Yes, it is this ugly. Two reasons - root items must have a QListView parent,
// rather than QListViewItem; and the TOC can move in and out an arbitrary number // rather than QListViewItem; and the TOC can move in and out an arbitrary number
// of levels // of levels
for (vector< Buffer::TocItem >::const_iterator iter = toclist.begin(); for (vector< Buffer::TocItem >::const_iterator iter = toclist.begin();
iter != toclist.end(); ++iter) { iter != toclist.end(); ++iter) {
if (iter->depth == depth) { if (iter->depth == curdepth) {
// insert it after the last one we processed // insert it after the last one we processed
if (!parent) if (!parent)
item = (last) ? (new QListViewItem(dialog_->tree,last)) : (new QListViewItem(dialog_->tree)); item = (last) ? (new QListViewItem(dialog_->tree,last)) : (new QListViewItem(dialog_->tree));
else else
item = (last) ? (new QListViewItem(parent,last)) : (new QListViewItem(parent)); item = (last) ? (new QListViewItem(parent,last)) : (new QListViewItem(parent));
} else if (iter->depth > depth) { } else if (iter->depth > curdepth) {
int diff = iter->depth - depth; int diff = iter->depth - curdepth;
// first save old parent and last // first save old parent and last
while (diff--) while (diff--)
istack.push(pair< QListViewItem *, QListViewItem * >(parent,last)); istack.push(pair< QListViewItem *, QListViewItem * >(parent,last));
item = (last) ? (new QListViewItem(last)) : (new QListViewItem(dialog_->tree)); item = (last) ? (new QListViewItem(last)) : (new QListViewItem(dialog_->tree));
parent = last; parent = last;
} else { } else {
int diff = depth - iter->depth; int diff = curdepth - iter->depth;
pair< QListViewItem *, QListViewItem * > top; pair< QListViewItem *, QListViewItem * > top;
// restore context // restore context
while (diff--) { while (diff--) {
@ -139,65 +143,76 @@ void FormToc::updateToc()
else else
item = (last) ? (new QListViewItem(parent,last)) : (new QListViewItem(parent)); item = (last) ? (new QListViewItem(parent,last)) : (new QListViewItem(parent));
} }
lyxerr[Debug::GUI] << "Table of contents" << endl << "Added item " << iter->str.c_str() lyxerr[Debug::GUI] << "Table of contents" << endl << "Added item " << iter->str.c_str()
<< " at depth " << iter->depth << ", previous sibling \"" << (last ? last->text(0) : "0") << " at depth " << iter->depth << ", previous sibling \"" << (last ? last->text(0) : "0")
<< "\", parent \"" << (parent ? parent->text(0) : "0") << "\"" << endl; << "\", parent \"" << (parent ? parent->text(0) : "0") << "\"" << endl;
item->setText(0,iter->str.c_str()); item->setText(0,iter->str.c_str());
depth = iter->depth; item->setOpen(iter->depth < depth);
curdepth = iter->depth;
last = item; last = item;
} }
dialog_->tree->setUpdatesEnabled(true); dialog_->tree->setUpdatesEnabled(true);
dialog_->tree->update(); dialog_->tree->update();
} }
void FormToc::setType(Buffer::TocType toctype) void FormToc::setType(Buffer::TocType toctype)
{ {
type = toctype; type = toctype;
switch (type) { switch (type) {
case Buffer::TOC_TOC: case Buffer::TOC_TOC:
dialog_->setCaption(_("Table of Contents")); dialog_->setCaption(_("Table of Contents"));
dialog_->tree->setColumnText(0,_("Table of Contents")); dialog_->tree->setColumnText(0,_("Table of Contents"));
break; dialog_->depth->setEnabled(true);
break;
case Buffer::TOC_LOF: case Buffer::TOC_LOF:
dialog_->setCaption(_("List of Figures")); dialog_->setCaption(_("List of Figures"));
dialog_->tree->setColumnText(0,_("List of Figures")); dialog_->tree->setColumnText(0,_("List of Figures"));
break; dialog_->depth->setEnabled(false);
break;
case Buffer::TOC_LOT: case Buffer::TOC_LOT:
dialog_->setCaption(_("List of Tables")); dialog_->setCaption(_("List of Tables"));
dialog_->tree->setColumnText(0,_("List of Tables")); dialog_->tree->setColumnText(0,_("List of Tables"));
break; dialog_->depth->setEnabled(false);
break;
case Buffer::TOC_LOA: case Buffer::TOC_LOA:
dialog_->setCaption(_("List of Algorithms")); dialog_->setCaption(_("List of Algorithms"));
dialog_->tree->setColumnText(0,_("List of Algorithms")); dialog_->tree->setColumnText(0,_("List of Algorithms"));
break; dialog_->depth->setEnabled(false);
break;
} }
} }
void FormToc::set_depth(int newdepth)
{
if (newdepth!=depth)
updateToc(newdepth);
}
void FormToc::update() void FormToc::update()
{ {
if (params.getCmdName()=="tableofcontents") { if (params.getCmdName()=="tableofcontents") {
setType(Buffer::TOC_TOC); setType(Buffer::TOC_TOC);
dialog_->menu->setCurrentItem(0); dialog_->menu->setCurrentItem(0);
} else if (params.getCmdName()=="listoffigures") { } else if (params.getCmdName()=="listoffigures") {
setType(Buffer::TOC_LOF); setType(Buffer::TOC_LOF);
dialog_->menu->setCurrentItem(1); dialog_->menu->setCurrentItem(1);
} else if (params.getCmdName()=="listoftables") { } else if (params.getCmdName()=="listoftables") {
setType(Buffer::TOC_LOT); setType(Buffer::TOC_LOT);
dialog_->menu->setCurrentItem(2); dialog_->menu->setCurrentItem(2);
} else { } else {
setType(Buffer::TOC_LOA); setType(Buffer::TOC_LOA);
dialog_->menu->setCurrentItem(3); dialog_->menu->setCurrentItem(3);
} }
updateToc(); updateToc(depth);
} }
void FormToc::select(const char *text) void FormToc::select(const char *text)
{ {
if (!lv_->view()->available()) if (!lv_->view()->available())
return; return;
vector <Buffer::TocItem>::const_iterator iter = toclist.begin(); vector <Buffer::TocItem>::const_iterator iter = toclist.begin();
for (; iter != toclist.end(); ++iter) { for (; iter != toclist.end(); ++iter) {
if (iter->str==text) if (iter->str==text)
@ -211,21 +226,21 @@ void FormToc::select(const char *text)
lv_->getLyXFunc()->Dispatch(LFUN_GOTO_PARAGRAPH, tostr(iter->par->id()).c_str()); lv_->getLyXFunc()->Dispatch(LFUN_GOTO_PARAGRAPH, tostr(iter->par->id()).c_str());
} }
void FormToc::set_type(Buffer::TocType toctype) void FormToc::set_type(Buffer::TocType toctype)
{ {
if (toctype==type) if (toctype==type)
return; return;
setType(toctype); setType(toctype);
updateToc(); updateToc(depth);
} }
void FormToc::show() void FormToc::show()
{ {
if (!dialog_) if (!dialog_)
dialog_ = new FormTocDialog(this, 0, _("LyX: Table of Contents"), false); dialog_ = new FormTocDialog(this, 0, _("LyX: Table of Contents"), false);
if (!dialog_->isVisible()) { if (!dialog_->isVisible()) {
h_ = d_->hideBufferDependent.connect(slot(this, &FormToc::hide)); h_ = d_->hideBufferDependent.connect(slot(this, &FormToc::hide));
u_ = d_->updateBufferDependent.connect(slot(this, &FormToc::update)); u_ = d_->updateBufferDependent.connect(slot(this, &FormToc::update));
@ -233,7 +248,7 @@ void FormToc::show()
dialog_->raise(); dialog_->raise();
dialog_->setActiveWindow(); dialog_->setActiveWindow();
update(); update();
dialog_->show(); dialog_->show();
} }
@ -245,7 +260,7 @@ void FormToc::close()
ih_.disconnect(); ih_.disconnect();
inset_ = 0; inset_ = 0;
} }
void FormToc::hide() void FormToc::hide()
{ {
dialog_->hide(); dialog_->hide();

View File

@ -18,19 +18,19 @@
#include "DialogBase.h" #include "DialogBase.h"
#include "LString.h" #include "LString.h"
#include "support/utility.hpp" #include "support/utility.hpp"
#include "insets/insetcommand.h" #include "insets/insetcommand.h"
#include "buffer.h" #include "buffer.h"
class Dialogs; class Dialogs;
class FormTocDialog; class FormTocDialog;
class FormToc : public DialogBase, public noncopyable { class FormToc : public DialogBase, public noncopyable {
public: public:
/**@name Constructors and Destructors */ /**@name Constructors and Destructors */
//@{ //@{
/// ///
FormToc(LyXView *, Dialogs *); FormToc(LyXView *, Dialogs *);
/// ///
~FormToc(); ~FormToc();
//@} //@}
@ -40,10 +40,12 @@ public:
void set_type(Buffer::TocType); void set_type(Buffer::TocType);
/// Update the dialog. /// Update the dialog.
void update(); void update();
/// change the depth shown
void set_depth(int);
/// close the connections /// close the connections
void close(); void close();
private: private:
/// Create the dialog if necessary, update it and display it. /// Create the dialog if necessary, update it and display it.
void show(); void show();
/// Hide the dialog. /// Hide the dialog.
@ -53,21 +55,19 @@ private:
void createTOC(string const &); void createTOC(string const &);
/// view a Toc inset /// view a Toc inset
void showTOC(InsetCommand * const); void showTOC(InsetCommand * const);
/// hierarchical tree
int doTree(vector < Buffer::TocItem>::const_iterator & , int, int, int);
/// update the Toc /// update the Toc
void updateToc(void); void updateToc(int);
/// set the type /// set the type
void setType(Buffer::TocType); void setType(Buffer::TocType);
/// Real GUI implementation. /// Real GUI implementation.
FormTocDialog * dialog_; FormTocDialog * dialog_;
/// the LyXView we belong to /// the LyXView we belong to
LyXView * lv_; LyXView * lv_;
/** Which Dialogs do we belong to? /** Which Dialogs do we belong to?
Used so we can get at the signals we have to connect to. Used so we can get at the signals we have to connect to.
*/ */
@ -89,6 +89,9 @@ private:
/// type currently being shown /// type currently being shown
Buffer::TocType type; Buffer::TocType type;
/// depth of list shown
int depth;
}; };
#endif #endif

View File

@ -39,6 +39,7 @@ ETAGS_ARGS = --lang=c++
libkde_la_SOURCES = \ libkde_la_SOURCES = \
Dialogs.C \ Dialogs.C \
GUIRunTime.C \ GUIRunTime.C \
QtLyXView.h \
FormCopyright.C \ FormCopyright.C \
FormCopyright.h \ FormCopyright.h \
formcopyrightdialog.C \ formcopyrightdialog.C \

View File

@ -156,6 +156,7 @@ FormRefDialog::FormRefDialog(FormRef *form, QWidget *parent, const char *name, b
// connections // connections
connect(refs, SIGNAL(highlighted(const char *)), this, SLOT(highlight_adaptor(const char *))); connect(refs, SIGNAL(highlighted(const char *)), this, SLOT(highlight_adaptor(const char *)));
connect(refs, SIGNAL(selected(const char *)), this, SLOT(select_adaptor(const char *)));
connect(sort, SIGNAL(toggled(bool)), this, SLOT(sort_adaptor(bool))); connect(sort, SIGNAL(toggled(bool)), this, SLOT(sort_adaptor(bool)));
connect(buttonOk, SIGNAL(clicked()), this, SLOT(apply_adaptor())); connect(buttonOk, SIGNAL(clicked()), this, SLOT(apply_adaptor()));
connect(buttonUpdate, SIGNAL(clicked()), this, SLOT(update_adaptor())); connect(buttonUpdate, SIGNAL(clicked()), this, SLOT(update_adaptor()));

View File

@ -73,8 +73,13 @@ private:
private slots: private slots:
/// adaptor to FormRef::select /// adaptor to FormRef::select
void select_adaptor(const char *sel) {
form_->select(sel);
}
/// adaptor to FormRef::highlight
void highlight_adaptor(const char *sel) { void highlight_adaptor(const char *sel) {
form_->select(sel); form_->highlight(sel);
} }
/// adaptor to FormRef::set_sort /// adaptor to FormRef::set_sort
@ -89,7 +94,7 @@ private slots:
/// adaptor to FormRef::update /// adaptor to FormRef::update
void update_adaptor(void) { void update_adaptor(void) {
form_->update(); form_->do_ref_update();
} }
/// adaptor to FormRef::apply /// adaptor to FormRef::apply

View File

@ -28,12 +28,12 @@ FormTocDialog::FormTocDialog(FormToc *form, QWidget *parent, const char *name, b
menu->insertItem(_("List of Figures")); menu->insertItem(_("List of Figures"));
menu->insertItem(_("List of Tables")); menu->insertItem(_("List of Tables"));
menu->insertItem(_("List of Algorithms")); menu->insertItem(_("List of Algorithms"));
menu->setMinimumSize(menu->sizeHint()); menu->setMinimumSize(menu->sizeHint());
tree = new QListView(this); tree = new QListView(this);
tree->setMinimumHeight(200); tree->setMinimumHeight(200);
tree->setRootIsDecorated(true); tree->setRootIsDecorated(true);
tree->setSorting(-1); tree->setSorting(-1);
tree->addColumn("Table of Contents"); tree->addColumn("Table of Contents");
buttonUpdate = new QPushButton(this); buttonUpdate = new QPushButton(this);
@ -47,8 +47,18 @@ FormTocDialog::FormTocDialog(FormToc *form, QWidget *parent, const char *name, b
buttonClose->setText(_("&Close")); buttonClose->setText(_("&Close"));
buttonClose->setDefault(true); buttonClose->setDefault(true);
// layouts depth = new QSlider(0, 5, 1, 1, QSlider::Horizontal, this);
depth->setMinimumSize(depth->sizeHint());
depth->setTickInterval(1);
depth->setTracking(true);
depthlabel = new QLabel(this);
depthlabel->setText(_("Depth"));
depthlabel->setMinimumSize(depthlabel->sizeHint());
depthlabel->setMaximumSize(depthlabel->sizeHint());
// layouts
topLayout = new QHBoxLayout(this,10); topLayout = new QHBoxLayout(this,10);
layout = new QVBoxLayout(); layout = new QVBoxLayout();
@ -57,6 +67,8 @@ FormTocDialog::FormTocDialog(FormToc *form, QWidget *parent, const char *name, b
layout->addWidget(menu,0); layout->addWidget(menu,0);
layout->addWidget(tree,1); layout->addWidget(tree,1);
layout->addWidget(depthlabel,0,AlignLeft);
layout->addWidget(depth,0);
buttonLayout = new QHBoxLayout(); buttonLayout = new QHBoxLayout();
@ -70,9 +82,10 @@ FormTocDialog::FormTocDialog(FormToc *form, QWidget *parent, const char *name, b
// connections // connections
connect(tree, SIGNAL(selectionChanged(QListViewItem *)), this, SLOT(select_adaptor(QListViewItem *))); connect(tree, SIGNAL(selectionChanged(QListViewItem *)), this, SLOT(select_adaptor(QListViewItem *)));
connect(menu, SIGNAL(activated(int)), this, SLOT(activate_adaptor(int))); connect(menu, SIGNAL(activated(int)), this, SLOT(activate_adaptor(int)));
connect(buttonUpdate, SIGNAL(clicked()), this, SLOT(update_adaptor())); connect(buttonUpdate, SIGNAL(clicked()), this, SLOT(update_adaptor()));
connect(buttonClose, SIGNAL(clicked()), this, SLOT(close_adaptor())); connect(buttonClose, SIGNAL(clicked()), this, SLOT(close_adaptor()));
connect(depth, SIGNAL(valueChanged(int)), this, SLOT(depth_adaptor(int)));
} }
void FormTocDialog::closeEvent(QCloseEvent *e) void FormTocDialog::closeEvent(QCloseEvent *e)

View File

@ -19,13 +19,15 @@
#include <config.h> #include <config.h>
#include <gettext.h> #include <gettext.h>
#include <debug.h> #include <debug.h>
#include <qlabel.h>
#include <qdialog.h> #include <qdialog.h>
#include <qlayout.h> #include <qlayout.h>
#include <qpushbutton.h> #include <qpushbutton.h>
#include <qcombobox.h> #include <qcombobox.h>
#include <qlistview.h> #include <qlistview.h>
#include <qslider.h>
#include "FormToc.h" #include "FormToc.h"
class FormTocDialog : public QDialog { class FormTocDialog : public QDialog {
@ -36,48 +38,55 @@ public:
~FormTocDialog(); ~FormTocDialog();
// widgets // widgets
QComboBox *menu; QComboBox *menu;
QListView *tree; QListView *tree;
QPushButton *buttonUpdate; QPushButton *buttonUpdate;
QPushButton *buttonClose; QPushButton *buttonClose;
QSlider *depth;
QLabel *depthlabel;
protected: protected:
void closeEvent(QCloseEvent *e); void closeEvent(QCloseEvent *e);
private: private:
FormToc *form_; FormToc *form_;
// layouts // layouts
QHBoxLayout *topLayout; QHBoxLayout *topLayout;
QVBoxLayout *layout; QVBoxLayout *layout;
QHBoxLayout *buttonLayout; QHBoxLayout *buttonLayout;
private slots: private slots:
/// adaptor to FormToc::select /// adaptor to FormToc::select
void select_adaptor(QListViewItem *item) { void select_adaptor(QListViewItem *item) {
form_->select(item->text(0)); form_->select(item->text(0));
} }
/// adaptor to FormToc::set_depth
void depth_adaptor(int depth) {
form_->set_depth(depth);
}
/// adaptor to FormToc::update /// adaptor to FormToc::update
void update_adaptor(void) { void update_adaptor(void) {
form_->update(); form_->update();
} }
// adaptors to FormToc::set_type // adaptors to FormToc::set_type
void activate_adaptor(int index) { void activate_adaptor(int index) {
switch (index) { switch (index) {
case 0: case 0:
form_->set_type(Buffer::TOC_TOC); form_->set_type(Buffer::TOC_TOC);
break; break;
case 1: case 1:
form_->set_type(Buffer::TOC_LOF); form_->set_type(Buffer::TOC_LOF);
break; break;
case 2: case 2:
form_->set_type(Buffer::TOC_LOT); form_->set_type(Buffer::TOC_LOT);
break; break;
case 3: case 3:
form_->set_type(Buffer::TOC_LOA); form_->set_type(Buffer::TOC_LOA);
break; break;
default: default:
@ -85,7 +94,7 @@ private slots:
break; break;
} }
} }
/// adaptor to FormToc::close /// adaptor to FormToc::close
void close_adaptor(void) { void close_adaptor(void) {
form_->close(); form_->close();