remove unused and a little documentation (all r=larsbj)

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5462 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
John Levon 2002-10-21 16:21:56 +00:00
parent 5696dc3287
commit 774dabb323
18 changed files with 324 additions and 285 deletions

View File

@ -556,7 +556,7 @@ bool BufferView::gotoLabel(string const & label)
}
void BufferView::menuUndo()
void BufferView::undo()
{
if (!available())
return;
@ -573,7 +573,7 @@ void BufferView::menuUndo()
}
void BufferView::menuRedo()
void BufferView::redo()
{
if (!available())
return;

View File

@ -31,34 +31,48 @@ class Painter;
class UpdatableInset;
class WordLangTuple;
///
/**
* A buffer view encapsulates a view onto a particular
* buffer, and allows access to operate upon it. A view
* is a sliding window of the entire document rendering.
*
* Eventually we will allow several views onto a single
* buffer, but not yet.
*/
class BufferView : boost::noncopyable {
public:
///
/**
* Codes to store necessary pending updates
* of the document rendering.
*/
enum UpdateCodes {
///
UPDATE = 0,
///
SELECT = 1,
///
FITCUR = 2,
///
CHANGE = 4
UPDATE = 0, //< FIXME
SELECT = 1, //< selection change
FITCUR = 2, //< the cursor needs fitting into the view
CHANGE = 4 //< document data has changed
};
///
BufferView(LyXView * owner, int , int , int, int);
///
/**
* Create a view with the given owner main window,
* of the given dimensions.
*/
BufferView(LyXView * owner, int x, int y, int w, int h);
~BufferView();
///
Buffer * buffer() const;
///
Painter & painter() const;
///
LyXScreen & screen() const;
///
/// set the buffer we are viewing
void buffer(Buffer * b);
///
/// return the buffer being viewed
Buffer * buffer() const;
/// return the painter object for drawing onto the view
Painter & painter() const;
/// return the screen object for handling re-drawing
LyXScreen & screen() const;
/// return the owning main view
LyXView * owner() const;
/// resize event has happened
void resize();
/**
* Repaint the pixmap. Used for when we don't want
@ -66,146 +80,164 @@ public:
* repaint of the whole screen.
*/
void repaint();
///
/// fit the user cursor within the visible view
bool fitCursor();
///
/// perform pending painting updates
void update();
//
// update for a particular lyxtext
void update(LyXText *, UpdateCodes uc);
///
void updateScrollbar();
///
void redoCurrentBuffer();
///
bool available() const;
///
LyXView * owner() const;
///
void beforeChange(LyXText *);
///
void savePosition(unsigned int i);
///
void restorePosition(unsigned int i);
///
bool isSavedPosition(unsigned int i);
/** This holds the mapping between buffer paragraphs and screen rows.
This should be private...but not yet. (Lgb)
*/
LyXText * text;
///
LyXText * getLyXText() const;
///
LyXText * getParentText(Inset * inset) const;
///
Language const * getParentLanguage(Inset * inset) const;
///
int workWidth() const;
///
UpdatableInset * theLockingInset() const;
///
void theLockingInset(UpdatableInset * inset);
///
/// update for a particular inset
void updateInset(Inset * inset, bool mark_dirty);
///
int slx;
///
int sly;
///
/// reset the scrollbar to reflect current view position
void updateScrollbar();
/// FIXME
void redoCurrentBuffer();
/// FIXME
bool available() const;
/// FIXME
void beforeChange(LyXText *);
/// Save the current position as bookmark i
void savePosition(unsigned int i);
/// Restore the position from bookmark i
void restorePosition(unsigned int i);
/// does the given bookmark have a saved position ?
bool isSavedPosition(unsigned int i);
/**
* This holds the mapping between buffer paragraphs and screen rows.
* This should be private...but not yet. (Lgb)
*/
LyXText * text;
/// return the lyxtext we are using
LyXText * getLyXText() const;
/// Return the current inset we are "locked" in
UpdatableInset * theLockingInset() const;
/// lock the given inset FIXME: return value ?
bool lockInset(UpdatableInset * inset);
/// unlock the given inset
int unlockInset(UpdatableInset * inset);
/// unlock the currently locked inset
void insetUnlock();
///
void replaceWord(string const & replacestring);
///
void endOfSpellCheck();
///
/// return the parent language of the given inset
Language const * getParentLanguage(Inset * inset) const;
/// Select the "current" word
void selectLastWord();
/// replace the currently selected word
void replaceWord(string const & replacestring);
/// Update after spellcheck finishes
void endOfSpellCheck();
/// return the next word
WordLangTuple const nextWord(float & value);
///
/// move cursor to the named label
bool gotoLabel(string const & label);
///
void pasteEnvironment();
///
/// copy the environment type from current paragraph
void copyEnvironment();
///
void menuUndo();
///
void menuRedo();
/// set the current paragraph's environment type
void pasteEnvironment();
/// undo last action
void undo();
/// redo last action
void redo();
/// removes all autodeletable insets
bool removeAutoInsets();
///
/// insert all errors found when running latex
void insertErrors(TeXErrors & terr);
///
/// set the cursor based on the given TeX source row
void setCursorFromRow(int row);
/** Insert an inset into the buffer.
Place it in a layout of lout,
if no_table make sure that it doesn't end up in a table.
*/
/**
* Insert an inset into the buffer.
* Place it in a layout of lout,
*/
bool insertInset(Inset * inset, string const & lout = string());
/// Inserts a lyx file at cursor position. return #false# if it fails
/// Inserts a lyx file at cursor position. return false if it fails
bool insertLyXFile(string const & file);
///
bool lockInset(UpdatableInset * inset);
///
void showLockedInsetCursor(int x, int y, int asc, int desc);
///
void hideLockedInsetCursor();
///
bool fitLockedInsetCursor(int x, int y, int asc, int desc);
///
int unlockInset(UpdatableInset * inset);
///
void lockedInsetStoreUndo(Undo::undo_kind kind);
///
/// show the user cursor
void showCursor();
///
/// hide the user cursor
void hideCursor();
///
/// FIXME
void showLockedInsetCursor(int x, int y, int asc, int desc);
/// FIXME
void hideLockedInsetCursor();
/// FIXME
bool fitLockedInsetCursor(int x, int y, int asc, int desc);
/// FIXME
void lockedInsetStoreUndo(Undo::undo_kind kind);
/// FIXME
void toggleSelection(bool = true);
///
/// FIXME: my word !
void toggleToggle();
///
/// center the document view around the cursor
void center();
/// scroll document by the given number of lines of default height
void scroll(int lines);
/// Scroll the view by a number of pixels
void scrollDocView(int);
///
void switchKeyMap();
///
bool ChangeInsets(Inset::Code code, string const & from,
string const & to);
///
bool ChangeRefsIfUnique(string const & from, string const & to);
///
bool ChangeCitationsIfUnique(string const & from, string const & to);
///
string const getClipboard() const;
///
void stuffClipboard(string const &) const;
///
bool dispatch(FuncRequest const & argument);
/// height of a normal line in pixels (zoom factor considered)
int defaultHeight() const;
///
void haveSelection(bool sel);
///
/// return the pixel width of the document view
int workWidth() const;
/// return the pixel height of the document view
int workHeight() const;
/// switch between primary and secondary keymaps for RTL entry
void switchKeyMap();
/// FIXME
bool ChangeRefsIfUnique(string const & from, string const & to);
/// FIXME
bool ChangeCitationsIfUnique(string const & from, string const & to);
/// get the contents of the window system clipboard
string const getClipboard() const;
/// fill the window system clipboard
void stuffClipboard(string const &) const;
/// tell the window system we have a selection
void haveSelection(bool sel);
/// execute the given function
bool dispatch(FuncRequest const & argument);
private:
///
/// Set the current locking inset
void theLockingInset(UpdatableInset * inset);
/// return the lyxtext containing this inset
LyXText * getParentText(Inset * inset) const;
/**
* Change all insets with the given code's contents to a new
* string. May only be used with InsetCommand-derived insets
* Returns true if a screen update is needed.
*/
bool ChangeInsets(Inset::Code code, string const & from,
string const & to);
struct Pimpl;
///
friend struct BufferView::Pimpl;
///
Pimpl * pimpl_;
};
///
BufferView::UpdateCodes operator|(BufferView::UpdateCodes uc1,
BufferView::UpdateCodes uc2);
#endif
#endif // BUFFERVIEW_H

View File

@ -1,3 +1,26 @@
2002-10-21 John Levon <levon@movementarian.org>
* BufferView.C: menuUndo ->undo, redo
* BufferView.h: document, remove dead, make some methods private
* paragraph_funcs.h:
* paragraph_funcs.C:
* CutAndPaste.C: s/pasteParagraph/mergeParagraph
* buffer.h:
* buffer.C:
* sgml.h:
* sgml.C: move sgml open/close tag into sgml.C
* bufferview_funcs.h: unused prototype
* lyxfunc.h:
* lyxfunc.C: remove unused
* lyxtext.h:
* text.C: remove unused
2002-10-21 John Levon <levon@movementarian.org>
* BufferView.h:

View File

@ -149,7 +149,7 @@ bool CutAndPaste::cutSelection(Paragraph * startpar, Paragraph ** endpar,
startpar->next()->stripLeadingSpaces();
if (startpar->hasSameLayout(startpar->next()) ||
startpar->next()->empty()) {
pasteParagraph(current_view->buffer()->params, startpar);
mergeParagraph(current_view->buffer()->params, startpar);
(*endpar) = startpar; // this because endpar gets deleted here!
}
// this paragraph's are of noone's owner!
@ -365,20 +365,20 @@ bool CutAndPaste::pasteSelection(Paragraph ** par, Paragraph ** endpar,
if ((*par)->next() == lastbuffer)
lastbuffer = *par;
pasteParagraph(current_view->buffer()->params, *par);
mergeParagraph(current_view->buffer()->params, *par);
// store the new cursor position
*par = lastbuffer;
pos = lastbuffer->size();
// maybe some pasting
if (lastbuffer->next() && paste_the_end) {
if (lastbuffer->next()->hasSameLayout(lastbuffer)) {
pasteParagraph(current_view->buffer()->params, lastbuffer);
mergeParagraph(current_view->buffer()->params, lastbuffer);
} else if (lastbuffer->next()->empty()) {
lastbuffer->next()->makeSameLayout(lastbuffer);
pasteParagraph(current_view->buffer()->params, lastbuffer);
mergeParagraph(current_view->buffer()->params, lastbuffer);
} else if (lastbuffer->empty()) {
lastbuffer->makeSameLayout(lastbuffer->next());
pasteParagraph(current_view->buffer()->params, lastbuffer);
mergeParagraph(current_view->buffer()->params, lastbuffer);
} else
lastbuffer->next()->stripLeadingSpaces();
}

View File

@ -199,7 +199,7 @@ string const Buffer::getLatexName(bool no_path) const
}
pair<Buffer::LogType, string> const Buffer::getLogName(void) const
pair<Buffer::LogType, string> const Buffer::getLogName() const
{
string const filename = getLatexName(false);
@ -2201,38 +2201,6 @@ bool Buffer::isSGML() const
}
int Buffer::sgmlOpenTag(ostream & os, Paragraph::depth_type depth, bool mixcont,
string const & latexname) const
{
if (!latexname.empty() && latexname != "!-- --") {
if (!mixcont)
os << string(" ",depth);
os << "<" << latexname << ">";
}
if (!mixcont)
os << endl;
return mixcont?0:1;
}
int Buffer::sgmlCloseTag(ostream & os, Paragraph::depth_type depth, bool mixcont,
string const & latexname) const
{
if (!latexname.empty() && latexname != "!-- --") {
if (!mixcont)
os << endl << string(" ",depth);
os << "</" << latexname << ">";
}
if (!mixcont)
os << endl;
return mixcont?0:1;
}
void Buffer::makeLinuxDocFile(string const & fname, bool nice, bool body_only)
{
ofstream ofs(fname.c_str());
@ -2269,12 +2237,12 @@ void Buffer::makeLinuxDocFile(string const & fname, bool nice, bool body_only)
ofs << ">\n\n";
if (params.options.empty())
sgmlOpenTag(ofs, 0, false, top_element);
sgml::openTag(ofs, 0, false, top_element);
else {
string top = top_element;
top += " ";
top += params.options;
sgmlOpenTag(ofs, 0, false, top);
sgml::openTag(ofs, 0, false, top);
}
}
@ -2295,7 +2263,7 @@ void Buffer::makeLinuxDocFile(string const & fname, bool nice, bool body_only)
Inset::Code lyx_code = inset->lyxCode();
if (lyx_code == Inset::TOC_CODE) {
string const temp = "toc";
sgmlOpenTag(ofs, depth, false, temp);
sgml::openTag(ofs, depth, false, temp);
par = par->next();
continue;
@ -2304,7 +2272,7 @@ void Buffer::makeLinuxDocFile(string const & fname, bool nice, bool body_only)
// environment tag closing
for (; depth > par->params().depth(); --depth) {
sgmlCloseTag(ofs, depth, false, environment_stack[depth]);
sgml::closeTag(ofs, depth, false, environment_stack[depth]);
environment_stack[depth].erase();
}
@ -2313,14 +2281,14 @@ void Buffer::makeLinuxDocFile(string const & fname, bool nice, bool body_only)
case LATEX_PARAGRAPH:
if (depth == par->params().depth()
&& !environment_stack[depth].empty()) {
sgmlCloseTag(ofs, depth, false, environment_stack[depth]);
sgml::closeTag(ofs, depth, false, environment_stack[depth]);
environment_stack[depth].erase();
if (depth)
--depth;
else
ofs << "</p>";
}
sgmlOpenTag(ofs, depth, false, style->latexname());
sgml::openTag(ofs, depth, false, style->latexname());
break;
case LATEX_COMMAND:
@ -2330,12 +2298,12 @@ void Buffer::makeLinuxDocFile(string const & fname, bool nice, bool body_only)
" LatexType Command.\n"));
if (!environment_stack[depth].empty()) {
sgmlCloseTag(ofs, depth, false, environment_stack[depth]);
sgml::closeTag(ofs, depth, false, environment_stack[depth]);
ofs << "</p>";
}
environment_stack[depth].erase();
sgmlOpenTag(ofs, depth, false, style->latexname());
sgml::openTag(ofs, depth, false, style->latexname());
break;
case LATEX_ENVIRONMENT:
@ -2345,7 +2313,7 @@ void Buffer::makeLinuxDocFile(string const & fname, bool nice, bool body_only)
if (depth == par->params().depth()
&& environment_stack[depth] != latexname) {
sgmlCloseTag(ofs, depth, false,
sgml::closeTag(ofs, depth, false,
environment_stack[depth]);
environment_stack[depth].erase();
}
@ -2355,9 +2323,9 @@ void Buffer::makeLinuxDocFile(string const & fname, bool nice, bool body_only)
}
if (environment_stack[depth] != latexname) {
if (depth == 0) {
sgmlOpenTag(ofs, depth, false, "p");
sgml::openTag(ofs, depth, false, "p");
}
sgmlOpenTag(ofs, depth, false, latexname);
sgml::openTag(ofs, depth, false, latexname);
if (environment_stack.size() == depth + 1)
environment_stack.push_back("!-- --");
@ -2374,12 +2342,12 @@ void Buffer::makeLinuxDocFile(string const & fname, bool nice, bool body_only)
else
item_name = "item";
sgmlOpenTag(ofs, depth + 1, false, item_name);
sgml::openTag(ofs, depth + 1, false, item_name);
}
break;
default:
sgmlOpenTag(ofs, depth, false, style->latexname());
sgml::openTag(ofs, depth, false, style->latexname());
break;
}
@ -2398,18 +2366,18 @@ void Buffer::makeLinuxDocFile(string const & fname, bool nice, bool body_only)
ofs << "]]>";
break;
default:
sgmlCloseTag(ofs, depth, false, style->latexname());
sgml::closeTag(ofs, depth, false, style->latexname());
break;
}
}
// Close open tags
for (int i = depth; i >= 0; --i)
sgmlCloseTag(ofs, depth, false, environment_stack[i]);
sgml::closeTag(ofs, depth, false, environment_stack[i]);
if (!body_only) {
ofs << "\n\n";
sgmlCloseTag(ofs, 0, false, top_element);
sgml::closeTag(ofs, 0, false, top_element);
}
ofs.close();
@ -2735,7 +2703,7 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body)
top += " ";
top += params.options;
}
sgmlOpenTag(ofs, 0, false, top);
sgml::openTag(ofs, 0, false, top);
ofs << "<!-- DocBook file was created by " << lyx_docversion
<< "\n See http://www.lyx.org/ for more information -->\n";
@ -2765,11 +2733,11 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body)
for (; depth > par->params().depth(); --depth) {
if (environment_inner[depth] != "!-- --") {
item_name = "listitem";
sgmlCloseTag(ofs, command_depth + depth, false, item_name);
sgml::closeTag(ofs, command_depth + depth, false, item_name);
if (environment_inner[depth] == "varlistentry")
sgmlCloseTag(ofs, depth+command_depth, false, environment_inner[depth]);
sgml::closeTag(ofs, depth+command_depth, false, environment_inner[depth]);
}
sgmlCloseTag(ofs, depth + command_depth, false, environment_stack[depth]);
sgml::closeTag(ofs, depth + command_depth, false, environment_stack[depth]);
environment_stack[depth].erase();
environment_inner[depth].erase();
}
@ -2779,12 +2747,12 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body)
&& !environment_stack[depth].empty()) {
if (environment_inner[depth] != "!-- --") {
item_name= "listitem";
sgmlCloseTag(ofs, command_depth+depth, false, item_name);
sgml::closeTag(ofs, command_depth+depth, false, item_name);
if (environment_inner[depth] == "varlistentry")
sgmlCloseTag(ofs, depth + command_depth, false, environment_inner[depth]);
sgml::closeTag(ofs, depth + command_depth, false, environment_inner[depth]);
}
sgmlCloseTag(ofs, depth + command_depth, false, environment_stack[depth]);
sgml::closeTag(ofs, depth + command_depth, false, environment_stack[depth]);
environment_stack[depth].erase();
environment_inner[depth].erase();
@ -2793,7 +2761,7 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body)
// Write opening SGML tags.
switch (style->latextype) {
case LATEX_PARAGRAPH:
sgmlOpenTag(ofs, depth + command_depth,
sgml::openTag(ofs, depth + command_depth,
false, style->latexname());
break;
@ -2814,14 +2782,14 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body)
if (cmd_depth < command_base) {
for (Paragraph::depth_type j = command_depth;
j >= command_base; --j) {
sgmlCloseTag(ofs, j, false, command_stack[j]);
sgml::closeTag(ofs, j, false, command_stack[j]);
ofs << endl;
}
command_depth = command_base = cmd_depth;
} else if (cmd_depth <= command_depth) {
for (int j = command_depth;
j >= int(cmd_depth); --j) {
sgmlCloseTag(ofs, j, false, command_stack[j]);
sgml::closeTag(ofs, j, false, command_stack[j]);
ofs << endl;
}
command_depth = cmd_depth;
@ -2850,10 +2818,10 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body)
}
}
sgmlOpenTag(ofs, depth + command_depth, false, command_name);
sgml::openTag(ofs, depth + command_depth, false, command_name);
item_name = c_params.empty()?"title":c_params;
sgmlOpenTag(ofs, depth + 1 + command_depth, false, item_name);
sgml::openTag(ofs, depth + 1 + command_depth, false, item_name);
break;
case LATEX_ENVIRONMENT:
@ -2870,13 +2838,13 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body)
}
environment_stack[depth] = style->latexname();
environment_inner[depth] = "!-- --";
sgmlOpenTag(ofs, depth + command_depth, false, environment_stack[depth]);
sgml::openTag(ofs, depth + command_depth, false, environment_stack[depth]);
} else {
if (environment_inner[depth] != "!-- --") {
item_name= "listitem";
sgmlCloseTag(ofs, command_depth + depth, false, item_name);
sgml::closeTag(ofs, command_depth + depth, false, item_name);
if (environment_inner[depth] == "varlistentry")
sgmlCloseTag(ofs, depth + command_depth, false, environment_inner[depth]);
sgml::closeTag(ofs, depth + command_depth, false, environment_inner[depth]);
}
}
@ -2885,7 +2853,7 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body)
if (style->latexparam() == "CDATA")
ofs << "<![CDATA[";
else
sgmlOpenTag(ofs, depth + command_depth, false, style->latexparam());
sgml::openTag(ofs, depth + command_depth, false, style->latexparam());
}
break;
}
@ -2893,15 +2861,15 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body)
desc_on = (style->labeltype == LABEL_MANUAL);
environment_inner[depth] = desc_on ? "varlistentry" : "listitem";
sgmlOpenTag(ofs, depth + 1 + command_depth,
sgml::openTag(ofs, depth + 1 + command_depth,
false, environment_inner[depth]);
item_name = desc_on ? "term" : "para";
sgmlOpenTag(ofs, depth + 1 + command_depth,
sgml::openTag(ofs, depth + 1 + command_depth,
false, item_name);
break;
default:
sgmlOpenTag(ofs, depth + command_depth,
sgml::openTag(ofs, depth + command_depth,
false, style->latexname());
break;
}
@ -2915,7 +2883,7 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body)
switch (style->latextype) {
case LATEX_COMMAND:
end_tag = c_params.empty() ? "title" : c_params;
sgmlCloseTag(ofs, depth + command_depth,
sgml::closeTag(ofs, depth + command_depth,
false, end_tag);
break;
case LATEX_ENVIRONMENT:
@ -2923,19 +2891,19 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body)
if (style->latexparam() == "CDATA")
ofs << "]]>";
else
sgmlCloseTag(ofs, depth + command_depth, false, style->latexparam());
sgml::closeTag(ofs, depth + command_depth, false, style->latexparam());
}
break;
case LATEX_ITEM_ENVIRONMENT:
if (desc_on == 1) break;
end_tag= "para";
sgmlCloseTag(ofs, depth + 1 + command_depth, false, end_tag);
sgml::closeTag(ofs, depth + 1 + command_depth, false, end_tag);
break;
case LATEX_PARAGRAPH:
sgmlCloseTag(ofs, depth + command_depth, false, style->latexname());
sgml::closeTag(ofs, depth + command_depth, false, style->latexname());
break;
default:
sgmlCloseTag(ofs, depth + command_depth, false, style->latexname());
sgml::closeTag(ofs, depth + command_depth, false, style->latexname());
break;
}
}
@ -2945,23 +2913,23 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body)
if (!environment_stack[depth].empty()) {
if (environment_inner[depth] != "!-- --") {
item_name = "listitem";
sgmlCloseTag(ofs, command_depth + depth, false, item_name);
sgml::closeTag(ofs, command_depth + depth, false, item_name);
if (environment_inner[depth] == "varlistentry")
sgmlCloseTag(ofs, depth + command_depth, false, environment_inner[depth]);
sgml::closeTag(ofs, depth + command_depth, false, environment_inner[depth]);
}
sgmlCloseTag(ofs, depth + command_depth, false, environment_stack[depth]);
sgml::closeTag(ofs, depth + command_depth, false, environment_stack[depth]);
}
}
for (int j = command_depth; j >= 0 ; --j)
if (!command_stack[j].empty()) {
sgmlCloseTag(ofs, j, false, command_stack[j]);
sgml::closeTag(ofs, j, false, command_stack[j]);
ofs << endl;
}
ofs << "\n\n";
sgmlCloseTag(ofs, 0, false, top_element);
sgml::closeTag(ofs, 0, false, top_element);
ofs.close();
// How to check for successful close

View File

@ -177,12 +177,6 @@ public:
///
void makeDocBookFile(string const & filename,
bool nice, bool only_body = false);
/// Open SGML/XML tag.
int sgmlOpenTag(std::ostream & os, Paragraph::depth_type depth, bool mixcont,
string const & latexname) const;
/// Closes SGML/XML tag.
int sgmlCloseTag(std::ostream & os, Paragraph::depth_type depth, bool mixcont,
string const & latexname) const;
///
void sgmlError(Paragraph * par, int pos, string const & message) const;

View File

@ -29,8 +29,6 @@ extern void bold(BufferView *);
///
extern void noun(BufferView *);
///
extern void table();
///
extern void lang(BufferView *, string const &);
///
extern void number(BufferView *);

View File

@ -1,3 +1,9 @@
2002-10-21 John Levon <levon@movementarian.org>
* inset.h: remove unused DISPATCH_RESULT
* insettext.C: sgml open/close tag now in sgml namespace
2002-10-21 Angus Leeming <leeming@lyx.org>
* insetgraphics.C (draw): Fix the drawing of an inset with a relative

View File

@ -171,11 +171,6 @@ public:
FINISHED_DOWN
};
/// To convert old binary dispatch results
RESULT DISPATCH_RESULT(bool b) {
return b ? DISPATCHED : FINISHED;
}
///
Inset();
///

View File

@ -38,6 +38,7 @@
#include "undo_funcs.h"
#include "WordLangTuple.h"
#include "paragraph_funcs.h"
#include "sgml.h"
#include "frontends/Alert.h"
#include "frontends/Dialogs.h"
@ -1631,11 +1632,11 @@ int InsetText::docbook(Buffer const * buf, ostream & os, bool mixcont) const
for (; depth > p->params().depth(); --depth) {
if (environment_inner[depth] != "!-- --") {
item_name = "listitem";
lines += buf->sgmlCloseTag(os, command_depth + depth, mixcont, item_name);
lines += sgml::closeTag(os, command_depth + depth, mixcont, item_name);
if (environment_inner[depth] == "varlistentry")
lines += buf->sgmlCloseTag(os, depth+command_depth, mixcont, environment_inner[depth]);
lines += sgml::closeTag(os, depth+command_depth, mixcont, environment_inner[depth]);
}
lines += buf->sgmlCloseTag(os, depth + command_depth, mixcont, environment_stack[depth]);
lines += sgml::closeTag(os, depth + command_depth, mixcont, environment_stack[depth]);
environment_stack[depth].erase();
environment_inner[depth].erase();
}
@ -1645,12 +1646,12 @@ int InsetText::docbook(Buffer const * buf, ostream & os, bool mixcont) const
&& !environment_stack[depth].empty()) {
if (environment_inner[depth] != "!-- --") {
item_name= "listitem";
lines += buf->sgmlCloseTag(os, command_depth+depth, mixcont, item_name);
lines += sgml::closeTag(os, command_depth+depth, mixcont, item_name);
if (environment_inner[depth] == "varlistentry")
lines += buf->sgmlCloseTag(os, depth + command_depth, mixcont, environment_inner[depth]);
lines += sgml::closeTag(os, depth + command_depth, mixcont, environment_inner[depth]);
}
lines += buf->sgmlCloseTag(os, depth + command_depth, mixcont, environment_stack[depth]);
lines += sgml::closeTag(os, depth + command_depth, mixcont, environment_stack[depth]);
environment_stack[depth].erase();
environment_inner[depth].erase();
@ -1659,7 +1660,7 @@ int InsetText::docbook(Buffer const * buf, ostream & os, bool mixcont) const
// Write opening SGML tags.
switch (style->latextype) {
case LATEX_PARAGRAPH:
lines += buf->sgmlOpenTag(os, depth + command_depth, mixcont, style->latexname());
lines += sgml::openTag(os, depth + command_depth, mixcont, style->latexname());
break;
case LATEX_COMMAND:
@ -1681,13 +1682,13 @@ int InsetText::docbook(Buffer const * buf, ostream & os, bool mixcont) const
}
environment_stack[depth] = style->latexname();
environment_inner[depth] = "!-- --";
lines += buf->sgmlOpenTag(os, depth + command_depth, mixcont, environment_stack[depth]);
lines += sgml::openTag(os, depth + command_depth, mixcont, environment_stack[depth]);
} else {
if (environment_inner[depth] != "!-- --") {
item_name= "listitem";
lines += buf->sgmlCloseTag(os, command_depth + depth, mixcont, item_name);
lines += sgml::closeTag(os, command_depth + depth, mixcont, item_name);
if (environment_inner[depth] == "varlistentry")
lines += buf->sgmlCloseTag(os, depth + command_depth, mixcont, environment_inner[depth]);
lines += sgml::closeTag(os, depth + command_depth, mixcont, environment_inner[depth]);
}
}
@ -1696,7 +1697,7 @@ int InsetText::docbook(Buffer const * buf, ostream & os, bool mixcont) const
if (style->latexparam() == "CDATA")
os << "<![CDATA[";
else
lines += buf->sgmlOpenTag(os, depth + command_depth, mixcont, style->latexparam());
lines += sgml::openTag(os, depth + command_depth, mixcont, style->latexparam());
}
break;
}
@ -1704,14 +1705,14 @@ int InsetText::docbook(Buffer const * buf, ostream & os, bool mixcont) const
desc_on = (style->labeltype == LABEL_MANUAL);
environment_inner[depth] = desc_on?"varlistentry":"listitem";
lines += buf->sgmlOpenTag(os, depth + 1 + command_depth, mixcont, environment_inner[depth]);
lines += sgml::openTag(os, depth + 1 + command_depth, mixcont, environment_inner[depth]);
item_name = desc_on?"term":"para";
lines += buf->sgmlOpenTag(os, depth + 1 + command_depth, mixcont, item_name);
lines += sgml::openTag(os, depth + 1 + command_depth, mixcont, item_name);
break;
default:
lines += buf->sgmlOpenTag(os, depth + command_depth, mixcont, style->latexname());
lines += sgml::openTag(os, depth + command_depth, mixcont, style->latexname());
break;
}
@ -1726,19 +1727,19 @@ int InsetText::docbook(Buffer const * buf, ostream & os, bool mixcont) const
if (style->latexparam() == "CDATA")
os << "]]>";
else
lines += buf->sgmlCloseTag(os, depth + command_depth, mixcont, style->latexparam());
lines += sgml::closeTag(os, depth + command_depth, mixcont, style->latexparam());
}
break;
case LATEX_ITEM_ENVIRONMENT:
if (desc_on == 1) break;
end_tag= "para";
lines += buf->sgmlCloseTag(os, depth + 1 + command_depth, mixcont, end_tag);
lines += sgml::closeTag(os, depth + 1 + command_depth, mixcont, end_tag);
break;
case LATEX_PARAGRAPH:
lines += buf->sgmlCloseTag(os, depth + command_depth, mixcont, style->latexname());
lines += sgml::closeTag(os, depth + command_depth, mixcont, style->latexname());
break;
default:
lines += buf->sgmlCloseTag(os, depth + command_depth, mixcont, style->latexname());
lines += sgml::closeTag(os, depth + command_depth, mixcont, style->latexname());
break;
}
}
@ -1748,12 +1749,12 @@ int InsetText::docbook(Buffer const * buf, ostream & os, bool mixcont) const
if (!environment_stack[depth].empty()) {
if (environment_inner[depth] != "!-- --") {
item_name = "listitem";
lines += buf->sgmlCloseTag(os, command_depth + depth, mixcont, item_name);
lines += sgml::closeTag(os, command_depth + depth, mixcont, item_name);
if (environment_inner[depth] == "varlistentry")
lines += buf->sgmlCloseTag(os, depth + command_depth, mixcont, environment_inner[depth]);
lines += sgml::closeTag(os, depth + command_depth, mixcont, environment_inner[depth]);
}
lines += buf->sgmlCloseTag(os, depth + command_depth, mixcont, environment_stack[depth]);
lines += sgml::closeTag(os, depth + command_depth, mixcont, environment_stack[depth]);
}
}
@ -2763,7 +2764,7 @@ void InsetText::collapseParagraphs(BufferView * bv) const
llt->selection.end.pos() + paragraphs.begin()->size());
}
}
pasteParagraph(bparams, &*paragraphs.begin());
mergeParagraph(bparams, &*paragraphs.begin());
}
reinitLyXText();
}
@ -2805,7 +2806,7 @@ void InsetText::appendParagraphs(BufferParams const & bparams,
// paste it!
lastbuffer->next(buf);
buf->previous(lastbuffer);
pasteParagraph(bparams, lastbuffer);
mergeParagraph(bparams, lastbuffer);
reinitLyXText();
}

View File

@ -100,11 +100,9 @@ extern void ShowLatexLog();
LyXFunc::LyXFunc(LyXView * o)
: owner(o),
keyseq(toplevel_keymap.get(), toplevel_keymap.get()),
cancel_meta_seq(toplevel_keymap.get(), toplevel_keymap.get())
cancel_meta_seq(toplevel_keymap.get(), toplevel_keymap.get()),
meta_fake_bit(key_modifier::none)
{
meta_fake_bit = key_modifier::none;
lyx_dead_action = LFUN_NOACTION;
lyx_calling_dead_action = LFUN_NOACTION;
}
@ -742,10 +740,10 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose)
}
// Undo/Redo is a bit tricky for insets.
if (action == LFUN_UNDO) {
view()->menuUndo();
view()->undo();
goto exit_with_message;
} else if (action == LFUN_REDO) {
view()->menuRedo();
view()->redo();
goto exit_with_message;
} else if (((result=inset->
// Hand-over to inset's own dispatch:
@ -1031,11 +1029,11 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose)
break;
case LFUN_UNDO:
view()->menuUndo();
view()->undo();
break;
case LFUN_REDO:
view()->menuRedo();
view()->redo();
break;
case LFUN_MENUSEARCH:

View File

@ -78,8 +78,6 @@ private:
///
LyXView * owner;
///
static int psd_idx;
///
kb_sequence keyseq;
///
kb_sequence cancel_meta_seq;
@ -89,10 +87,6 @@ private:
void moveCursorUpdate(bool flag = true, bool selecting = false);
///
void setupLocalKeymap();
///
kb_action lyx_dead_action;
///
kb_action lyx_calling_dead_action;
/// Error status, only Dispatch can change this flag
mutable bool errorstat;

View File

@ -175,13 +175,7 @@ public:
///
mutable int refresh_y;
///
int refresh_width;
///
int refresh_x;
///
mutable Row * refresh_row;
///
lyx::pos_type refresh_pos;
/// give and set the LyXText status
text_status status() const;

View File

@ -125,13 +125,8 @@ void breakParagraphConservative(BufferParams const & bparams,
}
// Be carefull, this does not make any check at all.
// This method has wrong name, it combined this par with the next par.
// In that sense it is the reverse of break paragraph. (Lgb)
void pasteParagraph(BufferParams const & bparams,
Paragraph * par)
void mergeParagraph(BufferParams const & bparams, Paragraph * par)
{
// copy the next paragraph to this one
Paragraph * the_next = par->next();
// first the DTP-stuff

View File

@ -28,11 +28,11 @@ void breakParagraphConservative(BufferParams const & bparams,
Paragraph *,
lyx::pos_type pos);
/** Paste this paragraph with the next one.
Be carefull, this doesent make any check at all.
*/
void pasteParagraph(BufferParams const & bparams,
Paragraph *);
/**
* Append the next paragraph onto the tail of this one.
* Be careful, this doesent make any check at all.
*/
void mergeParagraph(BufferParams const & bparams, Paragraph *);
#if 0

View File

@ -7,11 +7,17 @@
* \author John Levon <levon@movementarian.org>
*/
#include "sgml.h"
#include <config.h>
#include "support/LOstream.h"
#include "paragraph.h"
#include "sgml.h"
using std::pair;
using std::make_pair;
using std::ostream;
using std::endl;
namespace sgml {
@ -77,4 +83,36 @@ pair<bool, string> escapeChar(char c)
return make_pair(false, str);
}
int openTag(ostream & os, Paragraph::depth_type depth,
bool mixcont, string const & latexname)
{
if (!latexname.empty() && latexname != "!-- --") {
if (!mixcont)
os << string(" ", depth);
os << "<" << latexname << ">";
}
if (!mixcont)
os << endl;
return !mixcont;
}
int closeTag(ostream & os, Paragraph::depth_type depth,
bool mixcont, string const & latexname)
{
if (!latexname.empty() && latexname != "!-- --") {
if (!mixcont)
os << endl << string(" ", depth);
os << "</" << latexname << ">";
}
if (!mixcont)
os << endl;
return !mixcont;
}
} // namespace sgml

View File

@ -10,21 +10,27 @@
#ifndef SGML_H
#define SGML_H
#include <config.h>
#include "LString.h"
#include <algorithm>
#include <iosfwd>
namespace sgml {
/**
* Escape the given character if necessary
* to an SGML entity. The bool return is true
* to an SGML entity. Returns true
* if it was a whitespace character.
*/
std::pair<bool, string> escapeChar(char c);
/// FIXME
int openTag(std::ostream & os, Paragraph::depth_type depth,
bool mixcont, string const & latexname);
/// FIXME
int closeTag(std::ostream & os, Paragraph::depth_type depth,
bool mixcont, string const & latexname);
}
#endif // SGML_H

View File

@ -2026,11 +2026,10 @@ void LyXText::insertChar(BufferView * bview, char c)
// we would not get a rebreak!
row->fill(fill(bview, row, workWidth(bview)));
}
if (c == Paragraph::META_INSET || row->fill() < 0) {
refresh_y = y;
refresh_row = row;
refresh_x = cursor.x();
refresh_pos = cursor.pos();
status(bview, LyXText::NEED_MORE_REFRESH);
breakAgainOneRow(bview, row);
// will the cursor be in another row now?
@ -2055,9 +2054,7 @@ void LyXText::insertChar(BufferView * bview, char c)
need_break_row = 0;
} else {
refresh_y = y;
refresh_x = cursor.x();
refresh_row = row;
refresh_pos = cursor.pos();
int const tmpheight = row->height();
setHeightOfRow(bview, row);
@ -2789,7 +2786,7 @@ void LyXText::backspace(BufferView * bview)
&& cursor.par()->getAlign() == tmppar->getAlign()) {
removeParagraph(tmprow);
removeRow(tmprow);
pasteParagraph(bview->buffer()->params, cursor.par());
mergeParagraph(bview->buffer()->params, cursor.par());
if (!cursor.pos() || !cursor.par()->isSeparator(cursor.pos() - 1))
; //cursor.par()->insertChar(cursor.pos(), ' ');