Open-source Chrome-based interface development framework

Source: Internet
Author: User
Tags win32 window skia
Original Intention

We always hope that VC developers can easily develop exquisite and high-quality user interfaces. I like C ++. I chose Windows as the platform, so I spent most of my time using VC. I do not exclude other technologies, development languages, or development tools. I want to learn more about it to supplement the deficiencies in VC development. I have been engaged in interface development for five years. I have learned a lot, tried a lot, and failed a lot, but I am not discouraged. Thanks to the open source, especially Google's Chrome open source, which has improved me again. On forums and code websites, you can see some work on the interface, including source code and pure appreciation. Most of them look pretty good, and local execution will find a rough place, not delicate, difficult to commercial use. In general, it is difficult to see a good open-source framework on the interface in China. Outstanding companies are proud of this and constantly guide the interface trend, so that some other companies are tired of imitating it.

Interface development, like all other development, is technical and should be clear to those who actually study it. Some people asked me at the early stage: Isn't xp skin-changing good? Vista is out. Do you still need to skin it? Win7 is very beautiful, and no additional interface development is required? I think the interface has always represented an enterprise's logo culture, such as qq's blue and Penguin, Thunder's dynamic effect window and hummingbird. If you are interested in research, you are right and can do it better.

The characteristics of the Internet client are Xiao qiaoling. The interface itself is brilliant, and the interface engine behind it is very important. Google's open-source attitude is a challenge to Microsoft. I beat you on the internet and cannot beat you on the traditional desktop, open-source your outstanding desktop code to unite with everyone to keep isolating you.

Chrome open-source involves more than 30 other open-source projects and hundreds of projects. Generally, it takes some time for developers to take advantage of some of these features and experience in Porting large projects. What I did here is to extract the view part and make a basic development framework, cut off the excessive involvement, and try to use the Windows platform sdk as much as possible, it is intended to be useful to companies that are eager to learn about developers or have the ability to expand.

Background

The Research on the interface has gone through three stages: Traditional Win32 window, Win32 window subclass self-painting, and windowless interface development (directui ). These three stages have an intersection, which is generally improved over time.

Phase I: I was in my postgraduate internship in. I did gis platform development in my tutor company. I had little requirement on the interface, but there were also some customized development, in that period, it was basically codeproject. I learned regular Window Programming Skills and what effects the APIS could have when they could do, over time, you will know that the most direct way to make an effect is to combine those APIs. At that time, the work of Self-painting was not much, but it was annoying to call controls repeatedly for a long time. At that time, after reading the arcgis platform, we began to use web pages to create some interfaces, there is no way to get research. Later, I learned about a interface development library named BCG, and started the self-painting phase from it.

The second stage: the research on the interface library of BCG started in. Speaking of this, I think the leaked code will be of great help to improve the level of software development in China. At that time, the BCG interface library simulated the office2003 interface style. The simulation was very similar, but its code itself was not very clear, and the module division was not clear at a glance. At that time, he destroyed the open-source CJLib, but was subsequently turned over by Codejoke, a commercial company of CJLib, until it finally formed a mfcx in a rush to form a weak combination with mfc of VC8, currently, few companies are using it. Codejoke's xtp can also be learned in the form of leakage. Its interface components are reasonably divided and the code is clear, especially the skinframework framework in it, compile a dll separately to skin the regular window. The skin format can be compatible with xp. He also gave up the Sub-class self-painting of the regular window, instead of studying his implementation, because he has already done his best. Later, my graduation project in was based on him. The subject was about software construction and various forms of interface plug-ins were used to construct the software framework. At this time, qq has been developing towards a window-free system. At this time, I got the directui concept and started the research on the window-free interface.

Stage 3: 07-now. At the beginning, I studied http://www.viksoe.dk/code/windowless1.htm, and many people have learned about it. He abstracted some window-less interface elements, translated regular window message interpretations, and sent them to window-less elements. He introduced some ddraw effects, so he was very excited to access such code, the interface looks amazing at the beginning, especially the animation effect on the main interface. It also has obvious disadvantages: unicode is not supported, and the calculation of pretytext is faulty. The hybrid layout of local windows and non-window windows will be covered. Based on him, I made my first interface framework and applied it to commercial products of the company. You can enjoy it here: http://www.cppblog.com/wlwlxj/archive/2007/08/28/31014.html. He is not very powerful in the encapsulation of Windows and the abstraction of windowless elements, so it is difficult to use it to build a very powerful interface framework. Later, let's look at the qq and thunder interfaces, I feel that the previous interface elements are not universal and lack dynamic capabilities. Some ideas are mentioned in this post: http://hi.baidu.com/wlwel/blog/item/ad08bfc8?ff78dc9176808.html. I later thought that what I might need was the dynamic interface of the web page, the processing of graphics and images, and the drag and drop of the Dynamic Layout of the interface. I remembered that Win2000 leaked code in my hand, so I started a crazy thing: porting part of the ie code, as long as the interface engine, css and filter, and supporting various interactive events, this was my idea at the time. It took 8 months to get the results: http://www.cppblog.com/wlwlxj/archive/2009/06/28/88695.html. This time, it failed and cannot be commercialized. There are many problems. The focus of the button is 1 pixel deviation. css is very limited and nonstandard due to the low ie version, filters cannot be used because a component cannot be created and no code is available. The Code has been compiled for more than 30 mb. The structure of the Code itself is not clear, and there are many and messy places to be cut down. In the end, I cannot continue to modify the code. Many times in the middle of the process, I gave up and went on without service. The biggest help of this research is how to find what you want and how to slash code in a huge software code. It is like watching the garden, with a comprehensive technology and too many things learned. Later, I realized that the web page has the characteristics of web page layout. desktop software has the characteristics of desktop software and requires local interoperability. Next, I studied the comctl32 part for a few months, and finally found that the research on the edit button needs to go to the ntuser part, and even want to go to the display card driver to call it. Of course, there are also some achievements: Prepare. For some time, I even deliberately avoided interface development until I came into contact with the Chrome browser and saw his open source.

Work on Chrome Open Source

Chrome is open-source and mainly extracts part of the view code, depending on its base, gfx, skia, and app. I divide the base into base, message_framework, rfc_algorithm, skia is replaced by gdiplus and merged to gfx. The app is divided into animation and view_framework. the linux and mac support sections are removed, and unnecessary functions such as webpage drag-and-drop operations are removed, it forms a minimal development framework and modifies a bug in the title bar self-painting. At first, I wanted to replace the Base with boost. Later I found that the workload was heavy and I still didn't dare to do it. As follows:

Download all sorted code.

Follow-up work

Add more controls, functions, and modify comments in existing code. Accept all criticism and suggestions, but not personal attacks. I hope to see more works from other people. The open-source world is too rich now. Many things are not accessible, but are unwilling to calm down and study.

Note: The project is 2005. The additional header file <vsstyle. h> <vssym32.h> can be copied from the SDK of vc2008 or downloaded from any other place. 2008 directly convert to compile.




Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.