void VRGuiBits_on_internal_clicked(GtkButton* cb, gpointer data) { Gtk::Dialog* diag; VRGuiBuilder()->get_widget("dialog2", diag); cout << "\nPRINT NAME MAP" << flush; VRName::printNameDict(); diag->run(); }
void MainWindow::OnMenuAbout() { Gtk::Dialog *pDialog = NULL; builder->get_widget("zzz_about_dialog", pDialog); if(pDialog) { pDialog->set_transient_for(*this); pDialog->run(); pDialog->hide(); } }
void View::show_dialog(const char *name) { Gtk::Dialog *dialog; m_builder->get_widget (name, dialog); if (!dialog) { cerr << "no such dialog " << name << "\n"; return; } dialog->signal_response().connect (sigc::bind(sigc::mem_fun(*this, &View::hide_on_response), dialog)); dialog->show(); dialog->set_transient_for (*this); }
void VRConceptWidget::on_edit_prop_clicked() { if (!selected_property) return; Gtk::Dialog* dialog; VRGuiBuilder()->get_widget("PropertyEdit", dialog); setTextEntry("entry23", selected_property->getName()); setTextEntry("entry24", selected_property->type); dialog->show(); if (dialog->run() == Gtk::RESPONSE_OK) { selected_property->setName( getTextEntry("entry23") ); selected_property->type = getTextEntry("entry24"); saveScene(); } dialog->hide(); update(); }
std::string DialogBoxFactory::showTextEntryDialog(Glib::ustring MessageText, Glib::ustring LabelText) { Gtk::Dialog Dialog; Gtk::Label Message(MessageText); Gtk::Label Label(LabelText); Gtk::Entry Entry; Gtk::HBox Box; Box.pack_start(Label); Box.pack_start(Entry); Dialog.get_vbox()->pack_start(Message, true, true, 10); Dialog.get_vbox()->pack_start(Box, true, true, 10); Dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); Dialog.add_button(Gtk::Stock::OK, Gtk::RESPONSE_OK); Dialog.show_all_children(); if (Dialog.run() == Gtk::RESPONSE_OK) return Entry.get_text(); return ""; }
void SetDialogStrict(Gtk::Dialog& dlg, int min_wdh, int min_hgt, bool set_resizable) { dlg.set_resizable(set_resizable); // чтоб при закрытии экспандера диалог уменьшался // размер окна пошире GdkGeometry geom; geom.min_width = min_wdh; geom.min_height = min_hgt; gtk_window_set_geometry_hints(static_cast<Gtk::Window&>(dlg).gobj(), 0, &geom, GDK_HINT_MIN_SIZE); }
void DocumentProperties::onNewExtraField () { Gtk::Dialog dialog ("New Field", *dialog_, true, false); Gtk::VBox *vbox = dialog.get_vbox (); Gtk::HBox hbox; hbox.set_spacing (12); vbox->pack_start (hbox, true, true, 0); Gtk::Label label ("Field name:", false); hbox.pack_start (label, false, false, 0); Gtk::Entry entry; entry.set_activates_default (true); hbox.pack_start (entry, true, true, 0); dialog.add_button (Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); dialog.add_button (Gtk::Stock::OK, Gtk::RESPONSE_ACCEPT); dialog.set_default_response (Gtk::RESPONSE_ACCEPT); dialog.show_all (); vbox->set_border_width (12); if (dialog.run () == Gtk::RESPONSE_ACCEPT) { Gtk::ListStore::iterator it = extrafieldsstore_->children().begin (); Gtk::ListStore::iterator const end = extrafieldsstore_->children().end (); bool key_isnew = true; for (; it != end; ++it) if (Utility::firstCap ((*it)[extrakeycol_]) == Utility::firstCap (entry.get_text ())) { key_isnew = false; } if ( key_isnew ) { Gtk::ListStore::iterator row = extrafieldsstore_->append (); (*row)[extrakeycol_] = Utility::firstCap (entry.get_text ()); (*row)[extravalcol_] = ""; } else { Glib::ustring message; message = String::ucompose ( "<b><big>%1</big></b>", _("This key already exists.\n")); Gtk::MessageDialog dialog ( message, true, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_CLOSE, true); dialog.run (); } } }
void VRGuiBits_on_internal_close_clicked(GtkButton* cb, gpointer data) { Gtk::Dialog* diag; VRGuiBuilder()->get_widget("dialog2", diag); diag->hide(); }
int main(int argc, char *argv[]) { memset(&last_refreshed, 0, sizeof(last_refreshed)); for(int i = 1; i < argc; i++) { string tmp(argv[i]); if(tmp == "-s")display_spectrum = true; if(tmp == "-S")display_spectrogram = true; } Util.ChDir(Util.GetDirFromPath(Util.GetProgramPath())); //goto aaaaa; //fft=rfftw_create_plan(8192, for(UInt i = 0; i < CHANNELS; i++) { FFTFilter<jack_default_audio_sample_t>* trololo = new FFTFilter<jack_default_audio_sample_t> //bs, inbuffers, outbuffers, overlap,buffersperperiod, paddingL,paddingR, fftsize (1024, 12, 12, 2, 8, 0, 0, 8192); //trololo->freq_scale=9./10.; setFilterParams(*trololo); filt[i] = trololo; } jack_set_error_function(error); JackStatus st; if((client = jack_client_open("jackfft", JackNoStartServer, &st)) == 0) { fprintf(stderr, "could not connect to server: status %i\n", st); return 1; } jack_set_process_callback(client, process, 0); jack_on_shutdown(client, jack_shutdown, 0); printf("engine sample rate: %u\n", srate = jack_get_sample_rate(client)); /* create ports */ int i; for(i = 0; i < CHANNELS; i++) { inputs.push_back(jack_port_register(client, CONCAT("input_" << i).c_str(), JACK_DEFAULT_AUDIO_TYPE, JackPortIsInput, 0)); outputs.push_back(jack_port_register(client, CONCAT("output_" << i).c_str(), JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, 0)); #ifdef JACKFFT_USE_SOUNDTOUCH soundTouch[i].setSampleRate(srate); soundTouch[i].setChannels(1); #endif } //aaaaa: Gtk::Main kit(argc, argv); b = Gtk::Builder::create_from_file("main2.ui"); Gtk::Window* window1; Gtk::Button* b_save; Gtk::Button* b_saveas; Gtk::Button* b_open; Gtk::Button* b_revert; Gtk::Button* b_apply; Gtk::Button* b_params; Gtk::Button* b_shift; Gtk::CheckButton* c_pitchshift; Gtk::CheckButton* c_spectrum; Gtk::CheckButton* c_spectrogram; Gtk::CheckButton* c_spectrogram1; Gtk::CheckButton* c_spectrum2; Gtk::CheckButton* c_mux; Gtk::Label* label8; Gtk::FileChooserDialog* filechooserdialog1; Gtk::Viewport* viewport1; Gtk::Viewport* viewport2; Gtk::Viewport* viewport4; Gtk::Scale* s_mux; //get controls JACKFFT_GETWIDGET(window1); JACKFFT_GETWIDGET(b_save); JACKFFT_GETWIDGET(b_saveas); JACKFFT_GETWIDGET(b_open); JACKFFT_GETWIDGET(b_revert); JACKFFT_GETWIDGET(b_apply); JACKFFT_GETWIDGET(c_pitchshift); JACKFFT_GETWIDGET(label8); JACKFFT_GETWIDGET(b_params); JACKFFT_GETWIDGET(b_shift); JACKFFT_GETWIDGET(filechooserdialog1); JACKFFT_GETWIDGET(viewport1); JACKFFT_GETWIDGET(viewport2); JACKFFT_GETWIDGET(c_spectrum); JACKFFT_GETWIDGET(c_spectrum2); JACKFFT_GETWIDGET(s_mux); JACKFFT_GETWIDGET(c_mux); JACKFFT_GETWIDGET(viewport4); JACKFFT_GETWIDGET(c_spectrogram); JACKFFT_GETWIDGET(c_spectrogram1); //initialize controls b_save->signal_clicked().connect(&save); b_saveas->signal_clicked().connect(&saveas); b_open->signal_clicked().connect(&loadfile); b_revert->signal_clicked().connect(&load); b_apply->signal_clicked().connect(&apply_pitchshift); c_pitchshift->signal_toggled().connect(&apply_pitchshift); c = new EQControl(EQ_POINTS); c->Change += EQControl::ChangeDelegate(&on_change, c); c->MouseMove += EQControl::MouseDelegate(&on_mousemove, c); #ifdef CEPSTRUM c_eq2 = new EQControl(EQ_POINTS); c_eq2->Change += EQControl::ChangeDelegate(&on_change, c_eq2); c_eq2->MouseMove += EQControl::MouseDelegate(&on_mousemove, c_eq2); #endif //UInt complexsize = (UInt)(((FFTFilter<jack_default_audio_sample_t>*)filt[0])->PeriodSize() / 2) + 1; apply_label_workaround(label8); b_params->signal_clicked().connect([]() { Gtk::Window* w1; Gtk::Dialog* d; b->get_widget("window1", w1); b->get_widget("dialog1", d); d->set_transient_for(*w1); if(d->run() != RESPONSE_APPLY)goto hhhhh; FFTFilter<jack_default_audio_sample_t>** tmp; tmp = new FFTFilter<jack_default_audio_sample_t>*[CHANNELS]; Int bs, overlap, bpp, padding1, padding2, fftsize; Gtk::Entry* ent; b->get_widget("t_bs", ent); bs = atoi(ent->get_text().c_str()); b->get_widget("t_overlap", ent); overlap = atoi(ent->get_text().c_str()); b->get_widget("t_bpp", ent); bpp = atoi(ent->get_text().c_str()); b->get_widget("t_padding1", ent); padding1 = atoi(ent->get_text().c_str()); b->get_widget("t_padding2", ent); padding2 = atoi(ent->get_text().c_str()); b->get_widget("t_fftsize", ent); fftsize = atoi(ent->get_text().c_str()); Int buffers; buffers = (bpp + padding1 + padding2) + 4; for(int i = 0; i < CHANNELS; i++) { tmp[i] = new FFTFilter<jack_default_audio_sample_t> //bs, inbuffers, outbuffers, overlap,buffersperperiod, padding1,padding2 fftsize (bs, buffers, buffers, overlap,bpp, padding1,padding2, fftsize); setFilterParams(*(tmp[i])); } update_fft(tmp); apply_pitchshift1(tmp); filt2 = tmp; //assumed to be atomic on all cpus, otherwise the cpu sucks and is not supported hhhhh: d->hide(); }); b_shift->signal_clicked().connect([]() { Gtk::Window* w1; Gtk::Dialog* d; b->get_widget("window1", w1); b->get_widget("dialog_shift", d); d->set_transient_for(*w1); if(d->run() != RESPONSE_OK)goto hhhhh; Gtk::Entry* ent; b->get_widget("t_x", ent); double x; x = atof(ent->get_text().c_str()); for(Int i=0;i<EQ_POINTS;i++) { c->data[i]=scale_value_r(scale_value(c->data[i])*pow(2,x)); } c->do_draw(); update_fft(); hhhhh: d->hide(); }); //d->signal_response().connect(&on_response); filechooserdialog1->add_button(Stock::CANCEL, RESPONSE_CANCEL); viewport1->add(*c); //c->set_hexpand(true); //c->set_vexpand(true); c->show(); #ifdef CEPSTRUM Gtk::Viewport* vp_eq2; b->get_widget("vp_eq2", vp_eq2); vp_eq2->add(*c_eq2); c_eq2->show(); #endif //if(display_spectrum) //{ c2 = new EQControl(EQ_POINTS); viewport2->add(*c2); c2->show(); c2->MouseMove += EQControl::MouseDelegate(&on_mousemove, c2); c3 = new HistoryControl(SPECTROGRAM_LEN,EQ_POINTS); c3->show(); viewport4->add(*c3); /*} else { Gtk::Table* t1; b->get_widget("table1",t1); t1->remove(*v); }*/ //spectrum display c_spectrum->set_active(display_spectrum); viewport2->set_visible(display_spectrum); c_spectrum->signal_toggled().connect([c_spectrum]() { Gtk::Window* w1; Gtk::Viewport* v; b->get_widget("window1", w1); b->get_widget("viewport1", v); gint ww,wh; w1->get_size(ww,wh); if(display_spectrum && !c_spectrum->get_active()) { w1->resize(ww,wh-v->get_allocation().get_height()); } else if(!display_spectrum && c_spectrum->get_active()) { w1->resize(ww,wh+v->get_allocation().get_height()); } display_spectrum = c_spectrum->get_active(); Gtk::Viewport* vp; b->get_widget("viewport2", vp); vp->set_visible(display_spectrum); }); //spectrogram display c_spectrogram->set_active(display_spectrogram); viewport4->set_visible(display_spectrogram); c_spectrogram->signal_toggled().connect([c_spectrogram]() { Gtk::Window* w1; Gtk::Viewport* v; b->get_widget("window1", w1); b->get_widget("viewport1", v); gint ww,wh; w1->get_size(ww,wh); if(display_spectrogram && !c_spectrogram->get_active()) { w1->resize(ww,wh-v->get_allocation().get_height()); } else if(!display_spectrogram && c_spectrogram->get_active()) { w1->resize(ww,wh+v->get_allocation().get_height()); } display_spectrogram = c_spectrogram->get_active(); Gtk::Viewport* vp; b->get_widget("viewport4", vp); vp->set_visible(display_spectrogram); }); //spectrogram output c_spectrogram1->set_active(output_spectrogram); c_spectrogram1->signal_toggled().connect([c_spectrogram1]() { if(output_spectrogram && !c_spectrogram1->get_active()) { disableSpectrogramOutput(); } else if(!output_spectrogram && c_spectrogram1->get_active()) { enableSpectrogramOutput(); } wmb(); output_spectrogram=c_spectrogram1->get_active(); }); c_spectrum2->set_active(spectrum2); c_spectrum2->signal_toggled().connect([c_spectrum2]() { spectrum2 = c_spectrum2->get_active(); }); c_mux->set_active(do_mux); Gtk::Adjustment adj_mux(v_mux,0,1,0.01); s_mux->set_adjustment(adj_mux); auto update_mux=[&]() { do_mux=c_mux->get_active(); v_mux=adj_mux.get_value(); }; s_mux->signal_value_changed().connect(update_mux); c_mux->signal_toggled().connect(update_mux); load(); if(jack_activate(client)) { fprintf(stderr, "cannot activate client"); return 1; } g_thread_init (NULL); gdk_threads_init(); //glib_threads_init(); pthread_t thr; pthread_create(&thr,NULL,&thread1,NULL); gdk_threads_enter(); kit.run(*window1); gdk_threads_leave(); jack_client_close(client); return 0; }
void MenuWidget::OnConstantItemActivated(const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn* /* column */) { Gtk::TreeModel::iterator iter = m_ConstantTableTreeModel->get_iter(path); if (iter) { Gtk::TreeModel::Row row = *iter; if (!iter->parent()->get_stamp() || !iter->parent()->parent()->get_stamp()) return; // Not good; std::cout << "Row activated: Name=" << row->get_value(m_TableColumn) << std::endl; for (unsigned int p = 0; p < m_arrShaderPassDesc.size(); p++) { if (m_arrShaderPassDesc[p].name == row->parent()->parent()->get_value(m_TableColumn)) { for (unsigned int i = 0; i < m_arrShaderPassDesc[p].constants.size(); i++) { if (m_arrShaderPassDesc[p].constants[i].name == row->get_value(m_TableColumn)) { switch (m_arrShaderPassDesc[p].constants[i].inputType) { case IT_BOOL: case IT_FLOAT: case IT_INT: { Gtk::Dialog matrixDialog; Gtk::VBox rowBox; Gtk::HBox colBox[4]; Gtk::Entry entry[16]; for (unsigned int j = 0; j < 16; j++) { char temp[32]; sprintf_s(temp, "%f", m_arrShaderPassDesc[p].constants[i].valueFloat[j]); entry[j].set_text(temp); } unsigned int rows = m_arrShaderPassDesc[p].constants[i].rows; unsigned int cols = m_arrShaderPassDesc[p].constants[i].cols; unsigned int sizeOfArray = m_arrShaderPassDesc[p].constants[i].sizeOfArray; matrixDialog.get_vbox()->pack_start(rowBox); for (unsigned int r = 0; r < rows; r++) { rowBox.pack_start(colBox[r]); for (unsigned int c = 0; c < cols; c++) { colBox[r].pack_start(entry[r*cols + c]); } } matrixDialog.add_button(GTK_STOCK_OK, Gtk::RESPONSE_OK); matrixDialog.set_modal(); matrixDialog.show_all(); int ret = matrixDialog.run(); if (ret == Gtk::RESPONSE_OK) for (unsigned int r = 0; r < rows; r++) for (unsigned int c = 0; c < cols; c++) { m_arrShaderPassDesc[p].constants[i].valueFloat[r*cols + c] = (float)atof(entry[r*cols + c].get_text().c_str()); } break; } case IT_SAMPLER: case IT_SAMPLER1D: case IT_SAMPLER2D: case IT_SAMPLER3D: case IT_SAMPLERCUBE: { Gtk::FileChooserDialog textureDialog("Choose texture file"); textureDialog.add_button("Select", Gtk::RESPONSE_OK); int ret = textureDialog.run(); if (ret == Gtk::RESPONSE_OK) { Renderer* render = Renderer::GetInstance(); ResourceManager* resMan = render->GetResourceManager(); const unsigned int texIdx = resMan->CreateTexture(textureDialog.get_filename().c_str()); m_arrShaderPassDesc[p].constants[i].sampler.boundTexture = resMan->GetTexture(texIdx); } break; } default: return; } return; } } return; } } } }
aboutDialog::aboutDialog() { Gtk::Dialog *ad = this; Gtk::Button *okbutton = Gtk::manage(new class Gtk::Button("ok")); Gtk::Label *aboutLabel = Gtk::manage(new class Gtk::Label( "About " + GPD->sGUI_CLIENT() + " " + GPD->sVERSION() + ", build " + GPD->sBUILD() )); Gtk::TextView *textview = Gtk::manage(new class Gtk::TextView()); Gtk::ScrolledWindow *scrolledwindow = Gtk::manage(new class Gtk::ScrolledWindow()); Gtk::VBox *vbox = Gtk::manage(new class Gtk::VBox(false, 0)); okbutton->set_flags(Gtk::CAN_FOCUS); okbutton->set_relief(Gtk::RELIEF_NORMAL); ad->get_action_area()->property_layout_style().set_value(Gtk::BUTTONBOX_END); ad->set_default_size(300, 200); aboutLabel->set_alignment(0.5,0.5); aboutLabel->set_padding(0,0); aboutLabel->set_justify(Gtk::JUSTIFY_LEFT); aboutLabel->set_line_wrap(false); aboutLabel->set_use_markup(false); aboutLabel->set_selectable(false); textview->set_flags(Gtk::CAN_FOCUS); textview->set_editable(true); textview->set_cursor_visible(true); textview->set_pixels_above_lines(0); textview->set_pixels_below_lines(0); textview->set_pixels_inside_wrap(0); textview->set_left_margin(0); textview->set_right_margin(0); textview->set_indent(0); textview->set_wrap_mode(Gtk::WRAP_NONE); textview->set_justification(Gtk::JUSTIFY_LEFT); using namespace std; string text; text += "btg Copyright (C) 2005 Michael Wojciechowski."; text += GPD->sNEWLINE(); text += "This program is free software; you can redistribute it and/or modify"; text += GPD->sNEWLINE(); text += "it under the terms of the GNU General Public License as published by "; text += GPD->sNEWLINE(); text += "the Free Software Foundation; either version 2 of the License, or "; text += GPD->sNEWLINE(); text += "(at your option) any later version."; text += GPD->sNEWLINE(); text += "This program is distributed in the hope that it will be useful, "; text += GPD->sNEWLINE(); text += "but WITHOUT ANY WARRANTY; without even the implied warranty of "; text += GPD->sNEWLINE(); text += "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the "; text += GPD->sNEWLINE(); text += "GNU General Public License for more details."; text += GPD->sNEWLINE(); text += "You should have received a copy of the GNU General Public License "; text += GPD->sNEWLINE(); text += "along with this program; if not, write to the Free Software "; text += GPD->sNEWLINE(); text += "Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA"; text += GPD->sNEWLINE(); textview->get_buffer()->set_text(text); scrolledwindow->set_flags(Gtk::CAN_FOCUS); scrolledwindow->set_shadow_type(Gtk::SHADOW_IN); scrolledwindow->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); scrolledwindow->property_window_placement().set_value(Gtk::CORNER_TOP_LEFT); scrolledwindow->add(*textview); vbox->pack_start(*aboutLabel, Gtk::PACK_SHRINK, 0); vbox->pack_start(*scrolledwindow); ad->get_vbox()->set_homogeneous(false); ad->get_vbox()->set_spacing(0); ad->get_vbox()->pack_start(*vbox); //ad->set_title( "About " + GPD->sGUI_CLIENT() + " " + GPD->sVERSION() ); ad->set_title( GPD->sGUI_CLIENT() + " " + GPD->sVERSION() + " / About" ); ad->set_modal(true); ad->property_window_position().set_value(Gtk::WIN_POS_CENTER); ad->set_resizable(true); ad->property_destroy_with_parent().set_value(false); ad->set_has_separator(true); ad->add_action_widget(*okbutton, -5); okbutton->show(); aboutLabel->show(); textview->show(); scrolledwindow->show(); vbox->show(); okbutton->signal_clicked().connect(sigc::mem_fun(*this, &aboutDialog::on_ok_clicked)); // ad->show(); }