Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 15219 → Rev 15220

/trunk/Scribus/scribus/scribusdoc.cpp
8819,9 → 8819,68
regionsChanged()->update(QRectF());
}
 
void ScribusDoc::itemSelection_AlignItemRight(int i, double newX, AlignMethod how)
{
double diff=newX-AObjects[i].x2;
double width=AObjects[i].x2-AObjects[i].x1;
bool resize = (how == alignByResizing && diff > -width);
for (int j = 0; j < AObjects[i].Objects.count(); ++j)
if (!AObjects[i].Objects.at(j)->locked()) {
if (resize) {
AObjects[i].Objects.at(j)->resizeBy(diff, 0.0);
AObjects[i].Objects.at(j)->updateClip();
}
else AObjects[i].Objects.at(j)->moveBy(diff, 0.0);
}
}
 
void ScribusDoc::itemSelection_AlignLeftOut(AlignTo currAlignTo, double guidePosition)
void ScribusDoc::itemSelection_AlignItemLeft(int i, double newX, AlignMethod how)
{
double diff=newX-AObjects[i].x1;
double width=AObjects[i].x2-AObjects[i].x1;
bool resize = (how == alignByResizing && -diff > -width);
for (int j = 0; j < AObjects[i].Objects.count(); ++j)
if (!AObjects[i].Objects.at(j)->locked()) {
AObjects[i].Objects.at(j)->moveBy(diff, 0.0);
if (resize) {
AObjects[i].Objects.at(j)->resizeBy(-diff, 0.0);
AObjects[i].Objects.at(j)->updateClip();
}
}
}
 
void ScribusDoc::itemSelection_AlignItemBottom(int i, double newY, AlignMethod how)
{
double diff=newY-AObjects[i].y2;
double height=AObjects[i].y2-AObjects[i].y1;
bool resize = (how == alignByResizing && diff > -height);
for (int j = 0; j < AObjects[i].Objects.count(); ++j)
if (!AObjects[i].Objects.at(j)->locked()) {
if (resize) {
AObjects[i].Objects.at(j)->resizeBy(0.0, diff);
AObjects[i].Objects.at(j)->updateClip();
}
else AObjects[i].Objects.at(j)->moveBy(0.0, diff);
}
}
 
void ScribusDoc::itemSelection_AlignItemTop(int i, double newY, AlignMethod how)
{
double diff=newY-AObjects[i].y1;
double height=AObjects[i].y2-AObjects[i].y1;
bool resize = (how == alignByResizing && -diff > -height);
for (int j = 0; j < AObjects[i].Objects.count(); ++j)
if (!AObjects[i].Objects.at(j)->locked()) {
AObjects[i].Objects.at(j)->moveBy(0.0, diff);
if (resize) {
AObjects[i].Objects.at(j)->resizeBy(0.0, -diff);
AObjects[i].Objects.at(j)->updateClip();
}
}
}
 
void ScribusDoc::itemSelection_AlignLeftOut(AlignTo currAlignTo, AlignMethod currAlignMethod, double guidePosition)
{
if (!startAlign())
return;
uint alignObjectsCount=AObjects.count();
8853,17 → 8912,12
break;
}
for (int i = loopStart; i <= loopEnd; ++i)
{
double diff=newX-AObjects[i].x2;
for (int j = 0; j < AObjects[i].Objects.count(); ++j)
if (!AObjects[i].Objects.at(j)->locked())
AObjects[i].Objects.at(j)->moveBy(diff, 0.0);
}
itemSelection_AlignItemRight(i, newX, currAlignMethod);
endAlign();
}
 
 
void ScribusDoc::itemSelection_AlignLeftIn(AlignTo currAlignTo, double guidePosition)
void ScribusDoc::itemSelection_AlignLeftIn(AlignTo currAlignTo, AlignMethod currAlignMethod, double guidePosition)
{
if (!startAlign())
return;
8896,17 → 8950,12
break;
}
for (int i = loopStart; i <= loopEnd; ++i)
{
double diff=newX-AObjects[i].x1;
for (int j = 0; j < AObjects[i].Objects.count(); ++j)
if (!AObjects[i].Objects.at(j)->locked())
AObjects[i].Objects.at(j)->moveBy(diff, 0.0);
}
itemSelection_AlignItemLeft(i, newX, currAlignMethod);
endAlign();
}
 
 
void ScribusDoc::itemSelection_AlignCenterHor(AlignTo currAlignTo, double guidePosition)
void ScribusDoc::itemSelection_AlignCenterHor(AlignTo currAlignTo, AlignMethod currAlignMethod, double guidePosition)
{
if (!startAlign())
return;
8960,7 → 9009,7
}
 
 
void ScribusDoc::itemSelection_AlignRightIn(AlignTo currAlignTo, double guidePosition)
void ScribusDoc::itemSelection_AlignRightIn(AlignTo currAlignTo, AlignMethod currAlignMethod, double guidePosition)
{
if (!startAlign())
return;
8995,17 → 9044,12
break;
}
for (int i = loopStart; i <= loopEnd; ++i)
{
double diff=newX-AObjects[i].x2;
for (int j = 0; j < AObjects[i].Objects.count(); ++j)
if (!AObjects[i].Objects.at(j)->locked())
AObjects[i].Objects.at(j)->moveBy(diff, 0.0);
}
itemSelection_AlignItemRight(i, newX, currAlignMethod);
endAlign();
}
 
 
void ScribusDoc::itemSelection_AlignRightOut(AlignTo currAlignTo, double guidePosition)
void ScribusDoc::itemSelection_AlignRightOut(AlignTo currAlignTo, AlignMethod currAlignMethod, double guidePosition)
{
if (!startAlign())
return;
9040,17 → 9084,12
break;
}
for (int i = loopStart; i <= loopEnd; ++i)
{
double diff=newX-AObjects[i].x1;
for (int j = 0; j < AObjects[i].Objects.count(); ++j)
if (!AObjects[i].Objects.at(j)->locked())
AObjects[i].Objects.at(j)->moveBy(diff, 0.0);
}
itemSelection_AlignItemLeft(i, newX, currAlignMethod);
endAlign();
}
 
 
void ScribusDoc::itemSelection_AlignTopOut(AlignTo currAlignTo, double guidePosition)
void ScribusDoc::itemSelection_AlignTopOut(AlignTo currAlignTo, AlignMethod currAlignMethod, double guidePosition)
{
if (!startAlign())
return;
9083,17 → 9122,12
break;
}
for (int i = loopStart; i <= loopEnd; ++i)
{
double diff=newY-AObjects[i].y2;
for (int j = 0; j < AObjects[i].Objects.count(); ++j)
if (!AObjects[i].Objects.at(j)->locked())
AObjects[i].Objects.at(j)->moveBy(0.0, diff);
}
itemSelection_AlignItemBottom(i, newY, currAlignMethod);
endAlign();
}
 
 
void ScribusDoc::itemSelection_AlignTopIn(AlignTo currAlignTo, double guidePosition)
void ScribusDoc::itemSelection_AlignTopIn(AlignTo currAlignTo, AlignMethod currAlignMethod, double guidePosition)
{
if (!startAlign())
return;
9126,17 → 9160,12
break;
}
for (int i = loopStart; i <= loopEnd; ++i)
{
double diff=newY-AObjects[i].y1;
for (int j = 0; j < AObjects[i].Objects.count(); ++j)
if (!AObjects[i].Objects.at(j)->locked())
AObjects[i].Objects.at(j)->moveBy(0.0, diff);
}
itemSelection_AlignItemTop(i, newY, currAlignMethod);
endAlign();
}
 
 
void ScribusDoc::itemSelection_AlignCenterVer(AlignTo currAlignTo, double guidePosition)
void ScribusDoc::itemSelection_AlignCenterVer(AlignTo currAlignTo, AlignMethod currAlignMethod, double guidePosition)
{
if (!startAlign())
return;
9190,7 → 9219,7
}
 
 
void ScribusDoc::itemSelection_AlignBottomIn(AlignTo currAlignTo, double guidePosition)
void ScribusDoc::itemSelection_AlignBottomIn(AlignTo currAlignTo, AlignMethod currAlignMethod, double guidePosition)
{
if (!startAlign())
return;
9225,17 → 9254,12
break;
}
for (int i = loopStart; i <= loopEnd; ++i)
{
double diff=newY-AObjects[i].y2;
for (int j = 0; j < AObjects[i].Objects.count(); ++j)
if (!AObjects[i].Objects.at(j)->locked())
AObjects[i].Objects.at(j)->moveBy(0.0, diff);
}
itemSelection_AlignItemBottom(i, newY, currAlignMethod);
endAlign();
}
 
 
void ScribusDoc::itemSelection_AlignBottomOut(AlignTo currAlignTo, double guidePosition)
void ScribusDoc::itemSelection_AlignBottomOut(AlignTo currAlignTo, AlignMethod currAlignMethod, double guidePosition)
{
if (!startAlign())
return;
9270,12 → 9294,7
break;
}
for (int i = loopStart; i <= loopEnd; ++i)
{
double diff=newY-AObjects[i].y1;
for (int j = 0; j < AObjects[i].Objects.count(); ++j)
if (!AObjects[i].Objects.at(j)->locked())
AObjects[i].Objects.at(j)->moveBy(0.0, diff);
}
itemSelection_AlignItemTop(i, newY, currAlignMethod);
endAlign();
}
 
/trunk/Scribus/scribus/prefsmanager.cpp
148,47 → 148,6
csm.initialiseDefaultPrefs(appPrefs);
csm.findPaletteLocations();
csm.findPalettes();
/*
QString pfadC = ScPaths::instance().libDir()+"swatches/";
QString pfadC2 = pfadC + "Scribus_X11.txt";
QFile fiC(pfadC2);
if (!fiC.exists())
{
appPrefs.colorPrefs.DColors.insert("White", ScColor(0, 0, 0, 0));
appPrefs.colorPrefs.DColors.insert("Black", ScColor(0, 0, 0, 255));
appPrefs.colorPrefs.DColors.insert("Blue", ScColor(255, 255, 0, 0));
appPrefs.colorPrefs.DColors.insert("Cyan", ScColor(255, 0, 0, 0));
appPrefs.colorPrefs.DColors.insert("Green", ScColor(255, 0, 255, 0));
appPrefs.colorPrefs.DColors.insert("Red", ScColor(0, 255, 255, 0));
appPrefs.colorPrefs.DColors.insert("Yellow", ScColor(0, 0, 255, 0));
appPrefs.colorPrefs.DColors.insert("Magenta", ScColor(0, 255, 0, 0));
appPrefs.colorPrefs.DColorSet = "Scribus_Small";
}
else
{
if (fiC.open(IO_ReadOnly))
{
QString ColorEn, Cname;
int Rval, Gval, Bval;
QTextStream tsC(&fiC);
ColorEn = tsC.readLine();
while (!tsC.atEnd())
{
ColorEn = tsC.readLine();
QTextStream CoE(&ColorEn, IO_ReadOnly);
CoE >> Rval;
CoE >> Gval;
CoE >> Bval;
CoE >> Cname;
ScColor tmp;
tmp.setColorRGB(Rval, Gval, Bval);
appPrefs.colorPrefs.DColors.insert(Cname, tmp);
}
fiC.close();
}
appPrefs.colorPrefs.DColorSet = "X11 RGB-Set";
}
*/
 
appPrefs.uiPrefs.wheelJump = 40;
/** Set Default window position and size to sane default values which should work on every screen */
/trunk/Scribus/scribus/scribusdoc.h
863,6 → 863,7
void updateAllItemQColors();
//! @brief Some internal align tools
typedef enum {alignFirst, alignLast, alignPage, alignMargins, alignGuide, alignSelection } AlignTo;
typedef enum {alignByMoving, alignByResizing } AlignMethod;
void buildAlignItemList(Selection* customSelection=0);
bool startAlign();
void endAlign();
1230,16 → 1231,21
void itemSelection_SetImageScale(double x, double y, Selection* customSelection=0);
void itemSelection_SetImageScaleAndOffset(double ox, double oy, double sx, double sy, Selection* customSelection=0);
void itemSelection_SetImageRotation(double rot, Selection* customSelection=0);
void itemSelection_AlignLeftOut(AlignTo currAlignTo, double guidePosition);
void itemSelection_AlignRightOut(AlignTo currAlignTo, double guidePosition);
void itemSelection_AlignBottomIn(AlignTo currAlignTo, double guidePosition);
void itemSelection_AlignRightIn(AlignTo currAlignTo, double guidePosition);
void itemSelection_AlignBottomOut(AlignTo currAlignTo, double guidePosition);
void itemSelection_AlignCenterHor(AlignTo currAlignTo, double guidePosition);
void itemSelection_AlignLeftIn(AlignTo currAlignTo, double guidePosition);
void itemSelection_AlignCenterVer(AlignTo currAlignTo, double guidePosition);
void itemSelection_AlignTopOut(AlignTo currAlignTo, double guidePosition);
void itemSelection_AlignTopIn(AlignTo currAlignTo, double guidePosition);
void itemSelection_AlignItemLeft(int i, double newX, AlignMethod how);
void itemSelection_AlignItemRight(int i, double newX, AlignMethod how);
void itemSelection_AlignItemTop(int i, double newY, AlignMethod how);
void itemSelection_AlignItemBottom(int i, double newY, AlignMethod how);
void itemSelection_AlignLeftOut(AlignTo currAlignTo, AlignMethod currAlignMethod, double guidePosition);
void itemSelection_AlignRightOut(AlignTo currAlignTo, AlignMethod currAlignMethod, double guidePosition);
void itemSelection_AlignBottomIn(AlignTo currAlignTo, AlignMethod currAlignMethod, double guidePosition);
void itemSelection_AlignRightIn(AlignTo currAlignTo, AlignMethod currAlignMethod, double guidePosition);
void itemSelection_AlignBottomOut(AlignTo currAlignTo, AlignMethod currAlignMethod, double guidePosition);
void itemSelection_AlignCenterHor(AlignTo currAlignTo, AlignMethod currAlignMethod, double guidePosition);
void itemSelection_AlignLeftIn(AlignTo currAlignTo, AlignMethod currAlignMethod, double guidePosition);
void itemSelection_AlignCenterVer(AlignTo currAlignTo, AlignMethod currAlignMethod, double guidePosition);
void itemSelection_AlignTopOut(AlignTo currAlignTo, AlignMethod currAlignMethod, double guidePosition);
void itemSelection_AlignTopIn(AlignTo currAlignTo, AlignMethod currAlignMethod, double guidePosition);
 
void itemSelection_DistributeDistH(bool usingDistance=false, double distance=0.0);
void itemSelection_DistributeAcrossPage(bool useMargins=false);
void itemSelection_DistributeRight();
/trunk/Scribus/scribus/ui/aligndistribute.ui
91,6 → 91,22
<item row="0" column="1">
<widget class="QComboBox" name="alignRelativeToCombo"/>
</item>
<item row="2" column="0" >
<widget class="QLabel" name="alignMoveOrResizeLabel" >
<property name="text" >
<string>&amp;Align Sides By:</string>
</property>
<property name="wordWrap" >
<bool>false</bool>
</property>
<property name="buddy" >
<cstring>alignMoveOrResizeCombo</cstring>
</property>
</widget>
</item>
<item row="2" column="1" >
<widget class="QComboBox" name="alignMoveOrResizeCombo" />
</item>
</layout>
</item>
<item>
/trunk/Scribus/scribus/ui/aligndistribute.h
101,11 → 101,13
void swapRight();
void alignToChanged(int);
void alignMethodChanged(int);
 
private:
void init();
UndoManager *undoManager;
ScribusDoc::AlignTo currAlignTo;
ScribusDoc::AlignMethod currAlignMethod;
QList<AlignObjs> *alignObjects;
ScribusDoc *currDoc;
qreal unitRatio;
/trunk/Scribus/scribus/ui/aligndistribute.cpp
102,6 → 102,13
alignRelativeToCombo->setCurrentIndex(alignComboValue);
alignRelativeToCombo->setToolTip( tr( "<qt>Align relative to the:<ul><li>First selected item</li><li>Second Selected Item</li><li>The current page</li><li>The margins of the current page</li><li>A Guide</li><li>The selection</ul></qt>" ) );
alignToChanged(alignComboValue);
alignMoveOrResizeLabel->setText( tr( "&Align Sides By:" ) );
int alignMethodValue=alignMoveOrResizeCombo->currentIndex();
alignMoveOrResizeCombo->clear();
alignMoveOrResizeCombo->addItem( tr("Moving (Preserve Size)") );
alignMoveOrResizeCombo->addItem( tr("Resizing (Preserve Opposite Side)") );
alignMoveOrResizeCombo->setToolTip( tr( "<qt>When aligning one side of an item:<ul><li>Always move the other side too (preserve existing width and height), or </li><li>Keep the other side fixed (resize the item instead of moving it) whenever possible</li></ul></qt>" ));
alignMethodChanged(alignMethodValue);
alignGuideLineEdit->setToolTip( tr( "The location of the selected guide to align to" ) );
alignLeftOutToolButton->setText( QString::null );
alignLeftOutToolButton->setToolTip( tr( "Align right sides of items to left side of anchor" ) );
231,7 → 238,9
alignRelativeToCombo->setCurrentIndex(0);
alignToChanged(0);
alignMethodChanged(0);
connect(alignRelativeToCombo, SIGNAL(activated(int)), this, SLOT(alignToChanged(int)));
connect(alignMoveOrResizeCombo, SIGNAL(activated(int)), this, SLOT(alignMethodChanged(int)));
unitRatio=1.0;
guideDirection=-1;
263,43 → 272,43
void AlignDistributePalette::alignLeftOut()
{
if (currDoc!=NULL)
currDoc->itemSelection_AlignLeftOut(currAlignTo, guidePosition);
currDoc->itemSelection_AlignLeftOut(currAlignTo, currAlignMethod, guidePosition);
}
 
void AlignDistributePalette::alignLeftIn()
{
if (currDoc!=NULL)
currDoc->itemSelection_AlignLeftIn(currAlignTo, guidePosition);
currDoc->itemSelection_AlignLeftIn(currAlignTo, currAlignMethod, guidePosition);
}
 
void AlignDistributePalette::alignCenterHor()
{
if (currDoc!=NULL)
currDoc->itemSelection_AlignCenterHor(currAlignTo, guidePosition);
currDoc->itemSelection_AlignCenterHor(currAlignTo, currAlignMethod, guidePosition);
}
 
void AlignDistributePalette::alignRightIn()
{
if (currDoc!=NULL)
currDoc->itemSelection_AlignRightIn(currAlignTo, guidePosition);
currDoc->itemSelection_AlignRightIn(currAlignTo, currAlignMethod, guidePosition);
}
 
void AlignDistributePalette::alignRightOut()
{
if (currDoc!=NULL)
currDoc->itemSelection_AlignRightOut(currAlignTo, guidePosition);
currDoc->itemSelection_AlignRightOut(currAlignTo, currAlignMethod, guidePosition);
}
 
void AlignDistributePalette::alignTopOut()
{
if (currDoc!=NULL)
currDoc->itemSelection_AlignTopOut(currAlignTo, guidePosition);
currDoc->itemSelection_AlignTopOut(currAlignTo, currAlignMethod, guidePosition);
}
 
void AlignDistributePalette::alignTopIn()
{
if (currDoc!=NULL)
currDoc->itemSelection_AlignTopIn(currAlignTo, guidePosition);
currDoc->itemSelection_AlignTopIn(currAlignTo, currAlignMethod, guidePosition);
}
 
 
306,7 → 315,7
void AlignDistributePalette::alignCenterVer()
{
if (currDoc!=NULL)
currDoc->itemSelection_AlignCenterVer(currAlignTo, guidePosition);
currDoc->itemSelection_AlignCenterVer(currAlignTo, currAlignMethod, guidePosition);
}
 
 
313,13 → 322,13
void AlignDistributePalette::alignBottomIn()
{
if (currDoc!=NULL)
currDoc->itemSelection_AlignBottomIn(currAlignTo, guidePosition);
currDoc->itemSelection_AlignBottomIn(currAlignTo, currAlignMethod, guidePosition);
}
 
void AlignDistributePalette::alignBottomOut()
{
if (currDoc!=NULL)
currDoc->itemSelection_AlignBottomOut(currAlignTo, guidePosition);
currDoc->itemSelection_AlignBottomOut(currAlignTo, currAlignMethod, guidePosition);
}
 
void AlignDistributePalette::distributeLeft()
426,6 → 435,11
currAlignTo = ScribusDoc::AlignTo(newAlignTo);
enableGuideButtons();
}
void AlignDistributePalette::alignMethodChanged(int newAlignMethod)
{
currAlignMethod = ScribusDoc::AlignMethod(newAlignMethod);
enableGuideButtons();
}
 
void AlignDistributePalette::setGuide(int direction, qreal position)
{