diff options
| author | SND\weimingzhi_cp <SND\weimingzhi_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2009-09-16 12:26:05 +0000 |
|---|---|---|
| committer | SND\weimingzhi_cp <SND\weimingzhi_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2009-09-16 12:26:05 +0000 |
| commit | b690498435e18f0fded6570e67b24fe4676ff4a5 (patch) | |
| tree | 339db4344d209ee766b2b2cb464d5b6a68f02470 | |
| parent | 6c8416a40307ed74956ad8a24e4f76fe4619933c (diff) | |
| download | pcsxr-b690498435e18f0fded6570e67b24fe4676ff4a5.tar.gz | |
git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@29832 e17a0e51-4ae3-4d35-97c3-1a29b211df97
| -rw-r--r-- | ChangeLog | 2 | ||||
| -rw-r--r-- | data/pcsx.glade2 | 98 | ||||
| -rw-r--r-- | gui/Cheat.c | 82 |
3 files changed, 34 insertions, 148 deletions
@@ -4,6 +4,8 @@ September 16, 2009 Wei Mingzhi <weimingzhi@gmail.com> to Tibério Vítor <tvtoon at gmail dot com>. * po/LINGUAS: Added pt_BR.po. * po/pcsx.pot: Updated. + * gui/Cheat.c: Use checkboxes for toggling cheats. + * data/pcsx.glade2: Likewise. September 15, 2009 Wei Mingzhi <weimingzhi@gmail.com> diff --git a/data/pcsx.glade2 b/data/pcsx.glade2 index 7740fdd2..0dcae465 100644 --- a/data/pcsx.glade2 +++ b/data/pcsx.glade2 @@ -2259,9 +2259,11 @@ Romain Lafourcade</property> <child internal-child="vbox"> <widget class="GtkVBox" id="dialog-vbox7"> <property name="visible">True</property> + <property name="orientation">vertical</property> <child> <widget class="GtkVBox" id="vbox1"> <property name="visible">True</property> + <property name="orientation">vertical</property> <property name="spacing">15</property> <child> <widget class="GtkFrame" id="frame3"> @@ -2278,8 +2280,8 @@ Romain Lafourcade</property> <property name="shadow_type">etched-in</property> <child> <widget class="GtkTreeView" id="GtkCList_Cheat"> - <property name="width_request">300</property> - <property name="height_request">250</property> + <property name="width_request">500</property> + <property name="height_request">255</property> <property name="visible">True</property> <property name="can_focus">True</property> </widget> @@ -2306,18 +2308,6 @@ Romain Lafourcade</property> <property name="visible">True</property> <property name="spacing">10</property> <child> - <widget class="GtkButton" id="addbutton1"> - <property name="label" translatable="yes">gtk-add</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="use_stock">True</property> - </widget> - <packing> - <property name="position">0</property> - </packing> - </child> - <child> <widget class="GtkButton" id="editbutton1"> <property name="label" translatable="yes">gtk-edit</property> <property name="visible">True</property> @@ -2326,7 +2316,9 @@ Romain Lafourcade</property> <property name="use_stock">True</property> </widget> <packing> - <property name="position">1</property> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">2</property> </packing> </child> <child> @@ -2338,74 +2330,22 @@ Romain Lafourcade</property> <property name="use_stock">True</property> </widget> <packing> - <property name="position">2</property> - </packing> - </child> - <child> - <widget class="GtkButton" id="enablebutton1"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <child> - <widget class="GtkHBox" id="hbox2"> - <property name="visible">True</property> - <child> - <widget class="GtkImage" id="image3"> - <property name="visible">True</property> - <property name="stock">gtk-apply</property> - <property name="icon-size">1</property> - </widget> - <packing> - <property name="position">0</property> - </packing> - </child> - <child> - <widget class="GtkLabel" id="label2"> - <property name="visible">True</property> - <property name="label" translatable="yes">Enable</property> - </widget> - <packing> - <property name="position">1</property> - </packing> - </child> - </widget> - </child> - </widget> - <packing> + <property name="expand">False</property> + <property name="fill">False</property> <property name="position">3</property> </packing> </child> <child> - <widget class="GtkButton" id="disablebutton1"> + <widget class="GtkButton" id="addbutton1"> + <property name="label" translatable="yes">gtk-add</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> - <child> - <widget class="GtkHBox" id="hbox3"> - <property name="visible">True</property> - <child> - <widget class="GtkImage" id="image4"> - <property name="visible">True</property> - <property name="stock">gtk-cancel</property> - <property name="icon-size">1</property> - </widget> - <packing> - <property name="position">0</property> - </packing> - </child> - <child> - <widget class="GtkLabel" id="label3"> - <property name="visible">True</property> - <property name="label" translatable="yes">Disable</property> - </widget> - <packing> - <property name="position">1</property> - </packing> - </child> - </widget> - </child> + <property name="use_stock">True</property> </widget> <packing> + <property name="expand">False</property> + <property name="fill">False</property> <property name="position">4</property> </packing> </child> @@ -2418,7 +2358,10 @@ Romain Lafourcade</property> <property name="use_stock">True</property> </widget> <packing> - <property name="position">5</property> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="pack_type">end</property> + <property name="position">1</property> </packing> </child> <child> @@ -2430,7 +2373,10 @@ Romain Lafourcade</property> <property name="use_stock">True</property> </widget> <packing> - <property name="position">6</property> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="pack_type">end</property> + <property name="position">0</property> </packing> </child> </widget> diff --git a/gui/Cheat.c b/gui/Cheat.c index ec398a44..0bd9bcae 100644 --- a/gui/Cheat.c +++ b/gui/Cheat.c @@ -35,7 +35,7 @@ GtkWidget *CheatListDlg = NULL; GtkWidget *CheatSearchDlg = NULL; static void LoadCheatListItems(int index) { - GtkListStore *store = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_STRING); + GtkListStore *store = gtk_list_store_new(2, G_TYPE_BOOLEAN, G_TYPE_STRING); GtkTreeIter iter; GtkWidget *widget; GladeXML *xml; @@ -47,8 +47,7 @@ static void LoadCheatListItems(int index) { for (i = 0; i < NumCheats; i++) { gtk_list_store_append(store, &iter); - gtk_list_store_set(store, &iter, 0, Cheats[i].Enabled ? _(" Yes") : "", - 1, Cheats[i].Descr, -1); + gtk_list_store_set(store, &iter, 0, Cheats[i].Enabled, 1, Cheats[i].Descr, -1); } gtk_tree_view_set_model(GTK_TREE_VIEW(widget), GTK_TREE_MODEL(store)); @@ -93,20 +92,11 @@ static void CheatList_TreeSelectionChanged(GtkTreeSelection *selection, gpointer gtk_widget_set_sensitive(GTK_WIDGET(glade_xml_get_widget(xml, "editbutton1")), TRUE); gtk_widget_set_sensitive(GTK_WIDGET(glade_xml_get_widget(xml, "delbutton1")), TRUE); - if (Cheats[i].Enabled) { - gtk_widget_set_sensitive(GTK_WIDGET(glade_xml_get_widget(xml, "enablebutton1")), FALSE); - gtk_widget_set_sensitive(GTK_WIDGET(glade_xml_get_widget(xml, "disablebutton1")), TRUE); - } else { - gtk_widget_set_sensitive(GTK_WIDGET(glade_xml_get_widget(xml, "enablebutton1")), TRUE); - gtk_widget_set_sensitive(GTK_WIDGET(glade_xml_get_widget(xml, "disablebutton1")), FALSE); - } } else { xml = glade_get_widget_tree(CheatListDlg); gtk_widget_set_sensitive(GTK_WIDGET(glade_xml_get_widget(xml, "editbutton1")), FALSE); gtk_widget_set_sensitive(GTK_WIDGET(glade_xml_get_widget(xml, "delbutton1")), FALSE); - gtk_widget_set_sensitive(GTK_WIDGET(glade_xml_get_widget(xml, "enablebutton1")), FALSE); - gtk_widget_set_sensitive(GTK_WIDGET(glade_xml_get_widget(xml, "disablebutton1")), FALSE); } gtk_widget_set_sensitive (GTK_WIDGET(glade_xml_get_widget(xml, "savebutton1")), NumCheats); @@ -295,55 +285,11 @@ static void OnCheatListDlg_DelClicked(GtkWidget *widget, gpointer user_data) { // rather than regenerating the whole list } -static void OnCheatListDlg_EnableClicked(GtkWidget *widget, gpointer user_data) { - GladeXML *xml; - GtkTreeIter iter; - GtkTreeModel *model; - GtkTreePath *path; - - gboolean selected; - int i = -1; - - xml = glade_get_widget_tree(CheatListDlg); - widget = glade_xml_get_widget(xml, "GtkCList_Cheat"); - - selected = gtk_tree_selection_get_selected( - gtk_tree_view_get_selection(GTK_TREE_VIEW(widget)), - &model, &iter); - - if (selected) { - path = gtk_tree_model_get_path(model, &iter); - i = *gtk_tree_path_get_indices(path); +static void OnCheatListDlg_EnableToggled(GtkWidget *widget, gchar *path, gpointer user_data) { + int i = atoi(path); - Cheats[i].Enabled = 1; - } - - LoadCheatListItems(i); // FIXME: should modify it in the list directly - // rather than regenerating the whole list -} - -static void OnCheatListDlg_DisableClicked(GtkWidget *widget, gpointer user_data) { - GladeXML *xml; - GtkTreeIter iter; - GtkTreeModel *model; - GtkTreePath *path; - - gboolean selected; - int i = -1; - - xml = glade_get_widget_tree(CheatListDlg); - widget = glade_xml_get_widget(xml, "GtkCList_Cheat"); - - selected = gtk_tree_selection_get_selected( - gtk_tree_view_get_selection(GTK_TREE_VIEW(widget)), - &model, &iter); - - if (selected) { - path = gtk_tree_model_get_path(model, &iter); - i = *gtk_tree_path_get_indices(path); - - Cheats[i].Enabled = 0; - } + assert(i >= 0 && i < NumCheats); + Cheats[i].Enabled ^= 1; LoadCheatListItems(i); // FIXME: should modify it in the list directly // rather than regenerating the whole list @@ -453,11 +399,13 @@ void RunCheatListDialog() { widget = glade_xml_get_widget(xml, "GtkCList_Cheat"); // column for enable - renderer = gtk_cell_renderer_text_new (); + renderer = gtk_cell_renderer_toggle_new (); column = gtk_tree_view_column_new_with_attributes (_("Enable"), - renderer, "text", 0, NULL); + renderer, "active", 0, NULL); gtk_tree_view_append_column (GTK_TREE_VIEW(widget), column); + g_signal_connect (G_OBJECT(renderer), "toggled", G_CALLBACK(OnCheatListDlg_EnableToggled), 0); + // column for description renderer = gtk_cell_renderer_text_new (); column = gtk_tree_view_column_new_with_attributes (_("Description"), @@ -484,14 +432,6 @@ void RunCheatListDialog() { g_signal_connect_data(GTK_OBJECT(widget), "clicked", GTK_SIGNAL_FUNC(OnCheatListDlg_DelClicked), xml, NULL, G_CONNECT_AFTER); - widget = glade_xml_get_widget(xml, "enablebutton1"); - g_signal_connect_data(GTK_OBJECT(widget), "clicked", - GTK_SIGNAL_FUNC(OnCheatListDlg_EnableClicked), xml, NULL, G_CONNECT_AFTER); - - widget = glade_xml_get_widget(xml, "disablebutton1"); - g_signal_connect_data(GTK_OBJECT(widget), "clicked", - GTK_SIGNAL_FUNC(OnCheatListDlg_DisableClicked), xml, NULL, G_CONNECT_AFTER); - widget = glade_xml_get_widget(xml, "loadbutton1"); g_signal_connect_data(GTK_OBJECT(widget), "clicked", GTK_SIGNAL_FUNC(OnCheatListDlg_OpenClicked), xml, NULL, G_CONNECT_AFTER); @@ -507,8 +447,6 @@ void RunCheatListDialog() { gtk_widget_set_sensitive(GTK_WIDGET(glade_xml_get_widget(xml, "savebutton1")), NumCheats); gtk_widget_set_sensitive(GTK_WIDGET(glade_xml_get_widget(xml, "editbutton1")), FALSE); gtk_widget_set_sensitive(GTK_WIDGET(glade_xml_get_widget(xml, "delbutton1")), FALSE); - gtk_widget_set_sensitive(GTK_WIDGET(glade_xml_get_widget(xml, "enablebutton1")), FALSE); - gtk_widget_set_sensitive(GTK_WIDGET(glade_xml_get_widget(xml, "disablebutton1")), FALSE); gtk_widget_set_sensitive(GTK_WIDGET(glade_xml_get_widget(xml, "editbutton1")), FALSE); } |
