File: nsSanePluginControl.idl

package info (click to toggle)
mozilla-firefox 1.0.4-2sarge17
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 255,356 kB
  • ctags: 267,207
  • sloc: cpp: 1,623,961; ansic: 792,828; xml: 85,380; makefile: 41,934; perl: 27,802; asm: 14,884; sh: 14,807; cs: 4,507; python: 4,398; java: 4,004; yacc: 1,380; lex: 409; pascal: 354; php: 244; csh: 132; objc: 73; ada: 44; sql: 4
file content (147 lines) | stat: -rw-r--r-- 5,251 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
 *
 * The contents of this file are subject to the Mozilla Public
 * License Version 1.1 (the "License"); you may not use this file
 * except in compliance with the License. You may obtain a copy of
 * the License at http://www.mozilla.org/MPL/
 *
 * Software distributed under the License is distributed on an "AS
 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
 * implied. See the License for the specific language governing
 * rights and limitations under the License.
 * Contributor(s): 
 *
 *   Rusty Lynch <rusty.lynch@intel.com>
 */
/* 
 * Defines scriptable interface to SANE plugin.
 */

#include "nsISupports.idl"

[scriptable, uuid(10982800-365e-11d3-a2bf-0004ac779ef3)]
/**
 * This interface can be obtained with the following HTML/JavaScript sequence:
 *
 * <pre>
 * <EMBED type="application/X-sane-plugin" 
 *        id="SaneObject" 
 *        onScanComplete="ScanCompleteCallback()"
 *        device="hp:/dev/usbscanner"
 *        line_width="5"
 *        line_style="dash"
 *        cap_style="round"
 *        join_style="round"
 *        width=320 height=240>
 *
 * <form name="myForm">
 *   <!-- Scan Selected Region -->
 *   <input type="button" 
 *          value="Start Scan" 
 *          onClick="scanner.ScanImage()">
 *   <!-- many more buttons for controlling scanner/camera... -->
 * </form>
 * <script>
 *  var scanner = document.SaneObject.nsISaneControl;
 *  dump("scanner = "+ scanner + "\n");
 * </script>
 * </pre>
 *
 * This fragment will create an embedded plugin, which can then be accessed
 * and controlled by the nsISanePluginInstance interface which is instantiated
 * in the script.
 */
interface nsISanePluginInstance : nsISupports
{
    /////////////////////////////////////////////////////////////////////
    // Plugin Status Interface
    
    // Read-Only: Contains completion status of last operation
    attribute boolean Success;

    // Read-Only: Contains the current state of the scanner (IDLE|BUSY)
    attribute string State;

    /////////////////////////////////////////////////////////////////////
    // Image Preview Interface

    // Move zoom box to a given geometry in one step
    void ZoomImage(in unsigned short x, in unsigned short y, 
                   in unsigned short width, in unsigned short height);
    void ZoomImageWithAttributes(in unsigned short x, 
                                 in unsigned short y, 
                                 in unsigned short width, 
                                 in unsigned short height,
                                 in long req_line_width, 
                                 in string req_line_style,
                                 in string req_cap_style, 
                                 in string req_join_style);

    // Undo all croping and reset zoom box for entire image
    void Restore ();

    // Zoom in on the image and reset the zoom box to contain 
    // the entire image.
    void Crop(in unsigned short x, in unsigned short y,
              in unsigned short width, in unsigned short height);

    // Read/Write zoom box geometry
    // (Each write will trigger a refresh!)
    attribute unsigned short ZoomX;
    attribute unsigned short ZoomY;
    attribute unsigned short ZoomWidth;
    attribute unsigned short ZoomHeight;

    // Read/Write zoom box line attributes
    // (Each write will trigger a refresh!)
    attribute long   ZoomLineWidth;
    attribute string ZoomLineStyle;
    attribute string ZoomCapStyle;
    attribute string ZoomJoinStyle;

    // Read-Only zoom box change indicators
    // (For SANE devices that support changing the scan area,
    //  this allows for the controling JavaScript to safely adjust
    //  the scan area in a device specific manner.)
    attribute float ZoomBR_XChange;  // % bottom right x change on last zoom
    attribute float ZoomBR_YChange;  // % bottom right y ...
    attribute float ZoomTL_XChange;  // % top left x ...
    attribute float ZoomTL_YChange;  // % top left y ...

    // Read/Write JPEG compression attributes
    attribute long Quality;
    attribute string Method;

    //////////////////////////////////////////////////////////////////////
    // Generic SANE Interface

    // READ_ONLY: returns a colon delimeted list of option descriptions
    //            where each option description is a comma delimited
    //            list of values
    attribute string DeviceOptions;

    // Returns or sets the active device.
    attribute string ActiveDevice;

    // READ_ONLY: returns a comma delimited list of image parameters
    attribute string ImageParameters;

    // READ_ONLY: returns a comma delimited list of available devices
    attribute string AvailableDevices;

    // Pull image from device with current option settings.
    // As a side effect, the zoom box is set to contain the
    // entire image.
    void ScanImage();
    void SetOption(in string name, in string value);

    // Pop up a dialog to save current image to a file
    void SaveImage();
 };

%{ C++
//10982800-365e-11d3-a2bf-0004ac780ef3
#define NS_SANE_PLUGIN_CONTROL_CID \
 { 0x10982800, 0x365e, 0x11d3, { 0xa2, 0xbf, 0x0, 0x04, 0xac, 0x78, 0x0e, 0xf3 }}

%}