tglogo.png

Downloading File

Filename: ColorPicker W/Color Dialogs
alias MakeColorIcons {
  var %c 0
  if (!$isdir($+($mircdir,ColorIcon))) { mkdir ColorIcon }
  while (%c <= 15) {
    if (!$window(@MakeColorIcons)) { window  -hBpf +d @MakeColorIcons -1 -1 68 68 }
    drawfill @MakeColorIcons %c %c 0 0 68 68
    if (!$isfile($+(ColorIcon\,ColorIcon,%c,.bmp))) { drawsave @MakeColorIcons $qt($+($mircdir,ColorIcon\,ColorIcon,%c,.bmp)) }
    inc %c
  }
  window -c @MakeColorIcons
}
alias ColorPicker {
  if (!$dialog(ColorPicker)) { dialog -m ColorPicker ColorPicker }
  else { dialog -v ColorPicker ColorPicker }
}
dialog ColorPicker {
  title "Color Picker"
  size -1 -1 90 88
  option dbu
  icon 1, 2 2 8 8
  icon 2, 13 2 8 8
  icon 3, 24 2 8 8
  icon 4, 35 2 8 8
  icon 5, 46 2 8 8
  icon 6, 57 2 8 8
  icon 7, 68 2 8 8
  icon 8, 79 2 8 8
  icon 9, 2 15 8 8
  icon 10, 13 15 8 8
  icon 11, 24 15 8 8
  icon 12, 35 15 8 8
  icon 13, 46 15 8 8
  icon 14, 57 15 8 8
  icon 15, 68 15 8 8
  icon 16, 79 15 8 8
  button "", 17, 4 4 4 4
  button "", 18, 15 4 4 4
  button "", 19, 26 4 4 4
  button "", 20, 37 4 4 4
  button "", 21, 48 4 4 4
  button "", 22, 59 4 4 4
  button "", 23, 70 4 4 4
  button "", 24, 81 4 4 4
  button "", 25, 4 17 4 4
  button "", 26, 15 17 4 4
  button "", 27, 26 17 4 4
  button "", 28, 37 17 4 4
  button "", 29, 48 17 4 4
  button "", 30, 59 17 4 4
  button "", 31, 70 17 4 4
  button "", 32, 81 17 4 4
  icon 33, 6 36 34 34
  icon 34, 50 36 34 34
  radio "Foreground", 35, 6 24 37 10
  radio "Background", 36, 48 24 37 10
  button "Close", 37, 56 74 29 12, cancel
  button "Accept", 38, 5 74 29 12
}
On *:Dialog:ColorPicker:Close:*: {
  unset %ColorPicker*
}
On *:Dialog:ColorPicker:Sclick:*: {
  if ($did >= 17) && ($did <= 32) {
    if ($did(ColorPicker,35).state == 1) { 
      did -g ColorPicker 33 $+(ColorIcon\,ColorIcon,$calc($did - 17),.bmp)
      set %ColorPickerFG $calc($did - 17)
    }
    if ($did(ColorPicker,36).state == 1) { 
      did -g ColorPicker 34 $+(ColorIcon\,ColorIcon,$calc($did - 17),.bmp)
      set %ColorPickerBG $calc($did - 17)
    }
  }
  if ($did == 38) {
    color normal text %ColorPickerFG
    color background %ColorPickerBG
  }
}
On *:Dialog:ColorPicker:init:*: {
  MakeColorIcons
  var %c = 0
  while %c <= 15 {
    did -g ColorPicker $calc(%c + 1) $+(ColorIcon\,ColorIcon,%c,.bmp)
    inc %c
  }
  did -c ColorPicker 35
  set %ColorPickerFG $color(normal text)
  set %ColorPickerBG $color(background)
  did -g ColorPicker 33 $+(ColorIcon\ColorIcon,$color(normal text),.bmp)
  did -g ColorPicker 34 $+(ColorIcon\ColorIcon,$color(background),.bmp)
}
menu * {
 ColorPicker:ColorPicker
}


Related Files


Please note that on our website we use cookies necessary for the functioning of our website, cookies that optimize the performance. To learn more about our cookies, how we use them and their benefits, please read our Cookie Policy.
I Understand