コード例 #1
0
ファイル: VRGuiNav.cpp プロジェクト: Pfeil/polyvr
void VRGuiNav::on_preset_changed() {
    auto scene = VRSceneManager::getCurrent();
    if (scene == 0) return;
    VRNavPreset* preset = scene->getNavigation(getComboboxText("combobox5"));
    if (preset == 0) return;

    //get binding type liststore
    Glib::RefPtr<Gtk::ListStore> store = Glib::RefPtr<Gtk::ListStore>::cast_static(VRGuiBuilder()->get_object("binding_types"));

    //TODO: get all bindings from preset && update nav_bindings
    navBindings_store->clear();
    for (auto& b : *preset) {
        string cb_name;
        if (b.cb) cb_name = b.cb->getName();

        string type = "Event";
        if (b.doRepeat) type = "State";

        Gtk::ListStore::Row row = *navBindings_store->append();
        gtk_list_store_set (navBindings_store->gobj(), row.gobj(), 0, b.key, -1);
        gtk_list_store_set (navBindings_store->gobj(), row.gobj(), 1, b.state, -1);
        gtk_list_store_set (navBindings_store->gobj(), row.gobj(), 2, type.c_str(), -1);
        gtk_list_store_set (navBindings_store->gobj(), row.gobj(), 3, cb_name.c_str(), -1);
        gtk_list_store_set (navBindings_store->gobj(), row.gobj(), 4, NULL, -1);
    }
}
コード例 #2
0
ファイル: VRGuiUtils.cpp プロジェクト: AntonChalakov/polyvr
void fillStringListstore(string ls, vector<string> list) {
    Glib::RefPtr<Gtk::ListStore> store = Glib::RefPtr<Gtk::ListStore>::cast_static(VRGuiBuilder()->get_object(ls.c_str()));
    store->clear();
    for (unsigned int i=0; i<list.size(); i++) {
        Gtk::ListStore::Row row = *store->append();
        gtk_list_store_set (store->gobj(), row.gobj(), 0, list[i].c_str(), -1);
    }
}
コード例 #3
0
ファイル: VRGuiBits.cpp プロジェクト: TobiasHue/polyvr
// scene updated, get cameras and nav presets
void VRGuiBits::update() {
    // update camera liststore
    VRScene* scene = VRSceneManager::get()->getActiveScene();
    setLabel("label24", "Project: None");
    if (scene == 0) return;

    vector<VRCamera*> cams = scene->getCameraMap();
    Glib::RefPtr<Gtk::ListStore> store = Glib::RefPtr<Gtk::ListStore>::cast_static(VRGuiBuilder()->get_object("cameras"));
    store->clear();
    int active;
    for (uint i=0; i<cams.size(); i++) {
        if (cams[i] == scene->getActiveCamera()) active = i;
        Gtk::ListStore::Row row = *store->append();
        gtk_list_store_set (store->gobj(), row.gobj(), 0, cams[i]->getName().c_str(), -1);
    }

    // set active cam active
    Gtk::ComboBox* cb;
    VRGuiBuilder()->get_widget("combobox4", cb);
    cb->set_active(active);

    // update nav_presets liststore
    map<string, VRNavPreset*>::iterator itr;
    map<string, VRNavPreset*> presets = scene->getPresets();
    store = Glib::RefPtr<Gtk::ListStore>::cast_static(VRGuiBuilder()->get_object("nav_presets"));
    store->clear();
    for (itr = presets.begin(); itr != presets.end(); itr++) {
        Gtk::ListStore::Row row = *store->append();
        gtk_list_store_set (store->gobj(), row.gobj(), 0, itr->first.c_str(), -1);
        //if (itr->second) itr->second->setScene(scene);
    }

    // set first element active
    VRGuiBuilder()->get_widget("combobox9", cb);
    cb->set_active(0);

    // update setup and project label
    cout << " now running: " << scene->getName() << endl;
    setLabel("label24", "Project: " + scene->getName());
}
コード例 #4
0
ファイル: VRGuiBits.cpp プロジェクト: TobiasHue/polyvr
void VRGuiBits_on_internal_update(int i) {
    VRInternalMonitor* mnr = VRInternalMonitor::get();
    Glib::RefPtr<Gtk::ListStore> store = Glib::RefPtr<Gtk::ListStore>::cast_static(VRGuiBuilder()->get_object("liststore4"));
    store->clear();

    map<string, string> vars = mnr->getVariables();
    map<string, string>::iterator itr;
    for (itr = vars.begin(); itr != vars.end(); itr++) {
        Gtk::ListStore::Row row = *store->append();
        gtk_list_store_set (store->gobj(), row.gobj(), 0, itr->first.c_str(), -1);
        gtk_list_store_set (store->gobj(), row.gobj(), 1, itr->second.c_str(), -1);
    }
}
コード例 #5
0
ファイル: VRGuiNav.cpp プロジェクト: Pfeil/polyvr
void VRGuiNav::on_new_preset_clicked() {
    auto scene = VRSceneManager::getCurrent();
    if (scene == 0) return;
    VRNavPreset* preset = new VRNavPreset();
    scene->addNavigation(preset);
    preset->setTarget(scene->getActiveCamera());

    Glib::RefPtr<Gtk::ListStore> store = Glib::RefPtr<Gtk::ListStore>::cast_static(VRGuiBuilder()->get_object("nav_presets"));
    Gtk::ListStore::Row row = *store->append();
    gtk_list_store_set (store->gobj(), row.gobj(), 0, preset->getName().c_str(), -1);

    setComboboxLastActive("combobox5");
}
コード例 #6
0
ファイル: VRGuiNet.cpp プロジェクト: uagmw/polyvr
void VRGuiNet_updateList() {
    auto scene = VRSceneManager::getCurrent();
    if (scene == 0) return;

    // update script list
    Glib::RefPtr<Gtk::ListStore> store = Glib::RefPtr<Gtk::ListStore>::cast_static(VRGuiBuilder()->get_object("Sockets"));
    store->clear();

    map<string, VRSocket*> sockets = scene->getSockets();
    map<string, VRSocket*>::iterator itr;
    for (itr = sockets.begin(); itr != sockets.end(); itr++) {
        Gtk::ListStore::Row row = *store->append();
        VRSocket* socket = itr->second;
        gtk_list_store_set(store->gobj(), row.gobj(), 0, socket->getType().c_str(), -1);
        gtk_list_store_set(store->gobj(), row.gobj(), 1, socket->getPort(), -1);
        gtk_list_store_set(store->gobj(), row.gobj(), 2, socket->getIP().c_str(), -1);
        gtk_list_store_set(store->gobj(), row.gobj(), 3, socket->getCallback().c_str(), -1);
        gtk_list_store_set(store->gobj(), row.gobj(), 4, socket->getSignal()->getName().c_str(), -1);
        gtk_list_store_set(store->gobj(), row.gobj(), 5, socket->getName().c_str(), -1);
        gtk_list_store_set(store->gobj(), row.gobj(), 6, socket, -1);
        gtk_list_store_set(store->gobj(), row.gobj(), 7, socket->isClient(), -1);
    }
}
コード例 #7
0
ファイル: VRGuiNav.cpp プロジェクト: TobiasHue/polyvr
void VRGuiNav_on_preset_changed(GtkComboBox* cb, gpointer data) {
    VRNavPreset* preset = VRSceneManager::get()->getActiveScene()->getPreset(getComboboxText("combobox5"));
    if (preset == 0) return;

    //get binding type liststore
    Glib::RefPtr<Gtk::ListStore> store = Glib::RefPtr<Gtk::ListStore>::cast_static(VRGuiBuilder()->get_object("binding_types"));

    //TODO: get all bindings from preset and update nav_bindings
    navBindings_store->clear();
    for (uint i=0; i<preset->getBindings().size(); i++) {
        VRNavBinding b = preset->getBindings()[i];

        string type = "Event";
        if (b.doRepeat) type = "State";

        Gtk::ListStore::Row row = *navBindings_store->append();
        gtk_list_store_set (navBindings_store->gobj(), row.gobj(), 0, b.key, -1);
        gtk_list_store_set (navBindings_store->gobj(), row.gobj(), 1, b.state, -1);
        gtk_list_store_set (navBindings_store->gobj(), row.gobj(), 2, type.c_str(), -1);
        gtk_list_store_set (navBindings_store->gobj(), row.gobj(), 3, b.cb->getName().c_str(), -1);
        gtk_list_store_set (navBindings_store->gobj(), row.gobj(), 4, NULL, -1);
    }
}
コード例 #8
0
ファイル: VRGuiNav.cpp プロジェクト: Pfeil/polyvr
// scene updated, get cameras && nav presets
void VRGuiNav::update() {
    auto scene = VRSceneManager::getCurrent();
    if (scene == 0) return;

    Glib::RefPtr<Gtk::ListStore> combo_list;
    combo_list = Glib::RefPtr<Gtk::ListStore>::cast_static(VRGuiBuilder()->get_object("binding_callbacks"));
        // get navigator callback library!
    combo_list->clear();
    for (auto cb : scene->getNavigationCallbacks()) {
        Gtk::ListStore::Row row = *combo_list->append();
        gtk_list_store_set(combo_list->gobj(), row.gobj(), 0, cb.first.c_str(), -1);
    }

    setComboboxLastActive("combobox5");
    setCombobox("combobox5", getListStorePos( "nav_presets", scene->getActiveNavigation() ) );
}
コード例 #9
0
ファイル: VRGuiNav.cpp プロジェクト: TobiasHue/polyvr
void VRGuiNav_on_new_preset_clicked(GtkButton* b, gpointer d) {
    VRNavPreset* preset = new VRNavPreset();
    VRScene* scene = VRSceneManager::get()->getActiveScene();

    string name = "preset"; //TODO: dialog with name, and copy from other scene options
    scene->addPreset(preset, name);

    //preset->setDevice(VRMouse::get());
    preset->setTarget(scene->getActiveCamera());

    Glib::RefPtr<Gtk::ListStore> store = Glib::RefPtr<Gtk::ListStore>::cast_static(VRGuiBuilder()->get_object("nav_presets"));
    Gtk::ListStore::Row row = *store->append();
    gtk_list_store_set (store->gobj(), row.gobj(), 0, name.c_str(), -1);

    setComboboxLastActive("combobox5");
}
コード例 #10
0
ファイル: VRGuiNav.cpp プロジェクト: TobiasHue/polyvr
// scene updated, get cameras and nav presets
void VRGuiNav::update() {
    VRScene* scene = VRSceneManager::get()->getActiveScene();
    if (scene == 0) return;

    Glib::RefPtr<Gtk::ListStore> combo_list;
    combo_list = Glib::RefPtr<Gtk::ListStore>::cast_static(VRGuiBuilder()->get_object("binding_callbacks"));
        // get navigator callback library!
    map<string, VRDevCb*> cbs = scene->getCallbacks();
    map<string, VRDevCb*>::iterator itr;
    combo_list->clear();
    for (itr = cbs.begin(); itr != cbs.end(); itr++) {
        Gtk::ListStore::Row row = *combo_list->append();
        gtk_list_store_set(combo_list->gobj(), row.gobj(), 0, itr->first.c_str(), -1);
    }

    setComboboxLastActive("combobox5");
}
コード例 #11
0
ファイル: VRGuiBits.cpp プロジェクト: TobiasHue/polyvr
VRGuiBits::VRGuiBits() {
    setComboboxCallback("combobox4", VRGuiBits_on_camera_changed);
    setComboboxCallback("combobox9", VRGuiBits_on_navigation_changed);

    setToolButtonCallback("toolbutton4", VRGuiBits_on_save_clicked);
    setToolButtonCallback("toolbutton3", VRGuiBits_on_quit_clicked);
    setToolButtonCallback("toolbutton17", VRGuiBits_on_about_clicked);
    setToolButtonCallback("toolbutton18", VRGuiBits_on_internal_clicked);

    setButtonCallback("button14", VRGuiBits_on_new_cancel_clicked);
    setButtonCallback("button21", VRGuiBits_on_internal_close_clicked);

    setLabel("label24", "Project: None");

    // About Dialog

    Gtk::AboutDialog* diag;
    VRGuiBuilder()->get_widget("aboutdialog1", diag);
    diag->signal_response().connect( sigc::mem_fun(*this, &VRGuiBits::hideAbout) );
    ifstream f("ressources/gui/authors");
    vector<string> authors;
    for (string line; getline(f, line); ) authors.push_back(line);
    f.close();
    diag->set_authors(authors);

    // window fullscreen
    Gtk::Window* win;
    VRGuiBuilder()->get_widget("window1", win);
    win->signal_key_press_event().connect( sigc::mem_fun(*this, &VRGuiBits::toggleFullscreen) );

    // VTE

    GtkWidget* vte = vte_terminal_new();
    terminal = VTE_TERMINAL (vte);

    vte_terminal_set_background_transparent(terminal, FALSE);
    vte_terminal_set_scrollback_lines(terminal, -1);
    vte_terminal_set_size(terminal, 80, 20);

    char** argv=NULL;
    g_shell_parse_argv("/bin/bash", NULL, &argv, NULL);
    vte_terminal_fork_command_full(terminal, VTE_PTY_DEFAULT, NULL, argv, NULL, GSpawnFlags(0), NULL, NULL, NULL, NULL);

    vte_terminal_set_scroll_on_keystroke(terminal, TRUE);
    gtk_widget_set_size_request(vte, -1, 100);

    GtkWidget* scrollbar = gtk_vscrollbar_new(vte_terminal_get_adjustment(terminal));
    term_box = gtk_hbox_new(FALSE, 0);
    gtk_box_pack_start(GTK_BOX(term_box), vte, FALSE, TRUE, 0);
    gtk_box_pack_start(GTK_BOX(term_box), scrollbar, FALSE, FALSE, 0);

    Gtk::VPaned* paned;
    VRGuiBuilder()->get_widget("vpaned1", paned);
    gtk_paned_pack2(GTK_PANED (paned->gobj()), term_box, FALSE, FALSE);

    vte_terminal_get_emulation(VTE_TERMINAL (vte));

    gtk_widget_show (term_box);
    gtk_widget_show (vte);

    //int pos = paned->property_max_position () - 100;
    //paned->set_position(pos);

    VRFunction<int>* fkt = new VRFunction<int>( "IntMonitor_guiUpdate", VRGuiBits_on_internal_update );
    VRSceneManager::get()->addUpdateFkt(fkt);

    // view options
    setComboboxCallback("combobox20", VRGuiBits_on_viewoption_changed);
    Glib::RefPtr<Gtk::ListStore> opt_list = Glib::RefPtr<Gtk::ListStore>::cast_static(VRGuiBuilder()->get_object("view_options"));
    opt_list->clear();
    Gtk::ListStore::Row row;
    row = *opt_list->append();
    gtk_list_store_set (opt_list->gobj(), row.gobj(), 0, "referentials", -1);
    gtk_list_store_set (opt_list->gobj(), row.gobj(), 1, 0, -1);
    row = *opt_list->append();
    gtk_list_store_set (opt_list->gobj(), row.gobj(), 0, "setup", -1);
    gtk_list_store_set (opt_list->gobj(), row.gobj(), 1, 0, -1);
    row = *opt_list->append();
    gtk_list_store_set (opt_list->gobj(), row.gobj(), 0, "lights and cameras", -1);
    gtk_list_store_set (opt_list->gobj(), row.gobj(), 1, 0, -1);
}