// Function executed after the map has been solved void MapWindow::on_notification_from_worker_thread() { if (m_WorkerThread && worker.has_stopped()) { // Show a window dialog if there is no solution if( !worker.get_solution_exists() ) { DialogWindow.notification(); Gtk::MessageDialog *dlg = new Gtk::MessageDialog("No solution exists."); dlg->run(); delete dlg; } // Work is done. m_WorkerThread->join(); m_WorkerThread = NULL; // Update buttons m_Button_Solve.set_sensitive(false); m_Button_File.set_sensitive(true); // Force the on_draw function m_draw.queue_draw(); // Hide the spinner window DialogWindow.notification(); } }
void PredicateDialog::onAddPredicate() { SimpleTypeBox box( ("New predicate name?"), ""); std::string name = boost::trim_copy(box.run()); if (box.valid() and checkName(name)) { setSensitivePredicate(false); Gtk::TreeIter iter = m_model->append(); if (iter) { savePreviousPredicate(mPredicateNameEntry->get_text()); mPredicateNameEntry->set_text(name); Gtk::ListStore::Row row = *iter; row[m_viewscolumnrecord.name] = name; mTextViewFunction->get_buffer()->set_text(""); mHeaderPred->set_text( "bool " + name + "() const {" ); m_iter = iter; mTreePredicateList->set_cursor(m_model->get_path(iter)); mPredicateName.push_back(name); setSensitivePredicate(true); } } else { Gtk::MessageDialog errorDial ("Name error !", false, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true); errorDial.set_title("Error !"); errorDial.run(); } }
void MainSynthWindow::onDspEntryActivate (void) { gthPatchManager *patchMgr = gthPatchManager::instance(); string dspfile = dspEntry_.get_text(); int pagenum = notebook_.get_current_page(); /* noop caused by a spurious Enter */ if (dspfile == "") return; if (patchMgr->newPatch(dspfile, pagenum) == false) { char *error = g_strdup_printf("Couldn't load DSP %s; syntax error, or does not exist", dspfile.c_str()); Gtk::MessageDialog errorDialog (error, false, Gtk::MESSAGE_ERROR); errorDialog.run(); free(error); return; } notebook_.hide_all(); notebook_.pages().clear(); populate(); notebook_.show_all(); notebook_.set_current_page(pagenum); }
Glib::ustring Document::keyReplaceDialog ( Glib::ustring const &original, Glib::ustring const &replacement, const char *message_text) { Glib::ustring message = String::ucompose ( "<big><b>%1</b></big>\n\n%2", _("Key naming conflict"), String::ucompose ( message_text, original, replacement)); Gtk::MessageDialog dialog (message, true, Gtk::MESSAGE_QUESTION, Gtk::BUTTONS_NONE, true); Gtk::Button *button; button = dialog.add_button (_("_Ignore"), Gtk::RESPONSE_CANCEL); Gtk::Image *noImage = Gtk::manage (new Gtk::Image (Gtk::Stock::NO, Gtk::ICON_SIZE_BUTTON)); button->set_image (*noImage); button = dialog.add_button (_("_Replace"), Gtk::RESPONSE_ACCEPT); Gtk::Image *yesImage = Gtk::manage (new Gtk::Image (Gtk::Stock::YES, Gtk::ICON_SIZE_BUTTON)); button->set_image (*yesImage); dialog.set_default_response (Gtk::RESPONSE_ACCEPT); if (dialog.run () == Gtk::RESPONSE_ACCEPT) return replacement; else return original; }
void PredicateDialog::onRenamePredicate() { Glib::RefPtr < Gtk::TreeView::Selection > ref = mTreePredicateList-> get_selection(); if (ref) { Gtk::TreeModel::iterator iter = ref->get_selected(); if (iter) { Gtk::TreeModel::Row row = *iter; std::string oldName(row.get_value(m_viewscolumnrecord.name)); savePreviousPredicate(oldName); SimpleTypeBox box(("Predicate new name?"), ""); std::string name = boost::trim_copy(box.run()); if (box.valid() and checkName(name)) { setSensitivePredicate(false); m_model->erase(iter); Gtk::TreeModel::Children children = m_model->children(); m_iter = children.begin(); iter = m_model->append(); mPredicateNameEntry->set_text(name); Gtk::ListStore::Row row = *iter; row[m_viewscolumnrecord.name] = name; if (mPredicateFunction.find(oldName) != mPredicateFunction.end()) { mTextViewFunction->get_buffer()-> set_text(mPredicateFunction[oldName]); mPredicateFunction[name] = mPredicateFunction[oldName]; mPredicateFunction.erase(oldName); } mPredicateName.push_back(name); // Delete the element in the vector for (std::vector < std::string > ::iterator it = mPredicateName.begin(); it != mPredicateName.end(); ) { if ( *it == oldName ) { it = mPredicateName.erase(it); } else { ++it; } } mTreePredicateList->set_cursor(m_model->get_path(iter)); setSensitivePredicate(true); } else { Gtk::MessageDialog errorDial ("Name error !", false, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true); errorDial.set_title("Error !"); errorDial.run(); } } } }
void ShowMessage(const Glib::ustring& s, Gtk::Window* parent) { Gtk::MessageDialog* msg = new Gtk::MessageDialog(s); if(parent) msg->set_transient_for(*parent); msg->run(); delete msg; }
void View::alert (Gtk::MessageType t, const char *message, const char *secondary) { Gtk::MessageDialog dialog (*this, message, false /* markup */, t, Gtk::BUTTONS_CLOSE, true); if (secondary) dialog.set_secondary_text (secondary); dialog.run(); }
void LoginWindow::new_user_clicked() { if (login.get_text() != "" && pass.get_text() != "" && uc->addUser(login.get_text(), pass.get_text())) { Gtk::MessageDialog *info = new Gtk::MessageDialog("Konto utworzono"); info->set_modal(true); info->run(); delete info; } }
void MainSynthWindow::onPatchLoadError (const char* failure) { char *error = g_strdup_printf("Couldn't load patchfile %s; syntax error, or DSP does not exist", failure); Gtk::MessageDialog errorDialog (error, false, Gtk::MESSAGE_ERROR); errorDialog.run(); free(error); }
void Model::SendNow(string str) { if (rr_dev_fd (m_device) > 0) rr_dev_enqueue_cmd (m_device, RR_PRIO_HIGH, str.data(), str.size()); else { Gtk::MessageDialog dialog ("Can't send command", false, Gtk::MESSAGE_INFO, Gtk::BUTTONS_CLOSE); dialog.set_secondary_text ("You must first connect to a device!"); dialog.run (); } }
void show() { openfluid::core::UnitsCollection* TestUnitsColl = 0; if (!mp_SimulationBlob) { mp_Dialog->set_message("I am DummyModalWindow\n" "Nb of units in TestUnits class: no CoreRepository\n" "Nothing to do"); } else { unsigned int Size = 0; TestUnitsColl = mp_SimulationBlob->getCoreRepository().getUnits( "TestUnits"); if (TestUnitsColl) Size = TestUnitsColl->getList()->size(); mp_Dialog->set_message(Glib::ustring::compose("I am DummyModalWindow\n" "Nb of units in TestUnits class: %1\n" "Clicking ok will add a Unit of class \"TestUnits\"", Size)); } if (mp_Dialog->run() == Gtk::RESPONSE_OK && mp_SimulationBlob) { unsigned int NextId = 1; if (TestUnitsColl) { openfluid::core::UnitsList_t* TestUnits = TestUnitsColl->getList(); if (!TestUnits->empty()) { NextId = TestUnits->end().operator --()->getID() + 1; while (TestUnitsColl->getUnit(NextId)) NextId++; } } openfluid::core::Unit U("TestUnits", NextId, 1, openfluid::core::InstantiationInfo::DESCRIPTOR); mp_SimulationBlob->getCoreRepository().addUnit(U); signal_ChangedOccurs().emit(); } mp_Dialog->hide(); }
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 (); } } }
View *View::create(Model *model) { std::vector<std::string> dirs = Platform::getConfigPaths(); Glib::ustring ui; for (std::vector<std::string>::const_iterator i = dirs.begin(); i != dirs.end(); ++i) { std::string f_name = Glib::build_filename (*i, "repsnapper.ui"); Glib::RefPtr<Gio::File> file = Gio::File::create_for_path(f_name); try { char *ptr; gsize length; file->load_contents(ptr, length); ui = Glib::ustring(ptr); g_free(ptr); break; } catch(Gio::Error e) { switch(e.code()) { case Gio::Error::NOT_FOUND: continue; default: Gtk::MessageDialog dialog (_("Error reading UI description!!"), false, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_CLOSE); dialog.set_secondary_text(e.what()); dialog.run(); return NULL; } } } if(ui.empty()) { Gtk::MessageDialog dialog (_("Couldn't find UI description!"), false, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_CLOSE); dialog.set_secondary_text (_("Check that repsnapper has been correctly installed.")); dialog.run(); return NULL; } Glib::RefPtr<Gtk::Builder> builder; try { builder = Gtk::Builder::create_from_string(ui); } catch(const Gtk::BuilderError& ex) { Gtk::MessageDialog dialog (_("Error loading UI!"), false, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_CLOSE); dialog.set_secondary_text(ex.what()); dialog.run(); throw ex; } View *view = 0; builder->get_widget_derived("main_window", view); view->setModel (model); return view; }
void PhotoPreview::SetSilhouette() { try { Image=Gdk::Pixbuf::create_from_file(Cfg->GetSilhouetteImage()); } catch(...) { Gtk::MessageDialog *message = new Gtk::MessageDialog(_("Error reading data file: ")+Cfg->GetSilhouetteImage()+"\n", false,Gtk::MESSAGE_WARNING,Gtk::BUTTONS_OK,true); message->run(); delete message; return; } Redraw(); IsSilhouette=true; }
void LoginWindow::ok_clicked() { if (login_ok = uc->checkUser(login.get_text(), pass.get_text())) { hide(); } else { Gtk::MessageDialog *info = new Gtk::MessageDialog("Błędny login lub hasło."); info->set_modal(true); info->run(); delete info; } }
void catch_and_return_to_GUI_thread (void) { try { throw; } catch (const std::exception& e) { Gtk::MessageDialog dialog (e.what (), false, Gtk::MESSAGE_ERROR); dialog.set_keep_above (); dialog.run (); } }
void response(int Response) { if (Response == Gtk::RESPONSE_OK) { unsigned int NextId = 1; if (mp_TestUnitsColl) { openfluid::core::UnitsList_t* TestUnits = mp_TestUnitsColl->getList(); if (!TestUnits->empty()) { NextId = TestUnits->end().operator --()->getID() + 1; while (mp_TestUnitsColl->getUnit(NextId)) NextId++; } } openfluid::core::Unit U("TestUnits", NextId, 1, openfluid::core::InstantiationInfo::DESCRIPTOR); mp_SimulationBlob->getCoreRepository().addUnit(U); signal_ChangedOccurs().emit(); } else { mp_Dialog->hide(); signal_Hidden().emit(); } }
void MainSynthWindow::onBrowseButton (void) { gthPatchManager *patchMgr = gthPatchManager::instance(); int pagenum = notebook_.get_current_page(); Gtk::FileSelection fileSel("thinksynth - Load DSP"); if (prevDir_ != "") fileSel.set_filename(prevDir_); if (fileSel.run() == Gtk::RESPONSE_OK) { dspEntry_.set_text(fileSel.get_filename()); if (patchMgr->newPatch(fileSel.get_filename(), pagenum)) { string dn = thUtil::dirname((char*)fileSel.get_filename().c_str()); prevDir_ = dn + "/"; string **vals = new string *[2]; vals[0] = new string(prevDir_); vals[1] = NULL; gthPrefs *prefs = gthPrefs::instance(); prefs->Set("dspdir", vals); /* load up the patch file */ notebook_.hide_all(); notebook_.pages().clear(); populate(); notebook_.show_all(); notebook_.set_current_page(pagenum); } else { char *error = g_strdup_printf("Couldn't load DSP %s; syntax error, or does not exist", fileSel.get_filename().c_str()); Gtk::MessageDialog errorDialog (error, false, Gtk::MESSAGE_ERROR); errorDialog.run(); free(error); } } }
void DocumentProperties::onPasteBibtex () { GdkAtom const selection = GDK_SELECTION_CLIPBOARD; Glib::RefPtr<Gtk::Clipboard> clipboard = Gtk::Clipboard::get (selection); Glib::ustring clipboardtext = clipboard->wait_for_text (); DocumentList doclist; int const imported = doclist.import (clipboardtext, BibUtils::FORMAT_BIBTEX); DEBUG ("DocumentProperties::onPasteBibtex: Imported %1 references", imported); if (imported) { DocumentList::Container &docs = doclist.getDocs (); DocumentList::Container::iterator it = docs.begin (); /* * This will lose the key from the bibtex since it's * in Document not BibData */ Document doc; save(doc); doc.getBibData().mergeIn (it->getBibData()); update (doc); } else { Glib::ustring message; if (imported < 1) { message = String::ucompose ( "<b><big>%1</big></b>", _("No references found on clipboard.\n")); } else { message = String::ucompose ( "<b><big>%1</big></b>", _("Multiple references found on clipboard.\n")); } Gtk::MessageDialog dialog ( message, true, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_CLOSE, true); dialog.run (); } }
DummyModelessWindow() : mp_TestUnitsColl(0) { mp_Dialog = new Gtk::MessageDialog("", false, Gtk::MESSAGE_QUESTION, Gtk::BUTTONS_OK_CANCEL, false); mp_Dialog->signal_response().connect(sigc::mem_fun(*this, &DummyModelessWindow::response)); }
void show_dialog() const { Gtk::MessageDialog* dialog = new Gtk::MessageDialog( m_simple_desc, false, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_NONE, false); dialog->add_button(Gtk::Stock::CLOSE, Gtk::RESPONSE_CLOSE); dialog->set_secondary_text(m_detail_desc, true); dialog->signal_response().connect( sigc::hide( sigc::bind( sigc::ptr_fun(dispose_dialog), dialog))); dialog->show(); }
void show_dialog() const { Gtk::MessageDialog* dialog = new Gtk::MessageDialog( m_simple_desc, false, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_NONE, false); Gtk::Window* parent = NULL; Gtk::Widget* toplevel_widget = m_widget->get_toplevel(); if(gtk_widget_is_toplevel(toplevel_widget->gobj())) parent = dynamic_cast<Gtk::Window*>(toplevel_widget); g_assert(parent != NULL); dialog->set_transient_for(*parent); dialog->add_button(_("_Close"), Gtk::RESPONSE_CLOSE); dialog->set_secondary_text(m_detail_desc, true); dialog->signal_response().connect( sigc::hide( sigc::bind( sigc::ptr_fun(dispose_dialog), dialog))); dialog->show(); }
void AckFunctionDialog::onAddAck() { SimpleTypeBox box( ("New acknowledge function name?"), ""); std::string name = boost::trim_copy(box.run()); if (box.valid()) { if (checkName(name)) { setSensitiveAck(false); Gtk::TreeIter iter = m_model->append(); if (iter) { savePreviousAck(mAckNameEntry->get_text()); mAckNameEntry->set_text(name); Gtk::ListStore::Row row = *iter; row[m_viewscolumnrecord.name] = name; mHeaderAck->set_text("void " + name + "(const std::string&"\ "activityname,\n\t"\ "const ved::Activity& activity) {"); std::string generatedFunc = ""; mTextViewFunction->get_buffer()->set_text(generatedFunc); m_iter = iter; mTreeAckList->set_cursor(m_model->get_path(iter)); mAckName.push_back(name); setSensitiveAck(true); } } else { Gtk::MessageDialog errorDial ("Name error !", false, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true); errorDial.set_title("Error !"); errorDial.run(); } } }
static void connectDialog (int error) { string msg; switch (error) { case gthJackAudio::ERR_NO_PLAYBACK: msg = "Could not find a playback target for JACK\n" "(alsa_pcm or oss.)"; break; case gthJackAudio::ERR_HANDLE_NULL: msg = "Can't connect to the JACK server because it no\n" "longer seems to be running."; break; default: msg = "Could not (dis)connect JACK, errno = " + error; break; } Gtk::MessageDialog errorDialog (msg.c_str(), false, Gtk::MESSAGE_ERROR); errorDialog.run(); }
void onRefresh() { unsigned int Size = 0; if (!mp_SimulationBlob) mp_Dialog->set_message("I am DummyModelessWindow\n" "Nb of units in TestUnits class: no CoreRepository\n" "Nothing to do"); else { mp_TestUnitsColl = mp_SimulationBlob->getCoreRepository().getUnits( "TestUnits"); if (mp_TestUnitsColl) Size = mp_TestUnitsColl->getList()->size(); mp_Dialog->set_message(Glib::ustring::compose( "I am DummyModelessWindow\n" "Nb of units in TestUnits class: %1\n" "Clicking ok will add a Unit of class \"TestUnits\"", Size)); } }
void ErrorPopup::on_message(const Glib::ustring& msg_, GxLogger::MsgType tp, bool plugged) { if (plugged) { return; } if (tp == GxLogger::kError) { if (active) { msg += "\n" + msg_; if (msg.size() > 1000) { msg.substr(msg.size()-1000); } if (dialog) { dialog->set_message(msg); } } else { msg = msg_; active = true; show_msg(); } } }
void mixer_window::open_quit_dialog() { Gtk::MessageDialog dialog (*this, gettext("Really quit?"), false, Gtk::MESSAGE_QUESTION, Gtk::BUTTONS_NONE); dialog.add_button(gettext("No, continue running dvswitch."), Gtk::RESPONSE_CANCEL); dialog.add_button(gettext("Yes, exit dvswitch."), Gtk::RESPONSE_YES); dialog.set_default_response(Gtk::RESPONSE_CANCEL); dialog.set_position (Gtk::WIN_POS_CENTER_ON_PARENT); switch (dialog.run()) { case Gtk::RESPONSE_ACCEPT: case Gtk::RESPONSE_YES: Gtk::Main::quit(); break; default: break; } }
void ErrorPopup::show_msg() { dialog = new Gtk::MessageDialog(msg, false, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_CLOSE); dialog->set_keep_above(true); //Gtk::VBox *ma = dialog->get_message_area(); // not in Gtkmm 0.20 //FIXME: no comment :-) Gtk::VBox *ma = dynamic_cast<Gtk::VBox*>( *(++dynamic_cast<Gtk::HBox*>( *dialog->get_vbox()->get_children().begin())->get_children().begin())); // add an alignment parent to the label widget inside the message area // should better define our own dialog instead of hacking MessageDialog... Gtk::Alignment *align = new Gtk::Alignment(); align->show(); dynamic_cast<Gtk::Label*>(*ma->get_children().begin())->reparent(*align); ma->pack_start(*manage(align)); align->set_padding(50,20,0,10); Gtk::VBox *vbox = dynamic_cast<Gtk::VBox *>(dialog->get_child()); vbox->set_redraw_on_allocate(true); vbox->signal_expose_event().connect( sigc::group(&gx_cairo::error_box_expose,GTK_WIDGET(vbox->gobj()),sigc::_1,(void*)0),false); dialog->set_title(_("GUITARIX ERROR")); dialog->signal_response().connect( sigc::mem_fun(*this, &ErrorPopup::on_response)); dialog->show(); }
void onProjectClosed() { mp_Dialog->hide(); signal_Hidden().emit(); }
void show() { onRefresh(); mp_Dialog->show(); }