pcb 4.1.1
An interactive printed circuit board layout editor.

ghid-main-menu.c File Reference

Implementation of GHidMainMenu widget. More...

#include <glib.h>
#include <glib-object.h>
#include <gtk/gtk.h>
#include "gtkhid.h"
#include "gui.h"
#include "pcb-printf.h"
#include "ghid-main-menu.h"
#include "ghid-layer-selector.h"
#include "ghid-route-style-selector.h"
Include dependency graph for ghid-main-menu.c:

Go to the source code of this file.

Data Structures

struct  _GHidMainMenu
struct  _GHidMainMenuClass

Functions

void Message (const char *,...)
 Output of message in a dialog window or log window.
static gchar * translate_accelerator (const char *text)
 Translate gpcb-menu.res accelerators to gtk ones.
static gboolean g_str_case_equal (gconstpointer v1, gconstpointer v2)
static const char * check_unique_accel (const char *accelerator)
 Check that translated accelerators are unique; warn otherwise.
void ghid_main_menu_real_add_resource (GHidMainMenu *menu, GtkMenuShell *shell, const Resource *res)
 Translate a resource tree into a menu structure.
static void ghid_main_menu_init (GHidMainMenu *mm)
static void ghid_main_menu_class_init (GHidMainMenuClass *klass)
GType ghid_main_menu_get_type (void)
GtkWidget * ghid_main_menu_new (GCallback action_cb, void(*special_key_cb)(const char *accel, GtkAction *action, const Resource *node))
 Create a new GHidMainMenu.
void ghid_main_menu_add_resource (GHidMainMenu *menu, const Resource *res)
 Turn a pcb resource into the main menu.
void ghid_main_menu_add_popup_resource (GHidMainMenu *menu, const char *name, const Resource *res)
 Turn a pcb resource into a popup menu.
GtkMenu * ghid_main_menu_get_popup (GHidMainMenu *menu, const char *name)
 Returns a registered popup menu by name.
void ghid_main_menu_update_toggle_state (GHidMainMenu *menu, void(*cb)(GtkAction *, const char *toggle_flag, const char *active_flag))
 Updates the toggle/active state of all items.
void ghid_main_menu_install_layer_selector (GHidMainMenu *mm, GHidLayerSelector *ls)
 Installs or updates layer selector items.
void ghid_main_menu_install_route_style_selector (GHidMainMenu *mm, GHidRouteStyleSelector *rss)
 Installs or updates route style selector items.
GtkAccelGroup * ghid_main_menu_get_accel_group (GHidMainMenu *menu)
 Returns the menu bar's accelerator group.

Variables

static int action_counter

Detailed Description

Implementation of GHidMainMenu widget.

This widget is the main pcb menu.


Copyright.


PCB, interactive printed circuit board design

Copyright (C) 1994,1995,1996, 2004 Thomas Nau

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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

Contact addresses for paper mail and Email: Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany Thomas.Nau@rz.uni-ulm.de

Definition in file ghid-main-menu.c.


Function Documentation

static const char* check_unique_accel ( const char *  accelerator) [static]

Check that translated accelerators are unique; warn otherwise.

Definition at line 186 of file ghid-main-menu.c.

References _, g_str_case_equal(), and Message().

Referenced by ghid_main_menu_real_add_resource().

Here is the call graph for this function:

static gboolean g_str_case_equal ( gconstpointer  v1,
gconstpointer  v2 
) [static]

Definition at line 177 of file ghid-main-menu.c.

Referenced by check_unique_accel().

void ghid_main_menu_add_popup_resource ( GHidMainMenu menu,
const char *  name,
const Resource res 
)

Turn a pcb resource into a popup menu.

Definition at line 520 of file ghid-main-menu.c.

References ghid_main_menu_real_add_resource(), and _GHidMainMenu::popup_table.

Referenced by ghid_load_menus().

Here is the call graph for this function:

void ghid_main_menu_add_resource ( GHidMainMenu menu,
const Resource res 
)

Turn a pcb resource into the main menu.

Definition at line 511 of file ghid-main-menu.c.

References ghid_main_menu_real_add_resource().

Referenced by ghid_load_menus().

Here is the call graph for this function:

static void ghid_main_menu_class_init ( GHidMainMenuClass klass) [static]

Definition at line 440 of file ghid-main-menu.c.

Referenced by ghid_main_menu_get_type().

GtkAccelGroup* ghid_main_menu_get_accel_group ( GHidMainMenu menu)

Returns the menu bar's accelerator group.

Definition at line 649 of file ghid-main-menu.c.

References _GHidMainMenu::accel_group.

Referenced by ghid_install_accel_groups(), and ghid_remove_accel_groups().

GtkMenu* ghid_main_menu_get_popup ( GHidMainMenu menu,
const char *  name 
)

Returns a registered popup menu by name.

Definition at line 534 of file ghid-main-menu.c.

References _GHidMainMenu::popup_table.

Referenced by Popup().

GType ghid_main_menu_get_type ( void  )

Definition at line 446 of file ghid-main-menu.c.

References ghid_main_menu_class_init(), and ghid_main_menu_init().

Here is the call graph for this function:

static void ghid_main_menu_init ( GHidMainMenu mm) [static]

Definition at line 434 of file ghid-main-menu.c.

Referenced by ghid_main_menu_get_type().

void ghid_main_menu_install_layer_selector ( GHidMainMenu mm,
GHidLayerSelector ls 
)
void ghid_main_menu_install_route_style_selector ( GHidMainMenu mm,
GHidRouteStyleSelector rss 
)

Installs or updates route style selector items.

Definition at line 623 of file ghid-main-menu.c.

References ghid_route_style_selector_install_items(), _GHidMainMenu::n_route_styles, _GHidMainMenu::route_style_pos, and _GHidMainMenu::route_style_shell.

Referenced by ghid_do_export(), make_route_style_buttons(), and route_styles_edited_cb().

Here is the call graph for this function:

void ghid_main_menu_real_add_resource ( GHidMainMenu menu,
GtkMenuShell *  shell,
const Resource res 
)
void ghid_main_menu_update_toggle_state ( GHidMainMenu menu,
void(*)(GtkAction *, const char *toggle_flag, const char *active_flag)  cb 
)

Updates the toggle/active state of all items.

Loops through all actions, passing the action, its toggle flag (maybe NULL), and its active flag (maybe NULL), to a callback function. It is the responsibility of the function to actually change the state of the action.

Parameters:
[in]menuThe menu to be acted on.
[in]cbThe callback that toggles the actions.

Definition at line 552 of file ghid-main-menu.c.

References _GHidMainMenu::action_cb, and _GHidMainMenu::actions.

Referenced by ghid_update_toggle_flags().

void Message ( const char *  ,
  ... 
)

Output of message in a dialog window or log window.

Definition at line 91 of file error.c.

References args, gui, and hid_st::logv.

Referenced by ActionAttributes(), ActionChangeSize(), ActionDRCheck(), ActionElementSetAttr(), ActionImport(), ActionListLayertypes(), ActionLoadVendorFrom(), ActionMessage(), ActionMoveObject(), ActionPasteBuffer(), ActionRenumber(), ActionSetLayertype(), ActionSetViaLayers(), AddAllRats(), AddNet(), append_drc_violation(), apply_vendor_map(), AutoPlaceSelected(), AutoRoute(), ChangeBuriedViasAfterLayerMove(), ChangeElementName(), ChangeFlag(), ChdirErrorMessage(), check_file_version(), check_unique_accel(), CheckShorts(), ClosePolygon(), CollectSubnets(), config_layers_apply(), ConvertBufferToElement(), CreateDefaultFont(), CreateNewPin(), CreateNewVia(), drc_callback(), DRCAll(), EraseObject(), FinishStroke(), gcode_finish_png(), gcode_start_gcode(), gerber_set_layer(), get_menu_filename(), GetObjectBoundingBox(), GetUndoSlot(), ghid_load_menus(), ghid_main_menu_real_add_resource(), GlobalPuller(), gsvit_finish_png(), gsvit_write_xcentroids(), hid_actionv(), hid_parse_actionstring(), hid_register_actions(), hid_save_settings(), HideCrosshair(), hybrid_router(), IPCD356_Netlist(), IPCD356_SanityCheck(), lesstif_menu(), LoadFootprint(), LoadFootprintByName(), LoadNewlibFootprintsFromDir(), LookupLOConnectionsToLOList(), main(), MirrorBuffer(), MoveArcToLayer(), MoveLayer(), MoveLayerAction(), MoveLineToLayer(), MovePolygonToLayer(), MoveTextToLayer(), nelma_finish_png(), Netlist(), NotifyMode(), OpendirErrorMessage(), OpenErrorMessage(), PanAction(), Parse(), ParseConnection(), ParseFont(), ParseLibraryTree(), pcb_spawnvp(), png_do_export(), png_set_color(), png_set_layer(), png_use_mask(), PopenErrorMessage(), Popup(), previous_edge(), PrintBOM(), process_skips(), ProcNetlist(), ps_calibrate_1(), pv_arc_callback(), pv_line_callback(), pv_pad_callback(), pv_pv_callback(), rat_callback(), ReadEdifNetlist(), ReadLibraryContents(), ReadNetlist(), real_load_pcb(), Redo(), rematch(), renumber_block(), renumber_buffer(), ReportDialog(), ReportNetLengthByName(), RestoreCrosshair(), RestoreMode(), RestoreUndoSerialNumber(), roar_router(), RotateScreenObject(), RouteAll(), SaveInTMP(), SearchObjectByID(), SeekPad(), selection_changed_cb(), SetMode(), smartdisperse(), SmashBufferElement(), status(), Subtract(), toporouter_export(), toporouter_free(), toporouter_new(), translate_accelerator(), Undo(), UndoFlag(), UndoMirror(), UpdateXY(), use_gc(), vendorDrillMap(), vendorIsElementMappable(), WritePipe(), and yyerror().

static gchar* translate_accelerator ( const char *  text) [static]

Translate gpcb-menu.res accelerators to gtk ones.

Some keys need to be replaced by a name for the gtk accelerators to work. This table contains the translations. The "in" character is what would appear in gpcb-menu.res and the "out" string is what we have to feed to gtk. I was able to find these by using xev to find the keycode and then looked at gtk+-2.10.9/gdk/keynames.txt (from the gtk source distribution) to figure out the names that go with the codes.

Definition at line 101 of file ghid-main-menu.c.

References _, FALSE, len, Message(), and TRUE.

Referenced by ghid_main_menu_real_add_resource().

Here is the call graph for this function:


Variable Documentation

int action_counter [static]

Definition at line 49 of file ghid-main-menu.c.

Referenced by ghid_main_menu_real_add_resource().