static void cb_dialog_so_styled_response (GtkWidget *dialog, gint response_id, DialogSOStyled *state) { if (response_id == GTK_RESPONSE_HELP) return; if (response_id == GTK_RESPONSE_OK) { GSList *new_props = go_object_properties_collect (state->so); force_new_style (state->so); cmd_generic (GNM_WBC (state->wbcg), _("Format Object"), make_undo (state->so, state->orig_props), make_undo (state->so, new_props)); state->orig_props = NULL; } gtk_widget_destroy (dialog); }
static gint gtk_hex_entry_key_press (GtkWidget *widget, GdkEventKey *event) { GtkHexEntry *hex_entry; int key; g_return_val_if_fail (widget != NULL, FALSE); g_return_val_if_fail (GTK_IS_HEX_ENTRY (widget), FALSE); g_return_val_if_fail (event != NULL, FALSE); hex_entry = GTK_HEX_ENTRY (widget); if (hex_entry->editable == FALSE) return FALSE; if (hex_entry->cursor_position==-1) hex_entry->cursor_position = 0; key = event->keyval; switch (key) { case GDK_Return: case GDK_KP_Enter: make_copy (hex_entry,FALSE); hex_entry->cursor_position = 0; gtk_signal_emit (GTK_OBJECT (hex_entry), hex_entry_signals[SIG_ACTIVATE]); break; case GDK_F1: if (hex_entry->modified) { make_undo (hex_entry,FALSE); gtk_signal_emit (GTK_OBJECT (hex_entry), hex_entry_signals[SIG_VALUE_CHANGED]); } break; case GDK_plus: case GDK_KP_Add: gtk_hex_entry_set_value (hex_entry, gtk_hex_entry_get_value(hex_entry)+1); break; case GDK_KP_Subtract: case GDK_minus: gtk_hex_entry_set_value (hex_entry, gtk_hex_entry_get_value(hex_entry)-1); break; case GDK_KP_Page_Up: case GDK_Page_Up: gtk_hex_entry_set_value (hex_entry, gtk_hex_entry_get_value(hex_entry)+256); break; case GDK_KP_Page_Down: case GDK_Page_Down: gtk_hex_entry_set_value (hex_entry, gtk_hex_entry_get_value(hex_entry)-256); break; case GDK_Delete: case GDK_Clear: case GDK_KP_Delete: move_beginning_of_line(hex_entry); gtk_hex_entry_set_value (hex_entry,0); break; case GDK_BackSpace: move_backward_character(hex_entry); hex_entry->buffer[hex_entry->cursor_position] = '0'; gtk_hex_entry_value_changed (hex_entry); break; case GDK_Home: move_beginning_of_line(hex_entry); break; case GDK_End: move_end_of_line(hex_entry); break; case GDK_Left: move_backward_character(hex_entry); break; case GDK_Right: move_forward_character(hex_entry); break; case GDK_KP_0...GDK_KP_9: key -= GDK_KP_0; key += '0'; default: if ( ((key>='0')&&(key<='9')) || ((key>='a')&&(key<='f')) || ((key>='A')&&(key<='F'))) { hex_entry->buffer[hex_entry->cursor_position] = toupper(key); move_forward_character(hex_entry); gtk_hex_entry_value_changed (hex_entry); break; } else return FALSE; } queue_draw (hex_entry); return TRUE; }