1 /********************************************************************
2 * Module: editor.h. This is part of Visual-MinGW.
4 * License: Visual-MinGW is covered by GNU General Public License,
5 * Copyright (C) 2001 Manu B.
6 * See license.htm for more details.
8 *******************************************************************/
12 #include "Scintilla.h"
17 #define H_FILE (U_FILE+1)
18 #define C_FILE (U_FILE+2)
19 #define RC_FILE (U_FILE+3)
21 // Default block size.
22 const int blockSize
= 131072;
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);
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";
43 void EnsureRangeVisible(HWND hwndCtrl
, int posStart
, int posEnd
, bool enforcePolicy
);
44 int LengthDocument(HWND hwndCtrl
);
45 CharacterRange
GetSelection(HWND hwndCtrl
);
47 class CFileItem
: public CNode
54 char szFileName
[MAX_PATH
];
59 CTreeView
* pTreeView
;
63 // Owner child window.
64 CMDIChild
* pMdiChild
;
73 void GetFileType(CFileItem
* file
);
75 class CEditor
: public CScintilla
81 void LoadFile(CFileItem
* file
);
82 void SaveFile(char * fullPath
);
83 int GetCurrentPos(void);
84 void GotoLine(int line
, char * fileName
= NULL
);
86 void SetLexer(int fileType
);
87 void SetCppLexer(void);
88 bool MarginClick(int position
, int modifiers
);
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);
100 #define FR_MAX_LEN 200
102 class CFindReplaceDlg
: public CDlgBase
106 virtual ~CFindReplaceDlg();
108 HWND
Find(CScintilla
* pEditor
);
109 HWND
Replace(CScintilla
* pEditor
);
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
);
134 char findWhat
[FR_MAX_LEN
+ 1];
135 char replaceWhat
[FR_MAX_LEN
+ 1];
150 class CChooseFontDlg
: public CWindow
156 bool Create(CWindow
* pWindow
);