dialog bmanager {
  -
  title "Background Manager"
  -
  size -1 -1 220 270
  button "&OK",1,160 245 50 21,ok
  text "Emplacement:" ,2, 10 13 68 15
  combo 3,90 10 120 85,drop sort
  box ,4, 10 35 200 200
  check "Activer le background",5, 20 53 125 15
  edit ,6,20 75 150 21,read
  button "...",7, 175 75 25 19
  radio "Centrée -c",8,20 110 55 17
  radio "Remplie -f",9,20 130 60 17
  radio "Normale -n",10,20 150 57 17
  radio "Étirée -r",11,20 170 48 17
  radio "Tuiles -t",12,20 190 50 17
  radio "Photo -p",13,20 210 50 17
  icon 14,120 130 80 80
  button "Rafraichir",15,80 245 70 21,disable
  link "À propos",16,12 249 50 15
  link "Retour",17,12 249 50 15
  edit ,18, 10 10 200 227,read return autovs multi vsbar
}

on 1:dialog:bmanager:init:0:{
  did -h bmanager 17,18
  did -a bmanager 3 Status
  did -a bmanager 3 Querys
  did -a bmanager 3 Channels
  did -a bmanager 3 Principale
  did -b bmanager 5,7,8,9,10,11,12,13
  did -a bmanager 18 Background Manager version 1, $crlf $+ conçu pour mIRC 5.8 et plus $crlf $crlf $+ Cet add-on a été produit par Dj Dgé $crlf $crlf $crlf $+ Fonctionnement: $crlf $+ Premièrement, vous devez choisir où vous désirez mettre un arrière-plan. Ensuite, cochez "Activer le background" et selectionnez l'image (Format .BMP obligatoire). Par la suite, choisissez le style (ie. centré, photo) et appuyez sur "Rafraichir". $crlf $crlf $+ Vous pouvez aussi désactiver le background sans perdre la configuration. $crlf $crlf $+ Technique: $crlf $+ L'add-on fonctionne avec des variables alors faites gaffe aux "%bmanager*" ;p $crlf $crlf $+
}

on 1:dialog:bmanager:sclick:*:{
  if ($did == 3) {
    if ($did(3)) { 
      did -e bmanager 5,7,8,9,10,11,12,13
      did -u bmanager 5,8,9,10,11,12,13
      %p = %bmanagerP. [ $+ [ $did(3) ] ]
      if (%p) { did -c bmanager $gettok(%p,1,32) }
      else { did -c bmanager 8 }
      did -h bmanager 14
      did -r bmanager 6
      %f = " $+ %bmanager. [ $+ [ $did(3) ] ] $+ "
      if ($exists(%f)) { 
        did -ra bmanager 6 %bmanager. [ $+ [ $did(3) ] ] 
        did -v bmanager 14
        %i = " $+ %bmanager. [ $+ [ $did(3) ] ] $+ "
        did -g bmanager 14 %i
      }
      if (%bmanagerS. [ $+ [ $did(3) ] ] == 0) { did -c bmanager 5 }
      else { did -b bmanager 7,8,9,10,11,12,13 }
    }
    else { did -b bmanager 5,7 }
  }
  if ($did == 5) {
    if ($did(5).state == 1) { 
      set %bmanagerS. [ $+ [ $did(3) ] ] 0 
      did -e bmanager 7,8,9,10,11,12,13 
      goto e 
    }
    else { 
      set %bmanagerS. [ $+ [ $did(3) ] ] 1 
      if ($did(3) == Status) { background -sx }
      if ($did(3) == Principale) { background -mx }
      if ($did(3) == Querys) { 
        %e = 1 | while ($query(%e)) { background -dex $query(%e) | inc %e }
        %e = 1 | while ($chat(%e)) { background -dex $chat(%e) | inc %e }
      }
      if ($did(3) == Channels) { %e = 1 | while ($chan(%e)) { background -xe $chan(%e) | inc %e } }
      did -b bmanager 7,8,9,10,11,12,13
    }
  }
  if ($did == 7) {
    bmanager -f $did(3)
    did -ra bmanager 6 %bmanager. [ $+ [ $did(3) ] ] | did -v bmanager 14
    did -g bmanager 14 " $+ %bmanager. [ $+ [ $did(3) ] ] $+ "
  }
  if ($did >= 8 && $did <= 13) { 
    set %bmanagerP. [ $+ [ $did(3) ] ] $did $gettok($did($did),2,32) 
    did -e bmanager 15 
  }
  if ($did == 15) {
    :e
    %p = %bmanagerP. [ $+ [ $did(3) ] ]
    %i = " $+ %bmanager. [ $+ [ $did(3) ] ] $+ "
    if ($exists(%i)) {
      did -b bmanager 15
      if ($did(3) == Status) { 
        if (%p) { %r = $gettok(%p,2,32) $+ s } 
        else { %r = -cs }
        background %r %i 
      }
      if ($did(3) == Principale) { 
        if (%p) { %r = $gettok(%p,2,32) $+ m } 
        else { %r = -cm }
        background %r %i 
      }
      if ($did(3) == Querys) { 
        if (%p) { %r = $gettok(%p,2,32) $+ de } 
        else { %r = -cde }
        %e = 1 | while ($query(%e)) { background %r $query(%e) %i | inc %e }
        %e = 1 | while ($chat(%e)) { background %r $chat(%e) %i | inc %e }
      }
      if ($did(3) == Channels) {
        if (%p) { %r = $gettok(%p,2,32) $+ e } 
        else { %r = -ce }
        %e = 1 | while ($chan(%e)) { background %r $chan(%e) %i | inc %e }
      }
    }
  }
  if ($did == 16) { did -h bmanager 2,3,4,5,6,7,8,9,10,11,12,13,14,15,16 | did -v bmanager 17,18 }
  if ($did == 17) { did -v bmanager 2,3,4,5,6,7,8,9,10,11,12,13,14,15,16 | did -h bmanager 17,18 }
}

alias bmanager {
  if ($1 == $null) { if ($dialog(bmanager) == $null) { dialog -m bmanager bmanager } }
  if ($1 == -f) {
    %f = $sfile($iif(%bmanagerL,%bmanagerL,$mircdir),Sélectionnez une image de format .BMP,OK)
    if (.bmp isin %f) { 
      set %bmanager. [ $+ [ $2 ] ] %f 
      set %bmanagerL $nofile(%f)
      did -e bmanager 15
    }
  }
}

menu menubar {
 

}

on 1:load:{
  set %bmanagerS.Status 0
  set %bmanagerS.Querys 0
  set %bmanagerS.Channels 0
  set %bmanagerS.Principale 0
}
