Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; --- upp 2
- ; --- file themes
- ; --- type module
- ; --- info description=enable theme support|version=1.0.0.3|rank=7|libraries=theme|modules=control,themes_dlg,importer2|hidden=0
- ; --- load dependencies
- on *:load:{
- fixdatas
- rebuilddata
- setgroups
- setfonts
- loadmodule themes_dlg,importer2
- }
- on *:signal:rebuild:{
- ; $?1 = afterupdate|outdated
- rebuilddata $1
- if ($1 == outdated) { cttall }
- }
- alias -l rebuilddata {
- ; $?1 = afterupdate|outdated
- .timerthemeload -io 1 0 checknothemeunload $1
- }
- alias checknothemeunload {
- ; $?1 = afterupdate|outdated
- if ($ismodule(nothemes)) {
- dbout unloading nothemes from themes
- .unload -rs $quo($module2file(nothemes))
- }
- if ($1 == afterupdate) {
- .loadtheme $deftheme
- }
- else {
- loadtheme $deftheme
- }
- }
- alias cttall {
- ; !$1-
- dbout updated version detected, updating custom themes...
- var %dir = $+($mircdir,system\themes\)
- $null($findfile(%dir,*.upp,0,0,ctt_check $1-))
- }
- alias -l ctt_check {
- ; $1- = filename
- if (($isfile($1-)) && (!$isdefaulttheme($1-))) {
- $converttheme($1-)
- }
- }
- alias setfonts {
- setfont channel fchannel
- setfont query fquery
- setfont status fstatus
- }
- alias -l setfont {
- ; $1 = friendlyname, $2 = mircininame
- var %font = $readini($mircini,n,fonts,$2)
- $inf(font,$1,$gettok(%font,1,44)).set
- $inf(font,$+($1,.,size),$iif(($gettok(%font,2,44) isnum),$fontsize($v1).towindows)).set
- }
- alias deftheme {
- if ($istheme($inf(theme,lasttheme))) { return $inf(theme,lasttheme) }
- return $const(default,theme)
- }
- ; --- unload clean
- on *:unload:{
- closedialogs themes
- unloadlib theme
- unloadmodule themes_dlg
- .timerthemeload -io 1 0 loadmodule nothemes
- }
- ; --- groups
- on *:signal:setgroups:{
- setgroups
- }
- alias -l setgroups {
- setthemeprefixgroups
- setthemeprefixnicklistgroups
- setgroup themes_echodcctransfers $inf(theme,echodccs)
- setgroup themes_nomircdccs $inf(theme,nomircdccs)
- setgroup themes_hiding $inf(themehiding,on)
- }
- alias -l setthemeprefixgroups {
- if ($inf(prefix,on)) {
- if ($inf(theme,msgnickcolors)) {
- setgroup themes_prefix 0
- setgroup themes_prefix_color 1
- }
- else {
- setgroup themes_prefix 1
- setgroup themes_prefix_color 0
- }
- }
- else {
- setgroup themes_prefix 0
- setgroup themes_prefix_color 0
- }
- }
- alias -l setthemeprefixnicklistgroups {
- if ($inf(prefix,nicklist)) {
- setgroup themes_prefix_nicklist 1
- setgroup themes_prefix_custom 0
- }
- else {
- setgroup themes_prefix_nicklist 0
- setgroup themes_prefix_custom 1
- }
- }
- ; --- register toggles
- on *:signal:set.prefix.on:{ setthemeprefixgroups }
- on *:signal:set.prefix.nicklist:{ setthemeprefixnicklistgroups }
- on *:signal:set.theme.msgnickcolors:{ setthemeprefixgroups }
- on *:signal:set.theme.echodccs:{ setgroup themes_echodcctransfers $1 }
- on *:signal:set.theme.nomircdccs:{ setgroup themes_nomircdccs $1 }
- on *:signal:set.themehiding.on:{ setgroup themes_hiding $1 }
- ; --- feedback signals
- on *:signal:makechn:{
- $$1- themehiding -1 themehiding on theme engine event hiding
- }
- ; --- hashcache
- on *:signal:hashcache:{
- fixdatas
- }
- alias -l fixdatas {
- fixdata txt prefix q
- fixdata txt prefix a
- fixdata txt prefix o
- fixdata txt prefix h
- fixdata txt prefix v
- fixdata reg theme noclones
- fixdata reg theme notice.activeonly
- fixdata reg theme notice.notinactive
- fixdata reg theme notice.channelonly
- fixdata reg theme opsnotice.channelonly
- fixdata reg themehiding join
- fixdata reg themehiding part
- fixdata reg themehiding quit
- }
- ; --- on start
- on *:start:{
- savetheme
- }
- alias -l savetheme {
- if (($islib(theme)) && ($istheme($theme.name))) {
- $inf(theme,lasttheme,$theme.name).set
- }
- }
- ; --- channel status nick prefixes
- #themes_prefix_color off
- alias prefnonick {
- ; $1 = nick, $2 = chan
- if ($prefix2mode($left($nick($2,$1).pnick,1))) {
- return $+($chr(3),$nick($2,$1).color,$v1)
- }
- return $+($chr(3),$nick($2,$1).color)
- }
- #themes_prefix_color end
- #themes_prefix on
- alias prefnonick {
- ; $1 = nick, $2 = chan
- if ($prefix2mode($left($nick($2,$1).pnick,1))) {
- return $v1
- }
- }
- #themes_prefix end
- #themes_prefix_nicklist on
- alias prefix2mode {
- if ($1 isin $prefix) {
- return $1
- }
- }
- #themes_prefix_nicklist end
- #themes_prefix_custom off
- alias prefix2mode {
- if ($pos(-+%@!&*.~,$1) isnum 1-) { return $data(txt,prefix,$mid(vvhoaaqqq,$v1,1)) }
- }
- #themes_prefix_custom end
- ; --- themed aliases
- alias prefnonick { }
- alias avnick { return $prefnick($nick,$chan) }
- alias c { return $+ $data(txt,color,$1) }
- alias say_noenc { if (($active == status window) || ($left($active,1) == @)) { return } | !.msg $active $1- | echo $color(own) -aqtm $mytext($prefnick($me,$active),$1-) }
- alias describe_noenc { !.describe $1- | if (!$show) { return } | if ($window($1)) { echo $color(action) -tm $1 $myaction($prefnick($me,$1),$2-) } | elseif ($left($1,1) !== $chr(61)) { echo $color(action) -atm -> * $+ $1 $+ * $2- } }
- alias msg_noenc { !.msg $1- | if (!$show) { return } | if ($window($1)) { echo $color(own) -tm $1 $mytext($prefnick($me,$1),$2-) } | elseif ($left($1,1) !== $chr(61)) { echo $color(own) -atm -> * $+ $1 $+ * $2- } | checklistsignal $1- }
- ; --- themed events
- on &^*:text:*:#:{
- whilefix
- tokenize 32 $fill($1-)
- if ($msgstamp > 0) { echo $color(text) -mlbf $chan $asctime($msgstamp,$timestampfmt) $nb $1- }
- else { echo $color(text) -tmlbf $chan $nb $1- }
- halt
- }
- on ^*:text:*:?:{
- whilefix
- tokenize 32 $fill($1-)
- if ($msgstamp > 0) { echo $color(text) -mlbf $nick $asctime($msgstamp,$timestampfmt) $nbc $1- }
- else { echo $color(text) -tmlbf $nick $nbc $1- }
- halt
- }
- on ^*:action:*:#:{
- whilefix
- if ($str($chr(32),2) isin $rawmsg) {
- $null($regex(cact,$rawmsg,$+($chr(1),ACTION\s(.+),$chr(1),$)))
- tokenize 32 $fillonly($regml(cact,1))
- }
- if ($msgstamp > 0) { echo $color(action) -mlbf $chan $asctime($msgstamp,$timestampfmt) $chanaction($1-) }
- else { echo $color(action) -tmlbf $chan $chanaction($1-) }
- halt
- }
- on ^*:action:*:?:{
- whilefix
- if ($str($chr(32),2) isin $rawmsg) {
- $null($regex(pact,$rawmsg,$+($chr(1),ACTION\s(.+),$chr(1),$)))
- tokenize 32 $fillonly($regml(pact,1))
- }
- if ($msgstamp > 0) { echo $color(action) -mlbf $nick $asctime($msgstamp,$timestampfmt) $privaction($1-) }
- else { echo $color(action) -tmlbf $nick $privaction($1-) }
- halt
- }
- on ^*:chat:action *:{
- if ($str($chr(32),2) isin $rawmsg) {
- $null($regex(dact,$rawmsg,$+($chr(1),ACTION\s(.+),$chr(1),$)))
- tokenize 32 $fillonly($regml(dact,1))
- }
- else {
- tokenize 32 $gettok($2-,1-,1)
- }
- echo $color(action) -tmlbf =$nick $chataction($1-)
- halt
- }
- on ^*:chat:*:{ tokenize 32 $fillchat($1-) | echo $color(text) -tmlbf =$nick $nbc $1- | halt }
- on me:^*:join:#:{ whilefix | echo $chan $rc(onjoin,self) | halt }
- #themes_hiding off
- on !^*:join:#:{
- whilefix
- $checkforfloods
- if ((!$data(reg,themehiding,join)) || (!$chn(themehiding).getsafe)) {
- echo $color(join) -t $chan $chanjoin $clonechk $userstatsinfoline($nick,$wildsite)
- }
- halt
- }
- on !^*:part:#:{
- whilefix
- if ((!$data(reg,themehiding,part)) || (!$chn(themehiding).getsafe)) {
- if ($fill($1-) !== $null) { tokenize 32 $+($v1,$chr(15)) }
- else { tokenize 32 }
- echo $color(part) -t $chan $chanpart($1-)
- }
- halt
- }
- on ^*:quit:{
- whilefix
- if ($fill($1-) !== $null) { tokenize 32 $+($v1,$chr(15)) }
- else { tokenize 32 }
- if (!$data(reg,themehiding,quit)) { themeechoquits $1- | halt }
- var %c,%o = $comchan($nick,0)
- if ($query($nick)) { .signal echo -t $v1 $tag $cborder($nick) has quit irc $iif(($1- !== $null),$cbrack($v1)) }
- while (%o) {
- whilefix
- %c = $comchan($nick,%o)
- if (!$chns($cid,%c,themehiding).getsafe) { echo $color(quit) -t %c $chanquit($prefnick($nick,%c),$1-) }
- dec %o
- }
- halt
- }
- #themes_hiding end
- on !^*:join:#:{
- whilefix
- $checkforfloods
- echo $color(join) -t $chan $chanjoin $clonechk $userstatsinfoline($nick,$wildsite)
- halt
- }
- on !^*:part:#:{
- whilefix
- if ($fill($1-) !== $null) { tokenize 32 $+($v1,$chr(15)) }
- else { tokenize 32 }
- echo $color(part) -t $chan $chanpart($1-)
- halt
- }
- on ^*:quit:{
- whilefix
- if ($fill($1-) !== $null) { tokenize 32 $+($v1,$chr(15)) }
- else { tokenize 32 }
- themeechoquits $1-
- halt
- }
- alias -l themeechoquits {
- var %c,%o = $comchan($nick,0)
- if ($query($nick)) { .signal echo -t $v1 $tag $cborder($nick) has quit irc $iif(($1- !== $null),$cbrack($v1)) }
- while (%o) {
- whilefix
- %c = $comchan($nick,%o)
- echo $color(quit) -t %c $chanquit($prefnick($nick,%c),$1-)
- dec %o
- }
- }
- alias -l clonechk {
- if ($data(reg,theme,noclones)) { return }
- tokenize 32 $ialchan($wildsite,$chan,0)
- if ($1 <= 1) { return }
- var %t,%m,%k,%o = $1 | while (%o) {
- whilefix
- if ($ialchan($wildsite,$chan,%o).nick !== $nick) {
- %t = $prefnick($v1,$chan) $+ &
- inc %m $calc(1 + $len(%t))
- if (%m > 600) { %k = %k ... | break }
- %k = %k %t
- }
- dec %o
- }
- return $channelclone($1,$gettok(%k,1-,38))
- }
- alias -l userstatsinfoline {
- ; $1 = nick, $2 = wildsite
- if ($data(reg,userstats,on)) {
- var %msg
- if (($data(reg,userstats,showlines)) && ($dat(user,$+($getnet,.,$1)).exists)) { %msg = $sv(lines,$dat(user,$+($getnet,.,$1)).linesspoken) }
- if ($data(reg,userstats,showclass)) { %msg = %msg $sv(class,$remtok($hget(wild,$2),$1,1,32)) }
- return %msg
- }
- }
- alias -l sv { if ($2) { return $1 $+ : $+ $border($2-) } }
- on !^*:nick:{
- whilefix
- var %o = $comchan($newnick,0) | while (%o) {
- whilefix
- tokenize 32 $comchan($newnick,%o) $prefnonick($newnick,$comchan($newnick,%o))
- echo $color(nick) -t $1 $channickchange($+($2,$nick,),$+($2,$newnick,))
- dec %o
- }
- halt
- }
- on ^*:nick:{ whilefix | allecho $color(nick) -t $mynickchange | halt }
- alias -l allecho {
- var %o = $chan(0)
- while (%o) { whilefix | echo $1-2 $chan(%o) $3- | dec %o }
- echo $1-2 $+ s $3-
- if (($cid == $activecid) && ($active !ischan) && ($active !== status window)) {
- echo $1-2 $+ a $3-
- }
- }
- on ^*:usermode:{ whilefix | acecho $mymodechange($1-) | halt }
- on ^*:rawmode:#:{ whilefix | echo $color(mode) -t $chan $chanmodechange($avnick,$1,$2-) | halt }
- on &^*:invite:#:{
- whilefix
- if ($cid !== $activecid) { echo $color(invite) -atm $privinvite($+($shortservname,$nick),$1-) }
- else { echo $color(invite) -atm $privinvite($nick,$1-) }
- halt
- }
- on ^*:topic:#:{ whilefix | tokenize 32 $fill($1-) | echo $color(topic) -t $chan $chantopic($avnick,$+($chr(15),$1-,$chr(15))) | halt }
- on ^*:kick:#:{
- whilefix
- if ($fill($1-) !== $null) { tokenize 32 $+($v1,$chr(15)) }
- else { tokenize 32 }
- if ($knick == $me) {
- echo $color(kick) -t $chan $activechankickme($1-)
- if (($cid !== $activecid) || ($chan !== $active)) { asecho $chankickme($1-) }
- }
- else { echo $color(kick) -t $chan $chankick($avnick,$prefnick($knick,$chan),$1-) }
- halt
- }
- on ^*:notice:*:#:{
- whilefix
- tokenize 32 $fill($1-)
- if ((($chan !== $active) || ($activecid !== $cid)) && (!$data(reg,theme,notice.channelonly)) && (($target !== $+(@,$chan)) || (!$data(reg,theme,opsnotice.channelonly)))) {
- if ($cid !== $activecid) { echo $color(notice) -atm $channotice($+($shortservname,$avnick),$1-) }
- else { echo $color(notice) -atm $channotice($avnick,$1-) }
- }
- echo $color(notice) -tm $chan $channotice($avnick,$1-)
- halt
- }
- on &^*:notice:*:?:{
- whilefix
- tokenize 32 $fill($1-)
- if (!$data(reg,theme,notice.activeonly)) {
- var %o = $comchan($nick,0) | while (%o) {
- whilefix
- echo $color(notice) -tm $comchan($nick,%o) $privnotice($prefnick($nick,$comchan($nick,%o)),$1-)
- dec %o
- }
- }
- if (($nick !ison $active) || ($activecid !== $cid) || ($data(reg,theme,notice.activeonly))) {
- if ($data(reg,theme,notice.notinactive)) { echo $color(notice) -stm $privnotice($nick,$1-) }
- elseif ($cid !== $activecid) { echo $color(notice) -atm $privnotice($+($shortservname,$nick),$1-) }
- elseif ($nick ison $active) { echo $color(notice) -atm $privnotice($prefnick($nick,$active),$1-) }
- else { echo $color(notice) -atm $privnotice($nick,$1-) }
- }
- halt
- }
- ctcp &^*:xdcc *:?:{ whilefix | if ((!$inf(xdcc,on)) || (!$inf(xdcc,hidectcp))) { privctcpecho $1- } | halt }
- alias -l privctcpecho {
- ; $1- = ctcp
- if ($gettok($fill($1-),1-,1) !== motfv) { tokenize 32 $v1 }
- else { tokenize 32 VERSION }
- if ($inf(theme,ctcp.instatus)) { echo $color(ctcp) -stm $privctcp($nick,$1,$2-) }
- elseif ($cid !== $activecid) { echo $color(ctcp) -atm $privctcp($+($shortservname,$nick),$1,$2-) }
- else { echo $color(ctcp) -atm $privctcp($nick,$1,$2-) }
- }
- ctcp &^*:page *:?:{ whilefix | if (!$inf(pager,enabled)) { privctcpecho $1- } | halt }
- ctcp &^*:ping *:?:{ whilefix | if ($inf(ignore,ping) == all) { halt } | privctcpecho $1- }
- ctcp &^*:dcc *:?:{ whilefix }
- ctcp &^*:version:*:{ whilefix | halt }
- ctcp &^*:*:?:{ whilefix | privctcpecho $1- | halt }
- ctcp ^*:*:#:{
- whilefix
- if ($gettok($fill($1-),1-,1) !== motfv) { tokenize 32 $v1 }
- else { tokenize 32 VERSION }
- if ($inf(theme,ctcp.instatus)) { echo $color(ctcp) -stm $chanctcp($avnick,$1,$2-) }
- else {
- echo $color(ctcp) -tm $chan $chanctcp($avnick,$1,$2-)
- if ($cid !== $activecid) { echo $color(ctcp) -atm $chanctcp($+($shortservname,$avnick),$1,$2-) }
- elseif ($chan !== $active) { echo $color(ctcp) -atm $chanctcp($avnick,$1,$2-) }
- }
- halt
- }
- on &*:ctcpreply:*:{
- whilefix
- tokenize 32 $gettok($fill($1-),1-,1)
- if ($cid !== $activecid) { echo $color(ctcp) -atm $privctcpreply($+($shortservname,$nick),$1,$2-) }
- else { echo $color(ctcp) -atm $privctcpreply($nick,$1,$2-) }
- halt
- }
- on ^*:snotice:*:{
- whilefix
- if ($notarealservernotice) {
- tokenize 32 $fill($1-)
- if ($cid !== $activecid) { echo $color(notice) -atm $privnotice($+($shortservname,$gettok($nick,1,46)),$1-) }
- else { echo $color(notice) -atm $privnotice($gettok($nick,1,46),$1-) }
- halt
- }
- }
- on *:input:status window:{ whilefix }
- on *:input:@:{ whilefix }
- on &*:input:*:{
- whilefix
- if ($1- == $null) { if (!$inpaste) { return } | tokenize 32 $chr(160) }
- if (($left($1,1) !== /) || ($inpaste) || ($mouse.key & 2)) { haltdef | say $1- }
- elseif (($1 == /me) && ($2- !== $null)) { haltdef | describe $target $2- }
- }
- on *:disconnect:{ whilefix | if ($timeonline) { disconnectlogo } }
- alias -l disconnectlogo {
- if ($cid == $activecid) { aecho $logo }
- else {
- secho $logo
- if ($inf(theme,ondisconnect)) {
- aecho $csv($rc(onconnect,disconnected),$servname)
- }
- }
- }
- ; --- dcc transfer notification
- #themes_echodcctransfers on
- on *:signal:filercvd:{
- ; $1 = nick, $!2 = ip, $3 = cps, $4 = secs, $5 = size, $6- = filename
- aecho successfully received $cborder($nopath($6-)) $cbrack($size($5)) from $1 at $cborder($size($3) $+ /s) $csv(in,$hourtime($4)) $safeid(openlastreceivedmessage)
- }
- on *:signal:getfail:{
- ; $1 = nick, $!2 = ip, $3 = pct, $4 = secs, $5 = size, $6- = filename
- error failed to receive $cborder($nopath($6-)) $brack($size($5)) from $1 at $cborder($3 $+ $chr(37)) $csv(after,$hourtime($4))
- }
- on *:signal:filesent:{
- ; $1 = nick, $!2 = ip, $3 = cps, $4 = secs, $5 = size, $!6 = wid, $7 = exists, $8- = filename
- $iif(($7),secho,aecho) successfully sent $cborder($nopath($8-)) $brack($size($5)) to $1 at $cborder($size($3) $+ /s) $csv(in,$hourtime($4))
- }
- on *:signal:sendfail:{
- ; $1 = nick, $!2 = ip, $3 = pct, $4 = secs, $5 = size, $!6 = wid, $7 = exists, $!8 = bytessent, $9- = filename
- $iif(($7),statuserror,error) failed to send $cborder($nopath($9-)) $brack($size($5)) to $1 at $cborder($3 $+ $chr(37)) $csv(after,$hourtime($4))
- }
- #themes_echodcctransfers end
- ; --- no mirc dcc transfer echo messages
- #themes_nomircdccs off
- on ^*:filercvd:*:{
- whilefix
- haltdef
- }
- on ^*:getfail:*:{
- whilefix
- haltdef
- }
- on ^*:filesent:*:{
- whilefix
- haltdef
- }
- on ^*:sendfail:*:{
- whilefix
- haltdef
- }
- #themes_nomircdccs end
- ; --- global theme aliases
- alias themefile { return $+($themedir,$1-,.upp) }
- alias istheme { if ($1- !== $null) { return $isfile($themefile($v1)) } }
- alias themedir { return $path(directories,themes) }
- alias themepicdir { return $path(directories,themepics) }
- alias namedtheme { if ($left($theme.name,8) !== default_) { return $theme.name } }
- alias themednotifylistprops { return background,textcolor,textbg,caption,position }
- alias themedcontrolpanelprops { return background,textcolor,textbg,caption,position,flags,headerdims,iconview,icp }
- alias themedbackgrounds { return main,status,channel,query,menubar,menubuttons,switchbar,treebar }
- ; --- drag and drop support
- alias themesend {
- tokenize 32 $1-
- if ($left($1,1) == $chr(35)) { loadtheme $2- }
- else { $dccc(send $1 n/a $2-) }
- }
- ; --- loading themes
- alias loadtheme {
- ; $1- = themename|themefile
- tokenize 32 $1-
- if ($istheme($1-)) { tokenize 32 $themefile($1-) }
- if ((!$isfile($1-)) && (!$islib(theme))) {
- dbout cannot load theme $1-
- tokenize 32 $themefile($const(default,theme))
- }
- if ($isfile($1-)) {
- tokenize 32 $realfn($1-)
- pretheme $1-
- if ((!$istheme($noext($nopath($1-)))) || ($crc($1-) !== $crc($themefile($noext($nopath($1-)))))) { .copy -o $quo($1-) $quo($themedir) }
- var %a = $iif((!$show),.) $+ continuethemeload
- .timerloadingtheme -io 1 0 %a $uneval($1-)
- }
- elseif (!$isid) { error no such theme $quo($1-) }
- }
- alias -l pretheme {
- mkemptydir $themepicdir
- $null($unzip($1-,$themepicdir))
- }
- alias continuethemeload {
- ; $1- = themefile
- var %file = $+($themepicdir,theme.txt)
- var %themename = $noext($nopath($1-))
- if ($isfile(%file)) {
- $overwritethemename(%themename)
- .copy -o $quo(%file) $quo($+($mircdir,system\aliases\,theme.txt))
- if (!$isfile($+($mircdir,system\aliases\,theme.txt))) {
- error failed to copy themefile $quo(%file) to $quo($+($mircdir,system\aliases\,theme.txt))
- }
- else {
- $iif((!$show),.) $+ applytheme
- }
- }
- else {
- error invalid themefile found, cannot load theme $quo(%themename)
- }
- }
- alias -l overwritethemename {
- ; $1 = themename
- var %file = $+($themepicdir,theme.txt)
- $null($read(%file,ns,theme.name))
- if ($readn) {
- write -l $+ $v1 $quo(%file) theme.name $evbrack(return,$noevalsafe($1))
- }
- }
- alias isdefaulttheme {
- ; $1 = themename|themefile
- return $istok($const(list,themes),$noext($nopath($1-)),44)
- }
- alias applytheme {
- if ($1- !== -n) {
- tokenize 32 -n
- if ($islib(theme)) { .reload -a $quo($v1) }
- else { .timer -io 1 1 applytheme -n | loadlib theme | return }
- }
- elseif (!$islib(theme)) { error could not load theme file $quo($lib2file(theme)) | return }
- setthemecolors $1
- setthemefonts $1
- setthemescriptcolors
- setthemestamp
- setthemeprefix
- setthemecontrolpanel
- setthemenotifylist
- setthemecontrolpanelicons
- setthemenotifylisticons
- setthemecnicks
- if ($show) { clearany }
- setthemebackgrounds
- saveini
- var %a = $iif((!$show),.) $+ themeecho
- .timerthemeecho -io 1 0 %a
- }
- alias themeecho {
- savetheme
- if ($show) { aecho $bracket(loaded theme,$theme.name) $csv(by,$theme.author) }
- .signal theme_loaded $theme.name
- }
- on *:signal:theme_loaded:{
- writeini -n $quo($mircini) colors n0 $+(mIRC Classic,$chr(44),$themed_events)
- writeini -n $quo($mircini) palettes n0 $themed_colors
- flushini $quo($mircini)
- .color -l
- setfonts
- }
- alias themed_events {
- ; !$1-
- var %k = background,action,ctcp,highlight,info,info2,invite,join,kick,mode,nick,normal,notice,notify,other,own,part,quit,topic,wallops,whois,editbox,editbox text,listbox,listbox text,gray,title,inactive,treebar,treebar text
- var %r,%i = 1,%o = $numtok(%k,44) | while (%i <= %o) {
- %r = $instok(%r,$color($gettok(%k,%i,44)),0,44)
- inc %i
- }
- return %r
- }
- alias themed_colors {
- ; !$1-
- var %r,%i = 0,%o = 15 | while (%i <= %o) {
- %r = $instok(%r,$color(%i),0,44)
- inc %i
- }
- return %r
- }
- alias deletetheme {
- ; $1- = themename|themefile
- if ($istheme($1-)) { tokenize 32 $themefile($1-) }
- var %themename = $noext($nopath($1-))
- if ($isfile($1-)) {
- if (!$isdefaulttheme($1-)) {
- if ($innput(deletetheme,%themename)) { ifsremove $1- }
- else { halt }
- }
- else { halt $innput(error,you cannot delete default themes $crlf $+ using this dialog. $crlf $crlf $+ the default themes are: $crlf $+ $replace($const(list,themes),$chr(44),$crlf)) }
- }
- else { halt $innput(error,no such theme $quo(%themename)) }
- }
- ; --- loading themes - backgrounds
- alias setthemebackgrounds {
- .signal theme.background $themedbackgrounds
- }
- on *:signal:theme.background:{
- ; $1 = backgrounds
- var %background,%i = 1,%o = $numtok($1,44) | while (%i <= %o) {
- %background = $safeid($+(background.,$gettok($1,%i,44)))
- if (%background !== $null) {
- if ($deltok($1,1- $+ %i,44) !== $null) { .signal $signal $v1 }
- _background $gettok($1,%i,44) %background
- return
- }
- inc %i
- }
- }
- ; --- loading themes - fonts
- alias -l setthemefonts {
- if ($theme.fontchannel) { .signal $1 theme.font -c $v1 }
- if ($theme.fontstatus) { .signal $1 theme.font -s $v1 }
- if ($theme.fontquery) { .signal $1 theme.font -q $v1 }
- }
- on *:signal:theme.font:{ if ($1-) { _font $v1 } }
- ; --- loading themes - cnicks
- alias -l setthemecnicks {
- var %n = $1
- if ($safeid(theme.msgnickcolors) !== $null) { $inf(theme,msgnickcolors,$v1).set }
- tokenize 32 $str($chr(32) $+ -r,$cnick(0))
- .signal %n theme.cnick $*
- if ($safeid(theme.cnicks)) { .signal %n theme.cnick $numtok($theme.cnicks,44) }
- }
- on *:signal:theme.cnick:{
- if ($1 == -r) { .cnick -r 1 }
- elseif ($1 isnum 1-) {
- .cnick $gettok($theme.cnicks,$v1,44)
- .signal $signal $calc($v1 -1)
- }
- }
- ; --- loading themes - colors
- alias -l setthemecolors {
- .color -s mirc classic
- var %n = $1
- tokenize 44 $+($theme.events,$chr(44),$theme.colors)
- .signal %n theme.color $*
- }
- on *:signal:theme.color:{ .color $1- }
- ; --- loading themes - scriptcolors
- alias -l setthemescriptcolors {
- if ($safeid(theme.color1) !== $null) { $inf(color,1,$v1).set }
- if ($safeid(theme.color2) !== $null) { $inf(color,2,$v1).set }
- }
- ; --- loading themes - timestamp
- alias -l setthemestamp {
- $inf(timestamp,on,$iif(($safeid(theme.timestamp)),1,0)).set
- var %timestampfmt = $safeid(theme.timestampfmt)
- $inf(timestamp,timestamp,$iif((%timestampfmt === $ts(2)),2,$iif((%timestampfmt === $ts(1)),1,%timestampfmt))).set
- settimestamp
- }
- ; --- loading themes - prefixes
- alias -l setthemeprefix {
- var %k = on.nicklist.v.h.o.a.q,%o = $numtok(%k,46) | while (%o) {
- setprefixsetting $gettok(%k,%o,46)
- dec %o
- }
- }
- alias -l setprefixsetting {
- ; $1 = prefixtype
- if ($safeid($+(prefix_,$1)) !== $null) { $inf(prefix,$1,$v1).set }
- }
- ; --- loading themes - controlpanel/notifylist settings
- alias -l setthemecontrolpanel {
- var %k = $themedcontrolpanelprops,%o = $numtok(%k,44) | while (%o) {
- setcontrolpanelsetting $gettok(%k,%o,44)
- dec %o
- }
- }
- alias -l setthemenotifylist {
- var %k = $themednotifylistprops,%o = $numtok(%k,44) | while (%o) {
- setnotifylistsetting $gettok(%k,%o,44)
- dec %o
- }
- }
- alias -l setnotifylistsetting {
- ; $1 = setting
- if ($safeid($+($1,.notifylist)) !== $null) { $dyn(dlg,notify,$1 $v1).set }
- }
- alias -l setcontrolpanelsetting {
- ; $1 = setting
- if ($safeid($+($1,.controlpanel)) !== $null) { $dyn(dlg,control,$1 $v1).set }
- }
- alias -l setthemecontrolpanelicons {
- var %icons = $safeid(theme.controlpanelicons),%cpitem,%o = $dat(cpitem).num | while (%o) {
- %cpitem = $dat(cpitem,%o).itemat
- if ($istok(%icons,%cpitem,44)) {
- $dat(cpitem,%cpitem,$defaultthemedicon(%cpitem)).iconset
- }
- elseif ($dat(cpitem,%cpitem).icon == $defaultthemedicon(%cpitem)) {
- $dat(cpitem,%cpitem,$defaultunthemedicon(%cpitem)).iconset
- }
- dec %o
- }
- }
- alias -l setthemenotifylisticons {
- var %icon,%icons = $safeid(theme.notifylisticons),%notifyicons = online,offline
- var %o = $numtok(%notifyicons,44) | while (%o) {
- %icon = $gettok(%notifyicons,%o,44)
- if ($istok(%icons,%icon,44)) {
- $inf(notify,$+(icon.,%icon),$defaultthemedicon(%icon)).set
- }
- elseif ($inf(notify,$+(icon.,%icon)) == $defaultthemedicon(%icon)) {
- $inf(notify,$+(icon.,%icon),$defaultnotifyicon(%icon)).set
- }
- dec %o
- }
- }
- ; --- table themes
- dialog themes {
- title "theme manager"
- size -1 -1 290 220
- option dbu
- tab "load theme", 1, 8 4 274 192
- box "available themes", 2, 16 24 94 166, tab 1
- list 3, 24 36 78 134, tab 1 sort size
- button "&load", 4, 24 172 37 12, tab 1
- button "&delete", 77, 64 172 37 12, tab 1
- box "theme details", 5, 116 24 158 166, tab 1
- text "name", 6, 124 37 33 8, tab 1 right
- edit "", 7, 160 36 106 10, tab 1 read autohs
- text "author", 8, 124 49 33 8, tab 1 right
- edit "", 9, 160 48 106 10, tab 1 read autohs
- text "created", 101, 124 61 33 8, tab 1 right
- edit "", 102, 160 60 106 10, tab 1 read autohs
- text "description", 16, 124 72 33 8, tab 1 right
- edit "", 17, 124 80 142 42, tab 1 read multi autovs
- button "&preview...", 83, 228 124 37 12, tab 1
- text "included settings:", 66, 124 132 45 8, tab 1
- check "", 10, 128 144 8 8, disable tab 1
- text "timestamp", 69, 136 144 37 8, tab 1
- check "", 14, 196 144 8 8, disable tab 1
- text "controlpanel layout", 72, 204 144 57 8, tab 1
- check "", 11, 128 152 8 8, disable tab 1
- text "nick prefixes", 70, 136 152 37 8, tab 1
- check "", 15, 196 152 8 8, disable tab 1
- text "notifylist layout", 73, 204 152 57 8, tab 1
- check "", 12, 128 160 8 8, disable tab 1
- text "script colors", 71, 136 160 37 8, tab 1
- check "", 13, 196 160 8 8, disable tab 1
- text "nicklist colors", 74, 204 160 57 8, tab 1
- text "fonts used", 67, 124 177 33 8, tab 1 right
- edit "", 68, 160 176 106 10, tab 1 read
- tab "settings", 18
- box "font settings", 19, 16 24 258 50, tab 18
- text "channel font", 20, 24 35 33 8, tab 18 right
- edit "", 21, 60 34 54 10, tab 18 autohs
- text "size", 22, 124 35 13 8, tab 18 right
- edit "", 23, 140 34 26 10, tab 18 autohs
- icon 34, 172 34 95 11, system\pics\pixel.bmp, 0, tab 18 noborder
- text "chat font", 24, 24 47 33 8, tab 18 right
- edit "", 25, 60 46 54 10, tab 18 autohs
- text "size", 26, 124 47 13 8, tab 18 right
- edit "", 27, 140 46 26 10, tab 18 autohs
- icon 32, 172 46 95 11, system\pics\pixel.bmp, 0, tab 18 noborder
- text "status font", 28, 24 59 33 8, tab 18 right
- edit "", 29, 60 58 54 10, tab 18 autohs
- text "size", 30, 124 59 13 8, tab 18 right
- edit "", 31, 140 58 26 10, tab 18 autohs
- icon 33, 172 58 95 11, system\pics\pixel.bmp, 0, tab 18 noborder
- box "channel status nickprefixes", 45, 16 76 82 114, group tab 18
- check "enable", 47, 24 88 34 8, tab 18
- radio "use default prefixes", 98, 32 101 62 8, disable tab 18
- radio "use custom:", 99, 32 113 50 8, disable tab 18
- text "+q", 78, 24 128 21 8, disable tab 18 right
- edit "", 79, 48 128 42 10, disable tab 18 autohs
- text "+a", 62, 24 139 21 8, disable tab 18 right
- edit "", 63, 48 139 42 10, disable tab 18 autohs
- text "+o", 48, 24 150 21 8, disable tab 18 right
- edit "", 49, 48 150 42 10, disable tab 18 autohs
- text "+h", 50, 24 161 21 8, disable tab 18 right
- edit "", 51, 48 161 42 10, disable tab 18 autohs
- text "+v", 53, 24 172 21 8, disable tab 18 right
- edit "", 54, 48 172 42 10, disable tab 18 autohs
- box "nick colors", 81, 104 76 170 30, tab 18
- check "color nicks in messages like nicks on the nicklist", 82, 112 88 130 8, tab 18
- box "notes on creating themes", 46, 104 108 170 82, tab 18
- text "to adjust color settings, inactive this dialog and hit alt+k", 37, 112 120 145 8, tab 18
- text "to adjust nicklist colors, inactive this dialog, hit alt+b and see the 'nick' tab", 38, 112 136 157 16, tab 18
- text "settings on this tab might be overwritten when you (re)load a theme. to safeguard your changes, click the 'theme builder' button to create a theme based on your current settings and theme.", 39, 112 160 157 28, tab 18
- tab "behaviour", 52
- box "disconnect", 55, 16 24 258 26, tab 52
- check "show 'disconnected from...' message on disconnect from a non-active server", 36, 24 36 202 8, tab 52
- box "ctcps", 61, 16 52 258 26, tab 52
- check "show ctcps in the status window (default: show ctcps in the active window)", 59, 24 64 198 8, tab 52
- box "dcc", 64, 16 80 126 34, tab 52
- check "hide upp dcc transfer echo messages", 65, 24 92 106 8, tab 52
- check "hide mirc dcc transfer echo messages", 100, 24 100 102 8, tab 52
- box "join", 75, 148 80 126 34, tab 52
- check "do not show clones in join message", 76, 156 92 102 8, tab 52
- box "notices", 60, 16 116 258 50, tab 52
- check "show private notices in active window only (default: show in active and in all common channels)", 56, 24 128 242 8, tab 52
- check "do not show private notices in active window", 80, 24 136 122 8, tab 52
- check "show channel notices in the target channel only (default: show in target and active window)", 57, 24 144 238 8, tab 52
- check "show ops notices in the target channel only (default: show in target and active window)", 58, 24 152 226 8, tab 52
- text "note: contrary to the previous tab, settings on this and the next tab cannot be themed, as they affect what to show and where, rather than how to show it.", 103, 20 172 249 16, tab 52
- tab "event hiding", 84
- box "settings", 85, 16 24 142 166, tab 84
- check "hide the following events:", 86, 24 36 78 8, tab 84
- check "join", 87, 32 48 26 8, disable tab 84
- check "part", 88, 32 56 26 8, disable tab 84
- check "quit", 89, 32 64 26 8, disable tab 84
- text "on these channels:", 90, 32 80 53 8, disable tab 84
- radio "all", 91, 32 92 19 8, disable tab 84
- radio "all except", 92, 56 92 34 8, disable tab 84
- radio "only", 93, 96 92 26 8, disable tab 84
- combo 94, 32 104 84 74, disable tab 84 size
- button "add", 95, 120 104 29 12, disable tab 84
- button "remove", 96, 120 164 29 12, disable tab 84
- text "network.channel", 97, 56 178 45 8, disable tab 84
- button "&theme builder...", 35, 16 204 49 12, multi
- text "current theme", 40, 72 200 77 8, center
- button "&ok", 42, 156 204 37 12, default ok
- button "&cancel", 43, 200 204 37 12, cancel
- button "&apply", 44, 244 204 37 12
- text "", 41, 72 208 77 8, center
- }
- ; --- popup themes
- #themes_popup on
- menu menubar,status {
- themes
- .load theme
- ..$submenu($thememenu($1))
- .create theme... { dopen maketheme }
- .settings... { dopen themes }
- .-
- .unload this module { unloadthemeengine }
- }
- alias -l thememenu {
- if (($1 == begin) || ($1 == end)) { return - }
- if ($noext($nopath($findfile($themedir,*.upp,$1,0)))) {
- tokenize 32 $v1
- var %i = $uneval($1-)
- if ($1- == $theme.name) { return $style(1) %i :loadtheme %i }
- return %i :loadtheme %i
- }
- }
- alias -l unloadthemeengine { unloadmoduletree themes }
- #themes_popup end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement