Allow full screen PDF

This commit is contained in:
James Allen 2014-07-22 13:33:01 +01:00
parent c04b503914
commit 688842de3c
8 changed files with 102 additions and 6 deletions

View file

@ -1,6 +1,7 @@
div.full-size(
ng-show="ui.view == 'editor'"
layout="pdf"
layout-disabled="ui.pdfLayout != 'sideBySide'"
resize-on="layout:main:resize"
resize-proportionally="true"
initial-size-east="'50%'"
@ -31,7 +32,8 @@ div.full-size(
)
.ui-layout-east
include ./pdf
div(ng-if="ui.pdfLayout == 'sideBySide'")
include ./pdf
.ui-layout-resizer-controls.synctex-controls(
ng-show="!!pdf.url && settings.pdfViewer == 'pdfjs'"
@ -51,4 +53,11 @@ div.full-size(
tooltip-append-to-body="true"
ng-click="syncToCode()"
)
i.fa.fa-long-arrow-left
i.fa.fa-long-arrow-left
div.full-size(
ng-if="ui.pdfLayout == 'flat'"
ng-show="ui.view == 'pdf'"
)
include ./pdf

View file

@ -72,6 +72,20 @@ aside#file-tree(ng-controller="FileTreeController")
i.fa.fa-fw.fa-file
span {{ entity.name }}
div(ng-show="ui.pdfLayout == 'flat' && (ui.view == 'editor' || ui.view == 'pdf')")
ul.list-unstyled.file-tree-list
li(
ng-class="{ 'selected': ui.view == 'pdf' }"
)
.entity
.entity-name(
ng-click="ui.view = 'pdf'"
)
i.fa.fa-fw.toggle
i.fa.fa-fw.fa-file-pdf-o
| PDF
script(type='text/ng-template', id='entityListItemTemplate')
li(

View file

@ -1,4 +1,4 @@
div.full-size(ng-controller="PdfController")
div.full-size.pdf(ng-controller="PdfController")
.toolbar.toolbar-tall
a.btn.btn-info(
href,
@ -26,6 +26,27 @@ div.full-size(ng-controller="PdfController")
'label-danger': pdf.logEntries.errors.length > 0\
}"
) {{ pdf.logEntries.errors.length + pdf.logEntries.warnings.length }}
.toolbar-right
a(
href,
ng-click="switchToFlatLayout()"
ng-show="ui.pdfLayout == 'sideBySide'"
tooltip="Full screen"
tooltip-placement="bottom"
tooltip-append-to-body="true"
)
i.full-screen
a(
href,
ng-click="switchToSideBySideLayout()"
ng-show="ui.pdfLayout == 'flat'"
tooltip="Split screen"
tooltip-placement="bottom"
tooltip-append-to-body="true"
)
i.split-screen
i.split-screen
.pdf-viewer(ng-show="pdf.url && pdf.view == 'pdf' && !pdf.failure && !pdf.timeout && !pdf.error")
div(

View file

@ -50,6 +50,7 @@ define [
leftMenuShown: false
view: "editor"
chatOpen: false
pdfLayout: 'sideBySide'
}
$scope.user = window.user
$scope.settings = window.userSettings

View file

@ -102,5 +102,12 @@ define [
resetOpenStates()
onInternalResize()
scope.$watch attrs.layoutDisabled, (value) ->
if value
element.layout().hide("east")
else
element.layout().show("east")
}
]

View file

@ -147,7 +147,22 @@ define [
.then (data) ->
{doc, line} = data
ide.editorManager.openDoc(doc, gotoLine: line)
$scope.switchToFlatLayout = () ->
$scope.ui.pdfLayout = 'flat'
$scope.ui.view = 'pdf'
$.localStorage "pdf.layout", "flat"
$scope.switchToSideBySideLayout = () ->
$scope.ui.pdfLayout = 'sideBySide'
$scope.ui.view = 'editor'
$.localStorage "pdf.layout", "split"
if pdfLayout = $.localStorage("pdf.layout")
$scope.switchToSideBySideLayout() if pdfLayout == "split"
$scope.switchToFlatLayout() if pdfLayout == "flat"
else
$scope.switchToSideBySideLayout()
]
App.factory "synctex", ["ide", "$http", "$q", (ide, $http, $q) ->

View file

@ -54,7 +54,7 @@ aside#file-tree {
font-size: 14px;
}
i.fa-file, i.fa-image {
i.fa-file, i.fa-image, i.fa-file-pdf-o {
color: @gray-light;
font-size: 14px;
}

View file

@ -73,7 +73,7 @@
}
}
.toolbar {
.pdf .toolbar {
.log-btn {
&.active, &:active {
.label {
@ -87,6 +87,35 @@
}
}
}
.toolbar-right {
margin-right: @line-height-computed / 2;
a {
&:hover {
i {
box-shadow: 1px 1px 0 rgba(0, 0, 0, 0.25);
border-color: @gray-dark;
}
}
i {
display: inline-block;
width: 16px;
height: 16px;
border: 1px solid @gray-light;
margin-top: 5px;
}
i.full-screen {
border-top-width: 3px;
border-radius: 2px;
}
i.split-screen {
width: 7px;
border-top-width: 3px;
border-radius: 2px;
margin-left: 2px;
}
}
}
}
.pdf-logs {