Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
kam-printing
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
wizards
kam-printing
Commits
b9fbdcd5
Commit
b9fbdcd5
authored
Jun 15, 2012
by
Martin Mareš
Browse files
Options
Downloads
Patches
Plain Diff
PPD: MediaType, InputSlot
parent
8592f0df
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
ppd/PPD.pm
+33
-4
33 additions, 4 deletions
ppd/PPD.pm
ppd/PPD/Paper.pm
+19
-4
19 additions, 4 deletions
ppd/PPD/Paper.pm
ppd/gen-hp
+36
-5
36 additions, 5 deletions
ppd/gen-hp
with
88 additions
and
13 deletions
ppd/PPD.pm
+
33
−
4
View file @
b9fbdcd5
...
...
@@ -4,7 +4,7 @@ use strict;
use
warnings
;
use
Exporter
'
import
';
our
@EXPORT
=
qw(define_group define_ui_group declare get set maybe_set option generate)
;
our
@EXPORT
=
qw(define_group define_ui_group
switch_group
declare get set maybe_set option
gen_values
generate)
;
### PPD data model ###
...
...
@@ -45,6 +45,7 @@ my %groups = ();
my
@head_groups
=
();
my
@ui_groups
=
();
my
@nonui_groups
=
();
my
$current_group_key
;
sub
define_group
($$)
{
my
(
$key
,
$g
)
=
@_
;
...
...
@@ -54,6 +55,7 @@ sub define_group($$) {
if
(
$g
->
{
UI
})
{
push
@ui_groups
,
$key
;
}
elsif
(
$g
->
{
Head
})
{
push
@head_groups
,
$key
;
}
else
{
push
@nonui_groups
,
$key
;
}
$current_group_key
=
$key
;
}
sub
define_head_group
($$)
{
...
...
@@ -68,6 +70,14 @@ sub define_ui_group($$) {
define_group
(
$key
,
$g
);
}
sub
switch_group
($)
{
my
(
$key
)
=
@_
;
$groups
{
$key
}
or
die
"
Group
$key
does not exist
\n
";
my
$prev
=
$current_group_key
;
$current_group_key
=
$key
;
return
$prev
;
}
# declare("group", ["keyword", "type[!]", "value"], ...)
sub
declare
($@)
{
my
$gn
=
shift
@_
;
...
...
@@ -119,12 +129,31 @@ sub option($) {
my
(
$o
)
=
@_
;
my
$key
=
$o
->
{
Key
};
!
defined
$keywords
{
$key
}
or
die
"
Keyword
$key
already known
\n
";
my
$g
=
$groups
{
$o
->
{
Group
}}
or
die
"
Keyword
$key
specified with an unknown group
\n
";
$o
->
{
Type
}
=
'
o
';
$keywords
{
$key
}
=
$o
;
my
$g
=
$groups
{
$current_group_key
};
$o
->
{
Group
}
=
$current_group_key
;
$o
->
{
Type
}
=
'
o
';
push
@
{
$g
->
{
Keywords
}},
$o
;
}
### Auxiliary functions ###
sub
gen_values
($@)
{
my
$template
=
shift
@_
;
my
@values
=
();
while
(
@
_
)
{
my
$v
=
shift
@_
;
if
(
!
ref
$v
)
{
$v
=
{
Key
=>
$v
};
}
if
(
!
defined
$v
->
{
PS
})
{
$v
->
{
PS
}
=
sprintf
(
$template
,
$v
->
{
Key
});
}
push
@values
,
$v
;
}
return
\
@values
;
}
### Known main keywords ###
# Group "f": file description
...
...
@@ -229,7 +258,7 @@ sub emit_option($) {
print
"
*
${jcl}
OpenUI *
$key
/
",
(
$o
->
{
Name
}
//
$o
->
{
Key
}),
"
:
",
$o
->
{
Choice
},
"
\n
";
my
$pri
=
$o
->
{
Priority
}
//
100
;
my
$sec
=
$o
->
{
Section
}
//
(
$jcl
?
"
JCLSetup
"
:
"
AnySetup
");
print
'
*
',
((
defined
$o
->
{
UI
})
?
""
:
'
NonUI
'),
"
OrderDependency
$pri
$sec
*
$key
\n
";
print
'
*
',
((
defined
$o
->
{
Choice
})
?
""
:
'
NonUI
'),
"
OrderDependency
$pri
$sec
*
$key
\n
";
}
print
"
*Default
$key
:
",
get_default
(
$o
),
"
\n
";
for
my
$v
(
@
{
$o
->
{
Values
}})
{
...
...
This diff is collapsed.
Click to expand it.
ppd/PPD/Paper.pm
+
19
−
4
View file @
b9fbdcd5
...
...
@@ -12,10 +12,29 @@ sub mm($) {
# W width in PS points
# H height in PS points
my
%media
=
(
'
A0
'
=>
{
Name
=>
'
A0
',
W
=>
mm
(
841
),
H
=>
mm
(
1189
)
},
'
A1
'
=>
{
Name
=>
'
A1
',
W
=>
mm
(
594
),
H
=>
mm
(
841
)
},
'
A2
'
=>
{
Name
=>
'
A2
',
W
=>
mm
(
420
),
H
=>
mm
(
594
)
},
'
A3
'
=>
{
Name
=>
'
A3
',
W
=>
mm
(
297
),
H
=>
mm
(
420
)
},
'
A4
'
=>
{
Name
=>
'
A4
',
W
=>
mm
(
210
),
H
=>
mm
(
297
)
},
'
A5
'
=>
{
Name
=>
'
A5
',
W
=>
mm
(
148
),
H
=>
mm
(
210
)
},
'
A6
'
=>
{
Name
=>
'
A6
',
W
=>
mm
(
105
),
H
=>
mm
(
148
)
},
'
B0
'
=>
{
Name
=>
'
B0
',
W
=>
mm
(
1000
),
H
=>
mm
(
1414
)
},
'
B1
'
=>
{
Name
=>
'
B1
',
W
=>
mm
(
707
),
H
=>
mm
(
1000
)
},
'
B2
'
=>
{
Name
=>
'
B2
',
W
=>
mm
(
500
),
H
=>
mm
(
707
)
},
'
B3
'
=>
{
Name
=>
'
B3
',
W
=>
mm
(
353
),
H
=>
mm
(
500
)
},
'
B4
'
=>
{
Name
=>
'
B4
',
W
=>
mm
(
250
),
H
=>
mm
(
353
)
},
'
B5
'
=>
{
Name
=>
'
B5
',
W
=>
mm
(
176
),
H
=>
mm
(
250
)
},
'
B6
'
=>
{
Name
=>
'
B6
',
W
=>
mm
(
125
),
H
=>
mm
(
176
)
},
'
C0
'
=>
{
Name
=>
'
C0
',
W
=>
mm
(
917
),
H
=>
mm
(
1297
)
},
'
C1
'
=>
{
Name
=>
'
C1
',
W
=>
mm
(
648
),
H
=>
mm
(
917
)
},
'
C2
'
=>
{
Name
=>
'
C2
',
W
=>
mm
(
458
),
H
=>
mm
(
648
)
},
'
C3
'
=>
{
Name
=>
'
C3
',
W
=>
mm
(
324
),
H
=>
mm
(
458
)
},
'
C4
'
=>
{
Name
=>
'
C4
',
W
=>
mm
(
229
),
H
=>
mm
(
354
)
},
'
C5
'
=>
{
Name
=>
'
C5
',
W
=>
mm
(
162
),
H
=>
mm
(
229
)
},
'
C6
'
=>
{
Name
=>
'
C6
',
W
=>
mm
(
114
),
H
=>
mm
(
162
)
},
'
C7
'
=>
{
Name
=>
'
C7
',
W
=>
mm
(
81
),
H
=>
mm
(
114
)
},
'
C8
'
=>
{
Name
=>
'
C8
',
W
=>
mm
(
57
),
H
=>
mm
(
81
)
},
'
Letter
'
=>
{
Name
=>
'
US Letter
',
W
=>
612
,
H
=>
792
},
'
Legal
'
=>
{
Name
=>
'
US Legal
',
W
=>
612
,
H
=>
1008
},
);
...
...
@@ -52,7 +71,6 @@ sub add_papers($) {
define_ui_group
('
Media
',
{
Name
=>
'
Media settings
'
});
option
({
Group
=>
'
Media
',
Key
=>
'
PageSize
',
Name
=>
'
Page Size
',
Choice
=>
'
PickAny
',
...
...
@@ -70,7 +88,6 @@ sub add_papers($) {
});
option
({
Group
=>
'
Media
',
Key
=>
'
PageRegion
',
Name
=>
'
Page Region
',
Choice
=>
'
PickAny
',
...
...
@@ -88,7 +105,6 @@ sub add_papers($) {
});
option
({
Group
=>
'
Media
',
Key
=>
'
ImageableArea
',
Values
=>
[
map
{
my
$k
=
$_
;
...
...
@@ -103,7 +119,6 @@ sub add_papers($) {
});
option
({
Group
=>
'
Media
',
Key
=>
'
PaperDimension
',
Values
=>
[
map
{
my
$k
=
$_
;
...
...
This diff is collapsed.
Click to expand it.
ppd/gen-hp
+
36
−
5
View file @
b9fbdcd5
...
...
@@ -24,7 +24,6 @@ set('cupsProtocol', 'None');
define_ui_group
('
Basic
',
{
Name
=>
'
Basic options
'
});
option
({
Group
=>
'
Basic
',
Key
=>
'
Duplex
',
Name
=>
'
2-Sided Printing
',
Choice
=>
'
PickOne
',
...
...
@@ -36,7 +35,6 @@ option({
});
option
({
Group
=>
'
Basic
',
Key
=>
'
Resolution
',
Name
=>
'
Printer Resolution
',
Choice
=>
'
PickOne
',
...
...
@@ -50,7 +48,6 @@ option({
});
option
({
Group
=>
'
Basic
',
Key
=>
'
HPEconoMode
',
Name
=>
'
EconoMode
',
Choice
=>
'
Boolean
',
...
...
@@ -61,7 +58,6 @@ option({
});
option
({
Group
=>
'
Basic
',
Key
=>
'
Smoothing
',
Name
=>
'
Resolution Enhancement
',
Choice
=>
'
Boolean
',
...
...
@@ -74,7 +70,6 @@ option({
});
option
({
Group
=>
'
Basic
',
Key
=>
'
Collate
',
Choice
=>
'
Boolean
',
Values
=>
[
...
...
@@ -84,6 +79,7 @@ option({
});
PPD::PJL::
add_jcl
();
PPD::Paper::
add_papers
({
MinW
=>
216
,
MaxW
=>
612
,
MinH
=>
360
,
MaxH
=>
1008
,
...
...
@@ -91,4 +87,39 @@ PPD::Paper::add_papers({
PSPageSize
=>
sub
{
my
(
$m
)
=
@_
;
return
sprintf
("
<< /PageSize [%d %d] >> setpagedevice
",
$m
->
{
W
},
$m
->
{
H
});
},
});
option
({
Key
=>
'
MediaType
',
Name
=>
'
Media Type
',
Choice
=>
'
PickOne
',
Priority
=>
20
,
Values
=>
gen_values
("
<< /MediaType (%s) >> setpagedevice
",
{
Key
=>
'
None
',
PS
=>
'
<< /MediaType null >> setpagedevice
',
Default
=>
1
},
"
Plain
",
"
Preprinted
",
"
Letterhead
",
"
Transparency
",
"
Prepunched
",
"
Labels
",
"
Bond
",
"
Recycled
",
"
Color
",
"
Rough
",
"
Card Stock
",
"
Envelope
"
),
});
option
({
Key
=>
'
InputSlot
',
Name
=>
'
Input Slot
',
Choice
=>
'
PickOne
',
Priority
=>
20
,
Values
=>
[
{
Key
=>
'
ManualFeed
',
Name
=>
'
Tray 1 with manual feed
',
PS
=>
'
<< /ManualFeed true /MediaPosition 3 >> setpagedevice
'
},
{
Key
=>
'
Tray1
',
Name
=>
'
Tray 1
',
PS
=>
'
<< /ManualFeed false /MediaPosition 3 >> setpagedevice
'
},
{
Key
=>
'
Tray2
',
Name
=>
'
Tray 2
',
PS
=>
'
<< /ManualFeed false /MediaPosition 0 >> setpagedevice
'
},
{
Key
=>
'
Tray3
',
Name
=>
'
Tray 3
',
PS
=>
'
<< /ManualFeed false /MediaPosition 1 >> setpagedevice
'
},
],
});
generate
();
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment