Updated and correct the gEDA/gaf man pages a little bit.
[geda-gaf.git] / docs / wiki / geda_devel-tips.html
blob04b9a0b40fcbfdf2f120ff042bd9727c1d8aa61c
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:devel-tips</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:26-0400" />
11 <meta name="keywords" content="geda,devel-tips" />
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:devel-tips?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:devel-tips" />
18 <link rel="alternate" type="text/plain" title="Wiki Markup" href="http://geda.seul.org/wiki/_export/raw/geda:devel-tips" />
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="#geda_developer_tips_tricks_and_hints" class="toc">gEDA Developer Tips, tricks and hints</a></span></div>
31 <ul class="toc">
32 <li class="level2"><div class="li"><span class="li"><a href="#how_to_branch_correctly_using_cvs" class="toc">How to branch correctly using CVS</a></span></div></li>
33 <li class="level2"><div class="li"><span class="li"><a href="#doxygen_comments_and_styles" class="toc">Doxygen Comments and styles</a></span></div></li>
34 <li class="level2"><div class="li"><span class="li"><a href="#dialogsdesign_and_behaviour" class="toc">Dialogs: Design and Behaviour</a></span></div>
35 <ul class="toc">
36 <li class="level3"><div class="li"><span class="li"><a href="#dialog_design" class="toc">Dialog Design</a></span></div></li>
37 <li class="level3"><div class="li"><span class="li"><a href="#modal_or_nonmodal_dialogs" class="toc">Modal or Nonmodal dialogs</a></span></div></li>
38 <li class="level3"><div class="li"><span class="li"><a href="#where_to_place_the_dialog" class="toc">Where to place the dialog</a></span></div></li>
39 <li class="level3"><div class="li"><span class="li"><a href="#placing_dialogs_in_front_of_their_parent_window" class="toc">Placing dialogs in front of their parent window</a></span></div></li>
40 <li class="level3"><div class="li"><span class="li"><a href="#button_order_in_dialogs" class="toc">Button order in dialogs</a></span></div></li>
41 <li class="level3"><div class="li"><span class="li"><a href="#dialog_design_of_the_current_dialogs" class="toc">Dialog design of the current dialogs</a></span></div></li>
42 <li class="level3"><div class="li"><span class="li"><a href="#source_template_for_simple_dialogs" class="toc">Source template for simple dialogs</a></span></div></li>
43 <li class="level3"><div class="li"><span class="li"><a href="#current_dialog_issues_in_gschem" class="toc">Current Dialog Issues in Gschem</a></span></div></li></ul>
44 </li></ul>
45 </li></ul>
46 </div>
47 </div>
51 <h1><a name="geda_developer_tips_tricks_and_hints" id="geda_developer_tips_tricks_and_hints">gEDA Developer Tips, tricks and hints</a></h1>
52 <div class="level1">
54 </div>
55 <!-- SECTION "gEDA Developer Tips, tricks and hints" [1-53] -->
56 <h2><a name="how_to_branch_correctly_using_cvs" id="how_to_branch_correctly_using_cvs">How to branch correctly using CVS</a></h2>
57 <div class="level2">
59 <p>
60 Here’s a summary of what should happen with development on a branch that is intended to later be merged to the trunk. Suppose the branch is called “mine”.
61 </p>
63 <p>
64 1) tag the repository (trunk) to create a branch point tag:
65 </p>
66 <pre class="code"> cvs tag mine-base </pre>
68 <p>
69 2) branch
70 </p>
71 <pre class="code"> cvs tag -b -r mine-base mine</pre>
73 <p>
74 What step #1 does is to keep track of where the “mine” branch started <br/>
75 from. The &quot;-r mine-base” in step #2 says to create the branch starting <br/>
76 from the tag “mine-base”. It is important to do this because you need<br/>
77 to be able to know where each file is rooted (i.e., what version in the <br/>
78 trunk it is derived from).
79 </p>
81 <p>
82 Usually, it is a good idea to periodically merge changes which have taken <br/>
83 place on the trunk to the branch. This will reduce the amount of work when <br/>
84 the work on the branch is ready to go back to the trunk.
85 </p>
87 <p>
88 # go to where the trunk is checked out and update it
89 </p>
90 <pre class="code"> cd /to/my/trunk/sources
91 cvs update -PdA</pre>
93 <p>
94 # create a temporary tag in case someone commits stuff while you’re<br/>
95 # in the middle of this procedure. This keeps you from losing anything.
96 </p>
97 <pre class="code"> cvs tag merge-mine</pre>
99 <p>
100 # go to your branch source tree
101 </p>
102 <pre class="code">
103 cd /to/my/branch/sources
104 cvs update -Pd</pre>
107 # the following says to apply the changes that have taken place on<br/>
108 # the trunk between the version tagged with “mine-base” and “merge-mine”<br/>
109 # to your branch source tree
110 </p>
111 <pre class="code"> cvs update -j mine-base -j merge-mine -dP</pre>
114 # if all goes well, you’ll have no conflicts. It is not uncommon <br/>
115 # for there to be some cases where you have to resolve conflicts by<br/>
116 # hand. In this case the affected files will have a special comment<br/>
117 # showing what your file on the branch had and what the file tagged as<br/>
118 # merge-mine had. You, as the programmer, have to figure out what is<br/>
119 # correct. Once this is all done, proceed.<br/>
121 </p>
124 # checkin with a message like “sync with trunk” or<br/>
125 # “pull up revs #### from the trunk” (if you were pulling up<br/>
126 # a specific change).
127 </p>
128 <pre class="code"> cvs ci</pre>
131 # Now we move the branch point tag to the temporary merge tag<br/>
132 # This is because we have changed what rev each file in the branch<br/>
133 # is based on in the trunk. This is known as re-rooting.
134 </p>
135 <pre class="code"> cvs tag -F -r merge-mine mine-base</pre>
138 # now we don’t need the temporary merge tag anymore so remove it
139 </p>
140 <pre class="code"> cvs tag -d merge-mine</pre>
143 When it is time to merge changes that have taken place on a branch back<br/>
144 to the trunk (usually marking the end of that branch), first do a final <br/>
145 trunk &rarr; branch merge as mentioned above. Then do a branch &rarr; trunk merge.
146 </p>
149 Now for a branch to trunk merge you’d do
150 </p>
151 <pre class="code"> cd /to/my/trunk/sources
152 cvs update -PdA
153 cvs update -j mine-base -j mine -dP</pre>
156 # resolve conflicts
157 </p>
158 <pre class="code"> cvs ci
159 cvs tag -F mine-base</pre>
162 This takes any changes between “mine-base” and “mine” and tries to apply <br/>
163 it to the trunk. If it all goes cleanly, you just check it in otherwise you <br/>
164 have to resolve conflicts. Then you move the branch point tag because the trunk<br/>
165 now reflects the lastest in the branch.
166 </p>
169 The above was contributed by Dan McMahill
170 </p>
172 </div>
173 <!-- SECTION "How to branch correctly using CVS" [54-3116] -->
174 <h2><a name="doxygen_comments_and_styles" id="doxygen_comments_and_styles">Doxygen Comments and styles</a></h2>
175 <div class="level2">
178 Any volunteer for writing some notes?
179 </p>
180 <ul>
181 <li class="level1"><div class="li"> which keywords to use</div>
182 </li>
183 <li class="level1"><div class="li"> a template for a function</div>
184 </li>
185 <li class="level1"><div class="li"> a template for structs?</div>
186 </li>
187 <li class="level1"><div class="li"> bug, todo and fixme tags</div>
188 </li>
189 </ul>
191 </div>
192 <!-- SECTION "Doxygen Comments and styles" [3117-3310] -->
193 <h2><a name="dialogsdesign_and_behaviour" id="dialogsdesign_and_behaviour">Dialogs: Design and Behaviour</a></h2>
194 <div class="level2">
196 </div>
197 <!-- SECTION "Dialogs: Design and Behaviour" [3311-3353] -->
198 <h3><a name="dialog_design" id="dialog_design">Dialog Design</a></h3>
199 <div class="level3">
202 There’s a nice document from the gnome guys called <a href="http://developer.gnome.org/projects/gup/hig/2.0/" class="urlextern" title="http://developer.gnome.org/projects/gup/hig/2.0/" rel="nofollow"> Gnome HIG</a>. There are several suggestions on how to design dialogs and how they should behave.
203 </p>
206 <strong> The dialog design is mostly a matter of taste:</strong>
207 </p>
208 <ul>
209 <li class="level1"><div class="li"> alignment of elements. See <a href="http://developer.gnome.org/projects/gup/hig/2.0/design-window.html" class="urlextern" title="http://developer.gnome.org/projects/gup/hig/2.0/design-window.html" rel="nofollow"> Window Layout</a></div>
210 </li>
211 <li class="level1"><div class="li"> right alignment of dialog buttons</div>
212 </li>
213 <li class="level1"><div class="li"> some spacing around the dialog (but how much?)</div>
214 </li>
215 <li class="level1"><div class="li"> some spacing between the elements (vertical and horizontal)</div>
216 </li>
217 <li class="level1"><div class="li"> option groups with frames or indentation?</div>
218 </li>
219 <li class="level1"><div class="li"> frame labels or bold headlines?</div>
220 </li>
221 </ul>
224 <strong>Misc:</strong>
225 </p>
226 <ul>
227 <li class="level1"><div class="li"> with a <a href="http://www.chipx86.com/wiki/Libsexy#SexyIconEntry" class="urlextern" title="http://www.chipx86.com/wiki/Libsexy#SexyIconEntry" rel="nofollow"> libsexy widget</a> it would be possible to place an icon inside the text entry this would be usefull for some dialogs: </div>
228 <ul>
229 <li class="level3"><div class="li"> the filter entry in the component select dialog</div>
230 </li>
231 <li class="level3"><div class="li"> the file select in the print dialog</div>
232 </li>
233 <li class="level3"><div class="li"> the file select in the export png dialog</div>
234 </li>
235 </ul>
236 </li>
237 </ul>
239 </div>
240 <!-- SECTION "Dialog Design" [3354-4328] -->
241 <h3><a name="modal_or_nonmodal_dialogs" id="modal_or_nonmodal_dialogs">Modal or Nonmodal dialogs</a></h3>
242 <div class="level3">
245 A modal dialog is required whenever the main application provides data for the dialog.
246 </p>
247 <pre class="code">Example:
248 The dialog is called with a selection list and the dialog only should operate on this selection.</pre>
251 A modal dialog is OK too, if the dialog is only called very seldom. The file open dialog could be nonmodal because it does not require any input from the application.
252 </p>
255 A modal dialog is not OK if there is a lot of user interaction with the dialog. The component selection is a good example.
256 </p>
258 </div>
259 <!-- SECTION "Modal or Nonmodal dialogs" [4329-4859] -->
260 <h3><a name="where_to_place_the_dialog" id="where_to_place_the_dialog">Where to place the dialog</a></h3>
261 <div class="level3">
264 A dialog can be put on different places in on the screen. A list of possible places can be found in the <a href="http://developer.gnome.org/doc/API/2.0/gtk/gtk-Standard-Enumerations.html#GtkWindowPosition" class="urlextern" title="http://developer.gnome.org/doc/API/2.0/gtk/gtk-Standard-Enumerations.html#GtkWindowPosition" rel="nofollow"> GtkReference</a>
265 </p>
268 The current dialogs are placed either on the mouse position (GTK_WIN_POS_MOUSE) or at no preset position (GTK_WIN_POS_NONE). The Gnome HID does not say anything about that topic.
269 </p>
272 The default setting is GTK_WIN_POS_NONE for GtkWindow see <a href="http://developer.gnome.org/doc/API/2.0/gtk/GtkWindow.html#GtkWindow--window-position" class="urlextern" title="http://developer.gnome.org/doc/API/2.0/gtk/GtkWindow.html#GtkWindow--window-position" rel="nofollow"> GtkWindow</a>. The default for GtkDialog is GTK_WIN_POS_CENTER_ON_PARENT (<a href="http://cvs.gnome.org/viewcvs/gtk%2B/gtk/gtkdialog.c" class="urlextern" title="http://cvs.gnome.org/viewcvs/gtk%2B/gtk/gtkdialog.c" rel="nofollow"> taken from the GtkDialog source</a>).
273 </p>
275 </div>
276 <!-- SECTION "Where to place the dialog" [4860-5604] -->
277 <h3><a name="placing_dialogs_in_front_of_their_parent_window" id="placing_dialogs_in_front_of_their_parent_window">Placing dialogs in front of their parent window</a></h3>
278 <div class="level3">
281 Most of the dialogs are placed in front of their parent window using the transient_for property (see. <a href="http://developer.gnome.org/doc/API/2.0/gtk/GtkWindow.html#gtk-window-set-transient-for" class="urlextern" title="http://developer.gnome.org/doc/API/2.0/gtk/GtkWindow.html#gtk-window-set-transient-for" rel="nofollow"> GtkReference</a>). This property should be set for all modal dialogs.
282 </p>
285 For nonmodal dialogs the setting of transient_for property is not obvious. While in gschem for example the coord dialog should stay above the parent window, the log window does not need to stay in front of it.
286 </p>
289 <strong>Note:</strong> There is an older mechanism that keeps the the dialogs in front of gschem. If the <em>raise-dialog-boxes-on-expose</em> variable is set to <em>enable</em> in one of gschem’s configuration files, it may cause problems with some window managers. If dialogs are flickering at 100% CPU load, then disable that setting.
290 </p>
291 <pre class="code lisp"><span class="co1">; raise-dialog-boxes-on-expose string</span>
292 <span class="co1">;</span>
293 <span class="co1">; Controls if dialog boxes are raised whenever an expose event happens</span>
294 <span class="co1">; Default is enabled</span>
295 <span class="co1">;</span>
296 <span class="co1">;(raise-dialog-boxes-on-expose &quot;enabled&quot;)</span>
297 <span class="br0">&#40;</span>raise-dialog-boxes-on-expose <span class="st0">&quot;disabled&quot;</span><span class="br0">&#41;</span></pre>
298 </div>
299 <!-- SECTION "Placing dialogs in front of their parent window" [5605-6690] -->
300 <h3><a name="button_order_in_dialogs" id="button_order_in_dialogs">Button order in dialogs</a></h3>
301 <div class="level3">
304 Button order at the bottom of the dialog depends on which operating system the user is using. GTK handles this automatically (require version &gt; 2.6.0) , but requires the developers set the alternative button order. For more information, check the GTK documentation <a href="http://developer.gnome.org/doc/API/2.0/gtk/GtkSettings.html" class="urlextern" title="http://developer.gnome.org/doc/API/2.0/gtk/GtkSettings.html" rel="nofollow">here</a>.
305 </p>
308 The alternative button order is set with just one call to a GTK function:
309 </p>
310 <pre class="code C"><span class="co2">#if GTK_CHECK_VERSION (2,6,0)</span>
311 <span class="coMULTI">/* Set the alternative button order (ok, cancel, help) for other systems */</span>
312 gtk_dialog_set_alternative_button_order<span class="br0">&#40;</span>GTK_DIALOG<span class="br0">&#40;</span>dialog<span class="br0">&#41;</span>,
313 GTK_RESPONSE_OK,
314 GTK_RESPONSE_NO,
315 GTK_RESPONSE_CANCEL,
316 GTK_RESPONSE_HELP,
317 <span class="nu0">-1</span><span class="br0">&#41;</span>;
318 <span class="co2">#endif</span></pre>
320 This should be done for every new dialog created, before running it.
321 </p>
323 </div>
324 <!-- SECTION "Button order in dialogs" [6691-7514] -->
325 <h3><a name="dialog_design_of_the_current_dialogs" id="dialog_design_of_the_current_dialogs">Dialog design of the current dialogs</a></h3>
326 <div class="level3">
329 <a href="_detail/devel_tips_dialog_picture.html" class="media" title="devel_tips:dialog_picture.png"><img src="_media/devel_tips_dialog_picture.png" class="media" alt="" /></a>
330 </p>
331 <ul>
332 <li class="level1"><div class="li"> There is some space around the whole dialog (<em>DIALOG_BORDER_SPACING</em>). </div>
333 </li>
334 <li class="level1"><div class="li"> Some indentation to show the topic group (<em>DIALOG_INDENTATION</em>) below it’s bold headline.</div>
335 </li>
336 <li class="level1"><div class="li"> The vertikal and the horizontal separation is done with <em>DIALOG_H_SPACING</em> and <em>DIALOG_V_SPACING</em>.</div>
337 </li>
338 </ul>
340 </div>
341 <!-- SECTION "Dialog design of the current dialogs" [7515-7879] -->
342 <h3><a name="source_template_for_simple_dialogs" id="source_template_for_simple_dialogs">Source template for simple dialogs</a></h3>
343 <div class="level3">
346 This template is not intented to compile, but you can easily copy the code block that you need.
347 </p>
348 <pre class="code c"><span class="kw4">void</span> dialog <span class="br0">&#40;</span>TOPLEVEL *w_current<span class="br0">&#41;</span>
349 <span class="br0">&#123;</span>
350 GtkWidget *vbox, *label, *alignment, *table;
351 GtkWidget *dialog;
352 &nbsp;
353 <span class="coMULTI">/* only create the dialog if it is not there yet. This usually is a
354 widget pointer in the w_current structure:
355 dialog = w_current-&gt;tewindow */</span>
356 <span class="kw1">if</span> <span class="br0">&#40;</span>!dialog<span class="br0">&#41;</span> <span class="br0">&#123;</span>
357 dialog = gtk_dialog_new_with_buttons<span class="br0">&#40;</span>_<span class="br0">&#40;</span><span class="st0">&quot;Dialog title&quot;</span><span class="br0">&#41;</span>,
358 <span class="coMULTI">/* the parent window or NULL */</span>
359 GTK_WINDOW<span class="br0">&#40;</span>w_current-&gt;main_window<span class="br0">&#41;</span>,
360 <span class="coMULTI">/* dialog properties */</span>
361 GTK_DIALOG_MODAL, <span class="coMULTI">/* 0 for nonmodal dialogs */</span>
362 <span class="coMULTI">/* dialog buttons and response signals */</span>
363 GTK_STOCK_CANCEL,
364 GTK_RESPONSE_REJECT,
365 GTK_STOCK_OK,
366 GTK_RESPONSE_ACCEPT,
367 <span class="kw2">NULL</span><span class="br0">&#41;</span>;
368 &nbsp;
369 <span class="co2">#if GTK_CHECK_VERSION (2,6,0)</span>
370 <span class="coMULTI">/* Set the alternative button order (ok, cancel, help) for other systems */</span>
371 gtk_dialog_set_alternative_button_order<span class="br0">&#40;</span>GTK_DIALOG<span class="br0">&#40;</span>dialog<span class="br0">&#41;</span>,
372 GTK_RESPONSE_OK,
373 GTK_RESPONSE_NO,
374 GTK_RESPONSE_CANCEL,
375 GTK_RESPONSE_HELP,
376 <span class="nu0">-1</span><span class="br0">&#41;</span>;
377 <span class="co2">#endif</span>
378 &nbsp;
379 <span class="coMULTI">/* set default response signal. This is usually triggered by the
380 &quot;Return&quot; key */</span>
381 gtk_dialog_set_default_response<span class="br0">&#40;</span>GTK_DIALOG<span class="br0">&#40;</span>dialog<span class="br0">&#41;</span>,
382 GTK_RESPONSE_ACCEPT<span class="br0">&#41;</span>;
383 &nbsp;
384 <span class="coMULTI">/* set the function for handling the button responses and dialog close
385 for nonmodal dialogs you can use dialog_run() too.*/</span>
386 gtk_signal_connect<span class="br0">&#40;</span>GTK_OBJECT<span class="br0">&#40;</span>dialog<span class="br0">&#41;</span>, <span class="st0">&quot;response&quot;</span>,
387 GTK_SIGNAL_FUNC<span class="br0">&#40;</span>dialog_response<span class="br0">&#41;</span>, w_current<span class="br0">&#41;</span>;
388 &nbsp;
389 <span class="coMULTI">/* where to place the dialog: GTK_WIN_POS_MOUSE or GTK_WIN_POS_NONE */</span>
390 gtk_window_position<span class="br0">&#40;</span>GTK_WINDOW <span class="br0">&#40;</span>dialog<span class="br0">&#41;</span>, GTK_WIN_POS_MOUSE<span class="br0">&#41;</span>;
391 &nbsp;
392 <span class="coMULTI">/* set the border spacing and the vbox spacing of the dialog */</span>
393 vbox = GTK_DIALOG<span class="br0">&#40;</span>dialog<span class="br0">&#41;</span>-&gt;vbox;
394 gtk_container_set_border_width<span class="br0">&#40;</span>GTK_CONTAINER<span class="br0">&#40;</span>dialog<span class="br0">&#41;</span>,DIALOG_BORDER_SPACING<span class="br0">&#41;</span>;
395 gtk_box_set_spacing<span class="br0">&#40;</span>GTK_BOX<span class="br0">&#40;</span>vbox<span class="br0">&#41;</span>, DIALOG_V_SPACING<span class="br0">&#41;</span>;
396 &nbsp;
397 <span class="coMULTI">/* create a label (with markup) and pack it into the dialog box */</span>
398 label = gtk_label_new<span class="br0">&#40;</span>_<span class="br0">&#40;</span><span class="st0">&quot;&lt;b&gt;Section label&lt;/b&gt;&quot;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;
399 gtk_label_set_use_markup<span class="br0">&#40;</span>GTK_LABEL<span class="br0">&#40;</span>label<span class="br0">&#41;</span>, <span class="kw2">TRUE</span><span class="br0">&#41;</span>;
400 gtk_misc_set_alignment<span class="br0">&#40;</span>GTK_MISC<span class="br0">&#40;</span>label<span class="br0">&#41;</span>,<span class="nu0">0</span>,<span class="nu0">0</span><span class="br0">&#41;</span>;
401 gtk_box_pack_start<span class="br0">&#40;</span>GTK_BOX<span class="br0">&#40;</span>vbox<span class="br0">&#41;</span>, label, <span class="kw2">FALSE</span>, <span class="kw2">FALSE</span>, <span class="nu0">0</span><span class="br0">&#41;</span>;
402 &nbsp;
403 <span class="coMULTI">/* create a alignment container with the DIALOG_INDENTATION on the left */</span>
404 alignment = gtk_alignment_new<span class="br0">&#40;</span><span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">1</span>,<span class="nu0">1</span><span class="br0">&#41;</span>;
405 gtk_alignment_set_padding<span class="br0">&#40;</span>GTK_ALIGNMENT<span class="br0">&#40;</span>alignment<span class="br0">&#41;</span>, <span class="nu0">0</span>, <span class="nu0">0</span>,
406 DIALOG_INDENTATION, <span class="nu0">0</span><span class="br0">&#41;</span>;
407 gtk_box_pack_start<span class="br0">&#40;</span>GTK_BOX<span class="br0">&#40;</span>vbox<span class="br0">&#41;</span>, alignment, <span class="kw2">FALSE</span>, <span class="kw2">FALSE</span>, <span class="nu0">0</span><span class="br0">&#41;</span>;
408 &nbsp;
409 <span class="coMULTI">/* a table can store several entries. It is stored in the aligment container.
410 Note: the vertical and horizontal cell spacings */</span>
411 table = gtk_table_new <span class="br0">&#40;</span><span class="nu0">3</span>, <span class="nu0">2</span>, <span class="kw2">FALSE</span><span class="br0">&#41;</span>;
412 gtk_table_set_row_spacings<span class="br0">&#40;</span>GTK_TABLE<span class="br0">&#40;</span>table<span class="br0">&#41;</span>, DIALOG_V_SPACING<span class="br0">&#41;</span>;
413 gtk_table_set_col_spacings<span class="br0">&#40;</span>GTK_TABLE<span class="br0">&#40;</span>table<span class="br0">&#41;</span>, DIALOG_H_SPACING<span class="br0">&#41;</span>;
414 gtk_container_add<span class="br0">&#40;</span>GTK_CONTAINER<span class="br0">&#40;</span>alignment<span class="br0">&#41;</span>, table<span class="br0">&#41;</span>;
415 &nbsp;
416 <span class="coMULTI">/* a simple text label in one table cell with left alignment.
417 Note: the GTK_FILL in the third line is required */</span>
418 label = gtk_label_new<span class="br0">&#40;</span>_<span class="br0">&#40;</span><span class="st0">&quot;Text:&quot;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;
419 gtk_misc_set_alignment<span class="br0">&#40;</span>GTK_MISC<span class="br0">&#40;</span>label<span class="br0">&#41;</span>,<span class="nu0">0</span>,<span class="nu0">0</span><span class="br0">&#41;</span>;
420 gtk_table_attach<span class="br0">&#40;</span>GTK_TABLE<span class="br0">&#40;</span>table<span class="br0">&#41;</span>, label, <span class="nu0">0</span>,<span class="nu0">1</span>,<span class="nu0">0</span>,<span class="nu0">1</span>, GTK_FILL,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span><span class="br0">&#41;</span>;
421 &nbsp;
422 <span class="coMULTI">/* a simple text entry completes the option row */</span>
423 textentry = gtk_entry_new_with_max_length <span class="br0">&#40;</span><span class="nu0">10</span><span class="br0">&#41;</span>;
424 gtk_table_attach_defaults<span class="br0">&#40;</span>GTK_TABLE<span class="br0">&#40;</span>table<span class="br0">&#41;</span>, textentry, <span class="nu0">1</span>,<span class="nu0">2</span>,<span class="nu0">0</span>,<span class="nu0">1</span><span class="br0">&#41;</span>;
425 gtk_entry_set_activates_default<span class="br0">&#40;</span>GTK_ENTRY<span class="br0">&#40;</span>textentry<span class="br0">&#41;</span>, <span class="kw2">TRUE</span><span class="br0">&#41;</span>;
426 &nbsp;
427 <span class="coMULTI">/* ..... more table rows with options, or new sections */</span>
428 &nbsp;
429 <span class="coMULTI">/* create references to all widgets that you need later */</span>
430 GLADE_HOOKUP_OBJECT<span class="br0">&#40;</span>dialog, sizeentry,<span class="st0">&quot;textentry&quot;</span><span class="br0">&#41;</span>;
431 &nbsp;
432 <span class="coMULTI">/* show all widgets recursivly */</span>
433 gtk_widget_show_all<span class="br0">&#40;</span>dialog<span class="br0">&#41;</span>;
434 <span class="br0">&#125;</span>
435 &nbsp;
436 <span class="kw1">else</span> <span class="br0">&#123;</span>
437 <span class="coMULTI">/* Dialog is already there. Present it to the user.
438 This is only required if you have a nonmodal dialog */</span>
439 gtk_window_present<span class="br0">&#40;</span>GTK_WINDOW<span class="br0">&#40;</span>dialog<span class="br0">&#41;</span><span class="br0">&#41;</span>;
440 <span class="br0">&#125;</span>
441 &nbsp;
442 <span class="coMULTI">/* always set the current values to the dialog
443 If you're placing that part at the end of the dialog function you can
444 easily create dialogs that can be called, even if they are already open */</span>
445 textentry = g_object_get_data<span class="br0">&#40;</span>G_OBJECT<span class="br0">&#40;</span>dialog<span class="br0">&#41;</span>, <span class="st0">&quot;textentry&quot;</span><span class="br0">&#41;</span>;
446 gtk_entry_set_text<span class="br0">&#40;</span>GTK_ENTRY<span class="br0">&#40;</span>textentry<span class="br0">&#41;</span>, <span class="kw4">string</span><span class="br0">&#41;</span>;
447 <span class="coMULTI">/* select the text region that the user usually likes to overwrite */</span>
448 gtk_entry_select_region<span class="br0">&#40;</span>GTK_ENTRY<span class="br0">&#40;</span>textentry<span class="br0">&#41;</span>, <span class="nu0">0</span>, strlen<span class="br0">&#40;</span><span class="kw4">string</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;
449 <span class="br0">&#125;</span></pre>
451 The response function for such a dialog may look like this:
452 </p>
453 <pre class="code c"><span class="kw4">void</span> dialog_response<span class="br0">&#40;</span>GtkWidget *widget, gint response, TOPLEVEL *w_current<span class="br0">&#41;</span>
454 <span class="br0">&#123;</span>
455 <span class="kw1">switch</span> <span class="br0">&#40;</span>response<span class="br0">&#41;</span> <span class="br0">&#123;</span>
456 <span class="kw1">case</span> GTK_RESPONSE_ACCEPT:
457 <span class="coMULTI">/* apply the dialog settings:
458 just insert your code here if it is short
459 call an extra apply function if the required code is long */</span>
460 <span class="kw2">break</span>;
461 <span class="kw1">case</span> GTK_RESPONSE_REJECT:
462 <span class="kw1">case</span> GTK_RESPONSE_DELETE_EVENT:
463 <span class="coMULTI">/* for modal dialogs just do nothing,
464 for nonmodal dialogs, destroy the dialog and clean up */</span>
465 <span class="kw2">break</span>;
466 <span class="kw1">default</span>:
467 <span class="coMULTI">/* catch wrong signals signals (paranoid error checking ;-)) */</span>
468 <a href="http://www.opengroup.org/onlinepubs/009695399/functions/printf.html"><span class="kw3">printf</span></a><span class="br0">&#40;</span><span class="st0">&quot;dialog_response(): strange signal %d<span class="es0">\n</span>&quot;</span>, response<span class="br0">&#41;</span>;
469 <span class="br0">&#125;</span>
470 &nbsp;
471 <span class="coMULTI">/* for nonmodal dialogs just do nothing,
472 for modal dialogs, always destroy the dialog and clean up */</span>
473 <span class="br0">&#125;</span></pre>
474 </div>
475 <!-- SECTION "Source template for simple dialogs" [7880-13015] -->
476 <h3><a name="current_dialog_issues_in_gschem" id="current_dialog_issues_in_gschem">Current Dialog Issues in Gschem</a></h3>
477 <div class="level3">
478 <ul>
479 <li class="level1"><div class="li"> every dialog has it’s own design</div>
480 </li>
481 <li class="level1"><div class="li"> dialog placement: mouse position or no predefined position?</div>
482 </li>
483 <li class="level1"><div class="li"> dialogs do not remember their last size, position and contents.</div>
484 </li>
485 <li class="level1"><div class="li"> missing keyboard shortcuts</div>
486 </li>
487 </ul>
490 <strong>Here’s a list of things that could be improved:</strong>
491 </p>
493 </div>
495 <h5><a name="print_dialog" id="print_dialog">Print Dialog</a></h5>
496 <div class="level5">
497 <ul>
498 <li class="level1"><div class="li"> change design?</div>
499 </li>
500 </ul>
502 </div>
504 <h5><a name="write_image" id="write_image">Write Image</a></h5>
505 <div class="level5">
506 <ul>
507 <li class="level1"><div class="li"> In the fileselect dialog the default filename is missing if the file does not exist</div>
508 </li>
509 <li class="level1"><div class="li"> Return key does not work in the filename entry</div>
510 </li>
511 </ul>
513 </div>
515 <h5><a name="execute_script" id="execute_script">Execute Script</a></h5>
516 <div class="level5">
517 <ul>
518 <li class="level1"><div class="li"> </div>
519 </li>
520 </ul>
522 </div>
524 <h5><a name="edit_text" id="edit_text">Edit Text</a></h5>
525 <div class="level5">
526 <ul>
527 <li class="level1"><div class="li"> some missing keyboard shortcuts</div>
528 </li>
529 <li class="level1"><div class="li"> add *unmodified* tags if there are multiple selections</div>
530 </li>
531 <li class="level1"><div class="li"> maybe add some color pixbufs for the color</div>
532 </li>
533 <li class="level1"><div class="li"> maybe replace the text alignment with nine ratio buttons, toggle buttons with icons or &hellip;</div>
534 </li>
535 </ul>
537 </div>
539 <h5><a name="color_dialog" id="color_dialog">Color Dialog</a></h5>
540 <div class="level5">
541 <ul>
542 <li class="level1"><div class="li"> maybe add some color pixbufs for the color</div>
543 </li>
544 </ul>
546 </div>
548 <h5><a name="line_width_and_type" id="line_width_and_type">Line Width and Type</a></h5>
549 <div class="level5">
550 <ul>
551 <li class="level1"><div class="li"> keyboard shortcuts missing</div>
552 </li>
553 <li class="level1"><div class="li"> icons for the line type</div>
554 </li>
555 </ul>
557 </div>
559 <h5><a name="fill_type" id="fill_type">Fill Type</a></h5>
560 <div class="level5">
561 <ul>
562 <li class="level1"><div class="li"> keyboard shortcuts missing</div>
563 </li>
564 <li class="level1"><div class="li"> icons in the fill type</div>
565 </li>
566 </ul>
568 </div>
570 <h5><a name="translate_symbol" id="translate_symbol">Translate Symbol</a></h5>
571 <div class="level5">
572 <ul>
573 <li class="level1"><div class="li"> </div>
574 </li>
575 </ul>
577 </div>
579 <h5><a name="page_manager" id="page_manager">Page Manager</a></h5>
580 <div class="level5">
581 <ul>
582 <li class="level1"><div class="li"> wrong button order? Depends on whether you think the refresh button is the main action button or just an extra button.</div>
583 </li>
584 <li class="level1"><div class="li"> Maybe the “Return” key should trigger Refresh</div>
585 </li>
586 </ul>
588 </div>
590 <h5><a name="component_selector" id="component_selector">Component Selector</a></h5>
591 <div class="level5">
592 <ul>
593 <li class="level1"><div class="li"> strange edit widget when typing and the tree is selected (It’s a search helper widget, disable it?!)</div>
594 </li>
595 </ul>
597 </div>
599 <h5><a name="single_attribut_editor" id="single_attribut_editor">Single Attribut Editor</a></h5>
600 <div class="level5">
601 <ul>
602 <li class="level1"><div class="li"> when multiple elements are selected and you call edit (ee) there are a few problems:</div>
603 <ul>
604 <li class="level3"><div class="li"> if the first object is text, then this dialog is opened (but with the wrong list parameter</div>
605 </li>
606 <li class="level3"><div class="li"> if the first object is complex then the multiple attribute editor is called</div>
607 </li>
608 </ul>
609 </li>
610 </ul>
612 </div>
614 <h5><a name="multi_attribute_editor" id="multi_attribute_editor">Multi Attribute Editor</a></h5>
615 <div class="level5">
616 <ul>
617 <li class="level1"><div class="li"> </div>
618 </li>
619 </ul>
621 </div>
623 <h5><a name="add_text" id="add_text">Add Text</a></h5>
624 <div class="level5">
625 <ul>
626 <li class="level1"><div class="li"> </div>
627 </li>
628 </ul>
630 </div>
632 <h5><a name="arc_params" id="arc_params">Arc Params</a></h5>
633 <div class="level5">
634 <ul>
635 <li class="level1"><div class="li"> add the diameter to the dialog, but select the start angle entry (increment = grid)</div>
636 </li>
637 <li class="level1"><div class="li"> let “ee” call that dialog if only a single arc is selected</div>
638 </li>
639 <li class="level1"><div class="li"> maybe add a section label</div>
640 </li>
641 </ul>
643 </div>
645 <h5><a name="insert_picture" id="insert_picture">Insert Picture</a></h5>
646 <div class="level5">
647 <ul>
648 <li class="level1"><div class="li"> </div>
649 </li>
650 </ul>
652 </div>
654 <h5><a name="picture_replace" id="picture_replace">Picture Replace</a></h5>
655 <div class="level5">
656 <ul>
657 <li class="level1"><div class="li"> the new picture uses the aspect ratio of the old picture</div>
658 </li>
659 <li class="level1"><div class="li"> the dialog has lots in common with the Insert Picture dialog. They could use some code together</div>
660 </li>
661 </ul>
663 </div>
665 <h5><a name="find_text" id="find_text">Find Text</a></h5>
666 <div class="level5">
667 <ul>
668 <li class="level1"><div class="li"> manipulates the mouse pointer (maybe the zooming code is the culprit). Just press “Return” to trigger a FindNext</div>
669 </li>
670 <li class="level1"><div class="li"> if you select hierarchy and the found text is in a different schematic, then the filename in the title is not updated</div>
671 </li>
672 <li class="level1"><div class="li"> maybe add an option: “Select all matching text objects”, disable hierarchy for that feature!</div>
673 </li>
674 <li class="level1"><div class="li"> <img src="lib/images/smileys/fixme.gif" class="middle" alt="FIXME" /> gschem hangs if you use that dialog with hierarchical schematics that have dependancy loops (e.g. the autonumber test schematics)</div>
675 </li>
676 <li class="level1"><div class="li"> add an option “search for visible text only”</div>
677 </li>
678 <li class="level1"><div class="li"> maybe use regular expressions instead of the substring for the searchtext</div>
679 </li>
680 </ul>
682 </div>
684 <h5><a name="hide_text" id="hide_text">Hide Text</a></h5>
685 <div class="level5">
686 <ul>
687 <li class="level1"><div class="li"> use regular expressions instead of starting substring</div>
688 </li>
689 </ul>
691 </div>
693 <h5><a name="show_text" id="show_text">Show Text</a></h5>
694 <div class="level5">
695 <ul>
696 <li class="level1"><div class="li"> use regular expressions instead of starting substring</div>
697 </li>
698 <li class="level1"><div class="li"> Maybe merge that dialog together with the “Hide Text” dialog</div>
699 </li>
700 </ul>
702 </div>
704 <h5><a name="autonumber_text" id="autonumber_text">Autonumber Text</a></h5>
705 <div class="level5">
706 <ul>
707 <li class="level1"><div class="li"> Maybe disable the skip option if the renumber scope is “selection”. The other skip options (Page and Hierarchy) are really stupid.</div>
708 </li>
709 </ul>
711 </div>
713 <h5><a name="text_size" id="text_size">Text Size</a></h5>
714 <div class="level5">
715 <ul>
716 <li class="level1"><div class="li"> </div>
717 </li>
718 </ul>
720 </div>
722 <h5><a name="snap_grid_spacing" id="snap_grid_spacing">Snap Grid Spacing</a></h5>
723 <div class="level5">
724 <ul>
725 <li class="level1"><div class="li"> </div>
726 </li>
727 </ul>
729 </div>
731 <h5><a name="coord_dialog" id="coord_dialog">Coord Dialog</a></h5>
732 <div class="level5">
733 <ul>
734 <li class="level1"><div class="li"> maybe move the world coordinates to the main window status bar</div>
735 </li>
736 </ul>
738 </div>
740 <h5><a name="about_dialog" id="about_dialog">About Dialog</a></h5>
741 <div class="level5">
742 <ul>
743 <li class="level1"><div class="li"> </div>
744 </li>
745 </ul>
747 </div>
749 <h5><a name="hotkeys" id="hotkeys">Hotkeys</a></h5>
750 <div class="level5">
751 <ul>
752 <li class="level1"><div class="li"> </div>
753 </li>
754 </ul>
756 </div>
757 <!-- SECTION "Current Dialog Issues in Gschem" [13016-] --></div>
758 </body>
759 </html>