void CircuitWidget::edit_line_label (uint32_t line) { if(!circuit) { return; } Gtk::Dialog enterLabel("Enter Label"); enterLabel.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); enterLabel.add_button(Gtk::Stock::OK, Gtk::RESPONSE_OK); enterLabel.set_default_response(Gtk::RESPONSE_OK); Gtk::Entry labelEntry; labelEntry.set_activates_default(); labelEntry.set_max_length(5000); labelEntry.show(); enterLabel.get_vbox()->pack_start(labelEntry,Gtk::PACK_SHRINK); int result = enterLabel.run(); if (result == Gtk::RESPONSE_OK && std::string(labelEntry.get_text()) != "") { if(line >= circuit->numLines()) { Line & l = circuit->getLineModify(line - circuit->numLines()); l.outLabel = labelEntry.get_text(); } else { Line & l = circuit->getLineModify(line); l.lineName = labelEntry.get_text(); l.constant = false; } size_changed = true; force_redraw(); } }
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 (); } } }
pinDialogPriv(pinDialog &,const void *opsysParam) : Gtk::Dialog("inputDialog",true), m_label("pin entry") { m_textInput.set_activates_default(true); get_vbox()->pack_start(m_label); m_label.set_alignment(0.1,0.5); get_vbox()->pack_start(m_textInput); m_textInput.set_visibility(false); set_has_separator(true); add_button(Gtk::Stock::OK,Gtk::RESPONSE_OK); add_button(Gtk::Stock::CANCEL ,Gtk::RESPONSE_CANCEL); set_default_response(Gtk::RESPONSE_CANCEL); show_all_children(); }
void Info::show(std::string ClassName, std::set<int> UnitIDs) { mp_IDLabel->set_label(""); mp_ProcessOrderLabel->set_label(""); mref_ListStoreFrom->clear(); mref_ListStoreTo->clear(); mref_ListStoreParent->clear(); mref_ListStoreChildren->clear(); mref_ListStoreIDs->clear(); m_InputDataNames.clear(); if (!m_InputDataLineTable.empty()) { std::map<Gtk::Label*, std::pair<Gtk::Entry*, Gtk::Button*> >::iterator iter; for (iter = m_InputDataLineTable.begin(); iter != m_InputDataLineTable.end(); ++iter) { delete((*iter).first); delete((*iter).second.second); delete((*iter).second.first); } } m_InputDataLineTable.clear(); mp_NameClassLabel->set_label(ClassName); mp_TreeViewIDs->set_name(""); std::set<int>::iterator it; for (it = UnitIDs.begin(); it != UnitIDs.end(); it++) { Gtk::TreeRow Row = *mref_ListStoreIDs->append(); Row[m_ModelColumnIDs.m_ID] = *it; m_InputDataNames = mp_CoreRepos->getUnit(ClassName, *it)->getInputData()->getInputDataNames(); if(m_InputDataNames.empty()) mp_InputDataTable->set_visible(false); else { mp_InputDataTable->resize((m_InputDataNames.size() * 2) - 1, 3); mp_InputDataTable->set_homogeneous(false); mp_InputDataTable->set_spacings(5); int compt = 0; for (unsigned int i = 0; i < (m_InputDataNames.size() * 2) - 1; i++) { if ((i % 2) == 0) { Gtk::Label* InputDataLabel = Gtk::manage( new Gtk::Label(m_InputDataNames[compt])); mp_InputDataTable->attach(*InputDataLabel, 0, 1, i, i + 1, Gtk::FILL | Gtk::EXPAND, Gtk::SHRINK); Gtk::Entry* InputDataValueEntry = Gtk::manage(new Gtk::Entry()); InputDataValueEntry->set_name(InputDataLabel->get_label()); mp_InputDataTable->attach(*InputDataValueEntry, 1, 2, i, i + 1, Gtk::FILL | Gtk::EXPAND, Gtk::SHRINK); InputDataValueEntry->signal_activate().connect( sigc::bind<std::string>( sigc::mem_fun(*this, &Info::onEntryInputDataChanged), InputDataValueEntry->get_name())); InputDataValueEntry->signal_focus_out_event().connect( sigc::bind<std::string>( sigc::mem_fun(*this, &Info::on_focus_out_event), InputDataValueEntry->get_name())); InputDataValueEntry->set_activates_default(true); Gtk::Button* RestoreDefaultButton = Gtk::manage( new Gtk::Button(_("Restore"), false)); mp_InputDataTable->attach(*RestoreDefaultButton, 2, 3, i, i + 1, Gtk::FILL | Gtk::EXPAND, Gtk::SHRINK); std::pair<Gtk::Entry*, Gtk::Button*> TempPairEntryButton = std::make_pair(InputDataValueEntry, RestoreDefaultButton); m_InputDataLineTable.insert( std::pair<Gtk::Label*, std::pair<Gtk::Entry*, Gtk::Button*> >( InputDataLabel, TempPairEntryButton)); InputDataLabel->set_visible(true); InputDataValueEntry->set_visible(true); RestoreDefaultButton->set_visible(true); RestoreDefaultButton->set_sensitive(false); compt++; } else { mp_InputDataTable->attach(*ToolBox::setHSeparator(), 0, 3, i, i + 1, Gtk::FILL | Gtk::EXPAND, Gtk::SHRINK); } } mp_InputDataTable->set_visible(true); } } if(! mref_ListStoreIDs->children().empty()) mp_TreeViewIDs->get_selection()->select(mref_ListStoreIDs->children()[0]); if (mp_Dialog->run() == Gtk::RESPONSE_OK) { } mp_Dialog->hide(); }
bool ClipSelector::on_button_press_event(GdkEventButton* event) { block = ((int)event->y) / 18; if ( masterClipSelector ) { if ( event->button == 1 ) { // tell the engine to play a scene EngineEvent* x = new EngineEvent(); x->setSceneNumber(block); top->toEngineQueue.push(x); masterClipPlaying = block; redraw(); // harmonySeq integration: send it the scene id OSC tag //cout << "ClipSelector: HarmonySeq integration: Sending OSC tag # " << block << " now!" << endl; //lo_send( lo_address_new(NULL, "7773") , "/harmonyseq/event", "i", block ); return true; } else // rename scene { Gtk::Dialog dialog("Rename Scene", false); // not modal, leave program update! Gtk::Entry* entry = new Gtk::Entry(); entry->set_activates_default (true); dialog.add_button( Gtk::Stock::OK, Gtk::RESPONSE_OK ); dialog.add_button( Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL ); dialog.set_default_response( Gtk::RESPONSE_OK ); dialog.get_vbox()->add( *entry ); dialog.get_vbox()->show_all(); list<string>::iterator iter = nameList.begin(); string name; switch ( dialog.run() ) { case Gtk::RESPONSE_OK: name = entry->get_buffer()->get_text(); cout << " Dialog OK clicked, entry contains: " << name << endl; advance(iter, block); *iter = name; redraw(); break; default: break; } } return true; } if( event->type == GDK_BUTTON_PRESS && event->button == 1 && event-> x < 20 ) // left { // so we're gonna play a clip, if the track is record enabled, and the // current block is *NOT* recording yet, we set it to record, otherwise // we stop it from recording. If the track isn't record armed: then we // send a play message TrackOutputState* state = &stateStore->trackoutputState.at(ID); if ( state->recEnable && stateStore->trackoutputState.at(ID).recEnable == false ) { std::cout << "ClipSelector " << ID << ": Record ON Press on block " << block << std::endl; } else if ( state->recEnable && stateStore->trackoutputState.at(ID).recEnable == true ) { std::cout << "ClipSelector " << ID << ": Record OFF Press on block " << block << std::endl; } else { std::cout << "ClipSelector " << ID << ": Play Button Press on block " << block << std::endl; } // EngineEvent* x = new EngineEvent(); x->looperSelectBuffer(ID,block); top->toEngineQueue.push(x); } else { // its a click in the block, but probably for "drag drop" functionality, // *dont* set the block to play, jsut storke the block number that we've // clicked on so we can send it later (this is done @ top of function already) } if( event->type == GDK_BUTTON_PRESS && event->button == 3 ) // right { std::cout << "ClipSelector " << ID << ": Load event on block " << block << std::endl; loadSample(block); } return true; }