CString CVariablesGrid::GetFullName( int row )
{
	// Get the full name.
	CString fullName = GetItemText( row, 0 );
	CGridTreeCell* treeCell = (CGridTreeCell*)GetCell( row, 0 );
	int curLevel = treeCell->GetLevel();
	if (curLevel > 1)
	{
		for (int i = row - 1; i >= 1; --i)
		{
			if (curLevel <= 1)
				break;
			CGridTreeCell* treeCell = (CGridTreeCell*)GetCell(i, 0);
			int level = treeCell->GetLevel();
			if (level == curLevel - 1)
			{
				// Found a new part to tack on.
				fullName = GetItemText(i, 0) + "." + fullName;
				curLevel--;
			}
		}
	}

	return fullName;
}
Exemplo n.º 2
0
void GeneratorData::LinkCells( glm::vec2 posA, glm::vec2 posB )
{
    auto& cellA = GetCell( posA );
    auto& cellB = GetCell( posB );
    if (posA.x > posB.x)
    {
        cellA.AddEntrance( EntranceType::Left );
        cellB.AddEntrance( EntranceType::Right );
    }
    else if (posA.y > posB.y)
    {
        cellA.AddEntrance( EntranceType::Bottom );
        cellB.AddEntrance( EntranceType::Top );
    }
    else if (posA.x < posB.x)
    {
        cellA.AddEntrance( EntranceType::Right );
        cellB.AddEntrance( EntranceType::Left );
    }
    else
    {
        cellA.AddEntrance( EntranceType::Top );
        cellB.AddEntrance( EntranceType::Bottom );
    }
}
Exemplo n.º 3
0
bool JelloMesh::isInterior(const JelloMesh::Spring& s) const
{
    int i1,j1,k1,i2,j2,k2;
    GetCell(s.m_p1, i1, j1, k1);
    GetCell(s.m_p2, i2, j2, k2);
    return isInterior(i1,j1,k1) || isInterior(i2,j2,k2);
}
Exemplo n.º 4
0
//清除上次选中行
void QuoteTableCtrlGeneralSort::RefreshWnd()
{
	COLORREF color = GetGridBkColor();
	CRect rectCell, rectRow;
	CCellID cell =  GetCellFromPt(m_LastDownPoint);

	CGridCellBase* pCell = GetCell(cell.row, cell.col);
	BOOL bInTextArea = FALSE;
	if (pCell)
	{

		if (GetCellRect(cell.row, cell.col, rectCell) &&
			pCell->GetTextRect(rectCell))
		{
			bInTextArea = rectCell.PtInRect(m_LastDownPoint);
		}
	}

	if ( bInTextArea )
	{
		for (int i=0; i<GetColumnCount(); i++)
		{
			pCell = GetCell(cell.row, i);
		/*	pCell->GetBackClr();*/
			if (pCell)
			{
				pCell->SetState(/*pCell->GetState() | */m_iColProp->GetColumnMask(GetHeadID(i)));
				pCell->SetBackClr(color);
			}
		}
	}
	Invalidate();
}
Exemplo n.º 5
0
bool C4Scoreboard::SortBy(int32_t iColKey, bool fReverse)
{
	// get sort col
	int32_t iCol = GetColByKey(iColKey);
	if (iCol<0) return false;
	// sort
	int32_t iSortDir = fReverse ? -1 : +1;
	int32_t iSortBegin=1, iSortEnd=iRows-1;
	while (iSortBegin < iSortEnd)
	{
		int32_t iNewBorder = iSortBegin; int32_t i;
		for (i = iSortBegin; i < iSortEnd; ++i)
			if (GetCell(iCol, i)->iVal * iSortDir > GetCell(iCol, i+1)->iVal * iSortDir)
			{
				SwapRows(i, i+1);
				iNewBorder = i;
			}
		iSortEnd = iNewBorder;
		for (i = iSortEnd; i > iSortBegin; --i)
			if (GetCell(iCol, i-1)->iVal * iSortDir > GetCell(iCol, i)->iVal * iSortDir)
			{
				SwapRows(i-1, i);
				iNewBorder = i;
			}
		iSortBegin = iNewBorder;
	}
	return true;
}
Exemplo n.º 6
0
void GMassMobAppearGrid::SaveParse(GStageLevel* pStage)
{
	CGridCellBase* cell =  NULL;
	GtLongNumberString num;
	for( gint i = 1 ; i < GetRowCount() ; i++ )
	{
		GStageLevel::MassAppearMob mob;

		cell = GetCell( i, 0 );
		num.SetNumber( (gtchar*)cell->GetText() );
		mob.mIndex = (guint32)num.GetNumber( 0 );

		cell = GetCell( i, 1 );
		num.SetNumber( (gtchar*)cell->GetText() );
		mob.mLevel = (guint32)num.GetNumber( 0 );

		cell = GetCell( i, 2 );
		num.SetNumber( (gtchar*)cell->GetText() );
		mob.mNumLine = (guint32)num.GetNumber( 0 );

		cell = GetCell( i, 3 );
		num.SetNumber( (gtchar*)cell->GetText() );
		mob.mNumMobCount = (guint32)num.GetNumber( 0 );

		pStage->AddMassAppearMob( mob );
	}
}
Exemplo n.º 7
0
/**
	@brief	multi sort function.

	@author	BHK
*/
BOOL CGridCtrlEx::MultiSortItems(const int& low , const int& high)
{
///	if (high == -1)
///		high = GetRowCount() - 1;
	
	int lo = low;
	int hi = high;
	const int mid= int((lo + hi)*0.5);

	ResetSelectedRange();
	SetFocusCell(-1, - 1);

	for(int i = low;i < high;++i)
	{
		for(int j = i + 1;j <= high;++j)
		{
			if(MultiCompare(i , j) > 0)
			{
				for (int col = 0; col < GetColumnCount(); col++)
				{
					CGridCellBase *pCell = GetCell(i, col);
					SetCell(i, col, GetCell(j, col));
					SetCell(j, col, pCell);
				}
				UINT nRowHeight    = m_arRowHeights[i];
				m_arRowHeights[i] = m_arRowHeights[j];
				m_arRowHeights[j] = nRowHeight;
			}
		}
	}
	
	return TRUE;
}
Exemplo n.º 8
0
void UpdateCell(World *const w, unsigned int cellX, unsigned int cellY)
{
	
	unsigned char count = 0;
	//Set up the bounds for our search, ensuring that they are
	//within the array.
	int fromX = cellX - 1;
	//Commented-out functionality is pre world-wrapping
	//if(fromX < 0) {
	//	fromX = 0;
	//}
	int toX = cellX + 1;
	//if(toX >= w->width) {
	//	toX = w->width-1;
	//}
	int fromY = cellY - 1;
	//if(fromY < 0) {
	//	fromY = 0;
	//}
	int toY = cellY + 1;
	//if(toY >= w->height) {
	//	toY = w->height-1;
	//}
	bool ourCell = false; //TODO: Should it default false?
	//Search for adjacent tiles.
	for(int itY = fromY; itY <= toY; ++itY)
	{
		for(int itX = fromX; itX <= toX; ++itX)
		{
		//Is this just our cell?
			if((itX == cellX) && (itY == cellY))
			{
				ourCell = GetCell(w, itX, itY);	
			}
			else if(GetCell(w, itX, itY) == true)
			{
				++count;
			}
		}
	}
	if((count < 2) && (ourCell == true))
	{
		//Death by underpopulation
		SetCell(w, cellX, cellY, false);
	}
	else if((count > 3) && (ourCell == true))
	{
		//Death by overcrowding
		SetCell(w, cellX, cellY, false);
	}
	//Two neighbors on a live cell does nothing.
	//Three on an empty cell creates a live cell (reproduction):
	else if((count == 3) && (ourCell == false))
	{
		SetCell(w, cellX, cellY, true);
	}
};
Exemplo n.º 9
0
void cPath::ProcessIfWalkable(const Vector3i & a_Location, cPathCell * a_Parent, int a_Cost)
{
	cPathCell * cell = GetCell(a_Location);
	int x, y, z;

	// Make sure we fit in the position.
	for (y = 0; y < m_BoundingBoxHeight; ++y)
	{
		for (x = 0; x < m_BoundingBoxWidth; ++x)
		{
			for (z = 0; z < m_BoundingBoxWidth; ++z)
			{
				if (GetCell(a_Location + Vector3i(x, y, z))->m_IsSolid)
				{
					return;
				}
			}
		}
	}

	/*
	y = -1;
	for (x = 0; x < m_BoundingBoxWidth; ++x)
	{
		for (z = 0; z < m_BoundingBoxWidth; ++z)
		{
			if (!GetCell(a_Location + Vector3i(x, y, z))->m_IsSolid)
			{
				return;
			}
		}
	}
	ProcessCell(cell, a_Parent, a_Cost);
	*/

	// Make sure there's at least 1 piece of solid below us.

	bool GroundFlag = false;
	y =-1;
	for (x = 0; x < m_BoundingBoxWidth; ++x)
	{
		for (z = 0; z < m_BoundingBoxWidth; ++z)
		{
			if (GetCell(a_Location + Vector3i(x, y, z))->m_IsSolid)
			{
				GroundFlag = true;
				break;
			}
		}
	}

	if (GroundFlag)
	{
		ProcessCell(cell, a_Parent, a_Cost);
	}
}
Exemplo n.º 10
0
void Grid::Addconnections(const int i, const int j, const int iAdder, const int jAdder)
{
    //Centeri = i +
    double Dist = sqrt(iAdder * iAdder + jAdder * jAdder);

    Cell* c1 = GetCell(i,j);
    Cell* c2 = GetCell(i+iAdder,j+jAdder);
    Cell* c3 = GetCell(i-iAdder,j+jAdder);
    Cell* c4 = GetCell(i+iAdder,j-jAdder);
    Cell* c5 = GetCell(i-iAdder,j-jAdder);

    if(c2 && CheckVisibility(c1->Pos,c2->Pos))
        cells[i][j].AddConnection(GetCell(i+iAdder,j+jAdder), Dist);
    if(iAdder != 0)
        if(c3 && CheckVisibility(c1->Pos,c3->Pos))
            cells[i][j].AddConnection(GetCell(i-iAdder,j+jAdder), Dist);
    if(jAdder != 0)
        if(c4 && CheckVisibility(c1->Pos,c4->Pos))
            cells[i][j].AddConnection(GetCell(i+iAdder,j-jAdder), Dist);
    if(iAdder != 0 && jAdder != 0)
        if(c5 && CheckVisibility(c1->Pos,c5->Pos))
            cells[i][j].AddConnection(GetCell(i-iAdder,j-jAdder), Dist);


}
Exemplo n.º 11
0
void CTWenUGCtrlEx::SwapRow(long i, long j)
{
	CUGCell ci, cj;
	for(int cols=0; cols<GetNumberCols(); cols++)
	{
		GetCell(cols, i, &ci);
		GetCell(cols, j, &cj);
		SetCell(cols, i, &cj);
		SetCell(cols, j, &ci);
	}
}
Exemplo n.º 12
0
void XYViewGridControl::UpdateXYData()
{
    for (int i = 1; i < GetRowCount(); i++)
    {
        GetCell(i, 1)->UpdateText();
        GetCell(i, 2)->UpdateText();
    }

    AutoSize();

    InvalidateAll();
}
void
GLUndoElementCut::Undo()
{
	// change value to old value
	GetData()->InsertElement(GetCell(), itsValue);

	// create undo object to change it back
	GLUndoElementAppend* undo = 
		new GLUndoElementAppend(GetTable(), GetCell());
	assert(undo != NULL);
	NewUndo(undo);
}
void CvTacticalAnalysisMap::EstablishZoneNeighborhood()
{
	//walk over the map and see which zones are adjacent
	int iW = GC.getMap().getGridWidth();
	int iH = GC.getMap().getGridHeight();

	for(unsigned int iI = 0; iI < m_DominanceZones.size(); iI++)
	{
		m_DominanceZones[iI].ClearNeighboringZones();
	}

	for (int i=0; i<iW; i++)
	{
		for (int j=0; j<iH; j++)
		{
			CvPlot* pA = GC.getMap().plot(i,j);
			CvPlot* pB = GC.getMap().plot(i,j+1);
			CvPlot* pC = GC.getMap().plot(i+1,j);

			CvTacticalAnalysisCell* cA = pA ? GetCell( pA->GetPlotIndex() ) : NULL;
			CvTacticalAnalysisCell* cB = pB ? GetCell( pB->GetPlotIndex() ) : NULL;
			CvTacticalAnalysisCell* cC = pC ? GetCell( pC->GetPlotIndex() ) : NULL;

			if (cA && cB)
			{
				int iA = cA->GetDominanceZone();
				int iB = cB->GetDominanceZone();
				if (iA!=-1 && iB!=-1 && 
					GetZoneByID(iA)->GetTerritoryType()!=TACTICAL_TERRITORY_NO_OWNER &&
					GetZoneByID(iB)->GetTerritoryType()!=TACTICAL_TERRITORY_NO_OWNER
					)
				{
					GetZoneByID(iA)->AddNeighboringZone(iB);
					GetZoneByID(iB)->AddNeighboringZone(iA);
				}
			}
			if (cA && cC)
			{
				int iA = cA->GetDominanceZone();
				int iC = cC->GetDominanceZone();
				if (iA!=-1 && iC!=-1 &&
					GetZoneByID(iA)->GetTerritoryType()!=TACTICAL_TERRITORY_NO_OWNER &&
					GetZoneByID(iC)->GetTerritoryType()!=TACTICAL_TERRITORY_NO_OWNER
					)
				{
					GetZoneByID(iA)->AddNeighboringZone(iC);
					GetZoneByID(iC)->AddNeighboringZone(iA);
				}
			}
		}
	}
}
Exemplo n.º 15
0
bool World::IsNewLand(MapPoint const &p) const
{
    if (INVALID_CONTINENT == GetCell(p)->GetContinent())
    {
        uint32 e = GetCell(p)->GetEnv();

        return (e & k_BIT_MOVEMENT_TYPE_LAND)
            || (e & k_BIT_MOVEMENT_TYPE_MOUNTAIN)
            || (e & k_MASK_ENV_CANAL_TUNNEL);
    }

    return false;
}
Exemplo n.º 16
0
JBoolean
JXTable::HitSamePart
	(
	const JPoint& pt1,
	const JPoint& pt2
	)
	const
{
	JPoint cell1, cell2;
	return JConvertToBoolean( GetCell(pt1, &cell1) &&
							  GetCell(pt2, &cell2) &&
							  cell1 == cell2 );
}
Exemplo n.º 17
0
bool World::IsNewWater(MapPoint const & p) const
{
    Cell *  c = GetCell(p);
    sint32  v = c->GetContinent();

    if (INVALID_CONTINENT == v)
    {
        uint32 e = GetCell(p)->GetEnv();
        return (e & k_BIT_MOVEMENT_TYPE_WATER)
            || (e & k_BIT_MOVEMENT_TYPE_SHALLOW_WATER)
            || (c->GetCity().m_id != 0);
    }

    return false;
}
Exemplo n.º 18
0
void OCME::BuildImpostorsHierarchy(std::vector<Cell*> & fromCells){
	++impostor_updated;
	/*
	The impostors are built bottom up, starting from the smallest cells (lowest h)
	*/
	std::vector<CellKey> cells_by_level [256];

	std::vector<Cell*>::iterator ci;


	// phase 1. fill the array of level with the cells and compute centroid and data occupancy
	for(ci  = fromCells.begin(); ci != fromCells.end(); ++ci){
		(*ci)->impostor->SetCentroids();
		CellKey & ck = (*ci)->key;
		cells_by_level[COff(ck.h)].push_back(ck);
	}

	unsigned int level = 0;
	while( (level  < 256) &&  cells_by_level[level].empty() ) {++level;} // find the lowest non empty level
	if(level == 256) return;												// if the database is empty return

	// phase 2., bottom up updating of the impostors
	std::vector<vcg::Point3f> smp;
//	unsigned int tmpEnd = level+5;
	for( ; level  < 255;++level ){

			::RemoveDuplicates(cells_by_level[level]);
		// build of the impostors of this level
		for(unsigned int i = 0; i <cells_by_level[level].size();++i) 
				GetCell( cells_by_level[level][i],false)->impostor->Create( this,cells_by_level[level][i]);
		for(unsigned int i = 0; i <cells_by_level[level].size();++i) 
				GetCell( cells_by_level[level][i],false)->impostor->ClearDataCumulate();

		for(unsigned int i = 0; i <cells_by_level[level].size();++i){
			const CellKey &  k = cells_by_level[level][i];
			Cell* cell = GetCell( k,false);
			assert(cell);
			if(!cell->rd->impostor_updated()){
				const CellKey & pk = Parent(k);
			//	to_insert  = (GetCell( pk,false)==NULL);
				if(!UpdateImpostor(pk) /*&& to_insert*/)
					cells_by_level[level+1].push_back(pk);
				else
					octree_roots.push_back(GetCell(pk));
			}
		}
	}
}
Exemplo n.º 19
0
vector<Cell> GetClosestPath(const model::World& world,
                            Cell const & start, Direction const start_dir, Cell const & finish, Game const & game)
{
    
    static map<cashe_key, vector<Cell> > cacshe;
    static int bonus_hash = 0;
    int bonus_hash_cur = 0;
    auto const & map = world.getTilesXY();
    vector<vector<int>> bonuses(map.size(), vector<int>(map[0].size(), 0));
    for (Bonus const & bonus: world.getBonuses())
    {
        bonus_hash_cur += bonus.getX() * bonus.getX() + bonus.getY() * bonus.getY();
        auto bonus_cell= GetCell(bonus, game);
        bonuses[bonus_cell.m_x][bonus_cell.m_y] = (bonus.getType() == PURE_SCORE || bonus.getType() == REPAIR_KIT) ? 1 : 0;
    }
    if (bonus_hash !=  bonus_hash_cur)
    {
        bonus_hash = bonus_hash_cur;
        cacshe.clear();
    }
    
    
    
    cashe_key ck = {start, start_dir, finish};
    if (cacshe.count(ck) == 1)
        return cacshe[ck];
    
    MapT data;
    DSF(world.getTilesXY(), {start, start_dir}, {start, start_dir}, finish, data, bonuses);
    //    PrintMap(world.getTilesXY(), data);
    
    vector<Cell> res;
    int const INF = 1000000;
    int best = INF;
    MapKeyT cur = {finish, LEFT};
    for (auto dir: AllDirections())
    {
        if (data.count({finish,dir}) == 0)
            continue;
        if (data[{finish,dir}].first < best)
        {
            best = data[{finish,dir}].first;
            cur = {finish,dir};
        }
        
    }
    if (best == INF)
        return res;
    
    
    while (cur.first != start)
    {
        res.push_back(cur.first);
        cur = data[cur].second;
    }
    res.push_back(start);
    reverse(res.begin(), res.end());
    cacshe[ck] = res;
    return res;
}
Exemplo n.º 20
0
  //
  // Reset
  //
  // Set default values in all cells
  //
  void Placement::Reset()
  {
    ASSERT(IsSetup());

    for (S32 z = 0; z < size.z; z++)
    {
      for (S32 x = 0; x < size.x; x++)
      {
        // Get the required cell
        Cell &cell = GetCell(x, z);

        // Does this cell lie on the footprint
        cell.onFoot = ((x > 0) && (x < size.x - 1) && (z > 0) && (z < size.z - 1));

        // Set default data
        cell.result = PR_NONE;
        cell.map.Set(0, 0);
        cell.zip.Set(-1, -1);
        cell.type.Set(x - 1, z - 1);
      }
    }   

    // Reset best height
    thumpHeight = 0.0F;
  }
Exemplo n.º 21
0
void CUniformGrid::GetUnitsInRadius(NodeVector * dstVector, const Vector3 & point, float radius)
{
	const Vector3 radiusPoint(radius, radius, 0);

	int minX, minY;
	CellCoordFromMapPoint(&minX, &minY, point - radiusPoint);
	minX = math::max(0, math::min(minX, (m_Width - 1)));
	minY = math::max(0, math::min(minY, (m_Height - 1)));

	int maxX, maxY;
	CellCoordFromMapPoint(&maxX, &maxY, point + radiusPoint);
	maxX = math::max(0, math::min(maxX, (m_Width - 1)));
	maxY = math::max(0, math::min(maxY, (m_Height - 1)));

	dstVector->clear();

	for (int y = minY; y <= maxY; ++y)
	{
		for (int x = minX; x <= maxX; ++x)
		{
			// FIXME: non optimal - square, refactor me
			NodeVector *  gridVector = GetCell(x, y);
			dstVector->insert(dstVector->end(), gridVector->begin(), gridVector->end());
		}
	}
}
Exemplo n.º 22
0
void CTWenUGCtrlEx::AppendRow_ButtonAdd(void)
{
	int nRow = CUGCtrl::GetNumberRows();

	if(nRow > 0)
	{
		CUGCell cell;
		GetCell(0, nRow-1, &cell);

		if(cell.GetBitmap()==GetBitmap(m_nIndexBMP_Add))//如果有增加行
		{
			return;
		}
	}

	if(AppendRow() != UG_SUCCESS) return;

	int nCol = GetNumberCols();

	JoinCells(1, nRow, nCol-1, nRow);

	if(nCol>1)
	{
		QuickSetBackColor(1, nRow, RGB(240,240,240));
		QuickSetBorder(1, nRow, UG_BDR_RAISED|UG_BDR_LTHIN|UG_BDR_RTHIN|UG_BDR_TTHIN|UG_BDR_BTHIN); 
	}

	QuickSetBitmap(0, nRow, m_nIndexBMP_Add);
}
Exemplo n.º 23
0
int CRealTimeGrid::OnCellTypeNotify(long ID,int col,long row,long msg,long param)
{
	if( ID == m_buttonIndex && msg == UGCT_BUTTONCLICK )
	{
		QuickSetNumber( 0, row, 0 );
		QuickRedrawCell( 0, row );

		CUGCell cell;
		GetCell( 3, row, &cell );
		cell.SetBackColor(RGB(255,255,255));
		cell.SetTextColor(RGB(0,0,0));
		cell.SetText( _T( "Okay" ) );
		SetCell( 3, row, &cell );
		QuickRedrawCell( 3, row );

		TRACE( _T( "Reset the progress bar in row %ld" ), row );
		GotoCell( -1, row );
	}

	if( ID == UGCT_CHECKBOX && msg == UGCT_CHECKBOXSET )
	{
		if( param == TRUE )
			TRACE( _T( "Progress bar in row %ld was enabled." ), row );
		else
			TRACE( _T( "Progress bar in row %ld was disabled." ), row );
	}
		
	return TRUE;
}
Exemplo n.º 24
0
void Grid::Arrange(const Rect finalRect) {
    Cell* cell;
    Control* el;

    for (Grid::CellData& d : els) {
        cell = GetCell(d.row, d.col);
        el = d.el;
        Point pos(GetCellPos(d.row, d.col));
        int elDx = el->DesiredSize().Width;
        int containerDx = 0;
        for (int i = d.col; i < d.col + d.colSpan; i++) {
            containerDx += maxColWidth[i];
        }

        int xOff = d.horizAlign.CalcOffset(elDx, containerDx);
        pos.X += xOff;
        int elDy = el->DesiredSize().Height;
        int containerDy = maxRowHeight[d.row];
        int yOff = d.vertAlign.CalcOffset(elDy, containerDy);
        pos.Y += yOff;
        Rect r(pos, cell->desiredSize);
        el->Arrange(r);
    }
    SetPosition(finalRect);
}
Exemplo n.º 25
0
void Matrix::CopyTo(Matrix& m) {
    for (int x = 0; x < _size; x++) {
        for (int y = 0; y < _size; y++) {
            GetCell(x, y).CopyTo(m.GetCell(x, y));
        }
    }
}
JBoolean
JXRowHeaderWidget::InDragRegion
	(
	const JPoint&	pt,
	JPoint*			cell
	)
	const
{
	JCoordinate width;
	JColorIndex color;
	GetRowBorderInfo(&width, &color);
	const JCoordinate halfWidth = kDragRegionHalfWidth + (width+1)/2;

	JPoint virtualPt(pt.x, pt.y - halfWidth);
	if (GetCell(virtualPt, cell))
		{
		JRect cellRect = GetCellRect(*cell);
		if (cellRect.bottom - halfWidth <= pt.y &&
			pt.y <= cellRect.bottom + halfWidth)
			{
			return kJTrue;
			}
		}

	return kJFalse;
}
void
CBCommandTable::HandleDNDHere
	(
	const JPoint&	pt,
	const JXWidget*	source
	)
{
	JIndex newRowIndex = itsDNDRowIndex;

	JPoint cell;
	if (GetCell(JPinInRect(pt, GetBounds()), &cell))
		{
		const JRect r = GetCellRect(cell);
		if (pt.y <= r.ycenter())
			{
			newRowIndex = cell.y;
			}
		else
			{
			newRowIndex = cell.y + 1;
			}
		}

	if (newRowIndex != itsDNDRowIndex)
		{
		itsDNDRowIndex = newRowIndex;
		Refresh();
		}
}
void
CBCommandTable::HandleMouseDown
	(
	const JPoint&			pt,
	const JXMouseButton		button,
	const JSize				clickCount,
	const JXButtonStates&	buttonStates,
	const JXKeyModifiers&	modifiers
	)
{
	JPoint cell;
	if (ScrollForWheel(button, modifiers) ||
		!GetCell(pt, &cell))
		{
		return;
		}

	itsStartPt = pt;
	if (cell.x == kOptionsColumn)
		{
		SelectSingleCell(cell);
		itsOptionsMenu->PopUp(this, pt, buttonStates, modifiers);
		}
	else if (button == kJXLeftButton)
		{
		SelectSingleCell(cell);
		if (clickCount == 2)
			{
			BeginEditing(cell);
			}
		}
}
void
GMAccountList::HandleMouseDown
	(
	const JPoint&			pt,
	const JXMouseButton	button,
	const JSize			clickCount,
	const JXButtonStates&	buttonStates,
	const JXKeyModifiers&	modifiers
	)
{
	JPoint cell;
	if (button == kJXLeftButton && clickCount == 1 &&
		GetCell(pt, &cell))
		{
		JTableSelection& s = GetTableSelection();
		if (!s.IsSelected(cell) && itsDialog->OKToSwitchAccounts())
			{
			s.ClearSelection();
			s.SelectRow(cell.y);
			Broadcast(NameSelected(cell.y));
			BeginEditing(cell);
			}
		else if (s.IsSelected(cell) && !IsEditing())
			{
			BeginEditing(cell);
			}
		}
	else if (button > kJXRightButton)
		{
		ScrollForWheel(button, modifiers);
		}
}
Exemplo n.º 30
0
void Highlighter::highlightCells()
{
    assert(m_renderer && m_selection.visualization && !m_selection.indices.empty());

    auto dataSet = m_selection.visualization->colorMappingInputData(m_selection.visOutputPort);
    if (!dataSet)
    {
        return;
    }

    const auto index = m_selection.indices.front();

    // extract picked triangle and create highlighting geometry
    // create two shifted polygons to work around occlusion

    auto selection = dataSet->GetCell(index);

    // this is probably a glyph or the like; we don't have an implementation for that in the moment
    if (!selection || selection->GetCellType() == VTK_VOXEL)
    {
        return;
    }

    m_impl->highlightCell(*selection);

    emit geometryChanged();
}