 
     super options, file
 
+    options.advancedSettings         ?= no
     options.createFindAndReplaceView ?= yes
 
     @listenWindowResize()

      KD.singletons.localSync.removeFromOpenedFiles file
      @getDelegate().removeOpenDocument @

    @ace.on "ace.changeSetting", (setting, value)->
      if setting is "syntax"
        file = @getData()
        fileExtension = file.getExtension()
        appStorage = KD.getSingleton('appStorageController').storage 'Ace', '1.0.1'
        appStorage.setValue "syntax_#{fileExtension}", value

    @ace.on "FileIsReadOnly", =>
      @getActiveTabHandle().setClass "readonly"
      @ace.setReadOnly yes
      modal             = new KDModalView
        title           : "This file is readonly"
        content         : """
        <div class="modalformline">
          <p>

    else
      @findAndReplaceView = new KDCustomHTMLView

    @caretPosition    = new KDCustomHTMLView
      tagName         : 'div'
      cssClass        : 'caret-position section'
      partial         : '<span>1</span>:<span>1</span>'

    @advancedSettings = new KDButtonViewWithMenu
      style           : 'editor-advanced-settings-menu'
      icon            : yes
      iconOnly        : yes
      iconClass       : 'cog'
      type            : 'contextmenu'
      delegate        : this
      itemClass       : AceSettingsView
      click           : (pubInst, event) -> @contextMenu event
      menu            : @getAdvancedSettingsMenuItems.bind this

    @advancedSettings.disable()

    unless options.advancedSettings
      @advancedSettings.hide()

    @setViewListeners()

  setViewListeners:->
    @ace.on 'ace.ready', => @advancedSettings.enable()

    @ace.on 'ace.changeSetting', (setting, value) =>
      @ace["set#{setting.capitalize()}"]? value

    @advancedSettings.emit 'ace.settingsView.setDefaults', @ace

    $spans = @caretPosition.$ 'span'

    @ace.on 'ace.change.cursor', (cursor) =>
      $spans.eq(0).text ++cursor.row
      $spans.eq(1).text ++cursor.column

    @ace.on 'ace.requests.saveAs', (contents, options) =>
      @openSaveDialog options

    @ace.on "ace.requests.save", (contents) =>
      file = @getData()
      if /localfile:/.test file.path
        @openSaveDialog closeAfter: no
      else
        file.once 'fs.save.started',    @ace.bound 'saveStarted'
        file.once 'fs.save.finished',   @ace.bound 'saveFinished'
        file.emit 'file.requests.save', contents

    @ace.on 'FileContentChanged', =>
      @ace.contentChanged = yes
      @getActiveTabHandle().setClass 'modified'
      @getDelegate().quitOptions =
        message : 'You have unsaved changes. You will lose them if you close this tab.'
        title   : 'Do you want to close this tab?'

    @ace.on 'FileContentSynced', =>
      @ace.contentChanged = no
      @getActiveTabHandle().unsetClass 'modified'
      delete @getDelegate().quitOptions

    @on 'KDObjectWillBeDestroyed', =>
