CVS housekeeping.
[reactos.git] / rosapps / devutils / vmingw / editor.h
1 /********************************************************************
2 * Module: editor.h. This is part of Visual-MinGW.
3 *
4 * License: Visual-MinGW is covered by GNU General Public License,
5 * Copyright (C) 2001 Manu B.
6 * See license.htm for more details.
7 *
8 *******************************************************************/
9 #ifndef EDITOR_H
10 #define EDITOR_H
11
12 #include "Scintilla.h"
13 #include "SciLexer.h"
14 #include "winui.h"
15
16 #define U_FILE 3
17 #define H_FILE (U_FILE+1)
18 #define C_FILE (U_FILE+2)
19 #define RC_FILE (U_FILE+3)
20
21 // Default block size.
22 const int blockSize = 131072;
23
24 // Default colors.
25 const COLORREF black = RGB(0,0,0);
26 const COLORREF white = RGB(0xff,0xff,0xff);
27 const COLORREF darkBlue = RGB(0, 0, 0x7f);
28 const COLORREF Green = RGB(0, 0x7f, 0);
29 const COLORREF darkGreen = RGB(0x3f, 0x70, 0x3f);
30 const COLORREF Purple = RGB(0x7f, 0x00, 0x7f);
31 const COLORREF Ice = RGB(0x00, 0x7f, 0x7f);
32 const COLORREF Olive = RGB(0x7f, 0x7f, 0x00);
33
34 // Default Cpp keywords.
35 const char cppKeyWords[] =
36 "asm auto bool break case catch char class const const_cast continue "
37 "default delete do double dynamic_cast else enum explicit export extern false float for "
38 "friend goto if inline int long mutable namespace new operator private protected public "
39 "register reinterpret_cast return short signed sizeof static static_cast struct switch "
40 "template this throw true try typedef typeid typename union unsigned using "
41 "virtual void volatile wchar_t while";
42
43 void EnsureRangeVisible(HWND hwndCtrl, int posStart, int posEnd, bool enforcePolicy);
44 int LengthDocument(HWND hwndCtrl);
45 CharacterRange GetSelection(HWND hwndCtrl);
46
47 class CFileItem : public CNode
48 {
49 public:
50 CFileItem();
51 ~CFileItem();
52
53 // File name.
54 char szFileName[MAX_PATH];
55 WORD nFileOffset;
56 WORD nFileExtension;
57
58 // Owner tree view.
59 CTreeView * pTreeView;
60 HTREEITEM _hItem;
61 HTREEITEM _hDirItem;
62
63 // Owner child window.
64 CMDIChild * pMdiChild;
65 int show;
66 bool isInProject;
67
68 protected:
69
70 private:
71 };
72
73 void GetFileType(CFileItem * file);
74
75 class CEditor : public CScintilla
76 {
77 public:
78 CEditor();
79 ~CEditor();
80
81 void LoadFile(CFileItem * file);
82 void SaveFile(char * fullPath);
83 int GetCurrentPos(void);
84 void GotoLine(int line, char * fileName = NULL);
85 int caretPos;
86 void SetLexer(int fileType);
87 void SetCppLexer(void);
88 bool MarginClick(int position, int modifiers);
89
90 protected:
91
92 private:
93 void DefineMarker(int marker, int markerType, COLORREF fore, COLORREF back);
94 void GetRange(int start, int end, char *text);
95 void SetAStyle(int style, COLORREF fore, COLORREF back, int size, const char *face);
96 void Expand(int &line, bool doExpand, bool force = false,
97 int visLevels = 0, int level = -1);
98 };
99
100 #define FR_MAX_LEN 200
101
102 class CFindReplaceDlg : public CDlgBase
103 {
104 public:
105 CFindReplaceDlg();
106 virtual ~CFindReplaceDlg();
107
108 HWND Find(CScintilla * pEditor);
109 HWND Replace(CScintilla * pEditor);
110
111 protected:
112 void FindNext(bool reverseDirection, bool showWarnings);
113 virtual LRESULT CALLBACK CDlgProc(UINT Message, WPARAM wParam, LPARAM lParam);
114 BOOL OnInitDialog(HWND hwndFocus, LPARAM lInitParam);
115 BOOL Find_OnInitDialog(void);
116 BOOL Replace_OnInitDialog(void);
117 BOOL OnCommand(WORD wNotifyCode, WORD wID, HWND hwndCtl);
118 BOOL Find_OnCommand(WORD wIDl);
119 BOOL Replace_OnCommand(WORD wID);
120 BOOL HandleReplaceCommand(int cmd);
121 void ReplaceOnce(void);
122 void ReplaceAll(bool inSelection);
123
124 private:
125 HWND hFindWhat;
126 HWND hReplaceWith;
127 HWND hWholeWord;
128 HWND hMatchCase;
129 HWND hRegExp;
130 HWND hWrap;
131 HWND hUnSlash;
132 HWND hUp;
133 HWND hDown;
134 char findWhat[FR_MAX_LEN + 1];
135 char replaceWhat[FR_MAX_LEN + 1];
136
137 bool bWholeWord;
138 bool bMatchCase;
139 bool bRegExp;
140 bool bWrapFind;
141 bool bUnSlash;
142 bool bReverseFind;
143 bool bHavefound;
144
145 CEditor * pEditor;
146 HWND hEditor;
147 int resId;
148 };
149
150 class CChooseFontDlg : public CWindow
151 {
152 public:
153 CChooseFontDlg();
154 ~CChooseFontDlg();
155
156 bool Create(CWindow * pWindow);
157
158 protected:
159 CHOOSEFONT cf;
160 LOGFONT lf;
161
162 private:
163 };
164
165 #endif