Hello folks,
I am Jactry Zeng, a junior who majoring in Electronic Science from China. And also a very fresh developer of Wine. My nickname in #winehackers is jactry. :)
I would like to apply for this year's GSoC to work for Wine. I have entered Wine's GSoC last year. What I have work for is ITextDocument, I implemented some functions of it. I got some experience of Wine development and fixed some other bugs[0] of richedit during that time.
I continued the work of ITextDocument after GSoC, I know there is still a lot of work worth to do. Such as ITextDocument::Range[1], which is used to get an ITextRange object of the content. And functions of ITextRange[2] are used to operate this range of text. Now in Wine, ITextRange was implemented mix with ITextSelection[3][4]. And ITextDocument::GetSelection[5] which is used to get an ITextSelection object is similar to ITextRange. In an easy way, we can implement ITextDocument::Range using some cast (I have a dirty hack in attachment). But I don't think it is a permanent solution.
There are four parts in my plan:
--- Part 0: Do some COM cleanup. ---
Because ITextRange is implemented mix with ITextSelection now, so we should do some COM cleanup to create an ITextRange interface independently. And create a ITextSelection interface inherits from ITextRange. This is just the preparatory work for implementing ITextRange and I will begin this part before GSoC. ( So it is signed as part zore :b )
--- Part 1: Implement ITextDocument::Range. ---
I will write more tests for ITextDocument::Range and ITextDocument::GetSelection first. Than try to implement ITextDocumen::Range. When this part is finished, bug 12458[6] and bug 18303[7] will benefit from it.
--- Part 2: Implement functions of ITextRange ---
In this part, I will try my best to implement some functions of ITextRange. I will write some tests for them first and than implement them. I think this is the hard part. And these functions will be implemented preferentially: GetText, GetDuplicate, GetStar, GetEnd, Copy, SetText. Because GetDuplicate and GetEnd were needed by bug 18303, and these functions seem was depend on the others. After these functions were implemented, I think bug 18303 will be fixed! ( Oh, this one of my pursues! ;) )
--- Part 3: Imporve all the code for being merged by upstream. ---
This is the last part, I will improve all the patches for being merged by upstream, including what I did last year. After this part is finished, Wine will really has an initial implementation of ITextDocument and ITextRange. Maybe it will spend a lot of time, and I will continue this work after GSoC if I can't finish all of this part during GSoC.
I think after all these are finished not only bug 18303 and bug 12458 will benefit from it, but also many other softwares. Because TOM interfaces are so important and be used frequently in real world applications.
I appreciate for any comment. Thank you. :)
attachments: dirty hack of ITextDocument::Range: dirty_hack.txt patch 0001: tests for ITextDocument_Range
[0] http://source.winehq.org/git/wine.git/?a=search&h=HEAD&st=author&...http://source.winehq.org/git/wine.git/?a=search&h=HEAD&st=author&s=jactry [1] http://msdn.microsoft.com/en-us/library/windows/desktop/bb774097(v=vs.85).as... [2] http://msdn.microsoft.com/en-us/library/windows/desktop/bb774058(v=vs.85).as... [3] http://msdn.microsoft.com/en-us/library/windows/desktop/bb774060(v=vs.85).as... [4] http://source.winehq.org/git/wine.git/blob/HEAD:/dlls/riched20/richole.c#l77... [5] http://msdn.microsoft.com/en-us/library/windows/desktop/bb774013(v=vs.85).as... [6] http://bugs.winehq.org/show_bug.cgi?id=12458 [7] http://bugs.winehq.org/show_bug.cgi?id=18303
Hello folks,
I began to work on ITextRange and ITextSelction in the past two weeks. I have implemented the ITextRange interface and some functions of it. And fixed some other bugs in dlls/riched20/richole.c.
1. Stub implementation of ITextRange interface https://github.com/Jactry/wine/commit/0c79f0e0f6aba886b366e424608a74135cb883... This is just an initial implementation. In order to implement all the functions of ITextRange, more members will be added to ITextRangeImpl struct. For example, according this test[0] we knew when some text in an ITextRange instance was deleted, range of ITextRange in the same RichEdit should adjust for this change. (MSDN[1] also has some description about this.) So we should add something to let all ITextRange instance know each other and adjust others range after deleting or appending some text.
2. Initial implementation of ITextRange::GetText https://github.com/Jactry/wine/commit/90dcce8bea58c789dcc82bde1ebd321205dade... This is also an initial implementation, because I found range of all the ITextRange instances in an RichEdit would be reseted to (0, 0) and ITextRange::GetText would return a NULL BSTR[2] when the content in this RichEdit was changed by WM_SETTEXT. I think we may need to add a member to ME_TextEditor to let it know about all ITextRange of it, so it can reset the range of all ITextRange in it when the content was changed by WM_SETTEXT or any other functions.
Linked list may will be a good choice for the first problem. Or anyone have a better way? Any feedback will be appreciate! Thank you! :)
[0] https://github.com/Jactry/wine/commit/95e43da329dde420138bbf3b2e5c608c2a2ba6... [1] http://msdn.microsoft.com/en-us/library/windows/desktop/bb774058(v=vs.85).as... [2] https://github.com/Jactry/wine/commit/90dcce8bea58c789dcc82bde1ebd321205dade...