void GLIDebugVariableGrid::RefreshWatchValues() { // If not showing/adding watch values, return now if(!(gridFlags & DF_ShowWatchValues)) { return; } //Add the header if(gridFlags & DF_ShowHeaders) { int headerIndex = AddRowType(RT_Header, 0); SetCellValue(headerIndex, NAME_COLUMN_INDEX, wxT("Watch values")); } //Loop and add all the watch values for(uint i=0; i<watchValuesArray.size(); i++) { AddWatchDisplay(watchValuesArray[i], i); } //Add a empty watch value to add a new value if(watchValuesArray.size() < MAX_NUM_WATCH_VALUES) { int newIndex = AddRowType(RT_WatchValue, watchValuesArray.size()); SetTypeSelectionBox(newIndex, TYPE_COLUMN_INDEX, GL_FLOAT); //Select the starting cell SetCurrentCell(newIndex, NAME_COLUMN_INDEX); } }
BOOL CRGXMainWndGrid::FindRow(long lPawnTicketNr, bool bNotifyMainWin) { //ROWCOL rc = GetRowCount(); BOOL brtn = FALSE; TRACE("Tiketti=%ld\n", lPawnTicketNr); long lRows = GetRowCount(); //UINT lRows = GetRowCount(); for (int i=1; i<=lRows; i++) { if (atol(GetValueRowCol(i,1)) == lPawnTicketNr) { //TRACE("Viimeisin lainanumero = %s\n", strResult); this->setRowBoldFont((ROWCOL) i); SetCurrentCell(i,0); if (bNotifyMainWin == TRUE) { GetParent()->SendMessage(WM_COMMAND, GetDlgCtrlID() | RJ_OG_PARENT_DLG << 16, (LONG) GetSafeHwnd()); } brtn = TRUE; break; } } //SetColumnWidths(); return brtn; }
bool GLIDebugVariableGrid::ToggleRowExpansion(int currRow) { //Test if the passed row is within range if(currRow >= 0 && currRow < rowTypeDataArray.size()) { //If the value is a uniform that has more that one value if(rowTypeDataArray[currRow].type == RT_Uniform) { //Get the uniform index uint uniformIndex = rowTypeDataArray[currRow].indexValue; if(uniformIndex < uniformDataArray.size() && uniformDataArray[uniformIndex].arrayCount > 1) { //Toggle the array show value if necessary uniformDataArray[uniformIndex].isExpanded = !uniformDataArray[uniformIndex].isExpanded; //Refresh the grid RefreshGrid(); //Reset the selected row SetCurrentCell(currRow, NAME_COLUMN_INDEX); return true; } } } return false; }
bool GLIDebugVariableGrid::OnDnDText(const wxString &newWatchName) { //If currently editing, return now if(IsCellEditControlEnabled()) { return false; } //If showing watch values or there is already too many watch variables if(!(gridFlags & DF_ShowWatchValues) || watchValuesArray.size() >= MAX_NUM_WATCH_VALUES) { return false; } //Add the value UniformData newWatchData; newWatchData.name = newWatchName; newWatchData.type = GL_FLOAT; newWatchData.isFloatType = true; watchValuesArray.push_back(newWatchData); //Refresh the display int currRow = GetGridCursorRow(); int currColumn = GetGridCursorCol(); //Update the grid RefreshGrid(); //Reset the selected cell SetCurrentCell(currRow, currColumn); return true; }
void BFMachineInternalStorage::Read() { if ( inputBufferPos == inputBuffer.size() ) { return; } SetCurrentCell(inputBuffer[inputBufferPos++]); }
void FPropertyTable::SetSelectionMode( const ESelectionMode::Type Mode ) { SelectionMode = Mode; if ( !CanSelectCells() ) { SetCurrentCell( NULL ); SetCurrentColumn( NULL ); } if ( !CanSelectRows() ) { SetCurrentRow( NULL ); } }
void cCustomShotTable::mousePressEvent(QMouseEvent *event) { QTableWidget::mousePressEvent(event); if ((IsDragOn==1)||(columnCount()==0)||(DiaporamaObject==NULL)) return; setCursor(Qt::ArrowCursor); IsDragOn=0; // Get item number under mouse int ThumbWidth =columnWidth(0); int Selected =(event->pos().x()+horizontalOffset())/ThumbWidth; if ((Selected>=0)&&(Selected<NbrItem())) { // if item is correct, check if it was previously selected. Then if not select it if (Selected!=CurrentSelected()) SetCurrentCell(Selected); else { // if it was previously selected then start a drag & drop operation IsDragOn=1; DragItemSource=Selected; DragItemDest =Selected; //RepaintCell(Selected); setCursor(Qt::ClosedHandCursor); } } }
CString CRGXMainWndGrid::ShowPawnTicketNumbers(/*CString sHtun*/ long AsId) { long lRows = 0; m_lLainojaKpl = 0; m_dLainojaYhtEuro = 0; m_lAktiivisiaKpl = 0; m_lLunastetutKpl = 0; m_dAktLainojaYhtEuro = 0; char buf[20]; CString strResult; CString stmp = ""; CString sAsId = ""; //TRACE(" --- ShowPawnTicketNumbers\n"); //BOOL bLock = LockUpdate(); clear(); setGridReadOnly(FALSE); try { //pLainaRS->Close(); /*pLainaRS->m_strFilter.Format("LA_AS_HTun='" + sHtun + "' order by LA_Nr");*/ sAsId.Format("%ld", AsId); pLainaRS->m_strFilter.Format("LA_AS_ID=" + sAsId + " order by LA_Tila, LA_Nr"); TRACE("...where %s\n", pLainaRS->m_strFilter); pLainaRS->Open(); while (!pLainaRS->IsEOF()) { lRows++; m_lLainojaKpl++; SetRowCount(lRows); SetValueRange(CGXRange(lRows, 1), pLainaRS->m_LA_Nr); SetValueRange(CGXRange(lRows, 2), pLainaRS->m_LA_LainanNimi); // --- lainan perustamispäivä ---- sprintf(buf, "%s", pLainaRS->m_LA_AlkupPv.Format("%d.%m.%Y")); SetValueRange(CGXRange(lRows, 3), buf); // // --- Eräpäivä --- sprintf(buf, "%s", pLainaRS->m_LA_EraPv.Format("%d.%m.%Y")); SetValueRange(CGXRange(lRows, 4), buf); // // --- Lainan tila --- SetValueRange(CGXRange(lRows, 5), pLainaRS->m_LA_Tila); if (pLainaRS->m_LA_Tila == "L") // lunastettu -> sininen { m_lLunastetutKpl++; SetStyleRange(CGXRange(lRows, 1, lRows, 16), CGXStyle().SetInterior(RGB(128,255,255)) ); } else if (pLainaRS->m_LA_Tila == "A") // uudistettu -> vihreä ? { m_lAktiivisiaKpl++; m_dAktLainojaYhtEuro = m_dAktLainojaYhtEuro + pLainaRS->m_LA_Laina; SetStyleRange(CGXRange(lRows, 1, lRows, 16), CGXStyle().SetInterior(RGB(64,255,192)) ); } else if (pLainaRS->m_LA_Tila == "H") // huutokaupassa -> orange ? { SetStyleRange(CGXRange(lRows, 1, lRows, 16), CGXStyle().SetInterior(RGB(255,128,128)) ); } else if (pLainaRS->m_LA_Tila == "M") // myyty huutokaupassa -> light gray ? { SetStyleRange(CGXRange(lRows, 1, lRows, 16), CGXStyle().SetInterior(RGB(192,192,192)) ); } stmp.Format("%7.2f", pLainaRS->m_LA_VakSumma); SetValueRange(CGXRange(lRows, 6), stmp); stmp.Format("%7.2f", pLainaRS->m_LA_Laina); m_dLainojaYhtEuro = m_dLainojaYhtEuro + pLainaRS->m_LA_Laina; SetValueRange(CGXRange(lRows, 7), stmp); // // --- Odotuspäivä --- if(!pLainaRS->IsFieldNull(&pLainaRS->m_LA_OdotusPv)) sprintf(buf, "%s", pLainaRS->m_LA_OdotusPv.Format("%d.%m.%Y")); else sprintf(buf, ""); SetValueRange(CGXRange(lRows, 8), buf); // --- Viite --- sprintf(buf, "%s", theApp.buildReferenceNumberFor(pLainaRS->m_LA_Nr)); SetValueRange(CGXRange(lRows, 9), buf); stmp.Format("%7.1f", pLainaRS->m_LA_Korko); SetValueRange(CGXRange(lRows, 10), stmp); SetValueRange(CGXRange(lRows, 11), pLainaRS->m_LA_Kielto); if (!pLainaRS->IsFieldNull(&pLainaRS->m_LA_KieltoRajaPv)) { SetStyleRange(CGXRange(lRows, 1, lRows, 17), CGXStyle().SetInterior(RGB(255,0,0)) // red ); } stmp.Format("%7.1f", pLainaRS->m_LA_SaVakMaksuPr); SetValueRange(CGXRange(lRows, 12), stmp); SetValueRange(CGXRange(lRows, 13), "0"); stmp.Format("%7.2f", pLainaRS->m_LA_YlimSaMaksu); SetValueRange(CGXRange(lRows, 14), stmp); SetValueRange(CGXRange(lRows, 15), pLainaRS->m_LA_Liitteet); SetValueRange(CGXRange(lRows, 16), pLainaRS->m_LA_Huom); SetValueRange(CGXRange(lRows, 17), pLainaRS->m_LA_Varasto); if (pLainaRS->m_LA_EraPv < CTime::GetCurrentTime() && !(pLainaRS->m_LA_Tila == "M" || pLainaRS->m_LA_Tila == "L")) { SetStyleRange(CGXRange(lRows, 4, lRows, 4), CGXStyle().SetInterior(RGB(250,141,69)) // rusk.punainen ); } SetRowHeight(lRows,lRows,30); // Rivikork pLainaRS->MoveNext(); } } catch (CDBException* e) { AfxMessageBox(e->m_strError); e->Delete(); } pLainaRS->Close(); //LockUpdate(bLock); Redraw(); // setGridReadOnly(TRUE); if (lRows >= 1) { SetCurrentCell(1,0); strResult = GetValueRowCol(1,1); this->FindRow(atol(strResult)); } else { SetCurrentCell(0,0); strResult = ""; } this->resetWaitDateParam(); //TRACE("Viimeisin lainanumero = %s\n", strResult); return strResult; }
void GLIDebugVariableGrid::OnCellChange(wxGridEvent &gridEvent) { int currRow = gridEvent.GetRow(); int currColumn = gridEvent.GetCol(); //Get if the cell data is a watch value // (and not currently doing a manual cell update) if(internalCellEditCounter == 0 && currRow >= 0 && currRow < rowTypeDataArray.size() && rowTypeDataArray[currRow].type == RT_WatchValue) { UniformData newWatchData; //Get the string value newWatchData.name = GetCellValue(currRow, NAME_COLUMN_INDEX); //Get the type data newWatchData.type = GL_FLOAT; newWatchData.isFloatType = true; GetGLSLType(GetCellValue(currRow, TYPE_COLUMN_INDEX), newWatchData.type, newWatchData.isFloatType); //Test if the watch value index is for a new watch or, editing an old one uint watchIndex = rowTypeDataArray[currRow].indexValue; if(watchIndex >= watchValuesArray.size()) { //Add the new watch if there is room (should always be) and the name has been set if(currColumn == NAME_COLUMN_INDEX && newWatchData.name.length() > 0 && watchValuesArray.size() < MAX_NUM_WATCH_VALUES) { watchValuesArray.push_back(newWatchData); //Refresh the grid RefreshGrid(); //Reset the selected cell SetCurrentCell(currRow, currColumn); } } else { //If the name is valid if(newWatchData.name.length() > 0) { //Override the watch data watchValuesArray[watchIndex] = newWatchData; } else { //Delete the watch value from the array watchValuesArray.erase(watchValuesArray.begin() + watchIndex); //Refresh the grid RefreshGrid(); //Reset the selected cell SetCurrentCell(currRow, currColumn); } } return; } //The event was not processed gridEvent.Skip(); }
void GLIDebugVariableGrid::OnKeyDown(wxKeyEvent &keyEvent) { //If in edit mode, allow all keys through if(IsCellEditControlEnabled()) { keyEvent.Skip(); return; } //Don't allow the enter key to switch between rows if(keyEvent.m_keyCode == WXK_RETURN) { //Toggle the expandable rows if necessary if(ToggleRowExpansion(GetGridCursorRow())) { return; } //If the cell is able to be edited, start editing if(!IsCurrentCellReadOnly()) { EnableCellEditControl(); } return; } //Delete watch values on the delete key if(keyEvent.m_keyCode == WXK_DELETE) { int currRow = GetGridCursorRow(); int currColumn = GetGridCursorCol(); //Check that the current row is in range if(currRow >= 0 && currRow < rowTypeDataArray.size() && rowTypeDataArray[currRow].type == RT_WatchValue) { //Can only delete old stored watch values, not in progress editing ones uint watchIndex = rowTypeDataArray[currRow].indexValue; if(watchIndex < watchValuesArray.size()) { //Delete the watch value from the array watchValuesArray.erase(watchValuesArray.begin() + watchIndex); //Refresh the grid RefreshGrid(); //Reset the selected cell SetCurrentCell(currRow, currColumn); return; } } } //Handle Ctrl-C to copy the contents of a cell to the clipboard if(keyEvent.m_keyCode == 'C' && keyEvent.m_controlDown) { if (wxTheClipboard->Open()) { //Add the data this is in the current cell wxTheClipboard->SetData( new wxTextDataObject(GetCellValue(GetGridCursorRow(), GetGridCursorCol())) ); wxTheClipboard->Close(); } } //Process all other keys keyEvent.Skip(); }