Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 11894 → Rev 11895

/trunk/Scribus/scribus/replaceonecolor.h
0,0 → 1,46
/*
For general Scribus (>=1.3.2) copyright and licensing information please refer
to the COPYING file provided with the program. Following this notice may exist
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
/***************************************************************************
* Copyright (C) 2008 by Franz Schmid *
* franz.schmid@altmuehlnet.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
 
#ifndef REPLACEONECOLORDIALOG_H
#define REPLACEONECOLORDIALOG_H
 
#include <QDialog>
#include "ui_replaceonecolor.h"
#include "scribusapi.h"
#include "sccolor.h"
 
class SCRIBUS_API replaceColorDialog : public QDialog, Ui::replaceColorDialog
{
Q_OBJECT
 
public:
replaceColorDialog(QWidget* parent, ColorList &availableColors, ColorList &usedColors);
~replaceColorDialog() {};
const QString getOriginalColor();
const QString getReplacementColor();
};
 
#endif
/trunk/Scribus/scribus/replacecolors.ui
0,0 → 1,149
<ui version="4.0" >
<class>replaceColorsDialog</class>
<widget class="QDialog" name="replaceColorsDialog" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>409</width>
<height>248</height>
</rect>
</property>
<property name="windowTitle" >
<string>Replace Colors</string>
</property>
<property name="sizeGripEnabled" >
<bool>true</bool>
</property>
<property name="modal" >
<bool>true</bool>
</property>
<layout class="QVBoxLayout" >
<property name="spacing" >
<number>5</number>
</property>
<property name="leftMargin" >
<number>10</number>
</property>
<property name="topMargin" >
<number>10</number>
</property>
<property name="rightMargin" >
<number>10</number>
</property>
<property name="bottomMargin" >
<number>10</number>
</property>
<item>
<layout class="QHBoxLayout" >
<property name="spacing" >
<number>5</number>
</property>
<item>
<widget class="QTableWidget" name="replacementTable" >
<property name="minimumSize" >
<size>
<width>150</width>
<height>150</height>
</size>
</property>
<property name="selectionBehavior" >
<enum>QAbstractItemView::SelectRows</enum>
</property>
<property name="columnCount" >
<number>2</number>
</property>
<column/>
<column/>
</widget>
</item>
<item>
<layout class="QVBoxLayout" >
<property name="spacing" >
<number>5</number>
</property>
<item>
<widget class="QPushButton" name="addButton" >
<property name="text" >
<string>Add ...</string>
</property>
<property name="autoDefault" >
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="removeButton" >
<property name="text" >
<string>Remove</string>
</property>
<property name="autoDefault" >
<bool>false</bool>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons" >
<set>QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>replaceColorsDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel" >
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel" >
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>replaceColorsDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel" >
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel" >
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>
/trunk/Scribus/scribus/replacecolors.cpp
0,0 → 1,121
/*
For general Scribus (>=1.3.2) copyright and licensing information please refer
to the COPYING file provided with the program. Following this notice may exist
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
/**************************************************************************
* Copyright (C) 2008 by Franz Schmid *
* franz.schmid@altmuehlnet.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
 
#include "replacecolors.h"
#include "replaceonecolor.h"
#include "commonstrings.h"
#include "util_icon.h"
#include <QHeaderView>
 
replaceColorsDialog::replaceColorsDialog(QWidget* parent, ColorList &colorList, ColorList &colorListUsed) : QDialog(parent)
{
setupUi(this);
setModal(true);
setWindowIcon(QIcon(loadIcon ( "AppIcon.png" )));
EditColors = colorList;
UsedColors = colorListUsed;
selectedRow = -1;
replaceMap.clear();
replacementTable->horizontalHeader()->setMovable(false);
replacementTable->horizontalHeader()->setClickable(false);
replacementTable->horizontalHeader()->setResizeMode(QHeaderView::Stretch);
replacementTable->setHorizontalHeaderItem(0, new QTableWidgetItem( tr("Original")));
replacementTable->setHorizontalHeaderItem(1, new QTableWidgetItem( tr("Replacement")));
replacementTable->verticalHeader()->setMovable(false);
replacementTable->verticalHeader()->setResizeMode(QHeaderView::Fixed);
replacementTable->verticalHeader()->hide();
updateReplacementTable();
removeButton->setEnabled(false);
connect(addButton, SIGNAL(clicked()), this, SLOT(addColor()));
connect(replacementTable, SIGNAL(cellClicked(int, int)), this, SLOT(selReplacement(int)));
connect(removeButton, SIGNAL(clicked()), this, SLOT(delReplacement()));
}
 
void replaceColorsDialog::addColor()
{
replaceColorDialog *dia = new replaceColorDialog(this, EditColors, UsedColors);
if (dia->exec())
{
QString orig = dia->getOriginalColor();
if (orig == CommonStrings::tr_NoneColor)
orig = CommonStrings::None;
QString repl = dia->getReplacementColor();
if (repl == CommonStrings::tr_NoneColor)
repl = CommonStrings::None;
if (replaceMap.values().contains(orig))
{
QMap<QString,QString>::Iterator it;
for (it = replaceMap.begin(); it != replaceMap.end(); ++it)
{
if (it.value() == orig)
it.value() = repl;
}
}
replaceMap.insert(orig, repl);
updateReplacementTable();
}
delete dia;
}
 
void replaceColorsDialog::selReplacement(int sel)
{
selectedRow = sel;
removeButton->setEnabled(true);
}
 
void replaceColorsDialog::delReplacement()
{
if (selectedRow > -1)
{
replaceMap.remove(replacementTable->item(selectedRow, 0)->text());
replacementTable->removeRow(selectedRow);
selectedRow = -1;
}
}
 
void replaceColorsDialog::updateReplacementTable()
{
replacementTable->clearContents();
replacementTable->setRowCount(0);
selectedRow = -1;
removeButton->setEnabled(false);
if (replaceMap.count() > 0)
{
replacementTable->setRowCount(replaceMap.count());
int row = 0;
QMap<QString,QString>::Iterator it;
for (it = replaceMap.begin(); it != replaceMap.end(); ++it)
{
QTableWidgetItem *tW = new QTableWidgetItem(it.key());
tW->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
replacementTable->setItem(row, 0, tW);
QTableWidgetItem *tW2 = new QTableWidgetItem(it.value());
tW->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
replacementTable->setItem(row, 1, tW2);
row++;
}
}
}
/trunk/Scribus/scribus/replaceonecolor.ui
0,0 → 1,133
<ui version="4.0" >
<class>replaceColorDialog</class>
<widget class="QDialog" name="replaceColorDialog" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>224</width>
<height>106</height>
</rect>
</property>
<property name="windowTitle" >
<string>Replace Color</string>
</property>
<property name="sizeGripEnabled" >
<bool>true</bool>
</property>
<property name="modal" >
<bool>true</bool>
</property>
<layout class="QVBoxLayout" >
<property name="spacing" >
<number>5</number>
</property>
<property name="leftMargin" >
<number>10</number>
</property>
<property name="topMargin" >
<number>10</number>
</property>
<property name="rightMargin" >
<number>10</number>
</property>
<property name="bottomMargin" >
<number>10</number>
</property>
<item>
<layout class="QGridLayout" >
<property name="horizontalSpacing" >
<number>5</number>
</property>
<property name="verticalSpacing" >
<number>5</number>
</property>
<item row="0" column="0" >
<widget class="QLabel" name="label" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Preferred" hsizetype="Maximum" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string>Replace:</string>
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="ColorCombo" name="originalColor" />
</item>
<item row="1" column="0" >
<widget class="QLabel" name="label_2" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Preferred" hsizetype="Maximum" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string>with:</string>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="ColorCombo" name="replacementColor" />
</item>
</layout>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons" >
<set>QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>ColorCombo</class>
<extends>QComboBox</extends>
<header>colorcombo.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>replaceColorDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel" >
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel" >
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>replaceColorDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel" >
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel" >
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>
/trunk/Scribus/scribus/scribus.cpp
162,6 → 162,7
#include "pslib.h"
#include "query.h"
#include "reformdoc.h"
#include "replacecolors.h"
#include "resourcecollection.h"
#include "sccolorengine.h"
#include "sccombobox.h"
661,6 → 662,7
scrMenuMgr->addMenuItem(scrActions["editEditWithLatexEditor"], "Edit");
scrMenuMgr->addMenuSeparator("Edit");
scrMenuMgr->addMenuItem(scrActions["editColors"], "Edit");
scrMenuMgr->addMenuItem(scrActions["editReplaceColors"], "Edit");
scrMenuMgr->addMenuItem(scrActions["editPatterns"], "Edit");
scrMenuMgr->addMenuItem(scrActions["editStyles"], "Edit");
scrMenuMgr->addMenuItem(scrActions["editMasterPages"], "Edit");
681,6 → 683,7
scrActions["editSelectAllOnLayer"]->setEnabled(false);
scrActions["editDeselectAll"]->setEnabled(false);
scrActions["editSearchReplace"]->setEnabled(false);
scrActions["editReplaceColors"]->setEnabled(false);
scrActions["editPatterns"]->setEnabled(false);
scrActions["editStyles"]->setEnabled(false);
scrActions["editMasterPages"]->setEnabled(false);
2641,6 → 2644,7
scrActions["editSelectAll"]->setEnabled(true);
scrActions["editSelectAllOnLayer"]->setEnabled(true);
scrActions["editDeselectAll"]->setEnabled(false);
scrActions["editReplaceColors"]->setEnabled(true);
scrActions["editPatterns"]->setEnabled(true);
scrActions["editStyles"]->setEnabled(true);
scrActions["editMasterPages"]->setEnabled(true);
4462,6 → 4466,7
scrActions["editSelectAll"]->setEnabled(false);
scrActions["editSelectAllOnLayer"]->setEnabled(false);
scrActions["editDeselectAll"]->setEnabled(false);
scrActions["editReplaceColors"]->setEnabled(false);
scrActions["editPatterns"]->setEnabled(false);
scrActions["editStyles"]->setEnabled(false);
scrActions["editSearchReplace"]->setEnabled(false);
7321,6 → 7326,33
}
}
 
void ScribusMainWindow::slotReplaceColors()
{
if (HaveDoc)
{
ColorList UsedC;
doc->getUsedColors(UsedC);
replaceColorsDialog *dia2 = new replaceColorsDialog(this, doc->PageColors, UsedC);
if (dia2->exec())
{
ResourceCollection colorrsc;
colorrsc.mapColors(dia2->replaceMap);
PrefsManager::replaceToolColors(doc->toolSettings, colorrsc.colors());
doc->replaceNamedResources(colorrsc);
doc->replaceLineStyleColors(dia2->replaceMap);
doc->recalculateColors();
doc->recalcPicturesRes();
propertiesPalette->updateColorList();
propertiesPalette->SetLineFormats(doc);
styleManager->updateColorList();
if (doc->m_Selection->count() != 0)
doc->m_Selection->itemAt(0)->emitAllToGUI();
view->DrawNew();
}
delete dia2;
}
}
 
void ScribusMainWindow::slotEditColors()
{
ColorList edc;
/trunk/Scribus/scribus/replacecolors.h
0,0 → 1,56
/*
For general Scribus (>=1.3.2) copyright and licensing information please refer
to the COPYING file provided with the program. Following this notice may exist
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
/***************************************************************************
* Copyright (C) 2008 by Franz Schmid *
* franz.schmid@altmuehlnet.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
 
#ifndef REPLACECOLORSDIALOG_H
#define REPLACECOLORSDIALOG_H
 
#include <QDialog>
#include "ui_replacecolors.h"
#include "scribusapi.h"
#include "sccolor.h"
 
class SCRIBUS_API replaceColorsDialog : public QDialog, Ui::replaceColorsDialog
{
Q_OBJECT
 
public:
replaceColorsDialog(QWidget* parent, ColorList &colorList, ColorList &colorListUsed);
~replaceColorsDialog() {};
ColorList EditColors;
ColorList UsedColors;
QMap<QString,QString> replaceMap;
 
private slots:
void addColor();
void selReplacement(int sel);
void delReplacement();
 
private:
void updateReplacementTable();
int selectedRow;
};
 
#endif
/trunk/Scribus/scribus/replaceonecolor.cpp
0,0 → 1,49
/*
For general Scribus (>=1.3.2) copyright and licensing information please refer
to the COPYING file provided with the program. Following this notice may exist
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
/**************************************************************************
* Copyright (C) 2008 by Franz Schmid *
* franz.schmid@altmuehlnet.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
 
#include "replaceonecolor.h"
#include "util_icon.h"
 
replaceColorDialog::replaceColorDialog(QWidget* parent, ColorList &availableColors, ColorList &usedColors) : QDialog(parent)
{
setupUi(this);
setModal(true);
setWindowIcon(QIcon(loadIcon( "AppIcon.png" )));
originalColor->addItem(CommonStrings::tr_NoneColor);
originalColor->insertItems(usedColors, ColorCombo::fancyPixmaps);
replacementColor->addItem(CommonStrings::tr_NoneColor);
replacementColor->insertItems(availableColors, ColorCombo::fancyPixmaps);
}
 
const QString replaceColorDialog::getOriginalColor()
{
return originalColor->currentText();
}
 
const QString replaceColorDialog::getReplacementColor()
{
return replacementColor->currentText();
}
/trunk/Scribus/scribus/actionmanager.cpp
208,6 → 208,8
scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
name="editColors";
scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
name="editReplaceColors";
scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
name="editPatterns";
scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
name="editStyles";
235,6 → 237,7
connect( (*scrActions)["editEditWithImageEditor"], SIGNAL(triggered()), mainWindow, SLOT(callImageEditor()) );
connect( (*scrActions)["editEditWithLatexEditor"], SIGNAL(triggered()), mainWindow, SLOT(callImageEditor()) );
connect( (*scrActions)["editColors"], SIGNAL(triggered()), mainWindow, SLOT(slotEditColors()) );
connect( (*scrActions)["editReplaceColors"], SIGNAL(triggered()), mainWindow, SLOT(slotReplaceColors()) );
connect( (*scrActions)["editPatterns"], SIGNAL(triggered()), mainWindow, SLOT(managePatterns()) );
connect( (*scrActions)["editMasterPages"], SIGNAL(triggered()), mainWindow, SLOT(manageMasterPages()) );
connect( (*scrActions)["editJavascripts"], SIGNAL(triggered()), mainWindow, SLOT(ManageJava()) );
1260,6 → 1263,7
(*scrActions)["editEditWithImageEditor"]->setTexts( tr("Edit Image..."));
(*scrActions)["editEditWithLatexEditor"]->setTexts( tr("Edit Source..."));
(*scrActions)["editColors"]->setTexts( tr("C&olors..."));
(*scrActions)["editReplaceColors"]->setTexts( tr("Replace Colors..."));
(*scrActions)["editPatterns"]->setTexts( tr("Patterns..."));
(*scrActions)["editStyles"]->setTexts( tr("S&tyles..."));
(*scrActions)["editMasterPages"]->setTexts( tr("&Master Pages..."));
1654,7 → 1658,7
itmenu->second << "fileDocSetup" << "filePreferences" << "filePrint" << "PrintPreview" << "fileQuit";
++itmenu;
//Edit
itmenu->second << "editUndoAction" << "editRedoAction" << "editActionMode" << "editCut" << "editCopy" << "editPaste" << "editCopyContents" << "editPasteContents" << "editPasteContentsAbs" << "editClearContents" << "editSelectAll" << "editSelectAllOnLayer" << "editDeselectAll" << "editSearchReplace" << "toolsEditWithStoryEditor" << "editEditWithImageEditor" << "editEditWithLatexEditor" << "editExtendedImageProperties" << "editColors" << "editPatterns" << "editStyles" << "editMasterPages" << "editJavascripts";
itmenu->second << "editUndoAction" << "editRedoAction" << "editActionMode" << "editCut" << "editCopy" << "editPaste" << "editCopyContents" << "editPasteContents" << "editPasteContentsAbs" << "editClearContents" << "editSelectAll" << "editSelectAllOnLayer" << "editDeselectAll" << "editSearchReplace" << "toolsEditWithStoryEditor" << "editEditWithImageEditor" << "editEditWithLatexEditor" << "editExtendedImageProperties" << "editColors" << "editReplaceColors" << "editPatterns" << "editStyles" << "editMasterPages" << "editJavascripts";
//Style
++itmenu;
int font_sizes[] = {7, 9, 10, 11, 12, 14, 18, 24, 36, 48, 60, 72};
/trunk/Scribus/scribus/scribus.h
440,6 → 440,8
void setItemFSize(int id);
/** Farbeditor */
void slotEditColors();
/** Color Replacement */
void slotReplaceColors();
/** Style Manager */
/*
// Setzt den Pen-Tonwert
/trunk/Scribus/scribus/CMakeLists.txt
42,6 → 42,8
picsearchoptions.ui
picstatus.ui
pluginmanagerprefsgui.ui
replacecolors.ui
replaceonecolor.ui
shortcutwidget.ui
smcstylewidget.ui
smlinestylewidget.ui
190,6 → 192,8
pslib.h
query.h
reformdoc.h
replacecolors.h
replaceonecolor.h
rulermover.h
sampleitem.h
scfilewidget.h
447,6 → 451,8
rawimage.cpp
rc4.c
reformdoc.cpp
replacecolors.cpp
replaceonecolor.cpp
rulermover.cpp
sampleitem.cpp
sccolor.cpp