~ubuntu-branches/ubuntu/karmic/mhwaveedit/karmic

« back to all changes in this revision

Viewing changes to src/rawdialog.c

  • Committer: Bazaar Package Importer
  • Author(s): Free Ekanayaka
  • Date: 2008-01-08 22:20:37 UTC
  • mfrom: (2.1.6 hardy)
  • Revision ID: james.westby@ubuntu.com-20080108222037-tsazhckl5vmc8yih
Tags: 1.4.14-2
Added desktop file (Closes: #457849), thanks to Marco Rodrigues

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * Copyright (C) 2002 2003 2005, Magnus Hjorth
 
2
 * Copyright (C) 2002 2003 2005 2007, Magnus Hjorth
3
3
 *
4
4
 * This file is part of mhWaveEdit.
5
5
 *
32
32
static gboolean ok_flag, destroy_flag;
33
33
static Dataformat fmt;
34
34
static FormatSelector *fs;
 
35
static Intbox *offset_box;
 
36
static gint maxhdrsize;
35
37
 
36
38
static void rawdialog_ok(GtkButton *button, gpointer user_data)
37
39
{
38
 
     if (format_selector_check(fs)) {
 
40
     if (format_selector_check(fs) || 
 
41
         intbox_check_limit(offset_box,0,maxhdrsize,_("header size"))) {
39
42
          gtk_signal_emit_stop_by_name(GTK_OBJECT(button),"clicked");
40
43
          return;
41
44
     }
48
51
     destroy_flag = TRUE;
49
52
}
50
53
 
51
 
Dataformat *rawdialog_execute(gchar *filename)
 
54
Dataformat *rawdialog_execute(gchar *filename, gint filesize, guint *offset)
52
55
{
53
56
     GtkWindow *w;
54
57
     GtkWidget *a,*b,*c;
61
64
     fmt.samplebytes= fmt.samplesize * fmt.channels;
62
65
     fmt.sign = FALSE;
63
66
     fmt.bigendian = IS_BIGENDIAN;
64
 
     dataformat_get_from_inifile("rawDialog",TRUE,&fmt);     
 
67
     dataformat_get_from_inifile("rawDialog",TRUE,&fmt);    
 
68
     maxhdrsize = filesize;
65
69
     
66
70
     w = GTK_WINDOW(gtk_window_new(GTK_WINDOW_DIALOG));
67
71
     gtk_window_set_title(w,_("Unknown file format"));
81
85
     fs = FORMAT_SELECTOR(b);
82
86
     format_selector_set(fs,&fmt);
83
87
     gtk_container_add(GTK_CONTAINER(a),b);
 
88
     b = gtk_hbox_new(FALSE,0);
 
89
     gtk_container_add(GTK_CONTAINER(a),b);
 
90
     c = gtk_label_new(_("Header bytes: "));
 
91
     gtk_box_pack_start(GTK_BOX(b),c,FALSE,FALSE,0);
 
92
     c = intbox_new(inifile_get_guint32("rawDialog_offset",0));
 
93
     offset_box = INTBOX(c);
 
94
     gtk_box_pack_start(GTK_BOX(b),c,FALSE,FALSE,0);
84
95
     b = gtk_hseparator_new();
85
96
     gtk_container_add(GTK_CONTAINER(a),b);
86
97
     b = gtk_hbutton_box_new();
103
114
     
104
115
     if (!ok_flag) return NULL;
105
116
 
 
117
     *offset = (guint) offset_box->val;
106
118
     dataformat_save_to_inifile("rawDialog",&fmt,TRUE);
 
119
     inifile_set_guint32("rawDialog_offset",*offset);
107
120
     return &fmt;
108
121
}