diff --git a/ivette/Makefile b/ivette/Makefile index bde89ca5f3448b5e1f3f7531d55b2bbf62eda872..35d6c5d87446432f6e6d2f8a57a6c99cd7a5de16 100644 --- a/ivette/Makefile +++ b/ivette/Makefile @@ -24,6 +24,11 @@ lint: dome-pkg dome-templ @echo "[Ivette] running ts linter" yarn run lint +fixlint: dome-pkg dome-templ + @echo "[Ivette] running ts linter (with fix)" + yarn run lint --fix + + # -------------------------------------------------------------------------- # --- Ivette Documentation # -------------------------------------------------------------------------- diff --git a/ivette/src/dome/src/main/menubar.js b/ivette/src/dome/src/main/menubar.js index 8435e522ff4fa418c7ebdc04f361cde493890b83..061b1b6a1cf4f4c153dc620bcd4fbcbb653c5664 100644 --- a/ivette/src/dome/src/main/menubar.js +++ b/ivette/src/dome/src/main/menubar.js @@ -9,13 +9,19 @@ import * as System from 'dome/system' ; // --- Special Callbacks // -------------------------------------------------------------------------- -function reloadWindow(item, focusedWindow) +function reloadWindow(item) { - if (focusedWindow) { - reset(); // declared below - focusedWindow.send('dome.ipc.closing'); - focusedWindow.reload(); - } + reset(); // declared below + BrowserWindow.getAllWindows().forEach((win) => { + if (win) { + try { + win.send('dome.ipc.closing'); + win.reload(); + } catch(err) { + console.warn('[Reload]',win.id,err); + } + }; + }); } function toggleFullScreen(item, focusedWindow) diff --git a/ivette/src/dome/src/renderer/controls/icons.json b/ivette/src/dome/src/renderer/controls/icons.json index 1afd562e8e04d7a5fdfbb1255a5345dbd1e86987..681bb6d5286a132d76594580042d864e12cec557 100644 --- a/ivette/src/dome/src/renderer/controls/icons.json +++ b/ivette/src/dome/src/renderer/controls/icons.json @@ -5,6 +5,36 @@ "viewBox": "0 0 22 24", "path": "M15.429 11.143q0-2.478-1.761-4.239t-4.239-1.761-4.239 1.761-1.761 4.239 1.761 4.239 4.239 1.761 4.239-1.761 1.761-4.239zM22.286 22.286q0 0.696-0.509 1.205t-1.205 0.509q-0.723 0-1.205-0.509l-4.594-4.58q-2.397 1.661-5.344 1.661-1.915 0-3.663-0.743t-3.013-2.009-2.009-3.013-0.743-3.663 0.743-3.663 2.009-3.013 3.013-2.009 3.663-0.743 3.663 0.743 3.013 2.009 2.009 3.013 0.743 3.663q0 2.946-1.661 5.344l4.594 4.594q0.496 0.496 0.496 1.205z" }, + "ZOOM.IN": { + "section": "Tools", + "title": "Zoom In", + "viewBox": "0 0 15 16", + "path": "M9.143 7.143v0.571q0 0.116-0.085 0.201t-0.201 0.085h-2v2q0 0.116-0.085 0.201t-0.201 0.085h-0.571q-0.116 0-0.201-0.085t-0.085-0.201v-2h-2q-0.116 0-0.201-0.085t-0.085-0.201v-0.571q0-0.116 0.085-0.201t0.201-0.085h2v-2q0-0.116 0.085-0.201t0.201-0.085h0.571q0.116 0 0.201 0.085t0.085 0.201v2h2q0.116 0 0.201 0.085t0.085 0.201zM10.286 7.429q0-1.652-1.174-2.826t-2.826-1.174-2.826 1.174-1.174 2.826 1.174 2.826 2.826 1.174 2.826-1.174 1.174-2.826zM14.857 14.857q0 0.473-0.335 0.808t-0.808 0.335q-0.482 0-0.804-0.339l-3.063-3.054q-1.598 1.107-3.563 1.107-1.277 0-2.442-0.496t-2.009-1.339-1.339-2.009-0.496-2.442 0.496-2.442 1.339-2.009 2.009-1.339 2.442-0.496 2.442 0.496 2.009 1.339 1.339 2.009 0.496 2.442q0 1.964-1.107 3.563l3.063 3.063q0.33 0.33 0.33 0.804z" + }, + "ZOOM.OUT": { + "section": "Tools", + "title": "Zoom Out", + "viewBox": "0 0 15 16", + "path": "M9.143 7.143v0.571q0 0.116-0.085 0.201t-0.201 0.085h-5.143q-0.116 0-0.201-0.085t-0.085-0.201v-0.571q0-0.116 0.085-0.201t0.201-0.085h5.143q0.116 0 0.201 0.085t0.085 0.201zM10.286 7.429q0-1.652-1.174-2.826t-2.826-1.174-2.826 1.174-1.174 2.826 1.174 2.826 2.826 1.174 2.826-1.174 1.174-2.826zM14.857 14.857q0 0.473-0.335 0.808t-0.808 0.335q-0.482 0-0.804-0.339l-3.063-3.054q-1.598 1.107-3.563 1.107-1.277 0-2.442-0.496t-2.009-1.339-1.339-2.009-0.496-2.442 0.496-2.442 1.339-2.009 2.009-1.339 2.442-0.496 2.442 0.496 2.009 1.339 1.339 2.009 0.496 2.442q0 1.964-1.107 3.563l3.063 3.063q0.33 0.33 0.33 0.804z" + }, + "PAINTBRUSH": { + "section": "Tools", + "title": "Paint Brush", + "viewBox": "0 0 16 16", + "path": "M14.42 0q0.625 0 1.094 0.415t0.469 1.040q0 0.563-0.402 1.348-2.964 5.616-4.152 6.714-0.866 0.813-1.946 0.813-1.125 0-1.933-0.826t-0.808-1.96q0-1.143 0.821-1.893l5.696-5.17q0.527-0.482 1.161-0.482zM6.304 9.232q0.348 0.679 0.951 1.161t1.344 0.679l0.009 0.634q0.036 1.902-1.156 3.098t-3.112 1.196q-1.098 0-1.946-0.415t-1.362-1.138-0.772-1.634-0.259-1.964q0.063 0.045 0.366 0.268t0.554 0.397 0.527 0.326 0.411 0.152q0.366 0 0.491-0.33 0.223-0.589 0.513-1.004t0.621-0.679 0.786-0.424 0.92-0.228 1.116-0.094z" + }, + "WRAPTEXT": { + "section": "Tools", + "title": "Wrap Text", + "viewBox": "0 0 24 24", + "path": "M5 7h14c.55 0 1-.45 1-1s-.45-1-1-1H5c-.55 0-1 .45-1 1s.45 1 1 1zm11.83 4H5c-.55 0-1 .45-1 1s.45 1 1 1h12.13c1 0 1.93.67 2.09 1.66.21 1.25-.76 2.34-1.97 2.34H15v-.79c0-.45-.54-.67-.85-.35l-1.79 1.79c-.2.2-.2.51 0 .71l1.79 1.79c.32.32.85.09.85-.35V19h2c2.34 0 4.21-2.01 3.98-4.39-.2-2.08-2.06-3.61-4.15-3.61zM9 17H5c-.55 0-1 .45-1 1s.45 1 1 1h4c.55 0 1-.45 1-1s-.45-1-1-1z" + }, + "CODE": { + "section": "Tools", + "title": "Source Code", + "viewBox": "0 0 26 24", + "path": "M8.263 18.737l-0.67 0.67q-0.134 0.134-0.308 0.134t-0.308-0.134l-6.241-6.241q-0.134-0.134-0.134-0.308t0.134-0.308l6.241-6.241q0.134-0.134 0.308-0.134t0.308 0.134l0.67 0.67q0.134 0.134 0.134 0.308t-0.134 0.308l-5.263 5.263 5.263 5.263q0.134 0.134 0.134 0.308t-0.134 0.308zM16.179 4.446l-4.996 17.29q-0.054 0.174-0.208 0.261t-0.315 0.033l-0.83-0.228q-0.174-0.054-0.261-0.208t-0.033-0.328l4.996-17.29q0.054-0.174 0.208-0.261t0.315-0.033l0.83 0.228q0.174 0.054 0.261 0.208t0.033 0.328zM24.978 13.165l-6.241 6.241q-0.134 0.134-0.308 0.134t-0.308-0.134l-0.67-0.67q-0.134-0.134-0.134-0.308t0.134-0.308l5.263-5.263-5.263-5.263q-0.134-0.134-0.134-0.308t0.134-0.308l0.67-0.67q0.134-0.134 0.308-0.134t0.308 0.134l6.241 6.241q0.134 0.134 0.134 0.308t-0.134 0.308z" + }, "EXECUTE": { "section": "Tools", "viewBox": "0 0 16 16", @@ -315,5 +345,4 @@ "viewBox": "0 0 21 16", "path": "M5.714 14.571l3.429-1.714v-2.804l-3.429 1.464v3.054zM5.143 10.518l3.607-1.545-3.607-1.545-3.607 1.545zM14.857 14.571l3.429-1.714v-2.804l-3.429 1.464v3.054zM14.286 10.518l3.607-1.545-3.607-1.545-3.607 1.545zM10.286 7.902l3.429-1.473v-2.375l-3.429 1.464v2.384zM9.714 4.518l3.938-1.688-3.938-1.688-3.938 1.688zM19.429 9.143v3.714q0 0.321-0.17 0.598t-0.464 0.42l-4 2q-0.223 0.125-0.509 0.125t-0.509-0.125l-4-2q-0.045-0.018-0.063-0.036-0.018 0.018-0.063 0.036l-4 2q-0.223 0.125-0.509 0.125t-0.509-0.125l-4-2q-0.295-0.143-0.464-0.42t-0.17-0.598v-3.714q0-0.339 0.192-0.625t0.504-0.429l3.875-1.661v-3.571q0-0.339 0.192-0.625t0.504-0.429l4-1.714q0.205-0.089 0.446-0.089t0.446 0.089l4 1.714q0.313 0.143 0.504 0.429t0.192 0.625v3.571l3.875 1.661q0.321 0.143 0.509 0.429t0.188 0.625z" } - } diff --git a/ivette/src/dome/src/renderer/controls/style.css b/ivette/src/dome/src/renderer/controls/style.css index a6986b056761d6525ac544183090ae4b726ce1ad..402bb4f98f39a049df63a45cc908ffbfb150d9d5 100644 --- a/ivette/src/dome/src/renderer/controls/style.css +++ b/ivette/src/dome/src/renderer/controls/style.css @@ -273,32 +273,28 @@ /* -------------------------------------------------------------------------- */ .dome-xIconButton { - margin: 4px ; + margin: 2px ; + padding: 2px ; background: transparent ; } -.dome-xIconButton:hover { - fill: #00b6ff ; -} +.dome-xIconButton:hover { fill: #000 ; background: #c0c0c0 ; } -.dome-xIconButton-default { - fill: #777 ; -} +.dome-xIconButton-default { fill: #777 ; } -.dome-xIconButton-selected { fill: #449bef ; } +.dome-xIconButton-selected:not(:hover) { fill: #449bef ; } +.dome-xIconButton-selected:hover { fill: #c54dae ; } .dome-xIconButton-positive { fill: #00d000 ; } .dome-xIconButton-negative { fill: #fb3832 ; } -.dome-xIconButton-warning { - fill: #449bef ; -} +.dome-xIconButton-warning { fill: orange ; } .dome-xIconButton.dome-control-disabled, -.dome-xIconButton.dome-control-disabled:hover -{ - fill: #eee ; +.dome-xIconButton.dome-control-disabled:hover { + fill: #aeafae ; + background: inherit ; } .dome-xIconButton.dome-control-hidden { diff --git a/ivette/src/dome/src/renderer/dome.js b/ivette/src/dome/src/renderer/dome.js index a50223b1aaf9e79850f1df144ff227e6acf79430..81de82545f3b09c424f98fb8c1b1710362bbf3e1 100644 --- a/ivette/src/dome/src/renderer/dome.js +++ b/ivette/src/dome/src/renderer/dome.js @@ -431,7 +431,7 @@ const fireSaveSettings = _.debounce( ipcRenderer.send( 'dome.ipc.settings.window', settingsPatches ) ; settingsPatches = {} ; } - }, 200 + }, 100 ); const fireSaveGlobals = _.debounce( @@ -440,7 +440,7 @@ const fireSaveGlobals = _.debounce( ipcRenderer.send( 'dome.ipc.settings.global', globalPatches ) ; globalPatches = {} ; } - }, 200 + }, 100 ); ipcRenderer.on('dome.ipc.closing', (_evt) => { diff --git a/ivette/src/dome/src/renderer/text/editors.js b/ivette/src/dome/src/renderer/text/editors.js index db98d1a8fb8a88164d73a7ddc00bea35230313b5..a2efb0ea1c654779e3330937071fac753ad591a2 100644 --- a/ivette/src/dome/src/renderer/text/editors.js +++ b/ivette/src/dome/src/renderer/text/editors.js @@ -10,6 +10,7 @@ import _ from 'lodash' ; import React from 'react' ; import * as Dome from 'dome' ; +import { Vfill } from 'dome/layout/boxes' ; import CodeMirror from 'codemirror/lib/codemirror.js' ; import './style.css' ; @@ -18,63 +19,20 @@ import 'codemirror/lib/codemirror.css' ; const CSS_HOVERED = 'dome-xText-hover' ; const CSS_SELECTED = 'dome-xText-select' ; +const getConfig = ({ + buffer, + selection, + onSelection, + onContextMenu, + fontSize, + ...config +}) => config; + // -------------------------------------------------------------------------- -// --- Text View +// --- Code Mirror Instance Wrapper // -------------------------------------------------------------------------- -/** - @class - @summary Rich Text Editor. - @property {Buffer} buffer - associated Buffer holding the text content - @property {string} className - additional class name(s) - @property {object} style - additional CSS style - @property {number} fontSize - editor font-size - @property {string} selection - currently selected markder identifier - @property {function} onSelection - callback used when an identified marker is clicked - @property {function} onContextMenu - selection callback on right-click - @property {object} [...options] - additional CodeMirror - [configuration](https://codemirror.net/doc/manual.html#config) properties - @description - - A component rendering the content of a text buffer, that shall be instances - of the `Buffer` base class. - - The view is based on a [CodeMirror](https://codemirror.net) component linked with - the internal Code Mirror Document from the associated buffer. - - Multiple views might share the same buffer as source content. The buffer will be - kept in sync with all its linked views. - - The Text component never update its mounted NODE element, however, all property - modifications (including buffer) are propagated to the internal CodeMirror instance. - Undefined properties are set (or reset) to the CodeMirror defaults. - - ##### Themes - - The CodeMirror `theme` option allow you to style your document, - especially when using modes. - Themes are only accessible if you load the associated CSS style sheet. - For instance, to use the `'ambiance'` theme provided with CodeMirror, you shall - import `'codemirror/theme/ambiance.css'` somewhere in your application. - - ##### Modes & Adds-On - - You can install modes and adds-on provided by the CodeMirror distribution by - simply importing (once, before being used) the associated modules in your - application. For instance, to use the `'javascript'` mode option, you shall - import `'codemirror/mode/javascript/javascript.js'` file in your application. - - ##### Further Customization - - You can register your own extensions directly into the global `CodeMirror` - class instance. However, the correct instance must be retrieved by using - `import CodeMirror from 'codemirror/lib/codemirror.js'` ; using `from - 'codemirror'` returns a different instance of `CodeMirror` class and will - not work. - - */ - -export class Text extends React.Component { +class CodeMirrorWrapper extends React.Component { constructor(props) { super(props); @@ -104,15 +62,9 @@ export class Text extends React.Component { this.rootElement = elt ; if (elt) { // Mounting... - const { buffer, - selection, /* ignored */ - onSelection, /* ignored */ - onContextMenu, /* ignored */ - fontSize, /* ignored */ - className, /* ignored */ - style, /* ignored */ - ...config } = this.props ; - const cm = this.codeMirror = new CodeMirror(elt, { value: "" }); + const { buffer } = this.props; + const config = getConfig(this.props); + const cm = this.codeMirror = new CodeMirror(elt, { value: '' }); if (buffer) buffer.link(cm); // Passing all options to constructor does not work (Cf. CodeMirror's BTS) for (var opt in config) cm.setOption( opt , config[opt] ); @@ -336,17 +288,23 @@ export class Text extends React.Component { const cm = this.codeMirror ; if (cm) { // Swap documents if necessary - const { buffer:oldBuffer, - selection:oldSelect, - ...oldConfig } = this.props ; - const { buffer:newBuffer, - selection:newSelect, - ...newConfig } = newProps ; + const { + buffer:oldBuffer, + selection:oldSelect, + fontSize:oldFont + } = this.props; + const { + buffer:newBuffer, + selection:newSelect, + fontSize:newFont + } = newProps ; if (oldBuffer !== newBuffer) { if (oldBuffer) oldBuffer.unlink(cm); if (newBuffer) newBuffer.link(cm); else cm.clear(); } + const oldConfig = getConfig(this.props); + const newConfig = getConfig(newProps); // Incremental update options var opt ; for ( opt in oldConfig ) if (!(opt in newConfig)) { @@ -366,18 +324,16 @@ export class Text extends React.Component { if (oldSelect) this._unmarkElementsWith( CSS_SELECTED ); if (newSelect) this._markElementsWith( 'dome-xMark-' + newSelect, CSS_SELECTED ); } + // Refresh on new font + if ( oldFont !== newFont ) setImmediate(this.refresh); } // Keep mounted node unchanged return false; } render() { - const { className, fontSize, style } = this.props ; - const theStyle = Object.assign( {} , style ); - if (fontSize) theStyle.fontSize = fontSize ; return ( - <div className={'dome-xText ' + className} - style={theStyle} + <div className={'dome-xText'} ref={this.mountPoint} onClick={this.onClick} onContextMenu={this.onContextMenu} @@ -391,3 +347,70 @@ export class Text extends React.Component { } // -------------------------------------------------------------------------- +// --- Text View +// -------------------------------------------------------------------------- + +/** + @summary Rich Text Editor. + @property {Buffer} buffer - associated Buffer holding the text content + @property {string} className - additional class name(s) + @property {object} style - additional CSS style + @property {number} fontSize - editor font-size + @property {string} selection - currently selected markder identifier + @property {function} onSelection - callback used when an identified marker is clicked + @property {function} onContextMenu - selection callback on right-click + @property {object} [...options] - additional CodeMirror + [configuration](https://codemirror.net/doc/manual.html#config) properties + @description + + A component rendering the content of a text buffer, that shall be instances + of the `Buffer` base class. + + The view is based on a [CodeMirror](https://codemirror.net) component linked with + the internal Code Mirror Document from the associated buffer. + + Multiple views might share the same buffer as source content. The buffer will be + kept in sync with all its linked views. + + The Text component never update its mounted NODE element, however, all property + modifications (including buffer) are propagated to the internal CodeMirror instance. + Undefined properties are set (or reset) to the CodeMirror defaults. + + ##### Themes + + The CodeMirror `theme` option allow you to style your document, + especially when using modes. + Themes are only accessible if you load the associated CSS style sheet. + For instance, to use the `'ambiance'` theme provided with CodeMirror, you shall + import `'codemirror/theme/ambiance.css'` somewhere in your application. + + ##### Modes & Adds-On + + You can install modes and adds-on provided by the CodeMirror distribution by + simply importing (once, before being used) the associated modules in your + application. For instance, to use the `'javascript'` mode option, you shall + import `'codemirror/mode/javascript/javascript.js'` file in your application. + + ##### Further Customization + + You can register your own extensions directly into the global `CodeMirror` + class instance. However, the correct instance must be retrieved by using + `import CodeMirror from 'codemirror/lib/codemirror.js'` ; using `from + 'codemirror'` returns a different instance of `CodeMirror` class and will + not work. + + */ +export function Text(props) { + let { className, style, fontSize, ...cmprops } = props ; + if (fontSize < 4) fontSize = 4; + if (fontSize > 48) fontSize = 48; + const theStyle = Object.assign( {} , style ); + theStyle.fontSize = fontSize ; + return ( + <Vfill className={className} style={theStyle}> + <CodeMirrorWrapper fontSize={fontSize} {...cmprops}/> + </Vfill> + ); +} + +// -------------------------------------------------------------------------- diff --git a/ivette/src/dome/src/renderer/text/style.css b/ivette/src/dome/src/renderer/text/style.css index be7f8ea0dd15cccbb7f192d1f42ba4541f7073e2..425a00b769c4956576bc4f332ba3eff52106bafb 100644 --- a/ivette/src/dome/src/renderer/text/style.css +++ b/ivette/src/dome/src/renderer/text/style.css @@ -12,6 +12,8 @@ .dome-xText .CodeMirror { width: 100% ; height: 100% ; + line-height: 1.2 !important; + text-shadow: none !important; } .dome-xText-hover { diff --git a/ivette/src/renderer/ASTview.tsx b/ivette/src/renderer/ASTview.tsx index 2399b2410f5bbafc71e72290935fa1a529daa215..cc6bfd19604fddda5a2e51e81547ebca89db3be0 100644 --- a/ivette/src/renderer/ASTview.tsx +++ b/ivette/src/renderer/ASTview.tsx @@ -6,13 +6,22 @@ import React from 'react'; import * as Server from 'frama-c/server'; import * as States from 'frama-c/states'; -import { Vfill } from 'dome/layout/boxes'; +import * as Dome from 'dome'; import { RichTextBuffer } from 'dome/text/buffers'; import { Text } from 'dome/text/editors'; -import { Component } from 'frama-c/LabViews'; +import { IconButton } from 'dome/controls/buttons'; +import { Component, TitleBar } from 'frama-c/LabViews'; import 'codemirror/mode/clike/clike'; import 'codemirror/theme/ambiance.css'; +import 'codemirror/theme/solarized.css'; + +const THEMES = [ + { id: 'default', label: 'Default' }, + { id: 'ambiance', label: 'Ambiance' }, + { id: 'solarized light', label: 'Solarized Light' }, + { id: 'solarized dark', label: 'Solarized Dark' }, +]; // -------------------------------------------------------------------------- // --- Rich Text Printer @@ -65,6 +74,10 @@ const ASTview = () => { const buffer = React.useMemo(() => new RichTextBuffer(), []); const printed = React.useRef(); const [select, setSelect] = States.useSelection(); + const [theme, setTheme] = Dome.useGlobalSetting('ASTview.theme', 'default'); + const [fontSize, setFontSize] = Dome.useGlobalSetting('ASTview.fontSize', 12); + const [wrapText, setWrapText] = Dome.useSwitch('ASTview.wrapText', false); + const theFunction = select && select.function; const theMarker = select && select.marker; @@ -82,20 +95,57 @@ const ASTview = () => { }, [buffer, theMarker]); // Callbacks + const zoomIn = () => fontSize < 48 && setFontSize(fontSize + 2); + const zoomOut = () => fontSize > 4 && setFontSize(fontSize - 2); const onSelection = (marker: any) => setSelect({ marker }); + // Theme Popup + + const selectTheme = (id?: string) => id && setTheme(id); + const checkTheme = + (th: { id: string }) => ({ checked: th.id === theme, ...th }); + const themePopup = + () => Dome.popupMenu(THEMES.map(checkTheme), selectTheme); + // Component return ( - <Vfill> + <> + <TitleBar> + <IconButton + icon="ZOOM.OUT" + onClick={zoomOut} + disabled={!theFunction} + title="Decrease font size" + /> + <IconButton + icon="ZOOM.IN" + onClick={zoomIn} + disabled={!theFunction} + title="Increase font size" + /> + <IconButton + icon="PAINTBRUSH" + onClick={themePopup} + title="Choose theme" + /> + <IconButton + icon="WRAPTEXT" + selected={wrapText} + onClick={setWrapText} + title="Wrap text" + /> + </TitleBar> <Text buffer={buffer} mode="text/x-csrc" - theme="ambiance" + theme={theme} + fontSize={fontSize} + lineWrapping={wrapText} selection={theMarker} onSelection={onSelection} readOnly /> - </Vfill> + </> ); }; diff --git a/ivette/src/renderer/Controller.tsx b/ivette/src/renderer/Controller.tsx index a92c1aa39ccf2731e2727834615507aca68d0644..60387fdd6c8e15333575e7cf1855d879a70a1036 100644 --- a/ivette/src/renderer/Controller.tsx +++ b/ivette/src/renderer/Controller.tsx @@ -168,7 +168,11 @@ const RenderConsole = () => { return ( <> <TitleBar label={command ? 'Command Line' : 'Console'}> - <Label className="dimmed" display={command && length > 0}> + <Label + className="dimmed" + display={command && length > 0} + title="Rank in History" + > {1 + index}/{length} </Label> <Space /> @@ -205,20 +209,20 @@ const RenderConsole = () => { display={command} disabled={!next} onClick={doNext} - title="Previous Command" + title="Next Command" /> <Space /> <IconButton icon="MEDIA.PLAY" display={command} onClick={doExec} - title="Execute Command Line" + title="Execute Command" /> <IconButton icon="EDIT" selected={command} onClick={switchCmd} - title="Edit Command Line" + title="Edit Command" /> </TitleBar> <Text diff --git a/ivette/src/renderer/Preferences.js b/ivette/src/renderer/Preferences.js index 542d1d7c97a42463aa3f0f6f528e1262b58a4e07..7a9d1f76f585e32a17058ba1bd3c7151644aa108 100644 --- a/ivette/src/renderer/Preferences.js +++ b/ivette/src/renderer/Preferences.js @@ -13,8 +13,43 @@ import React from 'react' ; +import * as Dome from 'dome'; +import { Form, Section, FieldSelect, FieldCheckbox, FieldSlider } from 'dome/layout/forms' ; + +const ASTviewPrefs = () => { + + const [theme, setTheme] = Dome.useGlobalSetting('ASTview.theme', 'default'); + const [fontSize, setFontSize] = Dome.useGlobalSetting('ASTview.fontSize', 12); + + return ( + <React.Fragment> + <Form> + <Section label="AST View" unfold={true}> + <FieldSelect + value={theme} + onChange={setTheme} + label="Theme" + title="Set the color theme of the AST source code"> + <option value='default' label='Default'/> + <option value='ambiance' label='Ambiance'/> + <option value='solarized light' label='Solarized light'/> + <option value='solarized dark' label='Solarized dark'/> + </FieldSelect> + <FieldSlider + value={fontSize} + onChange={setFontSize} + label="Font Size" + title="Set the font size of the AST source code" + min={8} + max={32} + step={2} + /> + </Section> + </Form> + </React.Fragment> + ); +} + export default (() => ( - <h1 className='dome-text-title' style={{margin: 24}}> - Settings (none) - </h1> + <ASTviewPrefs/> ));