Few fixes for the kde frontend.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1405 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Dekel Tsur 2001-01-26 17:24:09 +00:00
parent 976b104ffe
commit f04a7e4745
10 changed files with 50 additions and 65 deletions

View File

@ -1,3 +1,7 @@
2001-01-26 Dekel Tsur <dekelts@tau.ac.il>
* vspace.C (isValidLength): Fix for empty input string.
2001-01-26 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr> 2001-01-26 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
* LyXAction.C (init): change description of LFUN_FIGURE to * LyXAction.C (init): change description of LFUN_FIGURE to

View File

@ -1,3 +1,15 @@
2001-01-26 Dekel Tsur <dekelts@tau.ac.il>
* dlg/lengthentry.C: Move the '#include <config.h>' to the top
(fix compilation with lyxstring).
* FormPrint.h: Fix for namespace-less compilers.
* refdlg.C (RefDialog): Use InsetRef::types.
* FormRef.C (update, apply): Use InsetRef::getName and
InsetRef::getType.
2000-01-24 John Levon <moz@compsoc.man.ac.uk> 2000-01-24 John Levon <moz@compsoc.man.ac.uk>
* FormParagraph.C: update readonly in correct * FormParagraph.C: update readonly in correct

View File

@ -22,6 +22,10 @@ class Dialogs;
class LyXView; class LyXView;
class PrintDialog; class PrintDialog;
#ifdef SIGC_CXX_NAMESPACES
using SigC::Connection;
#endif
class FormPrint : public DialogBase, public noncopyable { class FormPrint : public DialogBase, public noncopyable {
public: public:
/**@name Constructors and Destructors */ /**@name Constructors and Destructors */
@ -57,9 +61,9 @@ private:
Dialogs * d_; Dialogs * d_;
/// Hide connection. /// Hide connection.
SigC::Connection h_; Connection h_;
/// Update connection. /// Update connection.
SigC::Connection u_; Connection u_;
}; };
#endif #endif

View File

@ -23,6 +23,7 @@
#include "lyxfunc.h" #include "lyxfunc.h"
#include "refdlg.h" #include "refdlg.h"
#include "debug.h" #include "debug.h"
#include "insets/insetref.h"
#include <qtooltip.h> #include <qtooltip.h>
@ -30,7 +31,7 @@ using std::endl;
FormRef::FormRef(LyXView *v, Dialogs *d) FormRef::FormRef(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),
sort(0), gotowhere(GOTOREF), type(REF), refs(0) sort(0), gotowhere(GOTOREF), refs(0)
{ {
// 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
@ -172,22 +173,8 @@ void FormRef::update(bool switched)
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()=="pageref") { if (inset_)
type = PAGEREF; dialog_->type->setCurrentItem(InsetRef::getType(params.getCmdName()));
dialog_->type->setCurrentItem(1);
} else if (params.getCmdName()=="vref") {
type = VREF;
dialog_->type->setCurrentItem(2);
} 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);
}
dialog_->buttonGoto->setText(_("&Goto reference")); dialog_->buttonGoto->setText(_("&Goto reference"));
QToolTip::remove(dialog_->buttonGoto); QToolTip::remove(dialog_->buttonGoto);
@ -221,26 +208,7 @@ void FormRef::apply()
if (!lv_->view()->available()) if (!lv_->view()->available())
return; return;
switch (dialog_->type->currentItem()) { params.setCmdName(InsetRef::getName(dialog_->type->currentItem()));
case 0:
params.setCmdName("ref");
break;
case 1:
params.setCmdName("pageref");
break;
case 2:
params.setCmdName("vref");
break;
case 3:
params.setCmdName("vpageref");
break;
case 4:
params.setCmdName("prettyref");
break;
default:
lyxerr[Debug::GUI] << "Unknown Ref Type" << endl;
}
params.setContents(dialog_->reference->text()); params.setContents(dialog_->reference->text());
params.setOptions(dialog_->refname->text()); params.setOptions(dialog_->refname->text());

View File

@ -52,10 +52,6 @@ public:
void close(); void close();
private: private:
enum Type {
REF, PAGEREF, VREF, VPAGEREF, PRETTYREF
};
enum GotoType { enum GotoType {
GOTOREF, GOTOBACK GOTOREF, GOTOBACK
}; };
@ -103,9 +99,6 @@ private:
/// where to go /// where to go
GotoType gotowhere; GotoType gotowhere;
/// current type
Type type;
/// available references /// available references
std::vector< string > refs; std::vector< string > refs;
}; };

View File

@ -4,6 +4,8 @@
* John Levon, moz@compsoc.man.ac.uk * John Levon, moz@compsoc.man.ac.uk
*/ */
#include <config.h>
#include "lengthentry.h" #include "lengthentry.h"
#include <qlayout.h> #include <qlayout.h>
@ -11,8 +13,6 @@
#include <qcombobox.h> #include <qcombobox.h>
#include "support/lstrings.h" #include "support/lstrings.h"
#include <config.h>
#include <gettext.h> #include <gettext.h>
#include "debug.h" #include "debug.h"

View File

@ -15,8 +15,9 @@
#include <config.h> #include <config.h>
#include "refdlg.h" #include "refdlg.h"
#include "dlg/helpers.h" #include "dlg/helpers.h"
#include "insets/insetref.h"
#ifdef CXX_WORKING_NAMESPACES #ifdef CXX_WORKING_NAMESPACES
using kde_helpers::setSizeHint; using kde_helpers::setSizeHint;
@ -65,11 +66,8 @@ RefDialog::RefDialog(FormRef *form, QWidget *parent, const char *name, bool, WFl
sort->setMaximumSize(sort->sizeHint()); sort->setMaximumSize(sort->sizeHint());
type = new QComboBox(this); type = new QComboBox(this);
type->insertItem(_("Reference")); for (int i = 0; !InsetRef::types[i].latex_name.empty(); ++i)
type->insertItem(_("Page number")); type->insertItem(_(InsetRef::types[i].gui_name.c_str()));
type->insertItem(_("Ref on page xxx"));
type->insertItem(_("on page xxx"));
type->insertItem(_("Pretty reference"));
setSizeHint(type); setSizeHint(type);
labeltype = new QLabel(this); labeltype = new QLabel(this);

View File

@ -1,3 +1,7 @@
2001-01-26 Dekel Tsur <dekelts@tau.ac.il>
* lyxstring.C: Fix some assertions.
2001-01-23 Dekel Tsur <dekelts@tau.ac.il> 2001-01-23 Dekel Tsur <dekelts@tau.ac.il>
* lstrings.C (strip): Add a fix for compilers with broken * lstrings.C (strip): Add a fix for compilers with broken

View File

@ -1046,7 +1046,7 @@ lyxstring::size_type lyxstring::rfind(value_type c, size_type i) const
lyxstring::size_type lyxstring::find_first_of(lyxstring const & a, lyxstring::size_type lyxstring::find_first_of(lyxstring const & a,
size_type i) const size_type i) const
{ {
Assert(i < rep->sz); // OURS! Assert(i <= rep->sz); // OURS!
TestlyxstringInvariant(this); TestlyxstringInvariant(this);
for (size_type t = i; t < rep->sz; ++t) { for (size_type t = i; t < rep->sz; ++t) {
@ -1060,7 +1060,7 @@ lyxstring::size_type lyxstring::find_first_of(value_type const * ptr,
size_type i, size_type i,
size_type n) const size_type n) const
{ {
Assert(ptr && i < rep->sz); // OURS! Assert(ptr && i <= rep->sz); // OURS!
TestlyxstringInvariant(this); TestlyxstringInvariant(this);
if (!n) return npos; if (!n) return npos;
@ -1074,7 +1074,7 @@ lyxstring::size_type lyxstring::find_first_of(value_type const * ptr,
lyxstring::size_type lyxstring::find_first_of(value_type const * ptr, lyxstring::size_type lyxstring::find_first_of(value_type const * ptr,
size_type i) const size_type i) const
{ {
Assert(ptr && i < rep->sz); // OURS! Assert(ptr && i <= rep->sz); // OURS!
TestlyxstringInvariant(this); TestlyxstringInvariant(this);
for (size_type t = i; t < rep->sz; ++t) { for (size_type t = i; t < rep->sz; ++t) {
@ -1086,7 +1086,7 @@ lyxstring::size_type lyxstring::find_first_of(value_type const * ptr,
lyxstring::size_type lyxstring::find_first_of(value_type c, size_type i) const lyxstring::size_type lyxstring::find_first_of(value_type c, size_type i) const
{ {
Assert(i < rep->sz); // OURS! Assert(i <= rep->sz); // OURS!
TestlyxstringInvariant(this); TestlyxstringInvariant(this);
for (size_type t = i; t < rep->sz; ++t) { for (size_type t = i; t < rep->sz; ++t) {
@ -1158,7 +1158,7 @@ lyxstring::size_type lyxstring::find_first_not_of(lyxstring const & a,
TestlyxstringInvariant(this); TestlyxstringInvariant(this);
if (!rep->sz) return npos; if (!rep->sz) return npos;
Assert(i < rep->sz); Assert(i <= rep->sz);
for (size_type t = i; t < rep->sz; ++t) { for (size_type t = i; t < rep->sz; ++t) {
if (a.find(rep->s[t]) == npos) return t; if (a.find(rep->s[t]) == npos) return t;
} }
@ -1170,7 +1170,7 @@ lyxstring::size_type lyxstring::find_first_not_of(value_type const * ptr,
size_type i, size_type i,
size_type n) const size_type n) const
{ {
Assert(ptr && i < rep->sz); // OURS! Assert(ptr && i <= rep->sz); // OURS!
TestlyxstringInvariant(this); TestlyxstringInvariant(this);
if (!n) return (i < rep->sz) ? i : npos; if (!n) return (i < rep->sz) ? i : npos;
@ -1184,7 +1184,7 @@ lyxstring::size_type lyxstring::find_first_not_of(value_type const * ptr,
lyxstring::size_type lyxstring::find_first_not_of(value_type const * ptr, lyxstring::size_type lyxstring::find_first_not_of(value_type const * ptr,
size_type i) const size_type i) const
{ {
Assert(ptr && i < rep->sz); // OURS! Assert(ptr && i <= rep->sz); // OURS!
TestlyxstringInvariant(this); TestlyxstringInvariant(this);
for (size_type t = i; t < rep->sz; ++t) { for (size_type t = i; t < rep->sz; ++t) {
@ -1198,7 +1198,7 @@ lyxstring::size_type lyxstring::find_first_not_of(value_type c,
size_type i) const size_type i) const
{ {
if (!rep->sz) return npos; if (!rep->sz) return npos;
Assert(i < rep->sz); // OURS! Assert(i <= rep->sz); // OURS!
TestlyxstringInvariant(this); TestlyxstringInvariant(this);
for (size_type t = i; t < rep->sz; ++t) { for (size_type t = i; t < rep->sz; ++t) {
@ -1293,7 +1293,7 @@ lyxstring & lyxstring::replace(size_type i, size_type n, lyxstring const & x,
lyxstring & lyxstring::replace(size_type i, size_type n, lyxstring & lyxstring::replace(size_type i, size_type n,
value_type const * p, size_type n2) value_type const * p, size_type n2)
{ {
Assert(p && i < rep->sz); // OURS! Assert(p && i <= rep->sz); // OURS!
TestlyxstringInvariant(this); TestlyxstringInvariant(this);
rep = rep->get_own_copy(); rep = rep->get_own_copy();
@ -1304,7 +1304,7 @@ lyxstring & lyxstring::replace(size_type i, size_type n,
lyxstring & lyxstring::replace(size_type i, size_type n, value_type const * p) lyxstring & lyxstring::replace(size_type i, size_type n, value_type const * p)
{ {
Assert(p && i < rep->sz); // OURS! Assert(p && i <= rep->sz); // OURS!
TestlyxstringInvariant(this); TestlyxstringInvariant(this);
return replace(i, min(n, rep->sz), p, (!p) ? 0 : strlen(p)); return replace(i, min(n, rep->sz), p, (!p) ? 0 : strlen(p));

View File

@ -249,6 +249,8 @@ bool isValidLength(string const & data, LyXLength * result)
/// The parser may seem overkill for lengths without /// The parser may seem overkill for lengths without
/// glue, but since we already have it, using it is /// glue, but since we already have it, using it is
/// easier than writing something from scratch. /// easier than writing something from scratch.
if (data.empty())
return true;
string buffer(data); string buffer(data);
int pattern_index = 0; int pattern_index = 0;