--- /dev/null
+/*\r
+ * FCKeditor - The text editor for Internet - http://www.fckeditor.net\r
+ * Copyright (C) 2003-2009 Frederico Caldeira Knabben\r
+ *\r
+ * == BEGIN LICENSE ==\r
+ *\r
+ * Licensed under the terms of any of the following licenses at your\r
+ * choice:\r
+ *\r
+ * - GNU General Public License Version 2 or later (the "GPL")\r
+ * http://www.gnu.org/licenses/gpl.html\r
+ *\r
+ * - GNU Lesser General Public License Version 2.1 or later (the "LGPL")\r
+ * http://www.gnu.org/licenses/lgpl.html\r
+ *\r
+ * - Mozilla Public License Version 1.1 or later (the "MPL")\r
+ * http://www.mozilla.org/MPL/MPL-1.1.html\r
+ *\r
+ * == END LICENSE ==\r
+ *\r
+ * FCKToolbarPanelButton Class: Handles the Fonts combo selector.\r
+ */\r
+\r
+var FCKToolbarFontsCombo = function( tooltip, style )\r
+{\r
+ this.CommandName = 'FontName' ;\r
+ this.Label = this.GetLabel() ;\r
+ this.Tooltip = tooltip ? tooltip : this.Label ;\r
+ this.Style = style ? style : FCK_TOOLBARITEM_ICONTEXT ;\r
+\r
+ this.DefaultLabel = FCKConfig.DefaultFontLabel || '' ;\r
+}\r
+\r
+// Inherit from FCKToolbarSpecialCombo.\r
+FCKToolbarFontsCombo.prototype = new FCKToolbarFontFormatCombo( false ) ;\r
+\r
+FCKToolbarFontsCombo.prototype.GetLabel = function()\r
+{\r
+ return FCKLang.Font ;\r
+}\r
+\r
+FCKToolbarFontsCombo.prototype.GetStyles = function()\r
+{\r
+ var baseStyle = FCKStyles.GetStyle( '_FCK_FontFace' ) ;\r
+\r
+ if ( !baseStyle )\r
+ {\r
+ alert( "The FCKConfig.CoreStyles['Size'] setting was not found. Please check the fckconfig.js file" ) ;\r
+ return {} ;\r
+ }\r
+\r
+ var styles = {} ;\r
+\r
+ var fonts = FCKConfig.FontNames.split(';') ;\r
+\r
+ for ( var i = 0 ; i < fonts.length ; i++ )\r
+ {\r
+ var fontParts = fonts[i].split('/') ;\r
+ var font = fontParts[0] ;\r
+ var caption = fontParts[1] || font ;\r
+\r
+ var style = FCKTools.CloneObject( baseStyle ) ;\r
+\r
+ style.SetVariable( 'Font', font ) ;\r
+ style.Label = caption ;\r
+\r
+ styles[ caption ] = style ;\r
+ }\r
+\r
+ return styles ;\r
+}\r
+\r
+FCKToolbarFontsCombo.prototype.RefreshActiveItems = FCKToolbarStyleCombo.prototype.RefreshActiveItems ;\r
+\r
+FCKToolbarFontsCombo.prototype.StyleCombo_OnBeforeClick = function( targetSpecialCombo )\r
+{\r
+ // Clear the current selection.\r
+ targetSpecialCombo.DeselectAll() ;\r
+\r
+ var startElement = FCKSelection.GetBoundaryParentElement( true ) ;\r
+\r
+ if ( startElement )\r
+ {\r
+ var path = new FCKElementPath( startElement ) ;\r
+\r
+ for ( var i in targetSpecialCombo.Items )\r
+ {\r
+ var item = targetSpecialCombo.Items[i] ;\r
+ var style = item.Style ;\r
+\r
+ if ( style.CheckActive( path ) )\r
+ {\r
+ targetSpecialCombo.SelectItem( item ) ;\r
+ return ;\r
+ }\r
+ }\r
+ }\r
+}\r