void UINodeMapSelector::reset () { UINodeSelector<std::string>::reset(); if (_mapManager) { const IMapManager::Maps &maps = _mapManager->getMaps(); for (IMapManager::Maps::const_iterator i = maps.begin(); i != maps.end(); ++i) { if (!_multiplayer || i->second->getStartPositions() > 1) addData(i->first); } return; } const CampaignPtr& campaignPtr = _campaignManager->getActiveCampaign(); if (!campaignPtr) return; const Campaign::MapList& maps = campaignPtr->getMaps(); int index = -1; int mapIndex = 0; for (Campaign::MapListConstIter i = maps.begin(); i != maps.end(); ++i, ++mapIndex) { const CampaignMapPtr& p = *i; addData(p->getId()); if (index == -1 && p->isLocked()) { index = mapIndex - 1; } } selectEntry(index); }
//--------------------------------------------------------------------------- void __fastcall TQSOEditDlg::FormShow( TObject */*Sender*/ ) { GJVQSOEditFrame->initialise( contest, this ); selectEntry( firstContact ); firstContact = 0; GJVQSOEditFrame->CallsignEdit->SetFocus(); }
void RandomNetwork::fillAdjacency(double p){ for (int i=0;i<nNodes;i++){ for (int j=0;j<nNodes;j++){ adjacency[i][j] = selectEntry(i,j, p); } } }
void __fastcall TGJVQSOEditFrame::InsertAfterButtonClick( TObject */*Sender*/ ) { BaseContact *nct = getNextContact(); LoggerContestLog *ct = dynamic_cast<LoggerContestLog *>( contest ); DisplayContestContact *newct = ct->addContactBetween(selectedContact, nct); newct->contactFlags.setValue(newct->contactFlags.getValue()|TO_BE_ENTERED); selectEntry(newct); }
ComboBox::ComboBox(const IRect &rect, int drop_size, const char *prefix, CRange<const char*> values) :Window(rect), m_drop_size(drop_size), m_prefix(prefix) { m_button = make_shared<Button>(IRect(int2(0, 0), rect.size()), ""); m_dummy = make_shared<ListBox>(IRect(0, 0, 10, 10)); attach(m_button); for(auto value : values) addEntry(value, ColorId::white); if(!values.empty()) selectEntry(0); }
LoadSlotDialog::LoadSlotDialog(QWidget *parent) : QDialog(parent), ui(new Ui::LoadSlotDialog) { ui->setupUi(this); QSqlQuery query; query.prepare("SELECT slot_id, desc FROM slots ORDER BY desc"); query.exec(); while (query.next()) { ui->slotComboBox->addItem(query.value(1).toString(),query.value(0).toInt()); } connect(ui->loadButton, SIGNAL(clicked()), this, SLOT(selectEntry())); }
void __fastcall TQSOEditDlg::GJVQSOEditFrame1GJVForceButtonClick( TObject */*Sender*/ ) { if (catchup) { LoggerContestLog *ct = dynamic_cast<LoggerContestLog *>( contest ); int ctmax = ct->maxSerial + 1; DisplayContestContact *lct = ct->addContact( ctmax, 0, false, catchup ); selectEntry(lct); } else { ModalResult = mrOk; } }
void __fastcall TGJVQSOEditFrame::PriorButtonClick( TObject */*Sender*/ ) { current = 0; // make sure the focus moves off this button if ( !checkLogEntry(true) ) { return ; } BaseContact *lct = getPriorContact(); if ( lct ) { selectEntry( lct ); } else { ShowMessage( "Start of QSOs" ); } }
void __fastcall TGJVQSOEditFrame::FirstUnfilledButtonClick( TObject */*Sender*/ ) { current = 0; // make sure the focus moves off this button if ( !checkLogEntry(true) ) { return ; } for ( LogIterator i = contest->ctList.begin(); i != contest->ctList.end(); i++ ) { if ( ( *i ) ->contactFlags.getValue() & TO_BE_ENTERED ) { selectEntry( ( *i ) ); return ; } } ShowMessage( "No more unfilled contacts found" ); }
void MenuGump::ChildNotify(Gump *child, uint32 message) { if (child->IsOfType<EditWidget>() && message == EditWidget::EDIT_ENTER) { EditWidget* editwidget = p_dynamic_cast<EditWidget*>(child); assert(editwidget); std::string name = editwidget->getText(); if (!name.empty()) { MainActor* av = getMainActor(); av->setName(name); Close(); } } if (child->IsOfType<ButtonWidget>() && message==ButtonWidget::BUTTON_CLICK) { selectEntry(child->GetIndex()); } }
bool MenuGump::OnKeyDown(int key, int mod) { if (Gump::OnKeyDown(key, mod)) return true; if (!nameEntryMode) { if (key == SDLK_ESCAPE) { // FIXME: this check should probably be in Game or GUIApp MainActor* av = getMainActor(); if (av && !(av->getActorFlags() & Actor::ACT_DEAD)) Close(); // don't allow closing if dead/game over } else if (key >= SDLK_1 && key <=SDLK_9) { selectEntry(key - SDLK_1 + 1); } } return true; }
void __fastcall TQSOEditDlg::InitialiseTimerTimer(TObject */*Sender*/) { // we had this so that we could close the form easily on startup // when the conatct was zero - not sure if still needed InitialiseTimer->Enabled = false; GJVQSOEditFrame->initialise( contest, this, catchup ); selectEntry( firstContact ); if (GJVQSOEditFrame->isCatchup()) { Caption = "Catch-up (Post Entry)"; } else if ( firstContact ->contactFlags.getValue() & TO_BE_ENTERED ) { Caption = "Completing unfilled contacts"; } else { Caption = "Editting QSO"; } firstContact = 0; }
void InterfaceSettings::load() { libraryArtistImage->setChecked(Settings::self()->libraryArtistImage()); selectEntry(libraryView, Settings::self()->libraryView()); libraryCoverSize->setCurrentIndex(Settings::self()->libraryCoverSize()); libraryYear->setChecked(Settings::self()->libraryYear()); selectEntry(albumsView, Settings::self()->albumsView()); albumsCoverSize->setCurrentIndex(Settings::self()->albumsCoverSize()); albumSort->setCurrentIndex(Settings::self()->albumSort()); selectEntry(folderView, Settings::self()->folderView()); selectEntry(playlistsView, Settings::self()->playlistsView()); playListsStartClosed->setChecked(Settings::self()->playListsStartClosed()); selectEntry(streamsView, Settings::self()->streamsView()); selectEntry(onlineView, Settings::self()->onlineView()); groupSingle->setChecked(Settings::self()->groupSingle()); useComposer->setChecked(Settings::self()->useComposer()); groupMultiple->setCurrentIndex(Settings::self()->groupMultiple() ? 1 : 0); #ifdef ENABLE_DEVICES_SUPPORT showDeleteAction->setChecked(Settings::self()->showDeleteAction()); selectEntry(devicesView, Settings::self()->devicesView()); #endif playQueueGrouped->setCurrentIndex(Settings::self()->playQueueGrouped() ? 1 : 0); playQueueAutoExpand->setChecked(Settings::self()->playQueueAutoExpand()); playQueueStartClosed->setChecked(Settings::self()->playQueueStartClosed()); playQueueScroll->setChecked(Settings::self()->playQueueScroll()); playQueueBackground->setChecked(Settings::self()->playQueueBackground()); albumsViewChanged(); albumsCoverSizeChanged(); playListsStyleChanged(); playQueueGroupedChanged(); forceSingleClick->setChecked(Settings::self()->forceSingleClick()); systemTrayCheckBox->setChecked(Settings::self()->useSystemTray()); systemTrayPopup->setChecked(Settings::self()->showPopups()); minimiseOnClose->setChecked(Settings::self()->minimiseOnClose()); minimiseOnClose->setEnabled(systemTrayCheckBox->isChecked()); minimiseOnCloseLabel->setEnabled(systemTrayCheckBox->isChecked()); #ifndef Q_OS_WIN gnomeMediaKeys->setChecked(Settings::self()->gnomeMediaKeys()); #endif }
void __fastcall TGJVQSOEditFrame::NextButtonClick( TObject */*Sender*/ ) { current = 0; // make sure the focus moves off this button if ( !checkLogEntry() ) { return ; } for ( LogIterator i = contest->ctList.begin(); i != contest->ctList.end(); i++ ) { if ( ( *i ) ->getLogSequence() == screenContact.getLogSequence() ) { i++; if ( i == contest->ctList.end() ) { ShowMessage( "End of QSOs" ); i--; } selectEntry( ( *i ) ); return ; } } ShowMessage( "End of QSOs" ); }
bool ComboBox::onEvent(const Event &ev) { if(ev.type == Event::window_closed && ev.source == m_popup.get()) { m_dummy->selectEntry(m_popup->selectedId()); m_popup = nullptr; updateButton(); if(ev.value) sendEvent(this, Event::element_selected, m_dummy->selectedId()); } else if(ev.type == Event::button_clicked && ev.source == m_button.get()) { DASSERT(!m_popup); if(m_drop_size > 0 && size()) { int popup_size = min(m_drop_size, m_dummy->size() * m_dummy->lineHeight()); IRect clip_rect = clippedRect(); IRect rect(clip_rect.min, int2(clip_rect.max.x, clip_rect.min.y + popup_size)); m_popup = make_shared<ListBox>(rect, WindowStyle::gui_popup); for(int n = 0; n < size(); n++) { const ListBox::Entry &entry = (*m_dummy)[n]; m_popup->addEntry(entry.text.c_str(), entry.color); } m_popup->selectEntry(m_dummy->selectedId()); m_popup->setInnerOffset(int2(0, m_dummy->selectedId() * m_dummy->lineHeight())); mainWindow()->attach(m_popup, true); } else if(size() > 1) { int next_id = (selectedId() + 1) % size(); selectEntry(next_id); sendEvent(this, Event::element_selected, next_id); } } else return false; return true; }
bool TGJVQSOLogFrame::doGJVCancelButtonClick( TObject */*Sender*/ ) { DateEdit->ReadOnly = !contest->isPostEntry(); TimeEdit->ReadOnly = !contest->isPostEntry(); SerTXEdit->ReadOnly = true; ScreenContact *temp = 0; if ( !partialContact ) { savePartial(); temp = partialContact; partialContact = 0; } updateTimeAllowed = true; updateQSOTime(); selectEntry( 0 ); CallsignEdit->SetFocus(); if ( temp ) partialContact = temp; MinosParameters::getMinosParameters() ->showErrorList( ); return true; }
//--------------------------------------------------------------------------- void TGJVQSOLogFrame::logScreenEntry( ) { if ( contest->isReadOnly() ) return ; int ctmax = atoi( screenContact.serials.c_str() ); if ( ctmax > contest->maxSerial ) contest->maxSerial = ctmax; // NB contact will be saved - soon // will be used to hold the screen contact LoggerContestLog *ct = dynamic_cast<LoggerContestLog *>( contest ); if ( !ct ) { return ; } DisplayContestContact *lct = ct->addContact( ctmax, 0, false ); // "current" doesn't get flag, don't save ContestLog yet bool setTime = ct->isPostEntry(); dtg saved( screenContact.time ); // dtg from current contact bool contactmodeCW = ( screenContact.reps.size() == 3 && screenContact.repr.size() == 3 ); bool curmodeCW = ( stricmp( screenContact.mode, "A1A" ) == 0 ); if ( contactmodeCW != curmodeCW ) { // ask if change... if ( !curmodeCW ) { if ( MinosParameters::getMinosParameters() ->yesNoMessage( this, "Change mode to A1A?" ) ) { screenContact.mode = "A1A"; } } else { if ( MinosParameters::getMinosParameters() ->yesNoMessage( this, "Change mode to J3E?" ) ) { screenContact.mode = "J3E"; } } } ct->mode.setValue( screenContact.mode ); screenContact.op1.setValue( ct->op1.getValue() ); screenContact.op2.setValue( ct->op2.getValue() ); lct->copyFromArg( screenContact ); ContestContact *llct = dynamic_cast<ContestContact *>( lct ); llct->commonSave(); // which also saves the ContestLog selectEntry( 0 ); // select the "next" if ( setTime ) { updateTimeAllowed = false; updateQSOTime(); screenContact.time = saved; DateEdit->Text = screenContact.time.getDate( DTGDISP ).c_str(); int selpt = DateEdit->Text.Length(); if ( selpt > 2 ) { DateEdit->SelStart = 1; DateEdit->SelLength = 1; } TimeEdit->Text = screenContact.time.getTime( DTGDISP ).c_str(); selpt = TimeEdit->Text.Length(); if ( selpt > 0 ) { TimeEdit->SelStart = selpt - 1; TimeEdit->SelLength = 1; } selectField( 0 ); } editScreen->afterLogContact(); }
int main() { float scrollPos = 0.0f; float scrollDir = 0.0f const float scrollFriction = 0.9f; const float clampFriction = 0.9f; int dragAnchor = 0; bool draging = false; int prevDragAnchor = 0; float maxScrollPos = 100; while (1) { scanKeys(); // process input int down = keysDown(); int up = keysUp(); touchPosition touchPos; touchRead(&touchPos); if (down & KEY_TOUCH) { // always stop when tapping the screen scrollDir = 0.0f; if (touchPos.px < SCREEN_WIDTH / 2) { prevDragAnchor = dragAnchour = touchPos.py; draging = true; } else { int canvasPos = touchPos.py - scrollPos; int entry = canvasPos / ENTRY_HEIGHT; selectEntry(entry); } } else if (up & KEY_TOUCH) { draging = false; } // animate if (!draging) { scrollPos += scrollDir; scrollDir *= scrollFriction; if (fabs(scrollDir) < 0.01f) scrollDir = 0.0f; if (scrollPos < 0.0f) { // clamp to start scrollDir = 0.0f; scrollPos *= clampFriction; } else if (scrollPos > maxScrollPos) { // clamp to end scrollDir = 0.0f; scrollPos = scrollPos + (maxScrollPos - scrollPos) * clampFriction; } setScroll(int(scrollPos)); } else { setScroll(touchPos.py - dragAnchor); // track scrollDir scrollDir += touchPos.py - prevDragAnchor; scrollDir *= scrollFriction; prevDragAnchor = dragAnchor; } swiWaitForVBlank(); } }