fix crossref label list, some debug messages + various

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@445 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2000-01-25 12:35:27 +00:00
parent 1813d44cad
commit 328f69b0c1
22 changed files with 121 additions and 90 deletions

View File

@ -1,3 +1,20 @@
2000-01-25 Lars Gullik Bjønnes <larsbj@lyx.org>
* several files: marked several lines with "DEL LINE", this is
lines that can be deleted without changing anything.
if (<ptr>) // DEL LINE /* this line is _never_ needed. Delete
checks this anyway */
delete <ptr>
* src/insets/insetlatexaccent.C: Changed some debugs to Debug::KEY
* src/DepTable.C (update): add a "+" at the end when the checksum
is different. (debugging string only)
* src/paragraph.C (ReturnNextInsetPointer): fix bug that caused
the next inset to not be displayed. This should also fix the list
of labels in the "Insert Crossreference" dialog.
2000-01-24 Lars Gullik Bjønnes <larsbj@lyx.org>
* src/support/LSubstring.C (LSubstring): set pos to string::npos

View File

@ -225,7 +225,7 @@ void BufferView::buffer(Buffer * b)
// Nuke old image
// screen is always deleted when the buffer is changed.
if (screen)
if (screen) // DEL LINE
delete screen;
screen = 0;
@ -273,7 +273,7 @@ void BufferView::buffer(Buffer * b)
void BufferView::updateScreen()
{
// Regenerate the screen.
if (screen)
if (screen) // DEL LINE
delete screen;
screen = new LyXScreen(FL_ObjWin(work_area),
work_area->w,
@ -1520,13 +1520,17 @@ void BufferView::CursorToggleCB(FL_OBJECT * ob, long)
Window tmpwin;
int tmp;
XGetInputFocus(fl_display, &tmpwin, &tmp);
if (lyxerr.debugging(Debug::INFO)) {
lyxerr << "tmpwin: " << tmpwin
<< "\nwindow: " << view->owner_->getForm()->window
<< "\nwork_area_focus: " << view->work_area_focus
<< "\nlyx_focus : " << view->lyx_focus
<< endl;
}
// Commenting this out, we have not had problems with this
// for a long time. We will probably work on this code later
// and we can reenable this debug code then. Now it only
// anoying when debugging. (Lgb)
//if (lyxerr.debugging(Debug::INFO)) {
// 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;

View File

@ -50,9 +50,12 @@ void DepTable::update()
unsigned long one = (*itr).second.second;
unsigned long two = lyx::sum((*itr).first.c_str());
(*itr).second = make_pair(one, two);
if (lyxerr.debugging()) {
lyxerr << "update: " << (*itr).first << " "
<< one << " " << two << endl;
if (lyxerr.debugging(Debug::DEPEND)) {
lyxerr << "Update dep: " << (*itr).first << " "
<< one << " " << two;
if (one != two)
lyxerr << " +";
lyxerr << endl;
}
}
}
@ -93,7 +96,6 @@ bool DepTable::extchanged(string const & ext) const
return true;
}
}
return false;
}
@ -125,7 +127,7 @@ void DepTable::write(string const & f) const
for (DepList::const_iterator cit = deplist.begin();
cit != deplist.end();
++cit) {
if (lyxerr.debugging()) {
if (lyxerr.debugging(Debug::DEPEND)) {
lyxerr << "Write dep: "
<< (*cit).first << " "
<< (*cit).second.first << " "
@ -145,8 +147,8 @@ void DepTable::read(string const & f)
unsigned long one = 0;
unsigned long two = 0;
while(ifs >> nome >> one >> two) {
if (lyxerr.debugging()) {
lyxerr << "read dep: "
if (lyxerr.debugging(Debug::DEPEND)) {
lyxerr << "Read dep: "
<< nome << " "
<< one << " "
<< two << endl;

View File

@ -51,7 +51,7 @@ extern BufferList bufferlist;
struct texfile_struct {
LaTeX::TEX_FILES file;
char const *extension;
char const * extension;
};
static
@ -139,11 +139,12 @@ int LaTeX::run(TeXErrors & terr, MiniBuffer * minib)
// Update the checksums
head.update();
lyxerr[Debug::LATEX] << "Dependency file exists" << endl;
lyxerr[Debug::DEPEND] << "Dependency file exists" << endl;
if (head.sumchange()) {
++count;
lyxerr[Debug::DEPEND]
<< "Dependency file has changed" << endl;
lyxerr[Debug::LATEX]
<< "Dependency file has changed\n"
<< "Run #" << count << endl;
minib->Set(string(_("LaTeX run number ")) + tostr(count));
minib->Store();
@ -152,15 +153,18 @@ int LaTeX::run(TeXErrors & terr, MiniBuffer * minib)
if (scanres & LaTeX::ERRORS) return scanres; // return on error
run_bibtex = scanAux(head);
if (run_bibtex)
lyxerr << "Bibtex demands rerun" << endl;
lyxerr[Debug::DEPEND]
<< "Bibtex demands rerun" << endl;
} else {
lyxerr[Debug::LATEX] << "return no_change" << endl;
lyxerr[Debug::DEPEND] << "return no_change" << endl;
return LaTeX::NO_CHANGE;
}
} else {
++count;
lyxerr[Debug::LATEX] << "Dependency file does not exist\n"
<< "Run #" << count << endl;
lyxerr[Debug::DEPEND]
<< "Dependency file does not exist" << endl;
lyxerr[Debug::LATEX]
<< "Run #" << count << endl;
head.insert(file, true);
minib->Set(string(_("LaTeX run number ")) + tostr(count));
minib->Store();
@ -219,8 +223,9 @@ int LaTeX::run(TeXErrors & terr, MiniBuffer * minib)
if (rerun || head.sumchange()) {
rerun = false;
++count;
lyxerr[Debug::DEPEND]
<< "Dep. file has changed or rerun requested" << endl;
lyxerr[Debug::LATEX]
<< "Dep. file has changed or rerun requested\n"
<< "Run #" << count << endl;
minib->Set(string(_("LaTeX run number ")) + tostr(count));
minib->Store();
@ -231,7 +236,7 @@ int LaTeX::run(TeXErrors & terr, MiniBuffer * minib)
deplog(head); // reads the latex log
head.update();
} else {
lyxerr[Debug::LATEX] << "Dep. file has NOT changed" << endl;
lyxerr[Debug::DEPEND] << "Dep. file has NOT changed" << endl;
}
// 1.5
@ -570,7 +575,7 @@ void LaTeX::deplog(DepTable & head)
break;
foundfile += c;
}
lyxerr[Debug::LATEX] << "Found file: "
lyxerr[Debug::DEPEND] << "Found file: "
<< foundfile << endl;
// Ok now we found a file.
@ -582,7 +587,7 @@ void LaTeX::deplog(DepTable & head)
// absolute path and should
// be inserted.
if (AbsolutePath(foundfile)) {
lyxerr[Debug::LATEX] << "AbsolutePath file: "
lyxerr[Debug::DEPEND] << "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
@ -595,7 +600,7 @@ void LaTeX::deplog(DepTable & head)
// insert it into head
if (FileInfo(OnlyFilename(foundfile)).exist()) {
if (suffixIs(foundfile, ".aux")) {
lyxerr[Debug::LATEX] << "We don't want "
lyxerr[Debug::DEPEND] << "We don't want "
<< OnlyFilename(foundfile)
<< " in the dep file"
<< endl;
@ -603,19 +608,19 @@ void LaTeX::deplog(DepTable & head)
// This is a tex file generated by LyX
// and latex is not likely to change this
// during its runs.
lyxerr[Debug::LATEX] << "Tmpdir TeX file: "
lyxerr[Debug::DEPEND] << "Tmpdir TeX file: "
<< OnlyFilename(foundfile)
<< endl;
head.insert(foundfile, true);
} else {
lyxerr[Debug::LATEX] << "In tmpdir file:"
lyxerr[Debug::DEPEND] << "In tmpdir file:"
<< OnlyFilename(foundfile)
<< endl;
head.insert(OnlyFilename(foundfile));
}
continue;
}
lyxerr[Debug::LATEX]
lyxerr[Debug::DEPEND]
<< "Not a file or we are unable to find it."
<< endl;
}
@ -632,10 +637,9 @@ void LaTeX::deptex(DepTable & head)
tmp = ChangeExtension(file,
all_files[i].extension,
true);
lyxerr[Debug::LATEX] << "deptex: " << tmp << endl;
lyxerr[Debug::DEPEND] << "deptex: " << tmp << endl;
if (fi.newFile(tmp).exist())
head.insert(tmp);
}
}
}

View File

@ -3823,17 +3823,18 @@ string Buffer::getReferenceList(char delim)
{
/// if this is a child document and the parent is already loaded
/// Use the parent's list instead [ale990407]
if (!params.parentname.empty() && bufferlist.exists(params.parentname)) {
if (!params.parentname.empty()
&& bufferlist.exists(params.parentname)) {
Buffer * tmp = bufferlist.getBuffer(params.parentname);
if (tmp)
return tmp->getReferenceList(delim);
return tmp->getReferenceList(delim);
}
LyXParagraph * par = paragraph;
LyXParagraph::size_type pos;
Inset * inset;
string lst;
while (par){
while (par) {
pos = -1;
while ((inset = par->ReturnNextInsetPointer(pos))){
for (int i = 0; i < inset->GetNumberOfLabels(); ++i) {
@ -3842,7 +3843,7 @@ string Buffer::getReferenceList(char delim)
lst += inset->getLabel(i);
}
++pos;
}
}
par = par->next;
}
lyxerr.debug() << "References(" << lst << ")" << endl;

View File

@ -4,7 +4,7 @@
* LyX, The Document Processor
*
* Copyright 1995 Matthias Ettrich
* Copyright 1995-1999 The LyX Team.
* Copyright 1995-2000 The LyX Team.
*
* ====================================================== */

View File

@ -32,6 +32,7 @@ static error_item errorTags[] = {
{ Debug::LYXRC, "lyxrc", "Configuration files reading"},
{ Debug::KBMAP, "kbmap", "Custom keyboard definition"},
{ Debug::LATEX, "latex", "LaTeX generation/execution"},
{ Debug::DEPEND, "depend", "Dependency information"},
{ Debug::MATHED, "mathed", "Math editor"},
{ Debug::FONT, "font", "Font handling"},
{ Debug::TCLASS, "tclass", "Textclass files reading"},
@ -55,7 +56,7 @@ Debug::type Debug::value(string const & val)
while (!v.empty()) {
string::size_type st = v.find(',');
string tmp(lowercase(v.substr(0, st)));
if (tmp.empty())
if (tmp.empty())
break;
// Is it a number?
if (isStrInt(tmp))

View File

@ -47,13 +47,16 @@ struct Debug {
///
ACTION = (1 << 14), // 16384
///
LYXLEX = (1 << 15)
LYXLEX = (1 << 15),
///
DEPEND = (1 << 16)
};
///
static const type ANY = type(INFO | INIT | KEY | TOOLBAR |
PARSER | LYXRC | KBMAP | LATEX |
MATHED | FONT | TCLASS | LYXVC |
LYXSERVER | ROFF | ACTION | LYXLEX);
LYXSERVER | ROFF | ACTION | LYXLEX |
DEPEND);
///
friend inline void operator|=(Debug::type & d1, Debug::type d2);

View File

@ -4,7 +4,7 @@
* LyX, The Document Processor
*
* Copyright 1995 Matthias Ettrich
* Copyright 1995-1999 The LyX Team.
* Copyright 1995-2000 The LyX Team.
*
* ====================================================== */
@ -98,7 +98,7 @@ void InsetLatexAccent::checkContents()
}
if (contents[0] != '\\') return; // demand that first char is a '\\'
lyxerr.debug() << "Decode: " << contents << endl;
lyxerr[Debug::KEY] << "Decode: " << contents << endl;
remdot = false; plusasc = false; plusdesc = false;
@ -213,12 +213,12 @@ void InsetLatexAccent::checkContents()
break;
}
//ic = (modtype == DOT_LESS_J ? 'j' : 'i');
lyxerr.debug() << "Contents: [" << contents << "]"
<< ", ic: " << ic
<< ", top: " << plusasc
<< ", bot: " << plusdesc
<< ", dot: " << remdot
<< ", mod: " << modtype << endl;
lyxerr[Debug::KEY] << "Contents: [" << contents << "]"
<< ", ic: " << ic
<< ", top: " << plusasc
<< ", bot: " << plusdesc
<< ", dot: " << remdot
<< ", mod: " << modtype << endl;
// Special case for space
} else if (contents[3] == '}') {
ic = ' ';
@ -253,12 +253,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: " << plusasc
<< ", bot: " << plusdesc
<< ", dot: " << remdot
<< ", mod: " << modtype << endl;
lyxerr[Debug::KEY] << "Contents: [" << contents << "]"
<< ", ic: " << ic
<< ", top: " << plusasc
<< ", bot: " << plusdesc
<< ", dot: " << remdot
<< ", mod: " << modtype << endl;
}
candisp = true;
}
@ -413,7 +413,7 @@ void InsetLatexAccent::Draw(LyXFont font,
float tmpx = 0;
if (font.shape() == LyXFont::ITALIC_SHAPE)
tmpx += (8.0 * hg) / 10.0; // italic
lyxerr.debug() << "Removing dot." << endl;
lyxerr[Debug::KEY] << "Removing dot." << endl;
// remove the dot first
scr.fillRectangle(gc_clear, int(x + tmpx),
tmpvar, wid,

View File

@ -519,7 +519,7 @@ kb_keymap::~kb_keymap()
{
if(!table) return;
for(kb_key * t = table; t->code != NoSymbol; ++t)
if(t->table)
if(t->table) // DEL LINE
delete t->table;
delete table;
}

View File

@ -89,13 +89,12 @@ public:
///
~kb_sequence()
{
if (sequence != staticseq) {
delete sequence;
delete modifiers;
}
~kb_sequence() {
if (sequence != staticseq) {
delete sequence;
delete modifiers;
}
}
/// Add a key to the key sequence and look it up in the curmap
/** Add a key to the key sequence and look it up in the curmap

View File

@ -202,10 +202,10 @@ LyXGUI::~LyXGUI()
{
// Lyxserver was created in this class so should be destroyed
// here. asierra-970604
if (lyxserver) {
if (lyxserver) { // DEL LINE
delete lyxserver;
lyxserver = 0;
}
} // DEL LINE
CloseLyXLookup();
}

View File

@ -133,10 +133,10 @@ LyX::LyX(int * argc, char * argv[])
// A destructor is always necessary (asierra-970604)
LyX::~LyX()
{
if (lastfiles)
if (lastfiles) // DEL LINE
delete lastfiles;
if (lyxGUI)
if (lyxGUI) // DEL LINE
delete lyxGUI;
}

View File

@ -33,9 +33,9 @@ LyXVC::~LyXVC()
fl_hide_form(browser->LaTeXLog);
fl_free_form(browser->LaTeXLog);
}
if (vcs) {
if (vcs) { // DEL LINE
delete vcs;
}
} // DEL LINE
}

View File

@ -437,7 +437,8 @@ struct MathedRowSt {
///
~MathedRowSt() {
delete[] w;
if (label) delete[] label;
if (label) // DEL LINE
delete[] label;
}
/// Should be const but...
MathedRowSt * getNext() const { return next; }

View File

@ -517,7 +517,7 @@ MathAccentInset::MathAccentInset(MathedInset *ins, int cd, short st)
MathAccentInset::~MathAccentInset()
{
if (inset)
if (inset) // DEL LINE
delete inset;
}

View File

@ -394,7 +394,7 @@ void MathedIter::Clear()
Reset();
while (OK()) {
if (IsInset()) {
MathedInset* inset = GetInset();
MathedInset * inset = GetInset();
if (inset->GetType()!= LM_OT_MACRO_ARG)
delete inset;
Delete();
@ -519,7 +519,7 @@ void MathedXIter::Merge(LyxArrayBase *a0)
crow = r;
} else {
Delete();
pos2--;
--pos2;
}
}
Next();

View File

@ -157,7 +157,8 @@ BitmapMenu::BitmapMenu(int n, FL_OBJECT * bt, BitmapMenu * prevx): nb(n)
BitmapMenu::~BitmapMenu()
{
if (next) delete next;
if (next) // DEL LINE
delete next;
if (form->visible) Hide();
fl_free_form(form);
delete[] bitmap;

View File

@ -142,8 +142,7 @@ void LyXParagraph::writeFile(ostream & os, BufferParams & params,
os << "\n\\begin_float "
<< string_footnotekinds[footnotekind]
<< " ";
}
else {
} else {
os << "\n\\end_float ";
}
}
@ -155,8 +154,7 @@ void LyXParagraph::writeFile(ostream & os, BufferParams & params,
os << "\n\\begin_deeper ";
++dth;
}
}
else {
} else {
while (depth < dth) {
os << "\n\\end_deeper ";
--dth;
@ -233,8 +231,7 @@ void LyXParagraph::writeFile(ostream & os, BufferParams & params,
}
os << '\n';
}
}
else {
} else {
// Dummy layout. This means that a footnote ended.
os << "\n\\end_float ";
footflag = LyXParagraph::NO_FOOTNOTE;
@ -553,14 +550,14 @@ LyXParagraph::~LyXParagraph()
while (insettable) {
tmpinset = insettable;
insettable = insettable->next;
if (tmpinset->inset)
if (tmpinset->inset) // DEL LINE
delete tmpinset->inset;
delete tmpinset;
if (insettable && insettable->next == insettable) {
// somehow this recursion appears occasionally
// but I can't find where. This bandaid
// helps but isn't the best fix. (ARRae)
if (insettable->inset) {
if (insettable->inset) { // DEL LINE
delete insettable->inset;
}
delete insettable;
@ -578,12 +575,12 @@ LyXParagraph::~LyXParagraph()
#endif
/* table stuff -- begin*/
if (table)
if (table) // DEL LINE
delete table;
/* table stuff -- end*/
// ale970302
if (bibkey)
if (bibkey) // DEL LINE
delete bibkey;
}
@ -621,7 +618,7 @@ void LyXParagraph::Erase(LyXParagraph::size_type pos)
tmpi = tmpi->next;
}
if (tmpi) { // this should always be true
if (tmpi->inset) // delete the inset if it exists
if (tmpi->inset) // delete the inset if it exists // DEL LINE
delete tmpi->inset;
if (tmpi == insettable)
insettable = tmpi->next;
@ -2201,7 +2198,7 @@ Inset * LyXParagraph::ReturnNextInsetPointer(LyXParagraph::size_type & pos)
for (InsetList::iterator it = insetlist.begin();
it != insetlist.end(); ++it) {
if ((*it).pos >= pos) {
if (it2 != insetlist.end() || (*it).pos < (*it2).pos)
if (it2 == insetlist.end() || (*it).pos < (*it2).pos)
it2 = it;
}
}

View File

@ -94,7 +94,8 @@ struct isp_result {
misses = static_cast<char**>(0);
}
~isp_result() {
if (misses) delete[] misses;
if (misses) // DEL LINE
delete[] misses;
}
};

View File

@ -185,7 +185,7 @@ DebugStream::~DebugStream()
{
delete nullstream.rdbuf(0); // Without this we leak
delete rdbuf(0); // Without this we leak
if (internal)
if (internal) // DEL LINE
delete internal;
}

View File

@ -292,10 +292,10 @@ void LyXTable::set_row_column_number_info()
row = 0;
column = 0;
if (rowofcell)
if (rowofcell) // DEL LINE
delete [] rowofcell;
rowofcell = new int[numberofcells];
if (columnofcell)
if (columnofcell) // DEL LINE
delete [] columnofcell;
columnofcell = new int[numberofcells];