SCINTILL TANT Guide (1)

xiaoxiao2021-03-06  21

Scintilla is a free source code editing control, which fully open source, and provides a license allows users to freely use it in open source software or commercial software.

I am discovered by the editorial control when I have a graduation topic. It is found to be powerful and stable after use. As the source code editing control, we can see the features you can see in the normal text editing control, SCINTILLA is fully Implementation, and it is also available to provide special features useful when editing and debugging source code. Including grammar highlights, error instructions, code automatic completion, and code prompts, etc. Moreover, on the blank of the left, it can display a very useful display breakpoint in the debug code and display the current operation line. Moreover, custom styles are open than most of the other editor controls, which allows users to customize different types of fonts, whether bold, bits, foreground, and background colors, support a large number of fonts. For example, after setting the C / C editing mode, you can define the color, font, size, etc. of the comment statement type, the same, you can customize the color, font, size of the keyword type, such as this, which gives the user The freedom of big configuration.

According to the news released on the SCINTILLA website, Scitilla will be more flexible, robust, better in the .NET and Java virtual machine in the future development, and see that the Scitilla project is a very energetic. Project, its development team is very passionate, which also benefits us - these users benefit.

According to the author, the motivation to develop SCINTILLA is from his disappointment to Richedit. In Richedit, the change in style is seen as a change in the document, which will be recorded in the stack of the undo, and the modification of the document objects set mark. This pair source code editing is very unsuitable, changing the color of the keyword type or the color of the operator, which should not be considered as a modification of the document, nor should it be able to return / advance through undo / redo. I have a deep feeling, if it is Richedit to do the control of the source code editor, there will be too many things that need to write the code, choose SCINTILLA, will be a wise choice, saving time, effort, safe, reliable .

SCINTILL currently provides Win32 and Linux versions. Used in Linux is GTK , which has been tested in GTK 1.2 and 2.0 in Windows95, NT4.0, Windows2000, Windows XP, and Redhat Linux8 and 9. This is a cross-platform control, and it is also one of my very appreciation. Below my main discussion or how to use this control under Windows VC, but other platform / compilation tools are also small and small, touch the category.

Introduction:

The Windows version of SCINTILLA is a form control. Its primary programming interface is transmitted by form messages. What function you want to implement, you can send a message to the control, when you need to get information from the control, accept the WM_NOTIFY message, you can get a large number of current control information from the parameters it take, such as whether you have modified the text, Whether you are clicking on the border on the left, etc. However, in fact, in the MFC programming, control controls through the message is still very troublesome, because most of these messages are custom messages, not convenient to memory. So the general approach is to encapsulate these messages into a form class so that it is convenient to call. In addition to achieving the functionality that the general editing control can be implemented, SCINTILA can also perform syntax highlighting, code folding, bookmark, automatic completion, statement prompt, etc. You can fully use the standard editing control CEDIT or RicheDit, SCINTILL provides a coordinated API port, which is its advantages. In fact, the SCINTILLA development group also developed a editing software Scite with this control, which enables all the features of Scintilla, if you are very interested in Scintilla, but I don't know if it can do those functions. When a scite, use it fully understand. At the same time, Scite is also open source software, learning its code, is learning SCINTILLA how to use. In the SCINTILLA document, this document is explained, which only independently explains the use of each message, and does not explain how to connect them into a practical editor, want to know how to implement certain features And look at how Scite is implemented. I have also seen the code of Scite, readability is still good, but unfortunately, I have no patience, I also read a few functions, I know it, if you want this control, read the SCITE source code or Nice.

SCINTILLA message is sent with the SendMessage function, which provides two header files: SCINTILLA.H and ScileXer.h, the macro definition of the message number is here, and there are many definitions of structures, types, and the like to be used. Two parameters of the message belt WPARAM and LPARAM are often used, perhaps one, two, or no parameters. However, it is recommended that you prefer to give 0 values ​​when you use, because if you expand your message function later, you will use a parameter to assign a value to prevent the crash.

The type of usual parameter is as follows: BOOL INT const char * char * color

Other types do not need to be said, as for the Color type, is used to describe colors, it is actually an integer, the calculation method is: RED | (Green << 8) | (Blue << 16), Red, Green, Blue It is an 8-bit 2-based number, that is, 2 bits 16. It is easy to achieve 256 colors of allocation. As for

That is to say, this parameter is not used in this message, it can be assigned to zero.

The following explanations are in the environment of VC MFC, because I have been developing things in this environment, if I use SDK programming, just use more APIs, as for compiler, VC, GCC Also, I don't think there is no big problem. I used GDB to debug Scite source code. I learned how Scintilla is used, and I didn't try the GTK programming under the Linux platform. From the document, it is also used to control the control. , Use the message to obtain the information of the control. Below I will encapsulate SCINTILA to become a form class, how to use its function in the program, the level is limited, and now it is still in school, it may be slow, huh, huh, understand.

转载请注明原文地址:https://www.9cbs.com/read-68198.html

New Post(0)