+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
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
/* @@ end of prolog @@ */
/* List of already loaded domains. */
+
static struct loaded_l10nfile *_nl_loaded_domains;
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,
}
+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;
else if (pid > 0)
sigchldhandler(pid, &status);
}
- if (InsetUpdateList)
- UpdateInsetUpdateList();
+ view->updatelist.update(view);
+
if (view && !view->screen){
goto set_timer_and_return;
}
}
+bool BufferView::belowMouse() const
+{
+ return workarea->belowMouse();
+}
+
+
void BufferView::showCursor()
{
if (screen)
#include "BackStack.h"
#include "LaTeX.h"
#include "undo.h"
+#include "UpdateInset.h"
class LyXView;
class Buffer;
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.
///
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_;
int last_click_x, last_click_y;
///
WorkArea * workarea;
+ ///
+ UpdateInset updatelist;
+public:
+ ///
+ void updateInset(Inset *, bool);
+ ///
+ void pushIntoUpdateList(Inset * i) {
+ updatelist.push(i);
+ }
};
#endif
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;
+ }
+ }
+}
}
}
+
void SendtoApplyCB(FL_OBJECT *, long)
{
if (!current_view->available())
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);
TableLayout.C \
TextCache.C \
TextCache.h \
+ UpdateInset.C \
+ UpdateInset.h \
WorkArea.C \
WorkArea.h \
bibforms.h \
--- /dev/null
+#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
+ }
+}
+
+
--- /dev/null
+// -*- 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
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;
///
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;
*
* 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
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();
}
-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;
///
bool empty() const;
- /// Saves buffer. Returns false if unsuccesful.
-#if 0
- bool write(Buffer *, bool makeBackup);
-#endif
-
///
bool QwriteAll();
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 *);
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();
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;
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
}
}
-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) {
<< endl;
}
// add inset figures[i]->inset into to_update list
- PutInsetIntoInsetUpdateList(figures[i]->inset);
+ current_view->pushIntoUpdateList(figures[i]->inset);
+
+ //PutInsetIntoInsetUpdateList(figures[i]->inset);
}
}
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);
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);
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
extern LyXRC * lyxrc;
extern BufferList bufferlist;
-extern void UpdateInset(BufferView *, Inset * inset, bool mark_dirty = true);
FD_include * create_form_include(void)
}
fl_hide_form(form->include);
- UpdateInset(current_view, inset);
+ current_view->updateInset(inset, true);
break;
} // fall through
}
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;
#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;
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
#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)
inset->flag = InsetUrl::URL;
else
inset->flag = InsetUrl::HTML_URL;
- UpdateInset(bv, inset);
+ bv->updateInset(inset, true);
}
if (inset->fd_form_url) {
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]
/* 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;
/*
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();
}
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
///
extern void AllowInput();
-///
-struct InsetUpdateStruct {
- ///
- Inset * inset;
- ///
- InsetUpdateStruct * next;
-};
#endif
#include "lyxrc.h"
#include "gettext.h"
#include "lyx_gui_misc.h"
-#include "lyx_cb.h"
#include "lyxlookup.h"
#include "bufferlist.h"
{ "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::ignore = { IGNORE_FAMILY,
- IGNORE_SERIES,
- IGNORE_SHAPE,
- IGNORE_SIZE,
- LColor::ignore,
- IGNORE,
- IGNORE,
- IGNORE,
- IGNORE,
- IGNORE_DIR };
-#endif
+
+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 };
+
/// Decreases font size by one
LyXFont & LyXFont::decSize()
/// 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) {
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?
class LyXLex;
-#define NEW_BITS 1
-
///
class LyXFont {
public:
bool equalExceptLatex(LyXFont const &) const;
private:
-#ifdef NEW_BITS
///
struct FontBits {
bool operator==(FontBits const & fb1) const {
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;
/// 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);
}
-#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
{
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
extern void ShowLatexLog();
-extern void UpdateInset(BufferView *, Inset * inset, bool mark_dirty = true);
-
/* === globals =========================================================== */
bool LyXFunc::show_sc = true;
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:
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"));
}
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
///
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
#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"
#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;
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);
delete mathcursor;
}
mathcursor = 0;
- UpdateInset(bv, this, false);
+ bv->updateInset(this, false);
}
// x -= par->xo;
// y -= par->yo;
- UpdateInset(bv, this, false);
+ bv->updateInset(this, false);
}
{
par->Metrics(); // To inform lyx kernel the exact size
// (there were problems with arrays).
- UpdateInset(bv, this);
+ bv->updateInset(this, true);
}
if (sel_flag) {
sel_flag = false;
sel_x = sel_y = 0;
- UpdateInset(bv, this, false);
+ bv->updateInset(this, false);
}
}
sel_x = x; sel_y = y;
if (mathcursor->Selection()) {
mathcursor->SelClear();
- UpdateInset(bv, this, false);
+ bv->updateInset(this, false);
}
}
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;
}
}
break;
if (!mathcursor->InMacroMode() && mathcursor->pullArg()) {
- UpdateInset(bv, this);
+ bv->updateInset(this, true);
break;
}
//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",);
#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"
#endif
#include "menus.h"
-#include "lyx_cb.h"
#include "version.h"
#include "lyxfont.h"
#include "lyx_main.h"
*
* 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
*
* ====================================================== */
#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);
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;
}
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;
}
#include "layout.h"
#include "LyXView.h"
#include "support/textutils.h"
-#include "lyx_cb.h"
#include "undo.h"
#include "minibuffer.h"
#include "buffer.h"
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-
tmprow->previous = 0;
tmprow->next = firstrow;
firstrow = tmprow;
- }
- else {
+ } else {
tmprow->previous = row;
tmprow->next = row->next;
row->next = tmprow;
tmprow->par = par;
tmprow->pos = pos;
-
+
if (row == lastrow)
lastrow = tmprow;
++number_of_rows; // one more row
row->next->previous = row->previous;
if (!row->previous) {
firstrow = row->next;
- }
- else {
+ } else {
row->previous->next = row->next;
}
if (row == lastrow)
}
}
-
+
// insert the specified paragraph behind the specified row
void LyXText::InsertParagraph(LyXParagraph * par, Row * row) const
{
if (!row) {
firstrow->height = 0;
AppendParagraph(firstrow);
- }
- else {
+ } else {
row->next->height = 0;
AppendParagraph(row->next);
}
#include "lyxlex.h"
#include "debug.h"
#include "combox.h"
-#include "lyx_cb.h"
#include "LyXView.h"
#include "LyXAction.h"
#include "support/lstrings.h"