Ejemplo n.º 1
0
bool MyApp::OnInit()
{
    wxBoxSizer* sizer = new wxBoxSizer(wxHORIZONTAL);
    frame = new wxFrame((wxFrame *)NULL, -1,  wxT("Hello wxDC"), wxPoint(50,50), wxSize(800,600));
	
    drawPane = new BasicDrawPane( (wxFrame*) frame );
    sizer->Add(drawPane, 1, wxEXPAND);
	
    frame->SetSizer(sizer);
    frame->SetAutoLayout(true);
	
    frame->Show();
    return true;
} 
Ejemplo n.º 2
0
bool TraceScope::OnInit()
{
    wxBoxSizer* sizer = new wxBoxSizer(wxHORIZONTAL);
    m_frame = new wxFrame((wxFrame *)NULL, -1,  wxT("lttng-scope"), wxPoint(50,50), wxSize(400,200));

    m_scopeView = new ScopeView( (wxFrame*) m_frame );
    sizer->Add(m_scopeView, 1, wxEXPAND);

    m_frame->SetSizer(sizer);
    m_frame->SetAutoLayout(true);

    m_frame->Show();

    return true;
}
Ejemplo n.º 3
0
bool MyApp::OnInit()
{
    wxBoxSizer* sizer = new wxBoxSizer(wxHORIZONTAL);
    frame = new wxFrame((wxFrame *)NULL, -1,  wxT("Hello GL World"), wxPoint(50,50), wxSize(400,200));
	
    int args[] = {WX_GL_RGBA, WX_GL_DOUBLEBUFFER, WX_GL_DEPTH_SIZE, 16, 0};
    
    glPane = new BasicGLPane( (wxFrame*) frame, args);
    sizer->Add(glPane, 1, wxEXPAND);
	
    frame->SetSizer(sizer);
    frame->SetAutoLayout(true);
	
    frame->Show();
    return true;
} 
Ejemplo n.º 4
0
bool MyApp::OnInit()
{
    wxBoxSizer* sizer = new wxBoxSizer(wxHORIZONTAL);
    frame = new wxFrame((wxFrame *)NULL, -1,  wxT("Hello GL World"), wxPoint(50,50), wxSize(400,200));
 
    int args[] = {WX_GL_RGBA, WX_GL_DOUBLEBUFFER, WX_GL_DEPTH_SIZE, 16, 0};
    
    glPane = new BasicGLPane( (wxFrame*) frame, args);
    sizer->Add(glPane, 1,wxEXPAND);
    //glPane->starter = false;
    frame->SetSizer(sizer);
    frame->SetAutoLayout(true);

    
    cout << "Initializing!!" << std::endl;
    if(!initialize())
        return false;
    frame->Show();

    //glPane->starter = true;
    return true;
} 
Ejemplo n.º 5
0
  bool
  OnInit()
  {
    int i, RetVal = 1;
    long uj;
    //#define FLEXGRID
#ifndef FLEXGRID
    wxBoxSizer* sizer = new wxBoxSizer(wxHORIZONTAL);
#else
    wxFlexGridSizer* sizer = new wxFlexGridSizer (3, 3, 0, 0);
    sizer->AddGrowableRow (1, 1);
    sizer->AddGrowableCol (1, 1);
#endif

    // Parse command-line arguments.
    for (i = 1; i < argc; i++)
      {
        wxString Argv = argv[i];
        if (Argv.BeforeFirst('=') == wxT("--port"))
          {
            if (Argv.AfterFirst('=').ToLong(&uj))
              Port = uj;
            else
              {
                fprintf(stderr, "Illegal value in --port switch.\n");
                goto Help;
              }
          }
        else if (Argv.BeforeFirst('=') == wxT("--host"))
          {
            Host = Argv.AfterFirst('=');
          }
        else if (Argv == wxT("--verbose") || Argv == wxT("-v"))
          Verbosity++;
        else if (Argv == wxT("--help"))
          {
            RetVal = 0;
            Help: ;
            fprintf(stderr, "USAGE:\n");
            fprintf(stderr, "     yaPanel [OPTIONS]\n");
            fprintf(stderr, "The allowed OPTIONS are:\n");
            fprintf(stderr, "--help    Display this help-info.\n");
            fprintf(
                stderr,
                "--host=H  Host IP address or name of yaOBC server. Default \"%s\".\n",
                HOST);
            fprintf(stderr, "--port=P  Defaults to --port=%d.\n", PORT);
            fprintf(stderr, "--verbose Increase message verbosity.\n");
            goto Done;
          }
        else
          {
            fprintf(stderr, "Unrecognized switch.\n");
            goto Help;
          }
      }

    // Initialize the socket library.
    if (enet_initialize() != 0)
      {
        fprintf(stderr, "An error occurred while initializing ENet.\n");
        goto Done;
      }
    atexit(enet_deinitialize);
    if (Verbosity)
      fprintf(stderr, "Starting up enet client.\n");
    host = enet_host_create(NULL, 1, 2, 0, 0);
    if (host == NULL)
      {
        fprintf(stderr,
            "An error occurred while trying to create an ENet client.\n");
        goto Done;
      }

    wxInitAllImageHandlers();

    // Read in the file that lists all of the positions of the input-
    // and output fields in the background PNG.

      {
        FILE *fp;
        char s[129], Name[MAX_NAME_SIZE];
        int i1, i2, i3, i4;

        BackgroundWidth = 0;
        BackgroundHeight = 0;

        fp = fopen("yaPanel.coordinates", "rb");
        if (fp == NULL)
          {
            wxMessageBox(wxT("Could not open yaPanel.coordinates"), wxT(
                "Fatal error"), wxOK | wxICON_ERROR);
            goto Done;
          }
        while (NULL != fgets(s, sizeof(s), fp))
          {
            if (5 == sscanf(s, "%" NAME_FIELD_WIDTH "s%d%d%d%d", Name, &i1,
                &i2, &i3, &i4))
              {
                int i;
                for (i = 0; i < NumFields; i++)
                  if (!strcmp(Fields[i].Name, Name))
                    break;
                if (i < NumFields)
                  {
                    if (i2 < 0)
                      i2 += BackgroundHeight - 1;
                    if (i4 < 0)
                      i4 += BackgroundHeight - 1;
                    if (i1 > i3)
                      {
                        int i;
                        i = i1;
                        i1 = i3;
                        i3 = i1;
                      }
                    if (i2 > i4)
                      {
                        int i;
                        i = i2;
                        i2 = i4;
                        i4 = i;
                      }
                    strcpy(Fields[i].Name, Name);
                    Fields[i].Type = FT_IN;
                    Fields[i].Left = i1;
                    Fields[i].Top = i2;
                    Fields[i].Right = i3;
                    Fields[i].Bottom = i4;
                  }
              }
            else if (3 == sscanf(s, "%" NAME_FIELD_WIDTH "s%d%d", Name, &i1,
                &i2))
              {
                if (!strcmp(Name, "size"))
                  {
                    BackgroundWidth = i1;
                    BackgroundHeight = i2;
                  }
                else
                  {
                    int i;
                    for (i = 0; i < NumFields; i++)
                      if (!strcmp(Fields[i].Name, Name))
                        break;
                    if (i < NumFields)
                      {
                        if (i2 < 0)
                          i2 += BackgroundHeight - 1;
                        strcpy(Fields[i].Name, Name);
                        Fields[i].Type = FT_OUT;
                        Fields[i].x = i1;
                        Fields[i].y = i2;
                      }
                  }
              }
          }
      }
    if (BackgroundWidth == 0 || BackgroundHeight == 0)
      {
        wxMessageBox(wxT("Size-fields not found in yaPanel.coordinates"), wxT(
            "Fatal error"), wxOK | wxICON_ERROR);
        goto Done;
      }

    frame = new wxFrame(NULL, wxID_ANY, wxT("Test yaPanel"), wxPoint(50, 50),
        wxSize(BackgroundWidth, BackgroundHeight));

    // then simply create like this
    drawPane = new wxImagePanel(frame, wxT("yaPanel.png"), wxBITMAP_TYPE_PNG);
#ifndef FLEXGRID
    sizer->Add(drawPane, 100, wxEXPAND);
#else
    sizer->AddStretchSpacer();
    sizer->AddStretchSpacer();
    sizer->AddStretchSpacer();
    sizer->AddStretchSpacer();
    sizer->Add(drawPane, 100, wxSHAPED);
    sizer->AddStretchSpacer();
    sizer->AddStretchSpacer();
    sizer->AddStretchSpacer();
    sizer->AddStretchSpacer();
#endif

    frame->SetSizer(sizer);
    drawPane->CaptureMouse();

    frame->Show();
    return true;
    // Error exit here.
    Done: ;
    if (host != NULL)
      enet_host_destroy(host);
    return false;
  }