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"
|
|
|
|
|
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
|
|
|
///
|
|
|
|
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;
|
|
|
|
}
|
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;
|
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
|