-- chat_toolbar - Displays a basic toolbar for interaction with Chat -- (optional component of Chat System) -- Template attachment: chat_system -- Created by: Patrick Ferland -- Created on: 05/27/2008 -- Revision History -- 05/27/2008 P.Ferland - New script -- 05/30/2008 P.Ferland - Initial release -- 06/02/2008 P.Ferland - Cleanup and documentation -- 06/05/2008 P.Ferland - Added toolbar configuration to this script -- 06/09/2008 P.Ferland - Separated toolbar from core skin and cleaned up -- 07/01/2008 P.Ferland - Modified to use stylesheet winstyles -- 07/22/2008 P.Ferland - Commented out sync scripts -- 07/30/2008 P.Ferland - Moved toolbar to chat window bottom -- 08/08/2008 P.Ferland - Updated dynamic configuration for new configurator -- 10/28/2008 P.Ferland - Made compatible with updated chat, removed obsolete attach/detach code -- Constants DEFAULT_BUTTONS = { MIN = { bn = '11304:303', bh = '11304:156', bp = '11304:155' }, NORMAL = { bn = '11304:304', bh = '11304:159', bp = '11304:158' }, MAX = { bn = '11304:302', bh = '11304:153', bp = '11304:152' }, SKINS = { bn = '11304:297', bh = '11304:165', bp = '11304:164' }, CHANNELS = { bn = '11304:298', bh = '11304:189', bp = '11304:188' }, PAUSE = { bn = '11304:305', bh = '11304:162', bp = '11304:161' }, SELECTED = '11304:106' } PLAYER_TOOLBAR_SCRIPT = '11304:16' CHAT_TOOLBAR = '11304:7' -- Script properties Define Properties() script_description = 'Chat Toolbar' script_long_description = 'Add a configurable toolbar to your Chat window' chat_system_toolbar_enabled = 1 ExposeProperty('chat_system_toolbar_enabled', 'Display toolbar?', 'checkbox') PersistProperty('chat_system_toolbar_enabled') chat_system_toolbar_pause_display = 0 chat_system_toolbar_channel_display = 0 ExposeProperty('chat_system_toolbar_channel_display', 'Display current channel on toolbar?', 'checkbox') PersistProperty('chat_system_toolbar_channel_display') chat_system_toolbar_channel_select = 0 ExposeProperty('chat_system_toolbar_channel_select', 'Display channel selector on toolbar?', 'checkbox') PersistProperty('chat_system_toolbar_channel_select') chat_system_toolbar_size_buttons = 1 ExposeProperty('chat_system_toolbar_size_buttons', 'Display chat size buttons on toolbar?', 'checkbox') PersistProperty('chat_system_toolbar_size_buttons') chat_system_toolbar_skin_select = 0 ExposeProperty('chat_system_toolbar_skin_select', 'Display chat skin selector on toolbar?', 'checkbox') PersistProperty('chat_system_toolbar_skin_select') IncludeScript('11302:12') -- chat_utility end -- Commands -- no commands -- Triggers -- Smart Object configuration extension Trigger set_script_param(caller, user_id, script_id, name, value) -- For core modules that need to redraw the UI, restart chat if ( script_id == CHAT_TOOLBAR ) then SendTo(self, 'chat_system_initialize', 0) end end -- System trigger, fired when script attaches (in builder or on object instantiation Trigger attach() -- Register scripts for loading chat_system_register_player_script(self, PLAYER_TOOLBAR_SCRIPT) SendTo(self, 'chat_system_initialize', 0) end -- System trigger, fired when script is detached Trigger detach() -- Unregister scripts chat_system_unregister_player_script(self, PLAYER_TOOLBAR_SCRIPT) SendTo(self, 'chat_system_initialize', 0) end Trigger chat_init_skins() SendTo(self, 'chat_init_skins_toolbar', 20) end Trigger chat_init_skins_toolbar() -- Define toolbar skin data for default skins local mpdefault_toolbar_min = { ws = '11304:55', x = 0, y = 24, w = 400, h = 20, item_y = 2, visible = 1, y_pad = 4, BUTTONS = { MIN = { bn = '11304:303', bh = '11304:156', bp = '11304:155' }, NORMAL = { bn = '11304:304', bh = '11304:159', bp = '11304:158' }, MAX = { bn = '11304:302', bh = '11304:153', bp = '11304:152' }, SKINS = { bn = '11304:297', bh = '11304:165', bp = '11304:164' }, CHANNELS = { bn = '11304:298', bh = '11304:189', bp = '11304:188' }, PAUSE = { bn = '11304:305', bh = '11304:162', bp = '11304:161' } } } local mpdefault_toolbar = { ws = '11304:55', x = 0, y = 24, w = 321, h = 20, item_y = 2, visible = 1, y_pad = 4, BUTTONS = { MIN = { bn = '11304:303', bh = '11304:156', bp = '11304:155' }, NORMAL = { bn = '11304:304', bh = '11304:159', bp = '11304:158' }, MAX = { bn = '11304:302', bh = '11304:153', bp = '11304:152' }, SKINS = { bn = '11304:297', bh = '11304:165', bp = '11304:164' }, CHANNELS = { bn = '11304:298', bh = '11304:189', bp = '11304:188' }, PAUSE = { bn = '11304:305', bh = '11304:162', bp = '11304:161' } } } local mpdefault_toolbar_max = { ws = '11304:55', x = 0, y = 24, w = 620, h = 20, item_y = 2, visible = 1, y_pad = 4, BUTTONS = { MIN = { bn = '11304:303', bh = '11304:156', bp = '11304:155' }, NORMAL = { bn = '11304:304', bh = '11304:159', bp = '11304:158' }, MAX = { bn = '11304:302', bh = '11304:153', bp = '11304:152' }, SKINS = { bn = '11304:297', bh = '11304:165', bp = '11304:164' }, CHANNELS = { bn = '11304:298', bh = '11304:189', bp = '11304:188' }, PAUSE = { bn = '11304:305', bh = '11304:162', bp = '11304:161' } } } local skin = {} skin = self.chat_system_skins['mpdefault'] if (skin ~= nil) then if (skin.normal ~= nil) then skin.normal.toolbar = table.deepcopy(mpdefault_toolbar) --skin.normal.window.y = skin.normal.window.y - skin.normal.toolbar.y skin.normal.toolbar.y = skin.normal.window.h + skin.normal.toolbar.y_pad end if (skin.minimized ~= nil) then skin.minimized.toolbar = table.deepcopy(mpdefault_toolbar_min) --skin.minimized.window.y = skin.minimized.window.y - skin.minimized.toolbar.y skin.minimized.toolbar.y = skin.minimized.window.h + skin.minimized.toolbar.y_pad end if (skin.maximized ~= nil) then skin.maximized.toolbar = table.deepcopy(mpdefault_toolbar_max) --skin.maximized.window.y = skin.maximized.window.y - skin.maximized.toolbar.y skin.maximized.toolbar.y = skin.maximized.window.h + skin.maximized.toolbar.y_pad end end SendTo(self, 'chat_system_initialize', 0) end -- Local functions -- no functions