OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 21 matching lines...) Expand all Loading... |
32 * @constructor | 32 * @constructor |
33 * @extends {WebInspector.View} | 33 * @extends {WebInspector.View} |
34 */ | 34 */ |
35 WebInspector.InspectorView = function() | 35 WebInspector.InspectorView = function() |
36 { | 36 { |
37 WebInspector.View.call(this); | 37 WebInspector.View.call(this); |
38 this.markAsRoot(); | 38 this.markAsRoot(); |
39 this.element.classList.add("fill", "vbox", "inspector-view"); | 39 this.element.classList.add("fill", "vbox", "inspector-view"); |
40 this.element.setAttribute("spellcheck", false); | 40 this.element.setAttribute("spellcheck", false); |
41 | 41 |
| 42 this._splitView = new WebInspector.SplitView(false, "InspectorView.splitView
", 300, 300); |
| 43 this._splitView.setSecondIsSidebar(true); |
| 44 this._splitView.setSidebarElementConstraints(150, 50); |
| 45 this._splitView.setMainElementConstraints(50, 50); |
| 46 WebInspector.dockController.addEventListener(WebInspector.DockController.Eve
nts.DockSideChanged, this._updateSplitView.bind(this)); |
| 47 |
| 48 this._splitView.element.id = "inspector-split-view"; |
| 49 this._splitView.show(this.element); |
| 50 |
| 51 this._overlayView = new WebInspector.ViewWithResizeCallback(this._onOverlayR
esized.bind(this)); |
| 52 this._overlayView.show(this._splitView.mainElement); |
| 53 |
| 54 this._devtoolsElement = this._splitView.sidebarElement; |
| 55 this._devtoolsElement.classList.add("vbox"); |
| 56 |
42 this._tabbedPane = new WebInspector.TabbedPane(); | 57 this._tabbedPane = new WebInspector.TabbedPane(); |
43 this._tabbedPane.setRetainTabsOrder(true); | 58 this._tabbedPane.setRetainTabsOrder(true); |
44 this._tabbedPane.show(this.element); | 59 this._tabbedPane.show(this._devtoolsElement); |
45 | 60 |
46 var toolbarElement = document.createElement("div"); | 61 this._toolbarElement = document.createElement("div"); |
47 toolbarElement.className = "toolbar toolbar-background"; | 62 this._toolbarElement.className = "toolbar toolbar-background"; |
48 var headerElement = this._tabbedPane.headerElement(); | 63 var headerElement = this._tabbedPane.headerElement(); |
49 headerElement.parentElement.insertBefore(toolbarElement, headerElement); | 64 headerElement.parentElement.insertBefore(this._toolbarElement, headerElement
); |
50 | 65 |
51 this._leftToolbarElement = toolbarElement.createChild("div", "toolbar-contro
ls-left"); | 66 this._leftToolbarElement = this._toolbarElement.createChild("div", "toolbar-
controls-left"); |
52 toolbarElement.appendChild(headerElement); | 67 this._toolbarElement.appendChild(headerElement); |
53 this._rightToolbarElement = toolbarElement.createChild("div", "toolbar-contr
ols-right"); | 68 this._rightToolbarElement = this._toolbarElement.createChild("div", "toolbar
-controls-right"); |
54 | 69 |
55 this._errorWarningCountElement = this._rightToolbarElement.createChild("div"
, "hidden"); | 70 this._errorWarningCountElement = this._rightToolbarElement.createChild("div"
, "hidden"); |
56 this._errorWarningCountElement.id = "error-warning-count"; | 71 this._errorWarningCountElement.id = "error-warning-count"; |
57 | 72 |
58 this._drawer = new WebInspector.Drawer(this); | 73 this._drawer = new WebInspector.Drawer(this); |
59 this.appendToRightToolbar(this._drawer.toggleButtonElement()); | 74 this.appendToRightToolbar(this._drawer.toggleButtonElement()); |
60 | 75 |
61 this._history = []; | 76 this._history = []; |
62 this._historyIterator = -1; | 77 this._historyIterator = -1; |
63 document.addEventListener("keydown", this._keyDown.bind(this), false); | 78 document.addEventListener("keydown", this._keyDown.bind(this), false); |
64 document.addEventListener("keypress", this._keyPress.bind(this), false); | 79 document.addEventListener("keypress", this._keyPress.bind(this), false); |
65 this._panelDescriptors = {}; | 80 this._panelDescriptors = {}; |
66 | 81 |
67 // Windows and Mac have two different definitions of '[' and ']', so accept
both of each. | 82 // Windows and Mac have two different definitions of '[' and ']', so accept
both of each. |
68 this._openBracketIdentifiers = ["U+005B", "U+00DB"].keySet(); | 83 this._openBracketIdentifiers = ["U+005B", "U+00DB"].keySet(); |
69 this._closeBracketIdentifiers = ["U+005D", "U+00DD"].keySet(); | 84 this._closeBracketIdentifiers = ["U+005D", "U+00DD"].keySet(); |
70 this._lastActivePanelSetting = WebInspector.settings.createSetting("lastActi
vePanel", "elements"); | 85 this._lastActivePanelSetting = WebInspector.settings.createSetting("lastActi
vePanel", "elements"); |
| 86 |
| 87 this._updateSplitView(); |
71 } | 88 } |
72 | 89 |
73 WebInspector.InspectorView.prototype = { | 90 WebInspector.InspectorView.prototype = { |
74 /** | 91 /** |
75 * @param {!Element} element | 92 * @param {!Element} element |
76 */ | 93 */ |
77 appendToLeftToolbar: function(element) | 94 appendToLeftToolbar: function(element) |
78 { | 95 { |
79 this._leftToolbarElement.appendChild(element); | 96 this._leftToolbarElement.appendChild(element); |
80 }, | 97 }, |
81 | 98 |
82 /** | 99 /** |
83 * @param {!Element} element | 100 * @param {!Element} element |
84 */ | 101 */ |
85 appendToRightToolbar: function(element) | 102 appendToRightToolbar: function(element) |
86 { | 103 { |
87 this._rightToolbarElement.appendChild(element); | 104 this._rightToolbarElement.appendChild(element); |
88 }, | 105 }, |
89 | 106 |
90 /** | 107 /** |
91 * @return {!WebInspector.Drawer} | 108 * @return {!WebInspector.Drawer} |
92 */ | 109 */ |
93 drawer: function() | 110 drawer: function() |
94 { | 111 { |
95 return this._drawer; | 112 return this._drawer; |
96 }, | 113 }, |
97 | 114 |
98 /** | 115 /** |
| 116 * @return {!Element} |
| 117 */ |
| 118 devtoolsElement: function() |
| 119 { |
| 120 return this._devtoolsElement; |
| 121 }, |
| 122 |
| 123 /** |
99 * @param {!WebInspector.PanelDescriptor} panelDescriptor | 124 * @param {!WebInspector.PanelDescriptor} panelDescriptor |
100 */ | 125 */ |
101 addPanel: function(panelDescriptor) | 126 addPanel: function(panelDescriptor) |
102 { | 127 { |
103 var panelName = panelDescriptor.name(); | 128 var panelName = panelDescriptor.name(); |
104 this._panelDescriptors[panelName] = panelDescriptor; | 129 this._panelDescriptors[panelName] = panelDescriptor; |
105 this._tabbedPane.appendTab(panelName, panelDescriptor.title(), new WebIn
spector.View()); | 130 this._tabbedPane.appendTab(panelName, panelDescriptor.title(), new WebIn
spector.View()); |
106 if (this._lastActivePanelSetting.get() === panelName) | 131 if (this._lastActivePanelSetting.get() === panelName) |
107 this._tabbedPane.selectTab(panelName); | 132 this._tabbedPane.selectTab(panelName); |
108 }, | 133 }, |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 this._historyIterator = this._history.length - 1; | 375 this._historyIterator = this._history.length - 1; |
351 }, | 376 }, |
352 | 377 |
353 onResize: function() | 378 onResize: function() |
354 { | 379 { |
355 // FIXME: make drawer a view. | 380 // FIXME: make drawer a view. |
356 this.doResize(); | 381 this.doResize(); |
357 this._drawer.resize(); | 382 this._drawer.resize(); |
358 }, | 383 }, |
359 | 384 |
| 385 _updateSplitView: function() |
| 386 { |
| 387 var dockSide = WebInspector.dockController.dockSide(); |
| 388 if (WebInspector.queryParamsObject["overlayContents"] && dockSide !== We
bInspector.DockController.State.Undocked) { |
| 389 this._splitView.showBoth(); |
| 390 var vertical = dockSide === WebInspector.DockController.State.Docked
ToRight; |
| 391 this._splitView.setVertical(vertical); |
| 392 if (vertical) { |
| 393 this._splitView.uninstallResizer(this._tabbedPane.headerElement(
)); |
| 394 this._splitView.installResizer(this._splitView.resizerElement())
; |
| 395 } else { |
| 396 this._splitView.uninstallResizer(this._splitView.resizerElement(
)); |
| 397 this._splitView.installResizer(this._tabbedPane.headerElement())
; |
| 398 } |
| 399 } else { |
| 400 this._splitView.showOnlySecond(); |
| 401 } |
| 402 }, |
| 403 |
| 404 _onOverlayResized: function() |
| 405 { |
| 406 var dockSide = WebInspector.dockController.dockSide(); |
| 407 if (WebInspector.queryParamsObject["overlayContents"] && dockSide !== We
bInspector.DockController.State.Undocked) { |
| 408 // Leave 3px room for resizer. |
| 409 var bottom = this._splitView.isVertical() ? 0 : this._splitView.side
barSize(); |
| 410 var right = this._splitView.isVertical() ? this._splitView.sidebarSi
ze() + 3 : 0; |
| 411 InspectorFrontendHost.setContentsInsets(0, 0, bottom, right); |
| 412 } |
| 413 |
| 414 // FIXME: make drawer a view. |
| 415 this._drawer.resize(); |
| 416 }, |
| 417 |
360 __proto__: WebInspector.View.prototype | 418 __proto__: WebInspector.View.prototype |
361 } | 419 }; |
362 | 420 |
363 /** | 421 /** |
364 * @type {?WebInspector.InspectorView} | 422 * @type {?WebInspector.InspectorView} |
365 */ | 423 */ |
366 WebInspector.inspectorView = null; | 424 WebInspector.inspectorView = null; |
OLD | NEW |