Пример #1
0
int main(int argc, char **argv)
{
    //int i;
    /*Ycodelist *c;*/
    gui_init(&argc, &argv);
    gui_startup();
    /*c = y_code_new(stdin);
    y_code_dump(c);
    y_mem_new(0x120);
    y_code_map(c);
    y_mem_dump(stdout);
    y_fetch_init(0x0);
    y_decode_init();
    y_arrange_init();
    y_reg_init();
    y_memory_init();
    for (i = 1; s_fetch_mode != Y_MODE_ABORT ||
                s_decode_mode != Y_MODE_ABORT; ++i){
        y_memory();
        y_exec();
        y_decode();
        y_fetch();
        y_msg_f(Y_MSG_DEBUG, "=========== Cycle %3d ============\n",i);
        dump_reg_state();
        dump_memory_stage();
        dump_exec();
        dump_decode();
        dump_fetch();
        //y_mem_dump(stdout);
    }
    gui_startup();
    y_mem_dump(stdout);
    y_mem_free();
    y_code_free(c);*/
    gui_end();
    return 0;
}
Пример #2
0
CatheterFrame::CatheterFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
    : wxFrame(NULL, wxID_ANY, title, pos, size) {

    int fw, fh;
    this->GetClientSize(&fw, &fh);
    /*wxRect frameRect = GetScreenRect();
    fw = frameRect.GetWidth();
    fh = frameRect.GetHeight();*/

    wxMenu *fileMenu = new wxMenu;
    fileMenu->Append(wxID_EXIT);

    wxMenu *helpMenu = new wxMenu;
    helpMenu->Append(wxID_ABOUT);

    wxMenuBar *menuBar = new wxMenuBar;
    menuBar->Append(fileMenu, "&File");
    menuBar->Append(helpMenu, "&Help");

    SetMenuBar(menuBar);

    CreateStatusBar(); //line of text at bottom of window
    SetStatusText("Welcome to the Catheter Control Gui. Controller is currently DISCONNECTED.");

    controlPanel = new wxPanel(this, wxID_ANY);

    wxSizer *controlSizerV = new wxBoxSizer(wxVERTICAL);

    wxBoxSizer *fileSizerH = new wxBoxSizer(wxHORIZONTAL);
    wxBoxSizer *packetSizerV = new wxBoxSizer(wxVERTICAL);
    wxBoxSizer *serialSizerH = new wxBoxSizer(wxHORIZONTAL);
   
    wxBoxSizer *loadPlayfileSizerV = new wxBoxSizer(wxVERTICAL);
    wxBoxSizer *savePlayfileSizerV = new wxBoxSizer(wxVERTICAL);
    wxBoxSizer *logfileSizerV = new wxBoxSizer(wxVERTICAL);
    
    loadPlayfileSizerV->Add(new wxButton(controlPanel, ID_LOAD_PLAYFILE_BUTTON, wxT("Load Playfile")));
    loadPlayfileSizerV->Add(new wxTextCtrl(controlPanel, ID_LOAD_PLAYFILE_TEXT, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER));
    
    savePlayfileSizerV->Add(new wxButton(controlPanel, ID_SAVE_PLAYFILE_BUTTON, wxT("Save to Playfile")));
    savePlayfileSizerV->Add(new wxTextCtrl(controlPanel, ID_SAVE_PLAYFILE_TEXT, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER));
    
    logfileSizerV->Add(new wxButton(controlPanel, ID_LOGFILE_BUTTON, wxT("Log to File")));
    logfileSizerV->Add(new wxTextCtrl(controlPanel, ID_LOGFILE_TEXT, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER));

    fileSizerH->Add(loadPlayfileSizerV);
    fileSizerH->AddSpacer(5);
    fileSizerH->Add(savePlayfileSizerV);
    fileSizerH->AddSpacer(5);
    fileSizerH->Add(logfileSizerV);
    
    int ids[7] = {ID_INC_CHAN1, ID_CURRENT_TEXT1, ID_CURRENT_BUTTON1, ID_POLL_CHAN1, ID_ENA_CHAN1, ID_UPD_CHAN1, ID_DIR_CHAN1};
    packetSizerV->Add(CatheterFrame::CreateChannelRowSizer(ids));
    packetSizerV->AddSpacer(5);
    
    ids[0] = ID_INC_CHAN2;
    ids[1] = ID_CURRENT_TEXT2;
    ids[2] = ID_CURRENT_BUTTON2;
    ids[3] = ID_POLL_CHAN2;
    ids[4] = ID_ENA_CHAN2;
    ids[5] = ID_UPD_CHAN2;
    ids[6] = ID_DIR_CHAN2;
    packetSizerV->Add(CatheterFrame::CreateChannelRowSizer(ids));
    packetSizerV->AddSpacer(5);
    
    ids[0] = ID_INC_CHAN3;
    ids[1] = ID_CURRENT_TEXT3;
    ids[3] = ID_CURRENT_BUTTON2;
    ids[3] = ID_POLL_CHAN3;
    ids[4] = ID_ENA_CHAN3;
    ids[5] = ID_UPD_CHAN3;
    ids[6] = ID_DIR_CHAN3;
    packetSizerV->Add(CatheterFrame::CreateChannelRowSizer(ids));
    packetSizerV->AddSpacer(5);
    
    ids[0] = ID_INC_CHAN4;
    ids[1] = ID_CURRENT_TEXT4;
    ids[4] = ID_CURRENT_BUTTON2;
    ids[3] = ID_POLL_CHAN4;
    ids[4] = ID_ENA_CHAN4;
    ids[5] = ID_UPD_CHAN4;
    ids[6] = ID_DIR_CHAN4;
    packetSizerV->Add(CatheterFrame::CreateChannelRowSizer(ids));
    packetSizerV->AddSpacer(5);
    
    ids[0] = ID_INC_CHAN5;
    ids[1] = ID_CURRENT_TEXT5;
    ids[5] = ID_CURRENT_BUTTON2;
    ids[3] = ID_POLL_CHAN5;
    ids[4] = ID_ENA_CHAN5;
    ids[5] = ID_UPD_CHAN5;
    ids[6] = ID_DIR_CHAN5;
    packetSizerV->Add(CatheterFrame::CreateChannelRowSizer(ids));
    packetSizerV->AddSpacer(5);
    
    ids[0] = ID_INC_CHAN6;
    ids[1] = ID_CURRENT_TEXT6;
    ids[6] = ID_CURRENT_BUTTON2;
    ids[3] = ID_POLL_CHAN6;
    ids[4] = ID_ENA_CHAN6;
    ids[5] = ID_UPD_CHAN6;
    ids[6] = ID_DIR_CHAN6;
    packetSizerV->Add(CatheterFrame::CreateChannelRowSizer(ids));
    packetSizerV->AddSpacer(5);
    
    
    wxBoxSizer *packetButtonSizerH = new wxBoxSizer(wxHORIZONTAL);
    packetButtonSizerH->Add(new wxButton(controlPanel, ID_CLEARPACKET_BUTTON, wxT("Clear Packet")));
    packetButtonSizerH->AddSpacer(5);
    packetButtonSizerH->Add(new wxButton(controlPanel, ID_CLEARALLPACKETS_BUTTON, wxT("Clear All Packets")));
    packetButtonSizerH->AddSpacer(15);
    packetButtonSizerH->Add(new wxButton(controlPanel, ID_PREVPACKET_BUTTON, wxT("<- Prev")), 0, wxALIGN_CENTRE_HORIZONTAL, 5);
    packetButtonSizerH->AddSpacer(5);
    packetButtonSizerH->Add(new wxButton(controlPanel, ID_ADDPACKET_BUTTON, wxT("++ Add")));
    packetButtonSizerH->AddSpacer(5);
    packetButtonSizerH->Add(new wxButton(controlPanel, ID_NEXTPACKET_BUTTON, wxT("Next ->")));
    packetButtonSizerH->AddSpacer(15);
    packetButtonSizerH->Add(new wxButton(controlPanel, ID_PREVIEWPACKETS_BUTTON, wxT("Preview Packets")), 0, wxALIGN_RIGHT, 5);

    packetSizerV->AddSpacer(15);
    packetSizerV->Add(packetButtonSizerH);

    serialSizerH->Add(new wxButton(controlPanel, ID_CONNECT_BUTTON, wxT("Connect")));
    serialSizerH->AddSpacer(5);
    serialSizerH->Add(new wxButton(controlPanel, ID_SENDPACKETS_BUTTON, wxT("Send Packets")));
    serialSizerH->AddSpacer(5);
    serialSizerH->Add(new wxButton(controlPanel, ID_GLOBALRESET_BUTTON, wxT("Send Global Reset")));
    serialSizerH->AddSpacer(5);
    serialSizerH->Add(new wxRadioButton(controlPanel, ID_SOURCEPLAYFILE, wxT("Read Packets\nfrom Playfile"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP));
    serialSizerH->AddSpacer(5);
    serialSizerH->Add(new wxRadioButton(controlPanel, ID_SOURCEWINDOW, wxT("Read Packets\nfrom Window")));

    controlSizerV->Add(fileSizerH, wxSizerFlags().Left().Expand().Border(wxALL, 10));
    controlSizerV->Add(packetSizerV, wxSizerFlags().Left().Expand().Border(wxALL, 10));
    controlSizerV->Add(serialSizerH, wxSizerFlags().Left().Expand().Border(wxALL, 10));
    
    controlPanel->SetSizer(controlSizerV);
    this->Fit();

    gui_startup();
}