mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-25 05:55:34 +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,47 +180,21 @@ void FormRef::update()
|
||||
|
||||
dialog_->sort->setChecked(sort);
|
||||
|
||||
dialog_->refs->clear();
|
||||
dialog_->type->setEnabled(false);
|
||||
do_ref_update();
|
||||
|
||||
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();
|
||||
}
|
||||
dialog_->buttonGoto->setEnabled(params.getContents()!="");
|
||||
dialog_->buttonOk->setEnabled(params.getContents()!="");
|
||||
|
||||
if (params.getContents()=="") {
|
||||
dialog_->buttonGoto->setEnabled(false);
|
||||
dialog_->buttonOk->setEnabled(false);
|
||||
} else {
|
||||
dialog_->buttonGoto->setEnabled(true);
|
||||
dialog_->buttonOk->setEnabled(true);
|
||||
}
|
||||
|
||||
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) {
|
||||
|
@ -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
|
||||
|
@ -34,7 +34,7 @@ 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
|
||||
@ -70,7 +70,7 @@ void FormToc::createTOC(string const & arg)
|
||||
show();
|
||||
}
|
||||
|
||||
void FormToc::updateToc()
|
||||
void FormToc::updateToc(int newdepth)
|
||||
{
|
||||
if (!lv_->view()->available()) {
|
||||
toclist.clear();
|
||||
@ -82,7 +82,7 @@ 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])
|
||||
@ -92,13 +92,17 @@ void FormToc::updateToc()
|
||||
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;
|
||||
@ -110,21 +114,21 @@ void FormToc::updateToc()
|
||||
|
||||
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--) {
|
||||
@ -143,7 +147,8 @@ void FormToc::updateToc()
|
||||
<< " 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;
|
||||
}
|
||||
|
||||
@ -158,22 +163,32 @@ void FormToc::setType(Buffer::TocType toctype)
|
||||
case Buffer::TOC_TOC:
|
||||
dialog_->setCaption(_("Table of Contents"));
|
||||
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"));
|
||||
dialog_->depth->setEnabled(false);
|
||||
break;
|
||||
case Buffer::TOC_LOT:
|
||||
dialog_->setCaption(_("List of Tables"));
|
||||
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"));
|
||||
dialog_->depth->setEnabled(false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void FormToc::set_depth(int newdepth)
|
||||
{
|
||||
if (newdepth!=depth)
|
||||
updateToc(newdepth);
|
||||
}
|
||||
|
||||
void FormToc::update()
|
||||
{
|
||||
if (params.getCmdName()=="tableofcontents") {
|
||||
@ -190,7 +205,7 @@ void FormToc::update()
|
||||
dialog_->menu->setCurrentItem(3);
|
||||
}
|
||||
|
||||
updateToc();
|
||||
updateToc(depth);
|
||||
}
|
||||
|
||||
void FormToc::select(const char *text)
|
||||
@ -218,7 +233,7 @@ void FormToc::set_type(Buffer::TocType toctype)
|
||||
return;
|
||||
|
||||
setType(toctype);
|
||||
updateToc();
|
||||
updateToc(depth);
|
||||
}
|
||||
|
||||
void FormToc::show()
|
||||
|
@ -40,6 +40,8 @@ public:
|
||||
void set_type(Buffer::TocType);
|
||||
/// Update the dialog.
|
||||
void update();
|
||||
/// change the depth shown
|
||||
void set_depth(int);
|
||||
/// close the connections
|
||||
void close();
|
||||
|
||||
@ -54,10 +56,8 @@ private:
|
||||
/// 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);
|
||||
@ -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,10 +73,15 @@ private:
|
||||
|
||||
private slots:
|
||||
/// adaptor to FormRef::select
|
||||
void highlight_adaptor(const char *sel) {
|
||||
void select_adaptor(const char *sel) {
|
||||
form_->select(sel);
|
||||
}
|
||||
|
||||
/// adaptor to FormRef::highlight
|
||||
void highlight_adaptor(const char *sel) {
|
||||
form_->highlight(sel);
|
||||
}
|
||||
|
||||
/// adaptor to FormRef::set_sort
|
||||
void sort_adaptor(bool sort) {
|
||||
form_->set_sort(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
|
||||
|
@ -47,6 +47,16 @@ FormTocDialog::FormTocDialog(FormToc *form, QWidget *parent, const char *name, b
|
||||
buttonClose->setText(_("&Close"));
|
||||
buttonClose->setDefault(true);
|
||||
|
||||
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);
|
||||
@ -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();
|
||||
|
||||
@ -73,6 +85,7 @@ FormTocDialog::FormTocDialog(FormToc *form, QWidget *parent, const char *name, b
|
||||
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)
|
||||
|
@ -20,11 +20,13 @@
|
||||
#include <gettext.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"
|
||||
|
||||
@ -41,6 +43,8 @@ public:
|
||||
QListView *tree;
|
||||
QPushButton *buttonUpdate;
|
||||
QPushButton *buttonClose;
|
||||
QSlider *depth;
|
||||
QLabel *depthlabel;
|
||||
|
||||
protected:
|
||||
void closeEvent(QCloseEvent *e);
|
||||
@ -60,6 +64,11 @@ private slots:
|
||||
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();
|
||||
|
Loading…
Reference in New Issue
Block a user