diff --git a/src/BufferView.C b/src/BufferView.C index 5a3da684df..028466fc42 100644 --- a/src/BufferView.C +++ b/src/BufferView.C @@ -1,8 +1,8 @@ /* This file is part of - * ====================================================== - * + * ====================================================== + * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team. * @@ -53,7 +53,7 @@ LyXView * BufferView::owner() const } -Painter & BufferView::painter() +Painter & BufferView::painter() { return pimpl_->painter(); } @@ -199,19 +199,19 @@ void BufferView::insetUnlock() bool BufferView::focus() const { - return pimpl_->focus(); + return pimpl_->focus(); } void BufferView::focus(bool f) { - pimpl_->focus(f); + pimpl_->focus(f); } bool BufferView::active() const { - return pimpl_->active(); + return pimpl_->active(); } @@ -221,7 +221,7 @@ int BufferView::workWidth() const } -bool BufferView::belowMouse() const +bool BufferView::belowMouse() const { return pimpl_->belowMouse(); } @@ -251,7 +251,7 @@ void BufferView::toggleToggle() } -void BufferView::center() +void BufferView::center() { pimpl_->center(); } diff --git a/src/BufferView.h b/src/BufferView.h index b65afe8163..bb1a72c3a3 100644 --- a/src/BufferView.h +++ b/src/BufferView.h @@ -44,7 +44,7 @@ public: /// CHANGE = 4 }; - + /// BufferView(LyXView * owner, int , int , int, int); /// @@ -73,7 +73,7 @@ public: void updateScrollbar(); /// Inset * checkInsetHit(LyXText *, int & x, int & y); - /// + /// void redoCurrentBuffer(); /// int resizeCurrentBuffer(); @@ -81,16 +81,16 @@ public: void cursorPrevious(LyXText *); /// void cursorNext(LyXText *); - /// + /// bool available() const; /// LyXView * owner() const; /// void beforeChange(LyXText *); - /// - void savePosition(unsigned int i); - /// - void restorePosition(unsigned int i); + /// + void savePosition(unsigned int i); + /// + void restorePosition(unsigned int i); /// bool isSavedPosition(unsigned int i); /** This holds the mapping between buffer paragraphs and screen rows. @@ -108,7 +108,7 @@ public: /// UpdatableInset * theLockingInset() const; /// - void theLockingInset(UpdatableInset * inset); + void theLockingInset(UpdatableInset * inset); /// void updateInset(Inset * inset, bool mark_dirty); /// @@ -184,7 +184,7 @@ public: void toggleToggle(); /// void center(); - + /// bool focus() const; /// @@ -200,7 +200,7 @@ public: void setState(); /// - bool ChangeInsets(Inset::Code code, string const & from, + bool ChangeInsets(Inset::Code code, string const & from, string const & to); /// bool ChangeRefsIfUnique(string const & from, string const & to); diff --git a/src/BufferView2.C b/src/BufferView2.C index 1ef20a9936..da33665c27 100644 --- a/src/BufferView2.C +++ b/src/BufferView2.C @@ -1,8 +1,8 @@ /* This file is part of - * ====================================================== - * + * ====================================================== + * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team. * @@ -73,7 +73,7 @@ bool BufferView::insertLyXFile(string const & filen) MakeDisplayPath(fname, 50)); return false; } - + beforeChange(text); ifstream ifs(fname.c_str()); @@ -83,9 +83,9 @@ bool BufferView::insertLyXFile(string const & filen) MakeDisplayPath(fname, 50)); return false; } - + int const c = ifs.peek(); - + LyXLex lex(0, 0); lex.setStream(ifs); @@ -95,7 +95,7 @@ bool BufferView::insertLyXFile(string const & filen) lyxerr[Debug::INFO] << "Will insert file with header" << endl; res = buffer()->readFile(lex, text->cursor.par()); } else { - lyxerr[Debug::INFO] << "Will insert file without header" + lyxerr[Debug::INFO] << "Will insert file without header" << endl; res = buffer()->readLyXformat2(lex, text->cursor.par()); } @@ -171,7 +171,7 @@ bool BufferView::removeAutoInsets() cursor_par = cursor_par_prev; cursor_pos = cursor_par_prev->size(); cursor_par_prev = cursor_par->previous(); - // cursor_par_next remains the same + // cursor_par_next remains the same } else if (cursor_par_next) { // First step below may occur before while{} // . @@ -254,13 +254,13 @@ void BufferView::insertErrors(TeXErrors & terr) int const errorrow = cit->error_in_line; // Insert error string for row number - int tmpid = -1; + int tmpid = -1; int tmppos = -1; if (buffer()->texrow.getIdFromRow(errorrow, tmpid, tmppos)) { buffer()->texrow.increasePos(tmpid, tmppos); } - + Paragraph * texrowpar = 0; if (tmpid == -1) { @@ -285,7 +285,7 @@ void BufferView::insertErrors(TeXErrors & terr) void BufferView::setCursorFromRow(int row) { - int tmpid = -1; + int tmpid = -1; int tmppos = -1; buffer()->texrow.getIdFromRow(row, tmpid, tmppos); @@ -356,7 +356,7 @@ void BufferView::menuRedo() return; } #endif - + if (available()) { owner()->message(_("Redo")); hideCursor(); @@ -423,14 +423,14 @@ void BufferView::paste() toggleSelection(); text->clearSelection(); update(text, BufferView::SELECT|BufferView::FITCUR); - + // paste text->pasteSelection(this); update(text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE); // why fake a selection only I think it should be a real one and not only // a painted one (Jug 20020318). #if 0 - // clear the selection + // clear the selection toggleSelection(); text->clearSelection(); update(text, BufferView::SELECT|BufferView::FITCUR); @@ -438,7 +438,7 @@ void BufferView::paste() } -/* these functions are for the spellchecker */ +/* these functions are for the spellchecker */ string const BufferView::nextWord(float & value) { if (!available()) { @@ -449,11 +449,11 @@ string const BufferView::nextWord(float & value) return text->selectNextWordToSpellcheck(this, value); } - + void BufferView::selectLastWord() { if (!available()) return; - + LyXCursor cur = text->selection.cursor; hideCursor(); beforeChange(text); @@ -467,7 +467,7 @@ void BufferView::selectLastWord() void BufferView::endOfSpellCheck() { if (!available()) return; - + hideCursor(); beforeChange(text); text->selectSelectedWord(this); @@ -483,15 +483,15 @@ void BufferView::replaceWord(string const & replacestring) LyXText * tt = getLyXText(); hideCursor(); update(tt, BufferView::SELECT|BufferView::FITCUR); - - /* clear the selection (if there is any) */ + + /* clear the selection (if there is any) */ toggleSelection(false); update(tt, BufferView::SELECT|BufferView::FITCUR); - - /* clear the selection (if there is any) */ + + /* clear the selection (if there is any) */ toggleSelection(false); tt->replaceSelectionWithString(this, replacestring); - + tt->setSelectionOverString(this, replacestring); // Go back so that replacement string is also spellchecked @@ -560,7 +560,7 @@ void BufferView::showLockedInsetCursor(int x, int y, int asc, int desc) (cursor.par()->getInset(cursor.pos() - 1) == locking_inset)) text->setCursor(this, cursor, - cursor.par(), cursor.pos() - 1); + cursor.par(), cursor.pos() - 1); LyXScreen::Cursor_Shape shape = LyXScreen::BAR_SHAPE; LyXText * txt = getLyXText(); if (locking_inset->isTextInset() && @@ -610,7 +610,7 @@ int BufferView::unlockInset(UpdatableInset * inset) return 0; } else if (inset && theLockingInset() && theLockingInset()->unlockInsetInInset(this, inset)) { - // owner inset has updated the layout combo + // owner inset has updated the layout combo finishUndo(); return 0; } @@ -625,8 +625,8 @@ void BufferView::lockedInsetStoreUndo(Undo::undo_kind kind) if (kind == Undo::EDIT) // in this case insets would not be stored! kind = Undo::FINISH; setUndo(this, kind, - text->cursor.par(), - text->cursor.par()->next()); + text->cursor.par(), + text->cursor.par()->next()); } @@ -664,7 +664,7 @@ bool BufferView::ChangeInsets(Inset::Code code, need_update = true; // FIXME - + // The test it.size()==1 was needed to prevent crashes. // How to set the cursor corretly when it.size()>1 ?? if (it.size() == 1) { @@ -696,10 +696,10 @@ bool BufferView::ChangeCitationsIfUnique(string const & from, string const & to) { typedef pair StringPair; - - vector keys = buffer()->getBibkeyList(); - if (count_if(keys.begin(), keys.end(), - lyx::equal_1st_in_pair(from)) + + vector keys = buffer()->getBibkeyList(); + if (count_if(keys.begin(), keys.end(), + lyx::equal_1st_in_pair(from)) > 1) return false; diff --git a/src/BufferView_pimpl.C b/src/BufferView_pimpl.C index ec1f53a9c8..05c59edf11 100644 --- a/src/BufferView_pimpl.C +++ b/src/BufferView_pimpl.C @@ -87,7 +87,7 @@ using SigC::slot; using lyx::pos_type; using lyx::textclass_type; -/* the selection possible is needed, that only motion events are +/* the selection possible is needed, that only motion events are * used, where the bottom press event was on the drawing area too */ bool selection_possible = false; @@ -153,10 +153,10 @@ BufferView::Pimpl::Pimpl(BufferView * b, LyXView * o, workarea_.workAreaKeyPress .connect(slot(this, &BufferView::Pimpl::workAreaKeyPress)); workarea_.selectionRequested - .connect(slot(this, &BufferView::Pimpl::selectionRequested)); + .connect(slot(this, &BufferView::Pimpl::selectionRequested)); workarea_.selectionLost .connect(slot(this, &BufferView::Pimpl::selectionLost)); - + cursor_timeout.timeout.connect(slot(this, &BufferView::Pimpl::cursorToggle)); cursor_timeout.start(); @@ -165,7 +165,7 @@ BufferView::Pimpl::Pimpl(BufferView * b, LyXView * o, } -Painter & BufferView::Pimpl::painter() +Painter & BufferView::Pimpl::painter() { return workarea_.getPainter(); } @@ -186,7 +186,7 @@ void BufferView::Pimpl::buffer(Buffer * b) textcache.add(buffer_, workarea_.workWidth(), bv_->text); if (lyxerr.debugging()) textcache.show(lyxerr, "BufferView::buffer"); - + bv_->text = 0; } @@ -194,7 +194,7 @@ void BufferView::Pimpl::buffer(Buffer * b) buffer_ = b; if (bufferlist.getState() == BufferList::CLOSING) return; - + // Nuke old image // screen is always deleted when the buffer is changed. screen_.reset(0); @@ -300,18 +300,18 @@ void BufferView::Pimpl::redoCurrentBuffer() int BufferView::Pimpl::resizeCurrentBuffer() { lyxerr[Debug::INFO] << "resizeCurrentBuffer" << endl; - + Paragraph * par = 0; Paragraph * selstartpar = 0; Paragraph * selendpar = 0; UpdatableInset * the_locking_inset = 0; - + pos_type pos = 0; pos_type selstartpos = 0; pos_type selendpos = 0; bool selection = false; bool mark_set = false; - + owner_->prohibitInput(); owner_->message(_("Formatting document...")); @@ -381,7 +381,7 @@ int BufferView::Pimpl::resizeCurrentBuffer() setState(); owner_->allowInput(); - /// clear the "Formatting Document" message + /// clear the "Formatting Document" message owner_->message(""); return 0; @@ -398,7 +398,7 @@ void BufferView::Pimpl::updateScreen() void BufferView::Pimpl::updateScrollbar() { /* If the text is smaller than the working area, the scrollbar - * maximum must be the working area height. No scrolling will + * maximum must be the working area height. No scrolling will * be possible */ if (!bv_->text) { workarea_.setScrollbar(0, 1.0); @@ -414,11 +414,11 @@ void BufferView::Pimpl::updateScrollbar() workarea_.setScrollbar(current_scrollbar_value, 1.0); return; } - + double const lineh = bv_->text->defaultHeight(); double const slider_size = (text_height == 0) ? 1.0 : 1.0 / double(text_height); - + static long old_text_height; static double old_lineh; static double old_slider_size; @@ -450,7 +450,7 @@ void BufferView::Pimpl::scrollCB(double value) if (current_scrollbar_value < 0) current_scrollbar_value = 0; - + if (!screen_.get()) return; @@ -460,9 +460,9 @@ void BufferView::Pimpl::scrollCB(double value) waitForX(); return; } - + LyXText * vbt = bv_->text; - + int const height = vbt->defaultHeight(); int const first = static_cast((bv_->text->first_y + height)); int const last = static_cast((bv_->text->first_y + workarea_.height() - height)); @@ -480,26 +480,26 @@ int BufferView::Pimpl::scrollUp(long time) { if (!buffer_) return 0; if (!screen_.get()) return 0; - + double value = workarea_.getScrollbarValue(); - + if (value == 0) return 0; float add_value = (bv_->text->defaultHeight() + float(time) * float(time) * 0.125); - + if (add_value > workarea_.height()) add_value = float(workarea_.height() - bv_->text->defaultHeight()); - + value -= add_value; if (value < 0) value = 0; - + workarea_.setScrollbarValue(value); - - scrollCB(value); + + scrollCB(value); return 0; } @@ -508,28 +508,28 @@ int BufferView::Pimpl::scrollDown(long time) { if (!buffer_) return 0; if (!screen_.get()) return 0; - + double value = workarea_.getScrollbarValue(); pair p = workarea_.getScrollbarBounds(); double const max = p.second; - + if (value == max) return 0; float add_value = (bv_->text->defaultHeight() + float(time) * float(time) * 0.125); - + if (add_value > workarea_.height()) add_value = float(workarea_.height() - bv_->text->defaultHeight()); - + value += add_value; - + if (value > max) value = max; workarea_.setScrollbarValue(value); - - scrollCB(value); + + scrollCB(value); return 0; } @@ -564,20 +564,20 @@ void BufferView::Pimpl::workAreaMotionNotify(int x, int y, unsigned int state) state); return; } - + /* The test for not selection possible is needed, that only motion events are used, where the bottom press event was on the drawing area too */ if (!selection_possible) return; - + screen_->hideCursor(); bv_->text->setCursorFromCoordinates(bv_, x, y + bv_->text->first_y); - + if (!bv_->text->selection.set()) update(bv_->text, BufferView::UPDATE); // Maybe an empty line was deleted - + bv_->text->setSelection(bv_); screen_->toggleToggle(bv_->text, bv_); fitCursor(); @@ -587,7 +587,7 @@ void BufferView::Pimpl::workAreaMotionNotify(int x, int y, unsigned int state) // Single-click on work area void BufferView::Pimpl::workAreaButtonPress(int xpos, int ypos, - unsigned int button) + unsigned int button) { if (!buffer_ || !screen_.get()) return; @@ -605,7 +605,7 @@ void BufferView::Pimpl::workAreaButtonPress(int xpos, int ypos, break; } } - + // Middle button press pastes if we have a selection // We do this here as if the selection was inside an inset // it could get cleared on the unlocking of the inset so @@ -615,10 +615,10 @@ void BufferView::Pimpl::workAreaButtonPress(int xpos, int ypos, owner_->getLyXFunc()->dispatch(LFUN_COPY); paste_internally = true; } - + if (bv_->theLockingInset()) { // We are in inset locking mode - + /* Check whether the inset was hit. If not reset mode, otherwise give the event to the inset */ if (inset_hit == bv_->theLockingInset()) { @@ -629,20 +629,20 @@ void BufferView::Pimpl::workAreaButtonPress(int xpos, int ypos, bv_->unlockInset(bv_->theLockingInset()); } } - + if (!inset_hit) selection_possible = true; screen_->hideCursor(); int const screen_first = bv_->text->first_y; - + // Clear the selection screen_->toggleSelection(bv_->text, bv_); bv_->text->clearSelection(); bv_->text->fullRebreak(bv_); update(); updateScrollbar(); - + // Single left click in math inset? if (isHighlyEditableInset(inset_hit)) { // Highly editable inset, like math @@ -655,25 +655,25 @@ void BufferView::Pimpl::workAreaButtonPress(int xpos, int ypos, inset->edit(bv_); //, xpos, ypos, button); inset->insetButtonPress(bv_, xpos, ypos, button); return; - } - + } + // Right click on a footnote flag opens float menu - if (button == 3) { + if (button == 3) { selection_possible = false; return; } - + if (!inset_hit) // otherwise it was already set in checkInsetHit(...) bv_->text->setCursorFromCoordinates(bv_, xpos, ypos + screen_first); finishUndo(); bv_->text->selection.cursor = bv_->text->cursor; bv_->text->cursor.x_fix(bv_->text->cursor.x()); - + owner_->updateLayoutChoice(); if (fitCursor()) { selection_possible = false; } - + // Insert primary selection with middle mouse // if there is a local selection in the current buffer, // insert this @@ -682,14 +682,14 @@ void BufferView::Pimpl::workAreaButtonPress(int xpos, int ypos, owner_->getLyXFunc()->dispatch(LFUN_PASTE); else owner_->getLyXFunc()->dispatch(LFUN_PASTESELECTION, - "paragraph"); + "paragraph"); selection_possible = false; return; } } -void BufferView::Pimpl::doubleClick(int /*x*/, int /*y*/, unsigned int button) +void BufferView::Pimpl::doubleClick(int /*x*/, int /*y*/, unsigned int button) { // select a word if (!buffer_) @@ -749,7 +749,7 @@ void BufferView::Pimpl::tripleClick(int /*x*/, int /*y*/, unsigned int button) void BufferView::Pimpl::selectionRequested() { static string sel; - + if (!available()) return; @@ -761,7 +761,7 @@ void BufferView::Pimpl::selectionRequested() text->selection.end != bv_->text->xsel_cache.end)) { bv_->text->xsel_cache = text->selection; - sel = text->selectionAsString(bv_->buffer(), false); + sel = text->selectionAsString(bv_->buffer(), false); } else if (!text->selection.set()) { sel = string(); bv_->text->xsel_cache.set(false); @@ -771,10 +771,10 @@ void BufferView::Pimpl::selectionRequested() } } - + void BufferView::Pimpl::selectionLost() { - if (active() && available()) { + if (active() && available()) { hideCursor(); toggleSelection(); bv_->getLyXText()->clearSelection(); @@ -783,7 +783,7 @@ void BufferView::Pimpl::selectionLost() } } - + void BufferView::Pimpl::enterView() { if (active() && available()) { @@ -816,15 +816,15 @@ void BufferView::Pimpl::workAreaButtonRelease(int x, int y, // We are in inset locking mode. /* LyX does a kind of work-area grabbing for insets. - Only a ButtonPress Event outside the inset will + Only a ButtonPress Event outside the inset will force a insetUnlock. */ bv_->theLockingInset()-> insetButtonRelease(bv_, x, y, button); return; } - + selection_possible = false; - + if (button == 2) return; @@ -832,7 +832,7 @@ void BufferView::Pimpl::workAreaButtonRelease(int x, int y, if (button == 1) { workarea_.haveSelection(bv_->getLyXText()->selection.set()); } - + setState(); owner_->showState(); owner_->updateMenubar(); @@ -845,7 +845,7 @@ void BufferView::Pimpl::workAreaButtonRelease(int x, int y, // if we reach this point with a selection, it // must mean we are currently selecting. // But we don't want to open the inset - // because that is annoying for the user. + // because that is annoying for the user. // So just pretend we didn't hit it. // this is OK because a "kosher" ButtonRelease // will follow a ButtonPress that clears @@ -854,7 +854,7 @@ void BufferView::Pimpl::workAreaButtonRelease(int x, int y, // problems if we end up opening an inset if (bv_->getLyXText()->selection.set()) return; - + // CHECK fix this proper in 0.13 // well, maybe 13.0 !!!!!!!!! @@ -889,7 +889,7 @@ void BufferView::Pimpl::workAreaButtonRelease(int x, int y, } // Maybe we want to edit a bibitem ale970302 - if (bv_->text->cursor.par()->bibkey && x < 20 + + if (bv_->text->cursor.par()->bibkey && x < 20 + bibitemMaxWidth(bv_, textclasslist[buffer_->params.textclass].defaultfont())) { bv_->text->cursor.par()->bibkey->edit(bv_, 0, 0, 0); } @@ -905,23 +905,23 @@ Box BufferView::Pimpl::insetDimensions(LyXText const & text, pos_type const pos = cursor.pos(); lyx::Assert(par.getInset(pos)); - + Inset const & inset(*par.getInset(pos)); LyXFont const & font = text.getFont(buffer_, &par, pos); - + int const width = inset.width(bv_, font); int const inset_x = font.isVisibleRightToLeft() ? (cursor.x() - width) : cursor.x(); - + return Box( inset_x + inset.scroll(), inset_x + width, cursor.y() - inset.ascent(bv_, font), cursor.y() + inset.descent(bv_, font)); } - - + + Inset * BufferView::Pimpl::checkInset(LyXText const & text, LyXCursor const & cursor, int & x, int & y) const @@ -934,7 +934,7 @@ Inset * BufferView::Pimpl::checkInset(LyXText const & text, } Inset /*const*/ * inset = par.getInset(pos); - + if (!isEditableInset(inset)) { return 0; } @@ -942,40 +942,40 @@ Inset * BufferView::Pimpl::checkInset(LyXText const & text, Box b(insetDimensions(text, cursor)); if (!b.contained(x, y)) { - lyxerr[Debug::GUI] << "Missed inset at x,y " << x << "," << y + lyxerr[Debug::GUI] << "Missed inset at x,y " << x << "," << y << " box " << b << endl; return 0; } - + text.setCursor(bv_, &par, pos, true); - + x -= b.x1; // The origin of an inset is on the baseline y -= (text.cursor.y()); - + return inset; } - + Inset * BufferView::Pimpl::checkInsetHit(LyXText * text, int & x, int & y) { if (!screen_.get()) return 0; - + int y_tmp = y + text->first_y; - + LyXCursor cursor; text->setCursorFromCoordinates(bv_, cursor, x, y_tmp); - + Inset * inset(checkInset(*text, cursor, x, y_tmp)); if (inset) { y = y_tmp; return inset; } - + // look at previous position - + if (cursor.pos() == 0) { return 0; } @@ -1071,7 +1071,7 @@ void BufferView::Pimpl::update() // -3 - update // -2 - update, move sel_cursor if selection, fitcursor // -1 - update, move sel_cursor if selection, fitcursor, mark dirty -// 0 - update, move sel_cursor if selection, fitcursor +// 0 - update, move sel_cursor if selection, fitcursor // 1 - update, move sel_cursor if selection, fitcursor, mark dirty // 3 - update, move sel_cursor if selection // @@ -1091,7 +1091,7 @@ void BufferView::Pimpl::update() // UPDATE = 0, // SELECT = 1, // FITCUR = 2, -// CHANGE = 4 +// CHANGE = 4 // }; // // UPDATE_ONLY = UPDATE; @@ -1121,7 +1121,7 @@ void BufferView::Pimpl::update(LyXText * text, BufferView::UpdateCodes f) } else { update(); } - + if ((f & FITCUR)) { fitCursor(); } @@ -1139,7 +1139,7 @@ void BufferView::Pimpl::cursorToggle() cursor_timeout.restart(); return; } - + if (!screen_.get()) { cursor_timeout.restart(); return; @@ -1148,13 +1148,13 @@ void BufferView::Pimpl::cursorToggle() /* FIXME */ extern void reapSpellchecker(void); reapSpellchecker(); - + if (!bv_->theLockingInset()) { screen_->cursorToggle(bv_); } else { bv_->theLockingInset()->toggleInsetCursor(bv_); } - + cursor_timeout.restart(); } @@ -1163,17 +1163,17 @@ void BufferView::Pimpl::cursorPrevious(LyXText * text) { if (!text->cursor.row()->previous()) return; - + int y = text->first_y; Row * cursorrow = text->cursor.row(); - + text->setCursorFromCoordinates(bv_, bv_->text->cursor.x_fix(), y); finishUndo(); // This is to allow jumping over large insets if ((cursorrow == text->cursor.row())) text->cursorUp(bv_); - - if (text->inset_owner || + + if (text->inset_owner || text->cursor.row()->height() < workarea_.height()) screen_->draw(bv_->text, bv_, text->cursor.y() @@ -1188,20 +1188,20 @@ void BufferView::Pimpl::cursorNext(LyXText * text) { if (!text->cursor.row()->next()) return; - + int y = text->first_y + workarea_.height(); // if (text->inset_owner) // y += bv_->text->first; text->getRowNearY(y); - + Row * cursorrow = text->cursor.row(); text->setCursorFromCoordinates(bv_, text->cursor.x_fix(), y); // + workarea_->height()); finishUndo(); // This is to allow jumping over large insets if ((cursorrow == bv_->text->cursor.row())) text->cursorDown(bv_); - - if (text->inset_owner || + + if (text->inset_owner || text->cursor.row()->height() < workarea_.height()) screen_->draw(bv_->text, bv_, text->cursor.y() - text->cursor.row()->baseline()); @@ -1250,7 +1250,7 @@ void BufferView::Pimpl::restorePosition(unsigned int i) if (fname != buffer_->fileName()) { Buffer * b = bufferlist.exists(fname) ? - bufferlist.getBuffer(fname) : + bufferlist.getBuffer(fname) : bufferlist.loadLyXFile(fname); // don't ask, just load it if (b != 0) buffer(b); } @@ -1345,7 +1345,7 @@ bool BufferView::Pimpl::active() const } -bool BufferView::Pimpl::belowMouse() const +bool BufferView::Pimpl::belowMouse() const { return workarea_.belowMouse(); } @@ -1390,7 +1390,7 @@ void BufferView::Pimpl::toggleToggle() } -void BufferView::Pimpl::center() +void BufferView::Pimpl::center() { beforeChange(bv_->text); if (bv_->text->cursor.y() > static_cast((workarea_.height() / 2))) { @@ -1403,16 +1403,16 @@ void BufferView::Pimpl::center() } -void BufferView::Pimpl::pasteClipboard(bool asPara) +void BufferView::Pimpl::pasteClipboard(bool asPara) { if (!buffer_) return; screen_->hideCursor(); beforeChange(bv_->text); - + string const clip(workarea_.getClipboard()); - + if (clip.empty()) return; @@ -1441,7 +1441,7 @@ inline void BufferView::Pimpl::moveCursorUpdate(bool selecting) { LyXText * lt = bv_->getLyXText(); - + if (selecting || lt->selection.mark()) { lt->setSelection(bv_); if (lt->bv_owner) @@ -1456,7 +1456,7 @@ void BufferView::Pimpl::moveCursorUpdate(bool selecting) if (!lt->selection.set()) workarea_.haveSelection(false); - + /* ---> Everytime the cursor is moved, show the current font state. */ // should this too me moved out of this func? //owner->showState(); @@ -1502,7 +1502,7 @@ void BufferView::Pimpl::MenuInsertLyXFile(string const & filen) FileDialog::Result result = fileDlg.Select(initpath, _("*.lyx| LyX Documents (*.lyx)")); - + if (result.first == FileDialog::Later) return; @@ -1520,7 +1520,7 @@ void BufferView::Pimpl::MenuInsertLyXFile(string const & filen) filename = FileSearch(string(), filename, "lyx"); string const disp_fn(MakeDisplayPath(filename)); - + ostringstream s1; s1 << _("Inserting document") << ' ' << disp_fn << " ..."; @@ -1544,7 +1544,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) { lyxerr[Debug::ACTION] << "BufferView::Pimpl::Dispatch: action[" << action <<"] arg[" << argument << "]" << endl; - + switch (action) { // --- Misc ------------------------------------------- case LFUN_APPENDIX: @@ -1569,7 +1569,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) delete inset; break; } - + case LFUN_SCROLL_INSET: // this is not handled here as this funktion is only aktive // if we have a locking_inset and that one is (or contains) @@ -1588,12 +1588,12 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) } break; } - + case LFUN_PASTE: bv_->paste(); setState(); break; - + case LFUN_PASTESELECTION: { bool asPara = false; @@ -1602,28 +1602,28 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) pasteClipboard(asPara); } break; - + case LFUN_CUT: bv_->cut(); break; - + case LFUN_COPY: bv_->copy(); break; - + case LFUN_LAYOUT_COPY: bv_->copyEnvironment(); break; - + case LFUN_LAYOUT_PASTE: bv_->pasteEnvironment(); setState(); break; - + case LFUN_GOTOERROR: gotoInset(Inset::ERROR_CODE, false); break; - + case LFUN_GOTONOTE: gotoInset(Inset::IGNORE_CODE, false); break; @@ -1640,15 +1640,15 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) case LFUN_HYPHENATION: specialChar(InsetSpecialChar::HYPHENATION); break; - + case LFUN_LIGATURE_BREAK: specialChar(InsetSpecialChar::LIGATURE_BREAK); break; - + case LFUN_LDOTS: specialChar(InsetSpecialChar::LDOTS); break; - + case LFUN_END_OF_SENTENCE: specialChar(InsetSpecialChar::END_OF_SENTENCE); break; @@ -1656,19 +1656,19 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) case LFUN_MENU_SEPARATOR: specialChar(InsetSpecialChar::MENU_SEPARATOR); break; - + case LFUN_HFILL: hfill(); break; - + case LFUN_DEPTH_MIN: changeDepth(bv_, bv_->getLyXText(), -1); break; - + case LFUN_DEPTH_PLUS: changeDepth(bv_, bv_->getLyXText(), 1); break; - + case LFUN_FREE: owner_->getDialogs()->setUserFreeFont(); break; @@ -1676,7 +1676,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) case LFUN_FILE_INSERT: MenuInsertLyXFile(argument); break; - + case LFUN_FILE_INSERT_ASCII_PARA: InsertAsciiFile(bv_, argument, true); break; @@ -1684,14 +1684,14 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) case LFUN_FILE_INSERT_ASCII: InsertAsciiFile(bv_, argument, false); break; - + case LFUN_LAYOUT: { lyxerr[Debug::INFO] << "LFUN_LAYOUT: (arg) " << argument << endl; - + // Derive layout number from given argument (string) - // and current buffer's textclass (number). */ + // and current buffer's textclass (number). */ textclass_type tclass = buffer_->params.textclass; bool hasLayout = textclasslist[tclass].hasLayout(argument); @@ -1701,7 +1701,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) if (hasLayout) { string const & obs = textclasslist[tclass][layout] .obsoleted_by(); - if (!obs.empty()) + if (!obs.empty()) layout = obs; } @@ -1745,50 +1745,50 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) bold(bv_); owner_->showState(); break; - + case LFUN_NOUN: noun(bv_); owner_->showState(); break; - + case LFUN_CODE: code(bv_); owner_->showState(); break; - + case LFUN_SANS: sans(bv_); owner_->showState(); break; - + case LFUN_ROMAN: roman(bv_); owner_->showState(); break; - + case LFUN_DEFAULT: styleReset(bv_); owner_->showState(); break; - + case LFUN_UNDERLINE: underline(bv_); owner_->showState(); break; - + case LFUN_FONT_SIZE: fontSize(bv_, argument); owner_->showState(); break; - + case LFUN_FONT_STATE: owner_->getLyXFunc()->setMessage(currentState(bv_)); break; - + case LFUN_UPCASE_WORD: { LyXText * lt = bv_->getLyXText(); - + update(lt, BufferView::SELECT | BufferView::FITCUR); @@ -1801,11 +1801,11 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) | BufferView::CHANGE); } break; - + case LFUN_LOWCASE_WORD: { LyXText * lt = bv_->getLyXText(); - + update(lt, BufferView::SELECT|BufferView::FITCUR); lt->changeCase(bv_, LyXText::text_lowercase); if (lt->inset_owner) @@ -1816,11 +1816,11 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) | BufferView::CHANGE); } break; - + case LFUN_CAPITALIZE_WORD: { LyXText * lt = bv_->getLyXText(); - + update(lt, BufferView::SELECT|BufferView::FITCUR); lt->changeCase(bv_, LyXText::text_capitalization); if (lt->inset_owner) @@ -1835,7 +1835,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) case LFUN_TRANSPOSE_CHARS: { LyXText * lt = bv_->getLyXText(); - + update(lt, BufferView::SELECT|BufferView::FITCUR); lt->transposeChars(*bv_); if (lt->inset_owner) @@ -1846,8 +1846,8 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) | BufferView::CHANGE); } break; - - + + case LFUN_INSERT_LABEL: MenuInsertLabel(bv_, argument); break; @@ -1880,29 +1880,29 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) { string label(argument); if (label.empty()) { - InsetRef * inset = + InsetRef * inset = static_cast(getInsetByCode(Inset::REF_CODE)); if (inset) { - label = inset->getContents(); + label = inset->getContents(); savePosition(0); } } - + if (!label.empty()) { //bv_->savePosition(0); if (!bv_->gotoLabel(label)) - Alert::alert(_("Error"), - _("Couldn't find this label"), + Alert::alert(_("Error"), + _("Couldn't find this label"), _("in current document.")); } } break; - + // --- Cursor Movements ----------------------------- case LFUN_RIGHT: { LyXText * lt = bv_->getLyXText(); - + bool is_rtl = lt->cursor.par()->isRightToLeftPar(buffer_->params); if (!lt->selection.mark()) beforeChange(lt); @@ -1927,7 +1927,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) owner_->showState(); } break; - + case LFUN_LEFT: { // This is soooo ugly. Isn`t it possible to make @@ -1960,11 +1960,11 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) owner_->showState(); } break; - + case LFUN_UP: { LyXText * lt = bv_->getLyXText(); - + if (!lt->selection.mark()) beforeChange(lt); update(lt, BufferView::UPDATE); @@ -1974,11 +1974,11 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) owner_->showState(); } break; - + case LFUN_DOWN: { LyXText * lt = bv_->getLyXText(); - + if (!lt->selection.mark()) beforeChange(lt); update(lt, BufferView::UPDATE); @@ -1992,7 +1992,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) case LFUN_UP_PARAGRAPH: { LyXText * lt = bv_->getLyXText(); - + if (!lt->selection.mark()) beforeChange(lt); update(lt, BufferView::UPDATE); @@ -2002,11 +2002,11 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) owner_->showState(); } break; - + case LFUN_DOWN_PARAGRAPH: { LyXText * lt = bv_->getLyXText(); - + if (!lt->selection.mark()) beforeChange(lt); update(lt, BufferView::UPDATE); @@ -2016,11 +2016,11 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) owner_->showState(); } break; - + case LFUN_PRIOR: { LyXText * lt = bv_->getLyXText(); - + if (!lt->selection.mark()) beforeChange(lt); update(lt, BufferView::UPDATE); @@ -2030,11 +2030,11 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) owner_->showState(); } break; - + case LFUN_NEXT: { LyXText * lt = bv_->getLyXText(); - + if (!lt->selection.mark()) beforeChange(lt); update(lt, BufferView::UPDATE); @@ -2044,11 +2044,11 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) owner_->showState(); } break; - + case LFUN_HOME: { LyXText * lt = bv_->getLyXText(); - + if (!lt->selection.mark()) beforeChange(lt); update(lt, BufferView::SELECT|BufferView::FITCUR); @@ -2058,11 +2058,11 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) owner_->showState(); } break; - + case LFUN_END: { LyXText * lt = bv_->getLyXText(); - + if (!lt->selection.mark()) beforeChange(lt); update(lt, @@ -2073,12 +2073,12 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) owner_->showState(); } break; - + case LFUN_SHIFT_TAB: case LFUN_TAB: { LyXText * lt = bv_->getLyXText(); - + if (!lt->selection.mark()) beforeChange(lt); update(lt, @@ -2089,11 +2089,11 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) owner_->showState(); } break; - + case LFUN_WORDRIGHT: { LyXText * lt = bv_->getLyXText(); - + if (!lt->selection.mark()) beforeChange(lt); update(lt, BufferView::SELECT|BufferView::FITCUR); @@ -2106,11 +2106,11 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) owner_->showState(); } break; - + case LFUN_WORDLEFT: { LyXText * lt = bv_->getLyXText(); - + if (!lt->selection.mark()) beforeChange(lt); update(lt, BufferView::SELECT|BufferView::FITCUR); @@ -2123,11 +2123,11 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) owner_->showState(); } break; - + case LFUN_BEGINNINGBUF: { LyXText * lt = bv_->getLyXText(); - + if (!lt->selection.mark()) beforeChange(lt); update(lt, @@ -2138,11 +2138,11 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) owner_->showState(); } break; - + case LFUN_ENDBUF: { LyXText * lt = bv_->getLyXText(); - + if (!lt->selection.mark()) beforeChange(lt); update(lt, @@ -2153,12 +2153,12 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) owner_->showState(); } break; - + /* cursor selection ---------------------------- */ case LFUN_RIGHTSEL: { LyXText * lt = bv_->getLyXText(); - + update(lt, BufferView::SELECT|BufferView::FITCUR); if (lt->cursor.par()->isRightToLeftPar(buffer_->params)) @@ -2170,11 +2170,11 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) owner_->showState(); } break; - + case LFUN_LEFTSEL: { LyXText * lt = bv_->getLyXText(); - + update(lt, BufferView::SELECT|BufferView::FITCUR); if (lt->cursor.par()->isRightToLeftPar(buffer_->params)) @@ -2186,11 +2186,11 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) owner_->showState(); } break; - + case LFUN_UPSEL: { LyXText * lt = bv_->getLyXText(); - + update(lt, BufferView::SELECT|BufferView::FITCUR); lt->cursorUp(bv_); @@ -2199,11 +2199,11 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) owner_->showState(); } break; - + case LFUN_DOWNSEL: { LyXText * lt = bv_->getLyXText(); - + update(lt, BufferView::SELECT|BufferView::FITCUR); lt->cursorDown(bv_); @@ -2216,7 +2216,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) case LFUN_UP_PARAGRAPHSEL: { LyXText * lt = bv_->getLyXText(); - + update(lt, BufferView::SELECT|BufferView::FITCUR); lt->cursorUpParagraph(bv_); @@ -2225,11 +2225,11 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) owner_->showState(); } break; - + case LFUN_DOWN_PARAGRAPHSEL: { LyXText * lt = bv_->getLyXText(); - + update(lt, BufferView::SELECT|BufferView::FITCUR); lt->cursorDownParagraph(bv_); @@ -2238,11 +2238,11 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) owner_->showState(); } break; - + case LFUN_PRIORSEL: { LyXText * lt = bv_->getLyXText(); - + update(lt, BufferView::SELECT|BufferView::FITCUR); cursorPrevious(lt); finishUndo(); @@ -2250,11 +2250,11 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) owner_->showState(); } break; - + case LFUN_NEXTSEL: { LyXText * lt = bv_->getLyXText(); - + update(lt, BufferView::SELECT|BufferView::FITCUR); cursorNext(lt); finishUndo(); @@ -2262,11 +2262,11 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) owner_->showState(); } break; - + case LFUN_HOMESEL: { LyXText * lt = bv_->getLyXText(); - + update(lt, BufferView::SELECT|BufferView::FITCUR); lt->cursorHome(bv_); finishUndo(); @@ -2274,7 +2274,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) owner_->showState(); } break; - + case LFUN_ENDSEL: { LyXText * lt = bv_->getLyXText(); @@ -2286,11 +2286,11 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) owner_->showState(); } break; - + case LFUN_WORDRIGHTSEL: { LyXText * lt = bv_->getLyXText(); - + update(lt, BufferView::SELECT|BufferView::FITCUR); if (lt->cursor.par()->isRightToLeftPar(buffer_->params)) lt->cursorLeftOneWord(bv_); @@ -2301,11 +2301,11 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) owner_->showState(); } break; - + case LFUN_WORDLEFTSEL: { LyXText * lt = bv_->getLyXText(); - + update(lt, BufferView::SELECT|BufferView::FITCUR); if (lt->cursor.par()->isRightToLeftPar(buffer_->params)) lt->cursorRightOneWord(bv_); @@ -2316,11 +2316,11 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) owner_->showState(); } break; - + case LFUN_BEGINNINGBUFSEL: { LyXText * lt = bv_->getLyXText(); - + if (lt->inset_owner) break; update(lt, BufferView::SELECT|BufferView::FITCUR); @@ -2330,11 +2330,11 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) owner_->showState(); } break; - + case LFUN_ENDBUFSEL: { LyXText * lt = bv_->getLyXText(); - + if (lt->inset_owner) break; update(lt, @@ -2360,7 +2360,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) moveCursorUpdate(false); } break; - + case LFUN_PROTECTEDSPACE: { LyXText * lt = bv_->getLyXText(); @@ -2379,7 +2379,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) moveCursorUpdate(false); } break; - + case LFUN_SETMARK: { LyXText * lt = bv_->getLyXText(); @@ -2401,7 +2401,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) lt->selection.cursor = lt->cursor; } break; - + case LFUN_DELETE: { LyXText * lt = bv_->getLyXText(); @@ -2430,7 +2430,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) LyXText * lt = bv_->getLyXText(); // Reverse the effect of LFUN_BREAKPARAGRAPH_SKIP. - + LyXCursor cursor = lt->cursor; if (!lt->selection.set()) { @@ -2444,15 +2444,15 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) (bv_, cursor.par()->params().lineTop(), cursor.par()->params().lineBottom(), - cursor.par()->params().pagebreakTop(), + cursor.par()->params().pagebreakTop(), cursor.par()->params().pagebreakBottom(), - VSpace(VSpace::NONE), + VSpace(VSpace::NONE), cursor.par()->params().spaceBottom(), - cursor.par()->params().spacing(), - cursor.par()->params().align(), + cursor.par()->params().spacing(), + cursor.par()->params().align(), cursor.par()->params().labelWidthString(), 0); lt->cursorLeft(bv_); - update(lt, + update(lt, BufferView::SELECT | BufferView::FITCUR | BufferView::CHANGE); @@ -2492,7 +2492,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) case LFUN_DELETE_WORD_BACKWARD: { LyXText * lt = bv_->getLyXText(); - + update(lt, BufferView::SELECT|BufferView::FITCUR); lt->deleteWordBackward(bv_); update(lt, @@ -2503,12 +2503,12 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) owner_->showState(); } break; - + /* -------> Kill to end of line. */ case LFUN_DELETE_LINE_FORWARD: { LyXText * lt = bv_->getLyXText(); - + update(lt, BufferView::SELECT|BufferView::FITCUR); lt->deleteLineForward(bv_); update(lt, @@ -2518,12 +2518,12 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) moveCursorUpdate(false); } break; - + /* -------> Set mark off. */ case LFUN_MARK_OFF: { LyXText * lt = bv_->getLyXText(); - + beforeChange(lt); update(lt, BufferView::SELECT|BufferView::FITCUR); lt->selection.cursor = lt->cursor; @@ -2535,7 +2535,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) case LFUN_MARK_ON: { LyXText * lt = bv_->getLyXText(); - + beforeChange(lt); lt->selection.mark(true); update(lt, BufferView::SELECT|BufferView::FITCUR); @@ -2543,11 +2543,11 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) owner_->getLyXFunc()->setMessage(N_("Mark on")); } break; - + case LFUN_BACKSPACE: { LyXText * lt = bv_->getLyXText(); - + if (!lt->selection.set()) { if (owner_->getIntl()->getTrans().backspace()) { lt->backspace(bv_); @@ -2572,22 +2572,22 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) { // Reverse the effect of LFUN_BREAKPARAGRAPH_SKIP. LyXText * lt = bv_->getLyXText(); - + LyXCursor cursor = lt->cursor; - + if (!lt->selection.set()) { - if (cursor.pos() == 0 - && !(cursor.par()->params().spaceTop() + if (cursor.pos() == 0 + && !(cursor.par()->params().spaceTop() == VSpace (VSpace::NONE))) { - lt->setParagraph + lt->setParagraph (bv_, - cursor.par()->params().lineTop(), + cursor.par()->params().lineTop(), cursor.par()->params().lineBottom(), - cursor.par()->params().pagebreakTop(), + cursor.par()->params().pagebreakTop(), cursor.par()->params().pagebreakBottom(), VSpace(VSpace::NONE), cursor.par()->params().spaceBottom(), - cursor.par()->params().spacing(), - cursor.par()->params().align(), + cursor.par()->params().spacing(), + cursor.par()->params().align(), cursor.par()->params().labelWidthString(), 0); update(lt, BufferView::SELECT @@ -2609,7 +2609,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) case LFUN_BREAKPARAGRAPH: { LyXText * lt = bv_->getLyXText(); - + beforeChange(lt); lt->breakParagraph(bv_, 0); update(lt, @@ -2625,7 +2625,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) case LFUN_BREAKPARAGRAPHKEEPLAYOUT: { LyXText * lt = bv_->getLyXText(); - + beforeChange(lt); lt->breakParagraph(bv_, 1); update(lt, @@ -2637,16 +2637,16 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) owner_->showState(); break; } - + case LFUN_BREAKPARAGRAPH_SKIP: { // When at the beginning of a paragraph, remove // indentation and add a "defskip" at the top. // Otherwise, do the same as LFUN_BREAKPARAGRAPH. LyXText * lt = bv_->getLyXText(); - + LyXCursor cursor = lt->cursor; - + beforeChange(lt); if (cursor.pos() == 0) { if (cursor.par()->params().spaceTop() == VSpace(VSpace::NONE)) { @@ -2661,7 +2661,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) cursor.par()->params().align(), cursor.par()->params().labelWidthString(), 1); //update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE); - } + } } else { lt->breakParagraph(bv_, 0); @@ -2681,14 +2681,14 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) case LFUN_PARAGRAPH_SPACING: { LyXText * lt = bv_->getLyXText(); - + Paragraph * par = lt->cursor.par(); Spacing::Space cur_spacing = par->params().spacing().getSpace(); float cur_value = 1.0; if (cur_spacing == Spacing::Other) { cur_value = par->params().spacing().getValue(); } - + istringstream istr(argument.c_str()); string tmp; @@ -2727,7 +2727,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) } } break; - + case LFUN_INSET_TOGGLE: { LyXText * lt = bv_->getLyXText(); @@ -2737,7 +2737,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) lt->toggleInset(bv_); update(lt, BufferView::SELECT|BufferView::FITCUR); setState(); - } + } break; case LFUN_QUOTE: @@ -2755,7 +2755,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) owner_->getDialogs()->createUrl(p.getAsString()); } break; - + case LFUN_INSERT_URL: { InsetCommandParams p; @@ -2768,15 +2768,15 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) updateInset(inset, true); } break; - + case LFUN_INSET_ERT: insertAndEditInset(new InsetERT(buffer_->params)); break; - + case LFUN_INSET_EXTERNAL: insertAndEditInset(new InsetExternal); break; - + case LFUN_INSET_FOOTNOTE: insertAndEditInset(new InsetFoot(buffer_->params)); break; @@ -2819,7 +2819,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) lyxerr << "Non-existent float type: " << argument << endl; } - + } break; @@ -2832,7 +2832,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) insertAndEditInset(new InsetTheorem); break; #endif - + case LFUN_INSET_CAPTION: { // Do we have a locking inset... @@ -2852,7 +2852,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) } } break; - + case LFUN_INSET_TABULAR: { int r = 2; @@ -2880,13 +2880,13 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) owner_->getLyXFunc()->setMessage("EOF"); } break; - + case LFUN_GETXY: owner_->getLyXFunc()->setMessage(tostr(bv_->getLyXText()->cursor.x()) + ' ' + tostr(bv_->getLyXText()->cursor.y())); break; - + case LFUN_SETXY: { int x = 0; @@ -2898,26 +2898,26 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) bv_->getLyXText()->setCursorFromCoordinates(bv_, x, y); } break; - + case LFUN_GETLAYOUT: owner_->getLyXFunc()->setMessage(tostr(bv_->getLyXText()->cursor.par()->layout())); break; - + case LFUN_GETFONT: { LyXFont & font = bv_->getLyXText()->current_font; - if (font.shape() == LyXFont::ITALIC_SHAPE) + if (font.shape() == LyXFont::ITALIC_SHAPE) owner_->getLyXFunc()->setMessage("E"); - else if (font.shape() == LyXFont::SMALLCAPS_SHAPE) + else if (font.shape() == LyXFont::SMALLCAPS_SHAPE) owner_->getLyXFunc()->setMessage("N"); - else + else owner_->getLyXFunc()->setMessage("0"); } break; // --- accented characters --------------------------- - + case LFUN_UMLAUT: case LFUN_CIRCUMFLEX: case LFUN_GRAVE: @@ -2948,12 +2948,12 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) | BufferView::CHANGE); } break; - + case LFUN_MATH_MACRO: mathDispatchMathMacro(bv_, argument); break; - case LFUN_MATH_DELIM: + case LFUN_MATH_DELIM: mathDispatchMathDelim(bv_, argument); break; @@ -2973,14 +2973,14 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) mathDispatchMathDisplay(bv_, argument); break; - case LFUN_MATH_MODE: // Open or create an inlined math inset + case LFUN_MATH_MODE: // Open or create an inlined math inset mathDispatchMathMode(bv_, argument); break; - + case LFUN_GREEK: // Insert a single greek letter mathDispatchGreek(bv_, argument); break; - + case LFUN_CITATION_INSERT: { InsetCommandParams p; @@ -2993,18 +2993,18 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) updateInset(inset, true); } break; - + case LFUN_INSERT_BIBTEX: - { + { // ale970405+lasgoutt970425 - // The argument can be up to two tokens separated + // The argument can be up to two tokens separated // by a space. The first one is the bibstyle. string const db = token(argument, ' ', 0); string const bibstyle = token(argument, ' ', 1); InsetCommandParams p("BibTeX", db, bibstyle); InsetBibtex * inset = new InsetBibtex(p); - + if (insertInset(inset)) { if (argument.empty()) inset->edit(bv_); @@ -3012,38 +3012,38 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) delete inset; } break; - + // BibTeX data bases case LFUN_BIBDB_ADD: { - InsetBibtex * inset = + InsetBibtex * inset = static_cast(getInsetByCode(Inset::BIBTEX_CODE)); if (inset) { inset->addDatabase(argument); } } break; - + case LFUN_BIBDB_DEL: { - InsetBibtex * inset = + InsetBibtex * inset = static_cast(getInsetByCode(Inset::BIBTEX_CODE)); if (inset) { inset->delDatabase(argument); } } break; - + case LFUN_BIBTEX_STYLE: { - InsetBibtex * inset = + InsetBibtex * inset = static_cast(getInsetByCode(Inset::BIBTEX_CODE)); if (inset) { inset->setOptions(argument); } } break; - + case LFUN_INDEX_CREATE: { InsetCommandParams p("index"); @@ -3057,7 +3057,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) owner_->getDialogs()->createIndex(p.getAsString()); } break; - + case LFUN_INDEX_INSERT: { InsetCommandParams p; @@ -3070,7 +3070,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) updateInset(inset, true); } break; - + case LFUN_INDEX_INSERT_LAST: { string const idxstring(bv_->getLyXText()->getStringToIndex(bv_)); @@ -3079,7 +3079,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) + idxstring + _(("' indexed."))); InsetCommandParams p("index", idxstring); InsetIndex * inset = new InsetIndex(p); - + if (!insertInset(inset)) delete inset; else @@ -3104,7 +3104,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) if (!insertInset(inset, "Standard")) delete inset; } - + break; case LFUN_CHILD_INSERT: @@ -3121,7 +3121,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) bv_->owner()->getDialogs()->showInclude(inset); } } - break; + break; case LFUN_FLOAT_LIST: { @@ -3131,7 +3131,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) delete inset; } break; - + case LFUN_THESAURUS_ENTRY: { string arg = argument; @@ -3139,7 +3139,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) if (arg.empty()) { arg = bv_->getLyXText()->selectionAsString(buffer_, false); - + // FIXME if (arg.size() > 100 || arg.empty()) { // Get word or selection @@ -3152,11 +3152,11 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) bv_->owner()->getDialogs()->showThesaurus(arg); } break; - + case LFUN_SELFINSERT: { if (argument.empty()) break; - + /* Automatically delete the currently selected * text and replace it with what is being * typed in now. Depends on lyxrc settings @@ -3164,7 +3164,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) * true (on). */ LyXText * lt = bv_->getLyXText(); - + if (lyxrc.auto_region_delete) { if (lt->selection.set()) { lt->cutSelection(bv_, false, false); @@ -3175,24 +3175,24 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) } workarea_.haveSelection(false); } - + beforeChange(lt); LyXFont const old_font(lt->real_current_font); - + string::const_iterator cit = argument.begin(); string::const_iterator end = argument.end(); for (; cit != end; ++cit) { owner_->getIntl()->getTrans().TranslateAndInsert(*cit, lt); } - + bv_->update(lt, BufferView::SELECT | BufferView::FITCUR | BufferView::CHANGE); - + lt->selection.cursor = lt->cursor; moveCursorUpdate(false); - + // real_current_font.number can change so we need to // update the minibuffer if (old_font != lt->real_current_font) @@ -3209,14 +3209,14 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) string arg; if (!argument.empty()) arg = argument; - else + else arg = lyxrc.date_insert_format; char datetmp[32]; int const datetmp_len = ::strftime(datetmp, 32, arg.c_str(), now_tm); LyXText * lt = bv_->getLyXText(); - + for (int i = 0; i < datetmp_len; i++) { lt->insertChar(bv_, datetmp[i]); update(lt, @@ -3233,7 +3233,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) case LFUN_UNKNOWN_ACTION: owner_->getLyXFunc()->setErrorMessage(N_("Unknown function!")); break; - + default: return false; } // end of switch @@ -3280,10 +3280,10 @@ void BufferView::Pimpl::specialChar(InsetSpecialChar::Kind kind) { if (available()) { LyXText * lt = bv_->getLyXText(); - + hideCursor(); update(lt, BufferView::SELECT|BufferView::FITCUR); - InsetSpecialChar * new_inset = + InsetSpecialChar * new_inset = new InsetSpecialChar(kind); if (!insertInset(new_inset)) delete new_inset; @@ -3306,13 +3306,13 @@ void BufferView::Pimpl::smartQuote() c = ' '; else c = par->getChar(pos - 1); - + hideCursor(); LyXLayout const & style = textclasslist[bv_->buffer()->params.textclass][par->layout()]; - + if (style.pass_thru || (!insertInset(new InsetQuotes(c, bv_->buffer()->params)))) bv_->owner()->getLyXFunc()->dispatch(LFUN_SELFINSERT, "\""); @@ -3327,12 +3327,12 @@ void BufferView::Pimpl::insertAndEditInset(Inset * inset) delete inset; } - + // Open and lock an updatable inset bool BufferView::Pimpl::open_new_inset(UpdatableInset * new_inset, bool behind) { LyXText * lt = bv_->getLyXText(); - + beforeChange(lt); finishUndo(); if (!insertInset(new_inset)) { @@ -3357,7 +3357,7 @@ bool BufferView::Pimpl::insertInset(Inset * inset, string const & lout) // not quite sure if we want this... setCursorParUndo(bv_); freezeUndo(); - + beforeChange(bv_->text); if (!lout.empty()) { update(bv_->text, BufferView::SELECT|BufferView::FITCUR); @@ -3366,7 +3366,7 @@ bool BufferView::Pimpl::insertInset(Inset * inset, string const & lout) if (bv_->text->cursor.par()->size()) { bv_->text->cursorLeft(bv_); - + bv_->text->breakParagraph(bv_); update(bv_->text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE); } @@ -3386,17 +3386,17 @@ bool BufferView::Pimpl::insertInset(Inset * inset, string const & lout) } bv_->text->setLayout(bv_, lay); - + bv_->text->setParagraph(bv_, 0, 0, 0, 0, VSpace(VSpace::NONE), VSpace(VSpace::NONE), Spacing(), - LYX_ALIGN_LAYOUT, + LYX_ALIGN_LAYOUT, string(), 0); update(bv_->text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE); } - + bv_->text->insertInset(bv_, inset); update(bv_->text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE); @@ -3432,7 +3432,7 @@ void BufferView::Pimpl::updateInset(Inset * inset, bool mark_dirty) } } } - + // then check if the inset is a top_level inset (has no owner) // if yes do the update as always otherwise we have to update the // toplevel inset where this inset is inside @@ -3468,13 +3468,13 @@ void BufferView::Pimpl::gotoInset(vector const & codes, bool same_content) { if (!available()) return; - + hideCursor(); beforeChange(bv_->text); update(bv_->text, BufferView::SELECT|BufferView::FITCUR); - + LyXCursor const & cursor = bv_->text->cursor; - + string contents; if (same_content && cursor.par()->isInset(cursor.pos())) { @@ -3484,10 +3484,10 @@ void BufferView::Pimpl::gotoInset(vector const & codes, contents = static_cast(inset)->getContents(); } - - + + if (!bv_->text->gotoNextInset(bv_, codes, contents)) { - if (bv_->text->cursor.pos() + if (bv_->text->cursor.pos() || bv_->text->cursor.par() != bv_->text->ownerParagraph()) { LyXCursor tmp = bv_->text->cursor; bv_->text->cursor.par(bv_->text->ownerParagraph()); diff --git a/src/BufferView_pimpl.h b/src/BufferView_pimpl.h index 91923563d0..9391bb6d2f 100644 --- a/src/BufferView_pimpl.h +++ b/src/BufferView_pimpl.h @@ -46,7 +46,7 @@ struct BufferView::Pimpl : public SigC::Object { void update(); // void update(LyXText *, BufferView::UpdateCodes); - /// Update pixmap of screen + /// Update pixmap of screen void updateScreen(); /// void workAreaExpose(); @@ -60,7 +60,7 @@ struct BufferView::Pimpl : public SigC::Object { * If hit, the coordinates are changed relative to the inset. */ Inset * checkInsetHit(LyXText *, int & x, int & y); - /// + /// int scrollUp(long time); /// int scrollDown(long time); @@ -143,12 +143,12 @@ private: * if one exists. If so, the inset is returned, and the co-ordinates are * made relative. Otherwise, 0 is returned. */ - Inset * checkInset(LyXText const & text, LyXCursor const & cursor, int & x, int & y) const; + Inset * checkInset(LyXText const & text, LyXCursor const & cursor, int & x, int & y) const; /// friend class BufferView; /// open and lock an updatable inset bool open_new_inset(UpdatableInset * new_inset, bool behind = false); - /// + /// void specialChar(InsetSpecialChar::Kind); /// void newline(); @@ -201,7 +201,7 @@ private: std::vector saved_positions; /// void moveCursorUpdate(bool selecting); - /// Get next inset of this class from current cursor position + /// Get next inset of this class from current cursor position Inset * getInsetByCode(Inset::Code code); /// void MenuInsertLyXFile(string const & filen); diff --git a/src/Bullet.C b/src/Bullet.C index b53040a9e3..8bc3d874eb 100644 --- a/src/Bullet.C +++ b/src/Bullet.C @@ -3,7 +3,7 @@ * generate the bullets in the bullet-panel's. * * This file is part of - * ====================================================== + * ====================================================== * * LyX, The Document Processor * @@ -54,7 +54,7 @@ Bullet::Bullet(int f, int c, int s) -Bullet::Bullet(string const & t) +Bullet::Bullet(string const & t) : font(MIN), character(MIN), size(MIN), user_text(1), text(t) { #ifdef ENABLE_ASSERTIONS @@ -215,7 +215,7 @@ string const Bullet::bulletSize(int s) // See additional comments in bulletEntry() below. static char const * BulletSize[SIZEMAX] = { - "\\tiny", "\\scriptsize", "\\footnotesize", "\\small", "\\normalsize", + "\\tiny", "\\scriptsize", "\\footnotesize", "\\small", "\\normalsize", "\\large", "\\Large", "\\LARGE", "\\huge", "\\Huge" }; @@ -238,10 +238,10 @@ string const Bullet::bulletEntry(int f, int c) // to get around a compiler bug in an earler version of gcc (< 2.7.2.1) // static string const BulletPanels[FONTMAX][CHARMAX] = { static char const * BulletPanel0[CHARMAX] = { - /* standard */ + /* standard */ "\\normalfont\\bfseries{--}", "\\(\\vdash\\)", "\\(\\dashv\\)", "\\(\\flat\\)", "\\(\\natural\\)", - "\\(\\sharp\\)", "\\(\\ast\\)", "\\(\\star\\)", + "\\(\\sharp\\)", "\\(\\ast\\)", "\\(\\star\\)", "\\(\\bullet\\)", "\\(\\circ\\)", "\\(\\cdot\\)", "\\(\\dagger\\)", "\\(\\bigtriangleup\\)", "\\(\\bigtriangledown\\)", "\\(\\triangleleft\\)", @@ -249,9 +249,9 @@ string const Bullet::bulletEntry(int f, int c) "\\(\\oplus\\)", "\\(\\ominus\\)", "\\(\\otimes\\)", "\\(\\oslash\\)", "\\(\\odot\\)", "\\(\\spadesuit\\)", "\\(\\diamond\\)", "\\(\\Diamond\\)", "\\(\\Box\\)", - "\\(\\diamondsuit\\)", "\\(\\heartsuit\\)", + "\\(\\diamondsuit\\)", "\\(\\heartsuit\\)", "\\(\\clubsuit\\)", "\\(\\rightarrow\\)", "\\(\\leadsto\\)", - "\\(\\rightharpoonup\\)", "\\(\\rightharpoondown\\)", + "\\(\\rightharpoonup\\)", "\\(\\rightharpoondown\\)", "\\(\\Rightarrow\\)", "\\(\\succ\\)" }; static char const * BulletPanel1[CHARMAX] = { diff --git a/src/Bullet.h b/src/Bullet.h index cc95508570..9e516e1cd4 100644 --- a/src/Bullet.h +++ b/src/Bullet.h @@ -1,7 +1,7 @@ // -*- C++ -*- /* This is the bullet class definition file. * This file is part of - * ====================================================== + * ====================================================== * * LyX, The Document Processor * @@ -60,7 +60,7 @@ private: This enum makes adding additional panels or changing panel sizes easier. Since you only need change these values for all tests to be correct for the new values. - + Note: MAX means the size of the array so to test you need: (x < MAX) *not* (x <= MAX) */ @@ -74,33 +74,33 @@ private: /// SIZEMAX = 10 }; - + /// void generateText() const; /// static string const bulletSize(int); /// static string const bulletEntry(int, int); - + /// int font; /// int character; /// int size; - - // size, character and font are array indices to access + + // size, character and font are array indices to access // the predefined arrays of LaTeX equivalent strings. - + /** flag indicates if user has control of text (1) or if I can use it to generate strings (0) or have already (-1) */ - mutable short user_text; - + mutable short user_text; + //NOTE: Arranging these four shorts above to be together // like this should ensure they are in a single cache line - + /** text may contain a user-defined LaTeX symbol command or one generated internally from the font, character and size settings. diff --git a/src/ChangeLog b/src/ChangeLog index 749542c577..fa36e0dfb1 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,7 @@ 2002-03-21 Lars Gullik Bjønnes + * most files: ws cleanup + * buffer.[Ch]: ws changes * Makefile.am (LYX_CONV_LIBS): remove ld -r stuff. diff --git a/src/Chktex.C b/src/Chktex.C index 6b86ed6850..ac08ba8879 100644 --- a/src/Chktex.C +++ b/src/Chktex.C @@ -1,14 +1,14 @@ /* This file is part of - * ====================================================== - * - * LyX, The Document Processor + * ====================================================== + * + * LyX, The Document Processor * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team. * * This file is Copyright 1997-1998 * Asger Alstrup * - * ====================================================== + * ====================================================== */ #include @@ -49,7 +49,7 @@ int Chktex::run(TeXErrors &terr) // run bibtex string log = OnlyFilename(ChangeExtension(file, ".log")); string tmp = cmd + " -q -v0 -b0 -x " + file + " -o " + log; - Systemcall one; + Systemcall one; int result= one.startscript(Systemcall::Wait, tmp); if (result == 0) { result = scanLogFile(terr); diff --git a/src/Chktex.h b/src/Chktex.h index 97c99f09cf..5ad8af2cca 100644 --- a/src/Chktex.h +++ b/src/Chktex.h @@ -1,7 +1,7 @@ // -*- C++ -*- /* This file is part of - * ====================================================== - * + * ====================================================== + * * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich @@ -10,7 +10,7 @@ * This file is Copyright 1997 * Asger Alstrup * - * ====================================================== + * ====================================================== */ #ifndef CHKTEX_H @@ -35,7 +35,7 @@ public: */ Chktex(string const & cmd, string const & file, string const & path); - + /** Runs chktex. @return -1 if fail, number of messages otherwise. */ @@ -49,7 +49,7 @@ private: /// string file; - + /// string path; }; diff --git a/src/ColorHandler.C b/src/ColorHandler.C index 416f09fea7..6a1f333ab4 100644 --- a/src/ColorHandler.C +++ b/src/ColorHandler.C @@ -1,8 +1,8 @@ /* This file is part of * ====================================================== - * + * * LyX, The Document Processor - * + * * Copyright 1998-2001 The LyX Team * *======================================================*/ @@ -25,14 +25,14 @@ using std::endl; -LyXColorHandler::LyXColorHandler() +LyXColorHandler::LyXColorHandler() { display = GUIRunTime::x11Display(); drawable = XCreatePixmap(display, RootWindow(display, GUIRunTime::x11Screen()), 10, 10, GUIRunTime::x11VisualDepth()); - + colormap = GUIRunTime::x11Colormap(); // Clear the GC cache for (int i = 0; i <= LColor::ignore; ++i) { @@ -72,8 +72,8 @@ GC LyXColorHandler::getGCForeground(LColor::color c) //if (lyxerr.debugging()) { // lyxerr << "Painter drawable: " << drawable() << endl; //} - - if (colorGCcache[c] != 0) + + if (colorGCcache[c] != 0) return colorGCcache[c]; XColor xcol; @@ -83,7 +83,7 @@ GC LyXColorHandler::getGCForeground(LColor::color c) // Look up the RGB values for the color, and an approximate // color that we can hope to get on this display. - if (XLookupColor(display, colormap, s.c_str(), &xcol, &ccol) == 0) { + if (XLookupColor(display, colormap, s.c_str(), &xcol, &ccol) == 0) { lyxerr << _("LyX: Unknown X11 color ") << s << _(" for ") << lcolor.getGUIName(c) << '\n' << _(" Using black instead, sorry!") << endl; @@ -94,7 +94,7 @@ GC LyXColorHandler::getGCForeground(LColor::color c) } else if (XAllocColor(display, colormap, &xcol) != 0) { if (lyxerr.debugging(Debug::GUI)) { lyxerr << _("LyX: X11 color ") << s - << _(" allocated for ") + << _(" allocated for ") << lcolor.getGUIName(c) << endl; } val.foreground = xcol.pixel; @@ -120,13 +120,13 @@ GC LyXColorHandler::getGCForeground(LColor::color c) double closest_distance = 1e20; // we want to minimize this double distance = 0; for (int t = 0; t < vi->map_entries; ++t) { - // The Euclidean distance between two points in + // The Euclidean distance between two points in // a three-dimensional space, the RGB color-cube, // is used as the distance measurement between two // colors. // Since square-root is monotonous, we don't have to - // take the square-root to find the minimum, and thus + // take the square-root to find the minimum, and thus // we use the squared distance instead to be faster. // If we want to get fancy, we could convert the RGB @@ -140,17 +140,17 @@ GC LyXColorHandler::getGCForeground(LColor::color c) closest_pixel = t; } } - lyxerr << _("LyX: Couldn't allocate '") << s + lyxerr << _("LyX: Couldn't allocate '") << s << _("' for ") << lcolor.getGUIName(c) - << _(" with (r,g,b)=(") + << _(" with (r,g,b)=(") << xcol.red << "," << xcol.green << "," << xcol.blue << ").\n" << _(" Using closest allocated " - "color with (r,g,b)=(") + "color with (r,g,b)=(") << cmap[closest_pixel].red << "," << cmap[closest_pixel].green << "," << cmap[closest_pixel].blue << _(") instead.\n") - << _("Pixel [") << closest_pixel << _("] is used.") + << _("Pixel [") << closest_pixel << _("] is used.") << endl; val.foreground = cmap[closest_pixel].pixel; } @@ -168,7 +168,7 @@ GC LyXColorHandler::getGCLinepars(PainterBase::line_style ls, //if (lyxerr.debugging()) { // lyxerr << "Painter drawable: " << drawable() << endl; //} - + int index = lw + (ls << 1) + (c << 6); LineGCCache::iterator it = lineGCcache.find(index); @@ -177,7 +177,7 @@ GC LyXColorHandler::getGCLinepars(PainterBase::line_style ls, XGCValues val; XGetGCValues(display, getGCForeground(c), GCForeground, &val); - + switch (lw) { case PainterBase::line_thin: val.line_width = 0; @@ -186,7 +186,7 @@ GC LyXColorHandler::getGCLinepars(PainterBase::line_style ls, val.line_width = 2; break; } - + switch (ls) { case PainterBase::line_solid: val.line_style = LineSolid; @@ -205,8 +205,8 @@ GC LyXColorHandler::getGCLinepars(PainterBase::line_style ls, val.function = GXcopy; return lineGCcache[index] = - XCreateGC(display, drawable, - GCForeground | GCLineStyle | GCLineWidth | + XCreateGC(display, drawable, + GCForeground | GCLineStyle | GCLineWidth | GCCapStyle | GCJoinStyle | GCFunction, &val); } @@ -236,7 +236,7 @@ void LyXColorHandler::updateColor (LColor::color c) PainterBase::line_width(lw), c); } } - + } // diff --git a/src/ColorHandler.h b/src/ColorHandler.h index 6a74288f4f..185f03dcd7 100644 --- a/src/ColorHandler.h +++ b/src/ColorHandler.h @@ -1,9 +1,9 @@ // -*- C++ -*- /* This file is part of * ====================================================== - * + * * LyX, The Document Processor - * + * * Copyright 1995-2001 The LyX Team * * ======================================================*/ diff --git a/src/CutAndPaste.C b/src/CutAndPaste.C index a18806898a..4fd6363155 100644 --- a/src/CutAndPaste.C +++ b/src/CutAndPaste.C @@ -1,8 +1,8 @@ /* This file is part of * ====================================================== - * + * * LyX, The Document Processor - * + * * Copyright 1995-2001 The LyX Team. * * ====================================================== */ @@ -65,9 +65,9 @@ void DeleteBuffer() { if (!buf) return; - + Paragraph * tmppar; - + while (buf) { tmppar = buf; buf = buf->next(); @@ -80,17 +80,17 @@ void DeleteBuffer() bool CutAndPaste::cutSelection(Paragraph * startpar, Paragraph ** endpar, - int start, int & end, char tc, bool doclear, + int start, int & end, char tc, bool doclear, bool realcut) { if (!startpar || (start > startpar->size())) return false; - + if (realcut) DeleteBuffer(); - + textclass = tc; - + if (!(*endpar) || startpar == (*endpar)) { // only within one paragraph if (realcut) { @@ -103,7 +103,7 @@ bool CutAndPaste::cutSelection(Paragraph * startpar, Paragraph ** endpar, for (; i < end; ++i) { if (realcut) startpar->copyIntoMinibuffer(*current_view->buffer(), - start); + start); startpar->erase(start); if (realcut) buf->insertFromMinibuffer(buf->size()); @@ -112,13 +112,13 @@ bool CutAndPaste::cutSelection(Paragraph * startpar, Paragraph ** endpar, } else { // more than one paragraph (*endpar)->breakParagraphConservative(current_view->buffer()->params, - end); + end); *endpar = (*endpar)->next(); end = 0; - + startpar->breakParagraphConservative(current_view->buffer()->params, - start); - + start); + // store the selection if (realcut) { buf = startpar->next(); @@ -127,12 +127,12 @@ bool CutAndPaste::cutSelection(Paragraph * startpar, Paragraph ** endpar, startpar->next()->previous(0); } (*endpar)->previous()->next(0); - + // cut the selection startpar->next(*endpar); - + (*endpar)->previous(startpar); - + // the cut selection should begin with standard layout if (realcut) { buf->params().clear(); @@ -160,15 +160,15 @@ bool CutAndPaste::cutSelection(Paragraph * startpar, Paragraph ** endpar, bool CutAndPaste::copySelection(Paragraph * startpar, Paragraph * endpar, - int start, int end, char tc) + int start, int end, char tc) { if (!startpar || (start > startpar->size())) return false; - + DeleteBuffer(); - + textclass = tc; - + if (!endpar || startpar == endpar) { // only within one paragraph buf = new Paragraph; @@ -186,7 +186,7 @@ bool CutAndPaste::copySelection(Paragraph * startpar, Paragraph * endpar, Paragraph * tmppar = startpar; buf = new Paragraph(*tmppar, false); Paragraph * tmppar2 = buf; - + while (tmppar != endpar && tmppar->next()) { tmppar = tmppar->next(); @@ -195,12 +195,12 @@ bool CutAndPaste::copySelection(Paragraph * startpar, Paragraph * endpar, tmppar2 = tmppar2->next(); } tmppar2->next(0); - + // the buf paragraph is too big pos_type tmpi2 = start; for (; tmpi2; --tmpi2) buf->erase(0); - + // now tmppar 2 is too big, delete all after end tmpi2 = end; while (tmppar2->size() > tmpi2) { @@ -218,14 +218,14 @@ bool CutAndPaste::copySelection(Paragraph * startpar, Paragraph * endpar, bool CutAndPaste::pasteSelection(Paragraph ** par, Paragraph ** endpar, - int & pos, char tc) + int & pos, char tc) { if (!checkPastePossible(*par)) return false; - + if (pos > (*par)->size()) pos = (*par)->size(); - + #if 0 // Paragraph * tmpbuf; Paragraph * tmppar = *par; @@ -235,7 +235,7 @@ bool CutAndPaste::pasteSelection(Paragraph ** par, Paragraph ** endpar, if (!buf->next()) { // only within a paragraph Paragraph * tmpbuf = new Paragraph(*buf, false); - + // Some provisions should be done here for checking // if we are inserting at the beginning of a // paragraph. If there are a space at the beginning @@ -263,12 +263,12 @@ bool CutAndPaste::pasteSelection(Paragraph ** par, Paragraph ** endpar, #endif { // many paragraphs - + // make a copy of the simple cut_buffer Paragraph * tmpbuf = buf; Paragraph * simple_cut_clone = new Paragraph(*tmpbuf, false); Paragraph * tmpbuf2 = simple_cut_clone; - + while (tmpbuf->next()) { tmpbuf = tmpbuf->next(); tmpbuf2->next(new Paragraph(*tmpbuf, false)); @@ -321,42 +321,42 @@ bool CutAndPaste::pasteSelection(Paragraph ** par, Paragraph ** endpar, } // now reset it to 0 buf->previous(0); - + // make sure there is no class difference SwitchLayoutsBetweenClasses(textclass, tc, buf, - current_view->buffer()->params); - + current_view->buffer()->params); + // make the buf exactly the same layout than // the cursor paragraph buf->makeSameLayout(*par); - + // find the end of the buffer Paragraph * lastbuffer = buf; while (lastbuffer->next()) lastbuffer = lastbuffer->next(); - + bool paste_the_end = false; - + // open the paragraph for inserting the buf // if necessary if (((*par)->size() > pos) || !(*par)->next()) { (*par)->breakParagraphConservative(current_view->buffer()->params, - pos); + pos); paste_the_end = true; } // set the end for redoing later *endpar = (*par)->next()->next(); - + // paste it! lastbuffer->next((*par)->next()); (*par)->next()->previous(lastbuffer); - + (*par)->next(buf); buf->previous(*par); - + if ((*par)->next() == lastbuffer) lastbuffer = *par; - + (*par)->pasteParagraph(current_view->buffer()->params); // store the new cursor position *par = lastbuffer; @@ -377,7 +377,7 @@ bool CutAndPaste::pasteSelection(Paragraph ** par, Paragraph ** endpar, // restore the simple cut buffer buf = simple_cut_clone; } - + return true; } @@ -386,7 +386,7 @@ int CutAndPaste::nrOfParagraphs() { if (!buf) return 0; - + int n = 1; Paragraph * tmppar = buf; while (tmppar->next()) { @@ -411,9 +411,9 @@ int CutAndPaste::SwitchLayoutsBetweenClasses(textclass_type c1, par = *it; string const name = par->layout(); LyXTextClass const & tclass = textclasslist[c2]; - + bool hasLayout = tclass.hasLayout(name); - + string lay = tclass.defaultLayoutName(); if (hasLayout) { lay = name; @@ -422,7 +422,7 @@ int CutAndPaste::SwitchLayoutsBetweenClasses(textclass_type c1, lay = tclass.defaultLayoutName(); } par->layout(lay); - + if (name != par->layout()) { ++ret; string const s = _("Layout had to be changed from\n") @@ -447,6 +447,6 @@ int CutAndPaste::SwitchLayoutsBetweenClasses(textclass_type c1, bool CutAndPaste::checkPastePossible(Paragraph *) { if (!buf) return false; - + return true; } diff --git a/src/CutAndPaste.h b/src/CutAndPaste.h index 32f9a767bf..4874d1b17d 100644 --- a/src/CutAndPaste.h +++ b/src/CutAndPaste.h @@ -1,9 +1,9 @@ // -*- C++ -*- /* This file is part of - * ====================================================== - * + * ====================================================== + * * LyX, The Document Processor - * + * * Copyright 1995-2001 the LyX Team. * * ====================================================== */ @@ -40,13 +40,13 @@ public: static int nrOfParagraphs(); /** needed to switch between different classes this works - for a list of paragraphs beginning with the specified par + for a list of paragraphs beginning with the specified par return value is the number of wrong conversions */ static int SwitchLayoutsBetweenClasses(lyx::textclass_type class1, - lyx::textclass_type class2, - Paragraph * par, + lyx::textclass_type class2, + Paragraph * par, BufferParams const & bparams); /// static diff --git a/src/DepTable.C b/src/DepTable.C index 1f409c9bb0..bf986c18d6 100644 --- a/src/DepTable.C +++ b/src/DepTable.C @@ -1,6 +1,6 @@ /* This file is part of - * ====================================================== - * + * ====================================================== + * * LyX, The Document Processor * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team. @@ -9,7 +9,7 @@ * Lars Gullik Bjønnes * Ben Stanley * - * ====================================================== + * ====================================================== */ #include @@ -68,7 +68,7 @@ void DepTable::insert(string const & fi, bool upd) lyxerr[Debug::DEPEND] << " Already in DepTable" << endl; } } - + void DepTable::update() { @@ -94,13 +94,13 @@ void DepTable::update() // file doesn't exist // remove stale files - if it's re-created, it // will be re-inserted by deplog. - lyxerr[Debug::DEPEND] << itr->first + lyxerr[Debug::DEPEND] << itr->first << " doesn't exist. removing from DepTable." << endl; DepList::iterator doomed = itr++; deplist.erase(doomed); continue; } - + if (lyxerr.debugging(Debug::DEPEND)) { if (di.changed()) lyxerr << " +"; @@ -238,7 +238,7 @@ void DepTable::read(string const & f) dep_info di; // This doesn't change through the loop. di.crc_prev = 0; - + while (ifs >> nome >> di.crc_cur >> di.mtime_cur) { if (lyxerr.debugging(Debug::DEPEND)) { lyxerr << "Read dep: " @@ -249,4 +249,3 @@ void DepTable::read(string const & f) deplist[nome] = di; } } - diff --git a/src/DepTable.h b/src/DepTable.h index 79bc2ca013..e9a12a6fad 100644 --- a/src/DepTable.h +++ b/src/DepTable.h @@ -1,16 +1,16 @@ // -*- C++ -*- /* This file is part of - * ====================================================== - * + * ====================================================== + * * LyX, The Document Processor * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team. - * + * * This file is Copyright 1996-2001 * Lars Gullik Bjønnes * Ben Stanley * - * ====================================================== + * ====================================================== */ #ifndef DEP_TABLE_H @@ -71,4 +71,3 @@ private: }; #endif - diff --git a/src/FloatList.C b/src/FloatList.C index 0d697910f6..d6c29868a6 100644 --- a/src/FloatList.C +++ b/src/FloatList.C @@ -27,7 +27,7 @@ FloatList::FloatList() { // Insert the latex builtin float-types // (these will later be read from a layout file) - + // table Floating table("table", "htbp", "lot", "", "plain", "Table", true); newFloat(table); @@ -35,7 +35,7 @@ FloatList::FloatList() // figure Floating figure("figure", "htbp", "lof", "", "plain", "Figure", true); newFloat(figure); - + // And we add algorithm too since LyX has // supported that for a long time, // but support for this should probably be moved to a layout file. @@ -45,13 +45,13 @@ FloatList::FloatList() } -FloatList::const_iterator FloatList::begin() const +FloatList::const_iterator FloatList::begin() const { return list.begin(); } -FloatList::const_iterator FloatList::end() const +FloatList::const_iterator FloatList::end() const { return list.end(); } diff --git a/src/FloatList.h b/src/FloatList.h index a2b9860fae..42aca7bc29 100644 --- a/src/FloatList.h +++ b/src/FloatList.h @@ -1,7 +1,7 @@ // -*- C++ -*- /* This file is part of * ====================================================== - * + * * LyX, The Document Processor * * Copyright 1998-2001 The LyX Team. diff --git a/src/Floating.C b/src/Floating.C index e06c0aa3e3..e4e528014e 100644 --- a/src/Floating.C +++ b/src/Floating.C @@ -1,6 +1,6 @@ /* This file is part of * ====================================================== - * + * * LyX, The Document Processor * * Copyright 1998-2001 The LyX Team. @@ -17,7 +17,7 @@ #include "Floating.h" -Floating::Floating() +Floating::Floating() {} diff --git a/src/Floating.h b/src/Floating.h index b9c7eb8e4e..2f0e5270f6 100644 --- a/src/Floating.h +++ b/src/Floating.h @@ -1,7 +1,7 @@ // -*- C++ -*- /* This file is part of * ====================================================== - * + * * LyX, The Document Processor * * Copyright 1998-2001 The LyX Team. diff --git a/src/FontInfo.C b/src/FontInfo.C index 3cb9af0911..c9dd2e1839 100644 --- a/src/FontInfo.C +++ b/src/FontInfo.C @@ -1,8 +1,8 @@ /* This file is part of - * ====================================================== - * + * ====================================================== + * * LyX, The Document Processor - * + * * Copyright 1997 Asger Alstrup * and the LyX Team. * @@ -67,13 +67,13 @@ string const FontInfo::getFontname(int size) // We use the closest match lyxerr[Debug::FONT] << "Using closest font match to get size " - << size + << size << " with\n" << strings[closestind] << endl; return strings[closestind]; } -/// Build newly sized font string +/// Build newly sized font string string const FontInfo::resize(string const & font, int size) const { string ret(font); @@ -134,7 +134,7 @@ void FontInfo::query() for (int i = 0; i < matches; ++i) { string name(list[i]); lyxerr[Debug::FONT] << "match #" << i << " " - << name << endl; + << name << endl; sizes[i] = lyx::atoi(token(name, '-', 7)); strings[i] = name; if (sizes[i] == 0) { diff --git a/src/FontInfo.h b/src/FontInfo.h index 13e3470897..7f4af1d4c7 100644 --- a/src/FontInfo.h +++ b/src/FontInfo.h @@ -1,16 +1,16 @@ // -*- C++ -*- /* This file is part of * ====================================================== - * + * * LyX, The Document Processor - * + * * Copyright 1997 Asger Alstrup * and the LyX Team. * * ====================================================== */ #ifndef FONTINFO_H -#define FONTINFO_H +#define FONTINFO_H #ifdef __GNUG__ #pragma interface @@ -21,7 +21,7 @@ #include /** This class manages a font. - The idea is to create a FontInfo object with a font name pattern with a + The idea is to create a FontInfo object with a font name pattern with a wildcard at the size field. Then this object can host request for font- instances of any given size. If no exact match is found, the closest size is chosen instead. If the font is scalable, the flag @@ -86,7 +86,7 @@ private: /// Ask X11 about this font pattern void query(); - /// Build newly sized font string + /// Build newly sized font string string const resize(string const &, int size) const; }; #endif diff --git a/src/FontLoader.C b/src/FontLoader.C index b75d165e91..7567dde5be 100644 --- a/src/FontLoader.C +++ b/src/FontLoader.C @@ -1,8 +1,8 @@ /* This file is part of - * ====================================================== - * + * ====================================================== + * * LyX, The Document Processor - * + * * Copyright 1997 Asger Alstrup * and the LyX Team. * @@ -72,7 +72,7 @@ void FontLoader::reset() // Unload all fonts -void FontLoader::unload() +void FontLoader::unload() { // Unload all fonts for (int i1 = 0; i1 < LyXFont::NUM_FAMILIES; ++i1) @@ -95,8 +95,8 @@ void FontLoader::unload() // Get font info /* Takes care of finding which font that can match the given request. Tries different alternatives. */ -void FontLoader::getFontinfo(LyXFont::FONT_FAMILY family, - LyXFont::FONT_SERIES series, +void FontLoader::getFontinfo(LyXFont::FONT_FAMILY family, + LyXFont::FONT_SERIES series, LyXFont::FONT_SHAPE shape) { // Do we have the font info already? @@ -104,7 +104,7 @@ void FontLoader::getFontinfo(LyXFont::FONT_FAMILY family, return; // Special fonts - switch (family) + switch (family) { case LyXFont::SYMBOL_FAMILY: fontinfo[family][series][shape] = @@ -137,19 +137,19 @@ void FontLoader::getFontinfo(LyXFont::FONT_FAMILY family, return; case LyXFont::MSB_FAMILY: - fontinfo[family][series][shape] = + fontinfo[family][series][shape] = new FontInfo("-*-msbm10-*-*-*-*-*-*-*-*-*-*-*-*"); return; case LyXFont::EUFRAK_FAMILY: - fontinfo[family][series][shape] = + fontinfo[family][series][shape] = new FontInfo("-*-eufm10-medium-*-*-*-*-*-*-*-*-*-*-*"); return; default: break; } - + // Normal font. Let's search for an existing name that matches. string ffamily; @@ -259,19 +259,19 @@ bool dummyXFontStructisGood = false; } // namespace anon /// Do load font -XFontStruct * FontLoader::doLoad(LyXFont::FONT_FAMILY family, - LyXFont::FONT_SERIES series, - LyXFont::FONT_SHAPE shape, +XFontStruct * FontLoader::doLoad(LyXFont::FONT_FAMILY family, + LyXFont::FONT_SERIES series, + LyXFont::FONT_SHAPE shape, LyXFont::FONT_SIZE size) { if (!lyxrc.use_gui) { if (!dummyXFontStructisGood) { // no character specific info - dummyXFontStruct.per_char = 0; + dummyXFontStruct.per_char = 0; // unit ascent on character displays - dummyXFontStruct.ascent = 1; + dummyXFontStruct.ascent = 1; // no descent on character displays - dummyXFontStruct.descent = 0; + dummyXFontStruct.descent = 0; dummyXFontStructisGood = true; } @@ -279,7 +279,7 @@ XFontStruct * FontLoader::doLoad(LyXFont::FONT_FAMILY family, } getFontinfo(family, series, shape); - int fsize = int((lyxrc.font_sizes[size] * lyxrc.dpi * + int fsize = int((lyxrc.font_sizes[size] * lyxrc.dpi * (lyxrc.zoom/100.0)) / 72.27 + 0.5); string font = fontinfo[family][series][shape]->getFontname(fsize); @@ -295,7 +295,7 @@ XFontStruct * FontLoader::doLoad(LyXFont::FONT_FAMILY family, current_view->owner()->messagePush(_("Loading font into X-Server...")); fs = XLoadQueryFont(GUIRunTime::x11Display(), font.c_str()); - + if (fs == 0) { if (font == "fixed") { lyxerr << "We're doomed. Can't get 'fixed' font." << endl; @@ -315,7 +315,7 @@ XFontStruct * FontLoader::doLoad(LyXFont::FONT_FAMILY family, f.setUnderbar(LyXFont::INHERIT); f.setNoun(LyXFont::INHERIT); f.setColor(LColor::inherit); - lyxerr << "Font '" << f.stateText(0) + lyxerr << "Font '" << f.stateText(0) << "' matched by\n" << font << endl; } diff --git a/src/FontLoader.h b/src/FontLoader.h index 66e1676068..66cd1c0503 100644 --- a/src/FontLoader.h +++ b/src/FontLoader.h @@ -1,16 +1,16 @@ // -*- C++ -*- /* This file is part of * ====================================================== - * + * * LyX, The Document Processor - * + * * Copyright 1997 Asger Alstrup - * and the LyX Team. + * and the LyX Team. * * ====================================================== */ #ifndef FONTLOADER_H_ -#define FONTLOADER_H_ +#define FONTLOADER_H_ #ifdef __GNUG__ #pragma interface @@ -22,10 +22,10 @@ class FontInfo; -/** This class takes care of loading fonts. It uses FontInfo to make -intelligent guesses about matching font size, and it tries different tags -itself in order to match the font loading demands. Later, I plan to extend -this with support for T1Lib, probably via a new class building on this. +/** This class takes care of loading fonts. It uses FontInfo to make +intelligent guesses about matching font size, and it tries different tags +itself in order to match the font loading demands. Later, I plan to extend +this with support for T1Lib, probably via a new class building on this. (Asger) */ class FontLoader { public: @@ -39,9 +39,9 @@ public: void update(); /// Load font - XFontStruct * load(LyXFont::FONT_FAMILY family, - LyXFont::FONT_SERIES series, - LyXFont::FONT_SHAPE shape, + XFontStruct * load(LyXFont::FONT_FAMILY family, + LyXFont::FONT_SERIES series, + LyXFont::FONT_SHAPE shape, LyXFont::FONT_SIZE size) { if (fontstruct[family][series][shape][size] != 0) return fontstruct[family][series][shape][size]; @@ -50,7 +50,7 @@ public: }; /// Do we have anything matching? bool available(LyXFont const & f); - + private: /// Array of font structs XFontStruct * fontstruct[LyXFont::NUM_FAMILIES][2][4][10]; @@ -65,14 +65,14 @@ private: void unload(); /// Get font info - void getFontinfo(LyXFont::FONT_FAMILY family, - LyXFont::FONT_SERIES series, + void getFontinfo(LyXFont::FONT_FAMILY family, + LyXFont::FONT_SERIES series, LyXFont::FONT_SHAPE shape); /** Does the actual loading of a font. Updates fontstruct. */ - XFontStruct * doLoad(LyXFont::FONT_FAMILY family, - LyXFont::FONT_SERIES series, - LyXFont::FONT_SHAPE shape, + XFontStruct * doLoad(LyXFont::FONT_FAMILY family, + LyXFont::FONT_SERIES series, + LyXFont::FONT_SHAPE shape, LyXFont::FONT_SIZE size); }; diff --git a/src/FuncStatus.C b/src/FuncStatus.C index f820ce2afe..5e7133c740 100644 --- a/src/FuncStatus.C +++ b/src/FuncStatus.C @@ -1,8 +1,8 @@ /* This file is part of - * ====================================================== - * + * ====================================================== + * * LyX, The Document Processor - * + * * Copyright 2001 The LyX Team. * * ====================================================== */ @@ -50,7 +50,7 @@ bool FuncStatus::unknown () const FuncStatus & FuncStatus::disabled (bool b) { if (b) - v_ |= DISABLED; + v_ |= DISABLED; else v_ &= !DISABLED; return *this; @@ -71,7 +71,7 @@ void FuncStatus::setOnOff (bool b) bool FuncStatus::onoff (bool b) const { - if (b) + if (b) return (v_ & ON); else return (v_ & OFF); diff --git a/src/FuncStatus.h b/src/FuncStatus.h index e48c3ab53c..f6b1c7b95c 100644 --- a/src/FuncStatus.h +++ b/src/FuncStatus.h @@ -34,7 +34,7 @@ public: FuncStatus & unknown(bool b); /// bool unknown() const; - + /// FuncStatus & disabled (bool b); /// diff --git a/src/LColor.C b/src/LColor.C index 3a24065cae..d445f313b2 100644 --- a/src/LColor.C +++ b/src/LColor.C @@ -1,8 +1,8 @@ /* This file is part of * ====================================================== - * + * * LyX, The Document Processor - * + * * Copyright 1998-2001 The LyX Team * *======================================================*/ @@ -125,7 +125,7 @@ string const LColor::getGUIName(LColor::color c) const string const LColor::getX11Name(LColor::color c) const { InfoTab::const_iterator ici = infotab.find(c); - if (ici != infotab.end()) + if (ici != infotab.end()) return ici->second.x11name; lyxerr << "LyX internal error: Missing color" @@ -195,7 +195,7 @@ LColor::color LColor::getFromGUIName(string const & guiname) const LColor::color LColor::getFromLyXName(string const & lyxname) const { - + InfoTab::const_iterator ici = infotab.begin(); InfoTab::const_iterator end = infotab.end(); for (; ici != end; ++ici) { diff --git a/src/LColor.h b/src/LColor.h index ab1d52fcae..b41608a0a7 100644 --- a/src/LColor.h +++ b/src/LColor.h @@ -1,9 +1,9 @@ // -*- C++ -*- /* This file is part of * ====================================================== - * + * * LyX, The Document Processor - * + * * Copyright 1998-2001 The LyX Team * *======================================================*/ @@ -20,11 +20,11 @@ #include "LString.h" /** - This is a stateless class. + This is a stateless class. It has one basic purposes: To serve as a color-namespace container (the Color enum). - + */ /** @@ -38,7 +38,7 @@ * - A real, predefined color, such as black, white, red or green. * - A logical color, such as no color, inherit, math */ - + class LColor // : public boost::noncopyable { // made copyable for same reasons as LyXRC was made copyable. See there for // explanation. @@ -116,7 +116,7 @@ public: /// caption frame color captionframe, - + /// collapsable insets text collapsable, /// collapsable insets frame @@ -158,7 +158,7 @@ public: /// Color used for bottom background buttonbg, - // Logical attributes + // Logical attributes /// Color is inherited inherit, @@ -172,19 +172,19 @@ public: void setColor(LColor::color col, string const & x11name); /// set the given LyX color to the color defined by the X11 name given bool setColor(string const & lyxname, string const & x11name); - + /// Get GUI name of color string const getGUIName(LColor::color c) const; - + /// Get X11 name of color string const getX11Name(LColor::color c) const; - + /// Get LaTeX name of color string const getLaTeXName(LColor::color c) const; - + /// Get LyX name of color string const getLyXName(LColor::color c) const; - + /// get the color from the GUI name LColor::color getFromGUIName(string const & guiname) const; /// get the color from the LyX name diff --git a/src/LString.h b/src/LString.h index cc9df47947..25809cba73 100644 --- a/src/LString.h +++ b/src/LString.h @@ -1,16 +1,16 @@ // -*- C++ -*- /* This file is part of * ====================================================== - * + * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team. * * ====================================================== */ #ifndef LSTRING_H -#define LSTRING_H +#define LSTRING_H #ifndef _CONFIG_H #error The header should always be included before LString.h diff --git a/src/LaTeX.C b/src/LaTeX.C index 054a7796a1..57256ab10d 100644 --- a/src/LaTeX.C +++ b/src/LaTeX.C @@ -1,14 +1,14 @@ /* This file is part of - * ====================================================== - * - * LyX, The Document Processor + * ====================================================== + * + * LyX, The Document Processor * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team. * * This file is Copyright 1996-2001 * Lars Gullik Bjønnes * - * ====================================================== + * ====================================================== */ #include @@ -62,7 +62,7 @@ extern BufferList bufferlist; void TeXErrors::insertError(int line, string const & error_desc, string const & error_text) { - Error newerr(line, error_desc, error_text); + Error newerr(line, error_desc, error_text); errors.push_back(newerr); } @@ -104,7 +104,7 @@ void LaTeX::deleteFilesOnError() const // makeindex file string ind = ChangeExtension(ofname, ".ind"); lyx::unlink(ind); - + // Also remove the aux file string aux = ChangeExtension(ofname, ".aux"); lyx::unlink(aux); @@ -124,12 +124,12 @@ int LaTeX::run(TeXErrors & terr, LyXFunc * lfun) const unsigned int MAX_RUN = 6; DepTable head; // empty head bool rerun = false; // rerun requested - + // The class LaTeX does not know the temp path. bufferlist.updateIncludedTeXfiles(lyx::getcwd()); //GetCWD()); - + // Never write the depfile if an error was encountered. - + // 0 // first check if the file dependencies exist: // ->If it does exist @@ -191,7 +191,7 @@ int LaTeX::run(TeXErrors & terr, LyXFunc * lfun) str << _("LaTeX run number") << ' ' << count; lfun->dispatch(LFUN_MESSAGE, str.str().c_str()); } - + this->operator()(); scanres = scanLogFile(terr); if (scanres & ERROR_RERUN) { @@ -219,7 +219,7 @@ int LaTeX::run(TeXErrors & terr, LyXFunc * lfun) // And if there were undefined citations or changes in references // the .aux file is checked for signs of bibtex. Bibtex is then run // if needed. - + // run makeindex if (head.haschanged(OnlyFilename(ChangeExtension(file, ".idx")))) { // no checks for now @@ -227,7 +227,7 @@ int LaTeX::run(TeXErrors & terr, LyXFunc * lfun) if (lfun) { lfun->dispatch(LFUN_MESSAGE, _("Running MakeIndex.")); } - + rerun = runMakeIndex(OnlyFilename(ChangeExtension(file, ".idx"))); } @@ -242,7 +242,7 @@ int LaTeX::run(TeXErrors & terr, LyXFunc * lfun) if (lfun) { lfun->dispatch(LFUN_MESSAGE, _("Running BibTeX.")); } - + updateBibtexDependencies(head, bibtex_info); rerun |= runBibTeX(bibtex_info); } else if (!had_depfile) { @@ -251,7 +251,7 @@ int LaTeX::run(TeXErrors & terr, LyXFunc * lfun) /// insert the .bib and .bst files into the .dep-pdf file. updateBibtexDependencies(head, bibtex_info); } - + // 1 // we know on this point that latex has been run once (or we just // returned) and the question now is to decide if we need to run @@ -276,14 +276,14 @@ int LaTeX::run(TeXErrors & terr, LyXFunc * lfun) str << _("LaTeX run number") << ' ' << count; lfun->dispatch(LFUN_MESSAGE, str.str().c_str()); } - + this->operator()(); scanres = scanLogFile(terr); if (scanres & ERRORS) { deleteFilesOnError(); return scanres; // return on error } - + // update the depedencies deplog(head); // reads the latex log head.update(); @@ -298,7 +298,7 @@ int LaTeX::run(TeXErrors & terr, LyXFunc * lfun) // again to make sure everything is redone correctly. // Also there should be no need to run the external programs any // more after this. - + // run makeindex if the .idx has changed or was generated. if (head.haschanged(OnlyFilename(ChangeExtension(file, ".idx")))) { // no checks for now @@ -306,10 +306,10 @@ int LaTeX::run(TeXErrors & terr, LyXFunc * lfun) if (lfun) { lfun->dispatch(LFUN_MESSAGE, _("Running MakeIndex.")); } - + rerun = runMakeIndex(OnlyFilename(ChangeExtension(file, ".idx"))); } - + // 2 // we will only run latex more if the log file asks for it. // or if the sumchange() is true. @@ -320,7 +320,7 @@ int LaTeX::run(TeXErrors & terr, LyXFunc * lfun) // -> rerun not asked for: // just return (fall out of bottom of func) // - while ((head.sumchange() || rerun || (scanres & RERUN)) + while ((head.sumchange() || rerun || (scanres & RERUN)) && count < MAX_RUN) { // Yes rerun until message goes away, or until // MAX_RUNS are reached. @@ -332,14 +332,14 @@ int LaTeX::run(TeXErrors & terr, LyXFunc * lfun) str << _("LaTeX run number") << ' ' << count; lfun->dispatch(LFUN_MESSAGE, str.str().c_str()); } - + this->operator()(); scanres = scanLogFile(terr); if (scanres & ERRORS) { deleteFilesOnError(); return scanres; // return on error } - + // keep this updated head.update(); } @@ -358,7 +358,7 @@ int LaTeX::operator()() #else // cmd.exe (OS/2) causes SYS0003 error at "/dev/null" string tmp = cmd + ' ' + file + " > nul"; #endif - Systemcall one; + Systemcall one; return one.startscript(Systemcall::Wait, tmp); } @@ -385,7 +385,7 @@ vector const LaTeX::scanAuxFiles(string const & file) { vector result; - + result.push_back(scanAuxFile(file)); for (int i = 1; i < 1000; ++i) { @@ -490,7 +490,7 @@ void LaTeX::updateBibtexDependencies(DepTable & dep, string file = findtexfile(*it2, "bst"); if (!file.empty()) dep.insert(file, true); - } + } } } @@ -526,7 +526,7 @@ int LaTeX::scanLogFile(TeXErrors & terr) string token; while (getline(ifs, token)) { lyxerr[Debug::LATEX] << "Log line: " << token << endl; - + if (token.empty()) continue; @@ -666,7 +666,7 @@ void LaTeX::deplog(DepTable & head) // Writing index file sample.idx LRegex reg5("Writing index file ([^ ]+).*"); LRegex unwanted("^.*\\.(aux|log|dvi|bbl|ind|glo)$"); - + ifstream ifs(logfile.c_str()); while (ifs) { // Ok, the scanning of files here is not sufficient. @@ -679,7 +679,7 @@ void LaTeX::deplog(DepTable & head) getline(ifs, token); token = strip(token, '\r'); if (token.empty()) continue; - + if (reg1.exact_match(token)) { LRegex::SubMatches const & sub = reg1.exec(token); foundfile = LSubstring(token, sub[1].first, @@ -706,21 +706,21 @@ void LaTeX::deplog(DepTable & head) // convert from native os path to unix path foundfile = os::internal_path(foundfile); - - lyxerr[Debug::DEPEND] << "Found file: " + + lyxerr[Debug::DEPEND] << "Found file: " << foundfile << endl; - + // Ok now we found a file. // Now we should make sure that this is a file that we can // access through the normal paths. // We will not try any fancy search methods to // find the file. - + // (1) foundfile is an // absolute path and should // be inserted. if (AbsolutePath(foundfile)) { - lyxerr[Debug::DEPEND] << "AbsolutePath file: " + lyxerr[Debug::DEPEND] << "AbsolutePath file: " << foundfile << endl; // On initial insert we want to do the update at once // since this file can not be a file generated by diff --git a/src/LaTeX.h b/src/LaTeX.h index 937870a703..d32b126d2d 100644 --- a/src/LaTeX.h +++ b/src/LaTeX.h @@ -1,15 +1,15 @@ // -*- C++ -*- /* This file is part of - * ====================================================== - * - * LyX, The Document Processor + * ====================================================== + * + * LyX, The Document Processor * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The Lyx Team * * This file is Copyright 1996-2001 * Lars Gullik Bjønnes * - * ====================================================== + * ====================================================== */ #ifndef LATEX_H @@ -100,7 +100,7 @@ bool operator!=(Aux_Info const & a, Aux_Info const & o) class LaTeX : boost::noncopyable { public: /** Return values from scanLogFile() and run() (to come) - + This enum should be enlarged a bit so that one could get more feedback from the LaTeX run. */ @@ -140,7 +140,7 @@ public: /// WARNINGS = TEX_WARNING + LATEX_WARNING + PACKAGE_WARNING }; - + /** cmd = the latex command, file = name of the (temporary) latex file, @@ -150,7 +150,7 @@ public: /// virtual ~LaTeX() {} - + /// runs LaTeX several times int run(TeXErrors &, LyXFunc *); @@ -181,7 +181,7 @@ protected: /// void scanAuxFile(string const &, Aux_Info &); - + /// void updateBibtexDependencies(DepTable &, std::vector const &); @@ -191,19 +191,19 @@ protected: /// void deleteFilesOnError() const; - + /// string cmd; /// string file; - + /// string path; /// used by scanLogFile int num_errors; - + /// The name of the final output file. string output_file; }; diff --git a/src/LaTeXFeatures.C b/src/LaTeXFeatures.C index a4a830e7c2..418f0b00ee 100644 --- a/src/LaTeXFeatures.C +++ b/src/LaTeXFeatures.C @@ -1,8 +1,8 @@ /* This file is part of - * ====================================================== - * + * ====================================================== + * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 the LyX Team. * @@ -46,7 +46,7 @@ void LaTeXFeatures::require(string const & name) { if (isRequired(name)) return; - + features.push_back(name); } @@ -59,7 +59,7 @@ void LaTeXFeatures::useLayout(string const & lyt) bool LaTeXFeatures::isRequired(string const & name) const { - FeaturesList::const_iterator i = find(features.begin(), + FeaturesList::const_iterator i = find(features.begin(), features.end(), name); return i != features.end(); @@ -91,25 +91,25 @@ void LaTeXFeatures::useLanguage(Language const * lang) } -void LaTeXFeatures::includeFile(string const & key, string const & name) +void LaTeXFeatures::includeFile(string const & key, string const & name) { IncludedFiles[key] = name; } -bool LaTeXFeatures::hasLanguages() +bool LaTeXFeatures::hasLanguages() { return !UsedLanguages.empty(); } -string LaTeXFeatures::getLanguages() const +string LaTeXFeatures::getLanguages() const { ostringstream languages; for (LanguageList::const_iterator cit = UsedLanguages.begin(); - cit != UsedLanguages.end(); + cit != UsedLanguages.end(); ++cit) languages << (*cit)->babel() << ','; @@ -117,7 +117,7 @@ string LaTeXFeatures::getLanguages() const } -set LaTeXFeatures::getEncodingSet(string const & doc_encoding) +set LaTeXFeatures::getEncodingSet(string const & doc_encoding) { set encodings; for (LanguageList::const_iterator it = @@ -129,7 +129,7 @@ set LaTeXFeatures::getEncodingSet(string const & doc_encoding) } namespace { - + char const * simplefeatures[] = { "array", "verbatim", @@ -164,7 +164,7 @@ string const LaTeXFeatures::getPackages() const << simplefeatures[i] << "}\n"; } - + /** * The rest of these packages are somewhat more complicated * than those above. @@ -174,17 +174,17 @@ string const LaTeXFeatures::getPackages() const && ! tclass.provides(LyXTextClass::amsmath)) { packages << "\\usepackage{amsmath}\n"; } - + // color.sty if (isRequired("color")) { if (params.graphicsDriver == "default") packages << "\\usepackage{color}\n"; else - packages << "\\usepackage[" + packages << "\\usepackage[" << params.graphicsDriver << "]{color}\n"; } - + // makeidx.sty if (isRequired("makeidx")) { if (! tclass.provides(LyXTextClass::makeidx)) @@ -197,7 +197,7 @@ string const LaTeXFeatures::getPackages() const if (params.graphicsDriver == "default") packages << "\\usepackage{graphicx}\n"; else - packages << "\\usepackage[" + packages << "\\usepackage[" << params.graphicsDriver << "]{graphicx}\n"; } @@ -254,7 +254,7 @@ string const LaTeXFeatures::getPackages() const } packages << "]{natbib}\n"; } - + packages << externalPreambles; return packages.str().c_str(); @@ -266,10 +266,10 @@ string const LaTeXFeatures::getMacros() const ostringstream macros; // always include this - if (true || isRequired("lyx")) + if (true || isRequired("lyx")) macros << lyx_def << '\n'; - if (isRequired("lyxline")) + if (isRequired("lyxline")) macros << lyxline_def << '\n'; if (isRequired("noun")) @@ -278,7 +278,7 @@ string const LaTeXFeatures::getMacros() const if (isRequired("lyxarrow")) macros << lyxarrow_def << '\n'; - // quotes. + // quotes. if (isRequired("quotesinglbase")) macros << quotesinglbase_def << '\n'; if (isRequired("quotedblbase")) @@ -291,21 +291,21 @@ string const LaTeXFeatures::getMacros() const macros << guillemotleft_def << '\n'; if (isRequired("guillemotright")) macros << guillemotright_def << '\n'; - - // Math mode + + // Math mode if (isRequired("boldsymbol") && !isRequired("amsmath")) macros << boldsymbol_def << '\n'; if (isRequired("binom") && !isRequired("amsmath")) macros << binom_def << '\n'; if (isRequired("mathcircumflex")) macros << mathcircumflex_def << '\n'; - + // other if (isRequired("NeedLyXMinipageIndent")) macros << minipageindent_def; - if (isRequired("ParagraphIndent")) + if (isRequired("ParagraphIndent")) macros << paragraphindent_def; - if (isRequired("NeedLyXFootnoteCode")) + if (isRequired("NeedLyXFootnoteCode")) macros << floatingfootnote_def; // floats @@ -324,7 +324,7 @@ string const LaTeXFeatures::getMacros() const string const LaTeXFeatures::getTClassPreamble() const { - // the text class specific preamble + // the text class specific preamble LyXTextClass const & tclass = textclasslist[params.textclass]; ostringstream tcpreamble; @@ -335,9 +335,9 @@ string const LaTeXFeatures::getTClassPreamble() const for (; cit != end; ++cit) { tcpreamble << tclass[*cit].preamble(); } - + return tcpreamble.str().c_str(); -} +} string const LaTeXFeatures::getLyXSGMLEntities() const @@ -396,10 +396,10 @@ void LaTeXFeatures::getFloatDefinitions(ostream & os) const // ostringstream floats; for (; cit != end; ++cit) { Floating const & fl = floatList.getType((*cit)); - + // For builtin floats we do nothing. if (fl.builtin()) continue; - + // We have to special case "table" and "figure" if (fl.type() == "tabular" || fl.type() == "figure") { // Output code to modify "table" or "figure" @@ -419,7 +419,7 @@ void LaTeXFeatures::getFloatDefinitions(ostream & os) const } } else { // The other non builtin floats. - + string const type = fl.type(); string const placement = fl.placement(); string const ext = fl.ext(); @@ -434,7 +434,7 @@ void LaTeXFeatures::getFloatDefinitions(ostream & os) const os << "\n" << "\\floatname{" << type << "}{" << name << "}\n"; - + // What missing here is to code to minimalize the code // output so that the same floatstyle will not be // used several times, when the same style is still in diff --git a/src/LaTeXFeatures.h b/src/LaTeXFeatures.h index f70d8286ea..92279ebfc0 100644 --- a/src/LaTeXFeatures.h +++ b/src/LaTeXFeatures.h @@ -1,9 +1,9 @@ // -*- C++ -*- /* This file is part of -* ====================================================== -* +* ====================================================== +* * LyX, The Document Processor -* +* * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 the LyX Team. * @@ -26,7 +26,7 @@ #include #include -class BufferParams; +class BufferParams; struct Language; /** The packages and commands that a buffer needs. This class @@ -35,11 +35,11 @@ struct Language; i.e require("amssymb") - To add support you should only need to require() the package name as + To add support you should only need to require() the package name as packages which don't have special requirements are handled automatically. If your new package does need special consideration you'll need to alter string const getPackages() const; - Remember to update the validate function in buffer.C and paragraph.C + Remember to update the validate function in buffer.C and paragraph.C when you do so. */ class LaTeXFeatures { @@ -62,7 +62,7 @@ public: void getFloatDefinitions(std::ostream & os) const; /// Print requirements to lyxerr void showStruct() const; - /// + /// void addExternalPreamble(string const &); /// Provide a string name-space to the requirements void require(string const & name); diff --git a/src/Lsstream.h b/src/Lsstream.h index 9c8b3c74d3..548f971589 100644 --- a/src/Lsstream.h +++ b/src/Lsstream.h @@ -1,16 +1,16 @@ // -*- C++ -*- /* This file is part of * ====================================================== - * + * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team. * * ====================================================== */ #ifndef LSSTREAM_H -#define LSSTREAM_H +#define LSSTREAM_H // Since we will include a string header anyway, we'd better do it // right now so that is not loaded before lyxstring.h. (JMarc) diff --git a/src/LyXAction.C b/src/LyXAction.C index 4fa9c9ef96..a1150138ef 100644 --- a/src/LyXAction.C +++ b/src/LyXAction.C @@ -1,8 +1,8 @@ /* This file is part of * ====================================================== - * + * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team. * @@ -22,12 +22,12 @@ using std::ostream; using std::endl; -/* +/* NAMING RULES FOR USER-COMMANDS Here's the set of rules to apply when a new command name is introduced: - + 1) Use the object.event order. That is, use `word-forward' - instead of `forward-word'. + instead of `forward-word'. 2) Don't introduce an alias for an already named object. Same for events. 3) Forward movement or focus is called `forward' (not `right'). 4) Backward movement or focus is called `backward' (not `left'). @@ -35,20 +35,20 @@ using std::endl; 6) Downward movement is called `down'. 7) The begin of an object is called `begin' (not `start'). 8) The end of an object is called `end'. - + (May 19 1996, 12:04, RvdK) */ -// These are globals. +// These are globals. LyXAction lyxaction; // Small helper function inline bool isPseudoAction(int a) -{ - return a > int(LFUN_LASTACTION); +{ + return a > int(LFUN_LASTACTION); } - + void LyXAction::newFunc(kb_action action, string const & name, @@ -70,7 +70,7 @@ void LyXAction::init() // times. Since the array is not static we get back the memory it // occupies after the init is completed. It compiles several // magnitudes faster. - + static bool init; if (init) return; @@ -117,7 +117,7 @@ void LyXAction::init() { LFUN_BREAKPARAGRAPHKEEPLAYOUT, "break-paragraph-keep-layout", "", Noop }, { LFUN_BREAKPARAGRAPH_SKIP, "break-paragraph-skip", "", Noop }, - { LFUN_BUILDPROG, "build-program", + { LFUN_BUILDPROG, "build-program", N_("Build program"), ReadOnly }, { LFUN_AUTOSAVE, "buffer-auto-save", N_("Autosave"), Noop }, { LFUN_BEGINNINGBUF, "buffer-begin", @@ -145,7 +145,7 @@ void LyXAction::init() { LFUN_MENUPRINT, "buffer-print", N_("Print"), ReadOnly }, { LFUN_MENURELOAD, "buffer-reload", N_("Revert to saved"), ReadOnly }, - { LFUN_SWITCHBUFFER, "buffer-switch", + { LFUN_SWITCHBUFFER, "buffer-switch", N_("Switch to an open document"), ReadOnly }, { LFUN_READ_ONLY_TOGGLE, "buffer-toggle-read-only", N_("Toggle read-only"), ReadOnly }, @@ -230,7 +230,7 @@ void LyXAction::init() ReadOnly }, { LFUN_HFILL, "hfill-insert", N_("Insert horizontal fill"), Noop }, - { LFUN_HELP_OPEN, "help-open", N_("Open a Help file"), + { LFUN_HELP_OPEN, "help-open", N_("Open a Help file"), NoBuffer|Argument}, { LFUN_HTMLURL, "html-insert", "", Noop }, { LFUN_HYPHENATION, "hyphenation-point-insert", @@ -316,13 +316,13 @@ void LyXAction::init() { LFUN_INSET_MINIPAGE, "minipage-insert", "", Noop }, { LFUN_INSERT_NOTE, "note-insert", "", Noop }, { LFUN_GOTONOTE, "note-next", "", ReadOnly }, - { LFUN_INSET_TOGGLE, "inset-toggle", + { LFUN_INSET_TOGGLE, "inset-toggle", N_("toggle inset"), ReadOnly }, { LFUN_DOWN_PARAGRAPH, "paragraph-down", N_("Go one paragraph down"), ReadOnly }, { LFUN_DOWN_PARAGRAPHSEL, "paragraph-down-select", N_("Select next paragraph"), ReadOnly }, - { LFUN_GOTO_PARAGRAPH, "paragraph-goto", + { LFUN_GOTO_PARAGRAPH, "paragraph-goto", N_("Go to paragraph"), ReadOnly }, { LFUN_PARAGRAPH_SPACING, "paragraph-spacing", "", Noop }, { LFUN_UP_PARAGRAPH, "paragraph-up", @@ -473,7 +473,7 @@ int LyXAction::searchActionArg(kb_action action, string const & arg) const if (aci == pit->second.end()) { // the action does not have any pseudoactions with this arg - lyxerr[Debug::ACTION] + lyxerr[Debug::ACTION] << "Action " << action << "does not have any pseudoactions with arg " << arg << endl; @@ -481,8 +481,8 @@ int LyXAction::searchActionArg(kb_action action, string const & arg) const } // pseudo action exist - lyxerr[Debug::ACTION] << "Pseudoaction exist[" - << action << '|' + lyxerr[Debug::ACTION] << "Pseudoaction exist[" + << action << '|' << arg << "] = " << aci->second << endl; return aci->second; @@ -514,7 +514,7 @@ int LyXAction::getPseudoAction(kb_action action, string const & arg) const lyxerr[Debug::ACTION] << "Creating new pseudoaction " << pseudo_counter << " for [" << action << '|' << arg << "]\n"; - + return pseudo_counter; } @@ -525,9 +525,9 @@ kb_action LyXAction::retrieveActionArg(int pseudo, string & arg) const { arg.erase(); // clear it to be sure. - if (!isPseudoAction(pseudo)) + if (!isPseudoAction(pseudo)) return static_cast(pseudo); - + pseudo_map::const_iterator pit = lyx_pseudo_map.find(pseudo); if (pit != lyx_pseudo_map.end()) { @@ -582,21 +582,21 @@ int LyXAction::getApproxFunc(string const & func) const // Checking for prefix is not so simple, but // using a simple bounding function gives // a similar result. [ale 19981103] - func_map::const_iterator fit = - lyx_func_map.lower_bound(func); - - if (fit != lyx_func_map.end()) { + func_map::const_iterator fit = + lyx_func_map.lower_bound(func); + + if (fit != lyx_func_map.end()) { action = fit->second; } } else { // Go get the next function - func_map::const_iterator fit = - lyx_func_map.upper_bound(func); - - if (fit != lyx_func_map.end()) { + func_map::const_iterator fit = + lyx_func_map.upper_bound(func); + + if (fit != lyx_func_map.end()) { action = fit->second; } } - + return action; } @@ -617,14 +617,14 @@ string const LyXAction::getActionName(int action) const ac = retrieveActionArg(action, arg); if (!arg.empty()) arg.insert(0, " "); - + info_map::const_iterator iit = lyx_info_map.find(ac); if (iit != lyx_info_map.end()) { string ret(iit->second.name); ret += arg; return ret; - } else + } else return string(); } @@ -665,8 +665,8 @@ string const LyXAction::helpText(int pseudoaction) const } -bool LyXAction::funcHasFlag(kb_action action, - LyXAction::func_attrib flag) const +bool LyXAction::funcHasFlag(kb_action action, + LyXAction::func_attrib flag) const { info_map::const_iterator ici = lyx_info_map.find(action); @@ -681,13 +681,13 @@ bool LyXAction::funcHasFlag(kb_action action, } -LyXAction::const_func_iterator LyXAction::func_begin() const +LyXAction::const_func_iterator LyXAction::func_begin() const { return lyx_func_map.begin(); } -LyXAction::const_func_iterator LyXAction::func_end() const +LyXAction::const_func_iterator LyXAction::func_end() const { return lyx_func_map.end(); } diff --git a/src/LyXAction.h b/src/LyXAction.h index c5fbf527ce..734969d5aa 100644 --- a/src/LyXAction.h +++ b/src/LyXAction.h @@ -51,37 +51,37 @@ public: Noop = 0, /// can be used in RO mode (perhaps this should change) ReadOnly = 1, // , - /// Can be used when there is no document open - NoBuffer = 2, + /// Can be used when there is no document open + NoBuffer = 2, //Interactive = 2, // Is interactive (requires a GUI) /// Argument = 4 // Requires argument //MathOnly = 8, // Only math mode //EtcEtc = ... // Or other attributes... }; - + /// LyXAction(); - + /** Returns an pseudoaction from a string - If you include arguments in func_name, a new psedoaction will be + If you include arguments in func_name, a new psedoaction will be created if needed. */ - int LookupFunc(string const & func_name) const; + int LookupFunc(string const & func_name) const; - /** Returns an action tag which name is the most similar to a string. + /** Returns an action tag which name is the most similar to a string. Don't include arguments, they would be ignored. */ - int getApproxFunc(string const & func) const; + int getApproxFunc(string const & func) const; - /** Returns an action name the most similar to a string. + /** Returns an action name the most similar to a string. Don't include arguments, they would be ignored. */ - string const getApproxFuncName(string const & func) const; + string const getApproxFuncName(string const & func) const; /// Returns a pseudo-action given an action and its argument. int getPseudoAction(kb_action action, string const & arg) const; /// Retrieves the real action and its argument. kb_action retrieveActionArg(int i, string & arg) const; - + /// Search for an existent pseudoaction, return -1 if it doesn't exist. int searchActionArg(kb_action action, string const & arg) const; @@ -103,24 +103,24 @@ private: /// void newFunc(kb_action, string const & name, string const & helpText, unsigned int attrib); - + /** This is a list of all the LyXFunc names with the coresponding action number. It is usually only used by the minibuffer or when assigning commands to keys during init. */ func_map lyx_func_map; - + /** This is a mapping from action number to an object holding info about this action. f.ex. helptext, command name (string), command attributes (ro) */ info_map lyx_info_map; - + /** A mapping from the automatically created pseudo action number to the real action and its argument. */ mutable pseudo_map lyx_pseudo_map; - + /** A (multi) mapping from the lyx action to all the generated pseudofuncs and the arguments the action should use. */ mutable arg_map lyx_arg_map; }; - + #endif diff --git a/src/LyXView.C b/src/LyXView.C index 34b2d47850..561e644f1c 100644 --- a/src/LyXView.C +++ b/src/LyXView.C @@ -1,9 +1,8 @@ - /* This file is part of - * ====================================================== - * + * ====================================================== + * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team. * @@ -75,7 +74,7 @@ LyXView::~LyXView() } -void LyXView::resize() +void LyXView::resize() { view()->resize(); } @@ -148,7 +147,7 @@ Menubar * LyXView::getMenubar() const } -void LyXView::updateMenubar() +void LyXView::updateMenubar() { if ((!view() || !view()->buffer()) && menubackend.hasMenu("main_nobuffer")) @@ -194,7 +193,7 @@ void LyXView::updateLayoutChoice() // document is loaded. if (!view() || !view()->buffer()) { toolbar->clearLayoutList(); - return; + return; } // Update the layout display diff --git a/src/LyXView.h b/src/LyXView.h index cb2465781f..425469ac88 100644 --- a/src/LyXView.h +++ b/src/LyXView.h @@ -69,7 +69,7 @@ public: void messagePush(string const & str); /// void messagePop(); - + /// Menubar * getMenubar() const; @@ -100,13 +100,13 @@ public: protected: /// Menubar * menubar; - /// + /// Toolbar * toolbar; /** This is supposed to be a pointer or a list of pointers to the BufferViews currently being shown in the LyXView. So far this is not used, but that should change pretty soon. (Lgb) */ BufferView * bufferview; - /// + /// MiniBuffer * minibuffer; /// Intl * intl; @@ -117,7 +117,7 @@ protected: /// void invalidateLayoutChoice(); private: - /// + /// LyXFunc * lyxfunc; /// Dialogs * dialogs_; diff --git a/src/MenuBackend.C b/src/MenuBackend.C index de6b67c0a1..71542cc954 100644 --- a/src/MenuBackend.C +++ b/src/MenuBackend.C @@ -1,6 +1,6 @@ /* This file is part of - * ====================================================== - * + * ====================================================== + * * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich @@ -46,8 +46,8 @@ using std::sort; MenuBackend menubackend; -MenuItem::MenuItem(Kind kind, string const & label, - string const & command, bool optional) +MenuItem::MenuItem(Kind kind, string const & label, + string const & command, bool optional) : kind_(kind), label_(label), optional_(optional) { switch (kind) { @@ -67,11 +67,11 @@ MenuItem::MenuItem(Kind kind, string const & label, if (action_ == LFUN_UNKNOWN_ACTION) { lyxerr << "MenuItem(): LyX command `" - << command << "' does not exist." << endl; + << command << "' does not exist." << endl; } if (optional_) - lyxerr[Debug::GUI] << "Optional item " - << command << endl; + lyxerr[Debug::GUI] << "Optional item " + << command << endl; break; case Submenu: submenu_ = command; @@ -80,15 +80,15 @@ MenuItem::MenuItem(Kind kind, string const & label, } -string const MenuItem::label() const -{ - return token(label_, '|', 0); +string const MenuItem::label() const +{ + return token(label_, '|', 0); } string const MenuItem::shortcut() const -{ - return token(label_, '|', 1); +{ + return token(label_, '|', 1); } @@ -128,7 +128,7 @@ Menu & Menu::read(LyXLex & lex) { "importformats", md_importformats }, { "item", md_item }, { "lastfiles", md_lastfiles }, - { "optitem", md_optitem }, + { "optitem", md_optitem }, { "separator", md_separator }, { "submenu", md_submenu }, { "toc", md_toc }, @@ -153,7 +153,7 @@ Menu & Menu::read(LyXLex & lex) string const name = _(lex.getString()); lex.next(true); string const command = lex.getString(); - add(MenuItem(MenuItem::Command, name, + add(MenuItem(MenuItem::Command, name, command, optional)); optional = false; break; @@ -198,7 +198,7 @@ Menu & Menu::read(LyXLex & lex) case md_floatinsert: add(MenuItem(MenuItem::FloatInsert)); break; - + case md_submenu: { lex.next(true); string const mlabel = _(lex.getString()); @@ -254,7 +254,7 @@ namespace { class compare_format { public: bool operator()(Format const * p1, Format const * p2) { - return *p1 < *p2; + return *p1 < *p2; } }; @@ -270,7 +270,7 @@ void Menu::expand(Menu & tomenu, Buffer * buf) const int ii = 1; LastFiles::const_iterator lfit = lastfiles->begin(); LastFiles::const_iterator end = lastfiles->end(); - + for (; lfit != end && ii < 10; ++lfit, ++ii) { string const label = tostr(ii) + ". " + MakeDisplayPath((*lfit), 30) @@ -283,12 +283,12 @@ void Menu::expand(Menu & tomenu, Buffer * buf) const } } break; - + case MenuItem::Documents: { typedef vector Strings; - + Strings const names = bufferlist.getFileNames(); - + if (names.empty()) { tomenu.add(MenuItem(MenuItem::Command, _("No Documents Open!"), @@ -315,9 +315,9 @@ void Menu::expand(Menu & tomenu, Buffer * buf) const case MenuItem::UpdateFormats: case MenuItem::ExportFormats: { typedef vector Formats; - + Formats formats; - + kb_action action; switch (cit->kind()) { case MenuItem::ImportFormats: @@ -325,22 +325,22 @@ void Menu::expand(Menu & tomenu, Buffer * buf) const action = LFUN_IMPORT; break; case MenuItem::ViewFormats: - formats = Exporter::GetExportableFormats(buf, true); + formats = Exporter::GetExportableFormats(buf, true); action = LFUN_PREVIEW; break; case MenuItem::UpdateFormats: - formats = Exporter::GetExportableFormats(buf, true); + formats = Exporter::GetExportableFormats(buf, true); action = LFUN_UPDATE; break; default: - formats = Exporter::GetExportableFormats(buf, false); + formats = Exporter::GetExportableFormats(buf, false); action = LFUN_EXPORT; } sort(formats.begin(), formats.end(), compare_format()); Formats::const_iterator fit = formats.begin(); Formats::const_iterator end = formats.end(); - + for (; fit != end ; ++fit) { if ((*fit)->dummy()) continue; @@ -388,7 +388,7 @@ void Menu::expand(Menu & tomenu, Buffer * buf) const string const label = cit->second.name(); tomenu.add(MenuItem(MenuItem::Command, label, action)); - + // and the wide version int const action2 = lyxaction .getPseudoAction(LFUN_INSET_WIDE_FLOAT, @@ -399,7 +399,7 @@ void Menu::expand(Menu & tomenu, Buffer * buf) const } } break; - + default: tomenu.add(*cit); } @@ -448,7 +448,7 @@ void MenuBackend::read(LyXLex & lex) while (lex.isOK() && !quit) { switch (lex.lex()) { - case md_menubar: + case md_menubar: menubar = true; // fallback to md_menu case md_menu: { @@ -461,7 +461,7 @@ void MenuBackend::read(LyXLex & lex) lex.printError("Cannot append to menu `$$Token' unless it is of the same type"); return; } - } else { + } else { Menu menu(name, menubar); menu.read(lex); add(menu); @@ -486,7 +486,7 @@ void MenuBackend::defaults() { menulist_.clear(); - lyxerr[Debug::GUI] << "MenuBackend::defaults: using default values" + lyxerr[Debug::GUI] << "MenuBackend::defaults: using default values" << endl; Menu file("file"); @@ -506,7 +506,7 @@ void MenuBackend::defaults() .add(MenuItem(MenuItem::Command, _("LinuxDoc...|L"), "buffer-import linuxdoc")); add(import); - + Menu edit("edit"); edit .add(MenuItem(MenuItem::Command, _("Cut"), "cut")) @@ -534,8 +534,8 @@ void MenuBackend::defaults() if (lyxerr.debugging(Debug::GUI)) { for (const_iterator cit = begin(); cit != end() ; ++cit) - lyxerr << "Menu name: " << cit->name() - << ", Menubar: " << cit->menubar() + lyxerr << "Menu name: " << cit->name() + << ", Menubar: " << cit->menubar() << endl; } } diff --git a/src/MenuBackend.h b/src/MenuBackend.h index b980e305f3..6f4bf989db 100644 --- a/src/MenuBackend.h +++ b/src/MenuBackend.h @@ -1,6 +1,6 @@ /* This file is part of -*- C++ -*- * ====================================================== -* +* * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich @@ -63,17 +63,17 @@ public: FloatInsert }; /// Create a Command type MenuItem - MenuItem(Kind kind, - string const & label = string(), - string const & command = string(), + MenuItem(Kind kind, + string const & label = string(), + string const & command = string(), bool optional = false); MenuItem(Kind kind, - string const & label, - int action, + string const & label, + int action, bool optional = false) : kind_(kind), label_(label), action_(action), submenu_(), optional_(optional) {} - + /// The label of a given menuitem string const label() const; /// The keyboard shortcut (usually underlined in the entry) @@ -81,7 +81,7 @@ public: /// The complete label, with label and shortcut separated by a '|' string const fulllabel() const { return label_;} /// The kind of entry - Kind kind() const { return kind_; } + Kind kind() const { return kind_; } /// the action (if relevant) int action() const { return action_; } /// the description of the submenu (if relevant) @@ -110,7 +110,7 @@ public: /// typedef ItemList::const_iterator const_iterator; /// - explicit Menu(string const & name = string(), bool mb = false) + explicit Menu(string const & name = string(), bool mb = false) : menubar_(mb), name_(name) {} /// Menu & add(MenuItem const &); @@ -122,9 +122,9 @@ public: ViewFormats, ExportFormats, UpdateFormats */ void expand(Menu & tomenu, Buffer *) const; - /// + /// bool menubar() const { return menubar_; } - /// + /// string const & name() const { return name_; } /// bool empty() const { return items_.empty(); } @@ -132,18 +132,18 @@ public: ItemList::size_type size() const { return items_.size(); } /// bool hasSubmenu(string const &) const; - /// - const_iterator begin() const { - return items_.begin(); - } - /// - const_iterator end() const { - return items_.end(); - } + /// + const_iterator begin() const { + return items_.begin(); + } + /// + const_iterator end() const { + return items_.end(); + } // Check whether the menu shortcuts are unique void checkShortcuts() const; - + private: /// ItemList items_; @@ -175,14 +175,14 @@ public: Menu const & getMenu (string const &) const; // bool empty() const { return menulist_.empty(); } - /// - const_iterator begin() const { - return menulist_.begin(); - } - /// - const_iterator end() const { - return menulist_.end(); - } + /// + const_iterator begin() const { + return menulist_.begin(); + } + /// + const_iterator end() const { + return menulist_.end(); + } private: /// MenuList menulist_; diff --git a/src/Painter.C b/src/Painter.C index e3a83a6e77..6b8d760bbb 100644 --- a/src/Painter.C +++ b/src/Painter.C @@ -1,8 +1,8 @@ /* This file is part of * ====================================================== - * + * * LyX, The Document Processor - * + * * Copyright 1998-2001 The LyX Team * *======================================================*/ @@ -41,7 +41,7 @@ using std::max; namespace { inline -Display * display() +Display * display() { return GUIRunTime::x11Display(); } @@ -69,7 +69,7 @@ PainterBase & Painter::line(int x1, int y1, int x2, int y2, enum line_style ls, enum line_width lw) { - XDrawLine(display(), owner.getPixmap(), + XDrawLine(display(), owner.getPixmap(), lyxColorHandler->getGCLinepars(ls, lw, col), x1, y1, x2, y2); return *this; @@ -82,18 +82,18 @@ PainterBase & Painter::lines(int const * xp, int const * yp, int np, enum line_width lw) { boost::scoped_array points(new XPoint[np]); - + for (int i = 0; i < np; ++i) { points[i].x = xp[i]; points[i].y = yp[i]; } - - XDrawLines(display(), owner.getPixmap(), - lyxColorHandler->getGCLinepars(ls, lw, col), + + XDrawLines(display(), owner.getPixmap(), + lyxColorHandler->getGCLinepars(ls, lw, col), points.get(), np, CoordModeOrigin); - + return *this; -} +} PainterBase & Painter::rectangle(int x, int y, int w, int h, @@ -102,7 +102,7 @@ PainterBase & Painter::rectangle(int x, int y, int w, int h, enum line_width lw) { XDrawRectangle(display(), owner.getPixmap(), - lyxColorHandler->getGCLinepars(ls, lw, col), + lyxColorHandler->getGCLinepars(ls, lw, col), x, y, w, h); return *this; } @@ -121,39 +121,39 @@ PainterBase & Painter::fillPolygon(int const * xp, int const * yp, int np, LColor::color col) { boost::scoped_array points(new XPoint[np]); - + for (int i = 0; i < np; ++i) { points[i].x = xp[i]; points[i].y = yp[i]; } - + XFillPolygon(display(), owner.getPixmap(), - lyxColorHandler->getGCForeground(col), points.get(), np, + lyxColorHandler->getGCForeground(col), points.get(), np, Nonconvex, CoordModeOrigin); - + return *this; -} +} PainterBase & Painter::arc(int x, int y, unsigned int w, unsigned int h, int a1, int a2, LColor::color col) { - XDrawArc(display(), owner.getPixmap(), + XDrawArc(display(), owner.getPixmap(), lyxColorHandler->getGCForeground(col), - x, y, w, h, a1, a2); + x, y, w, h, a1, a2); return *this; -} +} /// Draw lines from x1,y1 to x2,y2. They are arrays -PainterBase & Painter::segments(int const * x1, int const * y1, +PainterBase & Painter::segments(int const * x1, int const * y1, int const * x2, int const * y2, int ns, LColor::color col, enum line_style ls, enum line_width lw) { boost::scoped_array s(new XSegment[ns]); - + for (int i = 0; i < ns; ++i) { s[i].x1 = x1[i]; s[i].y1 = y1[i]; @@ -163,7 +163,7 @@ PainterBase & Painter::segments(int const * x1, int const * y1, XDrawSegments(display(), owner.getPixmap(), lyxColorHandler->getGCLinepars(ls, lw, col), s.get(), ns); - + return *this; } @@ -217,7 +217,7 @@ PainterBase & Painter::text(int x, int y, char const * s, size_t ls, text(x , y, xs.get(), ls, font); return *this; } - + GC gc = lyxColorHandler->getGCForeground(f.realColor()); if (f.realShape() != LyXFont::SMALLCAPS_SHAPE) { lyxfont::XSetFont(display(), gc, f); @@ -241,11 +241,11 @@ PainterBase & Painter::text(int x, int y, char const * s, size_t ls, } } } - + if (f.underbar() == LyXFont::ON) { underline(f, x, y, lyxfont::width(s, ls, f)); } - + return *this; } @@ -282,11 +282,11 @@ PainterBase & Painter::text(int x, int y, XChar2b const * s, int ls, } } } - + if (f.underbar() == LyXFont::ON) { underline(f, x, y, lyxfont::width(s, ls, f)); } - + return *this; } diff --git a/src/Painter.h b/src/Painter.h index 6f33849815..c5524fc1a6 100644 --- a/src/Painter.h +++ b/src/Painter.h @@ -1,9 +1,9 @@ // -*- C++ -*- /* This file is part of * ====================================================== - * + * * LyX, The Document Processor - * + * * Copyright 1995-2001 The LyX Team * * ======================================================*/ @@ -30,69 +30,69 @@ class WorkArea; */ class Painter : public PainterBase { public: - /// Constructor + /// Constructor explicit Painter(WorkArea &); - + /// Draw a line from point to point - PainterBase & line(int x1, int y1, int x2, int y2, + PainterBase & line(int x1, int y1, int x2, int y2, LColor::color = LColor::foreground, enum line_style = line_solid, enum line_width = line_thin); - + /// Here xp and yp are arrays of points PainterBase & lines(int const * xp, int const * yp, int np, LColor::color = LColor::foreground, enum line_style = line_solid, enum line_width = line_thin); - + /// Here xp and yp are arrays of points PainterBase & fillPolygon(int const * xp, int const * yp, int np, LColor::color = LColor::foreground); - + /// Draw lines from x1,y1 to x2,y2. They are arrays - PainterBase & segments(int const * x1, int const * y1, + PainterBase & segments(int const * x1, int const * y1, int const * x2, int const * y2, int ns, LColor::color = LColor::foreground, enum line_style = line_solid, enum line_width = line_thin); - - /// Draw a rectangle + + /// Draw a rectangle PainterBase & rectangle(int x, int y, int w, int h, LColor::color = LColor::foreground, enum line_style = line_solid, enum line_width = line_thin); - + /// Draw an arc - PainterBase & arc(int x, int y, unsigned int w, unsigned int h, + PainterBase & arc(int x, int y, unsigned int w, unsigned int h, int a1, int a2, LColor::color = LColor::foreground); - + /// Draw a pixel PainterBase & point(int x, int y, LColor::color = LColor::foreground); - + /// Fill a rectangle PainterBase & fillRectangle(int x, int y, int w, int h, LColor::color); - + /// For the graphics inset. PainterBase & image(int x, int y, int w, int h, grfx::GImage const & image); - + /// Draw a string at position x, y (y is the baseline) PainterBase & text(int x, int y, string const & str, LyXFont const & f); - + /** Draw a string at position x, y (y is the baseline) This is just for fast drawing */ PainterBase & text(int x, int y, char const * str, size_t l, LyXFont const & f); - + /// Draw a char at position x, y (y is the baseline) PainterBase & text(int x, int y, char c, LyXFont const & f); - + /// Draw a wide string at position x, y PainterBase & text(int x, int y, XChar2b const * str, int l, - LyXFont const & f); + LyXFont const & f); private: /// Check the font, and if set, draw an underline void underline(LyXFont const & f, int x, int y, int width); diff --git a/src/PainterBase.C b/src/PainterBase.C index ba7c818121..892815d713 100644 --- a/src/PainterBase.C +++ b/src/PainterBase.C @@ -1,8 +1,8 @@ /* This file is part of * ====================================================== - * + * * LyX, The Document Processor - * + * * Copyright 1998-2001 The LyX Team * *======================================================*/ @@ -64,13 +64,13 @@ PainterBase & PainterBase::buttonFrame(int x, int y, int w, int h) { // Width of a side of the button int d = 2; - + fillRectangle(x, y, w, d, LColor::top); fillRectangle(x, (y+h-d), w, d, LColor::bottom); - + // Now a couple of trapezoids int x1[4], y1[4]; - + x1[0] = x + d; y1[0] = y + d; x1[1] = x + d; y1[1] = (y + h - d); x1[2] = x; y1[2] = y + h; @@ -87,8 +87,8 @@ PainterBase & PainterBase::buttonFrame(int x, int y, int w, int h) } -PainterBase & PainterBase::rectText(int x, int baseline, - string const & str, +PainterBase & PainterBase::rectText(int x, int baseline, + string const & str, LyXFont const & font, LColor::color back, LColor::color frame) @@ -96,10 +96,10 @@ PainterBase & PainterBase::rectText(int x, int baseline, int width; int ascent; int descent; - + lyxfont::rectText(str, font, width, ascent, descent); rectangle(x, baseline - ascent, width, ascent + descent, frame); - fillRectangle(x + 1, baseline - ascent + 1, width - 1, + fillRectangle(x + 1, baseline - ascent + 1, width - 1, ascent + descent - 1, back); text(x + 3, baseline, str, font); return *this; @@ -107,13 +107,13 @@ PainterBase & PainterBase::rectText(int x, int baseline, PainterBase & PainterBase::buttonText(int x, int baseline, - string const & str, + string const & str, LyXFont const & font) { int width; int ascent; int descent; - + lyxfont::buttonText(str, font, width, ascent, descent); button(x, baseline - ascent, width, descent + ascent); text(x + 4, baseline, str, font); diff --git a/src/PainterBase.h b/src/PainterBase.h index d397100e1a..e5a8676bd8 100644 --- a/src/PainterBase.h +++ b/src/PainterBase.h @@ -1,9 +1,9 @@ // -*- C++ -*- /* This file is part of * ====================================================== - * + * * LyX, The Document Processor - * + * * Copyright 1998-2001 The LyX Team * *======================================================*/ @@ -25,15 +25,15 @@ namespace grfx { } /** A painter class to encapsulate all graphics parameters and operations - - Every graphics operation in LyX should be made by this class. It will + + Every graphics operation in LyX should be made by this class. It will be initialized and managed by the Screen class, and will be passed as a parameter to inset. - + It hides low level windows system parameters so insets and other clients don't have to worry about them and we can control graphics and GUI toolkit dependent drawing functions inside this single class. - + */ class PainterBase { public: @@ -44,7 +44,7 @@ public: /// line_thick }; - + /// enum line_style { /// @@ -54,13 +54,13 @@ public: /// line_onoffdash }; - + /// explicit PainterBase(WorkArea & wa) : owner(wa) {} - + /// virtual ~PainterBase() {} - + /* Screen geometry */ /// int paperMargin() const; @@ -68,14 +68,14 @@ public: int paperWidth() const; /// int paperHeight() const; - + /// Draw a line from point to point virtual PainterBase & line( - int x1, int y1, int x2, int y2, + int x1, int y1, int x2, int y2, LColor::color = LColor::foreground, enum line_style = line_solid, enum line_width = line_thin) = 0; - + /** Draw the lines between the lines in xp and yp. xp and yp are arrays of points, and np is the number of them. */ @@ -84,86 +84,86 @@ public: LColor::color = LColor::foreground, enum line_style = line_solid, enum line_width = line_thin) = 0; - + /// Here xp and yp are arrays of points virtual PainterBase & fillPolygon( int const * xp, int const * yp, int np, LColor::color = LColor::foreground) = 0; - + /// Draw lines from x1,y1 to x2,y2. They are arrays - virtual PainterBase & segments( - int const * x1, int const * y1, + virtual PainterBase & segments( + int const * x1, int const * y1, int const * x2, int const * y2, int ns, LColor::color = LColor::foreground, enum line_style = line_solid, enum line_width = line_thin) = 0; - - /// Draw a rectangle + + /// Draw a rectangle virtual PainterBase & rectangle( int x, int y, int w, int h, LColor::color = LColor::foreground, enum line_style = line_solid, enum line_width = line_thin) = 0; - + /// Draw a circle, d is the diameter, not the radious virtual PainterBase & circle( int x, int y, unsigned int d, LColor::color = LColor::foreground); - + /// Draw an ellipse virtual PainterBase & ellipse( int x, int y, unsigned int w, unsigned int h, LColor::color = LColor::foreground); - + /// Draw an arc virtual PainterBase & arc( int x, int y, - unsigned int w, unsigned int h, + unsigned int w, unsigned int h, int a1, int a2, LColor::color = LColor::foreground) = 0; - + /// Draw a pixel virtual PainterBase & point( int x, int y, LColor::color = LColor::foreground) = 0; - + /// Fill a rectangle virtual PainterBase & fillRectangle( int x, int y, int w, int h, LColor::color) = 0; - + /// A filled rectangle with the shape of a 3D button virtual PainterBase & button(int x, int y, int w, int h); - - /// - virtual PainterBase & buttonFrame(int x, int y, int w, int h); - - + + /// + virtual PainterBase & buttonFrame(int x, int y, int w, int h); + + // For the figure inset virtual PainterBase & image(int x, int y, int w, int h, grfx::GImage const & image) = 0; - + /// Draw a string at position x, y (y is the baseline) virtual PainterBase & text(int x, int y, string const & str, LyXFont const & f) = 0; - + /** Draw a string at position x, y (y is the baseline) This is just for fast drawing */ virtual PainterBase & text(int x, int y, char const * str, size_t l, LyXFont const & f) = 0; - + /// Draw a char at position x, y (y is the baseline) virtual PainterBase & text(int x, int y, char c, LyXFont const & f)=0; - + /** Draws a string and encloses it inside a rectangle. */ - PainterBase & rectText(int x, int baseline, - string const & string, + PainterBase & rectText(int x, int baseline, + string const & string, LyXFont const & font, LColor::color back, LColor::color frame); - + /** Draw a string and encloses it inside a button frame. */ PainterBase & buttonText(int x, int baseline, string const & s, LyXFont const & font); diff --git a/src/ParagraphParameters.C b/src/ParagraphParameters.C index 57912b441b..3542cb1bb8 100644 --- a/src/ParagraphParameters.C +++ b/src/ParagraphParameters.C @@ -1,4 +1,3 @@ - #include #ifdef __GNUG__ @@ -36,14 +35,14 @@ void ParagraphParameters::clear() tmp.labelwidthstring.erase(); tmp.start_of_appendix = false; #ifndef NO_PEXTRA_REALLY - //tmp.pextra_type = PEXTRA_NONE; - tmp.pextra_type = 0; - tmp.pextra_width.erase(); - tmp.pextra_widthp.erase(); - //tmp.pextra_alignment = MINIPAGE_ALIGN_TOP; - tmp.pextra_alignment = 0; - tmp.pextra_hfill = false; - tmp.pextra_start_minipage = false; + //tmp.pextra_type = PEXTRA_NONE; + tmp.pextra_type = 0; + tmp.pextra_width.erase(); + tmp.pextra_widthp.erase(); + //tmp.pextra_alignment = MINIPAGE_ALIGN_TOP; + tmp.pextra_alignment = 0; + tmp.pextra_hfill = false; + tmp.pextra_start_minipage = false; #endif set_from_struct(tmp); } @@ -62,18 +61,18 @@ bool ParagraphParameters::sameLayout(ParagraphParameters const & pp) const param->spacing == pp.param->spacing && #ifndef NO_PEXTRA_REALLY param->pextra_type == pp.param->pextra_type && - param->pextra_width == pp.param->pextra_width && - param->pextra_widthp == pp.param->pextra_widthp && - param->pextra_alignment == pp.param->pextra_alignment && - param->pextra_hfill == pp.param->pextra_hfill && - param->pextra_start_minipage == pp.param->pextra_start_minipage && + param->pextra_width == pp.param->pextra_width && + param->pextra_widthp == pp.param->pextra_widthp && + param->pextra_alignment == pp.param->pextra_alignment && + param->pextra_hfill == pp.param->pextra_hfill && + param->pextra_start_minipage == pp.param->pextra_start_minipage && #endif param->noindent == pp.param->noindent && param->depth == pp.param->depth; } -void ParagraphParameters::set_from_struct(ParameterStruct const & ps) +void ParagraphParameters::set_from_struct(ParameterStruct const & ps) { // get new param from container with tmp as template param = container.get(ps); diff --git a/src/ParameterStruct.h b/src/ParameterStruct.h index 51a8bd37fe..0f332b5a2a 100644 --- a/src/ParameterStruct.h +++ b/src/ParameterStruct.h @@ -36,7 +36,7 @@ struct ParameterStruct { /// LyXAlignment align; /// - depth_type depth; + depth_type depth; /// bool start_of_appendix; /// @@ -46,18 +46,18 @@ struct ParameterStruct { /// string labelwidthstring; #ifndef NO_PEXTRA_REALLY - /// - int pextra_type; - /// - string pextra_width; - /// - string pextra_widthp; - /// - int pextra_alignment; - /// - bool pextra_hfill; - /// - bool pextra_start_minipage; + /// + int pextra_type; + /// + string pextra_width; + /// + string pextra_widthp; + /// + int pextra_alignment; + /// + bool pextra_hfill; + /// + bool pextra_start_minipage; #endif }; @@ -77,7 +77,7 @@ ParameterStruct::ParameterStruct() inline bool operator==(ParameterStruct const & ps1, - ParameterStruct const & ps2) + ParameterStruct const & ps2) { return ps1.added_space_top == ps2.added_space_top && ps1.added_space_bottom == ps2.added_space_bottom @@ -102,7 +102,7 @@ bool operator==(ParameterStruct const & ps1, && ps1.pextra_start_minipage == ps2.pextra_start_minipage #endif ; - + } #endif diff --git a/src/PrinterParams.h b/src/PrinterParams.h index 4132017338..cdaeb29704 100644 --- a/src/PrinterParams.h +++ b/src/PrinterParams.h @@ -1,9 +1,9 @@ // -*- C++ -*- /* This file is part of * ====================================================== - * + * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team * @@ -73,11 +73,11 @@ struct PrinterParams { /// bool unsorted_copies; /// - int count_copies; + int count_copies; // The settings below should allow us to print any read-only doc in // whatever size/orientation we want it -- overriding the documents // settings. - // Override the documents orientation + // Override the documents orientation // bool orientation; // Print n pages per physical sheet // unsigned int nup; @@ -104,7 +104,7 @@ struct PrinterParams { } switch (target) { case PRINTER: -// Assert(!printer_name.empty()); +// Assert(!printer_name.empty()); break; case FILE: lyx::Assert(!file_name.empty()); diff --git a/src/Sectioning.C b/src/Sectioning.C index f14bb3b236..e779811fef 100644 --- a/src/Sectioning.C +++ b/src/Sectioning.C @@ -1,4 +1,3 @@ - #include #ifdef __GNUG__ diff --git a/src/ShareContainer.h b/src/ShareContainer.h index b36d1b652f..7fb74c79a0 100644 --- a/src/ShareContainer.h +++ b/src/ShareContainer.h @@ -66,7 +66,7 @@ private: return p.unique(); } }; - + /** Remove all unique items. This removes all elements from params that is only referenced from the private container. This can be considered a memory @@ -78,7 +78,7 @@ private: isUnique()); params.erase(it, params.end()); } - + /// The actual container. mutable Params params; }; diff --git a/src/Spacing.C b/src/Spacing.C index 30dd365a8f..1bbb945f9f 100644 --- a/src/Spacing.C +++ b/src/Spacing.C @@ -1,8 +1,8 @@ /* This file is part of - * ====================================================== - * + * ====================================================== + * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team. * @@ -23,8 +23,8 @@ using std::ostream; string const Spacing::spacing_string[] = {"single", "onehalf", "double", "other"}; - -float Spacing::getValue() const + +float Spacing::getValue() const { switch (space) { case Default: // nothing special should happen with this... @@ -63,9 +63,9 @@ void Spacing::set(Spacing::Space sp, string const & val) void Spacing::writeFile(ostream & os, bool para) const { if (space == Default) return; - + string cmd = para ? "\\paragraph_spacing " : "\\spacing "; - + if (getSpace() == Spacing::Other) { os.setf(ios::showpoint|ios::fixed); os.precision(2); @@ -73,7 +73,7 @@ void Spacing::writeFile(ostream & os, bool para) const << " " << getValue() << " \n"; } else { os << cmd << spacing_string[getSpace()] << " \n"; - } + } } diff --git a/src/Spacing.h b/src/Spacing.h index 2a3bb755dd..0395b3e0cf 100644 --- a/src/Spacing.h +++ b/src/Spacing.h @@ -1,9 +1,9 @@ // -*- C++ -*- /* This file is part of * ====================================================== - * + * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team. * @@ -63,7 +63,7 @@ public: string const writeEnvirBegin() const; /// string const writeEnvirEnd() const; - + private: /// Space space; diff --git a/src/TextCache.C b/src/TextCache.C index 48fd18fc76..31f97029f0 100644 --- a/src/TextCache.C +++ b/src/TextCache.C @@ -1,7 +1,7 @@ /* This file is part of - * ====================================================== - * - * LyX, The Document Processor + * ====================================================== + * + * LyX, The Document Processor * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team * diff --git a/src/TextCache.h b/src/TextCache.h index 93df369bb0..410e94eafc 100644 --- a/src/TextCache.h +++ b/src/TextCache.h @@ -1,8 +1,8 @@ // -*- C++ -*- /* This file is part of - * ====================================================== - * - * LyX, The Document Processor + * ====================================================== + * + * LyX, The Document Processor * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team * @@ -59,7 +59,7 @@ // I believe there are only three possible scenarios where the two first // are also covered by the third. // - The simplest scenario is what we have now, a single -// BufferView only. +// BufferView only. // o Opening // Nothing to do with the TextCache is done when opening a file. // o Switching @@ -114,7 +114,7 @@ class TextCache { public: /// typedef std::map > Cache; - + /// typedef Cache::value_type value_type; diff --git a/src/Thesaurus.C b/src/Thesaurus.C index b8e8a74594..ebfd3bda35 100644 --- a/src/Thesaurus.C +++ b/src/Thesaurus.C @@ -13,7 +13,7 @@ #ifdef HAVE_LIBAIKSAURUS #include - + using std::sort; Thesaurus::Thesaurus() @@ -36,14 +36,14 @@ Thesaurus::Meanings Thesaurus::lookup(string const & text) return meanings; // weird api, but ... - + int prev_meaning = -1; int cur_meaning; string meaning; - // correct, returns "" at the end + // correct, returns "" at the end string ret = aik_->next(cur_meaning); - + while (!ret.empty()) { if (cur_meaning != prev_meaning) { meaning = ret; @@ -52,9 +52,9 @@ Thesaurus::Meanings Thesaurus::lookup(string const & text) } else { if (ret != text) { meanings[meaning].push_back(ret); - } + } } - + ret = aik_->next(cur_meaning); } @@ -62,7 +62,7 @@ Thesaurus::Meanings Thesaurus::lookup(string const & text) it != meanings.end(); ++it) { sort(it->second.begin(), it->second.end()); } - + return meanings; } @@ -71,13 +71,13 @@ Thesaurus::Meanings Thesaurus::lookup(string const & text) Thesaurus::Thesaurus() { } - - + + Thesaurus::~Thesaurus() { } - + Thesaurus::Meanings Thesaurus::lookup(string const &) { return Meanings(); @@ -86,4 +86,4 @@ Thesaurus::Meanings Thesaurus::lookup(string const &) #endif // HAVE_LIBAIKSAURUS // Global instance -Thesaurus thesaurus; +Thesaurus thesaurus; diff --git a/src/Thesaurus.h b/src/Thesaurus.h index 083fcef223..12bb6a7820 100644 --- a/src/Thesaurus.h +++ b/src/Thesaurus.h @@ -9,15 +9,15 @@ #ifndef THESAURUS_H #define THESAURUS_H - + #include #include - + #include "LString.h" #ifdef HAVE_LIBAIKSAURUS #include "Aiksaurus.h" #endif - + /** * This class provides an interface to whatever thesauri we might support. */ @@ -30,7 +30,7 @@ public: ~Thesaurus(); typedef std::map > Meanings; - + /** * look up some text in the thesaurus */ @@ -41,7 +41,7 @@ private: Aiksaurus * aik_; #endif }; - + extern Thesaurus thesaurus; - + #endif diff --git a/src/ToolbarDefaults.C b/src/ToolbarDefaults.C index 37ea3a29ad..8930ae982a 100644 --- a/src/ToolbarDefaults.C +++ b/src/ToolbarDefaults.C @@ -1,6 +1,6 @@ /* This file is part of - * ====================================================== - * + * ====================================================== + * * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich @@ -62,7 +62,7 @@ void ToolbarDefaults::add(int action) } -void ToolbarDefaults::init() +void ToolbarDefaults::init() { add(LAYOUTS); add(LFUN_FILE_OPEN); @@ -75,19 +75,19 @@ void ToolbarDefaults::init() add(LFUN_COPY); add(LFUN_PASTE); add(SEPARATOR); - + add(LFUN_EMPH); add(LFUN_NOUN); add(LFUN_FREE); add(SEPARATOR); - + add(LFUN_INSET_FOOTNOTE); add(LFUN_INSET_MARGINAL); add(LFUN_DEPTH_PLUS); add(SEPARATOR); - add(LFUN_MATH_MODE); + add(LFUN_MATH_MODE); add(SEPARATOR); add(LFUN_INSET_GRAPHICS); @@ -95,7 +95,7 @@ void ToolbarDefaults::init() } -void ToolbarDefaults::read(LyXLex & lex) +void ToolbarDefaults::read(LyXLex & lex) { //consistency check if (compare_no_case(lex.getString(), "toolbar")) { @@ -104,9 +104,9 @@ void ToolbarDefaults::read(LyXLex & lex) } defaults.clear(); - + bool quit = false; - + lex.pushTable(toolTags, TO_LAST - 1); if (lyxerr.debugging(Debug::PARSER)) @@ -123,19 +123,19 @@ void ToolbarDefaults::read(LyXLex & lex) add(func); } break; - + case TO_SEPARATOR: add(SEPARATOR); break; - + case TO_LAYOUTS: add(LAYOUTS); break; - + case TO_NEWLINE: add(NEWLINE); break; - + case TO_ENDTOOLBAR: quit = true; break; @@ -155,7 +155,7 @@ void ToolbarDefaults::add(string const & func) if (tf == -1) { lyxerr << "Toolbar::add: no LyX command called `" - << func << "' exists!" << endl; + << func << "' exists!" << endl; } else { add(tf); } diff --git a/src/ToolbarDefaults.h b/src/ToolbarDefaults.h index f4bce2adfd..a3ffb4de2d 100644 --- a/src/ToolbarDefaults.h +++ b/src/ToolbarDefaults.h @@ -1,7 +1,7 @@ // -*- C++ -*- /* This file is part of - * ====================================================== - * + * ====================================================== + * * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich @@ -27,7 +27,7 @@ class LyXLex; /// class ToolbarDefaults { public: - /// The special toolbar actions + /// The special toolbar actions enum ItemType { /// adds space between buttons in the toolbar SEPARATOR=-3, diff --git a/src/Variables.C b/src/Variables.C index 22e41ed8b7..3edcdfb193 100644 --- a/src/Variables.C +++ b/src/Variables.C @@ -1,8 +1,8 @@ /* This file is part of -* ====================================================== -* +* ====================================================== +* * LyX, The Document Processor -* +* * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 the LyX Team. * @@ -22,7 +22,7 @@ void Variables::set(string const & var, string const & val) { // We want to use const_iterator (Lgb) Vars::iterator cit = vars_.find(var); - if (cit != vars_.end()) + if (cit != vars_.end()) vars_.erase(var); vars_[var] = val;; } @@ -31,9 +31,9 @@ void Variables::set(string const & var, string const & val) string const Variables::get(string const & var) const { Vars::const_iterator cit = vars_.find(var); - if (cit != vars_.end()) + if (cit != vars_.end()) return cit->second; - else + else return string(); } @@ -41,7 +41,7 @@ string const Variables::get(string const & var) const bool Variables::isSet(string const & var) const { Vars::const_iterator cit = vars_.find(var); - return (cit != vars_.end()); + return (cit != vars_.end()); } @@ -80,4 +80,3 @@ int main() { } #endif - diff --git a/src/Variables.h b/src/Variables.h index c7c092a5c0..e624a9b695 100644 --- a/src/Variables.h +++ b/src/Variables.h @@ -1,9 +1,9 @@ // -*- C++ -*- /* This file is part of -* ====================================================== -* +* ====================================================== +* * LyX, The Document Processor -* +* * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 the LyX Team. * @@ -23,13 +23,13 @@ /// class Variables { public: - /// + /// void set(string const &, string const &); - /// + /// string const get(string const &) const; /// bool isSet(string const & var) const; - /// + /// string const expand(string const &) const; private: /// diff --git a/src/WorkArea.C b/src/WorkArea.C index 6131ec7bb6..0335b1b6c6 100644 --- a/src/WorkArea.C +++ b/src/WorkArea.C @@ -1,8 +1,8 @@ /* This file is part of * ====================================================== - * + * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team. * @@ -34,7 +34,7 @@ // xforms doesn't define this (but it should be in ). extern "C" FL_APPEVENT_CB fl_set_preemptive_callback(Window, FL_APPEVENT_CB, void *); - + using std::endl; using std::abs; using std::hex; @@ -54,26 +54,26 @@ extern "C" { // Just a bunch of C wrappers around static members of WorkArea static void C_WorkArea_scroll_cb(FL_OBJECT * ob, long buf) - { + { WorkArea::scroll_cb(ob, buf); - } + } + - static int C_WorkArea_work_area_handler(FL_OBJECT * ob, int event, - FL_Coord, FL_Coord, + FL_Coord, FL_Coord, int key, void * xev) - { + { return WorkArea::work_area_handler(ob, event, 0, 0, key, xev); - } + } static int C_WorkAreaEventCB(FL_FORM * form, void * xev) { WorkArea * wa = static_cast(form->u_vdata); - int ret = wa->event_cb(static_cast(xev)); + int ret = wa->event_cb(static_cast(xev)); lyxerr << "Pending: " << XPending(fl_get_display()) << endl; - + return ret; } } @@ -115,7 +115,7 @@ WorkArea::WorkArea(int xpos, int ypos, int width, int height) int const splash_y = ypos + (height - splash_h) / 2; splash_ = obj = fl_add_pixmapbutton(FL_NORMAL_BUTTON, - splash_x, splash_y, + splash_x, splash_y, splash_w, splash_h, ""); fl_set_pixmapbutton_file(obj, splash_file.c_str()); fl_set_pixmapbutton_focus_outline(obj, 3); @@ -148,7 +148,7 @@ WorkArea::WorkArea(int xpos, int ypos, int width, int height) obj->u_vdata = this; fl_set_object_callback(obj, C_WorkArea_scroll_cb, 0); setScrollbarBounds(0.0, 0.0); - + /// /// The free object @@ -162,7 +162,7 @@ WorkArea::WorkArea(int xpos, int ypos, int width, int height) << xpos + bw << '+' << ypos + bw << ' ' << width - 15 - 2 * bw << 'x' << height - 2 * bw << endl; - + work_area = obj = fl_add_free(FL_ALL_FREE, xpos + bw, ypos + bw, width - 15 - 2 * bw, // scrollbarwidth @@ -177,8 +177,8 @@ WorkArea::WorkArea(int xpos, int ypos, int width, int height) /// X selection hook - xforms gets it wrong fl_current_form->u_vdata = this; - fl_register_raw_callback(fl_current_form, FL_ALL_EVENT, C_WorkAreaEventCB); - + fl_register_raw_callback(fl_current_form, FL_ALL_EVENT, C_WorkAreaEventCB); + fl_unfreeze_all_forms(); } @@ -208,7 +208,7 @@ bool WorkArea::belowMouse() const void WorkArea::resize(int xpos, int ypos, int width, int height) { fl_freeze_all_forms(); - + int const bw = int(abs(fl_get_border_width())); // a box @@ -245,7 +245,7 @@ void destroy_object(FL_OBJECT * obj) fl_free_object(obj); } } // namespace anon - + void WorkArea::createPixmap(int width, int height) { @@ -264,7 +264,7 @@ void WorkArea::createPixmap(int width, int height) if (cur_width == width && cur_height == height && workareapixmap) return; - + cur_width = width; cur_height = height; @@ -274,11 +274,11 @@ void WorkArea::createPixmap(int width, int height) if (lyxerr.debugging(Debug::WORKAREA)) lyxerr << "Creating pixmap (" << width << 'x' << height << ")" << endl; - + workareapixmap = XCreatePixmap(fl_get_display(), RootWindow(fl_get_display(), 0), width, - height, + height, fl_get_visual_depth()); if (lyxerr.debugging(Debug::WORKAREA)) lyxerr << "\tpixmap=" << workareapixmap << endl; @@ -339,12 +339,12 @@ int WorkArea::work_area_handler(FL_OBJECT * ob, int event, static int x_old = -1; static int y_old = -1; static long scrollbar_value_old = -1; - + XEvent * ev = static_cast(xev); WorkArea * area = static_cast(ob->u_vdata); if (!area) return 1; - + switch (event) { case FL_DRAW: if (!area->work_area || @@ -362,7 +362,7 @@ int WorkArea::work_area_handler(FL_OBJECT * ob, int event, ev->xbutton.y - ob->y, ev->xbutton.button); //area->workAreaKeyPress(XK_Pointer_Button1, ev->xbutton.state); - break; + break; case FL_RELEASE: if (!ev || ev->xbutton.button == 0) break; // Should really have used xbutton.state @@ -394,7 +394,7 @@ int WorkArea::work_area_handler(FL_OBJECT * ob, int event, #endif { lyxerr[Debug::WORKAREA] << "Workarea event: KEYBOARD" << endl; - + KeySym keysym = 0; char dummy[1]; XKeyEvent * xke = reinterpret_cast(ev); @@ -410,7 +410,7 @@ int WorkArea::work_area_handler(FL_OBJECT * ob, int event, char const * tmp2 = XKeysymToString(keysym); string const stm = (tmp ? tmp : ""); string const stm2 = (tmp2 ? tmp2 : ""); - + lyxerr[Debug::KEY] << "WorkArea: Key is `" << stm << "' [" << key << "]" << endl; lyxerr[Debug::KEY] << "WorkArea: Keysym is `" << stm2 << "' [" @@ -456,7 +456,7 @@ int WorkArea::work_area_handler(FL_OBJECT * ob, int event, << endl; //} } - + #endif unsigned int const ret_state = xke->state; @@ -489,7 +489,7 @@ int WorkArea::work_area_handler(FL_OBJECT * ob, int event, last_time_pressed = xke->time; last_key_pressed = xke->keycode; last_state_pressed = ret_state; - + area->workAreaKeyPress(ret_key, ret_state); } break; @@ -535,7 +535,7 @@ int WorkArea::work_area_handler(FL_OBJECT * ob, int event, lyxerr[Debug::WORKAREA] << "Workarea event: OTHER" << endl; break; } - + return 1; } @@ -546,13 +546,13 @@ string clipboard_selection; bool clipboard_read = false; extern "C" { - + static int request_clipboard_cb(FL_OBJECT * /*ob*/, long /*type*/, - void const * data, long size) + void const * data, long size) { clipboard_selection.erase(); - + if (size > 0) clipboard_selection.reserve(size); for (int i = 0; i < size; ++i) @@ -580,7 +580,7 @@ int WorkArea::event_cb(XEvent * xev) lyxerr[Debug::GUI] << "Lost selection." << endl; selectionLost.emit(); // ret = 1; - break; + break; } return ret; } @@ -592,24 +592,24 @@ void WorkArea::haveSelection(bool yes) const XSetSelectionOwner(fl_get_display(), XA_PRIMARY, None, CurrentTime); return; } - + XSetSelectionOwner(fl_get_display(), XA_PRIMARY, FL_ObjWin(work_area), CurrentTime); } - -string const WorkArea::getClipboard() const + +string const WorkArea::getClipboard() const { clipboard_read = false; - + if (fl_request_clipboard(work_area, 0, request_clipboard_cb) == -1) return string(); XEvent ev; - + while (!clipboard_read) { if (fl_check_forms() == FL_EVENT) { fl_XNextEvent(&ev); - lyxerr << "Received unhandled X11 event" << endl; + lyxerr << "Received unhandled X11 event" << endl; lyxerr << "Type: 0x" << hex << ev.xany.type << " Target: 0x" << hex << ev.xany.window << endl; } @@ -617,11 +617,11 @@ string const WorkArea::getClipboard() const return clipboard_selection; } - + void WorkArea::putClipboard(string const & s) const { static string hold; hold = s; - + fl_stuff_clipboard(work_area, 0, hold.data(), hold.size(), 0); } diff --git a/src/WorkArea.h b/src/WorkArea.h index c512b445bd..715f1f56e5 100644 --- a/src/WorkArea.h +++ b/src/WorkArea.h @@ -1,9 +1,9 @@ // -*- C++ -*- /* This file is part of * ====================================================== - * + * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team. * @@ -130,16 +130,16 @@ public: SigC::Signal0 selectionRequested; /// emitted when another X client has stolen our selection SigC::Signal0 selectionLost; - + /// handles SelectionRequest X Event, to fill the clipboard int event_cb(XEvent * xev); private: /// void createPixmap(int, int); - + /// FL_OBJECT * backgroundbox; - /// + /// FL_OBJECT * work_area; /// FL_OBJECT * scrollbar; diff --git a/src/XFormsView.C b/src/XFormsView.C index ce655b4090..bb73db762b 100644 --- a/src/XFormsView.C +++ b/src/XFormsView.C @@ -1,9 +1,8 @@ - /* This file is part of - * ====================================================== - * + * ====================================================== + * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team. * @@ -41,13 +40,13 @@ extern void QuitLyX(); BufferView * current_view; extern "C" { - + static int C_XFormsView_atCloseMainFormCB(FL_FORM * form, void * p) { return XFormsView::atCloseMainFormCB(form, p); } - + } @@ -62,7 +61,7 @@ XFormsView::XFormsView(int width, int height) &LyXFunc::miniDispatch)); minibuffer->timeout.connect(SigC::slot(getLyXFunc(), &LyXFunc::initMiniBuffer)); - + // Make sure the buttons are disabled if needed. updateToolbar(); } @@ -113,10 +112,10 @@ void XFormsView::show(int place, int border, string const & title) void XFormsView::create_form_form_main(int width, int height) /* to make this work as it should, .lyxrc should have been * read first; OR maybe this one should be made dynamic. - * Hmmmm. Lgb. + * Hmmmm. Lgb. * We will probably not have lyxrc before the main form is - * initialized, because error messages from lyxrc parsing - * are presented (and rightly so) in GUI popups. Asger. + * initialized, because error messages from lyxrc parsing + * are presented (and rightly so) in GUI popups. Asger. */ { // the main form @@ -128,7 +127,7 @@ void XFormsView::create_form_form_main(int width, int height) // Parameters for the appearance of the main form int const air = 2; int const bw = abs(fl_get_border_width()); - + // // THE MENUBAR // @@ -158,7 +157,7 @@ void XFormsView::create_form_form_main(int width, int height) // MINIBUFFER // - minibuffer = new MiniBuffer(this, air, height - (25 + air), + minibuffer = new MiniBuffer(this, air, height - (25 + air), width - (2 * air), 25); // @@ -166,12 +165,12 @@ void XFormsView::create_form_form_main(int width, int height) // autosave_timeout->timeout.connect(SigC::slot(this, &XFormsView::AutoSave)); - + // // Misc // - // assign an icon to main form + // assign an icon to main form string iconname = LibFileSearch("images", "lyx", "xpm"); if (!iconname.empty()) { unsigned int w, h; @@ -189,10 +188,10 @@ void XFormsView::create_form_form_main(int width, int height) // set min size fl_set_form_minsize(form_, 50, 50); - + fl_end_form(); - minibuffer->dd_init(); + minibuffer->dd_init(); } @@ -202,7 +201,7 @@ void XFormsView::init() invalidateLayoutChoice(); updateLayoutChoice(); updateMenubar(); - + // Start autosave timer if (lyxrc.autosave) { autosave_timeout->setTimeout(lyxrc.autosave * 1000); @@ -233,14 +232,14 @@ void XFormsView::prohibitInput() const static Cursor cursor; static bool cursor_undefined = true; - + if (cursor_undefined) { cursor = XCreateFontCursor(fl_get_display(), XC_watch); XFlush(fl_get_display()); cursor_undefined = false; } - - /* set the cursor to the watch for all forms and the canvas */ + + /* set the cursor to the watch for all forms and the canvas */ XDefineCursor(fl_get_display(), getForm()->window, cursor); XFlush(fl_get_display()); @@ -251,7 +250,7 @@ void XFormsView::prohibitInput() const void XFormsView::allowInput() const { /* reset the cursor from the watch for all forms and the canvas */ - + XUndefineCursor(fl_get_display(), getForm()->window); XFlush(fl_get_display()); diff --git a/src/XFormsView.h b/src/XFormsView.h index e3b052be77..f96cc9d5e9 100644 --- a/src/XFormsView.h +++ b/src/XFormsView.h @@ -1,9 +1,9 @@ // -*- C++ -*- /* This file is part of - * ====================================================== - * + * ====================================================== + * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team. * @@ -53,7 +53,7 @@ private: virtual void setWindowTitle(string const &, string const &); /// makes the main form. void create_form_form_main(int width, int height); - /// A pointer to the form. + /// A pointer to the form. FL_FORM * form_; }; #endif diff --git a/src/box.C b/src/box.C index afaba9c63e..41bb8bcfe3 100644 --- a/src/box.C +++ b/src/box.C @@ -24,7 +24,7 @@ bool Box::contained(int x, int y) y1 < y && y2 > y); } - + ostream & operator<<(ostream & o, Box const & b) { return o << "x1,y1: " << b.x1 << "," << b.y1 diff --git a/src/box.h b/src/box.h index 884a28eb5d..6ba0997205 100644 --- a/src/box.h +++ b/src/box.h @@ -36,8 +36,8 @@ struct Box { */ bool contained(int x, int y); }; - + std::ostream & operator<<(std::ostream &, Box const &); - + #endif // BOX_H diff --git a/src/broken_headers.h b/src/broken_headers.h index 7bccb61dd3..8c059344d3 100644 --- a/src/broken_headers.h +++ b/src/broken_headers.h @@ -1,13 +1,13 @@ /* -*- C++ -*- */ /* This file is part of -* ====================================================== -* +* ====================================================== +* * LyX, The Document Processor -* +* * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team * -* ====================================================== +* ====================================================== A few prototypes missing from Sun and SCO 3.2v4 header files */ #ifndef BROKEN_HEADERS_H diff --git a/src/bufferlist.C b/src/bufferlist.C index f0b289eb92..3b69c1d071 100644 --- a/src/bufferlist.C +++ b/src/bufferlist.C @@ -1,15 +1,15 @@ /* This file is part of - * ====================================================== - * + * ====================================================== + * * LyX, The Document Word Processor * * Copyright 1995 Matthias Ettrich - * Copyright 1995-2001 The LyX Team. + * Copyright 1995-2001 The LyX Team. * * This file is Copyright 1996-2001 * Lars Gullik Bjønnes * - * ====================================================== + * ====================================================== */ #include @@ -124,7 +124,7 @@ bool BufferList::qwriteOne(Buffer * buf, string const & fname, if (buf->isUnnamed()) { removeAutosaveFile(buf->fileName()); } - + unsaved_list += MakeDisplayPath(fname, 50) + "\n"; return true; case 3: // Cancel @@ -134,7 +134,7 @@ bool BufferList::qwriteOne(Buffer * buf, string const & fname, return true; } - + bool BufferList::qwriteAll() { string unsaved; @@ -151,10 +151,10 @@ bool BufferList::qwriteAll() return false; } } - + if (!unsaved.empty() && lyxrc.exit_confirmation) { return Alert::askQuestion(_("Some documents were not saved:"), - unsaved, _("Exit anyway?")); + unsaved, _("Exit anyway?")); } return true; @@ -167,7 +167,7 @@ void BufferList::closeAll() // Since we are closing we can just as well delete all // in the textcache this will also speed the closing/quiting up a bit. textcache.clear(); - + while (!bstore.empty()) { close(bstore.front()); } @@ -178,14 +178,14 @@ void BufferList::closeAll() bool BufferList::close(Buffer * buf) { lyx::Assert(buf); - + // CHECK // Trace back why we need to use buf->getUser here. // Perhaps slight rewrite is in order? (Lgb) - - if (buf->getUser()) + + if (buf->getUser()) buf->getUser()->insetUnlock(); - + if (buf->paragraph && !buf->isLyxClean() && !quitting) { if (buf->getUser()) buf->getUser()->owner()->prohibitInput(); @@ -260,7 +260,7 @@ Buffer * BufferList::getBuffer(unsigned int choice) int BufferList::unlockInset(UpdatableInset * inset) { lyx::Assert(inset); - + BufferStorage::iterator it = bstore.begin(); BufferStorage::iterator end = bstore.end(); for (; it != end; ++it) { @@ -298,21 +298,21 @@ void BufferList::emergencyWriteAll() } -void BufferList::emergencyWrite(Buffer * buf) +void BufferList::emergencyWrite(Buffer * buf) { // assert(buf) // this is not good since C assert takes an int - // and a pointer is a long (JMarc) + // and a pointer is a long (JMarc) assert(buf != 0); // use c assert to avoid a loop - + // No need to save if the buffer has not changed. if (buf->isLyxClean()) return; - + lyxerr << fmt(_("lyx: Attempting to save document %s as..."), buf->isUnnamed() ? OnlyFilename(buf->fileName()).c_str() : buf->fileName().c_str()) << endl; - + // We try to save three places: // 1) Same place as document. Unless it is an unnamed doc. @@ -328,7 +328,7 @@ void BufferList::emergencyWrite(Buffer * buf) lyxerr << _(" Save failed! Trying...") << endl; } } - + // 2) In HOME directory. string s = AddName(GetEnvPath("HOME"), buf->fileName()); s += ".emergency"; @@ -338,9 +338,9 @@ void BufferList::emergencyWrite(Buffer * buf) lyxerr << _(" Save seems successful. Phew.") << endl; return; } - + lyxerr << _(" Save failed! Trying...") << endl; - + // 3) In "/tmp" directory. // MakeAbsPath to prepend the current // drive letter on OS/2 @@ -366,11 +366,11 @@ Buffer * BufferList::readFile(string const & s, bool ronly) FileInfo fileInfo2(s); if (!fileInfo2.exist()) { - Alert::alert(_("Error!"), _("Cannot open file"), + Alert::alert(_("Error!"), _("Cannot open file"), MakeDisplayPath(s)); return 0; } - + Buffer * b = bstore.newBuffer(s, ronly); // Check if emergency save file exists and is newer. @@ -443,7 +443,7 @@ bool BufferList::exists(string const & s) const bool BufferList::isLoaded(Buffer const * b) const { lyx::Assert(b); - + BufferStorage::const_iterator cit = find(bstore.begin(), bstore.end(), b); return cit != bstore.end(); @@ -495,7 +495,7 @@ Buffer * BufferList::newFile(string const & name, string tname, bool isNamed) } b->setReadonly(false); - + return b; } @@ -511,7 +511,7 @@ Buffer * BufferList::loadLyXFile(string const & filename, bool tolastfiles) // file already open? if (exists(s)) { - if (Alert::askQuestion(_("Document is already open:"), + if (Alert::askQuestion(_("Document is already open:"), MakeDisplayPath(s, 50), _("Do you want to reload that document?"))) { // Reload is accomplished by closing and then loading @@ -520,7 +520,7 @@ Buffer * BufferList::loadLyXFile(string const & filename, bool tolastfiles) } // Fall through to new load. (Asger) } else { - // Here, we pretend that we just loaded the + // Here, we pretend that we just loaded the // open document return getBuffer(s); } @@ -542,7 +542,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. - if (Alert::askQuestion(_("Do you want to retrieve file under version control?"))) { + if (Alert::askQuestion(_("Do you want to retrieve file under version control?"))) { // How can we know _how_ to do the checkout? // With the current VC support it has to be, // a RCS file since CVS do not have special ,v files. @@ -550,7 +550,7 @@ Buffer * BufferList::loadLyXFile(string const & filename, bool tolastfiles) return loadLyXFile(filename, tolastfiles); } } - if (Alert::askQuestion(_("Cannot open specified file:"), + if (Alert::askQuestion(_("Cannot open specified file:"), MakeDisplayPath(s, 50), _("Create new document with this name?"))) { diff --git a/src/bufferlist.h b/src/bufferlist.h index c42e1f2a8e..b24f813d20 100644 --- a/src/bufferlist.h +++ b/src/bufferlist.h @@ -87,7 +87,7 @@ private: class BufferList : boost::noncopyable { public: /// - BufferList(); + BufferList(); /// state info enum list_state { @@ -99,7 +99,7 @@ public: /// returns the state of the bufferlist list_state getState() const { return state_; } - + /** Loads a LyX file or... @@ -107,22 +107,22 @@ public: \param tolastfiles Wether the file should be put in the last opened files list or not. \return The newly loaded LyX file. - */ - Buffer * loadLyXFile(string const & filename, + */ + Buffer * loadLyXFile(string const & filename, bool tolastfiles = true); - + /// bool empty() const; /// - bool qwriteAll(); + bool qwriteAll(); /// Close all open buffers. void closeAll(); /** Read a file into a buffer readonly or not. - \return + \return */ Buffer * readFile(string const &, bool ro); @@ -139,7 +139,7 @@ public: /// void emergencyWriteAll(); - + /** Close buffer. \param buf the buffer that should be closed @@ -149,13 +149,13 @@ public: /// Buffer * first(); - + /// returns true if the buffer exists already bool exists(string const &) const; /// returns true if the buffer is loaded bool isLoaded(Buffer const * b) const; - + /// returns a pointer to the buffer with the given name. Buffer * getBuffer(string const &); /// returns a pointer to the buffer with the given number. @@ -163,11 +163,11 @@ public: private: /// ask to save a buffer on quit bool qwriteOne(Buffer * buf, string const & fname, - string & unsaved_list); + string & unsaved_list); /// BufferStorage bstore; - + /// list_state state_; /// diff --git a/src/bufferparams.C b/src/bufferparams.C index 179d26604b..b24ee8e69d 100644 --- a/src/bufferparams.C +++ b/src/bufferparams.C @@ -1,8 +1,8 @@ /* This file is part of - * ====================================================== - * + * ====================================================== + * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team. * @@ -39,7 +39,7 @@ BufferParams::BufferParams() : textclass(textclasslist.NumberOfClass("article").second) { paragraph_separation = PARSEP_INDENT; - defskip = VSpace(VSpace::MEDSKIP); + defskip = VSpace(VSpace::MEDSKIP); quotes_language = InsetQuotes::EnglishQ; quotes_times = InsetQuotes::DoubleQ; fontsize = "default"; @@ -74,9 +74,9 @@ void BufferParams::writeFile(ostream & os) const // The top of the file is written by the buffer. // Prints out the buffer info into the .lyx file given by file - // the textclass - os << "\\textclass " << textclasslist[textclass].name() << '\n'; - + // the textclass + os << "\\textclass " << textclasslist[textclass].name() << '\n'; + // then the the preamble if (!preamble.empty()) { // remove '\n' from the end of preamble @@ -85,12 +85,12 @@ void BufferParams::writeFile(ostream & os) const << tmppreamble << "\n\\end_preamble\n"; } - - /* the options */ + + /* the options */ if (!options.empty()) { os << "\\options " << options << '\n'; } - + /* then the text parameters */ if (language != ignore_language) os << "\\language " << language->lang() << '\n'; @@ -113,31 +113,31 @@ void BufferParams::writeFile(ostream & os) const << "\n\\use_numerical_citations " << use_numerical_citations << "\n\\paperorientation " << string_orientation[orientation] << '\n'; - if (!paperwidth.empty()) + if (!paperwidth.empty()) os << "\\paperwidth " << VSpace(paperwidth).asLyXCommand() << '\n'; - if (!paperheight.empty()) + if (!paperheight.empty()) os << "\\paperheight " << VSpace(paperheight).asLyXCommand() << '\n'; - if (!leftmargin.empty()) + if (!leftmargin.empty()) os << "\\leftmargin " << VSpace(leftmargin).asLyXCommand() << '\n'; - if (!topmargin.empty()) + if (!topmargin.empty()) os << "\\topmargin " << VSpace(topmargin).asLyXCommand() << '\n'; - if (!rightmargin.empty()) + if (!rightmargin.empty()) os << "\\rightmargin " << VSpace(rightmargin).asLyXCommand() << '\n'; - if (!bottommargin.empty()) + if (!bottommargin.empty()) os << "\\bottommargin " << VSpace(bottommargin).asLyXCommand() << '\n'; - if (!headheight.empty()) + if (!headheight.empty()) os << "\\headheight " << VSpace(headheight).asLyXCommand() << '\n'; - if (!headsep.empty()) + if (!headsep.empty()) os << "\\headsep " << VSpace(headsep).asLyXCommand() << '\n'; - if (!footskip.empty()) + if (!footskip.empty()) os << "\\footskip " << VSpace(footskip).asLyXCommand() << '\n'; os << "\\secnumdepth " << secnumdepth @@ -151,7 +151,7 @@ void BufferParams::writeFile(ostream & os) const // An output operator for insetquotes would be nice case InsetQuotes::SingleQ: os << "\\quotes_times 1\n"; break; - case InsetQuotes::DoubleQ: + case InsetQuotes::DoubleQ: os << "\\quotes_times 2\n"; break; } os << "\\papercolumns " << columns @@ -223,7 +223,7 @@ void BufferParams::useClassDefaults() bool BufferParams::hasClassDefaults() const { LyXTextClass const & tclass = textclasslist[textclass]; - + return (sides == tclass.sides() && columns == tclass.columns() && pagestyle == tclass.pagestyle() @@ -246,7 +246,7 @@ void BufferParams::readPreamble(LyXLex & lex) void BufferParams::readLanguage(LyXLex & lex) { if (!lex.next()) return; - + string const tmptok = lex.getString(); // check if tmptok is part of tex_babel in tex-defs.h @@ -264,14 +264,14 @@ void BufferParams::readLanguage(LyXLex & lex) void BufferParams::readGraphicsDriver(LyXLex & lex) { if (!lex.next()) return; - + string const tmptok = lex.getString(); // check if tmptok is part of tex_graphics in tex_defs.h int n = 0; while (true) { string const test = tex_graphics[n++]; - - if (test == tmptok) { + + if (test == tmptok) { graphicsDriver = tmptok; break; } else if (test == "last_item") { @@ -280,6 +280,6 @@ void BufferParams::readGraphicsDriver(LyXLex & lex) " Setting graphics driver to `default'.\n"); graphicsDriver = "default"; break; - } + } } } diff --git a/src/bufferparams.h b/src/bufferparams.h index 476b52815e..811eeede6e 100644 --- a/src/bufferparams.h +++ b/src/bufferparams.h @@ -1,9 +1,9 @@ // -*- C++ -*- /* This file is part of - * ====================================================== - * + * ====================================================== + * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team. * @@ -130,19 +130,19 @@ public: /** Wether paragraphs are separated by using a indent like in articles or by using a little skip like in letters. */ - PARSEP paragraph_separation; + PARSEP paragraph_separation; /// InsetQuotes::quote_language quotes_language; /// InsetQuotes::quote_times quotes_times; /// - string fontsize; + string fontsize; /// - lyx::textclass_type textclass; + lyx::textclass_type textclass; /* this are for the PaperLayout */ /// the general papersize (papersize2 or paperpackage - char papersize; // add apprip. signedness + char papersize; // add apprip. signedness /// the selected Geometry papersize char papersize2; // add approp. signedness /// a special paperpackage .sty-file diff --git a/src/bufferview_funcs.C b/src/bufferview_funcs.C index 308c4dc796..d1718aa92f 100644 --- a/src/bufferview_funcs.C +++ b/src/bufferview_funcs.C @@ -1,8 +1,8 @@ /* This file is part of - * ====================================================== - * + * ====================================================== + * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team. * @@ -81,7 +81,7 @@ void changeDepth(BufferView * bv, LyXText * text, int decInc) { if (!bv->available() || !text) return; - + bv->hideCursor(); bv->update(bv->text, BufferView::SELECT|BufferView::FITCUR); if (decInc >= 0) @@ -124,7 +124,7 @@ void styleReset(BufferView * bv) { #ifndef INHERIT_LANG LyXFont font(LyXFont::ALL_INHERIT, ignore_language); -#else +#else LyXFont font(LyXFont::ALL_INHERIT); #endif toggleAndShow(bv, font); @@ -147,12 +147,12 @@ void fontSize(BufferView * bv, string const & size) } -// Returns the current font and depth as a message. +// Returns the current font and depth as a message. string const currentState(BufferView * bv) { ostringstream state; - if (bv->available()) { + if (bv->available()) { // I think we should only show changes from the default // font. (Asger) LyXText * text = bv->getLyXText(); @@ -164,12 +164,12 @@ string const currentState(BufferView * bv) state << _("Font:") << ' ' << font.stateText(&buffer->params); - + // The paragraph depth int depth = text->getDepth(); if (depth > 0) state << _(", Depth: ") << depth; - + // The paragraph spacing, but only if different from // buffer spacing. if (!text->cursor.par()->params().spacing().isDefault()) { @@ -180,7 +180,7 @@ string const currentState(BufferView * bv) switch (cur_space) { case Spacing::Single: state << _("Single"); - + break; case Spacing::Onehalf: state << _("Onehalf"); @@ -211,7 +211,7 @@ string const currentState(BufferView * bv) */ void toggleAndShow(BufferView * bv, LyXFont const & font, bool toggleall) { - if (bv->available()) { + if (bv->available()) { if (bv->theLockingInset()) { bv->theLockingInset()->setFont(bv, font, toggleall); return; @@ -229,7 +229,7 @@ void toggleAndShow(BufferView * bv, LyXFont const & font, bool toggleall) font.number() != LyXFont::IGNORE) { LyXCursor & cursor = text->cursor; text->computeBidiTables(bv->buffer(), cursor.row()); - if (cursor.boundary() != + if (cursor.boundary() != text->isBoundary(bv->buffer(), cursor.par(), cursor.pos(), text->real_current_font)) text->setCursor(bv, cursor.par(), cursor.pos(), diff --git a/src/bufferview_funcs.h b/src/bufferview_funcs.h index 01895550fb..bc8a1c5172 100644 --- a/src/bufferview_funcs.h +++ b/src/bufferview_funcs.h @@ -1,9 +1,9 @@ // -*- C++ -*- /* This file is part of - * ====================================================== - * + * ====================================================== + * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team. * @@ -50,7 +50,7 @@ extern void styleReset(BufferView *); extern void underline(BufferView *); /// extern void fontSize(BufferView *, string const &); -/// Returns the current font and depth as a message. +/// Returns the current font and depth as a message. extern string const currentState(BufferView *); /// extern void toggleAndShow(BufferView *, LyXFont const &, diff --git a/src/chset.C b/src/chset.C index c912b31149..2815485bf1 100644 --- a/src/chset.C +++ b/src/chset.C @@ -23,11 +23,11 @@ bool CharacterSet::loadFile(string const & fname) { map_.clear(); name_.erase(); - + // ascii 7-bit if (fname.empty() || fname == "ascii") return true; - + // open definition file lyxerr[Debug::KBMAP] << "Reading character set file " << fname << ".cdef" << endl; @@ -38,12 +38,12 @@ bool CharacterSet::loadFile(string const & fname) return true; // no definition, use 7-bit ascii } name_ = fname; - + string line; // Ok, I'll be the first to admit that this is probably not // the fastest way to parse the cdef files, but I though it // was a bit neat. Anyway it is wrong to use the lyxlex parse - // without the use of a keyword table. + // without the use of a keyword table. LRegex reg("^([12][0-9][0-9])[ \t]+\"([^ ]+)\".*"); while (getline(ifs, line)) { if (reg.exact_match(line)) { diff --git a/src/commandtags.h b/src/commandtags.h index a84313a032..f469118864 100644 --- a/src/commandtags.h +++ b/src/commandtags.h @@ -113,7 +113,7 @@ enum kb_action { LFUN_UMLAUT, LFUN_DOT, LFUN_OGONEK, - LFUN_VECTOR, // 90 // Alejandro 040696 + LFUN_VECTOR, // 90 // Alejandro 040696 LFUN_SELFINSERT, LFUN_GETBUFNAME, LFUN_GETXY, @@ -214,8 +214,8 @@ enum kb_action { LFUN_CHILDOPEN, // Ale 970528 LFUN_TOC_INSERT, // Lgb 97-05-27 LFUN_FLOAT_LIST, // Lgb 20010503 - LFUN_READ_ONLY_TOGGLE, // Lgb 97-05-27 - LFUN_BIBDB_ADD, // Ale 970530 + LFUN_READ_ONLY_TOGGLE, // Lgb 97-05-27 + LFUN_BIBDB_ADD, // Ale 970530 LFUN_BIBDB_DEL, // Ale 970530 LFUN_BIBTEX_STYLE, // 190 // Ale 970530 LFUN_GETTIP, // Ale 970603 @@ -259,7 +259,7 @@ enum kb_action { LFUN_LOFVIEW, // 230 // Dekel 20000519 LFUN_LOTVIEW, // Dekel 20000519 LFUN_LOAVIEW, // Dekel 20000519 - LFUN_SET_COLOR, // SLior 20000611 + LFUN_SET_COLOR, // SLior 20000611 LFUN_INSET_EXTERNAL, // Alstrup 20000609 LFUN_INSET_MARGINAL, // Lgb 20000626 LFUN_INSET_MINIPAGE, // Lgb 20000627 diff --git a/src/converter.C b/src/converter.C index f74584cc1b..1e09a7c869 100644 --- a/src/converter.C +++ b/src/converter.C @@ -1,8 +1,8 @@ /* This file is part of - * ====================================================== - * + * ====================================================== + * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team. * @@ -72,7 +72,7 @@ bool Format::isChildFormat() const { if (name_.empty()) return false; - return isdigit(name_[name_.length() - 1]); + return isdigit(name_[name_.length() - 1]); } @@ -116,10 +116,10 @@ void Formats::add(string const & name) } -void Formats::add(string const & name, string const & extension, +void Formats::add(string const & name, string const & extension, string const & prettyname, string const & shortcut) { - FormatList::iterator it = + FormatList::iterator it = find_if(formatlist.begin(), formatlist.end(), lyx::compare_memfun(&Format::name, name)); if (it == formatlist.end()) @@ -134,7 +134,7 @@ void Formats::add(string const & name, string const & extension, void Formats::erase(string const & name) { - FormatList::iterator it = + FormatList::iterator it = find_if(formatlist.begin(), formatlist.end(), lyx::compare_memfun(&Format::name, name)); if (it != formatlist.end()) @@ -185,10 +185,10 @@ bool Formats::view(Buffer const * buffer, string const & filename, if (paper_size == "letter") paper_size = "us"; command += " " + paper_size; - if (buffer->params.orientation + if (buffer->params.orientation == BufferParams::ORIENTATION_LANDSCAPE) command += 'r'; - } + } command += " " + QuoteName(OnlyFilename((filename))); @@ -325,7 +325,7 @@ void Converters::add(string const & from, string const & to, converter.flags = flags; } converter.readFlags(); - + if (converter.latex && (latex_command_.empty() || to == "dvi")) latex_command_ = subst(command, token_from, ""); // If we have both latex & pdflatex, we set latex_command to latex. @@ -355,10 +355,10 @@ void Converters::erase(string const & from, string const & to) // This method updates the pointers From and To in all the converters. // The code is not very efficient, but it doesn't matter as the number // of formats and converters is small. -// Furthermore, this method is called only on startup, or after +// Furthermore, this method is called only on startup, or after // adding/deleting a format in FormPreferences (the latter calls can be // eliminated if the formats in the Formats class are stored using a map or -// a list (instead of a vector), but this will cause other problems). +// a list (instead of a vector), but this will cause other problems). void Converters::update(Formats const & formats) { ConverterList::iterator it = converterlist_.begin(); @@ -419,7 +419,7 @@ Converters::getReachableTo(string const & target, bool clear_visited) if (i != s || target != "lyx") { result.push_back(&formats.get(i)); } - + vector::iterator it = vertices_[i].in_vertices.begin(); vector::iterator end = vertices_[i].in_vertices.end(); for (; it != end; ++it) { @@ -523,7 +523,7 @@ Converters::getPath(string const & from, string const & to) found = true; break; } - + vector::const_iterator beg = vertices_[i].out_vertices.begin(); vector::const_iterator cit = beg; @@ -615,8 +615,8 @@ bool Converters::convert(Buffer const * buffer, } else { if (conv.need_aux && !run_latex && !latex_command_.empty()) { - lyxerr[Debug::FILES] - << "Running " << latex_command_ + lyxerr[Debug::FILES] + << "Running " << latex_command_ << " to update aux file"<< endl; runLaTeX(buffer, latex_command_); } @@ -704,11 +704,11 @@ bool Converters::convert(Buffer const * buffer, } } return true; - } else + } else return move(outfile, to_file, conv.latex); } -// If from = /path/file.ext and to = /path2/file2.ext2 then this method +// If from = /path/file.ext and to = /path2/file2.ext2 then this method // moves each /path/file*.ext file to /path2/file2*.ext2' bool Converters::move(string const & from, string const & to, bool copy) { @@ -728,7 +728,7 @@ bool Converters::move(string const & from, string const & to, bool copy) string from2 = path + *it; string to2 = to_base + it->substr(base.length()); to2 = ChangeExtension(to2, to_extension); - lyxerr[Debug::FILES] << "moving " << from2 + lyxerr[Debug::FILES] << "moving " << from2 << " to " << to2 << endl; bool moved = (copy) ? lyx::copy(from2, to2) @@ -848,7 +848,7 @@ bool Converters::runLaTeX(Buffer const * buffer, string const & command) // do the LaTeX run(s) string name = buffer->getLatexName(); - LaTeX latex(command, name, buffer->filePath()); + LaTeX latex(command, name, buffer->filePath()); TeXErrors terr; int result = latex.run(terr, bv ? bv->owner()->getLyXFunc() : 0); @@ -888,12 +888,12 @@ bool Converters::runLaTeX(Buffer const * buffer, string const & command) if (bv) bv->owner()->allowInput(); - - int const ERROR_MASK = + + int const ERROR_MASK = LaTeX::NO_LOGFILE | LaTeX::ERRORS | LaTeX::NO_OUTPUT; - + return (result & ERROR_MASK) == 0; } diff --git a/src/converter.h b/src/converter.h index ebc5b9abfe..0f507af1ac 100644 --- a/src/converter.h +++ b/src/converter.h @@ -1,9 +1,9 @@ // -*- C++ -*- /* This file is part of - * ====================================================== - * + * ====================================================== + * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team. * @@ -84,8 +84,8 @@ bool operator<(Format const & a, Format const & b) /// class Formats { public: - /// - typedef std::vector FormatList; + /// + typedef std::vector FormatList; /// typedef FormatList::const_iterator const_iterator; /// @@ -99,7 +99,7 @@ public: /// void add(string const & name); /// - void add(string const & name, string const & extension, + void add(string const & name, string const & extension, string const & prettyname, string const & shortcut); /// void erase(string const & name); @@ -176,7 +176,7 @@ public: /// class Converters { public: - typedef std::vector ConverterList; + typedef std::vector ConverterList; /// typedef ConverterList::const_iterator const_iterator; /// @@ -241,7 +241,7 @@ public: } private: /// - bool scanLog(Buffer const * buffer, string const & command, + bool scanLog(Buffer const * buffer, string const & command, string const & filename); /// bool runLaTeX(Buffer const * buffer, string const & command); diff --git a/src/counters.C b/src/counters.C index 0fa97db461..af660bf46d 100644 --- a/src/counters.C +++ b/src/counters.C @@ -1,6 +1,6 @@ /* This file is part of - * ====================================================== - * + * ====================================================== + * * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich @@ -58,7 +58,7 @@ void Counter::reset() } -Counters::~Counters() +Counters::~Counters() { // We need this since we store the Counter's as pointers in // the counterList. @@ -106,7 +106,7 @@ void Counters::newCounter(string const & newc, string const & oldc) } -void Counters::set(string const & ctr, int val) +void Counters::set(string const & ctr, int val) { CounterList::iterator it = counterList.find(ctr); if (it == counterList.end()) { @@ -128,7 +128,7 @@ void Counters::addto(string const & ctr, int val) } -int Counters::value(string const & ctr) const +int Counters::value(string const & ctr) const { CounterList::const_iterator cit = counterList.find(ctr); if (cit == counterList.end()) { diff --git a/src/counters.h b/src/counters.h index bcd900476c..e17474234a 100644 --- a/src/counters.h +++ b/src/counters.h @@ -1,7 +1,7 @@ // -*- C++ -*- /* This file is part of - * ====================================================== - * + * ====================================================== + * * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich diff --git a/src/debug.C b/src/debug.C index b5213386f5..b629f57a0d 100644 --- a/src/debug.C +++ b/src/debug.C @@ -1,8 +1,8 @@ /* This file is part of -* ====================================================== -* +* ====================================================== +* * LyX, The Document Processor -* +* * Copyright 1999-2001 The LyX Team. * * ====================================================== */ @@ -64,7 +64,7 @@ int const numErrorTags = sizeof(errorTags)/sizeof(error_item); } // namespace anon - + Debug::type const Debug::ANY = Debug::type( Debug::INFO | Debug::INIT | Debug::KEY | Debug::GUI | Debug::PARSER | Debug::LYXRC | Debug::KBMAP | Debug::LATEX | @@ -74,7 +74,7 @@ Debug::type const Debug::ANY = Debug::type( Debug::INSETTEXT | Debug::GRAPHICS); -Debug::type Debug::value(string const & val) +Debug::type Debug::value(string const & val) { type l = Debug::NONE; string v(val); @@ -84,11 +84,11 @@ Debug::type Debug::value(string const & val) if (tmp.empty()) break; // Is it a number? - if (isStrInt(tmp)) + if (isStrInt(tmp)) l |= static_cast(strToInt(tmp)); else // Search for an explicit name - for (int i = 0 ; i < numErrorTags ; ++i) + for (int i = 0 ; i < numErrorTags ; ++i) if (tmp == errorTags[i].name) { l |= errorTags[i].level; break; @@ -112,7 +112,7 @@ void Debug::showLevel(ostream & o, Debug::type level) } -void Debug::showTags(ostream & os) +void Debug::showTags(ostream & os) { for (int i = 0 ; i < numErrorTags ; ++i) os << setw(7) << errorTags[i].level diff --git a/src/debug.h b/src/debug.h index 654c7835f9..cb3d87e799 100644 --- a/src/debug.h +++ b/src/debug.h @@ -1,9 +1,9 @@ // -*- C++ -*- /* This file is part of - * ====================================================== - * + * ====================================================== + * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team. * @@ -80,10 +80,10 @@ struct Debug { /** A function to convert symbolic string names on debug levels to their numerical value. */ - static Debug::type value(string const & val); + static Debug::type value(string const & val); - /** Display the tags and descriptions of the current debug level - of ds + /** Display the tags and descriptions of the current debug level + of ds */ static void showLevel(std::ostream & o, type level); diff --git a/src/encoding.C b/src/encoding.C index 118b6a6a84..9d12136428 100644 --- a/src/encoding.C +++ b/src/encoding.C @@ -1,8 +1,8 @@ /* This file is part of - * ====================================================== - * + * ====================================================== + * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team. * @@ -74,7 +74,7 @@ Uchar tab_symbol[256] = { 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - + 0xffff, 0x03d2, 0x2032, 0x2264, 0x2215, 0x221e, 0xffff, 0x2663, 0x2666, 0x2665, 0x2660, 0x2194, 0x2190, 0x2191, 0x2192, 0x2193, @@ -113,16 +113,16 @@ unsigned char arabic_table2[63][4] = { {0x4e, 0xc0, 0xbe, 0xbf}, // 0xce = khaa {0x4f, 0xa6, 0xa6, 0xa6}, // 0xcf = dal - {0x50, 0xa7, 0xa7, 0xa7}, // 0xd0 = thal - {0x51, 0xa8, 0xa8, 0xa8}, // 0xd1 = ra - {0x52, 0xa9, 0xa9, 0xa9}, // 0xd2 = zain - {0x53, 0xc3, 0xc1, 0xc2}, // 0xd3 = seen + {0x50, 0xa7, 0xa7, 0xa7}, // 0xd0 = thal + {0x51, 0xa8, 0xa8, 0xa8}, // 0xd1 = ra + {0x52, 0xa9, 0xa9, 0xa9}, // 0xd2 = zain + {0x53, 0xc3, 0xc1, 0xc2}, // 0xd3 = seen {0x54, 0xc6, 0xc4, 0xc5}, // 0xd4 = sheen - {0x55, 0xc9, 0xc7, 0xc8}, // 0xd5 = sad - {0x56, 0xcc, 0xca, 0xcb}, // 0xd6 = dad - {0x57, 0xcf, 0xcd, 0xce}, // 0xd7 = tah - {0x58, 0xd2, 0xd0, 0xd1}, // 0xd8 = zah - {0x59, 0xd5, 0xd3, 0xd4}, // 0xd9 = ain + {0x55, 0xc9, 0xc7, 0xc8}, // 0xd5 = sad + {0x56, 0xcc, 0xca, 0xcb}, // 0xd6 = dad + {0x57, 0xcf, 0xcd, 0xce}, // 0xd7 = tah + {0x58, 0xd2, 0xd0, 0xd1}, // 0xd8 = zah + {0x59, 0xd5, 0xd3, 0xd4}, // 0xd9 = ain {0x5a, 0xd8, 0xd6, 0xd7}, // 0xda = ghain {0,0,0,0}, // 0xdb {0,0,0,0}, // 0xdc @@ -130,17 +130,17 @@ unsigned char arabic_table2[63][4] = { {0,0,0,0}, // 0xde {0,0,0,0}, // 0xdf - {0,0,0,0}, // 0xe0 - {0x61, 0xdb, 0xd9, 0xda}, // 0xe1 = fa - {0x62, 0xde, 0xdc, 0xdd}, // 0xe2 = qaf - {0x63, 0xe1, 0xdf, 0xe0}, // 0xe3 = kaf - {0x64, 0xe4, 0xe2, 0xe3}, // 0xe4 = lam - {0x65, 0xe7, 0xe5, 0xe6}, // 0xe5 = meem - {0x66, 0xea, 0xe8, 0xe9}, // 0xe6 = noon - {0x67, 0xed, 0xeb, 0xec}, // 0xe7 = ha - {0x68, 0xaa, 0xaa, 0xaa}, // 0xe8 = waw + {0,0,0,0}, // 0xe0 + {0x61, 0xdb, 0xd9, 0xda}, // 0xe1 = fa + {0x62, 0xde, 0xdc, 0xdd}, // 0xe2 = qaf + {0x63, 0xe1, 0xdf, 0xe0}, // 0xe3 = kaf + {0x64, 0xe4, 0xe2, 0xe3}, // 0xe4 = lam + {0x65, 0xe7, 0xe5, 0xe6}, // 0xe5 = meem + {0x66, 0xea, 0xe8, 0xe9}, // 0xe6 = noon + {0x67, 0xed, 0xeb, 0xec}, // 0xe7 = ha + {0x68, 0xaa, 0xaa, 0xaa}, // 0xe8 = waw {0x69, 0xab, 0xab, 0xab}, // 0xe9 = alef maksura - {0x6a, 0xf0, 0xee, 0xef}, // 0xea = ya + {0x6a, 0xf0, 0xee, 0xef}, // 0xea = ya {0x6b, 0x6b, 0x6b, 0x6b}, // 0xeb = fathatan {0x6c, 0x6c, 0x6c, 0x6c}, // 0xec = dammatan {0x6d, 0x6d, 0x6d, 0x6d}, // 0xed = kasratan @@ -275,7 +275,7 @@ unsigned char Encodings::TransformChar(unsigned char c, Encoding const * Encodings::getEncoding(string const & encoding) const { - EncodingList::const_iterator it = encodinglist.find(encoding); + EncodingList::const_iterator it = encodinglist.find(encoding); if (it != encodinglist.end()) return &it->second; else @@ -285,7 +285,7 @@ Encoding const * Encodings::getEncoding(string const & encoding) const Encodings::Encodings() { encodinglist["iso8859-1"] = Encoding("iso8859-1", "latin1", tab_iso8859_1); - symbol_encoding_ = + symbol_encoding_ = #ifdef USE_UNICODE_FOR_SYMBOLS Encoding("symbol", "", tab_symbol); #else diff --git a/src/encoding.h b/src/encoding.h index 85f9614757..fe429862cd 100644 --- a/src/encoding.h +++ b/src/encoding.h @@ -1,9 +1,9 @@ // -*- C++ -*- /* This file is part of - * ====================================================== - * + * ====================================================== + * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team. * diff --git a/src/exporter.C b/src/exporter.C index fda1a6ec0f..7d9c2b3f09 100644 --- a/src/exporter.C +++ b/src/exporter.C @@ -1,8 +1,8 @@ /* This file is part of - * ====================================================== - * + * ====================================================== + * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team. * @@ -69,7 +69,7 @@ bool Exporter::Export(Buffer * buffer, string const & format, string filename = buffer->getLatexName(false); if (!buffer->tmppath.empty()) filename = AddName(buffer->tmppath, filename); - filename = ChangeExtension(filename, + filename = ChangeExtension(filename, formats.extension(backend_format)); // Ascii backend @@ -138,7 +138,7 @@ vector const Exporter::GetExportableFormats(Buffer const * buffer, bool only_viewable) { vector backends = Backends(buffer); - vector result = + vector result = converters.getReachable(backends[0], only_viewable, true); for (vector::const_iterator it = backends.begin() + 1; it != backends.end(); ++it) { diff --git a/src/exporter.h b/src/exporter.h index d1f3c8d6fd..9944d6c47f 100644 --- a/src/exporter.h +++ b/src/exporter.h @@ -1,9 +1,9 @@ // -*- C++ -*- /* This file is part of - * ====================================================== - * + * ====================================================== + * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team. * diff --git a/src/font.C b/src/font.C index 0f7e707c9f..f9bcb0ec80 100644 --- a/src/font.C +++ b/src/font.C @@ -1,8 +1,8 @@ /* This file is part of - * ====================================================== - * + * ====================================================== + * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team. * @@ -60,7 +60,7 @@ int lyxfont::ascent(char c, LyXFont const & f) unsigned int uc = static_cast(c); if (finfo->per_char && uc >= finfo->min_char_or_byte2 - && uc <= finfo->max_char_or_byte2+256*finfo->max_byte1) + && uc <= finfo->max_char_or_byte2+256*finfo->max_byte1) return finfo->per_char[uc - finfo->min_char_or_byte2].ascent; else return finfo->ascent; @@ -73,7 +73,7 @@ int lyxfont::descent(char c, LyXFont const & f) unsigned int uc = static_cast(c); if (finfo->per_char && uc >= finfo->min_char_or_byte2 - && uc <= finfo->max_char_or_byte2+256*finfo->max_byte1) + && uc <= finfo->max_char_or_byte2+256*finfo->max_byte1) return finfo->per_char[uc - finfo->min_char_or_byte2].descent; else return finfo->descent; @@ -86,7 +86,7 @@ int lyxfont::lbearing(char c, LyXFont const & f) unsigned int uc = static_cast(c); if (finfo->per_char && uc >= finfo->min_char_or_byte2 - && uc <= finfo->max_char_or_byte2+256*finfo->max_byte1) + && uc <= finfo->max_char_or_byte2+256*finfo->max_byte1) return finfo->per_char[uc - finfo->min_char_or_byte2].lbearing; else return 0; @@ -99,7 +99,7 @@ int lyxfont::rbearing(char c, LyXFont const & f) unsigned int uc = static_cast(c); if (finfo->per_char && uc >= finfo->min_char_or_byte2 - && uc <= finfo->max_char_or_byte2+256*finfo->max_byte1) + && uc <= finfo->max_char_or_byte2+256*finfo->max_byte1) return finfo->per_char[uc - finfo->min_char_or_byte2].rbearing; else return width(c, f); @@ -126,7 +126,7 @@ int lyxfont::width(char const * s, size_t n, LyXFont const & f) Uchar c = encoding->ucs(s[i]); xs[i].byte1 = c >> 8; xs[i].byte2 = c & 0xff; - } + } int result = width(xs.get(), n, font); return result; } @@ -167,7 +167,7 @@ int lyxfont::width(XChar2b const * s, int n, LyXFont const & f) { if (!lyxrc.use_gui) return n; - + if (f.realShape() != LyXFont::SMALLCAPS_SHAPE) { return ::XTextWidth16(getXFontstruct(f), s, n); } else { @@ -205,7 +205,7 @@ int lyxfont::XTextWidth16(LyXFont const & f, XChar2b const * str, int count) } -void lyxfont::XSetFont(Display * display, GC gc, LyXFont const & f) +void lyxfont::XSetFont(Display * display, GC gc, LyXFont const & f) { ::XSetFont(display, gc, getFontID(f)); } @@ -226,7 +226,7 @@ void lyxfont::buttonText(string const & str, LyXFont const & font, int & width, int & ascent, int & descent) { static int const d = 3; - + width = lyxfont::width(str, font) + d * 2 + 2; ascent = lyxfont::maxAscent(font) + d; descent = lyxfont::maxDescent(font) + d; diff --git a/src/font.h b/src/font.h index 51d50e93d6..eb4b71ca2a 100644 --- a/src/font.h +++ b/src/font.h @@ -1,9 +1,9 @@ // -*- C++ -*- /* This file is part of - * ====================================================== - * + * ====================================================== + * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team. * diff --git a/src/gettext.C b/src/gettext.C index d8b9b96bc6..e65081c71c 100644 --- a/src/gettext.C +++ b/src/gettext.C @@ -1,8 +1,8 @@ /* This file is part of - * ====================================================== - * + * ====================================================== + * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team. * @@ -38,7 +38,7 @@ char const * _(char const * str) } -string const _(string const & str) +string const _(string const & str) { if (!str.empty()) { int const s = str.length(); @@ -65,7 +65,7 @@ void locale_init() void gettext_init(string const & localedir) { - bindtextdomain(PACKAGE, localedir.c_str()); + bindtextdomain(PACKAGE, localedir.c_str()); textdomain(PACKAGE); } diff --git a/src/graphics/ChangeLog b/src/graphics/ChangeLog index 8ed1e59940..0c63f7fcd9 100644 --- a/src/graphics/ChangeLog +++ b/src/graphics/ChangeLog @@ -1,5 +1,7 @@ 2002-03-21 Lars Gullik Bjønnes + * most files: ws cleanup + * Makefile.am: remove ld -r stuff 2002-03-20 Lars Gullik Bjønnes @@ -99,7 +101,7 @@ 2002-01-17 John Levon * ImageLoaderXPM.C: don't set XpmColorKey flag if we don't use it - + 2001-12-19 Jean-Marc Lasgouttes * GraphicsCacheItem.h: do not include in header files @@ -147,7 +149,7 @@ 2001-07-03 Jean-Marc Lasgouttes * ImageLoaderXPM.C (runImageLoader): get display information from - GUIRunTime. + GUIRunTime. 2001-06-14 Angus Leeming @@ -165,8 +167,8 @@ 2001-04-16 Allan Rae * ImageLoaderXPM.C (runImageLoader): #warning triggers an error on Sun - CC 6.0 as an unrecognised preprocessor directive. So ensure they're - wrapped. + CC 6.0 as an unrecognised preprocessor directive. So ensure they're + wrapped. 2001-04-02 Baruch Even diff --git a/src/graphics/GraphicsCache.C b/src/graphics/GraphicsCache.C index 0c86a59413..59b27d4dd1 100644 --- a/src/graphics/GraphicsCache.C +++ b/src/graphics/GraphicsCache.C @@ -147,7 +147,7 @@ GCache::find(InsetGraphics const & inset) if (it->second->referencedBy(inset)) return it; } - + return cache->end(); } @@ -161,7 +161,7 @@ GCache::find(InsetGraphics const & inset) const if (it->second->referencedBy(inset)) return it; } - + return cache->end(); } diff --git a/src/graphics/GraphicsCache.h b/src/graphics/GraphicsCache.h index e6297572fe..05d5320dd3 100644 --- a/src/graphics/GraphicsCache.h +++ b/src/graphics/GraphicsCache.h @@ -9,7 +9,7 @@ * * grfx::GCache is the manager of the image cache. * It is responsible for creating the grfx::GCacheItem's and maintaining them. - * + * * grfx::GCache is a singleton class. It is possible to have only one * instance of it at any moment. */ @@ -93,7 +93,7 @@ private: */ CacheType * cache; }; - + } // namespace grfx diff --git a/src/graphics/GraphicsCacheItem.C b/src/graphics/GraphicsCacheItem.C index c9e1d6ab66..dfd9cd23a6 100644 --- a/src/graphics/GraphicsCacheItem.C +++ b/src/graphics/GraphicsCacheItem.C @@ -48,7 +48,7 @@ GCacheItem::GCacheItem(InsetGraphics const & inset, GParams const & params) namespace { typedef GCacheItem::ModifiedItemPtr ModifiedItemPtr; - + class Compare_Params { public: Compare_Params(GParams const & p) : p_(p) {} @@ -112,7 +112,7 @@ void GCacheItem::modify(InsetGraphics const & inset, GParams const & params) (*it)->add(inset); return; } - + // If no ModifiedItem exists with these params, then create one. ModifiedItemPtr item(new ModifiedItem(inset, params, image_)); modified_images.push_back(item); @@ -187,7 +187,7 @@ ImagePtr const GCacheItem::image(InsetGraphics const & inset) const // find a ModifiedItem that is referenced by this inset. ListType::const_iterator begin = modified_images.begin(); ListType::const_iterator end = modified_images.end(); - ListType::const_iterator it = + ListType::const_iterator it = std::find_if(begin, end, Find_Inset(inset)); // Someone's being daft. @@ -212,7 +212,7 @@ ImageStatus GCacheItem::status(InsetGraphics const & inset) const // find a ModifiedItem that is referenced by this inset. ListType::const_iterator begin = modified_images.begin(); ListType::const_iterator end = modified_images.end(); - ListType::const_iterator it = + ListType::const_iterator it = std::find_if(begin, end, Find_Inset(inset)); // Someone's being daft. @@ -270,7 +270,7 @@ void GCacheItem::changeDisplay(bool changed_background) } return; } - + ListType temp_list; for (ListType::iterator it = begin; it != end; ++it) { @@ -399,7 +399,7 @@ string const findTargetFormat(string const & from) typedef GImage::FormatList FormatList; FormatList const & formats = GImage::loadableFormats(); - // There must be a format to load from. + // There must be a format to load from. lyx::Assert(!formats.empty()); // First ascertain if we can load directly with no conversion @@ -425,7 +425,7 @@ string const findTargetFormat(string const & from) } // anon namespace - + void GCacheItem::convertToDisplayFormat() { setStatus(Converting); @@ -439,16 +439,16 @@ void GCacheItem::convertToDisplayFormat() setStatus(ErrorNoFile); return; } - + // maybe that other zip extensions also be useful, especially the // ones that may be declared in texmf/tex/latex/config/graphics.cfg. // for example: /* -----------snip------------- - {\DeclareGraphicsRule{.pz}{eps}{.bb}{}% - \DeclareGraphicsRule{.eps.Z}{eps}{.eps.bb}{}% - \DeclareGraphicsRule{.ps.Z}{eps}{.ps.bb}{}% - \DeclareGraphicsRule{.ps.gz}{eps}{.ps.bb}{}% - \DeclareGraphicsRule{.eps.gz}{eps}{.eps.bb}{}}}% + {\DeclareGraphicsRule{.pz}{eps}{.bb}{}% + \DeclareGraphicsRule{.eps.Z}{eps}{.eps.bb}{}% + \DeclareGraphicsRule{.ps.Z}{eps}{.ps.bb}{}% + \DeclareGraphicsRule{.ps.gz}{eps}{.ps.bb}{}% + \DeclareGraphicsRule{.eps.gz}{eps}{.eps.bb}{}}}% -----------snip-------------*/ lyxerr[Debug::GRAPHICS] @@ -488,7 +488,7 @@ void GCacheItem::convertToDisplayFormat() // Take only the filename part of the file, without path or extension. string const temp = ChangeExtension(OnlyFilename(filename), string()); - + // Add some stuff to create a uniquely named temporary file. // This file is deleted in loadImage after it is loaded into memory. string const to_file_base = lyx::tempName(string(), temp); @@ -555,7 +555,7 @@ ImagePtr const ModifiedItem::image() const void ModifiedItem::modify(ImagePtr const & new_image) { - if (!new_image.get()) + if (!new_image.get()) return; original_image_ = new_image; @@ -576,7 +576,7 @@ void ModifiedItem::modify(ImagePtr const & new_image) void ModifiedItem::setPixmap() { - if (!modified_image_.get()) + if (!modified_image_.get()) return; if (params().display == GParams::NONE) { @@ -635,7 +635,7 @@ ModifiedItemPtr ModifiedItem::changeDisplay() // Loop over the list of insets. Compare the updated params for each // with params(). If different, move into a new list. ListType::iterator begin = insets.begin(); - ListType::iterator end = insets.end(); + ListType::iterator end = insets.end(); ListType::iterator it = std::remove_if(begin, end, Params_Changed(params())); diff --git a/src/graphics/GraphicsCacheItem.h b/src/graphics/GraphicsCacheItem.h index 7952f7190d..94e1e28088 100644 --- a/src/graphics/GraphicsCacheItem.h +++ b/src/graphics/GraphicsCacheItem.h @@ -33,7 +33,7 @@ #pragma interface #endif -#include "GraphicsTypes.h" +#include "GraphicsTypes.h" #include #include "LString.h" #include @@ -46,7 +46,7 @@ namespace grfx { class GParams; class ModifiedItem; - + /// A grfx::GCache item holder. class GCacheItem : boost::noncopyable, public SigC::Object { public: @@ -70,7 +70,7 @@ public: /// The name of the original image file. string const & filename() const; - + /// Is this image file referenced by this inset? bool referencedBy(InsetGraphics const &) const; @@ -123,7 +123,7 @@ private: void imageLoaded(bool); /// How far have we got in loading the original, unmodified image? - ImageStatus status() const; + ImageStatus status() const; /** Sets the status of the loading process. Also notifies * listeners that the status has chacnged. @@ -244,7 +244,7 @@ private: ImagePtr modified_image_; /// ImageStatus status_; - /// + /// boost::shared_ptr p_; }; diff --git a/src/graphics/GraphicsConverter.C b/src/graphics/GraphicsConverter.C index ca347ade67..028e24d775 100644 --- a/src/graphics/GraphicsConverter.C +++ b/src/graphics/GraphicsConverter.C @@ -50,7 +50,7 @@ string const move_file(string const & from_file, string const & to_file) } // namespace anon - + namespace grfx { GConverter & GConverter::get() @@ -58,7 +58,7 @@ GConverter & GConverter::get() static GConverter singleton; return singleton; } - + bool GConverter::isReachable(string const & from_format_name, string const & to_format_name) const @@ -99,7 +99,7 @@ void GConverter::convert(string const & from_file, string const & to_file_base, on_finish->emit(string()); return; } - + fs << script.str().c_str(); fs.close(); @@ -115,7 +115,7 @@ void GConverter::convert(string const & from_file, string const & to_file_base, // Launch the conversion process. ConvProcessPtr shared_ptr; - shared_ptr.reset(new ConvProcess(script_file, script_command, + shared_ptr.reset(new ConvProcess(script_file, script_command, to_file, on_finish)); all_processes_.push_back(shared_ptr); } @@ -124,7 +124,7 @@ void GConverter::convert(string const & from_file, string const & to_file_base, namespace { typedef boost::shared_ptr ConvProcessPtr; - + class Find_Ptr { public: Find_Ptr(ConvProcess * ptr) : ptr_(ptr) {} @@ -139,7 +139,7 @@ private: }; } // namespace anon - + void GConverter::erase(ConvProcess * process) { @@ -155,7 +155,7 @@ void GConverter::erase(ConvProcess * process) } -bool GConverter::build_script(string const & from_file, +bool GConverter::build_script(string const & from_file, string const & to_file_base, string const & from_format, string const & to_format, @@ -219,7 +219,7 @@ bool GConverter::build_script(string const & from_file, // Store in the shell script script << "\n" << command << "\n\n"; - // Test that this was successful. If not, remove + // Test that this was successful. If not, remove // ${outfile} and exit the shell script script << "if [ $? -ne 0 ]; then\n" << "\t'rm' -f ${outfile}\n" @@ -253,7 +253,7 @@ bool GConverter::build_script(string const & from_file, } -ConvProcess::ConvProcess(string const & script_file, +ConvProcess::ConvProcess(string const & script_file, string const & script_command, string const & to_file, SignalTypePtr on_finish) : script_file_(script_file), to_file_(to_file), on_finish_(on_finish) @@ -261,7 +261,7 @@ ConvProcess::ConvProcess(string const & script_file, Forkedcall::SignalTypePtr convert_ptr; convert_ptr.reset(new Forkedcall::SignalType); - convert_ptr->connect(SigC::slot(this, &ConvProcess::converted)); + convert_ptr->connect(SigC::slot(this, &ConvProcess::converted)); Forkedcall call; int retval = call.startscript(script_command, convert_ptr); diff --git a/src/graphics/GraphicsImage.C b/src/graphics/GraphicsImage.C index 97ee4ed3d2..5f4b4c5fa7 100644 --- a/src/graphics/GraphicsImage.C +++ b/src/graphics/GraphicsImage.C @@ -49,7 +49,7 @@ GImage::getScaledDimensions(GParams const & params) const height = width * getHeight() / getWidth(); } } - + if (width == 0 || height == 0) // Something is wrong! return std::make_pair(getWidth(), getHeight()); @@ -57,4 +57,3 @@ GImage::getScaledDimensions(GParams const & params) const return std::make_pair(width, height); } } // namespace grfx - diff --git a/src/graphics/GraphicsImage.h b/src/graphics/GraphicsImage.h index 50eabd25e2..1afa3bf980 100644 --- a/src/graphics/GraphicsImage.h +++ b/src/graphics/GraphicsImage.h @@ -83,10 +83,10 @@ public: /// Clip the image using params. virtual void clip(GParams const & params) = 0; - + /// Rotate the image using params. virtual void rotate(GParams const & params) = 0; - + /// Scale the image using params. virtual void scale(GParams const & params) = 0; diff --git a/src/graphics/GraphicsImageXPM.C b/src/graphics/GraphicsImageXPM.C index fb6df44881..37aaec0741 100644 --- a/src/graphics/GraphicsImageXPM.C +++ b/src/graphics/GraphicsImageXPM.C @@ -124,7 +124,7 @@ void GImageXPM::load(string const & filename, GImage::SignalTypePtr on_finish) break; case XpmNoMemory: - lyxerr[Debug::GRAPHICS] + lyxerr[Debug::GRAPHICS] << "Insufficient memory to read in XPM file" << std::endl; break; @@ -135,7 +135,7 @@ void GImageXPM::load(string const & filename, GImage::SignalTypePtr on_finish) delete xpm_image; lyxerr[Debug::GRAPHICS] - << "Error reading XPM file '" + << "Error reading XPM file '" << XpmGetErrorString(success) << "'" << std::endl; } else { @@ -200,15 +200,15 @@ bool GImageXPM::setPixmap(GParams const & params) // Load up the pixmap XpmImage xpm_image = image_.get(); int const status = - XpmCreatePixmapFromXpmImage(display, - XRootWindowOfScreen(screen), - &xpm_image, + XpmCreatePixmapFromXpmImage(display, + XRootWindowOfScreen(screen), + &xpm_image, &pixmap, &mask, &attrib); XpmFreeAttributes(&attrib); if (status != XpmSuccess) { - lyxerr << "Error creating pixmap from xpm_image '" + lyxerr << "Error creating pixmap from xpm_image '" << XpmGetErrorString(status) << "'" << std::endl; pixmap_status_ = PIXMAP_FAILED; @@ -298,7 +298,7 @@ void GImageXPM::rotate(GParams const & params) max_y = std::max(max_y, y_rot); min_y = std::min(min_y, y_rot); typedef unsigned int dimension; - + dimension const new_width = 1 + int(max_x - min_x); // round up! dimension const new_height = 1 + int(max_y - min_y); @@ -382,7 +382,7 @@ bool contains_color_none(XpmImage const & image); string const unique_color_string(XpmImage const & image); -// create a copy (using malloc and strcpy). If (!in) return 0; +// create a copy (using malloc and strcpy). If (!in) return 0; char * clone_c_string(char const * in); // Given a string of the form #ff0571 create appropriate grayscale and @@ -638,7 +638,7 @@ char * clone_c_string(char const * in) if (!in) return 0; - // Don't forget the '\0' + // Don't forget the '\0' char * out = static_cast(malloc(strlen(in) + 1)); return strcpy(out, in); } diff --git a/src/graphics/GraphicsImageXPM.h b/src/graphics/GraphicsImageXPM.h index a2cc32c806..4d3c88638b 100644 --- a/src/graphics/GraphicsImageXPM.h +++ b/src/graphics/GraphicsImageXPM.h @@ -44,7 +44,7 @@ public: /// Get the image width unsigned int getWidth() const; - + /// Get the image height unsigned int getHeight() const; @@ -62,10 +62,10 @@ public: /// Clip the image using params. void clip(GParams const & params); - + /// Rotate the image using params. void rotate(GParams const & params); - + /// Scale the image using params. void scale(GParams const & params); @@ -82,7 +82,7 @@ private: * c_color together with g_color and m_color entries for each c_color * entry when it is first stored. */ - class Data + class Data { public: /// Default c-tor. Initialise everything to zero. @@ -132,7 +132,7 @@ private: unsigned int color_none_id() const; }; - + Data image_; /// The pixmap itself. @@ -147,7 +147,7 @@ private: /// PIXMAP_SUCCESS }; - + PixmapStatus pixmap_status_; }; diff --git a/src/graphics/GraphicsParams.C b/src/graphics/GraphicsParams.C index 9554e5eb71..6353f7b51c 100644 --- a/src/graphics/GraphicsParams.C +++ b/src/graphics/GraphicsParams.C @@ -28,7 +28,7 @@ GParams::GParams(InsetGraphicsParams const & iparams) { if (iparams.clip) bb = iparams.bb; - + if (iparams.rotate) angle = int(iparams.rotateAngle); @@ -119,7 +119,7 @@ BoundingBox::BoundingBox(string const & bb) return; LyXLength const length_yb(tmp1); - + tmp2 = split(tmp2, tmp1, ' '); if (!isValidLength(tmp1) || !isValidLength(tmp2)) return; @@ -148,7 +148,7 @@ BoundingBox::BoundingBox(string const & bb) } -bool BoundingBox::empty() const +bool BoundingBox::empty() const { return (!xl && !yb && !xr && !yt); } diff --git a/src/graphics/GraphicsParams.h b/src/graphics/GraphicsParams.h index 8f90d82d3e..29761c7d5a 100644 --- a/src/graphics/GraphicsParams.h +++ b/src/graphics/GraphicsParams.h @@ -6,7 +6,7 @@ * * \author Angus Leeming * - * Used internally by the GraphicsCache. + * Used internally by the GraphicsCache. * Only a subset of InsetGraphicsParams is needed for display purposes. * The GraphicsParams c-tor also interrogates lyxrc to ascertain whether * to display or not. @@ -47,7 +47,7 @@ struct BoundingBox { bool operator==(BoundingBox const &, BoundingBox const &); bool operator!=(BoundingBox const &, BoundingBox const &); -struct GParams +struct GParams { GParams(InsetGraphicsParams const &); diff --git a/src/importer.C b/src/importer.C index 65c3ce185c..563651d465 100644 --- a/src/importer.C +++ b/src/importer.C @@ -1,8 +1,8 @@ /* This file is part of - * ====================================================== - * + * ====================================================== + * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team. * @@ -34,7 +34,7 @@ extern BufferList bufferlist; extern void InsertAsciiFile(BufferView *, string const &, bool); -bool Importer::Import(LyXView * lv, string const & filename, +bool Importer::Import(LyXView * lv, string const & filename, string const & format) { string const displaypath = MakeDisplayPath(filename); @@ -103,7 +103,7 @@ bool Importer::IsImportable(string const & format) vector const Importer::GetImportableFormats() { vector loaders = Loaders(); - vector result = + vector result = converters.getReachableTo(loaders[0], true); for (vector::const_iterator it = loaders.begin() + 1; it != loaders.end(); ++it) { diff --git a/src/importer.h b/src/importer.h index 089e6336b8..8bcfd08140 100644 --- a/src/importer.h +++ b/src/importer.h @@ -1,9 +1,9 @@ // -*- C++ -*- /* This file is part of - * ====================================================== - * + * ====================================================== + * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team. * @@ -26,12 +26,12 @@ class Importer { public: /// static - bool Import(LyXView * lv, string const & filename, + bool Import(LyXView * lv, string const & filename, string const & format); #if 0 /// static - bool IsImportable(string const & format); + bool IsImportable(string const & format); #endif /// static diff --git a/src/intl.C b/src/intl.C index 5353084edb..6eac587bc6 100644 --- a/src/intl.C +++ b/src/intl.C @@ -2,7 +2,7 @@ * ====================================================== * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team. * @@ -55,7 +55,7 @@ void Intl::ToggleKeyMap() KeyMapSec(); } else if (keymapon) { KeyMapOn(false); - } else + } else KeyMapPrim(); } diff --git a/src/intl.h b/src/intl.h index 6c5f47e7b3..e83ad9d7a5 100644 --- a/src/intl.h +++ b/src/intl.h @@ -18,9 +18,9 @@ public: PRIMARY, SECONDARY }; - + Intl(); - + /// {en/dis}able the keymap void KeyMapOn(bool on); diff --git a/src/iterators.h b/src/iterators.h index f34e76917d..b87d16e537 100644 --- a/src/iterators.h +++ b/src/iterators.h @@ -50,7 +50,7 @@ public: return positions.top().par; } /// - PosHolder::size_type size() const + PosHolder::size_type size() const { return positions.size(); } /// friend diff --git a/src/kbmap.C b/src/kbmap.C index 26f7bbe66a..7004b3ec73 100644 --- a/src/kbmap.C +++ b/src/kbmap.C @@ -2,7 +2,7 @@ * ====================================================== * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team. * @@ -34,7 +34,7 @@ string const kb_keymap::printKeysym(unsigned int key, unsigned int mod) mod &= ModsMask; char const * const s = XKeysymToString(key); - + if (mod & ShiftMask) buf += "S-"; if (mod & ControlMask) buf += "C-"; if (mod & Mod1Mask) buf += "M-"; @@ -79,7 +79,7 @@ string::size_type kb_keymap::bind(string const & seq, int action) << seq << "' Action `" << action << "'" << endl; } - + kb_sequence k(0, 0); string::size_type const res = k.parse(seq); @@ -178,7 +178,7 @@ void kb_keymap::defkey(kb_sequence * seq, int action, unsigned int r) } } } - + Table::iterator newone = table.insert(table.end(), kb_key()); newone->code = code; newone->mod = modmsk; diff --git a/src/kbmap.h b/src/kbmap.h index e7f35d7236..9c1ddecd22 100644 --- a/src/kbmap.h +++ b/src/kbmap.h @@ -34,7 +34,7 @@ public: /// print all available keysyms string const print() const; - + /** * Look up a key press in the keymap. * @param key the keysym @@ -64,13 +64,13 @@ private: struct kb_key { /// Keysym unsigned int code; - + /// Modifier masks unsigned int mod; - + /// Keymap for prefix keys boost::shared_ptr table; - + /// Action for !prefix keys int action; }; @@ -81,7 +81,7 @@ private: * @param r internal recursion level */ void defkey(kb_sequence * seq, int action, unsigned int r = 0); - + /// Returns a string of the given key string const printKey(kb_key const & key) const; diff --git a/src/kbsequence.C b/src/kbsequence.C index 29f2cdc80f..fa93e556b7 100644 --- a/src/kbsequence.C +++ b/src/kbsequence.C @@ -2,7 +2,7 @@ * ====================================================== * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team. * @@ -53,7 +53,7 @@ int kb_sequence::addkey(unsigned int key, unsigned int mod, unsigned int nmod) if (curmap) { return curmap->lookup(key, mod, this); } - + return LFUN_UNKNOWN_ACTION; } @@ -70,7 +70,7 @@ string::size_type kb_sequence::parse(string const & s) ++i; if (i >= s.length()) break; - + if (i + 1 < s.length() && s[i + 1] == '-') { switch (s[i]) { case 's': case 'S': @@ -111,7 +111,7 @@ string::size_type kb_sequence::parse(string const & s) string::size_type j = i; for (; j < s.length() && s[j] != ' '; ++j) tbuf += s[j]; // (!!!check bounds :-) - + KeySym key = XStringToKeysym(tbuf.c_str()); if (key == NoSymbol) { lyxerr[Debug::KBMAP] @@ -120,12 +120,12 @@ string::size_type kb_sequence::parse(string const & s) return j; } i = j; - + addkey(key, mod, nmod); mod = 0; } } - + // empty sequence? if (!length_) return 0; @@ -141,7 +141,7 @@ string const kb_sequence::print() const //if (deleted_) // return buf; - + for (vector::size_type i = 0; i < length_; ++i) { buf += kb_keymap::printKeysym(sequence[i], modifiers[i] & 0xffff); diff --git a/src/kbsequence.h b/src/kbsequence.h index 8da2f19e46..e00382d34e 100644 --- a/src/kbsequence.h +++ b/src/kbsequence.h @@ -26,7 +26,7 @@ public: kb_sequence(kb_keymap * std, kb_keymap * cur) : stdmap(std), curmap(cur), length_(0), deleted_(false) {} - + /** * Add a key to the key sequence and look it up in the curmap @@ -46,28 +46,28 @@ public: * Prefixes are S-, C-, M- for shift, control, meta */ string::size_type parse(string const & s); - + /** * Return the current sequence as a string. * @see parse() */ string const print() const; - + /** * Return the current sequence and available options as * a string. No options are added if no curmap kb map exists. */ string const printOptions() const; - + /// Mark the sequence as deleted. void mark_deleted(); /// Return the ISO value of the last keysym in sequence, or 0 char getiso() const; - + /// Reset sequence to become "deleted" void reset(); - + /// clear in full void clear(); @@ -82,23 +82,23 @@ public: /// Keymap to use if a new sequence is starting kb_keymap * stdmap; - + /// Keymap to use for the next key kb_keymap * curmap; - + private: /// get the keysym of last in sequence unsigned int getsym() const; - + /** * Array holding the current key sequence. * If sequence[length-1] < 0xff it can be used as ISO8859 char */ std::vector sequence; - + /// modifiers for keys in the sequence std::vector modifiers; - + /// Current length of key sequence std::vector::size_type length_; diff --git a/src/language.C b/src/language.C index 55c89e8ca7..bb5d5f1d67 100644 --- a/src/language.C +++ b/src/language.C @@ -1,8 +1,8 @@ /* This file is part of - * ====================================================== - * + * ====================================================== + * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team. * @@ -38,7 +38,7 @@ Language const * inherit_language = &inherit_lang; void Languages::setDefaults() { languagelist["english"] = Language("english", "english", N_("English"), - false, + false, encodings.getEncoding("iso8859-1"), "en", ""); english_language = default_language = &languagelist["english"]; @@ -79,10 +79,10 @@ void Languages::read(string const & filename) Encoding const * encoding = encodings.getEncoding(encoding_str); if (!encoding) { encoding = encodings.getEncoding("iso8859-1"); - lyxerr << "Unknown encoding " << encoding_str << endl; + lyxerr << "Unknown encoding " << encoding_str << endl; } - languagelist[lang] = Language(lang, babel, display, rtl, + languagelist[lang] = Language(lang, babel, display, rtl, encoding, code, latex_options); } @@ -103,7 +103,7 @@ void Languages::read(string const & filename) Language const * Languages::getLanguage(string const & language) const { - const_iterator it = languagelist.find(language); + const_iterator it = languagelist.find(language); if (it != languagelist.end()) return &it->second; else diff --git a/src/language.h b/src/language.h index cd156c33e4..01e0c74b90 100644 --- a/src/language.h +++ b/src/language.h @@ -1,9 +1,9 @@ // -*- C++ -*- /* This file is part of - * ====================================================== - * + * ====================================================== + * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team. * @@ -99,14 +99,14 @@ public: } /// const_iterator begin() const { - return languagelist.begin(); - } - /// - const_iterator end() const { - return languagelist.end(); - } + return languagelist.begin(); + } /// - + const_iterator end() const { + return languagelist.end(); + } + /// + private: /// LanguageList languagelist; diff --git a/src/lastfiles.C b/src/lastfiles.C index 477b13f8c6..615b9de7ee 100644 --- a/src/lastfiles.C +++ b/src/lastfiles.C @@ -1,8 +1,8 @@ /* This file is part of - * ====================================================== - * + * ====================================================== + * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team. * diff --git a/src/lastfiles.h b/src/lastfiles.h index e3f24765c1..9a5c5ad4f9 100644 --- a/src/lastfiles.h +++ b/src/lastfiles.h @@ -1,9 +1,9 @@ // -*- C++ -*- /* This file is part of - * ====================================================== - * + * ====================================================== + * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team. * @@ -34,7 +34,7 @@ public: /// typedef Files::const_iterator const_iterator; - + /** Read the lastfiles file. @param file The file to read the lastfiles form. @param dostat Whether to check for file existance. @@ -43,7 +43,7 @@ public: explicit LastFiles(string const & file, bool dostat = true, unsigned int num = 4); - + /** Insert #file# into the list. This funtion inserts #file# into the last files list. If the file already exist it is moved to the top of the list, else exist it @@ -84,14 +84,14 @@ private: */ ABSOLUTEMAXLASTFILES = 20 }; - + /// a list of lastfiles Files files; /// number of files in the lastfiles list. unsigned int num_files; /// check for file existance or not. bool dostat; - + /** Read the lastfiles file. Reads the #.lyx_lastfiles# at the beginning of the LyX session. This will read the lastfiles file (usually #.lyx_lastfiles#). It @@ -103,6 +103,6 @@ private: /** Used by the constructor to set the number of stored last files. @param num the number of lastfiles to set. */ - void setNumberOfFiles(unsigned int num); + void setNumberOfFiles(unsigned int num); }; #endif diff --git a/src/layout.h b/src/layout.h index 54ee907131..83a6228936 100644 --- a/src/layout.h +++ b/src/layout.h @@ -1,9 +1,9 @@ // -*- C++ -*- /* This file is part of * ====================================================== - * + * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team. * @@ -142,25 +142,25 @@ enum LYX_END_LABEL_TYPES { /// END_LABEL_ENUM_LAST = END_LABEL_STATIC }; - -/* Fix labels are printed flushright, manual labels flushleft. + +/* Fix labels are printed flushright, manual labels flushleft. * MARGIN_MANUAL and MARGIN_FIRST_DYNAMIC are *only* for LABEL_MANUAL, - * MARGIN_DYNAMIC and MARGIN_STATIC are *not* for LABEL_MANUAL. + * MARGIN_DYNAMIC and MARGIN_STATIC are *not* for LABEL_MANUAL. * This seems a funny restriction, but I think other combinations are - * not needed, so I will not change it yet. + * not needed, so I will not change it yet. * Correction: MARGIN_FIRST_DYNAMIC also usable with LABEL_STATIC */ -/* There is a parindent and a parskip. Which one is used depends on the - * paragraph_separation-flag of the text-object. +/* There is a parindent and a parskip. Which one is used depends on the + * paragraph_separation-flag of the text-object. * BUT: parindent is only thrown away, if a parskip is defined! So if you - * want a space between the paragraphs and a parindent at the same time, + * want a space between the paragraphs and a parindent at the same time, * you should set parskip to zero and use topsep, parsep and bottomsep. - * - * The standard layout is an exception: its parindent is only set, if the + * + * The standard layout is an exception: its parindent is only set, if the * previous paragraph is standard too. Well, this is LateX and it is good! - */ + */ #endif diff --git a/src/lyx_cb.C b/src/lyx_cb.C index 885055cda3..acd2dc171b 100644 --- a/src/lyx_cb.C +++ b/src/lyx_cb.C @@ -1,8 +1,8 @@ /* This file is part of - * ====================================================== - * + * ====================================================== + * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich, * Copyright 1995-2001 The LyX Team. * @@ -38,7 +38,7 @@ #include #include -#include +#include #include using std::vector; @@ -83,7 +83,7 @@ bool MenuWrite(BufferView * bv, Buffer * buffer) { // FIXME: needed ? XFlush(GUIRunTime::x11Display()); - + if (!buffer->save()) { if (Alert::askQuestion(_("Save failed. Rename and try again?"), MakeDisplayPath(buffer->fileName(), 50), @@ -145,7 +145,7 @@ bool WriteAs(BufferView * bv, Buffer * buffer, string const & filename) _("Save anyway?"))) return false; // Falls through to name change and save - } + } // No, but do we have another file with this name open? else if (!buffer->isUnnamed() && bufferlist.exists(fname)) { if (Alert::askQuestion(_("Another document with same name open!"), @@ -165,7 +165,7 @@ bool WriteAs(BufferView * bv, Buffer * buffer, string const & filename) } // Check whether the file exists else { FileInfo const myfile(fname); - if (myfile.isOK() && !Alert::askQuestion(_("Document already exists:"), + if (myfile.isOK() && !Alert::askQuestion(_("Document already exists:"), MakeDisplayPath(fname, 50), _("Replace file?"))) return false; @@ -197,9 +197,9 @@ int MenuRunChktex(Buffer * buffer) if (buffer->isSGML()) { Alert::alert(_("Chktex does not work with SGML derived documents.")); return 0; - } else + } else ret = buffer->runChktex(); - + if (ret >= 0) { string s; string t; @@ -263,13 +263,13 @@ void AutoSave(BufferView * bv) } bv->owner()->message(_("Autosaving current document...")); - + // create autosave filename - string fname = bv->buffer()->filePath(); + string fname = bv->buffer()->filePath(); fname += "#"; fname += OnlyFilename(bv->buffer()->fileName()); fname += "#"; - + // tmp_ret will be located (usually) in /tmp // will that be a problem? pid_t const pid = fork(); // If you want to debug the autosave @@ -280,7 +280,7 @@ void AutoSave(BufferView * bv) // to fork. But we will do the save // anyway. bool failed = false; - + string const tmp_ret = lyx::tempName(string(), "lyxauto"); if (!tmp_ret.empty()) { bv->buffer()->writeFile(tmp_ret, 1); @@ -295,7 +295,7 @@ void AutoSave(BufferView * bv) } else { failed = true; } - + if (failed) { // failed to write/rename tmp_ret so try writing direct if (!bv->buffer()->writeFile(fname, 1)) { @@ -309,7 +309,7 @@ void AutoSave(BufferView * bv) _exit(0); } } - + bv->buffer()->markBakClean(); bv->owner()->resetAutosaveTimer(); } @@ -340,7 +340,7 @@ Buffer * NewLyxFile(string const & filename) << "\nName is " << name << "\nTemplate is " << tmpname << endl; - // find a free buffer + // find a free buffer Buffer * tmpbuf = bufferlist.newFile(name, tmpname); if (tmpbuf) lastfiles->newFile(tmpbuf->fileName()); @@ -351,7 +351,7 @@ Buffer * NewLyxFile(string const & filename) // Insert ascii file (if filename is empty, prompt for one) void InsertAsciiFile(BufferView * bv, string const & f, bool asParagraph) { - if (!bv->available()) + if (!bv->available()) return; string const tmpstr = getContentsOfAsciiFile(bv, f, asParagraph); @@ -360,7 +360,7 @@ void InsertAsciiFile(BufferView * bv, string const & f, bool asParagraph) // insert the string bv->hideCursor(); - + // clear the selection bool flag = (bv->text == bv->getLyXText()); if (flag) @@ -371,7 +371,7 @@ void InsertAsciiFile(BufferView * bv, string const & f, bool asParagraph) bv->getLyXText()->insertStringAsParagraphs(bv, tmpstr); if (flag) bv->update(bv->text, - BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE); + BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE); } @@ -383,7 +383,7 @@ string getContentsOfAsciiFile(BufferView * bv, string const & f, bool asParagrap if (fname.empty()) { FileDialog fileDlg(bv->owner(), _("Select file to insert"), (asParagraph) ? LFUN_FILE_INSERT_ASCII_PARA : LFUN_FILE_INSERT_ASCII); - + FileDialog::Result result = fileDlg.Select(bv->owner()->buffer()->filePath()); if (result.first == FileDialog::Later) @@ -391,7 +391,7 @@ string getContentsOfAsciiFile(BufferView * bv, string const & f, bool asParagrap fname = result.second; - if (fname.empty()) + if (fname.empty()) return string(); } @@ -420,13 +420,13 @@ string getContentsOfAsciiFile(BufferView * bv, string const & f, bool asParagrap string const tmpstr(tmp.begin(), tmp.end()); #else // This is what we want to use and what we will use once the - // compilers get good enough. + // compilers get good enough. //string tmpstr(ii, end); // yet a reason for using std::string // alternate approach to get the file into a string: string tmpstr; copy(ii, end, back_inserter(tmpstr)); #endif - + return tmpstr; } @@ -465,7 +465,7 @@ void MenuInsertLabel(BufferView * bv, string const & arg) par_text = split(par_text, head, ' '); if (i > 0) text += '-'; // Is it legal to use spaces in - // labels ? + // labels ? text += head; } @@ -493,12 +493,12 @@ void Reconfigure(BufferView * bv) // Run configure in user lyx directory Path p(user_lyxdir); Systemcall one; - one.startscript(Systemcall::Wait, + one.startscript(Systemcall::Wait, AddName(system_lyxdir, "configure")); p.pop(); bv->owner()->message(_("Reloading configuration...")); lyxrc.read(LibFileSearch(string(), "lyxrc.defaults")); - Alert::alert(_("The system has been reconfigured."), + Alert::alert(_("The system has been reconfigured."), _("You need to restart LyX to make use of any"), _("updated document class specifications.")); } diff --git a/src/lyx_cb.h b/src/lyx_cb.h index e973ed9671..864851af42 100644 --- a/src/lyx_cb.h +++ b/src/lyx_cb.h @@ -37,4 +37,3 @@ void MenuInsertLabel(BufferView * bv, string const & arg); /// void Reconfigure(BufferView * bv); #endif - diff --git a/src/lyx_gui.C b/src/lyx_gui.C index 22424d09ff..aff0e0fe87 100644 --- a/src/lyx_gui.C +++ b/src/lyx_gui.C @@ -1,8 +1,8 @@ /* This file is part of * ====================================================== - * + * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team. * @@ -72,7 +72,7 @@ FL_resource res[] = extern "C" { - + static int LyX_XErrHandler(Display * display, XErrorEvent * xeev) { @@ -80,7 +80,7 @@ int LyX_XErrHandler(Display * display, XErrorEvent * xeev) // We don't abort on BadWindow return 0; } - + // emergency cleanup LyX::emergencyCleanup(); @@ -92,7 +92,7 @@ int LyX_XErrHandler(Display * display, XErrorEvent * xeev) lyx::abort(); return 0; // Solaris CC wants us to return something } - + } @@ -103,15 +103,15 @@ LyXGUI::LyXGUI(LyX * owner, int * argc, char * argv[], bool GUI) if (!gui) return; - // + // setDefaults(); - + static const int num_res = sizeof(res)/sizeof(FL_resource); fl_initialize(argc, argv, "LyX", cmdopt, num_res); // It appears that, in xforms >=0.89.5, fl_initialize() // calls setlocale() and ruins our LC_NUMERIC setting. locale_init(); - fl_get_app_resources(res, num_res); + fl_get_app_resources(res, num_res); static const int geometryBitmask = XParseGeometry(geometry, @@ -132,10 +132,10 @@ LyXGUI::LyXGUI(LyX * owner, int * argc, char * argv[], bool GUI) // A width less than 590 pops up an awkward main window // The minimal values of width/height (590/400) are defined in - // src/lyx.C - if (width < 590) width = 590; + // src/lyx.C + if (width < 590) width = 590; if (height < 400) height = 400; - + // If width is not set by geometry, check it against monitor width if (!(geometryBitmask & 4)) { Screen * scr = ScreenOfDisplay(fl_get_display(), fl_screen); @@ -168,8 +168,8 @@ LyXGUI::LyXGUI(LyX * owner, int * argc, char * argv[], bool GUI) // A destructor is always necessary (asierra-970604) LyXGUI::~LyXGUI() { - // Lyxserver was created in this class so should be destroyed - // here. asierra-970604 + // Lyxserver was created in this class so should be destroyed + // here. asierra-970604 delete lyxserver; lyxserver = 0; delete lyxViews; @@ -196,22 +196,22 @@ void LyXGUI::init() if (lyxrc.popup_font_encoding.empty()) lyxrc.popup_font_encoding = lyxrc.font_norm; // Set the font name for popups and menus - string boldfontname = lyxrc.popup_bold_font - + "-*-*-*-?-*-*-*-*-" - + lyxrc.popup_font_encoding; + string boldfontname = lyxrc.popup_bold_font + + "-*-*-*-?-*-*-*-*-" + + lyxrc.popup_font_encoding; // "?" means "scale that font" - string fontname = lyxrc.popup_normal_font - + "-*-*-*-?-*-*-*-*-" - + lyxrc.popup_font_encoding; + string fontname = lyxrc.popup_normal_font + + "-*-*-*-?-*-*-*-*-" + + lyxrc.popup_font_encoding; int bold = fl_set_font_name(FL_BOLD_STYLE, boldfontname.c_str()); int normal = fl_set_font_name(FL_NORMAL_STYLE, fontname.c_str()); - if (bold < 0) - lyxerr << "Could not set menu font to " + if (bold < 0) + lyxerr << "Could not set menu font to " << boldfontname << endl; - if (normal < 0) - lyxerr << "Could not set popup font to " + if (normal < 0) + lyxerr << "Could not set popup font to " << fontname << endl; if (bold < 0 && normal < 0) { @@ -232,15 +232,15 @@ void LyXGUI::init() else if (normal < 0) fl_set_font_name(FL_NORMAL_STYLE, boldfontname.c_str()); - // put here (after fl_initialize) to avoid segfault. Cannot be done + // put here (after fl_initialize) to avoid segfault. Cannot be done // in setDefaults() (Matthias 140496) - // Moved from ::LyXGUI to ::init to allow popup font customization + // Moved from ::LyXGUI to ::init to allow popup font customization // (petr 120997). - fl_setpup_fontstyle(FL_NORMAL_STYLE); - fl_setpup_fontsize(FL_NORMAL_SIZE); - fl_setpup_color(FL_MCOL, FL_BLACK); + fl_setpup_fontstyle(FL_NORMAL_STYLE); + fl_setpup_fontsize(FL_NORMAL_SIZE); + fl_setpup_color(FL_MCOL, FL_BLACK); fl_set_goodies_font(FL_NORMAL_STYLE, FL_NORMAL_SIZE); -#if FL_REVISION < 89 +#if FL_REVISION < 89 fl_set_oneliner_font(FL_NORMAL_STYLE, FL_NORMAL_SIZE); #else fl_set_tooltip_font(FL_NORMAL_STYLE, FL_NORMAL_SIZE); @@ -272,7 +272,7 @@ void LyXGUI::create_forms() // should a mapping exist. string const filename = AddName(user_lyxdir, "preferences.xform"); XformsColor::read(filename); - + // Show the main & title form int main_placement = FL_PLACE_CENTER | FL_FREE_SIZE; // Did we get a valid position? diff --git a/src/lyx_gui.h b/src/lyx_gui.h index 1690e44c9a..a5ff60abbf 100644 --- a/src/lyx_gui.h +++ b/src/lyx_gui.h @@ -1,9 +1,9 @@ // -*- C++ -*- /* This file is part of * ====================================================== - * + * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team. * @@ -36,7 +36,7 @@ public: LyXGUI(LyX * owner, int * argc, char * argv[], bool gui); /// ~LyXGUI(); - + /** This functions starts the ball. For XForms it runs a loop of fl_check_forms(). For QT this will probably be .exec(). @@ -46,19 +46,19 @@ public: main initialization. */ void init(); - + /// Register the buffer with the first found LyXView in lyxViews void regBuf(Buffer *); - + /// Access to (first?) LyXView LyXView * getLyXView() const; - + private: /// void setDefaults(); /// void create_forms(); - + /// The LyX that owns this GUI. LyX * _owner; /// diff --git a/src/lyx_main.C b/src/lyx_main.C index 46143a7020..ecb5e29663 100644 --- a/src/lyx_main.C +++ b/src/lyx_main.C @@ -1,8 +1,8 @@ /* This file is part of - * ====================================================== - * + * ====================================================== + * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team. * @@ -87,7 +87,7 @@ LyX::LyX(int * argc, char * argv[]) // Global bindings (this must be done as early as possible.) (Lgb) toplevel_keymap.reset(new kb_keymap); defaultKeyBindings(toplevel_keymap.get()); - + // Make the GUI object, and let it take care of the // command line arguments that concerns it. lyxerr[Debug::INIT] << "Initializing LyXGUI..." << endl; @@ -105,7 +105,7 @@ LyX::LyX(int * argc, char * argv[]) exit(0); } } - + // Initialization of LyX (reads lyxrc and more) lyxerr[Debug::INIT] << "Initializing LyX::init..." << endl; init(gui); @@ -114,7 +114,7 @@ LyX::LyX(int * argc, char * argv[]) lyxGUI->init(); // Load the files specified in the command line. - if ((*argc) == 2) + if ((*argc) == 2) lyxerr[Debug::INFO] << "Opening document..." << endl; else if ((*argc) > 2) lyxerr[Debug::INFO] << "Opening documents..." << endl; @@ -157,7 +157,7 @@ LyX::LyX(int * argc, char * argv[]) // try to dispatch to last loaded buffer first bool dispatched = last_loaded->dispatch(batch_command); - // if this was successful, return. + // if this was successful, return. // Maybe we could do something more clever than aborting... if (dispatched) { lyxerr << "We are done!" << endl; @@ -171,7 +171,7 @@ LyX::LyX(int * argc, char * argv[]) // fall through... } - + // Let the ball begin... lyxGUI->runTime(); } @@ -184,7 +184,7 @@ LyX::~LyX() extern "C" { - + static void error_handler(int err_sig) { @@ -202,7 +202,7 @@ void error_handler(int err_sig) lyxerr << "\nlyx: SIGSEGV signal caught" << endl; lyxerr << "Sorry, you have found a bug in LyX. " - "Please read the bug-reporting instructions " + "Please read the bug-reporting instructions " "in Help->Introduction and send us a bug report, " "if necessary. Thanks !" << endl; break; @@ -210,7 +210,7 @@ void error_handler(int err_sig) // no comments break; } - + // Deinstall the signal handlers signal(SIGHUP, SIG_DFL); signal(SIGINT, SIG_DFL); @@ -221,7 +221,7 @@ void error_handler(int err_sig) LyX::emergencyCleanup(); lyxerr << "Bye." << endl; - if (err_sig!= SIGHUP && + if (err_sig!= SIGHUP && (!GetEnv("LYXDEBUG").empty() || err_sig == SIGSEGV)) lyx::abort(); exit(0); @@ -246,7 +246,7 @@ void LyX::init(bool gui) string binpath = os::binpath(); string binname = os::binname(); string fullbinname = MakeAbsPath(binname, binpath); - + if (binpath.empty()) { lyxerr << _("Warning: could not determine path of binary.") << "\n" @@ -281,7 +281,7 @@ void LyX::init(bool gui) // LYX_DIR_11x environment variable string const lyxdir = GetEnvPath("LYX_DIR_11x"); - + if (!lyxdir.empty()) { lyxerr[Debug::INIT] << "LYX_DIR_11x: " << lyxdir << endl; searchpath += lyxdir + ';'; @@ -295,18 +295,18 @@ void LyX::init(bool gui) if (LyXReadLink(fullbinname, link)) { // Path of binary/../share/name of binary/ searchpath += NormalizePath(AddPath(binpath, - "../share/") + "../share/") + OnlyFilename(binname)); searchpath += ';'; fullbinpath = link; binpath = MakeAbsPath(OnlyPath(fullbinpath)); } } - - bool followlink; + + bool followlink; do { // Path of binary/../share/name of binary/ - searchpath += NormalizePath(AddPath(binpath, "../share/") + + searchpath += NormalizePath(AddPath(binpath, "../share/") + OnlyFilename(binname)) + ';'; // Follow Symlinks @@ -361,7 +361,7 @@ void LyX::init(bool gui) if (system_lyxdir != NormalizePath(lyxdir)) { lyxerr <<_("LYX_DIR_11x environment variable no good.") << '\n' - << _("System directory set to: ") + << _("System directory set to: ") << system_lyxdir << endl; path_shown = true; } @@ -381,7 +381,7 @@ void LyX::init(bool gui) << "Giving up." << endl; exit(1); } - lyxerr << _("Using built-in default ") + lyxerr << _("Using built-in default ") << LYX_DIR << _(" but expect problems.") << endl; } else { @@ -393,12 +393,12 @@ void LyX::init(bool gui) // Report the system directory if debugging is on if (!path_shown) lyxerr[Debug::INIT] << "System directory: '" - << system_lyxdir << '\'' << endl; + << system_lyxdir << '\'' << endl; // // Determine user lyx-dir // - + // Directories are searched in this order: // 1) -userdir command line parameter // 2) LYX_USERDIR_11x environment variable @@ -418,7 +418,7 @@ void LyX::init(bool gui) explicit_userdir = false; } - lyxerr[Debug::INIT] << "User LyX directory: '" + lyxerr[Debug::INIT] << "User LyX directory: '" << user_lyxdir << '\'' << endl; // Check that user LyX directory is ok. We don't do that if @@ -428,7 +428,7 @@ void LyX::init(bool gui) } else { first_start = false; } - + // // Shine up lyxrc defaults // @@ -437,7 +437,7 @@ void LyX::init(bool gui) if (lyxrc.template_path.empty()) { lyxrc.template_path = AddPath(system_lyxdir, "templates"); } - + // Default lastfiles file: $HOME/.lyx/lastfiles if (lyxrc.lastfiles.empty()) { lyxrc.lastfiles = AddName(user_lyxdir, "lastfiles"); @@ -446,12 +446,12 @@ void LyX::init(bool gui) // Disable gui when either lyxrc or easyparse says so if (!gui) lyxrc.use_gui = false; - - // Calculate screen dpi as average of x-DPI and y-DPI: + + // Calculate screen dpi as average of x-DPI and y-DPI: if (lyxrc.use_gui) { lyxrc.dpi = GUIRunTime::getScreenDPI(); lyxerr[Debug::INIT] << "DPI setting detected to be " - << lyxrc.dpi + 0.5 << endl; + << lyxrc.dpi + 0.5 << endl; } else { lyxrc.dpi = 1; // I hope this is safe } @@ -488,7 +488,7 @@ void LyX::init(bool gui) readUIFile(lyxrc.ui_file); // Bind the X dead keys to the corresponding LyX functions if - // necessary. + // necessary. if (lyxrc.override_x_deadkeys) deadKeyBindings(toplevel_keymap.get()); @@ -496,7 +496,7 @@ void LyX::init(bool gui) lyxrc.print(); } - // Create temp directory + // Create temp directory os::setTmpDir(CreateLyXTmpDir(lyxrc.tempdir_path)); system_tempdir = os::getTmpDir(); if (lyxerr.debugging(Debug::INIT)) { @@ -505,8 +505,8 @@ void LyX::init(bool gui) // load the lastfiles mini-database lyxerr[Debug::INIT] << "Reading lastfiles `" - << lyxrc.lastfiles << "'..." << endl; - lastfiles.reset(new LastFiles(lyxrc.lastfiles, + << lyxrc.lastfiles << "'..." << endl; + lastfiles.reset(new LastFiles(lyxrc.lastfiles, lyxrc.check_lastfiles, lyxrc.num_lastfiles)); @@ -524,25 +524,25 @@ void LyX::defaultKeyBindings(kb_keymap * kbmap) kbmap->bind("Left", LFUN_LEFT); kbmap->bind("Up", LFUN_UP); kbmap->bind("Down", LFUN_DOWN); - + kbmap->bind("Tab", LFUN_TAB); kbmap->bind("ISO_Left_Tab", LFUN_TAB); // jbl 2001-23-02 - + kbmap->bind("Home", LFUN_HOME); kbmap->bind("End", LFUN_END); kbmap->bind("Prior", LFUN_PRIOR); kbmap->bind("Next", LFUN_NEXT); - + kbmap->bind("Return", LFUN_BREAKPARAGRAPH); //kbmap->bind("~C-~S-~M-nobreakspace", LFUN_PROTECTEDSPACE); - + kbmap->bind("Delete", LFUN_DELETE); kbmap->bind("BackSpace", LFUN_BACKSPACE); // sub- and superscript -MV kbmap->bind("~S-underscore", LFUN_SUBSCRIPT); kbmap->bind("~S-asciicircum", LFUN_SUPERSCRIPT); - + // kbmap->bindings to enable the use of the numeric keypad // e.g. Num Lock set //kbmap->bind("KP_0", LFUN_SELFINSERT); @@ -569,8 +569,8 @@ void LyX::defaultKeyBindings(kb_keymap * kbmap) kbmap->bind("KP_End", LFUN_END); kbmap->bind("KP_Prior", LFUN_PRIOR); kbmap->bind("KP_Next", LFUN_NEXT); - - kbmap->bind("C-Tab", LFUN_TABINSERT); // ale970515 + + kbmap->bind("C-Tab", LFUN_TABINSERT); // ale970515 kbmap->bind("S-Tab", LFUN_SHIFT_TAB); // jug20000522 kbmap->bind("S-ISO_Left_Tab", LFUN_SHIFT_TAB); // jbl 2001-23-02 } @@ -582,13 +582,13 @@ void LyX::emergencyCleanup() // like to delete any we find, but our lyxdir might // contain documents etc. which might be helpful on // a crash - + bufferlist.emergencyWriteAll(); if (lyxserver) lyxserver->emergencyCleanup(); } - + // LyX can optionally take over the handling of deadkeys void LyX::deadKeyBindings(kb_keymap * kbmap) { @@ -628,7 +628,7 @@ void LyX::queryUserLyXDir(bool explicit_userdir) } else { first_start = !explicit_userdir; } - + // If the user specified explicitely a directory, ask whether // to create it (otherwise, always create it) if (explicit_userdir && @@ -665,22 +665,22 @@ void LyX::queryUserLyXDir(bool explicit_userdir) bool LyX::readRcFile(string const & name) { lyxerr[Debug::INIT] << "About to read " << name << "..." << endl; - + string const lyxrc_path = LibFileSearch(string(), name); if (!lyxrc_path.empty()) { - lyxerr[Debug::INIT] << "Found " << name + lyxerr[Debug::INIT] << "Found " << name << " in " << lyxrc_path << endl; - if (lyxrc.read(lyxrc_path) < 0) { - Alert::alert(_("LyX Warning!"), + if (lyxrc.read(lyxrc_path) < 0) { + Alert::alert(_("LyX Warning!"), _("Error while reading ") + lyxrc_path + ".", _("Using built-in defaults.")); return false; } return true; } else { - lyxerr[Debug::INIT] << "Could not find " << name << endl; + lyxerr[Debug::INIT] << "Could not find " << name << endl; } - + return false; } @@ -700,15 +700,15 @@ void LyX::readUIFile(string const & name) }; lyxerr[Debug::INIT] << "About to read " << name << "..." << endl; - + string const ui_path = LibFileSearch("ui", name, "ui"); if (ui_path.empty()) { - lyxerr[Debug::INIT] << "Could not find " << name << endl; + lyxerr[Debug::INIT] << "Could not find " << name << endl; menubackend.defaults(); return; } - + lyxerr[Debug::INIT] << "Found " << name << " in " << ui_path << endl; LyXLex lex(uitags, ui_last - 1); @@ -717,13 +717,13 @@ void LyX::readUIFile(string const & name) lyxerr << "Unable to set LyXLeX for ui file: " << ui_path << endl; } - + if (lyxerr.debugging(Debug::PARSER)) lex.printTable(lyxerr); while (lex.isOK()) { switch (lex.lex()) { - case ui_menuset: + case ui_menuset: menubackend.read(lex); break; @@ -791,9 +791,9 @@ void commandLineHelp() "\t-userdir dir try to set user directory to dir\n" "\t-sysdir dir try to set system directory to dir\n" "\t-geometry WxH+X+Y set geometry of the main window\n" - "\t-dbg feature[,feature]...\n" - " select the features to debug.\n" - " Type `lyx -dbg' to see the list of features\n" + "\t-dbg feature[,feature]...\n" + " select the features to debug.\n" + " Type `lyx -dbg' to see the list of features\n" "\t-x [--execute] command\n" " where command is a lyx command.\n" "\t-e [--export] fmt\n" @@ -837,14 +837,14 @@ bool LyX::easyParse(int * argc, char * argv[]) Debug::showTags(lyxerr); exit(0); } - } + } // Check for "-sysdir" else if (arg == "-sysdir") { if (i + 1 < *argc) { system_lyxdir = argv[i + 1]; removeargs = 2; } else { - lyxerr << _("Missing directory for -sysdir switch!") + lyxerr << _("Missing directory for -sysdir switch!") << endl; exit(0); } @@ -864,7 +864,7 @@ bool LyX::easyParse(int * argc, char * argv[]) else if (arg == "--help" || arg == "-help") { commandLineHelp(); exit(0); - } + } // Check for --version or -version else if (arg == "--version" || arg == "-version") { commandLineVersionInfo(); @@ -905,7 +905,7 @@ bool LyX::easyParse(int * argc, char * argv[]) string const type(argv[i+1]); string const file(argv[i+2]); removeargs = 3; - + batch_command = "buffer-import " + type + " " + file; lyxerr << "batch_command: " << batch_command << endl; diff --git a/src/lyx_main.h b/src/lyx_main.h index 523de58dd9..c56d5ea9a7 100644 --- a/src/lyx_main.h +++ b/src/lyx_main.h @@ -1,9 +1,9 @@ // -*- C++ -*- /* This file is part of -* ====================================================== -* +* ====================================================== +* * LyX, The Document Processor -* +* * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team. * @@ -77,14 +77,14 @@ private: /** Search for and read the LyXRC file name, return true if successfull. */ - bool readRcFile(string const & name); + bool readRcFile(string const & name); /// Read the ui file `name' void readUIFile(string const & name); /// Read the languages file `name' void readLanguagesFile(string const & name); /// Read the encodings file `name' void readEncodingsFile(string const & name); - /// + /// bool easyParse(int * argc, char * argv[]); }; diff --git a/src/lyx_sty.C b/src/lyx_sty.C index df388b3b77..8b188e2966 100644 --- a/src/lyx_sty.C +++ b/src/lyx_sty.C @@ -1,8 +1,8 @@ /* This file is part of - * ====================================================== - * + * ====================================================== + * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team. * @@ -18,20 +18,20 @@ //\NeedsTeXFormat{LaTeX2e} //\ProvidesPackage{lyx}[1996/01/11 LLE v0.2 (LyX LaTeX Extensions)] -//\message{LyX LaTeX Extensions (LLE v0.2) of 11-Jan-1996.} +//\message{LyX LaTeX Extensions (LLE v0.2) of 11-Jan-1996.} // include this always -string const lyx_def = +string const lyx_def = "\\providecommand{\\LyX}{L\\kern-.1667em\\lower.25em\\hbox{Y}\\kern-.125emX\\@}"; - -string const lyxline_def = + +string const lyxline_def = "\\newcommand{\\lyxline}[1]{\n" " {#1 \\vspace{1ex} \\hrule width \\columnwidth \\vspace{1ex}}\n" "}"; string const noun_def = "\\newcommand{\\noun}[1]{\\textsc{#1}}"; -string const lyxarrow_def = +string const lyxarrow_def = "\\newcommand{\\lyxarrow}{\\leavevmode\\,$\\triangleright$\\,\\allowbreak}"; // for quotes without babel. This does not give perfect results, but @@ -39,59 +39,59 @@ string const lyxarrow_def = -string const quotedblbase_def = +string const quotedblbase_def = "\\ProvideTextCommandDefault{\\quotedblbase}{%\n" " \\raisebox{-1.4ex}[1ex][.5ex]{\\textquotedblright}%\n" " \\penalty10000\\hskip0em\\relax%\n" "}"; -string const quotesinglbase_def = +string const quotesinglbase_def = "\\ProvideTextCommandDefault{\\quotesinglbase}{%\n" " \\raisebox{-1.4ex}[1ex][.5ex]{\\textquoteright}%\n" " \\penalty10000\\hskip0em\\relax%\n" "}"; -string const guillemotleft_def = - "\\ProvideTextCommandDefault{\\guillemotleft}{%\n" - " {\\usefont{U}{lasy}{m}{n}\\char'50\\kern-.15em\\char'50}%\n" - "\\penalty10000\\hskip0pt\\relax%\n" - "}"; +string const guillemotleft_def = + "\\ProvideTextCommandDefault{\\guillemotleft}{%\n" + " {\\usefont{U}{lasy}{m}{n}\\char'50\\kern-.15em\\char'50}%\n" + "\\penalty10000\\hskip0pt\\relax%\n" + "}"; -string const guillemotright_def = - "\\ProvideTextCommandDefault{\\guillemotright}{%\n" - " \\penalty10000\\hskip0pt%\n" - " {\\usefont{U}{lasy}{m}{n}\\char'51\\kern-.15em\\char'51}%\n" - "}"; +string const guillemotright_def = + "\\ProvideTextCommandDefault{\\guillemotright}{%\n" + " \\penalty10000\\hskip0pt%\n" + " {\\usefont{U}{lasy}{m}{n}\\char'51\\kern-.15em\\char'51}%\n" + "}"; -string const guilsinglleft_def = - "\\ProvideTextCommandDefault{\\guilsinglleft}{%\n" - " {\\usefont{U}{lasy}{m}{n}\\char'50}%\n" - " \\penalty10000\\hskip0pt\\relax%\n" - "}"; +string const guilsinglleft_def = + "\\ProvideTextCommandDefault{\\guilsinglleft}{%\n" + " {\\usefont{U}{lasy}{m}{n}\\char'50}%\n" + " \\penalty10000\\hskip0pt\\relax%\n" + "}"; -string const guilsinglright_def = - "\\ProvideTextCommandDefault{\\guilsinglright}{%\n" - " \\penalty10000\\hskip0pt%\n" - " {\\usefont{U}{lasy}{m}{n}\\char'51}%\n" - "}"; +string const guilsinglright_def = + "\\ProvideTextCommandDefault{\\guilsinglright}{%\n" + " \\penalty10000\\hskip0pt%\n" + " {\\usefont{U}{lasy}{m}{n}\\char'51}%\n" + "}"; -string const paragraphindent_def = +string const paragraphindent_def = "\\newenvironment{LyXParagraphIndent}[1]%\n" "{\n" " \\begin{list}{}{%\n" " \\setlength\\topsep{0pt}%\n" " \\addtolength{\\leftmargin}{#1}\n" -// "%% \\addtolength{\\leftmargin}{#1\\textwidth}\n" -// "%% \\setlength{\\textwidth}{#2\\textwidth}\n" -// "%% \\setlength\\listparindent\\parindent%\n" -// "%% \\setlength\\itemindent\\parindent%\n" +// "%% \\addtolength{\\leftmargin}{#1\\textwidth}\n" +// "%% \\setlength{\\textwidth}{#2\\textwidth}\n" +// "%% \\setlength\\listparindent\\parindent%\n" +// "%% \\setlength\\itemindent\\parindent%\n" " \\setlength\\parsep{0pt plus 1pt}%\n" " }\n" " \\item[]\n" "}\n" "{\\end{list}}\n"; -string const floatingfootnote_def = +string const floatingfootnote_def = "%% Special footnote code from the package 'stblftnt.sty'\n" "%% Author: Robin Fairbairns -- Last revised Dec 13 1996\n" "\\let\\SF@@footnote\\footnote\n" @@ -109,21 +109,19 @@ string const floatingfootnote_def = " \\expandafter\\noexpand\\csname SF@gobble@opt \\endcsname}\n" "\\def\\SF@gobble@twobracket[#1]#2{}\n"; -string const minipageindent_def = +string const minipageindent_def = "%% This length is the backup for minipages of the \\parindent\n" "\\newlength{\\LyXMinipageIndent}\n" "\\setlength{\\LyXMinipageIndent}{\\parindent}\n"; -string const boldsymbol_def = +string const boldsymbol_def = "%% Bold symbol macro for standard LaTeX users\n" "\\newcommand{\\boldsymbol}[1]{\\mbox{\\boldmath $#1$}}\n"; -string const binom_def = +string const binom_def = "%% Binom macro for standard LaTeX users\n" "\\newcommand{\\binom}[2]{{#1 \\choose #2}}\n"; -string const mathcircumflex_def = +string const mathcircumflex_def = "%% For printing a cirumflex inside a formula\n" "\\newcommand{\\mathcircumflex}[0]{\\mbox{\\^{}}}\n"; - - diff --git a/src/lyx_sty.h b/src/lyx_sty.h index e56217205f..1873548af2 100644 --- a/src/lyx_sty.h +++ b/src/lyx_sty.h @@ -1,9 +1,9 @@ // -*- C++ -*- /* This file is part of - * ====================================================== - * + * ====================================================== + * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team. * diff --git a/src/lyxcursor.C b/src/lyxcursor.C index 12afbd3df9..76e43f76ba 100644 --- a/src/lyxcursor.C +++ b/src/lyxcursor.C @@ -1,8 +1,8 @@ /* This file is part of - * ====================================================== - * + * ====================================================== + * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team. * @@ -23,7 +23,7 @@ LyXCursor::LyXCursor() {} -void LyXCursor::par(Paragraph * p) +void LyXCursor::par(Paragraph * p) { par_ = p; } @@ -47,7 +47,7 @@ lyx::pos_type LyXCursor::pos() const } -void LyXCursor::boundary(bool b) +void LyXCursor::boundary(bool b) { boundary_ = b; } diff --git a/src/lyxcursor.h b/src/lyxcursor.h index cc7cb9ef90..c36812befd 100644 --- a/src/lyxcursor.h +++ b/src/lyxcursor.h @@ -1,9 +1,9 @@ // -*- C++ -*- /* This file is part of - * ====================================================== - * + * ====================================================== + * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team. * @@ -90,7 +90,7 @@ bool operator!=(LyXCursor const & a, LyXCursor const & b) /// inline -bool operator<(LyXCursor const & a, LyXCursor const & b) +bool operator<(LyXCursor const & a, LyXCursor const & b) { // Can this be done in a nother way? return (a.y() < b.y() && a.pos() < b.pos()); @@ -98,7 +98,7 @@ bool operator<(LyXCursor const & a, LyXCursor const & b) /// inline -bool operator>(LyXCursor const & a, LyXCursor const & b) +bool operator>(LyXCursor const & a, LyXCursor const & b) { return b < a; } diff --git a/src/lyxfind.C b/src/lyxfind.C index 5a44645f90..fa6acb468f 100644 --- a/src/lyxfind.C +++ b/src/lyxfind.C @@ -33,38 +33,38 @@ enum SearchResult { /// returns true if the specified string is at the specified position bool IsStringInText(Paragraph * par, pos_type pos, - string const & str, bool const & = true, - bool const & = false); + string const & str, bool const & = true, + bool const & = false); /// if the string is found: return true and set the cursor to the new position SearchResult SearchForward(BufferView *, LyXText * text, string const & str, - bool const & = true, bool const & = false); + bool const & = true, bool const & = false); /// SearchResult SearchBackward(BufferView *, LyXText * text, string const & str, - bool const & = true, bool const & = false); + bool const & = true, bool const & = false); int LyXReplace(BufferView * bv, - string const & searchstr, string const & replacestr, - bool forward, bool casesens, bool matchwrd, bool replaceall, - bool once) + string const & searchstr, string const & replacestr, + bool forward, bool casesens, bool matchwrd, bool replaceall, + bool once) { - if (!bv->available() || bv->buffer()->isReadonly()) + if (!bv->available() || bv->buffer()->isReadonly()) return 0; - + // CutSelection cannot cut a single space, so we have to stop // in order to avoid endless loop :-( if (searchstr.length() == 0 || (searchstr.length() == 1 && searchstr[0] == ' ')) { Alert::alert(_("Sorry!"), _("You cannot replace a single space, " - "nor an empty character.")); + "nor an empty character.")); return 0; } - + LyXText * text = bv->getLyXText(); - // now we can start searching for the first + // now we can start searching for the first // start at top if replaceall bool fw = forward; if (replaceall) { @@ -77,7 +77,7 @@ int LyXReplace(BufferView * bv, // override search direction because we search top to bottom fw = true; } - + // if nothing selected or selection does not equal search string // search and select next occurance and return if no replaceall string str1; @@ -110,25 +110,25 @@ int LyXReplace(BufferView * bv, if (!once) found = LyXFind(bv, searchstr, fw, false, casesens, matchwrd); } while (!once && replaceall && found); - + if (bv->focus()) bv->showCursor(); - + return replace_count; } bool LyXFind(BufferView * bv, - string const & searchstr, bool forward, - bool frominset, bool casesens, bool matchwrd) + string const & searchstr, bool forward, + bool frominset, bool casesens, bool matchwrd) { if (!bv->available() || searchstr.empty()) return false; - + LyXText * text = bv->getLyXText(); bv->hideCursor(); bv->update(text, BufferView::SELECT|BufferView::FITCUR); - + if (text->selection.set()) text->cursor = forward ? text->selection.end : text->selection.start; @@ -156,13 +156,13 @@ bool LyXFind(BufferView * bv, text->setCursor(bv, par, pos); } if (par) { - result = forward ? + result = forward ? SearchForward(bv, text, searchstr, casesens, matchwrd) : SearchBackward(bv, text, searchstr, casesens, matchwrd); } } } else { - result = forward ? + result = forward ? SearchForward(bv, text, searchstr, casesens, matchwrd) : SearchBackward(bv, text, searchstr, casesens, matchwrd); } @@ -178,10 +178,10 @@ bool LyXFind(BufferView * bv, bv->update(bv->getLyXText(), BufferView::SELECT|BufferView::FITCUR); } else if (result == SR_NOT_FOUND) found = false; - + if (bv->focus()) bv->showCursor(); - + return found; } @@ -193,13 +193,13 @@ bool IsStringInText(Paragraph * par, pos_type pos, { if (!par) return false; - + string::size_type size = str.length(); pos_type i = 0; while (((pos + i) < par->size()) && (string::size_type(i) < size) && (cs ? (str[i] == par->getChar(pos + i)) - : (uppercase(str[i]) == uppercase(par->getChar(pos + i))))) + : (uppercase(str[i]) == uppercase(par->getChar(pos + i))))) { ++i; } @@ -220,7 +220,7 @@ bool IsStringInText(Paragraph * par, pos_type pos, // if the string can be found: return true and set the cursor to // the new position, cs = casesensitive, mw = matchword SearchResult SearchForward(BufferView * bv, LyXText * text, string const & str, - bool const & cs, bool const & mw) + bool const & cs, bool const & mw) { Paragraph * par = text->cursor.par(); pos_type pos = text->cursor.pos(); @@ -239,16 +239,16 @@ SearchResult SearchForward(BufferView * bv, LyXText * text, string const & str, return SR_FOUND_NOUPDATE; text = bv->getLyXText(); } - + ++pos; - + if (pos >= par->size()) { prev_par = par; par = par->next(); pos = 0; } } - + if (par) { text->setCursor(bv, par, pos); return SR_FOUND; @@ -265,8 +265,8 @@ SearchResult SearchForward(BufferView * bv, LyXText * text, string const & str, // if the string can be found: return true and set the cursor to // the new position, cs = casesensitive, mw = matchword SearchResult SearchBackward(BufferView * bv, LyXText * text, - string const & str, - bool const & cs, bool const & mw) + string const & str, + bool const & cs, bool const & mw) { Paragraph * par = text->cursor.par(); pos_type pos = text->cursor.pos(); @@ -295,9 +295,9 @@ SearchResult SearchBackward(BufferView * bv, LyXText * text, if (inset->searchBackward(bv, str, cs, mw)) return SR_FOUND_NOUPDATE; text = bv->getLyXText(); - } + } } while (par && !IsStringInText(par, pos, str, cs, mw)); - + if (par) { text->setCursor(bv, par, pos); return SR_FOUND; @@ -307,4 +307,3 @@ SearchResult SearchBackward(BufferView * bv, LyXText * text, return SR_NOT_FOUND; } } - diff --git a/src/lyxfind.h b/src/lyxfind.h index 7ea11b7f6f..2e74dc3361 100644 --- a/src/lyxfind.h +++ b/src/lyxfind.h @@ -12,12 +12,12 @@ class BufferView; int LyXReplace(BufferView * bv, string const &, string const &, - bool, bool = true, bool = false, - bool = false, bool = false); + bool, bool = true, bool = false, + bool = false, bool = false); bool LyXFind(BufferView *, - string const & searchstr, bool forward, - bool frominset = false, bool casesens = true, + string const & searchstr, bool forward, + bool frominset = false, bool casesens = true, bool matchwrd = false); #endif diff --git a/src/lyxfont.C b/src/lyxfont.C index 8959e619e8..3a3b3f845b 100644 --- a/src/lyxfont.C +++ b/src/lyxfont.C @@ -1,8 +1,8 @@ /* This file is part of - * ====================================================== - * + * ====================================================== + * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team. * @@ -40,62 +40,62 @@ using std::strlen; namespace { -char const * GUIFamilyNames[LyXFont::NUM_FAMILIES + 2 /* default & error */] = +char const * GUIFamilyNames[LyXFont::NUM_FAMILIES + 2 /* default & error */] = { N_("Roman"), N_("Sans serif"), N_("Typewriter"), N_("Symbol"), "cmr", "cmsy", "cmm", "cmex", "msa", "msb", "eufrak", N_("Inherit"), N_("Ignore") }; -char const * GUISeriesNames[4] = +char const * GUISeriesNames[4] = { N_("Medium"), N_("Bold"), N_("Inherit"), N_("Ignore") }; -char const * GUIShapeNames[6] = +char const * GUIShapeNames[6] = { N_("Upright"), N_("Italic"), N_("Slanted"), N_("Smallcaps"), N_("Inherit"), N_("Ignore") }; -char const * GUISizeNames[14] = +char const * GUISizeNames[14] = { N_("Tiny"), N_("Smallest"), N_("Smaller"), N_("Small"), N_("Normal"), N_("Large"), - N_("Larger"), N_("Largest"), N_("Huge"), N_("Huger"), N_("Increase"), N_("Decrease"), + N_("Larger"), N_("Largest"), N_("Huge"), N_("Huger"), N_("Increase"), N_("Decrease"), N_("Inherit"), N_("Ignore") }; - -char const * GUIMiscNames[5] = + +char const * GUIMiscNames[5] = { N_("Off"), N_("On"), N_("Toggle"), N_("Inherit"), N_("Ignore") }; // // Strings used to read and write .lyx format files // -char const * LyXFamilyNames[LyXFont::NUM_FAMILIES + 2 /* default & error */] = +char const * LyXFamilyNames[LyXFont::NUM_FAMILIES + 2 /* default & error */] = { "roman", "sans", "typewriter", "symbol", "cmr", "cmsy", "cmm", "cmex", "msa", "msb", "eufrak", "default", "error" }; -char const * LyXSeriesNames[4] = +char const * LyXSeriesNames[4] = { "medium", "bold", "default", "error" }; -char const * LyXShapeNames[6] = +char const * LyXShapeNames[6] = { "up", "italic", "slanted", "smallcaps", "default", "error" }; -char const * LyXSizeNames[14] = +char const * LyXSizeNames[14] = { "tiny", "scriptsize", "footnotesize", "small", "normal", "large", - "larger", "largest", "huge", "giant", + "larger", "largest", "huge", "giant", "increase", "decrease", "default", "error" }; -char const * LyXMiscNames[5] = +char const * LyXMiscNames[5] = { "off", "on", "toggle", "default", "error" }; // // Strings used to write LaTeX files // -char const * LaTeXFamilyNames[6] = +char const * LaTeXFamilyNames[6] = { "textrm", "textsf", "texttt", "error1", "error2", "error3" }; -char const * LaTeXSeriesNames[4] = +char const * LaTeXSeriesNames[4] = { "textmd", "textbf", "error4", "error5" }; -char const * LaTeXShapeNames[6] = +char const * LaTeXShapeNames[6] = { "textup", "textit", "textsl", "textsc", "error6", "error7" }; -char const * LaTeXSizeNames[14] = +char const * LaTeXSizeNames[14] = { "tiny", "scriptsize", "footnotesize", "small", "normalsize", "large", "Large", "LARGE", "huge", "Huge", "error8", "error9", "error10", "error11" }; @@ -204,31 +204,31 @@ LyXFont::FONT_MISC_STATE LyXFont::underbar() const } -LColor::color LyXFont::color() const +LColor::color LyXFont::color() const { return bits.color; } -Language const * LyXFont::language() const +Language const * LyXFont::language() const { return lang; } -LyXFont::FONT_MISC_STATE LyXFont::number() const +LyXFont::FONT_MISC_STATE LyXFont::number() const { return bits.number; } -bool LyXFont::isRightToLeft() const +bool LyXFont::isRightToLeft() const { return lang->RightToLeft(); } -bool LyXFont::isVisibleRightToLeft() const +bool LyXFont::isVisibleRightToLeft() const { return (lang->RightToLeft() && number() != ON); @@ -306,7 +306,7 @@ LyXFont & LyXFont::setNumber(LyXFont::FONT_MISC_STATE n) /// Decreases font size by one -LyXFont & LyXFont::decSize() +LyXFont & LyXFont::decSize() { switch (size()) { case SIZE_HUGER: setSize(SIZE_HUGE); break; @@ -337,7 +337,7 @@ LyXFont & LyXFont::decSize() /// Increases font size by one -LyXFont & LyXFont::incSize() +LyXFont & LyXFont::incSize() { switch (size()) { case SIZE_HUGER: break; @@ -368,7 +368,7 @@ LyXFont & LyXFont::incSize() /// Updates a misc setting according to request -LyXFont::FONT_MISC_STATE LyXFont::setMisc(FONT_MISC_STATE newfont, +LyXFont::FONT_MISC_STATE LyXFont::setMisc(FONT_MISC_STATE newfont, FONT_MISC_STATE org) { if (newfont == TOGGLE) { @@ -383,13 +383,13 @@ LyXFont::FONT_MISC_STATE LyXFont::setMisc(FONT_MISC_STATE newfont, } } else if (newfont == IGNORE) return org; - else + else return newfont; } /// Updates font settings according to request -void LyXFont::update(LyXFont const & newfont, +void LyXFont::update(LyXFont const & newfont, Language const * document_language, bool toggleall) { @@ -412,7 +412,7 @@ void LyXFont::update(LyXFont const & newfont, case INHERIT_SERIES: setSeries(newfont.series()); break; - case IGNORE_SERIES: + case IGNORE_SERIES: break; } @@ -434,7 +434,7 @@ void LyXFont::update(LyXFont const & newfont, setEmph(setMisc(newfont.emph(), emph())); setUnderbar(setMisc(newfont.underbar(), underbar())); setNoun(setMisc(newfont.noun(), noun())); - + setNumber(setMisc(newfont.number(), number())); if (newfont.language() == language() && toggleall) if (language() == document_language) @@ -442,7 +442,7 @@ void LyXFont::update(LyXFont const & newfont, else #ifndef INHERIT_LANGUAGE setLanguage(document_language); -#else +#else setLanguage(inherit_language); #endif else if (newfont.language() != ignore_language) @@ -504,7 +504,7 @@ LyXFont & LyXFont::realize(LyXFont const & tmplt, Language const * deflang) bits = tmplt.bits; return *this; } - + if (bits.family == INHERIT_FAMILY) { bits.family = tmplt.bits.family; } @@ -538,7 +538,7 @@ bool LyXFont::resolved() const { return (family() != INHERIT_FAMILY && series() != INHERIT_SERIES && shape() != INHERIT_SHAPE && size() != INHERIT_SIZE && - emph() != INHERIT && underbar() != INHERIT && + emph() != INHERIT && underbar() != INHERIT && noun() != INHERIT && #ifdef INHERIT_LANGUAGE language() != inherit_language && @@ -740,7 +740,7 @@ LyXFont & LyXFont::lyxRead(LyXLex & lex) /// Writes the changes from this font to orgfont in .lyx format in file void LyXFont::lyxWriteChanges(LyXFont const & orgfont, #ifdef INHERIT_LANGUAGE - Language const * doclang, + Language const * doclang, #endif ostream & os) const { @@ -840,7 +840,7 @@ int LyXFont::latexWriteStartChanges(ostream & os, LyXFont const & base, LyXFont f = *this; f.reduce(base); - + if (f.family() != INHERIT_FAMILY) { os << '\\' << LaTeXFamilyNames[f.family()] @@ -904,7 +904,7 @@ int LyXFont::latexWriteStartChanges(ostream & os, LyXFont const & base, // Returns number of chars written // This one corresponds to latexWriteStartChanges(). (Asger) int LyXFont::latexWriteEndChanges(ostream & os, LyXFont const & base, - LyXFont const & next) const + LyXFont const & next) const { int count = 0; bool env = false; diff --git a/src/lyxfont.h b/src/lyxfont.h index 28611e5429..ad9d3f276c 100644 --- a/src/lyxfont.h +++ b/src/lyxfont.h @@ -1,11 +1,11 @@ // -*- C++ -*- /* This file is part of * ====================================================== - * + * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich - * Copyright 1995-2001 The LyX Team. + * Copyright 1995-2001 The LyX Team. * * ====================================================== */ @@ -125,7 +125,7 @@ public: /// IGNORE_SIZE }; - + /// Used for emph, underbar, noun and latex toggles enum FONT_MISC_STATE { /// @@ -177,28 +177,28 @@ public: /// Decreases font size by one LyXFont & decSize(); - + /// Increases font size by one LyXFont & incSize(); - + /// FONT_FAMILY family() const; - + /// FONT_SERIES series() const; - + /// FONT_SHAPE shape() const; - + /// FONT_SIZE size() const; - + /// FONT_MISC_STATE emph() const; - + /// FONT_MISC_STATE underbar() const; - + /// FONT_MISC_STATE noun() const; @@ -208,7 +208,7 @@ public: /// LColor::color color() const; - /// + /// Language const * language() const; /// @@ -219,7 +219,7 @@ public: /// bool isSymbolFont() const; - + /// LyXFont & setFamily(LyXFont::FONT_FAMILY f); /// @@ -238,21 +238,21 @@ public: LyXFont & setNumber(LyXFont::FONT_MISC_STATE n); /// LyXFont & setColor(LColor::color c); - /// + /// LyXFont & setLanguage(Language const * l); /// Set family after LyX text format LyXFont & setLyXFamily(string const &); - + /// Set series after LyX text format LyXFont & setLyXSeries(string const &); - + /// Set shape after LyX text format LyXFont & setLyXShape(string const &); - + /// Set size after LyX text format LyXFont & setLyXSize(string const &); - + /// Returns misc flag after LyX text format LyXFont::FONT_MISC_STATE setLyXMisc(string const &); @@ -261,7 +261,7 @@ public: /// Returns size of font in LaTeX text notation string const latexSize() const; - + /** Updates font settings according to request. If an attribute is IGNORE, the attribute is left as it is. When toggleall = true, all properties that matches the font in use @@ -274,11 +274,11 @@ public: void update(LyXFont const & newfont, Language const * default_lang, bool toggleall = false); - + /** Reduce font to fall back to template where possible. Equal fields are reduced to INHERIT */ void reduce(LyXFont const & tmplt); - + /// Realize font from a template (INHERIT are realized) #ifndef INHERIT_LANGUAGE LyXFont & realize(LyXFont const & tmplt); @@ -287,16 +287,16 @@ public: #endif /// Is a given font fully resolved? bool resolved() const; - + /// Read a font specification from LyXLex. Used for layout files. LyXFont & lyxRead(LyXLex &); - + /// Writes the changes from this font to orgfont in .lyx format in file #ifndef INHERIT_LANGUAGE void lyxWriteChanges(LyXFont const & orgfont, std::ostream &) const; #else void lyxWriteChanges(LyXFont const & orgfont, Language const * doclang, - std::ostream &) const; + std::ostream &) const; #endif /** Writes the head of the LaTeX needed to change to this font. @@ -355,16 +355,16 @@ private: /// FontBits bits; - + /// Language const * lang; - + /// Sane font static FontBits sane; - + /// All inherit font static FontBits inherit; - + /// All ignore font static FontBits ignore; @@ -382,7 +382,7 @@ LyXFont::FONT_SHAPE LyXFont::shape() const inline -LyXFont::FONT_FAMILY LyXFont::family() const +LyXFont::FONT_FAMILY LyXFont::family() const { return bits.family; } diff --git a/src/lyxfunc.C b/src/lyxfunc.C index aa8c2fd32d..5b9e126da3 100644 --- a/src/lyxfunc.C +++ b/src/lyxfunc.C @@ -1,8 +1,8 @@ /* This file is part of - * ====================================================== - * + * ====================================================== + * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team. * @@ -97,12 +97,12 @@ #include #include -#include -#include +#include +#include using std::pair; -using std::make_pair; +using std::make_pair; using std::endl; using std::find_if; using std::vector; @@ -144,8 +144,8 @@ public: void receiveCmd(string const & cmd) {} /// void receiveArg(string const & arg) {} - - + + private: }; @@ -195,7 +195,7 @@ void LyXFunc::moveCursorUpdate(bool flag, bool selecting) } owner->view()->update(TEXT(flag), BufferView::SELECT|BufferView::FITCUR); owner->view()->showCursor(); - + /* ---> Everytime the cursor is moved, show the current font state. */ // should this too me moved out of this func? owner->view()->setState(); @@ -209,7 +209,7 @@ void LyXFunc::handleKeyFunc(kb_action action) if (keyseq.length() > 1) { c = 0; } - + owner->getIntl()->getTrans() .deadkey(c, get_accent(action).accent, TEXT(false)); // Need to clear, in case the minibuffer calls these @@ -222,10 +222,10 @@ void LyXFunc::handleKeyFunc(kb_action action) } -void LyXFunc::processKeySym(KeySym keysym, unsigned int state) +void LyXFunc::processKeySym(KeySym keysym, unsigned int state) { string argument; - + if (lyxerr.debugging(Debug::KEY)) { char const * tmp = XKeysymToString(keysym); string const stm = (tmp ? tmp : ""); @@ -251,19 +251,19 @@ void LyXFunc::processKeySym(KeySym keysym, unsigned int state) || keysym == XK_Mode_switch || keysym == 0x0) { return; } - + // Do a one-deep top-level lookup for // cancel and meta-fake keys. RVDK_PATCH_5 cancel_meta_seq.reset(); int action = cancel_meta_seq.addkey(keysym, state &(ShiftMask|ControlMask - |Mod1Mask)); + |Mod1Mask)); if (lyxerr.debugging(Debug::KEY)) { lyxerr << "action first set to [" << action << "]" << endl; } - - // When not cancel or meta-fake, do the normal lookup. + + // When not cancel or meta-fake, do the normal lookup. // Note how the meta_fake Mod1 bit is OR-ed in and reset afterwards. // Mostly, meta_fake_bit = 0. RVDK_PATCH_5. if ((action != LFUN_CANCEL) && (action != LFUN_META_FAKE)) { @@ -283,8 +283,8 @@ void LyXFunc::processKeySym(KeySym keysym, unsigned int state) } // Dont remove this unless you know what you are doing. meta_fake_bit = 0; - - // can this happen now ? + + // can this happen now ? if (action == LFUN_NOACTION) { action = LFUN_PREFIX; } @@ -324,19 +324,19 @@ void LyXFunc::processKeySym(KeySym keysym, unsigned int state) // This is very X dependent. unsigned int c = keysym; string argument; - + c = kb_keymap::getiso(c); if (c > 0) argument = static_cast(c); - + dispatch(LFUN_SELFINSERT, argument); lyxerr[Debug::KEY] << "SelfInsert arg[`" << argument << "']" << endl; } else verboseDispatch(action, false); -} +} FuncStatus LyXFunc::getStatus(int ac) const @@ -353,7 +353,7 @@ FuncStatus LyXFunc::getStatus(kb_action action, { FuncStatus flag; Buffer * buf = owner->buffer(); - + if (action == LFUN_UNKNOWN_ACTION) { setStatusMessage(N_("Unknown action")); return flag.unknown(true); @@ -361,14 +361,14 @@ FuncStatus LyXFunc::getStatus(kb_action action, // the default error message if we disable the command setStatusMessage(N_("Command disabled")); - + // Check whether we need a buffer if (!lyxaction.funcHasFlag(action, LyXAction::NoBuffer)) { // Yes we need a buffer, do we have one? if (buf) { // yes // Can we use a readonly buffer? - if (buf->isReadonly() && + if (buf->isReadonly() && !lyxaction.funcHasFlag(action, LyXAction::ReadOnly)) { // no @@ -384,11 +384,11 @@ FuncStatus LyXFunc::getStatus(kb_action action, } UpdatableInset * tli = owner->view()->theLockingInset(); - + // I would really like to avoid having this switch and rather try to // encode this in the function itself. - bool disable = false; - switch (action) { + bool disable = false; + switch (action) { case LFUN_MENUPRINT: disable = !Exporter::IsExportable(buf, "dvi") || lyxrc.print_command == "none"; @@ -479,13 +479,13 @@ FuncStatus LyXFunc::getStatus(kb_action action, case LFUN_INSET_TOGGLE: { LyXText * lt = owner->view()->getLyXText(); - disable = !(isEditableInset(lt->getInset()) - || (lt->inset_owner + disable = !(isEditableInset(lt->getInset()) + || (lt->inset_owner && lt->inset_owner->owner() - && lt->inset_owner->owner()->isOpen())); + && lt->inset_owner->owner()->isOpen())); break; } - case LFUN_MATH_VALIGN: + case LFUN_MATH_VALIGN: if (mathcursor) { char align = mathcursor->valign(); if (align == '\0') { @@ -505,7 +505,7 @@ FuncStatus LyXFunc::getStatus(kb_action action, disable = true; break; - case LFUN_MATH_HALIGN: + case LFUN_MATH_HALIGN: if (mathcursor) { char align = mathcursor->halign(); if (align == '\0') { @@ -525,7 +525,7 @@ FuncStatus LyXFunc::getStatus(kb_action action, disable = true; break; - case LFUN_MATH_MUTATE: + case LFUN_MATH_MUTATE: if (tli && (tli->lyxCode() == Inset::MATH_CODE)) { MathInsetTypes type = mathcursor->formula()->getType(); if (argument == "inline") { @@ -544,20 +544,20 @@ FuncStatus LyXFunc::getStatus(kb_action action, break; // we just need to be in math mode to enable that - case LFUN_MATH_SIZE: + case LFUN_MATH_SIZE: case LFUN_MATH_SPACE: - case LFUN_MATH_LIMITS: - case LFUN_MATH_NONUMBER: + case LFUN_MATH_LIMITS: + case LFUN_MATH_NONUMBER: case LFUN_MATH_NUMBER: disable = !mathcursor; break; // we need to be math mode and a math array for that // Hack: halign produces non-zero result iff we are in a math array - case LFUN_MATH_ROW_INSERT: - case LFUN_MATH_ROW_DELETE: - case LFUN_MATH_COLUMN_INSERT: - case LFUN_MATH_COLUMN_DELETE: + case LFUN_MATH_ROW_INSERT: + case LFUN_MATH_ROW_DELETE: + case LFUN_MATH_COLUMN_INSERT: + case LFUN_MATH_COLUMN_DELETE: disable = !mathcursor || !mathcursor->halign(); break; @@ -569,7 +569,7 @@ FuncStatus LyXFunc::getStatus(kb_action action, Inset::Code code = Inset::NO_CODE; switch (action) { case LFUN_INSET_ERT: - code = Inset::ERT_CODE; + code = Inset::ERT_CODE; break; case LFUN_INSET_GRAPHICS: code = Inset::GRAPHICS_CODE; @@ -668,7 +668,7 @@ FuncStatus LyXFunc::getStatus(kb_action action, if (disable) flag.disabled(true); - + // A few general toggles switch (action) { case LFUN_TOOLTIPS_TOGGLE: @@ -683,7 +683,7 @@ FuncStatus LyXFunc::getStatus(kb_action action, break; case LFUN_SWITCHBUFFER: // toggle on the current buffer, but do not toggle off - // the other ones (is that a good idea?) + // the other ones (is that a good idea?) if (argument == buf->fileName()) flag.setOnOff(true); break; @@ -745,41 +745,41 @@ FuncStatus LyXFunc::getStatus(kb_action action, break; } } - + return flag; } // temporary dispatch method -void LyXFunc::miniDispatch(string const & s) +void LyXFunc::miniDispatch(string const & s) { - string s2(frontStrip(strip(s))); - + string s2(frontStrip(strip(s))); + if (!s2.empty()) { verboseDispatch(s2, true); } } -void LyXFunc::verboseDispatch(string const & s, bool show_sc) +void LyXFunc::verboseDispatch(string const & s, bool show_sc) { int action = lyxaction.LookupFunc(frontStrip(s)); - + if (action == LFUN_UNKNOWN_ACTION) { string const msg = string(_("Unknown function (")) + s + ")"; owner->message(msg); } else { verboseDispatch(action, show_sc); - } + } } -void LyXFunc::verboseDispatch(int ac, bool show_sc) +void LyXFunc::verboseDispatch(int ac, bool show_sc) { string argument; kb_action action; - + // get the real action and argument action = lyxaction.retrieveActionArg(ac, argument); @@ -794,21 +794,21 @@ void LyXFunc::verboseDispatch(kb_action action, string res = dispatch(action, argument); commandshortcut.erase(); - + if (lyxrc.display_shortcuts && show_sc) { if (action != LFUN_SELFINSERT) { // Put name of command and list of shortcuts // for it in minibuffer string comname = lyxaction.getActionName(action); - + int pseudoaction = action; bool argsadded = false; - + if (!argument.empty()) { // the pseudoaction is useful for the bindings - pseudoaction = + pseudoaction = lyxaction.searchActionArg(action, - argument); + argument); if (pseudoaction == LFUN_UNKNOWN_ACTION) { pseudoaction = action; @@ -832,7 +832,7 @@ void LyXFunc::verboseDispatch(kb_action action, commandshortcut = "(" + comname + ')'; } } - } + } if (res.empty()) { if (!commandshortcut.empty()) { @@ -849,8 +849,8 @@ string const LyXFunc::dispatch(kb_action action, string argument) lyxerr[Debug::ACTION] << "LyXFunc::Dispatch: action[" << action <<"] arg[" << argument << "]" << endl; - // we have not done anything wrong yet. - errorstat = false; + // we have not done anything wrong yet. + errorstat = false; dispatch_buffer.erase(); #ifdef NEW_DISPATCHER @@ -893,9 +893,9 @@ string const LyXFunc::dispatch(kb_action action, string argument) goto exit_with_message; } else if (((result=owner->view()->theLockingInset()-> // Hand-over to inset's own dispatch: - localDispatch(owner->view(), action, argument)) == - UpdatableInset::DISPATCHED) || - (result == UpdatableInset::DISPATCHED_NOUPDATE)) + localDispatch(owner->view(), action, argument)) == + UpdatableInset::DISPATCHED) || + (result == UpdatableInset::DISPATCHED_NOUPDATE)) goto exit_with_message; // If UNDISPATCHED, just soldier on else if (result == UpdatableInset::FINISHED) { @@ -944,7 +944,7 @@ string const LyXFunc::dispatch(kb_action action, string argument) owner->showState(); } goto exit_with_message; - case LFUN_LEFT: + case LFUN_LEFT: if (TEXT()->cursor.par()->isRightToLeftPar(owner->buffer()->params)) { TEXT()->cursorRight(owner->view()); moveCursorUpdate(true, false); @@ -976,7 +976,7 @@ string const LyXFunc::dispatch(kb_action action, string argument) owner->view()->theLockingInset(); if (tli) { UpdatableInset * lock = tli->getLockingInset(); - + if (tli == lock) { owner->view()->unlockInset(tli); TEXT()->cursorRight(owner->view()); @@ -991,13 +991,13 @@ string const LyXFunc::dispatch(kb_action action, string argument) } } break; - + // --- Misc ------------------------------------------- - case LFUN_WORDFINDFORWARD : + case LFUN_WORDFINDFORWARD : case LFUN_WORDFINDBACKWARD : { static string last_search; string searched_string; - + if (!argument.empty()) { last_search = argument; searched_string = argument; @@ -1011,7 +1011,7 @@ string const LyXFunc::dispatch(kb_action action, string argument) // owner->view()->showCursor(); } break; - + case LFUN_PREFIX: { if (owner->view()->available() && !owner->view()->theLockingInset()) { @@ -1033,7 +1033,7 @@ string const LyXFunc::dispatch(kb_action action, string argument) allCmds, hist); } break; - + case LFUN_CANCEL: // RVDK_PATCH_5 keyseq.reset(); meta_fake_bit = 0; @@ -1048,7 +1048,7 @@ string const LyXFunc::dispatch(kb_action action, string argument) meta_fake_bit = Mod1Mask; setMessage(keyseq.print()); } - break; + break; case LFUN_READ_ONLY_TOGGLE: if (owner->buffer()->lyxvc.inUse()) { @@ -1058,24 +1058,24 @@ string const LyXFunc::dispatch(kb_action action, string argument) !owner->buffer()->isReadonly()); } break; - + case LFUN_CENTER: // this is center and redraw. owner->view()->center(); break; - + // --- Menus ----------------------------------------------- case LFUN_MENUNEW: menuNew(false); break; - + case LFUN_MENUNEWTMPLT: menuNew(true); break; - + case LFUN_CLOSEBUFFER: closeBuffer(); break; - + case LFUN_MENUWRITE: if (!owner->buffer()->isUnnamed()) { ostringstream s1; @@ -1086,31 +1086,31 @@ string const LyXFunc::dispatch(kb_action action, string argument) } else WriteAs(owner->view(), owner->buffer()); break; - + case LFUN_WRITEAS: WriteAs(owner->view(), owner->buffer(), argument); break; - + case LFUN_MENURELOAD: reloadBuffer(); break; - + case LFUN_UPDATE: Exporter::Export(owner->buffer(), argument, true); break; - + case LFUN_PREVIEW: Exporter::Preview(owner->buffer(), argument); break; - + case LFUN_BUILDPROG: Exporter::Export(owner->buffer(), "program", true); break; - case LFUN_RUNCHKTEX: + case LFUN_RUNCHKTEX: MenuRunChktex(owner->buffer()); break; - + case LFUN_MENUPRINT: owner->getDialogs()->showPrint(); break; @@ -1125,11 +1125,11 @@ string const LyXFunc::dispatch(kb_action action, string argument) case LFUN_IMPORT: doImport(argument); break; - + case LFUN_QUIT: QuitLyX(); break; - + case LFUN_TOCVIEW: #if 0 case LFUN_LOFVIEW: @@ -1153,28 +1153,28 @@ string const LyXFunc::dispatch(kb_action action, string argument) #endif owner->getDialogs()->createTOC(p.getAsString()); break; - } + } case LFUN_DIALOG_TABULAR_INSERT: owner->getDialogs()->showTabularCreate(); break; - + case LFUN_AUTOSAVE: AutoSave(owner->view()); break; - + case LFUN_UNDO: owner->view()->menuUndo(); break; - + case LFUN_REDO: owner->view()->menuRedo(); break; - + case LFUN_MENUSEARCH: owner->getDialogs()->showSearch(); break; - + case LFUN_REMOVEERRORS: if (owner->view()->removeAutoInsets()) { owner->view()->redraw(); @@ -1185,11 +1185,11 @@ string const LyXFunc::dispatch(kb_action action, string argument) case LFUN_DEPTH_MIN: changeDepth(owner->view(), TEXT(false), -1); break; - + case LFUN_DEPTH_PLUS: changeDepth(owner->view(), TEXT(false), 1); break; - + case LFUN_FREE: owner->getDialogs()->setUserFreeFont(); break; @@ -1222,7 +1222,7 @@ string const LyXFunc::dispatch(kb_action action, string argument) owner->getDialogs()->showTexinfo(); break; - case LFUN_HELP_OPEN: + case LFUN_HELP_OPEN: { string const arg = argument; if (arg.empty()) { @@ -1244,7 +1244,7 @@ string const LyXFunc::dispatch(kb_action action, string argument) owner->view()->buffer(bufferlist.loadLyXFile(fname, false)); owner->allowInput(); break; - } + } // --- version control ------------------------------- case LFUN_VC_REGISTER: @@ -1253,7 +1253,7 @@ string const LyXFunc::dispatch(kb_action action, string argument) owner->buffer()->lyxvc.registrer(); } break; - + case LFUN_VC_CHECKIN: { if (owner->buffer()->lyxvc.inUse() @@ -1261,7 +1261,7 @@ string const LyXFunc::dispatch(kb_action action, string argument) owner->buffer()->lyxvc.checkIn(); } break; - + case LFUN_VC_CHECKOUT: { if (owner->buffer()->lyxvc.inUse() @@ -1269,29 +1269,29 @@ string const LyXFunc::dispatch(kb_action action, string argument) owner->buffer()->lyxvc.checkOut(); } break; - + case LFUN_VC_REVERT: { owner->buffer()->lyxvc.revert(); } break; - + case LFUN_VC_UNDO: { owner->buffer()->lyxvc.undoLast(); } break; - + case LFUN_VC_HISTORY: { owner->getDialogs()->showVCLogFile(); break; } - + // --- buffers ---------------------------------------- - case LFUN_SWITCHBUFFER: - owner->view()->buffer(bufferlist.getBuffer(argument)); + case LFUN_SWITCHBUFFER: + owner->view()->buffer(bufferlist.getBuffer(argument)); break; case LFUN_FILE_NEW: @@ -1302,7 +1302,7 @@ string const LyXFunc::dispatch(kb_action action, string argument) owner->view()->buffer(tmpbuf); } break; - + case LFUN_FILE_OPEN: open(argument); break; @@ -1310,15 +1310,15 @@ string const LyXFunc::dispatch(kb_action action, string argument) case LFUN_LATEX_LOG: owner->getDialogs()->showLogFile(); break; - + case LFUN_LAYOUT_DOCUMENT: owner->getDialogs()->showDocument(); break; - + case LFUN_LAYOUT_PARAGRAPH: owner->getDialogs()->showParagraph(); break; - + case LFUN_LAYOUT_CHARACTER: owner->getDialogs()->showCharacter(); break; @@ -1341,7 +1341,7 @@ string const LyXFunc::dispatch(kb_action action, string argument) case LFUN_LAYOUT_PREAMBLE: owner->getDialogs()->showPreamble(); break; - + case LFUN_DROP_LAYOUTS_CHOICE: owner->getToolbar()->openLayoutList(); break; @@ -1349,12 +1349,12 @@ string const LyXFunc::dispatch(kb_action action, string argument) case LFUN_MENU_OPEN_BY_NAME: owner->getMenubar()->openByName(argument); break; // RVDK_PATCH_5 - + case LFUN_SPELLCHECK: if (lyxrc.isp_command != "none") owner->getDialogs()->showSpellchecker(); break; - + // --- lyxserver commands ---------------------------- @@ -1364,7 +1364,7 @@ string const LyXFunc::dispatch(kb_action action, string argument) << owner->buffer()->fileName() << "] " << endl; break; - + case LFUN_NOTIFY: { dispatch_buffer = keyseq.print(); @@ -1383,12 +1383,12 @@ string const LyXFunc::dispatch(kb_action action, string argument) // Either change buffer or load the file if (bufferlist.exists(s)) { - owner->view()->buffer(bufferlist.getBuffer(s)); + owner->view()->buffer(bufferlist.getBuffer(s)); } else { - owner->view()->buffer(bufferlist.loadLyXFile(s)); + owner->view()->buffer(bufferlist.loadLyXFile(s)); } - - // Set the cursor + + // Set the cursor owner->view()->setCursorFromRow(row); // Recenter screen @@ -1446,7 +1446,7 @@ string const LyXFunc::dispatch(kb_action action, string argument) } } break; - + case LFUN_ADD_TO_TOOLBAR: { if (lyxerr.debugging(Debug::GUI)) { @@ -1464,7 +1464,7 @@ string const LyXFunc::dispatch(kb_action action, string argument) } } break; - + // --- insert characters ---------------------------------------- // --- Mathed stuff. If we are here, there is no locked inset yet. @@ -1488,11 +1488,11 @@ string const LyXFunc::dispatch(kb_action action, string argument) case LFUN_MATH_PANEL: owner->getDialogs()->showMathPanel(); break; - + case LFUN_CITATION_CREATE: { InsetCommandParams p("cite"); - + if (!argument.empty()) { // This should be set at source, ie when typing // "citation-insert foo" in the minibuffer. @@ -1509,11 +1509,11 @@ string const LyXFunc::dispatch(kb_action action, string argument) owner->getDialogs()->createCitation(p.getAsString()); } break; - + case LFUN_CHILDOPEN: { string const filename = - MakeAbsPath(argument, + MakeAbsPath(argument, owner->buffer()->filePath()); setMessage(N_("Opening child document ") + MakeDisplayPath(filename) + "..."); @@ -1528,24 +1528,24 @@ string const LyXFunc::dispatch(kb_action action, string argument) case LFUN_TOGGLECURSORFOLLOW: lyxrc.cursor_follows_scrollbar = !lyxrc.cursor_follows_scrollbar; break; - + case LFUN_KMAP_OFF: // keymap off owner->getIntl()->KeyMapOn(false); break; - + case LFUN_KMAP_PRIM: // primary keymap owner->getIntl()->KeyMapPrim(); break; - + case LFUN_KMAP_SEC: // secondary keymap owner->getIntl()->KeyMapSec(); break; - + case LFUN_KMAP_TOGGLE: // toggle keymap owner->getIntl()->ToggleKeyMap(); break; - case LFUN_SEQUENCE: + case LFUN_SEQUENCE: { // argument contains ';'-terminated commands while (argument.find(';') != string::npos) { @@ -1559,7 +1559,7 @@ string const LyXFunc::dispatch(kb_action action, string argument) case LFUN_DIALOG_PREFERENCES: owner->getDialogs()->showPreferences(); break; - + case LFUN_SAVEPREFERENCES: { Path p(user_lyxdir); @@ -1570,7 +1570,7 @@ string const LyXFunc::dispatch(kb_action action, string argument) case LFUN_SCREEN_FONT_UPDATE: { // handle the screen font changes. - // + // lyxrc.set_font_norm_type(); fontloader.update(); // Of course we should only do the resize and the textcache.clear @@ -1613,7 +1613,7 @@ string const LyXFunc::dispatch(kb_action action, string argument) grfx::GCache & gc = grfx::GCache::get(); gc.changeDisplay(true); } - + owner->view()->redraw(); break; } @@ -1667,7 +1667,7 @@ exit_with_message: owner->message(_(res)); owner->updateMenubar(); owner->updateToolbar(); - + return res; } @@ -1692,7 +1692,7 @@ void LyXFunc::menuNew(bool fromTemplate) static int newfile_number; string s; - + if (lyxrc.new_ask_filename) { FileDialog fileDlg(owner, _("Enter filename for new document"), LFUN_SELECT_FILE_SYNC, @@ -1705,13 +1705,13 @@ void LyXFunc::menuNew(bool fromTemplate) fileDlg.Select(initpath, _("*.lyx|LyX Documents (*.lyx)"), _("newfile")); - + if (result.second.empty()) { owner->message(_("Canceled.")); lyxerr[Debug::INFO] << "New Document Cancelled." << endl; return; } - + // get absolute path of file and make sure the filename ends // with .lyx s = MakeAbsPath(result.second); @@ -1741,25 +1741,25 @@ void LyXFunc::menuNew(bool fromTemplate) // Check whether the file already exists FileInfo fi(s); if (fi.readable() && - Alert::askQuestion(_("File already exists:"), + Alert::askQuestion(_("File already exists:"), MakeDisplayPath(s, 50), _("Do you want to open the document?"))) { // loads document string const disp_fn(MakeDisplayPath(s)); - + ostringstream str; str << _("Opening document") << ' ' << disp_fn << "..."; - + owner->message(str.str().c_str()); //XFlush(fl_get_display()); owner->view()->buffer(bufferlist.loadLyXFile(s)); ostringstream str2; str2 << _("Document") << ' ' << disp_fn << ' ' << _("opened."); - + owner->message(str2.str().c_str()); - + return; } } else { @@ -1788,17 +1788,17 @@ void LyXFunc::menuNew(bool fromTemplate) FileDialog::Result result = fileDlg.Select(lyxrc.template_path, _("*.lyx|LyX Documents (*.lyx)")); - + if (result.first == FileDialog::Later) return; string const fname = result.second; - if (fname.empty()) + if (fname.empty()) return; - templname = fname; + templname = fname; } - + // find a free buffer lyxerr[Debug::INFO] << "Find a free buffer." << endl; owner->view()->buffer(bufferlist.newFile(s, templname)); @@ -1808,7 +1808,7 @@ void LyXFunc::menuNew(bool fromTemplate) void LyXFunc::open(string const & fname) { string initpath = lyxrc.document_path; - + if (owner->view()->available()) { string const trypath = owner->buffer()->filePath(); // If directory is writeable, use this as default. @@ -1817,7 +1817,7 @@ void LyXFunc::open(string const & fname) } string filename; - + if (fname.empty()) { FileDialog fileDlg(owner, _("Select document to open"), LFUN_FILE_OPEN, @@ -1829,12 +1829,12 @@ void LyXFunc::open(string const & fname) FileDialog::Result result = fileDlg.Select(initpath, "*.lyx|LyX Documents (*.lyx)"); - + if (result.first == FileDialog::Later) return; filename = result.second; - + // check selected filename if (filename.empty()) { owner->message(_("Canceled.")); @@ -1852,13 +1852,13 @@ void LyXFunc::open(string const & fname) } filename = fullpath; - + // loads document string const disp_fn(MakeDisplayPath(filename)); ostringstream str; str << _("Opening document") << ' ' << disp_fn << "..."; - + owner->message(str.str().c_str()); Buffer * openbuf = bufferlist.loadLyXFile(filename); @@ -1880,12 +1880,12 @@ void LyXFunc::doImport(string const & argument) { string format; string filename = split(argument, format, ' '); - lyxerr[Debug::INFO] << "LyXFunc::doImport: " << format + lyxerr[Debug::INFO] << "LyXFunc::doImport: " << format << " file: " << filename << endl; if (filename.empty()) { // need user interaction string initpath = lyxrc.document_path; - + if (owner->view()->available()) { string const trypath = owner->buffer()->filePath(); // If directory is writeable, use this as default. @@ -1896,13 +1896,13 @@ void LyXFunc::doImport(string const & argument) string const text = _("Select ") + formats.prettyName(format) + _(" file to import"); - FileDialog fileDlg(owner, text, + FileDialog fileDlg(owner, text, LFUN_IMPORT, make_pair(string(_("Documents|#o#O")), string(lyxrc.document_path)), make_pair(string(_("Examples|#E#e")), string(AddPath(system_lyxdir, "examples")))); - + string const extension = "*." + formats.extension(format) + "| " + formats.prettyName(format) + " (*." + formats.extension(format) + ")"; @@ -1914,14 +1914,14 @@ void LyXFunc::doImport(string const & argument) return; filename = result.second; - + // check selected filename if (filename.empty()) owner->message(_("Canceled.")); } // still no filename? abort - if (filename.empty()) + if (filename.empty()) return; // get absolute path of file @@ -1931,7 +1931,7 @@ void LyXFunc::doImport(string const & argument) // Check if the document already is open if (bufferlist.exists(lyxfile)) { - switch (Alert::askConfirmation(_("Document is already open:"), + switch (Alert::askConfirmation(_("Document is already open:"), MakeDisplayPath(lyxfile, 50), _("Do you want to close that document now?\n" "('No' will just switch to the open version)"))) @@ -1952,14 +1952,14 @@ void LyXFunc::doImport(string const & argument) // Check if a LyX document by the same root exists in filesystem FileInfo const f(lyxfile, true); - if (f.exist() && !Alert::askQuestion(_("A document by the name"), + if (f.exist() && !Alert::askQuestion(_("A document by the name"), MakeDisplayPath(lyxfile), _("already exists. Overwrite?"))) { owner->message(_("Canceled")); return; } // filename should be valid now - + Importer::Import(owner, filename, format); } @@ -2000,7 +2000,7 @@ void LyXFunc::setErrorMessage(string const & m) const } -void LyXFunc::setMessage(string const & m) const +void LyXFunc::setMessage(string const & m) const { dispatch_buffer = m; } @@ -2012,10 +2012,10 @@ void LyXFunc::setStatusMessage(string const & m) const } -void LyXFunc::initMiniBuffer() +void LyXFunc::initMiniBuffer() { string text = _("Welcome to LyX!"); - + // When meta-fake key is pressed, show the key sequence so far + "M-". if (wasMetaKey()) { text = keyseq.print(); @@ -2027,12 +2027,12 @@ void LyXFunc::initMiniBuffer() if (keyseq.length() > 0 && !keyseq.deleted()) { text = keyseq.printOptions(); } - + // Else, show the buffer state. else if (owner->view()->available()) { Buffer * tmpbuf = owner->buffer(); - - string const nicename = + + string const nicename = MakeDisplayPath(tmpbuf->fileName()); // Should we do this instead? (kindo like emacs) // leaves more room for other information @@ -2054,7 +2054,6 @@ void LyXFunc::initMiniBuffer() if (text != _("Welcome to LyX!")) // this is a hack text = _("* No document open *"); } - + owner->message(text); } - diff --git a/src/lyxfunc.h b/src/lyxfunc.h index 9cd6458def..ec8898c242 100644 --- a/src/lyxfunc.h +++ b/src/lyxfunc.h @@ -18,7 +18,7 @@ class LyXView; class LyXText; -/** This class encapsulates all the LyX command operations. +/** 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 keyboard or from the GUI. All GUI objects, including buttons and @@ -29,28 +29,28 @@ public: /// explicit LyXFunc(LyXView *); - + /// LyX dispatcher, executes lyx actions. string const dispatch(kb_action ac, string argument = string()); /// The same as dispatch, but also shows shortcuts and command - /// name in minibuffer if show_sc is true (more to come?) + /// name in minibuffer if show_sc is true (more to come?) void verboseDispatch(kb_action action, string const & argument, bool show_sc); - + /// Same as above, using a pseudoaction as argument void verboseDispatch(int ac, bool show_sc); /// Same as above, when the command is provided as a string void verboseDispatch(string const & s, bool show_sc); - /// + /// void miniDispatch(string const & s); /// void initMiniBuffer(); - + /// void processKeySym(KeySym k, unsigned int state); @@ -58,24 +58,24 @@ public: /// can contain the string argument. FuncStatus getStatus(int ac) const; /// - FuncStatus getStatus(kb_action action, + FuncStatus getStatus(kb_action action, string const & argument = string()) const; - + /// The last key was meta bool wasMetaKey() const; - /// True if lyxfunc reports an error - bool errorStat() const { return errorstat; } - /// Buffer to store result messages - void setMessage(string const & m) const; - /// Buffer to store result messages - void setErrorMessage(string const &) const; - /// Buffer to store result messages from getStatus - void setStatusMessage(string const &) const; - /// Buffer to store result messages - string const getMessage() const { return dispatch_buffer; } - /// Buffer to store result messages - string const getStatusMessage() const { return status_buffer; } + /// True if lyxfunc reports an error + bool errorStat() const { return errorstat; } + /// Buffer to store result messages + void setMessage(string const & m) const; + /// Buffer to store result messages + void setErrorMessage(string const &) const; + /// Buffer to store result messages from getStatus + void setStatusMessage(string const &) const; + /// Buffer to store result messages + string const getMessage() const { return dispatch_buffer; } + /// Buffer to store result messages + string const getStatusMessage() const { return status_buffer; } /// Handle a accented char keysequenze void handleKeyFunc(kb_action action); @@ -84,30 +84,30 @@ private: LyXView * owner; /// static int psd_idx; - /// - kb_sequence keyseq; - /// - kb_sequence cancel_meta_seq; + /// + kb_sequence keyseq; + /// + kb_sequence cancel_meta_seq; /// unsigned meta_fake_bit; /// void moveCursorUpdate(bool flag = true, bool selecting = false); /// void setupLocalKeymap(); - /// - kb_action lyx_dead_action; - /// - kb_action lyx_calling_dead_action; - /// Error status, only Dispatch can change this flag - mutable bool errorstat; + /// + kb_action lyx_dead_action; + /// + kb_action lyx_calling_dead_action; + /// Error status, only Dispatch can change this flag + mutable bool errorstat; - /** Buffer to store messages and result data. Is there a + /** Buffer to store messages and result data. Is there a good reason to have this one as static in Dispatch? (Ale) */ - mutable string dispatch_buffer; - /** Buffer to store messages and result data from getStatus + mutable string dispatch_buffer; + /** Buffer to store messages and result data from getStatus */ - mutable string status_buffer; + mutable string status_buffer; /// Command name and shortcut information string commandshortcut; @@ -132,15 +132,15 @@ private: LyXText * TEXT(bool) const; /// }; - - + + /*-------------------- inlines --------------------------*/ inline -bool LyXFunc::wasMetaKey() const -{ +bool LyXFunc::wasMetaKey() const +{ return (meta_fake_bit != 0); } - + #endif diff --git a/src/lyxgluelength.C b/src/lyxgluelength.C index d5add58afc..0469b8e735 100644 --- a/src/lyxgluelength.C +++ b/src/lyxgluelength.C @@ -2,7 +2,7 @@ * ====================================================== * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team. * @@ -58,7 +58,7 @@ string const LyXGlueLength::asString() const buffer << len_.value() << unit_name[len_.unit()] << "+-" << plus_.value() << unit_name[plus_.unit()]; - + else buffer << len_.value() << unit_name[len_.unit()] << '+' << plus_.value() @@ -73,13 +73,13 @@ string const LyXGlueLength::asString() const buffer << len_.value() << unit_name[len_.unit()] << '+' << plus_.value() << unit_name[plus_.unit()]; - + else if (!minus_.zero()) if (len_.unit() == minus_.unit()) buffer << len_.value() << '-' << minus_.value() << unit_name[len_.unit()]; - + else buffer << len_.value() << unit_name[len_.unit()] << '-' << minus_.value() @@ -139,8 +139,8 @@ LyXLength const & LyXGlueLength::minus() const bool operator==(LyXGlueLength const & l1, LyXGlueLength const & l2) { return l1.len() == l2.len() - && l1.plus() == l2.plus() - && l1.minus() == l2.minus(); + && l1.plus() == l2.plus() + && l1.minus() == l2.minus(); } diff --git a/src/lyxgluelength.h b/src/lyxgluelength.h index e392093cf0..aae56652eb 100644 --- a/src/lyxgluelength.h +++ b/src/lyxgluelength.h @@ -41,7 +41,7 @@ public: The traditional Latex format is also accepted, like 4cm plus 10pt minus 10pt */ explicit LyXGlueLength(string const & data); - + /// LyXLength const & len() const; /// diff --git a/src/lyxlayout.C b/src/lyxlayout.C index 0fd63445cc..130c128039 100644 --- a/src/lyxlayout.C +++ b/src/lyxlayout.C @@ -1,9 +1,8 @@ - /* This file is part of - * ====================================================== - * + * ====================================================== + * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team. * @@ -28,51 +27,51 @@ using std::endl; // The order of the LayoutTags enum is no more important. [asierra300396] // Tags indexes. enum LayoutTags { - LT_ALIGN = 1, - LT_ALIGNPOSSIBLE, - LT_MARGIN, - LT_BOTTOMSEP, - LT_COPYSTYLE, - LT_OBSOLETEDBY, + LT_ALIGN = 1, + LT_ALIGNPOSSIBLE, + LT_MARGIN, + LT_BOTTOMSEP, + LT_COPYSTYLE, + LT_OBSOLETEDBY, //LT_EMPTY, - LT_END, - //LT_ENVIRONMENT_DEFAULT, + LT_END, + //LT_ENVIRONMENT_DEFAULT, //LT_FANCYHDR, - LT_FILL_BOTTOM, - LT_FILL_TOP, + LT_FILL_BOTTOM, + LT_FILL_TOP, //LT_FIRST_COUNTER, - LT_FONT, - LT_FREE_SPACING, + LT_FONT, + LT_FREE_SPACING, LT_PASS_THRU, //LT_HEADINGS, - LT_ITEMSEP, - LT_KEEPEMPTY, - LT_LABEL_BOTTOMSEP, - LT_LABELFONT, + LT_ITEMSEP, + LT_KEEPEMPTY, + LT_LABEL_BOTTOMSEP, + LT_LABELFONT, LT_TEXTFONT, - LT_LABELINDENT, - LT_LABELSEP, - LT_LABELSTRING, - LT_LABELSTRING_APPENDIX, + LT_LABELINDENT, + LT_LABELSEP, + LT_LABELSTRING, + LT_LABELSTRING_APPENDIX, LT_LABELTYPE, LT_ENDLABELSTRING, LT_ENDLABELTYPE, - LT_LATEXNAME, - LT_LATEXPARAM, - LT_LATEXTYPE, - LT_LEFTMARGIN, - LT_NEED_PROTECT, - LT_NEWLINE, - LT_NEXTNOINDENT, - LT_PARINDENT, - LT_PARSEP, - LT_PARSKIP, + LT_LATEXNAME, + LT_LATEXPARAM, + LT_LATEXTYPE, + LT_LEFTMARGIN, + LT_NEED_PROTECT, + LT_NEWLINE, + LT_NEXTNOINDENT, + LT_PARINDENT, + LT_PARSEP, + LT_PARSKIP, //LT_PLAIN, - LT_PREAMBLE, - LT_RIGHTMARGIN, - LT_SPACING, - LT_TOPSEP, - LT_INTITLE + LT_PREAMBLE, + LT_RIGHTMARGIN, + LT_SPACING, + LT_TOPSEP, + LT_INTITLE }; ///////////////////// @@ -120,27 +119,27 @@ bool LyXLayout::Read (LyXLex & lexrc, LyXTextClass const & tclass) { "bottomsep", LT_BOTTOMSEP }, { "copystyle", LT_COPYSTYLE }, { "end", LT_END }, - { "endlabelstring", LT_ENDLABELSTRING }, - { "endlabeltype", LT_ENDLABELTYPE }, + { "endlabelstring", LT_ENDLABELSTRING }, + { "endlabeltype", LT_ENDLABELTYPE }, { "fill_bottom", LT_FILL_BOTTOM }, { "fill_top", LT_FILL_TOP }, - { "font", LT_FONT }, - { "freespacing", LT_FREE_SPACING }, + { "font", LT_FONT }, + { "freespacing", LT_FREE_SPACING }, { "intitle", LT_INTITLE }, - { "itemsep", LT_ITEMSEP }, + { "itemsep", LT_ITEMSEP }, { "keepempty", LT_KEEPEMPTY }, { "labelbottomsep", LT_LABEL_BOTTOMSEP }, - { "labelfont", LT_LABELFONT }, - { "labelindent", LT_LABELINDENT }, - { "labelsep", LT_LABELSEP }, - { "labelstring", LT_LABELSTRING }, + { "labelfont", LT_LABELFONT }, + { "labelindent", LT_LABELINDENT }, + { "labelsep", LT_LABELSEP }, + { "labelstring", LT_LABELSTRING }, { "labelstringappendix", LT_LABELSTRING_APPENDIX }, - { "labeltype", LT_LABELTYPE }, - { "latexname", LT_LATEXNAME }, + { "labeltype", LT_LABELTYPE }, + { "latexname", LT_LATEXNAME }, { "latexparam", LT_LATEXPARAM }, - { "latextype", LT_LATEXTYPE }, - { "leftmargin", LT_LEFTMARGIN }, - { "margin", LT_MARGIN }, + { "latextype", LT_LATEXTYPE }, + { "leftmargin", LT_LEFTMARGIN }, + { "margin", LT_MARGIN }, { "needprotect", LT_NEED_PROTECT }, { "newline", LT_NEWLINE }, { "nextnoindent", LT_NEXTNOINDENT }, @@ -148,7 +147,7 @@ bool LyXLayout::Read (LyXLex & lexrc, LyXTextClass const & tclass) { "parindent", LT_PARINDENT }, { "parsep", LT_PARSEP }, { "parskip", LT_PARSKIP }, - { "passthru", LT_PASS_THRU }, + { "passthru", LT_PASS_THRU }, { "preamble", LT_PREAMBLE }, { "rightmargin", LT_RIGHTMARGIN }, { "spacing", LT_SPACING }, @@ -165,12 +164,12 @@ bool LyXLayout::Read (LyXLex & lexrc, LyXTextClass const & tclass) // See comment in lyxrc.C. switch (le) { case LyXLex::LEX_FEOF: - continue; + continue; case LyXLex::LEX_UNDEF: // parse error lexrc.printError("Unknown layout tag `$$Token'"); error = true; - continue; + continue; default: break; } switch (static_cast(le)) { @@ -179,9 +178,9 @@ bool LyXLayout::Read (LyXLex & lexrc, LyXTextClass const & tclass) break; case LT_COPYSTYLE: // initialize with a known style - if (lexrc.next()) { + if (lexrc.next()) { string const style = lexrc.getString(); - + if (tclass.hasLayout(style)) { string const tmpname = name_; this->operator=(tclass[style]); @@ -194,7 +193,7 @@ bool LyXLayout::Read (LyXLex & lexrc, LyXTextClass const & tclass) for (; it != end; ++it) { lyxerr << it->name() << endl; } - + //lexrc.printError("Cannot copy known " // "style `$$Token'"); } @@ -202,9 +201,9 @@ bool LyXLayout::Read (LyXLex & lexrc, LyXTextClass const & tclass) break; case LT_OBSOLETEDBY: // replace with a known style - if (lexrc.next()) { + if (lexrc.next()) { string const style = lexrc.getString(); - + if (tclass.hasLayout(style)) { string const tmpname = name_; this->operator=(tclass[style]); @@ -213,8 +212,8 @@ bool LyXLayout::Read (LyXLex & lexrc, LyXTextClass const & tclass) obsoleted_by_ = style; } else { lyxerr << "Cannot replace with unknown style `" << style << "'" << endl; - - //lexrc.printError("Cannot replace with" + + //lexrc.printError("Cannot replace with" // " unknown style " // "`$$Token'"); } @@ -232,11 +231,11 @@ bool LyXLayout::Read (LyXLex & lexrc, LyXTextClass const & tclass) case LT_INTITLE: intitle = lexrc.next() && lexrc.getInteger(); break; - + case LT_NEED_PROTECT: needprotect = lexrc.next() && lexrc.getInteger(); break; - + case LT_KEEPEMPTY: keepempty = lexrc.next() && lexrc.getInteger(); break; @@ -262,10 +261,10 @@ bool LyXLayout::Read (LyXLex & lexrc, LyXTextClass const & tclass) break; case LT_LATEXNAME: - if (lexrc.next()) - latexname_ = lexrc.getString(); + if (lexrc.next()) + latexname_ = lexrc.getString(); break; - + case LT_LATEXPARAM: if (lexrc.next()) latexparam_ = lexrc.getString(); @@ -282,11 +281,11 @@ bool LyXLayout::Read (LyXLex & lexrc, LyXTextClass const & tclass) case LT_ENDLABELTYPE: readEndLabelType(lexrc); break; - + case LT_LEFTMARGIN: // left margin type - if (lexrc.next()) + if (lexrc.next()) leftmargin = lexrc.getString(); - break; + break; case LT_RIGHTMARGIN: // right margin type if (lexrc.next()) @@ -420,7 +419,7 @@ void LyXLayout::readAlign(LyXLex & lexrc) switch (le) { case LyXLex::LEX_UNDEF: lexrc.printError("Unknown alignment `$$Token'"); - return; + return; default: break; }; switch (static_cast(le)) { @@ -461,7 +460,7 @@ void LyXLayout::readAlignPossible(LyXLex & lexrc) switch (le) { case LyXLex::LEX_UNDEF: lexrc.printError("Unknown alignment `$$Token'"); - continue; + continue; default: break; }; switch (static_cast(le)) { @@ -534,7 +533,7 @@ void LyXLayout::readLabelType(LyXLex & lexrc) switch (le) { case LyXLex::LEX_UNDEF: lexrc.printError("Unknown labeltype tag `$$Token'"); - return; + return; default: break; } switch (static_cast(le)) { diff --git a/src/lyxlayout.h b/src/lyxlayout.h index d0f79c7b96..ff6d1446f5 100644 --- a/src/lyxlayout.h +++ b/src/lyxlayout.h @@ -1,9 +1,9 @@ // -*- C++ -*- /* This file is part of * ====================================================== - * + * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team. * @@ -173,7 +173,7 @@ public: return latextype == LATEX_PARAGRAPH; } /// - bool isCommand() const { + bool isCommand() const { return latextype == LATEX_COMMAND; } /// @@ -192,7 +192,7 @@ private: /** Name of an layout that has replaced this layout. This is used to rename a layout, while keeping backward - compatibility + compatibility */ string obsoleted_by_; diff --git a/src/lyxlength.C b/src/lyxlength.C index 7eb622220c..1067ac7a75 100644 --- a/src/lyxlength.C +++ b/src/lyxlength.C @@ -2,7 +2,7 @@ * ====================================================== * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team. * @@ -37,7 +37,7 @@ LyXLength::LyXLength(string const & data) : val_(0), unit_(LyXLength::PT) { LyXLength tmp; - + if (!isValidLength (data, &tmp)) return; // should raise an exception @@ -106,7 +106,7 @@ void LyXLength::unit(LyXLength::UNIT u) } -bool LyXLength::zero() const +bool LyXLength::zero() const { return val_ == 0.0; } @@ -128,7 +128,7 @@ int LyXLength::inPixels(int default_width, int default_height) const // display negative space with text too double result = 0.0; int val_sign = val_ < 0.0 ? -1 : 1; - + switch (unit_) { case LyXLength::SP: // Scaled point: sp = 1/65536 pt @@ -210,4 +210,3 @@ bool operator!=(LyXLength const & l1, LyXLength const & l2) { return !(l1 == l2); } - diff --git a/src/lyxlex.C b/src/lyxlex.C index 86ec37b86b..118162bdc1 100644 --- a/src/lyxlex.C +++ b/src/lyxlex.C @@ -1,6 +1,6 @@ /* This file is part of - * ====================================================== - * + * ====================================================== + * * LyX, The Document Processor * * Copyright 1996-2001 The LyX Team. @@ -33,7 +33,7 @@ LyXLex::LyXLex(keyword_item * tab, int num) {} -LyXLex::~LyXLex() +LyXLex::~LyXLex() { delete pimpl_; } @@ -131,7 +131,7 @@ float LyXLex::getFloat() const { // replace comma with dot in case the file was written with // the wrong locale (should be rare, but is easy enough to - // avoid). + // avoid). string str = subst(pimpl_->getString(), ",", "."); if (isStrDbl(str)) return strToDbl(str); @@ -150,7 +150,7 @@ string const LyXLex::getString() const // I would prefer to give a tag number instead of an explicit token // here, but it is not possible because Buffer::readLyXformat2 uses -// explicit tokens (JMarc) +// explicit tokens (JMarc) string const LyXLex::getLongString(string const & endtoken) { string str, prefix; @@ -160,15 +160,15 @@ string const LyXLex::getLongString(string const & endtoken) if (!eatLine()) // blank line in the file being read continue; - + string const token = frontStrip(strip(getString()), " \t"); - + lyxerr[Debug::PARSER] << "LongString: `" << getString() << '\'' << endl; // We do a case independent comparison, like search_kw // does. - if (compare_no_case(token, endtoken) != 0) { + if (compare_no_case(token, endtoken) != 0) { string tmpstr = getString(); if (firstline) { unsigned int i = 0; @@ -180,14 +180,14 @@ string const LyXLex::getLongString(string const & endtoken) firstline = false; lyxerr[Debug::PARSER] << "Prefix = `" << prefix << '\'' << endl; - } + } - if (!prefix.empty() + if (!prefix.empty() && prefixIs(tmpstr, prefix)) { tmpstr.erase(0, prefix.length() - 1); } str += frontStrip(tmpstr, "\t") + '\n'; - } + } else // token == endtoken break; } @@ -237,7 +237,7 @@ void LyXLex::pushToken(string const & pt) int LyXLex::findToken(char const * str[]) { int i = 0; - + if (next()) { if (compare(pimpl_->buff, "default")) { while (str[i][0] && compare(str[i], pimpl_->buff)) { diff --git a/src/lyxlex.h b/src/lyxlex.h index f884ccd8eb..143a88d087 100644 --- a/src/lyxlex.h +++ b/src/lyxlex.h @@ -29,13 +29,13 @@ struct keyword_item { texclass and others to come. @see lyxrc.C for an example of usage. */ -class LyXLex : boost::noncopyable { +class LyXLex : boost::noncopyable { public: /// LyXLex (keyword_item *, int); /// ~LyXLex(); - + /// Lex basic codes enum { /// @@ -76,10 +76,10 @@ public: bool nextToken(); /// Push a token, that next token got from lyxlex. void pushToken(string const &); - - /// + + /// int getLineNo() const; - + /// int getInteger() const; /// @@ -88,7 +88,7 @@ public: float getFloat() const; /// string const getString() const; - + /** Get a long string, ended by the tag `endtag'. This string can span several lines. The first line serves as a template for how many spaces the lines @@ -97,7 +97,7 @@ public: perfectly if you use tabs. */ string const getLongString(string const & endtag); - + /// bool eatLine(); /// @@ -109,7 +109,7 @@ public: /** Pushes a token list on a stack and replaces it with a new one. */ void pushTable(keyword_item *, int); - + /** Pops a token list into void and replaces it with the one now on top of the stack. */ diff --git a/src/lyxlex_pimpl.C b/src/lyxlex_pimpl.C index fd4cb586a7..3156c864da 100644 --- a/src/lyxlex_pimpl.C +++ b/src/lyxlex_pimpl.C @@ -32,7 +32,7 @@ struct compare_tags { // } // end of anon namespace -LyXLex::Pimpl::Pimpl(keyword_item * tab, int num) +LyXLex::Pimpl::Pimpl(keyword_item * tab, int num) : is(&fb__), table(tab), no_items(num), status(0), lineno(0), commentChar('#') { @@ -53,7 +53,7 @@ void LyXLex::Pimpl::printError(string const & message) const << " of file " << MakeDisplayPath(name) << ']' << endl; } - + void LyXLex::Pimpl::printTable(ostream & os) { os << "\nNumber of tags: " << no_items << '\n'; @@ -94,14 +94,14 @@ void LyXLex::Pimpl::pushTable(keyword_item * tab, int num) verifyTable(); } - + void LyXLex::Pimpl::popTable() { if (pushed.empty()) { lyxerr << "LyXLex error: nothing to pop!" << endl; return; } - + pushed_table tmp = pushed.top(); pushed.pop(); table = tmp.table_elem; @@ -124,7 +124,7 @@ bool LyXLex::Pimpl::setFile(string const & filename) return fb__.is_open() && is.good(); } - + void LyXLex::Pimpl::setStream(istream & i) { if (fb__.is_open() || is.tellg() > 0) @@ -157,7 +157,7 @@ bool LyXLex::Pimpl::next(bool esc /* = false */) buff[pushTok.length()] = '\0'; pushTok.erase(); return true; - } + } } if (!esc) { unsigned char c = 0; // getc() returns an int @@ -180,7 +180,7 @@ bool LyXLex::Pimpl::next(bool esc /* = false */) ++lineno; continue; } - + if (c == '\"') { int i = -1; do { @@ -190,27 +190,27 @@ bool LyXLex::Pimpl::next(bool esc /* = false */) buff[++i] = c; } while (c != '\"' && c != '\n' && is && i != (LEX_MAX_BUFF - 2)); - + if (i == (LEX_MAX_BUFF - 2)) { printError("Line too long"); c = '\"'; // Pretend we got a " ++i; } - + if (c != '\"') { printError("Missing quote"); if (c == '\n') ++lineno; } - + buff[i] = '\0'; status = LEX_DATA; - break; + break; } - + if (c == ',') continue; /* Skip ','s */ - + // using relational operators with chars other // than == and != is not safe. And if it is done // the type _have_ to be unsigned. It usually a @@ -229,7 +229,7 @@ bool LyXLex::Pimpl::next(bool esc /* = false */) buff[i] = '\0'; status = LEX_TOKEN; } - + if (c == '\r' && is) { // The Windows support has lead to the // possibility of "\r\n" at the end of @@ -238,28 +238,28 @@ bool LyXLex::Pimpl::next(bool esc /* = false */) is.get(cc); c = cc; } - + if (c == '\n') ++lineno; - + } if (status) return true; - + status = is.eof() ? LEX_FEOF: LEX_UNDEF; buff[0] = '\0'; return false; } else { unsigned char c = 0; // getc() returns an int char cc = 0; - + status = 0; while (is && !status) { is.get(cc); c = cc; - + // skip ','s if (c == ',') continue; - + if (c == '\\') { // escape int i = 0; @@ -281,7 +281,7 @@ bool LyXLex::Pimpl::next(bool esc /* = false */) status = LEX_TOKEN; continue; } - + if (c == commentChar) { // Read rest of line (fast :-) // That is still not fast... (Lgb) @@ -297,7 +297,7 @@ bool LyXLex::Pimpl::next(bool esc /* = false */) ++lineno; continue; } - + // string if (c == '\"') { int i = -1; @@ -317,28 +317,28 @@ bool LyXLex::Pimpl::next(bool esc /* = false */) buff[++i] = '\\'; } buff[++i] = c; - + if (!escaped && c == '\"') break; } while (c != '\n' && is && i != (LEX_MAX_BUFF - 2)); - + if (i == (LEX_MAX_BUFF - 2)) { printError("Line too long"); c = '\"'; // Pretend we got a " ++i; } - + if (c != '\"') { printError("Missing quote"); if (c == '\n') ++lineno; } - + buff[i] = '\0'; status = LEX_DATA; - break; + break; } - + if (c > ' ' && is) { int i = 0; do { @@ -363,9 +363,9 @@ bool LyXLex::Pimpl::next(bool esc /* = false */) if (c == '\n') ++lineno; } - + if (status) return true; - + status = is.eof() ? LEX_FEOF : LEX_UNDEF; buff[0] = '\0'; return false; @@ -395,7 +395,7 @@ int LyXLex::Pimpl::lex() return status; } - + bool LyXLex::Pimpl::eatLine() { int i = 0; @@ -470,22 +470,22 @@ bool LyXLex::Pimpl::nextToken() } while (c >= ' ' && c != '\\' && is && i != (LEX_MAX_BUFF-1)); } - + if (i == (LEX_MAX_BUFF - 1)) { printError("Line too long"); } - + if (c == '\\') is.putback(c); // put it back buff[i] = '\0'; status = LEX_TOKEN; } - + if (c == '\n') ++lineno; - + } if (status) return true; - + status = is.eof() ? LEX_FEOF: LEX_UNDEF; buff[0] = '\0'; return false; diff --git a/src/lyxlex_pimpl.h b/src/lyxlex_pimpl.h index 9aecd59bd3..1f63abc111 100644 --- a/src/lyxlex_pimpl.h +++ b/src/lyxlex_pimpl.h @@ -20,7 +20,7 @@ struct LyXLex::Pimpl : boost::noncopyable { /// LEX_MAX_BUFF = 2048 }; - + /// Pimpl(keyword_item * tab, int num); /// @@ -55,7 +55,7 @@ struct LyXLex::Pimpl : boost::noncopyable { std::filebuf fb__; /// the stream that we use. std::istream is; - /// + /// string name; /// keyword_item * table; diff --git a/src/lyxlookup.C b/src/lyxlookup.C index 9fc627f957..228e1920c6 100644 --- a/src/lyxlookup.C +++ b/src/lyxlookup.C @@ -1,9 +1,9 @@ /* This file is part of - * ====================================================== - * + * ====================================================== + * * LyX, The Document Processor - * - * Copyright 1995 Matthias Ettrich + * + * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX team. * * ====================================================== */ @@ -41,7 +41,7 @@ XComposeStatus compose_status= {0, 0}; // This is called after the main LyX window has been created -void InitLyXLookup(Display * display, Window window) +void InitLyXLookup(Display * display, Window window) { xic = 0; @@ -52,7 +52,7 @@ void InitLyXLookup(Display * display, Window window) // This part could be done before opening display string oldlocale = setlocale(LC_CTYPE, 0); setlocale(LC_CTYPE, ""); - if (!XSupportsLocale()) { + if (!XSupportsLocale()) { lyxerr[Debug::KEY] << "InitLyXLookup: X does not support this locale." << endl; @@ -60,7 +60,7 @@ void InitLyXLookup(Display * display, Window window) } // reset the LC_CTYPE locale to previous value. setlocale(LC_CTYPE, oldlocale.c_str()); - + char const * locmod; if (!(locmod = XSetLocaleModifiers(""))) { lyxerr[Debug::KEY] << "InitLyXLookup: Could not set modifiers " @@ -70,7 +70,7 @@ void InitLyXLookup(Display * display, Window window) else lyxerr[Debug::KEY] << "InitLyXLookup: X locale modifiers are `" << locmod << '\'' << endl; - + // This part will have to be done for each frame xim = XOpenIM (display, 0, 0, 0); if (xim) { @@ -78,17 +78,17 @@ void InitLyXLookup(Display * display, Window window) XNInputStyle, XIMPreeditNothing|XIMStatusNothing, XNClientWindow, window, - XNFocusWindow, window, + XNFocusWindow, window, 0); - + if (!xic) { lyxerr[Debug::KEY] << "InitLyXLookup: " "could not create an input context" << endl; XCloseIM (xim); xim = 0; - } + } } - else + else lyxerr[Debug::KEY] << "InitLyXLookup: could not open " "an input method." << endl; } @@ -162,16 +162,16 @@ bool isDeadEvent(KeySym keysym) // This is called instead of XLookupString() -int LyXLookupString(XEvent * event, +int LyXLookupString(XEvent * event, char * buffer_return, int bytes_buffer, - KeySym * keysym_return) + KeySym * keysym_return) { if (event->type != KeyPress) { lyxerr << "LyXLookupString: wrong event type: " << event->type << endl; return 0; } - + int result = 0; if (xic) { #if 1 @@ -179,10 +179,10 @@ int LyXLookupString(XEvent * event, XLookupString(&event->xkey, buffer_return, bytes_buffer, keysym_return, 0); - + if (lyxrc.override_x_deadkeys && isDeadEvent(*keysym_return)) { - lyxerr[Debug::KEY] + lyxerr[Debug::KEY] << "LyXLookupString: found DeadEvent" << endl; return 0; } @@ -191,11 +191,11 @@ int LyXLookupString(XEvent * event, if (XFilterEvent (event, None)) { lyxerr[Debug::KEY] <<"XFilterEvent" << endl; *keysym_return = NoSymbol; - return 0; + return 0; } #endif Status status_return = 0; - + result = XmbLookupString(xic, &event->xkey, buffer_return, bytes_buffer, keysym_return, &status_return); @@ -212,7 +212,7 @@ int LyXLookupString(XEvent * event, lyxerr[Debug::KEY] << "XLookupChars " << string(buffer_return, result) << endl; - + *keysym_return = NoSymbol; break; case XLookupKeySym: @@ -239,7 +239,7 @@ int LyXLookupString(XEvent * event, // This is called after the main window has been destroyed -void CloseLyXLookup() +void CloseLyXLookup() { if (xic) { lyxerr[Debug::KEY] << "CloseLyXLookup: destroying input context" @@ -259,16 +259,16 @@ void CloseLyXLookup() XComposeStatus compose_status= {0, 0}; // This is called after the main LyX window has been created -void InitLyXLookup(Display *, Window) +void InitLyXLookup(Display *, Window) { //Nothing to do. } // This is called instead of XLookupString(). I this particular case, // this *is* XLookupString... -int LyXLookupString(XEvent * event, +int LyXLookupString(XEvent * event, char * buffer_return, int bytes_buffer, - KeySym * keysym_return) + KeySym * keysym_return) { return XLookupString(&event->xkey, buffer_return, bytes_buffer, keysym_return, @@ -276,10 +276,9 @@ int LyXLookupString(XEvent * event, } // This is called after the main window has been destroyed -void CloseLyXLookup() +void CloseLyXLookup() { // Nothing to do } #endif // HAVE_XOPENIM - diff --git a/src/lyxlookup.h b/src/lyxlookup.h index 145b5a3c1e..7eadbdf7b3 100644 --- a/src/lyxlookup.h +++ b/src/lyxlookup.h @@ -1,9 +1,9 @@ /* This file is part of -*- C++ -*- -* ====================================================== -* +* ====================================================== +* * LyX, The Document Processor -* -* Copyright 1995 Matthias Ettrich +* +* Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team. * * ====================================================== */ @@ -21,7 +21,7 @@ extern void InitLyXLookup(Display *, Window); /// Read a keysym and/or a string (like XLookupString) -extern int LyXLookupString(XEvent * event, +extern int LyXLookupString(XEvent * event, char * buffer_return, int bytes_buffer, KeySym * keysym_return); diff --git a/src/lyxrc.C b/src/lyxrc.C index 95f463fe8f..3831760b44 100644 --- a/src/lyxrc.C +++ b/src/lyxrc.C @@ -1,8 +1,8 @@ /* This file is part of * ====================================================== - * + * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team. * @@ -105,8 +105,8 @@ keyword_item lyxrcTags[] = { { "\\print_landscape_flag", LyXRC::RC_PRINTLANDSCAPEFLAG }, { "\\print_oddpage_flag", LyXRC::RC_PRINTODDPAGEFLAG }, { "\\print_pagerange_flag", LyXRC::RC_PRINTPAGERANGEFLAG }, - { "\\print_paper_dimension_flag", LyXRC::RC_PRINTPAPERDIMENSIONFLAG }, - { "\\print_paper_flag", LyXRC::RC_PRINTPAPERFLAG }, + { "\\print_paper_dimension_flag", LyXRC::RC_PRINTPAPERDIMENSIONFLAG }, + { "\\print_paper_flag", LyXRC::RC_PRINTPAPERFLAG }, { "\\print_reverse_flag", LyXRC::RC_PRINTREVERSEFLAG }, { "\\print_spool_command", LyXRC::RC_PRINTSPOOL_COMMAND }, { "\\print_spool_printerprefix", LyXRC::RC_PRINTSPOOL_PRINTERPREFIX }, @@ -145,7 +145,7 @@ keyword_item lyxrcTags[] = { #endif { "\\use_tempdir", LyXRC::RC_USETEMPDIR }, { "\\view_dvi_paper_option", LyXRC::RC_VIEWDVI_PAPEROPTION }, - { "\\viewer" ,LyXRC::RC_VIEWER}, + { "\\viewer" ,LyXRC::RC_VIEWER}, { "\\wheel_jump", LyXRC::RC_WHEEL_JUMP } }; @@ -155,7 +155,7 @@ const int lyxrcCount = sizeof(lyxrcTags) / sizeof(keyword_item); } // namespace anon -LyXRC::LyXRC() +LyXRC::LyXRC() { setDefaults(); } @@ -228,7 +228,7 @@ void LyXRC::setDefaults() { display_graphics = "color"; display_shortcuts = true; // Spellchecker settings: -#ifdef USE_PSPELL +#ifdef USE_PSPELL use_pspell = true; #endif isp_command = "ispell"; @@ -286,16 +286,16 @@ void LyXRC::readBindFileIfNeeded() int LyXRC::read(string const & filename) -{ +{ LyXLex lexrc(lyxrcTags, lyxrcCount); if (lyxerr.debugging(Debug::PARSER)) lexrc.printTable(lyxerr); - + lexrc.setFile(filename); if (!lexrc.isOK()) return -2; - + lyxerr[Debug::LYXRC] << "Reading '" << filename << "'..." << endl; - + while (lexrc.isOK()) { // By using two switches we take advantage of the compiler // telling us if we have missed a LyXRCTags element in @@ -308,17 +308,17 @@ int LyXRC::read(string const & filename) switch (le) { case LyXLex::LEX_UNDEF: lexrc.printError("Unknown tag `$$Token'"); - continue; + continue; case LyXLex::LEX_FEOF: - continue; + continue; default: break; } switch (static_cast(le)) { case RC_INPUT: // Include file - if (lexrc.next()) { + if (lexrc.next()) { string const tmp = LibFileSearch(string(), - lexrc.getString()); + lexrc.getString()); if (read(tmp)) { lexrc.printError("Error reading " "included file: "+tmp); @@ -340,18 +340,18 @@ int LyXRC::read(string const & filename) bind_file = tmp; } break; - - case RC_UIFILE: + + case RC_UIFILE: if (lexrc.next()) { ui_file = lexrc.getString(); } break; - + case RC_EXIT_CONFIRMATION: if (lexrc.next()) exit_confirmation = lexrc.getBool(); break; - + case RC_AUTORESET_OPTIONS: if (lexrc.next()) auto_reset_options = lexrc.getBool(); @@ -371,162 +371,162 @@ int LyXRC::read(string const & filename) if (lexrc.next()) use_kbmap = lexrc.getBool(); break; - + case RC_KBMAP_PRIMARY: if (lexrc.next()) { string const kmap(lexrc.getString()); if (kmap.empty()) { // nothing - } else if (!LibFileSearch("kbd", kmap, - "kmap").empty()) + } else if (!LibFileSearch("kbd", kmap, + "kmap").empty()) primary_kbmap = kmap; - else + else lexrc.printError("LyX: Keymap `$$Token' not found"); } break; - + case RC_KBMAP_SECONDARY: if (lexrc.next()) { string const kmap(lexrc.getString()); if (kmap.empty()) { // nothing - } else if (!LibFileSearch("kbd", kmap, - "kmap").empty()) + } else if (!LibFileSearch("kbd", kmap, + "kmap").empty()) secondary_kbmap = kmap; - else + else lexrc.printError("LyX: Keymap `$$Token' not found"); } break; - + case RC_FONT_ENCODING: if (lexrc.next()) fontenc = lexrc.getString(); break; - + case RC_PRINTER: if (lexrc.next()) printer = lexrc.getString(); break; - + case RC_PRINT_COMMAND: if (lexrc.next()) print_command = lexrc.getString(); break; - + case RC_PRINTEVENPAGEFLAG: if (lexrc.next()) print_evenpage_flag = lexrc.getString(); break; - + case RC_PRINTODDPAGEFLAG: if (lexrc.next()) print_oddpage_flag = lexrc.getString(); break; - + case RC_PRINTPAGERANGEFLAG: if (lexrc.next()) print_pagerange_flag = lexrc.getString(); break; - + case RC_PRINTCOPIESFLAG: if (lexrc.next()) print_copies_flag = lexrc.getString(); break; - + case RC_PRINTCOLLCOPIESFLAG: if (lexrc.next()) print_collcopies_flag = lexrc.getString(); break; - + case RC_PRINTREVERSEFLAG: if (lexrc.next()) print_reverse_flag = lexrc.getString(); break; - + case RC_PRINTLANDSCAPEFLAG: if (lexrc.next()) print_landscape_flag = lexrc.getString(); break; - + case RC_PRINTTOPRINTER: if (lexrc.next()) print_to_printer = lexrc.getString(); break; - + case RC_PRINT_ADAPTOUTPUT: if (lexrc.next()) print_adapt_output = lexrc.getBool(); break; - + case RC_PRINTTOFILE: if (lexrc.next()) print_to_file = lexrc.getString(); break; - + case RC_PRINTFILEEXTENSION: if (lexrc.next()) print_file_extension = lexrc.getString(); break; - + case RC_PRINTEXSTRAOPTIONS: if (lexrc.next()) print_extra_options = lexrc.getString(); break; - + case RC_PRINTSPOOL_COMMAND: if (lexrc.next()) print_spool_command = lexrc.getString(); break; - + case RC_PRINTSPOOL_PRINTERPREFIX: if (lexrc.next()) print_spool_printerprefix = lexrc.getString(); break; - - case RC_PRINTPAPERDIMENSIONFLAG: + + case RC_PRINTPAPERDIMENSIONFLAG: if (lexrc.next()) print_paper_dimension_flag = lexrc.getString(); break; - - case RC_PRINTPAPERFLAG: + + case RC_PRINTPAPERFLAG: if (lexrc.next()) print_paper_flag = lexrc.getString(); break; - + case RC_CUSTOM_EXPORT_COMMAND: if (lexrc.next()) custom_export_command = lexrc.getString(); break; - + case RC_CUSTOM_EXPORT_FORMAT: if (lexrc.next()) custom_export_format = lexrc.getString(); break; case RC_DEFAULT_PAPERSIZE: - if (lexrc.next()) { - string const size = + if (lexrc.next()) { + string const size = lowercase(lexrc.getString()); if (size == "usletter") - default_papersize = + default_papersize = BufferParams::PAPER_USLETTER; else if (size == "legal") - default_papersize = + default_papersize = BufferParams::PAPER_LEGALPAPER; else if (size == "executive") - default_papersize = + default_papersize = BufferParams::PAPER_EXECUTIVEPAPER; else if (size == "a3") - default_papersize = + default_papersize = BufferParams::PAPER_A3PAPER; else if (size == "a4") - default_papersize = + default_papersize = BufferParams::PAPER_A4PAPER; else if (size == "a5") - default_papersize = + default_papersize = BufferParams::PAPER_A5PAPER; else if (size == "b5") - default_papersize = + default_papersize = BufferParams::PAPER_B5PAPER; } break; @@ -534,7 +534,7 @@ int LyXRC::read(string const & filename) case RC_VIEWDVI_PAPEROPTION: if (lexrc.next()) view_dvi_paper_option = lexrc.getString(); - else + else view_dvi_paper_option.erase(); break; @@ -542,17 +542,17 @@ int LyXRC::read(string const & filename) if (lexrc.next()) ps_command = lexrc.getString(); break; - + case RC_CHKTEX_COMMAND: if (lexrc.next()) chktex_command = lexrc.getString(); break; - + case RC_SCREEN_DPI: if (lexrc.next()) dpi = lexrc.getInteger(); break; - + case RC_SCREEN_ZOOM: if (lexrc.next()) zoom = lexrc.getInteger(); @@ -562,7 +562,7 @@ int LyXRC::read(string const & filename) if (lexrc.next()) wheel_jump = lexrc.getInteger(); break; - + case RC_SCREEN_FONT_SIZES: if (lexrc.next()) font_sizes[LyXFont::SIZE_TINY] = @@ -595,68 +595,68 @@ int LyXRC::read(string const & filename) font_sizes[LyXFont::SIZE_HUGER] = lexrc.getFloat(); break; - - case RC_SCREEN_FONT_SCALABLE: - if (lexrc.next()) - use_scalable_fonts = lexrc.getBool(); + + case RC_SCREEN_FONT_SCALABLE: + if (lexrc.next()) + use_scalable_fonts = lexrc.getBool(); break; - + case RC_AUTOSAVE: if (lexrc.next()) autosave = lexrc.getInteger(); break; - + case RC_DOCUMENTPATH: if (lexrc.next()) { document_path = ExpandPath(lexrc.getString()); } break; - + case RC_TEMPLATEPATH: if (lexrc.next()) template_path = ExpandPath(lexrc.getString()); break; - + case RC_TEMPDIRPATH: if (lexrc.next()) tempdir_path = ExpandPath(lexrc.getString()); break; - + case RC_USETEMPDIR: if (lexrc.next()) use_tempdir = lexrc.getBool(); break; - + case RC_LASTFILES: if (lexrc.next()) lastfiles = ExpandPath(lexrc.getString()); break; - - case RC_NUMLASTFILES: - if (lexrc.next()) - num_lastfiles = lexrc.getInteger(); + + case RC_NUMLASTFILES: + if (lexrc.next()) + num_lastfiles = lexrc.getInteger(); break; - - case RC_CHECKLASTFILES: - if (lexrc.next()) - check_lastfiles = lexrc.getBool(); + + case RC_CHECKLASTFILES: + if (lexrc.next()) + check_lastfiles = lexrc.getBool(); break; - + case RC_SCREEN_FONT_ROMAN: if (lexrc.next()) roman_font_name = lexrc.getString(); break; - + case RC_SCREEN_FONT_SANS: if (lexrc.next()) sans_font_name = lexrc.getString(); break; - + case RC_SCREEN_FONT_TYPEWRITER: if (lexrc.next()) typewriter_font_name = lexrc.getString(); break; - + case RC_SCREEN_FONT_ENCODING: if (lexrc.next()) { font_norm = lexrc.getString(); @@ -668,12 +668,12 @@ int LyXRC::read(string const & filename) if (lexrc.next()) popup_bold_font = lexrc.getString(); break; - + case RC_POPUP_NORMAL_FONT: if (lexrc.next()) popup_normal_font = lexrc.getString(); break; - + case RC_POPUP_FONT_ENCODING: if (lexrc.next()) popup_font_encoding = lexrc.getString(); @@ -689,7 +689,7 @@ int LyXRC::read(string const & filename) lexrc.printError("Missing color tag."); break; } - + if (lexrc.next()) { x11_name = lexrc.getString(); } else { @@ -705,10 +705,10 @@ int LyXRC::read(string const & filename) } case RC_AUTOREGIONDELETE: // Auto region delete defaults to true - if (lexrc.next()) - auto_region_delete = lexrc.getBool(); + if (lexrc.next()) + auto_region_delete = lexrc.getBool(); break; - + case RC_BIND: { // we should not do an explicit binding before @@ -720,21 +720,21 @@ int LyXRC::read(string const & filename) int action = 0; string::size_type res = 0; string seq, cmd; - + if (lexrc.next()) { seq = lexrc.getString(); } else { lexrc.printError("RC_BIND: Missing key sequence"); break; } - + if (lexrc.next(true)) { cmd = lexrc.getString(); } else { lexrc.printError("RC_BIND: missing command"); break; } - + if ((action = lyxaction.LookupFunc(cmd))>= 0) { if (lyxerr.debugging(Debug::LYXRC)) { lyxerr << "RC_BIND: Sequence `" @@ -748,7 +748,7 @@ int LyXRC::read(string const & filename) lexrc.printError( "RC_BIND: " "Invalid key sequence `" - + seq + '\''); + + seq + '\''); } } else {// cmd is the last token read. lexrc.printError( @@ -765,7 +765,7 @@ int LyXRC::read(string const & filename) if (lexrc.next()) lyxpipes = ExpandPath(lexrc.getString()); break; - + case RC_CURSOR_FOLLOWS_SCROLLBAR: if (lexrc.next()) cursor_follows_scrollbar = lexrc.getBool(); @@ -777,7 +777,7 @@ int LyXRC::read(string const & filename) break; case RC_ASCIIROFF_COMMAND: - if (lexrc.next()) + if (lexrc.next()) ascii_roff_command = lexrc.getString(); break; case RC_ASCII_LINELEN: @@ -828,8 +828,8 @@ int LyXRC::read(string const & filename) isp_esc_chars = lexrc.getString(); break; case RC_MAKE_BACKUP: - if (lexrc.next()) - make_backup = lexrc.getBool(); + if (lexrc.next()) + make_backup = lexrc.getBool(); break; case RC_BACKUPDIR_PATH: if (lexrc.next()) @@ -887,7 +887,7 @@ int LyXRC::read(string const & filename) if (lexrc.next()) show_banner = lexrc.getBool(); break; - + case RC_NEW_ASK_FILENAME: if (lexrc.next()) new_ask_filename = lexrc.getBool(); @@ -992,7 +992,7 @@ void LyXRC::output(ostream & os) const << "# This file is written by LyX, if you want to make your own\n" << "# modifications you should do them from inside LyX and save\n" << "\n"; - + // Why the switch you might ask. It is a trick to ensure that all // the elements in the LyXRCTags enum is handled. As you can see // there are no breaks at all. So it is just a huge fall-through. @@ -1015,7 +1015,7 @@ void LyXRC::output(ostream & os) const os << "\n#\n" << "# MISC SECTION ######################################\n" << "#\n\n"; - + case RC_SHOW_BANNER: if (show_banner != system_lyxrc.show_banner) { os << "# Set to false to inhibit the startup banner.\n" @@ -1059,16 +1059,16 @@ void LyXRC::output(ostream & os) const << "\\display_graphics " << display_graphics << "\n"; } - + case RC_DISPLAY_SHORTCUTS: if (display_shortcuts != system_lyxrc.display_shortcuts) { os << "# Display name of the last command executed,\n" - << "# with a list of short-cuts in the minibuffer.\n" + << "# with a list of short-cuts in the minibuffer.\n" << "\\display_shortcuts " << tostr(display_shortcuts) << "\n"; } case RC_VIEWDVI_PAPEROPTION: - if (view_dvi_paper_option + if (view_dvi_paper_option != system_lyxrc.view_dvi_paper_option) { os << "# Options used to specify paper size to the\n" << "# view_dvi_command (e.g. -paper)\n" @@ -1138,7 +1138,7 @@ void LyXRC::output(ostream & os) const os << "\n#\n" << "# SCREEN & FONTS SECTION ############################\n" << "#\n\n"; - + case RC_POPUP_NORMAL_FONT: if (popup_normal_font != system_lyxrc.popup_normal_font) { os << "\\popup_normal_font \"" << popup_normal_font @@ -1240,15 +1240,15 @@ void LyXRC::output(ostream & os) const << " " << font_sizes[LyXFont::SIZE_HUGER] << "\n"; } - + os << "\n#\n" << "# COLOR SECTION ###################################\n" << "#\n\n"; - + case RC_SET_COLOR: for (int i = 0; i < LColor::ignore; ++i) { LColor::color lc = static_cast(i); - + string const col(lcolor.getX11Name(lc)); if (col != system_lcolor.getX11Name(lc)) { os << "\\set_color \"" @@ -1256,11 +1256,11 @@ void LyXRC::output(ostream & os) const << col << "\"\n"; } } - + os << "\n#\n" << "# PRINTER SECTION ###################################\n" << "#\n\n"; - + case RC_PRINTER: if (printer != system_lyxrc.printer) { os << "\\printer \"" << printer << "\"\n"; @@ -1318,7 +1318,7 @@ void LyXRC::output(ostream & os) const } case RC_PRINTCOPIESFLAG: if (print_copies_flag != system_lyxrc.print_copies_flag) { - os << "\\print_copies_flag \"" << print_copies_flag + os << "\\print_copies_flag \"" << print_copies_flag << "\"\n"; } case RC_PRINTCOLLCOPIESFLAG: @@ -1358,7 +1358,7 @@ void LyXRC::output(ostream & os) const os << "\n#\n" << "# EXPORT SECTION ####################################\n" << "#\n\n"; - + case RC_CUSTOM_EXPORT_COMMAND: if (custom_export_command != system_lyxrc.custom_export_command) { @@ -1376,7 +1376,7 @@ void LyXRC::output(ostream & os) const os << "\n#\n" << "# TEX SECTION #######################################\n" << "#\n\n"; - + case RC_FONT_ENCODING: if (fontenc != system_lyxrc.fontenc) { os << "\\font_encoding \"" << fontenc << "\"\n"; @@ -1542,12 +1542,12 @@ void LyXRC::output(ostream & os) const } case RC_LANGUAGE_AUTO_BEGIN: if (language_auto_begin != system_lyxrc.language_auto_begin) { - os << "\\language_auto_begin " + os << "\\language_auto_begin " << tostr(language_auto_begin) << "\n"; } case RC_LANGUAGE_AUTO_END: if (language_auto_end != system_lyxrc.language_auto_end) { - os << "\\language_auto_end " + os << "\\language_auto_end " << tostr(language_auto_end) << "\n"; } case RC_MARK_FOREIGN_LANGUAGE: @@ -1604,12 +1604,12 @@ void LyXRC::output(ostream & os) const for (Formats::const_iterator cit = system_formats.begin(); cit != system_formats.end(); ++cit) if (!formats.getFormat(cit->name())) - os << "\\format \"" << cit->name() + os << "\\format \"" << cit->name() << "\" \"\" \"\" \"\"\n"; case RC_VIEWER: for (Formats::const_iterator cit = formats.begin(); cit != formats.end(); ++cit) { - Format const * format = + Format const * format = system_formats.getFormat(cit->name()); if ((!format || format->viewer() != cit->viewer()) && (format || !cit->viewer().empty())) @@ -1641,7 +1641,7 @@ void LyXRC::output(ostream & os) const for (Converters::const_iterator cit = system_converters.begin(); cit != system_converters.end(); ++cit) if (!converters.getConverter(cit->from, cit->to)) - os << "\\converter \"" << cit->from + os << "\\converter \"" << cit->from << "\" \"" << cit->to << "\" \"\" \"\"\n"; } os.flush(); @@ -1668,23 +1668,23 @@ void LyXRC::set_font_norm_type() } -string const LyXRC::getDescription(LyXRCTags tag) +string const LyXRC::getDescription(LyXRCTags tag) { string str; - + switch (tag) { case RC_FONT_ENCODING: str = N_("The font encoding used for the LaTeX2e fontenc package. T1 is highly recommended for non-English languages."); break; - + case RC_PRINTER: str = N_("The default printer to print on. If none is specified, LyX will use the environment variable PRINTER."); break; - + case RC_PRINT_COMMAND: str = N_("Your favorite print program, e.g. \"dvips\", \"dvilj4\"."); break; - + case RC_PRINTEVENPAGEFLAG: str = N_("The option to print only even pages."); break; @@ -1713,104 +1713,104 @@ string const LyXRC::getDescription(LyXRCTags tag) str = N_("The option to print out in landscape."); break; - case RC_PRINTPAPERFLAG: + case RC_PRINTPAPERFLAG: str = N_("The option to specify paper type."); break; case RC_PRINTPAPERDIMENSIONFLAG: str = N_("Option to specify the dimensions of the print paper."); break; - + case RC_PRINTTOPRINTER: str = N_("Option to pass to the print program to print on a specific printer."); break; - + case RC_PRINT_ADAPTOUTPUT: str = N_("Select for LyX to pass the name of the destination printer to your print command."); break; - + case RC_PRINTTOFILE: str = N_("Option to pass to the print program to print to a file."); break; - + case RC_PRINTFILEEXTENSION: str = N_("Extension of printer program output file. Usually \".ps\"."); break; - + case RC_PRINTEXSTRAOPTIONS: str = N_("Extra options to pass to printing program after everything else, but before the filename of the DVI file to be printed."); break; - + case RC_PRINTSPOOL_COMMAND: str = N_("When set, this printer option automatically prints to a file and then calls a separate print spooling program on that file with the given name and arguments."); break; - + case RC_PRINTSPOOL_PRINTERPREFIX: str = N_("If you specify a printer name in the print dialog, the following argument is prepended along with the printer name after the spool command."); break; - + case RC_SCREEN_DPI: str = N_("DPI (dots per inch) of your monitor is auto-detected by LyX. If that goes wrong, override the setting here."); break; - + case RC_SCREEN_ZOOM: //xgettext:no-c-format str = N_("The zoom percentage for screen fonts. A setting of 100% will make the fonts roughly the same size as on paper."); break; - + case RC_SCREEN_FONT_SIZES: str = N_("The font sizes used for calculating the scaling of the screen fonts."); break; - + case RC_SCREEN_FONT_ROMAN: case RC_SCREEN_FONT_SANS: case RC_SCREEN_FONT_TYPEWRITER: str = N_("The screen fonts used to display the text while editing."); break; - + case RC_POPUP_BOLD_FONT: str = N_("The bold font in the dialogs."); break; - + case RC_POPUP_NORMAL_FONT: str = N_("The normal font in the dialogs."); break; - + case RC_SCREEN_FONT_ENCODING: str = N_("The encoding for the screen fonts."); break; - + case RC_POPUP_FONT_ENCODING: str = N_("The encoding for the menu/popups fonts."); break; - + case RC_SET_COLOR: break; - + case RC_AUTOSAVE: str = N_("The time interval between auto-saves (in seconds). 0 means no auto-save."); break; - + case RC_DOCUMENTPATH: str = N_("The default path for your documents. An empty value selects the directory LyX was started from."); break; - + case RC_TEMPLATEPATH: str = N_("The path that LyX will set when offering to choose a template. An empty value selects the directory LyX was started from."); break; - + case RC_TEMPDIRPATH: str = N_("LyX will place its temporary directories in this path. They will be deleted when you quit LyX."); break; - + case RC_USETEMPDIR: str = N_("Select if you wish to use a temporary directory structure to store temporary TeX output."); break; - + case RC_LASTFILES: str = N_("The file where the last-files information should be stored."); break; - + case RC_AUTOREGIONDELETE: str = N_("De-select if you don't want the current selection to be replaced automatically by what you type."); break; @@ -1818,7 +1818,7 @@ string const LyXRC::getDescription(LyXRCTags tag) case RC_AUTORESET_OPTIONS: str = N_("De-select if you don't want the class options to be reset to defaults after class change."); break; - + case RC_OVERRIDE_X_DEADKEYS: str = N_("Select if LyX is to take over the handling of the dead keys (a.k.a. accent keys) that may be defined for your keyboard."); break; @@ -1835,7 +1835,7 @@ string const LyXRC::getDescription(LyXRCTags tag) case RC_UIFILE: str = N_("The UI (user interface) file. Can either specify an absolute path, or LyX will look in its global and local ui/ directories."); break; - + case RC_KBMAP: case RC_KBMAP_PRIMARY: case RC_KBMAP_SECONDARY: @@ -1845,89 +1845,89 @@ string const LyXRC::getDescription(LyXRCTags tag) case RC_ASCIIROFF_COMMAND: str = N_("Use to define an external program to render tables in the ASCII output. E.g. \"groff -t -Tlatin1 $$FName\" where $$FName is the input file. If \"none\" is specified, an internal routine is used."); break; - + case RC_ASCII_LINELEN: str = N_("This is the maximum line length of an exported ASCII file (LaTeX, SGML or plain text)."); break; - + case RC_NUMLASTFILES: str = N_("Maximal number of lastfiles. Up to 9 can appear in the file menu."); break; - + case RC_CHECKLASTFILES: str = N_("Select to check whether the lastfiles still exist."); break; - + case RC_VIEWDVI_PAPEROPTION: str = N_("Specify the paper command to DVI viewer (leave empty or use \"-paper\")"); break; - + case RC_DEFAULT_PAPERSIZE: str = N_("Specify the default paper size."); break; - + case RC_PS_COMMAND: break; - + case RC_ACCEPT_COMPOUND: str = N_("Consider run-together words, such as \"diskdrive\" for \"disk drive\", as legal words?"); break; - + case RC_SPELL_COMMAND: str = N_("What command runs the spell checker?"); break; - + case RC_USE_INP_ENC: str = N_("Specify whether to pass the -T input encoding option to ispell. Enable this if you can't spellcheck words with international letters in them. This may not work with all dictionaries."); break; - + case RC_USE_ALT_LANG: case RC_ALT_LANG: str = N_("Specify an alternate language. The default is to use the language of the document."); break; - + case RC_USE_PERS_DICT: case RC_PERS_DICT: str = N_("Specify an alternate personal dictionary file. E.g. \".ispell_english\"."); break; - + case RC_USE_ESC_CHARS: case RC_ESC_CHARS: str = N_("Specify additional chars that can be part of a word."); break; - + case RC_SCREEN_FONT_SCALABLE: str = N_("Allow bitmap fonts to be resized. If you are using a bitmap font, selecting this option may make some fonts look blocky in LyX. Deselecting this option makes LyX use the nearest bitmap font size available, instead of scaling."); break; - + case RC_CHKTEX_COMMAND: str = N_("Define how to run chktex. E.g. \"chktex -n11 -n1 -n3 -n6 -n9 -22 -n25 -n30 -n38\" Refer to the ChkTeX documentation."); break; - + case RC_CURSOR_FOLLOWS_SCROLLBAR: str = N_("LyX normally doesn't update the cursor position if you move the scrollbar. Set to true if you'd prefer to always have the cursor on screen."); break; - + case RC_DIALOGS_ICONIFY_WITH_MAIN: str = N_("Iconify the dialogs when the main window is iconified. (Affects only dialogs shown after the change has been made.)"); break; - + case RC_EXIT_CONFIRMATION: str = N_("Sets whether LyX asks for a second confirmation to exit when you have changed documents. (LyX will still ask to save changed documents.)"); break; - + case RC_DISPLAY_GRAPHICS: str = N_("Select how LyX will display any graphics."); break; - + case RC_DISPLAY_SHORTCUTS: str = N_("LyX continously displays names of last command executed, along with a list of defined short-cuts for it in the minibuffer. Set to false if LyX seems slow."); break; - + case RC_MAKE_BACKUP: str = N_("De-select if you don't want LyX to create backup files."); break; - + case RC_BACKUPDIR_PATH: str = N_("The path for storing backup files. If it is an empty string, LyX will store the backup file in the same directory as the original file."); break; @@ -1935,11 +1935,11 @@ string const LyXRC::getDescription(LyXRCTags tag) case RC_RTL_SUPPORT: str = N_("Select to enable support of right-to-left languages (e.g. Hebrew, Arabic)."); break; - + case RC_MARK_FOREIGN_LANGUAGE: str = N_("Select to control the highlighting of words with a language foreign to that of the document."); break; - + case RC_LANGUAGE_PACKAGE: str = N_("The latex command for loading the language package. E.g. \"\\usepackage{babel}\", \"\\usepackage{omega}\"."); break; @@ -1951,19 +1951,19 @@ string const LyXRC::getDescription(LyXRCTags tag) case RC_LANGUAGE_USE_BABEL: str = N_("De-select if you don't want babel to be used when the language of the document is the default language."); break; - + case RC_LANGUAGE_AUTO_BEGIN: str = N_("Select if a language switching command is needed at the beginning of the document."); break; - + case RC_LANGUAGE_AUTO_END: str = N_("Select if a language switching command is needed at the end of the document."); break; - + case RC_LANGUAGE_COMMAND_BEGIN: str = N_("The latex command for changing from the language of the document to another language. E.g. \\selectlanguage{$$lang} where $$lang is substituted by the name of the second language."); break; - + case RC_LANGUAGE_COMMAND_END: str = N_("The latex command for changing back to the language of the document."); break; @@ -1976,28 +1976,28 @@ string const LyXRC::getDescription(LyXRCTags tag) //xgettext:no-c-format str = N_("This accepts the normal strftime formats; see man strftime for full details. E.g.\"%A, %e. %B %Y\"."); break; - + case RC_SHOW_BANNER: str = N_("De-select if you don't want the startup banner."); break; - + case RC_WHEEL_JUMP: str = N_("The wheel movement factor (for mice with wheels or five button mice)."); break; - + case RC_CONVERTER: break; - + case RC_VIEWER: break; - + case RC_FORMAT: break; - + case RC_NEW_ASK_FILENAME: str = N_("This sets the behaviour if you want to be asked for a filename when creating a new document or wait until you save it and be asked then."); break; - + case RC_DEFAULT_LANGUAGE: str = N_("New documents will be assigned this language."); break; @@ -2005,7 +2005,7 @@ string const LyXRC::getDescription(LyXRCTags tag) case RC_LABEL_INIT_LENGTH: str = N_("Maximum number of words in the initialization string for a new label"); break; - + default: break; } diff --git a/src/lyxrc.h b/src/lyxrc.h index 6b79a00620..1a7c1fa042 100644 --- a/src/lyxrc.h +++ b/src/lyxrc.h @@ -1,9 +1,9 @@ // -*- C++ -*- /* This file is part of - * ====================================================== - * + * ====================================================== + * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team. * @@ -44,7 +44,7 @@ enum LyXRCTags { RC_PRINTEXSTRAOPTIONS, RC_PRINTSPOOL_COMMAND, RC_PRINTSPOOL_PRINTERPREFIX, - RC_PRINTPAPERFLAG, + RC_PRINTPAPERFLAG, RC_PRINTPAPERDIMENSIONFLAG, RC_CUSTOM_EXPORT_COMMAND, RC_CUSTOM_EXPORT_FORMAT, @@ -121,7 +121,7 @@ enum LyXRCTags { RC_DEFAULT_LANGUAGE, RC_LABEL_INIT_LENGTH, RC_DISPLAY_GRAPHICS, -#ifdef USE_PSPELL +#ifdef USE_PSPELL RC_USE_PSPELL, #endif RC_LAST @@ -139,7 +139,7 @@ enum LyXRCTags { /// void write(string const & filename) const; /// - void print() const; + void print() const; /// void output(std::ostream & os) const; /// @@ -178,14 +178,14 @@ enum LyXRCTags { string print_extra_options; /// string print_spool_command; - /// + /// string print_spool_printerprefix; /// string print_paper_flag; /// string print_paper_dimension_flag; /// - string custom_export_command; + string custom_export_command; /// string custom_export_format; /// @@ -194,8 +194,8 @@ enum LyXRCTags { string ps_command; /// option for telling the dvi viewer about the paper size string view_dvi_paper_option; - /// default paper size for local xdvi/dvips/ghostview/whatever - BufferParams::PAPER_SIZE default_papersize; + /// default paper size for local xdvi/dvips/ghostview/whatever + BufferParams::PAPER_SIZE default_papersize; /// command to run chktex incl. options string chktex_command; /// @@ -278,7 +278,7 @@ enum LyXRCTags { /// unsigned int ascii_linelen; /// Ispell command -#ifdef USE_PSPELL +#ifdef USE_PSPELL bool use_pspell; #endif string isp_command; @@ -325,7 +325,7 @@ enum LyXRCTags { /// string language_command_local; /// - bool language_global_options; + bool language_global_options; /// bool language_use_babel; /// diff --git a/src/lyxrow.C b/src/lyxrow.C index d043dcfbf7..3dbe39095f 100644 --- a/src/lyxrow.C +++ b/src/lyxrow.C @@ -1,8 +1,8 @@ /* This file is part of - * ====================================================== - * + * ====================================================== + * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team. * diff --git a/src/lyxrow.h b/src/lyxrow.h index ac71a2d661..f427b7a8a4 100644 --- a/src/lyxrow.h +++ b/src/lyxrow.h @@ -1,9 +1,9 @@ // -*- C++ -*- /* This file is part of - * ====================================================== - * + * ====================================================== + * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team. * diff --git a/src/lyxscreen.h b/src/lyxscreen.h index c90cab8794..f611e8a6e1 100644 --- a/src/lyxscreen.h +++ b/src/lyxscreen.h @@ -1,9 +1,9 @@ // -*- C++ -*- /* This file is part of - * ====================================================== - * + * ====================================================== + * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team * @@ -47,17 +47,17 @@ public: /// ~LyXScreen(); - + /// Sets the cursor color to LColor::cursor. void setCursorColor(); - + /** Draws the screen form textposition y. Uses as much of the already printed pixmap as possible */ void draw(LyXText *, BufferView *, unsigned int y); /// Redraws the screen, without using existing pixmap void redraw(LyXText *, BufferView *); - + /// Returns a new top so that the cursor is visible unsigned int topCursorVisible(LyXText const *); /// Redraws the screen such that the cursor is visible @@ -80,7 +80,7 @@ public: /// void toggleToggle(LyXText *, BufferView *, int y_offset = 0, int x_offset = 0); - + /** Updates part of the screen. If text->status is LyXText::NEED_MORE_REFRESH, we update from the point of change and to the end of the screen. @@ -94,11 +94,11 @@ public: bool cursor_visible; private: /// Copies specified area of pixmap to screen - void expose(int x, int y, int exp_width, int exp_height); + void expose(int x, int y, int exp_width, int exp_height); /// y1 and y2 are coordinates of the screen void drawFromTo(LyXText *, BufferView *, int y1, int y2, - int y_offset = 0, int x_offset = 0, bool internal=false); + int y_offset = 0, int x_offset = 0, bool internal=false); /// y is a coordinate of the text void drawOneRow(LyXText *, BufferView *, Row * row, @@ -106,7 +106,7 @@ private: /// WorkArea & owner; - + /// Pixmap cursor_pixmap; /// diff --git a/src/lyxserver.C b/src/lyxserver.C index 64d0c15622..a3d781edad 100644 --- a/src/lyxserver.C +++ b/src/lyxserver.C @@ -1,8 +1,8 @@ /* This file is part of - * ====================================================== - * + * ====================================================== + * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team. * @@ -10,27 +10,27 @@ /** Docu : To use the lyxserver define the name of the pipe in your - lyxrc: - \serverpipe "/home/myhome/.lyxpipe" - Then use .lyxpipe.in and .lyxpipe.out to communicate to LyX. - Each message consists of a single line in ASCII. Input lines - (client -> LyX) have the following format: - "LYXCMD:::" - Answers from LyX look like this: - "INFO:::" + lyxrc: + \serverpipe "/home/myhome/.lyxpipe" + Then use .lyxpipe.in and .lyxpipe.out to communicate to LyX. + Each message consists of a single line in ASCII. Input lines + (client -> LyX) have the following format: + "LYXCMD:::" + Answers from LyX look like this: + "INFO:::" [asierra970531] Or like this in case of error: - "ERROR:::" - where and are just echoed. - If LyX notifies about a user defined extension key-sequence, - the line looks like this: - "NOTIFY:" + "ERROR:::" + where and are just echoed. + If LyX notifies about a user defined extension key-sequence, + the line looks like this: + "NOTIFY:" [asierra970531] New server-only messages to implement a simple protocol - "LYXSRV::" - where can be "hello" or "bye". If hello is - received LyX will inform the client that it's listening its - messages, and 'bye' will inform that lyx is closing. + "LYXSRV::" + where can be "hello" or "bye". If hello is + received LyX will inform the client that it's listening its + messages, and 'bye' will inform that lyx is closing. - See development/server_monitor.c for an example client. + See development/server_monitor.c for an example client. Purpose: implement a client/server lib for LyX */ @@ -68,10 +68,10 @@ using std::endl; // provide an empty mkfifo() if we do not have one. This disables the -// lyxserver. +// lyxserver. #ifndef HAVE_MKFIFO int mkfifo(char const * __path, mode_t __mode) { - return 0; + return 0; } #endif @@ -82,7 +82,7 @@ extern LyXAction lyxaction; extern "C" { - + // C wrapper static void C_LyXComm_callback(int fd, void *v) @@ -99,7 +99,7 @@ extern "C" { void LyXComm::openConnection() { lyxerr[Debug::LYXSERVER] << "LyXComm: Opening connection" << endl; - + // If we are up, that's an error if (ready) { lyxerr << "LyXComm: Already connected" << endl; @@ -107,7 +107,7 @@ void LyXComm::openConnection() } // We assume that we don't make it ready = false; - + if (pipename.empty()) { lyxerr[Debug::LYXSERVER] << "LyXComm: server is disabled, nothing to do" @@ -122,46 +122,46 @@ void LyXComm::openConnection() endPipe(infd, inPipeName()); return; } - + if (fcntl(outfd, F_SETFL, O_NONBLOCK) < 0) { lyxerr << "LyXComm: Could not set flags on pipe " << outPipeName() << '\n' << strerror(errno) << endl; return; } - + // We made it! ready = true; lyxerr[Debug::LYXSERVER] << "LyXComm: Connection established" << endl; } - + /// Close pipes void LyXComm::closeConnection() { - lyxerr[Debug::LYXSERVER] << "LyXComm: Closing connection" << endl; + lyxerr[Debug::LYXSERVER] << "LyXComm: Closing connection" << endl; if (pipename.empty()) { lyxerr[Debug::LYXSERVER] << "LyXComm: server is disabled, nothing to do" << endl; - return; + return; } if (!ready) { lyxerr << "LyXComm: Already disconnected" << endl; return; } - + endPipe(infd, inPipeName()); endPipe(outfd, outPipeName()); - + ready = false; } int LyXComm::startPipe(string const & filename, bool write) { int fd; - + #ifdef __EMX__ HPIPE os2fd; APIRET rc; @@ -177,7 +177,7 @@ int LyXComm::startPipe(string const & filename, bool write) pipename.erase(); return -1; } - + if (rc != NO_ERROR) { errnum = TranslateOS2Error(rc); lyxerr <<"LyXComm: Could not create pipe " << filename @@ -193,7 +193,7 @@ int LyXComm::startPipe(string const & filename, bool write) return -1; }; // Imported handles can be used both with OS/2 APIs and emx - // library functions. + // library functions. fd = _imphandle(os2fd); #else if (::access(filename.c_str(), F_OK) == 0) { @@ -203,7 +203,7 @@ int LyXComm::startPipe(string const & filename, bool write) pipename.erase(); return -1; } - + if (::mkfifo(filename.c_str(), 0600) < 0) { lyxerr << "LyXComm: Could not create pipe " << filename << '\n' << strerror(errno) << endl; @@ -211,17 +211,17 @@ int LyXComm::startPipe(string const & filename, bool write) }; fd = ::open(filename.c_str(), write ? (O_RDWR) : (O_RDONLY|O_NONBLOCK)); #endif - + if (fd < 0) { lyxerr << "LyXComm: Could not open pipe " << filename << '\n' << strerror(errno) << endl; lyx::unlink(filename); return -1; } - + if (!write) fl_add_io_callback(fd, FL_READ, C_LyXComm_callback, this); - + return fd; } @@ -234,7 +234,7 @@ void LyXComm::endPipe(int & fd, string const & filename) #ifdef __EMX__ APIRET rc; int errnum; - + rc = DosDisConnectNPipe(fd); if (rc != NO_ERROR) { errnum = TranslateOS2Error(rc); @@ -243,12 +243,12 @@ void LyXComm::endPipe(int & fd, string const & filename) return; } #endif - + if (::close(fd) < 0) { lyxerr << "LyXComm: Could not close pipe " << filename << '\n' << strerror(errno) << endl; } - + // OS/2 pipes are deleted automatically #ifndef __EMX__ if (lyx::unlink(filename) < 0) { @@ -274,14 +274,14 @@ void LyXComm::emergencyCleanup() void LyXComm::callback(int fd, void *v) { LyXComm * c = static_cast(v); - + if (lyxerr.debugging(Debug::LYXSERVER)) { lyxerr << "LyXComm: Receiving from fd " << fd << endl; } - - const int CMDBUFLEN = 100; + + const int CMDBUFLEN = 100; char charbuf[CMDBUFLEN]; - string cmd; + string cmd; // nb! make lsbuf a class-member for multiple sessions static string lsbuf; @@ -297,24 +297,24 @@ void LyXComm::callback(int fd, void *v) // commit any commands read while (lsbuf.find('\n') != string::npos) // while still // commands - // left + // left { // split() grabs the entire string if - // the delim /wasn't/ found. ?:-P + // the delim /wasn't/ found. ?:-P lsbuf= split(lsbuf, cmd,'\n'); lyxerr[Debug::LYXSERVER] << "LyXComm: status:" << status - << ", lsbuf:" << lsbuf + << ", lsbuf:" << lsbuf << ", cmd:" << cmd << endl; if (!cmd.empty()) - c->clientcb(c->client, cmd); - //\n or not \n? + c->clientcb(c->client, cmd); + //\n or not \n? } } if (errno == EAGAIN) { // EAGAIN is not really an error , it means we're // only reading too fast for the writing process on - // the other end of the pipe. + // the other end of the pipe. errno = 0; return; // up to libforms select-loop (*crunch*) } @@ -323,7 +323,7 @@ void LyXComm::callback(int fd, void *v) lyxerr << "LyXComm: " << strerror(errno) << endl; if (!lsbuf.empty()) { - lyxerr << "LyxComm: truncated command: " + lyxerr << "LyxComm: truncated command: " << lsbuf << endl; lsbuf.erase(); } @@ -398,9 +398,9 @@ void LyXServer::callback(LyXServer * serv, string const & msg) { lyxerr[Debug::LYXSERVER] << "LyXServer: Received: '" << msg << '\'' << endl; - + char const * p = msg.c_str(); - + // --- parse the string -------------------------------------------- // // Format: LYXCMD:::\n @@ -409,26 +409,26 @@ void LyXServer::callback(LyXServer * serv, string const & msg) while (*p) { // --- 1. check 'header' --- - if (compare(p, "LYXSRV:", 7) == 0) { - server_only = true; + if (compare(p, "LYXSRV:", 7) == 0) { + server_only = true; } else if (0 != compare(p, "LYXCMD:", 7)) { lyxerr << "LyXServer: Unknown request \"" << p << "\"" << endl; return; } p += 7; - + // --- 2. for the moment ignore the client name --- string client; while (*p && *p != ':') client += char(*p++); if (*p == ':') ++p; if (!*p) return; - + // --- 3. get function name --- string cmd; while (*p && *p != ':') cmd += char(*p++); - + // --- 4. parse the argument --- string arg; if (!server_only && *p == ':' && *(++p)) { @@ -436,17 +436,17 @@ void LyXServer::callback(LyXServer * serv, string const & msg) arg += char(*p++); if (*p) ++p; } - + lyxerr[Debug::LYXSERVER] << "LyXServer: Client: '" << client << "' Command: '" << cmd << "' Argument: '" << arg << '\'' << endl; - + // --- lookup and exec the command ------------------ - + if (server_only) { string buf; - // return the greeting to inform the client that + // return the greeting to inform the client that // we are listening. if (cmd == "hello") { // One more client @@ -457,8 +457,8 @@ void LyXServer::callback(LyXServer * serv, string const & msg) return; } int i= 0; //find place in clients[] - while (!serv->clients[i].empty() - && inumclients) + while (!serv->clients[i].empty() + && inumclients) ++i; serv->clients[i] = client; serv->numclients++; @@ -492,7 +492,7 @@ void LyXServer::callback(LyXServer * serv, string const & msg) } return; } - + if (!cmd.empty()) { // which lyxfunc should we let it connect to? // The correct solution would be to have a @@ -504,7 +504,7 @@ void LyXServer::callback(LyXServer * serv, string const & msg) kb_action action = static_cast(lyxaction.LookupFunc(cmd)); //int action = -1; string rval, buf; - + if (action>= 0) { rval = serv->func->dispatch(action, arg); } else { @@ -519,7 +519,7 @@ void LyXServer::callback(LyXServer * serv, string const & msg) buf = "ERROR:"; else buf = "INFO:"; - buf += string(client) + ":" + cmd + ":" + rval + "\n"; + buf += string(client) + ":" + cmd + ":" + rval + "\n"; serv->pipes.send(buf); // !!! we don't do any error checking - @@ -527,7 +527,7 @@ void LyXServer::callback(LyXServer * serv, string const & msg) // message is lost and others too // maybe; so the client should empty // the outpipe before issuing a request. - + // not found } } /* while *p */ @@ -547,4 +547,3 @@ void LyXServer::notifyClient(string const & s) string buf = string("NOTIFY:") + s + "\n"; pipes.send(buf); } - diff --git a/src/lyxserver.h b/src/lyxserver.h index 4952411b1f..6b69392fe6 100644 --- a/src/lyxserver.h +++ b/src/lyxserver.h @@ -1,9 +1,9 @@ // -*- C++ -*- /* This file is part of -* ====================================================== -* +* ====================================================== +* * LyX, The Document Processor -* +* * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team. * @@ -51,7 +51,7 @@ public: /// clean up in emergency void emergencyCleanup(); - + /// Send message void send(string const &); @@ -71,16 +71,16 @@ private: /// Open pipes void openConnection(); - + /// Close pipes void closeConnection(); /// start a pipe int startPipe(string const &, bool); - + /// finish a pipe void endPipe(int &, string const &); - + /// This is -1 if not open int infd; @@ -111,23 +111,23 @@ public: // The lyx server should not take an argument "LyXFunc" but this is // how it will be done for 0.12. In 0.13 we must write a non-gui // bufferview. - // IMO lyxserver is atypical, and for the moment the only one, non-gui - // bufferview. We just have to find a way to handle situations like if - // lyxserver is using a buffer that is being edited with a bufferview. - // With a common buffer list this is not a problem, maybe. (Alejandro) + // IMO lyxserver is atypical, and for the moment the only one, non-gui + // bufferview. We just have to find a way to handle situations like if + // lyxserver is using a buffer that is being edited with a bufferview. + // With a common buffer list this is not a problem, maybe. (Alejandro) /// LyXServer(LyXFunc * f, string const & pip) : numclients(0), func(f), pipes(pip, (this), callback) {} - /// + /// ~LyXServer(); /// void notifyClient(string const &); - + /// whilst crashing etc. void emergencyCleanup() { pipes.emergencyCleanup(); } - + private: /// static void callback(LyXServer *, string const & msg); diff --git a/src/lyxtext.h b/src/lyxtext.h index b59b37a55a..646f736ffa 100644 --- a/src/lyxtext.h +++ b/src/lyxtext.h @@ -1,9 +1,9 @@ // -*- C++ -*- /* This file is part of - * ====================================================== - * + * ====================================================== + * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team. * @@ -68,7 +68,7 @@ public: LyXText(BufferView *); /// LyXText(InsetText *); - + /// Destructor ~LyXText(); @@ -104,10 +104,10 @@ public: LyXFont const getLabelFont(Buffer const *, Paragraph * par) const; /// void setCharFont(Buffer const *, Paragraph * par, - lyx::pos_type pos, LyXFont const & font); + lyx::pos_type pos, LyXFont const & font); void setCharFont(BufferView *, Paragraph * par, - lyx::pos_type pos, LyXFont const & font, bool toggleall); - + lyx::pos_type pos, LyXFont const & font, bool toggleall); + /// what you expect when pressing at cursor position void breakParagraph(BufferView *, char keep_layout = 0); @@ -120,63 +120,63 @@ public: string const & layout); /// void setLayout(BufferView *, string const & layout); - + /// used in setlayout void makeFontEntriesLayoutSpecific(Buffer const *, Paragraph * par); - - /** increment depth over selection and make a total rebreak of those + + /** increment depth over selection and make a total rebreak of those paragraphs */ void incDepth(BufferView *); - - /** decrement depth over selection and make a total rebreak of those + + /** decrement depth over selection and make a total rebreak of those paragraphs */ void decDepth(BufferView *); /** Get the depth at current cursor position */ int getDepth() const; - + /** set font over selection and make a total rebreak of those paragraphs. toggleall defaults to false. */ void setFont(BufferView *, LyXFont const &, bool toggleall = false); - + /** deletes and inserts again all paragaphs between the cursor and the specified par. The Cursor is needed to set the refreshing - parameters. + parameters. This function is needed after SetLayout and SetFont etc. */ void redoParagraphs(BufferView *, LyXCursor const & cursor, Paragraph const * end_par) const; /// void redoParagraph(BufferView *) const; - + /// void toggleFree(BufferView *, LyXFont const &, bool toggleall = false); /// string getStringToIndex(BufferView *); - + /** recalculates the heights of all previous rows of the specified paragraph. needed, if the last characters font - has changed. + has changed. */ void redoHeightOfParagraph(BufferView *, LyXCursor const & cursor); - - /** forces the redrawing of a paragraph. Needed when manipulating a + + /** forces the redrawing of a paragraph. Needed when manipulating a right address box - */ + */ void redoDrawingOfParagraph(BufferView *, LyXCursor const & cursor); - - /** insert a character, moves all the following breaks in the + + /** insert a character, moves all the following breaks in the same Paragraph one to the right and make a little rebreak */ void insertChar(BufferView *, char c); /// void insertInset(BufferView *, Inset * inset); - + /** Completes the insertion with a full rebreak. Returns true if something was broken. */ bool fullRebreak(BufferView *); @@ -201,25 +201,25 @@ public: /// void status(BufferView *, text_status) const; -private: +private: /** wether the screen needs a refresh, starting with refresh_y */ mutable text_status status_; - + public: /** returns a pointer to the row near the specified y-coordinate (relative to the whole text). y is set to the real beginning of this row - */ + */ Row * getRowNearY(int & y) const; - - /** returns the column near the specified x-coordinate of the row + + /** returns the column near the specified x-coordinate of the row x is set to the real beginning of this column - */ + */ lyx::pos_type getColumnNearX(BufferView *, Row * row, int & x, bool & boundary) const; - + /** returns a pointer to a specified row. y is set to the beginning of the row */ @@ -230,11 +230,11 @@ public: the first row */ Row * firstRow() { return firstrow; } - + /** returns the height of a default row, needed for scrollbar */ int defaultHeight() const; - + /** The cursor. Later this variable has to be removed. There should be now internal cursor in a text (and thus not in a buffer). By keeping this it is @@ -248,7 +248,7 @@ public: /** The structure that keeps track of the selections set. */ struct Selection { - Selection() + Selection() : set_(false), mark_(false) {} bool set() const { @@ -264,45 +264,45 @@ public: mark_ = m; } LyXCursor cursor; // temporary cursor to hold a cursor position - // until setSelection is called! + // until setSelection is called! LyXCursor start; // start of a REAL selection LyXCursor end; // end of a REAL selection private: bool set_; // former selection bool mark_; // former mark_set - + }; mutable Selection selection; // this is used to handle XSelection events in the right manner mutable Selection xsel_cache; /// needed for the toggling (cursor position on last selection made) - mutable LyXCursor last_sel_cursor; + mutable LyXCursor last_sel_cursor; /// needed for toggling the selection in screen.C mutable LyXCursor toggle_cursor; /// needed for toggling the selection in screen.C mutable LyXCursor toggle_end_cursor; - + /// need the selection cursor: void setSelection(BufferView *); /// void clearSelection() const; /// string const selectionAsString(Buffer const *, bool label) const; - + /// select the word we need depending on word_location - void getWord(LyXCursor & from, LyXCursor & to, + void getWord(LyXCursor & from, LyXCursor & to, word_location const) const; /// just selects the word the cursor is in void selectWord(BufferView *, word_location const); /// returns the inset at cursor (if it exists), 0 otherwise Inset * getInset() const; - /** 'selects" the next word, where the cursor is not in - and returns this word as string. THe cursor will be moved - to the beginning of this word. + /** 'selects" the next word, where the cursor is not in + and returns this word as string. THe cursor will be moved + to the beginning of this word. With SelectSelectedWord can this be highlighted really - */ + */ string const selectNextWordToSpellcheck(BufferView *, float & value) const; /// void selectSelectedWord(BufferView *); @@ -375,7 +375,7 @@ public: /// void deleteLineForward(BufferView *); /// - bool selectWordWhenUnderCursor(BufferView *, + bool selectWordWhenUnderCursor(BufferView *, word_location const); /// enum TextCase { @@ -395,7 +395,7 @@ public: LyXText::TextCase action); /// void transposeChars(BufferView &); - + /** returns a printed row in a pixmap. The y value is needed to decide, wether it is selected text or not. This is a strange solution but faster. @@ -403,7 +403,7 @@ public: void getVisibleRow(BufferView *, int y_offset, int x_offset, Row * row_ptr, int y, bool cleared=false); - /// + /// void toggleInset(BufferView *); /// void cutSelection(BufferView *, bool doclear = true, bool realcut = true); @@ -418,17 +418,17 @@ public: /** the DTP switches for paragraphs. LyX will store the top settings always in the first physical paragraph, the bottom settings in the - last. When a paragraph is broken, the top settings rest, the bottom + last. When a paragraph is broken, the top settings rest, the bottom settings are given to the new one. So I can make shure, they do not duplicate themself (and you cannnot make dirty things with them! ) - */ + */ void setParagraph(BufferView *, bool line_top, bool line_bottom, bool pagebreak_top, bool pagebreak_bottom, VSpace const & space_top, VSpace const & space_bottom, Spacing const & spacing, - LyXAlignment align, + LyXAlignment align, string labelwidthstring, bool noindent); @@ -455,7 +455,7 @@ public: /// /* for the greater insets */ - + /// returns false if inset wasn't found bool updateInset(BufferView *, Inset *); /// @@ -499,7 +499,7 @@ public: return 0; else return bidi_levels[pos-bidi_start]; - } + } /// inline bool bidi_InRange(lyx::pos_type pos) const { @@ -512,7 +512,7 @@ private: /// mutable Row * lastrow; - + /** Copybuffer for copy environment type. Asger has learned that this should be a buffer-property instead Lgb has learned that 'char' is a lousy type for non-characters @@ -534,7 +534,7 @@ private: /** appends the implizit specified paragraph behind the specified row, * start at the implizit given position */ void appendParagraph(BufferView *, Row * row) const; - + /// void breakAgain(BufferView *, Row * row) const; /// @@ -543,9 +543,9 @@ private: void setHeightOfRow(BufferView *, Row * row_ptr) const; /** this calculates the specified parameters. needed when setting - * the cursor and when creating a visible row */ + * the cursor and when creating a visible row */ void prepareToPrint(BufferView *, Row * row, float & x, - float & fill_separator, + float & fill_separator, float & fill_hfill, float & fill_label_hfill, bool bidi = true) const; @@ -553,11 +553,11 @@ private: /// A struct used for drawing routines struct DrawRowParams { // the bufferview - BufferView * bv; + BufferView * bv; // the row Row * row; // the painter to use - Painter * pain; + Painter * pain; // has the background been cleared bool cleared; /// x offset (e.g. for insets) @@ -577,57 +577,57 @@ private: /// fill separator size float separator; }; - + /// paint the background bool paintRowBackground(DrawRowParams & p); - - /// paint the selection background + + /// paint the selection background void paintRowSelection(DrawRowParams & p); /// paint appendix marker void paintRowAppendix(DrawRowParams & p); - - /// paint env depth bar + + /// paint env depth bar void paintRowDepthBar(DrawRowParams & p); - + /// get the on-screen size of the length marker int getLengthMarkerHeight(BufferView * bv, VSpace const & vsp) const; - + /// paint an added space marker int drawLengthMarker(DrawRowParams & p, string const & str, - VSpace const & vsp, int start); - + VSpace const & vsp, int start); + /// paint a first row in a paragraph void paintFirstRow(DrawRowParams & p); - + /// paint a last row in a paragraph void paintLastRow(DrawRowParams & p); - + /// paint text void paintRowText(DrawRowParams & p); - + // fix the cursor `cur' after a characters has been deleted at `where' // position. Called by deleteEmptyParagraphMechanism void fixCursorAfterDelete(BufferView * bview, LyXCursor & cur, LyXCursor const & where) const; - - /// delete double space (false) or empty paragraphs (true) around old_cursor + + /// delete double space (false) or empty paragraphs (true) around old_cursor bool deleteEmptyParagraphMechanism(BufferView *, LyXCursor const & old_cursor) const; public: /** Updates all counters starting BEHIND the row. Changed paragraphs - * with a dynamic left margin will be rebroken. */ + * with a dynamic left margin will be rebroken. */ void updateCounters(BufferView *, Row * row) const; private: /// void setCounter(Buffer const *, Paragraph * par) const; - + /* * some low level functions */ - + /// int singleWidth(BufferView *, Paragraph * par, lyx::pos_type pos) const; @@ -635,7 +635,7 @@ private: int singleWidth(BufferView *, Paragraph * par, lyx::pos_type pos, char c) const; - + /// draw normal chars void drawChars(DrawRowParams & p, lyx::pos_type & vpos, bool hebrew, bool arabic); @@ -645,7 +645,7 @@ private: void drawHebrewComposeChar(DrawRowParams & p, lyx::pos_type & vpos); /// draw a mark for foreign language, starting from orig_x void drawForeignMark(DrawRowParams & p, float const orig_x, LyXFont const & orig_font); - /// draw an inset + /// draw an inset void drawInset(DrawRowParams & p, lyx::pos_type const pos); /// draw new line marker void drawNewline(DrawRowParams & p, lyx::pos_type const pos); @@ -656,14 +656,14 @@ private: lyx::pos_type nextBreakPoint(BufferView *, Row const * row, int width) const; /// returns the minimum space a row needs on the screen in pixel int fill(BufferView *, Row * row, int workwidth) const; - + /** returns the minimum space a manual label needs on the - screen in pixel */ + screen in pixel */ int labelFill(BufferView *, Row const * row) const; /// lyx::pos_type beginningOfMainBody(Buffer const *, Paragraph const * par) const; - + /** Returns the left beginning of the text. This information cannot be taken from the layouts-objekt, because in LaTeX the beginning of the text fits in some cases @@ -677,7 +677,7 @@ private: /** returns the number of separators in the specified row. The separator on the very last column doesnt count - */ + */ int numberOfSeparators(Buffer const *, Row const * row) const; /** returns the number of hfills in the specified row. The @@ -686,15 +686,15 @@ private: more usefull than not to ignore! */ int numberOfHfills(Buffer const *, Row const * row) const; - + /// like NumberOfHfills, but only those in the manual label! int numberOfLabelHfills(Buffer const *, Row const * row) const; - /** returns true, if a expansion is needed. Rules are given by + /** returns true, if a expansion is needed. Rules are given by LaTeX */ bool hfillExpansion(Buffer const *, Row const * row_ptr, lyx::pos_type pos) const; - /// + /// LColor::color backgroundColor(); @@ -720,7 +720,7 @@ private: unsigned char transformChar(unsigned char c, Paragraph * par, lyx::pos_type pos) const; - /** returns the paragraph position of the last character in the + /** returns the paragraph position of the last character in the specified row */ lyx::pos_type rowLast(Row const * row) const; diff --git a/src/lyxtextclass.C b/src/lyxtextclass.C index 7f6a668ff4..9418b24464 100644 --- a/src/lyxtextclass.C +++ b/src/lyxtextclass.C @@ -1,8 +1,8 @@ /* This file is part of - * ====================================================== - * + * ====================================================== + * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team. * @@ -69,7 +69,7 @@ bool LyXTextClass::do_readStyle(LyXLex & lexrc, LyXLayout & lay) lay.reslabelfont.realize(defaultfont(), default_language); #endif return false; // no errors - } + } lyxerr << "Error parsing style `" << lay.name() << "'" << endl; return true; } @@ -131,37 +131,37 @@ bool LyXTextClass::Read(string const & filename, bool merge) lyxerr[Debug::TCLASS] << "Reading input file " << MakeDisplayPath(filename) << endl; - + LyXLex lexrc(textClassTags, TC_RIGHTMARGIN); bool error = false; - lexrc.setFile(filename); - if (!lexrc.isOK()) error = true; + lexrc.setFile(filename); + if (!lexrc.isOK()) error = true; // parsing while (lexrc.isOK() && !error) { int le = lexrc.lex(); switch (le) { case LyXLex::LEX_FEOF: - continue; + continue; - case LyXLex::LEX_UNDEF: + case LyXLex::LEX_UNDEF: lexrc.printError("Unknown TextClass tag `$$Token'"); error = true; - continue; + continue; default: break; } switch (static_cast(le)) { case TC_OUTPUTTYPE: // output type definition readOutputType(lexrc); break; - + case TC_INPUT: // Include file - if (lexrc.next()) { - string tmp = LibFileSearch("layouts", - lexrc.getString(), + if (lexrc.next()) { + string tmp = LibFileSearch("layouts", + lexrc.getString(), "layout"); - + if (Read(tmp, true)) { lexrc.printError("Error reading input" "file: "+tmp); @@ -177,7 +177,7 @@ bool LyXTextClass::Read(string const & filename, bool merge) defaultlayout_ = name; } break; - + case TC_STYLE: if (lexrc.next()) { string const name = subst(lexrc.getString(), @@ -221,7 +221,7 @@ bool LyXTextClass::Read(string const & filename, bool merge) if (lexrc.next()) columns_ = lexrc.getInteger(); break; - + case TC_SIDES: if (lexrc.next()) { switch (lexrc.getInteger()) { @@ -236,12 +236,12 @@ bool LyXTextClass::Read(string const & filename, bool merge) } } break; - + case TC_PAGESTYLE: - lexrc.next(); + lexrc.next(); pagestyle_ = strip(lexrc.getString()); break; - + case TC_DEFAULTFONT: defaultfont_.lyxRead(lexrc); if (!defaultfont_.resolved()) { @@ -251,7 +251,7 @@ bool LyXTextClass::Read(string const & filename, bool merge) defaultfont_.realize(LyXFont(LyXFont::ALL_SANE)); #else defaultfont_.realize(LyXFont(LyXFont::ALL_SANE), - default_language); + default_language); #endif } break; @@ -270,10 +270,10 @@ bool LyXTextClass::Read(string const & filename, bool merge) tocdepth_ = lexrc.getInteger(); break; - // First step to support options - case TC_CLASSOPTIONS: + // First step to support options + case TC_CLASSOPTIONS: readClassOptions(lexrc); - break; + break; case TC_PREAMBLE: preamble_ = lexrc.getLongString("EndPreamble"); @@ -295,19 +295,19 @@ bool LyXTextClass::Read(string const & filename, bool merge) break; case TC_LEFTMARGIN: // left margin type - if (lexrc.next()) + if (lexrc.next()) leftmargin_ = lexrc.getString(); - break; + break; case TC_RIGHTMARGIN: // right margin type if (lexrc.next()) rightmargin_ = lexrc.getString(); break; } - } + } if (!merge) { // we are at top level here. - lyxerr[Debug::TCLASS] << "Finished reading textclass " + lyxerr[Debug::TCLASS] << "Finished reading textclass " << MakeDisplayPath(filename) << endl; if (defaultlayout_.empty()) { @@ -316,7 +316,7 @@ bool LyXTextClass::Read(string const & filename, bool merge) error = true; } } else - lyxerr[Debug::TCLASS] << "Finished reading input file " + lyxerr[Debug::TCLASS] << "Finished reading input file " << MakeDisplayPath(filename) << endl; @@ -389,7 +389,7 @@ void LyXTextClass::readMaxCounter(LyXLex & lexrc) switch (le) { case LyXLex::LEX_UNDEF: lexrc.printError("Unknown MaxCounter tag `$$Token'"); - return; + return; default: break; } switch (static_cast(le)) { @@ -451,7 +451,7 @@ void LyXTextClass::readClassOptions(LyXLex & lexrc) switch (le) { case LyXLex::LEX_UNDEF: lexrc.printError("Unknown ClassOption tag `$$Token'"); - continue; + continue; default: break; } switch (static_cast(le)) { @@ -461,7 +461,7 @@ void LyXTextClass::readClassOptions(LyXLex & lexrc) break; case CO_PAGESTYLE: lexrc.next(); - opt_pagestyle_ = strip(lexrc.getString()); + opt_pagestyle_ = strip(lexrc.getString()); break; case CO_OTHER: lexrc.next(); @@ -497,7 +497,7 @@ string const & LyXTextClass::rightmargin() const bool LyXTextClass::hasLayout(string const & n) const { string const name = (n.empty() ? defaultLayoutName() : n); - + return find_if(layoutlist.begin(), layoutlist.end(), lyx::compare_memfun(&LyXLayout::name, name)) != layoutlist.end(); @@ -507,10 +507,10 @@ bool LyXTextClass::hasLayout(string const & n) const LyXLayout const & LyXTextClass::operator[](string const & n) const { lyx::Assert(!n.empty()); - + if (n.empty()) lyxerr << "Operator[] called with empty n" << endl; - + string const name = (n.empty() ? defaultLayoutName() : n); static string lastLayoutName; @@ -519,7 +519,7 @@ LyXLayout const & LyXTextClass::operator[](string const & n) const if (name == lastLayoutName) return layoutlist[lastLayoutIndex]; - + LayoutList::const_iterator cit = find_if(layoutlist.begin(), layoutlist.end(), @@ -529,14 +529,14 @@ LyXLayout const & LyXTextClass::operator[](string const & n) const lyxerr << "We failed to find the layout '" << name << "' in the layout list. You MUST investigate!" << endl; - + // we require the name to exist lyx::Assert(false); } lastLayoutName = name; lastLayoutIndex = std::distance(layoutlist.begin(), cit); - + return *cit; } @@ -545,7 +545,7 @@ bool LyXTextClass::delete_layout(string const & name) { if (name == defaultLayoutName()) return false; - + LayoutList::iterator it = remove_if(layoutlist.begin(), layoutlist.end(), lyx::compare_memfun(&LyXLayout::name, name)); @@ -575,7 +575,7 @@ bool LyXTextClass::load() const } loaded = true; return loaded; - + } @@ -669,7 +669,7 @@ bool LyXTextClass::provides(LyXTextClass::Provides p) const { return provides_ & p; } - + unsigned int LyXTextClass::columns() const { diff --git a/src/lyxtextclass.h b/src/lyxtextclass.h index 975c01183c..ff62771676 100644 --- a/src/lyxtextclass.h +++ b/src/lyxtextclass.h @@ -1,9 +1,9 @@ // -*- C++ -*- /* This file is part of * ====================================================== - * + * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team. * @@ -37,15 +37,15 @@ public: typedef LayoutList::const_iterator const_iterator; /// explicit - LyXTextClass (string const & = string(), - string const & = string(), + LyXTextClass (string const & = string(), + string const & = string(), string const & = string()); /// const_iterator begin() const { return layoutlist.begin(); } /// const_iterator end() const { return layoutlist.end(); } - + /// bool Read(string const & filename, bool merge = false); /// @@ -97,7 +97,7 @@ public: }; /// bool provides(Provides p) const; - + /// unsigned int columns() const; /// @@ -125,7 +125,7 @@ public: /// Text that dictates how wide the right margin is on the screen string const & rightmargin() const; - /// + /// int maxcounter() const; /// int size() const; diff --git a/src/lyxtextclasslist.C b/src/lyxtextclasslist.C index 79f0c3b117..6050c266cb 100644 --- a/src/lyxtextclasslist.C +++ b/src/lyxtextclasslist.C @@ -1,8 +1,8 @@ /* This file is part of - * ====================================================== - * + * ====================================================== + * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team. * @@ -106,13 +106,13 @@ bool LyXTextClassList::Read () "lyxlex was not able to set file: " << real_file << endl; } - + if (!lex.isOK()) { lyxerr << "LyXTextClassList::Read: unable to open " "textclass file `" << MakeDisplayPath(real_file, 1000) << "'\nCheck your installation. LyX can't continue." << endl; - return false; + return false; } bool finished = false; @@ -172,7 +172,7 @@ LyXTextClassList textclasslist; void LyXSetStyle() { lyxerr[Debug::TCLASS] << "LyXSetStyle: parsing configuration...\n"; - + if (!textclasslist.Read()) { lyxerr[Debug::TCLASS] << "LyXSetStyle: an error occured " "during parsing.\n Exiting." << endl; diff --git a/src/lyxtextclasslist.h b/src/lyxtextclasslist.h index 0865670745..a84a05aac5 100644 --- a/src/lyxtextclasslist.h +++ b/src/lyxtextclasslist.h @@ -1,9 +1,9 @@ // -*- C++ -*- /* This file is part of * ====================================================== - * + * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team. * @@ -62,7 +62,7 @@ private: void Add(LyXTextClass const &); }; -/// +/// extern LyXTextClassList textclasslist; #endif diff --git a/src/lyxvc.C b/src/lyxvc.C index cef2111b99..b8980d6f6e 100644 --- a/src/lyxvc.C +++ b/src/lyxvc.C @@ -80,9 +80,9 @@ void LyXVC::registrer() vcs = new RCS(owner_->fileName()); vcs->owner(owner_); } - + // If the document is changed, we might want to save it - if (!vcs->owner()->isLyxClean() && + if (!vcs->owner()->isLyxClean() && Alert::askQuestion(_("Changes in document:"), MakeDisplayPath(vcs->owner()->fileName(), 50), _("Save document and proceed?"))) { @@ -107,7 +107,7 @@ void LyXVC::registrer() _("This document has NOT been registered.")); return; } - + vcs->registrer(tmp.second); } @@ -115,7 +115,7 @@ void LyXVC::registrer() void LyXVC::checkIn() { // If the document is changed, we might want to save it - if (!vcs->owner()->isLyxClean() && + if (!vcs->owner()->isLyxClean() && Alert::askQuestion(_("Changes in document:"), MakeDisplayPath(vcs->owner()->fileName(), 50), _("Save document and proceed?"))) { @@ -145,7 +145,7 @@ void LyXVC::checkIn() void LyXVC::checkOut() { lyxerr[Debug::LYXVC] << "LyXVC: checkOut" << endl; - if (!vcs->owner()->isLyxClean() + if (!vcs->owner()->isLyxClean() && !Alert::askQuestion(_("Changes in document:"), MakeDisplayPath(vcs->owner()->fileName(), 50), _("Ignore changes and proceed with check out?"))) { @@ -153,7 +153,7 @@ void LyXVC::checkOut() } vcs->checkOut(); - + } diff --git a/src/lyxvc.h b/src/lyxvc.h index 75bc7871cd..30110b2bbe 100644 --- a/src/lyxvc.h +++ b/src/lyxvc.h @@ -19,7 +19,7 @@ class Buffer; The support in LyX is based loosely upon the version control in GNU Emacs, but is not as extensive as that one. See examples/VC.lyx for a simple tutorial and manual for the use of the version control system in LyX. - + LyXVC use this algorithm when it searches for VC files: for RCS it searches for ,v and RCS/,v similar should be done for CVS. By doing this there doesn't need to be any @@ -40,7 +40,7 @@ public: control by a VCS. */ bool file_found_hook(string const & fn); - + /** This function should be run when a file is requested for loading, but it does not exist. This function will then check for a VC master file with the same name (see above function). If this exists the @@ -75,9 +75,9 @@ public: */ const string getLogFile() const; - /// + /// void toggleReadOnly(); - + /// Is the document under administration by RCS? bool inUse(); @@ -92,7 +92,7 @@ public: private: /// Buffer * owner_; - + /// VCS * vcs; }; diff --git a/src/main.C b/src/main.C index 473cf5c537..cd9680818c 100644 --- a/src/main.C +++ b/src/main.C @@ -1,8 +1,8 @@ /* This file is part of - * ====================================================== - * + * ====================================================== + * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team. * @@ -30,10 +30,10 @@ int main(int argc, char * argv[]) string lyx_localedir = GetEnvPath("LYX_LOCALEDIR"); if (lyx_localedir.empty()) lyx_localedir = LOCALEDIR; - + // initialize for internationalized version *EK* - locale_init(); - gettext_init(lyx_localedir); + locale_init(); + gettext_init(lyx_localedir); LyX lyx(&argc, argv); return 0; // SUCCESS diff --git a/src/minibuffer.C b/src/minibuffer.C index 3f1ae5224e..92a307dfc7 100644 --- a/src/minibuffer.C +++ b/src/minibuffer.C @@ -3,10 +3,10 @@ * The MiniBuffer Class * read minibuffer.h for more * information. - * + * * Copyright 1995 Matthias Ettrich - * Copyright 1995-2001 The LyX Team. - * + * Copyright 1995-2001 The LyX Team. + * * ########################################################################### */ @@ -18,9 +18,9 @@ #pragma implementation #endif -// FIXME: temporary +// FIXME: temporary #include "frontends/xforms/DropDown.h" - + #include "minibuffer.h" #include "support/lyxalgo.h" @@ -47,7 +47,7 @@ namespace { struct prefix { string p; - prefix(string const & s) + prefix(string const & s) : p(s) {} bool operator()(string const & s) const { return prefixIs(s, p); @@ -71,8 +71,8 @@ MiniBuffer::MiniBuffer(LyXView * o, FL_Coord x, FL_Coord y, deactivate(); } - -// thanks for nothing, xforms (recursive creation not allowed) + +// thanks for nothing, xforms (recursive creation not allowed) void MiniBuffer::dd_init() { dropdown_ = new DropDown(owner_, the_buffer); @@ -88,8 +88,8 @@ MiniBuffer::~MiniBuffer() delete dropdown_; } - -void MiniBuffer::stored_slot() + +void MiniBuffer::stored_slot() { if (stored_) { stored_ = false; @@ -98,7 +98,7 @@ void MiniBuffer::stored_slot() } -void MiniBuffer::stored_set(string const & str) +void MiniBuffer::stored_set(string const & str) { stored_input = str; stored_ = true; @@ -122,7 +122,7 @@ int MiniBuffer::peek_event(FL_OBJECT * ob, int event, int key) set_input(input); stored_ = false; } - + switch (key) { case XK_Down: if (hist_iter != history_->end()) { @@ -135,7 +135,7 @@ int MiniBuffer::peek_event(FL_OBJECT * ob, int event, int key) } else { set_input((*hist_iter)); } - return 1; + return 1; case XK_Up: if (hist_iter == history_->begin()) { // no further history @@ -145,12 +145,12 @@ int MiniBuffer::peek_event(FL_OBJECT * ob, int event, int key) --hist_iter; set_input((*hist_iter)); } - return 1; + return 1; case 9: case XK_Tab: { // Completion handling. - + vector comp; lyx::copy_if(completion_.begin(), completion_.end(), @@ -187,11 +187,11 @@ int MiniBuffer::peek_event(FL_OBJECT * ob, int event, int key) test += tmp[test.length()]; } set_input(test); - + int x,y,w,h; fl_get_wingeometry(fl_get_real_object_window(the_buffer), &x, &y, &w, &h); - + // asynchronous completion int const air = the_buffer->x; x += air; @@ -199,7 +199,7 @@ int MiniBuffer::peek_event(FL_OBJECT * ob, int event, int key) w = the_buffer->w; dropdown_->select(comp, x, y, w); } - return 1; + return 1; } case 27: case XK_Escape: @@ -208,7 +208,7 @@ int MiniBuffer::peek_event(FL_OBJECT * ob, int event, int key) init(); deactivate(); //escape.emit(); - return 1; + return 1; case 13: case XK_Return: { @@ -255,9 +255,9 @@ int MiniBuffer::peek_event(FL_OBJECT * ob, int event, int key) return 1; } } - + } - + default: return 0; } @@ -266,22 +266,22 @@ int MiniBuffer::peek_event(FL_OBJECT * ob, int event, int key) //lyxerr << "Unhandled minibuffer event!" << endl; break; } - + return 0; } extern "C" { - + static - int C_MiniBuffer_peek_event(FL_OBJECT * ob, int event, + int C_MiniBuffer_peek_event(FL_OBJECT * ob, int event, FL_Coord, FL_Coord, int key, void * /*xev*/) { MiniBuffer * mini = static_cast(ob->u_vdata); return mini->peek_event(ob, event, key); } - + } @@ -299,26 +299,26 @@ FL_OBJECT * MiniBuffer::add(int type, FL_Coord x, FL_Coord y, FL_Coord w, FL_Coord h) { FL_OBJECT * obj; - + the_buffer = obj = fl_add_input(type, x, y, w, h, text.c_str()); - fl_set_object_boxtype(obj, FL_DOWN_BOX); - fl_set_object_resize(obj, FL_RESIZE_ALL); - fl_set_object_gravity(obj, SouthWestGravity, SouthEastGravity); - fl_set_object_color(obj, FL_MCOL, FL_MCOL); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - + fl_set_object_boxtype(obj, FL_DOWN_BOX); + fl_set_object_resize(obj, FL_RESIZE_ALL); + fl_set_object_gravity(obj, SouthWestGravity, SouthEastGravity); + fl_set_object_color(obj, FL_MCOL, FL_MCOL); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + // To intercept Up, Down, Table for history - fl_set_object_prehandler(obj, C_MiniBuffer_peek_event); - obj->u_vdata = this; - obj->wantkey = FL_KEY_TAB; + fl_set_object_prehandler(obj, C_MiniBuffer_peek_event); + obj->u_vdata = this; + obj->wantkey = FL_KEY_TAB; set_input(text); - + return obj; } -void MiniBuffer::message(string const & str) +void MiniBuffer::message(string const & str) { timer->restart(); string const ntext = strip(str); @@ -329,7 +329,7 @@ void MiniBuffer::message(string const & str) } -void MiniBuffer::messagePush(string const & str) +void MiniBuffer::messagePush(string const & str) { text_stored = text; message(str); @@ -390,7 +390,7 @@ void MiniBuffer::deactivate() } -void MiniBuffer::redraw() +void MiniBuffer::redraw() { fl_redraw_object(the_buffer); XFlush(fl_display); @@ -406,7 +406,7 @@ void MiniBuffer::set_complete_input(string const & str) } } - + void MiniBuffer::append_char(char c) { if (!c || !isprint(c)) @@ -420,7 +420,7 @@ void MiniBuffer::append_char(char c) fl_set_input(the_buffer, str.c_str()); } - + void MiniBuffer::set_input(string const & str) { fl_set_input(the_buffer, str.c_str()); diff --git a/src/minibuffer.h b/src/minibuffer.h index e259e50f46..394f9429cf 100644 --- a/src/minibuffer.h +++ b/src/minibuffer.h @@ -13,8 +13,8 @@ #endif class LyXView; -class DropDown; -class Timeout; +class DropDown; +class Timeout; /// class MiniBuffer : public SigC::Object { @@ -23,7 +23,7 @@ public: spaces, nospaces }; - + /// MiniBuffer(LyXView * o, FL_Coord x, FL_Coord y, FL_Coord h, FL_Coord w); @@ -33,7 +33,7 @@ public: /// create drop down void dd_init(); - + /// void addSet(string const &, string const & = string()); @@ -44,7 +44,7 @@ public: void messagePush(string const & str); /// void messagePop(); - + /** Makes the minibuffer wait for a string to be inserted. Waits for a string to be inserted into the minibuffer, when the string has been inserted the signal stringReady is @@ -56,7 +56,7 @@ public: /// void redraw(); /// - int peek_event(FL_OBJECT *, int, int); + int peek_event(FL_OBJECT *, int, int); /// SigC::Signal1 stringReady; /// @@ -74,7 +74,7 @@ private: void stored_slot(); /// void stored_set(string const &); - /// set the minibuffer content if str non-empty + /// set the minibuffer content if str non-empty void set_complete_input(string const &); /// append c to the current contents void append_char(char c); diff --git a/src/paragraph.C b/src/paragraph.C index b2d361acd7..ae7a8a0f04 100644 --- a/src/paragraph.C +++ b/src/paragraph.C @@ -1,10 +1,10 @@ /* This file is part of - * ====================================================== - * + * ====================================================== + * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich - * Copyright 1995-2001 The LyX Team. + * Copyright 1995-2001 The LyX Team. * * ====================================================== */ @@ -133,7 +133,7 @@ Paragraph::Paragraph(Paragraph const & lp, bool same_ids) } else { bibkey = 0; } - + // copy everything behind the break-position to the new paragraph insetlist = lp.insetlist; for (InsetList::iterator it = insetlist.begin(); @@ -170,8 +170,8 @@ Paragraph::~Paragraph() void Paragraph::writeFile(Buffer const * buf, ostream & os, - BufferParams const & bparams, - depth_type dth) const + BufferParams const & bparams, + depth_type dth) const { // The beginning or end of a deeper (i.e. nested) area? if (dth != params().depth()) { @@ -187,15 +187,15 @@ void Paragraph::writeFile(Buffer const * buf, ostream & os, } } } - + // First write the layout string lay = layout(); if (lay.empty()) { lay = textclasslist[bparams.textclass].defaultLayoutName(); } - + os << "\n\\layout " << layout() << "\n"; - + // Maybe some vertical spaces. if (params().spaceTop().kind() != VSpace::NONE) os << "\\added_space_top " @@ -203,35 +203,35 @@ void Paragraph::writeFile(Buffer const * buf, ostream & os, if (params().spaceBottom().kind() != VSpace::NONE) os << "\\added_space_bottom " << params().spaceBottom().asLyXCommand() << " "; - + // Maybe the paragraph has special spacing params().spacing().writeFile(os, true); - + // The labelwidth string used in lists. if (!params().labelWidthString().empty()) os << "\\labelwidthstring " << params().labelWidthString() << '\n'; - + // Lines above or below? if (params().lineTop()) os << "\\line_top "; if (params().lineBottom()) os << "\\line_bottom "; - + // Pagebreaks above or below? if (params().pagebreakTop()) os << "\\pagebreak_top "; if (params().pagebreakBottom()) os << "\\pagebreak_bottom "; - + // Start of appendix? if (params().startOfAppendix()) os << "\\start_of_appendix "; - + // Noindent? if (params().noindent()) os << "\\noindent "; - + // Alignment? if (params().align() != LYX_ALIGN_LAYOUT) { int h = 0; @@ -243,20 +243,20 @@ void Paragraph::writeFile(Buffer const * buf, ostream & os, } os << "\\align " << string_align[h] << " "; } - + // bibitem ale970302 if (bibkey) bibkey->write(buf, os); - + LyXFont font1(LyXFont::ALL_INHERIT, bparams.language); - + int column = 0; for (pos_type i = 0; i < size(); ++i) { if (!i) { os << "\n"; column = 0; } - + // Write font changes LyXFont font2 = getFontSettings(bparams, i); if (font2 != font1) { @@ -268,7 +268,7 @@ void Paragraph::writeFile(Buffer const * buf, ostream & os, column = 0; font1 = font2; } - + value_type const c = getChar(i); switch (c) { case META_INSET: @@ -288,11 +288,11 @@ void Paragraph::writeFile(Buffer const * buf, ostream & os, } } break; - case META_NEWLINE: + case META_NEWLINE: os << "\n\\newline \n"; column = 0; break; - case META_HFILL: + case META_HFILL: os << "\n\\hfill \n"; column = 0; break; @@ -324,7 +324,7 @@ void Paragraph::writeFile(Buffer const * buf, ostream & os, break; } } - + // now write the next paragraph if (next_) next_->writeFile(buf, os, bparams, dth); @@ -340,7 +340,7 @@ void Paragraph::validate(LaTeXFeatures & features) const features.require("lyxline"); if (!params().spacing().isDefault()) features.require("setspace"); - + // then the layouts features.useLayout(layout()); @@ -502,7 +502,7 @@ void Paragraph::insertChar(pos_type pos, Paragraph::value_type c) void Paragraph::insertChar(pos_type pos, Paragraph::value_type c, - LyXFont const & font) + LyXFont const & font) { pimpl_->insertChar(pos, c, font); } @@ -524,7 +524,7 @@ void Paragraph::insertInset(pos_type pos, Inset * inset, LyXFont const & font) bool Paragraph::insetAllowed(Inset::Code code) { //lyxerr << "Paragraph::InsertInsetAllowed" << endl; - + if (pimpl_->inset_owner) return pimpl_->inset_owner->insetAllowed(code); return true; @@ -549,7 +549,7 @@ Inset * Paragraph::getInset(pos_type pos) lyxerr << "ERROR (Paragraph::getInset): " << "Inset does not exist: " << pos << endl; //::raise(SIGSTOP); - + // text[pos] = ' '; // WHY!!! does this set the pos to ' '???? // Did this commenting out introduce a bug? So far I have not // see any, please enlighten me. (Lgb) @@ -588,7 +588,7 @@ Inset const * Paragraph::getInset(pos_type pos) const // Gets uninstantiated font setting at position. LyXFont const Paragraph::getFontSettings(BufferParams const & bparams, - pos_type pos) const + pos_type pos) const { lyx::Assert(pos <= size()); @@ -620,7 +620,7 @@ LyXFont const Paragraph::getFirstFontSettings() const { if (size() > 0 && !pimpl_->fontlist.empty()) return pimpl_->fontlist[0].font(); - + return LyXFont(LyXFont::ALL_INHERIT); } @@ -636,7 +636,7 @@ LyXFont const Paragraph::getFont(BufferParams const & bparams, pos_type pos) const { lyx::Assert(pos >= 0); - + LyXLayout const & lout = textclasslist[bparams.textclass][layout()]; pos_type main_body = 0; @@ -648,7 +648,7 @@ LyXFont const Paragraph::getFont(BufferParams const & bparams, layoutfont = lout.labelfont; else layoutfont = lout.font; - + LyXFont tmpfont = getFontSettings(bparams, pos); #ifndef INHERIT_LANGUAGE tmpfont.realize(layoutfont); @@ -664,7 +664,7 @@ LyXFont const Paragraph::getLabelFont(BufferParams const & bparams) const { LyXLayout const & lout = textclasslist[bparams.textclass][layout()]; - + LyXFont tmpfont = lout.labelfont; tmpfont.setLanguage(getParLanguage(bparams)); @@ -816,7 +816,7 @@ void Paragraph::setFont(pos_type pos, LyXFont const & font) pimpl_->fontlist.insert(pimpl_->fontlist.begin() + i + 1, Pimpl::FontTable(pos, font)); } else { // The general case. The block is splitted into 3 blocks - pimpl_->fontlist.insert(pimpl_->fontlist.begin() + i, + pimpl_->fontlist.insert(pimpl_->fontlist.begin() + i, Pimpl::FontTable(pos - 1, pimpl_->fontlist[i].font())); pimpl_->fontlist.insert(pimpl_->fontlist.begin() + i + 1, Pimpl::FontTable(pos, font)); @@ -871,34 +871,34 @@ void Paragraph::breakParagraph(BufferParams const & bparams, // create a new paragraph Paragraph * tmp = new Paragraph(this); tmp->layout(textclasslist[bparams.textclass].defaultLayoutName()); - + // remember to set the inset_owner tmp->setInsetOwner(inInset()); - + // this is an idea for a more userfriendly layout handling, I will // see what the users say - + // layout stays the same with latex-environments if (flag) { tmp->layout(layout()); tmp->setLabelWidthString(params().labelWidthString()); } - + if (size() > pos || !size() || flag == 2) { tmp->layout(layout()); tmp->params().align(params().align()); tmp->setLabelWidthString(params().labelWidthString()); - + tmp->params().lineBottom(params().lineBottom()); params().lineBottom(false); tmp->params().pagebreakBottom(params().pagebreakBottom()); params().pagebreakBottom(false); tmp->params().spaceBottom(params().spaceBottom()); params().spaceBottom(VSpace(VSpace::NONE)); - + tmp->params().depth(params().depth()); tmp->params().noindent(params().noindent()); - + // copy everything behind the break-position // to the new paragraph pos_type pos_end = size() - 1; @@ -913,7 +913,7 @@ void Paragraph::breakParagraph(BufferParams const & bparams, erase(i); } } - + // just an idea of me if (!pos) { tmp->params().lineTop(params().lineTop()); @@ -924,7 +924,7 @@ void Paragraph::breakParagraph(BufferParams const & bparams, bibkey = 0; params().clear(); layout(textclasslist[bparams.textclass].defaultLayoutName()); - + // layout stays the same with latex-environments if (flag) { layout(tmp->layout()); @@ -933,7 +933,7 @@ void Paragraph::breakParagraph(BufferParams const & bparams, } } } - + void Paragraph::makeSameLayout(Paragraph const * par) { @@ -943,13 +943,13 @@ void Paragraph::makeSameLayout(Paragraph const * par) } -int Paragraph::stripLeadingSpaces(lyx::textclass_type tclass) +int Paragraph::stripLeadingSpaces(lyx::textclass_type tclass) { if (textclasslist[tclass][layout()].free_spacing || isFreeSpacing()) { return 0; } - + int i = 0; while (size() && (isNewline(0) || isLineSeparator(0))) { erase(0); @@ -962,7 +962,7 @@ int Paragraph::stripLeadingSpaces(lyx::textclass_type tclass) bool Paragraph::hasSameLayout(Paragraph const * par) const { - return + return par->layout() == layout() && params().sameLayout(par->params()); } @@ -989,7 +989,7 @@ void Paragraph::breakParagraphConservative(BufferParams const & bparams, if (tmp->insertFromMinibuffer(j - pos)) ++j; } - + for (pos_type k = pos_end; k >= pos; --k) { erase(k); } @@ -1119,11 +1119,11 @@ void Paragraph::applyLayout(string const & new_layout) } -// if the layout of a paragraph contains a manual label, the beginning of the +// if the layout of a paragraph contains a manual label, the beginning of the // main body is the beginning of the second word. This is what the par- // function returns. If the layout does not contain a label, the main // body always starts with position 0. This differentiation is necessary, -// because there cannot be a newline or a blank <= the beginning of the +// because there cannot be a newline or a blank <= the beginning of the // main body in TeX. int Paragraph::beginningOfMainBody() const @@ -1136,7 +1136,7 @@ int Paragraph::beginningOfMainBody() const && getChar(i) != Paragraph::META_NEWLINE) { ++i; char previous_char = 0; - char temp = 0; + char temp = 0; if (i < size() && (previous_char = getChar(i)) != Paragraph::META_NEWLINE) { // Yes, this ^ is supposed to be "= " not "==" @@ -1239,15 +1239,15 @@ int Paragraph::getPositionOfInset(Inset const * inset) const Paragraph * Paragraph::TeXOnePar(Buffer const * buf, - BufferParams const & bparams, - ostream & os, TexRow & texrow, - bool moving_arg) + BufferParams const & bparams, + ostream & os, TexRow & texrow, + bool moving_arg) { lyxerr[Debug::LATEX] << "TeXOnePar... " << this << endl; Inset const * in = inInset(); bool further_blank_line = false; LyXLayout style; - + // well we have to check if we are in an inset with unlimited // lenght (all in one row) if that is true then we don't allow // any special options in the paragraph and also we don't allow @@ -1265,7 +1265,7 @@ Paragraph * Paragraph::TeXOnePar(Buffer const * buf, os << params().spacing().writeEnvirBegin() << "\n"; texrow.newline(); } - + if (tex_code_break_column && style.isCommand()) { os << '\n'; texrow.newline(); @@ -1302,14 +1302,14 @@ Paragraph * Paragraph::TeXOnePar(Buffer const * buf, if (language->babel() != previous_language->babel() // check if we already put language command in TeXEnvironment() && !(style.isEnvironment() - && (!previous() || previous()->layout() != layout() || - previous()->params().depth() != params().depth()))) + && (!previous() || previous()->layout() != layout() || + previous()->params().depth() != params().depth()))) { if (!lyxrc.language_command_end.empty() && previous_language->babel() != doc_language->babel()) { os << subst(lyxrc.language_command_end, "$$lang", - previous_language->babel()) + previous_language->babel()) << endl; texrow.newline(); } @@ -1318,7 +1318,7 @@ Paragraph * Paragraph::TeXOnePar(Buffer const * buf, language->babel() != doc_language->babel()) { os << subst(lyxrc.language_command_begin, "$$lang", - language->babel()) + language->babel()) << endl; texrow.newline(); } @@ -1339,7 +1339,7 @@ Paragraph * Paragraph::TeXOnePar(Buffer const * buf, << style.latexparam(); break; case LATEX_ITEM_ENVIRONMENT: - if (bibkey) { + if (bibkey) { bibkey->latex(buf, os, false, false); } else os << "\\item "; @@ -1352,7 +1352,7 @@ Paragraph * Paragraph::TeXOnePar(Buffer const * buf, } bool need_par = simpleTeXOnePar(buf, bparams, os, texrow, moving_arg); - + // Make sure that \\par is done with the font of the last // character if this has another size as the default. // This is necessary because LaTeX (and LyX on the screen) @@ -1367,7 +1367,7 @@ Paragraph * Paragraph::TeXOnePar(Buffer const * buf, ? getLayoutFont(bparams) : getFont(bparams, size() - 1)); bool is_command = style.isCommand(); - + if (style.resfont.size() != font.size() && next_ && !is_command) { if (!need_par) os << "{"; @@ -1400,7 +1400,7 @@ Paragraph * Paragraph::TeXOnePar(Buffer const * buf, texrow.newline(); } } - + if ((in == 0) || !in->forceDefaultParagraphs(in)) { further_blank_line = false; if (params().lineBottom()) { @@ -1429,7 +1429,7 @@ Paragraph * Paragraph::TeXOnePar(Buffer const * buf, texrow.newline(); } } - + // we don't need it for the last paragraph!!! if (next_) { os << '\n'; @@ -1463,12 +1463,12 @@ int Paragraph::startTeXParParams(BufferParams const & bparams, ostream & os) const { int column = 0; - + if (params().noindent()) { os << "\\noindent "; column += 10; } - + switch (params().align()) { case LYX_ALIGN_NONE: case LYX_ALIGN_BLOCK: @@ -1498,7 +1498,7 @@ int Paragraph::startTeXParParams(BufferParams const & bparams, column += 14; break; } - + return column; } @@ -1507,7 +1507,7 @@ int Paragraph::endTeXParParams(BufferParams const & bparams, ostream & os) const { int column = 0; - + switch (params().align()) { case LYX_ALIGN_NONE: case LYX_ALIGN_BLOCK: @@ -1543,16 +1543,16 @@ int Paragraph::endTeXParParams(BufferParams const & bparams, // This one spits out the text of the paragraph bool Paragraph::simpleTeXOnePar(Buffer const * buf, - BufferParams const & bparams, - ostream & os, TexRow & texrow, - bool moving_arg) + BufferParams const & bparams, + ostream & os, TexRow & texrow, + bool moving_arg) { lyxerr[Debug::LATEX] << "SimpleTeXOnePar... " << this << endl; bool return_value = false; LyXLayout style; - + // well we have to check if we are in an inset with unlimited // lenght (all in one row) if that is true then we don't allow // any special options in the paragraph and also we don't allow @@ -1565,7 +1565,7 @@ bool Paragraph::simpleTeXOnePar(Buffer const * buf, } else { style = textclasslist[bparams.textclass][layout()]; } - + LyXFont basefont; // Maybe we have to create a optional argument. @@ -1586,7 +1586,7 @@ bool Paragraph::simpleTeXOnePar(Buffer const * buf, } moving_arg |= style.needprotect; - + // Which font is currently active? LyXFont running_font(basefont); // Do we have an open font change? @@ -1623,11 +1623,11 @@ bool Paragraph::simpleTeXOnePar(Buffer const * buf, os << '{'; ++column; } - + if (!asdefault) column += startTeXParParams(bparams, os); } - + value_type c = getChar(i); // Fully instantiated font @@ -1645,7 +1645,7 @@ bool Paragraph::simpleTeXOnePar(Buffer const * buf, font = next_font; } } - + // We end font definition before blanks if (font != running_font && open_font) { column += running_font.latexWriteEndChanges(os, @@ -1684,7 +1684,7 @@ bool Paragraph::simpleTeXOnePar(Buffer const * buf, } basefont = getLayoutFont(bparams); running_font = basefont; - if (font.family() == + if (font.family() == LyXFont::TYPEWRITER_FAMILY) { os << "~"; } @@ -1698,8 +1698,8 @@ bool Paragraph::simpleTeXOnePar(Buffer const * buf, } else { pimpl_->simpleTeXSpecialChars(buf, bparams, os, texrow, moving_arg, - font, running_font, - basefont, open_font, + font, running_font, + basefont, open_font, style, i, column, c); } } @@ -1710,11 +1710,11 @@ bool Paragraph::simpleTeXOnePar(Buffer const * buf, if (next_) { running_font .latexWriteEndChanges(os, basefont, - next_->getFont(bparams, - 0)); + next_->getFont(bparams, + 0)); } else { running_font.latexWriteEndChanges(os, basefont, - basefont); + basefont); } #else #ifdef WITH_WARNINGS @@ -1751,43 +1751,43 @@ bool Paragraph::sgmlConvertChar(char c, string & sgml_string) case Paragraph::META_NEWLINE: sgml_string = '\n'; break; - case '&': + case '&': sgml_string = "&"; break; - case '<': - sgml_string = "<"; + case '<': + sgml_string = "<"; break; case '>': - sgml_string = ">"; + sgml_string = ">"; break; - case '$': - sgml_string = "$"; + case '$': + sgml_string = "$"; break; - case '#': + case '#': sgml_string = "#"; break; - case '%': + case '%': sgml_string = "%"; break; - case '[': + case '[': sgml_string = "["; break; - case ']': + case ']': sgml_string = "]"; break; - case '{': + case '{': sgml_string = "{"; break; - case '}': + case '}': sgml_string = "}"; break; - case '~': + case '~': sgml_string = "˜"; break; - case '"': + case '"': sgml_string = """; break; - case '\\': + case '\\': sgml_string = "\"; break; case ' ': @@ -1849,7 +1849,7 @@ Paragraph * Paragraph::TeXEnvironment(Buffer const * buf, } else if (style.latextype == LATEX_ITEM_ENVIRONMENT) { os << "\\begin{" << style.latexname() << '}' << style.latexparam() << '\n'; - } else + } else os << "\\begin{" << style.latexname() << '}' << style.latexparam() << '\n'; texrow.newline(); @@ -1865,7 +1865,7 @@ Paragraph * Paragraph::TeXEnvironment(Buffer const * buf, //&& !suffixIs(os, "\n\n") ) { // There should be at least one '\n' already - // but we need there to be two for Standard + // but we need there to be two for Standard // paragraphs that are depth-increment'ed to be // output correctly. However, tables can // also be paragraphs so don't adjust them. @@ -1882,7 +1882,7 @@ Paragraph * Paragraph::TeXEnvironment(Buffer const * buf, } while (par && par->layout() == layout() && par->params().depth() == params().depth()); - + if (style.isEnvironment()) { os << "\\end{" << style.latexname() << "}\n"; texrow.newline(); @@ -1922,7 +1922,7 @@ bool Paragraph::isLineSeparator(pos_type pos) const value_type const c = getChar(pos); return IsLineSeparatorChar(c) || (IsInsetChar(c) && getInset(pos) && - getInset(pos)->isLineSeparator()); + getInset(pos)->isLineSeparator()); } @@ -1938,14 +1938,14 @@ bool Paragraph::isLetter(pos_type pos) const value_type const c = getChar(pos); if (IsLetterChar(c)) return true; - if (isInset(pos)) + if (isInset(pos)) return getInset(pos)->isLetter(); // We want to pass the ' and escape chars to ispell string const extra = lyxrc.isp_esc_chars + '\''; return contains(extra, c); } - - + + bool Paragraph::isWord(pos_type pos) const { return IsWordChar(getChar(pos)) ; @@ -1953,7 +1953,7 @@ bool Paragraph::isWord(pos_type pos) const Language const * -Paragraph::getParLanguage(BufferParams const & bparams) const +Paragraph::getParLanguage(BufferParams const & bparams) const { if (size() > 0) { #ifndef INHERIT_LANGUAGE @@ -1999,7 +1999,7 @@ bool Paragraph::isMultiLingual(BufferParams const & bparams) Language const * doc_language = bparams.language; Pimpl::FontList::const_iterator cit = pimpl_->fontlist.begin(); Pimpl::FontList::const_iterator end = pimpl_->fontlist.end(); - + for (; cit != end; ++cit) if (cit->font().language() != ignore_language && cit->font().language() != latex_language && @@ -2041,7 +2041,7 @@ string const Paragraph::asString(Buffer const * buffer, bool label) } -string const Paragraph::asString(Buffer const * buffer, +string const Paragraph::asString(Buffer const * buffer, pos_type beg, pos_type end, bool label) { ostringstream ost; @@ -2056,7 +2056,7 @@ string const Paragraph::asString(Buffer const * buffer, else if (c == META_NEWLINE) ost << '\n'; else if (c == META_HFILL) - ost << '\t'; + ost << '\t'; else if (c == META_INSET) { getInset(i)->ascii(buffer, ost); } @@ -2147,7 +2147,7 @@ string const & Paragraph::layout() const void Paragraph::layout(string const & new_layout) { lyx::Assert(!new_layout.empty()); - + layout_ = new_layout; } @@ -2198,7 +2198,7 @@ void Paragraph::setChar(pos_type pos, value_type c) Paragraph::inset_iterator::inset_iterator(Paragraph::InsetList::iterator const & iter) - : it(iter) + : it(iter) {} diff --git a/src/paragraph.h b/src/paragraph.h index 9523a23a7c..f6e437064a 100644 --- a/src/paragraph.h +++ b/src/paragraph.h @@ -1,9 +1,9 @@ // -*- C++ -*- /* This file is part of - * ====================================================== - * + * ====================================================== + * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team. * @@ -77,7 +77,7 @@ public: }; /// typedef char value_type; - /// The same as ParameterStruct::depth_type + /// The same as ParameterStruct::depth_type typedef unsigned int depth_type; /// @@ -105,13 +105,13 @@ public: /// string const asString(Buffer const *, lyx::pos_type beg, lyx::pos_type end, bool label); - + /// void writeFile(Buffer const *, std::ostream &, BufferParams const &, depth_type) const; /// void validate(LaTeXFeatures &) const; - + /// int id() const; /// @@ -124,13 +124,13 @@ public: std::ostream &, TexRow & texrow, bool moving_arg); - /// + /// int startTeXParParams(BufferParams const &, std::ostream &) const; - /// + /// int endTeXParParams(BufferParams const &, std::ostream &) const; - + /// bool simpleTeXOnePar(Buffer const *, BufferParams const &, std::ostream &, TexRow & texrow, bool moving_arg); @@ -170,7 +170,7 @@ public: string const & layout() const; /// void layout(string const & new_layout); - + /// void setCounter(int i, int v); /// @@ -180,11 +180,11 @@ public: /// char enumdepth; - + /// char itemdepth; - /// + /// InsetBibKey * bibkey; // ale970302 /// @@ -206,15 +206,15 @@ public: Paragraph * depthHook(depth_type depth); /// for the environments Paragraph const * depthHook(depth_type depth) const; - /// + /// Paragraph * outerHook(); - /// + /// Paragraph const * outerHook() const; /// int beginningOfMainBody() const; /// string const & getLabelstring() const; - + /// the next two functions are for the manual labels string const getLabelWidthString() const; /// @@ -232,7 +232,7 @@ public: /// void erase(lyx::pos_type pos); /** the flag determines wether the layout should be copied - */ + */ void breakParagraph(BufferParams const &, lyx::pos_type pos, int flag); /// void breakParagraphConservative(BufferParams const &, lyx::pos_type pos); @@ -249,7 +249,7 @@ public: font attached to this paragraph. If pos == -2, use the label font of the layout attached here. In all cases, the font is instantiated, i.e. does not have any - attributes with values LyXFont::INHERIT, LyXFont::IGNORE or + attributes with values LyXFont::INHERIT, LyXFont::IGNORE or LyXFont::TOGGLE. */ LyXFont const getFont(BufferParams const &, lyx::pos_type pos) const; @@ -265,7 +265,7 @@ public: void setFont(lyx::pos_type pos, LyXFont const & font); /// Returns the height of the highest font in range LyXFont::FONT_SIZE highestFontInRange(lyx::pos_type startpos, - lyx::pos_type endpos, + lyx::pos_type endpos, LyXFont::FONT_SIZE const def_size) const; /// void insertChar(lyx::pos_type pos, value_type c); @@ -306,12 +306,12 @@ public: bool isKomma(lyx::pos_type pos) const; /// Used by the spellchecker bool isLetter(lyx::pos_type pos) const; - /// + /// bool isWord(lyx::pos_type pos) const; /** paste this paragraph with the next one be carefull, this doesent make any check at all - */ + */ void pasteParagraph(BufferParams const &); /// returns -1 if inset not found @@ -321,7 +321,7 @@ public: Paragraph * getParFromID(int id) const; /// - int stripLeadingSpaces(lyx::textclass_type tclass); + int stripLeadingSpaces(lyx::textclass_type tclass); #ifndef NO_PEXTRA_REALLY /* If I set a PExtra Indent on one paragraph of a ENV_LIST-TYPE @@ -373,7 +373,7 @@ public: Inset * operator*() { return it->inset; } /// Inset * operator->() { return it->inset; } - + /// lyx::pos_type getPos() const { return it->pos; } /// @@ -390,7 +390,7 @@ public: }; /// friend class inset_iterator; - + /// inset_iterator inset_iterator_begin(); /// diff --git a/src/paragraph_pimpl.C b/src/paragraph_pimpl.C index c223c72785..ab4b20af93 100644 --- a/src/paragraph_pimpl.C +++ b/src/paragraph_pimpl.C @@ -1,10 +1,10 @@ /* This file is part of - * ====================================================== - * + * ====================================================== + * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich - * Copyright 1995-2001 The LyX Team. + * Copyright 1995-2001 The LyX Team. * * ====================================================== */ @@ -40,18 +40,18 @@ ShareContainer Paragraph::Pimpl::FontTable::container; unsigned int Paragraph::Pimpl::paragraph_id = 0; namespace { - + string special_phrases[][2] = { { "LyX", "\\LyX{}" }, { "TeX", "\\TeX{}" }, { "LaTeX2e", "\\LaTeXe{}" }, { "LaTeX", "\\LaTeX{}" }, }; - + size_t phrases_nr = sizeof(special_phrases)/sizeof(special_phrases[0]); - + } // namespace anon - + Paragraph::Pimpl::Pimpl(Paragraph * owner) : owner_(owner) @@ -96,7 +96,7 @@ Paragraph::value_type Paragraph::Pimpl::getChar(pos_type pos) const // Then this has no meaning. (Lgb) if (!size() || pos == size()) return '\0'; - + return text[pos]; } @@ -108,7 +108,7 @@ void Paragraph::Pimpl::setChar(pos_type pos, value_type c) void Paragraph::Pimpl::insertChar(pos_type pos, value_type c, - LyXFont const & font) + LyXFont const & font) { lyx::Assert(pos <= size()); @@ -117,18 +117,18 @@ void Paragraph::Pimpl::insertChar(pos_type pos, value_type c, // Update the font table. FontTable search_font(pos, LyXFont()); for (FontList::iterator it = lower_bound(fontlist.begin(), - fontlist.end(), - search_font, matchFT()); + fontlist.end(), + search_font, matchFT()); it != fontlist.end(); ++it) { it->pos(it->pos() + 1); } - + // Update the inset table. InsetTable search_inset(pos, 0); for (InsetList::iterator it = lower_bound(owner_->insetlist.begin(), - owner_->insetlist.end(), - search_inset, matchIT()); + owner_->insetlist.end(), + search_inset, matchIT()); it != owner_->insetlist.end(); ++it) { ++it->pos; @@ -142,10 +142,10 @@ void Paragraph::Pimpl::insertInset(pos_type pos, { lyx::Assert(inset); lyx::Assert(pos <= size()); - + insertChar(pos, META_INSET, font); lyx::Assert(text[pos] == META_INSET); - + // Add a new entry in the inset table. InsetTable search_inset(pos, 0); InsetList::iterator it = lower_bound(owner_->insetlist.begin(), @@ -158,7 +158,7 @@ void Paragraph::Pimpl::insertInset(pos_type pos, owner_->insetlist.insert(it, InsetTable(pos, inset)); inset->parOwner(owner_); } - + if (inset_owner) inset->setOwner(inset_owner); } @@ -167,7 +167,7 @@ void Paragraph::Pimpl::insertInset(pos_type pos, void Paragraph::Pimpl::erase(pos_type pos) { lyx::Assert(pos < size()); - // if it is an inset, delete the inset entry + // if it is an inset, delete the inset entry if (text[pos] == Paragraph::META_INSET) { // find the entry InsetTable search_inset(pos, 0); @@ -180,19 +180,19 @@ void Paragraph::Pimpl::erase(pos_type pos) owner_->insetlist.erase(it); } } - + text.erase(text.begin() + pos); - + // Erase entries in the tables. FontTable search_font(pos, LyXFont()); - + FontList::iterator it = lower_bound(fontlist.begin(), fontlist.end(), search_font, matchFT()); if (it != fontlist.end() && it->pos() == pos && - (pos == 0 || - (it != fontlist.begin() + (pos == 0 || + (it != fontlist.begin() && boost::prior(it)->pos() == pos - 1))) { // If it is a multi-character font // entry, we just make it smaller @@ -207,12 +207,12 @@ void Paragraph::Pimpl::erase(pos_type pos) it = fontlist.begin() + i - 1; } } - + // Update all other entries. FontList::iterator fend = fontlist.end(); for (; it != fend; ++it) it->pos(it->pos() - 1); - + // Update the inset table. InsetTable search_inset(pos, 0); InsetList::iterator lend = owner_->insetlist.end(); @@ -226,23 +226,23 @@ void Paragraph::Pimpl::erase(pos_type pos) void Paragraph::Pimpl::simpleTeXBlanks(ostream & os, TexRow & texrow, - pos_type const i, - int & column, LyXFont const & font, - LyXLayout const & style) + pos_type const i, + int & column, LyXFont const & font, + LyXLayout const & style) { if (style.pass_thru) return; if (column > tex_code_break_column - && i + && i && getChar(i - 1) != ' ' && (i < size() - 1) // same in FreeSpacing mode && !style.free_spacing && !owner_->isFreeSpacing() - // In typewriter mode, we want to avoid + // In typewriter mode, we want to avoid // ! . ? : at the end of a line && !(font.family() == LyXFont::TYPEWRITER_FAMILY && (getChar(i - 1) == '.' - || getChar(i - 1) == '?' + || getChar(i - 1) == '?' || getChar(i - 1) == ':' || getChar(i - 1) == '!'))) { if (tex_code_break_column == 0) { @@ -267,7 +267,7 @@ bool Paragraph::Pimpl::isTextAt(BufferParams const & bp, string const & str, pos_type pos) { LyXFont const & font = owner_->getFont(bp, pos); - + for (string::size_type i = 0; i < str.length(); ++i) { if (pos + static_cast(i) >= size()) return false; @@ -279,7 +279,7 @@ bool Paragraph::Pimpl::isTextAt(BufferParams const & bp, return true; } - + void Paragraph::Pimpl::simpleTeXSpecialChars(Buffer const * buf, BufferParams const & bparams, ostream & os, @@ -317,7 +317,7 @@ void Paragraph::Pimpl::simpleTeXSpecialChars(Buffer const * buf, } int tmp = inset->latex(buf, os, moving_arg, - style.free_spacing); + style.free_spacing); if (close) os << "}"; @@ -346,7 +346,7 @@ void Paragraph::Pimpl::simpleTeXSpecialChars(Buffer const * buf, running_font = basefont; break; - case Paragraph::META_HFILL: + case Paragraph::META_HFILL: os << "\\hfill{}"; column += 7; break; @@ -355,12 +355,12 @@ void Paragraph::Pimpl::simpleTeXSpecialChars(Buffer const * buf, // And now for the special cases within each mode switch (c) { - case '\\': + case '\\': os << "\\textbackslash{}"; column += 15; break; - - case '°': case '±': case '²': case '³': + + case '°': case '±': case '²': case '³': case '×': case '÷': case '¹': case 'ª': case 'º': case '¬': case 'µ': if ((bparams.inputenc == "latin1" || @@ -378,7 +378,7 @@ void Paragraph::Pimpl::simpleTeXSpecialChars(Buffer const * buf, os << c; } break; - + case '|': case '<': case '>': // In T1 encoding, these characters exist if (lyxrc.fontenc == "T1") { @@ -401,7 +401,7 @@ void Paragraph::Pimpl::simpleTeXSpecialChars(Buffer const * buf, if (font.family() == LyXFont::TYPEWRITER_FAMILY) { os << c; break; - } + } // Otherwise, we use what LaTeX // provides us. switch (c) { @@ -419,7 +419,7 @@ void Paragraph::Pimpl::simpleTeXSpecialChars(Buffer const * buf, break; } break; - + case '-': // "--" in Typewriter mode -> "-{}-" if (i <= size() - 2 && getChar(i + 1) == '-' @@ -430,12 +430,12 @@ void Paragraph::Pimpl::simpleTeXSpecialChars(Buffer const * buf, os << '-'; } break; - - case '\"': + + case '\"': os << "\\char`\\\"{}"; column += 9; break; - + case '£': if (bparams.inputenc == "default") { os << "\\pounds{}"; @@ -444,24 +444,24 @@ void Paragraph::Pimpl::simpleTeXSpecialChars(Buffer const * buf, os << c; } break; - + case '$': case '&': case '%': case '#': case '{': case '}': case '_': os << '\\' << c; column += 1; break; - + case '~': os << "\\textasciitilde{}"; column += 16; break; - + case '^': os << "\\textasciicircum{}"; column += 17; break; - + case '*': case '[': case ']': // avoid being mistaken for optional arguments os << '{' << c << '}'; @@ -471,13 +471,13 @@ void Paragraph::Pimpl::simpleTeXSpecialChars(Buffer const * buf, case ' ': // Blanks are printed before font switching. // Sure? I am not! (try nice-latex) - // I am sure it's correct. LyX might be smarter - // in the future, but for now, nothing wrong is - // written. (Asger) + // I am sure it's correct. LyX might be smarter + // in the future, but for now, nothing wrong is + // written. (Asger) break; default: - + // I assume this is hack treating typewriter as verbatim if (font.family() == LyXFont::TYPEWRITER_FAMILY) { if (c != '\0') { @@ -485,15 +485,15 @@ void Paragraph::Pimpl::simpleTeXSpecialChars(Buffer const * buf, } break; } - + // LyX, LaTeX etc. - + // FIXME: if we have "LaTeX" with a font change in the middle (before // the 'T', then the "TeX" part is still special cased. Really we // should only operate this on "words" for some definition of word - + size_t pnr = 0; - + for (; pnr < phrases_nr; ++pnr) { if (isTextAt(bparams, special_phrases[pnr][0], i)) { os << special_phrases[pnr][1]; @@ -552,12 +552,12 @@ LyXFont const Paragraph::Pimpl::realizeFont(LyXFont const & font, BufferParams const & bparams) const { LyXFont tmpfont(font); - + // check for environment font information char par_depth = owner_->getDepth(); Paragraph const * par = owner_; LyXTextClass const & tclass = textclasslist[bparams.textclass]; - + while (par && par->getDepth() && !tmpfont.resolved()) { par = par->outerHook(); if (par) { @@ -575,5 +575,5 @@ LyXFont const Paragraph::Pimpl::realizeFont(LyXFont const & font, , bparams.language #endif ); - return tmpfont; + return tmpfont; } diff --git a/src/paragraph_pimpl.h b/src/paragraph_pimpl.h index 747f661123..c504bc85aa 100644 --- a/src/paragraph_pimpl.h +++ b/src/paragraph_pimpl.h @@ -1,9 +1,9 @@ // -*- C++ -*- /* This file is part of - * ====================================================== - * + * ====================================================== + * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team. * @@ -97,12 +97,12 @@ struct Paragraph::Pimpl { /// End position of paragraph this font attribute covers lyx::pos_type pos_; /** Font. Interpretation of the font values: - If a value is LyXFont::INHERIT_*, it means that the font + If a value is LyXFont::INHERIT_*, it means that the font attribute is inherited from either the layout of this - paragraph or, in the case of nested paragraphs, from the - layout in the environment one level up until completely + paragraph or, in the case of nested paragraphs, from the + layout in the environment one level up until completely resolved. - The values LyXFont::IGNORE_* and LyXFont::TOGGLE are NOT + The values LyXFont::IGNORE_* and LyXFont::TOGGLE are NOT allowed in these font tables. */ boost::shared_ptr font_; @@ -153,7 +153,7 @@ private: /// match a string against a particular point in the paragraph bool isTextAt(BufferParams const &, string const & str, lyx::pos_type pos); - + /// Who owns us? Paragraph * owner_; /// diff --git a/src/screen.C b/src/screen.C index ee6202e324..f4ec9eb99e 100644 --- a/src/screen.C +++ b/src/screen.C @@ -1,8 +1,8 @@ /* This file is part of -* ====================================================== -* +* ====================================================== +* * LyX, The Document Processor -* +* * Copyright 1995 Matthias Ettrich * Copyright 1995-1998 The LyX Team * @@ -36,14 +36,14 @@ namespace { GC createGC() { XGCValues val; - val.foreground = BlackPixel(fl_get_display(), + val.foreground = BlackPixel(fl_get_display(), DefaultScreen(fl_get_display())); - + val.function = GXcopy; val.graphics_exposures = false; val.line_style = LineSolid; val.line_width = 0; - return XCreateGC(fl_get_display(), RootWindow(fl_get_display(), 0), + return XCreateGC(fl_get_display(), RootWindow(fl_get_display(), 0), GCForeground | GCFunction | GCGraphicsExposures | GCLineWidth | GCLineStyle , &val); } @@ -73,13 +73,13 @@ LyXScreen::~LyXScreen() XFreeGC(fl_get_display(), gc_copy); } - -void LyXScreen::setCursorColor() + +void LyXScreen::setCursorColor() { if (!lyxColorHandler.get()) return; GC gc = lyxColorHandler->getGCForeground(LColor::cursor); - + XGCValues val; XGetGCValues(fl_get_display(), gc, GCForeground, &val); @@ -112,22 +112,22 @@ void LyXScreen::expose(int x, int y, int exp_width, int exp_height) void LyXScreen::drawFromTo(LyXText * text, BufferView * bv, - int y1, int y2, int y_offset, int x_offset, - bool internal) + int y1, int y2, int y_offset, int x_offset, + bool internal) { int y_text = text->first_y + y1; - - // get the first needed row + + // get the first needed row Row * row = text->getRowNearY(y_text); // y_text is now the real beginning of the row - + int y = y_text - text->first_y; // y1 is now the real beginning of row on the screen - + while (row != 0 && y < y2) { LyXText::text_status st = text->status(); text->getVisibleRow(bv, y + y_offset, - x_offset, row, y + text->first_y); + x_offset, row, y + text->first_y); internal = internal && (st != LyXText::CHANGED_IN_DRAW); while (internal && text->status() == LyXText::CHANGED_IN_DRAW) { if (text->fullRebreak(bv)) { @@ -136,7 +136,7 @@ void LyXScreen::drawFromTo(LyXText * text, BufferView * bv, } text->status(bv, st); text->getVisibleRow(bv, y + y_offset, - x_offset, row, y + text->first_y); + x_offset, row, y + text->first_y); } y += row->height(); row = row->next(); @@ -168,7 +168,7 @@ void LyXScreen::drawOneRow(LyXText * text, BufferView * bv, Row * row, text->getVisibleRow(bv, y, x_offset, row, y + text->first_y); } while (!text->inset_owner && - text->status() == LyXText::CHANGED_IN_DRAW); + text->status() == LyXText::CHANGED_IN_DRAW); bv->text->status(bv, st); #else text->getVisibleRow(bv, y, x_offset, row, y + text->first_y); @@ -212,8 +212,8 @@ void LyXScreen::draw(LyXText * text, BufferView * bv, unsigned int y) old_first - text->first_y); } else { drawFromTo(text, bv, - owner.height() + old_first - text->first_y, - owner.height(), 0, 0, internal); + owner.height() + old_first - text->first_y, + owner.height(), 0, 0, internal); XCopyArea (fl_get_display(), owner.getWin(), owner.getWin(), @@ -229,7 +229,7 @@ void LyXScreen::draw(LyXText * text, BufferView * bv, unsigned int y) owner.workWidth(), text->first_y - old_first); } } else { - // make a dumb new-draw + // make a dumb new-draw drawFromTo(text, bv, 0, owner.height(), 0, 0, internal); expose(0, 0, owner.workWidth(), owner.height()); } @@ -254,12 +254,12 @@ void LyXScreen::showCursor(LyXText const * text, BufferView const * bv) } -/* returns true if first has changed, otherwise false */ +/* returns true if first has changed, otherwise false */ bool LyXScreen::fitManualCursor(LyXText * text, BufferView * bv, int /*x*/, int y, int asc, int desc) { int newtop = text->first_y; - + if (y + desc - text->first_y >= static_cast(owner.height())) newtop = y - 3 * owner.height() / 4; // the scroll region must be so big!! else if (y - asc < text->first_y @@ -268,7 +268,7 @@ bool LyXScreen::fitManualCursor(LyXText * text, BufferView * bv, } newtop = max(newtop, 0); // can newtop ever be < 0? (Lgb) - + if (newtop != text->first_y) { draw(text, bv, newtop); text->first_y = newtop; @@ -283,14 +283,14 @@ void LyXScreen::showManualCursor(LyXText const * text, int x, int y, { // Update the cursor color. setCursorColor(); - + int const y1 = max(y - text->first_y - asc, 0); int const y_tmp = min(y - text->first_y + desc, static_cast(owner.height())); // Secure against very strange situations int const y2 = max(y_tmp, y1); - + if (cursor_pixmap) { XFreePixmap(fl_get_display(), cursor_pixmap); cursor_pixmap = 0; @@ -315,7 +315,7 @@ void LyXScreen::showManualCursor(LyXText const * text, int x, int y, break; } - cursor_pixmap = + cursor_pixmap = XCreatePixmap (fl_get_display(), fl_root, cursor_pixmap_w, @@ -362,11 +362,11 @@ void LyXScreen::hideCursor() if (!cursor_visible) return; if (cursor_pixmap) { - XCopyArea (fl_get_display(), + XCopyArea (fl_get_display(), cursor_pixmap, owner.getWin(), gc_copy, - 0, 0, + 0, 0, cursor_pixmap_w, cursor_pixmap_h, cursor_pixmap_x + owner.xpos(), cursor_pixmap_y + owner.ypos()); @@ -384,7 +384,7 @@ void LyXScreen::cursorToggle(BufferView * bv) const } -/* returns a new top so that the cursor is visible */ +/* returns a new top so that the cursor is visible */ unsigned int LyXScreen::topCursorVisible(LyXText const * text) { int newtop = text->first_y; @@ -394,7 +394,7 @@ unsigned int LyXScreen::topCursorVisible(LyXText const * text) // Is this a hack? Yes, probably... (Lgb) if (!row) return max(newtop, 0); - + if (text->cursor.y() - row->baseline() + row->height() - text->first_y >= owner.height()) { if (row->height() < owner.height() @@ -407,7 +407,7 @@ unsigned int LyXScreen::topCursorVisible(LyXText const * text) newtop = text->cursor.y() - owner.height() / 2; /* the scroll region must be so big!! */ } - + } else if (static_cast((text->cursor.y()) - row->baseline()) < text->first_y && text->first_y > 0) { if (row->height() < owner.height() @@ -427,7 +427,7 @@ unsigned int LyXScreen::topCursorVisible(LyXText const * text) /* scrolls the screen so that the cursor is visible, if necessary. -* returns true if a change was made, otherwise false */ +* returns true if a change was made, otherwise false */ bool LyXScreen::fitCursor(LyXText * text, BufferView * bv) { // Is a change necessary? @@ -438,9 +438,9 @@ bool LyXScreen::fitCursor(LyXText * text, BufferView * bv) return result; } - + void LyXScreen::update(LyXText * text, BufferView * bv, - int y_offset, int x_offset) + int y_offset, int x_offset) { switch (text->status()) { case LyXText::NEED_MORE_REFRESH: @@ -507,21 +507,21 @@ void LyXScreen::toggleSelection(LyXText * text, BufferView * bv, owner.workWidth(), bottom - text->first_y - (top - text->first_y)); } - - + + void LyXScreen::toggleToggle(LyXText * text, BufferView * bv, int y_offset, int x_offset) { if (text->toggle_cursor.par() == text->toggle_end_cursor.par() && text->toggle_cursor.pos() == text->toggle_end_cursor.pos()) return; - + int const top_tmp = text->toggle_cursor.y() - text->toggle_cursor.row()->baseline(); int const bottom_tmp = text->toggle_end_cursor.y() - - text->toggle_end_cursor.row()->baseline() + - text->toggle_end_cursor.row()->baseline() + text->toggle_end_cursor.row()->height(); - + int const bottom = min(max(bottom_tmp, text->first_y), static_cast(text->first_y + owner.height())); int const top = min(max(top_tmp, text->first_y), diff --git a/src/sp_base.h b/src/sp_base.h index df21779ad5..2a18fb1ada 100644 --- a/src/sp_base.h +++ b/src/sp_base.h @@ -21,13 +21,13 @@ class SpellBase ISP_MISSED, ISP_IGNORE }; - + virtual ~SpellBase() {} virtual void initialize(BufferParams const & , string const &) = 0; virtual bool alive() = 0; - + virtual void cleanUp() = 0; virtual enum spellStatus check(string const &) = 0; @@ -43,8 +43,7 @@ class SpellBase virtual char const * error() = 0; virtual char const * nextMiss() = 0; - + }; #endif - diff --git a/src/sp_ispell.h b/src/sp_ispell.h index 4255ca2269..62a5958627 100644 --- a/src/sp_ispell.h +++ b/src/sp_ispell.h @@ -16,11 +16,11 @@ class ISpell : public SpellBase ASC_ISPELL, ASC_ASPELL }; - + ISpell(); - + ISpell(BufferParams const & params, string const & lang); - + ~ISpell(); @@ -44,14 +44,14 @@ class ISpell : public SpellBase /// store replacement void store(string const & mis, string const & cor); - + char const * nextMiss(); char const * error(); - + private: - ActualSpellChecker actual_spell_checker; + ActualSpellChecker actual_spell_checker; /// instream to communicate with ispell FILE * in; @@ -73,9 +73,7 @@ class ISpell : public SpellBase char * b; /// char * e; - + }; - + #endif - - diff --git a/src/sp_pspell.h b/src/sp_pspell.h index 8d01c45a94..5cd0266a82 100644 --- a/src/sp_pspell.h +++ b/src/sp_pspell.h @@ -15,9 +15,9 @@ class PSpell : public SpellBase public: PSpell(); - + PSpell(BufferParams const & params, string const & lang); - + ~PSpell(); /// initialize spell checker @@ -40,15 +40,15 @@ class PSpell : public SpellBase /// store replacement void store(string const & mis, string const & cor); - + char const * nextMiss(); char const * error(); - + private: PspellManager * sc; - + PspellStringEmulation * els; PspellCanHaveError * spell_error_object; @@ -59,7 +59,5 @@ class PSpell : public SpellBase bool alive_; }; - + #endif - - diff --git a/src/sp_spell.C b/src/sp_spell.C index 3563c32cbe..a47903f650 100644 --- a/src/sp_spell.C +++ b/src/sp_spell.C @@ -1,5 +1,5 @@ /* This file is part of - * ====================================================== + * ====================================================== * * LyX, The Document Processor * @@ -56,8 +56,8 @@ using std::endl; namespace { - /// pid for the `ispell' process. - pid_t isp_pid = -1; + /// pid for the `ispell' process. + pid_t isp_pid = -1; } /// @@ -73,7 +73,7 @@ namespace { #include "sp_pspell.h" -PSpell::PSpell() +PSpell::PSpell() : sc(0), els(0), spell_error_object(0), flag(ISP_UNKNOWN), alive_(false) { @@ -88,14 +88,14 @@ PSpell::PSpell(BufferParams const & params, string const & lang) } -PSpell::~PSpell() +PSpell::~PSpell() { cleanUp(); close(); if (els) delete_pspell_string_emulation(els); } - + void PSpell::initialize(BufferParams const &, string const & lang) { @@ -113,7 +113,7 @@ void PSpell::initialize(BufferParams const &, string const & lang) } -void PSpell::cleanUp() +void PSpell::cleanUp() { if (spell_error_object) { delete_pspell_can_have_error(spell_error_object); @@ -137,9 +137,9 @@ enum PSpell::spellStatus PSpell::check(string const & word) pspell_manager_suggest(sc, word.c_str()); lyx::Assert(sugs != 0); els = pspell_word_list_elements(sugs); - if (pspell_word_list_empty(sugs)) + if (pspell_word_list_empty(sugs)) flag = ISP_UNKNOWN; - else + else flag = ISP_MISSED; } return flag; @@ -160,7 +160,7 @@ void PSpell::insert(string const & word) } -void PSpell::accept(string const & word) +void PSpell::accept(string const & word) { if (sc) pspell_manager_add_to_session(sc, word.c_str()); @@ -260,8 +260,8 @@ void ISpell::initialize(BufferParams const & params, string const & lang) << endl; goto END; } - - if (isp_pid == 0) { + + if (isp_pid == 0) { /* child process */ dup2(pipein[0], STDIN_FILENO); dup2(pipeout[1], STDOUT_FILENO); @@ -296,16 +296,16 @@ void ISpell::initialize(BufferParams const & params, string const & lang) } else { // Report run-together words with // missing blanks as errors - tmp = new char[3]; + tmp = new char[3]; string("-B").copy(tmp, 2); tmp[2] = '\0'; - argv[argc++] = tmp; + argv[argc++] = tmp; } if (lyxrc.isp_use_esc_chars) { // Specify additional characters that // can be part of a word tmp = new char[3]; string("-w").copy(tmp, 2); tmp[2] = '\0'; - argv[argc++] = tmp; + argv[argc++] = tmp; // Put the escape chars in ""s string tms = "\"" + lyxrc.isp_esc_chars + "\""; tmp = new char[tms.length() + 1]; @@ -347,7 +347,7 @@ void ISpell::initialize(BufferParams const & params, string const & lang) // setup of argv for (int i = 0; i < argc - 1; ++i) delete[] argv[i]; - + lyxerr << "LyX: Failed to start ispell!" << endl; _exit(0); } @@ -368,17 +368,17 @@ void ISpell::initialize(BufferParams const & params, string const & lang) // Configure provides us with macros which are supposed to do // the right typecast. - retval = select(SELECT_TYPE_ARG1 (pipeout[0]+1), - SELECT_TYPE_ARG234 (&infds), - 0, - 0, + retval = select(SELECT_TYPE_ARG1 (pipeout[0]+1), + SELECT_TYPE_ARG234 (&infds), + 0, + 0, SELECT_TYPE_ARG5 (&tv)); if (retval > 0) { // Ok, do the reading. We don't have to FD_ISSET since // there is only one fd in infds. fgets(buf, 2048, in); - + // determine if the spell checker is really Aspell if (strstr(buf, "Aspell")) actual_spell_checker = ASC_ASPELL; @@ -387,7 +387,7 @@ void ISpell::initialize(BufferParams const & params, string const & lang) fputs("!\n", out); // Set terse mode (silently accept correct words) - + } else if (retval == 0) { // timeout. Give nice message to user. lyxerr << "Ispell read timed out, what now?" << endl; @@ -405,7 +405,7 @@ void ISpell::initialize(BufferParams const & params, string const & lang) } END: if (isp_pid == -1) { - error_ = + error_ = "\n\n" "The spellcheck-process has died for some reason.\n" "*One* possible reason could be that you do not have\n" @@ -425,20 +425,20 @@ void ISpell::initialize(BufferParams const & params, string const & lang) */ void reapSpellchecker(void) { - if (isp_pid == -1) + if (isp_pid == -1) return; waitpid(isp_pid, 0, WNOHANG); } - + bool ISpell::alive() { return isp_pid != -1; } -void ISpell::cleanUp() +void ISpell::cleanUp() { ::fclose(out); } @@ -450,12 +450,12 @@ enum ISpell::spellStatus ISpell::check(string const & word) ::fputs(word.c_str(), out); ::fputc('\n', out); - + char buf[1024]; - ::fgets(buf, 1024, in); - + ::fgets(buf, 1024, in); + // I think we have to check if ispell is still alive here because - // the signal-handler could have disabled blocking on the fd + // the signal-handler could have disabled blocking on the fd if (!alive()) return ISP_UNKNOWN; switch (*buf) { @@ -498,8 +498,8 @@ enum ISpell::spellStatus ISpell::check(string const & word) void ISpell::close() { - // Note: If you decide to optimize this out when it is not - // needed please note that when Aspell is used this command + // Note: If you decide to optimize this out when it is not + // needed please note that when Aspell is used this command // is also needed to save the replacement dictionary. // -- Kevin Atkinson (kevinatk@home.com) @@ -518,7 +518,7 @@ void ISpell::insert(string const & word) } -void ISpell::accept(string const & word) +void ISpell::accept(string const & word) { ::fputc('@', out); // Accept in this session ::fputs(word.c_str(), out); diff --git a/src/stl_string_fwd.h b/src/stl_string_fwd.h index c8152258cd..3606c8268a 100644 --- a/src/stl_string_fwd.h +++ b/src/stl_string_fwd.h @@ -1,9 +1,9 @@ // -*- C++ -*- /* This file is part of * ====================================================== - * + * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team. * @@ -15,7 +15,7 @@ /* * This file exists to appease STLPort when using included lyxstring. * It won't be around forever ... - */ + */ #ifndef USE_INCLUDED_STRING // include the real stl_string_fwd.h diff --git a/src/tabular-old.C b/src/tabular-old.C index 3e06db9a68..1f7d9f576d 100644 --- a/src/tabular-old.C +++ b/src/tabular-old.C @@ -1,13 +1,13 @@ /* This file is part of - * ====================================================== - * + * ====================================================== + * * LyX, The Document Processor - * + * * Copyright 2000-2001 The LyX Team. * * @author: Jürgen Vigna * - * ====================================================== + * ====================================================== */ #include @@ -134,7 +134,7 @@ bool getTokenValue(string const & str, const char * token, LyXLength & len) if (!getTokenValue(str, token, tmp)) return false; return isValidLength(tmp, &len); -} +} inline diff --git a/src/tabular.C b/src/tabular.C index d80ed83234..d38a35714d 100644 --- a/src/tabular.C +++ b/src/tabular.C @@ -1,13 +1,13 @@ /* This file is part of - * ====================================================== - * + * ====================================================== + * * LyX, The Document Processor - * + * * Copyright 2000-2002 The LyX Team. * * @author: Jürgen Vigna * - * ====================================================== + * ====================================================== */ #include @@ -76,7 +76,7 @@ LyXTabular::cellstruct::cellstruct(BufferParams const & bg) } -LyXTabular::rowstruct::rowstruct() +LyXTabular::rowstruct::rowstruct() { top_line = true; bottom_line = false; @@ -90,7 +90,7 @@ LyXTabular::rowstruct::rowstruct() } -LyXTabular::columnstruct::columnstruct() +LyXTabular::columnstruct::columnstruct() { left_line = true; right_line = false; @@ -120,7 +120,7 @@ LyXTabular::LyXTabular(BufferParams const & bp, LyXTabular::LyXTabular(BufferParams const & bp, InsetTabular * inset, LyXTabular const & lt, - bool same_id) + bool same_id) { owner_ = inset; cur_cell = -1; @@ -196,9 +196,9 @@ LyXTabular * LyXTabular::clone(BufferParams const & bp, } -/* activates all lines and sets all widths to 0 */ +/* activates all lines and sets all widths to 0 */ void LyXTabular::Init(BufferParams const & bp, - int rows_arg, int columns_arg, LyXTabular const * lt) + int rows_arg, int columns_arg, LyXTabular const * lt) { rows_ = rows_arg; columns_ = columns_arg; @@ -227,7 +227,7 @@ void LyXTabular::Init(BufferParams const & bp, calculate_width_of_column(i); } column_info.back().right_line = true; - + calculate_width_of_tabular(); rowofcell = vector(); @@ -241,7 +241,7 @@ void LyXTabular::Init(BufferParams const & bp, void LyXTabular::AppendRow(BufferParams const & bp, int cell) { ++rows_; - + int row = row_of_cell(cell); row_vector::iterator rit = row_info.begin() + row; @@ -279,7 +279,7 @@ void LyXTabular::AppendRow(BufferParams const & bp, int cell) void LyXTabular::DeleteRow(int row) { if (rows_ == 1) return; // Not allowed to delete last row - + row_info.erase(row_info.begin() + row); //&row_info[row]); cell_info.erase(cell_info.begin() + row); //&cell_info[row]); --rows_; @@ -290,7 +290,7 @@ void LyXTabular::DeleteRow(int row) void LyXTabular::AppendColumn(BufferParams const & bp, int cell) { ++columns_; - + cell_vvector c_info = cell_vvector(rows_, cell_vector(columns_, cellstruct(bp))); int const column = column_of_cell(cell); @@ -333,7 +333,7 @@ void LyXTabular::DeleteColumn(int column) //if (!(columns_ - 1)) //return; if (columns_ == 1) return; // Not allowed to delete last column - + column_info.erase(column_info.begin() + column); for (int i = 0; i < rows_; ++i) { cell_info[i].erase(cell_info[i].begin() + column); @@ -359,7 +359,7 @@ void LyXTabular::Reinit(bool reset_widths) } } } - + for (int i = 0; i < columns_; ++i) { calculate_width_of_column(i); } @@ -438,11 +438,11 @@ int LyXTabular::NumberOfCellsInRow(int cell) const } -/* returns 1 if there is a topline, returns 0 if not */ +/* returns 1 if there is a topline, returns 0 if not */ bool LyXTabular::TopLine(int cell, bool onlycolumn) const { int const row = row_of_cell(cell); - + if (!onlycolumn && IsMultiColumn(cell)) return cellinfo_of_cell(cell)->top_line; return row_info[row].top_line; @@ -602,7 +602,7 @@ int LyXTabular::GetAdditionalWidth(int cell) const } -// returns the maximum over all rows +// returns the maximum over all rows int LyXTabular::GetWidthOfColumn(int cell) const { int const column1 = column_of_cell(cell); @@ -621,17 +621,17 @@ int LyXTabular::GetWidthOfTabular() const } -/* returns 1 if a complete update is necessary, otherwise 0 */ +/* returns 1 if a complete update is necessary, otherwise 0 */ bool LyXTabular::SetWidthOfMulticolCell(int cell, int new_width) { if (!IsMultiColumn(cell)) return false; - + int const row = row_of_cell(cell); int const column1 = column_of_cell(cell); int const column2 = right_column_of_cell(cell); int const old_val = cell_info[row][column2].width_of_cell; - + // first set columns to 0 so we can calculate the right width for (int i = column1; i <= column2; ++i) { cell_info[row][i].width_of_cell = 0; @@ -675,13 +675,13 @@ void LyXTabular::recalculateMulticolumnsOfColumn(int column) { int const cellno = cell_info[row][column].cellno; SetWidthOfMulticolCell(cellno, - GetWidthOfCell(cellno)-(2 * WIDTH_OF_LINE)); + GetWidthOfCell(cellno)-(2 * WIDTH_OF_LINE)); } } } -/* returns 1 if a complete update is necessary, otherwise 0 */ +/* returns 1 if a complete update is necessary, otherwise 0 */ bool LyXTabular::SetWidthOfCell(int cell, int new_width) { int const row = row_of_cell(cell); @@ -775,7 +775,7 @@ bool LyXTabular::SetMColumnPWidth(int cell, LyXLength const & width) bool LyXTabular::SetAlignSpecial(int cell, string const & special, - LyXTabular::Feature what) + LyXTabular::Feature what) { if (what == SET_SPECIAL_MULTI) cellinfo_of_cell(cell)->align_special = special; @@ -902,7 +902,7 @@ int LyXTabular::GetWidthOfCell(int cell) const int LyXTabular::GetBeginningOfTextInCell(int cell) const { int x = 0; - + switch (GetAlignment(cell)) { case LYX_ALIGN_CENTER: x += (GetWidthOfColumn(cell) - GetWidthOfCell(cell)) / 2; @@ -911,10 +911,10 @@ int LyXTabular::GetBeginningOfTextInCell(int cell) const x += GetWidthOfColumn(cell) - GetWidthOfCell(cell); // + GetAdditionalWidth(cell); break; - default: /* LYX_ALIGN_LEFT: nothing :-) */ + default: /* LYX_ALIGN_LEFT: nothing :-) */ break; } - + // the LaTeX Way :-( x += WIDTH_OF_LINE; return x; @@ -952,7 +952,7 @@ bool LyXTabular::calculate_width_of_column(int column) { int const old_column_width = column_info[column].width_of_column; int maximum = 0; - + for (int i = 0; i < rows_; ++i) { maximum = max(cell_info[i][column].width_of_cell, maximum); } @@ -1314,7 +1314,7 @@ void LyXTabular::ReadNew(Buffer const * buf, istream & is, void LyXTabular::OldFormatRead(BufferParams const & bp, - LyXLex & lex, string const & fl) + LyXLex & lex, string const & fl) { int version; int i; @@ -1330,7 +1330,7 @@ void LyXTabular::OldFormatRead(BufferParams const & bp, int e = 0; int f = 0; int g = 0; - + istream & is = lex.getStream(); string s(fl); if (s.length() > 8) @@ -1395,7 +1395,7 @@ void LyXTabular::OldFormatRead(BufferParams const & bp, #else // ignore is buggy but we will use it later (Lgb) is.ignore(); // skip '"' -#endif +#endif getline(is, s1, '"'); #if 1 is >> ch; // skip '"' @@ -1586,9 +1586,9 @@ int LyXTabular::UnsetMultiColumn(int cell) { int const row = row_of_cell(cell); int column = column_of_cell(cell); - + int result = 0; - + if (cell_info[row][column].multicolumn == CELL_BEGIN_OF_MULTICOLUMN) { cell_info[row][column].multicolumn = CELL_NORMAL; ++column; @@ -1988,7 +1988,7 @@ int LyXTabular::TeXCellPreamble(ostream & os, int cell) const os << cellinfo_of_cell(cell)->align_special << "}{"; } else { if (LeftLine(cell) && - (IsFirstCellInRow(cell) || + (IsFirstCellInRow(cell) || (!IsMultiColumn(cell-1) && !LeftLine(cell, true) && !RightLine(cell-1, true)))) { @@ -2085,7 +2085,7 @@ int LyXTabular::TeXCellPostamble(ostream & os, int cell) const int LyXTabular::TeXLongtableHeaderFooter(ostream & os, Buffer const * buf, - bool fragile, bool fp) const + bool fragile, bool fp) const { if (!is_long_tabular) return 0; @@ -2185,7 +2185,7 @@ bool LyXTabular::isValidRow(int const row) const int LyXTabular::TeXRow(ostream & os, int const i, Buffer const * buf, - bool fragile, bool fp) const + bool fragile, bool fp) const { int ret = 0; int cell = GetCellNumber(i, 0); @@ -2240,7 +2240,7 @@ int LyXTabular::latex(Buffer const * buf, for (int i = 0; i < columns_; ++i) { if (!column_info[i].align_special.empty()) { os << column_info[i].align_special; - } else { + } else { if (column_info[i].left_line) os << '|'; if (!column_info[i].p_width.zero()) { @@ -2279,7 +2279,7 @@ int LyXTabular::latex(Buffer const * buf, ++ret; ret += TeXLongtableHeaderFooter(os, buf, fragile, fp); - + //+--------------------------------------------------------------------- //+ the single row and columns (cells) + //+--------------------------------------------------------------------- @@ -2315,7 +2315,7 @@ int LyXTabular::docbookRow(Buffer const * buf, ostream & os, int row) const { int ret = 0; int cell = GetFirstCellInRow(row); - + os << "\n"; for (int j = 0; j < columns_; ++j) { if (IsPartOfMultiColumn(row, j)) @@ -2359,7 +2359,7 @@ int LyXTabular::docbookRow(Buffer const * buf, ostream & os, int row) const } os << "\n"; return ret; -} +} int LyXTabular::docBook(Buffer const * buf, ostream & os) const @@ -2372,7 +2372,7 @@ int LyXTabular::docBook(Buffer const * buf, ostream & os) const os << "\n"; - + for (int i = 0; i < columns_; ++i) { os << " const & clen) const + vector const & clen) const { int const fcell = GetFirstCellInRow(row); int const n = NumberOfCellsInRow(fcell) + fcell; @@ -2493,7 +2493,7 @@ int LyXTabular::asciiTopHLine(ostream & os, int row, int LyXTabular::asciiBottomHLine(ostream & os, int row, - vector const & clen) const + vector const & clen) const { int const fcell = GetFirstCellInRow(row); int const n = NumberOfCellsInRow(fcell) + fcell; @@ -2540,9 +2540,9 @@ int LyXTabular::asciiBottomHLine(ostream & os, int row, int LyXTabular::asciiPrintCell(Buffer const * buf, ostream & os, - int cell, int row, int column, - vector const & clen, - bool onlydata) const + int cell, int row, int column, + vector const & clen, + bool onlydata) const { ostringstream sstr; int ret = GetCellInset(cell)->ascii(buf, sstr, 0); @@ -2551,7 +2551,7 @@ int LyXTabular::asciiPrintCell(Buffer const * buf, ostream & os, os << sstr.str(); return ret; } - + if (LeftLine(cell)) os << "| "; else @@ -2688,7 +2688,7 @@ int LyXTabular::GetCellFromInset(Inset const * inset, int maybe_cell) const << "this is not a cell of the tabular!" << endl; return -1; } - + const int save_cur_cell = cur_cell; int cell = cur_cell; if (GetCellInset(cell) != inset) { @@ -2697,7 +2697,7 @@ int LyXTabular::GetCellFromInset(Inset const * inset, int maybe_cell) const cell = -1; } } - + if (cell == -1) { for (cell = GetNumberOfCells(); cell >= 0; --cell) { if (GetCellInset(cell) == inset) @@ -2706,7 +2706,7 @@ int LyXTabular::GetCellFromInset(Inset const * inset, int maybe_cell) const lyxerr[Debug::INSETTEXT] << "LyXTabular::GetCellFromInset: " << "cell=" << cell - << ", cur_cell=" << save_cur_cell + << ", cur_cell=" << save_cur_cell << ", maybe_cell=" << maybe_cell << endl; // We should have found a cell at this point @@ -2715,7 +2715,7 @@ int LyXTabular::GetCellFromInset(Inset const * inset, int maybe_cell) const << "Cell not found!" << endl; } } - + return cell; } @@ -2747,7 +2747,7 @@ vector const LyXTabular::getLabelList() const return label_list; } - + LyXTabular::BoxType LyXTabular::UseParbox(int cell) const { Paragraph * par = GetCellInset(cell)->paragraph(); diff --git a/src/tabular.h b/src/tabular.h index 50c2e51fa3..b3432cfcfe 100644 --- a/src/tabular.h +++ b/src/tabular.h @@ -1,9 +1,9 @@ // -*- C++ -*- /* This file is part of - * ====================================================== - * + * ====================================================== + * * LyX, The Document Processor - * + * * Copyright 2000-2001 The LyX Team. * * @author: Jürgen Vigna @@ -30,7 +30,7 @@ class InsetTabular; class LaTeXFeatures; class Buffer; -/* The features the text class offers for tables */ +/* The features the text class offers for tables */ /// class LyXTabular { @@ -175,7 +175,7 @@ public: }; /// typedef struct lttype ltType; - + /* konstruktor */ /// LyXTabular(BufferParams const &, @@ -191,7 +191,7 @@ public: /// LyXTabular * clone(BufferParams const &, InsetTabular *, bool same_id = false); - + /// Returns true if there is a topline, returns false if not bool TopLine(int cell, bool onlycolumn = false) const; /// Returns true if there is a topline, returns false if not @@ -200,7 +200,7 @@ public: bool LeftLine(int cell, bool onlycolumn = false) const; /// Returns true if there is a topline, returns false if not bool RightLine(int cell, bool onlycolumn = false) const; - + /// bool TopAlreadyDrawed(int cell) const; /// @@ -212,7 +212,7 @@ public: int GetAdditionalHeight(int row) const; /// int GetAdditionalWidth(int cell) const; - + /* returns the maximum over all rows */ /// int GetWidthOfColumn(int cell) const; @@ -300,7 +300,7 @@ public: int docBook(Buffer const * buf, std::ostream & os) const; /// int ascii(Buffer const *, std::ostream &, int const depth, - bool onlydata, unsigned char delim) const; + bool onlydata, unsigned char delim) const; /// bool IsMultiColumn(int cell, bool real = false) const; /// @@ -566,24 +566,24 @@ private: int TeXCellPostamble(std::ostream &, int cell) const; /// int TeXLongtableHeaderFooter(std::ostream &, Buffer const * buf, - bool fragile, bool fp) const; + bool fragile, bool fp) const; /// bool isValidRow(int const row) const; /// int TeXRow(std::ostream &, int const row, Buffer const * buf, - bool fragile, bool fp) const; + bool fragile, bool fp) const; /// // helper function for ASCII returns number of newlines /// int asciiTopHLine(std::ostream &, int row, - std::vector const &) const; + std::vector const &) const; /// int asciiBottomHLine(std::ostream &, int row, - std::vector const &) const; + std::vector const &) const; /// int asciiPrintCell(Buffer const *, std::ostream &, - int cell, int row, int column, - std::vector const &, + int cell, int row, int column, + std::vector const &, bool onlydata) const; /// auxiliary function for docbook int docbookRow(Buffer const * buf, std::ostream & os, int row) const; diff --git a/src/tabular_funcs.C b/src/tabular_funcs.C index dcb87be801..dd1a2a01c5 100644 --- a/src/tabular_funcs.C +++ b/src/tabular_funcs.C @@ -1,13 +1,13 @@ /* This file is part of - * ====================================================== - * + * ====================================================== + * * LyX, The Document Processor - * + * * Copyright 2000-2001 The LyX Team. * * @author: Jürgen Vigna * - * ====================================================== + * ====================================================== */ #include @@ -34,7 +34,7 @@ string const write_attribute(string const & name, bool const & b) // file format bloat for tabulars. if (!b) return string(); - + return write_attribute(name, tostr(b)); } @@ -45,7 +45,7 @@ string const write_attribute(string const & name, int const & i) // file format bloat for tabulars. if (!i) return string(); - + return write_attribute(name, tostr(i)); } @@ -55,7 +55,7 @@ string const write_attribute(string const & name, LyXLength const & value) // we write only the value if we really have one same reson as above. if (value.zero()) return string(); - + return write_attribute(name, value.asString()); } @@ -238,7 +238,7 @@ bool getTokenValue(string const & str, const char * token, bool & flag) if (!getTokenValue(str, token, tmp)) return false; return string2type(tmp, flag); -} +} bool getTokenValue(string const & str, const char * token, LyXLength & len) @@ -250,7 +250,7 @@ bool getTokenValue(string const & str, const char * token, LyXLength & len) if (!getTokenValue(str, token, tmp)) return false; return isValidLength(tmp, &len); -} +} void l_getline(istream & is, string & str) diff --git a/src/tabular_funcs.h b/src/tabular_funcs.h index fd686e1575..5db625f438 100644 --- a/src/tabular_funcs.h +++ b/src/tabular_funcs.h @@ -1,14 +1,14 @@ // -*- C++ -*- /* This file is part of - * ====================================================== - * + * ====================================================== + * * LyX, The Document Processor - * + * * Copyright 2000-2001 The LyX Team. * * @author: Jürgen Vigna * - * ====================================================== + * ====================================================== */ #ifndef TABULAR_FUNCS_H @@ -30,7 +30,7 @@ string const write_attribute(string const & name, T const & t) { if (tostr(t).empty()) return string(); - + string str = " " + name + "=\"" + tostr(t) + "\""; return str; } @@ -52,14 +52,14 @@ extern bool string2type(string const str, bool & num); extern bool getTokenValue(string const & str, char const * token, string &ret); extern bool getTokenValue(string const & str, char const * token, int & num); extern bool getTokenValue(string const & str, char const * token, - LyXAlignment & num); + LyXAlignment & num); extern bool getTokenValue(string const & str, char const * token, - LyXTabular::VAlignment & num); + LyXTabular::VAlignment & num); extern bool getTokenValue(string const & str, char const * token, - LyXTabular::BoxType & num); + LyXTabular::BoxType & num); extern bool getTokenValue(string const & str, char const * token, bool & flag); extern bool getTokenValue(string const & str, char const * token, - LyXLength & len); + LyXLength & len); extern void l_getline(std::istream & is, string & str); #endif diff --git a/src/tex-accent.C b/src/tex-accent.C index a184f74291..eb65f1df6a 100644 --- a/src/tex-accent.C +++ b/src/tex-accent.C @@ -1,8 +1,8 @@ /* This file is part of - * ====================================================== - * + * ====================================================== + * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team. * @@ -89,7 +89,7 @@ tex_accent_struct get_accent(kb_action action) string const DoAccent(string const & s, tex_accent accent) { string res; - + res += lyx_accent_table[accent].cmd; res += '{'; if (s == "i" || s == "j") { @@ -105,4 +105,3 @@ string const DoAccent(char c, tex_accent accent) { return DoAccent(tostr(c), accent); } - diff --git a/src/tex-accent.h b/src/tex-accent.h index e2b85f8952..66ae1b97f1 100644 --- a/src/tex-accent.h +++ b/src/tex-accent.h @@ -1,9 +1,9 @@ // -*- C++ -*- /* This file is part of - * ====================================================== - * + * ====================================================== + * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team. * @@ -110,5 +110,5 @@ struct tex_accent_struct { /// extern tex_accent_struct lyx_accent_table[]; - + #endif diff --git a/src/tex-strings.C b/src/tex-strings.C index c9e97dbe95..5c217e75fd 100644 --- a/src/tex-strings.C +++ b/src/tex-strings.C @@ -1,8 +1,8 @@ /* This file is part of - * ====================================================== - * + * ====================================================== + * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team. * @@ -19,17 +19,17 @@ // this file should perhaps be split into even smaller parts char const * string_paragraph_separation[3] = { - "indent", "skip", "" + "indent", "skip", "" }; char const * string_quotes_language[7] = { - "english", "swedish", "german", "polish", "french", "danish", "" -}; + "english", "swedish", "german", "polish", "french", "danish", "" +}; char const * string_papersize[12] = { - "Default", "Custom", "letterpaper", "executivepaper", "legalpaper", + "Default", "Custom", "letterpaper", "executivepaper", "legalpaper", "a3paper", "a4paper", "a5paper", "b3paper", "b4paper", "b5paper", "" }; @@ -45,17 +45,17 @@ char const * string_orientation[3] = { char const * string_footnotekinds[8] = { - "footnote", "margin", "fig", "tab", "alg", "wide-fig", "wide-tab", "" + "footnote", "margin", "fig", "tab", "alg", "wide-fig", "wide-tab", "" }; char const * string_align[5] = { - "block", "left", "right", "center", "" + "block", "left", "right", "center", "" }; // The following was moved from tex-defs.h to here, because tex-defs.h is -// used all over. As it happens, that meant that these strings were included +// used all over. As it happens, that meant that these strings were included // 27 times in the object file. (Asger) char const * tex_graphics[] = {"default", "dvips", "dvitops", "emtex", @@ -64,5 +64,3 @@ char const * tex_graphics[] = {"default", "dvips", "dvitops", "emtex", char const * tex_fonts[] = {"default", "ae", "pslatex", "times", "palatino", "helvet", "avant", "newcent", "bookman", ""}; - - diff --git a/src/tex-strings.h b/src/tex-strings.h index 9916342126..a0a67023c1 100644 --- a/src/tex-strings.h +++ b/src/tex-strings.h @@ -1,9 +1,9 @@ // -*- C++ -*- /* This file is part of - * ====================================================== - * + * ====================================================== + * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team. * @@ -34,7 +34,7 @@ extern char const * string_footnotekinds[]; extern char const * string_align[]; // The following was moved from tex-defs.h to here, because tex-defs.h is -// used all over. As it happens, that meant that these strings were included +// used all over. As it happens, that meant that these strings were included // 27 times in the object file. (Asger) /// diff --git a/src/texrow.C b/src/texrow.C index 5d9f3116d4..84d9c7ce00 100644 --- a/src/texrow.C +++ b/src/texrow.C @@ -1,8 +1,8 @@ /* This file is part of - * ====================================================== - * + * ====================================================== + * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team. * @@ -73,7 +73,7 @@ bool TexRow::getIdFromRow(int row, int & id, int & pos) const vt.rownumber(row); RowList::const_iterator cit = find_if(rowlist.begin(), rowlist.end(), same_rownumber(vt)); - + if (cit != rowlist.end()) { id = cit->id(); pos = cit->pos(); @@ -118,4 +118,4 @@ TexRow & TexRow::operator+= (TexRow const & tr) { rowlist.insert(rowlist.end(), tr.rowlist.begin(), tr.rowlist.end()); return *this; -} +} diff --git a/src/texrow.h b/src/texrow.h index 0c3adb3330..700bcd67df 100644 --- a/src/texrow.h +++ b/src/texrow.h @@ -1,9 +1,9 @@ // -*- C++ -*- /* This file is part of - * ====================================================== - * + * ====================================================== + * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team * @@ -94,6 +94,6 @@ private: Paragraph * lastpar; /// Last position int lastpos; - + }; #endif diff --git a/src/text.C b/src/text.C index f96bd64089..6898b18145 100644 --- a/src/text.C +++ b/src/text.C @@ -1,8 +1,8 @@ /* This file is part of - * ====================================================== - * + * ====================================================== + * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team. * @@ -87,11 +87,11 @@ int LyXText::workWidth(BufferView * bview, Inset * inset) const } } } - + if (!par) { return workWidth(bview); } - + LyXLayout const & layout = textclasslist[bview->buffer()->params.textclass][par->layout()]; @@ -188,7 +188,7 @@ unsigned char LyXText::transformChar(unsigned char c, Paragraph * par, // Lgb int LyXText::singleWidth(BufferView * bview, Paragraph * par, - pos_type pos) const + pos_type pos) const { char const c = par->getChar(pos); return singleWidth(bview, par, pos, c); @@ -196,7 +196,7 @@ int LyXText::singleWidth(BufferView * bview, Paragraph * par, int LyXText::singleWidth(BufferView * bview, Paragraph * par, - pos_type pos, char c) const + pos_type pos, char c) const { LyXFont const font = getFont(bview->buffer(), par, pos); @@ -282,7 +282,7 @@ void LyXText::computeBidiTables(Buffer const * buf, Row * row) const if (bidi_end + 2 - bidi_start > static_cast(log2vis_list.size())) { - pos_type new_size = + pos_type new_size = (bidi_end + 2 - bidi_start < 500) ? 500 : 2 * (bidi_end + 2 - bidi_start); log2vis_list.resize(new_size); @@ -427,27 +427,27 @@ void LyXText::drawNewline(DrawRowParams & p, pos_type const pos) int const y = p.yo + p.row->baseline(); int xp[3]; int yp[3]; - + yp[0] = int(y - 0.875 * asc * 0.75); yp[1] = int(y - 0.500 * asc * 0.75); yp[2] = int(y - 0.125 * asc * 0.75); - + if (bidi_level(pos) % 2 == 0) { xp[0] = int(p.x + wid * 0.375); xp[1] = int(p.x); xp[2] = int(p.x + wid * 0.375); - } else { + } else { xp[0] = int(p.x + wid * 0.625); xp[1] = int(p.x + wid); xp[2] = int(p.x + wid * 0.625); } - + p.pain->lines(xp, yp, 3, LColor::eolmarker); - + yp[0] = int(y - 0.500 * asc * 0.75); yp[1] = int(y - 0.500 * asc * 0.75); yp[2] = int(y - asc * 0.75); - + if (bidi_level(pos) % 2 == 0) { xp[0] = int(p.x); xp[1] = int(p.x + wid); @@ -457,13 +457,13 @@ void LyXText::drawNewline(DrawRowParams & p, pos_type const pos) xp[1] = int(p.x); xp[2] = int(p.x); } - + p.pain->lines(xp, yp, 3, LColor::eolmarker); p.x += wid; } - + void LyXText::drawInset(DrawRowParams & p, pos_type const pos) { Inset * inset = p.row->par()->getInset(pos); @@ -472,13 +472,13 @@ void LyXText::drawInset(DrawRowParams & p, pos_type const pos) if (!inset) { return; } - + LyXFont const & font = getFont(p.bv->buffer(), p.row->par(), pos); inset->update(p.bv, font, false); inset->draw(p.bv, font, p.yo + p.row->baseline(), p.x, p.cleared); - - if (!need_break_row && !inset_owner + + if (!need_break_row && !inset_owner && p.bv->text->status() == CHANGED_IN_DRAW) { Row * prev = p.row->previous(); if (prev && prev->par() == p.row->par()) { @@ -501,72 +501,72 @@ void LyXText::drawInset(DrawRowParams & p, pos_type const pos) void LyXText::drawForeignMark(DrawRowParams & p, float const orig_x, LyXFont const & orig_font) { if (!lyxrc.mark_foreign_language) - return; + return; if (orig_font.language() == latex_language) return; if (orig_font.language() == p.bv->buffer()->params.language) return; - + int const y = p.yo + p.row->height() - 1; p.pain->line(int(orig_x), y, int(p.x), y, LColor::language); } - + void LyXText::drawHebrewComposeChar(DrawRowParams & p, pos_type & vpos) { pos_type pos = vis2log(vpos); - + string str; - // first char + // first char char c = p.row->par()->getChar(pos); str += c; - ++vpos; - + ++vpos; + LyXFont const & font = getFont(p.bv->buffer(), p.row->par(), pos); int const width = lyxfont::width(c, font); int dx = 0; - + for (pos_type i = pos-1; i >= 0; --i) { c = p.row->par()->getChar(i); if (!Encodings::IsComposeChar_hebrew(c)) { if (IsPrintableNonspace(c)) { - int const width2 = + int const width2 = singleWidth(p.bv, p.row->par(), i, c); // dalet / resh dx = (c == 'ø' || c == 'ã') - ? width2 - width + ? width2 - width : (width2 - width) / 2; } break; } } - + // Draw nikud p.pain->text(int(p.x) + dx, p.yo + p.row->baseline(), str, font); } - + void LyXText::drawArabicComposeChar(DrawRowParams & p, pos_type & vpos) { pos_type pos = vis2log(vpos); string str; - - // first char + + // first char char c = p.row->par()->getChar(pos); c = transformChar(c, p.row->par(), pos); str +=c; ++vpos; - + LyXFont const & font = getFont(p.bv->buffer(), p.row->par(), pos); int const width = lyxfont::width(c, font); int dx = 0; - + for (pos_type i = pos-1; i >= 0; --i) { c = p.row->par()->getChar(i); if (!Encodings::IsComposeChar_arabic(c)) { if (IsPrintableNonspace(c)) { - int const width2 = + int const width2 = singleWidth(p.bv, p.row->par(), i, c); dx = (width2 - width) / 2; } @@ -576,15 +576,15 @@ void LyXText::drawArabicComposeChar(DrawRowParams & p, pos_type & vpos) // Draw nikud p.pain->text(int(p.x) + dx, p.yo + p.row->baseline(), str, font); } - - + + void LyXText::drawChars(DrawRowParams & p, pos_type & vpos, - bool hebrew, bool arabic) + bool hebrew, bool arabic) { pos_type pos = vis2log(vpos); pos_type const last = rowLastPrintable(p.row); LyXFont const & orig_font = getFont(p.bv->buffer(), p.row->par(), pos); - + // first character string str; str += p.row->par()->getChar(pos); @@ -597,28 +597,28 @@ void LyXText::drawChars(DrawRowParams & p, pos_type & vpos, // collect as much similar chars as we can while (vpos <= last && (pos = vis2log(vpos)) >= 0) { char c = p.row->par()->getChar(pos); - + if (!IsPrintableNonspace(c)) break; - + if (arabic && Encodings::IsComposeChar_arabic(c)) break; if (hebrew && Encodings::IsComposeChar_hebrew(c)) break; - + if (orig_font != getFont(p.bv->buffer(), p.row->par(), pos)) break; - + str += c; ++vpos; } - + // Draw text and set the new x position p.pain->text(int(p.x), p.yo + p.row->baseline(), str, orig_font); p.x += lyxfont::width(str, orig_font); } - + void LyXText::draw(DrawRowParams & p, pos_type & vpos) { pos_type const pos = vis2log(vpos); @@ -627,9 +627,9 @@ void LyXText::draw(DrawRowParams & p, pos_type & vpos) LyXFont const & orig_font = getFont(p.bv->buffer(), par, pos); float const orig_x = p.x; - + char const c = par->getChar(pos); - + if (IsNewlineChar(c)) { ++vpos; drawNewline(p, pos); @@ -645,7 +645,7 @@ void LyXText::draw(DrawRowParams & p, pos_type & vpos) // special case languages bool const hebrew = (orig_font.language()->lang() == "hebrew"); - bool const arabic = + bool const arabic = orig_font.language()->lang() == "arabic" && (lyxrc.font_norm_type == LyXRC::ISO_8859_6_8 || lyxrc.font_norm_type == LyXRC::ISO_10646_1); @@ -662,7 +662,7 @@ void LyXText::draw(DrawRowParams & p, pos_type & vpos) } drawForeignMark(p, orig_x, orig_font); - + #ifdef INHERIT_LANGUAGE #ifdef WITH_WARNINGS if ((font.language() == inherit_language) || @@ -673,8 +673,8 @@ void LyXText::draw(DrawRowParams & p, pos_type & vpos) } -// Returns the left beginning of the text. -// This information cannot be taken from the layouts-objekt, because in +// Returns the left beginning of the text. +// This information cannot be taken from the layouts-objekt, because in // LaTeX the beginning of the text fits in some cases (for example sections) // exactly the label-width. int LyXText::leftMargin(BufferView * bview, Row const * row) const @@ -682,11 +682,11 @@ int LyXText::leftMargin(BufferView * bview, Row const * row) const LyXTextClass const & tclass = textclasslist[bview->buffer()->params.textclass]; LyXLayout const & layout = tclass[row->par()->layout()]; - - string parindent = layout.parindent; + + string parindent = layout.parindent; int x = LYX_PAPER_MARGIN; - + x += lyxfont::signedWidth(tclass.leftmargin(), tclass.defaultfont()); // this is the way, LyX handles the LaTeX-Environments. @@ -705,12 +705,12 @@ int LyXText::leftMargin(BufferView * bview, Row const * row) const } } else { // find the next level paragraph - + Paragraph * newpar = row->par()->outerHook(); - + // make a corresponding row. Needed to call LeftMargin() - + // check wether it is a sufficent paragraph if (newpar && tclass[newpar->layout()].isEnvironment()) { Row dummyrow; @@ -732,7 +732,7 @@ int LyXText::leftMargin(BufferView * bview, Row const * row) const parindent = tclass[newpar->layout()].parindent; } } - + LyXFont const labelfont = getLabelFont(bview->buffer(), row->par()); switch (layout.margintype) { case MARGIN_DYNAMIC: @@ -788,35 +788,35 @@ int LyXText::leftMargin(BufferView * bview, Row const * row) const x += lyxfont::width(layout.labelsep, labelfont); x += lyxfont::width(row->par()->getLabelstring(), labelfont); - } + } break; - + case MARGIN_RIGHT_ADDRESS_BOX: { // ok, a terrible hack. The left margin depends on the widest // row in this paragraph. Do not care about footnotes, they // are *NOT* allowed in the LaTeX realisation of this layout. - + // find the first row of this paragraph Row const * tmprow = row; while (tmprow->previous() && tmprow->previous()->par() == row->par()) tmprow = tmprow->previous(); - + int minfill = tmprow->fill(); while (tmprow->next() && tmprow->next()->par() == row->par()) { tmprow = tmprow->next(); if (tmprow->fill() < minfill) minfill = tmprow->fill(); } - + x += lyxfont::signedWidth(layout.leftmargin, tclass.defaultfont()); x += minfill; } break; } - + LyXAlignment align; // wrong type if (row->par()->params().align() == LYX_ALIGN_LAYOUT) @@ -826,8 +826,8 @@ int LyXText::leftMargin(BufferView * bview, Row const * row) const // set the correct parindent if (row->pos() == 0) { - if ((layout.labeltype == LABEL_NO_LABEL - || layout.labeltype == LABEL_TOP_ENVIRONMENT + if ((layout.labeltype == LABEL_NO_LABEL + || layout.labeltype == LABEL_TOP_ENVIRONMENT || layout.labeltype == LABEL_CENTERED_TOP_ENVIRONMENT || (layout.labeltype == LABEL_STATIC && layout.latextype == LATEX_ENVIRONMENT @@ -848,7 +848,7 @@ int LyXText::leftMargin(BufferView * bview, Row const * row) const x += bibitemMaxWidth(bview, tclass.defaultfont()); } } - + return x; } @@ -857,7 +857,7 @@ int LyXText::rightMargin(Buffer const * buf, Row const * row) const { LyXTextClass const & tclass = textclasslist[buf->params.textclass]; LyXLayout const & layout = tclass[row->par()->layout()]; - + int x = LYX_PAPER_MARGIN + lyxfont::signedWidth(tclass.rightmargin(), tclass.defaultfont()); @@ -867,16 +867,16 @@ int LyXText::rightMargin(Buffer const * buf, Row const * row) const // later added hack and this is true if (row->par()->getDepth()) { // find the next level paragraph - + Paragraph * newpar = row->par(); - + do { newpar = newpar->previous(); } while (newpar && newpar->getDepth() >= row->par()->getDepth()); - + // make a corresponding row. Needed to call LeftMargin() - + // check wether it is a sufficent paragraph if (newpar && tclass[newpar->layout()].isEnvironment()) { Row dummyrow; @@ -891,7 +891,7 @@ int LyXText::rightMargin(Buffer const * buf, Row const * row) const row->par()->params().depth(0); } } - + //lyxerr << "rightmargin: " << layout->rightmargin << endl; x += lyxfont::signedWidth(layout.rightmargin, tclass.defaultfont()) * 4 / (row->par()->getDepth() + 4); @@ -906,10 +906,10 @@ int LyXText::labelEnd(BufferView * bview, Row const * row) const Row tmprow; tmprow = *row; tmprow.pos(row->par()->size()); - return leftMargin(bview, &tmprow); /* just the beginning + return leftMargin(bview, &tmprow); /* just the beginning of the main body */ } else - return 0; /* LabelEnd is only needed, if the + return 0; /* LabelEnd is only needed, if the layout fills a flushleft label. */ } @@ -926,17 +926,17 @@ LyXText::nextBreakPoint(BufferView * bview, Row const * row, int width) const pos_type const pos = row->pos(); - // position of the last possible breakpoint + // position of the last possible breakpoint // -1 isn't a suitable value, but a flag pos_type last_separator = -1; width -= rightMargin(bview->buffer(), row); - + pos_type const main_body = beginningOfMainBody(bview->buffer(), par); LyXLayout const & layout = textclasslist[bview->buffer()->params.textclass][par->layout()]; pos_type i = pos; - + if (layout.margintype == MARGIN_RIGHT_ADDRESS_BOX) { /* special code for right address boxes, only newlines count */ while (i < par->size()) { @@ -944,7 +944,7 @@ LyXText::nextBreakPoint(BufferView * bview, Row const * row, int width) const last_separator = i; i = par->size() - 1; // this means break //x = width; - } else if (par->isInset(i) && par->getInset(i) + } else if (par->isInset(i) && par->getInset(i) && par->getInset(i)->display()) { par->getInset(i)->display(false); } @@ -952,7 +952,7 @@ LyXText::nextBreakPoint(BufferView * bview, Row const * row, int width) const } } else { // Last position is an invariant - pos_type const last = + pos_type const last = par->size(); // this is the usual handling int x = leftMargin(bview, row); @@ -1027,17 +1027,17 @@ LyXText::nextBreakPoint(BufferView * bview, Row const * row, int width) const else if (i == last && x < width) last_separator = i; } - - // well, if last_separator is still 0, the line isn't breakable. + + // well, if last_separator is still 0, the line isn't breakable. // don't care and cut simply at the end if (last_separator < 0) { last_separator = i; } - + // manual labels cannot be broken in LaTeX, do not care if (main_body && last_separator < main_body) last_separator = main_body - 1; - + return last_separator; } @@ -1051,7 +1051,7 @@ int LyXText::fill(BufferView * bview, Row * row, int paper_width) const int w; // get the pure distance pos_type const last = rowLastPrintable(row); - + // special handling of the right address boxes if (textclasslist[bview->buffer()->params.textclass][row->par()->layout()].margintype == MARGIN_RIGHT_ADDRESS_BOX) @@ -1062,9 +1062,9 @@ int LyXText::fill(BufferView * bview, Row * row, int paper_width) const row->fill(tmpfill); } else w = leftMargin(bview, row); - + LyXLayout const & layout = textclasslist[bview->buffer()->params.textclass][row->par()->layout()]; - pos_type const main_body = + pos_type const main_body = beginningOfMainBody(bview->buffer(), row->par()); pos_type i = row->pos(); @@ -1088,7 +1088,7 @@ int LyXText::fill(BufferView * bview, Row * row, int paper_width) const if (w < left_margin) w = left_margin; } - + int const fill = paper_width - w - rightMargin(bview->buffer(), row); return fill; } @@ -1098,7 +1098,7 @@ int LyXText::fill(BufferView * bview, Row * row, int paper_width) const int LyXText::labelFill(BufferView * bview, Row const * row) const { pos_type last = beginningOfMainBody(bview->buffer(), row->par()) - 1; - // -1 because a label ends either with a space that is in the label, + // -1 because a label ends either with a space that is in the label, // or with the beginning of a footnote that is outside the label. // I don't understand this code in depth, but sometimes "last" is @@ -1107,30 +1107,30 @@ int LyXText::labelFill(BufferView * bview, Row const * row) const // triggered when you have an open footnote in a paragraph // environment with a manual label. (Asger) if (last < 0) last = 0; - - if (row->par()->isLineSeparator(last)) /* a sepearator at this end + + if (row->par()->isLineSeparator(last)) /* a sepearator at this end does not count */ --last; - + int w = 0; pos_type i = row->pos(); while (i <= last) { w += singleWidth(bview, row->par(), i); ++i; } - + int fill = 0; if (!row->par()->params().labelWidthString().empty()) { fill = max(lyxfont::width(row->par()->params().labelWidthString(), getLabelFont(bview->buffer(), row->par())) - w, 0); } - + return fill; } -// returns the number of separators in the specified row. The separator +// returns the number of separators in the specified row. The separator // on the very last column doesnt count int LyXText::numberOfSeparators(Buffer const * buf, Row const * row) const { @@ -1147,14 +1147,14 @@ int LyXText::numberOfSeparators(Buffer const * buf, Row const * row) const // returns the number of hfills in the specified row. The LyX-Hfill is -// a LaTeX \hfill so that the hfills at the beginning and at the end were +// a LaTeX \hfill so that the hfills at the beginning and at the end were // ignored. This is *MUCH* more usefull than not to ignore! int LyXText::numberOfHfills(Buffer const * buf, Row const * row) const { pos_type const last = rowLast(row); pos_type first = row->pos(); - - if (first) { /* hfill *DO* count at the beginning + + if (first) { /* hfill *DO* count at the beginning * of paragraphs! */ while (first <= last && row->par()->isHfill(first)) { ++first; @@ -1165,7 +1165,7 @@ int LyXText::numberOfHfills(Buffer const * buf, Row const * row) const int n = 0; for (pos_type p = first; p <= last; ++p) { // last, because the end is ignored! - + if (row->par()->isHfill(p)) { ++n; } @@ -1179,7 +1179,7 @@ int LyXText::numberOfLabelHfills(Buffer const * buf, Row const * row) const { pos_type last = rowLast(row); pos_type first = row->pos(); - if (first) { /* hfill *DO* count at the beginning + if (first) { /* hfill *DO* count at the beginning * of paragraphs! */ while (first < last && row->par()->isHfill(first)) ++first; @@ -1200,12 +1200,12 @@ int LyXText::numberOfLabelHfills(Buffer const * buf, Row const * row) const // returns true, if a expansion is needed. // Rules are given by LaTeX bool LyXText::hfillExpansion(Buffer const * buf, Row const * row_ptr, - pos_type pos) const + pos_type pos) const { // by the way, is it a hfill? if (!row_ptr->par()->isHfill(pos)) return false; - + // at the end of a row it does not count // unless another hfill exists on the line if (pos >= rowLast(row_ptr)) { @@ -1216,19 +1216,19 @@ bool LyXText::hfillExpansion(Buffer const * buf, Row const * row_ptr, if (i == pos) { return false; } - } - - // at the beginning of a row it does not count, if it is not + } + + // at the beginning of a row it does not count, if it is not // the first row of a paragaph if (!row_ptr->pos()) return true; - + // in some labels it does not count if (textclasslist[buf->params.textclass][row_ptr->par()->layout()].margintype != MARGIN_MANUAL && pos < beginningOfMainBody(buf, row_ptr->par())) - return false; - + return false; + // if there is anything between the first char of the row and // the sepcified position that is not a newline and not a hfill, // the hfill will count, otherwise not @@ -1236,7 +1236,7 @@ bool LyXText::hfillExpansion(Buffer const * buf, Row const * row_ptr, while (i < pos && (row_ptr->par()->isNewline(i) || row_ptr->par()->isHfill(i))) ++i; - + return i != pos; } @@ -1260,16 +1260,16 @@ void LyXText::setHeightOfRow(BufferView * bview, Row * row_ptr) const LyXFont tmpfont; Inset * tmpinset = 0; - /* ok , let us initialize the maxasc and maxdesc value. + /* ok , let us initialize the maxasc and maxdesc value. * This depends in LaTeX of the font of the last character * in the paragraph. The hack below is necessary because * of the possibility of open footnotes */ - + /* Correction: only the fontsize count. The other properties are taken from the layoutfont. Nicer on the screen :) */ Paragraph * par = row_ptr->par(); Paragraph * firstpar = row_ptr->par(); - + LyXLayout const & layout = textclasslist[bview->buffer()->params.textclass][firstpar->layout()]; // as max get the first character of this row then it can increes but not @@ -1290,13 +1290,13 @@ void LyXText::setHeightOfRow(BufferView * bview, Row * row_ptr) const spacing_val = bview->buffer()->params.spacing.getValue(); } //lyxerr << "spacing_val = " << spacing_val << endl; - + int maxasc = int(lyxfont::maxAscent(font) * - layout.spacing.getValue() * - spacing_val); + layout.spacing.getValue() * + spacing_val); int maxdesc = int(lyxfont::maxDescent(font) * - layout.spacing.getValue() * - spacing_val); + layout.spacing.getValue() * + spacing_val); pos_type const pos_end = rowLast(row_ptr); int labeladdon = 0; int maxwidth = 0; @@ -1331,7 +1331,7 @@ void LyXText::setHeightOfRow(BufferView * bview, Row * row_ptr) const asc = lyxfont::maxAscent(font); desc = lyxfont::maxDescent(font); - if (asc > maxasc) + if (asc > maxasc) maxasc = asc; if (desc > maxdesc) maxdesc = desc; @@ -1342,10 +1342,10 @@ void LyXText::setHeightOfRow(BufferView * bview, Row * row_ptr) const ++maxdesc; row_ptr->ascent_of_text(maxasc); - + // is it a top line? if (!row_ptr->pos() && (row_ptr->par() == firstpar)) { - + // some parksips VERY EASY IMPLEMENTATION if (bview->buffer()->params.paragraph_separation == BufferParams::PARSEP_SKIP) @@ -1356,31 +1356,31 @@ void LyXText::setHeightOfRow(BufferView * bview, Row * row_ptr) const { maxasc += bview->buffer()->params.getDefSkip().inPixels(bview); } else if (firstpar->previous() && - textclasslist[bview->buffer()->params.textclass][firstpar->previous()->layout()].isParagraph() && - firstpar->previous()->getDepth() == 0) + textclasslist[bview->buffer()->params.textclass][firstpar->previous()->layout()].isParagraph() && + firstpar->previous()->getDepth() == 0) { // is it right to use defskip here too? (AS) maxasc += bview->buffer()->params.getDefSkip().inPixels(bview); } } - + // the paper margins if (!row_ptr->par()->previous() && bv_owner) maxasc += LYX_PAPER_MARGIN; - + // add the vertical spaces, that the user added maxasc += getLengthMarkerHeight(bview, firstpar->params().spaceTop()); - + // do not forget the DTP-lines! // there height depends on the font of the nearest character if (firstpar->params().lineTop()) maxasc += 2 * lyxfont::ascent('x', getFont(bview->buffer(), - firstpar, 0)); - + firstpar, 0)); + // and now the pagebreaks if (firstpar->params().pagebreakTop()) maxasc += 3 * defaultHeight(); - + // This is special code for the chapter, since the label of this // layout is printed in an extra row if (layout.labeltype == LABEL_COUNTER_CHAPTER @@ -1392,15 +1392,15 @@ void LyXText::setHeightOfRow(BufferView * bview, Row * row_ptr) const } else { spacing_val = bview->buffer()->params.spacing.getValue(); } - + labeladdon = int(lyxfont::maxDescent(labelfont) * - layout.spacing.getValue() * - spacing_val) + layout.spacing.getValue() * + spacing_val) + int(lyxfont::maxAscent(labelfont) * layout.spacing.getValue() * spacing_val); } - + // special code for the top label if ((layout.labeltype == LABEL_TOP_ENVIRONMENT || layout.labeltype == LABEL_BIBLIO @@ -1414,7 +1414,7 @@ void LyXText::setHeightOfRow(BufferView * bview, Row * row_ptr) const } else { spacing_val = bview->buffer()->params.spacing.getValue(); } - + labeladdon = int( (lyxfont::maxAscent(labelfont) * layout.spacing.getValue() * @@ -1425,10 +1425,10 @@ void LyXText::setHeightOfRow(BufferView * bview, Row * row_ptr) const + layout.topsep * defaultHeight() + layout.labelbottomsep * defaultHeight()); } - - // and now the layout spaces, for example before and after a section, + + // and now the layout spaces, for example before and after a section, // or between the items of a itemize or enumerate environment - + if (!firstpar->params().pagebreakTop()) { Paragraph * prev = row_ptr->par()->previous(); if (prev) @@ -1440,19 +1440,19 @@ void LyXText::setHeightOfRow(BufferView * bview, Row * row_ptr) const layoutasc = (layout.itemsep * defaultHeight()); } else if (row_ptr->previous()) { tmptop = layout.topsep; - + if (row_ptr->previous()->par()->getDepth() >= row_ptr->par()->getDepth()) tmptop -= textclasslist[bview->buffer()->params.textclass][row_ptr->previous()->par()->layout()].bottomsep; - + if (tmptop > 0) layoutasc = (tmptop * defaultHeight()); } else if (row_ptr->par()->params().lineTop()) { tmptop = layout.topsep; - + if (tmptop > 0) layoutasc = (tmptop * defaultHeight()); } - + prev = row_ptr->par()->outerHook(); if (prev) { maxasc += int(textclasslist[bview->buffer()->params.textclass][prev->layout()].parsep * defaultHeight()); @@ -1469,7 +1469,7 @@ void LyXText::setHeightOfRow(BufferView * bview, Row * row_ptr) const } } } - + // is it a bottom line? if (row_ptr->par() == par && (!row_ptr->next() || row_ptr->next()->par() != row_ptr->par())) @@ -1477,22 +1477,22 @@ void LyXText::setHeightOfRow(BufferView * bview, Row * row_ptr) const // the paper margins if (!par->next() && bv_owner) maxdesc += LYX_PAPER_MARGIN; - + // add the vertical spaces, that the user added maxdesc += getLengthMarkerHeight(bview, firstpar->params().spaceBottom()); - + // do not forget the DTP-lines! // there height depends on the font of the nearest character if (firstpar->params().lineBottom()) maxdesc += 2 * lyxfont::ascent('x', - getFont(bview->buffer(), + getFont(bview->buffer(), par, max(pos_type(0), par->size() - 1))); - + // and now the pagebreaks if (firstpar->params().pagebreakBottom()) maxdesc += 3 * defaultHeight(); - + // and now the layout spaces, for example before and after // a section, or between the items of a itemize or enumerate // environment @@ -1502,12 +1502,12 @@ void LyXText::setHeightOfRow(BufferView * bview, Row * row_ptr) const Paragraph * comparepar = row_ptr->par(); float usual = 0; float unusual = 0; - + if (comparepar->getDepth() > nextpar->getDepth()) { usual = (textclasslist[bview->buffer()->params.textclass][comparepar->layout()].bottomsep * defaultHeight()); comparepar = comparepar->depthHook(nextpar->getDepth()); if (comparepar->layout()!= nextpar->layout() - || nextpar->getLabelWidthString() != + || nextpar->getLabelWidthString() != comparepar->getLabelWidthString()) { unusual = (textclasslist[bview->buffer()->params.textclass][comparepar->layout()].bottomsep * defaultHeight()); @@ -1517,25 +1517,25 @@ void LyXText::setHeightOfRow(BufferView * bview, Row * row_ptr) const else layoutdesc = usual; } else if (comparepar->getDepth() == nextpar->getDepth()) { - + if (comparepar->layout() != nextpar->layout() - || nextpar->getLabelWidthString() != + || nextpar->getLabelWidthString() != comparepar->getLabelWidthString()) layoutdesc = int(textclasslist[bview->buffer()->params.textclass][comparepar->layout()].bottomsep * defaultHeight()); } } } - + // incalculate the layout spaces maxasc += int(layoutasc * 2 / (2 + firstpar->getDepth())); maxdesc += int(layoutdesc * 2 / (2 + firstpar->getDepth())); - + // calculate the new height of the text height -= row_ptr->height(); - + row_ptr->height(maxasc + maxdesc + labeladdon); row_ptr->baseline(maxasc + labeladdon); - + height += row_ptr->height(); float x = 0; if (layout.margintype != MARGIN_RIGHT_ADDRESS_BOX) { @@ -1562,14 +1562,14 @@ void LyXText::setHeightOfRow(BufferView * bview, Row * row_ptr) const void LyXText::appendParagraph(BufferView * bview, Row * row) const { bool not_ready = true; - - // The last character position of a paragraph is an invariant so we can + + // The last character position of a paragraph is an invariant so we can // safely get it here. (Asger) pos_type const lastposition = row->par()->size(); do { // Get the next breakpoint pos_type z = nextBreakPoint(bview, row, workWidth(bview)); - + Row * tmprow = row; // Insert the new row @@ -1581,7 +1581,7 @@ void LyXText::appendParagraph(BufferView * bview, Row * row) const row->height(0); } else not_ready = false; - + // Set the dimensions of the row // fixed fill setting now by calling inset->update() in // SingleWidth when needed! @@ -1595,7 +1595,7 @@ void LyXText::appendParagraph(BufferView * bview, Row * row) const void LyXText::breakAgain(BufferView * bview, Row * row) const { bool not_ready = true; - + do { // get the next breakpoint pos_type z = nextBreakPoint(bview, row, workWidth(bview)); @@ -1619,7 +1619,7 @@ void LyXText::breakAgain(BufferView * bview, Row * row) const } } else { /* if there are some rows too much, delete them */ - /* only if you broke the whole paragraph! */ + /* only if you broke the whole paragraph! */ Row * tmprow2 = row; while (tmprow2->next() && tmprow2->next()->par() == row->par()) { tmprow2 = tmprow2->next(); @@ -1630,8 +1630,8 @@ void LyXText::breakAgain(BufferView * bview, Row * row) const } not_ready = false; } - - /* set the dimensions of the row */ + + /* set the dimensions of the row */ tmprow->fill(fill(bview, tmprow, workWidth(bview))); setHeightOfRow(bview, tmprow); } while (not_ready); @@ -1648,7 +1648,7 @@ void LyXText::breakAgainOneRow(BufferView * bview, Row * row) if (z < row->par()->size()) { if (!row->next() || (row->next() && row->next()->par() != row->par())) { - /* insert a new row */ + /* insert a new row */ ++z; insertRow(row, row->par(), z); row = row->next(); @@ -1672,7 +1672,7 @@ void LyXText::breakAgainOneRow(BufferView * bview, Row * row) removeRow(tmprow2->next()); } } - + // set the dimensions of the row tmprow->fill(fill(bview, tmprow, workWidth(bview))); setHeightOfRow(bview, tmprow); @@ -1689,8 +1689,8 @@ void LyXText::breakParagraph(BufferView * bview, char keep_layout) if ((cursor.par()->size() <= 0) && layout.labeltype!= LABEL_SENSITIVE) return; - - setUndo(bview, Undo::FINISH, cursor.par(), cursor.par()->next()); + + setUndo(bview, Undo::FINISH, cursor.par(), cursor.par()->next()); // Always break behind a space // @@ -1698,12 +1698,12 @@ void LyXText::breakParagraph(BufferView * bview, char keep_layout) if (cursor.pos() < cursor.par()->size() && cursor.par()->isLineSeparator(cursor.pos())) cursor.par()->erase(cursor.pos()); - // cursor.pos(cursor.pos() + 1); + // cursor.pos(cursor.pos() + 1); // break the paragraph if (keep_layout) keep_layout = 2; - else + else keep_layout = layout.isEnvironment(); cursor.par()->breakParagraph(bview->buffer()->params, cursor.pos(), keep_layout); @@ -1717,20 +1717,20 @@ void LyXText::breakParagraph(BufferView * bview, char keep_layout) // set to standard-layout cursor.par()->next()->applyLayout(tclass.defaultLayoutName()); } - - /* if the cursor is at the beginning of a row without prior newline, - * move one row up! + + /* if the cursor is at the beginning of a row without prior newline, + * move one row up! * This touches only the screen-update. Otherwise we would may have * an empty row on the screen */ if (cursor.pos() && !cursor.row()->par()->isNewline(cursor.row()->pos() - 1) && cursor.row()->pos() == cursor.pos()) { cursorLeft(bview); - } - + } + status(bview, LyXText::NEED_MORE_REFRESH); refresh_row = cursor.row(); refresh_y = cursor.y() - cursor.row()->baseline(); - + // Do not forget the special right address boxes if (layout.margintype == MARGIN_RIGHT_ADDRESS_BOX) { while (refresh_row->previous() && @@ -1740,7 +1740,7 @@ void LyXText::breakParagraph(BufferView * bview, char keep_layout) } } removeParagraph(cursor.row()); - + // set the dimensions of the cursor row cursor.row()->fill(fill(bview, cursor.row(), workWidth(bview))); @@ -1749,18 +1749,18 @@ void LyXText::breakParagraph(BufferView * bview, char keep_layout) while (cursor.par()->next()->size() && cursor.par()->next()->isNewline(0)) cursor.par()->next()->erase(0); - + insertParagraph(bview, cursor.par()->next(), cursor.row()); updateCounters(bview, cursor.row()->previous()); - + /* This check is necessary. Otherwise the new empty paragraph will - * be deleted automatically. And it is more friendly for the user! */ + * be deleted automatically. And it is more friendly for the user! */ if (cursor.pos()) setCursor(bview, cursor.par()->next(), 0); else setCursor(bview, cursor.par(), 0); - + if (cursor.row()->next()) breakAgain(bview, cursor.row()->next()); @@ -1768,7 +1768,7 @@ void LyXText::breakParagraph(BufferView * bview, char keep_layout) } -// Just a macro to make some thing easier. +// Just a macro to make some thing easier. void LyXText::redoParagraph(BufferView * bview) const { clearSelection(); @@ -1777,7 +1777,7 @@ void LyXText::redoParagraph(BufferView * bview) const } -/* insert a character, moves all the following breaks in the +/* insert a character, moves all the following breaks in the * same Paragraph one to the right and make a rebreak */ void LyXText::insertChar(BufferView * bview, char c) { @@ -1786,7 +1786,7 @@ void LyXText::insertChar(BufferView * bview, char c) // When the free-spacing option is set for the current layout, // disable the double-space checking - bool const freeSpacing = + bool const freeSpacing = textclasslist[bview->buffer()->params.textclass][cursor.row()->par()->layout()].free_spacing || cursor.row()->par()->isFreeSpacing(); @@ -1838,22 +1838,22 @@ void LyXText::insertChar(BufferView * bview, char c) } - /* First check, if there will be two blanks together or a blank at - the beginning of a paragraph. - I decided to handle blanks like normal characters, the main + /* First check, if there will be two blanks together or a blank at + the beginning of a paragraph. + I decided to handle blanks like normal characters, the main difference are the special checks when calculating the row.fill - (blank does not count at the end of a row) and the check here */ + (blank does not count at the end of a row) and the check here */ // The bug is triggered when we type in a description environment: // The current_font is not changed when we go from label to main text // and it should (along with realtmpfont) when we type the space. // CHECK There is a bug here! (Asger) - + LyXFont realtmpfont = real_current_font; LyXFont rawtmpfont = current_font; /* store the current font. * This is because of the use * of cursor movements. The moving - * cursor would refresh the + * cursor would refresh the * current font */ // Get the font that is used to calculate the baselineskip @@ -1863,16 +1863,16 @@ void LyXText::insertChar(BufferView * bview, char c) lastpos - 1); bool jumped_over_space = false; - + if (!freeSpacing && IsLineSeparatorChar(c)) { - if ((cursor.pos() > 0 + if ((cursor.pos() > 0 && cursor.par()->isLineSeparator(cursor.pos() - 1)) || (cursor.pos() > 0 && cursor.par()->isNewline(cursor.pos() - 1)) || (cursor.pos() == 0)) { static bool sent_space_message = false; if (!sent_space_message) { - if (cursor.pos() == 0) + if (cursor.pos() == 0) bview->owner()->message(_("You cannot insert a space at the beginning of a paragraph. Please read the Tutorial.")); else bview->owner()->message(_("You cannot type two spaces this way. Please read the Tutorial.")); @@ -1887,8 +1887,8 @@ void LyXText::insertChar(BufferView * bview, char c) charInserted(); return; } - /* No newline at first position - * of a paragraph or behind labels. + /* No newline at first position + * of a paragraph or behind labels. * TeX does not allow that. */ if (cursor.pos() < cursor.par()->size() && @@ -1897,21 +1897,21 @@ void LyXText::insertChar(BufferView * bview, char c) cursorRight(bview); cursor.row()->fill(-1); // to force a new break } - + // the display inset stuff if (cursor.row()->par()->isInset(cursor.row()->pos())) { Inset * inset = cursor.row()->par()->getInset(cursor.row()->pos()); - if (inset && (inset->display() || inset->needFullRow())) { + if (inset && (inset->display() || inset->needFullRow())) { // force a new break - cursor.row()->fill(-1); // to force a new break + cursor.row()->fill(-1); // to force a new break } } // get the cursor row fist Row * row = cursor.row(); int y = cursor.y() - row->baseline(); - if (c != Paragraph::META_INSET) /* Here case LyXText::InsertInset - * already insertet the character */ + if (c != Paragraph::META_INSET) /* Here case LyXText::InsertInset + * already insertet the character */ cursor.par()->insertChar(cursor.pos(), c); setCharFont(bview->buffer(), cursor.par(), cursor.pos(), rawtmpfont); @@ -1923,7 +1923,7 @@ void LyXText::insertChar(BufferView * bview, char c) tmprow->pos(tmprow->pos() + 1); } } - + // Is there a break one row above if ((cursor.par()->isLineSeparator(cursor.pos()) || cursor.par()->isNewline(cursor.pos()) @@ -1937,19 +1937,19 @@ void LyXText::insertChar(BufferView * bview, char c) workWidth(bview)); if (z >= row->pos()) { row->pos(z + 1); - + // set the dimensions of the row above row->previous()->fill(fill(bview, row->previous(), workWidth(bview))); setHeightOfRow(bview, row->previous()); - + y -= row->previous()->height(); refresh_y = y; refresh_row = row->previous(); status(bview, LyXText::NEED_MORE_REFRESH); - + breakAgainOneRow(bview, row); current_font = rawtmpfont; @@ -1957,34 +1957,34 @@ void LyXText::insertChar(BufferView * bview, char c) setCursor(bview, cursor.par(), cursor.pos() + 1, false, cursor.boundary()); // cursor MUST be in row now. - + if (row->next() && row->next()->par() == row->par()) need_break_row = row->next(); else need_break_row = 0; - + // check, wether the last characters font has changed. if (cursor.pos() && cursor.pos() == cursor.par()->size() && rawparfont != rawtmpfont) redoHeightOfParagraph(bview, cursor); - + charInserted(); return; } } - + // recalculate the fill of the row if (row->fill() >= 0) /* needed because a newline - * will set fill to -1. Otherwise - * we would not get a rebreak! */ + * will set fill to -1. Otherwise + * we would not get a rebreak! */ row->fill(fill(bview, row, workWidth(bview))); if (row->fill() < 0) { refresh_y = y; - refresh_row = row; + refresh_row = row; refresh_x = cursor.x(); refresh_pos = cursor.pos(); status(bview, LyXText::NEED_MORE_REFRESH); - breakAgainOneRow(bview, row); + breakAgainOneRow(bview, row); // will the cursor be in another row now? if (rowLast(row) <= cursor.pos() + 1 && row->next()) { if (row->next() && row->next()->par() == row->par()) @@ -2004,20 +2004,20 @@ void LyXText::insertChar(BufferView * bview, char c) if (row->next() && row->next()->par() == row->par()) need_break_row = row->next(); else - need_break_row = 0; + need_break_row = 0; } else { refresh_y = y; refresh_x = cursor.x(); refresh_row = row; refresh_pos = cursor.pos(); - + int const tmpheight = row->height(); setHeightOfRow(bview, row); if (tmpheight == row->height()) status(bview, LyXText::NEED_VERY_LITTLE_REFRESH); else status(bview, LyXText::NEED_MORE_REFRESH); - + current_font = rawtmpfont; real_current_font = realtmpfont; setCursor(bview, cursor.par(), cursor.pos() + 1, false, @@ -2032,13 +2032,13 @@ void LyXText::insertChar(BufferView * bview, char c) // now the special right address boxes if (textclasslist[bview->buffer()->params.textclass][cursor.par()->layout()].margintype == MARGIN_RIGHT_ADDRESS_BOX) { - redoDrawingOfParagraph(bview, cursor); + redoDrawingOfParagraph(bview, cursor); } } charInserted(); } - + void LyXText::charInserted() { @@ -2055,15 +2055,15 @@ void LyXText::charInserted() void LyXText::prepareToPrint(BufferView * bview, - Row * row, float & x, - float & fill_separator, - float & fill_hfill, - float & fill_label_hfill, - bool bidi) const + Row * row, float & x, + float & fill_separator, + float & fill_hfill, + float & fill_label_hfill, + bool bidi) const { float nlh; float ns; - + float w = row->fill(); fill_hfill = 0; fill_label_hfill = 0; @@ -2077,11 +2077,11 @@ void LyXText::prepareToPrint(BufferView * bview, ? rightMargin(bview->buffer(), row) : 0; } else x = (workWidth(bview) > 0) ? leftMargin(bview, row) : 0; - + // is there a manual margin with a manual label LyXTextClass const & tclass = textclasslist[bview->buffer()->params.textclass]; LyXLayout const & layout = tclass[row->par()->layout()]; - + if (layout.margintype == MARGIN_MANUAL && layout.labeltype == LABEL_MANUAL) { // one more since labels are left aligned @@ -2090,7 +2090,7 @@ void LyXText::prepareToPrint(BufferView * bview, fill_label_hfill = labelFill(bview, row) / nlh; } } - + // are there any hfills in the row? float const nh = numberOfHfills(bview->buffer(), row); @@ -2101,7 +2101,7 @@ void LyXText::prepareToPrint(BufferView * bview, // if the row is already larger then the permitted width as then // we force the LEFT_ALIGN'edness! } else if (static_cast(row->width()) < workWidth(bview)) { - // is it block, flushleft or flushright? + // is it block, flushleft or flushright? // set x how you need it int align; if (row->par()->params().align() == LYX_ALIGN_LAYOUT) { @@ -2109,14 +2109,14 @@ void LyXText::prepareToPrint(BufferView * bview, } else { align = row->par()->params().align(); } - - // center displayed insets + + // center displayed insets Inset * inset; if (row->par()->isInset(row->pos()) && (inset=row->par()->getInset(row->pos())) && (inset->display())) // || (inset->scroll() < 0))) align = (inset->lyxCode() == Inset::MATHMACRO_CODE) - ? LYX_ALIGN_BLOCK : LYX_ALIGN_CENTER; + ? LYX_ALIGN_BLOCK : LYX_ALIGN_CENTER; // ERT insets should always be LEFT ALIGNED on screen inset = row->par()->inInset(); if (inset && inset->owner() && @@ -2124,15 +2124,15 @@ void LyXText::prepareToPrint(BufferView * bview, { align = LYX_ALIGN_LEFT; } - + switch (align) { case LYX_ALIGN_BLOCK: ns = numberOfSeparators(bview->buffer(), row); if (ns && row->next() && row->next()->par() == row->par() && !(row->next()->par()->isNewline(row->next()->pos() - 1)) && !(row->next()->par()->isInset(row->next()->pos()) - && row->next()->par()->getInset(row->next()->pos()) - && row->next()->par()->getInset(row->next()->pos())->display()) + && row->next()->par()->getInset(row->next()->pos()) + && row->next()->par()->getInset(row->next()->pos())->display()) ) { fill_separator = w / ns; @@ -2153,12 +2153,12 @@ void LyXText::prepareToPrint(BufferView * bview, computeBidiTables(bview->buffer(), row); if (is_rtl) { - pos_type main_body = + pos_type main_body = beginningOfMainBody(bview->buffer(), row->par()); pos_type last = rowLast(row); if (main_body > 0 && - (main_body - 1 > last || + (main_body - 1 > last || !row->par()->isLineSeparator(main_body - 1))) { x += lyxfont::width(layout.labelsep, getLabelFont(bview->buffer(), row->par())); @@ -2167,7 +2167,7 @@ void LyXText::prepareToPrint(BufferView * bview, } } } - + /* important for the screen */ @@ -2197,7 +2197,7 @@ void LyXText::cursorRightOneWord(BufferView * bview) const } // Advance through word. while (tmpcursor.pos() < tmpcursor.par()->size() && - tmpcursor.par()->isWord(tmpcursor.pos())) { + tmpcursor.par()->isWord(tmpcursor.pos())) { // printf("Current pos2 %d", tmpcursor.pos()) ; tmpcursor.pos(tmpcursor.pos() + 1); ++steps; @@ -2211,22 +2211,22 @@ void LyXText::cursorTab(BufferView * bview) const { LyXCursor tmpcursor = cursor; while (tmpcursor.pos() < tmpcursor.par()->size() - && !tmpcursor.par()->isNewline(tmpcursor.pos())) - tmpcursor.pos(tmpcursor.pos() + 1); + && !tmpcursor.par()->isNewline(tmpcursor.pos())) + tmpcursor.pos(tmpcursor.pos() + 1); if (tmpcursor.pos() == tmpcursor.par()->size()) { - if (tmpcursor.par()->next()) { - tmpcursor.par(tmpcursor.par()->next()); - tmpcursor.pos(0); - } + if (tmpcursor.par()->next()) { + tmpcursor.par(tmpcursor.par()->next()); + tmpcursor.pos(0); + } } else - tmpcursor.pos(tmpcursor.pos() + 1); + tmpcursor.pos(tmpcursor.pos() + 1); setCursor(bview, tmpcursor.par(), tmpcursor.pos()); } /* -------> Skip initial whitespace at end of word and move cursor to *start* - of prior word, not to end of next prior word. */ + of prior word, not to end of next prior word. */ void LyXText::cursorLeftOneWord(BufferView * bview) const { @@ -2239,8 +2239,8 @@ void LyXText::cursorLeftOneWord(LyXCursor & cur) const { // treat HFills, floats and Insets as words cur = cursor; - while (cur.pos() - && (cur.par()->isSeparator(cur.pos() - 1) + while (cur.pos() + && (cur.par()->isSeparator(cur.pos() - 1) || cur.par()->isKomma(cur.pos() - 1)) && !(cur.par()->isHfill(cur.pos() - 1) || cur.par()->isInset(cur.pos() - 1))) @@ -2255,7 +2255,7 @@ void LyXText::cursorLeftOneWord(LyXCursor & cur) const cur.par(cur.par()->previous()); cur.pos(cur.par()->size()); } - } else { // Here, cur != 0 + } else { // Here, cur != 0 while (cur.pos() > 0 && cur.par()->isWord(cur.pos()-1)) cur.pos(cur.pos() - 1); @@ -2264,7 +2264,7 @@ void LyXText::cursorLeftOneWord(LyXCursor & cur) const /* -------> Select current word. This depends on behaviour of CursorLeftOneWord(), so it is patched as well. */ -void LyXText::getWord(LyXCursor & from, LyXCursor & to, +void LyXText::getWord(LyXCursor & from, LyXCursor & to, word_location const loc) const { // first put the cursor where we wana start to select the word @@ -2280,7 +2280,7 @@ void LyXText::getWord(LyXCursor & from, LyXCursor & to, return; } // no break here, we go to the next - + case WHOLE_WORD: // Move cursor to the beginning, when not already there. if (from.pos() && !from.par()->isSeparator(from.pos() - 1) @@ -2308,7 +2308,7 @@ void LyXText::getWord(LyXCursor & from, LyXCursor & to, } -void LyXText::selectWord(BufferView * bview, word_location const loc) +void LyXText::selectWord(BufferView * bview, word_location const loc) { LyXCursor from; LyXCursor to; @@ -2325,8 +2325,8 @@ void LyXText::selectWord(BufferView * bview, word_location const loc) /* -------> Select the word currently under the cursor when no selection is currently set */ -bool LyXText::selectWordWhenUnderCursor(BufferView * bview, - word_location const loc) +bool LyXText::selectWordWhenUnderCursor(BufferView * bview, + word_location const loc) { if (!selection.set()) { selectWord(bview, loc); @@ -2339,7 +2339,7 @@ bool LyXText::selectWordWhenUnderCursor(BufferView * bview, // This function is only used by the spellchecker for NextWord(). // It doesn't handle LYX_ACCENTs and probably never will. string const LyXText::selectNextWordToSpellcheck(BufferView * bview, - float & value) const + float & value) const { if (the_locking_inset) { string str = the_locking_inset->selectNextWordToSpellcheck(bview, value); @@ -2357,7 +2357,7 @@ string const LyXText::selectNextWordToSpellcheck(BufferView * bview, cursor.pos(cursor.pos() + 1); } Paragraph * tmppar = cursor.par(); - + // If this is not the very first word, skip rest of // current word because we are probably in the middle // of a word if there is text here. @@ -2366,7 +2366,7 @@ string const LyXText::selectNextWordToSpellcheck(BufferView * bview, && cursor.par()->isLetter(cursor.pos())) cursor.pos(cursor.pos() + 1); } - + // Now, skip until we have real text (will jump paragraphs) while ((cursor.par()->size() > cursor.pos() && (!cursor.par()->isLetter(cursor.pos())) @@ -2374,7 +2374,7 @@ string const LyXText::selectNextWordToSpellcheck(BufferView * bview, !cursor.par()->getInset(cursor.pos())->allowSpellcheck())) || (cursor.par()->size() == cursor.pos() && cursor.par()->next())) - { + { if (cursor.pos() == cursor.par()->size()) { cursor.par(cursor.par()->next()); cursor.pos(0); @@ -2391,8 +2391,8 @@ string const LyXText::selectNextWordToSpellcheck(BufferView * bview, // now call us again to do the above trick // but obviously we have to start from down below ;) return bview->text->selectNextWordToSpellcheck(bview, value); - } - + } + // Update the value if we changed paragraphs if (cursor.par() != tmppar) { setCursor(bview, cursor.par(), cursor.pos()); @@ -2401,11 +2401,11 @@ string const LyXText::selectNextWordToSpellcheck(BufferView * bview, // Start the selection from here selection.cursor = cursor; - + // and find the end of the word (insets like optional hyphens // and ligature break are part of a word) while (cursor.pos() < cursor.par()->size() - && (cursor.par()->isLetter(cursor.pos()))) + && (cursor.par()->isLetter(cursor.pos()))) cursor.pos(cursor.pos() + 1); // Finally, we copy the word to a string and return it @@ -2430,17 +2430,17 @@ void LyXText::selectSelectedWord(BufferView * bview) } // move cursor to the beginning setCursor(bview, selection.cursor.par(), selection.cursor.pos()); - + // set the sel cursor selection.cursor = cursor; - + // now find the end of the word while (cursor.pos() < cursor.par()->size() && (cursor.par()->isLetter(cursor.pos()))) cursor.pos(cursor.pos() + 1); - + setCursor(bview, cursor.par(), cursor.pos()); - + // finally set the selection setSelection(bview); } @@ -2460,7 +2460,7 @@ void LyXText::deleteWordForward(BufferView * bview) selection.cursor = cursor; cursor = tmpcursor; setSelection(bview); - + /* -----> Great, CutSelection() gets rid of multiple spaces. */ cutSelection(bview, true, false); } @@ -2513,13 +2513,13 @@ void LyXText::deleteLineForward(BufferView * bview) } -// Change the case of a word at cursor position. +// Change the case of a word at cursor position. // This function directly manipulates Paragraph::text because there // is no Paragraph::SetChar currently. I did what I could to ensure // that it is correct. I guess part of it should be moved to // Paragraph, but it will have to change for 1.1 anyway. At least // it does not access outside of the allocated array as the older -// version did. (JMarc) +// version did. (JMarc) void LyXText::changeCase(BufferView * bview, LyXText::TextCase action) { LyXCursor from; @@ -2543,7 +2543,7 @@ void LyXText::changeRegionCase(BufferView * bview, LyXText::TextCase action) { lyx::Assert(from <= to); - + setUndo(bview, Undo::FINISH, from.par(), to.par()->next()); pos_type pos = from.pos(); @@ -2586,7 +2586,7 @@ void LyXText::transposeChars(BufferView & bview) { Paragraph * tmppar = cursor.par(); - setUndo(&bview, Undo::FINISH, tmppar, tmppar->next()); + setUndo(&bview, Undo::FINISH, tmppar, tmppar->next()); pos_type tmppos = cursor.pos(); @@ -2620,7 +2620,7 @@ void LyXText::Delete(BufferView * bview) int const old_cur_par_id = old_cursor.par()->id(); int const old_cur_par_prev_id = old_cursor.par()->previous() ? old_cursor.par()->previous()->id() : 0; - + // just move to the right cursorRight(bview); @@ -2643,7 +2643,7 @@ void LyXText::Delete(BufferView * bview) // to make sure undo gets the right cursor position cursor = old_cursor; setUndo(bview, Undo::DELETE, - cursor.par(), cursor.par()->next()); + cursor.par(), cursor.par()->next()); cursor = tmpcursor; backspace(bview); } @@ -2661,17 +2661,17 @@ void LyXText::backspace(BufferView * bview) if (cursor.pos() == 0) { // The cursor is at the beginning of a paragraph, // so the the backspace will collapse two paragraphs into one. - + // we may paste some paragraphs - + // is it an empty paragraph? - + if ((lastpos == 0 || (lastpos == 1 && cursor.par()->isSeparator(0)))) { // This is an empty paragraph and we delete it just by moving the cursor one step // left and let the DeleteEmptyParagraphMechanism handle the actual deletion // of the paragraph. - + if (cursor.par()->previous()) { Paragraph * tmppar = cursor.par()->previous(); if (cursor.par()->layout() == tmppar->layout() @@ -2682,9 +2682,9 @@ void LyXText::backspace(BufferView * bview) tmppar->params().spaceBottom(cursor.par()->params().spaceBottom()); tmppar->params().pagebreakBottom(cursor.par()->params().pagebreakBottom()); } - + cursorLeft(bview); - + // the layout things can change the height of a row ! int const tmpheight = cursor.row()->height(); setHeightOfRow(bview, cursor.row()); @@ -2699,35 +2699,35 @@ void LyXText::backspace(BufferView * bview) if (cursor.par()->previous()) { setUndo(bview, Undo::DELETE, - cursor.par()->previous(), cursor.par()->next()); + cursor.par()->previous(), cursor.par()->next()); } - - Paragraph * tmppar = cursor.par(); - Row * tmprow = cursor.row(); + + Paragraph * tmppar = cursor.par(); + Row * tmprow = cursor.row(); // We used to do cursorLeftIntern() here, but it is // not a good idea since it triggers the auto-delete // mechanism. So we do a cursorLeftIntern()-lite, // without the dreaded mechanism. (JMarc) - if (cursor.par()->previous()) { + if (cursor.par()->previous()) { // steps into the above paragraph. setCursorIntern(bview, cursor.par()->previous(), - cursor.par()->previous()->size(), - false); + cursor.par()->previous()->size(), + false); } /* Pasting is not allowed, if the paragraphs have different layout. I think it is a real bug of all other word processors to allow it. It confuses the user. Even so with a footnote paragraph and a non-footnote - paragraph. I will not allow pasting in this case, - because the user would be confused if the footnote behaves + paragraph. I will not allow pasting in this case, + because the user would be confused if the footnote behaves different wether it is open or closed. - + Correction: Pasting is always allowed with standard-layout */ LyXTextClass const & tclass = textclasslist[bview->buffer()->params.textclass]; - + if (cursor.par() != tmppar && (cursor.par()->layout() == tmppar->layout() || tmppar->layout() == tclass.defaultLayoutName()) @@ -2735,7 +2735,7 @@ void LyXText::backspace(BufferView * bview) removeParagraph(tmprow); removeRow(tmprow); cursor.par()->pasteParagraph(bview->buffer()->params); - + if (!cursor.pos() || !cursor.par()->isSeparator(cursor.pos() - 1)) ; //cursor.par()->insertChar(cursor.pos(), ' '); // strangely enough it seems that commenting out the line above removes @@ -2744,44 +2744,44 @@ void LyXText::backspace(BufferView * bview) else if (cursor.pos()) cursor.pos(cursor.pos() - 1); - + status(bview, LyXText::NEED_MORE_REFRESH); refresh_row = cursor.row(); refresh_y = cursor.y() - cursor.row()->baseline(); - + // remove the lost paragraph // This one is not safe, since the paragraph that the tmprow and the // following rows belong to has been deleted by the PasteParagraph // above. The question is... could this be moved in front of the // PasteParagraph? //RemoveParagraph(tmprow); - //RemoveRow(tmprow); - + //RemoveRow(tmprow); + // This rebuilds the rows. appendParagraph(bview, cursor.row()); updateCounters(bview, cursor.row()); - + // the row may have changed, block, hfills etc. setCursor(bview, cursor.par(), cursor.pos(), false); } } else { /* this is the code for a normal backspace, not pasting - * any paragraphs */ + * any paragraphs */ setUndo(bview, Undo::DELETE, - cursor.par(), cursor.par()->next()); + cursor.par(), cursor.par()->next()); // We used to do cursorLeftIntern() here, but it is // not a good idea since it triggers the auto-delete // mechanism. So we do a cursorLeftIntern()-lite, // without the dreaded mechanism. (JMarc) setCursorIntern(bview, cursor.par(), cursor.pos()- 1, - false, cursor.boundary()); - + false, cursor.boundary()); + // some insets are undeletable here if (cursor.par()->isInset(cursor.pos())) { if (!cursor.par()->getInset(cursor.pos())->deletable()) - return; + return; // force complete redo when erasing display insets - // this is a cruel method but safe..... Matthias + // this is a cruel method but safe..... Matthias if (cursor.par()->getInset(cursor.pos())->display() || cursor.par()->getInset(cursor.pos())->needFullRow()) { cursor.par()->erase(cursor.pos()); @@ -2789,21 +2789,21 @@ void LyXText::backspace(BufferView * bview) return; } } - + Row * row = cursor.row(); int y = cursor.y() - row->baseline(); pos_type z; /* remember that a space at the end of a row doesnt count - * when calculating the fill */ + * when calculating the fill */ if (cursor.pos() < rowLast(row) || !cursor.par()->isLineSeparator(cursor.pos())) { row->fill(row->fill() + singleWidth(bview, - cursor.par(), - cursor.pos())); + cursor.par(), + cursor.pos())); } - + /* some special code when deleting a newline. This is similar - * to the behavior when pasting paragraphs */ + * to the behavior when pasting paragraphs */ if (cursor.pos() && cursor.par()->isNewline(cursor.pos())) { cursor.par()->erase(cursor.pos()); // refresh the positions @@ -2818,7 +2818,7 @@ void LyXText::backspace(BufferView * bview) if (cursor.pos() < cursor.par()->size() && !cursor.par()->isSeparator(cursor.pos())) { cursor.par()->insertChar(cursor.pos(), ' '); - setCharFont(bview->buffer(), cursor.par(), + setCharFont(bview->buffer(), cursor.par(), cursor.pos(), current_font); // refresh the positions tmprow = row; @@ -2829,7 +2829,7 @@ void LyXText::backspace(BufferView * bview) } } else { cursor.par()->erase(cursor.pos()); - + // refresh the positions Row * tmprow = row; while (tmprow->next() @@ -2846,23 +2846,23 @@ void LyXText::backspace(BufferView * bview) cursor.par()->erase(cursor.pos()); // refresh the positions tmprow = row; - while (tmprow->next() && + while (tmprow->next() && tmprow->next()->par() == row->par()) { tmprow = tmprow->next(); tmprow->pos(tmprow->pos() - 1); } } } - + // is there a break one row above if (row->previous() && row->previous()->par() == row->par()) { z = nextBreakPoint(bview, row->previous(), workWidth(bview)); if (z >= row->pos()) { row->pos(z + 1); - + Row * tmprow = row->previous(); - + // maybe the current row is now empty if (row->pos() >= row->par()->size()) { // remove it @@ -2875,13 +2875,13 @@ void LyXText::backspace(BufferView * bview) else need_break_row = 0; } - + // set the dimensions of the row above y -= tmprow->height(); tmprow->fill(fill(bview, tmprow, workWidth(bview))); setHeightOfRow(bview, tmprow); - + refresh_y = y; refresh_row = tmprow; status(bview, LyXText::NEED_MORE_REFRESH); @@ -2897,23 +2897,23 @@ void LyXText::backspace(BufferView * bview) return; } } - + // break the cursor row again if (row->next() && row->next()->par() == row->par() && (rowLast(row) == row->par()->size() - 1 || nextBreakPoint(bview, row, workWidth(bview)) != rowLast(row))) { - + /* it can happen that a paragraph loses one row * without a real breakup. This is when a word - * is to long to be broken. Well, I don t care this + * is to long to be broken. Well, I don t care this * hack ;-) */ if (rowLast(row) == row->par()->size() - 1) removeRow(row->next()); - + refresh_y = y; refresh_row = row; status(bview, LyXText::NEED_MORE_REFRESH); - + breakAgainOneRow(bview, row); // will the cursor be in another row now? if (row->next() && row->next()->par() == row->par() && @@ -2954,9 +2954,9 @@ void LyXText::backspace(BufferView * bview) lastpos = cursor.par()->size(); if (cursor.pos() == lastpos) setCurrentFont(bview); - + // check, whether the last characters font has changed. - if (rawparfont != + if (rawparfont != cursor.par()->getFontSettings(bview->buffer()->params, lastpos - 1)) { redoHeightOfParagraph(bview, cursor); } else { @@ -2964,7 +2964,7 @@ void LyXText::backspace(BufferView * bview) if (textclasslist [bview->buffer()->params.textclass] [cursor.par()->layout()].margintype == MARGIN_RIGHT_ADDRESS_BOX) { - redoDrawingOfParagraph(bview, cursor); + redoDrawingOfParagraph(bview, cursor); } } } @@ -2985,11 +2985,11 @@ bool LyXText::paintRowBackground(DrawRowParams & p) clear_area = inset->doClearArea(); } } - + if (p.cleared) { return true; - } - + } + if (clear_area) { int const x = p.xo; int const y = p.yo < 0 ? 0 : p.yo; @@ -2997,12 +2997,12 @@ bool LyXText::paintRowBackground(DrawRowParams & p) p.pain->fillRectangle(x, y, p.width, h, backgroundColor()); return true; } - + if (inset == 0) return false; - + int h = p.row->baseline() - inset->ascent(p.bv, font); - + // first clear the whole row above the inset! if (h > 0) { p.pain->fillRectangle(p.xo, p.yo, p.width, h, backgroundColor()); @@ -3011,7 +3011,7 @@ bool LyXText::paintRowBackground(DrawRowParams & p) // clear the space below the inset! h += inset->ascent(p.bv, font) + inset->descent(p.bv, font); if ((p.row->height() - h) > 0) { - p.pain->fillRectangle(p.xo, p.yo + h, + p.pain->fillRectangle(p.xo, p.yo + h, p.width, p.row->height() - h, backgroundColor()); } @@ -3023,7 +3023,7 @@ bool LyXText::paintRowBackground(DrawRowParams & p) p.row->height(), backgroundColor()); } } - + return false; } @@ -3039,15 +3039,15 @@ void LyXText::paintRowSelection(DrawRowParams & p) int const endy = selection.end.y(); Row const * startrow = selection.start.row(); Row const * endrow = selection.end.row(); - + Row * row = p.row; - + if (bidi_same_direction) { int x; int y = p.yo; int w; int h = row->height(); - + if (startrow == row && endrow == row) { if (startx < endx) { x = p.xo + startx; @@ -3078,20 +3078,20 @@ void LyXText::paintRowSelection(DrawRowParams & p) } return; } - + if (!((startrow != row && !is_rtl) || (endrow != row && is_rtl))) { return; } - + float tmpx = p.x; - + p.pain->fillRectangle(p.xo, p.yo, int(p.x), row->height(), LColor::selection); - + Buffer const * buffer = p.bv->buffer(); Paragraph * par = row->par(); pos_type main_body = beginningOfMainBody(buffer, par); pos_type const last = rowLastPrintable(row); - + for (pos_type vpos = row->pos(); vpos <= last; ++vpos) { pos_type pos = vis2log(vpos); float const old_tmpx = tmpx; @@ -3101,22 +3101,22 @@ void LyXText::paintRowSelection(DrawRowParams & p) [buffer->params.textclass] [par->layout()]; LyXFont const lfont = getLabelFont(buffer, par); - - + + tmpx += p.label_hfill + lyxfont::width(layout.labelsep, lfont); if (par->isLineSeparator(main_body - 1)) tmpx -= singleWidth(p.bv, par, main_body - 1); } - + if (hfillExpansion(buffer, row, pos)) { tmpx += singleWidth(p.bv, par, pos); if (pos >= main_body) tmpx += p.hfill; - else + else tmpx += p.label_hfill; } - + else if (par->isSeparator(pos)) { tmpx += singleWidth(p.bv, par, pos); if (pos >= main_body) @@ -3124,7 +3124,7 @@ void LyXText::paintRowSelection(DrawRowParams & p) } else { tmpx += singleWidth(p.bv, par, pos); } - + if ((startrow != row || selection.start.pos() <= pos) && (endrow != row || pos < selection.end.pos())) { // Here we do not use p.x as p.xo was added to p.x. @@ -3140,7 +3140,7 @@ void LyXText::paintRowSelection(DrawRowParams & p) } } } - + void LyXText::paintRowAppendix(DrawRowParams & p) { @@ -3154,11 +3154,11 @@ void LyXText::paintRowAppendix(DrawRowParams & p) } } - + void LyXText::paintRowDepthBar(DrawRowParams & p) { Paragraph::depth_type const depth = p.row->par()->getDepth(); - + if (depth <= 0) return; @@ -3172,11 +3172,11 @@ void LyXText::paintRowDepthBar(DrawRowParams & p) for (Paragraph::depth_type i = 1; i <= depth; ++i) { int const x = (LYX_PAPER_MARGIN / 5) * i + p.xo; int const h = p.yo + p.row->height() - 1 - (i - next_depth - 1) * 3; - + p.pain->line(x, p.yo, x, h, LColor::depthbar); - + int const w = LYX_PAPER_MARGIN / 5; - + if (i > prev_depth) { p.pain->fillRectangle(x, p.yo, w, 2, LColor::depthbar); } @@ -3195,7 +3195,7 @@ int LyXText::getLengthMarkerHeight(BufferView * bv, VSpace const & vsp) const if (vsp.kind() != VSpace::LENGTH) { return space_size; } - + LyXFont font; font.decSize(); int const min_size = max(3 * arrow_size, @@ -3204,16 +3204,16 @@ int LyXText::getLengthMarkerHeight(BufferView * bv, VSpace const & vsp) const if (vsp.length().len().value() < 0.0) return min_size; - else + else return max(min_size, space_size); } - + int LyXText::drawLengthMarker(DrawRowParams & p, string const & prefix, VSpace const & vsp, int start) { int const arrow_size = 4; - int const size = getLengthMarkerHeight(p.bv, vsp); + int const size = getLengthMarkerHeight(p.bv, vsp); int const end = start + size; // the label to display (if any) @@ -3243,26 +3243,26 @@ int LyXText::drawLengthMarker(DrawRowParams & p, string const & prefix, // nothing to draw here return size; } - + int const leftx = p.xo + leftMargin(p.bv, p.row); int const midx = leftx + arrow_size; int const rightx = midx + arrow_size; - + // first the string int w = 0; int a = 0; int d = 0; - + LyXFont font; font.setColor(LColor::added_space).decSize(); lyxfont::rectText(str, font, w, a, d); - - p.pain->rectText(leftx + 2 * arrow_size + 5, + + p.pain->rectText(leftx + 2 * arrow_size + 5, start + ((end - start) / 2) + d, str, font, backgroundColor(), backgroundColor()); - + // top arrow p.pain->line(leftx, ty1, midx, ty2, LColor::added_space); p.pain->line(midx, ty2, rightx, ty1, LColor::added_space); @@ -3276,18 +3276,18 @@ int LyXText::drawLengthMarker(DrawRowParams & p, string const & prefix, return size; } - - + + void LyXText::paintFirstRow(DrawRowParams & p) { - Paragraph * par = p.row->par(); + Paragraph * par = p.row->par(); ParagraphParameters const & parparams = par->params(); - + // start of appendix? if (parparams.startOfAppendix()) { p.pain->line(1, p.yo, p.width - 2, p.yo, LColor::appendixline); } - + int y_top = 0; // think about the margins @@ -3297,13 +3297,13 @@ void LyXText::paintFirstRow(DrawRowParams & p) // draw a top pagebreak if (parparams.pagebreakTop()) { int const y = p.yo + y_top + 2*defaultHeight(); - p.pain->line(p.xo, y, p.xo + p.width, y, + p.pain->line(p.xo, y, p.xo + p.width, y, LColor::pagebreak, Painter::line_onoffdash); - + int w = 0; int a = 0; int d = 0; - + LyXFont pb_font; pb_font.setColor(LColor::pagebreak).decSize(); lyxfont::rectText(_("Page Break (top)"), pb_font, w, a, d); @@ -3313,11 +3313,11 @@ void LyXText::paintFirstRow(DrawRowParams & p) backgroundColor()); y_top += 3 * defaultHeight(); } - + // draw the additional space if needed: y_top += drawLengthMarker(p, _("Space above"), parparams.spaceTop(), p.yo + y_top); - + Buffer const * buffer = p.bv->buffer(); LyXTextClass const & tclass = textclasslist[buffer->params.textclass]; @@ -3332,34 +3332,34 @@ void LyXText::paintFirstRow(DrawRowParams & p) y_top += buffer->params.getDefSkip().inPixels(p.bv); } else { LyXLayout const & playout = - tclass[par->previous()->layout()]; + tclass[par->previous()->layout()]; if (playout.latextype == LATEX_PARAGRAPH && !par->previous()->getDepth()) { - // is it right to use defskip here, too? (AS) + // is it right to use defskip here, too? (AS) y_top += buffer->params.getDefSkip().inPixels(p.bv); } } } } - + int const ww = p.bv->workWidth(); - + // draw a top line if (parparams.lineTop()) { LyXFont font(LyXFont::ALL_SANE); int const asc = lyxfont::ascent('x', getFont(buffer, par, 0)); - + y_top += asc; - + int const w = (inset_owner ? inset_owner->width(p.bv, font) : ww); int const xp = static_cast(inset_owner ? p.xo : 0); p.pain->line(xp, p.yo + y_top, xp + w, p.yo + y_top, LColor::topline, Painter::line_solid, Painter::line_thick); - + y_top += asc; } - + bool const is_rtl = p.row->par()->isRightToLeftPar(p.bv->buffer()->params); // should we print a label? @@ -3367,12 +3367,12 @@ void LyXText::paintFirstRow(DrawRowParams & p) && (layout.labeltype != LABEL_STATIC || layout.latextype != LATEX_ENVIRONMENT || par->isFirstInSequence())) { - + LyXFont font = getLabelFont(buffer, par); if (!par->getLabelstring().empty()) { float x = p.x; string const str = par->getLabelstring(); - + // this is special code for the chapter layout. This is // printed in an extra row and has a pagebreak at // the top. @@ -3384,18 +3384,18 @@ void LyXText::paintFirstRow(DrawRowParams & p) } else { spacing_val = buffer->params.spacing.getValue(); } - - int const maxdesc = + + int const maxdesc = int(lyxfont::maxDescent(font) * layout.spacing.getValue() * spacing_val) + int(layout.parsep) * defaultHeight(); - + if (is_rtl) { - x = ww - leftMargin(p.bv, p.row) - + x = ww - leftMargin(p.bv, p.row) - lyxfont::width(str, font); } - + p.pain->text(int(x), - p.yo + p.row->baseline() - + p.yo + p.row->baseline() - p.row->ascent_of_text() - maxdesc, str, font); } @@ -3426,18 +3426,18 @@ void LyXText::paintFirstRow(DrawRowParams & p) } else { spacing_val = buffer->params.spacing.getValue(); } - - int maxdesc = + + int maxdesc = int(lyxfont::maxDescent(font) * layout.spacing.getValue() * spacing_val + (layout.labelbottomsep * defaultHeight())); - + float x = p.x; if (layout.labeltype == LABEL_CENTERED_TOP_ENVIRONMENT) { x = ((is_rtl ? leftMargin(p.bv, p.row) : p.x) - + ww - rightMargin(buffer, p.row)) / 2; + + ww - rightMargin(buffer, p.row)) / 2; x -= lyxfont::width(str, font) / 2; } else if (is_rtl) { - x = ww - leftMargin(p.bv, p.row) - + x = ww - leftMargin(p.bv, p.row) - lyxfont::width(str, font); } p.pain->text(int(x), p.yo + p.row->baseline() @@ -3445,7 +3445,7 @@ void LyXText::paintFirstRow(DrawRowParams & p) str, font); } } - + if (layout.labeltype == LABEL_BIBLIO && par->bibkey) { LyXFont font = getLayoutFont(buffer, par); float x; @@ -3459,29 +3459,29 @@ void LyXText::paintFirstRow(DrawRowParams & p) par->bibkey->draw(p.bv, font, p.yo + p.row->baseline(), x, p.cleared); } } - - + + void LyXText::paintLastRow(DrawRowParams & p) { Paragraph * par = p.row->par(); ParagraphParameters const & parparams = par->params(); int y_bottom = p.row->height() - 1; - + // think about the margins if (!p.row->next() && bv_owner) y_bottom -= LYX_PAPER_MARGIN; - + int const ww = p.bv->workWidth(); - + // draw a bottom pagebreak if (parparams.pagebreakBottom()) { LyXFont pb_font; pb_font.setColor(LColor::pagebreak).decSize(); int const y = p.yo + y_bottom - 2 * defaultHeight(); - + p.pain->line(p.xo, y, p.xo + p.width, y, LColor::pagebreak, Painter::line_onoffdash); - + int w = 0; int a = 0; int d = 0; @@ -3489,40 +3489,40 @@ void LyXText::paintLastRow(DrawRowParams & p) p.pain->rectText((ww - w) / 2, y + d, _("Page Break (bottom)"), pb_font, backgroundColor(), backgroundColor()); - + y_bottom -= 3 * defaultHeight(); } - + // draw the additional space if needed: int const height = getLengthMarkerHeight(p.bv, parparams.spaceBottom()); y_bottom -= drawLengthMarker(p, _("Space below"), parparams.spaceBottom(), p.yo + y_bottom - height); - + Buffer const * buffer = p.bv->buffer(); - + // draw a bottom line if (parparams.lineBottom()) { LyXFont font(LyXFont::ALL_SANE); int const asc = lyxfont::ascent('x', getFont(buffer, par, max(pos_type(0), par->size() - 1))); - + y_bottom -= asc; - + int const w = (inset_owner ? inset_owner->width(p.bv, font) : ww); int const xp = static_cast(inset_owner ? p.xo : 0); - int const y = p.yo + y_bottom; + int const y = p.yo + y_bottom; p.pain->line(xp, y, xp + w, y, LColor::topline, Painter::line_solid, Painter::line_thick); - + y_bottom -= asc; } bool const is_rtl = p.row->par()->isRightToLeftPar(p.bv->buffer()->params); int const endlabel = par->getEndLabel(buffer->params); - + // draw an endlabel switch (endlabel) { case END_LABEL_BOX: @@ -3535,7 +3535,7 @@ void LyXText::paintLastRow(DrawRowParams & p) if (p.row->fill() <= size) x += (size - p.row->fill() + 1) * (is_rtl ? -1 : 1); - + if (endlabel == END_LABEL_BOX) { p.pain->rectangle(x, y, size, size, LColor::eolmarker); } else { @@ -3564,17 +3564,17 @@ void LyXText::paintLastRow(DrawRowParams & p) void LyXText::paintRowText(DrawRowParams & p) { Paragraph * par = p.row->par(); - Buffer const * buffer = p.bv->buffer(); - + Buffer const * buffer = p.bv->buffer(); + pos_type const last = rowLastPrintable(p.row); - pos_type main_body = + pos_type main_body = beginningOfMainBody(buffer, par); - if (main_body > 0 && - (main_body - 1 > last || + if (main_body > 0 && + (main_body - 1 > last || !par->isLineSeparator(main_body - 1))) { main_body = 0; } - + LyXLayout const & layout = textclasslist[buffer->params.textclass][par->layout()]; @@ -3588,7 +3588,7 @@ void LyXText::paintRowText(DrawRowParams & p) p.x += p.label_hfill + lwidth - singleWidth(p.bv, par, main_body - 1); } - + if (par->isHfill(pos)) { p.x += 1; @@ -3597,10 +3597,10 @@ void LyXText::paintRowText(DrawRowParams & p) p.pain->line(int(p.x), y1, int(p.x), y0, LColor::added_space); - + if (hfillExpansion(buffer, p.row, pos)) { int const y2 = (y0 + y1) / 2; - + if (pos >= main_body) { p.pain->line(int(p.x), y2, int(p.x + p.hfill), y2, @@ -3633,7 +3633,7 @@ void LyXText::paintRowText(DrawRowParams & p) void LyXText::getVisibleRow(BufferView * bv, int y_offset, int x_offset, - Row * row, int y, bool cleared) + Row * row, int y, bool cleared) { if (row->height() <= 0) { lyxerr << "LYX_ERROR: row.height: " @@ -3656,7 +3656,7 @@ void LyXText::getVisibleRow(BufferView * bv, int y_offset, int x_offset, p.y = y; p.width = inset_owner ? inset_owner->textWidth(bv, true) : bv->workWidth(); p.cleared = cleared; - + // start painting // clear to background if necessary @@ -3672,7 +3672,7 @@ void LyXText::getVisibleRow(BufferView * bv, int y_offset, int x_offset, // environment depth brackets paintRowDepthBar(p); - + // draw any stuff wanted for a first row of a paragraph if (!row->pos()) { paintFirstRow(p); @@ -3681,12 +3681,12 @@ void LyXText::getVisibleRow(BufferView * bv, int y_offset, int x_offset, // draw any stuff wanted for the last row of a paragraph if (!row->next() || (row->next()->par() != row->par())) { paintLastRow(p); - } + } // paint text - paintRowText(p); + paintRowText(p); } - + int LyXText::defaultHeight() const { @@ -3694,9 +3694,9 @@ int LyXText::defaultHeight() const return int(lyxfont::maxAscent(font) + lyxfont::maxDescent(font) * 1.5); } - -/* returns the column near the specified x-coordinate of the row -* x is set to the real beginning of this column */ + +/* returns the column near the specified x-coordinate of the row +* x is set to the real beginning of this column */ pos_type LyXText::getColumnNearX(BufferView * bview, Row * row, int & x, bool & boundary) const @@ -3705,7 +3705,7 @@ LyXText::getColumnNearX(BufferView * bview, Row * row, int & x, float fill_separator; float fill_hfill; float fill_label_hfill; - + prepareToPrint(bview, row, tmpx, fill_separator, fill_hfill, fill_label_hfill); @@ -3719,12 +3719,12 @@ LyXText::getColumnNearX(BufferView * bview, Row * row, int & x, pos_type main_body = beginningOfMainBody(bview->buffer(), row->par()); float last_tmpx = tmpx; - + if (main_body > 0 && - (main_body - 1 > last || + (main_body - 1 > last || !row->par()->isLineSeparator(main_body - 1))) main_body = 0; - + while (vc <= last && tmpx <= x) { c = vis2log(vc); last_tmpx = tmpx; @@ -3735,7 +3735,7 @@ LyXText::getColumnNearX(BufferView * bview, Row * row, int & x, if (row->par()->isLineSeparator(main_body - 1)) tmpx -= singleWidth(bview, row->par(), main_body-1); } - + if (hfillExpansion(bview->buffer(), row, c)) { x += singleWidth(bview, row->par(), c); if (c >= main_body) @@ -3751,7 +3751,7 @@ LyXText::getColumnNearX(BufferView * bview, Row * row, int & x, tmpx += singleWidth(bview, row->par(), c); ++vc; } - + if ((tmpx + last_tmpx) / 2 > x) { tmpx = last_tmpx; left_side = true; @@ -3762,12 +3762,12 @@ LyXText::getColumnNearX(BufferView * bview, Row * row, int & x, boundary = false; bool const lastrow = lyxrc.rtl_support // This is not needed, but gives - // some speedup if rtl_support=false + // some speedup if rtl_support=false && (!row->next() || row->next()->par() != row->par()); bool const rtl = (lastrow) ? row->par()->isRightToLeftPar(bview->buffer()->params) : false; // If lastrow is false, we don't need to compute - // the value of rtl. + // the value of rtl. if (row->pos() > last) // Row is empty? c = row->pos(); @@ -3801,23 +3801,23 @@ LyXText::getColumnNearX(BufferView * bview, Row * row, int & x, x = int(tmpx); return c; } - + // returns pointer to a specified row Row * LyXText::getRow(Paragraph * par, pos_type pos, int & y) const { if (!firstrow) return 0; - + Row * tmprow = firstrow; y = 0; - + // find the first row of the specified paragraph while (tmprow->next() && tmprow->par() != par) { y += tmprow->height(); tmprow = tmprow->next(); } - + // now find the wanted row while (tmprow->pos() < pos && tmprow->next() @@ -3826,7 +3826,7 @@ Row * LyXText::getRow(Paragraph * par, pos_type pos, int & y) const y += tmprow->height(); tmprow = tmprow->next(); } - + return tmprow; } @@ -3837,20 +3837,20 @@ Row * LyXText::getRowNearY(int & y) const // If possible we should optimize this method. (Lgb) Row * tmprow = firstrow; int tmpy = 0; - + while (tmprow->next() && tmpy + tmprow->height() <= y) { tmpy += tmprow->height(); tmprow = tmprow->next(); } - + y = tmpy; // return the real y //lyxerr << "returned y = " << y << endl; - + return tmprow; #else // Search from the current cursor position. - + Row * tmprow = cursor.row(); int tmpy = cursor.y() - tmprow->baseline(); @@ -3859,7 +3859,7 @@ Row * LyXText::getRowNearY(int & y) const lyxerr << "tmprow->baseline() = " << tmprow->baseline() << endl; lyxerr << "first = " << first << endl; lyxerr << "y = " << y << endl; - + if (y < tmpy) { lyxerr << "up" << endl; #if 0 @@ -3875,7 +3875,7 @@ Row * LyXText::getRowNearY(int & y) const #endif } else if (y > tmpy) { lyxerr << "down" << endl; - + while (tmprow->next() && tmpy + tmprow->height() <= y) { tmpy += tmprow->height(); tmprow = tmprow->next(); @@ -3883,11 +3883,11 @@ Row * LyXText::getRowNearY(int & y) const } else { lyxerr << "equal" << endl; } - + y = tmpy; // return the real y lyxerr << "returned y = " << y << endl; - + return tmprow; #endif diff --git a/src/text2.C b/src/text2.C index bbed1cb927..f9d2a574d6 100644 --- a/src/text2.C +++ b/src/text2.C @@ -1,8 +1,8 @@ /* This file is part of * ====================================================== - * + * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team. * @@ -93,7 +93,7 @@ void LyXText::init(BufferView * bview, bool reinit) Paragraph * par = ownerParagraph(); current_font = getFont(bview->buffer(), par, 0); - + while (par) { insertParagraph(bview, par, lastrow); par = par->next(); @@ -123,7 +123,7 @@ LyXFont const realizeFont(LyXFont const & font, { LyXFont tmpfont(font); Paragraph::depth_type par_depth = par->getDepth(); - + // Resolve against environment font information while (par && par_depth && !tmpfont.resolved()) { par = par->outerHook(); @@ -145,7 +145,7 @@ LyXFont const realizeFont(LyXFont const & font, tmpfont.realize(textclasslist[buf->params.textclass].defaultfont()); #else tmpfont.realize(textclasslist[buf->params.textclass].defaultfont(), - buf->params.language); + buf->params.language); #endif return tmpfont; @@ -162,13 +162,13 @@ LyXFont const realizeFont(LyXFont const & font, // If position is -1, we get the layout font of the paragraph. // If position is -2, we get the font of the manual label of the paragraph. LyXFont const LyXText::getFont(Buffer const * buf, Paragraph * par, - pos_type pos) const + pos_type pos) const { lyx::Assert(pos >= 0); - - LyXLayout const & layout = + + LyXLayout const & layout = textclasslist[buf->params.textclass][par->layout()]; - + Paragraph::depth_type par_depth = par->getDepth(); // We specialize the 95% common case: if (!par_depth) { @@ -194,11 +194,11 @@ LyXFont const LyXText::getFont(Buffer const * buf, Paragraph * par, #endif } } - + // The uncommon case need not be optimized as much - + LyXFont layoutfont; - + if (pos < beginningOfMainBody(buf, par)) { // 1% goes here layoutfont = layout.labelfont; @@ -215,14 +215,14 @@ LyXFont const LyXText::getFont(Buffer const * buf, Paragraph * par, #endif if (par->inInset()) par->inInset()->getDrawFont(tmpfont); - + return realizeFont(tmpfont, buf, par); } LyXFont const LyXText::getLayoutFont(Buffer const * buf, Paragraph * par) const { - LyXLayout const & layout = + LyXLayout const & layout = textclasslist[buf->params.textclass][par->layout()]; Paragraph::depth_type par_depth = par->getDepth(); @@ -237,7 +237,7 @@ LyXFont const LyXText::getLayoutFont(Buffer const * buf, Paragraph * par) const LyXFont const LyXText::getLabelFont(Buffer const * buf, Paragraph * par) const { - LyXLayout const & layout = + LyXLayout const & layout = textclasslist[buf->params.textclass][par->layout()]; Paragraph::depth_type par_depth = par->getDepth(); @@ -251,8 +251,8 @@ LyXFont const LyXText::getLabelFont(Buffer const * buf, Paragraph * par) const void LyXText::setCharFont(BufferView * bv, Paragraph * par, - pos_type pos, LyXFont const & fnt, - bool toggleall) + pos_type pos, LyXFont const & fnt, + bool toggleall) { Buffer const * buf = bv->buffer(); LyXFont font = getFont(buf, par, pos); @@ -273,7 +273,7 @@ void LyXText::setCharFont(BufferView * bv, Paragraph * par, void LyXText::setCharFont(Buffer const * buf, Paragraph * par, - pos_type pos, LyXFont const & fnt) + pos_type pos, LyXFont const & fnt) { LyXFont font(fnt); @@ -298,9 +298,9 @@ void LyXText::setCharFont(Buffer const * buf, Paragraph * par, layoutfont.realize(tclass[tp->layout()].font); #else layoutfont.realize(textclasslist. - Style(buf->params.textclass, - tp->layout()).font, - buf->params.language); + Style(buf->params.textclass, + tp->layout()).font, + buf->params.language); #endif } } @@ -321,7 +321,7 @@ void LyXText::setCharFont(Buffer const * buf, Paragraph * par, // inserts a new row behind the specified row, increments // the touched counters void LyXText::insertRow(Row * row, Paragraph * par, - pos_type pos) const + pos_type pos) const { Row * tmprow = new Row; if (!row) { @@ -333,14 +333,14 @@ void LyXText::insertRow(Row * row, Paragraph * par, tmprow->next(row->next()); row->next(tmprow); } - + if (tmprow->next()) tmprow->next()->previous(tmprow); - + if (tmprow->previous()) tmprow->previous()->next(tmprow); - - + + tmprow->par(par); tmprow->pos(pos); @@ -372,7 +372,7 @@ void LyXText::removeRow(Row * row) const } height -= row->height(); // the text becomes smaller - + delete row; --number_of_rows; // one row less } @@ -383,7 +383,7 @@ void LyXText::removeParagraph(Row * row) const { Paragraph * tmppar = row->par(); row = row->next(); - + Row * tmprow; while (row && row->par() == tmppar) { tmprow = row->next(); @@ -391,17 +391,17 @@ void LyXText::removeParagraph(Row * row) const row = tmprow; } } - + // insert the specified paragraph behind the specified row void LyXText::insertParagraph(BufferView * bview, Paragraph * par, - Row * row) const + Row * row) const { - insertRow(row, par, 0); /* insert a new row, starting - * at postition 0 */ + insertRow(row, par, 0); /* insert a new row, starting + * at postition 0 */ setCounter(bview->buffer(), par); // set the counters - + // and now append the whole paragraph behind the new row if (!row) { firstrow->height(0); @@ -418,7 +418,7 @@ Inset * LyXText::getInset() const Inset * inset = 0; if (cursor.pos() == 0 && cursor.par()->bibkey) { inset = cursor.par()->bibkey; - } else if (cursor.pos() < cursor.par()->size() + } else if (cursor.pos() < cursor.par()->size() && cursor.par()->isInset(cursor.pos())) { inset = cursor.par()->getInset(cursor.pos()); } @@ -470,7 +470,7 @@ void LyXText::makeFontEntriesLayoutSpecific(Buffer const * buf, layoutfont = layout.labelfont; else layoutfont = layout.font; - + LyXFont tmpfont = par->getFontSettings(buf->params, pos); tmpfont.reduce(layoutfont); par->setFont(pos, tmpfont); @@ -485,7 +485,7 @@ Paragraph * LyXText::setLayout(BufferView * bview, { Paragraph * endpar = send_cur.par()->next(); Paragraph * undoendpar = endpar; - + if (endpar && endpar->getDepth()) { while (endpar && endpar->getDepth()) { endpar = endpar->next(); @@ -494,16 +494,16 @@ Paragraph * LyXText::setLayout(BufferView * bview, } else if (endpar) { endpar = endpar->next(); // because of parindents etc. } - + setUndo(bview, Undo::EDIT, sstart_cur.par(), undoendpar); - + // ok we have a selection. This is always between sstart_cur // and sel_end cursor cur = sstart_cur; LyXLayout const & lyxlayout = textclasslist[bview->buffer()->params.textclass][layout]; - + do { cur.par()->applyLayout(layout); makeFontEntriesLayoutSpecific(bview->buffer(), cur.par()); @@ -511,7 +511,7 @@ Paragraph * LyXText::setLayout(BufferView * bview, fppar->params().spaceTop(lyxlayout.fill_top ? VSpace(VSpace::VFILL) : VSpace(VSpace::NONE)); - fppar->params().spaceBottom(lyxlayout.fill_bottom ? + fppar->params().spaceBottom(lyxlayout.fill_bottom ? VSpace(VSpace::VFILL) : VSpace(VSpace::NONE)); if (lyxlayout.margintype == MARGIN_MANUAL) @@ -524,7 +524,7 @@ Paragraph * LyXText::setLayout(BufferView * bview, if (cur.par() != send_cur.par()) cur.par(cur.par()->next()); } while (cur.par() != send_cur.par()); - + return endpar; } @@ -543,7 +543,7 @@ void LyXText::setLayout(BufferView * bview, string const & layout) Paragraph * endpar = setLayout(bview, cursor, selection.start, selection.end, layout); redoParagraphs(bview, selection.start, endpar); - + // we have to reset the selection, because the // geometry could have changed setCursor(bview, selection.start.par(), @@ -580,7 +580,7 @@ void LyXText::incDepth(BufferView * bview) } else if (endpar) { endpar = endpar->next(); // because of parindents etc. } - + setUndo(bview, Undo::EDIT, selection.start.par(), undoendpar); @@ -589,12 +589,12 @@ void LyXText::incDepth(BufferView * bview) // ok we have a selection. This is always between sel_start_cursor // and sel_end cursor cursor = selection.start; - + bool anything_changed = false; - + LyXTextClass const & tclass = textclasslist[bview->buffer()->params.textclass]; - + while (true) { // NOTE: you can't change the depth of a bibliography entry if (tclass[cursor.par()->layout()].labeltype != LABEL_BIBLIO) { @@ -612,7 +612,7 @@ void LyXText::incDepth(BufferView * bview) break; cursor.par(cursor.par()->next()); } - + // if nothing changed set all depth to 0 if (!anything_changed) { cursor = selection.start; @@ -622,9 +622,9 @@ void LyXText::incDepth(BufferView * bview) } cursor.par()->params().depth(0); } - + redoParagraphs(bview, selection.start, endpar); - + // we have to reset the selection, because the // geometry could have changed setCursor(bview, selection.start.par(), selection.start.pos()); @@ -658,7 +658,7 @@ void LyXText::decDepth(BufferView * bview) } else if (endpar) { endpar = endpar->next(); // because of parindents etc. } - + setUndo(bview, Undo::EDIT, selection.start.par(), undoendpar); @@ -680,7 +680,7 @@ void LyXText::decDepth(BufferView * bview) } redoParagraphs(bview, selection.start, endpar); - + // we have to reset the selection, because the // geometry could have changed setCursor(bview, selection.start.par(), @@ -702,7 +702,7 @@ void LyXText::setFont(BufferView * bview, LyXFont const & font, bool toggleall) // Determine basis font LyXFont layoutfont; if (cursor.pos() < beginningOfMainBody(bview->buffer(), - cursor.par())) { + cursor.par())) { layoutfont = getLabelFont(bview->buffer(), cursor.par()); } else { @@ -710,7 +710,7 @@ void LyXText::setFont(BufferView * bview, LyXFont const & font, bool toggleall) cursor.par()); } // Update current font - real_current_font.update(font, + real_current_font.update(font, bview->buffer()->params.language, toggleall); @@ -722,18 +722,18 @@ void LyXText::setFont(BufferView * bview, LyXFont const & font, bool toggleall) real_current_font.realize(layoutfont); #else real_current_font.realize(layoutfont, - bview->buffer()->params.language); + bview->buffer()->params.language); #endif return; } LyXCursor tmpcursor = cursor; // store the current cursor - + // ok we have a selection. This is always between sel_start_cursor // and sel_end cursor - + setUndo(bview, Undo::EDIT, - selection.start.par(), selection.end.par()->next()); + selection.start.par(), selection.end.par()->next()); freezeUndo(); cursor = selection.start; while (cursor.par() != selection.end.par() || @@ -751,9 +751,9 @@ void LyXText::setFont(BufferView * bview, LyXFont const & font, bool toggleall) } } unFreezeUndo(); - + redoParagraphs(bview, selection.start, selection.end.par()->next()); - + // we have to reset the selection, because the // geometry could have changed, but we keep // it for user convenience @@ -762,7 +762,7 @@ void LyXText::setFont(BufferView * bview, LyXFont const & font, bool toggleall) setCursor(bview, selection.end.par(), selection.end.pos()); setSelection(bview); setCursor(bview, tmpcursor.par(), tmpcursor.pos(), true, - tmpcursor.boundary()); + tmpcursor.boundary()); } @@ -772,14 +772,14 @@ void LyXText::redoHeightOfParagraph(BufferView * bview, LyXCursor const & cur) int y = cur.y() - tmprow->baseline(); setHeightOfRow(bview, tmprow); - + while (tmprow->previous() && tmprow->previous()->par() == tmprow->par()) { tmprow = tmprow->previous(); y -= tmprow->height(); setHeightOfRow(bview, tmprow); } - + // we can set the refreshing parameters now status(bview, LyXText::NEED_MORE_REFRESH); refresh_y = y; @@ -791,7 +791,7 @@ void LyXText::redoHeightOfParagraph(BufferView * bview, LyXCursor const & cur) void LyXText::redoDrawingOfParagraph(BufferView * bview, LyXCursor const & cur) { Row * tmprow = cur.row(); - + int y = cur.y() - tmprow->baseline(); setHeightOfRow(bview, tmprow); @@ -812,17 +812,17 @@ void LyXText::redoDrawingOfParagraph(BufferView * bview, LyXCursor const & cur) // deletes and inserts again all paragaphs between the cursor -// and the specified par +// and the specified par // This function is needed after SetLayout and SetFont etc. void LyXText::redoParagraphs(BufferView * bview, LyXCursor const & cur, - Paragraph const * endpar) const + Paragraph const * endpar) const { Row * tmprow2; Paragraph * tmppar = 0; Paragraph * first_phys_par = 0; - + Row * tmprow = cur.row(); - + int y = cur.y() - tmprow->baseline(); if (!tmprow->previous()) { @@ -845,8 +845,8 @@ void LyXText::redoParagraphs(BufferView * bview, LyXCursor const & cur, status(bview, LyXText::NEED_MORE_REFRESH); refresh_y = y; refresh_row = tmprow->previous(); /* the real refresh row will - be deleted, so I store - the previous here */ + be deleted, so I store + the previous here */ // remove it if (tmprow->next()) tmppar = tmprow->next()->par(); @@ -860,13 +860,13 @@ void LyXText::redoParagraphs(BufferView * bview, LyXCursor const & cur, tmppar = 0; } } - + // remove the first one tmprow2 = tmprow; /* this is because tmprow->previous() - can be 0 */ + can be 0 */ tmprow = tmprow->previous(); removeRow(tmprow2); - + tmppar = first_phys_par; do { @@ -882,17 +882,17 @@ void LyXText::redoParagraphs(BufferView * bview, LyXCursor const & cur, tmppar = tmppar->next(); } } while (tmppar && tmppar != endpar); - + // this is because of layout changes if (refresh_row) { refresh_y -= refresh_row->height(); - setHeightOfRow(bview, refresh_row); + setHeightOfRow(bview, refresh_row); } else { refresh_row = firstrow; refresh_y = 0; - setHeightOfRow(bview, refresh_row); + setHeightOfRow(bview, refresh_row); } - + if (tmprow && tmprow->next()) setHeightOfRow(bview, tmprow->next()); } @@ -919,7 +919,7 @@ bool LyXText::fullRebreak(BufferView * bview) /* the cursor set functions have a special mechanism. When they * realize, that you left an empty paragraph, they will delete it. * They also delete the corresponding row */ - + // need the selection cursor: void LyXText::setSelection(BufferView * bview) { @@ -930,9 +930,9 @@ void LyXText::setSelection(BufferView * bview) selection.start = selection.cursor; selection.end = selection.cursor; } - + selection.set(true); - + // first the toggling area if (cursor.y() < last_sel_cursor.y() || (cursor.y() == last_sel_cursor.y() @@ -943,9 +943,9 @@ void LyXText::setSelection(BufferView * bview) toggle_end_cursor = cursor; toggle_cursor = last_sel_cursor; } - + last_sel_cursor = cursor; - + // and now the whole selection if (selection.cursor.par() == cursor.par()) @@ -953,7 +953,7 @@ void LyXText::setSelection(BufferView * bview) selection.end = cursor; selection.start = selection.cursor; } else { - selection.end = selection.cursor; + selection.end = selection.cursor; selection.start = cursor; } else if (selection.cursor.y() < cursor.y() || @@ -963,12 +963,12 @@ void LyXText::setSelection(BufferView * bview) selection.start = selection.cursor; } else { - selection.end = selection.cursor; + selection.end = selection.cursor; selection.start = cursor; } - + // a selection with no contents is not a selection - if (selection.start.par() == selection.end.par() && + if (selection.start.par() == selection.end.par() && selection.start.pos() == selection.end.pos()) selection.set(false); @@ -978,11 +978,11 @@ void LyXText::setSelection(BufferView * bview) string const LyXText::selectionAsString(Buffer const * buffer, - bool label) const + bool label) const { if (!selection.set()) return string(); string result; - + // Special handling if the whole selection is within one paragraph if (selection.start.par() == selection.end.par()) { result += selection.start.par()->asString(buffer, @@ -991,7 +991,7 @@ string const LyXText::selectionAsString(Buffer const * buffer, label); return result; } - + // The selection spans more than one paragraph // First paragraph in selection @@ -1000,7 +1000,7 @@ string const LyXText::selectionAsString(Buffer const * buffer, selection.start.par()->size(), label) + "\n\n"; - + // The paragraphs in between (if any) LyXCursor tmpcur(selection.start); tmpcur.par(tmpcur.par()->next()); @@ -1014,7 +1014,7 @@ string const LyXText::selectionAsString(Buffer const * buffer, // Last paragraph in selection result += selection.end.par()->asString(buffer, 0, selection.end.pos(), label); - + return result; } @@ -1068,10 +1068,10 @@ void LyXText::cursorBottom(BufferView * bview) const cursor.par(cursor.par()->next()); setCursor(bview, cursor.par(), cursor.par()->size()); } - - + + void LyXText::toggleFree(BufferView * bview, - LyXFont const & font, bool toggleall) + LyXFont const & font, bool toggleall) { // If the mask is completely neutral, tell user if (font == LyXFont(LyXFont::ALL_IGNORE)) { @@ -1081,11 +1081,11 @@ void LyXText::toggleFree(BufferView * bview, } // Try implicit word selection - // If there is a change in the language the implicit word selection + // If there is a change in the language the implicit word selection // is disabled. LyXCursor resetCursor = cursor; bool implicitSelection = (font.language() == ignore_language - && font.number() == LyXFont::IGNORE) + && font.number() == LyXFont::IGNORE) ? selectWordWhenUnderCursor(bview, WHOLE_WORD_STRICT) : false; // Set font @@ -1107,9 +1107,9 @@ void LyXText::toggleFree(BufferView * bview, string LyXText::getStringToIndex(BufferView * bview) { string idxstring; - + // Try implicit word selection - // If there is a change in the language the implicit word selection + // If there is a change in the language the implicit word selection // is disabled. LyXCursor resetCursor = cursor; bool implicitSelection = selectWordWhenUnderCursor(bview, PREVIOUS_WORD); @@ -1124,7 +1124,7 @@ string LyXText::getStringToIndex(BufferView * bview) } idxstring = selectionAsString(bview->buffer(), false); - + // Implicit selections are cleared afterwards //and cursor is set to the original position. if (implicitSelection) { @@ -1148,11 +1148,11 @@ pos_type LyXText::beginningOfMainBody(Buffer const * buf, } -/* the DTP switches for paragraphs. LyX will store them in the -* first physicla paragraph. When a paragraph is broken, the top settings -* rest, the bottom settings are given to the new one. So I can make shure, -* they do not duplicate themself and you cannnot make dirty things with -* them! */ +/* the DTP switches for paragraphs. LyX will store them in the +* first physicla paragraph. When a paragraph is broken, the top settings +* rest, the bottom settings are given to the new one. So I can make shure, +* they do not duplicate themself and you cannnot make dirty things with +* them! */ void LyXText::setParagraph(BufferView * bview, bool line_top, bool line_bottom, @@ -1160,9 +1160,9 @@ void LyXText::setParagraph(BufferView * bview, VSpace const & space_top, VSpace const & space_bottom, Spacing const & spacing, - LyXAlignment align, + LyXAlignment align, string labelwidthstring, - bool noindent) + bool noindent) { LyXCursor tmpcursor = cursor; if (!selection.set()) { @@ -1184,14 +1184,14 @@ void LyXText::setParagraph(BufferView * bview, // because of parindents etc. endpar = endpar->next(); } - + setUndo(bview, Undo::EDIT, selection.start.par(), undoendpar); - + Paragraph * tmppar = selection.end.par(); LyXTextClass const & tclass = textclasslist[bview->buffer()->params.textclass]; - + while (tmppar != selection.start.par()->previous()) { setCursor(bview, tmppar, 0); status(bview, LyXText::NEED_MORE_REFRESH); @@ -1203,10 +1203,10 @@ void LyXText::setParagraph(BufferView * bview, cursor.par()->params().pagebreakBottom(pagebreak_bottom); cursor.par()->params().spaceTop(space_top); cursor.par()->params().spaceBottom(space_bottom); - cursor.par()->params().spacing(spacing); + cursor.par()->params().spacing(spacing); // does the layout allow the new alignment? LyXLayout const & layout = tclass[cursor.par()->layout()]; - + if (align == LYX_ALIGN_LAYOUT) align = layout.align; if (align & layout.alignpossible) { @@ -1219,9 +1219,9 @@ void LyXText::setParagraph(BufferView * bview, cursor.par()->params().noindent(noindent); tmppar = cursor.par()->previous(); } - + redoParagraphs(bview, selection.start, endpar); - + clearSelection(); setCursor(bview, selection.start.par(), selection.start.pos()); selection.cursor = cursor; @@ -1259,7 +1259,7 @@ char hebrewCounter(int n) { static const char hebrew[22] = { 'à', 'á', 'â', 'ã', 'ä', 'å', 'æ', 'ç', 'è', - 'é', 'ë', 'ì', 'î', 'ð', 'ñ', 'ò', 'ô', 'ö', + 'é', 'ë', 'ì', 'î', 'ð', 'ñ', 'ò', 'ô', 'ö', '÷', 'ø', 'ù', 'ú' }; if (n < 1 || n > 22) @@ -1305,14 +1305,14 @@ void LyXText::setCounter(Buffer const * buf, Paragraph * par) const par->params().appendix(true); for (int i = 0; i < 10; ++i) { par->setCounter(i, 0); - } + } } par->enumdepth = par->previous()->enumdepth; par->itemdepth = par->previous()->itemdepth; } else { for (int i = 0; i < 10; ++i) { par->setCounter(i, 0); - } + } par->params().appendix(par->params().startOfAppendix()); par->enumdepth = 0; par->itemdepth = 0; @@ -1346,11 +1346,11 @@ void LyXText::setCounter(Buffer const * buf, Paragraph * par) const for (int i = 6 + par->enumdepth + 1; i < 10; ++i) par->setCounter(i, 0); } - + if (!par->params().labelString().empty()) { par->params().labelString(string()); } - + if (layout.margintype == MARGIN_MANUAL) { if (par->params().labelWidthString().empty()) { par->setLabelWidthString(layout.labelstring()); @@ -1358,21 +1358,21 @@ void LyXText::setCounter(Buffer const * buf, Paragraph * par) const } else { par->setLabelWidthString(string()); } - + // is it a layout that has an automatic label? if (layout.labeltype >= LABEL_COUNTER_CHAPTER) { - + int i = layout.labeltype - LABEL_COUNTER_CHAPTER; if (i >= 0 && i<= buf->params.secnumdepth) { - par->incCounter(i); // increment the counter - + par->incCounter(i); // increment the counter + // Is there a label? Useful for Chapter layout if (!par->params().appendix()) { if (!layout.labelstring().empty()) par->params().labelString(layout.labelstring()); else par->params().labelString(string()); - } else { + } else { if (!layout.labelstring_appendix().empty()) par->params().labelString(layout.labelstring_appendix()); else @@ -1401,7 +1401,7 @@ void LyXText::setCounter(Buffer const * buf, Paragraph * par) const << par->getCounter(i - 2) << '.' << par->getCounter(i - 1) << '.' << par->getCounter(i); - + break; case LABEL_COUNTER_PARAGRAPH: s << par->getCounter(i - 4) << '.' @@ -1424,7 +1424,7 @@ void LyXText::setCounter(Buffer const * buf, Paragraph * par) const // case it is, how can this be correct? // (Lgb) s << par->getCounter(i) << '.'; - break; + break; } } else { // appendix switch (2 * LABEL_COUNTER_CHAPTER - textclass.maxcounter() + i) { @@ -1499,7 +1499,7 @@ void LyXText::setCounter(Buffer const * buf, Paragraph * par) const // case it is, how can this be correct? // (Lgb) s << par->getCounter(i) << '.'; - + break; } } @@ -1507,7 +1507,7 @@ void LyXText::setCounter(Buffer const * buf, Paragraph * par) const par->params().labelString(par->params().labelString() +s.str().c_str()); // We really want to remove the c_str as soon as // possible... - + for (i++; i < 10; ++i) { // reset the following counters par->setCounter(i, 0); @@ -1562,8 +1562,8 @@ void LyXText::setCounter(Buffer const * buf, Paragraph * par) const // reset the following counters par->setCounter(i, 0); } - - } + + } } else if (layout.labeltype == LABEL_BIBLIO) {// ale970302 int i = LABEL_COUNTER_ENUMI - LABEL_COUNTER_CHAPTER + par->enumdepth; par->incCounter(i); @@ -1574,16 +1574,16 @@ void LyXText::setCounter(Buffer const * buf, Paragraph * par) const } par->bibkey->setCounter(number); par->params().labelString(layout.labelstring()); - + // In biblio should't be following counters but... } else { string s = layout.labelstring(); - + // the caption hack: if (layout.labeltype == LABEL_SENSITIVE) { bool isOK (par->inInset() && par->inInset()->owner() && (par->inInset()->owner()->lyxCode() == Inset::FLOAT_CODE)); - + if (isOK) { InsetFloat * tmp = static_cast(par->inInset()->owner()); Floating const & fl @@ -1591,16 +1591,16 @@ void LyXText::setCounter(Buffer const * buf, Paragraph * par) const // We should get the correct number here too. s = fl.name() + " #:"; } else { - /* par->SetLayout(0); + /* par->SetLayout(0); s = layout->labelstring; */ s = (par->getParLanguage(buf->params)->lang() == "hebrew") ? " :úåòîùî øñç" : "Senseless: "; } } par->params().labelString(s); - + /* reset the enumeration counter. They are always resetted - * when there is any other layout between */ + * when there is any other layout between */ for (int i = 6 + par->enumdepth; i < 10; ++i) par->setCounter(i, 0); } @@ -1623,15 +1623,15 @@ void LyXText::updateCounters(BufferView * bview, Row * row) const while (par) { while (row->par() != par) row = row->next(); - + setCounter(bview->buffer(), par); - + // now check for the headline layouts. remember that they // have a dynamic left margin LyXTextClass const & tclass = textclasslist[bview->buffer()->params.textclass]; LyXLayout const & layout = tclass[par->layout()]; - + if (layout.margintype == MARGIN_DYNAMIC || layout.labeltype == LABEL_SENSITIVE) { // Rebreak the paragraph @@ -1693,14 +1693,14 @@ void LyXText::cutSelection(BufferView * bview, bool doclear, bool realcut) // This doesn't make sense, if there is no selection if (!selection.set()) return; - + // OK, we have a selection. This is always between selection.start // and selection.end // make sure that the depth behind the selection are restored, too Paragraph * endpar = selection.end.par()->next(); Paragraph * undoendpar = endpar; - + if (endpar && endpar->getDepth()) { while (endpar && endpar->getDepth()) { endpar = endpar->next(); @@ -1709,10 +1709,10 @@ void LyXText::cutSelection(BufferView * bview, bool doclear, bool realcut) } else if (endpar) { endpar = endpar->next(); // because of parindents etc. } - + setUndo(bview, Undo::DELETE, selection.start.par(), undoendpar); - + // there are two cases: cut only within one paragraph or // more than one paragraph if (selection.start.par() == selection.end.par()) { @@ -1720,16 +1720,16 @@ void LyXText::cutSelection(BufferView * bview, bool doclear, bool realcut) endpar = selection.end.par(); int pos = selection.end.pos(); CutAndPaste::cutSelection(selection.start.par(), &endpar, - selection.start.pos(), pos, - bview->buffer()->params.textclass, + selection.start.pos(), pos, + bview->buffer()->params.textclass, doclear, realcut); selection.end.pos(pos); } else { endpar = selection.end.par(); int pos = selection.end.pos(); CutAndPaste::cutSelection(selection.start.par(), &endpar, - selection.start.pos(), pos, - bview->buffer()->params.textclass, + selection.start.pos(), pos, + bview->buffer()->params.textclass, doclear, realcut); cursor.par(endpar); selection.end.par(endpar); @@ -1774,11 +1774,11 @@ void LyXText::copySelection(BufferView * bview) && selection.start.par()->isLineSeparator(selection.start.pos()) && (selection.start.par() != selection.end.par() || selection.start.pos() < selection.end.pos())) - selection.start.pos(selection.start.pos() + 1); + selection.start.pos(selection.start.pos() + 1); CutAndPaste::copySelection(selection.start.par(), selection.end.par(), - selection.start.pos(), selection.end.pos(), - bview->buffer()->params.textclass); + selection.start.pos(), selection.end.pos(), + bview->buffer()->params.textclass); } @@ -1789,17 +1789,17 @@ void LyXText::pasteSelection(BufferView * bview) return; setUndo(bview, Undo::INSERT, - cursor.par(), cursor.par()->next()); + cursor.par(), cursor.par()->next()); Paragraph * endpar; Paragraph * actpar = cursor.par(); int pos = cursor.pos(); CutAndPaste::pasteSelection(&actpar, &endpar, pos, - bview->buffer()->params.textclass); - + bview->buffer()->params.textclass); + redoParagraphs(bview, cursor, endpar); - + setCursor(bview, cursor.par(), cursor.pos()); clearSelection(); @@ -1815,7 +1815,7 @@ void LyXText::setSelectionOverString(BufferView * bview, string const & str) { if (str.empty()) return; - + selection.cursor = cursor; for (string::size_type i = 0; i < str.length(); ++i) cursorRight(bview); @@ -1846,7 +1846,7 @@ void LyXText::replaceSelectionWithString(BufferView * bview, selection.end.par()->insertChar(pos, (*cit), font); ++pos; } - + // Cut the selection cutSelection(bview, true, false); @@ -1860,12 +1860,12 @@ void LyXText::insertStringAsLines(BufferView * bview, string const & str) Paragraph * par = cursor.par(); pos_type pos = cursor.pos(); Paragraph * endpar = cursor.par()->next(); - + setCursorParUndo(bview); - + // only to be sure, should not be neccessary clearSelection(); - + bview->buffer()->insertStringAsLines(par, pos, current_font, str); redoParagraphs(bview, cursor, endpar); @@ -1893,7 +1893,7 @@ void LyXText::insertStringAsParagraphs(BufferView * bview, string const & str) } else { linestr[i] = ' '; newline_inserted = true; - } + } } else if (IsPrintable(linestr[i])) { newline_inserted = false; } @@ -1915,8 +1915,8 @@ bool LyXText::gotoNextInset(BufferView * bview, res.par(res.par()->next()); res.pos(0); } - - } while (res.par() && + + } while (res.par() && !(res.par()->isInset(res.pos()) && (inset = res.par()->getInset(res.pos())) != 0 && find(codes.begin(), codes.end(), inset->lyxCode()) @@ -1934,14 +1934,14 @@ bool LyXText::gotoNextInset(BufferView * bview, void LyXText::checkParagraph(BufferView * bview, Paragraph * par, - pos_type pos) + pos_type pos) { - LyXCursor tmpcursor; + LyXCursor tmpcursor; int y = 0; pos_type z; Row * row = getRow(par, pos, y); - + // is there a break one row above if (row->previous() && row->previous()->par() == row->par()) { z = nextBreakPoint(bview, row->previous(), workWidth(bview)); @@ -1951,9 +1951,9 @@ void LyXText::checkParagraph(BufferView * bview, Paragraph * par, refresh_y = y; refresh_row = row->previous(); status(bview, LyXText::NEED_MORE_REFRESH); - + breakAgain(bview, row->previous()); - + // set the cursor again. Otherwise // dangling pointers are possible setCursor(bview, cursor.par(), cursor.pos(), @@ -1967,13 +1967,13 @@ void LyXText::checkParagraph(BufferView * bview, Paragraph * par, pos_type const tmplast = rowLast(row); refresh_y = y; refresh_row = row; - + breakAgain(bview, row); if (row->height() == tmpheight && rowLast(row) == tmplast) status(bview, LyXText::NEED_VERY_LITTLE_REFRESH); else - status(bview, LyXText::NEED_MORE_REFRESH); - + status(bview, LyXText::NEED_MORE_REFRESH); + // check the special right address boxes if (textclasslist[bview->buffer()->params.textclass][ par->layout()].margintype @@ -1985,29 +1985,29 @@ void LyXText::checkParagraph(BufferView * bview, Paragraph * par, tmpcursor.x(0); tmpcursor.x_fix(0); tmpcursor.pos(pos); - redoDrawingOfParagraph(bview, tmpcursor); + redoDrawingOfParagraph(bview, tmpcursor); } // set the cursor again. Otherwise dangling pointers are possible // also set the selection - + if (selection.set()) { tmpcursor = cursor; setCursorIntern(bview, selection.cursor.par(), selection.cursor.pos(), false, selection.cursor.boundary()); - selection.cursor = cursor; + selection.cursor = cursor; setCursorIntern(bview, selection.start.par(), selection.start.pos(), false, selection.start.boundary()); - selection.start = cursor; + selection.start = cursor; setCursorIntern(bview, selection.end.par(), selection.end.pos(), false, selection.end.boundary()); - selection.end = cursor; + selection.end = cursor; setCursorIntern(bview, last_sel_cursor.par(), last_sel_cursor.pos(), false, last_sel_cursor.boundary()); - last_sel_cursor = cursor; + last_sel_cursor = cursor; cursor = tmpcursor; } setCursorIntern(bview, cursor.par(), cursor.pos(), @@ -2024,9 +2024,9 @@ bool LyXText::updateInset(BufferView * bview, Inset * inset) checkParagraph(bview, cursor.par(), pos); return true; } - + // check every paragraph - + Paragraph * par = ownerParagraph(); do { pos = par->getPositionOfInset(inset); @@ -2036,14 +2036,14 @@ bool LyXText::updateInset(BufferView * bview, Inset * inset) } par = par->next(); } while (par); - + return false; } bool LyXText::setCursor(BufferView * bview, Paragraph * par, - pos_type pos, - bool setfont, bool boundary) const + pos_type pos, + bool setfont, bool boundary) const { LyXCursor old_cursor = cursor; setCursorIntern(bview, par, pos, setfont, boundary); @@ -2052,7 +2052,7 @@ bool LyXText::setCursor(BufferView * bview, Paragraph * par, void LyXText::setCursor(BufferView * bview, LyXCursor & cur, Paragraph * par, - pos_type pos, bool boundary) const + pos_type pos, bool boundary) const { lyx::Assert(par); lyx::Assert(bview); @@ -2077,7 +2077,7 @@ void LyXText::setCursor(BufferView * bview, LyXCursor & cur, Paragraph * par, Row * row = getRow(par, pos, y); // y is now the beginning of the cursor row y += row->baseline(); - // y is now the cursor baseline + // y is now the cursor baseline cur.y(y); // now get the cursors x position @@ -2086,7 +2086,7 @@ void LyXText::setCursor(BufferView * bview, LyXCursor & cur, Paragraph * par, float fill_hfill; float fill_label_hfill; prepareToPrint(bview, row, x, fill_separator, fill_hfill, - fill_label_hfill); + fill_label_hfill); pos_type cursor_vpos = 0; pos_type last = rowLastPrintable(row); @@ -2098,14 +2098,14 @@ void LyXText::setCursor(BufferView * bview, LyXCursor & cur, Paragraph * par, pos = row->pos(); cur.pos(pos); } - + if (last < row->pos()) cursor_vpos = row->pos(); else if (pos > last && !boundary) cursor_vpos = (row->par()->isRightToLeftPar(bview->buffer()->params)) - ? row->pos() : last + 1; + ? row->pos() : last + 1; else if (pos > row->pos() && - (pos > last || boundary)) + (pos > last || boundary)) /// Place cursor after char at (logical) position pos - 1 cursor_vpos = (bidi_level(pos - 1) % 2 == 0) ? log2vis(pos - 1) + 1 : log2vis(pos - 1); @@ -2113,14 +2113,14 @@ void LyXText::setCursor(BufferView * bview, LyXCursor & cur, Paragraph * par, /// Place cursor before char at (logical) position pos cursor_vpos = (bidi_level(pos) % 2 == 0) ? log2vis(pos) : log2vis(pos) + 1; - + pos_type main_body = beginningOfMainBody(bview->buffer(), row->par()); if ((main_body > 0) && - ((main_body-1 > last) || + ((main_body-1 > last) || !row->par()->isLineSeparator(main_body-1))) main_body = 0; - + for (pos_type vpos = row->pos(); vpos < cursor_vpos; ++vpos) { pos = vis2log(vpos); if (main_body > 0 && pos == main_body - 1) { @@ -2137,7 +2137,7 @@ void LyXText::setCursor(BufferView * bview, LyXCursor & cur, Paragraph * par, x += singleWidth(bview, row->par(), pos); if (pos >= main_body) x += fill_hfill; - else + else x += fill_label_hfill; } else if (row->par()->isSeparator(pos)) { x += singleWidth(bview, row->par(), pos); @@ -2146,7 +2146,7 @@ void LyXText::setCursor(BufferView * bview, LyXCursor & cur, Paragraph * par, } else x += singleWidth(bview, row->par(), pos); } - + cur.x(int(x)); cur.x_fix(cur.x()); cur.row(row); @@ -2154,7 +2154,7 @@ void LyXText::setCursor(BufferView * bview, LyXCursor & cur, Paragraph * par, void LyXText::setCursorIntern(BufferView * bview, Paragraph * par, - pos_type pos, bool setfont, bool boundary) const + pos_type pos, bool setfont, bool boundary) const { InsetText * it = static_cast(par->inInset()); if (it) { @@ -2181,7 +2181,7 @@ void LyXText::setCursorIntern(BufferView * bview, Paragraph * par, return; } } - + setCursor(bview, cursor, par, pos, boundary); if (setfont) setCurrentFont(bview); @@ -2200,7 +2200,7 @@ void LyXText::setCurrentFont(BufferView * bview) const else // potentional bug... BUG (Lgb) if (cursor.par()->isSeparator(pos)) { if (pos > cursor.row()->pos() && - bidi_level(pos) % 2 == + bidi_level(pos) % 2 == bidi_level(pos - 1) % 2) --pos; else if (pos + 1 < cursor.par()->size()) @@ -2239,7 +2239,7 @@ void LyXText::setCursorFromCoordinates(BufferView * bview, LyXCursor & cur, int x, int y) const { // Get the row first. - + Row * row = getRowNearY(y); bool bound = false; pos_type const column = getColumnNearX(bview, row, x, bound); @@ -2247,7 +2247,7 @@ void LyXText::setCursorFromCoordinates(BufferView * bview, LyXCursor & cur, cur.pos(row->pos() + column); cur.x(x); cur.y(y + row->baseline()); - cur.row(row); + cur.row(row); cur.boundary(bound); } @@ -2284,14 +2284,14 @@ void LyXText::cursorRight(BufferView * bview, bool internal) const void LyXText::cursorUp(BufferView * bview) const { - setCursorFromCoordinates(bview, cursor.x_fix(), + setCursorFromCoordinates(bview, cursor.x_fix(), cursor.y() - cursor.row()->baseline() - 1); } void LyXText::cursorDown(BufferView * bview) const { - setCursorFromCoordinates(bview, cursor.x_fix(), + setCursorFromCoordinates(bview, cursor.x_fix(), cursor.y() - cursor.row()->baseline() + cursor.row()->height() + 1); } @@ -2352,7 +2352,7 @@ bool LyXText::deleteEmptyParagraphMechanism(BufferView * bview, { return false; } - + /* Ok I'll put some comments here about what is missing. I have fixed BackSpace (and thus Delete) to not delete double-spaces automagically. I have also changed Cut, @@ -2378,9 +2378,9 @@ bool LyXText::deleteEmptyParagraphMechanism(BufferView * bview, // If the pos around the old_cursor were spaces, delete one of them. if (old_cursor.par() != cursor.par() - || old_cursor.pos() != cursor.pos()) { + || old_cursor.pos() != cursor.pos()) { // Only if the cursor has really moved - + if (old_cursor.pos() > 0 && old_cursor.pos() < old_cursor.par()->size() && old_cursor.par()->isLineSeparator(old_cursor.pos()) @@ -2413,7 +2413,7 @@ bool LyXText::deleteEmptyParagraphMechanism(BufferView * bview, // don't delete anything if this is the ONLY paragraph! if (!old_cursor.par()->next() && !old_cursor.par()->previous()) return false; - + // Do not delete empty paragraphs with keepempty set. if (textclasslist [bview->buffer()->params.textclass] @@ -2421,9 +2421,9 @@ bool LyXText::deleteEmptyParagraphMechanism(BufferView * bview, return false; // only do our magic if we changed paragraph - if (old_cursor.par() == cursor.par()) + if (old_cursor.par() == cursor.par()) return false; - + // record if we have deleted a paragraph // we can't possibly have deleted a paragraph before this point bool deleted = false; @@ -2433,11 +2433,11 @@ bool LyXText::deleteEmptyParagraphMechanism(BufferView * bview, && old_cursor.par()->isLineSeparator(0)))) { // ok, we will delete anything LyXCursor tmpcursor; - + // make sure that you do not delete any environments status(bview, LyXText::NEED_MORE_REFRESH); deleted = true; - + if (old_cursor.row()->previous()) { refresh_row = old_cursor.row()->previous(); refresh_y = old_cursor.y() - old_cursor.row()->baseline() - refresh_row->height(); @@ -2459,7 +2459,7 @@ bool LyXText::deleteEmptyParagraphMechanism(BufferView * bview, } // delete old par delete old_cursor.par(); - + /* Breakagain the next par. Needed because of * the parindent that can occur or dissappear. * The next row can change its height, if @@ -2472,7 +2472,7 @@ bool LyXText::deleteEmptyParagraphMechanism(BufferView * bview, } else { refresh_row = old_cursor.row()->next(); refresh_y = old_cursor.y() - old_cursor.row()->baseline(); - + tmpcursor = cursor; cursor = old_cursor; // that undo can restore the right cursor position Paragraph * endpar = old_cursor.par()->next(); @@ -2492,7 +2492,7 @@ bool LyXText::deleteEmptyParagraphMechanism(BufferView * bview, } delete old_cursor.par(); - + /* Breakagain the next par. Needed because of the parindent that can occur or dissappear. The next row can change its height, if @@ -2502,7 +2502,7 @@ bool LyXText::deleteEmptyParagraphMechanism(BufferView * bview, updateCounters(bview, refresh_row->previous()); } } - + // correct cursor y setCursorIntern(bview, cursor.par(), cursor.pos()); @@ -2535,7 +2535,7 @@ void LyXText::toggleAppendix(BufferView * bview) for (; tmp; tmp = tmp->next()) { tmp->params().startOfAppendix(false); } - + par->params().startOfAppendix(start); // we can set the refreshing parameters now diff --git a/src/tracer.C b/src/tracer.C index 7c7d6c94d1..a9d75a744e 100644 --- a/src/tracer.C +++ b/src/tracer.C @@ -1,8 +1,8 @@ /* This file is part of - * ====================================================== - * + * ====================================================== + * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team. * diff --git a/src/tracer.h b/src/tracer.h index 570da31963..36908a70f0 100644 --- a/src/tracer.h +++ b/src/tracer.h @@ -1,9 +1,9 @@ // -*- C++ -*- /* This file is part of - * ====================================================== - * + * ====================================================== + * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team. * @@ -28,7 +28,7 @@ public: lyxerr << string(depth, ' ') << "TRACE IN: " << str << std::endl; depth += 2; - + } /// ~Trace() { diff --git a/src/trans.C b/src/trans.C index 87caa575a4..57ba8d0421 100644 --- a/src/trans.C +++ b/src/trans.C @@ -111,7 +111,7 @@ void Trans::AddDeadkey(tex_accent accent, string const & keys) } -int Trans::Load(LyXLex & lex) +int Trans::Load(LyXLex & lex) { bool error = false; @@ -127,7 +127,7 @@ int Trans::Load(LyXLex & lex) << "'" << endl; } else return -1; - + string const keys = lex.getString(); if (lex.next(true)) { @@ -159,7 +159,7 @@ int Trans::Load(LyXLex & lex) AddDeadkey(accent, keys); #endif break; - } + } case KCOMB: { string str; @@ -169,7 +169,7 @@ int Trans::Load(LyXLex & lex) lyxerr[Debug::KBMAP] << str << endl; } else return -1; - + tex_accent accent_1 = getkeymod(str); if (accent_1 == TEX_NOACCENT) return -1; @@ -209,7 +209,7 @@ int Trans::Load(LyXLex & lex) } else { return -1; } - + InsertException(kmod_list_[accent_1].exception_list, static_cast(it->first), allowed, true, accent_2); @@ -323,7 +323,7 @@ int Trans::Load(string const & language) FreeKeymap(); LyXLex lex(kmapTags, K_LAST-1); lex.setFile(filename); - + int const res = Load(lex); if (res == 0) { @@ -344,7 +344,7 @@ tex_accent getkeymod(string const & 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::KBMAP] << "Found it!" << endl; diff --git a/src/trans.h b/src/trans.h index 8cb068d90f..e0ccbc08ba 100644 --- a/src/trans.h +++ b/src/trans.h @@ -17,7 +17,7 @@ class LyXLex; class TransManager; /** - Trans: holds a .kmap file + Trans: holds a .kmap file */ //class Trans : public TransInterface { class Trans { @@ -37,7 +37,7 @@ public: string const process(char, TransManager &); /// bool isAccentDefined(tex_accent, KmodInfo &) const; - + private: /// void AddDeadkey(tex_accent, string const &); @@ -75,4 +75,4 @@ string const & Trans::Match(unsigned char c) return dummy; } -#endif +#endif diff --git a/src/trans_mgr.C b/src/trans_mgr.C index fa077ce907..90afbc1fba 100644 --- a/src/trans_mgr.C +++ b/src/trans_mgr.C @@ -70,7 +70,7 @@ TransDeadkeyState::TransDeadkeyState() string const TransDeadkeyState::normalkey(char c) { string res; - + KmodException::iterator it = deadkey_info_.exception_list.begin(); KmodException::iterator end = deadkey_info_.exception_list.end(); @@ -91,7 +91,7 @@ string const TransDeadkeyState::normalkey(char c) string const TransDeadkeyState::deadkey(char c, KmodInfo d) { string res; - + // Check if the same deadkey was typed twice if (deadkey_ == c) { res = deadkey_; @@ -100,7 +100,7 @@ string const TransDeadkeyState::deadkey(char c, KmodInfo d) currentState = init_state_; return res; } - + // Check if it is a combination or an exception KmodException::const_iterator cit = deadkey_info_.exception_list.begin(); KmodException::const_iterator end = deadkey_info_.exception_list.end(); @@ -121,9 +121,9 @@ string const TransDeadkeyState::deadkey(char c, KmodInfo d) } } - // Not a combination or an exception. + // Not a combination or an exception. // Output deadkey1 and keep deadkey2 - + if (deadkey_!= 0) res = deadkey_; deadkey_ = c; @@ -185,8 +185,8 @@ TransManager::TransManager() {} -TransManager::~TransManager() -{ +TransManager::~TransManager() +{ delete t1_; delete t2_; } @@ -194,9 +194,9 @@ TransManager::~TransManager() int TransManager::SetPrimary(string const & language) { - if (t1_->GetName() == language) + if (t1_->GetName() == language) return 0; - + return t1_->Load(language); } @@ -205,7 +205,7 @@ int TransManager::SetSecondary(string const & language) { if (t2_->GetName() == language) return 0; - + return t2_->Load(language); } @@ -220,7 +220,7 @@ void TransManager::EnablePrimary() { if (t1_->IsDefined()) active_ = t1_; - + lyxerr[Debug::KBMAP] << "Enabling primary keymap" << endl; } @@ -243,10 +243,10 @@ void TransManager::DisableKeymap() void TransManager::TranslateAndInsert(char c, LyXText * text) { string res = active_->process(c, *this); - + // Process with tokens string temp; - + while (res.length() > 0) { res = split(res, temp, TransState::TOKEN_SEP); insert(temp, text); @@ -255,9 +255,9 @@ void TransManager::TranslateAndInsert(char c, LyXText * text) void TransManager::insertVerbatim(string const & str, LyXText * text) -{ +{ string::size_type const l = str.length(); - + for (string::size_type i = 0; i < l; ++i) { text->insertChar(current_view, str[i]); } @@ -266,14 +266,14 @@ void TransManager::insertVerbatim(string const & str, LyXText * text) void TransManager::insert(string const & str, LyXText * text) { - // Go through the character encoding only if the current + // Go through the character encoding only if the current // encoding (chset_->name()) matches the current font_norm // (lyrxc->font_norm) - + // Is false to speak about "only if" the current encoding will // almost always be equal to font_norm. pair enc = chset_.encodeString(str); - if (chset_.getName() != lyxrc.font_norm || + if (chset_.getName() != lyxrc.font_norm || !enc.first) { // Could not find an encoding InsetLatexAccent ins(str); @@ -304,7 +304,7 @@ void TransManager::deadkey(char c, tex_accent accent, LyXText * t) return; } } - + if (active_ == &default_ || c == 0) { KmodInfo i; i.accent = accent; diff --git a/src/trans_mgr.h b/src/trans_mgr.h index 1864bc80e3..4507f48272 100644 --- a/src/trans_mgr.h +++ b/src/trans_mgr.h @@ -61,7 +61,7 @@ public: /// Init State -class TransInitState : virtual public TransFSMData, public TransState { +class TransInitState : virtual public TransFSMData, public TransState { public: /// TransInitState(); @@ -104,7 +104,7 @@ public: deadkey2_ = 0; deadkey2_info_.accent = TEX_NOACCENT; currentState = deadkey_state_; - + return false; } /// diff --git a/src/undo.C b/src/undo.C index 289bf32fd3..2463245dcd 100644 --- a/src/undo.C +++ b/src/undo.C @@ -1,8 +1,8 @@ /* This file is part of * ====================================================== - * + * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team. * diff --git a/src/undo.h b/src/undo.h index e0c4899d92..4ebdd89224 100644 --- a/src/undo.h +++ b/src/undo.h @@ -1,9 +1,9 @@ // -*- C++ -*- /* This file is part of * ====================================================== - * + * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team. * diff --git a/src/undo_funcs.C b/src/undo_funcs.C index b988b67871..d8304ed94b 100644 --- a/src/undo_funcs.C +++ b/src/undo_funcs.C @@ -1,8 +1,8 @@ /* This file is part of - * ====================================================== - * + * ====================================================== + * * LyX, The Document Processor - * + * * Copyright 1995-2001 The LyX Team. * * ====================================================== */ @@ -53,7 +53,7 @@ bool textUndo(BufferView * bv) if (first) { bv->buffer()->redostack.push( createUndo(bv, undo->kind, first, - bv->buffer()->getParFromID(undo->number_of_behind_par))); + bv->buffer()->getParFromID(undo->number_of_behind_par))); } } } @@ -84,7 +84,7 @@ bool textRedo(BufferView * bv) if (first) { bv->buffer()->undostack.push( createUndo(bv, undo->kind, first, - bv->buffer()->getParFromID(undo->number_of_behind_par))); + bv->buffer()->getParFromID(undo->number_of_behind_par))); } } } @@ -105,9 +105,9 @@ bool textHandleUndo(BufferView * bv, Undo * undo) bool result = false; if (undo) { Paragraph * before = - bv->buffer()->getParFromID(undo->number_of_before_par); + bv->buffer()->getParFromID(undo->number_of_before_par); Paragraph * behind = - bv->buffer()->getParFromID(undo->number_of_behind_par); + bv->buffer()->getParFromID(undo->number_of_behind_par); Paragraph * tmppar; Paragraph * tmppar2; Paragraph * tmppar5; @@ -131,8 +131,8 @@ bool textHandleUndo(BufferView * bv, Undo * undo) // replace the paragraphs with the undo informations Paragraph * tmppar3 = undo->par; - undo->par = 0; /* otherwise the undo destructor would - delete the paragraph */ + undo->par = 0; /* otherwise the undo destructor would + delete the paragraph */ // get last undo par and set the right(new) inset-owner of the // paragraph if there is any. This is not needed if we don't have @@ -151,7 +151,7 @@ bool textHandleUndo(BufferView * bv, Undo * undo) tmppar4->setInsetOwner(in); } } - + // now remove the old text if there is any #ifdef DELETE_UNUSED_PARAGRAPHS vector vvpar; @@ -169,9 +169,9 @@ bool textHandleUndo(BufferView * bv, Undo * undo) tmppar = tmppar5; tmppar5 = tmppar5->next(); // a memory optimization for edit: - // Only layout information + // Only layout information // is stored in the undo. So restore - // the text informations. + // the text informations. if (undo->kind == Undo::EDIT) { tmppar2->setContentsFromPar(tmppar); #ifndef DELETE_UNUSED_PARAGRAPHS @@ -181,14 +181,14 @@ bool textHandleUndo(BufferView * bv, Undo * undo) } } } - + // put the new stuff in the list if there is one if (tmppar3) { if (before) before->next(tmppar3); else bv->text->ownerParagraph(firstUndoParagraph(bv, undo->number_of_inset_id)->id(), - tmppar3); + tmppar3); tmppar3->previous(before); } else { @@ -197,7 +197,7 @@ bool textHandleUndo(BufferView * bv, Undo * undo) // one is the first! if (!before && behind) { bv->text->ownerParagraph(firstUndoParagraph(bv, undo->number_of_inset_id)->id(), - behind); + behind); tmppar3 = behind; } } @@ -206,8 +206,8 @@ bool textHandleUndo(BufferView * bv, Undo * undo) if (behind) behind->previous(tmppar4); } - - + + // Set the cursor for redoing if (before) { Inset * it = before->inInset(); @@ -228,8 +228,8 @@ bool textHandleUndo(BufferView * bv, Undo * undo) it = static_cast(tmppar3->inInset()); if (it) { it->getLyXText(bv)->redoParagraphs(bv, - it->getLyXText(bv)->cursor, - endpar); + it->getLyXText(bv)->cursor, + endpar); if (tmppar) { it = static_cast(tmppar->inInset()); LyXText * t; @@ -245,7 +245,7 @@ bool textHandleUndo(BufferView * bv, Undo * undo) } bv->updateInset(it, false); bv->text->setCursorIntern(bv, bv->text->cursor.par(), - bv->text->cursor.pos()); + bv->text->cursor.pos()); } else { bv->text->redoParagraphs(bv, bv->text->cursor, endpar); if (tmppar) { @@ -319,7 +319,7 @@ void unFreezeUndo() void setUndo(BufferView * bv, Undo::undo_kind kind, - Paragraph const * first, Paragraph const * behind) + Paragraph const * first, Paragraph const * behind) { if (!undo_frozen) { bv->buffer()->undostack.push(createUndo(bv, kind, first, behind)); @@ -329,14 +329,14 @@ void setUndo(BufferView * bv, Undo::undo_kind kind, void setRedo(BufferView * bv, Undo::undo_kind kind, - Paragraph const * first, Paragraph const * behind) + Paragraph const * first, Paragraph const * behind) { bv->buffer()->redostack.push(createUndo(bv, kind, first, behind)); } Undo * createUndo(BufferView * bv, Undo::undo_kind kind, - Paragraph const * first, Paragraph const * behind) + Paragraph const * first, Paragraph const * behind) { lyx::Assert(first); @@ -353,14 +353,14 @@ Undo * createUndo(BufferView * bv, Undo::undo_kind kind, // Undo::EDIT and Undo::FINISH are // always finished. (no overlapping there) - // overlapping only with insert and delete inside one paragraph: + // overlapping only with insert and delete inside one paragraph: // Nobody wants all removed character - // appear one by one when undoing. + // appear one by one when undoing. // EDIT is special since only layout information, not the // contents of a paragaph are stored. if (!undo_finished && (kind != Undo::EDIT) && (kind != Undo::FINISH)) { // check wether storing is needed - if (!bv->buffer()->undostack.empty() && + if (!bv->buffer()->undostack.empty() && bv->buffer()->undostack.top()->kind == kind && bv->buffer()->undostack.top()->number_of_before_par == before_number && bv->buffer()->undostack.top()->number_of_behind_par == behind_number) { @@ -387,7 +387,7 @@ Undo * createUndo(BufferView * bv, Undo::undo_kind kind, { Paragraph * tmppar = start; Paragraph * tmppar2 = new Paragraph(*tmppar, true); - + // a memory optimization: Just store the layout information // when only edit if (kind == Undo::EDIT) { @@ -395,7 +395,7 @@ Undo * createUndo(BufferView * bv, Undo::undo_kind kind, } undopar = tmppar2; - + while (tmppar != end && tmppar->next()) { tmppar = tmppar->next(); #if 0 @@ -410,7 +410,7 @@ Undo * createUndo(BufferView * bv, Undo::undo_kind kind, tmppar2->clearContents(); } tmppar2->next()->previous(tmppar2); - + tmppar2 = tmppar2->next(); } tmppar2->next(0); @@ -419,11 +419,11 @@ Undo * createUndo(BufferView * bv, Undo::undo_kind kind, int cursor_par = undoCursor(bv).par()->id(); int cursor_pos = undoCursor(bv).pos(); - + Undo * undo = new Undo(kind, inset_id, - before_number, behind_number, - cursor_par, cursor_pos, undopar); - + before_number, behind_number, + cursor_par, cursor_pos, undopar); + undo_finished = false; return undo; } @@ -432,7 +432,7 @@ Undo * createUndo(BufferView * bv, Undo::undo_kind kind, void setCursorParUndo(BufferView * bv) { setUndo(bv, Undo::FINISH, bv->text->cursor.par(), - bv->text->cursor.par()->next()); + bv->text->cursor.par()->next()); } diff --git a/src/undo_funcs.h b/src/undo_funcs.h index 0339bbc5f1..6838abe9d4 100644 --- a/src/undo_funcs.h +++ b/src/undo_funcs.h @@ -1,9 +1,9 @@ // -*- C++ -*- /* This file is part of - * ====================================================== - * + * ====================================================== + * * LyX, The Document Processor - * + * * Copyright 1995-2001 The LyX Team. * * ====================================================== */ @@ -34,14 +34,14 @@ extern void freezeUndo(); /// this is dangerous and for internal use only extern void unFreezeUndo(); /// -extern void setUndo(BufferView *, Undo::undo_kind kind, - Paragraph const * first, Paragraph const * behind); +extern void setUndo(BufferView *, Undo::undo_kind kind, + Paragraph const * first, Paragraph const * behind); /// extern void setRedo(BufferView *, Undo::undo_kind kind, - Paragraph const * first, Paragraph const * behind); + Paragraph const * first, Paragraph const * behind); /// extern Undo * createUndo(BufferView *, Undo::undo_kind kind, - Paragraph const * first, Paragraph const * behind); + Paragraph const * first, Paragraph const * behind); /// for external use in lyx_cb.C extern void setCursorParUndo(BufferView *); diff --git a/src/undostack.C b/src/undostack.C index 5b7ec58569..33d07cca34 100644 --- a/src/undostack.C +++ b/src/undostack.C @@ -1,8 +1,8 @@ /* This file is part of * ====================================================== - * + * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team. * @@ -65,7 +65,7 @@ void UndoStack::push(Undo * undo_arg) { if (!undo_arg) return; - + stakk.push_front(undo_arg); if (stakk.size() > limit) { Undo * tmp = stakk.back(); diff --git a/src/undostack.h b/src/undostack.h index 35632d54bd..4271ea0e7b 100644 --- a/src/undostack.h +++ b/src/undostack.h @@ -1,9 +1,9 @@ // -*- C++ -*- /* This file is part of * ====================================================== - * + * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team. * diff --git a/src/vc-backend.C b/src/vc-backend.C index 33a59362cd..c4336d48e7 100644 --- a/src/vc-backend.C +++ b/src/vc-backend.C @@ -28,7 +28,7 @@ using std::getline; int VCS::doVCCommand(string const & cmd, string const & path) { lyxerr[Debug::LYXVC] << "doVCCommand: " << cmd << endl; - Systemcall one; + Systemcall one; Path p(path); int const ret = one.startscript(Systemcall::Wait, cmd); return ret; @@ -129,7 +129,7 @@ void RCS::scanMaster() break; } } while (!contains(tmpt, ";")); - + } else if (token == "comment") { // we don't need to read any further than this. read_enough = true; @@ -306,7 +306,7 @@ void CVS::revert() // Reverts to the version in CVS repository and // gets the updated version from the repository. string const fil = OnlyFilename(owner_->fileName()); - + doVCCommand("rm -f \"" + fil + "\"; cvs update \"" + fil + "\"", owner_->filePath()); owner_->markLyxClean(); diff --git a/src/vc-backend.h b/src/vc-backend.h index 45508ca0c2..1c3fa62c18 100644 --- a/src/vc-backend.h +++ b/src/vc-backend.h @@ -43,13 +43,13 @@ public: /** * getLog - read the revision log into the given file * @param fname file name to read into - */ + */ virtual void getLog(string const &) = 0; /// return the current version description virtual string const versionString() const = 0; /// return the current version string const & version() const { - return version_; + return version_; } /// return the user who has locked the file string const & locker() const { return locker_; } @@ -62,7 +62,7 @@ public: protected: /// parse information from the version file virtual void scanMaster() = 0; - + /** * doVCCommand - call out to the version control utility * @param cmd the command to execute @@ -71,21 +71,21 @@ protected: */ static int doVCCommand(string const & cmd, string const & path); - /** + /** * The master VC file. For RCS this is *,v or RCS/ *,v. master should * have full path. */ string master_; - + /// The status of the VC controlled file. VCStatus vcstatus; - - /** + + /** * The version of the VC file. I am not sure if this can be a - * string or if it must be a float/int. + * string or if it must be a float/int. */ string version_; - + /// The user currently keeping the lock on the VC file. string locker_; /// The buffer using this VC @@ -154,7 +154,7 @@ public: protected: virtual void scanMaster(); - + private: string file_; }; diff --git a/src/version.h b/src/version.h index 22b0be74d3..3a77e8066b 100644 --- a/src/version.h +++ b/src/version.h @@ -17,7 +17,7 @@ extern char const * lyx_version; /// extern char const * lyx_release_date; -/// This version string is intended to be used in files created by LyX +/// This version string is intended to be used in files created by LyX extern char const * lyx_docversion; /// This is the version information shown by 'lyx -version' diff --git a/src/vspace.C b/src/vspace.C index e4e01550f4..6b4d25a7ed 100644 --- a/src/vspace.C +++ b/src/vspace.C @@ -60,8 +60,8 @@ bool isEndOfData(string const & data) * @param data input string * @return a char representing the type of token returned * - * The possible return values are : - * + stretch indicator for glue length + * The possible return values are : + * + stretch indicator for glue length * - shrink indicator for glue length * n a numeric value (stored in number array) * u a unit type (stored in unit array) @@ -91,7 +91,7 @@ char nextToken(string & data) if (number_index > 3) return 'E'; string buffer; - + // we have found some number if (i == string::npos) { buffer = data; @@ -107,13 +107,13 @@ char nextToken(string & data) return 'n'; } else return 'E'; } - + i = data.find_first_not_of("abcdefghijklmnopqrstuvwxyz%"); if (i != 0) { if (unit_index > 3) return 'E'; string buffer; - + // we have found some alphabetical string if (i == string::npos) { buffer = data; @@ -217,7 +217,7 @@ bool isValidGlueLength(string const & data, LyXGlueLength * result) break; } // end of hack - + int pattern_index = 0; int table_index = 0; char pattern[20]; @@ -241,7 +241,7 @@ bool isValidGlueLength(string const & data, LyXGlueLength * result) if (!*table[table_index].pattern) return false; } - + // Get the values from the appropriate places. If an index // is zero, the corresponding array value is zero or UNIT_NONE, // so we needn't check this. @@ -286,7 +286,7 @@ bool isValidLength(string const & data, LyXLength * result) break; } // end of hack - + number_index = unit_index = 1; // entries at index 0 are sentinels // construct "pattern" from "data" @@ -301,8 +301,8 @@ bool isValidLength(string const & data, LyXLength * result) pattern[pattern_index] = '\0'; // only the most basic pattern is accepted here - if (compare(pattern, "nu") != 0) return false; - + if (compare(pattern, "nu") != 0) return false; + // It _was_ a correct length string. // Store away the values we found. if (result) { @@ -454,14 +454,14 @@ string const VSpace::asLatexCommand(BufferParams const & params) const case LENGTH: { string const lenstr = len_.asLatexString(); - + ret = keep_ ? "\\vspace*{" + lenstr + '}' : "\\vspace{" + lenstr + '}'; } break; } - + return ret; } @@ -473,7 +473,7 @@ int VSpace::inPixels(BufferView * bv) const int const default_height = bv->text->defaultHeight(); // [pixels] int retval = 0; - + switch (kind_) { case NONE: // Value for this is already set @@ -481,18 +481,18 @@ int VSpace::inPixels(BufferView * bv) const case DEFSKIP: retval = bv->buffer()->params.getDefSkip().inPixels(bv); break; - + // This is how the skips are normally defined by // LateX. But there should be some way to change // this per document. case SMALLSKIP: retval = default_height / 4; break; - + case MEDSKIP: retval = default_height / 2; break; - + case BIGSKIP: retval = default_height; break; @@ -501,13 +501,13 @@ int VSpace::inPixels(BufferView * bv) const // leave space for the vfill symbol retval = 3 * default_height; break; - + case LENGTH: { int const default_width = bv->workWidth(); retval = len_.len().inPixels(default_width, default_height); break; } - + } return retval; } diff --git a/src/vspace.h b/src/vspace.h index b2b18bcfe7..936d1f4e92 100644 --- a/src/vspace.h +++ b/src/vspace.h @@ -46,7 +46,7 @@ public: /// Constructor for reading from a .lyx file explicit VSpace(string const & data); - + /// return the type of vertical space vspace_kind kind() const; /// return the length of this space @@ -60,9 +60,9 @@ public: bool operator==(VSpace const &) const; // conversion - + /// how it goes into the LyX file - string const asLyXCommand() const; + string const asLyXCommand() const; /// the latex representation string const asLatexCommand(BufferParams const & params) const; /// the size of the space on-screen