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(); return pimpl_->screen();
} }

View File

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

View File

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

View File

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

View File

@ -15,6 +15,7 @@
#include "frontends/Timeout.h" #include "frontends/Timeout.h"
#include "frontends/key_state.h" #include "frontends/key_state.h"
#include "frontends/mouse_state.h" #include "frontends/mouse_state.h"
#include "frontends/LyXKeySym.h"
#include "box.h" #include "box.h"
#include "insets/insetspecialchar.h" #include "insets/insetspecialchar.h"
#include "support/types.h" #include "support/types.h"
@ -28,10 +29,7 @@
class LyXView; class LyXView;
class WorkArea; class WorkArea;
class LScreen; class LyXScreen;
// FIXME: remove
#include <X11/Xlib.h>
/// ///
struct BufferView::Pimpl : public boost::signals::trackable { 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 /// return the work area for this bview
WorkArea & workarea() const; WorkArea & workarea() const;
/// return the screen for this bview /// return the screen for this bview
LScreen & screen() const; LyXScreen & screen() const;
/// ///
void buffer(Buffer *); void buffer(Buffer *);
/// ///
@ -79,7 +77,8 @@ struct BufferView::Pimpl : public boost::signals::trackable {
/// wheel mouse scroll /// wheel mouse scroll
int scroll(long time); 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); void workAreaMotionNotify(int x, int y, mouse_button::state state);
/// ///
@ -172,7 +171,7 @@ private:
/// ///
Buffer * buffer_; Buffer * buffer_;
/// ///
boost::scoped_ptr<LScreen> screen_; boost::scoped_ptr<LyXScreen> screen_;
/// ///
boost::scoped_ptr<WorkArea> workarea_; 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> 2002-06-14 Angus Leeming <leeming@lyx.org>
* Makefile.am: nuke forgotten stl_string_fwd.h. * 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_OFF, "mark-off", "", ReadOnly },
{ LFUN_MARK_ON, "mark-on", "", ReadOnly }, { LFUN_MARK_ON, "mark-on", "", ReadOnly },
{ LFUN_SETMARK, "mark-toggle", "", ReadOnly }, { LFUN_SETMARK, "mark-toggle", "", ReadOnly },
{ LFUN_MATH, "math", "", Noop },
{ LFUN_MATH_DELIM, "math-delim", "", Noop }, { LFUN_MATH_DELIM, "math-delim", "", Noop },
{ LFUN_MATH_DISPLAY, "math-display", "", Noop }, { LFUN_MATH_DISPLAY, "math-display", "", Noop },
{ LFUN_GREEK, "math-greek", N_("Math Greek"), 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) { } else if (file_format < 220) {
Alert::alert(_("ERROR!"), Alert::alert(_("ERROR!"),
_("Old LyX file format found. " _("Old LyX file format found. "
"User LyX 1.2.x to read this!")); "Use LyX 1.2.x to read this!"));
return false; 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 string const & latexname) const
{ {
if (!latexname.empty() && latexname != "!-- --") if (!latexname.empty() && latexname != "!-- --") {
//os << "<!-- " << depth << " -->" << "<" << latexname << ">"; if (!mixcont)
os << "<" << latexname << ">"; 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 string const & latexname) const
{ {
if (!latexname.empty() && latexname != "!-- --") if (!latexname.empty() && latexname != "!-- --") {
//os << "<!-- " << depth << " -->" << "</" << latexname << ">\n"; if (!mixcont)
os << endl << string(" ",depth);
os << "</" << latexname << ">"; 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"; ofs << ">\n\n";
if (params.options.empty()) if (params.options.empty())
sgmlOpenTag(ofs, 0, top_element); sgmlOpenTag(ofs, 0, false, top_element);
else { else {
string top = top_element; string top = top_element;
top += " "; top += " ";
top += params.options; 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(); Inset::Code lyx_code = inset->lyxCode();
if (lyx_code == Inset::TOC_CODE) { if (lyx_code == Inset::TOC_CODE) {
string const temp = "toc"; string const temp = "toc";
sgmlOpenTag(ofs, depth, temp); sgmlOpenTag(ofs, depth, false, temp);
par = par->next(); par = par->next();
continue; continue;
@ -2839,7 +2853,7 @@ void Buffer::makeLinuxDocFile(string const & fname, bool nice, bool body_only)
// environment tag closing // environment tag closing
for (; depth > par->params().depth(); --depth) { for (; depth > par->params().depth(); --depth) {
sgmlCloseTag(ofs, depth, environment_stack[depth]); sgmlCloseTag(ofs, depth, false, environment_stack[depth]);
environment_stack[depth].erase(); environment_stack[depth].erase();
} }
@ -2848,14 +2862,14 @@ void Buffer::makeLinuxDocFile(string const & fname, bool nice, bool body_only)
case LATEX_PARAGRAPH: case LATEX_PARAGRAPH:
if (depth == par->params().depth() if (depth == par->params().depth()
&& !environment_stack[depth].empty()) { && !environment_stack[depth].empty()) {
sgmlCloseTag(ofs, depth, environment_stack[depth]); sgmlCloseTag(ofs, depth, false, environment_stack[depth]);
environment_stack[depth].erase(); environment_stack[depth].erase();
if (depth) if (depth)
--depth; --depth;
else else
ofs << "</p>"; ofs << "</p>";
} }
sgmlOpenTag(ofs, depth, style.latexname()); sgmlOpenTag(ofs, depth, false, style.latexname());
break; break;
case LATEX_COMMAND: case LATEX_COMMAND:
@ -2865,21 +2879,19 @@ void Buffer::makeLinuxDocFile(string const & fname, bool nice, bool body_only)
" LatexType Command.\n")); " LatexType Command.\n"));
if (!environment_stack[depth].empty()) { if (!environment_stack[depth].empty()) {
sgmlCloseTag(ofs, depth, sgmlCloseTag(ofs, depth, false, environment_stack[depth]);
environment_stack[depth]);
ofs << "</p>"; ofs << "</p>";
} }
environment_stack[depth].erase(); environment_stack[depth].erase();
sgmlOpenTag(ofs, depth, style.latexname()); sgmlOpenTag(ofs, depth, false, style.latexname());
break; break;
case LATEX_ENVIRONMENT: case LATEX_ENVIRONMENT:
case LATEX_ITEM_ENVIRONMENT: case LATEX_ITEM_ENVIRONMENT:
if (depth == par->params().depth() if (depth == par->params().depth()
&& environment_stack[depth] != style.latexname()) { && environment_stack[depth] != style.latexname()) {
sgmlCloseTag(ofs, depth, sgmlCloseTag(ofs, depth, false, environment_stack[depth]);
environment_stack[depth]);
environment_stack[depth].erase(); environment_stack[depth].erase();
} }
if (depth < par->params().depth()) { 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 (environment_stack[depth] != style.latexname()) {
if (depth == 0) { 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) if (environment_stack.size() == depth + 1)
environment_stack.push_back("!-- --"); environment_stack.push_back("!-- --");
@ -2907,10 +2919,10 @@ void Buffer::makeLinuxDocFile(string const & fname, bool nice, bool body_only)
else else
item_name = "item"; item_name = "item";
sgmlOpenTag(ofs, depth + 1, item_name); sgmlOpenTag(ofs, depth + 1, false, item_name);
break; break;
default: default:
sgmlOpenTag(ofs, depth, style.latexname()); sgmlOpenTag(ofs, depth, false, style.latexname());
break; break;
} }
@ -2929,18 +2941,18 @@ void Buffer::makeLinuxDocFile(string const & fname, bool nice, bool body_only)
ofs << "]]>"; ofs << "]]>";
break; break;
default: default:
sgmlCloseTag(ofs, depth, style.latexname()); sgmlCloseTag(ofs, depth, false, style.latexname());
break; break;
} }
} }
// Close open tags // Close open tags
for (int i=depth; i >= 0; --i) for (int i=depth; i >= 0; --i)
sgmlCloseTag(ofs, depth, environment_stack[i]); sgmlCloseTag(ofs, depth, false, environment_stack[i]);
if (!body_only) { if (!body_only) {
ofs << "\n\n"; ofs << "\n\n";
sgmlCloseTag(ofs, 0, top_element); sgmlCloseTag(ofs, 0, false, top_element);
} }
ofs.close(); ofs.close();
@ -3266,7 +3278,7 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body)
top += " "; top += " ";
top += params.options; top += params.options;
} }
sgmlOpenTag(ofs, 0, top); sgmlOpenTag(ofs, 0, false, top);
ofs << "<!-- DocBook file was created by " << lyx_docversion ofs << "<!-- DocBook file was created by " << lyx_docversion
<< "\n See http://www.lyx.org/ for more information -->\n"; << "\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) { for (; depth > par->params().depth(); --depth) {
if (environment_inner[depth] != "!-- --") { if (environment_inner[depth] != "!-- --") {
item_name = "listitem"; item_name = "listitem";
sgmlCloseTag(ofs, command_depth + depth, sgmlCloseTag(ofs, command_depth + depth, false, item_name);
item_name);
if (environment_inner[depth] == "varlistentry") if (environment_inner[depth] == "varlistentry")
sgmlCloseTag(ofs, depth+command_depth, sgmlCloseTag(ofs, depth+command_depth, false, environment_inner[depth]);
environment_inner[depth]);
} }
sgmlCloseTag(ofs, depth + command_depth, sgmlCloseTag(ofs, depth + command_depth, false, environment_stack[depth]);
environment_stack[depth]);
environment_stack[depth].erase(); environment_stack[depth].erase();
environment_inner[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()) { && !environment_stack[depth].empty()) {
if (environment_inner[depth] != "!-- --") { if (environment_inner[depth] != "!-- --") {
item_name= "listitem"; item_name= "listitem";
sgmlCloseTag(ofs, command_depth+depth, sgmlCloseTag(ofs, command_depth+depth, false, item_name);
item_name);
if (environment_inner[depth] == "varlistentry") if (environment_inner[depth] == "varlistentry")
sgmlCloseTag(ofs, sgmlCloseTag(ofs, depth + command_depth, false, environment_inner[depth]);
depth + command_depth,
environment_inner[depth]);
} }
sgmlCloseTag(ofs, depth + command_depth, sgmlCloseTag(ofs, depth + command_depth, false, environment_stack[depth]);
environment_stack[depth]);
environment_stack[depth].erase(); environment_stack[depth].erase();
environment_inner[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. // Write opening SGML tags.
switch (style.latextype) { switch (style.latextype) {
case LATEX_PARAGRAPH: case LATEX_PARAGRAPH:
sgmlOpenTag(ofs, depth + command_depth, sgmlOpenTag(ofs, depth + command_depth, false, style.latexname());
style.latexname());
break; break;
case LATEX_COMMAND: case LATEX_COMMAND:
@ -3352,14 +3356,14 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body)
if (cmd_depth < command_base) { if (cmd_depth < command_base) {
for (Paragraph::depth_type j = command_depth; for (Paragraph::depth_type j = command_depth;
j >= command_base; --j) { j >= command_base; --j) {
sgmlCloseTag(ofs, j, command_stack[j]); sgmlCloseTag(ofs, j, false, command_stack[j]);
ofs << endl; ofs << endl;
} }
command_depth = command_base = cmd_depth; command_depth = command_base = cmd_depth;
} else if (cmd_depth <= command_depth) { } else if (cmd_depth <= command_depth) {
for (int j = command_depth; for (int j = command_depth;
j >= int(cmd_depth); --j) { j >= int(cmd_depth); --j) {
sgmlCloseTag(ofs, j, command_stack[j]); sgmlCloseTag(ofs, j, false, command_stack[j]);
ofs << endl; ofs << endl;
} }
command_depth = cmd_depth; 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); sgmlOpenTag(ofs, depth + command_depth, false, command_name);
if (c_params.empty())
item_name = "title"; item_name = c_params.empty()?"title":c_params;
else sgmlOpenTag(ofs, depth + 1 + command_depth, false, item_name);
item_name = c_params;
sgmlOpenTag(ofs, depth + 1 + command_depth, item_name);
break; break;
case LATEX_ENVIRONMENT: case LATEX_ENVIRONMENT:
@ -3410,18 +3412,13 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body)
} }
environment_stack[depth] = style.latexname(); environment_stack[depth] = style.latexname();
environment_inner[depth] = "!-- --"; environment_inner[depth] = "!-- --";
sgmlOpenTag(ofs, depth + command_depth, sgmlOpenTag(ofs, depth + command_depth, false, environment_stack[depth]);
environment_stack[depth]);
} else { } else {
if (environment_inner[depth] != "!-- --") { if (environment_inner[depth] != "!-- --") {
item_name= "listitem"; item_name= "listitem";
sgmlCloseTag(ofs, sgmlCloseTag(ofs, command_depth + depth, false, item_name);
command_depth + depth,
item_name);
if (environment_inner[depth] == "varlistentry") if (environment_inner[depth] == "varlistentry")
sgmlCloseTag(ofs, sgmlCloseTag(ofs, depth + command_depth, false, environment_inner[depth]);
depth + command_depth,
environment_inner[depth]);
} }
} }
@ -3430,35 +3427,21 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body)
if (style.latexparam() == "CDATA") if (style.latexparam() == "CDATA")
ofs << "<![CDATA["; ofs << "<![CDATA[";
else else
sgmlOpenTag(ofs, depth + command_depth, sgmlOpenTag(ofs, depth + command_depth, false, style.latexparam());
style.latexparam());
} }
break; break;
} }
desc_on = (style.labeltype == LABEL_MANUAL); desc_on = (style.labeltype == LABEL_MANUAL);
if (desc_on) environment_inner[depth] = desc_on?"varlistentry": "listitem";
environment_inner[depth]= "varlistentry"; sgmlOpenTag(ofs, depth + 1 + command_depth, false, environment_inner[depth]);
else
environment_inner[depth]= "listitem";
sgmlOpenTag(ofs, depth + 1 + command_depth, item_name = desc_on? "term": "para";
environment_inner[depth]); sgmlOpenTag(ofs, depth + 1 + command_depth, false, item_name);
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);
}
break; break;
default: default:
sgmlOpenTag(ofs, depth + command_depth, sgmlOpenTag(ofs, depth + command_depth, false, style.latexname());
style.latexname());
break; break;
} }
@ -3469,31 +3452,27 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body)
// write closing SGML tags // write closing SGML tags
switch (style.latextype) { switch (style.latextype) {
case LATEX_COMMAND: case LATEX_COMMAND:
if (c_params.empty()) end_tag = c_params.empty()?"title":c_params;
end_tag = "title"; sgmlCloseTag(ofs, depth + command_depth, false, end_tag);
else
end_tag = c_params;
sgmlCloseTag(ofs, depth + command_depth, end_tag);
break; break;
case LATEX_ENVIRONMENT: case LATEX_ENVIRONMENT:
if (!style.latexparam().empty()) { if (!style.latexparam().empty()) {
if (style.latexparam() == "CDATA") if (style.latexparam() == "CDATA")
ofs << "]]>"; ofs << "]]>";
else else
sgmlCloseTag(ofs, depth + command_depth, sgmlCloseTag(ofs, depth + command_depth, false, style.latexparam());
style.latexparam());
} }
break; break;
case LATEX_ITEM_ENVIRONMENT: case LATEX_ITEM_ENVIRONMENT:
if (desc_on == 1) break; if (desc_on == 1) break;
end_tag= "para"; end_tag= "para";
sgmlCloseTag(ofs, depth + 1 + command_depth, end_tag); sgmlCloseTag(ofs, depth + 1 + command_depth, false, end_tag);
break; break;
case LATEX_PARAGRAPH: case LATEX_PARAGRAPH:
sgmlCloseTag(ofs, depth + command_depth, style.latexname()); sgmlCloseTag(ofs, depth + command_depth, false, style.latexname());
break; break;
default: default:
sgmlCloseTag(ofs, depth + command_depth, style.latexname()); sgmlCloseTag(ofs, depth + command_depth, false, style.latexname());
break; break;
} }
} }
@ -3503,26 +3482,23 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body)
if (!environment_stack[depth].empty()) { if (!environment_stack[depth].empty()) {
if (environment_inner[depth] != "!-- --") { if (environment_inner[depth] != "!-- --") {
item_name = "listitem"; item_name = "listitem";
sgmlCloseTag(ofs, command_depth + depth, sgmlCloseTag(ofs, command_depth + depth, false, item_name);
item_name);
if (environment_inner[depth] == "varlistentry") if (environment_inner[depth] == "varlistentry")
sgmlCloseTag(ofs, depth + command_depth, sgmlCloseTag(ofs, depth + command_depth, false, environment_inner[depth]);
environment_inner[depth]);
} }
sgmlCloseTag(ofs, depth + command_depth, sgmlCloseTag(ofs, depth + command_depth, false, environment_stack[depth]);
environment_stack[depth]);
} }
} }
for (int j = command_depth; j >= 0 ; --j) for (int j = command_depth; j >= 0 ; --j)
if (!command_stack[j].empty()) { if (!command_stack[j].empty()) {
sgmlCloseTag(ofs, j, command_stack[j]); sgmlCloseTag(ofs, j, false, command_stack[j]);
ofs << endl; ofs << endl;
} }
ofs << "\n\n"; ofs << "\n\n";
sgmlCloseTag(ofs, 0, top_element); sgmlCloseTag(ofs, 0, false, top_element);
ofs.close(); ofs.close();
// How to check for successful close // How to check for successful close
@ -3538,8 +3514,7 @@ void Buffer::simpleDocBookOnePar(ostream & os,
{ {
bool emph_flag = false; bool emph_flag = false;
LyXLayout const & style = LyXLayout const & style = textclasslist[params.textclass][par->layout()];
textclasslist[params.textclass][par->layout()];
LyXFont font_old = style.labeltype == LABEL_MANUAL ? style.labelfont : style.font; 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 ( i || desc_on != 3) {
if(style.latexparam() == "CDATA") if(style.latexparam() == "CDATA")
os << "]]>"; os << "]]>";
inset->docbook(this, os); inset->docbook(this, os, false);
if(style.latexparam() == "CDATA") if(style.latexparam() == "CDATA")
os << "<![CDATA["; os << "<![CDATA[";
} }

View File

@ -180,10 +180,10 @@ public:
void makeDocBookFile(string const & filename, void makeDocBookFile(string const & filename,
bool nice, bool only_body = false); bool nice, bool only_body = false);
/// Open SGML/XML tag. /// 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; string const & latexname) const;
/// Closes SGML/XML tag. /// 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; string const & latexname) const;
/// ///
void sgmlError(Paragraph * par, int pos, string const & message) 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_MATH,
LFUN_INSERT_MATRIX, LFUN_INSERT_MATRIX,
LFUN_GREEK, // 110 LFUN_GREEK, // 110
LFUN_MATH, // Andre' 2002-06-14
LFUN_MATH_LIMITS, LFUN_MATH_LIMITS,
LFUN_GREEK_TOGGLE, LFUN_GREEK_TOGGLE,
LFUN_MATH_DELIM, // Alejandro 180696 LFUN_MATH_DELIM, // Alejandro 180696

View File

@ -1,11 +1,47 @@
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> 2002-06-12 John Levon <moz@compsoc.man.ac.uk>
* Painter.h: * Painter.h:
* Painter.C: s/PainterBase/Painter, remove dead code * Painter.C: s/PainterBase/Painter, remove dead code
2002-06-12 Angus Leeming <leeming@lyx.org> 2002-06-12 Angus Leeming <leeming@lyx.org>
* lyx_gui.h: remove trailing semi-colon after the brace closing * lyx_gui.h: remove trailing semi-colon after the brace closing
the namespace. the namespace.
2002-06-12 John Levon <moz@compsoc.man.ac.uk> 2002-06-12 John Levon <moz@compsoc.man.ac.uk>
@ -13,15 +49,15 @@
* LyXView.h: cleanup * LyXView.h: cleanup
* LyXView.C: move init() here from xforms/ * LyXView.C: move init() here from xforms/
2002-06-12 John Levon <moz@compsoc.man.ac.uk> 2002-06-12 John Levon <moz@compsoc.man.ac.uk>
* screen.h: * screen.h:
* screen.C: change topCursorVisible() prototype * screen.C: change topCursorVisible() prototype
2002-06-12 Angus Leeming <leeming@lyx.org> 2002-06-12 Angus Leeming <leeming@lyx.org>
* font_metrics.h: remove trailing semi-colon after the brace closing * font_metrics.h: remove trailing semi-colon after the brace closing
the namespace. the namespace.
2002-06-12 John Levon <moz@compsoc.man.ac.uk> 2002-06-12 John Levon <moz@compsoc.man.ac.uk>
@ -29,34 +65,34 @@
* GUIRunTime.h: remove in favour of ... * GUIRunTime.h: remove in favour of ...
* Makefile.am: * Makefile.am:
* lyx_gui.h: ... namespace for GUI start up * lyx_gui.h: ... namespace for GUI start up
* LyXView.h: remove init(),show(),setPosition() * LyXView.h: remove init(),show(),setPosition()
2002-06-12 John Levon <moz@compsoc.man.ac.uk> 2002-06-12 John Levon <moz@compsoc.man.ac.uk>
* Menubar.C: * Menubar.C:
* Timeout.h: * Timeout.h:
* Toolbar.C: * Toolbar.C:
* LyXView.h: * LyXView.h:
* LyXView.C: some cleanup, prefer scoped_ptr * LyXView.C: some cleanup, prefer scoped_ptr
2002-06-12 John Levon <moz@compsoc.man.ac.uk> 2002-06-12 John Levon <moz@compsoc.man.ac.uk>
* screen.C: * screen.C:
* Painter.C: use workHeight() * Painter.C: use workHeight()
* WorkArea.h: remove confusing duplicate unused code * WorkArea.h: remove confusing duplicate unused code
2002-06-12 John Levon <moz@compsoc.man.ac.uk> 2002-06-12 John Levon <moz@compsoc.man.ac.uk>
* screen.h: * screen.h:
* screen.C: rename, add reset() * screen.C: rename, add reset()
2002-06-11 John Levon <moz@compsoc.man.ac.uk> 2002-06-11 John Levon <moz@compsoc.man.ac.uk>
* font_metrics.h: move X-specific stuff out of namespace * font_metrics.h: move X-specific stuff out of namespace
2002-06-07 Angus Leeming <leeming@lyx.org> 2002-06-07 Angus Leeming <leeming@lyx.org>
Fixes needed to compile with Compaq cxx 6.5. Fixes needed to compile with Compaq cxx 6.5.
@ -68,7 +104,7 @@
2002-05-31 John Levon <moz@compsoc.man.ac.uk> 2002-05-31 John Levon <moz@compsoc.man.ac.uk>
* Alert.h: better variable name * Alert.h: better variable name
2002-05-29 Lars Gullik Bjønnes <larsbj@birdstep.com> 2002-05-29 Lars Gullik Bjønnes <larsbj@birdstep.com>
* switch from SigC signals to boost::signals * switch from SigC signals to boost::signals

View File

@ -21,18 +21,296 @@
#endif #endif
#include "Dialogs.h" #include "Dialogs.h"
#include "support/LAssert.h" #include "support/LAssert.h"
#include "guiapi.h"
// Signal enabling all visible dialogs to be redrawn if so desired. // Signal enabling all visible dialogs to be redrawn if so desired.
// E.g., when the GUI colours have been remapped. // E.g., when the GUI colours have been remapped.
boost::signal0<void> Dialogs::redrawGUI; boost::signal0<void> Dialogs::redrawGUI;
extern LyXView * dialogs_lyxview;
// toggle tooltips on/off in all dialogs. // toggle tooltips on/off in all dialogs.
boost::signal0<void> Dialogs::toggleTooltips; boost::signal0<void> Dialogs::toggleTooltips;
void Dialogs::add(DialogBase * ptr) void Dialogs::showAboutlyx()
{ {
lyx::Assert(ptr); gui_ShowAboutlyx(*dialogs_lyxview, *this);
dialogs_.push_back(db_ptr(ptr));
} }
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/shared_ptr.hpp>
#include <boost/signals/signal0.hpp> #include <boost/signals/signal0.hpp>
#include <boost/signals/signal1.hpp> #include <boost/signals/signal1.hpp>
#include <boost/function.hpp>
#include <vector> #include <vector>
#ifdef __GNUG__ #ifdef __GNUG__
@ -95,101 +93,101 @@ public:
Put into some sort of alphabetical order */ Put into some sort of alphabetical order */
//@{ //@{
/// ///
boost::function<void> showAboutlyx; void showAboutlyx();
/// show the key and label of a bibliography entry /// show the key and label of a bibliography entry
boost::function<void, InsetCommand *> showBibitem; void showBibitem(InsetCommand * ic);
/// show the bibtex dialog /// 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 /// 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 /// show the external inset dialog
boost::function<void, InsetExternal *> showExternal; void showExternal(InsetExternal *);
/// show the contents of a file. /// show the contents of a file.
boost::function<void, string const &> showFile; void showFile(string const &);
/// show all forked child processes /// 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 /// 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 /// show the LaTeX log or build file
boost::function<void> showLogFile; void showLogFile();
/// display the top-level maths panel /// 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 /// bring up the spellchecker
boost::function<void> showSpellchecker; void showSpellchecker();
/// bring up the spellchecker tab in preferences /// 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 /// show the TexInfo
boost::function<void> showTexinfo; void showTexinfo();
/// show the thesaurus dialog /// 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 /// show the version control log
boost::function<void> showVCLogFile; void showVCLogFile();
//@} //@}
private: private:
/// Add a dialog to the vector of dialogs. /// Add a dialog to the vector of dialogs.
void add(DialogBase *); //void add(DialogBase *);
/// the dialogs being managed /// the dialogs being managed
std::vector<db_ptr> dialogs_; //std::vector<db_ptr> dialogs_;
}; };
#endif #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() void LyXView::init()
{ {
// Set the textclass choice
invalidateLayoutChoice();
updateLayoutChoice(); updateLayoutChoice();
updateMenubar(); updateMenubar();
@ -182,12 +180,6 @@ void LyXView::resetAutosaveTimer()
} }
void LyXView::invalidateLayoutChoice()
{
last_textclass_ = -1;
}
void LyXView::updateLayoutChoice() void LyXView::updateLayoutChoice()
{ {
// don't show any layouts without a buffer // don't show any layouts without a buffer
@ -197,12 +189,8 @@ void LyXView::updateLayoutChoice()
} }
// update the layout display // update the layout display
if (last_textclass_ != int(buffer()->params.textclass)) { if (toolbar_->updateLayoutList(buffer()->params.textclass)) {
toolbar_->updateLayoutList(true); current_layout = textclasslist[buffer()->params.textclass].defaultLayoutName();
last_textclass_ = int(buffer()->params.textclass);
current_layout = textclasslist[last_textclass_].defaultLayoutName();
} else {
toolbar_->updateLayoutList(false);
} }
string const & layout = string const & layout =

View File

@ -55,7 +55,11 @@ public:
virtual ~LyXView(); 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(); void init();
/// start modal operation /// start modal operation
@ -111,7 +115,7 @@ public:
void messagePop(); void messagePop();
/// show state (font etc.) in minibuffer /// show state (font etc.) in minibuffer
void showState(); void showState();
/// updates the title of the window /// updates the title of the window
void updateWindowTitle(); void updateWindowTitle();
@ -138,9 +142,6 @@ protected:
/// called on timeout /// called on timeout
void autoSave(); void autoSave();
/// FIXME: GUII - toolbar property
void invalidateLayoutChoice();
private: private:
/** /**
* setWindowTitle - set title of window * setWindowTitle - set title of window
@ -153,15 +154,6 @@ private:
boost::scoped_ptr<LyXFunc> lyxfunc_; boost::scoped_ptr<LyXFunc> lyxfunc_;
/// dialogs for this view /// dialogs for this view
boost::scoped_ptr<Dialogs> dialogs_; 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 #endif // LYXVIEW_H

View File

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

View File

@ -23,6 +23,7 @@ extern LyXAction lyxaction;
Toolbar::Toolbar(LyXView * o, int x, int y, ToolbarDefaults const &tbd) Toolbar::Toolbar(LyXView * o, int x, int y, ToolbarDefaults const &tbd)
: last_textclass_(-1)
{ {
pimpl_ = new Pimpl(o, x, y); 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 /// update the layout combox
void setLayout(string const & layout); 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 /// Drop down the layout list
void openLayoutList(); void openLayoutList();
/// Erase the layout list /// Erase the layout list
@ -69,5 +72,10 @@ private:
friend struct Toolbar::Pimpl; friend struct Toolbar::Pimpl;
/// ///
Pimpl * pimpl_; Pimpl * pimpl_;
/**
* The last textclass layout list in the layout choice selector
*/
int last_textclass_;
}; };
#endif #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 // -*- C++ -*-
#include "frontends/xforms/XWorkArea.h" /**
* \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> 2002-06-12 Angus Leeming <leeming@lyx.org>
* ControlParagraph.[Ch]: forward declare ParagraphParameters. * ControlParagraph.[Ch]: forward declare ParagraphParameters.
@ -7,11 +11,11 @@
* ControlInset.tmpl: add missing header file, ButtonControllerBase.h. * ControlInset.tmpl: add missing header file, ButtonControllerBase.h.
2002-06-11 Edwin Leuven <leuven@fee.uva.nl> 2002-06-11 Edwin Leuven <leuven@fee.uva.nl>
* ControlParagraph.[Ch]: new paragraph controller * ControlParagraph.[Ch]: new paragraph controller
* GUI.h: add new controller * GUI.h: add new controller
* Makefile.am: ditto * Makefile.am: ditto
2002-06-10 Lars Gullik Bjønnes <larsbj@birdstep.com> 2002-06-10 Lars Gullik Bjønnes <larsbj@birdstep.com>
* GUI.h: do not include ButtonController.tmpl * GUI.h: do not include ButtonController.tmpl

View File

@ -14,10 +14,7 @@
#pragma implementation #pragma implementation
#endif #endif
#include "ViewBase.h"
#include "ButtonControllerBase.h"
#include "ControlAboutlyx.h" #include "ControlAboutlyx.h"
#include "Dialogs.h"
#include "frontends/LyXView.h" #include "frontends/LyXView.h"
#include "Lsstream.h" #include "Lsstream.h"
#include "BufferView.h" #include "BufferView.h"
@ -25,17 +22,14 @@
#include "support/filetools.h" // FileSearch #include "support/filetools.h" // FileSearch
#include "version.h" #include "version.h"
#include <boost/bind.hpp>
// needed for the browser // needed for the browser
extern string system_lyxdir; extern string system_lyxdir;
extern string user_lyxdir; extern string user_lyxdir;
ControlAboutlyx::ControlAboutlyx(LyXView & lv, Dialogs & d) ControlAboutlyx::ControlAboutlyx(LyXView & lv, Dialogs & d)
: ControlDialogBI(lv, d) : ControlDialogBI(lv, d)
{ {}
d_.showAboutlyx = boost::bind(&ControlAboutlyx::show, this);
}
stringstream & ControlAboutlyx::getCredits(stringstream & ss) const stringstream & ControlAboutlyx::getCredits(stringstream & ss) const
@ -65,21 +59,25 @@ stringstream & ControlAboutlyx::getCredits(stringstream & ss) const
return ss; return ss;
} }
string const ControlAboutlyx::getCopyright() const string const ControlAboutlyx::getCopyright() const
{ {
return _("LyX is Copyright (C) 1995 by Matthias Ettrich,\n1995-2001 LyX Team"); return _("LyX is Copyright (C) 1995 by Matthias Ettrich,\n1995-2001 LyX Team");
} }
string const ControlAboutlyx::getLicense() const 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."); 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 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."); 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 string const ControlAboutlyx::getVersion() const
{ {
stringstream ss; stringstream ss;

View File

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

View File

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

View File

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

View File

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

View File

@ -18,30 +18,16 @@
#endif #endif
#include "ControlCitation.h" #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::vector;
using std::pair;
vector<biblio::CiteStyle> ControlCitation::citeStyles_; vector<biblio::CiteStyle> ControlCitation::citeStyles_;
ControlCitation::ControlCitation(LyXView & lv, Dialogs & d) ControlCitation::ControlCitation(LyXView & lv, Dialogs & d)
: ControlCommand(lv, d, LFUN_CITATION_INSERT) : 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() void ControlCitation::clearDaughterParams()

View File

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

View File

@ -17,31 +17,15 @@
#pragma implementation #pragma implementation
#endif #endif
#include "ViewBase.h"
#include "ButtonControllerBase.h"
#include "ControlERT.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) // sorry this is just a temporary hack we should include vspace.h! (Jug)
extern const char * stringFromUnit(int); extern const char * stringFromUnit(int);
ControlERT::ControlERT(LyXView & lv, Dialogs & d) ControlERT::ControlERT(LyXView & lv, Dialogs & d)
: ControlInset<InsetERT, ERTParams>(lv, 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() void ControlERT::applyParamsToInset()
@ -65,6 +49,7 @@ ERTParams::ERTParams()
: status(InsetERT::Collapsed) : status(InsetERT::Collapsed)
{} {}
ERTParams::ERTParams(InsetERT const & inset) ERTParams::ERTParams(InsetERT const & inset)
: status(inset.status()) : status(inset.status())
{} {}

View File

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

View File

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

View File

@ -16,30 +16,11 @@
#endif #endif
#include "ControlFloat.h" #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) ControlFloat::ControlFloat(LyXView & lv, Dialogs & d)
: ControlInset<InsetFloat, FloatParams>(lv, 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() void ControlFloat::applyParamsToInset()

View File

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

View File

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

View File

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

View File

@ -18,18 +18,8 @@
#endif #endif
#include "ControlIndex.h" #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) ControlIndex::ControlIndex(LyXView & lv, Dialogs & d)
: ControlCommand(lv, d, LFUN_INDEX_INSERT) : 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 "buffer.h"
#include "debug.h" #include "debug.h"
#include "frontends/LyXView.h" #include "frontends/LyXView.h"
#include "insets/insetfloat.h"
#include "insets/insetgraphics.h"
#include "support/LAssert.h" #include "support/LAssert.h"
#include <boost/bind.hpp> #include <boost/bind.hpp>
template <class Inset, class Params> template <class Inset, class Params>

View File

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

View File

@ -18,29 +18,12 @@
#endif #endif
#include "ControlMinipage.h" #include "ControlMinipage.h"
#include "ViewBase.h"
#include "ButtonControllerBase.h"
#include "Dialogs.h"
#include "frontends/LyXView.h"
#include "buffer.h"
#include "BufferView.h" #include "BufferView.h"
#include "helper_funcs.h"
#include <boost/bind.hpp>
using std::vector;
ControlMinipage::ControlMinipage(LyXView & lv, Dialogs & d) ControlMinipage::ControlMinipage(LyXView & lv, Dialogs & d)
: ControlInset<InsetMinipage, MinipageParams>(lv, 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() void ControlMinipage::applyParamsToInset()

View File

@ -13,11 +13,9 @@
#pragma implementation #pragma implementation
#endif #endif
#include "ViewBase.h"
#include "ButtonControllerBase.h"
#include "ControlParagraph.h" #include "ControlParagraph.h"
#include "ViewBase.h"
#include "ParagraphParameters.h" #include "ParagraphParameters.h"
#include "Dialogs.h"
#include "Liason.h" #include "Liason.h"
#include "LyXView.h" #include "LyXView.h"
#include "BufferView.h" #include "BufferView.h"
@ -27,16 +25,12 @@
#include "lyxtextclasslist.h" #include "lyxtextclasslist.h"
#include "support/LAssert.h" #include "support/LAssert.h"
#include <boost/bind.hpp>
using Liason::setMinibuffer; using Liason::setMinibuffer;
ControlParagraph::ControlParagraph(LyXView & lv, Dialogs & d) ControlParagraph::ControlParagraph(LyXView & lv, Dialogs & d)
: ControlDialogBD(lv, d), pp_(0), ininset_(false) : ControlDialogBD(lv, d), pp_(0), ininset_(false)
{ {}
d_.showParagraph = boost::bind(&ControlParagraph::show, this);
}
ControlParagraph::~ControlParagraph() ControlParagraph::~ControlParagraph()
@ -83,13 +77,13 @@ void ControlParagraph::apply()
pp_->noindent()); pp_->noindent());
// Actually apply these settings // Actually apply these settings
lv_.view()->update(text, lv_.view()->update(text,
BufferView::SELECT | BufferView::SELECT |
BufferView::FITCUR | BufferView::FITCUR |
BufferView::CHANGE); BufferView::CHANGE);
lv_.buffer()->markDirty(); lv_.buffer()->markDirty();
setMinibuffer(&lv_, _("Paragraph layout set")); setMinibuffer(&lv_, _("Paragraph layout set"));
} }
@ -101,13 +95,13 @@ void ControlParagraph::setParams()
/// get paragraph /// get paragraph
Paragraph const * par_ = lv_.view()->getLyXText()->cursor.par(); Paragraph const * par_ = lv_.view()->getLyXText()->cursor.par();
/// Set the paragraph parameters /// Set the paragraph parameters
*pp_ = par_->params(); *pp_ = par_->params();
/// this needs to be done separately /// this needs to be done separately
pp_->labelWidthString(par_->getLabelWidthString()); pp_->labelWidthString(par_->getLabelWidthString());
/// alignment /// alignment
LyXTextClass const & tclass = LyXTextClass const & tclass =
textclasslist[lv_.view()->buffer()->params.textclass]; textclasslist[lv_.view()->buffer()->params.textclass];
@ -118,5 +112,5 @@ void ControlParagraph::setParams()
alignpos_ = tclass[par_->layout()].alignpossible; alignpos_ = tclass[par_->layout()].alignpossible;
/// is paragraph in inset /// is paragraph in inset
ininset_ = par_->inInset(); ininset_ = par_->inInset();
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -18,33 +18,19 @@
#endif #endif
#include "ControlRef.h" #include "ControlRef.h"
#include "ViewBase.h"
#include "ButtonControllerBase.h"
#include "Dialogs.h"
#include "buffer.h"
#include "lyxfunc.h" #include "lyxfunc.h"
#include "bufferlist.h" #include "bufferlist.h"
#include "debug.h"
#include "frontends/LyXView.h"
#include "support/filetools.h" // MakeAbsPath, MakeDisplayPath #include "support/filetools.h" // MakeAbsPath, MakeDisplayPath
#include <boost/bind.hpp>
#include <algorithm>
using std::vector; using std::vector;
using std::find;
extern BufferList bufferlist; extern BufferList bufferlist;
ControlRef::ControlRef(LyXView & lv, Dialogs & d) ControlRef::ControlRef(LyXView & lv, Dialogs & d)
: ControlCommand(lv, d, LFUN_REF_INSERT) : 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 vector<string> const ControlRef::getLabelList(string const & name) const

View File

@ -18,13 +18,9 @@
#endif #endif
#include "ControlSearch.h" #include "ControlSearch.h"
#include "ViewBase.h"
#include "ButtonControllerBase.h"
#include "Dialogs.h"
#include "Liason.h" #include "Liason.h"
#include "buffer.h" #include "buffer.h"
#include "lyxfind.h" #include "lyxfind.h"
#include "debug.h"
#include "gettext.h" #include "gettext.h"
#include "BufferView.h" #include "BufferView.h"
@ -32,26 +28,20 @@
#include "support/lstrings.h" #include "support/lstrings.h"
#include <boost/bind.hpp>
using Liason::setMinibuffer; using Liason::setMinibuffer;
ControlSearch::ControlSearch(LyXView & lv, Dialogs & d) ControlSearch::ControlSearch(LyXView & lv, Dialogs & d)
: ControlDialogBD(lv, 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, void ControlSearch::find(string const & search,
bool casesensitive, bool matchword, bool forward) const bool casesensitive, bool matchword, bool forward) const
{ {
bool const found = LyXFind(lv_.view(), search, bool const found = lyxfind::LyXFind(lv_.view(), search,
forward, false, casesensitive, matchword); forward, casesensitive,
matchword);
if (!found) if (!found)
setMinibuffer(&lv_, _("String not 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 // move on to the next instance once the present instance has been
// changed // changed
bool const once = !all; bool const once = !all;
int const replace_count = LyXReplace(lv_.view(), int const replace_count =
search, replace, true, casesensitive, lyxfind::LyXReplace(lv_.view(),
matchword, all, once); search, replace, true, casesensitive,
matchword, all, once);
if (replace_count == 0) { if (replace_count == 0) {
setMinibuffer(&lv_, _("String not found!")); setMinibuffer(&lv_, _("String not found!"));

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -18,28 +18,20 @@
#endif #endif
#include "ControlToc.h" #include "ControlToc.h"
#include "ViewBase.h"
#include "ButtonControllerBase.h"
#include "buffer.h" #include "buffer.h"
#include "Dialogs.h" #include "Dialogs.h"
#include "lyxfunc.h" #include "lyxfunc.h"
#include "gettext.h" #include "gettext.h"
#include "BufferView.h" #include "BufferView.h"
#include "frontends/LyXView.h"
#include "support/lstrings.h" // tostr #include "support/lstrings.h" // tostr
#include <boost/bind.hpp>
using std::vector; using std::vector;
ControlToc::ControlToc(LyXView & lv, Dialogs & d) ControlToc::ControlToc(LyXView & lv, Dialogs & d)
: ControlCommand(lv, d, LFUN_TOC_INSERT) : 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 void ControlToc::Goto(int const & id) const

View File

@ -18,18 +18,8 @@
#endif #endif
#include "ControlUrl.h" #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) ControlUrl::ControlUrl(LyXView & lv, Dialogs & d)
: ControlCommand(lv, d, LFUN_INSERT_URL) : 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 "ControlVCLog.h"
#include "Lsstream.h" #include "Lsstream.h"
#include "ViewBase.h"
#include "ButtonControllerBase.h" #include "ButtonControllerBase.h"
#include "buffer.h" #include "buffer.h"
#include "BufferView.h" #include "BufferView.h"
#include "Dialogs.h"
#include "lyxrc.h" #include "lyxrc.h"
#include "gettext.h" #include "gettext.h"
@ -32,17 +30,15 @@
#include "support/lyxlib.h" #include "support/lyxlib.h"
#include <boost/bind.hpp>
#include <fstream> #include <fstream>
using std::endl; using std::endl;
ControlVCLog::ControlVCLog(LyXView & lv, Dialogs & d) ControlVCLog::ControlVCLog(LyXView & lv, Dialogs & d)
: ControlDialogBD(lv, d) : ControlDialogBD(lv, d)
{ {}
d_.showVCLogFile = boost::bind(&ControlVCLog::show, this);
}
string const ControlVCLog::getBufferFileName() const string const ControlVCLog::getBufferFileName() const
{ {

View File

@ -11,38 +11,7 @@
#define GUI_H #define GUI_H
#include "ButtonController.h" #include "ButtonController.h"
#include "ButtonPolicies.h" #include "ViewBase.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"
/** This class instantiates and makes available the GUI-specific /** This class instantiates and makes available the GUI-specific
ButtonController and View. ButtonController and View.
@ -57,6 +26,45 @@ public:
/// ///
virtual ViewBase & view() { return view_; } 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: private:
/// ///
ButtonController<Policy, GUIbc> bc_; ButtonController<Policy, GUIbc> bc_;
@ -64,357 +72,4 @@ private:
GUIview view_; 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 #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,284 +1,87 @@
/* This file is part of /**
* ====================================================== * \file screen.C
* * Copyright 2002 the LyX Team
* LyX, The Document Processor * Read the file COPYING
* *
* Copyright 1995 Matthias Ettrich * \author John Levon <moz@compsoc.man.ac.uk>
* Copyright 1995-1998 The LyX Team */
*
* ====================================================== */
#include <config.h>
#ifdef __GNUG__ #ifdef __GNUG__
#pragma implementation #pragma implementation
#endif #endif
#include <algorithm> #include <config.h>
#include "screen.h" #include "screen.h"
#include "lyxtext.h" #include "lyxtext.h"
#include "lyxrow.h" #include "lyxrow.h"
#include "frontends/Painter.h"
#include "frontends/WorkArea.h"
#include "buffer.h"
#include "BufferView.h" #include "BufferView.h"
#include "buffer.h"
#include "WorkArea.h"
#include "Painter.h"
#include "font_metrics.h" #include "font_metrics.h"
#include "insets/insettext.h"
#include "frontends/xforms/ColorHandler.h"
#include "language.h" #include "language.h"
#include "debug.h"
using std::max;
using std::min; using std::min;
using std::max;
namespace { using std::endl;
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
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()
{
XFreeGC(fl_get_display(), gc_copy);
}
void LScreen::reset()
{
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;
// We need this GC
gc_copy = createGC();
}
LyXScreen::LyXScreen()
: force_clear_(true), cursor_visible_(false)
{
}
LyXScreen::~LyXScreen()
{
}
// FIXME: GUII these cursor methods need to decide
// whether the workarea is focused or not
void LyXScreen::showCursor(LyXText const * text, BufferView const * bv)
{
if (cursor_visible_)
return;
void LScreen::setCursorColor() workarea().getPainter().start();
{
if (!lyxColorHandler.get()) return; Cursor_Shape shape = BAR_SHAPE;
BufferParams const & bp(bv->buffer()->params);
LyXFont const & realfont(text->real_current_font);
GC gc = lyxColorHandler->getGCForeground(LColor::cursor); if (realfont.language() != bp.language
|| realfont.isVisibleRightToLeft()
XGCValues val; != bp.language->RightToLeft()) {
XGetGCValues(fl_get_display(), shape = (realfont.isVisibleRightToLeft())
gc, GCForeground, &val); ? REVERSED_L_SHAPE : L_SHAPE;
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();
} }
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) bool LyXScreen::fitManualCursor(BufferView * bv, LyXText * text,
{ int /*x*/, int y, int asc, int desc)
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)
{ {
int const vheight = workarea().workHeight();
int newtop = text->first_y; int newtop = text->first_y;
if (y + desc - text->first_y >= static_cast<int>(owner.workHeight())) if (y + desc - text->first_y >= vheight)
newtop = y - 3 * owner.workHeight() / 4; // the scroll region must be so big!! newtop = y - 3 * vheight / 4; // the scroll region must be so big!!
else if (y - asc < text->first_y else if (y - asc < text->first_y
&& text->first_y > 0) { && text->first_y > 0) {
newtop = y - owner.workHeight() / 4; newtop = y - vheight / 4;
} }
newtop = max(newtop, 0); // can newtop ever be < 0? (Lgb) newtop = max(newtop, 0); // can newtop ever be < 0? (Lgb)
if (newtop != text->first_y) { if (newtop != text->first_y) {
draw(text, bv, newtop); draw(text, bv, newtop);
text->first_y = newtop; text->first_y = newtop;
@ -288,124 +91,26 @@ bool LScreen::fitManualCursor(LyXText * text, BufferView * bv,
} }
void LScreen::showManualCursor(LyXText const * text, int x, int y, void LyXScreen::cursorToggle(BufferView * bv) const
int asc, int desc, Cursor_Shape shape)
{ {
// Update the cursor color. if (cursor_visible_)
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)
bv->hideCursor(); bv->hideCursor();
else else
bv->showCursor(); bv->showCursor();
} }
/* returns a new top so that the cursor is visible */ unsigned int LyXScreen::topCursorVisible(LyXCursor const & cursor, int top_y)
unsigned int LScreen::topCursorVisible(LyXCursor const & cursor, int top_y)
{ {
int const vheight = owner.workHeight(); int const vheight = workarea().workHeight();
int newtop = top_y; int newtop = top_y;
Row * row = cursor.row(); Row * row = cursor.row();
// Is this a hack? Yes, probably... (Lgb) // Is this a hack? Yes, probably... (Lgb)
if (!row) if (!row)
return max(newtop, 0); return max(newtop, 0);
if (cursor.y() - row->baseline() + row->height() if (cursor.y() - row->baseline() + row->height()
- top_y >= vheight) { - top_y >= vheight) {
if (row->height() < vheight if (row->height() < vheight
@ -418,8 +123,8 @@ unsigned int LScreen::topCursorVisible(LyXCursor const & cursor, int top_y)
newtop = cursor.y() newtop = cursor.y()
- vheight / 2; /* the scroll region must be so big!! */ - 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) { top_y && top_y > 0) {
if (row->height() < vheight if (row->height() < vheight
&& row->height() > vheight / 4) { && 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. bool LyXScreen::fitCursor(LyXText * text, BufferView * bv)
* returns true if a change was made, otherwise false */
bool LScreen::fitCursor(LyXText * text, BufferView * bv)
{ {
// Is a change necessary? // Is a change necessary?
int const newtop = topCursorVisible(text->cursor, text->first_y); int const newtop = topCursorVisible(text->cursor, text->first_y);
@ -449,28 +152,33 @@ bool LScreen::fitCursor(LyXText * text, BufferView * bv)
return result; return result;
} }
void LScreen::update(LyXText * text, BufferView * bv, void LyXScreen::update(LyXText * text, BufferView * bv,
int y_offset, int x_offset) int yo, int xo)
{ {
int const vwidth = workarea().workWidth();
int const vheight = workarea().workHeight();
workarea().getPainter().start();
switch (text->status()) { switch (text->status()) {
case LyXText::NEED_MORE_REFRESH: case LyXText::NEED_MORE_REFRESH:
{ {
int const y = max(int(text->refresh_y - text->first_y), 0); 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; text->refresh_y = 0;
// otherwise this is called ONLY from BufferView_pimpl(update) // otherwise this is called ONLY from BufferView_pimpl(update)
// or we should see to set this flag accordingly // or we should see to set this flag accordingly
if (text != bv->text) if (text != bv->text)
text->status(bv, LyXText::UNCHANGED); text->status(bv, LyXText::UNCHANGED);
expose(0, y, owner.workWidth(), owner.workHeight() - y); expose(0, y, vwidth, vheight - y);
} }
break; break;
case LyXText::NEED_VERY_LITTLE_REFRESH: case LyXText::NEED_VERY_LITTLE_REFRESH:
{ {
// ok I will update the current cursor row // ok I will update the current cursor row
drawOneRow(text, bv, text->refresh_row, text->refresh_y, 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 // this because if we had a major update the refresh_row could
// have been set to 0! // have been set to 0!
if (text->refresh_row) { if (text->refresh_row) {
@ -478,8 +186,8 @@ void LScreen::update(LyXText * text, BufferView * bv,
// or we should see to set this flag accordingly // or we should see to set this flag accordingly
if (text != bv->text) if (text != bv->text)
text->status(bv, LyXText::UNCHANGED); text->status(bv, LyXText::UNCHANGED);
expose(0, text->refresh_y - text->first_y + y_offset, expose(0, text->refresh_y - text->first_y + yo,
owner.workWidth(), text->refresh_row->height()); vwidth, text->refresh_row->height());
} }
} }
break; break;
@ -488,12 +196,14 @@ void LScreen::update(LyXText * text, BufferView * bv,
// Nothing needs done // Nothing needs done
break; break;
} }
workarea().getPainter().end();
} }
void LScreen::toggleSelection(LyXText * text, BufferView * bv, void LyXScreen::toggleSelection(LyXText * text, BufferView * bv,
bool kill_selection, bool kill_selection,
int y_offset, int x_offset) int yo, int xo)
{ {
// only if there is a selection // only if there is a selection
if (!text->selection.set()) return; if (!text->selection.set()) return;
@ -503,45 +213,140 @@ void LScreen::toggleSelection(LyXText * text, BufferView * bv,
- text->selection.end.row()->baseline() - text->selection.end.row()->baseline()
+ text->selection.end.row()->height()), + text->selection.end.row()->height()),
text->first_y), text->first_y),
static_cast<int>(text->first_y + owner.workHeight())); static_cast<int>(text->first_y + workarea().workHeight()));
int const top = min( int const top = min(
max(static_cast<int>(text->selection.start.y() - max(static_cast<int>(text->selection.start.y() -
text->selection.start.row()->baseline()), text->selection.start.row()->baseline()),
text->first_y), text->first_y),
static_cast<int>(text->first_y + owner.workHeight())); static_cast<int>(text->first_y + workarea().workHeight()));
if (kill_selection) if (kill_selection)
text->selection.set(false); text->selection.set(false);
workarea().getPainter().start();
drawFromTo(text, bv, top - text->first_y, bottom - text->first_y, drawFromTo(text, bv, top - text->first_y, bottom - text->first_y,
y_offset, x_offset); yo, xo);
expose(0, top - text->first_y, expose(0, top - text->first_y,
owner.workWidth(), workarea().workWidth(),
bottom - text->first_y - (top - text->first_y)); bottom - text->first_y - (top - text->first_y));
workarea().getPainter().end();
} }
void LScreen::toggleToggle(LyXText * text, BufferView * bv, void LyXScreen::toggleToggle(LyXText * text, BufferView * bv,
int y_offset, int x_offset) int yo, int xo)
{ {
if (text->toggle_cursor.par() == text->toggle_end_cursor.par() if (text->toggle_cursor.par() == text->toggle_end_cursor.par()
&& text->toggle_cursor.pos() == text->toggle_end_cursor.pos()) && text->toggle_cursor.pos() == text->toggle_end_cursor.pos())
return; return;
int const top_tmp = text->toggle_cursor.y() int const top_tmp = text->toggle_cursor.y()
- text->toggle_cursor.row()->baseline(); - text->toggle_cursor.row()->baseline();
int const bottom_tmp = text->toggle_end_cursor.y() int const bottom_tmp = text->toggle_end_cursor.y()
- text->toggle_end_cursor.row()->baseline() - text->toggle_end_cursor.row()->baseline()
+ text->toggle_end_cursor.row()->height(); + 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), 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), 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, drawFromTo(text, bv, top - text->first_y,
bottom - text->first_y, y_offset, bottom - text->first_y, yo,
x_offset); xo);
expose(0, top - text->first_y, owner.workWidth(), expose(0, top - text->first_y, workarea().workWidth(),
bottom - text->first_y - (top - text->first_y)); 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

@ -6,29 +6,25 @@
* *
* \author unknown * \author unknown
* \author John Levon <moz@compsoc.man.ac.uk> * \author John Levon <moz@compsoc.man.ac.uk>
*/ */
#ifndef LYXSCREEN_H #ifndef SCREEN_H
#define LYXSCREEN_H #define SCREEN_H
#ifdef __GNUG__ #ifdef __GNUG__
#pragma interface #pragma interface
#endif #endif
#include <X11/Xlib.h>
class LyXText; class LyXText;
class LyXCursor; class LyXCursor;
class WorkArea; class WorkArea;
class Buffer;
class BufferView; class BufferView;
struct Row; struct Row;
/** /**
* LScreen - document rendering management * LyXScreen - document rendering management
* *
* This class is used to manage the on-screen rendering inside the * This class is used to manage the on-screen rendering inside the
* work area; it is responsible for deciding which LyXText rows * work area; it is responsible for deciding which LyXText rows
* need re-drawing. * need re-drawing.
* *
@ -37,36 +33,66 @@ struct Row;
* *
* The blinking cursor is also handled here. * The blinking cursor is also handled here.
*/ */
class LScreen { class LyXScreen {
public: public:
/// /// types of cursor in work area
enum Cursor_Shape { enum Cursor_Shape {
/// /// normal I-beam
BAR_SHAPE, BAR_SHAPE,
/// /// L-shape for locked insets of a different language
L_SHAPE, L_SHAPE,
/// /// reverse L-shape for RTL text
REVERSED_L_SHAPE REVERSED_L_SHAPE
}; };
/// LyXScreen();
LScreen(WorkArea &);
/// virtual ~LyXScreen();
~LScreen();
/**
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;
/**
* 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;
/// unpaint the cursor painted by showManualCursor()
virtual void hideCursor() = 0;
/**
* 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 *);
/// Sets the cursor color to LColor::cursor.
void setCursorColor();
/** Draws the screen form textposition y. Uses as much of
the already printed pixmap as possible */
void draw(LyXText *, BufferView *, unsigned int y);
/// Redraws the screen, without using existing pixmap
void redraw(LyXText *, BufferView *);
/** /**
* topCursorVisible - get a new "top" to make the cursor visible * topCursorVisible - get a new "top" to make the cursor visible
* @param c the cursor * @param c the cursor
@ -75,70 +101,71 @@ public:
* This helper function calculates a new y co-ordinate for * This helper function calculates a new y co-ordinate for
* the top of the containing region such that the cursor contained * the top of the containing region such that the cursor contained
* within the LyXText is "nicely" visible. * 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 *); * fitCursor - fit the cursor onto the work area
/// * @param text the text containing the cursor
void showCursor(LyXText const *, BufferView const *); * @param bv the bufferview
/// * @return true if a change was necessary
void hideCursor(); *
/// * Scrolls the screen so that the cursor is visible,
void cursorToggle(BufferView *) const; */
/// virtual bool fitCursor(LyXText *, BufferView *);
void showManualCursor(LyXText const *, int x, int y,
int asc, int desc, /// show the cursor if it's not, and vice versa
Cursor_Shape shape); virtual void cursorToggle(BufferView *) const;
/// returns 1 if first has changed, otherwise 0
bool fitManualCursor(LyXText *, BufferView *, int, int, int, int); /**
/// * update - update part of the screen rendering
void toggleSelection(LyXText *, BufferView *, bool = true, * @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); 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); int y_offset = 0, int x_offset = 0);
/// FIXME
virtual bool forceClear() const { return force_clear_; }
/** Updates part of the screen. If text->status is protected:
LyXText::NEED_MORE_REFRESH, we update from the /// copies specified area of pixmap to screen
point of change and to the end of the screen. virtual void expose(int x, int y, int exp_width, int exp_height) = 0;
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; }
///
bool cursor_visible;
private:
/// Copies specified area of pixmap to screen
void expose(int x, int y, int exp_width, int exp_height);
/// get the work area
virtual WorkArea & workarea() const = 0;
/// y1 and y2 are coordinates of the screen /// y1 and y2 are coordinates of the screen
void drawFromTo(LyXText *, BufferView *, int y1, int y2, virtual void drawFromTo(LyXText *, BufferView *, int y1, int y2,
int y_offset = 0, int x_offset = 0, bool internal=false); int y_offset = 0, int x_offset = 0, bool internal = false);
/// y is a coordinate of the text /// 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); int y_text, int y_offset = 0, int x_offset = 0);
/// /// grey out (no buffer)
WorkArea & owner; void greyOut();
/// /// FIXME ?
Pixmap cursor_pixmap; bool force_clear_;
///
int cursor_pixmap_x; /// is the blinking cursor currently drawn
/// bool cursor_visible_;
int cursor_pixmap_y;
///
int cursor_pixmap_w;
///
int cursor_pixmap_h;
///
GC gc_copy;
///
bool force_clear;
}; };
#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> 2002-06-14 Angus Leeming <leeming@lyx.org>
@ -59,18 +86,18 @@
* xforms_helpers.[Ch]: removed scex, idex functions. * xforms_helpers.[Ch]: removed scex, idex functions.
* Most other files: minor changes associated with the above. * Most other files: minor changes associated with the above.
2002-06-12 John Levon <moz@compsoc.man.ac.uk> 2002-06-12 John Levon <moz@compsoc.man.ac.uk>
* XWorkArea.h: * XWorkArea.h:
* XWorkArea.C: move scrolling logic into here * XWorkArea.C: move scrolling logic into here
* ColorHandler.h: * ColorHandler.h:
* ColorHandler.C: * ColorHandler.C:
* XPainter.h: * XPainter.h:
* XPainter.C: remove unused stuff, s/PainterBase/Painter/, * XPainter.C: remove unused stuff, s/PainterBase/Painter/,
s/Painter/XPainter/ s/Painter/XPainter/
2002-06-12 Angus Leeming <leeming@lyx.org> 2002-06-12 Angus Leeming <leeming@lyx.org>
* lyx_gui.C (parse_init): exit isn't in namespace lyx_gui! * lyx_gui.C (parse_init): exit isn't in namespace lyx_gui!
@ -82,7 +109,7 @@
2002-05-24 Martin Vermeer <martin.vermeer@hut.fi> 2002-05-24 Martin Vermeer <martin.vermeer@hut.fi>
* FormMathsDelim.C: fix delimiter pre-display rendering * FormMathsDelim.C: fix delimiter pre-display rendering
mess-up bug (354) mess-up bug (354)
2002-06-12 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr> 2002-06-12 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
@ -93,7 +120,7 @@
* XFormsView.h: * XFormsView.h:
* XFormsView.C: move init() back to LyXView * XFormsView.C: move init() back to LyXView
2002-06-12 John Levon <moz@compsoc.man.ac.uk> 2002-06-12 John Levon <moz@compsoc.man.ac.uk>
* GUIRunTime.C: remove in favour of ... * GUIRunTime.C: remove in favour of ...
@ -103,26 +130,26 @@
* XFormsView.h: * XFormsView.h:
* XFormsView.C: change show() prototype * XFormsView.C: change show() prototype
* XPainter.C: * XPainter.C:
* xfont_loader.C: don't use GUIRunTime any more * xfont_loader.C: don't use GUIRunTime any more
2002-06-12 John Levon <moz@compsoc.man.ac.uk> 2002-06-12 John Levon <moz@compsoc.man.ac.uk>
* ColorHandler.C: * ColorHandler.C:
* FontInfo.h: * FontInfo.h:
* FormBase.C: * FormBase.C:
* FormBaseDeprecated.C: * FormBaseDeprecated.C:
* MathsSymbols.C: * MathsSymbols.C:
* Menubar_pimpl.C: minor cleanups * Menubar_pimpl.C: minor cleanups
2002-06-12 John Levon <moz@compsoc.man.ac.uk> 2002-06-12 John Levon <moz@compsoc.man.ac.uk>
* xformsGImage.C: * xformsGImage.C:
* FontInfo.h: * FontInfo.h:
* FontInfo.C: some cleanup * FontInfo.C: some cleanup
* XWorkArea.C: * XWorkArea.C:
* XFormsView.h: * XFormsView.h:
* XFormsView.C: some minor cleanup, use of * XFormsView.C: some minor cleanup, use of
scoped_ptr scoped_ptr
@ -134,12 +161,12 @@
* XWorkArea.h: * XWorkArea.h:
* XWorkArea.C: use workHeight(), remove enter/leaveView * XWorkArea.C: use workHeight(), remove enter/leaveView
2002-06-11 John Levon <moz@compsoc.man.ac.uk> 2002-06-11 John Levon <moz@compsoc.man.ac.uk>
* XWorkArea.h: * XWorkArea.h:
* XWorkArea.C: remove belowMouse() and active() * XWorkArea.C: remove belowMouse() and active()
2002-06-11 John Levon <moz@compsoc.man.ac.uk> 2002-06-11 John Levon <moz@compsoc.man.ac.uk>
* xfont_metrics.h: * xfont_metrics.h:
@ -147,11 +174,11 @@
* XPainter.C: X-specific metrics stuff moved into xforms/ only * XPainter.C: X-specific metrics stuff moved into xforms/ only
2002-06-11 Edwin Leuven <leuven@fee.uva.nl> 2002-06-11 Edwin Leuven <leuven@fee.uva.nl>
* FormParagraph.[Ch]: moved to mvc * FormParagraph.[Ch]: moved to mvc
* form_paragraph.[Ch]: idem * form_paragraph.[Ch]: idem
* forms/form_paragraph.fd: idem * forms/form_paragraph.fd: idem
* Dialogs.C: idem * Dialogs.C: idem
2002-06-06 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr> 2002-06-06 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
@ -166,7 +193,7 @@
* xformsGImage.h: use FLIMAGE_H_LOCATION to include flimage.h. * xformsGImage.h: use FLIMAGE_H_LOCATION to include flimage.h.
2002-06-10 Lars Gullik Bjønnes <larsbj@birdstep.com> 2002-06-10 Lars Gullik Bjønnes <larsbj@birdstep.com>
* FormMathsPanel.C: do not include ButtonController.tmpl * FormMathsPanel.C: do not include ButtonController.tmpl
* FormPreferences.C: ditto * FormPreferences.C: ditto
* xformsBC.C: ditto * xformsBC.C: ditto
@ -190,11 +217,11 @@
2002-06-04 John Levon <moz@compsoc.man.ac.uk> 2002-06-04 John Levon <moz@compsoc.man.ac.uk>
* xformsGImage.h: an xforms build fix * xformsGImage.h: an xforms build fix
2002-06-02 Michael A. Koziarski <michael@koziarski.com> 2002-06-02 Michael A. Koziarski <michael@koziarski.com>
* Tooltips.C: fix some sigc++ -> boost errors. * Tooltips.C: fix some sigc++ -> boost errors.
2002-06-02 John Levon <moz@compsoc.man.ac.uk> 2002-06-02 John Levon <moz@compsoc.man.ac.uk>
* GUIRunTime.C: * GUIRunTime.C:
@ -206,7 +233,7 @@
2002-05-10 Herbert Voss <voss@perce.de> 2002-05-10 Herbert Voss <voss@perce.de>
* FormInclude.C (input, update): disable load-button when * FormInclude.C (input, update): disable load-button when
"use verbatim" is enabled "use verbatim" is enabled
2002-05-30 Lars Gullik Bjønnes <larsbj@birdstep.com> 2002-05-30 Lars Gullik Bjønnes <larsbj@birdstep.com>

View File

@ -14,76 +14,11 @@
#endif #endif
#include "Dialogs.h" #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" #include "Tooltips.h"
LyXView * dialogs_lyxview;
/// Are the tooltips on or off? /// Are the tooltips on or off?
bool Dialogs::tooltipsEnabled() bool Dialogs::tooltipsEnabled()
{ {
@ -93,72 +28,9 @@ bool Dialogs::tooltipsEnabled()
Dialogs::Dialogs(LyXView * lv) Dialogs::Dialogs(LyXView * lv)
{ {
add(new GUI<ControlAboutlyx, FormAboutlyx, #if 1
OkCancelPolicy, xformsBC>(*lv, *this)); dialogs_lyxview = lv;
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));
#endif #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 // reduce the number of connections needed in
// dialogs by a simple connection here. // dialogs by a simple connection here.
hideAll.connect(hideBufferDependent); hideAll.connect(hideBufferDependent);

View File

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

View File

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

View File

@ -62,10 +62,12 @@ FormDocument::FormDocument(LyXView * lv, Dialogs * d)
ActCell(0), Confirmed(0), ActCell(0), Confirmed(0),
current_bullet_panel(0), current_bullet_depth(0), fbullet(0) current_bullet_panel(0), current_bullet_depth(0), fbullet(0)
{ {
#if 0
// let the dialog be shown // let the dialog be shown
// This is a permanent connection so we won't bother // This is a permanent connection so we won't bother
// storing a copy because we won't be disconnecting. // storing a copy because we won't be disconnecting.
d->showDocument = boost::bind(&FormDocument::show, this); 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)); ams_ops_.reset(new FormMathsBitmap(lv, d, *this, _("AMS Operators"), latex));
//showUnderMouse(false); //showUnderMouse(false);
#if 0
d->showMathPanel = boost::bind(&FormMathsPanel::show, this); d->showMathPanel = boost::bind(&FormMathsPanel::show, this);
#endif
} }

View File

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

View File

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

View File

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

View File

@ -17,7 +17,6 @@
#include "ControlRef.h" #include "ControlRef.h"
#include "FormRef.h" #include "FormRef.h"
#include "forms/form_ref.h" #include "forms/form_ref.h"
#include "Tooltips.h"
#include "xforms_helpers.h" #include "xforms_helpers.h"
#include "insets/insetref.h" #include "insets/insetref.h"
#include "helper_funcs.h" // getStringFromVector #include "helper_funcs.h" // getStringFromVector
@ -63,25 +62,6 @@ void FormRef::build()
bc().addReadOnly(dialog_->button_update); bc().addReadOnly(dialog_->button_update);
bc().addReadOnly(dialog_->input_name); bc().addReadOnly(dialog_->input_name);
bc().addReadOnly(dialog_->input_ref); 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 "gettext.h"
#include FORMS_H_LOCATION #include FORMS_H_LOCATION
FormShowFile::FormShowFile(ControlShowFile & c) FormShowFile::FormShowFile(ControlShowFile & c)
: FormCB<ControlShowFile, FormBrowser>(c, string()) : FormCB<ControlShowFile, FormBrowser>(c, string())
{} {}

View File

@ -39,15 +39,17 @@ using std::bind2nd;
using std::remove_if; using std::remove_if;
FormTabular::FormTabular(LyXView * lv, Dialogs * d) FormTabular::FormTabular(LyXView & lv, Dialogs & d)
: FormInset(lv, d, _("Tabular Layout")), : FormInset(&lv, &d, _("Tabular Layout")),
inset_(0), actCell_(-1), closing_(false) inset_(0), actCell_(-1), closing_(false)
{ {
#if 0
// let the dialog be shown // let the dialog be shown
// This is a permanent connection so we won't bother // This is a permanent connection so we won't bother
// storing a copy because we won't be disconnecting. // storing a copy because we won't be disconnecting.
d->showTabular = boost::bind(&FormTabular::showInset, this, _1); d->showTabular = boost::bind(&FormTabular::showInset, this, _1);
d->updateTabular = boost::bind(&FormTabular::updateInset, 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 { class FormTabular : public FormInset {
public: public:
friend void gui_ShowTabular(InsetTabular *, LyXView &, Dialogs &);
friend void gui_UpdateTabular(InsetTabular *, LyXView &, Dialogs &);
/// #FormTabular x(LyXFunc ..., Dialogs ...);# /// #FormTabular x(LyXFunc ..., Dialogs ...);#
FormTabular(LyXView *, Dialogs *); FormTabular(LyXView &, Dialogs &);
private: private:
/// Pointer to the actual instantiation of the ButtonController. /// 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 \ xforms_resize.h \
$(XFORMSGIMAGE) xformsBC.C \ $(XFORMSGIMAGE) xformsBC.C \
xformsBC.h \ xformsBC.h \
xscreen.C \
xscreen.h \
Alert_pimpl.C \ Alert_pimpl.C \
Color.C \ Color.C \
Color.h \ Color.h \
@ -141,6 +143,9 @@ libxforms_la_SOURCES = \
FormUrl.h \ FormUrl.h \
FormVCLog.C \ FormVCLog.C \
FormVCLog.h \ FormVCLog.h \
guiapi.C \
LyXKeySymFactory.C \
LyXScreenFactory.C \
MathsSymbols.C \ MathsSymbols.C \
MathsSymbols.h \ MathsSymbols.h \
Menubar_pimpl.C \ Menubar_pimpl.C \
@ -153,8 +158,11 @@ libxforms_la_SOURCES = \
Toolbar_pimpl.h \ Toolbar_pimpl.h \
Tooltips.C \ Tooltips.C \
Tooltips.h \ Tooltips.h \
WorkAreaFactory.C \
XFormsView.C \ XFormsView.C \
XFormsView.h \ XFormsView.h \
XLyXKeySym.C \
XLyXKeySym.h \
XPainter.C \ XPainter.C \
XPainter.h \ XPainter.h \
XWorkArea.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; using std::max;
XPainter::XPainter(WorkArea & xwa) XPainter::XPainter(XWorkArea & xwa)
: Painter(), owner_(xwa) : Painter(), owner_(xwa)
{ {
} }

View File

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

View File

@ -18,6 +18,7 @@
#include "LyXView.h" #include "LyXView.h"
#include "lyxrc.h" // lyxrc.show_banner #include "lyxrc.h" // lyxrc.show_banner
#include "version.h" // lyx_version #include "version.h" // lyx_version
#include "XLyXKeySym.h"
#if FL_VERSION < 1 && (FL_REVISION < 89 || (FL_REVISION == 89 && FL_FIXLEVEL < 5)) #if FL_VERSION < 1 && (FL_REVISION < 89 || (FL_REVISION == 89 && FL_FIXLEVEL < 5))
#include "lyxlookup.h" #include "lyxlookup.h"
@ -123,33 +124,33 @@ key_modifier::state x_key_state(unsigned int state)
extern "C" { 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 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(); area->scroll_cb();
} }
static 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, FL_Coord, FL_Coord,
int key, void * xev) int key, void * xev)
{ {
return WorkArea::work_area_handler(ob, event, return XWorkArea::work_area_handler(ob, event,
0, 0, key, xev); 0, 0, key, xev);
} }
static static
int C_WorkAreaEventCB(FL_FORM * form, void * xev) { int C_XWorkAreaEventCB(FL_FORM * form, void * xev) {
WorkArea * wa = static_cast<WorkArea*>(form->u_vdata); XWorkArea * wa = static_cast<XWorkArea*>(form->u_vdata);
return wa->event_cb(static_cast<XEvent*>(xev)); 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) : splash_(0), splash_text_(0), workareapixmap(0), painter_(*this)
{ {
fl_freeze_all_forms(); 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_resize(obj, FL_RESIZE_ALL);
fl_set_object_gravity(obj, NorthEastGravity, SouthEastGravity); fl_set_object_gravity(obj, NorthEastGravity, SouthEastGravity);
obj->u_vdata = this; 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_bounds(scrollbar, 0.0, 0.0);
fl_set_scrollbar_value(scrollbar, 0.0); fl_set_scrollbar_value(scrollbar, 0.0);
fl_set_scrollbar_size(scrollbar, scrollbar->h); 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, x + bw, y + bw,
w - 15 - 2 * bw, // scrollbarwidth w - 15 - 2 * bw, // scrollbarwidth
h - 2 * bw, "", h - 2 * bw, "",
C_WorkArea_work_area_handler); C_XWorkArea_work_area_handler);
obj->wantkey = FL_KEY_ALL; 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. */ to the work_area_handler. */
fl_set_object_boxtype(obj,FL_DOWN_BOX); fl_set_object_boxtype(obj,FL_DOWN_BOX);
fl_set_object_resize(obj, FL_RESIZE_ALL); 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 /// X selection hook - xforms gets it wrong
fl_current_form->u_vdata = this; 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(); fl_unfreeze_all_forms();
} }
WorkArea::~WorkArea() XWorkArea::~XWorkArea()
{ {
if (workareapixmap) if (workareapixmap)
XFreePixmap(fl_get_display(), 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(); fl_freeze_all_forms();
@ -297,7 +298,7 @@ void destroy_object(FL_OBJECT * obj)
} // namespace anon } // 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 // Three calls to createPixmap are needed to draw the initial view
// of LyX. Any more and the splash is destroyed. // 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_) { if (!splash_) {
fl_winset(FL_ObjWin(work_area)); 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); 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 // we need to cache this for scroll_cb
doc_height_ = height; doc_height_ = height;
@ -391,7 +392,7 @@ void WorkArea::setScrollbarParams(int height, int pos, int line_height)
// callback for scrollbar slider // callback for scrollbar slider
void WorkArea::scroll_cb() void XWorkArea::scroll_cb()
{ {
double const val = fl_get_scrollbar_value(scrollbar); double const val = fl_get_scrollbar_value(scrollbar);
lyxerr[Debug::GUI] << "scroll: val: " << val << endl; 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 , FL_Coord, FL_Coord ,
int key, void * xev) int key, void * xev)
{ {
@ -411,7 +412,7 @@ int WorkArea::work_area_handler(FL_OBJECT * ob, int event,
static long scrollbar_value_old = -1; static long scrollbar_value_old = -1;
XEvent * ev = static_cast<XEvent*>(xev); 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; 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 << "We have " << num_keys << " keys in the returned buffer" << endl;
// lyxerr << "Our dummy string is " << dummy << endl; // lyxerr << "Our dummy string is " << dummy << endl;
#endif #endif
if (lyxerr.debugging(Debug::KEY)) { if (lyxerr.debugging(Debug::KEY)) {
char const * tmp = XKeysymToString(key); char const * tmp = XKeysymToString(key);
char const * tmp2 = XKeysymToString(keysym); char const * tmp2 = XKeysymToString(keysym);
string const stm = (tmp ? tmp : ""); string const stm = (tmp ? tmp : "");
string const stm2 = (tmp2 ? tmp2 : ""); string const stm2 = (tmp2 ? tmp2 : "");
lyxerr[Debug::KEY] << "WorkArea: Key is `" << stm << "' [" lyxerr[Debug::KEY] << "XWorkArea: Key is `" << stm << "' ["
<< key << "]" << endl; << key << "]" << endl;
lyxerr[Debug::KEY] << "WorkArea: Keysym is `" << stm2 << "' [" lyxerr[Debug::KEY] << "XWorkArea: Keysym is `" << stm2 << "' ["
<< keysym << "]" << endl; << keysym << "]" << endl;
} }
@ -562,7 +564,11 @@ int WorkArea::work_area_handler(FL_OBJECT * ob, int event,
last_key_pressed = xke->keycode; last_key_pressed = xke->keycode;
last_state_pressed = ret_state; 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; break;
@ -637,7 +643,7 @@ extern "C" {
} // namespace anon } // namespace anon
int WorkArea::event_cb(XEvent * xev) int XWorkArea::event_cb(XEvent * xev)
{ {
int ret = 0; int ret = 0;
switch (xev->type) { 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) { if (!yes) {
XSetSelectionOwner(fl_get_display(), XA_PRIMARY, None, CurrentTime); 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; 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; static string hold;
hold = s; hold = s;

View File

@ -15,59 +15,49 @@
#pragma interface #pragma interface
#endif #endif
#include "frontends/WorkArea.h"
#include "XPainter.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 FORMS_H_LOCATION
#include <utility>
/// ///
class WorkArea { class XWorkArea : public WorkArea {
public: 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; } virtual unsigned int width() const { return work_area->w + scrollbar->w; }
//unsigned int width() const { return backgroundbox->w + 15; }
/// ///
int xpos() const { return work_area->x; } virtual int xpos() const { return work_area->x; }
//int xpos() const { return backgroundbox->x; }
/// ///
int ypos() const { return work_area->y; } virtual int ypos() const { return work_area->y; }
//int ypos() const { return backgroundbox->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(work_area);
fl_redraw_object(scrollbar); fl_redraw_object(scrollbar);
} }
/// ///
void setFocus() const; virtual void setFocus() const;
/// ///
Window getWin() const { return work_area->form->window; } 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; } Pixmap getPixmap() const { return workareapixmap; }
/// xforms callback /// xforms callback
@ -78,36 +68,11 @@ public:
/// xforms callback from scrollbar /// xforms callback from scrollbar
void scroll_cb(); void scroll_cb();
/// a selection exists /// 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; virtual 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;
/// handles SelectionRequest X Event, to fill the clipboard /// handles SelectionRequest X Event, to fill the clipboard
int event_cb(XEvent * xev); int event_cb(XEvent * xev);

View File

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

View File

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

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> 2002-06-14 Angus Leeming <leeming@lyx.org>
* inseetexternal.C: remove the using std::difftime declaration. * 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 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. /// Updates needed features for this inset.
virtual void validate(LaTeXFeatures & features) const; 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; int ret;
os << "<title>"; os << "<title>";
ret = InsetText::docbook(buf, os); ret = InsetText::docbook(buf, os, mixcont);
os << "</title>\n"; os << "</title>\n";
return ret; return ret;
} }

View File

@ -54,7 +54,7 @@ public:
int ascii(Buffer const * buf, std::ostream & os, int linelen) const; int ascii(Buffer const * buf, std::ostream & os, int linelen) const;
/// ///
virtual virtual
int docbook(Buffer const * buf, std::ostream & os) const; int docbook(Buffer const * buf, std::ostream & os, bool mixcont) const;
protected: protected:
private: 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 #if 0
@ -649,7 +649,8 @@ bool InsetCollapsable::searchForward(BufferView * bv, string const & str,
bool found = inset.searchForward(bv, str, cs, mw); bool found = inset.searchForward(bv, str, cs, mw);
if (first_after_edit && !found) if (first_after_edit && !found)
close(bv); close(bv);
first_after_edit = false; else if (!found)
first_after_edit = false;
return found; return found;
} }
@ -660,7 +661,8 @@ bool InsetCollapsable::searchBackward(BufferView * bv, string const & str,
bool found = inset.searchBackward(bv, str, cs, mw); bool found = inset.searchBackward(bv, str, cs, mw);
if (first_after_edit && !found) if (first_after_edit && !found)
close(bv); close(bv);
first_after_edit = false; else if (!found)
first_after_edit = false;
return found; return found;
} }

View File

@ -105,7 +105,7 @@ public:
/// ///
int linuxdoc(Buffer const *, std::ostream &) const; 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; void validate(LaTeXFeatures & features) const;
/// ///

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