mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
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:
parent
525c430bc7
commit
b2b9fd9c89
21
ChangeLog
21
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.
|
||||
|
@ -40,11 +40,6 @@
|
||||
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
|
||||
|
@ -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
|
||||
|
@ -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();
|
||||
|
||||
if (readonly) {
|
||||
dialog_->type->setEnabled(false);
|
||||
dialog_->buttonOk->setEnabled(false);
|
||||
dialog_->buttonUpdate->setEnabled(false);
|
||||
dialog_->buttonGoto->setEnabled(params.getContents()!="");
|
||||
dialog_->buttonOk->setEnabled(params.getContents()!="");
|
||||
|
||||
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) {
|
||||
|
@ -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
|
||||
|
@ -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 *
|
||||
@ -16,25 +16,25 @@
|
||||
#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();
|
||||
|
@ -18,19 +18,19 @@
|
||||
#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
|
||||
|
@ -39,6 +39,7 @@ ETAGS_ARGS = --lang=c++
|
||||
libkde_la_SOURCES = \
|
||||
Dialogs.C \
|
||||
GUIRunTime.C \
|
||||
QtLyXView.h \
|
||||
FormCopyright.C \
|
||||
FormCopyright.h \
|
||||
formcopyrightdialog.C \
|
||||
|
@ -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()));
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -19,13 +19,15 @@
|
||||
#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();
|
||||
|
Loading…
Reference in New Issue
Block a user