Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 4746 → Rev 4745

/branches/Version13x/Scribus/scribus/pageitem_textframe.cpp
2244,7 → 2244,7
altx = itemText.at(pos)->yp;
if ( altx > alty )
{
// we were at begin of line
// we was at begin of line
break;
}
}
2255,9 → 2255,6
}
else
{
//Control Home for start of frame text
pos=0;
/*
// paragraph begin
if ( pos < len &&
itemText.at(pos)->ch.at(0).latin1() == 13 )
2270,14 → 2267,10
}
else
--pos;
*/
}
CPos = pos;
if ( buttonState & ShiftButton )
ExpandSel(-1, oldPos);
if ( this->HasSel )
view->RefreshItem(this);
ScMW->setTBvals(this);
break;
case Key_End:
// go to end of line
2322,9 → 2315,6
}
else
{
//Control End for end of frame text
pos=static_cast<int>(itemText.count());
/*
// go to end of paragraph
if ( itemText.at(CPos)->ch.at(0).latin1() == 13 )
{
2338,106 → 2328,77
else
++pos;
}
*/
CPos = pos;
}
if ( buttonState & ShiftButton )
ExpandSel(1, oldPos);
if ( this->HasSel )
view->RefreshItem(this);
ScMW->setTBvals(this);
break;
case Key_Down:
if (buttonState & ControlButton)
if (CPos != static_cast<int>(itemText.count()))
{
// go to end of paragraph
len = static_cast<int>(itemText.count());
if ( CPos >= len )
break; // at end of frame
if ( itemText.at(CPos)->ch.at(0).latin1() == 13 )
bool down1=false;
double newy;
newy = alty = itemText.at(CPos)->yp;
altx = itemText.at(CPos)->xp;
do
{
break;
}
pos = CPos;
while ( pos < len )
{
if ( itemText.at(pos)->ch.at(0).latin1() == 13 )
++CPos;
if (CPos == static_cast<int>(itemText.count()))
break;
else
++pos;
}
CPos = pos;
if ( buttonState & ShiftButton )
ExpandSel(1, oldPos);
}
else
{
if (CPos != static_cast<int>(itemText.count()))
{
bool down1=false;
double newy;
newy = alty = itemText.at(CPos)->yp;
altx = itemText.at(CPos)->xp;
do
//CB Catch some funny empty lines. still testing
//if ((CPos < static_cast<int>(itemText.count())-1) && itemText.at(CPos+1)->ch[0].digitValue()==-1 && itemText.at(CPos)->ch[0].digitValue()==-1 && itemText.at(CPos)->xp == altx && itemText.at(CPos)->yp == alty)
// break;
if (itemText.at(CPos)->yp > alty)
{
++CPos;
if (CPos == static_cast<int>(itemText.count()))
if (down1 && itemText.at(CPos)->yp > newy)
{
--CPos;
break;
//CB Catch some funny empty lines. still testing
//if ((CPos < static_cast<int>(itemText.count())-1) && itemText.at(CPos+1)->ch[0].digitValue()==-1 && itemText.at(CPos)->ch[0].digitValue()==-1 && itemText.at(CPos)->xp == altx && itemText.at(CPos)->yp == alty)
// break;
if (itemText.at(CPos)->yp > alty)
{
if (down1 && itemText.at(CPos)->yp > newy)
{
--CPos;
break;
}
if (itemText.at(CPos)->xp >= altx)
break;
down1=true;
}
//CB Make the cursor move forward a column
if (itemText.at(CPos)->yp < alty)
{
double newX=altx+columnWidth();
while (itemText.at(CPos)->xp<newX && CPos < static_cast<int>(itemText.count())-1)
++CPos;
if (itemText.at(CPos)->xp >= altx)
break;
}
newy=itemText.at(CPos)->yp;
down1=true;
}
while (CPos < static_cast<int>(itemText.count()));
if ( buttonState & ShiftButton )
//CB Make the cursor move forward a column
if (itemText.at(CPos)->yp < alty)
{
if ( buttonState & AltButton )
CPos = itemText.count();
ExpandSel(1, oldPos);
double newX=altx+columnWidth();
while (itemText.at(CPos)->xp<newX && CPos < static_cast<int>(itemText.count())-1)
++CPos;
break;
}
else
if (CPos == static_cast<int>(itemText.count()))
if (NextBox != 0)
newy=itemText.at(CPos)->yp;
}
while (CPos < static_cast<int>(itemText.count()));
if ( buttonState & ShiftButton )
{
if ( buttonState & AltButton )
CPos = itemText.count();
ExpandSel(1, oldPos);
}
else
if (CPos == static_cast<int>(itemText.count()))
if (NextBox != 0)
{
if (NextBox->itemText.count() != 0)
{
if (NextBox->itemText.count() != 0)
{
view->Deselect(true);
NextBox->CPos = 0;
view->SelectItemNr(NextBox->ItemNr);
//currItem = currItem->NextBox;
}
view->Deselect(true);
NextBox->CPos = 0;
view->SelectItemNr(NextBox->ItemNr);
//currItem = currItem->NextBox;
}
}
else
}
}
else
{
if (NextBox != 0)
{
if (NextBox != 0)
if (NextBox->itemText.count() != 0)
{
if (NextBox->itemText.count() != 0)
{
view->Deselect(true);
NextBox->CPos = 0;
view->SelectItemNr(NextBox->ItemNr);
//currItem = currItem->NextBox;
}
view->Deselect(true);
NextBox->CPos = 0;
view->SelectItemNr(NextBox->ItemNr);
//currItem = currItem->NextBox;
}
}
}
2446,90 → 2407,64
ScMW->setTBvals(this);
break;
case Key_Up:
if (buttonState & ControlButton)
if (CPos > 0)
{
if ( (pos = CPos) == 0 )
break; // at begin of frame
len = static_cast<int>(itemText.count());
if ( pos == len )
pos--;
// paragraph begin
if ( pos < len &&
itemText.at(pos)->ch.at(0).latin1() == 13 )
--pos;
while(pos > 0 )
if ( itemText.at(pos)->ch.at(0).latin1() == 13 )
{
++pos;
break;
}
else
--pos;
CPos = pos;
if ( buttonState & ShiftButton )
ExpandSel(-1, oldPos);
}
else
{
if (CPos == static_cast<int>(itemText.count()))
--CPos;
alty = itemText.at(CPos)->yp;
altx = itemText.at(CPos)->xp;
if (CPos > 0)
{
if (CPos == static_cast<int>(itemText.count()))
do
{
--CPos;
alty = itemText.at(CPos)->yp;
altx = itemText.at(CPos)->xp;
if (CPos > 0)
{
do
if (CPos == 0)
break;
if ( itemText.at(CPos)->ch.at(0).latin1() == 13 )
break;
if (itemText.at(CPos)->yp < alty)
{
--CPos;
if (CPos == 0)
if (itemText.at(CPos)->xp <= altx)
break;
if ( itemText.at(CPos)->ch.at(0).latin1() == 13 )
break;
if (itemText.at(CPos)->yp < alty)
{
if (itemText.at(CPos)->xp <= altx)
break;
}
//CB Make the cursor move back a column
if (itemText.at(CPos)->yp > alty)
{
double newX=altx-columnWidth();
while (itemText.at(CPos)->xp>newX && CPos > 0)
--CPos;
break;
}
}
while (CPos > 0);
}
if ( buttonState & ShiftButton )
{
if ( buttonState & AltButton )
CPos = 0;
ExpandSel(-1, oldPos);
}
else
if (CPos == 0)
//CB Make the cursor move back a column
if (itemText.at(CPos)->yp > alty)
{
if (BackBox != 0)
{
view->Deselect(true);
BackBox->CPos = BackBox->itemText.count();
view->SelectItemNr(BackBox->ItemNr);
//currItem = currItem->BackBox;
}
double newX=altx-columnWidth();
while (itemText.at(CPos)->xp>newX && CPos > 0)
--CPos;
break;
}
}
while (CPos > 0);
}
if ( buttonState & ShiftButton )
{
if ( buttonState & AltButton )
CPos = 0;
ExpandSel(-1, oldPos);
}
else
{
CPos = 0;
if (BackBox != 0)
if (CPos == 0)
{
view->Deselect(true);
BackBox->CPos = BackBox->itemText.count();
view->SelectItemNr(BackBox->ItemNr);
//currItem = currItem->BackBox;
if (BackBox != 0)
{
view->Deselect(true);
BackBox->CPos = BackBox->itemText.count();
view->SelectItemNr(BackBox->ItemNr);
//currItem = currItem->BackBox;
}
}
}
else
{
CPos = 0;
if (BackBox != 0)
{
view->Deselect(true);
BackBox->CPos = BackBox->itemText.count();
view->SelectItemNr(BackBox->ItemNr);
//currItem = currItem->BackBox;
}
}
if ( this->HasSel )