#
# This file is a part of the NsCDE - Not so Common Desktop Environment
# Author: Hegel3DReloaded
# Licence: GPLv3
#

UseGettext {$NSCDE_ROOT/share/locale;NsCDE-ColorMgr}
WindowLocaleTitle { Number Of Colors To Use }
WindowSize 296 358
Colorset 22

Init
Begin
   Set $Ncolors = (GetScriptArgument 1)
   If $Ncolors == {} Then
   Begin
      Set $Ncolors = 8
   End

   # Static value for examining default
   Set $StartNcolors = $Ncolors

   Set $FpVariantScriptArg = (GetScriptArgument 2)
   If $FpVariantScriptArg == {8} Then
   Begin
      Set $FpVariantArg = {8}
      ChangeValue 6 1
   End
   Else
   Begin
      Set $FpVariantArg = {5}
   End

   Set $WsmVariantScriptArg = (GetScriptArgument 3)
   If $WsmVariantScriptArg == {w} Then
   Begin
      Set $WsmVariantArg = {1}
      ChangeValue 7 1
   End
   Else
   Begin
      Set $WsmVariantArg = {0}
   End

   ChangeValue 5 1

   ChangeLocaleTitle 3 {Use 4 Colors Scheme}
   ChangeLocaleTitle 4 {Use 8 Colors Scheme}
   ChangeLocaleTitle 6 { Color 8 for Front Panel and Icons}
   ChangeLocaleTitle 7 { Color 6 for Workspace Manager}

   Set $DefaultTitle = (Gettext {Default}) { (} $Ncolors {)}
   ChangeTitle 5 $DefaultTitle

   Set $DefaultFont = (GetOutput {$NSCDE_TOOLSDIR/getfont -v -t normal -s medium -Z 14} 1 -1)
   ChangeFont 3 $DefaultFont
   ChangeFont 4 $DefaultFont
   ChangeFont 5 $DefaultFont
   ChangeFont 6 $DefaultFont
   ChangeFont 7 $DefaultFont

   Set $BtnFont = (GetOutput {$NSCDE_TOOLSDIR/getfont -v -t normal -s medium -Z 12.5} 1 -1)
   ChangeFont 9 $BtnFont
   ChangeFont 10 $BtnFont
   ChangeFont 11 $BtnFont

   # Keybindings
   Key Return C 9 1 {KeyOk}
   Key Escape A 10 1 {KeyClose}
   Key F1 A 11 1 {KeyHelp}
   Key Help A 11 1 {KeyHelp}
End

Widget 1
   Property
   Size 20 32
   Position 10 4
   Type ItemDraw
   Flags NoReliefString NoFocus
   Title {}
   Icon NsCDE/DtColor.l.pm
   Main
      Case message of
      SingleClic :
      Begin
      End
End

Widget 2
Property
   Size 280 170
   Position 8 54
   Type Rectangle
   Main
      Case message of
      SingleClic :
      Begin
      End
End

Widget 3
Property
   Position 22 80
   Type RadioButton
   Flags NoReliefString
   Title {XXXXXXXXXXXXXXXXXXXXXX}
   Font "xft:::pixelsize=15"
   Main
      Case message of
      SingleClic :
      Begin
         Set $Ncolors = 4
         Set $FpVariantArg = {5}
         Set $WsmVariantArg = {0}
         ChangeValue 4 0
         ChangeValue 5 0
         ChangeValue 6 0
         ChangeValue 7 0
      End
End

Widget 4
Property
   Position 22 130
   Type RadioButton
   Flags NoReliefString
   Title {XXXXXXXXXXXXXXXXXXXXXX}
   Font "xft:::pixelsize=15"
   Main
      Case message of
      SingleClic :
      Begin
         Set $Ncolors = 8
         ChangeValue 3 0
         ChangeValue 5 0
      End
End

Widget 5
Property
   Position 22 180
   Type RadioButton
   Flags NoReliefString
   Title {XXXXXXXXXXXXXXXXXXXXXX}
   Font "xft:::pixelsize=15"
   Main
      Case message of
      SingleClic :
      Begin
         ChangeValue 3 0
         ChangeValue 4 0
         If (GetValue 6) == 1 Then
         Begin
            If $StartNcolors == 4 Then
            Begin
               ChangeValue 6 0
            End
         End

         If $Ncolors == {} Then
         Begin
            Set $Ncolors = 8
         End
      End
End

Widget 6
   Property
   Size 180 0
   Position 10 234
   Type CheckBox
   Font "xft:::pixelsize=15"
   Flags NoReliefString Left
   Value 0
   Title { Color 8 for Front Panel and Icons}
   Main
      Case message of
      SingleClic :
      Begin
         If (GetValue 6) == 1 Then
         Begin
            ChangeValue 3 0
            If $Ncolors == 4 Then
            Begin
               ChangeValue 4 1
               ChangeValue 5 0
               Set $Ncolors = 8
            End
            Set $FpVariantArg = {8}
         End
         Else
         Begin
            Set $FpVariantArg = {5}
         End
      End
End

Widget 7
   Property
   Size 180 0
   Position 10 266
   Type CheckBox
   Font "xft:::pixelsize=15"
   Flags NoReliefString Left
   Value 0
   Title { Color 6 for Workspace Manager}
   Main
      Case message of
      SingleClic :
      Begin
         If (GetValue 7) == 1 Then
         Begin
            ChangeValue 3 0
            If $Ncolors == 4 Then
            Begin
               ChangeValue 4 1
               ChangeValue 5 0
               Set $Ncolors = 8
            End
            Set $WsmVariantArg = 1
         End
         Else
         Begin
            Set $WsmVariantArg = 0
         End
      End
End

Widget 8
Property
   Size 286 0
   Position 4 304
   Type Rectangle
Main
   Case message of
      SingleClic :
         Begin
         End
End

Widget 9
Property
   Size 60 20
   Position 16 318
   Type PushButton
   Flags NoReliefString
   LocaleTitle {OK}
   Font "xft:::pixelsize=15"
   Main
      Case message of
      SingleClic :
      Begin
         SendSignal 9 1
      End
      1 :
      Begin
         Do {SendToModule ColorMgr SendString 20 1 } $Ncolors
         Do {SendToModule ColorMgr SendString 20 2 } $FpVariantArg
         Do {SendToModule ColorMgr SendString 20 3 } $WsmVariantArg
         Quit
      End
End

Widget 10
Property
   Size 60 20
   Position 118 318
   Type PushButton
   Flags NoReliefString
   LocaleTitle {Cancel}
   Font "xft:::pixelsize=15"
   Main
      Case message of
      SingleClic :
      Begin
         SendSignal 10 1
      End
      1 :
      Begin
         Quit
      End
End

Widget 11
Property
   Size 60 20
   Position 212 318
   Type PushButton
   Flags NoReliefString
   LocaleTitle {Help}
   Font "xft:::pixelsize=15"
   Main
      Case message of
      SingleClic :
      Begin
         SendSignal 11 1
      End
      1 :
      Begin
         Do {f_DisplayURL "$[gt.Color Style Manager]" html/NsCDE-ColorMgr.html}
      End
End

