gattrib

x_window.c File Reference

Functions for the toplevel window. More...

#include <stdio.h>
#include <stdlib.h>
#include <gtk/gtk.h>
#include <libgeda/libgeda.h>
#include "../include/struct.h"
#include "../include/prototype.h"
#include "../include/globals.h"
Include dependency graph for x_window.c:

Go to the source code of this file.

Defines

#define GATTRIB_THEME_ICON_NAME   "geda-gattrib"

Functions

static void x_window_create_menu (GtkWindow *window, GtkWidget **menubar)
 Create and attach the menu bar.
static void x_window_set_default_icon (void)
 Set application icon.
void x_window_init ()
 Initialises the toplevel gtksheet.
static void menu_file_save ()
 File->Save menu item.
static void menu_file_export_csv ()
 File->Export CSV menu item.
static void menu_edit_newattrib ()
 Edit->New attrib menu item.
static void menu_edit_delattrib ()
 Edit->Delete Attribute menu item.
void x_window_add_items ()
 Add all items to the top level window.

Variables

static const GtkActionEntry actions []

Detailed Description

This file holds functions used to handle the toplevel window and various widgets held by that window. Widges used to handle (GtkSheet *sheet) itself are held in a different file.

Definition in file x_window.c.


Define Documentation

#define GATTRIB_THEME_ICON_NAME   "geda-gattrib"

Definition at line 60 of file x_window.c.


Function Documentation

static void x_window_create_menu ( GtkWindow *  window,
GtkWidget **  menubar 
) [static]

Create the menu bar and attach it to the main window.

First, the GtkActionGroup object is created and filled with entries of type GtkActionEntry (each entry specifies a single action, such as opening a file). Then the GtkUIManager object is created and used to load menus.xml file with the menu description. Finally, the GtkAccelGroup is added to the main window to enable keyboard accelerators and a pointer to the menu bar is retrieved from the GtkUIManager object.

Parameters:
windowWindow to add the menubar to
[out]menubarCreated menubar

Definition at line 267 of file x_window.c.

static void x_window_set_default_icon ( void  ) [static]

Setup default icon for GTK windows

Sets the default window icon by name, to be found in the current icon theme. The name used is #defined above as GATTRIB_THEME_ICON_NAME.

Definition at line 439 of file x_window.c.

void x_window_init ( )

This function initializes the toplevel gtksheet stuff.

It basically just initializes the following widgets: GTK_WINDOW *window GTK_CONTAINER *main_vbox GTK_MENU

Note that it doesn't display the spreadsheet itself. This is done in x_sheet_build_sheet. I suppose I could postpone all initialization until x_sheet_build_sheet, but I figured that I could at least do some initialization here. In particular, the stuff to put up the menus is long & it is worthwhile to separate it from other code. Maybe I'll refactor this later.

Definition at line 85 of file x_window.c.

Here is the call graph for this function:

static void menu_file_save ( ) [static]

Implement the File->Save menu

Definition at line 158 of file x_window.c.

Here is the call graph for this function:

static void menu_file_export_csv ( ) [static]

Implement the File->Export CSV menu item

Definition at line 172 of file x_window.c.

Here is the call graph for this function:

static void menu_edit_newattrib ( ) [static]

Implement the New attrib menu item

Definition at line 194 of file x_window.c.

Here is the call graph for this function:

static void menu_edit_delattrib ( ) [static]

Implements the Delete Attribute menu item

Definition at line 213 of file x_window.c.

Here is the call graph for this function:

void x_window_add_items ( )

This function updates the top level window after a new page is read in.

It does the following:

  1. Create a new gtksheet having the current dimensions.
  2. Call x_gktsheet_add_row_labels(comp_count, master_*_list_head)
  3. Call x_gktsheet_add_col_labels(comp_attrib_count, master_*_attrib_list_head)
  4. Call x_gktsheet_add_row_labels(net_count, master_*_list_head)
  5. Call x_gktsheet_add_col_labels(net_attrib_count, master_*_attrib_list_head)
  6. loop on i, j -- call x_gtksheet_add_entry(i, j, attrib_value)
  7. Call gtk_widget_show(window) to show new window.

Definition at line 316 of file x_window.c.

Here is the call graph for this function:


Variable Documentation

const GtkActionEntry actions[] [static]
Initial value:
 {
  
  
  { "file", NULL, "_File"},
  
  { "file-save", GTK_STOCK_SAVE, "Save", "<Control>S", "", menu_file_save},
  { "file-export-csv", NULL, "Export CSV", "", "", menu_file_export_csv},
  
  { "file-quit", GTK_STOCK_QUIT, "Quit", "<Control>Q", "", G_CALLBACK(gattrib_really_quit)},

  
  { "edit", NULL, "_Edit"},
  { "edit-add-attrib", NULL, "Add new attrib column", "", "", menu_edit_newattrib},
  { "edit-delete-attrib", NULL, "Delete attrib column", "", "", menu_edit_delattrib},
  
  
  

  
  { "visibility", NULL, "_Visibility"},
  { "visibility-invisible", NULL, "Set selected invisible", "", "", s_visibility_set_invisible},
  { "visibility-name-only", NULL, "Set selected name visible only", "", "", s_visibility_set_name_only},
  { "visibility-value-only", NULL, "Set selected value visible only", "", "", s_visibility_set_value_only},
  { "visibility-name-value", NULL, "Set selected name and value visible", "", "", s_visibility_set_name_and_value},

  
  { "help", NULL, "_Help"},
  { "help-about", GTK_STOCK_ABOUT, "About", "", "", x_dialog_about_dialog},
}

The Gtk action table

Definition at line 221 of file x_window.c.

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines