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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
/***************************************************************************
* Copyright (C) 2005 Nicolas Hadacek <hadacek@kde.org> *
* Copyright (C) 2003-2004 Alain Gibaud <alain.gibaud@free.fr> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
***************************************************************************/
#ifndef TEXT_EDITOR_H
#define TEXT_EDITOR_H
#include <tqsplitter.h>
#include <tqstringlist.h>
class TQSplitter;
#include <kate/view.h>
#include <kate/document.h>
#include "common/gui/pfile_ext.h"
#include "editor.h"
#include "progs/manager/breakpoint.h"
//-----------------------------------------------------------------------------
class TextEditor : public Editor
{
Q_OBJECT
TQ_OBJECT
public:
TextEditor(bool withDebugger, TQWidget *parent, const char *name = 0);
virtual PURL::FileType fileType() const { return url().fileType(); }
virtual PURL::Url url() const { return _document->url(); }
virtual bool isModified() const;
virtual bool isReadOnly() const;
virtual void addGui();
virtual void removeGui();
virtual void setFocus() { _view->setFocus(); }
static TQPixmap pixmap(Breakpoint::MarkType type);
void setMark(uint line, Breakpoint::MarkType type);
void clearBreakpointMarks();
void setCursor(uint line, uint column) { _view->setCursorPosition(line, column); }
uint cursorLine() const;
virtual bool open(const PURL::Url &url);
virtual bool save(const PURL::Url &url) { return _document->saveAs(url.kurl()); }
virtual bool eventFilter(TQObject *o, TQEvent *e);
virtual TQValueList<uint> bookmarkLines() const;
virtual void setBookmarkLines(const TQValueList<uint> &lines);
public slots:
void addView();
void removeCurrentView();
void gotFocus(Kate::View *);
void highlightChanged();
virtual void statusChanged();
void selectAll() { _document->selectAll(); }
void deselect() { _document->clearSelection(); }
void copy() { _view->copy(); }
protected:
enum EolType { Dos = 1, Unix = 0, Mac = 2 };
Kate::Document *_document;
Kate::View *_view;
private slots:
void addToDebugManager();
private:
TQSplitter *_split;
bool _oldModified, _oldReadOnly;
struct MarkTypeData {
uint type;
const char *pixmap;
};
static const MarkTypeData MARK_TYPE_DATA[Breakpoint::Nb_MarkTypes];
private:
virtual void setModifiedInternal(bool modified);
virtual void setReadOnlyInternal(bool readOnly);
uint highlightMode(const TQString &name) const;
void clearMarks(uint type);
};
//-----------------------------------------------------------------------------
class SimpleTextEditor : public TextEditor
{
Q_OBJECT
TQ_OBJECT
public:
SimpleTextEditor(bool withDebugger, PURL::FileType type, TQWidget *parent, const char *name = 0);
SimpleTextEditor(bool withDebugger, TQWidget *parent, const char *name = 0);
void setFileType(PURL::FileType type) { _type = type; }
virtual PURL::FileType fileType() const { return _type; }
bool setText(const TQString &text);
virtual bool open(const PURL::Url &url);
protected:
virtual bool load() { return false; }
private:
Log::StringView _sview;
PURL::FileType _type;
PURL::TempFile _file;
};
#endif
|