-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathYabText.h
95 lines (84 loc) · 3.13 KB
/
YabText.h
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
#ifndef YABTEXT_H
#define YABTEXT_H
#include <TextView.h>
#include <Font.h>
#include <String.h>
#include <vector>
#include <string>
#include <stdio.h>
#include <Window.h>
#include <Message.h>
#include <Messenger.h>
class YabText : public BTextView
{
public:
YabText(BRect frame, const char* name, BRect textRect, uint32 resizeMode, uint32 flags);
~YabText();
void AddCommand(const char* command, int colorGroup);
virtual void AttachedToWindow();
virtual void Select(int32 start,int32 finish);
void SetColors(int, int, int, int);
int32 CountPhysicalLines(); //?
virtual void KeyDown(const char* bytes, int32 numBytes);
int FindFirstOnLine(char c,int offset,int eol);
int32 OffsetAtIndex(int32 index);// const;
int32 LineAt(int32 offset);// const;
void FillSolEol(std::vector<int>& s,std::vector<int>& e,int start,int finish);
// void GoToLine(int32 index);
int32 CountLines();
void ParseAll(int start,int finish,bool IsInteractive);
void IParseLine(int sol,int eol); // TODO!
void ParseLine(int sol,int eol,std::vector<rgb_color>& colorVec); // TODO!
void ICheckWordLists(int sol,int eol,std::vector<rgb_color>& colorVec);
void SetText(const char* text,int32 length,const text_run_array* runs = NULL);
void UpdateColors();
void UpdateFontSize();
void SetText(BFile* file,int32 offset,int32 length,const text_run_array* runs = NULL);
bool Contains(std::vector<BString>& v,BString s);
// virtual bool CanEndLine(int32 offset);
// void LoadFile(entry_ref *ref);
virtual void MessageReceived(BMessage* msg);
bool HasChanged();
void SetChanged(bool changed);
bool IsCaseSensitive();
void SetCaseSensitive(bool caseSensitive);
void SetNormalFocus();
void SetAttachedFocus();
void AddWord(BString *word);
void SetAutoCompleteStart(int num);
void HasAutoCompletion(bool flag);
int SearchOffset;
private:
bool isCaseSensitive, hasChanged, isJapanese;
int myFontSize;
rgb_color bgcolor;
rgb_color textcolor, punc_symbol_color, comment_color, ignore_color, div1_color, div2_color,div3_color,div4_color,div5_color; //added div1_color -div5_color 11.11.2021 lorglas
rgb_color format_cmd_color, special_cmd_color, generic_cmd_color, div1_cmd_color, div2_cmd_color, div3_cmd_color, div4_cmd_color, div5_cmd_color; //added div1_color -div5_color 11.11.2021 lorglas
BFont f;
std::vector <BString> green_matches;
std::vector <BString> purple_matches;
std::vector <BString> generic_matches;
std::vector <BString> comment_matches;
std::vector <BString> div1_matches; //added div1_color -div5_color 11.11.2021 lorglas
std::vector <BString> div2_matches;
std::vector <BString> div3_matches;
std::vector <BString> div4_matches;
std::vector <BString> div5_matches;
std::vector <char> punctuation;
BList *words;
bool hasAutoCompletion, isAutoComplete;
int32 autoOffset, autoEnd;
int number_of_letters;
bool min(int32 a, int32 b)
{
return (a<=b?a:b);
};
bool max(int32 a, int32 b)
{
return (a>=b?a:b);
};
protected:
virtual void InsertText(const char* text,int32 length,int32 offset,const text_run_array* runner);
virtual void DeleteText(int32 start, int32 finish);
};
#endif