/[pcsx2_0.9.7]/trunk/plugins/onepad/Linux/dialog.cpp
ViewVC logotype

Contents of /trunk/plugins/onepad/Linux/dialog.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 290 - (show annotations) (download)
Sat Dec 25 02:51:30 2010 UTC (9 years ago) by william
File size: 20318 byte(s)
Auto Commited Import of: pcsx2-0.9.7-DEBUG (upstream: v0.9.7.4139 local: v0.9.7.283-latest) in ./trunk
1 /* OnePAD - author: arcum42(@gmail.com)
2 * Copyright (C) 2009
3 *
4 * Based on ZeroPAD, author zerofrog@gmail.com
5 * Copyright (C) 2006-2007
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
20 */
21
22 #include "joystick.h"
23 #include "onepad.h"
24 #include <gtk/gtk.h>
25
26 extern bool PollX11Keyboard(char* &temp, u32 &pkey);
27 extern string KeyName(int pad, int key);
28
29 void config_key(int pad, int key);
30 void on_conf_key(GtkButton *button, gpointer user_data);
31
32 int current_pad = 0;
33 int current_joystick = -1;
34 GtkWidget *rev_lx_check, *rev_ly_check, *force_feedback_check, *rev_rx_check, *rev_ry_check;
35
36 const char* s_pGuiKeyMap[] =
37 {
38 "L2", "R2", "L1", "R1",
39 "Triangle", "Circle", "Cross", "Square",
40 "Select", "L3", "R3", "Start",
41 "Up", "Right", "Down", "Left",
42 "Lx", "Rx", "Ly", "Ry",
43 "L_Up", "L_Right", "L_Down", "L_Left",
44 "R_Up", "R_Right", "R_Down", "R_Left"
45 };
46
47 enum
48 {
49 COL_PAD = 0,
50 COL_BUTTON,
51 COL_KEY,
52 COL_PAD_NUM,
53 COL_VALUE,
54 NUM_COLS
55 };
56
57 class keys_tree
58 {
59 private:
60 GtkTreeStore *treestore;
61 GtkTreeModel *model;
62 GtkTreeView *view;
63 bool has_columns;
64
65 void repopulate()
66 {
67 GtkTreeIter toplevel;
68
69 gtk_tree_store_clear(treestore);
70
71 for (int pad = 0; pad < 2 * MAX_SUB_KEYS; pad++)
72 {
73 for (int key = 0; key < MAX_KEYS; key++)
74 {
75 if (get_key(pad, key) != 0)
76 {
77 string pad_value;
78 switch(pad)
79 {
80 case 0: pad_value = "Pad 1"; break;
81 case 2: pad_value = "Pad 1"; break;
82 case 1: pad_value = "Pad 2"; break;
83 case 3: pad_value = "Pad 2"; break;
84 default: pad_value = "Invalid"; break;
85 }
86 gtk_tree_store_append(treestore, &toplevel, NULL);
87 gtk_tree_store_set(treestore, &toplevel,
88 COL_PAD, pad_value.c_str(),
89 COL_BUTTON, s_pGuiKeyMap[key],
90 COL_KEY, KeyName(pad, key).c_str(),
91 COL_PAD_NUM, pad,
92 COL_VALUE, key,
93 -1);
94 }
95 }
96 }
97 }
98
99 void create_a_column(const char *name, int num, bool visible)
100 {
101 GtkCellRenderer *renderer;
102 GtkTreeViewColumn *col;
103
104 col = gtk_tree_view_column_new();
105 gtk_tree_view_column_set_title(col, name);
106
107 /* pack tree view column into tree view */
108 gtk_tree_view_append_column(view, col);
109
110 renderer = gtk_cell_renderer_text_new();
111
112 /* pack cell renderer into tree view column */
113 gtk_tree_view_column_pack_start(col, renderer, TRUE);
114
115 /* connect 'text' property of the cell renderer to
116 * model column that contains the first name */
117 gtk_tree_view_column_add_attribute(col, renderer, "text", num);
118 gtk_tree_view_column_set_visible(col, visible);
119 }
120
121 void create_columns()
122 {
123 if (!has_columns)
124 {
125 create_a_column("Pad #", COL_PAD, true);
126 create_a_column("Pad Button", COL_BUTTON, true);
127 create_a_column("Key Value", COL_KEY, true);
128 create_a_column("Pad Num", COL_PAD_NUM, false);
129 create_a_column("Internal", COL_VALUE, false);
130 has_columns = true;
131 }
132 }
133 public:
134 GtkWidget *view_widget()
135 {
136 return GTK_WIDGET(view);
137 }
138
139 void init()
140 {
141 has_columns = false;
142 view = GTK_TREE_VIEW(gtk_tree_view_new());
143 treestore = gtk_tree_store_new(NUM_COLS,
144 G_TYPE_STRING,
145 G_TYPE_STRING,
146 G_TYPE_STRING,
147 G_TYPE_UINT,
148 G_TYPE_UINT);
149
150 model = GTK_TREE_MODEL(treestore);
151 gtk_tree_view_set_model(view, model);
152 g_object_unref(model); /* destroy model automatically with view */
153 gtk_tree_selection_set_mode(gtk_tree_view_get_selection(view), GTK_SELECTION_SINGLE);
154 }
155
156 void update()
157 {
158 create_columns();
159 repopulate();
160 }
161
162 void clear_all()
163 {
164 clearPAD();
165 update();
166 }
167
168 bool get_selected(int &pad, int &key)
169 {
170 GtkTreeSelection *selection;
171 GtkTreeIter iter;
172
173 selection = gtk_tree_view_get_selection(view);
174 if (gtk_tree_selection_get_selected(selection, &model, &iter))
175 {
176 gtk_tree_model_get(model, &iter, COL_PAD_NUM, &pad, COL_VALUE, &key,-1);
177 return true;
178 }
179 return false;
180 }
181
182 void remove_selected()
183 {
184 int key, pad;
185 if (get_selected(pad, key))
186 {
187 set_key(pad, key, 0);
188 update();
189 }
190 }
191 void modify_selected()
192 {
193 int key, pad;
194 if (get_selected(pad, key))
195 {
196 config_key(pad,key);
197 update();
198 }
199 }
200 };
201 keys_tree *fir;
202
203 int _GetJoystickIdFromPAD(int pad)
204 {
205 // select the right joystick id
206 u32 joyid = -1;
207
208 // for (int p = 0; p < MAX_SUB_KEYS; p++)
209 // {
210 // for (int i = 0; i < MAX_KEYS; ++i)
211 // {
212 // KeyType k = type_of_key(PadEnum[pad][p],i);
213 //
214 // if (k == PAD_JOYSTICK || k == PAD_JOYBUTTONS)
215 // {
216 // joyid = key_to_joystick_id(PadEnum[pad][p],i);
217 // return joyid;
218 // }
219 // }
220 // }
221
222 if (!JoystickIdWithinBounds(joyid))
223 {
224 // get first unused joystick
225 for (joyid = 0; joyid < s_vjoysticks.size(); ++joyid)
226 {
227 if (s_vjoysticks[joyid]->GetPAD() < 0) break;
228 }
229 }
230
231 return joyid;
232 }
233
234 int Get_Current_Joystick()
235 {
236 // check bounds
237 int joyid = _GetJoystickIdFromPAD(0);
238
239 if (JoystickIdWithinBounds(joyid))
240 return joyid + 1; // select the combo
241 else
242 return 0; //s_vjoysticks.size(); // no gamepad
243 }
244
245 void populate_new_joysticks(GtkComboBox *box)
246 {
247 char str[255];
248 JoystickInfo::EnumerateJoysticks(s_vjoysticks);
249
250 gtk_combo_box_append_text(box, "No Gamepad");
251
252 vector<JoystickInfo*>::iterator it = s_vjoysticks.begin();
253
254 // Delete everything in the vector vjoysticks.
255 while (it != s_vjoysticks.end())
256 {
257 sprintf(str, "%d: %s - but: %d, axes: %d, hats: %d", (*it)->GetId(), (*it)->GetName().c_str(),
258 (*it)->GetNumButtons(), (*it)->GetNumAxes(), (*it)->GetNumHats());
259 gtk_combo_box_append_text(box, str);
260 it++;
261 }
262 current_joystick = Get_Current_Joystick();
263 }
264
265 typedef struct
266 {
267 GtkWidget *widget;
268 int index;
269 void put(const char* lbl, int i, GtkFixed *fix, int x, int y)
270 {
271 widget = gtk_button_new_with_label(lbl);
272 gtk_fixed_put(fix, widget, x, y);
273 gtk_widget_set_size_request(widget, 64, 24);
274 index = i;
275 g_signal_connect(GTK_OBJECT (widget), "clicked", G_CALLBACK(on_conf_key), this);
276 }
277 } dialog_buttons;
278
279 void config_key(int pad, int key)
280 {
281 bool captured = false;
282
283 // save the joystick states
284 UpdateJoysticks();
285
286 while (!captured)
287 {
288 vector<JoystickInfo*>::iterator itjoy;
289 char *tmp;
290
291 u32 pkey = get_key(pad, key);
292 if (PollX11Keyboard(tmp, pkey))
293 {
294 set_key(pad, key, pkey);
295 PAD_LOG("%s\n", KeyName(pad, key).c_str());
296 captured = true;
297 break;
298 }
299
300 SDL_JoystickUpdate();
301
302 itjoy = s_vjoysticks.begin();
303 while ((itjoy != s_vjoysticks.end()) && (!captured))
304 {
305 int button_id, direction;
306
307 pkey = get_key(pad, key);
308 if ((*itjoy)->PollButtons(button_id, pkey))
309 {
310 set_key(pad, key, pkey);
311 PAD_LOG("%s\n", KeyName(pad, key).c_str());
312 captured = true;
313 break;
314 }
315
316 bool sign = false;
317 bool pov = (!((key == PAD_RY) || (key == PAD_LY) || (key == PAD_RX) || (key == PAD_LX)));
318
319 int axis_id;
320
321 if (pov)
322 {
323 if ((*itjoy)->PollPOV(axis_id, sign, pkey))
324 {
325 set_key(pad, key, pkey);
326 PAD_LOG("%s\n", KeyName(pad, key).c_str());
327 captured = true;
328 break;
329 }
330 }
331 else
332 {
333 if ((*itjoy)->PollAxes(axis_id, pkey))
334 {
335 set_key(pad, key, pkey);
336 PAD_LOG("%s\n", KeyName(pad, key).c_str());
337 captured = true;
338 break;
339 }
340 }
341
342 if ((*itjoy)->PollHats(axis_id, direction, pkey))
343 {
344 set_key(pad, key, pkey);
345 PAD_LOG("%s\n", KeyName(pad, key).c_str());
346 captured = true;
347 break;
348 }
349 itjoy++;
350 }
351 }
352 }
353
354 void on_conf_key(GtkButton *button, gpointer user_data)
355 {
356 dialog_buttons *btn = (dialog_buttons *)user_data;
357 int key = btn->index;
358
359 if (key == -1) return;
360
361 config_key(current_pad, key);
362 fir->update();
363 }
364
365 void on_remove_clicked(GtkButton *button, gpointer user_data)
366 {
367 fir->remove_selected();
368 }
369
370 void on_clear_clicked(GtkButton *button, gpointer user_data)
371 {
372 fir->clear_all();
373 }
374
375 void on_modify_clicked(GtkButton *button, gpointer user_data)
376 {
377 fir->modify_selected();
378 }
379
380 void joy_changed(GtkComboBox *box, gpointer user_data)
381 {
382 int joyid = gtk_combo_box_get_active(box);
383
384 // unassign every joystick with this pad
385 for (int i = 0; i < (int)s_vjoysticks.size(); ++i)
386 {
387 if (s_vjoysticks[i]->GetPAD() == s_selectedpad) s_vjoysticks[i]->Assign(-1);
388 }
389
390 if (joyid >= 0 && joyid < (int)s_vjoysticks.size()) s_vjoysticks[joyid]->Assign(current_pad);
391 }
392
393 void pad_changed(GtkComboBox *box, gpointer user_data)
394 {
395 int temp = gtk_combo_box_get_active(box);
396 if (temp >= 0) current_pad = temp;
397 fir->update();
398 int options = (conf.options >> (16 * current_pad));
399
400 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(rev_lx_check), (options & PADOPTION_REVERSELX));
401 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(rev_ly_check), (options & PADOPTION_REVERSELY));
402 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(rev_rx_check), (options & PADOPTION_REVERSERX));
403 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(rev_ry_check), (options & PADOPTION_REVERSERY));
404 }
405
406 void update_option(int option, bool value)
407 {
408 int mask = (option << (16 * current_pad));
409
410 if (value)
411 conf.options |= mask;
412 else
413 conf.options &= ~mask;
414 }
415
416 void on_refresh(GtkComboBox *box, gpointer user_data)
417 {
418 GtkComboBox *joy_choose_cbox = (GtkComboBox*)user_data;
419
420 if (current_joystick < 0) current_joystick = Get_Current_Joystick();
421
422 for(int i=0; i <= (int)s_vjoysticks.size(); i++)
423 {
424 gtk_combo_box_remove_text(joy_choose_cbox, 0);
425 }
426 populate_new_joysticks(joy_choose_cbox);
427 if (gtk_combo_box_get_active(joy_choose_cbox) != current_joystick)
428 gtk_combo_box_set_active(joy_choose_cbox, current_joystick);
429 }
430
431 void on_rev_lx(GtkComboBox *box, gpointer user_data)
432 {
433 update_option(PADOPTION_REVERSELX, gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(rev_lx_check)));
434 }
435
436 void on_rev_ly(GtkComboBox *box, gpointer user_data)
437 {
438 update_option(PADOPTION_REVERSELY, gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(rev_ly_check)));
439 }
440
441 void on_rev_rx(GtkComboBox *box, gpointer user_data)
442 {
443 update_option(PADOPTION_REVERSERX, gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(rev_rx_check)));
444 }
445
446 void on_rev_ry(GtkComboBox *box, gpointer user_data)
447 {
448 update_option(PADOPTION_REVERSERY, gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(rev_ry_check)));
449 }
450
451 //void on_forcefeedback_toggled(GtkToggleButton *togglebutton, gpointer user_data)
452 //{
453 // int mask = PADOPTION_REVERSELX << (16 * s_selectedpad);
454 //
455 // if (gtk_toggle_button_get_active(togglebutton))
456 // {
457 // conf.options |= mask;
458 //
459 // int joyid = gtk_combo_box_get_active(GTK_COMBO_BOX(s_devicecombo));
460 //
461 // if (joyid >= 0 && joyid < (int)s_vjoysticks.size()) s_vjoysticks[joyid]->TestForce();
462 // }
463 // else
464 // {
465 // conf.options &= ~mask;
466 // }
467 //}
468
469 void DisplayDialog()
470 {
471 int return_value;
472
473 GtkWidget *dialog;
474 GtkWidget *main_frame, *main_box;
475
476 GtkWidget *pad_choose_frame, *pad_choose_box;
477 GtkComboBox *pad_choose_cbox;
478
479 GtkWidget *joy_choose_frame, *joy_choose_box;
480 GtkComboBox *joy_choose_cbox;
481 //GtkWidget *joy_refresh;
482
483 GtkWidget *keys_frame, *keys_box;
484
485 GtkWidget *keys_tree_frame, *keys_tree_box;
486 GtkWidget *keys_tree_clear_btn, *keys_tree_remove_btn, *keys_tree_modify_btn;
487 GtkWidget *keys_btn_box, *keys_btn_frame;
488
489 GtkWidget *keys_static_frame, *keys_static_box;
490 GtkWidget *keys_static_area;
491 dialog_buttons btn[29];
492
493 LoadConfig();
494 current_pad = 0;
495 fir = new keys_tree;
496 fir->init();
497
498 /* Create the widgets */
499 dialog = gtk_dialog_new_with_buttons (
500 "OnePAD Config",
501 NULL, /* parent window*/
502 (GtkDialogFlags)(GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT),
503 GTK_STOCK_OK,
504 GTK_RESPONSE_ACCEPT,
505 GTK_STOCK_CANCEL,
506 GTK_RESPONSE_REJECT,
507 NULL);
508
509 pad_choose_cbox = GTK_COMBO_BOX(gtk_combo_box_new_text());
510 gtk_combo_box_append_text(pad_choose_cbox, "Pad 1");
511 gtk_combo_box_append_text(pad_choose_cbox, "Pad 2");
512 gtk_combo_box_append_text(pad_choose_cbox, "Pad 1 (alt)");
513 gtk_combo_box_append_text(pad_choose_cbox, "Pad 2 (alt)");
514 gtk_combo_box_set_active(pad_choose_cbox, current_pad);
515 g_signal_connect(GTK_OBJECT (pad_choose_cbox), "changed", G_CALLBACK(pad_changed), NULL);
516
517 if (current_joystick == -1) current_joystick = Get_Current_Joystick();
518 joy_choose_cbox = GTK_COMBO_BOX(gtk_combo_box_new_text());
519 populate_new_joysticks(joy_choose_cbox);
520 gtk_combo_box_set_active(joy_choose_cbox, current_joystick);
521 g_signal_connect(GTK_OBJECT (joy_choose_cbox), "changed", G_CALLBACK(joy_changed), NULL);
522
523 //joy_refresh = gtk_button_new_with_label("Refresh");
524 //g_signal_connect(GTK_OBJECT (joy_refresh), "clicked", G_CALLBACK(on_refresh), joy_choose_cbox);
525 //gtk_widget_set_size_request(joy_refresh, 64, 24);
526
527 keys_tree_clear_btn = gtk_button_new_with_label("Clear All");
528 g_signal_connect(GTK_OBJECT (keys_tree_clear_btn), "clicked", G_CALLBACK(on_clear_clicked), NULL);
529 gtk_widget_set_size_request(keys_tree_clear_btn, 64, 24);
530
531 keys_tree_remove_btn = gtk_button_new_with_label("Remove");
532 g_signal_connect(GTK_OBJECT (keys_tree_remove_btn), "clicked", G_CALLBACK(on_remove_clicked), NULL);
533 gtk_widget_set_size_request(keys_tree_remove_btn, 64, 24);
534
535 keys_tree_modify_btn = gtk_button_new_with_label("Modify");
536 g_signal_connect(GTK_OBJECT (keys_tree_modify_btn), "clicked", G_CALLBACK(on_modify_clicked), NULL);
537 gtk_widget_set_size_request(keys_tree_modify_btn, 64, 24);
538
539 main_box = gtk_vbox_new(false, 5);
540 main_frame = gtk_frame_new ("Onepad Config");
541 gtk_container_add (GTK_CONTAINER(main_frame), main_box);
542
543 pad_choose_box = gtk_vbox_new(false, 5);
544 pad_choose_frame = gtk_frame_new ("Choose a Pad to modify:");
545 gtk_container_add (GTK_CONTAINER(pad_choose_frame), pad_choose_box);
546
547 joy_choose_box = gtk_hbox_new(false, 5);
548 joy_choose_frame = gtk_frame_new ("Joystick to use for this pad");
549 gtk_container_add (GTK_CONTAINER(joy_choose_frame), joy_choose_box);
550
551 keys_btn_box = gtk_hbox_new(false, 5);
552 keys_btn_frame = gtk_frame_new ("");
553 gtk_container_add (GTK_CONTAINER(keys_btn_frame), keys_btn_box);
554
555 keys_tree_box = gtk_vbox_new(false, 5);
556 keys_tree_frame = gtk_frame_new ("");
557 gtk_container_add (GTK_CONTAINER(keys_tree_frame), keys_tree_box);
558
559 keys_static_box = gtk_hbox_new(false, 5);
560 keys_static_frame = gtk_frame_new ("");
561 gtk_container_add (GTK_CONTAINER(keys_static_frame), keys_static_box);
562
563 keys_static_area = gtk_fixed_new();
564
565 u32 static_offset = 0; //320
566 btn[0].put("L2", 0, GTK_FIXED(keys_static_area), static_offset + 64, 8);
567 btn[1].put("R2", 1, GTK_FIXED(keys_static_area), static_offset + 392, 8);
568 btn[2].put("L1", 2, GTK_FIXED(keys_static_area), static_offset + 64, 32);
569 btn[3].put("R1", 3, GTK_FIXED(keys_static_area), static_offset + 392, 32);
570
571 btn[4].put("Triangle", 4, GTK_FIXED(keys_static_area), static_offset + 392, 80);
572 btn[5].put("Circle", 5, GTK_FIXED(keys_static_area), static_offset + 456, 104);
573 btn[6].put("Cross", 6, GTK_FIXED(keys_static_area), static_offset + 392,128);
574 btn[7].put("Square", 7, GTK_FIXED(keys_static_area), static_offset + 328, 104);
575
576 btn[8].put("Select", 8, GTK_FIXED(keys_static_area), static_offset + 200, 48);
577 btn[9].put("L3", 9, GTK_FIXED(keys_static_area), static_offset + 200, 8);
578 btn[10].put("R3", 10, GTK_FIXED(keys_static_area), static_offset + 272, 8);
579 btn[11].put("Start", 11, GTK_FIXED(keys_static_area), static_offset + 272, 48);
580
581 // Arrow pad
582 btn[12].put("Up", 12, GTK_FIXED(keys_static_area), static_offset + 64, 80);
583 btn[13].put("Right", 13, GTK_FIXED(keys_static_area), static_offset + 128, 104);
584 btn[14].put("Down", 14, GTK_FIXED(keys_static_area), static_offset + 64, 128);
585 btn[15].put("Left", 15, GTK_FIXED(keys_static_area), static_offset + 0, 104);
586
587 //btn[xx].put("Analog", GTK_FIXED(keys_static_area), static_offset + 232, 104);
588
589 btn[16].put("Lx", 16, GTK_FIXED(keys_static_area), static_offset + 64, 264);
590 btn[17].put("Rx", 17, GTK_FIXED(keys_static_area), static_offset + 392, 264);
591 btn[18].put("Ly", 18, GTK_FIXED(keys_static_area), static_offset + 64, 288);
592 btn[19].put("Ry", 19, GTK_FIXED(keys_static_area), static_offset + 392, 288);
593
594 // Left Joystick
595 btn[20].put("Up", 20, GTK_FIXED(keys_static_area), static_offset + 64, 240);
596 btn[21].put("Right", 21, GTK_FIXED(keys_static_area), static_offset + 128, 272);
597 btn[22].put("Down", 22, GTK_FIXED(keys_static_area), static_offset + 64, 312);
598 btn[23].put("Left", 23, GTK_FIXED(keys_static_area), static_offset + 0, 272);
599
600 // Right Joystick
601 btn[24].put("Up", 24, GTK_FIXED(keys_static_area), static_offset + 392, 240);
602 btn[25].put("Right", 25, GTK_FIXED(keys_static_area), static_offset + 456, 272);
603 btn[26].put("Down", 26, GTK_FIXED(keys_static_area), static_offset + 392, 312);
604 btn[27].put("Left", 27, GTK_FIXED(keys_static_area), static_offset + 328, 272);
605
606 int options = (conf.options >> (16 * current_pad));
607 rev_lx_check = gtk_check_button_new_with_label("Reverse Lx");
608 gtk_fixed_put(GTK_FIXED(keys_static_area), rev_lx_check, static_offset + 40, 344);
609 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(rev_lx_check), (options & PADOPTION_REVERSELX));
610 g_signal_connect(GTK_OBJECT (rev_lx_check), "toggled", G_CALLBACK(on_rev_lx), NULL);
611
612 rev_ly_check = gtk_check_button_new_with_label("Reverse Ly");
613 gtk_fixed_put(GTK_FIXED(keys_static_area), rev_ly_check, static_offset + 40, 368);
614 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(rev_ly_check), (options & PADOPTION_REVERSELY));
615 g_signal_connect(GTK_OBJECT (rev_ly_check), "toggled", G_CALLBACK(on_rev_ly), NULL);
616
617 rev_rx_check = gtk_check_button_new_with_label("Reverse Rx");
618 gtk_fixed_put(GTK_FIXED(keys_static_area), rev_rx_check, static_offset + 368, 344);
619 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(rev_rx_check), (options & PADOPTION_REVERSERX));
620 g_signal_connect(GTK_OBJECT (rev_rx_check), "toggled", G_CALLBACK(on_rev_rx), NULL);
621
622 rev_ry_check = gtk_check_button_new_with_label("Reverse Ry");
623 gtk_fixed_put(GTK_FIXED(keys_static_area), rev_ry_check, static_offset + 368, 368);
624 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(rev_ry_check), (options & PADOPTION_REVERSERY));
625 g_signal_connect(GTK_OBJECT (rev_ry_check), "toggled", G_CALLBACK(on_rev_ry), NULL);
626
627 keys_box = gtk_hbox_new(false, 5);
628 keys_frame = gtk_frame_new ("Key Settings");
629 gtk_container_add (GTK_CONTAINER(keys_frame), keys_box);
630
631 gtk_box_pack_start (GTK_BOX (keys_tree_box), fir->view_widget(), true, true, 0);
632 gtk_box_pack_end (GTK_BOX (keys_btn_box), keys_tree_clear_btn, false, false, 0);
633 gtk_box_pack_end (GTK_BOX (keys_btn_box), keys_tree_remove_btn, false, false, 0);
634 gtk_box_pack_end (GTK_BOX (keys_btn_box), keys_tree_modify_btn, false, false, 0);
635
636 gtk_container_add(GTK_CONTAINER(pad_choose_box), GTK_WIDGET(pad_choose_cbox));
637 gtk_container_add(GTK_CONTAINER(joy_choose_box), GTK_WIDGET(joy_choose_cbox));
638 //gtk_container_add(GTK_CONTAINER(joy_choose_box), joy_refresh);
639 gtk_container_add(GTK_CONTAINER(keys_tree_box), keys_btn_frame);
640 gtk_box_pack_start (GTK_BOX (keys_box), keys_tree_frame, true, true, 0);
641 gtk_container_add(GTK_CONTAINER(keys_box), keys_static_area);
642
643 gtk_container_add(GTK_CONTAINER(main_box), pad_choose_frame);
644 gtk_container_add(GTK_CONTAINER(main_box), joy_choose_frame);
645 gtk_container_add(GTK_CONTAINER(main_box), keys_frame);
646
647 gtk_container_add (GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), main_frame);
648
649 fir->update();
650
651 gtk_widget_show_all (dialog);
652
653 return_value = gtk_dialog_run (GTK_DIALOG (dialog));
654 if (return_value == GTK_RESPONSE_ACCEPT) SaveConfig();
655
656 LoadConfig();
657 delete fir;
658 gtk_widget_destroy (dialog);
659 }

  ViewVC Help
Powered by ViewVC 1.1.22