/** * * Make an array of colors complete with styles. The colors are arranged by hue families. * * @param int slices The number of families. 6-15 is probably good. * @param int trisize Proportional with the square root of the size of each family 4 to 6 is probably good. * @return array an array with the values at 'options' and styles in 'styles' */ function makeColorArrays($slices, $triSize) { $options = array(); $styles = array(); $options[''] = "Default"; $styles[''] = ""; for ($dark = 0; $dark <= $triSize; $dark++) { $goalDark = 255.99 * $dark / $triSize; $arr = GUIComponentUtility::addColor($goalDark, $goalDark, $goalDark); $val0 = $arr[0]; $val1 = $arr[1]; $options[$val0] = $val0; $styles[$val0] = $val1; } for ($rot = 0; $rot < $slices; $rot++) { $angle_R = $rot / $slices * 2 * M_PI + M_PI * 1 / 3; $angle_G = $rot / $slices * 2 * M_PI + M_PI * 5 / 3; $angle_B = $rot / $slices * 2 * M_PI + M_PI * 3 / 3; $baseR = 128 + 127.99 * sin($angle_R); $baseG = 128 + 127.99 * sin($angle_G); $baseB = 128 + 127.99 * sin($angle_B); for ($dark = $triSize; $dark > 0; $dark--) { $baseDarknessR = $baseR * $dark / $triSize; $baseDarknessG = $baseG * $dark / $triSize; $baseDarknessB = $baseB * $dark / $triSize; $goalDark = 255.99 * $dark / $triSize; for ($gray = 0; $gray < $dark; $gray++) { $actual_r = $baseDarknessR * ($dark - $gray) + $goalDark * $gray; $actual_g = $baseDarknessG * ($dark - $gray) + $goalDark * $gray; $actual_b = $baseDarknessB * ($dark - $gray) + $goalDark * $gray; $actual_r /= $dark; $actual_g /= $dark; $actual_b /= $dark; $arr = GUIComponentUtility::addColor($actual_r, $actual_g, $actual_b); $val0 = $arr[0]; $val1 = $arr[1]; $options[$val0] = $val0; $styles[$val0] = $val1; } } } //this hack takes care of the fact that I really want to return them both. $ret = array(); $ret['options'] = $options; $ret['styles'] = $styles; return $ret; }
/** * Make everything */ function rebuildContent() { $callBack = $this->_callBack; $collectionName = $this->_collectionName; $thingsToApplyCollectionTo = $this->_thingsToApplyCollectionTo; //get the theme eval('$theme = ' . $callBack . "();"); if (!is_object($theme)) { return; } $color = GUIComponentUtility::makeColorArrays(12, 5); $marginArray = GUIComponentUtility::makeMarginAndPaddingArray(); $borderSizes = GUIComponentUtility::makeBorderSizeArrays(); $borderStyles = GUIComponentUtility::makeBorderStyleArrays(); $collectionSelector1 = "*." . $collectionName; //first style collection if (!$theme->getStyleCollection($collectionSelector1)) { $styleCollection1 = new StyleCollection($collectionSelector1, $collectionName, "BackGround properties", "How would you like your background to look?" . $collectionName); foreach ($thingsToApplyCollectionTo as $arr) { $theme->addStyleForComponentType($styleCollection1, $arr['type'], $arr['index']); } } //first style collection GUI elements $comp = new WGUISelectList($callBack, $collectionSelector1, new BackgroundColorSP("#FFFFFF"), "ColorSC", $color['options'], $color['styles']); $this->addComponent('bgColor', $comp); $prop = new BorderSP('0px', "solid", "#000000"); $comp = new WGUISelectList($callBack, $collectionSelector1, $prop, "LengthSC", $borderSizes['options'], $borderSizes['styles']); $this->addComponent('borderSize', $comp); $comp = new WGUISelectList($callBack, $collectionSelector1, $prop, "BorderStyleSC", $borderStyles['options'], $borderStyles['styles']); $this->addComponent('borderStyle', $comp); $comp = new WGUISelectList($callBack, $collectionSelector1, $prop, "ColorSC", $color['options'], $color['styles']); $this->addComponent('borderColor', $comp); $comp = new WGUISelectList($callBack, $collectionSelector1, new MarginTopSP("0px"), "LengthSC", $marginArray, false); $this->addComponent('m_top', $comp); $comp = new WGUISelectList($callBack, $collectionSelector1, new MarginBottomSP("0px"), "LengthSC", $marginArray, false); $this->addComponent('m_bottom', $comp); $comp = new WGUISelectList($callBack, $collectionSelector1, new MarginLeftSP("0px"), "LengthSC", $marginArray, false); $this->addComponent('m_left', $comp); $comp = new WGUISelectList($callBack, $collectionSelector1, new MarginRightSP("0px"), "LengthSC", $marginArray, false); $this->addComponent('m_right', $comp); }
/** * Make everything */ function rebuildContent() { $callBack = $this->_callBack; $collectionName = $this->_collectionName; $thingsToApplyCollectionTo = $this->_thingsToApplyCollectionTo; //get the theme eval('$theme = ' . $callBack . "();"); if (!is_object($theme)) { return; } $align = GUIComponentUtility::makeAlignArray(); $textSpacing = GUIComponentUtility::makeSpacingArray(); $lineSpacing = GUIComponentUtility::makeLineSpacingArray(); $marginArray = GUIComponentUtility::makeMarginAndPaddingArray(); $collectionSelector1 = "*." . $collectionName; //first style collection if (!$theme->getStyleCollection($collectionSelector1)) { $styleCollection1 = new StyleCollection($collectionSelector1, $collectionName, "Text Properties", "How would you like your text to look?" . $collectionName); foreach ($thingsToApplyCollectionTo as $arr) { $theme->addStyleForComponentType($styleCollection1, $arr['type'], $arr['index']); } } //first style collection GUI elements $comp = new WGUISelectList($callBack, $collectionSelector1, new TextAlignSP("left"), "TextAlignSC", $align, "text-align"); $this->addComponent('align', $comp); $comp = new WGUISelectList($callBack, $collectionSelector1, new LetterSpacingSP("normal"), "TextSpacingSC", $textSpacing, "letter-spacing"); $this->addComponent('letterSpace', $comp); $comp = new WGUISelectList($callBack, $collectionSelector1, new WordSpacingSP("normal"), "TextSpacingSC", $textSpacing, false); $this->addComponent('wordSpace', $comp); $comp = new WGUISelectList($callBack, $collectionSelector1, new LineHeightSP("normal"), "LineHeightSC", $lineSpacing, false); $this->addComponent('lineSpace', $comp); $comp = new WGUISelectList($callBack, $collectionSelector1, new PaddingTopSP("0px"), "LengthSC", $marginArray, false); $this->addComponent('p_top', $comp); $comp = new WGUISelectList($callBack, $collectionSelector1, new PaddingBottomSP("0px"), "LengthSC", $marginArray, false); $this->addComponent('p_bottom', $comp); $comp = new WGUISelectList($callBack, $collectionSelector1, new PaddingLeftSP("0px"), "LengthSC", $marginArray, false); $this->addComponent('p_left', $comp); $comp = new WGUISelectList($callBack, $collectionSelector1, new PaddingRightSP("0px"), "LengthSC", $marginArray, false); $this->addComponent('p_right', $comp); }
/** * Make everything */ function rebuildContent() { $callBack = $this->_callBack; $collectionName = $this->_collectionName; $thingsToApplyCollectionTo = $this->_thingsToApplyCollectionTo; //get the theme eval('$theme = ' . $callBack . "();"); if (!is_object($theme)) { return; } //get arrays ready $color = GUIComponentUtility::makeColorArrays(12, 5); $fonts = GUIComponentUtility::makeFontArray(); $fontSize = GUIComponentUtility::makeFontSizeArray(); $collectionSelector1 = "*." . $collectionName; //first style collection if (!$theme->getStyleCollection($collectionSelector1)) { $styleCollection1 = new StyleCollection($collectionSelector1, $collectionName, "Font Properties", "Font choice with selector " . $collectionName); foreach ($thingsToApplyCollectionTo as $arr) { $theme->addStyleForComponentType($styleCollection1, $arr['type'], $arr['index']); } } //first style collection GUI elements $comp = new WGUISelectList($callBack, $collectionSelector1, new ColorSP("#000000"), "ColorSC", $color['options'], $color['styles']); $this->addComponent('color', $comp); $prop = new FontSP('serif', "12pt", "normal", "normal", "normal"); $comp = new WGUISelectList($callBack, $collectionSelector1, $prop, "FontFamilySC", $fonts, "font-family"); $this->addComponent('font', $comp); $comp = new WGUISelectList($callBack, $collectionSelector1, $prop, "FontSizeSC", $fontSize, "font-size"); $this->addComponent('fontSize', $comp); $comp = new WGUICheckBox($callBack, $collectionSelector1, $prop, "FontWeightSC", "bold", "normal"); $this->addComponent('boldBox', $comp); $comp = new WGUICheckBox($callBack, $collectionSelector1, $prop, "FontStyleSC", "italic", "normal"); $this->addComponent('italicsBox', $comp); $comp = new WGUICheckBox($callBack, $collectionSelector1, $prop, "FontVariantSC", "small-caps", "normal"); $this->addComponent('smallcapsBox', $comp); }