void ModelDialog::SetDefaultStartChannels() { int strings = GetNumberOfStrings(); int startchan = SpinCtrl_StartChannel->GetValue(); int nodesPerString = SpinCtrl_parm2->GetValue(); for (int stringnum=0; stringnum<strings; stringnum++) { gridStartChannels->SetCellValue(stringnum,0, wxString::Format(wxT("%i"),startchan + (stringnum*nodesPerString*3))); } }
void ModelDialog::UpdateRowCount() { int strings = GetNumberOfStrings(); int curRowCnt = gridStartChannels->GetNumberRows(); if (strings > curRowCnt ) { gridStartChannels->AppendRows(strings - curRowCnt); } else if ( strings < curRowCnt ) { gridStartChannels->DeleteRows(strings, curRowCnt - strings); } bool OneString = strings == 1; if (OneString) cbIndividualStartNumbers->SetValue(false); cbIndividualStartNumbers->Enable(!OneString); }
void ModelDialog::UpdateStartChannels() { int StringStartChan,StringEndChan; long StringStartChanLong; wxString tmpStr; int StringCnt = GetNumberOfStrings(); bool OneString = StringCnt == 1; int ChannelsPerString = GetChannelsPerStringStd(); if (IsCustom()) { int maxval = GetCustomMaxChannel(); switch (ChannelsPerString) { case 1: // traditional strings StringCnt = maxval; break; case 3: // dumb rgb StringCnt = maxval; break; default: // rgb pixels ChannelsPerString = maxval*3; break; } } // Update number of grid rows int curRowCnt = gridStartChannels->GetNumberRows(); if (StringCnt > curRowCnt ) { gridStartChannels->AppendRows(StringCnt - curRowCnt); } else if ( StringCnt < curRowCnt ) { gridStartChannels->DeleteRows(StringCnt, curRowCnt - StringCnt); } // if only 1 string, then disable individual string start channels if (OneString) cbIndividualStartNumbers->SetValue(false); cbIndividualStartNumbers->Enable(!OneString); // update grid if(cbIndividualStartNumbers->IsChecked()) { // update end channel numbers only for (int stringnum=0; stringnum<StringCnt; stringnum++) { tmpStr = gridStartChannels->GetCellValue(stringnum,0); if (tmpStr.ToLong(&StringStartChanLong) && StringStartChanLong > 0) { StringEndChan=StringStartChanLong + ChannelsPerString - 1; gridStartChannels->SetCellValue(stringnum,1, wxString::Format("%i",StringEndChan)); } } SetReadOnly(false); } else { // update start and end channel numbers int startchan = SpinCtrl_StartChannel->GetValue(); for (int stringnum=0; stringnum<StringCnt; stringnum++) { StringStartChan=startchan + (stringnum*ChannelsPerString); StringEndChan=StringStartChan + ChannelsPerString - 1; gridStartChannels->SetCellValue(stringnum,0, wxString::Format("%i",StringStartChan)); gridStartChannels->SetCellValue(stringnum,1, wxString::Format("%i",StringEndChan)); } SetReadOnly(true); } }