From 9b03874f32c19f05985814d2df39c1ba0c4c9e7f Mon Sep 17 00:00:00 2001 From: byuu Date: Mon, 27 Oct 2008 15:02:10 +0000 Subject: [PATCH] Update to bsnes v037a release. [No changelog available] --- readme.txt | 2 +- src/base.h | 2 +- src/lib/hiro/gtk/listbox.cpp | 73 +++++++++++++++++++------------- src/lib/hiro/hiro.hpp | 2 +- src/ui/event.cpp | 2 +- src/ui/settings/driverselect.cpp | 10 ++--- src/ui/settings/inputconfig.cpp | 2 +- 7 files changed, 54 insertions(+), 39 deletions(-) diff --git a/readme.txt b/readme.txt index 1af72f7d..c8bdc98b 100644 --- a/readme.txt +++ b/readme.txt @@ -1,5 +1,5 @@ bsnes -Version: 0.037 +Version: 0.037a Author: byuu ======== diff --git a/src/base.h b/src/base.h index b1fa2b85..170c8ba8 100644 --- a/src/base.h +++ b/src/base.h @@ -1,4 +1,4 @@ -#define BSNES_VERSION "0.037" +#define BSNES_VERSION "0.037a" #define BSNES_TITLE "bsnes v" BSNES_VERSION #define BUSCORE sBus diff --git a/src/lib/hiro/gtk/listbox.cpp b/src/lib/hiro/gtk/listbox.cpp index 743cc37e..2d566ce8 100644 --- a/src/lib/hiro/gtk/listbox.cpp +++ b/src/lib/hiro/gtk/listbox.cpp @@ -1,19 +1,27 @@ -void hiro_plistbox_change(pListbox *p) { +static void hiro_plistbox_change(pListbox *p) { + //only send message when active item changes if(p->listbox_selection == p->get_selection()) return; - if(p->self.on_change) p->self.on_change(event_t(event_t::Change, p->listbox_selection = p->get_selection(), &p->self)); + + p->listbox_selection = p->get_selection(); + if(p->self.on_change) { + p->self.on_change(event_t(event_t::Change, p->listbox_selection, &p->self)); + } } -void hiro_plistbox_activate(pListbox *p) { - if(p->self.on_activate) p->self.on_activate(event_t(event_t::Activate, p->listbox_selection = p->get_selection(), &p->self)); +static void hiro_plistbox_activate(pListbox *p) { + p->listbox_selection = p->get_selection(); + if(p->self.on_activate) { + p->self.on_activate(event_t(event_t::Activate, p->listbox_selection, &p->self)); + } } void pListbox::create(unsigned style, unsigned width, unsigned height, const char *columns, const char *text) { bool header = style & Listbox::Header; GtkPolicyType hscroll = (style & Listbox::HorizontalScrollAlways) ? GTK_POLICY_ALWAYS : - (style & Listbox::HorizontalScrollNever) ? GTK_POLICY_NEVER : + (style & Listbox::HorizontalScrollNever ) ? GTK_POLICY_NEVER : GTK_POLICY_AUTOMATIC; GtkPolicyType vscroll = (style & Listbox::VerticalScrollAlways) ? GTK_POLICY_ALWAYS : - (style & Listbox::VerticalScrollNever) ? GTK_POLICY_NEVER : + (style & Listbox::VerticalScrollNever ) ? GTK_POLICY_NEVER : GTK_POLICY_AUTOMATIC; scrollbox = gtk_scrolled_window_new(0, 0); @@ -35,7 +43,7 @@ void pListbox::create(unsigned style, unsigned width, unsigned height, const cha gtk_widget_show(listbox); gtk_widget_show(scrollbox); - //alternate colors for each listbox entry if there are multiple columns ... + //alternate colors for each listbox entry if there are multiple columns gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(listbox), count(list) >= 2 ? true : false); for(unsigned i = 0; i < count(list); i++) { renderer = gtk_cell_renderer_text_new(); @@ -68,58 +76,65 @@ void pListbox::set_column_width(unsigned column, unsigned width) { } void pListbox::add_item(const char *text) { -lstring list; + lstring list; split(list, "\t", text); gtk_list_store_append(store, &iter); for(unsigned i = 0; i < count(list); i++) { - gtk_list_store_set(store, &iter, i, list[i](), -1); + gtk_list_store_set(store, &iter, i, (const char*)list[i], -1); } } void pListbox::set_item(unsigned index, const char *text) { -GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(listbox)); + GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(listbox)); for(unsigned i = 0; i <= index; i++) { i == 0 ? gtk_tree_model_get_iter_first(model, &iter) : gtk_tree_model_iter_next(model, &iter); } -lstring list; + lstring list; split(list, "\t", text); for(unsigned i = 0; i < count(list); i++) { - gtk_list_store_set(store, &iter, i, list[i](), -1); + gtk_list_store_set(store, &iter, i, (const char*)list[i], -1); } } int pListbox::get_selection() { -GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(listbox)); -GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(listbox)); - if(gtk_tree_model_get_iter_first(model, &iter) == false) { return -1; } - if(gtk_tree_selection_iter_is_selected(selection, &iter) == true) { return 0; } + GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(listbox)); + GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(listbox)); + if(gtk_tree_model_get_iter_first(model, &iter) == false) return -1; + if(gtk_tree_selection_iter_is_selected(selection, &iter) == true) return 0; for(unsigned i = 1; i < 100000; i++) { - if(gtk_tree_model_iter_next(model, &iter) == false) { return -1; } - if(gtk_tree_selection_iter_is_selected(selection, &iter) == true) { return i; } + if(gtk_tree_model_iter_next(model, &iter) == false) return -1; + if(gtk_tree_selection_iter_is_selected(selection, &iter) == true) return i; } return -1; } void pListbox::set_selection(int index) { -int current = get_selection(); -GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(listbox)); -GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(listbox)); + int current = get_selection(); + GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(listbox)); + GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(listbox)); gtk_tree_selection_unselect_all(selection); - if(index < 0) { goto end; } - if(gtk_tree_model_get_iter_first(model, &iter) == false) { goto end; } - if(index == 0) { gtk_tree_selection_select_iter(selection, &iter); goto end; } - for(unsigned i = 1; i < 100000; i++) { - if(gtk_tree_model_iter_next(model, &iter) == false) { goto end; } - if(index == i) { gtk_tree_selection_select_iter(selection, &iter); goto end; } + if(index < 0) return; //nothing to select? + + if(gtk_tree_model_get_iter_first(model, &iter)) { + if(index == 0) { + gtk_tree_selection_select_iter(selection, &iter); + } else { + for(unsigned i = 1; i < 100000; i++) { + if(gtk_tree_model_iter_next(model, &iter) == false) break; + if(index == i) { + gtk_tree_selection_select_iter(selection, &iter); + break; + } + } + } } -end: - if(current != index); //{ owner->message(Message::Changed, (uintptr_t)this); } } void pListbox::reset() { + listbox_selection = -1; gtk_list_store_clear(GTK_LIST_STORE(store)); gtk_tree_view_set_model(GTK_TREE_VIEW(listbox), GTK_TREE_MODEL(store)); } diff --git a/src/lib/hiro/hiro.hpp b/src/lib/hiro/hiro.hpp index 85135fae..8f18cea6 100644 --- a/src/lib/hiro/hiro.hpp +++ b/src/lib/hiro/hiro.hpp @@ -1,6 +1,6 @@ /* hiro - version: 0.007b (2008-10-26) + version: 0.008 (2008-10-27) author: byuu license: public domain */ diff --git a/src/ui/event.cpp b/src/ui/event.cpp index f98ec571..61130a5f 100644 --- a/src/ui/event.cpp +++ b/src/ui/event.cpp @@ -126,7 +126,7 @@ void update_emulation_speed(int speed) { unsigned outfreq = config::audio.output_frequency; unsigned infreq = config::audio.input_frequency * scale[speed] + 0.5; - audio.set(Audio::Resample, outfreq != infreq); //only resample when necessary + audio.set(Audio::Resample, outfreq != infreq); //only resample when necessary audio.set(Audio::ResampleOutputFrequency, outfreq); audio.set(Audio::ResampleInputFrequency, infreq); diff --git a/src/ui/settings/driverselect.cpp b/src/ui/settings/driverselect.cpp index ff967264..5be41352 100644 --- a/src/ui/settings/driverselect.cpp +++ b/src/ui/settings/driverselect.cpp @@ -22,9 +22,9 @@ uintptr_t DriverSelectWindow::input_change(event_t) { void DriverSelectWindow::setup() { create(0, 475, 355); - //this is only displayed if app.crashed_on_last_run == true + //this is only displayed if application crashed on last run crash_message.create(0, 475, 36, string() - << translate["WARNING: bsnes crashed on last startup due to incompatible driver settings."] << "\n" + << translate["Warning: bsnes crashed on last startup due to incompatible driver settings."] << "\n" << translate["Please select a different driver configuration below."] ); @@ -35,7 +35,7 @@ void DriverSelectWindow::setup() { split(part, ";", video.driver_list()); for(unsigned i = 0; i < count(part); i++) { - cvideo.add_item(part[i]); + cvideo.add_item(translate[string() << "{{videodriver}}" << part[i]]); if(part[i] == config::system.video) cvideo.set_selection(i); } @@ -44,7 +44,7 @@ void DriverSelectWindow::setup() { split(part, ";", audio.driver_list()); for(unsigned i = 0; i < count(part); i++) { - caudio.add_item(part[i]); + caudio.add_item(translate[string() << "{{audiodriver}}" << part[i]]); if(part[i] == config::system.audio) caudio.set_selection(i); } @@ -53,7 +53,7 @@ void DriverSelectWindow::setup() { split(part, ";", input.driver_list()); for(unsigned i = 0; i < count(part); i++) { - cinput.add_item(part[i]); + cinput.add_item(translate[string() << "{{inputdriver}}" << part[i]]); if(part[i] == config::system.input) cinput.set_selection(i); } diff --git a/src/ui/settings/inputconfig.cpp b/src/ui/settings/inputconfig.cpp index a17394cb..ae3753a5 100644 --- a/src/ui/settings/inputconfig.cpp +++ b/src/ui/settings/inputconfig.cpp @@ -184,7 +184,7 @@ uintptr_t InputConfigWindow::set_tick(event_t) { message = translate["Move mouse or analog joypad axis to assign to $ ..."]; } - replace(message, "$", group->list[pos]->name); + replace(message, "$", translate[group->list[pos]->name]); window_input_capture.label.set_text(message); bool show_controller_graphic = false;