Downloaded and integrated latest wiki documentation from the geda website.
[geda-gaf/whiteaudio.git] / docs / wiki / geda_kig_howto.html
blob0d998b244c80c88f4acf3df102272dad856c3956
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
4 lang="en" dir="ltr">
5 <head>
6 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
7 <title>geda:kig_howto</title>
8 <meta name="generator" content="DokuWiki Release rc2007-05-24" />
9 <meta name="robots" content="index,follow" />
10 <meta name="date" content="2007-05-24T22:27:25-0400" />
11 <meta name="keywords" content="geda,kig_howto" />
12 <link rel="search" type="application/opensearchdescription+xml" href="http://geda.seul.org/wiki/lib/exe/opensearch.php" title="geda Wiki" />
13 <link rel="start" href="http://geda.seul.org/wiki/" />
14 <link rel="contents" href="http://geda.seul.org/wiki/geda:kig_howto?do=index" title="Index" />
15 <link rel="alternate" type="application/rss+xml" title="Recent Changes" href="http://geda.seul.org/wiki/feed.php" />
16 <link rel="alternate" type="application/rss+xml" title="Current Namespace" href="http://geda.seul.org/wiki/feed.php?mode=list&ns=geda" />
17 <link rel="alternate" type="text/html" title="Plain HTML" href="http://geda.seul.org/wiki/_export/xhtml/geda:kig_howto" />
18 <link rel="alternate" type="text/plain" title="Wiki Markup" href="http://geda.seul.org/wiki/_export/raw/geda:kig_howto" />
19 <link rel="stylesheet" media="all" type="text/css" href="lib/exe/css" />
20 <link rel="stylesheet" media="screen" type="text/css" href="lib/exe/001css" />
21 <link rel="stylesheet" media="print" type="text/css" href="lib/exe/002css" />
22 </head>
23 <body>
24 <div class="dokuwiki export">
25 <div class="toc">
26 <div class="tocheader toctoggle" id="toc__header">Table of Contents</div>
27 <div id="toc__inside">
29 <ul class="toc">
30 <li class="level1"><div class="li"><span class="li"><a href="#how_to_setup_keymapping_in_gschem" class="toc">How To Setup Keymapping In gschem</a></span></div>
31 <ul class="toc">
32 <li class="level2"><div class="li"><span class="li"><a href="#about_this_document" class="toc">About this document</a></span></div></li>
33 <li class="level2"><div class="li"><span class="li"><a href="#functionality" class="toc">Functionality</a></span></div></li>
34 <li class="level2"><div class="li"><span class="li"><a href="#keymaps" class="toc">Keymaps</a></span></div>
35 <ul class="toc">
36 <li class="level3"><div class="li"><span class="li"><a href="#an_example_on_keymaps" class="toc">An example on keymaps</a></span></div></li>
37 <li class="level3"><div class="li"><span class="li"><a href="#description_of_keys" class="toc">Description of keys</a></span></div></li>
38 <li class="level3"><div class="li"><span class="li"><a href="#actions" class="toc">Actions</a></span></div></li>
39 <li class="level3"><div class="li"><span class="li"><a href="#function_calls" class="toc">Function calls</a></span></div></li>
40 <li class="level3"><div class="li"><span class="li"><a href="#another_keymap" class="toc">Another keymap</a></span></div></li>
41 </ul>
42 </li>
43 <li class="level2"><div class="li"><span class="li"><a href="#where_are_the_key_mappings_stored" class="toc">Where are the key mappings stored</a></span></div>
44 <ul class="toc">
45 <li class="level3"><div class="li"><span class="li"><a href="#appendix_a_--_dictionary" class="toc">Appendix A -- Dictionary</a></span></div></li>
46 </ul>
47 </li>
48 <li class="level2"><div class="li"><span class="li"><a href="#appendix_b_--_built-in_actions_in_gschem" class="toc">Appendix B -- Built-in actions in gschem</a></span></div></li></ul>
49 </li></ul>
50 </div>
51 </div>
55 <h1><a name="how_to_setup_keymapping_in_gschem" id="how_to_setup_keymapping_in_gschem">How To Setup Keymapping In gschem</a></h1>
56 <div class="level1">
58 <p>
59 by: Stefan Petersen, spe@geda.seul.org This document is released under <a href="http://www.fsf.org/copyleft/gpl.html" class="urlextern" title="http://www.fsf.org/copyleft/gpl.html" rel="nofollow">GPL</a>
60 </p>
62 <p>
63 1999-07-24
64 </p>
66 </div>
67 <!-- SECTION "How To Setup Keymapping In gschem" [1-177] -->
68 <h2><a name="about_this_document" id="about_this_document">About this document</a></h2>
69 <div class="level2">
71 <p>
72 The purpose of this document is to try to explain how key mapping works in gEDA/gschem schematic entry program. It uses the langauge Scheme a lot, which is a Lisp-dialect and is used in gschem as a scripting language. If you’re not familiar with this language, please see the dictionary (see appendix A, page X, for a short description of common data structures used in Scheme.
73 </p>
75 </div>
76 <!-- SECTION "About this document" [178-588] -->
77 <h2><a name="functionality" id="functionality">Functionality</a></h2>
78 <div class="level2">
80 <p>
81 When you press a button in gschem, a Scheme function is called. This function (press-key) accepts one argument, the name of the pressed key. Then there are Scheme routines to evaluate which key you pressed and call the appropriate action.<br/>
82 Since the evaluation routines are written in Scheme it’s simple to change the behaviour of what happens when you presses a key. You can implement macros or do several things at each key press. For example, the “repeat-last-key” command is implemented completly in Scheme.
83 </p>
85 </div>
86 <!-- SECTION "Functionality" [589-1128] -->
87 <h2><a name="keymaps" id="keymaps">Keymaps</a></h2>
88 <div class="level2">
90 <p>
91 The current implementation is built-up around “keymaps”. A keymap is a list with pairs. Each pairs first element (the car-element) is which key to react on, and the second element (cdr) is a “what-to-do-next”. This can either be an action, a function to call or another keymap.
92 </p>
94 </div>
95 <!-- SECTION "Keymaps" [1129-1427] -->
96 <h3><a name="an_example_on_keymaps" id="an_example_on_keymaps">An example on keymaps</a></h3>
97 <div class="level3">
99 <p>
100 Two simple examples of keymaps are seen in Figure 1 and Figure 2.
101 </p>
102 <pre class="code">(define global-keymap
103 &#039;((&quot;Escape&quot; . cancel)
104 (&quot;a&quot; . add-keymap)))</pre>
107 Figure 1: First example of an simple keymap
108 </p>
111 In figure 1 is the keymap called global-keymap. This keymap is the first keymap used. If you for example press the ‘a’-key, global-keymap tells us that next key pressed will be interpreted by add-keymap (see figure 2).
112 </p>
113 <pre class="code">(define add-keymap
114 &#039;((&quot;c&quot; . add-component)
115 (&quot;a&quot; . add-attribute)
116 (&quot;n&quot; . add-net-hotkey)))</pre>
119 Figure 2: Second example of an simple keymap
120 </p>
123 If you, after you pressed ‘a’, press a ‘c’ the built-in action add-component comes to live. This is exactly what had happend if you had selected Add, Component&hellip;in the menubar.<br/>
124 When an action has been performed the current keymap is reset back to global-keymap.<br/>
125 Available built-in actions are listed in appendix B.
126 </p>
128 </div>
129 <!-- SECTION "An example on keymaps" [1428-2357] -->
130 <h3><a name="description_of_keys" id="description_of_keys">Description of keys</a></h3>
131 <div class="level3">
134 The key are described as:
135 </p>
136 <table class="inline">
137 <tr>
138 <td> For a </td><td> “a” </td>
139 </tr>
140 <tr>
141 <td class="leftalign"> For Shift-A </td><td> “Shift A” </td>
142 </tr>
143 <tr>
144 <td> For Control-a </td><td> “Control a” </td>
145 </tr>
146 <tr>
147 <td> For Alt-a </td><td> “Alt a” </td>
148 </tr>
149 </table>
152 There are a few simple rules to follow when keys for a new keymap is defined:
153 </p>
154 <ul>
155 <li class="level1"><div class="li"> Everything is case sensitive</div>
156 </li>
157 <li class="level1"><div class="li"> At this point in time you can only have one modifier (shift, control, alt) at a time.</div>
158 </li>
159 <li class="level1"><div class="li"> Keys must be unique in each keymap, especially the global one</div>
160 </li>
161 <li class="level1"><div class="li"> Strings (without any modifers) are the same strings specified for the keys in the file /usr/lib/X11/XKeysymDB (at least on a linux box) </div>
162 </li>
163 </ul>
165 </div>
166 <!-- SECTION "Description of keys" [2358-2925] -->
167 <h3><a name="actions" id="actions">Actions</a></h3>
168 <div class="level3">
171 The built-in actions that can be called are listed in Appendix B.<br/>
172 Sometimes you may notice that there are similar actions, like edit-rotate-90 and edit-rotate-90-hotkey. They do the same thing, just that the -hotkey actions is run immediately, while the other wait for you to select something.
173 </p>
175 </div>
176 <!-- SECTION "Actions" [2926-3240] -->
177 <h3><a name="function_calls" id="function_calls">Function calls</a></h3>
178 <div class="level3">
181 If the cdr-element is an ordinary Scheme function that function is called. The function can’t receive any arguments.<br/>
182 This can be used if you want to do complex tasks, like several actions in a row or do some calculation. You can do rather advanced actions since the Guile dialect of Scheme used in gschem is extended from plain Scheme. For further information on Guile, please see the Guile documentation.
183 </p>
185 </div>
186 <!-- SECTION "Function calls" [3241-3674] -->
187 <h3><a name="another_keymap" id="another_keymap">Another keymap</a></h3>
188 <div class="level3">
191 If the cdr-element is another keymap then that command is a multi-key command, ie you need to press at least two keys to cause an action. The first key is desribed in the first keymap, which points to the next keymap. The second keymap describes what should happen when the second key is pressed.
192 </p>
194 </div>
195 <!-- SECTION "Another keymap" [3675-3997] -->
196 <h2><a name="where_are_the_key_mappings_stored" id="where_are_the_key_mappings_stored">Where are the key mappings stored</a></h2>
197 <div class="level2">
200 The keymap is stored in the startup file for gschem, namely <code>&lt;startpath, typically /usr/local&gt;/share/gEDA/system-gschemrc</code>.<br/>
201 You can then redefine or add keymaps as you like (I think) in your local setup file for gschem, ~/.gEDA/gschemrc
202 </p>
205 The Scheme functions used to resolve keypresses to actions are stored at <code>&lt;startpath, typically /usr/local&gt;/share/gEDA/scheme/gschem.scm</code>. This is configurable in the gschemrc files.
206 </p>
208 </div>
209 <!-- SECTION "Where are the key mappings stored" [3998-4471] -->
210 <h3><a name="appendix_a_--_dictionary" id="appendix_a_--_dictionary">Appendix A -- Dictionary</a></h3>
211 <div class="level3">
212 <table class="inline">
213 <tr>
214 <td> <strong>function</strong> </td><td>A subprogram in Scheme, C or other programming languages. </td>
215 </tr>
216 <tr>
217 <td><strong>action</strong> </td><td>What gschem (in this case) does when you press a key or a set of keys. </td>
218 </tr>
219 <tr>
220 <td><strong>list</strong> </td><td>A data structure very common in Lisp-looking languages like Scheme. Simply put, a long list of values. </td>
221 </tr>
222 <tr>
223 <td><strong>pair</strong> </td><td>(also dotted pair) A datstructure also very common in Lisp-looking languages. </td>
224 </tr>
225 <tr>
226 <td><strong>car element</strong> </td><td>First element in a pair. Since lists are decendents from pairs, car is also the first element in a list. </td>
227 </tr>
228 <tr>
229 <td><strong>cdr element</strong> </td><td>(pronounced cudr) The second element in a pair. In the list case it denotes the rest of list. </td>
230 </tr>
231 </table>
233 </div>
234 <!-- SECTION "Appendix A -- Dictionary" [4472-5116] -->
235 <h2><a name="appendix_b_--_built-in_actions_in_gschem" id="appendix_b_--_built-in_actions_in_gschem">Appendix B -- Built-in actions in gschem</a></h2>
236 <div class="level2">
239 Run: <pre STYLE="background : Lightgreen;margin-left : 2em"><font size="+0">grep gh_register_procedure_0_0 gschem/src/g_register.c</font></pre>
240 </p>
243 and do some work in emacsen.
244 </p>
247 <pre STYLE="background : Lightgreen;margin-left : 2em"><font size="+0">file-new-window
248 file-new
249 file-open
250 file-script
251 file-save
252 file-save-as
253 file-save-all
254 file-print
255 file-image
256 file-close-window
257 file-quit
258 edit-select
259 edit-copy
260 edit-copy-hotkey
261 edit-move
262 edit-move-hotkey
263 edit-delete
264 edit-rotate-90
265 edit-rotate-90-hotkey
266 edit-mirror
267 edit-mirror-hotkey
268 edit-slot
269 edit-color
270 edit-edit
271 edit-lock
272 edit-unlock
273 edit-translate
274 edit-embed
275 edit-unembed
276 edit-hidden
277 view-redraw
278 view-zoom-full
279 view-zoom-limits
280 view-zoom-in
281 view-zoom-out
282 view-zoom-box
283 view-zoom-box-hotkey
284 view-pan
285 view-pan-hotkey
286 view-update-nets
287 page-manager
288 page-next
289 page-prev
290 page-new
291 page-close
292 page-discard
293 page-print
294 add-component
295 add-attribute
296 add-net
297 add-net-hotkey
298 add-text
299 add-line
300 add-line-hotkey
301 add-box
302 add-box-hotkey
303 add-circle
304 add-circle-hotkey
305 add-arc
306 add-arc-hotkey
307 add-pin
308 add-pin-hotkey
309 hierarchy-open-symbol
310 attributes-attach
311 attributes-detach
312 attributes-show-name
313 attributes-show-value
314 attributes-show-both
315 attributes-visibility-toggle
316 options-text-size
317 options-snap-size
318 options-action-feedback
319 options-grid
320 options-snap
321 options-show-log-window
322 options-show-coord-window
323 misc-misc
324 cancel</font></pre>
325 </p>
327 </div>
328 <!-- SECTION "Appendix B -- Built-in actions in gschem" [5117-] --></div>
329 </body>
330 </html>