Thanks for the input... I guess I've got a lot of fixing up to do. So, all of the responses I have received, I guess mean that they need to be redone before being accepted? If they don't get a response like "Accepted", they're not accepted?
<br><br>Maybe my strategy of making a bunch of changes and sending them all at once wasn't too good of an idea. :)<br><br>I'll work on them and re-submit later.<br><br><div><span class="gmail_quote">On 6/8/06, <b class="gmail_sendername">
Vitaliy Margolen</b> <<a href="mailto:wine-devel@kievinfo.com">wine-devel@kievinfo.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Thursday, June 8, 2006, 6:40:33 PM, Anoni Moose wrote:<br>> This is my first patch to an open source project... if anyone has any comments/suggestions, please tell me. :)<br><br>> These patches add full search, search next, replace, and goto line functionality to notepad. Too bad I missed the
0.9.15 release!<br><br>> Changelog:<br><br>> * programs/notepad/main.c, programs/notepad/dialog.c,<br>> programs/notepad/main.h, programs/notepad/notepad_res.h,<br>> programs/notepad/dialog.h:<br>> notepad: Add/call functions to load/save globals settings (including font info) to registry.
<br>> -Added full Search/Search Next functionality.<br>> -Added full Replace functionality.<br>> -Added full Goto Line functionality.<br>> -Load/Save to registry whether we want to wrap long lines or not.<br><br>
<br>Please one patch per email. You should combine all of your changes into one patch<br>if that's one logical change and can be applied by itself. Of course resultant code<br>should compile and work.<br><br>> @@ -638,6 +641,8 @@
<br>> Globals.hFont=CreateFontIndirect( &lf );<br>> Globals.lfFont=lf;<br>> SendMessage( Globals.hEdit, WM_SETFONT, (WPARAM)Globals.hFont, (LPARAM)TRUE );<br>> + SETTINGS_SaveSettings();
<br>> +<br>Please respect indentation. Don't just copy&paste stuff all over the file.<br><br>> VOID DIALOG_Search(VOID)<br>> {<br>> +<br>> + if (Globals.find.hwndOwner == NULL) {<br>> ZeroMemory(&Globals.find, sizeof(
Globals.find));<br>> + }<br>> Globals.find.lStructSize = sizeof(Globals.find);<br>> Globals.find.hwndOwner = Globals.hMainWnd;<br>Pretty much the same here: don't just insert stuff, indent it properly.
<br>And please no extra blank lines nor needles curly brackets.<br><br>> + if (Globals.replace.hwndOwner == NULL) {<br>> + ZeroMemory(&Globals.replace, sizeof(Globals.replace));<br>> + }<br>Respect indentation and style of the file you changing. In this case 4-spaces
<br>not 2.<br><br>> + Globals.hFindReplaceDlg = ReplaceText(&Globals.replace);<br>> + assert(Globals.hFindReplaceDlg != 0);<br>> +}<br>Please don't use assert. Do a proper error checking instead.<br><br>
> + if (result == -1) { /* text not found. */<br>> + MessageBoxA(Globals.hEdit, "Cannot find text.", NULL, MB_OK | MB_ICONINFORMATION);<br>> + } else {<br>You should put all the text into resource files.
<br><br>> +WCHAR *GrabWindowTextW(HWND hWnd, DWORD *nbytes) {<br>> +<br>> + static WCHAR *data = NULL;<br>> + DWORD _nbytes = 0;<br>> +<br>> + if (nbytes == NULL) nbytes = &_nbytes;<br>> +
<br>> + *nbytes = (*nbytes == 0 ? GetWindowTextLengthW(hWnd) + 1 : *nbytes);<br>> + data = HeapAlloc(GetProcessHeap(), 0, (*nbytes) * sizeof(WCHAR));<br>> + GetWindowTextW(hWnd, data, (*nbytes)+1);<br>
> + return data;<br>> +}<br>Why do you need static if you return allocated buffer?<br>nbytes is misleading - it should be nchars.<br>(*nbytes)+1 is incorrect. You allocated enough memory for *nbytes only.<br><br>
> +int SearchText(HWND hWnd, LPFINDREPLACE find, int pos);<br>Please use windows types so they would work right on 64-bit platforms.<br><br>> + "^R", CMD_REPLACE<br>Native notepad has it as ctrl+H.<br><br>
Vitaliy Margolen<br><br><br><br></blockquote></div><br><br clear="all"><br>-- <br>- Anoni Moose