 updatePlayButtons()
 redrawLoop()
 
-application.saveDialog.show()
+#application.saveDialog.show()

#  return parts.join " "
  
doExport = ->
  #data = JSON.stringify(exportField(application.cells))
  data = stringifyFieldData exportField application.cells
  #edata = lzw_encode data

  #data1 = exportTrivial application.cells
  #edata1 = lzw_encode data1
  
  #console.log "Data len before compression: #{data.length}, after compression: #{edata.length}, ratio: #{edata.length/data.length}"
  showExporDialog data

doExportClose = ->
  E('export-dialog').style.display = 'none'

  importData: (data)->
    try
      console.log "importing #{data}"
      match = data.match /^(\d+)\$(\d+)\$(.*)$/
      throw new Error("Data format unrecognized") unless match?
      n = parseIntChecked match[1]
      m = parseIntChecked match[2]

      if n isnt @getGroup().n or m isnt @getGroup().m
        console.log "Need to change grid"
        @setGridImpl n, m
      @cells = importField parseFieldData match[3]
      console.log "Imported #{@cells.count} cells"
    catch e
      alert "Faield to import data: #{e}"
