mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
the lfun3 patches (overall cleanup and "localizing" dispatch() in mathed)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4958 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
c10dfd15cd
commit
808973619b
@ -545,7 +545,7 @@ void BufferView::Pimpl::workAreaButtonPress(int xpos, int ypos,
|
||||
// we have to check this first
|
||||
bool paste_internally = false;
|
||||
if (button == mouse_button::button2 && bv_->getLyXText()->selection.set()) {
|
||||
owner_->getLyXFunc().dispatch(LFUN_COPY);
|
||||
owner_->dispatch(FuncRequest(LFUN_COPY));
|
||||
paste_internally = true;
|
||||
}
|
||||
|
||||
@ -616,9 +616,9 @@ void BufferView::Pimpl::workAreaButtonPress(int xpos, int ypos,
|
||||
// insert this
|
||||
if (button == mouse_button::button2) {
|
||||
if (paste_internally)
|
||||
owner_->getLyXFunc().dispatch(LFUN_PASTE);
|
||||
owner_->dispatch(FuncRequest(LFUN_PASTE));
|
||||
else
|
||||
owner_->getLyXFunc().dispatch(FuncRequest(LFUN_PASTESELECTION, "paragraph"));
|
||||
owner_->dispatch(FuncRequest(LFUN_PASTESELECTION, "paragraph"));
|
||||
selection_possible = false;
|
||||
return;
|
||||
}
|
||||
@ -3265,8 +3265,7 @@ void BufferView::Pimpl::smartQuote()
|
||||
|
||||
if (style->pass_thru ||
|
||||
(!insertInset(new InsetQuotes(c, bv_->buffer()->params))))
|
||||
bv_->owner()->getLyXFunc().
|
||||
dispatch(FuncRequest(LFUN_SELFINSERT, "\""));
|
||||
bv_->owner()->dispatch(FuncRequest(LFUN_SELFINSERT, "\""));
|
||||
}
|
||||
|
||||
|
||||
@ -3288,7 +3287,7 @@ void BufferView::Pimpl::insertAndEditInset(Inset * inset)
|
||||
if (insertInset(inset)) {
|
||||
inset->edit(bv_);
|
||||
if (gotsel)
|
||||
owner_->getLyXFunc().dispatch(LFUN_PASTESELECTION);
|
||||
owner_->dispatch(FuncRequest(LFUN_PASTESELECTION));
|
||||
}
|
||||
else
|
||||
delete inset;
|
||||
|
@ -1,3 +1,20 @@
|
||||
|
||||
2002-08-13 André Pönitz <poenitz@gmx.net>
|
||||
|
||||
* funcrequest.h: new constructor
|
||||
|
||||
* funcrequest.C: move stuff here from .h
|
||||
|
||||
* Makefile.am:
|
||||
* BufferView_pimpl.C:
|
||||
* LyXAction.C:
|
||||
* toc.C:
|
||||
* lyxfunc.C: subsequent changes
|
||||
|
||||
* lyxfunc.h: new view() member function
|
||||
|
||||
* lyxfunc.C: subsequent changes
|
||||
|
||||
2002-08-13 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* BufferView2.C:
|
||||
|
@ -475,7 +475,7 @@ int LyXAction::getPseudoAction(kb_action action, string const & arg)
|
||||
static unsigned int pseudo_counter = LFUN_LASTACTION;
|
||||
|
||||
// Create new pseudo action.
|
||||
lyx_pseudo_map[++pseudo_counter] = FuncRequest(action, arg);
|
||||
lyx_pseudo_map[++pseudo_counter] = FuncRequest(0, action, arg);
|
||||
|
||||
// First ensure that the action is in lyx_arg_map;
|
||||
lyx_arg_map[action];
|
||||
|
@ -123,6 +123,7 @@ lyx_SOURCES = \
|
||||
gettext.C \
|
||||
gettext.h \
|
||||
funcrequest.h \
|
||||
funcrequest.C \
|
||||
importer.C \
|
||||
importer.h \
|
||||
intl.C \
|
||||
|
@ -67,7 +67,8 @@ ParagraphList::iterator::operator--(int)
|
||||
bool operator==(ParagraphList::iterator const & i1,
|
||||
ParagraphList::iterator const & i2)
|
||||
{
|
||||
return &(*const_cast<ParagraphList::iterator&>(i1)) == &(*const_cast<ParagraphList::iterator&>(i2));
|
||||
return &(*const_cast<ParagraphList::iterator&>(i1))
|
||||
== &(*const_cast<ParagraphList::iterator&>(i2));
|
||||
}
|
||||
|
||||
|
||||
@ -124,6 +125,21 @@ void ParagraphList::set(Paragraph * p)
|
||||
}
|
||||
|
||||
|
||||
void ParagraphList::push_back(Paragraph * p)
|
||||
{
|
||||
if (!parlist) {
|
||||
parlist = p;
|
||||
return;
|
||||
}
|
||||
|
||||
Paragraph * pos = parlist;
|
||||
while (pos->next())
|
||||
pos = pos->next();
|
||||
pos->next(p);
|
||||
p->previous(pos);
|
||||
}
|
||||
|
||||
|
||||
int ParagraphList::size() const
|
||||
{
|
||||
// When we switch to a std::container this will be O(1)
|
||||
|
@ -58,6 +58,8 @@ public:
|
||||
///
|
||||
void set(Paragraph *);
|
||||
///
|
||||
void push_back(Paragraph *);
|
||||
///
|
||||
int size() const;
|
||||
///
|
||||
bool empty() const;
|
||||
|
@ -1,3 +1,8 @@
|
||||
|
||||
2002-08-13 André Pönitz <poenitz@gmx.net>
|
||||
|
||||
* LyXView.[Ch]: new member dispatch();
|
||||
|
||||
2002-08-13 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* LyXView.[Ch]:
|
||||
@ -16,7 +21,7 @@
|
||||
|
||||
* Toolbar.C:
|
||||
|
||||
2002-08-06 André Poentiz <poenitz@gmx.net>
|
||||
2002-08-06 André Poenitz <poenitz@gmx.net>
|
||||
|
||||
* Screen.C: Honor \show_banner lyxrc setting
|
||||
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "MenuBackend.h"
|
||||
#include "gettext.h"
|
||||
#include "lyxfunc.h"
|
||||
#include "funcrequest.h"
|
||||
#include "lyx_cb.h"
|
||||
#include "BufferView.h"
|
||||
#include "bufferview_funcs.h"
|
||||
@ -170,3 +171,12 @@ void LyXView::updateWindowTitle()
|
||||
last_title = title;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void LyXView::dispatch(FuncRequest const & req)
|
||||
{
|
||||
// substitute the correct BufferView here
|
||||
FuncRequest r = req;
|
||||
r.setView(view().get());
|
||||
getLyXFunc().dispatch(r);
|
||||
}
|
||||
|
@ -36,6 +36,7 @@ class Dialogs;
|
||||
class LyXFunc;
|
||||
class LyXFont;
|
||||
class Timeout;
|
||||
class FuncRequest;
|
||||
|
||||
/**
|
||||
* LyXView - main LyX window
|
||||
@ -132,8 +133,11 @@ public:
|
||||
/// reset autosave timer
|
||||
void resetAutosaveTimer();
|
||||
|
||||
/// dispatch to current BufferView
|
||||
void dispatch(FuncRequest const & req);
|
||||
|
||||
protected:
|
||||
/// view of a buffer. Eventtually there will be several.
|
||||
/// view of a buffer. Eventually there will be several.
|
||||
boost::shared_ptr<BufferView> bufferview_;
|
||||
|
||||
/// view's menubar
|
||||
|
@ -21,20 +21,21 @@
|
||||
#include "frontends/LyXView.h"
|
||||
#include "bmtable.h"
|
||||
#include "debug.h"
|
||||
#include "support/lstrings.h"
|
||||
#include "lyxfunc.h"
|
||||
#include "funcrequest.h"
|
||||
#include "Lsstream.h"
|
||||
#include FORMS_H_LOCATION
|
||||
|
||||
#include "delim.xbm"
|
||||
#include "delim0.xpm"
|
||||
#include "delim1.xpm"
|
||||
|
||||
|
||||
static int const delim_rversion[] = {
|
||||
1,1,3,3,4,5,7,7,9,9,10,11,
|
||||
13,13,14,15,16,17,19,19,20,21,22,23
|
||||
};
|
||||
|
||||
|
||||
static char const * delim_values[] = {
|
||||
"(", ")", "lceil", "rceil", "uparrow", "Uparrow",
|
||||
"[", "]", "lfloor", "rfloor", "updownarrow", "Updownarrow",
|
||||
@ -88,13 +89,12 @@ void FormMathsDelim::build()
|
||||
void FormMathsDelim::apply()
|
||||
{
|
||||
int const left = int(dialog_->radio_left->u_ldata);
|
||||
int const right= int(dialog_->radio_right->u_ldata);
|
||||
int const right = int(dialog_->radio_right->u_ldata);
|
||||
|
||||
ostringstream ost;
|
||||
ost << delim_values[left] << ' ' << delim_values[right];
|
||||
ostringstream os;
|
||||
os << delim_values[left] << ' ' << delim_values[right];
|
||||
|
||||
lv_->getLyXFunc().
|
||||
dispatch(FuncRequest(LFUN_MATH_DELIM, ost.str().c_str()), false);
|
||||
lv_->dispatch(FuncRequest(LFUN_MATH_DELIM, os.str().c_str()));
|
||||
}
|
||||
|
||||
|
||||
|
@ -22,7 +22,6 @@
|
||||
#include "Dialogs.h"
|
||||
#include "frontends/LyXView.h"
|
||||
#include "Lsstream.h"
|
||||
#include "lyxfunc.h"
|
||||
#include "funcrequest.h"
|
||||
#include "support/LAssert.h"
|
||||
#include "support/lyxalgo.h" // lyx::count
|
||||
@ -97,11 +96,10 @@ void FormMathsMatrix::apply()
|
||||
int const nx = int(fl_get_slider_value(dialog_->slider_columns) + 0.5);
|
||||
int const ny = int(fl_get_slider_value(dialog_->slider_rows) + 0.5);
|
||||
|
||||
ostringstream ost;
|
||||
ost << nx << ' ' << ny << ' ' << c << ' ' << sh;
|
||||
ostringstream os;
|
||||
os << nx << ' ' << ny << ' ' << c << ' ' << sh;
|
||||
|
||||
lv_->getLyXFunc().
|
||||
dispatch(FuncRequest(LFUN_INSERT_MATRIX, ost.str().c_str()));
|
||||
lv_->dispatch(FuncRequest(LFUN_INSERT_MATRIX, os.str().c_str()));
|
||||
}
|
||||
|
||||
|
||||
@ -124,7 +122,7 @@ bool FormMathsMatrix::input(FL_OBJECT * ob, long)
|
||||
|
||||
int FormMathsMatrix::AlignFilter(char const * cur, int c)
|
||||
{
|
||||
size_t len = strlen(cur);
|
||||
size_t const len = strlen(cur);
|
||||
|
||||
int const n = int(fl_get_slider_value(dialog_->slider_columns) + 0.5)
|
||||
- int(len)
|
||||
|
@ -20,8 +20,6 @@
|
||||
#include "FormMathsPanel.h"
|
||||
#include "forms/form_maths_panel.h"
|
||||
#include "MathsSymbols.h"
|
||||
#include "debug.h"
|
||||
#include "lyxfunc.h"
|
||||
#include "funcrequest.h"
|
||||
|
||||
#include "forms/form_maths_deco.h"
|
||||
@ -234,9 +232,10 @@ void FormMathsPanel::build()
|
||||
bc().setCancel(dialog_->button_close);
|
||||
}
|
||||
|
||||
|
||||
bool FormMathsPanel::input(FL_OBJECT *, long data)
|
||||
{
|
||||
MathsCallbackValues val = static_cast<MathsCallbackValues>(data);
|
||||
MathsCallbackValues const val = static_cast<MathsCallbackValues>(data);
|
||||
|
||||
switch (val) {
|
||||
case MM_GREEK:
|
||||
@ -320,19 +319,17 @@ bool FormMathsPanel::input(FL_OBJECT *, long data)
|
||||
break;
|
||||
|
||||
case MM_SUPER:
|
||||
//lv_->getLyXFunc().dispatch(LFUN_MATH_MODE);
|
||||
lv_->getLyXFunc().dispatch(LFUN_SUPERSCRIPT);
|
||||
lv_->dispatch(FuncRequest(LFUN_SUPERSCRIPT));
|
||||
break;
|
||||
|
||||
case MM_SUB:
|
||||
//lv_->getLyXFunc().dispatch(LFUN_MATH_MODE);
|
||||
lv_->getLyXFunc().dispatch(LFUN_SUBSCRIPT);
|
||||
lv_->dispatch(FuncRequest(LFUN_SUBSCRIPT));
|
||||
break;
|
||||
|
||||
case MM_SUBSUPER:
|
||||
lv_->getLyXFunc().dispatch(LFUN_SUBSCRIPT);
|
||||
lv_->getLyXFunc().dispatch(LFUN_LEFT);
|
||||
lv_->getLyXFunc().dispatch(LFUN_SUPERSCRIPT);
|
||||
lv_->dispatch(FuncRequest(LFUN_SUBSCRIPT));
|
||||
lv_->dispatch(FuncRequest(LFUN_LEFT));
|
||||
lv_->dispatch(FuncRequest(LFUN_SUPERSCRIPT));
|
||||
break;
|
||||
|
||||
case MM_DELIM:
|
||||
@ -382,21 +379,21 @@ bool FormMathsPanel::input(FL_OBJECT *, long data)
|
||||
void FormMathsPanel::insertSymbol(string const & sym, bool bs) const
|
||||
{
|
||||
if (bs)
|
||||
lv_->getLyXFunc().dispatch(FuncRequest(LFUN_INSERT_MATH, '\\' + sym));
|
||||
lv_->dispatch(FuncRequest(LFUN_INSERT_MATH, '\\' + sym));
|
||||
else
|
||||
lv_->getLyXFunc().dispatch(FuncRequest(LFUN_INSERT_MATH, sym));
|
||||
lv_->dispatch(FuncRequest(LFUN_INSERT_MATH, sym));
|
||||
}
|
||||
|
||||
|
||||
void FormMathsPanel::dispatchFunc(kb_action action) const
|
||||
{
|
||||
lv_->getLyXFunc().dispatch(action);
|
||||
lv_->dispatch(FuncRequest(action));
|
||||
}
|
||||
|
||||
|
||||
void FormMathsPanel::mathDisplay() const
|
||||
{
|
||||
lv_->getLyXFunc().dispatch(LFUN_MATH_DISPLAY);
|
||||
lv_->dispatch(FuncRequest(LFUN_MATH_DISPLAY));
|
||||
}
|
||||
|
||||
|
||||
|
@ -22,7 +22,6 @@
|
||||
#include "frontends/LyXView.h"
|
||||
#include "language.h"
|
||||
#include "frnt_lang.h"
|
||||
#include "lyxfunc.h"
|
||||
#include "lyxlex.h"
|
||||
#include "lyxrc.h"
|
||||
#include "LColor.h"
|
||||
@ -132,7 +131,7 @@ void FormPreferences::ok()
|
||||
colors_.modifiedXformsPrefs = !XformsColor::write(filename);
|
||||
}
|
||||
|
||||
lv_->getLyXFunc().dispatch(LFUN_SAVEPREFERENCES);
|
||||
lv_->dispatch(FuncRequest(LFUN_SAVEPREFERENCES));
|
||||
}
|
||||
|
||||
|
||||
@ -437,7 +436,7 @@ void FormPreferences::Colors::apply()
|
||||
|
||||
string const s = lcolor.getLyXName(lc) + string(" ") +
|
||||
hexname;
|
||||
parent_.lv_->getLyXFunc().dispatch(FuncRequest(LFUN_SET_COLOR, s));
|
||||
parent_.lv_->dispatch(FuncRequest(LFUN_SET_COLOR, s));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -744,8 +743,7 @@ void FormPreferences::Colors::LoadBrowserLyX()
|
||||
<< "\". Set to \"black\"!" << endl;
|
||||
|
||||
string const arg = lcolor.getLyXName(lc) + " black";
|
||||
parent_.lv_->getLyXFunc().
|
||||
dispatch(FuncRequest(LFUN_SET_COLOR, arg));
|
||||
parent_.lv_->dispatch(FuncRequest(LFUN_SET_COLOR, arg));
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -2557,7 +2555,7 @@ void FormPreferences::ScreenFonts::apply() const
|
||||
if (changed) {
|
||||
// Now update the buffers
|
||||
// Can anything below here affect the redraw process?
|
||||
parent_.lv_->getLyXFunc().dispatch(LFUN_SCREEN_FONT_UPDATE);
|
||||
parent_.lv_->dispatch(FuncRequest(LFUN_SCREEN_FONT_UPDATE));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,6 @@
|
||||
#include "XFormsView.h"
|
||||
#include "lyxfunc.h"
|
||||
#include "FuncStatus.h"
|
||||
#include "BufferView.h"
|
||||
#include "buffer.h"
|
||||
#include "funcrequest.h"
|
||||
#include "MathsSymbols.h"
|
||||
|
@ -12,29 +12,35 @@
|
||||
#include "commandtags.h"
|
||||
#include "LString.h"
|
||||
|
||||
class BufferView;
|
||||
|
||||
/**
|
||||
* This class encapsulates a LyX action and its argument
|
||||
* in order to pass it around easily.
|
||||
*/
|
||||
struct FuncRequest {
|
||||
|
||||
FuncRequest()
|
||||
: action(LFUN_UNKNOWN_ACTION)
|
||||
{}
|
||||
|
||||
FuncRequest(kb_action act)
|
||||
: action(act)
|
||||
{}
|
||||
|
||||
FuncRequest(kb_action act, string const & arg)
|
||||
: action(act), argument(arg)
|
||||
{}
|
||||
|
||||
class FuncRequest {
|
||||
public:
|
||||
/// just for putting thes things in std::container
|
||||
FuncRequest();
|
||||
/// actions without extra argument
|
||||
explicit FuncRequest(kb_action act);
|
||||
/// actions with extra argument
|
||||
FuncRequest(kb_action act, string const & arg);
|
||||
/// actions without extra argument
|
||||
FuncRequest(BufferView * view, kb_action act);
|
||||
/// actions with extra argument
|
||||
FuncRequest(BufferView * view, kb_action act, string const & arg);
|
||||
/// for mouse events
|
||||
FuncRequest(kb_action act, int ax, int ay, int aextra)
|
||||
: action(act), argument(), x(ax), y(ay), extra(aextra)
|
||||
{}
|
||||
FuncRequest(BufferView * view, kb_action act, int ax, int ay, int aextra);
|
||||
/// access to the view
|
||||
BufferView * view() const;
|
||||
/// access to the view
|
||||
void setView(BufferView * view);
|
||||
|
||||
private:
|
||||
/// the BufferView we are talking to
|
||||
BufferView * view_;
|
||||
public: // should be private, too...
|
||||
/// the action
|
||||
kb_action action;
|
||||
/// the action's string argument
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include "importer.h"
|
||||
#include "converter.h"
|
||||
#include "frontends/LyXView.h"
|
||||
#include "lyxfunc.h"
|
||||
#include "funcrequest.h"
|
||||
|
||||
#include "bufferlist.h"
|
||||
#include "support/filetools.h"
|
||||
@ -78,7 +78,7 @@ bool Importer::Import(LyXView * lv, string const & filename,
|
||||
: ChangeExtension(filename,
|
||||
formats.extension(loader_format));
|
||||
InsertAsciiFile(lv->view().get(), filename2, as_paragraphs);
|
||||
lv->getLyXFunc().dispatch(LFUN_MARK_OFF);
|
||||
lv->dispatch(FuncRequest(LFUN_MARK_OFF));
|
||||
}
|
||||
|
||||
// we are done
|
||||
|
@ -305,17 +305,17 @@ void UpdatableInset::scroll(BufferView * bv, int offset) const
|
||||
|
||||
/// An updatable inset could handle lyx editing commands
|
||||
UpdatableInset::RESULT
|
||||
UpdatableInset::localDispatch(BufferView * bv, FuncRequest const & ev)
|
||||
UpdatableInset::localDispatch(FuncRequest const & ev)
|
||||
{
|
||||
if (!ev.argument.empty() && ev.action == LFUN_SCROLL_INSET) {
|
||||
if (ev.argument.find('.') != ev.argument.npos) {
|
||||
float const xx = static_cast<float>(strToDbl(ev.argument));
|
||||
scroll(bv, xx);
|
||||
scroll(ev.view(), xx);
|
||||
} else {
|
||||
int const xx = strToInt(ev.argument);
|
||||
scroll(bv, xx);
|
||||
scroll(ev.view(), xx);
|
||||
}
|
||||
bv->updateInset(this, false);
|
||||
ev.view()->updateInset(this, false);
|
||||
|
||||
return DISPATCHED;
|
||||
}
|
||||
|
@ -512,7 +512,7 @@ public:
|
||||
bool /*lr*/ = false)
|
||||
{ return false; }
|
||||
/// An updatable inset could handle lyx editing commands
|
||||
virtual RESULT localDispatch(BufferView *, FuncRequest const & ev);
|
||||
virtual RESULT localDispatch(FuncRequest const & ev);
|
||||
///
|
||||
bool isCursorVisible() const { return cursor_visible_; }
|
||||
///
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "lyxlex.h"
|
||||
#include "lyxtext.h"
|
||||
#include "WordLangTuple.h"
|
||||
#include "funcrequest.h"
|
||||
|
||||
#include "frontends/font_metrics.h"
|
||||
#include "frontends/Painter.h"
|
||||
@ -445,11 +446,11 @@ void InsetCollapsable::update(BufferView * bv, LyXFont const & font,
|
||||
|
||||
|
||||
UpdatableInset::RESULT
|
||||
InsetCollapsable::localDispatch(BufferView * bv, FuncRequest const & ev)
|
||||
InsetCollapsable::localDispatch(FuncRequest const & ev)
|
||||
{
|
||||
UpdatableInset::RESULT result = inset.localDispatch(bv, ev);
|
||||
UpdatableInset::RESULT result = inset.localDispatch(ev);
|
||||
if (result >= FINISHED)
|
||||
bv->unlockInset(this);
|
||||
ev.view()->unlockInset(this);
|
||||
first_after_edit = false;
|
||||
return result;
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ public:
|
||||
///
|
||||
void insetMotionNotify(BufferView *, int, int, mouse_button::state);
|
||||
///
|
||||
UpdatableInset::RESULT localDispatch(BufferView *, FuncRequest const &);
|
||||
RESULT localDispatch(FuncRequest const &);
|
||||
///
|
||||
int latex(Buffer const *, std::ostream &,
|
||||
bool fragile, bool free_spc) const;
|
||||
|
@ -445,10 +445,10 @@ int InsetERT::docbook(Buffer const *, ostream & os, bool) const
|
||||
}
|
||||
|
||||
|
||||
UpdatableInset::RESULT
|
||||
InsetERT::localDispatch(BufferView * bv, FuncRequest const & ev)
|
||||
UpdatableInset::RESULT InsetERT::localDispatch(FuncRequest const & ev)
|
||||
{
|
||||
UpdatableInset::RESULT result = DISPATCHED_NOUPDATE;
|
||||
BufferView * bv = ev.view();
|
||||
|
||||
if (inset.paragraph()->empty()) {
|
||||
set_latex_font(bv);
|
||||
@ -459,7 +459,7 @@ InsetERT::localDispatch(BufferView * bv, FuncRequest const & ev)
|
||||
bv->owner()->setLayout(inset.paragraph()->layout()->name());
|
||||
break;
|
||||
default:
|
||||
result = InsetCollapsable::localDispatch(bv, ev);
|
||||
result = InsetCollapsable::localDispatch(ev);
|
||||
}
|
||||
switch (ev.action) {
|
||||
case LFUN_BREAKPARAGRAPH:
|
||||
|
@ -94,7 +94,7 @@ public:
|
||||
///
|
||||
void validate(LaTeXFeatures &) const {}
|
||||
///
|
||||
UpdatableInset::RESULT localDispatch(BufferView *, FuncRequest const &);
|
||||
RESULT localDispatch(FuncRequest const &);
|
||||
///
|
||||
bool checkInsertChar(LyXFont &);
|
||||
///
|
||||
|
@ -25,7 +25,6 @@
|
||||
#include "funcrequest.h"
|
||||
#include "buffer.h"
|
||||
#include "gettext.h"
|
||||
#include "lyxfunc.h"
|
||||
|
||||
using std::ostream;
|
||||
|
||||
@ -46,8 +45,7 @@ string const InsetParent::getScreenLabel(Buffer const *) const
|
||||
|
||||
void InsetParent::edit(BufferView * bv, int, int, mouse_button::state)
|
||||
{
|
||||
bv->owner()->getLyXFunc().
|
||||
dispatch(FuncRequest(LFUN_CHILDOPEN, getContents()));
|
||||
bv->owner()->dispatch(FuncRequest(LFUN_CHILDOPEN, getContents()));
|
||||
}
|
||||
|
||||
|
||||
|
@ -12,7 +12,6 @@
|
||||
#include "LaTeXFeatures.h"
|
||||
#include "frontends/LyXView.h"
|
||||
#include "frontends/Dialogs.h"
|
||||
#include "lyxfunc.h"
|
||||
#include "BufferView.h"
|
||||
#include "support/lstrings.h"
|
||||
|
||||
@ -27,8 +26,7 @@ void InsetRef::edit(BufferView * bv, int, int, mouse_button::state button)
|
||||
{
|
||||
// FuncRequestually trigger dialog with button 3 not 1
|
||||
if (button == mouse_button::button3)
|
||||
bv->owner()->getLyXFunc().
|
||||
dispatch(FuncRequest(LFUN_REF_GOTO, getContents()));
|
||||
bv->owner()->dispatch(FuncRequest(LFUN_REF_GOTO, getContents()));
|
||||
else if (button == mouse_button::button1)
|
||||
bv->owner()->getDialogs().showRef(this);
|
||||
}
|
||||
|
@ -821,7 +821,7 @@ void InsetTabular::insetButtonPress(BufferView * bv, int x, int y, mouse_button:
|
||||
the_locking_inset = 0;
|
||||
}
|
||||
if (button == mouse_button::button2) {
|
||||
localDispatch(bv, FuncRequest(LFUN_PASTESELECTION, "paragraph"));
|
||||
localDispatch(FuncRequest(bv, LFUN_PASTESELECTION, "paragraph"));
|
||||
return;
|
||||
}
|
||||
if (inset_hit && bv->theLockingInset()) {
|
||||
@ -877,14 +877,14 @@ void InsetTabular::insetMotionNotify(BufferView * bv, int x, int y, mouse_button
|
||||
}
|
||||
|
||||
|
||||
UpdatableInset::RESULT
|
||||
InsetTabular::localDispatch(BufferView * bv, FuncRequest const & ev)
|
||||
UpdatableInset::RESULT InsetTabular::localDispatch(FuncRequest const & ev)
|
||||
{
|
||||
// We need to save the value of the_locking_inset as the call to
|
||||
// the_locking_inset->LocalDispatch might unlock it.
|
||||
old_locking_inset = the_locking_inset;
|
||||
UpdatableInset::RESULT result =
|
||||
UpdatableInset::localDispatch(bv, ev);
|
||||
RESULT result = UpdatableInset::localDispatch(ev);
|
||||
|
||||
BufferView * bv = ev.view();
|
||||
if (result == DISPATCHED || result == DISPATCHED_NOUPDATE) {
|
||||
resetPos(bv);
|
||||
return result;
|
||||
@ -925,7 +925,7 @@ InsetTabular::localDispatch(BufferView * bv, FuncRequest const & ev)
|
||||
kb_action action = ev.action;
|
||||
string arg = ev.argument;
|
||||
if (the_locking_inset) {
|
||||
result = the_locking_inset->localDispatch(bv, ev);
|
||||
result = the_locking_inset->localDispatch(ev);
|
||||
if (result == DISPATCHED_NOUPDATE) {
|
||||
int sc = scroll();
|
||||
resetPos(bv);
|
||||
@ -1251,7 +1251,7 @@ InsetTabular::localDispatch(BufferView * bv, FuncRequest const & ev)
|
||||
case LFUN_DEFAULT:
|
||||
case LFUN_UNDERLINE:
|
||||
case LFUN_FONT_SIZE:
|
||||
if (bv->dispatch(FuncRequest(action, arg)))
|
||||
if (bv->dispatch(FuncRequest(bv, action, arg)))
|
||||
result = DISPATCHED;
|
||||
break;
|
||||
default:
|
||||
@ -1266,7 +1266,7 @@ InsetTabular::localDispatch(BufferView * bv, FuncRequest const & ev)
|
||||
if (activateCellInset(bv)) {
|
||||
// reset need_update setted in above function!
|
||||
need_update = NONE;
|
||||
result = the_locking_inset->localDispatch(bv, FuncRequest(action, arg));
|
||||
result = the_locking_inset->localDispatch(FuncRequest(bv, action, arg));
|
||||
if ((result == UNDISPATCHED) || (result >= FINISHED)) {
|
||||
unlockInsetInInset(bv, the_locking_inset);
|
||||
nodraw(false);
|
||||
|
@ -142,7 +142,7 @@ public:
|
||||
///
|
||||
void insetMotionNotify(BufferView *, int, int, mouse_button::state);
|
||||
///
|
||||
UpdatableInset::RESULT localDispatch(BufferView *, FuncRequest const &);
|
||||
RESULT localDispatch(FuncRequest const &);
|
||||
///
|
||||
int latex(Buffer const *, std::ostream &, bool, bool) const;
|
||||
///
|
||||
|
@ -28,7 +28,6 @@
|
||||
#include "lyxfont.h"
|
||||
#include "lyxcursor.h"
|
||||
#include "lyxfind.h"
|
||||
#include "lyxfunc.h"
|
||||
#include "lyxlex.h"
|
||||
#include "lyxrow.h"
|
||||
#include "lyxrc.h"
|
||||
@ -1036,7 +1035,7 @@ void InsetText::insetButtonPress(BufferView * bv,
|
||||
if (bv->theLockingInset()) {
|
||||
if (isHighlyEditableInset(inset)) {
|
||||
// We just have to lock the inset before calling a
|
||||
// PressFuncRequest on it!
|
||||
// PressEvent on it!
|
||||
UpdatableInset * uinset = static_cast<UpdatableInset*>(inset);
|
||||
if (!bv->lockInset(uinset)) {
|
||||
lyxerr[Debug::INSETS] << "Cannot lock inset" << endl;
|
||||
@ -1050,7 +1049,7 @@ void InsetText::insetButtonPress(BufferView * bv,
|
||||
if (!inset) { // && (button == mouse_button::button2)) {
|
||||
bool paste_internally = false;
|
||||
if ((button == mouse_button::button2) && getLyXText(bv)->selection.set()) {
|
||||
localDispatch(bv, FuncRequest(LFUN_COPY));
|
||||
localDispatch(FuncRequest(bv, LFUN_COPY));
|
||||
paste_internally = true;
|
||||
}
|
||||
bool clear = false;
|
||||
@ -1089,9 +1088,9 @@ void InsetText::insetButtonPress(BufferView * bv,
|
||||
// insert this
|
||||
if (button == mouse_button::button2) {
|
||||
if (paste_internally)
|
||||
localDispatch(bv, FuncRequest(LFUN_PASTE));
|
||||
localDispatch(FuncRequest(bv, LFUN_PASTE));
|
||||
else
|
||||
localDispatch(bv, FuncRequest(LFUN_PASTESELECTION, "paragraph"));
|
||||
localDispatch(FuncRequest(bv, LFUN_PASTESELECTION, "paragraph"));
|
||||
}
|
||||
} else {
|
||||
getLyXText(bv)->clearSelection();
|
||||
@ -1169,12 +1168,12 @@ void InsetText::insetMotionNotify(BufferView * bv, int x, int y, mouse_button::s
|
||||
|
||||
|
||||
UpdatableInset::RESULT
|
||||
InsetText::localDispatch(BufferView * bv, FuncRequest const & ev)
|
||||
InsetText::localDispatch(FuncRequest const & ev)
|
||||
{
|
||||
BufferView * bv = ev.view();
|
||||
bool was_empty = (paragraphs.begin()->empty() && !paragraphs.begin()->next());
|
||||
no_selection = false;
|
||||
UpdatableInset::RESULT
|
||||
result= UpdatableInset::localDispatch(bv, ev);
|
||||
RESULT result= UpdatableInset::localDispatch(ev);
|
||||
if (result != UNDISPATCHED)
|
||||
return DISPATCHED;
|
||||
|
||||
@ -1183,7 +1182,7 @@ InsetText::localDispatch(BufferView * bv, FuncRequest const & ev)
|
||||
return FINISHED;
|
||||
|
||||
if (the_locking_inset) {
|
||||
result = the_locking_inset->localDispatch(bv, ev);
|
||||
result = the_locking_inset->localDispatch(ev);
|
||||
if (result == DISPATCHED_NOUPDATE)
|
||||
return result;
|
||||
else if (result == DISPATCHED) {
|
||||
@ -1453,7 +1452,7 @@ InsetText::localDispatch(BufferView * bv, FuncRequest const & ev)
|
||||
// see if we found the layout number:
|
||||
if (!hasLayout) {
|
||||
FuncRequest lf(LFUN_MESSAGE, N_("Layout ") + ev.argument + N_(" not known"));
|
||||
bv->owner()->getLyXFunc().dispatch(lf);
|
||||
bv->owner()->dispatch(lf);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -131,7 +131,7 @@ public:
|
||||
///
|
||||
void insetMotionNotify(BufferView *, int, int, mouse_button::state);
|
||||
///
|
||||
UpdatableInset::RESULT localDispatch(BufferView *, FuncRequest const &);
|
||||
RESULT localDispatch(FuncRequest const &);
|
||||
///
|
||||
int latex(Buffer const *, std::ostream &,
|
||||
bool fragile, bool free_spc) const;
|
||||
|
216
src/lyxfunc.C
216
src/lyxfunc.C
@ -138,8 +138,8 @@ inline
|
||||
LyXText * LyXFunc::TEXT(bool flag = true) const
|
||||
{
|
||||
if (flag)
|
||||
return owner->view()->text;
|
||||
return owner->view()->getLyXText();
|
||||
return view()->text;
|
||||
return view()->getLyXText();
|
||||
}
|
||||
|
||||
|
||||
@ -147,14 +147,14 @@ inline
|
||||
void LyXFunc::moveCursorUpdate(bool flag, bool selecting)
|
||||
{
|
||||
if (selecting || TEXT(flag)->selection.mark()) {
|
||||
TEXT(flag)->setSelection(owner->view().get());
|
||||
TEXT(flag)->setSelection(view());
|
||||
if (TEXT(flag)->bv_owner)
|
||||
owner->view()->toggleToggle();
|
||||
view()->toggleToggle();
|
||||
}
|
||||
owner->view()->update(TEXT(flag), BufferView::SELECT|BufferView::FITCUR);
|
||||
owner->view()->showCursor();
|
||||
view()->update(TEXT(flag), BufferView::SELECT|BufferView::FITCUR);
|
||||
view()->showCursor();
|
||||
|
||||
owner->view()->switchKeyMap();
|
||||
view()->switchKeyMap();
|
||||
}
|
||||
|
||||
|
||||
@ -172,7 +172,7 @@ void LyXFunc::handleKeyFunc(kb_action action)
|
||||
// actions
|
||||
keyseq.clear();
|
||||
// copied verbatim from do_accent_char
|
||||
owner->view()->update(TEXT(false),
|
||||
view()->update(TEXT(false),
|
||||
BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
|
||||
TEXT(false)->selection.cursor = TEXT(false)->cursor;
|
||||
}
|
||||
@ -263,7 +263,7 @@ void LyXFunc::processKeySym(LyXKeySymPtr keysym,
|
||||
if (c != 0)
|
||||
argument = c;
|
||||
|
||||
dispatch(FuncRequest(LFUN_SELFINSERT, argument));
|
||||
dispatch(FuncRequest(view(), LFUN_SELFINSERT, argument));
|
||||
lyxerr[Debug::KEY] << "SelfInsert arg[`"
|
||||
<< argument << "']" << endl;
|
||||
} else {
|
||||
@ -277,7 +277,7 @@ FuncStatus LyXFunc::getStatus(int ac) const
|
||||
kb_action action;
|
||||
string arg;
|
||||
boost::tie(action, arg) = lyxaction.retrieveActionArg(ac);
|
||||
return getStatus(FuncRequest(action, arg));
|
||||
return getStatus(FuncRequest(view(), action, arg));
|
||||
}
|
||||
|
||||
|
||||
@ -320,7 +320,7 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & ev) const
|
||||
}
|
||||
}
|
||||
|
||||
UpdatableInset * tli = owner->view()->theLockingInset();
|
||||
UpdatableInset * tli = view()->theLockingInset();
|
||||
|
||||
// I would really like to avoid having this switch and rather try to
|
||||
// encode this in the function itself.
|
||||
@ -410,11 +410,11 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & ev) const
|
||||
disable = !buf->lyxvc.inUse();
|
||||
break;
|
||||
case LFUN_BOOKMARK_GOTO:
|
||||
disable = !owner->view()->
|
||||
disable = !view()->
|
||||
isSavedPosition(strToUnsignedInt(ev.argument));
|
||||
break;
|
||||
case LFUN_INSET_TOGGLE: {
|
||||
LyXText * lt = owner->view()->getLyXText();
|
||||
LyXText * lt = view()->getLyXText();
|
||||
disable = !(isEditableInset(lt->getInset())
|
||||
|| (lt->inset_owner
|
||||
&& lt->inset_owner->owner()
|
||||
@ -706,7 +706,7 @@ void LyXFunc::dispatch(int ac, bool verbose)
|
||||
kb_action action;
|
||||
string arg;
|
||||
boost::tie(action, arg) = lyxaction.retrieveActionArg(ac);
|
||||
dispatch(FuncRequest(action, arg), verbose);
|
||||
dispatch(FuncRequest(view(), action, arg), verbose);
|
||||
}
|
||||
|
||||
|
||||
@ -729,8 +729,8 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose)
|
||||
|
||||
selection_possible = false;
|
||||
|
||||
if (owner->view()->available())
|
||||
owner->view()->hideCursor();
|
||||
if (view()->available())
|
||||
view()->hideCursor();
|
||||
|
||||
string argument = ev.argument;
|
||||
kb_action action = ev.action;
|
||||
@ -745,16 +745,16 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose)
|
||||
goto exit_with_message;
|
||||
}
|
||||
|
||||
if (owner->view()->available() && owner->view()->theLockingInset()) {
|
||||
if (view()->available() && view()->theLockingInset()) {
|
||||
UpdatableInset::RESULT result;
|
||||
if ((action > 1) || ((action == LFUN_UNKNOWN_ACTION) &&
|
||||
(!keyseq.deleted())))
|
||||
{
|
||||
UpdatableInset * inset = owner->view()->theLockingInset();
|
||||
UpdatableInset * inset = view()->theLockingInset();
|
||||
#if 1
|
||||
int inset_x;
|
||||
int dummy_y;
|
||||
inset->getCursorPos(owner->view().get(), inset_x, dummy_y);
|
||||
inset->getCursorPos(view(), inset_x, dummy_y);
|
||||
#endif
|
||||
if ((action == LFUN_UNKNOWN_ACTION)
|
||||
&& argument.empty()) {
|
||||
@ -762,14 +762,14 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose)
|
||||
}
|
||||
// Undo/Redo is a bit tricky for insets.
|
||||
if (action == LFUN_UNDO) {
|
||||
owner->view()->menuUndo();
|
||||
view()->menuUndo();
|
||||
goto exit_with_message;
|
||||
} else if (action == LFUN_REDO) {
|
||||
owner->view()->menuRedo();
|
||||
view()->menuRedo();
|
||||
goto exit_with_message;
|
||||
} else if (((result=inset->
|
||||
// Hand-over to inset's own dispatch:
|
||||
localDispatch(owner->view().get(), FuncRequest(action, argument))) ==
|
||||
localDispatch(FuncRequest(view(), action, argument))) ==
|
||||
UpdatableInset::DISPATCHED) ||
|
||||
(result == UpdatableInset::DISPATCHED_NOUPDATE))
|
||||
goto exit_with_message;
|
||||
@ -780,7 +780,7 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose)
|
||||
// FINISHED means that the cursor should be
|
||||
// one position after the inset.
|
||||
} else if (result == UpdatableInset::FINISHED_RIGHT) {
|
||||
TEXT()->cursorRight(owner->view().get());
|
||||
TEXT()->cursorRight(view());
|
||||
moveCursorUpdate(true, false);
|
||||
owner->view_state_changed();
|
||||
goto exit_with_message;
|
||||
@ -788,33 +788,33 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose)
|
||||
if (TEXT()->cursor.irow()->previous()) {
|
||||
#if 1
|
||||
TEXT()->setCursorFromCoordinates(
|
||||
owner->view().get(), TEXT()->cursor.ix() + inset_x,
|
||||
view(), TEXT()->cursor.ix() + inset_x,
|
||||
TEXT()->cursor.iy() -
|
||||
TEXT()->cursor.irow()->baseline() - 1);
|
||||
TEXT()->cursor.x_fix(TEXT()->cursor.x());
|
||||
#else
|
||||
TEXT()->cursorUp(owner->view().get());
|
||||
TEXT()->cursorUp(view());
|
||||
#endif
|
||||
moveCursorUpdate(true, false);
|
||||
owner->view_state_changed();
|
||||
} else {
|
||||
owner->view()->update(TEXT(), BufferView::SELECT|BufferView::FITCUR);
|
||||
view()->update(TEXT(), BufferView::SELECT|BufferView::FITCUR);
|
||||
}
|
||||
goto exit_with_message;
|
||||
} else if (result == UpdatableInset::FINISHED_DOWN) {
|
||||
if (TEXT()->cursor.irow()->next()) {
|
||||
#if 1
|
||||
TEXT()->setCursorFromCoordinates(
|
||||
owner->view().get(), TEXT()->cursor.ix() + inset_x,
|
||||
view(), TEXT()->cursor.ix() + inset_x,
|
||||
TEXT()->cursor.iy() -
|
||||
TEXT()->cursor.irow()->baseline() +
|
||||
TEXT()->cursor.irow()->height() + 1);
|
||||
TEXT()->cursor.x_fix(TEXT()->cursor.x());
|
||||
#else
|
||||
TEXT()->cursorDown(owner->view().get());
|
||||
TEXT()->cursorDown(view());
|
||||
#endif
|
||||
} else {
|
||||
TEXT()->cursorRight(owner->view().get());
|
||||
TEXT()->cursorRight(view());
|
||||
}
|
||||
moveCursorUpdate(true, false);
|
||||
owner->view_state_changed();
|
||||
@ -827,29 +827,29 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose)
|
||||
case LFUN_UNKNOWN_ACTION:
|
||||
case LFUN_BREAKPARAGRAPH:
|
||||
case LFUN_BREAKLINE:
|
||||
TEXT()->cursorRight(owner->view().get());
|
||||
owner->view()->switchKeyMap();
|
||||
TEXT()->cursorRight(view());
|
||||
view()->switchKeyMap();
|
||||
owner->view_state_changed();
|
||||
break;
|
||||
case LFUN_RIGHT:
|
||||
if (!TEXT()->cursor.par()->isRightToLeftPar(owner->buffer()->params)) {
|
||||
TEXT()->cursorRight(owner->view().get());
|
||||
TEXT()->cursorRight(view());
|
||||
moveCursorUpdate(true, false);
|
||||
owner->view_state_changed();
|
||||
}
|
||||
goto exit_with_message;
|
||||
case LFUN_LEFT:
|
||||
if (TEXT()->cursor.par()->isRightToLeftPar(owner->buffer()->params)) {
|
||||
TEXT()->cursorRight(owner->view().get());
|
||||
TEXT()->cursorRight(view());
|
||||
moveCursorUpdate(true, false);
|
||||
owner->view_state_changed();
|
||||
}
|
||||
goto exit_with_message;
|
||||
case LFUN_DOWN:
|
||||
if (TEXT()->cursor.row()->next())
|
||||
TEXT()->cursorDown(owner->view().get());
|
||||
TEXT()->cursorDown(view());
|
||||
else
|
||||
TEXT()->cursorRight(owner->view().get());
|
||||
TEXT()->cursorRight(view());
|
||||
moveCursorUpdate(true, false);
|
||||
owner->view_state_changed();
|
||||
goto exit_with_message;
|
||||
@ -864,20 +864,20 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose)
|
||||
|
||||
case LFUN_ESCAPE:
|
||||
{
|
||||
if (!owner->view()->available()) break;
|
||||
if (!view()->available()) break;
|
||||
// this function should be used always [asierra060396]
|
||||
UpdatableInset * tli =
|
||||
owner->view()->theLockingInset();
|
||||
view()->theLockingInset();
|
||||
if (tli) {
|
||||
UpdatableInset * lock = tli->getLockingInset();
|
||||
|
||||
if (tli == lock) {
|
||||
owner->view()->unlockInset(tli);
|
||||
TEXT()->cursorRight(owner->view().get());
|
||||
view()->unlockInset(tli);
|
||||
TEXT()->cursorRight(view());
|
||||
moveCursorUpdate(true, false);
|
||||
owner->view_state_changed();
|
||||
} else {
|
||||
tli->unlockInsetInInset(owner->view().get(),
|
||||
tli->unlockInsetInInset(view(),
|
||||
lock,
|
||||
true);
|
||||
}
|
||||
@ -902,16 +902,16 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose)
|
||||
}
|
||||
bool fw = (action == LFUN_WORDFINDBACKWARD);
|
||||
if (!searched_string.empty()) {
|
||||
lyxfind::LyXFind(owner->view().get(), searched_string, fw);
|
||||
lyxfind::LyXFind(view(), searched_string, fw);
|
||||
}
|
||||
// owner->view()->showCursor();
|
||||
// view()->showCursor();
|
||||
}
|
||||
break;
|
||||
|
||||
case LFUN_PREFIX:
|
||||
{
|
||||
if (owner->view()->available() && !owner->view()->theLockingInset()) {
|
||||
owner->view()->update(TEXT(),
|
||||
if (view()->available() && !view()->theLockingInset()) {
|
||||
view()->update(TEXT(),
|
||||
BufferView::SELECT|BufferView::FITCUR);
|
||||
}
|
||||
owner->message(keyseq.printOptions());
|
||||
@ -926,7 +926,7 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose)
|
||||
case LFUN_CANCEL: // RVDK_PATCH_5
|
||||
keyseq.reset();
|
||||
meta_fake_bit = key_modifier::none;
|
||||
if (owner->view()->available())
|
||||
if (view()->available())
|
||||
// cancel any selection
|
||||
dispatch(LFUN_MARK_OFF);
|
||||
setMessage(N_("Cancel"));
|
||||
@ -949,7 +949,7 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose)
|
||||
break;
|
||||
|
||||
case LFUN_CENTER: // this is center and redraw.
|
||||
owner->view()->center();
|
||||
view()->center();
|
||||
break;
|
||||
|
||||
// --- Menus -----------------------------------------------
|
||||
@ -971,15 +971,15 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose)
|
||||
s1 << _("Saving document") << ' '
|
||||
<< MakeDisplayPath(owner->buffer()->fileName() + "...");
|
||||
owner->message(s1.str().c_str());
|
||||
MenuWrite(owner->view().get(), owner->buffer());
|
||||
MenuWrite(view(), owner->buffer());
|
||||
s1 << _(" done.");
|
||||
owner->message(s1.str().c_str());
|
||||
} else
|
||||
WriteAs(owner->view().get(), owner->buffer());
|
||||
WriteAs(view(), owner->buffer());
|
||||
break;
|
||||
|
||||
case LFUN_WRITEAS:
|
||||
WriteAs(owner->view().get(), owner->buffer(), argument);
|
||||
WriteAs(view(), owner->buffer(), argument);
|
||||
break;
|
||||
|
||||
case LFUN_MENURELOAD:
|
||||
@ -1047,15 +1047,15 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose)
|
||||
}
|
||||
|
||||
case LFUN_AUTOSAVE:
|
||||
AutoSave(owner->view().get());
|
||||
AutoSave(view());
|
||||
break;
|
||||
|
||||
case LFUN_UNDO:
|
||||
owner->view()->menuUndo();
|
||||
view()->menuUndo();
|
||||
break;
|
||||
|
||||
case LFUN_REDO:
|
||||
owner->view()->menuRedo();
|
||||
view()->menuRedo();
|
||||
break;
|
||||
|
||||
case LFUN_MENUSEARCH:
|
||||
@ -1063,19 +1063,19 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose)
|
||||
break;
|
||||
|
||||
case LFUN_REMOVEERRORS:
|
||||
if (owner->view()->removeAutoInsets()) {
|
||||
if (view()->removeAutoInsets()) {
|
||||
#warning repaint() or update() or nothing ?
|
||||
owner->view()->repaint();
|
||||
owner->view()->fitCursor();
|
||||
view()->repaint();
|
||||
view()->fitCursor();
|
||||
}
|
||||
break;
|
||||
|
||||
case LFUN_DEPTH_MIN:
|
||||
changeDepth(owner->view().get(), TEXT(false), -1);
|
||||
changeDepth(view(), TEXT(false), -1);
|
||||
break;
|
||||
|
||||
case LFUN_DEPTH_PLUS:
|
||||
changeDepth(owner->view().get(), TEXT(false), 1);
|
||||
changeDepth(view(), TEXT(false), 1);
|
||||
break;
|
||||
|
||||
case LFUN_FREE:
|
||||
@ -1083,19 +1083,19 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose)
|
||||
break;
|
||||
|
||||
case LFUN_RECONFIGURE:
|
||||
Reconfigure(owner->view().get());
|
||||
Reconfigure(view());
|
||||
break;
|
||||
|
||||
#if 0
|
||||
case LFUN_FLOATSOPERATE:
|
||||
if (argument == "openfoot")
|
||||
owner->view()->allFloats(1,0);
|
||||
view()->allFloats(1,0);
|
||||
else if (argument == "closefoot")
|
||||
owner->view()->allFloats(0,0);
|
||||
view()->allFloats(0,0);
|
||||
else if (argument == "openfig")
|
||||
owner->view()->allFloats(1,1);
|
||||
view()->allFloats(1,1);
|
||||
else if (argument == "closefig")
|
||||
owner->view()->allFloats(0,1);
|
||||
view()->allFloats(0,1);
|
||||
break;
|
||||
#else
|
||||
#ifdef WITH_WARNINGS
|
||||
@ -1129,7 +1129,7 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose)
|
||||
str << _("Opening help file") << ' '
|
||||
<< MakeDisplayPath(fname) << "...";
|
||||
owner->message(str.str().c_str());
|
||||
owner->view()->buffer(bufferlist.loadLyXFile(fname, false));
|
||||
view()->buffer(bufferlist.loadLyXFile(fname, false));
|
||||
owner->allowInput();
|
||||
break;
|
||||
}
|
||||
@ -1179,7 +1179,7 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose)
|
||||
// --- buffers ----------------------------------------
|
||||
|
||||
case LFUN_SWITCHBUFFER:
|
||||
owner->view()->buffer(bufferlist.getBuffer(argument));
|
||||
view()->buffer(bufferlist.getBuffer(argument));
|
||||
break;
|
||||
|
||||
case LFUN_FILE_NEW:
|
||||
@ -1187,7 +1187,7 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose)
|
||||
// servercmd: argument must be <file>:<template>
|
||||
Buffer * tmpbuf = NewFile(argument);
|
||||
if (tmpbuf)
|
||||
owner->view()->buffer(tmpbuf);
|
||||
view()->buffer(tmpbuf);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -1212,16 +1212,16 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose)
|
||||
break;
|
||||
|
||||
case LFUN_LAYOUT_TABULAR:
|
||||
if (owner->view()->theLockingInset()) {
|
||||
if (owner->view()->theLockingInset()->lyxCode()==Inset::TABULAR_CODE) {
|
||||
if (view()->theLockingInset()) {
|
||||
if (view()->theLockingInset()->lyxCode()==Inset::TABULAR_CODE) {
|
||||
InsetTabular * inset = static_cast<InsetTabular *>
|
||||
(owner->view()->theLockingInset());
|
||||
inset->openLayoutDialog(owner->view().get());
|
||||
} else if (owner->view()->theLockingInset()->
|
||||
(view()->theLockingInset());
|
||||
inset->openLayoutDialog(view());
|
||||
} else if (view()->theLockingInset()->
|
||||
getFirstLockingInsetOfType(Inset::TABULAR_CODE)!=0) {
|
||||
InsetTabular * inset = static_cast<InsetTabular *>(
|
||||
owner->view()->theLockingInset()->getFirstLockingInsetOfType(Inset::TABULAR_CODE));
|
||||
inset->openLayoutDialog(owner->view().get());
|
||||
view()->theLockingInset()->getFirstLockingInsetOfType(Inset::TABULAR_CODE));
|
||||
inset->openLayoutDialog(view());
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -1270,16 +1270,16 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose)
|
||||
|
||||
// Either change buffer or load the file
|
||||
if (bufferlist.exists(s)) {
|
||||
owner->view()->buffer(bufferlist.getBuffer(s));
|
||||
view()->buffer(bufferlist.getBuffer(s));
|
||||
} else {
|
||||
owner->view()->buffer(bufferlist.loadLyXFile(s));
|
||||
view()->buffer(bufferlist.loadLyXFile(s));
|
||||
}
|
||||
|
||||
owner->view()->setCursorFromRow(row);
|
||||
view()->setCursorFromRow(row);
|
||||
|
||||
owner->view()->center();
|
||||
view()->center();
|
||||
// see BufferView_pimpl::center()
|
||||
owner->view()->updateScrollbar();
|
||||
view()->updateScrollbar();
|
||||
}
|
||||
break;
|
||||
|
||||
@ -1299,19 +1299,19 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose)
|
||||
<< " found." << endl;
|
||||
}
|
||||
|
||||
if (owner->view()->theLockingInset())
|
||||
owner->view()->unlockInset(owner->view()->theLockingInset());
|
||||
if (view()->theLockingInset())
|
||||
view()->unlockInset(view()->theLockingInset());
|
||||
if (par->inInset()) {
|
||||
par->inInset()->edit(owner->view().get());
|
||||
par->inInset()->edit(view());
|
||||
}
|
||||
// Set the cursor
|
||||
owner->view()->getLyXText()->setCursor(owner->view().get(), par, 0);
|
||||
owner->view()->switchKeyMap();
|
||||
view()->getLyXText()->setCursor(view(), par, 0);
|
||||
view()->switchKeyMap();
|
||||
owner->view_state_changed();
|
||||
|
||||
owner->view()->center();
|
||||
view()->center();
|
||||
// see BufferView_pimpl::center()
|
||||
owner->view()->updateScrollbar();
|
||||
view()->updateScrollbar();
|
||||
}
|
||||
break;
|
||||
|
||||
@ -1337,10 +1337,10 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose)
|
||||
|
||||
// passthrough hat and underscore outside mathed:
|
||||
case LFUN_SUBSCRIPT:
|
||||
dispatch(FuncRequest(LFUN_SELFINSERT, "_"));
|
||||
dispatch(FuncRequest(view(), LFUN_SELFINSERT, "_"));
|
||||
break;
|
||||
case LFUN_SUPERSCRIPT:
|
||||
dispatch(FuncRequest(LFUN_SELFINSERT, "^"));
|
||||
dispatch(FuncRequest(view(), LFUN_SELFINSERT, "^"));
|
||||
break;
|
||||
|
||||
case LFUN_MATH_PANEL:
|
||||
@ -1362,7 +1362,7 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose)
|
||||
} else {
|
||||
p.setContents(argument);
|
||||
}
|
||||
dispatch(FuncRequest(LFUN_CITATION_INSERT, p.getAsString()));
|
||||
dispatch(FuncRequest(view(), LFUN_CITATION_INSERT, p.getAsString()));
|
||||
} else
|
||||
owner->getDialogs().createCitation(p.getAsString());
|
||||
}
|
||||
@ -1375,11 +1375,11 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose)
|
||||
owner->buffer()->filePath());
|
||||
setMessage(N_("Opening child document ") +
|
||||
MakeDisplayPath(filename) + "...");
|
||||
owner->view()->savePosition(0);
|
||||
view()->savePosition(0);
|
||||
if (bufferlist.exists(filename))
|
||||
owner->view()->buffer(bufferlist.getBuffer(filename));
|
||||
view()->buffer(bufferlist.getBuffer(filename));
|
||||
else
|
||||
owner->view()->buffer(bufferlist.loadLyXFile(filename));
|
||||
view()->buffer(bufferlist.loadLyXFile(filename));
|
||||
}
|
||||
break;
|
||||
|
||||
@ -1437,8 +1437,8 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose)
|
||||
// Of course we should only do the resize and the textcache.clear
|
||||
// if values really changed...but not very important right now. (Lgb)
|
||||
// All visible buffers will need resize
|
||||
owner->view()->resize();
|
||||
owner->view()->repaint();
|
||||
view()->resize();
|
||||
view()->repaint();
|
||||
}
|
||||
break;
|
||||
|
||||
@ -1477,7 +1477,7 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose)
|
||||
#endif
|
||||
}
|
||||
|
||||
owner->view()->repaint();
|
||||
view()->repaint();
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1507,7 +1507,7 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose)
|
||||
default:
|
||||
// Then if it was none of the above
|
||||
// Trying the BufferView::pimpl dispatch:
|
||||
if (!owner->view()->dispatch(ev))
|
||||
if (!view()->dispatch(ev))
|
||||
lyxerr << "A truly unknown func ["
|
||||
<< lyxaction.getActionName(ev.action) << "]!"
|
||||
<< endl;
|
||||
@ -1583,7 +1583,7 @@ void LyXFunc::menuNew(string const & name, bool fromTemplate)
|
||||
string initpath = lyxrc.document_path;
|
||||
string filename(name);
|
||||
|
||||
if (owner->view()->available()) {
|
||||
if (view()->available()) {
|
||||
string const trypath = owner->buffer()->filePath();
|
||||
// If directory is writeable, use this as default.
|
||||
if (IsDirWriteable(trypath))
|
||||
@ -1629,7 +1629,7 @@ void LyXFunc::menuNew(string const & name, bool fromTemplate)
|
||||
templname = fname;
|
||||
}
|
||||
|
||||
owner->view()->buffer(bufferlist.newFile(filename, templname, !name.empty()));
|
||||
view()->buffer(bufferlist.newFile(filename, templname, !name.empty()));
|
||||
}
|
||||
|
||||
|
||||
@ -1637,7 +1637,7 @@ void LyXFunc::open(string const & fname)
|
||||
{
|
||||
string initpath = lyxrc.document_path;
|
||||
|
||||
if (owner->view()->available()) {
|
||||
if (view()->available()) {
|
||||
string const trypath = owner->buffer()->filePath();
|
||||
// If directory is writeable, use this as default.
|
||||
if (IsDirWriteable(trypath))
|
||||
@ -1690,7 +1690,7 @@ void LyXFunc::open(string const & fname)
|
||||
}
|
||||
// the user specifically chose this name. Believe them.
|
||||
Buffer * buffer = bufferlist.newFile(filename, "", true);
|
||||
owner->view()->buffer(buffer);
|
||||
view()->buffer(buffer);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1701,7 +1701,7 @@ void LyXFunc::open(string const & fname)
|
||||
|
||||
Buffer * openbuf = bufferlist.loadLyXFile(filename);
|
||||
if (openbuf) {
|
||||
owner->view()->buffer(openbuf);
|
||||
view()->buffer(openbuf);
|
||||
ostringstream str;
|
||||
str << _("Document") << ' ' << disp_fn << ' ' << _("opened.");
|
||||
owner->message(str.str().c_str());
|
||||
@ -1725,7 +1725,7 @@ void LyXFunc::doImport(string const & argument)
|
||||
if (filename.empty()) {
|
||||
string initpath = lyxrc.document_path;
|
||||
|
||||
if (owner->view()->available()) {
|
||||
if (view()->available()) {
|
||||
string const trypath = owner->buffer()->filePath();
|
||||
// If directory is writeable, use this as default.
|
||||
if (IsDirWriteable(trypath))
|
||||
@ -1780,7 +1780,7 @@ void LyXFunc::doImport(string const & argument)
|
||||
return;
|
||||
break;
|
||||
case 2:
|
||||
owner->view()->buffer(bufferlist.getBuffer(lyxfile));
|
||||
view()->buffer(bufferlist.getBuffer(lyxfile));
|
||||
return;
|
||||
case 3:
|
||||
owner->message(_("Canceled."));
|
||||
@ -1806,7 +1806,7 @@ void LyXFunc::reloadBuffer()
|
||||
{
|
||||
string const fn = owner->buffer()->fileName();
|
||||
if (bufferlist.close(owner->buffer()))
|
||||
owner->view()->buffer(bufferlist.loadLyXFile(fn));
|
||||
view()->buffer(bufferlist.loadLyXFile(fn));
|
||||
}
|
||||
|
||||
|
||||
@ -1819,7 +1819,7 @@ void LyXFunc::closeBuffer()
|
||||
// since there's no current buffer
|
||||
owner->getDialogs().hideBufferDependent();
|
||||
} else {
|
||||
owner->view()->buffer(bufferlist.first());
|
||||
view()->buffer(bufferlist.first());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1863,8 +1863,14 @@ string const LyXFunc::view_status_message()
|
||||
return keyseq.printOptions();
|
||||
}
|
||||
|
||||
if (!owner->view()->available())
|
||||
if (!view()->available())
|
||||
return _("Welcome to LyX!");
|
||||
|
||||
return currentState(owner->view().get());
|
||||
return currentState(view());
|
||||
}
|
||||
|
||||
|
||||
BufferView * LyXFunc::view() const
|
||||
{
|
||||
return owner->view().get();
|
||||
}
|
||||
|
@ -17,6 +17,7 @@
|
||||
class LyXView;
|
||||
class LyXText;
|
||||
class FuncRequest;
|
||||
class BufferView;
|
||||
|
||||
|
||||
/** This class encapsulates all the LyX command operations.
|
||||
@ -71,6 +72,9 @@ public:
|
||||
void handleKeyFunc(kb_action action);
|
||||
|
||||
private:
|
||||
///
|
||||
BufferView * view() const;
|
||||
|
||||
///
|
||||
LyXView * owner;
|
||||
///
|
||||
|
12
src/lyxvc.C
12
src/lyxvc.C
@ -9,8 +9,8 @@
|
||||
#include "debug.h"
|
||||
#include "buffer.h"
|
||||
#include "BufferView.h"
|
||||
#include "lyxfunc.h"
|
||||
#include "gettext.h"
|
||||
#include "funcrequest.h"
|
||||
|
||||
#include "frontends/Alert.h"
|
||||
#include "frontends/LyXView.h"
|
||||
@ -113,14 +113,13 @@ void LyXVC::registrer()
|
||||
MakeDisplayPath(filename, 50),
|
||||
_("Save document and proceed?"))) {
|
||||
vcs->owner()->getUser()->owner()
|
||||
->getLyXFunc().dispatch(LFUN_MENUWRITE);
|
||||
->dispatch(FuncRequest(LFUN_MENUWRITE));
|
||||
}
|
||||
|
||||
// Maybe the save fails, or we answered "no". In both cases,
|
||||
// the document will be dirty, and we abort.
|
||||
if (!vcs->owner()->isClean()) {
|
||||
if (!vcs->owner()->isClean())
|
||||
return;
|
||||
}
|
||||
|
||||
lyxerr[Debug::LYXVC] << "LyXVC: registrer" << endl;
|
||||
pair<bool, string> tmp =
|
||||
@ -146,14 +145,13 @@ void LyXVC::checkIn()
|
||||
MakeDisplayPath(vcs->owner()->fileName(), 50),
|
||||
_("Save document and proceed?"))) {
|
||||
vcs->owner()->getUser()->owner()
|
||||
->getLyXFunc().dispatch(LFUN_MENUWRITE);
|
||||
->dispatch(FuncRequest(LFUN_MENUWRITE));
|
||||
}
|
||||
|
||||
// Maybe the save fails, or we answered "no". In both cases,
|
||||
// the document will be dirty, and we abort.
|
||||
if (!vcs->owner()->isClean()) {
|
||||
if (!vcs->owner()->isClean())
|
||||
return;
|
||||
}
|
||||
|
||||
lyxerr[Debug::LYXVC] << "LyXVC: checkIn" << endl;
|
||||
pair<bool, string> tmp = Alert::askForText(_("LyX VC: Log Message"));
|
||||
|
@ -251,55 +251,19 @@ vector<string> const InsetFormula::getLabelList() const
|
||||
|
||||
|
||||
UpdatableInset::RESULT
|
||||
InsetFormula::localDispatch(BufferView * bv, FuncRequest const & ev)
|
||||
InsetFormula::localDispatch(FuncRequest const & ev)
|
||||
{
|
||||
RESULT result = DISPATCHED;
|
||||
BufferView *bv = ev.view();
|
||||
|
||||
switch (ev.action) {
|
||||
|
||||
case LFUN_BREAKLINE:
|
||||
bv->lockedInsetStoreUndo(Undo::INSERT);
|
||||
mathcursor->breakLine();
|
||||
mathcursor->normalize();
|
||||
updateLocal(bv, true);
|
||||
break;
|
||||
|
||||
case LFUN_MATH_NUMBER:
|
||||
{
|
||||
if (!hull())
|
||||
break;
|
||||
//lyxerr << "toggling all numbers\n";
|
||||
if (display()) {
|
||||
bv->lockedInsetStoreUndo(Undo::INSERT);
|
||||
bool old = par()->numberedType();
|
||||
for (MathInset::row_type row = 0; row < par_->nrows(); ++row)
|
||||
hull()->numbered(row, !old);
|
||||
bv->owner()->message(old ? _("No number") : _("Number"));
|
||||
updateLocal(bv, true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case LFUN_MATH_NONUMBER:
|
||||
{
|
||||
//lyxerr << "toggling line number\n";
|
||||
if (display()) {
|
||||
bv->lockedInsetStoreUndo(Undo::INSERT);
|
||||
MathCursor::row_type row = mathcursor->hullRow();
|
||||
bool old = hull()->numbered(row);
|
||||
bv->owner()->message(old ? _("No number") : _("Number"));
|
||||
hull()->numbered(row, !old);
|
||||
updateLocal(bv, true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case LFUN_INSERT_LABEL:
|
||||
{
|
||||
if (!hull())
|
||||
break;
|
||||
|
||||
bv->lockedInsetStoreUndo(Undo::INSERT);
|
||||
bv->lockedInsetStoreUndo(Undo::EDIT);
|
||||
|
||||
MathCursor::row_type row = mathcursor->hullRow();
|
||||
string old_label = hull()->label(row);
|
||||
@ -383,7 +347,7 @@ InsetFormula::localDispatch(BufferView * bv, FuncRequest const & ev)
|
||||
}
|
||||
|
||||
default:
|
||||
result = InsetFormulaBase::localDispatch(bv, ev);
|
||||
result = InsetFormulaBase::localDispatch(ev);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -72,7 +72,7 @@ public:
|
||||
///
|
||||
bool insetAllowed(Inset::Code code) const;
|
||||
///
|
||||
virtual RESULT localDispatch(BufferView *, FuncRequest const &);
|
||||
virtual RESULT localDispatch(FuncRequest const &);
|
||||
///
|
||||
std::vector<string> const getLabelList() const;
|
||||
///
|
||||
|
@ -118,7 +118,7 @@ void InsetFormulaBase::mutateToText()
|
||||
view_->owner()->getIntl()->getTransManager().TranslateAndInsert(*cit, lt);
|
||||
|
||||
// remove ourselves
|
||||
//view_->owner()->getLyXFunc().dispatch(LFUN_ESCAPE);
|
||||
//view_->owner()->dispatch(LFUN_ESCAPE);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -299,7 +299,7 @@ bool InsetFormulaBase::insetButtonRelease(BufferView * bv,
|
||||
|
||||
if (button == mouse_button::button3) {
|
||||
// try to dispatch to enclosed insets first
|
||||
if (mathcursor->dispatch(FuncRequest(LFUN_MOUSE_RELEASE, x, y, 3)))
|
||||
if (mathcursor->dispatch(FuncRequest(bv, LFUN_MOUSE_RELEASE, x, y, 3)))
|
||||
return true;
|
||||
|
||||
// launch math panel for right mouse button
|
||||
@ -309,7 +309,7 @@ bool InsetFormulaBase::insetButtonRelease(BufferView * bv,
|
||||
|
||||
if (button == mouse_button::button1) {
|
||||
// try to dispatch to enclosed insets first
|
||||
if (mathcursor->dispatch(FuncRequest(LFUN_MOUSE_RELEASE, x, y, 1)))
|
||||
if (mathcursor->dispatch(FuncRequest(bv, LFUN_MOUSE_RELEASE, x, y, 1)))
|
||||
return true;
|
||||
|
||||
// try to set the cursor
|
||||
@ -343,14 +343,14 @@ void InsetFormulaBase::insetButtonPress(BufferView * bv,
|
||||
mathcursor->selClear();
|
||||
mathcursor->setPos(x + xo_, y + yo_);
|
||||
|
||||
if (mathcursor->dispatch(FuncRequest(LFUN_MOUSE_PRESS, x, y, 1))) {
|
||||
if (mathcursor->dispatch(FuncRequest(bv, LFUN_MOUSE_PRESS, x, y, 1))) {
|
||||
//delete mathcursor;
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
if (button == mouse_button::button3) {
|
||||
if (mathcursor->dispatch(FuncRequest(LFUN_MOUSE_PRESS, x, y, 3))) {
|
||||
if (mathcursor->dispatch(FuncRequest(bv, LFUN_MOUSE_PRESS, x, y, 3))) {
|
||||
//delete mathcursor;
|
||||
return;
|
||||
}
|
||||
@ -366,11 +366,11 @@ void InsetFormulaBase::insetMotionNotify(BufferView * bv,
|
||||
return;
|
||||
|
||||
if (button == mouse_button::button1)
|
||||
if (mathcursor->dispatch(FuncRequest(LFUN_MOUSE_MOTION, x, y, 1)))
|
||||
if (mathcursor->dispatch(FuncRequest(bv, LFUN_MOUSE_MOTION, x, y, 1)))
|
||||
return;
|
||||
|
||||
if (button == mouse_button::button3)
|
||||
if (mathcursor->dispatch(FuncRequest(LFUN_MOUSE_MOTION, x, y, 3)))
|
||||
if (mathcursor->dispatch(FuncRequest(bv, LFUN_MOUSE_MOTION, x, y, 3)))
|
||||
return;
|
||||
|
||||
if (abs(x - first_x) < 2 && abs(y - first_y) < 2) {
|
||||
@ -393,7 +393,7 @@ void InsetFormulaBase::insetMotionNotify(BufferView * bv,
|
||||
|
||||
|
||||
UpdatableInset::RESULT
|
||||
InsetFormulaBase::localDispatch(BufferView * bv, FuncRequest const & ev)
|
||||
InsetFormulaBase::localDispatch(FuncRequest const & ev)
|
||||
{
|
||||
//lyxerr << "InsetFormulaBase::localDispatch: act: " << action
|
||||
// << " arg: '" << arg
|
||||
@ -402,6 +402,7 @@ InsetFormulaBase::localDispatch(BufferView * bv, FuncRequest const & ev)
|
||||
if (!mathcursor)
|
||||
return UNDISPATCHED;
|
||||
|
||||
BufferView * bv = ev.view();
|
||||
string argument = ev.argument;
|
||||
RESULT result = DISPATCHED;
|
||||
bool sel = false;
|
||||
@ -415,6 +416,16 @@ InsetFormulaBase::localDispatch(BufferView * bv, FuncRequest const & ev)
|
||||
|
||||
switch (ev.action) {
|
||||
|
||||
case LFUN_MATH_NUMBER:
|
||||
case LFUN_MATH_NONUMBER:
|
||||
case LFUN_TABINSERT:
|
||||
case LFUN_BREAKLINE:
|
||||
case LFUN_DELETE_LINE_FORWARD:
|
||||
bv->lockedInsetStoreUndo(Undo::EDIT);
|
||||
mathcursor->dispatch(ev);
|
||||
updateLocal(bv, true);
|
||||
break;
|
||||
|
||||
case LFUN_WORDRIGHTSEL:
|
||||
case LFUN_RIGHTSEL:
|
||||
sel = true; // fall through...
|
||||
@ -475,12 +486,6 @@ InsetFormulaBase::localDispatch(BufferView * bv, FuncRequest const & ev)
|
||||
updateLocal(bv, false);
|
||||
break;
|
||||
|
||||
case LFUN_DELETE_LINE_FORWARD:
|
||||
bv->lockedInsetStoreUndo(Undo::DELETE);
|
||||
mathcursor->delLine();
|
||||
updateLocal(bv, true);
|
||||
break;
|
||||
|
||||
case LFUN_TAB:
|
||||
mathcursor->idxNext();
|
||||
updateLocal(bv, false);
|
||||
@ -491,12 +496,6 @@ InsetFormulaBase::localDispatch(BufferView * bv, FuncRequest const & ev)
|
||||
updateLocal(bv, false);
|
||||
break;
|
||||
|
||||
case LFUN_TABINSERT:
|
||||
bv->lockedInsetStoreUndo(Undo::EDIT);
|
||||
mathcursor->splitCell();
|
||||
updateLocal(bv, true);
|
||||
break;
|
||||
|
||||
case LFUN_DELETE_WORD_BACKWARD:
|
||||
case LFUN_BACKSPACE:
|
||||
bv->lockedInsetStoreUndo(Undo::DELETE);
|
||||
@ -936,8 +935,8 @@ void mathDispatchCreation(BufferView * bv, string const & arg, bool display)
|
||||
// always changing to mathrm when opening an inlined inset
|
||||
// -- I really hate "LyXfunc overloading"...
|
||||
if (display)
|
||||
f->localDispatch(bv, FuncRequest(LFUN_MATH_DISPLAY));
|
||||
f->localDispatch(bv, FuncRequest(LFUN_INSERT_MATH, arg));
|
||||
f->localDispatch(FuncRequest(bv, LFUN_MATH_DISPLAY));
|
||||
f->localDispatch(FuncRequest(bv, LFUN_INSERT_MATH, arg));
|
||||
}
|
||||
} else {
|
||||
// create a macro if we see "\\newcommand" somewhere, and an ordinary
|
||||
@ -995,7 +994,7 @@ void mathDispatchMathDelim(BufferView * bv, string const & arg)
|
||||
InsetFormula * f = new InsetFormula(bv);
|
||||
if (openNewInset(bv, f)) {
|
||||
f->mutate("simple");
|
||||
bv->theLockingInset()->localDispatch(bv, FuncRequest(LFUN_MATH_DELIM, arg));
|
||||
bv->theLockingInset()->localDispatch(FuncRequest(bv, LFUN_MATH_DELIM, arg));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1007,7 +1006,7 @@ void mathDispatchInsertMatrix(BufferView * bv, string const & arg)
|
||||
InsetFormula * f = new InsetFormula(bv);
|
||||
if (openNewInset(bv, f)) {
|
||||
f->mutate("simple");
|
||||
bv->theLockingInset()->localDispatch(bv, FuncRequest(LFUN_INSERT_MATRIX, arg));
|
||||
bv->theLockingInset()->localDispatch(FuncRequest(bv, LFUN_INSERT_MATRIX, arg));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1019,7 +1018,7 @@ void mathDispatchInsertMath(BufferView * bv, string const & arg)
|
||||
InsetFormula * f = new InsetFormula(bv);
|
||||
if (openNewInset(bv, f)) {
|
||||
f->mutate("simple");
|
||||
bv->theLockingInset()->localDispatch(bv, FuncRequest(LFUN_INSERT_MATH, arg));
|
||||
bv->theLockingInset()->localDispatch(FuncRequest(bv, LFUN_INSERT_MATH, arg));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1031,7 +1030,7 @@ void mathDispatchGreek(BufferView * bv, string const & arg)
|
||||
InsetFormula * f = new InsetFormula(bv);
|
||||
if (openNewInset(bv, f)) {
|
||||
f->mutate("simple");
|
||||
bv->theLockingInset()->localDispatch(bv, FuncRequest(LFUN_GREEK, arg));
|
||||
bv->theLockingInset()->localDispatch(FuncRequest(bv, LFUN_GREEK, arg));
|
||||
bv->unlockInset(f);
|
||||
}
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ public:
|
||||
virtual void insetUnlock(BufferView *);
|
||||
|
||||
/// To allow transparent use of math editing functions
|
||||
virtual RESULT localDispatch(BufferView *, FuncRequest const &);
|
||||
virtual RESULT localDispatch(FuncRequest const &);
|
||||
|
||||
///
|
||||
virtual std::vector<string> const getLabelList() const;
|
||||
|
@ -520,30 +520,6 @@ void MathCursor::erase()
|
||||
}
|
||||
|
||||
|
||||
void MathCursor::delLine()
|
||||
{
|
||||
autocorrect_ = false;
|
||||
macroModeClose();
|
||||
|
||||
if (selection_) {
|
||||
selDel();
|
||||
return;
|
||||
}
|
||||
|
||||
if (par()->nrows() > 1) {
|
||||
// grid are the only things with more than one row...
|
||||
lyx::Assert(par()->asGridInset());
|
||||
par()->asGridInset()->delRow(hullRow());
|
||||
}
|
||||
|
||||
if (idx() >= par()->nargs())
|
||||
idx() = par()->nargs() - 1;
|
||||
|
||||
if (pos() > size())
|
||||
pos() = size();
|
||||
}
|
||||
|
||||
|
||||
bool MathCursor::up(bool sel)
|
||||
{
|
||||
dump("up 1");
|
||||
@ -807,6 +783,13 @@ MathHullInset * MathCursor::enclosingHull(MathCursor::idx_type & idx) const
|
||||
}
|
||||
|
||||
|
||||
void MathCursor::popToHere(MathInset const * p)
|
||||
{
|
||||
while (depth() && Cursor_.back().par_ != p)
|
||||
Cursor_.pop_back();
|
||||
}
|
||||
|
||||
|
||||
void MathCursor::popToEnclosingGrid()
|
||||
{
|
||||
while (depth() && !Cursor_.back().par_->asGridInset())
|
||||
@ -973,57 +956,6 @@ void MathCursor::idxPrev()
|
||||
}
|
||||
|
||||
|
||||
void MathCursor::splitCell()
|
||||
{
|
||||
if (idx() + 1 == par()->nargs())
|
||||
return;
|
||||
MathArray ar = array();
|
||||
ar.erase(0, pos());
|
||||
array().erase(pos(), size());
|
||||
++idx();
|
||||
pos() = 0;
|
||||
array().insert(0, ar);
|
||||
}
|
||||
|
||||
|
||||
void MathCursor::breakLine()
|
||||
{
|
||||
// leave inner cells
|
||||
while (popRight())
|
||||
;
|
||||
|
||||
idx_type dummy;
|
||||
MathHullInset * p = enclosingHull(dummy);
|
||||
if (!p)
|
||||
return;
|
||||
|
||||
if (p->getType() == "simple" || p->getType() == "equation") {
|
||||
p->mutate("eqnarray");
|
||||
idx() = 1;
|
||||
pos() = 0;
|
||||
} else {
|
||||
p->addRow(hullRow());
|
||||
|
||||
// split line
|
||||
const row_type r = hullRow();
|
||||
for (col_type c = hullCol() + 1; c < p->ncols(); ++c)
|
||||
std::swap(p->cell(p->index(r, c)), p->cell(p->index(r + 1, c)));
|
||||
|
||||
// split cell
|
||||
splitCell();
|
||||
std::swap(p->cell(idx()), p->cell(idx() + p->ncols() - 1));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//void MathCursor::readLine(MathArray & ar) const
|
||||
//{
|
||||
// idx_type base = row() * par()->ncols();
|
||||
// for (idx_type off = 0; off < par()->ncols(); ++off)
|
||||
// ar.push_back(par()->cell(base + off));
|
||||
//}
|
||||
|
||||
|
||||
char MathCursor::valign() const
|
||||
{
|
||||
idx_type idx;
|
||||
@ -1637,7 +1569,6 @@ void MathCursor::handleExtern(const string & arg)
|
||||
if (extra.empty())
|
||||
extra = "noextra";
|
||||
|
||||
|
||||
if (selection()) {
|
||||
MathArray ar;
|
||||
selGet(ar);
|
||||
@ -1690,10 +1621,13 @@ void MathCursor::handleExtern(const string & arg)
|
||||
idxLineLast();
|
||||
MathArray ar = cursor().cell();
|
||||
lyxerr << "use cell: " << ar << "\n";
|
||||
breakLine();
|
||||
idxRight();
|
||||
#ifdef WITH_WARNINGS
|
||||
#warning temporarily disabled
|
||||
#endif
|
||||
//breakLine();
|
||||
//idxRight();
|
||||
cursor().cell() = eq;
|
||||
idxRight();
|
||||
//idxRight();
|
||||
cursor().cell() = pipeThroughExtern(lang, extra, ar);
|
||||
idxLineLast();
|
||||
}
|
||||
@ -1701,24 +1635,36 @@ void MathCursor::handleExtern(const string & arg)
|
||||
}
|
||||
|
||||
|
||||
int MathCursor::dispatch(FuncRequest const & cmd)
|
||||
MathInset::result_type MathCursor::dispatch(FuncRequest const & cmd)
|
||||
{
|
||||
// try to dispatch to adajcent items if they are not editable
|
||||
// actually, this should only happen for mouse clicks...
|
||||
if (hasNextAtom() && !openable(nextAtom(), false))
|
||||
if (int res = nextAtom().nucleus()->dispatch(cmd, 0, 0))
|
||||
idx_type d1;
|
||||
pos_type d2;
|
||||
if (hasNextAtom() && !openable(nextAtom(), false)) {
|
||||
MathInset::result_type res = nextAtom().nucleus()->dispatch(cmd, d1, d2);
|
||||
if (res != MathInset::UNDISPATCHED)
|
||||
return res;
|
||||
if (hasPrevAtom() && !openable(prevAtom(), false))
|
||||
if (int res = prevAtom().nucleus()->dispatch(cmd, 0, 0))
|
||||
}
|
||||
if (hasPrevAtom() && !openable(prevAtom(), false)) {
|
||||
MathInset::result_type res = prevAtom().nucleus()->dispatch(cmd, d1, d2);
|
||||
if (res != MathInset::UNDISPATCHED)
|
||||
return res;
|
||||
}
|
||||
|
||||
for (int i = Cursor_.size() - 1; i >= 0; --i) {
|
||||
MathCursorPos & pos = Cursor_[i];
|
||||
int const res = pos.par_->dispatch(cmd, pos.idx_, pos.pos_);
|
||||
if (res)
|
||||
MathInset::result_type const res
|
||||
= pos.par_->dispatch(cmd, pos.idx_, pos.pos_);
|
||||
if (res != MathInset::UNDISPATCHED) {
|
||||
if (res == MathInset::DISPATCHED_POP) {
|
||||
Cursor_.shrink(i + 1);
|
||||
selClear();
|
||||
}
|
||||
return res;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
return MathInset::UNDISPATCHED;
|
||||
}
|
||||
|
||||
|
||||
|
@ -99,8 +99,6 @@ public:
|
||||
///
|
||||
void niceInsert(MathAtom const &);
|
||||
|
||||
///
|
||||
void delLine();
|
||||
/// in pixels from top of screen
|
||||
void setPos(int x, int y);
|
||||
/// in pixels from top of screen
|
||||
@ -115,6 +113,8 @@ public:
|
||||
void popToEnclosingGrid();
|
||||
/// go up to the hull inset
|
||||
void popToEnclosingHull();
|
||||
/// go up to the hull inset
|
||||
void popToHere(MathInset const * p);
|
||||
///
|
||||
InsetFormulaBase * formula() const;
|
||||
/// current offset in the current cell
|
||||
@ -169,12 +169,6 @@ public:
|
||||
void drawSelection(MathPainterInfo & pain) const;
|
||||
///
|
||||
void handleNest(MathAtom const & at);
|
||||
/// splits cells and shifts right part to the next cell
|
||||
void splitCell();
|
||||
/// splits line and insert new row of cell
|
||||
void breakLine();
|
||||
/// read contents of line into an array
|
||||
void readLine(MathArray & ar) const;
|
||||
/// remove this as soon as LyXFunc::getStatus is "localized"
|
||||
string getLastCode() const { return "mathnormal"; }
|
||||
///
|
||||
@ -238,7 +232,7 @@ public:
|
||||
unsigned depth() const;
|
||||
|
||||
/// local dispatcher
|
||||
int dispatch(FuncRequest const & cmd);
|
||||
MathInset::result_type dispatch(FuncRequest const & cmd);
|
||||
/// describe the situation
|
||||
string info() const;
|
||||
/// dump selection information for debugging
|
||||
|
@ -5,14 +5,12 @@
|
||||
#endif
|
||||
|
||||
#include "math_fontinset.h"
|
||||
#include "debug.h"
|
||||
#include "math_mathmlstream.h"
|
||||
#include "math_streamstr.h"
|
||||
#include "math_support.h"
|
||||
#include "math_parser.h"
|
||||
#include "LaTeXFeatures.h"
|
||||
#include "textpainter.h"
|
||||
#include "frontends/Painter.h"
|
||||
|
||||
|
||||
|
||||
@ -47,8 +45,6 @@ void MathFontInset::metrics(MathMetricsInfo & mi) const
|
||||
|
||||
void MathFontInset::draw(MathPainterInfo & pi, int x, int y) const
|
||||
{
|
||||
//lyxerr << "MathFontInset::draw\n";
|
||||
//MathNestInset::draw(pi, x, y);
|
||||
MathFontSetChanger dummy(pi.base, key_->name.c_str());
|
||||
cell(0).draw(pi, x + 1, y);
|
||||
drawMarkers(pi, x, y);
|
||||
@ -63,7 +59,6 @@ void MathFontInset::metricsT(TextMetricsInfo const & mi) const
|
||||
|
||||
void MathFontInset::drawT(TextPainter & pain, int x, int y) const
|
||||
{
|
||||
//lyxerr << "drawing font code: " << code_ << '\n';
|
||||
cell(0).drawT(pain, x, y);
|
||||
}
|
||||
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include "math_mathmlstream.h"
|
||||
#include "math_streamstr.h"
|
||||
#include "lyxfont.h"
|
||||
#include "funcrequest.h"
|
||||
#include "frontends/Painter.h"
|
||||
#include "debug.h"
|
||||
|
||||
@ -902,3 +903,66 @@ int MathGridInset::border() const
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
void MathGridInset::splitCell(idx_type & idx, pos_type & pos)
|
||||
{
|
||||
if (idx + 1 == nargs())
|
||||
return;
|
||||
MathArray ar = cell(idx);
|
||||
ar.erase(0, pos);
|
||||
cell(idx).erase(pos, cell(idx).size());
|
||||
++idx;
|
||||
pos = 0;
|
||||
cell(idx).insert(0, ar);
|
||||
}
|
||||
|
||||
|
||||
MathInset::result_type MathGridInset::dispatch
|
||||
(FuncRequest const & cmd, idx_type & idx, pos_type & pos)
|
||||
{
|
||||
switch (cmd.action) {
|
||||
|
||||
case LFUN_DELETE_LINE_FORWARD:
|
||||
//autocorrect_ = false;
|
||||
//macroModeClose();
|
||||
//if (selection_) {
|
||||
// selDel();
|
||||
// return;
|
||||
//}
|
||||
if (nrows() > 1)
|
||||
delRow(row(idx));
|
||||
if (idx >= nargs())
|
||||
idx = nargs() - 1;
|
||||
if (pos > cell(idx).size())
|
||||
pos = cell(idx).size();
|
||||
return DISPATCHED_POP;
|
||||
|
||||
case LFUN_TABINSERT:
|
||||
//bv->lockedInsetStoreUndo(Undo::EDIT);
|
||||
splitCell(idx, pos);
|
||||
//updateLocal(bv, true);
|
||||
return DISPATCHED_POP;
|
||||
|
||||
case LFUN_BREAKLINE: {
|
||||
//bv->lockedInsetStoreUndo(Undo::INSERT);
|
||||
row_type const r = row(idx);
|
||||
addRow(r);
|
||||
|
||||
// split line
|
||||
for (col_type c = col(idx) + 1; c < ncols(); ++c)
|
||||
std::swap(cell(index(r, c)), cell(index(r + 1, c)));
|
||||
|
||||
// split cell
|
||||
splitCell(idx, pos);
|
||||
std::swap(cell(idx), cell(idx + ncols() - 1));
|
||||
|
||||
//mathcursor->normalize();
|
||||
//updateLocal(bv, true);
|
||||
return DISPATCHED_POP;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return UNDISPATCHED;
|
||||
}
|
||||
|
@ -128,6 +128,8 @@ public:
|
||||
MathGridInset * asGridInset() { return this; }
|
||||
/// identifies GridInset
|
||||
MathGridInset const * asGridInset() const { return this; }
|
||||
/// local dispatcher
|
||||
result_type dispatch(FuncRequest const & cmd, idx_type & idx, pos_type & pos);
|
||||
|
||||
///
|
||||
col_type ncols() const;
|
||||
@ -219,6 +221,8 @@ protected:
|
||||
string eocString(col_type col) const;
|
||||
/// extract number of columns from alignment string
|
||||
col_type guessColumns(string const & halign) const;
|
||||
/// splits cells and shifts right part to the next cell
|
||||
void splitCell(idx_type &, pos_type & pos);
|
||||
|
||||
public:
|
||||
/// row info
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "debug.h"
|
||||
#include "frontends/Painter.h"
|
||||
#include "textpainter.h"
|
||||
#include "funcrequest.h"
|
||||
#include "Lsstream.h"
|
||||
#include "LaTeXFeatures.h"
|
||||
#include "support/LAssert.h"
|
||||
@ -645,3 +646,47 @@ void MathHullInset::check() const
|
||||
lyx::Assert(nonum_.size() == nrows());
|
||||
lyx::Assert(label_.size() == nrows());
|
||||
}
|
||||
|
||||
|
||||
MathInset::result_type MathHullInset::dispatch
|
||||
(FuncRequest const & cmd, idx_type & idx, pos_type & pos)
|
||||
{
|
||||
switch (cmd.action) {
|
||||
|
||||
case LFUN_BREAKLINE:
|
||||
if (type_ == "simple" || type_ == "equation") {
|
||||
mutate("eqnarray");
|
||||
idx = 1;
|
||||
pos = 0;
|
||||
return DISPATCHED_POP;
|
||||
}
|
||||
return MathGridInset::dispatch(cmd, idx, pos);
|
||||
|
||||
case LFUN_MATH_NUMBER:
|
||||
//lyxerr << "toggling all numbers\n";
|
||||
if (display()) {
|
||||
//bv->lockedInsetStoreUndo(Undo::INSERT);
|
||||
bool old = numberedType();
|
||||
for (row_type row = 0; row < nrows(); ++row)
|
||||
numbered(row, !old);
|
||||
//bv->owner()->message(old ? _("No number") : _("Number"));
|
||||
//updateLocal(bv, true);
|
||||
}
|
||||
return DISPATCHED;
|
||||
|
||||
case LFUN_MATH_NONUMBER:
|
||||
if (display()) {
|
||||
//bv->lockedInsetStoreUndo(Undo::INSERT);
|
||||
bool old = numbered(row(idx));
|
||||
//bv->owner()->message(old ? _("No number") : _("Number"));
|
||||
numbered(row(idx), !old);
|
||||
//updateLocal(bv, true);
|
||||
}
|
||||
return DISPATCHED;
|
||||
|
||||
default:
|
||||
return UNDISPATCHED;
|
||||
}
|
||||
return UNDISPATCHED;
|
||||
}
|
||||
|
||||
|
@ -46,6 +46,8 @@ public:
|
||||
bool display() const;
|
||||
///
|
||||
bool ams() const;
|
||||
/// local dispatcher
|
||||
result_type dispatch(FuncRequest const & cmd, idx_type & idx, pos_type & pos);
|
||||
///
|
||||
void getLabelList(std::vector<string> &) const;
|
||||
///
|
||||
|
@ -265,9 +265,10 @@ int MathInset::docbook(std::ostream &, bool) const
|
||||
}
|
||||
|
||||
|
||||
int MathInset::dispatch(FuncRequest const &, idx_type, pos_type)
|
||||
MathInset::result_type
|
||||
MathInset::dispatch(FuncRequest const &, idx_type &, pos_type &)
|
||||
{
|
||||
return 0; // undispatched
|
||||
return UNDISPATCHED;
|
||||
}
|
||||
|
||||
|
||||
|
@ -228,6 +228,13 @@ public:
|
||||
virtual bool isRelOp() const { return false; }
|
||||
/// -1: text mode, 1: math mode, 0 undecided
|
||||
enum mode_type {UNDECIDED_MODE, TEXT_MODE, MATH_MODE, VERBATIM_MODE};
|
||||
/// Dispatch result codes, see inset/inset.h
|
||||
enum result_type {
|
||||
UNDISPATCHED = 0, DISPATCHED, DISPATCHED_NOUPDATE,
|
||||
FINISHED, FINISHED_RIGHT, FINISHED_UP, FINISHED_DOWN,
|
||||
DISPATCHED_POP
|
||||
};
|
||||
|
||||
virtual mode_type currentMode() const { return UNDECIDED_MODE; }
|
||||
/// will this get written as a single block in {..}
|
||||
virtual bool extraBraces() const { return false; }
|
||||
@ -281,7 +288,8 @@ public:
|
||||
/// dump content to stderr for debugging
|
||||
virtual void dump() const;
|
||||
/// local dispatcher
|
||||
virtual int dispatch(FuncRequest const & cmd, idx_type idx, pos_type pos);
|
||||
virtual result_type dispatch
|
||||
(FuncRequest const & cmd, idx_type & idx, pos_type & pos);
|
||||
|
||||
/// LyXInset stuff
|
||||
/// write labels into a list
|
||||
|
@ -119,6 +119,29 @@ void MathIterator::jump(difference_type i)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
void MathIterator::shrink(size_type i)
|
||||
{
|
||||
if (i < size())
|
||||
erase(begin() + i, end());
|
||||
}
|
||||
|
||||
|
||||
void MathIterator::shrink(size_type i)
|
||||
{
|
||||
if (i < size())
|
||||
erase(begin() + i, end());
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
void MathIterator::shrink(size_type i)
|
||||
{
|
||||
if (i < size())
|
||||
erase(begin() + i, end());
|
||||
}
|
||||
|
||||
|
||||
bool operator==(MathIterator const & it, MathIterator const & jt)
|
||||
{
|
||||
return MathIterator::base_type(it) == MathIterator::base_type(jt);
|
||||
|
@ -18,6 +18,7 @@ public:
|
||||
using base_type::back;
|
||||
using base_type::begin;
|
||||
using base_type::end;
|
||||
using base_type::erase;
|
||||
using base_type::operator[];
|
||||
using base_type::size_type;
|
||||
using base_type::difference_type;
|
||||
@ -45,6 +46,8 @@ public:
|
||||
void goEnd();
|
||||
/// read access to top most item
|
||||
MathArray const & cell() const;
|
||||
/// shrinks to at most i levels
|
||||
void shrink(size_type i);
|
||||
|
||||
private:
|
||||
/// own level down
|
||||
|
@ -1,7 +1,6 @@
|
||||
#include <config.h>
|
||||
|
||||
#include "ref_inset.h"
|
||||
#include "math_cursor.h"
|
||||
#include "funcrequest.h"
|
||||
#include "formulabase.h"
|
||||
#include "BufferView.h"
|
||||
@ -36,33 +35,32 @@ void RefInset::infoize(std::ostream & os) const
|
||||
}
|
||||
|
||||
|
||||
int RefInset::dispatch(FuncRequest const & cmd, idx_type, pos_type)
|
||||
MathInset::result_type
|
||||
RefInset::dispatch(FuncRequest const & cmd, idx_type &, pos_type &)
|
||||
{
|
||||
switch (cmd.action) {
|
||||
case LFUN_MOUSE_RELEASE:
|
||||
if (cmd.extra == 3) {
|
||||
lyxerr << "trying to goto ref" << cell(0) << "\n";
|
||||
mathcursor->formula()->view()->owner()->getLyXFunc().
|
||||
dispatch(FuncRequest(LFUN_REF_GOTO, asString(cell(0))));
|
||||
return 1; // dispatched
|
||||
cmd.view()->dispatch(FuncRequest(LFUN_REF_GOTO, asString(cell(0))));
|
||||
return DISPATCHED;
|
||||
}
|
||||
if (cmd.extra == 1) {
|
||||
lyxerr << "trying to open ref" << cell(0) << "\n";
|
||||
// Eventually trigger dialog with button 3 not 1
|
||||
// mathcursor->formula()->view()->owner()->getDialogs()
|
||||
// ->showRef(this);
|
||||
return 1; // dispatched
|
||||
// cmd.view()->owner()->getDialogs()->showRef(this);
|
||||
return DISPATCHED;
|
||||
}
|
||||
break;
|
||||
case LFUN_MOUSE_PRESS:
|
||||
case LFUN_MOUSE_MOTION:
|
||||
// eat other mouse commands
|
||||
return 1;
|
||||
return DISPATCHED;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
// not our business
|
||||
return 0;
|
||||
return UNDISPATCHED;
|
||||
}
|
||||
|
||||
|
||||
|
@ -17,7 +17,7 @@ public:
|
||||
///
|
||||
void infoize(std::ostream & os) const;
|
||||
///
|
||||
int dispatch(FuncRequest const & cmd, idx_type idx, pos_type pos);
|
||||
result_type dispatch(FuncRequest const & cmd, idx_type & idx, pos_type & pos);
|
||||
///
|
||||
string screenLabel() const;
|
||||
///
|
||||
|
@ -23,7 +23,6 @@
|
||||
#include "toc.h"
|
||||
#include "buffer.h"
|
||||
#include "frontends/LyXView.h"
|
||||
#include "lyxfunc.h"
|
||||
#include "LyXAction.h"
|
||||
#include "paragraph.h"
|
||||
#include "insets/insetfloat.h"
|
||||
@ -46,7 +45,7 @@ string const TocItem::asString() const
|
||||
void TocItem::goTo(LyXView & lv_) const
|
||||
{
|
||||
string const tmp = tostr(par->id());
|
||||
lv_.getLyXFunc().dispatch(FuncRequest(LFUN_GOTO_PARAGRAPH, tmp));
|
||||
lv_.dispatch(FuncRequest(LFUN_GOTO_PARAGRAPH, tmp));
|
||||
}
|
||||
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include "buffer.h"
|
||||
#include "BufferView.h"
|
||||
#include "frontends/LyXView.h"
|
||||
#include "lyxfunc.h"
|
||||
#include "funcrequest.h"
|
||||
|
||||
#include "support/FileInfo.h"
|
||||
#include "support/path.h"
|
||||
@ -159,7 +159,7 @@ void RCS::registrer(string const & msg)
|
||||
cmd += OnlyFilename(owner_->fileName());
|
||||
cmd += "\"";
|
||||
doVCCommand(cmd, owner_->filePath());
|
||||
owner_->getUser()->owner()->getLyXFunc().dispatch(LFUN_MENURELOAD);
|
||||
owner_->getUser()->owner()->dispatch(FuncRequest(LFUN_MENURELOAD));
|
||||
}
|
||||
|
||||
|
||||
@ -167,7 +167,7 @@ void RCS::checkIn(string const & msg)
|
||||
{
|
||||
doVCCommand("ci -q -u -m\"" + msg + "\" \""
|
||||
+ OnlyFilename(owner_->fileName()) + "\"", owner_->filePath());
|
||||
owner_->getUser()->owner()->getLyXFunc().dispatch(LFUN_MENURELOAD);
|
||||
owner_->getUser()->owner()->dispatch(FuncRequest(LFUN_MENURELOAD));
|
||||
}
|
||||
|
||||
|
||||
@ -176,7 +176,7 @@ void RCS::checkOut()
|
||||
owner_->markClean();
|
||||
doVCCommand("co -q -l \""
|
||||
+ OnlyFilename(owner_->fileName()) + "\"", owner_->filePath());
|
||||
owner_->getUser()->owner()->getLyXFunc().dispatch(LFUN_MENURELOAD);
|
||||
owner_->getUser()->owner()->dispatch(FuncRequest(LFUN_MENURELOAD));
|
||||
}
|
||||
|
||||
|
||||
@ -186,8 +186,7 @@ void RCS::revert()
|
||||
+ OnlyFilename(owner_->fileName()) + "\"", owner_->filePath());
|
||||
// We ignore changes and just reload!
|
||||
owner_->markClean();
|
||||
owner_->getUser()->owner()
|
||||
->getLyXFunc().dispatch(LFUN_MENURELOAD);
|
||||
owner_->getUser()->owner()->dispatch(FuncRequest(LFUN_MENURELOAD));
|
||||
}
|
||||
|
||||
|
||||
@ -289,7 +288,7 @@ void CVS::registrer(string const & msg)
|
||||
{
|
||||
doVCCommand("cvs -q add -m \"" + msg + "\" \""
|
||||
+ OnlyFilename(owner_->fileName()) + "\"", owner_->filePath());
|
||||
owner_->getUser()->owner()->getLyXFunc().dispatch(LFUN_MENURELOAD);
|
||||
owner_->getUser()->owner()->dispatch(FuncRequest(LFUN_MENURELOAD));
|
||||
}
|
||||
|
||||
|
||||
@ -298,7 +297,7 @@ void CVS::checkIn(string const & msg)
|
||||
doVCCommand("cvs -q commit -m \"" + msg + "\" \""
|
||||
+ OnlyFilename(owner_->fileName()) + "\"",
|
||||
owner_->filePath());
|
||||
owner_->getUser()->owner()->getLyXFunc().dispatch(LFUN_MENURELOAD);
|
||||
owner_->getUser()->owner()->dispatch(FuncRequest(LFUN_MENURELOAD));
|
||||
}
|
||||
|
||||
|
||||
@ -318,8 +317,7 @@ void CVS::revert()
|
||||
doVCCommand("rm -f \"" + fil + "\"; cvs update \"" + fil + "\"",
|
||||
owner_->filePath());
|
||||
owner_->markClean();
|
||||
owner_->getUser()->owner()
|
||||
->getLyXFunc().dispatch(LFUN_MENURELOAD);
|
||||
owner_->getUser()->owner()->dispatch(FuncRequest(LFUN_MENURELOAD));
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user