]> git.lyx.org Git - features.git/commitdiff
Remove InsetMathXYArrow
authorGeorg Baum <baum@lyx.org>
Thu, 16 Jun 2016 18:39:32 +0000 (20:39 +0200)
committerGeorg Baum <baum@lyx.org>
Thu, 16 Jun 2016 18:39:32 +0000 (20:39 +0200)
This was dead code that did never work, and most of it was boilerplate that
you can steel in 15 minutes from any existing math inset. Apart from that it
did contain a pointer to InsetXYMatrix which would create the same problems
we saw with the macros.

development/cmake/LyxPackaging.cmake
src/insets/Inset.cpp
src/insets/InsetCode.h
src/mathed/CMakeLists.txt
src/mathed/InsetMathXYArrow.cpp [deleted file]
src/mathed/InsetMathXYArrow.h [deleted file]
src/mathed/MathParser.cpp

index 5e6e0e43b513d56ac7803009f48eda991b30552d..7a1916e26bfa64f97d4049a8d23bf4152764f9ad 100644 (file)
@@ -195,7 +195,6 @@ SET(CPACK_SOURCE_IGNORE_FILES
 "/attic/"
 "/HTML/"
 "/lyx-2\\\\."
-"/InsetMathXYArrow\\\\..*$"
 "/expectedTestFailures$"
 "/MergedManuals.lyx$"
 )
index a0bbf32f4a2435af33456a26ef48a6b4de6e0618..c7d3f9654fe4bb81e96f746b71b50ea4479732e3 100644 (file)
@@ -172,7 +172,6 @@ static void build_translator()
        insetnames[MATH_UNDERSET_CODE] = InsetName("mathunderset");
        insetnames[MATH_UNKNOWN_CODE] = InsetName("mathunknown");
        insetnames[MATH_XARROW_CODE] = InsetName("mathxarrow");
-       insetnames[MATH_XYARROW_CODE] = InsetName("mathxyarrow");
        insetnames[MATH_XYMATRIX_CODE] = InsetName("mathxymatrix");
        insetnames[MATH_DIAGRAM_CODE] = InsetName("mathdiagram");
        insetnames[MATH_MACRO_CODE] = InsetName("mathmacro");
index ea7f981231568b76e9a9e0ac9499793bf945c696..1df6800d2d8cdfec456494aa607e51aaa96bb7b8 100644 (file)
@@ -217,11 +217,9 @@ enum InsetCode {
        ///
        MATH_XARROW_CODE,
        ///
-       MATH_XYARROW_CODE,
+       MATH_XYMATRIX_CODE,
        ///
-       MATH_XYMATRIX_CODE, // 100
-       ///
-       MATH_MACRO_CODE,
+       MATH_MACRO_CODE, // 100
        ///
        ARGUMENT_PROXY_CODE,
        ///
@@ -229,9 +227,9 @@ enum InsetCode {
        ///
        MATH_DIAGRAM_CODE, 
        ///
-       SCRIPT_CODE, // 105
+       SCRIPT_CODE,
        ///
-       IPA_CODE,
+       IPA_CODE, // 105
        ///
        IPACHAR_CODE,
        ///
index 8d354f6a133e35ae3caf545868325f0b31186ad5..c47ca6b0a6de607f5d7c61d5644aaa755e2b82a4 100644 (file)
@@ -9,9 +9,6 @@ project(mathed)
 file(GLOB mathed_sources ${TOP_SRC_DIR}/src/mathed/${LYX_CPP_FILES})
 file(GLOB mathed_headers ${TOP_SRC_DIR}/src/mathed/${LYX_HPP_FILES})
 
-list(REMOVE_ITEM mathed_sources
-       ${TOP_SRC_DIR}/src/mathed/InsetMathXYArrow.cpp)
-
 lyx_add_msvc_pch(mathed)
 
 include_directories(${TOP_SRC_DIR}/src/mathed ${QT_INCLUDES})
diff --git a/src/mathed/InsetMathXYArrow.cpp b/src/mathed/InsetMathXYArrow.cpp
deleted file mode 100644 (file)
index 19852e5..0000000
+++ /dev/null
@@ -1,172 +0,0 @@
-/**
- * \file InsetMathXYArrow.cpp
- * This file is part of LyX, the document processor.
- * Licence details can be found in the file COPYING.
- *
- * \author André Pönitz
- *
- * Full author contact details are available in file CREDITS.
- */
-
-#include <config.h>
-
-#include "InsetMathXYArrow.h"
-#include "MathStream.h"
-#include "MathSupport.h"
-#include "frontends/Painter.h"
-#include "support/debug.h"
-
-using namespace std;
-
-namespace lyx {
-
-
-InsetMathXYArrow::InsetMathXYArrow()
-       : InsetMathNest(2), up_(false), target_(0)
-{}
-
-
-Inset * InsetMathXYArrow::clone() const
-{
-       return new InsetMathXYArrow(*this);
-}
-
-
-InsetMathXYMatrix const * InsetMathXYArrow::targetMatrix() const
-{
-       return target_;
-}
-
-
-MathData const & InsetMathXYArrow::targetCell() const
-{
-#if 0
-       InsetMathXYMatrix const * p = targetMatrix();
-       int x = 0;
-       int y = 0;
-       MathData const & t = cell(0);
-       for (MathData::const_iterator it = t.begin(); it != t.end(); ++it) {
-               switch ((*it)->getChar()) {
-                       case 'l': --x; break;
-                       case 'r': ++x; break;
-                       case 'u': --y; break;
-                       case 'd': ++y; break;
-               }
-       }
-       //lyxerr << "target: x: " << x << " y: " << y << endl;
-       InsetMath::idx_type n = mi_.idx + p->ncols() * y + x;
-       if (n >= p->nargs()) {
-               lyxerr << "source: n: " << mi_.idx << "\n"
-                      << "target: n: " << n << " out of range" << endl;
-               n = 0;
-       }
-       return p->cell(n);
-#else
-       static MathData dummy;
-       return dummy;
-#endif
-}
-
-
-MathData const & InsetMathXYArrow::sourceCell() const
-{
-#if 0
-       return targetMatrix()->cell(mi_.idx);
-#else
-       static MathData dummy;
-       return dummy;
-#endif
-}
-
-
-bool InsetMathXYArrow::metrics(MetricsInfo & mi) const
-{
-       InsetMathNest::metrics(mi);
-       mi_ = mi;
-       Changer dummy = mi.base.changeFontSet(mi.base, "textrm");
-#if 0
-       target_ = mi.inset ? mi.inset->asXYMatrixInset() : 0;
-
-       if (editing()) {
-               int w    = mathed_string_width(mi.base.font, from_ascii("target: "));
-               width_   = w + max(dim0.width(), dim1.wid);
-               ascent_  = dim0.asc;
-               descent_ = dim0.des + dim1.height() + 10;
-       } else {
-               width_   = 0;
-               ascent_  = 0;
-               descent_ = 0;
-               //mathed_string_dim(font_, "X", ascent_, descent_, width_);
-       }
-#endif
-}
-
-
-void InsetMathXYArrow::draw(PainterInfo & pi, int x, int y) const
-{
-       metrics(mi_);
-       Changer dummy = pi.base.changeFontSet(pi.base, "textrm");
-
-       if (editing()) {
-
-#if 0
-
-               int lasc;
-               int ldes;
-               int lwid;
-               mathed_string_dim(pi.base.font, "target: ", lasc, ldes, lwid);
-
-               cell(0).draw(pi, x + lwid, y);
-               pi.base.text(x + 3, y, "target");
-               y += max(dim0.des, ldes) + 5;
-
-               y += max(dim1.asc, lasc) + 5;
-               cell(1).draw(pi, x + lwid, y);
-               pi.base.text(x + 3, y, "label");
-
-#endif
-
-       } else {
-
-               pi.pain.text(x, y, "X");
-               MathData const & s = sourceCell();
-               MathData const & t = targetCell();
-               pi.pain.line(s.xm(), s.ym(), t.xm(), t.ym(), Color_math);
-               cell(1).draw(pi, (s.xm() + t.xm())/2, (s.ym() + t.ym())/2);
-
-       }
-}
-
-
-void InsetMathXYArrow::write(WriteStream & os) const
-{
-       MathEnsurer ensurer(os);
-       os << "\\ar";
-       if (!cell(0).empty())
-               os << '[' << cell(0) << ']';
-       if (!cell(1).empty())
-               os << (up_ ? '^' : '_') << '{' << cell(1) << '}';
-       os << " ";
-}
-
-
-void InsetMathXYArrow::normalize(NormalStream & os) const
-{
-       os << "[xyarrow ";
-       InsetMathNest::normalize(os);
-       os << ']';
-}
-
-
-void InsetMathXYArrow::mathmlize(MathStream &) const
-{
-       throw MathExportException();
-}
-
-
-void InsetMathXYArrow::htmlize(HtmlStream &) const 
-{
-       throw MathExportException(); 
-}
-
-} // namespace lyx
diff --git a/src/mathed/InsetMathXYArrow.h b/src/mathed/InsetMathXYArrow.h
deleted file mode 100644 (file)
index da5d0a6..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-// -*- C++ -*-
-/**
- * \file InsetMathXYArrow.h
- * This file is part of LyX, the document processor.
- * Licence details can be found in the file COPYING.
- *
- * \author André Pönitz
- *
- * Full author contact details are available in file CREDITS.
- */
-
-#ifndef MATH_XYARROWINSET_H
-#define MATH_ARROWINSET_H
-
-#include "InsetMathNest.h"
-#include "MetricsInfo.h"
-
-
-namespace lyx {
-
-
-// for the \ar stuff in \xymatrix
-
-class InsetMathXYMatrix;
-
-class InsetMathXYArrow : public InsetMathNest {
-public:
-       ///
-       InsetMathXYArrow();
-       ///
-       virtual Inset * clone() const;
-       ///
-       bool metrics(MetricsInfo & mi) const;
-       ///
-       void draw(PainterInfo & pi, int x, int y) const;
-       ///
-       InsetMathXYArrow * asXYArrowInset() { return this; }
-
-       ///
-       void write(WriteStream & os) const;
-       ///
-       void normalize(NormalStream &) const;
-       ///
-       InsetMathXYMatrix const * targetMatrix() const;
-       ///
-       MathData const & targetCell() const;
-       ///
-       MathData const & sourceCell() const;
-       ///
-       InsetCode lyxCode() const { return MATH_XYARROW_CODE; }
-       ///
-       void mathmlize(MathStream &) const;
-       ///
-       void htmlize(HtmlStream &) const;
-
-       ///
-       bool up_;
-       ///
-       mutable MetricsInfo mi_;
-       ///
-       mutable Font font_;
-       ///
-       mutable InsetMathXYMatrix const * target_;
-};
-
-
-
-} // namespace lyx
-#endif
index d3263175205ea46cb95a1877c1a63d2fafe3de7d..1e615d248b38731575fd73b95b4aa490a592dd10 100644 (file)
@@ -1943,23 +1943,6 @@ bool Parser::parse1(InsetMathGrid & grid, unsigned flags,
                        cell->push_back(createInsetMath(t.cs(), buf));
                        parse2(cell->back(), FLAG_ITEM, mode, false);
                }
-
-               // Disabled
-               else if (1 && t.cs() == "ar") {
-                       auto p = make_unique<InsetMathXYArrow>();
-                       // try to read target
-                       parse(p->cell(0), FLAG_OTPTION, mode);
-                       // try to read label
-                       if (nextToken().cat() == catSuper || nextToken().cat() == catSub) {
-                               p->up_ = nextToken().cat() == catSuper;
-                               getToken();
-                               parse(p->cell(1), FLAG_ITEM, mode);
-                               //lyxerr << "read label: " << p->cell(1) << endl;
-                       }
-
-                       cell->push_back(MathAtom(p.release()));
-                       //lyxerr << "read cell: " << cell << endl;
-               }
 #endif
 
                else if (t.cs() == "lyxmathsym") {