Example #1
0
GSFrame::GSFrame(wxWindow* parent, const wxString& title)
	: wxFrame(parent, wxID_ANY, title, g_Conf->GSWindow.WindowPos)
	, m_timer_UpdateTitle( this )
{
	SetIcons( wxGetApp().GetIconBundle() );
	SetBackgroundColour( *wxBLACK );

	wxStaticText* label = new wxStaticText( this, wxID_ANY, _("GS Output is Disabled!") );
	m_id_OutputDisabled = label->GetId();
	label->SetFont( wxFont( 20, wxDEFAULT, wxNORMAL, wxBOLD ) );
	label->SetForegroundColour( *wxWHITE );

	AppStatusEvent_OnSettingsApplied();

	GSPanel* gsPanel = new GSPanel( this );
	gsPanel->Show( !EmuConfig.GS.DisableOutput );
	m_id_gspanel = gsPanel->GetId();

	// TODO -- Implement this GS window status window!  Whee.
	// (main concern is retaining proper client window sizes when closing/re-opening the window).
	//m_statusbar = CreateStatusBar( 2 );

	Connect( wxEVT_CLOSE_WINDOW,	wxCloseEventHandler		(GSFrame::OnCloseWindow) );
	Connect( wxEVT_MOVE,			wxMoveEventHandler		(GSFrame::OnMove) );
	Connect( wxEVT_SIZE,			wxSizeEventHandler		(GSFrame::OnResize) );
	Connect( wxEVT_ACTIVATE,		wxActivateEventHandler	(GSFrame::OnActivate) );

	Connect(m_timer_UpdateTitle.GetId(), wxEVT_TIMER, wxTimerEventHandler(GSFrame::OnUpdateTitle) );
}
void WindowPosition::disconnect(wxTopLevelWindow* window)
{
	_window = nullptr;

	window->Disconnect(wxEVT_SIZE, wxSizeEventHandler(WindowPosition::onResize), nullptr, this);
	window->Disconnect(wxEVT_MOVE, wxMoveEventHandler(WindowPosition::onMove), nullptr, this);
}
CWindowStateManager::CWindowStateManager(wxTopLevelWindow* pWindow)
{
	m_pWindow = pWindow;

	m_lastMaximized = false;

	m_pWindow->Connect(wxID_ANY, wxEVT_SIZE, wxSizeEventHandler(CWindowStateManager::OnSize), 0, this);
	m_pWindow->Connect(wxID_ANY, wxEVT_MOVE, wxMoveEventHandler(CWindowStateManager::OnMove), 0, this);
}
Example #4
0
MyButton::MyButton(const wxString& title) 
	:wxFrame(NULL, -1, title, wxDefaultPosition, wxSize(270, 150))
{
	wxPanel* panel = new wxPanel(this, -1);

	st1 = new wxStaticText(panel, -1, wxT(""), wxPoint(10, 10));
	st2 = new wxStaticText(panel, -1, wxT(""), wxPoint(10, 30));
	wxButton* button = new wxButton(panel, wxID_EXIT, wxT("Quit"), wxPoint(50, 20));

	Connect(wxEVT_MOVE, wxMoveEventHandler(MyButton::OnMove));

	Centre();
}
// Connect the passed window to this object
void WindowPosition::connect(wxTopLevelWindow* window)
{
	if (_window != nullptr)
	{
		disconnect(_window);
	}

	_window = window;
	applyPosition();

	window->Connect(wxEVT_SIZE, wxSizeEventHandler(WindowPosition::onResize), nullptr, this);
	window->Connect(wxEVT_MOVE, wxMoveEventHandler(WindowPosition::onMove), nullptr, this);
}
GNC::GUI::StatusBarProgreso::~StatusBarProgreso()
{
        m_pMensajeTarea->Disconnect(wxEVT_LEFT_DOWN, wxMouseEventHandler( StatusBarProgreso::OnMostrarOcultarDialogoProgreso),NULL,this);

        this->Disconnect(wxEVT_IDLE, wxIdleEventHandler(StatusBarProgreso::OnIdle), NULL, this);
        this->Disconnect(wxEVT_MENSAJES_USUARIO_ASYNC, EventoMensajesUsuarioAsyncHandler(StatusBarProgreso::OnMensajeUsuario), NULL, this);
        this->GetParent()->Disconnect(wxEVT_MOVE,wxMoveEventHandler(StatusBarProgreso::OnMove),NULL,this);
        this->Disconnect(wxEVT_SIZE,wxSizeEventHandler(StatusBarProgreso::OnSize),NULL,this);

        m_pIconoProgreso->Destroy();
        m_pIconoProgreso = NULL;
        m_pIconoParado->Destroy();
        m_pIconoParado = NULL;
        m_pProgresoTarea->Destroy();
        m_pProgresoTarea = NULL;
}
Example #7
0
void ToolBox::Init()
{
	SetPosition();
	pinmode = 1;	
	ostype = GetSystem();
	diagbox = mainwin->diagbox;
	
	visible = true;
	status = NULL;

	buttonheight = 23;
    boxfont = wxFont(wxFontInfo(8).FaceName("Tahoma"));
    confont = wxFont(wxFontInfo(8).FaceName("Tahoma"));
	//boxfont = wxFont(8, wxFONTFAMILY_SWISS, wxNORMAL, wxNORMAL, false, "Tahoma");
	//confont = wxFont(8, wxFONTFAMILY_SWISS, wxNORMAL, wxNORMAL, false, "Tahoma");
	if(ostype == Mac) {
		buttonheight = 25;
        boxfont = wxFont(wxFontInfo(12).FaceName("Tahoma"));
        confont = wxFont(wxFontInfo(10).FaceName("Tahoma"));
		//boxfont = wxFont(12, wxFONTFAMILY_SWISS, wxNORMAL, wxNORMAL, false, "Tahoma");
		//confont = wxFont(10, wxFONTFAMILY_SWISS, wxNORMAL, wxNORMAL, false, "Tahoma");
	}

	if(boxtype == 1) {
		winman = new wxAuiManager;
		winman->SetManagedWindow(this);
		panel = new ToolPanel(this, wxDefaultPosition, wxDefaultSize);                // Base panel for default param file combobox
		panel->SetFont(boxfont);
		//mainbox = new wxBoxSizer(wxVERTICAL);
		//panel->SetSizer(mainbox);
		//tabpanel = new wxNotebook(panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxNB_TOP);
	}
	else {
		panel = new ToolPanel(this, wxDefaultPosition, wxDefaultSize);
		panel->SetFont(boxfont);
		mainbox = new wxBoxSizer(wxVERTICAL);
		panel->SetSizer(mainbox);
	}

	activepanel = panel;

	//mod->diagbox->Write("ToolBox init\n");

	Connect(wxEVT_MOVE, wxMoveEventHandler(ToolBox::OnMove));
	Connect(wxEVT_SIZE, wxSizeEventHandler(ToolBox::OnSize));
	Connect(wxEVT_CLOSE_WINDOW, wxCloseEventHandler(ToolBox::OnClose));
}
GNC::GUI::StatusBarProgreso::StatusBarProgreso( wxWindow* pPadre, wxWindow* pPadrePanel, bool listenMessages, wxWindowID id, long style) :
        wxStatusBar(pPadre, id, style),
        m_dirty (true)
{
        m_pPanelTareas = new PanelTareasBase(pPadrePanel);
        m_pPanelTareas->Show(false);

        SetFieldsCount(Field_Max); //uno para el texto y el otro para lo q yo quiera
        static const int widths[Field_Max] = { -1, 32, 250, 150};
        SetStatusWidths(Field_Max, widths);

        //mensaje tarea
        m_pMensajeTarea = new wxStaticText(this,wxID_ANY,wxT(""), wxDefaultPosition, wxSize(250, -1), wxST_NO_AUTORESIZE);
        m_pMensajeTarea->Connect(wxEVT_LEFT_DOWN, wxMouseEventHandler( StatusBarProgreso::OnMostrarOcultarDialogoProgreso),NULL,this);

        //botoncico de progreso
        m_pIconoProgreso = new wxAnimationCtrl(this,wxID_ANY,GinkgoResourcesManager::ProgressBar::GetAniLoading());
        m_pIconoProgreso->Hide();

        m_pProgresoTarea = new wxGauge(this, wxID_ANY, 100);
        m_pProgresoTarea->Hide();

        m_pIconoParado = new wxStaticBitmap(this,wxID_ANY,GinkgoResourcesManager::ProgressBar::GetIcoStopped());
        m_pIconoParado->Show(true);

        //escuchamos el evento de mensajes
        if (listenMessages) {
                GNC::GCS::Events::EventoMensajes evt(NULL);
                GNC::GCS::ControladorEventos::Instance()->Registrar(this,evt);
        }

        wxSizeEvent event(pPadre->GetSize());
        OnSize(event);

        //onsize
        this->Connect(wxEVT_IDLE, wxIdleEventHandler(StatusBarProgreso::OnIdle), NULL, this);
        this->Connect(wxEVT_SIZE,wxSizeEventHandler(StatusBarProgreso::OnSize),NULL,this);
        this->GetParent()->Connect(wxEVT_MOVE,wxMoveEventHandler(StatusBarProgreso::OnMove),NULL,this);
        this->Connect(wxEVT_MENSAJES_USUARIO_ASYNC, EventoMensajesUsuarioAsyncHandler(StatusBarProgreso::OnMensajeUsuario), NULL, this);
}
Example #9
0
// ------------------------------------------------------------------------
MainEmuFrame::MainEmuFrame(wxWindow* parent, const wxString& title)
	: wxFrame(parent, wxID_ANY, title, wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE & ~(wxMAXIMIZE_BOX | wxRESIZE_BORDER) )

	, m_statusbar( *CreateStatusBar(2, 0) )
	, m_background( this, wxID_ANY, wxGetApp().GetLogoBitmap() )

	// All menu components must be created on the heap!

	, m_menubar( *new wxMenuBar() )

	, m_menuCDVD	( *new wxMenu() )
	, m_menuSys		( *new wxMenu() )
	, m_menuConfig	( *new wxMenu() )
	, m_menuMisc	( *new wxMenu() )
	, m_menuDebug	( *new wxMenu() )

	, m_LoadStatesSubmenu( *MakeStatesSubMenu( MenuId_State_Load01, MenuId_State_LoadBackup ) )
	, m_SaveStatesSubmenu( *MakeStatesSubMenu( MenuId_State_Save01 ) )

	, m_MenuItem_Console( *new wxMenuItem( &m_menuMisc, MenuId_Console, _("Show Console"), wxEmptyString, wxITEM_CHECK ) )
	, m_MenuItem_Console_Stdio( *new wxMenuItem( &m_menuMisc, MenuId_Console_Stdio, _("Console to Stdio"), wxEmptyString, wxITEM_CHECK ) )

{
	m_RestartEmuOnDelete = false;

	for( int i=0; i<PluginId_Count; ++i )
		m_PluginMenuPacks[i].Populate( (PluginsEnum_t)i );

	// ------------------------------------------------------------------------
	// Initial menubar setup.  This needs to be done first so that the menu bar's visible size
	// can be factored into the window size (which ends up being background+status+menus)

	//m_menubar.Append( &m_menuBoot,		_("&Boot") );
	m_menubar.Append( &m_menuSys,		_("&System") );
	m_menubar.Append( &m_menuCDVD,		_("CD&VD") );
	m_menubar.Append( &m_menuConfig,	_("&Config") );
	m_menubar.Append( &m_menuMisc,		_("&Misc") );
#ifdef PCSX2_DEVBUILD
	m_menubar.Append( &m_menuDebug,		_("&Debug") );
#endif
	SetMenuBar( &m_menubar );

	// ------------------------------------------------------------------------

	wxSize backsize( m_background.GetSize() );

	wxString wintitle;
	if( PCSX2_isReleaseVersion )
	{
		// stable releases, with a simple title.
		wintitle.Printf( _("%s  %d.%d.%d %s"), pxGetAppName().c_str(), PCSX2_VersionHi, PCSX2_VersionMid, PCSX2_VersionLo,
			SVN_MODS ? _("(modded)") : wxEmptyString
		);
	}
	else
	{
		// beta / development editions, which feature revision number and compile date.
		wintitle.Printf( _("%s  %d.%d.%d.%d%s (svn)  %s"), pxGetAppName().c_str(), PCSX2_VersionHi, PCSX2_VersionMid, PCSX2_VersionLo,
			SVN_REV, SVN_MODS ? L"m" : wxEmptyString, fromUTF8(__DATE__).c_str() );
	}

	SetTitle( wintitle );

	// Ideally the __WXMSW__ port should use the embedded IDI_ICON2 icon, because wxWidgets sucks and
	// loses the transparency information when loading bitmaps into icons.  But for some reason
	// I cannot get it to work despite following various examples to the letter.


	SetIcons( wxGetApp().GetIconBundle() );

	int m_statusbar_widths[] = { (int)(backsize.GetWidth()*0.73), (int)(backsize.GetWidth()*0.25) };
	m_statusbar.SetStatusWidths(2, m_statusbar_widths);
	//m_statusbar.SetStatusText( L"The Status is Good!", 0);
	m_statusbar.SetStatusText( wxEmptyString, 0);

	wxBoxSizer& joe( *new wxBoxSizer( wxVERTICAL ) );
	joe.Add( &m_background );
	SetSizerAndFit( &joe );

	// Use default window position if the configured windowpos is invalid (partially offscreen)
	if( g_Conf->MainGuiPosition == wxDefaultPosition || !pxIsValidWindowPosition( *this, g_Conf->MainGuiPosition) )
		g_Conf->MainGuiPosition = GetScreenPosition();
	else
		SetPosition( g_Conf->MainGuiPosition );

	// Updating console log positions after the main window has been fitted to its sizer ensures
	// proper docked positioning, since the main window's size is invalid until after the sizer
	// has been set/fit.

	InitLogBoxPosition( g_Conf->ProgLogBox );

	// ------------------------------------------------------------------------
	// Some of the items in the System menu are configured by the UpdateCoreStatus() method.
	
	m_menuSys.Append(MenuId_Boot_CDVD,		_("Initializing..."));

	m_menuSys.Append(MenuId_Boot_CDVD2,		_("Initializing..."));

	m_menuSys.Append(MenuId_Boot_ELF,		_("Run ELF..."),
		_("For running raw PS2 binaries directly"));

	m_menuSys.AppendSeparator();
	m_menuSys.Append(MenuId_Sys_SuspendResume,	_("Initializing..."));
	m_menuSys.AppendSeparator();

	//m_menuSys.Append(MenuId_Sys_Close,		_("Close"),
	//	_("Stops emulation and closes the GS window."));

	m_menuSys.Append(MenuId_Sys_LoadStates,	_("Load state"), &m_LoadStatesSubmenu);
	m_menuSys.Append(MenuId_Sys_SaveStates,	_("Save state"), &m_SaveStatesSubmenu);

	m_menuSys.Append(MenuId_EnableBackupStates,	_("Backup before save"),
		wxEmptyString, wxITEM_CHECK);

	m_menuSys.AppendSeparator();

	m_menuSys.Append(MenuId_EnablePatches,	_("Automatic Gamefixes"),
		_("Automatically applies needed Gamefixes to known problematic games"), wxITEM_CHECK);

	m_menuSys.Append(MenuId_EnableCheats,	_("Enable Cheats"),
		wxEmptyString, wxITEM_CHECK);

	m_menuSys.Append(MenuId_EnableWideScreenPatches,	_("Enable Widescreen Patches"),
		wxEmptyString, wxITEM_CHECK);

	m_menuSys.Append(MenuId_EnableHostFs,	_("Enable Host Filesystem"),
		wxEmptyString, wxITEM_CHECK);

	m_menuSys.AppendSeparator();

	m_menuSys.Append(MenuId_Sys_Shutdown,	_("Shutdown"),
		_("Wipes all internal VM states and shuts down plugins."));

	m_menuSys.Append(MenuId_Exit,			_("Exit"),
		AddAppName(_("Closing %s may be hazardous to your health")));


	// ------------------------------------------------------------------------
	wxMenu& isoRecents( wxGetApp().GetRecentIsoMenu() );

	//m_menuCDVD.AppendSeparator();
	m_menuCDVD.Append( MenuId_IsoSelector,	_("Iso Selector"), &isoRecents );
	m_menuCDVD.Append( GetPluginMenuId_Settings(PluginId_CDVD), _("Plugin Menu"), m_PluginMenuPacks[PluginId_CDVD] );

	m_menuCDVD.AppendSeparator();
	m_menuCDVD.Append( MenuId_Src_Iso,		_("Iso"),		_("Makes the specified ISO image the CDVD source."), wxITEM_RADIO );
	m_menuCDVD.Append( MenuId_Src_Plugin,	_("Plugin"),	_("Uses an external plugin as the CDVD source."), wxITEM_RADIO );
	m_menuCDVD.Append( MenuId_Src_NoDisc,	_("No disc"),	_("Use this to boot into your virtual PS2's BIOS configuration."), wxITEM_RADIO );

	//m_menuCDVD.AppendSeparator();
	//m_menuCDVD.Append( MenuId_SkipBiosToggle,_("Enable BOOT2 injection"),
	//	_("Skips PS2 splash screens when booting from Iso or DVD media"), wxITEM_CHECK );

	// ------------------------------------------------------------------------

	m_menuConfig.Append(MenuId_Config_SysSettings,	_("Emulation &Settings") );
	m_menuConfig.Append(MenuId_Config_McdSettings,	_("&Memory cards") );
	m_menuConfig.Append(MenuId_Config_BIOS,			_("&Plugin/BIOS Selector") );
	if (IsDebugBuild) m_menuConfig.Append(MenuId_Config_GameDatabase,	_("Game Database Editor") );
	// Empty menu
	// m_menuConfig.Append(MenuId_Config_Language,		_("Appearance...") );

	m_menuConfig.AppendSeparator();

	m_menuConfig.Append(MenuId_Config_GS,		_("&Video (GS)"),		m_PluginMenuPacks[PluginId_GS]);
	m_menuConfig.Append(MenuId_Config_SPU2,		_("&Audio (SPU2)"),		m_PluginMenuPacks[PluginId_SPU2]);
	m_menuConfig.Append(MenuId_Config_PAD,		_("&Controllers (PAD)"),m_PluginMenuPacks[PluginId_PAD]);
	m_menuConfig.Append(MenuId_Config_DEV9,		_("Dev9"),				m_PluginMenuPacks[PluginId_DEV9]);
	m_menuConfig.Append(MenuId_Config_USB,		_("USB"),				m_PluginMenuPacks[PluginId_USB]);
	m_menuConfig.Append(MenuId_Config_FireWire,	_("Firewire"),			m_PluginMenuPacks[PluginId_FW]);

	//m_menuConfig.AppendSeparator();
	//m_menuConfig.Append(MenuId_Config_Patches,	_("Patches (unimplemented)"),	wxEmptyString);

	m_menuConfig.AppendSeparator();
	m_menuConfig.Append(MenuId_Config_Multitap0Toggle,	_("Multitap 1"),	wxEmptyString, wxITEM_CHECK );
	m_menuConfig.Append(MenuId_Config_Multitap1Toggle,	_("Multitap 2"),	wxEmptyString, wxITEM_CHECK );

	m_menuConfig.AppendSeparator();
	m_menuConfig.Append(MenuId_Config_ResetAll,	_("Clear all settings..."),
		AddAppName(_("Clears all %s settings and re-runs the startup wizard.")));

	// ------------------------------------------------------------------------

	m_menuMisc.Append( &m_MenuItem_Console );
#ifdef __LINUX__
	m_menuMisc.Append( &m_MenuItem_Console_Stdio );
#endif
	//Todo: Though not many people need this one :p
	//m_menuMisc.Append(MenuId_Profiler,			_("Show Profiler"),	wxEmptyString, wxITEM_CHECK);
	//m_menuMisc.AppendSeparator();

	// No dialogs implemented for these yet...
	//m_menuMisc.Append(41, "Patch Browser...", wxEmptyString, wxITEM_NORMAL);
	//m_menuMisc.Append(42, "Patch Finder...", wxEmptyString, wxITEM_NORMAL);

	m_menuMisc.AppendSeparator();

	//Todo:
	//There's a great working "open website" in the about panel. Less clutter by just using that.
	//m_menuMisc.Append(MenuId_Website,			_("Visit Website..."),
	//	_("Opens your web-browser to our favorite website."));
	m_menuMisc.Append(MenuId_About,				_("About...") );

	m_menuMisc.AppendSeparator();
	m_menuMisc.Append( MenuId_ChangeLang,		L"Change Language" ); // Always in English

#ifdef PCSX2_DEVBUILD
	//m_menuDebug.Append(MenuId_Debug_Open,		_("Open Debug Window..."),	wxEmptyString);
	//m_menuDebug.Append(MenuId_Debug_MemoryDump,	_("Memory Dump..."),		wxEmptyString);
	m_menuDebug.Append(MenuId_Debug_Logging,	_("Logging..."),			wxEmptyString);
#endif
	m_MenuItem_Console.Check( g_Conf->ProgLogBox.Visible );

	ConnectMenus();
	Connect( wxEVT_MOVE,			wxMoveEventHandler			(MainEmuFrame::OnMoveAround) );
	Connect( wxEVT_CLOSE_WINDOW,	wxCloseEventHandler			(MainEmuFrame::OnCloseWindow) );
	Connect( wxEVT_SET_FOCUS,		wxFocusEventHandler			(MainEmuFrame::OnFocus) );
	Connect( wxEVT_ACTIVATE,		wxActivateEventHandler		(MainEmuFrame::OnActivate) );

	PushEventHandler( &wxGetApp().GetRecentIsoManager() );
	SetDropTarget( new IsoDropTarget( this ) );

	ApplyCoreStatus();
	ApplySettings();
}
Example #10
0
HypoMain::HypoMain(const wxString& title, const wxPoint& pos, const wxSize& size)
: MainFrame(title, pos, size)
{
    wxIcon icon;
    wxColour backcolour, panelcolour;
    
    backcolour.Set("#ffffff");
    //panelcolour.Set("#eeeeee");     // grey
    //panelcolour.Set("#ccdaff");     // pale blue
    //panelcolour.Set("#ccffcc");       // pale green
    //panelcolour.Set("#ece9d8");     // xp default
    //panelcolour = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW);
    //ostype = GetSystem();
    //mainwin = this;
    SetMinSize(wxSize(200, 670));
    //mainwing = this;
    //CreateStatusBar();
    
    // Check System
    wxString oslabel = wxGetOsDescription();
    SetStatusText(oslabel);
    mainframe = this;
    
    //blankevent = new wxCommandEvent();
    
    /*
     screensize = wxGetDisplaySize();
     printdata = new wxPrintData;
     pageSetupData = new wxPageSetupDialogData;
     printdata->SetPaperId(wxPAPER_A5);
     printdata->SetOrientation(wxLANDSCAPE);
     
     // copy over initial paper size from print record
     *pageSetupData = *printdata;
     
     // Set some initial page margins in mm.
     pageSetupData->SetMarginTopLeft(wxPoint(15, 15));
     pageSetupData->SetMarginBottomRight(wxPoint(15, 15));*/
    
    numgraphs = 8;
    numdraw = 3;
    numdraw2 = 3;
    activemod = 0;
    startmod = 13;
    pinmode = 0;
    basic = 1;
    diagnostic = 0;
    xstretch = 50;
    modpath = "";
    
    //toolset = new ToolSet();
    //toolset->AddBox(diagbox);
    
    OptionLoad();
    //ViewLoad();
    MainLoad();
    
    spikedisp = 0;   // spike display mode   0 = plain   1 = burst   2 = hazard filter
    
    //diagbox->Show(true);
    
    diagbox->Write("HypoMain initialisation\n\n");
    
    gpos = new graphdisp[numgraphs];
    //greg = new GraphDat[100];
    //graphbase = new GraphBase(200);
    //greg = graphbase->graphstore;
    
    
    //currdata = new CurrentDat();
    //realdata = new SpikeDat();
    //burstdata = new BurstDat();
    //burstdata->spikedata = vasodata->spikedat;
    //analysisdata = new AnaDat();
    //expdata = new SpikeDat();
    //expdata->burstdata = new BurstDat();
    //expdata->burstdata->spikedata = expdata;

		// Spike Analysis Module                  July 2015

		expdata = new SpikeDat();
    expdata->burstdata = new BurstDat();
    selectdata = new SpikeDat();
		burstdata = new BurstDat();
   
    
    //GraphData();
    
    burstbox = NULL;
    infobox = NULL;
    protocolbox = NULL;
    focusdata = NULL;
    dispwin = NULL;
    scalebox = NULL;
    //diagbox->Show();
    
    SetBackgroundColour(backcolour);
    SetIcon(icon);
    //Centre();
    
    mainsizer = new wxBoxSizer(wxHORIZONTAL);
    //wxBoxSizer *graphsizer = new wxBoxSizer(wxVERTICAL);
    graphsizer = new wxBoxSizer(wxVERTICAL);
    mainpos = GetPosition();
    
    //infobox = new InfoBox(this, "Info", wxPoint(mainpos.x+700, mainpos.y+5), wxSize(200, 300));
    //infobox = new InfoBox(this, "Info", wxPoint(320, 155), wxSize(200, 300));
    //toolset.AddBox(infobox);
    
    //scalebox->SetBackgroundColour(panelcolour);
    
    
    //scalebox = new ScaleBox(this, wxSize(80, 775), numdraw, gpos, greg, graphwin);
    //scalebox = new ScaleBox(this, wxDefaultSize, numdraw, gpos, graphbase, graphwin);
    
    
    if(basic) BasicMenu();
    else FullMenu();
    
    //GraphOut();
    //graphpos = 0;
    //ofp = fopen("graphdiag.txt", "w");
    //wxofp = new wxTextFile("graphdiag.txt");
    //wxofp->Create();
    //wxofp->Open();
    //wxofp->Clear();
    
    //scalebox->GraphUpdate();
    
    scaletype = 0;
    
    diagbox->Write("HypoMain model start\n\n");
    
    moddex = 1;
    mod = NULL;
    
    ModInit();
    
    diagbox->Write("HypoMain graph start\n\n");
    
    if(!mod) {
			  wxPanel *defpan = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxDefaultSize);
        graphsizer->Add(defpan, 0, wxEXPAND);
        numdraw = 0;
        diagbox->Show();
        return;
    }
    
    if(mod->gcount < numdraw) numdraw = mod->gcount;
    
    for(graph = 0; graph<numdraw; graph++) {
        //fprintf(ofp, "graph %d  numplots %d  plot0 title %s  gparam %d\n", graph,
        //gpos[graph].numplots, gpos[graph].plot[0]->gname.mb_str(), gpos[graph].plot[0]->gparam);
        //outline.Printf("graph %d  numplots %d  plot0 title %s  gparam %d\n",
        //graph, gpos[graph].numplots, gpos[graph].plot[0]->gname, gpos[graph].plot[0]->gparam);
        //wxofp->AddLine(outline);
        //fflush(ofp);
        
        graphwin[graph] = new GraphWindow3(this, this, mod, wxPoint(0, graph*250 + 10), wxSize(100, 255), &gpos[graph], graph);
        graphwin[graph]->FrontGraph(&gpos[graph]);
        graphsizer->Add(graphwin[graph], 1, wxEXPAND);
        
        //graphwin[graph]->Refresh();
    }

		
    
    //if(diagnostic) mod->diagbox->textbox->AppendText("scalebox call\n");
    scalebox = new ScaleBox(this, this, wxDefaultSize, numdraw, gpos, mod, graphwin, 0, scaletype);
		scalebox->GraphSwitch(0);
		
		//scalebox->GraphSwitch(0);

    //if(diagnostic) mod->diagbox->textbox->AppendText("scalebox call ok\n");
    if(mod->graphload) scalebox->GLoad("default");
		
    if (mod->gsync) {
        scalebox->gsynch = 1;
        if(ostype != Mac) scalebox->syncbutton->SetValue(true);
    }
    scalebox->xmin = mod->xmin;
    
    diagbox->Write(text.Format("mod path = %s\n", mod->GetPath()));
    
    graphsizer->AddSpacer(5);
    if(scalebox) mainsizer->Add(scalebox, 0, wxEXPAND);
    //mainsizer->Add(scalebox, 1);
    mainsizer->Add(graphsizer, 7, wxEXPAND);
    SetSizer(mainsizer);
    Layout();

	
    
    //if(mod->path != "" && !wxDirExists(mod->path)) wxMkdir(mod->path);
    //scalebox->SetMod(mod);
    
    /*wxSize boxsize;
     if(ostype == Mac) boxsize = wxSize(315, 380);
     else boxsize = wxSize(320, 430);
     mainpos = GetPosition();
     protocolbox = new ProtocolBox(mod, "Protocol", wxPoint(320, 455), boxsize);
     toolset.AddBox(protocolbox);
     protocolbox->Show(true);*/
    
    
    //burstbox = new BurstBox(this, "Burst Analysis", wxPoint(mainpos.x+1020, mainpos.y+340), wxSize(300, 350), burstdata);
    //burstbox->Show(true);
    
    
    //SetStatusText("Hypo Net Model");
    //fclose(ofp);
    //wxofp->Write();
    //wxofp->Close();
    
    
    
    //diagbox->Raise();
    //long valmax;
    
    //valmax = std::numeric_limits<int>::max();
    //diagbox->Write(text.Format("max int value %d\n\n", valmax));
    
    //double doubmax = std::numeric_limits<double>::max();
    //diagbox->Write(text.Format("max int value %.10f\n\n", doubmax));
    
    //OnModGen(wxCommandEvent());
    
    
    //Connect(wxEVT_PAINT, wxPaintEventHandler(MainFrame::OnPaint));
    Connect(wxEVT_MOVE, wxMoveEventHandler(HypoMain::OnMove));
    Connect(wxEVT_SIZE, wxSizeEventHandler(HypoMain::OnSize));
    Connect(wxEVT_CLOSE_WINDOW, wxCloseEventHandler(HypoMain::OnClose));
    //Connect(wxEVT_LEFT_DCLICK, wxMouseEventHandler(MainFrame::OnDClick));
    //Connect(wxEVT_MOTION, wxMouseEventHandler(MainFrame::OnDClick));
    Connect(wxEVT_LEFT_UP, wxMouseEventHandler(HypoMain::OnDClick));
    
    Connect(ID_Quit, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(HypoMain::OnQuit));
    Connect(ID_About, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(HypoMain::OnAbout));
    Connect(ID_IGFMod, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(HypoMain::OnParams));
    Connect(ID_CortMod, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(HypoMain::OnCortMod));
    Connect(ID_OsmoMod, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(HypoMain::OnOsmoMod));
    Connect(ID_HeatMod, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(HypoMain::OnHeatMod));
    Connect(ID_GHMod, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(HypoMain::OnGHMod));
    Connect(ID_Output, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(HypoMain::OnOutput));
    Connect(ID_Info, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(HypoMain::OnInfo));
    Connect(ID_Burst, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(HypoMain::OnBurst));
    Connect(ID_Options, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(HypoMain::OnOptionPanel));
    Connect(ID_Display, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(HypoMain::OnNewDisp));
    Connect(ID_Protocol, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(HypoMain::OnProtocol));
    Connect(ID_Sound, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(HypoMain::OnSound));
    Connect(ID_GraphAdd, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(HypoMain::OnGraphAdd));
    Connect(ID_ModGen, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(HypoMain::OnModGen));
    Connect(ID_Diag, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(HypoMain::OnDiagBox));
    Connect(wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler(HypoMain::OnEnter));
}
Example #11
0
// --------------------------------------------------------------------------------------
//  ConsoleLogFrame  (implementations)
// --------------------------------------------------------------------------------------
ConsoleLogFrame::ConsoleLogFrame( MainEmuFrame *parent, const wxString& title, AppConfig::ConsoleLogOptions& options )
	: wxFrame(parent, wxID_ANY, title)
	, m_conf( options )
	, m_TextCtrl( *new pxLogTextCtrl(this) )
	, m_timer_FlushUnlocker( this )
	, m_ColorTable( options.FontSize )

	, m_QueueColorSection( L"ConsoleLog::QueueColorSection" )
	, m_QueueBuffer( L"ConsoleLog::QueueBuffer" )
	, m_threadlogger( EnableThreadedLoggingTest ? new ConsoleTestThread() : NULL )
{
	m_CurQueuePos				= 0;
	m_WaitingThreadsForFlush	= 0;
	m_pendingFlushMsg			= false;
	m_FlushRefreshLocked		= false;

	// create Log menu (contains most options)
	wxMenuBar *pMenuBar = new wxMenuBar();
	SetMenuBar( pMenuBar );
	SetIcons( wxGetApp().GetIconBundle() );

	if (0==m_conf.Theme.CmpNoCase(L"Dark"))
	{
		m_ColorTable.SetColorScheme_Dark();
		m_TextCtrl.SetBackgroundColour( wxColor( 0, 0, 0 ) );
	}
	else //if ((0==m_conf.Theme.CmpNoCase("Default")) || (0==m_conf.Theme.CmpNoCase("Light")))
	{
		m_ColorTable.SetColorScheme_Light();
		m_TextCtrl.SetBackgroundColour( wxColor( 230, 235, 242 ) );
	}

	m_TextCtrl.SetDefaultStyle( m_ColorTable[DefaultConsoleColor] );

	// SetDefaultStyle only sets the style of text in the control.  We need to
	// also set the font of the control, so that sizing logic knows what font we use:
	m_TextCtrl.SetFont( m_ColorTable[DefaultConsoleColor].GetFont() );

	wxMenu& menuLog		(*new wxMenu());
	wxMenu& menuAppear	(*new wxMenu());
	wxMenu& menuSources	(*new wxMenu());
	wxMenu& menuFontSizes( menuAppear );

	// create Appearance menu and submenus

	menuFontSizes.Append( MenuId_FontSize_Small,	_("Small"),	_t("Fits a lot of log in a microcosmically small area."),
		wxITEM_RADIO )->Check( options.FontSize == 7 );
	menuFontSizes.Append( MenuId_FontSize_Normal,	_("Normal font"),_t("It's what I use (the programmer guy)."),
		wxITEM_RADIO )->Check( options.FontSize == 8 );
	menuFontSizes.Append( MenuId_FontSize_Large,	_("Large"),	_t("Its nice and readable."),
		wxITEM_RADIO )->Check( options.FontSize == 10 );
	menuFontSizes.Append( MenuId_FontSize_Huge,		_("Huge"),	_t("In case you have a really high res display."),
		wxITEM_RADIO )->Check( options.FontSize == 12 );

	menuFontSizes.AppendSeparator();
	menuFontSizes.Append( MenuId_ColorScheme_Light,	_("Light theme"),	_t("Default soft-tone color scheme."), wxITEM_RADIO );
	menuFontSizes.Append( MenuId_ColorScheme_Dark,	_("Dark theme"),	_t("Classic black color scheme for people who enjoy having text seared into their optic nerves."), wxITEM_RADIO );

	menuAppear.AppendSeparator();
	menuAppear.Append( wxID_ANY, _("Always on Top"),
		_t("When checked the log window will be visible over other foreground windows."), wxITEM_CHECK );

	menuLog.Append(wxID_SAVE,	_("&Save..."),		_("Save log contents to file"));
	menuLog.Append(wxID_CLEAR,	_("C&lear"),		_("Clear the log window contents"));
	menuLog.AppendSeparator();
	menuLog.AppendSubMenu( &menuAppear, _("Appearance") );
	menuLog.AppendSeparator();
	menuLog.Append(wxID_CLOSE,	_("&Close"),		_("Close this log window; contents are preserved"));

	// Source Selection/Toggle menu

	menuSources.Append( MenuId_LogSource_Devel, _("Dev/Verbose"), _("Shows PCSX2 developer logs"), wxITEM_CHECK );
	menuSources.Append( MenuId_LogSource_CDVD_Info, _("CDVD reads"), _("Shows disk read activity"), wxITEM_CHECK );
	
	menuSources.AppendSeparator();

	uint srcnt = ArraySize(ConLogSources);
	for (uint i=0; i<srcnt; ++i)
	{
		if (const BaseTraceLogSource* log = ConLogSources[i])
		{
			menuSources.Append( MenuId_LogSource_Start+i, log->GetName(), log->GetDescription(), wxITEM_CHECK );
			Connect( MenuId_LogSource_Start+i, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(ConsoleLogFrame::OnToggleSource));
		}
		else
			menuSources.AppendSeparator();
	}

	menuSources.AppendSeparator();
	menuSources.Append( MenuId_LogSource_EnableAll,		_("Enable all"),	_("Enables all log source filters.") );
	menuSources.Append( MenuId_LogSource_DisableAll,	_("Disable all"),	_("Disables all log source filters.") );
	menuSources.Append( MenuId_LogSource_SetDefault,	_("Restore Default"), _("Restore default source filters.") );

	pMenuBar->Append(&menuLog,		_("&Log"));
	pMenuBar->Append(&menuSources,	_("&Sources"));

	// status bar for menu prompts
	CreateStatusBar();

	SetSize( wxRect( options.DisplayPosition, options.DisplaySize ) );
	Show( options.Visible );

	// Bind Events:

	Connect( wxID_OPEN,  wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(ConsoleLogFrame::OnOpen)  );
	Connect( wxID_CLOSE, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(ConsoleLogFrame::OnClose) );
	Connect( wxID_SAVE,  wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(ConsoleLogFrame::OnSave)  );
	Connect( wxID_CLEAR, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(ConsoleLogFrame::OnClear) );

	Connect( MenuId_FontSize_Small,		MenuId_FontSize_Huge,		wxEVT_COMMAND_MENU_SELECTED,	wxCommandEventHandler( ConsoleLogFrame::OnFontSize ) );
	Connect( MenuId_ColorScheme_Light,	MenuId_ColorScheme_Dark,	wxEVT_COMMAND_MENU_SELECTED,	wxCommandEventHandler( ConsoleLogFrame::OnToggleTheme ) );

	Connect( MenuId_LogSource_Devel,		wxEVT_COMMAND_MENU_SELECTED,	wxCommandEventHandler( ConsoleLogFrame::OnToggleSource ) );
	Connect( MenuId_LogSource_CDVD_Info,	wxEVT_COMMAND_MENU_SELECTED,	wxCommandEventHandler( ConsoleLogFrame::OnToggleCDVDInfo ) );
	Connect( MenuId_LogSource_EnableAll,	wxEVT_COMMAND_MENU_SELECTED,	wxCommandEventHandler( ConsoleLogFrame::OnEnableAllLogging ) );
	Connect( MenuId_LogSource_DisableAll,	wxEVT_COMMAND_MENU_SELECTED,	wxCommandEventHandler( ConsoleLogFrame::OnDisableAllLogging ) );
	Connect( MenuId_LogSource_SetDefault,	wxEVT_COMMAND_MENU_SELECTED,	wxCommandEventHandler( ConsoleLogFrame::OnSetDefaultLogging ) );

	Connect( wxEVT_CLOSE_WINDOW,	wxCloseEventHandler			(ConsoleLogFrame::OnCloseWindow) );
	Connect( wxEVT_MOVE,			wxMoveEventHandler			(ConsoleLogFrame::OnMoveAround) );
	Connect( wxEVT_SIZE,			wxSizeEventHandler			(ConsoleLogFrame::OnResize) );
	Connect( wxEVT_ACTIVATE,		wxActivateEventHandler		(ConsoleLogFrame::OnActivate) );

	Connect( pxEvt_SetTitleText,	wxCommandEventHandler	(ConsoleLogFrame::OnSetTitle) );
	Connect( pxEvt_DockConsole,		wxCommandEventHandler	(ConsoleLogFrame::OnDockedMove) );
	Connect( pxEvt_FlushQueue,		wxCommandEventHandler	(ConsoleLogFrame::OnFlushEvent) );

	Connect( m_timer_FlushUnlocker.GetId(),	wxEVT_TIMER,	wxTimerEventHandler	(ConsoleLogFrame::OnFlushUnlockerTimer) );

	if( m_threadlogger != NULL )
		m_threadlogger->Start();

	OnLoggingChanged();

	if (0==m_conf.Theme.CmpNoCase(L"Dark"))
	{
		pMenuBar->Check(MenuId_ColorScheme_Dark, true);
	}
	else //if ((0==m_conf.Theme.CmpNoCase("Default")) || (0==m_conf.Theme.CmpNoCase("Light")))
	{
		pMenuBar->Check(MenuId_ColorScheme_Light, true);
	}
}
Example #12
0
CWindowStateManager::~CWindowStateManager()
{
	m_pWindow->Disconnect(wxID_ANY, wxEVT_SIZE, wxSizeEventHandler(CWindowStateManager::OnSize), 0, this);
	m_pWindow->Disconnect(wxID_ANY, wxEVT_MOVE, wxMoveEventHandler(CWindowStateManager::OnMove), 0, this);
}