Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 6548 → Rev 6549

/branches/Version13x/Scribus/scribus/scribusview.h
79,13 → 79,16
QToolButton *zoomDefaultToolbarButton;
QToolButton *zoomOutToolbarButton;
QToolButton *zoomInToolbarButton;
QToolButton *previewToolbarButton;
#else
QPushButton *zoomDefaultToolbarButton;
QPushButton *zoomOutToolbarButton;
QPushButton *zoomInToolbarButton;
QPushButton *previewToolbarButton;
#endif
QComboBox *layerMenu; //Menu for layers at bottom of view
QComboBox *unitSwitcher; //Menu for units at bottom of view
QComboBox *visualMenu;
/** Dokument zu dem die Seite gehoert */
ScribusDoc * const Doc;
ApplicationPrefs * const Prefs;
143,6 → 146,7
bool previewMode;
bool viewAsPreview;
bool storedFramesShown;
int previewVisual;
FPoint RCenter;
FPointArray RecordP;
void DrawMasterItems(ScPainter *painter, Page *page, QRect clip);
235,6 → 239,7
 
public slots: // Public slots
void languageChange();
void switchPreviewVisual(int vis);
void togglePreview();
void unitChange();
void setRulersShown(bool isShown);
/branches/Version13x/Scribus/scribus/icons/Makefile.am
1,4 → 1,4
EXTRA_DIST = curvelinear.png curvebezier.png curve.png invert.png page16.png pagedouble16.png pagequadro16.png pagesingle16.png pagetriple16.png viewmag1.png viewmagout.png viewmagin.png register.png cmyk.png rgb.png spot.png alert.png pagedouble.png pagequadro.png pagesingle.png pagetriple.png mover.png above.png below.png firstline.png leftindent.png rightindent.png shade.png linespacing.png linespacing2.png textbase.png textscaleh.png textkern.png textscalev.png wordsOnly.png shadow.png AllCaps.png DrawFrame.xpm DrawImageFrame.xpm DrawPolylineFrame.xpm DrawTable.xpm DrawTextFrame.xpm plugins.png shortwords.png filenew.png fileopen.png editcopy22.png edittrash.png font_otf16.png font_truetype16.png font_type1_16.png font_otf.png font_truetype.png font_type1.png acroread.png checkdoc.png vectorgfx.png ooo_draw.png ooo_writer.png key_bindings.png blend.png hyphenate.png scrap.png misc.png externaltools.png tools.png page.png guides.png font.png typography.png screen.png nftabout.xpm nftinfo.xpm dist.png dist22.png tab.png view.png Kreuz.xpm Bild.xpm Bild16.xpm Editm.xpm Kreise.xpm Lock.xpm Lupe.xpm Rechtecke.xpm Rotieren.xpm Stift16.xpm Stift.xpm Text.xpm Text16.xpm Unlock.xpm DateiClose.png DateiNeu.xpm DateiOpen.xpm DateiPrint.xpm DateiSave2.png AppIcon2.png AppIcon.png LupeZ.xpm DragPix.xpm Rotieren2.png HandC.xpm scribus_logo.jpg DateiClos16.png DateiNeu16.png DateiOpen16.png DateiPrint16.png DateiSave16.png editcopy.png editcut.png editcut22.png editdelete.png editdelete22.png editpaste.png exit.png doc.png image.png pdf.png postscript.png txt.png Zeichen.xpm Hoch.xpm Kapital.xpm Strike.xpm Tief.xpm Unter.xpm Kern.xpm Spacing.xpm Corner.xpm FlipH.xpm FlipV.xpm Winkel.xpm acrobat.png scribusicon.png text_block.png text_center.png text_left.png text_right.png Text2.xpm spline16.png spline.png triangle.png Stiftalt.xpm Stiftalt16.xpm beziertool.png beziertool16.png AddNode.png DeleteNode.png MoveAsym.png MoveKontrol.png MoveNode.png MoveSym.png BevelJoin.png ButtCap.png MiterJoin.png RoundJoin.png SquareCap.png ResetNode.png RoundCap.png Reset1Node.png BezierClose.png PolyCut.png AddPoint.png DelPoint.png Split.png Deletelayer.png Layervisible.xpm Lowerlayer.png Newlayer.png Raiselayer.png checkbox.png combobox.png listbox.png pushbutton.png textview.png charset.png goto.png document2.png trashcan.png trashcan2.png gohome.png bottom.png down.png top.png up.png irreg.png text_force.png ok.png ok22.png Revers.png hmirror.png vmirror.png shear_right.png shear_left.png shear_up.png shear_down.png Splash.png back.png start.png forward.png finish.png penciladd.png pencilsub.png outlined.png fill.png NoPrint.png unlock.png locked.png signature.png signature2.png rotate_cw.png rotate_ccw.png crop.png expand.png frameresize.png framenoresize.png testfill.png frame_table16.png frame_table.png scribusdoc.png scribusdoc16.png documentinfo.png documentinfo32.png filesaveas.png revert.png reload.png compfile.png reload16.png compfile16.png find.png find16.png addf.png removef.png launch.png launch16.png \
EXTRA_DIST = previewOn.png previewOff.png curvelinear.png curvebezier.png curve.png invert.png page16.png pagedouble16.png pagequadro16.png pagesingle16.png pagetriple16.png viewmag1.png viewmagout.png viewmagin.png register.png cmyk.png rgb.png spot.png alert.png pagedouble.png pagequadro.png pagesingle.png pagetriple.png mover.png above.png below.png firstline.png leftindent.png rightindent.png shade.png linespacing.png linespacing2.png textbase.png textscaleh.png textkern.png textscalev.png wordsOnly.png shadow.png AllCaps.png DrawFrame.xpm DrawImageFrame.xpm DrawPolylineFrame.xpm DrawTable.xpm DrawTextFrame.xpm plugins.png shortwords.png filenew.png fileopen.png editcopy22.png edittrash.png font_otf16.png font_truetype16.png font_type1_16.png font_otf.png font_truetype.png font_type1.png acroread.png checkdoc.png vectorgfx.png ooo_draw.png ooo_writer.png key_bindings.png blend.png hyphenate.png scrap.png misc.png externaltools.png tools.png page.png guides.png font.png typography.png screen.png nftabout.xpm nftinfo.xpm dist.png dist22.png tab.png view.png Kreuz.xpm Bild.xpm Bild16.xpm Editm.xpm Kreise.xpm Lock.xpm Lupe.xpm Rechtecke.xpm Rotieren.xpm Stift16.xpm Stift.xpm Text.xpm Text16.xpm Unlock.xpm DateiClose.png DateiNeu.xpm DateiOpen.xpm DateiPrint.xpm DateiSave2.png AppIcon2.png AppIcon.png LupeZ.xpm DragPix.xpm Rotieren2.png HandC.xpm scribus_logo.jpg DateiClos16.png DateiNeu16.png DateiOpen16.png DateiPrint16.png DateiSave16.png editcopy.png editcut.png editcut22.png editdelete.png editdelete22.png editpaste.png exit.png doc.png image.png pdf.png postscript.png txt.png Zeichen.xpm Hoch.xpm Kapital.xpm Strike.xpm Tief.xpm Unter.xpm Kern.xpm Spacing.xpm Corner.xpm FlipH.xpm FlipV.xpm Winkel.xpm acrobat.png scribusicon.png text_block.png text_center.png text_left.png text_right.png Text2.xpm spline16.png spline.png triangle.png Stiftalt.xpm Stiftalt16.xpm beziertool.png beziertool16.png AddNode.png DeleteNode.png MoveAsym.png MoveKontrol.png MoveNode.png MoveSym.png BevelJoin.png ButtCap.png MiterJoin.png RoundJoin.png SquareCap.png ResetNode.png RoundCap.png Reset1Node.png BezierClose.png PolyCut.png AddPoint.png DelPoint.png Split.png Deletelayer.png Layervisible.xpm Lowerlayer.png Newlayer.png Raiselayer.png checkbox.png combobox.png listbox.png pushbutton.png textview.png charset.png goto.png document2.png trashcan.png trashcan2.png gohome.png bottom.png down.png top.png up.png irreg.png text_force.png ok.png ok22.png Revers.png hmirror.png vmirror.png shear_right.png shear_left.png shear_up.png shear_down.png Splash.png back.png start.png forward.png finish.png penciladd.png pencilsub.png outlined.png fill.png NoPrint.png unlock.png locked.png signature.png signature2.png rotate_cw.png rotate_ccw.png crop.png expand.png frameresize.png framenoresize.png testfill.png frame_table16.png frame_table.png scribusdoc.png scribusdoc16.png documentinfo.png documentinfo32.png filesaveas.png revert.png reload.png compfile.png reload16.png compfile16.png find.png find16.png addf.png removef.png launch.png launch16.png \
u_undo.png u_redo.png u_undo16.png u_redo16.png u_margins.png u_margins_locked.png u_align.png u_move.png u_resize.png u_rotate.png u_group.png u_fill.png u_shade.png u_lock.png u_unlock.png u_create.png u_delete.png u_fliph.png u_flipv.png u_cut.png u_transp.png u_line.png u_arrow.png u_font.png u_svg.png u_eps.png u_scale_image.png u_shape.png u_enableprint.png u_disableprint.png \
docattributes.png tabtocindex.png colorpicker.png wizard.png flow-bounding.png flow-contour.png flow-frame.png flow-none.png\
al_bottom_in.png al_bottom_out.png al_center_hor.png al_center_ver.png al_left_in.png al_left_out.png al_right_in.png al_right_out.png al_top_in.png al_top_out.png distribute_acrosspage.png distribute_acrossmargins.png distribute_bottom.png distribute_downpage.png distribute_downmargins.png distribute_hcentre.png \
134,6 → 134,8
$(mkinstalldirs) $(prefix)/share/scribus/icons/16/
$(mkinstalldirs) $(prefix)/share/scribus/icons/22/
$(mkinstalldirs) $(prefix)/share/pixmaps/
$(INSTALL_DATA) $(srcdir)/previewOn.png $(prefix)/share/scribus/icons/previewOn.png
$(INSTALL_DATA) $(srcdir)/previewOff.png $(prefix)/share/scribus/icons/previewOff.png
$(INSTALL_DATA) $(srcdir)/curvelinear.png $(prefix)/share/scribus/icons/curvelinear.png
$(INSTALL_DATA) $(srcdir)/curvebezier.png $(prefix)/share/scribus/icons/curvebezier.png
$(INSTALL_DATA) $(srcdir)/curve.png $(prefix)/share/scribus/icons/curve.png
990,3 → 992,5
-rm -f $(prefix)/share/scribus/icons/22/zoom-out.png
-rm -f $(prefix)/share/scribus/icons/16/layer-flow-around.png
-rm -f $(prefix)/share/scribus/icons/layer-outline.png
-rm -f $(prefix)/share/scribus/icons/previewOn.png
-rm -f $(prefix)/share/scribus/icons/previewOff.png
/branches/Version13x/Scribus/scribus/icons/previewOn.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: Scribus/scribus/icons/previewOff.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/Scribus/scribus/icons/previewOff.png
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: Scribus/scribus/icons/CMakeLists.txt
===================================================================
--- Scribus/scribus/icons/CMakeLists.txt (revision 6548)
+++ Scribus/scribus/icons/CMakeLists.txt (revision 6549)
@@ -311,6 +311,8 @@
Zeichen.xpm
vpl.png
layer-outline.png
+previewOn.png
+previewOff.png
DESTINATION ${ICONDIR}
)
/branches/Version13x/Scribus/scribus/pageitem.cpp
58,6 → 58,7
 
#include "util.h"
#include "scpattern.h"
#include "colorblind.h"
 
#include "text/nlsconfig.h"
#ifdef HAVE_CAIRO
1454,6 → 1455,12
void PageItem::SetFarbe(QColor *tmp, QString farbe, int shad)
{
*tmp = m_Doc->PageColors[farbe].getShadeColorProof(shad);
if ((m_Doc->view()->viewAsPreview) && (m_Doc->view()->previewVisual != 0))
{
VisionDefectColor *defect = new VisionDefectColor();
*tmp = defect->convertDefect(*tmp, m_Doc->view()->previewVisual);
delete defect;
}
}
 
 
1971,6 → 1978,12
{
if (lineColorVal != CommonStrings::None)
strokeQColor = m_Doc->PageColors[lineColorVal].getShadeColorProof(lineShadeVal);
if ((m_Doc->view()->viewAsPreview) && (m_Doc->view()->previewVisual != 0))
{
VisionDefectColor *defect = new VisionDefectColor();
strokeQColor = defect->convertDefect(strokeQColor, m_Doc->view()->previewVisual);
delete defect;
}
}
 
void PageItem::setFillQColor()
1977,6 → 1990,12
{
if (fillColorVal != CommonStrings::None)
fillQColor = m_Doc->PageColors[fillColorVal].getShadeColorProof(fillShadeVal);
if ((m_Doc->view()->viewAsPreview) && (m_Doc->view()->previewVisual != 0))
{
VisionDefectColor *defect = new VisionDefectColor();
fillQColor = defect->convertDefect(fillQColor, m_Doc->view()->previewVisual);
delete defect;
}
}
 
void PageItem::setLineTransparency(double newTransparency)
3664,6 → 3683,29
pixm.createLowRes(scaling);
pixm.imgInfo.lowResScale = scaling;
}
if ((m_Doc->view()->viewAsPreview) && (m_Doc->view()->previewVisual != 0))
{
VisionDefectColor *defect = new VisionDefectColor();
QColor tmpC;
int h = pixm.qImagePtr()->height();
int w = pixm.qImagePtr()->width();
int r, g, b, a;
for( int yi=0; yi < h; ++yi )
{
QRgb * s = (QRgb*)(pixm.qImagePtr()->scanLine( yi ));
for( int xi = 0; xi < w; ++xi )
{
QRgb rgb = *s;
tmpC.setRgb(rgb);
tmpC = defect->convertDefect(tmpC, m_Doc->view()->previewVisual);
a = qAlpha(rgb);
tmpC.getRgb(&r, &g, &b);
*s = qRgba(r, g, b, a);
s++;
}
}
delete defect;
}
}
return true;
}
/branches/Version13x/Scribus/scribus/colorblind.h
0,0 → 1,161
/*
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.
*/
#ifndef COLORBLIND_H
#define COLORBLIND_H
 
#include <qvariant.h>
#include <qcolor.h>
#include <qobject.h>
 
/*! \brief This code is an implementation of an algorithm described by Hans Brettel,
Francoise Vienot and John Mollon in the Journal of the Optical Society of
America V14(10), pg 2647. (See http://vischeck.com/ for more info.).
 
Based on the GIMP's cdisplay_colorblind.c
by Michael Natterer <mitch@gimp.org>, Sven Neumann <sven@gimp.org>,
Robert Dougherty <bob@vischeck.com> and Alex Wade <alex@vischeck.com>.
 
This code is written using "Scribus coding standard" as a part of the
Scribus project (www.scribus.net).
 
\author Petr Vanek <petr@scribus.info>
 
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.
*/
 
class VisionDefectColor : public QObject, public QColor
{
Q_OBJECT
public:
/*! \brief Enumerate Vision Defects for readable ComboBox access */
enum defectMode {
normalVision = 0,
protanopeVision = 1,
deuteranopeVision = 2,
tritanopeVision = 3,
colorBlindnessVision = 4
};
 
/*! \brief QColor like constructors. Setup the RGB parts, then init().
\param r red part of the color
\param g green part of the color
\param b blue part of the color
*/
VisionDefectColor(int r, int g, int b);
/*! \brief QColor like constructors. Setup the RGB parts, then init().
\param c QColor object
*/
VisionDefectColor(QColor c);
 
/*! \brief Default constructors. Setup the RGB parts to default values, then init().
*/
VisionDefectColor();
 
/*! \brief Actual defect type. One of the 'defectMode' */
int deficiency;
 
/*! \brief Perform conversion itself.
Gama removing, RGB2LSM, matrix operation for selected deficiency,
LSM2RGB, gama applying. */
void convertDefect();
 
/*! \brief Perform conversion itself. Confidence overload to perform the conversion in one step;
\param c QColor object
\param d defect type
\retval QColor converted color
Gama removing, RGB2LSM, matrix operation for selected deficiency,
LSM2RGB, gama applying. */
QColor convertDefect(QColor c, int d);
 
/*! \brief Return the color parts
\retval uint red part
*/
uint getRed();
/*! \brief Return the color parts
\retval uint green part
*/
uint getGreen();
/*! \brief Return the color parts
\retval uint blue part
*/
uint getBlue();
/*! \brief Return QColor
\retval QColor new QColor
*/
QColor getColor();
 
private:
/*! \brief Convert matrix */
double rgb2lms[9];
/*! \brief Convert matrix */
double lms2rgb[9];
/*! \brief Gamma matrix */
double gammaRGB[3];
 
/*! \brief cross products with transform matrixes for actual defect */
double a1, b1, c1;
/*! \brief cross products with transform matrixes for actual defect */
double a2, b2, c2;
/*! \brief Inflection border line */
double inflection;
 
/*! \brief Internal RGB color parts */
double red, green, blue;
 
/*! \brief original color */
QColor originalColor;
 
/*! \brief Initialization of the internal values. rgb2lms, lms2rgb etc.
For most modern Cathode-Ray Tube monitors (CRTs), the following
are good estimates of the RGB->LMS and LMS->RGB transform
matrices. They are based on spectra measured on a typical CRT
with a PhotoResearch PR650 spectral photometer and the Stockman
human cone fundamentals. NOTE: these estimates will NOT work well
for LCDs!
The RGB<->LMS transforms are computed from the human cone
photo-pigment absorption spectra and the monitor phosphor
emission spectra. These parameters are fairly constant for most
humans and most montiors (at least for modern CRTs). However,
gamma will vary quite a bit, as it is a property of the monitor
(eg. amplifier gain), the video card, and even the
software. Further, users can adjust their gammas (either via
adjusting the monitor amp gains or in software). That said, the
following are the gamma estimates that we have used in the
Vischeck code. Many colorblind users have viewed our simulations
and told us that they "work" (simulated and original images are
indistinguishabled).
*/
void init();
 
/*! \brief This function performs initialisations that are dependant
on the type of color deficiency (see defectMode). */
void setupDefect();
 
/*! \brief Ensures that x is between the limits set by low and high.
Glib CLAMP() macro replacement for C++ speedup optimalization.
\param x value itself
\param low low border
\param high high border
\retval double value from interval
*/
double clamp(double x, double low, double high);
 
};
 
#endif
Property changes:
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Index: Scribus/scribus/scribusview.cpp
===================================================================
--- Scribus/scribus/scribusview.cpp (revision 6548)
+++ Scribus/scribus/scribusview.cpp (revision 6549)
@@ -176,9 +176,16 @@
zoomOutToolbarButton = new QToolButton(this);
zoomDefaultToolbarButton = new QToolButton(this);
zoomInToolbarButton = new QToolButton(this);
+ previewToolbarButton = new QToolButton(this);
zoomDefaultToolbarButton->setAutoRaise(OPTION_FLAT_BUTTON);
zoomOutToolbarButton->setAutoRaise(OPTION_FLAT_BUTTON);
zoomInToolbarButton->setAutoRaise(OPTION_FLAT_BUTTON);
+ previewToolbarButton->setAutoRaise(OPTION_FLAT_BUTTON);
+ previewToolbarButton->setToggleButton(true);
+ QIconSet ic;
+ ic.setPixmap(loadIcon("previewOff.png"), QIconSet::Automatic, QIconSet::Normal, QIconSet::Off);
+ ic.setPixmap(loadIcon("previewOn.png"), QIconSet::Automatic, QIconSet::Normal, QIconSet::On);
+ previewToolbarButton->setIconSet(ic);
#else
zoomDefaultToolbarButton = new QPushButton(this);
zoomDefaultToolbarButton->setFocusPolicy(QWidget::NoFocus);
@@ -195,6 +202,12 @@
zoomInToolbarButton->setDefault( false );
zoomInToolbarButton->setAutoDefault( false );
zoomInToolbarButton->setFlat(OPTION_FLAT_BUTTON);
+ previewToolbarButton = new QPushButton(this);
+ previewToolbarButton->setFocusPolicy(QWidget::NoFocus);
+ previewToolbarButton->setDefault( false );
+ previewToolbarButton->setAutoDefault( false );
+ previewToolbarButton->setFlat(OPTION_FLAT_BUTTON);
+ previewToolbarButton->setPixmap(loadIcon("previewOn.png"));
#endif
//zoomDefaultToolbarButton->setText("1:1");
zoomDefaultToolbarButton->setPixmap(loadIcon("16/zoom-original.png"));
@@ -207,6 +220,10 @@
layerMenu->setEditable(false);
layerMenu->setFont(fo);
layerMenu->setFocusPolicy(QWidget::NoFocus);
+ visualMenu = new QComboBox( false, this, "visualMenu" );
+ visualMenu->setFocusPolicy(QWidget::NoFocus);
+ visualMenu->setFont(fo);
+ visualMenu->setEnabled(false);
horizRuler = new Hruler(this, Doc);
vertRuler = new Vruler(this, Doc);
rulerMover = new RulerMover(this);
@@ -216,12 +233,12 @@
setAcceptDrops(true);
viewport()->setAcceptDrops(true);
setDragAutoScroll(false);
- //languageChange();
Doc->DragP = false;
Doc->leaveDrag = false;
Doc->SubMode = -1;
storedFramesShown = Doc->guidesSettings.framesShown;
viewAsPreview = false;
+ previewVisual = 0;
shiftSelItems = false;
#ifdef HAVE_CAIRO
m_ScMW->scrActions["viewFit20"]->setOn(viewAsPreview);
@@ -234,25 +251,45 @@
connect(pageSelector, SIGNAL(GotoPage(int)), this, SLOT(GotoPa(int)));
connect(layerMenu, SIGNAL(activated(int)), this, SLOT(GotoLa(int)));
connect(unitSwitcher, SIGNAL(activated(int)), this, SLOT(ChgUnit(int)));
+ connect(previewToolbarButton, SIGNAL(clicked()), this, SLOT(togglePreview()));
+ connect(visualMenu, SIGNAL(activated(int)), this, SLOT(switchPreviewVisual(int)));
connect(this, SIGNAL(contentsMoving(int, int)), this, SLOT(setRulerPos(int, int)));
connect(this, SIGNAL(HaveSel(int)), this, SLOT(selectionChanged()));
+ languageChange();
}
void ScribusView::languageChange()
{
- disconnect(layerMenu, SIGNAL(activated(int)), this, SLOT(GotoLa(int)));
- disconnect(unitSwitcher, SIGNAL(activated(int)), this, SLOT(ChgUnit(int)));
- zoomSpinBox->setSuffix( tr( " %" ) );
- layerMenu->setCurrentText( tr("Layer")+" 0");
+// disconnect(layerMenu, SIGNAL(activated(int)), this, SLOT(GotoLa(int)));
+// disconnect(unitSwitcher, SIGNAL(activated(int)), this, SLOT(ChgUnit(int)));
+ disconnect(visualMenu, SIGNAL(activated(int)), this, SLOT(switchPreviewVisual(int)));
+// zoomSpinBox->setSuffix( tr( " %" ) );
+// layerMenu->setCurrentText( tr("Layer")+" 0");
//CB TODO Convert to actions later
- unitSwitcher->clear();
- for (int i=0;i<=unitGetMaxIndex();++i)
- unitSwitcher->insertItem(unitGetStrFromIndex(i));
- unitSwitcher->setCurrentText(unitGetStrFromIndex(Doc->unitIndex()));
- connect(layerMenu, SIGNAL(activated(int)), this, SLOT(GotoLa(int)));
- connect(unitSwitcher, SIGNAL(activated(int)), this, SLOT(ChgUnit(int)));
+// unitSwitcher->clear();
+// for (int i=0;i<=unitGetMaxIndex();++i)
+// unitSwitcher->insertItem(unitGetStrFromIndex(i));
+ visualMenu->clear();
+ visualMenu->insertItem( tr("Normal Vision"));
+ visualMenu->insertItem( tr("Protanopia (Red)"));
+ visualMenu->insertItem( tr("Deuteranopia (Green)"));
+ visualMenu->insertItem( tr("Tritanopia (Blue)"));
+ visualMenu->insertItem( tr("Full Color Blindness"));
+ visualMenu->setCurrentItem(previewVisual);
+// unitSwitcher->setCurrentText(unitGetStrFromIndex(Doc->unitIndex()));
+ connect(visualMenu, SIGNAL(activated(int)), this, SLOT(switchPreviewVisual(int)));
+// connect(layerMenu, SIGNAL(activated(int)), this, SLOT(GotoLa(int)));
+// connect(unitSwitcher, SIGNAL(activated(int)), this, SLOT(ChgUnit(int)));
}
+void ScribusView::switchPreviewVisual(int vis)
+{
+ previewVisual = vis;
+ Doc->recalculateColors();
+ Doc->recalcPicturesRes();
+ updateContents();
+}
+
void ScribusView::togglePreview()
{
viewAsPreview = !viewAsPreview;
@@ -273,7 +310,12 @@
m_ScMW->scrActions["viewShowBaseline"]->setEnabled(!viewAsPreview);
m_ScMW->scrActions["viewShowTextChain"]->setEnabled(!viewAsPreview);
m_ScMW->scrActions["viewShowTextControls"]->setEnabled(!viewAsPreview);
-// Doc->updateAllItemQColors();
+#if OPTION_USE_QTOOLBUTTON
+ previewToolbarButton->setOn(viewAsPreview);
+#endif
+ visualMenu->setEnabled(viewAsPreview);
+ Doc->recalculateColors();
+ Doc->recalcPicturesRes();
updateContents();
}
@@ -356,7 +398,7 @@
else
painter->setPen(black, 1, SolidLine, FlatCap, MiterJoin);
painter->setBrush(Doc->papColor);
- painter->drawRect(x, y, w, h);
+ painter->drawRect(x, y, w, h);
if ((Doc->guidesSettings.before) && (!viewAsPreview))
DrawPageMarks(painter, Doc->Pages->at(a), QRect(clipx, clipy, clipw, cliph));
#ifdef HAVE_CAIRO
/branches/Version13x/Scribus/scribus/scribus.cpp
6940,11 → 6940,7
for (uint cst = 0; cst < ite->fill_gradient.Stops(); ++cst)
{
if (it.key() == cstops.at(cst)->name)
{
ite->SetFarbe(&tmpc, it.data(), cstops.at(cst)->shade);
cstops.at(cst)->color = tmpc;
cstops.at(cst)->name = it.data();
}
}
}
}
6980,11 → 6976,7
for (uint cst = 0; cst < ite->fill_gradient.Stops(); ++cst)
{
if (it.key() == cstops.at(cst)->name)
{
ite->SetFarbe(&tmpc, it.data(), cstops.at(cst)->shade);
cstops.at(cst)->color = tmpc;
cstops.at(cst)->name = it.data();
}
}
}
}
7020,64 → 7012,56
for (uint cst = 0; cst < ite->fill_gradient.Stops(); ++cst)
{
if (it.key() == cstops.at(cst)->name)
{
ite->SetFarbe(&tmpc, it.data(), cstops.at(cst)->shade);
cstops.at(cst)->color = tmpc;
cstops.at(cst)->name = it.data();
}
}
}
}
}
for (c=0; c<doc->DocItems.count(); ++c)
{
ite = doc->DocItems.at(c);
if (ite->asImageFrame())
for (it = ers.begin(); it != ers.end(); ++it)
{
if (ite->PicAvail)
QStringList patterns = doc->docPatterns.keys();
for (uint c = 0; c < patterns.count(); ++c)
{
bool fho = ite->imageFlippedH();
bool fvo = ite->imageFlippedV();
doc->LoadPict(ite->Pfile, ite->ItemNr, true);
ite->setImageFlippedH(fho);
ite->setImageFlippedV(fvo);
ite->AdjustPictScale();
ScPattern pa = doc->docPatterns[patterns[c]];
for (uint o = 0; o < pa.items.count(); o++)
{
PageItem *ite = pa.items.at(o);
if ((ite->itemType() == PageItem::TextFrame) || (ite->itemType() == PageItem::PathText))
{
CharStyle lastStyle;
int lastStyleStart = 0;
for (d=0; d<ite->itemText.length(); ++d)
{
CharStyle newStyle;
if (it.key() == ite->itemText.charStyle(d).fillColor())
newStyle.setFillColor(it.data());
if (it.key() == ite->itemText.charStyle(d).strokeColor())
newStyle.setStrokeColor(it.data());
if (newStyle != lastStyle) {
ite->itemText.applyCharStyle(lastStyleStart, d-lastStyleStart, lastStyle);
lastStyle = newStyle;
lastStyleStart = d;
}
}
ite->itemText.applyCharStyle(lastStyleStart, ite->itemText.length()-lastStyleStart, lastStyle);
}
if (it.key() == ite->fillColor())
ite->setFillColor(it.data());
if (it.key() == ite->lineColor())
ite->setLineColor(it.data());
QPtrVector<VColorStop> cstops = ite->fill_gradient.colorStops();
for (uint cst = 0; cst < ite->fill_gradient.Stops(); ++cst)
{
if (it.key() == cstops.at(cst)->name)
{
cstops.at(cst)->name = it.data();
}
}
}
}
}
}
for (c=0; c<doc->MasterItems.count(); ++c)
{
ite = doc->MasterItems.at(c);
if (ite->asImageFrame())
{
if (ite->PicAvail)
{
bool fho = ite->imageFlippedH();
bool fvo = ite->imageFlippedV();
doc->LoadPict(ite->Pfile, ite->ItemNr, true);
ite->setImageFlippedH(fho);
ite->setImageFlippedV(fvo);
ite->AdjustPictScale();
}
}
}
for (c=0; c<doc->FrameItems.count(); ++c)
{
ite = doc->FrameItems.at(c);
if (ite->asImageFrame())
{
if (ite->PicAvail)
{
bool fho = ite->imageFlippedH();
bool fvo = ite->imageFlippedV();
doc->LoadPict(ite->Pfile, ite->ItemNr, true);
ite->setImageFlippedH(fho);
ite->setImageFlippedV(fvo);
ite->AdjustPictScale();
}
}
}
doc->updateAllItemQColors();
doc->recalculateColors();
doc->recalcPicturesRes();
view->DrawNew();
}
else
/branches/Version13x/Scribus/scribus/colorblind.cpp
0,0 → 1,250
/*
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.
*/
#include "colorblind.h"
#include "colorblind.moc"
 
#include <math.h>
 
//#define CLAMP(x, low, high) (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x)))
 
 
VisionDefectColor::VisionDefectColor(int r, int g, int b)
{
red = (double)r;
green = (double)g;
blue = (double)b;
originalColor = QColor(r, g, b);
init();
}
 
VisionDefectColor::VisionDefectColor(QColor c)
{
red = (double)c.red();
green = (double)c.green();
blue = (double)c.blue();
originalColor = c;
init();
}
 
VisionDefectColor::VisionDefectColor()
{
red = 0.0;
green = 0.0;
blue = 0.0;
originalColor = QColor(0, 0, 0);
init();
}
 
void VisionDefectColor::init()
{
rgb2lms[0] = 0.05059983;
rgb2lms[1] = 0.08585369;
rgb2lms[2] = 0.00952420;
 
rgb2lms[3] = 0.01893033;
rgb2lms[4] = 0.08925308;
rgb2lms[5] = 0.01370054;
 
rgb2lms[6] = 0.00292202;
rgb2lms[7] = 0.00975732;
rgb2lms[8] = 0.07145979;
 
lms2rgb[0] = 30.830854;
lms2rgb[1] = -29.832659;
lms2rgb[2] = 1.610474;
 
lms2rgb[3] = -6.481468;
lms2rgb[4] = 17.715578;
lms2rgb[5] = -2.532642;
 
lms2rgb[6] = -0.375690;
lms2rgb[7] = -1.199062;
lms2rgb[8] = 14.273846;
 
gammaRGB[0] = 2.1;
gammaRGB[1] = 2.0;
gammaRGB[2] = 2.1;
}
 
void VisionDefectColor::convertDefect()
{
double tmp;
 
/* Remove gamma to linearize RGB intensities */
red = pow(red, 1.0 / gammaRGB[0]);
green = pow(green, 1.0 / gammaRGB[1]);
blue = pow(blue, 1.0 / gammaRGB[2]);
 
/* Convert to LMS (dot product with transform matrix) */
double redOld = red;
double greenOld = green;
 
red = redOld * rgb2lms[0] + greenOld * rgb2lms[1] + blue * rgb2lms[2];
green = redOld * rgb2lms[3] + greenOld * rgb2lms[4] + blue * rgb2lms[5];
blue = redOld * rgb2lms[6] + greenOld * rgb2lms[7] + blue * rgb2lms[8];
 
switch (deficiency)
{
case normalVision:
break;
case deuteranopeVision:
setupDefect();
tmp = blue / red;
/* See which side of the inflection line we fall... */
if (tmp < inflection)
green = -(a1 * red + c1 * blue) / b1;
else
green = -(a2 * red + c2 * blue) / b2;
break;
case protanopeVision:
setupDefect();
tmp = blue / green;
/* See which side of the inflection line we fall... */
if (tmp < inflection)
red = -(b1 * green + c1 * blue) / a1;
else
red = -(b2 * green + c2 * blue) / a2;
break;
case tritanopeVision:
setupDefect();
tmp = green / red;
/* See which side of the inflection line we fall... */
if (tmp < inflection)
blue = -(a1 * red + b1 * green) / c1;
else
blue = -(a2 * red + b2 * green) / c2;
break;
case colorBlindnessVision:
{
double gray = clamp(0.3 * originalColor.red()
+ 0.59 * originalColor.green()
+ 0.11 * originalColor.blue(), 0, 255);
red = gray;
green = gray;
blue = gray;
return; // no other transformations!
}
default:
break;
}
 
/* Convert back to RGB (cross product with transform matrix) */
redOld = red;
greenOld = green;
 
red = redOld * lms2rgb[0] + greenOld * lms2rgb[1] + blue * lms2rgb[2];
green = redOld * lms2rgb[3] + greenOld * lms2rgb[4] + blue * lms2rgb[5];
blue = redOld * lms2rgb[6] + greenOld * lms2rgb[7] + blue * lms2rgb[8];
 
/* Apply gamma to go back to non-linear intensities */
red = pow(red, gammaRGB[0]);
green = pow(green, gammaRGB[1]);
blue = pow(blue, gammaRGB[2]);
 
/* Ensure that we stay within the RGB gamut */
/* *** FIX THIS: it would be better to desaturate than blindly clip. */
red = clamp(red, 0.0, 255.0);
green = clamp(green, 0.0, 255.0);
blue = clamp(blue, 0.0, 255.0);
}
 
QColor VisionDefectColor::convertDefect(QColor c, int d)
{
red = (double)c.red();
green = (double)c.green();
blue = (double)c.blue();
originalColor = c;
init();
deficiency = d;
convertDefect();
return getColor();
}
 
void VisionDefectColor::setupDefect()
{
double anchor_e[3];
double anchor[12];
 
/*
Load the LMS anchor-point values for lambda = 475 & 485 nm (for
protans & deutans) and the LMS values for lambda = 575 & 660 nm
(for tritans)
*/
anchor[0] = 0.08008; anchor[1] = 0.1579; anchor[2] = 0.5897;
anchor[3] = 0.1284; anchor[4] = 0.2237; anchor[5] = 0.3636;
anchor[6] = 0.9856; anchor[7] = 0.7325; anchor[8] = 0.001079;
anchor[9] = 0.0914; anchor[10] = 0.007009; anchor[11] = 0.0;
 
/* We also need LMS for RGB=(1,1,1)- the equal-energy point (one of
* our anchors) (we can just peel this out of the rgb2lms transform
* matrix)
*/
anchor_e[0] = rgb2lms[0] + rgb2lms[1] + rgb2lms[2];
anchor_e[1] = rgb2lms[3] + rgb2lms[4] + rgb2lms[5];
anchor_e[2] = rgb2lms[6] + rgb2lms[7] + rgb2lms[8];
 
switch (deficiency)
{
case deuteranopeVision:
/* find a,b,c for lam=575nm and lam=475 */
a1 = anchor_e[1] * anchor[8] - anchor_e[2] * anchor[7];
b1 = anchor_e[2] * anchor[6] - anchor_e[0] * anchor[8];
c1 = anchor_e[0] * anchor[7] - anchor_e[1] * anchor[6];
a2 = anchor_e[1] * anchor[2] - anchor_e[2] * anchor[1];
b2 = anchor_e[2] * anchor[0] - anchor_e[0] * anchor[2];
c2 = anchor_e[0] * anchor[1] - anchor_e[1] * anchor[0];
inflection = (anchor_e[2] / anchor_e[0]);
break;
case protanopeVision:
/* find a,b,c for lam=575nm and lam=475 */
a1 = anchor_e[1] * anchor[8] - anchor_e[2] * anchor[7];
b1 = anchor_e[2] * anchor[6] - anchor_e[0] * anchor[8];
c1 = anchor_e[0] * anchor[7] - anchor_e[1] * anchor[6];
a2 = anchor_e[1] * anchor[2] - anchor_e[2] * anchor[1];
b2 = anchor_e[2] * anchor[0] - anchor_e[0] * anchor[2];
c2 = anchor_e[0] * anchor[1] - anchor_e[1] * anchor[0];
inflection = (anchor_e[2] / anchor_e[1]);
break;
case tritanopeVision:
/* Set 1: regions where lambda_a=575, set 2: lambda_a=475 */
a1 = anchor_e[1] * anchor[11] - anchor_e[2] * anchor[10];
b1 = anchor_e[2] * anchor[9] - anchor_e[0] * anchor[11];
c1 = anchor_e[0] * anchor[10] - anchor_e[1] * anchor[9];
a2 = anchor_e[1] * anchor[5] - anchor_e[2] * anchor[4];
b2 = anchor_e[2] * anchor[3] - anchor_e[0] * anchor[5];
c2 = anchor_e[0] * anchor[4] - anchor_e[1] * anchor[3];
inflection = (anchor_e[1] / anchor_e[0]);
break;
}
}
 
uint VisionDefectColor::getRed()
{
return (uint)red;
}
 
uint VisionDefectColor::getGreen()
{
return (uint)green;
}
 
uint VisionDefectColor::getBlue()
{
return (uint)blue;
}
 
QColor VisionDefectColor::getColor()
{
return QColor(getRed(), getGreen(), getBlue());
}
 
double VisionDefectColor::clamp(double x, double low, double high)
{
double ret;
(x > high) ? ret = high : ((x < low) ? ret = low : ret = x);
return ret;
}
Property changes:
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Index: Scribus/scribus/scribusdoc.cpp
===================================================================
--- Scribus/scribus/scribusdoc.cpp (revision 6548)
+++ Scribus/scribus/scribusdoc.cpp (revision 6549)
@@ -901,7 +901,7 @@
bool ScribusDoc::AddFont(QString name, int fsize)
{
bool ret = false;
- FT_Face face;
+// FT_Face face;
if (UsedFonts.contains(name))
return true;
@@ -2219,6 +2219,7 @@
bool ScribusDoc::addPattern(QString &name, ScPattern& pattern)
{
docPatterns.insert(name, pattern);
+ return true;
}
void ScribusDoc::setPatterns(QMap<QString, ScPattern> &patterns)
@@ -3108,7 +3109,7 @@
Page* oldCurrentPage = currentPage();
int z=-2;
PageItem *prevItem=0; //Previous item for text frame linking
- for (int i=0;i<pageNs.size();++i)
+ for (uint i=0;i<pageNs.size();++i)
{
Page* targetPage=Pages->at(pageNs[i]-1);
//We need this for the itemAdd, FIXME later
@@ -5951,6 +5952,24 @@
currItem->AdjustPictScale();
}
}
+ QStringList patterns = docPatterns.keys();
+ for (uint c = 0; c < patterns.count(); ++c)
+ {
+ ScPattern pa = docPatterns[patterns[c]];
+ for (uint o = 0; o < pa.items.count(); o++)
+ {
+ PageItem *currItem = pa.items.at(o);
+ if ((currItem->PicAvail) && (currItem->Pfile == name))
+ {
+ bool fho = currItem->imageFlippedH();
+ bool fvo = currItem->imageFlippedV();
+ LoadPict(currItem->Pfile, currItem->ItemNr, true);
+ currItem->setImageFlippedH(fho);
+ currItem->setImageFlippedV(fvo);
+ currItem->AdjustPictScale();
+ }
+ }
+ }
emit updateContents();
changed();
}
@@ -5978,6 +5997,17 @@
if (currItem->PicAvail)
cc++;
}
+ QStringList patterns = docPatterns.keys();
+ for (uint c = 0; c < patterns.count(); ++c)
+ {
+ ScPattern pa = docPatterns[patterns[c]];
+ for (uint o = 0; o < pa.items.count(); o++)
+ {
+ PageItem *currItem = pa.items.at(o);
+ if (currItem->PicAvail)
+ cc++;
+ }
+ }
m_ScMW->mainWindowProgressBar->setTotalSteps(cc);
for (uint a = 0; a < DocItems.count(); ++a)
{
@@ -6030,6 +6060,27 @@
qApp->eventLoop()->processEvents(QEventLoop::ExcludeUserInput);
}
}
+ for (uint c = 0; c < patterns.count(); ++c)
+ {
+ ScPattern pa = docPatterns[patterns[c]];
+ for (uint o = 0; o < pa.items.count(); o++)
+ {
+ PageItem *currItem = pa.items.at(o);
+ if (currItem->PicAvail)
+ {
+ bool fho = currItem->imageFlippedH();
+ bool fvo = currItem->imageFlippedV();
+ currItem->pixm.imgInfo.lowResType = toolSettings.lowResType;
+ LoadPict(currItem->Pfile, currItem->ItemNr, true);
+ currItem->setImageFlippedH(fho);
+ currItem->setImageFlippedV(fvo);
+ currItem->AdjustPictScale();
+ ca++;
+ m_ScMW->mainWindowProgressBar->setProgress(ca);
+ qApp->eventLoop()->processEvents(QEventLoop::ExcludeUserInput);
+ }
+ }
+ }
emit updateContents();
changed();
}
@@ -6063,6 +6114,20 @@
currItem->pixm = ScImage();
}
}
+ QStringList patterns = docPatterns.keys();
+ for (uint c = 0; c < patterns.count(); ++c)
+ {
+ ScPattern pa = docPatterns[patterns[c]];
+ for (uint o = 0; o < pa.items.count(); o++)
+ {
+ PageItem *currItem = pa.items.at(o);
+ if ((currItem->PicAvail) && (currItem->Pfile == name))
+ {
+ currItem->PicAvail = false;
+ currItem->pixm = ScImage();
+ }
+ }
+ }
emit updateContents();
changed();
}
/branches/Version13x/Scribus/scribus/scribuswin.cpp
62,6 → 62,8
m_View->zoomInToolbarButton->reparent(statusFrame, point);
m_View->pageSelector->reparent(statusFrame, point);
m_View->zoomSpinBox->reparent(statusFrame, point);
m_View->previewToolbarButton->reparent(statusFrame, point);
m_View->visualMenu->reparent(statusFrame, point);
statusFrameLayout->addWidget(m_View->unitSwitcher);
statusFrameLayout->addWidget(m_View->zoomSpinBox);
statusFrameLayout->addWidget(m_View->zoomOutToolbarButton);
71,6 → 73,12
statusFrameLayout->addWidget(m_View->layerMenu);
QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
statusFrameLayout->addItem( spacer );
statusFrameLayout->addWidget(m_View->previewToolbarButton);
statusFrameLayout->addWidget(m_View->visualMenu);
#ifndef HAVE_CAIRO
m_View->previewToolbarButton->hide();
m_View->visualMenu->hide();
#endif
statusBar()->addWidget(statusFrame, 4, true);
currentDir = QDir::currentDirPath();
}
/branches/Version13x/Scribus/scribus/plugins/colorwheel/colorblind.cpp
30,6 → 30,15
init();
}
 
VisionDefectColor::VisionDefectColor()
{
red = 0.0;
green = 0.0;
blue = 0.0;
originalColor = QColor(0, 0, 0);
init();
}
 
void VisionDefectColor::init()
{
rgb2lms[0] = 0.05059983;
143,6 → 152,18
blue = clamp(blue, 0.0, 255.0);
}
 
QColor VisionDefectColor::convertDefect(QColor c, int d)
{
red = (double)c.red();
green = (double)c.green();
blue = (double)c.blue();
originalColor = c;
init();
deficiency = d;
convertDefect();
return getColor();
}
 
void VisionDefectColor::setupDefect()
{
double anchor_e[3];
/branches/Version13x/Scribus/scribus/plugins/colorwheel/colorblind.h
63,6 → 63,10
*/
VisionDefectColor(QColor c);
 
/*! \brief Default constructors. Setup the RGB parts to default values, then init().
*/
VisionDefectColor();
 
/*! \brief Actual defect type. One of the 'defectMode' */
int deficiency;
 
71,6 → 75,14
LSM2RGB, gama applying. */
void convertDefect();
 
/*! \brief Perform conversion itself. Confidence overload to perform the conversion in one step;
\param c QColor object
\param d defect type
\retval QColor converted color
Gama removing, RGB2LSM, matrix operation for selected deficiency,
LSM2RGB, gama applying. */
QColor convertDefect(QColor c, int d);
 
/*! \brief Return the color parts
\retval uint red part
*/
/branches/Version13x/Scribus/scribus/CMakeLists.txt
66,6 → 66,7
cmsprefs.h
cmykfw.h
collect4output.h
colorblind.h
colorchart.h
colorm.h
colorsetmanager.h
242,6 → 243,7
cmsutil.cpp
cmsettings.cpp
collect4output.cpp
colorblind.cpp
colorchart.cpp
colorcombo.cpp
colorm.cpp