1/**
2 * This adds our own picker into the toolbar definition
3 *
4 * For each button a custom type is defined
5 */
6if (typeof toolbar == 'object' && typeof toolbox_initialized == 'undefined') {
7    toolbar[toolbar.length] = {
8        "type": "picker",
9        "id": "toolbox__picker",
10        "title": "Toolbox",
11        "icon": toolbox_icon + "wrench_orange.png",
12        "key": "",
13        "list": [
14            {
15                "type": "toolbox_sort",
16                "title": toolbox_lang.sortasc,
17                "icon": toolbox_icon + "sort_ascending.png",
18                "key": "",
19                "reverse": 0
20            },
21            {
22                "type": "toolbox_sort",
23                "title": toolbox_lang.sortdesc,
24                "icon": toolbox_icon + "sort_descending.png",
25                "key": "",
26                "reverse": 1
27            },
28            {
29                "type": "toolbox_indent",
30                "title": toolbox_lang.indent,
31                "icon": toolbox_icon + "text_indent.png",
32                "key": "",
33                "reverse": 0
34            },
35            {
36                "type": "toolbox_indent",
37                "title": toolbox_lang.outdent,
38                "icon": toolbox_icon + "text_indent_remove.png",
39                "key": "",
40                "reverse": 1
41            },
42            {
43                "type": "toolbox_counter",
44                "title": toolbox_lang.counter,
45                "icon": toolbox_icon + "edit-number.png",
46                "key": ""
47            },
48            {
49                "type": "toolbox_find",
50                "title": toolbox_lang.f_r,
51                "icon": toolbox_icon + "edit-replace.png",
52                "key": ""
53            }
54        ]
55    };
56
57    // avoid two pickers when plugin and greasemonkey is installed
58    toolbox_initialized = 'yes';
59
60    /**
61     * The Find and Replace dialog
62     */
63    window.tb_toolbox_find = function (btn, opts, edid) {
64        pickerClose();
65        ToolboxFindAndReplace(edid);
66    };
67
68    /**
69     * Sort the selected text
70     */
71    window.tb_toolbox_sort = function (btn, opts, edid) {
72        pickerClose();
73        ToolboxTextTools(edid).sort(opts['reverse']);
74    };
75
76    /**
77     * Indent the selected text
78     */
79    window.tb_toolbox_indent = function (btn, opts, edid) {
80        pickerClose();
81        ToolboxTextTools(edid).indent(opts['reverse']);
82    };
83
84    /**
85     * Count words and characters
86     *
87     */
88    window.tb_toolbox_counter = function (btn, opts, edid) {
89        pickerClose();
90        ToolboxCounter(edid);
91    };
92}
93