//---------------------------------------------------------
void CActive_Attributes_Control::On_Field_Open(wxCommandEvent &event)
{
	int	iField	= m_Field_Offset + GetGridCursorCol();
	int	iRecord	=                  GetGridCursorRow();

	if( iField >= 0 && iField<m_pTable->Get_Field_Count() && iRecord >= 0 && iRecord < m_pTable->Get_Count() )
	{
		CSG_Table_Record	*pRecord	= m_pTable->Get_Record(iRecord);

		if( event.GetId() == ID_CMD_TABLE_FIELD_OPEN_APP )
		{
			Open_Application(pRecord->asString(iField));
		}

		if( event.GetId() == ID_CMD_TABLE_FIELD_OPEN_DATA )
		{
			wxString	Value	= pRecord->asString(iField);

			if( _Get_DataSource(Value) )
			{
				g_pData->Open   (Value);
			}
		}
	}
}
//---------------------------------------------------------
void CVIEW_Table_Control::On_LClick(wxGridEvent &event)
{
	int					iField		= m_Field_Offset + event.GetCol();
	CSG_Table_Record	*pRecord	= m_pRecords[event.GetRow()];

	//-----------------------------------------------------
	if( event.AltDown() )
	{
		if( m_pTable->Get_Field_Type(iField) == SG_DATATYPE_String )
		{
			if( event.ControlDown() )
			{
				g_pData->Open   (pRecord->asString(iField));
			}
			else
			{
				Open_Application(pRecord->asString(iField));
			}
		}
	}

	//-----------------------------------------------------
	else if( event.ControlDown() )
	{
		m_pTable->Select(pRecord, true);

		Update_Selection();
	}

	else if( event.ShiftDown() )
	{
		SelectBlock(event.GetRow(), 0, GetGridCursorRow(), GetNumberCols(), false);
	}

	else
	{
		SelectRow(event.GetRow(), false);

		if( pRecord && iField >= m_Field_Offset && iField < m_pTable->Get_Field_Count() && m_pTable->Get_Field_Type(iField) == SG_DATATYPE_Color )
		{
			long	lValue;

			if( DLG_Color(lValue = pRecord->asInt(iField)) )
			{
				pRecord->Set_Value(iField, lValue);

				SetCellBackgroundColour(event.GetRow(), event.GetCol(), Get_Color_asWX(pRecord->asInt(iField)));

				ForceRefresh();
			}
		}
	}

	//-----------------------------------------------------
	SetGridCursor(event.GetRow(), event.GetCol());
}
//---------------------------------------------------------
void CActive_Attributes_Control::On_LClick(wxGridEvent &event)
{
	int					iField		= m_Field_Offset + event.GetCol();
	CSG_Table_Record	*pRecord	= m_pTable->Get_Record(event.GetRow());

	//-----------------------------------------------------
	if( event.AltDown() )
	{
		if( m_pTable->Get_Field_Type(iField) == SG_DATATYPE_String )
		{
			Open_Application(pRecord->asString(iField));
		}
	}

	//-----------------------------------------------------
	if( event.ControlDown() )
	{
		if( m_pTable->Get_Field_Type(iField) == SG_DATATYPE_String )
		{
			g_pData->Open   (pRecord->asString(iField));
		}
	}

	//-----------------------------------------------------
	else
	{
		if( pRecord && iField >= m_Field_Offset && iField < m_pTable->Get_Field_Count() && m_pTable->Get_Field_Type(iField) == SG_DATATYPE_Color )
		{
			long	lValue;

			if( DLG_Color(lValue = pRecord->asInt(iField)) )
			{
				pRecord->Set_Value(iField, lValue);

				SetCellBackgroundColour(event.GetRow(), event.GetCol(), Get_Color_asWX(pRecord->asInt(iField)));

				ForceRefresh();
			}
		}
	}

	//-----------------------------------------------------
	SetGridCursor(event.GetRow(), event.GetCol());
}
//---------------------------------------------------------
void CVIEW_Table_Control::On_Field_Open(wxCommandEvent &event)
{
	int	iField	= m_Field_Offset + GetGridCursorCol();
	int	iRecord	=                  GetGridCursorRow();

	if( iField >= 0 && iField<m_pTable->Get_Field_Count() && iRecord >= 0 && iRecord < m_pTable->Get_Count() )
	{
		CSG_Table_Record	*pRecord	= m_pRecords[iRecord];

		if( event.GetId() == ID_CMD_TABLE_FIELD_OPEN_APP )
		{
			Open_Application(pRecord->asString(iField));
		}

		if( event.GetId() == ID_CMD_TABLE_FIELD_OPEN_DATA )
		{
			g_pData->Open   (pRecord->asString(iField));
		}
	}
}
Exemple #5
0
//---------------------------------------------------------
bool		Open_WebBrowser(const wxChar *Reference)
{
	return( Open_Application(Reference, wxT("html")) );
}