Esempio n. 1
0
void FabAtHomePrinter::executePoints(const vector<Point>& points, Bay* bay, const bool flowDuringPath, double pushoutDistance, double pushoutVelocity, double standardDistance, double standardVelocity, double suckbackDistance, double suckbackVelocity, const Point& suckbackPoint)
{
	int currIndex = 0;
	int res = -1;
     bool flowStarted = false;
	while(res != points.size()-1)
	{
		//Invariant: currIndex is the next index to be added to the segment list.
		res = fillSegmentList(points, currIndex);
		//Invariant: res is the most recent index that was added to the segment list.
		//The segment list has been filled so start downloading.
		downloadSegmentList(bay, flowDuringPath && !flowStarted, flowDuringPath && res == points.size()-1, pushoutDistance, pushoutVelocity, standardDistance, standardVelocity, suckbackDistance, suckbackVelocity,suckbackPoint);
          flowStarted = flowDuringPath;
          //The next index to be added to the segment list is the most recent index that was added to the segment list.
		currIndex = res;
	}
}
KLSevenSegmentWidget::KLSevenSegmentWidget(QWidget *parent, const char *name, KLDocument* doc)
    :QDialog(parent, name), ui(new Ui_KLSevenSegmentWidgetBase)
{
    ui->setupUi(this);

    fillSegmentList();

    QList< QRadioButton*> helper;
    helper.append( ui->rbA0 );
    helper.append( ui->rbA1 );
    helper.append( ui->rbA2 );
    helper.append( ui->rbA3 );
    helper.append( ui->rbA4 );
    helper.append( ui->rbA5 );
    helper.append( ui->rbA6 );
    helper.append( ui->rbA7 );
    m_radios.append( helper );
    helper.clear();
    helper.append( ui->rbB0 );
    helper.append( ui->rbB1 );
    helper.append( ui->rbB2 );
    helper.append( ui->rbB3 );
    helper.append( ui->rbB4 );
    helper.append( ui->rbB5 );
    helper.append( ui->rbB6 );
    helper.append( ui->rbB7 );
    m_radios.append( helper );
    helper.clear();
    helper.append( ui->rbC0 );
    helper.append( ui->rbC1 );
    helper.append( ui->rbC2 );
    helper.append( ui->rbC3 );
    helper.append( ui->rbC4 );
    helper.append( ui->rbC5 );
    helper.append( ui->rbC6 );
    helper.append( ui->rbC7 );
    m_radios.append( helper );
    helper.clear();
    helper.append( ui->rbD0 );
    helper.append( ui->rbD1 );
    helper.append( ui->rbD2 );
    helper.append( ui->rbD3 );
    helper.append( ui->rbD4 );
    helper.append( ui->rbD5 );
    helper.append( ui->rbD6 );
    helper.append( ui->rbD7 );
    m_radios.append( helper );
    helper.clear();
    helper.append( ui->rbE0 );
    helper.append( ui->rbE1 );
    helper.append( ui->rbE2 );
    helper.append( ui->rbE3 );
    helper.append( ui->rbE4 );
    helper.append( ui->rbE5 );
    helper.append( ui->rbE6 );
    helper.append( ui->rbE7 );
    m_radios.append( helper );
    helper.clear();
    helper.append( ui->rbF0 );
    helper.append( ui->rbF1 );
    helper.append( ui->rbF2 );
    helper.append( ui->rbF3 );
    helper.append( ui->rbF4 );
    helper.append( ui->rbF5 );
    helper.append( ui->rbF6 );
    helper.append( ui->rbF7 );
    m_radios.append( helper );
    helper.clear();
    helper.append( ui->rbG0 );
    helper.append( ui->rbG1 );
    helper.append( ui->rbG2 );
    helper.append( ui->rbG3 );
    helper.append( ui->rbG4 );
    helper.append( ui->rbG5 );
    helper.append( ui->rbG6 );
    helper.append( ui->rbG7 );
    m_radios.append( helper );
    helper.clear();
    helper.append( ui->rbDP0 );
    helper.append( ui->rbDP1 );
    helper.append( ui->rbDP2 );
    helper.append( ui->rbDP3 );
    helper.append( ui->rbDP4 );
    helper.append( ui->rbDP5 );
    helper.append( ui->rbDP6 );
    helper.append( ui->rbDP7 );
    m_radios.append( helper );
    helper.clear();
    m_document = doc;
    m_dontReactOnToolButtons=false;
    // Here starts the reread code:
    m_whiteSpace = "";
    
    m_startLine = m_stopLine = -1;
    // Now we search in the document for the start and the stop, if any:
    if ( m_document->lastActiveView() )
    {
        if ( m_document->lastActiveView()->view() )
        {
            int curLine = m_document->lastActiveView()->view()->cursorPosition().line();
            m_stopLine = m_startLine = curLine;
            bool foundStart = false, foundStop = false;
            while ( m_startLine >= 0 )
            {
                if ( m_startLine != curLine )
                    if (m_document->kateDoc()->line( m_startLine ).upper().stripWhiteSpace().startsWith( WIZARD_END ))
                        break;
                if (!m_document->kateDoc()->line( m_startLine ).upper().stripWhiteSpace().startsWith( WIZARD_START ))
                    m_startLine--;
                else
                {
                    foundStart = true;
                    break;
                }
            }
            while ( m_stopLine < (int) m_document->kateDoc()->lines() )
            {
                if ( m_stopLine != curLine )
                    if (m_document->kateDoc()->line( m_stopLine ).upper().stripWhiteSpace().startsWith( WIZARD_START ))
                        break;
                if (!m_document->kateDoc()->line( m_stopLine ).upper().stripWhiteSpace().startsWith( WIZARD_END ))
                    m_stopLine++;
                else
                {
                    foundStop = true;
                    break;
                }
            }
            if (!( foundStart && foundStop ))
                m_startLine = m_stopLine = -1;
        }
    }
    
    QRadioButton *bit;
    QList< QRadioButton*> seg;
    for ( unsigned int i=0; i<m_radios.count(); i++ )
    {
        seg=m_radios[i];
        foreach ( bit,seg )
        {
            connect( bit, SIGNAL(toggled( bool )), this, SLOT(slotBitSegmentAssocChanged()) );
        }
    }