예제 #1
0
void DiaGridView::OnClickedButtonRowCol(ROWCOL nHitRow, ROWCOL nHitCol)
{
	switch (nHitCol)
	{

	case 5:
		{
			CGXStyle style;
			GetStyleRowCol(nHitRow, nHitCol, style);

			CColorDialog dlg(style.GetInterior().GetColor());

			COLORREF rgbColor;

			if (dlg.DoModal() == IDOK)
			{
				rgbColor = dlg.GetColor();
				style.SetInterior(rgbColor);
				setEntityPenColor(nHitRow, rgbColor);
			}

			StoreStyleRowCol(nHitRow, nHitCol, &style);
			break;
		}
	default: break;
	}
}
예제 #2
0
BOOL DiaGridView::StoreStyleRowCol( ROWCOL nRow, ROWCOL nCol, const CGXStyle* pStyle, GXModifyType mt /*= gxOverride*/, int nType /*= 0*/ )
{
  auto cell = GetRowData(nRow);
  if( !cell )
    return FALSE;

  switch (nCol)
  {
  case 2:
    {
      CGXStyle styleY;
      GetStyleRowCol(nRow, nCol + 1, styleY);

      CPoint point( pStyle->GetLongValue(), styleY.GetLongValue() );

      setEntityCentralPoint( nRow, point );
      break;
    }
  case 3:
    {
      CGXStyle styleX;
      GetStyleRowCol(nRow, nCol - 1, styleX);

      CPoint point( styleX.GetLongValue(), pStyle->GetLongValue() );

      setEntityCentralPoint(nRow, point);
      break;
    }
  case 4:
    {
      int istyle = getIntegerTypeOfStyle(pStyle->GetValue());

      setEntityPenStyle(nRow, istyle);
      break;
    }
  }
  return TRUE;
}
예제 #3
0
BOOL DiaGridView::GetStyleRowCol( ROWCOL nRow, ROWCOL nCol, CGXStyle& style, GXModifyType mt, int nType )
{
  auto cell = GetRowData(nRow);
  if( !cell )
    return FALSE;

  CPoint point = cell->getCentralPoint();

  switch(nCol)
  {
    case 1:
      style.SetValue(getStringFigureTypeName( cell->type() ));
    return TRUE;

    case 2:
      style.SetValue(point.x);
    return TRUE;

    case 3:
      style.SetValue(point.y);
      return TRUE;
    case 4:
      style
        .SetControl(GX_IDS_CTRL_COMBOBOX)
        .SetChoiceList("solid\ndash\ndashdot\ndashdotdot")
        .SetValue(getStringContourTypeName( cell->getContourStyle() ));
      return TRUE;
    case 5:
      style
        .SetControl(GX_IDS_CTRL_HOTSPOT)	
        .SetInterior(cell->getContourColor());
      return TRUE;
  }

  return FALSE;
}
예제 #4
0
BOOL CRGXMainWndGrid::OnLoadCellStyle(ROWCOL nRow,
									  ROWCOL nCol,
									  CGXStyle& style,
									  LPCTSTR pszExistingValue)
{
	CString sData;
	//UINT cols;
	//UINT row;
	CString s;
	//CGXBrowseParam* pBrowseData = GetBrowseParam();

	ASSERT(nRow <= LONG_MAX);
	//TRACE("pszExistingValue=%s\n", pszExistingValue);
	TRACE("nRow=%d, nCol=%d\n", nRow, nCol);
	if (nRow == 0 && nCol == 0)
	{
      // style for the top-left button
      return FALSE;
	}

	/*else if (nRow == 0)
	{
		// Column headers
		switch (nCol)
		{
		case 1:   style.SetValue("Laina"); break;
		case 4:   style.SetValue("Nimi"); break;
		case 7:   style.SetValue("Pv"); break;
		case 8:   style.SetValue("EräPv"); break;
		case 9:   style.SetValue("Tila"); break;
		case 10:  style.SetValue("Summa"); break;
		case 11:  style.SetValue("Laina"); break;
		}
		return TRUE;
	}
	rs.MoveFirst();
while (!rs.IsEOF())
{
   for (UINT nField = 0; nField < rs.m_nFields; nField++)
   {
      CString s;
      if (rs.GetFieldData(nField, s))
            TRACE(_T("\042%s\042"), s);

      if (nField < rs. m_nFields-1)
         TRACE(_T(", "));
      else
         TRACE(_T("\n"));
   }
   rs.MoveNext( );
}

	*/

	if (nRow > 0 /* && nCol > 0*/)
	{
		/*if (!m_pAsiTest->IsEOF())
		{
			m_pAsiTest->MoveFirst();
			TRACE("Ensimmäinen record! MoveFirst()\n");
		}

		long nRecord = GetRecordFromRow(nRow);
		for (row = 0; row <= nRecord; row++)
		{
			if (!m_pAsiTest->IsEOF())
			{
				m_pAsiTest->MoveNext();
				m_pAsiTest->GetFieldData(0, s);
				TRACE("LaskuNr=%s\n", s);
			}
		}*/

		//	TRACE("R=%d\n", nRecord);
		//	cols = m_pAsiTest->m_nFields;



			//for (UINT nField = 0; nField < cols; nField++)
			//{

				CString s2;
			//	if (m_pAsiTest->GetFieldData(nField, s))
			//	{
			//		s2 = s;
					/*TRACE("s=%s", s);
					if (nField < m_pAsiTest->m_nFields-1)
						 TRACE(_T(", "));
					  else
						 TRACE(_T("\n"));
					*/
					//style.SetInterior(RGB(255,255,0));
					//style.SetValue(GetFieldFromCol(nField));

					//m_pAsiTest->GetFieldData(0, s);
					//TRACE("s=%s\n", s);
					if (nCol == 1)
						style.SetValue("s");
					if (nCol == 2)
						style.SetValue("RJ2");
					if (nCol == 3)
						style.SetValue("RJ3");
					if (nCol == 4)
						style.SetValue("RJ4");
					if (nCol == 5)
						style.SetValue("RJ5");
					if (nCol == 6)
						style.SetValue("RJ6");
					else if (nCol >= 6 && nCol <12)
					{
						style.SetValue("Koe");
						style.SetInterior(RGB(255,255,0));
					}
					else if (nCol == 12)
					{
						style.SetValue("C12");
						style.SetInterior(RGB(0,0,255));
					}
			//	}
			//}
			//m_pAsiTest->GetFieldData(nRecord, sData);





		//style.SetInterior(RGB(255,255,0));
		//style.SetValue(GetFieldFromCol(nCol));

		return TRUE;
	}

	return TRUE;

}
///////////////////////////////////////////////////////////////////////////
// GetStyleRowCol: Called by grid core to get the values and styles for
// grid cells.  This allows us to implement a "virtual" grid.
// Inputs:
//	ROWCOL			nRow		Row of cell to fetch.  Zero means column header.
//	ROWCOL			nCol		Column of cell to fetch.  Zero means row header.
//	GXModifyType	mt			Modification type (see OG docs).
//	int				nType		-1 for complete row, column, or table
// Outputs:
//	CGXStyle&		styleReturn	The style object that will be filled in 
//								by this method.
// Return value:
//	BOOL		TRUE if this method filled in the style/value, FALSE if
//				the grid base class should do it.
///////////////////////////////////////////////////////////////////////////
BOOL CStreetSegmentBrowseGrid::GetStyleRowCol(
	ROWCOL nRow, 
	ROWCOL nCol, 
	CGXStyle& style, 
	GXModifyType mt, 
	int nType
) {
	// Set basic style
	style.SetReadOnly(TRUE);

	if (mt == gxRemove) {
		// not supported
		return FALSE;
	} else if (nType == -1) {      
		// here you can return the style for a complete row, column or table
		return FALSE;   
	} else if (nRow == 0 && nCol == 0) {
		// style for the top-left button
		return FALSE;
	} else if (nRow == 0 && nCol > 0) {
		// Column headers
		const char* label = "";
		switch (nCol) {
		case AddrLowColumn: label = "AddrLow"; break;
		case AddrHighColumn: label = "AddrHigh"; break;
		case IsRightSideColumn: label = "Side"; break;
		case CountyCodeColumn: label = "County"; break;
		case CensusTractColumn: label = "Tract"; break;
		case CensusBlockColumn: label = "Block"; break;
		case PostcodeExtColumn: label = "Pcode Ext"; break;
		case SegmentIDColumn: label = "CoordID"; break;
		case SegmentCountColumn: label = "CoordCount"; break;
		}
		style.
			SetValue(label).
			SetReadOnly(TRUE);
		return TRUE;
	} else if (nCol == 0) {
		// Row headers
		return FALSE;
	}

	if (refQueryFile == 0) {
		return FALSE;
	}

	int recordID = nRow - 1;
	StreetSegment streetSegment;
	if (!refQueryFile->GetStreetSegmentByIDCached(recordID, streetSegment)) {
		style.
			SetValue("***ERROR***");
		return TRUE;
	}

	char buf[100];
	switch (nCol) {
	case AddrLowColumn: 
		style.SetValue(streetSegment.addrLow);
		break;
	case AddrHighColumn: 
		style.SetValue(streetSegment.addrHigh);
		break;
	case IsRightSideColumn: 
		style.SetValue(streetSegment.isRightSide == 0 ? "L" : "R");
		break;
	case CountyCodeColumn: 
		sprintf(buf, "%d", streetSegment.countyCode);
		style.SetValue(buf);
		break;
	case CensusTractColumn: 
		style.SetValue(streetSegment.censusTract);
		break;
	case CensusBlockColumn: 
		style.SetValue(streetSegment.censusBlock);
		break;
	case PostcodeExtColumn: 
		style.SetValue(streetSegment.postcodeExt);
		break;
	case SegmentIDColumn:
		sprintf(buf, "%d", streetSegment.coordinateID);
		style.SetValue(buf);
		break;
	case SegmentCountColumn: 
		sprintf(buf, "%d", streetSegment.coordinateCount);
		style.SetValue(buf);
		break;
	default:
		style.
			SetValue("***ERROR***");
		return TRUE;
		break;
	}

	// Selection processing
	if ((int)nRow >= selStart && (int)nRow <= selEnd) {
		// Highlight selected cells.
		style.
			SetInterior(0x000000).
			SetTextColor(0xFFFFFF);

	}

	return TRUE;
}