diff --git a/media/html/mackeys.html b/media/html/mackeys.html new file mode 100644 index 0000000..5f4cd71 --- /dev/null +++ b/media/html/mackeys.html @@ -0,0 +1,33 @@ + + + + + + Mind Reader Key Bindings for Mac + + +

Here is a list of all the Mind Reader commands and their keybindings on Mac systems

+

+

Editor Settings

+ Increase Font Scale -
+ Decrease Font Scale -
+ Increase Editor Scale -
+ Decrease Editor Scale -
+ Reset Editor Scale -
+ Select Theme -
+

Navigation

+ Get Indent -
+ Show All Symbols -
+ Go To Line -
+ Quick Open -
+ Go To Symbol -
+ Show Problems -
+ Next In File -
+ Previous In File -
+ Open Previous Editor Group -
+ Navigate Forward -
+ Navigate Back -
+ Get Quick Input Back - +

+ + diff --git a/media/html/main.html b/media/html/main.html new file mode 100644 index 0000000..afd1508 --- /dev/null +++ b/media/html/main.html @@ -0,0 +1,43 @@ + + + + + + Mind Reader + + + +

+

Welcome to Mind_Reader!

+

We are the Single Semester Snobs and this is our tool to Help Blind Students Program Lego Mindstorms Robots in Python.

+ +

Use the following key binding to bring up a page for all key bindings for windows +
+ Control and Shift and 8 +

+

Use this key binding to do the same for mac computers: +
+ Command and Shift and 9 +

+

This is the Lego Spike Prime! +

+ +

+ Get the robot! + + diff --git a/media/html/winkeys.html b/media/html/winkeys.html new file mode 100644 index 0000000..fd89cfa --- /dev/null +++ b/media/html/winkeys.html @@ -0,0 +1,33 @@ + + + + + + Mind Reader Key Bindings for Windows + + +

Here is a list of all Mind Reader's commands and their keybindings on windows and linux systems

+

+

Editor Settings

+ Increase Font Scale - Number Pad Add
+ Decrease Font Scale - Number Pad Subtract
+ Increase Editor Scale - Shift and Number Pad Add
+ Decrease Editor Scale - Shift and Number Pad Subtract
+ Reset Editor Scale - Shift and Enter
+ Select Theme - Control and Shift and 1
+

Navigation

+ Get Indent - Shift and Tab
+ Show All Symbols - Control and T
+ Go To Line - Control and G
+ Quick Open - Control and P
+ Go To Symbol - Control and Shift and 0
+ Show Problems - Control and Shift and M
+ Next In File - F8
+ Previous In File - Shift and F8
+ Open Previous Editor Group - Control and Tab
+ Navigate Forward - Control and Shift and Minus
+ Navigate Back - Control and Alt and Minus
+ Get Quick Input Back - Control and Alt and Minus +

+ + diff --git a/src/commands.ts b/src/commands.ts index d36f78a..64aa0c9 100644 --- a/src/commands.ts +++ b/src/commands.ts @@ -1,5 +1,6 @@ import * as vscode from 'vscode'; import * as pl from './pylex'; +import * as fs from 'fs'; /** * @type {Object} Command // Command to register with the VS Code Extension API @@ -57,11 +58,11 @@ const commands: Command[] = [ { name: 'mind-reader.openKeyBindWin', - callback: openKeyBindWin, + callback: () => openKeyBindWin('Windows') }, { name: 'mind-reader.openKeyBindMac', - callback: openKeyBindMac, + callback: () => openKeyBindWin('Mac'), }, //Navigation Keys...... @@ -173,56 +174,14 @@ function openWebview(): void { {} ); // Webview options. More on these later. - panel.webview.html = getWebviewContent(); + panel.webview.html = getWebviewContent('media/html/main.html'); } -function getWebviewContent() { - return ` - - - - - Mind Reader - - - -

-

Welcome to Mind_Reader!

-

We are the Single Semester Snobs and this is our tool to Help Blind Students Program Lego Mindstorms Robots in Python.

- -

Use the following key binding to bring up a page for all key bindings for windows -
- Control and Shift and 8 -

-

Use this key binding to do the same for mac computers: -
- Command and Shift and 9 -

-

This is the Lego Spike Prime! -

- -

- Get the robot! - - `; +function getWebviewContent(filepath: string) { + return fs.readFileSync(filepath, {encoding: 'utf-8'}); } -function openKeyBindWin(): void { +function openKeyBindWin(os: 'Mac' | 'Windows'): void { //vscode.commands.executeCommand('workbench.action.zoomOut'); const panel = vscode.window.createWebviewPanel( 'mindReader', // Identifies the type of the webview. Used internally @@ -231,94 +190,13 @@ function openKeyBindWin(): void { {} ); // Webview options. More on these later. - panel.webview.html = getKeyBindWinContent(); + if (os === 'Windows') { + panel.webview.html = getWebviewContent('media/html/winkeys.html'); + } else if (os === 'Mac') { + panel.webview.html = getWebviewContent('media/html/mackeys.html'); + } } -function getKeyBindWinContent() { - return ` - - - - - Mind Reader Key Bindings for Windows - - -

Here is a list of all Mind Reader's commands and they're keybindings on windows and linux systems

-

-

Editor Settings

- Increase Font Scale - Number Pad Add
- Decrease Font Scale - Number Pad Subtract
- Increase Editor Scale - Shift and Number Pad Add
- Decrease Editor Scale - Shift and Number Pad Subtract
- Reset Editor Scale - Shift and Enter
- Select Theme - Control and Shift and 1
-

Navigation

- Get Indent - Shift and Tab
- Show All Symbols - Control and T
- Go To Line - Control and G
- Quick Open - Control and P
- Go To Symbol - Control and Shift and 0
- Show Problems - Control and Shift and M
- Next In File - F8
- Previous In File - Shift and F8
- Open Previous Editor Group - Control and Tab
- Navigate Forward - Control and Shift and Minus
- Navigate Back - Control and Alt and Minus
- Get Quick Input Back - Control and Alt and Minus -

- - `; -} - -function openKeyBindMac(): void { - //vscode.commands.executeCommand('workbench.action.zoomOut'); - const panel = vscode.window.createWebviewPanel( - 'mindReader', // Identifies the type of the webview. Used internally - 'MR Key Bindings', // Title of the panel displayed to the user - vscode.ViewColumn.One, // Editor column to show the new webview panel in. - {} - ); // Webview options. More on these later. - - panel.webview.html = getKeyBindMacContent(); -} - -function getKeyBindMacContent() { - return ` - - - - - Mind Reader Key Bindings for Mac - - -

Here is a list of all the Mind Reader commands and they're keybindings on Mac systems

-

-

Editor Settings

- Increase Font Scale -
- Decrease Font Scale -
- Increase Editor Scale -
- Decrease Editor Scale -
- Reset Editor Scale -
- Select Theme -
-

Navigation

- Get Indent -
- Show All Symbols -
- Go To Line -
- Quick Open -
- Go To Symbol -
- Show Problems -
- Next In File -
- Previous In File -
- Open Previous Editor Group -
- Navigate Forward -
- Navigate Back -
- Get Quick Input Back - -

- - `; -} - - function getIndent(): void { let editor = vscode.window.activeTextEditor; if(editor)