Skip to content

Commit 07bad30

Browse files
authored
Merge pull request #90 from nexB/85-add-keyboard-shortcuts-for-different-views
Add keyboard shortcuts for different views #85
2 parents 0c21068 + b1183aa commit 07bad30

File tree

3 files changed

+52
-10
lines changed

3 files changed

+52
-10
lines changed

assets/js/renderer.js

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -338,35 +338,53 @@ $(document).ready(function () {
338338
placeholder: "select me"
339339
});
340340

341-
// Show clue DataTable. Hide node view and component summary table
342-
showClueButton.click(function() {
341+
// Show Table View (aka "clue DataTable"). Hide node view and component summary table.
342+
function showTableView() {
343343
cluesContainer.show();
344344
nodeContainer.hide();
345345
componentContainer.hide();
346346
leftCol.addClass('col-md-2').show();
347347
tabBar.removeClass('col-md-11').addClass('col-md-9');
348348
cluesTable.draw();
349-
});
349+
}
350+
351+
// Show clue DataTable. Hide node view and component summary table
352+
showClueButton.click(showTableView);
353+
354+
// Show clue DataTable. Hide node view and component summary table -- custom menu
355+
ipcRenderer.on('table-view', showTableView);
350356

351357
// Show node view. Hide clue and component table
352-
showNodeViewButton.click(function() {
358+
function showNodeView() {
353359
nodeContainer.show();
354360
cluesContainer.hide();
355361
componentContainer.hide();
356362
leftCol.addClass('col-md-2').show();
357363
tabBar.removeClass('col-md-11').addClass('col-md-9');
358364
nodeView.redraw();
359-
});
365+
}
366+
367+
// Show node view. Hide clue and component table
368+
showNodeViewButton.click(showNodeView);
369+
370+
// Show node view. Hide clue and component table -- custom menu
371+
ipcRenderer.on('node-view', showNodeView);
360372

361373
// Show component summary table. Hide DataTable and node view
362-
showComponentButton.click(function() {
374+
function showComponentSummaryView() {
363375
componentContainer.show();
364376
nodeContainer.hide();
365377
cluesContainer.hide();
366378
leftCol.removeClass('col-md-2').hide();
367379
tabBar.removeClass('col-md-9').addClass('col-md-11');
368380
componentsTable.reload();
369-
});
381+
}
382+
383+
// Show component summary table. Hide DataTable and node view
384+
showComponentButton.click(showComponentSummaryView);
385+
386+
// Show component summary table. Hide DataTable and node view -- custom menu
387+
ipcRenderer.on('component-summary-view', showComponentSummaryView);
370388

371389
// Creates the database and all View objects from a SQLite file
372390
function loadDatabaseFromFile(fileName) {

index.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,13 @@
6666
<button class="btn btn-sidebar" id="save-file" data-toggle="tooltip" title="Save SQLite File"><i class="fa fa-floppy-o" aria-hidden="true"></i></button>
6767
</li>
6868
<li>
69-
<button class="btn btn-sidebar" id="show-clue-table" data-toggle="tooltip" title="Table view"><i class="fa fa-table" aria-hidden="true"></i></button>
69+
<button class="btn btn-sidebar" id="show-clue-table" data-toggle="tooltip" title="Table View"><i class="fa fa-table" aria-hidden="true"></i></button>
7070
</li>
7171
<li>
72-
<button class="btn btn-sidebar" id="show-tree" data-toggle="tooltip" title="Conclusions view"><i class="fa fa-code-fork" aria-hidden="true"></i></button>
72+
<button class="btn btn-sidebar" id="show-tree" data-toggle="tooltip" title="Node View"><i class="fa fa-code-fork" aria-hidden="true"></i></button>
7373
</li>
7474
<li>
75-
<button class="btn btn-sidebar" id="show-component-table" data-toggle="modal" data-placement="right" title="Import Components to DejaCode"><i class="fa fa-list-ol" aria-hidden="true"></i></button>
75+
<button class="btn btn-sidebar" id="show-component-table" data-toggle="modal" data-placement="right" title="Component Summary View"><i class="fa fa-list-ol" aria-hidden="true"></i></button>
7676
</li>
7777
<li>
7878
<button class="btn btn-sidebar" id="show-help" data-toggle="modal" data-placement="right" title="Help with Application" data-target="#helpModal"><i class="fa fa-question" aria-hidden="true"></i></button>

main.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,30 @@ function getTemplate() {
113113
{
114114
label: '&View',
115115
submenu: [
116+
{
117+
label: "Table View",
118+
accelerator: 'CmdOrCtrl+T',
119+
click: function (menuItem, currentWindow) {
120+
currentWindow.webContents.send('table-view')
121+
}
122+
},
123+
{
124+
label: "Node View",
125+
accelerator: 'CmdOrCtrl+N',
126+
click: function (menuItem, currentWindow) {
127+
currentWindow.webContents.send('node-view')
128+
}
129+
},
130+
{
131+
label: "Component Summary View",
132+
accelerator: 'Shift+CmdOrCtrl+C',
133+
click: function (menuItem, currentWindow) {
134+
currentWindow.webContents.send('component-summary-view')
135+
}
136+
},
137+
{
138+
type: 'separator'
139+
},
116140
{
117141
label: 'Reload',
118142
accelerator: 'CmdOrCtrl+R',

0 commit comments

Comments
 (0)