NO

Author Topic: Addin Icons  (Read 11848 times)

JohnF

  • Guest
Addin Icons
« on: October 22, 2004, 10:05:03 AM »
Two addins I've recompiled no longer display their icons.

John

CLR

  • Guest
Addin Icons
« Reply #1 on: October 22, 2004, 11:29:13 AM »
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

Offline Pelle

  • Administrator
  • Member
  • *****
  • Posts: 2266
    • http://www.smorgasbordet.com
Addin Icons
« Reply #2 on: October 22, 2004, 12:49:51 PM »
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
/Pelle

JohnF

  • Guest
Addin Icons
« Reply #3 on: October 22, 2004, 12:51:34 PM »
Quote from: "CLR"
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

JohnF

  • Guest
Addin Icons
« Reply #4 on: October 22, 2004, 01:11:19 PM »
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

Code: [Select]

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

CLR

  • Guest
Addin Icons
« Reply #5 on: October 22, 2004, 02:08:41 PM »
Quote from: "Pelle"
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.

Offline Pelle

  • Administrator
  • Member
  • *****
  • Posts: 2266
    • http://www.smorgasbordet.com
Addin Icons
« Reply #6 on: October 22, 2004, 02:08:55 PM »
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
/Pelle

CLR

  • Guest
Addin Icons
« Reply #7 on: October 22, 2004, 02:18:19 PM »
Quote from: "JohnF"

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 :(

CLR

  • Guest
Addin Icons
« Reply #8 on: October 22, 2004, 02:55:50 PM »
Quote from: "JohnF"
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

Code: [Select]

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:
Code: [Select]

int Test(int d, int c,
   char *dd){
   // code...
}


The OnFindFunc function will receive it in one single line:

Code: [Select]
int Test(int d, int c, char *dd)

In this case, AddIn_FindSourceText function will fail.

JohnF

  • Guest
Addin Icons
« Reply #9 on: October 22, 2004, 03:53:52 PM »
Quote from: "CLR"
Quote from: "JohnF"

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

JohnF

  • Guest
Addin Icons
« Reply #10 on: October 22, 2004, 03:58:16 PM »
Quote from: "CLR"
Quote from: "JohnF"
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

Code: [Select]

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:
Code: [Select]

int Test(int d, int c,
   char *dd){
   // code...
}


The OnFindFunc function will receive it in one single line:

Code: [Select]
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