~ubuntu-branches/ubuntu/breezy/tiemu/breezy

« back to all changes in this revision

Viewing changes to src/gui/gtk/itick_cb.c

  • Committer: Bazaar Package Importer
  • Author(s): Julien BLACHE
  • Date: 2005-06-02 16:50:15 UTC
  • mfrom: (1.2.1 upstream) (2.1.1 sarge)
  • Revision ID: james.westby@ubuntu.com-20050602165015-59ab24414tl2wzol
Tags: 1.99+svn1460-1
* New snapshot.
* debian/control:
  + Updated build-depends.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#ifdef HAVE_CONFIG_H
2
 
#  include <config.h>
3
 
#endif
4
 
 
5
 
#include <gtk/gtk.h>
6
 
 
7
 
#include "itick_cb.h"
8
 
#include "itick_dbox.h"
9
 
#include "support.h"
10
 
 
11
 
#include "platform.h"
12
 
#include "struct.h"
13
 
#include "ticalc.h"
14
 
#include "main.h"
15
 
 
16
 
gint tmp_cyclerate, tmp_tickrate, tmp_itick;
17
 
 
18
 
gint display_tickrate_dbox()
19
 
{
20
 
  GtkWidget *dbox;
21
 
  gpointer user_data;
22
 
  gchar buffer[MAXCHARS];
23
 
 
24
 
  dbox = create_tickrate_dbox();
25
 
  
26
 
  user_data = gtk_object_get_data(GTK_OBJECT(dbox), "entry7");
27
 
  tmp_tickrate = (options.params)->tick_rate;
28
 
  g_snprintf(buffer, MAXCHARS, "%lu", (options.params)->tick_rate);
29
 
  gtk_entry_set_text((GtkEntry *)user_data, buffer);
30
 
 
31
 
  gtk_widget_show_all(dbox);
32
 
  return 0;
33
 
}
34
 
 
35
 
 
36
 
void
37
 
on_entry7_changed                      (GtkEditable     *editable,
38
 
                                        gpointer         user_data)
39
 
{
40
 
  gchar *s;
41
 
  
42
 
  s = gtk_editable_get_chars((GtkEditable *)(user_data), 0, -1);
43
 
  if(sscanf(s, "%i", &tmp_tickrate) < 1)
44
 
    tmp_tickrate = 40000;
45
 
  
46
 
  g_free(s);
47
 
}
48
 
 
49
 
void
50
 
on_button33_clicked                    (GtkButton       *button,
51
 
                                        gpointer         user_data)
52
 
{
53
 
  (options.params)->tick_rate = tmp_tickrate;
54
 
  gtk_widget_destroy(user_data);
55
 
}
56
 
 
57
 
 
58
 
void
59
 
on_button34_clicked                    (GtkButton       *button,
60
 
                                        gpointer         user_data)
61
 
{
62
 
  gtk_widget_destroy(user_data);
63
 
}
64
 
 
65
 
 
66
 
void
67
 
on_tickrate_dbox_destroy               (GtkObject       *object,
68
 
                                        gpointer         user_data)
69
 
{
70
 
  unhalt();
71
 
}
72
 
 
73
 
/*--*/
74
 
 
75
 
gint display_cyclerate_dbox()
76
 
{
77
 
  GtkWidget *dbox;
78
 
  gpointer user_data;
79
 
  gchar buffer[MAXCHARS];
80
 
 
81
 
  dbox = create_cyclerate_dbox();
82
 
  
83
 
  user_data = gtk_object_get_data(GTK_OBJECT(dbox), "entry8");
84
 
  tmp_cyclerate = (options.params)->cycle_rate;
85
 
  g_snprintf(buffer, MAXCHARS, "%lu", (options.params)->cycle_rate);
86
 
  gtk_entry_set_text((GtkEntry *)user_data, buffer);
87
 
 
88
 
  gtk_widget_show_all(dbox);
89
 
  return 0;
90
 
}
91
 
 
92
 
 
93
 
void
94
 
on_entry8_changed                      (GtkEditable     *editable,
95
 
                                        gpointer         user_data)
96
 
{
97
 
  gchar *s;
98
 
 
99
 
  s = gtk_editable_get_chars((GtkEditable *)(user_data), 0, -1);
100
 
  if(sscanf(s, "%i", &tmp_cyclerate) < 1)
101
 
    tmp_cyclerate = 40000;
102
 
 
103
 
  g_free(s);
104
 
}
105
 
 
106
 
 
107
 
void
108
 
on_button35_clicked                    (GtkButton       *button,
109
 
                                        gpointer         user_data)
110
 
{
111
 
  (options.params)->cycle_rate = tmp_cyclerate;
112
 
 
113
 
  gtk_widget_destroy(user_data);
114
 
}
115
 
 
116
 
 
117
 
void
118
 
on_button36_clicked                    (GtkButton       *button,
119
 
                                        gpointer         user_data)
120
 
{
121
 
  gtk_widget_destroy(user_data);
122
 
}
123
 
 
124
 
 
125
 
void
126
 
on_cyclerate_dbox_destroy              (GtkObject       *object,
127
 
                                        gpointer         user_data)
128
 
{
129
 
  unhalt();
130
 
}
131
 
 
132
 
/* -- */
133
 
 
134
 
gint display_itick_dbox()
135
 
{
136
 
  GtkWidget *dbox;
137
 
  gpointer user_data;
138
 
  gchar buffer[MAXCHARS];
139
 
 
140
 
  dbox = create_itick_dbox();
141
 
  
142
 
  user_data = gtk_object_get_data(GTK_OBJECT(dbox), "entry9");
143
 
  tmp_itick = (options.params)->i_tick;
144
 
  g_snprintf(buffer, MAXCHARS, "%i", (options.params)->i_tick);
145
 
  gtk_entry_set_text((GtkEntry *)user_data, buffer);
146
 
 
147
 
  gtk_widget_show_all(dbox);
148
 
  return 0;
149
 
}
150
 
 
151
 
 
152
 
void
153
 
on_entry9_changed                      (GtkEditable     *editable,
154
 
                                        gpointer         user_data)
155
 
{
156
 
  gchar *s;
157
 
 
158
 
  s = gtk_editable_get_chars((GtkEditable *)(user_data), 0, -1);
159
 
  if(sscanf(s, "%i", &tmp_itick) < 1)
160
 
    tmp_itick = 640;
161
 
 
162
 
  g_free(s);
163
 
}
164
 
 
165
 
 
166
 
void
167
 
on_button41_clicked                    (GtkButton       *button,
168
 
                                        gpointer         user_data)
169
 
{
170
 
  (options.params)->i_tick = tmp_itick;
171
 
 
172
 
  gtk_widget_destroy(user_data);
173
 
}
174
 
 
175
 
 
176
 
void
177
 
on_button42_clicked                    (GtkButton       *button,
178
 
                                        gpointer         user_data)
179
 
{
180
 
  gtk_widget_destroy(user_data);
181
 
}
182
 
 
183
 
 
184
 
void
185
 
on_itick_dbox_destroy                  (GtkObject       *object,
186
 
                                        gpointer         user_data)
187
 
{
188
 
  unhalt();
189
 
}
190
 
 
191
 
/* */
192
 
 
193
 
 
194