mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 13:18:28 +00:00
This moves all LyXText related LyXFuncs to BufferView::Dispatch so that they
can also be called from inside the InsetText::LocalDispatch. Some small update and repaint fixes for InsetText. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1610 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
96e0bafddd
commit
e07f7bcc50
@ -291,3 +291,8 @@ BufferView::UpdateCodes operator|(BufferView::UpdateCodes uc1,
|
||||
return static_cast<BufferView::UpdateCodes>
|
||||
(static_cast<int>(uc1) | static_cast<int>(uc2));
|
||||
}
|
||||
|
||||
bool BufferView::Dispatch(kb_action action, string const & argument)
|
||||
{
|
||||
return pimpl_->Dispatch(action, argument);
|
||||
}
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
#include FORMS_H_LOCATION
|
||||
#include "undo.h"
|
||||
#include "commandtags.h"
|
||||
#include <boost/utility.hpp>
|
||||
|
||||
class LyXView;
|
||||
@ -249,6 +250,8 @@ public:
|
||||
void pasteClipboard(bool asPara);
|
||||
///
|
||||
void stuffClipboard(string const &) const;
|
||||
///
|
||||
bool Dispatch(kb_action action, string const & argument);
|
||||
private:
|
||||
struct Pimpl;
|
||||
///
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -5,6 +5,7 @@
|
||||
|
||||
#include "BufferView.h"
|
||||
#include "UpdateInset.h"
|
||||
#include "commandtags.h"
|
||||
#include "frontends/Timeout.h"
|
||||
|
||||
#ifdef __GNUG__
|
||||
@ -118,6 +119,8 @@ struct BufferView::Pimpl : public Object {
|
||||
///
|
||||
void center();
|
||||
///
|
||||
bool Dispatch(kb_action action, string const & argument);
|
||||
///
|
||||
BufferView * bv_;
|
||||
///
|
||||
LyXView * owner_;
|
||||
@ -161,5 +164,10 @@ private:
|
||||
: filename(f), par_id(id), par_pos(pos) {}
|
||||
};
|
||||
std::vector<Position> saved_positions;
|
||||
|
||||
void moveCursorUpdate(bool selecting);
|
||||
/// Get next inset of this class from current cursor position
|
||||
Inset * getInsetByCode(Inset::Code code);
|
||||
void MenuInsertLyXFile(string const & filen);
|
||||
};
|
||||
#endif
|
||||
|
@ -1,3 +1,18 @@
|
||||
2001-02-23 Juergen Vigna <jug@sad.it>
|
||||
|
||||
* lyxfunc.C (Dispatch): removed the whole part of the switch statement
|
||||
which works with LyXText and putted it inside BufferView. Here now we
|
||||
only call for that part the BufferView::Dispatch() function.
|
||||
|
||||
* BufferView.C (Dispatch): added.
|
||||
|
||||
* BufferView_pimpl.C (Dispatch): added! Here are now all dispatch
|
||||
functions which needs to use a LyXText over from LyXFunc.
|
||||
(MenuInsertLyXFile): added
|
||||
(getInsetByCode): added
|
||||
(moveCursorUpdate): added
|
||||
(static TEXT): added
|
||||
|
||||
2001-02-22 Juergen Vigna <jug@sad.it>
|
||||
|
||||
* BufferView_pimpl.C (update): call a status update to see if LyXText
|
||||
|
@ -1,3 +1,22 @@
|
||||
2001-02-23 Juergen Vigna <jug@sad.it>
|
||||
|
||||
* insettext.C (draw): some small repainting fixes.
|
||||
(LocalDispatch): put the sel_cursor stuff after the insert of chars.
|
||||
|
||||
* inset.C (LocalDispatch): changed action to be a kb_action (as it
|
||||
should be) and not an int.
|
||||
|
||||
* insettabular.C (LocalDispatch): ditto
|
||||
|
||||
* insettext.C (LocalDispatch): ditto
|
||||
|
||||
* insetcollapsable.C (LocalDispatch): ditto
|
||||
|
||||
2001-02-22 Juergen Vigna <jug@sad.it>
|
||||
|
||||
* insettabular.C (LocalDispatch): return DISPATCHED if we cannot
|
||||
DISPATCH it and we don't have a locking_inset.
|
||||
|
||||
2001-02-21 Baruch Even <baruch@ev-en.org>
|
||||
|
||||
* insetgraphics.[Ch]: Changed to use boost::shared_ptr<GraphicsCacheItem>
|
||||
|
@ -211,7 +211,7 @@ void UpdatableInset::scroll(BufferView * bv, int offset) const
|
||||
/// An updatable inset could handle lyx editing commands
|
||||
UpdatableInset::RESULT
|
||||
UpdatableInset::LocalDispatch(BufferView * bv,
|
||||
int action, string const & arg)
|
||||
kb_action action, string const & arg)
|
||||
{
|
||||
if (!arg.empty() && (action==LFUN_SCROLL_INSET)) {
|
||||
if (arg.find('.') != arg.npos) {
|
||||
|
@ -350,7 +350,7 @@ void InsetCollapsable::update(BufferView * bv, LyXFont const & font,
|
||||
|
||||
|
||||
UpdatableInset::RESULT
|
||||
InsetCollapsable::LocalDispatch(BufferView * bv, int action,
|
||||
InsetCollapsable::LocalDispatch(BufferView * bv, kb_action action,
|
||||
string const & arg)
|
||||
{
|
||||
UpdatableInset::RESULT result = inset->LocalDispatch(bv, action, arg);
|
||||
|
@ -89,7 +89,8 @@ public:
|
||||
///
|
||||
void InsetKeyPress(XKeyEvent *);
|
||||
///
|
||||
UpdatableInset::RESULT LocalDispatch(BufferView *, int, string const &);
|
||||
UpdatableInset::RESULT LocalDispatch(BufferView *, kb_action,
|
||||
string const &);
|
||||
///
|
||||
int Latex(Buffer const *, std::ostream &,
|
||||
bool fragile, bool free_spc) const;
|
||||
|
@ -714,7 +714,8 @@ void InsetTabular::InsetKeyPress(XKeyEvent * xke)
|
||||
}
|
||||
|
||||
|
||||
UpdatableInset::RESULT InsetTabular::LocalDispatch(BufferView * bv, int action,
|
||||
UpdatableInset::RESULT InsetTabular::LocalDispatch(BufferView * bv,
|
||||
kb_action action,
|
||||
string const & arg)
|
||||
{
|
||||
// We need to save the value of the_locking_inset as the call to
|
||||
|
@ -135,7 +135,8 @@ public:
|
||||
///
|
||||
void InsetKeyPress(XKeyEvent *);
|
||||
///
|
||||
UpdatableInset::RESULT LocalDispatch(BufferView *, int, string const &);
|
||||
UpdatableInset::RESULT LocalDispatch(BufferView *, kb_action,
|
||||
string const &);
|
||||
///
|
||||
int Latex(Buffer const *, std::ostream &, bool, bool) const;
|
||||
///
|
||||
|
@ -273,7 +273,7 @@ void InsetText::draw(BufferView * bv, LyXFont const & f,
|
||||
|
||||
// no draw is necessary !!!
|
||||
if ((drawFrame == LOCKED) && !locked && !par->size()) {
|
||||
if (!cleared && (need_update == CLEAR_FRAME)) {
|
||||
if (!cleared && (need_update & CLEAR_FRAME)) {
|
||||
pain.rectangle(top_x + 1, baseline - insetAscent + 1,
|
||||
width(bv, f) - 1,
|
||||
insetAscent + insetDescent - 1,
|
||||
@ -349,7 +349,7 @@ void InsetText::draw(BufferView * bv, LyXFont const & f,
|
||||
if (y_offset < 0)
|
||||
y_offset = y;
|
||||
TEXT(bv)->first = first;
|
||||
if (cleared || !locked || (need_update&FULL) || (need_update&INIT)) {
|
||||
if (cleared) { // (need_update&FULL) || (need_update&INIT)
|
||||
int yf = y_offset;
|
||||
y = 0;
|
||||
while ((row != 0) && (yf < ph)) {
|
||||
@ -359,6 +359,13 @@ void InsetText::draw(BufferView * bv, LyXFont const & f,
|
||||
yf += row->height();
|
||||
row = row->next();
|
||||
}
|
||||
} else if (!locked) {
|
||||
if (need_update & CURSOR) {
|
||||
bv->screen()->ToggleSelection(TEXT(bv), bv, true, y_offset,int(x));
|
||||
TEXT(bv)->ClearSelection(bv);
|
||||
TEXT(bv)->sel_cursor = TEXT(bv)->cursor;
|
||||
}
|
||||
bv->screen()->Update(TEXT(bv), bv, y_offset, int(x));
|
||||
} else {
|
||||
locked = false;
|
||||
if (need_update & SELECTION)
|
||||
@ -740,7 +747,7 @@ void InsetText::InsetKeyPress(XKeyEvent * xke)
|
||||
|
||||
UpdatableInset::RESULT
|
||||
InsetText::LocalDispatch(BufferView * bv,
|
||||
int action, string const & arg)
|
||||
kb_action action, string const & arg)
|
||||
{
|
||||
no_selection = false;
|
||||
UpdatableInset::RESULT
|
||||
@ -778,6 +785,8 @@ InsetText::LocalDispatch(BufferView * bv,
|
||||
moveRightIntern(bv, false, false);
|
||||
dispatched = true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
the_locking_inset = 0;
|
||||
if (dispatched)
|
||||
@ -815,7 +824,6 @@ InsetText::LocalDispatch(BufferView * bv,
|
||||
}
|
||||
}
|
||||
TEXT(bv)->ClearSelection(bv);
|
||||
TEXT(bv)->sel_cursor = TEXT(bv)->cursor;
|
||||
for (string::size_type i = 0; i < arg.length(); ++i) {
|
||||
if (greek_kb_flag) {
|
||||
if (!math_insert_greek(bv, arg[i])) {
|
||||
@ -828,6 +836,7 @@ InsetText::LocalDispatch(BufferView * bv,
|
||||
}
|
||||
}
|
||||
}
|
||||
TEXT(bv)->sel_cursor = TEXT(bv)->cursor;
|
||||
UpdateLocal(bv, CURSOR_PAR, true);
|
||||
result=DISPATCHED_NOUPDATE;
|
||||
break;
|
||||
@ -1087,6 +1096,7 @@ InsetText::LocalDispatch(BufferView * bv,
|
||||
break;
|
||||
|
||||
default:
|
||||
if (!bv->Dispatch(action, arg))
|
||||
result = UNDISPATCHED;
|
||||
break;
|
||||
}
|
||||
|
@ -125,7 +125,7 @@ public:
|
||||
///
|
||||
void InsetKeyPress(XKeyEvent *);
|
||||
///
|
||||
UpdatableInset::RESULT LocalDispatch(BufferView *, int, string const &);
|
||||
UpdatableInset::RESULT LocalDispatch(BufferView *, kb_action, string const &);
|
||||
///
|
||||
int Latex(Buffer const *, std::ostream &,
|
||||
bool fragile, bool free_spc) const;
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "gettext.h"
|
||||
#include "lyxfont.h"
|
||||
#include "lyxlex.h"
|
||||
#include "commandtags.h"
|
||||
|
||||
class BufferView;
|
||||
class Buffer;
|
||||
@ -356,7 +357,7 @@ public:
|
||||
bool /*lr*/ = false)
|
||||
{ return false; }
|
||||
/// An updatable inset could handle lyx editing commands
|
||||
virtual RESULT LocalDispatch(BufferView *, int, string const &);
|
||||
virtual RESULT LocalDispatch(BufferView *, kb_action, string const &);
|
||||
///
|
||||
virtual bool isCursorVisible() const { return cursor_visible; }
|
||||
///
|
||||
|
1615
src/lyxfunc.C
1615
src/lyxfunc.C
File diff suppressed because it is too large
Load Diff
@ -77,9 +77,8 @@ public:
|
||||
void setErrorMessage(string const &) const;
|
||||
/// Buffer to store result messages
|
||||
string const getMessage() const { return dispatch_buffer; }
|
||||
/// Get next inset of this class from current cursor position
|
||||
Inset * getInsetByCode(Inset::Code);
|
||||
|
||||
/// Handle a accented char keysequenze
|
||||
void handleKeyFunc(kb_action action);
|
||||
/// Should a hint message be displayed?
|
||||
void setHintMessage(bool);
|
||||
private:
|
||||
@ -121,8 +120,6 @@ private:
|
||||
|
||||
///
|
||||
void doImport(string const &);
|
||||
///
|
||||
void MenuInsertLyXFile(string const &);
|
||||
|
||||
///
|
||||
void CloseBuffer();
|
||||
|
@ -1,3 +1,10 @@
|
||||
2001-02-23 Juergen Vigna <jug@sad.it>
|
||||
|
||||
* formula.C (LocalDispatch): changed action to be a kb_action (as it
|
||||
should be) and not an int.
|
||||
|
||||
* formulamacro.C (LocalDispatch): ditto.
|
||||
|
||||
2001-02-14 André Pönitz <poenitz@htwm.de>
|
||||
|
||||
* math_parinset.[Ch]: make array a real MathArray, not just a
|
||||
|
@ -661,7 +661,8 @@ bool InsetFormula::SetNumber(bool numbf)
|
||||
|
||||
|
||||
UpdatableInset::RESULT
|
||||
InsetFormula::LocalDispatch(BufferView * bv, int action, string const & arg)
|
||||
InsetFormula::LocalDispatch(BufferView * bv, kb_action action,
|
||||
string const & arg)
|
||||
{
|
||||
// extern char *dispatch_result;
|
||||
MathedTextCodes varcode = LM_TC_MIN;
|
||||
|
@ -105,7 +105,7 @@ public:
|
||||
void InsetUnlock(BufferView *);
|
||||
|
||||
/// To allow transparent use of math editing functions
|
||||
virtual RESULT LocalDispatch(BufferView *, int, string const &);
|
||||
virtual RESULT LocalDispatch(BufferView *, kb_action, string const &);
|
||||
|
||||
///
|
||||
void InsertSymbol(BufferView *, string const &);
|
||||
|
@ -204,7 +204,7 @@ void InsetFormulaMacro::InsetUnlock(BufferView * bv)
|
||||
|
||||
UpdatableInset::RESULT
|
||||
InsetFormulaMacro::LocalDispatch(BufferView * bv,
|
||||
int action, string const & arg)
|
||||
kb_action action, string const & arg)
|
||||
{
|
||||
if (action == LFUN_MATH_MACROARG) {
|
||||
int i = lyx::atoi(arg) - 1;
|
||||
|
@ -66,7 +66,7 @@ public:
|
||||
///
|
||||
void InsetUnlock(BufferView *);
|
||||
///
|
||||
RESULT LocalDispatch(BufferView *, int, string const &);
|
||||
RESULT LocalDispatch(BufferView *, kb_action, string const &);
|
||||
|
||||
private:
|
||||
///
|
||||
|
Loading…
Reference in New Issue
Block a user