selectionToXML

$canvaseditor selectionToXML
copies selection as XML to clipboard

obj method canvaseditor selectionToXML {} {
  global env
  set elements [xmlElement elements {} {*}[lmap obj [my selection] {
        $obj data
      }]]
  set stackList {}
  foreach obj [$self stackSequence] {
    if {[$obj topgroup] in [my selection]} then {
      set id [dict get [$obj data] attribute id]
      lappend stackList [xmlElement item [list ref $id]]
    }
  }
  set meta [xmlComment "
      user: $env(USERNAME)
      time: [clock format [clock seconds] -format {%Y-%m-%d %H:%M:%S}]
  "]
  set stack [xmlElement stack {} {*}$stackList]
  xml unparse [xmlElement selection {} $meta $elements $stack] -pp
}

© Wolf-Dieter Busch | Home | Sitemap | Urheber | A-Z