on *:load: {
  .load -rs $+($shortfn($+($scriptdir,\hobo-notes.toolbars.hbsn)))
  .load -rs $+($shortfn($+($scriptdir,\hobo-notes.functions.hbsn)))
  .load -rs $+($shortfn($+($scriptdir,\hobo-notes.functions2.hbsn)))
  .load -rs $+($shortfn($+($scriptdir,\hobo-notes.agents.hbsn)))
  set %hobo-office.directory $+($shortfn($scriptdir)) 
  set %hobonotes.theme default 
  set %hobonotes.nagaboutlogfile 1
  set %agent.didle on
  set %agent.greet on
  set %agent.sidle on
  set %agent.sound on
}
on *:unload: {
  unset %hobonotes*
  unset %hbn*
  unset %cb.line1
  unset %channel.hobo 
  unset %colorcombo.dll 
  unset %file.dll
  unset %file.name 
  unset %file.name.2
  unset %font.format
  unset %font.type.1 
  unset %goto.line 
  unset %hobo-office.directory
  unset %new.execute.decision
  unset %agent.didle
  unset %agent.greet
  unset %agent.sidle
  unset %agent.sound
  .unload -rs $+($shortfn($+($scriptdir,\hobo-notes.toolbars.hbsn)))
  .unload -rs $+($shortfn($+($scriptdir,\hobo-notes.functions.hbsn)))
  .unload -rs $+($shortfn($+($scriptdir,\hobo-notes.functions2.hbsn)))
  .unload -rs $+($shortfn($+($scriptdir,\hobo-notes.agents.hbsn)))
}
dialog Hobo {
  title bIRC Word - %bsver
  icon $themeicons(hobonotes), 0
  size -1 -1 322 231
  option dbu
  button "Button", 29, 49 61 0 0, disable hide ok cancel
  button "", 99, 1 1 1 1
  list 15, 0 0 167 17, size
  list 100, 0 0 167 17, size
  list 101, 0 0 167 17, size
  edit "", 19, 59 18 266 212, autohs autovs multi return hsbar vsbar
  edit "", 109, 59 18 264 212, multi return
  list 30, 0 18 57 197, size sort extsel
  list 27, 0 18 57 197, size
  list 26, 0 214 57 17, size
  button "", 31, 56 18 3 100
  menu "Datei", 1
  item "Neu...", 2, 1
  item "Öffnen", 3, 1
  item "break", 4, 1
  item "Speichern", 6, 1
  item "Speichern als", 94, 1
  item "break", 7, 1
  item "Drucken", 8, 1
  item "break", 9, 1
  item "Exit", 10, 1
  menu "Edit", 11
  item "Kopieren", 17, 11
  item "Einfügen", 18, 11
  item "break", 22, 11
  item "Finden", 23, 11
  item "Gehe zu", 24, 11
  menu "Format", 16
  item "Schrift", 20, 16
  menu "Tools", 87
  item "Zwischenablage", 13, 87
  item "break", 14, 87
  item "Einstellung", 88, 87
  item "Themes", 28, 87
  menu "Hilfe", 5
  item "Readme", 12, 5
  item "break", 21, 5
  item "Über", 25, 5
}
dialog -l Settings {
  title Einstellungen - %bsver
  icon $themeicons(Settings), 0
  size -1 -1 112 103
  option dbu
  tab "Toolbar", 12, 2 3 108 84
  tab "Sidebar", 13
  tab "Datei Handling", 14
  tab "Loganzeiger", 15
  box "Appearance", 10, 270 193 49 84
  box "Dcc Handling", 9, 246 211 94 63
  list 32, 13 32 34 39, tab 14 size extsel
  button "Remove", 31, 50 49 22 12, tab 14
  button "Add", 30, 50 33 22 12, tab 14
  check "Open Files on Receival", 29, 13 19 67 10, tab 14
  button "OK", 2, 37 90 37 12, ok
  box "Main Toolbar", 5, 270 200 49 38
  radio "Icons Only", 6, 35 30 38 12, tab 12
  radio "Text Only", 7, 35 44 36 12, tab 12
  radio "Icons + Text", 8, 35 58 42 12, tab 12
  box "Sidebar", 18, 270 239 49 38
  check "Enabled", 36, 34 21 38 8, tab 13
  radio "Auto-Text", 4, 6 49 45 12, tab 13 group
  radio "File Info", 1, 6 64 45 12, tab 13
  radio "Character Map", 3, 6 35 45 12, tab 13
  box "Formatting", 25, 276 153 54 19, hide
  check "Indent Text", 26, 306 158 39 8, hide
  check "Drag and Drop Window", 27, 13 72 85 10, tab 14
  radio "Log Viewer", 11, 54 35 45 12, tab 13
  text "Hobo-Notes cannot find any Log Files in the selected directory.", 16, 8 61 96 16, tab 15
  edit "", 17, 8 30 96 10, tab 15 read autohs
  text "Current Log Directory Path:", 19, 8 19 80 8, tab 15
  button "Change Path", 20, 37 41 37 12, tab 15
}
dialog -l Print {
  title "Print"
  size -1 -1 137 104
  option pixels
  radio "Print Selection", 1, 45 5 94 22
  radio "Print All", 2, 45 24 70 22
  button "Print", 3, 3 47 64 24
  button "Cancel", 4, 70 47 64 24, ok cancel
  icon 5, 3 4 38 38, $themeicons(print), 0
  edit "", 6, 2 108 538 409, multi autohs autovs vsbar hsbar return read
  button "Preview>>", 7, 34 75 65 25
}
dialog -l About {
  title "About Hobo-Notes"
  size -1 -1 250 250
  option dbu
  icon $themeicons(about), 0
  edit "", 1, 0 0 206 189, return 
  button "", 99, 1 1 1 1
}
on *:dialog:about:init:0: {
  if ( $dialog(about).title = About Hobo-Notes ) {
    dll $mdx.dll SetMircVersion $version
    dll $mdx.dll MarkDialog $dname  
    dll $mdx.dll SetDialog $dname style title sysmenu 
    echo $gettok($dll($mdx.dll,SetControlMDX,1 RichEdit AutoURL VSBar HSBar  multi return> $mdx.ctl),$9,45)
    echo $gettok($dll($mdx.dll,SetControlMDX,99 Positioner maxbox minbox size> $mdx.dialog),$9,45)
    did -a about 1 loadFile +rtf $+($shortfn($+($scriptdir,\about.rtf)))
    dll $mdx.dll MoveControl about 1 * * $calc($dialog(about).cw + 3) $calc($dialog(about).ch + 3)
  }
  did -c hobo 25
}
on *:dialog:about:close:0: { did -u hobo 25 }
on *:dialog:about:sclick:99: {
  if ( $dialog(about).title = About Hobo-Notes ) {
    dll $mdx.dll MoveControl about 1 * * $calc($dialog(about).cw + 3) $calc($dialog(about).ch + 3)
  }
}
on *:dialog:hobo:init:0: {
  if ( $hsettings.read(Settings,Toolbar) = $null ) { hsettings.write Settings Toolbar 0 }
  set %hobonotes.textarea.chars 0
  set %hobonotes.textarea.words 0
  dll $mdx.dll SetMircVersion $version
  dll $mdx.dll MarkDialog $dname 
  dll $mdx.dll SetDialog $dname style title sysmenu 
  echo $gettok($dll($mdx.dll,SetControlMDX,hobo 99 Positioner minbox maxbox size noclose> $mdx.dialog ),$9,45)
  echo $gettok($dll($mdx.dll,SetControlMDX,hobo 27 TreeView haslines linesatroot fullrowselect showsel > $mdx.views),$9,45)
  echo $gettok($dll($mdx.dll,SetControlMDX,hobo 30 ListView report rowselect single grid nosortheader noheader underlinehot infotip > $mdx.views),$9,45)
  echo $gettok($dll($mdx.dll,SetControlMDX,hobo 109 RichEdit AutoURL VSBar HSBar Read multi return> $mdx.ctl),$9,45))
  echo $gettok($dll($mdx.dll,SetControlMDX,hobo 31 Divider Vertical LRBorder TBBorder> $mdx.ctl),$9,45))
  did -a hobo 109 loadFile +rtf $+($shortfn($+($scriptdir,\readme.rtf)))
  did -h hobo 109
  dll $mdx.dll SetBorderStyle Hobo 15,100,101 
  toolbar.start.load
  toolbar.load
  editbox.settings
  hobonotes.loadsidebar.toolbar
  themes.apply
  if ( %hobonotes.logs.dir = $null ) { 
    if ( %hobonotes.nagaboutlogfile = 1 ) {
      var %temp $input(Log File Directory is not set. If you wish to use the Log Viewer you must set a directory in the settings dialog,oi,No Log File Directory Set,No Log File Directory Set)
      set %hobonotes.nagaboutlogfile 0
    }
  }
  if ( $hsettings.read(Settings,sidebar) = 0 ) {
    hobonotes.cmap.close
    did -h hobo 31
    dll $mdx.dll MoveControl Hobo 19 0 * $calc($dialog(hobo).cw + 3) $calc($dialog(hobo).ch - 33)
    dll $mdx.dll MoveControl Hobo 109 0 * $calc($dialog(hobo).cw + 3) $calc($dialog(hobo).ch - 33))
    dll $mdx.dll MoveControl Hobo 32 $calc($dialog(hobo).cw - 212 ) * * *
    dll $mdx.dll MoveControl Hobo 33 $calc($dialog(hobo).cw - 242 ) * * *
    dll $mdx.dll MoveControl Hobo 35 $calc($dialog(hobo).cw - 90 ) * * *
    dll $mdx.dll MoveControl Hobo 34 $calc($dialog(hobo).cw - 60 ) * * *
    dll $mdx.dll MoveControl Hobo 31 * * * $calc($dialog(hobo).ch - 36)
    dll $mdx.dll MoveControl Hobo 15 * * $dialog(hobo).cw *
    dll $mdx.dll MoveControl Hobo 100 * * $dialog(hobo).cw *
    dll $mdx.dll MoveControl Hobo 101 * * $dialog(hobo).cw *
  }
  if ( $hsettings.read(Settings,sidebar) = 1 ) {
    dll $mdx.dll MoveControl Hobo 19 * * $calc($dialog(hobo).cw - $calc( $divren - 2)) $calc($dialog(hobo).ch - 33)
    dll $mdx.dll MoveControl Hobo 109 * * $calc($dialog(hobo).cw - $calc( $divren - 2)) $calc($dialog(hobo).ch - 33)
    dll $mdx.dll MoveControl Hobo 30 * * $calc( $divlen) $calc($dialog(hobo).ch - 68)
    dll $mdx.dll MoveControl Hobo 31 * * * $calc($dialog(hobo).ch - 36)
    dll $mdx.dll MoveControl Hobo 32 $calc($dialog(hobo).cw - 212 ) * * *
    dll $mdx.dll MoveControl Hobo 33 $calc($dialog(hobo).cw - 242 ) * * *
    dll $mdx.dll MoveControl Hobo 35 $calc($dialog(hobo).cw - 90 ) * * *
    dll $mdx.dll MoveControl Hobo 34 $calc($dialog(hobo).cw - 60 ) * * *
    dll $mdx.dll MoveControl Hobo 27 * * $calc( $divlen) $calc($dialog(hobo).ch - 68)
    dll $mdx.dll MoveControl Hobo 26 * $calc($dialog(hobo).ch - 35) $calc( $divlen) *
    dll $mdx.dll MoveControl Hobo 15 * * $dialog(hobo).cw *
    dll $mdx.dll MoveControl Hobo 100 * * $dialog(hobo).cw *
    dll $mdx.dll MoveControl Hobo 101 * * $dialog(hobo).cw *
    if ( $hsettings.read(settings,cmap) = 0 ) {
      did -h hobo 30
      did -v hobo 27
    }
    if ( $hsettings.read(settings,cmap) = 1 ) {
      did -v hobo 30
      did -h hobo 27
      characters.load
    }
    if ( $hsettings.read(settings,logview) = 1 ) {
      did -v hobo 30
      did -h hobo 27
    }
    if ( $hsettings.read(settings,cmap) = 1 ) { characters.load }
    if ( $hsettings.read(Settings,autotext) = 1 ) { atext.treebar.set }
    if ( $hsettings.read(settings,stats) = 1 ) { sidebar.stats }
    if ( $hsettings.read(settings,logview) = 1 ) { hobonotes.sidebar.logview }
  }
  if ( $hsettings.read(Settings,dragdrop) = 1 ) {
    if ( $dialog(drag).hwnd = $null ) { dialog -mod drag drag }
  }
  if ( $hsettings.read(settings,sidebar) = 0 ) {
    did -h hobo 27
    did -h hobo 30
    did -h hobo 26
  }
  hobonotes.check.windows.folder
  loadagents
  if ( %agent.greet = on ) {
    Agent.speak.hobonotes1.intro
  }
  agent.idle
  ;hobonotes.load.fonts
  ;hobonotes.checkrecent
}
alias dialogs.hobonotes {
  dialog -m hobo hobo
}
on *:dialog:print:init:0: {
  dll $mdx.dll SetMircVersion $version
  dll $mdx.dll MarkDialog $dname  
  dll $mdx.dll SetDialog $dname style title sysmenu tool
  dll $mdx.dll SetBorderStyle $dname 1,2,3,4 
  did -r print 6
  hobonotes.print.preview
  if ( $did(hobo,19).selstart = $did(hobo,19).selend ) {
    did -b print 1
    did -c print 2
    did -b print 7
  }
  if ( $did(hobo,19).selstart != $did(hobo,19).selend ) {
    did -c print 1
    did -u print 2
    did -e print 7
  }
  did -c hobo 8
}
on *:dialog:print:close:0: { did -u hobo 8 }
on *:dialog:print:sclick:7: {
  if ( $dialog(print).w = 143 ) {
    dialog -s print -1 -1 543 566
    did -r print 7
    did -a print 7 Preview <<
    goto end
  }
  if ( $dialog(print).w = 549 ) {
    dialog -s print -1 -1 137 104
    did -r print 7
    did -a print 7 Preview >>
    goto end
  }
  :end
}
on *:dialog:hobo-notes:init:0: {
  dll $mdx.dll SetMircVersion $version
  dll $mdx.dll MarkDialog $dname  
  dll $mdx.dll SetDialog $dname style title sysmenu 
  hobonotes.loadextensionlist
  if ( $hsettings.read(Settings,toolbar) = 0 ) { did -c $dname 6 }
  if ( $hsettings.read(Settings,toolbar) = 1 ) { did -c $dname 7  }
  if ( $hsettings.read(Settings,toolbar) = 2 ) {  did -c $dname 8 }
  if ( $hsettings.read(Settings,autotext) = 1 ) { did -c $dname 4 }
  if ( $hsettings.read(Settings,cmap) = 1 ) { did -c $dname 3 }
  if ( $hsettings.read(Settings,indent) = 1 ) { did -c $dname 26 }
  if ( $hsettings.read(Settings,dragdrop) = 1 ) { did -c $dname 27 }
  if ( $hsettings.read(DCC,receive) = 1 ) { did -c $dname 29 }
  if ( $hsettings.read(settings,sidebar) = 1 ) { did -c hobo-notes 36 }
  if ( $hsettings.read(settings,stats) = 1 ) { did -c hobo-notes 1 }
  if ( $hsettings.read(settings,logview) = 1 ) { 
    did -c hobo-notes 11
    did -u hobo-notes 4,3,1
  }
  did -c hobo 88
  hobonotes.settings.logview.checkforlogs
  did -a hobo-notes 17 %hobonotes.logs.dir
}
on *:dialog:hobo-notes:sclick:20: {
  set %hobonotes.logs.dir $+($shortfn($sdir($mircdir,Select Log Directory)))
  hobonotes.logview.pathset.checkvalidity
  hobonotes.settings.logview.checkforlogs
  did -r hobo-notes 17
  did -a hobo-notes 17 %hobonotes.logs.dir
  if ( $hsettings.read(settings,logview) = 1 ) { hobonotes.sidebar.logview }
}
on *:dialog:hobo-notes:sclick:35: { 
  hobonotes.colorthemes.remove
  did -u hobo-notes 11
}
on *:dialog:hobo-notes:sclick:1: { 
  hobonotes.sidebar.statsbar
  did -u hobo-notes 11
}
on *:dialog:hobo-notes:sclick:3: { 
  hobonotes.sidebar.cmapset 
  did -u hobo-notes 11
}
on *:dialog:hobo-notes:sclick:11: { 
  hobonotes.sidebar.logview
  did -u hobo-notes 4,1,3
}
on *:dialog:hobo-notes:sclick:28: {
  hobonotes.colorthemes.refresh
  editbox.settings
}
on *:dialog:hobo-notes:close:0: { did -u hobo 88 }
on *:Dialog:hobo-notes:sclick:36: { hobonotes.sidebar.settings.execute }
on *:dialog:hobo-notes:sclick:29: { hsettings.write DCC Receive $did($dname,29).state }
on *:dialog:hobo-notes:sclick:26: { hsettings.write settings indent $did($dname,26).state }
on *:dialog:hobo-notes:sclick:27: {
  if ( $did(hobo-notes,27).state = 1 ) {
    hsettings.write settings dragdrop $did($dname,27).state
    dialog -mod drag drag
  }
  if ( $did(hobo-notes,27).state = 0 ) {
    hsettings.write settings dragdrop $did($dname,27).state
    dialog -x drag drag
  }
}
on *:dialog:hobo-notes:sclick:6: {
  hsettings.write settings toolbar 0
  toolbar.load
}
on *:dialog:hobo-notes:sclick:7: {
  hsettings.write settings toolbar 1
  toolbar.load
}
on *:dialog:hobo-notes:sclick:8: {
  hsettings.write settings toolbar 2
  toolbar.load
}
on *:dialog:hobo-notes:sclick:4: { hobonotes.sidebar.autotextset }
on *:dialog:hobo-notes:sclick:30: { hobonotes.addextension }
on *:dialog:hobo-notes:sclick:31: { hobonotes.removeextension }
on *:dialog:hobo-notes:sclick:32: {
  if ( $did(hobo-notes,32).sel = $null ) { did -b hobo-notes 31 }
  if ( $did(hobo-notes,32).sel != $null ) { did -e hobo-notes 31 }
}
on *:dialog:hobo-notes:sclick:17: {
  set %hobonotes.toolbar.image $shortfn($gettok($dll($file.dll,EDlg,l>Load Toolbar Image...>|Bitmap Image|*.bmp||>N),1-,32))
  if ( %hobonotes.toolbar.image != $false ) {
    did -i hobo 101 1 setbkg tile %hobonotes.toolbar.image
    did -i hobo 100 1 setbkg tile %hobonotes.toolbar.image
    did -i hobo 15 1 setbkg tile %hobonotes.toolbar.image
  }
}
on *:dialog:hobo:sclick:32: { hobonotes.setfont.execute.combo }
on *:dialog:hobo:sclick:34: { hobonotes.setfont.execute.combo }
on *:dialog:hobo:menu:20: {  hobonotes.setfont.execute }
on *:dialog:hobo:menu:8: {
  if ( $dialog(print).hwnd = $null ) { 
    dialog -ma print print 
    did -c hobo 8
  }
  else { 
    dialog -v print print
    did -c hobo 8
  }
}
alias hobo-notes.dialog.open {
  if ( $dialog(hobo).hwnd = $null ) { dialog -md hobo hobo }
  if ( $dialog(hobo).hwnd != $null ) { dialog -v hobo hobo }
}
on *:dialog:hobo:menu:88: {
  if ( $dialog(hobo-notes).hwnd = $null ) { 
    dialog -ma hobo-notes settings 
    did -c hobo 88 
  }
  else { 
    dialog -v hobo-notes settings 
    did -c hobo 88 
  }
}
on *:dialog:hobo:menu:17: {
  if ( $did(hobo,19).seltext != $null ) { copy.execute }
}
on *:dialog:hobo:menu:18: { paste.execute }
on *:dialog:hobo:menu:201: {
  set %hobonotes.tutorial 0
  agent.speak.hobonotes.intro
}
on *:dialog:hobo:menu:25: {
  if ( $dialog(about).hwnd = $null ) { 
    dialog -ma about about
    did -c hobo 25
  }
  else {
    dialog -v about about
    did -c hobo 25
  }
}
on *:dialog:hobo:menu:10: { closenotes.execute }
on *:dialog:hobo:sclick:26: {
  if ( $gettok($did(hobo,26).seltext,2,32) = 1 ) { hobonotes.sidebar.cmapset }
  if ( $gettok($did(hobo,26).seltext,2,32) = 2 ) { hobonotes.sidebar.autotextset }
  if ( $gettok($did(hobo,26).seltext,2,32) = 3 ) { hobonotes.sidebar.statsbar }
  if ( $$gettok($did(hobo,26).seltext,2,32) = 4 ) { hobonotes.sidebar.logview }
  if ( $gettok($did(hobo,26).seltext,2,32) = 5 ) {
    hobonotes.sidebar.settings.execute
    if ( $dialog(hobo-notes).hwnd != $null ) { did -u hobo-notes 36 }
  }
}
on *:dialog:hobo:menu:12: {
  if ( $did(hobo,19).visible = $true ) {
    did -c hobo 12
    did -v hobo 109
    did -h hobo 19
    goto end
  }
  if ( $did(hobo,19).visible != $true ) {
    did -u hobo 12
    did -h hobo 109
    did -v hobo 19
    goto end
  }
  if ( $me != $me ) {
    new.execute
    set %file.name $shortfn($+($scriptdir,\readme.txt))
    loadbuf $lines($shortfn($+($scriptdir,\readme.txt))) -op hobo 19 $shortfn($+($scriptdir,\readme.txt))
    did -j hobo 19
    hobonotes.stats.refresh
    hobonotes.settitle
  }
  :end
}
on *:dialog:hobo:menu:13: {
  if ( $dialog(clipboard).hwnd = $null ) { 
    dialog -ma clipboard clipboard  
    did -c hobo 13
  }
  else { 
    dialog -v clipboard clipboard
    did -c hobo 13
  }
}
on *:dialog:hobo:menu:94: { saveas.execute }
;on *:dialog:hobo:menu:23: { find.execute }
on *:dialog:hobo:menu:24: {
  set %goto.line $input(Goto Line,eo,Goto Line)
  goto.execute
}
on *:dialog:hobo:menu:10: { dialog -x hobo hobo }
on *:dialog:hobo:edit:19: {
  if ( $hsettings.read(settings,sidebar) = 1 ) {
    if ( $hsettings.read(settings,stats) = 1 ) { hobonotes.counts.refresh }
  }
}
on *:dialog:hobo:menu:28: {
  if ( $dialog(themes).hwnd = $null ) { 
    dialog -ma themes themes 
    did -c hobo 28
  }
  if ( $dialog(themes).hwnd != $null ) { 
    dialog -v themes themes
    did -c hobo 28
  }
}
alias divle { return $gettok($did(hobo,31).text,3,32) }
alias divre { return $gettok($did(hobo,31).text,5,32) }
alias divren { return $gettok($did(hobo,31).text,4,32) }
alias divlen { return $gettok($did(hobo,31).text,3,32) }
on *:dialog:hobo:sclick:31: {
  dll $mdx.dll MoveControl Hobo 19 $calc( $divren + 1) * $calc($dialog(hobo).cw - $divren + 1) *
  dll $mdx.dll MoveControl Hobo 109 $calc( $divren + 1) * $calc($dialog(hobo).cw - $divren + 1) *
  dll $mdx.dll MoveControl Hobo 27 0 * $divlen *
  dll $mdx.dll MoveControl Hobo 30 0 * $divlen *
  dll $mdx.dll MoveControl Hobo 26 0 * $divlen *
}
on *:dialog:hobo:sclick:99: {
  if ( $gettok($did($dname,$did).text,1,32) = sizing ) {
    if ( $dialog(hobo).h > 28 ) {
      set %hobonotes.window.w $dialog(hobo).w
      set %hobonotes.window.h $dialog(hobo).h  
    }
  }
  if ( $gettok($did($dname,$did).text,1,32) = tryclose ) { closenotes.execute  }
  if ( $hsettings.read(settings,sidebar) = 1 ) {
    dll $mdx.dll MoveControl Hobo 19 * * $calc($dialog(hobo).cw - $calc( $divren - 2)) $calc($dialog(hobo).ch - 34)
    dll $mdx.dll MoveControl Hobo 109 * * $calc($dialog(hobo).cw - $calc( $divren - 2)) $calc($dialog(hobo).ch - 34)
    dll $mdx.dll MoveControl Hobo 30 * * $calc( $divlen) $calc($dialog(hobo).ch - 68)
    dll $mdx.dll MoveControl Hobo 31 * * * $calc($dialog(hobo).ch - 36)
    dll $mdx.dll MoveControl Hobo 32 $calc($dialog(hobo).cw - 212 ) * * *
    dll $mdx.dll MoveControl Hobo 33 $calc($dialog(hobo).cw - 242 ) * * *
    dll $mdx.dll MoveControl Hobo 35 $calc($dialog(hobo).cw - 90 ) * * *
    dll $mdx.dll MoveControl Hobo 34 $calc($dialog(hobo).cw - 60 ) * * *
    dll $mdx.dll MoveControl Hobo 27 * * $calc( $divlen) $calc($dialog(hobo).ch - 68)
    dll $mdx.dll MoveControl Hobo 26 * $calc($dialog(hobo).ch - 35) $calc( $divlen) *
    dll $mdx.dll MoveControl Hobo 15 * * $dialog(hobo).cw *
    dll $mdx.dll MoveControl Hobo 100 * * $dialog(hobo).cw *
    dll $mdx.dll MoveControl Hobo 101 * * $dialog(hobo).cw *
  }
  if ( $hsettings.read(settings,sidebar) = 0 ) {
    dll $mdx.dll MoveControl Hobo 19 0 * $calc($dialog(hobo).cw + 3) $calc($dialog(hobo).ch - 34)
    dll $mdx.dll MoveControl Hobo 109 0 * $calc($dialog(hobo).cw + 3) $calc($dialog(hobo).ch - 34)
    dll $mdx.dll MoveControl Hobo 30 * * * $calc($dialog(hobo).ch - 68)
    dll $mdx.dll MoveControl Hobo 32 $calc($dialog(hobo).cw - 212 ) * * *
    dll $mdx.dll MoveControl Hobo 33 $calc($dialog(hobo).cw - 242 ) * * *
    dll $mdx.dll MoveControl Hobo 35 $calc($dialog(hobo).cw - 90 ) * * *
    dll $mdx.dll MoveControl Hobo 34 $calc($dialog(hobo).cw - 60 ) * * *
    dll $mdx.dll MoveControl Hobo 27 * * * $calc($dialog(hobo).ch - 68)
    dll $mdx.dll MoveControl Hobo 26 * $calc($dialog(hobo).ch - 35) * *
    dll $mdx.dll MoveControl Hobo 15 * * $dialog(hobo).cw *
    dll $mdx.dll MoveControl Hobo 100 * * $dialog(hobo).cw *
    dll $mdx.dll MoveControl Hobo 101 * * $dialog(hobo).cw *
  }
  ;  if ( $gettok($did($dname,$did).text,1,32) = tryclose ) {
  ;    if ( %hobonotes.shaded = 1 ) {
  ;      dialog -s hobo -1 -1 -1 %hobonotes.window.h
  ;      dll $mdx.dll SetMDXStyle hobo 99 +size
  ;      set %hobonotes.shaded 0
  ;      goto end
  ;    }
  ;    if ( %hobonotes.shaded = 0 ) {
  ;      dialog -s hobo -1 -1 -1 0
  ;      dll $mdx.dll SetMDXStyle hobo 99 -size
  ;      set %hobonotes.shaded 1
  ;      goto end
  ;    }
  ;  }
  :end
}
on *:dialog:print:sclick:3: {
  if ( $did($dname,1).state == 1 ) {
    hobonotes.printsel.execute
    dialog -x print print
  }
  if ( $did($dname,2).state == 1 ) {
    hobonotes.printall.execute
    dialog -x print print
  }
}
on *:dialog:hobo:dclick:30: { 
  if ( $hsettings.read(settings,cmap) = 1 ) { did -a $dname 19 $chr($gettok($did($dname,30).seltext,6,32) ) }
  if ( $hsettings.read(settings,Logview) = 1 ) { 
    set %file.name $gettok($did($dname,30).seltext,11,32)
    open.execute.logs
  }
}
on *:dialog:hobo:sclick:27: {
  if ( $hsettings.read(settings,autotext) = 1 ) { atext.insert.process }
}
on *:dialog:hobo:menu:2: { new.execute }
on *:dialog:hobo:menu:3: { open.execute }
on *:dialog:hobo:menu:6: { save.execute }
on *:dialog:hobo:menu:10: { closenotes.execute }
on *:dialog:hobo:dclick:15: { hobotools }
on *:dialog:hobo:dclick:100: { hobotools }
on *:dialog:hobo:dclick:101: { hobotools }
on *:dialog:hobo:sclick:15: {
  if ( $hsettings.read(Settings,toolbar) == 0 ) {
    if ( $gettok($did($dname,$did).seltext,2,32) = 1 ) {
      new.execute
      goto end
    }
    if ( $gettok($did($dname,$did).seltext,2,32) = 2 ) {
      open.execute
      goto end
    }
    if ( $gettok($did($dname,$did).seltext,2,32) = 3 ) {
      save.execute
      goto end
    }
    if ( $gettok($did($dname,$did).seltext,2,32) = 4 ) {
      if ( $dialog(print).hwnd = $null ) { dialog -ma print print }
      else { dialog -v print print }
      goto end
    }
    if ( $gettok($did($dname,$did).seltext,2,32) = 6 ) {
      copy.execute
      goto end
    }
    if ( $gettok($did($dname,$did).seltext,2,32) = 7 ) {
      paste.execute
      goto end
    }
    if ( $gettok($did($dname,$did).seltext,2,32) = 10 ) {
      if ( $dialog(clipboard).hwnd = $null ) { dialog -ma clipboard clipboard }
      else { dialog -v clipboard clipboard }
      goto end
    }
    if ( $gettok($did($dname,$did).seltext,2,32) = 11 ) {
      if ( $dialog(hobo-notes).hwnd = $null ) { dialog -ma hobo-notes settings }
      else { dialog -v hobo-notes settings }
      goto end
    }
    if ( $gettok($did($dname,$did).seltext,2,32) = 12 ) {
      if ( $dialog(about).hwnd = $null ) { dialog -ma about about }
      else { dialog -v about about }
      goto end
    }
  }
  else {
    if ( $gettok($did($dname,$did).seltext,3,32) = New ) {
      new.execute
      goto end
    }
    if ( $gettok($did($dname,$did).seltext,3,32) = Open ) {
      open.execute
      goto end
    }
    if ( $gettok($did($dname,$did).seltext,3,32) = Save ) {
      save.execute
      goto end
    }
    if ( $gettok($did($dname,$did).seltext,3,32) = Print ) {
      if ( $dialog(print).hwnd = $null ) { dialog -ma print print }
      else { dialog -v print print }
      goto end
    }
    if ( $gettok($did($dname,$did).seltext,3,32) = copy ) {
      copy.execute
      goto end
    }
    if ( $gettok($did($dname,$did).seltext,3,32) = Paste ) {
      paste.execute
      goto end
    }
    if ( $gettok($did($dname,$did).seltext,3,32) = Clipboard ) {
      if ( $dialog(clipboard).hwnd = $null ) { dialog -ma clipboard clipboard }
      else { dialog -v clipboard clipboard }
      goto end
    }
    if ( $gettok($did($dname,$did).seltext,3,32) = Settings ) {
      if ( $dialog(hobo-notes).hwnd = $null ) { dialog -ma hobo-notes settings }
      else { dialog -v hobo-notes settings }
      goto end
    }
    if ( $gettok($did($dname,$did).seltext,3,32) = About ) {
      if ( $dialog(about).hwnd = $null ) { dialog -ma about about }
      else { dialog -v about about }
      goto end
    }
  }
  :end
}
on *:dialog:hobo:sclick:100: {
  if ( $gettok($did($dname,$did).seltext,3,32) = New ) {
    new.execute
    goto end
  }
  if ( $gettok($did($dname,$did).seltext,3,32) = Open ) {
    open.execute
    goto end
  }
  if ( $gettok($did($dname,$did).seltext,3,32) = Save ) {
    save.execute
    goto end
  }
  if ( $gettok($did($dname,$did).seltext,3,32) = Print ) {
    if ( $dialog(print).hwnd = $null ) { dialog -ma print print }
    else { dialog -v print print }
    goto end
  }
  if ( $gettok($did($dname,$did).seltext,3,32) = copy ) {
    copy.execute
    goto end
  }
  if ( $gettok($did($dname,$did).seltext,3,32) = Paste ) {
    paste.execute
    goto end
  }
  if ( $gettok($did($dname,$did).seltext,3,32) = Clipboard ) {
    if ( $dialog(clipboard).hwnd = $null ) { dialog -ma clipboard clipboard }
    else { dialog -v clipboard clipboard }
    goto end
  }
  if ( $gettok($did($dname,$did).seltext,3,32) = Settings ) {
    if ( $dialog(hobo-notes).hwnd = $null ) { dialog -ma hobo-notes settings }
    else { dialog -v hobo-notes settings }
    goto end
  }
  if ( $gettok($did($dname,$did).seltext,3,32) = About ) {
    if ( $dialog(about).hwnd = $null ) { dialog -ma about about }
    else { dialog -v about about }
    goto end
  }
  :end
}
on *:dialog:hobo:sclick:101: {
  if ( $gettok($did($dname,$did).seltext,3,32) = New ) {
    new.execute
    goto end
  }
  if ( $gettok($did($dname,$did).seltext,3,32) = Open ) {
    open.execute
    goto end
  }
  if ( $gettok($did($dname,$did).seltext,3,32) = Save ) {
    save.execute
    goto end
  }
  if ( $gettok($did($dname,$did).seltext,3,32) = Print ) {
    if ( $dialog(print).hwnd = $null ) { dialog -ma print print }
    else { dialog -v print print }
    goto end
  }
  if ( $gettok($did($dname,$did).seltext,3,32) = copy ) {
    copy.execute
    goto end
  }
  if ( $gettok($did($dname,$did).seltext,3,32) = Paste ) {
    paste.execute
    goto end
  }
  if ( $gettok($did($dname,$did).seltext,3,32) = Clipboard ) {
    if ( $dialog(clipboard).hwnd = $null ) { dialog -ma clipboard clipboard }
    else { dialog -v clipboard clipboard }
    goto end
  }
  if ( $gettok($did($dname,$did).seltext,3,32) = Settings ) {
    if ( $dialog(hobo-notes).hwnd = $null ) { dialog -ma hobo-notes settings }
    else { dialog -v hobo-notes settings }
    goto end
  }
  if ( $gettok($did($dname,$did).seltext,3,32) = About ) {
    if ( $dialog(about).hwnd = $null ) { dialog -ma about about }
    else { dialog -v about about }
    goto end
  }
  :end
}
alias themes { dialog -ma themes themes }
dialog Themes {
  title "Themes"
  icon $themeicons(Themes), 0
  size -1 -1 198 189
  option dbu
  box "Preview", 1, 54 64 143 110
  edit Preview Text $crlf Preview Text, 3, 56 91 139 81, read autovs multi hsbar vsbar
  box "Themes", 4, 1 0 54 174
  button "Apply", 5, 160 176 37 12
  button "Cancel", 6, 120 176 37 12, cancel
  button "New Theme", 7, 8 176 37 12
  list 8, 3 7 50 165, size
  box "Info", 9, 54 0 143 60
  list 10, 56 7 139 52, size
  box "", 11, 196 56 1 12
  list 2, 56 72 139 19, size
  link "Get More Themes", 12, 52 178 55 8
}
on *:dialog:themes:sclick:12: { url -n http://s92586347.onlinehome.us/Hobo-Notes/Themes/ }
on *:dialog:themes:init:0: { 
  themes.dialog.load 
  did -c hobo 28
}
on *:dialog:themes:close:0: { did -u hobo 28 }
on *:dialog:themes:sclick:8: {
  set %hobonotes.theme $did(themes,8).seltext
  themes.info
}
on *:dialog:themes:sclick:2: { 
  if ( $gettok($did($dname,$did).seltext,2,32) = 7 ) {
    hobotools.preview
  }
}
on *:dialog:themes:sclick:7: { dialog -ma create create }
on *:dialog:themes:sclick:5: { themes.apply }
dialog -l Create {
  title "Create New Theme"
  icon $themeicons(Themes), 0
  size -1 -1 218 176
  option pixels notheme
  tab "Info", 1, 0 2 218 148
  tab "Colors", 15
  tab "Toolbar", 26
  tab "Icons", 23
  box "Text Area", 17, 4 26 211 80, tab 15
  edit "", 5, 76 48 140 20, tab 1
  button "Add", 2, 2 149 65 25, disable
  text "Theme Name:", 3, 3 30 70 17, tab 1 right
  edit "", 4, 76 29 140 20, tab 1 autohs
  text "Author:", 6, 3 49 70 17, tab 1 right
  text "Version:", 7, 3 68 70 17, tab 1 right
  edit "", 8, 76 67 140 20, tab 1
  edit "", 9, 76 86 140 20, tab 1
  text "Website:", 10, 3 87 70 17, tab 1 right
  edit "", 11, 76 105 140 20, tab 1
  text "Copyright:", 12, 3 106 70 17, tab 1 right
  edit "", 13, 76 124 140 20, tab 1
  text "Comments:", 14, 3 125 70 17, tab 1 right
  button "Set Color", 16, 105 43 106 16, tab 15
  text "Text:", 18, 64 44 36 17, tab 15 right
  text "Text Background:", 19, 8 64 92 17, tab 15 nowrap right
  button "Set Color", 20, 105 64 106 16, tab 15
  text "Background:", 21, 8 84 92 17, tab 15 nowrap right
  button "Set Color", 22, 105 84 106 16, tab 15
  icon 27, 4 28 208 112, $back.bmp, 0 tab 26
  button "Cancel", 28, 151 149 65 25, cancel
  button "Select Icon Directory", 24, 62 71 107 25, tab 23
}
on *:dialog:create:init:0: {
  unset %theme-new.*
  dll $mdx.dll SetMircVersion $version
  dll $mdx.dll MarkDialog $dname  
  dll $mdx.dll SetDialog $dname style title sysmenu 
  echo $gettok($dll($mdx.dll,SetControlMDX,16 Text Center> $mdx.ctl),$9,45)
  echo $gettok($dll($mdx.dll,SetControlMDX,20 Text Center> $mdx.ctl),$9,45)
  echo $gettok($dll($mdx.dll,SetControlMDX,22 Text Center> $mdx.ctl),$9,45)
  dll $mdx.dll SetColor create 16 text $themes.colors(text)
  dll $mdx.dll SetColor create 16 textbg $themes.colors(text)
  dll $mdx.dll SetColor create 16 background $themes.colors(text)
  dll $mdx.dll SetColor create 20 text $themes.colors(textbg)
  dll $mdx.dll SetColor create 20 textbg $themes.colors(textbg)
  dll $mdx.dll SetColor create 20 background $themes.colors(textbg)
  dll $mdx.dll SetColor create 22 text $themes.colors(editbg)
  dll $mdx.dll SetColor create 22 textbg $themes.colors(editbg)
  dll $mdx.dll SetColor create 22 background $themes.colors(editbg)
  set %theme-new.text $themes.colors(text)
  set %theme-new.textbg $themes.colors(textbg)
  set %theme-new.editbg $themes.colors(editbg)
  unset %theme-new.iconfolder
}
on *:dialog:create:sclick:24: {
  set %theme-new.iconfolder $shortfn($sdir(c:\,Select Icon Folder))
}
on *:dialog:create:edit:4: {
  set %theme-new.name $did($dname,$did).text
  themes.checknew
}
on *:dialog:create:edit:5: {
  set %theme-new.author $did($dname,$did).text
  themes.checknew
}
on *:dialog:create:edit:8: {
  set %theme-new.version $did($dname,$did).text
  themes.checknew
}
on *:dialog:create:edit:9: {
  if ( $did($dname,$did).text != $null ) { set %theme-new.website $did($dname,$did).text }
}
on *:dialog:create:edit:11: {
  if ( $did($dname,$did).text != $null ) { set %theme-new.copyright $did($dname,$did).text }
}
on *:dialog:create:edit:13: {
  if ( $did($dname,$did).text != $null ) { set %theme-new.comments $did($dname,$did).text }
}
on *:dialog:create:sclick:16: {
  set %theme-new.text $dll($color.dll,Color,.)
  dll $mdx.dll SetColor create 16 text %theme-new.text
  dll $mdx.dll SetColor create 16 textbg %theme-new.text
  dll $mdx.dll SetColor create 16 background %theme-new.text
}
on *:dialog:create:sclick:20: {
  set %theme-new.textbg $dll($color.dll,Color,.)
  dll $mdx.dll SetColor create 20 text %theme-new.textbg
  dll $mdx.dll SetColor create 20 textbg %theme-new.textbg
  dll $mdx.dll SetColor create 20 background %theme-new.textbg
}
on *:dialog:create:sclick:22: {
  set %theme-new.editbg $dll($color.dll,Color,.)
  dll $mdx.dll SetColor create 22 text %theme-new.editbg
  dll $mdx.dll SetColor create 22 textbg %theme-new.editbg
  dll $mdx.dll SetColor create 22 background %theme-new.editbg
}
on *:dialog:create:sclick:27: {
  set %theme-new.toolbar $shortfn($gettok($dll($file.dll,EDlg,l>Load Toolbar Image...>|Bitmap Image|*.bmp||>N),1-,32))
  if ( %theme-new.toolbar != $null ) { did -g create 27 %theme-new.toolbar }
}
on *:dialog:create:sclick:2: {
  .mkdir $shortfn($+($officedir,Themes\,%theme-new.name,\))
  .writeini -n $shortfn($+($officedir,Themes\,%theme-new.name,\theme.ini)) Info Name %theme-new.name
  .writeini -n $shortfn($+($officedir,Themes\,%theme-new.name,\theme.ini)) Info Author %theme-new.author
  .writeini -n $shortfn($+($officedir,Themes\,%theme-new.name,\theme.ini)) Info Version %theme-new.version
  if ( %theme-new.website != $null ) { .writeini -n $shortfn($+($officedir,Themes\,%theme-new.name,\theme.ini)) Info Website %theme-new.website }
  if ( %theme-new.website = $null ) { .writeini -n $shortfn($+($officedir,Themes\,%theme-new.name,\theme.ini)) Info Website None }
  if ( %theme-new.copyright != $null ) { .writeini -n $shortfn($+($officedir,Themes\,%theme-new.name,\theme.ini)) Info Copyrights %theme-new.copyright }
  if ( %theme-new.copyright = $null ) { .writeini -n $shortfn($+($officedir,Themes\,%theme-new.name,\theme.ini)) Info Copyrights None }
  if ( %theme-new.comments != $null ) {    .writeini -n $shortfn($+($officedir,Themes\,%theme-new.name,\theme.ini)) Info Comments %theme-new.comments  }
  if ( %theme-new.comments = $null ) { .writeini -n $shortfn($+($officedir,Themes\,%theme-new.name,\theme.ini)) Info Comments None  }
  .writeini -n $shortfn($+($officedir,Themes\,%theme-new.name,\theme.ini)) Colors Text %theme-new.text
  .writeini -n $shortfn($+($officedir,Themes\,%theme-new.name,\theme.ini)) Colors Textbg %theme-new.textbg
  .writeini -n $shortfn($+($officedir,Themes\,%theme-new.name,\theme.ini)) Colors editbg %theme-new.editbg
  if ( $file(%theme-new.toolbar).size != $null ) {
    .copy %theme-new.toolbar $shortfn($+($officedir,Themes\,%theme-new.name,\toolbar.bmp))  
  }
  if ( %theme-new.iconfolder != $null ) {
    .writeini -n $shortfn($+($officedir,Themes\,%theme-new.name,\theme.ini)) Settings Icons 1
    .mkdir $shortfn($+($officedir,Themes\,%theme-new.name,\icons\)) 
    var %file1 $findfile(%theme-new.iconfolder,*.ico,0)
    var %file2 1
    while ( %file2 <= %file1 ) {
      .copy $file($findfile(%theme-new.iconfolder,*.ico,%file2).shortfn).shortfn $shortfn($+($officedir,Themes\,%theme-new.name,\icons\)) 
      inc %file2
    }
  }
  if ( %theme-new.iconfolder = $null ) {
    .writeini -n $shortfn($+($officedir,Themes\,%theme-new.name,\theme.ini)) Settings Icons 0
  }
  dialog -x create create
  themes.list.load
}
alias hobotools {
  dll $popups.dll New htools 16 16
  dll $popups.dll LoadImg htools 1 icon small $themeicons(Clipboard)
  dll $popups.dll LoadImg htools 2 icon small $themeicons(settings)
  dll $popups.dll LoadImg htools 3 icon small $themeicons(agentsetting) 
  dll $popups.dll LoadImg htools 4 icon small $themeicons(themes)
  dll $popups.dll LoadImg htools 5 icon small $themeicons(tutorial)
  dll $popups.dll AddItem htools 1 1 1 Clipboard Viewer
  dll $popups.dll AddItem htools 2 +d Spell Checker
  dll $popups.dll AddItem htools 3 +d Dictionary
  dll $popups.dll AddItem htools 4 +d Thesaurus
  dll $popups.dll AddItem htools 5 +C 2 2 Settings
  dll $popups.dll AddItem htools 6 3 3 Agent Settings
  dll $popups.dll AddItem htools 7 4 4 Themes
  dll $popups.dll AddItem htools 8 +C 5 5 Tutorial
  var %hobotooldec $gettok($dll($popups.dll,Popup,htools $mouse.dx $mouse.dy ),3,32)
  if ( %hobotooldec = 1 ) {
    if ( $dialog(clipboard).hwnd = $null ) { dialog -ma clipboard clipboard }
    else { dialog -v clipboard clipboard }
  }
  if ( %hobotooldec = 2 ) {
    if ( $dialog(spell).hwnd = $null ) { dialog -ma spell spell }
    else { dialog -v spell spell }
  }
  if ( %hobotooldec = 6 ) {
    if ( $dialog(agent).hwnd = $null ) { dialog -ma agent agent }
    else { dialog -v agent agent }
  }
  if ( %hobotooldec = 5 ) {
    if ( $dialog(hobo-notes).hwnd = $null ) { dialog -ma hobo-notes settings }
    else { dialog -v hobo-notes settings }
  }
  if ( %hobotooldec = 7 ) {
    if ( $dialog(themes).hwnd = $null ) { dialog -ma themes themes }
    if ( $dialog(themes).hwnd != $null ) { dialog -v themes themes }
  }
  if ( %hobotooldec = 8 ) {
    set %hobonotes.tutorial 0
    agent.speak.hobonotes.intro
  }
}
alias dialog.hobonotes {
  if ( $dialog(hobo).hwnd = $null ) { dialog -md hobo hobo }
  if ( $dialog(hobo).hwnd != $null ) { dialog -v hobo hobo }
}
