OK.
Lesson 1
1) Open your
quicknote.kmm by notepad (or your preferred text editor)
2) Add this portion of code somewhere near the end of macro (I've put it between '
Accels' section and
$OnInit command)
QN_BuildToolbar{
$qn_tip1=_("Add to QuickNote");
pluginmsg(toolbars,"AddToolbar","QuickNote,16,16","");
pluginmsg(toolbars,"AddButton","QuickNote,quicknote1,macros("."QuickNote_Text"."),"."App Launchers".",".$qn_tip1.",16,16,"."TabDinBkGnd.bmp[1],TabDinBkGnd.bmp[1]","");
}
This creates new toolbar with 1 button which sends
selected text to QuickNote
How it works? Look:
•
$qn_tip1=_("Add to QuickNote"); - this line sets tooltip for your button (you need as many such lines as many buttons you want to create - give them unique names, changing number after
$qn_tip - 2, 3, 4 etc. Real coders prefer to start numeration from 0 but I've started from 1 - no matter, it make sense only whether name is unique across all the macros bunch and it wouldn't confuse yourself
)
•
pluginmsg(toolbars,"AddToolbar","QuickNote,16,16","");
Your plugin (macro) sends to KM a message to '
Add Toolbar' which is named '
QuickNote' and consists of buttons which are
16x16 pixels in size
In other macros you can skip this step if you plan to add buttons from other extensions to this toolbar not creating their own bars.
•
pluginmsg(toolbars,"AddButton","QuickNote,quicknote1,macros("."QuickNote_Text"."),"."&QuickNote".",".$qn_tip1.",16,16,"."TabDinBkGnd.bmp[1],TabDinBkGnd.bmp[1]","");
This is message to '
Add button' to the '
QuickNote' toolbar; '
qiucknote1' is the button name (you define this);
macros("."QuickNote_Text".") is the command that refers to one of the functions defined in macro earlier (by author). I've chosen
QuickNote_Text to send selected text, but one can choose another function or create 2nd (3rd, 4th, etc.) button on the toolbar
(for next buttons you need more pluginmsg(toolbars,"AddButton",...) lines in macro)
Next goes tooltip (
".$qn_tip1."), button sizes (
16,16) and then image address for 'hot', 'cold' and 'dead' states of the button.
I've inserted here address of one random button from my installationbut you need to get or create specific bmp-file with needed icons, place it in
skins\default folder and paste its filename in this macro command.
3) add the next line
$OnSetup=$OnSetup."QN_BuildToolbar;";
after this one
$OnInit=$OnInit."_QuickNote_BuildMenu;";
4) save your macro and restart KM if was running.
If you need additional explanation about buttons creation and handling - this will be Lesson 2.
Edited 5 time(s). Last edit at 12/03/2012 03:42PM by rodocop.