Beispiel #1
0
Plot_xyz::Plot_xyz() {
	i = 0;
	setWindowTitle(tr("The distribution of transfered electrons"));
	create_widgets();
	widgets_setting();
	create_actions();
}
Beispiel #2
0
static void
change_end (GtkSpinButton *button,
            GParamSpec    *pspec,
            GtkActionBar  *bar)
{
  create_widgets (bar,
                  GTK_PACK_END,
                  gtk_spin_button_get_value_as_int (button));
}
int MatrixView::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QWidget::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: matrixSaved((*reinterpret_cast< float**(*)>(_a[1]))); break;
        case 1: redrawMatrix(); break;
        case 2: create_widgets(); break;
        case 3: do_save_matrix(); break;
        default: ;
        }
        _id -= 4;
    }
    return _id;
}
Beispiel #4
0
MainFrame::MainFrame()
    : wxFrame((wxFrame*)0, -1, wxT(""), wxDefaultPosition, wxDefaultSize)
{
    create_menu();
    create_widgets();
    update_start(true);
    // Set icon
#if defined(__WXMSW__)
    wxIcon icon(wxT("metalink"), wxBITMAP_TYPE_ICO_RESOURCE);
#else
    wxFileName icon_name(wxStandardPaths::Get().GetDataDir(),
	                 wxT("metalink.png"));
    wxBitmap bmp(icon_name.GetFullPath(), wxBITMAP_TYPE_ANY);
    wxIcon icon;
    icon.CopyFromBitmap(bmp);
#endif
    SetIcon(icon);
    // Set properties
    SetTitle(wxT("Metalink Editor"));
    SetSize(wxSize(600, 550));
    // Update interface
    update();
    editor_.add_listener(this);
}
Beispiel #5
0
int
main (int   argc,
      char *argv[])
{
  GtkWidget *window, *widget, *vbox, *button;
  GtkWidget *offscreen = NULL;
  gboolean use_offscreen;

  gtk_init (&argc, &argv);

  use_offscreen = argc == 1;

  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_window_set_default_size (GTK_WINDOW (window), 300,300);

  g_signal_connect (window, "destroy",
                    G_CALLBACK (gtk_main_quit),
                    NULL);

  vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
  gtk_container_add (GTK_CONTAINER (window), vbox);

  scale = gtk_scale_new_with_range (GTK_ORIENTATION_HORIZONTAL,
                                    0, G_PI * 2, 0.01);
  gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 0);

  button = gtk_button_new_with_label ("Remove child 2");
  gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);

  if (use_offscreen)
    {
      offscreen = gtk_offscreen_box_new ();

      g_signal_connect (scale, "value_changed",
                        G_CALLBACK (scale_changed),
                        offscreen);
    }
  else
    {
      offscreen = gtk_paned_new (GTK_ORIENTATION_VERTICAL);
    }

  gtk_box_pack_start (GTK_BOX (vbox), offscreen, TRUE, TRUE, 0);

  widget = create_widgets ();
  if (use_offscreen)
    gtk_offscreen_box_add1 (GTK_OFFSCREEN_BOX (offscreen),
			    widget);
  else
    gtk_paned_add1 (GTK_PANED (offscreen), widget);

  widget = create_widgets ();
  if (1)
    {
      GtkWidget *widget2, *box2, *offscreen2;

      offscreen2 = gtk_offscreen_box_new ();
      gtk_box_pack_start (GTK_BOX (widget), offscreen2, FALSE, FALSE, 0);

      g_signal_connect (scale, "value_changed",
                        G_CALLBACK (scale_changed),
                        offscreen2);

      box2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
      gtk_offscreen_box_add2 (GTK_OFFSCREEN_BOX (offscreen2), box2);

      widget2 = gtk_button_new_with_label ("Offscreen in offscreen");
      gtk_box_pack_start (GTK_BOX (box2), widget2, FALSE, FALSE, 0);

      widget2 = gtk_entry_new ();
      gtk_entry_set_text (GTK_ENTRY (widget2), "Offscreen in offscreen");
      gtk_box_pack_start (GTK_BOX (box2), widget2, FALSE, FALSE, 0);
    }

  if (use_offscreen)
    gtk_offscreen_box_add2 (GTK_OFFSCREEN_BOX (offscreen), widget);
  else
    gtk_paned_add2 (GTK_PANED (offscreen), widget);

  gtk_widget_show_all (window);

  g_signal_connect (G_OBJECT (button), "clicked",
                    G_CALLBACK (remove_clicked),
                    widget);

  gtk_main ();

  return 0;
}
Beispiel #6
0
ChunkPanel::ChunkPanel(wxWindow* parent, MetalinkEditor& editor)
    : wxPanel(parent), editor_(editor)
{
    create_widgets();
    update();
}
//! compile les shaders et construit le programme + les buffers + le vertex array.
//! renvoie -1 en cas d'erreur.
int init( std::vector<const char *>& options )
{
    widgets= create_widgets();
    
    camera= make_orbiter();
    
    program= 0;
    const char *option;
    option= option_find(options, ".glsl");
    if(option != NULL)
    {
        program_filename= Filename(option);
        reload_program();
    }
    
    glGenVertexArrays(1, &vao);
    vertex_count= 3;
    
    option= option_find(options, ".obj");
    if(option != NULL)
    {
        mesh= read_mesh(option);
        if(mesh.positions.size() > 0)
        {
            mesh_filename= Filename(option);
            
            vao= make_mesh_vertex_format(mesh);
            vertex_count= (unsigned int) mesh.positions.size();
            
            Point pmin, pmax;
            mesh_bounds(mesh, pmin, pmax);
            orbiter_lookat(camera, center(pmin, pmax), distance(pmin, pmax));
        }
    }
    
    // charge les textures, si necessaire
    for(unsigned int i= 0; i < (unsigned int) options.size(); i++)
    {
        GLuint texture= read_texture(0, options[i]);
        if(texture > 0)
        {
            texture_filenames.push_back(Filename(options[i]));
            textures.push_back(texture);
        }
    }
    
    // nettoyage
    glUseProgram(0);
    glBindTexture(GL_TEXTURE_2D, 0);
    glBindVertexArray(0);
    glBindBuffer(GL_ARRAY_BUFFER, 0);
    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
    
    // etat openGL par defaut
    glClearColor(0.2f, 0.2f, 0.2f, 1.f);
    glClearDepth(1.f);
    
    glCullFace(GL_BACK);
    glFrontFace(GL_CCW);
    //~ glEnable(GL_CULL_FACE); // n'affiche que les faces correctement orientees...
    glDisable(GL_CULL_FACE);    // les faces mal orientees sont affichees avec des hachures oranges...
    
    glDepthFunc(GL_LESS);
    glEnable(GL_DEPTH_TEST);
    
    return 0;    
}