void CLayerTypeGrid::OnDClicked(int col,long row, RECT *rect,POINT *point,BOOL processed) { int lastColIndx = GetNumberCols() - 1; CString cellText(QuickGetText(lastColIndx, row)); int layerType = atoi(cellText); // Edit color if a layerType row (not a group name row) // and double click was not in the layer type column. if (layerType > -1 && col > 0) { CUGCell cell; GetCell(col, row, &cell); COLORREF color = cell.GetBackColor(); // current color CPersistantColorDialog dialog(color); if (dialog.DoModal() == IDOK) { color = dialog.GetColor(); cell.SetBackColor(color); SetCell(col, row, &cell); RedrawAll(); } } }
void CLayerTypeDlg::applyChanges() { int rows = m_layerTypeGrid.GetNumberRows(); // apply all layer set colors for (int layerSet = 0; layerSet < MAX_LAYERSETS; layerSet++) { for (int row = 0; row < rows; row++) { // get the layer type in the last column (hidden) int lastColIndx = m_layerTypeGrid.GetNumberCols() - 1; CString layerTypeStr( m_layerTypeGrid.QuickGetText(lastColIndx, row) ); int layerType = atoi(layerTypeStr); if (layerType < 0) continue; int layerSetColIndx = layerSet + 1; LayerTypeStruct *lt = &pDoc->LayerTypeArray[layerSet][layerType]; CUGCell cell; m_layerTypeGrid.GetCell(layerSetColIndx, row, &cell); COLORREF color = cell.GetBackColor(); BOOL show = cell.GetBool(); lt->color = color; lt->show = show; } } }