mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-25 10:58:52 +00:00
doubleClick, trippleClick, new UpdateInsetList some other small stuff
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@570 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
0c3da1a1d9
commit
b92c965543
18
ChangeLog
18
ChangeLog
@ -1,3 +1,21 @@
|
||||
2000-02-22 Lars Gullik Bjønnes <larsbj@lyx.org>
|
||||
|
||||
* src/lyx_cb.C src/UpdateInset.[Ch]: move the updateinsetlist into
|
||||
BufferView and reimplement the list as a queue put inside its own
|
||||
class.
|
||||
|
||||
* src/bufferlist.[Ch] (updateInset): remove func, not needed.
|
||||
|
||||
* several files: use the new interface to the "updateinsetlist"
|
||||
|
||||
* src/WorkArea.C (work_area_handler): call BufferView::doubleClick
|
||||
on doubleclick.
|
||||
(work_area_handler): call BufferView::trippleClick on trippleclick.
|
||||
|
||||
* src/BufferView.C (doubleClick): new function, selects word on
|
||||
doubleclick.
|
||||
(trippleClick): new function, selects line on trippleclick.
|
||||
|
||||
2000-02-22 Allan Rae <rae@lyx.org>
|
||||
|
||||
* lib/bind/xemacs.bind: buffer-previous not supported
|
||||
|
@ -185,7 +185,7 @@ dnl Check the version of g++
|
||||
case $gxx_version in
|
||||
2.7*) CXXFLAGS="$lyx_opt";;
|
||||
2.95.1) CXXFLAGS="-g $lyx_opt -fpermissive -fno-rtti";;
|
||||
2.95.*) CXXFLAGS="-g $lyx_opt -Woverloaded-virtual -fno-rtti -fno-exceptions";;
|
||||
2.95.*) CXXFLAGS="-g $lyx_opt -fno-rtti -fno-exceptions";;
|
||||
*2.91.*) CXXFLAGS="-g $lyx_opt -Wno-return-type -fno-exceptions -fno-rtti";;
|
||||
*) CXXFLAGS="-g $lyx_opt -fno-exceptions -fno-rtti";;
|
||||
esac
|
||||
|
@ -63,6 +63,7 @@ void free ();
|
||||
|
||||
/* @@ end of prolog @@ */
|
||||
/* List of already loaded domains. */
|
||||
|
||||
static struct loaded_l10nfile *_nl_loaded_domains;
|
||||
|
||||
|
||||
|
@ -61,8 +61,6 @@ extern bool input_prohibited;
|
||||
extern bool selection_possible;
|
||||
extern char ascii_type;
|
||||
extern void MenuPasteSelection(char at);
|
||||
extern InsetUpdateStruct * InsetUpdateList;
|
||||
extern void UpdateInsetUpdateList();
|
||||
extern void FreeUpdateTimer();
|
||||
|
||||
BufferView::BufferView(LyXView * o, int xpos, int ypos,
|
||||
@ -774,6 +772,41 @@ void BufferView::workAreaButtonPress(int xpos, int ypos, unsigned int button)
|
||||
}
|
||||
|
||||
|
||||
void BufferView::doubleClick(int /*x*/, int /*y*/, unsigned int button)
|
||||
{
|
||||
// select a word
|
||||
if (buffer_ && !the_locking_inset) {
|
||||
if (screen && button == 1) {
|
||||
screen->HideCursor();
|
||||
screen->ToggleSelection();
|
||||
text->SelectWord();
|
||||
screen->ToggleSelection(false);
|
||||
/* This will fit the cursor on the screen
|
||||
* if necessary */
|
||||
update(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void BufferView::trippleClick(int /*x*/, int /*y*/, unsigned int button)
|
||||
{
|
||||
// select a line
|
||||
if (buffer_ && screen && button == 1) {
|
||||
screen->HideCursor();
|
||||
screen->ToggleSelection();
|
||||
text->CursorHome();
|
||||
text->sel_cursor = text->cursor;
|
||||
text->CursorEnd();
|
||||
text->SetSelection();
|
||||
screen->ToggleSelection(false);
|
||||
/* This will fit the cursor on the screen
|
||||
* if necessary */
|
||||
update(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void BufferView::workAreaButtonRelease(int x, int y, unsigned int button)
|
||||
{
|
||||
if (buffer_ == 0 || screen == 0) return;
|
||||
@ -1097,9 +1130,9 @@ void BufferView::cursorToggleCB(FL_OBJECT * ob, long)
|
||||
else if (pid > 0)
|
||||
sigchldhandler(pid, &status);
|
||||
}
|
||||
if (InsetUpdateList)
|
||||
UpdateInsetUpdateList();
|
||||
|
||||
view->updatelist.update(view);
|
||||
|
||||
if (view && !view->screen){
|
||||
goto set_timer_and_return;
|
||||
}
|
||||
@ -1429,6 +1462,12 @@ bool BufferView::active() const
|
||||
}
|
||||
|
||||
|
||||
bool BufferView::belowMouse() const
|
||||
{
|
||||
return workarea->belowMouse();
|
||||
}
|
||||
|
||||
|
||||
void BufferView::showCursor()
|
||||
{
|
||||
if (screen)
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "BackStack.h"
|
||||
#include "LaTeX.h"
|
||||
#include "undo.h"
|
||||
#include "UpdateInset.h"
|
||||
|
||||
class LyXView;
|
||||
class Buffer;
|
||||
@ -210,6 +211,8 @@ public:
|
||||
void focus(bool);
|
||||
///
|
||||
bool active() const;
|
||||
///
|
||||
bool belowMouse() const;
|
||||
/// A callback for the up arrow in the scrollbar.
|
||||
void upCB(long time, int button);
|
||||
/// A callback for the slider in the scrollbar.
|
||||
@ -233,6 +236,10 @@ private:
|
||||
///
|
||||
void workAreaSelectionNotify(Window win, XEvent * event);
|
||||
///
|
||||
void doubleClick(int x, int y, unsigned int button);
|
||||
///
|
||||
void trippleClick(int x, int y, unsigned int button);
|
||||
///
|
||||
LyXView * owner_;
|
||||
///
|
||||
Buffer * buffer_;
|
||||
@ -254,6 +261,15 @@ private:
|
||||
int last_click_x, last_click_y;
|
||||
///
|
||||
WorkArea * workarea;
|
||||
///
|
||||
UpdateInset updatelist;
|
||||
public:
|
||||
///
|
||||
void updateInset(Inset *, bool);
|
||||
///
|
||||
void pushIntoUpdateList(Inset * i) {
|
||||
updatelist.push(i);
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -748,3 +748,37 @@ void BufferView::lockedInsetStoreUndo(Undo::undo_kind kind)
|
||||
text->cursor.par->
|
||||
ParFromPos(text->cursor.pos)->next);
|
||||
}
|
||||
|
||||
|
||||
void BufferView::updateInset(Inset * inset, bool mark_dirty)
|
||||
{
|
||||
if (!inset)
|
||||
return;
|
||||
|
||||
// first check for locking insets
|
||||
if (the_locking_inset == inset) {
|
||||
if (text->UpdateInset(inset)){
|
||||
update();
|
||||
if (mark_dirty){
|
||||
if (buffer()->isLyxClean())
|
||||
owner()->getMiniBuffer()->setTimer(4);
|
||||
buffer()->markDirty();
|
||||
}
|
||||
updateScrollbar();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// then check the current buffer
|
||||
if (available()) {
|
||||
hideCursor();
|
||||
update(-3);
|
||||
if (text->UpdateInset(inset)){
|
||||
if (mark_dirty)
|
||||
update(1);
|
||||
else
|
||||
update(3);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -44,6 +44,7 @@ void MenuSendto()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SendtoApplyCB(FL_OBJECT *, long)
|
||||
{
|
||||
if (!current_view->available())
|
||||
@ -103,12 +104,14 @@ void SendtoApplyCB(FL_OBJECT *, long)
|
||||
Systemcalls one(Systemcalls::System, command);
|
||||
}
|
||||
|
||||
|
||||
void SendtoCancelCB(FL_OBJECT *, long)
|
||||
{
|
||||
fl_hide_form(fd_form_sendto->form_sendto);
|
||||
}
|
||||
|
||||
void SendtoOKCB(FL_OBJECT *ob, long data)
|
||||
|
||||
void SendtoOKCB(FL_OBJECT * ob, long data)
|
||||
{
|
||||
SendtoCancelCB(ob, data);
|
||||
SendtoApplyCB(ob, data);
|
||||
|
@ -55,6 +55,8 @@ lyx_SOURCES = \
|
||||
TableLayout.C \
|
||||
TextCache.C \
|
||||
TextCache.h \
|
||||
UpdateInset.C \
|
||||
UpdateInset.h \
|
||||
WorkArea.C \
|
||||
WorkArea.h \
|
||||
bibforms.h \
|
||||
|
20
src/UpdateInset.C
Normal file
20
src/UpdateInset.C
Normal file
@ -0,0 +1,20 @@
|
||||
#include <config.h>
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation
|
||||
#endif
|
||||
|
||||
#include "UpdateInset.h"
|
||||
#include "BufferView.h"
|
||||
//#include "insets/lyxinset.h"
|
||||
|
||||
void UpdateInset::update(BufferView * bv)
|
||||
{
|
||||
while (!insetqueue.empty()) {
|
||||
Inset * inset = insetqueue.front();
|
||||
insetqueue.pop();
|
||||
bv->updateInset(inset, false); // "false" because no document change
|
||||
}
|
||||
}
|
||||
|
||||
|
35
src/UpdateInset.h
Normal file
35
src/UpdateInset.h
Normal file
@ -0,0 +1,35 @@
|
||||
// -*- C++ -*-
|
||||
|
||||
#ifndef UPDATE_INSET_H
|
||||
#define UPDATE_INSET_H
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
#include <queue>
|
||||
#include "support/LAssert.h"
|
||||
|
||||
using std::queue;
|
||||
|
||||
class Inset;
|
||||
class BufferView;
|
||||
|
||||
///
|
||||
class UpdateInset {
|
||||
public:
|
||||
///
|
||||
void push(Inset * inset) {
|
||||
Assert(inset);
|
||||
insetqueue.push(inset);
|
||||
}
|
||||
///
|
||||
void update(BufferView *);
|
||||
private:
|
||||
///
|
||||
typedef queue<Inset*> InsetQueue;
|
||||
///
|
||||
InsetQueue insetqueue;
|
||||
};
|
||||
|
||||
#endif // UPDATE_INSET_H
|
@ -394,11 +394,17 @@ int WorkArea::work_area_handler(FL_OBJECT * ob, int event,
|
||||
break;
|
||||
case FL_DBLCLICK:
|
||||
if (!ev) break;
|
||||
lyxerr.debug() << "Workarea event: DBLCLICK" << endl;;
|
||||
lyxerr.debug() << "Workarea event: DBLCLICK" << endl;
|
||||
area->owner->doubleClick(ev->xbutton.x - ob->x,
|
||||
ev->xbutton.y - ob->y,
|
||||
ev->xbutton.button);
|
||||
break;
|
||||
case FL_TRPLCLICK:
|
||||
if (!ev) break;
|
||||
lyxerr.debug() << "Workarea event: TRPLCLICK" << endl;
|
||||
area->owner->trippleClick(ev->xbutton.x - ob->x,
|
||||
ev->xbutton.y - ob->y,
|
||||
ev->xbutton.button);
|
||||
break;
|
||||
case FL_OTHER:
|
||||
if (!ev) break;
|
||||
|
@ -60,6 +60,8 @@ public:
|
||||
///
|
||||
bool active() const { return work_area->active; }
|
||||
///
|
||||
bool belowMouse() const { return work_area->belowmouse; }
|
||||
///
|
||||
bool visible() const { return work_area->form->visible; }
|
||||
///
|
||||
void greyOut() const;
|
||||
|
@ -3,8 +3,8 @@
|
||||
*
|
||||
* LyX, The Document Word Processor
|
||||
*
|
||||
* Copyright 1995 Matthias Ettrich
|
||||
* Copyright 1995-2000 The LyX Team.
|
||||
* Copyright 1995 Matthias Ettrich
|
||||
* Copyright 1995-2000 The LyX Team.
|
||||
*
|
||||
* This file is Copyright 1996-2000
|
||||
* Lars Gullik Bjønnes
|
||||
@ -158,21 +158,12 @@ bool BufferList::close(Buffer * buf)
|
||||
MakeDisplayPath(buf->fileName(), 50),
|
||||
_("Save document?"))){
|
||||
case 1: // Yes
|
||||
#if 0
|
||||
if (write(buf, lyxrc->make_backup)) {
|
||||
lastfiles->newFile(buf->fileName());
|
||||
} else {
|
||||
AllowInput();
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
if (buf->save(lyxrc->make_backup)) {
|
||||
lastfiles->newFile(buf->fileName());
|
||||
} else {
|
||||
AllowInput();
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case 3: // Cancel
|
||||
AllowInput();
|
||||
@ -211,20 +202,6 @@ Buffer * BufferList::getBuffer(int choice)
|
||||
}
|
||||
|
||||
|
||||
void BufferList::updateInset(Inset * inset, bool mark_dirty)
|
||||
{
|
||||
for (BufferStorage::iterator it = bstore.begin();
|
||||
it != bstore.end(); ++it) {
|
||||
if ((*it)->getUser()
|
||||
&& (*it)->getUser()->text->UpdateInset(inset)) {
|
||||
if (mark_dirty)
|
||||
(*it)->markDirty();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int BufferList::unlockInset(UpdatableInset * inset)
|
||||
{
|
||||
if (!inset) return 1;
|
||||
|
@ -95,11 +95,6 @@ public:
|
||||
///
|
||||
bool empty() const;
|
||||
|
||||
/// Saves buffer. Returns false if unsuccesful.
|
||||
#if 0
|
||||
bool write(Buffer *, bool makeBackup);
|
||||
#endif
|
||||
|
||||
///
|
||||
bool QwriteAll();
|
||||
|
||||
@ -116,9 +111,6 @@ public:
|
||||
Buffer * newFile(string const &, string);
|
||||
/// returns a vector with all the buffers filenames
|
||||
vector<string> getFileNames() const;
|
||||
|
||||
///
|
||||
void updateInset(Inset *, bool = true);
|
||||
|
||||
///
|
||||
int unlockInset(UpdatableInset *);
|
||||
|
@ -69,9 +69,7 @@ extern BufferView * current_view;
|
||||
extern FL_OBJECT * figinset_canvas;
|
||||
|
||||
extern char ** environ; // is this only redundtant on linux systems? Lgb.
|
||||
extern void UpdateInset(BufferView *, Inset * inset, bool mark_dirty = true);
|
||||
// better for asyncron updating:
|
||||
void PutInsetIntoInsetUpdateList(Inset * inset);
|
||||
|
||||
extern void ProhibitInput();
|
||||
extern void AllowInput();
|
||||
|
||||
@ -405,11 +403,6 @@ void InitFigures()
|
||||
fl_add_canvas_handler(figinset_canvas, ClientMessage,
|
||||
GhostscriptMsg, current_view->owner()->getMainForm());
|
||||
|
||||
#if 0
|
||||
// now we have to init color_map
|
||||
if (!color_map) color_map = DefaultColormap(fl_display,
|
||||
DefaultScreen(fl_display));
|
||||
#endif
|
||||
// allocate color cube on pseudo-color display
|
||||
// first get visual
|
||||
gs_color = false;
|
||||
@ -451,15 +444,6 @@ void DoneFigures()
|
||||
|
||||
fl_remove_canvas_handler(figinset_canvas, ClientMessage,
|
||||
GhostscriptMsg);
|
||||
|
||||
#if 0
|
||||
if (gs_color) {
|
||||
lyxerr.debug() << "Freeing up the colors..." << endl;
|
||||
XFreeColors(fl_display, color_map, gs_pixels,
|
||||
gs_num_pixels, 0);
|
||||
/******????????????????? what's planes in this case ??????***/
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -805,13 +789,15 @@ static figdata * getfigdata(int wid, int hgh, string const & fname,
|
||||
}
|
||||
|
||||
|
||||
static void getbitmap(figdata * p)
|
||||
static
|
||||
void getbitmap(figdata * p)
|
||||
{
|
||||
p->gspid = -1;
|
||||
}
|
||||
|
||||
|
||||
static void makeupdatelist(figdata * p)
|
||||
static
|
||||
void makeupdatelist(figdata * p)
|
||||
{
|
||||
for (int i = 0; i < figinsref; ++i)
|
||||
if (figures[i]->data == p) {
|
||||
@ -821,7 +807,9 @@ static void makeupdatelist(figdata * p)
|
||||
<< endl;
|
||||
}
|
||||
// add inset figures[i]->inset into to_update list
|
||||
PutInsetIntoInsetUpdateList(figures[i]->inset);
|
||||
current_view->pushIntoUpdateList(figures[i]->inset);
|
||||
|
||||
//PutInsetIntoInsetUpdateList(figures[i]->inset);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1891,7 +1879,7 @@ void InsetFig::CallbackFig(long arg)
|
||||
lyxerr << "Update: ["
|
||||
<< wid << 'x' << hgh << ']' << endl;
|
||||
}
|
||||
UpdateInset(current_view, this);
|
||||
current_view->updateInset(this, true);
|
||||
if (arg == 8) {
|
||||
fl_set_focus_object(form->Figure, form->OkBtn);
|
||||
fl_hide_form(form->Figure);
|
||||
|
@ -27,7 +27,6 @@ FD_citation_form * citation_form = 0;
|
||||
FD_bibitem_form * bibitem_form = 0;
|
||||
static Combox * bibcombox = 0;
|
||||
|
||||
extern void UpdateInset(BufferView *, Inset * inset, bool mark_dirty = true);
|
||||
void BibitemUpdate(Combox *);
|
||||
FD_citation_form * create_form_citation_form(void);
|
||||
FD_bibitem_form * create_form_bibitem_form(void);
|
||||
@ -49,7 +48,7 @@ extern "C" void bibitem_cb(FL_OBJECT *, long data)
|
||||
fl_hide_form(citation_form->citation_form);
|
||||
// shouldn't mark the buffer dirty unless something
|
||||
// was actually altered
|
||||
UpdateInset(holder->view, inset);
|
||||
holder->view->updateInset(inset, true);
|
||||
break;
|
||||
}
|
||||
// fall through to Cancel on RO-mode
|
||||
|
@ -26,7 +26,6 @@ extern BufferView * current_view;
|
||||
|
||||
extern LyXRC * lyxrc;
|
||||
extern BufferList bufferlist;
|
||||
extern void UpdateInset(BufferView *, Inset * inset, bool mark_dirty = true);
|
||||
|
||||
|
||||
FD_include * create_form_include(void)
|
||||
@ -145,7 +144,7 @@ extern "C" void include_cb(FL_OBJECT *, long arg)
|
||||
}
|
||||
|
||||
fl_hide_form(form->include);
|
||||
UpdateInset(current_view, inset);
|
||||
current_view->updateInset(inset, true);
|
||||
break;
|
||||
} // fall through
|
||||
|
||||
@ -166,7 +165,7 @@ extern "C" void include_cb(FL_OBJECT *, long arg)
|
||||
}
|
||||
|
||||
fl_hide_form(form->include);
|
||||
UpdateInset(current_view, inset);
|
||||
current_view->updateInset(inset, true);
|
||||
current_view->owner()->getLyXFunc()->Dispatch(LFUN_CHILDOPEN, inset->getContents().c_str());
|
||||
}
|
||||
break;
|
||||
|
@ -16,7 +16,6 @@
|
||||
#include "lyx_gui_misc.h" // WarnReadonly
|
||||
|
||||
extern BufferView * current_view;
|
||||
extern void UpdateInset(BufferView *, Inset * inset, bool mark_dirty = true);
|
||||
|
||||
FD_index_form * index_form = 0;
|
||||
|
||||
@ -31,7 +30,7 @@ extern "C" void index_cb(FL_OBJECT *, long data)
|
||||
if(tmp != inset->getContents()) {
|
||||
inset->setContents(tmp);
|
||||
fl_hide_form(index_form->index_form);
|
||||
UpdateInset(current_view, inset);
|
||||
current_view->updateInset(inset, true);
|
||||
break;
|
||||
}
|
||||
} // fall through to Cancel on RO
|
||||
|
@ -14,8 +14,6 @@
|
||||
#include "LaTeXFeatures.h"
|
||||
#include "lyx_gui_misc.h" // CancelCloseBoxCB
|
||||
|
||||
extern void UpdateInset(BufferView *, Inset * inset, bool mark_dirty = true);
|
||||
|
||||
|
||||
InsetUrl::InsetUrl(string const & cmd)
|
||||
: fd_form_url(0)
|
||||
@ -94,7 +92,7 @@ void InsetUrl::CloseUrlCB(FL_OBJECT * ob, long)
|
||||
inset->flag = InsetUrl::URL;
|
||||
else
|
||||
inset->flag = InsetUrl::HTML_URL;
|
||||
UpdateInset(bv, inset);
|
||||
bv->updateInset(inset, true);
|
||||
}
|
||||
|
||||
if (inset->fd_form_url) {
|
||||
|
83
src/lyx_cb.C
83
src/lyx_cb.C
@ -144,7 +144,8 @@ bool toggleall = true;
|
||||
Matthias
|
||||
*/
|
||||
|
||||
void UpdateInset(BufferView * bv, Inset * inset, bool mark_dirty = true);
|
||||
//void UpdateInset(BufferView * bv, Inset * inset, bool mark_dirty = true);
|
||||
|
||||
/* these functions return 1 if an error occured,
|
||||
otherwise 0 */
|
||||
// Now they work only for updatable insets. [Alejandro 080596]
|
||||
@ -156,10 +157,10 @@ void ToggleLockedInsetCursor(long x, long y, int asc, int desc);
|
||||
|
||||
/* this is for asyncron updating. UpdateInsetUpdateList will be called
|
||||
automatically from LyX. Just insert the Inset into the Updatelist */
|
||||
void UpdateInsetUpdateList();
|
||||
void PutInsetIntoInsetUpdateList(Inset * inset);
|
||||
//void UpdateInsetUpdateList();
|
||||
//void PutInsetIntoInsetUpdateList(Inset * inset);
|
||||
|
||||
InsetUpdateStruct * InsetUpdateList = 0;
|
||||
//InsetUpdateStruct * InsetUpdateList = 0;
|
||||
|
||||
|
||||
/*
|
||||
@ -242,11 +243,11 @@ void AllowInput()
|
||||
if (fd_form_character->form_character->visible)
|
||||
XUndefineCursor(fl_display,
|
||||
fd_form_character->form_character->window);
|
||||
#if 0
|
||||
|
||||
// What to do about this? (Lgb)
|
||||
if (current_view->getWorkArea()->belowmouse)
|
||||
if (current_view->belowMouse())
|
||||
SetXtermCursor(current_view->owner()->getForm()->window);
|
||||
#endif
|
||||
|
||||
XFlush(fl_display);
|
||||
fl_activate_all_forms();
|
||||
}
|
||||
@ -3538,74 +3539,6 @@ extern "C" void RefHideCB(FL_OBJECT *, long)
|
||||
fl_hide_form(fd_form_ref->form_ref);
|
||||
}
|
||||
|
||||
|
||||
// candidate for move to BufferView
|
||||
void UpdateInset(BufferView * bv, Inset * inset, bool mark_dirty)
|
||||
{
|
||||
if (!inset)
|
||||
return;
|
||||
|
||||
/* very first check for locking insets*/
|
||||
if (bv->the_locking_inset == inset) {
|
||||
if (bv->text->UpdateInset(inset)){
|
||||
bv->update();
|
||||
if (mark_dirty){
|
||||
if (bv->buffer()->isLyxClean())
|
||||
bv->owner()->getMiniBuffer()->setTimer(4);
|
||||
bv->buffer()->markDirty();
|
||||
}
|
||||
bv->updateScrollbar();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* first check the current buffer */
|
||||
if (bv->available()) {
|
||||
bv->hideCursor();
|
||||
bv->update(-3);
|
||||
if (bv->text->UpdateInset(inset)){
|
||||
if (mark_dirty)
|
||||
bv->update(1);
|
||||
else
|
||||
bv->update(3);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// check all buffers
|
||||
bufferlist.updateInset(inset, mark_dirty);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void PutInsetIntoInsetUpdateList(Inset * inset)
|
||||
{
|
||||
Assert(inset);
|
||||
InsetUpdateStruct * tmp = new InsetUpdateStruct();
|
||||
tmp->inset = inset;
|
||||
tmp->next = InsetUpdateList;
|
||||
InsetUpdateList = tmp;
|
||||
}
|
||||
|
||||
|
||||
void UpdateInsetUpdateList()
|
||||
{
|
||||
InsetUpdateStruct * tmp = InsetUpdateList;
|
||||
while (tmp) {
|
||||
UpdateInset(current_view, tmp->inset, false); // "false" because no document change
|
||||
tmp = tmp->next;
|
||||
}
|
||||
|
||||
// delete the update list
|
||||
while (InsetUpdateList) {
|
||||
tmp = InsetUpdateList;
|
||||
InsetUpdateList = InsetUpdateList->next;
|
||||
delete tmp;
|
||||
}
|
||||
InsetUpdateList = 0;
|
||||
}
|
||||
|
||||
|
||||
#ifdef WITH_WARNINGS
|
||||
#warning UGLY!!
|
||||
#endif
|
||||
|
@ -63,12 +63,5 @@ extern string CurrentState();
|
||||
///
|
||||
extern void AllowInput();
|
||||
|
||||
///
|
||||
struct InsetUpdateStruct {
|
||||
///
|
||||
Inset * inset;
|
||||
///
|
||||
InsetUpdateStruct * next;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@ -34,7 +34,6 @@
|
||||
#include "lyxrc.h"
|
||||
#include "gettext.h"
|
||||
#include "lyx_gui_misc.h"
|
||||
#include "lyx_cb.h"
|
||||
#include "lyxlookup.h"
|
||||
#include "bufferlist.h"
|
||||
|
||||
|
131
src/lyxfont.C
131
src/lyxfont.C
@ -99,40 +99,43 @@ string const LaTeXSizeNames[14] =
|
||||
{ "tiny", "scriptsize", "footnotesize", "small", "normalsize", "large",
|
||||
"Large", "LARGE", "huge", "Huge", "error8", "error9", "error10", "error11" };
|
||||
|
||||
#ifdef NEW_BITS
|
||||
LyXFont::FontBits LyXFont::sane = { ROMAN_FAMILY,
|
||||
MEDIUM_SERIES,
|
||||
UP_SHAPE,
|
||||
SIZE_NORMAL,
|
||||
LColor::none,
|
||||
OFF,
|
||||
OFF,
|
||||
OFF,
|
||||
OFF,
|
||||
LTR_DIR };
|
||||
|
||||
LyXFont::FontBits LyXFont::inherit = { INHERIT_FAMILY,
|
||||
INHERIT_SERIES,
|
||||
INHERIT_SHAPE,
|
||||
INHERIT_SIZE,
|
||||
LColor::inherit,
|
||||
INHERIT,
|
||||
INHERIT,
|
||||
INHERIT,
|
||||
INHERIT,
|
||||
INHERIT_DIR };
|
||||
LyXFont::FontBits LyXFont::sane = {
|
||||
ROMAN_FAMILY,
|
||||
MEDIUM_SERIES,
|
||||
UP_SHAPE,
|
||||
SIZE_NORMAL,
|
||||
LColor::none,
|
||||
OFF,
|
||||
OFF,
|
||||
OFF,
|
||||
OFF,
|
||||
LTR_DIR };
|
||||
|
||||
LyXFont::FontBits LyXFont::inherit = {
|
||||
INHERIT_FAMILY,
|
||||
INHERIT_SERIES,
|
||||
INHERIT_SHAPE,
|
||||
INHERIT_SIZE,
|
||||
LColor::inherit,
|
||||
INHERIT,
|
||||
INHERIT,
|
||||
INHERIT,
|
||||
INHERIT,
|
||||
INHERIT_DIR };
|
||||
|
||||
LyXFont::FontBits LyXFont::ignore = {
|
||||
IGNORE_FAMILY,
|
||||
IGNORE_SERIES,
|
||||
IGNORE_SHAPE,
|
||||
IGNORE_SIZE,
|
||||
LColor::ignore,
|
||||
IGNORE,
|
||||
IGNORE,
|
||||
IGNORE,
|
||||
IGNORE,
|
||||
IGNORE_DIR };
|
||||
|
||||
LyXFont::FontBits LyXFont::ignore = { IGNORE_FAMILY,
|
||||
IGNORE_SERIES,
|
||||
IGNORE_SHAPE,
|
||||
IGNORE_SIZE,
|
||||
LColor::ignore,
|
||||
IGNORE,
|
||||
IGNORE,
|
||||
IGNORE,
|
||||
IGNORE,
|
||||
IGNORE_DIR };
|
||||
#endif
|
||||
|
||||
/// Decreases font size by one
|
||||
LyXFont & LyXFont::decSize()
|
||||
@ -312,8 +315,6 @@ void LyXFont::reduce(LyXFont const & tmplt)
|
||||
|
||||
|
||||
/// Realize font from a template
|
||||
// This one is not pretty, but it's extremely fast (Asger)
|
||||
#ifdef NEW_BITS
|
||||
LyXFont & LyXFont::realize(LyXFont const & tmplt)
|
||||
{
|
||||
if (bits == inherit) {
|
||||
@ -354,68 +355,6 @@ LyXFont & LyXFont::realize(LyXFont const & tmplt)
|
||||
|
||||
return *this;
|
||||
}
|
||||
#else
|
||||
LyXFont & LyXFont::realize(LyXFont const & tmplt)
|
||||
{
|
||||
if (bits == inherit) {
|
||||
bits = tmplt.bits;
|
||||
return *this;
|
||||
}
|
||||
|
||||
if ((bits & (Fam_Mask<<Fam_Pos)) == (ui32(INHERIT_FAMILY)<<Fam_Pos))
|
||||
{
|
||||
bits &= ~(Fam_Mask << Fam_Pos);
|
||||
bits |= (tmplt.bits & Fam_Mask << Fam_Pos);
|
||||
}
|
||||
if ((bits & (Ser_Mask<<Ser_Pos)) == (ui32(INHERIT_SERIES)<<Ser_Pos))
|
||||
{
|
||||
bits &= ~(Ser_Mask << Ser_Pos);
|
||||
bits |= (tmplt.bits & Ser_Mask << Ser_Pos);
|
||||
}
|
||||
if ((bits & (Sha_Mask << Sha_Pos)) == ui32(INHERIT_SHAPE) << Sha_Pos)
|
||||
{
|
||||
bits &= ~(Sha_Mask << Sha_Pos);
|
||||
bits |= (tmplt.bits & Sha_Mask << Sha_Pos);
|
||||
}
|
||||
if ((bits & (Siz_Mask << Siz_Pos)) == ui32(INHERIT_SIZE) << Siz_Pos)
|
||||
{
|
||||
bits &= ~(Siz_Mask << Siz_Pos);
|
||||
bits |= (tmplt.bits & Siz_Mask << Siz_Pos);
|
||||
}
|
||||
if ((bits & (Misc_Mask << Emp_Pos)) == ui32(INHERIT) << Emp_Pos)
|
||||
{
|
||||
bits &= ~(Misc_Mask << Emp_Pos);
|
||||
bits |= (tmplt.bits & Misc_Mask << Emp_Pos);
|
||||
}
|
||||
if ((bits & (Misc_Mask << Und_Pos)) == ui32(INHERIT) << Und_Pos)
|
||||
{
|
||||
bits &= ~(Misc_Mask << Und_Pos);
|
||||
bits |= (tmplt.bits & Misc_Mask << Und_Pos);
|
||||
}
|
||||
if ((bits & (Misc_Mask << Nou_Pos)) == ui32(INHERIT) << Nou_Pos)
|
||||
{
|
||||
bits &= ~(Misc_Mask << Nou_Pos);
|
||||
bits |= (tmplt.bits & Misc_Mask << Nou_Pos);
|
||||
}
|
||||
if ((bits & (Misc_Mask << Lat_Pos)) == ui32(INHERIT) << Lat_Pos)
|
||||
{
|
||||
bits &= ~(Misc_Mask << Lat_Pos);
|
||||
bits |= (tmplt.bits & Misc_Mask << Lat_Pos);
|
||||
}
|
||||
if ((bits & (Col_Mask << Col_Pos)) == ui32(LColor::inherit) << Col_Pos)
|
||||
{
|
||||
bits &= ~(Col_Mask << Col_Pos);
|
||||
bits |= (tmplt.bits & Col_Mask << Col_Pos);
|
||||
}
|
||||
if ((bits & (Dir_Mask << Dir_Pos)) == ui32(INHERIT_DIR) << Dir_Pos)
|
||||
{
|
||||
bits &= ~(Dir_Mask << Dir_Pos);
|
||||
bits |= (tmplt.bits & Dir_Mask << Dir_Pos);
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/// Is font resolved?
|
||||
|
267
src/lyxfont.h
267
src/lyxfont.h
@ -37,8 +37,6 @@
|
||||
|
||||
class LyXLex;
|
||||
|
||||
#define NEW_BITS 1
|
||||
|
||||
///
|
||||
class LyXFont {
|
||||
public:
|
||||
@ -372,7 +370,6 @@ public:
|
||||
bool equalExceptLatex(LyXFont const &) const;
|
||||
|
||||
private:
|
||||
#ifdef NEW_BITS
|
||||
///
|
||||
struct FontBits {
|
||||
bool operator==(FontBits const & fb1) const {
|
||||
@ -402,89 +399,9 @@ private:
|
||||
FONT_MISC_STATE latex;
|
||||
FONT_DIRECTION direction;
|
||||
};
|
||||
#else
|
||||
/// This have to be at least 32 bits, but 64 or more does not hurt
|
||||
typedef unsigned int ui32;
|
||||
#endif
|
||||
|
||||
/** Representation: bit table
|
||||
Layout of bit table:
|
||||
11 1111 111 122 222 222 2233
|
||||
Bit 012 34 567 8901 2345 678 901 234 567 8901
|
||||
FFF SS SSS SSSS CCCC EEE UUU NNN LLL
|
||||
aaa ee hhh iiii oooo mmm nnn ooo aaa
|
||||
mmm rr aaa zzzz llll ppp ddd uuu ttt
|
||||
|
||||
Bit 76543210 76543210 76543210 76543210
|
||||
--- Fam_Pos
|
||||
-- Ser_Pos
|
||||
--- Sha_Pos
|
||||
---- Siz_Pos
|
||||
---- Col_Pos
|
||||
--- Emp_Pos
|
||||
--- Und_Pos
|
||||
- -- Nou_Pos
|
||||
--- Lat_Pos
|
||||
---- Dir_Pos
|
||||
|
||||
Some might think this is a dirty representation, but it gives
|
||||
us at least 25% speed-up, so why not? (Asger)
|
||||
|
||||
First of all it is a maintence nightmare...and now that we need
|
||||
to enlarge the Color bits with 2 (from 4 to 6), we have a problem
|
||||
since a 32 bit entity is not large enough... (Lgb)
|
||||
*/
|
||||
|
||||
#ifdef NEW_BITS
|
||||
FontBits bits;
|
||||
#else
|
||||
ui32 bits;
|
||||
|
||||
///
|
||||
enum FONT_POSITION {
|
||||
///
|
||||
Fam_Pos = 0,
|
||||
///
|
||||
Ser_Pos = 3,
|
||||
///
|
||||
Sha_Pos = 5,
|
||||
///
|
||||
Siz_Pos = 8,
|
||||
///
|
||||
Col_Pos = 12,
|
||||
///
|
||||
Emp_Pos = 16,
|
||||
///
|
||||
Und_Pos = 19,
|
||||
///
|
||||
Nou_Pos = 22,
|
||||
///
|
||||
Lat_Pos = 25,
|
||||
///
|
||||
Dir_Pos = 28
|
||||
};
|
||||
|
||||
///
|
||||
enum FONT_MASK {
|
||||
///
|
||||
Fam_Mask = 0x07,
|
||||
///
|
||||
Ser_Mask = 0x03,
|
||||
///
|
||||
Sha_Mask = 0x07,
|
||||
///
|
||||
Siz_Mask = 0x0f,
|
||||
///
|
||||
Col_Mask = 0x0f,
|
||||
///
|
||||
Dir_Mask = 0x07,
|
||||
///
|
||||
Misc_Mask = 0x07
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef NEW_BITS
|
||||
/// Sane font
|
||||
static FontBits sane;
|
||||
|
||||
@ -494,43 +411,6 @@ private:
|
||||
/// All ignore font
|
||||
static FontBits ignore;
|
||||
|
||||
#else
|
||||
/// Sane font
|
||||
enum { sane = ui32(ROMAN_FAMILY) << Fam_Pos
|
||||
| ui32(MEDIUM_SERIES) << Ser_Pos
|
||||
| ui32(UP_SHAPE) << Sha_Pos
|
||||
| ui32(SIZE_NORMAL) << Siz_Pos
|
||||
| ui32(LColor::none) << Col_Pos
|
||||
| ui32(OFF) << Emp_Pos
|
||||
| ui32(OFF) << Und_Pos
|
||||
| ui32(OFF) << Nou_Pos
|
||||
| ui32(OFF) << Lat_Pos
|
||||
| ui32(LTR_DIR) << Dir_Pos};
|
||||
|
||||
/// All inherit font
|
||||
enum{ inherit = ui32(INHERIT_FAMILY) << Fam_Pos
|
||||
| ui32(INHERIT_SERIES) << Ser_Pos
|
||||
| ui32(INHERIT_SHAPE) << Sha_Pos
|
||||
| ui32(INHERIT_SIZE) << Siz_Pos
|
||||
| ui32(LColor::inherit) << Col_Pos
|
||||
| ui32(INHERIT) << Emp_Pos
|
||||
| ui32(INHERIT) << Und_Pos
|
||||
| ui32(INHERIT) << Nou_Pos
|
||||
| ui32(INHERIT) << Lat_Pos
|
||||
| ui32(INHERIT_DIR) << Dir_Pos};
|
||||
|
||||
/// All ignore font
|
||||
enum{ ignore = ui32(IGNORE_FAMILY) << Fam_Pos
|
||||
| ui32(IGNORE_SERIES) << Ser_Pos
|
||||
| ui32(IGNORE_SHAPE) << Sha_Pos
|
||||
| ui32(IGNORE_SIZE) << Siz_Pos
|
||||
| ui32(LColor::ignore) << Col_Pos
|
||||
| ui32(IGNORE) << Emp_Pos
|
||||
| ui32(IGNORE) << Und_Pos
|
||||
| ui32(IGNORE) << Nou_Pos
|
||||
| ui32(IGNORE) << Lat_Pos
|
||||
| ui32(IGNORE_DIR) << Dir_Pos};
|
||||
#endif
|
||||
/// Updates a misc setting according to request
|
||||
LyXFont::FONT_MISC_STATE setMisc(LyXFont::FONT_MISC_STATE newfont,
|
||||
LyXFont::FONT_MISC_STATE org);
|
||||
@ -581,11 +461,6 @@ inline LyXFont & LyXFont::operator=(LyXFont const & x)
|
||||
}
|
||||
|
||||
|
||||
#ifdef NEW_BITS
|
||||
// You don't have to understand the stuff below :-)
|
||||
// It works, and it's bloody fast. (Asger)
|
||||
// And impossible to work with. (Lgb)
|
||||
|
||||
inline
|
||||
LyXFont::FONT_FAMILY LyXFont::family() const
|
||||
{
|
||||
@ -732,147 +607,5 @@ LyXFont & LyXFont::setDirection(LyXFont::FONT_DIRECTION d)
|
||||
bits.direction = d;
|
||||
return *this;
|
||||
}
|
||||
#else
|
||||
// You don't have to understand the stuff below :-)
|
||||
// It works, and it's bloody fast. (Asger)
|
||||
// And impossible to work with. (Lgb)
|
||||
|
||||
inline LyXFont::FONT_FAMILY LyXFont::family() const
|
||||
{
|
||||
return LyXFont::FONT_FAMILY((bits >> Fam_Pos) & Fam_Mask);
|
||||
}
|
||||
|
||||
|
||||
inline LyXFont::FONT_SERIES LyXFont::series() const
|
||||
{
|
||||
return LyXFont::FONT_SERIES((bits >> Ser_Pos) & Ser_Mask);
|
||||
}
|
||||
|
||||
|
||||
inline LyXFont::FONT_SHAPE LyXFont::shape() const
|
||||
{
|
||||
return LyXFont::FONT_SHAPE((bits >> Sha_Pos) & Sha_Mask);
|
||||
}
|
||||
|
||||
|
||||
inline LyXFont::FONT_SIZE LyXFont::size() const
|
||||
{
|
||||
return LyXFont::FONT_SIZE((bits >> Siz_Pos) & Siz_Mask);
|
||||
}
|
||||
|
||||
|
||||
inline LyXFont::FONT_MISC_STATE LyXFont::emph() const
|
||||
{
|
||||
return LyXFont::FONT_MISC_STATE((bits >> Emp_Pos) & Misc_Mask);
|
||||
}
|
||||
|
||||
|
||||
inline LyXFont::FONT_MISC_STATE LyXFont::underbar() const
|
||||
{
|
||||
return LyXFont::FONT_MISC_STATE((bits >> Und_Pos) & Misc_Mask);
|
||||
}
|
||||
|
||||
|
||||
inline LyXFont::FONT_MISC_STATE LyXFont::noun() const
|
||||
{
|
||||
return LyXFont::FONT_MISC_STATE((bits >> Nou_Pos) & Misc_Mask);
|
||||
}
|
||||
|
||||
|
||||
inline LyXFont::FONT_MISC_STATE LyXFont::latex() const
|
||||
{
|
||||
return LyXFont::FONT_MISC_STATE((bits >> Lat_Pos) & Misc_Mask);
|
||||
}
|
||||
|
||||
|
||||
inline LColor::color LyXFont::color() const
|
||||
{
|
||||
return LColor::color((bits >> Col_Pos) & Col_Mask);
|
||||
}
|
||||
|
||||
|
||||
inline LyXFont::FONT_DIRECTION LyXFont::direction() const
|
||||
{
|
||||
return LyXFont::FONT_DIRECTION((bits >> Dir_Pos) & Dir_Mask);
|
||||
}
|
||||
|
||||
inline LyXFont & LyXFont::setFamily(LyXFont::FONT_FAMILY f)
|
||||
{
|
||||
bits &= ~(Fam_Mask << Fam_Pos);
|
||||
bits |= ui32(f) << Fam_Pos;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
inline LyXFont & LyXFont::setSeries(LyXFont::FONT_SERIES s)
|
||||
{
|
||||
bits &= ~(Ser_Mask << Ser_Pos);
|
||||
bits |= ui32(s) << Ser_Pos;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
inline LyXFont & LyXFont::setShape(LyXFont::FONT_SHAPE s)
|
||||
{
|
||||
bits &= ~(Sha_Mask << Sha_Pos);
|
||||
bits |= ui32(s) << Sha_Pos;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
inline LyXFont & LyXFont::setSize(LyXFont::FONT_SIZE s)
|
||||
{
|
||||
bits &= ~(Siz_Mask << Siz_Pos);
|
||||
bits |= ui32(s) << Siz_Pos;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
inline LyXFont & LyXFont::setEmph(LyXFont::FONT_MISC_STATE e)
|
||||
{
|
||||
bits &= ~(Misc_Mask << Emp_Pos);
|
||||
bits |= ui32(e) << Emp_Pos;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
inline LyXFont & LyXFont::setUnderbar(LyXFont::FONT_MISC_STATE u)
|
||||
{
|
||||
bits &= ~(Misc_Mask << Und_Pos);
|
||||
bits |= ui32(u) << Und_Pos;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
inline LyXFont & LyXFont::setNoun(LyXFont::FONT_MISC_STATE n)
|
||||
{
|
||||
bits &= ~(Misc_Mask << Nou_Pos);
|
||||
bits |= ui32(n) << Nou_Pos;
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline LyXFont & LyXFont::setLatex(LyXFont::FONT_MISC_STATE l)
|
||||
{
|
||||
bits &= ~(Misc_Mask << Lat_Pos);
|
||||
bits |= ui32(l) << Lat_Pos;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
inline LyXFont & LyXFont::setColor(LColor::color c)
|
||||
{
|
||||
bits &= ~(Col_Mask << Col_Pos);
|
||||
bits |= ui32(c) << Col_Pos;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
inline LyXFont & LyXFont::setDirection(LyXFont::FONT_DIRECTION d)
|
||||
{
|
||||
bits &= ~(Dir_Mask << Dir_Pos);
|
||||
bits |= ui32(d) << Dir_Pos;
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -120,8 +120,6 @@ extern int getISOCodeFromLaTeX(char *);
|
||||
|
||||
extern void ShowLatexLog();
|
||||
|
||||
extern void UpdateInset(BufferView *, Inset * inset, bool mark_dirty = true);
|
||||
|
||||
/* === globals =========================================================== */
|
||||
|
||||
bool LyXFunc::show_sc = true;
|
||||
@ -660,22 +658,6 @@ string LyXFunc::Dispatch(int ac,
|
||||
|
||||
case LFUN_CENTER: // this is center and redraw.
|
||||
owner->view()->center();
|
||||
#if 0
|
||||
owner->view()->beforeChange();
|
||||
if (owner->view()->text->cursor.y >
|
||||
owner->view()->getWorkArea()->height() / 2)
|
||||
{
|
||||
owner->view()->getScreen()->
|
||||
Draw(owner->view()->text->cursor.y -
|
||||
owner->view()->getWorkArea()->height() / 2
|
||||
);
|
||||
} else { // <=
|
||||
owner->view()->getScreen()->
|
||||
Draw(0);
|
||||
}
|
||||
owner->view()->update(0);
|
||||
owner->view()->redraw();
|
||||
#endif
|
||||
break;
|
||||
|
||||
case LFUN_APPENDIX:
|
||||
@ -1249,7 +1231,7 @@ string LyXFunc::Dispatch(int ac,
|
||||
inset->setFlag(InsetRef::PAGE_REF);
|
||||
else
|
||||
inset->setFlag(InsetRef::REF);
|
||||
UpdateInset(owner->view(), inset);
|
||||
owner->view()->updateInset(inset, true);
|
||||
} else {
|
||||
setErrorMessage(N_("No cross-reference to toggle"));
|
||||
}
|
||||
|
@ -487,7 +487,7 @@ private:
|
||||
mutable Row * firstrow;
|
||||
///
|
||||
mutable Row * lastrow;
|
||||
|
||||
|
||||
/** Copybuffer for copy environment type
|
||||
Asger has learned that this should be a buffer-property instead
|
||||
Lgb has learned that 'char' is a lousy type for non-characters
|
||||
@ -566,6 +566,7 @@ private:
|
||||
|
||||
///
|
||||
LyXParagraph::size_type BeginningOfMainBody(LyXParagraph * par) const;
|
||||
|
||||
/** Returns the left beginning of the text.
|
||||
This information cannot be taken from the layouts-objekt, because
|
||||
in LaTeX the beginning of the text fits in some cases
|
||||
|
@ -27,7 +27,6 @@
|
||||
#include "math_cursor.h"
|
||||
#include "math_parser.h"
|
||||
#include "lyx_main.h"
|
||||
#include "lyx_cb.h"
|
||||
#include "minibuffer.h"
|
||||
#include "BufferView.h"
|
||||
#include "lyxtext.h"
|
||||
@ -39,8 +38,6 @@
|
||||
#include "LyXView.h"
|
||||
#include "Painter.h"
|
||||
|
||||
extern void UpdateInset(BufferView *, Inset * inset, bool mark_dirty = true);
|
||||
|
||||
extern char * mathed_label;
|
||||
|
||||
extern char const * latex_special_chars;
|
||||
@ -460,7 +457,7 @@ void InsetFormula::Edit(BufferView * bv, int x, int y)
|
||||
mathcursor = new MathedCursor(par);
|
||||
bv->lockInset(this);
|
||||
par->Metrics();
|
||||
UpdateInset(bv, this, false);
|
||||
bv->updateInset(this, false);
|
||||
x += par->xo;
|
||||
y += par->yo;
|
||||
mathcursor->SetPos(x, y);
|
||||
@ -479,7 +476,7 @@ void InsetFormula::InsetUnlock(BufferView * bv)
|
||||
delete mathcursor;
|
||||
}
|
||||
mathcursor = 0;
|
||||
UpdateInset(bv, this, false);
|
||||
bv->updateInset(this, false);
|
||||
}
|
||||
|
||||
|
||||
@ -558,7 +555,7 @@ void InsetFormula::ToggleInsetSelection(BufferView * bv)
|
||||
// x -= par->xo;
|
||||
// y -= par->yo;
|
||||
|
||||
UpdateInset(bv, this, false);
|
||||
bv->updateInset(this, false);
|
||||
|
||||
}
|
||||
|
||||
@ -637,7 +634,7 @@ void InsetFormula::UpdateLocal(BufferView * bv)
|
||||
{
|
||||
par->Metrics(); // To inform lyx kernel the exact size
|
||||
// (there were problems with arrays).
|
||||
UpdateInset(bv, this);
|
||||
bv->updateInset(this, true);
|
||||
}
|
||||
|
||||
|
||||
@ -652,7 +649,7 @@ void InsetFormula::InsetButtonRelease(BufferView * bv,
|
||||
if (sel_flag) {
|
||||
sel_flag = false;
|
||||
sel_x = sel_y = 0;
|
||||
UpdateInset(bv, this, false);
|
||||
bv->updateInset(this, false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -664,7 +661,7 @@ void InsetFormula::InsetButtonPress(BufferView * bv,
|
||||
sel_x = x; sel_y = y;
|
||||
if (mathcursor->Selection()) {
|
||||
mathcursor->SelClear();
|
||||
UpdateInset(bv, this, false);
|
||||
bv->updateInset(this, false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -688,7 +685,7 @@ void InsetFormula::InsetMotionNotify(BufferView * bv,
|
||||
ShowInsetCursor(bv);
|
||||
mathcursor->GetPos(x, y);
|
||||
if (sel_x!= x || sel_y!= y)
|
||||
UpdateInset(bv, this, false);
|
||||
bv->updateInset(this, false);
|
||||
sel_x = x; sel_y = y;
|
||||
}
|
||||
}
|
||||
@ -788,7 +785,7 @@ bool InsetFormula::LocalDispatch(BufferView * bv, int action, char const * arg)
|
||||
break;
|
||||
|
||||
if (!mathcursor->InMacroMode() && mathcursor->pullArg()) {
|
||||
UpdateInset(bv, this);
|
||||
bv->updateInset(this, true);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -796,7 +793,7 @@ bool InsetFormula::LocalDispatch(BufferView * bv, int action, char const * arg)
|
||||
//current_view->lockedInsetStoreUndo(Undo::INSERT);
|
||||
bv->lockedInsetStoreUndo(Undo::DELETE);
|
||||
mathcursor->Delete();
|
||||
UpdateInset(bv, this);
|
||||
bv->updateInset(this, true);
|
||||
break;
|
||||
// case LFUN_GETXY:
|
||||
// sprintf(dispatch_buffer, "%d %d",);
|
||||
|
@ -26,7 +26,6 @@
|
||||
#include "math_parser.h"
|
||||
#include "math_macro.h"
|
||||
#include "lyx_main.h"
|
||||
#include "lyx_cb.h"
|
||||
#include "BufferView.h"
|
||||
#include "gettext.h"
|
||||
#include "Painter.h"
|
||||
|
@ -27,7 +27,6 @@
|
||||
#endif
|
||||
|
||||
#include "menus.h"
|
||||
#include "lyx_cb.h"
|
||||
#include "version.h"
|
||||
#include "lyxfont.h"
|
||||
#include "lyx_main.h"
|
||||
|
@ -3,10 +3,10 @@
|
||||
*
|
||||
* LyX, The Document Processor
|
||||
*
|
||||
* Copyright (C) 1995 Matthias Ettrich
|
||||
* Copyright (C) 1995-1998 The LyX Team.
|
||||
* Copyright 1995 Matthias Ettrich
|
||||
* Copyright 1995-2000 The LyX Team.
|
||||
*
|
||||
* This file is Copyleft (C) 1996-1998
|
||||
* This file is Copyleft 1996-2000
|
||||
* Lars Gullik Bjønnes
|
||||
*
|
||||
* ====================================================== */
|
||||
@ -14,15 +14,14 @@
|
||||
#include <config.h>
|
||||
#include FORMS_H_LOCATION
|
||||
#include "latexoptions.h"
|
||||
#include "lyx_cb.h"
|
||||
#include "lyx_main.h"
|
||||
#include "buffer.h"
|
||||
#include "BufferView.h"
|
||||
|
||||
extern FD_LaTeXOptions *fd_latex_options;
|
||||
extern BufferView *current_view;
|
||||
extern FD_LaTeXOptions * fd_latex_options;
|
||||
extern BufferView * current_view;
|
||||
|
||||
void LaTeXOptionsOK(FL_OBJECT *ob, long data)
|
||||
void LaTeXOptionsOK(FL_OBJECT * ob, long data)
|
||||
{
|
||||
LaTeXOptionsApply(ob, data);
|
||||
LaTeXOptionsCancel(ob, data);
|
||||
|
37
src/text.C
37
src/text.C
@ -4395,32 +4395,44 @@ Row * LyXText::GetRow(LyXParagraph * par,
|
||||
LyXParagraph::size_type pos, long & y) const
|
||||
{
|
||||
Row * tmprow;
|
||||
|
||||
|
||||
if (currentrow) {
|
||||
if (par == currentrow->par || par == currentrow->par->Previous()) {
|
||||
if (par == currentrow->par
|
||||
|| par == currentrow->par->Previous()) {
|
||||
// do not dereference par, it may have been deleted
|
||||
// already! (Matthias)
|
||||
while (currentrow->previous && currentrow->previous->par != par) {
|
||||
// already! (Matthias)
|
||||
|
||||
// Walk backwards as long as the previous
|
||||
// rows par is not par
|
||||
while (currentrow->previous
|
||||
&& currentrow->previous->par != par) {
|
||||
currentrow = currentrow->previous;
|
||||
currentrow_y -= currentrow->height;
|
||||
}
|
||||
while (currentrow->previous && currentrow->previous->par == par) {
|
||||
// Walk backwards as long as the previous
|
||||
// rows par _is_ par
|
||||
while (currentrow->previous
|
||||
&& currentrow->previous->par == par) {
|
||||
currentrow = currentrow->previous;
|
||||
currentrow_y -= currentrow->height;
|
||||
}
|
||||
}
|
||||
|
||||
tmprow = currentrow;
|
||||
y = currentrow_y;
|
||||
// find the first row of the specified paragraph
|
||||
while (tmprow->next && (tmprow->par != par)) {
|
||||
while (tmprow->next
|
||||
&& tmprow->par != par) {
|
||||
y += tmprow->height;
|
||||
tmprow = tmprow->next;
|
||||
}
|
||||
|
||||
if (tmprow->par == par){
|
||||
// now find the wanted row
|
||||
while (tmprow->pos < pos && tmprow->next && tmprow->next->par == par &&
|
||||
tmprow->next->pos <= pos) {
|
||||
while (tmprow->pos < pos
|
||||
&& tmprow->next
|
||||
&& tmprow->next->par == par
|
||||
&& tmprow->next->pos <= pos) {
|
||||
y += tmprow->height;
|
||||
tmprow = tmprow->next;
|
||||
}
|
||||
@ -4429,17 +4441,20 @@ Row * LyXText::GetRow(LyXParagraph * par,
|
||||
return tmprow;
|
||||
}
|
||||
}
|
||||
|
||||
tmprow = firstrow;
|
||||
y = 0;
|
||||
// find the first row of the specified paragraph
|
||||
while (tmprow->next && (tmprow->par != par)) {
|
||||
while (tmprow->next && tmprow->par != par) {
|
||||
y += tmprow->height;
|
||||
tmprow = tmprow->next;
|
||||
}
|
||||
|
||||
// now find the wanted row
|
||||
while (tmprow->pos < pos && tmprow->next && tmprow->next->par == par &&
|
||||
tmprow->next->pos <= pos) {
|
||||
while (tmprow->pos < pos
|
||||
&& tmprow->next
|
||||
&& tmprow->next->par == par
|
||||
&& tmprow->next->pos <= pos) {
|
||||
y += tmprow->height;
|
||||
tmprow = tmprow->next;
|
||||
}
|
||||
|
17
src/text2.C
17
src/text2.C
@ -25,7 +25,6 @@
|
||||
#include "layout.h"
|
||||
#include "LyXView.h"
|
||||
#include "support/textutils.h"
|
||||
#include "lyx_cb.h"
|
||||
#include "undo.h"
|
||||
#include "minibuffer.h"
|
||||
#include "buffer.h"
|
||||
@ -58,11 +57,12 @@ LyXText::LyXText(BufferView * bv, int pw, Buffer * p)
|
||||
current_font = GetFont(par, 0);
|
||||
|
||||
height = 0;
|
||||
|
||||
|
||||
while (par) {
|
||||
InsertParagraph(par, lastrow);
|
||||
par = par->Next();
|
||||
}
|
||||
|
||||
// set cursor at the very top position
|
||||
selection = true; /* these setting is necessary
|
||||
because of the delete-empty-
|
||||
@ -244,8 +244,7 @@ void LyXText::InsertRow(Row * row, LyXParagraph * par,
|
||||
tmprow->previous = 0;
|
||||
tmprow->next = firstrow;
|
||||
firstrow = tmprow;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
tmprow->previous = row;
|
||||
tmprow->next = row->next;
|
||||
row->next = tmprow;
|
||||
@ -260,7 +259,7 @@ void LyXText::InsertRow(Row * row, LyXParagraph * par,
|
||||
|
||||
tmprow->par = par;
|
||||
tmprow->pos = pos;
|
||||
|
||||
|
||||
if (row == lastrow)
|
||||
lastrow = tmprow;
|
||||
++number_of_rows; // one more row
|
||||
@ -285,8 +284,7 @@ void LyXText::RemoveRow(Row * row) const
|
||||
row->next->previous = row->previous;
|
||||
if (!row->previous) {
|
||||
firstrow = row->next;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
row->previous->next = row->next;
|
||||
}
|
||||
if (row == lastrow)
|
||||
@ -313,7 +311,7 @@ void LyXText::RemoveParagraph(Row * row) const
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// insert the specified paragraph behind the specified row
|
||||
void LyXText::InsertParagraph(LyXParagraph * par, Row * row) const
|
||||
{
|
||||
@ -326,8 +324,7 @@ void LyXText::InsertParagraph(LyXParagraph * par, Row * row) const
|
||||
if (!row) {
|
||||
firstrow->height = 0;
|
||||
AppendParagraph(firstrow);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
row->next->height = 0;
|
||||
AppendParagraph(row->next);
|
||||
}
|
||||
|
@ -27,7 +27,6 @@
|
||||
#include "lyxlex.h"
|
||||
#include "debug.h"
|
||||
#include "combox.h"
|
||||
#include "lyx_cb.h"
|
||||
#include "LyXView.h"
|
||||
#include "LyXAction.h"
|
||||
#include "support/lstrings.h"
|
||||
|
Loading…
Reference in New Issue
Block a user