notepad-plus-plus / npp-usermanual

Notepad++ User Manual
https://npp-user-manual.org/
Other
218 stars 98 forks source link

document plugin command NPPM_GETTABCOLORID #671

Closed alankilborn closed 5 months ago

alankilborn commented 5 months ago

With (presumably) N++ release 8.6.8, there is a new plugin command. Provide documentation for it; suggested:

[2138] NPPM_GETTABCOLORID
Gets the tab color id for the given view and tab index.

Parameters:

wParam [in]
int, 0 for primary view, 1 for secondary view, -1 for currently-active view
lParam [in]
int, zero-based tab index, i.e., use 0 for first tab, 1 for second tab, etc.; use -1 for active tab

Return value:

int, the tab color id value:
    -1 (no color)
    0 (yellow)
    1 (green)
    2 (blue)
    3 (orange)
    4 (pink)

References:

donho commented 5 months ago

I suggest to add the following note to help plugin devs to better use this API: Note: there's no symmetric command NPPM_SETTABCOLORID. Plugins can use NPPM_MENUCOMMAND to set current tab color with the desired tab color ID.

alankilborn commented 5 months ago

I suggest to add the following note to help plugin devs to better use this API

Good one!

But I'd do it this way:

Note: there's no symmetric plugin command for setting the tab color. Plugins can use NPPM_MENUCOMMAND to set current tab color with the desired tab color ID.

and then including a table of the menu command ids for the 5 different colors.

Note that the reason to NOT use the text NPPM_SETTABCOLORID directly is that it ISN'T a real command, but it sort of looks like it is!

donho commented 5 months ago

@alankilborn Sounds good!

alankilborn commented 5 months ago

Revised suggested documentation:

[2138] NPPM_GETTABCOLORID
Gets the tab color id for the given view and tab index.

Parameters:

wParam [in]
int, 0 for primary view, 1 for secondary view, -1 for currently-active view
lParam [in]
int, zero-based tab index, i.e., use 0 for first tab, 1 for second tab, etc.; use -1 for active tab

Return value:

int, the tab color id value:
    -1 (no color)
    0 (yellow)
    1 (green)
    2 (blue)
    3 (orange)
    4 (pink)

Note: There is no symmetric plugin command for setting the tab color. Plugins can use NPPM_MENUCOMMAND to set active tab's color with the desired tab color using these menu-command ids:
    44110 (no color)
    44111 (yellow)
    44112 (green)
    44113 (blue)
    44114 (orange)
    44115 (pink)