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
|
|
|
|
*
|
2000-01-24 18:34:46 +00:00
|
|
|
* Copyright 1995 Matthias Ettrich
|
|
|
|
* Copyright 1995-2000 The LyX Team.
|
1999-11-04 01:40:20 +00:00
|
|
|
*
|
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
|
2000-02-04 09:38:32 +00:00
|
|
|
#include "undo.h"
|
2000-10-02 00:55:02 +00:00
|
|
|
#include <boost/utility.hpp>
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
class LyXView;
|
2000-02-04 09:38:32 +00:00
|
|
|
class LyXText;
|
2000-04-08 17:02:02 +00:00
|
|
|
class TeXErrors;
|
2000-05-15 14:49:36 +00:00
|
|
|
class Buffer;
|
2000-06-19 15:33:58 +00:00
|
|
|
class LyXScreen;
|
2000-06-21 15:07:57 +00:00
|
|
|
class WorkArea;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
///
|
2000-08-01 17:33:32 +00:00
|
|
|
class BufferView : public noncopyable {
|
1999-09-27 18:44:28 +00:00
|
|
|
public:
|
2000-06-12 11:27:15 +00:00
|
|
|
///
|
|
|
|
enum UpdateCodes {
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
2000-06-12 11:27:15 +00:00
|
|
|
UPDATE = 0,
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
2000-06-12 11:27:15 +00:00
|
|
|
SELECT = 1,
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
2000-06-12 11:27:15 +00:00
|
|
|
FITCUR = 2,
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
2000-06-12 11:27:15 +00:00
|
|
|
CHANGE = 4
|
|
|
|
};
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
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();
|
|
|
|
///
|
2000-04-08 17:02:02 +00:00
|
|
|
Buffer * buffer() const;
|
2000-02-10 17:53:36 +00:00
|
|
|
///
|
|
|
|
Painter & painter();
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2000-06-19 15:33:58 +00:00
|
|
|
LyXScreen * screen() const;
|
|
|
|
///
|
2000-06-21 15:07:57 +00:00
|
|
|
WorkArea * workarea() const;
|
|
|
|
///
|
1999-11-09 23:52:04 +00:00
|
|
|
void buffer(Buffer * b);
|
2000-02-10 17:53:36 +00:00
|
|
|
///
|
|
|
|
void resize(int, int, int, int);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
|
|
|
void resize();
|
|
|
|
///
|
|
|
|
void redraw();
|
|
|
|
///
|
2000-09-28 14:05:24 +00:00
|
|
|
void fitCursor(LyXText *);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
|
|
|
void update();
|
2000-08-07 20:58:24 +00:00
|
|
|
//
|
2000-06-12 11:27:15 +00:00
|
|
|
void update(UpdateCodes uc);
|
2000-01-06 02:44:26 +00:00
|
|
|
///
|
1999-09-27 18:44:28 +00:00
|
|
|
void updateScrollbar();
|
|
|
|
///
|
2000-08-07 20:58:24 +00:00
|
|
|
Inset * checkInsetHit(LyXText *, int & x, int & y,
|
|
|
|
unsigned int button);
|
2000-07-04 11:30:07 +00:00
|
|
|
///
|
1999-09-27 18:44:28 +00:00
|
|
|
void redoCurrentBuffer();
|
|
|
|
///
|
|
|
|
int resizeCurrentBuffer();
|
|
|
|
///
|
|
|
|
void gotoError();
|
|
|
|
///
|
|
|
|
void cursorPrevious();
|
|
|
|
///
|
|
|
|
void cursorNext();
|
|
|
|
///
|
|
|
|
bool available() const;
|
|
|
|
///
|
2000-04-08 17:02:02 +00:00
|
|
|
LyXView * owner() const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2000-01-07 03:42:16 +00:00
|
|
|
void beforeChange();
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
|
|
|
void savePosition();
|
|
|
|
///
|
|
|
|
void restorePosition();
|
2000-06-05 15:12:09 +00:00
|
|
|
///
|
|
|
|
bool NoSavedPositions();
|
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
|
|
|
///
|
2000-06-12 11:27:15 +00:00
|
|
|
int workWidth() const;
|
2000-02-25 12:06:15 +00:00
|
|
|
///
|
2000-10-03 13:55:48 +00:00
|
|
|
UpdatableInset * theLockingInset() const;
|
|
|
|
void theLockingInset(UpdatableInset const * inset);
|
2000-01-07 03:42:16 +00:00
|
|
|
///
|
2000-02-25 12:06:15 +00:00
|
|
|
void updateInset(Inset * inset, bool mark_dirty);
|
|
|
|
///
|
2000-01-07 03:42:16 +00:00
|
|
|
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();
|
|
|
|
///
|
2000-09-14 17:53:12 +00:00
|
|
|
string const nextWord(float & value);
|
2000-01-08 21:02:58 +00:00
|
|
|
///
|
|
|
|
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();
|
2000-07-19 17:16:27 +00:00
|
|
|
#ifndef NEW_INSETS
|
2000-01-08 21:02:58 +00:00
|
|
|
///
|
|
|
|
void toggleFloat();
|
|
|
|
///
|
|
|
|
void openStuff();
|
2000-07-19 17:16:27 +00:00
|
|
|
#endif
|
2000-01-08 21:02:58 +00:00
|
|
|
///
|
|
|
|
void insertNote();
|
2000-07-19 17:16:27 +00:00
|
|
|
#ifndef NEW_INSETS
|
2000-01-08 21:02:58 +00:00
|
|
|
///
|
|
|
|
void allFloats(char flag, char figmar);
|
2000-07-19 17:16:27 +00:00
|
|
|
#endif
|
2000-01-08 21:02:58 +00:00
|
|
|
/// removes all autodeletable insets
|
|
|
|
bool removeAutoInsets();
|
|
|
|
///
|
|
|
|
void insertErrors(TeXErrors & terr);
|
|
|
|
///
|
|
|
|
void setCursorFromRow(int row);
|
2000-08-07 20:58:24 +00:00
|
|
|
/** Insert an inset into the buffer.
|
|
|
|
Placie it in a layout of lout,
|
|
|
|
if no_table make sure that it doesn't end up in a table.
|
|
|
|
*/
|
2000-05-15 14:49:36 +00:00
|
|
|
bool insertInset(Inset * inset, string const & lout = string(),
|
2000-01-08 21:02:58 +00:00
|
|
|
bool no_table = false);
|
|
|
|
/// open and lock an updatable inset
|
2000-07-11 15:08:54 +00:00
|
|
|
bool open_new_inset(UpdatableInset * new_inset);
|
2000-08-07 20:58:24 +00:00
|
|
|
/** Inserts a lyx file at cursor position.
|
|
|
|
@return #false# if it fails.
|
|
|
|
*/
|
2000-01-08 21:02:58 +00:00
|
|
|
bool insertLyXFile(string const & file);
|
|
|
|
///
|
2000-04-19 14:42:19 +00:00
|
|
|
bool lockInset(UpdatableInset * inset);
|
2000-01-08 21:02:58 +00:00
|
|
|
///
|
2000-09-29 18:44:07 +00:00
|
|
|
void showLockedInsetCursor(int x, int y, int asc, int desc);
|
2000-01-08 21:02:58 +00:00
|
|
|
///
|
2000-02-17 19:59:08 +00:00
|
|
|
void hideLockedInsetCursor();
|
2000-01-08 21:02:58 +00:00
|
|
|
///
|
2000-09-29 18:44:07 +00:00
|
|
|
void fitLockedInsetCursor(int x, int y, int asc, int desc);
|
2000-01-08 21:02:58 +00:00
|
|
|
///
|
|
|
|
int unlockInset(UpdatableInset * inset);
|
|
|
|
///
|
|
|
|
void lockedInsetStoreUndo(Undo::undo_kind kind);
|
2000-02-17 19:59:08 +00:00
|
|
|
///
|
|
|
|
void showCursor();
|
|
|
|
///
|
|
|
|
void hideCursor();
|
|
|
|
///
|
|
|
|
void toggleSelection(bool = true);
|
|
|
|
///
|
|
|
|
void toggleToggle();
|
|
|
|
///
|
|
|
|
void center();
|
|
|
|
|
2000-02-10 17:53:36 +00:00
|
|
|
///
|
|
|
|
bool focus() const;
|
|
|
|
///
|
|
|
|
void focus(bool);
|
|
|
|
///
|
|
|
|
bool active() const;
|
2000-02-23 16:39:03 +00:00
|
|
|
///
|
|
|
|
bool belowMouse() const;
|
2000-04-26 13:57:28 +00:00
|
|
|
/// A callback for the slider in the scrollbar.
|
|
|
|
void scrollCB(double);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
2000-02-03 19:51:27 +00:00
|
|
|
///
|
2000-02-17 19:59:08 +00:00
|
|
|
void setState();
|
2000-02-03 19:51:27 +00:00
|
|
|
|
2000-02-10 17:53:36 +00:00
|
|
|
///
|
2000-04-08 17:02:02 +00:00
|
|
|
void pushIntoUpdateList(Inset * i);
|
|
|
|
///
|
|
|
|
void workAreaExpose();
|
2000-02-10 17:53:36 +00:00
|
|
|
///
|
2000-02-17 19:59:08 +00:00
|
|
|
void workAreaButtonPress(int x, int y, unsigned int button);
|
2000-02-10 17:53:36 +00:00
|
|
|
///
|
2000-02-17 19:59:08 +00:00
|
|
|
void workAreaButtonRelease(int x, int y, unsigned int button);
|
2000-02-10 17:53:36 +00:00
|
|
|
///
|
2000-04-08 17:02:02 +00:00
|
|
|
void workAreaMotionNotify(int x, int y, unsigned int state);
|
2000-02-10 17:53:36 +00:00
|
|
|
///
|
2000-02-23 16:39:03 +00:00
|
|
|
void doubleClick(int x, int y, unsigned int button);
|
|
|
|
///
|
2000-02-29 02:19:17 +00:00
|
|
|
void tripleClick(int x, int y, unsigned int button);
|
2000-02-23 16:39:03 +00:00
|
|
|
///
|
2000-04-14 19:20:33 +00:00
|
|
|
void enterView();
|
|
|
|
///
|
|
|
|
void leaveView();
|
2000-05-19 16:46:01 +00:00
|
|
|
///
|
|
|
|
bool ChangeRefs(string const & from, string const & to);
|
2000-05-20 01:38:25 +00:00
|
|
|
///
|
2000-05-20 21:37:05 +00:00
|
|
|
void pasteClipboard(bool asPara);
|
|
|
|
///
|
|
|
|
void stuffClipboard(string const &) const;
|
2000-04-08 17:02:02 +00:00
|
|
|
private:
|
|
|
|
struct Pimpl;
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
2000-06-26 10:29:33 +00:00
|
|
|
friend struct BufferView::Pimpl;
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
2000-04-08 17:02:02 +00:00
|
|
|
Pimpl * pimpl_;
|
1999-09-27 18:44:28 +00:00
|
|
|
};
|
|
|
|
|
2000-06-12 11:27:15 +00:00
|
|
|
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
2000-06-12 11:27:15 +00:00
|
|
|
BufferView::UpdateCodes operator|(BufferView::UpdateCodes uc1,
|
|
|
|
BufferView::UpdateCodes uc2);
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
#endif
|