Ejemplo n.º 1
0
SendMsgDlg::SendMsgDlg(const char *name, time_t when, const char *text)
: LinqWindow(WIN_SEND_MESSAGE)
{
	signal_delete_event().connect(SigC::slot(*this, &SendMsgDlg::on_window_delete_event));
	set_title (_("LinQ - Send message"));

	m_notebook.set_scrollable(true);
	m_notebook.popup_enable();

	Gtk::VBox *vbox;
	vbox = Gtk::manage(new Gtk::VBox(false, 0));
	
	Gtk::MenuBar *menubar;
	menubar = Gtk::manage(new Gtk::MenuBar());

	Gtk::Menu *menu;
	menu = Gtk::manage(new Gtk::Menu());	
	Gtk::Menu::MenuList& menulist = menu->items();
	menulist.push_back(Gtk::Menu_Helpers::MenuElem(_("View _histroy")));
	menulist.push_back(Gtk::Menu_Helpers::MenuElem(_("_Close")));	
	menubar->items().push_back( Gtk::Menu_Helpers::MenuElem("_Conservation", *menu) );
	
	menu = Gtk::manage(new Gtk::Menu());	
	menulist = menu->items();
	menulist.push_back(Gtk::Menu_Helpers::CheckMenuElem(_("Enabel _sound")));
	menubar->items().push_back( Gtk::Menu_Helpers::MenuElem("_Conservation", *menu) );

	vbox->pack_start(*menubar, false, true, 0);
	vbox->pack_start(m_notebook, true, true, 0);

	add(*vbox);

	SendMsgDlgTab *tab;
	tab = new SendMsgDlgTab(this, name);
	if (text)
		tab->onRecvMessage(when, text);
	tab->doPresent();

	show_all();
}
Ejemplo n.º 2
0
MainWindow::MainWindow () :
	Gtk::Window(),
	m_events(m_window.GetWindow()),
	m_mainimage(PREFIX_SHARE "/meteor.png"),
	m_padConfigDialog(*this, m_config),
	m_running(false)
{
	this->set_title("Meteor");
	this->set_resizable(false);

	Gtk::Menu* menu_file = manage(new Gtk::Menu);
	menu_file->items().push_back(Gtk::Menu_Helpers::StockMenuElem(
				Gtk::Stock::OPEN, sigc::mem_fun(*this,
					&MainWindow::on_open)));
	Gtk::Image* img = manage(new Gtk::Image(Gtk::Stock::OPEN,
				Gtk::ICON_SIZE_MENU));
	menu_file->items().push_back(Gtk::Menu_Helpers::ImageMenuElem(
				"Open _BIOS", *img, sigc::mem_fun(*this, &MainWindow::on_open_bios)));
	menu_file->items().push_back(Gtk::Menu_Helpers::StockMenuElem(
				Gtk::Stock::CLOSE, sigc::mem_fun(*this,
					&MainWindow::on_close)));
	img = manage(new Gtk::Image(Gtk::Stock::CLOSE,
				Gtk::ICON_SIZE_MENU));
	menu_file->items().push_back(Gtk::Menu_Helpers::ImageMenuElem(
				"Close B_IOS", *img, sigc::mem_fun(*this,
					&MainWindow::on_close_bios)));
	menu_file->items().push_back(Gtk::Menu_Helpers::SeparatorElem());
	menu_file->items().push_back(Gtk::Menu_Helpers::StockMenuElem(
				Gtk::Stock::QUIT, sigc::mem_fun(*this,
					&MainWindow::on_quit)));

	Gtk::Menu* menu_emulator = manage(new Gtk::Menu);
	img = manage(new Gtk::Image(Gtk::Stock::MEDIA_PLAY,
				Gtk::ICON_SIZE_MENU));
	menu_emulator->items().push_back(Gtk::Menu_Helpers::ImageMenuElem(
				"R_un", Gtk::AccelKey('u', Gdk::CONTROL_MASK), *img,
				sigc::mem_fun(*this, &MainWindow::on_run)));
	img = manage(new Gtk::Image(Gtk::Stock::MEDIA_STOP,
				Gtk::ICON_SIZE_MENU));
	menu_emulator->items().push_back(Gtk::Menu_Helpers::ImageMenuElem(
				"_Stop", Gtk::AccelKey('s', Gdk::CONTROL_MASK), *img,
				sigc::mem_fun(*this, &MainWindow::on_stop)));
	img = manage(new Gtk::Image(Gtk::Stock::MEDIA_REWIND,
				Gtk::ICON_SIZE_MENU));
	menu_emulator->items().push_back(Gtk::Menu_Helpers::ImageMenuElem(
				"_Reset", Gtk::AccelKey('r', Gdk::CONTROL_MASK), *img,
				sigc::mem_fun(*this, &MainWindow::on_reset)));
	menu_emulator->items().push_back(Gtk::Menu_Helpers::SeparatorElem());
	img = manage(new Gtk::Image(Gtk::Stock::PREFERENCES,
				Gtk::ICON_SIZE_MENU));
	menu_emulator->items().push_back(Gtk::Menu_Helpers::ImageMenuElem(
				"_Configure pad", *img,
				sigc::mem_fun(*this, &MainWindow::on_config_pad)));

	Gtk::Menu* menu_sstate = manage(new Gtk::Menu);
	Gtk::Menu* menu_lstate = manage(new Gtk::Menu);
	{
		char tmp[2];
		tmp[0] = '1';
		tmp[1] = '\0';
		for (char c = 0; c < 9; ++c, ++tmp[0])
			menu_sstate->items().push_back(Gtk::Menu_Helpers::MenuElem(
						tmp, Gtk::AccelKey(GDK_F1 + c, Gdk::CONTROL_MASK),
						sigc::bind<uint8_t>(sigc::mem_fun(
								*this, &MainWindow::on_save_state), c)));

		tmp[0] = '1';
		for (char c = 0; c < 9; ++c, ++tmp[0])
			menu_lstate->items().push_back(Gtk::Menu_Helpers::MenuElem(
						tmp, Gtk::AccelKey(GDK_F1 + c, (Gdk::ModifierType)0),
						sigc::bind<uint8_t>(sigc::mem_fun(
								*this, &MainWindow::on_load_state), c)));
	}

	Gtk::Menu* menu_state = manage(new Gtk::Menu);
	img = manage(new Gtk::Image(Gtk::Stock::SAVE,
				Gtk::ICON_SIZE_MENU));
	menu_state->items().push_back(Gtk::Menu_Helpers::ImageMenuElem(
				"Save", *img, *menu_sstate));
	img = manage(new Gtk::Image(Gtk::Stock::OPEN,
				Gtk::ICON_SIZE_MENU));
	menu_state->items().push_back(Gtk::Menu_Helpers::ImageMenuElem(
				"Load", *img, *menu_lstate));

	Gtk::Menu* menu_debug = manage(new Gtk::Menu);
	Gtk::Menu_Helpers::CheckMenuElem disassemblercheck(
				"Disassembler", sigc::mem_fun(*this,
					&MainWindow::on_menu_disassembler_toggle));
	m_refDisassemblerCheck =
		Glib::RefPtr<Gtk::CheckMenuItem>::cast_static(
				disassemblercheck.get_child());
	menu_debug->items().push_back(disassemblercheck);
	Gtk::Menu_Helpers::CheckMenuElem palettecheck(
				"Palette", sigc::mem_fun(*this,
					&MainWindow::on_menu_palette_toggle));
	m_refPaletteCheck =
		Glib::RefPtr<Gtk::CheckMenuItem>::cast_static(
				palettecheck.get_child());
	menu_debug->items().push_back(palettecheck);
	Gtk::Menu_Helpers::CheckMenuElem vramcheck(
				"Vram viewer", sigc::mem_fun(*this,
					&MainWindow::on_menu_vram_toggle));
	m_refVramCheck =
		Glib::RefPtr<Gtk::CheckMenuItem>::cast_static(
				vramcheck.get_child());
	menu_debug->items().push_back(vramcheck);

	Gtk::Menu* menu_help = manage(new Gtk::Menu);
	menu_help->items().push_back(Gtk::Menu_Helpers::StockMenuElem(
				Gtk::Stock::ABOUT, sigc::mem_fun(*this,
					&MainWindow::on_menu_about)));

	Gtk::MenuBar* menubar = manage(new Gtk::MenuBar);
	menubar->items().push_back(Gtk::Menu_Helpers::MenuElem("_File", *menu_file));
	menubar->items().push_back(
			Gtk::Menu_Helpers::MenuElem("_Emulator", *menu_emulator));
	menubar->items().push_back(
			Gtk::Menu_Helpers::MenuElem("_State", *menu_state));
	menubar->items().push_back(
			Gtk::Menu_Helpers::MenuElem("_Debug", *menu_debug));
	menubar->items().push_back(
			Gtk::Menu_Helpers::StockMenuElem(Gtk::Stock::HELP, *menu_help));

	m_viewport.set_double_buffered(false);
	m_viewport.set_size_request(4*240, 4*160);

	m_statusbar.set_has_resize_grip(false);

	m_mainvbox.pack_start(*menubar);
	m_mainvbox.pack_start(m_mainimage);
	m_mainvbox.pack_start(m_viewport);
	m_mainvbox.pack_start(m_statusbar);

	this->add(m_mainvbox);

	menubar->show_all();
	m_mainimage.show_all();
	m_statusbar.show_all();
	m_mainvbox.show();
	this->show();

	m_disassemblerWindow.signal_hide().connect(sigc::mem_fun(*this,
				&MainWindow::on_disassembler_hide));
	m_paletteWindow.signal_hide().connect(sigc::mem_fun(*this,
				&MainWindow::on_palette_hide));
	m_vramWindow.signal_hide().connect(sigc::mem_fun(*this,
				&MainWindow::on_vram_hide));

	m_config.Load();
	m_config.Init();
	m_batteryPath = m_config.GetBatteryPath();
	m_sstatePath = m_config.GetSStatePath();
	m_romPath = m_config.GetRomPath();

	m_window.InitAMeteor();
	m_audio.InitAMeteor();

	//m_refDisassemblerCheck->set_active(true);
	//m_refPaletteCheck->set_active(true);
	m_aboutDialog.set_logo(m_mainimage.get_pixbuf());
}