OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // require: cr/ui/print_preview_cloud.js | 5 // require: cr/ui/print_preview_cloud.js |
6 | 6 |
7 var localStrings = new LocalStrings(); | 7 var localStrings = new LocalStrings(); |
8 | 8 |
9 // If useCloudPrint is true we attempt to connect to cloud print | 9 // If useCloudPrint is true we attempt to connect to cloud print |
10 // and populate the list of printers with cloud print printers. | 10 // and populate the list of printers with cloud print printers. |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 // Names of all the custom events used. | 119 // Names of all the custom events used. |
120 var customEvents = { | 120 var customEvents = { |
121 // Fired when the mouse moves while a margin line is being dragged. | 121 // Fired when the mouse moves while a margin line is being dragged. |
122 MARGIN_LINE_DRAG: 'marginLineDrag', | 122 MARGIN_LINE_DRAG: 'marginLineDrag', |
123 // Fired when a mousedown event occurs on a margin line. | 123 // Fired when a mousedown event occurs on a margin line. |
124 MARGIN_LINE_MOUSE_DOWN: 'marginLineMouseDown', | 124 MARGIN_LINE_MOUSE_DOWN: 'marginLineMouseDown', |
125 // Fired when a margin textbox gains focus. | 125 // Fired when a margin textbox gains focus. |
126 MARGIN_TEXTBOX_FOCUSED: 'marginTextboxFocused', | 126 MARGIN_TEXTBOX_FOCUSED: 'marginTextboxFocused', |
127 // Fired when a new preview might be needed because of margin changes. | 127 // Fired when a new preview might be needed because of margin changes. |
128 MARGINS_MAY_HAVE_CHANGED: 'marginsMayHaveChanged', | 128 MARGINS_MAY_HAVE_CHANGED: 'marginsMayHaveChanged', |
129 // Fired when the margins selection in the dropdown changes. | |
130 MARGINS_SELECTION_CHANGED: 'marginsSelectionChanged', | |
131 // Fired when a pdf generation related error occurs. | 129 // Fired when a pdf generation related error occurs. |
132 PDF_GENERATION_ERROR: 'PDFGenerationError', | 130 PDF_GENERATION_ERROR: 'PDFGenerationError', |
133 // Fired once the first page of the pdf document is loaded in the plugin. | 131 // Fired once the first page of the pdf document is loaded in the plugin. |
134 PDF_LOADED: 'PDFLoaded', | 132 PDF_LOADED: 'PDFLoaded', |
135 // Fired when the selected printer capabilities change. | 133 // Fired when the selected printer capabilities change. |
136 PRINTER_CAPABILITIES_UPDATED: 'printerCapabilitiesUpdated', | 134 PRINTER_CAPABILITIES_UPDATED: 'printerCapabilitiesUpdated', |
137 // Fired when the print button needs to be updated. | 135 // Fired when the print button needs to be updated. |
138 UPDATE_PRINT_BUTTON: 'updatePrintButton', | 136 UPDATE_PRINT_BUTTON: 'updatePrintButton', |
139 // Fired when the print summary needs to be updated. | 137 // Fired when the print summary needs to be updated. |
140 UPDATE_SUMMARY: 'updateSummary' | 138 UPDATE_SUMMARY: 'updateSummary' |
(...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
861 if (!isExpectedPreviewResponse(previewResponseId)) | 859 if (!isExpectedPreviewResponse(previewResponseId)) |
862 return; | 860 return; |
863 pageSettings.updateState(pageCount); | 861 pageSettings.updateState(pageCount); |
864 if (!previewModifiable && pageSettings.requestPrintPreviewIfNeeded()) | 862 if (!previewModifiable && pageSettings.requestPrintPreviewIfNeeded()) |
865 return; | 863 return; |
866 | 864 |
867 cr.dispatchSimpleEvent(document, customEvents.UPDATE_SUMMARY); | 865 cr.dispatchSimpleEvent(document, customEvents.UPDATE_SUMMARY); |
868 } | 866 } |
869 | 867 |
870 /** | 868 /** |
871 * @param {printing::PageSizeMargins} pageLayout The default layout of the page | 869 * @param {{contentWidth: number, contentHeight: number, marginLeft: number, |
872 * in points. | 870 * marginRight: number, marginTop: number, marginBottom: number, |
| 871 * printableAreaX: number, printableAreaY: number, |
| 872 * printableAreaWidth: number, printableAreaHeight: number}} pageLayout |
| 873 * Specifies default page layout details in points. |
873 * @param {boolean} hasCustomPageSizeStyle Indicates whether the previewed | 874 * @param {boolean} hasCustomPageSizeStyle Indicates whether the previewed |
874 * document has a custom page size style. | 875 * document has a custom page size style. |
875 */ | 876 */ |
876 function onDidGetDefaultPageLayout(pageLayout, hasCustomPageSizeStyle) { | 877 function onDidGetDefaultPageLayout(pageLayout, hasCustomPageSizeStyle) { |
877 hasPageSizeStyle = hasCustomPageSizeStyle; | 878 hasPageSizeStyle = hasCustomPageSizeStyle; |
878 marginSettings.currentDefaultPageLayout = new print_preview.PageLayout( | 879 marginSettings.currentDefaultPageLayout = new print_preview.PageLayout( |
879 pageLayout.contentWidth, | 880 pageLayout.contentWidth, |
880 pageLayout.contentHeight, | 881 pageLayout.contentHeight, |
881 pageLayout.marginLeft, | 882 pageLayout.marginLeft, |
882 pageLayout.marginTop, | 883 pageLayout.marginTop, |
883 pageLayout.marginRight, | 884 pageLayout.marginRight, |
884 pageLayout.marginBottom); | 885 pageLayout.marginBottom); |
| 886 headerFooterSettings.checkAndHideHeaderFooterOption( |
| 887 pageLayout, marginSettings.selectedMarginsValue); |
885 } | 888 } |
886 | 889 |
887 /** | 890 /** |
888 * This function sends a request to hide the overlay layer only if there is no | 891 * This function sends a request to hide the overlay layer only if there is no |
889 * pending print document request and we are not waiting for the print ready | 892 * pending print document request and we are not waiting for the print ready |
890 * metafile. | 893 * metafile. |
891 */ | 894 */ |
892 function checkAndHideOverlayLayerIfValid() { | 895 function checkAndHideOverlayLayerIfValid() { |
893 var selectedPrinter = getSelectedPrinterName(); | 896 var selectedPrinter = getSelectedPrinterName(); |
894 var printToDialog = selectedPrinter == PRINT_TO_PDF || | 897 var printToDialog = selectedPrinter == PRINT_TO_PDF || |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1202 <include src="copies_settings.js"/> | 1205 <include src="copies_settings.js"/> |
1203 <include src="header_footer_settings.js"/> | 1206 <include src="header_footer_settings.js"/> |
1204 <include src="layout_settings.js"/> | 1207 <include src="layout_settings.js"/> |
1205 <include src="color_settings.js"/> | 1208 <include src="color_settings.js"/> |
1206 <include src="margin_settings.js"/> | 1209 <include src="margin_settings.js"/> |
1207 <include src="margin_textbox.js"/> | 1210 <include src="margin_textbox.js"/> |
1208 <include src="margin_utils.js"/> | 1211 <include src="margin_utils.js"/> |
1209 <include src="margins_ui.js"/> | 1212 <include src="margins_ui.js"/> |
1210 <include src="margins_ui_pair.js"/> | 1213 <include src="margins_ui_pair.js"/> |
1211 <include src="preview_area.js"/> | 1214 <include src="preview_area.js"/> |
OLD | NEW |