Skip to content

Commit

Permalink
Merge pull request #3 from alvin-777/feature-improve-buttons
Browse files Browse the repository at this point in the history
Button improvements
  • Loading branch information
alvin-777 committed Aug 17, 2015
2 parents a9c57c4 + 8f2db64 commit 4a56036
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 17 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ Put the folder in _root_of_poi_/resources/app/plugins

### Change Log

#### v1.1.0
* New button features
* Right-click on Zoom button will reset the window size and position.
* New Hide button.

#### v1.0.1
* Removed a label (which didn't work, and wouldn't look good if it worked...). Use plain text instead.

Expand Down
3 changes: 2 additions & 1 deletion index.cjsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ initialPoiStatsWindow = ->
height: size[1]
realClose: true
window.poiStatsWindow = newWindow
newWindow.setMinimumSize 600, 425
newWindow.on 'move', savePoiStatsWindowPosition
newWindow.on 'resize', savePoiStatsWindowSize
newWindow.on 'closed', onPoiStatsWindowClosed
Expand All @@ -62,7 +63,7 @@ module.exports =
displayName: <span><FontAwesome name='bar-chart' key={0} /> {__ 'PluginName'}</span>
author: 'Alvin Yu'
link: 'https://github.com/alvin-777/poi-plugin-poi-stats'
version: '0.2.0'
version: '1.1.0'
description: __ 'PluginDesc'
handleClick: ->
if window.poiStatsWindow != null
Expand Down
45 changes: 29 additions & 16 deletions views/navigation-bar.cjsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,27 +66,40 @@ NavigationBar = React.createClass
# MacOSX can handle maximize & unmaximize automatically.
# May need to call unmaximize() on some OS??
remote.getCurrentWindow().maximize()
resetWindow: ->
remote.getCurrentWindow().setBounds
x: (config.get 'poi.window.x', 0) + 800
y: config.get 'poi.window.y', 0
width: 800
height: 750
toggleFullscreen: ->
currWin = remote.getCurrentWindow()
currWin.setFullScreen(!currWin.isFullScreen())
hideWindow: ->
remote.getCurrentWindow().hide()
copyToClipboard: ->
webview.copy()
render: ->
<Grid>
<Col>
<ButtonGroup>
<Button bsSize='small' bsStyle='info' disabled={!webview.canGoBack()} onClick={@goBack} title='Back'><FontAwesome name='arrow-left' /></Button>
<Button bsSize='small' bsStyle='info' disabled={!webview.canGoForward()} onClick={@goForward} title='Forward'><FontAwesome name='arrow-right' /></Button>
</ButtonGroup>
<span> {@getIcon()} </span>
<Button bsSize='small' bsStyle='warning' onClick={@refreshPage} title='Refresh'><FontAwesome name='refresh' /></Button>
<span> </span>
<ButtonGroup>
<Button bsSize='small' bsStyle='primary' onClick={@maximiseWindow} title='Zoom'><FontAwesome name='arrows' /></Button>
<Button bsSize='small' bsStyle='primary' onClick={@toggleFullscreen} title='Toggle Fullscreen'><FontAwesome name='arrows-alt' /></Button>
</ButtonGroup>
<span> </span>
<Button bsSize='small' bsStyle='default' onClick={@copyToClipboard} title='Copy To Clipboard'><FontAwesome name='clipboard' /></Button>
</Col>
<Grid fluid=true>
<Row>
<Col lg={11} md={11} xs={11}>
<ButtonGroup>
<Button bsSize='small' bsStyle='info' disabled={!webview.canGoBack()} onClick={@goBack} title='Back'><FontAwesome name='arrow-left' /></Button>
<Button bsSize='small' bsStyle='info' disabled={!webview.canGoForward()} onClick={@goForward} title='Forward'><FontAwesome name='arrow-right' /></Button>
</ButtonGroup>
<span> {@getIcon()} </span>
<Button bsSize='small' bsStyle='warning' onClick={@refreshPage} title='Refresh'><FontAwesome name='refresh' /></Button>
<span> </span>
<ButtonGroup>
<Button bsSize='small' bsStyle='primary' onClick={@maximiseWindow} onContextMenu={@resetWindow} title='Zoom/Reset Window'><FontAwesome name='arrows' /></Button>
<Button bsSize='small' bsStyle='primary' onClick={@toggleFullscreen} title='Toggle Fullscreen'><FontAwesome name='arrows-alt' /></Button>
</ButtonGroup>
<span> </span>
<Button bsSize='small' onClick={@copyToClipboard} title='Copy To Clipboard'><FontAwesome name='clipboard' /></Button>
</Col>
<Col lg={1} md={1} xs={1}>
<Button bsSize='small' onClick={@hideWindow} title='Hide Window'><FontAwesome name='times' /></Button>
</Col>
</Row>
</Grid>
module.exports = NavigationBar

0 comments on commit 4a56036

Please sign in to comment.