// The CoqLayoutClassic class. // Copyright (C) 2015-2017 Mines ParisTech/ARMINES // // This class provides a plugabble side panel with proof and query // buffers. import $ from 'jquery'; import { SettingsPanel } from './settings.js'; // Bootstrap import 'bootstrap/dist/css/bootstrap.min.css'; import 'bootstrap/dist/js/bootstrap.bundle.min.js'; // Medias import "../css/landing-page.css"; import "../css/kbd.css"; import '../css/coq-log.css'; import '../css/coq-base.css'; import '../css/coq-light.css'; import '../css/coq-dark.css'; import '../css/settings.css'; /***********************************************************************/ /* The CoqLayout class contains the goal, query, and packages buffer */ /***********************************************************************/ /** * Classical layout: a right panel containing a toolbar with buttons at the * top, and a main area divided vertically into three collapsible panes. * Also shows a power button that hides or shows the panel. * * @class CoqLayoutClassic */ export class CoqLayoutClassic { options : any; ide : HTMLElement; panel : HTMLDivElement; proof : HTMLDivElement; query : HTMLDivElement; packages : HTMLDivElement; buttons : HTMLSpanElement; menubtn : SVGElement settings : SettingsPanel; onToggle : (evt : any) => void; onAction : (evt : any) => void; log_levels : string[]; log_level : number; outline : HTMLDivElement; scrollTimeout? : any; // timeout html(params) { var {base_path, backend, kb} = params; return `
').addClass('splash-above'), $('
').addClass('splash-below') ) } if (version_info) above.text(version_info); if (msg) below.text(msg); image[0].className = ""; image.addClass(['splash-image', mode]); var img = image.find('img'); if (img.attr('src') !== overlay) img.attr('src', overlay); if (mode !== 'wait') this.splashLinks(); } splashLinks() { var bar = $(`
`); // Set icons let icon = fn => `${this.options.base_path}/frontend/classic/images/${fn}`; bar.find('a[href="#quick-help"] img').attr('src', icon('help.svg')).height("1em"); bar.find('a[href="#scratchpad"] img').attr('src', icon('scratchpad.png')).height("1em"); // Set quick-help action bar.find('a[href="#quick-help"]').on('click', ev => { ev.preventDefault(); this.showHelp(); }); // Set scratchpad action bar.find('a[href="#scratchpad"]').attr('href', this.options.links?.scratchpad ?? `${this.options.base_path}/examples/scratchpad.html`); // Ship it bar.prependTo($(this.proof).find('.splash-below')); } createOutline() { var outline_pane : JQuery').addClass('system').text(msg)); } _setButtons(enabled) { if(enabled) { $(this.buttons).find('button').removeAttr('disabled'); this.buttons.classList.remove('disabled') } else { $(this.buttons).find('button').attr('disabled'); this.buttons.classList.add('disabled'); } } toolbarOn() { // Enable the button actions and show them. this._setButtons(true); this.ide.classList.remove('on-hold'); } toolbarOff() { // Disable the button actions and dim them. this._setButtons(false); this.ide.classList.add('on-hold'); } // This is still not optimal. update_goals(content) { // TODO: Add diff/history of goals. // XXX: should send a message. $(this.proof).html(content); } // Add a log event received from Coq. log(text, level, attrs : any = {}) { // Levels are taken from Coq itself: // | Debug | Info | Notice | Warning | Error var item = $('