mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-16 16:18:22 +00:00
bb344452c8
Use the function support:truncateWithEllipsis() to shorten a docstring with ... at the end. Actually we use U+2026 HORIZONTAL ELLIPSIS instead of "..." when automatically shortening strings. This is to be consistent with Qt's own truncation and is much nicer on the screen. This includes the bugs #9575 and #9572 regarding broken text elision in the outliner. Known issues (non-regressions): * TocBackend::updateItem() should be rewritten to update all TOCs. (#8386) * "..." should be replaced with … everywhere else on the interface (including translation strings). * We should prefer to rely on QFontMetrics::elidedText() to truncate strings with an ellipsis whenever possible, or an equivalent for the buffer view dependent on the font metrics. See the warning in src/support/lstrings.h.
182 lines
4.1 KiB
C++
182 lines
4.1 KiB
C++
// -*- C++ -*-
|
|
/**
|
|
* \file InsetIPAMacro.h
|
|
* This file is part of LyX, the document processor.
|
|
* Licence details can be found in the file COPYING.
|
|
*
|
|
* \author Jürgen Spitzmüller
|
|
*
|
|
* Full author contact details are available in file CREDITS.
|
|
*/
|
|
|
|
#ifndef INSET_IPAMACRO_H
|
|
#define INSET_IPAMACRO_H
|
|
|
|
|
|
#include "Inset.h"
|
|
#include "InsetCollapsable.h"
|
|
|
|
|
|
namespace lyx {
|
|
|
|
class LaTeXFeatures;
|
|
|
|
class InsetIPADecoParams
|
|
{
|
|
public:
|
|
enum Type {
|
|
Toptiebar,
|
|
Bottomtiebar
|
|
};
|
|
///
|
|
InsetIPADecoParams();
|
|
///
|
|
void write(std::ostream & os) const;
|
|
///
|
|
void read(Lexer & lex);
|
|
///
|
|
Type type;
|
|
};
|
|
|
|
/////////////////////////////////////////////////////////////////////////
|
|
//
|
|
// InsetIPADeco
|
|
//
|
|
/////////////////////////////////////////////////////////////////////////
|
|
|
|
/// Used to insert IPA decorations
|
|
class InsetIPADeco : public InsetCollapsable
|
|
{
|
|
public:
|
|
///
|
|
InsetIPADeco(Buffer *, std::string const &);
|
|
///
|
|
~InsetIPADeco();
|
|
///
|
|
static std::string params2string(InsetIPADecoParams const &);
|
|
///
|
|
static void string2params(std::string const &, InsetIPADecoParams &);
|
|
///
|
|
InsetIPADecoParams const & params() const { return params_; }
|
|
private:
|
|
///
|
|
InsetCode lyxCode() const { return IPADECO_CODE; }
|
|
///
|
|
docstring layoutName() const;
|
|
///
|
|
void metrics(MetricsInfo &, Dimension &) const;
|
|
///
|
|
void draw(PainterInfo & pi, int x, int y) const;
|
|
///
|
|
void write(std::ostream &) const;
|
|
///
|
|
void read(Lexer & lex);
|
|
///
|
|
bool neverIndent() const { return true; }
|
|
///
|
|
void latex(otexstream &, OutputParams const &) const;
|
|
///
|
|
int plaintext(odocstringstream & ods, OutputParams const & op,
|
|
size_t max_length = INT_MAX) const;
|
|
///
|
|
int docbook(odocstream &, OutputParams const &) const;
|
|
///
|
|
docstring xhtml(XHTMLStream &, OutputParams const &) const;
|
|
///
|
|
bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;
|
|
///
|
|
void doDispatch(Cursor & cur, FuncRequest & cmd);
|
|
///
|
|
void validate(LaTeXFeatures & features) const;
|
|
///
|
|
bool allowSpellCheck() const { return false; }
|
|
///
|
|
bool insetAllowed(InsetCode code) const;
|
|
///
|
|
docstring toolTip(BufferView const & bv, int x, int y) const;
|
|
///
|
|
Inset * clone() const { return new InsetIPADeco(*this); }
|
|
/// used by the constructors
|
|
void init();
|
|
///
|
|
friend class InsetIPADecoParams;
|
|
|
|
///
|
|
InsetIPADecoParams params_;
|
|
};
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////
|
|
//
|
|
// InsetIPAChar
|
|
//
|
|
/////////////////////////////////////////////////////////////////////////
|
|
|
|
/// Used to insert special IPA chars that are not available in unicode
|
|
class InsetIPAChar : public Inset {
|
|
public:
|
|
|
|
/// The different kinds of special chars we support
|
|
enum Kind {
|
|
/// falling tone mark
|
|
TONE_FALLING,
|
|
/// rising tone mark
|
|
TONE_RISING,
|
|
/// high-rising tone mark
|
|
TONE_HIGH_RISING,
|
|
/// low-rising tone mark
|
|
TONE_LOW_RISING,
|
|
/// high rising-falling tone mark
|
|
TONE_HIGH_RISING_FALLING
|
|
};
|
|
|
|
///
|
|
InsetIPAChar() : Inset(0), kind_(TONE_FALLING) {}
|
|
///
|
|
explicit InsetIPAChar(Kind k);
|
|
///
|
|
Kind kind() const;
|
|
///
|
|
void metrics(MetricsInfo &, Dimension &) const;
|
|
///
|
|
void draw(PainterInfo & pi, int x, int y) const;
|
|
///
|
|
void write(std::ostream &) const;
|
|
/// Will not be used when lyxf3
|
|
void read(Lexer & lex);
|
|
///
|
|
void latex(otexstream &, OutputParams const &) const;
|
|
///
|
|
int plaintext(odocstringstream & ods, OutputParams const & op,
|
|
size_t max_length = INT_MAX) const;
|
|
///
|
|
int docbook(odocstream &, OutputParams const &) const;
|
|
///
|
|
docstring xhtml(XHTMLStream &, OutputParams const &) const;
|
|
///
|
|
void toString(odocstream &) const;
|
|
///
|
|
void forOutliner(docstring &, size_t const, bool const) const;
|
|
///
|
|
InsetCode lyxCode() const { return IPACHAR_CODE; }
|
|
/// We don't need \begin_inset and \end_inset
|
|
bool directWrite() const { return true; }
|
|
///
|
|
void validate(LaTeXFeatures &) const;
|
|
|
|
/// should this inset be handled like a normal character?
|
|
bool isChar() const { return true; }
|
|
/// is this equivalent to a letter?
|
|
bool isLetter() const { return true; }
|
|
private:
|
|
Inset * clone() const { return new InsetIPAChar(*this); }
|
|
|
|
/// And which kind is this?
|
|
Kind kind_;
|
|
};
|
|
|
|
|
|
} // namespace lyx
|
|
|
|
#endif
|