From 946895278050e4a464c9591e99232a72f5f4dec9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20Gullik=20Bj=C3=B8nnes?= Date: Tue, 4 Jul 2000 19:16:35 +0000 Subject: [PATCH] more changes, read the Changelog git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@857 a592a061-630c-0410-9148-cb99ea01b6c8 --- ChangeLog | 72 ++++++++++++++++++++++ src/FloatList.C | 55 +++++++++++++++++ src/FloatList.h | 45 +------------- src/LaTeX.C | 58 ++++-------------- src/LaTeX.h | 44 -------------- src/LyXAction.C | 1 + src/Painter.C | 3 - src/Painter.h | 3 - src/PrinterParams.h | 2 - src/buffer.C | 109 ++++++++++++++++------------------ src/commandtags.h | 1 + src/insets/Makefile.am | 4 ++ src/insets/insetcollapsable.C | 19 +++++- src/insets/insetcollapsable.h | 5 +- src/insets/insetert.C | 14 ++--- src/insets/insetert.h | 7 +-- src/insets/insetfloat.C | 66 ++++++++++---------- src/insets/insetfloat.h | 5 -- src/insets/insetfoot.C | 28 ++------- src/insets/insetfoot.h | 18 ++---- src/insets/insetfootlike.C | 53 +++++++++++++++++ src/insets/insetfootlike.h | 41 +++++++++++++ src/insets/insetlist.C | 11 +--- src/insets/insetlist.h | 5 -- src/insets/insetmarginal.C | 34 +++-------- src/insets/insetmarginal.h | 15 +---- src/insets/insetminipage.C | 11 +--- src/insets/insetminipage.h | 5 -- src/insets/insettext.C | 5 +- src/insets/insettext.h | 2 +- src/insets/insettheorem.C | 105 ++++++++++++++++++++++++++++++++ src/insets/insettheorem.h | 46 ++++++++++++++ src/insets/lyxinset.h | 6 +- src/lyxfunc.C | 13 +++- src/lyxrc.C | 2 +- src/mathed/math_cursor.h | 4 +- src/mathed/math_defs.h | 10 ++-- src/mathed/math_iter.h | 4 +- src/mathed/math_macro.h | 56 +++++++++-------- src/mathed/math_root.h | 5 +- src/paragraph.C | 11 +++- src/vspace.h | 2 + 42 files changed, 591 insertions(+), 414 deletions(-) create mode 100644 src/insets/insetfootlike.C create mode 100644 src/insets/insetfootlike.h create mode 100644 src/insets/insettheorem.C create mode 100644 src/insets/insettheorem.h diff --git a/ChangeLog b/ChangeLog index 011c794361..3c7cc9c505 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,75 @@ +2000-07-04 Lars Gullik Bjønnes + + * 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 + + * src/FloatList.[Ch]: moved inlines out of line to FloatList.C + +2000-07-02 Lars Gullik Bjønnes + + * 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 * src/text.C (NextBreakPoint): added support for needFullRow() diff --git a/src/FloatList.C b/src/FloatList.C index 77a885a2bf..d0a7263d88 100644 --- a/src/FloatList.C +++ b/src/FloatList.C @@ -1,5 +1,60 @@ #include +#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; diff --git a/src/FloatList.h b/src/FloatList.h index 422110d6fd..a328edb7d0 100644 --- a/src/FloatList.h +++ b/src/FloatList.h @@ -27,50 +27,11 @@ public: /// typedef std::map 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; diff --git a/src/LaTeX.C b/src/LaTeX.C index d319a6c770..94af204a5f 100644 --- a/src/LaTeX.C +++ b/src/LaTeX.C @@ -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); - } - } -} diff --git a/src/LaTeX.h b/src/LaTeX.h index 5af4adbeba..fdc9f52332 100644 --- a/src/LaTeX.h +++ b/src/LaTeX.h @@ -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; diff --git a/src/LyXAction.C b/src/LyXAction.C index 0f6caa20e9..9fd90a5e54 100644 --- a/src/LyXAction.C +++ b/src/LyXAction.C @@ -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 } }; diff --git a/src/Painter.C b/src/Painter.C index b638691601..603ac4e6ed 100644 --- a/src/Painter.C +++ b/src/Painter.C @@ -41,9 +41,6 @@ Painter::Painter(WorkArea & wa) } -Painter::~Painter() {} - - /* Basic drawing routines */ extern bool Lgb_bug_find_hack; diff --git a/src/Painter.h b/src/Painter.h index 9c5ea73700..8798428e75 100644 --- a/src/Painter.h +++ b/src/Painter.h @@ -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, diff --git a/src/PrinterParams.h b/src/PrinterParams.h index 6f738a0914..2c19c0af74 100644 --- a/src/PrinterParams.h +++ b/src/PrinterParams.h @@ -108,8 +108,6 @@ struct PrinterParams { { testInvariant(); } - /// - ~PrinterParams() {} //@} diff --git a/src/buffer.C b/src/buffer.C index bb1d109db1..55785a6b3c 100644 --- a/src/buffer.C +++ b/src/buffer.C @@ -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 << "\n\n"; - } - else { + } else { ofs << "\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 << ""; 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); diff --git a/src/commandtags.h b/src/commandtags.h index 10a85331eb..6d16872eb3 100644 --- a/src/commandtags.h +++ b/src/commandtags.h @@ -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 */ }; diff --git a/src/insets/Makefile.am b/src/insets/Makefile.am index df4dccd2fa..dcfca79d1c 100644 --- a/src/insets/Makefile.am +++ b/src/insets/Makefile.am @@ -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 \ diff --git a/src/insets/insetcollapsable.C b/src/insets/insetcollapsable.C index 718600a2d9..9e843c2862 100644 --- a/src/insets/insetcollapsable.C +++ b/src/insets/insetcollapsable.C @@ -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); } - diff --git a/src/insets/insetcollapsable.h b/src/insets/insetcollapsable.h index 687c11317a..14174a00ca 100644 --- a/src/insets/insetcollapsable.h +++ b/src/insets/insetcollapsable.h @@ -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; diff --git a/src/insets/insetert.C b/src/insets/insetert.C index 32bb4476f1..2abd91b8e4 100644 --- a/src/insets/insetert.C +++ b/src/insets/insetert.C @@ -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); diff --git a/src/insets/insetert.h b/src/insets/insetert.h index 43deb1c0e8..77c63df10a 100644 --- a/src/insets/insetert.h +++ b/src/insets/insetert.h @@ -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 diff --git a/src/insets/insetfloat.C b/src/insets/insetfloat.C index cc893bc70d..e60f5c36eb 100644 --- a/src/insets/insetfloat.C +++ b/src/insets/insetfloat.C @@ -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); } } + diff --git a/src/insets/insetfloat.h b/src/insets/insetfloat.h index 997c99f73a..8669911d5e 100644 --- a/src/insets/insetfloat.h +++ b/src/insets/insetfloat.h @@ -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; diff --git a/src/insets/insetfoot.C b/src/insets/insetfoot.C index e9f56e6785..4857207529 100644 --- a/src/insets/insetfoot.C +++ b/src/insets/insetfoot.C @@ -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 diff --git a/src/insets/insetfoot.h b/src/insets/insetfoot.h index 115ce8ff20..566c6e2db5 100644 --- a/src/insets/insetfoot.h +++ b/src/insets/insetfoot.h @@ -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 + + + diff --git a/src/insets/insetfootlike.C b/src/insets/insetfootlike.C new file mode 100644 index 0000000000..e6e448052d --- /dev/null +++ b/src/insets/insetfootlike.C @@ -0,0 +1,53 @@ +/* This file is part of + * ====================================================== + * + * LyX, The Document Processor + * + * Copyright 1998 The LyX Team. + * + * ====================================================== + */ + +#include + +#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 diff --git a/src/insets/insetfootlike.h b/src/insets/insetfootlike.h new file mode 100644 index 0000000000..ab2eeb0f97 --- /dev/null +++ b/src/insets/insetfootlike.h @@ -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 + + + + + diff --git a/src/insets/insetlist.C b/src/insets/insetlist.C index 2b67d19468..a126b40e67 100644 --- a/src/insets/insetlist.C +++ b/src/insets/insetlist.C @@ -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 { diff --git a/src/insets/insetlist.h b/src/insets/insetlist.h index 342a7f8b28..4aaa2bfc9c 100644 --- a/src/insets/insetlist.h +++ b/src/insets/insetlist.h @@ -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; diff --git a/src/insets/insetmarginal.C b/src/insets/insetmarginal.C index ce0fe40f81..86bba7f28e 100644 --- a/src/insets/insetmarginal.C +++ b/src/insets/insetmarginal.C @@ -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 diff --git a/src/insets/insetmarginal.h b/src/insets/insetmarginal.h index 6a47bfeb7b..5d19e9579e 100644 --- a/src/insets/insetmarginal.h +++ b/src/insets/insetmarginal.h @@ -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 diff --git a/src/insets/insetminipage.C b/src/insets/insetminipage.C index 2e90212764..5cd5e8e366 100644 --- a/src/insets/insetminipage.C +++ b/src/insets/insetminipage.C @@ -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 diff --git a/src/insets/insetminipage.h b/src/insets/insetminipage.h index daba5e9486..540d68c46c 100644 --- a/src/insets/insetminipage.h +++ b/src/insets/insetminipage.h @@ -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; diff --git a/src/insets/insettext.C b/src/insets/insettext.C index f8be238c2e..b4d5f4c34f 100644 --- a/src/insets/insettext.C +++ b/src/insets/insettext.C @@ -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? diff --git a/src/insets/insettext.h b/src/insets/insettext.h index 223b34ede1..8b46a13142 100644 --- a/src/insets/insettext.h +++ b/src/insets/insettext.h @@ -55,9 +55,9 @@ public: ALWAYS }; /// - explicit InsetText(); /// + explicit InsetText(InsetText const &); /// ~InsetText(); diff --git a/src/insets/insettheorem.C b/src/insets/insettheorem.C new file mode 100644 index 0000000000..388d876ccd --- /dev/null +++ b/src/insets/insettheorem.C @@ -0,0 +1,105 @@ +/* This file is part of + * ====================================================== + * + * LyX, The Document Processor + * + * Copyright 1998 The LyX Team. + * + * ====================================================== + */ + +#include + +#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 diff --git a/src/insets/insettheorem.h b/src/insets/insettheorem.h new file mode 100644 index 0000000000..e3d3a92cab --- /dev/null +++ b/src/insets/insettheorem.h @@ -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 diff --git a/src/insets/lyxinset.h b/src/insets/lyxinset.h index 482037f17e..68b69a6025 100644 --- a/src/insets/lyxinset.h +++ b/src/insets/lyxinset.h @@ -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 diff --git a/src/lyxfunc.C b/src/lyxfunc.C index ed1d3c00fa..8d2ca3f1ed 100644 --- a/src/lyxfunc.C +++ b/src/lyxfunc.C @@ -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; diff --git a/src/lyxrc.C b/src/lyxrc.C index 2758bba5ae..2b81b0d0c3 100644 --- a/src/lyxrc.C +++ b/src/lyxrc.C @@ -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; diff --git a/src/mathed/math_cursor.h b/src/mathed/math_cursor.h index e019208b51..24d9a767a3 100644 --- a/src/mathed/math_cursor.h +++ b/src/mathed/math_cursor.h @@ -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); diff --git a/src/mathed/math_defs.h b/src/mathed/math_defs.h index c213a4c200..747addcd70 100644 --- a/src/mathed/math_defs.h +++ b/src/mathed/math_defs.h @@ -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(); diff --git a/src/mathed/math_iter.h b/src/mathed/math_iter.h index a34738eb32..effa8200cc 100644 --- a/src/mathed/math_iter.h +++ b/src/mathed/math_iter.h @@ -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; } diff --git a/src/mathed/math_macro.h b/src/mathed/math_macro.h index b0f062f7b0..5e9773acc6 100644 --- a/src/mathed/math_macro.h +++ b/src/mathed/math_macro.h @@ -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; }; diff --git a/src/mathed/math_root.h b/src/mathed/math_root.h index 286a50494a..497adc0804 100644 --- a/src/mathed/math_root.h +++ b/src/mathed/math_root.h @@ -28,11 +28,8 @@ class MathRootInset: public MathSqrtInset { public: /// - explicit + explicit MathRootInset(short st = LM_ST_TEXT); - /// - // explicit - // MathRootInset(MathSqrtInset &); /// ~MathRootInset(); /// diff --git a/src/paragraph.C b/src/paragraph.C index 8eac8d5ddd..449acc3adc 100644 --- a/src/paragraph.C +++ b/src/paragraph.C @@ -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; diff --git a/src/vspace.h b/src/vspace.h index 2d36964671..92ae532319 100644 --- a/src/vspace.h +++ b/src/vspace.h @@ -200,6 +200,8 @@ public: len (l), kp (false) {} + /// + explicit VSpace(float v, LyXLength::UNIT u) : kin (LENGTH), len (v, u),