User Tools

Site Tools


geda:devel-tips

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
geda:devel-tips [2012/05/15 08:15]
vzh Added C formatting
geda:devel-tips [2014/04/18 11:25] (current)
vzh Add link to Russian translation
Line 1: Line 1:
 +//​Translations of this page are also available in the following languages://​ [[devel-tips.ru|Русский]].
 +
 ====== gEDA Developer Tips, tricks and hints ====== ====== gEDA Developer Tips, tricks and hints ======
  
  
 ===== Data Structure of a Schematic ===== ===== Data Structure of a Schematic =====
-Internally, a schematic in gaf is implemented by number of doubly linked lists. The central type linked in the lists is OBJECT. It can represent a symbol, a line of text, a drawing primitive, a net, or an attribute. ​  ​+Internally, a schematic in gaf is implemented by number of doubly linked lists. The central type linked in the lists is OBJECT. It can represent a symbol, a line of text, a drawing primitive, a net, or an attribute.
  
 An overview of the data structure of a schematic can be retrieved [[http://​www.brorson.com/​gEDA/​gEDA_Structures_20050108.pdf|here]]. The sketch was drawn in 2005 by Stuart Brorson. An overview of the data structure of a schematic can be retrieved [[http://​www.brorson.com/​gEDA/​gEDA_Structures_20050108.pdf|here]]. The sketch was drawn in 2005 by Stuart Brorson.
Line 16: Line 18:
 **Doxygen** is a tool which extracts API documentation from comments in the source code. Markup can be placed in the comments, which is then extracted and rendered to HTML or LaTeX by Doxygen. This allows e.g. one function to link to another related function, and permits arguments and return values to have documentation associated with them. **Doxygen** is a tool which extracts API documentation from comments in the source code. Markup can be placed in the comments, which is then extracted and rendered to HTML or LaTeX by Doxygen. This allows e.g. one function to link to another related function, and permits arguments and return values to have documentation associated with them.
  
-Some sections of the gaf source have already been doxyfied. Currently, this includes libgeda, gschem, gnetlist, gsymcheck and gattrib. The Makefile in the doc dir of these tools contains a target "​doxygen"​. Alternatively,​ you can browse the output of doxygen online [[http://​www.xs4all.nl/​~ljh4timm/​gaf/​dox.html|on this site]], made available by Bert Timmerman. ​+Some sections of the gaf source have already been doxyfied. Currently, this includes libgeda, gschem, gnetlist, gsymcheck and gattrib. The Makefile in the //​docs// ​dir of these tools contains a target "​doxygen"​. Alternatively,​ you can browse the output of doxygen online [[http://​www.xs4all.nl/​~ljh4timm/​gaf/​dox.html|on this site]], made available by Bert Timmerman.
  
-If you want to see Doxygen'​s ideas on how to format documentation see the [[http://​www.stack.nl/​~dimitri/​doxygen/​docblocks.html|Doxygen website]]. The individual commands are documented [[http://​www.stack.nl/​~dimitri/​doxygen/​commands.html|here]]. There is also a very handy Doxygen [[http://​www.digilife.be/​quickreferences/​QRC/​Doxygen%20Quick%20Reference.pdf|quick reference card]].+If you want to see Doxygen'​s ideas on how to format documentation see the [[http://​www.stack.nl/​~dimitri/​doxygen/​docblocks.html|Doxygen website]]. The individual commands are documented [[http://​www.stack.nl/​~dimitri/​doxygen/​commands.html|here]]. There is also a very handy Doxygen [[http://​www.digilife.be/​quickreferences/​QRC/​Doxygen ​Quick Reference.pdf|quick reference card]].
  
 The following sections provide an introduction on how gschem and libgeda are customarily documented. Note that the QT style of **%%/*! comment goes here */%%** for a Doxygen-enabled comment is preferred. The following sections provide an introduction on how gschem and libgeda are customarily documented. Note that the QT style of **%%/*! comment goes here */%%** for a Doxygen-enabled comment is preferred.
Line 111: Line 113:
 A modal dialog is required whenever the main application provides data for the dialog. A modal dialog is required whenever the main application provides data for the dialog.
  
-  Example: ​+  Example:
     The dialog is called with a selection list and the dialog only should operate on this selection.     The dialog is called with a selection list and the dialog only should operate on this selection.
  
-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. ​+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.
  
 A modal dialog is not OK if there is a lot of user interaction with the dialog. The component selection is a good example. A modal dialog is not OK if there is a lot of user interaction with the dialog. The component selection is a good example.
Line 130: Line 132:
  
 ==== Placing dialogs in front of their parent window ==== ==== Placing dialogs in front of their parent window ====
-Most of the dialogs are placed in front of their parent window using the transient_for property (see. [[http://​developer.gnome.org/​doc/​API/​2.0/​gtk/​GtkWindow.html#​gtk-window-set-transient-for | GtkReference]]). This property should be set for all modal dialogs. ​+Most of the dialogs are placed in front of their parent window using the transient_for property (see. [[http://​developer.gnome.org/​doc/​API/​2.0/​gtk/​GtkWindow.html#​gtk-window-set-transient-for | GtkReference]]). This property should be set for all modal dialogs.
  
 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. 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.
Line 167: Line 169:
 {{:​devel_tips:​dialog_picture.png}} {{:​devel_tips:​dialog_picture.png}}
  
-  * There is some space around the whole dialog (//​DIALOG_BORDER_SPACING//​). ​+  * There is some space around the whole dialog (//​DIALOG_BORDER_SPACING//​).
   * Some indentation to show the topic group (//​DIALOG_INDENTATION//​) below it's bold headline.   * Some indentation to show the topic group (//​DIALOG_INDENTATION//​) below it's bold headline.
   * The vertikal and the horizontal separation is done with //​DIALOG_H_SPACING//​ and //​DIALOG_V_SPACING//​.   * The vertikal and the horizontal separation is done with //​DIALOG_H_SPACING//​ and //​DIALOG_V_SPACING//​.
Line 181: Line 183:
  
   /* only create the dialog if it is not there yet. This usually is a   /* only create the dialog if it is not there yet. This usually is a
-     ​widget pointer in the w_current structure: ​+     ​widget pointer in the w_current structure:
      ​dialog = w_current->​tewindow */      ​dialog = w_current->​tewindow */
   if (!dialog) {   if (!dialog) {
     dialog = gtk_dialog_new_with_buttons(_("​Dialog title"​),​     dialog = gtk_dialog_new_with_buttons(_("​Dialog title"​),​
  /* the parent window or NULL */  /* the parent window or NULL */
- GTK_WINDOW(w_current->​main_window), ​+ GTK_WINDOW(w_current->​main_window),​
  /* dialog properties */  /* dialog properties */
  GTK_DIALOG_MODAL,​ /* 0 for nonmodal dialogs */  GTK_DIALOG_MODAL,​ /* 0 for nonmodal dialogs */
Line 204: Line 206:
      -1);      -1);
  
-    /* set default response signal. This is usually triggered by the +    /* set default response signal. This is usually triggered by the
        "​Return"​ key */        "​Return"​ key */
     gtk_dialog_set_default_response(GTK_DIALOG(dialog),​     gtk_dialog_set_default_response(GTK_DIALOG(dialog),​
      GTK_RESPONSE_ACCEPT);​      GTK_RESPONSE_ACCEPT);​
  
-    /* set the function for handling the button responses and dialog close +    /* set the function for handling the button responses and dialog close
        for nonmodal dialogs you can use dialog_run() too.*/        for nonmodal dialogs you can use dialog_run() too.*/
     gtk_signal_connect(GTK_OBJECT(dialog),​ "​response",​     gtk_signal_connect(GTK_OBJECT(dialog),​ "​response",​
Line 230: Line 232:
     /* create a alignment container with the DIALOG_INDENTATION on the left */     /* create a alignment container with the DIALOG_INDENTATION on the left */
     alignment = gtk_alignment_new(0,​0,​1,​1);​     alignment = gtk_alignment_new(0,​0,​1,​1);​
-    gtk_alignment_set_padding(GTK_ALIGNMENT(alignment),​ 0, 0, +    gtk_alignment_set_padding(GTK_ALIGNMENT(alignment),​ 0, 0,
        DIALOG_INDENTATION,​ 0);        DIALOG_INDENTATION,​ 0);
     gtk_box_pack_start(GTK_BOX(vbox),​ alignment, FALSE, FALSE, 0);     gtk_box_pack_start(GTK_BOX(vbox),​ alignment, FALSE, FALSE, 0);
Line 241: Line 243:
     gtk_container_add(GTK_CONTAINER(alignment),​ table);     gtk_container_add(GTK_CONTAINER(alignment),​ table);
  
-    /* a simple text label in one table cell with left alignment. ​+    /* a simple text label in one table cell with left alignment.
        Note: the GTK_FILL in the third line is required */        Note: the GTK_FILL in the third line is required */
     label = gtk_label_new(_("​Text:"​));​     label = gtk_label_new(_("​Text:"​));​
     gtk_misc_set_alignment(GTK_MISC(label),​0,​0);​     gtk_misc_set_alignment(GTK_MISC(label),​0,​0);​
     gtk_table_attach(GTK_TABLE(table),​ label, 0,1,0,1, GTK_FILL,​0,​0,​0);​     gtk_table_attach(GTK_TABLE(table),​ label, 0,1,0,1, GTK_FILL,​0,​0,​0);​
-    ​+
     /* a simple text entry completes the option row */     /* a simple text entry completes the option row */
     textentry = gtk_entry_new_with_max_length (10);     textentry = gtk_entry_new_with_max_length (10);
Line 261: Line 263:
   }   }
  
-  else {  +  else { 
-    /* Dialog is already there. Present it to the user. +    /* Dialog is already there. Present it to the user.
        This is only required if you have a nonmodal dialog */        This is only required if you have a nonmodal dialog */
     gtk_window_present(GTK_WINDOW(dialog));​     gtk_window_present(GTK_WINDOW(dialog));​
   }   }
  
-  /* always set the current values to the dialog  +  /* always set the current values to the dialog 
-     If you're placing that part at the end of the dialog function you can +     If you're placing that part at the end of the dialog function you can
      ​easily create dialogs that can be called, even if they are already open */      ​easily create dialogs that can be called, even if they are already open */
   textentry = g_object_get_data(G_OBJECT(dialog),​ "​textentry"​);​   textentry = g_object_get_data(G_OBJECT(dialog),​ "​textentry"​);​
Line 308: Line 310:
   * dialogs do not remember their last size, position and contents.   * dialogs do not remember their last size, position and contents.
   * missing keyboard shortcuts   * missing keyboard shortcuts
-  ​+
 **Here'​s a list of things that could be improved:** **Here'​s a list of things that could be improved:**
  
Line 317: Line 319:
    * In the fileselect dialog the default filename is missing if the file does not exist    * In the fileselect dialog the default filename is missing if the file does not exist
    * Return key does not work in the filename entry    * Return key does not work in the filename entry
-   +
 ==Execute Script== ==Execute Script==
-   ​* ​+   *
  
 ==Edit Text== ==Edit Text==
Line 339: Line 341:
  
 ==Translate Symbol== ==Translate Symbol==
-   ​* ​+   *
  
 ==Page Manager== ==Page Manager==
Line 347: Line 349:
 ==Component Selector== ==Component Selector==
    * strange edit widget when typing and the tree is selected (It's a search helper widget, disable it?!)    * strange edit widget when typing and the tree is selected (It's a search helper widget, disable it?!)
-   +
 ==Single Attribut Editor== ==Single Attribut Editor==
    * when multiple elements are selected and you call edit (ee) there are a few problems:    * when multiple elements are selected and you call edit (ee) there are a few problems:
Line 354: Line 356:
  
 ==Multi Attribute Editor== ==Multi Attribute Editor==
-   ​* ​+   *
  
 ==Add Text== ==Add Text==
-   ​* ​+   *
  
 ==Arc Params== ==Arc Params==
Line 365: Line 367:
  
 ==Insert Picture== ==Insert Picture==
-   ​* ​+   *
  
 ==Picture Replace== ==Picture Replace==
Line 385: Line 387:
    * use regular expressions instead of starting substring    * use regular expressions instead of starting substring
    * Maybe merge that dialog together with the "Hide Text" dialog    * Maybe merge that dialog together with the "Hide Text" dialog
-   +
 ==Autonumber Text== ==Autonumber Text==
    * Maybe disable the skip option if the renumber scope is "​selection"​. The other skip options (Page and Hierarchy) are really stupid.    * Maybe disable the skip option if the renumber scope is "​selection"​. The other skip options (Page and Hierarchy) are really stupid.
  
 ==Text Size== ==Text Size==
-   ​* ​+   *
  
 ==Snap Grid Spacing== ==Snap Grid Spacing==
-   ​* ​+   *
  
-==Coord Dialog== ​  ​+==Coord Dialog==
    * maybe move the world coordinates to the main window status bar    * maybe move the world coordinates to the main window status bar
  
 ==About Dialog== ==About Dialog==
-   ​* ​+   *
  
 ==Hotkeys== ==Hotkeys==
    *    *
  
geda/devel-tips.1337084117.txt.gz · Last modified: 2012/05/15 08:15 by vzh