[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

gEDA-cvs: CVS update: .cvsignore



  User: ahvezda 
  Date: 07/01/08 23:47:11

  Modified:    .        .cvsignore Makefile.am
  Added:       .        o_embed.c
  Log:
  Added "embed/unembed all components/schematics" functionality to gschlas
  
  
  
  
  Revision  Changes    Path
  1.2       +0 -1      eda/geda/gaf/libgeda/src/.cvsignore
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: .cvsignore
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/libgeda/src/.cvsignore,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -b -r1.1 -r1.2
  --- .cvsignore	27 Oct 2002 19:24:24 -0000	1.1
  +++ .cvsignore	9 Jan 2007 04:47:11 -0000	1.2
  @@ -1,4 +1,3 @@
  -*.c
   *.lo
   .deps
   .libs
  
  
  
  1.58      +3 -2      eda/geda/gaf/libgeda/src/Makefile.am
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: Makefile.am
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/libgeda/src/Makefile.am,v
  retrieving revision 1.57
  retrieving revision 1.58
  diff -u -b -r1.57 -r1.58
  --- Makefile.am	25 Aug 2006 01:00:13 -0000	1.57
  +++ Makefile.am	9 Jan 2007 04:47:11 -0000	1.58
  @@ -1,4 +1,4 @@
  -# $Id: Makefile.am,v 1.57 2006/08/25 01:00:13 ahvezda Exp $
  +# $Id: Makefile.am,v 1.58 2007/01/09 04:47:11 ahvezda Exp $
   #
   # NOTE: Don't forget that in the libtool distribution, files in this
   # directory are distributed by the demo_distfiles variable in the top
  @@ -17,7 +17,8 @@
   	o_arc_basic.c o_attrib.c o_basic.c o_box_basic.c \
   	o_circle_basic.c o_complex_basic.c o_line_basic.c o_list.c \
   	o_net_basic.c o_selection.c o_bus_basic.c o_text_basic.c \
  -	o_pin_basic.c o_image.c u_basic.c s_attrib.c s_basic.c \
  +	o_pin_basic.c o_image.c o_embed.c \
  +	u_basic.c s_attrib.c s_basic.c \
   	s_clib.c s_encoding.c s_hierarchy.c s_papersizes.c s_stretch.c \
   	s_log.c \
   	s_page.c s_slib.c s_color.c s_undo.c s_conn.c \
  
  
  
  1.1                  eda/geda/gaf/libgeda/src/o_embed.c
  
  Index: o_embed.c
  ===================================================================
  /* gEDA - GPL Electronic Design Automation
   * libgeda - gEDA's library
   * Copyright (C) 1998-2007 Ales V. Hvezda
   *
   * This program is free software; you can redistribute it and/or modify
   * it under the terms of the GNU General Public License as published by
   * the Free Software Foundation; either version 2 of the License, or
   * (at your option) any later version.
   *
   * This program is distributed in the hope that it will be useful,
   * but WITHOUT ANY WARRANTY; without even the implied warranty of
   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   * GNU General Public License for more details.
   *
   * You should have received a copy of the GNU General Public License
   * along with this program; if not, write to the Free Software
   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA
   */
  #include <config.h>
  
  #include <stdio.h>
  
  #include <gtk/gtk.h>
  #include <libguile.h>
  
  #ifdef HAS_LIBGD
  #include <gd.h>
  #endif
  #include <libgen.h>
  
  #include "defines.h"
  #include "struct.h"
  #include "globals.h"
  #include "o_types.h"
  #include "funcs.h"
  #include "colors.h"
  
  #include "../include/prototype.h"
  
  #ifdef HAVE_LIBDMALLOC
  #include <dmalloc.h>
  #endif
  
  
  /*! \todo Finish function documentation!!!
   *  \brief
   *  \par Function Description
   * 
   */
  void o_embed(TOPLEVEL *w_current, OBJECT *o_current)
  {
    gchar *new_basename;
  
    /* check o_current is a complex and is not already embedded */
    if (o_current->type == OBJ_COMPLEX &&
        !o_complex_is_embedded (o_current))
    {
      /* change the clib of complex to "EMBEDDED" */
      if (o_current->complex_clib) {
        g_free (o_current->complex_clib);
      }
      o_current->complex_clib = g_strdup ("EMBEDDED");
  
      /* change the basename to "EMBEDDED"+basename */
      new_basename = g_strconcat ("EMBEDDED",
                                  o_current->complex_basename,
                                  NULL);
      g_free (o_current->complex_basename);
      o_current->complex_basename = new_basename;
  
      s_log_message ("Component [%s] has been embedded\n",
                     o_current->complex_basename + 8);
      
      /* page content has been modified */
      w_current->page_current->CHANGED = 1;
    }
  
    /* If it's a picture and it's not embedded */
    if ( (o_current->type == OBJ_PICTURE) &&
         (o_current->picture->embedded == 0) ) {
  
      o_current->picture->embedded = 1;
      
      s_log_message ("Picture [%s] has been embedded\n",
  		   basename(o_current->picture->filename));
      
      
      /* page content has been modified */
      w_current->page_current->CHANGED = 1;
    }
    
  }
  
  /*! \todo Finish function documentation!!!
   *  \brief
   *  \par Function Description
   * 
   */
  void o_unembed(TOPLEVEL *w_current, OBJECT *o_current)
  {
    gchar *new_basename, *new_clib;
    const GSList *clibs;
    
    /* check o_current is an embedded complex */
    if (o_current->type == OBJ_COMPLEX &&
        o_complex_is_embedded (o_current))
    {
      /* get ride of the EMBEDDED word in basename */
      new_basename = g_strdup (o_current->complex_basename + 8);
      
      /* search for the symbol in the library */
      clibs = s_clib_search_basename (new_basename);
  
      if (!clibs) {
        /* symbol not found in the symbol library: signal an error */
        s_log_message ("Could not find component [%s], while trying to unembed. Component is still embedded\n",
                       o_current->complex_basename + 8);
        
      } else {
        /* set the object new basename */
        g_free (o_current->complex_basename);
        o_current->complex_basename = new_basename;
  
        /* set the object new clib */
        g_free (o_current->complex_clib);
        if (g_slist_next (clibs)) {
          s_log_message ("More than one component found with name [%s]\n",
                         new_basename);
          /* PB: for now, use the first directory in clibs */
          /* PB: maybe open a dialog to select the right one? */
        }
        new_clib = g_strdup ((gchar*)clibs->data);
        o_current->complex_clib = new_clib;
  
        s_log_message ("Component [%s] has been successfully unembedded\n",
                       o_current->complex_basename);
        
        /* page content has been modified */
        w_current->page_current->CHANGED = 1;
        
      }
    }
  
    /* If it's a picture and it's embedded */
    if ( (o_current->type == OBJ_PICTURE) &&
         (o_current->picture->embedded == 1) ) {
  
      o_current->picture->embedded = 0;
      
      s_log_message ("Picture [%s] has been unembedded\n",
  		   basename(o_current->picture->filename));
      
      
      /* page content has been modified */
      w_current->page_current->CHANGED = 1;
    }
    
  }
  
  
  


_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs