more changes, read the Changelog

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@857 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2000-07-04 19:16:35 +00:00
parent 729f944d88
commit 9468952780
42 changed files with 591 additions and 414 deletions

View File

@ -1,3 +1,75 @@
2000-07-04 Lars Gullik Bjønnes <larsbj@lyx.org>
* src/mathed/math_iter.h: remove empty destructor
* src/mathed/math_cursor.h: remove empty destructor
* src/insets/lyxinset.h: add THEOREM_CODE
* src/insets/insettheorem.[Ch]: new files
* src/insets/insetminipage.C: (InsertInset): remove
* src/insets/insetmarginal.C: inherit from InsetFootLike instead
of InsetCollapsable
(InsertInset): remove
* src/insets/insetlist.C: (InsertList): remove
* src/insets/insetfootlike.[Ch]: new files
* src/insets/insetfoot.C: inherit from InsetFootLike instead of
InsetCollapsable.
(Write): remove
(InsertInset): ditto
* src/insets/insetert.C: remove include Painter.h, reindent
(InsertInset): move to header
* src/insets/insetcollapsable.h: remove explicit from default
contructor, remove empty destructor, add InsertInset
* src/insets/insetcollapsable.C (InsertInset): new func
* src/insets/Makefile.am (libinsets_la_SOURCES): add new files
* src/vspace.h: add explicit to constructor
* src/paragraph.C (SimpleTeXSpecialChars): use \, instead of
\textcompwordmark, please test this.
* src/lyxrc.C: set ascii_linelen to 65 by default
* src/lyxfunc.C (Dispatch): handle LFUN_INSET_THEOREM
* src/commandtags.h: add LFUN_INSET_THEOREM
* src/buffer.C (parseSingleLyXformat2Token): handle insettheorem
(makeLinuxDocFile): remove _some_ of the nice logic
(makeDocBookFile): ditto
* src/Painter.[Ch]: (~Painter): removed
* src/LyXAction.C (init): entry for insettheorem added
* src/LaTeX.C: get rid of the all_files array, and the TEX_FILES
enum
(deplog): code to detect files generated by LaTeX, needs testing
(deptex): removed
2000-07-03 Lars Gullik Bjønnes <larsbj@lyx.org>
* src/FloatList.[Ch]: moved inlines out of line to FloatList.C
2000-07-02 Lars Gullik Bjønnes <larsbj@lyx.org>
* src/LaTeX.C (deplog): Add a check for files that are going to be
created by the first latex run, part of the project to remove the
all_files array.
* src/LaTeX.[Ch]: Patch from Baruch to add hebrew table of
contents to the extension list.
2000-07-04 Juergen Vigna <jug@sad.it>
* src/text.C (NextBreakPoint): added support for needFullRow()

View File

@ -1,5 +1,60 @@
#include <config.h>
#ifdef __GNUG__
#pragma implementation
#endif
#include "FloatList.h"
FloatList::FloatList()
{
// Insert the latex builtin float-types
Floating table;
table.type = "table";
table.placement = "";
table.ext = "lot";
table.within = "";
table.style = "";
table.name = "";
table.builtin = true;
list[table.type] = table;
Floating figure;
figure.type = "figure";
figure.placement = "";
figure.ext = "lof";
figure.within = "";
figure.style = "";
figure.name = "";
figure.builtin = true;
list[figure.type] = figure;
// And we add algorithm too since LyX has
// supported that for a long time
Floating algorithm;
algorithm.type = "algorithm";
algorithm.placement = "htbp";
algorithm.ext = "loa";
algorithm.within = "";
algorithm.style = "ruled";
algorithm.name = "Algorithm";
algorithm.builtin = false;
list[algorithm.type] = algorithm;
}
void FloatList::newFloat(Floating const & fl)
{
list[fl.type] = fl;
}
string FloatList::defaultPlacement(string const & t) const
{
List::const_iterator cit = list.find(t);
if (cit != list.end())
return (*cit).second.placement;
return string();
}
// The global floatlist
FloatList floatList;

View File

@ -27,50 +27,11 @@ public:
///
typedef std::map<string, Floating> List;
///
FloatList() {
// Insert the latex builtin float-types
Floating table;
table.type = "table";
table.placement = "";
table.ext = "lot";
table.within = "";
table.style = "";
table.name = "";
table.builtin = true;
list[table.type] = table;
Floating figure;
figure.type = "figure";
figure.placement = "";
figure.ext = "lof";
figure.within = "";
figure.style = "";
figure.name = "";
figure.builtin = true;
list[figure.type] = figure;
// And we add algorithm too since LyX has
// supported that for a long time
Floating algorithm;
algorithm.type = "algorithm";
algorithm.placement = "htbp";
algorithm.ext = "loa";
algorithm.within = "";
algorithm.style = "ruled";
algorithm.name = "Algorithm";
algorithm.builtin = false;
list[algorithm.type] = algorithm;
}
FloatList();
///
void newFloat(Floating const & fl) {
list[fl.type] = fl;
}
void newFloat(Floating const & fl);
///
string defaultPlacement(string const & t) const {
List::const_iterator cit = list.find(t);
if (cit != list.end())
return (*cit).second.placement;
return string();
}
string defaultPlacement(string const & t) const;
private:
///
List list;

View File

@ -51,29 +51,6 @@ using std::endl;
extern BufferList bufferlist;
struct texfile_struct {
LaTeX::TEX_FILES file;
char const * extension;
};
static
const texfile_struct all_files[] = {
{ LaTeX::AUX, ".aux"},
{ LaTeX::BBL, ".bbl"},
{ LaTeX::DVI, ".dvi"},
{ LaTeX::GLO, ".glo"},
{ LaTeX::IDX, ".idx"},
{ LaTeX::IND, ".ind"},
{ LaTeX::LOF, ".lof"},
{ LaTeX::LOA, ".loa"},
{ LaTeX::LOG, ".log"},
{ LaTeX::LOT, ".lot"},
{ LaTeX::TOC, ".toc"},
{ LaTeX::LTX, ".ltx"},
{ LaTeX::TEX, ".tex"}
};
/*
* CLASS TEXERRORS
*/
@ -92,8 +69,6 @@ void TeXErrors::insertError(int line, string const & error_desc,
LaTeX::LaTeX(string const & latex, string const & f, string const & p)
: cmd(latex), file(f), path(p)
{
tex_files = NO_FILES;
file_count = sizeof(all_files) / sizeof(texfile_struct);
num_errors = 0;
depfile = file + ".dep";
}
@ -213,7 +188,6 @@ int LaTeX::run(TeXErrors & terr, MiniBuffer * minib)
// update the dependencies.
deplog(head); // reads the latex log
deptex(head); // checks for latex files
head.update();
// 0.5
@ -622,7 +596,10 @@ void LaTeX::deplog(DepTable & head)
LRegex reg1(")* *\\(([^ ]+).*");
LRegex reg2("File: ([^ ]+).*");
LRegex reg3("No file ([^ ]+)\\..*");
LRegex reg4("\\\\openout[0-9]+.*=.*`([^ ]+)'\\..*");
LRegex unwanted("^.*\\.(aux|log|dvi|bbl|ind|glo)$");
ifstream ifs(logfile.c_str());
while (ifs) {
// Ok, the scanning of files here is not sufficient.
@ -643,6 +620,14 @@ void LaTeX::deplog(DepTable & head)
LRegex::SubMatches const & sub = reg2.exec(token);
foundfile = LSubstring(token, sub[1].first,
sub[1].second);
} else if (reg3.exact_match(token)) {
LRegex::SubMatches const & sub = reg3.exec(token);
foundfile = LSubstring(token, sub[1].first,
sub[1].second);
} else if (reg4.exact_match(token)) {
LRegex::SubMatches const & sub = reg4.exec(token);
foundfile = LSubstring(token, sub[1].first,
sub[1].second);
} else {
continue;
}
@ -672,7 +657,7 @@ void LaTeX::deplog(DepTable & head)
// (2) foundfile is in the tmpdir
// insert it into head
if (FileInfo(OnlyFilename(foundfile)).exist()) {
if (suffixIs(foundfile, ".aux")) {
if (unwanted.exact_match(foundfile)) {
lyxerr[Debug::DEPEND]
<< "We don't want "
<< OnlyFilename(foundfile)
@ -701,20 +686,3 @@ void LaTeX::deplog(DepTable & head)
<< endl;
}
}
void LaTeX::deptex(DepTable & head)
{
int except = AUX|LOG|DVI|BBL|IND|GLO;
string tmp;
FileInfo fi;
for (int i = 0; i < file_count; ++i) {
if (!(all_files[i].file & except)) {
tmp = OnlyFilename(ChangeExtension(file,
all_files[i].extension));
lyxerr[Debug::DEPEND] << "deptex: " << tmp << endl;
if (fi.newFile(tmp).exist())
head.insert(tmp);
}
}
}

View File

@ -63,42 +63,6 @@ private:
///
class LaTeX {
public:
/** All the different files produced by TeX.
This is the files mentioned on page 208-9 in Lamports book +
.ltx and .tex files.
*/
enum TEX_FILES {
///
NO_FILES = 0,
/// used for table of contents et.al.
AUX = 1,
/// written by BibTeX
BBL = 2,
/// LaTeX's output
DVI = 4,
/// glossary (not supported by LyX so far)
GLO = 8,
///index
IDX = 16,
/// written by makeindex
IND = 32,
/// list of figures
LOF = 64,
/// the LaTeX log file
LOG = 128,
/// list of tables
LOT = 256,
/// table of contents
TOC = 512,
/// latex files
LTX = 1024,
/// tex files
TEX = 2048,
/// list of algorithms
LOA = 4096
};
/** Return values from scanLogFile() and run() (to come)
This enum should be enlarged a bit so that one could
@ -166,9 +130,6 @@ protected:
///
void deplog(DepTable & head);
///
void deptex(DepTable & head);
///
int scanLogFile(TeXErrors &);
@ -192,11 +153,6 @@ protected:
///
string path;
///
TEX_FILES tex_files;
///
int file_count;
// used by scanLogFile
int num_errors;

View File

@ -399,6 +399,7 @@ void LyXAction::init()
{ LFUN_INSET_MINIPAGE, "minipage-inset-insert", "", Noop },
{ LFUN_INSET_FLOAT, "float-inset-insert", "", Noop },
{ LFUN_INSET_LIST, "list-inset-insert", "", Noop },
{ LFUN_INSET_THEOREM, "theorem-inset-insert", "", Noop },
{ LFUN_NOACTION, "", "", Noop }
};

View File

@ -41,9 +41,6 @@ Painter::Painter(WorkArea & wa)
}
Painter::~Painter() {}
/* Basic drawing routines */
extern bool Lgb_bug_find_hack;

View File

@ -36,9 +36,6 @@ public:
/// Constructor
explicit Painter(WorkArea &);
/// Destructor
~Painter();
/**@Basic drawing routines */
/// Draw a line from point to point
PainterBase & line(int x1, int y1, int x2, int y2,

View File

@ -108,8 +108,6 @@ struct PrinterParams {
{
testInvariant();
}
///
~PrinterParams() {}
//@}

View File

@ -71,6 +71,7 @@
#include "insets/insetfloat.h"
#include "insets/insetlist.h"
#include "insets/insettabular.h"
#include "insets/insettheorem.h"
#include "support/filetools.h"
#include "support/path.h"
#include "LaTeX.h"
@ -871,6 +872,11 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
inset->Read(this, lex);
par->InsertInset(pos, inset, font);
++pos;
} else if (tmptok == "Theorem") {
Inset * inset = new InsetList;
inset->Read(this, lex);
par->InsertInset(pos, inset, font);
++pos;
} else if (tmptok == "GRAPHICS") {
Inset * inset = new InsetGraphics;
//inset->Read(this, lex);
@ -1613,7 +1619,8 @@ void Buffer::makeLaTeXFile(string const & fname,
string options; // the document class options.
if (tokenPos(tclass.opt_fontsize(), '|', params.fontsize) >= 0) {
if (tokenPos(tclass.opt_fontsize(),
'|', params.fontsize) >= 0) {
// only write if existing in list (and not default)
options += params.fontsize;
options += "pt,";
@ -1825,7 +1832,8 @@ void Buffer::makeLaTeXFile(string const & fname,
texrow.newline();
}
if (tokenPos(tclass.opt_pagestyle(), '|', params.pagestyle) >= 0) {
if (tokenPos(tclass.opt_pagestyle(),
'|', params.pagestyle) >= 0) {
if (params.pagestyle == "fancy") {
ofs << "\\usepackage{fancyhdr}\n";
texrow.newline();
@ -1881,16 +1889,15 @@ void Buffer::makeLaTeXFile(string const & fname,
}
// Now insert the LyX specific LaTeX commands...
string preamble, tmppreamble;
// The optional packages;
preamble = features.getPackages();
string preamble(features.getPackages());
// this might be useful...
preamble += "\n\\makeatletter\n\n";
preamble += "\n\\makeatletter\n";
// Some macros LyX will need
tmppreamble = features.getMacros();
string tmppreamble(features.getMacros());
if (!tmppreamble.empty()) {
preamble += "\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% "
@ -1913,7 +1920,7 @@ void Buffer::makeLaTeXFile(string const & fname,
+ params.preamble + '\n';
}
preamble += "\\makeatother\n\n";
preamble += "\\makeatother\n";
// Itemize bullet settings need to be last in case the user
// defines their own bullets that use a package included
@ -1957,8 +1964,7 @@ void Buffer::makeLaTeXFile(string const & fname,
ofs << preamble;
// make the body.
ofs << "\\begin{document}\n\n";
texrow.newline();
ofs << "\\begin{document}\n";
texrow.newline();
} // only_body
lyxerr.debug() << "preamble finished, now the body." << endl;
@ -2009,11 +2015,12 @@ void Buffer::makeLaTeXFile(string const & fname,
lyxerr.debug() << "Finished making latex file." << endl;
}
//
// LaTeX all paragraphs from par to endpar, if endpar == 0 then to the end
//
void Buffer::latexParagraphs(ostream & ofs, LyXParagraph *par,
LyXParagraph *endpar, TexRow & texrow) const
void Buffer::latexParagraphs(ostream & ofs, LyXParagraph * par,
LyXParagraph * endpar, TexRow & texrow) const
{
bool was_title = false;
bool already_title = false;
@ -2104,6 +2111,7 @@ void Buffer::latexParagraphs(ostream & ofs, LyXParagraph *par,
}
}
bool Buffer::isLatex() const
{
return textclasslist.TextClass(params.textclass).outputType() == LATEX;
@ -2174,10 +2182,10 @@ void Buffer::makeLinuxDocFile(string const & fname, bool nice, bool body_only)
LaTeXFeatures features(params, tclass.numLayouts());
validate(features);
if(nice)
tex_code_break_column = lyxrc.ascii_linelen;
else
tex_code_break_column = 0;
//if(nice)
tex_code_break_column = lyxrc.ascii_linelen;
//else
//tex_code_break_column = 0;
texrow.reset();
@ -2186,8 +2194,7 @@ void Buffer::makeLinuxDocFile(string const & fname, bool nice, bool body_only)
if (params.preamble.empty() && sgml_includedfiles.empty()) {
ofs << "<!doctype linuxdoc system>\n\n";
}
else {
} else {
ofs << "<!doctype linuxdoc system [ "
<< params.preamble << sgml_includedfiles << " \n]>\n\n";
}
@ -2590,31 +2597,29 @@ void Buffer::SimpleLinuxDocOnePar(ostream & os, LyXParagraph * par,
case 0:
if (font2.family() == LyXFont::TYPEWRITER_FAMILY) {
push_tag(os, "tt", stack_num, stack);
family_type= 1;
family_type = 1;
}
else if (font2.family() == LyXFont::SANS_FAMILY) {
push_tag(os, "sf", stack_num, stack);
family_type= 2;
family_type = 2;
}
break;
case 1:
pop_tag(os, "tt", stack_num, stack);
if (font2.family() == LyXFont::SANS_FAMILY) {
push_tag(os, "sf", stack_num, stack);
family_type= 2;
}
else {
family_type= 0;
family_type = 2;
} else {
family_type = 0;
}
break;
case 2:
pop_tag(os, "sf", stack_num, stack);
if (font2.family() == LyXFont::TYPEWRITER_FAMILY) {
push_tag(os, "tt", stack_num, stack);
family_type= 1;
}
else {
family_type= 0;
family_type = 1;
} else {
family_type = 0;
}
}
}
@ -2624,8 +2629,7 @@ void Buffer::SimpleLinuxDocOnePar(ostream & os, LyXParagraph * par,
if (font2.series() == LyXFont::BOLD_SERIES) {
push_tag(os, "bf", stack_num, stack);
is_bold = true;
}
else if (is_bold) {
} else if (is_bold) {
pop_tag(os, "bf", stack_num, stack);
is_bold = false;
}
@ -2637,31 +2641,28 @@ void Buffer::SimpleLinuxDocOnePar(ostream & os, LyXParagraph * par,
case 0:
if (font2.shape() == LyXFont::ITALIC_SHAPE) {
push_tag(os, "it", stack_num, stack);
shape_type= 1;
}
else if (font2.shape() == LyXFont::SLANTED_SHAPE) {
shape_type = 1;
} else if (font2.shape() == LyXFont::SLANTED_SHAPE) {
push_tag(os, "sl", stack_num, stack);
shape_type= 2;
shape_type = 2;
}
break;
case 1:
pop_tag(os, "it", stack_num, stack);
if (font2.shape() == LyXFont::SLANTED_SHAPE) {
push_tag(os, "sl", stack_num, stack);
shape_type= 2;
}
else {
shape_type= 0;
shape_type = 2;
} else {
shape_type = 0;
}
break;
case 2:
pop_tag(os, "sl", stack_num, stack);
if (font2.shape() == LyXFont::ITALIC_SHAPE) {
push_tag(os, "it", stack_num, stack);
shape_type= 1;
}
else {
shape_type= 0;
shape_type = 1;
} else {
shape_type = 0;
}
}
}
@ -2700,13 +2701,11 @@ void Buffer::SimpleLinuxDocOnePar(ostream & os, LyXParagraph * par,
linux_doc_line_break(os, char_line_count, 6);
os << "</tag>";
desc_on = 2;
}
else {
} else {
linux_doc_line_break(os, char_line_count, 1);
os << c;
}
}
else {
} else {
os << sgml_string;
char_line_count += sgml_string.length();
}
@ -2783,10 +2782,10 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body)
LaTeXFeatures features(params, tclass.numLayouts());
validate(features);
if(nice)
tex_code_break_column = lyxrc.ascii_linelen;
else
tex_code_break_column = 0;
//if(nice)
tex_code_break_column = lyxrc.ascii_linelen;
//else
//tex_code_break_column = 0;
ofstream ofs(fname.c_str());
if (!ofs) {
@ -2891,19 +2890,16 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body)
if(!command_stack[j].empty())
sgmlCloseTag(ofs, j, command_stack[j]);
command_depth= command_base= cmd_depth;
}
else if(cmd_depth <= command_depth) {
} else if(cmd_depth <= command_depth) {
for(int j = command_depth;
j >= cmd_depth; --j)
if(!command_stack[j].empty())
sgmlCloseTag(ofs, j, command_stack[j]);
command_depth= cmd_depth;
}
else
} else
command_depth= cmd_depth;
}
else {
} else {
command_depth = command_base = cmd_depth;
command_flag = true;
}
@ -2973,8 +2969,7 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body)
item_name= "term";
sgmlOpenTag(ofs, depth + 1 + command_depth,
item_name);
}
else {
} else {
item_name= "para";
sgmlOpenTag(ofs, depth + 1 + command_depth,
item_name);

View File

@ -259,6 +259,7 @@ enum kb_action {
LFUN_INSET_MINIPAGE, // Lgb 20000627
LFUN_INSET_FLOAT, // Lgb 20000627
LFUN_INSET_LIST, // Lgb 20000627
LFUN_INSET_THEOREM, // Lgb 20000630
LFUN_LASTACTION /* this marks the end of the table */
};

View File

@ -37,6 +37,8 @@ libinsets_la_SOURCES = \
insetfloat.C \
insetfoot.C \
insetfoot.h \
insetfootlike.C \
insetfootlike.h \
insetgraphics.C \
insetgraphics.h \
insetinclude.C \
@ -71,6 +73,8 @@ libinsets_la_SOURCES = \
insetspecialchar.h \
insettabular.C \
insettabular.h \
insettheorem.C \
insettheorem.h \
insettext.C \
insettext.h \
insettoc.C \

View File

@ -22,6 +22,7 @@
#include "insets/insettext.h"
#include "support/LOstream.h"
#include "support/lstrings.h"
#include "debug.h"
class LyXText;
@ -56,6 +57,18 @@ Inset * InsetCollapsable::Clone() const
}
bool InsetCollapsable::InsertInset(BufferView * bv, Inset * in)
{
if (!InsertInsetAllowed(in)) {
lyxerr << "InsetCollapsable::InsertInset: "
"Unable to insert inset." << endl;
return false;
}
return inset->InsertInset(bv, in);
}
void InsetCollapsable::Write(Buffer const * buf, ostream & os) const
{
os << "collapsed " << tostr(collapsed) << "\n";
@ -377,7 +390,7 @@ void InsetCollapsable::ToggleInsetCursor(BufferView * bv)
UpdatableInset * InsetCollapsable::GetLockingInset()
{
UpdatableInset *in = inset->GetLockingInset();
UpdatableInset * in = inset->GetLockingInset();
if (inset == in)
return this;
return in;
@ -392,7 +405,8 @@ UpdatableInset * InsetCollapsable::GetFirstLockingInsetOfType(Inset::Code c)
}
void InsetCollapsable::SetFont(BufferView * bv, LyXFont const & font, bool toggleall)
void InsetCollapsable::SetFont(BufferView * bv,
LyXFont const & font, bool toggleall)
{
inset->SetFont(bv, font, toggleall);
}
@ -413,4 +427,3 @@ void InsetCollapsable::deleteLyXText(BufferView * bv)
{
inset->deleteLyXText(bv);
}

View File

@ -41,11 +41,8 @@ public:
///
static int const TEXT_TO_BOTTOM_OFFSET = 2;
///
explicit
InsetCollapsable();
///
~InsetCollapsable() {}
///
Inset * Clone() const;
///
void Read(Buffer const *, LyXLex &);
@ -66,6 +63,8 @@ public:
///
EDITABLE Editable() const;
///
bool InsertInset(BufferView *, Inset * inset);
///
bool IsTextInset() const { return true; }
///
bool doClearArea() const;

View File

@ -16,7 +16,6 @@
#include "insetert.h"
#include "gettext.h"
#include "lyxfont.h"
#include "Painter.h"
#include "buffer.h"
#include "insets/insettext.h"
#include "support/LOstream.h"
@ -40,8 +39,8 @@ InsetERT::InsetERT() : InsetCollapsable()
void InsetERT::Write(Buffer const * buf, ostream & os) const
{
os << getInsetName() << "\n";
InsetCollapsable::Write(buf, os);
os << getInsetName() << "\n";
InsetCollapsable::Write(buf, os);
}
@ -57,13 +56,7 @@ Inset * InsetERT::Clone() const
char const * InsetERT::EditMessage() const
{
return _("Opened ERT Inset");
}
bool InsetERT::InsertInset(BufferView *, Inset *)
{
return false;
return _("Opened ERT Inset");
}
@ -74,6 +67,7 @@ void InsetERT::SetFont(BufferView *, LyXFont const &, bool)
_("Sorry."));
}
void InsetERT::Edit(BufferView * bv, int x, int y, unsigned int button)
{
InsetCollapsable::Edit(bv, x, y, button);

View File

@ -20,8 +20,6 @@
#include "insetcollapsable.h"
class Painter;
/** A colapsable text inset
To write full ert (including styles and other insets) in a given
@ -32,20 +30,17 @@ public:
///
InsetERT();
///
~InsetERT() {}
///
void Write(Buffer const * buf, std::ostream & os) const;
///
Inset * Clone() const;
///
char const * EditMessage() const;
///
bool InsertInset(BufferView *, Inset *);
bool InsertInset(BufferView *, Inset *) { return false; }
///
void SetFont(BufferView *, LyXFont const &, bool toggleall = false);
///
void Edit(BufferView *, int, int, unsigned int);
///
};
#endif

View File

@ -80,16 +80,16 @@ using std::endl;
InsetFloat::InsetFloat() : InsetCollapsable()
{
setLabel(_("float"));
LyXFont font(LyXFont::ALL_SANE);
font.decSize();
font.decSize();
font.setColor(LColor::footnote);
setLabelFont(font);
setAutoCollapse(false);
setInsetName("Float");
floatType = "table";
floatPlacement = "H";
setLabel(_("float"));
LyXFont font(LyXFont::ALL_SANE);
font.decSize();
font.decSize();
font.setColor(LColor::footnote);
setLabelFont(font);
setAutoCollapse(false);
setInsetName("Float");
floatType = "table";
floatPlacement = "H";
}
@ -130,17 +130,17 @@ void InsetFloat::Validate(LaTeXFeatures & features) const
Inset * InsetFloat::Clone() const
{
InsetFloat * result = new InsetFloat;
result->inset->init(inset);
InsetFloat * result = new InsetFloat;
result->inset->init(inset);
result->collapsed = collapsed;
return result;
result->collapsed = collapsed;
return result;
}
char const * InsetFloat::EditMessage() const
{
return _("Opened Float Inset");
return _("Opened Float Inset");
}
@ -153,41 +153,34 @@ int InsetFloat::Latex(Buffer const * buf,
os << "[" << floatPlacement << "]";
os << "%\n";
int i = inset->Latex(buf, os, fragile, fp);
os << "\\end{" << floatType << "}%\n";
return i + 2;
}
bool InsetFloat::InsertInset(BufferView * bv, Inset * in)
{
if (!InsertInsetAllowed(in))
return false;
return inset->InsertInset(bv, in);
int i = inset->Latex(buf, os, fragile, fp);
os << "\\end{" << floatType << "}%\n";
return i + 2;
}
bool InsetFloat::InsertInsetAllowed(Inset * in) const
{
if ((in->LyxCode() == Inset::FOOT_CODE) ||
(in->LyxCode() == Inset::MARGIN_CODE)) {
return false;
}
return true;
if ((in->LyxCode() == Inset::FOOT_CODE) ||
(in->LyxCode() == Inset::MARGIN_CODE)) {
return false;
}
return true;
}
#if 0
LyXFont InsetFloat::GetDrawFont(BufferView * bv,
LyXParagraph * p, int pos) const
{
LyXFont fn = getLyXText(bv)->GetFont(bv->buffer(), p, pos);
fn.decSize().decSize();
return fn;
LyXFont fn = getLyXText(bv)->GetFont(bv->buffer(), p, pos);
fn.decSize().decSize();
return fn;
}
#endif
void InsetFloat::InsetButtonRelease(BufferView * bv, int x, int y, int button)
{
if (x >= 0
@ -202,3 +195,4 @@ void InsetFloat::InsetButtonRelease(BufferView * bv, int x, int y, int button)
InsetCollapsable::InsetButtonRelease(bv, x, y, button);
}
}

View File

@ -26,11 +26,8 @@ class Painter;
class InsetFloat : public InsetCollapsable {
public:
///
explicit
InsetFloat();
///
~InsetFloat() {}
///
void Write(Buffer const * buf, std::ostream & os) const;
///
void Read(Buffer const * buf, LyXLex & lex);
@ -45,8 +42,6 @@ public:
///
const char * EditMessage() const;
///
bool InsertInset(BufferView *, Inset * inset);
///
bool InsertInsetAllowed(Inset * inset) const;
///
// LyXFont GetDrawFont(BufferView *, LyXParagraph * par, int pos) const;

View File

@ -18,34 +18,22 @@
#include "gettext.h"
#include "lyxfont.h"
#include "BufferView.h"
#include "Painter.h"
#include "lyxtext.h"
#include "insets/insettext.h"
#include "support/LOstream.h"
#include "debug.h"
using std::ostream;
using std::endl;
InsetFoot::InsetFoot() : InsetCollapsable()
InsetFoot::InsetFoot() : InsetFootlike()
{
setLabel(_("foot"));
LyXFont font(LyXFont::ALL_SANE);
font.decSize();
font.decSize();
font.setColor(LColor::footnote);
setLabelFont(font);
setAutoCollapse(false);
setInsetName("Foot");
}
void InsetFoot::Write(Buffer const * buf, ostream & os) const
{
os << getInsetName() << "\n";
InsetCollapsable::Write(buf, os);
}
Inset * InsetFoot::Clone() const
{
InsetFoot * result = new InsetFoot;
@ -74,15 +62,6 @@ int InsetFoot::Latex(Buffer const * buf,
}
bool InsetFoot::InsertInset(BufferView * bv, Inset * in)
{
if (!InsertInsetAllowed(in))
return false;
return inset->InsertInset(bv, in);
}
bool InsetFoot::InsertInsetAllowed(Inset * in) const
{
if ((in->LyxCode() == Inset::FOOT_CODE) ||
@ -92,6 +71,7 @@ bool InsetFoot::InsertInsetAllowed(Inset * in) const
return true;
}
#if 0
LyXFont InsetFoot::GetDrawFont(BufferView * bv,
LyXParagraph * p, int pos) const

View File

@ -18,23 +18,16 @@
#pragma interface
#endif
#include "insetcollapsable.h"
class Painter;
#include "insetfootlike.h"
/** The footnote inset
*/
class InsetFoot : public InsetCollapsable {
class InsetFoot : public InsetFootlike {
public:
///
explicit
InsetFoot();
///
~InsetFoot() {}
///
void Write(Buffer const * buf, std::ostream & os) const;
///
Inset * Clone() const;
///
Inset::Code LyxCode() const { return Inset::FOOT_CODE; }
@ -43,11 +36,12 @@ public:
///
const char * EditMessage() const;
///
bool InsertInset(BufferView *, Inset * inset);
///
bool InsertInsetAllowed(Inset * inset) const;
///
// LyXFont GetDrawFont(BufferView *, LyXParagraph * par, int pos) const;
//LyXFont GetDrawFont(BufferView *, LyXParagraph * par, int pos) const;
};
#endif

View File

@ -0,0 +1,53 @@
/* This file is part of
* ======================================================
*
* LyX, The Document Processor
*
* Copyright 1998 The LyX Team.
*
* ======================================================
*/
#include <config.h>
#ifdef __GNUG__
#pragma implementation
#endif
#include "insetfootlike.h"
#include "lyxfont.h"
#include "BufferView.h"
#include "lyxtext.h"
#include "support/LOstream.h"
using std::ostream;
using std::endl;
InsetFootlike::InsetFootlike()
: InsetCollapsable()
{
LyXFont font(LyXFont::ALL_SANE);
font.decSize();
font.decSize();
font.setColor(LColor::footnote);
setLabelFont(font);
setAutoCollapse(false);
}
void InsetFootlike::Write(Buffer const * buf, ostream & os) const
{
os << getInsetName() << "\n";
InsetCollapsable::Write(buf, os);
}
#if 0
LyXFont InsetFootlike::GetDrawFont(BufferView * bv,
LyXParagraph * p, int pos) const
{
LyXFont fn = getLyXText(bv)->GetFont(bv->buffer(), p, pos);
fn.decSize().decSize();
return fn;
}
#endif

View File

@ -0,0 +1,41 @@
// -*- C++ -*-
/* This file is part of
* ======================================================
*
* LyX, The Document Processor
*
* Copyright 1998 The LyX Team.
*
*======================================================
*/
// The pristine updatable inset: Text
#ifndef InsetFootlike_H
#define InsetFootlike_H
#ifdef __GNUG__
#pragma interface
#endif
#include "insetcollapsable.h"
/** The footnote inset
*/
class InsetFootlike : public InsetCollapsable {
public:
///
InsetFootlike();
///
void Write(Buffer const * buf, std::ostream & os) const;
///
//LyXFont GetDrawFont(BufferView *, LyXParagraph * par, int pos) const;
};
#endif

View File

@ -21,6 +21,7 @@
#include "lyxtext.h"
#include "insets/insettext.h"
#include "support/LOstream.h"
#include "debug.h"
using std::ostream;
using std::endl;
@ -85,15 +86,6 @@ int InsetList::Latex(Buffer const * buf,
}
bool InsetList::InsertInset(BufferView * bv, Inset * in)
{
if (!InsertInsetAllowed(in))
return false;
return inset->InsertInset(bv, in);
}
bool InsetList::InsertInsetAllowed(Inset * in) const
{
if ((in->LyxCode() == Inset::FOOT_CODE) ||
@ -103,6 +95,7 @@ bool InsetList::InsertInsetAllowed(Inset * in) const
return true;
}
#if 0
LyXFont InsetList::GetDrawFont(BufferView * bv,LyXParagraph * p, int pos) const
{

View File

@ -26,11 +26,8 @@ class Painter;
class InsetList : public InsetCollapsable {
public:
///
explicit
InsetList();
///
~InsetList() {}
///
void Write(Buffer const * buf, std::ostream & os) const;
///
Inset * Clone() const;
@ -41,8 +38,6 @@ public:
///
const char * EditMessage() const;
///
bool InsertInset(BufferView *, Inset * inset);
///
bool InsertInsetAllowed(Inset * inset) const;
///
// LyXFont GetDrawFont(BufferView *, LyXParagraph * par, int pos) const;

View File

@ -18,32 +18,20 @@
#include "gettext.h"
#include "lyxfont.h"
#include "BufferView.h"
#include "Painter.h"
#include "lyxtext.h"
#include "insets/insettext.h"
#include "support/LOstream.h"
#include "debug.h"
using std::ostream;
using std::endl;
InsetMarginal::InsetMarginal()
: InsetCollapsable()
: InsetFootlike()
{
setLabel(_("margin"));
LyXFont font(LyXFont::ALL_SANE);
font.decSize();
font.decSize();
font.setColor(LColor::footnote);
setLabelFont(font);
setAutoCollapse(false);
setInsetName("Marginal");
}
void InsetMarginal::Write(Buffer const * buf, ostream & os) const
{
os << getInsetName() << "\n";
InsetCollapsable::Write(buf, os);
setLabel(_("margin"));
setInsetName("Marginal");
}
@ -59,7 +47,7 @@ Inset * InsetMarginal::Clone() const
char const * InsetMarginal::EditMessage() const
{
return _("Opened Marginal Note Inset");
return _("Opened Marginal Note Inset");
}
@ -75,15 +63,6 @@ int InsetMarginal::Latex(Buffer const * buf,
}
bool InsetMarginal::InsertInset(BufferView * bv, Inset * in)
{
if (!InsertInsetAllowed(in))
return false;
return inset->InsertInset(bv, in);
}
bool InsetMarginal::InsertInsetAllowed(Inset * in) const
{
if ((in->LyxCode() == Inset::FOOT_CODE) ||
@ -93,6 +72,7 @@ bool InsetMarginal::InsertInsetAllowed(Inset * in) const
return true;
}
#if 0
LyXFont InsetMarginal::GetDrawFont(BufferView * bv,
LyXParagraph * p, int pos) const

View File

@ -16,23 +16,16 @@
#pragma interface
#endif
#include "insetcollapsable.h"
class Painter;
#include "insetfootlike.h"
/** The marginal note inset
*/
class InsetMarginal : public InsetCollapsable {
class InsetMarginal : public InsetFootlike {
public:
///
explicit
InsetMarginal();
///
~InsetMarginal() {}
///
void Write(Buffer const * buf, std::ostream & os) const;
///
Inset * Clone() const;
///
Inset::Code LyxCode() const { return Inset::MARGIN_CODE; }
@ -41,11 +34,9 @@ public:
///
const char * EditMessage() const;
///
bool InsertInset(BufferView *, Inset * inset);
///
bool InsertInsetAllowed(Inset * inset) const;
///
// LyXFont GetDrawFont(BufferView *, LyXParagraph * par, int pos) const;
//LyXFont GetDrawFont(BufferView *, LyXParagraph * par, int pos) const;
};
#endif

View File

@ -21,6 +21,7 @@
#include "lyxtext.h"
#include "insets/insettext.h"
#include "support/LOstream.h"
#include "debug.h"
using std::ostream;
using std::endl;
@ -103,15 +104,6 @@ int InsetMinipage::Latex(Buffer const * buf,
}
bool InsetMinipage::InsertInset(BufferView * bv, Inset * in)
{
if (!InsertInsetAllowed(in))
return false;
return inset->InsertInset(bv, in);
}
bool InsetMinipage::InsertInsetAllowed(Inset * in) const
{
if ((in->LyxCode() == Inset::FLOAT_CODE) ||
@ -121,6 +113,7 @@ bool InsetMinipage::InsertInsetAllowed(Inset * in) const
return true;
}
#if 0
LyXFont InsetMinipage::GetDrawFont(BufferView * bv,
LyXParagraph * p, int pos) const

View File

@ -26,11 +26,8 @@ class Painter;
class InsetMinipage : public InsetCollapsable {
public:
///
explicit
InsetMinipage();
///
~InsetMinipage() {}
///
void Write(Buffer const * buf, std::ostream & os) const;
///
Inset * Clone() const;
@ -41,8 +38,6 @@ public:
///
const char * EditMessage() const;
///
bool InsertInset(BufferView *, Inset * inset);
///
bool InsertInsetAllowed(Inset * inset) const;
///
// LyXFont GetDrawFont(BufferView *, LyXParagraph * par, int pos) const;

View File

@ -106,8 +106,7 @@ void InsetText::init(InsetText const * ins)
InsetText::~InsetText()
{
LyXParagraph * p;
p = par->next;
LyXParagraph * p = par->next;
delete par;
while(p) {
par = p;
@ -139,7 +138,7 @@ void InsetText::WriteParagraphData(Buffer const * buf, ostream & os) const
void InsetText::Read(Buffer const * buf, LyXLex & lex)
{
string token;
string token;
int pos = 0;
LyXParagraph * return_par = 0;
char depth = 0; // signed or unsigned?

View File

@ -55,9 +55,9 @@ public:
ALWAYS
};
///
explicit
InsetText();
///
explicit
InsetText(InsetText const &);
///
~InsetText();

105
src/insets/insettheorem.C Normal file
View File

@ -0,0 +1,105 @@
/* This file is part of
* ======================================================
*
* LyX, The Document Processor
*
* Copyright 1998 The LyX Team.
*
* ======================================================
*/
#include <config.h>
#ifdef __GNUG__
#pragma implementation
#endif
#include "insettheorem.h"
#include "gettext.h"
#include "lyxfont.h"
#include "BufferView.h"
#include "Painter.h"
#include "lyxtext.h"
#include "support/LOstream.h"
#include "debug.h"
#include "insets/insettext.h"
using std::ostream;
using std::endl;
/*
The intention is to be able to create arbitrary theorem like environments
sing this class and some helper/container classes. It should be possible
to create these theorems both from layout file and interactively by the
user.
*/
InsetTheorem::InsetTheorem()
: InsetCollapsable()
{
setLabel(_("theorem"));
LyXFont font(LyXFont::ALL_SANE);
font.decSize();
font.decSize();
font.setColor(LColor::footnote);
setLabelFont(font);
setAutoCollapse(false);
setInsetName("Theorem");
}
void InsetTheorem::Write(Buffer const * buf, ostream & os) const
{
os << getInsetName() << "\n";
InsetCollapsable::Write(buf, os);
}
Inset * InsetTheorem::Clone() const
{
InsetTheorem * result = new InsetTheorem;
result->collapsed = collapsed;
return result;
}
char const * InsetTheorem::EditMessage() const
{
return _("Opened Theorem Inset");
}
int InsetTheorem::Latex(Buffer const * buf,
ostream & os, bool fragile, bool fp) const
{
os << "\\begin{theorem}%\n";
int i = inset->Latex(buf, os, fragile, fp);
os << "\\end{theorem}%\n";
return i + 2;
}
bool InsetTheorem::InsertInsetAllowed(Inset * inset) const
{
lyxerr << "InsetTheorem::InsertInsetAllowed" << endl;
if ((inset->LyxCode() == Inset::FOOT_CODE) ||
(inset->LyxCode() == Inset::MARGIN_CODE)) {
return false;
}
return true;
}
#if 0
LyXFont InsetTheorem::GetDrawFont(BufferView * bv,
LyXParagraph * p, int pos) const
{
LyXFont fn = getLyXText(bv)->GetFont(bv->buffer(), p, pos);
fn.decSize().decSize();
return fn;
}
#endif

46
src/insets/insettheorem.h Normal file
View File

@ -0,0 +1,46 @@
// -*- C++ -*-
/* This file is part of
* ======================================================
*
* LyX, The Document Processor
*
* Copyright 1998 The LyX Team.
*
* ======================================================
*/
#ifndef InsetTheorem_H
#define InsetTheorem_H
#ifdef __GNUG__
#pragma interface
#endif
#include "insetcollapsable.h"
/** The footnote inset
*/
class InsetTheorem : public InsetCollapsable {
public:
///
InsetTheorem();
///
void Write(Buffer const * buf, std::ostream & os) const;
///
Inset * Clone() const;
///
Inset::Code LyxCode() const { return Inset::THEOREM_CODE; }
///
bool display() const { return true; }
///
int Latex(Buffer const *, std::ostream &, bool fragile, bool fp) const;
///
const char * EditMessage() const;
///
bool InsertInsetAllowed(Inset * inset) const;
///
//LyXFont GetDrawFont(BufferView *, LyXParagraph * par, int pos) const;
};
#endif

View File

@ -100,7 +100,9 @@ public:
///
TABULAR_CODE,
///
EXTERNAL_CODE
EXTERNAL_CODE,
///
THEOREM_CODE
};
///
@ -276,8 +278,6 @@ public:
///
UpdatableInset() { scx = mx_scx = 0; }
///
//virtual ~UpdatableInset() {}
///
virtual EDITABLE Editable() const;
/// may call ToggleLockedInsetCursor

View File

@ -61,6 +61,7 @@ using std::istringstream;
#include "insets/insetfloat.h"
#include "insets/insetlist.h"
#include "insets/insettabular.h"
#include "insets/insettheorem.h"
#include "mathed/formulamacro.h"
#include "toolbar.h"
#include "spellchecker.h" // RVDK_PATCH_5
@ -2077,7 +2078,17 @@ string LyXFunc::Dispatch(int ac,
delete new_inset;
}
break;
case LFUN_INSET_THEOREM:
{
InsetTheorem * new_inset = new InsetTheorem;
if (owner->view()->insertInset(new_inset))
new_inset->Edit(owner->view(), 0, 0, 0);
else
delete new_inset;
}
break;
case LFUN_INSET_TABULAR:
{
int r = 2, c = 2;

View File

@ -347,7 +347,7 @@ void LyXRC::setDefaults() {
override_x_deadkeys = true;
autosave = 300;
auto_region_delete = true;
ascii_linelen = 75;
ascii_linelen = 65;
num_lastfiles = 4;
check_lastfiles = true;
make_backup = true;

View File

@ -31,11 +31,9 @@
class MathedCursor {
public:
///
explicit
explicit
MathedCursor(MathParInset * p);
///
~MathedCursor() { };
///
void Insert(byte, MathedTextCodes t = LM_TC_MIN);
///
void Insert(MathedInset *, int t = LM_TC_INSET);

View File

@ -222,7 +222,7 @@ class MathedInset {
/// A math inset has a name (usually its LaTeX name), type and font-size
MathedInset(char const * nm, short ot, short st);
///
explicit
explicit
MathedInset(MathedInset *);
///
virtual ~MathedInset() {}
@ -318,7 +318,7 @@ class MathParInset: public MathedInset {
MathParInset(short st = LM_ST_TEXT, char const * nm = 0,
short ot = LM_OT_MIN);
///
explicit
explicit
MathParInset(MathParInset *);
///
virtual ~MathParInset();
@ -417,7 +417,7 @@ class MathParInset: public MathedInset {
*/
struct MathedRowSt {
///
explicit
explicit
MathedRowSt(int n) {
w = new int[n + 1]; // this leaks
asc = desc = y = 0;
@ -476,10 +476,10 @@ struct MathedRowSt {
class MathMatrixInset: public MathParInset {
public:
///
explicit
explicit
MathMatrixInset(int m = 1, int n = 1, short st = LM_ST_TEXT);
///
explicit
explicit
MathMatrixInset(MathMatrixInset *);
///
MathedInset * Clone();

View File

@ -51,7 +51,7 @@ class MathedIter {
ncols = row = col = 0;
}
///
explicit
explicit
MathedIter(LyxArrayBase *);
///
virtual ~MathedIter() { }
@ -170,8 +170,6 @@ class MathedXIter: public MathedIter {
///
MathedXIter(MathParInset*);
///
~MathedXIter() { };
///
void SetData(MathParInset *);
///
MathParInset *getPar() { return p; }

View File

@ -37,12 +37,12 @@ class MathMacro : public MathParInset
{
public:
/// A macro can only be builded from an existing template
explicit
explicit
MathMacro(MathMacroTemplate *);
/// or from another macro.
explicit
explicit
MathMacro(MathMacro *);
///
///
~MathMacro();
///
void draw(Painter &, int, int);
@ -105,12 +105,16 @@ private:
class MathMacroArgument: public MathParInset {
public:
///
MathMacroArgument() { expnd_mode = false; number = 1; SetType(LM_OT_MACRO_ARG); }
MathMacroArgument() {
expnd_mode = false;
number = 1;
SetType(LM_OT_MACRO_ARG);
}
///
explicit
explicit
MathMacroArgument(int);
///
~MathMacroArgument() { lyxerr << "help, destroyme!" << std::endl; }
~MathMacroArgument() { lyxerr << "help, destroyme!" << std::endl; }
///
MathedInset * Clone() { return this; }
///
@ -126,9 +130,9 @@ public:
/// Is expanded or not
bool getExpand() { return expnd_mode; }
private:
///
///
bool expnd_mode;
///
///
int number;
};
@ -137,15 +141,15 @@ private:
class MathMacroTemplate: public MathParInset {
public:
/// A template constructor needs all the data
explicit
explicit
MathMacroTemplate(char const *, int na = 0, int f = 0);
///
///
~MathMacroTemplate();
///
///
void draw(Painter &, int, int);
///
///
void Metrics();
///
///
void WriteDef(std::ostream &, bool fragile);
/// useful for special insets
void setTCode(MathedTextCodes t) { tcode = t; }
@ -161,7 +165,7 @@ public:
MathParInset * getMacroPar(int) const;
///
void SetMacroFocus(int &, int, int);
///
///
void setEditMode(bool);
/// Replace the appropriate arguments with a specific macro's data
@ -189,30 +193,30 @@ typedef MathMacroTemplate * MathMacroTemplateP;
///
class MathMacroTable {
public:
///
explicit
///
explicit
MathMacroTable(int);
///
///
~MathMacroTable();
///
///
void addTemplate(MathMacroTemplate *);
///
///
MathMacro * getMacro(char const *) const;
///
///
MathMacroTemplate * getTemplate(char const *) const;
///
///
void builtinMacros();
///
///
static MathMacroTable mathMTable;
///
///
static bool built;
private:
///
///
const int max_macros;
///
///
int num_macros;
///
///
MathMacroTemplateP * macro_table;
};

View File

@ -28,11 +28,8 @@
class MathRootInset: public MathSqrtInset {
public:
///
explicit
explicit
MathRootInset(short st = LM_ST_TEXT);
///
// explicit
// MathRootInset(MathSqrtInset &);
///
~MathRootInset();
///

View File

@ -690,6 +690,8 @@ void LyXParagraph::InsertInset(LyXParagraph::size_type pos,
bool LyXParagraph::InsertInsetAllowed(Inset * inset)
{
lyxerr << "LyXParagraph::InsertInsetAllowed" << endl;
if (inset_owner)
return inset_owner->InsertInsetAllowed(inset);
return true;
@ -3330,8 +3332,13 @@ void LyXParagraph::SimpleTeXSpecialChars(Buffer const * buf,
//... but we should avoid ligatures
if ((c == '>' || c == '<')
&& i <= size() - 2
&& GetChar(i + 1) == c){
os << "\\textcompwordmark{}";
&& GetChar(i + 1) == c) {
//os << "\\textcompwordmark{}";
// Jean-Marc, have a look at
// this. I think this works
// equally well:
os << "\\,{}";
// Lgb
column += 19;
}
break;

View File

@ -200,6 +200,8 @@ public:
len (l),
kp (false) {}
///
explicit
VSpace(float v, LyXLength::UNIT u) :
kin (LENGTH),
len (v, u),