~ubuntu-branches/debian/lenny/ecb/lenny

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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
<html lang="en">
<head>
<title>ECB - the Emacs Code Browser</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name=description content="ECB - the Emacs Code Browser">
<meta name=generator content="makeinfo 4.2">
<link href="http://www.gnu.org/software/texinfo/" rel=generator-home>
</head>
<body>
<p>
Node:<a name="Possible%20layout-outlines">Possible layout-outlines</a>,
Next:<a rel=next accesskey=n href="The-layout-engine-API.html#The%20layout-engine%20API">The layout-engine API</a>,
Previous:<a rel=previous accesskey=p href="Programming-special-windows.html#Programming%20special%20windows">Programming special windows</a>,
Up:<a rel=up accesskey=u href="The-layout-engine.html#The%20layout-engine">The layout-engine</a>
<hr><br>

<h4>The wide range of possible layout-outlines</h4>

<p>In the two previous sections <a href="Programming-a-new-layout.html#Programming%20a%20new%20layout">Programming a new layout</a> and
<a href="Programming-special-windows.html#Programming%20special%20windows">Programming special windows</a> we have explained in detail how to
program new layouts and how to program new special windows/buffers and
adding them to a new layout.

<p>The intention of this section is to be a summary what are the real
restrictions for a new layout-outline programmed with
<code>ecb-layout-define</code>. This is necessary because until now we just
programmed "obvious" layouts, means layout which are in principle
very similar to the standard ones which means one big edit-window and
some special windows "around" this edit-window. This section will
show you that a layout can have also very different outlines.

<p>OK, here are the real restrictions and conditions for a layout
programmed with <code>ecb-layout-define</code>:
<ol type=1 start=1>
</p><li>It must have exactly one edit-window regardless of its size. The user
of this layout can later split this edit-window in as many
edit-windows as he like.

<li>All other windows created within the <var>CREATE-CODE</var> body of
<code>ecb-layout-define</code> (see <a href="Programming-a-new-layout.html#Programming%20a%20new%20layout">Programming a new layout</a>) must be
dedicated to their buffers.

<li>All the dedicated windows must (exclusive!) either reside on the left,
right, top or left-and-right side of the edit-window. This will be
defined with the <var>TYPE</var>-argument of <code>ecb-layout-define</code>
(see <a href="Programming-a-new-layout.html#Programming%20a%20new%20layout">Programming a new layout</a>).
</ol>

<p>You see, there are only three restrictions/conditions. These and only
these must be fulfilled at layout-programming.

<p>Demonstrating what this really means and how flexible the
layout-engine of ECB really is, can be done best with some
"pathological" layout-outlines. All the following are correct
layouts (working code is added below each layout):

<p>The following is a top layout with three vertical layered special
windows.

<br><pre>------------------------------------------------------------------
|                                                                |
|                 Upper special window                           |
|                                                                |
|----------------------------------------------------------------|
|                                                                |
|                 Middle special window                          |
|                                                                |
|----------------------------------------------------------------|
|                                                                |
|                 Lower special window                           |
|                                                                |
|================================================================|
|                                                                |
|                         Edit-area                              |
|      (can be splitted by the user in several edit-windows)     |
------------------------------------------------------------------
|                                                                |
|                 Compilation-window (optional)                  |
|                                                                |
------------------------------------------------------------------
</pre>

<p>Here is the code for that top layout (all buffers are dummy-buffers):

<br><pre>
;; The "dedicated setter" functions:

(defun ecb-set-usw-buffer ()
  (ecb-with-dedicated-window
    "Upper special window"
    'ecb-set-usw-buffer
      (switch-to-buffer (get-buffer-create "Upper special window"))))

(defun ecb-set-msw-buffer ()
  (ecb-with-dedicated-window
    "Middle special window"
    'ecb-set-msw-buffer
      (switch-to-buffer (get-buffer-create "Middle special window"))))

(defun ecb-set-lsw-buffer ()
  (ecb-with-dedicated-window
    "Lower special window"
    'ecb-set-lsw-buffer
      (switch-to-buffer (get-buffer-create "Lower special window"))))

;; The layout itself:

(ecb-layout-define "example-layout3" top
  nil

  ;; here we have an edit-window and above one top window which we can
  ;; now split in several other windows. Dependent on the value of
  ;; `ecb-compile-window-height' we have also a compile-window at the
  ;; bottom.

  (ecb-set-usw-buffer)
  (ecb-split-ver 0.33)
  (ecb-set-msw-buffer)
  (ecb-split-ver 0.5)
  (ecb-set-lsw-buffer)

  ;; select the edit-window.
  (select-window (next-window)))
</pre>

<p>The following is a left-right layout which has six special windows in
the left-"column" and one big special window in the
right-"column". For left-right layouts the left-"column" and the
right-"column" have always the same width.

<br><pre>------------------------------------------------------------------
|             |       |                   |                      |
| Left1       | Left5 |                   |                      |
|             |       |                   |                      |
|-------------|       |                   |                      |
|      |      |       |                   |                      |
|      |      |       |                   |                      |
|      |      |       |                   |                      |
| Left2| Left3|-------|     Edit-area     |   Right1             |
|      |      |       | (can be splitted  |                      |
|      |      |       |  in several edit- |                      |
|      |      |       |      windows)     |                      |
|-------------|       |                   |                      |
|             |       |                   |                      |
| Left4       | Left6 |                   |                      |
|             |       |                   |                      |
------------------------------------------------------------------
|                                                                |
|                 Compilation-window (optional)                  |
|                                                                |
------------------------------------------------------------------
</pre>

<p>Here is the code for that left-right layout, again with dummy-buffers
(depending to your screen-resolution you will need a quite big value
for <code>ecb-windows-width</code>, e.g. 0.4):

<p>Here is one of the "dedicated setter" functions<a rel=footnote href="#fn-1"><sup>1</sup></a>:

<br><pre>(defun ecb-set-left1-buffer ()
  (ecb-with-dedicated-window
    "Left1"
    'ecb-set-left1-buffer
      (switch-to-buffer (get-buffer-create "Left1"))))
</pre>

<p>Here is the layout-definition itself:

<br><pre>(ecb-layout-define "example-layout2" left-right
  nil

  ;; here we have an edit-window and left and right two windows each
  ;; with width `ecb-windows-width'. Dependent to the value of
  ;; `ecb-compile-window-height' we have also a compile-window at the
  ;; bottom.

  (ecb-set-left1-buffer)
  (ecb-split-hor 0.66 t)
  (ecb-split-ver 0.75)
  (ecb-set-left4-buffer)
  (select-window (previous-window (selected-window) 0))
  (ecb-split-ver 0.25 nil t)
  (ecb-set-left2-buffer)
  (ecb-split-hor 0.5)
  (ecb-set-left3-buffer)
  (select-window (next-window (next-window)))
  (ecb-set-left5-buffer)
  (ecb-split-ver 0.5)
  (ecb-set-left6-buffer)
  (select-window (next-window (next-window)))
  (ecb-set-right1-buffer))

  ;; select the edit-window
  (select-window (previous-window (selected-window) 0)))
</pre>

<p>Especially the last example should demonstrate that even very
complicated layouts are easy to program with <code>ecb-layout-define</code>. 
If such layouts are senseful is another topic ;-)

<hr><h4>Footnotes</h4>
<ol type="1">
<li><a name="fn-1"></a>
<p>The
``dedicated setter functions'' for all these ecb-windows/buffers are
not explicitly described - they look all like
<code>ecb-set-left1-buffer</code>
- of course with different buffer-names!</p>

</ol><hr>

</body></html>