#ifndef ____editview_h__
#define ____editview_h__

#include "HTTPPage.h"

namespace http {

   class __editview : public HTTPPage {

      int processCommand(std::string request, core::TCPSession *session, HTTPSession *httpSession, HTTPRequest *httpRequest, std::stringstream &data) override {

         data << "  <div style=\"position: relative;\">" << std::endl;
         data << "" << std::endl;
         data << "  <div id=\"window1\" style=\"position: absolute; left: 0px; top: 0px; border: 1pt solid black; display: inline-block; padding: 2px; background: #808080; color: #ffffff;\">" << std::endl;
         data << "" << std::endl;
         data << "  <span style=\"font: 20px bebasneue;\">View Editor</span>" << std::endl;
         data << "" << std::endl;
         data << "  <div id=\"mainpage\" " << std::endl;
         data << "       style=\"width: 600px; height: 600px; border: 1px solid black; position: relative; background: #ffffff;\" " << std::endl;
         data << "       onmousemove=\"mousemove(event); return true;\" " << std::endl;
         data << "       onmouseup=\"mouseup(); return true;\">" << std::endl;
         data << "" << std::endl;
         data << "    <canvas id=\"grid\" width=\"600px\" height=\"600px\" style=\"position: absolute; left: 0px; top: 0px; alpha: 0.5; cursor: normal;\"></canvas>" << std::endl;
         data << "" << std::endl;

         data << "<div id=\"__workspace__\"></div>" << std::endl;

         data << "" << std::endl;
         data << "  <div id=\"window3\" style=\"position:absolute; top: 235px; left: 610px;" << std::endl;
         data << "       border: 1pt solid black; display: inline-block; padding: 2px; background: #808080; color: #ffffff;\">" << std::endl;
         data << "" << std::endl;
         data << "  <span style=\"font: 20px bebasneue;\">OPTIONS</span>" << std::endl;
         data << "" << std::endl;
         data << "  <div style=\"width: 150px; height: 300px; color: #000000; border: 1px solid black; position: relative; background: #ffffff;\" " << std::endl;
         data << "       onmousemove=\"mousemove(event); return true;\" " << std::endl;
         data << "       onmouseup=\"mouseup(); return true;\">  " << std::endl;
         data << "" << std::endl;
         data << "  <div id=\"controls\">" << std::endl;
         data << "    <input type=\"checkbox\" name=\"grid\" onchange=\"showGrid = this.checked; drawGrid(); return true;\"><span style=\"font: 12px bebasneue; margin-bottom: 2px;\">Show Grid</span><br>" << std::endl;
         data << "    <input type=\"checkbox\" name=\"snaptogrid\" onchange=\"snapToGrid = this.checked; return true;\"><span style=\"font: 12px bebasneue; margin-bottom: 2px;\">Snap To Grid</span><br>" << std::endl;
         data << "    <span style=\"font: 12px bebasneue; margin-bottom: 2px;\">Grid Size: </span><input type=\"text\" name=\"gridsize\" id=\"gridsize\" style=\"width: 20px;\" size=\"3\" onchange=\"gridSize = parseInt(this.value); drawGrid(); return true;\"><br>" << std::endl;
         data << "  </div>" << std::endl;
         data << "" << std::endl;
         data << "  <div id=\"itemparameters\" style=\"font: 12px bebasneue;\"></div>" << std::endl;
         data << "" << std::endl;
         data << "  <div id=\"data\" style=\"font: 12px bebasneue;\">" << std::endl;
         data << "   <p>NO DATA</p>" << std::endl;
         data << "  </div>" << std::endl;
         data << "" << std::endl;
         data << "  </div>" << std::endl;
         data << "  </div>" << std::endl;
         data << "" << std::endl;
         data << "" << std::endl;
         data << "  <div id=\"window2\" style=\"position:absolute; top: 0px; left: 610px; border: 1pt solid black; display: inline-block; padding: 2px; background: #808080; color: #ffffff;\">" << std::endl;
         data << "" << std::endl;
         data << "  <span style=\"font: 20px bebasneue;\">Toolbar</span>" << std::endl;
         data << "" << std::endl;
         data << "  <div id=\"toolbar\" " << std::endl;
         data << "       style=\"width: 80px; height: 200px; border: 1px solid black; position: relative; background: #ffffff;\" " << std::endl;
         data << "       onmousemove=\"mousemove(event); return true;\" " << std::endl;
         data << "       onmouseup=\"mouseup(); return true;\">" << std::endl;
         data << "    <button id=\"button1\" " << std::endl;
         data << "       style=\"width: 40px; height: 40px; border: 2px solid green; position: absolute;\"" << std::endl;
         data << "       onmousedown=\"mousedown(this, event); return true;\">Press</button>" << std::endl;
         data << "" << std::endl;
         data << "  </div>" << std::endl;
         data << "  </div>" << std::endl;
         data << "  " << std::endl;
         data << "  </div>  " << std::endl;
         data << "" << std::endl;
         data << "  <script src=\"/__editview_js\" />" << std::endl;

         httpRequest->response.addHeader("Content-Type", "script/javascript");

         return 0;
      }

   };

}

#endif
