mircscripting.info Forum Index mircscripting.info
#mIRCscripting Forum
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

DCX Channel Information Popup

 
Post new topic   Reply to topic    mircscripting.info Forum Index -> Snippets
View previous topic :: View next topic  
Author Message
Ook
Major


Joined: 01 May 2004
Posts: 80

PostPosted: Sun Mar 26, 2006 5:14 pm    Post subject: DCX Channel Information Popup Reply with quote

Code:

;
; Channel Information window V1.3 By Ook
;
; Requires:
;   mIRC V6.16+
;   dcx.dll
;   dcx_tools.mrc already loaded.
;
; Usage:
;   Enable in the channel menu then hold the mouse pointer at the top of the channel text area.
;   A dialog will appear it shows the channel topic with colours etc.. (readonly) & allows you to change some channel modes.
;
; $1 = window name
alias -l open_chaninfo {
  if (!$chan($1)) { echo 4 -as [ERROR] Unknown Channel: $1 [open_chaninfo] | halt }
  if ($dialog($+(chaninfo_,$1))) return
  clean_chaninfo
  dialog -m $+(chaninfo_,$1) chaninfo
  .timerchaninfo -oi 0 1 check_chaninfo
  set $+(%,chaninfo_,$1) 1
}
alias -l close_chaninfo {
  if ($dialog($+(chaninfo_,$1))) dialog -x $v1
  clean_chaninfo
  unset $+(%,chaninfo_,$1)
}
alias -l clean_chaninfo {
  ; cleanup old dialogs
  var %cnt = 1
  while ($dialog(%cnt) != $null) {
    if (chaninfo_* iswm $v1) {
      var %w = $gettok($v2,2-,95)
      if ($chan(%w) == $null) close_chaninfo %w
    }
    inc %cnt
  }
}
alias -l show_chaninfo {
  clean_chaninfo
  if ($dialog($+(chaninfo_,$1))) {
    var %d = $v1, %w = $1
    dialog -s %d $calc($window(%w).dx + 5) $calc($window(%w).dy +24) $calc($window(%w).dw -6) 80
    xdialog -a %d +v 200
    xdid -r %d 2
    xdid -a %d 2 $chan(%w).topic
    var %m = $gettok($chan(%w).mode,1,32)
    if (t isincs %m) xdid -c %d 4
    else xdid -u %d 4
    if (n isincs %m) xdid -c %d 5
    else xdid -u %d 5
    if (m isincs %m) xdid -c %d 6
    else xdid -u %d 6
    if (i isincs %m) xdid -c %d 7
    else xdid -u %d 7
    if (s isincs %m) xdid -c %d 8
    else xdid -u %d 8
    if (p isincs %m) xdid -c %d 9
    else xdid -u %d 9
    xdialog -l %d update
  }
}
alias -l hide_chaninfo {
  if ($dialog($+(chaninfo_,$1))) xdialog -h $v1
}
alias check_chaninfo {
  ; check mIRC is active app
  if (!$appactive) return
  ; check active window has chaninfo dialog.
  var %d = $+(chaninfo_,$active)
  if ($dialog(%d) == $null) return
  ; check if mouse is in activate area
  if ($inrect($mouse.dx,$mouse.dy,$window($active).dx,$calc($window($active).dy +20),$window($active).dw,10)) show_chaninfo $active
  elseif (!$inrect($mouse.dx,$mouse.dy,$dialog(%d).x,$dialog(%d).y,$dialog(%d).w,$dialog(%d).h)) hide_chaninfo $active
}
alias _chaninfo_callback {
  if ($2 == sclick) {
    if ($3 !isnum 4-9) return
    if ($xdid($1,$3).state) var %s = +
    else var %s = -
    if ($me isop $gettok($1,2-,95)) mode $v2 $+(%s,$gettok(x x x t n m i s p,$3,32))
  }
}
alias -l update_afterinit {
  ; update CLA after init, update must be before hide
  xdialog -l $1 update
  ; hide dialog
  xdialog -h $1
}
on *:dialog:chaninfo_*:init:0:{
  ; mark dialog for dcx
  dcx Mark $dname _chaninfo_callback
  ; set dialog as borderless
  xdialog -b $dname +
  ; set dialog background colour
  xdialog -g $dname +b $rgb(210,210,210)
  ; get window name that this dialog is for
  var %w = $gettok($dname,2-,95)
  ; size dialog for window dimensions
  dialog -s $dname $calc($window(%w).dx + 5) $calc($window(%w).dy +24) $calc($window(%w).dw -6) 80
  ; unused box on left
  xdialog -c $dname 1 box 0 0 100 100
  ; topic
  xdialog -c $dname 2 richedit 100 0 100 100 center multi readonly
  ; modes box on right
  xdialog -c $dname 3 box 200 0 100 100
  ; +t
  xdid -c $dname 3 4 check 10 10 50 11
  xdid -t $dname 4 +t
  ; +n
  xdid -c $dname 3 5 check 10 22 50 11
  xdid -t $dname 5 +n
  ; +m
  xdid -c $dname 3 6 check 10 34 50 11
  xdid -t $dname 6 +m
  ; +i
  xdid -c $dname 3 7 check 10 46 50 11
  xdid -t $dname 7 +i
  ; +s
  xdid -c $dname 3 8 check 10 58 50 11
  xdid -t $dname 8 +s
  ; +p
  xdid -c $dname 3 9 check 10 70 50 11
  xdid -t $dname 9 +p
  ; setup CLA
  xdialog -l $dname root $chr(9) +ph 0 0 0 0
  xdialog -l $dname cell root $chr(9) +il 1 1 0 0
  xdialog -l $dname cell root $chr(9) +il 2 3 0 0
  xdialog -l $dname cell root $chr(9) +li 3 1 0 0
  ; setup modes box CLA
  xdid -l $dname 3 root $chr(9) +pv 0 0 0 0
  xdid -l $dname 3 space root $chr(9) + 5 5 5 5
  xdid -l $dname 3 cell root $chr(9) +il 4 1 0 0
  xdid -l $dname 3 cell root $chr(9) +il 5 1 0 0
  xdid -l $dname 3 cell root $chr(9) +il 6 1 0 0
  xdid -l $dname 3 cell root $chr(9) +il 7 1 0 0
  xdid -l $dname 3 cell root $chr(9) +il 8 1 0 0
  xdid -l $dname 3 cell root $chr(9) +il 9 1 0 0
  ; do dialog update after init event
  .timer 1 0 update_afterinit $dname
}
; channel menu to enable/disable the dialog
menu channel {
  $iif($dialog($+(chaninfo_,$chan)),$style(1)) Chaninfo: $+($iif($dialog($+(chaninfo_,$chan)),close,open),_chaninfo) $chan
}
; the dialog table for dcx
dialog -l chaninfo {
  title ""
  option pixel
  size -1 -1 300 100
}
; join event enables the dialog for you
on me:*:join:#: if (%chaninfo_ [ $+ [ $chan ] ]) open_chaninfo $chan
; hide dialog if the active window changes
on *:active:*: hide_chaninfo $lactive
; unload event clean's up everything
on *:unload: {
  .timerchaninfo off
  var %cnt = 1
  while ($dialog(%cnt) != $null) {
    if (chaninfo_* iswm $v1) close_chaninfo $gettok($v2,2-,95)
    inc %cnt
  }
}


edit: fixed $gettok(..,2,95) should have been $gettok(..,2-,95)
edit: fixed x bounds check
Back to top
View user's profile Send private message
XploreR
Major


Joined: 28 Dec 2007
Posts: 53
Location: Behind you!!!

PostPosted: Thu Apr 13, 2017 12:20 am    Post subject: Reply with quote

i am not sure i understand this: then hold the mouse pointer at the top of the channel text area.

what text area?
_________________
Simple Things Are allways better!
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    mircscripting.info Forum Index -> Snippets All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group