More backporting changes to core from wxwidgets work

This commit is contained in:
Ilari Liusvaara 2011-11-03 23:07:21 +02:00
parent 1fd32a963c
commit 9e8ba1f68c
6 changed files with 28 additions and 3 deletions

View file

@ -20,6 +20,7 @@ void lua_callback_quit() throw() {}
void init_lua() throw() {}
bool lua_requests_repaint = false;
bool lua_requests_subframe_paint = false;
bool lua_supported = false;
#else
#include "lua-int.hpp"
@ -431,4 +432,5 @@ void init_lua() throw()
bool lua_requests_repaint = false;
bool lua_requests_subframe_paint = false;
#endif
bool lua_supported = true;
#endif

View file

@ -81,6 +81,7 @@ void lua_callback_post_save(const std::string& name, bool is_state) throw();
void lua_callback_snoop_input(uint32_t port, uint32_t controller, uint32_t index, short value) throw();
void lua_callback_quit() throw();
extern bool lua_supported;
extern bool lua_requests_repaint;
extern bool lua_requests_subframe_paint;

View file

@ -604,6 +604,7 @@ namespace
"Syntax: set-rwmode\nSwitches to read/write mode\n",
[]() throw(std::bad_alloc, std::runtime_error) {
movb.get_movie().readonly_mode(false);
window_callback::do_mode_change(false);
lua_callback_do_readwrite();
update_movie_state();
window::notify_screen_update();
@ -613,6 +614,7 @@ namespace
"Syntax: set-romode\nSwitches to read-only mode\n",
[]() throw(std::bad_alloc, std::runtime_error) {
movb.get_movie().readonly_mode(true);
window_callback::do_mode_change(true);
update_movie_state();
window::notify_screen_update();
});
@ -622,6 +624,7 @@ namespace
[]() throw(std::bad_alloc, std::runtime_error) {
bool c = movb.get_movie().readonly_mode();
movb.get_movie().readonly_mode(!c);
window_callback::do_mode_change(!c);
if(c)
lua_callback_do_readwrite();
update_movie_state();

View file

@ -12,6 +12,7 @@
#include "rrdata.hpp"
#include "settings.hpp"
#include "controller.hpp"
#include "window.hpp"
struct moviefile our_movie;
struct loaded_rom* our_rom;
@ -263,6 +264,7 @@ void do_load_state(struct moviefile& _movie, int lmode)
movb.get_movie().readonly_mode(false);
if(lmode == LOAD_STATE_CURRENT && !current_mode)
movb.get_movie().readonly_mode(false);
window_callback::do_mode_change(movb.get_movie().readonly_mode());
messages << "ROM Type ";
switch(our_rom->rtype) {
case ROMTYPE_SNES:

View file

@ -291,6 +291,10 @@ void window_callback::on_sound_unmute(bool unmute) throw()
{
}
void window_callback::on_mode_change(bool readonly) throw()
{
}
void window_callback::on_sound_change(const std::string& dev) throw()
{
}
@ -317,7 +321,12 @@ void window_callback::do_sound_unmute(bool unmute) throw()
void window_callback::do_sound_change(const std::string& dev) throw()
{
std::cerr << "do_sound_change(" << dev << ")" << std::endl;
for(auto i : wcbs())
i->on_sound_change(dev);
}
}
void window_callback::do_mode_change(bool readonly) throw()
{
for(auto i : wcbs())
i->on_mode_change(readonly);
}

View file

@ -45,6 +45,10 @@ public:
* Called when sound device gets (possibly) changed.
*/
virtual void on_sound_change(const std::string& dev) throw();
/**
* Called when mode gets (possibly) changed.
*/
virtual void on_mode_change(bool readonly) throw();
/**
* Do try to close the window.
*/
@ -61,6 +65,10 @@ public:
* Do on_sound_change
*/
static void do_sound_change(const std::string& dev) throw();
/**
* Do on_mode_change
*/
static void do_mode_change(bool readonly) throw();
private:
window_callback(window_callback&);
window_callback& operator=(window_callback&);