/* $Id: gui-keyref-window.c,v 1.9 2006/03/20 20:38:13 wilson Exp $ */ /* * COPYRIGHT * * PCB, interactive printed circuit board design * Copyright (C) 1994,1995,1996 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., 675 Mass Ave, Cambridge, MA 02139, USA. * * Contact addresses for paper mail and Email: * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany * Thomas.Nau@rz.uni-ulm.de * */ /* This file written by Bill Wilson for the PCB Gtk port */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "gui.h" #ifdef HAVE_LIBDMALLOC #include #endif RCSID("$Id: gui-keyref-window.c,v 1.9 2006/03/20 20:38:13 wilson Exp $"); static GtkWidget *keyref_window; static gchar *key_ref_text[] = { "", N_("Keyboard\n"), N_("Keyboard shortcuts and actions available in PCB.\n"), N_("In below key actions, is , is \n"), N_("and is or \n"), "\n", "\ta\t", N_("Set layer and size from line or arc\n"), "\n", "a ", N_("Unselect all objects\n"), "\n", "\tb\t", N_("Flip element to opposite side of the board\n"), "\tb\t", N_("Flip selected objects to opposite side of the board\n"), "\n", "\tc\t", N_("Copy selected to buffer and unselect\n"), "\n", "\td\t", N_("Display pin/pad names (numbers with View->Enable pinout shows number)\n"), "\td\t", N_("Open pinout window for element under cursor\n"), "\n", "\te\t", N_("Delete all rats\n"), "\te\t", N_("Delete selected rats\n"), "\n", "\tf\t", N_("Highlight connections to object\n"), "\tf\t", N_("Reset highlighted connections\n"), "\tf\t", N_("Cumulative highlight connections to object\n"), "\n", "\tg\t", N_("Increment grid by configured grid increment\n"), "\tg\t", N_("Decrement grid by configured grid increment\n"), "\n", "\th\t", N_("Toggle visibility of element name under cursor\n"), "\th\t", N_("Toggle visibility of selected element names\n"), "\th\t", N_("Toggle the hole flag of object under cursor\n"), "\n", "\tj\t", N_("Toggle line/arc should clear polygons flag of object under cursor\n"), "\tj\t", N_("Toggle line/arc should clear polygons flag of selected\n"), "\n", "\tk\t", N_("Increase clearance of object by configured clearance\n"), "\tk\t", N_("Decrease clearance of object by configured clearance\n"), "\tk\t", N_("Increase clearance of selected objects by configured clearance\n"), "k ", N_("Decrease clearance of selected objects by configured clearance\n"), "\n", "\tl\t", N_("Increment current route style line size by configured line increment\n"), "\tl\t", N_("Decrement current route style line size by configured line increment\n"), "\n", "\tm\t", N_("Move object to current layer\n"), "\tm\t", N_("Move selected objects to current layer\n"), "\tm\t", N_("Mark at cursor location for showing relative offsets\n"), "\n", "\tn\t", N_("Select the shortest unselected rat on the board\n"), "\n", "\to\t", N_("Optimize and draw all rats\n"), "\to\t", N_("Optimize and draw selected rats\n"), "\n", "\to\t", N_("Change octagon flag of object\n"), "\n", "\tp\t", N_("Backup polygon drawing to previous point\n"), "\tp\t", N_("Close polygon\n"), "\n", "\tq\t", N_("Toggle the square flag of an object\n"), "\n", "\tr\t", N_("Redo last undone operation\n"), "\n", "\ts\t", N_("Increment size of an object by configured size increment\n"), "\ts\t", N_("Decrement size of an object by configured size increment\n"), "\ts\t", N_("Increment drill size of a pin or via\n"), "s ", N_("Decrement drill size of a pin or via\n"), "\n", "\tt\t", N_("Adjust text scale so new text increases by the configured size increment\n"), "\tt\t", N_("Adjust text scale so new text decreases by the configured size increment\n"), "\n", "\tu\t", N_("Undo last operation\n"), "\n", "\tv\t", N_("Zoom to board extents\n"), "\tv\t", N_("Increment current route style via size\n"), "v ", N_("Decrement current route style via size\n"), "\tv\t", N_("Increment current route style via hole size\n"), "v ", N_("Decrement current route style via hole size\n"), "\n", "\tx\t", N_("Copy selection to buffer and enter pastebuffer mode\n"), "x ", N_("Cut selection to buffer and enter pastebuffer mode\n"), "\n", "\tz\t", N_("Zoom in\n"), "\tz\t", N_("Zoom out\n"), "\n", "\t|\t", N_("Toggle thin draw mode\n"), "\n", "\t/\t", N_("Cycle multiline mode (Using overrides)\n"), "\n", "\t.\t", N_("Toggle all direction lines mode\n"), "\n", "\tEsc\t", N_("If drawing an object, return to a neutral state.\n"), "\n", "\tTab\t", N_("Switch view to other side\n"), "\n", " Space\t", N_("Switch to select mode\n"), "\n", "\t:\t", N_("Enter user command or pop up command window\n"), "\n", "\tDEL\t", N_("Delete object\n"), "\n", "\t1-9\t", N_("Select drawing layers\n"), "\n", "\t1-5\t", N_("Select current buffer\n"), "\n", "\n", "", N_("Mouse\n"), N_("Modifier key use can be combined with mouse button presses\n" "to modify mouse button actions.\n"), "\n", N_("Left button\n"), N_("\tPerform or initiate action determined by current mode.\n"), "\n", "\t", N_(""), N_(" - change rotation direction for rotation tool actions.\n"), "\n", N_("\tAfter a draw operation has been left mouse button initiated,\n" "\tmodifier key effects:\n"), "\t", N_(""), N_(" - change line 45 degree direction and arc angle direction,\n"), "\n", N_("Middle button\n"), N_("\tIf a line, arc, rectangle, or polygon draw operation has been\n" "\tinitiated, a click restarts the draw operation at the cursor position.\n"), "\n", N_("\tIf such a draw has not been initiated, a click selects objects and\n" "\ta press and drag moves objects.\n"), "\n", N_("Right button\n"), N_("\tPress and drag to pan.\n" "\tWhile drawing or moving, a click without a drag toggles auto pan mode.\n"), "\n\t", N_(""), N_(" - Popup a menu.\n"), "\n", N_("Scroll wheel\n"), N_("\tZoom in/out.\n"), "\n\t", N_(""), N_(" - pan vertically.\n"), "\t", N_(""), N_(" - pan horizontally..\n"), "\n", N_("Usage:\n"), N_("\tMouse actions can typically be combined. For example: while moving\n" "\tan object (with left or middle press and drag), the right button may\n" "\tbe simultaneously clicked to toggle auto pan or pressed and dragged\n" "\tto manually pan. Mouse moving or drawing may also be combined with\n" "\tkey actions.\n"), }; /* Remember user window resizes. */ static gint keyref_window_configure_event_cb(GtkWidget *widget, GdkEventConfigure *ev, gpointer data) { ghidgui->keyref_window_width = widget->allocation.width; ghidgui->keyref_window_height = widget->allocation.height; ghidgui->config_modified = TRUE; return FALSE; } static void keyref_close_cb(gpointer data) { gtk_widget_destroy(keyref_window); keyref_window = NULL; } static void keyref_destroy_cb(GtkWidget *widget, gpointer data) { keyref_window = NULL; } void ghid_keyref_window_show(void) { GtkWidget *vbox, *hbox, *button, *text; gint i; if (keyref_window) { /* gtk_window_present() grabs focus which we don't want */ gdk_window_raise(keyref_window->window); return; } keyref_window = gtk_window_new(GTK_WINDOW_TOPLEVEL); g_signal_connect(G_OBJECT(keyref_window), "destroy", G_CALLBACK(keyref_destroy_cb), NULL); g_signal_connect(G_OBJECT(keyref_window), "configure_event", G_CALLBACK(keyref_window_configure_event_cb), NULL); gtk_window_set_title(GTK_WINDOW(keyref_window), _("PCB Key Reference")); gtk_window_set_wmclass(GTK_WINDOW(keyref_window), "PCB_Keyref", "PCB"); gtk_window_set_default_size(GTK_WINDOW(keyref_window), ghidgui->keyref_window_width, ghidgui->keyref_window_height); vbox = gtk_vbox_new(FALSE, 0); gtk_container_set_border_width(GTK_CONTAINER(vbox), 6); gtk_container_add(GTK_CONTAINER(keyref_window), vbox); text = ghid_scrolled_text_view(vbox, NULL, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); for (i = 0; i < sizeof(key_ref_text)/sizeof(gchar *); ++i) ghid_text_view_append(text, _(key_ref_text[i])); /* The keyref window close button. */ hbox = gtk_hbutton_box_new(); gtk_button_box_set_layout(GTK_BUTTON_BOX(hbox), GTK_BUTTONBOX_END); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 3); button = gtk_button_new_from_stock(GTK_STOCK_CLOSE); g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(keyref_close_cb), NULL); gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 0); gtk_widget_show_all(keyref_window); }