DCX Switchbar

By BigSteve on Sep 29, 2011

DCX switchbar
Image
TIS ON THE LEFT -.-

;--[Startup event]
on *:START: { startassassin }
;--[Aliases]--
alias startassassin { switch }
;--[dialog control]
alias switch {
  if ($dialog(SwitchBar)) { dialog -x SwitchBar }
  dialog -m SwitchBar SwitchBar
}

;--[Switchbar]
alias -l xSwitch {
  if (%New. [ $+ [ $+($scon($1),$active) ] ] == On) { xdid -v SwitchBar 1 $xdid(SwitchBar,1,$+($chr(9),$2,$chr(9)),$1).find $chr(9) ( $+ $2 $+ ) }
  else { xdid -v SwitchBar 1 $xdid(SwitchBar,1,$+($chr(9),$2,$chr(9)),$1).find $chr(9) $2 }
}
alias -l eSwitch {
  if ($scon($1).server) { xdid -v SwitchBar 1 $xdid(SwitchBar,1,$+($chr(9),*,$chr(9)),W,$calc($1 + 1)).find $chr(9) $scon($1).server }
  elseif (!$scon($1).server) { xdid -v SwitchBar 1 $xdid(SwitchBar,1,$+($chr(9),*,$chr(9)),W,$calc($1 + 1)).find $chr(9) (Not Connected) }
}
alias iSwitch {
  xdid -r SwitchBar 1
  xdid -w SwitchBar 1 +n 0 icons/10.ico
  xdid -w SwitchBar 1 +n 0 icons/22.ico
  xdid -w SwitchBar 1 +n 0 icons/adminprotection.ico
  xdid -w SwitchBar 1 +n 0 icons/15.ico
  xdid -w SwitchBar 1 +n 0 icons/14.ico
  xdid -w SwitchBar 1 +n 0 icons/10.ico
  xdid -w SwitchBar 1 +n 0 icons/14.ico
  var %scid = 1
  while (%scid <= $scon(0)) {
    scon %scid
    if (!$server) { xdid -a SwitchBar 1 %scid $chr(9) +ceb 3 3 0 0 0 $color(4) $color(1) [Not Connected] $chr(9) This server is NOT connected. }
    elseif ($server) { xdid -a SwitchBar 1 %scid $chr(9) +ceb 2 2 0 0 0 $color(9) $color(1) $server $chr(9) Server - $server $chr(124) Connected at - $time(ddd hh:nn:ss tt)
      xdid -a SwitchBar 1 %scid 1 $chr(9) +ce 1 1 0 0 0 $color(7) $color(1) Channels ( $+ $chan(0) $+ )
      var %c = 1
      while (%c <= $chan(0)) {
        xdid -a SwitchBar 1 %scid 1 -1 $chr(9) +ce $iif(%New. [ $+ [ $+($server,$chan(%c)) ] ],6 6,5 5) 0 0 0 $color(4) $color(1) $iif(%New. [ $+ [ $+($server,$chan(%c)) ] ] == On,$+($chr(40),$chan(%c),$chr(41)),$chan(%c)) $chr(9) $chan(%c) - $iif(%New. [ $+ [ $+($server,$chan(%c)) ] ] == On,New Message,No new messages)
        inc %c
      }
      xdid -a SwitchBar 1 %scid 2 $chr(9) +ce 4 4 0 0 0 $color(7) $color(1) QUERY ( $+ $query(0) $+ )
      var %q = 1
      while (%q <= $query(0)) {
        xdid -a SwitchBar 1 %scid 2 -1 $chr(9) +ce $iif(%New. [ $+ [ $+($server,$query(%q)) ] ],4 4,1 1) 0 0 0 $color(4) $color(1) $iif(%New. [ $+ [ $+($server,$query(%q)) ] ] == On,$+($chr(40),$query(%q),$chr(41)),$query(%q)) $chr(9) $query(%q) - $iif(%New. [ $+ [ $+($server,$query(%q)) ] ] == On,New Message,No new messages)
        inc %q
      }
    }
    inc %scid
  }
  var %next = $calc(%scid + 1)
  ; echo -ag %next
  xdid -a SwitchBar 1 %next $chr(9) +ceb 4 4 0 0 0 $color(9) $color(1) Replacers $chr(9) Replacers [Dominate]
  xdid -a SwitchBar 1 %next $chr(9) +ceb 5 5 0 0 0 $color(4) $color(1) Windows ( $+ $window(0) $+ )
  var %win = $window(0)
  var %w = 1
  while (%w <= %win) {
    xdid -a SwitchBar 1 %next 1 $chr(9) +ce 5 5 0 0 0 $color(4) $color(1) $window(%w)
    inc %w
  }

}    

;--[DCX callback aliases]
alias DCX_switch { 
  if ($2 = mouse) { halt }
  var %command = $2
  ;  echo -ag First > $1-
  tokenize 32 $4-
  if (%command = sclick) {
    set %target $remove($xdid(SwitchBar,1).seltext,$chr(40),$chr(41))
    if (%target == Replacers) { window -a @Replacers | halt }
    ;   echo -sg %target > $1-
    if (@* iswm %target) { window -a $window($2) | halt }
    scon $1
    if ($2 == 1) && (!$3) { list }
    elseif (#* iswm %target) { window -a %target }
    elseif ($query($3)) { window -a $query($3) }
    elseif (!$2) { window -a "Status Window" }
  }
}

;--[Switchbar]
dialog SwitchBar {
  title "switchbar"
  size -1 -1 140 422
  option pixels
}

;--[Dialog Events]--
;--[Switchbar]
on *:dialog:SwitchBar:init:*: {
  dcx Mark $dname DCX_Switch
  xdialog -q $dname +r cross
  xdialog -c $dname 1 treeview 0 0 145 1100 haslines showsel
  xdid -i $dname 1 +b $color(1)
  xdid -i $dname 1 +l $color(4)
  .timer 1 0 xdock -m $dialog($dname).hwnd +l
  .timer 1 0 iSwitch
}
on *:ACTIVE:*: { set %New. [ $+ [ $+($server,$active) ] ] Off | iSwitch }
on *:TEXT:*:#: {
  if ($active == $chan) { halt }
  elseif (%New. [ $+ [ $+($server,$chan) ] ] !== On) { set %New. [ $+ [ $+($server,$chan) ] ] On | iSwitch }
}
on *:TEXT:*:?: {
  if ($active == $nick) { halt }
  elseif (%New. [ $+ [ $+($server,$nick) ] ] !== On) { set %New. [ $+ [ $+($server,$nick) ] ] On | iSwitch }
}
on *:ACTION:*:#: {
  if ($active == $chan) { halt }
  elseif (%New. [ $+ [ $+($server,$chan) ] ] !== On) { set %New. [ $+ [ $+($server,$chan) ] ] On | iSwitch }
}
on *:ACTION:*:?: {
  if ($active == $nick) { halt }
  elseif (%New. [ $+ [ $+($server,$nick) ] ] !== Yes) { set %New. [ $+ [ $+($server,$nick) ] ] On | iSwitch }
}
on *:CONNECT: { iSwitch }
on *:DISCONNECT: { iSwitch }
on *:RAWMODE: {
  if ($active == $chan) { halt }
  elseif (%New. [ $+ [ $+($server,$chan) ] ] !== On) { set %New. [ $+ [ $+($server,$chan) ] ] On | iSwitch }
}
on *:OPEN:?: { set %New. [ $+ [ $+($server,$nick) ] ] On | iSwitch }
on *:OPEN:#: { set %New. [ $+ [ $+($server,$chan) ] ] On | iSwitch }

Comments

Sign in to comment.
BigSteve   -  Mar 16, 2012

hmmm tell you what Im trying to add now is the scollbar encase your on more than one server with lots of rooms it kinda fails :-/, so I need to work out the code for adding a scollbar to the code

 Respond  
Lucius   -  Oct 15, 2011

/me slaps forehead "ofc"

 Respond  
BigSteve   -  Oct 13, 2011

to close rooms using the switch bar lol simple really

 Respond  
Lucius   -  Oct 13, 2011

for dcx... treebars? hmm a little checking gave me:

if ($2 == rclick) && ($3 == 1)  { 
  ;example
  if ($left($xdid(SwitchBar, 1, $4-).tvtext == $chr(35)) { hop $xdid(SwitchBar, 1, $4-).tvtext }
}

That theoretically would let you hop a channel on rightclick. Don't know that without testing it myself, but should be easy enough. if you use word matches in it too (other than the simple # I put) then you could make the right click content based.

I suppose you could even have a right click list if you have the skills with dcx xpopup to do it, then you could choose an action rather than a simple right click action. I can't see any real reason you'd need it other than the server window having a disconnect/reconnect option.

 Respond  
BigSteve   -  Oct 13, 2011

no see this would be good with right click function but I cant work out the code for it lol any one got any ideas?

 Respond  
irchainscriptz   -  Oct 01, 2011

Well would be nice if there was icons & the Dll with it , mind you the DLL is easy to get, so are the icons if you choose to add your own style. But yes would be great to see a screenshot of the switchbar!!

 Respond  
Lucius   -  Oct 01, 2011

I second the request for an image too.

 Respond  
Frenetic   -  Sep 30, 2011

You should include a download link to the icons and the dll file required to use this. Jus' saying.

 Respond  
xdesoto   -  Sep 29, 2011

Also, you should add a image.

 Respond  
extremity   -  Sep 29, 2011

which icons are meant to represent what? For example, is 10 a normal room icon, is 22 an active channel icon, etc?

 Respond  
Jethro   -  Sep 29, 2011

You didn't mention you need dcx.dll in your mirc directory to accompany the code.

 Respond  
Savage_CL   -  Sep 29, 2011

What does it do?

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.