Skip to content

Commit 6f8fad2

Browse files
committed
v0.4.1 - Improvements, MacOS fixes
1 parent 1ad2511 commit 6f8fad2

6 files changed

Lines changed: 101 additions & 125 deletions

File tree

.idea/workspace.xml

Lines changed: 81 additions & 115 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "tch-filector",
33
"productName": "FileCtor",
4-
"version": "0.4.0",
4+
"version": "0.4.1",
55
"author": "Tomas Chyly <chyly@tomas-chyly.com> (https://tomas-chyly.com/en/)",
66
"license": "GPL v3",
77
"description": "File inspector with interactive console.",

src/component/Tabs.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,15 @@ class Tabs extends Component {
2323
this.additionalTabsSelect = undefined;
2424

2525
let tabs = [];
26+
let selectedTab = undefined;
2627

2728
if (typeof (this.props.startTabs) !== 'undefined' && this.props.startTabs !== null && Array.isArray (this.props.startTabs)) {
2829
for (let i = 0; i < this.props.startTabs.length; i++) {
2930
tabs.push (this.AddTab (this.props.startTabs [i]));
31+
32+
if (typeof (this.props.startSelectedTab) !== 'undefined' && this.props.startTabs [i].id === this.props.startSelectedTab) {
33+
selectedTab = this.props.startSelectedTab;
34+
}
3035
}
3136
} else {
3237
let startWith = typeof (props.startWith) !== 'undefined' ? parseInt (props.startWith) : 0;
@@ -37,7 +42,9 @@ class Tabs extends Component {
3742
}
3843
}
3944

40-
let selectedTab = tabs.length > 0 ? tabs [0].id : undefined;
45+
if (typeof (selectedTab) === 'undefined') {
46+
selectedTab = tabs.length > 0 ? tabs [0].id : undefined;
47+
}
4148

4249
this.state = {
4350
tabs: tabs,
@@ -74,7 +81,7 @@ class Tabs extends Component {
7481
this.UpdateActiveNavigation ();
7582

7683
if (typeof (this.props.tabsSave) === 'function') {
77-
this.props.tabsSave (this.state.tabs);
84+
this.props.tabsSave (this.state.tabs, this.state.selectedTab);
7885
}
7986
}
8087

src/component/Titlebar.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@ class TitleBar extends Component {
9999
<button type="button" id="titlebar-home" onClick={this.Main.bind (this)}><Home /></button>
100100
<button type="button" id="titlebar-minimize" onClick={this.Minimize.bind (this)}><Minimize /></button>
101101
<button type="button" id="titlebar-maximize" onClick={this.Maximize.bind (this)}><MaximizeSquare /><MaximizeClone /></button>
102-
<button type="button" id="titlebar-main" onClick={this.Main.bind (this)}><Home /></button>
103102
</div>
104103
</div>;
105104
break;
@@ -109,7 +108,6 @@ class TitleBar extends Component {
109108
<button type="button" id="titlebar-close" onClick={this.Close.bind (this)}><Close /></button>
110109
<button type="button" id="titlebar-minimize" onClick={this.Minimize.bind (this)}><Minimize /></button>
111110
<button type="button" id="titlebar-maximize" onClick={this.Maximize.bind (this)}><MaximizeSquare /><MaximizeClone /></button>
112-
<button type="button" id="titlebar-main" onClick={this.Main.bind (this)}><Home /></button>
113111
</div>
114112
<div id="title">{this.state.title}</div>
115113
<div id="titlebar-actions-other">

src/component/titlebar.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
#titlebar.main-visible.reset-visible #title { padding-left: 46px; }
77
.darwin #title { padding: 8px 138px 8px 8px; }
88
.darwin #titlebar.main-visible #title,
9-
.darwin #titlebar.reset-visible #title { padding-right: 92px; }
10-
.darwin #titlebar.main-visible.reset-visible #title { padding-right: 46px; }
9+
.darwin #titlebar.reset-visible #title { padding-left: 8px; padding-right: 92px; }
10+
.darwin #titlebar.main-visible.reset-visible #title { padding-left: 8px; padding-right: 46px; }
1111
#titlebar-actions,
1212
#titlebar-actions-other { display: flex; }
1313
#titlebar-actions button,

src/view/FileInspector.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ class FileInspector extends Component {
2828

2929
this.state = {
3030
startTabs: undefined,
31+
startSelectedTab: undefined,
3132
drives: []
3233
};
3334
}
@@ -47,11 +48,14 @@ class FileInspector extends Component {
4748
this.startTabsListener = (event, message) => {
4849
if (message.key === 'file-inspector-tabs') {
4950
this.setState ({startTabs: message.value});
51+
} else if (message.key === 'file-inspector-tab-selected') {
52+
this.setState ({startSelectedTab: message.value});
5053
}
5154
};
5255
ipcRenderer.on ('config-get', this.startTabsListener);
5356
setTimeout (() => {
5457
ipcRenderer.send ('config-get', {key: 'file-inspector-tabs'});
58+
ipcRenderer.send ('config-get', {key: 'file-inspector-tab-selected'});
5559
}, 1);
5660

5761
setTimeout (() => {
@@ -83,7 +87,7 @@ class FileInspector extends Component {
8387
* Render the component into html.
8488
*/
8589
render () {
86-
if (typeof (this.state.startTabs) === 'undefined') {
90+
if (typeof (this.state.startTabs) === 'undefined' || typeof (this.state.startSelectedTab) === 'undefined') {
8791
return '';
8892
}
8993

@@ -103,7 +107,7 @@ class FileInspector extends Component {
103107
}
104108

105109
return <div className="file-inspector">
106-
<Tabs ref={this.tabs} startTabs={this.state.startTabs} startWith="1" tabsSave={this.TabsSave.bind (this)} tabParameters={this.TabParameters.bind (this)} onTabSelected={this.TabSelected.bind (this)} />
110+
<Tabs ref={this.tabs} startTabs={this.state.startTabs} startSelectedTab={this.state.startSelectedTab} startWith="1" tabsSave={this.TabsSave.bind (this)} tabParameters={this.TabParameters.bind (this)} onTabSelected={this.TabSelected.bind (this)} />
107111
<div className="container bottom">
108112
<div className="row">
109113
<div className="col-10">
@@ -125,8 +129,9 @@ class FileInspector extends Component {
125129
/**
126130
* Save Tabs to config.
127131
*/
128-
TabsSave (tabs) {
132+
TabsSave (tabs, selectedTab) {
129133
ipcRenderer.send ('config-set', {key: 'file-inspector-tabs', value: tabs});
134+
ipcRenderer.send ('config-set', {key: 'file-inspector-tab-selected', value: selectedTab});
130135
}
131136

132137
/**

0 commit comments

Comments
 (0)