on *:start: { dialog -m toolbar toolbar }

on *:connect: {
  update.toolbar
}

on *:disconnect: {
  update.toolbar
}

on *:close:*: {
  update.toolbar
}

alias saat { if ($dialog(toolbar)) { did -a toolbar $1 $time } }


alias update.toolbar {
  if (!$dialog(toolbar)) { halt }
  else {
    scid $activecid
    if ( $scid($activecid).status = connecting || $scid($activecid).status = connected ) { 
      did -o toolbar 1 3 +a 2 $chr(32) Bağlantıyı Kes $chr(9) $+ IRC Serverle Bağlantınızı Koparır. 
    }
    else {
      did -o toolbar 1 3 +a 1 $chr(32) Servere Bağlan $chr(9) $+ IRC Servere Bağlantı Kurar.
    }
  }
}


dialog toolbar {
  title "SohbetSen"
  size 0 0 500 $iif($temabul,22,24)
  option dbu
  list 1, 2 4 550 17, size
  text "", 2, 464 23 45 16, center
  text "", 3, 467 23 25 11, center

  list 100, 2 23 180 19, size
  combo 101, 170 23 148 70, size edit drop
  text "Adres:", 102, 140 24 26 31
  list  103, 323 23 45 11


}

on *:dialog:toolbar:init:0: {
  mdx MarkDialog $dname
  mdx SetDialog $dname style 
  mdx SetFont $dname 1,102,103 Turkish 14 800 Cyrillic
  mdx SetFont $dname 100 Turkish 14 600 Cyrillic
  mdx SetFont $dname 3 +a 20 600 arial

  mdx SetColor $dname 102 text $rgb(0,0,0)

  did -a $dname 101 http://www.sohbetsen.org
  did -c $dname 101 1


  rebar HideToolbar .
  rebar Dock $dialog(toolbar).hwnd > top

  mdx SetControlMDX $dname 1,3,4 Progressbar smooth > $ctl
  mdx SetControlMDX $dname 1,4 ToolBar list flat wrap arrows nodivider > $bars
  mdx SetControlMDX $dname 100,103 ToolBar list flat wrap arrows nodivider > $bars
  mdx SetBorderStyle 1,100,103



  did -i $dname 103 1 bmpsize 10 10
  did -i $dname 103 1 setimage +nh icon small SohbetSen\ico\9.ico
  did -a $dname 103 +b 1 Adrese Git!  
  did -a $dname 103 +a -

  did -i $dname 100 1 bmpsize 10 10
  did -i $dname 100 1 setimage icon large SohbetSen\ico\10.ico
  did -i $dname 100 1 setimage icon large SohbetSen\ico\11.ico
  did -i $dname 100 1 setimage icon large SohbetSen\ico\12.ico
  did -i $dname 100 1 setimage icon large SohbetSen\ico\13.ico
  did -a $dname 100 +a -
  did -a $dname 100 +a 1 $chr(32) Geri $chr(9) $+ Bir önceki sayfaya gelinir...
  did -a $dname 100 +a -
  did -a $dname 100 +a 2 $chr(32) İleri $chr(9) $+ Bir sonraki sayfaya  gidilir...
  did -a $dname 100 +a -
  did -a $dname 100 +a 3 $chr(32) Dur $chr(9) $+ Sayfa görüntülenmesi durdurulur...
  did -a $dname 100 +a -
  did -a $dname 100 +a 4 $chr(32) Yenile $chr(9) $+ Sayfa görüntülenmesini yeniler...
  did -a $dname 100 +a -


  did -i $dname 1 1 setscheme $rgb(163,163,163) $rgb(163,163,163)
  did -i $dname 1 1 bmpsize 26 26 
  did -i $dname 1 1 setimage icon large SohbetSen\ico\14.ico
  did -i $dname 1 1 setimage icon large SohbetSen\ico\15.ico
  did -i $dname 1 1 setimage icon large SohbetSen\ico\16.ico
  did -i $dname 1 1 setimage icon large SohbetSen\ico\17.ico
  did -i $dname 1 1 setimage icon large SohbetSen\ico\18.ico
  did -i $dname 1 1 setimage icon large SohbetSen\ico\19.ico
  did -i $dname 1 1 setimage icon large SohbetSen\ico\20.ico
  did -i $dname 1 1 setimage icon large SohbetSen\ico\21.ico
  did -i $dname 1 1 setimage icon large SohbetSen\ico\22.ico
  did -i $dname 1 1 setimage icon large SohbetSen\ico\23.ico
  did -i $dname 1 1 setimage icon large SohbetSen\ico\24.ico
  did -a $dname 1 +a -
  did -a $dname 1 +a 1  $chr(32) Server Bağlan $chr(9) $+ 
  did -a $dname 1 +a -
  did -a $dname 1 +a 3  $chr(32) Bağlantı $chr(9) $+
  did -a $dname 1 +a -
  did -a $dname 1 +a 4  $chr(32) Kanallar $chr(9) $+ 
  did -a $dname 1 +a -
  did -a $dname 1 +a 5 $chr(32) Korumalar $chr(9) $+ 
  did -a $dname 1 +a -
  did -a $dname 1 +a 6 $chr(32) Kontrol Panel $chr(9) $+ 
  did -a $dname 1 +a -
  did -a $dname 1 +a 7 $chr(32) Müzik $chr(9) $+ 
  did -a $dname 1 +a -
  did -a $dname 1 +a 8 $chr(32) Away Menü $chr(9) $+ 
  did -a $dname 1 +a -
  did -a $dname 1 +a 9 $chr(32) İnteraktif $chr(9) $+ 
  did -a $dname 1 +a -
  did -a $dname 1 +a 10 $chr(32) Oyunlar $chr(9) $+ 
  did -a $dname 1 +a -
  did -a $dname 1 +a 11 $chr(32) Web Adresleri $chr(9) $+ 
  did -a $dname 1 +a -

  if ($window($active) != @SohbetSen) && (!$window(@SohbetSen)) {
    window -peng1k0 @SohbetSen
    var %hwnd = $dll(SohbetSen\dll\nhtml.dll,attach,$window(@SohbetSen).hwnd)
    dll SohbetSen\dll\nhtml.dll attach %hwnd
    dll SohbetSen\dll\nhtml.dll navigate http://www.sohbetsen.org
  }
}
on *:dialog:toolbar:*:*: {
  if $devent == sclick {
    if $did == 1 {
      if ($did($dname,1).sel = 3) {
        if ($scid($activecid).status = connecting || $scid($activecid).status = connected ) { scid $activecid disconnect }
        else {
          scid $activecid server
        }
        update.toolbar
        did -f $dname 1
        scid $activecid window -a "status window"
      }
      if ($did($dname,1).sel = 5) {
        /helps
      }
      if ($did($dname,1).sel = 7) {
        /Kanallar
      }
      if ($did($dname,1).sel = 9) {
        /yonpanel
      }
      if ($did($dname,1).sel = 11) {
        /panel
      }
      if ($did($dname,1).sel = 13) {
        /MuzikPop
      }
      if ($did($dname,1).sel = 15) {
        /AwayX 
      }
      if ($did($dname,1).sel = 17) {
        /ExtraPop
      }
      if ($did($dname,1).sel = 19) {
        /oyunpop
      }
      if ($did($dname,1).sel = 21) {
        /dialog -m site site

      }
    }
    if $did == 100 {
      if $did(100).sel == 3 {
        var %hwnd = $dll(SohbetSen/dll/nhtml.dll,find,findme) 
        dll SohbetSen/dll/nHTML.dll attach %hwnd
        dll SohbetSen/dll/nhtml.dll back 0
        /echo -a  4 0,1 2 Bir önceki sayfaya geliniyor...

      }
    }
    if $did == 100 {
      if $did(100).sel == 5 {
        var %hwnd = $dll(SohbetSen/dll/nhtml.dll,find,findme) 
        dll SohbetSen/dll/nHTML.dll attach %hwnd 
        dll SohbetSen/dll/nHTML.dll forward 0
        /echo -a  4 0,1 2 Bir sonraki sayfaya gidiliyor...

      }
    }
    if $did == 100 {
      if $did(100).sel == 7 {
        var %hwnd = $dll(SohbetSen/dll/nhtml.dll,find,findme) 
        dll SohbetSen/dll/nHTML.dll attach %hwnd
        dll SohbetSen/dll/nHTML.dll stop 0
        /echo -a  4 0,1 2 Sayfa görüntülenmesi durduruluyor...

      }
    }
    if $did == 100 {
      if $did(100).sel == 9 {
        var %hwnd = $dll(SohbetSen/dll/nhtml.dll,find,findme) 
        dll SohbetSen/dll/nHTML.dll attach %hwnd
        dll SohbetSen/dll/nhtml.dll refresh 0
        /echo -a  4 0,1 2 Sayfa görüntülenmesi yenileniyor...

      }
    }
    if $did == 103 {
      var %z = $did(103).sel
      if (%z == 2) { git $did(101) }
    }
  }

}

Alias -l html { dll $+(",$mircdirSohbetSen/dll/nhtml.dll,") $1- } 
Alias -l nhtml { return $+(",$mircdirSohbetSen/dll/nhtml.dll,") }

Alias -l www {
  window -peng1Bk0 $1 
  html attach $window($1).hwnd
  html navigate $2-

}

Alias git { 
  if (!$1) { www $yenipencere($window(0)) http://www.sohbetsen.org }
  if ($1) { www $yenipencere($window(0)) $1- }
  if ($dialog(toolbar)) { did -a toolbar 101 $1- } 
}
Alias yenipencere { 
  var %w = 1,%wins = 1
  while ($window(%w)) {
    if (Web isin $ifmatch) { inc %wins }
    inc %w 
  }
  :winname
  var %window = $+(@Web,%wins)
  if ($window(%window)) { inc %wins | goto winname }
  return %window
}
