1999-09-27 18:44:28 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/* This file is part of
|
1999-11-15 12:01:38 +00:00
|
|
|
* ======================================================
|
1999-11-04 01:40:20 +00:00
|
|
|
*
|
|
|
|
* LyX, The Document Processor
|
|
|
|
*
|
|
|
|
* Copyright (C) 1995 Matthias Ettrich
|
|
|
|
* Copyright (C) 1995-1998 The LyX Team.
|
|
|
|
*
|
1999-11-15 12:01:38 +00:00
|
|
|
* ====================================================== */
|
1999-09-27 18:44:28 +00:00
|
|
|
|
1999-11-04 01:40:20 +00:00
|
|
|
#ifndef BUFFER_VIEW_H
|
|
|
|
#define BUFFER_VIEW_H
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma interface
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include FORMS_H_LOCATION
|
1999-11-04 01:40:20 +00:00
|
|
|
#include "BackStack.h"
|
1999-12-10 00:07:59 +00:00
|
|
|
#include "lyxtext.h"
|
2000-01-08 21:02:58 +00:00
|
|
|
#include "LaTeX.h"
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
class LyXView;
|
|
|
|
class Buffer;
|
|
|
|
class LyXScreen;
|
|
|
|
class Inset;
|
|
|
|
|
|
|
|
///
|
|
|
|
class BufferView {
|
|
|
|
public:
|
|
|
|
///
|
1999-12-21 06:10:21 +00:00
|
|
|
BufferView(LyXView * owner, int , int , int, int);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-12-10 00:07:59 +00:00
|
|
|
~BufferView();
|
|
|
|
///
|
1999-11-09 23:52:04 +00:00
|
|
|
Buffer * buffer() const { return buffer_; }
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-09 23:52:04 +00:00
|
|
|
FL_OBJECT * getWorkArea() { return work_area; }
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-09 23:52:04 +00:00
|
|
|
void buffer(Buffer * b);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
|
|
|
void resize();
|
|
|
|
///
|
|
|
|
void redraw();
|
|
|
|
///
|
|
|
|
void fitCursor();
|
|
|
|
///
|
|
|
|
void update();
|
1999-12-10 00:07:59 +00:00
|
|
|
///
|
|
|
|
void update(signed char f);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2000-01-06 02:44:26 +00:00
|
|
|
void smallUpdate(signed char f);
|
|
|
|
///
|
1999-09-27 18:44:28 +00:00
|
|
|
void updateScrollbar();
|
|
|
|
///
|
|
|
|
void redoCurrentBuffer();
|
|
|
|
///
|
|
|
|
int resizeCurrentBuffer();
|
|
|
|
///
|
|
|
|
void gotoError();
|
|
|
|
///
|
|
|
|
void cursorPrevious();
|
|
|
|
///
|
|
|
|
void cursorNext();
|
|
|
|
///
|
|
|
|
bool available() const;
|
|
|
|
///
|
1999-11-09 23:52:04 +00:00
|
|
|
LyXView * owner() const { return owner_; }
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-12-21 06:10:21 +00:00
|
|
|
LyXScreen * getScreen() {
|
|
|
|
fl_set_timer(timer_cursor, 0.4);
|
|
|
|
return screen;
|
|
|
|
}
|
2000-01-07 03:42:16 +00:00
|
|
|
///
|
|
|
|
void beforeChange();
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
|
|
|
void savePosition();
|
|
|
|
///
|
|
|
|
void restorePosition();
|
1999-12-10 00:07:59 +00:00
|
|
|
/** This holds the mapping between buffer paragraphs and screen rows.
|
|
|
|
This should be private...but not yet. (Lgb)
|
|
|
|
*/
|
|
|
|
LyXText * text;
|
2000-01-07 03:42:16 +00:00
|
|
|
///
|
|
|
|
UpdatableInset * the_locking_inset;
|
|
|
|
///
|
|
|
|
bool inset_slept;
|
|
|
|
///
|
|
|
|
int slx;
|
|
|
|
///
|
|
|
|
int sly;
|
|
|
|
///
|
|
|
|
void insetUnlock();
|
|
|
|
///
|
|
|
|
void insetSleep();
|
|
|
|
///
|
|
|
|
void insetWakeup();
|
2000-01-08 21:02:58 +00:00
|
|
|
///
|
|
|
|
void replaceWord(string const & replacestring);
|
|
|
|
///
|
|
|
|
void endOfSpellCheck();
|
|
|
|
///
|
|
|
|
void selectLastWord();
|
|
|
|
///
|
|
|
|
char * nextWord(float & value);
|
|
|
|
///
|
|
|
|
void insertCorrectQuote();
|
|
|
|
///
|
|
|
|
void gotoNote();
|
|
|
|
///
|
|
|
|
bool gotoLabel(string const & label);
|
|
|
|
///
|
|
|
|
void paste();
|
|
|
|
///
|
|
|
|
void cut();
|
|
|
|
///
|
|
|
|
void copy();
|
|
|
|
///
|
|
|
|
void pasteEnvironment();
|
|
|
|
///
|
|
|
|
void copyEnvironment();
|
|
|
|
///
|
|
|
|
void hfill();
|
|
|
|
///
|
|
|
|
void protectedBlank();
|
|
|
|
///
|
|
|
|
void newline();
|
|
|
|
///
|
|
|
|
void menuSeparator();
|
|
|
|
///
|
|
|
|
void endOfSentenceDot();
|
|
|
|
///
|
|
|
|
void ldots();
|
|
|
|
///
|
|
|
|
void hyphenationPoint();
|
|
|
|
///
|
|
|
|
void menuUndo();
|
|
|
|
///
|
|
|
|
void menuRedo();
|
|
|
|
///
|
|
|
|
void toggleFloat();
|
|
|
|
///
|
|
|
|
void openStuff();
|
|
|
|
///
|
|
|
|
void insertNote();
|
|
|
|
///
|
|
|
|
void allFloats(char flag, char figmar);
|
|
|
|
/// removes all autodeletable insets
|
|
|
|
bool removeAutoInsets();
|
|
|
|
///
|
|
|
|
void insertErrors(TeXErrors & terr);
|
|
|
|
///
|
|
|
|
void setCursorFromRow(int row);
|
|
|
|
/** Insert an inset into the buffer
|
|
|
|
Insert inset into buffer, placing it in a layout of lout,
|
|
|
|
if no_table make sure that it doesn't end up in a table. */
|
|
|
|
void insertInset(Inset * inset, string const & lout = string(),
|
|
|
|
bool no_table = false);
|
|
|
|
/// open and lock an updatable inset
|
|
|
|
void open_new_inset(UpdatableInset * new_inset);
|
|
|
|
/// Inserts a lyx file at cursor position. Returns false if it fails.
|
|
|
|
bool insertLyXFile(string const & file);
|
|
|
|
///
|
|
|
|
int lockInset(UpdatableInset * inset);
|
|
|
|
///
|
|
|
|
void showLockedInsetCursor(long x, long y, int asc, int desc);
|
|
|
|
///
|
|
|
|
void hideLockedInsetCursor(long x, long y, int asc, int desc);
|
|
|
|
///
|
|
|
|
void fitLockedInsetCursor(long x, long y, int asc, int desc);
|
|
|
|
///
|
|
|
|
int unlockInset(UpdatableInset * inset);
|
|
|
|
///
|
|
|
|
void lockedInsetStoreUndo(Undo::undo_kind kind);
|
1999-09-27 18:44:28 +00:00
|
|
|
private:
|
|
|
|
/// Update pixmap of screen
|
|
|
|
void updateScreen();
|
|
|
|
///
|
|
|
|
int workAreaExpose();
|
|
|
|
///
|
|
|
|
void create_view(int, int, int, int);
|
|
|
|
///
|
1999-11-09 23:52:04 +00:00
|
|
|
Inset * checkInsetHit(int & x, int & y);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
|
|
|
int ScrollUp(long time);
|
|
|
|
///
|
|
|
|
int ScrollDown(long time);
|
|
|
|
///
|
|
|
|
void ScrollUpOnePage(long /*time*/);
|
|
|
|
///
|
|
|
|
void ScrollDownOnePage(long /*time*/);
|
|
|
|
|
1999-10-25 14:18:30 +00:00
|
|
|
public:
|
1999-09-27 18:44:28 +00:00
|
|
|
/// A callback for the up arrow in the scrollbar.
|
1999-11-09 23:52:04 +00:00
|
|
|
static void UpCB(FL_OBJECT * ob, long);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
/// A callback for the slider in the scrollbar.
|
1999-11-09 23:52:04 +00:00
|
|
|
static void ScrollCB(FL_OBJECT * ob, long);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
/// A callback for the down arrow in the scrollbar.
|
1999-11-09 23:52:04 +00:00
|
|
|
static void DownCB(FL_OBJECT * ob, long);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
1999-10-25 14:18:30 +00:00
|
|
|
///
|
1999-11-09 23:52:04 +00:00
|
|
|
static void CursorToggleCB(FL_OBJECT * ob, long);
|
1999-09-27 18:44:28 +00:00
|
|
|
/** Work area free object handler
|
|
|
|
*/
|
|
|
|
static int work_area_handler(FL_OBJECT *, int event,
|
|
|
|
FL_Coord, FL_Coord, int key, void *xev);
|
1999-10-25 14:18:30 +00:00
|
|
|
private:
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-09 23:52:04 +00:00
|
|
|
int WorkAreaMotionNotify(FL_OBJECT * ob,
|
1999-09-27 18:44:28 +00:00
|
|
|
Window win,
|
|
|
|
int w, int h,
|
1999-11-09 23:52:04 +00:00
|
|
|
XEvent * ev, void * d);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
|
|
|
int WorkAreaSelectionNotify(FL_OBJECT *, Window win,
|
|
|
|
int /*w*/, int /*h*/,
|
1999-11-09 23:52:04 +00:00
|
|
|
XEvent * event, void * /*d*/);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-09 23:52:04 +00:00
|
|
|
int WorkAreaButtonPress(FL_OBJECT * ob,
|
1999-09-27 18:44:28 +00:00
|
|
|
Window win,
|
|
|
|
int w, int h,
|
1999-11-09 23:52:04 +00:00
|
|
|
XEvent * ev, void * d);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-09 23:52:04 +00:00
|
|
|
int WorkAreaButtonRelease(FL_OBJECT * ob,
|
1999-09-27 18:44:28 +00:00
|
|
|
Window win,
|
|
|
|
int w, int h,
|
1999-11-09 23:52:04 +00:00
|
|
|
XEvent * ev, void * d);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-09 23:52:04 +00:00
|
|
|
LyXView * owner_;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-09 23:52:04 +00:00
|
|
|
Buffer * buffer_;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-09 23:52:04 +00:00
|
|
|
LyXScreen * screen;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
|
|
|
long current_scrollbar_value;
|
|
|
|
///
|
|
|
|
bool lyx_focus;
|
|
|
|
///
|
|
|
|
bool work_area_focus;
|
|
|
|
///
|
1999-11-09 23:52:04 +00:00
|
|
|
FL_OBJECT * work_area;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-09 23:52:04 +00:00
|
|
|
FL_OBJECT * figinset_canvas;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-09 23:52:04 +00:00
|
|
|
FL_OBJECT * scrollbar;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-09 23:52:04 +00:00
|
|
|
FL_OBJECT * button_down;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-09 23:52:04 +00:00
|
|
|
FL_OBJECT * button_up;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-09 23:52:04 +00:00
|
|
|
FL_OBJECT * timer_cursor;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
BackStack backstack;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
|
|
|
int last_click_x, last_click_y;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|