# Logs mIRC Viewer by |PaRa-BoL (WebMaster@IRC-France.com) pour http://mircscriptsfrfm.com (Défi) # (le 17/12/2002)

{
  Log Viewer:/lo.stat
}
on *:load:{
  writeini logs-viewer.ini path path $+(",$scriptdirlogs,")
}
dialog lmw {
  title "mIRC Logs Viewer by |PaRa-BoL"
  size -1 -1 614 463
  button "", 666, 0 0 0 0
  button "", 777, 0 0 0 0, ok
  button "Button", 1, 11 9 589 270
  check "Effacer", 2, 520 358 75 20, push, flat
  box "Logs Nicks/Autres", 3, 195 299 136 139
  box "Logs Chans", 4, 15 299 136 139
  list 5, 24 321 120 111, size
  list 6, 203 321 120 111, size
  text "Recherche:", 7, 349 387 53 16
  edit "", 8, 408 385 100 21, autohs
  button "Rechercher", 9, 520 385 75 20, default flat
  text "Dossier: ", 12, 349 332 48 16
  edit "", 13, 408 330 100 21, read autohs
  button "Parcourir", 14, 520 331 75 20, flat
  list 10, -3 440 618 25, size
}

alias lmw {
  dialog -m lmw lmw
}
on *:dialog:lmw:init:0:{
  unset %lochek
  window -hb +e @lview 0 0 589 270
  dll $mdx-path SetMircVersion $version
  dll $mdx-path MarkDialog lmw
  dll $mdx-path SetControlMDX 1 Window > [ dialog.mdx ]
  dll $mdx-path SetControlMDX 666 positioner size minbox > [ dialog.mdx ]
  dll $mdx-path SetControlMDX 10 statusbar sizeGrip > [ BARS.mdx ]
  did -i $dname 10 1 setparts 100 -1
  did -i $dname 10 2 1
  did -i $dname 10 3 $chr(0160) $+ Aucun Log de chargé.
  did -a lmw 1 grab $window(@lview).hwnd @lview
  did -a lmw 13 $readini(logs-viewer.ini,path,path)
  logs.listing $readini(logs-viewer.ini,path,path)
}
on *:dialog:lmw:sclick:5:{
  if (%lochek) { did -i $dname 10 3 $chr(0160) $+ Effacement de $+($did(5,$did(5).sel),.log),") | .remove $+(",$readini(logs-viewer.ini,path,path) $+ $+(\,$did(5,$did(5).sel),.log),") | logs.listing $readini(logs-viewer.ini,path,path) | halt }
  clear @lview
  loadbuf -p @lview $+(",$readini(logs-viewer.ini,path,path) $+ $+(\,$did(5,$did(5).sel),.log),")
  did -i $dname 10 3 $chr(0160) $+ Log: $+($did(5,$did(5).sel),.log),") $chr(124) (Taille: $bytes($file($+(",$readini(logs-viewer.ini,path,path) $+ $+(\,$did(5,$did(5).sel),.log),")).size,k)) $+ KB $chr(124) Création: $asctime($file($+(",$readini(logs-viewer.ini,path,path) $+ $+(\,$did(5,$did(5).sel),.log),")).ctime,dd/mm/yy) $chr(124) Dernière modif: $asctime($file($+(",$readini(logs-viewer.ini,path,path) $+ $+(\,$did(5,$did(5).sel),.log),")).mtime,dd/mm/yy) $+ ) 
}
on *:dialog:lmw:sclick:6:{
  if (%lochek) { did -i $dname 10 3 $chr(0160) $+ Effacement de $+($did(6,$did(6).sel),.log),") | .remove $+(",$readini(logs-viewer.ini,path,path) $+ $+(\,$did(6,$did(6).sel),.log),") | logs.listing $readini(logs-viewer.ini,path,path) | halt }
  clear @lview
  loadbuf -p @lview $+(",$readini(logs-viewer.ini,path,path) $+ $+(\,$did(6,$did(6).sel),.log),")
  did -i $dname 10 3 $chr(0160) $+ Log: $+($did(6,$did(6).sel),.log),") $chr(124) (Taille: $bytes($file($+(",$readini(logs-viewer.ini,path,path) $+ $+(\,$did(6,$did(6).sel),.log),")).size,k)) $+ KB $chr(124) Création: $asctime($file($+(",$readini(logs-viewer.ini,path,path) $+ $+(\,$did(6,$did(6).sel),.log),")).ctime,dd/mm/yy) $chr(124) Dernière modif: $asctime($file($+(",$readini(logs-viewer.ini,path,path) $+ $+(\,$did(6,$did(6).sel),.log),")).mtime,dd/mm/yy) $+ ) 
}
alias logs.listing {
  unset %nbn %nbc
  did -r lmw 6,5
  if (%lolookfor) { set %nbfil $findfile(" $+ $readini(logs-viewer.ini,path,path) $+ ",* $+ %lolookfor $+ *.log,0,filt.logs $nopath($1-)) | did -i $dname 10 2 $chr(0160) $+ Total logs: %nbfil | unset %lolookfor }
  else {
    did -r lmw 6,5
    set %nbfil $findfile(" $+ $readini(logs-viewer.ini,path,path) $+ ",*.log,0,filt.logs $nopath($1-))
    did -i $dname 10 2 $chr(0160) $+ Total logs: %nbfil
  }
}
alias filt.logs {
  if ($chr(35) isin $1-) { inc %nbc | did -ra lmw 3 Logs Chans ( $+ %nbc $+ ) | did -a lmw 6 $remove($1-,.log) }
  else { inc %nbn | did -ra lmw 4 Logs Nicks/Autres ( $+ %nbn $+ ) | did -a lmw 5 $remove($1-,.log) }
}
alias mdx-path {
  return $+(",$scriptdirmdx.dll,")
}
alias lo.stat {
  unset %nbfil %nbc %nbn
  lmw
}
on *:dialog:lmw:sclick:666:{
  if (sizing isin $did($dname,$did)) && ($did($dname,$did) != %chivares) {
    loresize $gettok($did($dname,$did),9-,32)
    set %chivares $did($dname,$did)
  }
}
on *:dialog:lmw:sclick:14:{
  :debut
  set %lorep $sdir="Chosissez le répertoire de Logs"
  if ($findfile(" %lorep ",*.log,0,filt.logs $nopath($1-)) == 0) { goto debut | halt }
  writeini logs-viewer.ini path path $+(",%lorep,")
  did -ra lmw 13 %lorep
  logs.listing $readini(logs-viewer.ini,path,path)
}
on *:dialog:lmw:sclick:9:{
  did -i $dname 10 3 $chr(0160) $+ Recherche de $did(8)
  set %lolookfor $did(8)
  logs.listing $readini(logs-viewer.ini,path,path)
}
on *:dialog:lmw:sclick:2:{
  if (%lochek) { unset %lochek | did -i $dname 10 3 $chr(0160) $+ Mode Effacement Désactivé. }
  else { set %lochek 1 | did -i $dname 10 3 $chr(0160) $+ Mode Effacement Activé (Sélectionner le Log à effacer). }
}
alias loresize {
  if ($1 < 570) { goto suite }
  dll " $+ $scriptdirmdx.dll $+ " MoveControl lmw 1 11 9 $calc($1 - 25) $calc($2 - 193)
  dll " $+ $scriptdirmdx.dll $+ " MoveControl lmw 3 195 $calc($2 - 164) 136 139
  dll " $+ $scriptdirmdx.dll $+ " MoveControl lmw 6 203 $calc($2 - 142) 120 111
  dll " $+ $scriptdirmdx.dll $+ " MoveControl lmw 4 15 $calc($2 - 164) 136 139
  dll " $+ $scriptdirmdx.dll $+ " MoveControl lmw 5 24 $calc($2 - 142) 120 111
  dll " $+ $scriptdirmdx.dll $+ " MoveControl lmw 7 349 $calc($2 - 76) 53 16
  dll " $+ $scriptdirmdx.dll $+ " MoveControl lmw 12 349 $calc($2 - 131) 48 16
  dll " $+ $scriptdirmdx.dll $+ " MoveControl lmw 8 408 $calc($2 - 78) $calc($1 - 514) 21
  dll " $+ $scriptdirmdx.dll $+ " MoveControl lmw 13 408 $calc($2 - 133) $calc($1 - 514) 21
  dll " $+ $scriptdirmdx.dll $+ " MoveControl lmw 9 $calc($1 - 94) $calc($2 - 78) 75 20
  dll " $+ $scriptdirmdx.dll $+ " MoveControl lmw 14 $calc($1 - 94) $calc($2 - 132) 75 20
  dll " $+ $scriptdirmdx.dll $+ " MoveControl lmw 2 $calc($1 - 94) $calc($2 - 105) 75 20
  :suite
  dll " $+ $scriptdirmdx.dll $+ " MoveControl lmw 10 -3 $calc($2 - 23) $calc($1 + 4) 25
}
