fix the smallcaps drawing, move xfont metrics functions out from LyXFont, move non-inlineable functions out of line

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@638 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2000-04-04 00:19:15 +00:00
parent 0542d7af5d
commit 77e706c441
151 changed files with 1271 additions and 1155 deletions

View File

@ -1,3 +1,36 @@
2000-04-03 Lars Gullik Bjønnes <larsbj@lyx.org>
* src/font.[Ch]: new files. Contains the metric functions for
fonts, takes a LyXFont as parameter. Better separation of concepts.
* src/lyxfont.[Ch]: move the metric functions to font.[Ch] several
changes because of this.
* src/PainterBase.[Ch] (width): remove, use the ones in font.C instead
* src/*: compile with -Winline and move functions that don't
inline out of line.
* src/lyx_cb.C (stringOnlyContains): use string::find_first_not_of
instead of strspn.
2000-04-02 Lars Gullik Bjønnes <larsbj@lyx.org>
* src/paragraph.C (GetLabelstring): renamed from GetLabestring.
(various files changed because of this)
* src/Painter.C (text): fixed the drawing of smallcaps.
* src/lyxfont.[Ch] (drawText): removed unused member func.
(drawString): ditto
* src/*.C: added needed "using" statements and "std::" qualifiers.
2000-03-31 Lars Gullik Bjønnes <larsbj@lyx.org>
* src/*.h: removed all use of "using" from header files use
qualifier std:: instead.
2000-04-03 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
* src/text.C (Backspace): some additional cleanups (we already

View File

@ -194,7 +194,7 @@ dnl Check the version of g++
fi
if test x$with_warnings = xyes ; then
case $gxx_version in
2.95.*) CXXFLAGS="$CXXFLAGS -W -Wall -Wconversion";;
2.95.*) CXXFLAGS="$CXXFLAGS -W -Wall -Wconversion -Winline";;
2.96*) CXXFLAGS="$CXXFLAGS -W -Wall -Wconversion";;
*) CXXFLAGS="$CXXFLAGS -ansi -W -Wall -Wno-return-type";;
esac

View File

@ -194,7 +194,7 @@ dnl Check the version of g++
fi
if test x$with_warnings = xyes ; then
case $gxx_version in
2.95.*) CXXFLAGS="$CXXFLAGS -W -Wall -Wconversion";;
2.95.*) CXXFLAGS="$CXXFLAGS -W -Wall -Wconversion -Winline";;
2.96*) CXXFLAGS="$CXXFLAGS -W -Wall -Wconversion";;
*) CXXFLAGS="$CXXFLAGS -ansi -W -Wall -Wno-return-type";;
esac

View File

@ -24,30 +24,26 @@ src/FontLoader.C
src/form1.C
src/gettext.h
src/insets/figinset.C
src/insets/figinset.h
src/insets/form_graphics.C
src/insets/form_url.C
src/insets/insetbib.C
src/insets/inset.C
src/insets/inseteditor.C
src/insets/inseterror.C
src/insets/inseterror.h
src/insets/insetert.C
src/insets/insetert.h
src/insets/insetfoot.C
src/insets/insetgraphics.C
src/insets/insetinclude.C
src/insets/insetindex.C
src/insets/insetinfo.C
src/insets/insetinfo.h
src/insets/insetloa.h
src/insets/insetlof.h
src/insets/insetlot.h
src/insets/insetparent.h
src/insets/insetloa.C
src/insets/insetlof.C
src/insets/insetlot.C
src/insets/insetparent.C
src/insets/insetref.C
src/insets/insettext.C
src/insets/insettoc.h
src/insets/insettoc.C
src/insets/inseturl.C
src/insets/inseturl.h
src/insets/lyxinset.h
src/intl.C
src/kbsequence.C
src/language.C
@ -74,14 +70,11 @@ src/LyXSendto.C
src/lyxvc.C
src/LyXView.C
src/mathed/formula.C
src/mathed/formula.h
src/mathed/formulamacro.C
src/mathed/formulamacro.h
src/mathed/math_forms.C
src/mathed/math_panel.C
src/menus.C
src/minibuffer.C
src/minibuffer.h
src/Painter.C
src/PaperLayout.C
src/paragraph.C

View File

@ -15,8 +15,6 @@
#include "LString.h"
using std::stack;
// Created by Alejandro Aguilar Sierra, 970806
/** Utility to get back from a reference or from a child document.
@ -55,7 +53,7 @@ public:
}
private:
///
stack<BackStackItem> stakk;
std::stack<BackStackItem> stakk;
};
#endif

View File

@ -47,7 +47,9 @@
#include "lyxrc.h"
#include "lyxrow.h"
#include "WorkArea.h"
#include "font.h"
using std::pair;
using std::for_each;
using std::find_if;
using std::endl;
@ -935,7 +937,7 @@ void BufferView::workAreaButtonRelease(int x, int y, unsigned int button)
font.setSize(LyXFont::SIZE_FOOTNOTE);
int box_x = 20; // LYX_PAPER_MARGIN;
box_x += font.textWidth(" wide-tab ", 10);
box_x += lyxfont::width(" wide-tab ", font);
int screen_first = screen->first;
@ -944,7 +946,7 @@ void BufferView::workAreaButtonRelease(int x, int y, unsigned int button)
text->cursor.row->baseline
&& y + screen_first < text->cursor.y -
text->cursor.row->baseline
+ font.maxAscent() * 1.2 + font.maxDescent() * 1.2) {
+ lyxfont::maxAscent(font) * 1.2 + lyxfont::maxDescent(font) * 1.2) {
toggleFloat();
selection_possible = false;
return;

View File

@ -26,6 +26,7 @@
extern BufferList bufferlist;
using std::pair;
using std::endl;
using std::ifstream;

View File

@ -22,9 +22,6 @@
#pragma interface
#endif
using std::map;
using std::pair;
///
class DepTable {
public:
@ -54,8 +51,8 @@ public:
void remove_files_with_extension(string const &);
private:
///
typedef map<string,
pair<unsigned long, unsigned long> > DepList;
typedef std::map<string,
std::pair<unsigned long, unsigned long> > DepList;
///
DepList deplist;
};

View File

@ -13,6 +13,8 @@
#include <cmath> // fabs()
#include <cstdlib> // atoi()
#include FORMS_H_LOCATION
#ifdef __GNUG__
#pragma implementation "FontInfo.h"
#endif
@ -144,6 +146,17 @@ void FontInfo::query()
}
void FontInfo::init()
{
sizes = 0;
strings = 0;
matches = 0;
queried = false;
scalable = false;
scaleindex = -1;
}
/// Release allocated stuff
void FontInfo::release()
{

View File

@ -80,14 +80,7 @@ private:
int scaleindex;
/// Initialize empty record
void init() {
sizes = 0;
strings = 0;
matches = 0;
queried = false;
scalable = false;
scaleindex = -1;
}
void init();
/// Release allocated stuff
void release();

View File

@ -30,6 +30,11 @@ using std::endl;
extern BufferView * current_view;
// The global fontloader
FontLoader fontloader;
// Initialize font loader
FontLoader::FontLoader()
{

View File

@ -73,4 +73,7 @@ private:
LyXFont::FONT_SHAPE shape,
LyXFont::FONT_SIZE size);
};
extern FontLoader fontloader;
#endif

View File

@ -19,8 +19,6 @@
#include "LString.h"
using std::map;
/**
This is a stateless class.
@ -196,8 +194,7 @@ private:
string const & lyx);
///
//typedef map<LColor::color, information, less<LColor::color> > InfoTab;
typedef map<LColor::color, information> InfoTab;
typedef std::map<LColor::color, information> InfoTab;
InfoTab infotab;
};

View File

@ -17,6 +17,7 @@
using std::string;
#else
#include "support/lyxstring.h"
// using lyx::string;
typedef lyxstring string;
#endif
#endif

View File

@ -23,8 +23,6 @@
#include "DepTable.h"
#include <vector>
using std::vector;
class MiniBuffer;
///
@ -48,7 +46,7 @@ private:
};
public:
///
typedef vector<Error> Errors;
typedef std::vector<Error> Errors;
///
Errors::const_iterator begin() const { return errors.begin(); }
///

View File

@ -130,7 +130,7 @@ string LaTeXFeatures::getPackages(BufferParams const & params)
//char value[30];
//sprintf(value, "%.2f", params.spacing.getValue());
#ifdef HAVE_SSTREAM
ostringstream value;
std::ostringstream value;
#else
char val[30];
ostrstream value(val, 30);

View File

@ -22,9 +22,6 @@
#include "LString.h"
using std::vector;
using std::set;
class BufferParams;
class LyXTextClass;
struct Language;
@ -125,7 +122,7 @@ struct LaTeXFeatures {
//@Man: Layouts
//@{
vector<bool> layout;
std::vector<bool> layout;
//@}
//@Man: Special features
@ -136,7 +133,7 @@ struct LaTeXFeatures {
///
bool NeedLyXMinipageIndent;
///
typedef set<Language const *> LanguageList;
typedef std::set<Language const *> LanguageList;
///
LanguageList UsedLanguages;
//@}

View File

@ -19,6 +19,7 @@
#include "gettext.h"
#include "support/lstrings.h"
using std::ostream;
using std::endl;
/*

View File

@ -11,8 +11,6 @@
#include "commandtags.h"
#include "LString.h"
using std::map;
/** This class encapsulates LyX action and user command operations.
*/
class LyXAction {
@ -31,20 +29,15 @@ private:
};
public:
///
typedef map<string, kb_action> func_map;
//typedef map<string, kb_action, less<string> > func_map;
typedef std::map<string, kb_action> func_map;
///
typedef map<kb_action, func_info> info_map;
//typedef map<kb_action, func_info, less<kb_action> > info_map;
typedef std::map<kb_action, func_info> info_map;
///
typedef map<unsigned int, pseudo_func> pseudo_map;
//typedef map<unsigned int, pseudo_func, less<unsigned int> > pseudo_map;
typedef std::map<unsigned int, pseudo_func> pseudo_map;
///
typedef map<string, unsigned int> arg_item;
//typedef map<string, unsigned int, less<string> > arg_item;
typedef std::map<string, unsigned int> arg_item;
///
typedef map<kb_action, arg_item> arg_map;
//typedef map<kb_action, arg_item, less<kb_action> > arg_map;
typedef std::map<kb_action, arg_item> arg_map;
///
enum func_attrib {

View File

@ -90,6 +90,8 @@ lyx_SOURCES = \
figure.h \
filedlg.C \
filedlg.h \
font.C \
font.h \
form1.C \
form1.h \
gettext.h \

View File

@ -14,12 +14,12 @@
#pragma implementation
#endif
#include <cmath>
#ifdef USE_STL_MEMORY
#include <memory>
#endif
#include <cmath>
#include FORMS_H_LOCATION
#include "Painter.h"
#include "LString.h"
@ -28,8 +28,10 @@
#include "support/LAssert.h"
#include "support/lstrings.h"
#include "WorkArea.h"
#include "font.h"
using std::endl;
using std::max;
Painter::Painter(WorkArea & wa)
: PainterBase(wa)
@ -116,7 +118,7 @@ PainterBase & Painter::lines(int const * xp, int const * yp, int np,
#else
auto_ptr<XPoint> points(new Xpoint[np]);
#endif
for (int i=0; i<np; ++i) {
for (int i = 0; i < np; ++i) {
points[i].x = xp[i];
points[i].y = yp[i];
}
@ -179,7 +181,7 @@ PainterBase & Painter::fillPolygon(int const * xp, int const * yp, int np,
#else
auto_ptr<XPoint> points(new XPoint[np]);
#endif
for (int i=0; i<np; ++i) {
for (int i=0; i < np; ++i) {
points[i].x = xp[i];
points[i].y = yp[i];
}
@ -285,11 +287,34 @@ PainterBase & Painter::text(int x, int y, char const * s, int ls,
"workarea::workhandler\n";
lyxerr << "Painter drawable: " << drawable() << endl;
}
GC gc = getGCForeground(f.realColor());
XSetFont(display, gc, f.getFontID());
if (f.realShape() != LyXFont::SMALLCAPS_SHAPE) {
lyxfont::XSetFont(display, gc, f);
XDrawString(display, drawable(), gc, x, y, s, ls);
underline(f, x, y, this->width(s, ls, f));
} else {
LyXFont smallfont(f);
smallfont.decSize().decSize().setShape(LyXFont::UP_SHAPE);
char c;
int tmpx = x;
for(int i = 0; i < ls; ++i) {
c = s[i];
if (islower(static_cast<unsigned char>(c))) {
c = toupper(c);
lyxfont::XSetFont(display, gc, smallfont);
XDrawString(display, drawable(),
gc, tmpx, y, &c, 1);
tmpx += lyxfont::XTextWidth(smallfont, &c, 1);
//tmpx += lyxfont::width(c, f);
} else {
lyxfont::XSetFont(display, gc, f);
XDrawString(display, drawable(),
gc, tmpx, y, &c, 1);
tmpx += lyxfont::XTextWidth(f, &c, 1);
//tmpx += lyxfont::width(c, f);
}
}
}
underline(f, x, y, lyxfont::width(s, ls, f));
return *this;
}
@ -298,10 +323,8 @@ void Painter::underline(LyXFont const & f, int x, int y, int width)
{
// What about underbars?
if (f.underbar() == LyXFont::ON && f.latex() != LyXFont::ON) {
int below = f.maxDescent() / 2;
if (below < 2) below = 2;
int height = (f.maxDescent() / 4) - 1;
if (height < 0) height = 0;
int below = max(lyxfont::maxDescent(f) / 2, 2);
int height = max((lyxfont::maxDescent(f) / 4) - 1, 0);
fillRectangle(x, y + below, width, below + height, f.color());
}
}

View File

@ -25,8 +25,6 @@
#include "PainterBase.h"
#include "LColor.h"
using std::map;
class LyXFont;
class WorkArea;
@ -131,8 +129,7 @@ protected:
/// Caching of ordinary color GCs
GC colorGCcache[LColor::ignore + 1];
/// Caching of GCs used for lines
//typedef map<int, GC, less<int> > LineGCCache;
typedef map<int, GC> LineGCCache;
typedef std::map<int, GC> LineGCCache;
///
LineGCCache lineGCcache;
};

View File

@ -16,7 +16,7 @@
#include "PainterBase.h"
#include "lyxfont.h"
#include "WorkArea.h"
#include "font.h"
int PainterBase::dummy1 = 0;
int PainterBase::dummy2 = 0;
@ -34,24 +34,6 @@ int PainterBase::paperWidth() const
}
int PainterBase::width(string const & s, LyXFont const & f) const
{
return f.stringWidth(s);
}
int PainterBase::width(char const * s, int l, LyXFont const & f) const
{
return f.textWidth(s, l);
}
int PainterBase::width(char c, LyXFont const & f) const
{
return f.width(c);
}
PainterBase & PainterBase::circle(int x, int y, unsigned int d,
LColor::color col)
{
@ -110,9 +92,9 @@ PainterBase & PainterBase::rectText(int x, int baseline,
int & width, int & ascent, int & descent)
{
static int const d = 2;
width = this->width(str, font) + d * 2 + 2;
ascent = font.maxAscent() + d;
descent = font.maxDescent() + d;
width = lyxfont::width(str, font) + d * 2 + 2;
ascent = lyxfont::maxAscent(font) + d;
descent = lyxfont::maxDescent(font) + d;
if (!draw) return *this;
@ -129,9 +111,9 @@ PainterBase & PainterBase::buttonText(int x, int baseline,
LyXFont const & font, bool draw,
int & width, int & ascent, int & descent)
{
width = this->width(str, font) + 8;
ascent = font.maxAscent() + 3;
descent = font.maxDescent() + 3;
width = lyxfont::width(str, font) + 8;
ascent = lyxfont::maxAscent(font) + 3;
descent = lyxfont::maxDescent(font) + 3;
if (!draw) return *this;

View File

@ -20,7 +20,6 @@
class WorkArea;
class LyXFont;
//class LyXScreen;
/** A painter class to encapsulate all graphics parameters and operations
@ -162,16 +161,6 @@ public:
/// Draw a char at position x, y (y is the baseline)
virtual PainterBase & text(int x, int y, char c, LyXFont const & f)=0;
/// Get the width of text
int width(string const & s, LyXFont const & f) const;
/** Get the width of text
This is just for fast width */
int width(char const * s, int l, LyXFont const & f) const;
/// Get the width of text
int width(char c, LyXFont const & f) const;
/** Draws a string and encloses it inside a rectangle. Returns
the size of the rectangle. If draw is false, we only calculate
the size. */

View File

@ -11,6 +11,7 @@ using std::istringstream;
#include "Spacing.h"
using std::ios;
using std::ostream;
/// how can I put this inside of Spacing (class)
static

View File

@ -14,8 +14,6 @@
#include <iosfwd>
using std::ostream;
///
class Spacing {
public:
@ -44,7 +42,7 @@ public:
///
void set(Spacing::Space sp, char const * val) ;
///
void writeFile(ostream &) const;
void writeFile(std::ostream &) const;
///
friend bool operator!=(Spacing const & a, Spacing const & b) {
if (a.space == b.space && a.getValue() == b.getValue())

View File

@ -22,6 +22,7 @@
#include "buffer.h"
#include "bufferlist.h"
using std::ostream;
using std::for_each;
using std::remove_if;
using std::find_if;

View File

@ -23,9 +23,6 @@
#include "LString.h"
#include "lyxtext.h"
using std::ostream;
using std::vector;
class Buffer;
// This is only the very first implemetation and use of the TextCache,
@ -115,7 +112,7 @@ class Buffer;
class TextCache {
public:
///
typedef vector<LyXText*> Cache;
typedef std::vector<LyXText*> Cache;
///
typedef LyXText * value_type;
@ -124,9 +121,9 @@ public:
LyXText * findFit(Buffer * b, unsigned short p);
/** Lists all the LyXText's currently in the cache.
Uses msg as header for the list. */
void show(ostream & o, string const & msg);
void show(std::ostream & o, string const & msg);
/// Gives info on a single LyXText (buffer and width)
static void show(ostream & o, LyXText *);
static void show(std::ostream & o, LyXText *);
/** Adds a LyXText to the cache iff its buffer is
present in bufferlist. */
void add(LyXText *);

View File

@ -7,16 +7,13 @@
#include "LString.h"
using std::vector;
class LyXLex;
///
class ToolbarDefaults {
public:
///
typedef vector<int> Defaults;
typedef std::vector<int> Defaults;
///
typedef Defaults::iterator iterator;
///

View File

@ -10,8 +10,6 @@
#include <queue>
#include "support/LAssert.h"
using std::queue;
class Inset;
class BufferView;
@ -27,7 +25,7 @@ public:
void update(BufferView *);
private:
///
typedef queue<Inset*> InsetQueue;
typedef std::queue<Inset*> InsetQueue;
///
InsetQueue insetqueue;
};

View File

@ -21,8 +21,6 @@
#include FORMS_H_LOCATION
#include "Painter.h"
using std::pair;
class BufferView;
class WorkArea {
@ -79,8 +77,8 @@ public:
return fl_get_slider_value(scrollbar);
}
///
pair<double, double> getScrollbarBounds() const {
pair<double, double> p;
std::pair<double, double> getScrollbarBounds() const {
std::pair<double, double> p;
fl_get_slider_bounds(scrollbar, &p.first, &p.second);
return p;
}

View File

@ -25,12 +25,6 @@
#include <fstream>
#include <iomanip>
using std::ofstream;
using std::ifstream;
using std::fstream;
using std::ios;
using std::setw;
#include <cstdlib>
#include <unistd.h>
@ -74,7 +68,7 @@ using std::setw;
#include "insets/insetspecialchar.h"
#include "insets/figinset.h"
#include "insets/insettext.h"
#include "insets/insetnumber.h"
//#include "insets/insetnumber.h"
#include "insets/insetert.h"
#include "insets/insetgraphics.h"
#include "insets/insetfoot.h"
@ -93,7 +87,14 @@ using std::setw;
#include "gettext.h"
#include "language.h"
using std::ostream;
using std::ofstream;
using std::ifstream;
using std::fstream;
using std::ios;
using std::setw;
using std::endl;
using std::pair;
// Uncomment this line to enable a workaround for the weird behaviour
// of the cursor between a displayed inset and last character
@ -813,6 +814,7 @@ bool Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
par->InsertInset(pos, inset);
par->SetFont(pos, font);
++pos;
#if 0
} else if (tmptok == "Number") {
inset = new InsetNumber(this);
inset->Read(lex);
@ -820,6 +822,7 @@ bool Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
par->InsertInset(pos, inset);
par->SetFont(pos, font);
++pos;
#endif
} else if (tmptok == "Foot") {
inset = new InsetFoot(this);
inset->Read(lex);
@ -857,7 +860,7 @@ bool Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
if (!inscmd.getOptions().empty() || !inscmd.getContents().empty()) {
inset = new InsetRef(inscmd, this);
}
#warning Verify that this else clause is still needed. (Lgb)
#warning Check if this else clause is still needed. (Lgb)
#if 0
// This condition comes from a
// temporary solution to the latexdel
@ -1389,7 +1392,7 @@ void Buffer::writeFileAscii(string const & fname, int linelen)
if ((inset = par->GetInset(i))) {
#if 1
#ifdef HAVE_SSTREAM
ostringstream ost;
std::ostringstream ost;
inset->Latex(ost, -1, free_spc);
h += ost.str().length();
#else
@ -2038,7 +2041,7 @@ void Buffer::makeLaTeXFile(string const & fname,
bool was_title = false;
bool already_title = false;
#ifdef HAVE_SSTREAM
ostringstream ftnote;
std::ostringstream ftnote;
#else
char * tmpholder = 0;
#endif
@ -2495,7 +2498,7 @@ void Buffer::DocBookHandleFootnote(ostream & os, LyXParagraph * & par,
.NumberOfLayout(params.textclass,
"Caption").second) {
#ifdef HAVE_SSTREAM
ostringstream ost;
std::ostringstream ost;
#else
ostrstream ost;
#endif
@ -3127,7 +3130,7 @@ void Buffer::SimpleDocBookOnePar(ostream & os, string & extra,
if (c == LyXParagraph::META_INSET) {
Inset * inset = par->GetInset(i);
#ifdef HAVE_SSTREAM
ostringstream ost;
std::ostringstream ost;
inset->DocBook(ost);
string tmp_out = ost.str().c_str();
#else

View File

@ -35,8 +35,6 @@
#include "support/filetools.h"
#include "lyx_gui_misc.h"
using std::ostream;
class LyXRC;
class TeXErrors;
class LaTeXFeatures;
@ -338,42 +336,42 @@ public:
TexRow texrow;
private:
///
void linuxDocHandleFootnote(ostream & os,
void linuxDocHandleFootnote(std::ostream & os,
LyXParagraph * & par, int const depth);
///
void DocBookHandleCaption(ostream & os, string & inner_tag,
void DocBookHandleCaption(std::ostream & os, string & inner_tag,
int const depth, int desc_on,
LyXParagraph * & par);
///
void DocBookHandleFootnote(ostream & os,
void DocBookHandleFootnote(std::ostream & os,
LyXParagraph * & par, int const depth);
///
void sgmlOpenTag(ostream & os, int depth,
void sgmlOpenTag(std::ostream & os, int depth,
string const & latexname) const;
///
void sgmlCloseTag(ostream & os, int depth,
void sgmlCloseTag(std::ostream & os, int depth,
string const & latexname) const;
///
void LinuxDocError(LyXParagraph * par, int pos, char const * message);
///
void SimpleLinuxDocOnePar(ostream & os, LyXParagraph * par,
void SimpleLinuxDocOnePar(std::ostream & os, LyXParagraph * par,
int desc_on, int const depth);
///
void SimpleDocBookOnePar(ostream &, string & extra,
void SimpleDocBookOnePar(std::ostream &, string & extra,
LyXParagraph * par, int & desc_on,
int const depth);
/// LinuxDoc.
void push_tag(ostream & os, char const * tag,
void push_tag(std::ostream & os, char const * tag,
int & pos, char stack[5][3]);
/// LinuxDoc.
void pop_tag(ostream & os, char const * tag,
void pop_tag(std::ostream & os, char const * tag,
int & pos, char stack[5][3]);
#if 0
///
void RoffAsciiTable(ostream &, LyXParagraph * par);
void RoffAsciiTable(std::ostream &, LyXParagraph * par);
#endif
/// is save needed

View File

@ -38,6 +38,7 @@
extern BufferView * current_view; // called too many times in this file...
using std::vector;
using std::find;
using std::endl;

View File

@ -21,8 +21,6 @@
#include "buffer.h"
#include "debug.h"
using std::vector;
/** A class to hold all the buffers in a structure
The point of this class is to hide from bufferlist what kind
of structure the buffers are stored in. Should be no concern for
@ -34,7 +32,7 @@ using std::vector;
class BufferStorage {
public:
///
typedef vector<Buffer *> Container;
typedef std::vector<Buffer *> Container;
///
typedef Container::iterator iterator;
///
@ -112,7 +110,7 @@ public:
/// Make a new file (buffer) using a template
Buffer * newFile(string const &, string);
/// returns a vector with all the buffers filenames
vector<string> getFileNames() const;
std::vector<string> getFileNames() const;
///
int unlockInset(UpdatableInset *);

View File

@ -25,6 +25,7 @@
#include "lyxrc.h"
#include "language.h"
using std::ostream;
using std::endl;
BufferParams::BufferParams()

View File

@ -25,8 +25,6 @@
#include "layout.h"
#include "support/block.h"
using std::ostream;
/**
This class contains all the parameters for this a buffer uses. Some
work needs to be done on this class to make it nice. Now everything
@ -113,7 +111,7 @@ public:
//@}
///
void writeFile(ostream &) const;
void writeFile(std::ostream &) const;
///
void useClassDefaults();

View File

@ -13,6 +13,7 @@
#include "debug.h"
using std::ifstream;
using std::pair;
using std::make_pair;
using std::endl;

View File

@ -11,9 +11,6 @@
#include "LString.h"
using std::map;
using std::pair;
///
class CharacterSet {
public:
@ -22,12 +19,12 @@ public:
///
string const & getName() const;
///
pair<bool, int> encodeString(string &) const;
std::pair<bool, int> encodeString(string &) const;
private:
///
string name_;
///
typedef map<string, unsigned char> Cdef;
typedef std::map<string, unsigned char> Cdef;
///
Cdef map_;
};

View File

@ -12,8 +12,6 @@
#include "debug.h"
using std::ostream;
/** These are all the lyxfunctions (as enums).
*/
enum kb_action {
@ -250,5 +248,5 @@ enum kb_action {
LFUN_LASTACTION /* this marks the end of the table */
};
ostream & operator<<(ostream &, kb_action);
std::ostream & operator<<(std::ostream &, kb_action);
#endif

View File

@ -16,6 +16,7 @@
#include <iomanip>
using std::ostream;
using std::setw;
using std::endl;

View File

@ -8,8 +8,6 @@
#include "LString.h"
#include "support/lstrings.h"
using std::ostream;
/** Ideally this should have been a namespace, but since we try to be
compilable on older C++ compilators too, we use a struct instead.
This is all the different debug levels that we have.
@ -71,10 +69,10 @@ struct Debug {
/** Display the tags and descriptions of the current debug level
of ds
*/
static void showLevel(ostream & o, type level);
static void showLevel(std::ostream & o, type level);
/** show all the possible tags that can be used for debugging */
static void showTags(ostream & o);
static void showTags(std::ostream & o);
};
@ -91,7 +89,7 @@ void operator|= (Debug::type & d1, Debug::type d2)
///
ostream & operator<<(ostream & o, Debug::type t);
std::ostream & operator<<(std::ostream & o, Debug::type t);
extern DebugStream lyxerr;

View File

@ -88,7 +88,15 @@ public:
}
private:
///
void add(uid_t ID) const {
void add(uid_t ID) const;
///
typedef map<uid_t, string> Users;
///
mutable Users users;
};
void UserCache::add(uid_t ID) const
{
string pszNewName;
struct passwd * pEntry;
@ -101,12 +109,7 @@ private:
// adds new node
users[ID] = pszNewName;
}
///
typedef map<uid_t, string> Users;
///
mutable Users users;
};
}
/// Group cache class definition
@ -123,7 +126,15 @@ public:
}
private:
///
void add(gid_t ID) const {
void add(gid_t ID) const;
///
typedef map<gid_t, string> Groups;
///
mutable Groups groups;
};
void GroupCache::add(gid_t ID) const
{
string pszNewName;
struct group * pEntry;
@ -134,12 +145,7 @@ private:
}
// adds new node
groups[ID] = pszNewName;
}
///
typedef map<gid_t, string> Groups;
///
mutable Groups groups;
};
}
// static instances
static UserCache lyxUserCache;

View File

@ -22,8 +22,6 @@
#include FORMS_H_LOCATION
#include "form1.h"
using std::vector;
/// LyXDirEntry internal structure definition
class LyXDirEntry
{
@ -81,7 +79,7 @@ private:
///
string pszInfoLine;
///
typedef vector<LyXDirEntry> DirEntries;
typedef std::vector<LyXDirEntry> DirEntries;
///
DirEntries direntries;
///

157
src/font.C Normal file
View File

@ -0,0 +1,157 @@
#include <config.h>
#include "font.h"
#include "FontLoader.h"
#include "lyxrc.h"
extern LyXRC lyxrc;
// namespace {
static inline
XFontStruct * getXFontstruct(LyXFont const & f)
{
return fontloader.load(f.family(), f.series(),
f.realShape(), f.size());
}
static inline
XID getFontID(LyXFont const & f)
{
return getXFontstruct(f)->fid;
}
// } // end of anon namespace
int lyxfont::maxAscent(LyXFont const & f)
{
return getXFontstruct(f)->ascent;
}
int lyxfont::maxDescent(LyXFont const & f)
{
return getXFontstruct(f)->descent;
}
int lyxfont::ascent(char c, LyXFont const & f)
{
XFontStruct * finfo = getXFontstruct(f);
unsigned int uc = static_cast<unsigned char>(c);
if (finfo->per_char
&& uc >= finfo->min_char_or_byte2
&& uc <= finfo->max_char_or_byte2)
return finfo->per_char[uc - finfo->min_char_or_byte2].ascent;
else
return finfo->ascent;
}
int lyxfont::descent(char c, LyXFont const & f)
{
XFontStruct * finfo = getXFontstruct(f);
unsigned int uc = static_cast<unsigned char>(c);
if (finfo->per_char
&& uc >= finfo->min_char_or_byte2
&& uc <= finfo->max_char_or_byte2)
return finfo->per_char[uc - finfo->min_char_or_byte2].descent;
else
return finfo->descent;
}
int lyxfont::lbearing(char c, LyXFont const & f)
{
XFontStruct * finfo = getXFontstruct(f);
unsigned int uc = static_cast<unsigned char>(c);
if (finfo->per_char
&& uc >= finfo->min_char_or_byte2
&& uc <= finfo->max_char_or_byte2)
return finfo->per_char[uc - finfo->min_char_or_byte2].lbearing;
else
return 0;
}
int lyxfont::rbearing(char c, LyXFont const & f)
{
XFontStruct * finfo = getXFontstruct(f);
unsigned int uc = static_cast<unsigned char>(c);
if (finfo->per_char
&& uc >= finfo->min_char_or_byte2
&& uc <= finfo->max_char_or_byte2)
return finfo->per_char[uc - finfo->min_char_or_byte2].rbearing;
else
return width(c, f);
}
int lyxfont::width(char c, LyXFont const & f)
{
if (f.realShape() != LyXFont::SMALLCAPS_SHAPE) {
return lyxrc.use_gui ? ::XTextWidth(getXFontstruct(f), &c, 1)
: 1;
} else {
LyXFont smallfont(f);
smallfont.decSize().decSize().setShape(LyXFont::UP_SHAPE);
if (islower(static_cast<unsigned char>(c))) {
c = toupper(c);
return ::XTextWidth(getXFontstruct(smallfont), &c, 1);
} else {
return ::XTextWidth(getXFontstruct(f), &c, 1);
}
}
}
int lyxfont::width(char const * s, int n, LyXFont const & f)
{
if (!lyxrc.use_gui)
return n;
if (f.realShape() != LyXFont::SMALLCAPS_SHAPE) {
return ::XTextWidth(getXFontstruct(f), s, n);
} else {
// emulate smallcaps since X doesn't support this
unsigned int result = 0;
char c;
LyXFont smallfont(f);
smallfont.decSize().decSize().setShape(LyXFont::UP_SHAPE);
for (int i = 0; i < n; ++i) {
c = s[i];
// when islower is a macro, the cast is needed (JMarc)
if (islower(static_cast<unsigned char>(c))) {
c = toupper(c);
result += ::XTextWidth(getXFontstruct(smallfont), &c, 1);
} else {
result += ::XTextWidth(getXFontstruct(f), &c, 1);
}
}
return result;
}
}
int lyxfont::signedWidth(string const & s, LyXFont const & f)
{
if (s.empty()) return 0;
if (s.c_str()[0] == '-')
return -width(s.c_str() + 1, s.length() - 1, f);
else
return width(s.c_str(), s.length(), f);
}
int lyxfont::XTextWidth(LyXFont const & f, char * str, int count)
{
return ::XTextWidth(getXFontstruct(f), str, count);
}
void lyxfont::XSetFont(Display * display, GC gc, LyXFont const & f)
{
::XSetFont(display, gc, getFontID(f));
}
//} // end of namespace font
//} // end of namespace lyx

77
src/font.h Normal file
View File

@ -0,0 +1,77 @@
// -*- C++ -*-
#ifndef FONT_H
#define FONT_H
#include <X11/Xlib.h>
#include "LString.h"
class LyXFont;
//namespace lyx {
//namespace font {
struct lyxfont {
static
int maxAscent(LyXFont const & f);
static
int maxDescent(LyXFont const & f);
static
int ascent(char c, LyXFont const & f);
static
int descent(char c, LyXFont const & f);
static
int lbearing(char c, LyXFont const & f);
static
int rbearing(char c, LyXFont const & f);
static
int width(char c, LyXFont const & f);
static
int width(char const * s, int n, LyXFont const & f);
static
int width(string const & s, LyXFont const & f) {
if (s.empty()) return 0;
return width(s.c_str(), s.length(), f);
}
static
int width(char const * s, LyXFont const & f) {
return width(s, strlen(s), f);
}
static
int signedWidth(string const & s, LyXFont const & f);
static
int XTextWidth(LyXFont const & f, char * str, int count);
static
void XSetFont(Display * display, GC gc, LyXFont const & f);
};
//} // end of namespace font
// import into namespace lyx
//using font::maxAscent;
//using font::maxDescent;
//using font::ascent;
//using font::descent;
//using font::lbearing;
//using font::rbearing;
//using font::width;
//using font::signedWidth;
//using font::XTextWidth;
//using font::XSetFont;
//} // end of namespace lyx
#endif

View File

@ -3,6 +3,8 @@
#ifndef FD_KeyMap_h_
#define FD_KeyMap_h_
#include FORMS_H_LOCATION
/** Callbacks, globals and object handlers **/
extern "C" void GraphicsCB(FL_OBJECT *, long);

View File

@ -44,8 +44,6 @@ libinsets_la_SOURCES = \
insetlof.h \
insetlot.C \
insetlot.h \
insetnumber.C \
insetnumber.h \
insetparent.C \
insetparent.h \
insetquotes.C \

View File

@ -42,15 +42,6 @@
#include <algorithm>
#include <vector>
using std::ofstream;
using std::ifstream;
using std::queue;
using std::list;
using std::vector;
using std::find;
using std::flush;
using std::endl;
#include "figinset.h"
#include "lyx.h"
#include "lyx_main.h"
@ -66,6 +57,18 @@ using std::endl;
#include "support/FileInfo.h"
#include "support/lyxlib.h"
#include "Painter.h"
#include "font.h"
using std::ostream;
using std::istream;
using std::ofstream;
using std::ifstream;
using std::queue;
using std::list;
using std::vector;
using std::find;
using std::flush;
using std::endl;
extern BufferView * current_view;
extern FL_OBJECT * figinset_canvas;
@ -1029,7 +1032,7 @@ void InsetFig::draw(Painter & pain, LyXFont const & f,
font.setFamily(LyXFont::SANS_FAMILY);
font.setSize(LyXFont::SIZE_FOOTNOTE);
string justname = OnlyFilename (fname);
pain.text(int(x + 8), baseline - font.maxAscent() - 4,
pain.text(int(x + 8), baseline - lyxfont::maxAscent(font) - 4,
justname, font);
font.setSize(LyXFont::SIZE_TINY);
@ -1188,6 +1191,12 @@ bool InsetFig::Deletable() const
}
char const * InsetFig::EditMessage() const
{
return _("Opened figure");
}
void InsetFig::Edit(BufferView * bv, int, int, unsigned int)
{
lyxerr.debug() << "Editing InsetFig." << endl;

View File

@ -14,8 +14,6 @@
#include "insets/lyxinset.h"
/* the rest is figure stuff */
using std::ostream;
struct Figref;
///
@ -35,20 +33,21 @@ public:
void draw(Painter &, LyXFont const & font,
int baseline, float & x) const;
///
void Write(ostream &) const;
void Write(std::ostream &) const;
///
void Read(LyXLex & lex);
///
int Latex(ostream &, signed char fragile, bool free_space) const;
int Latex(std::ostream &, signed char fragile, bool free_space) const;
///
int Linuxdoc(ostream &) const;
int Linuxdoc(std::ostream &) const;
///
int DocBook(ostream &) const;
int DocBook(std::ostream &) const;
/// Updates needed features for this inset.
void Validate(LaTeXFeatures & features) const;
/// what appears in the minibuffer when opening
const char * EditMessage() const { return _("Opened figure"); }
char const * EditMessage() const;
///
void Edit(BufferView *, int, int, unsigned int);
///

View File

@ -3,6 +3,8 @@
#ifndef FORM_GRAPHICS_H
#define FORM_GRAPHICS_H
#include FORMS_H_LOCATION
/** Callbacks, globals and object handlers **/
extern "C" void GraphicsCB(FL_OBJECT *, long);

View File

@ -71,6 +71,11 @@ LyXFont Inset::ConvertFont(LyXFont font)
}
char const * Inset::EditMessage() const
{
return _("Opened inset");
}
/* some stuff for inset locking */
void UpdatableInset::InsetButtonPress(BufferView *, int x, int y, int button)

View File

@ -21,6 +21,7 @@ using std::ifstream;
#include "lyxtext.h"
#include "support/filetools.h"
using std::ostream;
using std::endl;
extern BufferView * current_view;

View File

@ -18,8 +18,6 @@
#include "insetcommand.h"
using std::ostream;
class Buffer;
/** Used to insert citations
@ -74,7 +72,7 @@ public:
///
Inset * Clone() const { return new InsetBibKey(this); }
/// Currently \bibitem is used as a LyX2.x command, so we need this method.
void Write(ostream &) const;
void Write(std::ostream &) const;
///
virtual string getScreenLabel() const;
///
@ -132,7 +130,7 @@ public:
///
void Edit(BufferView *, int x, int y, unsigned int button);
///
int Latex(ostream &, signed char, bool) const;
int Latex(std::ostream &, signed char, bool) const;
///
string getKeys(char delim);
///

View File

@ -18,6 +18,7 @@
#include "debug.h"
#include "Painter.h"
using std::ostream;
using std::endl;

View File

@ -19,8 +19,6 @@
#include "lyxinset.h"
#include "LString.h"
using std::ostream;
// Created by Alejandro 970222
/** Used to insert a LaTeX command automatically
*
@ -43,17 +41,18 @@ public:
///
void draw(Painter &, LyXFont const &, int baseline, float & x) const;
///
void Write(ostream &) const;
void Write(std::ostream &) const;
/// Parse the command.
void scanCommand(string const & cmd);
/// Will not be used when lyxf3
void Read(LyXLex & lex);
///
virtual int Latex(ostream &, signed char fragile, bool free_spc) const;
virtual int Latex(std::ostream &,
signed char fragile, bool free_spc) const;
///
virtual int Linuxdoc(ostream &) const;
virtual int Linuxdoc(std::ostream &) const;
///
virtual int DocBook(ostream &) const;
virtual int DocBook(std::ostream &) const;
///
Inset * Clone() const;
///

View File

@ -18,6 +18,9 @@
#include "gettext.h"
#include "lyx_gui_misc.h" // CancelCloseBoxCB
#include "Painter.h"
#include "font.h"
using std::ostream;
/* Error, used for the LaTeX-Error Messages */
@ -48,7 +51,7 @@ int InsetError::ascent(Painter &, LyXFont const & font) const
{
LyXFont efont;
efont.setSize(font.size()).decSize();
return efont.maxAscent() + 1;
return lyxfont::maxAscent(efont) + 1;
}
@ -56,7 +59,7 @@ int InsetError::descent(Painter &, LyXFont const & font) const
{
LyXFont efont;
efont.setSize(font.size()).decSize();
return efont.maxDescent() + 1;
return lyxfont::maxDescent(efont) + 1;
}
@ -64,7 +67,7 @@ int InsetError::width(Painter &, LyXFont const & font) const
{
LyXFont efont;
efont.setSize(font.size()).decSize();
return 6 + efont.textWidth(_("Error"), strlen(_("Error")));
return 6 + lyxfont::width(_("Error"), efont);
}
@ -150,6 +153,12 @@ extern "C" void C_InsetError_CloseErrorCB(FL_OBJECT * ob, long data)
}
char const * InsetError::EditMessage() const
{
return _("Opened error");
}
void InsetError::Edit(BufferView *, int, int, unsigned int)
{
static int ow = 400, oh = 240;

View File

@ -21,8 +21,6 @@
#include "LString.h"
#include "gettext.h"
using std::ostream;
/** Used for error messages from LaTeX runs.
The edit-operation opens a
@ -45,19 +43,19 @@ public:
///
void draw(Painter &, LyXFont const & font, int baseline, float & x) const;
///
void Write(ostream &) const;
void Write(std::ostream &) const;
///
void Read(LyXLex & lex);
///
int Latex(ostream &, signed char fragile, bool free_spc) const;
int Latex(std::ostream &, signed char fragile, bool free_spc) const;
///
int Linuxdoc(ostream &) const;
int Linuxdoc(std::ostream &) const;
///
int DocBook(ostream &) const;
int DocBook(std::ostream &) const;
///
bool AutoDelete() const;
/// what appears in the minibuffer when opening
const char * EditMessage() const {return _("Opened error");}
char const * EditMessage() const;
///
void Edit(BufferView *, int x, int y, unsigned int button);
///

View File

@ -20,6 +20,7 @@
#include "buffer.h"
//#include "lyx_gui_misc.h"
using std::ostream;
InsetERT::InsetERT(Buffer * bf)
: InsetCollapsable(bf)
@ -50,6 +51,13 @@ void InsetERT::Write(ostream & os) const
WriteParagraphData(os);
}
char const * InsetERT::EditMessage() const
{
return _("Opened ERT Inset");
}
bool InsetERT::InsertInset(BufferView *, Inset *)
{
return false;

View File

@ -20,8 +20,6 @@
#include "insetcollapsable.h"
using std::ostream;
class Painter;
/** A colapsable text inset
@ -38,9 +36,9 @@ public:
///
Inset * Clone() const;
///
void Write(ostream &) const;
void Write(std::ostream &) const;
///
const char * EditMessage() const { return _("Opened ERT Inset");}
char const * EditMessage() const;
///
bool InsertInset(BufferView *, Inset *);
///

View File

@ -20,6 +20,7 @@
#include "lyxscreen.h"
#include "Painter.h"
using std::ostream;
InsetFoot::InsetFoot(Buffer * bf)
: InsetCollapsable(bf)

View File

@ -20,8 +20,6 @@
#include "insetcollapsable.h"
using std::ostream;
class Painter;
/** The footnote inset
@ -38,9 +36,9 @@ public:
///
Inset::Code LyxCode() const { return Inset::FOOT_CODE; }
///
int Latex(ostream &, signed char, bool fp) const;
int Latex(std::ostream &, signed char, bool fp) const;
///
void Write(ostream &) const;
void Write(std::ostream &) const;
///
void Read(LyXLex &);
///

View File

@ -22,6 +22,7 @@
#include "support/FileInfo.h"
#include "support/filetools.h"
using std::ostream;
using std::endl;
extern string system_lyxdir;
@ -204,7 +205,7 @@ int InsetGraphics::Latex(ostream & os,
string command("\\insetgraphics");
#ifdef HAVE_SSTREAM
ostringstream options;
std::ostringstream options;
#else
ostrstream options;
#endif

View File

@ -21,8 +21,6 @@
#include "vspace.h"
#include "insets/BoundingBox.h"
using std::ostream;
struct FD_Graphics;
///
@ -44,18 +42,18 @@ public:
///
EDITABLE Editable() const;
///
void Write(ostream &) const;
void Write(std::ostream &) const;
///
void Read(LyXLex & lex);
/** returns the number of rows (\n's) of generated tex code.
fragile != 0 means, that the inset should take care about
fragile commands by adding a \protect before.
*/
int Latex(ostream &, signed char fragile, bool free_spc) const;
int Latex(std::ostream &, signed char fragile, bool free_spc) const;
///
int Linuxdoc(ostream &) const;
int Linuxdoc(std::ostream &) const;
///
int DocBook(ostream &) const;
int DocBook(std::ostream &) const;
/// Updates needed features for this inset.
void Validate(LaTeXFeatures & features) const;

View File

@ -23,6 +23,7 @@
#include "layout.h"
#include "lyxfunc.h"
using std::ostream;
using std::endl;
extern BufferView * current_view;
@ -283,6 +284,12 @@ void InsetInclude::Read(LyXLex & lex)
}
bool InsetInclude::display() const
{
return !isInput();
}
string InsetInclude::getScreenLabel() const
{
string temp;
@ -303,6 +310,14 @@ string InsetInclude::getScreenLabel() const
}
void InsetInclude::setContents(string const & c)
{
InsetCommand::setContents(c);
filename = MakeAbsPath(contents,
OnlyPath(getMasterFilename()));
}
bool InsetInclude::loadIfNeeded() const
{
if (isNoLoad() || isVerb()) return false;

View File

@ -19,8 +19,6 @@
#include "buffer.h"
#include "support/filetools.h"
using std::ostream;
struct LaTeXFeatures;
// Created by AAS 970521
@ -56,24 +54,20 @@ public:
return IS_EDITABLE;
}
/// With lyx3 we won't overload these 3 methods
void Write(ostream &) const;
void Write(std::ostream &) const;
///
void Read(LyXLex &);
///
int Latex(ostream &, signed char fragile, bool free_spc) const;
int Latex(std::ostream &, signed char fragile, bool free_spc) const;
///
void Validate(LaTeXFeatures &) const;
/// Input inserts anything inside a paragraph, Display can give some visual feedback
bool display() const { return !(isInput()); }
bool display() const;
///
string getScreenLabel() const;
///
void setContents(string const & c) {
InsetCommand::setContents(c);
filename = MakeAbsPath(contents,
OnlyPath(getMasterFilename()));
}
void setContents(string const & c);
///
void setFilename(string const & n) { setContents(n); }
///

View File

@ -24,7 +24,9 @@
#include "buffer.h"
#include "support/lstrings.h"
#include "Painter.h"
#include "font.h"
using std::ostream;
using std::endl;
/* Info, used for the Info boxes */
@ -57,19 +59,19 @@ InsetInfo::~InsetInfo()
int InsetInfo::ascent(Painter &, LyXFont const & font) const
{
return font.maxAscent() + 1;
return lyxfont::maxAscent(font) + 1;
}
int InsetInfo::descent(Painter &, LyXFont const & font) const
{
return font.maxDescent() + 1;
return lyxfont::maxDescent(font) + 1;
}
int InsetInfo::width(Painter &, LyXFont const & font) const
{
return 6 + font.textWidth(_("Note"), strlen(_("Note")));
return 6 + lyxfont::width(_("Note"), font);
}
@ -177,6 +179,12 @@ extern "C" void C_InsetInfo_CloseInfoCB(FL_OBJECT * ob, long data)
}
char const * InsetInfo::EditMessage() const
{
return _("Opened note");
}
void InsetInfo::Edit(BufferView *bv, int, int, unsigned int)
{
static int ow = -1, oh;

View File

@ -20,8 +20,6 @@
#include FORMS_H_LOCATION
#include "LString.h"
using std::ostream;
/** Info. Handles the note insets.
This class handles the note insets. The edit operation bringes up
@ -47,17 +45,17 @@ public:
///
void draw(Painter &, LyXFont const &, int baseline, float & x) const;
///
void Write(ostream &) const;
void Write(std::ostream &) const;
///
void Read(LyXLex & lex);
///
int Latex(ostream &, signed char fragile, bool free_spc) const;
int Latex(std::ostream &, signed char fragile, bool free_spc) const;
///
int Linuxdoc(ostream &) const;
int Linuxdoc(std::ostream &) const;
///
int DocBook(ostream &) const;
int DocBook(std::ostream &) const;
/// what appears in the minibuffer when opening
const char * EditMessage() const {return _("Opened note");}
char const * EditMessage() const;
///
void Edit(BufferView *, int, int, unsigned int);
///

View File

@ -16,6 +16,8 @@
#include "insetlabel.h"
using std::ostream;
/* Label. Used to insert a label automatically */

View File

@ -19,8 +19,6 @@
#include "insetcommand.h"
#include "LString.h"
using std::ostream;
///
class InsetLabel : public InsetCommand {
public:
@ -41,11 +39,11 @@ public:
///
EDITABLE Editable() const { return NOT_EDITABLE; }
///
int Latex(ostream &, signed char fragile, bool free_spc) const;
int Latex(std::ostream &, signed char fragile, bool free_spc) const;
///
int Linuxdoc(ostream &) const;
int Linuxdoc(std::ostream &) const;
///
int DocBook(ostream &) const;
int DocBook(std::ostream &) const;
private:
/// This function escapes 8-bit characters
string escape(string const &) const;

View File

@ -19,7 +19,9 @@
#include "lyxrc.h"
#include "support/lstrings.h"
#include "Painter.h"
#include "font.h"
using std::ostream;
using std::endl;
/* LatexAccent. Proper handling of accented characters */
@ -261,13 +263,13 @@ int InsetLatexAccent::ascent(Painter &, LyXFont const & font) const
int max;
if (candisp) {
if (ic == ' ')
max = font.ascent('a');
max = lyxfont::ascent('a', font);
else
max = font.ascent(ic);
max = lyxfont::ascent(ic, font);
if (plusasc)
max += (font.maxAscent() + 3) / 3;
max += (lyxfont::maxAscent(font) + 3) / 3;
} else
max = font.maxAscent() + 4;
max = lyxfont::maxAscent(font) + 4;
return max;
}
@ -277,13 +279,13 @@ int InsetLatexAccent::descent(Painter &, LyXFont const & font) const
int max;
if (candisp) {
if (ic == ' ')
max = font.descent('a');
max = lyxfont::descent('a', font);
else
max = font.descent(ic);
max = lyxfont::descent(ic, font);
if (plusdesc)
max += 3;
} else
max = font.maxDescent() + 4;
max = lyxfont::maxDescent(font) + 4;
return max;
}
@ -291,21 +293,21 @@ int InsetLatexAccent::descent(Painter &, LyXFont const & font) const
int InsetLatexAccent::width(Painter &, LyXFont const & font) const
{
if (candisp)
return font.textWidth(&ic, 1);
return lyxfont::width(ic, font);
else
return font.stringWidth(contents) + 4;
return lyxfont::width(contents, font) + 4;
}
int InsetLatexAccent::Lbearing(LyXFont const & font) const
{
return font.lbearing(ic);
return lyxfont::lbearing(ic, font);
}
int InsetLatexAccent::Rbearing(LyXFont const & font) const
{
return font.rbearing(ic);
return lyxfont::rbearing(ic, font);
}
@ -373,7 +375,7 @@ void InsetLatexAccent::draw(Painter & pain, LyXFont const & font,
int y;
if (plusasc) {
// mark at the top
hg = font.maxDescent();
hg = lyxfont::maxDescent(font);
y = baseline - asc;
if (font.shape() == LyXFont::ITALIC_SHAPE)
@ -391,15 +393,15 @@ void InsetLatexAccent::draw(Painter & pain, LyXFont const & font,
pain.text(int(x), baseline, ic, font);
if (remdot) {
int tmpvar = baseline - font.ascent('i');
int tmpvar = baseline - lyxfont::ascent('i', font);
float tmpx = 0;
if (font.shape() == LyXFont::ITALIC_SHAPE)
tmpx += (8.0 * hg) / 10.0; // italic
lyxerr[Debug::KEY] << "Removing dot." << endl;
// remove the dot first
pain.fillRectangle(int(x + tmpx), tmpvar, wid,
font.ascent('i') -
font.ascent('x') - 1,
lyxfont::ascent('i', font) -
lyxfont::ascent('x', font) - 1,
LColor::background);
// the five lines below is a simple hack to
// make the display of accent 'i' and 'j'
@ -419,8 +421,8 @@ void InsetLatexAccent::draw(Painter & pain, LyXFont const & font,
pain.line(int(x2), int(y + hg),
int(x2 + hg35), y + hg35);
#else
pain.text(x2 - (font.rbearing(0xB4) - font.lbearing(0xB4)) / 2,
baseline - font.ascent(ic) - font.descent(0xB4) - (font.ascent(0xB4) + font.descent(0xB4)) / 2,
pain.text(x2 - (lyxfont::rbearing(0xB4, font) - lyxfont::lbearing(0xB4, font)) / 2,
baseline - lyxfont::ascent(ic, font) - lyxfont::descent(0xB4, font) - (lyxfont::ascent(0xB4, font) + lyxfont::descent(0xB4, font)) / 2,
char(0xB4), font);
#endif
break;
@ -431,8 +433,8 @@ void InsetLatexAccent::draw(Painter & pain, LyXFont const & font,
pain.line(int(x2), int(y + hg),
int(x2 - hg35), y + hg35);
#else
pain.text(x2 - (font.rbearing(0x60) - font.lbearing(0x60)) / 2,
baseline - font.ascent(ic) - font.descent(0x60) - (font.ascent(0x60) + font.descent(0x60)) / 2.0,
pain.text(x2 - (lyxfont::rbearing(0x60, font) - lyxfont::lbearing(0x60, font)) / 2,
baseline - lyxfont::ascent(ic, font) - lyxfont::descent(0x60, font) - (lyxfont::ascent(0x60, font) + lyxfont::descent(0x60, font)) / 2.0,
char(0x60), font);
#endif
break;
@ -445,8 +447,8 @@ void InsetLatexAccent::draw(Painter & pain, LyXFont const & font,
int(x2 + wid * 0.4),
int(y + hg));
#else
pain.text(x2 - (font.rbearing(0xAF) - font.lbearing(0xAF)) / 2,
baseline - font.ascent(ic) - font.descent(0xAF) - (font.ascent(0xAF) + font.descent(0xAF)),
pain.text(x2 - (lyxfont::rbearing(0xAF, font) - lyxfont::lbearing(0xAF, font)) / 2,
baseline - lyxfont::ascent(ic, font) - lyxfont::descent(0xAF, font) - (lyxfont::ascent(0xAF, font) + lyxfont::descent(0xAF, font)),
char(0xAF), font);
#endif
break;
@ -472,8 +474,8 @@ void InsetLatexAccent::draw(Painter & pain, LyXFont const & font,
pain.lines(xp, yp, 4);
#else
pain.text(x2 - (font.rbearing('~') - font.lbearing('~')) / 2,
baseline - font.ascent(ic) - font.descent('~') - (font.ascent('~') + font.descent('~')) / 2,
pain.text(x2 - (lyxfont::rbearing('~', font) - lyxfont::lbearing('~', font)) / 2,
baseline - lyxfont::ascent(ic, font) - lyxfont::descent('~', font) - (lyxfont::ascent('~', font) + lyxfont::descent('~', font)) / 2,
'~', font);
#endif
break;
@ -486,7 +488,7 @@ void InsetLatexAccent::draw(Painter & pain, LyXFont const & font,
int(x2 + wid * 0.4),
y + hg / 2.0);
#else
pain.text(x2 - (font.rbearing(0x5F) - font.lbearing(0x5F)) / 2, baseline,
pain.text(x2 - (lyxfont::rbearing(0x5F, font) - lyxfont::lbearing(0x5F, font)) / 2, baseline,
char(0x5F), font);
#endif
break;
@ -510,7 +512,7 @@ void InsetLatexAccent::draw(Painter & pain, LyXFont const & font,
pain.lines(xp, yp, 4);
#else
pain.text(x2 - (font.rbearing(0xB8) - font.lbearing(0xB8)) / 2, baseline,
pain.text(x2 - (lyxfont::rbearing(0xB8, font) - lyxfont::lbearing(0xB8, font)) / 2, baseline,
char(0xB8), font);
#endif
@ -522,8 +524,8 @@ void InsetLatexAccent::draw(Painter & pain, LyXFont const & font,
pain.arc(int(x2), y + hg35,
3, 3, 0, 360 * 64);
#else
pain.text(x2 - (font.rbearing('.') - font.lbearing('.')) / 2.0,
baseline + 3.0 / 2.0 * (font.ascent('.') + font.descent('.')),
pain.text(x2 - (lyxfont::rbearing('.', font) - lyxfont::lbearing('.', font)) / 2.0,
baseline + 3.0 / 2.0 * (lyxfont::ascent('.', font) + lyxfont::descent('.', font)),
'.', font);
#endif
break;
@ -537,8 +539,8 @@ void InsetLatexAccent::draw(Painter & pain, LyXFont const & font,
(hg + 3.0)/5.0,
0, 360 * 64);
#else
pain.text(x2 - (font.rbearing('.') - font.lbearing('.')) / 2.0,
baseline - font.ascent(ic) - font.descent('.') - (font.ascent('.') + font.descent('.')) / 2,
pain.text(x2 - (lyxfont::rbearing('.', font) - lyxfont::lbearing('.', font)) / 2.0,
baseline - lyxfont::ascent(ic, font) - lyxfont::descent('.', font) - (lyxfont::ascent('.', font) + lyxfont::descent('.', font)) / 2,
'.', font);
#endif
break;
@ -553,8 +555,8 @@ void InsetLatexAccent::draw(Painter & pain, LyXFont const & font,
#else
LyXFont tmpf(font);
tmpf.decSize().decSize();
pain.text(x2 - (tmpf.rbearing(0xB0) - tmpf.lbearing(0xB0)) / 2.0,
baseline - font.ascent(ic) - tmpf.descent(0xB0) - (tmpf.ascent(0xB0) + tmpf.descent(0xB0)) / 3.0,
pain.text(x2 - (lyxfont::rbearing(0xB0, tmpf) - lyxfont::lbearing(0xB0, tmpf)) / 2.0,
baseline - lyxfont::ascent(ic, font) - lyxfont::descent(0xB0, tmpf) - (lyxfont::ascent(0xB0, tmpf) + lyxfont::descent(0xB0, tmpf)) / 3.0,
char(0xB0), tmpf);
#endif
break;
@ -619,11 +621,11 @@ void InsetLatexAccent::draw(Painter & pain, LyXFont const & font,
pain.segments(xs1, ys1, xs2, ys2, 2);
#else
pain.text(x2 - (font.rbearing('´') - font.lbearing('´')),
baseline - font.ascent(ic) - font.descent('´') - (font.ascent('´') + font.descent('´')) / 2,
pain.text(x2 - (lyxfont::rbearing('´', font) - lyxfont::lbearing('´', font)),
baseline - lyxfont::ascent(ic, font) - lyxfont::descent('´', font) - (lyxfont::ascent('´', font) + lyxfont::descent('´', font)) / 2,
'´', font);
pain.text(x2,
baseline - font.ascent(ic) - font.descent('´') - (font.ascent('´') + font.descent('´')) / 2,
baseline - lyxfont::ascent(ic, font) - lyxfont::descent('´', font) - (lyxfont::ascent('´', font) + lyxfont::descent('´', font)) / 2,
'´', font);
#endif
break;
@ -650,8 +652,8 @@ void InsetLatexAccent::draw(Painter & pain, LyXFont const & font,
rad, rad, 0, 360*64);
}
#else
pain.text(x2 - (font.rbearing('¨') - font.lbearing('¨')) / 2,
baseline - font.ascent(ic) - font.descent('¨') - ( font.ascent('¨') + font.descent('¨')) / 2,
pain.text(x2 - (lyxfont::rbearing('¨', font) - lyxfont::lbearing('¨', font)) / 2,
baseline - lyxfont::ascent(ic, font) - lyxfont::descent('¨', font) - ( lyxfont::ascent('¨', font) + lyxfont::descent('¨', font)) / 2,
'¨', font);
#endif
break;
@ -668,8 +670,8 @@ void InsetLatexAccent::draw(Painter & pain, LyXFont const & font,
#else
LyXFont tmpf(font);
tmpf.decSize().decSize().decSize();
pain.text(x2 - (tmpf.rbearing(0x5E) - tmpf.lbearing(0x5E)) / 2,
baseline - font.ascent(ic) - tmpf.descent(0x5E) - (tmpf.ascent(0x5E) + tmpf.descent(0x5E)) / 3.0,
pain.text(x2 - (lyxfont::rbearing(0x5E, tmpf) - lyxfont::lbearing(0x5E, tmpf)) / 2,
baseline - lyxfont::ascent(ic, font) - lyxfont::descent(0x5E, tmpf) - (lyxfont::ascent(0x5E, tmpf) + lyxfont::descent(0x5E, tmpf)) / 3.0,
char(0x5E), tmpf);
#endif
break;

View File

@ -19,8 +19,6 @@
#include "LString.h"
#include "lyxlex.h"
using std::ostream;
/** Insertion of accents
Proper handling of accented characters.
@ -51,15 +49,15 @@ public:
bool DisplayISO8859_9(Painter &, LyXFont const & font,
int baseline, float & x) const;
///
void Write(ostream &) const;
void Write(std::ostream &) const;
///
void Read(LyXLex & lex);
///
int Latex(ostream &, signed char fragile, bool free_spc) const;
int Latex(std::ostream &, signed char fragile, bool free_spc) const;
///
int Linuxdoc(ostream &) const;
int Linuxdoc(std::ostream &) const;
///
int DocBook(ostream &) const;
int DocBook(std::ostream &) const;
///
bool Deletable() const;
///
@ -116,7 +114,7 @@ public:
LSLASH
};
private:
friend ostream & operator<<(ostream &, ACCENT_TYPES);
friend std::ostream & operator<<(std::ostream &, ACCENT_TYPES);
/// Check if we know the modifier and can display it ok on screen.
void checkContents();
///

View File

@ -14,17 +14,19 @@
#include <config.h>
#ifdef __GNUG__
#pragma implementation "insetloa.h"
#pragma implementation "insetlof.h"
#pragma implementation "insetlot.h"
#pragma implementation
#endif
#include "insetloa.h"
#include "insetlof.h"
#include "insetlot.h"
#include "LaTeXFeatures.h"
void InsetLOA::Validate(LaTeXFeatures & features) const
{
features.algorithm = true;
}
string InsetLOA::getScreenLabel() const
{
return _("List of Algorithms");
}

View File

@ -34,7 +34,7 @@ public:
///
Inset * Clone() const { return new InsetLOA(owner); }
///
string getScreenLabel() const { return _("List of Algorithms"); }
string getScreenLabel() const;
///
EDITABLE Editable() const {

View File

@ -1,16 +1,13 @@
//#include <config.h>
#include <config.h>
//#ifdef __GNUG__
//#pragma implementation
//#endif
#ifdef __GNUG__
#pragma implementation
#endif
//#include "insettof.h"
// InsetLOF::InsetLOF():
// InsetCommand("listoffigures")
// {
// }
#include "insetlof.h"
string InsetLOF::getScreenLabel() const
{
return _("List of Figures");
}

View File

@ -12,15 +12,15 @@
#ifndef INSET_LOF_H
#define INSET_LOF_H
#ifdef __GNUG__
#pragma interface
#endif
#include "insetcommand.h"
#include "gettext.h"
// Created by Lgb 970527
#ifdef __GNUG__
#pragma interface
#endif
/** Used to insert table of contents
*/
class InsetLOF : public InsetCommand {
@ -32,7 +32,7 @@ public:
///
Inset * Clone() const { return new InsetLOF(owner); }
///
string getScreenLabel() const { return _("List of Figures"); }
string getScreenLabel() const;
///
EDITABLE Editable() const {

View File

@ -1,16 +1,14 @@
//#include <config.h>
#include <config.h>
//#ifdef __GNUG__
//#pragma implementation
//#endif
#ifdef __GNUG__
#pragma implementation
#endif
//#include "insetlot.h"
// InsetLOT::InsetLOT()
// : InsetCommand("listoftables")
// {
// }
#include "insetlot.h"
string InsetLOT::getScreenLabel() const
{
return _("List of Tables");
}

View File

@ -32,7 +32,7 @@ public:
///
Inset * Clone() const { return new InsetLOT(owner); }
///
string getScreenLabel() const { return _("List of Tables"); }
string getScreenLabel() const;
///
EDITABLE Editable() const {

View File

@ -24,6 +24,7 @@
#include "lyxfunc.h"
#include "commandtags.h"
using std::ostream;
InsetParent::InsetParent(string const & fn, Buffer * owner)
: InsetCommand("lyxparent")
@ -35,6 +36,12 @@ InsetParent::InsetParent(string const & fn, Buffer * owner)
}
string InsetParent::getScreenLabel() const
{
return string(_("Parent:")) + getContents();
}
void InsetParent::Edit(BufferView * bv, int, int, unsigned int)
{
bv->owner()->getLyXFunc()->

View File

@ -18,8 +18,6 @@
#include "insetcommand.h"
#include "gettext.h"
using std::ostream;
class Buffer;
/** Reference to the parent document.
@ -34,13 +32,11 @@ public:
///
InsetParent(string const & fn, Buffer * owner = 0);
///
int Latex(ostream &, signed char fragile, bool free_spc) const;
int Latex(std::ostream &, signed char fragile, bool free_spc) const;
///
Inset * Clone() const { return new InsetParent(getContents()); }
///
string getScreenLabel() const {
return string(_("Parent:")) + getContents();
}
string getScreenLabel() const;
///
void Edit(BufferView *, int, int, unsigned int);
///

View File

@ -23,7 +23,9 @@
#include "LaTeXFeatures.h"
#include "support/lstrings.h"
#include "Painter.h"
#include "font.h"
using std::ostream;
using std::endl;
// Quotes. Used for the various quotes. German, English, French,
@ -163,13 +165,13 @@ string InsetQuotes::DispString() const
int InsetQuotes::ascent(Painter &, LyXFont const & font) const
{
return font.maxAscent();
return lyxfont::maxAscent(font);
}
int InsetQuotes::descent(Painter &, LyXFont const & font) const
{
return font.maxDescent();
return lyxfont::maxDescent(font);
}
@ -180,11 +182,11 @@ int InsetQuotes::width(Painter &, LyXFont const & font) const
for (string::size_type i = 0; i < text.length(); ++i) {
if (text[i] == ' ')
w += font.width('i');
w += lyxfont::width('i', font);
else if (i == 0 || text[i] != text[i-1])
w += font.width(text[i]);
w += lyxfont::width(text[i], font);
else
w += font.width(',');
w += lyxfont::width(',', font);
}
return w;

View File

@ -18,8 +18,6 @@
#include "lyxinset.h"
using std::ostream;
class BufferParams;
struct LaTeXFeatures;
@ -83,15 +81,15 @@ public:
///
LyXFont ConvertFont(LyXFont font);
///
void Write(ostream &) const;
void Write(std::ostream &) const;
///
void Read(LyXLex & lex);
///
int Latex(ostream &, signed char fragile, bool free_spc) const;
int Latex(std::ostream &, signed char fragile, bool free_spc) const;
///
int Linuxdoc(ostream &) const;
int Linuxdoc(std::ostream &) const;
///
int DocBook(ostream &) const;
int DocBook(std::ostream &) const;
///
void Validate(LaTeXFeatures &) const;
///

View File

@ -16,6 +16,8 @@
#include "commandtags.h"
#include "gettext.h"
using std::ostream;
extern BufferView * current_view;

View File

@ -18,8 +18,6 @@
#include "insetcommand.h"
#include "buffer.h"
using std::ostream;
struct LaTeXFeatures;
/** The reference inset
@ -63,11 +61,11 @@ public:
///
void gotoLabel();
///
int Latex(ostream &, signed char fragile, bool free_spc) const;
int Latex(std::ostream &, signed char fragile, bool free_spc) const;
///
int Linuxdoc(ostream &) const;
int Linuxdoc(std::ostream &) const;
///
int DocBook(ostream &) const;
int DocBook(std::ostream &) const;
private:
/// This function escapes 8-bit characters
string escape(string const &) const;

View File

@ -17,7 +17,9 @@
#include "debug.h"
#include "LaTeXFeatures.h"
#include "Painter.h"
#include "font.h"
using std::ostream;
using std::max;
InsetSpecialChar::InsetSpecialChar(Kind k)
@ -27,13 +29,13 @@ InsetSpecialChar::InsetSpecialChar(Kind k)
int InsetSpecialChar::ascent(Painter &, LyXFont const & font) const
{
return font.maxAscent();
return lyxfont::maxAscent(font);
}
int InsetSpecialChar::descent(Painter &, LyXFont const & font) const
{
return font.maxDescent();
return lyxfont::maxDescent(font);
}
@ -42,22 +44,22 @@ int InsetSpecialChar::width(Painter &, LyXFont const & font) const
switch (kind) {
case HYPHENATION:
{
int w = font.textWidth("-", 1);
int w = lyxfont::width('-', font);
if (w > 5)
w -= 2; // to make it look shorter
return w;
}
case END_OF_SENTENCE:
{
return font.textWidth(".", 1);
return lyxfont::width('.', font);
}
case LDOTS:
{
return font.textWidth(". . .", 5);
return lyxfont::width(". . .", font);
}
case MENU_SEPARATOR:
{
return font.textWidth(" x ", 3);
return lyxfont::width(" x ", font);
}
#if 0
case NEWLINE:
@ -66,7 +68,7 @@ int InsetSpecialChar::width(Painter &, LyXFont const & font) const
#endif
case PROTECTED_SEPARATOR:
{
return font.textWidth("x", 1);
return lyxfont::width('x', font);
}
}
@ -103,9 +105,9 @@ void InsetSpecialChar::draw(Painter & pain, LyXFont const & f,
case MENU_SEPARATOR:
{
// A triangle the width and height of an 'x'
int w = font.textWidth("x", 1);
int ox = font.textWidth(" ", 1) + int(x);
int h = font.ascent('x');
int w = lyxfont::width('x', font);
int ox = lyxfont::width(' ', font) + int(x);
int h = lyxfont::ascent('x', font);
int xp[4], yp[4];
xp[0] = ox; yp[0] = baseline;
@ -125,7 +127,7 @@ void InsetSpecialChar::draw(Painter & pain, LyXFont const & f,
case PROTECTED_SEPARATOR:
{
float w = width(pain, font);
int h = font.ascent('x');
int h = lyxfont::ascent('x', font);
int xp[4], yp[4];
xp[0] = int(x);

View File

@ -18,8 +18,6 @@
#include "lyxinset.h"
#include "LString.h"
using std::ostream;
struct LaTeXFeatures;
/// Used to insert special chars
@ -57,15 +55,15 @@ public:
///
void draw(Painter &, LyXFont const &, int baseline, float & x) const;
///
void Write(ostream &) const;
void Write(std::ostream &) const;
/// Will not be used when lyxf3
void Read(LyXLex & lex);
///
int Latex(ostream &, signed char fragile, bool free_spc) const;
int Latex(std::ostream &, signed char fragile, bool free_spc) const;
///
int Linuxdoc(ostream &) const;
int Linuxdoc(std::ostream &) const;
///
int DocBook(ostream &) const;
int DocBook(std::ostream &) const;
///
Inset * Clone() const;
///

View File

@ -13,9 +13,6 @@
#include <fstream>
#include <algorithm>
using std::ifstream;
using std::min;
using std::max;
#include <cstdlib>
@ -54,6 +51,12 @@ using std::max;
#include "support/LAssert.h"
#include "lyxtext.h"
#include "lyxcursor.h"
#include "font.h"
using std::ostream;
using std::ifstream;
using std::min;
using std::max;
extern unsigned char getCurrentTextClass(Buffer *);
@ -164,7 +167,7 @@ int InsetText::ascent(Painter & pain, LyXFont const & font) const
}
if (maxAscent)
return maxAscent;
return font.maxAscent();
return lyxfont::maxAscent(font);
}
@ -176,7 +179,7 @@ int InsetText::descent(Painter & pain, LyXFont const & font) const
}
if (maxDescent)
return maxDescent;
return font.maxDescent();
return lyxfont::maxDescent(font);
}
@ -243,7 +246,7 @@ void InsetText::drawRowSelection(Painter & pain, int startpos, int endpos,
Inset const * tmpinset = par->GetInset(p);
x += tmpinset->width(pain, font);
} else {
x += pain.width(ch,font);
x += lyxfont::width(ch, font);
}
}
if (p == s_start)
@ -271,8 +274,8 @@ void InsetText::drawRowText(Painter & pain, int startpos, int endpos,
// skip for now
} else if (par->IsNewline(p)) {
// Draw end-of-line marker
int wid = font.width('n');
int asc = font.maxAscent();
int wid = lyxfont::width('n', font);
int asc = lyxfont::maxAscent(font);
int y = baseline;
int xp[3], yp[3];
@ -304,7 +307,7 @@ void InsetText::drawRowText(Painter & pain, int startpos, int endpos,
tmpinset->draw(pain, font, baseline, x);
} else {
pain.text(int(x), baseline, ch, font);
x += pain.width(ch,font);
x += lyxfont::width(ch, font);
}
}
}
@ -705,7 +708,7 @@ int InsetText::SingleWidth(Painter & pain, LyXParagraph * par, int pos) const
char c = par->GetChar(pos);
if (IsPrintable(c)) {
return font.width(c);
return lyxfont::width(c, font);
} else if (c == LyXParagraph::META_INSET) {
Inset const * tmpinset = par->GetInset(pos);
if (tmpinset)
@ -716,7 +719,7 @@ int InsetText::SingleWidth(Painter & pain, LyXParagraph * par, int pos) const
c = ' ';
else if (IsNewlineChar(c))
c = 'n';
return font.width(c);
return lyxfont::width(c, font);
}
@ -735,8 +738,8 @@ void InsetText::SingleHeight(Painter & pain, LyXParagraph * par,int pos,
desc = tmpinset->descent(pain, font);
}
} else {
asc = font.maxAscent();
desc = font.maxDescent();
asc = lyxfont::maxAscent(font);
desc = lyxfont::maxDescent(font);
}
return;
}
@ -851,8 +854,8 @@ void InsetText::ToggleInsetCursor(BufferView * bv)
LyXFont font = GetFont(par, actpos);
int asc = font.maxAscent();
int desc = font.maxDescent();
int asc = lyxfont::maxAscent(font);
int desc = lyxfont::maxDescent(font);
if (cursor_visible)
bv->hideLockedInsetCursor();
@ -867,8 +870,8 @@ void InsetText::ShowInsetCursor(BufferView * bv)
if (!cursor_visible) {
LyXFont font = GetFont(par, actpos);
int asc = font.maxAscent();
int desc = font.maxDescent();
int asc = lyxfont::maxAscent(font);
int desc = lyxfont::maxDescent(font);
bv->fitLockedInsetCursor(cx, cy, asc, desc);
bv->showLockedInsetCursor(cx, cy, asc, desc);
cursor_visible = true;

View File

@ -23,9 +23,6 @@
#include "LString.h"
//#include "buffer.h"
using std::ostream;
using std::vector;
class Painter;
class BufferView;
class Buffer;
@ -50,7 +47,7 @@ public:
///
void Read(LyXLex &);
///
void Write(ostream &) const;
void Write(std::ostream &) const;
///
int ascent(Painter &, LyXFont const &) const;
///
@ -80,11 +77,11 @@ public:
///
UpdatableInset::RESULT LocalDispatch(BufferView *, int, string const &);
///
int Latex(ostream &, signed char, bool free_spc) const;
int Latex(std::ostream &, signed char, bool free_spc) const;
///
int Linuxdoc(ostream &) const { return 0; }
int Linuxdoc(std::ostream &) const { return 0; }
///
int DocBook(ostream &) const { return 0; }
int DocBook(std::ostream &) const { return 0; }
///
void Validate(LaTeXFeatures & features) const;
///
@ -110,7 +107,7 @@ protected:
///
void UpdateLocal(BufferView *, bool);
///
void WriteParagraphData(ostream &) const;
void WriteParagraphData(std::ostream &) const;
///
void resetPos(BufferView *);
///
@ -219,7 +216,7 @@ private:
int baseline;
};
///
typedef vector<row_struct> RowList;
typedef std::vector<row_struct> RowList;
///
mutable RowList rows;
InsetText & operator = (InsetText const & it) {

View File

@ -12,6 +12,15 @@
#include "LyXView.h"
#include "BufferView.h"
using std::ostream;
string InsetTOC::getScreenLabel() const
{
return _("Table of Contents");
}
void InsetTOC::Edit(BufferView * bv, int, int, unsigned int)
{
bv->owner()->getLyXFunc()->Dispatch(LFUN_TOCVIEW);

View File

@ -19,8 +19,6 @@
#include "insetcommand.h"
#include "gettext.h"
using std::ostream;
class Buffer;
/** Used to insert table of contents
@ -34,7 +32,7 @@ public:
///
Inset * Clone() const { return new InsetTOC(owner); }
///
string getScreenLabel() const { return _("Table of Contents"); }
string getScreenLabel() const;
/// On edit, we open the TOC pop-up
void Edit(BufferView * bv, int, int, unsigned int);
///
@ -46,9 +44,9 @@ public:
///
Inset::Code LyxCode() const { return Inset::TOC_CODE; }
///
int Linuxdoc(ostream &) const;
int Linuxdoc(std::ostream &) const;
///
int DocBook(ostream &) const;
int DocBook(std::ostream &) const;
private:
///
Buffer * owner;

View File

@ -14,6 +14,7 @@
#include "LaTeXFeatures.h"
#include "lyx_gui_misc.h" // CancelCloseBoxCB
using std::ostream;
InsetUrl::InsetUrl(string const & cmd)
: fd_form_url(0)
@ -109,6 +110,12 @@ extern "C" void C_InsetUrl_CloseUrlCB(FL_OBJECT * ob, long data)
}
char const * InsetUrl::EditMessage() const
{
return _("Opened Url");
}
void InsetUrl::Edit(BufferView * bv, int, int, unsigned int)
{
static int ow = -1, oh;

View File

@ -19,8 +19,6 @@
#include "buffer.h"
#include "form_url.h"
using std::ostream;
struct LaTeXFeatures;
/** The url inset
@ -60,7 +58,7 @@ public:
return IS_EDITABLE;
}
///
const char * EditMessage() const {return _("Opened Url");}
char const * EditMessage() const;
///
bool display() const { return false; }
///
@ -72,11 +70,11 @@ public:
///
void gotoLabel();
///
int Latex(ostream &, signed char fragile, bool free_spc) const;
int Latex(std::ostream &, signed char fragile, bool free_spc) const;
///
int Linuxdoc(ostream &) const;
int Linuxdoc(std::ostream &) const;
///
int DocBook(ostream &) const;
int DocBook(std::ostream &) const;
///
static void CloseUrlCB(FL_OBJECT *, long data);
private:

View File

@ -16,12 +16,12 @@
#pragma interface
#endif
#include <X11/Xlib.h>
#include "gettext.h"
#include "lyxfont.h"
#include "lyxlex.h"
using std::ostream;
class Painter;
class Buffer;
class BufferView;
@ -29,6 +29,7 @@ class BufferView;
struct LaTeXFeatures;
/// Insets
class Inset {
public:
@ -114,7 +115,7 @@ public:
///
virtual LyXFont ConvertFont(LyXFont font);
/// what appears in the minibuffer when opening
virtual const char * EditMessage() const {return _("Opened inset");}
virtual const char * EditMessage() const;
///
virtual void Edit(BufferView *, int x, int y, unsigned int button);
///
@ -124,7 +125,7 @@ public:
///
virtual bool AutoDelete() const;
///
virtual void Write(ostream &) const = 0;
virtual void Write(std::ostream &) const = 0;
///
virtual void Read(LyXLex & lex) = 0;
/** returns the number of rows (\n's) of generated tex code.
@ -133,13 +134,13 @@ public:
If the freee_spc (freespacing) variable is set, then this inset
is in a free-spacing paragraph.
*/
virtual int Latex(ostream &, signed char fragile,
virtual int Latex(std::ostream &, signed char fragile,
bool free_spc) const = 0;
///
virtual int Linuxdoc(ostream &) const = 0;
virtual int Linuxdoc(std::ostream &) const = 0;
///
virtual int DocBook(ostream &) const = 0;
virtual int DocBook(std::ostream &) const = 0;
/// Updates needed features for this inset.
virtual void Validate(LaTeXFeatures & features) const;
///

View File

@ -6,6 +6,8 @@
#ifndef INTL_H
#define INTL_H
#include FORMS_H_LOCATION
#ifdef __GNUG__
#pragma interface
#endif

View File

@ -17,8 +17,6 @@
#include "LString.h"
using std::list;
class kb_sequence;
/// Defines key maps and actions for key sequences
@ -71,7 +69,7 @@ private:
return table.empty();
}
///
typedef list<kb_key> Table;
typedef std::list<kb_key> Table;
///
Table table;
};

View File

@ -9,13 +9,16 @@ Language const * default_language;
Language ignore_lang = {"ignore", "Ignore", false};
Language const * ignore_language = &ignore_lang;
///
class LangInit {
public:
///
LangInit() {
if (!init) initL();
init = true;
}
private:
///
void newLang(string const & l, string const & d, bool rtl) {
Language lang;
lang.lang = l;
@ -23,7 +26,15 @@ private:
lang.RightToLeft = rtl;
languages[l] = lang;
}
void initL() {
///
void initL();
///
static bool init;
};
void LangInit::initL()
{
newLang("afrikaans", N_("Afrikaans"), false);
newLang("american", N_("American"), false);
newLang("arabic", N_("Arabic"), true);
@ -66,9 +77,9 @@ private:
newLang("usorbian", N_("Usorbian"), false);
newLang("welsh", N_("Welsh"), false);
default_language = &languages["american"];
}
static bool init;
};
}
static
LangInit langinit;

View File

@ -5,15 +5,13 @@
#include <map>
#include "LString.h"
using std::map;
struct Language {
string lang;
string display;
bool RightToLeft;
};
typedef map<string, Language> Languages;
typedef std::map<string, Language> Languages;
extern Languages languages;
extern Language const * default_language;
extern Language const * ignore_language;

View File

@ -20,8 +20,6 @@
#include "LString.h"
using std::deque;
/** The latest documents loaded
This class takes care of the last .lyx files used by the LyX user. It
both reads and writes this information to a file. The number of files
@ -31,7 +29,7 @@ class LastFiles
{
public:
///
typedef deque<string> Files;
typedef std::deque<string> Files;
/**@name Constructors and Deconstructors */
//@{

View File

@ -24,6 +24,7 @@
#include "gettext.h"
#include "support/LAssert.h"
using std::pair;
using std::make_pair;
using std::sort;
using std::endl;

View File

@ -22,10 +22,6 @@
#include <vector>
using std::ostream;
using std::vector;
using std::pair;
/// Reads the style files
extern void LyXSetStyle();
@ -357,7 +353,7 @@ private:
class LyXTextClass {
public:
///
typedef vector<LyXLayout> LayoutList;
typedef std::vector<LyXLayout> LayoutList;
///
typedef LayoutList::const_iterator const_iterator;
///
@ -513,7 +509,7 @@ void operator|=(LyXTextClass::Provides & p1, LyXTextClass::Provides p2)
///
inline
ostream & operator<<(ostream & os, LyXTextClass::PageSides p)
std::ostream & operator<<(std::ostream & os, LyXTextClass::PageSides p)
{
switch (p) {
case LyXTextClass::OneSide:
@ -531,7 +527,7 @@ ostream & operator<<(ostream & os, LyXTextClass::PageSides p)
class LyXTextClassList {
public:
///
typedef vector<LyXTextClass> ClassList;
typedef std::vector<LyXTextClass> ClassList;
///
typedef ClassList::const_iterator const_iterator;
///
@ -546,7 +542,7 @@ public:
LyXTextClass::size_type layout) const;
/// Gets layout number from textclass number and layout name
pair<bool, LyXTextClass::size_type>
std::pair<bool, LyXTextClass::size_type>
NumberOfLayout(size_type textclass,
string const & name) const;
@ -558,7 +554,7 @@ public:
/** Gets textclass number from name.
Returns -1 if textclass name does not exist
*/
pair<bool, size_type>
std::pair<bool, size_type>
NumberOfClass(string const & textclass) const;
///

Some files were not shown because too many files have changed in this diff Show More