void
ghid_handle_user_command (gboolean raise)
{
  char *command;
  static char *previous = NULL;

  if (ghidgui->use_command_window)
    ghid_command_window_show (raise);
  else
    {
      command = ghid_command_entry_get (_("Enter command:"),
					(Settings.SaveLastCommand && previous) ? previous : (gchar *)"");
      if (command != NULL)
	{
	  /* copy new comand line to save buffer */
	  g_free (previous);
	  previous = g_strdup (command);
	  hid_parse_command (command);
	  g_free (command);
	}
      else if (previous)
	{
	  command = g_strdup (previous);
	  hid_parse_command (command);
	  g_free (command);
	}
    }
  ghid_window_set_name_label (PCB->Name);
  ghid_set_status_line_label ();
}
gboolean
ghid_port_button_release_cb (GtkWidget * drawing_area,
			     GdkEventButton * ev, gpointer data)
{
  ModifierKeysState mk;
  GdkModifierType state;

  ghid_note_event_location (ev);
  state = (GdkModifierType) (ev->state);
  mk = ghid_modifier_keys_state (&state);

  do_mouse_action(ev->button, mk + M_Release);

  AdjustAttachedObjects ();
  ghid_invalidate_all ();

  ghid_window_set_name_label (PCB->Name);
  ghid_set_status_line_label ();
  g_idle_add (ghid_idle_cb, NULL);
  return TRUE;
}
gboolean
ghid_port_button_press_cb (GtkWidget * drawing_area,
			   GdkEventButton * ev, gpointer data)
{
  ModifierKeysState mk;
  GdkModifierType state;

  /* Reject double and triple click events */
  if (ev->type != GDK_BUTTON_PRESS) return TRUE;

  ghid_note_event_location (ev);
  state = (GdkModifierType) (ev->state);
  mk = ghid_modifier_keys_state (&state);

  do_mouse_action(ev->button, mk);

  ghid_invalidate_all ();
  ghid_window_set_name_label (PCB->Name);
  ghid_set_status_line_label ();
  if (!gport->panning)
    g_idle_add (ghid_idle_cb, NULL);
  return TRUE;
}