Exemple #1
0
/*! \brief create a new page object
 *  \par Function Description
 *  Creates a new page and add it to <B>toplevel</B>'s list of pages.
 *
 *  It initializes the #PAGE structure and set its <B>page_filename</B>
 *  to <B>filename</B>. <B>toplevel</B>'s current page is not changed by
 *  this function.
 */
PAGE *s_page_new (TOPLEVEL *toplevel, const gchar *filename)
{
  PAGE *page;

  /* Now create a blank page */
  page = (PAGE*)g_new0 (PAGE, 1);

  page->pid = global_pid++;

  page->CHANGED = 0;

  /* big assumption here that page_filename isn't null */
  if (g_path_is_absolute (filename)) {
    page->page_filename = g_strdup (filename);
  } else {
    gchar *pwd = g_get_current_dir ();
    page->page_filename = g_build_filename (pwd, filename, NULL);
    g_free (pwd);
  }
	
  g_assert (toplevel->init_bottom != 0);

  page->up = -2;
  page->page_control = 0;

  /* Init connectible objects array */
  page->connectible_list = NULL;

  /* Init the object list */
  page->_object_list = NULL;

  /* new selection mechanism */
  page->selection_list = o_selection_new();

  page->place_list = NULL;

  /* init undo struct pointers */
  s_undo_init(page);
  
  page->object_lastplace = NULL;

  page->weak_refs = NULL;
  
  /* Backup variables */
  g_get_current_time (&page->last_load_or_save_time);
  page->ops_since_last_backup = 0;
  page->saved_since_first_loaded = 0;
  page->do_autosave_backup = 0;

  /* now append page to page list of toplevel */
  geda_list_add( toplevel->pages, page );
  page->toplevel = toplevel;

  return page;
}
Exemple #2
0
/*! \brief create a new page object
 *  \par Function Description
 *  Creates a new page and add it to <B>toplevel</B>'s list of pages.
 *
 *  It initializes the #PAGE structure and set its <B>page_filename</B>
 *  to <B>filename</B>. <B>toplevel</B>'s current page is not changed by
 *  this function.
 */
PAGE *s_page_new (TOPLEVEL *toplevel, const gchar *filename)
{
  PAGE *page;

  /* Now create a blank page */
  page = (PAGE*)g_new0 (PAGE, 1);

  page->pid = global_pid++;

  page->CHANGED = 0;

  /* big assumption here that page_filename isn't null */
  if (g_path_is_absolute (filename)) {
    page->page_filename = g_strdup (filename);
  } else {
    gchar *pwd = g_get_current_dir ();
    page->page_filename = g_build_filename (pwd, filename, NULL);
    g_free (pwd);
  }
	
  g_assert (toplevel->init_bottom != 0);
  page->coord_aspectratio = (
    ((float) toplevel->init_right) / ((float) toplevel->init_bottom));

  page->up = -2;
  page->page_control = 0;

  /* Init tile array */
  s_tile_init (toplevel, page);

  /* Init the object list */
  page->_object_list = NULL;

  /* new selection mechanism */
  page->selection_list = o_selection_new();

  /* net/pin/bus stretch when doing moves */
  page->stretch_list = NULL;

  page->place_list = NULL;

  /* init undo struct pointers */
  s_undo_init(page);
  
  page->object_lastplace = NULL;
  
  set_window (toplevel, page,
              toplevel->init_left, toplevel->init_right,
              toplevel->init_top,  toplevel->init_bottom);

  /* Backup variables */
  g_get_current_time (&page->last_load_or_save_time);
  page->ops_since_last_backup = 0;
  page->saved_since_first_loaded = 0;
  page->do_autosave_backup = 0;

  page->load_newer_backup_func = load_newer_backup_func;

  /* now append page to page list of toplevel */
  geda_list_add( toplevel->pages, page );

  return page;
}