//-/////////////////////////////////////////////////////////////////////////////
//-                                                                           //
//-               This file is part of the Buildbotics firmware.              //
//-                                                                           //
//-      Copyright (c) 2015 - 2021, Buildbotics LLC, All rights reserved.     //
//-                                                                           //
//-       This Source describes Open Hardware and is licensed under the       //
//-                               CERN-OHL-S v2.                              //
//-                                                                           //
//-       You may redistribute and modify this Source and make products       //
//-  using it under the terms of the CERN-OHL-S v2 (https:/cern.ch/cern-ohl). //
//-         This Source is distributed WITHOUT ANY EXPRESS OR IMPLIED         //
//-  WARRANTY, INCLUDING OF MERCHANTABILITY, SATISFACTORY QUALITY AND FITNESS //
//-   FOR A PARTICULAR PURPOSE. Please see the CERN-OHL-S v2 for applicable   //
//-                                conditions.                                //
//-                                                                           //
//-              Source location: https://github.com/buildbotics              //
//-                                                                           //
//-    As per CERN-OHL-S v2 section 4, should You produce hardware based on   //
//-  these sources, You must maintain the Source Location clearly visible on  //
//-  the external case of the CNC Controller or other product you make using  //
//-                                this Source.                               //
//-                                                                           //
//-              For more information, email info@buildbotics.com             //
//-                                                                           //
//-/////////////////////////////////////////////////////////////////////////////

script#view-editor-template(type="text/x-template")
  div
    nav.navbar
      nav-item
        | File
        .fa.fa-caret-down

        nav-menu
          nav-item(@click="new_file()")
            .fa.fa-file
            span New

          nav-item(@click="open()")
            .fa.fa-folder-open
            span Open

          nav-item(@click="save()", :disabled="!modified")
            .fa.fa-save
            span Save

          nav-item(@click="save_as()")
            .fa.fa-save
            span Save As

          nav-item(@click="revert()", :disabled="!modified")
            .fa.fa-undo
            span Revert

          nav-item(@click="download()")
            .fa.fa-download
            span Download
            a(v-el:download, style="display:none", :download="basename")

          nav-item(@click="view()", v-if="$root.webGLSupported")
            .fa.fa-eye
            span View

          nav-item(@click="$root.run(path)", :disabled="state.xx != 'READY'")
            .fa.fa-play
            span Run

      nav-item
        | Edit
        .fa.fa-caret-down
        nav-menu
          nav-item(@click="undo()", :disabled="!canUndo")
            .fa.fa-undo
            span Undo
            span Ctrl-Z

          nav-item(@click="redo()", :disabled="!canRedo")
            .fa.fa-repeat
            span Redo
            span Ctrl-Y

          nav-item(@click="copy()")
            .fa.fa-clone
            span Copy
            span Ctrl-C

          nav-item(@click="cut()")
            .fa.fa-scissors
            span Cut
            span Ctrl-X

          nav-item(@click="paste()")
            .fa.fa-clipboard
            span Paste
            span Ctrl-V

      .filename {{filename}}

    loading-message(v-if="loading")
    textarea(v-el:textarea)
