sample_vector_layer_viewer::sample_vector_layer_viewer(wxWindow* parent, wxWindowID id, const wxString &title, const wxPoint &pos, const wxSize &size, long style, const wxString &name) :
basic_viewer_frame(parent, id, title, pos, size, style, name)
{
#if defined(__WXMSW__)
	// Sous windows, on va chercher l'image dans les resources
	wxIcon icon(wxT("logo_matis_small") );
	SetIcon (icon);
#else
	SetIcon(wxICON(LOGO_MATIS_small));
#endif

        panel_viewer::Register(this,&m_dockManager);
        m_drawPane = panel_manager::instance()->create_object("PanelViewer");

	m_statusBar->SetStatusText(wxT("GilViewer - Adrien Chauve & Olivier Tournaire"));

	wxAuiPaneInfo paneInfoDrawPane;
	paneInfoDrawPane.Name( wxT("Viewer panel name") );
	paneInfoDrawPane.Caption( wxT("Viewer panel") );
	paneInfoDrawPane.TopDockable();
	paneInfoDrawPane.Center();
	paneInfoDrawPane.CloseButton(false);
	paneInfoDrawPane.CaptionVisible(false);
	m_dockManager.AddPane( m_drawPane, paneInfoDrawPane );

        m_drawPane->main_toolbar(this,&m_dockManager);
        m_drawPane->mode_and_geometry_toolbar(this,&m_dockManager);

	m_dockManager.Update();

	// Menu bar
        SetMenuBar( m_drawPane->menubar() );
}
Example #2
0
//---------------------------------------------------------------
void main()
{
   int i,j;
   clrscr();

   for(i=0;i<9;i++)     // flush all the arrays
      for(j=0;j<9;j++)
	 cnt = arr[i][j] = stat[i][j] = puzz[i][j] = hnt[i][j] = 0;

   int gd=DETECT,gm;
   initgraph(&gd, &gm,path);

   if(LOAD)  loading();

   clrscr();
   initgraph(&gd, &gm,path);

   setbkcolor(BLACK);
   rectangle(0,27,637,477);
   setfillstyle(1,BLUE);
   floodfill(25,30,15);
   frame(20,100,90,460,LIGHTRED,RED,GREEN);

   _1.draw();   _4.draw();   _7.draw();
   _2.draw();   _5.draw();   _8.draw();
   _3.draw();   _6.draw();   _9.draw();
   _ER.draw();

   ext_button();
   menubar();
   maze();
   fill_maze();
   Control();
}
Example #3
0
MainFrame::MainFrame()
	: FrameBase(NULL, wxID_ANY, "", "MainFrame", wxSize(280, 180))
	, m_aui_mgr(this)
{
	SetLabel(wxString::Format(_PRGNAME_ " " _PRGVER_ " r%d" SVN_MOD " (" SVN_DATE ")", SVN_REV));
	wxMenuBar& menubar(*new wxMenuBar());

	wxMenu& menu_boot(*new wxMenu());
	wxMenu& menu_sys(*new wxMenu());
	wxMenu& menu_conf(*new wxMenu());

	menubar.Append(&menu_boot, "Boot");
	menubar.Append(&menu_sys, "System");
	menubar.Append(&menu_conf, "Config");

	menu_boot.Append(id_boot_game, "Boot game");
	menu_boot.AppendSeparator();
	menu_boot.Append(id_boot_elf, "Boot Elf");
	//menu_boot.Append(id_boot_self, "Boot Self");

	menu_sys.Append(id_sys_pause, "Pause");
	menu_sys.Append(id_sys_stop, "Stop\tCtrl + S");
	menu_sys.AppendSeparator();
	menu_sys.Append(id_sys_send_exit, "Send exit cmd");

	menu_conf.Append(id_config_emu, "Settings");

	SetMenuBar(&menubar);

	m_game_viewer = new GameViewer(this);
	AddPane(m_game_viewer, "Game List", wxAUI_DOCK_BOTTOM);
	
	Connect( id_boot_game,  wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainFrame::BootGame) );
	Connect( id_boot_elf,   wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainFrame::BootElf) );
	Connect( id_boot_self,  wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainFrame::BootSelf) );

	Connect( id_sys_pause,  wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainFrame::Pause) );
	Connect( id_sys_stop,   wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainFrame::Stop) );
	Connect( id_sys_send_exit,   wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainFrame::SendExit) );
	Connect( id_update_dbg, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainFrame::UpdateUI) );

	Connect( id_config_emu, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainFrame::Config) );
	m_app_connector.Connect(wxEVT_KEY_DOWN, wxKeyEventHandler(MainFrame::OnKeyDown), (wxObject*)0, this);

	UpdateUI();
}
Example #4
0
void MainFrame::UpdateUI()
{
	wxMenuBar& menubar( *GetMenuBar() );
	wxMenuItem& pause = *menubar.FindItem( id_sys_pause );
	wxMenuItem& stop  = *menubar.FindItem( id_sys_stop );
	wxMenuItem& send_exit  = *menubar.FindItem( id_sys_send_exit );

	pause.SetText(Emu.IsRunned() ? "Pause\tCtrl + P" : Emu.IsReady() ? "Start\tCtrl + C" : "Resume\tCtrl + C");
	pause.Enable(!Emu.IsStopped());
	stop.Enable(!Emu.IsStopped());
	//send_exit.Enable(false);
	send_exit.Enable(!Emu.IsStopped() && Emu.GetCallbackManager().m_exit_callback.m_callbacks.GetCount());

	m_aui_mgr.Update();

	wxCommandEvent refit( wxEVT_COMMAND_MENU_SELECTED, id_update_dbg );
	GetEventHandler()->AddPendingEvent( refit );
}
Example #5
0
void ProcessMonitor::initializeMenus() 
{
   QMenuBar* menubar(menuBar());
   QAction*  action;
   QMenu*    menu;

   menubar->clear();
   menu = menubar->addMenu(tr("File"));
      action = menu->addAction(tr("Reconnect Servers"));
      connect(action, SIGNAL(triggered()), this, SLOT(reconnectServers()));
      action->setShortcut(Qt::CTRL + Qt::Key_R);

      action = menu->addAction(tr("Remove All Processes"));
      connect(action, SIGNAL(triggered()), this, SLOT(clearProcessList()));
      action->setShortcut(Qt::CTRL + Qt::Key_Backspace);

      action = menu->addAction(tr("Close"));
      connect(action, SIGNAL(triggered()), this, SLOT(close()));
      action->setShortcut(QKeySequence::Close);
}
Example #6
0
//MainEmuFrame needs to be aware which items are affected by presets if AppConfig::APPLY_FLAG_FROM_PRESET is on.
//currently only EnablePatches is affected when the settings come from a preset.
void MainEmuFrame::ApplyConfigToGui(AppConfig& configToApply, int flags)
{
	wxMenuBar& menubar( *GetMenuBar() );

	menubar.Check(	MenuId_EnablePatches, configToApply.EmuOptions.EnablePatches );
	menubar.Enable(	MenuId_EnablePatches, !configToApply.EnablePresets );

	if ( !(flags & AppConfig::APPLY_FLAG_FROM_PRESET) )
	{//these should not be affected by presets
		menubar.Check( MenuId_EnableBackupStates, configToApply.EmuOptions.BackupSavestate );
		menubar.Check( MenuId_EnableCheats,  configToApply.EmuOptions.EnableCheats );
		menubar.Check( MenuId_EnableWideScreenPatches,  configToApply.EmuOptions.EnableWideScreenPatches );
		menubar.Check( MenuId_EnableHostFs,  configToApply.EmuOptions.HostFs );
#ifdef __LINUX__
		menubar.Check( MenuId_Console_Stdio, configToApply.EmuOptions.ConsoleToStdio );
#endif

		menubar.Check( MenuId_Config_Multitap0Toggle, configToApply.EmuOptions.MultitapPort0_Enabled );
		menubar.Check( MenuId_Config_Multitap1Toggle, configToApply.EmuOptions.MultitapPort1_Enabled );
	}

	UpdateIsoSrcSelection();	//shouldn't be affected by presets but updates from g_Conf anyway and not from configToApply, so no problem here.
}
Example #7
0
gilviewer_frame::gilviewer_frame(wxWindow* parent, wxWindowID id, const wxString &title, const wxPoint &pos, const wxSize &size, long style, const wxString &name) :
basic_viewer_frame(parent, id, title, pos, size, style, name)
{
    panel_viewer::Register(this,&m_dockManager);
    m_panelviewer = panel_manager::instance()->create_object("PanelViewer");

    wxAuiPaneInfo paneInfoDrawPane;
    paneInfoDrawPane.Name( wxT("Viewer panel name") );
    paneInfoDrawPane.Caption( wxT("Viewer panel") );
    paneInfoDrawPane.TopDockable();
    paneInfoDrawPane.Center();
    paneInfoDrawPane.CloseButton(false);
    paneInfoDrawPane.CaptionVisible(false);
    m_dockManager.AddPane( m_panelviewer, paneInfoDrawPane );

    //create toolbars
    m_panelviewer->main_toolbar(this,&m_dockManager);
    m_panelviewer->mode_and_geometry_toolbar(this,&m_dockManager);

    m_dockManager.Update();

    SetMenuBar( m_panelviewer->menubar() );
    m_statusBar->SetStatusText(wxT("GilViewer - Adrien Chauve & Olivier Tournaire"));
}
Example #8
0
//-----------------------------------------------------------------------------
int main(int argc, char** argv) {
	//----

	s_pTbl_Items_Basic = new CN3TableBase<__TABLE_ITEM_BASIC>;

	std::string szFN = "Item_Org.tbl";
	if(s_pTbl_Items_Basic->LoadFromFile(szFN.c_str()) == false) {
		printf("Failed to load Item_Org.tbl\n");
		system("pause");
		return -1;
	}

	//----

	SQLHANDLE hEnv, hConn;

	SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &hEnv);
	SQLSetEnvAttr(hEnv, SQL_ATTR_ODBC_VERSION, (void *)SQL_OV_ODBC3, 0);
	SQLAllocHandle(SQL_HANDLE_DBC, hEnv, &hConn);
	if(SQLConnect(hConn, _T("KN_online"), SQL_NTS, _T("knight"), SQL_NTS, _T("knight"), SQL_NTS) == SQL_ERROR) {
		printf("SQLConnect\n");
		system("pause");
		return -1;
	}

	SQLHANDLE hStmt;
	SQLAllocHandle(SQL_HANDLE_STMT, hConn, &hStmt);
	if(SQLExecDirect(hStmt, _T("SELECT TOP(5000) Num, strName FROM ITEM;"), SQL_NTS) == SQL_ERROR) {//TOP(10000)
		printf("SQLExecDirect\n");
		system("pause");
		return -1;
	}

	long count = 0;
	SQLINTEGER cbData;
	while(SQLFetch(hStmt) == SQL_SUCCESS) {

		_ITEM_TABLE* item = new _ITEM_TABLE();

		SQLGetData(hStmt, 1, SQL_C_ULONG, &(item->m_iNum), sizeof(SQLUINTEGER), &cbData);
		SQLGetData(hStmt, 2, SQL_C_CHAR, item->m_sName, NAME_LENGTH, &cbData);

		ItemTableMap.PutData(count++, item);

		__TABLE_ITEM_BASIC* pItem = s_pTbl_Items_Basic->Find(item->m_iNum/1000*1000);
		if(!pItem) printf("Item \"%s\" is missing from the TBL!\n", item->m_sName);
	}

	SQLFreeHandle(SQL_HANDLE_STMT, hStmt);
	
	SQLDisconnect(hConn);
	SQLFreeHandle(SQL_HANDLE_DBC, hConn);
	SQLFreeHandle(SQL_HANDLE_ENV, hEnv);

	//----

	dirent** dir_list;
	int num_files = fl_filename_list("./item", &dir_list);

	num_disp_files = 0;
	for(int i=0; i<num_files; ++i) {
		int len_fn = strlen(dir_list[i]->d_name);
		if(!strcmp(&dir_list[i]->d_name[len_fn-7], "n3cplug") || !strcmp(&dir_list[i]->d_name[len_fn-7], "n3cpart")) {
			disp_files = (char**)realloc(disp_files, ++num_disp_files*sizeof(char*));
			disp_files[num_disp_files-1] = (char*)calloc(len_fn+1, sizeof(char));
			memcpy(disp_files[num_disp_files-1], dir_list[i]->d_name, len_fn);

			//char* filename = disp_files[num_disp_files-1];
			//N3MeshConverter::Convert(filename);
		}
	}

	fl_filename_free_list(&dir_list, num_files);

	//----

	Fl::use_high_res_GL(true);
	Fl_Window window(1024, 720, "KO Item Editor");

	GLItemViewer sw(window.w()-_gl_width, 30, _gl_width, _gl_height);
	m_sw = &sw;

	ItemTableView demo_table(0, 30, window.w()-(_gl_width+0), _gl_height);
	demo_table.selection_color(FL_YELLOW);
	demo_table.when(FL_WHEN_RELEASE|FL_WHEN_CHANGED);
	demo_table.table_box(FL_NO_BOX);
	demo_table.col_resize_min(4);
	demo_table.row_resize_min(4);

	demo_table.row_header(true);
	demo_table.row_header_width(60);
	demo_table.row_resize(true);
	demo_table.rows(num_disp_files /*ItemTableMap.GetSize()*/);
	demo_table.row_height_all(20);

	demo_table.col_header(true);
	demo_table.col_header_height(25);
	demo_table.col_resize(true);
	demo_table.cols(1 /*2*/);
	demo_table.col_width_all(150);

	Fl_Menu_Bar menubar(0, 0, window.w(), 30);
	menubar.menu(menu_table);
	menubar.callback(test_cb);

	// TODO: need to add the positions and widths/heights as variables
	Fl_Tabs info_tabs(0, _gl_height+40, window.w(), window.h()-_gl_height-30-10);
		Fl_Group group(0, _gl_height+40+35, window.w(), window.h()-_gl_height-30-10, "Table Info");
			tbl_id        = new Fl_Int_Input(80, _gl_height+30+35+20+5, 240, 30, "ID:");
			tbl_ext_index = new Fl_Int_Input(80, _gl_height+30+35+20+40+5, 240, 30, "Ext Index:");
			tbl_name      = new Fl_Input    (80, _gl_height+30+35+20+80+5, 240, 30, "Name:");
			tbl_remark    = new Fl_Input    (80, _gl_height+30+35+20+120+5, 240, 30, "Remark:");
		group.end();
		Fl_Group group2(0, _gl_height+40+35, window.w(), window.h()-_gl_height-30-10, "Database Info");
			Fl_Input input2(10, _gl_height+30+35+20, 240, 30);
		group2.end();
	info_tabs.end();

	window.end();
	window.show(argc, argv);

	sw.show();
	sw.redraw_overlay();

	return Fl::run();
}
Example #9
0
//write pending preset settings from the gui to g_Conf,
//	without triggering an overall "settingsApplied" event.
void MainEmuFrame::CommitPreset_noTrigger()
{
	wxMenuBar& menubar( *GetMenuBar() );
	g_Conf->EmuOptions.EnablePatches = menubar.IsChecked( MenuId_EnablePatches );
}
Example #10
0
void MainEmuFrame::ApplyCoreStatus()
{
	wxMenuBar& menubar( *GetMenuBar() );

	wxMenuItem* susres	= menubar.FindItem( MenuId_Sys_SuspendResume );
	wxMenuItem* cdvd	= menubar.FindItem( MenuId_Boot_CDVD );
	wxMenuItem* cdvd2	= menubar.FindItem( MenuId_Boot_CDVD2 );
	wxMenuItem* restart	= menubar.FindItem( MenuId_Sys_Restart );

	// [TODO] : Ideally each of these items would bind a listener instance to the AppCoreThread
	// dispatcher, and modify their states accordingly.  This is just a hack (for now) -- air

	bool vm = SysHasValidState();

	if( susres )
	{
		if( !CoreThread.IsClosing() )
		{
			susres->Enable();
			susres->SetText(_("Pause"));
			susres->SetHelp(_("Safely pauses emulation and preserves the PS2 state."));
		}
		else
		{
			susres->Enable(vm);
			if( vm )
			{
				susres->SetText(_("Resume"));
				susres->SetHelp(_("Resumes the suspended emulation state."));
			}
			else
			{
				susres->SetText(_("Pause/Resume"));
				susres->SetHelp(_("No emulation state is active; cannot suspend or resume."));
			}
		}
	}

	if( restart )
	{
		if( vm )	
		{
			restart->SetText(_("Restart"));
			restart->SetHelp(_("Simulates hardware reset of the PS2 virtual machine."));
		}
		else
		{
			restart->Enable( false );
			restart->SetHelp(_("No emulation state is active; boot something first."));
		}
	}

	if( cdvd )
	{
		if( vm )
		{
			cdvd->SetText(_("Reboot CDVD (full)"));
			cdvd->SetHelp(_("Hard reset of the active VM."));
		}
		else
		{
			cdvd->SetText(_("Boot CDVD (full)"));
			cdvd->SetHelp(_("Boot the VM using the current DVD or Iso source media"));
		}	
	}

	if( cdvd2 )
	{
		if( vm )
		{
			cdvd2->SetText(_("Reboot CDVD (fast)"));
			cdvd2->SetHelp(_("Reboot using fast BOOT (skips splash screens)"));
		}
		else
		{
			cdvd2->SetText(_("Boot CDVD (fast)"));
			cdvd2->SetHelp(_("Use fast boot to skip PS2 startup and splash screens"));
		}
	}

	menubar.Enable( MenuId_Sys_Shutdown, SysHasValidState() || CorePlugins.AreAnyInitialized() );
}
Example #11
0
void MainEmuFrame::ApplyCoreStatus()
{
	wxMenuBar& menubar( *GetMenuBar() );

	// [TODO] : Ideally each of these items would bind a listener instance to the AppCoreThread
	// dispatcher, and modify their states accordingly.  This is just a hack (for now) -- air

	if (wxMenuItem* susres = menubar.FindItem(MenuId_Sys_SuspendResume))
	{
		if( !CoreThread.IsClosing() )
		{
			susres->Enable();
			susres->SetItemLabel(_("Paus&e"));
			susres->SetHelp(_("Safely pauses emulation and preserves the PS2 state."));
		}
		else
		{
			bool ActiveVM = SysHasValidState();
			susres->Enable(ActiveVM);
			if( ActiveVM )
			{
				susres->SetItemLabel(_("R&esume"));
				susres->SetHelp(_("Resumes the suspended emulation state."));
			}
			else
			{
				susres->SetItemLabel(_("Pause/Resume"));
				susres->SetHelp(_("No emulation state is active; cannot suspend or resume."));
			}
		}
	}

	const CDVD_SourceType Source = g_Conf->CdvdSource;
	const MenuIdentifiers fullboot_id = MenuId_Boot_CDVD;
	const MenuIdentifiers fastboot_id = MenuId_Boot_CDVD2;

	wxMenuItem *cdvd_fast = menubar.FindItem(fastboot_id);
	if (Source == CDVD_SourceType::NoDisc)
	{
		if(cdvd_fast)
			m_menuSys.Destroy(cdvd_fast);
	}
	else
	{
		wxString label;
		wxString help_text = _("Use fast boot to skip PS2 startup and splash screens");

		switch (Source)
		{
		case CDVD_SourceType::Iso:
			label = _("Boot ISO (&fast)");
			break;
		case CDVD_SourceType::Plugin:
			label = _("Boot CDVD (&fast)");
			break;
		//case CDVD_SourceType::NoDisc: (Fast boot menu item is destroyed when no disc is selected)
		default:
			pxAssert(false);
		}

		if (cdvd_fast)
		{
			cdvd_fast->SetItemLabel(label);
			cdvd_fast->SetHelp(help_text);
		}
		else
		{
			m_menuSys.Insert(1, fastboot_id, label, help_text);
		}
	}

	if (wxMenuItem *cdvd_full = menubar.FindItem(fullboot_id))
	{
		switch (Source)
		{
		case CDVD_SourceType::Iso:
			cdvd_full->SetItemLabel(_("Boo&t ISO (full)"));
			cdvd_full->SetHelp(_("Boot the VM using the current ISO source media"));
			break;
		case CDVD_SourceType::Plugin:
			cdvd_full->SetItemLabel(_("Boo&t CDVD (full)"));
			cdvd_full->SetHelp(_("Boot the VM using the current CD/DVD source media"));
			break;
		case CDVD_SourceType::NoDisc:
			cdvd_full->SetItemLabel(_("Boo&t BIOS"));
			cdvd_full->SetHelp(_("Boot the VM without any source media"));
			break;
		default:
			pxAssert(false);
		}
	}
}
Example #12
0
File: Main.cpp Project: aib/glito
int main( int argc, char **argv ) {
    // I18N
#ifdef HAVE_SETLOCALE
    setlocale( LC_MESSAGES, "" ); // with glibc read LC_ALL first
    setlocale( LC_NUMERIC, "POSIX" ); // to avoid incompatibility between ifs files.
#endif
#ifdef ENABLE_NLS
#ifdef WIN32
    bindtextdomain( PACKAGE, "locale" );
#else
    bindtextdomain( PACKAGE, LOCALEDIR );
#endif
    textdomain( PACKAGE );
#endif
    // localization of some strings of FLTK:
    fl_no = _("No");
    fl_yes = _("Yes");
    fl_ok = _("OK");
    fl_cancel = _("Cancel");
    fl_close = _("Close");
    Fl_File_Chooser::add_favorites_label = _("Add to Favorites");
    Fl_File_Chooser::all_files_label = _("All Files (*)");
    Fl_File_Chooser::custom_filter_label = _("Custom Filter");
    Fl_File_Chooser::existing_file_label = _("Please choose an existing file!");
    Fl_File_Chooser::favorites_label = _("Favorites");
    Fl_File_Chooser::filename_label = _("Filename:");
#ifdef WIN32
    Fl_File_Chooser::filesystems_label = _("My Computer");
#else
    Fl_File_Chooser::filesystems_label = _("File Systems");
#endif
    Fl_File_Chooser::manage_favorites_label = _("Manage Favorites");
    Fl_File_Chooser::preview_label = _("Preview");
    Fl_File_Chooser::show_label = _("Show:");
    string skeletonToOpen;
#ifdef HAVE_UNISTD_H
    while ( true ) {
	int c = getopt( argc, argv, "vhp:" );
	if ( c == -1 ) {
	    break;
	}
	switch ( c ) {
	case 'p':
	    paramFile = optarg;
	    break;
	case 'v':
	    cerr << "Glito v" << VERSION << "\nCopyright (C) 2002-2003 Emmanuel Debanne\n"
		 << _("Glito is distributed under the terms of the GNU General Public License.\n");
	    return 0;
	default:
	case 'h':
	    usage();
	    return 0;
	}
    }
    if ( optind < argc ) {
	skeletonToOpen = argv[optind];
	++optind;
	if ( optind < argc ) {
	    usage();
	    return 0;
	}
    }
#endif
    // default size of the window
    int width = 600;
    int height = 450;
    const int menuHeight = 30;
    const int toolbarHeight = 27;
    const int toolHeight = 25;
    const string paramXML( IS::readStringInFile(paramFile) );
    if ( !paramXML.empty() ) {
	if ( !IS::ToXML::extractFirst( paramXML, "parameters" ).empty() ) {
	    width = atoi( IS::ToXML::extractFirst( paramXML, "frameWidth" ).c_str() );
	    height = atoi( IS::ToXML::extractFirst( paramXML, "frameHeight" ).c_str() );
	} else {
	    cerr << _("Failed to open: ") << paramFile << '\n';
	}
    }
    Fl_Window window( width, height + menuHeight + toolbarHeight );
    // if the window is closed, the application exits:
    window.callback(quit_cb);
    Fl_Menu_Bar menubar( 0, 0, width, menuHeight );
    menubar.box(FL_PLASTIC_UP_BOX);
    // in the main to allow gettext to do its job.
#ifdef WIN32
    manualFile = "";
#else
    manualFile = DOCDIR;
#endif
    manualFile += _("manual_en.html");
    static Fl_Menu_Item menutable[] = {
    {_("&File"),            0, 0, 0, FL_SUBMENU}, //0
    {_("&Open"),            FL_CTRL+'O', skeleton_open_cb},
    {_("&Save"),            FL_CTRL+'S', skeleton_save_cb},
    {_("&Export to Fractint"), 0, export_fractint_cb, 0, FL_MENU_DIVIDER},
#ifdef HAVE_LIBPNG
    {_("Set Fast Save Directory"), 0, set_snapshotPath_cb},
    {_("Fast Save"),        'f', saveSnapshot_cb, NULL, FL_MENU_DIVIDER},
    {_("Save PNG"),         0, saveImage_cb, (void*)Image::PNG},
#endif
    {_("Save PGM"),         0, saveImage_cb, (void*)Image::PGM},
    {_("Save BMP bitmap"),  0, saveImage_cb, (void*)Image::BMPB},
    {_("Save BMP gray"),    0, saveImage_cb, (void*)Image::BMPG, FL_MENU_DIVIDER},
    {_("Edit &Paramaters"), 'p', parameters_cb},
    {_("Open Paramaters"),  0, open_parameters_cb},
    {_("Sa&ve parameters"), 0, save_parameters_cb, 0, FL_MENU_DIVIDER},
    {_("&Quit"),	    FL_CTRL+'Q', quit_cb}, //10
    {0},
    {_("&Skeleton"),      0, 0, 0, FL_SUBMENU},
    {_("&New"),           FL_CTRL+'N', skeleton_new_cb},
    {_("&Random"),        'h', skeleton_random_cb, 0, FL_MENU_DIVIDER},
    {_("&Dimension"),     FL_CTRL+'D', skeleton_dimension_cb},
    {_("&Coordinates"),   0, skeleton_coordinates_cb, 0, FL_MENU_DIVIDER},
    {_("out Memory1"),    '1', outMemory_cb, (void*)1},
    {_("out Memory2"),    '2', outMemory_cb, (void*)2},
    {_("out Memory3"),    '3', outMemory_cb, (void*)3},
    {_("out Memory4"),    '4', outMemory_cb, (void*)4, FL_MENU_DIVIDER},//20
    {_("in Memory1"),     '5', inMemory_cb, (void*)1},
    {_("in Memory2"),     '6', inMemory_cb, (void*)2},
    {_("in Memory3"),     '7', inMemory_cb, (void*)3},
    {_("in Memory4"),     '8', inMemory_cb, (void*)4},
    {0},
    {_("&Function"),      0, 0, 0, FL_SUBMENU},
    {_("Pre&vious"),      'v', function_previous_cb},
    {_("&Next"),          'n', function_next_cb, 0, FL_MENU_DIVIDER},
    {_("&Cut"),           FL_CTRL+'X', function_cut_cb},
    {_("C&opy"),          FL_CTRL+'C', function_copy_cb},
    {_("&Paste"),         FL_CTRL+'V', function_paste_cb, 0, FL_MENU_DIVIDER},
    {_("&Reshape"),       's', function_reshape_cb, 0, FL_MENU_DIVIDER}, //32
    // the following items are modified by Glito::setSystemType()
    {_("&Linear"),        0, systemType_cb, (void *)LINEAR,     FL_MENU_RADIO|FL_MENU_VALUE}, //33
    {_("&Sinusoidal"),    0, systemType_cb, (void *)SINUSOIDAL, FL_MENU_RADIO}, //34
    {_("&Julia"),         0, systemType_cb, (void *)JULIA,      FL_MENU_RADIO}, //35
    {_("&Formulas"),      0, systemType_cb, (void *)FORMULA,    FL_MENU_RADIO|FL_MENU_DIVIDER}, //36
    {_("&Edit Formulas"), 0, edit_formula_cb},
    {0},
    {_("&Color"),         0, 0, 0, FL_SUBMENU},
    {_("Open Color Map"), 0, readColorMap_cb},
    {_("Color / B&W"),    0, colorBW_cb, 0, FL_MENU_DIVIDER},
    {_("Maps:")},
    {_("Autumn"),         0, readDefinedMap_cb, (void*)0},
    {_("Fast"),           0, readDefinedMap_cb, (void*)-1},
    {_("CMY"),            0, readDefinedMap_cb, (void*)1},
    {_("RGB"),            0, readDefinedMap_cb, (void*)2},
    {_("Light CMY"),      0, readDefinedMap_cb, (void*)3},
    {_("Dark"),           0, readDefinedMap_cb, (void*)4},
    {_("Rich"),           0, readDefinedMap_cb, (void*)5},
    {0},
    {_("&Animation"),     0, 0, 0, FL_SUBMENU},
    {_("&Zoom"),                      'z', animation_zoom_cb},
    {_("&Transition: Mem1 <-> Mem2"), 't', animation_transition_cb},
    {_("&Rotation"),                  'r', animation_rotation_cb},
    {_("&Stop"),                      ' ', animation_stop_cb, 0, FL_MENU_DIVIDER},
#ifdef HAVE_LIBMNG
    {_("Save Zoom as MNG"),       0, saveAnimation_cb, (void*)0},
    {_("Save Transition as MNG"), 0, saveAnimation_cb, (void*)1},
    {_("Save Rotation as MNG"),   0, saveAnimation_cb, (void*)2},
#endif
    {0},
    {_("&Help"),          0, 0, 0, FL_SUBMENU},
    {_("Docu&mentation"), FL_F+1, documentation_cb},
    {_("&Demo"),          0, demo_cb},
    {_("&About"),         0, about_cb},
    {0},
    {0}
    };
    menubar.menu(menutable);

    // the shortcuts are handled by the menu everywhere:
    //menubar.global();
    glito = new Glito( 0, menuHeight + toolbarHeight, width, height );
    if ( !IS::ToXML::extractFirst( paramXML, "parameters" ).empty() ) {
	glito->readParameters( paramXML );
    }
    if ( !skeletonToOpen.empty() ) {
 	if ( !glito->skel.fromXML( IS::readStringInFile(skeletonToOpen) ) ) {
	    cerr << _("Failed to open: ") << skeletonToOpen << '\n';
	}
 	glito->setSystemType();
    }
    Fl::visual( FL_DOUBLE | FL_INDEX );
    // to allow the preview of PNG files in the file chooser:
    Fl_File_Icon::load_system_icons();
    // the size of glito is changed when the size of the window is changed:
    window.add_resizable(*glito);

    // ********* toolbar ***********
    {
        Fl_Group* o = new Fl_Group( 0, menuHeight, width, toolbarHeight );
	o->resizable(NULL); // not resizable
	int x = 0;
	const int toolSpace = 9;
	const int toolInter = 1;
	{
	    Fl_Button* o = new Fl_Button( x, menuHeight+1, toolHeight, toolHeight );
	    prepareButton(o);
	    o->tooltip( _("Open") );
	    o->image( icon_file_open );
	    o->callback( (Fl_Callback*)skeleton_open_cb );
	    x += toolHeight + toolInter;
	}
#ifdef HAVE_LIBPNG
	{
	    Fl_Button* o = new Fl_Button( x, menuHeight+1, toolHeight, toolHeight );
	    prepareButton(o);
	    o->tooltip( _("Save PNG") );
	    o->image( icon_save_file );
	    o->callback( (Fl_Callback*)saveImage_cb, (void*)Image::PNG );
	    x += toolHeight + toolInter;
	}
	{
	    Fl_Button* o = new Fl_Button( x, menuHeight+1, toolHeight, toolHeight );
	    prepareButton(o);
	    o->tooltip( _("Fast save") );
	    o->image( icon_save_fast );
	    o->callback( (Fl_Callback*)saveSnapshot_cb );
	    x += toolHeight + toolInter;
	}
#endif
	x += toolSpace;
	{
	    Fl_Button* o = new Fl_Button( x, menuHeight+1, toolHeight, toolHeight );
	    prepareButton(o);
	    o->tooltip( _("Parameters") );
	    o->image( icon_param );
	    o->callback( (Fl_Callback*)parameters_cb );
	    x += toolHeight + toolInter;
	}
	x += toolSpace;
	{
	    Fl_Button* o = new Fl_Button( x, menuHeight+1, toolHeight, toolHeight );
	    prepareButton(o);
	    o->tooltip( _("Color / B&W") );
	    o->image( icon_colorbw );
	    o->callback( (Fl_Callback*)colorBW_cb );
	    x += toolHeight + toolInter;
	}
	{
	    Fl_Button* o = new Fl_Button( x, menuHeight+1, toolHeight, toolHeight );
	    prepareButton(o);
	    o->tooltip( _("Open Color Map") );
	    o->image( icon_colormap );
	    o->callback( (Fl_Callback*)readColorMap_cb );
	    x += toolHeight + toolInter;
	}
	x += toolSpace;
	{
	    Fl_Button* o = new Fl_Button( x, menuHeight+1, toolHeight, toolHeight );
	    prepareButton(o);
	    o->tooltip( _("Random") );
	    o->image( icon_hazard );
	    o->callback( (Fl_Callback*)skeleton_random_cb );
	    x += toolHeight + toolInter;
	}
	x += toolSpace;
	{
	    Fl_Button* o = new Fl_Button( x, menuHeight+1, toolHeight, toolHeight );
	    prepareButton(o);
	    o->tooltip( _("Previous function") );
	    o->image( icon_previous );
	    o->callback( (Fl_Callback*)function_previous_cb );
	    x += toolHeight + toolInter;
	}
	{
	    Fl_Button* o = new Fl_Button( x, menuHeight+1, toolHeight, toolHeight );
	    prepareButton(o);
	    o->tooltip( _("Next function") );
	    o->image( icon_next );
	    o->callback( (Fl_Callback*)function_next_cb );
	    x += toolHeight + toolInter;
	}
	x += toolSpace;
	{
	    Fl_Button* o = new Fl_Button( x, menuHeight+1, toolHeight, toolHeight );
	    prepareButton(o);
	    o->tooltip( _("Enlarge") );
	    o->image( icon_larger );
	    o->callback( (Fl_Callback*)view_large_cb );
	    x += toolHeight + toolInter;
	}
       	x += toolSpace;
	{
	    Fl_Light_Button* o = new Fl_Light_Button( x, menuHeight+1, toolHeight+20, toolHeight );
	    prepareButton(o);
	    o->tooltip( _("Rot/Dil") );
	    o->image( icon_rotdil );
	    o->callback( (Fl_Callback*)mouse_cb );
	    x += toolHeight + toolInter;
	}
	o->end();
    }


    window.end();
    window.show(argc,argv);
    /*
    Pixmap p = XCreateBitmapFromData( fl_display, DefaultRootWindow(fl_display),
				      icon_bits, icon_width, icon_height );
    window.icon((char *)p);
    */
    glito->show();
    menubar.show();
    { // seed for the random generator:
	time_t t;
	time(&t); 
	srand( (unsigned int)t );
    }
    return Fl::run();
}
Example #13
0
void MainFrame::UpdateUI(wxCommandEvent& event)
{
	event.Skip();

	bool is_running, is_stopped, is_ready;

	if(event.GetEventType() == wxEVT_DBG_COMMAND)
	{
		switch(event.GetId())
		{
			case DID_START_EMU:
			case DID_STARTED_EMU:
				is_running = true;
				is_stopped = false;
				is_ready = false;
			break;

			case DID_STOP_EMU:
			case DID_STOPPED_EMU:
				is_running = false;
				is_stopped = true;
				is_ready = false;
				m_sys_menu_opened = false;
			break;

			case DID_PAUSE_EMU:
			case DID_PAUSED_EMU:
				is_running = false;
				is_stopped = false;
				is_ready = false;
			break;

			case DID_RESUME_EMU:
			case DID_RESUMED_EMU:
				is_running = true;
				is_stopped = false;
				is_ready = false;
			break;

			case DID_READY_EMU:
				is_running = false;
				is_stopped = false;
				is_ready = true;
			break;

			case DID_REGISTRED_CALLBACK:
				is_running = Emu.IsRunning();
				is_stopped = Emu.IsStopped();
				is_ready = Emu.IsReady();
			break;

			default:
				return;
		}
	}
	else
	{
		is_running = Emu.IsRunning();
		is_stopped = Emu.IsStopped();
		is_ready = Emu.IsReady();
	}

	wxMenuBar& menubar( *GetMenuBar() );
	wxMenuItem& pause = *menubar.FindItem( id_sys_pause );
	wxMenuItem& stop  = *menubar.FindItem( id_sys_stop );
	wxMenuItem& send_exit = *menubar.FindItem( id_sys_send_exit );
	wxMenuItem& send_open_menu = *menubar.FindItem( id_sys_send_open_menu );
	pause.SetItemLabel(is_running ? "Pause\tCtrl + P" : is_ready ? "Start\tCtrl + C" : "Resume\tCtrl + C");
	pause.Enable(!is_stopped);
	stop.Enable(!is_stopped);
	//send_exit.Enable(false);
	bool enable_commands = !is_stopped && Emu.GetCallbackManager().m_exit_callback.m_callbacks.size();

	send_open_menu.SetItemLabel(wxString::Format("Send %s system menu cmd", (m_sys_menu_opened ? "close" : "open")));
	send_open_menu.Enable(enable_commands);
	send_exit.Enable(enable_commands);

	//m_aui_mgr.Update();

	//wxCommandEvent refit( wxEVT_COMMAND_MENU_SELECTED, id_update_dbg );
	//GetEventHandler()->AddPendingEvent( refit );
}
Example #14
0
int main(int argc, char* argv[]) {

	// every ParaGUI application need an application-object
	PG_Application app(argv[0]);

	// let us escape with "ESC"
	app.SetEmergencyQuit(true);
	
	// every application needs a theme (the look & feel of the widgets)
	//app.LoadTheme("default");
	app.LoadTheme("simple");

	// we must initialize the screen where we want to draw on

	// 640 - screen width
	// 480 - screen height
	// 0 - use screen bitdepth
	// SDL_SWSURFACE - PG_ option to generate surface in system memory

	app.InitScreen(800, 600, 0, SDL_SWSURFACE);

	// ok - now we have a nice 640x480x16 window on the screen :)

	PG_Rect rect(0, 0, 80, 30);

	PG_Button myButton(
		NULL,		// an optional parent widget for our button - NULL for no parent
		rect,		// the screen position where the button should appear
		"Quit"		// some textlabel for the button
		);

	// this defines our callback handler for the message MSG_BUTTONCLICK,
	// we pass a pointer to the app object as userdata

	PG_MenuBar menubar(NULL, PG_Rect(100, 0, 400, 30));
	PG_PopupMenu   popmenu(NULL, 425, 140, "File");

	popmenu.addMenuItem("Nail", 99, SigC::slot(handle_menu_click)).
        addMenuItem("Quit", ID_APP_EXIT, SigC::slot(handle_menu_click), &app);
 
	menubar.Add("File", &popmenu);

	menubar.Show();

	myButton.sigClick.connect( SigC::slot(exit_handler), (PG_Pointer)&app);

	// now we have to make the button visible

	myButton.Show();

	// Every ParaGUI application is event driven, so we need a loop where
	// we process all events (like mouse handling, keystrokes,...)

	// usually this is done with PG_Application::Run()

	PG_Rect sc_rect(50, 50, 100, 300);
	PG_ScrollBar myscroll(NULL, sc_rect, PG_ScrollBar::VERTICAL);
	myscroll.Show();

	PG_Rect sc_rect2(200, 200, 300, 100);
	PG_ScrollBar myscroll2(NULL, sc_rect2, PG_ScrollBar::HORIZONTAL);

	myscroll2.SetRange(0, 100);
	myscroll2.SetPageSize(10);
	myscroll2.SetLineSize(5);

	myscroll2.Show();

	// Attempt to get animation
	PlayField anim_test(
		// still no parent widget
		NULL,
		// a static function to create rects
		PG_Rect(260,120,120,50)
		);

	anim_test.AddTimer(400);
	anim_test.Show();

    PlayField2 anim_test2(
	  NULL,
	  PG_Rect(260, 300, 120, 100)
	  );
	  
	anim_test2.AddTimer(40);
	anim_test2.AddTimer(20);
	anim_test2.Show();

	app.Run();

	// this function will only exit when the application was closed

	return 0;
}
Example #15
0
MainFrame::MainFrame()
	: FrameBase(nullptr, wxID_ANY, "", "MainFrame", wxSize(800, 600))
	, m_aui_mgr(this)
	, m_sys_menu_opened(false)
{

#ifdef _DEBUG
	SetLabel(wxString::Format(_PRGNAME_ " git-" RPCS3_GIT_VERSION));
#else
	SetLabel(wxString::Format(_PRGNAME_ " " _PRGVER_));
#endif

	wxMenuBar& menubar(*new wxMenuBar());

	wxMenu& menu_boot(*new wxMenu());
	menubar.Append(&menu_boot, "Boot");
	menu_boot.Append(id_boot_game, "Boot game");
	menu_boot.Append(id_install_pkg, "Install PKG");
	menu_boot.AppendSeparator();
	menu_boot.Append(id_boot_elf, "Boot (S)ELF");

	wxMenu& menu_sys(*new wxMenu());
	menubar.Append(&menu_sys, "System");
	menu_sys.Append(id_sys_pause, "Pause")->Enable(false);
	menu_sys.Append(id_sys_stop, "Stop\tCtrl + S")->Enable(false);
	menu_sys.AppendSeparator();
	menu_sys.Append(id_sys_send_open_menu, "Send open system menu cmd")->Enable(false);
	menu_sys.Append(id_sys_send_exit, "Send exit cmd")->Enable(false);

	wxMenu& menu_conf(*new wxMenu());
	menubar.Append(&menu_conf, "Config");
	menu_conf.Append(id_config_emu, "Settings");
	menu_conf.Append(id_config_pad, "PAD Settings");
	menu_conf.AppendSeparator();
	menu_conf.Append(id_config_vfs_manager, "Virtual File System Manager");
	menu_conf.Append(id_config_vhdd_manager, "Virtual HDD Manager");

	wxMenu& menu_tools(*new wxMenu());
	menubar.Append(&menu_tools, "Tools");
	menu_tools.Append(id_tools_compiler, "ELF Compiler");
	menu_tools.Append(id_tools_memory_viewer, "Memory Viewer");
	menu_tools.Append(id_tools_rsx_debugger, "RSX Debugger");

	wxMenu& menu_help(*new wxMenu());
	menubar.Append(&menu_help, "Help");
	menu_help.Append(id_help_about, "About...");

	SetMenuBar(&menubar);

	// Panels
	m_game_viewer = new GameViewer(this);
	m_debugger_frame = new DebuggerPanel(this);
	ConLogFrame = new LogFrame(this);

	AddPane(m_game_viewer, "Game List", wxAUI_DOCK_BOTTOM);
	AddPane(ConLogFrame, "Log", wxAUI_DOCK_BOTTOM);
	AddPane(m_debugger_frame, "Debugger", wxAUI_DOCK_RIGHT);
	
	// Events
	Connect( id_boot_game,			 wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainFrame::BootGame) );
	Connect( id_install_pkg,		 wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainFrame::InstallPkg) );
	Connect( id_boot_elf,			 wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainFrame::BootElf) );

	Connect( id_sys_pause,           wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainFrame::Pause) );
	Connect( id_sys_stop,            wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainFrame::Stop) );
	Connect( id_sys_send_open_menu,	 wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainFrame::SendOpenCloseSysMenu) );
	Connect( id_sys_send_exit,       wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainFrame::SendExit) );

	Connect( id_config_emu,          wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainFrame::Config) );
	Connect( id_config_pad,          wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainFrame::ConfigPad) );
	Connect( id_config_vfs_manager,  wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainFrame::ConfigVFS) );
	Connect( id_config_vhdd_manager, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainFrame::ConfigVHDD) );

	Connect( id_tools_compiler,		 wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainFrame::OpenELFCompiler));
	Connect( id_tools_memory_viewer, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainFrame::OpenMemoryViewer));
	Connect( id_tools_rsx_debugger,  wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainFrame::OpenRSXDebugger));

	Connect( id_help_about,          wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainFrame::AboutDialogHandler) );

	Connect( id_update_dbg,          wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainFrame::UpdateUI) );

	m_app_connector.Connect(wxEVT_KEY_DOWN, wxKeyEventHandler(MainFrame::OnKeyDown), (wxObject*)0, this);
	m_app_connector.Connect(wxEVT_DBG_COMMAND, wxCommandEventHandler(MainFrame::UpdateUI), (wxObject*)0, this);
}
Example #16
0
//---------------------------------------------------------------
void wait_mouse()
{
   // quit via menu
   if(code==44)
   {
      if(o.x.cx>=215 && o.x.dx>=260 && o.x.cx<=285 && o.x.dx<=280)
      {
	frame(215,260,285,280,DARKGRAY,LIGHTGRAY,WHITE);
	outtextxy(240,265,"YES");delay(200);
	closegraph();exit(0);
      }

      if(o.x.cx>=328 && o.x.dx>=260 && o.x.cx<=403 && o.x.dx<=280)
      {
	frame(328,260,403,280,DARKGRAY,LIGHTGRAY,WHITE);
	outtextxy(357,265,"NO");delay(200);
	code = 0;
	Message_Box();
      }
      return;
   }

   // quit via corner button
   if(o.x.cx>=613 && o.x.dx>=7 && o.x.cx<=638 && o.x.dx<=27)
   {
      code = 44; // quit
      fill_maze();
      frame(190,180,430,300,LIGHTBLUE,LIGHTBLUE,WHITE);
      frame(193,183,427,297,LIGHTBLUE,LIGHTBLUE,WHITE);
      frame(196,186,424,200,BLUE,BLUE,BLUE);
      settextstyle(0,0,1);
      setcolor(WHITE);
      outtextxy(280,190,"MESSAGE");
      setcolor(BLACK);
      outtextxy(203,216,"DO YOU REALLY WANT TO ");
      outtextxy(203,231,"EXIT ?");

      frame(215,260,285,280,LIGHTGRAY,DARKGRAY,WHITE);
      frame(328,260,403,280,LIGHTGRAY,DARKGRAY,WHITE);
      outtextxy(240,265,"YES");
      outtextxy(357,265,"NO");
      frame(5,31,260,90,BLUE,BLUE,BLUE);
      menubar();
      return;
   }
   ///////////////////////////////////////////
   if(code == 47) // load a game from file
   {
      if(o.x.cx>=215 && o.x.dx>=260 && o.x.cx<=285 && o.x.dx<=280)
      {
	frame(215,260,285,280,DARKGRAY,LIGHTGRAY,WHITE);
	outtextxy(235,265,"OPEN");
	delay(200);
	load();
	Message_Box();
	frame(5,31,260,90,BLUE,BLUE,BLUE);
	code = 0;
	fill_maze();

	while(o.x.cx>=45 && o.x.dx>=31 && o.x.cx<=105 && o.x.dx<=70)
	{
	 frame(45,31,105,70,BLUE,BLUE,BLUE);
	 showmouse();getmousepos();
	}
	menubar();
      }
      //--------------------------------------------------------
      if(o.x.cx>=328 && o.x.dx>=260 && o.x.cx<=403 && o.x.dx<=280)
      {
	frame(328,260,403,280,DARKGRAY,LIGHTGRAY,WHITE);
	outtextxy(343,265,"CANCEL");delay(200);
	code = 0;
	Message_Box();
	frame(5,31,260,90,BLUE,BLUE,BLUE);
	menubar();
      }
      return;
   }
  ///////////////////////////////////////////
   if(code == 48) // save a game to file
   {
      if(o.x.cx>=215 && o.x.dx>=260 && o.x.cx<=285 && o.x.dx<=280)
      {
	frame(215,260,285,280,DARKGRAY,LIGHTGRAY,WHITE);
	outtextxy(245,265,"OK");
	delay(200);
	save();
	code = 0;
	Message_Box();
	frame(5,31,260,90,BLUE,BLUE,BLUE);
	menubar();
	fill_maze();

	while(o.x.cx>=45 && o.x.dx>=31 && o.x.cx<=105 && o.x.dx<=70)
	{
	 frame(45,31,105,70,BLUE,BLUE,BLUE);
	 showmouse();getmousepos();
	}
	menubar();

      }
     //--------------------------------------------------------
      if(o.x.cx>=328 && o.x.dx>=260 && o.x.cx<=403 && o.x.dx<=280)
      {
	frame(328,260,403,280,DARKGRAY,LIGHTGRAY,WHITE);
	outtextxy(343,265,"CANCEL");
	delay(200);
	code = 0;
	Message_Box();
	frame(5,31,260,90,BLUE,BLUE,BLUE);
	menubar();
      }
      return;
   }
   ///////////////////////////////////////////
   //////////////////////////////////////////
   if(code == 42) // resign
   {
      if(o.x.cx>=215 && o.x.dx>=260 && o.x.cx<=285 && o.x.dx<=280)
      {
	frame(215,260,285,280,DARKGRAY,LIGHTGRAY,WHITE);
	outtextxy(240,265,"YES");
	delay(200);
	Message_Box();
	frame(5,31,260,90,BLUE,BLUE,BLUE);
	menubar();

	for(int i=0;i<9;i++)
	  for(int j=0;j<9;j++)
	   {
	      arr[i][j] = puzz[i][j];
	   }

	Message_Box();

	for( i=0;i<9;i++)
	  for( j=0;j<9;j++)
	   {
	     arr[i][j] = stat[i][j] = puzz[i][j] = hnt[i][j] = 0;
	   }

	code = 0;
	puz_typ = 0;
	frame(5,31,260,90,BLUE,BLUE,BLUE);
	frame(45,31,105,70,BLUE,BLUE,BLUE);
	menubar();
	return;
      }
    //-------------------------------------------------------------
      if(o.x.cx>=328 && o.x.dx>=260 && o.x.cx<=403 && o.x.dx<=280)
      {
       frame(328,260,403,280,DARKGRAY,LIGHTGRAY,WHITE);
       outtextxy(357,265,"NO");
       delay(200);
       code = 0;
       Message_Box();
       frame(5,31,260,90,BLUE,BLUE,BLUE);
       menubar();
      }
      return;
   }

   if(menu_bar_effect())
   { return; }

   if( o.x.cx>=127 && o.x.dx>=27 && o.x.cx<=191 && o.x.dx<=85
      && men_stat == 4 && puz_typ != 0)
     {
	men_stat = 0;

	if( o.x.dx<=42   )
	{
	    if(code != 41)  // pause
	    { code = 41;fill_maze(); }

	    else if(code == 41)    // resume
	    {
	       code = 0; fill_maze();
	       while(o.x.cx>=127 && o.x.dx>=27 && o.x.cx<=191 && o.x.dx<=72)
	       {
		  frame(5,31,260,90,BLUE,BLUE,BLUE);
		  showmouse();
		  getmousepos();
	       }
	       menubar();
	       return;
	     }
	}

	else if( o.x.dx<=55 )   //   Resign();
	{
	    if(code != 41)  // not pause
	    {
	       code = 42;
	       fill_maze();
	       frame(190,180,430,300,LIGHTBLUE,LIGHTBLUE,WHITE);
	       frame(193,183,427,297,LIGHTBLUE,LIGHTBLUE,WHITE);
	       frame(196,186,424,200,BLUE,BLUE,BLUE);
	       setcolor(WHITE);
	       settextstyle(0,0,1);
	       outtextxy(280,190,"MESSAGE");
	       setcolor(BLACK);
	       outtextxy(203,216,"DO YOU REALLY WANT TO ");
	       outtextxy(203,231,"RESIGN ?");

	       frame(215,260,285,280,LIGHTGRAY,DARKGRAY,WHITE);
	       frame(328,260,403,280,LIGHTGRAY,DARKGRAY,WHITE);
	       outtextxy(240,265,"YES");
	       outtextxy(357,265,"NO");
	    }
	}

	else if( o.x.dx<=72 )  //   Hint
	{
	  if(code != 41)
	  {
	  char *an;
	  int i,j,curr,flag=1;
	  settextstyle(6,0,4);

	  for(i=0;i<9;i++)
	    for(j=0;j<9;j++)
	      if(arr[i][j] != puzz[i][j])
		 { flag = 0; break; }

	  if(flag == 0 && cnt != 81)
	  {
	   while(1)
	   {
	    i =  abs(rand() % 9),j =  abs(rand() % 9);
	    if(stat[i][j]==0 && (arr[i][j]==0 || arr[i][j]!=puzz[i][j] ))
	       break;
	   }

	   curr = puzz[i][j];
	   stat[i][j] = arr[i][j] = hnt[i][j] = curr;
	   cnt++;

	   switch(curr)
	   {
	     case 1:   an="1";  break;
	     case 2:   an="2";  break;
	     case 3:   an="3";  break;
	     case 4:   an="4";  break;
	     case 5:   an="5";  break;
	     case 6:   an="6";  break;
	     case 7:   an="7";  break;
	     case 8:   an="8";  break;
	     case 9:   an="9";  break;
	     case 10:  an=" ";  break;
	   }

	  int l=((i*40)+150);
	  int t=((j*40)+100);

	  setcolor(BLACK);
	  for(int k=l+4;k<l+40-4;k++)
	     line(k,t+4,k,t+40-4);

	  setcolor(YELLOW);
	  outtextxy((i*40)+165 ,(j*40)+95 ,an);
	}}}

	else if( o.x.dx<=85 )  //   Submit
	{
	  Usr_Submit();
	}

	while(o.x.cx>=127 && o.x.dx>=27 && o.x.cx<=191 && o.x.dx<=72)
	{   frame(5,31,260,90,BLUE,BLUE,BLUE);
	    showmouse();  getmousepos();    }

	menubar();
	return;
     }
///////////////////////////////////////////////////////////////////////////
   if( o.x.cx>=86 && o.x.dx>=27 && o.x.cx<=130 && o.x.dx<=60
      && men_stat == 3 && puz_typ != 0)                     // reset
     {
	men_stat = 0;

	if(o.x.dx<=42)    // reset
	{
	  for(int i=0; i<9 ; i++)
	    for(int j=0; j<9 ; j++)
	    {
	       if( stat[i][j] == 0 && arr[i][j] != 0 )
	       {
		   arr[i][j] = 0;
	       }
	    }
	    code = 41;fill_maze();
	    code = 0;fill_maze();
	}

	else if( o.x.dx<=55 )   //   Timer
	{

	}

	while(o.x.cx>=86 && o.x.dx>=27 && o.x.cx<=130 && o.x.dx<=72)
	{   frame(5,31,260,90,BLUE,BLUE,BLUE);
	    showmouse();  getmousepos();    }

	menubar();
	return;
     }
//////////////////////////////////////////////////////////////////////////
   else if( o.x.cx>=5 && o.x.dx>=27 && o.x.cx<=66 && o.x.dx<=70 && men_stat == 1)
   {
      men_stat = 0;
      if( o.x.dx<=42 )  // save game to a file
       {
	  if( puz_typ <= 0)
	  {
	  fill_maze();
	  frame(190,180,430,300,LIGHTBLUE,LIGHTBLUE,WHITE);
	  frame(193,183,427,297,LIGHTBLUE,LIGHTBLUE,WHITE);
	  frame(196,186,424,200,BLUE,BLUE,BLUE);
	  setcolor(WHITE);
	  settextstyle(0,0,1);
	  outtextxy(270,190,"SAVE GAME");
	  setcolor(BLACK);
	  outtextxy(230,231," NO GAME TO SAVE");
	  delay(900);
	  Message_Box();
	  }

	  else
	  {
	  code = 48;
	  File_name[0] = '\0';
	  nam_siz = 0;
	  fill_maze();
	  frame(190,180,430,300,LIGHTBLUE,LIGHTBLUE,WHITE);
	  frame(193,183,427,297,LIGHTBLUE,LIGHTBLUE,WHITE);
	  frame(196,186,424,200,BLUE,BLUE,BLUE);
	  setcolor(WHITE);
	  settextstyle(0,0,1);
	  outtextxy(270,190,"SAVE GAME");
	  setcolor(BLACK);
	  outtextxy(203,211,"ENTER THE FILE NAME :  ");
	  frame(207,225,410,245,LIGHTGRAY,LIGHTGRAY,BLACK);
	  frame(215,260,285,280,LIGHTGRAY,DARKGRAY,WHITE);
	  frame(328,260,403,280,LIGHTGRAY,DARKGRAY,WHITE);
	  outtextxy(245,265,"OK");
	  outtextxy(343,265,"CANCEL");
	  }
       }

      else if( o.x.dx>=42 && o.x.dx<=55 )    // load
       {
	  code = 47; // load
	  File_name[0] = '\0';
	  nam_siz = 0;
	  fill_maze();
	  frame(190,180,430,300,LIGHTBLUE,LIGHTBLUE,WHITE);
	  frame(193,183,427,297,LIGHTBLUE,LIGHTBLUE,WHITE);
	  frame(196,186,424,200,BLUE,BLUE,BLUE);
	  setcolor(WHITE);
	  settextstyle(0,0,1);
	  outtextxy(260,190,"OPEN A FILE");
	  setcolor(BLACK);
	  outtextxy(203,211,"ENTER THE FILE NAME :  ");
	  frame(207,225,410,245,LIGHTGRAY,LIGHTGRAY,BLACK);
	  frame(215,260,285,280,LIGHTGRAY,DARKGRAY,WHITE);
	  frame(328,260,403,280,LIGHTGRAY,DARKGRAY,WHITE);
	  outtextxy(235,265,"OPEN");
	  outtextxy(343,265,"CANCEL");
      }

      else if( o.x.dx<=72 )
       {
	   code = 44; // quit
	   fill_maze();
	   frame(190,180,430,300,LIGHTBLUE,LIGHTBLUE,WHITE);
	   frame(193,183,427,297,LIGHTBLUE,LIGHTBLUE,WHITE);
	   frame(196,186,424,200,BLUE,BLUE,BLUE);
	   setcolor(WHITE);
	   settextstyle(0,0,1);
	   outtextxy(280,190,"MESSAGE");
	   setcolor(BLACK);
	   outtextxy(203,216,"DO YOU REALLY WANT TO ");
	   outtextxy(203,231,"EXIT ?");

	   frame(215,260,285,280,LIGHTGRAY,DARKGRAY,WHITE);
	   frame(328,260,403,280,LIGHTGRAY,DARKGRAY,WHITE);
	   outtextxy(240,265,"YES");
	   outtextxy(357,265,"NO");
       }
   }

   // new puzzle :-
   else if( o.x.cx>=45 && o.x.dx>=31 && o.x.cx<=105 && o.x.dx<=70 && men_stat == 2)
   {
      men_stat = 0;

      for(int i=0;i<9;i++)
	for(int j=0;j<9;j++)
	     arr[i][j] = stat[i][j] = puzz[i][j] = hnt[i][j] = 0;

      cnt = 0;
      Message_Box();    // clears the board
      if( o.x.dx<=42 )	   puz_typ = 1;    // EASY
      else if(o.x.dx<=55)  puz_typ = 2;    // MEDIUM
      else if(o.x.dx<=72)  puz_typ = 3;    // HARD

      generate_puzzle(puz_typ);
      fill_maze();

      while(o.x.cx>=45 && o.x.dx>=31 && o.x.cx<=105 && o.x.dx<=70)
      {
	 frame(45,31,105,70,BLUE,BLUE,BLUE);
	 showmouse();getmousepos();
      }
      menubar();
      return;
   }

      // help
   else if( o.x.cx>=175 && o.x.dx>=31 && o.x.cx<=250 && o.x.dx<=60 && men_stat == 5)
     {
      men_stat = 0;
      if( o.x.dx<=42 )  // about
       {
	 fill_maze();
	 frame(190,180,430,300,LIGHTBLUE,LIGHTBLUE,WHITE);
	 frame(193,183,427,297,LIGHTBLUE,LIGHTBLUE,WHITE);
	 frame(196,186,424,200,BLUE,BLUE,BLUE);
	 setcolor(WHITE);
	 settextstyle(0,0,1);
	 outtextxy(280,190,"ABOUT");
	 setcolor(BLACK);
	 outtextxy(203,211,"Puzzle Sudoku ver. 1.3");
	 outtextxy(203,235,"For more details contact");
	 outtextxy(203,256," [email protected] ");
	 delay(3000);
       }

      else if( o.x.dx<=55 )  // credit
       {
	 fill_maze();
	 frame(190,180,430,300,LIGHTBLUE,LIGHTBLUE,WHITE);
	 frame(193,183,427,297,LIGHTBLUE,LIGHTBLUE,WHITE);
	 frame(196,186,424,200,BLUE,BLUE,BLUE);
	 setcolor(WHITE);
	 settextstyle(0,0,1);
	 outtextxy(270,190,"CREDITS");
	 setcolor(BLACK);
	 outtextxy(203,211," Made by :  ");
	 outtextxy(203,225,"   Tejas. A. Patil  ");
	 outtextxy(203,236,"   SE I.T MIT , Pune  ");
	 outtextxy(203,249,"I am thankful to my   ");
	 outtextxy(203,260,"Parents , Teachers and");
	 outtextxy(203,271,"Friends for their support");
	 outtextxy(203,282," and help.");
	 delay(3000);
       }
	 Message_Box();
	frame(5,31,260,90,BLUE,BLUE,BLUE);
	frame(45,31,105,70,BLUE,BLUE,BLUE);
	menubar();
   }

      // board
   if(o.x.cx>=150 && o.x.dx>=100 && o.x.cx<=510 && o.x.dx<=460)
   {
     int  xr = (o.x.cx-150)/40,
	  yr = (o.x.dx-100)/40;

     if(code > 40 ) return;
     if(puz_typ == 0 ) return;
     if(curr != 10 && arr[xr][yr] != 0)
	     Number_Pad(arr[xr][yr]-1);

     if(stat[xr][yr] != 0 ) return;
     if(cnt == 81 && curr != 10)    return;

     else
     {
	char *an;
	settextstyle(6,0,4);
	setcolor(LIGHTCYAN);
	switch(curr)
	{
	   case 1:   an="1"; break;
	   case 2:   an="2"; break;
	   case 3:   an="3"; break;
	   case 4:   an="4"; break;
	   case 5:   an="5"; break;
	   case 6:   an="6"; break;
	   case 7:   an="7"; break;
	   case 8:   an="8"; break;
	   case 9:   an="9"; break;
	   case 10:  an=" "; break;
       }

    do
    {
       if(curr != 10  &&  arr[xr][yr] == 0 && cnt != 81)
       { outtextxy((xr*40)+165, (yr*40)+95, an); }

       else if (curr == 10)
       {
	   int l=((xr*40)+150);
	   int t=((yr*40)+100);

	   setcolor(BLACK);
	   for(int k=l+4;k<l+40-4;k++)
	      line(k,t+4,k,t+40-4);

	   setcolor(WHITE);
       }
	   restrictmouse();
	   showmouse();
	   getmousepos();
    }
	while(o.x.cx>=((xr*40)+150) &&  o.x.dx>=((yr*40)+100) &&
	      o.x.cx<=((xr*40)+190) &&  o.x.dx<=((yr*40)+140)  );

       if(curr != 10  &&  arr[xr][yr] == 0 && cnt != 81)
	  cnt++;

       else if(curr == 10 && arr[xr][yr] != 0)  cnt--;

       arr[xr][yr] = (curr%10);
    }
  }

   if(o.x.cx>=40 && o.x.dx>=130 && o.x.cx<=70 && o.x.dx<=430 && code < 40
      && puz_typ != 0)
   {
      int p = (o.x.dx-130)/30;
      Number_Pad(p);
   }


   if(men_stat != 0)
   {
      men_stat = 0;
      frame(5,31,260,90,BLUE,BLUE,BLUE);
      menubar();
   }
}
Example #17
0
void MainFrame::UpdateUI(wxCommandEvent& event)
{
	event.Skip();

	bool is_running, is_stopped, is_ready;

	if(event.GetEventType() == wxEVT_DBG_COMMAND)
	{
		switch(event.GetId())
		{
			case DID_START_EMU:
			case DID_STARTED_EMU:
				is_running = true;
				is_stopped = false;
				is_ready = false;
			break;

			case DID_STOP_EMU:
			case DID_STOPPED_EMU:
				is_running = false;
				is_stopped = true;
				is_ready = false;
				m_sys_menu_opened = false;
			break;

			case DID_PAUSE_EMU:
			case DID_PAUSED_EMU:
				is_running = false;
				is_stopped = false;
				is_ready = false;
			break;

			case DID_RESUME_EMU:
			case DID_RESUMED_EMU:
				is_running = true;
				is_stopped = false;
				is_ready = false;
			break;

			case DID_READY_EMU:
				is_running = false;
				is_stopped = false;
				is_ready = true;
			break;

			case DID_REGISTRED_CALLBACK:
				is_running = Emu.IsRunning();
				is_stopped = Emu.IsStopped();
				is_ready = Emu.IsReady();
			break;

			default:
				return;
		}
	}
	else
	{
		is_running = Emu.IsRunning();
		is_stopped = Emu.IsStopped();
		is_ready = Emu.IsReady();
	}

	// Update menu items based on the state of the emulator
	wxMenuBar& menubar( *GetMenuBar() );

	// Emulation
	wxMenuItem& pause = *menubar.FindItem(id_sys_pause);
	wxMenuItem& stop  = *menubar.FindItem(id_sys_stop);
	pause.SetItemLabel(is_running ? "&Pause\tCtrl + P" : is_ready ? "&Start\tCtrl + E" : "&Resume\tCtrl + E");
	pause.Enable(!is_stopped);
	stop.Enable(!is_stopped);

	// PS3 Commands
	wxMenuItem& send_exit = *menubar.FindItem(id_sys_send_exit);
	wxMenuItem& send_open_menu = *menubar.FindItem(id_sys_send_open_menu);
	bool enable_commands = !is_stopped;
	send_open_menu.SetItemLabel(wxString::Format("Send &%s system menu cmd", (m_sys_menu_opened ? "close" : "open")));
	send_open_menu.Enable(enable_commands);
	send_exit.Enable(enable_commands);

	// Tools
	wxMenuItem& kernel_explorer = *menubar.FindItem(id_tools_kernel_explorer);
	wxMenuItem& memory_viewer = *menubar.FindItem(id_tools_memory_viewer);
	wxMenuItem& rsx_debugger = *menubar.FindItem(id_tools_rsx_debugger);
	wxMenuItem& string_search = *menubar.FindItem(id_tools_string_search);
	kernel_explorer.Enable(!is_stopped);
	memory_viewer.Enable(!is_stopped);
	rsx_debugger.Enable(!is_stopped);
	string_search.Enable(!is_stopped);
}
Example #18
0
void ZLApplication::createMenubar() {
	menubar();
	ZLMenubarCreator(*myMenubar).readDocument(ZLFile(ZLibrary::DefaultFilesPathPrefix() + "menubar.xml"));
}