summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-console/TEHistory.h
blob: 8339ec6c0347f19f0ef0d10e5f6f41268fa5e70c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/* -------------------------------------------------------------------------- */
/*                                                                            */
/* [TEHistory.H]                   History Buffer                             */
/*                                                                            */
/* -------------------------------------------------------------------------- */
/*                                                                            */
/* Copyright (c) 1997,1998 by Lars Doelle <lars.doelle@on-line.de>            */
/*                                                                            */
/* This file is part of Konsole - an X terminal for KDE                       */
/*                                                                            */
/* -------------------------------------------------------------------------- */
/*									      */
/* Ported Konsole to Qt/Embedded                                              */
/*									      */
/* Copyright (C) 2000 by John Ryland <jryland@trolltech.com>                  */
/*									      */
/* -------------------------------------------------------------------------- */

#ifndef TEHISTORY_H
#define TEHISTORY_H

#include "TECommon.h"

/*
   An extendable tmpfile(1) based buffer.
*/
class HistoryBuffer
{
public:
  HistoryBuffer();
 ~HistoryBuffer();

public:
  void setScroll(bool on);
  bool hasScroll();

public:
  void add(const unsigned char* bytes, int len);
  void get(unsigned char* bytes, int len, int loc);
  int  len();

private:
  int  ion;
  int  length;
};

class HistoryScroll
{
public:
  HistoryScroll();
 ~HistoryScroll();

public:
  void setScroll(bool on);
  bool hasScroll();

public: // access to history
  int  getLines();
  int  getLineLen(int lineno);
  void getCells(int lineno, int colno, int count, ca res[]);

public: // backward compatibility (obsolete)
  ca   getCell(int lineno, int colno) { ca res; getCells(lineno,colno,1,&res); return res; }

public: // adding lines.
  void addCells(ca a[], int count);
  void addLine();

private:
  int startOfLine(int lineno);
  HistoryBuffer index; // lines Row(int)
  HistoryBuffer cells; // text  Row(ca)
};

#endif // TEHISTORY_H