line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package LaTeX::TikZ::Context; |
2
|
|
|
|
|
|
|
|
3
|
10
|
|
|
10
|
|
36
|
use strict; |
|
10
|
|
|
|
|
10
|
|
|
10
|
|
|
|
|
241
|
|
4
|
10
|
|
|
10
|
|
32
|
use warnings; |
|
10
|
|
|
|
|
8
|
|
|
10
|
|
|
|
|
280
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
=head1 NAME |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
LaTeX::TikZ::Context - An object modeling in which context a set is evaluated. |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 VERSION |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
Version 0.03 |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=cut |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
our $VERSION = '0.03'; |
17
|
|
|
|
|
|
|
|
18
|
10
|
|
|
10
|
|
2671
|
use LaTeX::TikZ::Mod (); # Required to work around a bug in Mouse |
|
10
|
|
|
|
|
15
|
|
|
10
|
|
|
|
|
166
|
|
19
|
|
|
|
|
|
|
|
20
|
10
|
|
|
10
|
|
39
|
use LaTeX::TikZ::Tools; |
|
10
|
|
|
|
|
10
|
|
|
10
|
|
|
|
|
119
|
|
21
|
|
|
|
|
|
|
|
22
|
10
|
|
|
10
|
|
26
|
use Mouse; |
|
10
|
|
|
|
|
9
|
|
|
10
|
|
|
|
|
31
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head2 C |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
The parent context of the current one, or C for the topmost context. |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=cut |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
has 'parent' => ( |
33
|
|
|
|
|
|
|
is => 'ro', |
34
|
|
|
|
|
|
|
isa => 'Maybe[LaTeX::TikZ::Context]', |
35
|
|
|
|
|
|
|
required => 0, |
36
|
|
|
|
|
|
|
default => undef, |
37
|
|
|
|
|
|
|
); |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head2 C |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
The list of mods that are asked to be applied in this context. |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=cut |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
has '_mods' => ( |
46
|
|
|
|
|
|
|
is => 'ro', |
47
|
|
|
|
|
|
|
isa => 'ArrayRef[LaTeX::TikZ::Mod]', |
48
|
|
|
|
|
|
|
required => 0, |
49
|
|
|
|
|
|
|
default => sub { [ ] }, |
50
|
|
|
|
|
|
|
init_arg => 'mods', |
51
|
|
|
|
|
|
|
); |
52
|
|
|
|
|
|
|
|
53
|
305
|
|
|
305
|
1
|
254
|
sub mods { @{$_[0]->_mods} } |
|
305
|
|
|
|
|
809
|
|
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
has '_applied_mods' => ( |
56
|
|
|
|
|
|
|
is => 'ro', |
57
|
|
|
|
|
|
|
isa => 'HashRef[LaTeX::TikZ::Mod]', |
58
|
|
|
|
|
|
|
required => 0, |
59
|
|
|
|
|
|
|
default => sub { { } }, |
60
|
|
|
|
|
|
|
init_arg => undef, |
61
|
|
|
|
|
|
|
); |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head2 C |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
The list of mods that actually need to be applied in this context. |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=cut |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
has '_effective_mods' => ( |
70
|
|
|
|
|
|
|
is => 'ro', |
71
|
|
|
|
|
|
|
isa => 'ArrayRef[LaTeX::TikZ::Mod]', |
72
|
|
|
|
|
|
|
required => 0, |
73
|
|
|
|
|
|
|
default => sub { [ ] }, |
74
|
|
|
|
|
|
|
init_arg => undef, |
75
|
|
|
|
|
|
|
); |
76
|
|
|
|
|
|
|
|
77
|
304
|
|
|
304
|
1
|
248
|
sub effective_mods { @{$_[0]->_effective_mods} } |
|
304
|
|
|
|
|
882
|
|
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
has '_last_mod' => ( |
80
|
|
|
|
|
|
|
is => 'rw', |
81
|
|
|
|
|
|
|
isa => 'Int', |
82
|
|
|
|
|
|
|
required => 0, |
83
|
|
|
|
|
|
|
default => 0, |
84
|
|
|
|
|
|
|
init_arg => undef, |
85
|
|
|
|
|
|
|
); |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
my $ltml_tc = LaTeX::TikZ::Tools::type_constraint('LaTeX::TikZ::Mod::Layer'); |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
sub BUILD { |
90
|
305
|
|
|
305
|
1
|
335
|
my $cxt = shift; |
91
|
305
|
|
|
|
|
463
|
my $pcxt = $cxt->parent; |
92
|
|
|
|
|
|
|
|
93
|
305
|
|
|
|
|
441
|
my $applied_mods = $cxt->_applied_mods; |
94
|
305
|
|
|
|
|
633
|
for (my $c = $pcxt; defined $c; $c = $c->parent) { |
95
|
249
|
|
|
|
|
363
|
my $mods = $c->_applied_mods; |
96
|
249
|
|
|
|
|
733
|
while (my ($tag, $mods_info) = each %$mods) { |
97
|
234
|
|
|
|
|
188
|
unshift @{$applied_mods->{$tag}}, @$mods_info; |
|
234
|
|
|
|
|
1158
|
|
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
|
101
|
305
|
100
|
|
|
|
603
|
my $last_mod = defined $pcxt ? $pcxt->_last_mod : 0; |
102
|
305
|
|
|
|
|
415
|
my $effective_mods = $cxt->_effective_mods; |
103
|
|
|
|
|
|
|
|
104
|
305
|
|
|
|
|
238
|
my $last_layer; |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
MOD: |
107
|
305
|
|
|
|
|
495
|
for my $mod ($cxt->mods) { |
108
|
192
|
|
|
|
|
634
|
my $is_layer = $ltml_tc->check($mod); |
109
|
192
|
100
|
|
|
|
376
|
$last_layer = $mod if $is_layer; |
110
|
|
|
|
|
|
|
|
111
|
192
|
|
|
|
|
444
|
my $tag = $mod->tag; |
112
|
192
|
|
100
|
|
|
648
|
my $old = $applied_mods->{$tag} || []; |
113
|
192
|
|
|
|
|
313
|
for (@$old) { |
114
|
61
|
100
|
|
|
|
159
|
next MOD if $_->[0]->covers($mod); |
115
|
|
|
|
|
|
|
} |
116
|
|
|
|
|
|
|
|
117
|
163
|
|
|
|
|
146
|
push @{$applied_mods->{$tag}}, [ $mod, $last_mod++, $is_layer ]; |
|
163
|
|
|
|
|
502
|
|
118
|
163
|
|
|
|
|
390
|
push @$effective_mods, $mod; |
119
|
|
|
|
|
|
|
} |
120
|
|
|
|
|
|
|
|
121
|
305
|
100
|
|
|
|
576
|
if ($last_layer) { |
122
|
|
|
|
|
|
|
# Clips and mods don't propagate through layers. Hence, if a layer is set, |
123
|
|
|
|
|
|
|
# we should force their reuse. |
124
|
24
|
|
|
|
|
33
|
@$effective_mods = $last_layer; |
125
|
8
|
|
|
|
|
20
|
push @$effective_mods, map $_->[0], |
126
|
24
|
|
|
|
|
106
|
sort { $a->[1] <=> $b->[1] } |
127
|
|
|
|
|
|
|
grep !$_->[2], |
128
|
|
|
|
|
|
|
map @$_, |
129
|
|
|
|
|
|
|
values %$applied_mods; |
130
|
|
|
|
|
|
|
} |
131
|
|
|
|
|
|
|
|
132
|
305
|
|
|
|
|
1009
|
$cxt->_last_mod($last_mod); |
133
|
|
|
|
|
|
|
} |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=head1 SEE ALSO |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
L. |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=head1 AUTHOR |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
Vincent Pit, C<< >>, L. |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
You can contact me by mail or on C (vincent). |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=head1 BUGS |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
Please report any bugs or feature requests to C, or through the web interface at L. |
148
|
|
|
|
|
|
|
I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=head1 SUPPORT |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
perldoc LaTeX::TikZ |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
Copyright 2010,2011,2012,2013,2014,2015 Vincent Pit, all rights reserved. |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
=cut |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
1; # End of LaTeX::TikZ::Context |