Pelles C forum
Pelles C => Bug reports => Topic started by: JohnF on October 22, 2004, 10:05:03 AM
-
Two addins I've recompiled no longer display their icons.
John
-
Hi John.
The Add-in structure ADDIN_ADD_COMMAND has been changed in v2.90; I guess this is why poide doesn't display the icon. :?:
Attached is the 'function prototypes' addin for v.2.90.
EDIT:
removed the attachment
you may get the latest version in http://www.johnfindlay.plus.com/pellesc/addin/addin.htm
-
Most likely, yes. The samples don't do it properly, but it's probably best to always clear all add-in structures first ("ZeroMemory"). This will initialize everything to zero, which I *try* to use for defaults.
Pelle
-
Hi John.
The Add-in structure ADDIN_ADD_COMMAND has been changed in v2.90; I guess this is why poide doesn't display the icon. :?:
Attached is the 'function prototypes' addin for v.2.90.
The attachment doesn't contain the new info, only your project.
I've downloaded the new addin setup, thanks.
John
-
The icons are ok now.
Perhaps someone can help with this.
I've altered the liastaf code to display a listbox which is filled with text for each function line. Then by using AddIn_FindSourceText() API to find the function line but it's not working. Here is the code
case WM_COMMAND:
if(HIWORD(wParam) == LBN_DBLCLK )
{
int ret = SendMessage(GetDlgItem(hwndDlg, EDIT_CONTROL),
(UINT)LB_GETCURSEL,
(WPARAM) 0,
(LPARAM) 0);
char stext[290];
SendMessage(GetDlgItem(hwndDlg, EDIT_CONTROL),
(UINT)LB_GETTEXT,
(WPARAM) ret,
(LPARAM) stext);
AddIn_FindSourceText(AddIn_GetActiveDocument(g_hwndMain),
FR_DOWN, stext);
PostMessage(hwndDlg, WM_CLOSE, 0, 0);
}
The correct string is in stext but AddIn_FindSourceText appears not to do anything. Is there another way to goto a particular line?
John
-
Most likely, yes. The samples don't do it properly, but it's probably best to always clear all add-in structures first ("ZeroMemory"). This will initialize everything to zero, which I *try* to use for defaults.
Pelle
Hello.
Thanks for the info. I will 'ZeroMemory' from now on.
-
AddIn_FindSourceText() just returns the character index from the start of the buffer (or -1). It doesn't actually move the caret. Use AddIn_SetSourceSel() to move the caret (use same index for both start and end if you don't want a selection) - and probably AddIn_ScrollSourceCaret() to make sure the caret is on the visible page.
Pelle
-
The attachment doesn't contain the new info, only your project.
I've downloaded the new addin setup, thanks.
John
Hello.
I'm sorry, I didn't understand. What do you mean 'The attachment doesn't contain the new info, only your project.' ?. I don't speak English :(
-
The icons are ok now.
Perhaps someone can help with this.
I've altered the liastaf code to display a listbox which is filled with text for each function line. Then by using AddIn_FindSourceText() API to find the function line but it's not working. Here is the code
case WM_COMMAND:
if(HIWORD(wParam) == LBN_DBLCLK )
{
int ret = SendMessage(GetDlgItem(hwndDlg, EDIT_CONTROL),
(UINT)LB_GETCURSEL,
(WPARAM) 0,
(LPARAM) 0);
char stext[290];
SendMessage(GetDlgItem(hwndDlg, EDIT_CONTROL),
(UINT)LB_GETTEXT,
(WPARAM) ret,
(LPARAM) stext);
AddIn_FindSourceText(AddIn_GetActiveDocument(g_hwndMain),
FR_DOWN, stext);
PostMessage(hwndDlg, WM_CLOSE, 0, 0);
}
The correct string is in stext but AddIn_FindSourceText appears not to do anything. Is there another way to goto a particular line?
John
Hello.
You may be aware that both values received in OnFindFunc(int, char*) may not be accurate. For example, if you declare a function in multiples lines:
int Test(int d, int c,
char *dd){
// code...
}
The OnFindFunc function will receive it in one single line:
int Test(int d, int c, char *dd)
In this case, AddIn_FindSourceText function will fail.
-
The attachment doesn't contain the new info, only your project.
I've downloaded the new addin setup, thanks.
John
Hello.
I'm sorry, I didn't understand. What do you mean 'The attachment doesn't contain the new info, only your project.' ?. I don't speak English :(
You said
'Attached is the 'function prototypes' addin for v.2.90. '
Which suggested that you were posting updated info to allow the icons.
John
-
The icons are ok now.
Perhaps someone can help with this.
I've altered the liastaf code to display a listbox which is filled with text for each function line. Then by using AddIn_FindSourceText() API to find the function line but it's not working. Here is the code
case WM_COMMAND:
if(HIWORD(wParam) == LBN_DBLCLK )
{
int ret = SendMessage(GetDlgItem(hwndDlg, EDIT_CONTROL),
(UINT)LB_GETCURSEL,
(WPARAM) 0,
(LPARAM) 0);
char stext[290];
SendMessage(GetDlgItem(hwndDlg, EDIT_CONTROL),
(UINT)LB_GETTEXT,
(WPARAM) ret,
(LPARAM) stext);
AddIn_FindSourceText(AddIn_GetActiveDocument(g_hwndMain),
FR_DOWN, stext);
PostMessage(hwndDlg, WM_CLOSE, 0, 0);
}
The correct string is in stext but AddIn_FindSourceText appears not to do anything. Is there another way to goto a particular line?
John
Hello.
You may be aware that both values received in OnFindFunc(int, char*) may not be accurate. For example, if you declare a function in multiples lines:
int Test(int d, int c,
char *dd){
// code...
}
The OnFindFunc function will receive it in one single line:
int Test(int d, int c, char *dd)
In this case, AddIn_FindSourceText function will fail.
AddIn_FindSourceText will fail anyway as Pelle explained.
I'm using your iContador var - strlen(buffer) - 2 to store the beginning of a function line. Then using
AddIn_SetSourceSel(hwndDoc, &range);
AddIn_ScrollSourceCaret(hwndDoc);
To move the caret to the right position.
John