cleanups from John and Michael

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2995 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2001-11-09 13:44:48 +00:00
parent 146daa986e
commit 9d0ba3ddf2
31 changed files with 864 additions and 746 deletions

View File

@ -1,3 +1,7 @@
2001-11-04 John Levon <moz@compsoc.man.ac.uk>
* Makefile.in.in: consider Qt2 dialogs for translation
2001-10-08 gettextize <bug-gnu-utils@gnu.org>
* Makefile.in.in: Upgrade to gettext-0.10.40.

View File

@ -214,6 +214,8 @@ $(top_srcdir)/src/ext_l10n.h: $(top_srcdir)/lib/layouts/*.layout $(top_srcdir)/l
sed -n -e 's/^[sS]tyle[ ]*\([^ ]*\)$$/_("\1");/p' | \
sort | uniq >> $@
sed < $(top_srcdir)/lib/languages -e '/^#/d' -e 's/[^"]*\("[A-Za-z0-9][^"]*"\).*/_(\1);/' >> $@
cat $(top_srcdir)/src/frontends/qt2/ui/*.ui | grep '<string>..*</string>' | \
sed 's,&amp;,\&,;s,^.*<string>,_(",;s,</string>,"),;' | uniq >> $@
# Tell versions [3.59,3.63) of GNU make not to export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.

View File

@ -31,6 +31,7 @@ src/frontends/controllers/ControlSearch.C
src/frontends/controllers/ControlSpellchecker.C
src/frontends/controllers/ControlTexinfo.C
src/frontends/controllers/ControlThesaurus.C
src/frontends/controllers/ControlVCLog.C
src/frontends/controllers/biblio.C
src/frontends/controllers/character.C
src/frontends/controllers/helper_funcs.C

View File

@ -622,8 +622,7 @@ void BufferView::Pimpl::workAreaButtonPress(int xpos, int ypos,
updateScrollbar();
// Single left click in math inset?
if ((inset_hit != 0) &&
(inset_hit->editable()==Inset::HIGHLY_EDITABLE)) {
if (isHighlyEditableInset(inset_hit)) {
// Highly editable inset, like math
UpdatableInset * inset = static_cast<UpdatableInset *>(inset_hit);
selection_possible = false;
@ -792,7 +791,7 @@ void BufferView::Pimpl::workAreaButtonRelease(int x, int y,
owner_->message(inset_hit->editMessage());
if (inset_hit->editable()==Inset::HIGHLY_EDITABLE) {
if (isHighlyEditableInset(inset_hit)) {
// Highly editable inset, like math
UpdatableInset *inset = (UpdatableInset *)inset_hit;
inset->insetButtonRelease(bv_, x, y, button);
@ -856,9 +855,8 @@ Inset * BufferView::Pimpl::checkInsetHit(LyXText * text, int & x, int & y,
if (cursor.pos() < cursor.par()->size()
&& cursor.par()->getChar(cursor.pos()) == Paragraph::META_INSET
&& cursor.par()->getInset(cursor.pos())
&& cursor.par()->getInset(cursor.pos())->editable()) {
&& isMetaInset(cursor.par(), cursor.pos())
&& isEditableInset(cursor.par()->getInset(cursor.pos()))) {
// Check whether the inset really was hit
Inset * tmpinset = cursor.par()->getInset(cursor.pos());
@ -882,9 +880,8 @@ Inset * BufferView::Pimpl::checkInsetHit(LyXText * text, int & x, int & y,
}
if ((cursor.pos() - 1 >= 0) &&
(cursor.par()->getChar(cursor.pos()-1) == Paragraph::META_INSET) &&
(cursor.par()->getInset(cursor.pos() - 1)) &&
(cursor.par()->getInset(cursor.pos() - 1)->editable())) {
isMetaInset(cursor.par(), cursor.pos() - 1) &&
isEditableInset(cursor.par()->getInset(cursor.pos() - 1))) {
Inset * tmpinset = cursor.par()->getInset(cursor.pos()-1);
LyXFont font = text->getFont(buffer_, cursor.par(),
cursor.pos() - 1);
@ -1777,7 +1774,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
case LFUN_INSERT_LABEL:
MenuInsertLabel(bv_, argument);
break;
case LFUN_REF_INSERT:
if (argument.empty()) {
InsetCommandParams p("ref");
@ -1836,10 +1833,8 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
if (is_rtl)
lt->cursorLeft(bv_, false);
if (lt->cursor.pos() < lt->cursor.par()->size()
&& lt->cursor.par()->getChar(lt->cursor.pos())
== Paragraph::META_INSET
&& lt->cursor.par()->getInset(lt->cursor.pos())
&& lt->cursor.par()->getInset(lt->cursor.pos())->editable() == Inset::HIGHLY_EDITABLE){
&& isMetaInset(lt->cursor.par(), lt->cursor.pos())
&& isHighlyEditableInset(lt->cursor.par()->getInset(lt->cursor.pos()))) {
Inset * tmpinset = lt->cursor.par()->getInset(lt->cursor.pos());
owner_->getLyXFunc()->setMessage(tmpinset->editMessage());
if (is_rtl)
@ -1870,12 +1865,8 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
lt->cursorLeft(bv_, false);
if ((is_rtl || cur != lt->cursor) && // only if really moved!
lt->cursor.pos() < lt->cursor.par()->size() &&
(lt->cursor.par()->getChar(lt->cursor.pos()) ==
Paragraph::META_INSET) &&
lt->cursor.par()->getInset(lt->cursor.pos()) &&
(lt->cursor.par()->getInset(lt->cursor.pos())->editable()
== Inset::HIGHLY_EDITABLE))
{
isMetaInset(lt->cursor.par(), lt->cursor.pos()) &&
isHighlyEditableInset(lt->cursor.par()->getInset(lt->cursor.pos()))) {
Inset * tmpinset = lt->cursor.par()->getInset(lt->cursor.pos());
owner_->getLyXFunc()->setMessage(tmpinset->editMessage());
if (is_rtl)
@ -3411,16 +3402,19 @@ void BufferView::Pimpl::gotoInset(vector<Inset::Code> const & codes,
beforeChange(bv_->text);
update(bv_->text, BufferView::SELECT|BufferView::FITCUR);
LyXCursor const & cursor = bv_->text->cursor;
string contents;
if (same_content &&
bv_->text->cursor.par()->getChar(bv_->text->cursor.pos()) == Paragraph::META_INSET) {
Inset const * inset = bv_->text->cursor.par()->getInset(bv_->text->cursor.pos());
isMetaInset(cursor.par(), cursor.pos())) {
Inset const * inset = cursor.par()->getInset(cursor.pos());
if (find(codes.begin(), codes.end(), inset->lyxCode())
!= codes.end())
contents =
static_cast<InsetCommand const *>(inset)->getContents();
}
if (!bv_->text->gotoNextInset(bv_, codes, contents)) {
if (bv_->text->cursor.pos()
|| bv_->text->cursor.par() != bv_->text->firstParagraph()) {

View File

@ -1,3 +1,34 @@
2001-11-07 John Levon <moz@compsoc.man.ac.uk>
* BufferView_pimpl.C: use inline helpers
* LaTeXFeatures.h:
* LaTeXFeatures.C: fix typos
* Spacing.h:
* Spacing.C: move spacing_string into class
* ToolbarDefaults.C: move stuff into namespace anon
* layout.h: update enum
* lyxfunc.C: use better debug
* minibuffer.h: fix typo
* debug.h:
* debug.C:
* WorkArea.C: add and use Debug::WORKAREA
* lyxtext.h:
* text.C:
* text2.C: code re-organisation, inline helpers
2001-11-09 Michael A. Koziarski <michael@koziarski.org>
* Layout.C: replaced a few cases of std::vector.size() == 0 with
std::vector.empty().
2001-11-09 Allan Rae <rae@lyx.org>
* paragraph.C (TeXOnePar): remove old, now-irrelevent comments about

View File

@ -472,8 +472,8 @@ void LaTeXFeatures::getFloatDefinitions(std::ostream & os) const
<< name << "}\n";
// What missing here is to code to minimalize the code
// outputted so that the same flotastyle will not be
// used several times. when the same style is still in
// outputted so that the same floatstyle will not be
// used several times, when the same style is still in
// effect. (Lgb)
}
}

View File

@ -35,7 +35,7 @@ struct Language;
struct LaTeXFeatures {
///
LaTeXFeatures(BufferParams const &, LyXTextClass::size_type n) ;
/// The packaes needed by the document
/// The packages needed by the document
string const getPackages() const;
/// The macros definitions needed by the document
string const getMacros() const;

View File

@ -21,14 +21,9 @@
using std::ios;
using std::ostream;
/// how can I put this inside of Spacing (class)
namespace {
char const * const spacing_string[] = {"single", "onehalf", "double", "other"};
} // namespace anon
string const Spacing::spacing_string[]
= {"single", "onehalf", "double", "other"};
float Spacing::getValue() const
{
switch (space) {

View File

@ -63,11 +63,14 @@ public:
string const writeEnvirBegin() const;
///
string const writeEnvirEnd() const;
private:
///
Space space;
///
float value;
/// names of line spacing
static string const spacing_string[];
};

View File

@ -27,6 +27,28 @@ using std::endl;
extern LyXAction lyxaction;
ToolbarDefaults toolbardefaults;
namespace {
enum _tooltags {
TO_ADD = 1,
TO_ENDTOOLBAR,
TO_SEPARATOR,
TO_LAYOUTS,
TO_NEWLINE,
TO_LAST
};
struct keyword_item toolTags[TO_LAST - 1] = {
{ "end", TO_ENDTOOLBAR },
{ "icon", TO_ADD },
{ "layouts", TO_LAYOUTS },
{ "newline", TO_NEWLINE },
{ "separator", TO_SEPARATOR }
};
}; // end of anon namespace
ToolbarDefaults::ToolbarDefaults()
{
@ -73,25 +95,6 @@ void ToolbarDefaults::init()
}
enum _tooltags {
TO_ADD = 1,
TO_ENDTOOLBAR,
TO_SEPARATOR,
TO_LAYOUTS,
TO_NEWLINE,
TO_LAST
};
struct keyword_item toolTags[TO_LAST - 1] = {
{ "end", TO_ENDTOOLBAR },
{ "icon", TO_ADD },
{ "layouts", TO_LAYOUTS },
{ "newline", TO_NEWLINE },
{ "separator", TO_SEPARATOR }
};
void ToolbarDefaults::read(LyXLex & lex)
{
//consistency check
@ -134,8 +137,6 @@ void ToolbarDefaults::read(LyXLex & lex)
break;
case TO_ENDTOOLBAR:
// should not set automatically
//set();
quit = true;
break;
default:

View File

@ -74,7 +74,7 @@ WorkArea::WorkArea(int xpos, int ypos, int width, int height)
figinset_canvas = 0;
if (lyxerr.debugging(Debug::GUI))
if (lyxerr.debugging(Debug::WORKAREA))
lyxerr << "Creating work area: +"
<< xpos << '+' << ypos << ' '
<< width << 'x' << height << endl;
@ -91,7 +91,7 @@ WorkArea::WorkArea(int xpos, int ypos, int width, int height)
fl_set_object_gravity(obj, NorthWestGravity, NorthWestGravity);
// a box
if (lyxerr.debugging(Debug::GUI))
if (lyxerr.debugging(Debug::WORKAREA))
lyxerr << "\tbackground box: +"
<< xpos << '+' << ypos << ' '
<< width - 15 << 'x' << height << endl;
@ -154,7 +154,7 @@ WorkArea::WorkArea(int xpos, int ypos, int width, int height)
// We add this object as late as possible to avoit problems
// with drawing.
if (lyxerr.debugging(Debug::GUI))
if (lyxerr.debugging(Debug::WORKAREA))
lyxerr << "\tfree object: +"
<< xpos + bw << '+' << ypos + bw << ' '
<< width - 15 - 2 * bw << 'x'
@ -195,12 +195,6 @@ bool WorkArea::belowMouse() const
if (x > ulx && y > uly && x < ulx + h && y < uly + w)
return true;
return false;
//lyxerr << "Mouse: (" << x << ", " << y <<") button = " << button << endl;
//lyxerr << "Workarea: (" << work_area->x + work_area->form->x << ", " << work_area->y + work_area->form->y << ", " << work_area->w << ", " << work_area->h << ")" << endl;
//lyxerr << "Below mouse: " << work_area->belowmouse << endl;
//return work_area->belowmouse;
}
@ -270,7 +264,7 @@ void WorkArea::createPixmap(int width, int height)
if (workareapixmap)
XFreePixmap(fl_get_display(), workareapixmap);
if (lyxerr.debugging(Debug::GUI))
if (lyxerr.debugging(Debug::WORKAREA))
lyxerr << "Creating pixmap ("
<< width << 'x' << height << ")" << endl;
@ -279,7 +273,7 @@ void WorkArea::createPixmap(int width, int height)
width,
height,
fl_get_visual_depth());
if (lyxerr.debugging(Debug::GUI))
if (lyxerr.debugging(Debug::WORKAREA))
lyxerr << "\tpixmap=" << workareapixmap << endl;
}
@ -351,7 +345,7 @@ int WorkArea::work_area_handler(FL_OBJECT * ob, int event,
if (!area->work_area ||
!area->work_area->form->visible)
return 1;
lyxerr[Debug::GUI] << "Workarea event: DRAW" << endl;
lyxerr[Debug::WORKAREA] << "Workarea event: DRAW" << endl;
area->createPixmap(area->workWidth(), area->height());
Lgb_bug_find_hack = true;
area->workAreaExpose();
@ -360,7 +354,7 @@ int WorkArea::work_area_handler(FL_OBJECT * ob, int event,
case FL_PUSH:
if (!ev || ev->xbutton.button == 0) break;
// Should really have used xbutton.state
lyxerr[Debug::GUI] << "Workarea event: PUSH" << endl;
lyxerr[Debug::WORKAREA] << "Workarea event: PUSH" << endl;
area->workAreaButtonPress(ev->xbutton.x - ob->x,
ev->xbutton.y - ob->y,
ev->xbutton.button);
@ -369,7 +363,7 @@ int WorkArea::work_area_handler(FL_OBJECT * ob, int event,
case FL_RELEASE:
if (!ev || ev->xbutton.button == 0) break;
// Should really have used xbutton.state
lyxerr[Debug::GUI] << "Workarea event: RELEASE" << endl;
lyxerr[Debug::WORKAREA] << "Workarea event: RELEASE" << endl;
area->workAreaButtonRelease(ev->xbutton.x - ob->x,
ev->xbutton.y - ob->y,
ev->xbutton.button);
@ -384,7 +378,7 @@ int WorkArea::work_area_handler(FL_OBJECT * ob, int event,
ev->xmotion.y != y_old ||
fl_get_scrollbar_value(area->scrollbar) != scrollbar_value_old
) {
lyxerr[Debug::GUI] << "Workarea event: MOUSE" << endl;
lyxerr[Debug::WORKAREA] << "Workarea event: MOUSE" << endl;
area->workAreaMotionNotify(ev->xmotion.x - ob->x,
ev->xmotion.y - ob->y,
ev->xbutton.state);
@ -396,7 +390,7 @@ int WorkArea::work_area_handler(FL_OBJECT * ob, int event,
case FL_KEYPRESS:
#endif
{
lyxerr[Debug::KEY] << "Workarea event: KEYBOARD" << endl;
lyxerr[Debug::WORKAREA] << "Workarea event: KEYBOARD" << endl;
KeySym keysym = 0;
char dummy[1];
@ -414,9 +408,9 @@ int WorkArea::work_area_handler(FL_OBJECT * ob, int event,
string const stm = (tmp ? tmp : "");
string const stm2 = (tmp2 ? tmp2 : "");
lyxerr << "WorkArea: Key is `" << stm << "' ["
lyxerr[Debug::KEY] << "WorkArea: Key is `" << stm << "' ["
<< key << "]" << endl;
lyxerr << "WorkArea: Keysym is `" << stm2 << "' ["
lyxerr[Debug::KEY] << "WorkArea: Keysym is `" << stm2 << "' ["
<< keysym << "]" << endl;
}
@ -499,44 +493,43 @@ int WorkArea::work_area_handler(FL_OBJECT * ob, int event,
#if FL_REVISION >= 89
case FL_KEYRELEASE:
lyxerr << "Workarea event: KEYRELEASE" << endl;
lyxerr[Debug::WORKAREA] << "Workarea event: KEYRELEASE" << endl;
break;
#endif
case FL_FOCUS:
lyxerr[Debug::GUI] << "Workarea event: FOCUS" << endl;
lyxerr[Debug::WORKAREA] << "Workarea event: FOCUS" << endl;
area->workAreaFocus();
break;
case FL_UNFOCUS:
lyxerr[Debug::GUI] << "Workarea event: UNFOCUS" << endl;
lyxerr[Debug::WORKAREA] << "Workarea event: UNFOCUS" << endl;
area->workAreaUnfocus();
break;
case FL_ENTER:
lyxerr[Debug::GUI] << "Workarea event: ENTER" << endl;
lyxerr[Debug::WORKAREA] << "Workarea event: ENTER" << endl;
area->workAreaEnter();
break;
case FL_LEAVE:
lyxerr[Debug::GUI] << "Workarea event: LEAVE" << endl;
lyxerr[Debug::WORKAREA] << "Workarea event: LEAVE" << endl;
area->workAreaLeave();
break;
case FL_DBLCLICK:
if (!ev) break;
lyxerr[Debug::GUI] << "Workarea event: DBLCLICK" << endl;
lyxerr[Debug::WORKAREA] << "Workarea event: DBLCLICK" << endl;
area->workAreaDoubleClick(ev->xbutton.x - ob->x,
ev->xbutton.y - ob->y,
ev->xbutton.button);
break;
case FL_TRPLCLICK:
if (!ev) break;
lyxerr[Debug::GUI] << "Workarea event: TRPLCLICK" << endl;
lyxerr[Debug::WORKAREA] << "Workarea event: TRPLCLICK" << endl;
area->workAreaTripleClick(ev->xbutton.x - ob->x,
ev->xbutton.y - ob->y,
ev->xbutton.button);
break;
case FL_OTHER:
if (!ev) break;
lyxerr[Debug::GUI] << "Workarea event: OTHER" << endl;
lyxerr[Debug::WORKAREA] << "Workarea event: OTHER" << endl;
break;
}
@ -581,8 +574,10 @@ string const WorkArea::getClipboard() const
while (!clipboard_read) {
if (fl_check_forms() == FL_EVENT) {
lyxerr << "LyX: This shouldn't happen..." << endl;
fl_XNextEvent(&ev);
lyxerr << "Received unhandled X11 event" << endl;
lyxerr << "Type: 0x" << std::hex << ev.xany.type <<
"Target: 0x" << std::hex << ev.xany.window << endl;
}
}
return clipboard_selection;

View File

@ -53,6 +53,7 @@ error_item errorTags[] = {
{ Debug::DEPEND, "depend", N_("Dependency information")},
{ Debug::INSETS, "insets", N_("LyX Insets")},
{ Debug::FILES, "files", N_("Files used by LyX")},
{ Debug::WORKAREA, "workarea", N_("Workarea events")},
{ Debug::ANY, "any", N_("All debugging messages")}
};
@ -67,7 +68,7 @@ Debug::type const Debug::ANY = Debug::type(
Debug::PARSER | Debug::LYXRC | Debug::KBMAP | Debug::LATEX |
Debug::MATHED | Debug::FONT | Debug::TCLASS | Debug::LYXVC |
Debug::LYXSERVER | Debug::ROFF | Debug::ACTION | Debug::LYXLEX |
Debug::DEPEND | Debug::INSETS | Debug::FILES);
Debug::DEPEND | Debug::INSETS | Debug::FILES | Debug::WORKAREA);
Debug::type Debug::value(string const & val)

View File

@ -66,15 +66,11 @@ struct Debug {
///
INSETS = (1 << 17),
///
FILES = (1 << 18)
FILES = (1 << 18),
///
WORKAREA = (1 << 19)
};
///
// static const type ANY = type(INFO | INIT | KEY | GUI |
// PARSER | LYXRC | KBMAP | LATEX |
// MATHED | FONT | TCLASS | LYXVC |
// LYXSERVER | ROFF | ACTION | LYXLEX |
// DEPEND | INSETS);
///
static type const ANY;
/** A function to convert symbolic string names on debug levels

View File

@ -1,3 +1,7 @@
2001-11-04 John Levon <moz@compsoc.man.ac.uk>
* ControlVCLog.C: use _()
2001-10-23 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
* ControlSpellchecker.C: include <sys/types.h> since FreeBSD needs

View File

@ -29,6 +29,7 @@
#include "Dialogs.h"
#include "lyxrc.h"
#include "support/lyxlib.h"
#include "gettext.h"
using SigC::slot;
using std::endl;
@ -61,7 +62,7 @@ stringstream & ControlVCLog::getVCLogFile(stringstream & ss) const
}
if (!found)
ss << "No version control log file found." << endl;
ss << _("No version control log file found.") << endl;
lyx::unlink(name);

View File

@ -1,3 +1,9 @@
2001-11-04 John Levon <moz@compsoc.man.ac.uk>
* inset.h: new inline helpers
* insettext.C: use new helpers
2001-11-07 José Matos <jamatos@fep.up.pt>
* insettext.C (docbook): full support for paragraphs inside insettext.

View File

@ -513,4 +513,22 @@ private:
///
mutable bool block_drawing_;
};
/**
* returns true if pointer argument is valid
* and points to an editable inset
*/
inline bool isEditableInset(Inset * i)
{
return i && i->editable();
}
/**
* returns true if poiinter argument is valid
* and points to a highly editable inset
*/
inline bool isHighlyEditableInset(Inset * i)
{
return i && i->editable() == Inset::HIGHLY_EDITABLE;
}
#endif

View File

@ -38,4 +38,3 @@ protected:
};
#endif

View File

@ -876,7 +876,7 @@ void InsetText::insetButtonPress(BufferView * bv, int x, int y, int button)
the_locking_inset = 0;
}
if (bv->theLockingInset()) {
if (inset && inset->editable() == Inset::HIGHLY_EDITABLE) {
if (isHighlyEditableInset(inset)) {
UpdatableInset * uinset = static_cast<UpdatableInset*>(inset);
inset_x = cx(bv) - top_x + drawTextXOffset;
inset_y = cy(bv) + drawTextYOffset;
@ -940,9 +940,9 @@ void InsetText::insetButtonRelease(BufferView * bv, int x, int y, int button)
x - inset_x, y - inset_y,
button);
} else {
if (cpar(bv)->getChar(cpos(bv)) == Paragraph::META_INSET) {
if (isMetaInset(cpar(bv), cpos(bv))) {
inset = static_cast<UpdatableInset*>(cpar(bv)->getInset(cpos(bv)));
if (inset->editable() == Inset::HIGHLY_EDITABLE) {
if (isHighlyEditableInset(inset)) {
inset->insetButtonRelease(bv,
x - inset_x,
y - inset_y, button);
@ -1745,7 +1745,7 @@ bool InsetText::insertInset(BufferView * bv, Inset * inset)
}
lt->insertInset(bv, inset);
#if 0
if ((cpar(bv)->getChar(cpos(bv)) != Paragraph::META_INSET) ||
if ((!isMetaInset(cpar(bv), cpos(bv))) ||
(cpar(bv)->getInset(cpos(bv)) != inset))
lt->cursorLeft(bv);
#endif
@ -1845,12 +1845,12 @@ void InsetText::setFont(BufferView * bv, LyXFont const & font, bool toggleall,
bool InsetText::checkAndActivateInset(BufferView * bv, bool behind)
{
if (cpar(bv)->getChar(cpos(bv)) == Paragraph::META_INSET) {
if (isMetaInset(cpar(bv), cpos(bv))) {
unsigned int x;
unsigned int y;
Inset * inset =
static_cast<UpdatableInset*>(cpar(bv)->getInset(cpos(bv)));
if (!inset || inset->editable() != Inset::HIGHLY_EDITABLE)
if (!isHighlyEditableInset(inset))
return false;
LyXFont const font =
getLyXText(bv)->getFont(bv->buffer(), cpar(bv), cpos(bv));

View File

@ -1291,7 +1291,7 @@ string const &
LyXTextClassList::NameOfClass(LyXTextClassList::size_type number) const
{
static string const dummy("dummy");
if (classlist.size() == 0) {
if (classlist.empty()) {
return dummy;
}
lyx::Assert(number < classlist.size());
@ -1305,7 +1305,7 @@ LyXTextClassList::LatexnameOfClass(LyXTextClassList::size_type number) const
{
static string const dummy("dummy");
classlist[number].load();
if (classlist.size() == 0) {
if (classlist.empty()) {
return dummy;
}
lyx::Assert(number < classlist.size());
@ -1318,7 +1318,7 @@ string const &
LyXTextClassList::DescOfClass(LyXTextClassList::size_type number) const
{
static string const dummy("dummy");
if (classlist.size() == 0) {
if (classlist.empty()) {
return dummy;
}
lyx::Assert(number < classlist.size());
@ -1427,7 +1427,7 @@ bool LyXTextClassList::Read ()
}
lyxerr[Debug::TCLASS] << "End of parsing of textclass.lst" << endl;
if (classlist.size() == 0) {
if (classlist.empty()) {
lyxerr << "LyXTextClassList::Read: no textclasses found!"
<< endl;
WriteAlert(_("LyX wasn't able to find any layout description!"),

View File

@ -26,15 +26,11 @@ class LyXLeX;
/// Reads the style files
extern void LyXSetStyle();
///
enum no_good_name_for_this {
///
LYX_ENVIRONMENT_DEFAULT = 97,
enum layout_default {
///
LYX_LAYOUT_DEFAULT = 99
};
// Could this cause confusion that both DUMMY_LAYOUT and LAYOUT_DEFAULT has
// the same value? (Lgb)
///

View File

@ -807,7 +807,7 @@ string const LyXFunc::dispatch(int ac,
// We cannot use this function here
if (getStatus(ac, do_not_use_this_arg) & func_status::Disabled) {
lyxerr << "LyXFunc::Dispatch: "
lyxerr[Debug::ACTION] << "LyXFunc::Dispatch: "
<< lyxaction.getActionName(ac)
<< " [" << ac << "] is disabled at this location"
<< endl;

View File

@ -546,6 +546,55 @@ private:
float & fill_label_hfill,
bool bidi = true) const;
/// A struct used for drawing routines
struct DrawRowParams {
// the bufferview
BufferView * bv;
// the row
Row * row;
// the painter to use
Painter * pain;
// has the background been cleared
bool cleared;
/// x offset
int xo;
/// y offset
int yo;
/// FIXME
float x;
/// FIXME
int y;
/// the inset/view full width
int width;
/// hfill size
float hfill;
/// label hfill size
float label_hfill;
/// fill separator size
float separator;
};
/// paint the background
bool paintRowBackground(DrawRowParams & p);
/// paint the selection background
void paintRowSelection(DrawRowParams & p);
/// paint appendix marker
void paintRowAppendix(DrawRowParams & p);
/// paint env depth bar
void paintRowDepthBar(DrawRowParams & p);
/// paint a first row in a paragraph
void paintFirstRow(DrawRowParams & p);
/// paint a last row in a paragraph
void paintLastRow(DrawRowParams & p);
/// paint text
void paintRowText(DrawRowParams & p);
// fix the cursor `cur' after a characters has been deleted at `where'
// position. Called by deleteEmptyParagraphMechanism
void fixCursorAfterDelete(BufferView * bview,

View File

@ -47,7 +47,7 @@ public:
/** Makes the minibuffer wait for a string to be inserted.
Waits for a string to be inserted into the minibuffer, when
the string has been insterted the signal stringReady is
the string has been inserted the signal stringReady is
emitted.
*/
void getString(State space,

View File

@ -415,4 +415,10 @@ private:
Pimpl * pimpl_;
};
inline bool isMetaInset(Paragraph const * par, Paragraph::size_type const pos)
{
return par->getChar(pos) == Paragraph::META_INSET;
}
#endif

View File

@ -1,3 +1,9 @@
2001-11-04 John Levon <moz@compsoc.man.ac.uk>
* filetools.C: remove dead code
* syscall.C: show prog in fail case
2001-10-24 Andre Poenitz <poenitz@HTWM.De>
* filetools.C: code style cleanup

View File

@ -134,8 +134,7 @@ bool IsFileReadable (string const & path)
int IsFileWriteable (string const & path)
{
FileInfo fi(path);
//lyxerr << "fi : " << fi << endl;
//lyxerr << "fi.exists" << fi.exist() << endl;
if (fi.access(FileInfo::wperm|FileInfo::rperm)) // read-write
return 1;
if (fi.readable()) // read-only

View File

@ -181,7 +181,7 @@ pid_t Systemcalls::fork()
#ifndef __EMX__
execvp(syscmd, argv);
// If something goes wrong, we end up here:
lyxerr << "LyX: execvp failed: "
lyxerr << "LyX: execvp(" << syscmd << ") failed: "
<< strerror(errno) << endl;
} else if (cpid < 0) { // error
#else

1252
src/text.C

File diff suppressed because it is too large Load Diff

View File

@ -246,14 +246,12 @@ void LyXText::setCharFont(BufferView * bv, Paragraph * par,
LyXFont font = getFont(buf, par, pos);
font.update(fnt, buf->params.language, toggleall);
// Let the insets convert their font
if (par->getChar(pos) == Paragraph::META_INSET) {
if (isMetaInset(par, pos)) {
Inset * inset = par->getInset(pos);
if (inset) {
if (inset->editable()==Inset::IS_EDITABLE) {
UpdatableInset * uinset =
static_cast<UpdatableInset *>(inset);
uinset->setFont(bv, fnt, toggleall, true);
}
if (isEditableInset(inset)) {
UpdatableInset * uinset =
static_cast<UpdatableInset *>(inset);
uinset->setFont(bv, fnt, toggleall, true);
}
}
@ -451,7 +449,7 @@ Inset * LyXText::getInset() const
if (cursor.pos() == 0 && cursor.par()->bibkey) {
inset = cursor.par()->bibkey;
} else if (cursor.pos() < cursor.par()->size()
&& cursor.par()->getChar(cursor.pos()) == Paragraph::META_INSET) {
&& isMetaInset(cursor.par(), cursor.pos())) {
inset = cursor.par()->getInset(cursor.pos());
}
return inset;
@ -461,12 +459,12 @@ Inset * LyXText::getInset() const
void LyXText::toggleInset(BufferView * bview)
{
Inset * inset = getInset();
if (!inset->editable())
if (!isEditableInset(inset))
return;
//bview->owner()->message(inset->editMessage());
// do we want to keep this?? (JMarc)
if (inset->editable() != Inset::HIGHLY_EDITABLE)
if (!isHighlyEditableInset(inset))
setCursorParUndo(bview);
if (inset->isOpen()) {
@ -1697,7 +1695,7 @@ void LyXText::insertInset(BufferView * bview, Inset * inset)
// inset now after the Undo LyX tries to call inset->Edit(...) again
// and cannot do this as the cursor is behind the inset and GetInset
// does not return the inset!
if (inset->editable() == Inset::HIGHLY_EDITABLE) {
if (isHighlyEditableInset(inset)) {
cursorLeft(bview, true);
}
#endif
@ -1967,7 +1965,7 @@ bool LyXText::gotoNextInset(BufferView * bview,
}
} while (res.par() &&
!(res.par()->getChar(res.pos()) == Paragraph::META_INSET
!(isMetaInset(res.par(), res.pos())
&& (inset = res.par()->getInset(res.pos())) != 0
&& find(codes.begin(), codes.end(), inset->lyxCode())
!= codes.end()
@ -1976,7 +1974,7 @@ bool LyXText::gotoNextInset(BufferView * bview,
== contents)));
if (res.par()) {
setCursor(bview, res.par(), res.pos());
setCursor(bview, res.par(), res.pos(), false);
return true;
}
return false;
@ -2115,7 +2113,7 @@ void LyXText::setCursor(BufferView *bview, LyXCursor & cur, Paragraph * par,
y += row->baseline();
// y is now the cursor baseline
cur.y(y);
// now get the cursors x position
float x;
float fill_separator;

View File

@ -52,6 +52,7 @@ public:
MU,
/// Percent of columnwidth both "%" or "%c"
PW,
///
PE,
/// Percent of pagewidth
PP,