mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 01:59:02 +00:00
the merge from branch debugstream
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@180 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
cad4d9a025
commit
35584afc11
52
ChangeLog
52
ChangeLog
@ -10,6 +10,40 @@
|
||||
|
||||
1999-10-05 Lars Gullik Bjønnes <larsbj@lyx.org>
|
||||
|
||||
* autogen.sh (AUTOCONF): let the autogen script create the
|
||||
POTFILES.in file too. POTFILES.in should perhaps now not be
|
||||
included in the cvs module.
|
||||
|
||||
* some more files changed to use C++ includes instead of C ones.
|
||||
|
||||
* src/filedlg.C (Reread): fixed a bug wrt Time. It was appended
|
||||
not assigned.
|
||||
(Reread): added tostr to nlink. buggy output otherwise.
|
||||
(Reread): added a string() around szMode when assigning to Buffer,
|
||||
without this I got a log of garbled info strings.
|
||||
|
||||
* acconfig.h: commented out the PTR_AS_INT macros. They should not
|
||||
be needed.
|
||||
|
||||
* I have added several ostream & operator<<(ostream &, some_type)
|
||||
functions. This has been done to avoid casting and warnings when
|
||||
outputting enums to lyxerr. This as thus eliminated a lot of
|
||||
explicit casts and has made the code clearer. Among the enums
|
||||
affected: kb_action, InsetLatexAccent::ACCENT_TYPE, a couple of
|
||||
mathed enums, some font enum the Debug::type enum.
|
||||
|
||||
* src/support/lyxstring.h (clear): missing method. equivalent of
|
||||
erase(0, npos).
|
||||
|
||||
* all files that contained "stderr": rewrote constructs that used
|
||||
stderr to use lyxerr instead. (except bmtable)
|
||||
|
||||
* src/support/DebugStream.h (level): and the passed t with
|
||||
Debug::ANY to avoid spurious bits set.
|
||||
|
||||
* src/debug.h (Debug::type value): made it accept strings of the
|
||||
type INFO,INIT,KEY.
|
||||
|
||||
* configure.in (Check for programs): Added a check for kpsewhich,
|
||||
the latex generation will use this later to better the dicovery of
|
||||
all used files.
|
||||
@ -30,6 +64,18 @@
|
||||
* src/bufferparams.C (BufferParams): default input encoding is now
|
||||
"latin1"
|
||||
|
||||
* acinclude.m4 (cross_compiling): comment out macro
|
||||
LYX_GXX_STRENGTH_REDUCE.
|
||||
|
||||
* acconfig.h: make sure that const is not defined (to empty) when
|
||||
we are compiling C++. Remove commented out code using SIZEOF_xx
|
||||
macros.
|
||||
|
||||
* configure.in : move the test for const and inline as late as
|
||||
possible so that these C tests do not interefere with C++ ones.
|
||||
Remove the call to LYX_GXX_STRENGTH_REDUCE, since its usefulness
|
||||
has not been proven.
|
||||
|
||||
1999-10-04 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
|
||||
|
||||
* src/table.C (getDocBookAlign): remove bad default value for
|
||||
@ -42,6 +88,12 @@
|
||||
* lib/reLyX/.cvsignore: add configure and aclocal.m4 to the list
|
||||
of files to ignore.
|
||||
|
||||
1999-10-04 Lars Gullik Bjønnes <larsbj@lyx.org>
|
||||
|
||||
* Most files: finished the change from the old error code to use
|
||||
DebugStream for all lyxerr debugging. Only minor changes remain
|
||||
(e.g. the setting of debug levels using strings instead of number)
|
||||
|
||||
1999-10-02 Lars Gullik Bjønnes <larsbj@lyx.org>
|
||||
|
||||
* src/layout.C (Add): Changed to use compare_no_case instead of
|
||||
|
@ -116,12 +116,15 @@ char * strerror(int n);
|
||||
#endif
|
||||
*/
|
||||
|
||||
/*
|
||||
#if SIZEOF_VOID_P == SIZEOF_INT
|
||||
# define PTR_AS_INT(p) int(p)
|
||||
#else
|
||||
# define PTR_AS_INT(p) long(p)
|
||||
#endif
|
||||
*/
|
||||
|
||||
/* do we need this anymore?*/
|
||||
#ifdef BROKEN_CONST
|
||||
#include <string.h>
|
||||
#include "broken_const.h"
|
||||
@ -136,6 +139,12 @@ char * strerror(int n);
|
||||
/**/#undef inline
|
||||
#endif
|
||||
|
||||
/* C++ always has a good enough `const' */
|
||||
#if defined const && defined __cplusplus
|
||||
/**/#undef const
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __EMX__
|
||||
#include "os2_defines.h"
|
||||
#endif
|
||||
|
44
acinclude.m4
44
acinclude.m4
@ -195,28 +195,28 @@ else
|
||||
fi
|
||||
])dnl
|
||||
|
||||
|
||||
AC_DEFUN(LYX_GXX_STRENGTH_REDUCE,[
|
||||
#check for the strength reduction bug of gcc
|
||||
if test x$GXX = xyes && test $cross_compiling = no ; then
|
||||
AC_CACHE_CHECK( "for gcc strength-reduce bug", ac_cv_c_gcc_strength_bug,
|
||||
AC_TRY_RUN([
|
||||
int main(void) {
|
||||
static int Array[[3]];
|
||||
unsigned int B = 3;
|
||||
int i;
|
||||
for(i=0; i<B; i++) Array[[i]] = i - 3;
|
||||
exit( Array[[1]] != -2 );
|
||||
}],
|
||||
ac_cv_c_gcc_strength_bug="no",
|
||||
ac_cv_c_gcc_strength_bug="yes",
|
||||
ac_cv_c_gcc_strength_bug="yes") )
|
||||
if test "$ac_cv_c_gcc_strength_bug" = "yes"
|
||||
then
|
||||
CXXFLAGS="$CXXFLAGS -fno-strength-reduce"
|
||||
fi
|
||||
fi
|
||||
])dnl
|
||||
dnl We do not use this one anymore.
|
||||
dnl AC_DEFUN(LYX_GXX_STRENGTH_REDUCE,[
|
||||
dnl #check for the strength reduction bug of gcc
|
||||
dnl if test x$GXX = xyes && test $cross_compiling = no ; then
|
||||
dnl AC_CACHE_CHECK( "for gcc strength-reduce bug", ac_cv_c_gcc_strength_bug,
|
||||
dnl AC_TRY_RUN([
|
||||
dnl int main(void) {
|
||||
dnl static int Array[[3]];
|
||||
dnl unsigned int B = 3;
|
||||
dnl int i;
|
||||
dnl for(i=0; i<B; i++) Array[[i]] = i - 3;
|
||||
dnl exit( Array[[1]] != -2 );
|
||||
dnl }],
|
||||
dnl ac_cv_c_gcc_strength_bug="no",
|
||||
dnl ac_cv_c_gcc_strength_bug="yes",
|
||||
dnl ac_cv_c_gcc_strength_bug="yes") )
|
||||
dnl if test "$ac_cv_c_gcc_strength_bug" = "yes"
|
||||
dnl then
|
||||
dnl CXXFLAGS="$CXXFLAGS -fno-strength-reduce"
|
||||
dnl fi
|
||||
dnl fi
|
||||
dnl ])dnl
|
||||
|
||||
dnl Usage: LYX_CXX_RTTI : checks whether the C++ compiler
|
||||
dnl supports RTTI
|
||||
|
24
autogen.sh
24
autogen.sh
@ -39,3 +39,27 @@ else
|
||||
exit
|
||||
fi
|
||||
|
||||
echo "Creating POTFILES.in..."
|
||||
cat <<EOF > tmppot
|
||||
#
|
||||
# This file is automatically generated by autogen.sh. This command was
|
||||
# used to extract the files from the sources:
|
||||
#
|
||||
# grep -E "_\(\".*\"\)" \`find src -name \*.[hHC]\` | \\
|
||||
# awk 'BEGIN {FS= ":"} {print $1}' | sort | uniq
|
||||
#
|
||||
# This must be done when standing in lyx/
|
||||
#
|
||||
# This is all the files that contains internationalization strings.
|
||||
|
||||
EOF
|
||||
|
||||
grep -E "_\(\".*\"\)" `find src -name \*.[hHC]` | \
|
||||
awk 'BEGIN {FS= ":"} {print $1}' | sort | uniq >> tmppot
|
||||
mv tmppot po/POTFILES.in
|
||||
echo "done"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
13
configure.in
13
configure.in
@ -57,14 +57,8 @@ AC_LANG_CPLUSPLUS
|
||||
LYX_PROG_CXX
|
||||
AC_PROG_CXXCPP
|
||||
|
||||
### Compiler Characteristics
|
||||
AC_C_CONST
|
||||
AC_C_INLINE
|
||||
|
||||
### check the size of pointers and ints
|
||||
# the defaults are given for cross compilation.
|
||||
AC_CHECK_SIZEOF(void *, 4)
|
||||
AC_CHECK_SIZEOF(int, 4)
|
||||
LYX_CXX_MUTABLE
|
||||
LYX_CXX_PARTIAL
|
||||
LYX_CXX_EXPLICIT
|
||||
@ -73,9 +67,6 @@ LYX_CXX_STL_STRING
|
||||
LYX_CXX_NAMESPACES
|
||||
LYX_CXX_RTTI
|
||||
|
||||
### check for compiler brokenness
|
||||
LYX_GXX_STRENGTH_REDUCE
|
||||
|
||||
### Libarary Files
|
||||
dnl by testing these we check if it is ok to have
|
||||
dnl -lc and -lm as args to the compiler
|
||||
@ -147,6 +138,10 @@ fi
|
||||
### Setup GNU gettext
|
||||
dnl GNU gettext is written in C
|
||||
AC_LANG_C
|
||||
# Some tests that may be useful for gettext
|
||||
AC_C_CONST
|
||||
AC_C_INLINE
|
||||
# Do the real setup now
|
||||
AM_GNU_GETTEXT
|
||||
# a hack for those who try to change LyX, but do not have gettext installed
|
||||
case "${XGETTEXT}" in
|
||||
|
@ -2,6 +2,8 @@ reLyX
|
||||
noweb2lyx
|
||||
Makefile.in
|
||||
Makefile
|
||||
aclocal.m4
|
||||
configure
|
||||
config.log
|
||||
config.status
|
||||
configure
|
||||
|
@ -1,13 +1,14 @@
|
||||
#
|
||||
# I used this to extract the files from the sources:
|
||||
# This file is automatically generated by autogen.sh. This command was
|
||||
# used to extract the files from the sources:
|
||||
#
|
||||
# grep -E "_\(\".*\"\)" `find src -name \*.[hHC] | \
|
||||
# awk 'BEGIN {FS = ":"}{print $1}' | sort | uniq
|
||||
# grep -E "_\(\".*\"\)" `find src -name \*.[hHC]` | \
|
||||
# awk 'BEGIN {FS= ":"} {print }' | sort | uniq
|
||||
#
|
||||
# This must be done when standing in lyx/
|
||||
#
|
||||
|
||||
# This is all the files that contains internationalization strings.
|
||||
|
||||
src/BufferView.C
|
||||
src/Chktex.C
|
||||
src/FontLoader.C
|
||||
@ -79,5 +80,3 @@ src/support/filetools.C
|
||||
src/support/lyxlib.h
|
||||
src/text.C
|
||||
src/text2.C
|
||||
|
||||
|
||||
|
@ -33,7 +33,7 @@
|
||||
#include "lyxscreen.h"
|
||||
#include "up.xpm"
|
||||
#include "down.xpm"
|
||||
#include "error.h"
|
||||
#include "debug.h"
|
||||
#include "lyxdraw.h"
|
||||
#include "lyx_gui_misc.h"
|
||||
#include "BackStack.h"
|
||||
@ -90,7 +90,7 @@ BufferView::~BufferView()
|
||||
|
||||
void BufferView::setBuffer(Buffer *b)
|
||||
{
|
||||
lyxerr.debug("Setting buffer in BufferView");
|
||||
lyxerr.debug() << "Setting buffer in BufferView" << endl;
|
||||
if (_buffer) {
|
||||
_buffer->InsetSleep();
|
||||
_buffer->delUser(this);
|
||||
@ -112,7 +112,7 @@ void BufferView::setBuffer(Buffer *b)
|
||||
}
|
||||
|
||||
if (_buffer) {
|
||||
lyxerr.debug(string(" Buffer addr: ") + tostr(_buffer));
|
||||
lyxerr.debug() << " Buffer addr: " << _buffer << endl;
|
||||
_buffer->addUser(this);
|
||||
_owner->getMenus()->showMenus();
|
||||
// If we don't have a text object for this, we make one
|
||||
@ -127,7 +127,7 @@ void BufferView::setBuffer(Buffer *b)
|
||||
updateAllVisibleBufferRelatedPopups();
|
||||
_buffer->InsetWakeup();
|
||||
} else {
|
||||
lyxerr.debug(" No Buffer!");
|
||||
lyxerr.debug() << " No Buffer!" << endl;
|
||||
_owner->getMenus()->hideMenus();
|
||||
//workAreaExpose();
|
||||
updateScrollbar();
|
||||
@ -166,7 +166,7 @@ static bool lgb_hack = false;
|
||||
|
||||
void BufferView::redraw()
|
||||
{
|
||||
lyxerr.debug("BufferView::redraw()");
|
||||
lyxerr.debug() << "BufferView::redraw()" << endl;
|
||||
lgb_hack = true;
|
||||
fl_redraw_object(work_area);
|
||||
fl_redraw_object(scrollbar);
|
||||
@ -255,7 +255,7 @@ void BufferView::updateScrollbar()
|
||||
|
||||
void BufferView::redoCurrentBuffer()
|
||||
{
|
||||
lyxerr.debug("BufferView::redoCurrentBuffer");
|
||||
lyxerr.debug() << "BufferView::redoCurrentBuffer" << endl;
|
||||
if (_buffer && _buffer->text) {
|
||||
resize();
|
||||
_owner->updateLayoutChoice();
|
||||
@ -265,7 +265,7 @@ void BufferView::redoCurrentBuffer()
|
||||
|
||||
int BufferView::resizeCurrentBuffer()
|
||||
{
|
||||
lyxerr.debug("resizeCurrentBuffer");
|
||||
lyxerr.debug() << "resizeCurrentBuffer" << endl;
|
||||
|
||||
LyXParagraph *par = 0;
|
||||
LyXParagraph *selstartpar = 0;
|
||||
@ -1328,13 +1328,13 @@ void BufferView::CursorToggleCB(FL_OBJECT *ob, long)
|
||||
Window tmpwin;
|
||||
int tmp;
|
||||
XGetInputFocus(fl_display, &tmpwin, &tmp);
|
||||
lyxerr.debug(string("tmpwin: ") + tostr(tmpwin));
|
||||
lyxerr.debug(string("window: ")
|
||||
+ tostr(view->_owner->getForm()->window));
|
||||
lyxerr.debug(string("work_area_focus: ")
|
||||
+ tostr(view->work_area_focus));
|
||||
lyxerr.debug(string("lyx_focus : ")
|
||||
+ tostr(view->lyx_focus));
|
||||
if (lyxerr.debugging()) {
|
||||
lyxerr << "tmpwin: " << tmpwin
|
||||
<< "\nwindow: " << view->_owner->getForm()->window
|
||||
<< "\nwork_area_focus: " << view->work_area_focus
|
||||
<< "\nlyx_focus : " << view->lyx_focus
|
||||
<< endl;
|
||||
}
|
||||
if (tmpwin != view->_owner->getForm()->window) {
|
||||
view->lyx_focus = false;
|
||||
goto skip_timer;
|
||||
|
@ -24,7 +24,7 @@
|
||||
#include "support/filetools.h"
|
||||
#include "lyxlex.h"
|
||||
#include "support/FileInfo.h"
|
||||
#include "error.h"
|
||||
#include "debug.h"
|
||||
#include "support/syscall.h"
|
||||
#include "support/syscontr.h"
|
||||
#include "pathstack.h"
|
||||
|
@ -46,9 +46,9 @@ DepTable::DepTable(string const & f,
|
||||
char tmp2[256];
|
||||
sprintf(tmp1, "%lu", new_sum);
|
||||
sprintf(tmp2, "%lu", old_sum);
|
||||
lyxerr.debug("New file inserted in deplog: " +
|
||||
file + " " +
|
||||
tmp1 + " " + tmp2);
|
||||
lyxerr.debug() << "New file inserted in deplog: "
|
||||
<< file << " "
|
||||
<< tmp1 << " " << tmp2 << endl;
|
||||
}
|
||||
next = 0;
|
||||
}
|
||||
@ -79,8 +79,8 @@ void DepTable::update()
|
||||
char tmp2[256];
|
||||
sprintf(tmp1, "%lu", new_sum);
|
||||
sprintf(tmp2, "%lu", old_sum);
|
||||
lyxerr.debug("update: " + file + " " +
|
||||
tmp1 + " " + tmp2);
|
||||
lyxerr.debug() << "update: " << file << " "
|
||||
<< tmp1 << " " << tmp2 << endl;
|
||||
}
|
||||
}
|
||||
if (next) next->update();
|
||||
@ -141,9 +141,9 @@ void DepTable::read(string const &f)
|
||||
char tmp2[255];
|
||||
sprintf(tmp1, "%lu", one);
|
||||
sprintf(tmp2, "%lu", two);
|
||||
lyxerr.debug(string("read dep: ") +
|
||||
nome + " " + tmp1 +
|
||||
" " + tmp2);
|
||||
lyxerr.debug() << "read dep: "
|
||||
<< nome << " " << tmp1
|
||||
<< " " << tmp2 << endl;
|
||||
}
|
||||
insert(string(nome), false, one, two);
|
||||
}
|
||||
@ -158,8 +158,8 @@ void DepTable::write(FILE * f)
|
||||
char tmp2[255];
|
||||
sprintf(tmp1, "%lu", new_sum);
|
||||
sprintf(tmp2, "%lu", old_sum);
|
||||
lyxerr.print("Write dep: " + file + " " +
|
||||
tmp1 + " " + tmp2);
|
||||
lyxerr << "Write dep: " << file << " "
|
||||
<< tmp1 << " " << tmp2 << endl;
|
||||
}
|
||||
fprintf(f, "%s %lu %lu\n", file.c_str(),
|
||||
new_sum, old_sum);
|
||||
|
@ -7,7 +7,7 @@
|
||||
* Copyright (C) 1997 Asger Alstrup
|
||||
* and the LyX Team.
|
||||
*
|
||||
*======================================================*/
|
||||
* ======================================================*/
|
||||
|
||||
#include <config.h>
|
||||
#include <cmath> // fabs()
|
||||
@ -18,7 +18,7 @@
|
||||
#endif
|
||||
|
||||
#include "FontInfo.h"
|
||||
#include "error.h"
|
||||
#include "debug.h"
|
||||
#include "lyxrc.h" // lyxrc.use_scalable_fonts
|
||||
#include "support/lstrings.h"
|
||||
|
||||
@ -37,8 +37,8 @@ string FontInfo::getFontname(int size)
|
||||
if (sizes[i] == 0) {
|
||||
// Scalable font should not be considered close
|
||||
} else if (sizes[i] == size) {
|
||||
lyxerr.debug(string("Exact font match with\n")
|
||||
+ strings[i], Error::FONT);
|
||||
lyxerr[Debug::FONT] << "Exact font match with\n"
|
||||
<< strings[i] << endl;
|
||||
return strings[i];
|
||||
} else if (fabs(sizes[i] - size - 0.1) < error) {
|
||||
error = fabs(sizes[i] - size - 0.1);
|
||||
@ -49,8 +49,8 @@ string FontInfo::getFontname(int size)
|
||||
if (scalable && lyxrc->use_scalable_fonts) {
|
||||
// We can use scalable
|
||||
string font = resize(strings[scaleindex], size);
|
||||
lyxerr.debug("Using scalable font to get\n"
|
||||
+ font, Error::FONT);
|
||||
lyxerr[Debug::FONT] << "Using scalable font to get\n"
|
||||
<< font << endl;
|
||||
return font;
|
||||
}
|
||||
|
||||
@ -61,9 +61,9 @@ string FontInfo::getFontname(int size)
|
||||
}
|
||||
|
||||
// We use the closest match
|
||||
lyxerr.debug(string("Using closest font match to get size ")
|
||||
+ tostr(size)
|
||||
+ " with\n" + strings[closestind], Error::FONT);
|
||||
lyxerr[Debug::FONT] << "Using closest font match to get size "
|
||||
<< size
|
||||
<< " with\n" << strings[closestind] << endl;
|
||||
return strings[closestind];
|
||||
}
|
||||
|
||||
@ -106,7 +106,7 @@ void FontInfo::query()
|
||||
return;
|
||||
|
||||
if (pattern.empty()) {
|
||||
lyxerr.print("Can not use empty font name for font query.");
|
||||
lyxerr << "Can not use empty font name for font query." << endl;
|
||||
queried = true;
|
||||
return;
|
||||
}
|
||||
|
@ -10,8 +10,8 @@
|
||||
*======================================================*/
|
||||
|
||||
#include <config.h>
|
||||
#include <math.h> // fabs()
|
||||
#include <stdlib.h> // atoi()
|
||||
#include <cmath> // fabs()
|
||||
#include <cstdlib> // atoi()
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "FontLoader.h"
|
||||
@ -20,7 +20,7 @@
|
||||
#include "gettext.h"
|
||||
#include "FontLoader.h"
|
||||
#include "FontInfo.h"
|
||||
#include "error.h"
|
||||
#include "debug.h"
|
||||
#include "lyxrc.h" // lyxrc.font_*
|
||||
extern LyXRC * lyxrc;
|
||||
#include "minibuffer.h"
|
||||
@ -208,8 +208,8 @@ XFontStruct* FontLoader::doLoad(LyXFont::FONT_FAMILY family,
|
||||
string font = fontinfo[family][series][shape]->getFontname(fsize);
|
||||
|
||||
if (font.empty()) {
|
||||
lyxerr.print("No font matches request. Using 'fixed'.");
|
||||
lyxerr.print("Start LyX as 'lyx -dbg 515' to get more information.");
|
||||
lyxerr << "No font matches request. Using 'fixed'." << endl;
|
||||
lyxerr << "Start LyX as 'lyx -dbg 515' to get more information." << endl;
|
||||
font = "fixed";
|
||||
}
|
||||
|
||||
@ -220,13 +220,13 @@ XFontStruct* FontLoader::doLoad(LyXFont::FONT_FAMILY family,
|
||||
|
||||
if (fs == 0) {
|
||||
if (font=="fixed") {
|
||||
lyxerr.print("We're doomed. Can't get 'fixed' font.");
|
||||
lyxerr << "We're doomed. Can't get 'fixed' font." << endl;
|
||||
} else {
|
||||
lyxerr.print("Could not get font. Using 'fixed'.");
|
||||
lyxerr << "Could not get font. Using 'fixed'." << endl;
|
||||
fs = XLoadQueryFont(fl_display, "fixed");
|
||||
}
|
||||
} else {
|
||||
if (lyxerr.debugging(Error::FONT)) {
|
||||
if (lyxerr.debugging(Debug::FONT)) {
|
||||
// Tell user the font matching
|
||||
LyXFont f;
|
||||
f.setFamily(family);
|
||||
@ -239,8 +239,8 @@ XFontStruct* FontLoader::doLoad(LyXFont::FONT_FAMILY family,
|
||||
f.setNoun(LyXFont::INHERIT);
|
||||
f.setLatex(LyXFont::INHERIT);
|
||||
f.setColor(LyXFont::INHERIT_COLOR);
|
||||
lyxerr.print(string("Font '") + f.stateText()
|
||||
+ "' matched by\n" + font + '\n');
|
||||
lyxerr << "Font '" << f.stateText()
|
||||
<< "' matched by\n" << font << endl;
|
||||
}
|
||||
}
|
||||
minibuffer->Reset();
|
||||
|
@ -22,4 +22,3 @@ typedef lyxstring string;
|
||||
//typedef lyxwstring wstring;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
141
src/LaTeX.C
141
src/LaTeX.C
@ -24,7 +24,7 @@
|
||||
#include "LaTeX.h"
|
||||
#include "lyxlex.h"
|
||||
#include "support/FileInfo.h"
|
||||
#include "error.h"
|
||||
#include "debug.h"
|
||||
#include "support/lyxlib.h"
|
||||
#include "support/syscall.h"
|
||||
#include "support/syscontr.h"
|
||||
@ -124,7 +124,7 @@ void TeXErrors::scanError(LyXLex &lex)
|
||||
errstr += tmp;
|
||||
tmp = frontStrip(readLine(lex.getFile()));
|
||||
}
|
||||
lyxerr.debug("tmp: " + errstr);
|
||||
lyxerr.debug() << "tmp: " << errstr << endl;
|
||||
int line = 0;
|
||||
// unfortunately the error line is not always given
|
||||
// by "l.###" in the beginning of the error string
|
||||
@ -190,14 +190,14 @@ void TeXErrors::insertError(int line, string const &error_desc,
|
||||
|
||||
void TeXErrors::printErrors()
|
||||
{
|
||||
lyxerr.print("Printing errors.");
|
||||
lyxerr << "Printing errors." << endl;
|
||||
if (errors) {
|
||||
Error *tmperr = errors;
|
||||
do {
|
||||
lyxerr.print(string("Error in line ")
|
||||
+ tostr(tmperr->error_in_line)
|
||||
+ ": " + tmperr->error_desc
|
||||
+ '\n' + tmperr->error_text);
|
||||
lyxerr << "Error in line "
|
||||
<< tmperr->error_in_line
|
||||
<< ": " << tmperr->error_desc
|
||||
<< '\n' << tmperr->error_text << endl;
|
||||
//%d: %s\n%s\n", tmperr->error_in_line,
|
||||
// tmperr->error_desc.c_str(),
|
||||
// tmperr->error_text.c_str());
|
||||
@ -214,17 +214,17 @@ void TeXErrors::printWarnings()
|
||||
|
||||
void TeXErrors::printStatus()
|
||||
{
|
||||
lyxerr.print("Error struct:");
|
||||
lyxerr.print(string(" status: ") + tostr(status));
|
||||
lyxerr.print(string(" no err: ") + tostr(number_of_errors));
|
||||
if (status == LaTeX::NO_ERRORS) lyxerr.print("NO_ERRORS");
|
||||
if (status & LaTeX::NO_LOGFILE) lyxerr.print("NO_LOGFILE");
|
||||
if (status & LaTeX::NO_OUTPUT) lyxerr.print("NO_OUTPUT");
|
||||
if (status & LaTeX::UNDEF_REF) lyxerr. print("UNDEF_REF");
|
||||
if (status & LaTeX::RERUN) lyxerr. print("RERUN");
|
||||
if (status & LaTeX::TEX_ERROR) lyxerr.print("TEX_ERROR");
|
||||
if (status & LaTeX::TEX_WARNING) lyxerr.print("TEX_WARNING");
|
||||
if (status & LaTeX::NO_FILE) lyxerr.print("NO_FILE");
|
||||
lyxerr << "Error struct:"
|
||||
<< "\n status: " << status
|
||||
<< "\n no err: " << number_of_errors << endl;
|
||||
if (status == LaTeX::NO_ERRORS) lyxerr << "NO_ERRORS" << endl;
|
||||
if (status & LaTeX::NO_LOGFILE) lyxerr << "NO_LOGFILE" << endl;
|
||||
if (status & LaTeX::NO_OUTPUT) lyxerr << "NO_OUTPUT" << endl;
|
||||
if (status & LaTeX::UNDEF_REF) lyxerr << "UNDEF_REF" << endl;
|
||||
if (status & LaTeX::RERUN) lyxerr << "RERUN" << endl;
|
||||
if (status & LaTeX::TEX_ERROR) lyxerr << "TEX_ERROR" << endl;
|
||||
if (status & LaTeX::TEX_WARNING) lyxerr << "TEX_WARNING" << endl;
|
||||
if (status & LaTeX::NO_FILE) lyxerr << "NO_FILE" << endl;
|
||||
}
|
||||
|
||||
|
||||
@ -283,26 +283,25 @@ int LaTeX::run(TeXErrors &terr, MiniBuffer *minib)
|
||||
// Update the checksums
|
||||
head.update();
|
||||
|
||||
lyxerr.debug("Dependency file exists", Error::LATEX);
|
||||
lyxerr[Debug::LATEX] << "Dependency file exists" << endl;
|
||||
if (head.sumchange()) {
|
||||
lyxerr.debug("Dependency file has changed",
|
||||
Error::LATEX);
|
||||
lyxerr.debug(string(_("Run #")) + tostr(++count),
|
||||
Error::LATEX);
|
||||
++count;
|
||||
lyxerr[Debug::LATEX]
|
||||
<< "Dependency file has changed\n"
|
||||
<< "Run #" << count << endl;
|
||||
minib->Set(string(_("LaTeX run number ")) + tostr(count));
|
||||
minib->Store();
|
||||
this->operator()();
|
||||
scanres = scanLogFile(terr);
|
||||
if (scanres & LaTeX::ERRORS) return scanres; // return on error
|
||||
} else {
|
||||
lyxerr.debug("return no_change", Error::LATEX);
|
||||
lyxerr[Debug::LATEX] << "return no_change" << endl;
|
||||
return LaTeX::NO_CHANGE;
|
||||
}
|
||||
} else {
|
||||
lyxerr.debug("Dependency file does not exist",
|
||||
Error::LATEX);
|
||||
lyxerr.debug(string(_("Run #")) + tostr(++count),
|
||||
Error::LATEX);
|
||||
++count;
|
||||
lyxerr[Debug::LATEX] << "Dependency file does not exist\n"
|
||||
<< "Run #" << count << endl;
|
||||
head.insert(file, true);
|
||||
minib->Set(string(_("LaTeX run number ")) + tostr(count));
|
||||
minib->Store();
|
||||
@ -356,10 +355,10 @@ int LaTeX::run(TeXErrors &terr, MiniBuffer *minib)
|
||||
//
|
||||
if (rerun || head.sumchange()) {
|
||||
rerun = false;
|
||||
lyxerr.debug("Dep. file has changed or rerun requested",
|
||||
Error::LATEX);
|
||||
lyxerr.debug(string("Run #") + tostr(++count),
|
||||
Error::LATEX);
|
||||
++count;
|
||||
lyxerr[Debug::LATEX]
|
||||
<< "Dep. file has changed or rerun requested\n"
|
||||
<< "Run #" << count << endl;
|
||||
minib->Set(string(_("LaTeX run number ")) + tostr(count));
|
||||
minib->Store();
|
||||
this->operator()();
|
||||
@ -369,7 +368,7 @@ int LaTeX::run(TeXErrors &terr, MiniBuffer *minib)
|
||||
deplog(head); // reads the latex log
|
||||
head.update();
|
||||
} else {
|
||||
lyxerr.debug("Dep. file has NOT changed", Error::LATEX);
|
||||
lyxerr[Debug::LATEX] << "Dep. file has NOT changed" << endl;
|
||||
}
|
||||
|
||||
// 1.5
|
||||
@ -403,7 +402,8 @@ int LaTeX::run(TeXErrors &terr, MiniBuffer *minib)
|
||||
// Yes rerun until message goes away, or until
|
||||
// MAX_RUNS are reached.
|
||||
rerun = false;
|
||||
lyxerr.debug(string(_("Run #")) + tostr(++count), Error::LATEX);
|
||||
++count;
|
||||
lyxerr[Debug::LATEX] << "Run #" << count << endl;
|
||||
minib->Set(string(_("LaTeX run number ")) + tostr(count));
|
||||
minib->Store();
|
||||
this->operator()();
|
||||
@ -415,7 +415,7 @@ int LaTeX::run(TeXErrors &terr, MiniBuffer *minib)
|
||||
|
||||
// Write the dependencies to file.
|
||||
head.write(depfile);
|
||||
lyxerr.debug("Done.", Error::LATEX);
|
||||
lyxerr[Debug::LATEX] << "Done." << endl;
|
||||
return scanres;
|
||||
}
|
||||
|
||||
@ -434,9 +434,9 @@ int LaTeX::operator()()
|
||||
|
||||
bool LaTeX::runMakeIndex(string const &file)
|
||||
{
|
||||
lyxerr.debug("idx file has been made,"
|
||||
" running makeindex on file "
|
||||
+ file, Error::LATEX);
|
||||
lyxerr[Debug::LATEX] << "idx file has been made,"
|
||||
" running makeindex on file "
|
||||
<< file << endl;
|
||||
|
||||
// It should be possible to set the switches for makeindex
|
||||
// sorting style and such. It would also be very convenient
|
||||
@ -503,16 +503,17 @@ int LaTeX::scanLogFile(TeXErrors &terr)
|
||||
else // blank line in the file being read
|
||||
continue;
|
||||
|
||||
lyxerr.debug(token, Error::LATEX);
|
||||
lyxerr[Debug::LATEX] << token << endl;
|
||||
|
||||
if (prefixIs(token, "LaTeX Warning:")) {
|
||||
// Here shall we handle different
|
||||
// types of warnings
|
||||
retval |= LATEX_WARNING;
|
||||
lyxerr.debug("LaTeX Warning.", Error::LATEX);
|
||||
lyxerr[Debug::LATEX] << "LaTeX Warning." << endl;
|
||||
if (contains(token, "Rerun to get cross-references")) {
|
||||
retval |= RERUN;
|
||||
lyxerr.debug("We should rerun.", Error::LATEX);
|
||||
lyxerr[Debug::LATEX]
|
||||
<< "We should rerun." << endl;
|
||||
} else if (contains(token, "Citation")
|
||||
&& contains(token, "on page")
|
||||
&& contains(token, "undefined")) {
|
||||
@ -536,7 +537,7 @@ int LaTeX::scanLogFile(TeXErrors &terr)
|
||||
// Here shall we handle different
|
||||
// types of errors
|
||||
retval |= LATEX_ERROR;
|
||||
lyxerr.debug("LaTeX Error.", Error::LATEX);
|
||||
lyxerr[Debug::LATEX] << "LaTeX Error." << endl;
|
||||
// this is not correct yet
|
||||
terr.scanError(lex);
|
||||
num_errors++;
|
||||
@ -550,7 +551,7 @@ int LaTeX::scanLogFile(TeXErrors &terr)
|
||||
|
||||
if (contains(desc, "Undefined control sequence")) {
|
||||
retval |= TEX_ERROR;
|
||||
lyxerr.debug("TeX Error.", Error::LATEX);
|
||||
lyxerr[Debug::LATEX] << "TeX Error." << endl;
|
||||
terr.scanError(lex);
|
||||
num_errors++;
|
||||
} else {
|
||||
@ -560,7 +561,8 @@ int LaTeX::scanLogFile(TeXErrors &terr)
|
||||
if (prefixIs(tmp, "l.")) {
|
||||
// we have a latex error
|
||||
retval |= TEX_ERROR;
|
||||
lyxerr.debug("TeX Error.", Error::LATEX);
|
||||
lyxerr[Debug::LATEX]
|
||||
<<"TeX Error." << endl;
|
||||
// get the line number:
|
||||
int line = 0;
|
||||
sscanf(tmp.c_str(), "l.%d", &line);
|
||||
@ -636,9 +638,8 @@ void LaTeX::deplog(DepTable & head)
|
||||
}
|
||||
if (foundfile.empty()) continue;
|
||||
|
||||
lyxerr.debug("Found file: "
|
||||
+ foundfile,
|
||||
Error::LATEX);
|
||||
lyxerr[Debug::LATEX] << "Found file: "
|
||||
<< foundfile << endl;
|
||||
// Ok now we found a file.
|
||||
// Now we should make sure that
|
||||
// this is a file that we can
|
||||
@ -648,9 +649,8 @@ void LaTeX::deplog(DepTable & head)
|
||||
// absolute path and should
|
||||
// be inserted.
|
||||
if (AbsolutePath(foundfile)) {
|
||||
lyxerr.debug("AbsolutePath file: "
|
||||
+ foundfile,
|
||||
Error::LATEX);
|
||||
lyxerr[Debug::LATEX] << "AbsolutePath file: "
|
||||
<< foundfile << endl;
|
||||
// On inital insert we want to do the update at once
|
||||
// since this file can not be a file generated by
|
||||
// the latex run.
|
||||
@ -662,22 +662,22 @@ void LaTeX::deplog(DepTable & head)
|
||||
// insert it into head
|
||||
if (FileInfo(OnlyFilename(foundfile)).exist()) {
|
||||
if (suffixIs(foundfile, ".aux")) {
|
||||
lyxerr.debug("We don't want "
|
||||
+ OnlyFilename(foundfile)
|
||||
+ " in the dep file",
|
||||
Error::LATEX);
|
||||
lyxerr[Debug::LATEX] << "We don't want "
|
||||
<< OnlyFilename(foundfile)
|
||||
<< " in the dep file"
|
||||
<< endl;
|
||||
} else if (suffixIs(foundfile, ".tex")) {
|
||||
// This is a tex file generated by LyX
|
||||
// and latex is not likely to change this
|
||||
// during its runs.
|
||||
lyxerr.debug("Tmpdir TeX file: "
|
||||
+ OnlyFilename(foundfile),
|
||||
Error::LATEX);
|
||||
lyxerr[Debug::LATEX] << "Tmpdir TeX file: "
|
||||
<< OnlyFilename(foundfile)
|
||||
<< endl;
|
||||
head.insert(foundfile, true);
|
||||
} else {
|
||||
lyxerr.debug("In tmpdir file:"
|
||||
+ OnlyFilename(foundfile),
|
||||
Error::LATEX);
|
||||
lyxerr[Debug::LATEX] << "In tmpdir file:"
|
||||
<< OnlyFilename(foundfile)
|
||||
<< endl;
|
||||
head.insert(OnlyFilename(foundfile));
|
||||
}
|
||||
continue;
|
||||
@ -689,22 +689,21 @@ void LaTeX::deplog(DepTable & head)
|
||||
// should be inserted.
|
||||
PathPush(path);
|
||||
if (FileInfo(foundfile).exist()) {
|
||||
lyxerr.print("LyX Strange: this should actually never"
|
||||
" happen anymore, this it should be"
|
||||
" handled by the Absolute check.");
|
||||
lyxerr.debug("Same Directory file: "
|
||||
+ foundfile,
|
||||
Error::LATEX);
|
||||
lyxerr << "LyX Strange: this should actually never"
|
||||
" happen anymore, this it should be"
|
||||
" handled by the Absolute check."
|
||||
<< endl;
|
||||
lyxerr[Debug::LATEX] << "Same Directory file: "
|
||||
<< foundfile << endl;
|
||||
head.insert(foundfile);
|
||||
PathPop();
|
||||
continue;
|
||||
}
|
||||
PathPop();
|
||||
|
||||
lyxerr.debug("Not a file or we are unable to find it.",
|
||||
Error::LATEX);
|
||||
|
||||
|
||||
lyxerr[Debug::LATEX]
|
||||
<< "Not a file or we are unable to find it."
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
|
||||
@ -719,7 +718,7 @@ void LaTeX::deptex(DepTable &head)
|
||||
tmp = ChangeExtension(file,
|
||||
all_files[i].extension,
|
||||
true);
|
||||
lyxerr.debug("deptex: " + tmp, Error::LATEX);
|
||||
lyxerr[Debug::LATEX] << "deptex: " << tmp << endl;
|
||||
if (fi.newFile(tmp).exist())
|
||||
head.insert(tmp);
|
||||
}
|
||||
|
@ -16,7 +16,7 @@
|
||||
#endif
|
||||
|
||||
#include "LString.h"
|
||||
#include "error.h"
|
||||
#include "debug.h"
|
||||
#include "lyx_sty.h"
|
||||
#include "lyxrc.h"
|
||||
#include "LaTeXFeatures.h"
|
||||
@ -244,13 +244,10 @@ string LaTeXFeatures::getTClassPreamble(BufferParams const ¶ms)
|
||||
|
||||
|
||||
void LaTeXFeatures::showStruct(BufferParams ¶ms) {
|
||||
lyxerr.print("LyX needs the following commands when LaTeXing:");
|
||||
lyxerr << "LyX needs the following commands when LaTeXing:"
|
||||
// packs
|
||||
lyxerr.print("***** Packages:");
|
||||
lyxerr.print(getPackages(params));
|
||||
lyxerr.print("***** Macros:");
|
||||
lyxerr.print(getMacros(params));
|
||||
lyxerr.print("***** Textclass stuff:");
|
||||
lyxerr.print(getTClassPreamble(params));
|
||||
lyxerr.print("***** done.");
|
||||
<< "\n***** Packages:" << getPackages(params)
|
||||
<< "\n***** Macros:" << getMacros(params)
|
||||
<< "\n***** Textclass stuff:" << getTClassPreamble(params)
|
||||
<< "\n***** done." << endl;
|
||||
}
|
||||
|
@ -22,7 +22,7 @@
|
||||
#include "Literate.h"
|
||||
#include "lyxlex.h"
|
||||
#include "support/FileInfo.h"
|
||||
#include "error.h"
|
||||
#include "debug.h"
|
||||
#include "support/lyxlib.h"
|
||||
#include "support/syscall.h"
|
||||
#include "support/syscontr.h"
|
||||
@ -55,8 +55,7 @@ int Literate::weave(TeXErrors &terr, MiniBuffer *minib)
|
||||
// The class LaTeX does not know the temp path.
|
||||
bufferlist.updateIncludedTeXfiles(GetCWD());
|
||||
|
||||
lyxerr.debug(string(_("Weaving document")),
|
||||
Error::LATEX);
|
||||
lyxerr[Debug::LATEX] << "Weaving document" << endl;
|
||||
minib->Set(string(_("Weaving document")));
|
||||
minib->Store();
|
||||
|
||||
@ -66,7 +65,7 @@ int Literate::weave(TeXErrors &terr, MiniBuffer *minib)
|
||||
tmp2 = literate_filter + " < " + litfile + ".out" + " > " + litfile + ".log";
|
||||
ret1 = one.Startscript(Systemcalls::System, tmp1);
|
||||
ret2 = two.Startscript(Systemcalls::System, tmp2);
|
||||
lyxerr.debug(string(_("LITERATE")) + " {" + tmp1 + "} {" + tmp2 + "}");
|
||||
lyxerr.debug() << "LITERATE {" << tmp1 << "} {" << tmp2 << "}" << endl;
|
||||
scanres = scanLiterateLogFile(terr);
|
||||
if (scanres & Literate::ERRORS) return scanres; // return on literate error
|
||||
|
||||
@ -89,8 +88,7 @@ int Literate::build(TeXErrors &terr, MiniBuffer *minib)
|
||||
// The class LaTeX does not know the temp path.
|
||||
bufferlist.updateIncludedTeXfiles(GetCWD());
|
||||
|
||||
lyxerr.debug(string(_("Building program")),
|
||||
Error::LATEX);
|
||||
lyxerr[Debug::LATEX] << "Building program" << endl;
|
||||
minib->Set(string(_("Building program")));
|
||||
minib->Store();
|
||||
|
||||
@ -101,7 +99,7 @@ int Literate::build(TeXErrors &terr, MiniBuffer *minib)
|
||||
ret1 = one.Startscript(Systemcalls::System, tmp1);
|
||||
ret2 = two.Startscript(Systemcalls::System, tmp2);
|
||||
scanres = scanBuildLogFile(terr);
|
||||
lyxerr.debug("Done.", Error::LATEX);
|
||||
lyxerr[Debug::LATEX] << "Done." << endl;
|
||||
|
||||
return scanres;
|
||||
}
|
||||
@ -129,18 +127,18 @@ int Literate::scanLiterateLogFile(TeXErrors &terr)
|
||||
else // blank line in the file being read
|
||||
continue;
|
||||
|
||||
lyxerr.debug(token, Error::LATEX);
|
||||
lyxerr[Debug::LATEX] << token << endl;
|
||||
|
||||
if (prefixIs(token, "Build Warning:")) {
|
||||
// Here shall we handle different
|
||||
// types of warnings
|
||||
retval |= LATEX_WARNING;
|
||||
lyxerr.debug("Build Warning.", Error::LATEX);
|
||||
lyxerr[Debug::LATEX] << "Build Warning." << endl;
|
||||
} else if (prefixIs(token, "! Build Error:")) {
|
||||
// Here shall we handle different
|
||||
// types of errors
|
||||
retval |= LATEX_ERROR;
|
||||
lyxerr.debug("Build Error.", Error::LATEX);
|
||||
lyxerr[Debug::LATEX] << "Build Error." << endl;
|
||||
// this is not correct yet
|
||||
terr.scanError(lex);
|
||||
num_errors++;
|
||||
@ -172,18 +170,18 @@ int Literate::scanBuildLogFile(TeXErrors &terr)
|
||||
else // blank line in the file being read
|
||||
continue;
|
||||
|
||||
lyxerr.debug(token, Error::LATEX);
|
||||
lyxerr[Debug::LATEX] << token << endl;
|
||||
|
||||
if (prefixIs(token, "Build Warning:")) {
|
||||
// Here shall we handle different
|
||||
// types of warnings
|
||||
retval |= LATEX_WARNING;
|
||||
lyxerr.debug("Build Warning.", Error::LATEX);
|
||||
lyxerr[Debug::LATEX] << "Build Warning." << endl;
|
||||
} else if (prefixIs(token, "! Build Error:")) {
|
||||
// Here shall we handle different
|
||||
// types of errors
|
||||
retval |= LATEX_ERROR;
|
||||
lyxerr.debug("Build Error.", Error::LATEX);
|
||||
lyxerr[Debug::LATEX] << "Build Error." << endl;
|
||||
// this is not correct yet
|
||||
terr.scanError(lex);
|
||||
num_errors++;
|
||||
|
@ -1,12 +1,12 @@
|
||||
/* This file is part of
|
||||
* ======================================================
|
||||
*
|
||||
* LyX, The Document Processor
|
||||
*
|
||||
* Copyright (C) 1995 Matthias Ettrich
|
||||
* Copyright (C) 1995-1998 The LyX Team.
|
||||
*
|
||||
*======================================================*/
|
||||
* ======================================================
|
||||
*
|
||||
* LyX, The Document Processor
|
||||
*
|
||||
* Copyright 1995 Matthias Ettrich
|
||||
* Copyright 1995-1999 The LyX Team.
|
||||
*
|
||||
* ======================================================*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
#endif
|
||||
|
||||
#include "LyXAction.h"
|
||||
#include "error.h"
|
||||
#include "debug.h"
|
||||
#include "gettext.h"
|
||||
#include "support/lstrings.h"
|
||||
|
||||
@ -452,10 +452,9 @@ int LyXAction::searchActionArg(kb_action action, char const *arg)
|
||||
for (int i=0; i<psd_idx; i++) {
|
||||
if (action==tb->action && !strcmp(tb->name, arg)) {
|
||||
|
||||
lyxerr.debug(string("Pseudoaction already exist[")
|
||||
+ tostr(action) + '|'
|
||||
+ tostr(arg) + ']',
|
||||
Error::KEY);
|
||||
lyxerr[Debug::KEY] << "Pseudoaction already exist["
|
||||
<< action << '|'
|
||||
<< arg << ']' << endl;
|
||||
|
||||
return LFUN_LASTACTION+i;
|
||||
}
|
||||
@ -474,8 +473,8 @@ int LyXAction::getPseudoAction(kb_action action, char const *arg)
|
||||
if (psdaction >= 0) return psdaction;
|
||||
|
||||
if (psd_idx>=MAX_PSEUDO_ACTION) {
|
||||
lyxerr.print("Lyx Error: No more pseudo-actions allowed");
|
||||
lyxerr.print(" Tell the developers.");
|
||||
lyxerr << "Lyx Error: No more pseudo-actions allowed"
|
||||
<< " Tell the developers." << endl;
|
||||
return -1;
|
||||
}
|
||||
lyx_func_args[psd_idx].name = strdup(arg);
|
||||
@ -493,7 +492,7 @@ int LyXAction::retrieveActionArg(int i, char const** arg)
|
||||
*arg = lyx_func_args[i].name;
|
||||
return (int)lyx_func_args[i].action;
|
||||
} else {
|
||||
lyxerr.print("Lyx Error: Unrecognized pseudo-action");
|
||||
lyxerr << "Lyx Error: Unrecognized pseudo-action" << endl;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -526,9 +525,9 @@ int LyXAction::LookupFunc(char const *func)
|
||||
}
|
||||
if (arg && action >= 0) {
|
||||
action = getPseudoAction((kb_action)action, arg);
|
||||
lyxerr.debug(string("Pseudo action_arg[")
|
||||
+ tostr(action) + '|'
|
||||
+ tostr(arg) + ']',Error::KEY);
|
||||
lyxerr[Debug::KEY] << "Pseudo action_arg["
|
||||
<< action << '|'
|
||||
<< arg << ']' << endl;
|
||||
}
|
||||
return action;
|
||||
}
|
||||
@ -749,8 +748,12 @@ bool LyXAction::isFuncRO(kb_action action) const
|
||||
} else
|
||||
if (k<0) l = m+1; else r = m;
|
||||
}
|
||||
lyxerr.debug(string("RO[") + tostr(action)
|
||||
+ string(" ") + tostr(is_ro) + string("]"));
|
||||
lyxerr.debug() << "RO[" << action
|
||||
<< " " << is_ro << "]" << endl;
|
||||
return is_ro;
|
||||
}
|
||||
|
||||
ostream & operator<<(ostream & o, kb_action action)
|
||||
{
|
||||
return o << int(action);
|
||||
}
|
||||
|
@ -22,7 +22,7 @@
|
||||
#include "minibuffer.h"
|
||||
#include "lyxfunc.h"
|
||||
#include "lyx.xpm"
|
||||
#include "error.h"
|
||||
#include "debug.h"
|
||||
#include "layout_forms.h"
|
||||
#include "intl.h"
|
||||
#include "lyxrc.h"
|
||||
@ -51,7 +51,7 @@ LyXView::LyXView(int width, int height)
|
||||
{
|
||||
fd_form_main = create_form_form_main(width,height);
|
||||
fl_set_form_atclose(_form, atCloseMainFormCB, 0);
|
||||
lyxerr.debug("Initializing LyXFunc");
|
||||
lyxerr.debug() << "Initializing LyXFunc" << endl;
|
||||
lyxfunc = new LyXFunc(this);
|
||||
intl = new Intl;
|
||||
}
|
||||
@ -69,7 +69,7 @@ LyXView::~LyXView()
|
||||
|
||||
/// Redraw the main form.
|
||||
void LyXView::redraw() {
|
||||
lyxerr.debug("LyXView::redraw()");
|
||||
lyxerr.debug() << "LyXView::redraw()" << endl;
|
||||
fl_redraw_form(_form);
|
||||
minibuffer->Activate();
|
||||
}
|
||||
@ -95,7 +95,7 @@ void LyXView::UpdateTimerCB(FL_OBJECT *ob, long)
|
||||
// Callback for autosave timer
|
||||
void LyXView::AutosaveTimerCB(FL_OBJECT *, long)
|
||||
{
|
||||
lyxerr.debug("Running AutoSave()");
|
||||
lyxerr.debug() << "Running AutoSave()" << endl;
|
||||
AutoSave();
|
||||
}
|
||||
|
||||
|
@ -70,9 +70,8 @@ lyx_SOURCES = \
|
||||
credits.h \
|
||||
credits_form.C \
|
||||
credits_form.h \
|
||||
debug.h \
|
||||
definitions.h \
|
||||
error.C \
|
||||
error.h \
|
||||
figure.h \
|
||||
filedlg.C \
|
||||
filedlg.h \
|
||||
@ -175,7 +174,7 @@ lyx_SOURCES = \
|
||||
vspace.C \
|
||||
vspace.h
|
||||
|
||||
lyx_main.o: lyx_main.C lyx_main.h config.h version.h error.h gettext.h
|
||||
lyx_main.o: lyx_main.C lyx_main.h config.h version.h debug.h gettext.h
|
||||
$(CXXCOMPILE) -DLYX_DIR=\"$(LYX_DIR)\" -DTOP_SRCDIR=\"$(top_srcdir)\" \
|
||||
-DLYX_NAME=\"$(PACKAGE)\" -c $(top_srcdir)/src/lyx_main.C
|
||||
|
||||
|
@ -1,18 +1,18 @@
|
||||
// -*- C++ -*-
|
||||
/* This file is part of
|
||||
* ======================================================
|
||||
*
|
||||
* LyX, The Document Processor
|
||||
*
|
||||
* Copyright (C) 1995 1996 Matthias Ettrich
|
||||
* and the LyX Team.
|
||||
*
|
||||
*======================================================*/
|
||||
* ======================================================
|
||||
*
|
||||
* LyX, The Document Processor
|
||||
*
|
||||
* Copyright 1995 Matthias Ettrich
|
||||
* Copyright 1995-1999 The LyX Team.
|
||||
*
|
||||
* ======================================================*/
|
||||
|
||||
#ifndef _SPACING_H
|
||||
#define _SPACING_H
|
||||
#ifndef SPACING_H
|
||||
#define SPACING_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <cstdio>
|
||||
|
||||
///
|
||||
class Spacing {
|
||||
|
76
src/buffer.C
76
src/buffer.C
@ -68,7 +68,7 @@
|
||||
#include "Literate.h"
|
||||
#include "Chktex.h"
|
||||
#include "LyXView.h"
|
||||
#include "error.h"
|
||||
#include "debug.h"
|
||||
#include "LaTeXFeatures.h"
|
||||
#include "support/syscall.h"
|
||||
#include "support/lyxlib.h"
|
||||
@ -116,7 +116,7 @@ Buffer::Buffer(string const & file, LyXRC *lyxrc, bool ronly)
|
||||
inset_slept = false;
|
||||
users = 0;
|
||||
lyxvc.setBuffer(this);
|
||||
lyxerr.debug("Buffer::Buffer()");
|
||||
lyxerr.debug() << "Buffer::Buffer()" << endl;
|
||||
if (read_only || (lyxrc && lyxrc->use_tempdir)) {
|
||||
tmppath = CreateBufferTmpDir();
|
||||
} else tmppath.erase();
|
||||
@ -125,7 +125,7 @@ Buffer::Buffer(string const & file, LyXRC *lyxrc, bool ronly)
|
||||
|
||||
Buffer::~Buffer()
|
||||
{
|
||||
lyxerr.debug("Buffer::~Buffer()");
|
||||
lyxerr.debug() << "Buffer::~Buffer()" << endl;
|
||||
// here the buffer should take care that it is
|
||||
// saved properly, before it goes into the void.
|
||||
|
||||
@ -241,10 +241,10 @@ bool Buffer::insertLyXFile(string const & filen)
|
||||
bool res = true;
|
||||
|
||||
if (c=='#') {
|
||||
lyxerr.debug("Will insert file with header");
|
||||
lyxerr.debug() << "Will insert file with header" << endl;
|
||||
res = readFile(lex, text->cursor.par);
|
||||
} else {
|
||||
lyxerr.debug("Will insert file without header");
|
||||
lyxerr.debug() << "Will insert file without header" << endl;
|
||||
res = readLyXformat2(lex, text->cursor.par);
|
||||
}
|
||||
resize();
|
||||
@ -733,7 +733,7 @@ bool Buffer::readLyXformat2(LyXLex &lex, LyXParagraph *par)
|
||||
// This one is on its way out
|
||||
lex.EatLine();
|
||||
tmptok = strip(lex.GetString());
|
||||
//lyxerr.print(string(tmptok[0]));
|
||||
//lyxerr <<string(tmptok[0]));
|
||||
if (tmptok[0] == '\\') {
|
||||
// then this latex is a
|
||||
// latex command
|
||||
@ -755,7 +755,7 @@ bool Buffer::readLyXformat2(LyXLex &lex, LyXParagraph *par)
|
||||
// This one is on its way out...
|
||||
lex.EatLine();
|
||||
tmptok = strip(lex.GetString());
|
||||
//lyxerr.print(string(tmptok[0]));
|
||||
//lyxerr <<string(tmptok[0]));
|
||||
if (tmptok == "\\tableofcontents") {
|
||||
inset = new InsetTOC(this);
|
||||
} else if (tmptok == "\\listoffigures") {
|
||||
@ -1127,14 +1127,15 @@ bool Buffer::readFile(LyXLex &lex, LyXParagraph *par)
|
||||
bool Buffer::writeFile(string const & filename, bool flag)
|
||||
{
|
||||
// if flag is false writeFile will not create any GUI
|
||||
// warnings, only stderr.
|
||||
// warnings, only cerr.
|
||||
// Needed for autosave in background or panic save (Matthias 120496)
|
||||
|
||||
if (read_only && (filename == this->filename)) {
|
||||
// Here we should come with a question if we should
|
||||
// perform the write anyway.
|
||||
if (flag)
|
||||
lyxerr.print(_("Error! Document is read-only: ") + filename);
|
||||
lyxerr << _("Error! Document is read-only: ")
|
||||
<< filename << endl;
|
||||
else
|
||||
WriteAlert(_("Error! Document is read-only: "), filename);
|
||||
return false;
|
||||
@ -1145,7 +1146,8 @@ bool Buffer::writeFile(string const & filename, bool flag)
|
||||
// Here we should come with a question if we should
|
||||
// try to do the save anyway. (i.e. do a chmod first)
|
||||
if (flag)
|
||||
lyxerr.print(_("Error! Cannot write file: ") + filename);
|
||||
lyxerr << _("Error! Cannot write file: ")
|
||||
<< filename << endl;
|
||||
else
|
||||
WriteFSAlert(_("Error! Cannot write file: "), filename);
|
||||
return false;
|
||||
@ -1154,7 +1156,8 @@ bool Buffer::writeFile(string const & filename, bool flag)
|
||||
FilePtr file(filename, FilePtr::truncate);
|
||||
if (!file()) {
|
||||
if (flag)
|
||||
lyxerr.print(_("Error! Cannot write file: ") + filename);
|
||||
lyxerr << _("Error! Cannot write file: ")
|
||||
<< filename << endl;
|
||||
else
|
||||
WriteFSAlert(_("Error! Cannot write file: "), filename);
|
||||
return false;
|
||||
@ -1188,8 +1191,8 @@ bool Buffer::writeFile(string const & filename, bool flag)
|
||||
fprintf(file, "\n\\the_end\n");
|
||||
if (file.close()) {
|
||||
if (flag)
|
||||
lyxerr.print(_("Error! Could not close file properly: ")
|
||||
+ filename);
|
||||
lyxerr << _("Error! Could not close file properly: ")
|
||||
<< filename << endl;
|
||||
else
|
||||
WriteFSAlert(_("Error! Could not close file properly: "),
|
||||
filename);
|
||||
@ -1505,7 +1508,7 @@ void Buffer::writeFileAscii(string const & filename, int linelen)
|
||||
} else if (c != '\0')
|
||||
fprintf(file, "%c", c);
|
||||
else if (c == '\0')
|
||||
lyxerr.debug("writeAsciiFile: NULL char in structure.");
|
||||
lyxerr.debug() << "writeAsciiFile: NULL char in structure." << endl;
|
||||
currlinelen++;
|
||||
break;
|
||||
}
|
||||
@ -1541,7 +1544,7 @@ void Buffer::makeLaTeXFile(string const & filename,
|
||||
string const & original_path,
|
||||
bool nice, bool only_body)
|
||||
{
|
||||
lyxerr.debug("makeLaTeXFile...", Error::LATEX);
|
||||
lyxerr[Debug::LATEX] << "makeLaTeXFile..." << endl;
|
||||
params.textclass = GetCurrentTextClass();
|
||||
niceFile = nice; // this will be used by Insetincludes.
|
||||
|
||||
@ -1556,10 +1559,10 @@ void Buffer::makeLaTeXFile(string const & filename,
|
||||
}
|
||||
|
||||
// validate the buffer.
|
||||
lyxerr.debug(" Validating buffer...", Error::LATEX);
|
||||
lyxerr[Debug::LATEX] << " Validating buffer..." << endl;
|
||||
LaTeXFeatures features(tclass->number_of_defined_layouts);
|
||||
validate(features);
|
||||
lyxerr.debug(" Buffer validation done.", Error::LATEX);
|
||||
lyxerr[Debug::LATEX] << " Buffer validation done." << endl;
|
||||
|
||||
texrow.reset();
|
||||
// The starting paragraph of the coming rows is the
|
||||
@ -1579,7 +1582,7 @@ void Buffer::makeLaTeXFile(string const & filename,
|
||||
texrow.newline();
|
||||
texrow.newline();
|
||||
}
|
||||
lyxerr.debug("lyx header finished");
|
||||
lyxerr.debug() << "lyx header finished" << endl;
|
||||
// There are a few differences between nice LaTeX and usual files:
|
||||
// usual is \batchmode, uses \listfiles and has a
|
||||
// special input@path to allow the including of figures
|
||||
@ -1942,7 +1945,7 @@ void Buffer::makeLaTeXFile(string const & filename,
|
||||
texrow.newline();
|
||||
texrow.newline();
|
||||
} // only_body
|
||||
lyxerr.debug("preamble finished, now the body.");
|
||||
lyxerr.debug() << "preamble finished, now the body." << endl;
|
||||
|
||||
bool was_title = false;
|
||||
bool already_title = false;
|
||||
@ -1957,15 +1960,16 @@ void Buffer::makeLaTeXFile(string const & filename,
|
||||
while (par) {
|
||||
++loop_count;
|
||||
if (par->IsDummy())
|
||||
lyxerr.debug("Error in MakeLateXFile.", Error::LATEX);
|
||||
lyxerr[Debug::LATEX] << "Error in MakeLateXFile."
|
||||
<< endl;
|
||||
LyXLayout * layout = lyxstyle.Style(params.textclass,
|
||||
par->layout);
|
||||
|
||||
if (layout->intitle) {
|
||||
if (already_title) {
|
||||
lyxerr.print("Error in MakeLatexFile: You"
|
||||
" should not mix title layouts"
|
||||
" with normal ones.");
|
||||
lyxerr <<"Error in MakeLatexFile: You"
|
||||
" should not mix title layouts"
|
||||
" with normal ones." << endl;
|
||||
} else
|
||||
was_title = true;
|
||||
} else if (was_title && !already_title) {
|
||||
@ -2022,9 +2026,10 @@ void Buffer::makeLaTeXFile(string const & filename,
|
||||
LFile += "\\end{document}\n";
|
||||
texrow.newline();
|
||||
|
||||
lyxerr.debug("makeLaTeXFile...done", Error::LATEX);
|
||||
lyxerr[Debug::LATEX] << "makeLaTeXFile...done" << endl;
|
||||
} else {
|
||||
lyxerr.debug("LaTeXFile for inclusion made.", Error::LATEX);
|
||||
lyxerr[Debug::LATEX] << "LaTeXFile for inclusion made."
|
||||
<< endl;
|
||||
}
|
||||
|
||||
// Just to be sure. (Asger)
|
||||
@ -2043,7 +2048,7 @@ void Buffer::makeLaTeXFile(string const & filename,
|
||||
if (file.close()) {
|
||||
WriteFSAlert(_("Error! Could not close file properly:"), filename);
|
||||
}
|
||||
lyxerr.debug("Finished making latex file.");
|
||||
lyxerr.debug() << "Finished making latex file." << endl;
|
||||
}
|
||||
|
||||
|
||||
@ -3529,8 +3534,9 @@ void Buffer::RoffAsciiTable(FILE *file, LyXParagraph *par)
|
||||
if (c != '\0')
|
||||
fprintf(fp, "%c", c);
|
||||
else if (c == '\0')
|
||||
lyxerr.debug("RoffAsciiTable:"
|
||||
" NULL char in structure.");
|
||||
lyxerr.debug()
|
||||
<< "RoffAsciiTable:"
|
||||
" NULL char in structure." << endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -3539,7 +3545,7 @@ void Buffer::RoffAsciiTable(FILE *file, LyXParagraph *par)
|
||||
string cmd = lyxrc->ascii_roff_command + " >" + fname2;
|
||||
subst(cmd, "$$FName",fname1);
|
||||
Systemcalls one(Systemcalls::System, cmd);
|
||||
if (!(lyxerr.debugging(Error::ROFF))) {
|
||||
if (!(lyxerr.debugging(Debug::ROFF))) {
|
||||
remove(fname1.c_str());
|
||||
}
|
||||
if (!(fp=fopen(fname2.c_str(),"r"))) {
|
||||
@ -3639,8 +3645,8 @@ void Buffer::validate(LaTeXFeatures &features)
|
||||
|
||||
while (par) {
|
||||
// We don't use "lyxerr.debug" because of speed. (Asger)
|
||||
if (lyxerr.debugging(Error::LATEX))
|
||||
lyxerr.print(string("Paragraph: ") + tostr(par));
|
||||
if (lyxerr.debugging(Debug::LATEX))
|
||||
lyxerr << "Paragraph: " << par << endl;
|
||||
|
||||
// Now just follow the list of paragraphs and run
|
||||
// validate on each of them.
|
||||
@ -3674,7 +3680,7 @@ void Buffer::validate(LaTeXFeatures &features)
|
||||
}
|
||||
}
|
||||
|
||||
if (lyxerr.debugging(Error::LATEX)) {
|
||||
if (lyxerr.debugging(Debug::LATEX)) {
|
||||
features.showStruct(params);
|
||||
}
|
||||
}
|
||||
@ -3830,7 +3836,7 @@ string Buffer::getIncludeonlyList(char delim)
|
||||
}
|
||||
par = par->next;
|
||||
}
|
||||
lyxerr.debug(string("Includeonly(") + list + ')');
|
||||
lyxerr.debug() << "Includeonly(" << list << ')' << endl;
|
||||
return list;
|
||||
}
|
||||
|
||||
@ -3862,7 +3868,7 @@ string Buffer::getReferenceList(char delim)
|
||||
}
|
||||
par = par->next;
|
||||
}
|
||||
lyxerr.debug(string("References(") + list + string(")"));
|
||||
lyxerr.debug() << "References(" << list << ")" << endl;
|
||||
return list;
|
||||
}
|
||||
|
||||
@ -3916,7 +3922,7 @@ string Buffer::getBibkeyList(char delim)
|
||||
}
|
||||
}
|
||||
|
||||
lyxerr.debug(string("Bibkeys(") + bibkeys + string(")"));
|
||||
lyxerr.debug() << "Bibkeys(" << bibkeys << ")" << endl;
|
||||
return bibkeys;
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
* This file is Copyright 1996-1999
|
||||
* Lars Gullik Bjønnes
|
||||
*
|
||||
*======================================================
|
||||
* ======================================================
|
||||
*/
|
||||
|
||||
#ifdef __GNUG__
|
||||
@ -26,7 +26,7 @@
|
||||
#include "support/filetools.h"
|
||||
#include "lyx_gui_misc.h"
|
||||
#include "lastfiles.h"
|
||||
#include "error.h"
|
||||
#include "debug.h"
|
||||
#include "lyxrc.h"
|
||||
#include "lyxscreen.h"
|
||||
#include "lyxtext.h"
|
||||
@ -81,7 +81,7 @@ Buffer* BufferStorage::newBuffer(string const &s,
|
||||
&& buffer[i]) i++;
|
||||
buffer[i] = new Buffer(s, lyxrc, ronly);
|
||||
buffer[i]->params.useClassDefaults();
|
||||
lyxerr.debug(string("Assigning to buffer ") + tostr(i), Error::ANY);
|
||||
lyxerr.debug() << "Assigning to buffer " << i << endl;
|
||||
return buffer[i];
|
||||
}
|
||||
|
||||
@ -220,7 +220,7 @@ bool BufferList::write(Buffer *buf, bool makeBackup)
|
||||
times->actime = finfo.getAccessTime();
|
||||
times->modtime = finfo.getModificationTime();
|
||||
long blksize = finfo.getBlockSize();
|
||||
lyxerr.debug(string("BlockSize: ") + tostr(blksize));
|
||||
lyxerr.debug() << "BlockSize: " << blksize << endl;
|
||||
FilePtr fin(buf->filename,FilePtr::read);
|
||||
FilePtr fout(s,FilePtr::truncate);
|
||||
if (fin() && fout()) {
|
||||
@ -238,11 +238,11 @@ bool BufferList::write(Buffer *buf, bool makeBackup)
|
||||
chmod(s.c_str(), fmode);
|
||||
|
||||
if (utime(s.c_str(), times)) {
|
||||
lyxerr.print("utime error.");
|
||||
lyxerr << "utime error." << endl;
|
||||
}
|
||||
delete [] cbuf;
|
||||
} else {
|
||||
lyxerr.print("LyX was not able to make backupcopy. Beware.");
|
||||
lyxerr << "LyX was not able to make backupcopy. Beware." << endl;
|
||||
}
|
||||
delete[] times;
|
||||
}
|
||||
@ -421,10 +421,10 @@ void BufferList::emergencyWriteAll()
|
||||
if (!b->isLyxClean()) {
|
||||
bool madeit=false;
|
||||
|
||||
lyxerr.print(_("lyx: Attempting to save"
|
||||
lyxerr <<_("lyx: Attempting to save"
|
||||
" document ")
|
||||
+ b->filename
|
||||
+ _(" as..."));
|
||||
<< b->filename
|
||||
<< _(" as...") << endl;
|
||||
|
||||
for (int i=0; i<3 && !madeit; i++) {
|
||||
string s;
|
||||
@ -444,16 +444,17 @@ void BufferList::emergencyWriteAll()
|
||||
}
|
||||
s += ".emergency";
|
||||
|
||||
lyxerr.print(string(" ") + tostr(i+1) + ") " + s);
|
||||
lyxerr << " " << i+1 << ") " << s << endl;
|
||||
|
||||
if (b->writeFile(s,true)) {
|
||||
b->markLyxClean();
|
||||
lyxerr.print(_(" Save seems successful. Phew."));
|
||||
lyxerr << _(" Save seems successful. Phew.") << endl;
|
||||
madeit = true;
|
||||
} else if (i != 2) {
|
||||
lyxerr.print(_(" Save failed! Trying..."));
|
||||
lyxerr << _(" Save failed! Trying...")
|
||||
<< endl;
|
||||
} else {
|
||||
lyxerr.print(_(" Save failed! Bummer. Document is lost."));
|
||||
lyxerr << _(" Save failed! Bummer. Document is lost.") << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -650,7 +651,7 @@ Buffer* BufferList::loadLyXFile(string const & filename, bool tolastfiles)
|
||||
if (LyXVC::file_not_found_hook(s)) {
|
||||
// Ask if the file should be checked out for
|
||||
// viewing/editing, if so: load it.
|
||||
lyxerr.print("Do you want to checkout?");
|
||||
lyxerr << "Do you want to checkout?" << endl;
|
||||
}
|
||||
if (AskQuestion(_("Cannot open specified file:"),
|
||||
MakeDisplayPath(s,50),
|
||||
|
@ -1,24 +1,25 @@
|
||||
// -*- C++ -*-
|
||||
/* This file is part of
|
||||
* ======================================================
|
||||
*
|
||||
* LyX, The Document Processor
|
||||
* Copyright (C) 1995 Matthias Ettrich
|
||||
*
|
||||
* This file is Copyleft (C) 1996
|
||||
* Lars Gullik Bjønnes
|
||||
*
|
||||
*======================================================*/
|
||||
* ======================================================
|
||||
*
|
||||
* LyX, The Document Processor
|
||||
* Copyright 1995 Matthias Ettrich
|
||||
* Copyright 1995-1999 The LyX Team
|
||||
*
|
||||
* This file is Copyright 1996
|
||||
* Lars Gullik Bjønnes
|
||||
*
|
||||
* ======================================================*/
|
||||
|
||||
#ifndef _BUFFER_LIST_H_
|
||||
#define _BUFFER_LIST_H_
|
||||
#ifndef BUFFER_LIST_H
|
||||
#define BUFFER_LIST_H
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
#include "buffer.h"
|
||||
#include "error.h"
|
||||
#include "debug.h"
|
||||
|
||||
/** A class to hold all the buffers in a structure
|
||||
The point of this class is to hide from bufferlist what kind
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include "tex-strings.h"
|
||||
#include "layout.h"
|
||||
#include "vspace.h"
|
||||
#include "error.h"
|
||||
#include "debug.h"
|
||||
#include "support/lyxlib.h"
|
||||
#include "support/lstrings.h"
|
||||
|
||||
@ -236,8 +236,8 @@ void BufferParams::useClassDefaults() {
|
||||
void BufferParams::readPreamble(LyXLex &lex)
|
||||
{
|
||||
if (lex.GetString() != "\\begin_preamble")
|
||||
lyxerr.print("Error (BufferParams::readPreamble):"
|
||||
"consistency check failed.");
|
||||
lyxerr << "Error (BufferParams::readPreamble):"
|
||||
"consistency check failed." << endl;
|
||||
|
||||
preamble = lex.getLongString("\\end_preamble");
|
||||
}
|
||||
@ -261,9 +261,10 @@ void BufferParams::readLanguage(LyXLex &lex)
|
||||
break;
|
||||
}
|
||||
else if (test.empty()) {
|
||||
lyxerr.print("Warning: language `"
|
||||
+ tmptok + "' not recognized!");
|
||||
lyxerr.print(" Setting language to `default'.");
|
||||
lyxerr << "Warning: language `"
|
||||
<< tmptok << "' not recognized!\n"
|
||||
<< " Setting language to `default'."
|
||||
<< endl;
|
||||
language = "default";
|
||||
break;
|
||||
}
|
||||
|
21
src/chset.C
21
src/chset.C
@ -7,7 +7,7 @@
|
||||
#include "chset.h"
|
||||
#include "support/filetools.h"
|
||||
#include "lyxlex.h"
|
||||
#include "error.h"
|
||||
#include "debug.h"
|
||||
|
||||
|
||||
CharacterSet::CharacterSet()
|
||||
@ -43,11 +43,12 @@ bool CharacterSet::loadFile(const string& fname)
|
||||
return true; // ascii 7-bit
|
||||
|
||||
// open definition file
|
||||
lyxerr.debug("Opening keymap file "+ fname+ ".cdef",Error::KBMAP);
|
||||
lyxerr[Debug::KBMAP]
|
||||
<< "Opening keymap file " << fname << ".cdef" << endl;
|
||||
string filename = LibFileSearch("kbd", fname.c_str(), "cdef");
|
||||
FilePtr f(filename, FilePtr::read);
|
||||
if (filename.empty() || !f()) {
|
||||
lyxerr.print("Unable to open keymap file");
|
||||
lyxerr << "Unable to open keymap file" << endl;
|
||||
return true; // no definition, use 7-bit ascii
|
||||
}
|
||||
|
||||
@ -65,8 +66,8 @@ bool CharacterSet::loadFile(const string& fname)
|
||||
|
||||
switch(lex.lex()){
|
||||
case LyXLex::LEX_FEOF :
|
||||
lyxerr.debug("End of parsing of .cdef file",
|
||||
Error::KBMAP);
|
||||
lyxerr[Debug::KBMAP] << "End of parsing of .cdef file"
|
||||
<< endl;
|
||||
break;
|
||||
default:
|
||||
// Get Integer
|
||||
@ -86,9 +87,9 @@ bool CharacterSet::loadFile(const string& fname)
|
||||
tempc->next=map_;
|
||||
map_=tempc;
|
||||
|
||||
if (lyxerr.debugging(Error::KBMAP))
|
||||
fprintf(stderr, "Chardef: %d to [%s]\n",
|
||||
n, tempc->str.c_str());
|
||||
if (lyxerr.debugging(Debug::KBMAP))
|
||||
lyxerr << "Chardef: " << n
|
||||
<< " to [" << tempc->str << "]" << endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -103,7 +104,9 @@ bool CharacterSet::encodeString(string& str)
|
||||
|
||||
while(t) {
|
||||
if (t->str==str) {
|
||||
str = tostr(t->ic);
|
||||
str.erase();
|
||||
str += t->ic;
|
||||
//str = tostr(t->ic);
|
||||
break;
|
||||
}
|
||||
t=t->next;
|
||||
|
@ -1,6 +1,6 @@
|
||||
// -*- C++ -*-
|
||||
#ifndef _Chset_h_
|
||||
#define _Chset_h_
|
||||
#ifndef CHSET_H
|
||||
#define CHSET_H
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
|
10
src/combox.C
10
src/combox.C
@ -38,7 +38,7 @@
|
||||
#include "combox.h"
|
||||
#include <cstring>
|
||||
|
||||
#include "error.h"
|
||||
#include "debug.h"
|
||||
|
||||
Combox::Combox(combox_type t): type(t)
|
||||
{
|
||||
@ -73,20 +73,20 @@ void Combox::clear()
|
||||
|
||||
void Combox::remove()
|
||||
{
|
||||
//lyxerr.print(string("Button: ") + int(button));
|
||||
lyxerr.debug() << "Button: " << button << endl;
|
||||
if (button) {
|
||||
fl_delete_object(button);
|
||||
fl_free_object(button);
|
||||
}
|
||||
|
||||
//lyxerr.print(string("Label: ") + int(label));
|
||||
lyxerr.debug() << "Label: " << label << endl;
|
||||
if (label && label!=button) {
|
||||
fl_delete_object(label);
|
||||
fl_free_object(label);
|
||||
}
|
||||
|
||||
//lyxerr.print(string("Form: ") + int(form));
|
||||
//lyxerr.print(string("Browser: ") + int(browser));
|
||||
lyxerr.debug() << "Form: " << form << endl;
|
||||
lyxerr.debug() << "Browser: " << browser << endl;
|
||||
if (form && browser) {
|
||||
fl_delete_object(browser);
|
||||
fl_free_object(browser);
|
||||
|
@ -7,8 +7,8 @@
|
||||
- add a help text in LyXAction::getHelp() in LyXAction.C
|
||||
\* ======================================================================= */
|
||||
|
||||
#ifndef _COMMANDTAGS_H_
|
||||
#define _COMMANDTAGS_H_
|
||||
#ifndef COMMANDTAGS_H
|
||||
#define COMMANDTAGS_H
|
||||
|
||||
|
||||
/** These are all the lyxfunctions (as enums).
|
||||
@ -240,5 +240,7 @@ enum kb_action {
|
||||
LFUN_LASTACTION /* this marks the end of the table */
|
||||
};
|
||||
|
||||
class ostream;
|
||||
ostream & operator<<(ostream &, kb_action);
|
||||
#endif
|
||||
|
||||
|
94
src/debug.h
Normal file
94
src/debug.h
Normal file
@ -0,0 +1,94 @@
|
||||
// -*- C++ -*-
|
||||
|
||||
#ifndef LYXDEBUG_H
|
||||
#define LYXDEBUG_H
|
||||
|
||||
#include "LString.h"
|
||||
|
||||
/** Ideally this should have been a namespace, but since we try to be
|
||||
compilable on older C++ compilators too, we use a struct instead.
|
||||
This is all the different debug levels that we have.
|
||||
*/
|
||||
struct Debug {
|
||||
///
|
||||
enum type {
|
||||
///
|
||||
NONE = 0,
|
||||
///
|
||||
INFO = (1 << 0), // 1
|
||||
///
|
||||
INIT = (1 << 1), // 2
|
||||
///
|
||||
KEY = (1 << 2), // 4
|
||||
///
|
||||
TOOLBAR = (1 << 3), // 8
|
||||
///
|
||||
PARSER = (1 << 4), // 16
|
||||
///
|
||||
LYXRC = (1 << 5), // 32
|
||||
///
|
||||
KBMAP = (1 << 6), // 64
|
||||
///
|
||||
LATEX = (1 << 7), // 128
|
||||
///
|
||||
MATHED = (1 << 8), // 256 // Alejandro, please use this.
|
||||
///
|
||||
FONT = (1 << 9), // 512
|
||||
///
|
||||
TCLASS = (1 << 10), // 1024
|
||||
///
|
||||
LYXVC = (1 << 11), // 2048
|
||||
///
|
||||
LYXSERVER = (1 << 12), // 4096
|
||||
///
|
||||
ROFF = (1 << 13)
|
||||
};
|
||||
///
|
||||
static const type ANY = type(INFO | INIT | KEY | TOOLBAR |
|
||||
PARSER | LYXRC | KBMAP | LATEX |
|
||||
MATHED | FONT | TCLASS | LYXVC |
|
||||
LYXSERVER | ROFF);
|
||||
|
||||
/** A function to convert symbolic string names on debug levels
|
||||
to their numerical value.
|
||||
*/
|
||||
static Debug::type value(string const & val) {
|
||||
int l = Debug::NONE;
|
||||
string v(val);
|
||||
while (!v.empty()) {
|
||||
string::size_type st = v.find(',');
|
||||
string tmp(v.substr(0, st));
|
||||
if (tmp.empty()) break;
|
||||
if (val == "NONE") l |= Debug::NONE;
|
||||
else if (val == "INFO") l |= Debug::INFO;
|
||||
else if (val == "INIT") l |= Debug::INIT;
|
||||
else if (val == "KEY") l |= Debug::KEY;
|
||||
else if (val == "TOOLBAR") l |= Debug::TOOLBAR;
|
||||
else if (val == "PARSER") l |= Debug::PARSER;
|
||||
else if (val == "LYXRC") l |= Debug::LYXRC;
|
||||
else if (val == "KBMAP") l |= Debug::KBMAP;
|
||||
else if (val == "LATEX") l |= Debug::LATEX;
|
||||
else if (val == "MATHED") l |= Debug::MATHED;
|
||||
else if (val == "FONT") l |= Debug::FONT;
|
||||
else if (val == "TCLASS") l |= Debug::TCLASS;
|
||||
else if (val == "LYXVC") l |= Debug::LYXVC;
|
||||
else if (val == "LYXSERVER") l |= Debug::LYXSERVER;
|
||||
else if (val == "ROFF") l |= Debug::ROFF;
|
||||
else break; // unknown string
|
||||
if (st == string::npos) break;
|
||||
v.erase(0, st + 1);
|
||||
}
|
||||
return Debug::type(l);
|
||||
}
|
||||
};
|
||||
|
||||
///
|
||||
ostream & operator<<(ostream & o, Debug::type t);
|
||||
|
||||
#include "support/DebugStream.h"
|
||||
|
||||
extern DebugStream lyxerr;
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -280,14 +280,13 @@ void LyXFileDlg::Reread()
|
||||
File = AddName(pszDirectory, fname);
|
||||
|
||||
fileInfo.newFile(File, true);
|
||||
|
||||
fileInfo.modeString(szMode);
|
||||
unsigned int nlink = fileInfo.getNumberOfLinks();
|
||||
string user = lyxUserCache.Find(fileInfo.getUid());
|
||||
string group = lyxGroupCache.Find(fileInfo.getGid());
|
||||
|
||||
time_t modtime = fileInfo.getModificationTime();
|
||||
Time += ctime(&modtime);
|
||||
Time = ctime(&modtime);
|
||||
|
||||
if (curTime > fileInfo.getModificationTime() + SIX_MONTH_SEC
|
||||
|| curTime < fileInfo.getModificationTime()
|
||||
@ -300,10 +299,13 @@ void LyXFileDlg::Reread()
|
||||
#warning fix!
|
||||
|
||||
Time.erase(10, 9);
|
||||
Time.erase(15, string::npos);
|
||||
} else {
|
||||
Time.erase(16, string::npos);
|
||||
}
|
||||
|
||||
Buffer = szMode + ' ' +
|
||||
nlink + ' ' +
|
||||
Buffer = string(szMode) + ' ' +
|
||||
tostr(nlink) + ' ' +
|
||||
user + ' ' +
|
||||
group + ' ' +
|
||||
Time.substr(4, string::npos) + ' ';
|
||||
@ -469,7 +471,7 @@ void LyXFileDlg::SetButton(int iIndex, string const & pszName,
|
||||
*pTemp = pszPath;
|
||||
} else {
|
||||
fl_hide_object(pObject);
|
||||
(*pTemp).erase();
|
||||
(*pTemp).clear();
|
||||
}
|
||||
}
|
||||
|
||||
@ -620,7 +622,7 @@ bool LyXFileDlg::HandleDoubleClick()
|
||||
Temp += pszTemp;
|
||||
} else {
|
||||
// Directory higher up
|
||||
Temp.erase();
|
||||
Temp.clear();
|
||||
for (i = 0; i < iSelect; ++i) {
|
||||
string piece = fl_get_browser_line(pFileDlgForm->List, i+1);
|
||||
// The '+2' is here to count the '@b' (JMarc)
|
||||
|
@ -1,16 +1,16 @@
|
||||
// -*- C++ -*-
|
||||
/* This file is part of
|
||||
* ======================================================
|
||||
*
|
||||
* LyX, The Document Processor
|
||||
*
|
||||
* Copyright (C) 1995 1996 Matthias Ettrich
|
||||
* and the LyX Team.
|
||||
*
|
||||
*======================================================*/
|
||||
* ======================================================
|
||||
*
|
||||
* LyX, The Document Processor
|
||||
*
|
||||
* Copyright 1995 Matthias Ettrich
|
||||
* Copyright 1995-1999 The LyX Team.
|
||||
*
|
||||
* ======================================================*/
|
||||
|
||||
#ifndef __FILEDLG_H__
|
||||
#define __FILEDLG_H__
|
||||
#ifndef FILEDLG_H
|
||||
#define FILEDLG_H
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
|
@ -48,7 +48,7 @@ extern long int background_pixels;
|
||||
#include "filedlg.h"
|
||||
#include "support/filetools.h"
|
||||
#include "LyXView.h" // just because of form_main
|
||||
#include "error.h"
|
||||
#include "debug.h"
|
||||
#include "lyxdraw.h"
|
||||
#include "LaTeXFeatures.h"
|
||||
#include "lyxrc.h"
|
||||
@ -127,10 +127,10 @@ void addpidwait(int pid)
|
||||
pw = p;
|
||||
|
||||
if (lyxerr.debugging()) {
|
||||
lyxerr.print(string("Pids to wait for: ") + tostr(p->pid));
|
||||
lyxerr << "Pids to wait for: " << p->pid << endl;
|
||||
while (p->next) {
|
||||
p = p->next;
|
||||
lyxerr.print(string() + tostr(p->pid));
|
||||
lyxerr << p->pid << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -145,9 +145,8 @@ int GhostscriptMsg(FL_OBJECT *, Window, int, int,
|
||||
XClientMessageEvent *e = (XClientMessageEvent*) ev;
|
||||
|
||||
if(lyxerr.debugging()) {
|
||||
fprintf(stderr,
|
||||
"ClientMessage, win:[xx] gs:[%ld] pm:[%ld]\n",
|
||||
e->data.l[0], e->data.l[1]);
|
||||
lyxerr << "ClientMessage, win:[xx] gs:[" << e->data.l[0]
|
||||
<< "] pm:[" << e->data.l[1] << "]" << endl;
|
||||
}
|
||||
|
||||
// just kill gs, that way it will work for sure
|
||||
@ -174,23 +173,26 @@ int GhostscriptMsg(FL_OBJECT *, Window, int, int,
|
||||
figinset_canvas), &wa);
|
||||
XFlush(fl_display);
|
||||
if (lyxerr.debugging()) {
|
||||
fprintf(stderr,
|
||||
"Starting image translation %ld %d %dx%d %d %d\n",
|
||||
p->bitmap, p->flags, p->wid, p->hgh, wa.depth,
|
||||
XYPixmap);
|
||||
lyxerr
|
||||
<< "Starting image translation "
|
||||
<< p->bitmap << " "
|
||||
<< p->flags << " "
|
||||
<< p->wid << "x" << p->hgh
|
||||
<< " " << wa.depth
|
||||
<< " " << XYPixmap << endl;
|
||||
|
||||
}
|
||||
// now fork rendering process
|
||||
forkstat = fork();
|
||||
if (forkstat == -1) {
|
||||
lyxerr.debug("Cannot fork, using slow "
|
||||
"method for pixmap translation.");
|
||||
lyxerr.debug() << "Cannot fork, using slow "
|
||||
"method for pixmap translation." << endl;
|
||||
tmpdisp = fl_display;
|
||||
} else if (forkstat > 0) {
|
||||
// register child
|
||||
if (lyxerr.debugging()) {
|
||||
lyxerr.print(
|
||||
string("Spawned child ")
|
||||
+ tostr(forkstat));
|
||||
lyxerr << "Spawned child "
|
||||
<< forkstat << endl;
|
||||
}
|
||||
addpidwait(forkstat);
|
||||
break; // in parent process
|
||||
@ -202,11 +204,11 @@ int GhostscriptMsg(FL_OBJECT *, Window, int, int,
|
||||
p->wid, p->hgh, (1<<wa.depth)-1, XYPixmap);
|
||||
XFlush(tmpdisp);
|
||||
if (lyxerr.debugging()) {
|
||||
lyxerr.print("Got the image");
|
||||
lyxerr << "Got the image" << endl;
|
||||
}
|
||||
if (!im) {
|
||||
if (lyxerr.debugging()) {
|
||||
lyxerr.print("Error getting the image");
|
||||
lyxerr << "Error getting the image" << endl;
|
||||
}
|
||||
goto noim;
|
||||
}
|
||||
@ -231,18 +233,18 @@ int GhostscriptMsg(FL_OBJECT *, Window, int, int,
|
||||
}
|
||||
}
|
||||
if (lyxerr.debugging()) {
|
||||
lyxerr.print("Putting image back");
|
||||
lyxerr << "Putting image back" << endl;
|
||||
}
|
||||
XPutImage(tmpdisp, p->bitmap, gc, im, 0, 0,
|
||||
0, 0, p->wid, p->hgh);
|
||||
XDestroyImage(im);
|
||||
if (lyxerr.debugging()) {
|
||||
lyxerr.print("Done translation");
|
||||
lyxerr << "Done translation" << endl;
|
||||
}
|
||||
noim:
|
||||
if (lyxerr.debugging()) {
|
||||
lyxerr.print(string("Killing gs ")
|
||||
+ tostr(p->gspid));
|
||||
lyxerr << "Killing gs "
|
||||
<< p->gspid << endl;
|
||||
}
|
||||
kill(p->gspid, SIGHUP);
|
||||
|
||||
@ -256,8 +258,8 @@ int GhostscriptMsg(FL_OBJECT *, Window, int, int,
|
||||
}
|
||||
} else {
|
||||
if (lyxerr.debugging()) {
|
||||
lyxerr.print(string("Killing gs ")
|
||||
+tostr(p->gspid));
|
||||
lyxerr << "Killing gs "
|
||||
<< p->gspid << endl;
|
||||
}
|
||||
kill(p->gspid, SIGHUP);
|
||||
|
||||
@ -279,11 +281,12 @@ static void AllocColors(int num)
|
||||
int i;
|
||||
|
||||
if (lyxerr.debugging()) {
|
||||
printf("Allocating color cube %dx%dx%d\n", num, num, num);
|
||||
lyxerr << "Allocating color cube " << num
|
||||
<< 'x' << num << 'x' << num << endl;
|
||||
}
|
||||
|
||||
if (num <= 1) {
|
||||
lyxerr.print("Error allocating color colormap.");
|
||||
lyxerr << "Error allocating color colormap." << endl;
|
||||
gs_color = false;
|
||||
return;
|
||||
}
|
||||
@ -297,8 +300,8 @@ static void AllocColors(int num)
|
||||
if (i) XFreeColors(fl_display, color_map,
|
||||
gs_pixels, i, 0);
|
||||
if(lyxerr.debugging()) {
|
||||
lyxerr.print(string("Cannot allocate color cube " )
|
||||
+ tostr(num));
|
||||
lyxerr << "Cannot allocate color cube "
|
||||
<< num << endl;;
|
||||
}
|
||||
AllocColors(num-1);
|
||||
return;
|
||||
@ -319,12 +322,12 @@ static void AllocGrays(int num)
|
||||
int i;
|
||||
|
||||
if (lyxerr.debugging()) {
|
||||
lyxerr.print(string("Allocating grayscale ramp ")
|
||||
+ tostr(num));
|
||||
lyxerr << "Allocating grayscale ramp "
|
||||
<< num << endl;
|
||||
}
|
||||
|
||||
if (num < 4) {
|
||||
lyxerr.print("Error allocating grayscale colormap.");
|
||||
lyxerr << "Error allocating grayscale colormap." << endl;
|
||||
gs_color = false;
|
||||
return;
|
||||
}
|
||||
@ -336,8 +339,8 @@ static void AllocGrays(int num)
|
||||
if (i) XFreeColors(fl_display, color_map,
|
||||
gs_pixels, i, 0);
|
||||
if (lyxerr.debugging()) {
|
||||
lyxerr.print(string("Cannot allocate grayscale ")
|
||||
+ tostr(num));
|
||||
lyxerr << "Cannot allocate grayscale "
|
||||
<< num << endl;
|
||||
}
|
||||
AllocGrays(num/2);
|
||||
return;
|
||||
@ -408,13 +411,13 @@ void DoneFigures()
|
||||
figarrsize = 0;
|
||||
bmparrsize = 0;
|
||||
|
||||
lyxerr.debug("Unregistering figures...");
|
||||
lyxerr.debug() << "Unregistering figures..." << endl;
|
||||
|
||||
fl_remove_canvas_handler(figinset_canvas, ClientMessage,
|
||||
GhostscriptMsg);
|
||||
|
||||
if (gs_color) {
|
||||
lyxerr.debug("Freeing up the colors...");
|
||||
lyxerr.debug() << "Freeing up the colors..." << endl;
|
||||
XFreeColors(fl_display, color_map, gs_pixels,
|
||||
gs_num_pixels, 0);
|
||||
/******????????????????? what's planes in this case ??????***/
|
||||
@ -510,7 +513,7 @@ static void runqueue()
|
||||
|
||||
if (pid == -1) {
|
||||
if (lyxerr.debugging()) {
|
||||
lyxerr.print("GS start error! Cannot fork.");
|
||||
lyxerr << "GS start error! Cannot fork." << endl;
|
||||
}
|
||||
p->data->broken = true;
|
||||
p->data->reading = false;
|
||||
@ -555,9 +558,8 @@ static void runqueue()
|
||||
//#warning BUG seems that the only bug here might be the hardcoded dpi.. Bummer!
|
||||
|
||||
if (lyxerr.debugging()) {
|
||||
lyxerr.print(string("Will set GHOSTVIEW"
|
||||
" property to [") +
|
||||
tbuf + "]");
|
||||
lyxerr << "Will set GHOSTVIEW property to ["
|
||||
<< tbuf << "]" << endl;
|
||||
}
|
||||
// wait until property is deleted if executing multiple
|
||||
// ghostscripts
|
||||
@ -565,7 +567,7 @@ static void runqueue()
|
||||
// grab server to prevent other child interfering
|
||||
// with setting GHOSTVIEW property
|
||||
if (lyxerr.debugging()) {
|
||||
lyxerr.print("Grabbing the server");
|
||||
lyxerr << "Grabbing the server" << endl;
|
||||
}
|
||||
XGrabServer(tempdisp);
|
||||
prop = XListProperties(tempdisp, fl_get_canvas_id(
|
||||
@ -589,11 +591,11 @@ static void runqueue()
|
||||
// ok, property found, we must wait until ghostscript
|
||||
// deletes it
|
||||
if (lyxerr.debugging()) {
|
||||
lyxerr.print("Releasing the server");
|
||||
lyxerr.print(string("[") +
|
||||
tostr(getpid()) +
|
||||
"] GHOSTVIEW property"
|
||||
" found. Waiting.");
|
||||
lyxerr << "Releasing the server" << endl;
|
||||
lyxerr << "["
|
||||
<< getpid()
|
||||
<< "] GHOSTVIEW property"
|
||||
" found. Waiting." << endl;
|
||||
}
|
||||
#ifdef WITH_WARNINGS
|
||||
#warning What is this doing? (wouldn't a sleep(1); work too?')
|
||||
@ -644,7 +646,7 @@ static void runqueue()
|
||||
XUngrabServer(tempdisp);
|
||||
XFlush(tempdisp);
|
||||
if (lyxerr.debugging()) {
|
||||
lyxerr.print("Releasing the server");
|
||||
lyxerr << "Releasing the server" << endl;
|
||||
}
|
||||
XCloseDisplay(tempdisp);
|
||||
|
||||
@ -681,18 +683,18 @@ static void runqueue()
|
||||
p->data->fname.c_str(),
|
||||
"showpage.ps", "quit.ps", "-", 0);
|
||||
// if we are still there, an error occurred.
|
||||
lyxerr.print(string("Error executing ghostscript. ")
|
||||
+ "Code: " + tostr(err));
|
||||
lyxerr.debug("Cmd: "
|
||||
+ lyxrc->ps_command
|
||||
+" -sDEVICE=x11 "
|
||||
+ tbuf + tostr(' ')
|
||||
+ p->data->fname);
|
||||
lyxerr << "Error executing ghostscript. "
|
||||
<< "Code: " << err << endl;
|
||||
lyxerr.debug() << "Cmd: "
|
||||
<< lyxrc->ps_command
|
||||
<< " -sDEVICE=x11 "
|
||||
<< tbuf << ' '
|
||||
<< p->data->fname << endl;
|
||||
_exit(0); // no gs?
|
||||
}
|
||||
// normal process (parent)
|
||||
if (lyxerr.debugging()) {
|
||||
lyxerr.print(string("GS [") + tostr(pid) + "] started");
|
||||
lyxerr << "GS [" << pid << "] started" << endl;
|
||||
}
|
||||
gsqueue = gsqueue->next;
|
||||
gsrunning++;
|
||||
@ -771,9 +773,11 @@ static figdata *getfigdata(int wid, int hgh, string const & fname,
|
||||
figinset_canvas), &wa);
|
||||
|
||||
if (lyxerr.debugging()) {
|
||||
printf("Create pixmap disp:%d scr:%d w:%d h:%d depth:%d\n",
|
||||
PTR_AS_INT(fl_display), DefaultScreen(fl_display),
|
||||
wid, hgh, wa.depth);
|
||||
lyxerr << "Create pixmap disp:" << fl_display
|
||||
<< " scr:" << DefaultScreen(fl_display)
|
||||
<< " w:" << wid
|
||||
<< " h:" << hgh
|
||||
<< " depth:" << wa.depth << endl;
|
||||
}
|
||||
|
||||
p->ref = 1;
|
||||
@ -808,8 +812,8 @@ static void makeupdatelist(figdata *p)
|
||||
|
||||
for (i = 0; i < figinsref; ++i) if (figures[i]->data == p) {
|
||||
if (lyxerr.debugging()) {
|
||||
printf("Updating inset %d\n",
|
||||
PTR_AS_INT(figures[i]->inset));
|
||||
lyxerr << "Updating inset " << figures[i]->inset
|
||||
<< endl;
|
||||
}
|
||||
//UpdateInset(figures[i]->inset);
|
||||
// add inset figures[i]->inset into to_update list
|
||||
@ -825,22 +829,25 @@ void sigchldchecker(pid_t pid, int *status)
|
||||
|
||||
bool pid_handled = false;
|
||||
|
||||
lyxerr.debug(string("Got pid = ") + tostr(pid));
|
||||
lyxerr.debug() << "Got pid = " << pid << endl;
|
||||
pid_handled = false;
|
||||
for (i = bmpinsref - 1; i >= 0; --i) {
|
||||
if (bitmaps[i]->reading && pid == bitmaps[i]->gspid) {
|
||||
lyxerr.debug("Found pid in bitmaps");
|
||||
lyxerr.debug() << "Found pid in bitmaps" << endl;
|
||||
// now read the file and remove it from disk
|
||||
p = bitmaps[i];
|
||||
p->reading = false;
|
||||
if (bitmaps[i]->gsdone) *status = 0;
|
||||
if (*status == 0) {
|
||||
lyxerr.debug(string("GS [") + tostr(pid) +
|
||||
"] exit OK.");
|
||||
lyxerr.debug() << "GS [" << pid
|
||||
<< "] exit OK." << endl;
|
||||
} else {
|
||||
fprintf(stderr, "GS [%ld] error %d E:%d %d S:%d %d\n", long(pid),
|
||||
*status, WIFEXITED(*status), WEXITSTATUS(*status),
|
||||
WIFSIGNALED(*status), WTERMSIG(*status));
|
||||
lyxerr << "GS [" << pid << "] error "
|
||||
<< *status << " E:"
|
||||
<< WIFEXITED(*status)
|
||||
<< " " << WEXITSTATUS(*status)
|
||||
<< " S:" << WIFSIGNALED(*status)
|
||||
<< " " << WTERMSIG(*status) << endl;
|
||||
}
|
||||
if (*status == 0) {
|
||||
bitmap_waiting = true;
|
||||
@ -862,12 +869,12 @@ void sigchldchecker(pid_t pid, int *status)
|
||||
}
|
||||
}
|
||||
if (!pid_handled) {
|
||||
lyxerr.debug("Checking pid in pidwait");
|
||||
lyxerr.debug() << "Checking pid in pidwait" << endl;
|
||||
pidwait *p = pw, *prev = 0;
|
||||
while (p) {
|
||||
if (pid == p->pid) {
|
||||
lyxerr.debug("Found pid in pidwait");
|
||||
lyxerr.debug(string("Caught child pid of recompute routine ") + tostr(pid));
|
||||
lyxerr.debug() << "Found pid in pidwait" << endl;
|
||||
lyxerr.debug() << "Caught child pid of recompute routine " << pid << endl;
|
||||
if (prev)
|
||||
prev->next = p->next;
|
||||
else
|
||||
@ -881,32 +888,31 @@ void sigchldchecker(pid_t pid, int *status)
|
||||
}
|
||||
|
||||
if (pid == -1) {
|
||||
lyxerr.debug("waitpid error");
|
||||
lyxerr.debug() << "waitpid error" << endl;
|
||||
switch (errno) {
|
||||
case ECHILD:
|
||||
lyxerr.print(
|
||||
"The process or process group specified by pid "
|
||||
"does not exist or is not a child of the cal-"
|
||||
"ling process or can never be in the states "
|
||||
"specified by options.");
|
||||
lyxerr << "The process or process group specified by "
|
||||
"pid does not exist or is not a child of "
|
||||
"the calling process or can never be in the "
|
||||
"states specified by options." << endl;
|
||||
break;
|
||||
case EINTR:
|
||||
lyxerr.print(
|
||||
"waitpid() was interrupted due to the receipt "
|
||||
"of a signal sent by the calling process.");
|
||||
lyxerr << "waitpid() was interrupted due to the "
|
||||
"receipt of a signal sent by the calling "
|
||||
"process." << endl;
|
||||
break;
|
||||
case EINVAL:
|
||||
lyxerr.print(
|
||||
"An invalid value was specified for options.");
|
||||
lyxerr << "An invalid value was specified for "
|
||||
"options." << endl;
|
||||
break;
|
||||
default:
|
||||
lyxerr.print("Unknown error from waitpid");
|
||||
lyxerr << "Unknown error from waitpid" << endl;
|
||||
break;
|
||||
}
|
||||
} else if (pid == 0) {
|
||||
lyxerr.print("waitpid nohang");
|
||||
lyxerr << "waitpid nohang" << endl;;
|
||||
} else {
|
||||
lyxerr.debug("normal exit from childhandler");
|
||||
lyxerr.debug() << "normal exit from childhandler" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
@ -943,8 +949,8 @@ static void RegisterFigure(InsetFig *fi)
|
||||
fi->figure = tmpfig;
|
||||
|
||||
if (lyxerr.debugging()) {
|
||||
lyxerr.print(string("Register Figure: buffer:[") +
|
||||
tostr(current_view->currentBuffer()) + "]");
|
||||
lyxerr << "Register Figure: buffer:["
|
||||
<< current_view->currentBuffer() << "]" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1025,7 +1031,7 @@ InsetFig::InsetFig(int tmpx, int tmpy, Buffer *o)
|
||||
InsetFig::~InsetFig()
|
||||
{
|
||||
if (lyxerr.debugging()) {
|
||||
lyxerr.print("Figure destructor called");
|
||||
lyxerr << "Figure destructor called" << endl;
|
||||
}
|
||||
UnregisterFigure(this);
|
||||
}
|
||||
@ -1127,7 +1133,7 @@ void InsetFig::Read(LyXLex &lex)
|
||||
lex.next();
|
||||
|
||||
string const token = lex.GetString();
|
||||
lyxerr.debug("Token: " + token);
|
||||
lyxerr.debug() << "Token: " << token << endl;
|
||||
|
||||
if (token.empty())
|
||||
continue;
|
||||
@ -1175,7 +1181,7 @@ void InsetFig::Read(LyXLex &lex)
|
||||
case PER_PAGE: wtype = PER_PAGE; break;
|
||||
case PER_COL: wtype = PER_COL; break;
|
||||
default:
|
||||
lyxerr.debug("Unknown type!");
|
||||
lyxerr.debug() << "Unknown type!" << endl;
|
||||
break;
|
||||
}
|
||||
twtype = wtype;
|
||||
@ -1191,7 +1197,7 @@ void InsetFig::Read(LyXLex &lex)
|
||||
case IN: htype = IN; break;
|
||||
case PER_PAGE: htype = PER_PAGE; break;
|
||||
default:
|
||||
lyxerr.debug("Unknown type!");
|
||||
lyxerr.debug() << "Unknown type!" << endl;
|
||||
break;
|
||||
}
|
||||
thtype = htype;
|
||||
@ -1257,7 +1263,7 @@ bool InsetFig::Deletable() const
|
||||
|
||||
void InsetFig::Edit(int, int)
|
||||
{
|
||||
lyxerr.debug("Editing InsetFig.");
|
||||
lyxerr.debug() << "Editing InsetFig." << endl;
|
||||
Regenerate();
|
||||
|
||||
// We should have RO-versions of the form instead.
|
||||
@ -1288,8 +1294,9 @@ Inset *InsetFig::Clone()
|
||||
InsetFig *tmp = new InsetFig(100, 100, owner);
|
||||
|
||||
if (lyxerr.debugging()) {
|
||||
fprintf(stderr, "Clone Figure: buffer:[%d], cbuffer:[xx]\n",
|
||||
PTR_AS_INT(current_view->currentBuffer()));
|
||||
lyxerr << "Clone Figure: buffer:["
|
||||
<< current_view->currentBuffer()
|
||||
<< "], cbuffer:[xx]" << endl;
|
||||
}
|
||||
|
||||
tmp->wid = wid;
|
||||
@ -1632,19 +1639,19 @@ void InsetFig::Recompute()
|
||||
|
||||
switch (htype) {
|
||||
case DEF:
|
||||
//fprintf(stderr, "This should not happen!\n");
|
||||
//lyxerr << "This should not happen!" << endl;
|
||||
break;
|
||||
case CM: /* cm */
|
||||
case CM: /* cm */
|
||||
newy = (int) (28.346*xhgh);
|
||||
break;
|
||||
case IN: /* in */
|
||||
newy = (int) (72*xhgh);
|
||||
break;
|
||||
case PER_PAGE: /* % of page */
|
||||
case PER_PAGE: /* % of page */
|
||||
newy = (int) (8.42*xhgh);
|
||||
break;
|
||||
case PER_COL:
|
||||
// Doesn't occur; case exists to suppress
|
||||
case PER_COL:
|
||||
// Doesn't occur; case exists to suppress
|
||||
// compiler warnings.
|
||||
break;
|
||||
}
|
||||
@ -1731,8 +1738,8 @@ void InsetFig::GetPSSizes()
|
||||
for (;;) {
|
||||
c = fgetc(f);
|
||||
if (c == EOF) {
|
||||
lyxerr.debug("End of (E)PS file reached and"
|
||||
" no BoundingBox!");
|
||||
lyxerr.debug() << "End of (E)PS file reached and"
|
||||
" no BoundingBox!" << endl;
|
||||
break;
|
||||
}
|
||||
if (c == '%' && lastchar == '%') {
|
||||
@ -1750,9 +1757,11 @@ void InsetFig::GetPSSizes()
|
||||
}
|
||||
|
||||
if (lyxerr.debugging()) {
|
||||
fprintf(stderr, "%%%%BoundingBox:"
|
||||
" %d %d %d %d\n",
|
||||
psx, psy, pswid, pshgh);
|
||||
lyxerr << "%%%%BoundingBox:"
|
||||
<< psx << ' '
|
||||
<< psy << ' '
|
||||
<< pswid << ' '
|
||||
<< pshgh << endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1811,7 +1820,7 @@ void InsetFig::CallbackFig(long arg)
|
||||
fl_activate_object(form->Width);
|
||||
break;
|
||||
default:
|
||||
lyxerr.debug("Unknown type!");
|
||||
lyxerr.debug() << "Unknown type!" << endl;
|
||||
break;
|
||||
}
|
||||
regen = true;
|
||||
@ -1842,7 +1851,7 @@ void InsetFig::CallbackFig(long arg)
|
||||
fl_activate_object(form->Height);
|
||||
break;
|
||||
default:
|
||||
lyxerr.debug("Unknown type!");
|
||||
lyxerr.debug() << "Unknown type!" << endl;
|
||||
break;
|
||||
}
|
||||
regen = true;
|
||||
@ -1905,7 +1914,8 @@ void InsetFig::CallbackFig(long arg)
|
||||
Recompute();
|
||||
/* now update inset */
|
||||
if (lyxerr.debugging()) {
|
||||
fprintf(stderr, "Update: [%dx%d]\n", wid, hgh);
|
||||
lyxerr << "Update: ["
|
||||
<< wid << 'x' << hgh << ']' << endl;
|
||||
}
|
||||
UpdateInset(this);
|
||||
if (arg == 8) {
|
||||
@ -2070,7 +2080,7 @@ void InsetFig::Preview(char const *p)
|
||||
pid = fork();
|
||||
|
||||
if (pid == -1) {
|
||||
lyxerr.print("Cannot fork process!");
|
||||
lyxerr << "Cannot fork process!" << endl;
|
||||
return; // error
|
||||
}
|
||||
if (pid > 0) {
|
||||
@ -2081,11 +2091,11 @@ void InsetFig::Preview(char const *p)
|
||||
string buf1 = OnlyPath(owner->getFileName());
|
||||
string buf2 = MakeAbsPath(p, buf1);
|
||||
|
||||
lyxerr.print(string("Error during rendering ") +
|
||||
tostr(execlp(lyxrc->view_pspic_command.c_str(),
|
||||
lyxrc->view_pspic_command.c_str(),
|
||||
buf2.c_str(),
|
||||
0)));
|
||||
lyxerr << "Error during rendering "
|
||||
<< execlp(lyxrc->view_pspic_command.c_str(),
|
||||
lyxrc->view_pspic_command.c_str(),
|
||||
buf2.c_str(), 0)
|
||||
<< endl;
|
||||
_exit(0);
|
||||
}
|
||||
|
||||
@ -2098,7 +2108,8 @@ void InsetFig::BrowseFile()
|
||||
LyXFileDlg fileDlg;
|
||||
|
||||
if (lyxerr.debugging()) {
|
||||
fprintf(stderr, "Filename: %s\n", owner->getFileName().c_str());
|
||||
lyxerr << "Filename: "
|
||||
<< owner->getFileName() << endl;
|
||||
}
|
||||
string p = fl_get_input(form->EpsFile);
|
||||
|
||||
@ -2158,7 +2169,7 @@ void GraphicsCB(FL_OBJECT *obj, long arg)
|
||||
/* obj->form contains the form */
|
||||
|
||||
if (lyxerr.debugging()) {
|
||||
lyxerr.print(string("GraphicsCB callback: ") + tostr(arg));
|
||||
lyxerr << "GraphicsCB callback: " << arg << endl;
|
||||
}
|
||||
|
||||
/* find inset we were reacting to */
|
||||
@ -2167,8 +2178,7 @@ void GraphicsCB(FL_OBJECT *obj, long arg)
|
||||
== obj->form) {
|
||||
|
||||
if (lyxerr.debugging()) {
|
||||
lyxerr.print(string("Calling back figure ")
|
||||
+ tostr(i));
|
||||
lyxerr << "Calling back figure " << i << endl;
|
||||
}
|
||||
figures[i]->inset->CallbackFig(arg);
|
||||
return;
|
||||
@ -2182,8 +2192,7 @@ void HideFiguresPopups()
|
||||
if (figures[i]->inset->form
|
||||
&& figures[i]->inset->form->Figure->visible) {
|
||||
if (lyxerr.debugging()) {
|
||||
lyxerr.print(string("Hiding figure ")
|
||||
+ tostr(i));
|
||||
lyxerr << "Hiding figure " << i << endl;
|
||||
}
|
||||
// hide and free the form
|
||||
figures[i]->inset->CallbackFig(9);
|
||||
|
@ -15,7 +15,7 @@
|
||||
#endif
|
||||
|
||||
#include "lyxinset.h"
|
||||
#include "error.h"
|
||||
#include "debug.h"
|
||||
#include "support/lstrings.h"
|
||||
|
||||
/* Insets default methods */
|
||||
@ -71,34 +71,34 @@ LyXFont Inset::ConvertFont(LyXFont font)
|
||||
|
||||
void UpdatableInset::InsetButtonPress(int x, int y, int button)
|
||||
{
|
||||
lyxerr.debug(string("Inset Button Press x=")+ tostr(x) +
|
||||
", y=" + tostr(y) + ", button=" + tostr(button));
|
||||
lyxerr.debug() << "Inset Button Press x=" << x
|
||||
<< ", y=" << y << ", button=" << button << endl;
|
||||
}
|
||||
|
||||
|
||||
void UpdatableInset::InsetButtonRelease(int x, int y, int button)
|
||||
{
|
||||
lyxerr.debug(string("Inset Button Release x=")+ tostr(x) +
|
||||
", y=" + tostr(y) + ", button=" + tostr(button));
|
||||
lyxerr.debug() << "Inset Button Release x=" << x
|
||||
<< ", y=" << y << ", button=" << button << endl;
|
||||
}
|
||||
|
||||
|
||||
void UpdatableInset::InsetKeyPress(XKeyEvent *)
|
||||
{
|
||||
lyxerr.debug("Inset Keypress");
|
||||
lyxerr.debug() << "Inset Keypress" << endl;
|
||||
}
|
||||
|
||||
|
||||
void UpdatableInset::InsetMotionNotify(int x, int y, int state)
|
||||
{
|
||||
lyxerr.debug(string("Inset Motion Notify x=")+ tostr(x) +
|
||||
", y=" + tostr(y) + ", state=" + tostr(state));
|
||||
lyxerr.debug() << "Inset Motion Notify x=" << x
|
||||
<< ", y=" << y << ", state=" << state << endl;
|
||||
}
|
||||
|
||||
|
||||
void UpdatableInset::InsetUnlock()
|
||||
{
|
||||
lyxerr.debug("Inset Unlock", Error::ANY);
|
||||
lyxerr.debug() << "Inset Unlock" << endl;
|
||||
}
|
||||
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
#include "insetbib.h"
|
||||
#include "combox.h"
|
||||
#include "buffer.h"
|
||||
#include "error.h"
|
||||
#include "debug.h"
|
||||
#include "lyx_gui_misc.h"
|
||||
#include "BufferView.h"
|
||||
#include "gettext.h"
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
#include "insetcommand.h"
|
||||
#include "lyxdraw.h"
|
||||
#include "error.h"
|
||||
#include "debug.h"
|
||||
|
||||
InsetCommand::InsetCommand()
|
||||
{
|
||||
@ -160,12 +160,12 @@ void InsetCommand::scanCommand(string const &cmd)
|
||||
if (!tcontents.empty()) setContents(tcontents);
|
||||
// setContents is overloaded in InsetInclude
|
||||
|
||||
if (lyxerr.debugging(Error::LEX_PARSER))
|
||||
lyxerr.print("Command <" + cmd
|
||||
+ "> == <" + getCommand()
|
||||
+ "> == <" + getCmdName()
|
||||
+ '|' + getContents()
|
||||
+ '|' + getOptions() +'>');
|
||||
if (lyxerr.debugging(Debug::PARSER))
|
||||
lyxerr << "Command <" << cmd
|
||||
<< "> == <" << getCommand()
|
||||
<< "> == <" << getCmdName()
|
||||
<< '|' << getContents()
|
||||
<< '|' << getOptions() << '>' << endl;
|
||||
}
|
||||
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
#include "insetinclude.h"
|
||||
#include "buffer.h"
|
||||
#include "bufferlist.h"
|
||||
#include "error.h"
|
||||
#include "debug.h"
|
||||
#include "support/filetools.h"
|
||||
#include "lyxrc.h"
|
||||
#include "LyXView.h"
|
||||
@ -338,13 +338,13 @@ int InsetInclude::Latex(string &file, signed char /*fragile*/)
|
||||
Buffer *tmp = bufferlist.getBuffer(getFileName());
|
||||
|
||||
if (tmp->params.textclass != master->params.textclass) {
|
||||
lyxerr.print("ERROR: Cannot handle include file `"
|
||||
+ MakeDisplayPath(getFileName())
|
||||
+ "' which has textclass `"
|
||||
+ lyxstyle.NameOfClass(tmp->params.textclass)
|
||||
+ "' instead of `"
|
||||
+ lyxstyle.NameOfClass(master->params.textclass)
|
||||
+ "'.");
|
||||
lyxerr << "ERROR: Cannot handle include file `"
|
||||
<< MakeDisplayPath(getFileName())
|
||||
<< "' which has textclass `"
|
||||
<< lyxstyle.NameOfClass(tmp->params.textclass)
|
||||
<< "' instead of `"
|
||||
<< lyxstyle.NameOfClass(master->params.textclass)
|
||||
<< "'." << endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -360,8 +360,8 @@ int InsetInclude::Latex(string &file, signed char /*fragile*/)
|
||||
} else
|
||||
writefile = getFileName();
|
||||
writefile = ChangeExtension(writefile,".tex",false);
|
||||
lyxerr.debug("incfile:" + incfile, Error::LATEX);
|
||||
lyxerr.debug("writefile:" + writefile, Error::LATEX);
|
||||
lyxerr[Debug::LATEX] << "incfile:" << incfile << endl;
|
||||
lyxerr[Debug::LATEX] << "writefile:" << writefile << endl;
|
||||
|
||||
tmp->markDepClean(master->tmppath);
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include FORMS_H_LOCATION
|
||||
#include "insetindex.h"
|
||||
#include "buffer.h"
|
||||
#include "error.h"
|
||||
#include "debug.h"
|
||||
#include "LaTeXFeatures.h"
|
||||
#include "gettext.h"
|
||||
#include "LString.h"
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
#include "insetinfo.h"
|
||||
#include "lyxparagraph.h"
|
||||
#include "error.h"
|
||||
#include "debug.h"
|
||||
#include "lyxdraw.h"
|
||||
#include "gettext.h"
|
||||
#include "lyx_gui_misc.h" // CancelCloseBoxCB
|
||||
@ -100,8 +100,8 @@ void InsetInfo::Read(LyXLex &lex)
|
||||
{
|
||||
string tmp = lex.GetString(); // should be "Info"
|
||||
if (tmp != "Info")
|
||||
lyxerr.print("ERROR (InsetInfo::Read): "
|
||||
"consistency check 1 failed.");
|
||||
lyxerr << "ERROR (InsetInfo::Read): "
|
||||
"consistency check 1 failed." << endl;
|
||||
|
||||
while (lex.IsOK()) {
|
||||
if (!lex.EatLine())
|
||||
@ -110,7 +110,7 @@ void InsetInfo::Read(LyXLex &lex)
|
||||
continue;
|
||||
|
||||
string const token = strip(lex.GetString());
|
||||
lyxerr.debug("Note: " + token, Error::LEX_PARSER);
|
||||
lyxerr[Debug::PARSER] << "Note: " << token << endl;
|
||||
|
||||
if (token != "\\end_inset") {
|
||||
contents += token + '\n';
|
||||
|
@ -6,7 +6,7 @@
|
||||
* Copyright 1995 Matthias Ettrich
|
||||
* Copyright 1995-1999 The LyX Team.
|
||||
*
|
||||
*======================================================*/
|
||||
* ======================================================*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
#endif
|
||||
|
||||
#include "insetlatexaccent.h"
|
||||
#include "error.h"
|
||||
#include "debug.h"
|
||||
#include "lyxrc.h"
|
||||
#include "lyxdraw.h"
|
||||
#include "support/lstrings.h"
|
||||
@ -102,7 +102,7 @@ void InsetLatexAccent::checkContents()
|
||||
}
|
||||
if (contents[0] != '\\') return; // demand that first char is a '\\'
|
||||
|
||||
lyxerr.debug("Decode: " + contents);
|
||||
lyxerr.debug() << "Decode: " << contents << endl;
|
||||
|
||||
remdot = false; plusasc = false; plusdesc = false;
|
||||
|
||||
@ -213,15 +213,16 @@ void InsetLatexAccent::checkContents()
|
||||
case LSLASH: ic = 'L'; break;
|
||||
default:
|
||||
// if this happens something is really wrong
|
||||
lyxerr.print("InsetLaTexAccent: weird error.");
|
||||
lyxerr << "InsetLaTexAccent: weird error." << endl;
|
||||
break;
|
||||
}
|
||||
//ic = (modtype == DOT_LESS_J ? 'j' : 'i');
|
||||
lyxerr.debug("Contents: [" + contents + "], ic: " + ic
|
||||
+ ", top: " + tostr(plusasc)
|
||||
+ ", bot: " + tostr(plusdesc)
|
||||
+ ", dot: " + tostr(remdot)
|
||||
+ ", mod: " + tostr(modtype));
|
||||
lyxerr.debug() << "Contents: [" << contents << "]"
|
||||
<< ", ic: " << ic
|
||||
<< ", top: " << plusasc
|
||||
<< ", bot: " << plusdesc
|
||||
<< ", dot: " << remdot
|
||||
<< ", mod: " << modtype << endl;
|
||||
// Special case for space
|
||||
} else if (contents[3] == '}') {
|
||||
ic = ' ';
|
||||
@ -255,11 +256,12 @@ void InsetLatexAccent::checkContents()
|
||||
if (contents[++i] != '}' && contents[++i]) return;
|
||||
|
||||
// fine, the char is properly decoded now (hopefully)
|
||||
lyxerr.debug("Contents: [" + contents + "], ic: " + ic
|
||||
+ ", top: " + tostr(plusasc)
|
||||
+ ", bot: " + tostr(plusdesc)
|
||||
+ ", dot: " + tostr(remdot)
|
||||
+ ", mod: " + tostr(modtype));
|
||||
lyxerr.debug() << "Contents: [" << contents << "]"
|
||||
<< ", ic: " << ic
|
||||
<< ", top: " << plusasc
|
||||
<< ", bot: " << plusdesc
|
||||
<< ", dot: " << remdot
|
||||
<< ", mod: " << modtype << endl;
|
||||
}
|
||||
candisp = true;
|
||||
}
|
||||
@ -393,7 +395,7 @@ void InsetLatexAccent::Draw(LyXFont font,
|
||||
int tmpvar = baseline - font.ascent('i');
|
||||
float tmpx = 0;
|
||||
if (font.shape() == LyXFont::ITALIC_SHAPE) tmpx += (8*hg)/10; // italic
|
||||
lyxerr.debug("Removing dot.", Error::ANY);
|
||||
lyxerr.debug() << "Removing dot." << endl;
|
||||
// remove the dot first
|
||||
scr.fillRectangle(gc_clear, int(x + tmpx),
|
||||
tmpvar, wid,
|
||||
@ -663,3 +665,8 @@ bool InsetLatexAccent::IsEqual(Inset* other)
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
ostream & operator<<(ostream & o, InsetLatexAccent::ACCENT_TYPES at)
|
||||
{
|
||||
return o << int(at);
|
||||
}
|
||||
|
@ -8,8 +8,8 @@
|
||||
*
|
||||
*======================================================*/
|
||||
|
||||
#ifndef _INSET_LATEX_ACCENT_H
|
||||
#define _INSET_LATEX_ACCENT_H
|
||||
#ifndef INSET_LATEX_ACCENT_H
|
||||
#define INSET_LATEX_ACCENT_H
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
@ -118,7 +118,8 @@ private:
|
||||
///
|
||||
LSLASH
|
||||
};
|
||||
|
||||
|
||||
friend ostream & operator<<(ostream &, ACCENT_TYPES);
|
||||
/// Check if we know the modifier and can display it ok on screen.
|
||||
void checkContents();
|
||||
///
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
#include "insetquotes.h"
|
||||
#include "support/lyxlib.h"
|
||||
#include "error.h"
|
||||
#include "debug.h"
|
||||
#include "lyxfont.h"
|
||||
#include "lyxrc.h"
|
||||
#include "buffer.h"
|
||||
@ -92,8 +92,8 @@ void InsetQuotes::ParseString(string str)
|
||||
{
|
||||
int i;
|
||||
if (str.length() != 3) {
|
||||
lyxerr.print("ERROR (InsetQuotes::InsetQuotes):"
|
||||
" bad string length.");
|
||||
lyxerr << "ERROR (InsetQuotes::InsetQuotes):"
|
||||
" bad string length." << endl;
|
||||
str = "eld";
|
||||
}
|
||||
|
||||
@ -104,8 +104,8 @@ void InsetQuotes::ParseString(string str)
|
||||
}
|
||||
}
|
||||
if (i>=6) {
|
||||
lyxerr.print("ERROR (InsetQuotes::InsetQuotes):"
|
||||
" bad language specification.");
|
||||
lyxerr << "ERROR (InsetQuotes::InsetQuotes):"
|
||||
" bad language specification." << endl;
|
||||
language = InsetQuotes::EnglishQ;
|
||||
}
|
||||
|
||||
@ -116,8 +116,8 @@ void InsetQuotes::ParseString(string str)
|
||||
}
|
||||
}
|
||||
if (i>=2) {
|
||||
lyxerr.print("ERROR (InsetQuotes::InsetQuotes):"
|
||||
" bad side specification.");
|
||||
lyxerr << "ERROR (InsetQuotes::InsetQuotes):"
|
||||
" bad side specification." << endl;
|
||||
side = InsetQuotes::LeftQ;
|
||||
}
|
||||
|
||||
@ -128,8 +128,8 @@ void InsetQuotes::ParseString(string str)
|
||||
}
|
||||
}
|
||||
if (i>=2) {
|
||||
lyxerr.print("ERROR (InsetQuotes::InsetQuotes):"
|
||||
" bad times specification.");
|
||||
lyxerr << "ERROR (InsetQuotes::InsetQuotes):"
|
||||
" bad times specification." << endl;
|
||||
times = InsetQuotes::DoubleQ;
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include FORMS_H_LOCATION
|
||||
#include "insetref.h"
|
||||
#include "buffer.h"
|
||||
#include "error.h"
|
||||
#include "debug.h"
|
||||
#include "lyx_gui_misc.h" // CancelCloseBoxCB
|
||||
#include "LyXView.h"
|
||||
#include "lyxfunc.h"
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
#include "insetspecialchar.h"
|
||||
#include "lyxdraw.h"
|
||||
#include "error.h"
|
||||
#include "debug.h"
|
||||
#include "LaTeXFeatures.h"
|
||||
|
||||
InsetSpecialChar::InsetSpecialChar()
|
||||
|
26
src/intl.C
26
src/intl.C
@ -6,7 +6,7 @@
|
||||
* Copyright 1995 Matthias Ettrich
|
||||
* Copyright 1995-1999 The LyX Team.
|
||||
*
|
||||
*======================================================*/
|
||||
* ======================================================*/
|
||||
|
||||
/*
|
||||
* International support for LyX
|
||||
@ -24,7 +24,7 @@
|
||||
#include "tex-strings.h"
|
||||
#include "combox.h"
|
||||
#include "lyx_gui_misc.h" // CancelCloseBoxCB
|
||||
#include "error.h"
|
||||
#include "debug.h"
|
||||
#include "lyxrc.h"
|
||||
#include "trans_mgr.h"
|
||||
#include "support/lstrings.h"
|
||||
@ -52,16 +52,16 @@ Intl::~Intl()
|
||||
|
||||
int Intl::SetPrimary(string const & lang)
|
||||
{
|
||||
if (lyxerr.debugging(Error::KBMAP))
|
||||
lyxerr.print("Primary: `" + lang + "'");
|
||||
if (lyxerr.debugging(Debug::KBMAP))
|
||||
lyxerr << "Primary: `" << lang << "'" << endl;
|
||||
return trans->SetPrimary(lang);
|
||||
}
|
||||
|
||||
|
||||
int Intl::SetSecondary(string const & lang)
|
||||
{
|
||||
if (lyxerr.debugging(Error::KBMAP))
|
||||
lyxerr.print("Secondary: `" + lang + "'");
|
||||
if (lyxerr.debugging(Debug::KBMAP))
|
||||
lyxerr << "Secondary: `" << lang << "'" << endl;
|
||||
return trans->SetSecondary(lang);
|
||||
}
|
||||
|
||||
@ -136,8 +136,8 @@ void Intl::KeyMapPrim()
|
||||
/* read text from choice */
|
||||
i = Language->get();
|
||||
|
||||
if (lyxerr.debugging(Error::KBMAP))
|
||||
lyxerr.print(string("Table: ") + tex_babel[i-1]);
|
||||
if (lyxerr.debugging(Debug::KBMAP))
|
||||
lyxerr << "Table: " << tex_babel[i-1] << endl;
|
||||
|
||||
if (i == otherkeymap)
|
||||
p = fl_get_input(fd_form_keymap->OtherKeymap);
|
||||
@ -172,8 +172,8 @@ void Intl::KeyMapSec()
|
||||
/* read text from choice */
|
||||
i = Language2->get();
|
||||
|
||||
if (lyxerr.debugging(Error::KBMAP))
|
||||
lyxerr.print(string("Table: ") + tex_babel[i-1]);
|
||||
if (lyxerr.debugging(Debug::KBMAP))
|
||||
lyxerr << "Table: " << tex_babel[i-1] << endl;
|
||||
|
||||
if (i == otherkeymap)
|
||||
p = fl_get_input(fd_form_keymap->OtherKeymap2);
|
||||
@ -229,7 +229,7 @@ void Intl::DispatchCallback(FL_OBJECT *ob,long code)
|
||||
void Intl::InitKeyMapper(bool on)
|
||||
/* initialize key mapper */
|
||||
{
|
||||
lyxerr.debug("Initializing key mappings...", Error::KBMAP);
|
||||
lyxerr[Debug::KBMAP] << "Initializing key mappings..." << endl;
|
||||
|
||||
if (prim_lang.empty() && sec_lang.empty())
|
||||
keymapon = false;
|
||||
@ -314,8 +314,8 @@ void Intl::Keymap(long code)
|
||||
{
|
||||
char const *p;
|
||||
|
||||
if (lyxerr.debugging(Error::KBMAP))
|
||||
lyxerr.print(string("KeyMap callback: ") + tostr(code));
|
||||
if (lyxerr.debugging(Debug::KBMAP))
|
||||
lyxerr << "KeyMap callback: " << code << endl;
|
||||
|
||||
switch (code) {
|
||||
case 0:
|
||||
|
24
src/kbmap.C
24
src/kbmap.C
@ -19,7 +19,7 @@
|
||||
#endif
|
||||
|
||||
#include "kbmap.h"
|
||||
#include "error.h"
|
||||
#include "debug.h"
|
||||
|
||||
// The only modifiers that we handle. We want to throw away things
|
||||
// like NumLock.
|
||||
@ -219,8 +219,9 @@ int kb_sequence::parse(char const*s)
|
||||
|
||||
key = XStringToKeysym(tbuf);
|
||||
if(key == NoSymbol) {
|
||||
lyxerr.debug("kbmap.C: No such keysym: "
|
||||
+ string(tbuf),Error::KBMAP);
|
||||
lyxerr[Debug::KBMAP]
|
||||
<< "kbmap.C: No such keysym: "
|
||||
<< tbuf << endl;
|
||||
return j;
|
||||
}
|
||||
i = j;
|
||||
@ -387,8 +388,9 @@ int kb_keymap::bind(char const *seq, int action)
|
||||
if (!res) {
|
||||
defkey(&k, action);
|
||||
} else
|
||||
lyxerr.debug(string("Parse error at position ") + tostr(res) +
|
||||
" in key sequence '" + seq + "'.", Error::KBMAP);
|
||||
lyxerr[Debug::KBMAP] << "Parse error at position " << res
|
||||
<< " in key sequence '" << seq << "'."
|
||||
<< endl;
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -549,8 +551,11 @@ int kb_keymap::defkey(kb_sequence *seq, int action, int idx /*=0*/)
|
||||
if(idx+1 == seq->length) {
|
||||
char buf[20]; buf[0] = 0;
|
||||
seq->print(buf, 20, true);
|
||||
lyxerr.debug(string("Warning: New binding for '") + buf +
|
||||
"' is overriding old binding...", Error::KEY);
|
||||
lyxerr[Debug::KEY]
|
||||
<< "Warning: New binding for '"
|
||||
<< buf
|
||||
<< "' is overriding old binding..."
|
||||
<< endl;
|
||||
|
||||
if(t->table) {
|
||||
delete t->table;
|
||||
@ -561,8 +566,9 @@ int kb_keymap::defkey(kb_sequence *seq, int action, int idx /*=0*/)
|
||||
} else if (!t->table) {
|
||||
char buf[20]; buf[0] = 0;
|
||||
seq->print(buf, 20, true);
|
||||
lyxerr.print(string("Error: New binding for '") + buf +
|
||||
"' is overriding old binding...");
|
||||
lyxerr << "Error: New binding for '" << buf
|
||||
<< "' is overriding old binding..."
|
||||
<< endl;
|
||||
return -1;
|
||||
} else
|
||||
return t->table->defkey(seq, action, idx+1);
|
||||
|
@ -4,7 +4,7 @@
|
||||
Author : chb, 30.Oct.1995
|
||||
Docu : see kbmap.C
|
||||
Purpose: class definitions for XKeyEvent keymap handling
|
||||
\* ======================================================================= */
|
||||
\* ==================================================================== */
|
||||
|
||||
#ifndef KBMAP_H
|
||||
#define KBMAP_H
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include "support/FileInfo.h"
|
||||
#include "lastfiles.h"
|
||||
#include "support/filetools.h"
|
||||
#include "error.h"
|
||||
#include "debug.h"
|
||||
|
||||
LastFiles::LastFiles(string const & filename, bool st, char num)
|
||||
: dostat(st)
|
||||
@ -41,8 +41,9 @@ void LastFiles::setNumberOfFiles(char no)
|
||||
if (1 <= no && no <= ABSOLUTEMAXLASTFILES)
|
||||
num_files = no;
|
||||
else {
|
||||
lyxerr.print(string("LyX: lastfiles: too many files\n"
|
||||
"\tdefault (=") + tostr(DEFAULTFILES) + ") used.");
|
||||
lyxerr << "LyX: lastfiles: too many files\n"
|
||||
"\tdefault (=" << int(DEFAULTFILES) // int() only because of anon enum
|
||||
<< ") used." << endl;
|
||||
num_files = DEFAULTFILES;
|
||||
}
|
||||
}
|
||||
@ -95,8 +96,8 @@ void LastFiles::writeFile(string const & filename) const
|
||||
fprintf(fd, "\"%s\"\n", files[i].c_str());
|
||||
}
|
||||
} else
|
||||
lyxerr.print("LyX: Warning: unable to save LastFiles: "
|
||||
+ filename);
|
||||
lyxerr << "LyX: Warning: unable to save LastFiles: "
|
||||
<< filename << endl;
|
||||
}
|
||||
|
||||
|
||||
|
74
src/layout.C
74
src/layout.C
@ -35,7 +35,7 @@
|
||||
#include "lyxlex.h"
|
||||
#include "support/filetools.h"
|
||||
#include "lyx_gui_misc.h"
|
||||
#include "error.h"
|
||||
#include "debug.h"
|
||||
#include "gettext.h"
|
||||
|
||||
/* Global variable: textclass table */
|
||||
@ -44,15 +44,15 @@ LyXTextClassList lyxstyle;
|
||||
// Reads the style files
|
||||
void LyXSetStyle()
|
||||
{
|
||||
lyxerr.debug("LyXSetStyle: parsing configuration...");
|
||||
lyxerr.debug() << "LyXSetStyle: parsing configuration..." << endl;
|
||||
|
||||
if (!lyxstyle.Read()) {
|
||||
lyxerr.print("LyXSetStyle: an error occured during parsing.");
|
||||
lyxerr.print(" Exiting.");
|
||||
lyxerr << "LyXSetStyle: an error occured during parsing.\n"
|
||||
<< " Exiting." << endl;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
lyxerr.debug("LyXSetStyle: configuration parsed.");
|
||||
lyxerr.debug() << "LyXSetStyle: configuration parsed." << endl;
|
||||
}
|
||||
|
||||
|
||||
@ -814,11 +814,12 @@ LyXTextClass::~LyXTextClass()
|
||||
int LyXTextClass::Read (string const &filename, LyXLayoutList *list)
|
||||
{
|
||||
if (!list)
|
||||
lyxerr.debug("Reading textclass "
|
||||
+ MakeDisplayPath(filename), Error::TCLASS);
|
||||
lyxerr[Debug::TCLASS] << "Reading textclass "
|
||||
<< MakeDisplayPath(filename)
|
||||
<< endl;
|
||||
else
|
||||
lyxerr.debug("Reading input file "
|
||||
+ MakeDisplayPath(filename), Error::TCLASS);
|
||||
lyxerr[Debug::TCLASS] << "Reading input file "
|
||||
<< MakeDisplayPath(filename) << endl;
|
||||
|
||||
LyXLex lexrc(layoutTags, sizeof(layoutTags)/sizeof(keyword_item));
|
||||
bool error = false;
|
||||
@ -892,7 +893,9 @@ int LyXTextClass::Read (string const &filename, LyXLayoutList *list)
|
||||
tmpl->name = name;
|
||||
}
|
||||
|
||||
lyxerr.debug(" Reading style "+tmpl->name, Error::TCLASS);
|
||||
lyxerr[Debug::TCLASS] << " Reading style "
|
||||
<< tmpl->name
|
||||
<< endl;
|
||||
|
||||
if (!tmpl->Read(lexrc, l)) {
|
||||
// Resolve fonts
|
||||
@ -1072,12 +1075,14 @@ int LyXTextClass::Read (string const &filename, LyXLayoutList *list)
|
||||
number_of_defined_layouts = l->GetNum();
|
||||
delete l;
|
||||
}
|
||||
lyxerr.debug("Finished reading textclass "
|
||||
+ MakeDisplayPath(filename), Error::TCLASS);
|
||||
lyxerr[Debug::TCLASS] << "Finished reading textclass "
|
||||
<< MakeDisplayPath(filename)
|
||||
<< endl;
|
||||
}
|
||||
else
|
||||
lyxerr.debug("Finished reading input file "
|
||||
+ MakeDisplayPath(filename), Error::TCLASS);
|
||||
lyxerr[Debug::TCLASS] << "Finished reading input file "
|
||||
<< MakeDisplayPath(filename)
|
||||
<< endl;
|
||||
|
||||
return error;
|
||||
}
|
||||
@ -1093,11 +1098,11 @@ void LyXTextClass::load()
|
||||
string real_file = LibFileSearch("layouts", name, "layout");
|
||||
|
||||
if (Read(real_file)) {
|
||||
lyxerr.print("Error reading `"
|
||||
+ MakeDisplayPath(real_file) + '\'');
|
||||
lyxerr.print("(Check `" + name + "')");
|
||||
lyxerr.print("Check your installation and "
|
||||
"try Options/Reconfigure...");
|
||||
lyxerr << "Error reading `"
|
||||
<< MakeDisplayPath(real_file)
|
||||
<< "'\n(Check `" << name
|
||||
<< "')\nCheck your installation and "
|
||||
"try Options/Reconfigure..." << endl;
|
||||
}
|
||||
loaded = true;
|
||||
}
|
||||
@ -1274,12 +1279,13 @@ bool LyXTextClassList::Read ()
|
||||
{
|
||||
LyXLex lex(0, 0);
|
||||
string real_file = LibFileSearch("", "textclass.lst");
|
||||
lyxerr.debug("Reading textclasses from "+real_file,Error::TCLASS);
|
||||
lyxerr[Debug::TCLASS] << "Reading textclasses from "
|
||||
<< real_file << endl;
|
||||
|
||||
if (real_file.empty()) {
|
||||
lyxerr.print("LyXTextClassList::Read: unable to find "
|
||||
"textclass file `" +
|
||||
MakeDisplayPath(real_file, 1000) + "'. Exiting.");
|
||||
lyxerr << "LyXTextClassList::Read: unable to find "
|
||||
"textclass file `" << MakeDisplayPath(real_file, 1000)
|
||||
<< "'. Exiting." << endl;
|
||||
|
||||
WriteAlert(_("LyX wasn't able to find its layout descriptions!"),
|
||||
_("Check that the file \"textclass.lst\""),
|
||||
@ -1293,10 +1299,10 @@ bool LyXTextClassList::Read ()
|
||||
lex.setFile(real_file);
|
||||
|
||||
if (!lex.IsOK()) {
|
||||
lyxerr.print("LyXTextClassList::Read: unable to open "
|
||||
"textclass file `" +
|
||||
MakeDisplayPath(real_file, 1000) + '\'');
|
||||
lyxerr.print("Check your installation. LyX can't continue.");
|
||||
lyxerr << "LyXTextClassList::Read: unable to open "
|
||||
"textclass file `" << MakeDisplayPath(real_file, 1000)
|
||||
<< "\'\nCheck your installation. LyX can't continue."
|
||||
<< endl;
|
||||
return false;
|
||||
}
|
||||
bool finished = false;
|
||||
@ -1311,15 +1317,15 @@ bool LyXTextClassList::Read ()
|
||||
break;
|
||||
default:
|
||||
fname = lex.GetString();
|
||||
lyxerr.debug("Fname: " + fname, Error::TCLASS);
|
||||
lyxerr[Debug::TCLASS] << "Fname: " << fname << endl;
|
||||
if (lex.next()) {
|
||||
clname = lex.GetString();
|
||||
lyxerr.debug("Clname: " + clname,
|
||||
Error::TCLASS);
|
||||
lyxerr[Debug::TCLASS]
|
||||
<< "Clname: " << clname << endl;
|
||||
if (lex.next()) {
|
||||
desc = lex.GetString();
|
||||
lyxerr.debug("Desc: " + desc,
|
||||
Error::TCLASS);
|
||||
lyxerr[Debug::TCLASS]
|
||||
<< "Desc: " << desc << endl;
|
||||
// This code is run when we have
|
||||
// fname, clname and desc
|
||||
tmpl =new LyXTextClass(fname,
|
||||
@ -1327,7 +1333,7 @@ bool LyXTextClassList::Read ()
|
||||
desc);
|
||||
Add (tmpl);
|
||||
if (lyxerr.
|
||||
debugging(Error::TCLASS)) {
|
||||
debugging(Debug::TCLASS)) {
|
||||
tmpl->load();
|
||||
}
|
||||
}
|
||||
@ -1336,7 +1342,7 @@ bool LyXTextClassList::Read ()
|
||||
}
|
||||
|
||||
if (num_textclass == 0) {
|
||||
lyxerr.print("LyXTextClassList::Read: no textclass found!");
|
||||
lyxerr << "LyXTextClassList::Read: no textclass found!" << endl;
|
||||
WriteAlert(_("LyX wasn't able to find any layout description!"),
|
||||
_("Check the contents of the file \"textclass.lst\""),
|
||||
_("Sorry, has to exit :-("));
|
||||
|
20
src/lyx_cb.C
20
src/lyx_cb.C
@ -49,7 +49,7 @@
|
||||
#include "lastfiles.h"
|
||||
#include "support/FileInfo.h"
|
||||
#include "lyxscreen.h"
|
||||
#include "error.h"
|
||||
#include "debug.h"
|
||||
#include "support/syscall.h"
|
||||
#include "support/lyxlib.h"
|
||||
#include "lyxserver.h"
|
||||
@ -979,7 +979,7 @@ void MenuPrint(Buffer *buffer)
|
||||
|
||||
void QuitLyX()
|
||||
{
|
||||
lyxerr.debug("Running QuitLyX.");
|
||||
lyxerr.debug() << "Running QuitLyX." << endl;
|
||||
|
||||
if (!bufferlist.QwriteAll())
|
||||
return;
|
||||
@ -994,7 +994,7 @@ void QuitLyX()
|
||||
bufferlist.closeAll();
|
||||
|
||||
// do any other cleanup procedures now
|
||||
lyxerr.debug("Deleting tmp dir " + system_tempdir);
|
||||
lyxerr.debug() << "Deleting tmp dir " << system_tempdir << endl;
|
||||
|
||||
DestroyLyXTmpDir(system_tempdir);
|
||||
|
||||
@ -1091,9 +1091,9 @@ Buffer * NewLyxFile(string const & filename)
|
||||
tmpname = split(tmpname, ':');
|
||||
}
|
||||
#endif
|
||||
lyxerr.debug("Arg is " + filename);
|
||||
lyxerr.debug("Name is " + name);
|
||||
lyxerr.debug("Template is " + tmpname);
|
||||
lyxerr.debug() << "Arg is " << filename
|
||||
<< "\nName is " << name
|
||||
<< "\nTemplate is " << tmpname << endl;
|
||||
|
||||
// find a free buffer
|
||||
Buffer *tmpbuf = bufferlist.newFile(name,tmpname);
|
||||
@ -2946,19 +2946,19 @@ void DocumentApplyCB(FL_OBJECT *, long)
|
||||
Spacing tmpSpacing = params->spacing;
|
||||
switch(fl_get_choice(fd_form_document->choice_spacing)) {
|
||||
case 1:
|
||||
lyxerr.debug("Spacing: SINGLE");
|
||||
lyxerr.debug() << "Spacing: SINGLE" << endl;
|
||||
params->spacing.set(Spacing::Single);
|
||||
break;
|
||||
case 2:
|
||||
lyxerr.debug("Spacing: ONEHALF");
|
||||
lyxerr.debug() << "Spacing: ONEHALF" << endl;
|
||||
params->spacing.set(Spacing::Onehalf);
|
||||
break;
|
||||
case 3:
|
||||
lyxerr.debug("Spacing: DOUBLE");
|
||||
lyxerr.debug() << "Spacing: DOUBLE" << endl;
|
||||
params->spacing.set(Spacing::Double);
|
||||
break;
|
||||
case 4:
|
||||
lyxerr.debug("Spacing: OTHER");
|
||||
lyxerr.debug() << "Spacing: OTHER" << endl;
|
||||
params->spacing.set(Spacing::Other,
|
||||
fl_get_input(fd_form_document->input_spacing));
|
||||
break;
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include "tex-strings.h"
|
||||
#include "lyx_main.h"
|
||||
#include "latexoptions.h"
|
||||
#include "error.h"
|
||||
#include "debug.h"
|
||||
#include "version.h"
|
||||
#include "LyXView.h"
|
||||
#include "buffer.h"
|
||||
@ -154,7 +154,7 @@ static int LyX_XErrHandler(Display *display, XErrorEvent *xeev)
|
||||
// Get the reason for the crash.
|
||||
char etxt[513];
|
||||
XGetErrorText(display, xeev->error_code, etxt, 512);
|
||||
lyxerr.print(etxt);
|
||||
lyxerr << etxt << endl;
|
||||
// By doing an abort we get a nice backtrace. (hopefully)
|
||||
abort();
|
||||
return 0; // Solaris CC wants us to return something
|
||||
@ -175,7 +175,7 @@ LyXGUI::LyXGUI(LyX *owner, int *argc, char *argv[], bool GUI)
|
||||
fl_get_app_resources(res, num_res);
|
||||
Display *display = fl_get_display();
|
||||
if (!display) {
|
||||
lyxerr.print("LyX: unable to access X display, exiting");
|
||||
lyxerr << "LyX: unable to access X display, exiting" << endl;
|
||||
exit(1);
|
||||
}
|
||||
fcntl(ConnectionNumber(display), F_SETFD, FD_CLOEXEC);
|
||||
@ -259,7 +259,8 @@ void LyXGUI::init()
|
||||
fl_set_font_name(FL_BOLD_STYLE, menufontname.c_str());
|
||||
else
|
||||
#endif
|
||||
lyxerr.print("Could not set menu font to " + menufontname);
|
||||
lyxerr << "Could not set menu font to "
|
||||
<< menufontname << endl;
|
||||
|
||||
#if FL_REVISION > 85
|
||||
if (fl_set_font_name(FL_NORMAL_STYLE, popupfontname.c_str()) < 0)
|
||||
@ -271,7 +272,8 @@ void LyXGUI::init()
|
||||
fl_set_font_name(FL_NORMAL_STYLE, popupfontname.c_str());
|
||||
else
|
||||
#endif
|
||||
lyxerr.print("Could not set popup font to " + popupfontname);
|
||||
lyxerr << "Could not set popup font to "
|
||||
<< popupfontname << endl;
|
||||
|
||||
// put here (after fl_initialize) to avoid segfault. Cannot be done
|
||||
// in setDefaults() (Matthias 140496)
|
||||
@ -323,9 +325,9 @@ void LyXGUI::init()
|
||||
|
||||
void LyXGUI::create_forms()
|
||||
{
|
||||
lyxerr.debug("Initializing LyXView...");
|
||||
lyxerr.debug() << "Initializing LyXView..." << endl;
|
||||
lyxViews = new LyXView(width, height);
|
||||
lyxerr.debug("Initializing LyXView...done");
|
||||
lyxerr.debug() << "Initializing LyXView...done" << endl;
|
||||
|
||||
// From here down should be done by somebody else. (Lgb)
|
||||
|
||||
@ -622,7 +624,7 @@ void LyXGUI::runTime()
|
||||
|
||||
while (!finished) {
|
||||
if (fl_check_forms() == FL_EVENT) {
|
||||
lyxerr.print("LyX: This shouldn't happen...");
|
||||
lyxerr << "LyX: This shouldn't happen..." << endl;
|
||||
fl_XNextEvent(&ev);
|
||||
}
|
||||
}
|
||||
|
@ -321,7 +321,7 @@ const char* flyx_shortcut_extract(const char*sc)
|
||||
|
||||
if (sd[0]=='|') {
|
||||
sd++;
|
||||
//fprintf(stderr, "%s\n", sd);
|
||||
//lyxerr << sd << endl;
|
||||
return sd;
|
||||
}
|
||||
return "";
|
||||
|
201
src/lyx_main.C
201
src/lyx_main.C
@ -21,7 +21,7 @@
|
||||
#include "pathstack.h"
|
||||
#include "support/filetools.h"
|
||||
#include "bufferlist.h"
|
||||
#include "error.h"
|
||||
#include "debug.h"
|
||||
#include "support/FileInfo.h"
|
||||
#include "lastfiles.h"
|
||||
#include "intl.h"
|
||||
@ -37,7 +37,7 @@ string system_tempdir;
|
||||
string user_lyxdir; // Default $HOME/.lyx
|
||||
|
||||
// Should this be kept global? Asger says Yes.
|
||||
Error lyxerr;
|
||||
DebugStream lyxerr;
|
||||
|
||||
LastFiles *lastfiles;
|
||||
LyXRC *lyxrc;
|
||||
@ -70,19 +70,19 @@ LyX::LyX(int *argc, char *argv[])
|
||||
// Global bindings (this must be done as early as possible.) (Lgb)
|
||||
toplevel_keymap = new kb_keymap;
|
||||
|
||||
lyxerr.debug("Initializing lyxrc");
|
||||
lyxerr.debug() << "Initializing lyxrc" << endl;
|
||||
lyxrc = new LyXRC;
|
||||
|
||||
// Make the GUI object, and let it take care of the
|
||||
// command line arguments that concerns it.
|
||||
lyxerr.debug("Initializing LyXGUI...");
|
||||
lyxerr.debug() << "Initializing LyXGUI..." << endl;
|
||||
lyxGUI = new LyXGUI(this, argc, argv, gui);
|
||||
lyxerr.debug("Initializing LyXGUI...done");
|
||||
lyxerr.debug() << "Initializing LyXGUI...done" << endl;
|
||||
|
||||
// Initialization of LyX (reads lyxrc and more)
|
||||
lyxerr.debug("Initializing LyX::init...");
|
||||
lyxerr.debug() << "Initializing LyX::init..." << endl;
|
||||
init(argc, argv);
|
||||
lyxerr.debug("Initializing LyX::init...done");
|
||||
lyxerr.debug() << "Initializing LyX::init...done" << endl;
|
||||
|
||||
lyxGUI->init();
|
||||
|
||||
@ -91,9 +91,9 @@ LyX::LyX(int *argc, char *argv[])
|
||||
// the only thing left on the command line should be
|
||||
// filenames.
|
||||
if ((*argc)==2)
|
||||
lyxerr.debug("Opening document...");
|
||||
lyxerr.debug() << "Opening document..." << endl;
|
||||
else if ((*argc)>2)
|
||||
lyxerr.debug("Opening documents...");
|
||||
lyxerr.debug() << "Opening documents..." << endl;
|
||||
|
||||
Buffer *last_loaded = 0;
|
||||
|
||||
@ -106,7 +106,8 @@ LyX::LyX(int *argc, char *argv[])
|
||||
|
||||
if (first_start) {
|
||||
string splash = i18nLibFileSearch("examples", "splash.lyx");
|
||||
lyxerr.debug("Opening splash document "+splash+"...");
|
||||
lyxerr.debug() << "Opening splash document "
|
||||
<< splash << "..." << endl;
|
||||
Buffer * loadb = bufferlist.loadLyXFile(splash);
|
||||
if (loadb != 0) {
|
||||
last_loaded = loadb;
|
||||
@ -114,7 +115,7 @@ LyX::LyX(int *argc, char *argv[])
|
||||
}
|
||||
|
||||
if (last_loaded != 0) {
|
||||
lyxerr.debug("Yes we loaded some files.");
|
||||
lyxerr.debug() << "Yes we loaded some files." << endl;
|
||||
lyxGUI->regBuf(last_loaded);
|
||||
}
|
||||
|
||||
@ -175,10 +176,12 @@ void LyX::init(int */*argc*/, char **argv)
|
||||
binpath = MakeAbsPath(OnlyPath(binpath));
|
||||
|
||||
if (binpath.empty()) {
|
||||
lyxerr.print(_("Warning: could not determine path of binary."));
|
||||
lyxerr.print(_("If you have problems, try starting LyX with an absolute path."));
|
||||
lyxerr << _("Warning: could not determine path of binary.")
|
||||
<< "\n"
|
||||
<< _("If you have problems, try starting LyX with an absolute path.")
|
||||
<< endl;
|
||||
}
|
||||
lyxerr.debug("Path of binary: " + binpath);
|
||||
lyxerr.debug() << "Path of binary: " << binpath << endl;
|
||||
|
||||
//
|
||||
// Determine system directory.
|
||||
@ -207,7 +210,7 @@ void LyX::init(int */*argc*/, char **argv)
|
||||
string lyxdir = GetEnvPath("LYX_DIR_10x");
|
||||
|
||||
if (!lyxdir.empty()) {
|
||||
lyxerr.debug("LYX_DIR_10x: " + lyxdir, Error::INIT);
|
||||
lyxerr[Debug::INIT] << "LYX_DIR_10x: " << lyxdir << endl;
|
||||
searchpath += lyxdir + ';';
|
||||
}
|
||||
|
||||
@ -216,11 +219,12 @@ void LyX::init(int */*argc*/, char **argv)
|
||||
if (!FileSearch(build_lyxdir, "lyxrc.defaults").empty()) {
|
||||
searchpath += MakeAbsPath(AddPath(TOP_SRCDIR, "lib"),
|
||||
binpath) + ';';
|
||||
lyxerr.debug("Checking whether LyX is run in "
|
||||
"place... yes", Error::INIT);
|
||||
lyxerr[Debug::INIT] << "Checking whether LyX is run in "
|
||||
"place... yes" << endl;
|
||||
} else {
|
||||
lyxerr.debug("Checking whether LyX is run in place... no",
|
||||
Error::INIT);
|
||||
lyxerr[Debug::INIT]
|
||||
<< "Checking whether LyX is run in place... no"
|
||||
<< endl;
|
||||
build_lyxdir.erase();
|
||||
}
|
||||
|
||||
@ -250,7 +254,8 @@ void LyX::init(int */*argc*/, char **argv)
|
||||
searchpath += LYX_DIR;
|
||||
|
||||
// If debugging, show complete search path
|
||||
lyxerr.debug("System directory search path: "+searchpath, Error::INIT);
|
||||
lyxerr[Debug::INIT] << "System directory search path: "
|
||||
<< searchpath << endl;
|
||||
|
||||
string const filename = "chkconfig.ltx";
|
||||
string temp = FileOpenSearch(searchpath, filename, string());
|
||||
@ -264,41 +269,43 @@ void LyX::init(int */*argc*/, char **argv)
|
||||
// Warn if environment variable is set, but unusable
|
||||
if (!lyxdir.empty()) {
|
||||
if (system_lyxdir != NormalizePath(lyxdir)) {
|
||||
lyxerr.print(_("LYX_DIR_10x environment variable no good."));
|
||||
lyxerr.print(_("System directory set to: ")
|
||||
+ system_lyxdir);
|
||||
lyxerr <<_("LYX_DIR_10x environment variable no good.")
|
||||
<< '\n'
|
||||
<< _("System directory set to: ")
|
||||
<< system_lyxdir << endl;
|
||||
path_shown = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Warn the user if we couldn't find "chkconfig.ltx"
|
||||
if (system_lyxdir.empty()) {
|
||||
lyxerr.print(_("LyX Warning! Couldn't determine system directory."));
|
||||
lyxerr.print(_("Try the '-sysdir' command line parameter or"));
|
||||
lyxerr.print(_("set the environment variable LYX_DIR_10x to the "
|
||||
"LyX system directory"));
|
||||
lyxerr.print(_("containing the file `chkconfig.ltx'."));
|
||||
lyxerr <<_("LyX Warning! Couldn't determine system directory.")
|
||||
<<_("Try the '-sysdir' command line parameter or")
|
||||
<<_("set the environment variable LYX_DIR_10x to the "
|
||||
"LyX system directory")
|
||||
<< _("containing the file `chkconfig.ltx'.") << endl;
|
||||
if (!path_shown)
|
||||
lyxerr.print(_("Using built-in default ")
|
||||
+ string(LYX_DIR) + _(" but expect problems."));
|
||||
lyxerr << _("Using built-in default ")
|
||||
<< LYX_DIR << _(" but expect problems.")
|
||||
<< endl;
|
||||
else
|
||||
lyxerr.print(_("Expect problems."));
|
||||
lyxerr << _("Expect problems.") << endl;
|
||||
system_lyxdir = LYX_DIR;
|
||||
path_shown = true;
|
||||
}
|
||||
|
||||
// Report the system directory if debugging is on
|
||||
if (!path_shown)
|
||||
lyxerr.debug("System directory: '" + system_lyxdir + '\'',
|
||||
Error::INIT);
|
||||
lyxerr[Debug::INIT] << "System directory: '"
|
||||
<< system_lyxdir << '\'' << endl;
|
||||
|
||||
//
|
||||
// Determine user lyx-dir
|
||||
//
|
||||
|
||||
user_lyxdir = AddPath(GetEnvPath("HOME"), string(".") + LYX_NAME);
|
||||
lyxerr.debug("User LyX directory: '"
|
||||
+ user_lyxdir + '\'', Error::INIT);
|
||||
lyxerr[Debug::INIT] << "User LyX directory: '"
|
||||
<< user_lyxdir << '\'' << endl;
|
||||
|
||||
// Check that user LyX directory is ok.
|
||||
queryUserLyXDir();
|
||||
@ -307,7 +314,7 @@ void LyX::init(int */*argc*/, char **argv)
|
||||
// Load the layouts first
|
||||
//
|
||||
|
||||
lyxerr.debug("Reading layouts...", Error::INIT);
|
||||
lyxerr[Debug::INIT] << "Reading layouts..." << endl;
|
||||
LyXSetStyle();
|
||||
|
||||
//
|
||||
@ -328,8 +335,8 @@ void LyX::init(int */*argc*/, char **argv)
|
||||
Screen * scr=(DefaultScreenOfDisplay(fl_get_display()));
|
||||
lyxrc->dpi = ((HeightOfScreen(scr)* 25.4 / HeightMMOfScreen(scr)) +
|
||||
(WidthOfScreen(scr)* 25.4 / WidthMMOfScreen(scr))) / 2;
|
||||
lyxerr.debug(string("DPI setting detected to be ") +
|
||||
tostr(lyxrc->dpi+0.5));
|
||||
lyxerr.debug() << "DPI setting detected to be "
|
||||
<< lyxrc->dpi+0.5 << endl;
|
||||
|
||||
//
|
||||
// Read configuration files
|
||||
@ -343,19 +350,19 @@ void LyX::init(int */*argc*/, char **argv)
|
||||
if (!lyxrc->hasBindFile)
|
||||
lyxrc->ReadBindFile();
|
||||
|
||||
if (lyxerr.debugging(Error::LYXRC)) {
|
||||
if (lyxerr.debugging(Debug::LYXRC)) {
|
||||
lyxrc->Print();
|
||||
}
|
||||
|
||||
// Create temp directory
|
||||
system_tempdir = CreateLyXTmpDir(lyxrc->tempdir_path);
|
||||
if (lyxerr.debugging(Error::INIT)) {
|
||||
lyxerr.print("LyX tmp dir: `" + system_tempdir + '\'');
|
||||
if (lyxerr.debugging(Debug::INIT)) {
|
||||
lyxerr << "LyX tmp dir: `" << system_tempdir << '\'' << endl;
|
||||
}
|
||||
|
||||
// load the lastfiles mini-database
|
||||
lyxerr.debug("Reading lastfiles `" + lyxrc->lastfiles + "'...",
|
||||
Error::INIT);
|
||||
lyxerr[Debug::INIT] << "Reading lastfiles `"
|
||||
<< lyxrc->lastfiles << "'..." << endl;
|
||||
lastfiles = new LastFiles(lyxrc->lastfiles,
|
||||
lyxrc->check_lastfiles,
|
||||
lyxrc->num_lastfiles);
|
||||
@ -384,20 +391,22 @@ void LyX::queryUserLyXDir()
|
||||
if (!AskQuestion(_("You don't have a personal LyX directory."),
|
||||
_("It is needed to keep your own configuration."),
|
||||
_("Should I try to set it up for you (recommended)?"))) {
|
||||
lyxerr.print(_("Running without personal LyX directory."));
|
||||
lyxerr << _("Running without personal LyX directory.") << endl;
|
||||
// No, let's use $HOME instead.
|
||||
user_lyxdir = GetEnvPath("HOME");
|
||||
return;
|
||||
}
|
||||
|
||||
// Tell the user what is going on
|
||||
lyxerr.print(_("LyX: Creating directory ") + user_lyxdir + _(" and running configure..."));
|
||||
lyxerr << _("LyX: Creating directory ") << user_lyxdir
|
||||
<< _(" and running configure...") << endl;
|
||||
|
||||
// Create directory structure
|
||||
if (!createDirectory(user_lyxdir, 0755)) {
|
||||
// Failed, let's use $HOME instead.
|
||||
user_lyxdir = GetEnvPath("HOME");
|
||||
lyxerr.print(_("Failed. Will use ") + user_lyxdir + _(" instead."));
|
||||
lyxerr << _("Failed. Will use ") << user_lyxdir
|
||||
<< _(" instead.") << endl;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -405,80 +414,68 @@ void LyX::queryUserLyXDir()
|
||||
PathPush(user_lyxdir);
|
||||
system(AddName(system_lyxdir,"configure").c_str());
|
||||
PathPop();
|
||||
lyxerr.print(string("LyX: ") + _("Done!"));
|
||||
lyxerr << "LyX: " << _("Done!") << endl;
|
||||
}
|
||||
|
||||
|
||||
// Read the rc file `name'
|
||||
void LyX::ReadRcFile(string const & name)
|
||||
{
|
||||
lyxerr.debug("About to read "+name+"...", Error::INIT);
|
||||
lyxerr[Debug::INIT] << "About to read " << name << "..." << endl;
|
||||
|
||||
string lyxrc_path = LibFileSearch(string(), name);
|
||||
if (!lyxrc_path.empty()){
|
||||
lyxerr.debug("Found "+name+" in " + lyxrc_path, Error::INIT);
|
||||
lyxerr[Debug::INIT] << "Found " << name
|
||||
<< " in " << lyxrc_path << endl;
|
||||
if (lyxrc->Read(lyxrc_path) < 0) {
|
||||
WriteAlert(_("LyX Warning!"),
|
||||
_("Error while reading ")+lyxrc_path+".",
|
||||
_("Using built-in defaults."));
|
||||
}
|
||||
} else
|
||||
lyxerr.debug("Could not find "+name, Error::INIT);
|
||||
lyxerr[Debug::INIT] << "Could not find " << name << endl;
|
||||
}
|
||||
|
||||
|
||||
// Set debugging level and report result to user
|
||||
void setDebuggingLevel(int dbgLevel)
|
||||
{
|
||||
lyxerr.print(string(_("Setting debug level to ")) + tostr(dbgLevel));
|
||||
lyxerr.setDebugLevel(dbgLevel);
|
||||
lyxerr.debug(string("Debugging INFO #") + tostr(Error::INFO),
|
||||
Error::INFO);
|
||||
lyxerr.debug(string("Debugging INIT #") + tostr(Error::INIT),
|
||||
Error::INIT);
|
||||
lyxerr.debug(string("Debugging KEY #") + tostr(Error::KEY),
|
||||
Error::KEY);
|
||||
lyxerr.debug(string("Debugging TOOLBAR #") + tostr(Error::TOOLBAR),
|
||||
Error::TOOLBAR);
|
||||
lyxerr.debug(string("Debugging LEX and PARSER #") +
|
||||
tostr(Error::LEX_PARSER),
|
||||
Error::LEX_PARSER);
|
||||
lyxerr.debug(string("Debugging LYXRC #") + tostr(Error::LYXRC),
|
||||
Error::LYXRC);
|
||||
lyxerr.debug(string("Debugging KBMAP #") + tostr(Error::KBMAP),
|
||||
Error::KBMAP);
|
||||
lyxerr.debug(string("Debugging LATEX #") + tostr(Error::LATEX),
|
||||
Error::LATEX);
|
||||
lyxerr.debug(string("Debugging MATHED #") + tostr(Error::MATHED),
|
||||
Error::MATHED);
|
||||
lyxerr.debug(string("Debugging FONT #") + tostr(Error::FONT),
|
||||
Error::FONT);
|
||||
lyxerr.debug(string("Debugging TCLASS #") + tostr(Error::TCLASS),
|
||||
Error::TCLASS);
|
||||
lyxerr.debug(string("Debugging LYXVC #") + tostr(Error::LYXVC),
|
||||
Error::LYXVC);
|
||||
lyxerr.debug(string("Debugging LYXSERVER #") + tostr(Error::LYXSERVER),
|
||||
Error::LYXVC);
|
||||
lyxerr << _("Setting debug level to ") << dbgLevel << endl;
|
||||
lyxerr.level(Debug::type(dbgLevel));
|
||||
lyxerr[Debug::INFO] << "Debugging INFO #" << Debug::INFO << endl;
|
||||
lyxerr[Debug::INIT] << "Debugging INIT #" << Debug::INIT << endl;
|
||||
lyxerr[Debug::KEY] << "Debugging KEY #" << Debug::KEY << endl;
|
||||
lyxerr[Debug::TOOLBAR] << "Debugging TOOLBAR #" << Debug::TOOLBAR << endl;
|
||||
lyxerr[Debug::PARSER] << "Debugging LEX and PARSER #" << Debug::PARSER << endl;
|
||||
lyxerr[Debug::LYXRC] << "Debugging LYXRC #" << Debug::LYXRC << endl;
|
||||
lyxerr[Debug::KBMAP] << "Debugging KBMAP #" << Debug::KBMAP << endl;
|
||||
lyxerr[Debug::LATEX] << "Debugging LATEX #" << Debug::LATEX << endl;
|
||||
lyxerr[Debug::MATHED] << "Debugging MATHED #" << Debug::MATHED << endl;
|
||||
lyxerr[Debug::FONT] << "Debugging FONT #" << Debug::FONT << endl;
|
||||
lyxerr[Debug::TCLASS] << "Debugging TCLASS #" << Debug::TCLASS << endl;
|
||||
lyxerr[Debug::LYXVC] << "Debugging LYXVC #" << Debug::LYXVC << endl;
|
||||
lyxerr[Debug::LYXSERVER] << "Debugging LYXSERVER #" << Debug::LYXSERVER << endl;
|
||||
}
|
||||
|
||||
|
||||
// Give command line help
|
||||
void commandLineHelp()
|
||||
{
|
||||
lyxerr.print(_("LyX " LYX_VERSION " of " LYX_RELEASE ".\n"));
|
||||
lyxerr.print(_("Usage: lyx [ command line switches ] [ name.lyx ... ]\n"));
|
||||
lyxerr.print(_("Command line switches (case sensitive):"));
|
||||
lyxerr.print(_(" -help summarize LyX usage"));
|
||||
lyxerr.print(_(" -sysdir x try to set system directory to x"));
|
||||
lyxerr.print(_(" -width x set the width of the main window"));
|
||||
lyxerr.print(_(" -height y set the height of the main window"));
|
||||
lyxerr.print(_(" -xpos x set the x position of the main window"));
|
||||
lyxerr.print(_(" -ypos y set the y position of the main window"));
|
||||
lyxerr.print(_(" -dbg n where n is a sum of debugging options. Try -dbg 65535 -help"));
|
||||
lyxerr.print(_(" -Reverse swaps foreground & background colors"));
|
||||
lyxerr.print(_(" -Mono runs LyX in black and white mode"));
|
||||
lyxerr.print(_(" -FastSelection use a fast routine for drawing selections\n"));
|
||||
lyxerr.print(_("Check the LyX man page for more options."));
|
||||
lyxerr << "LyX " LYX_VERSION << " of " LYX_RELEASE << endl;
|
||||
lyxerr <<
|
||||
_("Usage: lyx [ command line switches ] [ name.lyx ... ]\n"
|
||||
"Command line switches (case sensitive):\n"
|
||||
"\t-help summarize LyX usage\n"
|
||||
"\t-sysdir x try to set system directory to x\n"
|
||||
"\t-width x set the width of the main window\n"
|
||||
"\t-height y set the height of the main window\n"
|
||||
"\t-xpos x set the x position of the main window\n"
|
||||
"\t-ypos y set the y position of the main window\n"
|
||||
"\t-dbg n where n is a sum of debugging options. Try -dbg 65535 -help\n"
|
||||
"\t-Reverse swaps foreground & background colors\n"
|
||||
"\t-Mono runs LyX in black and white mode\n"
|
||||
"\t-FastSelection use a fast routine for drawing selections\n\n"
|
||||
"Check the LyX man page for more options.") << endl;
|
||||
}
|
||||
|
||||
|
||||
@ -502,7 +499,8 @@ bool LyX::easyParse(int *argc, char *argv[])
|
||||
argv[j] = argv[j+2];
|
||||
i--; // After shift, check this number again.
|
||||
} else
|
||||
lyxerr.print(_("Missing number for -dbg switch!"));
|
||||
lyxerr << _("Missing number for -dbg switch!")
|
||||
<< endl;
|
||||
}
|
||||
// Check for "-sysdir"
|
||||
else if (arg == "-sysdir") {
|
||||
@ -516,7 +514,8 @@ bool LyX::easyParse(int *argc, char *argv[])
|
||||
argv[j] = argv[j+2];
|
||||
i--; // After shift, check this number again.
|
||||
} else
|
||||
lyxerr.print(_("Missing directory for -sysdir switch!"));
|
||||
lyxerr << _("Missing directory for -sysdir switch!")
|
||||
<< endl;
|
||||
// Check for --help or -help
|
||||
} else if (arg == "--help" || arg == "-help") {
|
||||
commandLineHelp();
|
||||
@ -535,21 +534,21 @@ void error_handler(int err_sig)
|
||||
{
|
||||
switch (err_sig) {
|
||||
case SIGHUP:
|
||||
fprintf(stderr, "\nlyx: SIGHUP signal caught\n");
|
||||
lyxerr << "\nlyx: SIGHUP signal caught" << endl;
|
||||
break;
|
||||
case SIGINT:
|
||||
// no comments
|
||||
break;
|
||||
case SIGFPE:
|
||||
fprintf(stderr, "\nlyx: SIGFPE signal caught\n");
|
||||
lyxerr << "\nlyx: SIGFPE signal caught" << endl;
|
||||
break;
|
||||
case SIGSEGV:
|
||||
fprintf(stderr, "\nlyx: SIGSEGV signal caught\n");
|
||||
fprintf(stderr,
|
||||
lyxerr << "\nlyx: SIGSEGV signal caught" << endl;
|
||||
lyxerr <<
|
||||
"Sorry, you have found a bug in LyX."
|
||||
" If possible, please read 'Known bugs'\n"
|
||||
"under the Help menu and then send us "
|
||||
"a full bug report. Thanks!\n");
|
||||
"a full bug report. Thanks!" << endl;
|
||||
break;
|
||||
case SIGTERM:
|
||||
// no comments
|
||||
@ -565,7 +564,7 @@ void error_handler(int err_sig)
|
||||
|
||||
bufferlist.emergencyWriteAll();
|
||||
|
||||
lyxerr.print("Bye.");
|
||||
lyxerr << "Bye." << endl;
|
||||
if(err_sig!=SIGHUP && (!GetEnv("LYXDEBUG").empty() || err_sig == SIGSEGV))
|
||||
abort();
|
||||
exit(0);
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
#include <cstdlib>
|
||||
#include FORMS_H_LOCATION
|
||||
#include "error.h"
|
||||
#include "debug.h"
|
||||
#include "lyx_sendfax.h"
|
||||
#include "lyx_main.h"
|
||||
#include "lyxrc.h"
|
||||
@ -121,7 +121,7 @@ bool button_send(string const &fname, string const &sendcmd)
|
||||
subst(cmd, "$$Name",name);
|
||||
subst(cmd, "$$Phone",phone);
|
||||
subst(cmd, "$$FName",fname);
|
||||
lyxerr.print("CMD: "+cmd);
|
||||
lyxerr << "CMD: " << cmd << endl;
|
||||
Systemcalls one(Systemcalls::System, cmd);
|
||||
show_logfile(logfile,false);
|
||||
remove(logfile.c_str());
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include <config.h>
|
||||
|
||||
#include "lyxdraw.h"
|
||||
#include "error.h"
|
||||
#include "debug.h"
|
||||
|
||||
extern int reverse_video;
|
||||
extern int mono_video;
|
||||
@ -66,7 +66,7 @@ bool setForegroundColor(char const * const color, XGCValues & val)
|
||||
{
|
||||
val.foreground = xcol.pixel;
|
||||
} else {
|
||||
lyxerr.print(string("LyX: Couldn't get color ") + color);
|
||||
lyxerr << "LyX: Couldn't get color " << color << endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -371,7 +371,8 @@ GC GetSelectionGC()
|
||||
if (!setForegroundColor(selection_color, val)) {
|
||||
fast_selection = True;
|
||||
if (clear_gc) clear_gc = 0;
|
||||
lyxerr.print(" Will use FastSelection-method.\n");
|
||||
lyxerr << " Will use FastSelection-method."
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
selection_gc = XCreateGC(fl_display, fl_root,
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include "gettext.h"
|
||||
#include "definitions.h"
|
||||
#include "lyxfont.h"
|
||||
#include "error.h"
|
||||
#include "debug.h"
|
||||
#include "lyxrc.h"
|
||||
#include "lyxlex.h"
|
||||
#include "lyxdraw.h"
|
||||
@ -124,16 +124,16 @@ LyXFont& LyXFont::decSize()
|
||||
case SIZE_SCRIPT: setSize(SIZE_TINY); break;
|
||||
case SIZE_TINY: break;
|
||||
case INCREASE_SIZE:
|
||||
lyxerr.print("Can't LyXFont::decSize on INCREASE_SIZE");
|
||||
lyxerr << "Can't LyXFont::decSize on INCREASE_SIZE" << endl;
|
||||
break;
|
||||
case DECREASE_SIZE:
|
||||
lyxerr.print("Can't LyXFont::decSize on DECREASE_SIZE");
|
||||
lyxerr <<"Can't LyXFont::decSize on DECREASE_SIZE" << endl;
|
||||
break;
|
||||
case INHERIT_SIZE:
|
||||
lyxerr.print("Can't LyXFont::decSize on INHERIT_SIZE");
|
||||
lyxerr <<"Can't LyXFont::decSize on INHERIT_SIZE" << endl;
|
||||
break;
|
||||
case IGNORE_SIZE:
|
||||
lyxerr.print("Can't LyXFont::decSize on IGNORE_SIZE");
|
||||
lyxerr <<"Can't LyXFont::decSize on IGNORE_SIZE" << endl;
|
||||
break;
|
||||
}
|
||||
return (*this);
|
||||
@ -155,16 +155,16 @@ LyXFont& LyXFont::incSize()
|
||||
case SIZE_SCRIPT: setSize(SIZE_FOOTNOTE); break;
|
||||
case SIZE_TINY: setSize(SIZE_SCRIPT); break;
|
||||
case INCREASE_SIZE:
|
||||
lyxerr.print("Can't LyXFont::incSize on INCREASE_SIZE");
|
||||
lyxerr <<"Can't LyXFont::incSize on INCREASE_SIZE" << endl;
|
||||
break;
|
||||
case DECREASE_SIZE:
|
||||
lyxerr.print("Can't LyXFont::incSize on DECREASE_SIZE");
|
||||
lyxerr <<"Can't LyXFont::incSize on DECREASE_SIZE" << endl;
|
||||
break;
|
||||
case INHERIT_SIZE:
|
||||
lyxerr.print("Can't LyXFont::incSize on INHERIT_SIZE");
|
||||
lyxerr <<"Can't LyXFont::incSize on INHERIT_SIZE" << endl;
|
||||
break;
|
||||
case IGNORE_SIZE:
|
||||
lyxerr.print("Can't LyXFont::incSize on IGNORE_SIZE");
|
||||
lyxerr <<"Can't LyXFont::incSize on IGNORE_SIZE" << endl;
|
||||
break;
|
||||
}
|
||||
return (*this);
|
||||
@ -181,8 +181,8 @@ LyXFont::FONT_MISC_STATE LyXFont::setMisc(FONT_MISC_STATE newfont,
|
||||
else if (org == OFF)
|
||||
return ON;
|
||||
else {
|
||||
lyxerr.print("LyXFont::setMisc: Need state"
|
||||
" ON or OFF to toggle. Setting to ON");
|
||||
lyxerr <<"LyXFont::setMisc: Need state"
|
||||
" ON or OFF to toggle. Setting to ON" << endl;
|
||||
return ON;
|
||||
}
|
||||
} else if (newfont == IGNORE)
|
||||
@ -380,7 +380,8 @@ LyXFont& LyXFont::setLyXFamily(string const & fam)
|
||||
if (s == LyXFamilyNames[i]) {
|
||||
setFamily(LyXFont::FONT_FAMILY(i));
|
||||
} else
|
||||
lyxerr.print("LyXFont::setLyXFamily: Unknown family `"+s+'\'');
|
||||
lyxerr << "LyXFont::setLyXFamily: Unknown family `"
|
||||
<< s << '\'' << endl;
|
||||
return (*this);
|
||||
}
|
||||
|
||||
@ -395,7 +396,8 @@ LyXFont& LyXFont::setLyXSeries(string const & ser)
|
||||
if (s == LyXSeriesNames[i]) {
|
||||
setSeries(LyXFont::FONT_SERIES(i));
|
||||
} else
|
||||
lyxerr.print("LyXFont::setLyXSeries: Unknown series `"+s+'\'');
|
||||
lyxerr << "LyXFont::setLyXSeries: Unknown series `"
|
||||
<< s << '\'' << endl;
|
||||
return (*this);
|
||||
}
|
||||
|
||||
@ -410,7 +412,8 @@ LyXFont& LyXFont::setLyXShape(string const & sha)
|
||||
if (s == LyXShapeNames[i]) {
|
||||
setShape(LyXFont::FONT_SHAPE(i));
|
||||
} else
|
||||
lyxerr.print("LyXFont::setLyXShape: Unknown shape `"+s+'\'');
|
||||
lyxerr << "LyXFont::setLyXShape: Unknown shape `"
|
||||
<< s << '\'' << endl;
|
||||
return (*this);
|
||||
}
|
||||
|
||||
@ -424,7 +427,8 @@ LyXFont& LyXFont::setLyXSize(string const & siz)
|
||||
if (s == LyXSizeNames[i]) {
|
||||
setSize(LyXFont::FONT_SIZE(i));
|
||||
} else
|
||||
lyxerr.print("LyXFont::setLyXSize: Unknown size `"+s+'\'');
|
||||
lyxerr << "LyXFont::setLyXSize: Unknown size `"
|
||||
<< s << '\'' << endl;
|
||||
return (*this);
|
||||
}
|
||||
|
||||
@ -436,7 +440,8 @@ LyXFont::FONT_MISC_STATE LyXFont::setLyXMisc(string const & siz)
|
||||
while (s != LyXMiscNames[i] && LyXMiscNames[i] != "error") i++;
|
||||
if (s == LyXMiscNames[i])
|
||||
return FONT_MISC_STATE(i);
|
||||
lyxerr.print("LyXFont::setLyXMisc: Unknown misc flag `"+s+'\'');
|
||||
lyxerr << "LyXFont::setLyXMisc: Unknown misc flag `"
|
||||
<< s << '\'' << endl;
|
||||
return OFF;
|
||||
}
|
||||
|
||||
@ -449,7 +454,8 @@ LyXFont& LyXFont::setLyXColor(string const & col)
|
||||
if (s == LyXColorNames[i]) {
|
||||
setColor(LyXFont::FONT_COLOR(i));
|
||||
} else
|
||||
lyxerr.print("LyXFont::setLyXColor: Unknown Color `"+s+'\'');
|
||||
lyxerr << "LyXFont::setLyXColor: Unknown Color `"
|
||||
<< s << '\'' << endl;
|
||||
return (*this);
|
||||
}
|
||||
|
||||
@ -465,7 +471,8 @@ LyXFont& LyXFont::setGUISize(string const & siz)
|
||||
if (s == _(lGUISizeNames[i].c_str())) {
|
||||
setSize(LyXFont::FONT_SIZE(i));
|
||||
} else
|
||||
lyxerr.print("LyXFont::setGUISize: Unknown Size `"+s+'\'');
|
||||
lyxerr << "LyXFont::setGUISize: Unknown Size `"
|
||||
<< s << '\'' << endl;
|
||||
return (*this);
|
||||
}
|
||||
|
||||
@ -576,12 +583,14 @@ void LyXFont::lyxWriteChanges(LyXFont const & orgfont, FILE * file) const
|
||||
switch (underbar()) {
|
||||
case OFF: fprintf(file, "\\bar no \n"); break;
|
||||
case ON: fprintf(file, "\\bar under \n"); break;
|
||||
case TOGGLE: lyxerr.print("LyXFont::lyxWriteFontChanges: "
|
||||
"TOGGLE should not appear here!");
|
||||
case TOGGLE: lyxerr << "LyXFont::lyxWriteFontChanges: "
|
||||
"TOGGLE should not appear here!"
|
||||
<< endl;
|
||||
break;
|
||||
case INHERIT: fprintf(file, "\\bar default \n"); break;
|
||||
case IGNORE: lyxerr.print("LyXFont::lyxWriteFontChanges: "
|
||||
"IGNORE should not appear here!");
|
||||
case IGNORE: lyxerr << "LyXFont::lyxWriteFontChanges: "
|
||||
"IGNORE should not appear here!"
|
||||
<< endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -593,12 +602,14 @@ void LyXFont::lyxWriteChanges(LyXFont const & orgfont, FILE * file) const
|
||||
switch (latex()) {
|
||||
case OFF: fprintf(file, "\\latex no_latex \n"); break;
|
||||
case ON: fprintf(file, "\\latex latex \n"); break;
|
||||
case TOGGLE: lyxerr.print("LyXFont::lyxWriteFontChanges: "
|
||||
"TOGGLE should not appear here!");
|
||||
case TOGGLE: lyxerr << "LyXFont::lyxWriteFontChanges: "
|
||||
"TOGGLE should not appear here!"
|
||||
<< endl;
|
||||
break;
|
||||
case INHERIT: fprintf(file, "\\latex default \n"); break;
|
||||
case IGNORE: lyxerr.print("LyXFont::lyxWriteFontChanges: "
|
||||
"IGNORE should not appear here!");
|
||||
case IGNORE: lyxerr << "LyXFont::lyxWriteFontChanges: "
|
||||
"IGNORE should not appear here!"
|
||||
<< endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -960,3 +971,8 @@ bool LyXFont::equalExceptLatex(LyXFont const &f) const
|
||||
f1.setLatex(f.latex());
|
||||
return f1 == f;
|
||||
}
|
||||
|
||||
ostream & operator<<(ostream & o, LyXFont::FONT_MISC_STATE fms)
|
||||
{
|
||||
return o << int(fms);
|
||||
}
|
||||
|
@ -471,6 +471,7 @@ private:
|
||||
XFontStruct* getXFontstruct() const;
|
||||
};
|
||||
|
||||
ostream & operator<<(ostream &, LyXFont::FONT_MISC_STATE);
|
||||
|
||||
inline LyXFont::LyXFont()
|
||||
{
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include "lyxfr1.h"
|
||||
#include "lyxfunc.h"
|
||||
#include "lyxscreen.h"
|
||||
#include "error.h"
|
||||
#include "debug.h"
|
||||
#include "lyxtext.h"
|
||||
#include "gettext.h"
|
||||
#include "LyXView.h" // only because of form_main
|
||||
|
18
src/lyxfr1.C
18
src/lyxfr1.C
@ -1,12 +1,12 @@
|
||||
/* This file is part of
|
||||
* ======================================================
|
||||
*
|
||||
* LyX, The Document Processor
|
||||
*
|
||||
* Copyright (C) 1995 Matthias Ettrich,
|
||||
* Copyright (C) 1995-1998 The LyX Team.
|
||||
*
|
||||
*======================================================*/
|
||||
* ======================================================
|
||||
*
|
||||
* LyX, The Document Processor
|
||||
*
|
||||
* Copyright 1995 Matthias Ettrich,
|
||||
* Copyright 1995-1999 The LyX Team.
|
||||
*
|
||||
* ======================================================*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
#include "lyxfr1.h"
|
||||
#include "lyxfunc.h"
|
||||
#include "lyxscreen.h"
|
||||
#include "error.h"
|
||||
#include "debug.h"
|
||||
#include "lyxtext.h"
|
||||
#include "gettext.h"
|
||||
#include "LyXView.h"
|
||||
|
@ -51,7 +51,7 @@
|
||||
#include "support/filetools.h"
|
||||
#include "support/FileInfo.h"
|
||||
#include "lyxscreen.h"
|
||||
#include "error.h"
|
||||
#include "debug.h"
|
||||
#include "lyxrc.h"
|
||||
#include "lyxtext.h"
|
||||
#include "gettext.h"
|
||||
@ -157,7 +157,7 @@ LyXFunc::~LyXFunc()
|
||||
}
|
||||
|
||||
|
||||
string LyXFunc::argAsString(char const *const argument)
|
||||
string LyXFunc::argAsString(char const * const argument)
|
||||
{
|
||||
string tmp(argument);
|
||||
|
||||
@ -165,7 +165,7 @@ string LyXFunc::argAsString(char const *const argument)
|
||||
// get the arg from somewhere else, a popup, or ask for
|
||||
// it in the minibuffer.
|
||||
}
|
||||
lyxerr.debug("argAsString: <" + tmp + '>');
|
||||
lyxerr.debug() << "argAsString: <" << tmp << '>' << endl;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
@ -206,20 +206,20 @@ int LyXFunc::processKeyEvent(XEvent *ev)
|
||||
|
||||
num_bytes = LyXLookupString(ev, s_r, 10, &keysym_return);
|
||||
|
||||
if (lyxerr.debugging(Error::KEY)) {
|
||||
lyxerr.print(string("KeySym is ")
|
||||
+ XKeysymToString(keysym_return)
|
||||
+ "["
|
||||
+ tostr(keysym_return) + "]"
|
||||
+ " and num_bytes is "
|
||||
+ tostr(num_bytes)
|
||||
+ " the string returned is \""
|
||||
+ string(s_r) + '\"');
|
||||
if (lyxerr.debugging(Debug::KEY)) {
|
||||
lyxerr << "KeySym is "
|
||||
<< XKeysymToString(keysym_return)
|
||||
<< "["
|
||||
<< keysym_return << "]"
|
||||
<< " and num_bytes is "
|
||||
<< num_bytes
|
||||
<< " the string returned is \""
|
||||
<< s_r << '\"' << endl;
|
||||
}
|
||||
// Do nothing if we have nothing (JMarc)
|
||||
if (num_bytes == 0 && keysym_return == NoSymbol) {
|
||||
lyxerr.debug("Empty kbd action (probably composing)",
|
||||
Error::KEY);
|
||||
lyxerr[Debug::KEY] << "Empty kbd action (probably composing)"
|
||||
<< endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -264,13 +264,13 @@ int LyXFunc::processKeyEvent(XEvent *ev)
|
||||
|
||||
if (action == 0) action = LFUN_PREFIX;
|
||||
|
||||
if (lyxerr.debugging(Error::KEY)) {
|
||||
if (lyxerr.debugging(Debug::KEY)) {
|
||||
char buf[100];
|
||||
keyseq.print(buf,100);
|
||||
lyxerr.print(string("Key [")
|
||||
+ tostr(action) + "]["
|
||||
+ buf + "]["
|
||||
+ tostr(num_bytes) +"]");
|
||||
lyxerr << "Key ["
|
||||
<< action << "]["
|
||||
<< buf << "]["
|
||||
<< num_bytes << "]" << endl;
|
||||
}
|
||||
|
||||
// already here we know if it any point in going further
|
||||
@ -301,7 +301,7 @@ int LyXFunc::processKeyEvent(XEvent *ev)
|
||||
argument[1] = 0;
|
||||
}
|
||||
if (!argument) {
|
||||
lyxerr.debug("Empty argument!");
|
||||
lyxerr.debug() << "Empty argument!" << endl;
|
||||
// This can`t possibly be of any use
|
||||
// so we`ll skip the dispatch.
|
||||
return 0;
|
||||
@ -453,7 +453,7 @@ string LyXFunc::Dispatch(int ac,
|
||||
owner->currentBuffer()->isReadonly() &&
|
||||
lyxaction.isFuncRO(action)) {
|
||||
setErrorMessage(N_("Document is read-only"));
|
||||
lyxerr.debug("Error: Document is read-only.");
|
||||
lyxerr.debug() << "Error: Document is read-only." << endl;
|
||||
goto exit_with_message;
|
||||
}
|
||||
|
||||
@ -1055,9 +1055,9 @@ string LyXFunc::Dispatch(int ac,
|
||||
|
||||
case LFUN_LAYOUTNO:
|
||||
{
|
||||
lyxerr.debug("LFUN_LAYOUTNO: (arg) " + string(argument));
|
||||
lyxerr.debug() << "LFUN_LAYOUTNO: (arg) " << argument << endl;
|
||||
int sel = atoi(argument);
|
||||
lyxerr.debug(string("LFUN_LAYOUTNO: (sel) ") + tostr(sel));
|
||||
lyxerr.debug() << "LFUN_LAYOUTNO: (sel) "<< sel << endl;
|
||||
|
||||
// Should this give a setMessage instead?
|
||||
if (sel == 0)
|
||||
@ -1076,8 +1076,8 @@ string LyXFunc::Dispatch(int ac,
|
||||
|
||||
case LFUN_LAYOUT:
|
||||
{
|
||||
lyxerr.debug("LFUN_LAYOUT: (arg) "
|
||||
+ string(argument));
|
||||
lyxerr.debug() << "LFUN_LAYOUT: (arg) "
|
||||
<< argument << endl;
|
||||
|
||||
// Derive layout number from given argument (string)
|
||||
// and current buffer's textclass (number). */
|
||||
@ -1892,9 +1892,9 @@ string LyXFunc::Dispatch(int ac,
|
||||
|
||||
case LFUN_GETNAME:
|
||||
setMessage(owner->currentBuffer()->getFileName());
|
||||
lyxerr.debug(string("FNAME[") +
|
||||
owner->currentBuffer()->getFileName() +
|
||||
"] ");
|
||||
lyxerr.debug() << "FNAME["
|
||||
<< owner->currentBuffer()->getFileName()
|
||||
<< "] " << endl;
|
||||
break;
|
||||
|
||||
case LFUN_NOTIFY:
|
||||
@ -1996,11 +1996,11 @@ string LyXFunc::Dispatch(int ac,
|
||||
case LFUN_PUSH_TOOLBAR:
|
||||
{
|
||||
int nth = atoi(argument);
|
||||
if (lyxerr.debugging(Error::TOOLBAR)) {
|
||||
lyxerr.print(string("LFUN_PUSH_TOOLBAR: argument = `")
|
||||
+ argument + "'");
|
||||
lyxerr.print(string("LFUN_PUSH_TOOLBAR: nth = `")
|
||||
+ tostr(nth) + "'");
|
||||
if (lyxerr.debugging(Debug::TOOLBAR)) {
|
||||
lyxerr << "LFUN_PUSH_TOOLBAR: argument = `"
|
||||
<< argument << "'\n"
|
||||
<< "LFUN_PUSH_TOOLBAR: nth = `"
|
||||
<< nth << "'" << endl;
|
||||
}
|
||||
|
||||
if (nth <= 0) {
|
||||
@ -2014,13 +2014,13 @@ string LyXFunc::Dispatch(int ac,
|
||||
|
||||
case LFUN_ADD_TO_TOOLBAR:
|
||||
{
|
||||
if (lyxerr.debugging(Error::TOOLBAR)) {
|
||||
lyxerr.print(string("LFUN_ADD_TO_TOOLBAR:"
|
||||
"argument = `")+ argument + '\'');
|
||||
if (lyxerr.debugging(Debug::TOOLBAR)) {
|
||||
lyxerr << "LFUN_ADD_TO_TOOLBAR:"
|
||||
"argument = `" << argument << '\'' << endl;
|
||||
}
|
||||
string tmp(argument);
|
||||
//lyxerr.print(string("Argument: ") + argument);
|
||||
//lyxerr.print(string("Tmp : ") + tmp);
|
||||
//lyxerr <<string("Argument: ") + argument);
|
||||
//lyxerr <<string("Tmp : ") + tmp);
|
||||
if (tmp.empty()) {
|
||||
LyXBell();
|
||||
setErrorMessage(N_("Usage: toolbar-add-to <LyX command>"));
|
||||
@ -2255,7 +2255,7 @@ string LyXFunc::Dispatch(int ac,
|
||||
|
||||
case LFUN_PARENTINSERT:
|
||||
{
|
||||
lyxerr.print(string("arg ") + argument);
|
||||
lyxerr << "arg " << argument << endl;
|
||||
Inset *new_inset = new InsetParent(argument, owner->currentBuffer());
|
||||
owner->currentBuffer()->insertInset(new_inset, "Standard", true);
|
||||
}
|
||||
@ -2402,7 +2402,7 @@ string LyXFunc::Dispatch(int ac,
|
||||
}
|
||||
break;
|
||||
default:
|
||||
lyxerr.print("A truly unknown func!");
|
||||
lyxerr << "A truly unknown func!" << endl;
|
||||
break;
|
||||
}
|
||||
} // end of switch
|
||||
@ -2456,7 +2456,7 @@ void LyXFunc::MenuNew(bool fromTemplate)
|
||||
|
||||
if (fname.empty()) {
|
||||
owner->getMiniBuffer()->Set(_("Canceled."));
|
||||
lyxerr.debug("New Document Cancelled.");
|
||||
lyxerr.debug() << "New Document Cancelled." << endl;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2519,7 +2519,7 @@ void LyXFunc::MenuNew(bool fromTemplate)
|
||||
}
|
||||
|
||||
// find a free buffer
|
||||
lyxerr.debug("Find a free buffer.");
|
||||
lyxerr.debug() << "Find a free buffer." << endl;
|
||||
owner->currentView()->setBuffer(bufferlist.newFile(s,templname));
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
// -*- C++ -*-
|
||||
#ifndef LYXFUNC_H_
|
||||
#define LYXFUNC_H_
|
||||
#ifndef LYXFUNC_H
|
||||
#define LYXFUNC_H
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
@ -14,7 +14,6 @@
|
||||
#include "LString.h"
|
||||
class LyXView;
|
||||
|
||||
|
||||
/** This class encapsulates all the LyX command operations.
|
||||
This is the class of the LyX's "high level event handler".
|
||||
Every user command is processed here, either invocated from
|
||||
|
57
src/lyxlex.C
57
src/lyxlex.C
@ -13,7 +13,7 @@
|
||||
#endif
|
||||
|
||||
#include "lyxlex.h"
|
||||
#include "error.h"
|
||||
#include "debug.h"
|
||||
#include "support/filetools.h"
|
||||
|
||||
LyXLex::LyXLex(keyword_item * tab, int num)
|
||||
@ -41,7 +41,7 @@ void LyXLex::pushTable(keyword_item * tab, int num)
|
||||
void LyXLex::popTable()
|
||||
{
|
||||
if (pushed == 0)
|
||||
lyxerr.print("LyXLex error: nothing to pop!");
|
||||
lyxerr << "LyXLex error: nothing to pop!" << endl;
|
||||
|
||||
pushed_table * tmp;
|
||||
tmp = pushed;
|
||||
@ -55,27 +55,27 @@ void LyXLex::popTable()
|
||||
|
||||
void LyXLex::printTable()
|
||||
{
|
||||
lyxerr.print(string("\nNumber of tags: ") + tostr(no_items));
|
||||
lyxerr << "\nNumber of tags: " << no_items << endl;
|
||||
for(int i=0; i<no_items; i++)
|
||||
lyxerr.print(string("table[")+ tostr(i) +
|
||||
"]: tag: `" + table[i].tag +
|
||||
"' code:" + tostr(table[i].code));
|
||||
lyxerr.print(string());
|
||||
lyxerr << "table[" << i
|
||||
<< "]: tag: `" << table[i].tag
|
||||
<< "' code:" << table[i].code << endl;
|
||||
lyxerr << endl;
|
||||
}
|
||||
|
||||
|
||||
void LyXLex::printError(string const & message)
|
||||
{
|
||||
string tmpmsg = subst(message, "$$Token", GetString());
|
||||
lyxerr.print("LyX: " + tmpmsg + " [around line " + tostr(lineno) + " of file "
|
||||
+ MakeDisplayPath(name) + ']');
|
||||
lyxerr << "LyX: " << tmpmsg << " [around line " << lineno
|
||||
<< " of file " << MakeDisplayPath(name) << ']' << endl;
|
||||
}
|
||||
|
||||
|
||||
bool LyXLex::setFile(string const & filename)
|
||||
{
|
||||
if (file)
|
||||
lyxerr.print("Error in LyXLex::setFile: file already set.");
|
||||
lyxerr << "Error in LyXLex::setFile: file already set." <<endl;
|
||||
file = fopen(filename.c_str(), "r");
|
||||
name = filename;
|
||||
owns_file = true;
|
||||
@ -87,7 +87,7 @@ bool LyXLex::setFile(string const & filename)
|
||||
void LyXLex::setFile(FILE * f)
|
||||
{
|
||||
if (file)
|
||||
lyxerr.print("Error in LyXLex::setFile: file already set.");
|
||||
lyxerr << "Error in LyXLex::setFile: file already set." << endl;
|
||||
file = f;
|
||||
owns_file = false;
|
||||
lineno = 0; // this is bogus if the file already has been read from
|
||||
@ -147,7 +147,8 @@ string LyXLex::getLongString(string const & endtoken)
|
||||
|
||||
string const token = frontStrip(strip(GetString()), " \t");
|
||||
|
||||
lyxerr.debug("LongString: `"+GetString()+'\'', Error::LEX_PARSER);
|
||||
lyxerr[Debug::PARSER] << "LongString: `"
|
||||
<< GetString() << '\'' << endl;
|
||||
|
||||
// We do a case independent comparison, like search_kw
|
||||
// does.
|
||||
@ -161,8 +162,8 @@ string LyXLex::getLongString(string const & endtoken)
|
||||
prefix += ' ';
|
||||
}
|
||||
firstline = false;
|
||||
lyxerr.debug("Prefix = `"+prefix+'\'',
|
||||
Error::LEX_PARSER);
|
||||
lyxerr[Debug::PARSER] << "Prefix = `" << prefix
|
||||
<< '\'' << endl;
|
||||
}
|
||||
|
||||
if (!prefix.empty()
|
||||
@ -226,15 +227,11 @@ int LyXLex::search_kw(char const * const tag) const
|
||||
while (l < r) {
|
||||
m = (l+r)/2;
|
||||
|
||||
if (lyxerr.debugging(Error::LEX_PARSER)) {
|
||||
string my_l;
|
||||
my_l+="LyXLex::search_kw: elem " ;
|
||||
my_l+= m;
|
||||
my_l+=" tag ";
|
||||
my_l+=table[m].tag;
|
||||
my_l+=" search tag ";
|
||||
my_l+= tag;
|
||||
lyxerr.print(my_l);
|
||||
if (lyxerr.debugging(Debug::PARSER)) {
|
||||
lyxerr << "LyXLex::search_kw: elem " << m
|
||||
<< " tag " << table[m].tag
|
||||
<< " search tag " << tag
|
||||
<< endl;
|
||||
}
|
||||
|
||||
if (table[m].tag)
|
||||
@ -253,7 +250,7 @@ bool LyXLex::next(bool esc)
|
||||
|
||||
if (!esc) {
|
||||
int c; // getc() returns an int
|
||||
int i;
|
||||
//int i;
|
||||
|
||||
|
||||
status = 0;
|
||||
@ -267,7 +264,7 @@ bool LyXLex::next(bool esc)
|
||||
}
|
||||
|
||||
if (c=='\"') {
|
||||
i = -1;
|
||||
int i = -1;
|
||||
do {
|
||||
c = getc(file);
|
||||
if (c != '\r')
|
||||
@ -296,7 +293,7 @@ bool LyXLex::next(bool esc)
|
||||
continue; /* Skip ','s */
|
||||
|
||||
if (c > ' ' && !feof(file)) {
|
||||
i = 0;
|
||||
int i = 0;
|
||||
do {
|
||||
buff[i++] = c;
|
||||
c = getc(file);
|
||||
@ -328,7 +325,7 @@ bool LyXLex::next(bool esc)
|
||||
return false;
|
||||
} else {
|
||||
int c; // getc() returns an int
|
||||
int i;
|
||||
//int i;
|
||||
|
||||
|
||||
status = 0;
|
||||
@ -340,7 +337,7 @@ bool LyXLex::next(bool esc)
|
||||
|
||||
if (c=='\\') {
|
||||
// escape
|
||||
i = 0;
|
||||
int i = 0;
|
||||
do {
|
||||
if (c == '\\') {
|
||||
// escape the next char
|
||||
@ -367,7 +364,7 @@ bool LyXLex::next(bool esc)
|
||||
|
||||
// string
|
||||
if (c=='\"') {
|
||||
i = -1;
|
||||
int i = -1;
|
||||
bool escaped = false;
|
||||
do {
|
||||
escaped = false;
|
||||
@ -402,7 +399,7 @@ bool LyXLex::next(bool esc)
|
||||
}
|
||||
|
||||
if (c > ' ' && !feof(file)) {
|
||||
i = 0;
|
||||
int i = 0;
|
||||
do {
|
||||
if (c == '\\') {
|
||||
// escape the next char
|
||||
|
@ -112,7 +112,7 @@ public:
|
||||
void printError(string const & message);
|
||||
|
||||
/**
|
||||
Prints the current token table on stderr.
|
||||
Prints the current token table on cerr.
|
||||
*/
|
||||
void printTable();
|
||||
protected:
|
||||
|
@ -1,12 +1,12 @@
|
||||
/* This file is part of
|
||||
* ======================================================
|
||||
*
|
||||
* LyX, The Document Processor
|
||||
*
|
||||
* Copyright (C) 1995 Matthias Ettrich
|
||||
* Copyright (C) 1995-1998 The LyX team.
|
||||
*
|
||||
*======================================================*/
|
||||
* ======================================================
|
||||
*
|
||||
* LyX, The Document Processor
|
||||
*
|
||||
* Copyright 1995 Matthias Ettrich
|
||||
* Copyright 1995-1999 The LyX team.
|
||||
*
|
||||
* ======================================================*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
#include <locale.h>
|
||||
#endif
|
||||
|
||||
#include "error.h"
|
||||
#include "debug.h"
|
||||
|
||||
static XIM xim;
|
||||
static XIC xic;
|
||||
@ -147,12 +147,12 @@ int LyXLookupString(XEvent *event,
|
||||
return 0;
|
||||
}
|
||||
if (XFilterEvent (event, None)) {
|
||||
//lyxerr.print("XFilterEvent");
|
||||
//lyxerr <<"XFilterEvent");
|
||||
*keysym_return = NoSymbol;
|
||||
return 0;
|
||||
}
|
||||
if (event->type != KeyPress)
|
||||
lyxerr.print("LyXLookupString: wrong event type"
|
||||
lyxerr <<"LyXLookupString: wrong event type"
|
||||
+string(event->type));
|
||||
Status status_return;
|
||||
|
||||
@ -161,18 +161,18 @@ int LyXLookupString(XEvent *event,
|
||||
&status_return);
|
||||
switch(status_return) {
|
||||
case XLookupBoth:
|
||||
//lyxerr.print("XLookupBoth");
|
||||
//lyxerr <<"XLookupBoth");
|
||||
break;
|
||||
case XLookupChars:
|
||||
//lyxerr.print("XLookupChars");
|
||||
//lyxerr <<"XLookupChars");
|
||||
*keysym_return = NoSymbol;
|
||||
break;
|
||||
case XLookupKeySym:
|
||||
//lyxerr.print("XLookupKeySym");
|
||||
//lyxerr <<"XLookupKeySym");
|
||||
result = 0;
|
||||
break;
|
||||
default:
|
||||
//lyxerr.print("default");
|
||||
//lyxerr <<"default");
|
||||
*keysym_return = NoSymbol;
|
||||
result = 0;
|
||||
break;
|
||||
|
22
src/lyxrc.C
22
src/lyxrc.C
@ -14,7 +14,7 @@
|
||||
#pragma implementation "lyxrc.h"
|
||||
#endif
|
||||
|
||||
#include "error.h"
|
||||
#include "debug.h"
|
||||
|
||||
#include "lyxrc.h"
|
||||
#include "LyXAction.h"
|
||||
@ -304,10 +304,10 @@ int LyXRC::ReadBindFile(string name)
|
||||
{
|
||||
hasBindFile = true;
|
||||
string tmp = i18nLibFileSearch("bind",name,"bind");
|
||||
lyxerr.debug("Reading bindfile:" + tmp, Error::LYXRC);
|
||||
lyxerr[Debug::LYXRC] << "Reading bindfile:" << tmp << endl;
|
||||
int result = Read(tmp);
|
||||
if (result) {
|
||||
lyxerr.print("Error reading bind file: " + tmp);
|
||||
lyxerr << "Error reading bind file: " << tmp << endl;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ -318,13 +318,13 @@ int LyXRC::Read(string const &filename)
|
||||
string bindFile = "cua";
|
||||
|
||||
LyXLex lexrc(lyxrcTags, lyxrcCount);
|
||||
if (lyxerr.debugging(Error::LEX_PARSER))
|
||||
if (lyxerr.debugging(Debug::PARSER))
|
||||
lexrc.printTable();
|
||||
|
||||
lexrc.setFile(filename);
|
||||
if (!lexrc.IsOK()) return -2;
|
||||
|
||||
lyxerr.debug("Reading '" + filename + "'...", Error::INIT);
|
||||
lyxerr[Debug::INIT] << "Reading '" << filename << "'..." << endl;
|
||||
|
||||
while (lexrc.IsOK()) {
|
||||
|
||||
@ -718,11 +718,11 @@ int LyXRC::Read(string const &filename)
|
||||
}
|
||||
|
||||
if ((action = lyxaction.LookupFunc(cmd.c_str()))>=0) {
|
||||
if (lyxerr.debugging(Error::KEY)) {
|
||||
lyxerr.print("RC_BIND: Sequence `"
|
||||
+ seq + "' Command `"
|
||||
+ cmd + "' Action `"
|
||||
+ tostr(action) + '\'');
|
||||
if (lyxerr.debugging(Debug::KEY)) {
|
||||
lyxerr << "RC_BIND: Sequence `"
|
||||
<< seq << "' Command `"
|
||||
<< cmd << "' Action `"
|
||||
<< action << '\'' << endl;
|
||||
}
|
||||
res = bindKey(seq.c_str(), action);
|
||||
if (res != 0) {
|
||||
@ -833,7 +833,7 @@ int LyXRC::Read(string const &filename)
|
||||
|
||||
void LyXRC::Print()
|
||||
{
|
||||
lyxerr.print("The current internal LyXRC:");
|
||||
lyxerr << "The current internal LyXRC:" << endl;
|
||||
}
|
||||
|
||||
|
||||
|
@ -4,10 +4,10 @@
|
||||
*
|
||||
* LyX, The Document Processor
|
||||
*
|
||||
* Copyright (C) 1995 1996 Matthias Ettrich
|
||||
* and the LyX Team.
|
||||
* Copyright 1995 Matthias Ettrich
|
||||
* Copyright 1995-1999 The LyX Team.
|
||||
*
|
||||
*======================================================*/
|
||||
* ======================================================*/
|
||||
|
||||
#ifndef LYXRC_H
|
||||
#define LYXRC_H
|
||||
|
@ -4,10 +4,10 @@
|
||||
*
|
||||
* LyX, The Document Processor
|
||||
*
|
||||
* Copyright (C) 1995 Matthias Ettrich
|
||||
* Copyright (C) 1995-1998 The LyX Team
|
||||
* Copyright 1995 Matthias Ettrich
|
||||
* Copyright 1995-1999 The LyX Team
|
||||
*
|
||||
*======================================================*/
|
||||
* ======================================================*/
|
||||
|
||||
#ifndef LYXSCREEN_H
|
||||
#define LYXSCREEN_H
|
||||
|
162
src/lyxserver.C
162
src/lyxserver.C
@ -5,7 +5,7 @@
|
||||
* LyX, The Document Processor
|
||||
*
|
||||
* Copyright 1995 Matthias Ettrich
|
||||
* Copyright 1995-1998 The LyX Team.
|
||||
* Copyright 1995-1999 The LyX Team.
|
||||
*
|
||||
* ======================================================*/
|
||||
|
||||
@ -53,7 +53,7 @@
|
||||
#include "lyxserver.h"
|
||||
#include "lyxfunc.h"
|
||||
#include "lyx_main.h"
|
||||
#include "error.h"
|
||||
#include "debug.h"
|
||||
#include "support/lstrings.h"
|
||||
|
||||
#ifdef __EMX__
|
||||
@ -83,11 +83,11 @@ extern LyXAction lyxaction;
|
||||
|
||||
// Open pipes
|
||||
void LyXComm::openConnection() {
|
||||
lyxerr.debug("LyXComm: Opening connection", Error::LYXSERVER);
|
||||
lyxerr[Debug::LYXSERVER] << "LyXComm: Opening connection" << endl;
|
||||
|
||||
// If we are up, that's an error
|
||||
if (ready) {
|
||||
lyxerr.print("LyXComm: Already connected");
|
||||
lyxerr << "LyXComm: Already connected" << endl;
|
||||
return;
|
||||
}
|
||||
// We assume that we don't make it
|
||||
@ -111,32 +111,32 @@ void LyXComm::openConnection() {
|
||||
#else
|
||||
if (access(tmp.c_str(), F_OK) == 0) {
|
||||
#endif
|
||||
lyxerr.print("LyXComm: Pipe " + tmp + " already exists.");
|
||||
lyxerr.print("If no other LyX program is active, please delete"
|
||||
" the pipe by hand and try again.");
|
||||
lyxerr << "LyXComm: Pipe " << tmp << " already exists.\n"
|
||||
<< "If no other LyX program is active, please delete"
|
||||
" the pipe by hand and try again." << endl;
|
||||
pipename = string();
|
||||
return;
|
||||
}
|
||||
#ifndef __EMX__
|
||||
if (mkfifo(tmp.c_str(), 0600) < 0) {
|
||||
lyxerr.print("LyXComm: Could not create pipe " + tmp);
|
||||
lyxerr.print(strerror(errno));
|
||||
lyxerr << "LyXComm: Could not create pipe " << tmp << '\n'
|
||||
<< strerror(errno) << endl;
|
||||
return;
|
||||
};
|
||||
infd = open(tmp.c_str(), O_RDONLY|O_NONBLOCK);
|
||||
#else
|
||||
if (rc != NO_ERROR) {
|
||||
errnum = TranslateOS2Error(rc);
|
||||
lyxerr.print("LyXComm: Could not create pipe " + tmp);
|
||||
lyxerr.print(strerror(errnum));
|
||||
lyxerr <<"LyXComm: Could not create pipe " << tmp
|
||||
<< strerror(errnum) << endl;
|
||||
return;
|
||||
};
|
||||
// Listen to it.
|
||||
rc = DosConnectNPipe(fd);
|
||||
if (rc != NO_ERROR && rc != ERROR_PIPE_NOT_CONNECTED) {
|
||||
errnum = TranslateOS2Error(rc);
|
||||
lyxerr.print("LyXComm: Could not create pipe " + tmp);
|
||||
lyxerr.print(strerror(errnum));
|
||||
lyxerr <<"LyXComm: Could not create pipe " + tmp);
|
||||
lyxerr <<strerror(errnum);
|
||||
return;
|
||||
};
|
||||
// Imported handles can be used both with OS/2 APIs and emx
|
||||
@ -144,8 +144,8 @@ void LyXComm::openConnection() {
|
||||
infd = _imphandle(fd);
|
||||
#endif
|
||||
if (infd < 0) {
|
||||
lyxerr.print("LyXComm: Could not open pipe " + tmp);
|
||||
lyxerr.print(strerror(errno));
|
||||
lyxerr << "LyXComm: Could not open pipe " << tmp << '\n'
|
||||
<< strerror(errno) << endl;
|
||||
return;
|
||||
}
|
||||
fl_add_io_callback(infd, FL_READ, callback, (void*)this);
|
||||
@ -162,56 +162,58 @@ void LyXComm::openConnection() {
|
||||
|
||||
if (rc == ERROR_PIPE_BUSY) {
|
||||
#endif
|
||||
lyxerr.print("LyXComm: Pipe " + tmp + " already exists.");
|
||||
lyxerr.print("If no other LyX program is active, please delete"
|
||||
" the pipe by hand and try again.");
|
||||
lyxerr << "LyXComm: Pipe " << tmp << " already exists.\n"
|
||||
<< "If no other LyX program is active, please delete"
|
||||
" the pipe by hand and try again." << endl;
|
||||
pipename = string();
|
||||
return;
|
||||
}
|
||||
#ifndef __EMX__
|
||||
if (mkfifo(tmp.c_str(), 0600) < 0) {
|
||||
lyxerr.print("LyXComm: Could not create pipe " + tmp);
|
||||
lyxerr.print(strerror(errno));
|
||||
lyxerr << "LyXComm: Could not create pipe " << tmp << '\n'
|
||||
<< strerror(errno) << endl;
|
||||
return;
|
||||
};
|
||||
if (access(tmp.c_str(), F_OK) != 0) {
|
||||
lyxerr.print("LyXComm: Pipe " + tmp + " does not exist");
|
||||
lyxerr << "LyXComm: Pipe " << tmp
|
||||
<< " does not exist" << endl;
|
||||
return;
|
||||
}
|
||||
outfd = open(tmp.c_str(), O_RDWR);
|
||||
#else
|
||||
if (rc != NO_ERROR) {
|
||||
errnum = TranslateOS2Error(rc);
|
||||
lyxerr.print("LyXComm: Could not create pipe " + tmp);
|
||||
lyxerr.print(strerror(errnum));
|
||||
lyxerr << "LyXComm: Could not create pipe " << tmp << '\n'
|
||||
<< strerror(errnum) << endl;
|
||||
return;
|
||||
}
|
||||
rc = DosConnectNPipe(fd);
|
||||
if (rc == ERROR_BAD_PIPE) {
|
||||
lyxerr.print("LyXComm: Pipe " + tmp + " does not exist");
|
||||
lyxerr << "LyXComm: Pipe " << tmp
|
||||
<< " does not exist" << endl;
|
||||
return;
|
||||
}
|
||||
if (rc != NO_ERROR && rc != ERROR_PIPE_NOT_CONNECTED) {
|
||||
errnum = TranslateOS2Error(rc);
|
||||
lyxerr.print("LyXComm: Could not create pipe " + tmp);
|
||||
lyxerr.print(strerror(errnum));
|
||||
lyxerr << "LyXComm: Could not create pipe " << tmp << '\n'
|
||||
<< strerror(errnum) << endl;
|
||||
return;
|
||||
}
|
||||
outfd = _imphandle(fd);
|
||||
#endif
|
||||
if (outfd < 0) {
|
||||
lyxerr.print("LyXComm: Could not open pipe " + tmp);
|
||||
lyxerr.print(strerror(errno));
|
||||
lyxerr << "LyXComm: Could not open pipe " << tmp << '\n'
|
||||
<< strerror(errno) << endl;
|
||||
return;
|
||||
}
|
||||
if (fcntl(outfd, F_SETFL, O_NONBLOCK) < 0) {
|
||||
lyxerr.print("LyXComm: Could not set flags on pipe " + tmp);
|
||||
lyxerr.print(strerror(errno));
|
||||
lyxerr << "LyXComm: Could not set flags on pipe " << tmp
|
||||
<< '\n' << strerror(errno) << endl;
|
||||
return;
|
||||
};
|
||||
// We made it!
|
||||
ready = true;
|
||||
lyxerr.debug("LyXComm: Connection established", Error::LYXSERVER);
|
||||
lyxerr[Debug::LYXSERVER] << "LyXComm: Connection established" << endl;
|
||||
}
|
||||
|
||||
/// Close pipes
|
||||
@ -220,14 +222,14 @@ void LyXComm::closeConnection() {
|
||||
APIRET rc;
|
||||
int errnum;
|
||||
#endif
|
||||
lyxerr.debug("LyXComm: Closing connection", Error::LYXSERVER);
|
||||
lyxerr[Debug::LYXSERVER] << "LyXComm: Closing connection" << endl;
|
||||
|
||||
if (pipename.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ready) {
|
||||
lyxerr.print("LyXComm: Already disconnected");
|
||||
lyxerr << "LyXComm: Already disconnected" << endl;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -239,19 +241,19 @@ void LyXComm::closeConnection() {
|
||||
rc = DosDisConnectNPipe(infd);
|
||||
if (rc != NO_ERROR) {
|
||||
errnum = TranslateOS2Error(rc);
|
||||
lyxerr.print("LyXComm: Could not disconnect pipe " + tmp);
|
||||
lyxerr.print(strerror(errnum));
|
||||
lyxerr << "LyXComm: Could not disconnect pipe " << tmp
|
||||
<< '\n' << strerror(errnum) << endl;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
if (close(infd) < 0) {
|
||||
lyxerr.print("LyXComm: Could not close pipe " + tmp);
|
||||
lyxerr.print(strerror(errno));
|
||||
lyxerr << "LyXComm: Could not close pipe " << tmp
|
||||
<< '\n' << strerror(errno) << endl;
|
||||
}
|
||||
#ifndef __EMX__ // OS/2 named pipes will be automatically removed.
|
||||
if (unlink(tmp.c_str()) < 0){
|
||||
lyxerr.print("LyXComm: Could not remove pipe " + tmp);
|
||||
lyxerr.print(strerror(errno));
|
||||
lyxerr << "LyXComm: Could not remove pipe " << tmp
|
||||
<< '\n' << strerror(errno) << endl;
|
||||
};
|
||||
#endif
|
||||
}
|
||||
@ -261,19 +263,19 @@ void LyXComm::closeConnection() {
|
||||
rc = DosDisConnectNPipe(outfd);
|
||||
if (rc != NO_ERROR) {
|
||||
errnum = TranslateOS2Error(rc);
|
||||
lyxerr.print("LyXComm: Could not disconnect pipe " + tmp);
|
||||
lyxerr.print(strerror(errnum));
|
||||
lyxerr << "LyXComm: Could not disconnect pipe " << tmp
|
||||
<< '\n' << strerror(errnum) << endl;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
if (close(outfd) < 0) {
|
||||
lyxerr.print("LyXComm: Could not close pipe " + tmp);
|
||||
lyxerr.print(strerror(errno));
|
||||
lyxerr << "LyXComm: Could not close pipe " << tmp
|
||||
<< '\n' << strerror(errno) << endl;
|
||||
}
|
||||
#ifndef __EMX__
|
||||
if (unlink(tmp.c_str()) < 0){
|
||||
lyxerr.print("LyXComm: Could not remove pipe " + tmp);
|
||||
lyxerr.print(strerror(errno));
|
||||
lyxerr << "LyXComm: Could not remove pipe " << tmp
|
||||
<< '\n' << strerror(errno) << endl;
|
||||
};
|
||||
#endif
|
||||
}
|
||||
@ -285,8 +287,8 @@ void LyXComm::callback(int fd, void *v)
|
||||
{
|
||||
LyXComm * c = (LyXComm *) v;
|
||||
|
||||
if (lyxerr.debugging(Error::LYXSERVER)) {
|
||||
lyxerr.print(string("LyXComm: Receiving from fd ") + tostr(fd));
|
||||
if (lyxerr.debugging(Debug::LYXSERVER)) {
|
||||
lyxerr << "LyXComm: Receiving from fd " << fd << endl;
|
||||
}
|
||||
|
||||
const int CMDBUFLEN = 100;
|
||||
@ -312,10 +314,10 @@ void LyXComm::callback(int fd, void *v)
|
||||
// split() grabs the entire string if
|
||||
// the delim /wasn't/ found. ?:-P
|
||||
lsbuf=split(lsbuf, cmd,'\n');
|
||||
lyxerr.debug(string("LyXComm: status:")
|
||||
+ tostr(status) + ", lsbuf:" + lsbuf
|
||||
+ ", cmd:" + cmd,
|
||||
Error::LYXSERVER);
|
||||
lyxerr[Debug::LYXSERVER]
|
||||
<< "LyXComm: status:" << status
|
||||
<< ", lsbuf:" << lsbuf
|
||||
<< ", cmd:" << cmd << endl;
|
||||
if(!cmd.empty())
|
||||
c->clientcb(c->client, cmd);
|
||||
//\n or not \n?
|
||||
@ -330,11 +332,11 @@ void LyXComm::callback(int fd, void *v)
|
||||
}
|
||||
if(errno != 0 )
|
||||
{
|
||||
lyxerr.print(string("LyXComm: ") + strerror(errno));
|
||||
lyxerr << "LyXComm: " << strerror(errno) << endl;
|
||||
if(!lsbuf.empty())
|
||||
{
|
||||
lyxerr.print("LyxComm: truncated command: "
|
||||
+ lsbuf);
|
||||
lyxerr << "LyxComm: truncated command: "
|
||||
<< lsbuf << endl;
|
||||
lsbuf.erase();
|
||||
}
|
||||
break; // reset connection
|
||||
@ -347,22 +349,24 @@ void LyXComm::callback(int fd, void *v)
|
||||
|
||||
void LyXComm::send(string const & msg) {
|
||||
if (msg.empty()) {
|
||||
lyxerr.print("LyXComm: Request to send empty string. Ignoring.");
|
||||
lyxerr << "LyXComm: Request to send empty string. Ignoring."
|
||||
<< endl;
|
||||
return;
|
||||
}
|
||||
|
||||
if (lyxerr.debugging(Error::LYXSERVER)) {
|
||||
lyxerr.print("LyXComm: Sending '" + msg + '\'');
|
||||
if (lyxerr.debugging(Debug::LYXSERVER)) {
|
||||
lyxerr << "LyXComm: Sending '" << msg << '\'' << endl;
|
||||
}
|
||||
|
||||
if (pipename.empty()) return;
|
||||
|
||||
if (!ready) {
|
||||
lyxerr.print("LyXComm: Pipes are closed. Could not send "+ msg);
|
||||
lyxerr << "LyXComm: Pipes are closed. Could not send "
|
||||
<< msg << endl;
|
||||
} else if (write(outfd, msg.c_str(), msg.length()) < 0) {
|
||||
lyxerr.print("LyXComm: Error sending message: " + msg);
|
||||
lyxerr.print(strerror(errno));
|
||||
lyxerr.print("LyXComm: Resetting connection");
|
||||
lyxerr << "LyXComm: Error sending message: " << msg
|
||||
<< '\n' << strerror(errno)
|
||||
<< "\nLyXComm: Resetting connection" << endl;
|
||||
closeConnection();
|
||||
openConnection();
|
||||
}
|
||||
@ -372,8 +376,8 @@ void LyXComm::send(string const & msg) {
|
||||
rc = DosResetBuffer(outfd); // To avoid synchronization problems.
|
||||
if (rc != NO_ERROR) {
|
||||
errnum = TranslateOS2Error(rc);
|
||||
lyxerr.print("LyXComm: Message could not be flushed: " +msg);
|
||||
lyxerr.print(strerror(errnum));
|
||||
lyxerr <<"LyXComm: Message could not be flushed: " +msg);
|
||||
lyxerr <<strerror(errnum));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@ -402,7 +406,8 @@ LyXServer::~LyXServer()
|
||||
|
||||
void LyXServer::callback(LyXServer * serv, string const & msg)
|
||||
{
|
||||
lyxerr.debug("LyXServer: Received: '" + msg + '\'', Error::LYXSERVER);
|
||||
lyxerr[Debug::LYXSERVER] << "LyXServer: Received: '"
|
||||
<< msg << '\'' << endl;
|
||||
|
||||
char const *p = msg.c_str();
|
||||
|
||||
@ -416,7 +421,7 @@ void LyXServer::callback(LyXServer * serv, string const & msg)
|
||||
if (strncmp(p, "LYXSRV:", 7)==0) {
|
||||
server_only = true;
|
||||
} else if(0!=strncmp(p, "LYXCMD:", 7)) {
|
||||
lyxerr.print("LyXServer: Unknown request");
|
||||
lyxerr << "LyXServer: Unknown request" << endl;
|
||||
return;
|
||||
}
|
||||
p += 7;
|
||||
@ -441,7 +446,10 @@ void LyXServer::callback(LyXServer * serv, string const & msg)
|
||||
if(*p) p++;
|
||||
}
|
||||
|
||||
lyxerr.debug("LyXServer: Client: '" + client + "' Command: '" + cmd + "' Argument: '" + arg + '\'', Error::LYXSERVER);
|
||||
lyxerr[Debug::LYXSERVER]
|
||||
<< "LyXServer: Client: '" << client
|
||||
<< "' Command: '" << cmd
|
||||
<< "' Argument: '" << arg << '\'' << endl;
|
||||
|
||||
// --- lookup and exec the command ------------------
|
||||
|
||||
@ -452,7 +460,9 @@ void LyXServer::callback(LyXServer * serv, string const & msg)
|
||||
if (cmd == "hello") {
|
||||
// One more client
|
||||
if(serv->numclients==MAX_CLIENTS){ //paranoid check
|
||||
lyxerr.debug("LyXServer: too many clients...", Error::LYXSERVER);
|
||||
lyxerr[Debug::LYXSERVER]
|
||||
<< "LyXServer: too many clients..."
|
||||
<< endl;
|
||||
return;
|
||||
}
|
||||
int i=0; //find place in clients[]
|
||||
@ -462,7 +472,9 @@ void LyXServer::callback(LyXServer * serv, string const & msg)
|
||||
serv->clients[i] = client;
|
||||
serv->numclients++;
|
||||
buf = "LYXSRV:" + client + ":hello\n";
|
||||
lyxerr.debug("LyXServer: Greeting " + client, Error::LYXSERVER);
|
||||
lyxerr[Debug::LYXSERVER]
|
||||
<< "LyXServer: Greeting "
|
||||
<< client << endl;
|
||||
serv->pipes.send(buf);
|
||||
} else if (cmd == "bye") {
|
||||
// If clients==0 maybe we should reset the pipes
|
||||
@ -474,14 +486,18 @@ void LyXServer::callback(LyXServer * serv, string const & msg)
|
||||
if (i<serv->numclients) {
|
||||
serv->numclients--;
|
||||
serv->clients[i].erase();
|
||||
lyxerr.debug("LyXServer: Client " + client + " said goodbye",
|
||||
Error::LYXSERVER);
|
||||
lyxerr[Debug::LYXSERVER]
|
||||
<< "LyXServer: Client "
|
||||
<< client << " said goodbye"
|
||||
<< endl;
|
||||
} else {
|
||||
lyxerr.debug("LyXServer: ignoring bye messge from unregistered client" +
|
||||
client + "\n", Error::LYXSERVER);
|
||||
lyxerr[Debug::LYXSERVER]
|
||||
<< "LyXServer: ignoring bye messge from unregistered client"
|
||||
<< client << endl;
|
||||
}
|
||||
} else {
|
||||
lyxerr.print("LyXServer: Undefined server command " + cmd + ".");
|
||||
lyxerr <<"LyXServer: Undefined server command "
|
||||
<< cmd << "." << endl;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -4,12 +4,13 @@
|
||||
*
|
||||
* LyX, The Document Processor
|
||||
*
|
||||
* Copyright (C) 1995 Matthias Ettrich
|
||||
* Copyright 1995 Matthias Ettrich
|
||||
* Copyright 1995-1999 The LyX Team.
|
||||
*
|
||||
*======================================================*/
|
||||
* ======================================================*/
|
||||
|
||||
#ifndef _LYXTEXT_H
|
||||
#define _LYXTEXT_H
|
||||
#ifndef LYXTEXT_H
|
||||
#define LYXTEXT_H
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
|
36
src/lyxvc.C
36
src/lyxvc.C
@ -6,7 +6,7 @@
|
||||
|
||||
#include FORMS_H_LOCATION
|
||||
#include "lyxvc.h"
|
||||
#include "error.h"
|
||||
#include "debug.h"
|
||||
#include "lyx_gui_misc.h"
|
||||
#include "bufferlist.h"
|
||||
#include "support/syscall.h"
|
||||
@ -49,9 +49,10 @@ bool LyXVC::file_found_hook(string const & fn)
|
||||
FileInfo f;
|
||||
// Check if *,v exists.
|
||||
tmp += ",v";
|
||||
lyxerr.debug(string("Checking if file is under vc: ") + tmp, Error::LYXVC);
|
||||
lyxerr[Debug::LYXVC] << "Checking if file is under vc: "
|
||||
<< tmp << endl;
|
||||
if (f.newFile(tmp).readable()) {
|
||||
lyxerr.debug("Yes it is under vc.", Error::LYXVC);
|
||||
lyxerr[Debug::LYXVC] << "Yes it is under vc." << endl;
|
||||
master = tmp;
|
||||
backend = RCS_VCS;
|
||||
scanMaster();
|
||||
@ -60,9 +61,10 @@ bool LyXVC::file_found_hook(string const & fn)
|
||||
// Check if RCS/*,v exists.
|
||||
tmp = AddName(AddPath(OnlyPath(fn), "RCS"), fn);
|
||||
tmp += ",v";
|
||||
lyxerr.debug("Checking if file is under vc: " + tmp, Error::LYXVC);
|
||||
lyxerr[Debug::LYXVC] << "Checking if file is under vc: "
|
||||
<< tmp << endl;
|
||||
if (f.newFile(tmp).readable()) {
|
||||
lyxerr.debug("Yes it is under vc.", Error::LYXVC);
|
||||
lyxerr[Debug::LYXVC] << "Yes it is under vc."<< endl;
|
||||
master = tmp;
|
||||
backend = RCS_VCS;
|
||||
scanMaster();
|
||||
@ -85,7 +87,7 @@ bool LyXVC::file_not_found_hook(string const &)
|
||||
|
||||
void LyXVC::scanMaster()
|
||||
{
|
||||
lyxerr.debug("LyXVC: This file is a VC file.", Error::LYXVC);
|
||||
lyxerr[Debug::LYXVC] << "LyXVC: This file is a VC file." << endl;
|
||||
|
||||
LyXLex lex(0, 0);
|
||||
lex.setFile(master);
|
||||
@ -96,8 +98,8 @@ void LyXVC::scanMaster()
|
||||
lex.next();
|
||||
token = lex.GetString();
|
||||
|
||||
lyxerr.debug("LyXVC::scanMaster: current lex text: `"
|
||||
+token+"'", Error::LYXVC);
|
||||
lyxerr[Debug::LYXVC] <<"LyXVC::scanMaster: current lex text: `"
|
||||
<< token << "'" << endl;
|
||||
|
||||
if (token.empty())
|
||||
continue;
|
||||
@ -136,7 +138,9 @@ void LyXVC::scanMaster()
|
||||
read_enough = true;
|
||||
} else {
|
||||
// unexpected
|
||||
lyxerr.debug("LyXVC::scanMaster(): unexpected token", Error::LYXVC);
|
||||
lyxerr[Debug::LYXVC]
|
||||
<< "LyXVC::scanMaster(): unexpected token"
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -176,11 +180,11 @@ void LyXVC::registrer()
|
||||
return;
|
||||
}
|
||||
|
||||
lyxerr.debug("LyXVC: registrer", Error::LYXVC);
|
||||
lyxerr[Debug::LYXVC] << "LyXVC: registrer" << endl;
|
||||
string tmp = askForText(_("LyX VC: Initial description"),
|
||||
_("(no initial description)"));
|
||||
if (tmp.empty()) {
|
||||
lyxerr.debug("LyXVC: user cancelled", Error::LYXVC);
|
||||
lyxerr[Debug::LYXVC] << "LyXVC: user cancelled" << endl;
|
||||
WriteAlert(_("Info"), _("This document has NOT been registered."));
|
||||
return;
|
||||
}
|
||||
@ -210,7 +214,7 @@ void LyXVC::checkIn()
|
||||
return;
|
||||
}
|
||||
|
||||
lyxerr.debug("LyXVC: checkIn", Error::LYXVC);
|
||||
lyxerr[Debug::LYXVC] << "LyXVC: checkIn" << endl;
|
||||
_owner->getUser()->getOwner()->getLyXFunc()->Dispatch(LFUN_MENUWRITE);
|
||||
string tmp = askForText(_("LyX VC: Log Message"));
|
||||
if (tmp.empty()) tmp = "(no log msg)";
|
||||
@ -222,7 +226,7 @@ void LyXVC::checkIn()
|
||||
|
||||
void LyXVC::checkOut()
|
||||
{
|
||||
lyxerr.debug("LyXVC: checkOut", Error::LYXVC);
|
||||
lyxerr[Debug::LYXVC] << "LyXVC: checkOut" << endl;
|
||||
if (!_owner->isLyxClean()
|
||||
&& !AskQuestion(_("Changes in document:"),
|
||||
MakeDisplayPath(_owner->getFileName(),50),
|
||||
@ -239,7 +243,7 @@ void LyXVC::checkOut()
|
||||
|
||||
void LyXVC::revert()
|
||||
{
|
||||
lyxerr.debug("LyXVC: revert", Error::LYXVC);
|
||||
lyxerr[Debug::LYXVC] << "LyXVC: revert" << endl;
|
||||
// Here we should check if the buffer is dirty. And if it is
|
||||
// we should warn the user that reverting will discard all
|
||||
// changes made since the last check in.
|
||||
@ -259,7 +263,7 @@ void LyXVC::revert()
|
||||
|
||||
void LyXVC::undoLast()
|
||||
{
|
||||
lyxerr.debug("LyXVC: undoLast", Error::LYXVC);
|
||||
lyxerr[Debug::LYXVC] << "LyXVC: undoLast" << endl;
|
||||
doVCCommand("rcs -o" + getVersion() + " \""
|
||||
+ OnlyFilename(_owner->getFileName()) + "\"");
|
||||
}
|
||||
@ -379,7 +383,7 @@ void LyXVC::showLog()
|
||||
|
||||
int LyXVC::doVCCommand(string const & cmd)
|
||||
{
|
||||
lyxerr.debug("doVCCommand: " + cmd, Error::LYXVC);
|
||||
lyxerr[Debug::LYXVC] << "doVCCommand: " << cmd << endl;
|
||||
Systemcalls one;
|
||||
PathPush(_owner->filepath);
|
||||
int ret = one.Startscript(Systemcalls::System, cmd);
|
||||
|
@ -36,7 +36,7 @@
|
||||
#include "lyxtext.h"
|
||||
#include "gettext.h"
|
||||
#include "LaTeXFeatures.h"
|
||||
#include "error.h"
|
||||
#include "debug.h"
|
||||
#include "lyx_gui_misc.h"
|
||||
|
||||
extern void UpdateInset(Inset* inset, bool mark_dirty = true);
|
||||
@ -153,7 +153,7 @@ LyXFont WhichFont(short type, int size)
|
||||
f.decSize();
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "Mathed Error: wrong font size: %d\n", size);
|
||||
lyxerr << "Mathed Error: wrong font size: " << size << endl;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -700,7 +700,7 @@ void InsetFormula::InsetMotionNotify(int x, int y, int /*button*/)
|
||||
|
||||
void InsetFormula::InsetKeyPress(XKeyEvent *)
|
||||
{
|
||||
lyxerr.debug("Used InsetFormula::InsetKeyPress.", Error::MATHED);
|
||||
lyxerr[Debug::MATHED] << "Used InsetFormula::InsetKeyPress." << endl;
|
||||
}
|
||||
|
||||
// Special Mathed functions
|
||||
@ -1081,7 +1081,7 @@ bool InsetFormula::LocalDispatch(int action, char const *arg)
|
||||
mathcursor->setAccent(0);
|
||||
}
|
||||
if (c==0) { // Dead key, do nothing
|
||||
//fprintf(stderr, "deadkey");
|
||||
//lyxerr << "deadkey" << endl;
|
||||
break;
|
||||
}
|
||||
if (isalpha(c)) {
|
||||
@ -1097,7 +1097,7 @@ bool InsetFormula::LocalDispatch(int action, char const *arg)
|
||||
varcode = MathIsAlphaFont(f) ? (MathedTextCodes)f:LM_TC_VAR;
|
||||
}
|
||||
|
||||
// fprintf(stderr, "Varcode %d ", varcode);
|
||||
// lyxerr << "Varcode << vardoce;
|
||||
mathcursor->Insert(c, (greek_kb_flag) ? LM_TC_SYMB: varcode);
|
||||
varcode = LM_TC_MIN;
|
||||
if (greek_kb_flag<2) greek_kb_flag = 0;
|
||||
@ -1170,7 +1170,7 @@ bool InsetFormula::LocalDispatch(int action, char const *arg)
|
||||
}
|
||||
UpdateLocal();
|
||||
} else {
|
||||
// fprintf(stderr, "Closed by action %d\n", action);
|
||||
// lyxerr << "Closed by action " << action << endl;
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +14,7 @@
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <stdlib.h>
|
||||
#include <cstdlib>
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "formulamacro.h"
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include "math_macro.h"
|
||||
#include "math_root.h"
|
||||
#include "support/lstrings.h"
|
||||
#include "error.h"
|
||||
#include "debug.h"
|
||||
|
||||
extern void mathed_set_font(short type, int style);
|
||||
|
||||
@ -147,7 +147,7 @@ void MathedCursor::SetPar(MathParInset *p)
|
||||
|
||||
void MathedCursor::Draw(long unsigned pm, int x, int y)
|
||||
{
|
||||
// fprintf(stderr, "Cursor[%d %d] ", x, y);
|
||||
// lyxerr << "Cursor[" << x << " " << y << "] ";
|
||||
win = pm; // win = (mathedCanvas) ? mathedCanvas: pm;
|
||||
par->Metrics();
|
||||
int w = par->Width()+2, a = par->Ascent()+1, h = par->Height()+1;
|
||||
@ -165,7 +165,7 @@ void MathedCursor::Draw(long unsigned pm, int x, int y)
|
||||
|
||||
void MathedCursor::Redraw()
|
||||
{
|
||||
lyxerr.debug("Mathed: Redrawing!", Error::MATHED);
|
||||
lyxerr[Debug::MATHED] << "Mathed: Redrawing!" << endl;
|
||||
par->Metrics();
|
||||
int w = par->Width(), h = par->Height();
|
||||
int x, y;
|
||||
@ -261,7 +261,7 @@ bool MathedCursor::Right(bool sel)
|
||||
if (!selection) {
|
||||
MathParInset *p = cursor->GetActiveInset();
|
||||
if (!p) {
|
||||
fprintf(stderr, "Math error: Inset expected.\n");
|
||||
lyxerr << "Math error: Inset expected." << endl;
|
||||
return cursor->Next();
|
||||
}
|
||||
p->setArgumentIdx(0);
|
||||
@ -424,7 +424,7 @@ void MathedCursor::Insert(MathedInset* p, int t)
|
||||
}
|
||||
|
||||
} else
|
||||
fprintf(stderr, "Math error: Full stack.\n");
|
||||
lyxerr << "Math error: Full stack." << endl;
|
||||
}
|
||||
|
||||
void MathedCursor::Delete()
|
||||
@ -585,7 +585,7 @@ void MathedCursor::SetSize(short size)
|
||||
void MathedCursor::setLabel(char const* label)
|
||||
{ // ugly hack and possible bug
|
||||
if (!cursor->setLabel(strnew(label)))
|
||||
fprintf(stderr, "MathErr: Bad place to set labels.");
|
||||
lyxerr << "MathErr: Bad place to set labels." << endl;
|
||||
}
|
||||
|
||||
|
||||
@ -634,8 +634,7 @@ void MathedCursor::Interpret(char const *s)
|
||||
if (!l) {
|
||||
p = MathMacroTable::mathMTable.getMacro(s);
|
||||
if (!p) {
|
||||
lyxerr.debug(string("Macro2 ") + s + ' '
|
||||
+ tostr(tcode), Error::MATHED);
|
||||
lyxerr[Debug::MATHED] << "Macro2 " << s << ' ' << tcode << endl;
|
||||
if (strcmp("root", s)==0) {
|
||||
p = new MathRootInset();
|
||||
tcode = LM_TC_ACTIVE_INSET;
|
||||
@ -643,7 +642,7 @@ void MathedCursor::Interpret(char const *s)
|
||||
p = new MathFuncInset(s, LM_OT_UNDEF);
|
||||
} else {
|
||||
tcode = ((MathMacro*)p)->getTCode();
|
||||
fprintf(stderr, "Macro2 %s %d ", s, tcode);
|
||||
lyxerr << "Macro2 " << s << ' ' << tcode << " " ;
|
||||
}
|
||||
} else {
|
||||
MathedInsetTypes fractype = LM_OT_FRAC;
|
||||
@ -665,7 +664,7 @@ void MathedCursor::Interpret(char const *s)
|
||||
}
|
||||
case LM_TK_STACK:
|
||||
fractype = LM_OT_STACKREL;
|
||||
lyxerr.debug(" i:stackrel ", Error::MATHED);
|
||||
lyxerr[Debug::MATHED] << " i:stackrel " << endl;
|
||||
case LM_TK_FRAC:
|
||||
{
|
||||
p = new MathFracInset(fractype);
|
||||
@ -705,8 +704,7 @@ void MathedCursor::Interpret(char const *s)
|
||||
case LM_TK_MACRO:
|
||||
p = MathMacroTable::mathMTable.getMacro(s);
|
||||
tcode = ((MathMacro*)p)->getTCode();
|
||||
lyxerr.debug(string("Macro ") + s + ' '
|
||||
+ tostr(tcode), Error::MATHED);
|
||||
lyxerr[Debug::MATHED] << "Macro " << s << ' ' << tcode << endl;
|
||||
break;
|
||||
default:
|
||||
{
|
||||
@ -752,7 +750,7 @@ void MathedCursor::MacroModeOpen()
|
||||
Insert (imacro);
|
||||
macro_mode = true;
|
||||
} else
|
||||
fprintf(stderr, "Mathed Warning: Already in macro mode\n");
|
||||
lyxerr << "Mathed Warning: Already in macro mode" << endl;
|
||||
}
|
||||
|
||||
void MathedCursor::MacroModeClose()
|
||||
@ -792,7 +790,7 @@ void MathedCursor::MacroModeBack()
|
||||
} else
|
||||
MacroModeClose();
|
||||
} else
|
||||
fprintf(stderr, "Mathed Warning: we are not in macro mode\n");
|
||||
lyxerr << "Mathed Warning: we are not in macro mode" << endl;
|
||||
}
|
||||
|
||||
void MathedCursor::MacroModeInsert(char c)
|
||||
@ -802,7 +800,7 @@ void MathedCursor::MacroModeInsert(char c)
|
||||
macrobf[macroln++] = c;
|
||||
imacro->Metrics();
|
||||
} else
|
||||
fprintf(stderr, "Mathed Warning: we are not in macro mode\n");
|
||||
lyxerr << "Mathed Warning: we are not in macro mode" << endl;
|
||||
}
|
||||
|
||||
void MathedCursor::SelCopy()
|
||||
@ -834,7 +832,7 @@ void MathedCursor::SelCut()
|
||||
|
||||
void MathedCursor::SelDel()
|
||||
{
|
||||
// fprintf(stderr, "Deleting sel ");
|
||||
// lyxerr << "Deleting sel "
|
||||
if (selection) {
|
||||
if (cursor->pos==selpos) return;
|
||||
cursor->Clean(selpos);
|
||||
@ -845,7 +843,7 @@ void MathedCursor::SelDel()
|
||||
|
||||
void MathedCursor::SelPaste()
|
||||
{
|
||||
// fprintf(stderr, "paste %p %d ", selarray, cursor->pos);
|
||||
// lyxerr << "paste " << selarray << " " << curor->pos;
|
||||
if (selection) SelDel();
|
||||
if (selarray) {
|
||||
cursor->Merge(selarray);
|
||||
@ -855,7 +853,7 @@ void MathedCursor::SelPaste()
|
||||
|
||||
void MathedCursor::SelStart()
|
||||
{
|
||||
lyxerr.debug("Starting sel ",Error::MATHED);
|
||||
lyxerr[Debug::MATHED] << "Starting sel " << endl;
|
||||
if (!anchor) {
|
||||
selpos = cursor->pos;
|
||||
selstk = new MathStackXIter(mathstk);
|
||||
@ -870,7 +868,7 @@ void MathedCursor::SelStart()
|
||||
|
||||
void MathedCursor::SelClear()
|
||||
{
|
||||
lyxerr.debug("Clearing sel ", Error::MATHED);
|
||||
lyxerr[Debug::MATHED] << "Clearing sel " << endl;
|
||||
selection = false;
|
||||
delete selstk;
|
||||
selstk = 0;
|
||||
@ -887,12 +885,12 @@ void MathedCursor::SelBalance()
|
||||
// If unbalanced, balance them
|
||||
while (d != 0) {
|
||||
if (d<0) {
|
||||
// fprintf(stderr, "b[%d %d %d %d]", mathstk.Level(), selstk->Level(), anchor->GetX(), cursor->GetX());
|
||||
// lyxerr << "b[" << mathstk.Level() << " " << selstk->Level << " " << anchor->GetX() << " " << cursor->GetX() << "]";
|
||||
anchor = selstk->pop();
|
||||
if (anchor->GetX() >= cursor->GetX())
|
||||
anchor->Next();
|
||||
} else {
|
||||
// fprintf(stderr, "a[%d %d]", mathstk.Level(), selstk->Level());
|
||||
// lyxerr <<"a[" << mathstk.Level() << " " << selstk->Level() <<"]";
|
||||
Pop();
|
||||
}
|
||||
d = mathstk.Level() - selstk->Level();
|
||||
@ -955,10 +953,10 @@ XPoint *MathedCursor::SelGetArea(int& np)
|
||||
point[i].x = point[0].x;
|
||||
point[i++].y = point[0].y;
|
||||
np = i;
|
||||
// fprintf(stderr, "AN[%d %d %d %d] ", x, y, x1, y1);
|
||||
// fprintf(stderr, "MT[%d %d %d %d] ", a, d, a1, d1);
|
||||
// lyxerr << "AN[" << x << " " << y << " " << x1 << " " << y1 << "] ";
|
||||
// lyxerr << "MT[" << a << " " << d << " " << a1 << " " << d1 << "] ";
|
||||
// for (i=0; i<np; i++)
|
||||
// fprintf(stderr, "XY[%d %d] ", point[i].x, point[i].y);
|
||||
// lyxerr << "XY[" << point[i].x << " " << point[i].y << "] ";
|
||||
|
||||
return &point[0];
|
||||
}
|
||||
|
@ -135,6 +135,8 @@ enum MathedTextCodes {
|
||||
LM_TC_MAX
|
||||
};
|
||||
|
||||
ostream & operator<<(ostream &, MathedTextCodes mtc);
|
||||
|
||||
///
|
||||
#define LM_TC_NORMAL LM_TC_VAR
|
||||
|
||||
|
@ -347,14 +347,14 @@ void mathed_draw_deco(Window win, int x, int y, int w, int h, int code)
|
||||
n = (int)d[i++];
|
||||
for (j=0; j<n; j++) {
|
||||
xx = d[i++]; yy = d[i++];
|
||||
// fprintf(stderr, " %g %g ", xx, yy);
|
||||
// lyxerr << " " << xx << " " << yy << " ";
|
||||
if (code==4)
|
||||
sqmt.transf(xx, yy, xx, yy);
|
||||
else
|
||||
mt.transf(xx, yy, xx, yy);
|
||||
p[j].x = x+(int)xx;
|
||||
p[j].y = y+(int)yy;
|
||||
// fprintf(stderr, "P[%d %g %g %d %d]", j, xx, yy, x, y);
|
||||
// lyxerr << "P[" << j " " << xx << " " << yy << " " << x << " " << y << "]";
|
||||
}
|
||||
XDrawLines(fl_display, win, mathLineGC, p, n, CoordModeOrigin);
|
||||
XFlush(fl_display);
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include FORMS_H_LOCATION
|
||||
#include "math_cursor.h"
|
||||
#include "math_parser.h"
|
||||
#include "debug.h"
|
||||
|
||||
extern void mathed_set_font(short type, int style);
|
||||
extern int mathed_char_width(short type, int style, byte c);
|
||||
@ -125,7 +126,8 @@ MathParInset::Draw(int x, int y)
|
||||
limits = false;
|
||||
}
|
||||
else {
|
||||
fprintf(stderr, "GMathed Error: Unrecognized code[%d]\n", cx);
|
||||
lyxerr << "GMathed Error: Unrecognized code[" << cx
|
||||
<< "]" << endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -223,7 +225,8 @@ MathParInset::Metrics()
|
||||
data.Next();
|
||||
}
|
||||
else {
|
||||
fprintf(stderr, "Mathed Error: Unrecognized code[%d]\n", cx);
|
||||
lyxerr << "Mathed Error: Unrecognized code[" << cx
|
||||
<< "]" << endl;
|
||||
break;
|
||||
}
|
||||
cxp = cx;
|
||||
|
@ -273,7 +273,7 @@ bool MathFracInset::Inside(int x, int y)
|
||||
|
||||
void MathFracInset::SetFocus(int /*x*/, int y)
|
||||
{
|
||||
// fprintf(stderr, "y %d %d %d ", y, yo, den->yo);
|
||||
// lyxerr << "y " << y << " " << yo << " " << den->yo << " ";
|
||||
idx = (y > yo) ? 1: 0;
|
||||
}
|
||||
|
||||
@ -410,7 +410,7 @@ void MathMatrixInset::Metrics()
|
||||
MathedRowSt *cprow=0, *cxrow;
|
||||
|
||||
if (!row) {
|
||||
// fprintf(stderr, " MIDA ");
|
||||
// lyxerr << " MIDA ";
|
||||
MathedXIter it(this);
|
||||
row = it.adjustVerticalSt();
|
||||
}
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include "math_inset.h"
|
||||
#include "symbol_def.h"
|
||||
#include "support/lstrings.h"
|
||||
#include "error.h"
|
||||
#include "debug.h"
|
||||
|
||||
const int SizeInset = sizeof(char*) + 2;
|
||||
const int SizeFont = 2;
|
||||
@ -79,7 +79,8 @@ MathedInset* MathedIter::GetInset()
|
||||
memcpy(&p, &array->bf[pos+1], sizeof(p));
|
||||
return p;
|
||||
} else {
|
||||
fprintf(stderr,"Math Error: This is not an inset[%d]\n", array->bf[pos]);
|
||||
lyxerr << "Math Error: This is not an inset["
|
||||
<< array->bf[pos] << "]" << endl;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -92,7 +93,7 @@ MathParInset* MathedIter::GetActiveInset()
|
||||
return (MathParInset*)GetInset();
|
||||
}
|
||||
|
||||
fprintf(stderr,"Math Error: This is not an active inset\n");
|
||||
lyxerr << "Math Error: This is not an active inset" << endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -309,11 +310,10 @@ bool MathedIter::Delete()
|
||||
else
|
||||
if (c==LM_TC_TAB || c==LM_TC_CR) {
|
||||
shift++;
|
||||
// fprintf(stderr, "Es un tab.");
|
||||
// lyxerr <<"Es un tab.";
|
||||
}
|
||||
else {
|
||||
fprintf(stderr, "Math Warning: expected inset.");
|
||||
fflush(stderr);
|
||||
lyxerr << "Math Warning: expected inset." << endl;
|
||||
}
|
||||
}
|
||||
|
||||
@ -330,7 +330,7 @@ bool MathedIter::Delete()
|
||||
LyxArrayBase *MathedIter::Copy(int pos1, int pos2)
|
||||
{
|
||||
if (!array) {
|
||||
// fprintf(stderr, "Math error: Attempting to copy a void array.\n");
|
||||
// lyxerr << "Math error: Attempting to copy a void array." << endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -356,7 +356,7 @@ LyxArrayBase *MathedIter::Copy(int pos1, int pos2)
|
||||
|
||||
int dx = pos2 - pos1;
|
||||
a = new LyxArrayBase(dx+LyxArrayBase::ARRAY_MIN_SIZE);
|
||||
// fprintf(stderr, "VA %d %d %d ", pos1, pos2, dx); fflush(stderr);
|
||||
// lyxerr << "VA " << pos2 << " " << pos2 << " " << dx << endl;
|
||||
memcpy(&a->bf[(fc) ? 1: 0], &array->bf[pos1], dx);
|
||||
if (fc) {
|
||||
a->bf[0] = fc;
|
||||
@ -385,7 +385,7 @@ LyxArrayBase *MathedIter::Copy(int pos1, int pos2)
|
||||
void MathedIter::Clear()
|
||||
{
|
||||
if (!array) {
|
||||
fprintf(stderr, "Math error: Attempting to clean a void array.\n");
|
||||
lyxerr << "Math error: Attempting to clean a void array." << endl;
|
||||
return;
|
||||
}
|
||||
Reset();
|
||||
@ -438,7 +438,7 @@ void MathedIter::adjustTabs()
|
||||
void MathedXIter::Clean(int pos2)
|
||||
{
|
||||
if (!array) {
|
||||
fprintf(stderr, "Math error: Attempting to clean a void array.\n");
|
||||
lyxerr << "Math error: Attempting to clean a void array." << endl;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -485,8 +485,9 @@ void MathedXIter::Clean(int pos2)
|
||||
void MathedXIter::Merge(LyxArrayBase *a0)
|
||||
{
|
||||
if (!a0) {
|
||||
lyxerr.debug("Math error: Attempting to merge a void array.",
|
||||
Error::MATHED);
|
||||
lyxerr[Debug::MATHED]
|
||||
<< "Math error: Attempting to merge a void array." << endl;
|
||||
|
||||
return;
|
||||
}
|
||||
// All insets must be clonned
|
||||
@ -585,10 +586,10 @@ byte* MathedXIter::GetString(int& ls)
|
||||
|
||||
bool MathedXIter::Next()
|
||||
{
|
||||
// fprintf(stderr, "Ne[%d]", pos);
|
||||
// lyxerr << "Ne[" << pos << "]";
|
||||
if (!OK()) return false;
|
||||
int w=0;
|
||||
// fprintf(stderr, "xt ");
|
||||
// lyxerr << "xt ";
|
||||
if (IsInset()) {
|
||||
MathedInset* px = GetInset();
|
||||
w = px->Width();
|
||||
@ -600,13 +601,13 @@ bool MathedXIter::Next()
|
||||
} else {
|
||||
byte c = GetChar();
|
||||
if (c>=' ') {
|
||||
// fprintf(stderr, "WD[%d %d %c] ", fcode, size, c); fflush(stderr);
|
||||
// lyxerr << "WD[" << fcode << " " << size << " " << c << endl;
|
||||
w = mathed_char_width(fcode, size, c);
|
||||
} else
|
||||
if (c==LM_TC_TAB && p) {
|
||||
// w = p->GetTab(col+1);
|
||||
w = (crow) ? crow->getTab(col+1): 0;
|
||||
//fprintf(stderr, "WW[%d]", w);
|
||||
//lyxerr << "WW[" << w << "]";
|
||||
} else
|
||||
if (c==LM_TC_CR && p) {
|
||||
x = 0;
|
||||
@ -615,12 +616,12 @@ bool MathedXIter::Next()
|
||||
y = crow->getBaseline();
|
||||
w = crow->getTab(0);
|
||||
}
|
||||
// fprintf(stderr, "WW[%d %d|%d]", col, row, w);
|
||||
// lyxerr << "WW[" << col " " << row << "|" << w << "]";
|
||||
} else
|
||||
fprintf(stderr, "No hubo w[%d]!", (int)c);
|
||||
lyxerr << "No hubo w[" << c << "]!";
|
||||
}
|
||||
if (MathedIter::Next()) {
|
||||
// fprintf(stderr, "LNX %d ", pos); fflush(stderr);
|
||||
// lyxerr <<"LNX " << pos << endl;
|
||||
// if (sw>0 && GetChar()!=LM_TC_UP && GetChar()!=LM_TC_DOWN) {
|
||||
// w = (sx>sw) ? 0: sw-sx;
|
||||
if ((sw>0 || sx>0) && GetChar()!=LM_TC_UP && GetChar()!=LM_TC_DOWN) {
|
||||
@ -729,9 +730,9 @@ bool MathedXIter::Down()
|
||||
void MathedXIter::addRow()
|
||||
{
|
||||
if (!crow) {
|
||||
lyxerr.debug(string("MathErr: Attempt to insert new"
|
||||
" line in a subparagraph. ")
|
||||
+ tostr(this), Error::MATHED);
|
||||
lyxerr[Debug::MATHED] << "MathErr: Attempt to insert new"
|
||||
" line in a subparagraph. " << this << endl;
|
||||
|
||||
return;
|
||||
}
|
||||
// Create new item for the structure
|
||||
@ -763,8 +764,7 @@ void MathedXIter::addRow()
|
||||
void MathedXIter::delRow()
|
||||
{
|
||||
if (!crow) {
|
||||
lyxerr.debug("MathErr: Attempt to delete a line in a subparagraph.",
|
||||
Error::MATHED);
|
||||
lyxerr[Debug::MATHED] << "MathErr: Attempt to delete a line in a subparagraph." << endl;
|
||||
return;
|
||||
}
|
||||
bool line_empty = true;
|
||||
@ -841,14 +841,14 @@ void MathedXIter::setTab(int tx, int tab)
|
||||
crow->w[tab] = tx;
|
||||
}
|
||||
else
|
||||
fprintf(stderr, "MathErr: No tabs allowed here");
|
||||
lyxerr << "MathErr: No tabs allowed here" << endl;
|
||||
}
|
||||
|
||||
|
||||
void MathedXIter::subMetrics(int a, int d)
|
||||
{
|
||||
if (!crow) {
|
||||
// fprintf(stderr, "MathErr: Attempt to submetric a subparagraph.");
|
||||
// lyxerr << "MathErr: Attempt to submetric a subparagraph." << endl;
|
||||
return;
|
||||
}
|
||||
crow->asc = a;
|
||||
@ -911,8 +911,9 @@ void MathedXIter::IMetrics(int pos2, int& width, int& ascent, int& descent)
|
||||
limits = false;
|
||||
}
|
||||
else {
|
||||
lyxerr.debug(string("Mathed Sel-Error: Unrecognized code[")
|
||||
+ tostr(cx) + ']', Error::MATHED);
|
||||
lyxerr[Debug::MATHED]
|
||||
<< "Mathed Sel-Error: Unrecognized code["
|
||||
<< cx << ']' << endl;
|
||||
break;
|
||||
}
|
||||
if (pos<pos2) Next();
|
||||
@ -948,10 +949,10 @@ MathedRowSt *MathedXIter::adjustVerticalSt()
|
||||
{
|
||||
GoBegin();
|
||||
if (!crow) {
|
||||
// fprintf(stderr, " CRW%d ", ncols);
|
||||
// lyxerr << " CRW" << ncols << " ";
|
||||
crow = new MathedRowSt(ncols+1); // this leaks
|
||||
}
|
||||
// fprintf(stderr, " CRW[%p] ", crow);
|
||||
// lyxerr<< " CRW[" << crow << "] ";
|
||||
MathedRowSt *row = crow;
|
||||
while (OK()) {
|
||||
if (IsCR()) {
|
||||
@ -960,7 +961,7 @@ MathedRowSt *MathedXIter::adjustVerticalSt()
|
||||
// r->next = crow->next;
|
||||
crow->next = r;
|
||||
crow = r;
|
||||
// fprintf(stderr, " CX[%p]", crow);
|
||||
// lyxerr << " CX[" << crow << "]";
|
||||
}
|
||||
Next();
|
||||
}
|
||||
|
@ -28,15 +28,24 @@
|
||||
#include "math_iter.h"
|
||||
#include "math_inset.h"
|
||||
#include "support/lstrings.h"
|
||||
#include "error.h"
|
||||
#include "debug.h"
|
||||
|
||||
|
||||
ostream & operator<<(ostream & o, MathedTextCodes mtc)
|
||||
{
|
||||
return o << int(mtc);
|
||||
}
|
||||
|
||||
enum MathedMacroFlag {
|
||||
MMF_Env=1,
|
||||
MMF_Exp=2,
|
||||
MMF_Edit=4
|
||||
};
|
||||
|
||||
ostream & operator<<(ostream & o, MathedMacroFlag mmf)
|
||||
{
|
||||
return o << int(mmf);
|
||||
}
|
||||
|
||||
extern GC mathGC, mathFrameGC, latexGC;
|
||||
extern int mathed_string_width(short type, int style, byte const* s, int ls);
|
||||
@ -158,9 +167,8 @@ void MathMacro::Write(FILE *file)
|
||||
void MathMacro::Write(string &file)
|
||||
{
|
||||
if (tmplate->flags & MMF_Exp) {
|
||||
lyxerr.debug(string("Expand ")+ tostr(tmplate->flags)
|
||||
+ ' ' + tostr(MMF_Exp),
|
||||
Error::MATHED);
|
||||
lyxerr[Debug::MATHED] << "Expand " << tmplate->flags
|
||||
<< ' ' << MMF_Exp << endl;
|
||||
tmplate->update(this);
|
||||
tmplate->Write(file);
|
||||
} else {
|
||||
@ -452,8 +460,8 @@ void MathMacroTable::addTemplate(MathMacroTemplate *m)
|
||||
if (num_macros<max_macros)
|
||||
macro_table[num_macros++] = m;
|
||||
else
|
||||
lyxerr.print("Error (MathMacroTable::addTemplate): "
|
||||
"Macro table exhausted!");
|
||||
lyxerr << "Error (MathMacroTable::addTemplate): "
|
||||
"Macro table exhausted!" << endl;
|
||||
}
|
||||
|
||||
|
||||
@ -471,7 +479,7 @@ void MathMacroTable::builtinMacros()
|
||||
|
||||
built = true;
|
||||
|
||||
lyxerr.debug("Building macros", Error::MATHED);
|
||||
lyxerr[Debug::MATHED] << "Building macros" << endl;
|
||||
|
||||
// This macro doesn't have arguments
|
||||
m = new MathMacroTemplate("notin"); // this leaks
|
||||
|
@ -14,14 +14,15 @@
|
||||
*
|
||||
* This code is under the GNU General Public Licence version 2 or later.
|
||||
*/
|
||||
#ifndef __MATH_MACRO__
|
||||
#define __MATH_MACRO__
|
||||
#ifndef MATH_MACRO
|
||||
#define MATH_MACRO
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
#include "math_defs.h"
|
||||
#include "debug.h"
|
||||
|
||||
///
|
||||
typedef MathParInset* MathParInsetP;
|
||||
@ -108,7 +109,7 @@ class MathMacroArgument: public MathParInset
|
||||
///
|
||||
MathMacroArgument(int);
|
||||
///
|
||||
~MathMacroArgument() { fprintf(stderr, "help, destroyme!\n"); }
|
||||
~MathMacroArgument() { lyxerr << "help, destroyme!" << endl; }
|
||||
///
|
||||
MathedInset *Clone() { return this; }
|
||||
///
|
||||
|
@ -28,7 +28,7 @@
|
||||
#include "math_inset.h"
|
||||
#include "math_macro.h"
|
||||
#include "math_root.h"
|
||||
#include "error.h"
|
||||
#include "debug.h"
|
||||
|
||||
enum {
|
||||
FLAG_BRACE = 1, // A { needed
|
||||
@ -100,7 +100,8 @@ char *strnew(char const* s)
|
||||
|
||||
static void mathPrintError(char const *msg)
|
||||
{
|
||||
fprintf(stderr, "Line ~%d: Math parse error: %s\n", yylineno, msg);
|
||||
lyxerr << "Line ~" << yylineno << ": Math parse error: "
|
||||
<< msg << endl;
|
||||
}
|
||||
|
||||
|
||||
@ -144,13 +145,15 @@ static char LexGetArg(char lf, bool accept_spaces=false)
|
||||
if (c>' ') {
|
||||
if (!lf) lf = c; else
|
||||
if (c!=lf)
|
||||
fprintf(stderr, "Math parse error: unexpected '%c'\n", c);
|
||||
lyxerr << "Math parse error: unexpected '"
|
||||
<< c << "'" << endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
rg = (lf=='{') ? '}': ((lf=='[') ? ']': ((lf=='(') ? ')': 0));
|
||||
if (!rg) {
|
||||
fprintf(stderr, "Math parse error: unknown bracket '%c'\n", lf);
|
||||
lyxerr << "Math parse error: unknown bracket '"
|
||||
<< lf << "'" << endl;
|
||||
return '\0';
|
||||
}
|
||||
do {
|
||||
@ -463,7 +466,7 @@ LyxArrayBase *mathed_parse(unsigned flags, LyxArrayBase *array, MathParInset **m
|
||||
MathParInset *p = new MathParInset(size, "", LM_OT_SCRIPT);
|
||||
LyxArrayBase * ar = mathed_parse(FLAG_BRACE_OPT|FLAG_BRACE_LAST, 0);
|
||||
p->SetData(ar);
|
||||
// fprintf(stderr, "UP[%d]", p->GetStyle());
|
||||
// lyxerr << "UP[" << p->GetStyle() << "]" << endl;
|
||||
data.Insert (p, LM_TC_UP);
|
||||
break;
|
||||
}
|
||||
@ -493,8 +496,8 @@ LyxArrayBase *mathed_parse(unsigned flags, LyxArrayBase *array, MathParInset **m
|
||||
} else
|
||||
mathPrintError("Unexpected tab");
|
||||
// debug info. [made that conditional -JMarc]
|
||||
if (lyxerr.debugging(Error::MATHED))
|
||||
fprintf(stderr, "%d %d\n", data.getCol(), mt->GetColumns());
|
||||
if (lyxerr.debugging(Debug::MATHED))
|
||||
lyxerr << data.getCol() << " " << mt->GetColumns() << endl;
|
||||
break;
|
||||
}
|
||||
case LM_TK_NEWLINE:
|
||||
@ -600,16 +603,16 @@ LyxArrayBase *mathed_parse(unsigned flags, LyxArrayBase *array, MathParInset **m
|
||||
lfd=yylex();
|
||||
if (lfd==LM_TK_SYM || lfd==LM_TK_STR || lfd==LM_TK_BOP|| lfd==LM_TK_SPECIAL)
|
||||
lfd = (lfd==LM_TK_SYM) ? yylval.l->id: yylval.i;
|
||||
// fprintf(stderr, "L[%d %c]", lfd, lfd);
|
||||
// lyxerr << "L[" << lfd << " " << lfd << "]";
|
||||
LyxArrayBase* a = mathed_parse(FLAG_RIGHT);
|
||||
rgd=yylex();
|
||||
// fprintf(stderr, "R[%d]", rgd);
|
||||
// lyxerr << "R[" << rgd << "]";
|
||||
if (rgd==LM_TK_SYM || rgd==LM_TK_STR || rgd==LM_TK_BOP || rgd==LM_TK_SPECIAL)
|
||||
rgd = (rgd==LM_TK_SYM) ? yylval.l->id: yylval.i;
|
||||
MathDelimInset *dl = new MathDelimInset(lfd, rgd);
|
||||
dl->SetData(a);
|
||||
data.Insert(dl, LM_TC_ACTIVE_INSET);
|
||||
// fprintf(stderr, "RL[%d %d]", lfd, rgd);
|
||||
// lyxerr << "RL[" << lfd << " " << rgd << "]";
|
||||
break;
|
||||
}
|
||||
case LM_TK_RIGHT:
|
||||
@ -691,8 +694,8 @@ LyxArrayBase *mathed_parse(unsigned flags, LyxArrayBase *array, MathParInset **m
|
||||
if (mathed_env != yylval.i && yylval.i!=LM_EN_ARRAY)
|
||||
mathPrintError("Unmatched environment");
|
||||
// debug info [made that conditional -JMarc]
|
||||
if (lyxerr.debugging(Error::MATHED))
|
||||
fprintf(stderr, "[%d]\n", yylval.i);
|
||||
if (lyxerr.debugging(Debug::MATHED))
|
||||
lyxerr << "[" << yylval.i << "]" << endl;
|
||||
plevel--;
|
||||
if (mt) { // && (flags & FLAG_END)) {
|
||||
mt->SetData(array);
|
||||
@ -745,10 +748,10 @@ LyxArrayBase *mathed_parse(unsigned flags, LyxArrayBase *array, MathParInset **m
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "MATH BEGIN[%d]\n", mathed_env);
|
||||
lyxerr << "MATH BEGIN[" << mathed_env << "]" << endl;
|
||||
#endif
|
||||
} else {
|
||||
// fprintf(stderr, "MATHCRO[%s]",yytext);
|
||||
// lyxerr << "MATHCRO[" << yytext << "]";
|
||||
MathMacro* p =
|
||||
MathMacroTable::mathMTable.getMacro(yytext);
|
||||
if (p) {
|
||||
@ -783,7 +786,7 @@ LyxArrayBase *mathed_parse(unsigned flags, LyxArrayBase *array, MathParInset **m
|
||||
if (rg != '}') {
|
||||
mathPrintError("Expected '{'");
|
||||
// debug info
|
||||
fprintf(stderr, "[%s]\n", yytext); fflush(stderr);
|
||||
lyxerr << "[" << yytext << "]" << endl;
|
||||
panic = true;
|
||||
break;
|
||||
}
|
||||
@ -799,19 +802,19 @@ LyxArrayBase *mathed_parse(unsigned flags, LyxArrayBase *array, MathParInset **m
|
||||
mathed_label = strnew(yytext);
|
||||
}
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Label[%d]\n", mathed_label);
|
||||
lyxerr << "Label[" << mathed_label << "]" << endl;
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
default:
|
||||
mathPrintError("Unrecognized token");
|
||||
// debug info
|
||||
fprintf(stderr, "[%d %s]\n", t, yytext);
|
||||
lyxerr << "[" << t << " " << yytext << "]" << endl;
|
||||
break;
|
||||
}
|
||||
tprev = t;
|
||||
if (panic) {
|
||||
fprintf(stderr, " Math Panic, expect problems!\n");
|
||||
lyxerr << " Math Panic, expect problems!" << endl;
|
||||
// Search for the end command.
|
||||
do t = yylex (); while (t != LM_TK_END && t);
|
||||
} else
|
||||
|
@ -31,7 +31,7 @@
|
||||
#include "lyxrc.h"
|
||||
#include "LyXView.h"
|
||||
#include "support/lstrings.h"
|
||||
#include "error.h"
|
||||
#include "debug.h"
|
||||
|
||||
#include "formula.h"
|
||||
|
||||
@ -207,7 +207,7 @@ BitmapMenu::AddBitmap(int id, int nx, int ny, int bw, int bh, char* data, Bool v
|
||||
void BitmapMenu::Create()
|
||||
{
|
||||
if (i<nb) {
|
||||
fprintf(stderr, "Error: Bitmaps not created!");
|
||||
lyxerr << "Error: Bitmaps not created!" << endl;
|
||||
return;
|
||||
}
|
||||
form = fl_bgn_form(FL_UP_BOX, w, h);
|
||||
@ -264,7 +264,7 @@ static void math_cb(FL_OBJECT* ob, long data)
|
||||
int i = menu->GetIndex(ob);
|
||||
char const *s = 0;
|
||||
|
||||
// fprintf(stderr, "data[%d]", data);
|
||||
// lyxerr << "data[" << data << "]";
|
||||
if (i<0) return;
|
||||
switch (data) {
|
||||
case MM_GREEK:
|
||||
@ -286,7 +286,7 @@ static void math_cb(FL_OBJECT* ob, long data)
|
||||
s = latex_misc[i];
|
||||
break;
|
||||
case MM_DOTS:
|
||||
// fprintf(stderr, "dots[%s %d]", latex_dots[i], i);
|
||||
// lyxerr << "dots[" << latex_dots[i] << " " << i << "]";
|
||||
s = latex_dots[i-29];
|
||||
break;
|
||||
}
|
||||
@ -365,7 +365,8 @@ void math_insert_symbol(char const* s)
|
||||
if (current_view->currentBuffer()->the_locking_inset->LyxCode()==Inset::MATH_CODE)
|
||||
((InsetFormula*)current_view->currentBuffer()->the_locking_inset)->InsertSymbol(s);
|
||||
else
|
||||
fprintf(stderr, "Math error: attempt to write on a wrong class of inset.\n");
|
||||
lyxerr << "Math error: attempt to write on a wrong "
|
||||
"class of inset." << endl;
|
||||
}
|
||||
}
|
||||
|
||||
@ -452,8 +453,7 @@ char** pixmapFromBitmapData(char const *s, int wx, int hx)
|
||||
char *bdata = 0;
|
||||
int w = 0, h = 0, dw = 0, dh = 0;
|
||||
|
||||
lyxerr.debug(string("Imando ") + tostr(i) + ", " + tostr(id),
|
||||
Error::MATHED);
|
||||
lyxerr[Debug::MATHED] << "Imando " << i << ", " << id << endl;
|
||||
switch (i) {
|
||||
case 0:
|
||||
if (id<=10) {
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "math_iter.h"
|
||||
#include "math_parser.h"
|
||||
#include "support/lstrings.h"
|
||||
#include "debug.h"
|
||||
|
||||
extern char const *latex_mathenv[];
|
||||
extern char *latex_mathspace[];
|
||||
@ -290,7 +291,8 @@ void MathParInset::Write(string &outf)
|
||||
outf += l->name;
|
||||
outf += ' ';
|
||||
} else {
|
||||
fprintf(stderr, "Illegal symbol code[%u %d %d]", *s, ls, data.FCode());
|
||||
lyxerr << "Illegal symbol code[" << *s
|
||||
<< " " << ls << " " << data.FCode() << "]";
|
||||
}
|
||||
} else {
|
||||
// Is there a standard logical XOR?
|
||||
@ -302,7 +304,8 @@ void MathParInset::Write(string &outf)
|
||||
if (*s=='}') brace--;
|
||||
}
|
||||
if (*s=='}' && data.FCode()==LM_TC_TEX && brace<0)
|
||||
fprintf(stderr, "Math warning: Unexpected closing brace.\n");
|
||||
lyxerr <<"Math warning: Unexpected closing brace."
|
||||
<< endl;
|
||||
else
|
||||
outf += (char) *s;
|
||||
}
|
||||
@ -348,7 +351,7 @@ void MathParInset::Write(string &outf)
|
||||
break;
|
||||
}
|
||||
default:
|
||||
fprintf(stderr, "WMath Error: unrecognized code[%d]", cx);
|
||||
lyxerr << "WMath Error: unrecognized code[" << cx << "]";
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -41,7 +41,7 @@
|
||||
#include "minibuffer.h"
|
||||
#include "lyxscreen.h"
|
||||
#include "intl.h"
|
||||
#include "error.h"
|
||||
#include "debug.h"
|
||||
#include "lyxrc.h"
|
||||
#include "lyxtext.h"
|
||||
#include "gettext.h"
|
||||
@ -121,12 +121,14 @@ void Menus::openByName(string const &menuName)
|
||||
else if (menuName == _("Options")) ShowOptionsMenu(menu_options, 0);
|
||||
else if (menuName == _("Documents")) ShowBufferMenu(menu_buffer, 0);
|
||||
else if (menuName == _("Help")) ShowHelpMenu(menu_help, 0);
|
||||
else lyxerr.print("The menu '" + menuName + "' is not available.");
|
||||
else lyxerr << "The menu '" << menuName
|
||||
<< "' is not available." << endl;
|
||||
} else {
|
||||
if (menuName == _("File")) ShowFileMenu2(menu_file2, 0);
|
||||
else if (menuName == _("Options")) ShowOptionsMenu(menu_options2, 0);
|
||||
else if (menuName == _("Help")) ShowHelpMenu(menu_help2, 0);
|
||||
else lyxerr.print("The menu '" + menuName + "' is not available.");
|
||||
else lyxerr << "The menu '" << menuName
|
||||
<< "' is not available." << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,7 @@
|
||||
#include FORMS_H_LOCATION
|
||||
#include "minibuffer.h"
|
||||
#include "LyXView.h"
|
||||
#include "error.h"
|
||||
#include "debug.h"
|
||||
#include "gettext.h"
|
||||
|
||||
extern bool keyseqUncomplete();
|
||||
@ -40,7 +40,7 @@ void MiniBuffer::TimerCB(FL_OBJECT *, long tmp)
|
||||
void MiniBuffer::ExecutingCB(FL_OBJECT *ob, long)
|
||||
{
|
||||
MiniBuffer *obj = (MiniBuffer*)ob->u_vdata;
|
||||
lyxerr.debug("Getting ready to execute: " + obj->cur_cmd);
|
||||
lyxerr.debug() << "Getting ready to execute: " << obj->cur_cmd << endl;
|
||||
fl_set_focus_object(obj->owner->getForm(),
|
||||
obj->owner->currentView()->getWorkArea());
|
||||
if (obj->cur_cmd.empty()) {
|
||||
@ -62,8 +62,8 @@ void MiniBuffer::ExecutingCB(FL_OBJECT *ob, long)
|
||||
function = arg;
|
||||
arg.erase();
|
||||
}
|
||||
lyxerr.debug("Function: " + function);
|
||||
lyxerr.debug("Arg : " + arg);
|
||||
lyxerr.debug() << "Function: " << function
|
||||
<< "\nArg : " << arg << endl;
|
||||
// Check if the name is valid (ale)
|
||||
// No, let the dispatch functions handle that.
|
||||
//int action = lyxaction.LookupFunc(function.c_str());
|
||||
@ -72,7 +72,7 @@ void MiniBuffer::ExecutingCB(FL_OBJECT *ob, long)
|
||||
// Dispatch only returns requested data for a few commands (ale)
|
||||
string res=obj->owner->getLyXFunc()->Dispatch(function.c_str(),
|
||||
arg.c_str());
|
||||
lyxerr.debug(string("Minibuffer Res: ") + res);
|
||||
lyxerr.debug() << "Minibuffer Res: " << res << endl;
|
||||
/* if (!res.empty())
|
||||
if(obj->owner->getLyXFunc()->errorStat())
|
||||
obj->Set(_("Error:"), _(res.c_str()), string(), 4);
|
||||
|
178
src/paragraph.C
178
src/paragraph.C
@ -20,7 +20,7 @@
|
||||
#include "tex-strings.h"
|
||||
#include "bufferparams.h"
|
||||
#include "support/FileInfo.h"
|
||||
#include "error.h"
|
||||
#include "debug.h"
|
||||
#include "LaTeXFeatures.h"
|
||||
#include "insets/insetinclude.h"
|
||||
#include "support/filetools.h"
|
||||
@ -106,7 +106,7 @@ LyXParagraph::LyXParagraph(LyXParagraph *par)
|
||||
|
||||
bibkey = 0; // ale970302
|
||||
// ale970302
|
||||
// fprintf(stderr, "new bib "); fflush(stderr);
|
||||
// lyxerr << "new bib " << endl;
|
||||
// if (par->bibkey) {
|
||||
// bibkey = new InsetBibKey(par->bibkey);
|
||||
// }
|
||||
@ -325,8 +325,8 @@ void LyXParagraph::writeFile(FILE *file, BufferParams ¶ms,
|
||||
if (c != '\0')
|
||||
fprintf(file, "%c", c);
|
||||
else
|
||||
lyxerr.print("ERROR (LyXParagraph::writeFile):"
|
||||
" NULL char in structure.");
|
||||
lyxerr << "ERROR (LyXParagraph::writeFile):"
|
||||
" NULL char in structure." << endl;
|
||||
column++;
|
||||
break;
|
||||
}
|
||||
@ -355,13 +355,13 @@ void LyXParagraph::validate(LaTeXFeatures &features)
|
||||
FontTable *tmpfonttable = fonttable;
|
||||
while (tmpfonttable) {
|
||||
if (tmpfonttable->font.noun() == LyXFont::ON) {
|
||||
lyxerr.debug(string("font.noun: ")
|
||||
+ tostr(tmpfonttable->font.noun()),
|
||||
Error::LATEX);
|
||||
lyxerr[Debug::LATEX] << "font.noun: "
|
||||
<< tmpfonttable->font.noun()
|
||||
<< endl;
|
||||
features.noun = true;
|
||||
lyxerr.debug("Noun enabled. Font: "
|
||||
+tmpfonttable->font.stateText(),
|
||||
Error::LATEX);
|
||||
lyxerr[Debug::LATEX] << "Noun enabled. Font: "
|
||||
<< tmpfonttable->font.stateText()
|
||||
<< endl;
|
||||
}
|
||||
switch (tmpfonttable->font.color()) {
|
||||
case LyXFont::NONE:
|
||||
@ -370,9 +370,9 @@ void LyXParagraph::validate(LaTeXFeatures &features)
|
||||
break;
|
||||
default:
|
||||
features.color = true;
|
||||
lyxerr.debug("Color enabled. Font: "
|
||||
+tmpfonttable->font.stateText(),
|
||||
Error::LATEX);
|
||||
lyxerr[Debug::LATEX] << "Color enabled. Font: "
|
||||
<< tmpfonttable->font.stateText()
|
||||
<< endl;
|
||||
}
|
||||
tmpfonttable = tmpfonttable->next;
|
||||
}
|
||||
@ -555,7 +555,8 @@ void LyXParagraph::Erase(int pos)
|
||||
if (next && next->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE)
|
||||
NextAfterFootnote()->Erase(pos - last - 1);
|
||||
else
|
||||
lyxerr.debug("ERROR (LyXParagraph::Erase): position does not exist.");
|
||||
lyxerr.debug() << "ERROR (LyXParagraph::Erase): "
|
||||
"position does not exist." << endl;
|
||||
return;
|
||||
}
|
||||
if (pos < last) { // last is free for insertation, but should be empty
|
||||
@ -631,7 +632,8 @@ void LyXParagraph::Erase(int pos)
|
||||
}
|
||||
|
||||
} else {
|
||||
lyxerr.print("ERROR (LyXParagraph::Erase): can't erase non-existant char.");
|
||||
lyxerr << "ERROR (LyXParagraph::Erase): "
|
||||
"can't erase non-existant char." << endl;
|
||||
}
|
||||
}
|
||||
|
||||
@ -648,7 +650,8 @@ void LyXParagraph::Enlarge(int pos, int number)
|
||||
if (next && next->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE)
|
||||
NextAfterFootnote()->Enlarge(pos - last - 1, number);
|
||||
else
|
||||
lyxerr.print("ERROR (LyXParagraph::Enlarge): position does not exist.");
|
||||
lyxerr << "ERROR (LyXParagraph::Enlarge): "
|
||||
"position does not exist." << endl;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -690,8 +693,8 @@ void LyXParagraph::InsertChar(int pos, char c)
|
||||
if (next && next->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE)
|
||||
NextAfterFootnote()->InsertChar(pos - last - 1, c);
|
||||
else
|
||||
lyxerr.debug("ERROR (LyXParagraph::InsertChar): "
|
||||
"position does not exist.");
|
||||
lyxerr.debug() << "ERROR (LyXParagraph::InsertChar): "
|
||||
"position does not exist." << endl;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -741,14 +744,14 @@ void LyXParagraph::InsertInset(int pos, Inset *inset)
|
||||
if (next && next->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE)
|
||||
NextAfterFootnote()->InsertInset(pos - last - 1, inset);
|
||||
else
|
||||
lyxerr.print("ERROR (LyXParagraph::InsertInset): "
|
||||
"position does not exist: " + tostr(pos));
|
||||
lyxerr << "ERROR (LyXParagraph::InsertInset): "
|
||||
"position does not exist: " << pos << endl;
|
||||
return;
|
||||
}
|
||||
|
||||
if (text[pos]!=LYX_META_INSET) {
|
||||
lyxerr.print("ERROR (LyXParagraph::InsertInset): "
|
||||
"there is no LYX_META_INSET");
|
||||
lyxerr << "ERROR (LyXParagraph::InsertInset): "
|
||||
"there is no LYX_META_INSET" << endl;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -769,7 +772,8 @@ Inset* LyXParagraph::GetInset(int pos)
|
||||
if (next && next->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE)
|
||||
return NextAfterFootnote()->GetInset(pos - last - 1);
|
||||
else {
|
||||
lyxerr.print(string("ERROR (LyXParagraph::GetInset): position does not exist: ") + tostr(pos));
|
||||
lyxerr << "ERROR (LyXParagraph::GetInset): position does not exist: "
|
||||
<< pos << endl;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -783,8 +787,8 @@ Inset* LyXParagraph::GetInset(int pos)
|
||||
if (tmpi)
|
||||
return tmpi->inset;
|
||||
else {
|
||||
lyxerr.print(string("ERROR (LyXParagraph::GetInset): "
|
||||
"Inset does not exist: ") + tostr(pos));
|
||||
lyxerr << "ERROR (LyXParagraph::GetInset): "
|
||||
"Inset does not exist: " << pos << endl;
|
||||
text[pos] = ' '; /// WHY!!! does this set the pos to ' '????
|
||||
// Did this commenting out introduce a bug? So far I have not
|
||||
// seen any, please enlighten me. (Lgb)
|
||||
@ -819,9 +823,8 @@ LyXFont LyXParagraph::GetFontSettings(int pos)
|
||||
// enough for this to be anable on debug?
|
||||
// We want strict error checking, but it's ok to only
|
||||
// have it when debugging. (Asger)
|
||||
lyxerr.print(
|
||||
string("ERROR (LyXParagraph::GetFontSettings): "
|
||||
"position does not exist. ") + tostr(pos));
|
||||
lyxerr << "ERROR (LyXParagraph::GetFontSettings): "
|
||||
"position does not exist. " << pos << endl;
|
||||
}
|
||||
} else if (pos) {
|
||||
return GetFontSettings(pos - 1);
|
||||
@ -906,8 +909,8 @@ char LyXParagraph::GetChar(int pos)
|
||||
if (pos < 0) {
|
||||
// This function is important. It should not work around bugs.
|
||||
// Let's find the bugs instead and fix them. (Asger)
|
||||
lyxerr.print(string("FATAL ERROR (LyXParagraph::GetChar):"
|
||||
" bad position ") + tostr(pos));
|
||||
lyxerr << "FATAL ERROR (LyXParagraph::GetChar):"
|
||||
" bad position " << pos << endl;
|
||||
abort();
|
||||
}
|
||||
#endif
|
||||
@ -922,15 +925,15 @@ char LyXParagraph::GetChar(int pos)
|
||||
if (next && next->footnoteflag != LyXParagraph::NO_FOOTNOTE)
|
||||
return NextAfterFootnote()->GetChar(pos - last - 1);
|
||||
else
|
||||
lyxerr.print("ERROR (LyXParagraph::GetChar): "
|
||||
"position does not exist.");
|
||||
lyxerr << "ERROR (LyXParagraph::GetChar): "
|
||||
"position does not exist." << endl;
|
||||
return '\0';
|
||||
} else { // pos==last
|
||||
/* we should have a footnote environment */
|
||||
if (!next || next->footnoteflag == LyXParagraph::NO_FOOTNOTE) {
|
||||
// Notice that LyX does request the last char from time to time. (Asger)
|
||||
// lyxerr.print("ERROR (LyXParagraph::GetChar): "
|
||||
// "expected footnote.");
|
||||
// lyxerr << "ERROR (LyXParagraph::GetChar): "
|
||||
// "expected footnote." << endl;
|
||||
return '\0';
|
||||
}
|
||||
switch (next->footnotekind) {
|
||||
@ -957,8 +960,8 @@ char LyXParagraph::GetChar(int pos)
|
||||
// return LYX_META_TAB;
|
||||
// if (next->footnotekind == LyXParagraph::ALGORITHM)
|
||||
// return LYX_META_ALGORITHM;
|
||||
// lyxerr.print("ERROR (LyXParagraph::GetChar): "
|
||||
// "unknown footnote kind.");
|
||||
// lyxerr << "ERROR (LyXParagraph::GetChar): "
|
||||
// "unknown footnote kind." << endl;
|
||||
// return 'F'; /* this should not happen! */
|
||||
// This _can_ not happen, due to the type of next->footnotekind
|
||||
// being LyXParagraph::footnot_kind
|
||||
@ -987,8 +990,8 @@ string LyXParagraph::GetWord(int & lastpos)
|
||||
if (lastpos < 0) {
|
||||
// This function is important. It should not work around bugs.
|
||||
// Let's find the bugs instead and fix them. (Asger)
|
||||
lyxerr.print(string("FATAL ERROR (LyXParagraph::GetWord):"
|
||||
" bad position ") + tostr(lastpos));
|
||||
lyxerr << "FATAL ERROR (LyXParagraph::GetWord):"
|
||||
" bad position " << lastpos << endl;
|
||||
abort();
|
||||
}
|
||||
#endif
|
||||
@ -1054,8 +1057,8 @@ LyXParagraph *LyXParagraph::ParFromPos(int pos)
|
||||
if (next && next->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE)
|
||||
return NextAfterFootnote()->ParFromPos(pos - last - 1);
|
||||
else
|
||||
lyxerr.print("ERROR (LyXParagraph::ParFromPos): "
|
||||
"position does not exist.");
|
||||
lyxerr << "ERROR (LyXParagraph::ParFromPos): "
|
||||
"position does not exist." << endl;
|
||||
return this;
|
||||
}
|
||||
else
|
||||
@ -1071,9 +1074,9 @@ int LyXParagraph::PositionInParFromPos(int pos)
|
||||
if (next && next->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE)
|
||||
return NextAfterFootnote()->PositionInParFromPos(pos - last - 1);
|
||||
else
|
||||
lyxerr.print(
|
||||
lyxerr <<
|
||||
"ERROR (LyXParagraph::PositionInParFromPos): "
|
||||
"position does not exist.");
|
||||
"position does not exist." << endl;
|
||||
return pos;
|
||||
}
|
||||
else
|
||||
@ -1089,8 +1092,8 @@ void LyXParagraph::SetFont(int pos, LyXFont const & font)
|
||||
if (next && next->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE) {
|
||||
NextAfterFootnote()->SetFont(pos - last - 1, font);
|
||||
} else {
|
||||
lyxerr.print("ERROR (LyXParagraph::SetFont): "
|
||||
"position does not exist.");
|
||||
lyxerr << "ERROR (LyXParagraph::SetFont): "
|
||||
"position does not exist." << endl;
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -1837,8 +1840,8 @@ LyXParagraph* LyXParagraph::DepthHook(int deth)
|
||||
|
||||
if (!newpar) {
|
||||
if (Previous() || GetDepth())
|
||||
lyxerr.print("ERROR (LyXParagraph::DepthHook): "
|
||||
"no hook.");
|
||||
lyxerr << "ERROR (LyXParagraph::DepthHook): "
|
||||
"no hook." << endl;
|
||||
newpar = this;
|
||||
}
|
||||
return newpar->FirstPhysicalPar();
|
||||
@ -1859,9 +1862,8 @@ int LyXParagraph::AutoDeleteInsets()
|
||||
Erase(tmpi2->pos);
|
||||
} else {}
|
||||
else
|
||||
lyxerr.print(
|
||||
"ERROR (LyXParagraph::AutoDeleteInsets): "
|
||||
"cannot auto-delete insets");
|
||||
lyxerr << "ERROR (LyXParagraph::AutoDeleteInsets): "
|
||||
"cannot auto-delete insets" << endl;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
@ -1939,13 +1941,13 @@ LyXParagraph* LyXParagraph::TeXOnePar(string &file, TexRow &texrow,
|
||||
string &foot, TexRow &foot_texrow,
|
||||
int &foot_count)
|
||||
{
|
||||
lyxerr.debug(string("TeXOnePar... ") + tostr(this), Error::LATEX);
|
||||
lyxerr[Debug::LATEX] << "TeXOnePar... " << this << endl;
|
||||
LyXParagraph *par = next;
|
||||
LyXLayout * style = lyxstyle.Style(GetCurrentTextClass(), layout);
|
||||
|
||||
bool further_blank_line = false;
|
||||
if (IsDummy())
|
||||
lyxerr.print("ERROR (LyXParagraph::TeXOnePar) is dummy.");
|
||||
lyxerr << "ERROR (LyXParagraph::TeXOnePar) is dummy." << endl;
|
||||
|
||||
if (start_of_appendix) {
|
||||
file += "\\appendix\n";
|
||||
@ -2093,7 +2095,7 @@ LyXParagraph* LyXParagraph::TeXOnePar(string &file, TexRow &texrow,
|
||||
texrow.newline();
|
||||
}
|
||||
|
||||
lyxerr.debug(string("TeXOnePar...done ") + tostr(par), Error::LATEX);
|
||||
lyxerr[Debug::LATEX] << "TeXOnePar...done " << par << endl;
|
||||
return par;
|
||||
}
|
||||
|
||||
@ -2101,8 +2103,7 @@ LyXParagraph* LyXParagraph::TeXOnePar(string &file, TexRow &texrow,
|
||||
// This one spits out the text of the paragraph
|
||||
bool LyXParagraph::SimpleTeXOnePar(string &file, TexRow &texrow)
|
||||
{
|
||||
lyxerr.debug(string("SimpleTeXOnePar... ") + tostr(this),
|
||||
Error::LATEX);
|
||||
lyxerr[Debug::LATEX] << "SimpleTeXOnePar... " << this << endl;
|
||||
|
||||
if (table)
|
||||
return SimpleTeXOneTablePar(file, texrow);
|
||||
@ -2272,8 +2273,7 @@ bool LyXParagraph::SimpleTeXOnePar(string &file, TexRow &texrow)
|
||||
return_value = false;
|
||||
}
|
||||
|
||||
lyxerr.debug(string("SimpleTeXOnePar...done ") + tostr(this),
|
||||
Error::LATEX);
|
||||
lyxerr[Debug::LATEX] << "SimpleTeXOnePar...done " << this << endl;
|
||||
return return_value;
|
||||
}
|
||||
|
||||
@ -2281,8 +2281,7 @@ bool LyXParagraph::SimpleTeXOnePar(string &file, TexRow &texrow)
|
||||
// This one spits out the text of a table paragraph
|
||||
bool LyXParagraph::SimpleTeXOneTablePar(string &file, TexRow &texrow)
|
||||
{
|
||||
lyxerr.debug(string("SimpleTeXOneTablePar... ")+
|
||||
tostr(this), Error::LATEX);
|
||||
lyxerr[Debug::LATEX] << "SimpleTeXOneTablePar... " << this << endl;
|
||||
char c;
|
||||
int column, tmp;
|
||||
|
||||
@ -2422,7 +2421,7 @@ bool LyXParagraph::SimpleTeXOneTablePar(string &file, TexRow &texrow)
|
||||
tmp = table->TexEndOfCell(file, current_cell_number);
|
||||
for (;tmp>0;tmp--)
|
||||
texrow.newline();
|
||||
lyxerr.debug(string("SimpleTeXOneTablePar...done ")+ tostr(this), Error::LATEX);
|
||||
lyxerr[Debug::LATEX] << "SimpleTeXOneTablePar...done " << this << endl;
|
||||
return return_value;
|
||||
}
|
||||
|
||||
@ -2432,8 +2431,7 @@ bool LyXParagraph::TeXContTableRows(string &file, int i,
|
||||
int current_cell_number,
|
||||
int &column, TexRow &texrow)
|
||||
{
|
||||
lyxerr.debug(string("TeXContTableRows... ") +
|
||||
tostr(this), Error::LATEX);
|
||||
lyxerr[Debug::LATEX] << "TeXContTableRows... " << this << endl;
|
||||
if (!table)
|
||||
return false;
|
||||
|
||||
@ -2521,7 +2519,7 @@ bool LyXParagraph::TeXContTableRows(string &file, int i,
|
||||
running_font = basefont;
|
||||
cell = table->CellHasContRow(current_cell_number);
|
||||
}
|
||||
lyxerr.debug(string("TeXContTableRows...done ")+ tostr(this), Error::LATEX);
|
||||
lyxerr[Debug::LATEX] << "TeXContTableRows...done " << this << endl;
|
||||
return return_value;
|
||||
}
|
||||
|
||||
@ -2597,8 +2595,7 @@ void LyXParagraph::SimpleDocBookOneTablePar(string &file, string &extra,
|
||||
{
|
||||
if (!table)
|
||||
return;
|
||||
lyxerr.debug(string("SimpleDocbookOneTablePar... ") +
|
||||
tostr(this), Error::LATEX);
|
||||
lyxerr[Debug::LATEX] << "SimpleDocbookOneTablePar... " << this << endl;
|
||||
int column, tmp;
|
||||
//bool return_value = false; // unused
|
||||
int current_cell_number = -1;
|
||||
@ -2751,8 +2748,8 @@ void LyXParagraph::SimpleDocBookOneTablePar(string &file, string &extra,
|
||||
if (footnoteflag == LyXParagraph::NO_FOOTNOTE)
|
||||
file += "</INFORMALTABLE>";
|
||||
file += '\n';
|
||||
lyxerr.debug(string("SimpleDocbookOneTablePar...done ") +
|
||||
tostr(this), Error::LATEX);
|
||||
lyxerr[Debug::LATEX] << "SimpleDocbookOneTablePar...done "
|
||||
<< this << endl;
|
||||
}
|
||||
|
||||
void LyXParagraph::DocBookContTableRows(string &file, string &extra,
|
||||
@ -2762,8 +2759,8 @@ void LyXParagraph::DocBookContTableRows(string &file, string &extra,
|
||||
if (!table)
|
||||
return;
|
||||
|
||||
lyxerr.debug(string("DocBookContTableRows... ") +
|
||||
tostr(this), Error::LATEX);
|
||||
lyxerr[Debug::LATEX] << "DocBookContTableRows... " << this << endl;
|
||||
|
||||
int cell, lastpos; //tmp; //unused
|
||||
LyXFont font1,font2;
|
||||
char c;
|
||||
@ -2880,8 +2877,7 @@ void LyXParagraph::DocBookContTableRows(string &file, string &extra,
|
||||
font1 = font2 = getFont(-1);
|
||||
cell = table->CellHasContRow(current_cell_number);
|
||||
}
|
||||
lyxerr.debug(string("DocBookContTableRows...done ") +
|
||||
tostr(this), Error::LATEX);
|
||||
lyxerr[Debug::LATEX] << "DocBookContTableRows...done " << this << endl;
|
||||
}
|
||||
|
||||
|
||||
@ -3243,7 +3239,7 @@ bool LyXParagraph::RoffContTableRows(FILE *fp, int i, int actcell)
|
||||
if (c != '\0')
|
||||
fprintf(fp, "%c", c);
|
||||
else
|
||||
lyxerr.debug("RoffAsciiTable: NULL char in structure.");
|
||||
lyxerr.debug() << "RoffAsciiTable: NULL char in structure." << endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -3256,12 +3252,12 @@ LyXParagraph * LyXParagraph::TeXDeeper(string &file, TexRow &texrow,
|
||||
string &foot, TexRow &foot_texrow,
|
||||
int &foot_count)
|
||||
{
|
||||
lyxerr.debug(string("TeXDeeper... ") + tostr(this), Error::LATEX);
|
||||
lyxerr[Debug::LATEX] << "TeXDeeper... " << this << endl;
|
||||
LyXParagraph *par = this;
|
||||
|
||||
while (par && par->depth == depth) {
|
||||
if (par->IsDummy())
|
||||
lyxerr.print("ERROR (LyXParagraph::TeXDeeper)");
|
||||
lyxerr << "ERROR (LyXParagraph::TeXDeeper)" << endl;
|
||||
if (lyxstyle.Style(GetCurrentTextClass(),
|
||||
par->layout)->isEnvironment()
|
||||
|| par->pextra_type != PEXTRA_NONE)
|
||||
@ -3275,7 +3271,7 @@ LyXParagraph * LyXParagraph::TeXDeeper(string &file, TexRow &texrow,
|
||||
foot_count);
|
||||
}
|
||||
}
|
||||
lyxerr.debug(string("TeXDeeper...done ") + tostr(par), Error::LATEX);
|
||||
lyxerr[Debug::LATEX] << "TeXDeeper...done " << par << endl;
|
||||
|
||||
return par;
|
||||
}
|
||||
@ -3297,9 +3293,9 @@ LyXParagraph* LyXParagraph::TeXEnvironment(string &file, TexRow &texrow,
|
||||
char
|
||||
par_sep = current_view->currentBuffer()->params.paragraph_separation;
|
||||
|
||||
lyxerr.debug(string("TeXEnvironment... ") + tostr(this), Error::LATEX);
|
||||
lyxerr[Debug::LATEX] << "TeXEnvironment... " << this << endl;
|
||||
if (IsDummy())
|
||||
lyxerr.print("ERROR (LyXParagraph::TeXEnvironment)");
|
||||
lyxerr << "ERROR (LyXParagraph::TeXEnvironment)" << endl;
|
||||
|
||||
LyXLayout * style = lyxstyle.Style(GetCurrentTextClass(), layout);
|
||||
|
||||
@ -3567,8 +3563,7 @@ LyXParagraph* LyXParagraph::TeXEnvironment(string &file, TexRow &texrow,
|
||||
file += '\n';
|
||||
texrow.newline();
|
||||
}
|
||||
lyxerr.debug(string("TeXEnvironment...done ")
|
||||
+ tostr(par), Error::LATEX);
|
||||
lyxerr[Debug::LATEX] << "TeXEnvironment...done " << par << endl;
|
||||
return par; // ale970302
|
||||
}
|
||||
|
||||
@ -3577,20 +3572,19 @@ LyXParagraph * LyXParagraph::TeXFootnote(string &file, TexRow &texrow,
|
||||
string &foot, TexRow &foot_texrow,
|
||||
int &foot_count)
|
||||
{
|
||||
lyxerr.debug(string("TeXFootnote... ")
|
||||
+ tostr(this), Error::LATEX);
|
||||
lyxerr[Debug::LATEX] << "TeXFootnote... " << this << endl;
|
||||
if (footnoteflag == LyXParagraph::NO_FOOTNOTE)
|
||||
lyxerr.print("ERROR (LyXParagraph::TeXFootnote): "
|
||||
"No footnote!");
|
||||
lyxerr << "ERROR (LyXParagraph::TeXFootnote): "
|
||||
"No footnote!" << endl;
|
||||
|
||||
LyXParagraph *par = this;
|
||||
LyXLayout * style = lyxstyle.Style(GetCurrentTextClass(),
|
||||
previous->GetLayout());
|
||||
|
||||
if (style->needprotect && footnotekind != LyXParagraph::FOOTNOTE){
|
||||
lyxerr.print("ERROR (LyXParagraph::TeXFootnote): "
|
||||
"Float other than footnote in command"
|
||||
" with moving argument is illegal");
|
||||
lyxerr << "ERROR (LyXParagraph::TeXFootnote): "
|
||||
"Float other than footnote in command"
|
||||
" with moving argument is illegal" << endl;
|
||||
}
|
||||
|
||||
if (footnotekind != LyXParagraph::FOOTNOTE
|
||||
@ -3702,7 +3696,8 @@ LyXParagraph * LyXParagraph::TeXFootnote(string &file, TexRow &texrow,
|
||||
LyXLayout *style = lyxstyle.Style(GetCurrentTextClass(),
|
||||
par->layout);
|
||||
if (par->IsDummy())
|
||||
lyxerr.print("ERROR (LyXParagraph::TeXFootnote)");
|
||||
lyxerr << "ERROR (LyXParagraph::TeXFootnote)"
|
||||
<< endl;
|
||||
if (style->isEnvironment()
|
||||
|| par->pextra_type == PEXTRA_MINIPAGE) { /* && !minipage_open ?? */
|
||||
// Allows the use of minipages within float environments.
|
||||
@ -3734,7 +3729,8 @@ LyXParagraph * LyXParagraph::TeXFootnote(string &file, TexRow &texrow,
|
||||
LyXLayout *style = lyxstyle.Style(GetCurrentTextClass(),
|
||||
par->layout);
|
||||
if (par->IsDummy())
|
||||
lyxerr.print("ERROR (LyXParagraph::TeXFootnote)");
|
||||
lyxerr << "ERROR (LyXParagraph::TeXFootnote)"
|
||||
<< endl;
|
||||
if (style->isEnvironment()
|
||||
|| par->pextra_type == PEXTRA_MINIPAGE) { /* && !minipage_open ?? */
|
||||
// Allows the use of minipages within float environments.
|
||||
@ -3756,8 +3752,9 @@ LyXParagraph * LyXParagraph::TeXFootnote(string &file, TexRow &texrow,
|
||||
}
|
||||
} while (par && par->footnoteflag != LyXParagraph::NO_FOOTNOTE);
|
||||
if (dummy_count) {
|
||||
lyxerr.print("ERROR (LyXParagraph::TeXFootnote): "
|
||||
"Footnote in a Footnote -- not supported");
|
||||
lyxerr << "ERROR (LyXParagraph::TeXFootnote): "
|
||||
"Footnote in a Footnote -- not supported"
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
|
||||
@ -3806,8 +3803,7 @@ LyXParagraph * LyXParagraph::TeXFootnote(string &file, TexRow &texrow,
|
||||
texrow.newline();
|
||||
}
|
||||
|
||||
lyxerr.debug(string("TeXFootnote...done ") +
|
||||
tostr(par->next), Error::LATEX);
|
||||
lyxerr[Debug::LATEX] << "TeXFootnote...done " << par->next << endl;
|
||||
return par;
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
#include "pathstack.h"
|
||||
#include "support/filetools.h"
|
||||
#include "error.h"
|
||||
#include "debug.h"
|
||||
#include "LString.h"
|
||||
#include "gettext.h"
|
||||
|
||||
@ -51,7 +51,7 @@ int PathStack::PathPush(string const & Path)
|
||||
return 2;
|
||||
}
|
||||
|
||||
lyxerr.debug("PathPush: " + Path);
|
||||
lyxerr.debug() << "PathPush: " << Path << endl;
|
||||
// adds new node
|
||||
NewNode = new PathStack(CurrentPath);
|
||||
NewNode->Next = Next;
|
||||
@ -78,7 +78,7 @@ int PathStack::PathPop()
|
||||
Path);
|
||||
Result = 2;
|
||||
}
|
||||
lyxerr.debug("PathPop: " + OldNode->Path);
|
||||
lyxerr.debug() << "PathPop: " << OldNode->Path << endl;
|
||||
delete OldNode;
|
||||
|
||||
return Result;
|
||||
|
@ -14,7 +14,6 @@
|
||||
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <csignal>
|
||||
@ -47,6 +46,8 @@
|
||||
#include "BufferView.h"
|
||||
#include "gettext.h"
|
||||
#include "lyx_gui_misc.h"
|
||||
#include "debug.h"
|
||||
#include "support/lstrings.h"
|
||||
|
||||
extern LyXRC *lyxrc;
|
||||
extern BufferView *current_view;
|
||||
@ -233,17 +234,19 @@ void create_ispell_pipe(string const & lang)
|
||||
isp_pid = -1;
|
||||
|
||||
if(pipe(pipein)==-1 || pipe(pipeout)==-1) {
|
||||
fprintf(stderr,"LyX: Can't create pipe for spellchecker!");
|
||||
lyxerr << "LyX: Can't create pipe for spellchecker!" << endl;
|
||||
return;
|
||||
}
|
||||
|
||||
if ((out = fdopen(pipein[1], "w"))==0) {
|
||||
fprintf(stderr,"LyX: Can't create stream for pipe for spellchecker!");
|
||||
lyxerr << "LyX: Can't create stream for pipe for spellchecker!"
|
||||
<< endl;
|
||||
return;
|
||||
}
|
||||
|
||||
if ((in = fdopen(pipeout[0], "r"))==0) {
|
||||
fprintf(stderr,"LyX: Can't create stream for pipe for spellchecker!");
|
||||
lyxerr <<"LyX: Can't create stream for pipe for spellchecker!"
|
||||
<< endl;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -254,7 +257,8 @@ void create_ispell_pipe(string const & lang)
|
||||
isp_pid = fork();
|
||||
|
||||
if(isp_pid==-1) {
|
||||
fprintf(stderr,"LyX: Can't create child process for spellchecker!");
|
||||
lyxerr << "LyX: Can't create child process for spellchecker!"
|
||||
<< endl;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -340,7 +344,7 @@ void create_ispell_pipe(string const & lang)
|
||||
for (int i=0; i < argc -1; i++)
|
||||
delete[] argv[i];
|
||||
|
||||
fprintf(stderr, "LyX: Failed to start ispell!\n");
|
||||
lyxerr << "LyX: Failed to start ispell!" << endl;
|
||||
_exit(0);
|
||||
}
|
||||
|
||||
@ -382,7 +386,7 @@ void create_ispell_pipe(string const & lang)
|
||||
|
||||
} else if (retval == 0) {
|
||||
// timeout. Give nice message to user.
|
||||
fprintf(stderr, "Ispell read timed out, what now?\n");
|
||||
lyxerr << "Ispell read timed out, what now?" << endl;
|
||||
#ifdef WITH_WARNINGS
|
||||
#warning Is this the correct thing to do?
|
||||
#endif
|
||||
@ -392,7 +396,7 @@ void create_ispell_pipe(string const & lang)
|
||||
isp_fd = -1;
|
||||
} else {
|
||||
// Select returned error
|
||||
fprintf(stderr, "Select on ispell returned error, what now?\n");
|
||||
lyxerr << "Select on ispell returned error, what now?" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
@ -767,7 +771,7 @@ bool RunSpellChecker(string const & lang)
|
||||
if(isp_pid!=-1) {
|
||||
ispell_terminate();
|
||||
string word_msg;
|
||||
word_msg += int(word_count);
|
||||
word_msg += tostr(word_count);
|
||||
if (word_count != 1) {
|
||||
word_msg += _(" words checked.");
|
||||
} else {
|
||||
|
262
src/support/DebugStream.C
Normal file
262
src/support/DebugStream.C
Normal file
@ -0,0 +1,262 @@
|
||||
// Created by Lars Gullik Bjønnes
|
||||
// Copyright 1999 Lars Gullik Bjønnes (larsbj@lyx.org)
|
||||
// Released into the public domain.
|
||||
|
||||
// Primarily developed for use in the LyX Project http://www.lyx.org/
|
||||
// but should be adaptable to any project.
|
||||
|
||||
//#define TEST_DEBUGSTREAM
|
||||
//#define MODERN_STL
|
||||
|
||||
//#include "DebugStream.h"
|
||||
#include "debug.h"
|
||||
|
||||
// Since the current C++ lib in egcs does not have a standard implementation
|
||||
// of basic_streambuf and basic_filebuf we don't have to include this
|
||||
// header.
|
||||
#ifdef MODERN_STL
|
||||
#include <fstream>
|
||||
#endif
|
||||
|
||||
ostream & operator<<(ostream & o, Debug::type t)
|
||||
{
|
||||
return o << int(t);
|
||||
}
|
||||
|
||||
/** This is a streambuffer that never prints out anything, at least
|
||||
that is the intention. You can call it a no-op streambuffer, and
|
||||
the ostream that uses it will be a no-op stream.
|
||||
*/
|
||||
class nullbuf : public std::streambuf {
|
||||
protected:
|
||||
///
|
||||
virtual int sync() { return 0; }
|
||||
///
|
||||
virtual std::streamsize xsputn(char const *, std::streamsize n) {
|
||||
// fakes a purge of the buffer by returning n
|
||||
return n;
|
||||
}
|
||||
///
|
||||
virtual int overflow(int c = EOF) {
|
||||
// fakes success by returning c
|
||||
return c == EOF ? ' ' : c;
|
||||
}
|
||||
};
|
||||
|
||||
/** A streambuf that sends the output to two different streambufs. These
|
||||
can be any kind of streambufs.
|
||||
*/
|
||||
class teebuf : public std::streambuf {
|
||||
public:
|
||||
///
|
||||
teebuf(std::streambuf * b1, std::streambuf * b2)
|
||||
: std::streambuf(), sb1(b1), sb2(b2) {}
|
||||
protected:
|
||||
///
|
||||
virtual int sync() {
|
||||
#ifdef MODERN_STL
|
||||
sb2->pubsync();
|
||||
return sb1->pubsync();
|
||||
#else
|
||||
sb2->sync();
|
||||
return sb1->sync();
|
||||
#endif
|
||||
}
|
||||
///
|
||||
virtual std::streamsize xsputn(char const * p, std::streamsize n) {
|
||||
#ifdef MODERN_STL
|
||||
sb2->sputn(p, n);
|
||||
return sb1->sputn(p, n);
|
||||
#else
|
||||
sb2->xsputn(p, n);
|
||||
return sb1->xsputn(p, n);
|
||||
#endif
|
||||
}
|
||||
///
|
||||
virtual int overflow(int c = EOF) {
|
||||
#ifdef MODERN_STL
|
||||
sb2->sputc(c);
|
||||
return sb1->sputc(c);
|
||||
#else
|
||||
sb2->overflow(c);
|
||||
return sb1->overflow(c);
|
||||
#endif
|
||||
}
|
||||
private:
|
||||
///
|
||||
std::streambuf * sb1;
|
||||
///
|
||||
std::streambuf * sb2;
|
||||
};
|
||||
|
||||
///
|
||||
class debugbuf : public std::streambuf {
|
||||
public:
|
||||
///
|
||||
debugbuf(std::streambuf * b)
|
||||
: std::streambuf(), sb(b) {}
|
||||
protected:
|
||||
///
|
||||
virtual int sync() {
|
||||
#ifdef MODERN_STL
|
||||
return sb->pubsync();
|
||||
#else
|
||||
return sb->sync();
|
||||
#endif
|
||||
}
|
||||
///
|
||||
virtual std::streamsize xsputn(char const * p, std::streamsize n) {
|
||||
#ifdef MODERN_STL
|
||||
return sb->sputn(p, n);
|
||||
#else
|
||||
return sb->xsputn(p, n);
|
||||
#endif
|
||||
}
|
||||
///
|
||||
virtual int overflow(int c = EOF) {
|
||||
#ifdef MODERN_STL
|
||||
return sb->sputc(c);
|
||||
#else
|
||||
return sb->overflow(c);
|
||||
#endif
|
||||
}
|
||||
private:
|
||||
///
|
||||
std::streambuf * sb;
|
||||
};
|
||||
|
||||
/// So that public parts of DebugStream does not need to know about filebuf
|
||||
struct DebugStream::debugstream_internal {
|
||||
/// Used when logging to file.
|
||||
std::filebuf fbuf;
|
||||
};
|
||||
|
||||
/// Constructor, sets the debug level to t.
|
||||
DebugStream::DebugStream(Debug::type t)
|
||||
: std::ostream(new debugbuf(std::cerr.rdbuf())),
|
||||
dt(t), nullstream(new nullbuf), internal(0) {}
|
||||
|
||||
|
||||
/// Constructor, sets the log file to f, and the debug level to t.
|
||||
DebugStream::DebugStream(char const * f, Debug::type t)
|
||||
: std::ostream(new debugbuf(std::cerr.rdbuf())),
|
||||
dt(t), nullstream(new nullbuf),
|
||||
internal(new debugstream_internal)
|
||||
{
|
||||
internal->fbuf.open(f, std::ios::out|std::ios::app);
|
||||
delete rdbuf(new teebuf(std::cerr.rdbuf(),
|
||||
&internal->fbuf));
|
||||
}
|
||||
|
||||
|
||||
DebugStream::~DebugStream()
|
||||
{
|
||||
delete nullstream.rdbuf(0); // Without this we leak
|
||||
delete rdbuf(0); // Without this we leak
|
||||
if (internal)
|
||||
delete internal;
|
||||
}
|
||||
|
||||
/// Sets the debugstreams' logfile to f.
|
||||
void DebugStream::logFile(char const * f)
|
||||
{
|
||||
if (internal) {
|
||||
internal->fbuf.close();
|
||||
} else {
|
||||
internal = new debugstream_internal;
|
||||
}
|
||||
internal->fbuf.open(f, std::ios::out|std::ios::app);
|
||||
delete rdbuf(new teebuf(std::cerr.rdbuf(),
|
||||
&internal->fbuf));
|
||||
}
|
||||
|
||||
|
||||
#ifdef TEST_DEBUGSTREAM
|
||||
|
||||
// Example debug stream
|
||||
DebugStream debugstream;
|
||||
|
||||
int main(int, char **)
|
||||
{
|
||||
/**
|
||||
I have been running some tests on this to see how much overhead
|
||||
this kind of permanent debug code has. My conclusion is: not
|
||||
much. In all, but the most time critical code, this will have
|
||||
close to no impact at all.
|
||||
|
||||
In the tests that I have run the use of
|
||||
if (debugstream.debugging(DebugStream::INFO))
|
||||
debugstream << "some debug\n";
|
||||
has close to no overhead when the debug level is not
|
||||
DebugStream::INFO.
|
||||
|
||||
The overhead for
|
||||
debugstream.debug(DebugStream::INFO) << "some debug\n";
|
||||
is also very small when the debug level is not
|
||||
DebugStream::INFO. However the overhead for this will increase
|
||||
if complex debugging information is output.
|
||||
|
||||
The overhead when the debug level is DebugStream::INFO can be
|
||||
significant, but since we then are running in debug mode it is
|
||||
of no concern.
|
||||
|
||||
Why should we use this instead of the class Error that we already
|
||||
have? First of all it uses C++ iostream and constructs, secondly
|
||||
it will be a lot easier to output the debug info that we need
|
||||
without a lot of manual conversions, thirdly we can now use
|
||||
iomanipulators and the complete iostream formatting functions.
|
||||
pluss it will work for all types that have a operator<<
|
||||
defined, and can be used in functors that take a ostream & as
|
||||
parameter. And there should be less need for temporary objects.
|
||||
And one nice bonus is that we get a log file almost for
|
||||
free.
|
||||
|
||||
Some of the names are of course open to modifications. I will try
|
||||
to use the names we already use in LyX.
|
||||
*/
|
||||
// Just a few simple debugs to show how it can work.
|
||||
debugstream << "Debug level set to Debug::NONE\n";
|
||||
if (debugstream.debugging()) {
|
||||
debugstream << "Something must be debugged\n";
|
||||
}
|
||||
debugstream.debug(Debug::WARN) << "more debug(WARN)\n";
|
||||
debugstream.debug(Debug::INFO) << "even more debug(INFO)\n";
|
||||
debugstream.debug(Debug::CRIT) << "even more debug(CRIT)\n";
|
||||
debugstream.level(Debug::value("INFO"));
|
||||
debugstream << "Setting debug level to Debug::INFO\n";
|
||||
if (debugstream.debugging()) {
|
||||
debugstream << "Something must be debugged\n";
|
||||
}
|
||||
debugstream.debug(Debug::WARN) << "more debug(WARN)\n";
|
||||
debugstream.debug(Debug::INFO) << "even more debug(INFO)\n";
|
||||
debugstream.debug(Debug::CRIT) << "even more debug(CRIT)\n";
|
||||
debugstream.addLevel(Debug::type(Debug::CRIT |
|
||||
Debug::WARN));
|
||||
debugstream << "Adding Debug::CRIT and Debug::WARN\n";
|
||||
debugstream[Debug::WARN] << "more debug(WARN)\n";
|
||||
debugstream[Debug::INFO] << "even more debug(INFO)\n";
|
||||
debugstream[Debug::CRIT] << "even more debug(CRIT)\n";
|
||||
debugstream.delLevel(Debug::INFO);
|
||||
debugstream << "Removing Debug::INFO\n";
|
||||
debugstream[Debug::WARN] << "more debug(WARN)\n";
|
||||
debugstream[Debug::INFO] << "even more debug(INFO)\n";
|
||||
debugstream[Debug::CRIT] << "even more debug(CRIT)\n";
|
||||
debugstream.logFile("logfile");
|
||||
debugstream << "Setting logfile to \"logfile\"\n";
|
||||
debugstream << "Value: " << 123 << " " << "12\n";
|
||||
int i = 0;
|
||||
int * p = new int;
|
||||
// note: the (void*) is needed on g++ 2.7.x since it does not
|
||||
// support partial specialization. In egcs this should not be
|
||||
// needed.
|
||||
debugstream << "automatic " << &i
|
||||
<< ", free store " << p << std::endl;
|
||||
delete p;
|
||||
/*
|
||||
for (int j = 0; j < 200000; ++j) {
|
||||
DebugStream tmp;
|
||||
tmp << "Test" << std::endl;
|
||||
}
|
||||
*/
|
||||
}
|
||||
#endif
|
160
src/support/DebugStream.h
Normal file
160
src/support/DebugStream.h
Normal file
@ -0,0 +1,160 @@
|
||||
// -*- C++ -*-
|
||||
|
||||
// Created by Lars Gullik Bjønnes
|
||||
// Copyright 1999 Lars Gullik Bjønnes (larsbj@lyx.org)
|
||||
// Released under the Gnu General Public License
|
||||
|
||||
// Implemented and tested on g++ 2.7.2.3
|
||||
|
||||
// Primarily developed for use in the LyX Project http://www.lyx.org/
|
||||
// but should be adaptable to any project.
|
||||
|
||||
#ifndef DEBUGSTREAM_H
|
||||
#define DEBUGSTREAM_H
|
||||
|
||||
#ifdef _STANDARD_C_PLUS_PLUS
|
||||
#define MODERN_STL
|
||||
#endif
|
||||
|
||||
#ifdef MODERN_STL
|
||||
#include <ostream>
|
||||
#else
|
||||
#include <iostream>
|
||||
#endif
|
||||
|
||||
#ifdef TEST_DEBUGSTREAM
|
||||
#include <string>
|
||||
struct Debug {
|
||||
///
|
||||
enum type {
|
||||
///
|
||||
NONE = 0,
|
||||
///
|
||||
INFO = (1 << 0), // 1
|
||||
///
|
||||
WARN = (1 << 1), // 2
|
||||
///
|
||||
CRIT = (1 << 2) // 4
|
||||
};
|
||||
///
|
||||
static const type ANY = type(INFO | WARN | CRIT);
|
||||
|
||||
/** A function to convert symbolic string names on debug levels
|
||||
to their numerical value.
|
||||
*/
|
||||
static Debug::type value(std::string const & val) {
|
||||
if (val == "NONE") return Debug::NONE;
|
||||
if (val == "INFO") return Debug::INFO;
|
||||
if (val == "WARN") return Debug::WARN;
|
||||
if (val == "CRIT") return Debug::CRIT;
|
||||
return Debug::NONE;
|
||||
}
|
||||
|
||||
};
|
||||
#endif
|
||||
|
||||
/** DebugStream is a ostream intended for debug output. It has also support
|
||||
for a logfile. Debug output is output to cerr and if the logfile is set,
|
||||
to the logfile.
|
||||
|
||||
Example of Usage:
|
||||
DebugStream debug;
|
||||
debug.level(Debug::INFO);
|
||||
debug.debug(Debug::WARN) << "WARN\n";
|
||||
debug[Debug::INFO] << "INFO\n";
|
||||
debug << "Always\n";
|
||||
|
||||
Will output:
|
||||
INFO
|
||||
Always
|
||||
|
||||
If you want to have debug output from time critical code you should
|
||||
use this construct:
|
||||
if (debug.debugging(Debug::INFO)) {
|
||||
debug << "...debug output...\n";
|
||||
}
|
||||
|
||||
To give debug info even if no debug (NONE) is requested:
|
||||
debug << "... always output ...\n";
|
||||
|
||||
To give debug output regardless of what debug level is set (!NONE):
|
||||
debug.debug() << "...on debug output...\n";
|
||||
debug[Debug::ANY] << "...on debug output...\n";
|
||||
|
||||
To give debug output when a specific debug level is set (INFO):
|
||||
debug.debug(Debug::INFO) << "...info...\n";
|
||||
debug[Debug::INFO] << "...info...\n";
|
||||
|
||||
To give debug output when either on of debug levels is set (INFO or CRIT):
|
||||
debug.debug(Debug::type(Debug::INFO | Debug::CRIT)) << "...info/crit...\n";
|
||||
debug[Debug::type(Debug::INFO | Debug::CRIT)] << "...info/crit...\n";
|
||||
|
||||
*/
|
||||
class DebugStream : public std::ostream {
|
||||
public:
|
||||
/// Constructor, sets the debug level to t.
|
||||
DebugStream(Debug::type t = Debug::NONE);
|
||||
|
||||
/// Constructor, sets the log file to f, and the debug level to t.
|
||||
DebugStream(char const * f, Debug::type t = Debug::NONE);
|
||||
|
||||
///
|
||||
virtual ~DebugStream();
|
||||
|
||||
/// Sets the debug level to t.
|
||||
void level(Debug::type t) {
|
||||
dt = Debug::type(t & Debug::ANY);
|
||||
}
|
||||
|
||||
/// Returns the current debug level.
|
||||
Debug::type level() const {
|
||||
return dt;
|
||||
}
|
||||
|
||||
/// Adds t to the current debug level.
|
||||
void addLevel(Debug::type t) {
|
||||
dt = Debug::type(dt | t);
|
||||
}
|
||||
|
||||
/// Deletes t from the current debug level.
|
||||
void delLevel(Debug::type t) {
|
||||
dt = Debug::type(dt & ~t);
|
||||
}
|
||||
|
||||
/// Sets the debugstreams' logfile to f.
|
||||
void logFile(char const * f);
|
||||
|
||||
/// Returns true if t is part of the current debug level.
|
||||
bool debugging(Debug::type t = Debug::ANY) const
|
||||
{
|
||||
if (dt & t) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/** Returns the no-op stream if t is not part of the
|
||||
current debug level otherwise the real debug stream
|
||||
is used.
|
||||
*/
|
||||
std::ostream & debug(Debug::type t = Debug::ANY) {
|
||||
if (dt & t) return *this;
|
||||
return nullstream;
|
||||
}
|
||||
|
||||
|
||||
/** This is an operator to give a more convenient use:
|
||||
dbgstream[Debug::INFO] << "Info!\n";
|
||||
*/
|
||||
std::ostream & operator[](Debug::type t) {
|
||||
return debug(t);
|
||||
}
|
||||
private:
|
||||
/// The current debug level
|
||||
Debug::type dt;
|
||||
/// The no-op stream.
|
||||
std::ostream nullstream;
|
||||
struct debugstream_internal;
|
||||
debugstream_internal * internal;
|
||||
};
|
||||
|
||||
#endif
|
@ -4,6 +4,8 @@ libsupport_a_LIBADD = @LIBOBJS@
|
||||
ETAGS_ARGS = --c++
|
||||
INCLUDES = -I${srcdir}/../
|
||||
libsupport_a_SOURCES = \
|
||||
DebugStream.C \
|
||||
DebugStream.h \
|
||||
FileInfo.C \
|
||||
FileInfo.h \
|
||||
LAssert.h \
|
||||
|
@ -110,7 +110,7 @@ string TmpFileName(string const & dir, string const & mask)
|
||||
if (!fnfo.newFile(ret).exist())
|
||||
return ret;
|
||||
}
|
||||
lyxerr.print("Not able to find a uniq tmpfile name.");
|
||||
lyxerr << "Not able to find a uniq tmpfile name." << endl;
|
||||
return string();
|
||||
}
|
||||
|
||||
@ -351,7 +351,7 @@ int DeleteAllFilesInDir (string const & path)
|
||||
continue;
|
||||
string unlinkpath = AddName (path, temp);
|
||||
|
||||
lyxerr.debug("Deleting file: " + unlinkpath);
|
||||
lyxerr.debug() << "Deleting file: " << unlinkpath << endl;
|
||||
|
||||
if (remove (unlinkpath.c_str()))
|
||||
WriteFSAlert (_("Error! Could not remove file:"),
|
||||
@ -493,7 +493,7 @@ string OnlyPath(string const & Filename)
|
||||
string::size_type j = Filename.rfind('/');
|
||||
if (j==string::npos)
|
||||
return "./";
|
||||
return Filename.substr(0, j+1);
|
||||
return Filename.substr(0, j + 1);
|
||||
}
|
||||
|
||||
|
||||
@ -649,8 +649,6 @@ string ExpandPath(string const & path)
|
||||
// Can't handle "../../" or "/../" (Asger)
|
||||
string NormalizePath(string const & path)
|
||||
{
|
||||
Assert(!path.empty()); // We don't allow empty path. (Lgb)
|
||||
|
||||
string TempBase;
|
||||
string RTemp;
|
||||
string Temp;
|
||||
|
@ -1,7 +1,7 @@
|
||||
// -*- C++-*-
|
||||
/* lyx-filetool.h : tools functions for file/path handling
|
||||
this file is part of LyX, the High Level Word Processor
|
||||
copyright (C) 1995-1997, Matthias Ettrich and the LyX Team
|
||||
Copyright 1995-1999, Matthias Ettrich and the LyX Team
|
||||
*/
|
||||
|
||||
#ifndef LYX_FILETOOL_H
|
||||
@ -15,7 +15,7 @@
|
||||
#include <cstdlib>
|
||||
#include <fcntl.h>
|
||||
#include <cerrno>
|
||||
#include "error.h"
|
||||
#include "debug.h"
|
||||
#include "LString.h"
|
||||
#include "support/lstrings.h"
|
||||
|
||||
@ -102,7 +102,7 @@ private:
|
||||
switch(errno) {
|
||||
case EINVAL:
|
||||
// Internal LyX error.
|
||||
lyxerr.print("FilePtr: Wrong parameter given to fopen.");
|
||||
lyxerr << "FilePtr: Wrong parameter given to fopen." << endl;
|
||||
break;
|
||||
default:
|
||||
// unknown error
|
||||
|
@ -1,9 +1,9 @@
|
||||
#include <config.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <cctype>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
|
||||
#include "LString.h"
|
||||
#include "lstrings.h"
|
||||
|
@ -437,10 +437,15 @@ const_reference> const_reverse_iterator;
|
||||
|
||||
///
|
||||
lyxstring & replace(iterator i, iterator i2, iterator j, iterator j2);
|
||||
|
||||
|
||||
/// Erase n chars from position i.
|
||||
lyxstring & erase(size_type i = 0, size_type n = npos);
|
||||
|
||||
///
|
||||
lyxstring & clear() {
|
||||
return erase(0, npos);
|
||||
}
|
||||
|
||||
///
|
||||
iterator erase(iterator i);
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include <sys/wait.h>
|
||||
#include <cstdlib>
|
||||
#include <cstdio>
|
||||
#include "debug.h"
|
||||
#include <unistd.h>
|
||||
#include "syscall.h"
|
||||
#include "syscontr.h"
|
||||
@ -98,16 +99,19 @@ void Systemcalls::waitForChild()
|
||||
retval = WEXITSTATUS(status);
|
||||
wait = false;
|
||||
} else if (WIFSIGNALED(status)) {
|
||||
fprintf(stderr,"LyX: Child didn't catch signal %d "
|
||||
"and died. Too bad.\n", WTERMSIG(status));
|
||||
lyxerr << "LyX: Child didn't catch signal "
|
||||
<< WTERMSIG(status)
|
||||
<<" and died. Too bad." << endl;
|
||||
wait = false;
|
||||
} else if (WIFSTOPPED(status)) {
|
||||
fprintf(stderr,"LyX: Child (pid: %ld) stopped on "
|
||||
"signal %d. Waiting for child to finish.\n",
|
||||
(long) pid, WSTOPSIG(status));
|
||||
lyxerr << "LyX: Child (pid: " << pid
|
||||
<< ") stopped on signal "
|
||||
<< WSTOPSIG(status)
|
||||
<< ". Waiting for child to finish." << endl;
|
||||
} else {
|
||||
fprintf(stderr,"LyX: Something rotten happened while "
|
||||
"waiting for child %ld\n", (long) pid);
|
||||
lyxerr << "LyX: Something rotten happened while "
|
||||
"waiting for child "
|
||||
<< pid << endl;
|
||||
wait = false;
|
||||
}
|
||||
}
|
||||
|
@ -4,9 +4,9 @@
|
||||
* LyX, The Document Processor
|
||||
*
|
||||
* Copyright (C) 1995 Matthias Ettrich
|
||||
* Copyright (C) 1995-1998 The LyX Team.
|
||||
* Copyright (C) 1995-1999 The LyX Team.
|
||||
*
|
||||
*======================================================*/
|
||||
* ======================================================*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
|
||||
#include "texrow.h"
|
||||
#include "lyxparagraph.h"
|
||||
#include "error.h"
|
||||
#include "debug.h"
|
||||
|
||||
// Delete linked list
|
||||
void TexRow::reset()
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "buffer.h"
|
||||
#include "lyxscreen.h"
|
||||
#include "minibuffer.h"
|
||||
#include "debug.h"
|
||||
|
||||
static const int LYX_PAPER_MARGIN = 20;
|
||||
|
||||
@ -513,8 +514,7 @@ int LyXText::RightMargin(Row *row)
|
||||
}
|
||||
}
|
||||
|
||||
//fprintf(stderr,"rightmargin: %s\n", layout->rightmargin.c_str());
|
||||
//fflush(stderr);
|
||||
//lyxerr << "rightmargin: " << layout->rightmargin << endl;
|
||||
x += (lyxstyle.TextClass(parameters->textclass)->defaultfont.signedStringWidth(layout->rightmargin) * 4
|
||||
/ (row->par->GetDepth() + 4));
|
||||
return x;
|
||||
@ -3255,8 +3255,7 @@ void LyXText::GetVisibleRow(LyXScreen &scr, int offset,
|
||||
LyXFont font;
|
||||
int maxdesc;
|
||||
if (row_ptr->height <= 0) {
|
||||
fprintf(stderr, "LYX_ERROR: row.height: %d \n",
|
||||
row_ptr->height);
|
||||
lyxerr << "LYX_ERROR: row.height: " << row_ptr->height << endl;
|
||||
return;
|
||||
}
|
||||
left_margin = LabelEnd(row_ptr);
|
||||
|
16
src/text2.C
16
src/text2.C
@ -1,12 +1,12 @@
|
||||
/* This file is part of
|
||||
* ======================================================
|
||||
*
|
||||
* LyX, The Document Processor
|
||||
*
|
||||
* Copyright (C) 1995 Matthias Ettrich
|
||||
* Copyright (C) 1995-1998 The LyX Team.
|
||||
*
|
||||
*======================================================*/
|
||||
* ======================================================
|
||||
*
|
||||
* LyX, The Document Processor
|
||||
*
|
||||
* Copyright 1995 Matthias Ettrich
|
||||
* Copyright 1995-1999 The LyX Team.
|
||||
*
|
||||
* ======================================================*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
|
@ -1,15 +1,15 @@
|
||||
/* This file is part of
|
||||
* ======================================================
|
||||
*
|
||||
* LyX, The Document Processor
|
||||
*
|
||||
* Copyright (C) 1995 Matthias Ettrich
|
||||
* Copyright (C) 1995-1998 The LyX Team.
|
||||
*
|
||||
* This file is Copyright 1996-1998
|
||||
* Lars Gullik Bjønnes
|
||||
*
|
||||
*======================================================*/
|
||||
* ======================================================
|
||||
*
|
||||
* LyX, The Document Processor
|
||||
*
|
||||
* Copyright 1995 Matthias Ettrich
|
||||
* Copyright 1995-1999 The LyX Team.
|
||||
*
|
||||
* This file is Copyright 1996-1998
|
||||
* Lars Gullik Bjønnes
|
||||
*
|
||||
* ======================================================*/
|
||||
|
||||
// Added pseudo-action handling, asierra 180296
|
||||
|
||||
@ -25,7 +25,7 @@
|
||||
#include "toolbar.h"
|
||||
#include "lyxfunc.h"
|
||||
#include "lyxlex.h"
|
||||
#include "error.h"
|
||||
#include "debug.h"
|
||||
#include "combox.h"
|
||||
#include "lyx_cb.h"
|
||||
#include "LyXView.h"
|
||||
@ -127,8 +127,8 @@ Toolbar::Toolbar(Toolbar const &rct, LyXView *o, int x, int y)
|
||||
toolbarItem *tmplist = rct.toollist;
|
||||
while (tmplist != 0) {
|
||||
add(tmplist->action);
|
||||
lyxerr.debug(string("tool action: ") + tostr(tmplist->action),
|
||||
Error::TOOLBAR);
|
||||
lyxerr[Debug::TOOLBAR] << "tool action: "
|
||||
<< tmplist->action << endl;
|
||||
tmplist=tmplist->next;
|
||||
}
|
||||
}
|
||||
@ -197,7 +197,7 @@ void Toolbar::ToolbarCB(FL_OBJECT *ob, long ac)
|
||||
|
||||
string res = t->owner->getLyXFunc()->Dispatch(int(ac));
|
||||
if(!res.empty())
|
||||
lyxerr.debug(res, Error::TOOLBAR);
|
||||
lyxerr[Debug::TOOLBAR] << res << endl;
|
||||
}
|
||||
|
||||
|
||||
@ -424,7 +424,7 @@ void Toolbar::add(int action, bool doclean)
|
||||
if (!doclean && owner) {
|
||||
// first «hide» the toolbar buttons. This is not a real hide
|
||||
// actually it deletes and frees the button altogether.
|
||||
lyxerr.print("Toolbar::add: «hide» the toolbar buttons.");
|
||||
lyxerr << "Toolbar::add: «hide» the toolbar buttons." << endl;
|
||||
toolbarItem *item, *tmp=0;
|
||||
item = toollist;
|
||||
|
||||
@ -461,7 +461,7 @@ void Toolbar::add(int action, bool doclean)
|
||||
help = lyxaction.helpText(act);
|
||||
help += " ";
|
||||
help += arg;
|
||||
lyxerr.debug(string("Pseudo action ") + tostr(action));
|
||||
lyxerr.debug() << "Pseudo action " << action << endl;
|
||||
} else {
|
||||
pixmap = getPixmap((kb_action)action);
|
||||
help = lyxaction.helpText((kb_action)action);
|
||||
@ -497,8 +497,8 @@ void Toolbar::add(string const & func, bool doclean)
|
||||
int tf = lyxaction.LookupFunc(func.c_str());
|
||||
|
||||
if (tf == -1){
|
||||
lyxerr.print("Toolbar::add: no LyX command called`"
|
||||
+func+"'exists!");
|
||||
lyxerr << "Toolbar::add: no LyX command called`"
|
||||
<< func << "'exists!" << endl;
|
||||
} else {
|
||||
add(tf, doclean);
|
||||
}
|
||||
@ -520,22 +520,22 @@ void Toolbar::clean()
|
||||
delete item;
|
||||
item = tmp;
|
||||
}
|
||||
//lyxerr.print(string("Combox: ") + int(combox));
|
||||
lyxerr[Debug::TOOLBAR] << "Combox: " << combox << endl;
|
||||
if (combox) {
|
||||
delete combox;
|
||||
combox = 0;
|
||||
}
|
||||
if (owner)
|
||||
fl_unfreeze_form(owner->getForm());
|
||||
lyxerr.debug("toolbar cleaned",Error::TOOLBAR);
|
||||
lyxerr[Debug::TOOLBAR] << "toolbar cleaned" << endl;
|
||||
cleaned = true;
|
||||
}
|
||||
|
||||
|
||||
void Toolbar::push(int nth)
|
||||
{
|
||||
lyxerr.debug(string("Toolbar::push: trying to trigger no `")+ tostr(nth)+'\'',
|
||||
Error::TOOLBAR);
|
||||
lyxerr[Debug::TOOLBAR] << "Toolbar::push: trying to trigger no `"
|
||||
<< nth << '\'' << endl;
|
||||
|
||||
if (nth == 0) return;
|
||||
|
||||
@ -558,8 +558,8 @@ void Toolbar::read(LyXLex &lex)
|
||||
{
|
||||
//consistency check
|
||||
if (lex.GetString() != "\\begin_toolbar")
|
||||
lyxerr.print("Toolbar::read: ERROR wrong token:`"
|
||||
+lex.GetString()+'\'');
|
||||
lyxerr << "Toolbar::read: ERROR wrong token:`"
|
||||
<< lex.GetString() << '\'' << endl;
|
||||
|
||||
clean();
|
||||
string func;
|
||||
@ -567,20 +567,21 @@ void Toolbar::read(LyXLex &lex)
|
||||
|
||||
lex.pushTable(toolTags, TO_LAST - 1);
|
||||
|
||||
if (lyxerr.debugging(Error::LEX_PARSER))
|
||||
if (lyxerr.debugging(Debug::PARSER))
|
||||
lex.printTable();
|
||||
|
||||
while (lex.IsOK() && !quit) {
|
||||
|
||||
lyxerr.debug("Toolbar::read: current lex text: `"
|
||||
+lex.GetString()+'\'',Error::TOOLBAR);
|
||||
lyxerr[Debug::TOOLBAR] << "Toolbar::read: current lex text: `"
|
||||
<< lex.GetString() << '\'' << endl;
|
||||
|
||||
switch(lex.lex()) {
|
||||
case TO_ADD:
|
||||
if (lex.EatLine()) {
|
||||
func = lex.GetString();
|
||||
lyxerr.debug("Toolbar::read TO_ADD func: `"
|
||||
+ func + "'", Error::TOOLBAR);
|
||||
lyxerr[Debug::TOOLBAR]
|
||||
<< "Toolbar::read TO_ADD func: `"
|
||||
<< func << "'" << endl;
|
||||
add(func);
|
||||
}
|
||||
break;
|
||||
|
80
src/trans.C
80
src/trans.C
@ -1,6 +1,6 @@
|
||||
#include <config.h>
|
||||
|
||||
#include <cstdio>
|
||||
//#include <cstdio>
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "trans.h"
|
||||
@ -11,7 +11,7 @@
|
||||
#include "support/filetools.h"
|
||||
#include "tex-strings.h"
|
||||
#include "lyxlex.h"
|
||||
#include "error.h"
|
||||
#include "debug.h"
|
||||
#include "trans_mgr.h"
|
||||
|
||||
|
||||
@ -198,19 +198,21 @@ int Trans::Load(LyXLex &lex)
|
||||
switch(lex.lex()) {
|
||||
case KMOD:
|
||||
{
|
||||
if (lyxerr.debugging(Error::KBMAP))
|
||||
fprintf(stderr,"KMOD: %s\n",lex.text());
|
||||
if (lyxerr.debugging(Debug::KBMAP))
|
||||
lyxerr << "KMOD:\t" << lex.text() << endl;
|
||||
if (lex.next(true)) {
|
||||
if (lyxerr.debugging(Error::KBMAP))
|
||||
fprintf(stderr, "key `%s'\n", lex.text());
|
||||
if (lyxerr.debugging(Debug::KBMAP))
|
||||
lyxerr << "key\t`" << lex.text()
|
||||
<< "'" << endl;
|
||||
} else
|
||||
return -1;
|
||||
|
||||
string keys = lex.GetString();
|
||||
|
||||
if (lex.next(true)) {
|
||||
if ( lyxerr.debugging(Error::KBMAP))
|
||||
fprintf(stderr, "accent `%s'\n", lex.text());
|
||||
if ( lyxerr.debugging(Debug::KBMAP))
|
||||
lyxerr << "accent\t`" << lex.text()
|
||||
<< "'" << endl;
|
||||
} else
|
||||
return -1;
|
||||
|
||||
@ -220,10 +222,9 @@ int Trans::Load(LyXLex &lex)
|
||||
return -1;
|
||||
|
||||
if (lex.next(true)) {
|
||||
if (lyxerr.debugging(Error::KBMAP))
|
||||
fprintf(stderr,
|
||||
"allowed `%s'\n",
|
||||
lex.text());
|
||||
if (lyxerr.debugging(Debug::KBMAP))
|
||||
lyxerr << "allowed\t`" << lex.text()
|
||||
<< "'" << endl;
|
||||
} else
|
||||
return -1;
|
||||
|
||||
@ -235,10 +236,10 @@ int Trans::Load(LyXLex &lex)
|
||||
case KCOMB: {
|
||||
const char *str;
|
||||
|
||||
lyxerr.debug("KCOMB:",Error::KBMAP);
|
||||
lyxerr[Debug::KBMAP] << "KCOMB:" << endl;
|
||||
if (lex.next(true)) {
|
||||
str=lex.text();
|
||||
lyxerr.debug(str,Error::KBMAP);
|
||||
lyxerr[Debug::KBMAP] << str << endl;
|
||||
} else
|
||||
return -1;
|
||||
|
||||
@ -247,7 +248,7 @@ int Trans::Load(LyXLex &lex)
|
||||
|
||||
if (lex.next(true)) {
|
||||
str=lex.text();
|
||||
lyxerr.debug(str,Error::KBMAP);
|
||||
lyxerr[Debug::KBMAP] << str << endl;
|
||||
} else
|
||||
return -1;
|
||||
|
||||
@ -268,7 +269,8 @@ int Trans::Load(LyXLex &lex)
|
||||
|
||||
if (lex.next()) {
|
||||
allowed=lex.GetString();
|
||||
lyxerr.debug("allowed: "+allowed,Error::KBMAP);
|
||||
lyxerr[Debug::KBMAP] << "allowed: "
|
||||
<< allowed << endl;
|
||||
} else
|
||||
return -1;
|
||||
|
||||
@ -279,12 +281,13 @@ int Trans::Load(LyXLex &lex)
|
||||
char key_from;
|
||||
char *string_to;
|
||||
|
||||
if (lyxerr.debugging(Error::KBMAP))
|
||||
fprintf(stderr, "KMAP: %s\n", lex.text());
|
||||
if (lyxerr.debugging(Debug::KBMAP))
|
||||
lyxerr << "KMAP:\t" << lex.text() << endl;
|
||||
if (lex.next(true)) {
|
||||
key_from=lex.text()[0];
|
||||
if (lyxerr.debugging(Error::KBMAP))
|
||||
fprintf(stderr, " `%s'\n", lex.text());
|
||||
if (lyxerr.debugging(Debug::KBMAP))
|
||||
lyxerr << "\t`" << lex.text() << "'"
|
||||
<< endl;
|
||||
} else
|
||||
return -1;
|
||||
|
||||
@ -292,8 +295,9 @@ int Trans::Load(LyXLex &lex)
|
||||
char const *t = lex.text();
|
||||
string_to = strcpy(new char[strlen(t)+1],t);
|
||||
keymap_[(unsigned char)key_from]=string_to;
|
||||
if (lyxerr.debugging(Error::KBMAP))
|
||||
fprintf(stderr, " `%s'\n", string_to);
|
||||
if (lyxerr.debugging(Debug::KBMAP))
|
||||
lyxerr << "\t`" << string_to << "'"
|
||||
<< endl;
|
||||
} else
|
||||
return -1;
|
||||
|
||||
@ -304,25 +308,28 @@ int Trans::Load(LyXLex &lex)
|
||||
char key;
|
||||
const char *str;
|
||||
|
||||
if (lyxerr.debugging(Error::KBMAP))
|
||||
fprintf(stderr, "KXMOD: %s\n", lex.text());
|
||||
if (lyxerr.debugging(Debug::KBMAP))
|
||||
lyxerr << "KXMOD:\t" << lex.text() << endl;
|
||||
if (lex.next(true)) {
|
||||
if (lyxerr.debugging(Error::KBMAP))
|
||||
fprintf(stderr, " `%s'\n", lex.text());
|
||||
if (lyxerr.debugging(Debug::KBMAP))
|
||||
lyxerr << "\t`" << lex.text() << "'"
|
||||
<< endl;
|
||||
accent = getkeymod(lex.GetString());
|
||||
} else
|
||||
return -1;
|
||||
|
||||
if (lex.next(true)) {
|
||||
if (lyxerr.debugging(Error::KBMAP))
|
||||
fprintf(stderr, " `%s'\n", lex.text());
|
||||
if (lyxerr.debugging(Debug::KBMAP))
|
||||
lyxerr << "\t`" << lex.text() << "'"
|
||||
<< endl;
|
||||
key=lex.text()[0];
|
||||
} else
|
||||
return -1;
|
||||
|
||||
if (lex.next(true)) {
|
||||
if (lyxerr.debugging(Error::KBMAP))
|
||||
fprintf(stderr, " `%s'\n", lex.text());
|
||||
if (lyxerr.debugging(Debug::KBMAP))
|
||||
lyxerr << "\t`" << lex.text() << "'"
|
||||
<< endl;
|
||||
str=lex.text();
|
||||
} else
|
||||
return -1;
|
||||
@ -331,7 +338,7 @@ int Trans::Load(LyXLex &lex)
|
||||
break;
|
||||
}
|
||||
case LyXLex::LEX_FEOF:
|
||||
lyxerr.debug("End of parsing",Error::LEX_PARSER);
|
||||
lyxerr[Debug::PARSER] << "End of parsing" << endl;
|
||||
break;
|
||||
default:
|
||||
lex.printError("ParseKeymapFile: "
|
||||
@ -393,13 +400,14 @@ tex_accent getkeymod(string const &p)
|
||||
/* return modifier - decoded from p and update p */
|
||||
{
|
||||
for (int i = 1; i <= TEX_MAX_ACCENT; i++) {
|
||||
if (lyxerr.debugging(Error::KBMAP))
|
||||
fprintf(stderr,
|
||||
"p = %s, lyx_accent_table[%d].name = `%s'\n",
|
||||
p.c_str(), i, lyx_accent_table[i].name);
|
||||
if (lyxerr.debugging(Debug::KBMAP))
|
||||
lyxerr << "p = " << p
|
||||
<< ", lyx_accent_table[" << i
|
||||
<<"].name = `" << lyx_accent_table[i].name
|
||||
<< "'" << endl;
|
||||
|
||||
if ( lyx_accent_table[i].name && contains(p, lyx_accent_table[i].name)) {
|
||||
lyxerr.debug("Found it!",Error::KBMAP);
|
||||
lyxerr[Debug::KBMAP] << "Found it!" << endl;
|
||||
return (tex_accent)i;
|
||||
}
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user