home *** CD-ROM | disk | FTP | other *** search
/ XMANGA 27 / XMANGA27.ISO / Extra / mp10setup.exe / wmploc.DLL / 256 / APPCOLORCHOOSER.JS < prev    next >
Encoding:
Text (UTF-16)  |  2004-08-11  |  7.1 KB  |  105 lines

  1. var g_fPolling=false;
  2. var g_kPaintSpeed=33;
  3.  
  4. function StartPolling()
  5. {
  6.     g_fPolling=true;
  7.     UpdateSliders();
  8.     timerTxt.moveTo(timerTxt.left,timerTxt.top,g_kPaintSpeed);
  9. }
  10.  
  11. function StopPolling()
  12. {
  13.     g_fPolling=false;
  14. }
  15.  
  16. function UpdateSliders()
  17. {
  18.     var newback                 = actualFromSlider(backhueslider.value);
  19.     mediacenter.backHueShift    = newback;
  20.     mediacenter.backSaturation  = backsatslider.value;
  21.     
  22.     var newbuttonsat            = (180-Math.abs(backhueslider.value)) / 180;
  23.     newbuttonsat                = Math.min(newbuttonsat, mediacenter.backSaturation);
  24.     mediacenter.buttonSaturation=newbuttonsat;
  25. }
  26.  
  27. function sliderFromActual(actualVal)
  28. {
  29.     return (actualVal<=180) ? actualVal : (actualVal-360);
  30. }
  31.  
  32. function actualFromSlider(sliderVal)
  33. {
  34.     return (sliderVal<0) ? (sliderVal+360) : sliderVal;
  35. }
  36.  
  37. function ResetColors()
  38. {
  39.     mediacenter.backHueShift=0;
  40.     mediacenter.buttonHueShift=0;
  41.     mediacenter.backSaturation=1;
  42.     mediacenter.buttonSaturation=1;
  43.     helper.clearColors();
  44. }
  45.  
  46. function ColorSetting(hue,sat)
  47. {
  48.     this.hue=hue;
  49.     this.sat=sat;
  50. }
  51.  
  52. var g_rgColorPresets = new Array
  53. (
  54. //====================================================================
  55. /*                   HUE     SATURATION            || TITLE         */
  56. //====================================================================
  57.     new ColorSetting(0,      1),                    // defaultblue
  58.     new ColorSetting(330,    0.491124272346497),    // teal_new
  59.     new ColorSetting(330,    1),                    // teal_current
  60.     new ColorSetting(300,    0.491124272346497),    // seagreen_new
  61.     new ColorSetting(300,    1),                    // seagreen_current
  62.     new ColorSetting(240,    0.491124272346497),    // green_new
  63.     new ColorSetting(240,    1),                    // green_current
  64.     new ColorSetting(210,    0.491124272346497),    // xpolive
  65.     new ColorSetting(210,    1),                    // olive_current
  66.     new ColorSetting(180,    0.272189348936081),    // putty
  67.     new ColorSetting(180,    1),                    // brown_current
  68.     new ColorSetting(171.48, 1.84),                 // orange 
  69.     new ColorSetting(150,    0.491124272346497),    // bronze_new
  70.     new ColorSetting(150,    1),                    // bronze_current
  71.     new ColorSetting(120,    1),                    // red_current
  72.     new ColorSetting(90,     1),                    // magenta_current
  73.     new ColorSetting(60,     0.461538463830948),    // violet_new
  74.     new ColorSetting(60,     1),                    // violet_current
  75.     new ColorSetting(30,     0.467455625534058),    // purple_new
  76.     new ColorSetting(30,     1.0),                  // purple_current
  77.     new ColorSetting(0,         0.0),                  // grey            
  78.     new ColorSetting(0,         0.272189348936081),    // xpsilver
  79.     new ColorSetting(0,      0.491124272346497)     // blue   
  80. );
  81.  
  82. var g_nCurrentColorPreset=parseInt(theme.loadPreference("CurrentColorPreset"));
  83.  
  84. function CycleColors(interval)
  85. {
  86.     if ( isNaN( g_nCurrentColorPreset ) )
  87.     {
  88.         g_nCurrentColorPreset=0;
  89.     }
  90.     else
  91.     {
  92.         g_nCurrentColorPreset = (g_nCurrentColorPreset+interval)%g_rgColorPresets.length;
  93.     }
  94.     mediacenter.backHueShift    = g_rgColorPresets[g_nCurrentColorPreset].hue;
  95.     mediacenter.backSaturation  = g_rgColorPresets[g_nCurrentColorPreset].sat;
  96. }
  97.  
  98. function SaveSettings()
  99. {
  100.     if(false==isNaN(g_nCurrentColorPreset))
  101.     {
  102.         theme.savePreference('CurrentColorPreset',g_nCurrentColorPreset);
  103.     }
  104. }
  105.