Exemplo n.º 1
0
extern void ModNewHandle( a_window *wnd, mod_handle handle )
{
    mod_window  *mod = WndMod( wnd );

    if( mod->handle == handle ) return;
    mod->handle = handle;
    ModInit( wnd );
    ModSetCurrent( wnd );
}
Exemplo n.º 2
0
static void     ModMenuItem( a_window *wnd, unsigned id, int row, int piece )
{
    address     addr;
    mod_handle  handle;
    mod_window  *mod = WndMod( wnd );

    piece=piece;

    handle = NO_MOD;
    addr = NilAddr;
    if( ModListNumRows( ModList( mod ) ) != 0 && row >= 0 ) {
        handle =  ModListMod( ModList( mod ), row );
        if( handle != NO_MOD ) {
            addr = ModFirstAddr( handle );
        }
    }
    switch( id ) {
    case MENU_INITIALIZE:
        WndMenuGrayAll( wnd );
        if( handle != NO_MOD ) {
            WndMenuEnable( wnd, MENU_MODULES_BREAK_SET_ALL, TRUE );
            WndMenuEnable( wnd, MENU_MODULES_BREAK_CLEAR_ALL, TRUE );
            WndMenuEnable( wnd, MENU_MODULES_ASSEMBLY, !IS_NIL_ADDR( addr ) );
            WndMenuEnable( wnd, MENU_MODULES_FUNCTIONS, TRUE );
            if( ModHasSourceInfo( handle ) ) {
                WndMenuEnable( wnd, MENU_MODULES_SOURCE, TRUE );
            }
        }
        WndMenuEnable( wnd, MENU_MODULES_SHOW_ALL, TRUE );
        WndMenuCheck( wnd, MENU_MODULES_SHOW_ALL, mod->all_modules );
        break;
    case MENU_MODULES_BREAK_SET_ALL:
        BreakAllModEntries( handle );
        break;
    case MENU_MODULES_BREAK_CLEAR_ALL:
        ClearAllModBreaks( handle );
        break;
    case MENU_MODULES_SOURCE:
        if( IS_NIL_ADDR( addr ) ) {
            ModName( handle, TxtBuff, TXT_LEN );
            WndFileInspect( TxtBuff, FALSE );
        } else {
            WndSrcInspect( addr );
        }
        break;
    case MENU_MODULES_ASSEMBLY:
        WndAsmInspect( addr );
        break;
    case MENU_MODULES_FUNCTIONS:
        WndFuncInspect( handle );
        break;
    case MENU_MODULES_SHOW_ALL:
        mod->all_modules = !mod->all_modules;
        ModInit( wnd );
        break;
    }
}
Exemplo n.º 3
0
static void     ModRefresh( a_window *wnd )
{
    int         i;
    mod_window  *mod = WndMod( wnd );
    modinfo     *info;

    if( WndFlags & UP_SYM_CHANGE ) {
        ModInit( wnd );
    }
    if( WndFlags & UP_OPEN_CHANGE ) {
        for( i = 0; i < ModListNumRows( ModList( mod ) ); ++i ) {
            info = &mod->info[ i ];
            info->open = CheckOpenGadget( wnd, i, info->open,
                                          ModListMod( ModList( mod ), i ),
                                          info->source, PIECE_SOURCE );
        }
    }
    if( WndFlags & (UP_CSIP_CHANGE+UP_STACKPOS_CHANGE) ) {
        ModSetCurrent( wnd );
    }
}
Exemplo n.º 4
0
//-----------------------------------------------------------------------------
// Purpose: Main loop for non-dedicated servers
//-----------------------------------------------------------------------------
int CEngineAPI::RunListenServer()
{
	//
	// NOTE: Systems set up here should depend on the mod 
	// Systems which are mod-independent should be set up in the launcher or Init()
	//

	// Innocent until proven guilty
	int nRunResult = RUN_OK;

	// Happens every time we start up and shut down a mod
	if ( ModInit( m_StartupInfo.m_pInitialMod, m_StartupInfo.m_pInitialGame ) )
	{
		CModAppSystemGroup modAppSystemGroup( false, m_StartupInfo.m_pParentAppSystemGroup );

		// Store off the app system factory...
		g_AppSystemFactory = modAppSystemGroup.GetFactory();

		nRunResult = modAppSystemGroup.Run();

		g_AppSystemFactory = NULL;

		// Shuts down the mod
		ModShutdown();

		// Disconnects from the editor window
		videomode->SetGameWindow( NULL );
	}

	// Closes down things that were set up in OnStartup
	// FIXME: OnStartup + OnShutdown should be removed + moved into the launcher
	// or the launcher code should be merged into the engine into the code in OnStartup/OnShutdown
	OnShutdown();

	return nRunResult;
}
Exemplo n.º 5
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));
}
Exemplo n.º 6
0
static void ModSetOptions( a_window *wnd )
{
    WndMod( wnd )->all_modules = _IsOn( SW_MOD_ALL_MODULES );
    ModInit( wnd );
}