From 792ece8130a37f29bb8a1cec2d0e093149d5b9e6 Mon Sep 17 00:00:00 2001 From: Pavel Sanda Date: Mon, 13 Oct 2008 11:25:37 +0000 Subject: [PATCH] Fix whitespaces so the diff between branches is not so huge. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26881 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/Buffer.h | 10 +-- src/Text3.cpp | 62 +++++++++---------- src/frontends/qt4/GuiApplication.h | 2 +- src/frontends/qt4/GuiWorkArea.cpp | 98 +++++++++++++++--------------- src/mathed/InsetMathGrid.cpp | 2 +- src/mathed/InsetMathHull.cpp | 8 +-- src/mathed/InsetMathNest.cpp | 72 +++++++++++----------- src/output_latex.cpp | 20 +++--- 8 files changed, 137 insertions(+), 137 deletions(-) diff --git a/src/Buffer.h b/src/Buffer.h index d73bf1ef09..4a9e9ae903 100644 --- a/src/Buffer.h +++ b/src/Buffer.h @@ -91,14 +91,14 @@ public: }; - /// Method to check if a file is externally modified, used by + /// Method to check if a file is externally modified, used by /// isExternallyModified() /** * timestamp is fast but inaccurate. For example, the granularity * of timestamp on a FAT filesystem is 2 second. Also, various operations * may touch the timestamp of a file even when its content is unchanged. * - * checksum is accurate but slow, which can be a problem when it is + * checksum is accurate but slow, which can be a problem when it is * frequently used, or used for a large file on a slow (network) file * system. * @@ -108,7 +108,7 @@ public: checksum_method, ///< Use file checksum timestamp_method, ///< Use timestamp, and checksum if timestamp has changed }; - + /** Constructor \param file \param b optional \c false by default @@ -166,7 +166,7 @@ public: /// Write file. Returns \c false if unsuccesful. bool writeFile(support::FileName const &) const; - /// Loads LyX file \c filename into buffer, * and \return success + /// Loads LyX file \c filename into buffer, * and \return success bool loadLyXFile(support::FileName const & s); /// Fill in the ErrorList with the TeXErrors @@ -475,7 +475,7 @@ private: void updateMacros(DocIterator & it, DocIterator & scope) const; - /// + /// bool readFileHelper(support::FileName const & s); /// std::vector backends() const; diff --git a/src/Text3.cpp b/src/Text3.cpp index e78a4ee689..e26607d2ad 100644 --- a/src/Text3.cpp +++ b/src/Text3.cpp @@ -577,10 +577,10 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd) } } else { if (reverseDirectionNeeded(cur)) { - cmd.action = cmd.action == LFUN_CHAR_LEFT_SELECT ? + cmd.action = cmd.action == LFUN_CHAR_LEFT_SELECT ? LFUN_CHAR_FORWARD_SELECT : LFUN_CHAR_FORWARD; } else { - cmd.action = cmd.action == LFUN_CHAR_LEFT_SELECT ? + cmd.action = cmd.action == LFUN_CHAR_LEFT_SELECT ? LFUN_CHAR_BACKWARD_SELECT : LFUN_CHAR_BACKWARD; } dispatch(cur, cmd); @@ -600,17 +600,17 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd) } } else { if (reverseDirectionNeeded(cur)) { - cmd.action = cmd.action == LFUN_CHAR_RIGHT_SELECT ? + cmd.action = cmd.action == LFUN_CHAR_RIGHT_SELECT ? LFUN_CHAR_BACKWARD_SELECT : LFUN_CHAR_BACKWARD; } else { - cmd.action = cmd.action == LFUN_CHAR_RIGHT_SELECT ? + cmd.action = cmd.action == LFUN_CHAR_RIGHT_SELECT ? LFUN_CHAR_FORWARD_SELECT : LFUN_CHAR_FORWARD; } dispatch(cur, cmd); return; } break; - + case LFUN_UP_SELECT: case LFUN_DOWN_SELECT: @@ -620,7 +620,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd) bool select = cmd.action == LFUN_DOWN_SELECT || cmd.action == LFUN_UP_SELECT; cur.selHandle(select); - + // move cursor up/down bool up = cmd.action == LFUN_UP_SELECT || cmd.action == LFUN_UP; bool const successful = cur.upDownInText(up, needsUpdate); @@ -629,7 +629,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd) needsUpdate |= cur.beforeDispatchCursor().inMathed(); } else cur.undispatched(); - + break; } @@ -738,7 +738,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd) moveCursor(cur, false); break; } - + case LFUN_CHAR_DELETE_FORWARD: if (!cur.selection()) { if (cur.pos() == cur.paragraph().size()) @@ -1032,14 +1032,14 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd) if (layout.empty()) layout = tclass.defaultLayoutName(); - if (para.forcePlainLayout()) + if (para.forcePlainLayout()) // in this case only the empty layout is allowed layout = tclass.plainLayoutName(); else if (para.usePlainLayout()) { - // in this case, default layout maps to empty layout + // in this case, default layout maps to empty layout if (layout == tclass.defaultLayoutName()) layout = tclass.plainLayoutName(); - } else { + } else { // otherwise, the empty layout maps to the default if (layout == tclass.plainLayoutName()) layout = tclass.defaultLayoutName(); @@ -1173,12 +1173,12 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd) // Set the cursor if (!bv->mouseSetCursor(cur, cmd.argument() == "region-select")) cur.updateFlags(Update::SinglePar | Update::FitCursor); - break; + break; case mouse_button::button2: // Middle mouse pasting. bv->mouseSetCursor(cur); - if (!cap::selection()) { + if (!cap::selection()) { // There is no local selection in the current buffer, so try to // paste primary selection instead. lyx::dispatch(FuncRequest(LFUN_PRIMARY_SELECTION_PASTE, @@ -1208,7 +1208,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd) } if (!bv->mouseSetCursor(cur, false)) cur.updateFlags(Update::SinglePar | Update::FitCursor); - break; + break; } default: @@ -1457,7 +1457,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd) else p["symbol"] = cmd.argument(); string const data = InsetCommand::params2string("nomenclature", p); - bv->showDialog("nomenclature", data); + bv->showDialog("nomenclature", data); break; } @@ -1631,9 +1631,9 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd) case LFUN_FINISHED_LEFT: LYXERR(Debug::DEBUG, "handle LFUN_FINISHED_LEFT:\n" << cur); - // We're leaving an inset, going left. If the inset is LTR, we're + // We're leaving an inset, going left. If the inset is LTR, we're // leaving from the front, so we should not move (remain at --- but - // not in --- the inset). If the inset is RTL, move left, without + // not in --- the inset). If the inset is RTL, move left, without // entering the inset itself; i.e., move to after the inset. if (cur.paragraph().getFontSettings( cur.bv().buffer().params(), cur.pos()).isRightToLeft()) @@ -1642,9 +1642,9 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd) case LFUN_FINISHED_RIGHT: LYXERR(Debug::DEBUG, "handle LFUN_FINISHED_RIGHT:\n" << cur); - // We're leaving an inset, going right. If the inset is RTL, we're + // We're leaving an inset, going right. If the inset is RTL, we're // leaving from the front, so we should not move (remain at --- but - // not in --- the inset). If the inset is LTR, move right, without + // not in --- the inset). If the inset is LTR, move right, without // entering the inset itself; i.e., move to after the inset. if (!cur.paragraph().getFontSettings( cur.bv().buffer().params(), cur.pos()).isRightToLeft()) @@ -1674,7 +1674,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd) params2string(cur.paragraph(), data); // Will the paragraph accept changes from the dialog? - bool const accept = + bool const accept = cur.inset().allowParagraphCustomization(cur.idx()); data = "update " + convert(accept) + '\n' + data; @@ -1725,7 +1725,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd) // FIXME If this call were replaced with one to clearParagraphParams(), // then we could get rid of this method altogether. setParagraphs(cur, p); - // FIXME This should be simplified when InsetFloatList takes a + // FIXME This should be simplified when InsetFloatList takes a // Buffer in its constructor. InsetFloatList * ifl = new InsetFloatList(to_utf8(cmd.argument())); ifl->setBuffer(bv->buffer()); @@ -1767,17 +1767,17 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd) // Given data, an encoding of the ParagraphParameters // generated in the Paragraph dialog, this function sets // the current paragraph, or currently selected paragraphs, - // appropriately. + // appropriately. // NOTE: This function overrides all existing settings. setParagraphs(cur, cmd.argument()); cur.message(_("Paragraph layout set")); break; } - + case LFUN_PARAGRAPH_PARAMS: { // Given data, an encoding of the ParagraphParameters as we'd - // find them in a LyX file, this function modifies the current paragraph, - // or currently selected paragraphs. + // find them in a LyX file, this function modifies the current paragraph, + // or currently selected paragraphs. // NOTE: This function only modifies, and does not override, existing // settings. setParagraphs(cur, cmd.argument(), true); @@ -1976,7 +1976,7 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd, case LFUN_FLEX_INSERT: { code = FLEX_CODE; string s = cmd.getArg(0); - InsetLayout il = + InsetLayout il = cur.buffer().params().documentClass().insetLayout(from_utf8(s)); if (il.lyxtype() != "charstyle" && il.lyxtype() != "custom" && @@ -2089,7 +2089,7 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd, enable = !theClipboard().empty(); break; } - + // we have an argument string const arg = to_utf8(cmd.argument()); if (isStrUnsignedInt(arg)) { @@ -2098,7 +2098,7 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd, enable = cap::numberOfSelections() > n; break; } - + // explicit graphics type? if ((arg == "pdf" && theClipboard().hasGraphicsContents(Clipboard::PdfGraphicsType)) || (arg == "png" && theClipboard().hasGraphicsContents(Clipboard::PngGraphicsType)) @@ -2107,7 +2107,7 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd, enable = true; break; } - + // unknown argument enable = false; break; @@ -2135,7 +2135,7 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd, enable = cur.inset().lyxCode() == FLEX_CODE && il.lyxtype() == to_utf8(cmd.argument()); } else { - enable = !isMainText(cur.bv().buffer()) + enable = !isMainText(cur.bv().buffer()) && cur.inset().nargs() == 1; } break; @@ -2167,7 +2167,7 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd, case LFUN_SET_GRAPHICS_GROUP: { InsetGraphics * ins = graphics::getCurrentGraphicsInset(cur); - if (!ins) + if (!ins) enable = false; else flag.setOnOff(to_utf8(cmd.argument()) == ins->getParams().groupId); diff --git a/src/frontends/qt4/GuiApplication.h b/src/frontends/qt4/GuiApplication.h index 50579bc1e3..379b8be68e 100644 --- a/src/frontends/qt4/GuiApplication.h +++ b/src/frontends/qt4/GuiApplication.h @@ -133,7 +133,7 @@ private Q_SLOTS: void handleRegularEvents(); /// void onLastWindowClosed(); - + private: /// bool closeAllViews(); diff --git a/src/frontends/qt4/GuiWorkArea.cpp b/src/frontends/qt4/GuiWorkArea.cpp index 52b9f554a6..dfcdaa5344 100644 --- a/src/frontends/qt4/GuiWorkArea.cpp +++ b/src/frontends/qt4/GuiWorkArea.cpp @@ -84,7 +84,7 @@ int const CursorWidth = 1; int const TabIndicatorWidth = 3; #undef KeyPress -#undef NoModifier +#undef NoModifier using namespace std; using namespace lyx::support; @@ -137,7 +137,7 @@ public: { if (!show_ || !rect_.isValid()) return; - + int y = rect_.top(); int l = x_ - rect_.left(); int r = rect_.right() - x_; @@ -145,7 +145,7 @@ public: // draw vertica linel painter.fillRect(x_, y, CursorWidth, rect_.height(), color_); - + // draw RTL/LTR indication painter.setPen(color_); if (l_shape_) { @@ -154,7 +154,7 @@ public: else painter.drawLine(x_, bot, x_ + CursorWidth + r, bot); } - + // draw completion triangle if (completable_) { int m = y + rect_.height() / 2; @@ -177,7 +177,7 @@ public: rtl_ = rtl; completable_ = completable; x_ = x; - + // extension to left and right int l = 0; int r = 0; @@ -189,7 +189,7 @@ public: else r += h / 3; } - + // completion triangle if (completable_) { if (rtl) @@ -244,7 +244,7 @@ GuiWorkArea::GuiWorkArea(Buffer & buffer, GuiView & lv) // Setup the signals connect(&cursor_timeout_, SIGNAL(timeout()), this, SLOT(toggleCursor())); - + int const time = QApplication::cursorFlashTime() / 2; if (time > 0) { cursor_timeout_.setInterval(time); @@ -274,7 +274,7 @@ GuiWorkArea::GuiWorkArea(Buffer & buffer, GuiView & lv) setMouseTracking(true); setMinimumSize(100, 70); #ifdef Q_WS_MACX - setFrameStyle(QFrame::NoFrame); + setFrameStyle(QFrame::NoFrame); #else setFrameStyle(QFrame::Box); #endif @@ -338,7 +338,7 @@ void GuiWorkArea::setFullScreen(bool full_screen) setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); } else { #ifdef Q_WS_MACX - setFrameStyle(QFrame::NoFrame); + setFrameStyle(QFrame::NoFrame); #else setFrameStyle(QFrame::Box); #endif @@ -399,7 +399,7 @@ void GuiWorkArea::redraw() hideCursor(); showCursor(); } - + LYXERR(Debug::WORKAREA, "WorkArea::redraw screen"); updateScreen(); update(0, 0, viewport()->width(), viewport()->height()); @@ -455,9 +455,9 @@ void GuiWorkArea::dispatch(FuncRequest const & cmd0, KeyModifier mod) else cmd = cmd0; - bool const notJustMovingTheMouse = + bool const notJustMovingTheMouse = cmd.action != LFUN_MOUSE_MOTION || cmd.button() != mouse_button::none; - + // In order to avoid bad surprise in the middle of an operation, we better stop // the blinking cursor. if (notJustMovingTheMouse) @@ -494,11 +494,11 @@ void GuiWorkArea::resizeBufferView() updateScreen(); // Update scrollbars which might have changed due different - // BufferView dimension. This is especially important when the + // BufferView dimension. This is especially important when the // BufferView goes from zero-size to the real-size for the first time, // as the scrollbar paramters are then set for the first time. updateScrollbar(); - + lyx_view_->updateLayoutList(); lyx_view_->setBusy(false); need_resize_ = false; @@ -850,7 +850,7 @@ void GuiWorkArea::keyPressEvent(QKeyEvent * ev) // (the auto repeated events come too fast) // \todo FIXME: remove hard coded Qt keys, process the key binding #ifdef Q_WS_X11 - if (XEventsQueued(QX11Info::display(), 0) > 1 && ev->isAutoRepeat() + if (XEventsQueued(QX11Info::display(), 0) > 1 && ev->isAutoRepeat() && (Qt::Key_PageDown || Qt::Key_PageUp)) { LYXERR(Debug::KEY, "system is busy: scroll key event ignored"); ev->ignore(); @@ -1165,7 +1165,7 @@ bool GuiWorkArea::isFullScreen() //////////////////////////////////////////////////////////////////// // -// TabWorkArea +// TabWorkArea // //////////////////////////////////////////////////////////////////// @@ -1178,7 +1178,7 @@ public: { QRect rect = QMacStyle::subElementRect(element, option, widget); bool noBar = static_cast(widget)->count() <= 1; - + // The Qt Mac style puts the contents into a 3 pixel wide box // which looks very ugly and not like other Mac applications. // Hence we remove this here, and moreover the 16 pixel round @@ -1227,7 +1227,7 @@ TabWorkArea::TabWorkArea(QWidget * parent) QObject::connect(closeBufferButton, SIGNAL(clicked()), this, SLOT(closeCurrentBuffer())); setCornerWidget(closeBufferButton, Qt::TopRightCorner); - + // setup drag'n'drop QTabBar* tb = new DragTabBar; connect(tb, SIGNAL(tabMoveRequested(int, int)), @@ -1239,7 +1239,7 @@ TabWorkArea::TabWorkArea(QWidget * parent) tb->setContextMenuPolicy(Qt::CustomContextMenu); connect(tb, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(showContextMenu(const QPoint &))); - + setUsesScrollButtons(true); } @@ -1268,7 +1268,7 @@ GuiWorkArea * TabWorkArea::currentWorkArea() if (count() == 0) return 0; - GuiWorkArea * wa = dynamic_cast(currentWidget()); + GuiWorkArea * wa = dynamic_cast(currentWidget()); LASSERT(wa, /**/); return wa; } @@ -1334,7 +1334,7 @@ GuiWorkArea * TabWorkArea::addWorkArea(Buffer & buffer, GuiView & view) showBar(count() > 1); updateTabTexts(); - + return wa; } @@ -1403,7 +1403,7 @@ void TabWorkArea::closeCurrentTab() if (clicked_tab_ == -1) removeWorkArea(currentWorkArea()); else { - GuiWorkArea * wa = dynamic_cast(widget(clicked_tab_)); + GuiWorkArea * wa = dynamic_cast(widget(clicked_tab_)); LASSERT(wa, /**/); removeWorkArea(wa); } @@ -1425,7 +1425,7 @@ public: abs_ = toqstr(filename.absoluteFilePath()); dottedPrefix_ = false; } - + /// Absolute path for debugging. QString abs() const { @@ -1461,7 +1461,7 @@ public: { if (postfix_.count() == 0) return displayString(); - + return prefix_ + (dottedPrefix_ ? ".../" : "") + postfix_.front() + "/"; @@ -1470,7 +1470,7 @@ public: bool final() const { return postfix_.empty(); } /// int tab() const { return tab_; } - + private: /// QString prefix_; @@ -1507,26 +1507,26 @@ void TabWorkArea::updateTabTexts() return; std::list paths; typedef std::list::iterator It; - - // collect full names first: path into postfix, empty prefix and + + // collect full names first: path into postfix, empty prefix and // filename without extension for (size_t i = 0; i < n; ++i) { - GuiWorkArea * i_wa = dynamic_cast(widget(i)); + GuiWorkArea * i_wa = dynamic_cast(widget(i)); FileName const fn = i_wa->bufferView().buffer().fileName(); paths.push_back(DisplayPath(i, fn)); } - + // go through path segments and see if it helps to make the path more unique bool somethingChanged = true; bool allFinal = false; while (somethingChanged && !allFinal) { // adding path segments changes order paths.sort(); - + LYXERR(Debug::GUI, "updateTabTexts() iteration start"); somethingChanged = false; allFinal = true; - + // find segments which are not unique (i.e. non-atomic) It it = paths.begin(); It segStart = it; @@ -1535,20 +1535,20 @@ void TabWorkArea::updateTabTexts() // look to the next item It next = it; ++next; - + // final? allFinal = allFinal && it->final(); - + LYXERR(Debug::GUI, "it = " << it->abs() << " => " << it->displayString()); - + // still the same segment? QString nextString; if ((next != paths.end() && (nextString = next->displayString()) == segString)) continue; LYXERR(Debug::GUI, "segment ended"); - + // only a trivial one with one element? if (it == segStart) { // start new segment @@ -1556,7 +1556,7 @@ void TabWorkArea::updateTabTexts() segString = nextString; continue; } - + // we found a non-atomic segment segStart <= sit <= it < next. // Shift path segments and hope for the best // that it makes the path more unique. @@ -1577,7 +1577,7 @@ void TabWorkArea::updateTabTexts() LYXERR(Debug::GUI, "same forecast found for " << sit->abs() << " => " << dspString); } - + // if the path segment helped, add it. Otherwise add dots bool dots = !moreUnique; LYXERR(Debug::GUI, "using dots = " << dots); @@ -1592,10 +1592,10 @@ void TabWorkArea::updateTabTexts() segString = nextString; } } - + // set new tab titles for (It it = paths.begin(); it != paths.end(); ++it) { - GuiWorkArea * i_wa = dynamic_cast(widget(it->tab())); + GuiWorkArea * i_wa = dynamic_cast(widget(it->tab())); Buffer & buf = i_wa->bufferView().buffer(); if (!buf.fileName().empty() && !buf.isClean()) setTabText(it->tab(), it->displayString() + "*"); @@ -1611,7 +1611,7 @@ void TabWorkArea::showContextMenu(const QPoint & pos) clicked_tab_ = static_cast(tabBar())->tabAt(pos); if (clicked_tab_ == -1) return; - + // show tab popup QMenu popup; popup.addAction(QIcon(":/images/hidetab.png"), @@ -1635,7 +1635,7 @@ void TabWorkArea::moveTab(int fromIndex, int toIndex) insertTab(toIndex, w, icon, text); setCurrentIndex(toIndex); } - + DragTabBar::DragTabBar(QWidget* parent) : QTabBar(parent) @@ -1670,7 +1670,7 @@ void DragTabBar::mouseMoveEvent(QMouseEvent * event) // If the left button isn't pressed anymore then return if (!(event->buttons() & Qt::LeftButton)) return; - + // If the distance is too small then return if ((event->pos() - dragStartPos_).manhattanLength() < QApplication::startDragDistance()) @@ -1680,21 +1680,21 @@ void DragTabBar::mouseMoveEvent(QMouseEvent * event) int tab = tabAt(dragStartPos_); if (tab == -1) return; - + // simulate button release to remove highlight from button int i = currentIndex(); QMouseEvent me(QEvent::MouseButtonRelease, dragStartPos_, event->button(), event->buttons(), 0); QTabBar::mouseReleaseEvent(&me); setCurrentIndex(i); - + // initiate Drag QDrag * drag = new QDrag(this); QMimeData * mimeData = new QMimeData; // a crude way to distinguish tab-reodering drops from other ones mimeData->setData("action", "tab-reordering") ; drag->setMimeData(mimeData); - + #if QT_VERSION >= 0x040300 // get tab pixmap as cursor QRect r = tabRect(tab); @@ -1705,7 +1705,7 @@ void DragTabBar::mouseMoveEvent(QMouseEvent * event) #else drag->start(Qt::MoveAction); #endif - + } @@ -1714,7 +1714,7 @@ void DragTabBar::dragEnterEvent(QDragEnterEvent * event) // Only accept if it's an tab-reordering request QMimeData const * m = event->mimeData(); QStringList formats = m->formats(); - if (formats.contains("action") + if (formats.contains("action") && m->data("action") == "tab-reordering") event->acceptProposedAction(); } @@ -1724,8 +1724,8 @@ void DragTabBar::dropEvent(QDropEvent * event) { int fromIndex = tabAt(dragStartPos_); int toIndex = tabAt(event->pos()); - - // Tell interested objects that + + // Tell interested objects that if (fromIndex != toIndex) tabMoveRequested(fromIndex, toIndex); event->acceptProposedAction(); diff --git a/src/mathed/InsetMathGrid.cpp b/src/mathed/InsetMathGrid.cpp index 48f1124d69..03e66d6a8c 100644 --- a/src/mathed/InsetMathGrid.cpp +++ b/src/mathed/InsetMathGrid.cpp @@ -480,7 +480,7 @@ void InsetMathGrid::metrics(MetricsInfo & mi, Dimension & dim) const } */ metricsMarkers2(dim); - // Cache the inset dimension. + // Cache the inset dimension. setDimCache(mi, dim); } diff --git a/src/mathed/InsetMathHull.cpp b/src/mathed/InsetMathHull.cpp index 4f90573ac5..8a9a7c36ed 100644 --- a/src/mathed/InsetMathHull.cpp +++ b/src/mathed/InsetMathHull.cpp @@ -342,7 +342,7 @@ void InsetMathHull::metrics(MetricsInfo & mi, Dimension & dim) const dim.wid += 1; if (display()) dim.des += displayMargin(); - // Cache the inset dimension. + // Cache the inset dimension. setDimCache(mi, dim); return; } @@ -1180,7 +1180,7 @@ void InsetMathHull::doDispatch(Cursor & cur, FuncRequest & cmd) else for (row_type row = 0; row < nrows(); ++row) numbered(row, !old); - + cur.message(old ? _("No number") : _("Number")); break; } @@ -1283,7 +1283,7 @@ void InsetMathHull::doDispatch(Cursor & cur, FuncRequest & cmd) } if (cur.pos() > cur.lastpos()) cur.pos() = cur.lastpos(); - + // FIXME: find some more clever handling of the selection, // i.e. preserve it. cur.clearSelection(); @@ -1464,7 +1464,7 @@ void InsetMathHull::handleFont2(Cursor & cur, docstring const & arg) void InsetMathHull::edit(Cursor & cur, bool front, EntryDirection entry_from) { cur.push(*this); - bool enter_front = (entry_from == Inset::ENTRY_DIRECTION_LEFT || + bool enter_front = (entry_from == Inset::ENTRY_DIRECTION_LEFT || (entry_from == Inset::ENTRY_DIRECTION_IGNORE && front)); enter_front ? idxFirst(cur) : idxLast(cur); // The inset formula dimension is not necessarily the same as the diff --git a/src/mathed/InsetMathNest.cpp b/src/mathed/InsetMathNest.cpp index 61fc4d0b2a..f2d8d2ac76 100644 --- a/src/mathed/InsetMathNest.cpp +++ b/src/mathed/InsetMathNest.cpp @@ -446,7 +446,7 @@ void InsetMathNest::handleNest(Cursor & cur, MathAtom const & nest, cur.insert(arg); return; } - + // multiple selected cells in a simple non-grid inset if (i1.asInsetMath()->nrows() == 0 || i1.asInsetMath()->ncols() == 0) { for (idx_type i = i1.idx(); i <= i2.idx(); ++i) { @@ -456,11 +456,11 @@ void InsetMathNest::handleNest(Cursor & cur, MathAtom const & nest, cur.resetAnchor(); cur.pos() = cur.lastpos(); cur.setSelection(); - + // change font of cell cur.handleNest(nest); cur.insert(arg); - + // cur is in the font inset now. If the loop continues, // we need to get outside again for the next cell if (i + 1 <= i2.idx()) @@ -468,7 +468,7 @@ void InsetMathNest::handleNest(Cursor & cur, MathAtom const & nest, } return; } - + // the complicated case with multiple selected cells in a grid row_type r1, r2; col_type c1, c2; @@ -481,11 +481,11 @@ void InsetMathNest::handleNest(Cursor & cur, MathAtom const & nest, cur.resetAnchor(); cur.pos() = cur.lastpos(); cur.setSelection(); - - // + + // cur.handleNest(nest); cur.insert(arg); - + // cur is in the font inset now. If the loop continues, // we need to get outside again for the next cell if (col + 1 <= c2 || row + 1 <= r2) @@ -504,7 +504,7 @@ void InsetMathNest::handleFont2(Cursor & cur, docstring const & arg) if (font.fontInfo().color() != Color_inherit && font.fontInfo().color() != Color_ignore) handleNest(cur, MathAtom(new InsetMathColor(true, font.fontInfo().color()))); - + // FIXME: support other font changes here as well? } @@ -581,22 +581,22 @@ void InsetMathNest::doDispatch(Cursor & cur, FuncRequest & cmd) case LFUN_CHAR_BACKWARD_SELECT: case LFUN_CHAR_FORWARD_SELECT: { // are we in a selection? - bool select = (cmd.action == LFUN_CHAR_RIGHT_SELECT + bool select = (cmd.action == LFUN_CHAR_RIGHT_SELECT || cmd.action == LFUN_CHAR_LEFT_SELECT || cmd.action == LFUN_CHAR_BACKWARD_SELECT || cmd.action == LFUN_CHAR_FORWARD_SELECT); - // are we moving forward or backwards? + // are we moving forward or backwards? // If the command was RIGHT or LEFT, then whether we're moving forward // or backwards depends on the cursor movement mode (logical or visual): - // * in visual mode, since math is always LTR, right -> forward, + // * in visual mode, since math is always LTR, right -> forward, // left -> backwards // * in logical mode, the mapping is determined by the // reverseDirectionNeeded() function - + bool forward; FuncCode finish_lfun; - if (cmd.action == LFUN_CHAR_FORWARD + if (cmd.action == LFUN_CHAR_FORWARD || cmd.action == LFUN_CHAR_FORWARD_SELECT) { forward = true; finish_lfun = LFUN_FINISHED_FORWARD; @@ -611,7 +611,7 @@ void InsetMathNest::doDispatch(Cursor & cur, FuncRequest & cmd) || cmd.action == LFUN_CHAR_RIGHT); if (lyxrc.visual_cursor || !reverseDirectionNeeded(cur)) forward = right; - else + else forward = !right; if (right) @@ -644,18 +644,18 @@ void InsetMathNest::doDispatch(Cursor & cur, FuncRequest & cmd) cur.macroModeClose(); break; } - + // stop/start the selection bool select = cmd.action == LFUN_DOWN_SELECT || cmd.action == LFUN_UP_SELECT; cur.selHandle(select); - + // go up/down bool up = cmd.action == LFUN_UP || cmd.action == LFUN_UP_SELECT; bool successful = cur.upDownInMath(up); if (successful) break; - + if (cur.fixIfBroken()) // FIXME: Something bad happened. We pass the corrected Cursor // instead of letting things go worse. @@ -692,7 +692,7 @@ void InsetMathNest::doDispatch(Cursor & cur, FuncRequest & cmd) case LFUN_WORD_BACKWARD_SELECT: case LFUN_WORD_LEFT_SELECT: cur.selHandle(cmd.action == LFUN_WORD_BACKWARD_SELECT || - cmd.action == LFUN_WORD_LEFT_SELECT || + cmd.action == LFUN_WORD_LEFT_SELECT || cmd.action == LFUN_LINE_BEGIN_SELECT); cur.macroModeClose(); if (cur.pos() != 0) { @@ -1054,7 +1054,7 @@ void InsetMathNest::doDispatch(Cursor & cur, FuncRequest & cmd) cur.recordUndoSelection(); interpretChar(cur, '^'); break; - + case LFUN_MATH_MACRO_FOLD: case LFUN_MATH_MACRO_UNFOLD: { Cursor it = cur; @@ -1133,7 +1133,7 @@ void InsetMathNest::doDispatch(Cursor & cur, FuncRequest & cmd) bool InsetMathNest::findMacroToFoldUnfold(Cursor & it, bool fold) const { // look for macro to open/close, but stay in mathed for (; !it.empty(); it.pop_back()) { - + // go backward through the current cell Inset * inset = it.nextInset(); while (inset && inset->asInsetMath()) { @@ -1142,24 +1142,24 @@ bool InsetMathNest::findMacroToFoldUnfold(Cursor & it, bool fold) const { // found the an macro to open/close? if (macro->folded() != fold) return true; - + // Wrong folding state. // If this was the first we see in this slice, look further left, // otherwise go up. if (inset != it.nextInset()) break; } - + // go up if this was the left most position if (it.pos() == 0) break; - + // go left it.pos()--; inset = it.nextInset(); } } - + return false; } @@ -1254,7 +1254,7 @@ bool InsetMathNest::getStatus(Cursor & cur, FuncRequest const & cmd, // Don't do this with multi-cell selections flag.setEnabled(cur.selBegin().idx() == cur.selEnd().idx()); break; - + case LFUN_MATH_MACRO_FOLD: case LFUN_MATH_MACRO_UNFOLD: { Cursor it = cur; @@ -1262,7 +1262,7 @@ bool InsetMathNest::getStatus(Cursor & cur, FuncRequest const & cmd, flag.setEnabled(found); break; } - + case LFUN_SPECIALCHAR_INSERT: // FIXME: These would probably make sense in math-text mode flag.setEnabled(false); @@ -1283,7 +1283,7 @@ bool InsetMathNest::getStatus(Cursor & cur, FuncRequest const & cmd, void InsetMathNest::edit(Cursor & cur, bool front, EntryDirection entry_from) { cur.push(*this); - bool enter_front = (entry_from == Inset::ENTRY_DIRECTION_RIGHT || + bool enter_front = (entry_from == Inset::ENTRY_DIRECTION_RIGHT || (entry_from == Inset::ENTRY_DIRECTION_IGNORE && front)); cur.idx() = enter_front ? 0 : cur.lastidx(); cur.pos() = enter_front ? 0 : cur.lastpos(); @@ -1336,7 +1336,7 @@ void InsetMathNest::lfunMousePress(Cursor & cur, FuncRequest & cmd) // Update::FitCursor: adjust the screen to the cursor // position if needed // cur.result().update(): don't overwrite previously set flags. - cur.updateFlags(Update::Decoration | Update::FitCursor + cur.updateFlags(Update::Decoration | Update::FitCursor | cur.result().update()); } else if (cmd.button() == mouse_button::button2) { if (cap::selection()) { @@ -1703,7 +1703,7 @@ InsetMathNest::createCompletionList(Cursor const & cur) const { if (!cur.inMacroMode()) return 0; - + return new MathCompletionList(cur); } @@ -1712,7 +1712,7 @@ docstring InsetMathNest::completionPrefix(Cursor const & cur) const { if (!cur.inMacroMode()) return docstring(); - + return cur.activeMacro()->name(); } @@ -1743,7 +1743,7 @@ bool InsetMathNest::insertCompletion(Cursor & cur, docstring const & s, } -void InsetMathNest::completionPosAndDim(Cursor const & cur, int & x, int & y, +void InsetMathNest::completionPosAndDim(Cursor const & cur, int & x, int & y, Dimension & dim) const { Inset const * inset = cur.activeMacro(); @@ -1771,7 +1771,7 @@ bool InsetMathNest::cursorMathForward(Cursor & cur) cur.pushBackward(*cur.nextAtom().nucleus()); cur.inset().idxFirst(cur); return true; - } + } if (cur.posForward() || idxForward(cur)) return true; // try to pop forwards --- but don't pop out of math! leave that to @@ -1790,10 +1790,10 @@ bool InsetMathNest::cursorMathBackward(Cursor & cur) cur.push(*cur.nextAtom().nucleus()); cur.inset().idxLast(cur); return true; - } + } if (cur.posBackward() || idxBackward(cur)) return true; - // try to pop backwards --- but don't pop out of math! leave that to + // try to pop backwards --- but don't pop out of math! leave that to // the FINISH lfuns int s = cur.depth() - 2; if (s >= 0 && cur[s].inset().asInsetMath()) @@ -1909,7 +1909,7 @@ docstring const & MathCompletionList::data(size_t idx) const } -std::string MathCompletionList::icon(size_t idx) const +std::string MathCompletionList::icon(size_t idx) const { // get the latex command docstring cmd; @@ -1918,7 +1918,7 @@ std::string MathCompletionList::icon(size_t idx) const cmd = globals[idx - lsize]; else cmd = locals[idx]; - + // get the icon resource name by stripping the backslash return "images/math/" + to_utf8(cmd.substr(1)) + ".png"; } diff --git a/src/output_latex.cpp b/src/output_latex.cpp index 646e836480..4dcab3d7cb 100644 --- a/src/output_latex.cpp +++ b/src/output_latex.cpp @@ -330,9 +330,9 @@ TeXOnePar(Buffer const & buf, Language const * const par_language = pit->getParLanguage(bparams); // The document's language Language const * const doc_language = bparams.language; - // The language that was in effect when the environment this paragraph is + // The language that was in effect when the environment this paragraph is // inside of was opened - Language const * const outer_language = + Language const * const outer_language = (runparams.local_font != 0) ? runparams.local_font->language() : doc_language; // The previous language that was in effect is either the language of @@ -362,7 +362,7 @@ TeXOnePar(Buffer const & buf, texrow.newline(); } - // We need to open a new language if we couldn't close the previous + // We need to open a new language if we couldn't close the previous // one (because there's no language_command_end); and even if we closed // the previous one, if the current language is different than the // outer_language (which is currently in effect once the previous one @@ -381,11 +381,11 @@ TeXOnePar(Buffer const & buf, // are we in an inset? runparams.local_font != 0 && // is the inset within an \L or \R? - // + // // FIXME: currently, we don't check this; this means that - // we'll have unnnecessary \L and \R commands, but that + // we'll have unnnecessary \L and \R commands, but that // doesn't seem to hurt (though latex will complain) - // + // // is this paragraph in the opposite direction? runparams.local_font->isRightToLeft() != par_language->rightToLeft() @@ -607,7 +607,7 @@ TeXOnePar(Buffer const & buf, // Closing the language is needed for the last paragraph; it is also // needed if we're within an \L or \R that we may have opened above (not // necessarily in this paragraph) and are about to close. - bool closing_rtl_ltr_environment = + bool closing_rtl_ltr_environment = // not for ArabTeX (par_language->lang() != "arabic_arabtex" && outer_language->lang() != "arabic_arabtex") && @@ -616,7 +616,7 @@ TeXOnePar(Buffer const & buf, runparams.local_font->isRightToLeft() != par_language->rightToLeft() && // are we about to close the language? ((nextpit != paragraphs.end() && - par_language->babel() != + par_language->babel() != (nextpit->getParLanguage(bparams))->babel()) || (nextpit == paragraphs.end() && par_language->babel() != outer_language->babel())); @@ -937,12 +937,12 @@ pair switchEncoding(odocstream & os, BufferParams const & bparams, } case Encoding::CJK: { int count = inputenc_arg.length(); - if (oldEnc.package() == Encoding::CJK && + if (oldEnc.package() == Encoding::CJK && open_encoding_ == CJK) { os << "\\end{CJK}"; count += 9; } - if (oldEnc.package() == Encoding::inputenc && + if (oldEnc.package() == Encoding::inputenc && open_encoding_ == inputenc) { os << "\\egroup"; count += 7;