|
@@ -26,7 +26,7 @@ $guiContent = new GuiColorPickerCtrl(ColorPickerDlg,EditorGuiGroup) {
|
|
|
changeChildSizeToFit = "0";
|
|
|
changeChildPosition = "0";
|
|
|
position = "0 24";
|
|
|
- extent = "271 481";
|
|
|
+ extent = "271 491";
|
|
|
profile = "GuiDefaultProfile";
|
|
|
tooltipProfile = "GuiToolTipProfile";
|
|
|
|
|
@@ -283,20 +283,26 @@ $guiContent = new GuiColorPickerCtrl(ColorPickerDlg,EditorGuiGroup) {
|
|
|
};
|
|
|
new GuiRolloutCtrl() {
|
|
|
caption = ":: Color Palette";
|
|
|
+ margin = "5 5 5 5";
|
|
|
position = "0 445";
|
|
|
- extent = "271 36";
|
|
|
+ extent = "271 46";
|
|
|
profile = "GuiRolloutProfile";
|
|
|
tooltipProfile = "GuiToolTipProfile";
|
|
|
|
|
|
- new GuiStackControl() {
|
|
|
- stackingType = "Dynamic";
|
|
|
- padding = "5";
|
|
|
- changeChildSizeToFit = "0";
|
|
|
- position = "0 17";
|
|
|
- extent = "271 16";
|
|
|
- profile = "GuiDefaultProfile";
|
|
|
- tooltipProfile = "GuiToolTipProfile";
|
|
|
- };
|
|
|
+ new GuiDynamicCtrlArrayControl(ColorPaletteStack) {
|
|
|
+ colCount = "12";
|
|
|
+ colSize = "12";
|
|
|
+ rowSize = "12";
|
|
|
+ rowCount = "3";
|
|
|
+ rowSpacing = "1";
|
|
|
+ colSpacing = "1";
|
|
|
+ dynamicSize = "1";
|
|
|
+ padding = "3 3 3 3";
|
|
|
+ position = "0 17";
|
|
|
+ extent = "271 47";
|
|
|
+ profile = "GuiDefaultProfile";
|
|
|
+ tooltipProfile = "GuiToolTipProfile";
|
|
|
+ };
|
|
|
};
|
|
|
};
|
|
|
};
|
|
@@ -342,6 +348,87 @@ function GetColorF( %currentColor, %callback, %root, %updateCallback, %cancelCal
|
|
|
%root.pushDialog(ColorPickerDlg);
|
|
|
}
|
|
|
|
|
|
+function ColorPaletteStack::onWake(%this)
|
|
|
+{
|
|
|
+ if($Pref::ColorPicker::ColorPalette $= "")
|
|
|
+ {
|
|
|
+ $Pref::ColorPicker::ColorPalette = "#FFFFFF #FF0000 #00FF00 #0000FF";
|
|
|
+ }
|
|
|
+
|
|
|
+ %colorCount = getWordCount($Pref::ColorPicker::ColorPalette);
|
|
|
+
|
|
|
+ if(%colorCount > 63)
|
|
|
+ %colorCount = 63;
|
|
|
+
|
|
|
+ for(%i=0; %i < %colorCount; %i++)
|
|
|
+ {
|
|
|
+ %hex = getWord($Pref::ColorPicker::ColorPalette, %i);
|
|
|
+ %rgb = ColorHEXToRGB(%hex);
|
|
|
+ %rgb = ColorIntToFloat(%rgb);
|
|
|
+
|
|
|
+ %colorBox = new GuiSwatchButtonCtrl() {
|
|
|
+ extent = "16 16";
|
|
|
+ color = %rgb;
|
|
|
+ profile = "GuiDefaultProfile";
|
|
|
+ colorHex = %hex;
|
|
|
+ useMouseEvents = "1";
|
|
|
+ class = "ColorPaletteSwatch";
|
|
|
+ };
|
|
|
+
|
|
|
+ ColorPaletteStack.Add(%colorBox);
|
|
|
+ }
|
|
|
+
|
|
|
+ %button = new GuiButtonCtrl() {
|
|
|
+ text = "+";
|
|
|
+ extent = "16 16";
|
|
|
+ profile = "ToolsGuiButtonProfile";
|
|
|
+ tooltipProfile = "GuiToolTipProfile";
|
|
|
+ command = "ColorPaletteStack.addCurrentColorToStack();";
|
|
|
+ };
|
|
|
+
|
|
|
+ ColorPaletteStack.Add(%button);
|
|
|
+}
|
|
|
+
|
|
|
+function ColorPaletteStack::addCurrentColorToStack(%this)
|
|
|
+{
|
|
|
+ %hex = HexTextEditor.getValue();
|
|
|
+ //Make sure we have 6 characters
|
|
|
+ while(strlen(%hex) < 6)
|
|
|
+ {
|
|
|
+ %hex = "0" @ %hex;
|
|
|
+ }
|
|
|
+ %hex = strupr(%hex);
|
|
|
+
|
|
|
+ $Pref::ColorPicker::ColorPalette = "#" @ %hex SPC $Pref::ColorPicker::ColorPalette;
|
|
|
+ ColorPaletteStack.clear();
|
|
|
+ ColorPaletteStack.onWake();
|
|
|
+}
|
|
|
+
|
|
|
+function ColorPaletteStack::onSleep(%this)
|
|
|
+{
|
|
|
+ ColorPaletteStack.clear();
|
|
|
+}
|
|
|
+
|
|
|
+function ColorPaletteSwatch::onMouseDown(%this)
|
|
|
+{
|
|
|
+ //Update all the other color fields
|
|
|
+ %rgb = ColorHEXToRGB(%this.colorHex);
|
|
|
+ %hsb = ColorRGBToHSB(%rgb);
|
|
|
+
|
|
|
+ // these automatically update our ColorNewSelected which
|
|
|
+ // updates all text fields including these.
|
|
|
+ ColorHueRange.setSelectedHue(getWord(%hsb, 0));
|
|
|
+ ColorHueRange.executeUpdate();
|
|
|
+
|
|
|
+ ColorBlendRange.setSelectedSaturation(getWord(%hsb, 1));
|
|
|
+ ColorBlendRange.setSelectedBrightness(getWord(%hsb, 2));
|
|
|
+ ColorBlendRange.executeUpdate();
|
|
|
+
|
|
|
+ // for now just set full alpha until we save out alpha as well
|
|
|
+ ColorAlphaRange.setSelectedAlpha(255);
|
|
|
+ ColorAlphaRange.executeUpdate();
|
|
|
+}
|
|
|
+
|
|
|
function ColorPickerRGBClass::onValidate(%this)
|
|
|
{
|
|
|
%red = RedTextEdit.getValue();
|