git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4417 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2002-06-18 15:44:30 +00:00
parent 978f922832
commit f1c24d1009
186 changed files with 4155 additions and 2934 deletions

View File

@ -41,7 +41,7 @@ Buffer * BufferView::buffer() const
}
LScreen & BufferView::screen() const
LyXScreen & BufferView::screen() const
{
return pimpl_->screen();
}

View File

@ -25,7 +25,7 @@ class LyXView;
class LyXText;
class TeXErrors;
class Buffer;
class LScreen;
class LyXScreen;
class Language;
class Painter;
class UpdatableInset;
@ -54,7 +54,7 @@ public:
///
Painter & painter() const;
///
LScreen & screen() const;
LyXScreen & screen() const;
///
void buffer(Buffer * b);
///

View File

@ -564,7 +564,7 @@ void BufferView::showLockedInsetCursor(int x, int y, int asc, int desc)
locking_inset))
text->setCursor(this, cursor,
cursor.par(), cursor.pos() - 1);
LScreen::Cursor_Shape shape = LScreen::BAR_SHAPE;
LyXScreen::Cursor_Shape shape = LyXScreen::BAR_SHAPE;
LyXText * txt = getLyXText();
if (locking_inset->isTextInset() &&
locking_inset->lyxCode() != Inset::ERT_CODE &&
@ -573,8 +573,8 @@ void BufferView::showLockedInsetCursor(int x, int y, int asc, int desc)
|| txt->real_current_font.isVisibleRightToLeft()
!= buffer()->params.language->RightToLeft()))
shape = (txt->real_current_font.isVisibleRightToLeft())
? LScreen::REVERSED_L_SHAPE
: LScreen::L_SHAPE;
? LyXScreen::REVERSED_L_SHAPE
: LyXScreen::L_SHAPE;
y += cursor.iy() + theLockingInset()->insetInInsetY();
screen().showManualCursor(text, x, y, asc, desc,
shape);
@ -594,7 +594,7 @@ bool BufferView::fitLockedInsetCursor(int x, int y, int asc, int desc)
{
if (theLockingInset() && available()) {
y += text->cursor.iy() + theLockingInset()->insetInInsetY();
if (screen().fitManualCursor(text, this, x, y, asc, desc)) {
if (screen().fitManualCursor(this, text, x, y, asc, desc)) {
updateScrollbar();
return true;
}

View File

@ -15,6 +15,8 @@
#include "BufferView_pimpl.h"
#include "frontends/WorkArea.h"
#include "frontends/screen.h"
#include "frontends/LyXScreenFactory.h"
#include "frontends/WorkAreaFactory.h"
#include "frontends/Dialogs.h"
#include "frontends/Alert.h"
#include "frontends/FileDialog.h"
@ -117,25 +119,6 @@ namespace {
const unsigned int saved_positions_num = 20;
inline
void waitForX()
{
XSync(fl_get_display(), 0);
}
void SetXtermCursor(Window win)
{
static Cursor cursor;
static bool cursor_undefined = true;
if (cursor_undefined) {
cursor = XCreateFontCursor(fl_get_display(), XC_xterm);
XFlush(fl_get_display());
cursor_undefined = false;
}
XDefineCursor(fl_get_display(), win, cursor);
XFlush(fl_get_display());
}
} // anon namespace
@ -145,8 +128,8 @@ BufferView::Pimpl::Pimpl(BufferView * b, LyXView * o,
: bv_(b), owner_(o), buffer_(0), cursor_timeout(400),
using_xterm_cursor(false)
{
workarea_.reset(new WorkArea(xpos, ypos, width, height));
screen_.reset(new LScreen(workarea()));
workarea_.reset(WorkAreaFactory::create(xpos, ypos, width, height));
screen_.reset(LyXScreenFactory::create(workarea()));
// Setup the signals
workarea().scrollDocView.connect(boost::bind(&BufferView::Pimpl::scrollDocView, this, _1));
@ -182,7 +165,7 @@ WorkArea & BufferView::Pimpl::workarea() const
}
LScreen & BufferView::Pimpl::screen() const
LyXScreen & BufferView::Pimpl::screen() const
{
return *screen_.get();
}
@ -408,7 +391,7 @@ int BufferView::Pimpl::resizeCurrentBuffer()
void BufferView::Pimpl::updateScreen()
{
// Regenerate the screen.
screen().reset();
screen().redraw(bv_->text, bv_);
}
@ -435,7 +418,6 @@ void BufferView::Pimpl::scrollDocView(int value)
screen().draw(bv_->text, bv_, value);
if (!lyxrc.cursor_follows_scrollbar) {
waitForX();
return;
}
@ -449,8 +431,6 @@ void BufferView::Pimpl::scrollDocView(int value)
vbt->setCursorFromCoordinates(bv_, 0, first);
else if (vbt->cursor.y() > last)
vbt->setCursorFromCoordinates(bv_, 0, last);
waitForX();
}
@ -470,7 +450,8 @@ int BufferView::Pimpl::scroll(long time)
}
void BufferView::Pimpl::workAreaKeyPress(KeySym key, key_modifier::state state)
void BufferView::Pimpl::workAreaKeyPress(LyXKeySymPtr key,
key_modifier::state state)
{
bv_->owner()->getLyXFunc()->processKeySym(key, state);
}
@ -2545,7 +2526,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
LyXText * lt = bv_->getLyXText();
if (!lt->selection.set()) {
if (owner_->getIntl()->getTrans().backspace()) {
if (owner_->getIntl()->getTransManager().backspace()) {
lt->backspace(bv_);
lt->selection.cursor = lt->cursor;
update(lt,
@ -2930,7 +2911,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
owner_->getLyXFunc()->handleKeyFunc(action);
} else {
owner_->getLyXFunc()->handleKeyFunc(action);
owner_->getIntl()->getTrans()
owner_->getIntl()->getTransManager()
.TranslateAndInsert(argument[0], bv_->getLyXText());
update(bv_->getLyXText(),
BufferView::SELECT
@ -2939,6 +2920,10 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
}
break;
case LFUN_MATH:
mathDispatch(bv_, argument);
break;
case LFUN_MATH_MACRO:
mathDispatchMathMacro(bv_, argument);
break;
@ -3174,7 +3159,8 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
string::const_iterator cit = argument.begin();
string::const_iterator end = argument.end();
for (; cit != end; ++cit) {
owner_->getIntl()->getTrans().TranslateAndInsert(*cit, lt);
owner_->getIntl()->getTransManager().
TranslateAndInsert(*cit, lt);
}
bv_->update(lt,

View File

@ -15,6 +15,7 @@
#include "frontends/Timeout.h"
#include "frontends/key_state.h"
#include "frontends/mouse_state.h"
#include "frontends/LyXKeySym.h"
#include "box.h"
#include "insets/insetspecialchar.h"
#include "support/types.h"
@ -28,10 +29,7 @@
class LyXView;
class WorkArea;
class LScreen;
// FIXME: remove
#include <X11/Xlib.h>
class LyXScreen;
///
struct BufferView::Pimpl : public boost::signals::trackable {
@ -43,7 +41,7 @@ struct BufferView::Pimpl : public boost::signals::trackable {
/// return the work area for this bview
WorkArea & workarea() const;
/// return the screen for this bview
LScreen & screen() const;
LyXScreen & screen() const;
///
void buffer(Buffer *);
///
@ -79,7 +77,8 @@ struct BufferView::Pimpl : public boost::signals::trackable {
/// wheel mouse scroll
int scroll(long time);
///
void workAreaKeyPress(KeySym key, key_modifier::state state);
void workAreaKeyPress(LyXKeySymPtr key,
key_modifier::state state);
///
void workAreaMotionNotify(int x, int y, mouse_button::state state);
///
@ -172,7 +171,7 @@ private:
///
Buffer * buffer_;
///
boost::scoped_ptr<LScreen> screen_;
boost::scoped_ptr<LyXScreen> screen_;
///
boost::scoped_ptr<WorkArea> workarea_;
///

View File

@ -1,3 +1,39 @@
2002-06-16 <alstrup@diku.dk>
* BufferView_pimpl.C (Pimpl): Use WorkAreaFactory.
Got rid of FORMS_H_LOCATION include. Now we are
GUII.
2002-06-15 LyX Development team <lyx@rilke>
* buffer.[Ch] (sgmlOpenTag):
(sgmlCloseTag): Added support for avoiding pernicious mixed
content. Return number of lines written.
(makeLinuxDocFile):
(makeDocBookFile): Fixed calls to sgml*Tag.
Simple white space clean.
(simpleDocBookOnePar): Simple white space clean.
* tabular.[Ch] (docBook): Renamed to docbook and got another
argument to related with the pernicious mixed content.
(docbookRow): Fixed calls for docbook inset method.
2002-06-15 Lyx Development team <larsbj@birdstep.com>
* lyxfunc.[Ch]: Use LyXKeySym instead of KeySym,
so it's X11 independent.
* kb*.[Ch]: ditto.
* BufferView_pimpl.[Ch] (workAreaKeyPress): ditto.
2002-06-15 Lyx Development team <lyx@electronia>
* intl.h: Renamed getTrans to getTransManager.
2002-06-14 Angus Leeming <leeming@lyx.org>
* Makefile.am: nuke forgotten stl_string_fwd.h.

View File

@ -280,6 +280,7 @@ void LyXAction::init()
{ LFUN_MARK_OFF, "mark-off", "", ReadOnly },
{ LFUN_MARK_ON, "mark-on", "", ReadOnly },
{ LFUN_SETMARK, "mark-toggle", "", ReadOnly },
{ LFUN_MATH, "math", "", Noop },
{ LFUN_MATH_DELIM, "math-delim", "", Noop },
{ LFUN_MATH_DISPLAY, "math-display", "", Noop },
{ LFUN_GREEK, "math-greek", N_("Math Greek"), Noop },

View File

@ -1713,7 +1713,7 @@ bool Buffer::readFile(LyXLex & lex, Paragraph * par)
} else if (file_format < 220) {
Alert::alert(_("ERROR!"),
_("Old LyX file format found. "
"User LyX 1.2.x to read this!"));
"Use LyX 1.2.x to read this!"));
return false;
}
}
@ -2749,21 +2749,35 @@ bool Buffer::isSGML() const
}
void Buffer::sgmlOpenTag(ostream & os, Paragraph::depth_type,
int Buffer::sgmlOpenTag(ostream & os, Paragraph::depth_type depth, bool mixcont,
string const & latexname) const
{
if (!latexname.empty() && latexname != "!-- --")
//os << "<!-- " << depth << " -->" << "<" << latexname << ">";
os << "<" << latexname << ">";
if (!latexname.empty() && latexname != "!-- --") {
if (!mixcont)
os << string(" ",depth);
os << "<" << latexname << ">";
}
if (!mixcont)
os << endl;
return mixcont?0:1;
}
void Buffer::sgmlCloseTag(ostream & os, Paragraph::depth_type,
int Buffer::sgmlCloseTag(ostream & os, Paragraph::depth_type depth, bool mixcont,
string const & latexname) const
{
if (!latexname.empty() && latexname != "!-- --")
//os << "<!-- " << depth << " -->" << "</" << latexname << ">\n";
if (!latexname.empty() && latexname != "!-- --") {
if (!mixcont)
os << endl << string(" ",depth);
os << "</" << latexname << ">";
}
if (!mixcont)
os << endl;
return mixcont?0:1;
}
@ -2803,12 +2817,12 @@ void Buffer::makeLinuxDocFile(string const & fname, bool nice, bool body_only)
ofs << ">\n\n";
if (params.options.empty())
sgmlOpenTag(ofs, 0, top_element);
sgmlOpenTag(ofs, 0, false, top_element);
else {
string top = top_element;
top += " ";
top += params.options;
sgmlOpenTag(ofs, 0, top);
sgmlOpenTag(ofs, 0, false, top);
}
}
@ -2830,7 +2844,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, temp);
sgmlOpenTag(ofs, depth, false, temp);
par = par->next();
continue;
@ -2839,7 +2853,7 @@ void Buffer::makeLinuxDocFile(string const & fname, bool nice, bool body_only)
// environment tag closing
for (; depth > par->params().depth(); --depth) {
sgmlCloseTag(ofs, depth, environment_stack[depth]);
sgmlCloseTag(ofs, depth, false, environment_stack[depth]);
environment_stack[depth].erase();
}
@ -2848,14 +2862,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, environment_stack[depth]);
sgmlCloseTag(ofs, depth, false, environment_stack[depth]);
environment_stack[depth].erase();
if (depth)
--depth;
else
ofs << "</p>";
}
sgmlOpenTag(ofs, depth, style.latexname());
sgmlOpenTag(ofs, depth, false, style.latexname());
break;
case LATEX_COMMAND:
@ -2865,21 +2879,19 @@ void Buffer::makeLinuxDocFile(string const & fname, bool nice, bool body_only)
" LatexType Command.\n"));
if (!environment_stack[depth].empty()) {
sgmlCloseTag(ofs, depth,
environment_stack[depth]);
sgmlCloseTag(ofs, depth, false, environment_stack[depth]);
ofs << "</p>";
}
environment_stack[depth].erase();
sgmlOpenTag(ofs, depth, style.latexname());
sgmlOpenTag(ofs, depth, false, style.latexname());
break;
case LATEX_ENVIRONMENT:
case LATEX_ITEM_ENVIRONMENT:
if (depth == par->params().depth()
&& environment_stack[depth] != style.latexname()) {
sgmlCloseTag(ofs, depth,
environment_stack[depth]);
sgmlCloseTag(ofs, depth, false, environment_stack[depth]);
environment_stack[depth].erase();
}
if (depth < par->params().depth()) {
@ -2888,9 +2900,9 @@ void Buffer::makeLinuxDocFile(string const & fname, bool nice, bool body_only)
}
if (environment_stack[depth] != style.latexname()) {
if (depth == 0) {
sgmlOpenTag(ofs, depth, "p");
sgmlOpenTag(ofs, depth, false, "p");
}
sgmlOpenTag(ofs, depth, style.latexname());
sgmlOpenTag(ofs, depth, false, style.latexname());
if (environment_stack.size() == depth + 1)
environment_stack.push_back("!-- --");
@ -2907,10 +2919,10 @@ void Buffer::makeLinuxDocFile(string const & fname, bool nice, bool body_only)
else
item_name = "item";
sgmlOpenTag(ofs, depth + 1, item_name);
sgmlOpenTag(ofs, depth + 1, false, item_name);
break;
default:
sgmlOpenTag(ofs, depth, style.latexname());
sgmlOpenTag(ofs, depth, false, style.latexname());
break;
}
@ -2929,18 +2941,18 @@ void Buffer::makeLinuxDocFile(string const & fname, bool nice, bool body_only)
ofs << "]]>";
break;
default:
sgmlCloseTag(ofs, depth, style.latexname());
sgmlCloseTag(ofs, depth, false, style.latexname());
break;
}
}
// Close open tags
for (int i=depth; i >= 0; --i)
sgmlCloseTag(ofs, depth, environment_stack[i]);
sgmlCloseTag(ofs, depth, false, environment_stack[i]);
if (!body_only) {
ofs << "\n\n";
sgmlCloseTag(ofs, 0, top_element);
sgmlCloseTag(ofs, 0, false, top_element);
}
ofs.close();
@ -3266,7 +3278,7 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body)
top += " ";
top += params.options;
}
sgmlOpenTag(ofs, 0, top);
sgmlOpenTag(ofs, 0, false, top);
ofs << "<!-- DocBook file was created by " << lyx_docversion
<< "\n See http://www.lyx.org/ for more information -->\n";
@ -3296,14 +3308,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,
item_name);
sgmlCloseTag(ofs, command_depth + depth, false, item_name);
if (environment_inner[depth] == "varlistentry")
sgmlCloseTag(ofs, depth+command_depth,
environment_inner[depth]);
sgmlCloseTag(ofs, depth+command_depth, false, environment_inner[depth]);
}
sgmlCloseTag(ofs, depth + command_depth,
environment_stack[depth]);
sgmlCloseTag(ofs, depth + command_depth, false, environment_stack[depth]);
environment_stack[depth].erase();
environment_inner[depth].erase();
}
@ -3313,16 +3322,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,
item_name);
sgmlCloseTag(ofs, command_depth+depth, false, item_name);
if (environment_inner[depth] == "varlistentry")
sgmlCloseTag(ofs,
depth + command_depth,
environment_inner[depth]);
sgmlCloseTag(ofs, depth + command_depth, false, environment_inner[depth]);
}
sgmlCloseTag(ofs, depth + command_depth,
environment_stack[depth]);
sgmlCloseTag(ofs, depth + command_depth, false, environment_stack[depth]);
environment_stack[depth].erase();
environment_inner[depth].erase();
@ -3331,8 +3336,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,
style.latexname());
sgmlOpenTag(ofs, depth + command_depth, false, style.latexname());
break;
case LATEX_COMMAND:
@ -3352,14 +3356,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, command_stack[j]);
sgmlCloseTag(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, command_stack[j]);
sgmlCloseTag(ofs, j, false, command_stack[j]);
ofs << endl;
}
command_depth = cmd_depth;
@ -3388,12 +3392,10 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body)
}
}
sgmlOpenTag(ofs, depth + command_depth, command_name);
if (c_params.empty())
item_name = "title";
else
item_name = c_params;
sgmlOpenTag(ofs, depth + 1 + command_depth, item_name);
sgmlOpenTag(ofs, depth + command_depth, false, command_name);
item_name = c_params.empty()?"title":c_params;
sgmlOpenTag(ofs, depth + 1 + command_depth, false, item_name);
break;
case LATEX_ENVIRONMENT:
@ -3410,18 +3412,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,
environment_stack[depth]);
sgmlOpenTag(ofs, depth + command_depth, false, environment_stack[depth]);
} else {
if (environment_inner[depth] != "!-- --") {
item_name= "listitem";
sgmlCloseTag(ofs,
command_depth + depth,
item_name);
sgmlCloseTag(ofs, command_depth + depth, false, item_name);
if (environment_inner[depth] == "varlistentry")
sgmlCloseTag(ofs,
depth + command_depth,
environment_inner[depth]);
sgmlCloseTag(ofs, depth + command_depth, false, environment_inner[depth]);
}
}
@ -3430,35 +3427,21 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body)
if (style.latexparam() == "CDATA")
ofs << "<![CDATA[";
else
sgmlOpenTag(ofs, depth + command_depth,
style.latexparam());
sgmlOpenTag(ofs, depth + command_depth, false, style.latexparam());
}
break;
}
desc_on = (style.labeltype == LABEL_MANUAL);
if (desc_on)
environment_inner[depth]= "varlistentry";
else
environment_inner[depth]= "listitem";
environment_inner[depth] = desc_on?"varlistentry": "listitem";
sgmlOpenTag(ofs, depth + 1 + command_depth, false, environment_inner[depth]);
sgmlOpenTag(ofs, depth + 1 + command_depth,
environment_inner[depth]);
if (desc_on) {
item_name= "term";
sgmlOpenTag(ofs, depth + 1 + command_depth,
item_name);
} else {
item_name= "para";
sgmlOpenTag(ofs, depth + 1 + command_depth,
item_name);
}
item_name = desc_on? "term": "para";
sgmlOpenTag(ofs, depth + 1 + command_depth, false, item_name);
break;
default:
sgmlOpenTag(ofs, depth + command_depth,
style.latexname());
sgmlOpenTag(ofs, depth + command_depth, false, style.latexname());
break;
}
@ -3469,31 +3452,27 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body)
// write closing SGML tags
switch (style.latextype) {
case LATEX_COMMAND:
if (c_params.empty())
end_tag = "title";
else
end_tag = c_params;
sgmlCloseTag(ofs, depth + command_depth, end_tag);
end_tag = c_params.empty()?"title":c_params;
sgmlCloseTag(ofs, depth + command_depth, false, end_tag);
break;
case LATEX_ENVIRONMENT:
if (!style.latexparam().empty()) {
if (style.latexparam() == "CDATA")
ofs << "]]>";
else
sgmlCloseTag(ofs, depth + command_depth,
style.latexparam());
sgmlCloseTag(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, end_tag);
sgmlCloseTag(ofs, depth + 1 + command_depth, false, end_tag);
break;
case LATEX_PARAGRAPH:
sgmlCloseTag(ofs, depth + command_depth, style.latexname());
sgmlCloseTag(ofs, depth + command_depth, false, style.latexname());
break;
default:
sgmlCloseTag(ofs, depth + command_depth, style.latexname());
sgmlCloseTag(ofs, depth + command_depth, false, style.latexname());
break;
}
}
@ -3503,26 +3482,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,
item_name);
sgmlCloseTag(ofs, command_depth + depth, false, item_name);
if (environment_inner[depth] == "varlistentry")
sgmlCloseTag(ofs, depth + command_depth,
environment_inner[depth]);
sgmlCloseTag(ofs, depth + command_depth, false, environment_inner[depth]);
}
sgmlCloseTag(ofs, depth + command_depth,
environment_stack[depth]);
sgmlCloseTag(ofs, depth + command_depth, false, environment_stack[depth]);
}
}
for (int j = command_depth; j >= 0 ; --j)
if (!command_stack[j].empty()) {
sgmlCloseTag(ofs, j, command_stack[j]);
sgmlCloseTag(ofs, j, false, command_stack[j]);
ofs << endl;
}
ofs << "\n\n";
sgmlCloseTag(ofs, 0, top_element);
sgmlCloseTag(ofs, 0, false, top_element);
ofs.close();
// How to check for successful close
@ -3538,8 +3514,7 @@ void Buffer::simpleDocBookOnePar(ostream & os,
{
bool emph_flag = false;
LyXLayout const & style =
textclasslist[params.textclass][par->layout()];
LyXLayout const & style = textclasslist[params.textclass][par->layout()];
LyXFont font_old = style.labeltype == LABEL_MANUAL ? style.labelfont : style.font;
@ -3577,7 +3552,7 @@ void Buffer::simpleDocBookOnePar(ostream & os,
if ( i || desc_on != 3) {
if(style.latexparam() == "CDATA")
os << "]]>";
inset->docbook(this, os);
inset->docbook(this, os, false);
if(style.latexparam() == "CDATA")
os << "<![CDATA[";
}

View File

@ -180,10 +180,10 @@ public:
void makeDocBookFile(string const & filename,
bool nice, bool only_body = false);
/// Open SGML/XML tag.
void sgmlOpenTag(std::ostream & os, Paragraph::depth_type depth,
int sgmlOpenTag(std::ostream & os, Paragraph::depth_type depth, bool mixcont,
string const & latexname) const;
/// Closes SGML/XML tag.
void sgmlCloseTag(std::ostream & os, Paragraph::depth_type depth,
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

@ -131,6 +131,7 @@ enum kb_action {
LFUN_INSERT_MATH,
LFUN_INSERT_MATRIX,
LFUN_GREEK, // 110
LFUN_MATH, // Andre' 2002-06-14
LFUN_MATH_LIMITS,
LFUN_GREEK_TOGGLE,
LFUN_MATH_DELIM, // Alejandro 180696

View File

@ -1,3 +1,39 @@
2002-06-16 Lars Gullik Bjønnes <larsbj@birdstep.com>
* add a nother layer of inderection for calling gui specific
methods.
* guiapi.h: new file
2002-06-16 <alstrup@diku.dk>
* WorkArea.C: New file for GUII.
* WorkAreaFactory.h: New file for GUII.
* WorkArea.h: GUII stuff.
2002-06-15 Lyx Development team <larsbj@birdstep.com>
* LyXKeySymFactory.h: Added GUII factory for LyXKeySyms.
* LyXKeySym.[Ch]: Made the LyXKeySym class GUII.
* LyXKeySym.[Ch]: new LyXKeySym class for representing a
keypress. For now, X11 dependent.
* Makefile.am: Added LyXKeySym.
2002-06-14 Lyx Development team <lyx@electronia>
* LyXScreenFactory.h: New factory for creating the screen
object in the super GUII way.
* screen.h: Made LyXScreen an abstract base class for the
screen object.
* LyXView.h: Moved last_textclass_ member to Toolbar.C where it
belongs.
2002-06-12 John Levon <moz@compsoc.man.ac.uk>
* Painter.h:

View File

@ -21,18 +21,296 @@
#endif
#include "Dialogs.h"
#include "support/LAssert.h"
#include "guiapi.h"
// Signal enabling all visible dialogs to be redrawn if so desired.
// E.g., when the GUI colours have been remapped.
boost::signal0<void> Dialogs::redrawGUI;
extern LyXView * dialogs_lyxview;
// toggle tooltips on/off in all dialogs.
boost::signal0<void> Dialogs::toggleTooltips;
void Dialogs::add(DialogBase * ptr)
void Dialogs::showAboutlyx()
{
lyx::Assert(ptr);
dialogs_.push_back(db_ptr(ptr));
gui_ShowAboutlyx(*dialogs_lyxview, *this);
}
void Dialogs::showBibitem(InsetCommand * ic)
{
gui_ShowBibitem(ic, *dialogs_lyxview, *this);
}
void Dialogs::showBibtex(InsetCommand * ic)
{
gui_ShowBibtex(ic, *dialogs_lyxview, *this);
}
void Dialogs::showCharacter()
{
gui_ShowCharacter(*dialogs_lyxview, *this);
}
void Dialogs::setUserFreeFont()
{
gui_SetUserFreeFont(*dialogs_lyxview, *this);
}
void Dialogs::showCitation(InsetCommand * ic)
{
gui_ShowCitation(ic, *dialogs_lyxview, *this);
}
void Dialogs::createCitation(string const & s)
{
gui_CreateCitation(s, *dialogs_lyxview, *this);
}
void Dialogs::showDocument()
{
gui_ShowDocument(*dialogs_lyxview, *this);
}
void Dialogs::showError(InsetError * ie)
{
gui_ShowError(ie, *dialogs_lyxview, *this);
}
void Dialogs::showERT(InsetERT * ie)
{
gui_ShowERT(ie, *dialogs_lyxview, *this);
}
void Dialogs::updateERT(InsetERT * ie)
{
gui_UpdateERT(ie, *dialogs_lyxview, *this);
}
void Dialogs::showExternal(InsetExternal * ie)
{
gui_ShowExternal(ie, *dialogs_lyxview, *this);
}
void Dialogs::showFile(string const & f)
{
gui_ShowFile(f, *dialogs_lyxview, *this);
}
void Dialogs::showFloat(InsetFloat * ifl)
{
gui_ShowFloat(ifl, *dialogs_lyxview, *this);
}
void Dialogs::showForks()
{
gui_ShowForks(*dialogs_lyxview, *this);
}
void Dialogs::showGraphics(InsetGraphics * ig)
{
gui_ShowGraphics(ig, *dialogs_lyxview, *this);
}
void Dialogs::showInclude(InsetInclude * ii)
{
gui_ShowInclude(ii, *dialogs_lyxview, *this);
}
void Dialogs::showIndex(InsetCommand * ic)
{
gui_ShowIndex(ic, *dialogs_lyxview, *this);
}
void Dialogs::createIndex(string const & s)
{
gui_CreateIndex(s, *dialogs_lyxview, *this);
}
void Dialogs::showInfo(InsetInfo * /*ii*/)
{
#if 0
gui_ShowInfo(ii, *dialogs_lyxview, *this);
#endif
}
void Dialogs::showLogFile()
{
gui_ShowLogFile(*dialogs_lyxview, *this);
}
void Dialogs::showMathPanel()
{
gui_ShowMathPanel(*dialogs_lyxview, *this);
}
void Dialogs::showMinipage(InsetMinipage * im)
{
gui_ShowMinipage(im, *dialogs_lyxview, *this);
}
void Dialogs::updateMinipage(InsetMinipage * im)
{
gui_UpdateMinipage(im, *dialogs_lyxview, *this);
}
void Dialogs::showParagraph()
{
gui_ShowParagraph(*dialogs_lyxview, *this);
}
void Dialogs::updateParagraph()
{
#if 0
gui_UpdateParagraph(*dialogs_lyxview, *this);
#endif
}
void Dialogs::showPreamble()
{
gui_ShowPreamble(*dialogs_lyxview, *this);
}
void Dialogs::showPreferences()
{
gui_ShowPreferences(*dialogs_lyxview, *this);
}
void Dialogs::showPrint()
{
gui_ShowPrint(*dialogs_lyxview, *this);
}
void Dialogs::showRef(InsetCommand * ic)
{
gui_ShowRef(ic, *dialogs_lyxview, *this);
}
void Dialogs::createRef(string const & s)
{
gui_CreateRef(s, *dialogs_lyxview, *this);
}
void Dialogs::showSearch()
{
gui_ShowSearch(*dialogs_lyxview, *this);
}
void Dialogs::showSendto()
{
gui_ShowSendto(*dialogs_lyxview, *this);
}
void Dialogs::showSpellchecker()
{
gui_ShowSpellchecker(*dialogs_lyxview, *this);
}
void Dialogs::showSpellcheckerPreferences()
{
gui_ShowSpellcheckerPreferences(*dialogs_lyxview, *this);
}
void Dialogs::showTabular(InsetTabular * it)
{
gui_ShowTabular(it, *dialogs_lyxview, *this);
}
void Dialogs::updateTabular(InsetTabular * it)
{
gui_UpdateTabular(it, *dialogs_lyxview, *this);
}
void Dialogs::showTabularCreate()
{
gui_ShowTabularCreate(*dialogs_lyxview, *this);
}
void Dialogs::showThesaurus(string const & s)
{
gui_ShowThesaurus(s, *dialogs_lyxview, *this);
}
void Dialogs::showTexinfo()
{
gui_ShowTexinfo(*dialogs_lyxview, *this);
}
void Dialogs::showTOC(InsetCommand * ic)
{
gui_ShowTOC(ic, *dialogs_lyxview, *this);
}
void Dialogs::createTOC(string const & s)
{
gui_CreateTOC(s, *dialogs_lyxview, *this);
}
void Dialogs::showUrl(InsetCommand * ic)
{
gui_ShowUrl(ic, *dialogs_lyxview, *this);
}
void Dialogs::createUrl(string const & s)
{
gui_CreateUrl(s, *dialogs_lyxview, *this);
}
void Dialogs::showVCLogFile()
{
gui_ShowVCLogFile(*dialogs_lyxview, *this);
}
//void Dialogs::add(DialogBase * ptr)
//{
// lyx::Assert(ptr);
// dialogs_.push_back(db_ptr(ptr));
//}

View File

@ -24,8 +24,6 @@
#include <boost/shared_ptr.hpp>
#include <boost/signals/signal0.hpp>
#include <boost/signals/signal1.hpp>
#include <boost/function.hpp>
#include <vector>
#ifdef __GNUG__
@ -95,101 +93,101 @@ public:
Put into some sort of alphabetical order */
//@{
///
boost::function<void> showAboutlyx;
void showAboutlyx();
/// show the key and label of a bibliography entry
boost::function<void, InsetCommand *> showBibitem;
void showBibitem(InsetCommand * ic);
/// show the bibtex dialog
boost::function<void, InsetCommand *> showBibtex;
void showBibtex(InsetCommand * ic);
///
boost::function<void> showCharacter;
void showCharacter();
/// connected to the character dialog also
boost::function<void> setUserFreeFont;
void setUserFreeFont();
///
boost::function<void, InsetCommand *> showCitation;
void showCitation(InsetCommand *);
///
boost::function<void, string const &> createCitation;
void createCitation(string const &);
///
boost::function<void> showDocument;
void showDocument();
///
boost::function<void, InsetError *> showError;
void showError(InsetError *);
/// show the external inset dialog
boost::function<void, InsetExternal *> showExternal;
void showExternal(InsetExternal *);
/// show the contents of a file.
boost::function<void, string const &> showFile;
void showFile(string const &);
/// show all forked child processes
boost::function<void> showForks;
void showForks();
///
boost::function<void, InsetGraphics *> showGraphics;
void showGraphics(InsetGraphics *);
/// show the details of a LyX file include inset
boost::function<void, InsetInclude *> showInclude;
void showInclude(InsetInclude *);
///
boost::function<void, InsetCommand *> showIndex;
void showIndex(InsetCommand *);
///
boost::function<void, string const &> createIndex;
void createIndex(string const &);
///
boost::function<void, InsetInfo *> showInfo;
void showInfo(InsetInfo *);
/// show the LaTeX log or build file
boost::function<void> showLogFile;
void showLogFile();
/// display the top-level maths panel
boost::function<void> showMathPanel;
void showMathPanel();
///
boost::function<void, InsetMinipage *> showMinipage;
void showMinipage(InsetMinipage *);
///
boost::function<void, InsetMinipage *> updateMinipage;
void updateMinipage(InsetMinipage *);
///
boost::function<void, InsetERT *> showERT;
void showERT(InsetERT *);
///
boost::function<void, InsetERT *> updateERT;
void updateERT(InsetERT *);
///
boost::function<void, InsetFloat *> showFloat;
void showFloat(InsetFloat *);
///
boost::function<void> showParagraph;
void showParagraph();
///
boost::signal0<void> updateParagraph;
void updateParagraph();
///
boost::function<void> showPreamble;
void showPreamble();
///
boost::function<void> showPreferences;
void showPreferences();
///
boost::function<void> showPrint;
void showPrint();
///
boost::function<void, InsetCommand *> showRef;
void showRef(InsetCommand *);
///
boost::function<void, string const &> createRef;
void createRef(string const &);
///
boost::function<void> showSearch;
void showSearch();
///
boost::function<void> showSendto;
void showSendto();
/// bring up the spellchecker
boost::function<void> showSpellchecker;
void showSpellchecker();
/// bring up the spellchecker tab in preferences
boost::function<void> showSpellcheckerPreferences;
void showSpellcheckerPreferences();
///
boost::function<void, InsetTabular *> showTabular;
void showTabular(InsetTabular *);
///
boost::function<void, InsetTabular *> updateTabular;
void updateTabular(InsetTabular *);
///
boost::function<void> showTabularCreate;
void showTabularCreate();
/// show the TexInfo
boost::function<void> showTexinfo;
void showTexinfo();
/// show the thesaurus dialog
boost::function<void, string const &> showThesaurus;
void showThesaurus(string const &);
///
boost::function<void, InsetCommand *> showTOC;
void showTOC(InsetCommand *);
///
boost::function<void, string const &> createTOC;
void createTOC(string const &);
///
boost::function<void, InsetCommand *> showUrl;
void showUrl(InsetCommand *);
///
boost::function<void, string const &> createUrl;
void createUrl(string const &);
/// show the version control log
boost::function<void> showVCLogFile;
void showVCLogFile();
//@}
private:
/// Add a dialog to the vector of dialogs.
void add(DialogBase *);
//void add(DialogBase *);
/// the dialogs being managed
std::vector<db_ptr> dialogs_;
//std::vector<db_ptr> dialogs_;
};
#endif

15
src/frontends/LyXKeySym.C Normal file
View File

@ -0,0 +1,15 @@
/**
* \file LyXKeySym.C
* Copyright 2002 the LyX Team
* Read the file COPYING
*
* \author Asger and Juergen
*/
#include <config.h>
#ifdef __GNUG__
#pragma implementation
#endif
#include "LyXKeySym.h"

60
src/frontends/LyXKeySym.h Normal file
View File

@ -0,0 +1,60 @@
// -*- C++ -*-
/**
* \file LyXKeySym.h
* Copyright 2002 the LyX Team
* Read the file COPYING
*
* \author Asger and Juergen
*/
#ifndef LYXKEYSYM_H
#define LYXKEYSYM_H
#ifdef __GNUG__
#pragma interface
#endif
#include "LString.h"
#include <boost/shared_ptr.hpp>
/**
* This is a base class for representing a keypress.
* Each frontend has to implement this to provide
* the functionality that LyX needs in regards to
* key presses.
*/
class LyXKeySym {
public:
LyXKeySym() {}
virtual ~LyXKeySym() {}
/// Initialize with the name of a key. F. ex. "space" or "a"
virtual void init(string const & symbolname) = 0;
/// Is this a valid key?
virtual bool isOK() const = 0;
/// Is this a modifier key only?
virtual bool isModifier() const = 0;
/// What is the symbolic name of this key? F.ex. "Return" or "c"
virtual string getSymbolName() const = 0;
/**
* Return the value of the keysym into the local ISO encoding.
* This converts the LyXKeySym to a 8-bit encoded character.
* This relies on user to use the right encoding.
*/
virtual char getISOEncoded() const = 0;
/**
* We need to be able to equality compare these for the
* sake of the keymap business.
*/
virtual bool operator==(LyXKeySym const & k) const = 0;
};
typedef boost::shared_ptr<LyXKeySym> LyXKeySymPtr;
#endif

View File

@ -0,0 +1,22 @@
/**
* \file LyXKeySymFactory.h
* Copyright 2002 the LyX Team
* Read the file COPYING
*
* \author Asger & Juergen
*/
#ifndef LYXKEYSYMFACTORY_H
#define LYXKEYSYMFACTORY_H
class LyXKeySym;
namespace LyXKeySymFactory {
/**
* Make a LyXKeySym. Used because we want to
* generate a toolkit-specific instance.
*/
LyXKeySym * create();
}
#endif // LYXKEYSYM_FACTORY_H

View File

@ -0,0 +1,23 @@
/**
* \file LyXScreenFactory.h
* Copyright 2002 the LyX Team
* Read the file COPYING
*
* \author John Levon <moz@compsoc.man.ac.uk>
*/
#ifndef LYXSCREENFACTORY_H
#define LYXSCREENFACTORY_H
class WorkArea;
class LyXScreen;
namespace LyXScreenFactory {
/**
* Make a screen renderer. Used because we want to
* generate a toolkit-specific instance.
*/
LyXScreen * create(WorkArea & owner);
}
#endif // LYXSCREEN_FACTORY_H

View File

@ -66,8 +66,6 @@ LyXView::~LyXView()
void LyXView::init()
{
// Set the textclass choice
invalidateLayoutChoice();
updateLayoutChoice();
updateMenubar();
@ -182,12 +180,6 @@ void LyXView::resetAutosaveTimer()
}
void LyXView::invalidateLayoutChoice()
{
last_textclass_ = -1;
}
void LyXView::updateLayoutChoice()
{
// don't show any layouts without a buffer
@ -197,12 +189,8 @@ void LyXView::updateLayoutChoice()
}
// update the layout display
if (last_textclass_ != int(buffer()->params.textclass)) {
toolbar_->updateLayoutList(true);
last_textclass_ = int(buffer()->params.textclass);
current_layout = textclasslist[last_textclass_].defaultLayoutName();
} else {
toolbar_->updateLayoutList(false);
if (toolbar_->updateLayoutList(buffer()->params.textclass)) {
current_layout = textclasslist[buffer()->params.textclass].defaultLayoutName();
}
string const & layout =

View File

@ -55,7 +55,11 @@ public:
virtual ~LyXView();
/// FIXME: what is the requirement for this be to separate from the ctor ?
/**
* This is called after the concrete view has been created.
* We have to have the toolbar and the other stuff created
* before we can populate it with this call.
*/
void init();
/// start modal operation
@ -138,9 +142,6 @@ protected:
/// called on timeout
void autoSave();
/// FIXME: GUII - toolbar property
void invalidateLayoutChoice();
private:
/**
* setWindowTitle - set title of window
@ -153,15 +154,6 @@ private:
boost::scoped_ptr<LyXFunc> lyxfunc_;
/// dialogs for this view
boost::scoped_ptr<Dialogs> dialogs_;
/**
* The last textclass layout list in the layout choice selector
* This should probably be moved to the toolbar, but for now it's
* here. (Asger)
*
* FIXME: GUII
*/
int last_textclass_;
};
#endif // LYXVIEW_H

View File

@ -23,6 +23,12 @@ libfrontends_la_SOURCES = \
FileDialog.h \
Liason.C \
Liason.h \
LyXKeySym.C \
LyXKeySym.h \
LyXKeySymFactory.h \
LyXScreenFactory.h \
LyXView.C \
LyXView.h \
Menubar.C \
Menubar.h \
Painter.C \
@ -31,11 +37,12 @@ libfrontends_la_SOURCES = \
Timeout.h \
Toolbar.C \
Toolbar.h \
LyXView.C \
LyXView.h \
WorkArea.C \
WorkArea.h \
WorkAreaFactory.h \
font_loader.h \
font_metrics.h \
guiapi.h \
key_state.h \
lyx_gui.h \
mouse_state.h \

View File

@ -23,6 +23,7 @@ extern LyXAction lyxaction;
Toolbar::Toolbar(LyXView * o, int x, int y, ToolbarDefaults const &tbd)
: last_textclass_(-1)
{
pimpl_ = new Pimpl(o, x, y);
@ -75,9 +76,17 @@ void Toolbar::setLayout(string const & layout)
}
void Toolbar::updateLayoutList(bool force)
bool Toolbar::updateLayoutList(int textclass)
{
pimpl_->updateLayoutList(force);
// update the layout display
if (last_textclass_ != textclass) {
pimpl_->updateLayoutList(true);
last_textclass_ = textclass;
return true;
} else {
pimpl_->updateLayoutList(false);
return false;
}
}

View File

@ -55,8 +55,11 @@ public:
/// update the layout combox
void setLayout(string const & layout);
/// Populate the layout combox; re-do everything if force is true.
void updateLayoutList(bool force);
/**
* Populate the layout combox - returns whether we did a full
* update or not
*/
bool updateLayoutList(int textclass);
/// Drop down the layout list
void openLayoutList();
/// Erase the layout list
@ -69,5 +72,10 @@ private:
friend struct Toolbar::Pimpl;
///
Pimpl * pimpl_;
/**
* The last textclass layout list in the layout choice selector
*/
int last_textclass_;
};
#endif

23
src/frontends/WorkArea.C Normal file
View File

@ -0,0 +1,23 @@
/**
* \file WorkArea.C
* Copyright 2002 the LyX Team
* Read the file COPYING
*
* \author Asger and Juergen
*/
#include <config.h>
#ifdef __GNUG__
#pragma implementation
#endif
#include "WorkArea.h"

View File

@ -1,2 +1,98 @@
// temporary
#include "frontends/xforms/XWorkArea.h"
// -*- C++ -*-
/**
* \file WorkArea.h
* Copyright 1995-2002 the LyX Team
* Read the file COPYING
*
* \author unknown
* \author John Levon <moz@compsoc.man.ac.uk>
*/
#ifndef WORKAREA_H
#define WORKAREA_H
#ifdef __GNUG__
#pragma interface
#endif
#include "frontends/Painter.h"
#include "frontends/mouse_state.h"
#include "frontends/key_state.h"
#include "frontends/LyXKeySym.h"
#include <boost/signals/signal0.hpp>
#include <boost/signals/signal1.hpp>
#include <boost/signals/signal2.hpp>
#include <boost/signals/signal3.hpp>
#include <utility>
///
class WorkArea {
public:
///
WorkArea() {}
///
virtual ~WorkArea() {}
///
virtual Painter & getPainter() = 0;
///
virtual int workWidth() const = 0;
///
virtual int workHeight() const = 0;
///
virtual unsigned int width() const = 0;
///
virtual int xpos() const = 0;
///
virtual int ypos() const = 0;
///
virtual void resize(int xpos, int ypos, int width, int height) = 0;
///
virtual void redraw() const = 0;
///
virtual void setFocus() const = 0;
///
virtual bool hasFocus() const = 0;
///
virtual bool visible() const = 0;
///
virtual void greyOut() const = 0;
///
virtual void setScrollbarParams(int height, int pos, int line_height) = 0;
/// a selection exists
virtual void haveSelection(bool) const = 0;
///
virtual string const getClipboard() const = 0;
///
virtual void putClipboard(string const &) const = 0;
// Signals
///
boost::signal0<void> workAreaExpose;
///
boost::signal1<void, int> scrollDocView;
///
boost::signal2<void, LyXKeySymPtr, key_modifier::state> workAreaKeyPress;
///
boost::signal3<void, int, int, mouse_button::state> workAreaButtonPress;
///
boost::signal3<void, int, int, mouse_button::state> workAreaButtonRelease;
///
boost::signal3<void, int, int, mouse_button::state> workAreaMotionNotify;
///
boost::signal0<void> workAreaFocus;
///
boost::signal0<void> workAreaUnfocus;
///
boost::signal3<void, int, int, mouse_button::state> workAreaDoubleClick;
///
boost::signal3<void, int, int, mouse_button::state> workAreaTripleClick;
/// emitted when an X client has requested our selection
boost::signal0<void> selectionRequested;
/// emitted when another X client has stolen our selection
boost::signal0<void> selectionLost;
};
#endif // WORKAREA_H

View File

@ -0,0 +1,22 @@
/**
* \file WorkAreaFactory.h
* Copyright 2002 the LyX Team
* Read the file COPYING
*
* \author John Levon <moz@compsoc.man.ac.uk>
*/
#ifndef WORKAREAFACTORY_H
#define WORKAREAFACTORY_H
class WorkArea;
namespace WorkAreaFactory {
/**
* Make a work area. Used because we want to generate
* a toolkit-specific instance.
*/
WorkArea * create(int x, int y, int w, int h);
}
#endif // WORKAREA_FACTORY_H

View File

@ -1,3 +1,7 @@
2002-06-16 Lars Gullik Bjønnes <larsbj@birdstep.com>
* changes to simplify function setup, removal of a lot of includes.
2002-06-12 Angus Leeming <leeming@lyx.org>
* ControlParagraph.[Ch]: forward declare ParagraphParameters.
@ -8,9 +12,9 @@
2002-06-11 Edwin Leuven <leuven@fee.uva.nl>
* ControlParagraph.[Ch]: new paragraph controller
* GUI.h: add new controller
* Makefile.am: ditto
* ControlParagraph.[Ch]: new paragraph controller
* GUI.h: add new controller
* Makefile.am: ditto
2002-06-10 Lars Gullik Bjønnes <larsbj@birdstep.com>

View File

@ -14,10 +14,7 @@
#pragma implementation
#endif
#include "ViewBase.h"
#include "ButtonControllerBase.h"
#include "ControlAboutlyx.h"
#include "Dialogs.h"
#include "frontends/LyXView.h"
#include "Lsstream.h"
#include "BufferView.h"
@ -25,17 +22,14 @@
#include "support/filetools.h" // FileSearch
#include "version.h"
#include <boost/bind.hpp>
// needed for the browser
extern string system_lyxdir;
extern string user_lyxdir;
ControlAboutlyx::ControlAboutlyx(LyXView & lv, Dialogs & d)
: ControlDialogBI(lv, d)
{
d_.showAboutlyx = boost::bind(&ControlAboutlyx::show, this);
}
{}
stringstream & ControlAboutlyx::getCredits(stringstream & ss) const
@ -65,21 +59,25 @@ stringstream & ControlAboutlyx::getCredits(stringstream & ss) const
return ss;
}
string const ControlAboutlyx::getCopyright() const
{
return _("LyX is Copyright (C) 1995 by Matthias Ettrich,\n1995-2001 LyX Team");
}
string const ControlAboutlyx::getLicense() const
{
return _("This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.");
}
string const ControlAboutlyx::getDisclaimer() const
{
return _("LyX is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\nSee the GNU General Public License for more details.\nYou should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.");
}
string const ControlAboutlyx::getVersion() const
{
stringstream ss;

View File

@ -19,23 +19,12 @@
#endif
#include "ControlBibitem.h"
#include "ViewBase.h"
#include "ButtonControllerBase.h"
#include "Dialogs.h"
#include "buffer.h"
#include "BufferView.h"
#include "frontends/LyXView.h"
#include <boost/bind.hpp>
#include <algorithm>
ControlBibitem::ControlBibitem(LyXView & lv, Dialogs & d)
: ControlCommand(lv, d)
{
d_.showBibitem = boost::bind(&ControlBibitem::showInset, this, _1);
}
{}
void ControlBibitem::applyParamsToInset()

View File

@ -19,11 +19,7 @@
#pragma implementation
#endif
#include "ViewBase.h"
#include "ButtonControllerBase.h"
#include "ControlBibtex.h"
#include "Dialogs.h"
#include "buffer.h"
#include "BufferView.h"
#include "lyxrc.h"
#include "helper_funcs.h"
@ -31,18 +27,13 @@
#include "frontends/LyXView.h"
#include <boost/bind.hpp>
#include <algorithm>
using std::pair;
using std::make_pair;
ControlBibtex::ControlBibtex(LyXView & lv, Dialogs & d)
: ControlCommand(lv, d)
{
d_.showBibtex = boost::bind(&ControlBibtex::showInset, this, _1);
}
{}
void ControlBibtex::applyParamsToInset()
{

View File

@ -16,7 +16,6 @@
#include "ViewBase.h"
#include "ButtonControllerBase.h"
#include "buffer.h"
#include "Dialogs.h"
#include "Liason.h"
#include "bufferview_funcs.h" // ToggleAndShow
#include "gettext.h"
@ -25,21 +24,13 @@
#include "frontends/LyXView.h"
#include <boost/bind.hpp>
#include <vector>
using Liason::setMinibuffer;
using std::vector;
ControlCharacter::ControlCharacter(LyXView & lv, Dialogs & d)
: ControlDialogBD(lv, d),
font_(0), toggleall_(false)
{
d_.showCharacter = boost::bind(&ControlCharacter::show, this);
d_.setUserFreeFont = boost::bind(&ControlCharacter::apply, this);
}
{}
void ControlCharacter::setParams()

View File

@ -61,9 +61,9 @@ public:
///
bool getToggleAll() const;
private:
/// Get changed parameters and Dispatch them to the kernel.
virtual void apply();
private:
/// set the params before show or update.
virtual void setParams();

View File

@ -18,30 +18,16 @@
#endif
#include "ControlCitation.h"
#include "ViewBase.h"
#include "ButtonControllerBase.h"
#include "buffer.h"
#include "Dialogs.h"
#include "frontends/LyXView.h"
#include <boost/bind.hpp>
#include <algorithm>
using std::pair;
using std::vector;
using std::pair;
vector<biblio::CiteStyle> ControlCitation::citeStyles_;
ControlCitation::ControlCitation(LyXView & lv, Dialogs & d)
: ControlCommand(lv, d, LFUN_CITATION_INSERT)
{
// These are permanent connections so we won't bother
// storing a copy because we won't be disconnecting.
d_.showCitation = boost::bind(&ControlCitation::showInset, this, _1);
d_.createCitation = boost::bind(&ControlCitation::createInset, this, _1);
}
{}
void ControlCitation::clearDaughterParams()

View File

@ -72,4 +72,3 @@ void ControlDialog<Base>::hide()
disconnect();
view().hide();
}

View File

@ -17,31 +17,15 @@
#pragma implementation
#endif
#include "ViewBase.h"
#include "ButtonControllerBase.h"
#include "ControlERT.h"
#include "Dialogs.h"
#include "frontends/LyXView.h"
#include "buffer.h"
#include "BufferView.h"
#include <boost/bind.hpp>
using std::vector;
// sorry this is just a temporary hack we should include vspace.h! (Jug)
extern const char * stringFromUnit(int);
ControlERT::ControlERT(LyXView & lv, Dialogs & d)
: ControlInset<InsetERT, ERTParams>(lv, d)
{
d_.showERT = boost::bind(&ControlERT::showInset, this, _1);
// We could have an extra method updateInset that calls
// view().update() rather than view().show(), but I don't see why
// it is really needed.
d_.updateERT = boost::bind(&ControlERT::showInset, this, _1);
}
{}
void ControlERT::applyParamsToInset()
@ -65,6 +49,7 @@ ERTParams::ERTParams()
: status(InsetERT::Collapsed)
{}
ERTParams::ERTParams(InsetERT const & inset)
: status(inset.status())
{}

View File

@ -18,21 +18,12 @@
#endif
#include "ControlError.h"
#include "ViewBase.h"
#include "ButtonControllerBase.h"
#include "Dialogs.h"
#include "buffer.h"
#include "insets/inseterror.h"
#include "frontends/LyXView.h"
#include <boost/bind.hpp>
ControlError::ControlError(LyXView & lv, Dialogs & d)
: ControlInset<InsetError, string>(lv, d)
{
d_.showError = boost::bind(&ControlError::showInset, this, _1);
}
{}
string const ControlError::getParams(InsetError const & inset)

View File

@ -19,35 +19,20 @@
#pragma implementation
#endif
#include "BufferView.h"
#include "ButtonControllerBase.h"
#include "ControlExternal.h"
#include "Dialogs.h"
#include "Liason.h"
#include "frontends/LyXView.h"
#include "ViewBase.h"
#include "buffer.h"
#include "frontends/Alert.h"
#include "BufferView.h"
#include "gettext.h"
#include "helper_funcs.h"
#include "lyxrc.h"
#include "support/filetools.h"
#include "support/lstrings.h"
#include <boost/scoped_ptr.hpp>
#include <boost/bind.hpp>
#include <utility>
#include <vector>
using std::make_pair;
using std::vector;
ControlExternal::ControlExternal(LyXView & lv, Dialogs & d)
: ControlInset<InsetExternal, InsetExternal::Params>(lv, d)
{
d_.showExternal = boost::bind(&ControlExternal::showInset, this, _1);
}
{}
InsetExternal::Params const ControlExternal::getParams(string const &)

View File

@ -16,30 +16,11 @@
#endif
#include "ControlFloat.h"
#include "ViewBase.h"
#include "ButtonControllerBase.h"
#include "Dialogs.h"
#include "buffer.h"
#include "BufferView.h"
#include "insets/insetfloat.h"
#include "frontends/LyXView.h"
#include <boost/bind.hpp>
using std::vector;
ControlFloat::ControlFloat(LyXView & lv, Dialogs & d)
: ControlInset<InsetFloat, FloatParams>(lv, d)
{
d_.showFloat = boost::bind(&ControlFloat::showInset, this, _1);
// We could have an extra method updateInset that calls
// view().update() rather than view().show(), but I don't see why
// it is really needed.
//d_.updateFloat.connect(slot(this, &ControlFloat::showInset));
}
{}
void ControlFloat::applyParamsToInset()

View File

@ -13,15 +13,12 @@
#endif
#include "ControlForks.h"
#include "ButtonControllerBase.h"
#include "ViewBase.h"
#include "BufferView.h"
#include "frontends/LyXView.h"
#include "lyxfunc.h"
#include "frontends/Dialogs.h"
#include "support/forkedcontr.h"
#include "support/lstrings.h"
@ -32,9 +29,7 @@ using std::vector;
ControlForks::ControlForks(LyXView & lv, Dialogs & d)
: ControlDialogBI(lv, d)
{
d_.showForks = boost::bind(&ControlForks::show, this);
}
{}
vector<pid_t> const ControlForks::getPIDs() const

View File

@ -18,8 +18,6 @@
#pragma implementation
#endif
#include "ViewBase.h"
#include "ButtonControllerBase.h"
#include "ControlGraphics.h"
#include "helper_funcs.h"
@ -42,13 +40,8 @@
#include "support/filetools.h"
#include "support/FileInfo.h"
#include <boost/bind.hpp>
#include <fstream>
using std::pair;
using std::make_pair;
using std::ifstream;
using std::vector;
namespace {
@ -103,9 +96,7 @@ string const xforms_pattern()
ControlGraphics::ControlGraphics(LyXView & lv, Dialogs & d)
: ControlInset<InsetGraphics, InsetGraphicsParams>(lv, d)
{
d_.showGraphics = boost::bind(&ControlGraphics::showInset, this, _1);
}
{}
InsetGraphicsParams const ControlGraphics::getParams(string const &)
@ -209,6 +200,7 @@ size_t const rorigin_size = sizeof(rorigin_lyx_strs) / sizeof(char *);
} // namespace anon
vector<RotationOriginPair> getRotationOriginData()
{
static vector<RotationOriginPair> data;
@ -217,8 +209,8 @@ vector<RotationOriginPair> getRotationOriginData()
data.resize(rorigin_size);
for (lyx::size_type i = 0; i < rorigin_size; ++i) {
data[i] = std::make_pair(_(rorigin_gui_strs[i]),
rorigin_lyx_strs[i]);
data[i] = make_pair(_(rorigin_gui_strs[i]),
rorigin_lyx_strs[i]);
}
return data;

View File

@ -9,19 +9,14 @@
*/
#include <config.h>
#include <utility>
#ifdef __GNUG__
#pragma implementation
#endif
#include "ControlInclude.h"
#include "ViewBase.h"
#include "ButtonControllerBase.h"
#include "buffer.h"
#include "Alert.h"
#include "BufferView.h"
#include "Dialogs.h"
#include "lyxfunc.h"
#include "gettext.h"
#include "helper_funcs.h"
@ -29,18 +24,14 @@
#include "support/filetools.h"
#include "frontends/LyXView.h"
#include <boost/bind.hpp>
#include <utility>
using std::pair;
using std::make_pair;
ControlInclude::ControlInclude(LyXView & lv, Dialogs & d)
: ControlInset<InsetInclude, InsetInclude::Params>(lv, d)
{
d_.showInclude = boost::bind(&ControlInclude::showInset, this, _1);
}
{}
void ControlInclude::applyParamsToInset()

View File

@ -18,18 +18,8 @@
#endif
#include "ControlIndex.h"
#include "ViewBase.h"
#include "ButtonControllerBase.h"
#include "buffer.h"
#include "Dialogs.h"
#include "frontends/LyXView.h"
#include <boost/bind.hpp>
ControlIndex::ControlIndex(LyXView & lv, Dialogs & d)
: ControlCommand(lv, d, LFUN_INDEX_INSERT)
{
d_.showIndex = boost::bind(&ControlIndex::showInset, this, _1);
d_.createIndex = boost::bind(&ControlIndex::createInset, this, _1);
}
{}

View File

@ -16,7 +16,10 @@
#include "buffer.h"
#include "debug.h"
#include "frontends/LyXView.h"
#include "insets/insetfloat.h"
#include "insets/insetgraphics.h"
#include "support/LAssert.h"
#include <boost/bind.hpp>
template <class Inset, class Params>

View File

@ -19,21 +19,14 @@
#endif
#include "ControlLog.h"
#include "ViewBase.h"
#include "ButtonControllerBase.h"
#include "Dialogs.h"
#include "lyxrc.h"
#include "BufferView.h"
#include "frontends/LyXView.h"
#include <boost/bind.hpp>
ControlLog::ControlLog(LyXView & lv, Dialogs & d)
: ControlDialogBD(lv, d)
{
d_.showLogFile = boost::bind(&ControlLog::show, this);
}
{}
void ControlLog::setParams()

View File

@ -18,29 +18,12 @@
#endif
#include "ControlMinipage.h"
#include "ViewBase.h"
#include "ButtonControllerBase.h"
#include "Dialogs.h"
#include "frontends/LyXView.h"
#include "buffer.h"
#include "BufferView.h"
#include "helper_funcs.h"
#include <boost/bind.hpp>
using std::vector;
ControlMinipage::ControlMinipage(LyXView & lv, Dialogs & d)
: ControlInset<InsetMinipage, MinipageParams>(lv, d)
{
d_.showMinipage = boost::bind(&ControlMinipage::showInset, this, _1);
// We could have an extra method updateInset that calls
// view().update() rather than view().show(), but I don't see why
// it is really needed.
d_.updateMinipage = boost::bind(&ControlMinipage::showInset, this, _1);
}
{}
void ControlMinipage::applyParamsToInset()

View File

@ -13,11 +13,9 @@
#pragma implementation
#endif
#include "ViewBase.h"
#include "ButtonControllerBase.h"
#include "ControlParagraph.h"
#include "ViewBase.h"
#include "ParagraphParameters.h"
#include "Dialogs.h"
#include "Liason.h"
#include "LyXView.h"
#include "BufferView.h"
@ -27,16 +25,12 @@
#include "lyxtextclasslist.h"
#include "support/LAssert.h"
#include <boost/bind.hpp>
using Liason::setMinibuffer;
ControlParagraph::ControlParagraph(LyXView & lv, Dialogs & d)
: ControlDialogBD(lv, d), pp_(0), ininset_(false)
{
d_.showParagraph = boost::bind(&ControlParagraph::show, this);
}
{}
ControlParagraph::~ControlParagraph()
@ -103,7 +97,7 @@ void ControlParagraph::setParams()
Paragraph const * par_ = lv_.view()->getLyXText()->cursor.par();
/// Set the paragraph parameters
*pp_ = par_->params();
*pp_ = par_->params();
/// this needs to be done separately
pp_->labelWidthString(par_->getLabelWidthString());
@ -118,5 +112,5 @@ void ControlParagraph::setParams()
alignpos_ = tclass[par_->layout()].alignpossible;
/// is paragraph in inset
ininset_ = par_->inInset();
ininset_ = par_->inInset();
}

View File

@ -54,4 +54,3 @@ private:
};
#endif // CONTROLPARAGRAPH_H

View File

@ -12,26 +12,20 @@
#pragma implementation
#endif
#include "ViewBase.h"
#include "ButtonControllerBase.h"
#include "ControlPreamble.h"
#include "ViewBase.h"
#include "frontends/LyXView.h"
#include "Dialogs.h"
#include "buffer.h"
#include "lyxrc.h"
#include "Liason.h"
#include "gettext.h"
#include "BufferView.h"
#include "support/LAssert.h"
#include <boost/bind.hpp>
ControlPreamble::ControlPreamble(LyXView & lv, Dialogs & d)
: ControlDialogBD(lv, d),
params_(0)
{
d_.showPreamble = boost::bind(&ControlPreamble::show, this);
}
{}
void ControlPreamble::apply()
@ -56,15 +50,13 @@ string & ControlPreamble::params() const
void ControlPreamble::setParams()
{
if (params_) delete params_;
delete params_;
params_ = new string(lv_.buffer()->params.preamble);
}
void ControlPreamble::clearParams()
{
if (params_) {
delete params_;
params_ = 0;
}
delete params_;
params_ = 0;
}

View File

@ -16,6 +16,8 @@
#include "ControlDialog_impl.h"
#include "LString.h"
/** A controller for Preamble dialogs.
*/
class ControlPreamble : public ControlDialogBD {

View File

@ -12,17 +12,15 @@
*/
#include <config.h>
#include <utility>
#ifdef __GNUG__
#pragma implementation
#endif
#include "ControlPrint.h"
#include "ViewBase.h"
#include "ButtonControllerBase.h"
#include "ControlPrint.h"
#include "buffer.h"
#include "Dialogs.h"
#include "frontends/LyXView.h"
#include "PrinterParams.h"
#include "Liason.h"
@ -32,18 +30,14 @@
#include "BufferView.h"
#include "support/LAssert.h"
#include <boost/bind.hpp>
using Liason::printBuffer;
using Liason::getPrinterParams;
using std::make_pair;
ControlPrint::ControlPrint(LyXView & lv, Dialogs & d)
: ControlDialogBD(lv, d),
params_(0)
{
d_.showPrint = boost::bind(&ControlPrint::show, this);
}
{}
void ControlPrint::apply()

View File

@ -21,6 +21,8 @@
#include "ControlDialog_impl.h"
#include "LString.h"
class PrinterParams;
/** A controller for Print dialogs.

View File

@ -18,33 +18,19 @@
#endif
#include "ControlRef.h"
#include "ViewBase.h"
#include "ButtonControllerBase.h"
#include "Dialogs.h"
#include "buffer.h"
#include "lyxfunc.h"
#include "bufferlist.h"
#include "debug.h"
#include "frontends/LyXView.h"
#include "support/filetools.h" // MakeAbsPath, MakeDisplayPath
#include <boost/bind.hpp>
#include <algorithm>
using std::vector;
using std::find;
extern BufferList bufferlist;
ControlRef::ControlRef(LyXView & lv, Dialogs & d)
: ControlCommand(lv, d, LFUN_REF_INSERT)
{
d_.showRef = boost::bind(&ControlRef::showInset, this, _1);
d_.createRef = boost::bind(&ControlRef::createInset, this, _1);
}
{}
vector<string> const ControlRef::getLabelList(string const & name) const

View File

@ -18,13 +18,9 @@
#endif
#include "ControlSearch.h"
#include "ViewBase.h"
#include "ButtonControllerBase.h"
#include "Dialogs.h"
#include "Liason.h"
#include "buffer.h"
#include "lyxfind.h"
#include "debug.h"
#include "gettext.h"
#include "BufferView.h"
@ -32,26 +28,20 @@
#include "support/lstrings.h"
#include <boost/bind.hpp>
using Liason::setMinibuffer;
ControlSearch::ControlSearch(LyXView & lv, Dialogs & d)
: ControlDialogBD(lv, d)
{
d_.showSearch = boost::bind(&ControlSearch::show, this);
// perhaps in the future we'd like a
// "search again" button/keybinding
// d_.searchAgain.connect(SigC::slot(this, &ControlSearch::FindNext));
}
{}
void ControlSearch::find(string const & search,
bool casesensitive, bool matchword, bool forward) const
{
bool const found = LyXFind(lv_.view(), search,
forward, false, casesensitive, matchword);
bool const found = lyxfind::LyXFind(lv_.view(), search,
forward, casesensitive,
matchword);
if (!found)
setMinibuffer(&lv_, _("String not found!"));
@ -65,9 +55,10 @@ void ControlSearch::replace(string const & search, string const & replace,
// move on to the next instance once the present instance has been
// changed
bool const once = !all;
int const replace_count = LyXReplace(lv_.view(),
search, replace, true, casesensitive,
matchword, all, once);
int const replace_count =
lyxfind::LyXReplace(lv_.view(),
search, replace, true, casesensitive,
matchword, all, once);
if (replace_count == 0) {
setMinibuffer(&lv_, _("String not found!"));

View File

@ -12,10 +12,8 @@
#pragma implementation
#endif
#include "ViewBase.h"
#include "ButtonControllerBase.h"
#include "ControlSendto.h"
#include "Dialogs.h"
#include "ViewBase.h"
#include "frontends/LyXView.h"
#include "BufferView.h"
#include "buffer.h"
@ -28,19 +26,14 @@
#include "support/lstrings.h"
#include "support/systemcall.h"
#include <boost/bind.hpp>
#include <fstream>
using std::vector;
ControlSendto::ControlSendto(LyXView & lv, Dialogs & d)
: ControlDialogBD(lv, d),
format_(0),
command_(lyxrc.custom_export_command)
{
d_.showSendto = boost::bind(&ControlSendto::show, this);
}
{}
vector<Format const *> const ControlSendto::allFormats() const

View File

@ -15,6 +15,8 @@
#endif
#include "ControlDialog_impl.h"
#include "LString.h"
#include <vector>
class Format;

View File

@ -13,24 +13,13 @@
#endif
#include "ControlShowFile.h"
#include "ViewBase.h"
#include "ButtonControllerBase.h"
#include "Dialogs.h"
#include "frontends/LyXView.h"
#include "BufferView.h"
#include "gettext.h"
#include "support/filetools.h" // FileSearch
#include <boost/bind.hpp>
#include <fstream>
ControlShowFile::ControlShowFile(LyXView & lv, Dialogs & d)
: ControlDialogBI(lv, d)
{
d_.showFile = boost::bind(&ControlShowFile::showFile, this, _1);
}
{}
void ControlShowFile::showFile(string const & file)

View File

@ -26,7 +26,6 @@
#include "language.h"
#include "ViewBase.h"
#include "ButtonControllerBase.h"
#include "Dialogs.h"
#include "Liason.h"
@ -39,10 +38,6 @@
# include "sp_pspell.h"
#endif
#include "debug.h"
#include <boost/bind.hpp>
#include <sys/types.h> // needed by <sys/select.h> at least on freebsd
#ifdef HAVE_SYS_SELECT_H
@ -60,9 +55,7 @@ ControlSpellchecker::ControlSpellchecker(LyXView & lv, Dialogs & d)
: ControlDialogBD(lv, d),
rtl_(false), newval_(0.0), oldval_(0), newvalue_(0), count_(0),
stop_(false), result_(SpellBase::ISP_OK), speller_(0)
{
d_.showSpellchecker = boost::bind(&ControlSpellchecker::show, this);
}
{}
void ControlSpellchecker::setParams()

View File

@ -20,20 +20,16 @@
#include "ViewBase.h"
#include "ButtonControllerBase.h"
#include "BufferView.h"
#include "Dialogs.h"
#include "lyxfunc.h"
#include "frontends/LyXView.h"
#include "support/lstrings.h"
#include <boost/bind.hpp>
ControlTabularCreate::ControlTabularCreate(LyXView & lv, Dialogs & d)
: ControlDialogBD(lv, d)
{
d_.showTabularCreate = boost::bind(&ControlTabularCreate::show, this);
}
{}
ControlTabularCreate::rowsCols & ControlTabularCreate::params()

View File

@ -18,8 +18,6 @@
#endif
#include "ControlTexinfo.h"
#include "ViewBase.h"
#include "ButtonControllerBase.h"
#include "Dialogs.h"
#include "BufferView.h"
#include "gettext.h"
@ -32,16 +30,12 @@
#include "support/path.h"
#include "support/lstrings.h"
#include <boost/bind.hpp>
extern string user_lyxdir; // home of *Files.lst
ControlTexinfo::ControlTexinfo(LyXView & lv, Dialogs & d)
: ControlDialogBI(lv, d)
{
d_.showTexinfo = boost::bind(&ControlTexinfo::show, this);
}
{}
// build filelists of all availabe bst/cls/sty-files. done through

View File

@ -13,27 +13,20 @@
#endif
#include "ControlThesaurus.h"
#include "ViewBase.h"
#include "ButtonControllerBase.h"
#include "Dialogs.h"
#include "Liason.h"
#include "lyxfind.h"
#include "buffer.h"
#include "debug.h"
#include "gettext.h"
#include "BufferView.h"
#include "frontends/LyXView.h"
#include <boost/bind.hpp>
using Liason::setMinibuffer;
ControlThesaurus::ControlThesaurus(LyXView & lv, Dialogs & d)
: ControlDialogBD(lv, d)
{
d_.showThesaurus = boost::bind(&ControlThesaurus::showEntry, this, _1);
}
{}
void ControlThesaurus::showEntry(string const & entry)
@ -49,8 +42,9 @@ void ControlThesaurus::replace(string const & newstr)
* on a particular charpos in a paragraph that is broken on
* deletion/change !
*/
int const replace_count = LyXReplace(lv_.view(), oldstr_, newstr,
true, true, true, false, true);
int const replace_count =
lyxfind::LyXReplace(lv_.view(), oldstr_, newstr,
true, true, true, false, true);
oldstr_ = newstr;

View File

@ -18,28 +18,20 @@
#endif
#include "ControlToc.h"
#include "ViewBase.h"
#include "ButtonControllerBase.h"
#include "buffer.h"
#include "Dialogs.h"
#include "lyxfunc.h"
#include "gettext.h"
#include "BufferView.h"
#include "frontends/LyXView.h"
#include "support/lstrings.h" // tostr
#include <boost/bind.hpp>
using std::vector;
ControlToc::ControlToc(LyXView & lv, Dialogs & d)
: ControlCommand(lv, d, LFUN_TOC_INSERT)
{
d_.showTOC = boost::bind(&ControlToc::showInset, this, _1);
d_.createTOC = boost::bind(&ControlToc::createInset, this, _1);
}
{}
void ControlToc::Goto(int const & id) const

View File

@ -18,18 +18,8 @@
#endif
#include "ControlUrl.h"
#include "ViewBase.h"
#include "ButtonControllerBase.h"
#include "Dialogs.h"
#include "buffer.h"
#include "frontends/LyXView.h"
#include <boost/bind.hpp>
ControlUrl::ControlUrl(LyXView & lv, Dialogs & d)
: ControlCommand(lv, d, LFUN_INSERT_URL)
{
d_.showUrl = boost::bind(&ControlUrl::showInset, this, _1);
d_.createUrl = boost::bind(&ControlUrl::createInset, this, _1);
}
{}

View File

@ -20,11 +20,9 @@
#include "ControlVCLog.h"
#include "Lsstream.h"
#include "ViewBase.h"
#include "ButtonControllerBase.h"
#include "buffer.h"
#include "BufferView.h"
#include "Dialogs.h"
#include "lyxrc.h"
#include "gettext.h"
@ -32,17 +30,15 @@
#include "support/lyxlib.h"
#include <boost/bind.hpp>
#include <fstream>
using std::endl;
ControlVCLog::ControlVCLog(LyXView & lv, Dialogs & d)
: ControlDialogBD(lv, d)
{
d_.showVCLogFile = boost::bind(&ControlVCLog::show, this);
}
{}
string const ControlVCLog::getBufferFileName() const
{

View File

@ -11,38 +11,7 @@
#define GUI_H
#include "ButtonController.h"
#include "ButtonPolicies.h"
#include "ControlAboutlyx.h"
#include "ControlBibitem.h"
#include "ControlBibtex.h"
#include "ControlCharacter.h"
#include "ControlCitation.h"
#include "ControlError.h"
#include "ControlERT.h"
#include "ControlExternal.h"
#include "ControlFloat.h"
#include "ControlForks.h"
#include "ControlGraphics.h"
#include "insets/insetgraphicsParams.h"
#include "ControlInclude.h"
#include "ControlIndex.h"
#include "ControlLog.h"
#include "ControlMinipage.h"
#include "ControlParagraph.h"
#include "ControlPreamble.h"
#include "ControlPrint.h"
#include "ControlRef.h"
#include "ControlSearch.h"
#include "ControlSendto.h"
#include "ControlShowFile.h"
#include "ControlSpellchecker.h"
#include "ControlTabularCreate.h"
#include "ControlTexinfo.h"
#include "ControlThesaurus.h"
#include "ControlToc.h"
#include "ControlUrl.h"
#include "ControlVCLog.h"
#include "ViewBase.h"
/** This class instantiates and makes available the GUI-specific
ButtonController and View.
@ -57,6 +26,45 @@ public:
///
virtual ViewBase & view() { return view_; }
friend void gui_ShowAboutlyx(LyXView &, Dialogs &);
friend void gui_ShowBibitem(InsetCommand *, LyXView &, Dialogs &);
friend void gui_ShowBibtex(InsetCommand *, LyXView &, Dialogs &);
friend void gui_ShowCharacter(LyXView &, Dialogs &);
friend void gui_SetUserFreeFont(LyXView &, Dialogs &);
friend void gui_ShowCitation(InsetCommand *, LyXView &, Dialogs &);
friend void gui_CreateCitation(string const &, LyXView &, Dialogs &);
friend void gui_ShowDocument(LyXView &, Dialogs &);
friend void gui_ShowError(InsetError *, LyXView &, Dialogs &);
friend void gui_ShowERT(InsetERT *, LyXView &, Dialogs &);
friend void gui_UpdateERT(InsetERT *, LyXView &, Dialogs &);
friend void gui_ShowExternal(InsetExternal *, LyXView &, Dialogs &);
friend void gui_ShowFloat(InsetFloat *, LyXView &, Dialogs &);
friend void gui_ShowForks(LyXView &, Dialogs &);
friend void gui_ShowGraphics(InsetGraphics *, LyXView &, Dialogs &);
friend void gui_ShowInclude(InsetInclude *, LyXView &, Dialogs &);
friend void gui_ShowIndex(InsetCommand *, LyXView &, Dialogs &);
friend void gui_CreateIndex(string const &, LyXView &, Dialogs &);
friend void gui_ShowLogFile(LyXView &, Dialogs &);
friend void gui_ShowMathPanel(LyXView &, Dialogs &);
friend void gui_ShowMinipage(InsetMinipage *, LyXView &, Dialogs &);
friend void gui_UpdateMinipage(InsetMinipage *, LyXView &, Dialogs &);
friend void gui_ShowParagraph(LyXView &, Dialogs &);
friend void gui_ShowPreamble(LyXView &, Dialogs &);
friend void gui_ShowPreferences(LyXView &, Dialogs &);
friend void gui_ShowPrint(LyXView &, Dialogs &);
friend void gui_ShowRef(InsetCommand *, LyXView &, Dialogs &);
friend void gui_CreateRef(string const &, LyXView &, Dialogs &);
friend void gui_ShowSearch(LyXView &, Dialogs &);
friend void gui_ShowSendto(LyXView &, Dialogs &);
friend void gui_ShowSpellchecker(LyXView &, Dialogs &);
friend void gui_ShowTabularCreate(LyXView &, Dialogs &);
friend void gui_ShowTexinfo(LyXView &, Dialogs &);
friend void gui_ShowTOC(InsetCommand *, LyXView &, Dialogs &);
friend void gui_CreateTOC(string const &, LyXView &, Dialogs &);
friend void gui_ShowUrl(InsetCommand *, LyXView &, Dialogs &);
friend void gui_CreateUrl(string const &, LyXView &, Dialogs &);
friend void gui_ShowVCLogFile(LyXView &, Dialogs &);
private:
///
ButtonController<Policy, GUIbc> bc_;
@ -64,357 +72,4 @@ private:
GUIview view_;
};
#if 0
/** Specialization for About LyX dialog
*/
template <class GUIview, class GUIbc>
class GUIAboutlyx :
public GUI<ControlAboutlyx, GUIview, OkCancelPolicy, GUIbc> {
public:
///
GUIAboutlyx(LyXView & lv, Dialogs & d)
: GUI<ControlAboutlyx, GUIview, OkCancelPolicy, GUIbc>(lv, d) {}
};
/** Specialization for Bibitem dialog
*/
template <class GUIview, class GUIbc>
class GUIBibitem :
public GUI<ControlBibitem, GUIview, OkCancelReadOnlyPolicy, GUIbc> {
public:
///
GUIBibitem(LyXView & lv, Dialogs & d)
: GUI<ControlBibitem, GUIview, OkCancelReadOnlyPolicy, GUIbc>(lv, d) {}
};
/** Specialization for Bibtex dialog
*/
template <class GUIview, class GUIbc>
class GUIBibtex :
public GUI<ControlBibtex, GUIview, OkCancelReadOnlyPolicy, GUIbc> {
public:
///
GUIBibtex(LyXView & lv, Dialogs & d)
: GUI<ControlBibtex, GUIview, OkCancelReadOnlyPolicy, GUIbc>(lv, d) {}
};
/** Specialization for Character dialog
*/
template <class GUIview, class GUIbc>
class GUICharacter : public GUI<ControlCharacter, GUIview,
OkApplyCancelReadOnlyPolicy, GUIbc>
{
public:
///
GUICharacter(LyXView & lv, Dialogs & d)
: GUI<ControlCharacter, GUIview,
OkApplyCancelReadOnlyPolicy, GUIbc>(lv, d) {}
};
/** Specialization for Citation dialog
*/
template <class GUIview, class GUIbc>
class GUICitation : public GUI<ControlCitation, GUIview,
NoRepeatedApplyReadOnlyPolicy, GUIbc>
{
public:
///
GUICitation(LyXView & lv, Dialogs & d)
: GUI<ControlCitation, GUIview,
NoRepeatedApplyReadOnlyPolicy, GUIbc>(lv, d) {}
};
/** Specialization for Error dialog
*/
template <class GUIview, class GUIbc>
class GUIError :
public GUI<ControlError, GUIview, OkCancelPolicy, GUIbc> {
public:
///
GUIError(LyXView & lv, Dialogs & d)
: GUI<ControlError, GUIview, OkCancelPolicy, GUIbc>(lv, d) {}
};
/** Specialization for ERT dialog
*/
template <class GUIview, class GUIbc>
class GUIERT :
public GUI<ControlERT, GUIview, NoRepeatedApplyReadOnlyPolicy, GUIbc> {
public:
///
GUIERT(LyXView & lv, Dialogs & d)
: GUI<ControlERT, GUIview, NoRepeatedApplyReadOnlyPolicy, GUIbc>(lv, d) {}
};
/** Specialization for External dialog
*/
template <class GUIview, class GUIbc>
class GUIExternal :
public GUI<ControlExternal, GUIview, OkApplyCancelReadOnlyPolicy, GUIbc> {
public:
///
GUIExternal(LyXView & lv, Dialogs & d)
: GUI<ControlExternal, GUIview, OkApplyCancelReadOnlyPolicy, GUIbc>(lv, d) {}
};
/** Specialization for Forks dialog
*/
template <class GUIview, class GUIbc>
class GUIForks :
public GUI<ControlForks, GUIview, OkApplyCancelPolicy, GUIbc> {
public:
///
GUIForks(LyXView & lv, Dialogs & d)
: GUI<ControlForks, GUIview, OkApplyCancelPolicy, GUIbc>(lv, d) {}
};
/** Specialization for Graphics dialog
*/
template <class GUIview, class GUIbc>
class GUIGraphics :
public GUI<ControlGraphics, GUIview, NoRepeatedApplyReadOnlyPolicy, GUIbc> {
public:
///
GUIGraphics(LyXView & lv, Dialogs & d)
: GUI<ControlGraphics, GUIview, NoRepeatedApplyReadOnlyPolicy, GUIbc>(lv, d) {}
};
/** Specialization for Include dialog
*/
template <class GUIview, class GUIbc>
class GUIInclude :
public GUI<ControlInclude, GUIview, OkCancelReadOnlyPolicy, GUIbc> {
public:
///
GUIInclude(LyXView & lv, Dialogs & d)
: GUI<ControlInclude, GUIview, OkCancelReadOnlyPolicy, GUIbc>(lv, d) {}
};
/** Specialization for Index dialog
*/
template <class GUIview, class GUIbc>
class GUIIndex :
public GUI<ControlIndex, GUIview, NoRepeatedApplyReadOnlyPolicy, GUIbc> {
public:
///
GUIIndex(LyXView & lv, Dialogs & d)
: GUI<ControlIndex, GUIview, NoRepeatedApplyReadOnlyPolicy, GUIbc>(lv, d) {}
};
/** Specialization for Log dialog
*/
template <class GUIview, class GUIbc>
class GUILog :
public GUI<ControlLog, GUIview, OkCancelPolicy, GUIbc> {
public:
///
GUILog(LyXView & lv, Dialogs & d)
: GUI<ControlLog, GUIview, OkCancelPolicy, GUIbc>(lv, d) {}
};
/** Specialization for Minipage dialog
*/
template <class GUIview, class GUIbc>
class GUIMinipage :
public GUI<ControlMinipage, GUIview, NoRepeatedApplyReadOnlyPolicy, GUIbc> {
public:
///
GUIMinipage(LyXView & lv, Dialogs & d)
: GUI<ControlMinipage, GUIview, NoRepeatedApplyReadOnlyPolicy, GUIbc>(lv, d) {}
};
/** Specialization for Float dialog
*/
template <class GUIview, class GUIbc>
class GUIFloat :
public GUI<ControlFloat, GUIview, NoRepeatedApplyReadOnlyPolicy, GUIbc> {
public:
///
GUIFloat(LyXView & lv, Dialogs & d)
: GUI<ControlFloat, GUIview, NoRepeatedApplyReadOnlyPolicy, GUIbc>(lv, d) {}
};
/** Specialization for Paragraph dialog
*/
template <class GUIview, class GUIbc>
class GUIParagraph : public GUI<ControlParagraph, GUIview,
OkApplyCancelReadOnlyPolicy, GUIbc>
{
public:
///
GUIParagraph(LyXView & lv, Dialogs & d)
: GUI<ControlParagraph, GUIview,
OkApplyCancelReadOnlyPolicy, GUIbc>(lv, d) {}
};
/** Specialization for Preamble dialog
*/
template <class GUIview, class GUIbc>
class GUIPreamble :
public GUI<ControlPreamble, GUIview, NoRepeatedApplyReadOnlyPolicy, GUIbc> {
public:
///
GUIPreamble(LyXView & lv, Dialogs & d)
: GUI<ControlPreamble, GUIview, NoRepeatedApplyReadOnlyPolicy, GUIbc>(lv, d) {}
};
/** Specialization for Print dialog
*/
template <class GUIview, class GUIbc>
class GUIPrint :
public GUI<ControlPrint, GUIview, OkApplyCancelPolicy, GUIbc> {
public:
///
GUIPrint(LyXView & lv, Dialogs & d)
: GUI<ControlPrint, GUIview, OkApplyCancelPolicy, GUIbc>(lv, d) {}
};
/** Specialization for Ref dialog
*/
template <class GUIview, class GUIbc>
class GUIRef :
public GUI<ControlRef, GUIview, NoRepeatedApplyReadOnlyPolicy, GUIbc> {
public:
///
GUIRef(LyXView & lv, Dialogs & d)
: GUI<ControlRef, GUIview, NoRepeatedApplyReadOnlyPolicy, GUIbc>(lv, d) {}
};
/** Specialization for Search dialog
*/
template <class GUIview, class GUIbc>
class GUISearch :
public GUI<ControlSearch, GUIview, NoRepeatedApplyReadOnlyPolicy, GUIbc> {
public:
///
GUISearch(LyXView & lv, Dialogs & d)
: GUI<ControlSearch, GUIview, NoRepeatedApplyReadOnlyPolicy, GUIbc>(lv, d) {}
};
/** Specialization for Sendto dialog
*/
template <class GUIview, class GUIbc>
class GUISendto :
public GUI<ControlSendto, GUIview, OkApplyCancelPolicy, GUIbc> {
public:
///
GUISendto(LyXView & lv, Dialogs & d)
: GUI<ControlSendto, GUIview, OkApplyCancelPolicy, GUIbc>(lv, d) {}
};
/** Specialization for ShowFile dialog
*/
template <class GUIview, class GUIbc>
class GUIShowFile :
public GUI<ControlShowFile, GUIview, OkCancelPolicy, GUIbc> {
public:
///
GUIShowFile(LyXView & lv, Dialogs & d)
: GUI<ControlShowFile, GUIview, OkCancelPolicy, GUIbc>(lv, d) {}
};
/** Specialization for Spellchecker dialog
*/
template <class GUIview, class GUIbc>
class GUISpellchecker :
public GUI<ControlSpellchecker, GUIview, NoRepeatedApplyReadOnlyPolicy, GUIbc> {
public:
///
GUISpellchecker(LyXView & lv, Dialogs & d)
: GUI<ControlSpellchecker, GUIview, NoRepeatedApplyReadOnlyPolicy, GUIbc>(lv, d) {}
};
/** Specialization for Toc dialog
*/
template <class GUIview, class GUIbc>
class GUIToc :
public GUI<ControlToc, GUIview, OkCancelPolicy, GUIbc> {
public:
///
GUIToc(LyXView & lv, Dialogs & d)
: GUI<ControlToc, GUIview, OkCancelPolicy, GUIbc>(lv, d) {}
};
/** Specialization for TabularCreate dialog
*/
template <class GUIview, class GUIbc>
class GUITabularCreate :
public GUI<ControlTabularCreate, GUIview,
OkApplyCancelReadOnlyPolicy, GUIbc> {
public:
///
GUITabularCreate(LyXView & lv, Dialogs & d)
: GUI<ControlTabularCreate, GUIview,
OkApplyCancelReadOnlyPolicy, GUIbc>(lv, d) {}
};
/** Specialization for Texinfo dialog
*/
template <class GUIview, class GUIbc>
class GUITexinfo :
public GUI<ControlTexinfo, GUIview, OkCancelPolicy, GUIbc> {
public:
///
GUITexinfo(LyXView & lv, Dialogs & d)
: GUI<ControlTexinfo, GUIview, OkCancelPolicy, GUIbc>(lv, d) {}
};
/** Specialization for Thesaurus dialog
*/
template <class GUIview, class GUIbc>
class GUIThesaurus :
public GUI<ControlThesaurus, GUIview,
OkApplyCancelReadOnlyPolicy, GUIbc> {
public:
///
GUIThesaurus(LyXView & lv, Dialogs & d)
: GUI<ControlThesaurus, GUIview,
OkApplyCancelReadOnlyPolicy, GUIbc>(lv, d) {}
};
/** Specialization for Url dialog
*/
template <class GUIview, class GUIbc>
class GUIUrl :
public GUI<ControlUrl, GUIview, NoRepeatedApplyReadOnlyPolicy, GUIbc> {
public:
///
GUIUrl(LyXView & lv, Dialogs & d)
: GUI<ControlUrl, GUIview, NoRepeatedApplyReadOnlyPolicy, GUIbc>(lv, d) {}
};
/** Specialization for VCLog dialog
*/
template <class GUIview, class GUIbc>
class GUIVCLog :
public GUI<ControlVCLog, GUIview, OkCancelPolicy, GUIbc> {
public:
///
GUIVCLog(LyXView & lv, Dialogs & d)
: GUI<ControlVCLog, GUIview, OkCancelPolicy, GUIbc>(lv, d) {}
};
#endif
#endif // GUI_H

66
src/frontends/guiapi.h Normal file
View File

@ -0,0 +1,66 @@
// -*- C++ -*-
#include "LString.h"
class LyXView;
class Dialogs;
class InsetCommand;
class InsetError;
class InsetERT;
class InsetExternal;
class InsetFloat;
class InsetGraphics;
class InsetInclude;
class InsetInfo;
class InsetMinipage;
class InsetTabular;
extern "C" {
void gui_ShowAboutlyx(LyXView &, Dialogs &);
void gui_ShowBibitem(InsetCommand * ic, LyXView & lv, Dialogs & d);
void gui_ShowBibtex(InsetCommand * ic, LyXView & lv, Dialogs & d);
void gui_ShowCharacter(LyXView & lv, Dialogs & d);
void gui_SetUserFreeFont(LyXView & lv, Dialogs & d);
void gui_ShowCitation(InsetCommand * ic, LyXView & lv, Dialogs & d);
void gui_CreateCitation(string const &, LyXView & lv, Dialogs & d);
void gui_ShowDocument(LyXView & lv, Dialogs & d);
void gui_ShowError(InsetError * ie, LyXView & lv, Dialogs & d);
void gui_ShowERT(InsetERT * ie, LyXView & lv, Dialogs & d);
void gui_UpdateERT(InsetERT * ie, LyXView & lv, Dialogs & d);
void gui_ShowExternal(InsetExternal * ie, LyXView & lv, Dialogs & d);
void gui_ShowFile(string const & f, LyXView & lv, Dialogs & d);
void gui_ShowFloat(InsetFloat *, LyXView & lv, Dialogs &);
void gui_ShowForks(LyXView & lv, Dialogs & d);
void gui_ShowGraphics(InsetGraphics *, LyXView & lv, Dialogs & d);
void gui_ShowInclude(InsetInclude *, LyXView & lv, Dialogs & d);
void gui_ShowIndex(InsetCommand *, LyXView & lv, Dialogs & d);
void gui_CreateIndex(string const &, LyXView & lv, Dialogs & d);
void gui_ShowInfo(InsetInfo *, LyXView & lv, Dialogs & d);
void gui_ShowLogFile(LyXView & lv, Dialogs & d);
void gui_ShowMathPanel(LyXView & lv, Dialogs & d);
void gui_ShowMinipage(InsetMinipage *, LyXView & lv, Dialogs & d);
void gui_UpdateMinipage(InsetMinipage *, LyXView & lv, Dialogs & d);
void gui_ShowParagraph(LyXView & lv, Dialogs & d);
void gui_UpdateParagraph(LyXView & lv, Dialogs & d);
void gui_ShowPreamble(LyXView & lv, Dialogs & d);
void gui_ShowPreferences(LyXView & lv, Dialogs & d);
void gui_ShowPrint(LyXView & lv, Dialogs & d);
void gui_ShowRef(InsetCommand *, LyXView &, Dialogs &);
void gui_CreateRef(string const &, LyXView &, Dialogs &);
void gui_ShowSearch(LyXView & lv, Dialogs & d);
void gui_ShowSendto(LyXView & lv, Dialogs & d);
void gui_ShowSpellchecker(LyXView & lv, Dialogs & d);
void gui_ShowSpellcheckerPreferences(LyXView & lv, Dialogs & d);
void gui_ShowTabular(InsetTabular *, LyXView &, Dialogs &);
void gui_UpdateTabular(InsetTabular *, LyXView &, Dialogs &);
void gui_ShowTabularCreate(LyXView & lv, Dialogs & d);
void gui_ShowTexinfo(LyXView & lv, Dialogs & d);
void gui_ShowThesaurus(string const &, LyXView &, Dialogs &);
void gui_ShowTOC(InsetCommand *, LyXView &, Dialogs &);
void gui_CreateTOC(string const &, LyXView &, Dialogs &);
void gui_ShowUrl(InsetCommand *, LyXView &, Dialogs &);
void gui_CreateUrl(string const &, LyXView &, Dialogs &);
void gui_ShowVCLogFile(LyXView & lv, Dialogs & d);
} // extern "C"

View File

@ -1,280 +1,83 @@
/* This file is part of
* ======================================================
*
* LyX, The Document Processor
*
* Copyright 1995 Matthias Ettrich
* Copyright 1995-1998 The LyX Team
*
* ====================================================== */
#include <config.h>
/**
* \file screen.C
* Copyright 2002 the LyX Team
* Read the file COPYING
*
* \author John Levon <moz@compsoc.man.ac.uk>
*/
#ifdef __GNUG__
#pragma implementation
#endif
#include <algorithm>
#include <config.h>
#include "screen.h"
#include "lyxtext.h"
#include "lyxrow.h"
#include "frontends/Painter.h"
#include "frontends/WorkArea.h"
#include "buffer.h"
#include "BufferView.h"
#include "buffer.h"
#include "WorkArea.h"
#include "Painter.h"
#include "font_metrics.h"
#include "insets/insettext.h"
#include "frontends/xforms/ColorHandler.h"
#include "language.h"
#include "debug.h"
using std::max;
using std::min;
using std::max;
using std::endl;
namespace {
GC createGC()
LyXScreen::LyXScreen()
: force_clear_(true), cursor_visible_(false)
{
XGCValues val;
val.foreground = BlackPixel(fl_get_display(),
DefaultScreen(fl_get_display()));
val.function = GXcopy;
val.graphics_exposures = false;
val.line_style = LineSolid;
val.line_width = 0;
return XCreateGC(fl_get_display(), RootWindow(fl_get_display(), 0),
GCForeground | GCFunction | GCGraphicsExposures
| GCLineWidth | GCLineStyle , &val);
}
} // namespace anon
// Constructor
LScreen::LScreen(WorkArea & o)
: owner(o), force_clear(true)
{
// the cursor isnt yet visible
cursor_visible = false;
cursor_pixmap = 0;
cursor_pixmap_x = 0;
cursor_pixmap_y = 0;
cursor_pixmap_w = 0;
cursor_pixmap_h = 0;
// We need this GC
gc_copy = createGC();
}
LScreen::~LScreen()
LyXScreen::~LyXScreen()
{
XFreeGC(fl_get_display(), gc_copy);
}
// FIXME: GUII these cursor methods need to decide
// whether the workarea is focused or not
void LScreen::reset()
void LyXScreen::showCursor(LyXText const * text, BufferView const * bv)
{
XFreeGC(fl_get_display(), gc_copy);
// the cursor isnt yet visible
cursor_visible = false;
cursor_pixmap = 0;
cursor_pixmap_x = 0;
cursor_pixmap_y = 0;
cursor_pixmap_w = 0;
cursor_pixmap_h = 0;
if (cursor_visible_)
return;
// We need this GC
gc_copy = createGC();
}
workarea().getPainter().start();
Cursor_Shape shape = BAR_SHAPE;
BufferParams const & bp(bv->buffer()->params);
LyXFont const & realfont(text->real_current_font);
void LScreen::setCursorColor()
{
if (!lyxColorHandler.get()) return;
GC gc = lyxColorHandler->getGCForeground(LColor::cursor);
XGCValues val;
XGetGCValues(fl_get_display(),
gc, GCForeground, &val);
XChangeGC(fl_get_display(), gc_copy, GCForeground, &val);
}
void LScreen::redraw(LyXText * text, BufferView * bv)
{
drawFromTo(text, bv, 0, owner.workHeight(), 0, 0, text == bv->text);
expose(0, 0, owner.workWidth(), owner.workHeight());
if (cursor_visible) {
cursor_visible = false;
bv->showCursor();
if (realfont.language() != bp.language
|| realfont.isVisibleRightToLeft()
!= bp.language->RightToLeft()) {
shape = (realfont.isVisibleRightToLeft())
? REVERSED_L_SHAPE : L_SHAPE;
}
showManualCursor(text, text->cursor.x(), text->cursor.y(),
font_metrics::maxAscent(realfont),
font_metrics::maxDescent(realfont),
shape);
workarea().getPainter().end();
}
void LScreen::expose(int x, int y, int exp_width, int exp_height)
{
XCopyArea(fl_get_display(),
owner.getPixmap(),
owner.getWin(),
gc_copy,
x, y,
exp_width, exp_height,
x + owner.xpos(),
y + owner.ypos());
}
void LScreen::drawFromTo(LyXText * text, BufferView * bv,
int y1, int y2, int y_offset, int x_offset,
bool internal)
{
int y_text = text->first_y + y1;
// get the first needed row
Row * row = text->getRowNearY(y_text);
// y_text is now the real beginning of the row
int y = y_text - text->first_y;
// y1 is now the real beginning of row on the screen
while (row != 0 && y < y2) {
LyXText::text_status st = text->status();
text->getVisibleRow(bv, y + y_offset,
x_offset, row, y + text->first_y);
internal = internal && (st != LyXText::CHANGED_IN_DRAW);
while (internal && text->status() == LyXText::CHANGED_IN_DRAW) {
text->fullRebreak(bv);
st = LyXText::NEED_MORE_REFRESH;
text->setCursor(bv, text->cursor.par(),
text->cursor.pos());
text->status(bv, st);
// we should be sure our row-pointer is still valid, so it's
// better to recompute it.
y_text = y + text->first_y;
row = text->getRowNearY(y_text);
y = y_text - text->first_y;
text->getVisibleRow(bv, y + y_offset,
x_offset, row, y + text->first_y);
}
y += row->height();
row = row->next();
}
force_clear = false;
// maybe we have to clear the screen at the bottom
if ((y < y2) && text->bv_owner) {
owner.getPainter().fillRectangle(0, y,
owner.workWidth(),
y2 - y,
LColor::bottomarea);
}
}
void LScreen::drawOneRow(LyXText * text, BufferView * bv, Row * row,
int y_text, int y_offset, int x_offset)
{
int const y = y_text - text->first_y + y_offset;
if (((y + row->height()) > 0) &&
((y - row->height()) <= static_cast<int>(owner.workHeight()))) {
// ok there is something visible
text->getVisibleRow(bv, y, x_offset, row, y + text->first_y);
}
force_clear = false;
}
/* draws the screen, starting with textposition y. uses as much already
* printed pixels as possible */
void LScreen::draw(LyXText * text, BufferView * bv, unsigned int y)
{
if (cursor_visible) hideCursor();
int const old_first = text->first_y;
bool internal = (text == bv->text);
text->first_y = y;
// is any optimiziation possible?
if ((y - old_first) < owner.workHeight()
&& (old_first - y) < owner.workHeight())
{
if (text->first_y < old_first) {
drawFromTo(text, bv, 0,
old_first - text->first_y, 0, 0, internal);
XCopyArea (fl_get_display(),
owner.getWin(),
owner.getWin(),
gc_copy,
owner.xpos(),
owner.ypos(),
owner.workWidth(),
owner.workHeight() - old_first + text->first_y,
owner.xpos(),
owner.ypos() + old_first - text->first_y
);
// expose the area drawn
expose(0, 0,
owner.workWidth(),
old_first - text->first_y);
} else {
drawFromTo(text, bv,
owner.workHeight() + old_first - text->first_y,
owner.workHeight(), 0, 0, internal);
XCopyArea (fl_get_display(),
owner.getWin(),
owner.getWin(),
gc_copy,
owner.xpos(),
owner.ypos() + text->first_y - old_first,
owner.workWidth(),
owner.workHeight() + old_first - text->first_y,
owner.xpos(),
owner.ypos());
// expose the area drawn
expose(0, owner.workHeight() + old_first - text->first_y,
owner.workWidth(), text->first_y - old_first);
}
} else {
// make a dumb new-draw
drawFromTo(text, bv, 0, owner.workHeight(), 0, 0, internal);
expose(0, 0, owner.workWidth(), owner.workHeight());
}
}
void LScreen::showCursor(LyXText const * text, BufferView const * bv)
{
if (!cursor_visible) {
Cursor_Shape shape = BAR_SHAPE;
if (text->real_current_font.language() !=
bv->buffer()->params.language
|| text->real_current_font.isVisibleRightToLeft()
!= bv->buffer()->params.language->RightToLeft())
shape = (text->real_current_font.isVisibleRightToLeft())
? REVERSED_L_SHAPE : L_SHAPE;
showManualCursor(text, text->cursor.x(), text->cursor.y(),
font_metrics::maxAscent(text->real_current_font),
font_metrics::maxDescent(text->real_current_font),
shape);
}
}
/* returns true if first has changed, otherwise false */
bool LScreen::fitManualCursor(LyXText * text, BufferView * bv,
int /*x*/, int y, int asc, int desc)
bool LyXScreen::fitManualCursor(BufferView * bv, LyXText * text,
int /*x*/, int y, int asc, int desc)
{
int const vheight = workarea().workHeight();
int newtop = text->first_y;
if (y + desc - text->first_y >= static_cast<int>(owner.workHeight()))
newtop = y - 3 * owner.workHeight() / 4; // the scroll region must be so big!!
if (y + desc - text->first_y >= vheight)
newtop = y - 3 * vheight / 4; // the scroll region must be so big!!
else if (y - asc < text->first_y
&& text->first_y > 0) {
newtop = y - owner.workHeight() / 4;
newtop = y - vheight / 4;
}
newtop = max(newtop, 0); // can newtop ever be < 0? (Lgb)
@ -288,116 +91,18 @@ bool LScreen::fitManualCursor(LyXText * text, BufferView * bv,
}
void LScreen::showManualCursor(LyXText const * text, int x, int y,
int asc, int desc, Cursor_Shape shape)
void LyXScreen::cursorToggle(BufferView * bv) const
{
// Update the cursor color.
setCursorColor();
int const y1 = max(y - text->first_y - asc, 0);
int const y_tmp = min(y - text->first_y + desc,
static_cast<int>(owner.workHeight()));
// Secure against very strange situations
int const y2 = max(y_tmp, y1);
if (cursor_pixmap) {
XFreePixmap(fl_get_display(), cursor_pixmap);
cursor_pixmap = 0;
}
if (y2 > 0 && y1 < int(owner.workHeight())) {
cursor_pixmap_h = y2 - y1 + 1;
cursor_pixmap_y = y1;
switch (shape) {
case BAR_SHAPE:
cursor_pixmap_w = 1;
cursor_pixmap_x = x;
break;
case L_SHAPE:
cursor_pixmap_w = cursor_pixmap_h/3;
cursor_pixmap_x = x;
break;
case REVERSED_L_SHAPE:
cursor_pixmap_w = cursor_pixmap_h/3;
cursor_pixmap_x = x - cursor_pixmap_w + 1;
break;
}
cursor_pixmap =
XCreatePixmap (fl_get_display(),
fl_root,
cursor_pixmap_w,
cursor_pixmap_h,
fl_get_visual_depth());
XCopyArea (fl_get_display(),
owner.getWin(),
cursor_pixmap,
gc_copy,
owner.xpos() + cursor_pixmap_x,
owner.ypos() + cursor_pixmap_y,
cursor_pixmap_w,
cursor_pixmap_h,
0, 0);
XDrawLine(fl_get_display(),
owner.getWin(),
gc_copy,
x + owner.xpos(),
y1 + owner.ypos(),
x + owner.xpos(),
y2 + owner.ypos());
switch (shape) {
case BAR_SHAPE:
break;
case L_SHAPE:
case REVERSED_L_SHAPE:
int const rectangle_h = (cursor_pixmap_h + 10) / 20;
XFillRectangle(fl_get_display(),
owner.getWin(),
gc_copy,
cursor_pixmap_x + owner.xpos(),
y2 - rectangle_h + 1 + owner.ypos(),
cursor_pixmap_w - 1, rectangle_h);
break;
}
}
cursor_visible = true;
}
void LScreen::hideCursor()
{
if (!cursor_visible) return;
if (cursor_pixmap) {
XCopyArea (fl_get_display(),
cursor_pixmap,
owner.getWin(),
gc_copy,
0, 0,
cursor_pixmap_w, cursor_pixmap_h,
cursor_pixmap_x + owner.xpos(),
cursor_pixmap_y + owner.ypos());
}
cursor_visible = false;
}
void LScreen::cursorToggle(BufferView * bv) const
{
if (cursor_visible)
if (cursor_visible_)
bv->hideCursor();
else
bv->showCursor();
}
/* returns a new top so that the cursor is visible */
unsigned int LScreen::topCursorVisible(LyXCursor const & cursor, int top_y)
unsigned int LyXScreen::topCursorVisible(LyXCursor const & cursor, int top_y)
{
int const vheight = owner.workHeight();
int const vheight = workarea().workHeight();
int newtop = top_y;
Row * row = cursor.row();
@ -419,7 +124,7 @@ unsigned int LScreen::topCursorVisible(LyXCursor const & cursor, int top_y)
- vheight / 2; /* the scroll region must be so big!! */
}
} else if (static_cast<int>(cursor.y() - row->baseline()) <
} else if (static_cast<int>((cursor.y()) - row->baseline()) <
top_y && top_y > 0) {
if (row->height() < vheight
&& row->height() > vheight / 4) {
@ -437,9 +142,7 @@ unsigned int LScreen::topCursorVisible(LyXCursor const & cursor, int top_y)
}
/* scrolls the screen so that the cursor is visible, if necessary.
* returns true if a change was made, otherwise false */
bool LScreen::fitCursor(LyXText * text, BufferView * bv)
bool LyXScreen::fitCursor(LyXText * text, BufferView * bv)
{
// Is a change necessary?
int const newtop = topCursorVisible(text->cursor, text->first_y);
@ -450,27 +153,32 @@ bool LScreen::fitCursor(LyXText * text, BufferView * bv)
}
void LScreen::update(LyXText * text, BufferView * bv,
int y_offset, int x_offset)
void LyXScreen::update(LyXText * text, BufferView * bv,
int yo, int xo)
{
int const vwidth = workarea().workWidth();
int const vheight = workarea().workHeight();
workarea().getPainter().start();
switch (text->status()) {
case LyXText::NEED_MORE_REFRESH:
{
int const y = max(int(text->refresh_y - text->first_y), 0);
drawFromTo(text, bv, y, owner.workHeight(), y_offset, x_offset);
drawFromTo(text, bv, y, vheight, yo, xo);
text->refresh_y = 0;
// otherwise this is called ONLY from BufferView_pimpl(update)
// or we should see to set this flag accordingly
if (text != bv->text)
text->status(bv, LyXText::UNCHANGED);
expose(0, y, owner.workWidth(), owner.workHeight() - y);
expose(0, y, vwidth, vheight - y);
}
break;
case LyXText::NEED_VERY_LITTLE_REFRESH:
{
// ok I will update the current cursor row
drawOneRow(text, bv, text->refresh_row, text->refresh_y,
y_offset, x_offset);
yo, xo);
// this because if we had a major update the refresh_row could
// have been set to 0!
if (text->refresh_row) {
@ -478,8 +186,8 @@ void LScreen::update(LyXText * text, BufferView * bv,
// or we should see to set this flag accordingly
if (text != bv->text)
text->status(bv, LyXText::UNCHANGED);
expose(0, text->refresh_y - text->first_y + y_offset,
owner.workWidth(), text->refresh_row->height());
expose(0, text->refresh_y - text->first_y + yo,
vwidth, text->refresh_row->height());
}
}
break;
@ -488,12 +196,14 @@ void LScreen::update(LyXText * text, BufferView * bv,
// Nothing needs done
break;
}
workarea().getPainter().end();
}
void LScreen::toggleSelection(LyXText * text, BufferView * bv,
void LyXScreen::toggleSelection(LyXText * text, BufferView * bv,
bool kill_selection,
int y_offset, int x_offset)
int yo, int xo)
{
// only if there is a selection
if (!text->selection.set()) return;
@ -503,25 +213,30 @@ void LScreen::toggleSelection(LyXText * text, BufferView * bv,
- text->selection.end.row()->baseline()
+ text->selection.end.row()->height()),
text->first_y),
static_cast<int>(text->first_y + owner.workHeight()));
static_cast<int>(text->first_y + workarea().workHeight()));
int const top = min(
max(static_cast<int>(text->selection.start.y() -
text->selection.start.row()->baseline()),
text->first_y),
static_cast<int>(text->first_y + owner.workHeight()));
static_cast<int>(text->first_y + workarea().workHeight()));
if (kill_selection)
text->selection.set(false);
workarea().getPainter().start();
drawFromTo(text, bv, top - text->first_y, bottom - text->first_y,
y_offset, x_offset);
yo, xo);
expose(0, top - text->first_y,
owner.workWidth(),
bottom - text->first_y - (top - text->first_y));
workarea().workWidth(),
bottom - text->first_y - (top - text->first_y));
workarea().getPainter().end();
}
void LScreen::toggleToggle(LyXText * text, BufferView * bv,
int y_offset, int x_offset)
void LyXScreen::toggleToggle(LyXText * text, BufferView * bv,
int yo, int xo)
{
if (text->toggle_cursor.par() == text->toggle_end_cursor.par()
&& text->toggle_cursor.pos() == text->toggle_end_cursor.pos())
@ -533,15 +248,105 @@ void LScreen::toggleToggle(LyXText * text, BufferView * bv,
- text->toggle_end_cursor.row()->baseline()
+ text->toggle_end_cursor.row()->height();
int const offset = y_offset < 0 ? y_offset : 0;
int const offset = yo < 0 ? yo : 0;
int const bottom = min(max(bottom_tmp, text->first_y),
static_cast<int>(text->first_y + owner.workHeight()))-offset;
static_cast<int>(text->first_y + workarea().workHeight())) - offset;
int const top = min(max(top_tmp, text->first_y),
static_cast<int>(text->first_y + owner.workHeight()))-offset;
static_cast<int>(text->first_y + workarea().workHeight())) - offset;
workarea().getPainter().start();
drawFromTo(text, bv, top - text->first_y,
bottom - text->first_y, y_offset,
x_offset);
expose(0, top - text->first_y, owner.workWidth(),
bottom - text->first_y, yo,
xo);
expose(0, top - text->first_y, workarea().workWidth(),
bottom - text->first_y - (top - text->first_y));
workarea().getPainter().end();
}
void LyXScreen::redraw(LyXText * text, BufferView * bv)
{
workarea().getPainter().start();
if (!text) {
greyOut();
expose(0, 0, workarea().workWidth(), workarea().workHeight());
workarea().getPainter().end();
return;
}
drawFromTo(text, bv, 0, workarea().workHeight(), 0, 0, text == bv->text);
expose(0, 0, workarea().workWidth(), workarea().workHeight());
workarea().getPainter().end();
if (cursor_visible_) {
cursor_visible_ = false;
bv->showCursor();
}
}
void LyXScreen::greyOut()
{
workarea().getPainter().fillRectangle(0, 0,
workarea().workWidth(),
workarea().workHeight(),
LColor::bottomarea);
}
void LyXScreen::drawFromTo(LyXText * text, BufferView * bv,
int y1, int y2, int yo, int xo,
bool internal)
{
int y_text = text->first_y + y1;
// get the first needed row
Row * row = text->getRowNearY(y_text);
// y_text is now the real beginning of the row
int y = y_text - text->first_y;
// y1 is now the real beginning of row on the screen
while (row != 0 && y < y2) {
LyXText::text_status st = text->status();
text->getVisibleRow(bv, y + yo,
xo, row, y + text->first_y);
internal = internal && (st != LyXText::CHANGED_IN_DRAW);
while (internal && text->status() == LyXText::CHANGED_IN_DRAW) {
text->fullRebreak(bv);
st = LyXText::NEED_MORE_REFRESH;
text->setCursor(bv, text->cursor.par(), text->cursor.pos());
text->status(bv, st);
text->getVisibleRow(bv, y + yo,
xo, row, y + text->first_y);
}
y += row->height();
row = row->next();
}
force_clear_ = false;
// maybe we have to clear the screen at the bottom
if ((y < y2) && text->bv_owner) {
workarea().getPainter().fillRectangle(0, y,
workarea().workWidth(), y2 - y,
LColor::bottomarea);
}
}
void LyXScreen::drawOneRow(LyXText * text, BufferView * bv, Row * row,
int y_text, int yo, int xo)
{
int const y = y_text - text->first_y + yo;
if (((y + row->height()) > 0) &&
((y - row->height()) <= static_cast<int>(workarea().workHeight()))) {
text->getVisibleRow(bv, y, xo, row, y + text->first_y);
}
force_clear_ = false;
}

View File

@ -8,25 +8,21 @@
* \author John Levon <moz@compsoc.man.ac.uk>
*/
#ifndef LYXSCREEN_H
#define LYXSCREEN_H
#ifndef SCREEN_H
#define SCREEN_H
#ifdef __GNUG__
#pragma interface
#endif
#include <X11/Xlib.h>
class LyXText;
class LyXCursor;
class WorkArea;
class Buffer;
class BufferView;
struct Row;
/**
* LScreen - document rendering management
* LyXScreen - document rendering management
*
* This class is used to manage the on-screen rendering inside the
* work area; it is responsible for deciding which LyXText rows
@ -37,35 +33,65 @@ struct Row;
*
* The blinking cursor is also handled here.
*/
class LScreen {
class LyXScreen {
public:
///
/// types of cursor in work area
enum Cursor_Shape {
///
/// normal I-beam
BAR_SHAPE,
///
/// L-shape for locked insets of a different language
L_SHAPE,
///
/// reverse L-shape for RTL text
REVERSED_L_SHAPE
};
///
LScreen(WorkArea &);
LyXScreen();
///
~LScreen();
virtual ~LyXScreen();
void reset();
/**
* draw the screen from a given position
* @param y the text position to draw from
*
* Uses as much of the already printed pixmap as possible
*/
virtual void draw(LyXText *, BufferView *, unsigned int y) = 0;
/// Sets the cursor color to LColor::cursor.
void setCursorColor();
/**
* showManualCursor - display the cursor on the work area
* @param text the lyx text containing the cursor
* @param x the x position of the cursor
* @param y the y position of the row's baseline
* @param asc ascent of the row
* @param desc descent of the row
* @param shape the current shape
*/
virtual void showManualCursor(LyXText const *, int x, int y,
int asc, int desc,
Cursor_Shape shape) = 0;
/** Draws the screen form textposition y. Uses as much of
the already printed pixmap as possible */
void draw(LyXText *, BufferView *, unsigned int y);
/// unpaint the cursor painted by showManualCursor()
virtual void hideCursor() = 0;
/// Redraws the screen, without using existing pixmap
void redraw(LyXText *, BufferView *);
/**
* fit the cursor onto the visible work area, scrolling if necessary
* @param bv the buffer view
* @param vheight the height of the visible region
* @param base_y the top of the lyxtext to look at
* @param x the new x position
* @param y the new y position
* @param a ascent of the cursor's row
* @param d descent of the cursor's row
* @return true if the work area needs scrolling as a result
*/
bool fitManualCursor(BufferView * bv, LyXText * text,
int x, int y, int a, int d);
/// redraw the screen, without using existing pixmap
virtual void redraw(LyXText *, BufferView *);
/// draw the cursor if it's not already shown
virtual void showCursor(LyXText const *, BufferView const *);
/**
* topCursorVisible - get a new "top" to make the cursor visible
@ -76,69 +102,70 @@ public:
* the top of the containing region such that the cursor contained
* within the LyXText is "nicely" visible.
*/
unsigned int topCursorVisible(LyXCursor const & c, int top_y);
virtual unsigned int topCursorVisible(LyXCursor const & c, int top_y);
/// Redraws the screen such that the cursor is visible
bool fitCursor(LyXText *, BufferView *);
///
void showCursor(LyXText const *, BufferView const *);
///
void hideCursor();
///
void cursorToggle(BufferView *) const;
///
void showManualCursor(LyXText const *, int x, int y,
int asc, int desc,
Cursor_Shape shape);
/// returns 1 if first has changed, otherwise 0
bool fitManualCursor(LyXText *, BufferView *, int, int, int, int);
///
void toggleSelection(LyXText *, BufferView *, bool = true,
/**
* fitCursor - fit the cursor onto the work area
* @param text the text containing the cursor
* @param bv the bufferview
* @return true if a change was necessary
*
* Scrolls the screen so that the cursor is visible,
*/
virtual bool fitCursor(LyXText *, BufferView *);
/// show the cursor if it's not, and vice versa
virtual void cursorToggle(BufferView *) const;
/**
* update - update part of the screen rendering
* @param text the containing text region
* @param bv the bufferview
* @param xo the x offset into the text
* @param yo the x offset into the text
*
* Updates part of the screen. If text->status is
* LyXText::NEED_MORE_REFRESH, we update from the
* point of change and to the end of the screen.
* If text->status is LyXText::NEED_VERY_LITTLE_REFRESH,
* we only update the current row.
*/
virtual void update(LyXText * text, BufferView * bv, int yo = 0, int xo = 0);
/// FIXME
virtual void toggleSelection(LyXText *, BufferView *, bool = true,
int y_offset = 0, int x_offset = 0);
///
void toggleToggle(LyXText *, BufferView *,
/// FIXME - at least change the name !!
virtual void toggleToggle(LyXText *, BufferView *,
int y_offset = 0, int x_offset = 0);
/** Updates part of the screen. If text->status is
LyXText::NEED_MORE_REFRESH, we update from the
point of change and to the end of the screen.
If text->status is LyXText::NEED_VERY_LITTLE_REFRESH,
we only update the current row. */
void update(LyXText *, BufferView *, int y_offset=0, int x_offset=0);
///
bool forceClear() const { return force_clear; }
/// FIXME
virtual bool forceClear() const { return force_clear_; }
///
bool cursor_visible;
private:
/// Copies specified area of pixmap to screen
void expose(int x, int y, int exp_width, int exp_height);
protected:
/// copies specified area of pixmap to screen
virtual void expose(int x, int y, int exp_width, int exp_height) = 0;
/// get the work area
virtual WorkArea & workarea() const = 0;
/// y1 and y2 are coordinates of the screen
void drawFromTo(LyXText *, BufferView *, int y1, int y2,
int y_offset = 0, int x_offset = 0, bool internal=false);
virtual void drawFromTo(LyXText *, BufferView *, int y1, int y2,
int y_offset = 0, int x_offset = 0, bool internal = false);
/// y is a coordinate of the text
void drawOneRow(LyXText *, BufferView *, Row * row,
virtual void drawOneRow(LyXText *, BufferView *, Row * row,
int y_text, int y_offset = 0, int x_offset = 0);
///
WorkArea & owner;
/// grey out (no buffer)
void greyOut();
///
Pixmap cursor_pixmap;
///
int cursor_pixmap_x;
///
int cursor_pixmap_y;
///
int cursor_pixmap_w;
///
int cursor_pixmap_h;
///
GC gc_copy;
///
bool force_clear;
/// FIXME ?
bool force_clear_;
/// is the blinking cursor currently drawn
bool cursor_visible_;
};
#endif
#endif // SCREEN_H

View File

@ -1,10 +1,37 @@
2002-06-13 Juergen Spitzmueller <j.spitzmueller@gmx.de>
2002-06-16 Lars Gullik Bjønnes <larsbj@birdstep.com>
* FormRef.C: Add Tooltips
* changes to let the function setup happen in frontends
* guiapi.C: new file
2002-06-18 Angus Leeming <leeming@lyx.org>
2002-06-16 <alstrup@diku.dk>
* forms/.cvsignore: ignore any generated files/dirs.
* xscreen.C (draw): After drawing, we wait for X with XSync..
* XWorkArea.[Ch]: Xforms implementation of GUII WorkArea.
* XPainter.[Ch]: Use XWorkArea instead of WorkArea.
* xscreen.[Ch]: Use XWorkArea instead of WorkArea.
* WorkAreaFactory.C: New file for GUII WorkArea.
* LyXScreenFactory.C: WorkArea GUIIized.
2002-06-15 Lyx Development team <larsbj@birdstep.com>
* LyXKeySymFactory.C: Added XForms implementation.
* XLyXKeySym.[Ch]: Added XForms implementation of the LyXKeySym
stuff.
* XWorkArea.[Ch]: Use LyXKeySym in signal interface for keypress.
2002-06-14 Lyx Development team <lyx@electronia>
* LyXScreenFactory.C: Implementation for XForms.
* xscreen.[Ch]: Added implementation of LyXScreen for XForms,
called XScreen (surprise!).
2002-06-14 Angus Leeming <leeming@lyx.org>
@ -148,10 +175,10 @@
2002-06-11 Edwin Leuven <leuven@fee.uva.nl>
* FormParagraph.[Ch]: moved to mvc
* form_paragraph.[Ch]: idem
* forms/form_paragraph.fd: idem
* Dialogs.C: idem
* FormParagraph.[Ch]: moved to mvc
* form_paragraph.[Ch]: idem
* forms/form_paragraph.fd: idem
* Dialogs.C: idem
2002-06-06 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>

View File

@ -14,76 +14,11 @@
#endif
#include "Dialogs.h"
#include "GUI.h"
#include "xformsBC.h"
#include "combox.h" // needed for clean destruction of boost::scoped_ptr
#include "forms/form_aboutlyx.h"
#include "forms/form_bibitem.h"
#include "forms/form_bibtex.h"
#include "forms/form_browser.h"
#include "forms/form_character.h"
#include "forms/form_citation.h"
#include "forms/form_error.h"
#include "forms/form_ert.h"
#include "forms/form_external.h"
#include "forms/form_float.h"
#include "forms/form_forks.h"
#include "forms/form_graphics.h"
#include "forms/form_include.h"
#include "forms/form_index.h"
#include "forms/form_minipage.h"
#include "forms/form_paragraph.h"
#include "forms/form_preamble.h"
#include "forms/form_print.h"
#include "forms/form_ref.h"
#include "forms/form_search.h"
#include "forms/form_sendto.h"
#include "forms/form_spellchecker.h"
#include "forms/form_tabular_create.h"
#include "forms/form_texinfo.h"
#include "forms/form_thesaurus.h"
#include "forms/form_toc.h"
#include "forms/form_url.h"
#include "FormAboutlyx.h"
#include "FormBibitem.h"
#include "FormBibtex.h"
#include "FormCharacter.h"
#include "FormCitation.h"
#include "FormError.h"
#include "FormERT.h"
#include "FormExternal.h"
#include "FormFloat.h"
#include "FormForks.h"
#include "FormGraphics.h"
#include "FormInclude.h"
#include "FormIndex.h"
#include "FormLog.h"
#include "FormMinipage.h"
#include "FormParagraph.h"
#include "FormPreamble.h"
#include "FormPrint.h"
#include "FormRef.h"
#include "FormSearch.h"
#include "FormSendto.h"
#include "FormShowFile.h"
#include "FormSpellchecker.h"
#include "FormTabularCreate.h"
#include "FormTexinfo.h"
#include "FormThesaurus.h"
#include "FormToc.h"
#include "FormUrl.h"
#include "FormVCLog.h"
#include "FormDocument.h"
#include "FormMathsPanel.h"
#include "FormPreferences.h"
#include "FormTabular.h"
#include "Tooltips.h"
LyXView * dialogs_lyxview;
/// Are the tooltips on or off?
bool Dialogs::tooltipsEnabled()
{
@ -93,72 +28,9 @@ bool Dialogs::tooltipsEnabled()
Dialogs::Dialogs(LyXView * lv)
{
add(new GUI<ControlAboutlyx, FormAboutlyx,
OkCancelPolicy, xformsBC>(*lv, *this));
add(new GUI<ControlBibitem, FormBibitem,
OkCancelReadOnlyPolicy, xformsBC>(*lv, *this));
add(new GUI<ControlBibtex, FormBibtex,
OkCancelReadOnlyPolicy, xformsBC>(*lv, *this));
add(new GUI<ControlCharacter, FormCharacter,
OkApplyCancelReadOnlyPolicy, xformsBC>(*lv, *this));
add(new GUI<ControlCitation, FormCitation,
NoRepeatedApplyReadOnlyPolicy, xformsBC>(*lv, *this));
add(new GUI<ControlError, FormError,
OkCancelPolicy, xformsBC>(*lv, *this));
add(new GUI<ControlERT, FormERT,
NoRepeatedApplyReadOnlyPolicy, xformsBC>(*lv, *this));
add(new GUI<ControlExternal, FormExternal,
OkApplyCancelReadOnlyPolicy, xformsBC>(*lv, *this));
add(new GUI<ControlForks, FormForks,
OkApplyCancelPolicy, xformsBC>(*lv, *this));
add(new GUI<ControlGraphics, FormGraphics,
NoRepeatedApplyReadOnlyPolicy, xformsBC>(*lv, *this));
add(new GUI<ControlInclude, FormInclude,
OkCancelReadOnlyPolicy, xformsBC>(*lv, *this));
add(new GUI<ControlIndex, FormIndex,
NoRepeatedApplyReadOnlyPolicy, xformsBC>(*lv, *this));
add(new GUI<ControlLog, FormLog,
OkCancelPolicy, xformsBC>(*lv, *this));
add(new GUI<ControlMinipage, FormMinipage,
NoRepeatedApplyReadOnlyPolicy, xformsBC>(*lv, *this));
add(new GUI<ControlFloat, FormFloat,
NoRepeatedApplyReadOnlyPolicy, xformsBC>(*lv, *this));
add(new GUI<ControlParagraph, FormParagraph,
OkApplyCancelReadOnlyPolicy, xformsBC>(*lv, *this));
add(new GUI<ControlPreamble, FormPreamble,
NoRepeatedApplyReadOnlyPolicy, xformsBC>(*lv, *this));
add(new GUI<ControlPrint, FormPrint,
OkApplyCancelPolicy, xformsBC>(*lv, *this));
add(new GUI<ControlRef, FormRef,
NoRepeatedApplyReadOnlyPolicy, xformsBC>(*lv, *this));
add(new GUI<ControlSearch, FormSearch,
NoRepeatedApplyReadOnlyPolicy, xformsBC>(*lv, *this));
add(new GUI<ControlSendto, FormSendto,
OkApplyCancelPolicy, xformsBC>(*lv, *this));
add(new GUI<ControlShowFile, FormShowFile,
OkCancelPolicy, xformsBC>(*lv, *this));
add(new GUI<ControlSpellchecker, FormSpellchecker,
NoRepeatedApplyReadOnlyPolicy, xformsBC>(*lv, *this));
add(new GUI<ControlTabularCreate, FormTabularCreate,
OkApplyCancelReadOnlyPolicy, xformsBC>(*lv, *this));
#ifdef HAVE_LIBAIKSAURUS
add(new GUI<ControlThesaurus, FormThesaurus,
OkApplyCancelReadOnlyPolicy, xformsBC>(*lv, *this));
#if 1
dialogs_lyxview = lv;
#endif
add(new GUI<ControlTexinfo, FormTexinfo,
OkCancelPolicy, xformsBC>(*lv, *this));
add(new GUI<ControlToc, FormToc,
OkCancelPolicy, xformsBC>(*lv, *this));
add(new GUI<ControlUrl, FormUrl,
NoRepeatedApplyReadOnlyPolicy, xformsBC>(*lv, *this));
add(new GUI<ControlVCLog, FormVCLog,
OkCancelPolicy, xformsBC>(*lv, *this));
add(new FormDocument(lv, this));
add(new FormMathsPanel(lv, this));
add(new FormPreferences(lv, this));
add(new FormTabular(lv, this));
// reduce the number of connections needed in
// dialogs by a simple connection here.
hideAll.connect(hideBufferDependent);

View File

@ -50,4 +50,5 @@ private:
boost::scoped_ptr<FD_aboutlyx_license> license_;
};
#endif // FORMABOUTLYX_H

View File

@ -57,6 +57,8 @@ public:
Tooltips & tooltips();
friend void gui_ShowDocument(LyXView &, Dialogs &);
protected: // methods
/// Pointer to the actual instantiation of the ButtonController.

View File

@ -62,10 +62,12 @@ FormDocument::FormDocument(LyXView * lv, Dialogs * d)
ActCell(0), Confirmed(0),
current_bullet_panel(0), current_bullet_depth(0), fbullet(0)
{
#if 0
// let the dialog be shown
// This is a permanent connection so we won't bother
// storing a copy because we won't be disconnecting.
d->showDocument = boost::bind(&FormDocument::show, this);
#endif
}

View File

@ -152,7 +152,9 @@ FormMathsPanel::FormMathsPanel(LyXView * lv, Dialogs * d)
ams_ops_.reset(new FormMathsBitmap(lv, d, *this, _("AMS Operators"), latex));
//showUnderMouse(false);
#if 0
d->showMathPanel = boost::bind(&FormMathsPanel::show, this);
#endif
}

View File

@ -37,6 +37,7 @@ struct FD_maths_panel;
*/
class FormMathsPanel : public FormBaseBD {
public:
friend void gui_ShowMathPanel(LyXView &, Dialogs &);
///
FormMathsPanel(LyXView *, Dialogs *);
///
@ -96,7 +97,7 @@ class FormMathsSub : public FormBaseBD {
public:
///
FormMathsSub(LyXView *, Dialogs *, FormMathsPanel const &,
string const &, bool allowResize=true);
string const &, bool allowResize = true);
protected:
/// Pointer to the actual instantiation of the ButtonController.

View File

@ -70,8 +70,8 @@ Converters local_converters;
} // namespace anon
FormPreferences::FormPreferences(LyXView * lv, Dialogs * d)
: FormBaseBI(lv, d, _("Preferences"), false),
FormPreferences::FormPreferences(LyXView & lv, Dialogs & d)
: FormBaseBI(&lv, &d, _("Preferences"), false),
colors_(*this), converters_(*this), inputs_misc_(*this),
formats_(*this), interface_(*this), language_(*this),
lnf_misc_(*this), outputs_misc_(*this), paths_(*this),
@ -80,8 +80,12 @@ FormPreferences::FormPreferences(LyXView * lv, Dialogs * d)
// let the dialog be shown
// This is a permanent connection so we won't bother
// storing a copy because we won't be disconnecting.
#if 0
d->showPreferences = boost::bind(&FormPreferences::show, this);
#endif
#if 0
d->showSpellcheckerPreferences = boost::bind(&FormPreferences::showSpellPref, this);
#endif
}

View File

@ -50,8 +50,10 @@ struct FD_preferences_spelloptions;
*/
class FormPreferences : public FormBaseBI {
public:
friend void gui_ShowPreferences(LyXView &, Dialogs &);
friend void gui_ShowSpellcheckerPreferences(LyXView &, Dialogs &);
///
FormPreferences(LyXView *, Dialogs *);
FormPreferences(LyXView &, Dialogs &);
private:
/// Pointer to the actual instantiation of the ButtonController.

View File

@ -17,7 +17,6 @@
#include "ControlRef.h"
#include "FormRef.h"
#include "forms/form_ref.h"
#include "Tooltips.h"
#include "xforms_helpers.h"
#include "insets/insetref.h"
#include "helper_funcs.h" // getStringFromVector
@ -63,25 +62,6 @@ void FormRef::build()
bc().addReadOnly(dialog_->button_update);
bc().addReadOnly(dialog_->input_name);
bc().addReadOnly(dialog_->input_ref);
//set up the tooltip mechanism
string str = _("Show the labels of another opened document. Useful if you are working with multipart documents, where you might want to refer to another doc.");
tooltips().init(dialog_->choice_buffer, str);
str = _("Choose a label to refer to.");
tooltips().init(dialog_->browser_refs, str);
str = _("Type in a label name. We recommend that you use the browser instead.");
tooltips().init(dialog_->input_ref, str);
str = _("Choose the reference style.");
tooltips().init(dialog_->choice_type, str);
str = _("Sort labels in alphabetical order.");
tooltips().init(dialog_->check_sort, str);
str = _("Refresh the list of labels.");
tooltips().init(dialog_->button_update, str);
}

View File

@ -19,6 +19,7 @@
#include "gettext.h"
#include FORMS_H_LOCATION
FormShowFile::FormShowFile(ControlShowFile & c)
: FormCB<ControlShowFile, FormBrowser>(c, string())
{}

View File

@ -39,15 +39,17 @@ using std::bind2nd;
using std::remove_if;
FormTabular::FormTabular(LyXView * lv, Dialogs * d)
: FormInset(lv, d, _("Tabular Layout")),
FormTabular::FormTabular(LyXView & lv, Dialogs & d)
: FormInset(&lv, &d, _("Tabular Layout")),
inset_(0), actCell_(-1), closing_(false)
{
#if 0
// let the dialog be shown
// This is a permanent connection so we won't bother
// storing a copy because we won't be disconnecting.
d->showTabular = boost::bind(&FormTabular::showInset, this, _1);
d->updateTabular = boost::bind(&FormTabular::updateInset, this, _1);
#endif
}

View File

@ -31,8 +31,11 @@ struct FD_tabular_longtable;
*/
class FormTabular : public FormInset {
public:
friend void gui_ShowTabular(InsetTabular *, LyXView &, Dialogs &);
friend void gui_UpdateTabular(InsetTabular *, LyXView &, Dialogs &);
/// #FormTabular x(LyXFunc ..., Dialogs ...);#
FormTabular(LyXView *, Dialogs *);
FormTabular(LyXView &, Dialogs &);
private:
/// Pointer to the actual instantiation of the ButtonController.

View File

@ -0,0 +1,22 @@
/**
* \file LyXKeySymFactory.C
* Copyright 2002 the LyX Team
* Read the file COPYING
*
* \author Asger & Juergen
*/
#include <config.h>
#include "frontends/LyXKeySymFactory.h"
#include "XLyXKeySym.h"
namespace LyXKeySymFactory {
LyXKeySym * create()
{
return new XLyXKeySym();
}
}

View File

@ -0,0 +1,23 @@
/**
* \file LyXScreenFactory.C
* Copyright 2002 the LyX Team
* Read the file COPYING
*
* \author John Levon <moz@compsoc.man.ac.uk>
*/
#include <config.h>
#include "frontends/LyXScreenFactory.h"
#include "XWorkArea.h"
#include "xscreen.h"
namespace LyXScreenFactory {
LyXScreen * create(WorkArea & owner)
{
return new XScreen(static_cast<XWorkArea &>(owner));
}
}

View File

@ -40,6 +40,8 @@ libxforms_la_SOURCES = \
xforms_resize.h \
$(XFORMSGIMAGE) xformsBC.C \
xformsBC.h \
xscreen.C \
xscreen.h \
Alert_pimpl.C \
Color.C \
Color.h \
@ -141,6 +143,9 @@ libxforms_la_SOURCES = \
FormUrl.h \
FormVCLog.C \
FormVCLog.h \
guiapi.C \
LyXKeySymFactory.C \
LyXScreenFactory.C \
MathsSymbols.C \
MathsSymbols.h \
Menubar_pimpl.C \
@ -153,8 +158,11 @@ libxforms_la_SOURCES = \
Toolbar_pimpl.h \
Tooltips.C \
Tooltips.h \
WorkAreaFactory.C \
XFormsView.C \
XFormsView.h \
XLyXKeySym.C \
XLyXKeySym.h \
XPainter.C \
XPainter.h \
XWorkArea.h \

View File

@ -0,0 +1,22 @@
/**
* \file WorkAreaFactory.C
* Copyright 2002 the LyX Team
* Read the file COPYING
*
* \author John Levon <moz@compsoc.man.ac.uk>
*/
#include <config.h>
#include "frontends/WorkAreaFactory.h"
#include "XWorkArea.h"
namespace WorkAreaFactory {
WorkArea * create(int x, int y, int w, int h)
{
return new XWorkArea(x, y, w, h);
}
}

View File

@ -0,0 +1,106 @@
/**
* \file XLyXKeySym.C
* Copyright 2002 the LyX Team
* Read the file COPYING
*
* \author Asger and Juergen
*/
#include <config.h>
#ifdef __GNUG__
#pragma implementation
#endif
#include "XLyXKeySym.h"
#include "debug.h"
#include <X11/Xlib.h>
#include <X11/keysym.h>
using std::endl;
XLyXKeySym::XLyXKeySym()
: LyXKeySym(), keysym(NoSymbol)
{
}
void XLyXKeySym::initFromKeySym(KeySym ks)
{
keysym = ks;
}
void XLyXKeySym::init(string const & symbolname)
{
keysym = XStringToKeysym(symbolname.c_str());
if (keysym == NoSymbol) {
lyxerr[Debug::KBMAP]
<< "XLyXKeySym.C: No such keysym: "
<< symbolname << endl;
}
}
bool XLyXKeySym::isOK() const
{
return keysym != NoSymbol;
}
bool XLyXKeySym::isModifier() const
{
// Can we be sure that this will work for all X Window
// implementations? (Lgb)
// Perhaps all of them should be explictly mentioned?
return ((keysym >= XK_Shift_L && keysym <= XK_Hyper_R)
|| keysym == XK_Mode_switch || keysym == 0x0);
}
string
XLyXKeySym::getSymbolName() const
{
char * name = XKeysymToString(keysym);
return name ? name : string();
}
char
XLyXKeySym::getISOEncoded() const
{
if (keysym == NoSymbol) {
return 0;
}
unsigned int c = keysym;
switch (c & 0x0000FF00) {
// latin 1 byte 3 = 0
case 0x00000000: break;
// latin 2 byte 3 = 1
case 0x00000100:
// latin 3 byte 3 = 2
case 0x00000200:
// latin 4 byte 3 = 3
case 0x00000300:
// cyrillic KOI8 & Co
case 0x00000600:
// greek
case 0x00000700:
// latin 8 byte 3 = 18 (0x12)
case 0x00001200:
// latin 9 byte 3 = 19 (0x13)
case 0x00001300:
c &= 0x000000FF;
break;
default:
c = 0;
}
return c;
}
bool XLyXKeySym::operator==(LyXKeySym const & k) const
{
// This is dangerous! Ideally, we should use dynamic_cast instead,
// but on the other hand, we are sure that we will always get
// the right type, because we decide at compile time which
// frontend we use. (Asger)
return keysym == static_cast<XLyXKeySym const &>(k).keysym;
}

View File

@ -0,0 +1,60 @@
// -*- C++ -*-
/**
* \file XLyXKeySym.h
* Copyright 2002 the LyX Team
* Read the file COPYING
*
* \author Asger and Juergen
*/
#ifndef XLYXKEYSYM_H
#define XLYXKEYSYM_H
#ifdef __GNUG__
#pragma interface
#endif
#include "LString.h"
#include <X11/Xlib.h>
#include "frontends/LyXKeySym.h"
/**
* This is a base class for representing a keypress.
* Each frontend has to implement this to provide
* the functionality that LyX needs in regards to
* key presses.
*/
class XLyXKeySym : public LyXKeySym {
public:
XLyXKeySym();
/// X11 specific initialization with an X11 KeySym
void initFromKeySym(KeySym);
virtual void init(string const & symbolname);
virtual ~XLyXKeySym() {}
/// Is this a valid key?
virtual bool isOK() const;
/// Is this a modifier key only?
virtual bool isModifier() const;
virtual string getSymbolName() const;
/**
* Return the value of the keysym into the local ISO encoding.
* This converts the LyXKeySym to a 8-bit encoded character.
* This relies on user to use the right encoding.
*/
virtual char getISOEncoded() const;
virtual bool operator==(LyXKeySym const & k) const;
private:
unsigned int keysym;
};
#endif

View File

@ -36,7 +36,7 @@ using std::endl;
using std::max;
XPainter::XPainter(WorkArea & xwa)
XPainter::XPainter(XWorkArea & xwa)
: Painter(), owner_(xwa)
{
}

View File

@ -24,14 +24,14 @@
class LyXFont;
class WorkArea;
class XWorkArea;
/**
* XPainter - a painter implementation for Xlib
*/
class XPainter : public Painter {
public:
XPainter(WorkArea &);
XPainter(XWorkArea &);
/// return the width of the work area in pixels
virtual int paperWidth() const;
@ -120,7 +120,7 @@ public:
private:
/// our owner who we paint upon
WorkArea & owner_;
XWorkArea & owner_;
};
#endif // XPAINTER_H

View File

@ -18,6 +18,7 @@
#include "LyXView.h"
#include "lyxrc.h" // lyxrc.show_banner
#include "version.h" // lyx_version
#include "XLyXKeySym.h"
#if FL_VERSION < 1 && (FL_REVISION < 89 || (FL_REVISION == 89 && FL_FIXLEVEL < 5))
#include "lyxlookup.h"
@ -123,33 +124,33 @@ key_modifier::state x_key_state(unsigned int state)
extern "C" {
// Just a bunch of C wrappers around static members of WorkArea
// Just a bunch of C wrappers around static members of XWorkArea
static
void C_WorkArea_scroll_cb(FL_OBJECT * ob, long)
void C_XWorkArea_scroll_cb(FL_OBJECT * ob, long)
{
WorkArea * area = static_cast<WorkArea*>(ob->u_vdata);
XWorkArea * area = static_cast<XWorkArea*>(ob->u_vdata);
area->scroll_cb();
}
static
int C_WorkArea_work_area_handler(FL_OBJECT * ob, int event,
int C_XWorkArea_work_area_handler(FL_OBJECT * ob, int event,
FL_Coord, FL_Coord,
int key, void * xev)
{
return WorkArea::work_area_handler(ob, event,
return XWorkArea::work_area_handler(ob, event,
0, 0, key, xev);
}
static
int C_WorkAreaEventCB(FL_FORM * form, void * xev) {
WorkArea * wa = static_cast<WorkArea*>(form->u_vdata);
int C_XWorkAreaEventCB(FL_FORM * form, void * xev) {
XWorkArea * wa = static_cast<XWorkArea*>(form->u_vdata);
return wa->event_cb(static_cast<XEvent*>(xev));
}
}
WorkArea::WorkArea(int x, int y, int w, int h)
XWorkArea::XWorkArea(int x, int y, int w, int h)
: splash_(0), splash_text_(0), workareapixmap(0), painter_(*this)
{
fl_freeze_all_forms();
@ -207,7 +208,7 @@ WorkArea::WorkArea(int x, int y, int w, int h)
fl_set_object_resize(obj, FL_RESIZE_ALL);
fl_set_object_gravity(obj, NorthEastGravity, SouthEastGravity);
obj->u_vdata = this;
fl_set_object_callback(obj, C_WorkArea_scroll_cb, 0);
fl_set_object_callback(obj, C_XWorkArea_scroll_cb, 0);
fl_set_scrollbar_bounds(scrollbar, 0.0, 0.0);
fl_set_scrollbar_value(scrollbar, 0.0);
fl_set_scrollbar_size(scrollbar, scrollbar->h);
@ -232,9 +233,9 @@ WorkArea::WorkArea(int x, int y, int w, int h)
x + bw, y + bw,
w - 15 - 2 * bw, // scrollbarwidth
h - 2 * bw, "",
C_WorkArea_work_area_handler);
C_XWorkArea_work_area_handler);
obj->wantkey = FL_KEY_ALL;
obj->u_vdata = this; /* This is how we pass the WorkArea
obj->u_vdata = this; /* This is how we pass the XWorkArea
to the work_area_handler. */
fl_set_object_boxtype(obj,FL_DOWN_BOX);
fl_set_object_resize(obj, FL_RESIZE_ALL);
@ -242,20 +243,20 @@ WorkArea::WorkArea(int x, int y, int w, int h)
/// X selection hook - xforms gets it wrong
fl_current_form->u_vdata = this;
fl_register_raw_callback(fl_current_form, FL_ALL_EVENT, C_WorkAreaEventCB);
fl_register_raw_callback(fl_current_form, FL_ALL_EVENT, C_XWorkAreaEventCB);
fl_unfreeze_all_forms();
}
WorkArea::~WorkArea()
XWorkArea::~XWorkArea()
{
if (workareapixmap)
XFreePixmap(fl_get_display(), workareapixmap);
}
void WorkArea::resize(int xpos, int ypos, int width, int height)
void XWorkArea::resize(int xpos, int ypos, int width, int height)
{
fl_freeze_all_forms();
@ -297,7 +298,7 @@ void destroy_object(FL_OBJECT * obj)
} // namespace anon
void WorkArea::createPixmap(int width, int height)
void XWorkArea::createPixmap(int width, int height)
{
// Three calls to createPixmap are needed to draw the initial view
// of LyX. Any more and the splash is destroyed.
@ -335,7 +336,7 @@ void WorkArea::createPixmap(int width, int height)
}
void WorkArea::greyOut() const
void XWorkArea::greyOut() const
{
if (!splash_) {
fl_winset(FL_ObjWin(work_area));
@ -345,13 +346,13 @@ void WorkArea::greyOut() const
}
void WorkArea::setFocus() const
void XWorkArea::setFocus() const
{
fl_set_focus_object(work_area->form, work_area);
}
void WorkArea::setScrollbarParams(int height, int pos, int line_height)
void XWorkArea::setScrollbarParams(int height, int pos, int line_height)
{
// we need to cache this for scroll_cb
doc_height_ = height;
@ -391,7 +392,7 @@ void WorkArea::setScrollbarParams(int height, int pos, int line_height)
// callback for scrollbar slider
void WorkArea::scroll_cb()
void XWorkArea::scroll_cb()
{
double const val = fl_get_scrollbar_value(scrollbar);
lyxerr[Debug::GUI] << "scroll: val: " << val << endl;
@ -402,7 +403,7 @@ void WorkArea::scroll_cb()
}
int WorkArea::work_area_handler(FL_OBJECT * ob, int event,
int XWorkArea::work_area_handler(FL_OBJECT * ob, int event,
FL_Coord, FL_Coord ,
int key, void * xev)
{
@ -411,7 +412,7 @@ int WorkArea::work_area_handler(FL_OBJECT * ob, int event,
static long scrollbar_value_old = -1;
XEvent * ev = static_cast<XEvent*>(xev);
WorkArea * area = static_cast<WorkArea*>(ob->u_vdata);
XWorkArea * area = static_cast<XWorkArea*>(ob->u_vdata);
if (!area) return 1;
@ -477,15 +478,16 @@ int WorkArea::work_area_handler(FL_OBJECT * ob, int event,
// lyxerr << "We have " << num_keys << " keys in the returned buffer" << endl;
// lyxerr << "Our dummy string is " << dummy << endl;
#endif
if (lyxerr.debugging(Debug::KEY)) {
char const * tmp = XKeysymToString(key);
char const * tmp2 = XKeysymToString(keysym);
string const stm = (tmp ? tmp : "");
string const stm2 = (tmp2 ? tmp2 : "");
lyxerr[Debug::KEY] << "WorkArea: Key is `" << stm << "' ["
lyxerr[Debug::KEY] << "XWorkArea: Key is `" << stm << "' ["
<< key << "]" << endl;
lyxerr[Debug::KEY] << "WorkArea: Keysym is `" << stm2 << "' ["
lyxerr[Debug::KEY] << "XWorkArea: Keysym is `" << stm2 << "' ["
<< keysym << "]" << endl;
}
@ -562,7 +564,11 @@ int WorkArea::work_area_handler(FL_OBJECT * ob, int event,
last_key_pressed = xke->keycode;
last_state_pressed = ret_state;
area->workAreaKeyPress(ret_key, x_key_state(ret_state));
XLyXKeySym * xlk = new XLyXKeySym;
xlk->initFromKeySym(ret_key);
area->workAreaKeyPress(LyXKeySymPtr(xlk),
x_key_state(ret_state));
}
break;
@ -637,7 +643,7 @@ extern "C" {
} // namespace anon
int WorkArea::event_cb(XEvent * xev)
int XWorkArea::event_cb(XEvent * xev)
{
int ret = 0;
switch (xev->type) {
@ -654,7 +660,7 @@ int WorkArea::event_cb(XEvent * xev)
}
void WorkArea::haveSelection(bool yes) const
void XWorkArea::haveSelection(bool yes) const
{
if (!yes) {
XSetSelectionOwner(fl_get_display(), XA_PRIMARY, None, CurrentTime);
@ -665,7 +671,7 @@ void WorkArea::haveSelection(bool yes) const
}
string const WorkArea::getClipboard() const
string const XWorkArea::getClipboard() const
{
clipboard_read = false;
@ -686,7 +692,7 @@ string const WorkArea::getClipboard() const
}
void WorkArea::putClipboard(string const & s) const
void XWorkArea::putClipboard(string const & s) const
{
static string hold;
hold = s;

View File

@ -15,59 +15,49 @@
#pragma interface
#endif
#include "frontends/WorkArea.h"
#include "XPainter.h"
#include "frontends/mouse_state.h"
#include "frontends/key_state.h"
#include <boost/signals/signal0.hpp>
#include <boost/signals/signal1.hpp>
#include <boost/signals/signal2.hpp>
#include <boost/signals/signal3.hpp>
#include FORMS_H_LOCATION
#include <utility>
///
class WorkArea {
class XWorkArea : public WorkArea {
public:
///
WorkArea(int xpos, int ypos, int width, int height);
XWorkArea(int xpos, int ypos, int width, int height);
///
~WorkArea();
~XWorkArea();
///
Painter & getPainter() { return painter_; }
virtual Painter & getPainter() { return painter_; }
///
int workWidth() const { return work_area->w; }
virtual int workWidth() const { return work_area->w; }
///
int workHeight() const { return work_area->h; }
virtual int workHeight() const { return work_area->h; }
///
unsigned int width() const { return work_area->w + scrollbar->w; }
//unsigned int width() const { return backgroundbox->w + 15; }
virtual unsigned int width() const { return work_area->w + scrollbar->w; }
///
int xpos() const { return work_area->x; }
//int xpos() const { return backgroundbox->x; }
virtual int xpos() const { return work_area->x; }
///
int ypos() const { return work_area->y; }
//int ypos() const { return backgroundbox->y; }
virtual int ypos() const { return work_area->y; }
///
void resize(int xpos, int ypos, int width, int height);
virtual void resize(int xpos, int ypos, int width, int height);
///
void redraw() const {
virtual void redraw() const {
fl_redraw_object(work_area);
fl_redraw_object(scrollbar);
}
///
void setFocus() const;
virtual void setFocus() const;
///
Window getWin() const { return work_area->form->window; }
///
bool hasFocus() const { return work_area->focus; }
virtual bool hasFocus() const { return work_area->focus; }
///
bool visible() const { return work_area->form->visible; }
virtual bool visible() const { return work_area->form->visible; }
///
void greyOut() const;
virtual void greyOut() const;
///
void setScrollbarParams(int height, int pos, int line_height);
virtual void setScrollbarParams(int height, int pos, int line_height);
///
Pixmap getPixmap() const { return workareapixmap; }
/// xforms callback
@ -78,36 +68,11 @@ public:
/// xforms callback from scrollbar
void scroll_cb();
/// a selection exists
void haveSelection(bool) const;
virtual void haveSelection(bool) const;
///
string const getClipboard() const;
virtual string const getClipboard() const;
///
void putClipboard(string const &) const;
// Signals
///
boost::signal0<void> workAreaExpose;
///
boost::signal1<void, int> scrollDocView;
///
boost::signal2<void, KeySym, key_modifier::state> workAreaKeyPress;
///
boost::signal3<void, int, int, mouse_button::state> workAreaButtonPress;
///
boost::signal3<void, int, int, mouse_button::state> workAreaButtonRelease;
///
boost::signal3<void, int, int, mouse_button::state> workAreaMotionNotify;
///
boost::signal0<void> workAreaFocus;
///
boost::signal0<void> workAreaUnfocus;
///
boost::signal3<void, int, int, mouse_button::state> workAreaDoubleClick;
///
boost::signal3<void, int, int, mouse_button::state> workAreaTripleClick;
/// emitted when an X client has requested our selection
boost::signal0<void> selectionRequested;
/// emitted when another X client has stolen our selection
boost::signal0<void> selectionLost;
virtual void putClipboard(string const &) const;
/// handles SelectionRequest X Event, to fill the clipboard
int event_cb(XEvent * xev);

View File

@ -4,6 +4,3 @@ Makefile
*.h
*.C
*.tmp
*.lo
.deps
.libs

View File

@ -10,13 +10,13 @@ SnapGrid: 2
=============== FORM ===============
Name: form_maths_delim
Width: 250
Height: 307
Height: 221
Number of Objects: 11
--------------------
class: FL_BOX
type: UP_BOX
box: 0 0 250 307
box: 0 0 250 221
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
@ -34,7 +34,7 @@ argument:
--------------------
class: FL_BUTTON
type: PUSH_BUTTON
box: 42 112 170 140
box: 28 108 192 64
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
@ -52,7 +52,7 @@ argument: 0
--------------------
class: FL_BUTTON
type: NORMAL_BUTTON
box: 168 268 70 30
box: 168 182 70 30
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
@ -88,7 +88,7 @@ argument: 0
--------------------
class: FL_BUTTON
type: NORMAL_BUTTON
box: 90 268 70 30
box: 90 182 70 30
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
@ -106,7 +106,7 @@ argument: 0
--------------------
class: FL_BUTTON
type: RETURN_BUTTON
box: 12 268 70 30
box: 14 182 70 30
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER

View File

@ -0,0 +1,534 @@
#include <config.h>
#include "guiapi.h"
#include "FormAboutlyx.h"
#include "forms/form_aboutlyx.h"
#include "FormBibitem.h"
#include "forms/form_bibitem.h"
#include "FormBibtex.h"
#include "forms/form_bibtex.h"
#include "FormBrowser.h"
#include "forms/form_browser.h"
#include "FormCharacter.h"
#include "forms/form_character.h"
#include "FormCitation.h"
#include "forms/form_citation.h"
#include "FormDocument.h"
#include "forms/form_document.h"
#include "FormError.h"
#include "forms/form_error.h"
#include "FormERT.h"
#include "forms/form_ert.h"
#include "FormExternal.h"
#include "forms/form_external.h"
#include "FormFloat.h"
#include "forms/form_float.h"
#include "FormForks.h"
#include "forms/form_forks.h"
#include "FormGraphics.h"
#include "forms/form_graphics.h"
#include "FormInclude.h"
#include "forms/form_include.h"
#include "FormIndex.h"
#include "forms/form_index.h"
#include "FormLog.h"
#include "FormMathsPanel.h"
#include "FormMathsBitmap.h"
#include "FormMathsDeco.h"
#include "FormMathsDelim.h"
#include "FormMathsMatrix.h"
#include "FormMathsSpace.h"
#include "FormMathsStyle.h"
#include "forms/form_maths_deco.h"
#include "forms/form_maths_delim.h"
#include "forms/form_maths_matrix.h"
#include "forms/form_maths_panel.h"
#include "forms/form_maths_space.h"
#include "forms/form_maths_style.h"
#include "FormMinipage.h"
#include "forms/form_minipage.h"
#include "FormParagraph.h"
#include "forms/form_paragraph.h"
#include "FormPreamble.h"
#include "forms/form_preamble.h"
#include "FormPreferences.h"
#include "forms/form_preferences.h"
#include "FormPrint.h"
#include "forms/form_print.h"
#include "FormRef.h"
#include "forms/form_ref.h"
#include "FormSearch.h"
#include "forms/form_search.h"
#include "FormSendto.h"
#include "forms/form_sendto.h"
#include "FormShowFile.h"
#include "FormSpellchecker.h"
#include "forms/form_spellchecker.h"
#include "FormTabular.h"
#include "forms/form_tabular.h"
#include "FormTabularCreate.h"
#include "forms/form_tabular_create.h"
#include "FormTexinfo.h"
#include "forms/form_texinfo.h"
#include "FormToc.h"
#include "forms/form_toc.h"
#include "FormUrl.h"
#include "forms/form_url.h"
#include "FormVCLog.h"
#include "xformsBC.h"
#include "combox.h"
#include "controllers/GUI.h"
#include "insets/inseterror.h"
#include "LyXView.h"
#include "ControlAboutlyx.h"
#include "ControlBibitem.h"
#include "ControlBibtex.h"
#include "ControlCharacter.h"
#include "ControlCitation.h"
#include "ControlError.h"
#include "ControlERT.h"
#include "ControlExternal.h"
#include "ControlFloat.h"
#include "ControlForks.h"
#include "ControlGraphics.h"
#include "insets/insetgraphicsParams.h"
#include "ControlInclude.h"
#include "ControlIndex.h"
#include "ControlLog.h"
#include "ControlMinipage.h"
#include "ControlParagraph.h"
#include "ControlPreamble.h"
#include "ControlPrint.h"
#include "ControlRef.h"
#include "ControlSearch.h"
#include "ControlSendto.h"
#include "ControlShowFile.h"
#include "ControlSpellchecker.h"
#include "ControlTabularCreate.h"
#include "ControlTexinfo.h"
#include "ControlThesaurus.h"
#include "ControlToc.h"
#include "ControlUrl.h"
#include "ControlVCLog.h"
namespace { // anon
// I belive that this one is buggy (Lgb)
// But not if used correctly. (Lgb)
template <class T>
class GUISingleton {
public:
static
T & get(LyXView & lv, Dialogs & d) {
static T t(lv, d);
return t;
}
};
GUISingleton<GUI<ControlCharacter, FormCharacter,
OkApplyCancelReadOnlyPolicy, xformsBC> >
controlCharacterSingleton;
GUISingleton<GUI<ControlCitation, FormCitation,
NoRepeatedApplyReadOnlyPolicy, xformsBC> >
controlCitationSingleton;
GUISingleton<GUI<ControlERT, FormERT,
NoRepeatedApplyReadOnlyPolicy, xformsBC> >
controlERTSingleton;
GUISingleton<GUI<ControlIndex, FormIndex,
NoRepeatedApplyReadOnlyPolicy, xformsBC> >
controlIndexSingleton;
GUISingleton<GUI<ControlMinipage, FormMinipage,
NoRepeatedApplyReadOnlyPolicy, xformsBC> >
controlMinipageSingleton;
GUISingleton<FormPreferences> formPreferencesSingleton;
GUISingleton<GUI<ControlRef, FormRef,
NoRepeatedApplyReadOnlyPolicy, xformsBC> >
controlRefSingleton;
GUISingleton<FormTabular> formTabularSingleton;
GUISingleton<GUI<ControlToc, FormToc,
OkCancelPolicy, xformsBC> >
controlTocSingleton;
GUISingleton<GUI<ControlUrl, FormUrl,
NoRepeatedApplyReadOnlyPolicy, xformsBC> >
controlUrlSingleton;
} // anon
extern "C" {
void gui_ShowAboutlyx(LyXView & lv, Dialogs & d)
{
static GUI<ControlAboutlyx, FormAboutlyx,
OkCancelPolicy, xformsBC> cal(lv, d);
cal.show();
}
void gui_ShowBibitem(InsetCommand * ic, LyXView & lv, Dialogs & d)
{
static GUI<ControlBibitem, FormBibitem,
OkCancelReadOnlyPolicy, xformsBC> cbi(lv, d);
cbi.showInset(ic);
}
void gui_ShowBibtex(InsetCommand * ic, LyXView & lv, Dialogs & d)
{
static GUI<ControlBibtex, FormBibtex,
OkCancelReadOnlyPolicy, xformsBC> cbt(lv, d);
cbt.showInset(ic);
}
void gui_ShowCharacter(LyXView & lv, Dialogs & d)
{
controlCharacterSingleton.get(lv, d).show();
}
void gui_SetUserFreeFont(LyXView & lv, Dialogs & d)
{
controlCharacterSingleton.get(lv, d).apply();
}
void gui_ShowCitation(InsetCommand * ic, LyXView & lv, Dialogs & d)
{
controlCitationSingleton.get(lv, d).showInset(ic);
}
void gui_CreateCitation(string const & s, LyXView & lv, Dialogs & d)
{
controlCitationSingleton.get(lv, d).createInset(s);
}
void gui_ShowDocument(LyXView & lv, Dialogs & d)
{
static FormDocument fd(&lv, &d);
fd.show();
}
void gui_ShowError(InsetError * ie, LyXView & lv, Dialogs & d)
{
static GUI<ControlError, FormError,
OkCancelPolicy, xformsBC> ce(lv, d);
ce.showInset(ie);
}
void gui_ShowERT(InsetERT * ie, LyXView & lv, Dialogs & d)
{
controlERTSingleton.get(lv, d).showInset(ie);
}
void gui_UpdateERT(InsetERT * ie, LyXView & lv, Dialogs & d)
{
controlERTSingleton.get(lv, d).showInset(ie);
}
void gui_ShowExternal(InsetExternal * ie, LyXView & lv, Dialogs & d)
{
static GUI<ControlExternal, FormExternal,
OkApplyCancelReadOnlyPolicy, xformsBC> ce(lv, d);
ce.showInset(ie);
}
void gui_ShowFile(string const & f, LyXView & lv, Dialogs & d)
{
static GUI<ControlShowFile, FormShowFile,
OkCancelPolicy, xformsBC> csf(lv, d);
csf.showFile(f);
}
void gui_ShowFloat(InsetFloat * ifl, LyXView & lv, Dialogs & d)
{
static GUI<ControlFloat, FormFloat,
NoRepeatedApplyReadOnlyPolicy, xformsBC> cf(lv, d);
cf.showInset(ifl);
}
void gui_ShowForks(LyXView & lv, Dialogs & d)
{
static GUI<ControlForks, FormForks,
OkApplyCancelPolicy, xformsBC> cf(lv, d);
cf.show();
}
void gui_ShowGraphics(InsetGraphics * ig, LyXView & lv, Dialogs & d)
{
static GUI<ControlGraphics, FormGraphics,
NoRepeatedApplyReadOnlyPolicy, xformsBC> cg(lv, d);
cg.showInset(ig);
}
void gui_ShowInclude(InsetInclude * ii, LyXView & lv, Dialogs & d)
{
static GUI<ControlInclude, FormInclude,
OkCancelReadOnlyPolicy, xformsBC> ci(lv, d);
ci.showInset(ii);
}
void gui_ShowIndex(InsetCommand * ic, LyXView & lv, Dialogs & d)
{
controlIndexSingleton.get(lv, d).showInset(ic);
}
void gui_CreateIndex(string const & s, LyXView & lv, Dialogs & d)
{
controlIndexSingleton.get(lv, d).createInset(s);
}
#if 0
void gui_ShowInfo(InsetInfo *, LyXView & lv, Dialogs & d)
{
}
#endif
void gui_ShowLogFile(LyXView & lv, Dialogs & d)
{
static GUI<ControlLog, FormLog,
OkCancelPolicy, xformsBC> cl(lv, d);
cl.show();
}
void gui_ShowMathPanel(LyXView & lv, Dialogs & d)
{
static FormMathsPanel fmp(&lv, &d);
fmp.show();
}
void gui_ShowMinipage(InsetMinipage * im, LyXView & lv, Dialogs & d)
{
controlMinipageSingleton.get(lv, d).showInset(im);
}
void gui_UpdateMinipage(InsetMinipage * im, LyXView & lv, Dialogs & d)
{
controlMinipageSingleton.get(lv, d).showInset(im);
}
void gui_ShowParagraph(LyXView & lv, Dialogs & d)
{
static GUI<ControlParagraph, FormParagraph,
OkApplyCancelReadOnlyPolicy, xformsBC> cp(lv, d);
cp.show();
}
#if 0
void gui_UpdateParagraph(LyXView & lv, Dialogs & d)
{
#warning FIXME!
// This should be the same object as in gui_ShowParagraph
static GUI<ControlParagraph, FormParagraph,
OkApplyCancelReadOnlyPolicy, xformsBC> cp(lv, d);
#if 0
cp.
#endif
}
#endif
void gui_ShowPreamble(LyXView & lv, Dialogs & d)
{
static GUI<ControlPreamble, FormPreamble,
NoRepeatedApplyReadOnlyPolicy, xformsBC> cp(lv, d);
cp.show();
}
void gui_ShowPreferences(LyXView & lv, Dialogs & d)
{
formPreferencesSingleton.get(lv, d).show();
}
void gui_ShowPrint(LyXView & lv, Dialogs & d)
{
static GUI<ControlPrint, FormPrint,
OkApplyCancelPolicy, xformsBC> cp(lv, d);
cp.show();
}
void gui_ShowRef(InsetCommand * ic, LyXView & lv, Dialogs & d)
{
controlRefSingleton.get(lv, d).showInset(ic);
}
void gui_CreateRef(string const & s, LyXView & lv, Dialogs & d)
{
controlRefSingleton.get(lv, d).createInset(s);
}
void gui_ShowSearch(LyXView & lv, Dialogs & d)
{
static GUI<ControlSearch, FormSearch,
NoRepeatedApplyReadOnlyPolicy, xformsBC> cs(lv, d);
cs.show();
}
void gui_ShowSendto(LyXView & lv, Dialogs & d)
{
static GUI<ControlSendto, FormSendto,
OkApplyCancelPolicy, xformsBC> cs(lv, d);
cs.show();
}
void gui_ShowSpellchecker(LyXView & lv, Dialogs & d)
{
static GUI<ControlSpellchecker, FormSpellchecker,
NoRepeatedApplyReadOnlyPolicy, xformsBC> cp(lv, d);
cp.show();
}
void gui_ShowSpellcheckerPreferences(LyXView & lv, Dialogs & d)
{
formPreferencesSingleton.get(lv, d).showSpellPref();
}
void gui_ShowTabular(InsetTabular * it, LyXView & lv, Dialogs & d)
{
formTabularSingleton.get(lv, d).showInset(it);
}
void gui_UpdateTabular(InsetTabular * it, LyXView & lv, Dialogs & d)
{
formTabularSingleton.get(lv, d).updateInset(it);
}
void gui_ShowTabularCreate(LyXView & lv, Dialogs & d)
{
static GUI<ControlTabularCreate, FormTabularCreate,
OkApplyCancelReadOnlyPolicy, xformsBC> ctc(lv, d);
ctc.show();
}
void gui_ShowTexinfo(LyXView & lv, Dialogs & d)
{
static GUI<ControlTexinfo, FormTexinfo,
OkCancelPolicy, xformsBC> ct(lv, d);
ct.show();
}
void gui_ShowThesaurus(string const & /*s*/, LyXView & , Dialogs &)
{
#ifdef HAVE_LIBAIKSAURUS
static GUI<ControlThesaurus, FormThesaurus,
OkApplyCancelReadOnlyPolicy, xformsBC> ct(lv, d);
ct.showEntry(s);
#endif
}
void gui_ShowTOC(InsetCommand * ic, LyXView & lv, Dialogs & d)
{
controlTocSingleton.get(lv, d).showInset(ic);
}
void gui_CreateTOC(string const & s, LyXView & lv, Dialogs & d)
{
controlTocSingleton.get(lv, d).createInset(s);
}
void gui_ShowUrl(InsetCommand * ic, LyXView & lv, Dialogs & d)
{
controlUrlSingleton.get(lv, d).showInset(ic);
}
void gui_CreateUrl(string const & s, LyXView & lv, Dialogs & d)
{
controlUrlSingleton.get(lv, d).createInset(s);
}
void gui_ShowVCLogFile(LyXView & lv, Dialogs & d)
{
static GUI<ControlVCLog, FormVCLog,
OkCancelPolicy, xformsBC> cv(lv, d);
cv.show();
}
} // extern "C"

View File

@ -0,0 +1,260 @@
/**
* \file xscreen.C
* Copyright 1995-2002 the LyX Team
* Read the file COPYING
*
* \author unknown
* \author John Levon <moz@compsoc.man.ac.uk>
*/
#include <config.h>
#ifdef __GNUG__
#pragma implementation
#endif
#include <algorithm>
#include <X11/Xlib.h>
#include "frontends/screen.h"
#include "frontends/font_metrics.h"
#include "XWorkArea.h"
#include "xscreen.h"
#include "lyxtext.h"
#include "lyxrow.h"
#include "Painter.h"
#include "WorkArea.h"
#include "buffer.h"
#include "BufferView.h"
#include "insets/insettext.h"
#include "ColorHandler.h"
#include "language.h"
using std::max;
using std::min;
namespace {
GC createGC()
{
XGCValues val;
val.foreground = BlackPixel(fl_get_display(),
DefaultScreen(fl_get_display()));
val.function = GXcopy;
val.graphics_exposures = false;
val.line_style = LineSolid;
val.line_width = 0;
return XCreateGC(fl_get_display(), RootWindow(fl_get_display(), 0),
GCForeground | GCFunction | GCGraphicsExposures
| GCLineWidth | GCLineStyle , &val);
}
} // namespace anon
// Constructor
XScreen::XScreen(XWorkArea & o)
: LyXScreen(), owner_(o)
{
// the cursor isnt yet visible
cursor_pixmap = 0;
cursor_pixmap_x = 0;
cursor_pixmap_y = 0;
cursor_pixmap_w = 0;
cursor_pixmap_h = 0;
// We need this GC
gc_copy = createGC();
}
XScreen::~XScreen()
{
XFreeGC(fl_get_display(), gc_copy);
}
void XScreen::setCursorColor()
{
if (!lyxColorHandler.get()) return;
GC gc = lyxColorHandler->getGCForeground(LColor::cursor);
XGCValues val;
XGetGCValues(fl_get_display(),
gc, GCForeground, &val);
XChangeGC(fl_get_display(), gc_copy, GCForeground, &val);
}
void XScreen::showManualCursor(LyXText const * text, int x, int y,
int asc, int desc, Cursor_Shape shape)
{
// Update the cursor color.
setCursorColor();
int const y1 = max(y - text->first_y - asc, 0);
int const y_tmp = min(y - text->first_y + desc,
static_cast<int>(owner_.workHeight()));
// Secure against very strange situations
int const y2 = max(y_tmp, y1);
if (cursor_pixmap) {
XFreePixmap(fl_get_display(), cursor_pixmap);
cursor_pixmap = 0;
}
if (y2 > 0 && y1 < int(owner_.workHeight())) {
cursor_pixmap_h = y2 - y1 + 1;
cursor_pixmap_y = y1;
switch (shape) {
case BAR_SHAPE:
cursor_pixmap_w = 1;
cursor_pixmap_x = x;
break;
case L_SHAPE:
cursor_pixmap_w = cursor_pixmap_h/3;
cursor_pixmap_x = x;
break;
case REVERSED_L_SHAPE:
cursor_pixmap_w = cursor_pixmap_h/3;
cursor_pixmap_x = x - cursor_pixmap_w + 1;
break;
}
cursor_pixmap =
XCreatePixmap (fl_get_display(),
fl_root,
cursor_pixmap_w,
cursor_pixmap_h,
fl_get_visual_depth());
XCopyArea (fl_get_display(),
owner_.getWin(),
cursor_pixmap,
gc_copy,
owner_.xpos() + cursor_pixmap_x,
owner_.ypos() + cursor_pixmap_y,
cursor_pixmap_w,
cursor_pixmap_h,
0, 0);
XDrawLine(fl_get_display(),
owner_.getWin(),
gc_copy,
x + owner_.xpos(),
y1 + owner_.ypos(),
x + owner_.xpos(),
y2 + owner_.ypos());
switch (shape) {
case BAR_SHAPE:
break;
case L_SHAPE:
case REVERSED_L_SHAPE:
int const rectangle_h = (cursor_pixmap_h + 10) / 20;
XFillRectangle(fl_get_display(),
owner_.getWin(),
gc_copy,
cursor_pixmap_x + owner_.xpos(),
y2 - rectangle_h + 1 + owner_.ypos(),
cursor_pixmap_w - 1, rectangle_h);
break;
}
}
cursor_visible_ = true;
}
void XScreen::hideCursor()
{
if (!cursor_visible_) return;
if (cursor_pixmap) {
XCopyArea (fl_get_display(),
cursor_pixmap,
owner_.getWin(),
gc_copy,
0, 0,
cursor_pixmap_w, cursor_pixmap_h,
cursor_pixmap_x + owner_.xpos(),
cursor_pixmap_y + owner_.ypos());
}
cursor_visible_ = false;
}
void XScreen::expose(int x, int y, int exp_width, int exp_height)
{
// FIXME: here we should definitely NOT do this.
// we need to generate an expose event for the workarea
// and then copy from the pixmap to the screen. This
// is the Sane Way (tm)
XCopyArea(fl_get_display(),
owner_.getPixmap(),
owner_.getWin(),
gc_copy,
x, y,
exp_width, exp_height,
x + owner_.xpos(),
y + owner_.ypos());
}
void XScreen::draw(LyXText * text, BufferView * bv, unsigned int y)
{
if (cursor_visible_) hideCursor();
int const old_first = text->first_y;
bool internal = (text == bv->text);
text->first_y = y;
// is any optimization possible?
if ((y - old_first) < owner_.workHeight()
&& (old_first - y) < owner_.workHeight())
{
if (text->first_y < old_first) {
drawFromTo(text, bv, 0,
old_first - text->first_y, 0, 0, internal);
XCopyArea (fl_get_display(),
owner_.getWin(),
owner_.getWin(),
gc_copy,
owner_.xpos(),
owner_.ypos(),
owner_.workWidth(),
owner_.workHeight() - old_first + text->first_y,
owner_.xpos(),
owner_.ypos() + old_first - text->first_y
);
// expose the area drawn
expose(0, 0,
owner_.workWidth(),
old_first - text->first_y);
} else {
drawFromTo(text, bv,
owner_.workHeight() + old_first - text->first_y,
owner_.workHeight(), 0, 0, internal);
XCopyArea (fl_get_display(),
owner_.getWin(),
owner_.getWin(),
gc_copy,
owner_.xpos(),
owner_.ypos() + text->first_y - old_first,
owner_.workWidth(),
owner_.workHeight() + old_first - text->first_y,
owner_.xpos(),
owner_.ypos());
// expose the area drawn
expose(0, owner_.workHeight() + old_first - text->first_y,
owner_.workWidth(), text->first_y - old_first);
}
} else {
// make a dumb new-draw
drawFromTo(text, bv, 0, owner_.workHeight(), 0, 0, internal);
expose(0, 0, owner_.workWidth(), owner_.workHeight());
}
XSync(fl_get_display(), 0);
}

View File

@ -0,0 +1,75 @@
// -*- C++ -*-
/**
* \file xscreen.h
* Copyright 1995-2002 the LyX Team
* Read the file COPYING
*
* \author unknown
* \author John Levon <moz@compsoc.man.ac.uk>
*/
#ifndef XSCREEN_H
#define XSCREEN_H
#ifdef __GNUG__
#pragma interface
#endif
#include <X11/Xlib.h>
#include "screen.h"
#include "XWorkArea.h"
/** The class XScreen is used for the main Textbody.
Concretely, the screen is held in a pixmap. This pixmap is kept up to
date and used to optimize drawing on the screen.
This class also handles the drawing of the cursor and partly the selection.
*/
class XScreen : public LyXScreen {
public:
///
XScreen(XWorkArea &);
///
virtual ~XScreen();
/// Sets the cursor color to LColor::cursor.
virtual void setCursorColor();
///
virtual void hideCursor();
///
virtual void showManualCursor(LyXText const *, int x, int y,
int asc, int desc,
Cursor_Shape shape);
/** Draws the screen form textposition y. Uses as much of
the already printed pixmap as possible */
virtual void draw(LyXText *, BufferView *, unsigned int y);
protected:
/// get the work area
virtual WorkArea & workarea() const { return owner_; }
/// Copies specified area of pixmap to screen
virtual void expose(int x, int y, int exp_width, int exp_height);
private:
/// our owning widget
XWorkArea & owner_;
///
Pixmap cursor_pixmap;
///
int cursor_pixmap_x;
///
int cursor_pixmap_y;
///
int cursor_pixmap_w;
///
int cursor_pixmap_h;
///
GC gc_copy;
};
#endif

View File

@ -1,3 +1,8 @@
2002-06-15 LyX Development team <lyx@rilke>
* inset*.[Ch] (docbook): Added new argument to take the pernicious
mixed content. Small white spaces clean.
2002-06-14 Angus Leeming <leeming@lyx.org>
* inseetexternal.C: remove the using std::difftime declaration.

View File

@ -194,7 +194,7 @@ public:
///
virtual int linuxdoc(Buffer const *, std::ostream &) const = 0;
///
virtual int docbook(Buffer const *, std::ostream &) const = 0;
virtual int docbook(Buffer const *, std::ostream &, bool) const = 0;
/// Updates needed features for this inset.
virtual void validate(LaTeXFeatures & features) const;
///

View File

@ -120,11 +120,11 @@ int InsetCaption::ascii(Buffer const * /*buf*/,
}
int InsetCaption::docbook(Buffer const * buf, ostream & os) const
int InsetCaption::docbook(Buffer const * buf, ostream & os, bool mixcont) const
{
int ret;
os << "<title>";
ret = InsetText::docbook(buf, os);
ret = InsetText::docbook(buf, os, mixcont);
os << "</title>\n";
return ret;
}

View File

@ -54,7 +54,7 @@ public:
int ascii(Buffer const * buf, std::ostream & os, int linelen) const;
///
virtual
int docbook(Buffer const * buf, std::ostream & os) const;
int docbook(Buffer const * buf, std::ostream & os, bool mixcont) const;
protected:
private:
};

View File

@ -392,9 +392,9 @@ int InsetCollapsable::linuxdoc(Buffer const * buf, ostream & os) const
}
int InsetCollapsable::docbook(Buffer const * buf, ostream & os) const
int InsetCollapsable::docbook(Buffer const * buf, ostream & os, bool mixcont) const
{
return inset.docbook(buf, os);
return inset.docbook(buf, os, mixcont);
}
#if 0
@ -649,7 +649,8 @@ bool InsetCollapsable::searchForward(BufferView * bv, string const & str,
bool found = inset.searchForward(bv, str, cs, mw);
if (first_after_edit && !found)
close(bv);
first_after_edit = false;
else if (!found)
first_after_edit = false;
return found;
}
@ -660,7 +661,8 @@ bool InsetCollapsable::searchBackward(BufferView * bv, string const & str,
bool found = inset.searchBackward(bv, str, cs, mw);
if (first_after_edit && !found)
close(bv);
first_after_edit = false;
else if (!found)
first_after_edit = false;
return found;
}

View File

@ -105,7 +105,7 @@ public:
///
int linuxdoc(Buffer const *, std::ostream &) const;
///
int docbook(Buffer const *, std::ostream &) const;
int docbook(Buffer const *, std::ostream &, bool mixcont) const;
///
void validate(LaTeXFeatures & features) const;
///

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