void CityLordView::mousePressEvent(QMouseEvent * e){ showFieldColor(false, true); startMouse = mapToScene(e->pos()); Location location = isoToLoc(startMouse); if(*sabotageActive){ if(goodLocation(location)){ selectField(location); if(clientManager->getMap()->getCase(location)->isRoad()){ clientManager->setRequest("roadblock"); clientManager->addInfo("row", std::to_string(location.getRow())); clientManager->addInfo("col", std::to_string(location.getCol())); clientManager->sendRequestAndRecv(); openMessageBox("RoadBlock"); } } } else{ if(goodLocation(location)){ selectField(location); if(clientManager->getMap()->getCase(location)->isField()){ dynamic_cast<ClientField*>(clientManager->getMap()->getCase(location))->setShowOwnerColor(true); } } if(goodLocation(previousSelectedLocation) && !previousSelectedLocation.isEqual(location)){ if(clientManager->getMap()->getCase(previousSelectedLocation)->isField()){ dynamic_cast<ClientField*>(clientManager->getMap()->getCase(previousSelectedLocation))->setShowOwnerColor(false); } } previousSelectedLocation = location; } repaintView(); }
//--------------------------------------------------------------------------- void TGJVEditFrame::showScreenEntry( void ) { // display the contents of the contest->screenContact if ( contest ) { // we only validate this contact up to the validation point contest->validationPoint = selectedContact; ScreenContact temp; temp.copyFromArg( screenContact ); // as screen contact gets corrupted by auto changes // op1, op2 in ScreenContact ge corrupted as well DateEdit->Text = temp.time.getDate( DTGDISP ).c_str(); TimeEdit->Text = temp.time.getTime( DTGDISP ).c_str(); CallsignEdit->Text = trim( temp.cs.fullCall.getValue() ).c_str(); RSTTXEdit->Text = trim( temp.reps ).c_str(); SerTXEdit->Text = trim( temp.serials ).c_str(); RSTRXEdit->Text = trim( temp.repr ).c_str(); SerRXEdit->Text = trim( temp.serialr ).c_str(); LocEdit->Text = trim( temp.loc.loc.getValue() ).c_str(); // also forces update of score etc QTHEdit->Text = trim( temp.extraText ).c_str(); CommentsEdit->Text = trim( temp.comments ).c_str(); ModeComboBoxGJV->Text = trim( temp.mode ).c_str(); NonScoreCheckBox->Checked = temp.contactFlags & NON_SCORING; DeletedCheckBox->Checked = temp.contactFlags & DONT_PRINT; editScreen->showScreenEntry( screenContact ); // and now we want to put the selection on each at the END of the text for ( std::vector <ValidatedControl *>::iterator vcp = vcs.begin(); vcp != vcs.end(); vcp++ ) { int selpt = ( *vcp ) ->wc->Text.Length(); ( *vcp ) ->wc->SelStart = selpt; ( *vcp ) ->wc->SelLength = 0; } valid( cmCheckValid ); // make sure contact is valid - display any errors if ( temp.contactFlags & ( COMMENT_ONLY | LOCAL_COMMENT ) ) { selectField( CommentsEdit ); } else selectField( 0 ); SerTXEdit->Color = clBtnFace; SerTXEdit->ReadOnly = true; MinosParameters::getMinosParameters() ->showErrorList( ); } }
/*********************************************************************** Main ***********************************************************************/ void main(void) { DisableInterrupts; initializations(); EnableInterrupts; //enables external xirq after vSync IRQ vSyncFlag = 0; while((vSyncFlag != 1) & (hCnt == 0)) {} asm andcc #$BF ////////////////////////////////////////////////////////////// //; START OF CODE FOR Spring 2012 MINI-PROJECT ////////////////////////////////////////////////////////////// // Load/Display Spalsh Screen displaySplash(); for(;;) { // write code here (Insert Code down here because we need an infinite loop.) // Display Menu Screen displayMenu(selection); // Check for Menu Selection checkMenuInputs(joy0vert); // Use case statement to branch to appropriate selection. // Don't branch unless the user has triggered the 'select' button. if (select == 1) { select = 0; switch (selection) { // Sub Function // Menu: case 1: // Select Character selectCharacter(); break; case 2: // Select Field selectField(); break; case 3: // Start Match startMatch(); break; // the default case is '-1' if nothing has been selected default: break; } } // We don't need the watchdog timer, but I don't think it can hurt to feed it anyway. // The watchdog was disabled in the initialization code. _FEED_COP(); /* feeds the dog */ } /* loop forever */ /* please make sure that you never leave main */ }
void ListBox::setSelected(bool sel) { Component::setSelected(sel); if (sel) { selectField(REQ_FIRST_FIELD); } else { set_field_back(current_field(m_pForm), A_NORMAL); form_driver(m_pForm, REQ_BEG_LINE); } m_curRow = 0; wrefresh(m_pPanel->getWindow()); }
void TGJVEditFrame::setActiveControl( WORD &Key ) { switch ( Key ) { case VK_F1: selectField( CallsignEdit ); Key = 0; break; case VK_F2: selectField( RSTTXEdit ); Key = 0; break; case VK_F3: selectField( RSTRXEdit ); Key = 0; break; case VK_F5: selectField( LocEdit ); Key = 0; break; } }
bool ListBox::handleKeyPress(int key) { if (key == KEY_UP) { //Move up a field selectField(REQ_PREV_FIELD); m_curRow = (m_curRow == 0) ? m_numRows - 1 : m_curRow - 1; return true; } else if (key == KEY_DOWN || key == 9) { //Tab key //Move down a field selectField(REQ_NEXT_FIELD); m_curRow = (m_curRow == m_numRows - 1) ? 0 : m_curRow + 1; return true; } else if (key == KEY_BACKSPACE || key == 127) { //Delete prev. char // form_driver(m_pForm, REQ_DEL_PREV); return true; } else if (key == 330) { //Delete key TODO: Fix this //Delete next char // form_driver(m_pForm, REQ_DEL_PREV); return true; } else { FIELD *pField = current_field(m_pForm); if (field_userptr(pField) != 0) { #ifdef DEBUG dout << "Create new row" << std::endl; #endif addRow(""); if (key == CuTAES::KEY_ENT) { //Clear field set_field_buffer(pField, 0, ""); return true; } } //Send key to form driver form_driver(m_pForm, key); } wrefresh(m_pPanel->getWindow()); return false; }
//============================================================================== void TGJVQSOLogFrame::logCurrentContact( bool /*forcelog*/ ) { if ( contest->isReadOnly() ) return ; // copy the display into the correct log entry, etc getScreenEntry(); // first check for extra lines to be added int ctno = atoi( screenContact.serials.c_str() ); if ( ctno > contest->maxSerial + 1 ) { if ( MessageBox( Handle, "Serial sent is too high - should I create the missing contacts?", "Minos Logger", MB_ICONQUESTION | MB_OKCANCEL ) == IDOK ) { int orflag = 0; if ( MessageBox( Handle, "Do you want to enter these contacts later?", "Minos Logger", MB_ICONQUESTION | MB_YESNO ) == IDYES ) { orflag = TO_BE_ENTERED; } int nct_no = contest->maxSerial + 1; do { // last child is "current contact", and we need to add TO IT LoggerContestLog *ct = dynamic_cast<LoggerContestLog *>( contest ); ct->addContact( nct_no, orflag, true ); // last contact nct_no++; } while ( nct_no < ctno ) ; } else { // reset focus to serial sent //????????????? But its disabled... selectField( SerTXEdit ); return ; } } logScreenEntry( ); // true => move on to next contact }
void ListBox::createForm() { if (m_pForm != 0) { unpost_form(m_pForm); free_form(m_pForm); } m_pForm = new_form(m_pFields); int rows, cols; scale_form(m_pForm, &rows, &cols); set_form_win(m_pForm, m_pPanel->getWindow()); set_form_sub(m_pForm, derwin(m_pPanel->getWindow(), getHeight() - 2, getWidth() - 2, getY() + 1, getX() + 1)); post_form(m_pForm); form_driver(m_pForm, REQ_LAST_FIELD); if (isSelected()) { selectField(REQ_PREV_FIELD); } }
//--------------------------------------------------------------------------- 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(); }
//--------------------------------------------------------------------------- bool TGJVEditFrame::doGJVOKButtonClick( TObject *Sender ) { DateEdit->ReadOnly = !contest->isPostEntry(); TimeEdit->ReadOnly = !contest->isPostEntry(); SerTXEdit->ReadOnly = true; SerTXEdit->Color = clBtnFace; if ( contest->isReadOnly() ) { return true; } GJVEditChange( Sender ); // start the match thread getScreenEntry(); // make sure it is saved if ( screenContact.contactFlags & ( LOCAL_COMMENT | DONT_PRINT | COMMENT_ONLY ) ) { logCurrentContact( false ); return true; } // validate the entry; if still invalid, spin round the invalid // controls (this should really be the job of tab, but...) TWinControl *currn = current; if ( !valid( cmCheckValid ) || ( currn == RSTTXEdit ) || ( currn == RSTRXEdit ) ) // make sure all single and cross field // validation has been done { doAutofill(); } bool was_unfilled = screenContact.contactFlags & TO_BE_ENTERED; if ( !valid( cmCheckValid ) ) // make sure all single and cross field // validation has been done { TWinControl * firstInvalid = 0; TWinControl *nextInvalid = 0; bool onCurrent = false; bool pastCurrent = false; for ( std::vector <ValidatedControl *>::iterator vcp = vcs.begin(); vcp != vcs.end(); vcp++ ) { if ( ( *vcp ) ->wc->ReadOnly || !( *vcp ) ->wc->Visible ) { continue; } if ( onCurrent ) pastCurrent = true; if ( ( *vcp ) ->wc == current ) onCurrent = true; if ( !( *vcp ) ->valid( cmValidStatus ) ) { if ( !firstInvalid ) firstInvalid = ( *vcp ) ->wc; if ( pastCurrent ) { if ( !nextInvalid ) { nextInvalid = ( *vcp ) ->wc; break; } } } } // make sure we go to the invalid field TWinControl *nextf = ( nextInvalid ) ? nextInvalid : firstInvalid; // but if it is DTG, probably want CS instead (Unless post entry) if ( ( nextf == TimeEdit ) || ( nextf == DateEdit ) ) { bool pe = contest->isPostEntry(); if ( !pe && screenContact.time.notEntered() == 0 ) { selectField( CallsignEdit ); nextf = 0; // dont show silly errors! if ( screenContact.cs.validate( ) == CS_OK ) { doAutofill(); //?????????????????????? return doGJVOKButtonClick( Sender ); } } } if ( nextf ) { if ( nextf == current ) { if ( firstInvalid != nextf ) selectField( firstInvalid ); else dlgForced(); // repeated attack on same faulty field } else selectField( nextf ); } // Show on errList on multdisp frame MinosParameters::getMinosParameters() ->showErrorList( ); return false ; } else { screenContact.contactFlags &= ~( TO_BE_ENTERED | FORCE_LOG ); } // all is OK (or we will have executed a return statement) // so do it! // we have to check if we need to save it // checkLogEntry does the log action as well if ( !was_unfilled && selectedContact ) // AND if we are logging "current" then we don't want to do this { if ( !checkLogEntry() ) // if it is the same, then don't log { return false; } } else { logCurrentContact( false ); } selectField( 0 ); // make sure we move off the "Log" default button return true; }
//--------------------------------------------------------------------------- void TGJVQSOEditFrame::selectEntry( BaseContact *slct ) { selectedContact = slct; // contact from log list selected FirstUnfilledButton->Visible = false; CatchupButton->Visible = false; screenContact.copyFromArg( *slct ); showScreenEntry(); PriorButton->Enabled = getPriorContact(); NextButton->Enabled = getNextContact(); InsertAfterButton->Enabled = getNextContact(); // dont allow insert after last contact MainOpComboBox->Text = screenContact.op1.c_str(); SecondOpComboBox->Text = screenContact.op2.c_str(); if ( !contest->isReadOnly() && (screenContact.contactFlags & TO_BE_ENTERED || catchup)) { // Uri Mode - catchuping QSOs from paper while logging current QSOs // and we need to set the date/time from the previous contact TimeEdit->ReadOnly = false; DateEdit->ReadOnly = false; int tne = screenContact.time.notEntered(); // partial dtg will give +fe // full dtg gives -ve, none gives 0 if ( tne == 0 ) { BaseContact * pct = getPriorContact(); if ( pct ) { screenContact.time = pct->time; DateEdit->Text = screenContact.time.getDate( DTGDISP ).c_str(); TimeEdit->Text = screenContact.time.getTime( DTGDISP ).c_str(); } else { // use contest start time TDateTime DTGStart = CanonicalToTDT(contest->DTGStart.getValue().c_str()); DateEdit->Text = DTGStart.FormatString("dd/mm/yy"); TimeEdit->Text = DTGStart.FormatString("hh:nn"); dtg time(false); time.setDate( DateEdit->Text.c_str(), DTGDISP ); time.setTime( TimeEdit->Text.SubString(1, 5).c_str(), DTGDISP ); screenContact.time = time; } int selpt = DateEdit->Text.Length(); if ( selpt > 2 ) { DateEdit->SelStart = 1; DateEdit->SelLength = 1; } selpt = TimeEdit->Text.Length(); if ( selpt > 0 ) { TimeEdit->SelStart = selpt - 1; TimeEdit->SelLength = 1; } } } else { TimeEdit->ReadOnly = true; DateEdit->ReadOnly = true; } SerTXEdit->ReadOnly = true; bool timeOK = false; int tne = screenContact.time.notEntered(); // partial dtg will give +fe // full dtg gives -ve, none gives 0 if (tne < 0) { dtg time(false); time.setDate( DateEdit->Text.c_str(), DTGDISP ); time.setTime( TimeEdit->Text.SubString(1, 5).c_str(), DTGDISP ); timeOK = contest->checkTime(time); } // DateEdit->Font->Assign(MinosParameters::getMinosParameters() ->getSysFont()); // TimeEdit->Font->Assign(MinosParameters::getMinosParameters() ->getSysFont()); if (timeOK) { DateEdit->Font->Color = clWindowText; TimeEdit->Font->Color = clWindowText; } else { DateEdit->Font->Color = clRed; TimeEdit->Font->Color = clRed; } MinosLoggerEvents::SendAfterSelectContact(catchup?0:slct, contest); selectField( 0 ); }
/** * handle command without reply * @param cmd command in text representation * @param len length of cmd (including '\0') * @return 0 ok, -1 failure */ int CameraV4L2::handleCommand(char *cmd, int len){ int w; int h; enum v4l2_field fld; int ret=-1; unsigned int a,b,c; // backup double dblVal; ret = -1; // error on default PLAYER_MSG1(2,"Got command %s", cmd); switch(cmd[0]){ case 's': case 'S': if (sscanf(cmd+1," %d %d", &w, &h)!=2) break; fg2_stopCapture(fg); ret = tryPixelSettings(fg, w, h, this->v4l2_type_id, fieldType); fg2_startCapture(fg); break; case 'i': case 'I': // todo: rollback if needed if (cmd[2]>='0' && cmd[2]<='9') sscanf(cmd+2,"%d", &(this->source)); else { this->source = -1; } fg2_stopCapture(fg); ret = fg2_set_source(this->fg, this->source, cmd+2); fg2_startCapture(fg); break; case 'n': case 'N': a = this->norm; b = this->width; c = this->height; if (cmd[1]!=' ' || selectFormat(cmd+2)!=0) break; fg2_stopCapture(fg); ret = fg2_set_source_norm(this->fg, this->norm); ret |= tryPixelSettings(fg, this->width, this->height, this->v4l2_type_id, fieldType); if (ret!=0) { this->norm = a; this->width = b; this->height = c; // known working? fg2_set_source_norm(this->fg, this->norm); tryPixelSettings(fg, this->width, this->height, this->v4l2_type_id, fieldType); } fg2_startCapture(fg); break; case 'm': case 'M': a = this->data.format; b = this->depth; c = this->v4l2_type_id; if (cmd[1]!=' ' || selectFormat(cmd+2)!=0) break; fg2_stopCapture(fg); ret = tryPixelSettings(fg, this->width, this->height, this->v4l2_type_id, fieldType); if (ret!=0) { this->data.format = a; this->depth = b; this->v4l2_type_id = c; ret = tryPixelSettings(fg, this->width, this->height, this->v4l2_type_id, fieldType); } fg2_startCapture(fg); break; case 'w': case 'W': // todo: rollback if needed if (cmd[2]>='0' && cmd[2]<='9'){ sscanf(cmd+2,"%d", &(this->flip_rb)); ret = 0; } break; case 'f': case 'F': fld = fieldType; if (cmd[1]!=' ' || selectField(cmd+2)!=0) break; fg2_stopCapture(fg); ret = tryPixelSettings(fg, this->width, this->height, this->v4l2_type_id, fieldType); fg2_startCapture(fg); if (ret!=0) { fieldType = fld; } break; case 'c': case 'C': if (cmd[1] == 'i' || cmd[1] == 'I') { if (sscanf(cmd+2, "%lf %u", &dblVal, &a)!=2) break; ret = fg2_setControlValueI(fg, a, dblVal); break; } for(w=2; w<len-1; w++) if (cmd[w]==' ' || cmd[w+1]=='\0') break; if (sscanf(cmd+2,"%lf",&dblVal) != 1) break; ret = fg2_setControlValue(fg, cmd+w+1, dblVal); break; default: PLAYER_WARN1("Unknown command %s",cmd); break; } return ret; }
//////////////////////////////////////////////////////////////////////////////// // Constructor CameraV4L2::CameraV4L2( ConfigFile* cf, int section) : Driver(cf, section, PLAYER_CAMERA_CODE, PLAYER_ALL_MODE, sizeof(player_camera_data_t), 128, 10, 10) { showFPS = 0; sourceCh = 0; const char *schary; // Camera defaults to /dev/video0 and NTSC this->device = cf->ReadString(section, "dev_file", "/dev/video0"); // Input source this->sourceCh = NULL; schary = cf->ReadString(section, "input", NULL); if (schary!=NULL && schary[0]>='0' && schary[0]<='9') this->source = cf->ReadInt(section, "input", 0); else { this->source = -1; this->sourceCh = schary; } // NTSC or PAL schary = cf->ReadString(section, "norm", "pal"); if (selectNorm(schary)!=0) selectNorm(normy[0].name); // Size this->width = cf->ReadTupleInt(section, "size", 0, this->width); this->height = cf->ReadTupleInt(section, "size", 1, this->height); // Palette type schary = cf->ReadString(section, "mode", "RGB24"); if (selectFormat(schary)!=0) selectFormat(formaty[0].name); schary = cf->ReadString(section, "field", "ANY"); if (selectField(schary)!=0) selectField(fieldy[0].name); flip_rb = cf->ReadInt(section, "swap_rb", 0); showFPS = cf->ReadInt(section, "show_fps", -1); if (showFPS>9) showFPS = 9; //printf("#controls: %d", cf->GetTupleCount(section, "controls") ); numOfCtls = cf->GetTupleCount(section, "controls")/2; if (numOfCtls>0){ int i; double k=0; ctlNames = new const char*[numOfCtls]; ctlVals = new double[numOfCtls]; for(i=0; i<numOfCtls; i++){ ctlNames[i] = cf->ReadTupleString(section, "controls", i*2+1, "null"); k = cf->ReadTupleFloat(section, "controls", i*2, 200.0); if (k>1.0){ numOfCtls = i; PLAYER_WARN1("Wrong value format for control %s, need val <= 1.0", ctlNames[i]); } else { ctlVals[i]=(double)k;//?? } } } back_source = source; back_norm = norm; back_depth = depth; back_width = width; back_height = height; back_fieldType = fieldType; back_v4l2_type_id = v4l2_type_id; puts("Camerav4l2: Driver object created"); return; }
//--------------------------------------------------------------------------- void TGJVQSOEditFrame::selectEntry( BaseContact *lct ) { selectedContact = lct; // contact from log list selected updateTimeAllowed = false; // whatever the time says, leave it alone screenContact.copyFromArg( *lct ); showScreenEntry(); if ( !contest->isReadOnly() && screenContact.contactFlags & TO_BE_ENTERED ) { // Uri Mode - backfilling QSOs from paper while logging current QSOs // and we need to set the date/time from the previous contact TimeEdit->ReadOnly = false; DateEdit->ReadOnly = false; int tne = screenContact.time.notEntered(); // partial dtg will give +fe // full dtg gives -ve, none gives 0 if ( tne == 0 ) { BaseContact * lct = getPriorContact(); if ( lct ) { screenContact.time = lct->time; 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; } } } } else { TimeEdit->ReadOnly = true; DateEdit->ReadOnly = true; } SerTXEdit->ReadOnly = true; bool timeOK = false; int tne = screenContact.time.notEntered(); // partial dtg will give +fe // full dtg gives -ve, none gives 0 if (tne < 0) { dtg time(false); time.setDate( DateEdit->Text.t_str(), DTGDISP ); time.setTime( TimeEdit->Text.SubString(1, 5).t_str(), DTGDISP ); timeOK = contest->checkTime(time); } if (timeOK) { DateEdit->Font->Color = clWindowText; TimeEdit->Font->Color = clWindowText; } else { DateEdit->Font->Color = clRed; TimeEdit->Font->Color = clRed; } editScreen->afterSelectEntry( lct ); selectField( 0 ); }
//--------------------------------------------------------------------------- void TGJVQSOEditFrame::selectEntry( BaseContact *lct ) { selectedContact = lct; // contact from log list selected if (contest->unfilledCount <= 0) { FirstUnfilledButton->Visible = false; } else { FirstUnfilledButton->Visible = true; } updateTimeAllowed = false; // whatever the time says, leave it alone screenContact.copyFromArg( *lct ); showScreenEntry(); if ( !contest->isReadOnly() && (screenContact.contactFlags & TO_BE_ENTERED || catchup)) { // Uri Mode - catchuping QSOs from paper while logging current QSOs // and we need to set the date/time from the previous contact TimeEdit->ReadOnly = false; DateEdit->ReadOnly = false; int tne = screenContact.time.notEntered(); // partial dtg will give +fe // full dtg gives -ve, none gives 0 if ( tne == 0 ) { BaseContact * lct = getPriorContact(); if ( lct ) { screenContact.time = lct->time; DateEdit->Text = screenContact.time.getDate( DTGDISP ).c_str(); TimeEdit->Text = screenContact.time.getTime( DTGDISP ).c_str(); } else { // use contest start time TDateTime DTGStart = CanonicalToTDT(contest->DTGStart.getValue().c_str()); DateEdit->Text = DTGStart.FormatString("dd/mm/yy"); TimeEdit->Text = DTGStart.FormatString("hh:nn"); dtg time(false); time.setDate( DateEdit->Text.c_str(), DTGDISP ); time.setTime( TimeEdit->Text.SubString(1, 5).c_str(), DTGDISP ); screenContact.time = time; } int selpt = DateEdit->Text.Length(); if ( selpt > 2 ) { DateEdit->SelStart = 1; DateEdit->SelLength = 1; } selpt = TimeEdit->Text.Length(); if ( selpt > 0 ) { TimeEdit->SelStart = selpt - 1; TimeEdit->SelLength = 1; } } } else { TimeEdit->ReadOnly = true; DateEdit->ReadOnly = true; } SerTXEdit->ReadOnly = true; bool timeOK = false; int tne = screenContact.time.notEntered(); // partial dtg will give +fe // full dtg gives -ve, none gives 0 if (tne < 0) { dtg time(false); time.setDate( DateEdit->Text.c_str(), DTGDISP ); time.setTime( TimeEdit->Text.SubString(1, 5).c_str(), DTGDISP ); timeOK = contest->checkTime(time); } if (timeOK) { DateEdit->Font->Color = clWindowText; TimeEdit->Font->Color = clWindowText; } else { DateEdit->Font->Color = clRed; TimeEdit->Font->Color = clRed; } editScreen->afterSelectEntry( lct ); selectField( 0 ); }