;Clipboard
dialog Clipboard {
  title "Clipboard Viewer"
  size -1 -1 92 54
  option dbu
  icon $themeicons(Clipboard), 0
  edit "", 5, 0 0 92 58, multi autovs vsbar return hsbar autohs
  menu "File", 1
  item "Exit", 2, 1
  menu "Edit", 3
  item "Clear Clipboard", 4, 3
  button "", 99, 1 1 1 1
}
on *:dialog:clipboard:init: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,99 Positioner size> $mdx.dialog ),$9,45)
  hobonotes.cboard.load
  did -c hobo 13
}
on *:dialog:clipboard:sclick:99: { dll $mdx.dll MoveControl clipboard 5 * * $calc($dialog(clipboard).cw + 3) $calc($dialog(clipboard).ch + 3) }
on *:dialog:clipboard:edit:5: { clipboard $did($dname,5).text }
on *:dialog:clipboard:menu:2: { 
  did -u hobo 13
  dialog -x clipboard clipboard
}
on *:dialog:clipboard:menu:4: {
  did -r $dname 5
  clipboard $did($dname,5).text
}
on *:dialog:clipboard:close:0: {
  did -u hobo 13
}
;Drag and Drop
dialog Drag {
  title "Drag Drop"
  size 0 0 20 10
  option dbu
  list 1, -1 -1 40 40 , size extsel
}
on *:dialog:drag:init:0: {
  dll $mdx.dll SetMircVersion $version
  dll $mdx.dll MarkDialog $dname  
  dll $mdx.dll SetDialog $dname style title sysmenu tool clientedge
  echo $gettok($dll($mdx.dll,SetControlMDX,1 ListView icon filedragsource noscroll nosortheader droptarget> $mdx.views),$9,45)
  did -i drag 1 1 getdrop 1
  hsettings.write settings dragdrop 1
}
on *:dialog:drag:sclick:1: {
  if ( $gettok($did($dname,$did,1).text,1,32) = drop ) {
    set %file.name.2 $+($shortfn($mdx.page(drag,1).dropinfo))
    hobonotes.dragopen.execute
  }
}
on *:dialog:drag:close:0: {
  hsettings.write settings dragdrop  0
  if ( $dialog(hobo-notes).hwnd != $null ) { did -u hobo-notes 27 }
}
;Logviewer Load
alias hobonotes.logview.load {
  did -r hobo 30 
  did -io hobo 30 1 headerdims 500:1 0:2
  did -io hobo 30 1 headertext +l 0 Log File $tab Path
  if ( $findfile(%hobonotes.logs.dir,*.log,0,1) != 0 ) {
    set %hobonotes.logview.load.1 $findfile(%hobonotes.logs.dir,*.log,0,0)
    var %hobonotes.logview.load.2 1
    while ( %hobonotes.logview.load.2 <= %hobonotes.logview.load.1 ) {
      if ( $findfile(%hobonotes.logs.dir,*.log,%hobonotes.logview.load.2,1) != $null ) {
        hobonotes.logview.display $nopath($findfile(%hobonotes.logs.dir,*.log,%hobonotes.logview.load.2,1)) $findfile(%hobonotes.logs.dir,*.log,%hobonotes.logview.load.2,1).shortfn
        inc %hobonotes.logview.load.2
      }
    }
  }
}
alias hobonotes.settings.logview.checkforlogs {
  if ( %hobonotes.logs.dir != $null ) {
    if ( $findfile(%hobonotes.logs.dir,*.log,0,1) = 0 ) { did -v hobo-notes 16 }
    if ( $findfile(%hobonotes.logs.dir,*.log,0,1) = $null ) { did -v hobo-notes 16 }
    if ( $findfile(%hobonotes.logs.dir,*.log,0,1) >= 1 ) { did -h hobo-notes 16 }
  }
  if ( %hobonotes.logs.dir = $null ) { did -v hobo-notes 16 }
}
alias hobonotes.logview.pathset.checkvalidity {
  while ( %hobonotes.logs.dir = $null ) {
    set %hobonotes.logs.dir $+($shortfn($sdir($mircdir,Select Log Directory))) 
  }
}
alias hobonotes.check.windows.folder {
  if ( %hobonotes.windows.dir = $null ) {
    if ( $finddir(c:\,Windows,1,1) != $null ) {
      set %hobonotes.windows.dir $finddir(c:\,Windows,1,1).shortfn
      hobonotes.check.windows.fonts
    }
    if ( $finddir(c:\,Winnt,1,1) != $null ) {
      set %hobonotes.windows.dir $finddir(c:\,Winnt,1,1).shortfn
      hobonotes.check.windows.fonts
    }
  }
}
