+ $.log('Found groups:', group_buttons);
+
+ group_buttons.each(function() {
+ var group = $(this);
+ var group_name = group.attr('ui:group');
+ $.log('Connecting group: ' + group_name);
+
+ group.click(function() {
+ // change the active group
+ var active = $("*.toolbar-tabs-container button.active", toolbar);
+ if (active != group) {
+ active.removeClass('active');
+ group.addClass('active');
+ $(".toolbar-button-groups-container p", toolbar).each(function() {
+ if ( $(this).attr('ui:group') != group_name)
+ $(this).hide();
+ else
+ $(this).show();
+ });
+ }
+ });
+ });
+
+ // connect action buttons
+ var action_buttons = $('*.toolbar-button-groups-container button', toolbar);
+ action_buttons.each(function() {
+ var button = $(this);
+ var hk = button.attr('ui:hotkey');
+
+ var callback = function() {
+ editor.callScriptlet(button.attr('ui:action'),
+ self, eval(button.attr('ui:action-params')) );
+ };
+
+ // connect button
+ button.click(callback);
+
+ // connect hotkey
+ if(hk) self.hotkeys[parseInt(hk)] = callback;
+
+ // tooltip
+ if (button.attr('ui:tooltip') )
+ {
+ var tooltip = button.attr('ui:tooltip');
+ if(hk) tooltip += ' [Alt+'+hk+']';
+
+ button.wTooltip({
+ delay: 1000,
+ style: {
+ border: "1px solid #7F7D67",
+ opacity: 0.9,
+ background: "#FBFBC6",
+ padding: "1px",
+ fontSize: "12px"
+ },
+ content: tooltip
+ });
+ }
+ });
+}
+
+Panel.prototype.hotkeyPressed = function(event)
+{
+ var callback = this.hotkeys[event.keyCode];
+ if(callback) callback();
+}
+
+Panel.prototype.isHotkey = function(event) {
+ if( event.altKey && (this.hotkeys[event.keyCode] != null) )
+ return true;
+ return false;
+}
+
+//
+Panel.prototype.fireEvent = function(name) {
+ $(document).trigger('panel:'+name, this);
+}
+
+function Editor()
+{
+ this.rootDiv = $('#panels');
+ this.popupQueue = [];
+ this.autosaveTimer = null;
+ this.scriplets = {};