libgeda

s_page.c File Reference

The page system. More...

#include <config.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include "libgeda_priv.h"
Include dependency graph for s_page.c:

Go to the source code of this file.

Functions

static void object_added (TOPLEVEL *toplevel, PAGE *page, OBJECT *object)
static void pre_object_removed (TOPLEVEL *toplevel, PAGE *page, OBJECT *object)
PAGEs_page_new (TOPLEVEL *toplevel, const gchar *filename)
 create a new page object
void s_page_delete (TOPLEVEL *toplevel, PAGE *page)
 delete a page and it's contents
void s_page_delete_list (TOPLEVEL *toplevel)
 Deletes the list of pages of toplevel.
void s_page_weak_ref (PAGE *page, void(*notify_func)(void *, void *), void *user_data)
 Add a weak reference watcher to an PAGE.
void s_page_weak_unref (PAGE *page, void(*notify_func)(void *, void *), void *user_data)
 Remove a weak reference watcher from an PAGE.
void s_page_add_weak_ptr (PAGE *page, void *weak_pointer_loc)
 Add a weak pointer to an PAGE.
void s_page_remove_weak_ptr (PAGE *page, void *weak_pointer_loc)
 Remove a weak pointer from an PAGE.
void s_page_goto (TOPLEVEL *toplevel, PAGE *p_new)
 changes the current page in toplevel
PAGEs_page_search (TOPLEVEL *toplevel, const gchar *filename)
 Search for pages by filename.
PAGEs_page_search_by_page_id (GedaPageList *list, int pid)
 Search for a page given its page id in a page list.
void s_page_print_all (TOPLEVEL *toplevel)
 Print full TOPLEVEL structure.
gint s_page_save_all (TOPLEVEL *toplevel)
 Saves all the pages of a TOPLEVEL object.
gboolean s_page_check_changed (GedaPageList *list)
 Check if CHANGED flag is set for any page in list.
void s_page_clear_changed (GedaPageList *list)
 Reset the CHANGED flag of all pages.
void s_page_autosave_init (TOPLEVEL *toplevel)
 Autosave initialization function.
gint s_page_autosave (TOPLEVEL *toplevel)
 Autosave callback function.
void s_page_append (TOPLEVEL *toplevel, PAGE *page, OBJECT *object)
 Append an OBJECT to the PAGE.
void s_page_append_list (TOPLEVEL *toplevel, PAGE *page, GList *obj_list)
 Append a GList of OBJECTs to the PAGE.
void s_page_remove (TOPLEVEL *toplevel, PAGE *page, OBJECT *object)
 Remove an OBJECT from the PAGE.
void s_page_replace (TOPLEVEL *toplevel, PAGE *page, OBJECT *object1, OBJECT *object2)
 Replace an OBJECT in a PAGE, in the same list position.
void s_page_delete_objects (TOPLEVEL *toplevel, PAGE *page)
 Remove and free all OBJECTs from the PAGE.
const GList * s_page_objects (PAGE *page)
 Return a GList of OBJECTs on the PAGE.
GList * s_page_objects_in_region (TOPLEVEL *toplevel, PAGE *page, int min_x, int min_y, int max_x, int max_y)
 Find the objects in a given region.
GList * s_page_objects_in_regions (TOPLEVEL *toplevel, PAGE *page, BOX *rects, int n_rects)
 Find the objects in a given region.

Variables

static gint global_pid = 0

Detailed Description

libgeda can handle multiple schematic or symbol pages. libgeda keeps track of the currently opened pages with a managed _GedaList. The currently used page is refered with an extra pointer.

Each page carries a list of the objects that are on the page. The first and the last element are referenced by the head and tail pointers.

s_page_overview.png

Definition in file s_page.c.


Function Documentation

static void object_added ( TOPLEVEL toplevel,
PAGE page,
OBJECT object 
) [static]

Definition at line 63 of file s_page.c.

Here is the call graph for this function:

static void pre_object_removed ( TOPLEVEL toplevel,
PAGE page,
OBJECT object 
) [static]

Definition at line 84 of file s_page.c.

Here is the call graph for this function:

PAGE* s_page_new ( TOPLEVEL toplevel,
const gchar *  filename 
)
Function Description
Creates a new page and add it to toplevel's list of pages.

It initializes the PAGE structure and set its page_filename to filename. toplevel's current page is not changed by this function.

Definition at line 116 of file s_page.c.

Here is the call graph for this function:

void s_page_delete ( TOPLEVEL toplevel,
PAGE page 
)
Function Description
Deletes a single page page from toplevel's list of pages.

See s_page_delete_list() to delete all pages of a toplevel

If the current page of toplevel is given as parameter page, the function sets the field page_current of the TOPLEVEL struct to NULL.

Definition at line 187 of file s_page.c.

Here is the call graph for this function:

void s_page_delete_list ( TOPLEVEL toplevel)
Function Description
Deletes the list of pages of toplevel. This function should only be called when you are finishing up.
Parameters:
toplevelThe TOPLEVEL object.

Definition at line 284 of file s_page.c.

Here is the call graph for this function:

void s_page_weak_ref ( PAGE page,
void(*)(void *, void *)  notify_func,
void *  user_data 
)
Function Description
Adds the weak reference callback notify_func to page. When page is destroyed, notify_func will be called with two arguments: the page, and the user_data.
See also:
s_page_weak_unref
Parameters:
[in,out]pagePage to weak-reference.
[in]notify_funcWeak reference notify function.
[in]user_dataData to be passed to notify_func.

Definition at line 317 of file s_page.c.

Here is the call graph for this function:

void s_page_weak_unref ( PAGE page,
void(*)(void *, void *)  notify_func,
void *  user_data 
)
Function Description
Removes the weak reference callback notify_func from page.
See also:
s_page_weak_ref()
Parameters:
[in,out]pagePage to weak-reference.
[in]notify_funcNotify function to search for.
[in]user_dataData to to search for.

Definition at line 336 of file s_page.c.

Here is the call graph for this function:

void s_page_add_weak_ptr ( PAGE page,
void *  weak_pointer_loc 
)
Function Description
Adds the weak pointer at weak_pointer_loc to page. The value of weak_pointer_loc will be set to NULL when page is destroyed.
See also:
s_page_remove_weak_ptr
Parameters:
[in,out]pagePage to weak-reference.
[in]weak_pointer_locMemory address of a pointer.

Definition at line 357 of file s_page.c.

Here is the call graph for this function:

void s_page_remove_weak_ptr ( PAGE page,
void *  weak_pointer_loc 
)
Function Description
Removes the weak pointer at weak_pointer_loc from page.
See also:
s_page_add_weak_ptr()
Parameters:
[in,out]pagePage to weak-reference.
[in]weak_pointer_locMemory address of a pointer.

Definition at line 374 of file s_page.c.

Here is the call graph for this function:

void s_page_goto ( TOPLEVEL toplevel,
PAGE p_new 
)
Function Description
Changes the current page in toplevel to the page p_new.
Parameters:
toplevelThe TOPLEVEL object
p_newThe PAGE to go to

Definition at line 389 of file s_page.c.

PAGE* s_page_search ( TOPLEVEL toplevel,
const gchar *  filename 
)
Function Description
Searches in toplevel's list of pages for a page with a filename equal to filename.
Parameters:
toplevelThe TOPLEVEL object
filenameThe filename string to search for
Returns:
PAGE pointer to a matching page, NULL otherwise.

Definition at line 414 of file s_page.c.

PAGE* s_page_search_by_page_id ( GedaPageList list,
int  pid 
)
Function Description
This functions returns the page that have the page id pid in the list of pages starting at page_list, or NULL if there is no such page.
Parameters:
[in]listThe list of page to search the page in.
[in]pidThe ID of the page to find.
Returns:
A pointer on the page found or NULL if not found.

Definition at line 440 of file s_page.c.

void s_page_print_all ( TOPLEVEL toplevel)
Function Description
This function prints the internal structure of toplevel's list of pages.
Parameters:
[in]toplevelThe TOPLEVEL object to print.

Definition at line 463 of file s_page.c.

Here is the call graph for this function:

gint s_page_save_all ( TOPLEVEL toplevel)
Function Description
Saves all the pages in the toplevel parameter.
Parameters:
[in]toplevelThe TOPLEVEL to save pages from.
Returns:
The number of failed tries to save a page.

Definition at line 485 of file s_page.c.

Here is the call graph for this function:

gboolean s_page_check_changed ( GedaPageList list)
Function Description
This function checks the CHANGED flag for all pages in the list object.
Parameters:
[in]listGedaPageList to check CHANGED flag in.
Returns:
1 if any page has the CHANGED flag set, 0 otherwise.

Definition at line 524 of file s_page.c.

void s_page_clear_changed ( GedaPageList list)
Function Description
This function resets the CHANGED flag of each page following head.
Parameters:
[in,out]listPAGE list to set CHANGED flags in.

Definition at line 548 of file s_page.c.

void s_page_autosave_init ( TOPLEVEL toplevel)
Function Description
This function sets up the autosave callback function.
Parameters:
[in]toplevelThe TOPLEVEL object.

Definition at line 568 of file s_page.c.

Here is the call graph for this function:

gint s_page_autosave ( TOPLEVEL toplevel)
Function Description
This function is a callback of the glib g_timeout functions. It is called every "interval" milliseconds and it sets a flag to save a backup copy of the opened pages.
Parameters:
[in]toplevelThe TOPLEVEL object.
Returns:
The length in milliseconds to set for next interval.

Definition at line 589 of file s_page.c.

void s_page_append ( TOPLEVEL toplevel,
PAGE page,
OBJECT object 
)
Function Description
Links the passed OBJECT to the end of the PAGE's linked list of objects.
Parameters:
[in]toplevelThe TOPLEVEL object.
[in]pageThe PAGE the object is being added to.
[in]objectThe OBJECT being added to the page.

Definition at line 633 of file s_page.c.

Here is the call graph for this function:

void s_page_append_list ( TOPLEVEL toplevel,
PAGE page,
GList *  obj_list 
)
Function Description
Links the passed OBJECT GList to the end of the PAGE's object_list.
Parameters:
[in]toplevelThe TOPLEVEL object.
[in]pageThe PAGE the objects are being added to.
[in]obj_listThe OBJECT list being added to the page.

Definition at line 649 of file s_page.c.

Here is the call graph for this function:

void s_page_remove ( TOPLEVEL toplevel,
PAGE page,
OBJECT object 
)
Function Description
Removes the passed OBJECT from the PAGE's linked list of objects.
Parameters:
[in]toplevelThe TOPLEVEL object.
[in]pageThe PAGE the object is being removed from.
[in]objectThe OBJECT being removed from the page.

Definition at line 668 of file s_page.c.

Here is the call graph for this function:

void s_page_replace ( TOPLEVEL toplevel,
PAGE page,
OBJECT object1,
OBJECT object2 
)
Function Description
Removes object1 from page's linked list of objects, and puts object2 in the position thus vacated. If object1 is not in page, object2 is appended to page.
Parameters:
[in]toplevelThe TOPLEVEL object.
[in]pageThe PAGE to be modified.
[in]object1The OBJECT being removed from the page.
[in]object2The OBJECT being added to the page.

Definition at line 687 of file s_page.c.

Here is the call graph for this function:

void s_page_delete_objects ( TOPLEVEL toplevel,
PAGE page 
)
Function Description
Removes and frees all OBJECTs from the PAGE.
Parameters:
[in]toplevelThe TOPLEVEL object.
[in]pageThe PAGE being cleared.

Definition at line 711 of file s_page.c.

Here is the call graph for this function:

const GList* s_page_objects ( PAGE page)
Function Description
An accessor for the PAGE's GList of objects.

NB: This GList is owned by the PAGE, and must not be free'd or modified by the caller.

Parameters:
[in]pageThe PAGE to get objects on.
Returns:
a const pointer to the PAGE's GList of objects

Definition at line 734 of file s_page.c.

GList* s_page_objects_in_region ( TOPLEVEL toplevel,
PAGE page,
int  min_x,
int  min_y,
int  max_x,
int  max_y 
)
Function Description
Finds the objects which are inside, or intersect the passed box shaped region.
Parameters:
[in]toplevelThe TOPLEVEL object.
[in]pageThe PAGE to find objects on.
[in]min_xThe smaller X coordinate of the region.
[in]min_yThe smaller Y coordinate of the region.
[in]max_xThe larger X coordinate of the region.
[in]max_yThe larger Y coordinate of the region.
Returns:
The GList of OBJECTs in the region.

Definition at line 754 of file s_page.c.

Here is the call graph for this function:

GList* s_page_objects_in_regions ( TOPLEVEL toplevel,
PAGE page,
BOX rects,
int  n_rects 
)
Function Description
Finds the objects which are inside, or intersect the passed box shaped region.
Parameters:
[in]toplevelThe TOPLEVEL object.
[in]pageThe PAGE to find objects on.
[in]rectsThe BOX regions to check.
[in]n_rectsThe number of regions.
Returns:
The GList of OBJECTs in the region.

Definition at line 779 of file s_page.c.

Here is the call graph for this function:


Variable Documentation

gint global_pid = 0 [static]

Definition at line 59 of file s_page.c.

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines