Exemplo n.º 1
0
void Maze::readFromFile(std::ifstream &f)
{
	for (int i = 0; i < size; i++)
	{
		for(int j = 0; j < size; j++)
		{

			f >> maze[i][j];
		}
	}
	x = getStartRow();
	y = getStartCol();
	startRow = getStartRow();
	startCol = getStartCol();
	endRow = getEndRow();
	endCol = getEndCol();
}
Exemplo n.º 2
0
LRESULT ListCtrl::ongetProperties( UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled )
{
	switch(wParam)
	{
	case LCP_START_ROW:
		return getStartRow();
	case LCP_END_ROW:
		return getEndRow();
	case LCP_START_COL:
		return getStartCol();
	case LCP_END_COL:
		return getEndCol();
	case LCP_ROWNUM_WIDTH:
		return getRowNumBarWidth();
	default:
		return 0;
	}
}
Exemplo n.º 3
0
/**
 * Style needed
 */
void FbEditor::onStyleNeeded(wxStyledTextEvent & event)
{
    // startint position
    auto startPos  = GetEndStyled();
    auto startLine = LineFromPosition(startPos);
    startPos       = PositionFromLine(startLine);
    // end position
    int lastPos    = event.GetPosition();
    int lastLine   = std::max(LineFromPosition(lastPos), std::min(GetLineCount(), GetFirstVisibleLine() + LinesOnScreen()));
    lastPos        = GetLineEndPosition(lastLine);
        
    // get token
    auto token = m_srcCtx->getLine(startLine, lastLine);
    
    // set stylling position
    StartStyling(startPos, INT_MAX);
    
    // clear indicatirs
    SetIndicatorCurrent(ErrorIndicator);
    IndicatorClearRange(startPos, lastPos - startPos);
    
    // no token? just colour to default
    if (!token) {
        style(lastPos - startPos, TokenStyle::Default);
        return;
    }
    
    
    // style the tokens
    int line = startLine;
    int col  = 0;
    while (token && line <= lastLine) {
        // end of the line?
        if (token->getKind() == TokenKind::EndOfLine) {
            token = token->getNext();
            continue;
        }
        
        // token line
        int tline = token->getLine();
        
        // token started before current line
        if (line > tline) {
            int start = PositionFromLine(line);
            int end   = PositionFromLine(token->getEndLine()) + token->getEndCol();
            style(end - start, token);
            
            // end on line and column
            col  = token->getEndCol();
            line = token->getEndLine();
            
            // get next token and continue
            token = token->getNext();
            continue;
        }
        
        // empty lines before next token?
        if (line < tline) {
            int start = PositionFromLine(line) + col;
            int end   = PositionFromLine(tline) + token->getCol();
            style(end - start, TokenStyle::Default);
            
            // end on line and column
            line = token->getLine();
            col = token->getCol();
            continue;
        }
        
        // started on the current line
        if (line == tline) {
            // empty space ?
            if (token->getCol() > col) {
                style(token->getCol() - col, TokenStyle::Default);
            }
            
            // style the token
            style(token->getLength(), token);
            col = token->getEndCol();
            line = token->getEndLine();
            
            // advance to the next one
            token = token->getNext();
            continue;
        }
        
        // some empty space till end of the line
        int length = GetLineLength(line);
        if (col < length) {
            style(length - col, TokenStyle::Default);
        }
        
        // incement line
        line++;
        col = 0;
    }
}