Show More
@@ -1,63 +1,61 | |||||
1 | //---------------------------------------------------------------------------- |
|
1 | //---------------------------------------------------------------------------- | |
2 |
// Copyright (C) 20 |
|
2 | // Copyright (C) 2011 The IPython Development Team | |
3 | // |
|
3 | // | |
4 | // Distributed under the terms of the BSD License. The full license is in |
|
4 | // Distributed under the terms of the BSD License. The full license is in | |
5 | // the file COPYING, distributed as part of this software. |
|
5 | // the file COPYING, distributed as part of this software. | |
6 | //---------------------------------------------------------------------------- |
|
6 | //---------------------------------------------------------------------------- | |
7 |
|
7 | |||
8 | //============================================================================ |
|
8 | //============================================================================ | |
9 | // Layout |
|
9 | // Layout | |
10 | //============================================================================ |
|
10 | //============================================================================ | |
11 |
|
11 | |||
12 | var IPython = (function (IPython) { |
|
12 | var IPython = (function (IPython) { | |
13 | "use strict"; |
|
13 | "use strict"; | |
14 |
|
14 | |||
15 | var LayoutManager = function () { |
|
15 | var LayoutManager = function () { | |
16 | this.bind_events(); |
|
16 | this.bind_events(); | |
17 | }; |
|
17 | }; | |
18 |
|
18 | |||
19 |
|
||||
20 | LayoutManager.prototype.bind_events = function () { |
|
19 | LayoutManager.prototype.bind_events = function () { | |
21 | $(window).resize($.proxy(this.do_resize,this)); |
|
20 | $(window).resize($.proxy(this.do_resize,this)); | |
22 | }; |
|
21 | }; | |
23 |
|
22 | |||
24 | LayoutManager.prototype.app_height = function() { |
|
23 | LayoutManager.prototype.app_height = function() { | |
25 | var win = $(window); |
|
24 | var win = $(window); | |
26 | var w = win.width(); |
|
25 | var w = win.width(); | |
27 | var h = win.height(); |
|
26 | var h = win.height(); | |
28 | var header_height; |
|
27 | var header_height; | |
29 | if ($('div#header').css('display') === 'none') { |
|
28 | if ($('div#header').css('display') === 'none') { | |
30 | header_height = 0; |
|
29 | header_height = 0; | |
31 | } else { |
|
30 | } else { | |
32 | header_height = $('div#header').outerHeight(true); |
|
31 | header_height = $('div#header').outerHeight(true); | |
33 | } |
|
32 | } | |
34 | var menubar_height = $('div#menubar').outerHeight(true); |
|
33 | var menubar_height; | |
35 | var toolbar_height; |
|
34 | if ($('div#menubar-container').css('display') === 'none') { | |
36 | if ($('div#maintoolbar').css('display') === 'none') { |
|
35 | menubar_height = 0; | |
37 | toolbar_height = 0; |
|
|||
38 | } else { |
|
36 | } else { | |
39 |
|
|
37 | menubar_height = $('div#menubar-container').outerHeight(true); | |
40 | } |
|
|||
41 | return h-header_height-menubar_height-toolbar_height; // content height |
|
|||
42 | } |
|
38 | } | |
|
39 | return h-header_height-menubar_height; // content height | |||
|
40 | }; | |||
43 |
|
41 | |||
44 | LayoutManager.prototype.do_resize = function () { |
|
42 | LayoutManager.prototype.do_resize = function () { | |
45 | var app_height = this.app_height() // content height |
|
43 | var app_height = this.app_height(); // content height | |
46 |
|
44 | |||
47 | $('#ipython-main-app').height(app_height); // content+padding+border height |
|
45 | $('#ipython-main-app').height(app_height); // content+padding+border height | |
48 |
|
46 | |||
49 | var pager_height = IPython.pager.percentage_height*app_height; |
|
47 | var pager_height = IPython.pager.percentage_height*app_height; | |
50 | var pager_splitter_height = $('div#pager_splitter').outerHeight(true); |
|
48 | var pager_splitter_height = $('div#pager_splitter').outerHeight(true); | |
51 | $('div#pager').outerHeight(pager_height); |
|
49 | $('div#pager').outerHeight(pager_height); | |
52 | if (IPython.pager.expanded) { |
|
50 | if (IPython.pager.expanded) { | |
53 | $('div#notebook').outerHeight(app_height-pager_height-pager_splitter_height); |
|
51 | $('div#notebook').outerHeight(app_height-pager_height-pager_splitter_height); | |
54 | } else { |
|
52 | } else { | |
55 | $('div#notebook').outerHeight(app_height-pager_splitter_height); |
|
53 | $('div#notebook').outerHeight(app_height-pager_splitter_height); | |
56 | } |
|
54 | } | |
57 | }; |
|
55 | }; | |
58 |
|
56 | |||
59 | IPython.LayoutManager = LayoutManager; |
|
57 | IPython.LayoutManager = LayoutManager; | |
60 |
|
58 | |||
61 | return IPython; |
|
59 | return IPython; | |
62 |
|
60 | |||
63 | }(IPython)); |
|
61 | }(IPython)); |
General Comments 0
You need to be logged in to leave comments.
Login now