]> git.lyx.org Git - features.git/commitdiff
patch from John Levon, fixes to kde
authorLars Gullik Bjønnes <larsbj@gullik.org>
Fri, 15 Sep 2000 15:32:07 +0000 (15:32 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Fri, 15 Sep 2000 15:32:07 +0000 (15:32 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1022 a592a061-630c-0410-9148-cb99ea01b6c8

12 files changed:
ChangeLog
acconfig.h
configure.in
src/frontends/kde/FormRef.C
src/frontends/kde/FormRef.h
src/frontends/kde/FormToc.C
src/frontends/kde/FormToc.h
src/frontends/kde/Makefile.am
src/frontends/kde/formrefdialog.C
src/frontends/kde/formrefdialog.h
src/frontends/kde/formtocdialog.C
src/frontends/kde/formtocdialog.h

index bb0ffe22ccb2c5abaab8bf098811ff0d866e13be..350a1ebe9b02b86181dbc7c7e6cbe8b7ea9d4759 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
 
        * src/frontends/kde/FormCitation.h: added some using directives.
index 46d8c9af5d1e7b89403c2b253f3cf41556486967..217db1b9645e91d412dc940220311dda789f6ff8 100644 (file)
   e.g. <xpm.h> */
 #undef XPM_H_LOCATION
 
-/* here are the defines for what Toolkit to use (default is XForms) */
-#undef KDEGUI
-
-#undef GTKGUI
-
 #undef HAVE_LIBSM
 
 #undef USE_PSPELL
index e46c4475436d10a56137adf058431ee39c2e9ec2..e8aecb2a1503d92d2039c3ed2a924aca4191c060 100644 (file)
@@ -168,8 +168,7 @@ case "$lyx_use_frontend" in
     FRONTEND_GUILIB="\${top_builddir}/src/frontends/kde/libkde.la"
     FRONTEND_LDFLAGS="\$(QT_LDFLAGS) \$(KDE_LDFLAGS)"
     FRONTEND_INCLUDES="-I\${srcdir}/kde \$(QT_INCLUDES) \$(KDE_INCLUDES)"
-    FRONTEND_LIBS="\$(KDE_LIBS)"
-    AC_DEFINE(KDEGUI);;
+    FRONTEND_LIBS="\$(KDE_LIBS)";;
   xforms) 
   # for now don't set it for xforms as this is always entered
     FRONTEND=""
@@ -183,8 +182,7 @@ case "$lyx_use_frontend" in
     FRONTEND_GUILIB="\${top_builddir}/src/frontends/gnome/libgnome.la"
     FRONTEND_LDFLAGS="\$(GNOMEMM_LIBDIR)"
     FRONTEND_INCLUDES="-I\${srcdir}/gnome \$(GNOMEMM_INCLUDEDIR) \$(GTKMM_CFLAGS)"
-    FRONTEND_LIBS="\$(GNOMEMM_LIBS) \$(GTKMM_LIBS)"
-    AC_DEFINE(GTKGUI);;
+    FRONTEND_LIBS="\$(GNOMEMM_LIBS) \$(GTKMM_LIBS)";;
   *)
     LYX_ERROR(Unknown frontend $lyx_use_frontend);;
 esac
index 54cc417fba6cb6ca6058ec0bdd5ca8beed3cd0eb..0b49bec03684a5fef2d2305f2c55b7166cc7c22d 100644 (file)
@@ -66,10 +66,15 @@ void FormRef::createRef(string const & arg)
 
 void FormRef::select(const char *text)
 {
-       params.setContents(text);
-       lv_->getLyXFunc()->Dispatch(LFUN_REF_BACK);
-       gotowhere = GOTOREF;
-       dialog_->buttonGoto->setText(_("&Goto reference"));
+       highlight(text);
+       goto_ref();
+}
+
+void FormRef::highlight(const char *text)
+{
+       if (gotowhere==GOTOBACK)
+               goto_ref();
+
        dialog_->buttonGoto->setEnabled(true);
        if (!readonly) {
                dialog_->type->setEnabled(true);
@@ -91,12 +96,12 @@ void FormRef::goto_ref()
 {
        switch (gotowhere) {
                case GOTOREF:
-                       lv_->getLyXFunc()->Dispatch(LFUN_REF_GOTO, params.getContents().c_str());
+                       lv_->getLyXFunc()->Dispatch(LFUN_REF_GOTO, dialog_->reference->text());
                        gotowhere=GOTOBACK;
                        dialog_->buttonGoto->setText(_("&Go back"));
                        break;
                case GOTOBACK:
-                       lv_->getLyXFunc()->Dispatch(LFUN_REF_BACK, params.getContents().c_str());
+                       lv_->getLyXFunc()->Dispatch(LFUN_REF_BACK);
                        gotowhere=GOTOREF;
                        dialog_->buttonGoto->setText(_("&Goto reference"));
                        break;
@@ -105,8 +110,19 @@ void FormRef::goto_ref()
 
 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);
+
+       // 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();
                iter != refs.end(); ++iter) {
                if (sort)
@@ -114,19 +130,34 @@ void FormRef::updateRefs()
                else
                        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->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()
 {
        dialog_->reference->setText(params.getContents().c_str());
        dialog_->refname->setText(params.getOptions().c_str());
 
-       if (params.getCmdName()=="prettyref") {
-               type = PRETTYREF;
-               dialog_->type->setCurrentItem(4);
-       } else if (params.getCmdName()=="pageref") {
+       if (params.getCmdName()=="pageref") {
                type = PAGEREF;
                dialog_->type->setCurrentItem(1);
        } else if (params.getCmdName()=="vref") {
@@ -135,6 +166,9 @@ void FormRef::update()
        } else if (params.getCmdName()=="vpageref") {
                type = VPAGEREF;
                dialog_->type->setCurrentItem(3);
+       } else if (params.getCmdName()=="prettyref") {
+               type = PRETTYREF;
+               dialog_->type->setCurrentItem(4);
        } else {
                type = REF;
                dialog_->type->setCurrentItem(0);
@@ -146,46 +180,20 @@ void FormRef::update()
 
        dialog_->sort->setChecked(sort);
 
-       dialog_->refs->clear();
-       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);
-       }
+       do_ref_update();
+
+       dialog_->buttonGoto->setEnabled(params.getContents()!="");
+       dialog_->buttonOk->setEnabled(params.getContents()!="");
 
-       if (readonly) {
-               dialog_->type->setEnabled(false);
-               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"));
-       } else {
-               dialog_->type->setEnabled(true);
-               dialog_->buttonUpdate->setEnabled(true);
+       else
                dialog_->buttonCancel->setText(_("&Cancel"));
-       }
 }
 
 void FormRef::apply()
@@ -216,6 +224,7 @@ void FormRef::apply()
                        lyxerr[Debug::GUI] << "Unknown Ref Type" << endl;
        }
 
+       params.setContents(dialog_->reference->text());
        params.setOptions(dialog_->refname->text());
 
        if (inset_ != 0) {
index 4c01b63212dd1ffa537f26e6dcaf32b5aabd690c..e3049b27c80ebaf7b16cf18075042fa2164fe778 100644 (file)
@@ -34,14 +34,18 @@ public:
        ~FormRef();
        //@}
 
-       /// select a ref
+       /// double-click a ref
        void select(const char *);
+       /// highlight a ref
+       void highlight(const char *);
        /// set sort
        void set_sort(bool);
        /// goto a ref (or back)
        void goto_ref(); 
        /// update dialog
        void update(); 
+       /// update just the refs
+       void do_ref_update();
        /// Apply changes
        void apply();
        /// close the connections
index 76ca0454195e045fa71d1f767cff6489cc0278cb..3b89858ccc7e6cf87002e20043b6b1f2324b3261 100644 (file)
@@ -3,7 +3,7 @@
  * (C) 2000 LyX Team
  * John Levon, moz@compsoc.man.ac.uk
  */
+
 /***************************************************************************
  *                                                                         *
  *   This program is free software; you can redistribute it and/or modify  *
 #include <config.h>
 
 #include <stack>
+
 #include "formtocdialog.h"
+
 #include "Dialogs.h"
 #include "FormToc.h"
 #include "gettext.h"
 #include "buffer.h"
 #include "support/lstrings.h"
 #include "QtLyXView.h"
-#include "lyxfunc.h" 
-#include "debug.h" 
+#include "lyxfunc.h"
+#include "debug.h"
 
 using std::vector;
 using std::pair;
 using std::stack;
+
 FormToc::FormToc(LyXView *v, Dialogs *d)
        : 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
        // This is a permanent connection so we won't bother
@@ -60,17 +60,17 @@ void FormToc::showTOC(InsetCommand * const inset)
        
        show();
 }
+
 void FormToc::createTOC(string const & arg)
 {
        if (inset_)
                close();
+
        params.setFromString(arg);
        show();
 }
-void FormToc::updateToc()
+
+void FormToc::updateToc(int newdepth)
 {
        if (!lv_->view()->available()) {
                toclist.clear();
@@ -82,49 +82,53 @@ void FormToc::updateToc()
                lv_->view()->buffer()->getTocList();
 
        // 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;
                for (; i < toclist.size(); ++i) {
                        if (toclist[i] !=  tmp[type][i])
                                break;
                }
-               if (i >= toclist.size()) 
+               if (i >= toclist.size())
                        return;
        }
+
+       depth=newdepth;
+
        toclist = tmp[type];
 
        dialog_->tree->clear();
+       if (toclist.empty()) 
+               return;
 
        dialog_->tree->setUpdatesEnabled(false);
 
-       int depth = 0; 
+       int curdepth = 0;
        stack< pair< QListViewItem *, QListViewItem *> > istack;
        QListViewItem *last = 0;
        QListViewItem *parent = 0;
        QListViewItem *item;
+
        // 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
        // of levels
+
        for (vector< Buffer::TocItem >::const_iterator iter = toclist.begin();
                iter != toclist.end(); ++iter) {
-               if (iter->depth == depth) {
+               if (iter->depth == curdepth) {
                        // insert it after the last one we processed
                        if (!parent)
                                item = (last) ? (new QListViewItem(dialog_->tree,last)) : (new QListViewItem(dialog_->tree));
                        else
                                item = (last) ? (new QListViewItem(parent,last)) : (new QListViewItem(parent));
-               } else if (iter->depth > depth) {
-                       int diff = iter->depth - depth;
+               } else if (iter->depth > curdepth) {
+                       int diff = iter->depth - curdepth;
                        // first save old parent and last
                        while (diff--)
                                istack.push(pair< QListViewItem *, QListViewItem * >(parent,last));
                        item = (last) ? (new QListViewItem(last)) : (new QListViewItem(dialog_->tree));
                        parent = last;
                } else {
-                       int diff = depth - iter->depth;
+                       int diff = curdepth - iter->depth;
                        pair< QListViewItem *, QListViewItem * > top;
                        // restore context
                        while (diff--) {
@@ -139,65 +143,76 @@ void FormToc::updateToc()
                        else
                                item = (last) ? (new QListViewItem(parent,last)) : (new QListViewItem(parent));
                }
-               lyxerr[Debug::GUI] << "Table of contents" << endl << "Added item " << iter->str.c_str() 
-                       << " at depth " << iter->depth << ", previous sibling \"" << (last ? last->text(0) : "0") 
+               lyxerr[Debug::GUI] << "Table of contents" << endl << "Added item " << iter->str.c_str()
+                       << " at depth " << iter->depth << ", previous sibling \"" << (last ? last->text(0) : "0")
                        << "\", parent \"" << (parent ? parent->text(0) : "0") << "\"" << endl;
                item->setText(0,iter->str.c_str());
-               depth = iter->depth;
+               item->setOpen(iter->depth < depth);
+               curdepth = iter->depth;
                last = item;
        }
 
        dialog_->tree->setUpdatesEnabled(true);
        dialog_->tree->update();
 }
+
 void FormToc::setType(Buffer::TocType toctype)
 {
        type = toctype;
        switch (type) {
                case Buffer::TOC_TOC:
                        dialog_->setCaption(_("Table of Contents"));
-                       dialog_->tree->setColumnText(0,_("Table of Contents")); 
-                       break; 
+                       dialog_->tree->setColumnText(0,_("Table of Contents"));
+                       dialog_->depth->setEnabled(true);
+                       break;
                case Buffer::TOC_LOF:
                        dialog_->setCaption(_("List of Figures"));
-                       dialog_->tree->setColumnText(0,_("List of Figures")); 
-                       break; 
+                       dialog_->tree->setColumnText(0,_("List of Figures"));
+                       dialog_->depth->setEnabled(false);
+                       break;
                case Buffer::TOC_LOT:
                        dialog_->setCaption(_("List of Tables"));
-                       dialog_->tree->setColumnText(0,_("List of Tables")); 
-                       break; 
+                       dialog_->tree->setColumnText(0,_("List of Tables"));
+                       dialog_->depth->setEnabled(false);
+                       break;
                case Buffer::TOC_LOA:
                        dialog_->setCaption(_("List of Algorithms"));
-                       dialog_->tree->setColumnText(0,_("List of Algorithms")); 
-                       break; 
+                       dialog_->tree->setColumnText(0,_("List of Algorithms"));
+                       dialog_->depth->setEnabled(false);
+                       break;
        }
 }
+
+void FormToc::set_depth(int newdepth)
+{
+       if (newdepth!=depth)
+               updateToc(newdepth);
+}
+
 void FormToc::update()
 {
        if (params.getCmdName()=="tableofcontents") {
                setType(Buffer::TOC_TOC);
                dialog_->menu->setCurrentItem(0);
        } else if (params.getCmdName()=="listoffigures") {
-               setType(Buffer::TOC_LOF); 
-               dialog_->menu->setCurrentItem(1); 
+               setType(Buffer::TOC_LOF);
+               dialog_->menu->setCurrentItem(1);
        } else if (params.getCmdName()=="listoftables") {
-               setType(Buffer::TOC_LOT); 
-               dialog_->menu->setCurrentItem(2); 
+               setType(Buffer::TOC_LOT);
+               dialog_->menu->setCurrentItem(2);
        } else {
-               setType(Buffer::TOC_LOA); 
-               dialog_->menu->setCurrentItem(3); 
-       } 
+               setType(Buffer::TOC_LOA);
+               dialog_->menu->setCurrentItem(3);
+       }
 
-       updateToc();
+       updateToc(depth);
 }
+
 void FormToc::select(const char *text)
 {
        if (!lv_->view()->available())
                return;
+
        vector <Buffer::TocItem>::const_iterator iter = toclist.begin();
        for (; iter != toclist.end(); ++iter) {
                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());
 }
+
 void FormToc::set_type(Buffer::TocType toctype)
 {
        if (toctype==type)
                return;
 
        setType(toctype);
-       updateToc();
+       updateToc(depth);
 }
+
 void FormToc::show()
 {
        if (!dialog_)
                dialog_ = new FormTocDialog(this, 0, _("LyX: Table of Contents"), false);
+
        if (!dialog_->isVisible()) {
                h_ = d_->hideBufferDependent.connect(slot(this, &FormToc::hide));
                u_ = d_->updateBufferDependent.connect(slot(this, &FormToc::update));
@@ -233,7 +248,7 @@ void FormToc::show()
 
        dialog_->raise();
        dialog_->setActiveWindow();
+
        update();
        dialog_->show();
 }
@@ -245,7 +260,7 @@ void FormToc::close()
        ih_.disconnect();
        inset_ = 0;
 }
+
 void FormToc::hide()
 {
        dialog_->hide();
index cdf878bbd8a5d7fea6360dc54d19508c54cfef03..69a143ab32b81fb594bf9010657ab620183f5c82 100644 (file)
 #include "DialogBase.h"
 #include "LString.h"
 #include "support/utility.hpp"
-#include "insets/insetcommand.h" 
-#include "buffer.h" 
+#include "insets/insetcommand.h"
+#include "buffer.h"
 
 class Dialogs;
 class FormTocDialog;
 
 class FormToc : public DialogBase, public noncopyable {
-public: 
+public:
        /**@name Constructors and Destructors */
        //@{
        ///
        FormToc(LyXView *, Dialogs *);
-       /// 
+       ///
        ~FormToc();
        //@}
 
@@ -40,10 +40,12 @@ public:
        void set_type(Buffer::TocType);
        /// Update the dialog.
        void update();
+       /// change the depth shown
+       void set_depth(int);
        /// close the connections
        void close();
-private: 
+
+private:
        /// Create the dialog if necessary, update it and display it.
        void show();
        /// Hide the dialog.
@@ -53,21 +55,19 @@ private:
        void createTOC(string const &);
        /// view a Toc inset
        void showTOC(InsetCommand * const);
-        
-       /// hierarchical tree
-       int doTree(vector < Buffer::TocItem>::const_iterator & , int, int, int);
+       
        /// update the Toc
-       void updateToc(void);
+       void updateToc(int);
 
        /// set the type
        void setType(Buffer::TocType);
+
        /// Real GUI implementation.
        FormTocDialog * 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.
        */
@@ -89,6 +89,9 @@ private:
 
        /// type currently being shown
        Buffer::TocType type;
+
+       /// depth of list shown
+       int depth;
 };
 
 #endif
index c98a3a331cdda12b5521806b9ac0d85babb0c3b2..69468ec15fb2387102321d8e303429e5db420750 100644 (file)
@@ -39,6 +39,7 @@ ETAGS_ARGS = --lang=c++
 libkde_la_SOURCES = \
        Dialogs.C \
        GUIRunTime.C \
+       QtLyXView.h \
        FormCopyright.C \
        FormCopyright.h \
        formcopyrightdialog.C \
index c3283602e2f6e991339aafc27abbc084dcd76cf4..ce154131a9c4dfd7e2b8eab863015539526f9a00 100644 (file)
@@ -156,6 +156,7 @@ FormRefDialog::FormRefDialog(FormRef *form, QWidget *parent, const char *name, b
        // connections
 
        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(buttonOk, SIGNAL(clicked()), this, SLOT(apply_adaptor()));
        connect(buttonUpdate, SIGNAL(clicked()), this, SLOT(update_adaptor()));
index d96d2267b0fb16675b3d8a09ad3f726143bdb579..7dac239d2bece0b9c82f27c0dc65cbc3ac14bf63 100644 (file)
@@ -73,8 +73,13 @@ private:
 
 private slots:
        /// adaptor to FormRef::select
+       void select_adaptor(const char *sel) {
+               form_->select(sel);
+       }
+
+       /// adaptor to FormRef::highlight
        void highlight_adaptor(const char *sel) {
-               form_->select(sel); 
+               form_->highlight(sel); 
        }
 
        /// adaptor to FormRef::set_sort
@@ -89,7 +94,7 @@ private slots:
  
        /// adaptor to FormRef::update
        void update_adaptor(void) {
-               form_->update();
+               form_->do_ref_update();
        }
  
        /// adaptor to FormRef::apply
index 8c9116245ad7e485f137d80305dcd5a9c77444b5..5d671cbe265701fefc3a3f7646a039fdeea10673 100644 (file)
@@ -28,12 +28,12 @@ FormTocDialog::FormTocDialog(FormToc *form, QWidget *parent, const char *name, b
        menu->insertItem(_("List of Figures"));
        menu->insertItem(_("List of Tables"));
        menu->insertItem(_("List of Algorithms"));
-       menu->setMinimumSize(menu->sizeHint()); 
+       menu->setMinimumSize(menu->sizeHint());
+
        tree = new QListView(this);
        tree->setMinimumHeight(200);
-       tree->setRootIsDecorated(true); 
-       tree->setSorting(-1); 
+       tree->setRootIsDecorated(true);
+       tree->setSorting(-1);
        tree->addColumn("Table of Contents");
 
         buttonUpdate = new QPushButton(this);
@@ -47,8 +47,18 @@ FormTocDialog::FormTocDialog(FormToc *form, QWidget *parent, const char *name, b
         buttonClose->setText(_("&Close"));
         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);
 
         layout = new QVBoxLayout();
@@ -57,6 +67,8 @@ FormTocDialog::FormTocDialog(FormToc *form, QWidget *parent, const char *name, b
 
        layout->addWidget(menu,0);
        layout->addWidget(tree,1);
+       layout->addWidget(depthlabel,0,AlignLeft);
+       layout->addWidget(depth,0);
 
         buttonLayout = new QHBoxLayout();
 
@@ -70,9 +82,10 @@ FormTocDialog::FormTocDialog(FormToc *form, QWidget *parent, const char *name, b
        // connections
 
        connect(tree, SIGNAL(selectionChanged(QListViewItem *)), this, SLOT(select_adaptor(QListViewItem *)));
-       connect(menu, SIGNAL(activated(int)), this, SLOT(activate_adaptor(int))); 
-       connect(buttonUpdate, SIGNAL(clicked()), this, SLOT(update_adaptor())); 
+       connect(menu, SIGNAL(activated(int)), this, SLOT(activate_adaptor(int)));
+       connect(buttonUpdate, SIGNAL(clicked()), this, SLOT(update_adaptor()));
        connect(buttonClose, SIGNAL(clicked()), this, SLOT(close_adaptor()));
+       connect(depth, SIGNAL(valueChanged(int)), this, SLOT(depth_adaptor(int)));
 }
 
 void FormTocDialog::closeEvent(QCloseEvent *e)
index f00b479f4435e1478c12866a3ee71697e7286f5d..68f67995384becf6384998501809271c8188983e 100644 (file)
 #include <config.h>
 #include <gettext.h>
 
-#include <debug.h> 
+#include <debug.h>
+#include <qlabel.h> 
 #include <qdialog.h>
 #include <qlayout.h>
 #include <qpushbutton.h>
 #include <qcombobox.h>
 #include <qlistview.h>
+#include <qslider.h>
+
 #include "FormToc.h"
 
 class FormTocDialog : public QDialog  {
@@ -36,48 +38,55 @@ public:
        ~FormTocDialog();
 
        // widgets
+
        QComboBox *menu;
        QListView *tree;
        QPushButton *buttonUpdate;
        QPushButton *buttonClose;
+       QSlider *depth;
+       QLabel *depthlabel; 
 
 protected:
        void closeEvent(QCloseEvent *e);
+
 private:
        FormToc *form_;
 
-       // layouts  
+       // layouts 
+
        QHBoxLayout *topLayout;
        QVBoxLayout *layout;
        QHBoxLayout *buttonLayout;
+
 private slots:
        /// adaptor to FormToc::select
        void select_adaptor(QListViewItem *item) {
                form_->select(item->text(0));
        }
 
+       /// adaptor to FormToc::set_depth
+       void depth_adaptor(int depth) {
+               form_->set_depth(depth);
+       }
+
        /// adaptor to FormToc::update
        void update_adaptor(void) {
                form_->update();
        }
+
        // adaptors to FormToc::set_type
        void activate_adaptor(int index) {
                switch (index) {
-                       case 0: 
+                       case 0:
                                form_->set_type(Buffer::TOC_TOC);
                                break;
-                       case 1: 
+                       case 1:
                                form_->set_type(Buffer::TOC_LOF);
                                break;
-                       case 2: 
+                       case 2:
                                form_->set_type(Buffer::TOC_LOT);
                                break;
-                       case 3: 
+                       case 3:
                                form_->set_type(Buffer::TOC_LOA);
                                break;
                        default:
@@ -85,7 +94,7 @@ private slots:
                                break;
                }
        }
+
        /// adaptor to FormToc::close
        void close_adaptor(void) {
                form_->close();