Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
/box-frame-create {                % =>
2
  box-container-create
3
  dup box-frame-setup-methods
4
  dup /box-frame add-type
5
} def
6
 
7
/box-frame-reflow {                % => Context Parent This
8
% If frame contains no boxes (for example, the src link is broken)
9
% we just return - no further processing will be done
10
  dup get-content length 0 gt {
11
 
12
% First box contained in a frame should always fill all its height
13
    dup get-height
14
    1 index get-content 0 get put-full-height
15
 
16
 
17
    dup get-uid 3 index context-push-container-uid
18
 
19
    2 index 1 index
20
    box-container-reflow-content
21
 
22
    2 index context-pop-collapsed-margin
23
    2 index context-pop-container-uid
24
  } if
25
 
26
  pop pop pop
27
} def
28
 
29
/box-frame-setup-methods {         % => Box
30
  dup /Methods get
31
  dup /reflow {box-frame-reflow} put
32
  pop pop
33
} def
34
 
35
/box-frameset-create {
36
  box-container-create
37
  dup box-frameset-setup-methods
38
  dup /rows 1 put
39
  dup /cols 1 put
40
  dup /box-frameset add-type
41
} def
42
 
43
/box-frameset-guess-lengths {      % => Height Lengths Frameset
44
% Initialization
45
  []                               % => Height Lengths Frameset Values
46
  2 index {                        % => Height Lengths Frameset Values Length
47
    pop 0 exch array-append        % => Height Lengths Frameset Values'
48
  } forall
49
 
50
% First pass: fixed-width columns
51
 
52
    3 index 1 index get
53
    dup /type get                  % => Height Lengths Frameset Values I Length Type
54
    {
55
      dup /percentage eq {
56
        pop
57
        /value get                 % => Height Lengths Frameset Values I Value
58
        5 index mul
59
        100 div                    % => Height Lengths Frameset Values I Value
60
 
61
        2 index 2 index 2 index put
62
        pop
63
 
64
        exit
65
      } if
66
 
67
      dup /constant eq {
68
        pop
69
 
70
        /value get px              % => Height Lengths Frameset Values I Value
71
        2 index 2 index 2 index put
72
 
73
        pop
74
        exit
75
      } if
76
 
77
      pop pop exit
78
    } loop                         % => Height Lengths Frameset Values I
79
    pop                            % => Height Lengths Frameset Values
80
  } for                            % => Height Lengths Frameset Values
81
 
82
% Second pass: relative-width columns
83
 
84
  3 index 1 index sum sub          % => Height Lengths Frameset Values Rest
85
 
86
 
87
  4 index
88
  {                                % => Height Lengths Frameset Values Rest Parts Value
89
    dup /type get /fraction eq {   % => Height Lengths Frameset Values Rest Parts Value
90
      /value get add               % => Height Lengths Frameset Values Rest Parts
91
    } {                            % => Height Lengths Frameset Values Rest Parts Value
92
      pop
93
    } ifelse                       % => Height Lengths Frameset Values Rest Parts
94
  } forall
95
 
96
  dup 0 gt {
97
    div                            % => Height Lengths Frameset Values PartSize
98
 
99
      4 index 1 index get
100
      dup /type get /fraction eq { % => Height Lengths Frameset Values PartSize I Length
101
        /value get                 % => Height Lengths Frameset Values PartSize I Parts
102
        2 index mul                % => Height Lengths Frameset Values PartSize I Len
103
        3 index exch
104
        2 index exch put           % => Height Lengths Frameset Values PartSize I
105
      } {
106
        pop
107
      } ifelse                     % => Height Lengths Frameset Values PartSize I
108
      pop
109
    } for                          % => Height Lengths Frameset Values PartSize
110
    pop
111
  } { pop pop } ifelse             % => Height Lengths Frameset Values
112
 
113
% Fix over/underconstrained framesets
114
  dup sum                          % => Height Lengths Frameset Values Width
115
  dup 0 gt {
116
    4 index exch div               % => Height Lengths Frameset Values Koeff
117
 
118
      2 index 1 index get
119
      2 index mul                  % => Height Lengths Frameset Values Koeff I Value'
120
      3 index exch
121
      2 index exch put             % => Height Lengths Frameset Values Koeff I
122
      pop
123
    } for                          % => Height Lengths Frameset Values Koeff
124
    pop
125
  } {
126
    pop
127
  } ifelse
128
 
129
  exch pop
130
  exch pop
131
  exch pop
132
} def
133
 
134
/box-frameset-put-cols {           % => Value Box
135
  exch /cols exch put
136
} def
137
 
138
/box-frameset-put-rows {
139
  exch /rows exch put
140
} def
141
 
142
/box-frameset-reflow {             % => Context Parent Box
143
  2 index context-get-viewport     % => Context Parent Box Viewport
144
 
145
% Frameset always fill all available space in viewport
146
 
147
  dup flow-viewport-get-left
148
  2 index get-extra-left add
149
  2 index put-left
150
 
151
  dup flow-viewport-get-top
152
  2 index get-extra-top sub
153
  2 index put-top
154
 
155
  dup flow-viewport-get-width
156
  2 index put-full-width
157
 
158
  dup flow-viewport-get-height
159
  2 index put-full-height
160
 
161
  pop                              % => Context Parent Box
162
 
163
% Parse layout-colntrol values
164
  dup get-height
165
  1 index /rows get
166
  2 index
167
  box-frameset-guess-lengths       % => Context Parent Box RowSizes
168
 
169
  1 index /get-width call-method
170
  2 index /cols get
171
  3 index
172
  box-frameset-guess-lengths       % => Context Parent Box RowSizes ColSizes
173
 
174
% Now reflow all frames in frameset
175
 
176
  4 index get-content {            % => Context Parent Box RowSizes ColSizes CurCol CurRow Frame
177
% Had we run out of cols/rows ?
178
    1 index 5 index length ge {
179
      pop
180
      exit
181
    } if                           % => Context Parent Box RowSizes ColSizes CurCol CurRow Frame
182
 
183
% Guess frame size and position
184
    5 index get-left               % => Context Parent Box RowSizes ColSizes CurCol CurRow Frame Left
185
    4 index 0                      % => Context Parent Box RowSizes ColSizes CurCol CurRow Frame Left ColsSizes 0
186
    5 index getinterval sum        % => Context Parent Box RowSizes ColSizes CurCol CurRow Frame Left ColOfs
187
    add
188
    1 index get-extra-left add     % => Context Parent Box RowSizes ColSizes CurCol CurRow Frame Left
189
    1 index put-left               % => Context Parent Box RowSizes ColSizes CurCol CurRow Frame
190
 
191
    5 index get-top                % => Context Parent Box RowSizes ColSizes CurCol CurRow Frame Top
192
    5 index 0
193
    4 index getinterval sum        % => Context Parent Box RowSizes ColSizes CurCol CurRow Frame Top RowOfs
194
    sub
195
    1 index get-extra-top sub
196
    1 index put-top                % => Context Parent Box RowSizes ColSizes CurCol CurRow Frame
197
 
198
    3 index 3 index get
199
    1 index put-full-width         % => Context Parent Box RowSizes ColSizes CurCol CurRow Frame
200
 
201
    dup /get-width call-method wc-create-constant
202
    1 index put-width-constraint
203
 
204
    4 index 2 index get
205
    1 index put-full-height        % => Context Parent Box RowSizes ColSizes CurCol CurRow Frame
206
 
207
% Reflow frame contents
208
    dup flow-viewport-create       % => Context Parent Box RowSizes ColSizes CurCol CurRow Frame Viewport'
209
    8 index context-push-viewport  % => Context Parent Box RowSizes ColSizes CurCol CurRow Frame
210
 
211
    7 index
212
    6 index
213
    2 index /reflow call-method    % => Context Parent Box RowSizes ColSizes CurCol CurRow Frame
214
 
215
    7 index context-pop-viewport
216
 
217
% Move to the nex frame position
218
    3 2 roll 1 add 3 1 roll        % => Context Parent Box RowSizes ColSizes CurCol' CurRow Frame
219
    2 index 4 index length ge {
220
      3 2 roll pop 0 3 1 roll
221
      exch 1 add exch
222
    } if
223
 
224
    pop
225
  } forall                         % => Context Parent Box RowSizes ColSizes CurCol CurRow
226
 
227
  pop pop pop pop
228
  pop pop pop
229
} def
230
 
231
/box-frameset-setup-methods {
232
  dup /Methods get
233
  dup /reflow {box-frameset-reflow} put
234
  pop pop
235
} def
236