View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0017180 | Scribus | Properties Palette | public | 2024-03-23 22:29 | 2024-06-12 21:34 |
Reporter | nitramr | Assigned To | nitramr | ||
Priority | normal | Severity | feature | Reproducibility | N/A |
Status | assigned | Resolution | open | ||
Platform | Desktop PC | OS | Ubuntu | OS Version | 23.10 64-bit |
Product Version | 1.7 milestone | ||||
Target Version | 1.7.0 | ||||
Summary | 0017180: Indigo UI: Properties Palette Redesign | ||||
Description | Redesign of PP reached the next milestone. # What's new? - New "Attribute" section for item name and print option - New "Fill" section for fill specific properties - Colors, gradient, hatch and patterns are represented in a small preview widget (ColorButton) - New Color Picker to edit colors, gradients, hatch and pattern - Color Picker includes gradient vector editing too # What has been replaced? - Colors section - Transparency section # Qt Designer Plugins - New SectionContainer widget Patch is tested under Ubuntu and MacOS | ||||
Tags | No tags attached. | ||||
Patch | Yes | ||||
related to | 0011417 | closed | nitramr | Reduced size of the "Colours" tab in the PP |
related to | 0015813 | new | Indigo UI: remove the item name from the Properties Palette | |
related to | 0015896 | new | [PATCH] Indigo UI: shrink the size of the XYZ pane | |
related to | 0015899 | new | [PATCH] Indigo UI: add an advanced section for the item name | |
related to | 0009694 | closed | nitramr | Properties palette section switching |
related to | 0006044 | resolved | nitramr | Properties Palette could use far less screen estate |
related to | 0015915 | assigned | ale | Indigo UI: refactor the Color and Line panels |
related to | 0014085 | resolved | nitramr | Properties palette is confusing under Windows 10 |
related to | 0010785 | new | UI : Improve color dropdown select icons | |
related to | 0009569 | closed | nitramr | Proposal for UI: Split properties window into simple single windows (plus 0001348) |
|
|
|
eager to see this in action! first reaction, without having applied the patch... one small nitpick: - "Blend Mode" should probably be two words (can be fixed after applying the patch) two comments: - from a first when the labels are off that the only widgets that are not "recognizable" are "Color" and "Mask". not sure if it's worth to try to find a way to make them have a visible difference (i guess that time will tell... and, until then, the tooltip is enough) - in the "custom type of line", value and offset can probably go on a single line (can be changed in a later iteration) thanks for this patch! |
|
Hi ale, thanks for your feedback. :) >> from a first when the labels are off that the only widgets that are not "recognizable" are "Color" and "Mask". That is true, when you turn off the additional labels it will show a small "mask" indicator icon. >> until then, the tooltip is enough Currently, the tooltip is used to provide more information of what you see, like "Color: %colorname%", or "Gradient: %gradientname%" >> in the "custom type of line", value and offset can probably go on a single line (can be changed in a later iteration) Yes, there are more places that can be optimized. I'm also not happy with the style picker. Also, your proposal to edit styles from this place is missing. At this point, it is a new foundation to implement or optimize more things. But for now I think it is fine, and we should test and stabilize it before apply further changes. I'm happy to get more feedback. Especially if something is not behaving correctly. I tested a lot and compared the behavior with 1.6.1, but I can't be sure that everything is working like it should be after those many changes I did. |
|
Fixed patch, there were missing files. propertiespalette_2024-03-25_01.patch (1,015,826 bytes)
Index: Scribus.pro =================================================================== --- Scribus.pro (Revision 26070) +++ Scribus.pro (Arbeitskopie) @@ -429,8 +429,7 @@ scribus/ui/colorchart.h \ scribus/ui/colorcombo.h \ scribus/ui/colorlistbox.h \ - scribus/ui/colorlistmodel.h \ - scribus/ui/colorpalette.h \ + scribus/ui/colorlistmodel.h \ scribus/ui/colorsandfills.h \ scribus/ui/contentpalette.h \ scribus/ui/contentpalette_default.h \ @@ -462,7 +461,6 @@ scribus/ui/gradientaddedit.h \ scribus/ui/gradienteditor.h \ scribus/ui/gradientpreview.h \ - scribus/ui/gradientvectordialog.h \ scribus/ui/gtdialogs.h \ scribus/ui/gtfiledialog.h \ scribus/ui/guidemanager.h \ @@ -658,8 +656,7 @@ scribus/ui/tabpdfoptions.h \ scribus/ui/tabruler.h \ scribus/ui/textpalette.h \ - scribus/ui/transformdialog.h \ - scribus/ui/transparencypalette.h \ + scribus/ui/transformdialog.h \ scribus/ui/unicodesearch.h \ scribus/ui/useprintermarginsdialog.h \ scribus/ui/viewtoolbar.h \ @@ -1609,8 +1606,7 @@ scribus/ui/fontreplacedialog.cpp \ scribus/ui/gradientaddedit.cpp \ scribus/ui/gradienteditor.cpp \ - scribus/ui/gradientpreview.cpp \ - scribus/ui/gradientvectordialog.cpp \ + scribus/ui/gradientpreview.cpp \ scribus/ui/gtdialogs.cpp \ scribus/ui/gtfiledialog.cpp \ scribus/ui/guidemanager.cpp \ Index: resources/iconsets/1_7_0/16/action-chevron-down.svg =================================================================== Kann nicht anzeigen: Dateityp ist als binär angegeben. svn:mime-type = image/svg+xml Index: resources/iconsets/1_7_0/16/action-chevron-up.svg =================================================================== Kann nicht anzeigen: Dateityp ist als binär angegeben. svn:mime-type = image/svg+xml Index: resources/iconsets/1_7_0/16/action-menu.svg =================================================================== --- resources/iconsets/1_7_0/16/action-menu.svg (nicht existent) +++ resources/iconsets/1_7_0/16/action-menu.svg (Arbeitskopie) @@ -0,0 +1,3 @@ +<svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><style>@import '../colors.css';</style> +<path fill-rule="evenodd" clip-rule="evenodd" d="M9 3.5C9 4.32843 8.32843 5 7.5 5C6.67157 5 6 4.32843 6 3.5C6 2.67157 6.67157 2 7.5 2C8.32843 2 9 2.67157 9 3.5ZM9 11.5C9 12.3284 8.32843 13 7.5 13C6.67157 13 6 12.3284 6 11.5C6 10.6716 6.67157 10 7.5 10C8.32843 10 9 10.6716 9 11.5ZM7.5 9C8.32843 9 9 8.32843 9 7.5C9 6.67157 8.32843 6 7.5 6C6.67157 6 6 6.67157 6 7.5C6 8.32843 6.67157 9 7.5 9Z"/> +</svg> Index: resources/iconsets/1_7_0/16/colorpicker-gradient.svg =================================================================== --- resources/iconsets/1_7_0/16/colorpicker-gradient.svg (nicht existent) +++ resources/iconsets/1_7_0/16/colorpicker-gradient.svg (Arbeitskopie) @@ -0,0 +1,10 @@ +<svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><style>@import '../colors.css';</style> +<path fill-rule="evenodd" clip-rule="evenodd" d="M15 1H1V15H15V1ZM14 2H2V14H14V2Z"/> +<rect x="2" y="2" width="12" height="12" fill="url(#paint0_linear_1147_8)"/> +<defs> +<linearGradient id="paint0_linear_1147_8" x1="14" y1="8" x2="2" y2="8" gradientUnits="userSpaceOnUse"> +<stop stop-color="white" stop-opacity="0"/> +<stop offset="1"/> +</linearGradient> +</defs> +</svg> Index: resources/iconsets/1_7_0/16/colorpicker-hatch.svg =================================================================== --- resources/iconsets/1_7_0/16/colorpicker-hatch.svg (nicht existent) +++ resources/iconsets/1_7_0/16/colorpicker-hatch.svg (Arbeitskopie) @@ -0,0 +1,3 @@ +<svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><style>@import '../colors.css';</style> +<path fill-rule="evenodd" clip-rule="evenodd" d="M1 1H15V1.99995L15 1.99998L15 1.99999V4.99995L15 4.99998L15 4.99999V7.99995L15 7.99998L15 7.99999V10.9999L15 11L15 11V15H1V1ZM14 10.2614V8.30768L2.00001 12L2 12V13.9537L14 10.2614ZM5.24996 14L14 11.3077V14H5.24996ZM2 10.9537L14 7.26141V5.30768L2.00001 8.99998L2 8.99995V10.9537ZM2 7.95372L14 4.26141V2.30768L2.00001 5.99998L2 5.99995V7.95372ZM2 4.95372L11.5996 2H2V4.95372Z"/> +</svg> Index: resources/iconsets/1_7_0/16/colorpicker-pattern.svg =================================================================== --- resources/iconsets/1_7_0/16/colorpicker-pattern.svg (nicht existent) +++ resources/iconsets/1_7_0/16/colorpicker-pattern.svg (Arbeitskopie) @@ -0,0 +1,3 @@ +<svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><style>@import '../colors.css';</style> +<path fill-rule="evenodd" clip-rule="evenodd" d="M15 1H1V15H15V1ZM11 2H8V5H5V2H2V5H5V8H2V11H5V14H8V11H11V14H14V11H11V8H14V5H11V2ZM8 8V11H5V8H8ZM8 8H11V5H8V8Z"/> +</svg> Index: resources/iconsets/1_7_0/16/colorpicker-solid.svg =================================================================== --- resources/iconsets/1_7_0/16/colorpicker-solid.svg (nicht existent) +++ resources/iconsets/1_7_0/16/colorpicker-solid.svg (Arbeitskopie) @@ -0,0 +1,4 @@ +<svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><style>@import '../colors.css';</style> +<path fill-rule="evenodd" clip-rule="evenodd" d="M15 1H1V15H15V1ZM14 2H2V14H14V2Z"/> +<rect x="2" y="2" width="12" height="12" fill-opacity="0.4"/> +</svg> Index: resources/iconsets/1_7_0/1_7_0.xml =================================================================== --- resources/iconsets/1_7_0/1_7_0.xml (Revision 26070) +++ resources/iconsets/1_7_0/1_7_0.xml (Arbeitskopie) @@ -147,6 +147,7 @@ <icon id="erase-shadow-off" file="16/action-shadow-erase-off.svg" /> <icon id="swap" file="16/action-swap.svg" /> <icon id="toggle-object-coordination" file="16/object-xycoordination.svg" /> + <icon id="context-menu" file="16/action-menu.svg" /> <!-- Alerts --> <icon onLight="#E54545" onDark="#FF6666" id="22/dialog-error.png" file="16/alert-error.svg" /> @@ -217,6 +218,11 @@ <icon id="rgb.png" file="16/color-rgb.svg" /> <icon id="cmyk.png" file="16/color-cmyk.svg" /> <icon id="lab.png" file="16/color-lab.svg" /> + <icon id="colorpicker-gradient" file="16/colorpicker-gradient.svg" /> + <icon id="colorpicker-hatch" file="16/colorpicker-hatch.svg" /> + <icon id="colorpicker-pattern" file="16/colorpicker-pattern.svg" /> + <icon id="colorpicker-solid" file="16/colorpicker-solid.svg" /> + <icon id="mask" file="16/color-mask.svg" /> <!-- Cursor --> <icon id="LinkTextFrame.png" file="32/cursor-link-text-frame.svg" /> @@ -552,6 +558,7 @@ <icon id="/16/story-editor.png" file="16/tool-story-editor.svg" /> <icon id="16/story-editor.png" file="16/tool-story-editor.svg" /> <icon id="22/story-editor.png" file="16/tool-story-editor.svg" /> + <icon id="gradient-edit" file="16/colorpicker-gradient.svg" /> <icon id="16/text-frame-link.png" file="16/tool-link-text-frame.svg" /> <icon id="22/text-frame-link.png" file="16/tool-link-text-frame.svg" /> <icon id="16/text-frame-unlink.png" file="16/tool-unlink-text-frame.svg" /> Index: resources/iconsets/1_7_0/checker.svg =================================================================== Kann nicht anzeigen: Dateityp ist als binär angegeben. svn:mime-type = image/svg+xml Index: scribus/CMakeLists.txt =================================================================== --- scribus/CMakeLists.txt (Revision 26070) +++ scribus/CMakeLists.txt (Arbeitskopie) @@ -331,6 +331,9 @@ PRIVATE designer/uiwidgets.h designer/uiwidgets.cpp designer/formwidget_plugin.h designer/formwidget_plugin.cpp + designer/sectioncontainer_extension.h designer/sectioncontainer_extension.cpp + designer/sectioncontainer_extensionfactory.h designer/sectioncontainer_extensionfactory.cpp + designer/sectioncontainer_plugin.h designer/sectioncontainer_plugin.cpp ) add_subdirectory(plugins) Index: scribus/CMakeLists_Sources.txt =================================================================== --- scribus/CMakeLists_Sources.txt (Revision 26070) +++ scribus/CMakeLists_Sources.txt (Arbeitskopie) @@ -259,6 +259,8 @@ imagedataloaders/scimgdataloader_tiff.cpp imagedataloaders/scimgdataloader_wpg.cpp manager/dock_manager.cpp + manager/widget_manager.cpp + models/gradientlistmodel.cpp palettes/cxfcolor.cpp palettes/cxfcolorspecification.cpp palettes/cxfdocument.cpp @@ -306,7 +308,6 @@ ui/colorcombo.cpp ui/colorlistbox.cpp ui/colorlistmodel.cpp - ui/colorpalette.cpp ui/colorsandfills.cpp ui/contentpalette.cpp ui/contentpalette_default.cpp @@ -331,7 +332,6 @@ ui/fontreplacedialog.cpp ui/gradientaddedit.cpp ui/gradienteditor.cpp - ui/gradientvectordialog.cpp ui/gradientpreview.cpp ui/gtdialogs.cpp ui/gtfiledialog.cpp @@ -351,6 +351,7 @@ ui/layers.cpp ui/linecombo.cpp ui/linemarkerselector.cpp + ui/linestyleselector.cpp ui/linkbutton.cpp ui/loremipsum.cpp ui/mark2item.cpp @@ -430,7 +431,9 @@ ui/printlanguagecombo.cpp ui/printpreview.cpp ui/propertiespalette.cpp + ui/propertiespalette_attributes.cpp ui/propertiespalette_image.cpp + ui/propertiespalette_fill.cpp ui/propertiespalette_group.cpp ui/propertiespalette_line.cpp ui/propertiespalette_shadow.cpp @@ -524,7 +527,6 @@ ui/tabpdfoptions.cpp ui/tabruler.cpp ui/transformdialog.cpp - ui/transparencypalette.cpp tt/simpletreemodel/treeitem.cpp tt/simpletreemodel/treemodel.cpp ui/copypagetomasterpagedialog.cpp @@ -539,15 +541,27 @@ ui/vruler.cpp ui/useprintermarginsdialog.cpp ui/weldedit.cpp + ui/colorpicker/colorpicker.cpp + ui/colorpicker/colorpicker_color.cpp + ui/colorpicker/colorpicker_color_swatches.cpp + ui/colorpicker/colorpicker_gradient.cpp + ui/colorpicker/colorpicker_gradient_properties.cpp + ui/colorpicker/colorpicker_gradient_swatches.cpp + ui/colorpicker/colorpicker_hatch.cpp + ui/colorpicker/colorpicker_pattern.cpp ui/delegates/sclistitemdelegate.cpp ui/docks/dock_centralwidget.cpp ui/docks/dock_panelbase.cpp ui/widgets/color_button.cpp ui/widgets/combo_blendmode.cpp + ui/widgets/combo_linestyle.cpp + ui/widgets/floatingwindow.cpp + ui/widgets/form_widget.cpp + ui/widgets/gradientlistbox.cpp ui/widgets/popup_menu.cpp ui/widgets/section_container.cpp + ui/widgets/stacked_container.cpp ui/widgets/switch.cpp - ui/widgets/form_widget.cpp ${SCRIBUS_OSG_SRC} ${SCRIBUS_GMAGICK_SRC} ${SCRIBUS_JPEGXL_SRC} Index: scribus/canvasmode.cpp =================================================================== --- scribus/canvasmode.cpp (Revision 26070) +++ scribus/canvasmode.cpp (Arbeitskopie) @@ -76,22 +76,7 @@ m_doc(view->m_doc), undoManager(UndoManager::instance()) { - m_pen["outline"] = QPen(Qt::gray, 1.0 , Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin); - m_pen["outline"].setCosmetic(true); - m_pen["selection"] = QPen(PrefsManager::instance().appPrefs.displayPrefs.frameColor, 1.0, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin); - m_pen["selection"].setCosmetic(true); - m_pen["selection-group"] = QPen(Qt::red, 1.0 , Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin); - m_pen["selection-group"].setCosmetic(true); - m_pen["selection-group-inside"] = QPen(PrefsManager::instance().appPrefs.displayPrefs.frameGroupColor, 1.0 , Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin); - m_pen["selection-group-inside"].setCosmetic(true); - m_pen["handle"] = QPen(PrefsManager::instance().appPrefs.displayPrefs.frameColor, 1.0, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin); - m_pen["handle"].setCosmetic(true); - - m_brush["outline"] = Qt::NoBrush; - m_brush["selection"] = Qt::NoBrush; - m_brush["selection-group"] = QColor(255,0,0,10); - m_brush["selection-group-inside"] = Qt::NoBrush; - m_brush["handle"] = PrefsManager::instance().appPrefs.displayPrefs.frameColor; + setStyle(); } CanvasMode::~CanvasMode() @@ -202,7 +187,7 @@ result = new CanvasMode_Normal(view); break; } - + return result; } @@ -215,58 +200,38 @@ void CanvasMode::drawSelectionHandles(QPainter *psx, QRectF selectionRect, bool background, bool insideGroup, double sx, double sy) { - m_pen["handle"] = QPen(PrefsManager::instance().appPrefs.displayPrefs.frameColor, 1.0, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin); - m_pen["handle"].setCosmetic(true); - m_pen["selection-group-inside"] = QPen(PrefsManager::instance().appPrefs.displayPrefs.frameGroupColor, 1.0 , Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin); - m_pen["selection-group-inside"].setCosmetic(true); - QPen ba(Qt::white, 3.0, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin); - ba.setCosmetic(true); - double markWidth = 4.0 / m_canvas->scale(); - if (insideGroup) - markWidth /= qMax(sx, sy); - QRectF handleRect(0, 0, markWidth, markWidth); +// double markWidth = 4.0 / m_canvas->scale(); +// if (insideGroup) +// markWidth /= qMax(sx, sy); +// QRectF handleRect(0, 0, markWidth, markWidth); double x = selectionRect.x(); double y = selectionRect.y(); double w = selectionRect.width(); double h = selectionRect.height(); - psx->setBrush(Qt::white); - if (background) - psx->setPen(ba); - else - { +// psx->setBrush(Qt::white); + + QPen p = m_pen["selection-handle"]; + +// if (background) +// p = m_pen["frame-outline"]; +// else +// { if (insideGroup) - psx->setPen(m_pen["selection-group-inside"]); - else - psx->setPen(m_pen["handle"]); - } - handleRect.moveCenter(QPointF(x, y)); - psx->drawRect(handleRect); - handleRect.moveCenter(QPointF(x+w/2.0, y)); - psx->drawRect(handleRect); - handleRect.moveCenter(QPointF(x+w, y)); - psx->drawRect(handleRect); - handleRect.moveCenter(QPointF(x+w, y+h/2.0)); - psx->drawRect(handleRect); - handleRect.moveCenter(QPointF(x+w, y+h)); - psx->drawRect(handleRect); - handleRect.moveCenter(QPointF(x+w/2.0, y+h)); - psx->drawRect(handleRect); - handleRect.moveCenter(QPointF(x, y+h)); - psx->drawRect(handleRect); - handleRect.moveCenter(QPointF(x, y+h/2.0)); - psx->drawRect(handleRect); + p = m_pen["selection-group-inside"]; +// } + + drawSelectionHandle(psx, QPointF(x, y), p, m_canvas->scale()); + drawSelectionHandle(psx, QPointF(x+w/2.0, y), p, m_canvas->scale()); + drawSelectionHandle(psx, QPointF(x+w, y), p, m_canvas->scale()); + drawSelectionHandle(psx, QPointF(x+w, y+h/2.0), p, m_canvas->scale()); + drawSelectionHandle(psx, QPointF(x+w, y+h), p, m_canvas->scale()); + drawSelectionHandle(psx, QPointF(x+w/2.0, y+h), p, m_canvas->scale()); + drawSelectionHandle(psx, QPointF(x, y+h), p, m_canvas->scale()); + drawSelectionHandle(psx, QPointF(x, y+h/2.0), p, m_canvas->scale()); } void CanvasMode::drawSelection(QPainter* psx, bool drawHandles) { - m_pen["selection"] = QPen(PrefsManager::instance().appPrefs.displayPrefs.frameColor, 1.0, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin); - m_pen["selection"].setCosmetic(true); - m_pen["selection-group-inside"] = QPen(PrefsManager::instance().appPrefs.displayPrefs.frameGroupColor, 1.0 , Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin); - m_pen["selection-group-inside"].setCosmetic(true); - QPen ba(Qt::white, 3.0, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin); - ba.setCosmetic(true); - QPen bb(Qt::black, 1.0, Qt::DotLine, Qt::FlatCap, Qt::MiterJoin); - bb.setCosmetic(true); psx->scale(m_canvas->scale(), m_canvas->scale()); psx->translate(-m_doc->minCanvasCoordinate.x(), -m_doc->minCanvasCoordinate.y()); psx->setClipping(true); @@ -310,9 +275,9 @@ x = currItem->asLine() ? 0 : -lineAdjust; y = currItem->asLine() ? 0 : -lineAdjust; } - psx->setBrush(Qt::NoBrush); - psx->setPen(ba); - psx->drawRect(QRectF(x, y, w, h)); +// psx->setBrush(Qt::NoBrush); +// psx->setPen(m_pen["frame-outline"]); +// psx->drawRect(QRectF(x, y, w, h)); psx->setPen(m_pen["selection-group-inside"]); psx->setBrush(m_brush["selection-group-inside"]); psx->drawRect(QRectF(x, y, w, h)); @@ -329,11 +294,11 @@ x = -lineAdjust; y = -lineAdjust; - psx->setBrush(Qt::NoBrush); - psx->setPen(ba); - psx->drawRect(QRectF(x, y, w, h)); - if (drawHandles) - drawSelectionHandles(psx, QRectF(x, y, w, h), true); +// psx->setBrush(Qt::NoBrush); +// psx->setPen(m_pen["frame-outline"]); +// psx->drawRect(QRectF(x, y, w, h)); +// if (drawHandles) +// drawSelectionHandles(psx, QRectF(x, y, w, h), true); psx->setPen(m_pen["selection-group"]); psx->setBrush(m_brush["selection-group"]); psx->drawRect(QRectF(x, y, w, h)); @@ -363,13 +328,13 @@ h = currItem->visualHeight(); x = currItem->asLine() ? 0 : (-currItem->visualLineWidth() / 2.0); y = -currItem->visualLineWidth() / 2.0; - psx->setBrush(Qt::NoBrush); +// psx->setBrush(Qt::NoBrush); QRectF drRect = QRectF(x, y, w, h).normalized(); if (m_doc->drawAsPreview && !m_doc->editOnPreview) { if (!currItem->annotation().IsOpen()) { - psx->setPen(bb); + psx->setPen(m_pen["frame-preview"]); psx->setBrush(Qt::NoBrush); psx->drawRect(drRect.adjusted(-1, -1, 1, 1)); } @@ -376,10 +341,10 @@ } else { - psx->setPen(ba); - psx->drawRect(drRect); - if (drawHandles) - drawSelectionHandles(psx, QRectF(x, y, w, h), true, true, sx, sy); +// psx->setPen(m_pen["frame-outline"]); +// psx->drawRect(drRect); +// if (drawHandles) +// drawSelectionHandles(psx, QRectF(x, y, w, h), true, true, sx, sy); psx->setPen(m_pen["selection-group-inside"]); psx->setBrush(m_brush["selection-group-inside"]); psx->drawRect(drRect); @@ -405,12 +370,12 @@ x = currItem->asLine() ? 0 : -lineAdjust; y = currItem->asLine() ? 0 : -lineAdjust; } - psx->setBrush(Qt::NoBrush); +// psx->setBrush(Qt::NoBrush); if (m_doc->drawAsPreview && !m_doc->editOnPreview) { if (!currItem->annotation().IsOpen()) { - psx->setPen(bb); + psx->setPen(m_pen["frame-preview"]); psx->setBrush(Qt::NoBrush); psx->drawRect(QRectF(x, y, w, h).adjusted(-1, -1, 1, 1)); } @@ -417,10 +382,10 @@ } else { - psx->setPen(ba); - psx->drawRect(QRectF(x, y, w, h)); - if (drawHandles && !currItem->locked() && !currItem->isLine()) - drawSelectionHandles(psx, QRectF(x, y, w, h), true); +// psx->setPen(m_pen["frame-outline"]); +// psx->drawRect(QRectF(x, y, w, h)); +// if (drawHandles && !currItem->locked() && !currItem->isLine()) +// drawSelectionHandles(psx, QRectF(x, y, w, h), true); psx->setPen(m_pen["selection"]); psx->setBrush(m_brush["selection"]); psx->drawRect(QRectF(x, y, w, h)); @@ -429,15 +394,9 @@ { if (currItem->isLine()) { - const double markWidth = 4.0 / m_canvas->scale(); - QRectF handleRect(0, 0, markWidth, markWidth); psx->setRenderHint(QPainter::Antialiasing); - psx->setBrush(Qt::white); - psx->setPen(m_pen["handle"]); - handleRect.moveCenter(QPointF(x, y + h / 2.0)); - psx->drawRect(handleRect); - handleRect.moveCenter(QPointF(x + w, y + h / 2.0)); - psx->drawRect(handleRect); + drawSelectionHandle(psx, QPointF(x, y + h / 2.0), m_pen["selection-handle"], m_canvas->scale()); + drawSelectionHandle(psx, QPointF(x + w, y + h / 2.0), m_pen["selection-handle"], m_canvas->scale()); } else drawSelectionHandles(psx, QRectF(x, y, w, h), false); @@ -444,11 +403,10 @@ } if (currItem->isWelded()) { - psx->setPen(QPen(Qt::yellow, 8.0 / m_canvas->scale(), Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin)); for (int i = 0 ; i < currItem->weldList.count(); i++) { PageItem::WeldingInfo wInf = currItem->weldList.at(i); - psx->drawPoint(QPointF(wInf.weldPoint.x(), wInf.weldPoint.y())); + drawWeldMarker(psx, QPointF(wInf.weldPoint.x(), wInf.weldPoint.y()), m_color["weld"], m_canvas->scale()); } } } @@ -502,8 +460,8 @@ if (currItem->isGroup()) { p->save(); - p->setBrush(m_brush["outline"]); - p->setPen(m_pen["outline"]); + p->setBrush(m_brush["frame-move"]); + p->setPen(m_pen["frame-move"]); p->setWorldTransform(itemTrans, true); if (matRot != 0) p->setRenderHint(QPainter::Antialiasing); @@ -548,8 +506,8 @@ else { p->save(); - p->setBrush(m_brush["outline"]); - p->setPen(m_pen["outline"]); + p->setBrush(m_brush["frame-move"]); + p->setPen(m_pen["frame-move"]); p->setWorldTransform(itemTrans, true); if (matRot != 0) p->setRenderHint(QPainter::Antialiasing); @@ -560,8 +518,8 @@ p->restore(); p->save(); - p->setBrush(m_brush["outline"]); - p->setPen(m_pen["outline"]); + p->setBrush(m_brush["frame-move"]); + p->setPen(m_pen["frame-move"]); p->setWorldTransform(itemTrans, true); if (matRot != 0) p->setRenderHint(QPainter::Antialiasing); @@ -619,8 +577,8 @@ #endif // GESTURE_FRAME_PREVIEW { p->save(); - p->setBrush(m_brush["outline"]); - p->setPen(m_pen["outline"]); + p->setBrush(m_brush["frame-move"]); + p->setPen(m_pen["frame-move"]); p->setWorldTransform(itemTrans, true); if (matRot != 0) p->setRenderHint(QPainter::Antialiasing); @@ -631,8 +589,8 @@ p->restore(); p->save(); - p->setBrush(m_brush["outline"]); - p->setPen(m_pen["outline"]); + p->setBrush(m_brush["frame-move"]); + p->setPen(m_pen["frame-move"]); p->setWorldTransform(itemTrans, true); if (matRot != 0) p->setRenderHint(QPainter::Antialiasing); @@ -642,8 +600,8 @@ } else { - p->setBrush(m_brush["outline"]); - p->setPen(m_pen["outline"]); + p->setBrush(m_brush["frame-move"]); + p->setPen(m_pen["frame-move"]); p->setWorldTransform(itemTrans, true); if (matRot != 0) p->setRenderHint(QPainter::Antialiasing); @@ -657,8 +615,8 @@ } else { - p->setBrush(m_brush["outline"]); - p->setPen(m_pen["outline"]); + p->setBrush(m_brush["frame-move"]); + p->setPen(m_pen["frame-move"]); p->translate(deltax, deltay); p->translate(x, y); p->drawRect(QRectF(0, 0, w, h)); @@ -845,6 +803,8 @@ void CanvasMode::commonDrawControls(QPainter* p, bool drawHandles) { + setStyle(); // reload pen and brush styles + if (m_canvas->m_viewMode.operItemMoving) drawOutline(p); else @@ -1746,14 +1706,63 @@ currItem->ContourLine.translate(xposOrig - currItem->xPos(),yposOrig - currItem->yPos()); m_doc->nodeEdit.finishTransaction(currItem); currItem->update(); - m_doc->regionsChanged()->update(currItem->getVisualBoundingRect()); + m_doc->regionsChanged()->update(currItem->getVisualBoundingRect()); } for (int i = 0; i < docSelectionCount; ++i) m_doc->m_Selection->itemAt(i)->checkChanges(true); if (docSelectionCount > 1 && m_view->groupTransactionStarted()) m_view->endGroupTransaction(); - m_doc->changedPagePreview(); + m_doc->changedPagePreview(); } break; } } + +void CanvasMode::setStyle() +{ + /* + Paper Fill = prefsData->displayPrefs.paperColor; // white + Scratch Space = prefsData->displayPrefs.scratchColor; // light grey + Selected Page Border = prefsData->displayPrefs.pageBorderColor; // red + Frames = prefsData->displayPrefs.frameNormColor; // black + Locked Frames = prefsData->displayPrefs.frameLockColor; // brown + Selected Frames = prefsData->displayPrefs.frameColor; // red + Linked Frames = prefsData->displayPrefs.frameLinkColor; // red + Grouped Frames = prefsData->displayPrefs.frameGroupColor; // dark teal + Annotation Frames = prefsData->displayPrefs.frameAnnotationColor; // blue + Text Control Characters = prefsData->displayPrefs.controlCharColor; // brown + */ + + m_color["frame-selection"] = PrefsManager::instance().appPrefs.displayPrefs.frameColor; + m_color["frame-group"] = PrefsManager::instance().appPrefs.displayPrefs.frameGroupColor; + m_color["frame"] = PrefsManager::instance().appPrefs.displayPrefs.frameNormColor; + m_color["frame-move"] = Qt::gray; + m_color["weld"] = QColor(214, 146, 43); + m_color["node"] = QColor(51, 132, 204); + m_color["test"] = Qt::magenta; + + m_pen["frame-move"] = QPen(m_color["frame-move"], 1.0 , Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin); + m_pen["frame-move"].setCosmetic(true); + m_pen["frame-preview"] = QPen(Qt::black, 1.0, Qt::DotLine, Qt::FlatCap, Qt::MiterJoin); + m_pen["frame-preview"].setCosmetic(true); + m_pen["selection"] = QPen(m_color["frame-selection"], 1.0, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin); + m_pen["selection"].setCosmetic(true); + m_pen["selection-handle"] = QPen(m_color["frame-selection"], 1.0, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin); + m_pen["selection-handle"].setCosmetic(true); + m_pen["selection-group"] = m_pen["selection"]; + m_pen["selection-group-inside"] = QPen(m_color["frame-group"], 1.0 , Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin); + m_pen["selection-group-inside"].setCosmetic(true); + m_pen["vector"] = QPen(m_color["node"], 1.0, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin); + m_pen["vector"].setCosmetic(true); + m_pen["node"] = QPen(m_color["node"], 1.0, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin); + m_pen["node"].setCosmetic(true); + m_pen["node-handle"] = QPen(m_color["node"], 1.0, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin); + m_pen["node-handle"].setCosmetic(true); + m_pen["node-dash"] = QPen(m_color["node"], 1.0, Qt::DashLine, Qt::FlatCap, Qt::MiterJoin); + m_pen["node-dash"].setCosmetic(true); + + m_brush["frame-move"] = Qt::NoBrush; + m_brush["selection"] = Qt::NoBrush; + m_brush["selection-group"] = QColor(255,0,0,10); + m_brush["selection-group-inside"] = Qt::NoBrush; +} Index: scribus/canvasmode.h =================================================================== --- scribus/canvasmode.h (Revision 26070) +++ scribus/canvasmode.h (Arbeitskopie) @@ -19,7 +19,8 @@ #define CANVAS_MODE_H #include "scribusapi.h" -#include "scribusdoc.h" +#include "scribusdoc.h" +#include "util_gui.h" #include <QBrush> #include <QCursor> @@ -155,6 +156,9 @@ ScribusView* view() const { return m_view; } ~CanvasMode() override; + QMap<QString,QPen> pens() const { return m_pen; }; + QMap<QString,QBrush> brushes() const { return m_brush; }; + protected: ScribusView* const m_view; Canvas* const m_canvas; @@ -175,9 +179,12 @@ void commonkeyPressEvent_NormalNodeEdit(QKeyEvent *e); void commonkeyReleaseEvent(QKeyEvent *e); + void setStyle(); + private: QMap<QString,QPen> m_pen; QMap<QString,QBrush> m_brush; + QMap<QString,QColor> m_color; bool m_keyRepeat {false}; bool m_arrowKeyDown {false}; Index: scribus/canvasmode_editarc.cpp =================================================================== --- scribus/canvasmode_editarc.cpp (Revision 26070) +++ scribus/canvasmode_editarc.cpp (Arbeitskopie) @@ -81,13 +81,8 @@ void CanvasMode_EditArc::drawControlsArc(QPainter* psx, PageItem* currItem) { - QPen p1b = QPen(Qt::blue, 1.0 / m_canvas->m_viewMode.scale, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin); - QPen p1bd = QPen(Qt::blue, 1.0 / m_canvas->m_viewMode.scale, Qt::DotLine, Qt::FlatCap, Qt::MiterJoin); - QPen p8b = QPen(Qt::blue, 8.0 / m_canvas->m_viewMode.scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin); - QPen p8r = QPen(Qt::red, 8.0 / m_canvas->m_viewMode.scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin); - psx->setTransform(currItem->getTransform(), true); - psx->setPen(p1b); - psx->setBrush(Qt::NoBrush); + qreal scale = m_canvas->m_viewMode.scale; + QPainterPath pp; const PageItem_Arc* item = currItem->asArc(); QPointF mPoint = item->PoLine.pointQF(0); @@ -99,31 +94,31 @@ pp.moveTo(mPoint); pp.arcTo(QRectF(mPoint.x() - nWidth, mPoint.y() - nHeight, nWidth * 2, nHeight * 2), m_startAngle, nSweep); pp.closeSubpath(); + + psx->save(); + psx->setRenderHint(QPainter::Antialiasing); + + // Draw Vector Path + psx->setTransform(currItem->getTransform(), true); + psx->setPen(pens().value("vector")); + psx->setBrush(Qt::NoBrush); psx->drawPath(pp); - psx->setPen(p1bd); + + if (currItem->rotation() == 0 || currItem->rotation() == 90 || currItem->rotation() == 180 || currItem->rotation() == 270) + psx->setRenderHint(QPainter::Antialiasing, false); + + // Draw Handle lines + psx->setPen(pens().value("node-dash")); psx->drawLine(mPoint, m_widthPoint); psx->drawLine(mPoint, m_heightPoint); - psx->setPen(p8b); - if (m_arcPoint == useControlStart) - psx->setPen(p8r); - else - psx->setPen(p8b); - psx->drawPoint(m_startPoint); - if (m_arcPoint == useControlSweep) - psx->setPen(p8r); - else - psx->setPen(p8b); - psx->drawPoint(m_endPoint); - if (m_arcPoint == useControlWidth) - psx->setPen(p8r); - else - psx->setPen(p8b); - psx->drawPoint(m_widthPoint); - if (m_arcPoint == useControlHeight) - psx->setPen(p8r); - else - psx->setPen(p8b); - psx->drawPoint(m_heightPoint); + + // Draw Nodes + drawNodeHandle(psx, m_startPoint, pens().value("node"), scale, m_arcPoint == useControlStart); + drawNodeHandle(psx, m_endPoint, pens().value("node"), scale, m_arcPoint == useControlSweep); + drawNodeHandle(psx, m_widthPoint, pens().value("node"), scale, m_arcPoint == useControlWidth); + drawNodeHandle(psx, m_heightPoint, pens().value("node"), scale, m_arcPoint == useControlHeight); + + psx->restore(); } void CanvasMode_EditArc::enterEvent(QEvent *e) Index: scribus/canvasmode_editgradient.cpp =================================================================== --- scribus/canvasmode_editgradient.cpp (Revision 26070) +++ scribus/canvasmode_editgradient.cpp (Arbeitskopie) @@ -38,9 +38,9 @@ #include "scribusview.h" #include "selection.h" #include "ui/contextmenu.h" -#include "ui/propertiespalette.h" #include "undomanager.h" #include "util_math.h" +#include "util_gui.h" CanvasMode_EditGradient::CanvasMode_EditGradient(ScribusView* view) : CanvasMode(view), m_ScMW(view->m_ScMW) @@ -50,7 +50,7 @@ inline bool CanvasMode_EditGradient::GetItem(PageItem** pi) { - *pi = m_doc->m_Selection->itemAt(0); + *pi = m_doc->m_Selection->itemAt(0); return (*pi) != nullptr; } @@ -73,36 +73,48 @@ void CanvasMode_EditGradient::drawControlsGradientVectors(QPainter* psx, PageItem *currItem) { psx->setTransform(currItem->getTransform(), true); - psx->setPen(QPen(Qt::blue, 1.0 / m_canvas->m_viewMode.scale, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin)); + psx->setRenderHint(QPainter::Antialiasing); + psx->setPen(pens().value("node-handle")); psx->setBrush(Qt::NoBrush); - if (m_view->editStrokeGradient == 1) + if (m_view->editStrokeGradient == GradientEdit::Gradient_Stroke) { + // Draw Start + End Nodes psx->drawLine(QPointF(currItem->GrStrokeStartX, currItem->GrStrokeStartY), QPointF(currItem->GrStrokeEndX, currItem->GrStrokeEndY)); - psx->setPen(QPen(Qt::magenta, 8.0 / m_canvas->m_viewMode.scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin)); - psx->drawPoint(QPointF(currItem->GrStrokeStartX, currItem->GrStrokeStartY)); - psx->drawPoint(QPointF(currItem->GrStrokeEndX, currItem->GrStrokeEndY)); + drawNodeHandle(psx, QPointF(currItem->GrStrokeStartX, currItem->GrStrokeStartY), pens().value("node"), m_canvas->m_viewMode.scale); + drawNodeHandle(psx, QPointF(currItem->GrStrokeEndX, currItem->GrStrokeEndY), pens().value("node"), m_canvas->m_viewMode.scale); + double radEnd = distance(currItem->GrStrokeEndX - currItem->GrStrokeStartX, currItem->GrStrokeEndY - currItem->GrStrokeStartY); double rotEnd = xy2Deg(currItem->GrStrokeEndX - currItem->GrStrokeStartX, currItem->GrStrokeEndY - currItem->GrStrokeStartY); - QTransform qmatrix; - qmatrix.translate(currItem->GrStrokeStartX, currItem->GrStrokeStartY); - qmatrix.rotate(rotEnd); - double mask_gradientSkew = 0.0; - if (currItem->GrStrokeSkew == 90) - mask_gradientSkew = 1; - else if (currItem->GrStrokeSkew == 180) - mask_gradientSkew = 0; - else if (currItem->GrStrokeSkew == 270) - mask_gradientSkew = -1; - else if (currItem->GrStrokeSkew == 390) - mask_gradientSkew = 0; - else - mask_gradientSkew = tan(M_PI / 180.0 * currItem->GrStrokeSkew); - qmatrix.shear(mask_gradientSkew, 0); - qmatrix.translate(0, currItem->GrStrokeStartY * (1.0 - currItem->GrStrokeScale)); - qmatrix.translate(-currItem->GrStrokeStartX, -currItem->GrStrokeStartY); - qmatrix.scale(1, currItem->GrStrokeScale); + + // Draw Focal Control if (currItem->GrTypeStroke == Gradient_Radial) - psx->drawPoint(qmatrix.map(QPointF(currItem->GrStrokeFocalX, currItem->GrStrokeFocalY))); + { + QTransform qmatrix; + qmatrix.translate(currItem->GrStrokeStartX, currItem->GrStrokeStartY); + qmatrix.rotate(rotEnd); + double mask_gradientSkew = 0.0; + if (currItem->GrStrokeSkew == 90) + mask_gradientSkew = 1; + else if (currItem->GrStrokeSkew == 180) + mask_gradientSkew = 0; + else if (currItem->GrStrokeSkew == 270) + mask_gradientSkew = -1; + else if (currItem->GrStrokeSkew == 360) + mask_gradientSkew = 0; + else + mask_gradientSkew = tan(M_PI / 180.0 * currItem->GrStrokeSkew); + qmatrix.shear(mask_gradientSkew, 0); + qmatrix.translate(0, currItem->GrStrokeStartY * (1.0 - currItem->GrStrokeScale)); + qmatrix.translate(-currItem->GrStrokeStartX, -currItem->GrStrokeStartY); + qmatrix.scale(1, currItem->GrStrokeScale); + + QPointF focal = qmatrix.map(QPointF(currItem->GrStrokeFocalX, currItem->GrStrokeFocalY)); + psx->setPen(pens().value("node-dash")); + psx->drawLine(QPointF(currItem->GrStrokeStartX, currItem->GrStrokeStartY), focal); + drawNodeControl(psx, focal, pens().value("node"), m_canvas->m_viewMode.scale); + } + + // Draw Shear Control QTransform m; m.translate(currItem->GrStrokeStartX, currItem->GrStrokeStartY); m.rotate(rotEnd); @@ -110,39 +122,49 @@ m.rotate(currItem->GrStrokeSkew); m.translate(radEnd * currItem->GrStrokeScale, 0); QPointF shP = m.map(QPointF(0,0)); - psx->setPen(QPen(Qt::blue, 1.0 / m_canvas->m_viewMode.scale, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin)); + psx->setPen(pens().value("node-handle")); psx->drawLine(QPointF(currItem->GrStrokeStartX, currItem->GrStrokeStartY), shP); - psx->setPen(QPen(Qt::magenta, 8.0 / m_canvas->m_viewMode.scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin)); - psx->drawPoint(shP); + drawNodeControl(psx, shP, pens().value("node"), m_canvas->m_viewMode.scale); + } - else if (m_view->editStrokeGradient == 2) + else if (m_view->editStrokeGradient == GradientEdit::Gradient_Mask) { + // Draw Start + End Nodes psx->drawLine(QPointF(currItem->GrMaskStartX, currItem->GrMaskStartY), QPointF(currItem->GrMaskEndX, currItem->GrMaskEndY)); - psx->setPen(QPen(Qt::magenta, 8.0 / m_canvas->m_viewMode.scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin)); - psx->drawPoint(QPointF(currItem->GrMaskStartX, currItem->GrMaskStartY)); - psx->drawPoint(QPointF(currItem->GrMaskEndX, currItem->GrMaskEndY)); + drawNodeHandle(psx, QPointF(currItem->GrMaskStartX, currItem->GrMaskStartY), pens().value("node"), m_canvas->m_viewMode.scale); + drawNodeHandle(psx, QPointF(currItem->GrMaskEndX, currItem->GrMaskEndY), pens().value("node"), m_canvas->m_viewMode.scale); + double radEnd = distance(currItem->GrMaskEndX - currItem->GrMaskStartX, currItem->GrMaskEndY - currItem->GrMaskStartY); double rotEnd = xy2Deg(currItem->GrMaskEndX - currItem->GrMaskStartX, currItem->GrMaskEndY - currItem->GrMaskStartY); - QTransform qmatrix; - qmatrix.translate(currItem->GrMaskStartX, currItem->GrMaskStartY); - qmatrix.rotate(rotEnd); - double mask_gradientSkew = 0.0; - if (currItem->GrMaskSkew == 90) - mask_gradientSkew = 1; - else if (currItem->GrMaskSkew == 180) - mask_gradientSkew = 0; - else if (currItem->GrMaskSkew == 270) - mask_gradientSkew = -1; - else if (currItem->GrMaskSkew == 390) - mask_gradientSkew = 0; - else - mask_gradientSkew = tan(M_PI / 180.0 * currItem->GrMaskSkew); - qmatrix.shear(mask_gradientSkew, 0); - qmatrix.translate(0, currItem->GrMaskStartY * (1.0 - currItem->GrMaskScale)); - qmatrix.translate(-currItem->GrMaskStartX, -currItem->GrMaskStartY); - qmatrix.scale(1, currItem->GrMaskScale); + + // Draw Focal Control if ((currItem->GrMask == GradMask_Radial) || (currItem->GrMask == GradMask_RadialLumAlpha)) - psx->drawPoint(qmatrix.map(QPointF(currItem->GrMaskFocalX, currItem->GrMaskFocalY))); + { + QTransform qmatrix; + qmatrix.translate(currItem->GrMaskStartX, currItem->GrMaskStartY); + qmatrix.rotate(rotEnd); + double mask_gradientSkew = 0.0; + if (currItem->GrMaskSkew == 90) + mask_gradientSkew = 1; + else if (currItem->GrMaskSkew == 180) + mask_gradientSkew = 0; + else if (currItem->GrMaskSkew == 270) + mask_gradientSkew = -1; + else if (currItem->GrMaskSkew == 360) + mask_gradientSkew = 0; + else + mask_gradientSkew = tan(M_PI / 180.0 * currItem->GrMaskSkew); + qmatrix.shear(mask_gradientSkew, 0); + qmatrix.translate(0, currItem->GrMaskStartY * (1.0 - currItem->GrMaskScale)); + qmatrix.translate(-currItem->GrMaskStartX, -currItem->GrMaskStartY); + qmatrix.scale(1, currItem->GrMaskScale); + + QPointF focal = qmatrix.map(QPointF(currItem->GrMaskFocalX, currItem->GrMaskFocalY)); + psx->setPen(pens().value("node-dash")); + psx->drawLine(QPointF(currItem->GrMaskStartX, currItem->GrMaskStartY), focal); + drawNodeControl(psx, focal, pens().value("node"), m_canvas->m_viewMode.scale); + } + // Draw Shear Control QTransform m; m.translate(currItem->GrMaskStartX, currItem->GrMaskStartY); m.rotate(rotEnd); @@ -150,42 +172,52 @@ m.rotate(currItem->GrMaskSkew); m.translate(radEnd * currItem->GrMaskScale, 0); QPointF shP = m.map(QPointF(0,0)); - psx->setPen(QPen(Qt::blue, 1.0 / m_canvas->m_viewMode.scale, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin)); + psx->setPen(pens().value("node-handle")); psx->drawLine(QPointF(currItem->GrMaskStartX, currItem->GrMaskStartY), shP); - psx->setPen(QPen(Qt::magenta, 8.0 / m_canvas->m_viewMode.scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin)); - psx->drawPoint(shP); + drawNodeControl(psx, shP, pens().value("node"), m_canvas->m_viewMode.scale); } - else if (m_view->editStrokeGradient == 0) + else if (m_view->editStrokeGradient == GradientEdit::Gradient) { + // Draw Start + End Nodes psx->drawLine(QPointF(currItem->GrStartX, currItem->GrStartY), QPointF(currItem->GrEndX, currItem->GrEndY)); - psx->setPen(QPen(Qt::magenta, 8.0 / m_canvas->m_viewMode.scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin)); - psx->drawPoint(QPointF(currItem->GrStartX, currItem->GrStartY)); - psx->drawPoint(QPointF(currItem->GrEndX, currItem->GrEndY)); + drawNodeHandle(psx, QPointF(currItem->GrStartX, currItem->GrStartY), pens().value("node"), m_canvas->m_viewMode.scale); + drawNodeHandle(psx, QPointF(currItem->GrEndX, currItem->GrEndY), pens().value("node"), m_canvas->m_viewMode.scale); + double radEnd = distance(currItem->GrEndX - currItem->GrStartX, currItem->GrEndY - currItem->GrStartY); double rotEnd = xy2Deg(currItem->GrEndX - currItem->GrStartX, currItem->GrEndY - currItem->GrStartY); - QTransform qmatrix; - qmatrix.translate(currItem->GrStartX, currItem->GrStartY); - qmatrix.rotate(rotEnd); - if (currItem->GrType != Gradient_Conical) + + // Draw Focal Control + if ((currItem->GrType == Gradient_Radial) || (currItem->GrType == Gradient_Conical)) { - double mask_gradientSkew = 0.0; - if (currItem->GrSkew == 90) - mask_gradientSkew = 1; - else if (currItem->GrSkew == 180) - mask_gradientSkew = 0; - else if (currItem->GrSkew == 270) - mask_gradientSkew = -1; - else if (currItem->GrSkew == 390) - mask_gradientSkew = 0; - else - mask_gradientSkew = tan(M_PI / 180.0 * currItem->GrSkew); - qmatrix.shear(mask_gradientSkew, 0); + QTransform qmatrix; + qmatrix.translate(currItem->GrStartX, currItem->GrStartY); + qmatrix.rotate(rotEnd); + if (currItem->GrType != Gradient_Conical) + { + double mask_gradientSkew = 0.0; + if (currItem->GrSkew == 90) + mask_gradientSkew = 1; + else if (currItem->GrSkew == 180) + mask_gradientSkew = 0; + else if (currItem->GrSkew == 270) + mask_gradientSkew = -1; + else if (currItem->GrSkew == 360) + mask_gradientSkew = 0; + else + mask_gradientSkew = tan(M_PI / 180.0 * currItem->GrSkew); + qmatrix.shear(mask_gradientSkew, 0); + } + qmatrix.translate(0, currItem->GrStartY * (1.0 - currItem->GrScale)); + qmatrix.translate(-currItem->GrStartX, -currItem->GrStartY); + qmatrix.scale(1, currItem->GrScale); + + QPointF focal = qmatrix.map(QPointF(currItem->GrFocalX, currItem->GrFocalY)); + psx->setPen(pens().value("node-dash")); + psx->drawLine(QPointF(currItem->GrStartX, currItem->GrStartY), focal); + drawNodeControl(psx, focal, pens().value("node"), m_canvas->m_viewMode.scale); } - qmatrix.translate(0, currItem->GrStartY * (1.0 - currItem->GrScale)); - qmatrix.translate(-currItem->GrStartX, -currItem->GrStartY); - qmatrix.scale(1, currItem->GrScale); - if ((currItem->GrType == Gradient_Radial) || (currItem->GrType == Gradient_Conical)) - psx->drawPoint(qmatrix.map(QPointF(currItem->GrFocalX, currItem->GrFocalY))); + + // Draw Shear Control QTransform m; m.translate(currItem->GrStartX, currItem->GrStartY); m.rotate(rotEnd); @@ -193,27 +225,25 @@ m.rotate(currItem->GrSkew); m.translate(radEnd * currItem->GrScale, 0); QPointF shP = m.map(QPointF(0,0)); - psx->setPen(QPen(Qt::blue, 1.0 / m_canvas->m_viewMode.scale, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin)); + psx->setPen(pens().value("node-handle")); psx->drawLine(QPointF(currItem->GrStartX, currItem->GrStartY), shP); - psx->setPen(QPen(Qt::magenta, 8.0 / m_canvas->m_viewMode.scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin)); - psx->drawPoint(shP); + drawNodeControl(psx, shP, pens().value("node"), m_canvas->m_viewMode.scale); + } - else if (m_view->editStrokeGradient == 3) + else if (m_view->editStrokeGradient == GradientEdit::FourColors) { - psx->setPen(QPen(Qt::magenta, 8.0 / m_canvas->m_viewMode.scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin)); - psx->drawPoint(QPointF(currItem->GrControl1.x(), currItem->GrControl1.y())); - psx->drawPoint(QPointF(currItem->GrControl2.x(), currItem->GrControl2.y())); - psx->drawPoint(QPointF(currItem->GrControl3.x(), currItem->GrControl3.y())); - psx->drawPoint(QPointF(currItem->GrControl4.x(), currItem->GrControl4.y())); + drawNodeHandle(psx, QPointF(currItem->GrControl1.x(), currItem->GrControl1.y()), pens().value("node"), m_canvas->m_viewMode.scale); + drawNodeHandle(psx, QPointF(currItem->GrControl2.x(), currItem->GrControl2.y()), pens().value("node"), m_canvas->m_viewMode.scale); + drawNodeHandle(psx, QPointF(currItem->GrControl3.x(), currItem->GrControl3.y()), pens().value("node"), m_canvas->m_viewMode.scale); + drawNodeHandle(psx, QPointF(currItem->GrControl4.x(), currItem->GrControl4.y()), pens().value("node"), m_canvas->m_viewMode.scale); } - else if (m_view->editStrokeGradient == 4) + else if (m_view->editStrokeGradient == GradientEdit::Diamond) { - psx->setPen(QPen(Qt::magenta, 8.0 / m_canvas->m_viewMode.scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin)); - psx->drawPoint(QPointF(currItem->GrControl1.x(), currItem->GrControl1.y())); - psx->drawPoint(QPointF(currItem->GrControl2.x(), currItem->GrControl2.y())); - psx->drawPoint(QPointF(currItem->GrControl3.x(), currItem->GrControl3.y())); - psx->drawPoint(QPointF(currItem->GrControl4.x(), currItem->GrControl4.y())); - psx->drawPoint(QPointF(currItem->GrControl5.x(), currItem->GrControl5.y())); + drawNodeHandle(psx, QPointF(currItem->GrControl1.x(), currItem->GrControl1.y()), pens().value("node"), m_canvas->m_viewMode.scale); + drawNodeHandle(psx, QPointF(currItem->GrControl2.x(), currItem->GrControl2.y()), pens().value("node"), m_canvas->m_viewMode.scale); + drawNodeHandle(psx, QPointF(currItem->GrControl3.x(), currItem->GrControl3.y()), pens().value("node"), m_canvas->m_viewMode.scale); + drawNodeHandle(psx, QPointF(currItem->GrControl4.x(), currItem->GrControl4.y()), pens().value("node"), m_canvas->m_viewMode.scale); + drawNodeHandle(psx, QPointF(currItem->GrControl5.x(), currItem->GrControl5.y()), pens().value("node"), m_canvas->m_viewMode.scale); } } @@ -232,7 +262,7 @@ void CanvasMode_EditGradient::activate(bool fromGesture) { -// qDebug() << "CanvasMode_EditGradient::activate" << fromGesture; + // qDebug() << "CanvasMode_EditGradient::activate" << fromGesture; CanvasMode::activate(fromGesture); m_canvas->m_viewMode.m_MouseButtonPressed = false; @@ -252,7 +282,7 @@ void CanvasMode_EditGradient::deactivate(bool forGesture) { -// qDebug() << "CanvasMode_EditGradient::deactivate" << forGesture; + // qDebug() << "CanvasMode_EditGradient::deactivate" << forGesture; m_view->setRedrawMarkerShown(false); CanvasMode::deactivate(forGesture); } @@ -272,7 +302,7 @@ m->accept(); m_canvas->m_viewMode.m_MouseButtonPressed = false; m_canvas->resetRenderMode(); -// m_view->stopDragTimer(); + // m_view->stopDragTimer(); PageItem *currItem = nullptr; if ((m_doc->m_Selection->isMultipleSelection()) || (m_doc->appMode != modeNormal)) { @@ -317,7 +347,7 @@ double newY = mousePointDoc.y(); FPoint npx(m_Mxp - newX, m_Myp - newY, 0, 0, currItem->rotation(), 1, 1, true); QPointF np(npx.x(), npx.y()); - if (m_view->editStrokeGradient == 1) + if (m_view->editStrokeGradient == GradientEdit::Gradient_Stroke) { if (m_gradientPoint == useGradientStart) { @@ -351,7 +381,7 @@ mask_gradientSkew = 0; else if (currItem->GrStrokeSkew == 270) mask_gradientSkew = -1; - else if (currItem->GrStrokeSkew == 390) + else if (currItem->GrStrokeSkew == 360) mask_gradientSkew = 0; else mask_gradientSkew = tan(M_PI / 180.0 * currItem->GrStrokeSkew); @@ -412,7 +442,7 @@ } } } - else if (m_view->editStrokeGradient == 2) + else if (m_view->editStrokeGradient == GradientEdit::Gradient_Mask) { if (m_gradientPoint == useGradientStart) { @@ -446,7 +476,7 @@ mask_gradientSkew = 0; else if (currItem->GrMaskSkew == 270) mask_gradientSkew = -1; - else if (currItem->GrMaskSkew == 390) + else if (currItem->GrMaskSkew == 360) mask_gradientSkew = 0; else mask_gradientSkew = tan(M_PI / 180.0 * currItem->GrMaskSkew); @@ -507,7 +537,7 @@ } } } - else if (m_view->editStrokeGradient == 0) + else if (m_view->editStrokeGradient == GradientEdit::Gradient) { if (m_gradientPoint == useGradientStart) { @@ -543,7 +573,7 @@ mask_gradientSkew = 0; else if (currItem->GrSkew == 270) mask_gradientSkew = -1; - else if (currItem->GrSkew == 390) + else if (currItem->GrSkew == 360) mask_gradientSkew = 0; else mask_gradientSkew = tan(M_PI / 180.0 * currItem->GrSkew); @@ -609,7 +639,7 @@ } } } - else if (m_view->editStrokeGradient == 3) + else if (m_view->editStrokeGradient == GradientEdit::FourColors) { if (m_gradientPoint == useControl1) currItem->GrControl1 -= npx; @@ -620,7 +650,7 @@ else if (m_gradientPoint == useControl4) currItem->GrControl4 -= npx; } - else if (m_view->editStrokeGradient == 4) + else if (m_view->editStrokeGradient == GradientEdit::Diamond) { if (m_gradientPoint == useControl1) currItem->GrControl1 -= npx; @@ -635,10 +665,10 @@ } m_Mxp = newX; m_Myp = newY; -// m_view->RefreshGradient(currItem, dx * m_canvas->scale(), dy * m_canvas->scale()); - m_ScMW->propertiesPalette->updateColorSpecialGradient(); + // m_view->RefreshGradient(currItem, dx * m_canvas->scale(), dy * m_canvas->scale()); + // m_ScMW->propertiesPalette->updateColorSpecialGradient(); currItem->update(); -/* QRectF upRect; + /* QRectF upRect; if (m_view->editStrokeGradient == 1) { upRect = QRectF(QPointF(currItem->GrStrokeStartX, currItem->GrStrokeStartY), QPointF(currItem->GrStrokeEndX, currItem->GrStrokeEndY)); @@ -728,7 +758,7 @@ PageItem *currItem = m_doc->m_Selection->itemAt(0); QTransform itemMatrix = currItem->getTransform(); QPointF gradientStart, gradientEnd, gradientFocal, gradientScale, gradientCenter; - if (m_view->editStrokeGradient == 1) + if (m_view->editStrokeGradient == GradientEdit::Gradient_Stroke) { gradientStart = QPointF(currItem->GrStrokeStartX, currItem->GrStrokeStartY); gradientEnd = QPointF(currItem->GrStrokeEndX, currItem->GrStrokeEndY); @@ -751,7 +781,7 @@ mask_gradientSkew = 0; else if (currItem->GrStrokeSkew == 270) mask_gradientSkew = -1; - else if (currItem->GrStrokeSkew == 390) + else if (currItem->GrStrokeSkew == 360) mask_gradientSkew = 0; else mask_gradientSkew = tan(M_PI / 180.0 * currItem->GrStrokeSkew); @@ -761,7 +791,7 @@ qmatrix.scale(1, currItem->GrStrokeScale); gradientFocal = qmatrix.map(QPointF(currItem->GrStrokeFocalX, currItem->GrStrokeFocalY)); } - else if (m_view->editStrokeGradient == 2) + else if (m_view->editStrokeGradient == GradientEdit::Gradient_Mask) { gradientStart = QPointF(currItem->GrMaskStartX, currItem->GrMaskStartY); gradientEnd = QPointF(currItem->GrMaskEndX, currItem->GrMaskEndY); @@ -784,7 +814,7 @@ mask_gradientSkew = 0; else if (currItem->GrMaskSkew == 270) mask_gradientSkew = -1; - else if (currItem->GrMaskSkew == 390) + else if (currItem->GrMaskSkew == 360) mask_gradientSkew = 0; else mask_gradientSkew = tan(M_PI / 180.0 * currItem->GrMaskSkew); @@ -794,7 +824,7 @@ qmatrix.scale(1, currItem->GrMaskScale); gradientFocal = qmatrix.map(QPointF(currItem->GrMaskFocalX, currItem->GrMaskFocalY)); } - else if (m_view->editStrokeGradient == 0) + else if (m_view->editStrokeGradient == GradientEdit::Gradient) { gradientStart = QPointF(currItem->GrStartX, currItem->GrStartY); gradientEnd = QPointF(currItem->GrEndX, currItem->GrEndY); @@ -819,7 +849,7 @@ mask_gradientSkew = 0; else if (currItem->GrSkew == 270) mask_gradientSkew = -1; - else if (currItem->GrSkew == 390) + else if (currItem->GrSkew == 360) mask_gradientSkew = 0; else mask_gradientSkew = tan(M_PI / 180.0 * currItem->GrSkew); @@ -830,7 +860,7 @@ qmatrix.scale(1, currItem->GrScale); gradientFocal = qmatrix.map(QPointF(currItem->GrFocalX, currItem->GrFocalY)); } - else if (m_view->editStrokeGradient == 3) + else if (m_view->editStrokeGradient == GradientEdit::FourColors) { gradientStart = QPointF(currItem->GrControl1.x(), currItem->GrControl1.y()); gradientEnd = QPointF(currItem->GrControl2.x(), currItem->GrControl2.y()); @@ -837,7 +867,7 @@ gradientFocal = QPointF(currItem->GrControl3.x(), currItem->GrControl3.y()); gradientScale = QPointF(currItem->GrControl4.x(), currItem->GrControl4.y()); } - else if (m_view->editStrokeGradient == 4) + else if (m_view->editStrokeGradient == GradientEdit::Diamond) { gradientStart = QPointF(currItem->GrControl1.x(), currItem->GrControl1.y()); gradientEnd = QPointF(currItem->GrControl2.x(), currItem->GrControl2.y()); @@ -850,7 +880,7 @@ gradientFocal = itemMatrix.map(gradientFocal); gradientScale = itemMatrix.map(gradientScale); gradientCenter = itemMatrix.map(gradientCenter); - if (m_view->editStrokeGradient == 3) + if (m_view->editStrokeGradient == GradientEdit::FourColors) { if (m_canvas->hitsCanvasPoint(m->globalPosition(), gradientStart)) m_gradientPoint = useControl1; @@ -861,7 +891,7 @@ else if (m_canvas->hitsCanvasPoint(m->globalPosition(), gradientScale)) m_gradientPoint = useControl4; } - else if (m_view->editStrokeGradient == 4) + else if (m_view->editStrokeGradient == GradientEdit::Diamond) { if (m_canvas->hitsCanvasPoint(m->globalPosition(), gradientStart)) m_gradientPoint = useControl1; @@ -996,5 +1026,5 @@ undoManager->action(currItem, is); } m_gradientPoint = noPointDefined; -// m_view->stopDragTimer(); + // m_view->stopDragTimer(); } Index: scribus/canvasmode_editmeshgradient.cpp =================================================================== --- scribus/canvasmode_editmeshgradient.cpp (Revision 26070) +++ scribus/canvasmode_editmeshgradient.cpp (Arbeitskopie) @@ -87,16 +87,18 @@ void CanvasMode_EditMeshGradient::drawControlsMeshGradient(QPainter* psx, PageItem* currItem) { - QPen p1b = QPen(Qt::blue, 1.0 / m_canvas->m_viewMode.scale, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin); - QPen p1bd = QPen(Qt::blue, 1.0 / m_canvas->m_viewMode.scale, Qt::DotLine, Qt::FlatCap, Qt::MiterJoin); - QPen p8b = QPen(Qt::blue, 8.0 / m_canvas->m_viewMode.scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin); - QPen p8r = QPen(Qt::red, 8.0 / m_canvas->m_viewMode.scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin); - QPen p8m = QPen(Qt::magenta, 8.0 / m_canvas->m_viewMode.scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin); - QPen p14r = QPen(Qt::red, 18.0 / m_canvas->m_viewMode.scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin); - QPen p14w = QPen(Qt::white, 18.0 / m_canvas->m_viewMode.scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin); +// QPen p14r = QPen(Qt::red, 18.0 / m_canvas->m_viewMode.scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin); +// QPen p14w = QPen(Qt::white, 18.0 / m_canvas->m_viewMode.scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin); + qreal scale = m_canvas->m_viewMode.scale; + + psx->save(); + psx->setRenderHint(QPainter::Antialiasing); + psx->setTransform(currItem->getTransform(), true); - psx->setPen(p1b); + psx->setPen(pens().value("vector")); psx->setBrush(Qt::NoBrush); + + // Draw Vector Path for (int grow = 0; grow < currItem->meshGradientArray.count()-1; grow++) { for (int gcol = 0; gcol < currItem->meshGradientArray[grow].count()-1; gcol++) @@ -111,107 +113,46 @@ Bez.cubicTo(mp2.controlBottom.x(), mp2.controlBottom.y(), mp3.controlTop.x(), mp3.controlTop.y(), mp3.gridPoint.x(), mp3.gridPoint.y()); Bez.cubicTo(mp3.controlLeft.x(), mp3.controlLeft.y(), mp4.controlRight.x(), mp4.controlRight.y(), mp4.gridPoint.x(), mp4.gridPoint.y()); Bez.cubicTo(mp4.controlTop.x(), mp4.controlTop.y(), mp1.controlBottom.x(), mp1.controlBottom.y(), mp1.gridPoint.x(), mp1.gridPoint.y()); - psx->setPen(p1b); psx->drawPath(Bez); } } - for (int grow = 0; grow < currItem->meshGradientArray.count(); grow++) + + // Draw Node Controls + if ((m_selectedMeshPoints.count() > 0) && (m_view->editStrokeGradient == GradientEdit::Mesh_ControlPoints)) { - for (int gcol = 0; gcol < currItem->meshGradientArray[grow].count(); gcol++) - { - bool isSelected = false; - for (int se = 0; se < m_selectedMeshPoints.count(); se++) - { - if ((grow == m_selectedMeshPoints[se].first) && (gcol == m_selectedMeshPoints[se].second)) - { - isSelected = true; - break; - } - } - MeshPoint mp1 = currItem->meshGradientArray[grow][gcol]; - if (m_view->editStrokeGradient == 5) - { - if (isSelected) - psx->setPen(p8r); - else - psx->setPen(p8m); - psx->drawPoint(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y())); - } - else if (m_view->editStrokeGradient == 6) - { - if (isSelected) - psx->setPen(p14r); - else - psx->setPen(p14w); - psx->drawPoint(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y())); - psx->setPen(QPen(mp1.color, 14.0 / m_canvas->m_viewMode.scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin)); - psx->drawPoint(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y())); - if (isSelected) - psx->setPen(p8r); - else - psx->setPen(p8m); - psx->drawPoint(QPointF(mp1.controlColor.x(), mp1.controlColor.y())); - } - else if (m_view->editStrokeGradient == 7) - { - psx->setPen(p8b); - psx->drawPoint(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y())); - } - } - } - if ((m_selectedMeshPoints.count() > 0) && (m_view->editStrokeGradient == 7)) - { int grow = m_selectedMeshPoints[0].first; int gcol = m_selectedMeshPoints[0].second; MeshPoint mp1 = currItem->meshGradientArray[grow][gcol]; - psx->setPen(p8m); if (grow == 0) { if (gcol == 0) { - psx->setPen(p1bd); + psx->setPen(pens().value("node-handle")); psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlBottom.x(), mp1.controlBottom.y())); psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlRight.x(), mp1.controlRight.y())); - psx->setPen(p8m); - if (m_gradientPoint == useControlR) - psx->setPen(p8r); - psx->drawPoint(QPointF(mp1.controlRight.x(), mp1.controlRight.y())); - psx->setPen(p8m); - if (m_gradientPoint == useControlB) - psx->setPen(p8r); - psx->drawPoint(QPointF(mp1.controlBottom.x(), mp1.controlBottom.y())); + + drawNodeControl(psx, QPointF(mp1.controlRight.x(), mp1.controlRight.y()), pens().value("node"), scale, m_gradientPoint == useControlR); + drawNodeControl(psx, QPointF(mp1.controlBottom.x(), mp1.controlBottom.y()), pens().value("node"), scale, m_gradientPoint == useControlB); } else if (gcol == currItem->meshGradientArray[grow].count()-1) { - psx->setPen(p1bd); + psx->setPen(pens().value("node-handle")); psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlBottom.x(), mp1.controlBottom.y())); psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlLeft.x(), mp1.controlLeft.y())); - psx->setPen(p8m); - if (m_gradientPoint == useControlL) - psx->setPen(p8r); - psx->drawPoint(QPointF(mp1.controlLeft.x(), mp1.controlLeft.y())); - psx->setPen(p8m); - if (m_gradientPoint == useControlB) - psx->setPen(p8r); - psx->drawPoint(QPointF(mp1.controlBottom.x(), mp1.controlBottom.y())); + + drawNodeControl(psx, QPointF(mp1.controlLeft.x(), mp1.controlLeft.y()), pens().value("node"), scale, m_gradientPoint == useControlL); + drawNodeControl(psx, QPointF(mp1.controlBottom.x(), mp1.controlBottom.y()), pens().value("node"), scale, m_gradientPoint == useControlB); } else { - psx->setPen(p1bd); + psx->setPen(pens().value("node-handle")); psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlBottom.x(), mp1.controlBottom.y())); psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlLeft.x(), mp1.controlLeft.y())); psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlRight.x(), mp1.controlRight.y())); - psx->setPen(p8m); - if (m_gradientPoint == useControlL) - psx->setPen(p8r); - psx->drawPoint(QPointF(mp1.controlLeft.x(), mp1.controlLeft.y())); - psx->setPen(p8m); - if (m_gradientPoint == useControlB) - psx->setPen(p8r); - psx->drawPoint(QPointF(mp1.controlBottom.x(), mp1.controlBottom.y())); - if (m_gradientPoint == useControlR) - psx->setPen(p8r); - psx->drawPoint(QPointF(mp1.controlRight.x(), mp1.controlRight.y())); + + drawNodeControl(psx, QPointF(mp1.controlLeft.x(), mp1.controlLeft.y()), pens().value("node"), scale, m_gradientPoint == useControlL); + drawNodeControl(psx, QPointF(mp1.controlBottom.x(), mp1.controlBottom.y()), pens().value("node"), scale, m_gradientPoint == useControlB); + drawNodeControl(psx, QPointF(mp1.controlRight.x(), mp1.controlRight.y()), pens().value("node"), scale, m_gradientPoint == useControlR); } } else if (grow == currItem->meshGradientArray.count()-1) @@ -218,49 +159,32 @@ { if (gcol == 0) { - psx->setPen(p1bd); + psx->setPen(pens().value("node-handle")); psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlTop.x(), mp1.controlTop.y())); psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlRight.x(), mp1.controlRight.y())); - psx->setPen(p8m); - if (m_gradientPoint == useControlR) - psx->setPen(p8r); - psx->drawPoint(QPointF(mp1.controlRight.x(), mp1.controlRight.y())); - psx->setPen(p8m); - if (m_gradientPoint == useControlT) - psx->setPen(p8r); - psx->drawPoint(QPointF(mp1.controlTop.x(), mp1.controlTop.y())); + + drawNodeControl(psx, QPointF(mp1.controlRight.x(), mp1.controlRight.y()), pens().value("node"), scale, m_gradientPoint == useControlR); + drawNodeControl(psx, QPointF(mp1.controlTop.x(), mp1.controlTop.y()), pens().value("node"), scale, m_gradientPoint == useControlT); } else if (gcol == currItem->meshGradientArray[grow].count()-1) { - psx->setPen(p1bd); + psx->setPen(pens().value("node-handle")); psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlTop.x(), mp1.controlTop.y())); psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlLeft.x(), mp1.controlLeft.y())); - psx->setPen(p8m); - if (m_gradientPoint == useControlL) - psx->setPen(p8r); - psx->drawPoint(QPointF(mp1.controlLeft.x(), mp1.controlLeft.y())); - psx->setPen(p8m); - if (m_gradientPoint == useControlT) - psx->setPen(p8r); - psx->drawPoint(QPointF(mp1.controlTop.x(), mp1.controlTop.y())); + + drawNodeControl(psx, QPointF(mp1.controlLeft.x(), mp1.controlLeft.y()), pens().value("node"), scale, m_gradientPoint == useControlL); + drawNodeControl(psx, QPointF(mp1.controlTop.x(), mp1.controlTop.y()), pens().value("node"), scale, m_gradientPoint == useControlT); } else { - psx->setPen(p1bd); + psx->setPen(pens().value("node-handle")); psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlTop.x(), mp1.controlTop.y())); psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlLeft.x(), mp1.controlLeft.y())); psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlRight.x(), mp1.controlRight.y())); - psx->setPen(p8m); - if (m_gradientPoint == useControlL) - psx->setPen(p8r); - psx->drawPoint(QPointF(mp1.controlLeft.x(), mp1.controlLeft.y())); - psx->setPen(p8m); - if (m_gradientPoint == useControlT) - psx->setPen(p8r); - psx->drawPoint(QPointF(mp1.controlTop.x(), mp1.controlTop.y())); - if (m_gradientPoint == useControlR) - psx->setPen(p8r); - psx->drawPoint(QPointF(mp1.controlRight.x(), mp1.controlRight.y())); + + drawNodeControl(psx, QPointF(mp1.controlLeft.x(), mp1.controlLeft.y()), pens().value("node"), scale, m_gradientPoint == useControlL); + drawNodeControl(psx, QPointF(mp1.controlTop.x(), mp1.controlTop.y()), pens().value("node"), scale, m_gradientPoint == useControlT); + drawNodeControl(psx, QPointF(mp1.controlRight.x(), mp1.controlRight.y()), pens().value("node"), scale, m_gradientPoint == useControlR); } } else @@ -267,68 +191,85 @@ { if (gcol == 0) { - psx->setPen(p1bd); + psx->setPen(pens().value("node-handle")); psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlTop.x(), mp1.controlTop.y())); psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlBottom.x(), mp1.controlBottom.y())); psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlRight.x(), mp1.controlRight.y())); - psx->setPen(p8m); - if (m_gradientPoint == useControlR) - psx->setPen(p8r); - psx->drawPoint(QPointF(mp1.controlRight.x(), mp1.controlRight.y())); - psx->setPen(p8m); - if (m_gradientPoint == useControlT) - psx->setPen(p8r); - psx->drawPoint(QPointF(mp1.controlTop.x(), mp1.controlTop.y())); - psx->setPen(p8m); - if (m_gradientPoint == useControlB) - psx->setPen(p8r); - psx->drawPoint(QPointF(mp1.controlBottom.x(), mp1.controlBottom.y())); + + drawNodeControl(psx, QPointF(mp1.controlRight.x(), mp1.controlRight.y()), pens().value("node"), scale, m_gradientPoint == useControlR); + drawNodeControl(psx, QPointF(mp1.controlTop.x(), mp1.controlTop.y()), pens().value("node"), scale, m_gradientPoint == useControlT); + drawNodeControl(psx, QPointF(mp1.controlBottom.x(), mp1.controlBottom.y()), pens().value("node"), scale, m_gradientPoint == useControlB); } else if (gcol == currItem->meshGradientArray[grow].count()-1) { - psx->setPen(p1bd); + psx->setPen(pens().value("node-handle")); psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlTop.x(), mp1.controlTop.y())); psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlBottom.x(), mp1.controlBottom.y())); psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlLeft.x(), mp1.controlLeft.y())); - psx->setPen(p8m); - if (m_gradientPoint == useControlL) - psx->setPen(p8r); - psx->drawPoint(QPointF(mp1.controlLeft.x(), mp1.controlLeft.y())); - psx->setPen(p8m); - if (m_gradientPoint == useControlT) - psx->setPen(p8r); - psx->drawPoint(QPointF(mp1.controlTop.x(), mp1.controlTop.y())); - psx->setPen(p8m); - if (m_gradientPoint == useControlB) - psx->setPen(p8r); - psx->drawPoint(QPointF(mp1.controlBottom.x(), mp1.controlBottom.y())); + + drawNodeControl(psx, QPointF(mp1.controlLeft.x(), mp1.controlLeft.y()), pens().value("node"), scale, m_gradientPoint == useControlL); + drawNodeControl(psx, QPointF(mp1.controlTop.x(), mp1.controlTop.y()), pens().value("node"), scale, m_gradientPoint == useControlT); + drawNodeControl(psx, QPointF(mp1.controlBottom.x(), mp1.controlBottom.y()), pens().value("node"), scale, m_gradientPoint == useControlB); } else { - psx->setPen(p1bd); + psx->setPen(pens().value("node-handle")); psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlTop.x(), mp1.controlTop.y())); psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlBottom.x(), mp1.controlBottom.y())); psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlLeft.x(), mp1.controlLeft.y())); psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlRight.x(), mp1.controlRight.y())); - psx->setPen(p8m); - if (m_gradientPoint == useControlL) - psx->setPen(p8r); - psx->drawPoint(QPointF(mp1.controlLeft.x(), mp1.controlLeft.y())); - psx->setPen(p8m); - if (m_gradientPoint == useControlT) - psx->setPen(p8r); - psx->drawPoint(QPointF(mp1.controlTop.x(), mp1.controlTop.y())); - psx->setPen(p8m); - if (m_gradientPoint == useControlB) - psx->setPen(p8r); - psx->drawPoint(QPointF(mp1.controlBottom.x(), mp1.controlBottom.y())); - psx->setPen(p8m); - if (m_gradientPoint == useControlR) - psx->setPen(p8r); - psx->drawPoint(QPointF(mp1.controlRight.x(), mp1.controlRight.y())); + + drawNodeControl(psx, QPointF(mp1.controlLeft.x(), mp1.controlLeft.y()), pens().value("node"), scale, m_gradientPoint == useControlL); + drawNodeControl(psx, QPointF(mp1.controlTop.x(), mp1.controlTop.y()), pens().value("node"), scale, m_gradientPoint == useControlT); + drawNodeControl(psx, QPointF(mp1.controlBottom.x(), mp1.controlBottom.y()), pens().value("node"), scale, m_gradientPoint == useControlB); + drawNodeControl(psx, QPointF(mp1.controlRight.x(), mp1.controlRight.y()), pens().value("node"), scale, m_gradientPoint == useControlR); } } } + + if (currItem->rotation() == 0 || currItem->rotation() == 90 || currItem->rotation() == 180 || currItem->rotation() == 270) + psx->setRenderHint(QPainter::Antialiasing, false); + + // Draw Nodes + for (int grow = 0; grow < currItem->meshGradientArray.count(); grow++) + { + for (int gcol = 0; gcol < currItem->meshGradientArray[grow].count(); gcol++) + { + bool isSelected = false; + for (int se = 0; se < m_selectedMeshPoints.count(); se++) + { + if ((grow == m_selectedMeshPoints[se].first) && (gcol == m_selectedMeshPoints[se].second)) + { + isSelected = true; + break; + } + } + MeshPoint mp1 = currItem->meshGradientArray[grow][gcol]; + if (m_view->editStrokeGradient == GradientEdit::Mesh_Point) + drawNodeHandle(psx, QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), pens().value("node"), scale, isSelected); +// else if (m_view->editStrokeGradient == GradientEdit::Mesh_Color) +// { +// if (isSelected) +// psx->setPen(p14r); +// else +// psx->setPen(p14w); +// psx->drawPoint(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y())); +// psx->setPen(QPen(mp1.color, 14.0 / m_canvas->m_viewMode.scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin)); +// psx->drawPoint(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y())); +// if (isSelected) +// psx->setPen(p8r); +// else +// psx->setPen(p8m); +// psx->drawPoint(QPointF(mp1.controlColor.x(), mp1.controlColor.y())); +// } + else if (m_view->editStrokeGradient == GradientEdit::Mesh_ControlPoints) + { + drawNodeHandle(psx, QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), pens().value("node"), scale); + } + } + } + + psx->restore(); } void CanvasMode_EditMeshGradient::enterEvent(QEvent *e) @@ -370,7 +311,7 @@ m_view->setRedrawMarkerShown(false); m_selectedMeshPoints.clear(); m_gradientPoint = noPointDefined; - m_ScMW->propertiesPalette->updateColorSpecialGradient(); +// m_ScMW->propertiesPalette->updateColorSpecialGradient(); CanvasMode::deactivate(forGesture); } @@ -454,13 +395,13 @@ doUpdate = true; break; case Qt::Key_5: - if (m_view->editStrokeGradient == 6) + if (m_view->editStrokeGradient == GradientEdit::Mesh_Color) { QPair<int, int> selP = m_selectedMeshPoints[0]; currItem->meshGradientArray[selP.first][selP.second].controlColor = currItem->meshGradientArray[selP.first][selP.second].gridPoint; doUpdate = true; } - else if (m_view->editStrokeGradient == 7) + else if (m_view->editStrokeGradient == GradientEdit::Mesh_ControlPoints) { QPair<int, int> selP = m_selectedMeshPoints[0]; if (m_gradientPoint == useControlT) @@ -477,7 +418,7 @@ } if (isMoving) { - if (m_view->editStrokeGradient == 5) + if (m_view->editStrokeGradient == GradientEdit::Mesh_Point) { for (int mo = 0; mo < m_selectedMeshPoints.count(); mo++) { @@ -485,12 +426,12 @@ currItem->meshGradientArray[selP.first][selP.second].moveRel(moveX, moveY); } } - else if (m_view->editStrokeGradient == 6) + else if (m_view->editStrokeGradient == GradientEdit::Mesh_Color) { QPair<int, int> selP = m_selectedMeshPoints[0]; currItem->meshGradientArray[selP.first][selP.second].controlColor += FPoint(moveX, moveY); } - else if (m_view->editStrokeGradient == 7) + else if (m_view->editStrokeGradient == GradientEdit::Mesh_ControlPoints) { QPair<int, int> selP = m_selectedMeshPoints[0]; if (m_gradientPoint == useControlT) @@ -569,7 +510,7 @@ PageItem *currItem = m_doc->m_Selection->itemAt(0); QTransform pp = currItem->getTransform(); FPoint npf = npfN.transformPoint(pp, true); - if (m_view->editStrokeGradient == 6) + if (m_view->editStrokeGradient == GradientEdit::Mesh_Color) { if (m_selectedMeshPoints.count() > 0) { @@ -584,7 +525,7 @@ FPoint npx(m_Mxp - npfN.x(), m_Myp - npfN.y(), 0, 0, currItem->rotation(), 1, 1, true); if (m_selectedMeshPoints.count() > 0) { - if (m_view->editStrokeGradient == 5) + if (m_view->editStrokeGradient == GradientEdit::Mesh_Point) { for (int mo = 0; mo < m_selectedMeshPoints.count(); mo++) { @@ -592,12 +533,12 @@ currItem->meshGradientArray[selP.first][selP.second].moveRel(-npx.x(), -npx.y()); } } - else if (m_view->editStrokeGradient == 6) + else if (m_view->editStrokeGradient == GradientEdit::Mesh_Color) { QPair<int, int> selP = m_selectedMeshPoints[0]; currItem->meshGradientArray[selP.first][selP.second].controlColor -= npx; } - else if (m_view->editStrokeGradient == 7) + else if (m_view->editStrokeGradient == GradientEdit::Mesh_ControlPoints) { QPair<int, int> selP = m_selectedMeshPoints[0]; if (m_gradientPoint == useControlT) @@ -643,9 +584,31 @@ QTransform itemMatrix = currItem->getTransform(); bool found = false; QPair<int, int> selPoint; - if (m_view->editStrokeGradient == 5) + if (m_view->editStrokeGradient == GradientEdit::Mesh_Point) { +// m_gradientPoint = noPointDefined; +// for (int grow = 0; grow < currItem->meshGradientArray.count(); grow++) +// { +// for (int gcol = 0; gcol < currItem->meshGradientArray[grow].count(); gcol++) +// { +// MeshPoint mp = currItem->meshGradientArray[grow][gcol]; +// QPointF gradientPoint(mp.gridPoint.x(), mp.gridPoint.y()); +// gradientPoint = itemMatrix.map(gradientPoint); +// if (m_canvas->hitsCanvasPoint(mousePointDoc, gradientPoint)) +// { +// selPoint.first = grow; +// selPoint.second = gcol; +// found = true; +// *m_old_mesh = mp; +// break; +// } +// } +// if (found) +// break; +// } + m_gradientPoint = noPointDefined; + m_selectedMeshPoints.clear(); for (int grow = 0; grow < currItem->meshGradientArray.count(); grow++) { for (int gcol = 0; gcol < currItem->meshGradientArray[grow].count(); gcol++) @@ -653,12 +616,16 @@ MeshPoint mp = currItem->meshGradientArray[grow][gcol]; QPointF gradientPoint(mp.gridPoint.x(), mp.gridPoint.y()); gradientPoint = itemMatrix.map(gradientPoint); - if (m_canvas->hitsCanvasPoint(mousePointDoc, gradientPoint)) + QPointF gradientColorPoint(mp.controlColor.x(), mp.controlColor.y()); + gradientColorPoint = itemMatrix.map(gradientColorPoint); + if (m_canvas->hitsCanvasPoint(mousePointDoc, gradientPoint) || m_canvas->hitsCanvasPoint(mousePointDoc, gradientColorPoint)) { selPoint.first = grow; selPoint.second = gcol; + currItem->selectedMeshPointX = grow; + currItem->selectedMeshPointY = gcol; + *m_old_mesh = mp; found = true; - *m_old_mesh = mp; break; } } @@ -666,7 +633,7 @@ break; } } - else if (m_view->editStrokeGradient == 6) + else if (m_view->editStrokeGradient == GradientEdit::Mesh_Color) { m_gradientPoint = noPointDefined; m_selectedMeshPoints.clear(); @@ -694,7 +661,7 @@ break; } } - else if (m_view->editStrokeGradient == 7) + else if (m_view->editStrokeGradient == GradientEdit::Mesh_ControlPoints) { for (int grow = 0; grow < currItem->meshGradientArray.count(); grow++) { @@ -947,7 +914,7 @@ currItem->selectedMeshControlPoint = static_cast<int>(m_gradientPoint); } m_canvas->m_viewMode.m_MouseButtonPressed = true; - m_ScMW->propertiesPalette->updateColorSpecialGradient(); +// m_ScMW->propertiesPalette->updateColorSpecialGradient(); m_view->setCursor(QCursor(Qt::CrossCursor)); m_doc->regionsChanged()->update(itemMatrix.mapRect(QRectF(0, 0, currItem->width(), currItem->height())).adjusted(-currItem->width() / 2.0, -currItem->height() / 2.0, currItem->width(), currItem->height())); } Index: scribus/canvasmode_editmeshpatch.cpp =================================================================== --- scribus/canvasmode_editmeshpatch.cpp (Revision 26070) +++ scribus/canvasmode_editmeshpatch.cpp (Arbeitskopie) @@ -86,11 +86,13 @@ void CanvasMode_EditMeshPatch::drawControlsMeshPoint(QPainter* psx, const MeshPoint& mp, bool isSelected) { - QPen p8r = QPen(Qt::red, 8.0 / m_canvas->m_viewMode.scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin); - QPen p8m = QPen(Qt::magenta, 8.0 / m_canvas->m_viewMode.scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin); - QPen p14r = QPen(Qt::red, 18.0 / m_canvas->m_viewMode.scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin); - QPen p14w = QPen(Qt::white, 18.0 / m_canvas->m_viewMode.scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin); - if (m_view->editStrokeGradient == 8) +// QPen p14r = QPen(Qt::red, 18.0 / m_canvas->m_viewMode.scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin); +// QPen p14w = QPen(Qt::white, 18.0 / m_canvas->m_viewMode.scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin); + qreal scale = m_canvas->m_viewMode.scale; + + drawNodeHandle(psx, QPointF(mp.gridPoint.x(), mp.gridPoint.y()), pens().value("node"), scale, isSelected); + +/* if (m_view->editStrokeGradient == GradientEdit::PatchMesh_Color) { if (isSelected) psx->setPen(p14r); @@ -105,29 +107,29 @@ psx->setPen(p8m); psx->drawPoint(QPointF(mp.controlColor.x(), mp.controlColor.y())); } - else if (m_view->editStrokeGradient == 9) + else */if (m_view->editStrokeGradient == GradientEdit::PatchMesh_Point) { - if (isSelected) - psx->setPen(p8r); - else - psx->setPen(p8m); - psx->drawPoint(QPointF(mp.gridPoint.x(), mp.gridPoint.y())); +// if (isSelected) +// psx->setPen(p8r); +// else +// psx->setPen(p8m); +// psx->drawPoint(QPointF(mp.gridPoint.x(), mp.gridPoint.y())); + + } } void CanvasMode_EditMeshPatch::drawControlsMeshPatch(QPainter* psx, PageItem* currItem) { - QPen p1b = QPen(Qt::blue, 1.0 / m_canvas->m_viewMode.scale, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin); - QPen p1bd = QPen(Qt::blue, 1.0 / m_canvas->m_viewMode.scale, Qt::DotLine, Qt::FlatCap, Qt::MiterJoin); -// QPen p8b = QPen(Qt::blue, 8.0 / m_canvas->m_viewMode.scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin); - QPen p8r = QPen(Qt::red, 8.0 / m_canvas->m_viewMode.scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin); - QPen p8m = QPen(Qt::magenta, 8.0 / m_canvas->m_viewMode.scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin); -// QPen p14r = QPen(Qt::red, 18.0 / m_canvas->m_viewMode.scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin); -// QPen p14w = QPen(Qt::white, 18.0 / m_canvas->m_viewMode.scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin); + qreal scale = m_canvas->m_viewMode.scale; + + psx->save(); psx->setTransform(currItem->getTransform(), true); - psx->setPen(p1b); + psx->setRenderHint(QPainter::Antialiasing); + psx->setPen(pens().value("vector")); psx->setBrush(Qt::NoBrush); + // Draw Vector Path for (int col = 0; col < currItem->meshGradientPatches.count(); col++) { meshGradientPatch patch = currItem->meshGradientPatches[col]; @@ -143,10 +145,11 @@ Bez.cubicTo(mp2.controlBottom.x(), mp2.controlBottom.y(), mp3.controlTop.x(), mp3.controlTop.y(), mp3.gridPoint.x(), mp3.gridPoint.y()); Bez.cubicTo(mp3.controlLeft.x(), mp3.controlLeft.y(), mp4.controlRight.x(), mp4.controlRight.y(), mp4.gridPoint.x(), mp4.gridPoint.y()); Bez.cubicTo(mp4.controlTop.x(), mp4.controlTop.y(), mp1.controlBottom.x(), mp1.controlBottom.y(), mp1.gridPoint.x(), mp1.gridPoint.y()); - psx->setPen(p1b); psx->drawPath(Bez); } } + + // Draw Selected Patch Mesh if (currItem->selectedMeshPointX >= 0) { meshGradientPatch patch = currItem->meshGradientPatches[currItem->selectedMeshPointX]; @@ -154,108 +157,92 @@ MeshPoint mp2 = patch.TR; MeshPoint mp3 = patch.BR; MeshPoint mp4 = patch.BL; - QPainterPath Bez; - Bez.moveTo(mp1.gridPoint.x(), mp1.gridPoint.y()); - Bez.cubicTo(mp1.controlRight.x(), mp1.controlRight.y(), mp2.controlLeft.x(), mp2.controlLeft.y(), mp2.gridPoint.x(), mp2.gridPoint.y()); - Bez.cubicTo(mp2.controlBottom.x(), mp2.controlBottom.y(), mp3.controlTop.x(), mp3.controlTop.y(), mp3.gridPoint.x(), mp3.gridPoint.y()); - Bez.cubicTo(mp3.controlLeft.x(), mp3.controlLeft.y(), mp4.controlRight.x(), mp4.controlRight.y(), mp4.gridPoint.x(), mp4.gridPoint.y()); - Bez.cubicTo(mp4.controlTop.x(), mp4.controlTop.y(), mp1.controlBottom.x(), mp1.controlBottom.y(), mp1.gridPoint.x(), mp1.gridPoint.y()); - psx->setPen(QPen(Qt::red, 1.0 / m_canvas->m_viewMode.scale, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin)); - psx->drawPath(Bez); - drawControlsMeshPoint(psx, mp1, m_patchPoint == useTL); - drawControlsMeshPoint(psx, mp2, m_patchPoint == useTR); - drawControlsMeshPoint(psx, mp3, m_patchPoint == useBR); - drawControlsMeshPoint(psx, mp4, m_patchPoint == useBL); - if (m_view->editStrokeGradient == 10) + + // Draw Node Controls + if (m_view->editStrokeGradient == GradientEdit::PatchMesh_ControlPoints) { if (m_patchPoint == useTL) { - psx->setPen(p1bd); + psx->setPen(pens().value("node-handle")); psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlBottom.x(), mp1.controlBottom.y())); psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlRight.x(), mp1.controlRight.y())); - if (m_gradientPoint == useControlB) - psx->setPen(p8r); - else - psx->setPen(p8m); - psx->drawPoint(QPointF(mp1.controlBottom.x(), mp1.controlBottom.y())); - if (m_gradientPoint == useControlR) - psx->setPen(p8r); - else - psx->setPen(p8m); - psx->drawPoint(QPointF(mp1.controlRight.x(), mp1.controlRight.y())); + + drawNodeControl(psx, QPointF(mp1.controlBottom.x(), mp1.controlBottom.y()), pens().value("node"), scale, m_gradientPoint == useControlB); + drawNodeControl(psx, QPointF(mp1.controlRight.x(), mp1.controlRight.y()), pens().value("node"), scale, m_gradientPoint == useControlR); } else if (m_patchPoint == useTR) { - psx->setPen(p1bd); + psx->setPen(pens().value("node-handle")); psx->drawLine(QPointF(mp2.gridPoint.x(), mp2.gridPoint.y()), QPointF(mp2.controlBottom.x(), mp2.controlBottom.y())); psx->drawLine(QPointF(mp2.gridPoint.x(), mp2.gridPoint.y()), QPointF(mp2.controlLeft.x(), mp2.controlLeft.y())); - if (m_gradientPoint == useControlL) - psx->setPen(p8r); - else - psx->setPen(p8m); - psx->drawPoint(QPointF(mp2.controlLeft.x(), mp2.controlLeft.y())); - if (m_gradientPoint == useControlB) - psx->setPen(p8r); - else - psx->setPen(p8m); - psx->drawPoint(QPointF(mp2.controlBottom.x(), mp2.controlBottom.y())); + + drawNodeControl(psx, QPointF(mp2.controlLeft.x(), mp2.controlLeft.y()), pens().value("node"), scale, m_gradientPoint == useControlL); + drawNodeControl(psx, QPointF(mp2.controlBottom.x(), mp2.controlBottom.y()), pens().value("node"), scale, m_gradientPoint == useControlB); } else if (m_patchPoint == useBR) { - psx->setPen(p1bd); + psx->setPen(pens().value("node-handle")); psx->drawLine(QPointF(mp3.gridPoint.x(), mp3.gridPoint.y()), QPointF(mp3.controlTop.x(), mp3.controlTop.y())); psx->drawLine(QPointF(mp3.gridPoint.x(), mp3.gridPoint.y()), QPointF(mp3.controlLeft.x(), mp3.controlLeft.y())); - if (m_gradientPoint == useControlL) - psx->setPen(p8r); - else - psx->setPen(p8m); - psx->drawPoint(QPointF(mp3.controlLeft.x(), mp3.controlLeft.y())); - if (m_gradientPoint == useControlT) - psx->setPen(p8r); - else - psx->setPen(p8m); - psx->drawPoint(QPointF(mp3.controlTop.x(), mp3.controlTop.y())); + + drawNodeControl(psx, QPointF(mp3.controlTop.x(), mp3.controlTop.y()), pens().value("node"), scale, m_gradientPoint == useControlT); + drawNodeControl(psx, QPointF(mp3.controlLeft.x(), mp3.controlLeft.y()), pens().value("node"), scale, m_gradientPoint == useControlL); } else if (m_patchPoint == useBL) { - psx->setPen(p1bd); + psx->setPen(pens().value("node-handle")); psx->drawLine(QPointF(mp4.gridPoint.x(), mp4.gridPoint.y()), QPointF(mp4.controlTop.x(), mp4.controlTop.y())); psx->drawLine(QPointF(mp4.gridPoint.x(), mp4.gridPoint.y()), QPointF(mp4.controlRight.x(), mp4.controlRight.y())); - if (m_gradientPoint == useControlR) - psx->setPen(p8r); - else - psx->setPen(p8m); - psx->drawPoint(QPointF(mp4.controlRight.x(), mp4.controlRight.y())); - if (m_gradientPoint == useControlT) - psx->setPen(p8r); - else - psx->setPen(p8m); - psx->drawPoint(QPointF(mp4.controlTop.x(), mp4.controlTop.y())); + + drawNodeControl(psx, QPointF(mp4.controlRight.x(), mp4.controlRight.y()), pens().value("node"), scale, m_gradientPoint == useControlR); + drawNodeControl(psx, QPointF(mp4.controlTop.x(), mp4.controlTop.y()), pens().value("node"), scale, m_gradientPoint == useControlT); } } + + if (currItem->rotation() == 0 || currItem->rotation() == 90 || currItem->rotation() == 180 || currItem->rotation() == 270) + psx->setRenderHint(QPainter::Antialiasing, false); + + // Draw Nodes + QPainterPath Bez; + Bez.moveTo(mp1.gridPoint.x(), mp1.gridPoint.y()); + Bez.cubicTo(mp1.controlRight.x(), mp1.controlRight.y(), mp2.controlLeft.x(), mp2.controlLeft.y(), mp2.gridPoint.x(), mp2.gridPoint.y()); + Bez.cubicTo(mp2.controlBottom.x(), mp2.controlBottom.y(), mp3.controlTop.x(), mp3.controlTop.y(), mp3.gridPoint.x(), mp3.gridPoint.y()); + Bez.cubicTo(mp3.controlLeft.x(), mp3.controlLeft.y(), mp4.controlRight.x(), mp4.controlRight.y(), mp4.gridPoint.x(), mp4.gridPoint.y()); + Bez.cubicTo(mp4.controlTop.x(), mp4.controlTop.y(), mp1.controlBottom.x(), mp1.controlBottom.y(), mp1.gridPoint.x(), mp1.gridPoint.y()); + psx->setPen(pens().value("selection-group-inside")); + psx->setBrush(Qt::NoBrush); + psx->drawPath(Bez); + drawControlsMeshPoint(psx, mp1, m_patchPoint == useTL); + drawControlsMeshPoint(psx, mp2, m_patchPoint == useTR); + drawControlsMeshPoint(psx, mp3, m_patchPoint == useBR); + drawControlsMeshPoint(psx, mp4, m_patchPoint == useBL); + } - if (m_view->editStrokeGradient == 11) + if (m_view->editStrokeGradient == GradientEdit::PatchMesh_Polygon) { + psx->setBrush(Qt::NoBrush); + if (m_clickPointPolygon.size() > 1) { - psx->setPen(p1b); + psx->setPen(pens().value("vector")); psx->drawPolyline(m_clickPointPolygon); } - psx->setPen(p8r); + for (int col = 0; col < m_clickPointPolygon.size(); col++) - { - psx->drawPoint(m_clickPointPolygon.value(col)); - } + drawNodeHandle(psx, m_clickPointPolygon.value(col), pens().value("node"), scale, true); + if (!m_clickPointPolygon.empty()) { - psx->setPen(p1bd); + psx->setPen(pens().value("vector")); psx->drawLine(m_clickPointPolygon.value(m_clickPointPolygon.count() - 1), m_currentPoint); if (m_clickPointPolygon.size() == 3) psx->drawLine(m_clickPointPolygon.value(0), m_currentPoint); } - psx->setPen(p8r); - psx->drawPoint(m_currentPoint); + + drawNodeHandle(psx, m_currentPoint, pens().value("node"), scale, true); } + + psx->restore(); } void CanvasMode_EditMeshPatch::enterEvent(QEvent *e) @@ -303,7 +290,7 @@ m_currItem->selectedMeshPointX = -1; m_currItem->selectedMeshPointY = m_patchPoint; m_currItem->selectedMeshControlPoint = m_gradientPoint; - m_ScMW->propertiesPalette->updateColorSpecialGradient(); +// m_ScMW->propertiesPalette->updateColorSpecialGradient(); m_currItem->snapToPatchGrid = false; CanvasMode::deactivate(forGesture); @@ -396,7 +383,7 @@ doUpdate = true; break; case Qt::Key_5: - if (m_view->editStrokeGradient == 8) + if (m_view->editStrokeGradient == GradientEdit::PatchMesh_Color) { if (m_patchPoint == useTL) currItem->meshGradientPatches[currItem->selectedMeshPointX].TL.controlColor = currItem->meshGradientPatches[currItem->selectedMeshPointX].TL.gridPoint; @@ -408,7 +395,7 @@ currItem->meshGradientPatches[currItem->selectedMeshPointX].BL.controlColor = currItem->meshGradientPatches[currItem->selectedMeshPointX].BL.gridPoint; doUpdate = true; } - else if (m_view->editStrokeGradient == 10) + else if (m_view->editStrokeGradient == GradientEdit::PatchMesh_ControlPoints) { if (m_patchPoint == useTL) { @@ -446,7 +433,7 @@ { if (m_patchPoint != noPointDefined) { - if (m_view->editStrokeGradient == 8) + if (m_view->editStrokeGradient == GradientEdit::PatchMesh_Color) { if (m_patchPoint == useTL) currItem->meshGradientPatches[currItem->selectedMeshPointX].TL.controlColor += FPoint(moveX, moveY); @@ -457,7 +444,7 @@ if (m_patchPoint == useBL) currItem->meshGradientPatches[currItem->selectedMeshPointX].BL.controlColor += FPoint(moveX, moveY); } - else if (m_view->editStrokeGradient == 9) + else if (m_view->editStrokeGradient == GradientEdit::PatchMesh_Point) { if (m_patchPoint == useTL) currItem->meshGradientPatches[currItem->selectedMeshPointX].TL.moveRel(moveX, moveY); @@ -468,7 +455,7 @@ if (m_patchPoint == useBL) currItem->meshGradientPatches[currItem->selectedMeshPointX].BL.moveRel(moveX, moveY); } - else if (m_view->editStrokeGradient == 10) + else if (m_view->editStrokeGradient == GradientEdit::PatchMesh_ControlPoints) { if (m_patchPoint == useTL) { @@ -561,7 +548,7 @@ QTransform pp = m_currItem->getTransform(); FPoint npf = npfN.transformPoint(pp, true); FPoint npx(m_Mxp - npfN.x(), m_Myp - npfN.y(), 0, 0, m_currItem->rotation(), 1, 1, true); - if (m_view->editStrokeGradient == 11) + if (m_view->editStrokeGradient == GradientEdit::PatchMesh_Polygon) { m_currentPoint = QPointF(npf.x(), npf.y()); m_canvas->displayXYHUD(m->globalPosition(), npf.x(), npf.y()); @@ -577,7 +564,7 @@ { if (m_patchPoint != noPointDefined) { - if (m_view->editStrokeGradient == 8) + if (m_view->editStrokeGradient == GradientEdit::PatchMesh_Color) { FPoint cP; FPoint gP; @@ -611,75 +598,74 @@ if (m_patchPoint == useBL) m_currItem->meshGradientPatches[m_currItem->selectedMeshPointX].BL.controlColor -= npx; } - else if (m_view->editStrokeGradient == 9) + else if (m_view->editStrokeGradient == GradientEdit::PatchMesh_Point) { m_canvas->displayXYHUD(m->globalPosition(), npf.x(), npf.y()); - if (m_view->editStrokeGradient == 9) + + FPoint mp; + FPoint mp_orig; + double xx = 0.0; + double yy = 0.0; + if (m_patchPoint == useTL) { - FPoint mp; - FPoint mp_orig; - double xx = 0.0; - double yy = 0.0; - if (m_patchPoint == useTL) + mp_orig = m_currItem->meshGradientPatches[m_currItem->selectedMeshPointX].TL.gridPoint; + mp = mp_orig - npx; + xx = mp.x(); + yy = mp.y(); + if (m_currItem->snapToPatchGrid) + snapToOtherPatch(xx, yy); + m_currItem->meshGradientPatches[m_currItem->selectedMeshPointX].TL.moveAbs(xx, yy); + } + if (m_patchPoint == useTR) + { + mp_orig = m_currItem->meshGradientPatches[m_currItem->selectedMeshPointX].TR.gridPoint; + mp = mp_orig - npx; + xx = mp.x(); + yy = mp.y(); + if (m_currItem->snapToPatchGrid) + snapToOtherPatch(xx, yy); + m_currItem->meshGradientPatches[m_currItem->selectedMeshPointX].TR.moveAbs(xx, yy); + } + if (m_patchPoint == useBR) + { + mp_orig = m_currItem->meshGradientPatches[m_currItem->selectedMeshPointX].BR.gridPoint; + mp = mp_orig - npx; + xx = mp.x(); + yy = mp.y(); + if (m_currItem->snapToPatchGrid) + snapToOtherPatch(xx, yy); + m_currItem->meshGradientPatches[m_currItem->selectedMeshPointX].BR.moveAbs(xx, yy); + } + if (m_patchPoint == useBL) + { + mp_orig = m_currItem->meshGradientPatches[m_currItem->selectedMeshPointX].BL.gridPoint; + mp = mp_orig - npx; + xx = mp.x(); + yy = mp.y(); + if (m_currItem->snapToPatchGrid) + snapToOtherPatch(xx, yy); + m_currItem->meshGradientPatches[m_currItem->selectedMeshPointX].BL.moveAbs(xx, yy); + } + if (m->modifiers() & Qt::ShiftModifier) + { + for (int col = 0; col < m_currItem->meshGradientPatches.count(); col++) { - mp_orig = m_currItem->meshGradientPatches[m_currItem->selectedMeshPointX].TL.gridPoint; - mp = mp_orig - npx; - xx = mp.x(); - yy = mp.y(); - if (m_currItem->snapToPatchGrid) - snapToOtherPatch(xx, yy); - m_currItem->meshGradientPatches[m_currItem->selectedMeshPointX].TL.moveAbs(xx, yy); - } - if (m_patchPoint == useTR) - { - mp_orig = m_currItem->meshGradientPatches[m_currItem->selectedMeshPointX].TR.gridPoint; - mp = mp_orig - npx; - xx = mp.x(); - yy = mp.y(); - if (m_currItem->snapToPatchGrid) - snapToOtherPatch(xx, yy); - m_currItem->meshGradientPatches[m_currItem->selectedMeshPointX].TR.moveAbs(xx, yy); - } - if (m_patchPoint == useBR) - { - mp_orig = m_currItem->meshGradientPatches[m_currItem->selectedMeshPointX].BR.gridPoint; - mp = mp_orig - npx; - xx = mp.x(); - yy = mp.y(); - if (m_currItem->snapToPatchGrid) - snapToOtherPatch(xx, yy); - m_currItem->meshGradientPatches[m_currItem->selectedMeshPointX].BR.moveAbs(xx, yy); - } - if (m_patchPoint == useBL) - { - mp_orig = m_currItem->meshGradientPatches[m_currItem->selectedMeshPointX].BL.gridPoint; - mp = mp_orig - npx; - xx = mp.x(); - yy = mp.y(); - if (m_currItem->snapToPatchGrid) - snapToOtherPatch(xx, yy); - m_currItem->meshGradientPatches[m_currItem->selectedMeshPointX].BL.moveAbs(xx, yy); - } - if (m->modifiers() & Qt::ShiftModifier) - { - for (int col = 0; col < m_currItem->meshGradientPatches.count(); col++) + if (col != m_currItem->selectedMeshPointX) { - if (col != m_currItem->selectedMeshPointX) - { - if (m_currItem->meshGradientPatches[col].TL.gridPoint == mp_orig) - m_currItem->meshGradientPatches[col].TL.moveAbs(xx, yy); - if (m_currItem->meshGradientPatches[col].TR.gridPoint == mp_orig) - m_currItem->meshGradientPatches[col].TR.moveAbs(xx, yy); - if (m_currItem->meshGradientPatches[col].BR.gridPoint == mp_orig) - m_currItem->meshGradientPatches[col].BR.moveAbs(xx, yy); - if (m_currItem->meshGradientPatches[col].BL.gridPoint == mp_orig) - m_currItem->meshGradientPatches[col].BL.moveAbs(xx, yy); - } + if (m_currItem->meshGradientPatches[col].TL.gridPoint == mp_orig) + m_currItem->meshGradientPatches[col].TL.moveAbs(xx, yy); + if (m_currItem->meshGradientPatches[col].TR.gridPoint == mp_orig) + m_currItem->meshGradientPatches[col].TR.moveAbs(xx, yy); + if (m_currItem->meshGradientPatches[col].BR.gridPoint == mp_orig) + m_currItem->meshGradientPatches[col].BR.moveAbs(xx, yy); + if (m_currItem->meshGradientPatches[col].BL.gridPoint == mp_orig) + m_currItem->meshGradientPatches[col].BL.moveAbs(xx, yy); } } } + } - else if (m_view->editStrokeGradient == 10) + else if (m_view->editStrokeGradient == GradientEdit::PatchMesh_ControlPoints) { if (m_patchPoint == useTL) { @@ -744,7 +730,7 @@ m_currItem = m_doc->m_Selection->itemAt(0); QTransform itemMatrix = m_currItem->getTransform(); bool found = false; - if (m_view->editStrokeGradient == 11) + if (m_view->editStrokeGradient == GradientEdit::PatchMesh_Polygon) { m_gradientPoint = noControlPointDefined; m_patchPoint = noPointDefined; @@ -775,7 +761,7 @@ patch.BL = mgP; m_currItem->meshGradientPatches.append(patch); m_currItem->selectedMeshPointX = m_currItem->meshGradientPatches.count() - 1; - m_view->editStrokeGradient = 9; + m_view->editStrokeGradient = GradientEdit::PatchMesh_Point; m_click_count = 0; m_clickPointPolygon.clear(); m_ScMW->propertiesPalette->endPatchAdd(); @@ -785,7 +771,7 @@ { if (m_currItem->selectedMeshPointX >= 0) { - if (m_view->editStrokeGradient == 8) + if (m_view->editStrokeGradient == GradientEdit::PatchMesh_Color) { meshGradientPatch patch = m_currItem->meshGradientPatches[m_currItem->selectedMeshPointX]; MeshPoint mp1 = patch.TL; @@ -815,7 +801,7 @@ else m_patchPoint = noPointDefined; } - else if (m_view->editStrokeGradient == 9) + else if (m_view->editStrokeGradient == GradientEdit::PatchMesh_Point) { meshGradientPatch patch = m_currItem->meshGradientPatches[m_currItem->selectedMeshPointX]; MeshPoint mp1 = patch.TL; @@ -845,7 +831,7 @@ else m_patchPoint = noPointDefined; } - else if (m_view->editStrokeGradient == 10) + else if (m_view->editStrokeGradient == GradientEdit::PatchMesh_ControlPoints) { if (m_patchPoint != noPointDefined) { @@ -945,8 +931,8 @@ m_currItem->selectedMeshPointY = m_patchPoint; m_currItem->selectedMeshControlPoint = m_gradientPoint; } - m_canvas->m_viewMode.m_MouseButtonPressed = true; - m_ScMW->propertiesPalette->updateColorSpecialGradient(); + m_canvas->m_viewMode.m_MouseButtonPressed = true; +// m_ScMW->propertiesPalette->updateColorSpecialGradient(); m_view->setCursor(QCursor(Qt::CrossCursor)); m_doc->regionsChanged()->update(itemMatrix.mapRect(QRectF(0, 0, m_currItem->width(), m_currItem->height())).adjusted(-m_currItem->width() / 2.0, -m_currItem->height() / 2.0, m_currItem->width(), m_currItem->height())); @@ -957,7 +943,7 @@ m_canvas->m_viewMode.m_MouseButtonPressed = false; m_canvas->resetRenderMode(); m->accept(); - if (m_view->editStrokeGradient != 11 && m_currItem->selectedMeshPointX >=0 && m_patchPoint != noPointDefined && UndoManager::undoEnabled()) + if (m_view->editStrokeGradient != GradientEdit::PatchMesh_Polygon && m_currItem->selectedMeshPointX >=0 && m_patchPoint != noPointDefined && UndoManager::undoEnabled()) { auto *ss = new ScOldNewState<MeshPoint>(Um::GradPos); ss->set("MOVE_MESH_PATCH"); Index: scribus/canvasmode_editpolygon.cpp =================================================================== --- scribus/canvasmode_editpolygon.cpp (Revision 26070) +++ scribus/canvasmode_editpolygon.cpp (Arbeitskopie) @@ -87,47 +87,44 @@ void CanvasMode_EditPolygon::drawControlsPolygon(QPainter* psx, PageItem* currItem) { - QPen p1b = QPen(Qt::blue, 1.0 / m_canvas->m_viewMode.scale, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin); - QPen p1bd = QPen(Qt::red, 1.0 / m_canvas->m_viewMode.scale, Qt::DotLine, Qt::FlatCap, Qt::MiterJoin); - QPen p8b = QPen(Qt::blue, 8.0 / m_canvas->m_viewMode.scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin); - QPen p8r = QPen(Qt::red, 8.0 / m_canvas->m_viewMode.scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin); + qreal scale = m_canvas->m_viewMode.scale; + PageItem_RegularPolygon* item = currItem->asRegularPolygon(); + QPainterPath path = regularPolygonPath(item->width(), item->height(), m_polyCorners, m_polyUseFactor, m_polyFactor, m_polyRotation, m_polyCurvature, m_polyInnerRot, m_polyOuterCurvature); + + psx->save(); psx->setTransform(currItem->getTransform(), true); - psx->setPen(p1b); + psx->setRenderHint(QPainter::Antialiasing); + + // Draw Vector path + psx->setPen(pens().value("vector")); psx->setBrush(Qt::NoBrush); - PageItem_RegularPolygon* item = currItem->asRegularPolygon(); - QPainterPath path = regularPolygonPath(item->width(), item->height(), m_polyCorners, m_polyUseFactor, m_polyFactor, m_polyRotation, m_polyCurvature, m_polyInnerRot, m_polyOuterCurvature); psx->drawPath(path); - psx->setPen(p1bd); - psx->drawLine(m_startPoint, m_endPoint); + + // Draw Control Lines if (m_polyUseFactor) { + psx->setPen(pens().value("node-handle")); psx->drawLine(m_endPoint, m_innerCPoint); psx->drawLine(m_startPoint, m_outerCPoint); } - psx->setPen(p8b); - if (m_polygonPoint == useControlOuter) - psx->setPen(p8r); - else - psx->setPen(p8b); - psx->drawPoint(m_startPoint); - if (m_polygonPoint == useControlInner) - psx->setPen(p8r); - else - psx->setPen(p8b); - psx->drawPoint(m_endPoint); + psx->setPen(pens().value("node-dash")); + psx->drawLine(m_startPoint, m_endPoint); + + if (currItem->rotation() == 0 || currItem->rotation() == 90 || currItem->rotation() == 180 || currItem->rotation() == 270) + psx->setRenderHint(QPainter::Antialiasing, false); + + // Draw Node Handle + drawNodeHandle(psx, m_startPoint, pens().value("node"), scale, m_polygonPoint == useControlOuter); + drawNodeHandle(psx, m_endPoint, pens().value("node"), scale, m_polygonPoint == useControlInner); + + // Draw Node Controls if (m_polyUseFactor) { - if (m_polygonPoint == useControlInnerCurve) - psx->setPen(p8r); - else - psx->setPen(p8b); - psx->drawPoint(m_innerCPoint); - if (m_polygonPoint == useControlOuterCurve) - psx->setPen(p8r); - else - psx->setPen(p8b); - psx->drawPoint(m_outerCPoint); + drawNodeControl(psx, m_innerCPoint, pens().value("node"), scale, m_polygonPoint == useControlInnerCurve); + drawNodeControl(psx, m_outerCPoint, pens().value("node"), scale, m_polygonPoint == useControlOuterCurve); } + + psx->restore(); } void CanvasMode_EditPolygon::enterEvent(QEvent *e) Index: scribus/canvasmode_editspiral.cpp =================================================================== --- scribus/canvasmode_editspiral.cpp (Revision 26070) +++ scribus/canvasmode_editspiral.cpp (Arbeitskopie) @@ -71,21 +71,16 @@ void CanvasMode_EditSpiral::drawControlsSpiral(QPainter* psx, const PageItem* currItem) { - QPen p8b = QPen(Qt::blue, 8.0 / m_canvas->m_viewMode.scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin); - QPen p8r = QPen(Qt::red, 8.0 / m_canvas->m_viewMode.scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin); + qreal scale = m_canvas->m_viewMode.scale; psx->setTransform(currItem->getTransform(), true); - psx->setBrush(Qt::NoBrush); - psx->setPen(p8b); - if (m_arcPoint == useControlStart) - psx->setPen(p8r); + + if (currItem->rotation() == 0 || currItem->rotation() == 90 || currItem->rotation() == 180 || currItem->rotation() == 270) + psx->setRenderHint(QPainter::Antialiasing, false); else - psx->setPen(p8b); - psx->drawPoint(m_startPoint); - if (m_arcPoint == useControlEnd) - psx->setPen(p8r); - else - psx->setPen(p8b); - psx->drawPoint(m_endPoint); + psx->setRenderHint(QPainter::Antialiasing, true); + + drawNodeHandle(psx, m_startPoint, pens().value("node"), scale, m_arcPoint == useControlStart); + drawNodeHandle(psx, m_endPoint, pens().value("node"), scale, m_arcPoint == useControlEnd); } void CanvasMode_EditSpiral::enterEvent(QEvent *e) Index: scribus/canvasmode_nodeedit.cpp =================================================================== --- scribus/canvasmode_nodeedit.cpp (Revision 26070) +++ scribus/canvasmode_nodeedit.cpp (Arbeitskopie) @@ -33,7 +33,6 @@ #include "ui/pageselector.h" #include "ui/scrspinbox.h" - CanvasMode_NodeEdit::CanvasMode_NodeEdit(ScribusView* view) : CanvasMode(view) { m_ScMW = m_view->m_ScMW; @@ -52,7 +51,6 @@ p->scale(m_canvas->scale(), m_canvas->scale()); p->translate(-m_doc->minCanvasCoordinate.x(), -m_doc->minCanvasCoordinate.y()); p->setTransform(currItem->getTransform(), true); - p->setPen(QPen(Qt::blue, 1 / m_canvas->m_viewMode.scale, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin)); p->setBrush(Qt::NoBrush); if ((m_doc->nodeEdit.isContourLine()) && (!currItem->ContourLine.empty())) @@ -73,17 +71,20 @@ p->scale(1, -1); } } - } - // draw curve + } const double scale = m_canvas->m_viewMode.scale; - const double onePerScale = 1 / scale; + + // Draw Vector Path if (cli.size() > 3) { + p->save(); + p->setRenderHint(QPainter::Antialiasing); + for (int i = 0; i < cli.size() - 3; i += 4) { if (cli.isMarker(i)) continue; - p->setPen(QPen(Qt::blue, onePerScale, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin)); + const FPoint& a1 = cli.point(i); const FPoint& a2 = cli.point(i + 1); const FPoint& a3 = cli.point(i + 3); @@ -91,52 +92,51 @@ QPainterPath Bez; Bez.moveTo(a1.x(), a1.y()); Bez.cubicTo(a2.x(), a2.y(), a3.x(), a3.y(), a4.x(), a4.y()); + p->setPen(pens().value("vector")); p->drawPath(Bez); - p->setPen(QPen(Qt::blue, onePerScale, Qt::DotLine, Qt::FlatCap, Qt::MiterJoin)); + p->setPen(pens().value("node-handle")); p->drawLine(QPointF(a1.x(), a1.y()), QPointF(a2.x(), a2.y())); p->drawLine(QPointF(a3.x(), a3.y()), QPointF(a4.x(), a4.y())); } + p->restore(); } double x = 0.0; double y = 0.0; - // draw points + // Draw Nodes for (int i = 0; i < cli.size() - 1; i += 2) { if (cli.isMarker(i)) continue; - Qt::GlobalColor color1 = (m_doc->nodeEdit.clre() == (i + 1)) ? Qt::red : Qt::magenta; - Qt::GlobalColor color2 = (m_doc->nodeEdit.clre() == i) ? Qt::red : Qt::blue; + if (m_doc->nodeEdit.edPoints()) { - p->setPen(QPen(color1, 8 / scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin)); cli.point(i + 1, &x, &y); - p->drawPoint(QPointF(x, y)); - p->setPen(QPen(color2, 8 / scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin)); + drawNodeControl(p, QPointF(x, y), pens().value("node"), scale); + cli.point(i, &x, &y); - p->drawPoint(QPointF(x, y)); + drawNodeHandle(p, QPointF(x, y), pens().value("node"), scale); } else { - p->setPen(QPen(color2, 8 / scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin)); cli.point(i, &x, &y); - p->drawPoint(QPointF(x, y)); - p->setPen(QPen(color1, 8 / scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin)); + drawNodeHandle(p, QPointF(x, y), pens().value("node"), scale); + cli.point(i + 1, &x, &y); - p->drawPoint(QPointF(x, y)); + drawNodeControl(p, QPointF(x, y), pens().value("node"), scale); } } if (m_doc->nodeEdit.clre() != -1) { - p->setPen(QPen(Qt::red, 8 / scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin)); cli.point(m_doc->nodeEdit.clre(), &x, &y); - p->drawPoint(QPointF(x, y)); + drawNodeControl(p, QPointF(x, y), pens().value("node"), scale, true); + const auto& selectedNodes = m_doc->nodeEdit.selNode(); for (int i = 0; i < selectedNodes.count(); ++i) { int selectedNode = selectedNodes.at(i); cli.point(selectedNode, &x, &y); - p->drawPoint(QPointF(x, y)); + drawNodeHandle(p, QPointF(x, y), pens().value("node"), scale, true); } } Index: scribus/commonstrings.cpp =================================================================== --- scribus/commonstrings.cpp (Revision 26070) +++ scribus/commonstrings.cpp (Arbeitskopie) @@ -37,6 +37,7 @@ QString CommonStrings::tr_Save; QString CommonStrings::Warning; QString CommonStrings::trWarning; +QString CommonStrings::trCustom; QString CommonStrings::trYes; QString CommonStrings::trNo; @@ -314,6 +315,8 @@ CommonStrings::trYesKey = tr("&Yes"); CommonStrings::trNoKey = tr("&No"); + CommonStrings::trCustom = "Custom"; + CommonStrings::itemType_TextFrame = tr("Text Frame"); CommonStrings::itemType_ImageFrame = tr("Image Frame"); CommonStrings::itemType_Line = tr("Line"); Index: scribus/commonstrings.h =================================================================== --- scribus/commonstrings.h (Revision 26070) +++ scribus/commonstrings.h (Arbeitskopie) @@ -105,6 +105,7 @@ static QString trYesKey; //! \brief Translated "No" with key accelerator "&No" static QString trNoKey; + static QString trCustom; //Item Types static QString itemType_TextFrame; Index: scribus/designer/sectioncontainer_extension.cpp =================================================================== --- scribus/designer/sectioncontainer_extension.cpp (nicht existent) +++ scribus/designer/sectioncontainer_extension.cpp (Arbeitskopie) @@ -0,0 +1,63 @@ +#include "sectioncontainer_extension.h" + +#include "../ui/widgets/section_container.h" + +SectionContainerExtension::SectionContainerExtension(SectionContainer *widget, + QObject *parent) + : QObject(parent) + , myWidget(widget) +{ +} + +bool SectionContainerExtension::canAddWidget() const +{ + return !myWidget->hasBodyWidget(); +} + +void SectionContainerExtension::addWidget(QWidget *widget) +{ + myWidget->setWidget(widget); +} + +int SectionContainerExtension::count() const +{ + return 1; +} + +int SectionContainerExtension::currentIndex() const +{ + return 0; +} + +void SectionContainerExtension::insertWidget(int index, QWidget *widget) +{ + //myWidget->insertPage(index, widget); + Q_UNUSED(index); + Q_UNUSED(widget); + //addWidget(widget); +} + +bool SectionContainerExtension::canRemove(int index) const +{ + Q_UNUSED(index); + return myWidget->hasBodyWidget(); +} + +void SectionContainerExtension::remove(int index) +{ + //myWidget->removePage(index); + Q_UNUSED(index); + myWidget->removeWidget(); +} + +void SectionContainerExtension::setCurrentIndex(int index) +{ + Q_UNUSED(index); +} + +QWidget* SectionContainerExtension::widget(int index) const +{ + Q_UNUSED(index); + return myWidget->widget(); +} + Index: scribus/designer/sectioncontainer_extension.h =================================================================== --- scribus/designer/sectioncontainer_extension.h (nicht existent) +++ scribus/designer/sectioncontainer_extension.h (Arbeitskopie) @@ -0,0 +1,34 @@ +#ifndef SECTIONCONTAINEREXTENSION_H +#define SECTIONCONTAINEREXTENSION_H + +#include <QtDesigner/QDesignerContainerExtension> + +QT_BEGIN_NAMESPACE +class QExtensionManager; +QT_END_NAMESPACE +class SectionContainer; + +class SectionContainerExtension: public QObject, + public QDesignerContainerExtension +{ + Q_OBJECT + Q_INTERFACES(QDesignerContainerExtension) + +public: + explicit SectionContainerExtension(SectionContainer *widget, QObject *parent); + + bool canAddWidget() const override; + void addWidget(QWidget *widget) override; + int count() const override; + int currentIndex() const override; + void insertWidget(int index, QWidget *widget) override; + bool canRemove(int index) const override; + void remove(int index) override; + void setCurrentIndex(int index) override; + QWidget *widget(int index) const override; + +private: + SectionContainer *myWidget; +}; + +#endif // SECTIONCONTAINEREXTENSION_H Index: scribus/designer/sectioncontainer_extensionfactory.cpp =================================================================== --- scribus/designer/sectioncontainer_extensionfactory.cpp (nicht existent) +++ scribus/designer/sectioncontainer_extensionfactory.cpp (Arbeitskopie) @@ -0,0 +1,20 @@ +#include "sectioncontainer_extensionfactory.h" + +#include "sectioncontainer_extension.h" +#include "../ui/widgets/section_container.h" + + +SectionContainerExtensionFactory::SectionContainerExtensionFactory(QExtensionManager *parent) + : QExtensionFactory(parent) +{} + +QObject *SectionContainerExtensionFactory::createExtension(QObject *object, + const QString &iid, + QObject *parent) const +{ + SectionContainer *widget = qobject_cast<SectionContainer*>(object); + + if (widget && (iid == Q_TYPEID(QDesignerContainerExtension))) + return new SectionContainerExtension(widget, parent); + return nullptr; +} Index: scribus/designer/sectioncontainer_extensionfactory.h =================================================================== --- scribus/designer/sectioncontainer_extensionfactory.h (nicht existent) +++ scribus/designer/sectioncontainer_extensionfactory.h (Arbeitskopie) @@ -0,0 +1,21 @@ +#ifndef SECTIONCONTAINEREXTENSIONFACTORY_H +#define SECTIONCONTAINEREXTENSIONFACTORY_H + +#include <QtDesigner/QExtensionFactory> + +QT_BEGIN_NAMESPACE +class QExtensionManager; +QT_END_NAMESPACE + +class SectionContainerExtensionFactory: public QExtensionFactory +{ + Q_OBJECT + +public: + explicit SectionContainerExtensionFactory(QExtensionManager *parent = nullptr); + +protected: + QObject *createExtension(QObject *object, const QString &iid, QObject *parent) const override; +}; + +#endif // SECTIONCONTAINEREXTENSIONFACTORY_H Index: scribus/designer/sectioncontainer_plugin.cpp =================================================================== --- scribus/designer/sectioncontainer_plugin.cpp (nicht existent) +++ scribus/designer/sectioncontainer_plugin.cpp (Arbeitskopie) @@ -0,0 +1,101 @@ +#include <QtDesigner/QExtensionFactory> +#include <QtDesigner/QExtensionManager> +#include <QtDesigner/QDesignerFormEditorInterface> +#include <QtDesigner/QDesignerFormWindowInterface> +#include <QtDesigner/QDesignerContainerExtension> +#include <QtDesigner/QDesignerPropertySheetExtension> + +#include <QIcon> +#include <QtPlugin> + +#include "../ui/widgets/section_container.h" +#include "sectioncontainer_plugin.h" +#include "sectioncontainer_extensionfactory.h" + + +SectionContainerPlugin::SectionContainerPlugin(QObject *parent) + : QObject(parent) +{ +} + +QString SectionContainerPlugin::name() const +{ + return QLatin1String("SectionContainer"); +} + +QString SectionContainerPlugin::group() const +{ + return QLatin1String("Scribus UI"); +} + +QString SectionContainerPlugin::toolTip() const +{ + return QString(); +} + +QString SectionContainerPlugin::whatsThis() const +{ + return QString(); +} + +QString SectionContainerPlugin::includeFile() const +{ + return QLatin1String("ui/widgets/section_container.h"); +} + +QIcon SectionContainerPlugin::icon() const +{ + return QIcon(); +} + +bool SectionContainerPlugin::isContainer() const +{ + return true; +} + +QWidget *SectionContainerPlugin::createWidget(QWidget *parent) +{ + SectionContainer *widget = new SectionContainer(parent); +// connect(widget, &SectionContainer::currentIndexChanged, +// this, &SectionContainerPlugin::currentIndexChanged); + return widget; +} + +bool SectionContainerPlugin::isInitialized() const +{ + return initialized; +} + +void SectionContainerPlugin::initialize(QDesignerFormEditorInterface *formEditor) +{ + Q_UNUSED(formEditor) + if (initialized) + return; + + QExtensionManager *manager = formEditor->extensionManager(); + QExtensionFactory *factory = new SectionContainerExtensionFactory(manager); + + Q_ASSERT(manager != 0); + manager->registerExtensions(factory, Q_TYPEID(QDesignerContainerExtension)); + + initialized = true; +} + +QString SectionContainerPlugin::domXml() const +{ + return QLatin1String(R"( +<ui language="c++" displayname="Section Container"> + <widget class="SectionContainer" name="sectionContainer"> + <widget class="QWidget" name="page"> + <layout class="QVBoxLayout" name="verticalLayout"/> + </widget> + </widget> + <customwidgets> + <customwidget> + <class>SectionContainer</class> + <extends>QWidget</extends> + <addpagemethod>setWidget</addpagemethod> + </customwidget> + </customwidgets> +</ui>)"); +} Index: scribus/designer/sectioncontainer_plugin.h =================================================================== --- scribus/designer/sectioncontainer_plugin.h (nicht existent) +++ scribus/designer/sectioncontainer_plugin.h (Arbeitskopie) @@ -0,0 +1,36 @@ +#ifndef SECTIONCONTAINERPLUGIN_H +#define SECTIONCONTAINERPLUGIN_H + +#include <QtUiPlugin/QDesignerCustomWidgetInterface> + +QT_BEGIN_NAMESPACE +class QIcon; +class QWidget; +QT_END_NAMESPACE + +class SectionContainerPlugin: public QObject, public QDesignerCustomWidgetInterface +{ + Q_OBJECT +// Q_PLUGIN_METADATA(IID "net.scribus.uiwidgets") + Q_INTERFACES(QDesignerCustomWidgetInterface) + +public: + explicit SectionContainerPlugin(QObject *parent = nullptr); + + QString name() const override; + QString group() const override; + QString toolTip() const override; + QString whatsThis() const override; + QString includeFile() const override; + QIcon icon() const override; + bool isContainer() const override; + QWidget *createWidget(QWidget *parent) override; + bool isInitialized() const override; + void initialize(QDesignerFormEditorInterface *formEditor) override; + QString domXml() const override; + +private: + bool initialized = false; +}; + +#endif // SECTIONCONTAINERPLUGIN_H Index: scribus/designer/uiwidgets.cpp =================================================================== --- scribus/designer/uiwidgets.cpp (Revision 26070) +++ scribus/designer/uiwidgets.cpp (Arbeitskopie) @@ -1,10 +1,12 @@ #include "uiwidgets.h" #include "formwidget_plugin.h" +#include "sectioncontainer_plugin.h" UIWidgets::UIWidgets(QObject *parent) : QObject(parent) { widgets.append(new FormWidgetPlugin(this)); + widgets.append(new SectionContainerPlugin(this)); } QList<QDesignerCustomWidgetInterface*> UIWidgets::customWidgets() const Index: scribus/manager/widget_manager.cpp =================================================================== --- scribus/manager/widget_manager.cpp (nicht existent) +++ scribus/manager/widget_manager.cpp (Arbeitskopie) @@ -0,0 +1,46 @@ +#include "widget_manager.h" +#include <QDebug> +//#include "selection.h" + +#include "ui/widgets/floatingwindow.h" +#include "ui/colorpicker/colorpicker.h" + +WidgetManager* WidgetManager::m_instance = nullptr; + +WidgetManager::WidgetManager(QObject *parent) + : QObject(parent) +{ + +} + +WidgetManager &WidgetManager::instance() +{ + static WidgetManager m_instance; + return m_instance; +} + +void WidgetManager::setup(ScribusDoc *doc) +{ + m_doc = doc; + m_colorPicker = new ColorPicker(/*ColorPickerConfig::Default*/); + m_colorPicker->setDoc(m_doc); + m_colorPickerWindow = new FloatingWindow(m_colorPicker, new QWidget()); + connect(m_colorPickerWindow, &FloatingWindow::closed, m_colorPicker, &ColorPicker::parentClosed); + +} + + +FloatingWindow *WidgetManager::colorPickerWindow() +{ + return m_colorPickerWindow; +} + +ColorPicker *WidgetManager::colorPicker() +{ + return m_colorPicker; +} + +void WidgetManager::unitChange() +{ + m_colorPicker->unitChange(); +} Index: scribus/manager/widget_manager.h =================================================================== --- scribus/manager/widget_manager.h (nicht existent) +++ scribus/manager/widget_manager.h (Arbeitskopie) @@ -0,0 +1,39 @@ +#ifndef WIDGETMANAGER_H +#define WIDGETMANAGER_H + +#include "scribusdoc.h" +#include <QObject> + +class ColorPicker; +class FloatingWindow; + +class WidgetManager: public QObject +{ + + Q_OBJECT +public: + WidgetManager(WidgetManager const&) = delete; + void operator=(WidgetManager const&) = delete; + static WidgetManager &instance(); + + void setup(ScribusDoc *doc); + + FloatingWindow * colorPickerWindow(); + ColorPicker * colorPicker(); + + void unitChange(); + +private: + WidgetManager(QObject *parent = nullptr); + ~WidgetManager() = default; + + static WidgetManager* m_instance; + + // Widgets + ScribusDoc *m_doc; + FloatingWindow * m_colorPickerWindow; + ColorPicker * m_colorPicker; + +}; + +#endif // WIDGETMANAGER_H Index: scribus/models/gradientlistmodel.cpp =================================================================== --- scribus/models/gradientlistmodel.cpp (nicht existent) +++ scribus/models/gradientlistmodel.cpp (Arbeitskopie) @@ -0,0 +1,305 @@ +#include "gradientlistmodel.h" +//#include "gradientlistbox.h" +#include "commonstrings.h" +#include "scribusdoc.h" + +GradientPixmapValue::GradientPixmapValue(const GradientPixmapValue& other) + : m_gradient(other.m_gradient), + m_doc(other.m_doc), + m_name(other.m_name) +{ + +} + +GradientPixmapValue& GradientPixmapValue::operator= (const GradientPixmapValue& other) +{ + m_gradient = other.m_gradient; + m_doc = other.m_doc; + m_name = other.m_name; + return *this; +} + +GradientPixmapValue::GradientPixmapValue(const VGradient& gradient, ScribusDoc* doc, const QString& gradientName) + : m_gradient(gradient), + m_name(gradientName) +{ + m_doc = (doc) ? doc->guardedPtr() : nullptr; +} + +GradientListModel::GradientListModel(QObject *parent) + : QAbstractItemModel(parent) +{ + +} + +void GradientListModel::clear() +{ + beginResetModel(); + m_gradients.clear(); + endResetModel(); +} + +int GradientListModel::columnCount(const QModelIndex &/*parent*/) const +{ + return 1; +} + +QVariant GradientListModel::data(const QModelIndex &index, int role) const +{ + if (!index.isValid()) + return QVariant(); + + const auto* pColorValue = static_cast<GradientPixmapValue*>(index.internalPointer()); + if (!pColorValue) + return QVariant(); + + if (role == Qt::DisplayRole) + { + if (pColorValue->m_name == CommonStrings::trCustom) + return CommonStrings::trCustom; + return pColorValue->m_name; + } + + if (role == Qt::ToolTipRole) + { + const VGradient& gradient = pColorValue->m_gradient; + if (pColorValue->m_name == CommonStrings::trCustom) + return QVariant(); + + switch(gradient.type()) + { + case VGradient::diamond: + return tr("Diamond"); + break; + case VGradient::fourcolor: + return tr("4-Color"); + break; + case VGradient::freemesh: + return tr("Free Mesh"); + break; + case VGradient::linear: + return tr("Linear"); + break; + case VGradient::mesh: + return tr("Mesh"); + break; + case VGradient::radial: + return tr("Radial"); + break; + } + + return QVariant(); + } + + if (role == Qt::UserRole) + { + if (pColorValue->m_name == CommonStrings::trCustom) + return CommonStrings::trCustom; + return QVariant::fromValue(*pColorValue); + } + + return QVariant(); +} + +Qt::ItemFlags GradientListModel::flags(const QModelIndex &index) const +{ + if (!index.isValid()) + return Qt::ItemFlags(); + + Qt::ItemFlags flags = Qt::ItemIsEnabled | Qt::ItemIsSelectable; + return flags; +} + +QModelIndex GradientListModel::index(int row, int column, const QModelIndex &parent) const +{ + if (!hasIndex(row, column, parent)) + return QModelIndex(); + + const auto* pColorValue = static_cast<GradientPixmapValue*>(parent.internalPointer()); + if (pColorValue) + return QModelIndex(); + + if (row < 0 || (row >= rowCount()) || (column != 0)) + return QModelIndex(); + + const GradientPixmapValue& colorValue = m_gradients.at(row); + return createIndex(row, column, const_cast<GradientPixmapValue*>(&colorValue)); +} + +void GradientListModel::insert(int i, const GradientPixmapValue& value) +{ + beginInsertRows(QModelIndex(), i, i); + m_gradients.insert(i, value); + endInsertRows(); +} + +QModelIndex GradientListModel::parent(const QModelIndex &/*child*/) const +{ + return QModelIndex(); +} + +bool GradientListModel::removeRow(int row, const QModelIndex& parent) +{ + if (row < 0 || row >= rowCount()) + return false; + + beginRemoveRows(parent, row, row); + m_gradients.remove(row); + endRemoveRows(); + + return true; +} + +bool GradientListModel::removeRows(int row, int count, const QModelIndex& parent) +{ + if (row < 0 || row >= rowCount()) + return false; + if (count <= 0) + return false; + + beginRemoveRows(parent, row, row + count - 1); + m_gradients.remove(row, count); + endRemoveRows(); + + return true; +} + +int GradientListModel::rowCount(const QModelIndex &parent) const +{ + if (m_gradients.count() == 0) + return 0; + + const auto* pColorValue = static_cast<GradientPixmapValue*>(parent.internalPointer()); + if (pColorValue) + return 0; + + return m_gradients.count(); +} + +void GradientListModel::setGradientList(const GradientList &gradientList) +{ + setGradientList(gradientList, m_isNoneColorShown); +} + +void GradientListModel::setGradientList(const GradientList& gradientList, bool showNone) +{ + ScribusDoc* doc = gradientList.document(); + + beginResetModel(); + + m_isNoneColorShown = showNone; + m_gradients.clear(); + m_gradients.reserve(gradientList.count()); + + if (m_isNoneColorShown) + m_gradients.append(GradientPixmapValue(VGradient(), nullptr, CommonStrings::trCustom)); + + GradientList::const_iterator iter; + for (iter = gradientList.begin(); iter != gradientList.end(); ++iter) + { + const QString& colorName = iter.key(); + const VGradient& gradient = iter.value(); + m_gradients.append(GradientPixmapValue(gradient, doc, colorName)); + } + + if (m_sortRule != SortByName) + { + if (m_sortRule == SortByType) + std::sort(m_gradients.begin(), m_gradients.end(), compareGradientTypes); + } + + endResetModel(); +} + +void GradientListModel::setShowNoneColor(bool showNone) +{ + if (m_isNoneColorShown == showNone) + return; + + beginResetModel(); + m_isNoneColorShown = showNone; + endResetModel(); +} + +void GradientListModel::setSortRule(SortRule sortRule) +{ + if (m_sortRule == sortRule) + return; + + beginResetModel(); + + m_sortRule = sortRule; + if (m_sortRule == SortByType) + std::sort(m_gradients.begin(), m_gradients.end(), compareGradientTypes); + else + std::sort(m_gradients.begin(), m_gradients.end(), compareGradientNames); + + endResetModel(); +} + +bool GradientListModel::compareGradientNames(const GradientPixmapValue& v1, const GradientPixmapValue& v2) +{ + if (v1.m_name == CommonStrings::trCustom) + return true; + if (v2.m_name == CommonStrings::trCustom) + return false; + + return (v1.m_name < v2.m_name); +} + +bool GradientListModel::compareGradientTypes(const GradientPixmapValue& v1, const GradientPixmapValue& v2) +{ + if (v1.m_name == CommonStrings::trCustom) + return true; + if (v2.m_name == CommonStrings::trCustom) + return false; + + QString sortString1("%1-%2"); + QString sortString2("%1-%2"); + + switch(v1.m_gradient.type()) + { + case VGradient::linear: + sortString1 = sortString1.arg("A", v1.m_name); + break; + case VGradient::radial: + sortString1 = sortString1.arg("B", v1.m_name); + break; + case VGradient::diamond: + sortString1 = sortString1.arg("C", v1.m_name); + break; + case VGradient::fourcolor: + sortString1 = sortString1.arg("D", v1.m_name); + break; + case VGradient::freemesh: + sortString1 = sortString1.arg("E", v1.m_name); + break; + case VGradient::mesh: + sortString1 = sortString1.arg("F", v1.m_name); + break; + } + + switch(v2.m_gradient.type()) + { + case VGradient::linear: + sortString2 = sortString2.arg("A", v2.m_name); + break; + case VGradient::radial: + sortString2 = sortString2.arg("B", v2.m_name); + break; + case VGradient::diamond: + sortString2 = sortString2.arg("C", v2.m_name); + break; + case VGradient::fourcolor: + sortString2 = sortString2.arg("D", v2.m_name); + break; + case VGradient::freemesh: + sortString2 = sortString2.arg("E", v2.m_name); + break; + case VGradient::mesh: + sortString2 = sortString2.arg("F", v2.m_name); + break; + } + + return (sortString1 < sortString2); +} Index: scribus/models/gradientlistmodel.h =================================================================== --- scribus/models/gradientlistmodel.h (nicht existent) +++ scribus/models/gradientlistmodel.h (Arbeitskopie) @@ -0,0 +1,104 @@ +#ifndef GRADIENTLISTMODEL_H +#define GRADIENTLISTMODEL_H + + +#include <QAbstractItemModel> +#include <QVector> + +#include "scguardedptr.h" +#include "scribusapi.h" +#include "vgradient.h" + +class ScribusDoc; + +struct SCRIBUS_API GradientPixmapValue +{ + VGradient m_gradient; + ScGuardedPtr<ScribusDoc> m_doc; + QString m_name { "invalid" }; + + GradientPixmapValue() = default; + GradientPixmapValue(const VGradient& gradient, ScribusDoc* doc, const QString& gradientName); + GradientPixmapValue(const GradientPixmapValue& other); + GradientPixmapValue& operator= (const GradientPixmapValue& other); +}; + +Q_DECLARE_METATYPE(GradientPixmapValue) + +class SCRIBUS_API GradientListModel : public QAbstractItemModel +{ + Q_OBJECT + +public: + //! Constructor + GradientListModel(QObject* parent = nullptr); + + enum SortRule + { + SortByName, + SortByType + }; + + //! Returns the color list + const QVector<GradientPixmapValue>& gradients() const { return m_gradients; } + + //! Returns if None color is shown as first item in the list + bool isNoneColorShown() const { return m_isNoneColorShown; } + + //! Remove all colors from list; + void clear(); + + //! Reimplement QAbstractItemModel columnCount() + int columnCount(const QModelIndex &parent = QModelIndex()) const; + + //! Reimplement QAbstractItemModel data() + QVariant data(const QModelIndex &index, int role) const; + + //! Reimplement QAbstractItemModel flags() + Qt::ItemFlags flags(const QModelIndex &index) const; + + //! Reimplement QAbstractItemModel index() + QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const; + + //! Insert an item in the list at specified position + void insert(int i, const GradientPixmapValue& value); + + //! Reimplement QAbstractItemModel parent() + QModelIndex parent(const QModelIndex &child) const; + + //! Reimplement QAbstractItemModel removeRow() + bool removeRow(int row, const QModelIndex& parent = QModelIndex()); + + //! Reimplement QAbstractItemModel removeRowz() + bool removeRows(int row, int count, const QModelIndex& parent = QModelIndex()); + + //! Reimplement QAbstractItemModel rowCount() + int rowCount(const QModelIndex &parent = QModelIndex()) const; + + //! Set color list + void setGradientList(const GradientList& gradientList); + + //! Set color list and None color option at same time + void setGradientList(const GradientList &gradientList, bool showNone); + + //! Set if None color is shown as first item in the list + void setShowNoneColor(bool showNone); + + //! Set how colors should be sorted + void setSortRule(SortRule sortRule); + +protected: + //! If None color is shown as first item in the list + bool m_isNoneColorShown { false }; + + //! The color list + QVector<GradientPixmapValue> m_gradients; + + // SortRule m_sortRule + SortRule m_sortRule { SortByName }; + + static bool compareGradientNames(const GradientPixmapValue& v1, const GradientPixmapValue& v2); + static bool compareGradientTypes(const GradientPixmapValue& v1, const GradientPixmapValue& v2); +}; + +#endif // GRADIENTLISTMODEL_H Index: scribus/pageitem.cpp =================================================================== --- scribus/pageitem.cpp (Revision 26070) +++ scribus/pageitem.cpp (Arbeitskopie) @@ -2766,6 +2766,9 @@ break; } + if(mp == nullptr) + return; + UndoTransaction trans; if (UndoManager::undoEnabled()) { Index: scribus/prefsmanager.cpp =================================================================== --- scribus/prefsmanager.cpp (Revision 26070) +++ scribus/prefsmanager.cpp (Arbeitskopie) @@ -174,6 +174,7 @@ appPrefs.uiPrefs.showSplashOnStartup = true; appPrefs.uiPrefs.useSmallWidgets = false; appPrefs.uiPrefs.hideLabels = false; + appPrefs.uiPrefs.hideLabelsOfInactiveTabs = false; appPrefs.uiPrefs.useTabs = false; appPrefs.uiPrefs.stickyTools = false; appPrefs.uiPrefs.grayscaleIcons = false; @@ -1344,6 +1345,7 @@ dcUI.setAttribute("ShowSplashOnStartup", static_cast<int>(appPrefs.uiPrefs.showSplashOnStartup)); dcUI.setAttribute("UseSmallWidgets", static_cast<int>(appPrefs.uiPrefs.useSmallWidgets)); dcUI.setAttribute("HideLabels", static_cast<int>(appPrefs.uiPrefs.hideLabels)); + dcUI.setAttribute("HideLabelsOfInactiveTabs", static_cast<int>(appPrefs.uiPrefs.hideLabelsOfInactiveTabs)); dcUI.setAttribute("UseDocumentTabs", static_cast<int>(appPrefs.uiPrefs.useTabs)); dcUI.setAttribute("StickyTools", static_cast<int>(appPrefs.uiPrefs.stickyTools)); dcUI.setAttribute("Theme", appPrefs.uiPrefs.style); @@ -1991,6 +1993,7 @@ appPrefs.uiPrefs.showSplashOnStartup = static_cast<bool>(dc.attribute("UI_SHOWSPLASHSCREEN", "1").toInt()); appPrefs.uiPrefs.useSmallWidgets = dc.attribute("UseSmallWidgets").toInt(); appPrefs.uiPrefs.hideLabels = dc.attribute("HideLabels").toInt(); + appPrefs.uiPrefs.hideLabelsOfInactiveTabs = dc.attribute("HideLabelsOfInactiveTabs").toInt(); appPrefs.uiPrefs.useTabs = static_cast<bool>(dc.attribute("UseDocumentTabs", "0").toInt()); appPrefs.uiPrefs.stickyTools = static_cast<bool>(dc.attribute("StickyTools", "0").toInt()); appPrefs.uiPrefs.grayscaleIcons = static_cast<bool>(dc.attribute("UseGrayscaleIcons",nullptr).toInt()); Index: scribus/prefsstructs.h =================================================================== --- scribus/prefsstructs.h (Revision 26070) +++ scribus/prefsstructs.h (Arbeitskopie) @@ -123,6 +123,7 @@ QString userPreferredLocale; //! System or interface language number formats bool useSmallWidgets {false}; //! Use small widgets in the palettes bool hideLabels {false}; //! Hide UI additional labels (Professional Mode) + bool hideLabelsOfInactiveTabs {false}; //! Hide text label of inactive tabs of Adavanced Docking System bool useTabs {false}; //! Use a tabbed MainWidget a la FireFox bool showStartupDialog {true}; //! Whether to show the startup dialog or not bool showSplashOnStartup {true}; //! Whether to show the splashscreen or not Index: scribus/scribus.cpp =================================================================== --- scribus/scribus.cpp (Revision 26070) +++ scribus/scribus.cpp (Arbeitskopie) @@ -21,6 +21,7 @@ * * ***************************************************************************/ +#include "ui/colorpicker/colorpicker.h" #include <QAction> #include <QApplication> #include <QByteArray> @@ -160,7 +161,6 @@ #include "ui/charselect.h" #include "ui/checkDocument.h" #include "ui/collectforoutput_ui.h" -#include "ui/colorpalette.h" #include "ui/contentpalette.h" #include "ui/contextmenu.h" #include "ui/copypagetomasterpagedialog.h" @@ -232,7 +232,6 @@ #include "ui/symbolpalette.h" #include "ui/tabmanager.h" #include "ui/transformdialog.h" -#include "ui/transparencypalette.h" #include "ui/viewtoolbar.h" #include "undogui.h" #include "undomanager.h" @@ -269,7 +268,8 @@ extern bool emergencyActivated; ScribusMainWindow::ScribusMainWindow() : - m_prefsManager(PrefsManager::instance()) + m_prefsManager(PrefsManager::instance()), + m_widgetManager(WidgetManager::instance()) { #ifdef Q_OS_MACOS @@ -299,6 +299,7 @@ CDockManager::setConfigFlag(CDockManager::DockAreaHideDisabledButtons, true); CDockManager::setConfigFlag(CDockManager::FocusHighlighting, true); CDockManager::setConfigFlag(CDockManager::DisableTabTextEliding, true); + CDockManager::setConfigFlag(CDockManager::ShowTabTextOnlyForActiveTab, m_prefsManager.appPrefs.uiPrefs.hideLabelsOfInactiveTabs); // Documentation: https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System/blob/master/doc/user-guide.md#auto-hide-configuration-flags // CDockManager::setAutoHideConfigFlags(CDockManager::DefaultAutoHideConfig); @@ -349,6 +350,7 @@ scrLayersActions.clear(); scrScrapActions.clear(); actionManager = new ActionManager(this); + m_widgetManager.setup(m_doc); appModeHelper = new AppModeHelper(); appModeHelper->setup(actionManager, &scrActions, &scrRecentFileActions, &scrWindowsActions, &scrScrapActions, &scrLayersActions, &scrRecentPasteActions); scrMenuMgr = new ScMWMenuManager(menuBar(), actionManager); @@ -7424,6 +7426,7 @@ alignDistributePalette->unitChange(); guidePalette->setupPage(); m_styleManager->unitChange(); + m_widgetManager.unitChange(); if (draw) view->DrawNew(); } @@ -7480,8 +7483,9 @@ } patternsDependingOnThis.prepend(temp); symbolPalette->editingStart(patternsDependingOnThis); - propertiesPalette->colorPalette->hideEditedPatterns(patternsDependingOnThis); - propertiesPalette->transparencyPalette->hideEditedPatterns(patternsDependingOnThis); +// propertiesPalette->colorPalette->hideEditedPatterns(patternsDependingOnThis); + WidgetManager::instance().colorPicker()->hideEditedPatterns(patternsDependingOnThis); +// propertiesPalette->transparencyPalette->hideEditedPatterns(patternsDependingOnThis); if (outlinePalette->isVisible()) outlinePalette->BuildTree(false); updateActiveWindowCaption( tr("Editing Symbol: %1").arg(temp)); @@ -9241,7 +9245,8 @@ // Update tools colors if needed m_prefsManager.replaceToolColors(dia->replaceColorMap); m_prefsManager.setColorSet(dia->m_colorList); - propertiesPalette->colorPalette->setColors(m_prefsManager.colorSet()); +// propertiesPalette->colorPalette->setColors(m_prefsManager.colorSet()); + WidgetManager::instance().colorPicker()->setColorList(m_prefsManager.colorSet()); m_prefsManager.appPrefs.defaultGradients = dia->dialogGradients; m_prefsManager.appPrefs.defaultPatterns = dia->dialogPatterns; QString Cpfad = QDir::toNativeSeparators(ScPaths::applicationDataDir())+"DefaultColors.xml"; Index: scribus/scribus.h =================================================================== --- scribus/scribus.h (Revision 26070) +++ scribus/scribus.h (Arbeitskopie) @@ -57,6 +57,7 @@ #include "scribusapi.h" #include "scribusdoc.h" #include "manager/dock_manager.h" +#include "manager/widget_manager.h" #include "styleoptions.h" #include "ui/customfdialog.h" #include "ui/scmessagebox.h" @@ -654,7 +655,8 @@ StyleManager *m_styleManager {nullptr}; UndoManager *m_undoManager {nullptr}; PrefsManager& m_prefsManager; - FormatsManager *m_formatsManager {nullptr}; + WidgetManager &m_widgetManager; + FormatsManager *m_formatsManager {nullptr}; QPointer<HelpBrowser> m_helpBrowser; QString m_osgFilterString; Index: scribus/scribusdoc.cpp =================================================================== --- scribus/scribusdoc.cpp (Revision 26070) +++ scribus/scribusdoc.cpp (Arbeitskopie) @@ -8437,6 +8437,35 @@ changedPagePreview(); } +void ScribusDoc::itemSelection_SetItemHatchFill(int mode, double distance, double angle, bool useBackground, const QString &background, const QString &foreground, Selection *customSelection) +{ + Selection* itemSelection = (customSelection != nullptr) ? customSelection : m_Selection; + int selectedItemCount = itemSelection->count(); + if (selectedItemCount == 0) + return; + + m_updateManager.setUpdatesDisabled(); + + UndoTransaction activeTransaction; + if (selectedItemCount > 1 && UndoManager::undoEnabled()) + activeTransaction = m_undoManager->beginTransaction(Um::Selection, Um::IPolygon, Um::SetFill, "", Um::IFill); + + PageItem *currItem; + for (int i = 0; i < selectedItemCount; ++i) + { + currItem = itemSelection->itemAt(i); + currItem->setHatchParameters(mode, distance, angle, useBackground, background, foreground); + currItem->update(); + } + + if (activeTransaction) + activeTransaction.commit(); + + m_updateManager.setUpdatesEnabled(); + changed(); + changedPagePreview(); +} + void ScribusDoc::itemSelection_SetItemStrokePattern(const QString& pattern, Selection* customSelection) { Selection* itemSelection = (customSelection != nullptr) ? customSelection : m_Selection; Index: scribus/scribusdoc.h =================================================================== --- scribus/scribusdoc.h (Revision 26070) +++ scribus/scribusdoc.h (Arbeitskopie) @@ -1608,6 +1608,7 @@ void itemSelection_SetItemGradFill(int typp, Selection* customSelection = nullptr); void itemSelection_SetItemPatternFill(const QString& pattern, Selection* customSelection = nullptr); void itemSelection_SetItemPatternProps(double scaleX, double scaleY, double offsetX, double offsetY, double rotation, double skewX, double skewY, bool mirrorX, bool mirrorY); + void itemSelection_SetItemHatchFill(int mode, double distance, double angle, bool useBackground, const QString& background, const QString& foreground, Selection* customSelection = nullptr); void itemSelection_SetItemStrokePattern(const QString& pattern, Selection* customSelection = nullptr); void itemSelection_SetItemStrokePatternProps(double scaleX, double scaleY, double offsetX, double offsetY, double rotation, double skewX, double skewY, double space, bool mirrorX, bool mirrorY, Selection* customSelection = nullptr); void itemSelection_SetItemStrokePatternType(bool type, Selection* customSelection = nullptr); Index: scribus/scribusstructs.h =================================================================== --- scribus/scribusstructs.h (Revision 26070) +++ scribus/scribusstructs.h (Arbeitskopie) @@ -117,6 +117,61 @@ Gradient_Hatch = 14 }; +static QString gradientTypeDebug(int type) +{ + switch(type) + { + case Gradient_None: + return "Gradient_None"; + break; + case Gradient_LinearLegacy1: + return "Gradient_LinearLegacy1"; + break; + case Gradient_LinearLegacy2: + return "Gradient_LinearLegacy2"; + break; + case Gradient_LinearLegacy3: + return "Gradient_LinearLegacy3"; + break; + case Gradient_LinearLegacy4: + return "Gradient_LinearLegacy4"; + break; + case Gradient_RadialLegacy5: + return "Gradient_RadialLegacy5"; + break; + case Gradient_Linear: + return "Gradient_Linear"; + break; + case Gradient_Radial: + return "Gradient_Radial"; + break; + case Gradient_Pattern: + return "Gradient_Pattern"; + break; + case Gradient_4Colors: + return "Gradient_4Colors"; + break; + case Gradient_Diamond: + return "Gradient_Diamond"; + break; + case Gradient_Mesh: + return "Gradient_Mesh"; + break; + case Gradient_PatchMesh: + return "Gradient_PatchMesh"; + break; + case Gradient_Conical: + return "Gradient_Conical"; + break; + case Gradient_Hatch: + return "Gradient_Hatch"; + break; + default: + return "undefinded type: " + QString::number(type); + break; + } +}; + enum { GradMask_None = 0, @@ -130,6 +185,108 @@ GradMask_PatternInverted = 8 }; +static QString gradientMaskDebug(int type) +{ + switch(type) + { + case GradMask_None: + return "GradMask_None"; + break; + case GradMask_Linear: + return "GradMask_Linear"; + break; + case GradMask_Radial: + return "GradMask_Radial"; + break; + case GradMask_Pattern: + return "GradMask_Pattern"; + break; + case GradMask_LinearLumAlpha: + return "GradMask_LinearLumAlpha"; + break; + case GradMask_RadialLumAlpha: + return "GradMask_RadialLumAlpha"; + break; + case GradMask_PatternLumAlpha: + return "GradMask_PatternLumAlpha"; + break; + case GradMask_PatternLumAlphaInverted: + return "GradMask_PatternLumAlphaInverted"; + break; + case GradMask_PatternInverted: + return "GradMask_PatternInverted"; + break; + default: + return "undefinded type: " + QString::number(type); + break; + } +}; + +enum class GradientEdit +{ + // Gradients + Gradient = 0, + Gradient_Stroke = 1, + Gradient_Mask = 2, + FourColors = 3, + Diamond = 4, + // Mesh + Mesh_Point = 5, + Mesh_Color = 6, + Mesh_ControlPoints = 7, + // Patch Mesh + PatchMesh_Color = 8, + PatchMesh_Point = 9, + PatchMesh_ControlPoints = 10, + PatchMesh_Polygon = 11 +}; +Q_DECLARE_METATYPE(GradientEdit) + +static QString gradientEditDebug(GradientEdit type) +{ + switch(type) + { + case GradientEdit::Gradient: + return "Gradient"; + break; + case GradientEdit::Gradient_Stroke: + return "Gradient_Stroke"; + break; + case GradientEdit::Gradient_Mask: + return "Gradient_Mask"; + break; + case GradientEdit::FourColors: + return "FourColors"; + break; + case GradientEdit::Diamond: + return "Diamond"; + break; + case GradientEdit::Mesh_Point: + return "Mesh_Point"; + break; + case GradientEdit::Mesh_Color: + return "Mesh_Color"; + break; + case GradientEdit::Mesh_ControlPoints: + return "Mesh_ControlPoints"; + break; + case GradientEdit::PatchMesh_Color: + return "PatchMesh_Color"; + break; + case GradientEdit::PatchMesh_Point: + return "PatchMesh_Point"; + break; + case GradientEdit::PatchMesh_ControlPoints: + return "PatchMesh_ControlPoints"; + break; + case GradientEdit::PatchMesh_Polygon: + return "PatchMesh_Polygon"; + break; + default: + return "missing type"; + } +}; + /** * This enum describes the sides that can be selected. A selection can be * expressed as an ORed combination of Left, Right, Top and Bottom. Index: scribus/scribusview.cpp =================================================================== --- scribus/scribusview.cpp (Revision 26070) +++ scribus/scribusview.cpp (Arbeitskopie) @@ -1227,7 +1227,7 @@ QRect rect = currItem->getRedrawBounding(m_canvas->scale()); m_canvas->Transform(currItem, matrix); FPointArray fpNew; - if (editStrokeGradient) + if (editStrokeGradient == GradientEdit::Gradient_Stroke) fpNew.setPoints(2, currItem->GrStrokeStartX, currItem->GrStrokeStartY, currItem->GrStrokeEndX, currItem->GrStrokeEndY); else fpNew.setPoints(2, currItem->GrStartX, currItem->GrStartY, currItem->GrEndX, currItem->GrEndY); Index: scribus/scribusview.h =================================================================== --- scribus/scribusview.h (Revision 26070) +++ scribus/scribusview.h (Arbeitskopie) @@ -151,7 +151,7 @@ bool Magnify { false }; bool storedFramesShown { false }; bool storedShowControls { false }; - int editStrokeGradient { 0 }; + GradientEdit editStrokeGradient { GradientEdit::Gradient }; bool m_AnnotChanged { false }; bool m_EditModeWasOn { false }; bool m_ChangedState { false }; Index: scribus/third_party/Qt-Advanced-Docking-System/CMakeLists.txt =================================================================== --- scribus/third_party/Qt-Advanced-Docking-System/CMakeLists.txt (Revision 26070) +++ scribus/third_party/Qt-Advanced-Docking-System/CMakeLists.txt (Arbeitskopie) @@ -1,5 +1,5 @@ ###<< Scribus -set(ADS_VERSION "4.2.0") +set(ADS_VERSION "4.2.1") ###>> Scribus cmake_minimum_required(VERSION 3.5) Index: scribus/third_party/Qt-Advanced-Docking-System/doc/user-guide.md =================================================================== --- scribus/third_party/Qt-Advanced-Docking-System/doc/user-guide.md (Revision 26070) +++ scribus/third_party/Qt-Advanced-Docking-System/doc/user-guide.md (Arbeitskopie) @@ -28,6 +28,7 @@ - [`FloatingContainerForceQWidgetTitleBar` (Linux only)](#floatingcontainerforceqwidgettitlebar-linux-only) - [`MiddleMouseButtonClosesTab`](#middlemousebuttonclosestab) - [`DisableTabTextEliding`](#disabletabtexteliding) + - [`ShowTabTextOnlyForActiveTab`](#showtabtextonlyforactivetab) - [Auto-Hide Configuration Flags](#auto-hide-configuration-flags) - [Auto Hide Dock Widgets](#auto-hide-dock-widgets) - [Pinning Auto-Hide Widgets to a certain border](#pinning-auto-hide-widgets-to-a-certain-border) @@ -486,6 +487,13 @@ ![DisableTabTextEliding false](cfg_flag_DisableTabTextEliding_false.png) +### `ShowTabTextOnlyForActiveTab` + +Set this flag (default = false) to show label texts in dock area tabs only +for active tabs. Inactive tabs only show their icon: + +![MShowTabTextOnlyForActiveTab true](cfg_flag_ShowTabTextOnlyForActiveTab_true.png) + ## Auto-Hide Configuration Flags ### Auto Hide Dock Widgets Index: scribus/third_party/Qt-Advanced-Docking-System/src/DockAreaWidget.cpp =================================================================== --- scribus/third_party/Qt-Advanced-Docking-System/src/DockAreaWidget.cpp (Revision 26070) +++ scribus/third_party/Qt-Advanced-Docking-System/src/DockAreaWidget.cpp (Arbeitskopie) @@ -464,7 +464,14 @@ return d->AutoHideDockContainer; } + //============================================================================ +CDockSplitter* CDockAreaWidget::parentSplitter() const +{ + return internal::findParent<CDockSplitter*>(this); +} + +//============================================================================ bool CDockAreaWidget::isAutoHide() const { return d->AutoHideDockContainer != nullptr; @@ -600,7 +607,7 @@ this->toggleView(false); // Hide empty parent splitters - auto Splitter = internal::findParent<CDockSplitter*>(this); + auto Splitter = parentSplitter(); internal::hideEmptyParentSplitters(Splitter); //Hide empty floating widget Index: scribus/third_party/Qt-Advanced-Docking-System/src/DockAreaWidget.h =================================================================== --- scribus/third_party/Qt-Advanced-Docking-System/src/DockAreaWidget.h (Revision 26070) +++ scribus/third_party/Qt-Advanced-Docking-System/src/DockAreaWidget.h (Arbeitskopie) @@ -47,6 +47,7 @@ class DockContainerWidgetPrivate; class CDockAreaTitleBar; class CDockingStateReader; +class CDockSplitter; /** @@ -217,6 +218,11 @@ CAutoHideDockContainer* autoHideDockContainer() const; /** + * Returns the parent splitter that contains this dock area + */ + CDockSplitter* parentSplitter() const; + + /** * Returns true if the dock area is in an auto hide container */ bool isAutoHide() const; Index: scribus/third_party/Qt-Advanced-Docking-System/src/DockContainerWidget.cpp =================================================================== --- scribus/third_party/Qt-Advanced-Docking-System/src/DockContainerWidget.cpp (Revision 26070) +++ scribus/third_party/Qt-Advanced-Docking-System/src/DockContainerWidget.cpp (Arbeitskopie) @@ -587,16 +587,7 @@ auto InsertParam = internal::dockAreaInsertParameters(area); auto NewDockAreas = FloatingContainer->findChildren<CDockAreaWidget*>( QString(), Qt::FindChildrenRecursively); - QSplitter* TargetAreaSplitter = internal::findParent<QSplitter*>(TargetArea); - - if (!TargetAreaSplitter) - { - QSplitter* Splitter = newSplitter(InsertParam.orientation()); - Layout->replaceWidget(TargetArea, Splitter); - Splitter->addWidget(TargetArea); - updateSplitterHandles(Splitter); - TargetAreaSplitter = Splitter; - } + auto TargetAreaSplitter = TargetArea->parentSplitter(); int AreaIndex = TargetAreaSplitter->indexOf(TargetArea); auto FloatingSplitter = FloatingContainer->rootSplitter(); if (TargetAreaSplitter->orientation() == InsertParam.orientation()) @@ -742,7 +733,7 @@ } auto InsertParam = internal::dockAreaInsertParameters(area); - QSplitter* TargetAreaSplitter = internal::findParent<QSplitter*>(TargetArea); + auto TargetAreaSplitter = TargetArea->parentSplitter(); int AreaIndex = TargetAreaSplitter->indexOf(TargetArea); auto Sizes = TargetAreaSplitter->sizes(); if (TargetAreaSplitter->orientation() == InsertParam.orientation()) @@ -877,7 +868,7 @@ // it already has and do nothing, if it is the same place. It would // also work without this check, but it looks nicer with the check // because there will be no layout updates - auto Splitter = internal::findParent<CDockSplitter*>(DroppedDockArea); + auto Splitter = DroppedDockArea->parentSplitter(); auto InsertParam = internal::dockAreaInsertParameters(area); if (Splitter == RootSplitter && InsertParam.orientation() == Splitter->orientation()) { @@ -1364,7 +1355,7 @@ NewDockArea->addDockWidget(Dockwidget); auto InsertParam = internal::dockAreaInsertParameters(area); - QSplitter* TargetAreaSplitter = internal::findParent<QSplitter*>(TargetDockArea); + auto TargetAreaSplitter = TargetDockArea->parentSplitter(); int index = TargetAreaSplitter ->indexOf(TargetDockArea); if (TargetAreaSplitter->orientation() == InsertParam.orientation()) { @@ -1381,7 +1372,7 @@ { ADS_PRINT("TargetAreaSplitter->orientation() != InsertParam.orientation()"); auto TargetAreaSizes = TargetAreaSplitter->sizes(); - QSplitter* NewSplitter = newSplitter(InsertParam.orientation()); + auto NewSplitter = newSplitter(InsertParam.orientation()); NewSplitter->addWidget(TargetDockArea); insertWidgetIntoSplitter(NewSplitter, NewDockArea, InsertParam.append()); @@ -1572,7 +1563,7 @@ area->disconnect(this); d->DockAreas.removeAll(area); - CDockSplitter* Splitter = internal::findParent<CDockSplitter*>(area); + auto Splitter = area->parentSplitter(); // Remove are from parent splitter and recursively hide tree of parent // splitters if it has no visible content @@ -1943,7 +1934,7 @@ //============================================================================ -QSplitter* CDockContainerWidget::rootSplitter() const +CDockSplitter* CDockContainerWidget::rootSplitter() const { return d->RootSplitter; } Index: scribus/third_party/Qt-Advanced-Docking-System/src/DockContainerWidget.h =================================================================== --- scribus/third_party/Qt-Advanced-Docking-System/src/DockContainerWidget.h (Revision 26070) +++ scribus/third_party/Qt-Advanced-Docking-System/src/DockContainerWidget.h (Arbeitskopie) @@ -53,6 +53,7 @@ class CDockingStateReader; class CAutoHideSideBar; class CAutoHideTab; +class CDockSplitter; struct AutoHideTabPrivate; struct AutoHideDockContainerPrivate; @@ -94,7 +95,7 @@ /** * Access function for the internal root splitter */ - QSplitter* rootSplitter() const; + CDockSplitter* rootSplitter() const; /** * Creates and initializes a dockwidget auto hide container into the given area. Index: scribus/third_party/Qt-Advanced-Docking-System/src/DockManager.cpp =================================================================== --- scribus/third_party/Qt-Advanced-Docking-System/src/DockManager.cpp (Revision 26070) +++ scribus/third_party/Qt-Advanced-Docking-System/src/DockManager.cpp (Arbeitskopie) @@ -1318,7 +1318,7 @@ { if (ContainedArea) { - auto Splitter = internal::findParent<CDockSplitter*>(ContainedArea); + auto Splitter = ContainedArea->parentSplitter(); if (Splitter) { return Splitter->sizes(); @@ -1335,7 +1335,7 @@ return; } - auto Splitter = internal::findParent<CDockSplitter*>(ContainedArea); + auto Splitter = ContainedArea->parentSplitter(); if (Splitter && Splitter->count() == sizes.count()) { Splitter->setSizes(sizes); Index: scribus/third_party/Qt-Advanced-Docking-System/src/DockManager.h =================================================================== --- scribus/third_party/Qt-Advanced-Docking-System/src/DockManager.h (Revision 26070) +++ scribus/third_party/Qt-Advanced-Docking-System/src/DockManager.h (Arbeitskopie) @@ -214,6 +214,7 @@ //! Users can overwrite this by setting the environment variable ADS_UseNativeTitle to "1" or "0". MiddleMouseButtonClosesTab = 0x2000000, //! If the flag is set, the user can use the mouse middle button to close the tab under the mouse DisableTabTextEliding = 0x4000000, //! Set this flag to disable eliding of tab texts in dock area tabs + ShowTabTextOnlyForActiveTab =0x8000000, //! Set this flag to show label texts in dock area tabs only for active tabs DefaultDockAreaButtons = DockAreaHasCloseButton | DockAreaHasUndockButton @@ -256,8 +257,7 @@ DefaultAutoHideConfig = AutoHideFeatureEnabled | DockAreaHasAutoHideButton - | AutoHideCloseButtonCollapsesDock - | AutoHideHasCloseButton + | AutoHideHasMinimizeButton }; Q_DECLARE_FLAGS(AutoHideFlags, eAutoHideFlag) Index: scribus/third_party/Qt-Advanced-Docking-System/src/DockWidget.cpp =================================================================== --- scribus/third_party/Qt-Advanced-Docking-System/src/DockWidget.cpp (Revision 26070) +++ scribus/third_party/Qt-Advanced-Docking-System/src/DockWidget.cpp (Arbeitskopie) @@ -184,11 +184,11 @@ DockArea->setCurrentDockWidget(_this); DockArea->toggleView(true); TabWidget->show(); - QSplitter* Splitter = internal::findParent<QSplitter*>(DockArea); + auto Splitter = DockArea->parentSplitter(); while (Splitter && !Splitter->isVisible() && !DockArea->isAutoHide()) { Splitter->show(); - Splitter = internal::findParent<QSplitter*>(Splitter); + Splitter = internal::findParent<CDockSplitter*>(Splitter); } CDockContainerWidget* Container = DockArea->dockContainer(); @@ -749,13 +749,12 @@ if (d->DockArea) { d->DockArea->toggleDockWidgetView(this, Open); + if (d->DockArea->isAutoHide()) + { + d->DockArea->autoHideDockContainer()->toggleView(Open); + } } - if (d->DockArea->isAutoHide()) - { - d->DockArea->autoHideDockContainer()->toggleView(Open); - } - if (Open && TopLevelDockWidgetBefore) { CDockWidget::emitTopLevelEventForWidget(TopLevelDockWidgetBefore, false); Index: scribus/third_party/Qt-Advanced-Docking-System/src/DockWidgetTab.cpp =================================================================== --- scribus/third_party/Qt-Advanced-Docking-System/src/DockWidgetTab.cpp (Revision 26070) +++ scribus/third_party/Qt-Advanced-Docking-System/src/DockWidgetTab.cpp (Arbeitskopie) @@ -421,12 +421,13 @@ break; default: - if (CDockManager::testConfigFlag(CDockManager::FocusHighlighting)) - { - d->focusController()->setDockWidgetTabPressed(false); - } - break; // do nothing + break; } + + if (CDockManager::testConfigFlag(CDockManager::FocusHighlighting)) + { + d->focusController()->setDockWidgetTabPressed(false); + } } else if (ev->button() == Qt::MiddleButton) { @@ -580,6 +581,14 @@ { d->updateCloseButtonVisibility(active); + if(CDockManager::testConfigFlag(CDockManager::ShowTabTextOnlyForActiveTab) && !d->Icon.isNull()) + { + if(active) + d->TitleLabel->setVisible(true); + else + d->TitleLabel->setVisible(false); + } + // Focus related stuff if (CDockManager::testConfigFlag(CDockManager::FocusHighlighting) && !d->DockWidget->dockManager()->isRestoringState()) { Index: scribus/third_party/Qt-Advanced-Docking-System/src/ads_globals.h =================================================================== --- scribus/third_party/Qt-Advanced-Docking-System/src/ads_globals.h (Revision 26070) +++ scribus/third_party/Qt-Advanced-Docking-System/src/ads_globals.h (Arbeitskopie) @@ -268,7 +268,7 @@ } parentWidget = parentWidget->parentWidget(); } - return 0; + return nullptr; } /** Index: scribus/third_party/Qt-Advanced-Docking-System/src/stylesheets/focus_highlighting.css =================================================================== --- scribus/third_party/Qt-Advanced-Docking-System/src/stylesheets/focus_highlighting.css (Revision 26070) +++ scribus/third_party/Qt-Advanced-Docking-System/src/stylesheets/focus_highlighting.css (Arbeitskopie) @@ -333,7 +333,7 @@ ads--CAutoHideDockContainer #dockAreaAutoHideButton { - qproperty-icon: url(:/ads/images/vs-pin-button-pinned-focused.svg), + qproperty-icon: url(:/ads/images/vs-pin-button-pinned-focused.svg); qproperty-iconSize: 16px; } Index: scribus/ui/colorlistbox.h =================================================================== --- scribus/ui/colorlistbox.h (Revision 26070) +++ scribus/ui/colorlistbox.h (Arbeitskopie) @@ -93,7 +93,7 @@ The list is cleared itself. Then is rendered an icon with color attributes (RGB/CMYK/Spot etc.). \param list a ColorList to present. */ - void setColors(ColorList& list, bool insertNone); + void setColors(ColorList &list, bool insertNone); /*! \brief Set the current color */ void setCurrentColor(QString colorName); Index: scribus/ui/colorpalette.cpp =================================================================== --- scribus/ui/colorpalette.cpp (Revision 26070) +++ scribus/ui/colorpalette.cpp (nicht existent) @@ -1,1913 +0,0 @@ -/* -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. -*/ -/*************************************************************************** - colorpalette.cpp - description - ------------------- - begin : Wed Apr 25 2001 - copyright : (C) 2001 by Franz Schmid - email : 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. * - * * - ***************************************************************************/ - -#include "colorpalette.h" - -#include <QAbstractItemView> -#include <QEvent> -#include <QFont> -#include <QFrame> -#include <QGridLayout> -#include <QGroupBox> -#include <QHBoxLayout> -#include <QLabel> -#include <QListWidget> -#include <QListWidgetItem> -#include <QPixmap> -#include <QRect> -#include <QSpacerItem> -#include <QSpinBox> -#include <QStandardItem> -#include <QToolButton> -#include <QToolTip> -#include <QVBoxLayout> -#include <QCheckBox> -#include <QDebug> - -#include "colorlistbox.h" -#include "commonstrings.h" -#include "gradienteditor.h" -#include "iconmanager.h" -#include "insertTable.h" -#include "pageitem.h" -#include "sccolorengine.h" -#include "sclistwidgetdelegate.h" -#include "scpage.h" -#include "scpainter.h" -#include "scpattern.h" -#include "scribus.h" -#include "scribusdoc.h" -#include "scribusview.h" -#include "scrspinbox.h" -#include "selection.h" -#include "undomanager.h" -#include "units.h" -#include "util.h" - - -ColorPalette::ColorPalette(QWidget* parent) : QWidget(parent) -{ - undoManager = UndoManager::instance(); - CGradDia = new GradientVectorDialog(this->parentWidget()); - CGradDia->hide(); - - setupUi(this); - fillModeCombo->addItem( tr("Solid") ); - fillModeCombo->addItem( tr("Gradient") ); - fillModeCombo->addItem( tr("Hatch") ); - fillShade->setDecimals(0); - strokeShade->setDecimals(0); - color1Alpha->setDecimals(0); - color2Alpha->setDecimals(0); - color3Alpha->setDecimals(0); - color4Alpha->setDecimals(0); - color1Shade->setDecimals(0); - color2Shade->setDecimals(0); - color3Shade->setDecimals(0); - color4Shade->setDecimals(0); - shadeMeshPoint->setDecimals(0); - strokeModeCombo->addItem( tr("Solid") ); - strokeModeCombo->addItem( tr("Gradient") ); - - colorPoint1->setPixmapType(ColorCombo::fancyPixmaps); - colorPoint2->setPixmapType(ColorCombo::fancyPixmaps); - colorPoint3->setPixmapType(ColorCombo::fancyPixmaps); - colorPoint4->setPixmapType(ColorCombo::fancyPixmaps); - colorMeshPoint->setPixmapType(ColorCombo::fancyPixmaps); - colorListFill->setPixmapType(ColorListBox::fancyPixmap); - colorListStroke->setPixmapType(ColorListBox::fancyPixmap); - hatchLineColor->setPixmapType(ColorCombo::fancyPixmaps); - hatchBackground->setPixmapType(ColorCombo::fancyPixmaps); - -/* Setting a delegate to display only icons for the patterns */ -/* ScListWidgetDelegate* delegateF = new ScListWidgetDelegate(patternBox, patternBox); - delegateF->setIconOnly(true); - patternBox->setItemDelegate(delegateF); - ScListWidgetDelegate* delegateS = new ScListWidgetDelegate(patternBoxStroke, patternBoxStroke); - delegateS->setIconOnly(true); - patternBoxStroke->setItemDelegate(delegateS); -*/ - gradEdit->layout()->setAlignment(Qt::AlignTop); - gradEditStroke->layout()->setAlignment(Qt::AlignTop); - gradientTypeStroke->setCurrentIndex(0); - - tabFillStroke->setCurrentIndex(0); - setCurrentItem(nullptr); - hatchAngle->setDecimals(0); - hatchAngle->setNewUnit(6); - hatchAngle->setValues(-360, 360, 1, 0); - hatchDist->setDecimals(0); - hatchDist->setNewUnit(0); - hatchDist->setValues(1, 1000, 0, 1); - /*editFillColorSelector->setChecked(true); - editFillColorSelectorButton();*/ -} - -void ColorPalette::connectSignals() -{ - connect(CGradDia, SIGNAL(NewSpecial(double,double,double,double,double,double,double,double,double,double)), this, SIGNAL(NewSpecial(double,double,double,double,double,double,double,double,double,double))); - connect(CGradDia, SIGNAL(paletteShown(bool)), this, SLOT(setActiveGradDia(bool))); - connect(CGradDia, SIGNAL(editGradient(int)), this, SIGNAL(editGradient(int))); - connect(CGradDia, SIGNAL(createNewMesh()), this, SLOT(createNewMeshGradient())); - connect(CGradDia, SIGNAL(resetMesh()), this, SLOT(resetMeshGradient())); - connect(CGradDia, SIGNAL(meshToShape()), this, SLOT(meshGradientToShape())); - connect(CGradDia, SIGNAL(reset1Control()), this, SLOT(resetOneControlPoint())); - connect(CGradDia, SIGNAL(resetAllControl()), this, SLOT(resetAllControlPoints())); - connect(CGradDia, SIGNAL(removePatch()), this, SLOT(handleRemovePatch())); - connect(CGradDia, SIGNAL(snapToMGrid(bool)), this, SLOT(snapToPatchGrid(bool))); - - connect(colorPoint1 , SIGNAL(activated(int)), this, SLOT(setGradientColors())); - connect(colorPoint2 , SIGNAL(activated(int)), this, SLOT(setGradientColors())); - connect(colorPoint3 , SIGNAL(activated(int)), this, SLOT(setGradientColors())); - connect(colorPoint4 , SIGNAL(activated(int)), this, SLOT(setGradientColors())); - connect(color1Alpha , SIGNAL(valueChanged(double)), this, SLOT(setGradientColors())); - connect(color2Alpha , SIGNAL(valueChanged(double)), this, SLOT(setGradientColors())); - connect(color3Alpha , SIGNAL(valueChanged(double)), this, SLOT(setGradientColors())); - connect(color4Alpha , SIGNAL(valueChanged(double)), this, SLOT(setGradientColors())); - connect(color1Shade , SIGNAL(valueChanged(double)), this, SLOT(setGradientColors())); - connect(color2Shade , SIGNAL(valueChanged(double)), this, SLOT(setGradientColors())); - connect(color3Shade , SIGNAL(valueChanged(double)), this, SLOT(setGradientColors())); - connect(color4Shade , SIGNAL(valueChanged(double)), this, SLOT(setGradientColors())); - connect(colorListFill , SIGNAL(currentRowChanged(int)), this, SLOT(selectColorF(int))); - connect(colorListStroke, SIGNAL(currentRowChanged(int)), this, SLOT(selectColorS(int))); - connect(colorMeshPoint , SIGNAL(activated(int)), this, SLOT(updateMeshPoint())); - connect(editMeshColors , SIGNAL(clicked()), this, SLOT(editMeshPointColor())); - connect(editPatternProps , SIGNAL(clicked()) , this, SLOT(changePatternProps())); - connect(editPatternPropsStroke, SIGNAL(clicked()), this, SLOT(changePatternPropsStroke())); - connect(fillModeCombo , SIGNAL(currentIndexChanged(int)), this, SLOT(slotGrad(int))); - connect(fillShade , SIGNAL(valueChanged(double)), this, SIGNAL(NewBrushShade(double))); - connect(followsPath , SIGNAL(clicked()), this, SLOT(toggleStrokePattern())); - connect(gradientTypeStroke , SIGNAL(activated(int)), this, SLOT(slotGradTypeStroke(int))); - connect(gradEdit , SIGNAL(gradientChanged()), this, SLOT(handleFillGradient())); - connect(gradEditButton, SIGNAL(clicked()), this, SLOT(editGradientVector())); - connect(gradEditButtonStroke, SIGNAL(clicked()), this, SLOT(editGradientVectorStroke())); - connect(gradEditStroke, SIGNAL(gradientChanged()), this, SLOT(handleStrokeGradient())); - connect(gradientType , SIGNAL(activated(int)), this, SLOT(slotGradType(int))); - connect(gradientTypeStroke , SIGNAL(activated(int)), this, SLOT(slotGradTypeStroke(int))); - connect(namedGradient , SIGNAL(currentTextChanged(QString)), this, SLOT(setNamedGradient(QString))); - connect(namedGradientStroke, SIGNAL(currentTextChanged(QString)), this, SLOT(setNamedGradientStroke(QString))); - connect(overPrintCombo , SIGNAL(activated(int)), this, SIGNAL(NewOverprint(int))); - connect(patternBox , SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(selectPattern(QListWidgetItem*))); - connect(patternBoxStroke , SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(selectPatternS(QListWidgetItem*))); - connect(shadeMeshPoint , SIGNAL(valueChanged(double)), this, SLOT(updateMeshPoint())); - connect(strokeShade , SIGNAL(valueChanged(double)), this, SIGNAL(NewPenShade(double))); - connect(strokeModeCombo , SIGNAL(currentIndexChanged(int)), this, SLOT(slotGradStroke(int))); - connect(tabFillStroke , SIGNAL(currentChanged(int)), this, SLOT(fillStrokeSelector(int))); - connect(transparencyMeshPoint, SIGNAL(valueChanged(double)), this, SLOT(updateMeshPoint())); - connect(hatchAngle, SIGNAL(valueChanged(double)), this, SLOT(changeHatchProps())); - connect(hatchDist, SIGNAL(valueChanged(double)), this, SLOT(changeHatchProps())); - connect(hatchType, SIGNAL(activated(int)), this, SLOT(changeHatchProps())); - connect(hatchBackground, SIGNAL(activated(int)), this, SLOT(changeHatchProps())); - connect(hatchLineColor, SIGNAL(activated(int)), this, SLOT(changeHatchProps())); - connect(gradientExtend , SIGNAL(activated(int)), this, SLOT(handleGradientExtend(int))); - connect(GradientExtendS , SIGNAL(activated(int)), this, SLOT(handleStrokeGradientExtend(int))); -} - -void ColorPalette::disconnectSignals() -{ - disconnect(CGradDia, SIGNAL(NewSpecial(double,double,double,double,double,double,double,double,double,double)), this, SIGNAL(NewSpecial(double,double,double,double,double,double,double,double,double,double))); - disconnect(CGradDia, SIGNAL(paletteShown(bool)), this, SLOT(setActiveGradDia(bool))); - disconnect(CGradDia, SIGNAL(editGradient(int)), this, SIGNAL(editGradient(int))); - disconnect(CGradDia, SIGNAL(createNewMesh()), this, SLOT(createNewMeshGradient())); - disconnect(CGradDia, SIGNAL(resetMesh()), this, SLOT(resetMeshGradient())); - disconnect(CGradDia, SIGNAL(meshToShape()), this, SLOT(meshGradientToShape())); - disconnect(CGradDia, SIGNAL(reset1Control()), this, SLOT(resetOneControlPoint())); - disconnect(CGradDia, SIGNAL(resetAllControl()), this, SLOT(resetAllControlPoints())); - disconnect(CGradDia, SIGNAL(removePatch()), this, SLOT(handleRemovePatch())); - disconnect(CGradDia, SIGNAL(snapToMGrid(bool)), this, SLOT(snapToPatchGrid(bool))); - - disconnect(colorPoint1 , SIGNAL(activated(int)), this, SLOT(setGradientColors())); - disconnect(colorPoint2 , SIGNAL(activated(int)), this, SLOT(setGradientColors())); - disconnect(colorPoint3 , SIGNAL(activated(int)), this, SLOT(setGradientColors())); - disconnect(colorPoint4 , SIGNAL(activated(int)), this, SLOT(setGradientColors())); - disconnect(color1Alpha , SIGNAL(valueChanged(double)), this, SLOT(setGradientColors())); - disconnect(color2Alpha , SIGNAL(valueChanged(double)), this, SLOT(setGradientColors())); - disconnect(color3Alpha , SIGNAL(valueChanged(double)), this, SLOT(setGradientColors())); - disconnect(color4Alpha , SIGNAL(valueChanged(double)), this, SLOT(setGradientColors())); - disconnect(color1Shade , SIGNAL(valueChanged(double)), this, SLOT(setGradientColors())); - disconnect(color2Shade , SIGNAL(valueChanged(double)), this, SLOT(setGradientColors())); - disconnect(color3Shade , SIGNAL(valueChanged(double)), this, SLOT(setGradientColors())); - disconnect(color4Shade , SIGNAL(valueChanged(double)), this, SLOT(setGradientColors())); - disconnect(colorListFill , SIGNAL(currentRowChanged(int)), this, SLOT(selectColorF(int))); - disconnect(colorListStroke, SIGNAL(currentRowChanged(int)), this, SLOT(selectColorS(int))); - disconnect(colorMeshPoint , SIGNAL(activated(int)), this, SLOT(updateMeshPoint())); - disconnect(editMeshColors , SIGNAL(clicked()), this, SLOT(editMeshPointColor())); - disconnect(editPatternProps , SIGNAL(clicked()) , this, SLOT(changePatternProps())); - disconnect(editPatternPropsStroke, SIGNAL(clicked()), this, SLOT(changePatternPropsStroke())); - disconnect(fillModeCombo , SIGNAL(currentIndexChanged(int)), this, SLOT(slotGrad(int))); - disconnect(fillShade , SIGNAL(valueChanged(double)), this, SIGNAL(NewBrushShade(double))); - disconnect(followsPath , SIGNAL(clicked()), this, SLOT(toggleStrokePattern())); - disconnect(gradientTypeStroke , SIGNAL(activated(int)), this, SLOT(slotGradTypeStroke(int))); - disconnect(gradEdit , SIGNAL(gradientChanged()), this, SLOT(handleFillGradient())); - disconnect(gradEditButton, SIGNAL(clicked()), this, SLOT(editGradientVector())); - disconnect(gradEditButtonStroke, SIGNAL(clicked()), this, SLOT(editGradientVectorStroke())); - disconnect(gradEditStroke, SIGNAL(gradientChanged()), this, SLOT(handleStrokeGradient())); - disconnect(gradientType , SIGNAL(activated(int)), this, SLOT(slotGradType(int))); - disconnect(gradientTypeStroke , SIGNAL(activated(int)), this, SLOT(slotGradTypeStroke(int))); - disconnect(namedGradient , SIGNAL(currentTextChanged(QString)), this, SLOT(setNamedGradient(QString))); - disconnect(namedGradientStroke, SIGNAL(currentTextChanged(QString)), this, SLOT(setNamedGradientStroke(QString))); - disconnect(overPrintCombo , SIGNAL(activated(int)), this, SIGNAL(NewOverprint(int))); - disconnect(patternBox , SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(selectPattern(QListWidgetItem*))); - disconnect(patternBoxStroke , SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(selectPatternS(QListWidgetItem*))); - disconnect(shadeMeshPoint, SIGNAL(valueChanged(double)), this, SLOT(updateMeshPoint())); - disconnect(strokeModeCombo , SIGNAL(currentIndexChanged(int)), this, SLOT(slotGradStroke(int))); - disconnect(strokeShade , SIGNAL(valueChanged(double)), this, SIGNAL(NewPenShade(double))); - disconnect(tabFillStroke , SIGNAL(currentChanged(int)), this, SLOT(fillStrokeSelector(int))); - disconnect(transparencyMeshPoint, SIGNAL(valueChanged(double)), this, SLOT(updateMeshPoint())); - disconnect(hatchAngle, SIGNAL(valueChanged(double)), this, SLOT(changeHatchProps())); - disconnect(hatchDist, SIGNAL(valueChanged(double)), this, SLOT(changeHatchProps())); - disconnect(hatchType, SIGNAL(activated(int)), this, SLOT(changeHatchProps())); - disconnect(hatchBackground, SIGNAL(activated(int)), this, SLOT(changeHatchProps())); - disconnect(hatchLineColor, SIGNAL(activated(int)), this, SLOT(changeHatchProps())); - disconnect(gradientExtend , SIGNAL(activated(int)), this, SLOT(handleGradientExtend(int))); - disconnect(GradientExtendS , SIGNAL(activated(int)), this, SLOT(handleStrokeGradientExtend(int))); -} - -void ColorPalette::setCurrentItem(PageItem* item) -{ - if ((item == nullptr) || (currentItem != item)) - { - editStrokeGradient = 0; - CGradDia->hide(); - editMeshColors->setEnabled(true); - gradEditButton->setEnabled(true); - } - - currentItem = item; - disconnectSignals(); - - if (!currentItem) - return; - - enablePatterns(patternList->count() != 0); - showOverprint(currentItem->doOverprint ? 1 : 0); - showColorValues(currentItem->lineColor(), currentItem->fillColor(), currentItem->lineShade(), currentItem->fillShade()); - showGradient(currentItem->gradientType()); - showGradientStroke(currentItem->strokeGradientType()); - gradEdit->setGradient(currentItem->fill_gradient); - gradEditStroke->setGradient(currentItem->stroke_gradient); - if (!currentItem->gradient().isEmpty()) - { - setCurrentComboItem(namedGradient, currentItem->gradient()); - gradEdit->setGradientEditable(false); - } - else - { - namedGradient->setCurrentIndex(0); - gradEdit->setGradientEditable(true); - } - if (!currentItem->strokeGradient().isEmpty()) - { - setCurrentComboItem(namedGradientStroke, currentItem->strokeGradient()); - gradEditStroke->setGradientEditable(false); - } - else - { - namedGradientStroke->setCurrentIndex(0); - gradEditStroke->setGradientEditable(true); - } - if (currentItem->GrTypeStroke > 0) - { - if (currentItem->GrTypeStroke == Gradient_Linear) - gradientTypeStroke->setCurrentIndex(0); - else - gradientTypeStroke->setCurrentIndex(1); - } - if (currentItem->gradientType() == 12) - setMeshPatchPoint(); - else - setMeshPoint(); - if (CGradDia && gradEditButton->isChecked()) - { - if (tabFillStroke->currentIndex() == 0) - setGradientVectorValues(); - else - setGradientVectorStrokeValues(); - } - editMeshColors->setEnabled(!CGradDia->isVisible()); - gradEditButton->setEnabled(!editMeshColors->isChecked()); - fillModeCombo->setEnabled(!gradEditButton->isChecked() && !editMeshColors->isChecked()); - gradientType->setEnabled(!gradEditButton->isChecked() && !editMeshColors->isChecked()); - strokeModeCombo->setEnabled(!gradEditButtonStroke->isChecked() && !editMeshColors->isChecked()); - gradientTypeStroke->setEnabled(!gradEditButtonStroke->isChecked() && !editMeshColors->isChecked()); - - bool mirrorX, mirrorY; - const ScPatternTransform& patternTrans = currentItem->patternTransform(); - currentItem->patternFlip(mirrorX, mirrorY); - setCurrentPattern(currentItem->pattern(), patternTrans, mirrorX, mirrorY); - const ScStrokePatternTransform& strokePatternTrans = currentItem->strokePatternTransform(); - currentItem->strokePatternFlip(mirrorX, mirrorY); - setCurrentPatternStroke(currentItem->strokePattern(), strokePatternTrans, mirrorX, mirrorY, currentItem->isStrokePatternToPath()); - - connectSignals(); -} - -void ColorPalette::updateFromItem() -{ - setCurrentItem(currentItem); -} - -void ColorPalette::setDocument(ScribusDoc* doc) -{ - this->disconnect(SIGNAL(NewPen(QString))); - this->disconnect(SIGNAL(NewBrush(QString))); - this->disconnect(SIGNAL(NewPenShade(double))); - this->disconnect(SIGNAL(NewBrushShade(double))); - this->disconnect(SIGNAL(NewGradient(int))); - this->disconnect(SIGNAL(NewGradientS(int))); - this->disconnect(SIGNAL(NewPattern(QString))); - this->disconnect(SIGNAL(NewPatternProps(double,double,double,double,double,double,double,bool,bool))); - this->disconnect(SIGNAL(NewOverprint(int))); - this->disconnect(SIGNAL(NewPatternS(QString))); - this->disconnect(SIGNAL(NewPatternTypeS(bool))); - this->disconnect(SIGNAL(NewPatternPropsS(double,double,double,double,double,double,double,double,bool,bool))); - disconnect(displayAllColors, SIGNAL(clicked()), this, SLOT(toggleColorDisplay())); - - if (currentDoc) - { - disconnect(currentDoc->m_Selection, SIGNAL(selectionChanged()), this, SLOT(handleSelectionChanged())); - disconnect(currentDoc , SIGNAL(docChanged()) , this, SLOT(handleSelectionChanged())); - disconnect(currentDoc->scMW() , SIGNAL(UpdateRequest(int)), this, SLOT(handleUpdateRequest(int))); - } - - ScribusDoc* oldDoc = currentDoc; - currentDoc = doc; - - if (doc == nullptr) - { - colorListStroke->cList = nullptr; - colorListFill->cList = nullptr; - disconnectSignals(); - } - else - { - colorListStroke->cList = &doc->PageColors; - colorListFill->cList = &doc->PageColors; - gradEdit->setColors(doc->PageColors); - currentUnit = doc->unitIndex(); - - updateColorList(); - updateCList(); - - connect(this, SIGNAL(NewPen(QString)) , doc, SLOT(itemSelection_SetItemPen(QString))); - connect(this, SIGNAL(NewBrush(QString)) , doc, SLOT(itemSelection_SetItemBrush(QString))); - connect(this, SIGNAL(NewPenShade(double)) , this, SLOT(handleStrokeShade(double))); - connect(this, SIGNAL(NewBrushShade(double)) , this, SLOT(handleFillShade(double))); - connect(this, SIGNAL(NewGradient(int)) , doc, SLOT(itemSelection_SetItemGradFill(int))); - connect(this, SIGNAL(NewGradientS(int)) , doc, SLOT(itemSelection_SetItemGradStroke(int))); - connect(this, SIGNAL(NewPattern(QString)) , doc, SLOT(itemSelection_SetItemPatternFill(QString))); - connect(this, SIGNAL(NewPatternProps(double,double,double,double,double,double,double,bool,bool)), doc, SLOT(itemSelection_SetItemPatternProps(double,double,double,double,double,double,double,bool,bool))); - connect(this, SIGNAL(NewOverprint(int)) , this, SLOT(handleOverprint(int))); - connect(this, SIGNAL(NewPatternS(QString)) , doc, SLOT(itemSelection_SetItemStrokePattern(QString))); - connect(this, SIGNAL(NewPatternTypeS(bool)), doc, SLOT(itemSelection_SetItemStrokePatternType(bool))); - connect(this, SIGNAL(NewPatternPropsS(double,double,double,double,double,double,double,double,bool,bool)), doc, SLOT(itemSelection_SetItemStrokePatternProps(double,double,double,double,double,double,double,double,bool,bool))); - connect(displayAllColors, SIGNAL(clicked()), this, SLOT(toggleColorDisplay())); - - connect(currentDoc->m_Selection, SIGNAL(selectionChanged()), this, SLOT(handleSelectionChanged())); - connect(currentDoc , SIGNAL(docChanged()) , this, SLOT(handleSelectionChanged())); - connect(currentDoc->scMW() , SIGNAL(UpdateRequest(int)), this, SLOT(handleUpdateRequest(int))); - } - - if (oldDoc != currentDoc) - { - showGradient(0); - } -} - -PageItem* ColorPalette::currentItemFromSelection() -{ - PageItem *currentItem = nullptr; - if (currentDoc) - currentItem = currentDoc->m_Selection->itemAt(0); - return currentItem; -} - -void ColorPalette::enablePatterns(bool enable) -{ - if (enable) - { - if (fillModeCombo->count() < 4) - fillModeCombo->addItem( tr("Pattern") ); - if (strokeModeCombo->count() < 3) - strokeModeCombo->addItem( tr("Pattern") ); - } - else - { - if (fillModeCombo->count() == 4) - fillModeCombo->removeItem(3); - if (strokeModeCombo->count() == 3) - strokeModeCombo->removeItem(2); - } -} - -void ColorPalette::handleSelectionChanged() -{ - if (currentDoc && !updatesBlocked()) - { - PageItem* currentItem = currentItemFromSelection(); - setCurrentItem(currentItem); - } -} - -void ColorPalette::handleUpdateRequest(int updateFlags) -{ - if (updateFlags & reqColorsUpdate) - updateColorList(); -} - -void ColorPalette::updateColorList() -{ - if (!currentDoc) - return; - - if (currentItem) - disconnectSignals(); - - this->setColors(currentDoc->PageColors); - this->setGradients(¤tDoc->docGradients); - this->setPatterns(¤tDoc->docPatterns); - - if (currentItem) - setCurrentItem(currentItem); -} - -void ColorPalette::updateCList() -{ - bool sigBlocked1 = colorListStroke->blockSignals(true); - bool sigBlocked2 = colorListFill->blockSignals(true); - - if (displayAllColors->isChecked()) - { - if (currentDoc != nullptr) - currentDoc->getUsedColors(colorList); - } - colorListFill->setColors(colorList, true); - colorListStroke->setColors(colorList, true); - gradEditStroke->setColors(colorList); - gradEdit->setColors(colorList); - colorPoint1->setColors(colorList, true); - colorPoint2->setColors(colorList, true); - colorPoint3->setColors(colorList, true); - colorPoint4->setColors(colorList, true); - colorMeshPoint->setColors(colorList, true); - colorListFill->clearSelection(); - colorListStroke->clearSelection(); - hatchLineColor->setColors(colorList, false); - hatchBackground->setColors(colorList, true); - - colorListStroke->blockSignals(sigBlocked1); - colorListFill->blockSignals(sigBlocked2); -} - -void ColorPalette::toggleColorDisplay() -{ - if (!currentDoc) - return; - colorListStroke->cList = ¤tDoc->PageColors; - colorListFill->cList = ¤tDoc->PageColors; - colorList = currentDoc->PageColors; - updateColorList(); -} - -void ColorPalette::showOverprint(int val) -{ - bool sigBlocked = overPrintCombo->blockSignals(true); - overPrintCombo->setCurrentIndex(val); - overPrintCombo->blockSignals(sigBlocked); -} - -void ColorPalette::handleFillShade(double val) -{ - if (!currentDoc) - return; - blockUpdates(true); - currentDoc->itemSelection_SetItemBrushShade(static_cast<int>(val)); - blockUpdates(false); -} - -void ColorPalette::handleStrokeShade(double val) -{ - if (!currentDoc) - return; - blockUpdates(true); - currentDoc->itemSelection_SetItemPenShade(static_cast<int>(val)); - blockUpdates(false); -} - -void ColorPalette::handleOverprint(int val) -{ - if (!currentDoc) - return; - bool setter = true; - if (val == 0) - setter = false; - currentDoc->itemSelection_SetOverprint(setter); -} - -void ColorPalette::handleFillGradient() -{ - if (!currentDoc) - return; - VGradient gradient(gradEdit->gradient()); - blockUpdates(true); - currentDoc->updateManager()->setUpdatesDisabled(); - currentDoc->itemSelection_SetFillGradient(gradient); - currentDoc->updateManager()->setUpdatesEnabled(); - blockUpdates(false); -} - -void ColorPalette::handleStrokeGradient() -{ - if (!currentDoc) - return; - VGradient gradient(gradEditStroke->gradient()); - blockUpdates(true); - currentDoc->updateManager()->setUpdatesDisabled(); - currentDoc->itemSelection_SetLineGradient(gradient); - currentDoc->updateManager()->setUpdatesEnabled(); - blockUpdates(false); -} - -void ColorPalette::handleStrokeGradientExtend(int val) -{ - if (!currentDoc) - return; - if (val == 0) - currentItem->setStrokeGradientExtend(VGradient::none); - else - currentItem->setStrokeGradientExtend(VGradient::pad); - currentItem->update(); - currentDoc->regionsChanged()->update(QRect()); -} - -void ColorPalette::handleGradientExtend(int val) -{ - if (!currentDoc) - return; - if (val == 0) - currentItem->setGradientExtend(VGradient::none); - else - currentItem->setGradientExtend(VGradient::pad); - currentItem->update(); - currentDoc->regionsChanged()->update(QRect()); -} - -void ColorPalette::showColorValues(const QString& stroke, const QString& fill, int sShade, int fShade) -{ - bool sigBlocked1 = fillShade->blockSignals(true); - bool sigBlocked2 = strokeShade->blockSignals(true); - bool sigBlocked3 = colorListStroke->blockSignals(true); - bool sigBlocked4 = colorListFill->blockSignals(true); - - strokeShade->setValue(sShade); - fillShade->setValue(fShade); - if ((stroke != CommonStrings::None) && (!stroke.isEmpty())) - colorListStroke->setCurrentColor(stroke); - else - colorListStroke->setCurrentRow(0); - if ((fill != CommonStrings::None) && (!fill.isEmpty())) - colorListFill->setCurrentColor(fill); - else - colorListFill->setCurrentRow(0); - - fillShade->blockSignals(sigBlocked1); - strokeShade->blockSignals(sigBlocked2); - colorListStroke->blockSignals(sigBlocked3); - colorListFill->blockSignals(sigBlocked4); -} - -void ColorPalette::selectColorS(int row) -{ - QString colorName; - QVariant varValue = colorListStroke->data(row, Qt::UserRole); - if (varValue.canConvert<ColorPixmapValue>()) - { - ColorPixmapValue value(varValue.value<ColorPixmapValue>()); - colorName = value.m_name; - } - else - { - colorName = varValue.toString(); - } - if (colorName.isEmpty()) - return; - emit NewPen(colorName); -} - -void ColorPalette::selectColorF(int row) -{ - QString colorName; - QVariant varValue = colorListFill->data(row, Qt::UserRole); - if (varValue.canConvert<ColorPixmapValue>()) - { - ColorPixmapValue value(varValue.value<ColorPixmapValue>()); - colorName = value.m_name; - } - else - { - colorName = varValue.toString(); - } - if (colorName.isEmpty()) - return; - emit NewBrush(colorName); -} - -void ColorPalette::setColors(const ColorList& newColorList) -{ - colorList.clear(); - colorList = newColorList; - updateCList(); -} - -void ColorPalette::fillStrokeSelector(int /*index*/) -{ - if (gradEditButton->isChecked() || editMeshColors->isChecked()) - { - editStrokeGradient = 0; - CGradDia->hide(); - editMeshColors->setEnabled(true); - editMeshColors->setChecked(false); - gradEditButton->setEnabled(true); - gradEditButton->setChecked(false); - emit editGradient(editStrokeGradient); - } - updateFromItem(); -} - -/*void ColorPalette::editLineColorSelectorButton() -{ - if (editLineColorSelector->isChecked()) - { - stackedWidget->setCurrentIndex(0); - editFillColorSelector->setChecked(false); - } - updateFromItem(); -} - -void ColorPalette::editFillColorSelectorButton() -{ - if (editFillColorSelector->isChecked()) - { - stackedWidget->setCurrentIndex(1); - editLineColorSelector->setChecked(false); - } - updateFromItem(); -}*/ - -void ColorPalette::updateGradientList() -{ - bool sigBlocked1 = namedGradient->blockSignals(true); - bool sigBlocked2 = namedGradientStroke->blockSignals(true); - - namedGradient->clear(); - namedGradient->setIconSize(QSize(48, 12)); - namedGradient->addItem( tr("Custom")); - namedGradientStroke->clear(); - namedGradientStroke->setIconSize(QSize(48, 12)); - namedGradientStroke->addItem( tr("Custom")); - QStringList patK = gradientList->keys(); - patK.sort(); - for (int i = 0; i < patK.count(); i++) - { - VGradient gr = gradientList->value(patK[i]); - QImage pixm(48, 12, QImage::Format_ARGB32_Premultiplied); - QPainter pb; - QBrush b(QColor(205,205,205), IconManager::instance().loadPixmap("testfill.png")); - pb.begin(&pixm); - pb.fillRect(0, 0, 48, 12, b); - pb.end(); - ScPainter *p = new ScPainter(&pixm, 48, 12); - p->setPen(Qt::black, 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin); - p->setFillMode(ScPainter::Gradient); - p->fill_gradient = gr; - p->setGradient(VGradient::linear, FPoint(0,6), FPoint(48, 6), FPoint(0,0), 1, 0); - p->drawRect(0, 0, 48, 12); - p->end(); - delete p; - QPixmap pm; - pm = QPixmap::fromImage(pixm); - namedGradient->addItem(pm, patK[i]); - namedGradientStroke->addItem(pm, patK[i]); - } - namedGradient->blockSignals(sigBlocked1); - namedGradientStroke->blockSignals(sigBlocked2); -} - -void ColorPalette::setGradients(QHash<QString, VGradient> *docGradients) -{ - gradientList = docGradients; - updateGradientList(); -} - -void ColorPalette::setGradientColors() -{ - QString color1 = colorPoint1->currentText(); - if (color1 == CommonStrings::tr_NoneColor) - color1 = CommonStrings::None; - QString color2 = colorPoint2->currentText(); - if (color2 == CommonStrings::tr_NoneColor) - color2 = CommonStrings::None; - QString color3 = colorPoint3->currentText(); - if (color3 == CommonStrings::tr_NoneColor) - color3 = CommonStrings::None; - QString color4 = colorPoint4->currentText(); - if (color4 == CommonStrings::tr_NoneColor) - color4 = CommonStrings::None; - double t1 = color1Alpha->value() / 100.0; - double t2 = color2Alpha->value() / 100.0; - double t3 = color3Alpha->value() / 100.0; - double t4 = color4Alpha->value() / 100.0; - UndoTransaction trans; - if (UndoManager::undoEnabled()) - trans = undoManager->beginTransaction(Um::Selection, Um::IFill, Um::GradVal, QString(), Um::IFill); - currentItem->set4ColorShade(static_cast<int>(color1Shade->value()), static_cast<int>(color2Shade->value()), static_cast<int>(color3Shade->value()), static_cast<int>(color4Shade->value())); - currentItem->set4ColorTransparency(t1, t2, t3, t4); - currentItem->set4ColorColors(color1, color2, color3, color4); - if (trans) - trans.commit(); - currentItem->update(); -} - -void ColorPalette::setNamedGradient(const QString &name) -{ - if (namedGradient->currentIndex() == 0) - { - gradEdit->setGradient(currentItem->fill_gradient); - currentItem->setGradient(""); - gradEdit->setGradientEditable(true); - } - else - { - gradEdit->setGradient(gradientList->value(name)); - gradEdit->setGradientEditable(false); - currentItem->setGradient(name); - } - if (gradientType->currentIndex() == 0) - emit NewGradient(Gradient_Linear); - else if (gradientType->currentIndex() == 1) - emit NewGradient(Gradient_Radial); - else if (gradientType->currentIndex() == 2) - emit NewGradient(Gradient_Conical); - else if (gradientType->currentIndex() == 3) - { - setGradientColors(); - emit NewGradient(Gradient_4Colors); - } - else if (gradientType->currentIndex() == 4) - emit NewGradient(Gradient_Diamond); - else if (gradientType->currentIndex() == 5) - emit NewGradient(Gradient_Mesh); -} - -void ColorPalette::setNamedGradientStroke(const QString &name) -{ - if (namedGradientStroke->currentIndex() == 0) - { - gradEditStroke->setGradient(currentItem->stroke_gradient); - currentItem->setStrokeGradient(""); - gradEditStroke->setGradientEditable(true); - } - else - { - gradEditStroke->setGradient(gradientList->value(name)); - gradEditStroke->setGradientEditable(false); - currentItem->setStrokeGradient(name); - } - if (gradientTypeStroke->currentIndex() == 0) - emit NewGradientS(Gradient_Linear); - else - emit NewGradientS(Gradient_Radial); -} - -void ColorPalette::updatePatternList() -{ - disconnect(patternBox, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(selectPattern(QListWidgetItem*))); - patternBox->clear(); - patternBox->setIconSize(QSize(48, 48)); - patternBoxStroke->clear(); - patternBoxStroke->setIconSize(QSize(48, 48)); - QStringList patK = patternList->keys(); - patK.sort(); - for (int a = 0; a < patK.count(); a++) - { - ScPattern sp = patternList->value(patK[a]); - QPixmap pm; - if (sp.getPattern()->width() >= sp.getPattern()->height()) - pm = QPixmap::fromImage(sp.getPattern()->scaledToWidth(48, Qt::SmoothTransformation)); - else - pm = QPixmap::fromImage(sp.getPattern()->scaledToHeight(48, Qt::SmoothTransformation)); - QPixmap pm2(48, 48); - pm2.fill(palette().color(QPalette::Base)); - QPainter p; - p.begin(&pm2); - p.drawPixmap(24 - pm.width() / 2, 24 - pm.height() / 2, pm); - p.end(); - QListWidgetItem *item = new QListWidgetItem(pm2, patK[a], patternBox); - item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); - QListWidgetItem *itemS = new QListWidgetItem(pm2, patK[a], patternBoxStroke); - itemS->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); - } - patternBox->clearSelection(); - patternBoxStroke->clearSelection(); - connect(patternBox, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(selectPattern(QListWidgetItem*))); -} - -void ColorPalette::hideEditedPatterns(QStringList names) -{ - for (int i = 0; i < names.count(); i++) - { - QList<QListWidgetItem*> items = patternBox->findItems(names[i], Qt::MatchExactly); - if (items.count() > 0) - items[0]->setHidden(true); - items = patternBoxStroke->findItems(names[i], Qt::MatchExactly); - if (items.count() > 0) - items[0]->setHidden(true); - } -} - -void ColorPalette::setPatterns(QHash<QString, ScPattern> *docPatterns) -{ - patternList = docPatterns; - updatePatternList(); -} - -void ColorPalette::selectPattern(QListWidgetItem *c) -{ - if (c == nullptr) - return; - emit NewPattern(c->text()); -} - -void ColorPalette::selectPatternS(QListWidgetItem *c) -{ - if (c == nullptr) - return; - emit NewPatternS(c->text()); -} - -void ColorPalette::setCurrentPatternStroke(const QString& pattern, const ScStrokePatternTransform& patternTrans, bool mirrorX, bool mirrorY, bool pathF) -{ - bool sigBlocked = patternBoxStroke->blockSignals(true); - QList<QListWidgetItem*> itl = patternBoxStroke->findItems(pattern, Qt::MatchExactly); - if (itl.count() != 0) - { - QListWidgetItem *it = itl[0]; - patternBoxStroke->setCurrentItem(it); - } - else - patternBoxStroke->clearSelection(); - m_strokePatternTrans = patternTrans; - m_Pattern_mirrorXS = mirrorX; - m_Pattern_mirrorYS = mirrorY; - followsPath->setChecked(pathF); - patternBoxStroke->blockSignals(sigBlocked); -} - -void ColorPalette::setCurrentPattern(const QString& pattern, const ScPatternTransform& patternTrans, bool mirrorX, bool mirrorY) -{ - bool sigBlocked = patternBox->blockSignals(true); - QList<QListWidgetItem*> itl = patternBox->findItems(pattern, Qt::MatchExactly); - if (itl.count() != 0) - { - QListWidgetItem *it = itl[0]; - patternBox->setCurrentItem(it); - } - else - patternBox->clearSelection(); - m_patternTrans = patternTrans; - m_Pattern_mirrorX = mirrorX; - m_Pattern_mirrorY = mirrorY; - patternBox->blockSignals(sigBlocked); -} - -void ColorPalette::slotGradStroke(int number) -{ - if (number == 1) - { - bool sigBlocked = namedGradientStroke->blockSignals(true); - if (!currentItem->strokeGradient().isEmpty()) - { - setCurrentComboItem(namedGradientStroke, currentItem->strokeGradient()); - gradEditStroke->setGradient(gradientList->value(currentItem->strokeGradient())); - gradEditStroke->setGradientEditable(false); - } - else - { - namedGradientStroke->setCurrentIndex(0); - gradEditStroke->setGradient(currentItem->stroke_gradient); - gradEditStroke->setGradientEditable(true); - } - emit NewPatternS(""); - if (gradientTypeStroke->currentIndex() == 0) - emit NewGradientS(Gradient_Linear); - else - emit NewGradientS(Gradient_Radial); - namedGradientStroke->blockSignals(sigBlocked); - } - else if (number == 2) - { - emit NewGradientS(Gradient_Pattern); - if (patternBoxStroke->currentItem()) - emit NewPatternS(patternBoxStroke->currentItem()->text()); - } - else - { - emit NewGradientS(Gradient_None); - emit NewPatternS(""); - } - strokeModeStack->setCurrentIndex(number); -} - -void ColorPalette::showGradient(int number) -{ - bool sigBlocked = fillModeCombo->blockSignals(true); - if (number == -1) - { - fillModeCombo->setCurrentIndex(0); - } - if (number == 0) - fillModeCombo->setCurrentIndex(0); - else if (((number > 0) && (number < 8)) || ((number >= 9) && (number <= 13))) - { - if ((number == 5) || (number == 7) || (number == 13)) - { - stackedWidget_2->setCurrentIndex(0); - if ((number == 5) || (number == 7)) - gradientType->setCurrentIndex(1); - if (number == 13) - gradientType->setCurrentIndex(2); - } - else if (number == 9) - { - stackedWidget_2->setCurrentIndex(1); - gradientType->setCurrentIndex(3); - if ((currentItem->GrColorP1 != CommonStrings::None) && (!currentItem->GrColorP1.isEmpty())) - setCurrentComboItem(colorPoint1, currentItem->GrColorP1); - else - colorPoint1->setCurrentIndex(0); - if ((currentItem->GrColorP2 != CommonStrings::None) && (!currentItem->GrColorP2.isEmpty())) - setCurrentComboItem(colorPoint2, currentItem->GrColorP2); - else - colorPoint2->setCurrentIndex(0); - if ((currentItem->GrColorP3 != CommonStrings::None) && (!currentItem->GrColorP3.isEmpty())) - setCurrentComboItem(colorPoint3, currentItem->GrColorP3); - else - colorPoint3->setCurrentIndex(0); - if ((currentItem->GrColorP4 != CommonStrings::None) && (!currentItem->GrColorP4.isEmpty())) - setCurrentComboItem(colorPoint4, currentItem->GrColorP4); - else - colorPoint4->setCurrentIndex(0); - color1Alpha->setValue(qRound(currentItem->GrCol1transp * 100)); - color2Alpha->setValue(qRound(currentItem->GrCol2transp * 100)); - color3Alpha->setValue(qRound(currentItem->GrCol3transp * 100)); - color4Alpha->setValue(qRound(currentItem->GrCol4transp * 100)); - color1Shade->setValue(currentItem->GrCol1Shade); - color2Shade->setValue(currentItem->GrCol2Shade); - color3Shade->setValue(currentItem->GrCol3Shade); - color4Shade->setValue(currentItem->GrCol4Shade); - } - else if (number == 10) - { - stackedWidget_2->setCurrentIndex(0); - gradientType->setCurrentIndex(4); - } - else if (number == 11) - { - stackedWidget_2->setCurrentIndex(2); - if ((currentItem->selectedMeshPointX > -1) && (currentItem->selectedMeshPointY > -1L)) - { - MeshPoint mp = currentItem->meshGradientArray[currentItem->selectedMeshPointX][currentItem->selectedMeshPointY]; - setCurrentComboItem(colorMeshPoint, mp.colorName); - shadeMeshPoint->setValue(mp.shade); - transparencyMeshPoint->setValue(mp.transparency * 100); - } - gradientType->setCurrentIndex(5); - } - else if (number == 12) - { - stackedWidget_2->setCurrentIndex(2); - gradientType->setCurrentIndex(6); - } - else - { - stackedWidget_2->setCurrentIndex(0); - gradientType->setCurrentIndex(0); - } - fillModeCombo->setCurrentIndex(1); - if (currentItem->getGradientExtend() == VGradient::none) - gradientExtend->setCurrentIndex(0); - else - gradientExtend->setCurrentIndex(1); - } - else if (number == 14) - { - fillModeCombo->setCurrentIndex(2); - hatchAngle->setValue(currentItem->hatchAngle); - hatchDist->setValue(currentItem->hatchDistance * unitGetRatioFromIndex(currentUnit)); - hatchType->setCurrentIndex(currentItem->hatchType); - if ((currentItem->hatchForeground != CommonStrings::None) && (!currentItem->hatchForeground.isEmpty())) - setCurrentComboItem(hatchLineColor, currentItem->hatchForeground); - if (currentItem->hatchUseBackground) - { - if (!currentItem->hatchBackground.isEmpty()) - setCurrentComboItem(hatchBackground, currentItem->hatchBackground); - } - else - setCurrentComboItem(hatchBackground, CommonStrings::None); - } - else - { - if (patternList->count() == 0) - { - fillModeCombo->setCurrentIndex(0); - emit NewGradient(Gradient_None); - } - else - fillModeCombo->setCurrentIndex(3); - } - fillModeStack->setCurrentIndex( fillModeCombo->currentIndex() ); - fillModeCombo->blockSignals(sigBlocked); -} - -void ColorPalette::showGradientStroke(int number) -{ - bool sigBlocked = strokeModeCombo->blockSignals(true); - if (number == -1 || number == 0) - strokeModeCombo->setCurrentIndex(0); - else if (number > 0 && number < 8) - { - if (number == 7) - gradientTypeStroke->setCurrentIndex(1); - else - gradientTypeStroke->setCurrentIndex(0); - strokeModeCombo->setCurrentIndex(1); - if (currentItem->getStrokeGradientExtend() == VGradient::none) - GradientExtendS->setCurrentIndex(0); - else - GradientExtendS->setCurrentIndex(1); - } - else - { - if (patternList->count() == 0) - { - strokeModeCombo->setCurrentIndex(0); - emit NewGradientS(Gradient_None); - } - else - strokeModeCombo->setCurrentIndex(2); - } - strokeModeStack->setCurrentIndex( strokeModeCombo->currentIndex() ); - strokeModeCombo->blockSignals(sigBlocked); -} - -void ColorPalette::slotGrad(int number) -{ - if (number == 1) - { - bool sigBlocked1 = gradEdit->blockSignals(true); - bool sigBlocked2 = gradientType->blockSignals(true); - bool sigBlocked3 = namedGradient->blockSignals(true); - if (!currentItem->gradient().isEmpty()) - { - setCurrentComboItem(namedGradient, currentItem->gradient()); - gradEdit->setGradient(gradientList->value(currentItem->gradient())); - gradEdit->setGradientEditable(false); - } - else - { - namedGradient->setCurrentIndex(0); - gradEdit->setGradient(currentItem->fill_gradient); - gradEdit->setGradientEditable(true); - } - if (gradientType->currentIndex() == 0) - { - stackedWidget_2->setCurrentIndex(0); - emit NewGradient(Gradient_Linear); - } - else if (gradientType->currentIndex() == 1) - { - stackedWidget_2->setCurrentIndex(0); - emit NewGradient(Gradient_Radial); - } - else if (gradientType->currentIndex() == 2) - { - stackedWidget_2->setCurrentIndex(0); - emit NewGradient(Gradient_Conical); - } - else if (gradientType->currentIndex() == 3) - { - stackedWidget_2->setCurrentIndex(1); - if ((currentItem->GrColorP1 != CommonStrings::None) && (!currentItem->GrColorP1.isEmpty())) - setCurrentComboItem(colorPoint1, currentItem->GrColorP1); - else - colorPoint1->setCurrentIndex(0); - if ((currentItem->GrColorP2 != CommonStrings::None) && (!currentItem->GrColorP2.isEmpty())) - setCurrentComboItem(colorPoint2, currentItem->GrColorP2); - else - colorPoint2->setCurrentIndex(0); - if ((currentItem->GrColorP3 != CommonStrings::None) && (!currentItem->GrColorP3.isEmpty())) - setCurrentComboItem(colorPoint3, currentItem->GrColorP3); - else - colorPoint3->setCurrentIndex(0); - if ((currentItem->GrColorP4 != CommonStrings::None) && (!currentItem->GrColorP4.isEmpty())) - setCurrentComboItem(colorPoint4, currentItem->GrColorP4); - else - colorPoint4->setCurrentIndex(0); - color1Alpha->setValue(qRound(currentItem->GrCol1transp * 100)); - color2Alpha->setValue(qRound(currentItem->GrCol2transp * 100)); - color3Alpha->setValue(qRound(currentItem->GrCol3transp * 100)); - color4Alpha->setValue(qRound(currentItem->GrCol4transp * 100)); - color1Shade->setValue(currentItem->GrCol1Shade); - color2Shade->setValue(currentItem->GrCol2Shade); - color3Shade->setValue(currentItem->GrCol3Shade); - color4Shade->setValue(currentItem->GrCol4Shade); - emit NewGradient(Gradient_4Colors); - } - else if (gradientType->currentIndex() == 4) - { - stackedWidget_2->setCurrentIndex(0); - emit NewGradient(Gradient_Diamond); - } - else if (gradientType->currentIndex() == 5) - { - stackedWidget_2->setCurrentIndex(2); - if ((currentItem->selectedMeshPointX > -1) && (currentItem->selectedMeshPointY > -1L)) - { - MeshPoint mp = currentItem->meshGradientArray[currentItem->selectedMeshPointX][currentItem->selectedMeshPointY]; - setCurrentComboItem(colorMeshPoint, mp.colorName); - shadeMeshPoint->setValue(mp.shade); - transparencyMeshPoint->setValue(mp.transparency * 100); - } - emit NewGradient(Gradient_Mesh); - } - else if (gradientType->currentIndex() == 6) - { - stackedWidget_2->setCurrentIndex(2); - emit NewGradient(Gradient_PatchMesh); - } - gradEdit->blockSignals(sigBlocked1); - gradientType->blockSignals(sigBlocked2); - namedGradient->blockSignals(sigBlocked3); - } - else if (number == 2) - { - hatchAngle->setValue(currentItem->hatchAngle); - hatchDist->setValue(currentItem->hatchDistance * unitGetRatioFromIndex(currentUnit)); - hatchType->setCurrentIndex(currentItem->hatchType); - if ((currentItem->hatchForeground != CommonStrings::None) && (!currentItem->hatchForeground.isEmpty())) - setCurrentComboItem(hatchLineColor, currentItem->hatchForeground); - if (currentItem->hatchUseBackground) - { - if (!currentItem->hatchBackground.isEmpty()) - setCurrentComboItem(hatchBackground, currentItem->hatchBackground); - } - else - setCurrentComboItem(hatchBackground, CommonStrings::None); - emit NewGradient(Gradient_Hatch); - } - else if (number == 3) - emit NewGradient(Gradient_Pattern); - else - emit NewGradient(Gradient_None); - fillModeStack->setCurrentIndex(number); -} - -void ColorPalette::slotGradType(int type) -{ - if (type == 0) - { - stackedWidget_2->setCurrentIndex(0); - emit NewGradient(Gradient_Linear); - } - else if (type == 1) - { - stackedWidget_2->setCurrentIndex(0); - emit NewGradient(Gradient_Radial); - } - else if (type == 2) - { - stackedWidget_2->setCurrentIndex(0); - emit NewGradient(Gradient_Conical); - } - else if (type == 3) - { - stackedWidget_2->setCurrentIndex(1); - if ((currentItem->GrColorP1 != CommonStrings::None) && (!currentItem->GrColorP1.isEmpty())) - setCurrentComboItem(colorPoint1, currentItem->GrColorP1); - else - colorPoint1->setCurrentIndex(0); - if ((currentItem->GrColorP2 != CommonStrings::None) && (!currentItem->GrColorP2.isEmpty())) - setCurrentComboItem(colorPoint2, currentItem->GrColorP2); - else - colorPoint2->setCurrentIndex(0); - if ((currentItem->GrColorP3 != CommonStrings::None) && (!currentItem->GrColorP3.isEmpty())) - setCurrentComboItem(colorPoint3, currentItem->GrColorP3); - else - colorPoint3->setCurrentIndex(0); - if ((currentItem->GrColorP4 != CommonStrings::None) && (!currentItem->GrColorP4.isEmpty())) - setCurrentComboItem(colorPoint4, currentItem->GrColorP4); - else - colorPoint4->setCurrentIndex(0); - color1Alpha->setValue(qRound(currentItem->GrCol1transp * 100)); - color2Alpha->setValue(qRound(currentItem->GrCol2transp * 100)); - color3Alpha->setValue(qRound(currentItem->GrCol3transp * 100)); - color4Alpha->setValue(qRound(currentItem->GrCol4transp * 100)); - color1Shade->setValue(currentItem->GrCol1Shade); - color2Shade->setValue(currentItem->GrCol2Shade); - color3Shade->setValue(currentItem->GrCol3Shade); - color4Shade->setValue(currentItem->GrCol4Shade); - emit NewGradient(Gradient_4Colors); - } - else if (type == 4) - { - stackedWidget_2->setCurrentIndex(0); - emit NewGradient(Gradient_Diamond); - } - else if (type == 5) - { - stackedWidget_2->setCurrentIndex(2); - if ((currentItem->selectedMeshPointX > -1) && (currentItem->selectedMeshPointY > -1L)) - { - MeshPoint mp = currentItem->meshGradientArray[currentItem->selectedMeshPointX][currentItem->selectedMeshPointY]; - setCurrentComboItem(colorMeshPoint, mp.colorName); - shadeMeshPoint->setValue(mp.shade); - transparencyMeshPoint->setValue(mp.transparency * 100); - } - emit NewGradient(Gradient_Mesh); - } - else if (type == 6) - { - stackedWidget_2->setCurrentIndex(2); - emit NewGradient(Gradient_PatchMesh); - } -} - -void ColorPalette::slotGradTypeStroke(int type) -{ - if (type == 0) - emit NewGradientS(Gradient_Linear); - else - emit NewGradientS(Gradient_Radial); -} - -void ColorPalette::editMeshPointColor() -{ - if (editMeshColors->isChecked()) - { - if (currentItem->gradientType() == 11) - editStrokeGradient = 6; - else if (currentItem->gradientType() == 12) - editStrokeGradient = 8; - else - editStrokeGradient = 0; - gradEditButton->setEnabled(false); - } - else - { - editStrokeGradient = 0; - gradEditButton->setEnabled(true); - } - fillModeCombo->setEnabled(!gradEditButton->isChecked() && !editMeshColors->isChecked()); - gradientType->setEnabled(!gradEditButton->isChecked() && !editMeshColors->isChecked()); - strokeModeCombo->setEnabled(!gradEditButtonStroke->isChecked() && !editMeshColors->isChecked()); - gradientTypeStroke->setEnabled(!gradEditButtonStroke->isChecked() && !editMeshColors->isChecked()); - emit editGradient(editStrokeGradient); -} - -void ColorPalette::createNewMeshGradient() -{ - InsertTable* dia = new InsertTable(this, 255, 255); - dia->setWindowTitle( tr( "Create Mesh" ) ); - if (dia->exec()) - { - currentItem->createGradientMesh(dia->Rows->value(), dia->Cols->value()); - currentItem->update(); - currentDoc->regionsChanged()->update(QRect()); - } - delete dia; -} - -void ColorPalette::resetMeshGradient() -{ - currentItem->resetGradientMesh(); - currentItem->update(); - currentDoc->regionsChanged()->update(QRect()); -} - -void ColorPalette::meshGradientToShape() -{ - currentItem->meshToShape(); - currentItem->update(); - currentDoc->regionsChanged()->update(QRect()); -} - -void ColorPalette::resetOneControlPoint() -{ - int grow = currentItem->selectedMeshPointX; - int gcol = currentItem->selectedMeshPointY; - int cont = currentItem->selectedMeshControlPoint; - MeshPoint tmp; - if (currentItem->gradientType() == 12) - { - if ((grow == -1) || (gcol == 0)) - return; - ScOldNewState<MeshPoint> *ss = nullptr; - if (UndoManager::undoEnabled()) - { - ss = new ScOldNewState<MeshPoint>(Um::GradPos); - ss->set("MOVE_MESH_PATCH"); - ss->set("ARRAY", false); - ss->set("X", grow); - ss->set("Y", gcol); - } - switch (gcol) - { - case 1: - tmp = currentItem->meshGradientPatches[grow].TL; - if (cont == 2) - tmp.controlBottom = tmp.gridPoint; - if (cont == 4) - tmp.controlRight = tmp.gridPoint; - if (UndoManager::undoEnabled()) - ss->setStates(currentItem->meshGradientPatches[grow].TL, tmp); - currentItem->meshGradientPatches[grow].TL = tmp; - break; - case 2: - tmp = currentItem->meshGradientPatches[grow].TR; - if (cont == 2) - tmp.controlBottom = tmp.gridPoint; - if (cont == 3) - tmp.controlLeft = tmp.gridPoint; - if (UndoManager::undoEnabled()) - ss->setStates(currentItem->meshGradientPatches[grow].TR, tmp); - currentItem->meshGradientPatches[grow].TR = tmp; - break; - case 3: - tmp = currentItem->meshGradientPatches[grow].BR; - if (cont == 1) - tmp.controlTop = tmp.gridPoint; - if (cont == 3) - tmp.controlLeft = tmp.gridPoint; - if (UndoManager::undoEnabled()) - ss->setStates(currentItem->meshGradientPatches[grow].BR, tmp); - currentItem->meshGradientPatches[grow].BR = tmp; - break; - case 4: - tmp = currentItem->meshGradientPatches[grow].BL; - if (cont == 1) - tmp.controlTop = tmp.gridPoint; - if (cont == 4) - tmp.controlRight = tmp.gridPoint; - if (UndoManager::undoEnabled()) - ss->setStates(currentItem->meshGradientPatches[grow].BL, tmp); - currentItem->meshGradientPatches[grow].BL = tmp; - break; - } - if (UndoManager::undoEnabled()) - undoManager->action(currentItem,ss); - } - else - { - if ((grow == -1) || (gcol == -1)) - return; - - tmp = currentItem->meshGradientArray[grow][gcol]; - if (cont == 1) - tmp.controlTop = tmp.gridPoint; - else if (cont == 2) - tmp.controlBottom = tmp.gridPoint; - else if (cont == 3) - tmp.controlLeft = tmp.gridPoint; - else if (cont == 4) - tmp.controlRight = tmp.gridPoint; - - if (UndoManager::undoEnabled()) - { - auto *ss = new ScOldNewState<MeshPoint>(Um::GradPos); - ss->set("MOVE_MESH_PATCH"); - ss->set("ARRAY", true); - ss->set("X", grow); - ss->set("Y", gcol); - ss->setStates(currentItem->meshGradientArray[grow][gcol], tmp); - undoManager->action(currentItem,ss); - } - currentItem->meshGradientArray[grow][gcol] = tmp; - } - currentItem->update(); - currentDoc->regionsChanged()->update(QRect()); -} - -void ColorPalette::resetAllControlPoints() -{ - int grow = currentItem->selectedMeshPointX; - int gcol = currentItem->selectedMeshPointY; - MeshPoint tmp; - if (currentItem->gradientType() == 12) - { - if ((grow == -1) || (gcol == 0)) - return; - ScOldNewState<MeshPoint> *ss = nullptr; - if (UndoManager::undoEnabled()) - { - ss = new ScOldNewState<MeshPoint>(Um::GradPos); - ss->set("MOVE_MESH_PATCH"); - ss->set("ARRAY", false); - ss->set("X", grow); - ss->set("Y", gcol); - } - switch (gcol) - { - case 1: - tmp = currentItem->meshGradientPatches[grow].TL; - tmp.controlTop = tmp.gridPoint; - tmp.controlLeft = tmp.gridPoint; - tmp.controlRight = tmp.gridPoint; - tmp.controlBottom = tmp.gridPoint; - if (UndoManager::undoEnabled()) - ss->setStates(currentItem->meshGradientPatches[grow].TL, tmp); - currentItem->meshGradientPatches[grow].TL = tmp; - break; - case 2: - tmp = currentItem->meshGradientPatches[grow].TR; - tmp.controlTop = tmp.gridPoint; - tmp.controlLeft = tmp.gridPoint; - tmp.controlRight = tmp.gridPoint; - tmp.controlBottom = tmp.gridPoint; - if (UndoManager::undoEnabled()) - ss->setStates(currentItem->meshGradientPatches[grow].TR, tmp); - currentItem->meshGradientPatches[grow].TR = tmp; - break; - case 3: - tmp = currentItem->meshGradientPatches[grow].BR; - tmp.controlTop = tmp.gridPoint; - tmp.controlLeft = tmp.gridPoint; - tmp.controlRight = tmp.gridPoint; - tmp.controlBottom = tmp.gridPoint; - if (UndoManager::undoEnabled()) - ss->setStates(currentItem->meshGradientPatches[grow].BR, tmp); - currentItem->meshGradientPatches[grow].BR = tmp; - break; - case 4: - tmp = currentItem->meshGradientPatches[grow].BL; - tmp.controlTop = tmp.gridPoint; - tmp.controlLeft = tmp.gridPoint; - tmp.controlRight = tmp.gridPoint; - tmp.controlBottom = tmp.gridPoint; - if (UndoManager::undoEnabled()) - ss->setStates(currentItem->meshGradientPatches[grow].BL, tmp); - currentItem->meshGradientPatches[grow].BL = tmp; - break; - } - if (UndoManager::undoEnabled()) - undoManager->action(currentItem,ss); - } - else - { - if ((grow == -1) || (gcol == -1)) - return; - tmp = currentItem->meshGradientArray[grow][gcol]; - tmp.controlTop = tmp.gridPoint; - tmp.controlLeft = tmp.gridPoint; - tmp.controlRight = tmp.gridPoint; - tmp.controlBottom = tmp.gridPoint; - if (UndoManager::undoEnabled()) - { - auto *ss = new ScOldNewState<MeshPoint>(Um::GradPos); - ss->set("MOVE_MESH_PATCH"); - ss->set("ARRAY", true); - ss->set("X", grow); - ss->set("Y", gcol); - ss->setStates(currentItem->meshGradientArray[grow][gcol], tmp); - undoManager->action(currentItem,ss); - } - currentItem->meshGradientArray[grow][gcol] = tmp; - } - currentItem->update(); - currentDoc->regionsChanged()->update(QRect()); -} - -void ColorPalette::editGradientVector() -{ - if (gradEditButton->isChecked()) - { - setGradientVectorValues(); - CGradDia->show(); - } - else - { - CGradDia->hide(); - editMeshColors->setEnabled(true); - } - if (currentItem->gradientType() == 9) - editStrokeGradient = 3; - else if (currentItem->gradientType() == 10) - editStrokeGradient = 4; - else if (currentItem->gradientType() == 11) - editStrokeGradient = 5; - else if (currentItem->gradientType() == 12) - editStrokeGradient = 9; - else - editStrokeGradient = 0; - fillModeCombo->setEnabled(!gradEditButton->isChecked() && !editMeshColors->isChecked()); - gradientType->setEnabled(!gradEditButton->isChecked() && !editMeshColors->isChecked()); - emit editGradient(editStrokeGradient); -} - -void ColorPalette::editGradientVectorStroke() -{ - if (gradEditButtonStroke->isChecked()) - { - setGradientVectorStrokeValues(); - CGradDia->show(); - } - else - { - CGradDia->hide(); - } - editStrokeGradient = 1; - strokeModeCombo->setEnabled(!gradEditButtonStroke->isChecked() && !editMeshColors->isChecked()); - gradientTypeStroke->setEnabled(!gradEditButtonStroke->isChecked() && !editMeshColors->isChecked()); - emit editGradient(editStrokeGradient); -} - -void ColorPalette::setGradientVectorValues() -{ - if (!gradEditButton->isChecked()) - return; - CGradDia->unitChange(currentDoc->unitIndex()); - CGradDia->setValues(currentItem->gradientStartX(), currentItem->gradientStartY(), currentItem->gradientEndX(), currentItem->gradientEndY(), currentItem->GrFocalX, currentItem->GrFocalY, currentItem->GrScale, currentItem->GrSkew, 0, 0); - if (currentItem->gradientType() == 6) - CGradDia->selectLinear(); - else if (currentItem->gradientType() == 7) - CGradDia->selectRadial(); - else if (currentItem->gradientType() == 9) - { - CGradDia->setValues(currentItem->GrControl1.x(), currentItem->GrControl1.y(), currentItem->GrControl2.x(), currentItem->GrControl2.y(), currentItem->GrControl3.x(), currentItem->GrControl3.y(), currentItem->GrControl4.x(), currentItem->GrControl4.y(), 0, 0); - CGradDia->selectFourColor(); - } - else if (currentItem->gradientType() == 10) - { - CGradDia->setValues(currentItem->GrControl1.x(), currentItem->GrControl1.y(), currentItem->GrControl2.x(), currentItem->GrControl2.y(), currentItem->GrControl3.x(), currentItem->GrControl3.y(), currentItem->GrControl4.x(), currentItem->GrControl4.y(), currentItem->GrControl5.x(), currentItem->GrControl5.y()); - CGradDia->selectDiamond(); - } - else if (currentItem->gradientType() == 11) - { - CGradDia->selectMesh(); - editMeshColors->setEnabled(false); - } - else if (currentItem->gradientType() == 12) - { - CGradDia->selectPatchMesh(); - editMeshColors->setEnabled(false); - } - else if (currentItem->gradientType() == 13) - CGradDia->selectConical(); -} - -void ColorPalette::setGradientVectorStrokeValues() -{ - if (!gradEditButtonStroke->isChecked()) - return; - CGradDia->unitChange(currentDoc->unitIndex()); - CGradDia->setValues(currentItem->GrStrokeStartX, currentItem->GrStrokeStartY, currentItem->GrStrokeEndX, currentItem->GrStrokeEndY, currentItem->GrStrokeFocalX, currentItem->GrStrokeFocalY, currentItem->GrStrokeScale, currentItem->GrStrokeSkew, 0, 0); - if (currentItem->strokeGradientType() == 6) - CGradDia->selectLinear(); - else - CGradDia->selectRadial(); -} - -void ColorPalette::setActiveGradDia(bool active) -{ - if (active) - return; - if (editStrokeGradient == 1) - gradEditButtonStroke->setChecked(false); - else - gradEditButton->setChecked(false); - emit editGradient(editStrokeGradient); - fillModeCombo->setEnabled(!gradEditButton->isChecked() && !editMeshColors->isChecked()); - gradientType->setEnabled(!gradEditButton->isChecked() && !editMeshColors->isChecked()); - strokeModeCombo->setEnabled(!gradEditButtonStroke->isChecked() && !editMeshColors->isChecked()); - gradientTypeStroke->setEnabled(!gradEditButtonStroke->isChecked() && !editMeshColors->isChecked()); - editMeshColors->setEnabled(true); -} - -void ColorPalette::setSpecialGradient(double x1, double y1, double x2, double y2, double fx, double fy, double sg, double sk, double cx, double cy) -{ - if (CGradDia) - CGradDia->setValues(x1, y1, x2, y2, fx, fy, sg, sk, cx, cy); -} - -void ColorPalette::setMeshPoint() -{ - if ((currentItem->selectedMeshPointX > -1) && (currentItem->selectedMeshPointY > -1)) - { - colorMeshPoint->setEnabled(true); - shadeMeshPoint->setEnabled(true); - transparencyMeshPoint->setEnabled(true); - MeshPoint mp = currentItem->meshGradientArray[currentItem->selectedMeshPointX][currentItem->selectedMeshPointY]; - setCurrentComboItem(colorMeshPoint, mp.colorName); - shadeMeshPoint->setValue(mp.shade); - transparencyMeshPoint->setValue(mp.transparency * 100); - } - else - { - colorMeshPoint->setEnabled(false); - shadeMeshPoint->setEnabled(false); - transparencyMeshPoint->setEnabled(false); - } -} - -void ColorPalette::endPatchAdd() -{ - CGradDia->endPAddButton(); -} - -void ColorPalette::snapToPatchGrid(bool val) -{ - currentItem->setSnapToPatchGrid(val); -} - -void ColorPalette::handleRemovePatch() -{ - if ((currentItem->selectedMeshPointX > -1) && (currentItem->meshGradientPatches.count() > 1)) - { - if (UndoManager::undoEnabled()) - { - ScItemState<meshGradientPatch> *ss = new ScItemState<meshGradientPatch>(Um::RemoveMeshPatch,"",Um::ILine); - ss->set("REMOVE_MESH_PATCH"); - ss->setItem(currentItem->meshGradientPatches.takeAt(currentItem->selectedMeshPointX)); - ss->set("POS", currentItem->selectedMeshPointX); - undoManager->action(currentItem,ss); - } - currentItem->selectedMeshPointX = -1; - CGradDia->changebuttonRemovePatch((currentItem->selectedMeshPointX > -1) && (currentItem->meshGradientPatches.count() > 1)); - currentItem->update(); - currentDoc->regionsChanged()->update(QRect()); - editStrokeGradient = 9; - emit editGradient(editStrokeGradient); - } -} - -void ColorPalette::updateMeshPoint() -{ - QString color = colorMeshPoint->currentText(); - if (color == CommonStrings::tr_NoneColor) - color = CommonStrings::None; - double t = transparencyMeshPoint->value() / 100.0; - currentItem->setMeshPointColor(currentItem->selectedMeshPointX, currentItem->selectedMeshPointY, color, static_cast<int>(shadeMeshPoint->value()), t, currentDoc->view()->editStrokeGradient == 8); - currentItem->update(); - currentDoc->regionsChanged()->update(QRect()); -} - -void ColorPalette::setMeshPatchPoint() -{ - if ((currentItem->selectedMeshPointX > -1) && (currentItem->selectedMeshPointY > 0)) - { - colorMeshPoint->setEnabled(true); - shadeMeshPoint->setEnabled(true); - transparencyMeshPoint->setEnabled(true); - meshGradientPatch patch = currentItem->meshGradientPatches[currentItem->selectedMeshPointX]; - MeshPoint mp; - switch (currentItem->selectedMeshPointY) - { - case 1: - mp = patch.TL; - break; - case 2: - mp = patch.TR; - break; - case 3: - mp = patch.BR; - break; - case 4: - mp = patch.BL; - break; - } - setCurrentComboItem(colorMeshPoint, mp.colorName); - shadeMeshPoint->setValue(mp.shade); - transparencyMeshPoint->setValue(mp.transparency * 100); - } - else - { - colorMeshPoint->setEnabled(false); - shadeMeshPoint->setEnabled(false); - transparencyMeshPoint->setEnabled(false); - } -} - -void ColorPalette::setMeshPatch() -{ - CGradDia->changebuttonRemovePatch((currentItem->selectedMeshPointX > -1) && (currentItem->meshGradientPatches.count() > 1)); -} - -void ColorPalette::changePatternProps() -{ - PatternPropsDialog *dia = new PatternPropsDialog(this, currentUnit, false); - dia->spinXscaling->setValue(m_patternTrans.scaleX * 100.0); - dia->spinYscaling->setValue(m_patternTrans.scaleY * 100.0); - if (m_patternTrans.scaleX == m_patternTrans.scaleY) - dia->keepScaleRatio->setChecked(true); - dia->spinXoffset->setValue(m_patternTrans.offsetX); - dia->spinYoffset->setValue(m_patternTrans.offsetY); - dia->spinAngle->setValue(m_patternTrans.rotation); - double asina = atan(m_patternTrans.skewX); - dia->spinXSkew->setValue(asina / (M_PI / 180.0)); - double asinb = atan(m_patternTrans.skewY); - dia->spinYSkew->setValue(asinb / (M_PI / 180.0)); - dia->FlipH->setChecked(m_Pattern_mirrorX); - dia->FlipV->setChecked(m_Pattern_mirrorY); - connect(dia, SIGNAL(NewPatternProps(double,double,double,double,double,double,double,bool,bool)), this, SIGNAL(NewPatternProps(double,double,double,double,double,double,double,bool,bool))); - dia->exec(); - m_patternTrans.scaleX = dia->spinXscaling->value() / 100.0; - m_patternTrans.scaleY = dia->spinYscaling->value() / 100.0; - m_patternTrans.offsetX = dia->spinXoffset->value(); - m_patternTrans.offsetY = dia->spinYoffset->value(); - m_patternTrans.rotation = dia->spinAngle->value(); - double skewX = dia->spinXSkew->value(); - double a; - if (skewX == 90.0) - a = 1.0; - else if (skewX == 180.0) - a = 0.0; - else if (skewX == 270.0) - a = -1.0; - else if (skewX == 360.0) - a = 0.0; - else - a = tan(M_PI / 180.0 * skewX); - m_patternTrans.skewX = tan(a); - skewX = dia->spinYSkew->value(); - if (skewX == 90.0) - a = 1.0; - else if (skewX == 180.0) - a = 0.0; - else if (skewX == 270.0) - a = -1.0; - else if (skewX == 360.0) - a = 0.0; - else - a = tan(M_PI / 180.0 * skewX); - m_patternTrans.skewY = tan(a); - m_Pattern_mirrorX = dia->FlipH->isChecked(); - m_Pattern_mirrorY = dia->FlipV->isChecked(); - delete dia; - fillModeCombo->setCurrentIndex(3); - emit NewGradient(Gradient_Pattern); -} - -void ColorPalette::changePatternPropsStroke() -{ - PatternPropsDialog *dia = new PatternPropsDialog(this, currentUnit, true); - dia->spinXscaling->setValue(m_strokePatternTrans.scaleX * 100.0); - dia->spinYscaling->setValue(m_strokePatternTrans.scaleY * 100.0); - if (m_strokePatternTrans.scaleX == m_strokePatternTrans.scaleY) - dia->keepScaleRatio->setChecked(true); - dia->spinXoffset->setValue(m_strokePatternTrans.offsetX); - dia->spinYoffset->setValue(m_strokePatternTrans.offsetY); - dia->spinAngle->setValue(m_strokePatternTrans.rotation); - dia->spinSpacing->setValue(m_strokePatternTrans.space * 100.0); - double asina = atan(m_strokePatternTrans.skewX); - dia->spinXSkew->setValue(asina / (M_PI / 180.0)); - double asinb = atan(m_strokePatternTrans.skewY); - dia->spinYSkew->setValue(asinb / (M_PI / 180.0)); - dia->FlipH->setChecked(m_Pattern_mirrorXS); - dia->FlipV->setChecked(m_Pattern_mirrorYS); - connect(dia, SIGNAL(NewPatternPropsS(double,double,double,double,double,double,double,double,bool,bool)), this, SIGNAL(NewPatternPropsS(double,double,double,double,double,double,double,double,bool,bool))); - dia->exec(); - m_strokePatternTrans.scaleX = dia->spinXscaling->value() / 100.0; - m_strokePatternTrans.scaleY = dia->spinYscaling->value() / 100.0; - m_strokePatternTrans.offsetX = dia->spinXoffset->value(); - m_strokePatternTrans.offsetY = dia->spinYoffset->value(); - m_strokePatternTrans.rotation = dia->spinAngle->value(); - double skewX = dia->spinXSkew->value(); - double a; - if (skewX == 90) - a = 1; - else if (skewX == 180) - a = 0; - else if (skewX == 270) - a = -1; - else if (skewX == 360) - a = 0; - else - a = tan(M_PI / 180.0 * skewX); - m_strokePatternTrans.skewX = tan(a); - skewX = dia->spinYSkew->value(); - if (skewX == 90) - a = 1; - else if (skewX == 180) - a = 0; - else if (skewX == 270) - a = -1; - else if (skewX == 360) - a = 0; - else - a = tan(M_PI / 180.0 * skewX); - m_strokePatternTrans.skewY = tan(a); - m_strokePatternTrans.space = dia->spinSpacing->value() / 100.0; - m_Pattern_mirrorXS = dia->FlipH->isChecked(); - m_Pattern_mirrorYS = dia->FlipV->isChecked(); - delete dia; -} - -void ColorPalette::changeHatchProps() -{ - QString color1 = hatchLineColor->currentText(); - if (color1 == CommonStrings::tr_NoneColor) - color1 = CommonStrings::None; - QString color2 = hatchBackground->currentText(); - if (color2 == CommonStrings::tr_NoneColor) - color2 = CommonStrings::None; - bool useB = (color2 != CommonStrings::None); - double angle = hatchAngle->value(); - double dist = hatchDist->value() / unitGetRatioFromIndex(currentUnit); - currentItem->setHatchParameters(hatchType->currentIndex(), dist, angle, useB, color2, color1); - currentItem->update(); - currentDoc->regionsChanged()->update(QRect()); -} - -void ColorPalette::toggleStrokePattern() -{ - emit NewPatternTypeS(followsPath->isChecked()); -} - -void ColorPalette::unitChange(double, double, int unitIndex) -{ - if (CGradDia) - CGradDia->unitChange(unitIndex); - hatchDist->setNewUnit(unitIndex); - currentUnit = unitIndex; -} - -void ColorPalette::languageChange() -{ - // Needed to avoid issues if an item is selected and patterns are available - if (currentItem) - disconnectSignals(); - - // Save fill tab state - int oldFillModeComboIndex = fillModeCombo->currentIndex(); - int oldGradientTypeIndex = gradientType->currentIndex(); - int oldGradientExtendIndex = gradientExtend->currentIndex(); - int oldHatchTypeIndex = hatchType->currentIndex(); - - // Save stroke tab state - int oldStrokeModeComboIndex = strokeModeCombo->currentIndex(); - int oldGradientTypeStrokeIndex = gradientTypeStroke->currentIndex(); - int oldGradientExtendSIndex = GradientExtendS->currentIndex(); - - // Save properties outside of tabs - int oldOverPrintComboIndex = overPrintCombo->currentIndex(); - - // Retranslate UI - retranslateUi(this); - - fillModeCombo->clear(); - fillModeCombo->addItem( tr("Solid")); - fillModeCombo->addItem( tr("Gradient")); - fillModeCombo->addItem( tr("Hatch")); - - strokeModeCombo->clear(); - strokeModeCombo->addItem( tr("Solid")); - strokeModeCombo->addItem( tr("Gradient")); - - if (currentDoc) - enablePatterns(patternList->count() != 0); - - // Restore properties - fillModeCombo->setCurrentIndex(oldFillModeComboIndex); - gradientType->setCurrentIndex(oldGradientTypeIndex); - gradientExtend->setCurrentIndex(oldGradientExtendIndex); - hatchType->setCurrentIndex(oldHatchTypeIndex); - - strokeModeCombo->setCurrentIndex(oldStrokeModeComboIndex); - gradientTypeStroke->setCurrentIndex(oldGradientTypeStrokeIndex); - GradientExtendS->setCurrentIndex(oldGradientExtendSIndex); - - overPrintCombo->setCurrentIndex(oldOverPrintComboIndex); - - // Reconnect signals if necessary - if (currentItem) - connectSignals(); -} Property changes on: scribus/ui/colorpalette.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:keywords ## -1 +0,0 ## -Author Date Id Revision \ No newline at end of property Index: scribus/ui/colorpalette.h =================================================================== --- scribus/ui/colorpalette.h (Revision 26070) +++ scribus/ui/colorpalette.h (nicht existent) @@ -1,187 +0,0 @@ -/* -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. -*/ -/*************************************************************************** - colorpalette.h - description - ------------------- - begin : Wed Apr 25 2001 - copyright : (C) 2001 by Franz Schmid - email : 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. * - * * - ***************************************************************************/ - -#ifndef COLORPALETTE_H -#define COLORPALETTE_H - -#include <QGroupBox> -#include <QPointer> -#include <QPushButton> -#include <QToolButton> -#include <QWidget> - -#include "scribusapi.h" -#include "gradienteditor.h" -#include "scribusdoc.h" -#include "scpatterntransform.h" -#include "ui/scrpalettebase.h" -#include "ui_colorpalette.h" -#include "ui/gradientvectordialog.h" -#include "ui/patternpropsdialog.h" - -class ColorListBox; -class PageItem; -class ScrSpinBox; -class ScPattern; -class UndoManager; - -/** - *@author Franz Schmid - */ - -class SCRIBUS_API ColorPalette : public QWidget, Ui::colorPalette -{ - Q_OBJECT - - friend class PropertiesPalette; - -public: - ColorPalette(QWidget* parent); - ~ColorPalette() = default; - - void setDocument(ScribusDoc* doc); - - void updateColorList(); - - void setColors(const ColorList& newColorList); - void setGradients(QHash<QString, VGradient> *docGradients); - void setPatterns(QHash<QString, ScPattern> *docPatterns); - - void setCurrentPattern(const QString& pattern, const ScPatternTransform& patternTrans, bool mirrorX, bool mirrorY); - void setCurrentPatternStroke(const QString& pattern, const ScStrokePatternTransform& patternTrans, bool mirrorX, bool mirrorY, bool pathF); - void setSpecialGradient(double x1, double y1, double x2, double y2, double fx, double fy, double sg, double sk, double cx, double cy); - -private: - - PageItem* currentItemFromSelection(); - UndoManager* undoManager {nullptr}; - -public slots: - void handleSelectionChanged(); - void handleUpdateRequest(int); - - /*void editLineColorSelectorButton(); - void editFillColorSelectorButton();*/ - void fillStrokeSelector(int /*index*/); - void handleFillShade(double); - void handleStrokeShade(double); - void handleOverprint(int); - void handleFillGradient(); - void handleStrokeGradient(); - void handleStrokeGradientExtend(int val); - void handleGradientExtend(int val); - void showColorValues(const QString& stroke, const QString& fille, int sShade, int fShade); - void showGradient(int nr); - void showGradientStroke(int nr); - void showOverprint(int); - void toggleColorDisplay(); - void setNamedGradient(const QString &name); - void setNamedGradientStroke(const QString &name); - void selectPattern(QListWidgetItem *c); - void selectPatternS(QListWidgetItem *c); - void hideEditedPatterns(QStringList names); - void selectColorS(int row); - void selectColorF(int row); - void slotGradStroke(int number); - void slotGrad(int nr); - void slotGradType(int type); - void slotGradTypeStroke(int type); - void setGradientColors(); - void editMeshPointColor(); - void createNewMeshGradient(); - void resetMeshGradient(); - void meshGradientToShape(); - void resetOneControlPoint(); - void resetAllControlPoints(); - void editGradientVector(); - void editGradientVectorStroke(); - void setActiveGradDia(bool active); - void setMeshPoint(); - void endPatchAdd(); - void snapToPatchGrid(bool val); - void handleRemovePatch(); - void setMeshPatch(); - void setMeshPatchPoint(); - void updateMeshPoint(); - void changePatternProps(); - void changePatternPropsStroke(); - void toggleStrokePattern(); - void changeHatchProps(); - -signals: - void NewPen(QString); - void NewBrush(QString); - void NewPenShade(double); - void NewBrushShade(double); - void NewGradient(int); - void NewGradientS(int); - void NewPattern(QString); - void NewPatternProps(double, double, double, double, double, double, double, bool, bool); - void NewPatternS(QString); - void NewPatternTypeS(bool); - void NewPatternPropsS(double, double, double, double, double, double, double, double, bool, bool); - void NewSpecial(double, double, double, double, double, double, double, double, double, double); - void NewOverprint(int); - void editGradient(int); - -protected: - ColorList colorList; - GradientVectorDialog* CGradDia { nullptr }; - PageItem* currentItem { nullptr }; - QHash<QString, ScPattern> *patternList { nullptr }; - QHash<QString, VGradient> *gradientList { nullptr }; - QPointer<ScribusDoc> currentDoc; - - ScPatternTransform m_patternTrans; - ScStrokePatternTransform m_strokePatternTrans; - bool m_Pattern_mirrorX { false }; - bool m_Pattern_mirrorXS { false }; - bool m_Pattern_mirrorY { false }; - bool m_Pattern_mirrorYS { false }; - int currentUnit {0}; - int editStrokeGradient {0}; - - void connectSignals(); - void disconnectSignals(); - - void setCurrentItem(PageItem* item); - void updateFromItem(); - - void setGradientVectorValues(); - void setGradientVectorStrokeValues(); - - int m_blockUpdates {0}; - void blockUpdates(bool block) { if (block) ++m_blockUpdates; else --m_blockUpdates; } - bool updatesBlocked() { return (m_blockUpdates > 0); } - - void enablePatterns(bool enable); - - void updateCList(); - void updateGradientList(); - void updatePatternList(); - - void languageChange(); - void unitChange(double, double, int unitIndex); -}; - -#endif Property changes on: scribus/ui/colorpalette.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:keywords ## -1 +0,0 ## -Author Date Id Revision \ No newline at end of property Index: scribus/ui/colorpalette.ui =================================================================== --- scribus/ui/colorpalette.ui (Revision 26070) +++ scribus/ui/colorpalette.ui (nicht existent) @@ -1,1192 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>colorPalette</class> - <widget class="QWidget" name="colorPalette"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>320</width> - <height>360</height> - </rect> - </property> - <layout class="QVBoxLayout" name="verticalLayout"> - <property name="spacing"> - <number>3</number> - </property> - <property name="leftMargin"> - <number>3</number> - </property> - <property name="topMargin"> - <number>3</number> - </property> - <property name="rightMargin"> - <number>3</number> - </property> - <property name="bottomMargin"> - <number>3</number> - </property> - <item> - <widget class="QTabWidget" name="tabFillStroke"> - <property name="currentIndex"> - <number>0</number> - </property> - <widget class="QWidget" name="tabFill"> - <attribute name="title"> - <string>Fill</string> - </attribute> - <layout class="QVBoxLayout" name="verticalLayout_2"> - <property name="spacing"> - <number>3</number> - </property> - <property name="leftMargin"> - <number>3</number> - </property> - <property name="topMargin"> - <number>3</number> - </property> - <property name="rightMargin"> - <number>3</number> - </property> - <property name="bottomMargin"> - <number>3</number> - </property> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_2"> - <property name="spacing"> - <number>3</number> - </property> - <item> - <widget class="QLabel" name="fillModeLabel"> - <property name="text"> - <string>Fill Mode</string> - </property> - </widget> - </item> - <item> - <widget class="QComboBox" name="fillModeCombo"/> - </item> - </layout> - </item> - <item> - <widget class="Line" name="line"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - </widget> - </item> - <item> - <widget class="QStackedWidget" name="fillModeStack"> - <property name="currentIndex"> - <number>0</number> - </property> - <widget class="QWidget" name="solidFillPage"> - <layout class="QVBoxLayout" name="verticalLayout_3"> - <property name="spacing"> - <number>3</number> - </property> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>0</number> - </property> - <property name="bottomMargin"> - <number>0</number> - </property> - <item> - <widget class="ColorListBox" name="colorListFill"/> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_3"> - <property name="spacing"> - <number>3</number> - </property> - <item> - <widget class="QLabel" name="fillShadeLabel"> - <property name="text"> - <string>Shade:</string> - </property> - </widget> - </item> - <item> - <widget class="ScrSpinBox" name="fillShade"> - <property name="suffix"> - <string>%</string> - </property> - <property name="maximum"> - <double>100.000000000000000</double> - </property> - <property name="value"> - <double>100.000000000000000</double> - </property> - </widget> - </item> - </layout> - </item> - </layout> - </widget> - <widget class="QWidget" name="gradientFillPage"> - <layout class="QVBoxLayout" name="verticalLayout_5"> - <property name="spacing"> - <number>3</number> - </property> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>0</number> - </property> - <property name="bottomMargin"> - <number>0</number> - </property> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_4"> - <property name="spacing"> - <number>3</number> - </property> - <item> - <widget class="QComboBox" name="gradientType"> - <item> - <property name="text"> - <string>Linear</string> - </property> - </item> - <item> - <property name="text"> - <string>Radial</string> - </property> - </item> - <item> - <property name="text"> - <string>Conical</string> - </property> - </item> - <item> - <property name="text"> - <string>4 Colors</string> - </property> - </item> - <item> - <property name="text"> - <string>Diamond</string> - </property> - </item> - <item> - <property name="text"> - <string>Mesh</string> - </property> - </item> - <item> - <property name="text"> - <string>Patch Mesh</string> - </property> - </item> - </widget> - </item> - <item> - <widget class="QToolButton" name="gradEditButton"> - <property name="text"> - <string>Move Vector</string> - </property> - <property name="checkable"> - <bool>true</bool> - </property> - </widget> - </item> - </layout> - </item> - <item> - <widget class="QStackedWidget" name="stackedWidget_2"> - <property name="currentIndex"> - <number>0</number> - </property> - <widget class="QWidget" name="page_3"> - <layout class="QVBoxLayout" name="verticalLayout_4"> - <property name="spacing"> - <number>3</number> - </property> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>0</number> - </property> - <property name="bottomMargin"> - <number>0</number> - </property> - <item> - <widget class="QComboBox" name="namedGradient"/> - </item> - <item> - <widget class="GradientEditor" name="gradEdit"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Expanding"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - </widget> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_10"> - <property name="spacing"> - <number>3</number> - </property> - <item> - <widget class="QLabel" name="gradientExtendLabel"> - <property name="text"> - <string>Extend:</string> - </property> - </widget> - </item> - <item> - <widget class="QComboBox" name="gradientExtend"> - <item> - <property name="text"> - <string>None</string> - </property> - </item> - <item> - <property name="text"> - <string>Pad</string> - </property> - </item> - </widget> - </item> - </layout> - </item> - </layout> - </widget> - <widget class="QWidget" name="page_4"> - <layout class="QVBoxLayout" name="verticalLayout_8"> - <property name="spacing"> - <number>3</number> - </property> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>0</number> - </property> - <property name="bottomMargin"> - <number>0</number> - </property> - <item> - <layout class="QGridLayout" name="gridLayout_4"> - <property name="spacing"> - <number>3</number> - </property> - <item row="0" column="0"> - <widget class="QLabel" name="colorPointLabel"> - <property name="text"> - <string>Color</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QLabel" name="colorShadeLabel"> - <property name="text"> - <string>Shade</string> - </property> - </widget> - </item> - <item row="0" column="2"> - <widget class="QLabel" name="colorAlphaLabel"> - <property name="text"> - <string>Transparency</string> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="ColorCombo" name="colorPoint1"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="ScrSpinBox" name="color1Shade"> - <property name="suffix"> - <string> %</string> - </property> - <property name="minimum"> - <double>0.000000000000000</double> - </property> - <property name="maximum"> - <double>100.000000000000000</double> - </property> - <property name="singleStep"> - <double>10.000000000000000</double> - </property> - <property name="value"> - <double>100.000000000000000</double> - </property> - </widget> - </item> - <item row="1" column="2"> - <widget class="ScrSpinBox" name="color1Alpha"> - <property name="suffix"> - <string> %</string> - </property> - <property name="maximum"> - <double>100.000000000000000</double> - </property> - <property name="singleStep"> - <double>10.000000000000000</double> - </property> - <property name="value"> - <double>100.000000000000000</double> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="ColorCombo" name="colorPoint2"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="ScrSpinBox" name="color2Shade"> - <property name="suffix"> - <string> %</string> - </property> - <property name="minimum"> - <double>0.000000000000000</double> - </property> - <property name="maximum"> - <double>100.000000000000000</double> - </property> - <property name="singleStep"> - <double>10.000000000000000</double> - </property> - <property name="value"> - <double>100.000000000000000</double> - </property> - </widget> - </item> - <item row="2" column="2"> - <widget class="ScrSpinBox" name="color2Alpha"> - <property name="suffix"> - <string> %</string> - </property> - <property name="maximum"> - <double>100.000000000000000</double> - </property> - <property name="singleStep"> - <double>10.000000000000000</double> - </property> - <property name="value"> - <double>100.000000000000000</double> - </property> - </widget> - </item> - <item row="3" column="0"> - <widget class="ColorCombo" name="colorPoint3"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - </widget> - </item> - <item row="3" column="1"> - <widget class="ScrSpinBox" name="color3Shade"> - <property name="suffix"> - <string> %</string> - </property> - <property name="minimum"> - <double>0.000000000000000</double> - </property> - <property name="maximum"> - <double>100.000000000000000</double> - </property> - <property name="singleStep"> - <double>10.000000000000000</double> - </property> - <property name="value"> - <double>100.000000000000000</double> - </property> - </widget> - </item> - <item row="3" column="2"> - <widget class="ScrSpinBox" name="color3Alpha"> - <property name="suffix"> - <string> %</string> - </property> - <property name="maximum"> - <double>100.000000000000000</double> - </property> - <property name="singleStep"> - <double>10.000000000000000</double> - </property> - <property name="value"> - <double>100.000000000000000</double> - </property> - </widget> - </item> - <item row="4" column="0"> - <widget class="ColorCombo" name="colorPoint4"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - </widget> - </item> - <item row="4" column="1"> - <widget class="ScrSpinBox" name="color4Shade"> - <property name="suffix"> - <string> %</string> - </property> - <property name="minimum"> - <double>0.000000000000000</double> - </property> - <property name="maximum"> - <double>100.000000000000000</double> - </property> - <property name="singleStep"> - <double>10.000000000000000</double> - </property> - <property name="value"> - <double>100.000000000000000</double> - </property> - </widget> - </item> - <item row="4" column="2"> - <widget class="ScrSpinBox" name="color4Alpha"> - <property name="suffix"> - <string> %</string> - </property> - <property name="maximum"> - <double>100.000000000000000</double> - </property> - <property name="singleStep"> - <double>10.000000000000000</double> - </property> - <property name="value"> - <double>100.000000000000000</double> - </property> - </widget> - </item> - </layout> - </item> - <item> - <spacer name="verticalSpacer"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>70</height> - </size> - </property> - </spacer> - </item> - </layout> - </widget> - <widget class="QWidget" name="page_5"> - <layout class="QVBoxLayout" name="verticalLayout_9"> - <property name="spacing"> - <number>3</number> - </property> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>0</number> - </property> - <property name="bottomMargin"> - <number>0</number> - </property> - <item> - <layout class="QGridLayout" name="gridLayout_5"> - <property name="spacing"> - <number>3</number> - </property> - <item row="0" column="0"> - <widget class="QLabel" name="colorMeshPointLabel"> - <property name="text"> - <string>Color:</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="ColorCombo" name="colorMeshPoint"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="shadeMeshPointLabel"> - <property name="text"> - <string>Shade:</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="ScrSpinBox" name="shadeMeshPoint"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="suffix"> - <string> %</string> - </property> - <property name="minimum"> - <double>0.000000000000000</double> - </property> - <property name="maximum"> - <double>100.000000000000000</double> - </property> - <property name="singleStep"> - <double>10.000000000000000</double> - </property> - <property name="value"> - <double>100.000000000000000</double> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="transparencyMeshPointLabel"> - <property name="text"> - <string>Opacity:</string> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="ScrSpinBox" name="transparencyMeshPoint"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="suffix"> - <string> %</string> - </property> - <property name="maximum"> - <double>100.000000000000000</double> - </property> - <property name="singleStep"> - <double>10.000000000000000</double> - </property> - <property name="value"> - <double>100.000000000000000</double> - </property> - </widget> - </item> - </layout> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_8"> - <property name="spacing"> - <number>3</number> - </property> - <item> - <widget class="QToolButton" name="editMeshColors"> - <property name="text"> - <string>Edit Colors</string> - </property> - <property name="checkable"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <spacer name="horizontalSpacer_2"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - <item> - <spacer name="verticalSpacer_2"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>101</height> - </size> - </property> - </spacer> - </item> - </layout> - </widget> - </widget> - </item> - </layout> - </widget> - <widget class="QWidget" name="page"> - <layout class="QVBoxLayout" name="verticalLayout_12"> - <property name="spacing"> - <number>3</number> - </property> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>0</number> - </property> - <property name="bottomMargin"> - <number>0</number> - </property> - <item> - <layout class="QGridLayout" name="gridLayout"> - <property name="spacing"> - <number>3</number> - </property> - <item row="0" column="0"> - <widget class="QLabel" name="hatchDistLabel"> - <property name="text"> - <string>Distance:</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="ScrSpinBox" name="hatchDist"/> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="hatchAngleLabel"> - <property name="text"> - <string>Angle:</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="ScrSpinBox" name="hatchAngle"> - <property name="minimum"> - <double>-360.000000000000000</double> - </property> - <property name="maximum"> - <double>360.000000000000000</double> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="hatchTypeLabel"> - <property name="text"> - <string>Type:</string> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QComboBox" name="hatchType"> - <item> - <property name="text"> - <string>Single</string> - </property> - </item> - <item> - <property name="text"> - <string>Double</string> - </property> - </item> - <item> - <property name="text"> - <string>Triple</string> - </property> - </item> - </widget> - </item> - <item row="3" column="0"> - <widget class="QLabel" name="hatchLineColorLabel"> - <property name="text"> - <string>Line Color:</string> - </property> - </widget> - </item> - <item row="3" column="1"> - <widget class="ColorCombo" name="hatchLineColor"/> - </item> - <item row="4" column="0"> - <widget class="QLabel" name="hatchBackgroundLabel"> - <property name="text"> - <string>Background:</string> - </property> - </widget> - </item> - <item row="4" column="1"> - <widget class="ColorCombo" name="hatchBackground"/> - </item> - </layout> - </item> - <item> - <spacer name="verticalSpacer_3"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>75</height> - </size> - </property> - </spacer> - </item> - </layout> - </widget> - <widget class="QWidget" name="patternFillPage"> - <layout class="QVBoxLayout" name="verticalLayout_6"> - <property name="spacing"> - <number>3</number> - </property> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>0</number> - </property> - <property name="bottomMargin"> - <number>0</number> - </property> - <item> - <widget class="QListWidget" name="patternBox"> - <property name="movement"> - <enum>QListView::Snap</enum> - </property> - <property name="flow"> - <enum>QListView::LeftToRight</enum> - </property> - <property name="isWrapping" stdset="0"> - <bool>true</bool> - </property> - <property name="resizeMode"> - <enum>QListView::Adjust</enum> - </property> - <property name="viewMode"> - <enum>QListView::IconMode</enum> - </property> - <property name="wordWrap"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_5"> - <property name="spacing"> - <number>3</number> - </property> - <item> - <widget class="QToolButton" name="editPatternProps"> - <property name="text"> - <string>Properties...</string> - </property> - </widget> - </item> - <item> - <spacer name="horizontalSpacer_3"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - </layout> - </widget> - </widget> - </item> - </layout> - </widget> - <widget class="QWidget" name="tabStroke"> - <attribute name="title"> - <string>Stroke</string> - </attribute> - <layout class="QVBoxLayout" name="verticalLayout_11"> - <property name="spacing"> - <number>3</number> - </property> - <property name="leftMargin"> - <number>3</number> - </property> - <property name="topMargin"> - <number>3</number> - </property> - <property name="rightMargin"> - <number>3</number> - </property> - <property name="bottomMargin"> - <number>3</number> - </property> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_6"> - <property name="spacing"> - <number>3</number> - </property> - <item> - <widget class="QLabel" name="strokeModeLabel"> - <property name="text"> - <string>Stroke Mode</string> - </property> - </widget> - </item> - <item> - <widget class="QComboBox" name="strokeModeCombo"/> - </item> - </layout> - </item> - <item> - <widget class="Line" name="line_2"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - </widget> - </item> - <item> - <widget class="QStackedWidget" name="strokeModeStack"> - <property name="currentIndex"> - <number>0</number> - </property> - <widget class="QWidget" name="solidStrokePage"> - <layout class="QVBoxLayout" name="verticalLayout_7"> - <property name="spacing"> - <number>3</number> - </property> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>0</number> - </property> - <property name="bottomMargin"> - <number>0</number> - </property> - <item> - <widget class="ColorListBox" name="colorListStroke"/> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_7"> - <property name="spacing"> - <number>3</number> - </property> - <item> - <widget class="QLabel" name="strokeShadeLabel"> - <property name="text"> - <string>Shade:</string> - </property> - </widget> - </item> - <item> - <widget class="ScrSpinBox" name="strokeShade"> - <property name="suffix"> - <string>%</string> - </property> - <property name="maximum"> - <double>100.000000000000000</double> - </property> - <property name="value"> - <double>100.000000000000000</double> - </property> - </widget> - </item> - </layout> - </item> - </layout> - </widget> - <widget class="QWidget" name="gradientStrokePage"> - <layout class="QVBoxLayout" name="verticalLayout_10"> - <property name="spacing"> - <number>3</number> - </property> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>0</number> - </property> - <property name="bottomMargin"> - <number>0</number> - </property> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_9"> - <property name="spacing"> - <number>3</number> - </property> - <item> - <widget class="QComboBox" name="gradientTypeStroke"> - <item> - <property name="text"> - <string>Linear</string> - </property> - </item> - <item> - <property name="text"> - <string>Radial</string> - </property> - </item> - </widget> - </item> - <item> - <widget class="QToolButton" name="gradEditButtonStroke"> - <property name="text"> - <string>Move Vector</string> - </property> - <property name="checkable"> - <bool>true</bool> - </property> - </widget> - </item> - </layout> - </item> - <item> - <widget class="QComboBox" name="namedGradientStroke"/> - </item> - <item> - <widget class="GradientEditor" name="gradEditStroke"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Expanding"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - </widget> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_12"> - <property name="spacing"> - <number>3</number> - </property> - <item> - <widget class="QLabel" name="GradientExtendSLabel"> - <property name="text"> - <string>Extend:</string> - </property> - </widget> - </item> - <item> - <widget class="QComboBox" name="GradientExtendS"> - <item> - <property name="text"> - <string>None</string> - </property> - </item> - <item> - <property name="text"> - <string>Pad</string> - </property> - </item> - </widget> - </item> - </layout> - </item> - </layout> - </widget> - <widget class="QWidget" name="patternStrokePage"> - <layout class="QVBoxLayout" name="verticalLayout_14"> - <property name="spacing"> - <number>3</number> - </property> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>0</number> - </property> - <property name="bottomMargin"> - <number>0</number> - </property> - <item> - <widget class="QListWidget" name="patternBoxStroke"> - <property name="movement"> - <enum>QListView::Snap</enum> - </property> - <property name="flow"> - <enum>QListView::LeftToRight</enum> - </property> - <property name="isWrapping" stdset="0"> - <bool>true</bool> - </property> - <property name="resizeMode"> - <enum>QListView::Adjust</enum> - </property> - <property name="viewMode"> - <enum>QListView::IconMode</enum> - </property> - <property name="wordWrap"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_11"> - <property name="spacing"> - <number>3</number> - </property> - <item> - <widget class="QToolButton" name="editPatternPropsStroke"> - <property name="text"> - <string>Properties...</string> - </property> - </widget> - </item> - <item> - <spacer name="horizontalSpacer_5"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QCheckBox" name="followsPath"> - <property name="layoutDirection"> - <enum>Qt::RightToLeft</enum> - </property> - <property name="text"> - <string>Pattern follows Path</string> - </property> - </widget> - </item> - </layout> - </item> - </layout> - </widget> - </widget> - </item> - </layout> - </widget> - </widget> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout"> - <property name="spacing"> - <number>3</number> - </property> - <item> - <widget class="QLabel" name="overPrintLabel"> - <property name="text"> - <string>Overprinting</string> - </property> - </widget> - </item> - <item> - <widget class="QComboBox" name="overPrintCombo"> - <item> - <property name="text"> - <string>Knockout</string> - </property> - </item> - <item> - <property name="text"> - <string>Overprint</string> - </property> - </item> - </widget> - </item> - </layout> - </item> - <item> - <widget class="QCheckBox" name="displayAllColors"> - <property name="layoutDirection"> - <enum>Qt::RightToLeft</enum> - </property> - <property name="text"> - <string>Display only used colors</string> - </property> - </widget> - </item> - </layout> - </widget> - <customwidgets> - <customwidget> - <class>ScrSpinBox</class> - <extends>QDoubleSpinBox</extends> - <header>ui/scrspinbox.h</header> - </customwidget> - <customwidget> - <class>GradientEditor</class> - <extends>QFrame</extends> - <header>ui/gradienteditor.h</header> - <container>1</container> - </customwidget> - <customwidget> - <class>ColorListBox</class> - <extends>QListView</extends> - <header>ui/colorlistbox.h</header> - </customwidget> - <customwidget> - <class>ColorCombo</class> - <extends>QComboBox</extends> - <header>ui/colorcombo.h</header> - </customwidget> - </customwidgets> - <resources/> - <connections/> -</ui> Index: scribus/ui/colorpicker/colorpicker.cpp =================================================================== --- scribus/ui/colorpicker/colorpicker.cpp (nicht existent) +++ scribus/ui/colorpicker/colorpicker.cpp (Arbeitskopie) @@ -0,0 +1,766 @@ +#include "colorpicker.h" + +#include <QButtonGroup> +#include "iconmanager.h" +#include "scribus.h" +#include "scribusapp.h" +#include "selection.h" +#include "ui/widgets/popup_menu.h" + +/* ********************************************************************************* * + * + * Constructor + Setup + * + * ********************************************************************************* */ + +ColorPicker::ColorPicker(Context context, QWidget *parent) : QWidget(parent) +{ + setupUi(this); + + comboOverprint = new QComboBox(); + checkboxUsedColors = new QCheckBox(); + + buttonGroup = new QButtonGroup(); + buttonGroup->addButton(buttonSolid, (int)Mode::Solid); + buttonGroup->addButton(buttonGradient, (int)Mode::Gradient); + buttonGroup->addButton(buttonHatch, (int)Mode::Hatch); + buttonGroup->addButton(buttonPattern, (int)Mode::Pattern); + + gradientEdit->setSelector(comboType); // required; gradientEdit has no gradient type selector + comboType->setVisible(false); + buttonPattern->setEnabled(false); // Button will enabled only if there are document patterns + buttonPreview->setFixedSize(32, 32); + + initContextMenu(); + languageChange(); + iconSetChange(); + setContext(context); + + stack->setCurrentWidget(colorEdit); + + // Picker + connect(ScQApp, SIGNAL(iconSetChanged()), this, SLOT(iconSetChange())); + connect(buttonGroup, &QButtonGroup::buttonClicked, this, &ColorPicker::changedTab); + connect(comboOverprint, &QComboBox::activated, this, &ColorPicker::updateOverPrint); + connect(checkboxUsedColors, &QCheckBox::toggled, this, &ColorPicker::toggleColorLists); + connect(stack, &StackedContainer::currentChanged, this, &ColorPicker::updateSize); + // Color + connect(colorEdit, &ColorPickerColor::colorChanged, this, &ColorPicker::updateColor); + connect(colorEdit, &ColorPickerColor::sizeChanged, this, &ColorPicker::updateSize); + // Gradient + connect(gradientEdit, &ColorPickerGradient::gradientChanged, this, &ColorPicker::updateGradient); + connect(gradientEdit, &ColorPickerGradient::gradientVectorChanged, this, &ColorPicker::updateGradientVector); + connect(gradientEdit, &ColorPickerGradient::gradientMeshChanged, this, &ColorPicker::updateGradientMesh); + connect(gradientEdit, &ColorPickerGradient::sizeChanged, this, &ColorPicker::updateSize); + connect(gradientEdit->Properties(), &ColorPickerGradientProperties::createNewMesh, this, &ColorPicker::createNewMesh); + connect(gradientEdit->Properties(), &ColorPickerGradientProperties::resetMesh, this, &ColorPicker::resetMesh); + connect(gradientEdit->Properties(), &ColorPickerGradientProperties::meshToShape, this, &ColorPicker::meshToShape); + connect(gradientEdit->Properties(), &ColorPickerGradientProperties::reset1Control, this, &ColorPicker::reset1Control); + connect(gradientEdit->Properties(), &ColorPickerGradientProperties::resetAllControl, this,&ColorPicker::resetAllControl); + connect(gradientEdit->Properties(), &ColorPickerGradientProperties::removePatch, this, &ColorPicker::removePatch); + connect(gradientEdit->Properties(), &ColorPickerGradientProperties::snapToMGrid, this, &ColorPicker::snapToMGrid); + // Hatch + connect(hatchEdit, &ColorPickerHatch::hatchChanged, this, &ColorPicker::updateHatch); + connect(hatchEdit, &ColorPickerHatch::sizeChanged, this, &ColorPicker::updateSize); + // Pattern + connect(patternEdit, &ColorPickerPattern::patternChanged, this, &ColorPicker::updatePattern); + connect(patternEdit, &ColorPickerPattern::sizeChanged, this, &ColorPicker::updateSize); + +} + +/* ********************************************************************************* * + * + * Members + * + * ********************************************************************************* */ + +void ColorPicker::setGeneralData(CPGeneralData data) +{ + m_generalData = data; + + QSignalBlocker sigOverprint(comboOverprint); + comboOverprint->setCurrentIndex(m_generalData.overprint ? 1 : 0); +} + +CPGeneralData ColorPicker::generalData() +{ + return m_generalData; +} + +void ColorPicker::setColorData(CPColorData data) +{ + QSignalBlocker sig(colorEdit); + colorEdit->setColorData(data); +} + +CPColorData ColorPicker::colorData() const +{ + return colorEdit->colorData(); +} + +void ColorPicker::setGradientData(CPGradientData data) +{ + QSignalBlocker sig(gradientEdit); + gradientEdit->setGradientData(data); + +} + +CPGradientData ColorPicker::gradientData() const +{ + return gradientEdit->gradientData(); +} + +void ColorPicker::setGradientVectorData(CPGradientVectorData data) +{ + QSignalBlocker sig(gradientEdit); + gradientEdit->setGradientVectorData(data); +} + +CPGradientVectorData ColorPicker::gradientVectorData() const +{ + return gradientEdit->gradientVectorData(); +} + +void ColorPicker::setGradientMeshData(CPColorData data) +{ + QSignalBlocker sig(gradientEdit); + gradientEdit->setGradientMeshData(data); +} + +CPColorData ColorPicker::gradientMeshData() +{ + return gradientEdit->gradientMeshData(); +} + +void ColorPicker::setPatternData(CPPatternData data) +{ + QSignalBlocker sig(patternEdit); + patternEdit->setPatternData(data); +} + +CPPatternData ColorPicker::patternData() const +{ + return patternEdit->patternData(); +} + +void ColorPicker::setHatchData(CPHatchData data) +{ + QSignalBlocker sig(hatchEdit); + hatchEdit->setHatchData(data); +} + +CPHatchData ColorPicker::hatchData() const +{ + return hatchEdit->hatchData(); +} + +void ColorPicker::setColorButton(ColorButton *button) +{ + if (m_colorButton != button) + gradientEdit->disableGradientEditProperties(); + + m_colorButton = button; + + if (m_colorButton) + m_colorButton->installEventFilter(this); +} + +ColorButton *ColorPicker::colorButton() +{ + return m_colorButton; +} + +QString ColorPicker::toolTipText() const +{ + switch(m_mode) + { + default: + case Mode::Solid: + return colorEdit->toolTipText(); + break; + case Mode::Gradient: + return gradientEdit->toolTipText(); + break; + case Mode::Hatch: + return hatchEdit->toolTipText(); + break; + case Mode::Pattern: + return patternEdit->toolTipText(); + break; + } + + return QString(); +} + +void ColorPicker::setColorList(const ColorList &list) +{ + colorList = list; + + if (checkboxUsedColors->isChecked() && m_doc != nullptr) + m_doc->getUsedColors(colorList); + + colorEdit->setColorList(colorList, true); + gradientEdit->setColorList(colorList); + hatchEdit->setColorList(colorList); +} + +void ColorPicker::setGradientList(const GradientList &list) +{ + gradientEdit->setGradientList(list); +} + +void ColorPicker::setPatternList(QHash<QString, ScPattern> *docPatterns) +{ + patternEdit->setPatternList(docPatterns); +} + +PageItem *ColorPicker::currentItemFromSelection() +{ + PageItem *currentItem = nullptr; + if (m_doc) + currentItem = m_doc->m_Selection->itemAt(0); + + return currentItem; +} + +bool ColorPicker::eventFilter(QObject *object, QEvent *event) +{ + ColorButton *colButton = qobject_cast<ColorButton*>(object); + if (!colButton) + return false; + + if (colButton == m_colorButton) + { + switch(event->type()) + { + case QEvent::EnabledChange: + case QEvent::Hide: + case QEvent::Close: + gradientEdit->disableGradientEditProperties(); + closeParent(); + return true; + break; + default: + return false; + } + } + + return false; +} + +void ColorPicker::initContextMenu() +{ + IconManager &iconManager = IconManager::instance(); + + QVBoxLayout *layoutMenu = new QVBoxLayout(); + layoutMenu->addWidget(comboOverprint); + layoutMenu->addWidget(checkboxUsedColors); + + QWidget *menu = new QWidget(); + menu->setLayout(layoutMenu); + menu->adjustSize(); + + contextMenu = new PopupMenu(menu); + buttonMenu->setMenu(contextMenu); + buttonMenu->setPopupMode(QToolButton::InstantPopup); + buttonMenu->setIcon(iconManager.loadIcon("context-menu")); +} + +Context ColorPicker::context() +{ + return m_context; +} + +void ColorPicker::setContext(Context config) +{ + if (m_context == config) + return; + + m_context = config; + + setUpdatesEnabled(false); + + colorEdit->setContext(m_context); + gradientEdit->setContext(m_context); + hatchEdit->setContext(m_context); + patternEdit->setContext(m_context); + + switch(m_context) + { + default: + case Context::Simple: + case Context::LineMask: + buttonSolid->setVisible(false); + buttonGradient->setVisible(false); + buttonHatch->setVisible(false); + buttonPattern->setVisible(false); + buttonMenu->setVisible(false); + // menu + checkboxUsedColors->setVisible(false); + comboOverprint->setVisible(false); + break; + case Context::DropShadow: + buttonSolid->setVisible(false); + buttonGradient->setVisible(false); + buttonHatch->setVisible(false); + buttonPattern->setVisible(false); + buttonMenu->setVisible(true); + // menu + checkboxUsedColors->setVisible(true); + comboOverprint->setVisible(false); + break; + case Context::Fill: + buttonSolid->setVisible(true); + buttonGradient->setVisible(true); + buttonHatch->setVisible(true); + buttonPattern->setVisible(true); + buttonMenu->setVisible(true); + // menu + checkboxUsedColors->setVisible(true); + comboOverprint->setVisible(true); + break; + case Context::FillMask: + buttonSolid->setVisible(true); + buttonGradient->setVisible(true); + buttonHatch->setVisible(false); + buttonPattern->setVisible(true); + buttonMenu->setVisible(true); + // menu + checkboxUsedColors->setVisible(true); + comboOverprint->setVisible(false); + break; + case Context::Line: + buttonSolid->setVisible(true); + buttonGradient->setVisible(true); + buttonHatch->setVisible(false); + buttonPattern->setVisible(true); + buttonMenu->setVisible(true); + // menu + checkboxUsedColors->setVisible(true); + comboOverprint->setVisible(true); + break; + } + + setUpdatesEnabled(true); + + updateSize(); +} + +Mode ColorPicker::mode() +{ + return m_mode; +} + +bool ColorPicker::gradientEditPropertiesEnabled() +{ + return gradientEdit->gradientEditPropertiesEnabled() && gradientEdit->isVisible(); +} + +void ColorPicker::setGradientEditPropertiesEnabled(bool enabled) +{ + gradientEdit->setGradientEditPropertiesEnabled(enabled); +} + +GradientEdit ColorPicker::gradientEditMode() +{ + return gradientEdit->gradientEditMode(); +} + +int ColorPicker::type() +{ + return m_type; +} + +void ColorPicker::setType(int type) +{ + m_type = type; +} + +/* ********************************************************************************* * + * + * Methods + * + * ********************************************************************************* */ + +void ColorPicker::loadLists() +{ + if (!m_doc) + return; + + // colors + setColorList(m_doc->PageColors); + + // gradients + GradientList lGradient; + lGradient.addGradients(m_doc->docGradients); + setGradientList(lGradient); + + // patterns + setPatternList(&m_doc->docPatterns); + +} + + +void ColorPicker::unsetDoc() +{ + if (m_doc) + { + disconnect(m_doc->m_Selection, SIGNAL(selectionChanged()), this, SLOT(handleSelectionChanged())); + disconnect(m_doc, SIGNAL(docChanged()), this, SLOT(handleSelectionChanged())); + } + + setDoc(nullptr); +} + +void ColorPicker::updateUiByMode(Mode mode) +{ + if (m_mode == mode) + return; + + m_mode = mode; + + switch(m_mode) + { + case Mode::Solid: + buttonSolid->setChecked(true); + stack->setCurrentWidget(colorEdit); + comboType->setVisible(false); + + break; + case Mode::Gradient: + buttonGradient->setChecked(true); + stack->setCurrentWidget(gradientEdit); + comboType->setVisible(true); + + break; + case Mode::Hatch: + buttonHatch->setChecked(true); + stack->setCurrentWidget(hatchEdit); + comboType->setVisible(false); + + break; + case Mode::Pattern: + buttonPattern->setChecked(true); + stack->setCurrentWidget(patternEdit); + comboType->setVisible(false); + + break; + } + +} + +void ColorPicker::updateUiByType(int type) +{ + setType(type); + + // set UI mode + if (m_context == Context::FillMask) + { + switch(type) + { + case GradMask_None: + updateUiByMode(Mode::Solid); + break; + case GradMask_Linear: + case GradMask_LinearLumAlpha: + case GradMask_Radial: + case GradMask_RadialLumAlpha: + updateUiByMode(Mode::Gradient); + break; + case GradMask_Pattern: + case GradMask_PatternInverted: + case GradMask_PatternLumAlpha: + case GradMask_PatternLumAlphaInverted: + updateUiByMode(Mode::Pattern); + break; + } + } + else + { + switch(type) + { + case Gradient_None: + updateUiByMode(Mode::Solid); + break; + case Gradient_Linear: + case Gradient_Conical: + case Gradient_Radial: + case Gradient_Diamond: + case Gradient_4Colors: + case Gradient_Mesh: + case Gradient_PatchMesh: + updateUiByMode(Mode::Gradient); + break; + case Gradient_Pattern: + updateUiByMode(Mode::Pattern); + break; + case Gradient_Hatch: + updateUiByMode(Mode::Hatch); + break; + } + } +} + +void ColorPicker::updatePreview() +{ + buttonPreview->setToolTip(toolTipText()); + buttonPreview->setContext(context()); + buttonPreview->setDoc(m_doc); + buttonPreview->setType(type()); + buttonPreview->setColorData(colorData()); + buttonPreview->setGradientData(gradientData()); + buttonPreview->setHatchData(hatchData()); + buttonPreview->setPatternData(patternData()); + buttonPreview->updatePreview(); +} + +void ColorPicker::hideEditedPatterns(QStringList names) +{ + patternEdit->hideEditedPatterns(names); +} + +void ColorPicker::enablePatterns() +{ + bool enable = false; + + if (m_doc) + enable = !m_doc->docPatterns.empty(); + + buttonPattern->setEnabled(enable); + + if (!enable && (mode() == Mode::Pattern)) + updateUiByMode(Mode::Solid); + +} + +void ColorPicker::closeParent() +{ + QWidget *widget = static_cast<QWidget*>(parent()); + + if (widget) + widget->close(); +} + + +/* ********************************************************************************* * + * + * Slots + * + * ********************************************************************************* */ + +void ColorPicker::setDoc(ScribusDoc *doc) +{ + if (m_doc) + { + disconnect(m_doc->m_Selection, SIGNAL(selectionChanged()), this, SLOT(handleSelectionChanged())); + disconnect(m_doc , SIGNAL(docChanged()) , this, SLOT(handleSelectionChanged())); + disconnect(m_doc->scMW() , SIGNAL(UpdateRequest(int)), this, SLOT(handleUpdateRequest(int))); + } + + m_doc = doc; + colorEdit->setDoc(m_doc); + gradientEdit->setDoc(m_doc); + hatchEdit->setDoc(m_doc); + patternEdit->setDoc(m_doc); + + if (m_doc) + { + loadLists(); + enablePatterns(); + + // Connect automatic selection handling only if the context handles the items within the color picker + if ( (context() == Context::Fill) || (context() == Context::FillMask) || (context() == Context::Line) || (context() == Context::LineMask)) + { + connect(m_doc->m_Selection, SIGNAL(selectionChanged()), this, SLOT(handleSelectionChanged())); + connect(m_doc , SIGNAL(docChanged()) , this, SLOT(handleSelectionChanged())); + connect(m_doc->scMW() , SIGNAL(UpdateRequest(int)), this, SLOT(handleUpdateRequest(int))); + } + + } +} + +void ColorPicker::languageChange() +{ + colorEdit->languageChange(); + gradientEdit->languageChange(); + hatchEdit->languageChange(); + patternEdit->languageChange(); + + int oldOverPrintComboIndex = comboOverprint->currentIndex(); + QSignalBlocker sigOverPrint(comboOverprint); + comboOverprint->clear(); + comboOverprint->addItem( tr("Knockout") ); + comboOverprint->addItem( tr("Overprint") ); + comboOverprint->setCurrentIndex(oldOverPrintComboIndex); + + checkboxUsedColors->setText( tr("Display only used colors") ); + +} + +void ColorPicker::iconSetChange() +{ + IconManager &iconManager = IconManager::instance(); + + buttonSolid->setIcon( iconManager.loadIcon("colorpicker-solid")); + buttonGradient->setIcon( iconManager.loadIcon("colorpicker-gradient")); + buttonHatch->setIcon( iconManager.loadIcon("colorpicker-hatch")); + buttonPattern->setIcon( iconManager.loadIcon("colorpicker-pattern")); +} + +void ColorPicker::unitChange() +{ + hatchEdit->unitChange(); + patternEdit->unitChange(); +} + +void ColorPicker::parentClosed() +{ + gradientEdit->disableGradientEditProperties(); +} + +void ColorPicker::endPatchAdd() +{ + gradientEdit->Properties()->endPAddButton(); +} + +void ColorPicker::enableButtonRemovePatch(bool enable) +{ + gradientEdit->Properties()->changebuttonRemovePatch(enable); +} + +void ColorPicker::enableMeshColor(bool enable) +{ + gradientEdit->enableMeshColor(enable); +} + +void ColorPicker::toggleColorLists() +{ + if (m_doc) + loadLists(); + + emit colorListChanged(); +} + +void ColorPicker::updateColor() +{ + setType(colorEdit->type()); + updatePreview(); + emit changed(); + emit colorChanged(); +} + +void ColorPicker::updateGradient() +{ + setType(gradientEdit->type()); + updatePreview(); + emit changed(); + emit gradientChanged(); +} + +void ColorPicker::updateGradientVector() +{ + setType(gradientEdit->type()); + emit gradientVectorChanged(); +} + +void ColorPicker::updateGradientMesh() +{ + setType(gradientEdit->type()); + emit gradientMeshChanged(); +} + +void ColorPicker::updateHatch() +{ + setType(hatchEdit->type()); + updatePreview(); + emit changed(); + emit hatchChanged(); +} + +void ColorPicker::updatePattern() +{ + setType(patternEdit->type()); + updatePreview(); + emit changed(); + emit patternChanged(); +} + +void ColorPicker::updateSize() +{ + setUpdatesEnabled(false); + + stack->adjustSize(); + adjustSize(); + + QWidget *parentWidget = qobject_cast<QWidget*>(parent()); + if (parentWidget) + parentWidget->adjustSize(); + + setUpdatesEnabled(true); + + emit sizeChanged(); +} + +void ColorPicker::updateOverPrint(int val) +{ + if (!m_doc) + return; + + bool setter = (val == 0) ? false : true; + m_generalData.overprint = val; + m_doc->itemSelection_SetOverprint(setter); +} + +void ColorPicker::changedTab() +{ + Mode fillMode = static_cast<Mode>(buttonGroup->checkedId()); + updateUiByMode(fillMode); + + switch(fillMode) + { + case Mode::Solid: + updateColor(); + gradientEdit->disableGradientEditProperties(); + break; + case Mode::Gradient: + updateGradient(); + updateGradientMesh(); + gradientEdit->handleGradientEditProperties(); + break; + case Mode::Hatch: + updateHatch(); + gradientEdit->disableGradientEditProperties(); + break; + case Mode::Pattern: + updatePattern(); + gradientEdit->disableGradientEditProperties(); + break; + } + +} + +void ColorPicker::handleSelectionChanged() +{ + if (m_doc) + enablePatterns(); +} + +void ColorPicker::handleUpdateRequest(int updateFlags) +{ + if (updateFlags & reqColorsUpdate) + loadLists(); +} + +/* ********************************************************************************* * + * + * Events + * + * ********************************************************************************* */ + +void ColorPicker::changeEvent(QEvent *e) +{ + if (e->type() == QEvent::LanguageChange) + languageChange(); + + QWidget::changeEvent(e); +} Index: scribus/ui/colorpicker/colorpicker.h =================================================================== --- scribus/ui/colorpicker/colorpicker.h (nicht existent) +++ scribus/ui/colorpicker/colorpicker.h (Arbeitskopie) @@ -0,0 +1,143 @@ +#ifndef COLORPICKER_H +#define COLORPICKER_H + +#include "ui_colorpicker.h" +#include <QWidget> +#include "sccolor.h" +#include "scribusdoc.h" +#include "colorpicker_enum.h" + +class UndoManager; +class PopupMenu; +class ColorButton; + +class ColorPicker : public QWidget, Ui::ColorPicker +{ + Q_OBJECT + +public: + + explicit ColorPicker(Context context = Context::Simple, QWidget *parent = nullptr); + ~ColorPicker() {}; + + void setGeneralData(CPGeneralData data); + CPGeneralData generalData(); + void setColorData(CPColorData data); + CPColorData colorData() const; + void setGradientData(CPGradientData data); + CPGradientData gradientData() const; + void setGradientVectorData(CPGradientVectorData data); + CPGradientVectorData gradientVectorData() const; + void setGradientMeshData(CPColorData data); + CPColorData gradientMeshData(); + void setPatternData(CPPatternData data); + CPPatternData patternData() const; + void setHatchData(CPHatchData data); + CPHatchData hatchData() const; + + void setColorButton(ColorButton *button); + ColorButton *colorButton(); + + QString toolTipText() const; + + Context context(); + void setContext(Context config); + + void setColorList(const ColorList& list); + + Mode mode(); + + bool gradientEditPropertiesEnabled(); + void setGradientEditPropertiesEnabled(bool enabled); + GradientEdit gradientEditMode(); + + int type(); + + void updateUiByType(int type); + void updatePreview(); + + void hideEditedPatterns(QStringList names); + + void loadLists(); + void unsetDoc(); + +public slots: + + void setDoc(ScribusDoc *doc); + void languageChange(); + void iconSetChange(); + void unitChange(); + void parentClosed(); + void endPatchAdd(); + void enableButtonRemovePatch(bool enable); + void enableMeshColor(bool enable); + +private slots: + void toggleColorLists(); + + void updateColor(); + void updateGradient(); + void updateGradientVector(); + void updateGradientMesh(); + void updateHatch(); + void updatePattern(); + void updateSize(); + void updateOverPrint(int val); + + void changedTab(); + + void handleSelectionChanged(); + void handleUpdateRequest(int updateFlags); + +private: + ColorButton * m_colorButton; + QPointer<ScribusDoc> m_doc; + Context m_context {Context::Simple}; + Mode m_mode {Mode::Solid}; + QButtonGroup *buttonGroup; + int m_type; + QComboBox *comboOverprint; + QCheckBox *checkboxUsedColors; + PopupMenu *contextMenu; + ColorList colorList; + CPGeneralData m_generalData; + + PageItem * currentItemFromSelection(); + + bool eventFilter(QObject *object, QEvent *event); + void initContextMenu(); + void setGradientList(const GradientList& list); + void setPatternList(QHash<QString, ScPattern> *docPatterns); + void setType(int type); + void updateUiByMode(Mode mode); + void enablePatterns(); + void closeParent(); + +protected: + void changeEvent(QEvent *e); + +signals: + void changed(); + void sizeChanged(); + void colorChanged(); + void gradientChanged(); + void gradientVectorChanged(); + void gradientVectorEditMode(GradientEdit); + void gradientVectorEdit(bool); + void gradientMeshChanged(); + void hatchChanged(); + void patternChanged(); + void colorListChanged(); + + // Gradient Properties + void createNewMesh(); + void resetMesh(); + void meshToShape(); + void reset1Control(); + void resetAllControl(); + void removePatch(); + void snapToMGrid(bool); + +}; + +#endif // COLORPICKER_H Index: scribus/ui/colorpicker/colorpicker.ui =================================================================== --- scribus/ui/colorpicker/colorpicker.ui (nicht existent) +++ scribus/ui/colorpicker/colorpicker.ui (Arbeitskopie) @@ -0,0 +1,245 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>ColorPicker</class> + <widget class="QWidget" name="ColorPicker"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>360</width> + <height>189</height> + </rect> + </property> + <property name="minimumSize"> + <size> + <width>360</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>360</width> + <height>16777215</height> + </size> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <property name="spacing"> + <number>0</number> + </property> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <layout class="QHBoxLayout" name="layoutButtons"> + <property name="spacing"> + <number>4</number> + </property> + <property name="leftMargin"> + <number>4</number> + </property> + <property name="topMargin"> + <number>4</number> + </property> + <property name="rightMargin"> + <number>4</number> + </property> + <property name="bottomMargin"> + <number>4</number> + </property> + <item> + <widget class="QToolButton" name="buttonSolid"> + <property name="text"> + <string/> + </property> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="checked"> + <bool>true</bool> + </property> + <property name="autoRaise"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QToolButton" name="buttonGradient"> + <property name="text"> + <string/> + </property> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="autoRaise"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QToolButton" name="buttonHatch"> + <property name="text"> + <string/> + </property> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="autoRaise"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QToolButton" name="buttonPattern"> + <property name="text"> + <string/> + </property> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="autoRaise"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout"> + <property name="spacing"> + <number>4</number> + </property> + <property name="leftMargin"> + <number>8</number> + </property> + <property name="topMargin"> + <number>8</number> + </property> + <property name="rightMargin"> + <number>8</number> + </property> + <property name="bottomMargin"> + <number>8</number> + </property> + <item> + <widget class="ColorButton" name="buttonPreview"> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_3"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Fixed</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>8</width> + <height>0</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QComboBox" name="comboType"/> + </item> + <item> + <spacer name="horizontalSpacer_2"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QToolButton" name="buttonMenu"> + <property name="text"> + <string/> + </property> + <property name="popupMode"> + <enum>QToolButton::InstantPopup</enum> + </property> + </widget> + </item> + </layout> + </item> + <item> + <widget class="StackedContainer" name="stack"> + <widget class="ColorPickerColor" name="colorEdit"/> + <widget class="ColorPickerGradient" name="gradientEdit"/> + <widget class="ColorPickerHatch" name="hatchEdit"/> + <widget class="ColorPickerPattern" name="patternEdit"/> + </widget> + </item> + </layout> + </widget> + <customwidgets> + <customwidget> + <class>ColorButton</class> + <extends>QToolButton</extends> + <header>ui/widgets/color_button.h</header> + </customwidget> + <customwidget> + <class>StackedContainer</class> + <extends>QStackedWidget</extends> + <header>ui/widgets/stacked_container.h</header> + <container>1</container> + </customwidget> + <customwidget> + <class>ColorPickerColor</class> + <extends>QWidget</extends> + <header>ui/colorpicker/colorpicker_color.h</header> + <container>1</container> + </customwidget> + <customwidget> + <class>ColorPickerGradient</class> + <extends>QWidget</extends> + <header>ui/colorpicker/colorpicker_gradient.h</header> + <container>1</container> + </customwidget> + <customwidget> + <class>ColorPickerHatch</class> + <extends>QWidget</extends> + <header>ui/colorpicker/colorpicker_hatch.h</header> + <container>1</container> + </customwidget> + <customwidget> + <class>ColorPickerPattern</class> + <extends>QWidget</extends> + <header>ui/colorpicker/colorpicker_pattern.h</header> + <container>1</container> + </customwidget> + </customwidgets> + <resources/> + <connections/> +</ui> Index: scribus/ui/colorpicker/colorpicker_color.cpp =================================================================== --- scribus/ui/colorpicker/colorpicker_color.cpp (nicht existent) +++ scribus/ui/colorpicker/colorpicker_color.cpp (Arbeitskopie) @@ -0,0 +1,190 @@ +#include "colorpicker_color.h" + +/* ********************************************************************************* * + * + * Constructor + Setup + * + * ********************************************************************************* */ + +ColorPickerColor::ColorPickerColor(QWidget *parent) : QWidget(parent) +{ + setupUi(this); + + languageChange(); + + connectSlots(); + connect(sectionSwatches, &SectionContainer::sizeChanged, this, &ColorPickerColor::updateSize); +} + +void ColorPickerColor::connectSlots() +{ + connect(swatches, &ColorPickerColorSwatches::colorChanged, this, &ColorPickerColor::updateColorFromSwatches); + connect(numberShade, &ScrSpinBox::valueChanged, this, &ColorPickerColor::updateColorShade); + connect(numberAlpha, &ScrSpinBox::valueChanged, this, &ColorPickerColor::updateColorAlpha); +} + +void ColorPickerColor::disconnectSlots() +{ + disconnect(swatches, &ColorPickerColorSwatches::colorChanged, this, &ColorPickerColor::updateColorFromSwatches); + disconnect(numberShade, &ScrSpinBox::valueChanged, this, &ColorPickerColor::updateColorShade); + disconnect(numberAlpha, &ScrSpinBox::valueChanged, this, &ColorPickerColor::updateColorAlpha); +} + +/* ********************************************************************************* * + * + * Members + * + * ********************************************************************************* */ + +CPColorData ColorPickerColor::colorData() const +{ + return m_color; +} + +void ColorPickerColor::setColorList(const ColorList &list, bool insertNone) +{ + QSignalBlocker sigSwatches(swatches); + swatches->setColors(list, insertNone); +} + +Context ColorPickerColor::context() +{ + return m_context; +} + +void ColorPickerColor::setContext(Context config) +{ + m_context = config; + isMask = false; + + switch(m_context) + { + default: + case Context::Simple: + sectionSwatches->setVisible(true); + numberShade->setVisible(false); + labelShade->setVisible(false); + numberAlpha->setVisible(false); + labelAlpha->setVisible(false); + break; + case Context::Fill: + sectionSwatches->setVisible(true); + numberShade->setVisible(true); + labelShade->setVisible(true); + numberAlpha->setVisible(false); + labelAlpha->setVisible(false); + break; + case Context::Line: + sectionSwatches->setVisible(true); + numberShade->setVisible(true); + labelShade->setVisible(true); + numberAlpha->setVisible(false); + labelAlpha->setVisible(false); + break; + case Context::FillMask: + case Context::LineMask: + sectionSwatches->setVisible(false); + numberShade->setVisible(false); + labelShade->setVisible(false); + numberAlpha->setVisible(true); + labelAlpha->setVisible(true); + isMask = true; + break; + case Context::DropShadow: + sectionSwatches->setVisible(true); + numberShade->setVisible(true); + labelShade->setVisible(true); + numberAlpha->setVisible(false); + labelAlpha->setVisible(false); + break; + } + + updateSize(); +} + +QString ColorPickerColor::toolTipText() const +{ + int op = 100 - m_color.Opacity * 100.0; + int sh = m_color.Shade; + + if(isMask) + return QString( tr("Opacity: %1 %").arg(op) ); + else + { + QString name = m_color.Name.isEmpty() ? CommonStrings::tr_None : m_color.Name; + QString shade = sh < 100 ? QString(", Shade: %1 %").arg(sh) : ""; + QString opacity = op < 100 ? QString(", Opacity: %1 %").arg(op) : ""; + return QString( tr("Color: %1%2%3").arg(name).arg(shade).arg(opacity) ); + } +} + +/* ********************************************************************************* * + * + * Slots + * + * ********************************************************************************* */ + +void ColorPickerColor::setDoc(ScribusDoc *doc) +{ + m_doc = doc; +} + +void ColorPickerColor::setColorData(CPColorData color) +{ + m_color = color; + + // update UI + controls + QSignalBlocker sigSwatches(swatches); + swatches->setCurrentColor(m_color.Name); + + QSignalBlocker sigShade(numberShade); + numberShade->setValue(m_color.Shade); + numberShade->setEnabled(m_color.Name != CommonStrings::tr_NoneColor); + + QSignalBlocker sigAlpha(numberAlpha); + numberAlpha->setValue(qRound(100 - (m_color.Opacity * 100))); + numberAlpha->setEnabled(m_color.Name != CommonStrings::tr_NoneColor); + +} + +void ColorPickerColor::languageChange() +{ + sectionSwatches->setText( tr("Color Swatches")); +} + +void ColorPickerColor::updateColorFromSwatches() +{ + m_color.Name = swatches->currentColor(); + numberShade->setEnabled(m_color.Name != CommonStrings::tr_NoneColor); + numberAlpha->setEnabled(m_color.Name != CommonStrings::tr_NoneColor); + + updateColor(); +} + +void ColorPickerColor::updateColorShade() +{ + m_color.Shade = numberShade->value(); + updateColor(); +} + +void ColorPickerColor::updateColorAlpha() +{ + m_color.Opacity = (100 - numberAlpha->value()) / 100.0; + updateColor(); +} + +void ColorPickerColor::updateColor() +{ + // setColorData(m_color); + emit colorChanged(); +} + +void ColorPickerColor::updateSize() +{ + int w = this->width(); + adjustSize(); + resize(w, sizeHint().height()); + emit sizeChanged(); +} + + Index: scribus/ui/colorpicker/colorpicker_color.h =================================================================== --- scribus/ui/colorpicker/colorpicker_color.h (nicht existent) +++ scribus/ui/colorpicker/colorpicker_color.h (Arbeitskopie) @@ -0,0 +1,54 @@ +#ifndef COLORPICKER_COLOR_H +#define COLORPICKER_COLOR_H + +#include <QWidget> +#include "ui_colorpicker_color.h" +#include "scribusdoc.h" +#include "colorpicker_enum.h" + +class ColorPickerColor : public QWidget, Ui::ColorPickerColor +{ + Q_OBJECT + +public: + explicit ColorPickerColor(QWidget *parent = nullptr); + ~ColorPickerColor() {}; + + CPColorData colorData() const; + void setColorList(const ColorList& list, bool insertNone = true); + + Context context(); + void setContext(Context config); + + int type() { return Gradient_None; }; + + QString toolTipText() const; + +public slots: + void setDoc(ScribusDoc *doc); + void setColorData(CPColorData color); + void languageChange(); + +private slots: + void updateColorFromSwatches(); + void updateColorShade(); + void updateColorAlpha(); + void updateColor(); + void updateSize(); + +private: + ScribusDoc *m_doc {nullptr}; + CPColorData m_color; + Context m_context {Context::Simple}; + bool isMask {false}; + + void connectSlots(); + void disconnectSlots(); + +signals: + void colorChanged(); + void sizeChanged(); + +}; + +#endif // COLORPICKER_COLOR_H Index: scribus/ui/colorpicker/colorpicker_color.ui =================================================================== --- scribus/ui/colorpicker/colorpicker_color.ui (nicht existent) +++ scribus/ui/colorpicker/colorpicker_color.ui (Arbeitskopie) @@ -0,0 +1,146 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>ColorPickerColor</class> + <widget class="QWidget" name="ColorPickerColor"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>300</width> + <height>122</height> + </rect> + </property> + <property name="windowTitle"> + <string>Form</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <property name="spacing"> + <number>0</number> + </property> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <layout class="QGridLayout" name="gridLayout"> + <property name="leftMargin"> + <number>8</number> + </property> + <property name="topMargin"> + <number>4</number> + </property> + <property name="rightMargin"> + <number>8</number> + </property> + <property name="bottomMargin"> + <number>4</number> + </property> + <property name="spacing"> + <number>4</number> + </property> + <item row="1" column="2"> + <widget class="ScrSpinBox" name="numberAlpha"> + <property name="suffix"> + <string> %</string> + </property> + <property name="maximum"> + <double>100.000000000000000</double> + </property> + <property name="singleStep"> + <double>10.000000000000000</double> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QLabel" name="labelAlpha"> + <property name="text"> + <string>Opacity:</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QLabel" name="labelShade"> + <property name="text"> + <string>Shade:</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="0" column="2"> + <widget class="ScrSpinBox" name="numberShade"> + <property name="suffix"> + <string> %</string> + </property> + <property name="maximum"> + <double>100.000000000000000</double> + </property> + <property name="singleStep"> + <double>10.000000000000000</double> + </property> + </widget> + </item> + <item row="1" column="0"> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + <item> + <widget class="SectionContainer" name="sectionSwatches"> + <property name="title" stdset="0"> + <string>Color Swatches</string> + </property> + <widget class="ColorPickerColorSwatches" name="swatches"/> + </widget> + </item> + </layout> + </widget> + <customwidgets> + <customwidget> + <class>SectionContainer</class> + <extends>QWidget</extends> + <header>ui/widgets/section_container.h</header> + <addpagemethod>setWidget</addpagemethod> + <container>1</container> + </customwidget> + <customwidget> + <class>ScrSpinBox</class> + <extends>QDoubleSpinBox</extends> + <header location="global">ui/scrspinbox.h</header> + </customwidget> + <customwidget> + <class>ColorPickerColorSwatches</class> + <extends>QWidget</extends> + <header>ui/colorpicker/colorpicker_color_swatches.h</header> + <container>1</container> + </customwidget> + </customwidgets> + <tabstops> + <tabstop>numberShade</tabstop> + <tabstop>numberAlpha</tabstop> + </tabstops> + <resources/> + <connections/> +</ui> Index: scribus/ui/colorpicker/colorpicker_color_swatches.cpp =================================================================== --- scribus/ui/colorpicker/colorpicker_color_swatches.cpp (nicht existent) +++ scribus/ui/colorpicker/colorpicker_color_swatches.cpp (Arbeitskopie) @@ -0,0 +1,41 @@ +#include "colorpicker_color_swatches.h" + +ColorPickerColorSwatches::ColorPickerColorSwatches(QWidget *parent) : QWidget(parent) +{ + setupUi(this); + + listSwatches->setPixmapType(ColorListBox::fancyPixmap); + + connect(listSwatches, &ColorListBox::currentTextChanged, this, &ColorPickerColorSwatches::setColorFromWidget); +} + +QString ColorPickerColorSwatches::currentColor() const +{ + return listSwatches->currentColor(); +} + +void ColorPickerColorSwatches::setColors(const ColorList &list, bool insertNone) +{ + ColorListModel* clm = qobject_cast<ColorListModel*>(listSwatches->model()); + if (!clm) + return; + + clm->setColorList(list, insertNone); +} + +void ColorPickerColorSwatches::setCurrentColor(QString colorName) +{ + if (colorName == CommonStrings::tr_NoneColor || colorName == CommonStrings::None) + colorName = CommonStrings::tr_NoneColor; + + // update color list + QSignalBlocker sig(listSwatches); + listSwatches->setCurrentColor(colorName); + +} + +void ColorPickerColorSwatches::setColorFromWidget(QString colorName) +{ + emit colorChanged(); +} + Index: scribus/ui/colorpicker/colorpicker_color_swatches.h =================================================================== --- scribus/ui/colorpicker/colorpicker_color_swatches.h (nicht existent) +++ scribus/ui/colorpicker/colorpicker_color_swatches.h (Arbeitskopie) @@ -0,0 +1,34 @@ +#ifndef COLORPICKER_COLOR_SWATCHES_H +#define COLORPICKER_COLOR_SWATCHES_H + +#include "ui_colorpicker_color_swatches.h" +#include <QWidget> +#include "sccolor.h" + +class ColorPickerColorSwatches : public QWidget, Ui::ColorPickerColorSwatches +{ + Q_OBJECT + +public: + + explicit ColorPickerColorSwatches(QWidget *parent = nullptr); + ~ColorPickerColorSwatches() {}; + + QString currentColor() const; + void setColors(const ColorList& list, bool insertNone = true); + +public slots: + void setCurrentColor(QString colorName); + +private slots: + void setColorFromWidget(QString colorName); + +private: + +signals: + void colorChanged(); + +}; + +#endif // COLORPICKER_COLOR_SWATCHES_H + Index: scribus/ui/colorpicker/colorpicker_color_swatches.ui =================================================================== --- scribus/ui/colorpicker/colorpicker_color_swatches.ui (nicht existent) +++ scribus/ui/colorpicker/colorpicker_color_swatches.ui (Arbeitskopie) @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>ColorPickerColorSwatches</class> + <widget class="QWidget" name="ColorPickerColorSwatches"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>311</width> + <height>300</height> + </rect> + </property> + <property name="windowTitle"> + <string>Form</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <property name="spacing"> + <number>0</number> + </property> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="ColorListBox" name="listSwatches"/> + </item> + </layout> + </widget> + <customwidgets> + <customwidget> + <class>ColorListBox</class> + <extends>QListView</extends> + <header>ui/colorlistbox.h</header> + </customwidget> + </customwidgets> + <resources/> + <connections/> +</ui> Index: scribus/ui/colorpicker/colorpicker_enum.h =================================================================== --- scribus/ui/colorpicker/colorpicker_enum.h (nicht existent) +++ scribus/ui/colorpicker/colorpicker_enum.h (Arbeitskopie) @@ -0,0 +1,116 @@ +#ifndef COLORPICKER_ENUM_H +#define COLORPICKER_ENUM_H + +#include <QString> +#include "vgradient.h" +#include "commonstrings.h" + +enum class Context +{ + Simple = 0, + Fill = 1, + FillMask = 2, + Line = 3, + LineMask = 4, + Text = 5, + TextOutline = 6, + TextBackground = 7, + DropShadow = 8, + TableCellFill = 9, + TableCellStroke = 10 +}; + +enum class Mode +{ + Solid = 0, + Gradient = 1, + Hatch = 2, + Pattern = 3 +}; + +struct CPGeneralData +{ + int overprint = 0; +}; + +struct CPHatchData +{ + QString ColorForeground = CommonStrings::tr_NoneColor; + QString ColorBackground = CommonStrings::tr_NoneColor; + bool HasBackgroundColor = false; + double Angle = 0.0; + double Distance = 1.0; + int Type = 0; +}; + +struct CPGradientData +{ + VGradient Gradient; + QString Name = ""; + int Type = 0; + VGradient::VGradientRepeatMethod repeatMethod = VGradient::pad; + // Four Colors + QString Color1Name = CommonStrings::tr_NoneColor; + QString Color2Name = CommonStrings::tr_NoneColor; + QString Color3Name = CommonStrings::tr_NoneColor; + QString Color4Name = CommonStrings::tr_NoneColor; + double Color1Shade = 100.0; + double Color2Shade = 100.0; + double Color3Shade = 100.0; + double Color4Shade = 100.0; + double Color1Alpha = 1.0; + double Color2Alpha = 1.0; + double Color3Alpha = 1.0; + double Color4Alpha = 1.0; +}; + +struct CPGradientVectorData +{ + // Regular Gradient Vector + double StartX; + double EndX; + double StartY; + double EndY; + double Skew; + double Scale; + double FocalX; + double FocalY; + // Control Points for Four Colors & Diamond + double C1X; + double C1Y; + double C2X; + double C2Y; + double C3X; + double C3Y; + double C4X; + double C4Y; + double C5X; + double C5Y; + +}; + +struct CPColorData +{ + QString Name = CommonStrings::tr_NoneColor; + double Opacity = 1.0; + double Shade = 100.0; +}; + +struct CPPatternData +{ + QString Name = ""; + double OffsetX = 0.0; + double OffsetY = 0.0; + double ScaleX = 1.0; + double ScaleY = 1.0; + double SkewX = 0.0; + double SkewY = 0.0; + double Angle = 0.0; + double Spacing = 1.0; + bool MirrorX = false; + bool MirrorY = false; + bool OnPath = false; +}; + + +#endif // COLORPICKER_ENUM_H Index: scribus/ui/colorpicker/colorpicker_gradient.cpp =================================================================== --- scribus/ui/colorpicker/colorpicker_gradient.cpp (nicht existent) +++ scribus/ui/colorpicker/colorpicker_gradient.cpp (Arbeitskopie) @@ -0,0 +1,780 @@ +#include "colorpicker_gradient.h" + +#include "util_gui.h" +#include "ui/gradienteditor.h" +#include "scribus.h" +#include "scribusview.h" +#include "selection.h" + +/* ********************************************************************************* * + * + * Constructor + Setup + * + * ********************************************************************************* */ + +ColorPickerGradient::ColorPickerGradient(QWidget *parent) : + QWidget(parent) +{ + setupUi(this); + + sectionVector->collapse(); + + listColor1Swatches = new ColorListBox(ColorListBox::fancyPixmap); + listColor2Swatches = new ColorListBox(ColorListBox::fancyPixmap); + listColor3Swatches = new ColorListBox(ColorListBox::fancyPixmap); + listColor4Swatches = new ColorListBox(ColorListBox::fancyPixmap); + listColorMesh = new ColorListBox(ColorListBox::fancyPixmap); + + buttonColor1->setContextWidget(listColor1Swatches); + buttonColor2->setContextWidget(listColor2Swatches); + buttonColor3->setContextWidget(listColor3Swatches); + buttonColor4->setContextWidget(listColor4Swatches); + buttonColorMesh->setContextWidget(listColorMesh); + + numberColor1Alpha->setDecimals(0); + numberColor2Alpha->setDecimals(0); + numberColor3Alpha->setDecimals(0); + numberColor4Alpha->setDecimals(0); + numberColorMeshAlpha->setDecimals(0); + numberColor1Shade->setDecimals(0); + numberColor2Shade->setDecimals(0); + numberColor3Shade->setDecimals(0); + numberColor4Shade->setDecimals(0); + numberColorMeshShade->setDecimals(0); + + gradientSelector = new QComboBox(); // dummy selector + + languageChange(); + connectSlots(); + + connect(properties, &ColorPickerGradientProperties::currentChanged, this, &ColorPickerGradient::updateSize); + connect(stackGradientPicker, &StackedContainer::currentChanged, this, &ColorPickerGradient::updateSize); + connect(sectionGradient, &SectionContainer::sizeChanged, this, &ColorPickerGradient::updateSize); + connect(sectionSwatches, &SectionContainer::sizeChanged, this, &ColorPickerGradient::updateSize); + connect(sectionVector, &SectionContainer::sizeChanged, this, &ColorPickerGradient::updateSize); +} + +void ColorPickerGradient::connectSlots() +{ + connect(sectionVector, &SectionContainer::collapsedStateChanged, this, &ColorPickerGradient::handleGradientEditProperties); + connect(swatches, &ColorPickerGradientSwatches::gradientChanged, this, &ColorPickerGradient::updateGradientFromSwatches); + connect(gradientSelector, &QComboBox::currentIndexChanged, this, &ColorPickerGradient::updateGradientTypeFromSelector); + connect(checkboxLumAlpha, &QCheckBox::stateChanged, this, &ColorPickerGradient::gradientChanged); + connect(gradientEditor, &GradientEditor::gradientChanged, this, &ColorPickerGradient::updateGradientFromEditor); + connect(gradientEditor, &GradientEditor::repeatMethodChanged, this, &ColorPickerGradient::updateRepeatMethod); + connect(properties, &ColorPickerGradientProperties::gradientVectorChanged, this, &ColorPickerGradient::gradientVectorChanged); + connect(properties, &ColorPickerGradientProperties::gradientEditMode, this, &ColorPickerGradient::setGradientEditMode); + + connect(numberColor1Alpha, &ScrSpinBox::valueChanged, this, &ColorPickerGradient::updateFourColors); + connect(numberColor2Alpha, &ScrSpinBox::valueChanged, this, &ColorPickerGradient::updateFourColors); + connect(numberColor3Alpha, &ScrSpinBox::valueChanged, this, &ColorPickerGradient::updateFourColors); + connect(numberColor4Alpha, &ScrSpinBox::valueChanged, this, &ColorPickerGradient::updateFourColors); + connect(numberColor1Shade, &ScrSpinBox::valueChanged, this, &ColorPickerGradient::updateFourColors); + connect(numberColor2Shade, &ScrSpinBox::valueChanged, this, &ColorPickerGradient::updateFourColors); + connect(numberColor3Shade, &ScrSpinBox::valueChanged, this, &ColorPickerGradient::updateFourColors); + connect(numberColor4Shade, &ScrSpinBox::valueChanged, this, &ColorPickerGradient::updateFourColors); + connect(listColor1Swatches, &ColorListBox::itemSelectionChanged, this, &ColorPickerGradient::updateFourColors); + connect(listColor2Swatches, &ColorListBox::itemSelectionChanged, this, &ColorPickerGradient::updateFourColors); + connect(listColor3Swatches, &ColorListBox::itemSelectionChanged, this, &ColorPickerGradient::updateFourColors); + connect(listColor4Swatches, &ColorListBox::itemSelectionChanged, this, &ColorPickerGradient::updateFourColors); + + connect(numberColorMeshAlpha, &ScrSpinBox::valueChanged, this, &ColorPickerGradient::updateMeshColor); + connect(numberColorMeshShade, &ScrSpinBox::valueChanged, this, &ColorPickerGradient::updateMeshColor); + connect(listColorMesh, &ColorListBox::itemSelectionChanged, this, &ColorPickerGradient::updateMeshColor); +} + +void ColorPickerGradient::disconnectSlots() +{ + disconnect(sectionVector, &SectionContainer::collapsedStateChanged, this, &ColorPickerGradient::handleGradientEditProperties); + disconnect(swatches, &ColorPickerGradientSwatches::gradientChanged, this, &ColorPickerGradient::updateGradientFromSwatches); + disconnect(gradientSelector, &QComboBox::currentIndexChanged, this, &ColorPickerGradient::updateGradientTypeFromSelector); + disconnect(checkboxLumAlpha, &QCheckBox::stateChanged, this, &ColorPickerGradient::gradientChanged); + disconnect(gradientEditor, &GradientEditor::gradientChanged, this, &ColorPickerGradient::updateGradientFromEditor); + disconnect(gradientEditor, &GradientEditor::repeatMethodChanged, this, &ColorPickerGradient::updateRepeatMethod); + disconnect(properties, &ColorPickerGradientProperties::gradientVectorChanged, this, &ColorPickerGradient::gradientVectorChanged); + disconnect(properties, &ColorPickerGradientProperties::gradientEditMode, this, &ColorPickerGradient::setGradientEditMode); + + disconnect(numberColor1Alpha, &ScrSpinBox::valueChanged, this, &ColorPickerGradient::updateFourColors); + disconnect(numberColor2Alpha, &ScrSpinBox::valueChanged, this, &ColorPickerGradient::updateFourColors); + disconnect(numberColor3Alpha, &ScrSpinBox::valueChanged, this, &ColorPickerGradient::updateFourColors); + disconnect(numberColor4Alpha, &ScrSpinBox::valueChanged, this, &ColorPickerGradient::updateFourColors); + disconnect(numberColor1Shade, &ScrSpinBox::valueChanged, this, &ColorPickerGradient::updateFourColors); + disconnect(numberColor2Shade, &ScrSpinBox::valueChanged, this, &ColorPickerGradient::updateFourColors); + disconnect(numberColor3Shade, &ScrSpinBox::valueChanged, this, &ColorPickerGradient::updateFourColors); + disconnect(numberColor4Shade, &ScrSpinBox::valueChanged, this, &ColorPickerGradient::updateFourColors); + disconnect(listColor1Swatches, &ColorListBox::itemSelectionChanged, this, &ColorPickerGradient::updateFourColors); + disconnect(listColor2Swatches, &ColorListBox::itemSelectionChanged, this, &ColorPickerGradient::updateFourColors); + disconnect(listColor3Swatches, &ColorListBox::itemSelectionChanged, this, &ColorPickerGradient::updateFourColors); + disconnect(listColor4Swatches, &ColorListBox::itemSelectionChanged, this, &ColorPickerGradient::updateFourColors); + + disconnect(numberColorMeshAlpha, &ScrSpinBox::valueChanged, this, &ColorPickerGradient::updateMeshColor); + disconnect(numberColorMeshShade, &ScrSpinBox::valueChanged, this, &ColorPickerGradient::updateMeshColor); + disconnect(listColorMesh, &ColorListBox::itemSelectionChanged, this, &ColorPickerGradient::updateMeshColor); +} + +/* ********************************************************************************* * + * + * Members + * + * ********************************************************************************* */ + +void ColorPickerGradient::setGradientList(const GradientList &list) +{ + swatches->setGradients(list, true); +} + +void ColorPickerGradient::setColorList(const ColorList &list) +{ + QSignalBlocker sig1(gradientEditor); + QSignalBlocker sig2(listColor1Swatches); + QSignalBlocker sig3(listColor2Swatches); + QSignalBlocker sig4(listColor3Swatches); + QSignalBlocker sig5(listColor4Swatches); + QSignalBlocker sig6(listColorMesh); + + colList = list; + gradientEditor->setColors(colList); + listColor1Swatches->setColors(colList, true); + listColor2Swatches->setColors(colList, true); + listColor3Swatches->setColors(colList, true); + listColor4Swatches->setColors(colList, true); + listColorMesh->setColors(colList, true); +} + +Context ColorPickerGradient::context() +{ + return m_context; +} + +void ColorPickerGradient::setContext(Context config) +{ + m_context = config; + + disconnectSlots(); + + // reset controls + gradientSelector->clear(); + + switch(m_context){ + case Context::Line: + gradientSelector->addItem(tr("Linear"), Gradient_Linear); + gradientSelector->addItem(tr("Radial"), Gradient_Radial); + gradientSelector->setCurrentIndex(0); + checkboxLumAlpha->setVisible(false); + gradientEditor->setExtendVisible(true); + break; + case Context::FillMask: + gradientSelector->addItem(tr("Linear"), Gradient_Linear); + gradientSelector->addItem(tr("Radial"), Gradient_Radial); + gradientSelector->setCurrentIndex(0); + checkboxLumAlpha->setVisible(true); + gradientEditor->setExtendVisible(false); + break; + case Context::Fill: + gradientSelector->addItem(tr("Linear"), Gradient_Linear); + gradientSelector->addItem(tr("Radial"), Gradient_Radial); + gradientSelector->addItem(tr("Conical"), Gradient_Conical); + gradientSelector->addItem(tr("Diamond"), Gradient_Diamond); + gradientSelector->addItem(tr("4 Colors"), Gradient_4Colors); + gradientSelector->addItem(tr("Mesh"), Gradient_Mesh); + gradientSelector->addItem(tr("Patch Mesh"), Gradient_PatchMesh); + gradientSelector->setCurrentIndex(0); + checkboxLumAlpha->setVisible(false); + gradientEditor->setExtendVisible(true); + break; + default: + case Context::Simple: + break; + } + + connectSlots(); + + updateSize(); +} + +void ColorPickerGradient::setSelector(QComboBox *selector) +{ + disconnect(gradientSelector, &QComboBox::currentIndexChanged, this, &ColorPickerGradient::updateGradientTypeFromSelector); + gradientSelector = selector; + connect(gradientSelector, &QComboBox::currentIndexChanged, this, &ColorPickerGradient::updateGradientTypeFromSelector); +} + +void ColorPickerGradient::setGradientData(CPGradientData gradient) +{ + m_gradient = gradient; + + // update UI + controls + setCurrentGradientType(gradient.Type); + setCurrentGradientName(gradient.Name); + setCurrentGradient(gradient.Gradient); + setCurrentFourColors( + gradient.Color1Name, gradient.Color2Name, gradient.Color3Name, gradient.Color4Name, + gradient.Color1Shade, gradient.Color2Shade, gradient.Color3Shade, gradient.Color4Shade, + gradient.Color1Alpha, gradient.Color2Alpha, gradient.Color3Alpha, gradient.Color4Alpha + ); + setCurrentRepeatMethod(gradient.repeatMethod); + +} + + +CPGradientData ColorPickerGradient::gradientData() +{ + return m_gradient; +} + +void ColorPickerGradient::setGradientVectorData(CPGradientVectorData data) +{ + QSignalBlocker sig(properties); + properties->setGradientVectorData(data); + // properties->setConfig(type(), isMask()); + +} + +CPGradientVectorData ColorPickerGradient::gradientVectorData() +{ + return properties->gradientVectorData(); +} + +void ColorPickerGradient::setGradientMeshData(CPColorData data) +{ + m_gradientMesh = data; + setCurrentMeshPoint(m_gradientMesh.Name, m_gradientMesh.Shade, m_gradientMesh.Opacity); +} + +CPColorData ColorPickerGradient::gradientMeshData() +{ + return m_gradientMesh; +} + +int ColorPickerGradient::type() +{ + int index = qvariant_cast<int>(gradientSelector->currentData().toInt()); + + if (isMask()) + { + switch(index) + { + case Gradient_Linear: + if(checkboxLumAlpha->isChecked()) + index = GradMask_LinearLumAlpha; + else + index = GradMask_Linear; + break; + case Gradient_Radial: + if(checkboxLumAlpha->isChecked()) + index = GradMask_RadialLumAlpha; + else + index = GradMask_Radial; + break; + } + } + + return index; +} + +GradientEdit ColorPickerGradient::gradientEditMode() +{ + int etype = type(); + GradientEdit m_gradType; + + if (isMask()) + { + switch(etype) + { + default: + case GradMask_Linear: + case GradMask_LinearLumAlpha: + case GradMask_Radial: + case GradMask_RadialLumAlpha: + m_gradType = GradientEdit::Gradient_Mask; + break; + } + } + else if (m_context == Context::Line) + m_gradType = GradientEdit::Gradient_Stroke; + else + { + switch(etype) + { + default: + case Gradient_Linear: + case Gradient_Radial: + case Gradient_Conical: + m_gradType = GradientEdit::Gradient; + break; + case Gradient_4Colors: + m_gradType = GradientEdit::FourColors; + break; + case Gradient_Diamond: + m_gradType = GradientEdit::Diamond; + break; + case Gradient_Mesh: + case Gradient_PatchMesh: + m_gradType = m_gradientMeshEdit; + break; + } + } + + return m_gradType; +} + +void ColorPickerGradient::setGradientEditMode(GradientEdit mode) +{ + m_gradientMeshEdit = mode; + + handleGradientEditProperties(); +} + +void ColorPickerGradient::setGradientEditPropertiesEnabled(bool enabled) +{ + QSignalBlocker sig(sectionVector); + sectionVector->setIsCollapsed(!enabled); + // handleGradientEditProperties(); // break m_ScMW->view->requestMode(); + updateSize(); +} + +bool ColorPickerGradient::gradientEditPropertiesEnabled() +{ + return !sectionVector->isCollapsed(); +} + +QString ColorPickerGradient::toolTipText() const +{ + QString name = m_gradient.Name.isEmpty() ? CommonStrings::trCustom : m_gradient.Name; + return QString( tr("Gradient: %1") ).arg(name); +} + +void ColorPickerGradient::disableGradientEditProperties() +{ + if (gradientEditPropertiesEnabled()) + { + setGradientEditPropertiesEnabled(false); + handleGradientEditProperties(); + } + +} + +void ColorPickerGradient::setDoc(ScribusDoc *doc) +{ + m_doc = doc; + unitChange(); +} + +/* ********************************************************************************* * + * + * Slots + * + * ********************************************************************************* */ + +void ColorPickerGradient::languageChange() +{ + sectionVector->setText( tr("Vector")); + sectionGradient->setText( tr("Gradient")); + sectionSwatches->setText( tr("Gradient Swatches")); + + retranslateUi(this); + +} + +void ColorPickerGradient::unitChange() +{ + if (!m_doc) + return; + + currentUnit = m_doc->unitIndex(); + properties->unitChange(currentUnit); +} + +void ColorPickerGradient::updateGradientFromSwatches(QString name, VGradient gradient) +{ + // use local gradient if gradient name is "custom" + if(name.isEmpty()) + gradient = this->gradientData().Gradient; + + gradientEditor->setGradientEditable(name.isEmpty()); + + m_gradient.Gradient = gradient; + m_gradient.Name = name; + updateGradient(); +} + +void ColorPickerGradient::updateGradientFromEditor() +{ + m_gradient.Gradient = gradientEditor->gradient(); + m_gradient.Name = ""; + updateGradient(); +} + +void ColorPickerGradient::updateGradientTypeFromSelector() +{ + VGradient::VGradientType gradType = VGradient::linear; + + switch(type()) + { + default: + case Gradient_Linear: + gradType = VGradient::linear; + break; + case Gradient_Radial: + gradType = VGradient::radial; + break; + case Gradient_Diamond: + gradType = VGradient::diamond; + break; + case Gradient_4Colors: + gradType = VGradient::fourcolor; + break; + case Gradient_Mesh: + gradType = VGradient::mesh; + break; + case Gradient_Conical: + case Gradient_PatchMesh: + gradType = VGradient::freemesh; + break; + } + + int gtype = type(); + + m_gradient.Gradient.setType(gradType); + m_gradient.Type = gtype; + + updateUI(); + updateGradient(); + + emit properties->gradientEditMode(properties->gradientEditType()); + +} + +void ColorPickerGradient::updateFourColors() +{ + QString color1 = listColor1Swatches->currentColor(); + if (color1 == CommonStrings::tr_NoneColor) + color1 = CommonStrings::None; + QString color2 = listColor2Swatches->currentColor(); + if (color2 == CommonStrings::tr_NoneColor) + color2 = CommonStrings::None; + QString color3 = listColor3Swatches->currentColor(); + if (color3 == CommonStrings::tr_NoneColor) + color3 = CommonStrings::None; + QString color4 = listColor4Swatches->currentColor(); + if (color4 == CommonStrings::tr_NoneColor) + color4 = CommonStrings::None; + + m_gradient.Color1Name = color1; + m_gradient.Color2Name = color2; + m_gradient.Color3Name = color3; + m_gradient.Color4Name = color4; + m_gradient.Color1Alpha = numberColor1Alpha->value() / 100.0; + m_gradient.Color2Alpha = numberColor2Alpha->value() / 100.0; + m_gradient.Color3Alpha = numberColor3Alpha->value() / 100.0; + m_gradient.Color4Alpha = numberColor4Alpha->value() / 100.0; + m_gradient.Color1Shade = numberColor1Shade->value(); + m_gradient.Color2Shade = numberColor2Shade->value(); + m_gradient.Color3Shade = numberColor3Shade->value(); + m_gradient.Color4Shade = numberColor4Shade->value(); + + // render color buttons + buttonColor1->setBackground(colorBrush(buttonColor1->backgroundDotSize(), m_gradient.Color1Name, m_gradient.Color1Shade, m_gradient.Color1Alpha)); + buttonColor1->setToolTip(m_gradient.Color1Name); + buttonColor2->setBackground(colorBrush(buttonColor2->backgroundDotSize(), m_gradient.Color2Name, m_gradient.Color2Shade, m_gradient.Color2Alpha)); + buttonColor2->setToolTip(m_gradient.Color2Name); + buttonColor3->setBackground(colorBrush(buttonColor3->backgroundDotSize(), m_gradient.Color3Name, m_gradient.Color3Shade, m_gradient.Color3Alpha)); + buttonColor3->setToolTip(m_gradient.Color3Name); + buttonColor4->setBackground(colorBrush(buttonColor4->backgroundDotSize(), m_gradient.Color4Name, m_gradient.Color4Shade, m_gradient.Color4Alpha)); + buttonColor4->setToolTip(m_gradient.Color4Name); + + updateGradient(); +} + +void ColorPickerGradient::updateMeshColor() +{ + QString colorMesh = listColorMesh->currentColor(); + if (colorMesh == CommonStrings::tr_NoneColor) + colorMesh = CommonStrings::None; + + m_gradientMesh.Name = colorMesh; + m_gradientMesh.Shade = numberColorMeshShade->value(); + m_gradientMesh.Opacity = numberColorMeshAlpha->value() / 100.0; + + // render color button + buttonColorMesh->setBackground(colorBrush(buttonColorMesh->backgroundDotSize(), m_gradientMesh.Name, m_gradientMesh.Shade, m_gradientMesh.Opacity)); + buttonColorMesh->setToolTip(m_gradientMesh.Name); + + if (gradientEditPropertiesEnabled() && (type() == Gradient_PatchMesh || type() == Gradient_Mesh)) + updateGradientMesh(); +} + +void ColorPickerGradient::updateRepeatMethod() +{ + m_gradient.repeatMethod = gradientEditor->repeatMethod(); + updateGradient(); +} + +void ColorPickerGradient::updateSize() +{ + int w = this->width(); + adjustSize(); + resize(w, sizeHint().height()); + emit sizeChanged(); +} + +void ColorPickerGradient::handleGradientEditProperties() +{ + if (!m_doc) + return; + + ScribusMainWindow *m_ScMW = m_doc->scMW(); + if (!m_ScMW || !m_ScMW->view) + return; + + GradientEdit type = gradientEditMode(); + bool editingOn = gradientEditPropertiesEnabled(); + + m_ScMW->view->editStrokeGradient = type; + + // Reference: void PropertiesPalette::toggleGradientEdit(int stroke) + + if (editingOn) + { + if ((type == GradientEdit::Mesh_Point) /*|| (type == GradientEdit::Mesh_Color)*/ || (type == GradientEdit::Mesh_ControlPoints)) + m_ScMW->view->requestMode(modeEditMeshGradient); + else if (/*(type == GradientEdit::PatchMesh_Color) ||*/ (type == GradientEdit::PatchMesh_Point) || (type == GradientEdit::PatchMesh_ControlPoints) || (type == GradientEdit::PatchMesh_Polygon)) + m_ScMW->view->requestMode(modeEditMeshPatch); + else + m_ScMW->view->requestMode(modeEditGradientVectors); + } + else + m_ScMW->view->requestMode(modeNormal); + + PageItem *currentItem = m_doc->m_Selection->itemAt(0); + + if (currentItem) + { + m_ScMW->view->RefreshGradient(currentItem); + + if ( (type == GradientEdit::Mesh_Point || type == GradientEdit::PatchMesh_Point) && (currentItem->selectedMeshPointX > -1) && (currentItem->selectedMeshPointY > -1)) + enableMeshColor(true); + else + enableMeshColor(false); + } +} + +/* ********************************************************************************* * + * + * Methods + * + * ********************************************************************************* */ + +void ColorPickerGradient::setCurrentGradientType(int type) +{ + if (isMask()) + { + QSignalBlocker sigLumAlpha(checkboxLumAlpha); + + switch(type) + { + default: + case GradMask_Linear: + type = Gradient_Linear; + checkboxLumAlpha->setChecked(false); + break; + case GradMask_LinearLumAlpha: + type = Gradient_Linear; + checkboxLumAlpha->setChecked(true); + break; + case GradMask_Radial: + type = Gradient_Radial; + checkboxLumAlpha->setChecked(false); + break; + case GradMask_RadialLumAlpha: + type = Gradient_Radial; + checkboxLumAlpha->setChecked(true); + break; + } + } + + QSignalBlocker sigType(gradientSelector); + + int index = gradientSelector->findData(type); + if ( index != -1 ) + gradientSelector->setCurrentIndex(index); + else + gradientSelector->setCurrentIndex(0); + + updateUI(); +} + +void ColorPickerGradient::setCurrentGradientName(QString name) +{ + QSignalBlocker sigGradientEditor(gradientEditor); + gradientEditor->setGradientEditable(name.isEmpty()); + + QSignalBlocker sigSwatches(swatches); + swatches->setCurrentGradient(name); +} + +void ColorPickerGradient::setCurrentGradient(VGradient gradient) +{ + QSignalBlocker sigGradientEditor(gradientEditor); + gradientEditor->setGradient(gradient); +} + +void ColorPickerGradient::setCurrentFourColors(QString color1, QString color2, QString color3, QString color4, double color1Shade, double color2Shade, double color3Shade, double color4Shade, double color1Alpha, double color2Alpha, double color3Alpha, double color4Alpha) +{ + + QSignalBlocker sigColor1Alpha(numberColor1Alpha); + QSignalBlocker sigColor2Alpha(numberColor2Alpha); + QSignalBlocker sigColor3Alpha(numberColor3Alpha); + QSignalBlocker sigColor4Alpha(numberColor4Alpha); + numberColor1Alpha->setValue(color1Alpha * 100.0); + numberColor2Alpha->setValue(color2Alpha * 100.0); + numberColor3Alpha->setValue(color3Alpha * 100.0); + numberColor4Alpha->setValue(color4Alpha * 100.0); + m_gradient.Color1Alpha = color1Alpha; + m_gradient.Color2Alpha = color2Alpha; + m_gradient.Color3Alpha = color3Alpha; + m_gradient.Color4Alpha = color4Alpha; + + QSignalBlocker sigColor1Shade(numberColor1Shade); + QSignalBlocker sigColor2Shade(numberColor2Shade); + QSignalBlocker sigColor3Shade(numberColor3Shade); + QSignalBlocker sigColor4Shade(numberColor4Shade); + numberColor1Shade->setValue(color1Shade); + numberColor2Shade->setValue(color2Shade); + numberColor3Shade->setValue(color3Shade); + numberColor4Shade->setValue(color4Shade); + m_gradient.Color1Shade = color1Shade; + m_gradient.Color2Shade = color2Shade; + m_gradient.Color3Shade = color3Shade; + m_gradient.Color4Shade = color4Shade; + + QSignalBlocker sigListColor1(listColor1Swatches); + QSignalBlocker sigListColor2(listColor2Swatches); + QSignalBlocker sigListColor3(listColor3Swatches); + QSignalBlocker sigListColor4(listColor4Swatches); + listColor1Swatches->setCurrentColor(color1); + listColor2Swatches->setCurrentColor(color2); + listColor3Swatches->setCurrentColor(color3); + listColor4Swatches->setCurrentColor(color4); + m_gradient.Color1Name = color1; + m_gradient.Color2Name = color2; + m_gradient.Color3Name = color3; + m_gradient.Color4Name = color4; + + QSignalBlocker sigButtonColor1(buttonColor1); + QSignalBlocker sigButtonColor2(buttonColor2); + QSignalBlocker sigButtonColor3(buttonColor3); + QSignalBlocker sigButtonColor4(buttonColor4); + buttonColor1->setBackground(colorBrush(buttonColor1->backgroundDotSize(), color1, m_gradient.Color1Shade, m_gradient.Color1Alpha)); + buttonColor1->setToolTip(color1); + buttonColor2->setBackground(colorBrush(buttonColor2->backgroundDotSize(), color2, m_gradient.Color2Shade, m_gradient.Color2Alpha)); + buttonColor2->setToolTip(color2); + buttonColor3->setBackground(colorBrush(buttonColor3->backgroundDotSize(), color3, m_gradient.Color3Shade, m_gradient.Color3Alpha)); + buttonColor3->setToolTip(color3); + buttonColor4->setBackground(colorBrush(buttonColor4->backgroundDotSize(), color4, m_gradient.Color4Shade, m_gradient.Color4Alpha)); + buttonColor4->setToolTip(color4); + +} + +void ColorPickerGradient::setCurrentMeshPoint(QString colorName, double shade, double alpha) +{ + + QSignalBlocker sigMeshListColor(listColorMesh); + listColorMesh->setCurrentColor(colorName); + m_gradientMesh.Name = colorName; + + QSignalBlocker sigMeshShade(numberColorMeshShade); + numberColorMeshShade->setValue(shade); + m_gradientMesh.Shade = shade; + + QSignalBlocker sigMeshAlpha(numberColorMeshAlpha); + numberColorMeshAlpha->setValue(alpha * 100); + m_gradientMesh.Opacity = alpha; + + QSignalBlocker sigMeshColor(buttonColorMesh); + buttonColorMesh->setBackground(colorBrush(buttonColorMesh->backgroundDotSize(), m_gradientMesh.Name, m_gradientMesh.Shade, m_gradientMesh.Opacity)); + buttonColorMesh->setToolTip(m_gradientMesh.Name); +} + +void ColorPickerGradient::setCurrentRepeatMethod(VGradient::VGradientRepeatMethod method) +{ + gradientEditor->setRepeatMethod(method); +} + +QBrush ColorPickerGradient::colorBrush(QSize size, QString colorName, double shade, double opacity) +{ + if (!m_doc || colorName == CommonStrings::tr_NoneColor || colorName == CommonStrings::None) + return renderEmptyPattern(size); + else + { + ScColor sColor(0, 0, 0); + + shade = qBound(0.0, shade, 100.0); + opacity = qBound(0.0, opacity, 1.0); + + if(m_doc->PageColors.contains(colorName)) + sColor = m_doc->PageColors.value(colorName); + + QColor qColorShade = ScColorEngine::getDisplayColor(sColor, m_doc, shade); + QColor qColor = ScColorEngine::getDisplayColor(sColor, m_doc, 100.0); + + return renderColor(size, qColor, qColorShade, opacity); + } +} + +void ColorPickerGradient::updateGradient() +{ + m_gradient.Type = type(); + setGradientData(m_gradient); + emit gradientChanged(); +} + +void ColorPickerGradient::updateGradientMesh() +{ + setGradientMeshData(m_gradientMesh); + emit gradientMeshChanged(); +} + +void ColorPickerGradient::updateUI() +{ + int gtype = type(); + + properties->setConfig(gtype, isMask()); + + switch(gtype) + { + default: + case Gradient_Conical: + case Gradient_Linear: + case Gradient_Radial: + case Gradient_Diamond: + stackGradientPicker->setCurrentWidget(pageNormal); + sectionSwatches->setVisible(true); + break; + case Gradient_Mesh: + case Gradient_PatchMesh: + stackGradientPicker->setCurrentWidget(pageMesh); + sectionSwatches->setVisible(false); + break; + case Gradient_4Colors: + stackGradientPicker->setCurrentWidget(pageFourColors); + sectionSwatches->setVisible(false); + break; + } + + updateSize(); + +} + +void ColorPickerGradient::enableMeshColor(bool enable) +{ + buttonColorMesh->setEnabled(enable); + numberColorMeshShade->setEnabled(enable); + numberColorMeshAlpha->setEnabled(enable); +} + +bool ColorPickerGradient::isMask() +{ + return (m_context == Context::FillMask || m_context == Context::LineMask); +} + Index: scribus/ui/colorpicker/colorpicker_gradient.h =================================================================== --- scribus/ui/colorpicker/colorpicker_gradient.h (nicht existent) +++ scribus/ui/colorpicker/colorpicker_gradient.h (Arbeitskopie) @@ -0,0 +1,112 @@ +#ifndef COLORPICKER_GRADIENT_H +#define COLORPICKER_GRADIENT_H + +#include "ui_colorpicker_gradient.h" +#include <QWidget> +#include <QComboBox> +#include "scribusdoc.h" +#include "colorpicker_enum.h" + +class ColorPickerGradient : public QWidget, Ui::ColorPickerGradient +{ + Q_OBJECT + +public: + explicit ColorPickerGradient(QWidget *parent = nullptr); + ~ColorPickerGradient() {}; + + void setGradientList(const GradientList& list); + void setColorList(const ColorList& list); + + Context context(); + void setContext(Context config); + + void setSelector(QComboBox *selector); + + void setGradientData(CPGradientData gradient); + CPGradientData gradientData(); + + void setGradientVectorData(CPGradientVectorData data); + CPGradientVectorData gradientVectorData(); + + void setGradientMeshData(CPColorData data); + CPColorData gradientMeshData(); + + int type(); + + GradientEdit gradientEditMode(); + void setGradientEditMode(GradientEdit mode); + + void setGradientEditPropertiesEnabled(bool enabled); + bool gradientEditPropertiesEnabled(); + + QString toolTipText() const; + + ColorPickerGradientProperties *Properties() { return properties; }; + ColorPickerGradientSwatches * Swatches() { return swatches; }; + + void disableGradientEditProperties(); + void enableMeshColor(bool enable); + +public slots: + void setDoc(ScribusDoc *doc); + void languageChange(); + void unitChange(); + + void handleGradientEditProperties(); + +private slots: + void updateGradientFromSwatches(QString name, VGradient gradient); + void updateGradientFromEditor(); + void updateGradientTypeFromSelector(); + void updateFourColors(); + void updateMeshColor(); + void updateRepeatMethod(); + void updateSize(); + +private: + void updateGradient(); + void updateGradientMesh(); + void updateUI(); + + ScribusDoc *m_doc {nullptr}; + CPGradientData m_gradient; + CPColorData m_gradientMesh; + Context m_context {Context::Simple}; + ColorListBox *listColor1Swatches; + ColorListBox *listColor2Swatches; + ColorListBox *listColor3Swatches; + ColorListBox *listColor4Swatches; + ColorListBox *listColorMesh; + int currentUnit {0}; +// int m_uiState {-1}; + ColorList colList; + QComboBox *gradientSelector; + GradientEdit m_gradientMeshEdit; + + bool isMask(); + + void connectSlots(); + void disconnectSlots(); + + void setCurrentGradientType(int type); + void setCurrentGradientName(QString name); + void setCurrentGradient(VGradient gradient); + void setCurrentFourColors(QString color1, QString color2, QString color3, QString color4, + double color1Shade, double color2Shade, double color3Shade, double color4Shade, + double color1Alpha, double color2Alpha, double color3Alpha, double color4Alpha + ); + void setCurrentMeshPoint(QString colorName, double shade, double alpha); + void setCurrentRepeatMethod(VGradient::VGradientRepeatMethod method); + QBrush colorBrush(QSize size, QString colorName, double shade, double opacity); + +signals: + void gradientChanged(); + void gradientVectorChanged(); + void gradientMeshChanged(); + void gradientVectorEditMode(); + void sizeChanged(); + +}; + +#endif // COLORPICKER_GRADIENT_H Index: scribus/ui/colorpicker/colorpicker_gradient.ui =================================================================== --- scribus/ui/colorpicker/colorpicker_gradient.ui (nicht existent) +++ scribus/ui/colorpicker/colorpicker_gradient.ui (Arbeitskopie) @@ -0,0 +1,997 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>ColorPickerGradient</class> + <widget class="QWidget" name="ColorPickerGradient"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>276</width> + <height>378</height> + </rect> + </property> + <property name="windowTitle"> + <string>Form</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <property name="spacing"> + <number>0</number> + </property> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="SectionContainer" name="sectionVector"> + <property name="title" stdset="0"> + <string>Vector</string> + </property> + <property name="isCollapsed"> + <bool>true</bool> + </property> + <property name="hasStyle"> + <bool>true</bool> + </property> + <widget class="ColorPickerGradientProperties" name="properties"/> + </widget> + </item> + <item> + <widget class="SectionContainer" name="sectionGradient"> + <property name="title" stdset="0"> + <string>Gradient</string> + </property> + <widget class="StackedContainer" name="stackGradientPicker"> + <property name="currentIndex"> + <number>2</number> + </property> + <widget class="QWidget" name="pageNormal"> + <layout class="QVBoxLayout" name="verticalLayout_2"> + <property name="spacing"> + <number>0</number> + </property> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>8</number> + </property> + <item> + <widget class="GradientEditor" name="gradientEditor"> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + </widget> + </item> + <item> + <spacer name="verticalSpacer_2"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + </spacer> + </item> + </layout> + </widget> + <widget class="QWidget" name="pageMesh"> + <layout class="QGridLayout" name="gridLayout_2"> + <property name="leftMargin"> + <number>8</number> + </property> + <property name="topMargin"> + <number>8</number> + </property> + <property name="rightMargin"> + <number>8</number> + </property> + <property name="bottomMargin"> + <number>8</number> + </property> + <property name="spacing"> + <number>4</number> + </property> + <item row="1" column="0"> + <spacer name="verticalSpacer_3"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + </spacer> + </item> + <item row="0" column="0"> + <layout class="QHBoxLayout" name="horizontalLayout_17"> + <property name="spacing"> + <number>4</number> + </property> + <item> + <widget class="FormWidget" name="formWidget_13"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="label" stdset="0"> + <string>Color</string> + </property> + <property name="font"> + <font> + <pointsize>8</pointsize> + </font> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_18"> + <property name="spacing"> + <number>4</number> + </property> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="ColorButton" name="buttonColorMesh"> + <property name="text"> + <string/> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="FormWidget" name="formWidget_14"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="label" stdset="0"> + <string>Shade</string> + </property> + <property name="font"> + <font> + <pointsize>8</pointsize> + </font> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_19"> + <property name="spacing"> + <number>4</number> + </property> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="QDoubleSpinBox" name="numberColorMeshShade"/> + </item> + </layout> + </widget> + </item> + <item> + <widget class="FormWidget" name="formWidget_15"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="label" stdset="0"> + <string>Opacity</string> + </property> + <property name="font"> + <font> + <pointsize>8</pointsize> + </font> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_20"> + <property name="spacing"> + <number>4</number> + </property> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="QDoubleSpinBox" name="numberColorMeshAlpha"/> + </item> + </layout> + </widget> + </item> + </layout> + </item> + <item row="0" column="3"> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + </spacer> + </item> + </layout> + </widget> + <widget class="QWidget" name="pageFourColors"> + <layout class="QGridLayout" name="gridLayout"> + <property name="leftMargin"> + <number>8</number> + </property> + <property name="topMargin"> + <number>8</number> + </property> + <property name="rightMargin"> + <number>8</number> + </property> + <property name="bottomMargin"> + <number>8</number> + </property> + <property name="horizontalSpacing"> + <number>16</number> + </property> + <property name="verticalSpacing"> + <number>4</number> + </property> + <item row="2" column="6"> + <spacer name="horizontalSpacer_2"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + </spacer> + </item> + <item row="2" column="0"> + <layout class="QHBoxLayout" name="horizontalLayout_10"> + <property name="spacing"> + <number>4</number> + </property> + <item> + <widget class="FormWidget" name="formWidget_3"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="label" stdset="0"> + <string>Color</string> + </property> + <property name="font"> + <font> + <pointsize>8</pointsize> + </font> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_4"> + <property name="spacing"> + <number>4</number> + </property> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="ColorButton" name="buttonColor3"> + <property name="text"> + <string/> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="FormWidget" name="formWidget_6"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="label" stdset="0"> + <string>Shade</string> + </property> + <property name="font"> + <font> + <pointsize>8</pointsize> + </font> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_6"> + <property name="spacing"> + <number>4</number> + </property> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="ScrSpinBox" name="numberColor3Shade"> + <property name="suffix"> + <string> %</string> + </property> + <property name="maximum"> + <double>100.000000000000000</double> + </property> + <property name="singleStep"> + <double>10.000000000000000</double> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="FormWidget" name="formWidget_10"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="label" stdset="0"> + <string>Opacity</string> + </property> + <property name="font"> + <font> + <pointsize>8</pointsize> + </font> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_14"> + <property name="spacing"> + <number>4</number> + </property> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="ScrSpinBox" name="numberColor3Alpha"> + <property name="suffix"> + <string> %</string> + </property> + <property name="maximum"> + <double>100.000000000000000</double> + </property> + <property name="singleStep"> + <double>10.000000000000000</double> + </property> + </widget> + </item> + </layout> + </widget> + </item> + </layout> + </item> + <item row="1" column="0"> + <layout class="QHBoxLayout" name="horizontalLayout_11"> + <property name="spacing"> + <number>4</number> + </property> + <item> + <widget class="FormWidget" name="formWidget_2"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="label" stdset="0"> + <string>Color</string> + </property> + <property name="font"> + <font> + <pointsize>8</pointsize> + </font> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_2"> + <property name="spacing"> + <number>4</number> + </property> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="ColorButton" name="buttonColor2"> + <property name="text"> + <string/> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="FormWidget" name="formWidget_8"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="label" stdset="0"> + <string>Shade</string> + </property> + <property name="font"> + <font> + <pointsize>8</pointsize> + </font> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_8"> + <property name="spacing"> + <number>4</number> + </property> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="ScrSpinBox" name="numberColor2Shade"> + <property name="suffix"> + <string> %</string> + </property> + <property name="maximum"> + <double>100.000000000000000</double> + </property> + <property name="singleStep"> + <double>10.000000000000000</double> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="FormWidget" name="formWidget_12"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="label" stdset="0"> + <string>Opacity</string> + </property> + <property name="font"> + <font> + <pointsize>8</pointsize> + </font> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_16"> + <property name="spacing"> + <number>4</number> + </property> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="ScrSpinBox" name="numberColor2Alpha"> + <property name="suffix"> + <string> %</string> + </property> + <property name="maximum"> + <double>100.000000000000000</double> + </property> + <property name="singleStep"> + <double>10.000000000000000</double> + </property> + </widget> + </item> + </layout> + </widget> + </item> + </layout> + </item> + <item row="0" column="0"> + <layout class="QHBoxLayout" name="horizontalLayout_9"> + <property name="spacing"> + <number>4</number> + </property> + <item> + <widget class="FormWidget" name="formWidget"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="label" stdset="0"> + <string>Color</string> + </property> + <property name="font"> + <font> + <pointsize>8</pointsize> + </font> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_3"> + <property name="spacing"> + <number>4</number> + </property> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="ColorButton" name="buttonColor1"> + <property name="text"> + <string/> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="FormWidget" name="formWidget_5"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="label" stdset="0"> + <string>Shade</string> + </property> + <property name="font"> + <font> + <pointsize>8</pointsize> + </font> + </property> + <layout class="QHBoxLayout" name="horizontalLayout"> + <property name="spacing"> + <number>4</number> + </property> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="ScrSpinBox" name="numberColor1Shade"> + <property name="suffix"> + <string> %</string> + </property> + <property name="maximum"> + <double>100.000000000000000</double> + </property> + <property name="singleStep"> + <double>10.000000000000000</double> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="FormWidget" name="formWidget_9"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="label" stdset="0"> + <string>Opacity</string> + </property> + <property name="font"> + <font> + <pointsize>8</pointsize> + </font> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_13"> + <property name="spacing"> + <number>4</number> + </property> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="ScrSpinBox" name="numberColor1Alpha"> + <property name="suffix"> + <string> %</string> + </property> + <property name="maximum"> + <double>100.000000000000000</double> + </property> + <property name="singleStep"> + <double>10.000000000000000</double> + </property> + </widget> + </item> + </layout> + </widget> + </item> + </layout> + </item> + <item row="5" column="0"> + <spacer name="verticalSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + </spacer> + </item> + <item row="4" column="0"> + <layout class="QHBoxLayout" name="horizontalLayout_12"> + <property name="spacing"> + <number>4</number> + </property> + <item> + <widget class="FormWidget" name="formWidget_4"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="label" stdset="0"> + <string>Color</string> + </property> + <property name="font"> + <font> + <pointsize>8</pointsize> + </font> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_5"> + <property name="spacing"> + <number>4</number> + </property> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="ColorButton" name="buttonColor4"> + <property name="text"> + <string/> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="FormWidget" name="formWidget_7"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="label" stdset="0"> + <string>Shade</string> + </property> + <property name="font"> + <font> + <pointsize>8</pointsize> + </font> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_7"> + <property name="spacing"> + <number>4</number> + </property> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="ScrSpinBox" name="numberColor4Shade"> + <property name="suffix"> + <string> %</string> + </property> + <property name="maximum"> + <double>100.000000000000000</double> + </property> + <property name="singleStep"> + <double>10.000000000000000</double> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="FormWidget" name="formWidget_11"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="label" stdset="0"> + <string>Opacity</string> + </property> + <property name="font"> + <font> + <pointsize>8</pointsize> + </font> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_15"> + <property name="spacing"> + <number>4</number> + </property> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="ScrSpinBox" name="numberColor4Alpha"> + <property name="suffix"> + <string> %</string> + </property> + <property name="maximum"> + <double>100.000000000000000</double> + </property> + <property name="singleStep"> + <double>10.000000000000000</double> + </property> + </widget> + </item> + </layout> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + </widget> + </widget> + </item> + <item> + <widget class="SectionContainer" name="sectionSwatches"> + <property name="title" stdset="0"> + <string>Gradient Swatches</string> + </property> + <widget class="ColorPickerGradientSwatches" name="swatches"/> + </widget> + </item> + <item> + <layout class="QVBoxLayout" name="verticalLayout_3"> + <property name="spacing"> + <number>4</number> + </property> + <property name="leftMargin"> + <number>8</number> + </property> + <property name="rightMargin"> + <number>8</number> + </property> + <property name="bottomMargin"> + <number>8</number> + </property> + <item> + <widget class="QCheckBox" name="checkboxLumAlpha"> + <property name="text"> + <string>Use Luminosity as Alpha</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + <customwidgets> + <customwidget> + <class>FormWidget</class> + <extends>QWidget</extends> + <header>ui/widgets/form_widget.h</header> + <container>1</container> + </customwidget> + <customwidget> + <class>SectionContainer</class> + <extends>QWidget</extends> + <header>ui/widgets/section_container.h</header> + <addpagemethod>setWidget</addpagemethod> + <container>1</container> + </customwidget> + <customwidget> + <class>ColorButton</class> + <extends>QToolButton</extends> + <header>ui/widgets/color_button.h</header> + </customwidget> + <customwidget> + <class>StackedContainer</class> + <extends>QStackedWidget</extends> + <header>ui/widgets/stacked_container.h</header> + <container>1</container> + </customwidget> + <customwidget> + <class>ScrSpinBox</class> + <extends>QDoubleSpinBox</extends> + <header location="global">ui/scrspinbox.h</header> + </customwidget> + <customwidget> + <class>GradientEditor</class> + <extends>QFrame</extends> + <header>ui/gradienteditor.h</header> + <container>1</container> + </customwidget> + <customwidget> + <class>ColorPickerGradientSwatches</class> + <extends>QWidget</extends> + <header>ui/colorpicker/colorpicker_gradient_swatches.h</header> + <container>1</container> + </customwidget> + <customwidget> + <class>ColorPickerGradientProperties</class> + <extends>QWidget</extends> + <header>ui/colorpicker/colorpicker_gradient_properties.h</header> + <container>1</container> + </customwidget> + </customwidgets> + <tabstops> + <tabstop>buttonColor1</tabstop> + <tabstop>numberColor1Shade</tabstop> + <tabstop>numberColor1Alpha</tabstop> + <tabstop>buttonColor2</tabstop> + <tabstop>numberColor2Shade</tabstop> + <tabstop>numberColor2Alpha</tabstop> + <tabstop>buttonColor3</tabstop> + <tabstop>numberColor3Shade</tabstop> + <tabstop>numberColor3Alpha</tabstop> + <tabstop>buttonColor4</tabstop> + <tabstop>numberColor4Shade</tabstop> + <tabstop>numberColor4Alpha</tabstop> + <tabstop>buttonColorMesh</tabstop> + <tabstop>numberColorMeshShade</tabstop> + <tabstop>numberColorMeshAlpha</tabstop> + <tabstop>checkboxLumAlpha</tabstop> + </tabstops> + <resources/> + <connections/> +</ui> Index: scribus/ui/colorpicker/colorpicker_gradient_properties.cpp =================================================================== --- scribus/ui/colorpicker/colorpicker_gradient_properties.cpp (nicht existent) +++ scribus/ui/colorpicker/colorpicker_gradient_properties.cpp (Arbeitskopie) @@ -0,0 +1,494 @@ +#include "colorpicker_gradient_properties.h" +#include "units.h" +#include "iconmanager.h" + +ColorPickerGradientProperties::ColorPickerGradientProperties(QWidget* parent) : StackedContainer(parent) +{ + m_unitRatio = 1.0; + + setupUi(this); + + gSk->setNewUnit(6); + gSk->setValues(-89, 89, 2, 0); + gSk_2->setNewUnit(6); + gSk_2->setValues(-89, 89, 2, 0); + gSc->setSuffix(" %"); + gSc->setValue( 100 ); + + connectSlots(); + + // Mesh + connect(buttonNewGrid, SIGNAL(clicked()), this, SIGNAL(createNewMesh())); + connect(buttonResetGrid, SIGNAL(clicked()), this, SIGNAL(resetMesh())); + connect(buttonPoLIne, SIGNAL(clicked()), this, SIGNAL(meshToShape())); + connect(editPoints, SIGNAL(clicked()), this, SLOT(handleEditButton())); + connect(editControlPoints, SIGNAL(clicked()), this, SLOT(handleEditControlButton())); + connect(resetControlPoint, SIGNAL(clicked()), this, SIGNAL(reset1Control())); + connect(resetAllControlPoints, SIGNAL(clicked()), this, SIGNAL(resetAllControl())); + // Patch Mesh + connect(editPPoint, SIGNAL(clicked()), this, SLOT(handlePEditButton())); + connect(editPControlPoints, SIGNAL(clicked()), this, SLOT(handlePEditControlButton())); + connect(buttonAddPatch, SIGNAL(clicked()), this, SLOT(handlePAddButton())); + connect(buttonRemovePatch, SIGNAL(clicked()), this, SIGNAL(removePatch())); + connect(resetPControlPoint, SIGNAL(clicked()), this, SIGNAL(reset1Control())); + connect(resetAllPControlPoints, SIGNAL(clicked()), this, SIGNAL(resetAllControl())); + connect(snapToGrid, SIGNAL(clicked()), this, SLOT(handleSnapToGridBox())); + + iconSetChange(); + languageChange(); + selectLinear(); +} + +void ColorPickerGradientProperties::changeEvent(QEvent *e) +{ + if (e->type() == QEvent::LanguageChange) + languageChange(); + + QWidget::changeEvent(e); +} + +void ColorPickerGradientProperties::selectLinear() +{ + this->setCurrentIndex(0); + m_gradientEditType = GradientEdit::Gradient; +} + +void ColorPickerGradientProperties::selectRadial() +{ + this->setCurrentIndex(1); + labelSkew2->show(); + gSk_2->show(); + m_gradientEditType = GradientEdit::Gradient; +} + +void ColorPickerGradientProperties::selectConical() +{ + this->setCurrentIndex(1); + labelSkew2->hide(); + gSk_2->hide(); + m_gradientEditType = GradientEdit::Gradient; +} + +void ColorPickerGradientProperties::selectFourColor() +{ + this->setCurrentIndex(2); + m_gradientEditType = GradientEdit::FourColors; +} + +void ColorPickerGradientProperties::selectDiamond() +{ + this->setCurrentIndex(3); + m_gradientEditType = GradientEdit::Diamond; +} + +void ColorPickerGradientProperties::selectMesh() +{ + QSignalBlocker sig(this); + + this->setCurrentIndex(4); + editPoints->setChecked(true); + m_gradientEditType = GradientEdit::Mesh_Point; +} + +void ColorPickerGradientProperties::selectPatchMesh() +{ + QSignalBlocker sig(this); + + this->setCurrentIndex(5); + editPPoint->setChecked(true); + snapToGrid->setChecked(false); + snapToGrid->setEnabled(true); + m_gradientEditType = GradientEdit::PatchMesh_Point; +} + +CPGradientVectorData ColorPickerGradientProperties::gradientVectorData() +{ + return m_data; +} + +void ColorPickerGradientProperties::setConfig(int type, bool isMask) +{ + int t = type; + + // normalize type based on mask mode + if (isMask) + { + switch (t) + { + default: + case GradMask_Linear: + case GradMask_LinearLumAlpha: + t = Gradient_Linear; + break; + case GradMask_Radial: + case GradMask_RadialLumAlpha: + t = Gradient_Radial; + break; + case GradMask_Pattern: + case GradMask_PatternInverted: + case GradMask_PatternLumAlphaInverted: + case GradMask_PatternLumAlpha: + // not handled + break; + } + } + + if (m_type == type) + return; + + m_type = t; + + switch (t) + { + default: + case Gradient_Linear: + selectLinear(); + break; + case Gradient_Radial: + selectRadial(); + break; + case Gradient_Diamond: + selectDiamond(); + break; + case Gradient_4Colors: + selectFourColor(); + break; + case Gradient_Conical: + selectConical(); + break; + case Gradient_Mesh: + selectMesh(); + break; + case Gradient_PatchMesh: + selectPatchMesh(); + break; + } + +// qDebug() << Q_FUNC_INFO << gradientTypeDebug(t); + +} + +GradientEdit ColorPickerGradientProperties::gradientEditType() +{ + return m_gradientEditType; +} + +void ColorPickerGradientProperties::languageChange() +{ + retranslateUi(this); +} + +void ColorPickerGradientProperties::handleEditButton() +{ + if (editPoints->isChecked()) + { + resetAllControlPoints->setEnabled(false); + resetControlPoint->setEnabled(false); + m_gradientEditType = GradientEdit::Mesh_Point; + emit gradientEditMode(gradientEditType()); + } +} + +void ColorPickerGradientProperties::handleEditControlButton() +{ + if (editControlPoints->isChecked()) + { + resetAllControlPoints->setEnabled(true); + resetControlPoint->setEnabled(true); + m_gradientEditType = GradientEdit::Mesh_ControlPoints; + emit gradientEditMode(gradientEditType()); + } +} + +void ColorPickerGradientProperties::handlePEditButton() +{ + if (editPPoint->isChecked()) + { + snapToGrid->setEnabled(true); + resetAllPControlPoints->setEnabled(false); + resetPControlPoint->setEnabled(false); + m_gradientEditType = GradientEdit::PatchMesh_Point; + emit gradientEditMode(gradientEditType()); + } +} + +void ColorPickerGradientProperties::handlePEditControlButton() +{ + if (editPControlPoints->isChecked()) + { + snapToGrid->setEnabled(false); + resetAllPControlPoints->setEnabled(true); + resetPControlPoint->setEnabled(true); + m_gradientEditType = GradientEdit::PatchMesh_ControlPoints; + emit gradientEditMode(gradientEditType()); + } +} + +void ColorPickerGradientProperties::handleSnapToGridBox() +{ + emit snapToMGrid(snapToGrid->isChecked()); +} + +void ColorPickerGradientProperties::handlePAddButton() +{ + editPPoint->setChecked(true); + editPPoint->setEnabled(false); + editPControlPoints->setEnabled(false); + resetAllPControlPoints->setEnabled(false); + resetPControlPoint->setEnabled(false); + buttonAddPatch->setEnabled(false); + m_gradientEditType = GradientEdit::PatchMesh_Polygon; + emit gradientEditMode(gradientEditType()); +} + +void ColorPickerGradientProperties::endPAddButton() +{ + editPPoint->setChecked(true); + editPPoint->setEnabled(true); + editPControlPoints->setEnabled(true); + resetAllPControlPoints->setEnabled(false); + resetPControlPoint->setEnabled(false); + buttonAddPatch->setChecked(false); + buttonAddPatch->setEnabled(true); + m_gradientEditType = GradientEdit::PatchMesh_Point; + emit gradientEditMode(gradientEditType()); +} + +void ColorPickerGradientProperties::changebuttonRemovePatch(bool val) +{ + buttonRemovePatch->setEnabled(val); +} + +void ColorPickerGradientProperties::setGradientVectorData(CPGradientVectorData data) +{ + disconnectSlots(); + + m_data = data; + // Linear + gX1->setValue(data.StartX * m_unitRatio); + gX2->setValue(data.EndX * m_unitRatio); + gY1->setValue(data.StartY * m_unitRatio); + gY2->setValue(data.EndY * m_unitRatio); + gSk->setValue(data.Skew); + // Radial + gX1_2->setValue(data.StartX * m_unitRatio); + gX2_2->setValue(data.EndX * m_unitRatio); + gY1_2->setValue(data.StartY * m_unitRatio); + gY2_2->setValue(data.EndY * m_unitRatio); + gFX->setValue(data.FocalX * m_unitRatio); + gFY->setValue(data.FocalY * m_unitRatio); + gSc->setValue(data.Scale * 100.0); + gSk_2->setValue(data.Skew); + // Four Colors + gC1X->setValue(data.C1X * m_unitRatio); + gC1Y->setValue(data.C1Y * m_unitRatio); + gC2X->setValue(data.C2X * m_unitRatio); + gC2Y->setValue(data.C2Y * m_unitRatio); + gC3X->setValue(data.C3X * m_unitRatio); + gC3Y->setValue(data.C3Y * m_unitRatio); + gC4X->setValue(data.C4X * m_unitRatio); + gC4Y->setValue(data.C4Y * m_unitRatio); + // Diamond + gC1XD->setValue(data.C1X * m_unitRatio); + gC1YD->setValue(data.C1Y * m_unitRatio); + gC2XD->setValue(data.C2X * m_unitRatio); + gC2YD->setValue(data.C2Y * m_unitRatio); + gC3XD->setValue(data.C3X * m_unitRatio); + gC3YD->setValue(data.C3Y * m_unitRatio); + gC4XD->setValue(data.C4X * m_unitRatio); + gC4YD->setValue(data.C4Y * m_unitRatio); + gC5XD->setValue(data.C5X * m_unitRatio); + gC5YD->setValue(data.C5Y * m_unitRatio); + + connectSlots(); +} + +void ColorPickerGradientProperties::changeSpecialLinear() +{ + m_data.StartX = gX1->value() / m_unitRatio; + m_data.StartY = gY1->value() / m_unitRatio; + m_data.EndX = gX2->value() / m_unitRatio; + m_data.EndY = gY2->value() / m_unitRatio; + m_data.FocalX = gFX->value() / m_unitRatio; + m_data.FocalY = gFY->value() / m_unitRatio; + m_data.Scale = 1; + m_data.Skew = gSk->value(); + + emit gradientVectorChanged(); +} + +void ColorPickerGradientProperties::changeSpecialRadial() +{ + m_data.StartX = gX1_2->value() / m_unitRatio; + m_data.StartY = gY1_2->value() / m_unitRatio; + m_data.EndX = gX2_2->value() / m_unitRatio; + m_data.EndY = gY2_2->value() / m_unitRatio; + m_data.FocalX = gFX->value() / m_unitRatio; + m_data.FocalY = gFY->value() / m_unitRatio; + m_data.Scale = gSc->value() / 100.0; + m_data.Skew = gSk_2->value(); + + emit gradientVectorChanged(); +} + +void ColorPickerGradientProperties::changeSpecialFourColors() +{ + m_data.C1X = gC1X->value() / m_unitRatio; + m_data.C1Y = gC1Y->value() / m_unitRatio; + m_data.C2X = gC2X->value() / m_unitRatio; + m_data.C2Y = gC2Y->value() / m_unitRatio; + m_data.C3X = gC3X->value() / m_unitRatio; + m_data.C3Y = gC3Y->value() / m_unitRatio; + m_data.C4X = gC4X->value() / m_unitRatio; + m_data.C4Y = gC4Y->value() / m_unitRatio; + + emit gradientVectorChanged(); +} + +void ColorPickerGradientProperties::changeSpecialDiamond() +{ + m_data.C1X = gC1XD->value() / m_unitRatio; + m_data.C1Y = gC1YD->value() / m_unitRatio; + m_data.C2X = gC2XD->value() / m_unitRatio; + m_data.C2Y = gC2YD->value() / m_unitRatio; + m_data.C3X = gC3XD->value() / m_unitRatio; + m_data.C3Y = gC3YD->value() / m_unitRatio; + m_data.C4X = gC4XD->value() / m_unitRatio; + m_data.C4Y = gC4YD->value() / m_unitRatio; + m_data.C5X = gC5XD->value() / m_unitRatio; + m_data.C5Y = gC5YD->value() / m_unitRatio; + + emit gradientVectorChanged(); +} + +void ColorPickerGradientProperties::iconSetChange() +{ + IconManager& im = IconManager::instance(); + editPoints->setIcon(im.loadIcon("MoveNode.png")); + editControlPoints->setIcon(im.loadIcon("MoveKontrol.png")); + resetControlPoint->setIcon(im.loadIcon("Reset1Node.png")); + resetAllControlPoints->setIcon(im.loadIcon("ResetNode.png")); + editPPoint->setIcon(im.loadIcon("MoveNode.png")); + editPControlPoints->setIcon(im.loadIcon("MoveKontrol.png")); + resetPControlPoint->setIcon(im.loadIcon("Reset1Node.png")); + resetAllPControlPoints->setIcon(im.loadIcon("ResetNode.png")); +} + +void ColorPickerGradientProperties::unitChange(int unitIndex) +{ + m_unitRatio = unitGetRatioFromIndex(unitIndex); + + disconnectSlots(); + + gX1->setNewUnit(unitIndex); + gY1->setNewUnit(unitIndex); + gX2->setNewUnit(unitIndex); + gY2->setNewUnit(unitIndex); + + gX1_2->setNewUnit(unitIndex); + gY1_2->setNewUnit(unitIndex); + gX2_2->setNewUnit(unitIndex); + gY2_2->setNewUnit(unitIndex); + gFX->setNewUnit(unitIndex); + gFY->setNewUnit(unitIndex); + + gC1X->setNewUnit(unitIndex); + gC1Y->setNewUnit(unitIndex); + gC2X->setNewUnit(unitIndex); + gC2Y->setNewUnit(unitIndex); + gC3X->setNewUnit(unitIndex); + gC3Y->setNewUnit(unitIndex); + gC4X->setNewUnit(unitIndex); + gC4Y->setNewUnit(unitIndex); + + gC1XD->setNewUnit(unitIndex); + gC1YD->setNewUnit(unitIndex); + gC2XD->setNewUnit(unitIndex); + gC2YD->setNewUnit(unitIndex); + gC3XD->setNewUnit(unitIndex); + gC3YD->setNewUnit(unitIndex); + gC4XD->setNewUnit(unitIndex); + gC4YD->setNewUnit(unitIndex); + gC5XD->setNewUnit(unitIndex); + gC5YD->setNewUnit(unitIndex); + + connectSlots(); +} + +void ColorPickerGradientProperties::connectSlots() +{ + // Linear + connect(gX1, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialLinear())); + connect(gX2, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialLinear())); + connect(gY1, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialLinear())); + connect(gY2, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialLinear())); + connect(gSk, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialLinear())); + // Radial + connect(gX1_2, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialRadial())); + connect(gX2_2, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialRadial())); + connect(gY1_2, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialRadial())); + connect(gY2_2, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialRadial())); + connect(gFX, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialRadial())); + connect(gFY, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialRadial())); + connect(gSk_2, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialRadial())); + connect(gSc, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialRadial())); + // Four Colors + connect(gC1X, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialFourColors())); + connect(gC1Y, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialFourColors())); + connect(gC2X, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialFourColors())); + connect(gC2Y, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialFourColors())); + connect(gC3X, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialFourColors())); + connect(gC3Y, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialFourColors())); + connect(gC4X, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialFourColors())); + connect(gC4Y, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialFourColors())); + // Diamond + connect(gC1XD, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialDiamond())); + connect(gC1YD, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialDiamond())); + connect(gC2XD, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialDiamond())); + connect(gC2YD, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialDiamond())); + connect(gC3XD, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialDiamond())); + connect(gC3YD, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialDiamond())); + connect(gC4XD, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialDiamond())); + connect(gC4YD, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialDiamond())); + connect(gC5XD, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialDiamond())); + connect(gC5YD, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialDiamond())); +} + +void ColorPickerGradientProperties::disconnectSlots() +{ + // Linear + disconnect(gX1, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialLinear())); + disconnect(gX2, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialLinear())); + disconnect(gY1, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialLinear())); + disconnect(gY2, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialLinear())); + disconnect(gSk, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialLinear())); + // Radial + disconnect(gX1_2, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialRadial())); + disconnect(gX2_2, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialRadial())); + disconnect(gY1_2, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialRadial())); + disconnect(gY2_2, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialRadial())); + disconnect(gFX, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialRadial())); + disconnect(gFY, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialRadial())); + disconnect(gSk_2, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialRadial())); + disconnect(gSc, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialRadial())); + // Four Colors + disconnect(gC1X, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialFourColors())); + disconnect(gC1Y, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialFourColors())); + disconnect(gC2X, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialFourColors())); + disconnect(gC2Y, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialFourColors())); + disconnect(gC3X, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialFourColors())); + disconnect(gC3Y, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialFourColors())); + disconnect(gC4X, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialFourColors())); + disconnect(gC4Y, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialFourColors())); + // Diamond + disconnect(gC1XD, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialDiamond())); + disconnect(gC1YD, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialDiamond())); + disconnect(gC2XD, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialDiamond())); + disconnect(gC2YD, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialDiamond())); + disconnect(gC3XD, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialDiamond())); + disconnect(gC3YD, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialDiamond())); + disconnect(gC4XD, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialDiamond())); + disconnect(gC4YD, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialDiamond())); + disconnect(gC5XD, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialDiamond())); + disconnect(gC5YD, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialDiamond())); +} Index: scribus/ui/colorpicker/colorpicker_gradient_properties.h =================================================================== --- scribus/ui/colorpicker/colorpicker_gradient_properties.h (nicht existent) +++ scribus/ui/colorpicker/colorpicker_gradient_properties.h (Arbeitskopie) @@ -0,0 +1,81 @@ +#ifndef COLORPICKER_GRADIENT_PROPERTIES_H +#define COLORPICKER_GRADIENT_PROPERTIES_H + +#include <QWidget> +#include <QLayout> +#include <QLabel> +#include <QEvent> +//#include "scribusapi.h" +#include "scribusstructs.h" +#include "ui_colorpicker_gradient_properties.h" +#include "colorpicker_enum.h" +#include "ui/widgets/stacked_container.h" + +class ColorPickerGradientProperties : public StackedContainer, Ui::ColorPickerGradientProperties +{ + Q_OBJECT + +public: + ColorPickerGradientProperties( QWidget* parent = nullptr); + ~ColorPickerGradientProperties() {}; + + void selectLinear(); + void selectRadial(); + void selectConical(); + void selectFourColor(); + void selectDiamond(); + void selectMesh(); + void selectPatchMesh(); + + void setGradientVectorData(CPGradientVectorData data); + CPGradientVectorData gradientVectorData(); + + void setConfig(int type, bool isMask); + GradientEdit gradientEditType(); + +public slots: + void languageChange(); + void handleEditButton(); + void handleEditControlButton(); + void handlePEditButton(); + void handlePEditControlButton(); + void handlePAddButton(); + void handleSnapToGridBox(); + void endPAddButton(); + void changebuttonRemovePatch(bool val); + void changeSpecialLinear(); + void changeSpecialRadial(); + void changeSpecialFourColors(); + void changeSpecialDiamond(); + + void iconSetChange(); + void unitChange(int unitIndex); + +protected: + double m_unitRatio; + GradientEdit m_gradientEditType {GradientEdit::Gradient}; + int m_type = -1; + CPGradientVectorData m_data; + void connectSlots(); + void disconnectSlots(); + + void changeEvent(QEvent *e) override; + +signals: + + // Gradient Vector + void gradientVectorChanged(); + + // Mesh + void gradientEditMode(GradientEdit); + void createNewMesh(); + void resetMesh(); + void meshToShape(); + void reset1Control(); + void resetAllControl(); + void removePatch(); + void snapToMGrid(bool); + +}; + +#endif // COLORPICKER_GRADIENT_PROPERTIES_H Index: scribus/ui/colorpicker/colorpicker_gradient_properties.ui =================================================================== --- scribus/ui/colorpicker/colorpicker_gradient_properties.ui (nicht existent) +++ scribus/ui/colorpicker/colorpicker_gradient_properties.ui (Arbeitskopie) @@ -0,0 +1,1402 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>ColorPickerGradientProperties</class> + <widget class="StackedContainer" name="ColorPickerGradientProperties"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>309</width> + <height>177</height> + </rect> + </property> + <property name="currentIndex"> + <number>1</number> + </property> + <widget class="QWidget" name="pageLinear"> + <layout class="QGridLayout" name="gridLayout_3"> + <property name="leftMargin"> + <number>8</number> + </property> + <property name="topMargin"> + <number>8</number> + </property> + <property name="rightMargin"> + <number>8</number> + </property> + <property name="bottomMargin"> + <number>8</number> + </property> + <property name="spacing"> + <number>4</number> + </property> + <item row="0" column="3"> + <spacer name="horizontalSpacer_5"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + </spacer> + </item> + <item row="1" column="2"> + <widget class="FormWidget" name="formWidget_3"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="label" stdset="0"> + <string>End</string> + </property> + <property name="font"> + <font> + <pointsize>8</pointsize> + </font> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_7"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="ScrSpinBox" name="gY2"> + <property name="minimum"> + <double>-3000.000000000000000</double> + </property> + <property name="maximum"> + <double>3000.000000000000000</double> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item row="1" column="0"> + <widget class="FormWidget" name="formWidget"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="label" stdset="0"> + <string/> + </property> + <property name="font"> + <font> + <pointsize>8</pointsize> + </font> + </property> + <property name="preserveLabelSpace"> + <bool>true</bool> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_5"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="QLabel" name="label_33"> + <property name="text"> + <string>Y:</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item row="0" column="2"> + <widget class="ScrSpinBox" name="gX2"> + <property name="minimum"> + <double>-3000.000000000000000</double> + </property> + <property name="maximum"> + <double>3000.000000000000000</double> + </property> + </widget> + </item> + <item row="0" column="0"> + <widget class="QLabel" name="label_32"> + <property name="text"> + <string>X:</string> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="FormWidget" name="labelSkew"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="label" stdset="0"> + <string>Skew</string> + </property> + <property name="font"> + <font> + <pointsize>8</pointsize> + </font> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_8"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="ScrSpinBox" name="gSk"> + <property name="minimum"> + <double>-89.000000000000000</double> + </property> + <property name="maximum"> + <double>89.000000000000000</double> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item row="0" column="1"> + <widget class="ScrSpinBox" name="gX1"> + <property name="minimum"> + <double>-3000.000000000000000</double> + </property> + <property name="maximum"> + <double>3000.000000000000000</double> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="FormWidget" name="formWidget_2"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="label" stdset="0"> + <string>Start</string> + </property> + <property name="font"> + <font> + <pointsize>8</pointsize> + </font> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_6"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="ScrSpinBox" name="gY1"> + <property name="minimum"> + <double>-3000.000000000000000</double> + </property> + <property name="maximum"> + <double>3000.000000000000000</double> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item row="3" column="1"> + <spacer name="verticalSpacer_3"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + </spacer> + </item> + </layout> + </widget> + <widget class="QWidget" name="pageRadial"> + <layout class="QGridLayout" name="gridLayout"> + <property name="leftMargin"> + <number>8</number> + </property> + <property name="topMargin"> + <number>8</number> + </property> + <property name="rightMargin"> + <number>8</number> + </property> + <property name="bottomMargin"> + <number>8</number> + </property> + <property name="spacing"> + <number>4</number> + </property> + <item row="0" column="0"> + <widget class="QLabel" name="label"> + <property name="text"> + <string>X:</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="FormWidget" name="formWidget_6"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="label" stdset="0"> + <string>Start</string> + </property> + <property name="font"> + <font> + <pointsize>8</pointsize> + </font> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_10"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="ScrSpinBox" name="gY1_2"> + <property name="minimum"> + <double>-3000.000000000000000</double> + </property> + <property name="maximum"> + <double>3000.000000000000000</double> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item row="1" column="0"> + <widget class="FormWidget" name="formWidget_5"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="label" stdset="0"> + <string/> + </property> + <property name="font"> + <font> + <pointsize>8</pointsize> + </font> + </property> + <property name="preserveLabelSpace"> + <bool>true</bool> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_9"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="QLabel" name="label_2"> + <property name="text"> + <string>Y:</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item row="1" column="3"> + <widget class="FormWidget" name="formWidget_8"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="label" stdset="0"> + <string>Focal</string> + </property> + <property name="font"> + <font> + <pointsize>8</pointsize> + </font> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_12"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="ScrSpinBox" name="gFY"> + <property name="minimum"> + <double>-3000.000000000000000</double> + </property> + <property name="maximum"> + <double>3000.000000000000000</double> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item row="1" column="2"> + <widget class="FormWidget" name="formWidget_7"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="label" stdset="0"> + <string>End</string> + </property> + <property name="font"> + <font> + <pointsize>8</pointsize> + </font> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_11"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="ScrSpinBox" name="gY2_2"> + <property name="minimum"> + <double>-3000.000000000000000</double> + </property> + <property name="maximum"> + <double>3000.000000000000000</double> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item row="2" column="2"> + <widget class="FormWidget" name="labelSkew2"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="label" stdset="0"> + <string>Skew</string> + </property> + <property name="font"> + <font> + <pointsize>8</pointsize> + </font> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_13"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="ScrSpinBox" name="gSk_2"> + <property name="minimum"> + <double>-89.000000000000000</double> + </property> + <property name="maximum"> + <double>89.000000000000000</double> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item row="0" column="4"> + <spacer name="horizontalSpacer_6"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + </spacer> + </item> + <item row="0" column="3"> + <widget class="ScrSpinBox" name="gFX"> + <property name="minimum"> + <double>-3000.000000000000000</double> + </property> + <property name="maximum"> + <double>3000.000000000000000</double> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="FormWidget" name="formWidget_10"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="label" stdset="0"> + <string>Scale</string> + </property> + <property name="font"> + <font> + <pointsize>8</pointsize> + </font> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_14"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="ScrSpinBox" name="gSc"> + <property name="minimum"> + <double>0.010000000000000</double> + </property> + <property name="maximum"> + <double>100.000000000000000</double> + </property> + <property name="value"> + <double>100.000000000000000</double> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item row="0" column="2"> + <widget class="ScrSpinBox" name="gX2_2"> + <property name="minimum"> + <double>-3000.000000000000000</double> + </property> + <property name="maximum"> + <double>3000.000000000000000</double> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="ScrSpinBox" name="gX1_2"> + <property name="minimum"> + <double>-3000.000000000000000</double> + </property> + <property name="maximum"> + <double>3000.000000000000000</double> + </property> + </widget> + </item> + <item row="3" column="1"> + <spacer name="verticalSpacer_5"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + </spacer> + </item> + </layout> + </widget> + <widget class="QWidget" name="pageFourColor"> + <layout class="QGridLayout" name="gridLayout_4"> + <property name="leftMargin"> + <number>8</number> + </property> + <property name="topMargin"> + <number>8</number> + </property> + <property name="rightMargin"> + <number>8</number> + </property> + <property name="bottomMargin"> + <number>8</number> + </property> + <property name="spacing"> + <number>4</number> + </property> + <item row="1" column="2"> + <widget class="QLabel" name="label_17"> + <property name="text"> + <string>/</string> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="label_15"> + <property name="text"> + <string>3. Point:</string> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="ScrSpinBox" name="gC3X"> + <property name="minimum"> + <double>-3000.000000000000000</double> + </property> + <property name="maximum"> + <double>3000.000000000000000</double> + </property> + </widget> + </item> + <item row="2" column="3"> + <widget class="ScrSpinBox" name="gC3Y"> + <property name="minimum"> + <double>-3000.000000000000000</double> + </property> + <property name="maximum"> + <double>3000.000000000000000</double> + </property> + </widget> + </item> + <item row="3" column="2"> + <widget class="QLabel" name="label_20"> + <property name="text"> + <string>/</string> + </property> + </widget> + </item> + <item row="3" column="3"> + <widget class="ScrSpinBox" name="gC4Y"> + <property name="minimum"> + <double>-3000.000000000000000</double> + </property> + <property name="maximum"> + <double>3000.000000000000000</double> + </property> + </widget> + </item> + <item row="1" column="3"> + <widget class="ScrSpinBox" name="gC2Y"> + <property name="minimum"> + <double>-3000.000000000000000</double> + </property> + <property name="maximum"> + <double>3000.000000000000000</double> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="ScrSpinBox" name="gC2X"> + <property name="minimum"> + <double>-3000.000000000000000</double> + </property> + <property name="maximum"> + <double>3000.000000000000000</double> + </property> + </widget> + </item> + <item row="0" column="3"> + <widget class="ScrSpinBox" name="gC1Y"> + <property name="minimum"> + <double>-3000.000000000000000</double> + </property> + <property name="maximum"> + <double>3000.000000000000000</double> + </property> + </widget> + </item> + <item row="0" column="2"> + <widget class="QLabel" name="label_18"> + <property name="text"> + <string>/</string> + </property> + </widget> + </item> + <item row="3" column="1"> + <widget class="ScrSpinBox" name="gC4X"> + <property name="minimum"> + <double>-3000.000000000000000</double> + </property> + <property name="maximum"> + <double>3000.000000000000000</double> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="ScrSpinBox" name="gC1X"> + <property name="minimum"> + <double>-3000.000000000000000</double> + </property> + <property name="maximum"> + <double>3000.000000000000000</double> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_16"> + <property name="text"> + <string>2. Point:</string> + </property> + </widget> + </item> + <item row="3" column="0"> + <widget class="QLabel" name="label_21"> + <property name="text"> + <string>4. Point:</string> + </property> + </widget> + </item> + <item row="0" column="0"> + <widget class="QLabel" name="label_19"> + <property name="text"> + <string>1. Point:</string> + </property> + </widget> + </item> + <item row="2" column="2"> + <widget class="QLabel" name="label_14"> + <property name="text"> + <string>/</string> + </property> + </widget> + </item> + <item row="4" column="1"> + <spacer name="verticalSpacer_4"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + </spacer> + </item> + </layout> + </widget> + <widget class="QWidget" name="pageDiamond"> + <layout class="QGridLayout" name="gridLayout_2"> + <property name="leftMargin"> + <number>8</number> + </property> + <property name="topMargin"> + <number>8</number> + </property> + <property name="rightMargin"> + <number>8</number> + </property> + <property name="bottomMargin"> + <number>8</number> + </property> + <property name="spacing"> + <number>4</number> + </property> + <item row="0" column="0"> + <widget class="QLabel" name="label_23"> + <property name="text"> + <string>1. Point:</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="ScrSpinBox" name="gC1XD"> + <property name="minimum"> + <double>-3000.000000000000000</double> + </property> + <property name="maximum"> + <double>3000.000000000000000</double> + </property> + </widget> + </item> + <item row="0" column="2"> + <widget class="QLabel" name="label_26"> + <property name="text"> + <string>/</string> + </property> + </widget> + </item> + <item row="0" column="3"> + <widget class="ScrSpinBox" name="gC1YD"> + <property name="minimum"> + <double>-3000.000000000000000</double> + </property> + <property name="maximum"> + <double>3000.000000000000000</double> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_25"> + <property name="text"> + <string>2. Point:</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="ScrSpinBox" name="gC2XD"> + <property name="minimum"> + <double>-3000.000000000000000</double> + </property> + <property name="maximum"> + <double>3000.000000000000000</double> + </property> + </widget> + </item> + <item row="1" column="2"> + <widget class="QLabel" name="label_24"> + <property name="text"> + <string>/</string> + </property> + </widget> + </item> + <item row="1" column="3"> + <widget class="ScrSpinBox" name="gC2YD"> + <property name="minimum"> + <double>-3000.000000000000000</double> + </property> + <property name="maximum"> + <double>3000.000000000000000</double> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="label_27"> + <property name="text"> + <string>3. Point:</string> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="ScrSpinBox" name="gC3XD"> + <property name="minimum"> + <double>-3000.000000000000000</double> + </property> + <property name="maximum"> + <double>3000.000000000000000</double> + </property> + </widget> + </item> + <item row="2" column="2"> + <widget class="QLabel" name="label_29"> + <property name="text"> + <string>/</string> + </property> + </widget> + </item> + <item row="2" column="3"> + <widget class="ScrSpinBox" name="gC3YD"> + <property name="minimum"> + <double>-3000.000000000000000</double> + </property> + <property name="maximum"> + <double>3000.000000000000000</double> + </property> + </widget> + </item> + <item row="3" column="0"> + <widget class="QLabel" name="label_28"> + <property name="text"> + <string>4. Point:</string> + </property> + </widget> + </item> + <item row="3" column="1"> + <widget class="ScrSpinBox" name="gC4XD"> + <property name="minimum"> + <double>-3000.000000000000000</double> + </property> + <property name="maximum"> + <double>3000.000000000000000</double> + </property> + </widget> + </item> + <item row="3" column="2"> + <widget class="QLabel" name="label_22"> + <property name="text"> + <string>/</string> + </property> + </widget> + </item> + <item row="3" column="3"> + <widget class="ScrSpinBox" name="gC4YD"> + <property name="minimum"> + <double>-3000.000000000000000</double> + </property> + <property name="maximum"> + <double>3000.000000000000000</double> + </property> + </widget> + </item> + <item row="4" column="0"> + <widget class="QLabel" name="label_30"> + <property name="text"> + <string>5. Point:</string> + </property> + </widget> + </item> + <item row="4" column="1"> + <widget class="ScrSpinBox" name="gC5XD"> + <property name="minimum"> + <double>-3000.000000000000000</double> + </property> + <property name="maximum"> + <double>3000.000000000000000</double> + </property> + </widget> + </item> + <item row="4" column="2"> + <widget class="QLabel" name="label_31"> + <property name="text"> + <string>/</string> + </property> + </widget> + </item> + <item row="4" column="3"> + <widget class="ScrSpinBox" name="gC5YD"> + <property name="minimum"> + <double>-3000.000000000000000</double> + </property> + <property name="maximum"> + <double>3000.000000000000000</double> + </property> + </widget> + </item> + </layout> + </widget> + <widget class="QWidget" name="pageMesh"> + <layout class="QVBoxLayout" name="verticalLayout_2"> + <property name="spacing"> + <number>4</number> + </property> + <property name="leftMargin"> + <number>8</number> + </property> + <property name="topMargin"> + <number>8</number> + </property> + <property name="rightMargin"> + <number>8</number> + </property> + <property name="bottomMargin"> + <number>8</number> + </property> + <item> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <layout class="QGridLayout" name="gridLayout_5"> + <item row="0" column="0"> + <widget class="QToolButton" name="editPoints"> + <property name="minimumSize"> + <size> + <width>22</width> + <height>22</height> + </size> + </property> + <property name="toolTip"> + <string>Edit Grid Points</string> + </property> + <property name="text"> + <string/> + </property> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="autoExclusive"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QToolButton" name="editControlPoints"> + <property name="minimumSize"> + <size> + <width>22</width> + <height>22</height> + </size> + </property> + <property name="toolTip"> + <string>Edit Control Points</string> + </property> + <property name="text"> + <string/> + </property> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="autoExclusive"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QToolButton" name="resetControlPoint"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="minimumSize"> + <size> + <width>22</width> + <height>22</height> + </size> + </property> + <property name="toolTip"> + <string>Reset selected Control Point</string> + </property> + <property name="text"> + <string/> + </property> + <property name="checkable"> + <bool>false</bool> + </property> + <property name="autoExclusive"> + <bool>false</bool> + </property> + </widget> + </item> + <item row="1" column="2"> + <widget class="QToolButton" name="resetAllControlPoints"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="minimumSize"> + <size> + <width>22</width> + <height>22</height> + </size> + </property> + <property name="toolTip"> + <string>Reset all Control Points</string> + </property> + <property name="text"> + <string/> + </property> + <property name="checkable"> + <bool>false</bool> + </property> + <property name="autoExclusive"> + <bool>false</bool> + </property> + </widget> + </item> + </layout> + </item> + <item> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_2"> + <item> + <layout class="QGridLayout" name="gridLayout_6"> + <item row="0" column="0"> + <widget class="QPushButton" name="buttonNewGrid"> + <property name="text"> + <string>New Mesh...</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QPushButton" name="buttonResetGrid"> + <property name="text"> + <string>Reset Mesh</string> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QPushButton" name="buttonPoLIne"> + <property name="text"> + <string>Mesh -> Shape</string> + </property> + </widget> + </item> + </layout> + </item> + <item> + <spacer name="horizontalSpacer_2"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>18</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + <item> + <spacer name="verticalSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + </spacer> + </item> + </layout> + </widget> + <widget class="QWidget" name="pagePatch"> + <layout class="QVBoxLayout" name="verticalLayout_3"> + <property name="spacing"> + <number>4</number> + </property> + <property name="leftMargin"> + <number>8</number> + </property> + <property name="topMargin"> + <number>8</number> + </property> + <property name="rightMargin"> + <number>8</number> + </property> + <property name="bottomMargin"> + <number>8</number> + </property> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_3"> + <item> + <layout class="QGridLayout" name="gridLayout_7"> + <item row="0" column="0"> + <widget class="QToolButton" name="editPPoint"> + <property name="minimumSize"> + <size> + <width>22</width> + <height>22</height> + </size> + </property> + <property name="toolTip"> + <string>Edit Grid Points</string> + </property> + <property name="text"> + <string/> + </property> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="autoExclusive"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QToolButton" name="editPControlPoints"> + <property name="minimumSize"> + <size> + <width>22</width> + <height>22</height> + </size> + </property> + <property name="toolTip"> + <string>Edit Control Points</string> + </property> + <property name="text"> + <string/> + </property> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="autoExclusive"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QToolButton" name="resetPControlPoint"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="minimumSize"> + <size> + <width>22</width> + <height>22</height> + </size> + </property> + <property name="toolTip"> + <string>Reset selected Control Point</string> + </property> + <property name="text"> + <string/> + </property> + <property name="checkable"> + <bool>false</bool> + </property> + <property name="autoExclusive"> + <bool>false</bool> + </property> + </widget> + </item> + <item row="1" column="2"> + <widget class="QToolButton" name="resetAllPControlPoints"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="minimumSize"> + <size> + <width>22</width> + <height>22</height> + </size> + </property> + <property name="toolTip"> + <string>Reset all Control Points</string> + </property> + <property name="text"> + <string/> + </property> + <property name="checkable"> + <bool>false</bool> + </property> + <property name="autoExclusive"> + <bool>false</bool> + </property> + </widget> + </item> + </layout> + </item> + <item> + <spacer name="horizontalSpacer_3"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + <item> + <widget class="QCheckBox" name="snapToGrid"> + <property name="text"> + <string>Snap to other Mesh Points</string> + </property> + </widget> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_4"> + <item> + <widget class="QPushButton" name="buttonAddPatch"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="text"> + <string>Add Patch</string> + </property> + <property name="checkable"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="buttonRemovePatch"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>Remove Patch</string> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_4"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + <item> + <spacer name="verticalSpacer_2"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + </spacer> + </item> + </layout> + </widget> + </widget> + <customwidgets> + <customwidget> + <class>FormWidget</class> + <extends>QWidget</extends> + <header>ui/widgets/form_widget.h</header> + <container>1</container> + </customwidget> + <customwidget> + <class>StackedContainer</class> + <extends>QStackedWidget</extends> + <header>ui/widgets/stacked_container.h</header> + <container>1</container> + </customwidget> + <customwidget> + <class>ScrSpinBox</class> + <extends>QDoubleSpinBox</extends> + <header location="global">ui/scrspinbox.h</header> + </customwidget> + </customwidgets> + <tabstops> + <tabstop>gX1_2</tabstop> + <tabstop>gY1_2</tabstop> + <tabstop>gX2_2</tabstop> + <tabstop>gY2_2</tabstop> + <tabstop>gFX</tabstop> + <tabstop>gFY</tabstop> + <tabstop>gSc</tabstop> + <tabstop>gSk_2</tabstop> + <tabstop>gC1X</tabstop> + <tabstop>gC1Y</tabstop> + <tabstop>gC2X</tabstop> + <tabstop>gC2Y</tabstop> + <tabstop>gC3X</tabstop> + <tabstop>gC3Y</tabstop> + <tabstop>gC4X</tabstop> + <tabstop>gC4Y</tabstop> + <tabstop>gC1XD</tabstop> + <tabstop>gC1YD</tabstop> + <tabstop>gC2XD</tabstop> + <tabstop>gC2YD</tabstop> + <tabstop>gC3XD</tabstop> + <tabstop>gC3YD</tabstop> + <tabstop>gC4XD</tabstop> + <tabstop>gC4YD</tabstop> + <tabstop>gC5XD</tabstop> + <tabstop>gC5YD</tabstop> + <tabstop>editPoints</tabstop> + <tabstop>editControlPoints</tabstop> + <tabstop>resetControlPoint</tabstop> + <tabstop>resetAllControlPoints</tabstop> + <tabstop>buttonNewGrid</tabstop> + <tabstop>buttonResetGrid</tabstop> + <tabstop>buttonPoLIne</tabstop> + <tabstop>editPPoint</tabstop> + <tabstop>editPControlPoints</tabstop> + <tabstop>resetPControlPoint</tabstop> + <tabstop>resetAllPControlPoints</tabstop> + <tabstop>snapToGrid</tabstop> + <tabstop>buttonAddPatch</tabstop> + <tabstop>buttonRemovePatch</tabstop> + <tabstop>gX1</tabstop> + <tabstop>gY1</tabstop> + <tabstop>gX2</tabstop> + <tabstop>gY2</tabstop> + <tabstop>gSk</tabstop> + </tabstops> + <resources/> + <connections/> +</ui> Index: scribus/ui/colorpicker/colorpicker_gradient_swatches.cpp =================================================================== --- scribus/ui/colorpicker/colorpicker_gradient_swatches.cpp (nicht existent) +++ scribus/ui/colorpicker/colorpicker_gradient_swatches.cpp (Arbeitskopie) @@ -0,0 +1,39 @@ +#include "colorpicker_gradient_swatches.h" +#include "ui/widgets/gradientlistbox.h" + +ColorPickerGradientSwatches::ColorPickerGradientSwatches(QWidget *parent) : QWidget(parent) +{ + setupUi(this); + + listSwatches->setPixmapType(GradientListBox::widePixmap); + + connect(listSwatches, &GradientListBox::currentTextChanged, this, &ColorPickerGradientSwatches::setGradientFromWidget); +} + +void ColorPickerGradientSwatches::setGradients(const GradientList &list, bool insertNone) +{ + GradientListModel* clm = qobject_cast<GradientListModel*>(listSwatches->model()); + if (!clm) + return; + + clm->setGradientList(list, insertNone); +} + +void ColorPickerGradientSwatches::setCurrentGradient(QString gradientName) +{ + m_gradientName = gradientName == "" ? CommonStrings::trCustom : gradientName; + + // update color list + QSignalBlocker sig(listSwatches); + listSwatches->setCurrentGradient(m_gradientName); + +} + +void ColorPickerGradientSwatches::setGradientFromWidget(QString gradientName) +{ + if (gradientName == CommonStrings::trCustom) + gradientName = ""; + + setCurrentGradient(gradientName); + emit gradientChanged(gradientName, listSwatches->currentGradient()); +} Index: scribus/ui/colorpicker/colorpicker_gradient_swatches.h =================================================================== --- scribus/ui/colorpicker/colorpicker_gradient_swatches.h (nicht existent) +++ scribus/ui/colorpicker/colorpicker_gradient_swatches.h (Arbeitskopie) @@ -0,0 +1,33 @@ +#ifndef COLORPICKER_GRADIENT_SWATCHES_H +#define COLORPICKER_GRADIENT_SWATCHES_H + +#include "ui_colorpicker_gradient_swatches.h" +#include <QWidget> +#include "vgradient.h" + +class ColorPickerGradientSwatches : public QWidget, Ui::ColorPickerGradientSwatches +{ + Q_OBJECT + +public: + + explicit ColorPickerGradientSwatches(QWidget *parent = nullptr); + ~ColorPickerGradientSwatches() {}; + + void setGradients(const GradientList& list, bool insertNone = true); + +public slots: + void setCurrentGradient(QString gradientName); + +private slots: + void setGradientFromWidget(QString gradientName); + +private: + QString m_gradientName; + +signals: + void gradientChanged(QString name, VGradient gradient); + +}; + +#endif // COLORPICKER_GRADIENT_SWATCHES_H Index: scribus/ui/colorpicker/colorpicker_gradient_swatches.ui =================================================================== --- scribus/ui/colorpicker/colorpicker_gradient_swatches.ui (nicht existent) +++ scribus/ui/colorpicker/colorpicker_gradient_swatches.ui (Arbeitskopie) @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>ColorPickerGradientSwatches</class> + <widget class="QWidget" name="ColorPickerGradientSwatches"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>314</width> + <height>299</height> + </rect> + </property> + <property name="windowTitle"> + <string>Form</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <property name="spacing"> + <number>0</number> + </property> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="GradientListBox" name="listSwatches"/> + </item> + </layout> + </widget> + <customwidgets> + <customwidget> + <class>GradientListBox</class> + <extends>QListView</extends> + <header>ui/widgets/gradientlistbox.h</header> + </customwidget> + </customwidgets> + <resources/> + <connections/> +</ui> Index: scribus/ui/colorpicker/colorpicker_hatch.cpp =================================================================== --- scribus/ui/colorpicker/colorpicker_hatch.cpp (nicht existent) +++ scribus/ui/colorpicker/colorpicker_hatch.cpp (Arbeitskopie) @@ -0,0 +1,207 @@ +#include "colorpicker_hatch.h" +#include "units.h" +#include "util_gui.h" +#include "sccolorengine.h" +#include "sccolor.h" +#include "ui/colorlistbox.h" + +ColorPickerHatch::ColorPickerHatch(QWidget *parent) : + QWidget(parent) +{ + setupUi(this); + + listForegroundSwatches = new ColorListBox(ColorListBox::fancyPixmap); + listBackgroundSwatches = new ColorListBox(ColorListBox::fancyPixmap); + + buttonLineColor->setContextWidget(listForegroundSwatches); + buttonBackgroundColor->setContextWidget(listBackgroundSwatches); + + hatchAngle->setDecimals(0); + hatchAngle->setNewUnit(6); + hatchAngle->setValues(-360, 360, 1, 0); + hatchDist->setDecimals(0); + hatchDist->setNewUnit(0); + hatchDist->setValues(1, 1000, 0, 1); + + connectSlots(); +} + +void ColorPickerHatch::connectSlots() +{ + connect(hatchAngle, SIGNAL(valueChanged(double)), this, SLOT(updateHatch())); + connect(hatchDist, SIGNAL(valueChanged(double)), this, SLOT(updateHatch())); + connect(hatchType, SIGNAL(activated(int)), this, SLOT(updateHatch())); + connect(listForegroundSwatches, &ColorListBox::itemSelectionChanged, this, &ColorPickerHatch::updateHatch); + connect(listBackgroundSwatches, &ColorListBox::itemSelectionChanged, this, &ColorPickerHatch::updateHatch); +} + +void ColorPickerHatch::disconnectSlots() +{ + disconnect(hatchAngle, SIGNAL(valueChanged(double)), this, SLOT(updateHatch())); + disconnect(hatchDist, SIGNAL(valueChanged(double)), this, SLOT(updateHatch())); + disconnect(hatchType, SIGNAL(activated(int)), this, SLOT(updateHatch())); + disconnect(listForegroundSwatches, &ColorListBox::itemSelectionChanged, this, &ColorPickerHatch::updateHatch); + disconnect(listBackgroundSwatches, &ColorListBox::itemSelectionChanged, this, &ColorPickerHatch::updateHatch); +} + +/* ********************************************************************************* * + * + * Members + * + * ********************************************************************************* */ + +Context ColorPickerHatch::context() +{ + return m_context; +} + +void ColorPickerHatch::setContext(Context config) +{ + m_context = config; +} + +void ColorPickerHatch::setColorList(const ColorList &list) +{ + QSignalBlocker sig1(listForegroundSwatches); + QSignalBlocker sig2(listBackgroundSwatches); + + colList = list; + listForegroundSwatches->setColors(colList, false); + listBackgroundSwatches->setColors(colList, true); +} + +CPHatchData ColorPickerHatch::hatchData() +{ + return m_hatch; +} + +QString ColorPickerHatch::toolTipText() const +{ + return QString( tr("Hatch") ); +} + +void ColorPickerHatch::setDoc(ScribusDoc *doc) +{ + m_doc = doc; + unitChange(); +} + +void ColorPickerHatch::setHatchData(CPHatchData hatch) +{ + m_hatch = hatch; + + disconnectSlots(); + + hatchAngle->setValue(m_hatch.Angle); + hatchDist->setValue(m_hatch.Distance * unitGetRatioFromIndex(currentUnit)); + hatchType->setCurrentIndex(m_hatch.Type); + + if ((m_hatch.ColorForeground != CommonStrings::None) && (!m_hatch.ColorForeground.isEmpty())) + listForegroundSwatches->setCurrentColor(m_hatch.ColorForeground); + + if (m_hatch.HasBackgroundColor) + { + if (!m_hatch.ColorBackground.isEmpty()) + listBackgroundSwatches->setCurrentColor(m_hatch.ColorBackground); + } + else + listBackgroundSwatches->setCurrentColor(CommonStrings::None); + + buttonLineColor->setBackground( colorBrush(buttonLineColor->backgroundDotSize(), m_hatch.ColorForeground) ); + buttonLineColor->setToolTip(m_hatch.ColorForeground); + buttonBackgroundColor->setBackground( colorBrush(buttonBackgroundColor->backgroundDotSize(), m_hatch.ColorBackground) ); + buttonBackgroundColor->setToolTip(m_hatch.ColorBackground); + + connectSlots(); +} + +/* ********************************************************************************* * + * + * Public Slots + * + * ********************************************************************************* */ + +void ColorPickerHatch::languageChange() +{ + + int oldHatchTypeIndex = hatchType->currentIndex(); + QSignalBlocker sigType(hatchType); + + // Retranslate UI + retranslateUi(this); + + hatchType->setCurrentIndex(oldHatchTypeIndex); + +} + +void ColorPickerHatch::unitChange() +{ + if (!m_doc) + return; + + currentUnit = m_doc->unitIndex(); + hatchDist->setNewUnit(currentUnit); +} + +/* ********************************************************************************* * + * + * Private Slots + * + * ********************************************************************************* */ + +void ColorPickerHatch::updateSize() +{ + int w = this->width(); + adjustSize(); + resize(w, sizeHint().height()); + emit sizeChanged(); +} + +void ColorPickerHatch::updateHatch() +{ + QString color1 = listForegroundSwatches->currentColor(); + if (color1 == CommonStrings::tr_NoneColor) + color1 = CommonStrings::None; + QString color2 = listBackgroundSwatches->currentColor(); + if (color2 == CommonStrings::tr_NoneColor) + color2 = CommonStrings::None; + + m_hatch.ColorForeground = color1; + m_hatch.ColorBackground = color2; + m_hatch.HasBackgroundColor = (color2 != CommonStrings::None); + m_hatch.Angle = hatchAngle->value(); + m_hatch.Distance = hatchDist->value() / unitGetRatioFromIndex(currentUnit); + m_hatch.Type = hatchType->currentIndex(); + + buttonLineColor->setBackground( colorBrush(buttonLineColor->backgroundDotSize(), m_hatch.ColorForeground) ); + buttonLineColor->setToolTip(m_hatch.ColorForeground); + buttonBackgroundColor->setBackground( colorBrush(buttonBackgroundColor->backgroundDotSize(), m_hatch.ColorBackground) ); + buttonBackgroundColor->setToolTip(m_hatch.ColorBackground); + + emit hatchChanged(); +} + +QColor ColorPickerHatch::colorFromName(QString colorName, double shade) +{ + if (!m_doc) + return QColor(); + + ScColor sColor(0, 0, 0); + shade = qBound(0.0, shade, 100.0); + + if (m_doc->PageColors.contains(colorName)) + sColor = m_doc->PageColors.value(colorName); + + return ScColorEngine::getDisplayColor(sColor, m_doc, shade); +} + +QBrush ColorPickerHatch::colorBrush(QSize size, QString colorName, double shade, double opacity) +{ + if (!m_doc || colorName == CommonStrings::tr_NoneColor || colorName == CommonStrings::None) + return renderEmptyPattern(size); + else + return renderColor(size, colorFromName(colorName, 100.0), colorFromName(colorName, shade), opacity); +} + + + Index: scribus/ui/colorpicker/colorpicker_hatch.h =================================================================== --- scribus/ui/colorpicker/colorpicker_hatch.h (nicht existent) +++ scribus/ui/colorpicker/colorpicker_hatch.h (Arbeitskopie) @@ -0,0 +1,62 @@ +#ifndef COLORPICKER_HATCH_H +#define COLORPICKER_HATCH_H + +#include <QWidget> +#include "ui_colorpicker_hatch.h" +#include "scribusdoc.h" +#include "colorpicker_enum.h" + +class ColorList; +class ColorListBox; + +class ColorPickerHatch : public QWidget, Ui::ColorPickerHatch +{ + Q_OBJECT + +public: + explicit ColorPickerHatch(QWidget *parent = nullptr); + ~ColorPickerHatch() {}; + + Context context(); + void setContext(Context config); + + void setColorList(const ColorList& list); + + CPHatchData hatchData(); + int type() { return Gradient_Hatch; }; + + QString toolTipText() const; + +public slots: + void setDoc(ScribusDoc *doc); + void setHatchData(CPHatchData hatch); + void languageChange(); + void unitChange(); + +private slots: + void updateSize(); + void updateHatch(); + +private: + ScribusDoc *m_doc {nullptr}; + QBrush m_background; + Context m_context {Context::Simple}; + CPHatchData m_hatch; + int currentUnit {0}; + ColorList colList; + ColorListBox *listForegroundSwatches; + ColorListBox *listBackgroundSwatches; + + QColor colorFromName(QString colorName, double shade); + QBrush colorBrush(QSize size, QString colorName, double shade = 100.0, double opacity = 1.0); + + void connectSlots(); + void disconnectSlots(); + +signals: + void hatchChanged(); + void sizeChanged(); + +}; + +#endif // COLORPICKER_HATCH_H Index: scribus/ui/colorpicker/colorpicker_hatch.ui =================================================================== --- scribus/ui/colorpicker/colorpicker_hatch.ui (nicht existent) +++ scribus/ui/colorpicker/colorpicker_hatch.ui (Arbeitskopie) @@ -0,0 +1,310 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>ColorPickerHatch</class> + <widget class="QWidget" name="ColorPickerHatch"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>265</width> + <height>138</height> + </rect> + </property> + <property name="windowTitle"> + <string>Form</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <property name="spacing"> + <number>4</number> + </property> + <property name="leftMargin"> + <number>8</number> + </property> + <property name="topMargin"> + <number>8</number> + </property> + <property name="rightMargin"> + <number>8</number> + </property> + <property name="bottomMargin"> + <number>8</number> + </property> + <item> + <layout class="QHBoxLayout" name="horizontalLayout"> + <property name="spacing"> + <number>4</number> + </property> + <item> + <widget class="FormWidget" name="hatchDistLabel"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="label" stdset="0"> + <string>Distance</string> + </property> + <property name="font"> + <font> + <pointsize>8</pointsize> + </font> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_4"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="ScrSpinBox" name="hatchDist"/> + </item> + </layout> + </widget> + </item> + <item> + <widget class="FormWidget" name="hatchAngleLabel"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="label" stdset="0"> + <string>Angle</string> + </property> + <property name="font"> + <font> + <pointsize>8</pointsize> + </font> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_3"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="ScrSpinBox" name="hatchAngle"> + <property name="minimum"> + <double>-360.000000000000000</double> + </property> + <property name="maximum"> + <double>360.000000000000000</double> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="FormWidget" name="hatchTypeLabel"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="label" stdset="0"> + <string>Type</string> + </property> + <property name="font"> + <font> + <pointsize>8</pointsize> + </font> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_2"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="QComboBox" name="hatchType"> + <item> + <property name="text"> + <string>Single</string> + </property> + </item> + <item> + <property name="text"> + <string>Double</string> + </property> + </item> + <item> + <property name="text"> + <string>Triple</string> + </property> + </item> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_2"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_5"> + <item> + <widget class="FormWidget" name="hatchLineColorLabel"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="label" stdset="0"> + <string>Line</string> + </property> + <property name="font"> + <font> + <pointsize>8</pointsize> + </font> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_7"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="ColorButton" name="buttonLineColor"> + <property name="text"> + <string/> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="FormWidget" name="hatchBackgroundLabel"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="label" stdset="0"> + <string>Background</string> + </property> + <property name="font"> + <font> + <pointsize>8</pointsize> + </font> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_6"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="ColorButton" name="buttonBackgroundColor"> + <property name="text"> + <string/> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + <item> + <spacer name="verticalSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + </spacer> + </item> + </layout> + </widget> + <customwidgets> + <customwidget> + <class>FormWidget</class> + <extends>QWidget</extends> + <header>ui/widgets/form_widget.h</header> + <container>1</container> + </customwidget> + <customwidget> + <class>ScrSpinBox</class> + <extends>QDoubleSpinBox</extends> + <header location="global">ui/scrspinbox.h</header> + </customwidget> + <customwidget> + <class>ColorButton</class> + <extends>QToolButton</extends> + <header>ui/widgets/color_button.h</header> + </customwidget> + </customwidgets> + <resources/> + <connections/> +</ui> Index: scribus/ui/colorpicker/colorpicker_pattern.cpp =================================================================== --- scribus/ui/colorpicker/colorpicker_pattern.cpp (nicht existent) +++ scribus/ui/colorpicker/colorpicker_pattern.cpp (Arbeitskopie) @@ -0,0 +1,365 @@ +#include "colorpicker_pattern.h" +#include "scribusapp.h" +#include "iconmanager.h" +#include "units.h" +#include "util_gui.h" +#include "ui/linkbutton.h" + +ColorPickerPattern::ColorPickerPattern(QWidget *parent) : + QWidget(parent) +{ + setupUi(this); + + iconSetChange(); + + // offset + numberOffsetX->setMinimum(-3000); + numberOffsetX->setMaximum(3000); + numberOffsetX->setNewUnit(SC_POINTS); + numberOffsetY->setMinimum(-3000); + numberOffsetY->setMaximum(3000); + numberOffsetY->setNewUnit(SC_POINTS); + // scale + numberScaleX->setMinimum(0.01); + numberScaleX->setMaximum(500); + numberScaleX->setNewUnit(SC_PERCENT); + numberScaleX->setValue( 100 ); + numberScaleY->setMinimum(0.01); + numberScaleY->setMaximum(500); + numberScaleY->setNewUnit(SC_PERCENT); + numberScaleY->setValue( 100 ); + buttonScaleRatio->setCheckable( true ); + buttonScaleRatio->setAutoRaise( true ); + // angle + numberAngle->setMinimum(-180); + numberAngle->setMaximum(180); + numberAngle->setNewUnit(SC_DEGREES); + // skew + numberSkewX->setMinimum(-89); + numberSkewX->setMaximum(89); + numberSkewX->setNewUnit(SC_DEGREES); + numberSkewX->setValue( 0 ); + numberSkewY->setMinimum(-89); + numberSkewY->setMaximum(89); + numberSkewY->setNewUnit(SC_DEGREES); + numberSkewY->setValue( 0 ); + // spacing + numberSpacing->setMinimum(1); + numberSpacing->setMaximum(500); + numberSpacing->setValue( 100 ); + // flip + buttonFlipHorizontal->setCheckable( true ); + buttonFlipVertical->setCheckable( true ); + + connect(ScQApp, SIGNAL(iconSetChanged()), this, SLOT(iconSetChange())); + connect(sectionProperties, &SectionContainer::sizeChanged, this, &ColorPickerPattern::updateSize); + connect(sectionSwatches, &SectionContainer::sizeChanged, this, &ColorPickerPattern::updateSize); + + connectSlots(); + +} + + +void ColorPickerPattern::connectSlots() +{ + connect(listPattern, &QListWidget::itemClicked, this, &ColorPickerPattern::updateName); + connect(numberOffsetX, &ScrSpinBox::valueChanged, this, &ColorPickerPattern::updatePattern); + connect(numberOffsetY, &ScrSpinBox::valueChanged, this, &ColorPickerPattern::updatePattern); + connect(numberScaleX, &ScrSpinBox::valueChanged, this, &ColorPickerPattern::updateScaleX); + connect(numberScaleY, &ScrSpinBox::valueChanged, this, &ColorPickerPattern::updateScaleY); + connect(numberSkewX, &ScrSpinBox::valueChanged, this, &ColorPickerPattern::updatePattern); + connect(numberSkewY, &ScrSpinBox::valueChanged, this, &ColorPickerPattern::updatePattern); + connect(numberAngle, &ScrSpinBox::valueChanged, this, &ColorPickerPattern::updatePattern); + connect(numberSpacing, &ScrSpinBox::valueChanged, this, &ColorPickerPattern::updatePattern); + connect(buttonFlipHorizontal, &QToolButton::toggled, this, &ColorPickerPattern::updatePattern); + connect(buttonFlipVertical, &QToolButton::toggled, this, &ColorPickerPattern::updatePattern); + connect(buttonScaleRatio, &LinkButton::toggled, this, &ColorPickerPattern::toggleScaleRatio); + connect(checkboxFollowsPath, &QCheckBox::toggled, this, &ColorPickerPattern::updatePattern); + connect(checkboxLumAlpha, &QCheckBox::toggled, this, &ColorPickerPattern::updatePattern); + connect(checkboxInvertedPattern, &QCheckBox::toggled, this, &ColorPickerPattern::updatePattern); +} + +void ColorPickerPattern::disconnectSlots() +{ + disconnect(listPattern, &QListWidget::itemClicked, this, &ColorPickerPattern::updateName); + disconnect(numberOffsetX, &ScrSpinBox::valueChanged, this, &ColorPickerPattern::updatePattern); + disconnect(numberOffsetY, &ScrSpinBox::valueChanged, this, &ColorPickerPattern::updatePattern); + disconnect(numberScaleX, &ScrSpinBox::valueChanged, this, &ColorPickerPattern::updateScaleX); + disconnect(numberScaleY, &ScrSpinBox::valueChanged, this, &ColorPickerPattern::updateScaleY); + disconnect(numberSkewX, &ScrSpinBox::valueChanged, this, &ColorPickerPattern::updatePattern); + disconnect(numberSkewY, &ScrSpinBox::valueChanged, this, &ColorPickerPattern::updatePattern); + disconnect(numberAngle, &ScrSpinBox::valueChanged, this, &ColorPickerPattern::updatePattern); + disconnect(numberSpacing, &ScrSpinBox::valueChanged, this, &ColorPickerPattern::updatePattern); + disconnect(buttonFlipHorizontal, &QToolButton::toggled, this, &ColorPickerPattern::updatePattern); + disconnect(buttonFlipVertical, &QToolButton::toggled, this, &ColorPickerPattern::updatePattern); + disconnect(buttonScaleRatio, &LinkButton::toggled, this, &ColorPickerPattern::toggleScaleRatio); + disconnect(checkboxFollowsPath, &QCheckBox::toggled, this, &ColorPickerPattern::updatePattern); + disconnect(checkboxLumAlpha, &QCheckBox::toggled, this, &ColorPickerPattern::updatePattern); + disconnect(checkboxInvertedPattern, &QCheckBox::toggled, this, &ColorPickerPattern::updatePattern); +} + +/* ********************************************************************************* * + * + * Members + * + * ********************************************************************************* */ + +void ColorPickerPattern::setPatternList(QHash<QString, ScPattern> *docPatterns) +{ + QSignalBlocker sigListPattern(listPattern); + + listPattern->clear(); + listPattern->setIconSize(QSize(48, 48)); + QStringList patK = docPatterns->keys(); + patK.sort(); + for (int a = 0; a < patK.count(); a++) + { + ScPattern sp = docPatterns->value(patK[a]); + QListWidgetItem *item = new QListWidgetItem(renderPattern(listPattern->iconSize(), sp), patK[a], listPattern); + item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); + } + listPattern->clearSelection(); +} + +CPPatternData ColorPickerPattern::patternData() +{ + return m_pattern; +} + +Context ColorPickerPattern::context() +{ + return m_context; +} + +void ColorPickerPattern::setContext(Context config) +{ + m_context = config; + + switch(m_context) + { + case Context::Line: + checkboxLumAlpha->setVisible(false); + checkboxInvertedPattern->setVisible(false); + checkboxFollowsPath->setVisible(true); + labelSpacing->setVisible(true); + break; + case Context::FillMask: + checkboxLumAlpha->setVisible(true); + checkboxInvertedPattern->setVisible(true); + checkboxFollowsPath->setVisible(false); + labelSpacing->setVisible(false); + break; + case Context::Fill: + checkboxLumAlpha->setVisible(false); + checkboxInvertedPattern->setVisible(false); + checkboxFollowsPath->setVisible(false); + labelSpacing->setVisible(false); + break; + default: + case Context::Simple: + break; + } + + updateSize(); +} + +void ColorPickerPattern::hideEditedPatterns(QStringList names) +{ + for (int i = 0; i < names.count(); i++) + { + QList<QListWidgetItem*> items = listPattern->findItems(names[i], Qt::MatchExactly); + if (items.count() > 0) + items[0]->setHidden(true); + } +} + +int ColorPickerPattern::type() +{ + switch(m_context){ + case Context::FillMask: + if (checkboxLumAlpha->isChecked()) + { + if (checkboxInvertedPattern->isChecked()) + return GradMask_PatternLumAlphaInverted; + else + return GradMask_PatternLumAlpha; + } + else + { + if (checkboxInvertedPattern->isChecked()) + return GradMask_PatternInverted; + else + return GradMask_Pattern; + } + break; + default: + return Gradient_Pattern; + break; + } +} + +QString ColorPickerPattern::toolTipText() const +{ + return QString( tr("Pattern: %1") ).arg(m_pattern.Name); +} + +void ColorPickerPattern::setDoc(ScribusDoc *doc) +{ + m_doc = doc; + unitChange(); +} + +void ColorPickerPattern::setPatternData(CPPatternData pattern) +{ + m_pattern = pattern; + + disconnectSlots(); + + // no patterns available + if (m_pattern.Name.isEmpty() && (listPattern->count() == 0)) + return; + // set name by first pattern in the list + if (m_pattern.Name.isEmpty() && (listPattern->count() > 0)) + m_pattern.Name = listPattern->item(0)->text(); + + QList<QListWidgetItem*> itl = listPattern->findItems(m_pattern.Name, Qt::MatchExactly); + if (itl.count() != 0) + { + QListWidgetItem *it = itl[0]; + listPattern->setCurrentItem(it); + } + else + listPattern->clearSelection(); + + numberOffsetX->setValue(m_pattern.OffsetX * unitGetRatioFromIndex(currentUnit)); + numberOffsetY->setValue(m_pattern.OffsetY * unitGetRatioFromIndex(currentUnit)); + numberScaleX->setValue(m_pattern.ScaleX * 100.0); + numberScaleY->setValue(m_pattern.ScaleY * 100.0); + numberSpacing->setValue(m_pattern.Spacing * 100.0); + numberSpacing->setEnabled(m_pattern.OnPath); + double asina = atan(m_pattern.SkewX); + numberSkewX->setValue(asina / (M_PI / 180.0)); + double asinb = atan(m_pattern.SkewY); + numberSkewY->setValue(asinb / (M_PI / 180.0)); + numberAngle->setValue(m_pattern.Angle); + buttonFlipHorizontal->setChecked(m_pattern.MirrorX); + buttonFlipVertical->setChecked(m_pattern.MirrorY); + checkboxFollowsPath->setChecked(m_pattern.OnPath); + buttonScaleRatio->setChecked( m_pattern.ScaleX == m_pattern.ScaleY ); + + connectSlots(); + +} + +/* ********************************************************************************* * + * + * Slots + * + * ********************************************************************************* */ + +void ColorPickerPattern::languageChange() +{ + sectionProperties->setText( tr("Properties") ); + sectionSwatches->setText( tr("Patterns") ); + + labelOffset->setText( tr("Offset") ); + labelScale->setText( tr("Scale") ); + labelSkew->setText( tr("Skew") ); + labelRotation->setText( tr("Rotation") ); + labelFlip->setText( tr("Flip") ); + labelX->setText( tr("X:") ); + labelY->setText( tr("Y:") ); + +} + +void ColorPickerPattern::iconSetChange() +{ + IconManager &iconManager = IconManager::instance(); + + buttonFlipHorizontal->setIcon( iconManager.loadIcon("16/flip-object-horizontal.png")); + buttonFlipVertical->setIcon( iconManager.loadIcon("16/flip-object-vertical.png")); +} + +void ColorPickerPattern::unitChange() +{ + if (!m_doc) + return; + + currentUnit = m_doc->unitIndex(); + + numberOffsetX->setNewUnit(currentUnit); + numberOffsetY->setNewUnit(currentUnit); +} + +void ColorPickerPattern::updatePattern() +{ + m_pattern.OffsetX = numberOffsetX->value() / unitGetRatioFromIndex(currentUnit); + m_pattern.OffsetY = numberOffsetY->value() / unitGetRatioFromIndex(currentUnit); + m_pattern.ScaleX = numberScaleX->value() / 100.0; + m_pattern.ScaleY = numberScaleY->value() / 100.0; + double a = M_PI / 180.0 * numberSkewX->value(); + double b = M_PI / 180.0 * numberSkewY->value(); + m_pattern.SkewX = tan(a); + m_pattern.SkewY = tan(b); + m_pattern.MirrorX = buttonFlipHorizontal->isChecked(); + m_pattern.MirrorY = buttonFlipVertical->isChecked(); + m_pattern.Spacing = numberSpacing->value() / 100.0; + m_pattern.Angle = numberAngle->value(); + m_pattern.OnPath = checkboxFollowsPath->isChecked(); + + numberSpacing->setEnabled(checkboxFollowsPath->isChecked()); + + emit patternChanged(); +} + +void ColorPickerPattern::updateScaleX() +{ + QSignalBlocker sigScaleY(numberScaleY); + + if (buttonScaleRatio->isChecked()) + numberScaleY->setValue(numberScaleX->value()); + + updatePattern(); +} + +void ColorPickerPattern::updateScaleY() +{ + QSignalBlocker sigScaleX(numberScaleX); + + if (buttonScaleRatio->isChecked()) + numberScaleX->setValue(numberScaleY->value()); + + updatePattern(); +} + +void ColorPickerPattern::updateName(QListWidgetItem *item) +{ + if (!item) + return; + m_pattern.Name = item->text(); + updatePattern(); +} + +void ColorPickerPattern::updateSize() +{ + int w = this->width(); + adjustSize(); + resize(w, sizeHint().height()); + emit sizeChanged(); +} + +void ColorPickerPattern::toggleScaleRatio() +{ + QSignalBlocker sigScaleY(numberScaleY); + + if (buttonScaleRatio->isChecked()) + { + numberScaleY->setValue(numberScaleX->value()); + updatePattern(); + buttonScaleRatio->setChecked(true); + } + else + buttonScaleRatio->setChecked(false); +} + + Index: scribus/ui/colorpicker/colorpicker_pattern.h =================================================================== --- scribus/ui/colorpicker/colorpicker_pattern.h (nicht existent) +++ scribus/ui/colorpicker/colorpicker_pattern.h (Arbeitskopie) @@ -0,0 +1,61 @@ +#ifndef COLORPICKER_PATTERN_H +#define COLORPICKER_PATTERN_H + +#include <QWidget> +#include "ui_colorpicker_pattern.h" +#include "scribusdoc.h" +#include "colorpicker_enum.h" + +class ColorPickerPattern : public QWidget, Ui::ColorPickerPattern +{ + Q_OBJECT + +public: + explicit ColorPickerPattern(QWidget *parent = nullptr); + ~ColorPickerPattern(){}; + + void setPatternList(QHash<QString, ScPattern> *docPatterns); + + CPPatternData patternData(); + + Context context(); + void setContext(Context config); + + void hideEditedPatterns(QStringList names); + + int type(); + + QString toolTipText() const; + +public slots: + void setDoc(ScribusDoc *doc); + void setPatternData(CPPatternData pattern); + void languageChange(); + void iconSetChange(); + void unitChange(); + +private slots: + void updatePattern(); + void updateScaleX(); + void updateScaleY(); + void updateName(QListWidgetItem *item); + void updateSize(); + void toggleScaleRatio(); + +private: + ScribusDoc *m_doc {nullptr}; + QBrush m_background; + Context m_context {Context::Simple}; + CPPatternData m_pattern; + int currentUnit {0}; + + void connectSlots(); + void disconnectSlots(); + +signals: + void patternChanged(); + void sizeChanged(); + +}; + +#endif // COLORPICKER_PATTERN_H Index: scribus/ui/colorpicker/colorpicker_pattern.ui =================================================================== --- scribus/ui/colorpicker/colorpicker_pattern.ui (nicht existent) +++ scribus/ui/colorpicker/colorpicker_pattern.ui (Arbeitskopie) @@ -0,0 +1,514 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>ColorPickerPattern</class> + <widget class="QWidget" name="ColorPickerPattern"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>271</width> + <height>496</height> + </rect> + </property> + <property name="windowTitle"> + <string>Form</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <property name="spacing"> + <number>0</number> + </property> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="SectionContainer" name="sectionProperties"> + <property name="title" stdset="0"> + <string>Properties</string> + </property> + <widget class="QWidget" name="widgetProperties"> + <layout class="QGridLayout" name="gridLayout_2"> + <property name="leftMargin"> + <number>8</number> + </property> + <property name="topMargin"> + <number>8</number> + </property> + <property name="rightMargin"> + <number>8</number> + </property> + <property name="bottomMargin"> + <number>8</number> + </property> + <property name="spacing"> + <number>4</number> + </property> + <item row="2" column="1" colspan="4"> + <layout class="QHBoxLayout" name="horizontalLayout_3"> + <property name="spacing"> + <number>16</number> + </property> + <item> + <widget class="FormWidget" name="labelRotation"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="label" stdset="0"> + <string>Rotation</string> + </property> + <property name="font"> + <font> + <pointsize>8</pointsize> + </font> + </property> + <layout class="QHBoxLayout" name="horizontalLayout"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="ScrSpinBox" name="numberAngle"/> + </item> + </layout> + </widget> + </item> + <item> + <widget class="FormWidget" name="labelSpacing"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="label" stdset="0"> + <string>Spacing</string> + </property> + <property name="font"> + <font> + <pointsize>8</pointsize> + </font> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_7"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="ScrSpinBox" name="numberSpacing"/> + </item> + </layout> + </widget> + </item> + <item> + <widget class="FormWidget" name="labelFlip"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="label" stdset="0"> + <string>Flip</string> + </property> + <property name="font"> + <font> + <pointsize>8</pointsize> + </font> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_2"> + <property name="spacing"> + <number>4</number> + </property> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="QToolButton" name="buttonFlipHorizontal"> + <property name="text"> + <string/> + </property> + <property name="checkable"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QToolButton" name="buttonFlipVertical"> + <property name="text"> + <string/> + </property> + <property name="checkable"> + <bool>true</bool> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + <item row="1" column="1"> + <widget class="FormWidget" name="labelOffset"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="label" stdset="0"> + <string>Offset</string> + </property> + <property name="font"> + <font> + <pointsize>8</pointsize> + </font> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_4"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="ScrSpinBox" name="numberOffsetY"/> + </item> + </layout> + </widget> + </item> + <item row="0" column="0"> + <widget class="QLabel" name="labelX"> + <property name="text"> + <string>X:</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="ScrSpinBox" name="numberOffsetX"/> + </item> + <item row="0" column="5"> + <spacer name="horizontalSpacer_2"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + </spacer> + </item> + <item row="1" column="0"> + <widget class="FormWidget" name="formWidget_8"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="label" stdset="0"> + <string/> + </property> + <property name="font"> + <font> + <pointsize>8</pointsize> + </font> + </property> + <property name="preserveLabelSpace"> + <bool>true</bool> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_8"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="QLabel" name="labelY"> + <property name="text"> + <string>Y:</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item row="1" column="4"> + <widget class="FormWidget" name="labelSkew"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="label" stdset="0"> + <string>Skew</string> + </property> + <property name="font"> + <font> + <pointsize>8</pointsize> + </font> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_6"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="ScrSpinBox" name="numberSkewY"/> + </item> + </layout> + </widget> + </item> + <item row="1" column="2"> + <widget class="FormWidget" name="labelScale"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="label" stdset="0"> + <string>Scale</string> + </property> + <property name="font"> + <font> + <pointsize>8</pointsize> + </font> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_5"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="ScrSpinBox" name="numberScaleY"/> + </item> + </layout> + </widget> + </item> + <item row="0" column="2"> + <widget class="ScrSpinBox" name="numberScaleX"/> + </item> + <item row="0" column="4"> + <widget class="ScrSpinBox" name="numberSkewX"/> + </item> + <item row="0" column="3" rowspan="2"> + <widget class="FormWidget" name="formWidget"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="label" stdset="0"> + <string/> + </property> + <property name="font"> + <font> + <pointsize>8</pointsize> + </font> + </property> + <property name="preserveLabelSpace"> + <bool>true</bool> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_9"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="LinkButton" name="buttonScaleRatio"> + <property name="text"> + <string/> + </property> + </widget> + </item> + </layout> + </widget> + </item> + </layout> + </widget> + </widget> + </item> + <item> + <widget class="SectionContainer" name="sectionSwatches"> + <property name="title" stdset="0"> + <string>Patterns</string> + </property> + <widget class="QListWidget" name="listPattern"/> + </widget> + </item> + <item> + <layout class="QVBoxLayout" name="verticalLayout_2"> + <property name="spacing"> + <number>4</number> + </property> + <property name="leftMargin"> + <number>8</number> + </property> + <property name="topMargin"> + <number>4</number> + </property> + <property name="rightMargin"> + <number>8</number> + </property> + <property name="bottomMargin"> + <number>8</number> + </property> + <item> + <widget class="QCheckBox" name="checkboxLumAlpha"> + <property name="text"> + <string>Use Luminosity as Alpha</string> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="checkboxInvertedPattern"> + <property name="text"> + <string>User inverted Pattern</string> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="checkboxFollowsPath"> + <property name="text"> + <string>Pattern follows Path</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + <customwidgets> + <customwidget> + <class>FormWidget</class> + <extends>QWidget</extends> + <header>ui/widgets/form_widget.h</header> + <container>1</container> + </customwidget> + <customwidget> + <class>SectionContainer</class> + <extends>QWidget</extends> + <header>ui/widgets/section_container.h</header> + <addpagemethod>setWidget</addpagemethod> + <container>1</container> + </customwidget> + <customwidget> + <class>ScrSpinBox</class> + <extends>QDoubleSpinBox</extends> + <header location="global">ui/scrspinbox.h</header> + </customwidget> + <customwidget> + <class>LinkButton</class> + <extends>QToolButton</extends> + <header>ui/linkbutton.h</header> + </customwidget> + </customwidgets> + <tabstops> + <tabstop>numberOffsetX</tabstop> + <tabstop>numberOffsetY</tabstop> + <tabstop>numberScaleX</tabstop> + <tabstop>numberScaleY</tabstop> + <tabstop>buttonScaleRatio</tabstop> + <tabstop>numberSkewX</tabstop> + <tabstop>numberSkewY</tabstop> + <tabstop>numberAngle</tabstop> + <tabstop>numberSpacing</tabstop> + <tabstop>buttonFlipHorizontal</tabstop> + <tabstop>buttonFlipVertical</tabstop> + <tabstop>checkboxLumAlpha</tabstop> + <tabstop>checkboxInvertedPattern</tabstop> + <tabstop>checkboxFollowsPath</tabstop> + </tabstops> + <resources/> + <connections/> +</ui> Index: scribus/ui/dasheditor.cpp =================================================================== --- scribus/ui/dasheditor.cpp (Revision 26070) +++ scribus/ui/dasheditor.cpp (Arbeitskopie) @@ -175,7 +175,7 @@ cHandle = palette().color(QPalette::WindowText); } - renderPointerHandle(&pw, QPointF(xPos, yPos), RADIUS * 2 - 2, cHandle ); + drawPointerHandle(&pw, QPointF(xPos, yPos), RADIUS * 2 - 2, cHandle ); } Index: scribus/ui/delegates/sclistitemdelegate.cpp =================================================================== --- scribus/ui/delegates/sclistitemdelegate.cpp (Revision 26070) +++ scribus/ui/delegates/sclistitemdelegate.cpp (Arbeitskopie) @@ -6,20 +6,41 @@ #include <QFlags> -ScListItemDelegate::ScListItemDelegate(QSize iconSize, TextPosition textPosition, QObject *parent) : QAbstractItemDelegate (parent) +ScListItemDelegate::ScListItemDelegate(QListView::ViewMode mode, QSize iconSize, TextPosition textPosition, Style style, QObject *parent) : QItemDelegate (parent) { setIconSize(iconSize); setTextPosition(textPosition); + setStyle(style); + setViewMode(mode); } void ScListItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const{ int padding = 8; - qreal margin = 4.5; + qreal margin = 2.5; int radius = 2; - QColor cHighlight = QApplication::palette().highlight().color(); + QPalette::ColorGroup cg = option.state & QStyle::State_Enabled ? QPalette::Normal : QPalette::Disabled; + QColor cBaseFill = option.palette.brush(cg, QPalette::AlternateBase).color(); + QColor cLinePen = option.palette.brush(cg, QPalette::Mid).color(); + QColor cText = option.palette.brush(cg, QPalette::Text).color(); + QColor cHighlight = option.palette.brush(cg, QPalette::Highlight).color(); + + QPen linePen(cLinePen, 1, Qt::SolidLine); + QPen lineMarkedPen(cHighlight, 1, Qt::SolidLine); + QPen fontPen(cText, 1, Qt::SolidLine); + + QBrush fillNormal(cBaseFill); cHighlight.setAlphaF(0.2); + QBrush fillSelected(cHighlight); + if(m_style == Style::Simple) + { + radius = 0; + margin = 0; + linePen = Qt::NoPen; + lineMarkedPen = Qt::NoPen; + } + QTextOption tOptions; QRect rIcon = option.rect; @@ -27,13 +48,7 @@ QRectF rItem = option.rect; rItem = rItem.adjusted(margin, margin, -margin, -margin); - QPen linePen(QApplication::palette().mid().color(), 1, Qt::SolidLine); - QPen lineMarkedPen(QApplication::palette().highlight().color(), 1, Qt::SolidLine); - QPen fontPen(QApplication::palette().text().color(), 1, Qt::SolidLine); - - QBrush fillNormal(QApplication::palette().alternateBase().color()); - QBrush fillSelected(cHighlight); - + painter->save(); painter->setRenderHint(QPainter::Antialiasing, true); if (option.state & QStyle::State_Selected) @@ -92,10 +107,29 @@ painter->setFont(QFont()); painter->drawText(rText, tOptions.flags(), title, &rText); } + + painter->restore(); } QSize ScListItemDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const{ - return option.rect.size(); + + QSize sh = option.rect.size(); + + switch(m_mode){ + default: + case QListView::ViewMode::IconMode: + { + } + break; + case QListView::ViewMode::ListMode: + { + sh.setWidth(0); + sh.setHeight(m_iconSize.height() + 16); + } + break; + } + + return sh;//QSize(sh.width(), sh.height()); } QSize ScListItemDelegate::iconSize() @@ -117,3 +151,23 @@ { m_textPosition = position; } + +ScListItemDelegate::Style ScListItemDelegate::style() +{ + return m_style; +} + +void ScListItemDelegate::setStyle(Style style) +{ + m_style = style; +} + +QListView::ViewMode ScListItemDelegate::viewMode() +{ + return m_mode; +} + +void ScListItemDelegate::setViewMode(QListView::ViewMode mode) +{ + m_mode = mode; +} Index: scribus/ui/delegates/sclistitemdelegate.h =================================================================== --- scribus/ui/delegates/sclistitemdelegate.h (Revision 26070) +++ scribus/ui/delegates/sclistitemdelegate.h (Arbeitskopie) @@ -1,10 +1,11 @@ #ifndef SCLISTITEMDELEGATE_H #define SCLISTITEMDELEGATE_H -#include <QAbstractItemDelegate> +#include <QItemDelegate> +#include <QListWidget> #include "scribusapi.h" -class SCRIBUS_API ScListItemDelegate : public QAbstractItemDelegate +class SCRIBUS_API ScListItemDelegate : public QItemDelegate { public: @@ -13,7 +14,12 @@ Right = 1 }; - ScListItemDelegate(QSize tileSize, TextPosition textPosition = TextPosition::Bottom, QObject *parent = nullptr); + enum Style { + Simple = 0, + Card = 1 + }; + + ScListItemDelegate(QListView::ViewMode mode, QSize tileSize, TextPosition textPosition = TextPosition::Bottom, Style style = Style::Card, QObject *parent = nullptr); virtual ~ScListItemDelegate(){}; void paint( QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index ) const; @@ -23,10 +29,16 @@ void setIconSize(QSize size); TextPosition textPosition(); void setTextPosition(TextPosition position); + Style style(); + void setStyle(Style style); + QListView::ViewMode viewMode(); + void setViewMode(QListView::ViewMode mode); private: - QSize m_iconSize = {QSize(64, 64)}; - TextPosition m_textPosition = {TextPosition::Bottom}; + QSize m_iconSize = { QSize(64, 64) }; + TextPosition m_textPosition = { TextPosition::Bottom }; + Style m_style = { Style::Card }; + QListView::ViewMode m_mode = { QListWidget::IconMode }; }; #endif // SCLISTITEMDELEGATE_H Index: scribus/ui/gradienteditor.cpp =================================================================== --- scribus/ui/gradienteditor.cpp (Revision 26070) +++ scribus/ui/gradienteditor.cpp (Arbeitskopie) @@ -5,11 +5,11 @@ for which a new license (GPL+exception) is in place. */ /*************************************************************************** - gradienteditor - description - ------------------- - begin : Mit Mai 26 2004 - copyright : (C) 2004 by Franz Schmid - email : Franz.Schmid@altmuehlnet.de + gradienteditor - description + ------------------- + begin : Mit Mai 26 2004 + copyright : (C) 2004 by Franz Schmid + email : Franz.Schmid@altmuehlnet.de ***************************************************************************/ /*************************************************************************** @@ -25,7 +25,7 @@ #include <QEvent> #include <QToolTip> -#include "util.h" +#include "util_gui.h" // Note : use temporarily editingFinished() signal to track value changes in stopPos, stopOpacity and // stopShade spinboxes. valueChanged() cause focus problems in these widgets due to signals emitted @@ -34,18 +34,24 @@ GradientEditor::GradientEditor(QWidget *pa) : QFrame(pa) { setupUi(this); - stopColor->setPixmapType(ColorCombo::fancyPixmaps); + stopPos->setDecimals(0); stopOpacity->setDecimals(0); stopShade->setDecimals(0); + + colorListBox = new ColorListBox(ColorListBox::fancyPixmap); + buttonColor->setContextWidget(colorListBox); + setExtendVisible(false); + initExtend(); + connect(stopPos , SIGNAL(valueChanged(double)), this, SLOT(changePos(double))); - connect(stopColor , SIGNAL(textActivated(QString)), this, SLOT(setStopColor(QString))); - connect(stopOpacity, SIGNAL(valueChanged(double)), this, SLOT(setStopTrans(double))); - connect(stopShade , SIGNAL(valueChanged(double)), this, SLOT(setStopShade(double))); + connect(stopOpacity, SIGNAL(valueChanged(double)), this, SLOT(setStopColor())); + connect(stopShade , SIGNAL(valueChanged(double)), this, SLOT(setStopColor())); connect(Preview, SIGNAL(selectedStop(VColorStop*)), this, SLOT(slotDisplayStop(VColorStop*))); - connect(Preview, SIGNAL(currStep(double)), this, SLOT(setPos(double))); - connect(Preview, SIGNAL(currStep(double)), this, SIGNAL(gradientChanged())); - connect(Preview, SIGNAL(gradientChanged()), this, SIGNAL(gradientChanged())); + connect(Preview, SIGNAL(selectedPosition(double)), this, SLOT(setPos(double))); + connect(colorListBox, SIGNAL(itemSelectionChanged()), this, SLOT(setStopColor())); + connect(this, SIGNAL(gradientChanged()), this, SLOT(updateColorButton())); + connect(comboExtend, &QComboBox::currentIndexChanged, this, &GradientEditor::repeatMethodChanged); } void GradientEditor::setGradient(const VGradient& grad) @@ -62,21 +68,19 @@ void GradientEditor::setColors(ColorList &colorList) { m_colorList = colorList; - stopColor->setColors(colorList, true); + colorListBox->setColors(colorList, true); } void GradientEditor::setPos(double p) { - stopPos->blockSignals(true); + QSignalBlocker sig1(stopPos); stopPos->setValue(qRound(p * 100)); - stopPos->blockSignals(false); } void GradientEditor::setGradTrans(double val) { - stopOpacity->blockSignals(true); + QSignalBlocker sig1(stopOpacity); stopOpacity->setValue(qRound(val * 100)); - stopOpacity->blockSignals(false); } void GradientEditor::slotDisplayStop(VColorStop* stop) @@ -84,12 +88,15 @@ setPos(stop->rampPoint); slotColor(stop->name, stop->shade); setGradTrans(stop->opacity); + updateColorButton(); + emit gradientChanged(); } void GradientEditor::slotColor(const QString& name, int shade) { - stopColor->blockSignals(true); - stopShade->blockSignals(true); + QSignalBlocker sig1(colorListBox); + QSignalBlocker sig2(stopShade); + stopShade->setValue(shade); QString nam = name; if (name == CommonStrings::None) @@ -100,12 +107,10 @@ } else { - stopShade->setEnabled(true); - stopOpacity->setEnabled(true); + stopShade->setEnabled(Preview->isEditable()); + stopOpacity->setEnabled(Preview->isEditable()); } - setCurrentComboItem(stopColor, nam); - stopColor->blockSignals(false); - stopShade->blockSignals(false); + colorListBox->setCurrentColor(nam); } void GradientEditor::setGradientEditable(bool val) @@ -112,14 +117,36 @@ { stopShade->setEnabled(val); stopOpacity->setEnabled(val); - stopColor->setEnabled(val); + buttonColor->setEnabled(val); stopPos->setEnabled(val); - Preview->setGradientEditable(val); + Preview->setIsEditable(val); } +VGradient::VGradientRepeatMethod GradientEditor::repeatMethod() +{ + return qvariant_cast<VGradient::VGradientRepeatMethod>(comboExtend->currentData()); +} + +void GradientEditor::setRepeatMethod(VGradient::VGradientRepeatMethod method) +{ + QSignalBlocker sigExtend(comboExtend); + + int index = comboExtend->findData(method); + if ( index != -1 ) + comboExtend->setCurrentIndex(index); + else + comboExtend->setCurrentIndex(0); + +} + +void GradientEditor::setExtendVisible(bool visible) +{ + extendLabel->setVisible(visible); +} + void GradientEditor::changePos(double v) { - Preview->setActStep(v / 100.0); + Preview->setActiveStopPosition(v / 100.0); emit gradientChanged(); } @@ -129,37 +156,25 @@ return ScColorEngine::getShadeColorProof(color, m_colorList.document(), shad); } -void GradientEditor::setStopColor(const QString &Color) +void GradientEditor::setStopColor() { + QString Color = colorListBox->currentColor(); + if (Color == CommonStrings::tr_NoneColor) { - Preview->setActColor(QColor(0, 0, 0, 0), CommonStrings::None, 100); - Preview->setActTrans(0.0); + Preview->setActiveStopColor(QColor(0, 0, 0, 0), CommonStrings::None, 100, 0.0); stopShade->setEnabled(false); stopOpacity->setEnabled(false); } else { - Preview->setActColor(setColor(Color, stopShade->value()), Color, stopShade->value()); - Preview->setActTrans(stopOpacity->value() / 100.0); - stopShade->setEnabled(true); - stopOpacity->setEnabled(true); + Preview->setActiveStopColor(setColor(Color, stopShade->value()), Color, stopShade->value(), stopOpacity->value() / 100.0); + stopShade->setEnabled(Preview->isEditable()); + stopOpacity->setEnabled(Preview->isEditable()); } emit gradientChanged(); } -void GradientEditor::setStopTrans(double val) -{ - Preview->setActTrans(val / 100.0); - emit gradientChanged(); -} - -void GradientEditor::setStopShade(double val) -{ - Preview->setActColor(setColor(stopColor->currentText(), val), stopColor->currentText(), val); - emit gradientChanged(); -} - void GradientEditor::changeEvent(QEvent *e) { if (e->type() == QEvent::LanguageChange) @@ -172,12 +187,43 @@ void GradientEditor::languageChange() { + initExtend(); retranslateUi(this); } +void GradientEditor::updateColorButton() +{ + QString colorName = colorListBox->currentColor(); + QBrush brush; + + if (colorName == CommonStrings::tr_NoneColor || colorName == CommonStrings::None) + brush = renderEmptyPattern(buttonColor->backgroundDotSize()); + else + { + const ScColor& color = m_colorList[colorName]; + + QColor qColorShade = ScColorEngine::getDisplayColor(color, m_colorList.document(), stopShade->value()); + QColor qColor = ScColorEngine::getDisplayColor(color, m_colorList.document(), 100.0); + + brush = QBrush(renderColor(buttonColor->backgroundDotSize(), qColor, qColorShade, stopOpacity->value() / 100.0)); + } + + buttonColor->setBackground(brush); +} + +void GradientEditor::initExtend() +{ + int oldGradientExtendIndex = comboExtend->currentIndex(); + QSignalBlocker sigExtend(comboExtend); + comboExtend->clear(); + comboExtend->addItem( tr("None"), VGradient::none ); + comboExtend->addItem( tr("Pad"), VGradient::pad ); + comboExtend->setCurrentIndex(oldGradientExtendIndex); +} + bool GradientEditor::event(QEvent * event) { - if (event->type() == QEvent::ToolTip) + if (event->type() == QEvent::ToolTip) { QHelpEvent *helpEvent = static_cast<QHelpEvent *>(event); QToolTip::showText(helpEvent->globalPos(), tr( "Add, change or remove color stops here" ), Preview, QRect(10,43, Preview->width()-20, 13)); Index: scribus/ui/gradienteditor.h =================================================================== --- scribus/ui/gradienteditor.h (Revision 26070) +++ scribus/ui/gradienteditor.h (Arbeitskopie) @@ -37,6 +37,7 @@ #include "gradientpreview.h" #include "ui_gradienteditor.h" #include "sccolorengine.h" +#include "colorlistbox.h" class SCRIBUS_API GradientEditor : public QFrame, Ui::GradientEditorBase { @@ -52,6 +53,11 @@ QColor setColor(const QString& colorName, int shad); void setGradientEditable(bool val); + VGradient::VGradientRepeatMethod repeatMethod(); + void setRepeatMethod(VGradient::VGradientRepeatMethod method); + + void setExtendVisible(bool visible); + public slots: void setPos(double); void changePos(double); @@ -58,17 +64,24 @@ void slotColor(const QString& name, int shade); void slotDisplayStop(VColorStop* stop); void setGradTrans(double val); - void setStopColor(const QString &); - void setStopTrans(double val); - void setStopShade(double val); + void setStopColor(); +// void setStopTrans(double val); +// void setStopShade(double val); void languageChange(); +private slots: + void updateColorButton(); + signals: void gradientChanged(); + void repeatMethodChanged(); protected: ColorList m_colorList; + ColorListBox *colorListBox; + void initExtend(); + void changeEvent(QEvent *e) override; bool event(QEvent * event ) override; }; Index: scribus/ui/gradienteditor.ui =================================================================== --- scribus/ui/gradienteditor.ui (Revision 26070) +++ scribus/ui/gradienteditor.ui (Arbeitskopie) @@ -6,8 +6,8 @@ <rect> <x>0</x> <y>0</y> - <width>210</width> - <height>178</height> + <width>369</width> + <height>128</height> </rect> </property> <property name="frameShape"> @@ -16,139 +16,285 @@ <property name="frameShadow"> <enum>QFrame::Plain</enum> </property> - <layout class="QGridLayout" name="gridLayout"> + <layout class="QVBoxLayout" name="verticalLayout"> + <property name="spacing"> + <number>4</number> + </property> <property name="leftMargin"> - <number>0</number> + <number>8</number> </property> <property name="topMargin"> - <number>0</number> + <number>8</number> </property> <property name="rightMargin"> - <number>0</number> + <number>8</number> </property> <property name="bottomMargin"> - <number>0</number> + <number>4</number> </property> - <property name="spacing"> - <number>3</number> - </property> - <item row="0" column="0" colspan="2"> - <widget class="GradientPreview" name="Preview"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>200</width> - <height>70</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>3000</width> - <height>70</height> - </size> - </property> - <property name="frameShape"> - <enum>QFrame::Panel</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Sunken</enum> - </property> - <property name="lineWidth"> - <number>2</number> - </property> - </widget> + <item> + <widget class="GradientPreview" name="Preview" native="true"/> </item> - <item row="1" column="0"> - <widget class="QLabel" name="stopPosLabel"> - <property name="text"> - <string>Position:</string> + <item> + <layout class="QGridLayout" name="gridLayout_2"> + <property name="leftMargin"> + <number>0</number> </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="ScrSpinBox" name="stopPos"> - <property name="suffix"> - <string> %</string> + <property name="rightMargin"> + <number>0</number> </property> - <property name="maximum"> - <number>100</number> + <property name="spacing"> + <number>4</number> </property> - </widget> + <item row="0" column="3"> + <widget class="FormWidget" name="stopOpacityLabel"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="label" stdset="0"> + <string>Opacity</string> + </property> + <property name="font"> + <font> + <pointsize>8</pointsize> + </font> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_4"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="ScrSpinBox" name="stopOpacity"> + <property name="suffix"> + <string> %</string> + </property> + <property name="decimals"> + <number>0</number> + </property> + <property name="maximum"> + <double>100.000000000000000</double> + </property> + <property name="singleStep"> + <double>10.000000000000000</double> + </property> + <property name="value"> + <double>100.000000000000000</double> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item row="0" column="0"> + <widget class="FormWidget" name="stopPosLabel"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="label" stdset="0"> + <string>Position</string> + </property> + <property name="font"> + <font> + <pointsize>8</pointsize> + </font> + </property> + <layout class="QHBoxLayout" name="horizontalLayout"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="ScrSpinBox" name="stopPos"> + <property name="suffix"> + <string> %</string> + </property> + <property name="decimals"> + <number>0</number> + </property> + <property name="maximum"> + <double>100.000000000000000</double> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item row="0" column="5"> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + </spacer> + </item> + <item row="0" column="1"> + <widget class="FormWidget" name="stopColorLabel"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="label" stdset="0"> + <string>Color</string> + </property> + <property name="font"> + <font> + <pointsize>8</pointsize> + </font> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_2"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="ColorButton" name="buttonColor"> + <property name="text"> + <string/> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item row="0" column="2"> + <widget class="FormWidget" name="stopShadeLabel"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="label" stdset="0"> + <string>Shade</string> + </property> + <property name="font"> + <font> + <pointsize>8</pointsize> + </font> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_3"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="ScrSpinBox" name="stopShade"> + <property name="suffix"> + <string> %</string> + </property> + <property name="decimals"> + <number>0</number> + </property> + <property name="maximum"> + <double>100.000000000000000</double> + </property> + <property name="singleStep"> + <double>10.000000000000000</double> + </property> + <property name="value"> + <double>100.000000000000000</double> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item row="0" column="4"> + <widget class="FormWidget" name="extendLabel"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="label" stdset="0"> + <string>Extend</string> + </property> + <property name="font"> + <font> + <pointsize>8</pointsize> + </font> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_5"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="QComboBox" name="comboExtend"/> + </item> + </layout> + </widget> + </item> + </layout> </item> - <item row="2" column="0"> - <widget class="QLabel" name="stopColorLabel"> - <property name="text"> - <string>Color:</string> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="ColorCombo" name="stopColor"/> - </item> - <item row="3" column="0"> - <widget class="QLabel" name="stopOpacityLabel"> - <property name="text"> - <string>Opacity:</string> - </property> - </widget> - </item> - <item row="3" column="1"> - <widget class="ScrSpinBox" name="stopOpacity"> - <property name="suffix"> - <string> %</string> - </property> - <property name="maximum"> - <number>100</number> - </property> - <property name="singleStep"> - <number>10</number> - </property> - <property name="value"> - <number>100</number> - </property> - </widget> - </item> - <item row="4" column="0"> - <widget class="QLabel" name="stopShadeLabel"> - <property name="text"> - <string>Shade:</string> - </property> - </widget> - </item> - <item row="4" column="1"> - <widget class="ScrSpinBox" name="stopShade"> - <property name="suffix"> - <string> %</string> - </property> - <property name="maximum"> - <number>100</number> - </property> - <property name="singleStep"> - <number>10</number> - </property> - <property name="value"> - <number>100</number> - </property> - </widget> - </item> </layout> </widget> <customwidgets> <customwidget> - <class>ColorCombo</class> - <extends>QComboBox</extends> - <header>ui/colorcombo.h</header> + <class>FormWidget</class> + <extends>QWidget</extends> + <header>ui/widgets/form_widget.h</header> + <container>1</container> </customwidget> <customwidget> - <class>GradientPreview</class> - <extends>QFrame</extends> - <header>ui/gradientpreview.h</header> - <container>1</container> + <class>ColorButton</class> + <extends>QToolButton</extends> + <header>ui/widgets/color_button.h</header> </customwidget> <customwidget> <class>ScrSpinBox</class> @@ -155,7 +301,20 @@ <extends>QDoubleSpinBox</extends> <header location="global">ui/scrspinbox.h</header> </customwidget> + <customwidget> + <class>GradientPreview</class> + <extends>QWidget</extends> + <header>ui/gradientpreview.h</header> + <container>1</container> + </customwidget> </customwidgets> + <tabstops> + <tabstop>stopPos</tabstop> + <tabstop>buttonColor</tabstop> + <tabstop>stopShade</tabstop> + <tabstop>stopOpacity</tabstop> + <tabstop>comboExtend</tabstop> + </tabstops> <resources/> <connections/> </ui> Index: scribus/ui/gradientpreview.cpp =================================================================== --- scribus/ui/gradientpreview.cpp (Revision 26070) +++ scribus/ui/gradientpreview.cpp (Arbeitskopie) @@ -21,8 +21,551 @@ * * ***************************************************************************/ -#include <algorithm> +#include "gradientpreview.h" +#include <QPainter> +#include <QPaintEvent> #include <QApplication> +#include "util_gui.h" +#include "iconmanager.h" + +const int RADIUS = 6; +const int GRADIENT_HEIGHT = 20; + +/* ********************************************************************************* * + * + * Constructor + Setup + * + * ********************************************************************************* */ + +GradientPreview::GradientPreview(QWidget *parent) + : QWidget{parent} +{ + + int h = scaleRect().height() + canvasRect().height() + RADIUS * 3; + + setMinimumSize(QSize(200, h)); + setMouseTracking(true); + setFocusPolicy(Qt::ClickFocus); + + setup(); + +} + +void GradientPreview::setup() +{ + m_activeStop = 0; + m_tmpStop = 0; + m_isEditable = true; + m_mousePos = QPointF(); + + QColor color; + fill_gradient.clearStops(); + + color = QColor(255,255,255); + fill_gradient.addStop( color, 0.0, 0.5, 1.0 ); + + color = QColor(0,0,0); + fill_gradient.addStop( color, 1.0, 0.5, 1.0 ); + +} + + +/* ********************************************************************************* * + * + * Private Methods + * + * ********************************************************************************* */ + +int GradientPreview::stopAtPosition(QPoint position) +{ + QList<VColorStop*> cstops = fill_gradient.colorStops(); + for (int i = 0; i < cstops.count(); ++i) + { + int stopPos = percentToPosition(cstops.at(i)->rampPoint); + if (stopRect(stopPos).contains(position) ) + return i; + } + + return -1; +} + +double GradientPreview::percentFromPosition(QPointF position) +{ + double t = static_cast<double>((position.x() - RADIUS)) / static_cast<double>(saveAreaRect().width()); + return qBound(0., t, 1.); +} + +int GradientPreview::percentToPosition(double t) +{ + return qRound(t * saveAreaRect().width() + RADIUS ); +} + + +int GradientPreview::mapPositionToGrid(qreal pos) +{ + return static_cast<int>(pos * 100 * ratio() + .5); +} + + +void GradientPreview::addStop(QPoint mousePosition) +{ + QColor colorL = activeStop()->color; + QString nameL = activeStop()->name; + double opacityL = activeStop()->opacity; + double shadeL = activeStop()->shade; + + QColor colorR = activeStop()->color; + QString nameR = activeStop()->name; + double opacityR = activeStop()->opacity; + double shadeR = activeStop()->shade; + + double t = percentFromPosition(mousePosition); + double mid = 0.5; + + // Add tmp stop + fill_gradient.addStop(colorL, t, mid, opacityL, nameL, shadeL); + sortStops(); + + // Update values + m_activeStop = stopAtPosition(mousePosition); + m_tmpStop = m_activeStop; + + + // The following code calculate the blend color between two neighbor stops of the new one. + // Currently commented out because Scribus don't support calculated colors without ID (color name) yet. +/* + VColorStop *stopL; + VColorStop *stopR; + + // Get left stop + if (m_activeStop - 1 >= 0) + stopL = activeStop(-1); + else + stopL = activeStop(1); + + colorL = stopL->color; + shadeL = stopL->shade; + opacityL = stopL->opacity; + nameL = stopL->name; + + // Get right stop + if (m_activeStop + 1 < fill_gradient.colorStops().count()) + stopR = activeStop(1); + else + stopR = activeStop(-1); + + colorR = stopR->color; + shadeR = stopR->shade; + opacityR = stopR->opacity; + nameR = stopR->name; + + + VColorStop stop = computeInBetweenStop(stopL, stopR, t); + fill_gradient.setStop(stop.color, t, mid, stop.opacity, stop.name, stop.shade); +*/ + + // add color from active stop + fill_gradient.setStop(colorL, t, mid, opacityL, nameL, shadeL); + + // Update UI + repaint(); + + if(m_activeStop > -1) + { + emitStop(); + } + + +} + +void GradientPreview::removeStop() +{ + QList<VColorStop*> cstops = fill_gradient.colorStops(); + + // Remove stop if it is not first or last one + if ( m_activeStop != -1 && cstops.count() > 2) + { + fill_gradient.removeStop(m_activeStop); + m_activeStop = qMax(m_activeStop - 1, 0); + m_tmpStop = m_activeStop; + + repaint(); + emitStop(); + } +} + +void GradientPreview::emitStopPosition() +{ + if (!fill_gradient.colorStops().isEmpty()) + emit selectedPosition(activeStop()->rampPoint); +} + +void GradientPreview::emitStop() +{ + if (!fill_gradient.colorStops().isEmpty()) + emit selectedStop(activeStop()); +} + +void GradientPreview::updateTmpStop(double t) +{ + // update stop position + if(m_activeStop != -1) + { + QList<VColorStop*> cstops = fill_gradient.colorStops(); + cstops.at(m_activeStop)->rampPoint = t; + + std::stable_sort(cstops.begin(), cstops.end(), compareStops); + for(int i = 0; i < cstops.count(); i++) + { + VColorStop *stop = cstops.at(i); + if(stop->rampPoint == t) + m_tmpStop = i; + } + + repaint(); + + } +} + +void GradientPreview::sortStops() +{ + QList<VColorStop*> cstops = fill_gradient.colorStops(); + std::stable_sort(cstops.begin(), cstops.end(), compareStops); + + VGradient grad(fill_gradient); + grad.clearStops(); + + foreach(VColorStop *stop, cstops) + grad.addStop(*stop); + + fill_gradient = grad; + +} + +/* ********************************************************************************* * + * + * Events + * + * ********************************************************************************* */ + +void GradientPreview::paintEvent(QPaintEvent *e) +{ + + QList<VColorStop*> cstops = fill_gradient.colorStops(); + std::stable_sort(cstops.begin(), cstops.end(), compareStops); + + QImage pixm(canvasRect().width(), canvasRect().height(), QImage::Format_ARGB32_Premultiplied); + + // Draw Background + QPainter pb(&pixm); + renderCheckerPattern(&pb, pixm.rect()); + pb.end(); + + // Draw Gradient + ScPainter *p = new ScPainter(&pixm, pixm.width(), pixm.height()); + p->setPen(Qt::black, 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin); + p->setFillMode(ScPainter::Gradient); + p->fill_gradient = fill_gradient; + p->setGradient(VGradient::linear, FPoint(0, 0), FPoint(pixm.width(), 0), FPoint(0, 0), 1.0, 0.0); + p->drawRect(0, 0, pixm.width(), pixm.height()); + p->end(); + delete p; + + // Draw UI + QPainter pw(this); + pw.drawImage(canvasRect().left(), canvasRect().top(), pixm); + pw.setPen(palette().color(QPalette::Midlight)); + pw.setBrush(Qt::NoBrush); + pw.drawRect(QRectF(canvasRect()).adjusted(.5, .5, -.5, -.5)); + + if (isEditable()) + { + pw.setRenderHint(QPainter::Antialiasing, true); + + // Draw Stops + for (int i = 0; i < fill_gradient.stops(); ++i) + { + qreal sPos = cstops.at(i)->rampPoint; + qreal xPos = mapPositionToGrid(sPos) + saveAreaRect().left() + .5; + qreal yPos = handleRect(sPos).top() + 0.5; + + // Draw Marker + if (m_tmpStop == i) + { + QPainterPath marker; + marker.moveTo( QPointF(xPos - 5, canvasRect().top() - 5.5) ); + marker.lineTo( QPointF(xPos + 5, canvasRect().top() - 5.5) ); + marker.lineTo( QPointF(xPos, canvasRect().top()) ); + marker.closeSubpath(); + + pw.setPen(QPen(palette().color(QPalette::Window), 1)); + pw.setBrush(palette().color(QPalette::Highlight)); + pw.drawPath(marker); + } + + bool isEmpty = cstops.at(i)->name == CommonStrings::tr_NoneColor; + drawPointerHandle(&pw, QPointF(xPos, yPos), RADIUS * 2 - 2, cstops.at(i)->color, isEmpty); + + } + } + + pw.end(); + + QWidget::paintEvent(e); + +} + +void GradientPreview::keyPressEvent(QKeyEvent *e) +{ + if (isEditable()) + if(e->key() == Qt::Key_Delete || e->key() == Qt::Key_Backspace) + removeStop(); +} + +void GradientPreview::mousePressEvent(QMouseEvent *m) +{ + QApplication::setOverrideCursor(QCursor(Qt::ArrowCursor)); + + if (isEditable()){ + + if (m->button() == Qt::LeftButton) + { + m_activeStop = stopAtPosition(m->pos()); + m_tmpStop = m_activeStop; + + if (m_activeStop == -1) + addStop(m->pos()); + else + { + repaint(); + emitStop(); + } + + } + } + else + m_activeStop = m_tmpStop = -1; + +} + +void GradientPreview::mouseReleaseEvent(QMouseEvent *m) +{ + + QApplication::restoreOverrideCursor(); + + if (isEditable()) + { + if (m->button() == Qt::LeftButton) + { + if (isMouseOutside(m->pos())) + removeStop(); + else + { + sortStops(); + m_activeStop = m_tmpStop; + repaint(); + emitStop(); + } + + } + } +} + +void GradientPreview::mouseMoveEvent(QMouseEvent *m) +{ + QApplication::changeOverrideCursor(QCursor(Qt::ArrowCursor)); + + if (isEditable()) + { + + m_mousePos = m->position(); + + // Set Hover Cursor + if (saveAreaRect().contains(m_mousePos.toPoint()) ) + { + if (stopAtPosition(m_mousePos.toPoint()) > -1) + setCursor(QCursor(Qt::SizeHorCursor)); + else + setCursor(IconManager::instance().loadCursor("AddPoint.png", 1, 1)); + } + + // Press Left Mouse + if (m->buttons() & Qt::LeftButton) + { + double newPos = percentFromPosition(m_mousePos); + updateTmpStop(newPos); + emitStopPosition(); + + QList<VColorStop*> cstops = fill_gradient.colorStops(); + // Set "remove" cursor if gradient has more than 2 stops + if (isMouseOutside(m->pos()) && cstops.count() > 2) + QApplication::changeOverrideCursor(IconManager::instance().loadCursor("DelPoint.png", 1, 1)); + + } + } + + +} + + +/* ********************************************************************************* * + * + * Public Members + * + * ********************************************************************************* */ + +void GradientPreview::setActiveStopColor(const QColor &c, const QString &n, int s, double a) +{ + if (m_activeStop == -1) + return; + + activeStop()->color = c; + activeStop()->name = n; + activeStop()->opacity = a; + activeStop()->shade = s; + repaint(); +} + +QColor GradientPreview::activeStopColor() +{ + if (m_activeStop == -1) + return QColor(); + + return activeStop()->color; + +} + +void GradientPreview::setActiveStopPosition(double t) +{ + if (m_activeStop == -1) + return; + + updateTmpStop(t); + repaint(); +} + + +void GradientPreview::setIsEditable(bool isEditable) +{ + m_isEditable = isEditable; + repaint(); +} + +bool GradientPreview::isEditable() +{ + return m_isEditable; +} + +void GradientPreview::setGradient(const VGradient &gradient) +{ + if ((gradient.colorStops().count() == fill_gradient.colorStops().count()) && (m_activeStop >= 0)) + { + int diffStops = 0; + for (int i = 0; i < fill_gradient.colorStops().count(); ++i) + { + VColorStop* stop1 = gradient.colorStops().at(i); + VColorStop* stop2 = fill_gradient.colorStops().at(i); + if ((stop1->color != stop2->color) || (stop1->midPoint != stop2->midPoint) || + (stop1->name != stop2->name) || (stop1->opacity != stop2->opacity) || + (stop1->rampPoint != stop2->rampPoint) || (stop1->shade != stop2->shade)) + { + ++diffStops; + } + } + if (diffStops > 1) + m_activeStop = 0; + } + + if ((m_activeStop < 0) && (gradient.colorStops().count() > 0)) + m_activeStop = 0; + + if (m_activeStop >= gradient.colorStops().count()) + m_activeStop = 0; + + fill_gradient = gradient; + + repaint(); +} + +const VGradient &GradientPreview::gradient() +{ + + // QList<VColorStop*> cstops = fill_gradient.colorStops(); + // std::stable_sort(cstops.begin(), cstops.end(), compareStops); + + // VGradient &grad(fill_gradient); + // grad.clearStops(); + + // foreach(VColorStop *stop, cstops){ + // grad.addStop(*stop); + // } + + return fill_gradient; +} + +void GradientPreview::updateDisplay() +{ + repaint(); + + if (!fill_gradient.colorStops().isEmpty()) + emit selectedStop(activeStop()); +} + +/* ********************************************************************************* * + * + * Private Members + * + * ********************************************************************************* */ + +QRect GradientPreview::saveAreaRect() +{ + return QRect(RADIUS, 0, width() - RADIUS * 2 - 2, height() - 4); +} + +QRect GradientPreview::canvasRect() +{ + return QRect(RADIUS, scaleRect().bottom(), width() - RADIUS * 2 - 2, GRADIENT_HEIGHT); +} + +QRect GradientPreview::scaleRect() +{ + return QRect(RADIUS, 0, width() - RADIUS * 2 - 2, 6); +} + +QRect GradientPreview::handleRect(int center) +{ + return QRect(center - RADIUS, canvasRect().bottom(), RADIUS * 2, saveAreaRect().bottom()); +} + +QRect GradientPreview::stopRect(int center) +{ + return QRect(center - RADIUS, saveAreaRect().top(), RADIUS * 2, saveAreaRect().bottom()); +} + +qreal GradientPreview::ratio() +{ + return saveAreaRect().width() / 100.0; +} + +bool GradientPreview::isMouseOutside(QPoint mouse) +{ + return (mouse.y() <= rect().top() || mouse.y() >= rect().bottom()); +} + + +VColorStop *GradientPreview::activeStop(int offset) const +{ + if(m_activeStop + offset < 0) + return fill_gradient.colorStops().first(); + + if(m_activeStop + offset >= fill_gradient.colorStops().count()) + return fill_gradient.colorStops().last(); + + return fill_gradient.colorStops().at(m_activeStop + offset); +} + +/*#include <algorithm> +#include <QApplication> #include <QCursor> #include <QEvent> #include <QMenu> @@ -409,3 +952,4 @@ isEditable = val; repaint(); } +*/ Index: scribus/ui/gradientpreview.h =================================================================== --- scribus/ui/gradientpreview.h (Revision 26070) +++ scribus/ui/gradientpreview.h (Arbeitskopie) @@ -34,11 +34,13 @@ #include <QHBoxLayout> class QEvent; +class ScColor; #include "scribusapi.h" #include "vgradient.h" -class SCRIBUS_API GradientPreview : public QFrame + +/*class SCRIBUS_API GradientPreview : public QFrame { Q_OBJECT @@ -87,4 +89,64 @@ void currStep(double); void gradientChanged(); }; +*/ + +class SCRIBUS_API GradientPreview : public QWidget +{ + Q_OBJECT +public: + explicit GradientPreview(QWidget *parent = nullptr); + ~GradientPreview() {}; + void paintEvent(QPaintEvent *e); + void keyPressEvent(QKeyEvent *e); + void mousePressEvent(QMouseEvent *m); + void mouseReleaseEvent(QMouseEvent *m); + void mouseMoveEvent(QMouseEvent *m); + + void setActiveStopColor(const QColor& c, const QString& n, int s, double a); + QColor activeStopColor(); + + void setActiveStopPosition(double t); + + void setIsEditable(bool isEditable); + bool isEditable(); + + void setGradient(const VGradient& gradient); + const VGradient& gradient(); + + void updateDisplay(); + +private: + VGradient fill_gradient; + QPointF m_mousePos; + bool m_isEditable; + int m_activeStop; + int m_tmpStop; + + QRect saveAreaRect(); + QRect canvasRect(); + QRect scaleRect(); + QRect handleRect(int center); + QRect stopRect(int center); + qreal ratio(); + bool isMouseOutside(QPoint mouse); + int mapPositionToGrid(qreal pos); + int stopAtPosition(QPoint position); + VColorStop *activeStop(int offset = 0) const; + double percentFromPosition(QPointF position); + int percentToPosition(double t); + + void setup(); + void addStop(QPoint mousePosition); + void removeStop(); + void emitStopPosition(); + void emitStop(); + void updateTmpStop(double t); + void sortStops(); + +signals: + void selectedStop(VColorStop*); + void selectedPosition(double); + +}; #endif Index: scribus/ui/gradientvectorbase.ui =================================================================== --- scribus/ui/gradientvectorbase.ui (Revision 26070) +++ scribus/ui/gradientvectorbase.ui (nicht existent) @@ -1,1078 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>GradientVectorBase</class> - <widget class="ScrPaletteBase" name="GradientVectorBase"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>267</width> - <height>178</height> - </rect> - </property> - <property name="minimumSize"> - <size> - <width>0</width> - <height>0</height> - </size> - </property> - <property name="windowTitle"> - <string>Gradient Vector</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout"> - <property name="leftMargin"> - <number>9</number> - </property> - <property name="topMargin"> - <number>9</number> - </property> - <property name="rightMargin"> - <number>9</number> - </property> - <property name="bottomMargin"> - <number>9</number> - </property> - <item> - <widget class="QStackedWidget" name="stackedWidget"> - <property name="currentIndex"> - <number>0</number> - </property> - <widget class="QWidget" name="pageLinear"> - <layout class="QGridLayout" name="gridLayout_3"> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>0</number> - </property> - <property name="bottomMargin"> - <number>0</number> - </property> - <item row="0" column="3"> - <widget class="ScrSpinBox" name="gY1"> - <property name="minimum"> - <double>-3000.000000000000000</double> - </property> - <property name="maximum"> - <double>3000.000000000000000</double> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="ScrSpinBox" name="gX1"> - <property name="minimum"> - <double>-3000.000000000000000</double> - </property> - <property name="maximum"> - <double>3000.000000000000000</double> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="label_5"> - <property name="text"> - <string>Skew:</string> - </property> - </widget> - </item> - <item row="1" column="3"> - <widget class="ScrSpinBox" name="gY2"> - <property name="minimum"> - <double>-3000.000000000000000</double> - </property> - <property name="maximum"> - <double>3000.000000000000000</double> - </property> - </widget> - </item> - <item row="0" column="2"> - <widget class="QLabel" name="label_2"> - <property name="text"> - <string>/</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="ScrSpinBox" name="gX2"> - <property name="minimum"> - <double>-3000.000000000000000</double> - </property> - <property name="maximum"> - <double>3000.000000000000000</double> - </property> - </widget> - </item> - <item row="0" column="0"> - <widget class="QLabel" name="label"> - <property name="text"> - <string>Start:</string> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="ScrSpinBox" name="gSk"> - <property name="minimum"> - <double>-89.000000000000000</double> - </property> - <property name="maximum"> - <double>89.000000000000000</double> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="label_3"> - <property name="text"> - <string>End:</string> - </property> - </widget> - </item> - <item row="1" column="2"> - <widget class="QLabel" name="label_4"> - <property name="text"> - <string>/</string> - </property> - </widget> - </item> - <item row="3" column="1"> - <spacer name="verticalSpacer_3"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>40</height> - </size> - </property> - </spacer> - </item> - </layout> - </widget> - <widget class="QWidget" name="pageRadial"> - <layout class="QGridLayout" name="gridLayout"> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>0</number> - </property> - <property name="bottomMargin"> - <number>0</number> - </property> - <item row="4" column="1"> - <widget class="ScrSpinBox" name="gSc"> - <property name="minimum"> - <double>0.010000000000000</double> - </property> - <property name="maximum"> - <double>100.000000000000000</double> - </property> - <property name="value"> - <double>100.000000000000000</double> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="ScrSpinBox" name="gX2_2"> - <property name="minimum"> - <double>-3000.000000000000000</double> - </property> - <property name="maximum"> - <double>3000.000000000000000</double> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="ScrSpinBox" name="gX1_2"> - <property name="minimum"> - <double>-3000.000000000000000</double> - </property> - <property name="maximum"> - <double>3000.000000000000000</double> - </property> - </widget> - </item> - <item row="0" column="2"> - <widget class="QLabel" name="label_6"> - <property name="text"> - <string>/</string> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="label_11"> - <property name="text"> - <string>Focal:</string> - </property> - </widget> - </item> - <item row="1" column="2"> - <widget class="QLabel" name="label_10"> - <property name="text"> - <string>/</string> - </property> - </widget> - </item> - <item row="2" column="2"> - <widget class="QLabel" name="label_12"> - <property name="text"> - <string>/</string> - </property> - </widget> - </item> - <item row="1" column="3"> - <widget class="ScrSpinBox" name="gY2_2"> - <property name="minimum"> - <double>-3000.000000000000000</double> - </property> - <property name="maximum"> - <double>3000.000000000000000</double> - </property> - </widget> - </item> - <item row="0" column="3"> - <widget class="ScrSpinBox" name="gY1_2"> - <property name="minimum"> - <double>-3000.000000000000000</double> - </property> - <property name="maximum"> - <double>3000.000000000000000</double> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="ScrSpinBox" name="gFX"> - <property name="minimum"> - <double>-3000.000000000000000</double> - </property> - <property name="maximum"> - <double>3000.000000000000000</double> - </property> - </widget> - </item> - <item row="3" column="1"> - <widget class="ScrSpinBox" name="gSk_2"> - <property name="minimum"> - <double>-89.000000000000000</double> - </property> - <property name="maximum"> - <double>89.000000000000000</double> - </property> - </widget> - </item> - <item row="4" column="0"> - <widget class="QLabel" name="label_13"> - <property name="text"> - <string>Scale:</string> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="label_9"> - <property name="text"> - <string>End:</string> - </property> - </widget> - </item> - <item row="3" column="0"> - <widget class="QLabel" name="label_7"> - <property name="text"> - <string>Skew:</string> - </property> - </widget> - </item> - <item row="2" column="3"> - <widget class="ScrSpinBox" name="gFY"> - <property name="minimum"> - <double>-3000.000000000000000</double> - </property> - <property name="maximum"> - <double>3000.000000000000000</double> - </property> - </widget> - </item> - <item row="0" column="0"> - <widget class="QLabel" name="label_8"> - <property name="text"> - <string>Start:</string> - </property> - </widget> - </item> - <item row="5" column="1"> - <spacer name="verticalSpacer_5"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </widget> - <widget class="QWidget" name="pageFourColor"> - <layout class="QGridLayout" name="gridLayout_4"> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>0</number> - </property> - <property name="bottomMargin"> - <number>0</number> - </property> - <item row="1" column="2"> - <widget class="QLabel" name="label_17"> - <property name="text"> - <string>/</string> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="label_15"> - <property name="text"> - <string>3. Point:</string> - </property> - </widget> - </item> - <item row="1" column="3"> - <widget class="ScrSpinBox" name="gC2Y"> - <property name="minimum"> - <double>-3000.000000000000000</double> - </property> - <property name="maximum"> - <double>3000.000000000000000</double> - </property> - </widget> - </item> - <item row="3" column="0"> - <widget class="QLabel" name="label_21"> - <property name="text"> - <string>4. Point:</string> - </property> - </widget> - </item> - <item row="0" column="2"> - <widget class="QLabel" name="label_18"> - <property name="text"> - <string>/</string> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="ScrSpinBox" name="gC3X"> - <property name="minimum"> - <double>-3000.000000000000000</double> - </property> - <property name="maximum"> - <double>3000.000000000000000</double> - </property> - </widget> - </item> - <item row="2" column="2"> - <widget class="QLabel" name="label_14"> - <property name="text"> - <string>/</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="ScrSpinBox" name="gC2X"> - <property name="minimum"> - <double>-3000.000000000000000</double> - </property> - <property name="maximum"> - <double>3000.000000000000000</double> - </property> - </widget> - </item> - <item row="0" column="0"> - <widget class="QLabel" name="label_19"> - <property name="text"> - <string>1. Point:</string> - </property> - </widget> - </item> - <item row="2" column="3"> - <widget class="ScrSpinBox" name="gC3Y"> - <property name="minimum"> - <double>-3000.000000000000000</double> - </property> - <property name="maximum"> - <double>3000.000000000000000</double> - </property> - </widget> - </item> - <item row="3" column="1"> - <widget class="ScrSpinBox" name="gC4X"> - <property name="minimum"> - <double>-3000.000000000000000</double> - </property> - <property name="maximum"> - <double>3000.000000000000000</double> - </property> - </widget> - </item> - <item row="3" column="3"> - <widget class="ScrSpinBox" name="gC4Y"> - <property name="minimum"> - <double>-3000.000000000000000</double> - </property> - <property name="maximum"> - <double>3000.000000000000000</double> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="ScrSpinBox" name="gC1X"> - <property name="minimum"> - <double>-3000.000000000000000</double> - </property> - <property name="maximum"> - <double>3000.000000000000000</double> - </property> - </widget> - </item> - <item row="3" column="2"> - <widget class="QLabel" name="label_20"> - <property name="text"> - <string>/</string> - </property> - </widget> - </item> - <item row="0" column="3"> - <widget class="ScrSpinBox" name="gC1Y"> - <property name="minimum"> - <double>-3000.000000000000000</double> - </property> - <property name="maximum"> - <double>3000.000000000000000</double> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="label_16"> - <property name="text"> - <string>2. Point:</string> - </property> - </widget> - </item> - <item row="4" column="1"> - <spacer name="verticalSpacer_4"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>40</height> - </size> - </property> - </spacer> - </item> - </layout> - </widget> - <widget class="QWidget" name="pageDiamond"> - <layout class="QGridLayout" name="gridLayout_2"> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>0</number> - </property> - <property name="bottomMargin"> - <number>0</number> - </property> - <item row="0" column="0"> - <widget class="QLabel" name="label_23"> - <property name="text"> - <string>1. Point:</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="ScrSpinBox" name="gC1XD"> - <property name="minimum"> - <double>-3000.000000000000000</double> - </property> - <property name="maximum"> - <double>3000.000000000000000</double> - </property> - </widget> - </item> - <item row="0" column="2"> - <widget class="QLabel" name="label_26"> - <property name="text"> - <string>/</string> - </property> - </widget> - </item> - <item row="0" column="3"> - <widget class="ScrSpinBox" name="gC1YD"> - <property name="minimum"> - <double>-3000.000000000000000</double> - </property> - <property name="maximum"> - <double>3000.000000000000000</double> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="label_25"> - <property name="text"> - <string>2. Point:</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="ScrSpinBox" name="gC2XD"> - <property name="minimum"> - <double>-3000.000000000000000</double> - </property> - <property name="maximum"> - <double>3000.000000000000000</double> - </property> - </widget> - </item> - <item row="1" column="2"> - <widget class="QLabel" name="label_24"> - <property name="text"> - <string>/</string> - </property> - </widget> - </item> - <item row="1" column="3"> - <widget class="ScrSpinBox" name="gC2YD"> - <property name="minimum"> - <double>-3000.000000000000000</double> - </property> - <property name="maximum"> - <double>3000.000000000000000</double> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="label_27"> - <property name="text"> - <string>3. Point:</string> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="ScrSpinBox" name="gC3XD"> - <property name="minimum"> - <double>-3000.000000000000000</double> - </property> - <property name="maximum"> - <double>3000.000000000000000</double> - </property> - </widget> - </item> - <item row="2" column="2"> - <widget class="QLabel" name="label_29"> - <property name="text"> - <string>/</string> - </property> - </widget> - </item> - <item row="2" column="3"> - <widget class="ScrSpinBox" name="gC3YD"> - <property name="minimum"> - <double>-3000.000000000000000</double> - </property> - <property name="maximum"> - <double>3000.000000000000000</double> - </property> - </widget> - </item> - <item row="3" column="0"> - <widget class="QLabel" name="label_28"> - <property name="text"> - <string>4. Point:</string> - </property> - </widget> - </item> - <item row="3" column="1"> - <widget class="ScrSpinBox" name="gC4XD"> - <property name="minimum"> - <double>-3000.000000000000000</double> - </property> - <property name="maximum"> - <double>3000.000000000000000</double> - </property> - </widget> - </item> - <item row="3" column="2"> - <widget class="QLabel" name="label_22"> - <property name="text"> - <string>/</string> - </property> - </widget> - </item> - <item row="3" column="3"> - <widget class="ScrSpinBox" name="gC4YD"> - <property name="minimum"> - <double>-3000.000000000000000</double> - </property> - <property name="maximum"> - <double>3000.000000000000000</double> - </property> - </widget> - </item> - <item row="4" column="0"> - <widget class="QLabel" name="label_30"> - <property name="text"> - <string>5. Point:</string> - </property> - </widget> - </item> - <item row="4" column="1"> - <widget class="ScrSpinBox" name="gC5XD"> - <property name="minimum"> - <double>-3000.000000000000000</double> - </property> - <property name="maximum"> - <double>3000.000000000000000</double> - </property> - </widget> - </item> - <item row="4" column="2"> - <widget class="QLabel" name="label_31"> - <property name="text"> - <string>/</string> - </property> - </widget> - </item> - <item row="4" column="3"> - <widget class="ScrSpinBox" name="gC5YD"> - <property name="minimum"> - <double>-3000.000000000000000</double> - </property> - <property name="maximum"> - <double>3000.000000000000000</double> - </property> - </widget> - </item> - </layout> - </widget> - <widget class="QWidget" name="pageMesh"> - <layout class="QVBoxLayout" name="verticalLayout_2"> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>0</number> - </property> - <property name="bottomMargin"> - <number>0</number> - </property> - <item> - <layout class="QHBoxLayout" name="horizontalLayout"> - <item> - <layout class="QGridLayout" name="gridLayout_5"> - <item row="0" column="0"> - <widget class="QToolButton" name="editPoints"> - <property name="minimumSize"> - <size> - <width>22</width> - <height>22</height> - </size> - </property> - <property name="toolTip"> - <string>Edit Grid Points</string> - </property> - <property name="text"> - <string/> - </property> - <property name="checkable"> - <bool>true</bool> - </property> - <property name="autoExclusive"> - <bool>true</bool> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QToolButton" name="editControlPoints"> - <property name="minimumSize"> - <size> - <width>22</width> - <height>22</height> - </size> - </property> - <property name="toolTip"> - <string>Edit Control Points</string> - </property> - <property name="text"> - <string/> - </property> - <property name="checkable"> - <bool>true</bool> - </property> - <property name="autoExclusive"> - <bool>true</bool> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QToolButton" name="resetControlPoint"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="minimumSize"> - <size> - <width>22</width> - <height>22</height> - </size> - </property> - <property name="toolTip"> - <string>Reset selected Control Point</string> - </property> - <property name="text"> - <string/> - </property> - <property name="checkable"> - <bool>false</bool> - </property> - <property name="autoExclusive"> - <bool>false</bool> - </property> - </widget> - </item> - <item row="1" column="2"> - <widget class="QToolButton" name="resetAllControlPoints"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="minimumSize"> - <size> - <width>22</width> - <height>22</height> - </size> - </property> - <property name="toolTip"> - <string>Reset all Control Points</string> - </property> - <property name="text"> - <string/> - </property> - <property name="checkable"> - <bool>false</bool> - </property> - <property name="autoExclusive"> - <bool>false</bool> - </property> - </widget> - </item> - </layout> - </item> - <item> - <spacer name="horizontalSpacer"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_2"> - <item> - <layout class="QGridLayout" name="gridLayout_6"> - <item row="0" column="0"> - <widget class="QPushButton" name="buttonNewGrid"> - <property name="text"> - <string>New Mesh...</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QPushButton" name="buttonResetGrid"> - <property name="text"> - <string>Reset Mesh</string> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QPushButton" name="buttonPoLIne"> - <property name="text"> - <string>Mesh -> Shape</string> - </property> - </widget> - </item> - </layout> - </item> - <item> - <spacer name="horizontalSpacer_2"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>18</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - <item> - <spacer name="verticalSpacer"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </widget> - <widget class="QWidget" name="pagePatch"> - <layout class="QVBoxLayout" name="verticalLayout_3"> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>0</number> - </property> - <property name="bottomMargin"> - <number>0</number> - </property> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_3"> - <item> - <layout class="QGridLayout" name="gridLayout_7"> - <item row="0" column="0"> - <widget class="QToolButton" name="editPPoint"> - <property name="minimumSize"> - <size> - <width>22</width> - <height>22</height> - </size> - </property> - <property name="toolTip"> - <string>Edit Grid Points</string> - </property> - <property name="text"> - <string/> - </property> - <property name="checkable"> - <bool>true</bool> - </property> - <property name="autoExclusive"> - <bool>true</bool> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QToolButton" name="editPControlPoints"> - <property name="minimumSize"> - <size> - <width>22</width> - <height>22</height> - </size> - </property> - <property name="toolTip"> - <string>Edit Control Points</string> - </property> - <property name="text"> - <string/> - </property> - <property name="checkable"> - <bool>true</bool> - </property> - <property name="autoExclusive"> - <bool>true</bool> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QToolButton" name="resetPControlPoint"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="minimumSize"> - <size> - <width>22</width> - <height>22</height> - </size> - </property> - <property name="toolTip"> - <string>Reset selected Control Point</string> - </property> - <property name="text"> - <string/> - </property> - <property name="checkable"> - <bool>false</bool> - </property> - <property name="autoExclusive"> - <bool>false</bool> - </property> - </widget> - </item> - <item row="1" column="2"> - <widget class="QToolButton" name="resetAllPControlPoints"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="minimumSize"> - <size> - <width>22</width> - <height>22</height> - </size> - </property> - <property name="toolTip"> - <string>Reset all Control Points</string> - </property> - <property name="text"> - <string/> - </property> - <property name="checkable"> - <bool>false</bool> - </property> - <property name="autoExclusive"> - <bool>false</bool> - </property> - </widget> - </item> - </layout> - </item> - <item> - <spacer name="horizontalSpacer_3"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - <item> - <widget class="QCheckBox" name="snapToGrid"> - <property name="text"> - <string>Snap to other Mesh Points</string> - </property> - </widget> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_4"> - <item> - <widget class="QPushButton" name="buttonAddPatch"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="text"> - <string>Add Patch</string> - </property> - <property name="checkable"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="buttonRemovePatch"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="text"> - <string>Remove Patch</string> - </property> - </widget> - </item> - <item> - <spacer name="horizontalSpacer_4"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>13</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - <item> - <spacer name="verticalSpacer_2"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </widget> - </widget> - </item> - </layout> - </widget> - <layoutdefault spacing="6" margin="11"/> - <customwidgets> - <customwidget> - <class>ScrSpinBox</class> - <extends>QDoubleSpinBox</extends> - <header>ui/scrspinbox.h</header> - </customwidget> - <customwidget> - <class>ScrPaletteBase</class> - <extends>QWidget</extends> - <header>ui/scrpalettebase.h</header> - <container>1</container> - </customwidget> - </customwidgets> - <includes> - <include location="local">ui/scrpalettebase.h</include> - <include location="local">ui/scrpalettebase.h</include> - <include location="local">ui/scrspinbox.h</include> - </includes> - <resources/> - <connections/> -</ui> Index: scribus/ui/gradientvectordialog.cpp =================================================================== --- scribus/ui/gradientvectordialog.cpp (Revision 26070) +++ scribus/ui/gradientvectordialog.cpp (nicht existent) @@ -1,453 +0,0 @@ -/* -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. -*/ -/*************************************************************************** - gradientvectordialog.cpp - description - ------------------- - begin : Tue Nov 17 2009 - copyright : (C) 2009 by Franz Schmid - email : 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. * - * * - ***************************************************************************/ - -#include "gradientvectordialog.h" -#include "units.h" -#include "iconmanager.h" - -GradientVectorDialog::GradientVectorDialog(QWidget* parent) : ScrPaletteBase(parent, "GradientVectorPalette", false, Qt::WindowFlags()) -{ - m_unitRatio = 1.0; - - setupUi(this); - gSk->setNewUnit(6); - gSk->setValues(-89, 89, 2, 0); - gSk_2->setNewUnit(6); - gSk->setValues(-89, 89, 2, 0); - gSc->setSuffix(" %"); - gSc->setValue( 100 ); - connect(gX1, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialL())); - connect(gX2, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialL())); - connect(gY1, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialL())); - connect(gY2, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialL())); - connect(gSk, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialL())); - connect(gX1_2, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialR())); - connect(gX2_2, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialR())); - connect(gY1_2, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialR())); - connect(gY2_2, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialR())); - connect(gFX, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialR())); - connect(gFY, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialR())); - connect(gSk_2, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialR())); - connect(gSc, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialR())); - connect(gC1X, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialF())); - connect(gC1Y, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialF())); - connect(gC2X, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialF())); - connect(gC2Y, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialF())); - connect(gC3X, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialF())); - connect(gC3Y, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialF())); - connect(gC4X, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialF())); - connect(gC4Y, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialF())); - connect(gC1XD, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialD())); - connect(gC1YD, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialD())); - connect(gC2XD, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialD())); - connect(gC2YD, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialD())); - connect(gC3XD, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialD())); - connect(gC3YD, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialD())); - connect(gC4XD, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialD())); - connect(gC4YD, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialD())); - connect(gC5XD, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialD())); - connect(gC5YD, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialD())); - connect(editPoints, SIGNAL(clicked()), this, SLOT(handleEditButton())); - connect(editControlPoints, SIGNAL(clicked()), this, SLOT(handleEditControlButton())); - connect(buttonNewGrid, SIGNAL(clicked()), this, SIGNAL(createNewMesh())); - connect(buttonResetGrid, SIGNAL(clicked()), this, SIGNAL(resetMesh())); - connect(buttonPoLIne, SIGNAL(clicked()), this, SIGNAL(meshToShape())); - connect(resetControlPoint, SIGNAL(clicked()), this, SIGNAL(reset1Control())); - connect(resetAllControlPoints, SIGNAL(clicked()), this, SIGNAL(resetAllControl())); - connect(editPPoint, SIGNAL(clicked()), this, SLOT(handlePEditButton())); - connect(editPControlPoints, SIGNAL(clicked()), this, SLOT(handlePEditControlButton())); - connect(buttonAddPatch, SIGNAL(clicked()), this, SLOT(handlePAddButton())); - connect(buttonRemovePatch, SIGNAL(clicked()), this, SIGNAL(removePatch())); - connect(resetPControlPoint, SIGNAL(clicked()), this, SIGNAL(reset1Control())); - connect(resetAllPControlPoints, SIGNAL(clicked()), this, SIGNAL(resetAllControl())); - connect(snapToGrid, SIGNAL(clicked()), this, SLOT(handleSnapToGridBox())); - QSize iconSize = QSize(22, 22); - IconManager& im = IconManager::instance(); - editPoints->setIcon(im.loadIcon("MoveNode.png")); - editPoints->setIconSize(iconSize); - editControlPoints->setIcon(im.loadIcon("MoveKontrol.png")); - editControlPoints->setIconSize(iconSize); - resetControlPoint->setIcon(im.loadIcon("Reset1Node.png")); - resetControlPoint->setIconSize(iconSize); - resetAllControlPoints->setIcon(im.loadIcon("ResetNode.png")); - resetAllControlPoints->setIconSize(iconSize); - editPPoint->setIcon(im.loadIcon("MoveNode.png")); - editPPoint->setIconSize(iconSize); - editPControlPoints->setIcon(im.loadIcon("MoveKontrol.png")); - editPControlPoints->setIconSize(iconSize); - resetPControlPoint->setIcon(im.loadIcon("Reset1Node.png")); - resetPControlPoint->setIconSize(iconSize); - resetAllPControlPoints->setIcon(im.loadIcon("ResetNode.png")); - resetAllPControlPoints->setIconSize(iconSize); - languageChange(); - selectLinear(); -} - -void GradientVectorDialog::changeEvent(QEvent *e) -{ - if (e->type() == QEvent::LanguageChange) - { - languageChange(); - } - else - QWidget::changeEvent(e); -} - -void GradientVectorDialog::selectLinear() -{ - stackedWidget->setCurrentIndex(0); - resize(minimumSizeHint()); -} - -void GradientVectorDialog::selectRadial() -{ - stackedWidget->setCurrentIndex(1); - label_7->show(); - gSk_2->show(); - resize(minimumSizeHint()); -} - -void GradientVectorDialog::selectConical() -{ - stackedWidget->setCurrentIndex(1); - label_7->hide(); - gSk_2->hide(); - resize(minimumSizeHint()); -} - -void GradientVectorDialog::selectFourColor() -{ - stackedWidget->setCurrentIndex(2); - resize(minimumSizeHint()); -} - -void GradientVectorDialog::selectDiamond() -{ - stackedWidget->setCurrentIndex(3); - resize(minimumSizeHint()); -} - -void GradientVectorDialog::selectMesh() -{ - stackedWidget->setCurrentIndex(4); - editPoints->setChecked(true); - resize(minimumSizeHint()); -} - -void GradientVectorDialog::selectPatchMesh() -{ - stackedWidget->setCurrentIndex(5); - editPPoint->setChecked(true); - snapToGrid->setChecked(false); - snapToGrid->setEnabled(true); - resize(minimumSizeHint()); -} - -void GradientVectorDialog::languageChange() -{ - retranslateUi(this); - resize(minimumSizeHint()); -} - -void GradientVectorDialog::handleEditButton() -{ - if (editPoints->isChecked()) - { - resetAllControlPoints->setEnabled(false); - resetControlPoint->setEnabled(false); - emit editGradient(5); - } -} - -void GradientVectorDialog::handleEditControlButton() -{ - if (editControlPoints->isChecked()) - { - resetAllControlPoints->setEnabled(true); - resetControlPoint->setEnabled(true); - emit editGradient(7); - } -} - -void GradientVectorDialog::handlePEditButton() -{ - if (editPPoint->isChecked()) - { - snapToGrid->setEnabled(true); - resetAllPControlPoints->setEnabled(false); - resetPControlPoint->setEnabled(false); - emit editGradient(9); - } -} - -void GradientVectorDialog::handlePEditControlButton() -{ - if (editPControlPoints->isChecked()) - { - snapToGrid->setEnabled(false); - resetAllPControlPoints->setEnabled(true); - resetPControlPoint->setEnabled(true); - emit editGradient(10); - } -} - -void GradientVectorDialog::handleSnapToGridBox() -{ - emit snapToMGrid(snapToGrid->isChecked()); -} - -void GradientVectorDialog::handlePAddButton() -{ - editPPoint->setChecked(true); - editPPoint->setEnabled(false); - editPControlPoints->setEnabled(false); - resetAllPControlPoints->setEnabled(false); - resetPControlPoint->setEnabled(false); - buttonAddPatch->setEnabled(false); - emit editGradient(11); -} - -void GradientVectorDialog::endPAddButton() -{ - editPPoint->setChecked(true); - editPPoint->setEnabled(true); - editPControlPoints->setEnabled(true); - resetAllPControlPoints->setEnabled(false); - resetPControlPoint->setEnabled(false); - buttonAddPatch->setChecked(false); - buttonAddPatch->setEnabled(true); -} - -void GradientVectorDialog::changebuttonRemovePatch(bool val) -{ - buttonRemovePatch->setEnabled(val); -} - -void GradientVectorDialog::setValues(double x1, double y1, double x2, double y2, double fx, double fy, double sg, double sk, double cx, double cy) -{ - disconnect(gX1, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialL())); - disconnect(gX2, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialL())); - disconnect(gY1, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialL())); - disconnect(gY2, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialL())); - disconnect(gSk, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialL())); - disconnect(gX1_2, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialR())); - disconnect(gX2_2, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialR())); - disconnect(gY1_2, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialR())); - disconnect(gY2_2, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialR())); - disconnect(gFX, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialR())); - disconnect(gFY, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialR())); - disconnect(gSk_2, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialR())); - disconnect(gSc, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialR())); - disconnect(gC1X, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialF())); - disconnect(gC1Y, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialF())); - disconnect(gC2X, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialF())); - disconnect(gC2Y, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialF())); - disconnect(gC3X, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialF())); - disconnect(gC3Y, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialF())); - disconnect(gC4X, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialF())); - disconnect(gC4Y, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialF())); - disconnect(gC1XD, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialD())); - disconnect(gC1YD, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialD())); - disconnect(gC2XD, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialD())); - disconnect(gC2YD, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialD())); - disconnect(gC3XD, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialD())); - disconnect(gC3YD, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialD())); - disconnect(gC4XD, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialD())); - disconnect(gC4YD, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialD())); - disconnect(gC5XD, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialD())); - disconnect(gC5YD, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialD())); - - gX1->setValue(x1 * m_unitRatio); - gX2->setValue(x2 * m_unitRatio); - gY1->setValue(y1 * m_unitRatio); - gY2->setValue(y2 * m_unitRatio); - gFX->setValue(fx * m_unitRatio); - gFY->setValue(fy * m_unitRatio); - gSk->setValue(sk); - gSc->setValue(sg * 100.0); - gX1_2->setValue(x1 * m_unitRatio); - gX2_2->setValue(x2 * m_unitRatio); - gY1_2->setValue(y1 * m_unitRatio); - gY2_2->setValue(y2 * m_unitRatio); - gSk_2->setValue(sk); - gC1X->setValue(x1 * m_unitRatio); - gC1Y->setValue(y1 * m_unitRatio); - gC2X->setValue(x2 * m_unitRatio); - gC2Y->setValue(y2 * m_unitRatio); - gC3X->setValue(fx * m_unitRatio); - gC3Y->setValue(fy * m_unitRatio); - gC4X->setValue(sg * m_unitRatio); - gC4Y->setValue(sk * m_unitRatio); - gC1XD->setValue(x1 * m_unitRatio); - gC1YD->setValue(y1 * m_unitRatio); - gC2XD->setValue(x2 * m_unitRatio); - gC2YD->setValue(y2 * m_unitRatio); - gC3XD->setValue(fx * m_unitRatio); - gC3YD->setValue(fy * m_unitRatio); - gC4XD->setValue(sg * m_unitRatio); - gC4YD->setValue(sk * m_unitRatio); - gC5XD->setValue(cx * m_unitRatio); - gC5YD->setValue(cy * m_unitRatio); - - connect(gX1, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialL())); - connect(gX2, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialL())); - connect(gY1, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialL())); - connect(gY2, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialL())); - connect(gSk, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialL())); - connect(gX1_2, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialR())); - connect(gX2_2, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialR())); - connect(gY1_2, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialR())); - connect(gY2_2, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialR())); - connect(gFX, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialR())); - connect(gFY, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialR())); - connect(gSk_2, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialR())); - connect(gSc, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialR())); - connect(gC1X, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialF())); - connect(gC1Y, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialF())); - connect(gC2X, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialF())); - connect(gC2Y, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialF())); - connect(gC3X, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialF())); - connect(gC3Y, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialF())); - connect(gC4X, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialF())); - connect(gC4Y, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialF())); - connect(gC1XD, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialD())); - connect(gC1YD, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialD())); - connect(gC2XD, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialD())); - connect(gC2YD, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialD())); - connect(gC3XD, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialD())); - connect(gC3YD, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialD())); - connect(gC4XD, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialD())); - connect(gC4YD, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialD())); - connect(gC5XD, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialD())); - connect(gC5YD, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialD())); -} - -void GradientVectorDialog::changeSpecialL() -{ - emit NewSpecial(gX1->value(), gY1->value(), gX2->value(), gY2->value(), gFX->value(), gFY->value(), 1, gSk->value(), 0, 0); -} - -void GradientVectorDialog::changeSpecialR() -{ - emit NewSpecial(gX1_2->value(), gY1_2->value(), gX2_2->value(), gY2_2->value(), gFX->value(), gFY->value(), gSc->value() / 100.0, gSk_2->value(), 0, 0); -} - -void GradientVectorDialog::changeSpecialF() -{ - emit NewSpecial(gC1X->value(), gC1Y->value(), gC2X->value(), gC2Y->value(), gC3X->value(), gC3Y->value(), gC4X->value(), gC4Y->value(), 0, 0); -} - -void GradientVectorDialog::changeSpecialD() -{ - emit NewSpecial(gC1XD->value(), gC1YD->value(), gC2XD->value(), gC2YD->value(), gC3XD->value(), gC3YD->value(), gC4XD->value(), gC4YD->value(), gC5XD->value(), gC5YD->value()); -} - -void GradientVectorDialog::unitChange(int unitIndex) -{ - m_unitRatio = unitGetRatioFromIndex(unitIndex); - - disconnect(gX1, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialL())); - disconnect(gX2, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialL())); - disconnect(gY1, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialL())); - disconnect(gY2, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialL())); - disconnect(gX1_2, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialR())); - disconnect(gX2_2, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialR())); - disconnect(gY1_2, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialR())); - disconnect(gY2_2, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialR())); - disconnect(gFX, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialR())); - disconnect(gFY, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialR())); - disconnect(gC1X, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialF())); - disconnect(gC1Y, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialF())); - disconnect(gC2X, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialF())); - disconnect(gC2Y, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialF())); - disconnect(gC3X, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialF())); - disconnect(gC3Y, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialF())); - disconnect(gC4X, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialF())); - disconnect(gC4Y, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialF())); - disconnect(gC1XD, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialD())); - disconnect(gC1YD, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialD())); - disconnect(gC2XD, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialD())); - disconnect(gC2YD, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialD())); - disconnect(gC3XD, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialD())); - disconnect(gC3YD, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialD())); - disconnect(gC4XD, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialD())); - disconnect(gC4YD, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialD())); - disconnect(gC5XD, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialD())); - disconnect(gC5YD, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialD())); - gX1->setNewUnit(unitIndex); - gY1->setNewUnit(unitIndex); - gX2->setNewUnit(unitIndex); - gY2->setNewUnit(unitIndex); - gFX->setNewUnit(unitIndex); - gFY->setNewUnit(unitIndex); - gX1_2->setNewUnit(unitIndex); - gY1_2->setNewUnit(unitIndex); - gX2_2->setNewUnit(unitIndex); - gY2_2->setNewUnit(unitIndex); - gC1X->setNewUnit(unitIndex); - gC1Y->setNewUnit(unitIndex); - gC2X->setNewUnit(unitIndex); - gC2Y->setNewUnit(unitIndex); - gC3X->setNewUnit(unitIndex); - gC3Y->setNewUnit(unitIndex); - gC4X->setNewUnit(unitIndex); - gC4Y->setNewUnit(unitIndex); - gC1XD->setNewUnit(unitIndex); - gC1YD->setNewUnit(unitIndex); - gC2XD->setNewUnit(unitIndex); - gC2YD->setNewUnit(unitIndex); - gC3XD->setNewUnit(unitIndex); - gC3YD->setNewUnit(unitIndex); - gC4XD->setNewUnit(unitIndex); - gC4YD->setNewUnit(unitIndex); - gC5XD->setNewUnit(unitIndex); - gC5YD->setNewUnit(unitIndex); - connect(gX1, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialL())); - connect(gX2, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialL())); - connect(gY1, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialL())); - connect(gY2, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialL())); - connect(gX1_2, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialR())); - connect(gX2_2, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialR())); - connect(gY1_2, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialR())); - connect(gY2_2, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialR())); - connect(gFX, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialR())); - connect(gFY, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialR())); - connect(gC1X, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialF())); - connect(gC1Y, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialF())); - connect(gC2X, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialF())); - connect(gC2Y, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialF())); - connect(gC3X, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialF())); - connect(gC3Y, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialF())); - connect(gC4X, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialF())); - connect(gC4Y, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialF())); - connect(gC1XD, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialD())); - connect(gC1YD, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialD())); - connect(gC2XD, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialD())); - connect(gC2YD, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialD())); - connect(gC3XD, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialD())); - connect(gC3YD, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialD())); - connect(gC4XD, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialD())); - connect(gC4YD, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialD())); - connect(gC5XD, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialD())); - connect(gC5YD, SIGNAL(valueChanged(double)), this, SLOT(changeSpecialD())); -} Index: scribus/ui/gradientvectordialog.h =================================================================== --- scribus/ui/gradientvectordialog.h (Revision 26070) +++ scribus/ui/gradientvectordialog.h (nicht existent) @@ -1,90 +0,0 @@ -/* -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. -*/ -/*************************************************************************** - gradientvectordialog.h - description - ------------------- - begin : Tue Nov 17 2009 - copyright : (C) 2009 by Franz Schmid - email : 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. * - * * - ***************************************************************************/ - -#ifndef GRADVECTOR_H -#define GRADVECTOR_H - -#include "ui_gradientvectorbase.h" - -#include <QWidget> -#include <QLayout> -#include <QLabel> -#include <QEvent> -#include "scribusapi.h" -#include "ui/scrpalettebase.h" - -/** - *@author Franz Schmid - */ - -class SCRIBUS_API GradientVectorDialog : public ScrPaletteBase, Ui::GradientVectorBase -{ - Q_OBJECT - -public: - GradientVectorDialog( QWidget* parent); - ~GradientVectorDialog() {}; - - void selectLinear(); - void selectRadial(); - void selectConical(); - void selectFourColor(); - void selectDiamond(); - void selectMesh(); - void selectPatchMesh(); - -public slots: - void languageChange(); - void handleEditButton(); - void handleEditControlButton(); - void handlePEditButton(); - void handlePEditControlButton(); - void handlePAddButton(); - void handleSnapToGridBox(); - void endPAddButton(); - void changebuttonRemovePatch(bool val); - void setValues(double x1, double y1, double x2, double y2, double fx, double fy, double sg, double sk, double cx, double cy); - void changeSpecialL(); - void changeSpecialR(); - void changeSpecialF(); - void changeSpecialD(); - void unitChange(int unitIndex); - -protected: - double m_unitRatio; - - void changeEvent(QEvent *e) override; - -signals: - void NewSpecial(double, double, double, double, double, double, double, double, double, double); - void editGradient(int); - void createNewMesh(); - void resetMesh(); - void meshToShape(); - void reset1Control(); - void resetAllControl(); - void removePatch(); - void snapToMGrid(bool); - -}; -#endif Index: scribus/ui/linemarkerselector.cpp =================================================================== --- scribus/ui/linemarkerselector.cpp (Revision 26070) +++ scribus/ui/linemarkerselector.cpp (Arbeitskopie) @@ -15,7 +15,7 @@ listMarker->setIconSize(QSize(60,48)); listMarker->setGridSize(QSize(76,64)); listMarker->setSpacing(4); - listMarker->setItemDelegate(new ScListItemDelegate(QSize(60,48))); + listMarker->setItemDelegate(new ScListItemDelegate(QListWidget::IconMode, QSize(60,48))); connect(listMarker, &QListWidget::itemSelectionChanged, this, [this]() { emit markerChanged(marker()); Index: scribus/ui/linestyleselector.cpp =================================================================== --- scribus/ui/linestyleselector.cpp (nicht existent) +++ scribus/ui/linestyleselector.cpp (Arbeitskopie) @@ -0,0 +1,151 @@ +#include "linestyleselector.h" +#include "scribus.h" +#include "sccolorengine.h" +#include "ui/delegates/sclistitemdelegate.h" +#include "util.h" +#include "ui/propertiespalette_utils.h" +#include "ui/stylemanager.h" +#include "util_gui.h" + +/* ********************************************************************************* * + * + * Constructor + Setup + * + * ********************************************************************************* */ + +LineStyleSelector::LineStyleSelector(QWidget *parent) : + QWidget(parent) +{ + setupUi(this); + + //lineStyles->setItemDelegate(new LineStyleItemDelegate()); +// tnailGrid->setIconSize(QSize(ICONSIZE, ICONSIZE)); +// tnailGrid->setGridSize(QSize(220, 80)); +// tnailGrid->setResizeMode(QListView::Adjust); +// tnailGrid->setItemDelegate(new ScListItemDelegate(QSize(ICONSIZE,ICONSIZE), ScListItemDelegate::Right)); + + lineStyles->setViewMode(QListWidget::ListMode); + lineStyles->setIconSize(m_size); +// lineStyles->setGridSize(QSize(76,64)); +// lineStyles->setSpacing(4); + lineStyles->setItemDelegate(new ScListItemDelegate(QListWidget::ListMode, m_size, ScListItemDelegate::Right, ScListItemDelegate::Simple)); +// lineStyles->addItem( "No Style" ); +// lineStyles->setCurrentItem(lineStyles->item(0)); + + languageChange(); + + connect(lineStyles, SIGNAL(itemClicked(QListWidgetItem*)), this, SIGNAL(itemClicked(QListWidgetItem*))); + connect(buttonNewLine, &QToolButton::clicked, this, &LineStyleSelector::newLine); +} + +LineStyleSelector::~LineStyleSelector() +{ + delete lineStyles->itemDelegate(); +} + +/* ********************************************************************************* * + * + * Members + * + * ********************************************************************************* */ + +void LineStyleSelector::setDoc(ScribusDoc *doc) +{ + m_doc = doc; +} + +QSize LineStyleSelector::iconSize() +{ + return m_size; +} + +/* ********************************************************************************* * + * + * Methods + * + * ********************************************************************************* */ + +void LineStyleSelector::updateLineStyles() +{ + lineStyles->blockSignals(true); + lineStyles->clear(); + if (m_doc != nullptr) + { + QHash<QString,MultiLine>::Iterator it; + for (it = m_doc->docLineStyles.begin(); it != m_doc->docLineStyles.end(); ++it) + { + LineStyleItem *lsi = new LineStyleItem(m_doc, it.value(), it.key()); +// lsi->setSizeHint(QSize(lsi->sizeHint().width(), 48)); + QIcon ico; + ico.addPixmap(renderPixmap(lsi->data(Qt::UserRole).value<LineStyleValue>())); + lsi->setIcon(ico); + lineStyles->addItem( lsi ); + } + + lineStyles->sortItems(); + lineStyles->insertItem( 0, tr("No Style")); + lineStyles->item(0)->setIcon(QIcon(renderEmptyPattern(m_size))); + + if (lineStyles->currentItem()) + lineStyles->currentItem()->setSelected(false); + } + lineStyles->blockSignals(false); +} + +QPixmap LineStyleSelector::renderPixmap(LineStyleValue item) +{ + QPixmap pixmap(m_size); + pixmap.fill(Qt::white); + + //const LineStyleValue& item(lsi->data(Qt::UserRole).value<LineStyleValue>()); + + QPainter p(&pixmap); + for (int i = item.m_Line.size() - 1; i > -1; i--) + { + const SingleLine& sLine = item.m_Line.at(i); + const ScColor& col = item.m_doc->PageColors[sLine.Color]; + QColor tmpf = ScColorEngine::getDisplayColor(col, item.m_doc, sLine.Shade); + QPen pen; + QVector<double> m_array; + if (sLine.Dash == 1) + pen.setStyle(Qt::SolidLine); + else + { + getDashArray(sLine.Dash, 1, m_array); + pen.setDashPattern(m_array); + } + pen.setColor(tmpf); + pen.setWidth(qMax(static_cast<int>(sLine.Width), 1)); + pen.setCapStyle(static_cast<Qt::PenCapStyle>(sLine.LineEnd)); + pen.setJoinStyle(static_cast<Qt::PenJoinStyle>(sLine.LineJoin)); + p.setPen(pen); + p.drawLine(0, m_size.height() / 2, m_size.width(), m_size.height() / 2); + } + p.end(); + + return pixmap; + +} + +/* ********************************************************************************* * + * + * Slots + * + * ********************************************************************************* */ + +void LineStyleSelector::languageChange() +{ + if(lineStyles->count() > 0) + lineStyles->item(0)->setText( tr("No Style") ); + + lineStyles->setToolTip( tr("Line style of current object")); +} + +void LineStyleSelector::newLine() +{ + if(!m_doc) + return; + + m_doc->scMW()->styleMgr()->setPaletteShown(true); +} + Index: scribus/ui/linestyleselector.h =================================================================== --- scribus/ui/linestyleselector.h (nicht existent) +++ scribus/ui/linestyleselector.h (Arbeitskopie) @@ -0,0 +1,43 @@ +#ifndef LINESTYLESELECTOR_H +#define LINESTYLESELECTOR_H + +#include <QWidget> +#include "scribusapi.h" +#include "scribusdoc.h" +#include "ui_linestyleselector.h" + + + +class LineStyleValue; + +class SCRIBUS_API LineStyleSelector : public QWidget, private Ui::LineStyleSelector +{ + Q_OBJECT + +public: + explicit LineStyleSelector(QWidget *parent = nullptr); + ~LineStyleSelector(); + + void setDoc(ScribusDoc *doc); + void updateLineStyles(); + + QListWidget *list() {return lineStyles;}; + QSize iconSize(); + +private: + ScribusDoc *m_doc { nullptr }; + QPixmap renderPixmap(LineStyleValue item); + QSize m_size { QSize(128, 16) }; + +public slots: + void languageChange(); + +private slots: + void newLine(); + +signals: + void itemClicked(QListWidgetItem*); + +}; + +#endif // LINESTYLESELECTOR_H Index: scribus/ui/linestyleselector.ui =================================================================== --- scribus/ui/linestyleselector.ui (nicht existent) +++ scribus/ui/linestyleselector.ui (Arbeitskopie) @@ -0,0 +1,67 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>LineStyleSelector</class> + <widget class="QWidget" name="LineStyleSelector"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>309</width> + <height>238</height> + </rect> + </property> + <property name="windowTitle"> + <string>Form</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <property name="spacing"> + <number>4</number> + </property> + <property name="leftMargin"> + <number>8</number> + </property> + <property name="topMargin"> + <number>8</number> + </property> + <property name="rightMargin"> + <number>8</number> + </property> + <property name="bottomMargin"> + <number>8</number> + </property> + <item> + <widget class="QListWidget" name="lineStyles"> + <property name="viewMode"> + <enum>QListView::IconMode</enum> + </property> + </widget> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <widget class="QToolButton" name="buttonNewLine"> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + </layout> + </widget> + <resources/> + <connections/> +</ui> Index: scribus/ui/linkbutton.cpp =================================================================== --- scribus/ui/linkbutton.cpp (Revision 26070) +++ scribus/ui/linkbutton.cpp (Arbeitskopie) @@ -27,11 +27,11 @@ #include "linkbutton.h" #include "iconmanager.h" #include "scribusapp.h" -#include "scribuscore.h" LinkButton::LinkButton(QWidget *pa) : QToolButton(pa) { setBackgroundRole(QPalette::Window); + setCheckable(true); iconSetChange(); connect(ScQApp, SIGNAL(iconSetChanged()), this, SLOT(iconSetChange())); Index: scribus/ui/newdocdialog.cpp =================================================================== --- scribus/ui/newdocdialog.cpp (Revision 26070) +++ scribus/ui/newdocdialog.cpp (Arbeitskopie) @@ -64,7 +64,7 @@ clear(); setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding); setGridSize(QSize(96, 96)); - setItemDelegate(new ScListItemDelegate(QSize(32,32))); + setItemDelegate(new ScListItemDelegate(QListWidget::IconMode, QSize(32,32))); } void PageLayoutsWidget::arrangeIcons() Index: scribus/ui/nftwidget.cpp =================================================================== --- scribus/ui/nftwidget.cpp (Revision 26070) +++ scribus/ui/nftwidget.cpp (Arbeitskopie) @@ -42,7 +42,7 @@ tnailGrid->setIconSize(QSize(ICONSIZE, ICONSIZE)); tnailGrid->setGridSize(QSize(220, 80)); tnailGrid->setResizeMode(QListView::Adjust); - tnailGrid->setItemDelegate(new ScListItemDelegate(QSize(ICONSIZE,ICONSIZE), ScListItemDelegate::Right)); + tnailGrid->setItemDelegate(new ScListItemDelegate(QListWidget::IconMode, QSize(ICONSIZE,ICONSIZE), ScListItemDelegate::Right)); // Signals and Slots Connections connect(categoryList, SIGNAL(itemSelectionChanged()), this, SLOT(setThumbnails())); connect(tnailGrid, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SIGNAL(leaveOK())); Index: scribus/ui/prefs_userinterface.cpp =================================================================== --- scribus/ui/prefs_userinterface.cpp (Revision 26070) +++ scribus/ui/prefs_userinterface.cpp (Arbeitskopie) @@ -72,7 +72,8 @@ //showSplashCheckBox->setToolTip( "<qt>" + tr( "" ) + "</qt>"); //showStartupDialogCheckBox->setToolTip( "<qt>" + tr( "" ) + "</qt>"); storyEditorUseSmartSelectionCheckBox->setToolTip( "<qt>" + tr( "The default behavior when double-clicking on a word is to select the word and the first following space. Smart selection will select only the word, without the following space." ) + "</qt>"); - hideLabels->setToolTip("<qt>" + tr( "Hides additional labels intended for beginners." ) + "</qt>"); + hideLabels->setToolTip("<qt>" + tr( "Hides informational labels on palettes." ) + "</qt>"); + hideLabelsOfInactiveTabs->setToolTip("<qt>" + tr( "Hides labels of inactive palette tabs." ) + "</qt>"); } void Prefs_UserInterface::restoreDefaults(struct ApplicationPrefs *prefsData) @@ -104,7 +105,8 @@ useTabsForDocumentsCheckBox->setChecked(prefsData->uiPrefs.useTabs); showSplashCheckBox->setChecked(prefsData->uiPrefs.showSplashOnStartup); useSmallWidgetsCheckBox->setChecked(prefsData->uiPrefs.useSmallWidgets); - hideLabels->setChecked(prefsData->uiPrefs.hideLabels); + hideLabels->setChecked(prefsData->uiPrefs.hideLabels); + hideLabelsOfInactiveTabs->setChecked(prefsData->uiPrefs.hideLabelsOfInactiveTabs); storyEditorUseSmartSelectionCheckBox->setChecked(prefsData->storyEditorPrefs.smartTextSelection); seFont.fromString(prefsData->storyEditorPrefs.guiFont); @@ -126,7 +128,8 @@ prefsData->uiPrefs.useTabs = useTabsForDocumentsCheckBox->isChecked(); prefsData->uiPrefs.showSplashOnStartup = showSplashCheckBox->isChecked(); prefsData->uiPrefs.useSmallWidgets = useSmallWidgetsCheckBox->isChecked(); - prefsData->uiPrefs.hideLabels = hideLabels->isChecked(); + prefsData->uiPrefs.hideLabels = hideLabels->isChecked(); + prefsData->uiPrefs.hideLabelsOfInactiveTabs = hideLabelsOfInactiveTabs->isChecked(); prefsData->storyEditorPrefs.guiFont = seFont.toString(); prefsData->storyEditorPrefs.smartTextSelection = storyEditorUseSmartSelectionCheckBox->isChecked(); Index: scribus/ui/prefs_userinterfacebase.ui =================================================================== --- scribus/ui/prefs_userinterfacebase.ui (Revision 26070) +++ scribus/ui/prefs_userinterfacebase.ui (Arbeitskopie) @@ -107,7 +107,7 @@ </property> </widget> </item> - <item row="4" column="1"> + <item row="5" column="1"> <widget class="QCheckBox" name="useTabsForDocumentsCheckBox"> <property name="text"> <string>Use Tabs for Documents</string> @@ -114,7 +114,7 @@ </property> </widget> </item> - <item row="5" column="0"> + <item row="6" column="0"> <widget class="QLabel" name="recentDocumentsLabel"> <property name="text"> <string>&Recent Documents:</string> @@ -124,7 +124,7 @@ </property> </widget> </item> - <item row="5" column="1"> + <item row="6" column="1"> <widget class="QSpinBox" name="recentDocumentsSpinBox"/> </item> <item row="3" column="1"> @@ -134,6 +134,13 @@ </property> </widget> </item> + <item row="4" column="1"> + <widget class="QCheckBox" name="hideLabelsOfInactiveTabs"> + <property name="text"> + <string>Hide Labels of Inactive Palette Tabs</string> + </property> + </widget> + </item> </layout> </item> <item> Index: scribus/ui/propertiespalette.cpp =================================================================== --- scribus/ui/propertiespalette.cpp (Revision 26070) +++ scribus/ui/propertiespalette.cpp (Arbeitskopie) @@ -32,21 +32,20 @@ #include "appmodehelper.h" #include "appmodes.h" -#include "colorpalette.h" -#include "iconmanager.h" +#include "colorpicker/colorpicker.h" +#include "insertTable.h" #include "pageitem_table.h" +#include "propertiespalette_attributes.h" #include "propertiespalette_line.h" +#include "propertiespalette_fill.h" #include "propertiespalette_shadow.h" #include "propertiespalette_shape.h" #include "propertiespalette_xyz.h" -#include "transparencypalette.h" #include "scribus.h" #include "scribusview.h" #include "selection.h" #include "undomanager.h" -#include "util_math.h" - PropertiesPalette::PropertiesPalette(QWidget *parent) : DockPanelBase("PropertiesPalette", "panel-frame-properties", parent) { undoManager = UndoManager::instance(); @@ -54,10 +53,6 @@ setObjectName(QString::fromLocal8Bit("PropertiesPalette")); setSizePolicy( QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum)); - QFont f(font()); - f.setPointSize(f.pointSize()-1); - setFont(f); - // XZY xyzPal = new PropertiesPalette_XYZ( this ); scXYZ = new SectionContainer("X, Y, &Z"); @@ -75,6 +70,12 @@ scShape->setWidget(shapePal); scShape->setIsCollapsed(true); + // Fill + fillPal = new PropertiesPalette_Fill(this); + scFill = new SectionContainer("&Fill"); + scFill->setWidget(fillPal); + scFill->setIsCollapsed(true); + // Line linePal = new PropertiesPalette_Line(this); scLine = new SectionContainer("&Line"); @@ -81,28 +82,22 @@ scLine->setWidget(linePal); scLine->setIsCollapsed(true); - // Color - colorPalette = new ColorPalette(this); - scColor = new SectionContainer("&Colors"); - scColor->setWidget(colorPalette); - scColor->setIsCollapsed(true); + // Attributes + attributesPal = new PropertiesPalette_Attributes(this); + scAttributes = new SectionContainer("&Attributes"); + scAttributes->setWidget(attributesPal); + scAttributes->setIsCollapsed(true); - // Transparency - transparencyPalette = new TransparencyPalette(this); - scTransparency = new SectionContainer("&Transparency"); - scTransparency->setWidget(transparencyPalette); - scTransparency->setIsCollapsed(true); - // Layout stack QVBoxLayout * lyt = new QVBoxLayout(); lyt->setContentsMargins(0, 0, 0, 0); lyt->setSpacing(0); lyt->addWidget(scXYZ); - lyt->addWidget(scShadow); lyt->addWidget(scShape); + lyt->addWidget(scFill); lyt->addWidget(scLine); - lyt->addWidget(scColor); - lyt->addWidget(scTransparency); + lyt->addWidget(scShadow); + lyt->addWidget(scAttributes); lyt->addStretch(1); QWidget * wdg = new QWidget(); @@ -112,10 +107,16 @@ languageChange(); enablePalettes(false); - connect(colorPalette, SIGNAL(NewSpecial(double,double,double,double,double,double,double,double,double,double)), this, SLOT(newSpGradient(double,double,double,double,double,double,double,double,double,double))); - connect(colorPalette, SIGNAL(editGradient(int)), this, SLOT(toggleGradientEdit(int))); - connect(transparencyPalette, SIGNAL(NewSpecial(double,double,double,double,double,double,double,double,double,double)), this, SLOT(newSpGradientM(double,double,double,double,double,double,double,double))); - connect(transparencyPalette, SIGNAL(editGradient()), this, SLOT(toggleGradientEditM())); + ColorPicker *colorPicker = WidgetManager::instance().colorPicker(); + if(colorPicker){ + connect(colorPicker, SIGNAL(meshToShape()), this, SLOT(meshGradientToShape())); + connect(colorPicker, SIGNAL(createNewMesh()), this, SLOT(createNewMeshGradient())); + connect(colorPicker, SIGNAL(resetMesh()), this, SLOT(resetMeshGradient())); + connect(colorPicker, SIGNAL(reset1Control()), this, SLOT(resetOneControlPoint())); + connect(colorPicker, SIGNAL(resetAllControl()), this, SLOT(resetAllControlPoints())); + connect(colorPicker, SIGNAL(snapToMGrid(bool)), this, SLOT(snapToPatchGrid(bool))); + connect(colorPicker, SIGNAL(removePatch()), this, SLOT(handleRemovePatch())); + } m_haveItem = false; @@ -125,7 +126,7 @@ { if (m_ScMW && !m_ScMW->scriptIsRunning()) { - if (m_haveDoc && m_haveItem && colorPalette->gradEditButton->isChecked()) + if (m_haveDoc && m_haveItem /*&& colorPalette->gradEditButton->isChecked()*/) { m_ScMW->view->requestMode(modeNormal); m_ScMW->view->RefreshGradient(m_item); @@ -151,10 +152,9 @@ this->shadowPal->setMainWindow(mw); this->shapePal->setMainWindow(mw); this->linePal->setMainWindow(mw); + this->fillPal->setMainWindow(mw); + this->attributesPal->setMainWindow(mw); - //connect(this->Cpal, SIGNAL(gradientChanged()), m_ScMW, SLOT(updtGradFill())); - //connect(this->Cpal, SIGNAL(strokeGradientChanged()), m_ScMW, SLOT(updtGradStroke())); - connect(this->transparencyPalette, SIGNAL(gradientChanged()), this, SLOT(handleGradientChanged())); connect(m_ScMW->appModeHelper, SIGNAL(AppModeChanged(int,int)), this, SLOT(AppModeChanged())); } @@ -172,10 +172,6 @@ m_doc = d; m_item = nullptr; setEnabled(!m_doc->drawAsPreview); - colorPalette->setDocument(m_doc); - colorPalette->setCurrentItem(nullptr); - transparencyPalette->setDocument(m_doc); - transparencyPalette->setCurrentItem(nullptr); m_unitRatio = m_doc->unitRatio(); m_unitIndex = m_doc->unitIndex(); @@ -186,9 +182,9 @@ shadowPal->setDoc(m_doc); shapePal->setDoc(m_doc); linePal->setDoc(m_doc); + fillPal->setDoc(m_doc); + attributesPal->setDoc(m_doc); - updateColorList(); - connect(m_doc->m_Selection, SIGNAL(selectionChanged()), this, SLOT(handleSelectionChanged())); connect(m_doc, SIGNAL(docChanged()), this, SLOT(handleSelectionChanged())); @@ -217,12 +213,11 @@ shapePal->unsetDoc(); linePal->unsetItem(); linePal->unsetDoc(); + fillPal->unsetItem(); + fillPal->unsetDoc(); + attributesPal->unsetItem(); + attributesPal->unsetDoc(); - colorPalette->setCurrentItem(nullptr); - colorPalette->setDocument(nullptr); - transparencyPalette->setCurrentItem(nullptr); - transparencyPalette->setDocument(nullptr); - m_haveItem = false; enablePalettes(false); } @@ -231,10 +226,9 @@ { m_haveItem = false; m_item = nullptr; - colorPalette->setCurrentItem(nullptr); - transparencyPalette->setCurrentItem(nullptr); shapePal->unsetItem(); linePal->unsetItem(); + fillPal->unsetItem(); handleSelectionChanged(); } @@ -256,10 +250,10 @@ { scXYZ->setEnabled(enable); scShape->setEnabled(enable); + scFill->setEnabled(enable); scLine->setEnabled(enable); - scColor->setEnabled(enable); - scTransparency->setEnabled(enable); scShadow->setEnabled(enable); + scAttributes->setEnabled(enable); } void PropertiesPalette::AppModeChanged() @@ -302,8 +296,6 @@ m_haveItem = false; m_item = item; - transparencyPalette->setCurrentItem(m_item); - setTextFlowMode(m_item->textFlowMode()); //CB replaces old emits from PageItem::emitAllToGUI() @@ -314,10 +306,9 @@ scXYZ->setEnabled(true); scShadow->setEnabled(true); scShape->setEnabled(true); - scLine->setEnabled(false); - scColor->setEnabled(false); - scTransparency->setEnabled(true); - + scLine->setEnabled(true); + scFill->setEnabled(true); + scAttributes->setEnabled(true); } m_haveItem = true; @@ -328,9 +319,9 @@ shadowPal->handleSelectionChanged(); shapePal->handleSelectionChanged(); linePal->handleSelectionChanged(); - colorPalette->handleSelectionChanged(); + fillPal->handleSelectionChanged(); + attributesPal->handleSelectionChanged(); } - if (m_item->isOSGFrame()) { scXYZ->setEnabled(true); @@ -337,8 +328,8 @@ scShadow->setEnabled(true); scShape->setEnabled(true); scLine->setEnabled(false); - scColor->setEnabled(true); - scTransparency->setEnabled(false); + scFill->setEnabled(true); + scAttributes->setEnabled(true); } if (m_item->asSymbol()) { @@ -346,8 +337,8 @@ scShadow->setEnabled(true); scShape->setEnabled(false); scLine->setEnabled(false); - scColor->setEnabled(false); - scTransparency->setEnabled(false); + scFill->setEnabled(false); + scAttributes->setEnabled(true); } } @@ -356,16 +347,15 @@ if (!m_haveDoc || !m_ScMW || m_ScMW->scriptIsRunning()) return; - enablePalettes(false); - PageItem* currItem = currentItemFromSelection(); if (m_doc->m_Selection->count() > 1) { scXYZ->setEnabled(true); + scShape->setEnabled(false); scShadow->setEnabled(true); scLine->setEnabled(true); - scColor->setEnabled(true); - scTransparency->setEnabled(true); + scFill->setEnabled(true); + scAttributes->setEnabled(true); } else { @@ -376,29 +366,37 @@ { case -1: m_haveItem = false; - colorPalette->showGradient(0); + scXYZ->setEnabled(false); + scShape->setEnabled(false); + scLine->setEnabled(false); + scFill->setEnabled(false); + scShadow->setEnabled(false); + scAttributes->setEnabled(false); break; case PageItem::ImageFrame: case PageItem::LatexFrame: + scXYZ->setEnabled(true); + scShadow->setEnabled(true); + scShape->setEnabled(true); + scLine->setEnabled(true); + scFill->setEnabled(true); + scAttributes->setEnabled(true); + break; case PageItem::OSGFrame: - if (currItem->isOSGFrame()) - { - scXYZ->setEnabled(true); - scShadow->setEnabled(true); - scShape->setEnabled(true); - scColor->setEnabled(true); - } - else - { - enablePalettes(true); - } + scXYZ->setEnabled(true); + scShadow->setEnabled(true); + scShape->setEnabled(true); + scLine->setEnabled(false); + scFill->setEnabled(true); + scAttributes->setEnabled(true); break; case PageItem::Line: scXYZ->setEnabled(true); scShadow->setEnabled(true); + scShape->setEnabled(false); scLine->setEnabled(true); - scColor->setEnabled(true); - scTransparency->setEnabled(true); + scFill->setEnabled(false); + scAttributes->setEnabled(true); break; case PageItem::Group: case PageItem::Symbol: @@ -412,7 +410,12 @@ case PageItem::PolyLine: case PageItem::Spiral: case PageItem::PathText: - enablePalettes(true); + scXYZ->setEnabled(true); + scShadow->setEnabled(true); + scShape->setEnabled(true); + scLine->setEnabled(true); + scFill->setEnabled(true); + scAttributes->setEnabled(true); break; } } @@ -424,6 +427,7 @@ { setCurrentItem(currItem); } + } void PropertiesPalette::unitChange() @@ -440,9 +444,8 @@ shadowPal->unitChange(); shapePal->unitChange(); linePal->unitChange(); + fillPal->unitChange(); - colorPalette->unitChange(oldRatio, m_unitRatio, m_doc->unitIndex()); - transparencyPalette->unitChange(oldRatio, m_unitRatio, m_doc->unitIndex()); m_haveItem = tmp; } @@ -458,211 +461,11 @@ } } -void PropertiesPalette::newSpGradient(double x1, double y1, double x2, double y2, double fx, double fy, double sg, double sk, double cx, double cy) -{ - if (!m_ScMW || m_ScMW->scriptIsRunning()) - return; - if ((m_haveDoc) && (m_haveItem)) - { - QRectF upRect; - UndoTransaction trans; - if (UndoManager::undoEnabled()) - trans = undoManager->beginTransaction(Um::Selection, Um::ILine, Um::GradPos + "p", "", Um::ILine); - if (m_ScMW->view->editStrokeGradient == 1) - { - m_item->setGradientStrokeStart(x1 / m_unitRatio, y1 / m_unitRatio); - m_item->setGradientStrokeEnd(x2 / m_unitRatio, y2 / m_unitRatio); - m_item->setGradientStrokeFocal(fx / m_unitRatio, fy / m_unitRatio); - m_item->setGradientStrokeScale(sg); - m_item->setGradientStrokeSkew(sk); - if (m_item->strokeGradientType() == 6) - { - m_item->setGradientStrokeFocal(m_item->gradientStrokeStartX(), m_item->gradientStrokeStartY()); - } - m_item->update(); - upRect = QRectF(m_item->gradientStrokeStart(), m_item->gradientStrokeEnd()); - double radEnd = distance(m_item->gradientStrokeEndX() - m_item->gradientStrokeStartX(), m_item->gradientStrokeEndY() - m_item->gradientStrokeStartY()); - double rotEnd = xy2Deg(m_item->gradientStrokeEndX() - m_item->gradientStrokeStartX(), m_item->gradientStrokeEndY() - m_item->gradientStrokeStartY()); - QTransform m; - m.translate(m_item->gradientStrokeStartX(), m_item->gradientStrokeStartY()); - m.rotate(rotEnd); - m.rotate(-90); - m.rotate(m_item->gradientStrokeSkew()); - m.translate(radEnd * m_item->gradientStrokeScale(), 0); - QPointF shP = m.map(QPointF(0,0)); - upRect = upRect.united(QRectF(shP, m_item->gradientStrokeEnd()).normalized()); - upRect = upRect.united(QRectF(shP, m_item->gradientStrokeStart()).normalized()); - upRect |= QRectF(shP, QPointF(0, 0)).normalized(); - upRect |= QRectF(shP, QPointF(m_item->width(), m_item->height())).normalized(); - } - else if (m_ScMW->view->editStrokeGradient == 3) - { - m_item->setGradientControl1(FPoint(x1 / m_unitRatio, y1 / m_unitRatio)); - m_item->setGradientControl2(FPoint(x2 / m_unitRatio, y2 / m_unitRatio)); - m_item->setGradientControl3(FPoint(fx / m_unitRatio, fy / m_unitRatio)); - m_item->setGradientControl4(FPoint(sg / m_unitRatio, sk / m_unitRatio)); - m_item->update(); - upRect = QRectF(QPointF(-m_item->width(), -m_item->height()), QPointF(m_item->width() * 2, m_item->height() * 2)).normalized(); - } - else if (m_ScMW->view->editStrokeGradient == 4) - { - m_item->setGradientControl1(FPoint(x1 / m_unitRatio, y1 / m_unitRatio)); - m_item->setGradientControl2(FPoint(x2 / m_unitRatio, y2 / m_unitRatio)); - m_item->setGradientControl3(FPoint(fx / m_unitRatio, fy / m_unitRatio)); - m_item->setGradientControl4(FPoint(sg / m_unitRatio, sk / m_unitRatio)); - m_item->setGradientControl5(FPoint(cx / m_unitRatio, cy / m_unitRatio)); - m_item->update(); - upRect = QRectF(QPointF(-m_item->width(), -m_item->height()), QPointF(m_item->width() * 2, m_item->height() * 2)).normalized(); - } - else - { - if (m_item->gradientType() == 13 && UndoManager::undoEnabled()) - { - SimpleState *ss= new SimpleState("Refresh"); - ss->set("UNDO_UPDATE_CONICAL"); - undoManager->action(m_item,ss); - } - m_item->setGradientStart(x1 / m_unitRatio, y1 / m_unitRatio); - m_item->setGradientEnd(x2 / m_unitRatio, y2 / m_unitRatio); - m_item->setGradientFocal(fx / m_unitRatio, fy / m_unitRatio); - m_item->setGradientScale(sg); - m_item->setGradientSkew(sk); - if (m_item->strokeGradientType() == 6) - { - m_item->setGradientFocal(m_item->gradientStartX(), m_item->gradientStartY()); - } - if (m_item->gradientType() == 13 && UndoManager::undoEnabled()) - { - m_item->createConicalMesh(); - SimpleState *ss= new SimpleState("Refresh"); - ss->set("REDO_UPDATE_CONICAL"); - undoManager->action(m_item,ss); - } - m_item->update(); - upRect = QRectF(m_item->gradientStart(), m_item->gradientEnd()); - double radEnd = distance(m_item->gradientEndX() - m_item->gradientStartX(), m_item->gradientEndY() - m_item->gradientStartY()); - double rotEnd = xy2Deg(m_item->gradientEndX() - m_item->gradientStartX(), m_item->gradientEndY() - m_item->gradientStartY()); - QTransform m; - m.translate(m_item->gradientStartX(), m_item->gradientStartY()); - m.rotate(rotEnd); - m.rotate(-90); - m.rotate(m_item->gradientSkew()); - m.translate(radEnd * m_item->gradientScale(), 0); - QPointF shP = m.map(QPointF(0,0)); - upRect |= QRectF(shP, m_item->gradientEnd()).normalized(); - upRect |= QRectF(shP, m_item->gradientStart()).normalized(); - upRect |= QRectF(shP, QPointF(0, 0)).normalized(); - upRect |= QRectF(shP, QPointF(m_item->width(), m_item->height())).normalized(); - } - if (trans) - trans.commit(); - upRect.translate(m_item->xPos(), m_item->yPos()); - m_doc->regionsChanged()->update(upRect.adjusted(-10.0, -10.0, 10.0, 10.0)); - m_doc->changed(); - m_doc->changedPagePreview(); - } -} - -void PropertiesPalette::toggleGradientEdit(int stroke) -{ - if (!m_ScMW || m_ScMW->scriptIsRunning()) - return; - if ((m_haveDoc) && (m_haveItem)) - { - m_ScMW->view->editStrokeGradient = stroke; - if (stroke == 1) - { - if (colorPalette->gradEditButtonStroke->isChecked()) - m_ScMW->view->requestMode(modeEditGradientVectors); - else - m_ScMW->view->requestMode(modeNormal); - } - else - { - if ((colorPalette->gradEditButton->isChecked()) || (colorPalette->editMeshColors->isChecked())) - { - if ((stroke == 5) || (stroke == 6) || (stroke == 7)) - m_ScMW->view->requestMode(modeEditMeshGradient); - else if ((stroke == 8) || (stroke == 9) || (stroke == 10) || (stroke == 11)) - m_ScMW->view->requestMode(modeEditMeshPatch); - else - m_ScMW->view->requestMode(modeEditGradientVectors); - } - else - m_ScMW->view->requestMode(modeNormal); - } - m_ScMW->view->RefreshGradient(m_item); - } -} - -void PropertiesPalette::newSpGradientM(double x1, double y1, double x2, double y2, double fx, double fy, double sg, double sk) -{ - if (!m_ScMW || m_ScMW->scriptIsRunning()) - return; - if ((m_haveDoc) && (m_haveItem)) - { - QRectF upRect; - UndoTransaction trans; - if (UndoManager::undoEnabled()) - trans = undoManager->beginTransaction(Um::Selection, Um::ILine, Um::GradPos + "o", "", Um::ILine); - m_item->setGradientMaskStart(x1 / m_unitRatio, y1 / m_unitRatio); - m_item->setGradientMaskEnd(x2 / m_unitRatio, y2 / m_unitRatio); - m_item->setGradientMaskFocal(fx / m_unitRatio, fy / m_unitRatio); - m_item->setGradientMaskScale(sg); - m_item->setGradientMaskSkew(sk); - if ((m_item->GrMask == GradMask_Linear) || (m_item->GrMask == GradMask_LinearLumAlpha)) - { - m_item->setGradientMaskFocal(m_item->GrMaskStartX, m_item->GrMaskStartY); - } - m_item->update(); - if (trans) - { - trans.commit(); - } - upRect = QRectF(m_item->gradientMaskStart(), m_item->gradientMaskEnd()); - double radEnd = distance(m_item->GrMaskEndX - m_item->GrMaskStartX, m_item->GrMaskEndY - m_item->GrMaskStartY); - double rotEnd = xy2Deg(m_item->GrMaskEndX - m_item->GrMaskStartX, m_item->GrMaskEndY - m_item->GrMaskStartY); - QTransform m; - m.translate(m_item->GrMaskStartX, m_item->GrMaskStartY); - m.rotate(rotEnd); - m.rotate(-90); - m.rotate(m_item->GrMaskSkew); - m.translate(radEnd * m_item->GrMaskScale, 0); - QPointF shP = m.map(QPointF(0,0)); - upRect |= QRectF(shP, m_item->gradientMaskEnd()).normalized(); - upRect |= QRectF(shP, m_item->gradientMaskStart()).normalized(); - upRect |= QRectF(shP, QPointF(0, 0)).normalized(); - upRect |= QRectF(shP, QPointF(m_item->width(), m_item->height())).normalized(); - upRect.translate(m_item->xPos(), m_item->yPos()); - m_doc->regionsChanged()->update(upRect.adjusted(-10.0, -10.0, 10.0, 10.0)); - m_doc->changed(); - m_doc->changedPagePreview(); - } -} - -void PropertiesPalette::toggleGradientEditM() -{ - if (!m_ScMW || m_ScMW->scriptIsRunning()) - return; - if ((m_haveDoc) && (m_haveItem)) - { - m_ScMW->view->editStrokeGradient = 2; - if (transparencyPalette->gradEditButton->isChecked()) - m_ScMW->view->requestMode(modeEditGradientVectors); - else - m_ScMW->view->requestMode(modeNormal); - } -} - void PropertiesPalette::updateColorList() { if (!m_haveDoc || !m_ScMW || m_ScMW->scriptIsRunning()) return; - colorPalette->updateColorList(); - transparencyPalette->updateColorList(); - shadowPal->updateColorList(); - assert (m_doc->PageColors.document()); } @@ -686,78 +489,306 @@ setWindowTitle( tr("Properties")); scXYZ->setText(tr("X, Y, &Z")); - scShadow->setText(tr("Drop Shadow")); + scShadow->setText(tr("&Drop Shadow")); scShape->setText(tr("&Shape")); scLine->setText(tr("&Line")); - scColor->setText(tr("&Colors")); - scTransparency->setText(tr("&Transparency")); + scFill->setText(tr("&Fill")); + scAttributes->setText(tr("&Attributes")); xyzPal->languageChange(); shadowPal->languageChange(); shapePal->languageChange(); - colorPalette->languageChange(); linePal->languageChange(); + fillPal->languageChange(); + attributesPal->languageChange(); } void PropertiesPalette::setGradientEditMode(bool on) { - colorPalette->gradEditButton->setChecked(on); + WidgetManager::instance().colorPicker()->setGradientEditPropertiesEnabled(on); } +void PropertiesPalette::setLocked(bool isLocked) +{ + shapePal->setLocked(isLocked); +} + +void PropertiesPalette::handleShapeEdit() +{ + if (!m_ScMW || m_ScMW->scriptIsRunning()) + return; + if ((m_haveDoc) && (m_haveItem)) + shapePal->setRoundRectEnabled(false); +} + +/* ********************************************************************************* * + * + * Mesh Gradient Methods + * + * ********************************************************************************* */ + void PropertiesPalette::endPatchAdd() { - colorPalette->endPatchAdd(); + WidgetManager::instance().colorPicker()->endPatchAdd(); } -void PropertiesPalette::updateColorSpecialGradient() +void PropertiesPalette::meshGradientToShape() { - if (!m_haveDoc) + + if (!m_doc || !m_item) return; - if(m_doc->m_Selection->isEmpty()) + + m_item->meshToShape(); + m_item->update(); + m_doc->regionsChanged()->update(QRect()); + +} + +void PropertiesPalette::createNewMeshGradient() +{ + if (!m_doc || !m_item) return; - PageItem* currItem = m_doc->m_Selection->itemAt(0); - if (currItem) + InsertTable* dia = new InsertTable(this, 255, 255); + dia->setWindowTitle( tr( "Create Mesh" ) ); + if (dia->exec()) { - if (m_ScMW->view->editStrokeGradient == 0) - colorPalette->setSpecialGradient(currItem->GrStartX, currItem->GrStartY, currItem->GrEndX, currItem->GrEndY, currItem->GrFocalX, currItem->GrFocalY, currItem->GrScale, currItem->GrSkew, 0, 0); - else if (m_ScMW->view->editStrokeGradient == 1) - colorPalette->setSpecialGradient(currItem->GrStrokeStartX, currItem->GrStrokeStartY, currItem->GrStrokeEndX, currItem->GrStrokeEndY, currItem->GrStrokeFocalX, currItem->GrStrokeFocalY, currItem->GrStrokeScale, currItem->GrStrokeSkew, 0, 0); - else if (m_ScMW->view->editStrokeGradient == 3) - colorPalette->setSpecialGradient(currItem->GrControl1.x(), currItem->GrControl1.y(), currItem->GrControl2.x(), currItem->GrControl2.y(), currItem->GrControl3.x(), currItem->GrControl3.y(), currItem->GrControl4.x(), currItem->GrControl4.y(), 0, 0); - else if (m_ScMW->view->editStrokeGradient == 4) - colorPalette->setSpecialGradient(currItem->GrControl1.x(), currItem->GrControl1.y(), currItem->GrControl2.x(), currItem->GrControl2.y(), currItem->GrControl3.x(), currItem->GrControl3.y(), currItem->GrControl4.x(), currItem->GrControl4.y(), currItem->GrControl5.x(), currItem->GrControl5.y()); - else if ((m_ScMW->view->editStrokeGradient == 5) || (m_ScMW->view->editStrokeGradient == 6)) - colorPalette->setMeshPoint(); - else if (m_ScMW->view->editStrokeGradient == 8) - colorPalette->setMeshPatchPoint(); - else if (m_ScMW->view->editStrokeGradient == 9) - colorPalette->setMeshPatch(); - else if (currItem->isGroup()) - transparencyPalette->setSpecialGradient(currItem->GrMaskStartX, currItem->GrMaskStartY, currItem->GrMaskEndX, currItem->GrMaskEndY, currItem->GrMaskFocalX, currItem->GrMaskFocalY, currItem->GrMaskScale, currItem->GrMaskSkew); + m_item->createGradientMesh(dia->Rows->value(), dia->Cols->value()); + m_item->update(); + m_doc->regionsChanged()->update(QRect()); } + delete dia; } -void PropertiesPalette::setLocked(bool isLocked) +void PropertiesPalette::resetMeshGradient() { - shapePal->setLocked(isLocked); + if (!m_doc || !m_item) + return; + + m_item->resetGradientMesh(); + m_item->update(); + m_doc->regionsChanged()->update(QRect()); } -void PropertiesPalette::handleShapeEdit() +void PropertiesPalette::resetOneControlPoint() { - if (!m_ScMW || m_ScMW->scriptIsRunning()) + if (!m_doc || !m_item) return; - if ((m_haveDoc) && (m_haveItem)) - shapePal->setRoundRectEnabled(false); + + int grow = m_item->selectedMeshPointX; + int gcol = m_item->selectedMeshPointY; + int cont = m_item->selectedMeshControlPoint; + MeshPoint tmp; + if (m_item->gradientType() == Gradient_PatchMesh) + { + if ((grow == -1) || (gcol == 0)) + return; + ScOldNewState<MeshPoint> *ss = nullptr; + if (UndoManager::undoEnabled()) + { + ss = new ScOldNewState<MeshPoint>(Um::GradPos); + ss->set("MOVE_MESH_PATCH"); + ss->set("ARRAY", false); + ss->set("X", grow); + ss->set("Y", gcol); + } + switch (gcol) + { + case 1: + tmp = m_item->meshGradientPatches[grow].TL; + if (cont == 2) + tmp.controlBottom = tmp.gridPoint; + if (cont == 4) + tmp.controlRight = tmp.gridPoint; + if (UndoManager::undoEnabled()) + ss->setStates(m_item->meshGradientPatches[grow].TL, tmp); + m_item->meshGradientPatches[grow].TL = tmp; + break; + case 2: + tmp = m_item->meshGradientPatches[grow].TR; + if (cont == 2) + tmp.controlBottom = tmp.gridPoint; + if (cont == 3) + tmp.controlLeft = tmp.gridPoint; + if (UndoManager::undoEnabled()) + ss->setStates(m_item->meshGradientPatches[grow].TR, tmp); + m_item->meshGradientPatches[grow].TR = tmp; + break; + case 3: + tmp = m_item->meshGradientPatches[grow].BR; + if (cont == 1) + tmp.controlTop = tmp.gridPoint; + if (cont == 3) + tmp.controlLeft = tmp.gridPoint; + if (UndoManager::undoEnabled()) + ss->setStates(m_item->meshGradientPatches[grow].BR, tmp); + m_item->meshGradientPatches[grow].BR = tmp; + break; + case 4: + tmp = m_item->meshGradientPatches[grow].BL; + if (cont == 1) + tmp.controlTop = tmp.gridPoint; + if (cont == 4) + tmp.controlRight = tmp.gridPoint; + if (UndoManager::undoEnabled()) + ss->setStates(m_item->meshGradientPatches[grow].BL, tmp); + m_item->meshGradientPatches[grow].BL = tmp; + break; + } + if (UndoManager::undoEnabled()) + undoManager->action(m_item,ss); + } + else // if (m_item->gradientType() == Gradient_Mesh) + { + if ((grow == -1) || (gcol == -1)) + return; + + tmp = m_item->meshGradientArray[grow][gcol]; + if (cont == 1) + tmp.controlTop = tmp.gridPoint; + else if (cont == 2) + tmp.controlBottom = tmp.gridPoint; + else if (cont == 3) + tmp.controlLeft = tmp.gridPoint; + else if (cont == 4) + tmp.controlRight = tmp.gridPoint; + + if (UndoManager::undoEnabled()) + { + auto *ss = new ScOldNewState<MeshPoint>(Um::GradPos); + ss->set("MOVE_MESH_PATCH"); + ss->set("ARRAY", true); + ss->set("X", grow); + ss->set("Y", gcol); + ss->setStates(m_item->meshGradientArray[grow][gcol], tmp); + undoManager->action(m_item,ss); + } + m_item->meshGradientArray[grow][gcol] = tmp; + } + m_item->update(); + m_doc->regionsChanged()->update(QRect()); } -void PropertiesPalette::handleGradientChanged() +void PropertiesPalette::resetAllControlPoints() { - if (!m_ScMW || m_ScMW->scriptIsRunning()) + if (!m_doc || !m_item) return; - if ((m_haveDoc) && (m_haveItem)) + + int grow = m_item->selectedMeshPointX; + int gcol = m_item->selectedMeshPointY; + MeshPoint tmp; + if (m_item->gradientType() == Gradient_PatchMesh) { - VGradient vg(transparencyPalette->gradEdit->gradient()); - m_doc->itemSelection_SetMaskGradient(vg); + if ((grow == -1) || (gcol == 0)) + return; + ScOldNewState<MeshPoint> *ss = nullptr; + if (UndoManager::undoEnabled()) + { + ss = new ScOldNewState<MeshPoint>(Um::GradPos); + ss->set("MOVE_MESH_PATCH"); + ss->set("ARRAY", false); + ss->set("X", grow); + ss->set("Y", gcol); + } + switch (gcol) + { + case 1: + tmp = m_item->meshGradientPatches[grow].TL; + tmp.controlTop = tmp.gridPoint; + tmp.controlLeft = tmp.gridPoint; + tmp.controlRight = tmp.gridPoint; + tmp.controlBottom = tmp.gridPoint; + if (UndoManager::undoEnabled()) + ss->setStates(m_item->meshGradientPatches[grow].TL, tmp); + m_item->meshGradientPatches[grow].TL = tmp; + break; + case 2: + tmp = m_item->meshGradientPatches[grow].TR; + tmp.controlTop = tmp.gridPoint; + tmp.controlLeft = tmp.gridPoint; + tmp.controlRight = tmp.gridPoint; + tmp.controlBottom = tmp.gridPoint; + if (UndoManager::undoEnabled()) + ss->setStates(m_item->meshGradientPatches[grow].TR, tmp); + m_item->meshGradientPatches[grow].TR = tmp; + break; + case 3: + tmp = m_item->meshGradientPatches[grow].BR; + tmp.controlTop = tmp.gridPoint; + tmp.controlLeft = tmp.gridPoint; + tmp.controlRight = tmp.gridPoint; + tmp.controlBottom = tmp.gridPoint; + if (UndoManager::undoEnabled()) + ss->setStates(m_item->meshGradientPatches[grow].BR, tmp); + m_item->meshGradientPatches[grow].BR = tmp; + break; + case 4: + tmp = m_item->meshGradientPatches[grow].BL; + tmp.controlTop = tmp.gridPoint; + tmp.controlLeft = tmp.gridPoint; + tmp.controlRight = tmp.gridPoint; + tmp.controlBottom = tmp.gridPoint; + if (UndoManager::undoEnabled()) + ss->setStates(m_item->meshGradientPatches[grow].BL, tmp); + m_item->meshGradientPatches[grow].BL = tmp; + break; + } + if (UndoManager::undoEnabled()) + undoManager->action(m_item,ss); } + else //if (m_item->gradientType() == Gradient_Mesh) + { + if ((grow == -1) || (gcol == -1)) + return; + tmp = m_item->meshGradientArray[grow][gcol]; + tmp.controlTop = tmp.gridPoint; + tmp.controlLeft = tmp.gridPoint; + tmp.controlRight = tmp.gridPoint; + tmp.controlBottom = tmp.gridPoint; + if (UndoManager::undoEnabled()) + { + auto *ss = new ScOldNewState<MeshPoint>(Um::GradPos); + ss->set("MOVE_MESH_PATCH"); + ss->set("ARRAY", true); + ss->set("X", grow); + ss->set("Y", gcol); + ss->setStates(m_item->meshGradientArray[grow][gcol], tmp); + undoManager->action(m_item,ss); + } + m_item->meshGradientArray[grow][gcol] = tmp; + } + m_item->update(); + m_doc->regionsChanged()->update(QRect()); } + +void PropertiesPalette::snapToPatchGrid(bool val) +{ + if (!m_item) + return; + + m_item->setSnapToPatchGrid(val); +} + +void PropertiesPalette::handleRemovePatch() +{ + if (!m_doc || !m_item) + return; + + if ((m_item->selectedMeshPointX > -1) && (m_item->meshGradientPatches.count() > 1)) + { + if (UndoManager::undoEnabled()) + { + ScItemState<meshGradientPatch> *ss = new ScItemState<meshGradientPatch>(Um::RemoveMeshPatch,"",Um::ILine); + ss->set("REMOVE_MESH_PATCH"); + ss->setItem(m_item->meshGradientPatches.takeAt(m_item->selectedMeshPointX)); + ss->set("POS", m_item->selectedMeshPointX); + undoManager->action(m_item,ss); + } + m_item->selectedMeshPointX = -1; + + WidgetManager::instance().colorPicker()->enableButtonRemovePatch( (m_item->selectedMeshPointX > -1) && (m_item->meshGradientPatches.count() > 1) ); + + m_item->update(); + m_doc->regionsChanged()->update(QRect()); + } +} Index: scribus/ui/propertiespalette.h =================================================================== --- scribus/ui/propertiespalette.h (Revision 26070) +++ scribus/ui/propertiespalette.h (Arbeitskopie) @@ -36,7 +36,9 @@ class ColorCombo; class ColorPalette; class NameWidget; +class PropertiesPalette_Attributes; class PropertiesPalette_Group; +class PropertiesPalette_Fill; class PropertiesPalette_Line; class PropertiesPalette_Shadow; class PropertiesPalette_Shape; @@ -57,7 +59,7 @@ ~PropertiesPalette() {} void endPatchAdd(); - void updateColorSpecialGradient(); +// void updateColorSpecialGradient(); void updateColorList(); void setGradientEditMode(bool); void setTextFlowMode(PageItem::TextFlowMode mode); @@ -69,11 +71,11 @@ // committed PropertiesPalette_Line* linePal {nullptr}; + PropertiesPalette_Fill* fillPal {nullptr}; PropertiesPalette_Shadow* shadowPal {nullptr}; PropertiesPalette_Shape* shapePal {nullptr}; PropertiesPalette_XYZ* xyzPal {nullptr}; - ColorPalette *colorPalette {nullptr}; - TransparencyPalette *transparencyPalette {nullptr}; + PropertiesPalette_Attributes* attributesPal {nullptr}; protected: void changeEvent(QEvent *e) override; @@ -101,22 +103,26 @@ private slots: - void handleGradientChanged(); void handleNewShape(int frameType); - void newSpGradient(double x1, double y1, double x2, double y2, double fx, double fy, double sg, double sk, double cx, double cy); - void toggleGradientEdit(int); - void newSpGradientM(double x1, double y1, double x2, double y2, double fx, double fy, double sg, double sk); - void toggleGradientEditM(); void handleShapeEdit(); + // Gradient Properties + void meshGradientToShape(); + void createNewMeshGradient(); + void resetMeshGradient(); + void resetOneControlPoint(); + void resetAllControlPoints(); + void snapToPatchGrid(bool val); + void handleRemovePatch(); + protected: SectionContainer * scXYZ {nullptr}; SectionContainer * scShape {nullptr}; SectionContainer * scLine {nullptr}; - SectionContainer * scColor {nullptr}; - SectionContainer * scTransparency {nullptr}; + SectionContainer * scFill {nullptr}; SectionContainer * scShadow {nullptr}; + SectionContainer * scAttributes {nullptr}; bool m_haveDoc {false}; bool m_haveItem {false}; Index: scribus/ui/propertiespalette_attributes.cpp =================================================================== --- scribus/ui/propertiespalette_attributes.cpp (nicht existent) +++ scribus/ui/propertiespalette_attributes.cpp (Arbeitskopie) @@ -0,0 +1,243 @@ +#include "propertiespalette_attributes.h" +#include "ui_propertiespalette_attributes.h" + +#include "commonstrings.h" +#include "iconmanager.h" +#include "pageitem.h" +#include "scraction.h" +#include "scribus.h" +#include "scribusapp.h" +#include "scribusdoc.h" +#include "selection.h" + +PropertiesPalette_Attributes::PropertiesPalette_Attributes(QWidget *parent) : + QWidget(parent) +{ + setupUi(this); + setSizePolicy( QSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum)); + + nameEdit->setFocusPolicy(Qt::ClickFocus); + + iconSetChange(); + languageChange(); + + connect(ScQApp, SIGNAL(iconSetChanged()), this, SLOT(iconSetChange())); + connect(ScQApp, SIGNAL(labelVisibilityChanged(bool)), this, SLOT(toggleLabelVisibility(bool))); + + + connect(nameEdit , SIGNAL(Leaved()) , this, SLOT(handleNewName())); + connect(noPrint , SIGNAL(clicked()), this, SLOT(handlePrint())); + +} + +void PropertiesPalette_Attributes::setMainWindow(ScribusMainWindow* mw) +{ + m_ScMW = mw; +} + +void PropertiesPalette_Attributes::setDoc(ScribusDoc *d) +{ + if((d == (ScribusDoc*) m_doc) || (m_ScMW && m_ScMW->scriptIsRunning())) + return; + + if (m_doc) + { + disconnect(m_doc->m_Selection, SIGNAL(selectionChanged()), this, SLOT(handleSelectionChanged())); + disconnect(m_doc , SIGNAL(docChanged()) , this, SLOT(handleSelectionChanged())); + } + + m_doc = d; + m_item = nullptr; + + m_haveDoc = true; + m_haveItem = false; + + connect(m_doc->m_Selection, SIGNAL(selectionChanged()), this, SLOT(handleSelectionChanged())); + connect(m_doc , SIGNAL(docChanged()) , this, SLOT(handleSelectionChanged())); +} + +void PropertiesPalette_Attributes::unsetDoc() +{ + if (m_doc) + { + disconnect(m_doc->m_Selection, SIGNAL(selectionChanged()), this, SLOT(handleSelectionChanged())); + disconnect(m_doc , SIGNAL(docChanged()) , this, SLOT(handleSelectionChanged())); + } + + m_haveDoc = false; + m_haveItem = false; + m_doc = nullptr; + m_item = nullptr; + nameEdit->clear(); + + setEnabled(false); +} + +void PropertiesPalette_Attributes::unsetItem() +{ + m_haveItem = false; + m_item = nullptr; + handleSelectionChanged(); +} + + +PageItem* PropertiesPalette_Attributes::currentItemFromSelection() +{ + PageItem *currentItem = nullptr; + + if (m_doc) + { + if (m_doc->m_Selection->count() > 0) + currentItem = m_doc->m_Selection->itemAt(0); + } + + return currentItem; +} + +void PropertiesPalette_Attributes::setCurrentItem(PageItem *item) +{ + if (!m_ScMW || m_ScMW->scriptIsRunning()) + return; + + if (!m_doc) + setDoc(item->doc()); + + disconnect(nameEdit, SIGNAL(Leaved()), this, SLOT(handleNewName())); + disconnect(noPrint, SIGNAL(clicked()), this, SLOT(handlePrint())); + + m_haveItem = false; + m_item = item; + + nameEdit->setText(m_item->itemName()); + noPrint->setChecked(!item->printEnabled()); + + connect(nameEdit, SIGNAL(Leaved()), this, SLOT(handleNewName())); + connect(noPrint , SIGNAL(clicked()), this, SLOT(handlePrint()), Qt::UniqueConnection); + + m_haveItem = true; + +} + +void PropertiesPalette_Attributes::handleSelectionChanged() +{ + if (!m_haveDoc || !m_ScMW || m_ScMW->scriptIsRunning()) + return; + +// nameEdit->setEnabled(m_doc->m_Selection->count() == 1); + + PageItem* currItem = currentItemFromSelection(); + if (m_doc->m_Selection->count() > 1) + { + nameEdit->setEnabled(false); + + setEnabled(true); + } + else + { + int itemType = currItem ? (int) currItem->itemType() : -1; + + m_haveItem = (itemType!=-1); + + nameEdit->setEnabled(true); + + setEnabled(true); + + } + if (currItem) + { + setCurrentItem(currItem); + } + updateGeometry(); +} + +void PropertiesPalette_Attributes::toggleLabelVisibility(bool visibility) +{ + formWidget->setLabelVisibility(visibility); + labelExport->setLabelVisibility(visibility); +} + +void PropertiesPalette_Attributes::showPrintingEnabled(bool isPrintingEnabled) +{ + noPrint->setChecked(!isPrintingEnabled); +} + + +void PropertiesPalette_Attributes::handlePrint() +{ + if (!m_haveDoc || !m_haveItem || !m_ScMW || m_ScMW->scriptIsRunning()) + return; + m_ScMW->scrActions["itemPrintingEnabled"]->toggle(); +} + +void PropertiesPalette_Attributes::handleNewName() +{ + if (m_ScMW->scriptIsRunning() || !m_haveDoc || !m_haveItem) + return; + QString NameOld = m_item->itemName(); + QString NameNew = nameEdit->text(); + if (NameNew.isEmpty()) + { + nameEdit->setText(NameOld); + return; + } + bool found = false; + QList<PageItem*> allItems; + for (int a = 0; a < m_doc->Items->count(); ++a) + { + PageItem *currItem = m_doc->Items->at(a); + if (currItem->isGroup()) + allItems = currItem->getAllChildren(); + else + allItems.append(currItem); + for (int ii = 0; ii < allItems.count(); ii++) + { + PageItem* item = allItems.at(ii); + if ((NameNew == item->itemName()) && (item != m_item)) + { + found = true; + break; + } + } + allItems.clear(); + } + if (found) + { + ScMessageBox::warning(this, CommonStrings::trWarning, "<qt>"+ tr("Name \"%1\" isn't unique.<br/>Please choose another.").arg(NameNew)+"</qt>"); + nameEdit->setText(NameOld); + nameEdit->setFocus(); + } + else + { + if (m_item->itemName() != nameEdit->text()) + { + m_item->setItemName(nameEdit->text()); + m_doc->changed(); + } + } +} + +void PropertiesPalette_Attributes::changeEvent(QEvent *e) +{ + if (e->type() == QEvent::LanguageChange) + { + languageChange(); + } + else + QWidget::changeEvent(e); +} + +void PropertiesPalette_Attributes::iconSetChange() +{ + IconManager& im = IconManager::instance(); + + QIcon a2; + a2.addPixmap(im.loadPixmap("NoPrint.png"), QIcon::Normal, QIcon::On); + a2.addPixmap(im.loadPixmap("16/document-print.png"), QIcon::Normal, QIcon::Off); + noPrint->setIcon(a2); + +} + +void PropertiesPalette_Attributes::languageChange() +{ + retranslateUi(this); +} Index: scribus/ui/propertiespalette_attributes.h =================================================================== --- scribus/ui/propertiespalette_attributes.h (nicht existent) +++ scribus/ui/propertiespalette_attributes.h (Arbeitskopie) @@ -0,0 +1,57 @@ +#ifndef PROPERTIESPALETTE_ATTRIBUTES_H +#define PROPERTIESPALETTE_ATTRIBUTES_H + +#include <QWidget> +#include "ui_propertiespalette_attributes.h" +#include "scribusapi.h" +#include "scguardedptr.h" + +class BasePointWidget; +class NameWidget; +class PageItem; +class ScribusDoc; +class Selection; +class ScribusMainWindow; + +class SCRIBUS_API PropertiesPalette_Attributes : public QWidget, Ui::PropertiesPalette_Attributes +{ + Q_OBJECT + +public: + explicit PropertiesPalette_Attributes(QWidget *parent = nullptr); + ~PropertiesPalette_Attributes() {}; + +private: + PageItem* currentItemFromSelection(); + +public slots: + void setMainWindow(ScribusMainWindow *mw); + + void setDoc(ScribusDoc *d); + void setCurrentItem(PageItem *item); + void unsetDoc(); + void unsetItem(); + + void iconSetChange(); + void languageChange(); + void toggleLabelVisibility(bool visibility); + + void showPrintingEnabled(bool isPrintingEnabled); + + void handleSelectionChanged(); + +private slots: + void handlePrint(); + void handleNewName(); + +protected: + bool m_haveDoc {false}; + bool m_haveItem {false}; + PageItem *m_item {nullptr}; + ScribusMainWindow* m_ScMW {nullptr}; + ScGuardedPtr<ScribusDoc> m_doc; + + void changeEvent(QEvent *e) override; +}; + +#endif // PROPERTIESPALETTE_ATTRIBUTES_H Index: scribus/ui/propertiespalette_attributes.ui =================================================================== --- scribus/ui/propertiespalette_attributes.ui (nicht existent) +++ scribus/ui/propertiespalette_attributes.ui (Arbeitskopie) @@ -0,0 +1,166 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>PropertiesPalette_Attributes</class> + <widget class="QWidget" name="PropertiesPalette_Attributes"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>288</width> + <height>65</height> + </rect> + </property> + <property name="windowTitle"> + <string>Form</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <property name="spacing"> + <number>4</number> + </property> + <property name="leftMargin"> + <number>8</number> + </property> + <property name="topMargin"> + <number>8</number> + </property> + <property name="rightMargin"> + <number>8</number> + </property> + <property name="bottomMargin"> + <number>8</number> + </property> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_16"> + <property name="spacing"> + <number>16</number> + </property> + <item> + <widget class="FormWidget" name="formWidget"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="label" stdset="0"> + <string/> + </property> + <property name="font"> + <font> + <pointsize>8</pointsize> + </font> + </property> + <property name="preserveLabelSpace"> + <bool>true</bool> + </property> + <layout class="QHBoxLayout" name="horizontalLayout"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="QLabel" name="labelName"> + <property name="text"> + <string>Name:</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item> + <widget class="NameWidget" name="nameEdit"> + <property name="focusPolicy"> + <enum>Qt::ClickFocus</enum> + </property> + <property name="toolTip"> + <string>Name of selected object</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="FormWidget" name="labelExport"> + <property name="label" stdset="0"> + <string>Export</string> + </property> + <property name="font"> + <font> + <pointsize>8</pointsize> + </font> + </property> + <property name="space"> + <number>2</number> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_15"> + <property name="spacing"> + <number>4</number> + </property> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="QToolButton" name="noPrint"> + <property name="toolTip"> + <string>Enable or disable exporting of the object</string> + </property> + <property name="checkable"> + <bool>true</bool> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + </layout> + </widget> + <customwidgets> + <customwidget> + <class>FormWidget</class> + <extends>QWidget</extends> + <header>ui/widgets/form_widget.h</header> + <container>1</container> + </customwidget> + <customwidget> + <class>NameWidget</class> + <extends>QLineEdit</extends> + <header>ui/propertiespalette_utils.h</header> + </customwidget> + </customwidgets> + <resources/> + <connections/> +</ui> Index: scribus/ui/propertiespalette_fill.cpp =================================================================== --- scribus/ui/propertiespalette_fill.cpp (nicht existent) +++ scribus/ui/propertiespalette_fill.cpp (Arbeitskopie) @@ -0,0 +1,760 @@ +#include "propertiespalette_fill.h" + +#include "iconmanager.h" +#include "scribus.h" +#include "scribusapp.h" +#include "scribusdoc.h" +#include "scribusview.h" +#include "selection.h" +#include "undomanager.h" +#include "ui/colorpicker/colorpicker.h" + +PropertiesPalette_Fill::PropertiesPalette_Fill(QWidget *parent) : + QWidget(parent) +{ + setupUi(this); + + setSizePolicy( QSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum)); + + buttonFillColor->setContext(Context::Fill); + buttonFillColor->setMenuContextType(ColorButton::Floating); + buttonFillMask->setContext(Context::FillMask); + buttonFillMask->setMenuContextType(ColorButton::Floating); + + undoManager = UndoManager::instance(); + + iconSetChange(); + languageChange(); + + connect(ScQApp, SIGNAL(iconSetChanged()), this, SLOT(iconSetChange())); + connect(ScQApp, SIGNAL(labelVisibilityChanged(bool)), this, SLOT(toggleLabelVisibility(bool))); + + connect(evenOdd, SIGNAL(clicked()), this, SLOT(handleFillRule())); + connect(nonZero, SIGNAL(clicked()), this, SLOT(handleFillRule())); + connect(buttonFillColor, SIGNAL(changed()), this, SLOT(handleFillColor())); + connect(buttonFillColor, SIGNAL(gradientVectorChanged()), this, SLOT(handleFillColorVector())); + connect(buttonFillColor, SIGNAL(gradientMeshChanged()), this, SLOT(handleFillColorMesh())); + connect(buttonFillMask, SIGNAL(changed()), this, SLOT(handleFillMask())); + connect(buttonFillMask, SIGNAL(gradientVectorChanged()), this, SLOT(handleFillMaskVector())); + connect(comboBlendmode, SIGNAL(currentIndexChanged(int)), this, SLOT(handleFillBlendmode(int))); + +} + +void PropertiesPalette_Fill::updateColorList() +{ + if (!m_haveDoc || !m_ScMW || m_ScMW->scriptIsRunning()) + return; +} + +void PropertiesPalette_Fill::setMainWindow(ScribusMainWindow* mw) +{ + m_ScMW = mw; + + connect(m_ScMW, SIGNAL(UpdateRequest(int)), this , SLOT(handleUpdateRequest(int))); +} + +void PropertiesPalette_Fill::setDoc(ScribusDoc *d) +{ + if((d == (ScribusDoc*) m_doc) || (m_ScMW && m_ScMW->scriptIsRunning())) + return; + + if (m_doc) + { + disconnect(m_doc->m_Selection, SIGNAL(selectionChanged()), this, SLOT(handleSelectionChanged())); + disconnect(m_doc , SIGNAL(docChanged()) , this, SLOT(handleSelectionChanged())); + } + + m_doc = d; + m_item = nullptr; + + m_haveDoc = true; + m_haveItem = false; + m_unitRatio = m_doc->unitRatio(); + + buttonFillColor->setDoc(m_doc); + buttonFillMask->setDoc(m_doc); + + connect(m_doc->m_Selection, SIGNAL(selectionChanged()), this, SLOT(handleSelectionChanged())); + connect(m_doc , SIGNAL(docChanged()) , this, SLOT(handleSelectionChanged())); +} + +void PropertiesPalette_Fill::unsetDoc() +{ + if (m_doc) + { + disconnect(m_doc->m_Selection, SIGNAL(selectionChanged()), this, SLOT(handleSelectionChanged())); + disconnect(m_doc , SIGNAL(docChanged()) , this, SLOT(handleSelectionChanged())); + } + + m_haveDoc = false; + m_haveItem = false; + m_doc = nullptr; + m_item = nullptr; + + buttonFillColor->unsetDoc(); + buttonFillMask->unsetDoc(); + + setEnabled(false); +} + +void PropertiesPalette_Fill::unsetItem() +{ + m_haveItem = false; + m_item = nullptr; + handleSelectionChanged(); +} + +PageItem* PropertiesPalette_Fill::currentItemFromSelection() +{ + PageItem *currentItem = nullptr; + + if (m_doc && m_doc->m_Selection->count() > 0) + currentItem = m_doc->m_Selection->itemAt(0); + + return currentItem; +} + +void PropertiesPalette_Fill::setCurrentItem_Fill(PageItem *item) +{ + buttonFillColor->setType(item->gradientType()); + + // Gradient + buttonFillColor->setGradient( + item->gradient(), + item->fill_gradient, + item->getGradientExtend(), + item->gradientCol1(), + item->gradientCol2(), + item->gradientCol3(), + item->gradientCol4(), + item->gradientShade1(), + item->gradientShade2(), + item->gradientShade3(), + item->gradientShade4(), + item->gradientTransp1(), + item->gradientTransp2(), + item->gradientTransp3(), + item->gradientTransp4() + ); + + // Gradient Vector + buttonFillColor->setGradientVector( + item->gradientStartX(), + item->gradientStartY(), + item->gradientEndX(), + item->gradientEndY(), + item->gradientFocalX(), + item->gradientFocalY(), + item->gradientScale(), + item->gradientSkew(), + item->gradientControl1().x(), + item->gradientControl1().y(), + item->gradientControl2().x(), + item->gradientControl2().y(), + item->gradientControl3().x(), + item->gradientControl3().y(), + item->gradientControl4().x(), + item->gradientControl4().y(), + item->gradientControl5().x(), + item->gradientControl5().y() + ); + + // Gradient Mesh + if (m_ScMW->view->editStrokeGradient == GradientEdit::Mesh_Point/* || (m_ScMW->view->editStrokeGradient == GradientEdit::Mesh_Color)*/) + { + if ((item->selectedMeshPointX > -1) && (item->selectedMeshPointY > -1)) + { + MeshPoint mp = item->meshGradientArray[item->selectedMeshPointX][item->selectedMeshPointY]; + + buttonFillColor->setGradientMesh( + mp.colorName, mp.shade, mp.transparency + ); + } + + WidgetManager::instance().colorPicker()->enableMeshColor((item->selectedMeshPointX > -1) && (item->selectedMeshPointY > -1)); + } + else if (m_ScMW->view->editStrokeGradient == GradientEdit::PatchMesh_Point) + { + if ((item->selectedMeshPointX > -1) && (item->selectedMeshPointY > 0)) + { + int index = qBound(0, item->selectedMeshPointX, item->meshGradientPatches.count()-1); + + meshGradientPatch patch = item->meshGradientPatches[index]; + MeshPoint mp; + switch (item->selectedMeshPointY) + { + case 1: + mp = patch.TL; + break; + case 2: + mp = patch.TR; + break; + case 3: + mp = patch.BR; + break; + case 4: + mp = patch.BL; + break; + } + + buttonFillColor->setGradientMesh( + mp.colorName, mp.shade, mp.transparency + ); + } + + WidgetManager::instance().colorPicker()->enableButtonRemovePatch((item->selectedMeshPointX > -1) && (item->meshGradientPatches.count() > 1)); + WidgetManager::instance().colorPicker()->enableMeshColor((item->selectedMeshPointX > -1) && (item->selectedMeshPointY > 0)); + + } + + // Hatch + buttonFillColor->setHatch( + item->hatchType, + item->hatchDistance, + item->hatchAngle, + item->hatchUseBackground, + item->hatchBackground, + item->hatchForeground + ); + // Pattern + bool mirrorX, mirrorY; + item->patternFlip(mirrorX, mirrorY); + buttonFillColor->setPattern(item->pattern(), + item->patternTransform().offsetX, + item->patternTransform().offsetY, + item->patternTransform().scaleX, + item->patternTransform().scaleY, + item->patternTransform().skewX, + item->patternTransform().skewY, + item->patternTransform().rotation, + 0.0, mirrorX, mirrorY, false + ); + // Color + buttonFillColor->setColor(item->fillColor(), item->fillShade()); + // General + buttonFillColor->setGeneral(item->overprint()); + + buttonFillColor->updateFloatingContext(); + buttonFillColor->updatePreview(); + +} + +void PropertiesPalette_Fill::setCurrentItem_FillMask(PageItem *item) +{ + buttonFillMask->setType(item->maskType()); + // Gradient + buttonFillMask->setGradient( + item->gradientMask(), + item->mask_gradient + ); + + // Gradient Vector + buttonFillMask->setGradientVector( + item->gradientMaskStartX(), + item->gradientMaskStartY(), + item->gradientMaskEndX(), + item->gradientMaskEndY(), + item->gradientMaskFocalX(), + item->gradientMaskFocalY(), + item->gradientMaskScale(), + item->gradientMaskSkew() + ); + + // Pattern + bool mirrorX, mirrorY; + item->maskFlip(mirrorX, mirrorY); + buttonFillMask->setPattern(item->patternMask(), + item->maskTransform().offsetX, + item->maskTransform().offsetY, + item->maskTransform().scaleX, + item->maskTransform().scaleY, + item->maskTransform().skewX, + item->maskTransform().skewY, + item->maskTransform().rotation, + 0.0, mirrorX, mirrorY, false + ); + // Color + buttonFillMask->setColor( + "", + 100, + item->fillTransparency() + ); + + buttonFillMask->updateFloatingContext(); + buttonFillMask->updatePreview(); + +} + +void PropertiesPalette_Fill::setCurrentItem(PageItem *item) +{ + if (!m_ScMW || m_ScMW->scriptIsRunning()) + return; + //CB We shouldn't really need to process this if our item is the same one + //maybe we do if the item has been changed by scripter.. but that should probably + //set some status if so. + //FIXME: This won't work until when a canvas deselect happens, m_item must be nullptr. + //if (m_item == i) + // return; + + if (item && !m_doc) + setDoc(item->doc()); + + m_haveItem = false; + m_item = item; + + if (!m_item) + return; + + int itemType = m_item ? (int) m_item->itemType() : -1; + + switch (itemType) + { + case -1: + + break; + case PageItem::LatexFrame: + case PageItem::OSGFrame: + case PageItem::Group: + case PageItem::Symbol: + case PageItem::Table: + case PageItem::ItemType1: + case PageItem::ItemType3: + case PageItem::Polygon: + case PageItem::RegularPolygon: + case PageItem::Arc: + case PageItem::PolyLine: + case PageItem::Spiral: + nonZero->setEnabled(true); + evenOdd->setEnabled(true); + nonZero->setChecked(!m_item->fillRule); + evenOdd->setChecked(m_item->fillRule); + + if (m_item->isGroup()) + labelFillColor->setEnabled(false); + else + labelFillColor->setEnabled(true); + + break; + case PageItem::ImageFrame: + case PageItem::TextFrame: + case PageItem::PathText: + nonZero->setChecked(false); + nonZero->setEnabled(false); + evenOdd->setChecked(false); + evenOdd->setEnabled(false); + labelFillColor->setEnabled(true); + break; + } + + setCurrentItem_Fill(m_item); + setCurrentItem_FillMask(m_item); + + QSignalBlocker sigFillBlendMode(comboBlendmode); + comboBlendmode->setCurrentIndex(m_item->fillBlendmode()); + + m_haveItem = true; +} + +void PropertiesPalette_Fill::handleFillRule() +{ + if (!m_haveDoc || !m_haveItem || !m_ScMW || m_ScMW->scriptIsRunning()) + return; + m_item->fillRule = evenOdd->isChecked(); + m_item->update(); +} + +void PropertiesPalette_Fill::handleFillColor() +{ + if (!m_doc ||!m_item || !m_ScMW || m_ScMW->scriptIsRunning()) + return; + + blockUpdates(true); + + switch(buttonFillColor->mode()) + { + default: + case Mode::Solid: + m_doc->itemSelection_SetItemBrush(buttonFillColor->colorData().Name); + m_doc->itemSelection_SetItemBrushShade(static_cast<int>(buttonFillColor->colorData().Shade)); + break; + case Mode::Gradient: + { + if(buttonFillColor->gradientData().Name.isEmpty()) + { + m_item->setGradient(""); + m_doc->itemSelection_SetFillGradient(buttonFillColor->gradientData().Gradient); + } + else + { + m_item->setGradient(buttonFillColor->gradientData().Name); + } + + UndoTransaction trans; + if (UndoManager::undoEnabled()) + trans = undoManager->beginTransaction(Um::Selection, Um::IFill, Um::GradVal, QString(), Um::IFill); + m_item->set4ColorShade( + static_cast<int>(buttonFillColor->gradientData().Color1Shade), + static_cast<int>(buttonFillColor->gradientData().Color2Shade), + static_cast<int>(buttonFillColor->gradientData().Color3Shade), + static_cast<int>(buttonFillColor->gradientData().Color4Shade) + ); + m_item->set4ColorTransparency( + buttonFillColor->gradientData().Color1Alpha, + buttonFillColor->gradientData().Color2Alpha, + buttonFillColor->gradientData().Color3Alpha, + buttonFillColor->gradientData().Color4Alpha + ); + m_item->set4ColorColors( + buttonFillColor->gradientData().Color1Name, + buttonFillColor->gradientData().Color2Name, + buttonFillColor->gradientData().Color3Name, + buttonFillColor->gradientData().Color4Name + ); + if (trans) + trans.commit(); + + m_item->setGradientExtend(buttonFillColor->gradientData().repeatMethod); + m_item->update(); + m_doc->regionsChanged()->update(QRect()); + } + break; + case Mode::Hatch: + m_doc->itemSelection_SetItemHatchFill( + buttonFillColor->hatchData().Type, + buttonFillColor->hatchData().Distance, + buttonFillColor->hatchData().Angle, + buttonFillColor->hatchData().HasBackgroundColor, + buttonFillColor->hatchData().ColorBackground, + buttonFillColor->hatchData().ColorForeground + ); + break; + case Mode::Pattern: + m_doc->itemSelection_SetItemPatternFill(buttonFillColor->patternData().Name); + m_doc->itemSelection_SetItemPatternProps( + buttonFillColor->patternData().ScaleX, + buttonFillColor->patternData().ScaleY, + buttonFillColor->patternData().OffsetX, + buttonFillColor->patternData().OffsetY, + buttonFillColor->patternData().Angle, + buttonFillColor->patternData().SkewX, + buttonFillColor->patternData().SkewY, + buttonFillColor->patternData().MirrorX, + buttonFillColor->patternData().MirrorY + ); + break; + } + + m_doc->itemSelection_SetItemGradFill(buttonFillColor->type()); + m_doc->itemSelection_SetOverprint(buttonFillColor->generalData().overprint); + + blockUpdates(false); + +} + +void PropertiesPalette_Fill::handleFillColorVector() +{ + if (!m_doc ||!m_item || !m_ScMW || m_ScMW->scriptIsRunning() || buttonFillColor->mode() != Mode::Gradient) + return; + + CPGradientVectorData gvd = buttonFillColor->gradientVectorData(); + + QRectF upRect; + UndoTransaction trans; + if (UndoManager::undoEnabled()) + trans = undoManager->beginTransaction(Um::Selection, Um::ILine, Um::GradPos + "p", "", Um::ILine); + + switch (buttonFillColor->type()) + { + case Gradient_4Colors: + m_item->setGradientControl1(FPoint(gvd.C1X, gvd.C1Y)); + m_item->setGradientControl2(FPoint(gvd.C2X, gvd.C2Y)); + m_item->setGradientControl3(FPoint(gvd.C3X, gvd.C3Y)); + m_item->setGradientControl4(FPoint(gvd.C4X, gvd.C4Y)); + m_item->update(); + upRect = QRectF(QPointF(-m_item->width(), -m_item->height()), QPointF(m_item->width() * 2, m_item->height() * 2)).normalized(); + break; + case Gradient_Diamond: + m_item->setGradientControl1(FPoint(gvd.C1X, gvd.C1Y)); + m_item->setGradientControl2(FPoint(gvd.C2X, gvd.C2Y)); + m_item->setGradientControl3(FPoint(gvd.C3X, gvd.C3Y)); + m_item->setGradientControl4(FPoint(gvd.C4X, gvd.C4Y)); + m_item->setGradientControl5(FPoint(gvd.C5X, gvd.C5Y)); + m_item->update(); + upRect = QRectF(QPointF(-m_item->width(), -m_item->height()), QPointF(m_item->width() * 2, m_item->height() * 2)).normalized(); + break; + default: + if (m_item->gradientType() == Gradient_Conical && UndoManager::undoEnabled()) + { + SimpleState *ss= new SimpleState("Refresh"); + ss->set("UNDO_UPDATE_CONICAL"); + undoManager->action(m_item,ss); + } + + m_item->setGradientStart(gvd.StartX, gvd.StartY); + m_item->setGradientEnd(gvd.EndX, gvd.EndY); + m_item->setGradientFocal(gvd.FocalX, gvd.FocalY); + m_item->setGradientScale(gvd.Scale); + m_item->setGradientSkew(gvd.Skew); + + if (m_item->gradientType() == Gradient_Conical && UndoManager::undoEnabled()) + { + m_item->createConicalMesh(); + SimpleState *ss= new SimpleState("Refresh"); + ss->set("REDO_UPDATE_CONICAL"); + undoManager->action(m_item,ss); + } + + m_item->update(); + upRect = QRectF(m_item->gradientStart(), m_item->gradientEnd()); + double radEnd = distance(m_item->gradientEndX() - m_item->gradientStartX(), m_item->gradientEndY() - m_item->gradientStartY()); + double rotEnd = xy2Deg(m_item->gradientEndX() - m_item->gradientStartX(), m_item->gradientEndY() - m_item->gradientStartY()); + QTransform m; + m.translate(m_item->gradientStartX(), m_item->gradientStartY()); + m.rotate(rotEnd); + m.rotate(-90); + m.rotate(m_item->gradientSkew()); + m.translate(radEnd * m_item->gradientScale(), 0); + QPointF shP = m.map(QPointF(0,0)); + upRect |= QRectF(shP, m_item->gradientEnd()).normalized(); + upRect |= QRectF(shP, m_item->gradientStart()).normalized(); + upRect |= QRectF(shP, QPointF(0, 0)).normalized(); + upRect |= QRectF(shP, QPointF(m_item->width(), m_item->height())).normalized(); + break; + } + + if (trans) + trans.commit(); + + upRect.translate(m_item->xPos(), m_item->yPos()); + m_doc->regionsChanged()->update(upRect.adjusted(-10.0, -10.0, 10.0, 10.0)); + m_doc->changed(); + m_doc->changedPagePreview(); + +} + +void PropertiesPalette_Fill::handleFillColorMesh() +{ + if (!m_doc ||!m_item || !m_ScMW || m_ScMW->scriptIsRunning()) + return; + + CPColorData mcd = buttonFillColor->gradientMeshData(); + + // Mesh Color + if (m_ScMW->view->editStrokeGradient == GradientEdit::Mesh_Point) + { + if ((m_item->selectedMeshPointX > -1) && (m_item->selectedMeshPointY > -1)) + m_item->setMeshPointColor(m_item->selectedMeshPointX, m_item->selectedMeshPointY, + mcd.Name, + mcd.Shade, + mcd.Opacity + ); + } + + // Mesh Patch Color + if (m_ScMW->view->editStrokeGradient == GradientEdit::PatchMesh_Point) + { + if ((m_item->selectedMeshPointX > -1) && (m_item->selectedMeshPointY > -1)) + m_item->setMeshPointColor(m_item->selectedMeshPointX, m_item->selectedMeshPointY, + mcd.Name, + mcd.Shade, + mcd.Opacity, + true + ); + } + + m_item->update(); + m_doc->regionsChanged()->update(QRect()); + +} + +void PropertiesPalette_Fill::handleFillMask() +{ + if (!m_doc || !m_item || !m_ScMW || m_ScMW->scriptIsRunning()) + return; + + blockUpdates(true); + m_doc->itemSelection_SetItemGradMask(buttonFillMask->type()); + + switch(buttonFillMask->mode()) + { + default: + case Mode::Solid: + m_doc->itemSelection_SetItemFillTransparency(buttonFillMask->colorData().Opacity); + break; + case Mode::Gradient: + + if(buttonFillMask->gradientData().Name.isEmpty()) + { + m_item->setGradientMask(""); + m_doc->itemSelection_SetMaskGradient(buttonFillMask->gradient()); + } + else + { + m_item->setGradientMask(buttonFillMask->gradientName()); + } + + break; + case Mode::Hatch: + // Do nothing + break; + case Mode::Pattern: + m_doc->itemSelection_SetItemPatternMask(buttonFillMask->patternData().Name); + m_doc->itemSelection_SetItemPatternMaskProps( + buttonFillMask->patternData().ScaleX, + buttonFillMask->patternData().ScaleY, + buttonFillMask->patternData().OffsetX, + buttonFillMask->patternData().OffsetY, + buttonFillMask->patternData().Angle, + buttonFillMask->patternData().SkewX, + buttonFillMask->patternData().SkewY, + buttonFillMask->patternData().MirrorX, + buttonFillMask->patternData().MirrorY + ); + break; + } + blockUpdates(false); +} + +void PropertiesPalette_Fill::handleFillMaskVector() +{ + if (!m_doc ||!m_item || !m_ScMW || m_ScMW->scriptIsRunning() || buttonFillMask->mode() != Mode::Gradient) + return; + + CPGradientVectorData gvd = buttonFillMask->gradientVectorData(); + + QRectF upRect; + UndoTransaction trans; + if (UndoManager::undoEnabled()) + trans = undoManager->beginTransaction(Um::Selection, Um::ILine, Um::GradPos + "o", "", Um::ILine); + + m_item->setGradientMaskStart(gvd.StartX, gvd.StartY); + m_item->setGradientMaskEnd(gvd.EndX, gvd.EndY); + m_item->setGradientMaskFocal(gvd.FocalX, gvd.FocalY); + m_item->setGradientMaskScale(gvd.Scale); + m_item->setGradientMaskSkew(gvd.Skew); + +// if ((m_item->GrMask == GradMask_Linear) || (m_item->GrMask == GradMask_LinearLumAlpha)) +// { +// m_item->setGradientMaskFocal(m_item->GrMaskStartX, m_item->GrMaskStartY); +// } + m_item->update(); + if (trans) + { + trans.commit(); + } + upRect = QRectF(m_item->gradientMaskStart(), m_item->gradientMaskEnd()); + double radEnd = distance(m_item->GrMaskEndX - m_item->GrMaskStartX, m_item->GrMaskEndY - m_item->GrMaskStartY); + double rotEnd = xy2Deg(m_item->GrMaskEndX - m_item->GrMaskStartX, m_item->GrMaskEndY - m_item->GrMaskStartY); + QTransform m; + m.translate(m_item->GrMaskStartX, m_item->GrMaskStartY); + m.rotate(rotEnd); + m.rotate(-90); + m.rotate(m_item->GrMaskSkew); + m.translate(radEnd * m_item->GrMaskScale, 0); + QPointF shP = m.map(QPointF(0,0)); + upRect |= QRectF(shP, m_item->gradientMaskEnd()).normalized(); + upRect |= QRectF(shP, m_item->gradientMaskStart()).normalized(); + upRect |= QRectF(shP, QPointF(0, 0)).normalized(); + upRect |= QRectF(shP, QPointF(m_item->width(), m_item->height())).normalized(); + upRect.translate(m_item->xPos(), m_item->yPos()); + m_doc->regionsChanged()->update(upRect.adjusted(-10.0, -10.0, 10.0, 10.0)); + m_doc->changed(); + m_doc->changedPagePreview(); +} + +void PropertiesPalette_Fill::handleFillBlendmode(int mode) +{ + if (!m_doc || !m_ScMW || m_ScMW->scriptIsRunning()) + return; + + m_doc->itemSelection_SetItemFillBlend(comboBlendmode->currentIndex()); +} + +void PropertiesPalette_Fill::handleSelectionChanged() +{ + if (!m_haveDoc || !m_ScMW || m_ScMW->scriptIsRunning()) + return; + + if (updatesBlocked()) + return; + + PageItem* currItem = currentItemFromSelection(); + if (m_doc->m_Selection->count() > 1) + { + setEnabled(true); + } + else + { + int itemType = currItem ? (int) currItem->itemType() : -1; + + m_haveItem = (itemType != -1); + switch (itemType) + { + case -1: + case PageItem::OSGFrame: + case PageItem::Line: + case PageItem::Symbol: + setEnabled(false); + break; + case PageItem::Arc: + case PageItem::ItemType1: + case PageItem::ItemType3: + case PageItem::Polygon: + case PageItem::RegularPolygon: + case PageItem::PolyLine: + case PageItem::Spiral: + case PageItem::PathText: + case PageItem::Table: + case PageItem::TextFrame: + case PageItem::ImageFrame: + case PageItem::LatexFrame: + setEnabled(true); + break; + } + } + setCurrentItem(currItem); + updateGeometry(); +} + +void PropertiesPalette_Fill::handleUpdateRequest(int updateFlags) +{ + if (updateFlags & reqColorsUpdate) + updateColorList(); +} + +void PropertiesPalette_Fill::iconSetChange() +{ + IconManager& im = IconManager::instance(); + + evenOdd->setIcon(im.loadIcon("fill-rule-even-odd.png")); + nonZero->setIcon(im.loadIcon("fill-rule-nonzero.png")); + + if(labelFillMask->labelVisibility()) + buttonFillMask->setIcon(QIcon()); + else + buttonFillMask->setIcon(im.loadIcon("mask", 8)); +} + +void PropertiesPalette_Fill::languageChange() +{ + retranslateUi(this); + + comboBlendmode->setToolTip( tr("Blendmode of fill")); +} + +void PropertiesPalette_Fill::unitChange() +{ + m_unitRatio = m_doc->unitRatio(); +} + +void PropertiesPalette_Fill::toggleLabelVisibility(bool v) +{ + labelFillColor->setLabelVisibility(v); + labelFillMask->setLabelVisibility(v); + labelFillRule->setLabelVisibility(v); + labelBlendmode->setLabelVisibility(v); + + iconSetChange(); +} + + Index: scribus/ui/propertiespalette_fill.h =================================================================== --- scribus/ui/propertiespalette_fill.h (nicht existent) +++ scribus/ui/propertiespalette_fill.h (Arbeitskopie) @@ -0,0 +1,73 @@ +#ifndef PROPERTIESPALETTE_FILL_H +#define PROPERTIESPALETTE_FILL_H + +#include "ui_propertiespalette_fill.h" +#include <QWidget> +#include "scribusapi.h" +#include "scguardedptr.h" + +class ScribusDoc; +class ScribusMainWindow; +class PageItem; +class ColorPicker; +class UndoManager; + +class SCRIBUS_API PropertiesPalette_Fill : public QWidget, Ui::PropertiesPalette_Fill +{ + Q_OBJECT + +public: + explicit PropertiesPalette_Fill(QWidget *parent = nullptr); + ~PropertiesPalette_Fill() {}; + + void updateColorList(); + +public slots: + void setMainWindow(ScribusMainWindow *mw); + + void setDoc(ScribusDoc *d); + void setCurrentItem(PageItem *item); + void unsetDoc(); + void unsetItem(); + + void handleSelectionChanged(); + void handleUpdateRequest(int); + + void iconSetChange(); + void languageChange(); + void unitChange(); + void toggleLabelVisibility(bool v); + +private: + PageItem* currentItemFromSelection(); + void setCurrentItem_Fill(PageItem *item); + void setCurrentItem_FillMask(PageItem *item); + + int m_blockUpdates {0}; + void blockUpdates(bool block) { if (block) ++m_blockUpdates; else --m_blockUpdates; } + bool updatesBlocked() { return (m_blockUpdates > 0); } + +protected: + bool m_haveDoc {false}; + bool m_haveItem {false}; + double m_unitRatio {1.0}; + PageItem *m_item {nullptr}; + ScribusMainWindow* m_ScMW {nullptr}; + ScGuardedPtr<ScribusDoc> m_doc; + UndoManager* undoManager {nullptr}; + QButtonGroup *buttonsCaps; + QButtonGroup *buttonsJoins; + +private slots: + void handleFillRule(); + void handleFillColor(); + void handleFillColorVector(); + void handleFillColorMesh(); + void handleFillMask(); + void handleFillMaskVector(); + void handleFillBlendmode(int mode); + + +}; + +#endif // PROPERTIESPALETTE_FILL_H Index: scribus/ui/propertiespalette_fill.ui =================================================================== --- scribus/ui/propertiespalette_fill.ui (nicht existent) +++ scribus/ui/propertiespalette_fill.ui (Arbeitskopie) @@ -0,0 +1,258 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>PropertiesPalette_Fill</class> + <widget class="QWidget" name="PropertiesPalette_Fill"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>335</width> + <height>66</height> + </rect> + </property> + <property name="windowTitle"> + <string>Form</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <property name="spacing"> + <number>4</number> + </property> + <property name="leftMargin"> + <number>8</number> + </property> + <property name="topMargin"> + <number>8</number> + </property> + <property name="rightMargin"> + <number>8</number> + </property> + <property name="bottomMargin"> + <number>8</number> + </property> + <item> + <layout class="QHBoxLayout" name="horizontalLayout"> + <property name="spacing"> + <number>16</number> + </property> + <item> + <widget class="FormWidget" name="labelFillColor"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="label" stdset="0"> + <string>Color</string> + </property> + <property name="font"> + <font> + <pointsize>8</pointsize> + </font> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_2"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="ColorButton" name="buttonFillColor"> + <property name="text"> + <string/> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_6"> + <property name="spacing"> + <number>4</number> + </property> + <item> + <widget class="FormWidget" name="labelFillMask"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="label" stdset="0"> + <string>Mask</string> + </property> + <property name="font"> + <font> + <pointsize>8</pointsize> + </font> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_4"> + <property name="spacing"> + <number>4</number> + </property> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="ColorButton" name="buttonFillMask"> + <property name="text"> + <string/> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="FormWidget" name="labelBlendmode"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="label" stdset="0"> + <string>Blendmode</string> + </property> + <property name="font"> + <font> + <pointsize>8</pointsize> + </font> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_5"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="ComboBlendMode" name="comboBlendmode"/> + </item> + </layout> + </widget> + </item> + </layout> + </item> + <item> + <widget class="FormWidget" name="labelFillRule"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="label" stdset="0"> + <string>Fill Rule</string> + </property> + <property name="font"> + <font> + <pointsize>8</pointsize> + </font> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_3"> + <property name="spacing"> + <number>4</number> + </property> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="QToolButton" name="evenOdd"> + <property name="text"> + <string/> + </property> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="autoExclusive"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QToolButton" name="nonZero"> + <property name="text"> + <string/> + </property> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="autoExclusive"> + <bool>true</bool> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + </layout> + </widget> + <customwidgets> + <customwidget> + <class>FormWidget</class> + <extends>QWidget</extends> + <header>ui/widgets/form_widget.h</header> + <container>1</container> + </customwidget> + <customwidget> + <class>ColorButton</class> + <extends>QToolButton</extends> + <header>ui/widgets/color_button.h</header> + </customwidget> + <customwidget> + <class>ComboBlendMode</class> + <extends>QComboBox</extends> + <header>ui/widgets/combo_blendmode.h</header> + </customwidget> + </customwidgets> + <resources/> + <connections/> +</ui> Index: scribus/ui/propertiespalette_group.h =================================================================== --- scribus/ui/propertiespalette_group.h (Revision 26070) +++ scribus/ui/propertiespalette_group.h (Arbeitskopie) @@ -30,7 +30,7 @@ void showTextFlowMode(PageItem::TextFlowMode mode); void updateColorList(); - void updateColorSpecialGradient(); +// void updateColorSpecialGradient(); protected: bool m_haveDoc {false}; Index: scribus/ui/propertiespalette_line.cpp =================================================================== --- scribus/ui/propertiespalette_line.cpp (Revision 26070) +++ scribus/ui/propertiespalette_line.cpp (Arbeitskopie) @@ -23,7 +23,7 @@ #include "scribusapp.h" #include "scribusdoc.h" #include "selection.h" -#include "ui/propertiespalette_utils.h" +#include "ui/colorpicker/colorpicker_enum.h" #include "ui/widgets/popup_menu.h" #include "units.h" #include "util.h" @@ -48,8 +48,6 @@ buttonsJoins->addButton(buttonJoinBevel, 1); buttonsJoins->addButton(buttonJoinRound, 2); - numberOpacity->setDecimals(0); - lineType->addItem( tr("Custom")); lineMarkerSelectorStart = new LineMarkerSelector(); @@ -62,8 +60,10 @@ PopupMenu *menuLineMarkerEnd = new PopupMenu(lineMarkerSelectorEnd); buttonMarkerEnd->setMenu(menuLineMarkerEnd); - lineStyles->setItemDelegate(new LineStyleItemDelegate()); - lineStyles->addItem( "No Style" ); + buttonLineColor->setContext(Context::Line); + buttonLineColor->setMenuContextType(ColorButton::Floating); + buttonLineMask->setContext(Context::LineMask); + buttonLineMask->setMenuContextType(ColorButton::Floating); languageChange(); iconSetChange(); @@ -73,7 +73,7 @@ connect(ScQApp, SIGNAL(labelVisibilityChanged(bool)), this, SLOT(toggleLabelVisibility(bool))); connect(lineWidth, SIGNAL(valueChanged(double)), this, SLOT(handleLineWidth())); - connect(lineType, SIGNAL(activated(int)), this, SLOT(handleLineStyle())); + connect(lineType, SIGNAL(activated(int)), this, SLOT(handleLineType())); connect(buttonsJoins, SIGNAL(idClicked(int)), this, SLOT(handleLineJoin())); connect(buttonsCaps, SIGNAL(idClicked(int)), this, SLOT(handleLineEnd())); connect(dashEditor, SIGNAL(dashChanged()), this, SLOT(handleDashChange())); @@ -81,10 +81,12 @@ connect(lineMarkerSelectorStart, SIGNAL(scaleChanged(double)), this, SLOT(handleStartArrowScale(double))); connect(lineMarkerSelectorEnd, SIGNAL(markerChanged(int)), this, SLOT(handleEndArrow(int))); connect(lineMarkerSelectorEnd, SIGNAL(scaleChanged(double)), this, SLOT(handleEndArrowScale(double))); - connect(lineStyles, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(handleLineStyle(QListWidgetItem*))); connect(buttonSwapMarker, SIGNAL(clicked(bool)), this, SLOT(swapLineMarker())); connect(comboBlendmode, SIGNAL(currentIndexChanged(int)), this, SLOT(handleLineBlendmode(int))); - connect(numberOpacity, SIGNAL(valueChanged(double)), this, SLOT(handleLineOpacity(double))); + connect(comboLineStyle, SIGNAL(currentIndexChanged(int)), this, SLOT(handleLineStyle(int))); + connect(buttonLineColor, SIGNAL(changed()), this, SLOT(handleLineColor())); + connect(buttonLineColor, SIGNAL(gradientVectorChanged()), this, SLOT(handleLineColorVector())); + connect(buttonLineMask, SIGNAL(changed()), this, SLOT(handleLineOpacity())); } @@ -104,7 +106,7 @@ if (m_doc) if (m_doc->m_Selection->count() >= 1) - currentItem = m_doc->m_Selection->itemAt(0); + currentItem = m_doc->m_Selection->itemAt(0); return currentItem; } @@ -138,6 +140,7 @@ lineWidth->setMaximum( 300 ); lineWidth->setMinimum( 0 ); + comboLineStyle->setDoc(m_doc); updateLineStyles(m_doc); lineMarkerSelectorStart->rebuildList(&m_doc->arrowStyles()); @@ -146,6 +149,9 @@ lineMarkerSelectorEnd->rebuildList(&m_doc->arrowStyles()); buttonMarkerEnd->setIcon(lineMarkerSelectorEnd->currentIcon()); + buttonLineColor->setDoc(m_doc); + buttonLineMask->setDoc(m_doc); + connect(m_doc->m_Selection, SIGNAL(selectionChanged()), this, SLOT(handleSelectionChanged())); connect(m_doc, SIGNAL(docChanged()), this, SLOT(handleSelectionChanged())); } @@ -163,6 +169,9 @@ m_doc = nullptr; m_item = nullptr; + comboLineStyle->setDoc(m_doc); + buttonLineColor->unsetDoc(); + buttonLineMask->unsetDoc(); updateLineStyles(nullptr); setEnabled(false); @@ -181,6 +190,9 @@ if (!m_haveDoc || !m_ScMW || m_ScMW->scriptIsRunning()) return; + if (updatesBlocked()) + return; + PageItem* currItem = currentItemFromSelection(); if (m_doc->m_Selection->count() > 1) { @@ -214,6 +226,8 @@ case PageItem::PathText: case PageItem::RegularPolygon: case PageItem::TextFrame: + case PageItem::Spiral: + case PageItem::Table: setEnabled(true); break; case PageItem::Symbol: @@ -253,9 +267,11 @@ m_haveItem = false; m_item = item; - lineStyles->blockSignals(true); - lineMarkerSelectorStart->blockSignals(true); - lineMarkerSelectorEnd->blockSignals(true); + QSignalBlocker sigLineStyle(comboLineStyle); + QSignalBlocker sigMarkerSelectorStart(lineMarkerSelectorStart); + QSignalBlocker sigMarkerSelectorEnd(lineMarkerSelectorEnd); + QSignalBlocker sigLineBlendMode(comboBlendmode); + if ((m_item->asLine()) || (m_item->asPolyLine()) || (m_item->asSpiral())) { lineMarkerSelectorStart->setMarker(m_item->startArrowIndex()); @@ -267,36 +283,34 @@ lineMarkerLabel->setVisible(true); } else - { lineMarkerLabel->setVisible(false); - } - if (lineStyles->currentItem()) - lineStyles->currentItem()->setSelected(false); + if ((m_item->isGroup()) && (!m_item->isSingleSel)) + setEnabled(false); + if (m_item->isOSGFrame()) + setEnabled(false); + if (m_item->isSymbol()) + setEnabled(false); - bool setter = false; + bool hasStyle = false; if (m_item->NamedLStyle.isEmpty()) { - setter = true; - QListWidgetItem *itemStl = nullptr; - itemStl = lineStyles->item(0); - if (itemStl != nullptr) - itemStl->setSelected(true); + hasStyle = false; + comboLineStyle->setCurrentIndex(0); } else { - QList<QListWidgetItem*> results (lineStyles->findItems(m_item->NamedLStyle, Qt::MatchFixedString|Qt::MatchCaseSensitive)); - if (results.count() > 0) - results[0]->setSelected(true); - setter = false; + hasStyle = true; + comboLineStyle->setCurrentText(m_item->NamedLStyle); } - lineType->setEnabled(setter); - lineWidth->setEnabled(setter); - lineJoinLabel->setEnabled(setter); - lineEndLabel->setEnabled(setter); + lineTypeLabel->setVisible(!hasStyle); + lineWidthLabel->setVisible(!hasStyle); + lineJoinLabel->setVisible(!hasStyle); + lineEndLabel->setVisible(!hasStyle); + lineColorLabel->setVisible(!hasStyle); - if (m_item->dashes().count() == 0) + if (m_item->dashes().count() == 0 || hasStyle) dashEditor->hide(); else { @@ -305,22 +319,16 @@ dashEditor->show(); } - lineStyles->blockSignals(false); - lineMarkerSelectorStart->blockSignals(false); - lineMarkerSelectorEnd->blockSignals(false); + comboBlendmode->setCurrentIndex(m_item->lineBlendmode()); - if ((m_item->isGroup()) && (!m_item->isSingleSel)) - setEnabled(false); - m_haveItem = true; + setCurrentItem_Line(m_item); + setCurrentItem_LineMask(m_item); + showLineWidth(m_item->lineWidth()); showLineValues(m_item->lineStyle(), m_item->lineEnd(), m_item->lineJoin()); - if (m_item->isOSGFrame()) - setEnabled(false); - if (m_item->isSymbol()) - setEnabled(false); } void PropertiesPalette_Line::updateArrowStyles() @@ -345,24 +353,78 @@ void PropertiesPalette_Line::updateLineStyles(ScribusDoc *doc) { - if (!m_ScMW || m_ScMW->scriptIsRunning()) + if (!m_ScMW || m_ScMW->scriptIsRunning() || !doc) return; - - lineStyles->blockSignals(true); - lineStyles->clear(); - if (doc != nullptr) - { - QHash<QString, MultiLine>::Iterator it; - for (it = doc->docLineStyles.begin(); it != doc->docLineStyles.end(); ++it) - lineStyles->addItem( new LineStyleItem(doc, it.value(), it.key()) ); - lineStyles->sortItems(); - lineStyles->insertItem( 0, tr("No Style")); - if (lineStyles->currentItem()) - lineStyles->currentItem()->setSelected(false); - } - lineStyles->blockSignals(false); + + comboLineStyle->updateLineStyles(); } +void PropertiesPalette_Line::setCurrentItem_Line(PageItem *item) +{ + buttonLineColor->setType(item->strokeGradientType()); + // Gradient + buttonLineColor->setGradient( + item->strokeGradient(), + item->stroke_gradient, + item->getStrokeGradientExtend() + ); + + // Gradient Vector + buttonLineColor->setGradientVector( + item->gradientStrokeStartX(), + item->gradientStrokeStartY(), + item->gradientStrokeEndX(), + item->gradientStrokeEndY(), + item->gradientStrokeFocalX(), + item->gradientStrokeFocalY(), + item->gradientStrokeScale(), + item->gradientStrokeSkew() + ); + + // Pattern + bool mirrorX, mirrorY; + item->strokePatternFlip(mirrorX, mirrorY); + buttonLineColor->setPattern( + item->strokePattern(), + item->strokePatternTransform().offsetX, + item->strokePatternTransform().offsetY, + item->strokePatternTransform().scaleX, + item->strokePatternTransform().scaleY, + item->strokePatternTransform().skewX, + item->strokePatternTransform().skewY, + item->strokePatternTransform().rotation, + item->strokePatternTransform().space, + mirrorX, mirrorY, + item->isStrokePatternToPath() + ); + // Color + buttonLineColor->setColor( + item->lineColor(), + item->lineShade() + ); + // General + buttonLineColor->setGeneral(item->overprint()); + + buttonLineColor->updatePreview(); + buttonLineColor->updateFloatingContext(); + +} + +void PropertiesPalette_Line::setCurrentItem_LineMask(PageItem *item) +{ + buttonLineMask->setType(Gradient_None); + // Color + buttonLineMask->setColor( + "", + 100, + item->lineTransparency() + ); + + buttonLineMask->updatePreview(); + buttonLineMask->updateFloatingContext(); + +} + void PropertiesPalette_Line::showLineWidth(double s) { if (!m_ScMW || m_ScMW->scriptIsRunning()) @@ -472,7 +534,7 @@ } } -void PropertiesPalette_Line::handleLineStyle() +void PropertiesPalette_Line::handleLineType() { if (!m_ScMW || m_ScMW->scriptIsRunning()) return; @@ -601,25 +663,35 @@ } } -void PropertiesPalette_Line::handleLineStyle(QListWidgetItem *widgetItem) +void PropertiesPalette_Line::handleLineStyle(int c) { - if (!m_doc || !m_ScMW || m_ScMW->scriptIsRunning() || !widgetItem) + if (!m_doc || !m_ScMW || m_ScMW->scriptIsRunning()) return; - bool setter = (widgetItem->listWidget()->currentRow() == 0); - m_doc->itemSelection_SetNamedLineStyle(setter ? QString("") : widgetItem->text()); - lineType->setEnabled(setter); - lineWidth->setEnabled(setter); - lineJoinLabel->setEnabled(setter); - lineEndLabel->setEnabled(setter); + bool setter = (c == 0); + m_doc->itemSelection_SetNamedLineStyle(setter ? QString("") : comboLineStyle->currentText()); } -void PropertiesPalette_Line::handleLineOpacity(double opacity) +void PropertiesPalette_Line::handleLineOpacity(/*double opacity*/) { if (!m_doc || !m_ScMW || m_ScMW->scriptIsRunning()) return; - m_doc->itemSelection_SetItemLineTransparency((100 - numberOpacity->value()) / 100.0); + blockUpdates(true); + + switch(buttonLineMask->mode()) + { + default: + case Mode::Solid: + m_doc->itemSelection_SetItemLineTransparency(buttonLineMask->colorData().Opacity); + break; + case Mode::Gradient: + case Mode::Hatch: + case Mode::Pattern: + // Do nothing + break; + } + blockUpdates(false); } void PropertiesPalette_Line::handleLineBlendmode(int mode) @@ -630,6 +702,117 @@ m_doc->itemSelection_SetItemLineBlend(comboBlendmode->currentIndex()); } +void PropertiesPalette_Line::handleLineColor() +{ + if (!m_doc || !m_ScMW || m_ScMW->scriptIsRunning()) + return; + + blockUpdates(true); + m_doc->itemSelection_SetItemGradStroke(buttonLineColor->type()); + + switch(buttonLineColor->mode()) + { + default: + case Mode::Solid: + m_doc->itemSelection_SetItemStrokePattern(""); // reset pattern + m_doc->itemSelection_SetItemPen(buttonLineColor->colorName()); + m_doc->itemSelection_SetItemPenShade(static_cast<int>(buttonLineColor->colorData().Shade)); + break; + case Mode::Gradient: + + m_doc->itemSelection_SetItemStrokePattern(""); // reset pattern + + if(buttonLineColor->gradientData().Name.isEmpty()) + { + m_item->setStrokeGradient(""); + m_doc->itemSelection_SetLineGradient(buttonLineColor->gradientData().Gradient); + } + else + { + m_item->setStrokeGradient(buttonLineColor->gradientData().Name); + } + + m_item->setStrokeGradientExtend(buttonLineColor->gradientData().repeatMethod); + m_item->update(); + m_doc->regionsChanged()->update(QRect()); + + break; + case Mode::Hatch: + // Do nothing + break; + case Mode::Pattern: + m_doc->itemSelection_SetItemStrokePattern(buttonLineColor->patternData().Name); + m_doc->itemSelection_SetItemStrokePatternType(buttonLineColor->patternData().OnPath); + m_doc->itemSelection_SetItemStrokePatternProps( + buttonLineColor->patternData().ScaleX, + buttonLineColor->patternData().ScaleY, + buttonLineColor->patternData().OffsetX, + buttonLineColor->patternData().OffsetY, + buttonLineColor->patternData().Angle, + buttonLineColor->patternData().SkewX, + buttonLineColor->patternData().SkewY, + buttonLineColor->patternData().Spacing, + buttonLineColor->patternData().MirrorX, + buttonLineColor->patternData().MirrorY + ); + break; + } + + m_doc->itemSelection_SetOverprint(buttonLineColor->generalData().overprint); + + // m_item->update(); + // m_doc->regionsChanged()->update(QRect()); + blockUpdates(false); + +} + +void PropertiesPalette_Line::handleLineColorVector() +{ + if (!m_doc ||!m_item || !m_ScMW || m_ScMW->scriptIsRunning() || buttonLineColor->mode() != Mode::Gradient) + return; + + CPGradientVectorData gvd = buttonLineColor->gradientVectorData(); + + QRectF upRect; + + switch (buttonLineColor->type()) + { + case Gradient_Linear: + case Gradient_Radial: + m_item->setGradientStrokeStart(gvd.StartX, gvd.StartY); + m_item->setGradientStrokeEnd(gvd.EndX, gvd.EndY); + m_item->setGradientStrokeFocal(gvd.FocalX, gvd.FocalY); + m_item->setGradientStrokeScale(gvd.Scale); + m_item->setGradientStrokeSkew(gvd.Skew); + if (m_item->strokeGradientType() == Gradient_Linear) + { + m_item->setGradientStrokeFocal(m_item->gradientStrokeStartX(), m_item->gradientStrokeStartY()); + } + m_item->update(); + upRect = QRectF(m_item->gradientStrokeStart(), m_item->gradientStrokeEnd()); + double radEnd = distance(m_item->gradientStrokeEndX() - m_item->gradientStrokeStartX(), m_item->gradientStrokeEndY() - m_item->gradientStrokeStartY()); + double rotEnd = xy2Deg(m_item->gradientStrokeEndX() - m_item->gradientStrokeStartX(), m_item->gradientStrokeEndY() - m_item->gradientStrokeStartY()); + QTransform m; + m.translate(m_item->gradientStrokeStartX(), m_item->gradientStrokeStartY()); + m.rotate(rotEnd); + m.rotate(-90); + m.rotate(m_item->gradientStrokeSkew()); + m.translate(radEnd * m_item->gradientStrokeScale(), 0); + QPointF shP = m.map(QPointF(0,0)); + upRect = upRect.united(QRectF(shP, m_item->gradientStrokeEnd()).normalized()); + upRect = upRect.united(QRectF(shP, m_item->gradientStrokeStart()).normalized()); + upRect |= QRectF(shP, QPointF(0, 0)).normalized(); + upRect |= QRectF(shP, QPointF(m_item->width(), m_item->height())).normalized(); + break; + } + + upRect.translate(m_item->xPos(), m_item->yPos()); + m_doc->regionsChanged()->update(upRect.adjusted(-10.0, -10.0, 10.0, 10.0)); + m_doc->changed(); + m_doc->changedPagePreview(); +} + + void PropertiesPalette_Line::swapLineMarker() { int startID = lineMarkerSelectorStart->marker(); @@ -658,6 +841,12 @@ buttonCapSquare->setIcon(im.loadIcon("16/stroke-cap-square.png")); buttonSwapMarker->setIcon(im.loadIcon("swap")); + + if(lineMaskLabel->labelVisibility()) + buttonLineMask->setIcon(QIcon()); + else + buttonLineMask->setIcon(im.loadIcon("mask", 8)); + } void PropertiesPalette_Line::languageChange() @@ -688,6 +877,7 @@ lineMarkerSelectorStart->languageChange(); lineMarkerSelectorEnd->languageChange(); + comboLineStyle->languageChange(); QString ptSuffix = tr(" pt"); QString suffix = (m_doc) ? unitGetSuffixFromIndex(m_doc->unitIndex()) : ptSuffix; @@ -695,12 +885,8 @@ lineWidth->setSuffix(suffix); lineWidth->setSpecialValueText( tr("Hairline")); - if(lineStyles->count() > 0) - lineStyles->item(0)->setText( tr("No Style") ); - lineType->setToolTip( tr("Pattern of line")); lineWidth->setToolTip( tr("Thickness of line")); - lineStyles->setToolTip( tr("Line style of current object")); buttonCapFlat->setToolTip( tr("Line end is flat")); buttonCapSquare->setToolTip( tr("Line end is squared")); buttonCapRound->setToolTip( tr("Line end is rounded")); @@ -707,8 +893,10 @@ buttonJoinMiter->setToolTip( tr("Line join is mitered")); buttonJoinRound->setToolTip( tr("Line join is rounded")); buttonJoinBevel->setToolTip( tr("Line join is beveled")); - buttonMarkerStart->setToolTip( tr("Arrow head style for start of line")); - buttonMarkerEnd->setToolTip( tr("Arrow head style for end of line")); + buttonMarkerStart->setToolTip( tr("Marker style for start of line")); + buttonMarkerEnd->setToolTip( tr("Marker style for end of line")); + buttonSwapMarker->setToolTip( tr("Swap start and end markers")); + comboBlendmode->setToolTip( tr("Blendmode of line")); } void PropertiesPalette_Line::unitChange() @@ -732,11 +920,14 @@ void PropertiesPalette_Line::toggleLabelVisibility(bool v) { + lineColorLabel->setLabelVisibility(v); lineWidthLabel->setLabelVisibility(v); lineJoinLabel->setLabelVisibility(v); lineTypeLabel->setLabelVisibility(v); lineEndLabel->setLabelVisibility(v); lineMarkerLabel->setLabelVisibility(v); - lineOpacityLabel->setLabelVisibility(v); + lineMaskLabel->setLabelVisibility(v); lineBlendmodeLabel->setLabelVisibility(v); + + iconSetChange(); } Index: scribus/ui/propertiespalette_line.h =================================================================== --- scribus/ui/propertiespalette_line.h (Revision 26070) +++ scribus/ui/propertiespalette_line.h (Arbeitskopie) @@ -1,93 +1,103 @@ -/* -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 PROPERTIESPALETTE_LINE_H -#define PROPERTIESPALETTE_LINE_H - -#include "ui_propertiespalette_linebase.h" - -#include "scribusapi.h" -#include "scguardedptr.h" -#include "units.h" - -class ArrowChooser; -class DashEditor; -class PageItem; -class ScribusDoc; -class ScribusMainWindow; +/* +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 PROPERTIESPALETTE_LINE_H +#define PROPERTIESPALETTE_LINE_H + +#include "ui_propertiespalette_linebase.h" + +#include <QListWidgetItem> +#include "scribusapi.h" +#include "scguardedptr.h" +#include "units.h" + +class ArrowChooser; +class DashEditor; +class PageItem; +class ScribusDoc; +class ScribusMainWindow; class QButtonGroup; class LineMarkerSelector; - -class SCRIBUS_API PropertiesPalette_Line : public QWidget, Ui::PropertiesPalette_LineBase -{ - Q_OBJECT - -public: - PropertiesPalette_Line(QWidget* parent); - ~PropertiesPalette_Line() {delete lineStyles->itemDelegate();}; - - void updateLineStyles(); - void updateArrowStyles(); - -protected: +class ColorPicker; - bool m_haveDoc {false}; - bool m_haveItem {false}; - double m_unitRatio {1.0}; - int m_unitIndex {SC_PT}; - PageItem *m_item {nullptr}; - ScribusMainWindow* m_ScMW {nullptr}; - ScGuardedPtr<ScribusDoc> m_doc; +class SCRIBUS_API PropertiesPalette_Line : public QWidget, Ui::PropertiesPalette_LineBase +{ + Q_OBJECT + +public: + PropertiesPalette_Line(QWidget* parent); + ~PropertiesPalette_Line() {}; + + void updateLineStyles(); + void updateArrowStyles(); + +protected: + + bool m_haveDoc {false}; + bool m_haveItem {false}; + double m_unitRatio {1.0}; + int m_unitIndex {SC_PT}; + PageItem *m_item {nullptr}; + ScribusMainWindow* m_ScMW {nullptr}; + ScGuardedPtr<ScribusDoc> m_doc; QButtonGroup *buttonsCaps; QButtonGroup *buttonsJoins; LineMarkerSelector *lineMarkerSelectorStart; LineMarkerSelector *lineMarkerSelectorEnd; - - void changeEvent(QEvent *e) override; - -private: - PageItem* currentItemFromSelection(); - void updateArrowStyles(ScribusDoc *doc); - void updateLineStyles(ScribusDoc *doc); - -public slots: - void setMainWindow(ScribusMainWindow *mw); - - void setDoc(ScribusDoc *d); - void setCurrentItem(PageItem *item); - void unsetDoc(); - void unsetItem(); - - void handleSelectionChanged(); - void handleUpdateRequest(int); - - void showLineWidth(double s); - void showLineValues(Qt::PenStyle p, Qt::PenCapStyle pc, Qt::PenJoinStyle pj); - - void iconSetChange(); - void languageChange(); - void unitChange(); - void localeChange(); + + void changeEvent(QEvent *e) override; + +private: + PageItem* currentItemFromSelection(); + void updateArrowStyles(ScribusDoc *doc); + void updateLineStyles(ScribusDoc *doc); + void setCurrentItem_Line(PageItem *item); + void setCurrentItem_LineMask(PageItem *item); + + int m_blockUpdates {0}; + void blockUpdates(bool block) { if (block) ++m_blockUpdates; else --m_blockUpdates; } + bool updatesBlocked() { return (m_blockUpdates > 0); } + +public slots: + void setMainWindow(ScribusMainWindow *mw); + + void setDoc(ScribusDoc *d); + void setCurrentItem(PageItem *item); + void unsetDoc(); + void unsetItem(); + + void handleSelectionChanged(); + void handleUpdateRequest(int); + + void showLineWidth(double s); + void showLineValues(Qt::PenStyle p, Qt::PenCapStyle pc, Qt::PenJoinStyle pj); + + void iconSetChange(); + void languageChange(); + void unitChange(); + void localeChange(); void toggleLabelVisibility(bool v); - -private slots: - void handleLineWidth(); - void handleLineStyle(); - void handleLineJoin(); - void handleLineEnd(); - void handleDashChange(); - void handleStartArrow(int id); - void handleEndArrow(int id); - void handleStartArrowScale(double sc); - void handleEndArrowScale(double sc); - void handleLineStyle(QListWidgetItem *c); - void handleLineOpacity(double opacity); + +private slots: + void handleLineWidth(); + void handleLineType(); + void handleLineStyle(int c); + void handleLineJoin(); + void handleLineEnd(); + void handleDashChange(); + void handleStartArrow(int id); + void handleEndArrow(int id); + void handleStartArrowScale(double sc); + void handleEndArrowScale(double sc); + void handleLineOpacity(); void handleLineBlendmode(int mode); + void handleLineColor(); + void handleLineColorVector(); void swapLineMarker(); - -}; - -#endif + +}; + +#endif Index: scribus/ui/propertiespalette_linebase.ui =================================================================== --- scribus/ui/propertiespalette_linebase.ui (Revision 26070) +++ scribus/ui/propertiespalette_linebase.ui (Arbeitskopie) @@ -6,488 +6,557 @@ <rect> <x>0</x> <y>0</y> - <width>314</width> - <height>344</height> + <width>314</width> + <height>233</height> </rect> </property> - <layout class="QVBoxLayout" name="verticalLayout"> - <property name="spacing"> - <number>8</number> - </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <property name="spacing"> + <number>8</number> + </property> <property name="leftMargin"> - <number>8</number> + <number>8</number> </property> <property name="topMargin"> - <number>8</number> + <number>8</number> </property> <property name="rightMargin"> - <number>8</number> + <number>8</number> </property> <property name="bottomMargin"> - <number>8</number> + <number>8</number> </property> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_3"> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_11"> + <item> + <widget class="ComboLineStyle" name="comboLineStyle"> + <property name="sizeAdjustPolicy"> + <enum>QComboBox::AdjustToContents</enum> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_4"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_3"> <property name="spacing"> - <number>4</number> + <number>16</number> </property> <item> - <widget class="FormWidget" name="lineWidthLabel"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> + <widget class="FormWidget" name="lineColorLabel"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> </property> - <property name="label" stdset="0"> - <string>Width</string> - </property> - <property name="font"> - <font> - <pointsize>8</pointsize> - </font> - </property> - <layout class="QHBoxLayout" name="horizontalLayout_4"> - <property name="spacing"> - <number>4</number> - </property> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>0</number> - </property> - <property name="bottomMargin"> - <number>0</number> - </property> - <item> - <widget class="ScrSpinBox" name="lineWidth"> - <property name="maximumSize"> - <size> - <width>100</width> - <height>16777215</height> - </size> - </property> - <property name="specialValueText"> - <string>Hairline</string> - </property> - <property name="maximum"> - <double>300.000000000000000</double> - </property> - </widget> - </item> - </layout> + <property name="label" stdset="0"> + <string>Color</string> + </property> + <property name="font"> + <font> + <pointsize>8</pointsize> + </font> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_12"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="ColorButton" name="buttonLineColor"> + <property name="text"> + <string/> + </property> + <property name="popupMode"> + <enum>QToolButton::InstantPopup</enum> + </property> + </widget> + </item> + </layout> </widget> </item> <item> - <widget class="FormWidget" name="lineTypeLabel"> + <layout class="QHBoxLayout" name="horizontalLayout_8"> + <property name="spacing"> + <number>4</number> + </property> + <item> + <widget class="FormWidget" name="lineMaskLabel"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="label" stdset="0"> + <string>Mask</string> + </property> + <property name="font"> + <font> + <pointsize>8</pointsize> + </font> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_13"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="ColorButton" name="buttonLineMask"> + <property name="text"> + <string/> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="FormWidget" name="lineBlendmodeLabel"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="label" stdset="0"> + <string>Blendmode</string> + </property> + <property name="font"> + <font> + <pointsize>8</pointsize> + </font> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_7"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="ComboBlendMode" name="comboBlendmode"/> + </item> + </layout> + </widget> + </item> + </layout> + </item> + <item> + <widget class="FormWidget" name="lineMarkerLabel"> <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> + <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="label" stdset="0"> - <string>Type</string> + <property name="label" stdset="0"> + <string>Marker</string> </property> - <property name="font"> - <font> - <pointsize>8</pointsize> - </font> + <property name="font"> + <font> + <pointsize>8</pointsize> + </font> </property> - <layout class="QHBoxLayout" name="horizontalLayout_5"> - <property name="spacing"> - <number>4</number> - </property> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>0</number> - </property> - <property name="bottomMargin"> - <number>0</number> - </property> - <item> - <widget class="LineCombo" name="lineType"/> - </item> - </layout> + <layout class="QHBoxLayout" name="horizontalLayout"> + <property name="spacing"> + <number>4</number> + </property> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="QToolButton" name="buttonMarkerStart"> + <property name="text"> + <string/> + </property> + <property name="iconSize"> + <size> + <width>20</width> + <height>16</height> + </size> + </property> + <property name="popupMode"> + <enum>QToolButton::InstantPopup</enum> + </property> + </widget> + </item> + <item> + <widget class="QToolButton" name="buttonSwapMarker"> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item> + <widget class="QToolButton" name="buttonMarkerEnd"> + <property name="text"> + <string/> + </property> + <property name="iconSize"> + <size> + <width>20</width> + <height>16</height> + </size> + </property> + <property name="popupMode"> + <enum>QToolButton::InstantPopup</enum> + </property> + </widget> + </item> + </layout> </widget> </item> - <item> - <spacer name="horizontalSpacer_2"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>0</width> - <height>0</height> - </size> - </property> - </spacer> - </item> + <item> + <spacer name="horizontalSpacer_2"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + </spacer> + </item> </layout> </item> - <item> - <widget class="DashEditor" name="dashEditor"> - <property name="frameShape"> - <enum>QFrame::StyledPanel</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - </widget> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_10"> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_6"> <property name="spacing"> - <number>16</number> + <number>16</number> </property> <item> - <widget class="FormWidget" name="lineEndLabel"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> + <widget class="FormWidget" name="lineWidthLabel"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> </property> - <property name="label" stdset="0"> - <string>Caps</string> - </property> - <property name="font"> - <font> - <pointsize>8</pointsize> - </font> - </property> - <layout class="QHBoxLayout" name="horizontalLayout_2"> - <property name="spacing"> - <number>4</number> - </property> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>0</number> - </property> - <property name="bottomMargin"> - <number>0</number> - </property> - <item> - <widget class="QToolButton" name="buttonCapFlat"> - <property name="text"> - <string/> - </property> - <property name="checkable"> - <bool>true</bool> - </property> - <property name="checked"> - <bool>false</bool> - </property> - </widget> - </item> - <item> - <widget class="QToolButton" name="buttonCapSquare"> - <property name="text"> - <string/> - </property> - <property name="checkable"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="QToolButton" name="buttonCapRound"> - <property name="text"> - <string/> - </property> - <property name="checkable"> - <bool>true</bool> - </property> - </widget> - </item> - </layout> + <property name="label" stdset="0"> + <string>Width</string> + </property> + <property name="font"> + <font> + <pointsize>8</pointsize> + </font> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_4"> + <property name="spacing"> + <number>4</number> + </property> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="ScrSpinBox" name="lineWidth"> + <property name="maximumSize"> + <size> + <width>100</width> + <height>16777215</height> + </size> + </property> + <property name="specialValueText"> + <string>Hairline</string> + </property> + <property name="maximum"> + <double>300.000000000000000</double> + </property> + </widget> + </item> + </layout> </widget> </item> <item> - <widget class="FormWidget" name="lineJoinLabel"> + <widget class="FormWidget" name="lineTypeLabel"> <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> + <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="label" stdset="0"> - <string>Joins</string> + <property name="label" stdset="0"> + <string>Type</string> </property> - <property name="font"> - <font> - <pointsize>8</pointsize> - </font> + <property name="font"> + <font> + <pointsize>8</pointsize> + </font> </property> - <layout class="QHBoxLayout" name="horizontalLayout_9"> - <property name="spacing"> - <number>4</number> - </property> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>0</number> - </property> - <property name="bottomMargin"> - <number>0</number> - </property> - <item> - <widget class="QToolButton" name="buttonJoinMiter"> - <property name="text"> - <string/> - </property> - <property name="checkable"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="QToolButton" name="buttonJoinRound"> - <property name="text"> - <string/> - </property> - <property name="checkable"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="QToolButton" name="buttonJoinBevel"> - <property name="text"> - <string/> - </property> - <property name="checkable"> - <bool>true</bool> - </property> - </widget> - </item> - </layout> + <layout class="QHBoxLayout" name="horizontalLayout_5"> + <property name="spacing"> + <number>4</number> + </property> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="LineCombo" name="lineType"/> + </item> + </layout> </widget> </item> - <item> - <widget class="FormWidget" name="lineMarkerLabel"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="label" stdset="0"> - <string>Marker</string> - </property> - <property name="font"> - <font> - <pointsize>8</pointsize> - </font> - </property> - <layout class="QHBoxLayout" name="horizontalLayout"> - <property name="spacing"> - <number>4</number> - </property> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>0</number> - </property> - <property name="bottomMargin"> - <number>0</number> - </property> - <item> - <widget class="QToolButton" name="buttonMarkerStart"> - <property name="text"> - <string/> - </property> - <property name="iconSize"> - <size> - <width>20</width> - <height>16</height> - </size> - </property> - <property name="popupMode"> - <enum>QToolButton::InstantPopup</enum> - </property> - </widget> - </item> - <item> - <widget class="QToolButton" name="buttonSwapMarker"> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item> - <widget class="QToolButton" name="buttonMarkerEnd"> - <property name="text"> - <string/> - </property> - <property name="iconSize"> - <size> - <width>20</width> - <height>16</height> - </size> - </property> - <property name="popupMode"> - <enum>QToolButton::InstantPopup</enum> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <spacer name="horizontalSpacer_3"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>0</width> - <height>0</height> - </size> - </property> - </spacer> - </item> + <item> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + </spacer> + </item> </layout> </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_6"> - <item> - <widget class="FormWidget" name="lineOpacityLabel"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="label" stdset="0"> - <string>Opacity</string> - </property> - <property name="font"> - <font> - <pointsize>8</pointsize> - </font> - </property> - <layout class="QHBoxLayout" name="horizontalLayout_8"> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>0</number> - </property> - <property name="bottomMargin"> - <number>0</number> - </property> - <item> - <widget class="ScrSpinBox" name="numberOpacity"> - <property name="suffix"> - <string> %</string> - </property> - <property name="decimals"> - <number>0</number> - </property> - <property name="maximum"> - <double>100.000000000000000</double> - </property> - <property name="value"> - <double>100.000000000000000</double> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <widget class="FormWidget" name="lineBlendmodeLabel"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="label" stdset="0"> - <string>Blendmode</string> - </property> - <property name="font"> - <font> - <pointsize>8</pointsize> - </font> - </property> - <layout class="QHBoxLayout" name="horizontalLayout_7"> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>0</number> - </property> - <property name="bottomMargin"> - <number>0</number> - </property> - <item> - <widget class="ComboBlendMode" name="comboBlendmode"/> - </item> - </layout> - </widget> - </item> - <item> - <spacer name="horizontalSpacer"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>0</width> - <height>0</height> - </size> - </property> - </spacer> - </item> - </layout> + <item> + <widget class="DashEditor" name="dashEditor"> + <property name="frameShape"> + <enum>QFrame::StyledPanel</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + </widget> </item> - <item> - <widget class="QListWidget" name="lineStyles"/> - </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_10"> + <property name="spacing"> + <number>16</number> + </property> + <item> + <widget class="FormWidget" name="lineEndLabel"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="label" stdset="0"> + <string>Caps</string> + </property> + <property name="font"> + <font> + <pointsize>8</pointsize> + </font> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_2"> + <property name="spacing"> + <number>4</number> + </property> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="QToolButton" name="buttonCapFlat"> + <property name="text"> + <string/> + </property> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="checked"> + <bool>false</bool> + </property> + </widget> + </item> + <item> + <widget class="QToolButton" name="buttonCapSquare"> + <property name="text"> + <string/> + </property> + <property name="checkable"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QToolButton" name="buttonCapRound"> + <property name="text"> + <string/> + </property> + <property name="checkable"> + <bool>true</bool> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="FormWidget" name="lineJoinLabel"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="label" stdset="0"> + <string>Joins</string> + </property> + <property name="font"> + <font> + <pointsize>8</pointsize> + </font> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_9"> + <property name="spacing"> + <number>4</number> + </property> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="QToolButton" name="buttonJoinMiter"> + <property name="text"> + <string/> + </property> + <property name="checkable"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QToolButton" name="buttonJoinRound"> + <property name="text"> + <string/> + </property> + <property name="checkable"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QToolButton" name="buttonJoinBevel"> + <property name="text"> + <string/> + </property> + <property name="checkable"> + <bool>true</bool> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_3"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> </layout> </widget> <customwidgets> <customwidget> - <class>FormWidget</class> - <extends>QWidget</extends> - <header>ui/widgets/form_widget.h</header> - <container>1</container> - </customwidget> - <customwidget> + <class>FormWidget</class> + <extends>QWidget</extends> + <header>ui/widgets/form_widget.h</header> + <container>1</container> + </customwidget> + <customwidget> + <class>ColorButton</class> + <extends>QToolButton</extends> + <header>ui/widgets/color_button.h</header> + </customwidget> + <customwidget> <class>ScrSpinBox</class> <extends>QDoubleSpinBox</extends> - <header>ui/scrspinbox.h</header> + <header location="global">ui/scrspinbox.h</header> </customwidget> <customwidget> <class>LineCombo</class> @@ -500,28 +569,34 @@ <header>ui/dasheditor.h</header> <container>1</container> </customwidget> - <customwidget> - <class>ComboBlendMode</class> - <extends>QComboBox</extends> - <header>ui/widgets/combo_blendmode.h</header> - </customwidget> + <customwidget> + <class>ComboBlendMode</class> + <extends>QComboBox</extends> + <header>ui/widgets/combo_blendmode.h</header> + </customwidget> + <customwidget> + <class>ComboLineStyle</class> + <extends>QComboBox</extends> + <header>ui/widgets/combo_linestyle.h</header> + </customwidget> </customwidgets> - <tabstops> - <tabstop>lineWidth</tabstop> - <tabstop>lineType</tabstop> - <tabstop>buttonCapFlat</tabstop> - <tabstop>buttonCapSquare</tabstop> - <tabstop>buttonCapRound</tabstop> - <tabstop>buttonJoinMiter</tabstop> - <tabstop>buttonJoinRound</tabstop> - <tabstop>buttonJoinBevel</tabstop> - <tabstop>buttonMarkerStart</tabstop> - <tabstop>buttonSwapMarker</tabstop> - <tabstop>buttonMarkerEnd</tabstop> - <tabstop>numberOpacity</tabstop> - <tabstop>comboBlendmode</tabstop> - <tabstop>lineStyles</tabstop> - </tabstops> + <tabstops> + <tabstop>comboLineStyle</tabstop> + <tabstop>buttonLineColor</tabstop> + <tabstop>buttonLineMask</tabstop> + <tabstop>comboBlendmode</tabstop> + <tabstop>buttonMarkerStart</tabstop> + <tabstop>buttonSwapMarker</tabstop> + <tabstop>buttonMarkerEnd</tabstop> + <tabstop>lineWidth</tabstop> + <tabstop>lineType</tabstop> + <tabstop>buttonCapFlat</tabstop> + <tabstop>buttonCapSquare</tabstop> + <tabstop>buttonCapRound</tabstop> + <tabstop>buttonJoinMiter</tabstop> + <tabstop>buttonJoinRound</tabstop> + <tabstop>buttonJoinBevel</tabstop> + </tabstops> <resources/> <connections/> </ui> Index: scribus/ui/propertiespalette_shadow.cpp =================================================================== --- scribus/ui/propertiespalette_shadow.cpp (Revision 26070) +++ scribus/ui/propertiespalette_shadow.cpp (Arbeitskopie) @@ -19,67 +19,62 @@ #include "scribusdoc.h" #include "selection.h" #include "units.h" -#include "iconmanager.h" +#include "iconmanager.h" -PropertiesPalette_Shadow::PropertiesPalette_Shadow( QWidget* parent) - : QWidget(parent) +PropertiesPalette_Shadow::PropertiesPalette_Shadow( QWidget* parent) + : QWidget(parent) { - setupUi(this); + setupUi(this); - switchHasShadow->setChecked(false); + switchHasShadow->setChecked(false); - numberXOffset->setNewUnit(0); - numberXOffset->setDecimals(2); - numberXOffset->setMinimum(-200.00); - numberXOffset->setMaximum(200.00); - numberXOffset->setValue(5.0); + numberXOffset->setNewUnit(0); + numberXOffset->setDecimals(2); + numberXOffset->setMinimum(-200.00); + numberXOffset->setMaximum(200.00); + numberXOffset->setValue(5.0); - numberYOffset->setNewUnit(0); - numberYOffset->setDecimals(2); - numberYOffset->setMinimum(-200.00); - numberYOffset->setMaximum(200.00); - numberYOffset->setValue(5.0); + numberYOffset->setNewUnit(0); + numberYOffset->setDecimals(2); + numberYOffset->setMinimum(-200.00); + numberYOffset->setMaximum(200.00); + numberYOffset->setValue(5.0); - numberBlurRadius->setNewUnit(0); - numberBlurRadius->setDecimals(2); - numberBlurRadius->setMinimum(-200.00); - numberBlurRadius->setMaximum(200.00); - numberBlurRadius->setValue(2.0); + numberBlurRadius->setNewUnit(0); + numberBlurRadius->setDecimals(2); + numberBlurRadius->setMinimum(-200.00); + numberBlurRadius->setMaximum(200.00); + numberBlurRadius->setValue(2.0); - buttonColor->setCurrentColor(tr( "Black")); + buttonColor->setContext(Context::DropShadow); + buttonColor->setMenuContextType(ColorButton::Floating); - numberBlurRadius->setNewUnit(7); - numberShade->setDecimals(0); - numberShade->setMinimum(0); - numberShade->setMaximum(100); - numberShade->setValue(100); + numberBlurRadius->setNewUnit(7); + numberOpacity->setDecimals(1); + numberOpacity->setMinimum(0.0); + numberOpacity->setMaximum(100.0); + numberOpacity->setValue(100.0); - numberBlurRadius->setNewUnit(7); - numberOpacity->setDecimals(1); - numberOpacity->setMinimum(0.0); - numberOpacity->setMaximum(100.0); - numberOpacity->setValue(100.0); - QStringList modes; - modes << tr( "Normal"); - comboboxBlendMode->addItems(modes); + modes << tr( "Normal"); + comboboxBlendMode->addItems(modes); - buttonEraseShadow->setCheckable(true); - buttonInheritOpacity->setCheckable(true); + buttonEraseShadow->setCheckable(true); + buttonInheritOpacity->setCheckable(true); - languageChange(); - iconSetChange(); + languageChange(); + iconSetChange(); - connectSlots(); - connect(ScQApp, SIGNAL(iconSetChanged()), this, SLOT(iconSetChange())); + connectSlots(); + connect(ScQApp, SIGNAL(iconSetChanged()), this, SLOT(iconSetChange())); connect(ScQApp, SIGNAL(localeChanged()), this, SLOT(localeChange())); - connect(ScQApp, SIGNAL(labelVisibilityChanged(bool)), this, SLOT(toggleLabelVisibility(bool))); + connect(ScQApp, SIGNAL(labelVisibilityChanged(bool)), this, SLOT(toggleLabelVisibility(bool))); } void PropertiesPalette_Shadow::setMainWindow(ScribusMainWindow* mw) { m_ScMW = mw; - connect(m_ScMW, SIGNAL(UpdateRequest(int)), this, SLOT(handleUpdateRequest(int))); +// connect(m_ScMW, SIGNAL(UpdateRequest(int)), this, SLOT(handleUpdateRequest(int))); } void PropertiesPalette_Shadow::setDoc(ScribusDoc *d) @@ -104,80 +99,74 @@ m_haveDoc = true; m_haveItem = false; - disconnectSlots(); + disconnectSlots(); - numberXOffset->setNewUnit(m_unitIndex); - numberXOffset->setDecimals(precision); - numberXOffset->setMinimum(minXYVal); - numberXOffset->setMaximum(maxXYWHVal); - numberXOffset->setValue(minXYVal); + numberXOffset->setNewUnit(m_unitIndex); + numberXOffset->setDecimals(precision); + numberXOffset->setMinimum(minXYVal); + numberXOffset->setMaximum(maxXYWHVal); + numberXOffset->setValue(minXYVal); - numberYOffset->setNewUnit(m_unitIndex); - numberYOffset->setDecimals(precision); - numberYOffset->setMinimum(minXYVal); - numberYOffset->setMaximum(maxXYWHVal); - numberYOffset->setValue(minXYVal); + numberYOffset->setNewUnit(m_unitIndex); + numberYOffset->setDecimals(precision); + numberYOffset->setMinimum(minXYVal); + numberYOffset->setMaximum(maxXYWHVal); + numberYOffset->setValue(minXYVal); - numberBlurRadius->setNewUnit(m_unitIndex); - numberBlurRadius->setDecimals(precision); - numberBlurRadius->setMinimum(0.0); - numberBlurRadius->setMaximum(200.00); - numberBlurRadius->setValue(5); - - numberShade->setDecimals(0); - numberShade->setMinimum(0); - numberShade->setMaximum(100); - numberShade->setValue(100); - - numberOpacity->setDecimals(0); - numberOpacity->setMinimum(0); - numberOpacity->setMaximum(100); - numberOpacity->setValue(100); - - buttonColor->setDoc(m_doc); - - updateColorList(); - connectSlots(); + numberBlurRadius->setNewUnit(m_unitIndex); + numberBlurRadius->setDecimals(precision); + numberBlurRadius->setMinimum(0.0); + numberBlurRadius->setMaximum(200.00); + numberBlurRadius->setValue(5); + numberOpacity->setDecimals(0); + numberOpacity->setMinimum(0); + numberOpacity->setMaximum(100); + numberOpacity->setValue(100); + + buttonColor->setDoc(m_doc); + +// updateColorList(); + connectSlots(); + setEnabled(true); + connect(m_doc->m_Selection, SIGNAL(selectionChanged()), this, SLOT(handleSelectionChanged())); connect(m_doc , SIGNAL(docChanged()) , this, SLOT(handleSelectionChanged())); - + } -void PropertiesPalette_Shadow::connectSlots() -{ - connect(numberXOffset, &ScrSpinBox::valueChanged, this, &PropertiesPalette_Shadow::handleNewValues); - connect(numberYOffset, &ScrSpinBox::valueChanged, this, &PropertiesPalette_Shadow::handleNewValues); - connect(numberBlurRadius, &ScrSpinBox::valueChanged, this, &PropertiesPalette_Shadow::handleNewValues); - connect(numberShade, &ScrSpinBox::valueChanged, this, &PropertiesPalette_Shadow::handleNewValues); - connect(numberOpacity, &ScrSpinBox::valueChanged, this, &PropertiesPalette_Shadow::handleNewValues); - - connect(switchHasShadow, &Switch::toggled, this, &PropertiesPalette_Shadow::handleNewValues); - - connect(comboboxBlendMode, &QComboBox::currentIndexChanged, this, &PropertiesPalette_Shadow::handleNewValues); - - connect(buttonColor, &ColorButton::colorChanged, this, &PropertiesPalette_Shadow::handleNewValues); - connect(buttonEraseShadow, &QToolButton::toggled, this, &PropertiesPalette_Shadow::handleNewValues); - connect(buttonInheritOpacity, &QToolButton::toggled, this, &PropertiesPalette_Shadow::handleInheritOpacity); -} - -void PropertiesPalette_Shadow::disconnectSlots() -{ - disconnect(numberXOffset, &ScrSpinBox::valueChanged, this, &PropertiesPalette_Shadow::handleNewValues); - disconnect(numberYOffset, &ScrSpinBox::valueChanged, this, &PropertiesPalette_Shadow::handleNewValues); - disconnect(numberBlurRadius, &ScrSpinBox::valueChanged, this, &PropertiesPalette_Shadow::handleNewValues); - disconnect(numberShade, &ScrSpinBox::valueChanged, this, &PropertiesPalette_Shadow::handleNewValues); - disconnect(numberOpacity, &ScrSpinBox::valueChanged, this, &PropertiesPalette_Shadow::handleNewValues); - - disconnect(switchHasShadow, &Switch::toggled, this, &PropertiesPalette_Shadow::handleNewValues); - - disconnect(comboboxBlendMode, &QComboBox::currentIndexChanged, this, &PropertiesPalette_Shadow::handleNewValues); - - disconnect(buttonColor, &ColorButton::colorChanged, this, &PropertiesPalette_Shadow::handleNewValues); - disconnect(buttonEraseShadow, &QToolButton::toggled, this, &PropertiesPalette_Shadow::handleNewValues); - disconnect(buttonInheritOpacity, &QToolButton::toggled, this, &PropertiesPalette_Shadow::handleInheritOpacity); -} - +void PropertiesPalette_Shadow::connectSlots() +{ + connect(numberXOffset, &ScrSpinBox::valueChanged, this, &PropertiesPalette_Shadow::handleNewValues); + connect(numberYOffset, &ScrSpinBox::valueChanged, this, &PropertiesPalette_Shadow::handleNewValues); + connect(numberBlurRadius, &ScrSpinBox::valueChanged, this, &PropertiesPalette_Shadow::handleNewValues); + connect(numberOpacity, &ScrSpinBox::valueChanged, this, &PropertiesPalette_Shadow::handleNewValues); + + connect(switchHasShadow, &Switch::toggled, this, &PropertiesPalette_Shadow::handleNewValues); + + connect(comboboxBlendMode, &QComboBox::currentIndexChanged, this, &PropertiesPalette_Shadow::handleNewValues); + + connect(buttonColor, &ColorButton::colorChanged, this, &PropertiesPalette_Shadow::handleNewValues); + connect(buttonEraseShadow, &QToolButton::toggled, this, &PropertiesPalette_Shadow::handleNewValues); + connect(buttonInheritOpacity, &QToolButton::toggled, this, &PropertiesPalette_Shadow::handleInheritOpacity); +} + +void PropertiesPalette_Shadow::disconnectSlots() +{ + disconnect(numberXOffset, &ScrSpinBox::valueChanged, this, &PropertiesPalette_Shadow::handleNewValues); + disconnect(numberYOffset, &ScrSpinBox::valueChanged, this, &PropertiesPalette_Shadow::handleNewValues); + disconnect(numberBlurRadius, &ScrSpinBox::valueChanged, this, &PropertiesPalette_Shadow::handleNewValues); + disconnect(numberOpacity, &ScrSpinBox::valueChanged, this, &PropertiesPalette_Shadow::handleNewValues); + + disconnect(switchHasShadow, &Switch::toggled, this, &PropertiesPalette_Shadow::handleNewValues); + + disconnect(comboboxBlendMode, &QComboBox::currentIndexChanged, this, &PropertiesPalette_Shadow::handleNewValues); + + disconnect(buttonColor, &ColorButton::colorChanged, this, &PropertiesPalette_Shadow::handleNewValues); + disconnect(buttonEraseShadow, &QToolButton::toggled, this, &PropertiesPalette_Shadow::handleNewValues); + disconnect(buttonInheritOpacity, &QToolButton::toggled, this, &PropertiesPalette_Shadow::handleInheritOpacity); +} + void PropertiesPalette_Shadow::unsetDoc() { if (m_doc) @@ -189,6 +178,7 @@ m_haveItem = false; m_doc = nullptr; m_item = nullptr; + buttonColor->unsetDoc(); setEnabled(false); } @@ -199,11 +189,11 @@ handleSelectionChanged(); } -void PropertiesPalette_Shadow::handleUpdateRequest(int updateFlags) -{ - if (updateFlags & reqColorsUpdate) - updateColorList(); -} +//void PropertiesPalette_Shadow::handleUpdateRequest(int updateFlags) +//{ +// if (updateFlags & reqColorsUpdate) +// updateColorList(); +//} PageItem* PropertiesPalette_Shadow::currentItemFromSelection() { @@ -226,27 +216,28 @@ setDoc(item->doc()); m_haveItem = false; m_item = item; - - disconnectSlots(); - - switchHasShadow->setChecked(item->hasSoftShadow()); - numberXOffset->setValue(item->softShadowXOffset() * m_unitRatio); - numberYOffset->setValue(item->softShadowYOffset() * m_unitRatio); - numberBlurRadius->setValue(item->softShadowBlurRadius() * m_unitRatio); - buttonColor->setCurrentColor(item->softShadowColor()); - numberShade->setValue(item->softShadowShade()); - numberOpacity->setValue(qRound(100 - (item->softShadowOpacity() * 100))); - comboboxBlendMode->setCurrentIndex(item->softShadowBlendMode()); - buttonEraseShadow->setChecked(item->softShadowErasedByObject()); - buttonInheritOpacity->setChecked(item->softShadowHasObjectTransparency()); - - labelErase->setVisible(item->itemType() != PageItem::Line); - - + + disconnectSlots(); + switchHasShadow->setChecked(item->hasSoftShadow()); + numberXOffset->setValue(item->softShadowXOffset() * m_unitRatio); + numberYOffset->setValue(item->softShadowYOffset() * m_unitRatio); + numberBlurRadius->setValue(item->softShadowBlurRadius() * m_unitRatio); + numberOpacity->setValue(qRound(100 - (item->softShadowOpacity() * 100))); + comboboxBlendMode->setCurrentIndex(item->softShadowBlendMode()); + buttonEraseShadow->setChecked(item->softShadowErasedByObject()); + buttonInheritOpacity->setChecked(item->softShadowHasObjectTransparency()); + + double opacity = item->softShadowHasObjectTransparency() ? item->fillTransparency() : item->softShadowOpacity(); + buttonColor->setColor(item->softShadowColor(), item->softShadowShade(), opacity); + buttonColor->updatePreview(); + buttonColor->updateFloatingContext(); + + labelErase->setVisible(item->itemType() != PageItem::Line); + m_haveItem = true; - updateSpinBoxConstants(); - - connectSlots(); +// updateSpinBoxConstants(); + + connectSlots(); } void PropertiesPalette_Shadow::handleSelectionChanged() @@ -267,67 +258,70 @@ m_unitRatio = m_doc->unitRatio(); m_unitIndex = m_doc->unitIndex(); - disconnectSlots(); + disconnectSlots(); - numberXOffset->setNewUnit(m_unitIndex); - numberYOffset->setNewUnit(m_unitIndex); - numberBlurRadius->setNewUnit(m_unitIndex); + numberXOffset->setNewUnit(m_unitIndex); + numberYOffset->setNewUnit(m_unitIndex); + numberBlurRadius->setNewUnit(m_unitIndex); - connectSlots(); + connectSlots(); } void PropertiesPalette_Shadow::localeChange() { -// numberXOffset->localeChange(); -// numberYOffset->localeChange(); - // numberBlurRadius->localeChange(); +// numberXOffset->localeChange(); +// numberYOffset->localeChange(); + // numberBlurRadius->localeChange(); } -void PropertiesPalette_Shadow::toggleLabelVisibility(bool v) -{ - labelColor->setLabelVisibility(v); - labelBlendmode->setLabelVisibility(v); - labelHasShadow->setLabelVisibility(v); - labelShade->setLabelVisibility(v); - labelErase->setLabelVisibility(v); -} - -void PropertiesPalette_Shadow::updateColorList() +void PropertiesPalette_Shadow::toggleLabelVisibility(bool v) { - if (!m_haveDoc || !m_ScMW || m_ScMW->scriptIsRunning()) - return; - disconnectSlots(); - - QString color = buttonColor->currentColor(); - buttonColor->setColors(m_doc->PageColors); - buttonColor->setCurrentColor(color); - - connectSlots(); + labelColor->setLabelVisibility(v); + labelBlendmode->setLabelVisibility(v); + labelHasShadow->setLabelVisibility(v); + labelErase->setLabelVisibility(v); } +//void PropertiesPalette_Shadow::updateColorList() +//{ +// if (!m_haveDoc || !m_ScMW || m_ScMW->scriptIsRunning()) +// return; +// disconnectSlots(); + +//// colorPicker->loadLists(); + +//// QString color = colorPicker->colorName(); +//// colorPicker->setColors(m_doc->PageColors); +//// colorPicker->setColor(color); + +// connectSlots(); +//} + void PropertiesPalette_Shadow::handleNewValues() { if (!m_haveItem || !m_haveDoc) return; - double x = numberXOffset->value() / m_unitRatio; - double y = numberYOffset->value() / m_unitRatio; - double r = numberBlurRadius->value() / m_unitRatio; - QString color = buttonColor->currentColor(); + double x = numberXOffset->value() / m_unitRatio; + double y = numberYOffset->value() / m_unitRatio; + double r = numberBlurRadius->value() / m_unitRatio; + QString color = buttonColor->colorData().Name; if (color == CommonStrings::tr_NoneColor) color = CommonStrings::None; - int b = comboboxBlendMode->currentIndex(); - double o = (100 - numberOpacity->value()) / 100.0; - int s = numberShade->value(); + int b = comboboxBlendMode->currentIndex(); + double o = (100 - numberOpacity->value()) / 100.0; + int s = buttonColor->colorData().Shade; - m_doc->itemSelection_SetSoftShadow(switchHasShadow->isChecked(), color, x, y, r, s, o, b, buttonEraseShadow->isChecked(), buttonInheritOpacity->isChecked()); + m_doc->itemSelection_SetSoftShadow(switchHasShadow->isChecked(), color, x, y, r, s, o, b, buttonEraseShadow->isChecked(), buttonInheritOpacity->isChecked()); + + buttonColor->updatePreview(); } -void PropertiesPalette_Shadow::handleInheritOpacity() -{ - numberOpacity->setEnabled(!buttonInheritOpacity->isChecked()); - handleNewValues(); -} - +void PropertiesPalette_Shadow::handleInheritOpacity() +{ + numberOpacity->setEnabled(!buttonInheritOpacity->isChecked()); + handleNewValues(); +} + void PropertiesPalette_Shadow::changeEvent(QEvent *e) { if (e->type() == QEvent::LanguageChange) @@ -340,34 +334,33 @@ void PropertiesPalette_Shadow::languageChange() { - labelXOffset->setText(tr( "X:")); - labelYOffset->setText(tr( "Y:")); - labelBlurRadius->setText(tr( "Radius:")); - labelColor->setText(tr( "Color")); - labelShade->setText(tr( "Shade")); - labelOpacity->setText(tr( "Opacity:")); - comboboxBlendMode->languageChange(); - labelBlendmode->setText(tr( "Blendmode")); - labelErase->setText(tr( "Erase Fill")); + labelXOffset->setText(tr( "X:")); + labelYOffset->setText(tr( "Y:")); + labelBlurRadius->setText(tr( "Radius:")); + labelColor->setText(tr( "Color")); + labelOpacity->setText(tr( "Opacity:")); + comboboxBlendMode->languageChange(); + labelBlendmode->setText(tr( "Blendmode")); + labelErase->setText(tr( "Erase Fill")); - buttonEraseShadow->setToolTip(tr( "Content covers Drop Shadow")); - buttonInheritOpacity->setToolTip(tr( "Inherit Object Transparency")); -} + buttonEraseShadow->setToolTip(tr( "Content covers Drop Shadow")); + buttonInheritOpacity->setToolTip(tr( "Inherit Object Transparency")); +} -void PropertiesPalette_Shadow::iconSetChange() -{ - IconManager &im = IconManager::instance(); - - QIcon iconErase; - iconErase.addPixmap(im.loadPixmap("erase-shadow-on"), QIcon::Normal, QIcon::On); - iconErase.addPixmap(im.loadPixmap("erase-shadow-off"), QIcon::Normal, QIcon::Off); - buttonEraseShadow->setIcon(iconErase); - - QIcon iconTransparency; - iconTransparency.addPixmap(im.loadPixmap("inherit-opacity-on"), QIcon::Normal, QIcon::On); - iconTransparency.addPixmap(im.loadPixmap("inherit-opacity-off"), QIcon::Normal, QIcon::Off); - buttonInheritOpacity->setIcon(iconTransparency); - +void PropertiesPalette_Shadow::iconSetChange() +{ + IconManager &im = IconManager::instance(); + + QIcon iconErase; + iconErase.addPixmap(im.loadPixmap("erase-shadow-on"), QIcon::Normal, QIcon::On); + iconErase.addPixmap(im.loadPixmap("erase-shadow-off"), QIcon::Normal, QIcon::Off); + buttonEraseShadow->setIcon(iconErase); + + QIcon iconTransparency; + iconTransparency.addPixmap(im.loadPixmap("inherit-opacity-on"), QIcon::Normal, QIcon::On); + iconTransparency.addPixmap(im.loadPixmap("inherit-opacity-off"), QIcon::Normal, QIcon::Off); + buttonInheritOpacity->setIcon(iconTransparency); + } void PropertiesPalette_Shadow::updateSpinBoxConstants() Index: scribus/ui/propertiespalette_shadow.h =================================================================== --- scribus/ui/propertiespalette_shadow.h (Revision 26070) +++ scribus/ui/propertiespalette_shadow.h (Arbeitskopie) @@ -7,11 +7,10 @@ #ifndef PROPERTIESPALETTE_SHADOW_H #define PROPERTIESPALETTE_SHADOW_H -#include "ui_propertiespalette_shadowbase.h" - +#include "ui_propertiespalette_shadowbase.h" + #include "scribusapi.h" #include "scguardedptr.h" - #include "units.h" class PageItem; @@ -18,8 +17,9 @@ class ScribusDoc; class Selection; class ScribusMainWindow; +//class ColorPicker; -class SCRIBUS_API PropertiesPalette_Shadow : public QWidget, Ui::PropertiesPalette_ShadowBase +class SCRIBUS_API PropertiesPalette_Shadow : public QWidget, Ui::PropertiesPalette_ShadowBase { Q_OBJECT @@ -27,14 +27,14 @@ PropertiesPalette_Shadow(QWidget* parent); ~PropertiesPalette_Shadow() {}; - void updateColorList(); +// void updateColorList(); private: PageItem* currentItemFromSelection(); - void connectSlots(); - void disconnectSlots(); - + void connectSlots(); + void disconnectSlots(); + public slots: void setMainWindow(ScribusMainWindow *mw); @@ -44,17 +44,17 @@ void unsetItem(); void languageChange(); - void iconSetChange(); + void iconSetChange(); void unitChange(); void localeChange(); - void toggleLabelVisibility(bool v); + void toggleLabelVisibility(bool v); void handleSelectionChanged(); - void handleUpdateRequest(int); +// void handleUpdateRequest(int); private slots: void handleNewValues(); - void handleInheritOpacity(); + void handleInheritOpacity(); protected slots: void updateSpinBoxConstants(); Index: scribus/ui/propertiespalette_shadowbase.ui =================================================================== --- scribus/ui/propertiespalette_shadowbase.ui (Revision 26070) +++ scribus/ui/propertiespalette_shadowbase.ui (Arbeitskopie) @@ -6,559 +6,505 @@ <rect> <x>0</x> <y>0</y> - <width>341</width> - <height>150</height> + <width>324</width> + <height>150</height> </rect> </property> - <layout class="QGridLayout" name="gridLayout_2"> + <layout class="QGridLayout" name="gridLayout_2"> <property name="leftMargin"> - <number>8</number> + <number>8</number> </property> <property name="topMargin"> - <number>8</number> + <number>8</number> </property> <property name="rightMargin"> - <number>8</number> + <number>8</number> </property> <property name="bottomMargin"> - <number>8</number> + <number>8</number> </property> - <property name="horizontalSpacing"> - <number>4</number> - </property> - <property name="verticalSpacing"> - <number>8</number> - </property> - <item row="3" column="0"> - <spacer name="horizontalSpacer_4"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeType"> - <enum>QSizePolicy::Fixed</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>24</width> - <height>0</height> - </size> - </property> - </spacer> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="labelXOffset"> + <property name="horizontalSpacing"> + <number>4</number> + </property> + <property name="verticalSpacing"> + <number>8</number> + </property> + <item row="3" column="0"> + <spacer name="horizontalSpacer_4"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Fixed</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>24</width> + <height>0</height> + </size> + </property> + </spacer> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="labelXOffset"> <property name="text"> - <string>X:</string> + <string>X:</string> </property> - <property name="alignment"> - <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> - </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> </widget> </item> - <item row="2" column="4"> - <layout class="QHBoxLayout" name="horizontalLayout_2"> + <item row="2" column="4"> + <layout class="QHBoxLayout" name="horizontalLayout_2"> <property name="spacing"> - <number>4</number> + <number>4</number> </property> - <item> - <widget class="ScrSpinBox" name="numberOpacity"> - <property name="suffix"> - <string> %</string> + <item> + <widget class="ScrSpinBox" name="numberOpacity"> + <property name="suffix"> + <string> %</string> </property> - <property name="decimals"> - <number>0</number> + <property name="decimals"> + <number>0</number> </property> - <property name="maximum"> - <double>100.000000000000000</double> + <property name="maximum"> + <double>100.000000000000000</double> </property> - <property name="value"> - <double>100.000000000000000</double> + <property name="value"> + <double>100.000000000000000</double> </property> </widget> </item> - <item> - <widget class="QToolButton" name="buttonInheritOpacity"> + <item> + <widget class="QToolButton" name="buttonInheritOpacity"> <property name="text"> - <string/> + <string/> </property> </widget> </item> - </layout> - </item> - <item row="0" column="5"> - <spacer name="horizontalSpacer_3"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeType"> - <enum>QSizePolicy::Expanding</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>0</width> - <height>0</height> - </size> - </property> - </spacer> - </item> - <item row="1" column="4"> - <widget class="ScrSpinBox" name="numberBlurRadius"> - <property name="maximumSize"> - <size> - <width>90</width> - <height>16777215</height> - </size> - </property> - <property name="suffix"> - <string>mm</string> - </property> - <property name="decimals"> - <number>3</number> - </property> - <property name="maximum"> - <double>20.000000000000000</double> - </property> - <property name="value"> - <double>5.000000000000000</double> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="labelYOffset"> - <property name="text"> - <string>Y:</string> - </property> - <property name="alignment"> - <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> - </property> - </widget> - </item> - <item row="0" column="1" colspan="4"> - <layout class="QHBoxLayout" name="horizontalLayout"> - <property name="spacing"> - <number>4</number> - </property> - <item> - <widget class="FormWidget" name="labelColor"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> + </layout> + </item> + <item row="0" column="5"> + <spacer name="horizontalSpacer_3"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Expanding</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + </spacer> + </item> + <item row="1" column="4"> + <widget class="ScrSpinBox" name="numberBlurRadius"> + <property name="suffix"> + <string>mm</string> + </property> + <property name="decimals"> + <number>3</number> + </property> + <property name="maximum"> + <double>20.000000000000000</double> + </property> + <property name="value"> + <double>5.000000000000000</double> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="labelYOffset"> + <property name="text"> + <string>Y:</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="0" column="1" colspan="4"> + <layout class="QHBoxLayout" name="horizontalLayout"> + <property name="spacing"> + <number>4</number> + </property> + <item> + <widget class="FormWidget" name="labelColor"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> </property> - <property name="label" stdset="0"> - <string>Color</string> + <property name="label" stdset="0"> + <string>Color</string> </property> - <property name="font"> - <font> - <pointsize>8</pointsize> - </font> + <property name="font"> + <font> + <pointsize>8</pointsize> + </font> </property> - <layout class="QHBoxLayout" name="horizontalLayout_7"> - <property name="spacing"> - <number>4</number> - </property> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>0</number> - </property> - <property name="bottomMargin"> - <number>0</number> - </property> - <item> - <widget class="ColorButton" name="buttonColor"> - <property name="text"> - <string/> - </property> - </widget> - </item> - </layout> + <layout class="QHBoxLayout" name="horizontalLayout_7"> + <property name="spacing"> + <number>4</number> + </property> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="ColorButton" name="buttonColor"> + <property name="text"> + <string/> + </property> + </widget> + </item> + </layout> </widget> </item> - <item> - <widget class="FormWidget" name="labelShade"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> + <item> + <widget class="FormWidget" name="labelBlendmode"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> </property> - <property name="label" stdset="0"> - <string>Shade</string> + <property name="label" stdset="0"> + <string>Blendmode</string> </property> - <property name="font"> - <font> - <pointsize>8</pointsize> - </font> + <property name="font"> + <font> + <pointsize>8</pointsize> + </font> </property> - <layout class="QHBoxLayout" name="horizontalLayout_5"> - <property name="spacing"> - <number>4</number> + <layout class="QHBoxLayout" name="horizontalLayout_9"> + <property name="spacing"> + <number>4</number> </property> - <property name="leftMargin"> - <number>0</number> + <property name="leftMargin"> + <number>0</number> </property> - <property name="topMargin"> - <number>0</number> + <property name="topMargin"> + <number>0</number> </property> - <property name="rightMargin"> - <number>0</number> + <property name="rightMargin"> + <number>0</number> </property> - <property name="bottomMargin"> - <number>0</number> + <property name="bottomMargin"> + <number>0</number> </property> - <item> - <widget class="ScrSpinBox" name="numberShade"> - <property name="suffix"> - <string> %</string> - </property> - <property name="decimals"> - <number>0</number> - </property> - <property name="maximum"> - <double>100.000000000000000</double> - </property> - <property name="value"> - <double>100.000000000000000</double> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <widget class="FormWidget" name="labelBlendmode"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="label" stdset="0"> - <string>Blendmode</string> - </property> - <property name="font"> - <font> - <pointsize>8</pointsize> - </font> - </property> - <layout class="QHBoxLayout" name="horizontalLayout_9"> - <property name="spacing"> - <number>4</number> - </property> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>0</number> - </property> - <property name="bottomMargin"> - <number>0</number> - </property> - <item> - <widget class="ComboBlendMode" name="comboboxBlendMode"> - <item> - <property name="text"> - <string>Normal</string> - </property> - </item> - <item> - <property name="text"> - <string>Darken</string> - </property> - </item> - <item> - <property name="text"> - <string>Lighten</string> - </property> - </item> - <item> - <property name="text"> - <string>Multiply</string> - </property> - </item> - <item> - <property name="text"> - <string>Screen</string> - </property> - </item> - <item> - <property name="text"> - <string>Overlay</string> - </property> - </item> - <item> - <property name="text"> - <string>Hard Light</string> - </property> - </item> - <item> - <property name="text"> - <string>Soft Light</string> - </property> - </item> - <item> - <property name="text"> - <string>Difference</string> - </property> - </item> - <item> - <property name="text"> - <string>Exclusion</string> - </property> - </item> - <item> - <property name="text"> - <string>Color Dodge</string> - </property> - </item> - <item> - <property name="text"> - <string>Color Burn</string> - </property> - </item> - <item> - <property name="text"> - <string>Hue</string> - </property> - </item> - <item> - <property name="text"> - <string>Saturation</string> - </property> - </item> - <item> - <property name="text"> - <string>Color</string> - </property> - </item> - <item> - <property name="text"> - <string>Luminosity</string> - </property> - </item> - </widget> - </item> - </layout> + <item> + <widget class="ComboBlendMode" name="comboboxBlendMode"> + <item> + <property name="text"> + <string>Normal</string> + </property> + </item> + <item> + <property name="text"> + <string>Darken</string> + </property> + </item> + <item> + <property name="text"> + <string>Lighten</string> + </property> + </item> + <item> + <property name="text"> + <string>Multiply</string> + </property> + </item> + <item> + <property name="text"> + <string>Screen</string> + </property> + </item> + <item> + <property name="text"> + <string>Overlay</string> + </property> + </item> + <item> + <property name="text"> + <string>Hard Light</string> + </property> + </item> + <item> + <property name="text"> + <string>Soft Light</string> + </property> + </item> + <item> + <property name="text"> + <string>Difference</string> + </property> + </item> + <item> + <property name="text"> + <string>Exclusion</string> + </property> + </item> + <item> + <property name="text"> + <string>Color Dodge</string> + </property> + </item> + <item> + <property name="text"> + <string>Color Burn</string> + </property> + </item> + <item> + <property name="text"> + <string>Hue</string> + </property> + </item> + <item> + <property name="text"> + <string>Saturation</string> + </property> + </item> + <item> + <property name="text"> + <string>Color</string> + </property> + </item> + <item> + <property name="text"> + <string>Luminosity</string> + </property> + </item> + </widget> + </item> + </layout> </widget> </item> - <item> - <widget class="FormWidget" name="labelErase"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> + <item> + <spacer name="horizontalSpacer_5"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> </property> - <property name="label" stdset="0"> - <string>Erase Fill</string> + <property name="sizeType"> + <enum>QSizePolicy::Fixed</enum> </property> - <property name="font"> - <font> - <pointsize>8</pointsize> - </font> + <property name="sizeHint" stdset="0"> + <size> + <width>8</width> + <height>0</height> + </size> </property> - <layout class="QHBoxLayout" name="horizontalLayout_11"> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>0</number> - </property> - <property name="bottomMargin"> - <number>0</number> - </property> - <item> - <widget class="QToolButton" name="buttonEraseShadow"> - <property name="text"> - <string/> - </property> - </widget> - </item> - </layout> + </spacer> + </item> + <item> + <widget class="FormWidget" name="labelErase"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="label" stdset="0"> + <string>Erase Fill</string> + </property> + <property name="font"> + <font> + <pointsize>8</pointsize> + </font> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_11"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="QToolButton" name="buttonEraseShadow"> + <property name="text"> + <string/> + </property> + </widget> + </item> + </layout> </widget> </item> - <item> - <spacer name="horizontalSpacer"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> + <item> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> </property> - <property name="sizeHint" stdset="0"> - <size> - <width>0</width> - <height>0</height> - </size> + <property name="sizeHint" stdset="0"> + <size> + <width>0</width> + <height>0</height> + </size> </property> - </spacer> + </spacer> </item> </layout> </item> - <item row="2" column="1"> - <widget class="ScrSpinBox" name="numberYOffset"> - <property name="maximumSize"> - <size> - <width>100</width> - <height>16777215</height> - </size> - </property> - <property name="suffix"> - <string>mm</string> - </property> - <property name="decimals"> - <number>3</number> - </property> - </widget> - </item> - <item row="1" column="3"> - <widget class="QLabel" name="labelBlurRadius"> - <property name="text"> - <string>Radius:</string> - </property> - <property name="alignment"> - <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="ScrSpinBox" name="numberXOffset"> - <property name="maximumSize"> - <size> - <width>100</width> - <height>16777215</height> - </size> - </property> - <property name="suffix"> - <string>mm</string> - </property> - <property name="decimals"> - <number>3</number> - </property> - </widget> - </item> - <item row="2" column="3"> - <widget class="QLabel" name="labelOpacity"> - <property name="text"> - <string>Opacity:</string> - </property> - <property name="alignment"> - <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> - </property> - </widget> - </item> - <item row="0" column="0"> - <widget class="FormWidget" name="labelHasShadow"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="label" stdset="0"> - <string/> - </property> - <property name="font"> - <font> - <pointsize>8</pointsize> - </font> - </property> - <property name="preserveLabelSpace"> - <bool>true</bool> - </property> - <property name="labelVisibility"> - <bool>true</bool> - </property> - <layout class="QHBoxLayout" name="horizontalLayout_12"> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>0</number> - </property> - <property name="bottomMargin"> - <number>0</number> - </property> - <item> - <widget class="Switch" name="switchHasShadow"> - <property name="text"> - <string/> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item row="2" column="2"> - <spacer name="horizontalSpacer_2"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeType"> - <enum>QSizePolicy::Maximum</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>8</width> - <height>0</height> - </size> - </property> - </spacer> - </item> + <item row="2" column="1"> + <widget class="ScrSpinBox" name="numberYOffset"> + <property name="suffix"> + <string>mm</string> + </property> + <property name="decimals"> + <number>3</number> + </property> + </widget> + </item> + <item row="1" column="3"> + <widget class="QLabel" name="labelBlurRadius"> + <property name="text"> + <string>Radius:</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="ScrSpinBox" name="numberXOffset"> + <property name="suffix"> + <string>mm</string> + </property> + <property name="decimals"> + <number>3</number> + </property> + </widget> + </item> + <item row="2" column="3"> + <widget class="QLabel" name="labelOpacity"> + <property name="text"> + <string>Opacity:</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="0" column="0"> + <widget class="FormWidget" name="labelHasShadow"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="label" stdset="0"> + <string/> + </property> + <property name="font"> + <font> + <pointsize>8</pointsize> + </font> + </property> + <property name="preserveLabelSpace"> + <bool>true</bool> + </property> + <property name="labelVisibility"> + <bool>true</bool> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_12"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="Switch" name="switchHasShadow"> + <property name="text"> + <string/> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item row="2" column="2"> + <spacer name="horizontalSpacer_2"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Maximum</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>8</width> + <height>0</height> + </size> + </property> + </spacer> + </item> </layout> </widget> <customwidgets> <customwidget> - <class>FormWidget</class> - <extends>QWidget</extends> - <header>ui/widgets/form_widget.h</header> - <container>1</container> - </customwidget> - <customwidget> + <class>FormWidget</class> + <extends>QWidget</extends> + <header>ui/widgets/form_widget.h</header> + <container>1</container> + </customwidget> + <customwidget> + <class>ColorButton</class> + <extends>QToolButton</extends> + <header>ui/widgets/color_button.h</header> + </customwidget> + <customwidget> <class>ScrSpinBox</class> <extends>QDoubleSpinBox</extends> - <header>ui/scrspinbox.h</header> + <header location="global">ui/scrspinbox.h</header> </customwidget> <customwidget> - <class>ComboBlendMode</class> + <class>ComboBlendMode</class> <extends>QComboBox</extends> - <header>ui/widgets/combo_blendmode.h</header> + <header>ui/widgets/combo_blendmode.h</header> </customwidget> - <customwidget> - <class>ColorButton</class> - <extends>QToolButton</extends> - <header>ui/widgets/color_button.h</header> - </customwidget> - <customwidget> - <class>Switch</class> - <extends>QToolButton</extends> - <header>ui/widgets/switch.h</header> - </customwidget> + <customwidget> + <class>Switch</class> + <extends>QToolButton</extends> + <header>ui/widgets/switch.h</header> + </customwidget> </customwidgets> - <tabstops> - <tabstop>switchHasShadow</tabstop> - <tabstop>buttonColor</tabstop> - <tabstop>numberShade</tabstop> - <tabstop>comboboxBlendMode</tabstop> - <tabstop>buttonEraseShadow</tabstop> - <tabstop>numberXOffset</tabstop> - <tabstop>numberYOffset</tabstop> - <tabstop>numberBlurRadius</tabstop> - <tabstop>numberOpacity</tabstop> - <tabstop>buttonInheritOpacity</tabstop> - </tabstops> + <tabstops> + <tabstop>switchHasShadow</tabstop> + <tabstop>buttonColor</tabstop> + <tabstop>comboboxBlendMode</tabstop> + <tabstop>buttonEraseShadow</tabstop> + <tabstop>numberXOffset</tabstop> + <tabstop>numberYOffset</tabstop> + <tabstop>numberBlurRadius</tabstop> + <tabstop>numberOpacity</tabstop> + <tabstop>buttonInheritOpacity</tabstop> + </tabstops> <resources/> <connections/> </ui> Index: scribus/ui/propertiespalette_shape.cpp =================================================================== --- scribus/ui/propertiespalette_shape.cpp (Revision 26070) +++ scribus/ui/propertiespalette_shape.cpp (Arbeitskopie) @@ -40,13 +40,11 @@ connect(ScQApp, SIGNAL(iconSetChanged()), this, SLOT(iconSetChange())); connect(ScQApp, SIGNAL(localeChanged()), this, SLOT(localeChange())); - connect(ScQApp, SIGNAL(labelVisibilityChanged(bool)), this, SLOT(toggleLabelVisibility(bool))); + connect(ScQApp, SIGNAL(labelVisibilityChanged(bool)), this, SLOT(toggleLabelVisibility(bool))); connect(textFlowBtnGroup, SIGNAL(idClicked(int)), this, SLOT(handleTextFlow())); connect(editShape, SIGNAL(clicked()) , this, SLOT(handleShapeEdit())); connect(roundRect, SIGNAL(valueChanged(double)) , this, SLOT(handleCornerRadius())); - connect(evenOdd, SIGNAL(clicked()), this, SLOT(handleFillRule())); - connect(nonZero, SIGNAL(clicked()), this, SLOT(handleFillRule())); connect(customShape, SIGNAL(FormSel(int,int,qreal*)), this, SLOT(handleNewShape(int,int,qreal*))); roundRect->showValue(0); @@ -330,21 +328,6 @@ roundRect->setValue(m_item->cornerRadius()*m_unitRatio); showTextFlowMode(m_item->textFlowMode()); - - if (m_item->isPathText() || m_item->isTextFrame() || m_item->isImageFrame()) - { - nonZero->setChecked(false); - nonZero->setEnabled(false); - evenOdd->setChecked(false); - evenOdd->setEnabled(false); - } - else - { - nonZero->setEnabled(true); - evenOdd->setEnabled(true); - nonZero->setChecked(!m_item->fillRule); - evenOdd->setChecked(m_item->fillRule); - } setLocked(m_item->locked()); setSizeLocked(m_item->sizeLocked()); @@ -397,7 +380,7 @@ mode = PageItem::TextFlowUsesImageClipping; m_item->setTextFlowMode(mode); m_doc->changed(); - m_doc->changedPagePreview(); + m_doc->changedPagePreview(); m_doc->invalidateAll(); m_doc->regionsChanged()->update(QRect()); } @@ -432,7 +415,7 @@ connect(m_ScMW->nodePalette, SIGNAL(paletteClosed()), this, SLOT(handleShapeEditEnded())); } m_doc->changed(); - m_doc->changedPagePreview(); + m_doc->changedPagePreview(); } } @@ -457,20 +440,12 @@ m_item->setCornerRadius(roundRect->value() / m_unitRatio); m_doc->setFrameRounded(); m_doc->changed(); - m_doc->changedPagePreview(); + m_doc->changedPagePreview(); //called from setFrameRounded already! m_doc->regionsChanged()->update(QRect()); m_item->update(); } -void PropertiesPalette_Shape::handleFillRule() -{ - if (!m_haveDoc || !m_haveItem || !m_ScMW || m_ScMW->scriptIsRunning()) - return; - m_item->fillRule = evenOdd->isChecked(); - m_item->update(); -} - void PropertiesPalette_Shape::handleNewShape(int f, int c, qreal *vals) { if (!m_ScMW || m_ScMW->scriptIsRunning()) @@ -524,9 +499,6 @@ textFlowUsesBoundingBox->setIcon(iconManager.loadIcon("flow-bounding.png")); textFlowUsesContourLine->setIcon(iconManager.loadIcon("flow-contour.png")); textFlowUsesImageClipping->setIcon(iconManager.loadIcon("flow-contour.png")); - - evenOdd->setIcon(iconManager.loadIcon("fill-rule-even-odd.png")); - nonZero->setIcon(iconManager.loadIcon("fill-rule-nonzero.png")); } void PropertiesPalette_Shape::languageChange() @@ -556,9 +528,8 @@ const QLocale& l(LocaleManager::instance().userPreferredLocale()); roundRect->setLocale(l); } - -void PropertiesPalette_Shape::toggleLabelVisibility(bool v) -{ - labelTextFlow->setLabelVisibility(v); - labelFillRule->setLabelVisibility(v); -} + +void PropertiesPalette_Shape::toggleLabelVisibility(bool v) +{ + labelTextFlow->setLabelVisibility(v); +} Index: scribus/ui/propertiespalette_shape.h =================================================================== --- scribus/ui/propertiespalette_shape.h (Revision 26070) +++ scribus/ui/propertiespalette_shape.h (Arbeitskopie) @@ -73,7 +73,7 @@ void languageChange(); void unitChange(); void localeChange(); - void toggleLabelVisibility(bool v); + void toggleLabelVisibility(bool v); private slots: @@ -81,7 +81,6 @@ void handleShapeEdit(); void handleShapeEditEnded(); void handleCornerRadius(); - void handleFillRule(); void handleNewShape(int, int, qreal *); }; Index: scribus/ui/propertiespalette_shapebase.ui =================================================================== --- scribus/ui/propertiespalette_shapebase.ui (Revision 26070) +++ scribus/ui/propertiespalette_shapebase.ui (Arbeitskopie) @@ -6,323 +6,256 @@ <rect> <x>0</x> <y>0</y> - <width>238</width> - <height>107</height> + <width>238</width> + <height>107</height> </rect> </property> <layout class="QVBoxLayout" name="verticalLayout"> <property name="spacing"> - <number>8</number> + <number>8</number> </property> <property name="leftMargin"> - <number>8</number> + <number>8</number> </property> <property name="topMargin"> - <number>8</number> + <number>8</number> </property> <property name="rightMargin"> - <number>8</number> + <number>8</number> </property> <property name="bottomMargin"> - <number>8</number> + <number>8</number> </property> <item> - <layout class="QHBoxLayout" name="horizontalLayout_6"> + <layout class="QHBoxLayout" name="horizontalLayout_6"> <property name="spacing"> - <number>4</number> + <number>4</number> </property> - <item> - <widget class="Autoforms" name="customShape"> - <property name="toolTip"> - <string>Choose the shape of frame...</string> - </property> - </widget> - </item> - <item> - <widget class="QToolButton" name="editShape"> - <property name="maximumSize"> - <size> - <width>16777215</width> - <height>23</height> - </size> - </property> + <item> + <widget class="Autoforms" name="customShape"> + <property name="toolTip"> + <string>Choose the shape of frame...</string> + </property> + </widget> + </item> + <item> + <widget class="QToolButton" name="editShape"> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>23</height> + </size> + </property> <property name="text"> - <string>&Edit...</string> + <string>&Edit...</string> </property> </widget> </item> - <item> - <spacer name="horizontalSpacer"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> + <item> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> </property> - <property name="sizeType"> - <enum>QSizePolicy::Fixed</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>16</width> - <height>0</height> - </size> - </property> - </spacer> + <property name="sizeType"> + <enum>QSizePolicy::Fixed</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>16</width> + <height>0</height> + </size> + </property> + </spacer> </item> - <item> - <widget class="QLabel" name="roundRectIcon"> - <property name="minimumSize"> - <size> - <width>16</width> - <height>16</height> - </size> + <item> + <widget class="QLabel" name="roundRectIcon"> + <property name="minimumSize"> + <size> + <width>16</width> + <height>16</height> + </size> </property> - <property name="toolTip"> - <string notr="true"/> - </property> + <property name="toolTip"> + <string notr="true"/> + </property> <property name="text"> - <string/> + <string/> </property> </widget> </item> - <item> - <widget class="ScrSpinBox" name="roundRect"> - <property name="toolTip"> - <string>Set radius of corner rounding</string> + <item> + <widget class="ScrSpinBox" name="roundRect"> + <property name="toolTip"> + <string>Set radius of corner rounding</string> </property> </widget> </item> - <item> - <spacer name="horizontalSpacer_2"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> + <item> + <spacer name="horizontalSpacer_2"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> </property> - <property name="sizeHint" stdset="0"> - <size> - <width>0</width> - <height>0</height> - </size> - </property> - </spacer> + <property name="sizeHint" stdset="0"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + </spacer> </item> </layout> </item> <item> - <layout class="QHBoxLayout" name="horizontalLayout_5"> - <property name="spacing"> - <number>16</number> - </property> - <item> - <widget class="FormWidget" name="labelTextFlow"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="label" stdset="0"> - <string>Text Flow</string> - </property> - <property name="font"> - <font> - <pointsize>8</pointsize> - </font> - </property> - <layout class="QHBoxLayout" name="horizontalLayout"> - <property name="spacing"> - <number>4</number> - </property> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>0</number> - </property> - <property name="bottomMargin"> - <number>0</number> - </property> - <item> - <widget class="QToolButton" name="textFlowDisabled"> - <property name="toolTip"> - <string>Text flow around frame disabled</string> - </property> - <property name="checkable"> - <bool>true</bool> - </property> - <property name="autoExclusive"> - <bool>true</bool> - </property> - <property name="toolButtonStyle"> - <enum>Qt::ToolButtonIconOnly</enum> - </property> - <attribute name="buttonGroup"> - <string notr="true">textFlowBtnGroup</string> - </attribute> - </widget> - </item> - <item> - <widget class="QToolButton" name="textFlowUsesFrameShape"> - <property name="toolTip"> - <string>Text flow around frame shape</string> - </property> - <property name="checkable"> - <bool>true</bool> - </property> - <property name="autoExclusive"> - <bool>true</bool> - </property> - <property name="toolButtonStyle"> - <enum>Qt::ToolButtonIconOnly</enum> - </property> - <attribute name="buttonGroup"> - <string notr="true">textFlowBtnGroup</string> - </attribute> - </widget> - </item> - <item> - <widget class="QToolButton" name="textFlowUsesBoundingBox"> - <property name="toolTip"> - <string>Text flow around bounding box</string> - </property> - <property name="checkable"> - <bool>true</bool> - </property> - <property name="autoExclusive"> - <bool>true</bool> - </property> - <property name="toolButtonStyle"> - <enum>Qt::ToolButtonIconOnly</enum> - </property> - <attribute name="buttonGroup"> - <string notr="true">textFlowBtnGroup</string> - </attribute> - </widget> - </item> - <item> - <widget class="QToolButton" name="textFlowUsesContourLine"> - <property name="toolTip"> - <string>Text flow around contour line</string> - </property> - <property name="checkable"> - <bool>true</bool> - </property> - <property name="autoExclusive"> - <bool>true</bool> - </property> - <property name="toolButtonStyle"> - <enum>Qt::ToolButtonIconOnly</enum> - </property> - <attribute name="buttonGroup"> - <string notr="true">textFlowBtnGroup</string> - </attribute> - </widget> - </item> - <item> - <widget class="QToolButton" name="textFlowUsesImageClipping"> - <property name="toolTip"> - <string>Text flow around image clip path</string> - </property> - <property name="checkable"> - <bool>true</bool> - </property> - <property name="autoExclusive"> - <bool>true</bool> - </property> - <property name="toolButtonStyle"> - <enum>Qt::ToolButtonIconOnly</enum> - </property> - <attribute name="buttonGroup"> - <string notr="true">textFlowBtnGroup</string> - </attribute> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <widget class="FormWidget" name="labelFillRule"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="label" stdset="0"> - <string>Fill Rule</string> - </property> - <property name="font"> - <font> - <pointsize>8</pointsize> - </font> - </property> - <layout class="QHBoxLayout" name="horizontalLayout_4"> - <property name="spacing"> - <number>4</number> - </property> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>0</number> - </property> - <property name="bottomMargin"> - <number>0</number> - </property> - <item> - <widget class="QToolButton" name="evenOdd"> - <property name="toolTip"> - <string>Any path self-intersections or subpaths create holes in the fill (fill-rule: evenodd)</string> - </property> - <property name="checkable"> - <bool>true</bool> - </property> - <property name="autoExclusive"> - <bool>true</bool> - </property> - <attribute name="buttonGroup"> - <string notr="true">fillRuleBtnGroup</string> - </attribute> - </widget> - </item> - <item> - <widget class="QToolButton" name="nonZero"> - <property name="toolTip"> - <string>Fill is solid unless a subpath is counterdirectional (fill-rule: nonzero)</string> - </property> - <property name="checkable"> - <bool>true</bool> - </property> - <property name="autoExclusive"> - <bool>true</bool> - </property> - <attribute name="buttonGroup"> - <string notr="true">fillRuleBtnGroup</string> - </attribute> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <spacer name="horizontalSpacer_4"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - <item> + <layout class="QHBoxLayout" name="horizontalLayout_5"> + <property name="spacing"> + <number>16</number> + </property> + <item> + <widget class="FormWidget" name="labelTextFlow"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="label" stdset="0"> + <string>Text Flow</string> + </property> + <property name="font"> + <font> + <pointsize>8</pointsize> + </font> + </property> + <layout class="QHBoxLayout" name="horizontalLayout"> + <property name="spacing"> + <number>4</number> + </property> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="QToolButton" name="textFlowDisabled"> + <property name="toolTip"> + <string>Text flow around frame disabled</string> + </property> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="autoExclusive"> + <bool>true</bool> + </property> + <property name="toolButtonStyle"> + <enum>Qt::ToolButtonIconOnly</enum> + </property> + <attribute name="buttonGroup"> + <string notr="true">textFlowBtnGroup</string> + </attribute> + </widget> + </item> + <item> + <widget class="QToolButton" name="textFlowUsesFrameShape"> + <property name="toolTip"> + <string>Text flow around frame shape</string> + </property> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="autoExclusive"> + <bool>true</bool> + </property> + <property name="toolButtonStyle"> + <enum>Qt::ToolButtonIconOnly</enum> + </property> + <attribute name="buttonGroup"> + <string notr="true">textFlowBtnGroup</string> + </attribute> + </widget> + </item> + <item> + <widget class="QToolButton" name="textFlowUsesBoundingBox"> + <property name="toolTip"> + <string>Text flow around bounding box</string> + </property> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="autoExclusive"> + <bool>true</bool> + </property> + <property name="toolButtonStyle"> + <enum>Qt::ToolButtonIconOnly</enum> + </property> + <attribute name="buttonGroup"> + <string notr="true">textFlowBtnGroup</string> + </attribute> + </widget> + </item> + <item> + <widget class="QToolButton" name="textFlowUsesContourLine"> + <property name="toolTip"> + <string>Text flow around contour line</string> + </property> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="autoExclusive"> + <bool>true</bool> + </property> + <property name="toolButtonStyle"> + <enum>Qt::ToolButtonIconOnly</enum> + </property> + <attribute name="buttonGroup"> + <string notr="true">textFlowBtnGroup</string> + </attribute> + </widget> + </item> + <item> + <widget class="QToolButton" name="textFlowUsesImageClipping"> + <property name="toolTip"> + <string>Text flow around image clip path</string> + </property> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="autoExclusive"> + <bool>true</bool> + </property> + <property name="toolButtonStyle"> + <enum>Qt::ToolButtonIconOnly</enum> + </property> + <attribute name="buttonGroup"> + <string notr="true">textFlowBtnGroup</string> + </attribute> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_4"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + <item> <spacer name="verticalSpacer"> <property name="orientation"> <enum>Qt::Vertical</enum> @@ -339,12 +272,12 @@ </widget> <customwidgets> <customwidget> - <class>FormWidget</class> - <extends>QWidget</extends> - <header>ui/widgets/form_widget.h</header> - <container>1</container> - </customwidget> - <customwidget> + <class>FormWidget</class> + <extends>QWidget</extends> + <header>ui/widgets/form_widget.h</header> + <container>1</container> + </customwidget> + <customwidget> <class>ScrSpinBox</class> <extends>QDoubleSpinBox</extends> <header>ui/scrspinbox.h</header> Index: scribus/ui/propertiespalette_xyz.cpp =================================================================== --- scribus/ui/propertiespalette_xyz.cpp (Revision 26070) +++ scribus/ui/propertiespalette_xyz.cpp (Arbeitskopie) @@ -17,7 +17,6 @@ #include "appmodehelper.h" #include "appmodes.h" #include "basepointwidget.h" -#include "commonstrings.h" #include "iconmanager.h" #include "localemgr.h" #include "pageitem.h" @@ -45,8 +44,6 @@ connect(userActionSniffer, SIGNAL(actionStart()), this, SLOT(spinboxStartUserAction())); connect(userActionSniffer, SIGNAL(actionEnd()), this, SLOT(spinboxFinishUserAction())); - nameEdit->setFocusPolicy(Qt::ClickFocus); - installSniffer(xposSpin); installSniffer(yposSpin); installSniffer(widthSpin); @@ -66,7 +63,6 @@ flipV->setCheckable(true); doLock->setCheckable(true); - noPrint->setCheckable(true); noResize->setCheckable(true); buttonLineBasePoint->setVisible(false); @@ -94,9 +90,7 @@ connect(basePointWidget, SIGNAL(buttonClicked(AnchorPoint)), this, SLOT(handleBasePoint(AnchorPoint))); connect(buttonLineBasePoint, SIGNAL(toggled(bool)), this, SLOT(handleLineMode())); - connect(nameEdit , SIGNAL(Leaved()) , this, SLOT(handleNewName())); connect(doLock , SIGNAL(clicked()), this, SLOT(handleLock())); - connect(noPrint , SIGNAL(clicked()), this, SLOT(handlePrint())); connect(noResize , SIGNAL(clicked()), this, SLOT(handleLockSize())); connect(doGroup , SIGNAL(clicked()), this, SLOT(handleGrouping()) ); connect(doUnGroup, SIGNAL(clicked()), this, SLOT(handleUngrouping()) ); @@ -169,7 +163,6 @@ m_haveItem = false; m_doc = nullptr; m_item = nullptr; - nameEdit->clear(); xposSpin->setConstants(nullptr); yposSpin->setConstants(nullptr); widthSpin->setConstants(nullptr); @@ -261,16 +254,11 @@ if (!m_doc) setDoc(item->doc()); - disconnect(nameEdit, SIGNAL(Leaved()), this, SLOT(handleNewName())); - m_haveItem = false; m_item = item; - nameEdit->setText(m_item->itemName()); levelLabel->setText( QString::number(m_item->level()) ); - connect(nameEdit, SIGNAL(Leaved()), this, SLOT(handleNewName())); - //CB replaces old emits from PageItem::emitAllToGUI() disconnect(xposSpin, SIGNAL(valueChanged(double)), this, SLOT(handleNewX())); disconnect(yposSpin, SIGNAL(valueChanged(double)), this, SLOT(handleNewY())); @@ -277,7 +265,6 @@ disconnect(widthSpin, SIGNAL(valueChanged(double)), this, SLOT(handleNewW())); disconnect(heightSpin, SIGNAL(valueChanged(double)), this, SLOT(handleNewH())); disconnect(doLock, SIGNAL(clicked()), this, SLOT(handleLock())); - disconnect(noPrint, SIGNAL(clicked()), this, SLOT(handlePrint())); disconnect(noResize, SIGNAL(clicked()), this, SLOT(handleLockSize())); disconnect(flipH, SIGNAL(clicked()), this, SLOT(handleFlipH())); disconnect(flipV, SIGNAL(clicked()), this, SLOT(handleFlipV())); @@ -296,7 +283,6 @@ flipH->setCheckable(checkableFlip); flipV->setCheckable(checkableFlip); - noPrint->setChecked(!item->printEnabled()); showFlippedH(item->imageFlippedH()); showFlippedV(item->imageFlippedV()); @@ -316,7 +302,6 @@ connect(widthSpin , SIGNAL(valueChanged(double)), this, SLOT(handleNewW()), Qt::UniqueConnection); connect(heightSpin , SIGNAL(valueChanged(double)), this, SLOT(handleNewH()), Qt::UniqueConnection); connect(doLock , SIGNAL(clicked()), this, SLOT(handleLock()), Qt::UniqueConnection); - connect(noPrint , SIGNAL(clicked()), this, SLOT(handlePrint()), Qt::UniqueConnection); connect(noResize, SIGNAL(clicked()), this, SLOT(handleLockSize()), Qt::UniqueConnection); connect(flipH , SIGNAL(clicked()), this, SLOT(handleFlipH()), Qt::UniqueConnection); connect(flipV , SIGNAL(clicked()), this, SLOT(handleFlipV()), Qt::UniqueConnection); @@ -407,8 +392,6 @@ if (!m_haveDoc || !m_ScMW || m_ScMW->scriptIsRunning()) return; -// nameEdit->setEnabled(m_doc->m_Selection->count() == 1); - PageItem* currItem = currentItemFromSelection(); if (m_doc->m_Selection->count() > 1) { @@ -465,7 +448,6 @@ heightSpin->setEnabled(true); rotationSpin->setEnabled(true); - nameEdit->setEnabled(false); flipH->setCheckable( false ); flipV->setCheckable( false ); flipH->setChecked(false); @@ -489,7 +471,6 @@ doGroup->setEnabled(false); doUnGroup->setEnabled(false); } - nameEdit->setEnabled(true); basePointWidget->setEnabled(true); basePointWidget->setMode(BasePointWidget::Full); keepFrameWHRatioButton->setVisible(true); @@ -596,9 +577,7 @@ labelLock->setLabelVisibility(visibility); labelGroup->setLabelVisibility(visibility); labelLevel->setLabelVisibility(visibility); - labelName->setLabelVisibility(visibility); - labelExport->setLabelVisibility(visibility); - formWidget->setLabelVisibility(visibility); + formWidget->setLabelVisibility(visibility); } void PropertiesPalette_XYZ::showXY(double x, double y) @@ -1384,13 +1363,6 @@ m_ScMW->scrActions["itemLockSize"]->toggle(); } -void PropertiesPalette_XYZ::handlePrint() -{ - if (!m_haveDoc || !m_haveItem || !m_ScMW || m_ScMW->scriptIsRunning()) - return; - m_ScMW->scrActions["itemPrintingEnabled"]->toggle(); -} - void PropertiesPalette_XYZ::handleFlipH() { if (!m_haveDoc || !m_haveItem || !m_ScMW || m_ScMW->scriptIsRunning()) @@ -1405,53 +1377,6 @@ m_ScMW->scrActions["itemFlipV"]->toggle(); } -void PropertiesPalette_XYZ::handleNewName() -{ - if (m_ScMW->scriptIsRunning() || !m_haveDoc || !m_haveItem) - return; - QString NameOld = m_item->itemName(); - QString NameNew = nameEdit->text(); - if (NameNew.isEmpty()) - { - nameEdit->setText(NameOld); - return; - } - bool found = false; - QList<PageItem*> allItems; - for (int a = 0; a < m_doc->Items->count(); ++a) - { - PageItem *currItem = m_doc->Items->at(a); - if (currItem->isGroup()) - allItems = currItem->getAllChildren(); - else - allItems.append(currItem); - for (int ii = 0; ii < allItems.count(); ii++) - { - PageItem* item = allItems.at(ii); - if ((NameNew == item->itemName()) && (item != m_item)) - { - found = true; - break; - } - } - allItems.clear(); - } - if (found) - { - ScMessageBox::warning(this, CommonStrings::trWarning, "<qt>"+ tr("Name \"%1\" isn't unique.<br/>Please choose another.").arg(NameNew)+"</qt>"); - nameEdit->setText(NameOld); - nameEdit->setFocus(); - } - else - { - if (m_item->itemName() != nameEdit->text()) - { - m_item->setItemName(nameEdit->text()); - m_doc->changed(); - } - } -} - void PropertiesPalette_XYZ::installSniffer(ScrSpinBox *spinBox) { const QList<QObject*>& list = spinBox->children(); @@ -1523,11 +1448,6 @@ a.addPixmap(im.loadPixmap("16/lock-unlocked.png"), QIcon::Normal, QIcon::Off); doLock->setIcon(a); - QIcon a2; - a2.addPixmap(im.loadPixmap("NoPrint.png"), QIcon::Normal, QIcon::On); - a2.addPixmap(im.loadPixmap("16/document-print.png"), QIcon::Normal, QIcon::Off); - noPrint->setIcon(a2); - QIcon a3; a3.addPixmap(im.loadPixmap("framenoresize.png"), QIcon::Normal, QIcon::On); a3.addPixmap(im.loadPixmap("frameresize.png"), QIcon::Normal, QIcon::Off); @@ -1536,7 +1456,6 @@ void PropertiesPalette_XYZ::languageChange() { - setWindowTitle( tr("Properties")); retranslateUi(this); QString suffix = m_haveDoc ? unitGetSuffixFromIndex(m_doc->unitIndex()) : tr(" pt"); @@ -1599,11 +1518,6 @@ noResize->setChecked(isSizeLocked); } -void PropertiesPalette_XYZ::showPrintingEnabled(bool isPrintingEnabled) -{ - noPrint->setChecked(!isPrintingEnabled); -} - void PropertiesPalette_XYZ::showFlippedH(bool isFlippedH) { flipH->setChecked(isFlippedH); Index: scribus/ui/propertiespalette_xyz.h =================================================================== --- scribus/ui/propertiespalette_xyz.h (Revision 26070) +++ scribus/ui/propertiespalette_xyz.h (Arbeitskopie) @@ -11,13 +11,10 @@ #include "scribusapi.h" #include "scrspinbox.h" -#include "linkbutton.h" -#include "sclistboxpixmap.h" #include "scguardedptr.h" #include "units.h" class BasePointWidget; -class NameWidget; class PageItem; class ScribusDoc; class Selection; @@ -55,7 +52,7 @@ void languageChange(); void unitChange(); void localeChange(); - void toggleLabelVisibility(bool visibility); + void toggleLabelVisibility(bool visibility); void showXY(double x, double y); void showWH(double x, double y); @@ -62,7 +59,6 @@ void showRotation(double r); void showLocked(bool); void showSizeLocked(bool); - void showPrintingEnabled(bool); void showFlippedH(bool); void showFlippedV(bool); @@ -83,14 +79,12 @@ void handleRaise(); void handleFront(); void handleBack(); - void handleBasePoint(AnchorPoint m); + void handleBasePoint(AnchorPoint m); void handleLock(); void handleLockSize(); - void handlePrint(); - void handleNewName(); void handleGrouping(); void handleUngrouping(); - void handleLineMode(); + void handleLineMode(); protected slots: //virtual void reject(); Index: scribus/ui/propertiespalette_xyzbase.ui =================================================================== --- scribus/ui/propertiespalette_xyzbase.ui (Revision 26070) +++ scribus/ui/propertiespalette_xyzbase.ui (Arbeitskopie) @@ -6,298 +6,245 @@ <rect> <x>0</x> <y>0</y> - <width>318</width> - <height>262</height> + <width>358</width> + <height>207</height> </rect> </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <layout class="QGridLayout" name="gridLayout"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <layout class="QGridLayout" name="gridLayout"> <property name="leftMargin"> - <number>8</number> + <number>8</number> </property> <property name="topMargin"> - <number>8</number> + <number>8</number> </property> <property name="rightMargin"> - <number>8</number> + <number>8</number> </property> <property name="bottomMargin"> - <number>8</number> + <number>8</number> </property> - <property name="horizontalSpacing"> - <number>4</number> - </property> - <property name="verticalSpacing"> - <number>8</number> - </property> - <item row="2" column="6"> - <spacer name="horizontalSpacer_2"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> + <property name="horizontalSpacing"> + <number>4</number> + </property> + <property name="verticalSpacing"> + <number>8</number> + </property> + <item row="4" column="0"> + <widget class="FormWidget" name="formWidget"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> </property> - <property name="sizeHint" stdset="0"> - <size> - <width>0</width> - <height>0</height> - </size> + <property name="label" stdset="0"> + <string/> </property> - </spacer> + <property name="font"> + <font> + <pointsize>8</pointsize> + </font> + </property> + <property name="preserveLabelSpace"> + <bool>true</bool> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_3"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="QLabel" name="labelZ"> + <property name="text"> + <string>Z:</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + </layout> + </widget> </item> - <item row="2" column="1"> - <widget class="ScrSpinBox" name="xposSpin"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> + <item row="2" column="2"> + <spacer name="horizontalSpacer_4"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> </property> - <property name="minimumSize"> - <size> - <width>100</width> - <height>0</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>100</width> - <height>16777215</height> - </size> - </property> - <property name="toolTip"> - <string>Horizontal position of current basepoint</string> - </property> - </widget> - </item> - <item row="2" column="5" rowspan="2"> - <layout class="QVBoxLayout" name="verticalLayout_2"> - <property name="spacing"> - <number>4</number> - </property> - <item> - <widget class="LinkButton" name="keepFrameWHRatioButton"> - <property name="toolTip"> - <string>Keep the aspect ratio</string> - </property> - <property name="checkable"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="QToolButton" name="buttonLineBasePoint"> - <property name="text"> - <string/> - </property> - <property name="checkable"> - <bool>true</bool> - </property> - </widget> - </item> - </layout> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="xposLabel"> - <property name="text"> - <string>&X:</string> - </property> - <property name="alignment"> - <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> - </property> - <property name="buddy"> - <cstring>xposSpin</cstring> - </property> - </widget> - </item> - <item row="3" column="1"> - <widget class="ScrSpinBox" name="yposSpin"> - <property name="minimumSize"> - <size> - <width>100</width> - <height>0</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>100</width> - <height>16777215</height> - </size> - </property> - <property name="toolTip"> - <string>Vertical position of current basepoint</string> - </property> - </widget> - </item> - <item row="3" column="0"> - <widget class="QLabel" name="yposLabel"> - <property name="text"> - <string>&Y:</string> - </property> - <property name="alignment"> - <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> - </property> - <property name="buddy"> - <cstring>yposSpin</cstring> - </property> - </widget> - </item> - <item row="2" column="2"> - <spacer name="horizontalSpacer_4"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeType"> - <enum>QSizePolicy::Fixed</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>8</width> - <height>0</height> - </size> - </property> - </spacer> - </item> - <item row="3" column="3"> - <widget class="QLabel" name="heightLabel"> - <property name="text"> - <string>&H:</string> - </property> - <property name="alignment"> - <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> - </property> - <property name="buddy"> - <cstring>heightSpin</cstring> - </property> - </widget> - </item> - <item row="7" column="3"> - <spacer name="verticalSpacer"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>0</height> - </size> - </property> - </spacer> - </item> - <item row="3" column="4"> - <widget class="ScrSpinBox" name="heightSpin"> - <property name="minimumSize"> - <size> - <width>100</width> - <height>0</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>100</width> - <height>16777215</height> - </size> - </property> - <property name="toolTip"> - <string>Height of current selection</string> - </property> - </widget> - </item> - <item row="2" column="4"> - <widget class="ScrSpinBox" name="widthSpin"> - <property name="minimumSize"> - <size> - <width>100</width> - <height>0</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>100</width> - <height>16777215</height> - </size> - </property> - <property name="toolTip"> - <string>Width of current selection</string> - </property> - </widget> - </item> - <item row="2" column="3"> - <widget class="QLabel" name="widthLabel"> - <property name="text"> - <string>&W:</string> - </property> - <property name="alignment"> - <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> - </property> - <property name="buddy"> - <cstring>widthSpin</cstring> - </property> - </widget> - </item> - <item row="7" column="0"> - <spacer name="horizontalSpacer_5"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeType"> - <enum>QSizePolicy::Fixed</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>24</width> - <height>0</height> - </size> - </property> - </spacer> - </item> - <item row="5" column="0" colspan="6"> - <layout class="QHBoxLayout" name="horizontalLayout_2"> - <property name="spacing"> - <number>16</number> - </property> - <item> - <widget class="BasePointWidget" name="basePointWidget" native="true"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>51</width> - <height>51</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>51</width> - <height>51</height> - </size> - </property> - </widget> - </item> - <item> - <widget class="FormWidget" name="labelFlip"> - <property name="label" stdset="0"> - <string>Flip</string> - </property> - <property name="font"> - <font> - <pointsize>8</pointsize> - </font> - </property> - <property name="space"> - <number>2</number> - </property> - <layout class="QHBoxLayout" name="horizontalLayout_11"> - <property name="spacing"> - <number>4</number> - </property> + <property name="sizeType"> + <enum>QSizePolicy::Fixed</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>8</width> + <height>0</height> + </size> + </property> + </spacer> + </item> + <item row="3" column="3"> + <widget class="QLabel" name="heightLabel"> + <property name="text"> + <string>&H:</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + <property name="buddy"> + <cstring>heightSpin</cstring> + </property> + </widget> + </item> + <item row="2" column="5" rowspan="2"> + <layout class="QVBoxLayout" name="verticalLayout_2"> + <property name="spacing"> + <number>4</number> + </property> + <item> + <widget class="LinkButton" name="keepFrameWHRatioButton"> + <property name="toolTip"> + <string>Keep the aspect ratio</string> + </property> + <property name="checkable"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QToolButton" name="buttonLineBasePoint"> + <property name="text"> + <string/> + </property> + <property name="checkable"> + <bool>true</bool> + </property> + </widget> + </item> + </layout> + </item> + <item row="3" column="0"> + <widget class="QLabel" name="yposLabel"> + <property name="text"> + <string>&Y:</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + <property name="buddy"> + <cstring>yposSpin</cstring> + </property> + </widget> + </item> + <item row="2" column="3"> + <widget class="QLabel" name="widthLabel"> + <property name="text"> + <string>&W:</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + <property name="buddy"> + <cstring>widthSpin</cstring> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="xposLabel"> + <property name="text"> + <string>&X:</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + <property name="buddy"> + <cstring>xposSpin</cstring> + </property> + </widget> + </item> + <item row="3" column="1"> + <widget class="ScrSpinBox" name="yposSpin"> + <property name="minimumSize"> + <size> + <width>120</width> + <height>0</height> + </size> + </property> + <property name="toolTip"> + <string>Vertical position of current basepoint</string> + </property> + </widget> + </item> + <item row="2" column="4"> + <widget class="ScrSpinBox" name="widthSpin"> + <property name="minimumSize"> + <size> + <width>120</width> + <height>0</height> + </size> + </property> + <property name="toolTip"> + <string>Width of current selection</string> + </property> + </widget> + </item> + <item row="5" column="0" colspan="6"> + <layout class="QHBoxLayout" name="horizontalLayout_2"> + <property name="spacing"> + <number>16</number> + </property> + <item> + <widget class="BasePointWidget" name="basePointWidget" native="true"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>51</width> + <height>51</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>51</width> + <height>51</height> + </size> + </property> + </widget> + </item> + <item> + <widget class="FormWidget" name="labelFlip"> + <property name="label" stdset="0"> + <string>Flip</string> + </property> + <property name="font"> + <font> + <pointsize>8</pointsize> + </font> + </property> + <property name="space"> + <number>2</number> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_11"> + <property name="spacing"> + <number>4</number> + </property> <property name="leftMargin"> <number>0</number> </property> @@ -310,361 +257,331 @@ <property name="bottomMargin"> <number>0</number> </property> - <item> - <widget class="QToolButton" name="flipH"> + <item> + <widget class="QToolButton" name="flipH"> <property name="toolTip"> - <string>Flip horizontally</string> + <string>Flip horizontally</string> </property> </widget> </item> - <item> - <widget class="QToolButton" name="flipV"> + <item> + <widget class="QToolButton" name="flipV"> <property name="toolTip"> - <string>Flip vertically</string> + <string>Flip vertically</string> </property> </widget> </item> - </layout> - </widget> - </item> - <item> - <widget class="FormWidget" name="labelLock"> - <property name="label" stdset="0"> - <string>Lock</string> - </property> - <property name="font"> - <font> - <pointsize>8</pointsize> - </font> - </property> - <property name="space"> - <number>2</number> - </property> - <layout class="QHBoxLayout" name="horizontalLayout_12"> - <property name="spacing"> - <number>4</number> - </property> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>0</number> - </property> - <property name="bottomMargin"> - <number>0</number> - </property> - <item> - <widget class="QToolButton" name="doLock"> - <property name="toolTip"> - <string>Lock or unlock the object</string> + </layout> + </widget> + </item> + <item> + <widget class="FormWidget" name="labelLock"> + <property name="label" stdset="0"> + <string>Lock</string> + </property> + <property name="font"> + <font> + <pointsize>8</pointsize> + </font> + </property> + <property name="space"> + <number>2</number> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_12"> + <property name="spacing"> + <number>4</number> + </property> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="QToolButton" name="doLock"> + <property name="toolTip"> + <string>Lock or unlock the object</string> </property> - </widget> - </item> - <item> - <widget class="QToolButton" name="noResize"> - <property name="toolTip"> - <string>Lock or unlock the size of the object</string> - </property> - <property name="checkable"> - <bool>true</bool> - </property> </widget> </item> - </layout> - </widget> - </item> - <item> - <widget class="FormWidget" name="labelGroup"> - <property name="label" stdset="0"> - <string>Group</string> - </property> - <property name="font"> - <font> - <pointsize>8</pointsize> - </font> - </property> - <property name="space"> - <number>2</number> - </property> - <layout class="QHBoxLayout" name="horizontalLayout_17"> - <property name="spacing"> - <number>4</number> - </property> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>0</number> - </property> - <property name="bottomMargin"> - <number>0</number> - </property> - <item> - <widget class="QToolButton" name="doGroup"> + <item> + <widget class="QToolButton" name="noResize"> <property name="toolTip"> - <string>Group the selected objects</string> + <string>Lock or unlock the size of the object</string> </property> + <property name="checkable"> + <bool>true</bool> + </property> </widget> </item> - <item> - <widget class="QToolButton" name="doUnGroup"> + </layout> + </widget> + </item> + <item> + <widget class="FormWidget" name="labelGroup"> + <property name="label" stdset="0"> + <string>Group</string> + </property> + <property name="font"> + <font> + <pointsize>8</pointsize> + </font> + </property> + <property name="space"> + <number>2</number> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_17"> + <property name="spacing"> + <number>4</number> + </property> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="QToolButton" name="doGroup"> <property name="toolTip"> - <string>Ungroup the selected group</string> + <string>Group the selected objects</string> </property> </widget> </item> - </layout> - </widget> - </item> - <item> - <spacer name="horizontalSpacer_3"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>0</width> - <height>0</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - <item row="6" column="0" colspan="6"> - <layout class="QHBoxLayout" name="horizontalLayout_16"> - <property name="spacing"> - <number>16</number> - </property> - <item> - <widget class="FormWidget" name="labelName"> - <property name="label" stdset="0"> - <string>Name</string> - </property> - <property name="font"> - <font> - <pointsize>8</pointsize> - </font> - </property> - <property name="space"> - <number>2</number> - </property> - <layout class="QHBoxLayout" name="horizontalLayout_18"> - <property name="spacing"> - <number>4</number> - </property> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>0</number> - </property> - <property name="bottomMargin"> - <number>0</number> - </property> - <item> - <widget class="NameWidget" name="nameEdit"> - <property name="focusPolicy"> - <enum>Qt::ClickFocus</enum> + <item> + <widget class="QToolButton" name="doUnGroup"> + <property name="toolTip"> + <string>Ungroup the selected group</string> </property> - <property name="toolTip"> - <string>Name of selected object</string> - </property> </widget> </item> - </layout> - </widget> - </item> - <item> - <widget class="FormWidget" name="labelExport"> - <property name="label" stdset="0"> - <string>Export</string> - </property> - <property name="font"> - <font> - <pointsize>8</pointsize> - </font> - </property> - <property name="space"> - <number>2</number> - </property> - <layout class="QHBoxLayout" name="horizontalLayout_15"> - <property name="spacing"> - <number>4</number> - </property> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>0</number> - </property> - <property name="bottomMargin"> - <number>0</number> - </property> - <item> - <widget class="QToolButton" name="noPrint"> - <property name="toolTip"> - <string>Enable or disable exporting of the object</string> + </layout> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_3"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + <item row="2" column="1"> + <widget class="ScrSpinBox" name="xposSpin"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>120</width> + <height>0</height> + </size> + </property> + <property name="toolTip"> + <string>Horizontal position of current basepoint</string> + </property> + </widget> + </item> + <item row="2" column="6"> + <spacer name="horizontalSpacer_2"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + </spacer> + </item> + <item row="3" column="4"> + <widget class="ScrSpinBox" name="heightSpin"> + <property name="minimumSize"> + <size> + <width>120</width> + <height>0</height> + </size> + </property> + <property name="toolTip"> + <string>Height of current selection</string> + </property> + </widget> + </item> + <item row="6" column="3"> + <spacer name="verticalSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>0</height> + </size> + </property> + </spacer> + </item> + <item row="4" column="1" colspan="5"> + <layout class="QHBoxLayout" name="horizontalLayout"> + <property name="spacing"> + <number>16</number> + </property> + <item> + <widget class="FormWidget" name="labelRotation"> + <property name="label" stdset="0"> + <string>&Rotation</string> + </property> + <property name="font"> + <font> + <pointsize>8</pointsize> + </font> + </property> + <property name="space"> + <number>2</number> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_6"> + <property name="spacing"> + <number>4</number> + </property> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="ScrSpinBox" name="rotationSpin"> + <property name="toolTip"> + <string>Rotation of object at current basepoint</string> </property> - </widget> - </item> - </layout> - </widget> - </item> - </layout> - </item> - <item row="4" column="1" colspan="5"> - <layout class="QHBoxLayout" name="horizontalLayout"> - <property name="spacing"> - <number>16</number> - </property> - <item> - <widget class="FormWidget" name="labelRotation"> - <property name="label" stdset="0"> - <string>&Rotation</string> - </property> - <property name="font"> - <font> - <pointsize>8</pointsize> - </font> - </property> - <property name="space"> - <number>2</number> - </property> - <layout class="QHBoxLayout" name="horizontalLayout_6"> - <property name="spacing"> - <number>4</number> - </property> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>0</number> - </property> - <property name="bottomMargin"> - <number>0</number> - </property> - <item> - <widget class="ScrSpinBox" name="rotationSpin"> - <property name="toolTip"> - <string>Rotation of object at current basepoint</string> + <property name="wrapping"> + <bool>true</bool> </property> - <property name="wrapping"> - <bool>true</bool> - </property> </widget> </item> - <item> - <widget class="QToolButton" name="rotateCCW"> + <item> + <widget class="QToolButton" name="rotateCCW"> <property name="toolTip"> - <string>Rotate the selection anti-clockwise by 90º</string> + <string>Rotate the selection anti-clockwise by 90º</string> </property> - <property name="text"> - <string/> - </property> + <property name="text"> + <string/> + </property> </widget> </item> - <item> - <widget class="QToolButton" name="rotateCW"> + <item> + <widget class="QToolButton" name="rotateCW"> <property name="toolTip"> - <string>Rotate the selection clockwise by 90º</string> + <string>Rotate the selection clockwise by 90º</string> </property> - <property name="text"> - <string/> + <property name="text"> + <string/> </property> </widget> </item> </layout> - </widget> - </item> + </widget> + </item> <item> - <widget class="FormWidget" name="labelLevel"> - <property name="label" stdset="0"> - <string>Level</string> + <widget class="FormWidget" name="labelLevel"> + <property name="label" stdset="0"> + <string>Level</string> </property> - <property name="font"> - <font> - <pointsize>8</pointsize> - </font> - </property> - <property name="space"> - <number>2</number> - </property> - <property name="labelVisibility"> - <bool>true</bool> - </property> - <layout class="QHBoxLayout" name="horizontalLayout_5"> - <property name="spacing"> - <number>4</number> - </property> + <property name="font"> + <font> + <pointsize>8</pointsize> + </font> + </property> + <property name="space"> + <number>2</number> + </property> + <property name="labelVisibility"> + <bool>true</bool> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_5"> + <property name="spacing"> + <number>4</number> + </property> <property name="leftMargin"> - <number>0</number> + <number>0</number> </property> <property name="topMargin"> - <number>0</number> + <number>0</number> </property> <property name="rightMargin"> - <number>0</number> + <number>0</number> </property> <property name="bottomMargin"> - <number>0</number> + <number>0</number> </property> - <item> - <widget class="QToolButton" name="levelTop"> + <item> + <widget class="QToolButton" name="levelTop"> <property name="toolTip"> - <string>Move to front</string> + <string>Move to front</string> </property> </widget> </item> - <item> - <widget class="QToolButton" name="levelUp"> + <item> + <widget class="QToolButton" name="levelUp"> <property name="toolTip"> - <string>Move one level up</string> + <string>Move one level up</string> </property> </widget> </item> - <item> - <widget class="QToolButton" name="levelDown"> + <item> + <widget class="QToolButton" name="levelDown"> <property name="toolTip"> - <string>Move one level down</string> + <string>Move one level down</string> </property> </widget> </item> - <item> - <widget class="QToolButton" name="levelBottom"> + <item> + <widget class="QToolButton" name="levelBottom"> <property name="toolTip"> - <string>Move to back</string> + <string>Move to back</string> </property> </widget> </item> - <item> - <widget class="QLabel" name="levelLabel"> - <property name="minimumSize"> - <size> - <width>24</width> - <height>0</height> - </size> - </property> + <item> + <widget class="QLabel" name="levelLabel"> + <property name="minimumSize"> + <size> + <width>24</width> + <height>0</height> + </size> + </property> <property name="toolTip"> - <string>Indicates the level the object is on, 1 means the object is at the bottom</string> + <string>Indicates the level the object is on, 1 means the object is at the bottom</string> </property> - <property name="text"> - <string>0</string> + <property name="text"> + <string>0</string> </property> </widget> </item> @@ -672,14 +589,14 @@ </widget> </item> <item> - <spacer name="horizontalSpacer_6"> + <spacer name="horizontalSpacer_6"> <property name="orientation"> <enum>Qt::Horizontal</enum> </property> <property name="sizeHint" stdset="0"> <size> - <width>0</width> - <height>0</height> + <width>0</width> + <height>0</height> </size> </property> </spacer> @@ -686,59 +603,30 @@ </item> </layout> </item> - <item row="4" column="0"> - <widget class="FormWidget" name="formWidget"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> + <item row="6" column="0"> + <spacer name="horizontalSpacer_5"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> </property> - <property name="label" stdset="0"> - <string/> + <property name="sizeType"> + <enum>QSizePolicy::Fixed</enum> </property> - <property name="font"> - <font> - <pointsize>8</pointsize> - </font> - </property> - <property name="preserveLabelSpace"> - <bool>true</bool> - </property> - <layout class="QHBoxLayout" name="horizontalLayout_3"> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>0</number> - </property> - <property name="bottomMargin"> - <number>0</number> - </property> - <item> - <widget class="QLabel" name="labelZ"> - <property name="text"> - <string>Z:</string> - </property> - <property name="alignment"> - <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> - </property> - </widget> - </item> - </layout> - </widget> + <property name="sizeHint" stdset="0"> + <size> + <width>24</width> + <height>0</height> + </size> + </property> + </spacer> </item> </layout> </widget> <customwidgets> <customwidget> - <class>FormWidget</class> - <extends>QWidget</extends> - <header>ui/widgets/form_widget.h</header> - <container>1</container> + <class>FormWidget</class> + <extends>QWidget</extends> + <header>ui/widgets/form_widget.h</header> + <container>1</container> </customwidget> <customwidget> <class>ScrSpinBox</class> @@ -746,44 +634,38 @@ <header>ui/scrspinbox.h</header> </customwidget> <customwidget> + <class>LinkButton</class> + <extends>QToolButton</extends> + <header>ui/linkbutton.h</header> + </customwidget> + <customwidget> <class>BasePointWidget</class> <extends>QWidget</extends> <header>ui/basepointwidget.h</header> <container>1</container> </customwidget> - <customwidget> - <class>NameWidget</class> - <extends>QLineEdit</extends> - <header>ui/propertiespalette_utils.h</header> - </customwidget> - <customwidget> - <class>LinkButton</class> - <extends>QToolButton</extends> - <header>ui/linkbutton.h</header> - </customwidget> </customwidgets> - <tabstops> - <tabstop>xposSpin</tabstop> - <tabstop>yposSpin</tabstop> - <tabstop>widthSpin</tabstop> - <tabstop>heightSpin</tabstop> - <tabstop>keepFrameWHRatioButton</tabstop> - <tabstop>buttonLineBasePoint</tabstop> - <tabstop>rotationSpin</tabstop> - <tabstop>rotateCCW</tabstop> - <tabstop>rotateCW</tabstop> - <tabstop>levelTop</tabstop> - <tabstop>levelUp</tabstop> - <tabstop>levelDown</tabstop> - <tabstop>levelBottom</tabstop> - <tabstop>flipH</tabstop> - <tabstop>flipV</tabstop> - <tabstop>doLock</tabstop> - <tabstop>noResize</tabstop> - <tabstop>doGroup</tabstop> - <tabstop>doUnGroup</tabstop> - <tabstop>noPrint</tabstop> - </tabstops> + <tabstops> + <tabstop>xposSpin</tabstop> + <tabstop>yposSpin</tabstop> + <tabstop>widthSpin</tabstop> + <tabstop>heightSpin</tabstop> + <tabstop>keepFrameWHRatioButton</tabstop> + <tabstop>buttonLineBasePoint</tabstop> + <tabstop>rotationSpin</tabstop> + <tabstop>rotateCCW</tabstop> + <tabstop>rotateCW</tabstop> + <tabstop>levelTop</tabstop> + <tabstop>levelUp</tabstop> + <tabstop>levelDown</tabstop> + <tabstop>levelBottom</tabstop> + <tabstop>flipH</tabstop> + <tabstop>flipV</tabstop> + <tabstop>doLock</tabstop> + <tabstop>noResize</tabstop> + <tabstop>doGroup</tabstop> + <tabstop>doUnGroup</tabstop> + </tabstops> <resources/> <connections/> </ui> Index: scribus/ui/scrspinbox.cpp =================================================================== --- scribus/ui/scrspinbox.cpp (Revision 26070) +++ scribus/ui/scrspinbox.cpp (Arbeitskopie) @@ -28,11 +28,11 @@ ScrSpinBox::ScrSpinBox(QWidget *parent, int unitIndex) : QDoubleSpinBox(parent) { init(unitIndex); + setFocusPolicy(Qt::StrongFocus); } -ScrSpinBox::ScrSpinBox(double minValue, double maxValue, QWidget *pa, int unitIndex) : QDoubleSpinBox(pa) +ScrSpinBox::ScrSpinBox(double minValue, double maxValue, QWidget *pa, int unitIndex) : ScrSpinBox(pa, unitIndex) { - init(unitIndex); setMinimum(minValue); setMaximum(maxValue); } @@ -90,9 +90,11 @@ else angle = std::clamp(angle, minimum(), maximum()); setValue(angle); +// lineEdit()->deselect(); return; } QDoubleSpinBox::stepBy(steps); +// lineEdit()->deselect(); } void ScrSpinBox::setParameters( int s ) @@ -335,9 +337,9 @@ if (event->type() == QEvent::Wheel) { - //If read only don't spin - if (isReadOnly()) - return false; + // If read only don't spin OR avoid value changes if widget has no focus + if (isReadOnly() || !hasFocus()) + return true; auto* wheelEvent = dynamic_cast<QWheelEvent*>(event); bool shiftB = wheelEvent->modifiers() & Qt::ShiftModifier; bool altB = wheelEvent->modifiers() & Qt::AltModifier; Index: scribus/ui/transparencypalette.cpp =================================================================== --- scribus/ui/transparencypalette.cpp (Revision 26070) +++ scribus/ui/transparencypalette.cpp (nicht existent) @@ -1,535 +0,0 @@ -/* -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. -*/ -/*************************************************************************** - transparencypalette.cpp - description - ------------------- - begin : Tue Nov 17 2009 - copyright : (C) 2009 by Franz Schmid - email : 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. * - * * - ***************************************************************************/ - -#include "transparencypalette.h" -#include "sccolorengine.h" -#include "scpainter.h" -#include "scpattern.h" -#include "scribus.h" -#include "iconmanager.h" -#include "util.h" - - -TransparencyPalette::TransparencyPalette(QWidget* parent) : QWidget(parent) -{ - TGradDia = new GradientVectorDialog(this->parentWidget()); - TGradDia->hide(); - setupUi(this); - fillOpacity->setDecimals(0); - - connect(fillOpacity, SIGNAL(valueChanged(double)), this, SLOT(slotTransF(double))); - connect(blendModeFill, SIGNAL(activated(int)), this, SIGNAL(NewBlend(int))); - connect(namedGradient, SIGNAL(textActivated(QString)), this, SLOT(setNamedGradient(QString))); - connect(gradEdit, SIGNAL(gradientChanged()), this, SIGNAL(gradientChanged())); - connect(gradEditButton, SIGNAL(clicked()), this, SLOT(editGradientVector())); - connect(TGradDia, SIGNAL(NewSpecial(double,double,double,double,double,double,double,double,double,double)), this, SIGNAL(NewSpecial(double,double,double,double,double,double,double,double,double,double))); - connect(TGradDia, SIGNAL(paletteShown(bool)), this, SLOT(setActiveGradDia(bool))); - connect(gradientType, SIGNAL(activated(int)), this, SLOT(slotGradType(int))); - connect(tabWidget, SIGNAL(currentChanged(int)), this, SLOT(slotGrad(int))); - connect(patternBox, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(selectPattern(QListWidgetItem*))); - connect(editPatternProps, SIGNAL(clicked()), this, SLOT(changePatternProps())); - connect(transpCalcGradient, SIGNAL(clicked()), this, SLOT(switchGradientMode())); - connect(transpCalcPattern, SIGNAL(clicked()), this, SLOT(switchPatternMode())); - connect(usePatternInverted, SIGNAL(clicked()), this, SLOT(switchPatternMode())); -} - -void TransparencyPalette::connectSignals() -{ - connect(gradEdit, SIGNAL(gradientChanged()), this, SIGNAL(gradientChanged())); - connect(namedGradient, SIGNAL(textActivated(QString)), this, SLOT(setNamedGradient(QString))); - connect(tabWidget, SIGNAL(currentChanged(int)), this, SLOT(slotGrad(int))); - connect(gradientType, SIGNAL(activated(int)), this, SLOT(slotGradType(int))); - connect(transpCalcGradient, SIGNAL(clicked()), this, SLOT(switchGradientMode())); - connect(transpCalcPattern, SIGNAL(clicked()), this, SLOT(switchPatternMode())); - connect(usePatternInverted, SIGNAL(clicked()), this, SLOT(switchPatternMode())); -} - -void TransparencyPalette::disconnectSignals() -{ - disconnect(gradEdit, SIGNAL(gradientChanged()), this, SIGNAL(gradientChanged())); - disconnect(namedGradient, SIGNAL(textActivated(QString)), this, SLOT(setNamedGradient(QString))); - disconnect(tabWidget, SIGNAL(currentChanged(int)), this, SLOT(slotGrad(int))); - disconnect(gradientType, SIGNAL(activated(int)), this, SLOT(slotGradType(int))); - disconnect(transpCalcGradient, SIGNAL(clicked()), this, SLOT(switchGradientMode())); - disconnect(transpCalcPattern, SIGNAL(clicked()), this, SLOT(switchPatternMode())); - disconnect(usePatternInverted, SIGNAL(clicked()), this, SLOT(switchPatternMode())); -} - -void TransparencyPalette::setCurrentItem(PageItem* item) -{ - currentItem = item; - disconnectSignals(); - - if (!currentItem || !currentDoc) - return; - - setActTrans(currentItem->fillTransparency()); - setActBlend(currentItem->fillBlendmode()); - gradEdit->setGradient(currentItem->mask_gradient); - if (!currentItem->gradientMask().isEmpty()) - { - setCurrentComboItem(namedGradient, currentItem->gradientMask()); - gradEdit->setGradientEditable(false); - } - else - { - namedGradient->setCurrentIndex(0); - gradEdit->setGradientEditable(true); - } - if (currentItem->maskType() == 0) - tabWidget->setCurrentIndex(0); - else if ((currentItem->maskType() == 1) || (currentItem->maskType() == 2) || (currentItem->maskType() == 4) || (currentItem->maskType() == 5)) - tabWidget->setCurrentIndex(1); - else - tabWidget->setCurrentIndex(2); - if (patternList->isEmpty()) - tabWidget->setTabEnabled(2, false); - else - tabWidget->setTabEnabled(2, true); - transpCalcGradient->setChecked(false); - transpCalcPattern->setChecked(false); - usePatternInverted->setChecked(false); - if ((currentItem->maskType() == 4) || (currentItem->maskType() == 5)) - transpCalcGradient->setChecked(true); - if ((currentItem->maskType() == 6) || (currentItem->maskType() == 7)) - transpCalcPattern->setChecked(true); - if ((currentItem->maskType() == 7) || (currentItem->maskType() == 8)) - usePatternInverted->setChecked(true); - if ((currentItem->maskType() == 1) || (currentItem->maskType() == 4)) - gradientType->setCurrentIndex(0); - else if ((currentItem->maskType() == 2) || (currentItem->maskType() == 5)) - gradientType->setCurrentIndex(1); - if(TGradDia && gradEditButton->isChecked()) - TGradDia->setValues(currentItem->GrMaskStartX, currentItem->GrMaskStartY, currentItem->GrMaskEndX, currentItem->GrMaskEndY, currentItem->GrMaskFocalX, currentItem->GrMaskFocalY, currentItem->GrMaskScale, currentItem->GrMaskSkew, 0, 0); - - bool mirrorX, mirrorY; - const ScMaskTransform& maskTrans = currentItem->maskTransform(); - currentItem->maskFlip(mirrorX, mirrorY); - setCurrentMaskPattern(currentItem->patternMask(), maskTrans, mirrorX, mirrorY); - - connectSignals(); -} - -void TransparencyPalette::setDocument(ScribusDoc* doc) -{ - this->disconnect(SIGNAL(NewTrans(double))); - this->disconnect(SIGNAL(NewGradient(int))); - this->disconnect(SIGNAL(NewBlend(int))); - this->disconnect(SIGNAL(NewPattern(QString))); - this->disconnect(SIGNAL(NewPatternProps(double,double,double,double,double,double,double,bool,bool))); - - if (currentDoc) - { - disconnect(currentDoc->scMW(), SIGNAL(UpdateRequest(int)), this, nullptr); - } - - currentDoc = doc; - - if (doc != nullptr) - { - gradEdit->setColors(doc->PageColors); - currentUnit = doc->unitIndex(); - - updateColorList(); - - connect(this, SIGNAL(NewTrans(double)), doc, SLOT(itemSelection_SetItemFillTransparency(double))); - connect(this, SIGNAL(NewBlend(int)), doc, SLOT(itemSelection_SetItemFillBlend(int))); - connect(this, SIGNAL(NewGradient(int)), doc, SLOT(itemSelection_SetItemGradMask(int))); - connect(this, SIGNAL(NewPattern(QString)), doc, SLOT(itemSelection_SetItemPatternMask(QString))); - connect(this, SIGNAL(NewPatternProps(double,double,double,double,double,double,double,bool,bool)), doc, SLOT(itemSelection_SetItemPatternMaskProps(double,double,double,double,double,double,double,bool,bool))); - connect(doc->scMW(), SIGNAL(UpdateRequest(int)), this, SLOT(handleUpdateRequest(int))); - } -} - -void TransparencyPalette::handleUpdateRequest(int updateFlags) -{ - if (updateFlags & reqColorsUpdate) - updateColorList(); -} - -void TransparencyPalette::updateColorList() -{ - if (!currentDoc) - return; - - if (currentItem) - disconnectSignals(); - - this->setColors(currentDoc->PageColors); - this->setPatterns(¤tDoc->docPatterns); - this->setGradients(¤tDoc->docGradients); - - if (currentItem) - setCurrentItem(currentItem); -} - -void TransparencyPalette::updateCList() -{ - gradEdit->setColors(colorList); -} - -void TransparencyPalette::updateGradientList() -{ - disconnect(namedGradient, SIGNAL(textActivated(QString)), this, SLOT(setNamedGradient(QString))); - namedGradient->clear(); - namedGradient->setIconSize(QSize(48, 12)); - namedGradient->addItem( tr("Custom")); - QStringList patK = gradientList->keys(); - patK.sort(); - for (int i = 0; i < patK.count(); i++) - { - VGradient gr = gradientList->value(patK[i]); - QImage pixm(48, 12, QImage::Format_ARGB32_Premultiplied); - QPainter pb; - QBrush b(QColor(205,205,205), IconManager::instance().loadPixmap("testfill.png")); - pb.begin(&pixm); - pb.fillRect(0, 0, 48, 12, b); - pb.end(); - ScPainter *p = new ScPainter(&pixm, 48, 12); - p->setPen(Qt::black, 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin); - p->setFillMode(ScPainter::Gradient); - p->fill_gradient = gr; - p->setGradient(VGradient::linear, FPoint(0,6), FPoint(48, 6), FPoint(0,0), 1, 0); - p->drawRect(0, 0, 48, 12); - p->end(); - delete p; - QPixmap pm; - pm = QPixmap::fromImage(pixm); - namedGradient->addItem(pm, patK[i]); - } - connect(namedGradient, SIGNAL(textActivated(QString)), this, SLOT(setNamedGradient(QString))); -} - -void TransparencyPalette::setGradients(QHash<QString, VGradient> *docGradients) -{ - gradientList = docGradients; - updateGradientList(); -} - -void TransparencyPalette::setColors(const ColorList& newColorList) -{ - colorList.clear(); - colorList = newColorList; - updateCList(); -} - -void TransparencyPalette::slotGrad(int number) -{ - if (number == 1) - { - disconnect(namedGradient, SIGNAL(textActivated(QString)), this, SLOT(setNamedGradient(QString))); - if (!currentItem->gradientMask().isEmpty()) - { - setCurrentComboItem(namedGradient, currentItem->gradientMask()); - gradEdit->setGradient(gradientList->value(currentItem->gradientMask())); - gradEdit->setGradientEditable(false); - } - else - { - namedGradient->setCurrentIndex(0); - gradEdit->setGradient(currentItem->mask_gradient); - gradEdit->setGradientEditable(true); - } - if (gradientType->currentIndex() == 0) - { - if (transpCalcGradient->isChecked()) - emit NewGradient(GradMask_LinearLumAlpha); - else - emit NewGradient(GradMask_Linear); - } - else - { - if (transpCalcGradient->isChecked()) - emit NewGradient(GradMask_RadialLumAlpha); - else - emit NewGradient(GradMask_Radial); - } - connect(namedGradient, SIGNAL(textActivated(QString)), this, SLOT(setNamedGradient(QString))); - } - else if (number == 2) - { - if (transpCalcPattern->isChecked()) - { - if (usePatternInverted->isChecked()) - emit NewGradient(GradMask_PatternLumAlphaInverted); - else - emit NewGradient(GradMask_PatternLumAlpha); - } - else - { - if (usePatternInverted->isChecked()) - emit NewGradient(GradMask_PatternInverted); - else - emit NewGradient(GradMask_Pattern); - } - } - else - emit NewGradient(GradMask_None); -} - -void TransparencyPalette::slotGradType(int type) -{ - if (type == 0) - { - if (transpCalcGradient->isChecked()) - emit NewGradient(GradMask_LinearLumAlpha); - else - emit NewGradient(GradMask_Linear); - } - else - { - if (transpCalcGradient->isChecked()) - emit NewGradient(GradMask_RadialLumAlpha); - else - emit NewGradient(GradMask_Radial); - } -} - -void TransparencyPalette::setNamedGradient(const QString &name) -{ - if (namedGradient->currentIndex() == 0) - { - gradEdit->setGradient(currentItem->mask_gradient); - currentItem->setGradientMask(""); - gradEdit->setGradientEditable(true); - } - else - { - gradEdit->setGradient(gradientList->value(name)); - gradEdit->setGradientEditable(false); - currentItem->setGradientMask(name); - } - if (gradientType->currentIndex() == 0) - { - if (transpCalcGradient->isChecked()) - emit NewGradient(GradMask_LinearLumAlpha); - else - emit NewGradient(GradMask_Linear); - } - else - { - if (transpCalcGradient->isChecked()) - emit NewGradient(GradMask_RadialLumAlpha); - else - emit NewGradient(GradMask_Radial); - } -} - -void TransparencyPalette::switchGradientMode() -{ - if (gradientType->currentIndex() == 0) - { - if (transpCalcGradient->isChecked()) - emit NewGradient(GradMask_LinearLumAlpha); - else - emit NewGradient(GradMask_Linear); - } - else - { - if (transpCalcGradient->isChecked()) - emit NewGradient(GradMask_RadialLumAlpha); - else - emit NewGradient(GradMask_Radial); - } -} - -void TransparencyPalette::switchPatternMode() -{ - if (transpCalcPattern->isChecked()) - { - if (usePatternInverted->isChecked()) - emit NewGradient(GradMask_PatternLumAlphaInverted); - else - emit NewGradient(GradMask_PatternLumAlpha); - } - else - { - if (usePatternInverted->isChecked()) - emit NewGradient(GradMask_PatternInverted); - else - emit NewGradient(GradMask_Pattern); - } -} - -void TransparencyPalette::editGradientVector() -{ - if (gradEditButton->isChecked()) - { - TGradDia->unitChange(currentDoc->unitIndex()); - TGradDia->setValues(currentItem->GrMaskStartX, currentItem->GrMaskStartY, currentItem->GrMaskEndX, currentItem->GrMaskEndY, currentItem->GrMaskFocalX, currentItem->GrMaskFocalY, currentItem->GrMaskScale, currentItem->GrMaskSkew, 0, 0); - if ((currentItem->GrMask == GradMask_Linear) || (currentItem->GrMask == GradMask_LinearLumAlpha)) - TGradDia->selectLinear(); - else - TGradDia->selectRadial(); - TGradDia->show(); - } - else - { - TGradDia->hide(); - } - emit editGradient(); -} - -void TransparencyPalette::setActiveGradDia(bool active) -{ - if (!active) - { - gradEditButton->setChecked(false); - emit editGradient(); - } -} - -void TransparencyPalette::setSpecialGradient(double x1, double y1, double x2, double y2, double fx, double fy, double sg, double sk) -{ - if (TGradDia) - TGradDia->setValues(x1, y1, x2, y2, fx, fy, sg, sk, 0, 0); -} - -void TransparencyPalette::hideEditedPatterns(QStringList names) -{ - for (int a = 0; a < names.count(); a++) - { - QList<QListWidgetItem*> items = patternBox->findItems(names[a], Qt::MatchExactly); - if (items.count() > 0) - items[0]->setHidden(true); - } -} - -void TransparencyPalette::updatePatternList() -{ - disconnect(patternBox, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(selectPattern(QListWidgetItem*))); - patternBox->clear(); - patternBox->setIconSize(QSize(48, 48)); - QStringList patK = patternList->keys(); - patK.sort(); - for (int a = 0; a < patK.count(); a++) - { - ScPattern sp = patternList->value(patK[a]); - QPixmap pm; - if (sp.getPattern()->width() >= sp.getPattern()->height()) - pm = QPixmap::fromImage(sp.getPattern()->scaledToWidth(48, Qt::SmoothTransformation)); - else - pm = QPixmap::fromImage(sp.getPattern()->scaledToHeight(48, Qt::SmoothTransformation)); - QPixmap pm2(48, 48); - pm2.fill(palette().color(QPalette::Base)); - QPainter p; - p.begin(&pm2); - p.drawPixmap(24 - pm.width() / 2, 24 - pm.height() / 2, pm); - p.end(); - QListWidgetItem *item = new QListWidgetItem(pm2, patK[a], patternBox); - item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); - } - patternBox->clearSelection(); - connect(patternBox, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(selectPattern(QListWidgetItem*))); -} - -void TransparencyPalette::setPatterns(QHash<QString, ScPattern> *docPatterns) -{ - patternList = docPatterns; - updatePatternList(); -} - -void TransparencyPalette::selectPattern(QListWidgetItem *c) -{ - if (c == nullptr) - return; - emit NewPattern(c->text()); -} - -void TransparencyPalette::setCurrentMaskPattern(const QString& pattern, const ScMaskTransform& maskTrans, bool mirrorX, bool mirrorY) -{ - disconnect(patternBox, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(selectPattern(QListWidgetItem*))); - QList<QListWidgetItem*> itl = patternBox->findItems(pattern, Qt::MatchExactly); - if (itl.count() != 0) - { - QListWidgetItem *it = itl[0]; - patternBox->setCurrentItem(it); - } - else - patternBox->clearSelection(); - m_maskTransform = maskTrans; - m_Pattern_mirrorX = mirrorX; - m_Pattern_mirrorY = mirrorY; - connect(patternBox, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(selectPattern(QListWidgetItem*))); -} - -void TransparencyPalette::changePatternProps() -{ - PatternPropsDialog *dia = new PatternPropsDialog(this, currentUnit, false); - dia->spinXscaling->setValue(m_maskTransform.scaleX * 100.0); - dia->spinYscaling->setValue(m_maskTransform.scaleY * 100.0); - if (m_maskTransform.scaleX == m_maskTransform.scaleY) - dia->keepScaleRatio->setChecked(true); - dia->spinXoffset->setValue(m_maskTransform.offsetX); - dia->spinYoffset->setValue(m_maskTransform.offsetY); - dia->spinAngle->setValue(m_maskTransform.rotation); - double asina = atan(m_maskTransform.skewX); - dia->spinXSkew->setValue(asina / (M_PI / 180.0)); - double asinb = atan(m_maskTransform.skewY); - dia->spinYSkew->setValue(asinb / (M_PI / 180.0)); - dia->FlipH->setChecked(m_Pattern_mirrorX); - dia->FlipV->setChecked(m_Pattern_mirrorY); - connect(dia, SIGNAL(NewPatternProps(double,double,double,double,double,double,double,bool,bool)), this, SIGNAL(NewPatternProps(double,double,double,double,double,double,double,bool,bool))); - dia->exec(); - m_maskTransform.scaleX = dia->spinXscaling->value() / 100.0; - m_maskTransform.scaleY = dia->spinYscaling->value() / 100.0; - m_maskTransform.offsetX = dia->spinXoffset->value(); - m_maskTransform.offsetY = dia->spinYoffset->value(); - m_maskTransform.rotation = dia->spinAngle->value(); - double a = M_PI / 180.0 * dia->spinXSkew->value(); - double b = M_PI / 180.0 * dia->spinYSkew->value(); - double sina = tan(a); - double sinb = tan(b); - m_maskTransform.skewX = sina; - m_maskTransform.skewY = sinb; - m_Pattern_mirrorX = dia->FlipH->isChecked(); - m_Pattern_mirrorY = dia->FlipV->isChecked(); - delete dia; -} - -void TransparencyPalette::setActTrans(double val) -{ - disconnect(fillOpacity, SIGNAL(valueChanged(double)), this, SLOT(slotTransF(double))); - fillOpacity->setValue(qRound(100 - (val * 100))); - connect(fillOpacity, SIGNAL(valueChanged(double)), this, SLOT(slotTransF(double))); -} - -void TransparencyPalette::setActBlend(int val) -{ - disconnect(blendModeFill, SIGNAL(activated(int)), this, SIGNAL(NewBlend(int))); - blendModeFill->setCurrentIndex(val); - connect(blendModeFill, SIGNAL(activated(int)), this, SIGNAL(NewBlend(int))); -} - -void TransparencyPalette::slotTransF(double val) -{ - emit NewTrans((100 - val) / 100.0); -} - -void TransparencyPalette::unitChange(double, double, int unitIndex) -{ - if (TGradDia) - TGradDia->unitChange(unitIndex); - currentUnit = unitIndex; -} - Index: scribus/ui/transparencypalette.h =================================================================== --- scribus/ui/transparencypalette.h (Revision 26070) +++ scribus/ui/transparencypalette.h (nicht existent) @@ -1,120 +0,0 @@ -/* -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. -*/ -/*************************************************************************** - transparencypalette.h - description - ------------------- - begin : Tue Nov 17 2009 - copyright : (C) 2009 by Franz Schmid - email : 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. * - * * - ***************************************************************************/ - -#ifndef TRANSPARENCYPALETTE_H -#define TRANSPARENCYPALETTE_H - -#include <QPointer> -#include <QGroupBox> -#include <QPushButton> -#include <QToolButton> -#include <QWidget> - -#include "scribusapi.h" -#include "gradienteditor.h" -#include "scribusdoc.h" -#include "ui/scrpalettebase.h" -#include "ui_transparencypalette.h" -#include "ui/gradientvectordialog.h" -#include "ui/patternpropsdialog.h" - -class ColorListBox; -class LinkButton; -class PageItem; -class ScrSpinBox; -class ScPattern; - -/** - *@author Franz Schmid - */ - -class SCRIBUS_API TransparencyPalette : public QWidget, Ui::transparencyPalette -{ - Q_OBJECT - - friend class PropertiesPalette; - friend class PropertiesPalette_Group; - -public: - TransparencyPalette(QWidget* parent); - ~TransparencyPalette() = default; - - void setDocument(ScribusDoc* doc); - void setCurrentItem(PageItem* item); - - void updateColorList(); - - void setColors(const ColorList& newColorList); - void setGradients(QHash<QString, VGradient> *docGradients); - void setPatterns(QHash<QString, ScPattern> *docPatterns); - - void setCurrentMaskPattern(const QString& pattern, const ScMaskTransform& maskTrans, bool mirrorX, bool mirrorY); - void setSpecialGradient(double x1, double y1, double x2, double y2, double fx, double fy, double sg, double sk); - -public slots: - void handleUpdateRequest(int); - - void slotGrad(int number); - void slotGradType(int type); - void setNamedGradient(const QString &name); - void switchGradientMode(); - void switchPatternMode(); - void editGradientVector(); - void setActiveGradDia(bool active); - void hideEditedPatterns(QStringList names); - void selectPattern(QListWidgetItem *c); - void changePatternProps(); - void setActTrans(double); - void setActBlend(int); - void slotTransF(double val); - void unitChange(double, double, int unitIndex); - -signals: - void NewTrans(double); - void NewBlend(int); - void gradientChanged(); - void editGradient(); - void NewGradient(int); - void NewSpecial(double, double, double, double, double, double, double, double, double, double); - void NewPattern(QString); - void NewPatternProps(double, double, double, double, double, double, double, bool, bool); - -protected: - GradientVectorDialog* TGradDia {nullptr}; - QPointer<ScribusDoc> currentDoc; - PageItem* currentItem {nullptr}; - ColorList colorList; - int currentUnit {0}; - QHash<QString, ScPattern> *patternList {nullptr}; - QHash<QString, VGradient> *gradientList {nullptr}; - ScMaskTransform m_maskTransform; - bool m_Pattern_mirrorX {false}; - bool m_Pattern_mirrorY {false}; - - void connectSignals(); - void disconnectSignals(); - void updateCList(); - void updateGradientList(); - void updatePatternList(); -}; -#endif Index: scribus/ui/transparencypalette.ui =================================================================== --- scribus/ui/transparencypalette.ui (Revision 26070) +++ scribus/ui/transparencypalette.ui (nicht existent) @@ -1,418 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>transparencyPalette</class> - <widget class="QWidget" name="transparencyPalette"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>236</width> - <height>379</height> - </rect> - </property> - <layout class="QVBoxLayout" name="verticalLayout_6"> - <property name="spacing"> - <number>3</number> - </property> - <property name="leftMargin"> - <number>3</number> - </property> - <property name="topMargin"> - <number>3</number> - </property> - <property name="rightMargin"> - <number>3</number> - </property> - <property name="bottomMargin"> - <number>3</number> - </property> - <item> - <widget class="QStackedWidget" name="stackedWidget"> - <property name="currentIndex"> - <number>0</number> - </property> - <widget class="QWidget" name="page_2"> - <layout class="QVBoxLayout" name="verticalLayout_3"> - <property name="spacing"> - <number>3</number> - </property> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>0</number> - </property> - <property name="bottomMargin"> - <number>0</number> - </property> - <item> - <widget class="QTabWidget" name="tabWidget"> - <property name="currentIndex"> - <number>0</number> - </property> - <widget class="QWidget" name="tabSolid"> - <attribute name="title"> - <string>Solid</string> - </attribute> - <layout class="QVBoxLayout" name="verticalLayout_2"> - <property name="spacing"> - <number>3</number> - </property> - <property name="leftMargin"> - <number>3</number> - </property> - <property name="topMargin"> - <number>3</number> - </property> - <property name="rightMargin"> - <number>3</number> - </property> - <property name="bottomMargin"> - <number>3</number> - </property> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_4"> - <property name="spacing"> - <number>3</number> - </property> - <item> - <widget class="QLabel" name="label_4"> - <property name="text"> - <string>Opacity:</string> - </property> - </widget> - </item> - <item> - <widget class="ScrSpinBox" name="fillOpacity"> - <property name="toolTip"> - <string>Set the transparency for the color selected</string> - </property> - <property name="suffix"> - <string> %</string> - </property> - <property name="maximum"> - <double>100.000000000000000</double> - </property> - <property name="singleStep"> - <double>10.000000000000000</double> - </property> - <property name="value"> - <double>100.000000000000000</double> - </property> - </widget> - </item> - </layout> - </item> - <item> - <spacer name="verticalSpacer_2"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>195</height> - </size> - </property> - </spacer> - </item> - </layout> - </widget> - <widget class="QWidget" name="tabGradient"> - <attribute name="title"> - <string>Gradient</string> - </attribute> - <layout class="QVBoxLayout" name="verticalLayout_4"> - <property name="spacing"> - <number>3</number> - </property> - <property name="leftMargin"> - <number>3</number> - </property> - <property name="topMargin"> - <number>3</number> - </property> - <property name="rightMargin"> - <number>3</number> - </property> - <property name="bottomMargin"> - <number>3</number> - </property> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_3"> - <property name="spacing"> - <number>3</number> - </property> - <item> - <widget class="QComboBox" name="gradientType"> - <item> - <property name="text"> - <string>Linear</string> - </property> - </item> - <item> - <property name="text"> - <string>Radial</string> - </property> - </item> - </widget> - </item> - <item> - <widget class="QToolButton" name="gradEditButton"> - <property name="toolTip"> - <string>Move the start of the gradient vector with the left mouse button pressed and move the end of the gradient vector with the right mouse button pressed</string> - </property> - <property name="text"> - <string>Move Vector</string> - </property> - <property name="checkable"> - <bool>true</bool> - </property> - </widget> - </item> - </layout> - </item> - <item> - <widget class="GradientEditor" name="gradEdit"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Expanding"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>200</width> - <height>173</height> - </size> - </property> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - </widget> - </item> - <item> - <widget class="QComboBox" name="namedGradient"/> - </item> - <item> - <widget class="QCheckBox" name="transpCalcGradient"> - <property name="text"> - <string>Use Luminosity as Alpha</string> - </property> - </widget> - </item> - </layout> - </widget> - <widget class="QWidget" name="tabPattern"> - <attribute name="title"> - <string>Pattern</string> - </attribute> - <layout class="QVBoxLayout" name="verticalLayout"> - <property name="spacing"> - <number>3</number> - </property> - <property name="leftMargin"> - <number>3</number> - </property> - <property name="topMargin"> - <number>3</number> - </property> - <property name="rightMargin"> - <number>3</number> - </property> - <property name="bottomMargin"> - <number>3</number> - </property> - <item> - <widget class="QListWidget" name="patternBox"> - <property name="movement"> - <enum>QListView::Snap</enum> - </property> - <property name="flow"> - <enum>QListView::LeftToRight</enum> - </property> - <property name="isWrapping" stdset="0"> - <bool>true</bool> - </property> - <property name="resizeMode"> - <enum>QListView::Adjust</enum> - </property> - <property name="viewMode"> - <enum>QListView::IconMode</enum> - </property> - <property name="wordWrap"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_2"> - <property name="spacing"> - <number>3</number> - </property> - <item> - <widget class="QToolButton" name="editPatternProps"> - <property name="text"> - <string>Properties...</string> - </property> - </widget> - </item> - <item> - <spacer name="horizontalSpacer_3"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - <item> - <widget class="QCheckBox" name="transpCalcPattern"> - <property name="text"> - <string>Use Luminosity as Alpha</string> - </property> - </widget> - </item> - <item> - <widget class="QCheckBox" name="usePatternInverted"> - <property name="text"> - <string>Use inverted Pattern</string> - </property> - </widget> - </item> - </layout> - </widget> - </widget> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_5"> - <property name="spacing"> - <number>3</number> - </property> - <item> - <widget class="QLabel" name="label_5"> - <property name="text"> - <string>Blend Mode:</string> - </property> - </widget> - </item> - <item> - <widget class="QComboBox" name="blendModeFill"> - <item> - <property name="text"> - <string>Normal</string> - </property> - </item> - <item> - <property name="text"> - <string>Darken</string> - </property> - </item> - <item> - <property name="text"> - <string>Lighten</string> - </property> - </item> - <item> - <property name="text"> - <string>Multiply</string> - </property> - </item> - <item> - <property name="text"> - <string>Screen</string> - </property> - </item> - <item> - <property name="text"> - <string>Overlay</string> - </property> - </item> - <item> - <property name="text"> - <string>Hard Light</string> - </property> - </item> - <item> - <property name="text"> - <string>Soft Light</string> - </property> - </item> - <item> - <property name="text"> - <string>Difference</string> - </property> - </item> - <item> - <property name="text"> - <string>Exclusion</string> - </property> - </item> - <item> - <property name="text"> - <string>Color Dodge</string> - </property> - </item> - <item> - <property name="text"> - <string>Color Burn</string> - </property> - </item> - <item> - <property name="text"> - <string>Hue</string> - </property> - </item> - <item> - <property name="text"> - <string>Saturation</string> - </property> - </item> - <item> - <property name="text"> - <string>Color</string> - </property> - </item> - <item> - <property name="text"> - <string>Luminosity</string> - </property> - </item> - </widget> - </item> - </layout> - </item> - </layout> - </widget> - </widget> - </item> - </layout> - </widget> - <customwidgets> - <customwidget> - <class>ScrSpinBox</class> - <extends>QDoubleSpinBox</extends> - <header location="global">ui/scrspinbox.h</header> - </customwidget> - <customwidget> - <class>GradientEditor</class> - <extends>QFrame</extends> - <header>ui/gradienteditor.h</header> - <container>1</container> - </customwidget> - </customwidgets> - <resources/> - <connections/> -</ui> Index: scribus/ui/widgets/color_button.cpp =================================================================== --- scribus/ui/widgets/color_button.cpp (Revision 26070) +++ scribus/ui/widgets/color_button.cpp (Arbeitskopie) @@ -2,10 +2,14 @@ #include <QPainter> #include <QPainterPath> +#include <QEvent> #include "util_gui.h" +#include "popup_menu.h" +#include "floatingwindow.h" +#include "scribusdoc.h" #include "sccolorengine.h" -#include "popup_menu.h" -#include "ui/colorlistbox.h" +#include "manager/widget_manager.h" +#include "ui/colorpicker/colorpicker.h" /* ********************************************************************************* * * @@ -15,18 +19,6 @@ ColorButton::ColorButton(QWidget *parent) : QToolButton(parent) { setFixedSize(26,26); - - m_colorName = CommonStrings::tr_NoneColor; - - colorList = new ColorListBox(this); - colorList->setPixmapType(ColorListBox::fancyPixmap); - - setPopupMode(QToolButton::InstantPopup); - setContextMenuPolicy(Qt::ContextMenuPolicy::CustomContextMenu); - PopupMenu *m_menu = new PopupMenu(colorList); - setMenu(m_menu); - - connect(colorList, &ColorListBox::currentTextChanged, this, &ColorButton::setCurrentColor); } /* ********************************************************************************* * @@ -35,6 +27,13 @@ * * ********************************************************************************* */ + +void ColorButton::setHasDot(bool enabled) +{ + m_hasDot = enabled; + update(); +} + bool ColorButton::hasDot() { return m_hasDot; @@ -49,77 +48,584 @@ QSize ColorButton::foregroundDotSize() { - int smallestSize = qMin(height()/2, width()/2); + int smallestSize = 12; return QSize(smallestSize, smallestSize); } -QString ColorButton::currentColor() const +void ColorButton::setMenuContextType(MenuContextType type) { - QString colorName(m_colorName); - if (colorName == CommonStrings::tr_NoneColor) - colorName = CommonStrings::None; + m_contextType = type; - return colorName; + switch (m_contextType) + { + case MenuContextType::None: + break; + case MenuContextType::Floating: + setPopupMode(QToolButton::InstantPopup); + setContextMenuPolicy(Qt::ContextMenuPolicy::NoContextMenu); + setMenu(nullptr); + connect(this, &QToolButton::pressed, this, &ColorButton::toggleFloatingContext); + break; + case MenuContextType::List: + stickyWidget->adjustSize(); + popupmenu = new PopupMenu(stickyWidget); + setPopupMode(QToolButton::InstantPopup); + setContextMenuPolicy(Qt::ContextMenuPolicy::CustomContextMenu); + setMenu(popupmenu); + disconnect(this, &QToolButton::pressed, this, &ColorButton::toggleFloatingContext); + break; + } } -void ColorButton::setColors(const ColorList &list, bool insertNone) +void ColorButton::setContextWidget(QWidget *widget) { - ColorListModel* clm = qobject_cast<ColorListModel*>(colorList->model()); - if (!clm) - return; + stickyWidget = widget; + setMenuContextType(MenuContextType::List); - clm->setColorList(list, insertNone); } -void ColorButton::setCurrentColor(QString colorName) +QWidget *ColorButton::contextWidget() { - if (!m_doc) - return; + if (m_contextType == MenuContextType::List) + return stickyWidget; + else + return nullptr; +} - m_colorName = colorName; +void ColorButton::setBackground(QBrush background) +{ + m_background = background; + update(); +} - if (m_colorName == CommonStrings::tr_NoneColor || m_colorName == CommonStrings::None) +QBrush ColorButton::background() +{ + if (isEnabled()) + return m_background; + else + return QBrush(palette().color(QPalette::Window)); +} + + +void ColorButton::setForeground(QBrush foreground) +{ + m_foreground = foreground; + if (m_hasDot) + update(); +} + +QBrush ColorButton::foreground() +{ + if (isEnabled()) + return m_foreground; + else + return QBrush(palette().color(QPalette::Window)); +} + +void ColorButton::setGeneral(int overprint) +{ + CPGeneralData i; + i.overprint = overprint; + + setGeneralData(i); +} + +void ColorButton::setGeneralData(CPGeneralData data) +{ + m_itemData = data; +} + +CPGeneralData ColorButton::generalData() +{ + return m_itemData; +} + +void ColorButton::setColor(QString colorName, double shade, double opacity) +{ + CPColorData c; + c.Name = colorName; + c.Shade = shade; + c.Opacity = opacity; + + setColorData(c); + +} + +void ColorButton::setColorData(CPColorData data) +{ + m_colorData = data; +} + +CPColorData ColorButton::colorData() const +{ + return m_colorData; +} + +QColor ColorButton::color() const +{ + if (!m_doc || colorName() == CommonStrings::tr_NoneColor || colorName() == CommonStrings::None) + return QColor(); + else { - m_colorName = CommonStrings::tr_NoneColor; - setBackground( renderEmptyPattern(this->size())); + ScColor sColor(0, 0, 0); + + if (m_doc->PageColors.contains(colorName())) + sColor = m_doc->PageColors.value(colorName()); + + QColor qColor = ScColorEngine::getDisplayColor(sColor, m_doc, colorData().Shade); + qColor.setAlphaF(1 - colorData().Opacity); + + return qColor; } +} + +QString ColorButton::colorName() const +{ + return colorData().Name; +} + +void ColorButton::setGradient(QString gradientName, VGradient gradient, VGradient::VGradientRepeatMethod repeatMethod, + QString color1, QString color2, QString color3, QString color4, + double color1Shade, double color2Shade, double color3Shade, double color4Shade, + double color1Alpha, double color2Alpha, double color3Alpha, double color4Alpha + ) +{ + CPGradientData g; + g.Gradient = gradient; + g.Name = gradientName; + g.Type = m_type; + g.repeatMethod = repeatMethod; + g.Color1Name = color1; + g.Color2Name = color2; + g.Color3Name = color3; + g.Color4Name = color4; + g.Color1Shade = color1Shade; + g.Color2Shade = color2Shade; + g.Color3Shade = color3Shade; + g.Color4Shade = color4Shade; + g.Color1Alpha = color1Alpha; + g.Color2Alpha = color2Alpha; + g.Color3Alpha = color3Alpha; + g.Color4Alpha = color4Alpha; + + setGradientData(g); + +} + +void ColorButton::setGradientData(CPGradientData data) +{ + m_gradientData = data; +} + +CPGradientData ColorButton::gradientData() const +{ + return m_gradientData; +} + +VGradient ColorButton::gradient() const +{ + return gradientData().Gradient; +} + +QString ColorButton::gradientName() const +{ + return gradientData().Name; +} + +void ColorButton::setGradientMesh(QString colorName, double shade, double opacity) +{ + CPColorData c; + c.Name = colorName; + c.Shade = shade; + c.Opacity = opacity; + + setGradientMeshData(c); +} + +void ColorButton::setGradientMeshData(CPColorData data) +{ + m_meshColorData = data; +} + +CPColorData ColorButton::gradientMeshData() const +{ + return m_meshColorData; +} + +void ColorButton::setGradientVector(double StartX, double StartY, double EndX, double EndY, double FocalX, double FocalY, double Scale, double Skew, + double C1X, double C1Y, double C2X, double C2Y, double C3X, double C3Y, double C4X, double C4Y, double C5X, double C5Y) +{ + CPGradientVectorData gvd; + gvd.StartX = StartX; + gvd.StartY = StartY; + gvd.EndX = EndX; + gvd.EndY = EndY; + gvd.FocalX = FocalX; + gvd.FocalY = FocalY; + gvd.Scale = Scale; + gvd.Skew = Skew; + gvd.C1X = C1X; + gvd.C1Y = C1Y; + gvd.C2X = C2X; + gvd.C2Y = C2Y; + gvd.C3X = C3X; + gvd.C3Y = C3Y; + gvd.C4X = C4X; + gvd.C4Y = C4Y; + gvd.C5X = C5X; + gvd.C5Y = C5Y; + + setGradientVectorData(gvd); +} + +void ColorButton::setGradientVectorData(CPGradientVectorData data) +{ + m_gradientVectorData = data; +} + +CPGradientVectorData ColorButton::gradientVectorData() +{ + return m_gradientVectorData; +} + +void ColorButton::setPattern(QString patternName, double offsetX, double offsetY, double scaleX, double scaleY, double skewX, double skewY, + double angle, double spacing, bool mirrorX, bool mirrorY, bool onPath + ) +{ + CPPatternData p; + p.Name = patternName; + p.OffsetX = offsetX; + p.OffsetY = offsetY; + p.ScaleX = scaleX; + p.ScaleY = scaleY; + p.SkewX = skewX; + p.SkewY = skewY; + p.Spacing = spacing; + p.Angle = angle; + p.MirrorX = mirrorX; + p.MirrorY = mirrorY; + p.OnPath = onPath; + + setPatternData(p); + +} + +void ColorButton::setPatternData(CPPatternData data) +{ + m_patternData = data; +} + +CPPatternData ColorButton::patternData() const +{ + return m_patternData; +} + +ScPattern ColorButton::pattern() const +{ + if(!m_doc) + return ScPattern(); + + return m_doc->docPatterns.find(patternData().Name).value(); +} + +QString ColorButton::patternName() const +{ + return patternData().Name; +} + +void ColorButton::setHatch(int type, double distance, double angle, bool hasBackground, QString backgroundColor, QString foregroundColor) +{ + CPHatchData h; + h.Type = type; + h.Angle = angle; + h.Distance = distance; + h.HasBackgroundColor = hasBackground; + h.ColorBackground = backgroundColor; + h.ColorForeground = foregroundColor; + + setHatchData(h); + +} + +void ColorButton::setHatchData(CPHatchData data) +{ + m_hatchData = data; +} + +CPHatchData ColorButton::hatchData() const +{ + return m_hatchData; +} + +void ColorButton::setModeByType(int type) +{ + if (isMask()) + { + switch(type) + { + case GradMask_None: + m_mode = Mode::Solid; + break; + case GradMask_Linear: + case GradMask_LinearLumAlpha: + case GradMask_Radial: + case GradMask_RadialLumAlpha: + m_mode = Mode::Gradient; + break; + case GradMask_Pattern: + case GradMask_PatternInverted: + case GradMask_PatternLumAlpha: + case GradMask_PatternLumAlphaInverted: + m_mode = Mode::Pattern; + break; + } + } else { - ScColor sColor(0, 0, 0); + switch(type) + { + case Gradient_None: + m_mode = Mode::Solid; + break; + case Gradient_Linear: + case Gradient_Conical: + case Gradient_Radial: + case Gradient_Diamond: + case Gradient_4Colors: + case Gradient_Mesh: + case Gradient_PatchMesh: + m_mode = Mode::Gradient; + break; + case Gradient_Pattern: + m_mode = Mode::Pattern; + break; + case Gradient_Hatch: + m_mode = Mode::Hatch; + break; + } + } +} - if(m_doc->PageColors.contains(m_colorName)) - sColor = m_doc->PageColors.value(m_colorName); +QColor ColorButton::colorFromName(QString colorName, double shade) +{ + ScColor sColor(0, 0, 0); + shade = qBound(0.0, shade, 100.0); - QColor qColor = ScColorEngine::getDisplayColor(sColor, m_doc); + if(m_doc->PageColors.contains(colorName)) + sColor = m_doc->PageColors.value(colorName); - int smallSide = backgroundDotSize().width(); - setBackground( renderSplitColor(QSize(smallSide, smallSide), qColor )); + return ScColorEngine::getDisplayColor(sColor, m_doc, shade); +} + +QBrush ColorButton::colorBrush(QSize size, QString colorName, double shade, double opacity) +{ + if (!m_doc || colorName == CommonStrings::tr_NoneColor || colorName == CommonStrings::None) + return renderEmptyPattern(size); + else + return renderColor(size, colorFromName(colorName, 100.0), colorFromName(colorName, shade), opacity); +} + +Context ColorButton::context() +{ + return m_context; +} + +void ColorButton::setContext(Context config) +{ + m_context = config; +} + +QBrush ColorButton::renderBrush() +{ + switch(m_mode) + { + default: + case Mode::Solid: + return brushSolid(); + break; + case Mode::Gradient: + return brushGradient(); + break; + case Mode::Hatch: + return brushHatch(); + break; + case Mode::Pattern: + return brushPattern(); + break; } - // update color list - QSignalBlocker sig(colorList); - colorList->setCurrentColor(m_colorName); + return QBrush(); +} - emit colorChanged(); +bool ColorButton::isMask() +{ + return (m_context == Context::FillMask || m_context == Context::LineMask) ? true : false; } -QBrush ColorButton::background() +QBrush ColorButton::brushSolid() { - if (isEnabled()) - return m_background; + if (!m_doc || m_colorData.Name == CommonStrings::tr_NoneColor || m_colorData.Name == CommonStrings::None) + return renderEmptyPattern(this->size()); else - return QBrush(palette().color(QPalette::Window)); + { + ScColor sColor(0, 0, 0); + + if(m_doc->PageColors.contains(m_colorData.Name)) + sColor = m_doc->PageColors.value(m_colorData.Name); + + // simulate grey tone for mask color + if(isMask()) + { + QColor qColor = ScColorEngine::getDisplayColor(sColor, m_doc, m_colorData.Opacity * 100.0); + return renderColor(this->size(), qColor, qColor, 1); + } + else + { + QColor qColorShade = ScColorEngine::getDisplayColor(sColor, m_doc, m_colorData.Shade); + QColor qColor = ScColorEngine::getDisplayColor(sColor, m_doc, 100.0); + return renderColor(this->size(), qColor, qColorShade, 1 - m_colorData.Opacity); + } + } } -QBrush ColorButton::foreground() +QBrush ColorButton::brushGradient() { - if (isEnabled()) - return m_foreground; + if (isMask()) + { + switch(type()) + { + default: + case GradMask_Linear: + case GradMask_LinearLumAlpha: + return QBrush(renderGradientLinear(this->size(), gradientData().Gradient)); + break; + case GradMask_Radial: + case GradMask_RadialLumAlpha: + return QBrush(renderGradientRadial(this->size(), gradientData().Gradient)); + break; + } + } else - return QBrush(palette().color(QPalette::Window)); + { + switch(type()) + { + case Gradient_Linear: + return QBrush(renderGradientLinear(this->size(), gradientData().Gradient)); + break; + case Gradient_Radial: + return QBrush(renderGradientRadial(this->size(), gradientData().Gradient)); + break; + case Gradient_Diamond: + return QBrush(renderGradientDiamond(this->size(), gradientData().Gradient)); + break; + case Gradient_Conical: + return QBrush(renderGradientConical(this->size(), gradientData().Gradient)); + break; + case Gradient_4Colors: + { + QColor color1; + QColor color2; + QColor color3; + QColor color4; + + if (m_gradientData.Color1Name != CommonStrings::None) + { + if (m_doc->PageColors.contains(m_gradientData.Color1Name)) + { + const ScColor& col = m_doc->PageColors[m_gradientData.Color1Name]; + color1 = ScColorEngine::getShadeColorProof(col, m_doc, m_gradientData.Color1Shade); + } + } + + if (m_gradientData.Color2Name != CommonStrings::None) + { + if (m_doc->PageColors.contains(m_gradientData.Color2Name)) + { + const ScColor& col = m_doc->PageColors[m_gradientData.Color2Name]; + color2 = ScColorEngine::getShadeColorProof(col, m_doc, m_gradientData.Color2Shade); + } + } + + if (m_gradientData.Color3Name != CommonStrings::None) + { + if (m_doc->PageColors.contains(m_gradientData.Color3Name)) + { + const ScColor& col = m_doc->PageColors[m_gradientData.Color3Name]; + color3 = ScColorEngine::getShadeColorProof(col, m_doc, m_gradientData.Color3Shade); + } + } + + if (m_gradientData.Color4Name != CommonStrings::None) + { + if (m_doc->PageColors.contains(m_gradientData.Color4Name)) + { + const ScColor& col = m_doc->PageColors[m_gradientData.Color4Name]; + color4 = ScColorEngine::getShadeColorProof(col, m_doc, m_gradientData.Color4Shade); + } + } + + return QBrush(renderGradient4Colors(this->size(), color1, color2, color3, color4)); + } + break; + case Gradient_Mesh: + return QBrush(renderGradientMesh(this->size())); + break; + case Gradient_PatchMesh: + return QBrush(renderGradientPatchMesh(this->size())); + break; + } + } + + return QBrush(); } +QBrush ColorButton::brushHatch() +{ + if(!m_doc) + return QBrush(); + + QColor fg; + QColor bg; + + if (m_hatchData.ColorForeground != CommonStrings::None) + fg = colorFromName(m_hatchData.ColorForeground, 100.0); + + if (m_hatchData.ColorBackground != CommonStrings::None) + bg = colorFromName(m_hatchData.ColorBackground, 100.0); + + return renderHatch(this->size(), + m_hatchData.Type, + m_hatchData.Distance, + m_hatchData.Angle, + m_hatchData.HasBackgroundColor, + bg, + fg + ); +} + +QBrush ColorButton::brushPattern() +{ + if (!m_doc || m_patternData.Name.isEmpty()) + return QBrush(); + + if (!m_doc->docPatterns.contains(m_patternData.Name)) + return QBrush(); + + return QBrush(*pattern().getPattern()); +} + +void ColorButton::setType(int type) +{ + m_type = type; + setModeByType(type); +} + +void ColorButton::setDoc(ScribusDoc *doc) +{ + m_doc = doc; +} + /* ********************************************************************************* * * * Methods @@ -126,40 +632,168 @@ * * ********************************************************************************* */ -void ColorButton::renderFill(QPainter *painter, QPointF center, qreal radius, QBrush background) +void ColorButton::updatePreview() { - renderCircularHandle(painter, center, radius, background); + setBackground(renderBrush()); } -/* ********************************************************************************* * - * - * Slots - * - * ********************************************************************************* */ -void ColorButton::setBackground(QBrush background) +void ColorButton::updateFloatingContext() { - m_background = background; - update(); + if (floatingWidget) + { + ColorPicker *colorPicker = qobject_cast<ColorPicker*>(floatingWidget->child()); + + if (colorPicker) + if (colorPicker->colorButton() == this) + updateColorPicker(colorPicker); + } } -void ColorButton::setForeground(QBrush foreground) +void ColorButton::unsetDoc() { - m_foreground = foreground; - if(m_hasDot) - update(); + setDoc(nullptr); } -void ColorButton::setHasDot(bool enabled) + +void ColorButton::toggleFloatingContext() { - m_hasDot = enabled; - update(); + WidgetManager &widgetManager = WidgetManager::instance(); + floatingWidget = widgetManager.colorPickerWindow(); + + if (floatingWidget){ + ColorPicker *colorPicker = qobject_cast<ColorPicker*>(floatingWidget->child()); + if (colorPicker) + { + updateColorPicker(colorPicker); + + connect(colorPicker, &ColorPicker::colorChanged, this, &ColorButton::updateColor); + connect(colorPicker, &ColorPicker::gradientChanged, this, &ColorButton::updateGradient); + connect(colorPicker, &ColorPicker::gradientVectorChanged, this, &ColorButton::updateGradientVector); + connect(colorPicker, &ColorPicker::gradientMeshChanged, this, &ColorButton::updateGradientMesh); + connect(colorPicker, &ColorPicker::hatchChanged, this, &ColorButton::updateHatch); + connect(colorPicker, &ColorPicker::patternChanged, this, &ColorButton::updatePattern); + connect(colorPicker, &ColorPicker::colorListChanged, this, &ColorButton::updateFloatingContext); + + floatingWidget->show(this); + } + } + } -void ColorButton::setDoc(ScribusDoc *doc) +void ColorButton::updateColor() { - m_doc = doc; + ColorPicker * colorPicker = qobject_cast<ColorPicker*>(sender()); + + if (colorPicker) + if (colorPicker->colorButton() == this) + { + setType(colorPicker->type()); + setGeneralData(colorPicker->generalData()); + setColorData(colorPicker->colorData()); + setToolTip(colorPicker->toolTipText()); + updatePreview(); + emit changed(); + emit colorChanged(); + } } +void ColorButton::updateGradient() +{ + ColorPicker * colorPicker = qobject_cast<ColorPicker*>(sender()); + + if (colorPicker) + if (colorPicker->colorButton() == this) + { + setType(colorPicker->type()); + setGeneralData(colorPicker->generalData()); + setGradientData(colorPicker->gradientData()); + setToolTip(colorPicker->toolTipText()); + updatePreview(); + emit changed(); + emit gradientChanged(); + } +} + +void ColorButton::updateGradientVector() +{ + ColorPicker * colorPicker = qobject_cast<ColorPicker*>(sender()); + + if (colorPicker) + if (colorPicker->colorButton() == this) + { + setType(colorPicker->type()); + setGradientVectorData(colorPicker->gradientVectorData()); + emit gradientVectorChanged(); + } +} + +void ColorButton::updateGradientMesh() +{ + ColorPicker * colorPicker = qobject_cast<ColorPicker*>(sender()); + + if (colorPicker) + if (colorPicker->colorButton() == this) + { + setType(colorPicker->type()); + setGradientMeshData(colorPicker->gradientMeshData()); + emit gradientMeshChanged(); + } +} + +void ColorButton::updateHatch() +{ + ColorPicker * colorPicker = qobject_cast<ColorPicker*>(sender()); + + if (colorPicker) + if (colorPicker->colorButton() == this) + { + setType(colorPicker->type()); + setGeneralData(colorPicker->generalData()); + setHatchData(colorPicker->hatchData()); + setToolTip(colorPicker->toolTipText()); + updatePreview(); + emit changed(); + emit hatchChanged(); + } +} + +void ColorButton::updatePattern() +{ + ColorPicker * colorPicker = qobject_cast<ColorPicker*>(sender()); + + if (colorPicker) + if (colorPicker->colorButton() == this) + { + setType(colorPicker->type()); + setGeneralData(colorPicker->generalData()); + setPatternData(colorPicker->patternData()); + setToolTip(colorPicker->toolTipText()); + updatePreview(); + emit changed(); + emit patternChanged(); + } +} + +void ColorButton::updateColorPicker(ColorPicker *colorPicker) +{ + QSignalBlocker sig(colorPicker); + + colorPicker->setColorButton( this ); + colorPicker->setDoc( m_doc ); + colorPicker->setContext( context() ); + colorPicker->updateUiByType( type() ); + colorPicker->setGeneralData( generalData() ); + colorPicker->setColorData( colorData() ); + colorPicker->setGradientData( gradientData() ); + colorPicker->setGradientVectorData( gradientVectorData() ); + colorPicker->setGradientMeshData( gradientMeshData() ); + colorPicker->setHatchData( hatchData() ); + colorPicker->setPatternData( patternData() ); + colorPicker->updatePreview(); + +} + + /* ********************************************************************************* * * * Events @@ -180,27 +814,41 @@ int inset = 1; // Draw Background Dot - QRectF bDot(rect().center() - QPointF(fSize.width() - inset - 0.5, fSize.height() - inset - 0.5), QSizeF(bSize.width() - inset, bSize.height() - inset)); + QRectF bDot(rect().center() - QPointF(bSize.width() / 2. - inset - 0.5, bSize.height() / 2. - inset - 0.5), QSizeF(bSize.width() - inset, bSize.height() - inset)); mask.addEllipse(bDot.adjusted(inset, inset, -inset, -inset)); painter.setClipPath(mask); renderCheckerPattern(&painter, mask.boundingRect()); painter.setClipping(false); - renderFill(&painter, bDot.center(), bSize.width() - inset, background()); + drawCircularHandle(&painter, bDot.center(), bSize.width() - inset, background()); // Draw Foreground Dot - if (m_hasDot) + if (m_hasDot && icon().isNull()) { mask.clear(); - QRectF fDot(rect().center().x(), rect().center().y(), fSize.width(), fSize.height()); - mask.addEllipse(fDot.adjusted(inset, inset, -inset, -inset)); + QRectF fDot(rect().right() - fSize.width() + 0.5, rect().bottom() - fSize.height() + 0.5, fSize.width(), fSize.height()); // bottom right corner + mask.addEllipse(fDot.center(), fDot.width() / 2., fDot.height() / 2.); painter.setClipPath(mask); renderCheckerPattern(&painter, mask.boundingRect()); painter.setClipping(false); - renderFill(&painter, fDot.center(), fSize.width() - inset, foreground()); + drawCircularHandle(&painter, fDot.center(), fDot.width(), foreground()); } + // Draw Icon + if (!icon().isNull()) + { + QIcon::Mode iMode = isEnabled() ? QIcon::Normal : QIcon::Disabled; + + int w = 8; + int h = 8; + QPixmap pix = icon().pixmap(QSize(w, h), iMode); + QRectF fDot(rect().right() - fSize.width() + 0.5, rect().bottom() - fSize.height() + 0.5, fSize.width(), fSize.height()); // bottom right corner + painter.setPen(QPen(palette().color(QPalette::WindowText))); + painter.setBrush(palette().color(QPalette::Base)); + painter.drawEllipse(fDot.center(), fDot.width() / 2., fDot.height() / 2.); + painter.drawPixmap(fDot.center() - QPointF(w/2, h/2), pix); + } + painter.end(); } - Index: scribus/ui/widgets/color_button.h =================================================================== --- scribus/ui/widgets/color_button.h (Revision 26070) +++ scribus/ui/widgets/color_button.h (Arbeitskopie) @@ -2,10 +2,18 @@ #define COLOR_BUTTON_H #include <QToolButton> -#include "sccolor.h" -#include "scribusdoc.h" +#include <QPointer> +#include "scribusapi.h" +#include "ui/colorpicker/colorpicker_enum.h" class ColorListBox; +class FloatingWindow; +class PopupMenu; +class PageItem; +class ScribusDoc; +class ScPattern; +class UndoManager; +class ColorPicker; class SCRIBUS_API ColorButton : public QToolButton { @@ -12,44 +20,166 @@ Q_OBJECT public: + + enum MenuContextType + { + None = 0, + Floating = 1, + List = 2 + }; + ColorButton(QWidget *parent = nullptr); ~ColorButton(){}; + /*! + * \brief Show or hide small dot in bottom right corner filled with foreground brush. + * \param enabled + */ + void setHasDot(bool enabled); bool hasDot(); + QSize backgroundDotSize(); QSize foregroundDotSize(); - QString currentColor() const; - void setColors(const ColorList& list, bool insertNone = true); + /*! + * \brief Set type of context to show on click event, e.g. floating or list. + * \param type + */ + void setMenuContextType(MenuContextType type); + MenuContextType menuContextType() { return m_contextType; }; + // General Data + void setGeneral(int overprint); + void setGeneralData(CPGeneralData data); + CPGeneralData generalData(); + + // Color + void setColor(QString colorName, double shade = 100.0, double opacity = 0.0); + void setColorData(CPColorData data); + CPColorData colorData() const; + QColor color() const; + QString colorName() const; + + // Gradient + void setGradient(QString gradientName, VGradient gradient, VGradient::VGradientRepeatMethod repeatMethod = VGradient::pad, + QString color1 = QString(), QString color2 = QString(), QString color3 = QString(), QString color4 = QString(), + double color1Shade = 0.0, double color2Shade = 0.0, double color3Shade = 0.0, double color4Shade = 0.0, + double color1Alpha = 1.0, double color2Alpha = 1.0, double color3Alpha = 1.0, double color4Alpha = 1.0); + void setGradientData(CPGradientData data); + CPGradientData gradientData() const; + VGradient gradient() const; + QString gradientName() const; + + // Gradient Mesh + void setGradientMesh(QString colorName, double shade = 100.0, double opacity = 0.0); + void setGradientMeshData(CPColorData data); + CPColorData gradientMeshData() const; + + // Gradient Vector + void setGradientVector(double StartX, double StartY, double EndX, double EndY, double FocalX, double FocalY, double Scale, double Skew, + double C1X = 0.0, double C1Y = 0.0, double C2X = 0.0, double C2Y = 0.0, double C3X = 0.0, double C3Y = 0.0, double C4X = 0.0, double C4Y = 0.0, double C5X = 0.0, double C5Y = 0.0); + void setGradientVectorData(CPGradientVectorData data); + CPGradientVectorData gradientVectorData(); + + // Pattern + void setPattern(QString patternName, double offsetX, double offsetY, double scaleX, double scaleY, double skewX, double skewY, double angle, double spacing, bool mirrorX, bool mirrorY, bool onPath); + void setPatternData(CPPatternData data); + CPPatternData patternData() const; + ScPattern pattern() const; + QString patternName() const; + + // Hatch + void setHatch(int type, double distance, double angle, bool hasBackground, QString backgroundColor, QString foregroundColor); + void setHatchData(CPHatchData data); + CPHatchData hatchData() const; + + /*! + * \brief Set context of color button, e.g. fill or line. A context set the right configuration on color picker widget. + * \param config + */ + void setContext(Context config); + Context context(); + + Mode mode() { return m_mode; }; + + void setType(int type); + int type() { return m_type; }; + + void updatePreview(); + void unsetDoc(); + + /*! + * \brief Set context widget to show on click event. Set MenuContextType to "List". + * \param widget + */ + void setContextWidget(QWidget *widget); + QWidget *contextWidget(); + public slots: void setDoc(ScribusDoc *doc); - void setCurrentColor(QString colorName); -private slots: void setBackground(QBrush background); void setForeground(QBrush foreground); - void setHasDot(bool enabled); -protected: - void paintEvent(QPaintEvent *e); + void toggleFloatingContext(); + void updateFloatingContext(); - void renderFill(QPainter *painter, QPointF center, qreal radius, QBrush background); +private slots: + void updateColor(); + void updateGradient(); + void updateGradientVector(); + void updateGradientMesh(); + void updateHatch(); + void updatePattern(); + void updateColorPicker(ColorPicker *colorPicker); private: QBrush m_background {Qt::NoBrush}; QBrush m_foreground {Qt::NoBrush}; bool m_hasDot {false}; - ScribusDoc *m_doc {nullptr}; - QWidget *m_context {nullptr}; - ColorListBox *colorList {nullptr}; - QString m_colorName; + QWidget *stickyWidget {nullptr}; + FloatingWindow *floatingWidget {nullptr}; + PopupMenu *popupmenu {nullptr}; + QPointer<ScribusDoc> m_doc; + Context m_context {Context::Simple}; + MenuContextType m_contextType {MenuContextType::None}; + Mode m_mode {Mode::Solid}; + CPColorData m_colorData; + CPGradientData m_gradientData; + CPGradientVectorData m_gradientVectorData; + CPColorData m_meshColorData; + CPHatchData m_hatchData; + CPPatternData m_patternData; + CPGeneralData m_itemData; + bool m_isMask {false}; + int m_type {0}; + bool m_ignoreItemType {true}; QBrush background(); QBrush foreground(); + QBrush renderBrush(); + bool isMask(); + void setModeByType(int type); + QColor colorFromName(QString colorName, double shade); + QBrush colorBrush(QSize size, QString colorName, double shade = 100.0, double opacity = 1.0); + QBrush brushSolid(); + QBrush brushGradient(); + QBrush brushHatch(); + QBrush brushPattern(); + +protected: + + void paintEvent(QPaintEvent *e); + signals: + void changed(); void colorChanged(); + void gradientChanged(); + void gradientVectorChanged(); + void gradientMeshChanged(); + void hatchChanged(); + void patternChanged(); }; Index: scribus/ui/widgets/combo_blendmode.h =================================================================== --- scribus/ui/widgets/combo_blendmode.h (Revision 26070) +++ scribus/ui/widgets/combo_blendmode.h (Arbeitskopie) @@ -6,12 +6,6 @@ #include "scribusapi.h" -/* ********************************************************************************* * - * - * Section Container Header - * - * ********************************************************************************* */ - class SCRIBUS_API ComboBlendMode : public QComboBox { public: Index: scribus/ui/widgets/combo_linestyle.cpp =================================================================== --- scribus/ui/widgets/combo_linestyle.cpp (nicht existent) +++ scribus/ui/widgets/combo_linestyle.cpp (Arbeitskopie) @@ -0,0 +1,126 @@ +#include "combo_linestyle.h" + +#include <QStylePainter> + +#include "sccolorengine.h" +#include "ui/delegates/sclistitemdelegate.h" +#include "util.h" +#include "ui/propertiespalette_utils.h" +#include "util_gui.h" + +/* ********************************************************************************* * + * + * Constructor + Setup + * + * ********************************************************************************* */ + +ComboLineStyle::ComboLineStyle(QWidget *parent) : QComboBox(parent) +{ + m_list = new QListWidget(); + m_list->setViewMode(QListWidget::ListMode); +// m_list->setIconSize(m_size); +// m_list->setGridSize(QSize(76,64)); +// m_list->setSpacing(4); + m_list->setItemDelegate(new ScListItemDelegate(QListWidget::ListMode, m_size, ScListItemDelegate::Right, ScListItemDelegate::Simple)); + + this->setView(m_list); + this->setModel(m_list->model()); + this->setIconSize(m_size); + + languageChange(); +} + +/* ********************************************************************************* * + * + * Members + * + * ********************************************************************************* */ + +void ComboLineStyle::setDoc(ScribusDoc *doc) +{ + m_doc = doc; +} + +void ComboLineStyle::setIconSize(QSize size) +{ + QComboBox::setIconSize(size); + m_list->setIconSize(size); +} + +/* ********************************************************************************* * + * + * Methods + * + * ********************************************************************************* */ + +void ComboLineStyle::updateLineStyles() +{ + QSignalBlocker sig1(this); + QSignalBlocker sig2(m_list); + + + int index = this->currentIndex(); + + m_list->clear(); + if (m_doc != nullptr) + { + QHash<QString,MultiLine>::Iterator it; + for (it = m_doc->docLineStyles.begin(); it != m_doc->docLineStyles.end(); ++it) + { + LineStyleItem *lsi = new LineStyleItem(m_doc, it.value(), it.key()); +// lsi->setSizeHint(QSize(lsi->sizeHint().width(), 48)); + QIcon ico; + ico.addPixmap(renderPixmap(lsi->data(Qt::UserRole).value<LineStyleValue>())); + lsi->setIcon(ico); + m_list->addItem( lsi ); + } + + m_list->sortItems(); + m_list->insertItem( 0, tr("No Style")); + m_list->item(0)->setIcon(QIcon(renderEmptyPattern(m_size))); + + index = (m_list->count() >= 0 && index < m_list->count()) ? index : 0; + this->setCurrentIndex(index); + } + +} + +void ComboLineStyle::languageChange() +{ + if(m_list->count() > 0) + m_list->item(0)->setText( tr("No Style") ); + + this->setToolTip( tr("Line style of current object")); +} + +QPixmap ComboLineStyle::renderPixmap(LineStyleValue item) +{ + QPixmap pixmap(m_size); + pixmap.fill(Qt::white); + + QPainter p(&pixmap); + for (int i = item.m_Line.size() - 1; i > -1; i--) + { + const SingleLine& sLine = item.m_Line.at(i); + const ScColor& col = item.m_doc->PageColors[sLine.Color]; + QColor tmpf = ScColorEngine::getDisplayColor(col, item.m_doc, sLine.Shade); + QPen pen; + QVector<double> m_array; + if (sLine.Dash == 1) + pen.setStyle(Qt::SolidLine); + else + { + getDashArray(sLine.Dash, 1, m_array); + pen.setDashPattern(m_array); + } + pen.setColor(tmpf); + pen.setWidth(qMax(static_cast<int>(sLine.Width), 1)); + pen.setCapStyle(static_cast<Qt::PenCapStyle>(sLine.LineEnd)); + pen.setJoinStyle(static_cast<Qt::PenJoinStyle>(sLine.LineJoin)); + p.setPen(pen); + p.drawLine(0, m_size.height() / 2, m_size.width(), m_size.height() / 2); + } + p.end(); + + return pixmap; +} Index: scribus/ui/widgets/combo_linestyle.h =================================================================== --- scribus/ui/widgets/combo_linestyle.h (nicht existent) +++ scribus/ui/widgets/combo_linestyle.h (Arbeitskopie) @@ -0,0 +1,32 @@ +#ifndef COMBOLINESTYLE_H +#define COMBOLINESTYLE_H + +#include <QComboBox> +#include <QObject> +#include <QListWidget> +#include "scribusapi.h" +#include "scribusdoc.h" + +class LineStyleValue; + +class SCRIBUS_API ComboLineStyle : public QComboBox +{ +public: + ComboLineStyle(QWidget *parent = nullptr); + + void setDoc(ScribusDoc *doc); + void setIconSize(QSize size); + void updateLineStyles(); + +public slots: + void languageChange(); + +private: + ScribusDoc *m_doc { nullptr }; + QSize m_size { QSize(128, 32) }; + QListWidget *m_list {nullptr}; + QPixmap renderPixmap(LineStyleValue item); + +}; + +#endif // COMBOLINESTYLE_H Index: scribus/ui/widgets/floatingwindow.cpp =================================================================== --- scribus/ui/widgets/floatingwindow.cpp (nicht existent) +++ scribus/ui/widgets/floatingwindow.cpp (Arbeitskopie) @@ -0,0 +1,194 @@ +#include "floatingwindow.h" +#include "iconmanager.h" + +#include <QPainter> +#include <QPaintEvent> +#include <QVBoxLayout> +#include <QApplication> +#include <QToolButton> + +FloatingWindow::FloatingWindow(QWidget *child, QWidget *reference, QWidget *parent) + : QWidget{parent, /*Qt::Window | */Qt::Tool | Qt::FramelessWindowHint /*| Qt::WindowStaysOnTopHint*/}, // Qt::Tool | Qt::FramelessWindowHint + m_child(child), + m_reference(reference) +{ + + if (m_child == nullptr) m_child = new QWidget(); + + IconManager &iconManager = IconManager::instance(); + + m_handle = new QWidget(); + m_handle->installEventFilter(this); + + QToolButton *buttonClose = new QToolButton(); + buttonClose->setToolButtonStyle(Qt::ToolButtonIconOnly); + buttonClose->setIcon(iconManager.loadIcon("close")); + buttonClose->setFixedSize(16,16); + buttonClose->setAutoRaise(true); + + QHBoxLayout *layoutHeader = new QHBoxLayout; + layoutHeader->addWidget(m_handle); + layoutHeader->addWidget(buttonClose); + layoutHeader->setContentsMargins(8, 8, 8, 8); + + m_layout = new QVBoxLayout(); + m_layout->addLayout(layoutHeader); + m_layout->addWidget(m_child); + m_layout->setSpacing(0); + m_layout->setContentsMargins(1, 1, 1, 1); + + setLayout(m_layout); + + connect(buttonClose, &QToolButton::pressed, this, &FloatingWindow::hide); + +} + +QWidget *FloatingWindow::child() +{ + return m_child; +} + +QWidget *FloatingWindow::reference() +{ + return m_reference; +} + +bool FloatingWindow::eventFilter(QObject *obj, QEvent *event) +{ + + QWidget *wdg = dynamic_cast<QWidget*>(obj); + + if (!wdg) + return QObject::eventFilter(obj, event); + + if (wdg == m_handle) + { + switch (event->type()) + { + case QEvent::MouseButtonPress: + { + QMouseEvent *mEvent = (QMouseEvent*)event; + m_mousePos = mEvent->pos(); + } + break; + case QEvent::MouseMove: + { + QMouseEvent *mEvent = (QMouseEvent*)event; + if (mEvent->buttons() & Qt::LeftButton) + this->move(mapToParent(mEvent->pos() - m_mousePos)); + } + break; + default: + break; + } + } + + return QObject::eventFilter(obj, event); + +} + +void FloatingWindow::keyPressEvent(QKeyEvent *event) +{ + if (event->key() == Qt::Key_Escape) + hide(); +} + +void FloatingWindow::hideEvent(QHideEvent *event) +{ + emit closed(); +} + +QSize FloatingWindow::screenSize() +{ + QList<QScreen*> screens = QGuiApplication::screens(); + QRect bounds; + + foreach (auto screen, screens) + bounds = bounds.united(screen->geometry()); + + return bounds.size(); + +} + +void FloatingWindow::calculatePosition() +{ + updateSize(); + + if (m_reference == nullptr) return; + + QPoint parentGlobalPos = m_reference->mapToGlobal(QPoint()); + QPoint position = parentGlobalPos; + + QSize screen = screenSize(); + + // Check if widget can be displayed on a side of reference widget + bool canBeLeft = (parentGlobalPos.x() >= this->width()) ? true : false; + bool canBeTop = (parentGlobalPos.y() >= this->height()) ? true : false; + bool canBeRight = (parentGlobalPos.x() + m_reference->width() + this->width() <= screen.width()) ? true : false; + bool canBeBottom = (parentGlobalPos.y() + m_reference->height() + this->height() <= screen.height()) ? true : false; + + // TOP + // Show at top side of reference + if (canBeTop == true && canBeBottom == false) + position.setY( parentGlobalPos.y() - this->height()); + + // Show at left side of reference + if (canBeTop == true && canBeLeft == true && canBeRight == false) + position.setX( parentGlobalPos.x() - this->width()); + + // Show at right side of reference + if (canBeTop == true && canBeRight == true) + position.setX( parentGlobalPos.x() + m_reference->width() ); + + + // BOTTOM + // Show at bottom side of reference + if (canBeBottom == true) + position.setY( parentGlobalPos.y() + m_reference->height()); + + // Offset from screen right + if (canBeBottom == true && canBeLeft == true && canBeRight == false) + position.setX( screen.width() - this->width()); + + // Offset from screen left + if (canBeBottom == true && canBeLeft == false && canBeRight == true) + position.setX( 0 ); + + // Align with left side of reference + if (canBeBottom == true && canBeLeft == true && canBeRight == true) + position.setX( parentGlobalPos.x() ); + +/* + * This is just an alternative behaviour + * + // Show left + if (canBeLeft == true && canBeRight == false) + position.setX( parentGlobalPos.x() - this->width()); + + // Show Right + if (canBeRight == true) + position.setX( parentGlobalPos.x() + m_reference->width()); + + // Show Top + if (canBeTop == true && canBeBottom == false && canBeLeft == true && canBeRight == true) + position.setY( parentGlobalPos.y() - this->height()); + + // Show Bottom + if (canBeBottom == true && canBeLeft == true && canBeRight == true) + position.setY( parentGlobalPos.y() + m_reference->height()); +*/ + setGeometry(position.x(),position.y(), this->width(), this->height() ); + +} + +void FloatingWindow::show(QWidget *reference) +{ + m_reference = reference; + calculatePosition(); + QWidget::show(); +} + +void FloatingWindow::updateSize() +{ + adjustSize(); +} Index: scribus/ui/widgets/floatingwindow.h =================================================================== --- scribus/ui/widgets/floatingwindow.h (nicht existent) +++ scribus/ui/widgets/floatingwindow.h (Arbeitskopie) @@ -0,0 +1,50 @@ +#ifndef STICKYPOPUP_H +#define STICKYPOPUP_H + +#include <QWidget> +#include <QVBoxLayout> + +class FloatingWindow : public QWidget +{ + Q_OBJECT +public: + + explicit FloatingWindow(QWidget * child, QWidget *reference, QWidget *parent = nullptr); + + QWidget *child(); + QWidget *reference(); + +protected: + bool eventFilter(QObject *obj, QEvent *event); + void keyPressEvent(QKeyEvent *event); + void hideEvent(QHideEvent *event); + +private: + + QWidget * m_child; + QWidget * m_reference; + QWidget * m_handle; + QVBoxLayout * m_layout; + QPoint m_mousePos; + + /*! + * \brief Screen size of all screens + * \return + */ + QSize screenSize(); + + /*! + * \brief Calculate screen position relative to reference() widget. + */ + void calculatePosition(); + +signals: + void closed(); + +public slots: + void show(QWidget *reference = nullptr); + void updateSize(); + +}; + +#endif // STICKYPOPUP_H Index: scribus/ui/widgets/form_widget.cpp =================================================================== --- scribus/ui/widgets/form_widget.cpp (Revision 26070) +++ scribus/ui/widgets/form_widget.cpp (Arbeitskopie) @@ -156,8 +156,6 @@ break; } - // painter.drawRect(rect().adjusted(0,0,-1,-1)); - } bool FormWidget::event(QEvent *e) Index: scribus/ui/widgets/form_widget.h =================================================================== --- scribus/ui/widgets/form_widget.h (Revision 26070) +++ scribus/ui/widgets/form_widget.h (Arbeitskopie) @@ -4,7 +4,7 @@ #include <QWidget> #include <QFont> -#include "scribusapi.h" +//#include "scribusapi.h" /* ********************************************************************************* * * @@ -12,7 +12,7 @@ * * ********************************************************************************* */ -class SCRIBUS_API FormWidget : public QWidget +class FormWidget : public QWidget { Q_OBJECT Q_CLASSINFO("Version", "1.0.0") Index: scribus/ui/widgets/gradientlistbox.cpp =================================================================== --- scribus/ui/widgets/gradientlistbox.cpp (nicht existent) +++ scribus/ui/widgets/gradientlistbox.cpp (Arbeitskopie) @@ -0,0 +1,398 @@ +#include "gradientlistbox.h" + +#include <cstdlib> +#include <QBitmap> +#include <QCursor> +#include <QEvent> +#include <QHelpEvent> +#include <QMenu> +#include <QPainter> +#include <QPersistentModelIndex> +#include <QPixmap> +#include <QSignalBlocker> +#include <QToolTip> + +#include "models/gradientlistmodel.h" +#include "commonstrings.h" +#include "iconmanager.h" +#include "scribusapp.h" +#include "scribusdoc.h" +#include "scpainter.h" + + +class SCRIBUS_API GradientWideItemDelegate : public ScListBoxPixmap<48, 16> +{ +public: + GradientWideItemDelegate(): ScListBoxPixmap<48, 16>() {}; + ~GradientWideItemDelegate() = default; + + void redraw(const QVariant&) const override; + QString text(const QVariant&) const override; +}; + + +void GradientWideItemDelegate::redraw(const QVariant& data) const +{ + int w = 48; + int h = 16; + + QPixmap* pPixmap = ScListBoxPixmap<48, 16>::pmap.data(); + pPixmap->fill(Qt::transparent); + + if (data.canConvert<GradientPixmapValue>()) + { + GradientPixmapValue item(data.value<GradientPixmapValue>()); + QImage pixm(w, h, QImage::Format_ARGB32_Premultiplied); + + ScPainter *p = new ScPainter(&pixm, w, h); + p->setPen(Qt::black, 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin); + p->setFillMode(ScPainter::Gradient); + p->fill_gradient = item.m_gradient; + p->setGradient(VGradient::linear, FPoint(0,h/2), FPoint(w, h/2), FPoint(0,0), 1, 0); + p->drawRect(0, 0, w, h); + p->end(); + delete p; + + QPainter pb(pPixmap); + QBrush b(QColor(205,205,205), IconManager::instance().loadPixmap("testfill.png")); + pb.fillRect(0, 0, w, h, b); + pb.drawImage(QRect(0, 0, w, h), pixm); + pb.end(); + } +} + +QString GradientWideItemDelegate::text(const QVariant& data) const +{ + if (data.canConvert<GradientPixmapValue>()) + return data.value<GradientPixmapValue>().m_name; + return data.toString(); +} + + +int GradientListBox::initialized; +int GradientListBox::sortRule; + +GradientListBox::GradientListBox(QWidget * parent) + : QListView(parent) +{ + if (initialized != 12345) + sortRule = 0; + initialized = 12345; + QListView::setModel(new GradientListModel(this)); + setPixmapType(GradientListBox::widePixmap); + + connect(this, SIGNAL(clicked(QModelIndex)), this, SLOT(emitItemClicked(QModelIndex))); + connect(this, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(emitItemDoubleClicked(QModelIndex))); + connect(this->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)), this, SLOT(emitCurrentChanged(QModelIndex,QModelIndex))); + connect(this->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SIGNAL(itemSelectionChanged())); + connect(this, SIGNAL(contextMenuRequested()), this, SLOT(slotRightClick())); +} + +GradientListBox::GradientListBox(GradientListBox::PixmapType type, QWidget * parent) + : QListView(parent) +{ + cList = nullptr; + if (initialized != 12345) + sortRule = 0; + initialized = 12345; + QListView::setModel(new GradientListModel(this)); + setPixmapType(type); + + connect(ScQApp, SIGNAL(iconSetChanged()), this, SLOT(iconSetChange())); + + connect(this, SIGNAL(clicked(QModelIndex)), this, SLOT(emitItemClicked(QModelIndex))); + connect(this, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(emitItemDoubleClicked(QModelIndex))); + connect(this->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)), this, SLOT(emitCurrentChanged(QModelIndex,QModelIndex))); + connect(this->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SIGNAL(itemSelectionChanged())); + connect(this, SIGNAL(contextMenuRequested()), this, SLOT(slotRightClick())); +} + +GradientListBox::~GradientListBox() +{ + if (itemDelegate()) + delete itemDelegate(); + clear(); +} + +void GradientListBox::clear() +{ + QAbstractItemModel* itemModel = model(); + itemModel->removeRows(0, itemModel->rowCount()); +} + +int GradientListBox::count() const +{ + return this->model()->rowCount(); +} + +void GradientListBox::changeEvent(QEvent *e) +{ + if (e->type() == QEvent::LanguageChange) + { + languageChange(); + return; + } + QListView::changeEvent(e); +} + +void GradientListBox::emitCurrentChanged(const QModelIndex ¤t, const QModelIndex &previous) +{ + QPersistentModelIndex persistentCurrent = current; + + QString text = model()->data(current, Qt::DisplayRole).toString(); + emit currentTextChanged(text); + emit currentRowChanged(persistentCurrent.row()); +} + +void GradientListBox::emitItemClicked(const QModelIndex ¤t) +{ + QPersistentModelIndex persistentCurrent = current; + emit itemClicked(persistentCurrent.row()); +} + +void GradientListBox::emitItemDoubleClicked(const QModelIndex ¤t) +{ + QPersistentModelIndex persistentCurrent = current; + emit itemDoubleClicked(persistentCurrent.row()); +} + +void GradientListBox::iconSetChange() +{ + +} + +void GradientListBox::languageChange() +{ + // Not needed anymore normally: on language change a paintEvent is sent to widget + // and model will return the new translated string for None color + /*if (this->count() > 0) + { + QModelIndexList result; + QModelIndex start = model()->index(0, 0, this->rootIndex()); + result = model()->match(start, Qt::UserRole, CommonStrings::None, 1, Qt::MatchExactly | Qt::MatchCaseSensitive); + if (result.isEmpty()) + return; + int index = result.first().row(); + QListWidgetItem* item = this->item(index); + item->setText(CommonStrings::tr_NoneColor); + }*/ +} + +QString GradientListBox::currentGradientName() const +{ + if (currentRow() >= 0) + { + QAbstractItemModel* itemModel = model(); + return itemModel->data(currentIndex(), Qt::DisplayRole).toString(); + } + return CommonStrings::tr_NoneColor; +} + +VGradient GradientListBox::currentGradient() const +{ + if (currentRow() >= 0) + { + QAbstractItemModel* itemModel = model(); + GradientPixmapValue gpv = qvariant_cast<GradientPixmapValue>(itemModel->data(currentIndex(), Qt::UserRole)); + return gpv.m_gradient; + } + return VGradient(); + +} + +int GradientListBox::currentRow() const +{ + return currentIndex().row(); +} + +QVariant GradientListBox::data(int row, int role) const +{ + QModelIndex index = model()->index(row, 0); + return model()->data(index, role); +} + +QStringList GradientListBox::findGradients(const QString &name, Qt::MatchFlags flags) const +{ + QStringList foundGradients; + QAbstractItemModel* currentModel = model(); + + QModelIndex firstIndex = currentModel->index(0, 0, QModelIndex()); + QModelIndexList indexes = currentModel->match(firstIndex, Qt::DisplayRole, name, -1, flags); + for (int i = 0; i < indexes.count(); ++i) + { + QModelIndex modelIndex = indexes.at(i); + QVariant modelData = currentModel->data(modelIndex, Qt::DisplayRole); + foundGradients.append(modelData.toString()); + } + + return foundGradients; +} + +bool GradientListBox::hasSelection() const +{ + return this->selectionModel()->hasSelection(); +} + +void GradientListBox::insertItem(int row, const VGradient& gradient, const QString& gradientName) +{ + GradientListModel* gradientListModel = qobject_cast<GradientListModel*>(model()); + if (!gradientListModel) + return; + + ScribusDoc* doc = nullptr; + if (cList) + doc = cList->document(); + + GradientPixmapValue value(gradient, doc, gradientName); + gradientListModel->insert(row, value); +} + +bool GradientListBox::isNoneColorShown() const +{ + GradientListModel* gradientListModel = qobject_cast<GradientListModel*>(model()); + if (gradientListModel) + return gradientListModel->isNoneColorShown(); + return false; +} + +void GradientListBox::removeItem(int i) +{ + // None color item cannot be removed + if (isNoneColorShown() && (i == 0)) + return; + + model()->removeRow(i); +} + +int GradientListBox::row(const QString& gradientName) +{ + QAbstractItemModel* currentModel = model(); + + QModelIndex firstIndex = currentModel->index(0, 0, QModelIndex()); + QModelIndexList indexes = currentModel->match(firstIndex, Qt::DisplayRole, gradientName, -1, Qt::MatchExactly); + if (indexes.count() > 0) + { + const QModelIndex& first = indexes.at(0); + return first.row(); + } + return -1; +} + +void GradientListBox::setCurrentGradient(QString gradientName) +{ + QModelIndex firstIndex = model()->index(0, 0, QModelIndex()); + QModelIndexList indexes = this->model()->match(firstIndex, Qt::DisplayRole, gradientName, -1, Qt::MatchExactly); + if (indexes.count() > 0) + this->selectionModel()->setCurrentIndex(indexes[0], QItemSelectionModel::ClearAndSelect); +} + +void GradientListBox::setGradients(GradientList& list, bool insertNone) +{ + ColorList::Iterator it; + + GradientListModel* gradientModel = qobject_cast<GradientListModel*>(this->model()); + if (!gradientModel) + return; + + cList = &list; + + gradientModel->setGradientList(list, insertNone); +} + +void GradientListBox::setCurrentRow(int row) +{ + QModelIndex index = this->model()->index(row, 0); + selectionModel()->setCurrentIndex(index, QItemSelectionModel::ClearAndSelect); +} + +void GradientListBox::setPixmapType(GradientListBox::PixmapType type) +{ + if (type == GradientListBox::widePixmap) + { + QAbstractItemDelegate* oldDelegate = itemDelegate(); + GradientWideItemDelegate* gradientDelegate = dynamic_cast<GradientWideItemDelegate*>(oldDelegate); + if (!gradientDelegate) + { + setItemDelegate(new GradientWideItemDelegate()); + delete oldDelegate; + m_type = type; + } + } + +} + +void GradientListBox::setShowNoneColor(bool showNone) +{ + GradientListModel* gradientListModel = qobject_cast<GradientListModel*>(model()); + if (gradientListModel) + gradientListModel->setShowNoneColor(showNone); +} + +void GradientListBox::slotRightClick() +{ + QSignalBlocker sigBlocker(this); + QString currentSel = currentGradientName(); + if (currentSel.isEmpty()) + return; + + QMenu *pmen = new QMenu(); + pmen->addAction( tr("Sort by Name")); + pmen->addAction( tr("Sort by Type")); + sortRule = pmen->actions().indexOf(pmen->exec(QCursor::pos())); + delete pmen; + + GradientListModel* gradientListModel = qobject_cast<GradientListModel*>(model()); + if (!gradientListModel) + return; + + if (sortRule == 0) + gradientListModel->setSortRule(GradientListModel::SortByName); + else if (sortRule == 1) + gradientListModel->setSortRule(GradientListModel::SortByType); + + if (!currentSel.isEmpty()) + setCurrentGradient(currentSel); +} + +QString GradientListBox::text(int row) const +{ + QVariant varText = data(row, Qt::DisplayRole); + return varText.toString(); +} + +void GradientListBox::updateBox(GradientList &list) +{ + bool showNoneColor = false; + + clear(); + reset(); + + GradientListModel* gradientModel = qobject_cast<GradientListModel*>(this->model()); + if (gradientModel) + showNoneColor = gradientModel->isNoneColorShown(); + setGradients(list, showNoneColor); +} + +bool GradientListBox::viewportEvent(QEvent *event) +{ + if (event != nullptr) + { + if (event->type() == QEvent::MouseButtonPress) + { + QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event); + if (mouseEvent->button() == Qt::RightButton) + return true; + } + else if (event->type() == QEvent::MouseButtonRelease) + { + QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event); + if (mouseEvent->button() == Qt::RightButton) + { + emit contextMenuRequested(); + return true; + } + } + } + return QListView::viewportEvent(event); +} + Index: scribus/ui/widgets/gradientlistbox.h =================================================================== --- scribus/ui/widgets/gradientlistbox.h (nicht existent) +++ scribus/ui/widgets/gradientlistbox.h (Arbeitskopie) @@ -0,0 +1,142 @@ +#ifndef GRADIENTLISTBOX_H +#define GRADIENTLISTBOX_H + + +#include <QColor> +#include <QListView> +#include <QListWidget> +#include <QPixmap> +#include <QPointer> +#include <QString> +#include <QStringList> +#include <QVariant> + +#include "models/gradientlistmodel.h" +#include "colorsetmanager.h" +#include "commonstrings.h" +#include "sccolor.h" +#include "scguardedptr.h" +#include "sclistboxpixmap.h" +#include "scribusapi.h" + +/*! \brief Very nice list box with color names and samples. +It's inherited from QListBox with all its methods and properties. +I create it as separate class because it's used now in ColorManager +and ColorWheel too. You can see it in Extras/Color Wheel or in +Edit/Colors dialogs in action. +\author Petr Vanek <petr@yarpen.cz> +*/ +class SCRIBUS_API GradientListBox : public QListView +{ + Q_OBJECT + + public: + + enum PixmapType + { + widePixmap + }; + + /*! \brief Standard QListBox like constructor. + Just there are initialized pixmaps for icon drawing. */ + GradientListBox(QWidget* parent = nullptr); + GradientListBox(GradientListBox::PixmapType type, QWidget* parent = nullptr); + ~GradientListBox(); + + /*! Return the current color name */ + QString currentGradientName() const; + + VGradient currentGradient() const; + + /*! Return the current row */ + int currentRow() const; + + /*! Return row count */ + int count() const; + + /*! Return model data for the given row and role */ + QVariant data(int row, int role) const; + + /*! Finds colors whose name matches the given string name using the given flags. */ + QStringList findGradients(const QString &name, Qt::MatchFlags flags) const; + + /*! Return if a color is currently selected */ + bool hasSelection() const; + + /*! Insert color at specified position */ + void insertItem(int row, const VGradient &gradient, const QString& gradientName); + + /*! Return if none color is shown at beginning oh list */ + bool isNoneColorShown() const; + + /*! \brief Retrieve the pixmap type used by this listbox */ + GradientListBox::PixmapType pixmapType() const { return m_type; } + + /*! \brief Fill the list box with values taken from list. + The list is cleared itself. Then is rendered an icon with + color attributes (RGB/CMYK/Spot etc.). + \param list a ColorList to present. */ + void updateBox(GradientList& list); + + /*! Remove list item at specified index */ + void removeItem(int i); + + /*! Find row index for specified colorname */ + int row(const QString& gradientName); + + /*! \brief Fill the list box with values taken from list. + The list is cleared itself. Then is rendered an icon with + color attributes (RGB/CMYK/Spot etc.). + \param list a ColorList to present. */ + void setGradients(GradientList& list, bool insertNone); + + /*! \brief Set the current color */ + void setCurrentGradient(QString gradientName); + + /*! \brief Set the current row */ + void setCurrentRow(int row); + + /*! \brief Set the pixmap type used by this listbox */ + void setPixmapType(GradientListBox::PixmapType type); + + //! Set if None color is shown as first item in the list + void setShowNoneColor(bool showNone); + + /*! \brief Return text displayed at specified row */ + QString text(int row) const; + + /*! \brief Pointer to the color list displayed by this box */ + GradientList* cList { nullptr }; + + public slots: + void clear(); + + private slots: + void slotRightClick(); + + protected slots: + void emitCurrentChanged(const QModelIndex ¤t, const QModelIndex &previous); + void emitItemClicked(const QModelIndex ¤t); + void emitItemDoubleClicked(const QModelIndex ¤t); + + virtual void iconSetChange(); + virtual void languageChange(); + + signals: + void currentRowChanged(int currentRow); + void currentTextChanged(const QString ¤tText); + void contextMenuRequested(); + void itemClicked(int currentRow); + void itemDoubleClicked(int currentRow); + void itemSelectionChanged(); + + protected: + void changeEvent(QEvent *e) override; + bool viewportEvent(QEvent *event) override; + + static int initialized; + static int sortRule; + GradientListBox::PixmapType m_type; +}; + +#endif // GRADIENTLISTBOX_H Index: scribus/ui/widgets/section_container.cpp =================================================================== --- scribus/ui/widgets/section_container.cpp (Revision 26070) +++ scribus/ui/widgets/section_container.cpp (Arbeitskopie) @@ -1,26 +1,31 @@ #include "section_container.h" +#include <QMouseEvent> #include <QPainter> #include <QPen> -#include <QMouseEvent> #include <QToolButton> + +#ifndef EXCLUDE_FOR_DESIGNER_PLUGIN #include "iconmanager.h" #include "scribusapp.h" +#endif - - -/* ********************************************************************************* * +/* ********************************************************************************* + * * * * Constructor + Setup * - * ********************************************************************************* */ + * ********************************************************************************* + */ -SectionContainer::SectionContainer(QWidget *parent) : SectionContainer("Title", true, parent){} +SectionContainer::SectionContainer(QWidget *parent) + : SectionContainer("Title", true, parent) {} -SectionContainer::SectionContainer(QString title, bool isCollapsible, QWidget *parent) - : QWidget{parent} +SectionContainer::SectionContainer(QString title, bool isCollapsible, + QWidget *parent) + : QWidget{parent} { - widgetHeader = new SectionContainerHeader(title); + header = new SectionContainerHeader(title); m_isCollapsible = isCollapsible; m_isCollapsed = false; m_hasStyle = true; @@ -28,11 +33,13 @@ // Main Layout mainLayout = new QVBoxLayout(this); mainLayout->setSpacing(0); - mainLayout->setContentsMargins(0,0,0,0); - mainLayout->addWidget(widgetHeader); + mainLayout->setContentsMargins(0, 0, 0, 0); + mainLayout->addWidget(header); + mainLayout->addWidget(body); // Size Policy - QSizePolicy sizePol = QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Maximum ); + QSizePolicy sizePol = + QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Maximum); setSizePolicy(sizePol); iconSetChange(); @@ -44,43 +51,49 @@ void SectionContainer::connectSlots() { - connect( widgetHeader->buttonCollapse, &QPushButton::clicked,this, &SectionContainer::toggleCollpasedState ); - connect( widgetHeader, &SectionContainerHeader::toggleCollpasedState,this, &SectionContainer::toggleCollpasedState ); - connect( ScQApp, SIGNAL(iconSetChanged()), this, SLOT(iconSetChange()) ); + connect(header->buttonCollapse, &QPushButton::clicked, this, + &SectionContainer::toggleCollpasedState); + connect(header, &SectionContainerHeader::toggleCollpasedState, this, + &SectionContainer::toggleCollpasedState); + +#ifndef EXCLUDE_FOR_DESIGNER_PLUGIN + connect(ScQApp, SIGNAL(iconSetChanged()), this, SLOT(iconSetChange())); +#endif } -/* ********************************************************************************* * +/* ********************************************************************************* + * * * * Properties * - * ********************************************************************************* */ + * ********************************************************************************* + */ void SectionContainer::setText(QString text) { - widgetHeader->labelTitle->setText(text); - widgetHeader->labelTitle->adjustSize(); + header->labelTitle->setText(text); + header->labelTitle->adjustSize(); } -QString SectionContainer::text() const -{ - return widgetHeader->labelTitle->text(); +QString SectionContainer::text() const { + return header->labelTitle->text(); } void SectionContainer::setFont(QFont font) { - widgetHeader->labelTitle->setFont(font); + header->labelTitle->setFont(font); QWidget::setFont(font); } QFont SectionContainer::font() const { - return widgetHeader->font(); + return header->font(); } void SectionContainer::setHasStyle(bool isSimple) { m_hasStyle = isSimple; - widgetHeader->m_hasStyle = isSimple; + header->m_hasStyle = isSimple; update(); } @@ -92,7 +105,7 @@ void SectionContainer::setIsCollapsible(bool isCollapsible) { m_isCollapsible = isCollapsible; - widgetHeader->buttonCollapse->setVisible(isCollapsible); + header->buttonCollapse->setVisible(isCollapsible); } bool SectionContainer::isCollapsible() const @@ -107,69 +120,102 @@ void SectionContainer::setIsCollapsed(bool state) { - if(isCollapsible() == false || mainLayout->count() != 2) + if (isCollapsible() == false) return; - QWidget *widget = mainLayout->itemAt(1)->widget(); m_isCollapsed = state; - if (m_isCollapsed) - { - widget->hide(); - widgetHeader->buttonCollapse->setIcon(iconCollapsed); - } - else - { - widget->show(); - widgetHeader->buttonCollapse->setIcon(iconExpanded); - } + header->buttonCollapse->setIcon(m_isCollapsed ? iconCollapsed : iconExpanded); + body->setVisible(!m_isCollapsed); - emit collapsedState(m_isCollapsed); + resize(calculateSize()); + emit collapsedStateChanged(m_isCollapsed); + emit sizeChanged(); } +void SectionContainer::collapse() +{ + setIsCollapsed(true); +} + +void SectionContainer::expand() +{ + setIsCollapsed(false); +} + void SectionContainer::setCollapseIcons(QIcon collapsed, QIcon expanded) { iconCollapsed = collapsed; iconExpanded = expanded; - if (m_isCollapsed) - widgetHeader->buttonCollapse->setIcon(iconCollapsed); - else - widgetHeader->buttonCollapse->setIcon(iconExpanded); + header->buttonCollapse->setIcon(m_isCollapsed ? iconCollapsed : iconExpanded); } +void SectionContainer::removeWidget() +{ + body = new QWidget; + mainLayout->addWidget(body); + m_hasBody = false; +} + void SectionContainer::setWidget(QWidget *widget) { - // Has no body widget - if (mainLayout->count() == 1) - { - mainLayout->insertWidget(1, widget); - } - // Has body widget - else if (mainLayout->count() == 2) - { - QWidget *oldWidget = mainLayout->itemAt(1)->widget(); - mainLayout->replaceWidget(oldWidget, widget); - } - else - return; + body = widget; + body->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Maximum); + body->adjustSize(); - // Override widget policy to fit into the body container - widget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::MinimumExpanding); -// widget->installEventFilter(this); - widget->adjustSize(); + mainLayout->addWidget(body); + m_hasBody = true; + + resize(calculateSize()); + emit sizeChanged(); } -QWidget* SectionContainer::widget() +QWidget *SectionContainer::widget() { - return mainLayout->count() == 2 ? mainLayout->itemAt(1)->widget() : nullptr; + return body; } -/* ********************************************************************************* * +bool SectionContainer::hasBodyWidget() +{ + return m_hasBody; +} + +void SectionContainer::setLayout(QLayout *layout) +{ + body->setLayout(layout); +} + +QLayout *SectionContainer::layout() const +{ + return body->layout(); +} + +QSize SectionContainer::minimumSizeHint() +{ + QSize s(200, childrenRect().height()); + + if (isCollapsed()) + s.setHeight(header->height()); + + return s; +} + +QSize SectionContainer::calculateSize() +{ + QSize s = minimumSizeHint(); + s.setWidth(this->width()); + + return s; +} + +/* ********************************************************************************* + * * * * Slots * - * ********************************************************************************* */ + * ********************************************************************************* + */ void SectionContainer::toggleCollpasedState() { @@ -180,15 +226,20 @@ void SectionContainer::iconSetChange() { +#ifndef EXCLUDE_FOR_DESIGNER_PLUGIN IconManager &iconManager = IconManager::instance(); - setCollapseIcons(iconManager.loadPixmap("collapse"), iconManager.loadPixmap("expand")); + setCollapseIcons(iconManager.loadPixmap("collapse"), + iconManager.loadPixmap("expand")); +#endif } -/* ********************************************************************************* * +/* ********************************************************************************* + * * * * Header * - * ********************************************************************************* */ + * ********************************************************************************* + */ void SectionContainer::addHeaderSuffixWidget(QWidget *widget) { @@ -197,21 +248,18 @@ void SectionContainer::insertHeaderSuffixWidget(int index, QWidget *widget) { - QToolButton *toolButton = dynamic_cast<QToolButton*>(widget); - if (toolButton) - { + QToolButton *toolButton = dynamic_cast<QToolButton *>(widget); + if (toolButton) { toolButton->setAutoRaise(true); - widgetHeader->layoutHeaderSuffix->insertWidget(index, toolButton); + header->layoutHeaderSuffix->insertWidget(index, toolButton); } else - { - widgetHeader->layoutHeaderSuffix->insertWidget(index, widget); - } + header->layoutHeaderSuffix->insertWidget(index, widget); } void SectionContainer::removeHeaderSuffixWidget(QWidget *widget) { - widgetHeader->layoutHeaderSuffix->removeWidget( widget ); + header->layoutHeaderSuffix->removeWidget(widget); widget->deleteLater(); } @@ -222,31 +270,28 @@ void SectionContainer::insertHeaderSuffixSpacing(int index, int size) { - widgetHeader->layoutHeaderSuffix->insertSpacing(index, size); + header->layoutHeaderSuffix->insertSpacing(index, size); } -void SectionContainer::addHeaderPrefixWidget(QWidget *widget) -{ +void SectionContainer::addHeaderPrefixWidget(QWidget *widget) { insertHeaderPrefixWidget(-1, widget); } void SectionContainer::insertHeaderPrefixWidget(int index, QWidget *widget) { - QToolButton *toolButton = dynamic_cast<QToolButton*>(widget); + QToolButton *toolButton = dynamic_cast<QToolButton *>(widget); if (toolButton) { toolButton->setAutoRaise(true); - widgetHeader->layoutHeaderPrefix->insertWidget(index, toolButton); + header->layoutHeaderPrefix->insertWidget(index, toolButton); } else - { - widgetHeader->layoutHeaderPrefix->insertWidget(index, widget); - } + header->layoutHeaderPrefix->insertWidget(index, widget); } void SectionContainer::removeHeaderPrefixWidget(QWidget *widget) { - widgetHeader->layoutHeaderPrefix->removeWidget( widget ); + header->layoutHeaderPrefix->removeWidget(widget); widget->deleteLater(); } @@ -257,15 +302,16 @@ void SectionContainer::insertHeaderPrefixSpacing(int index, int size) { - widgetHeader->layoutHeaderPrefix->insertSpacing(index, size); + header->layoutHeaderPrefix->insertSpacing(index, size); } - -/* ********************************************************************************* * +/* ********************************************************************************* + * * * * Events * - * ********************************************************************************* */ + * ********************************************************************************* + */ void SectionContainer::paintEvent(QPaintEvent *event) { @@ -275,51 +321,36 @@ return; int lineWidth = 1; - QColor bottomLineColor( palette().color(QPalette::Dark) ); + QColor bottomLineColor(palette().color(QPalette::Dark)); - QPainter painter( this ); + QPainter painter(this); // Bottom Line - painter.setPen( QPen(bottomLineColor, lineWidth) ); - painter.drawLine( 8, this->height() - lineWidth, this->width() - 8, this->height() - lineWidth ); + painter.setPen(QPen(bottomLineColor, lineWidth)); + painter.drawLine(8, this->height() - lineWidth, this->width() - 8, + this->height() - lineWidth); } -//bool SectionContainer::eventFilter(QObject *object, QEvent *event) -//{ -// QWidget *widget = qobject_cast<QWidget*>(object); - -// switch(event->type()) -// { -// case QEvent::Resize: -// { -// if(widget) -// qDebug() << "height" << widget->height() << widget->objectName(); - -// qDebug() << "resize body widget"; -// break; -// } -// default: -// break; -// } - -// return false; -//} - -/* ********************************************************************************* * +/* ********************************************************************************* + * * * * * SECTION CONTAINER HEADER * * - * ********************************************************************************* */ + * ********************************************************************************* + */ -/* ********************************************************************************* * +/* ********************************************************************************* + * * * * Constructor + Setup * - * ********************************************************************************* */ + * ********************************************************************************* + */ -SectionContainerHeader::SectionContainerHeader(QWidget *parent) : SectionContainerHeader("Title", parent){} +SectionContainerHeader::SectionContainerHeader(QWidget *parent) + : SectionContainerHeader("Title", parent) {} SectionContainerHeader::SectionContainerHeader(QString title, QWidget *parent) { @@ -333,9 +364,9 @@ buttonCollapse = new QPushButton; // Label -// QFont m_font(this->font()); -// m_font.setBold( true ); -// labelTitle->setFont(m_font); + // QFont m_font(this->font()); + // m_font.setBold( true ); + // labelTitle->setFont(m_font); labelTitle->setText(title); labelTitle->setBuddy(this); labelTitle->adjustSize(); @@ -343,36 +374,36 @@ // Buttons buttonCollapse->setFlat(true); buttonCollapse->setFixedSize(20, 20); -// buttonCollapse->adjustSize(); // needed to calculate the header height later -// buttonCollapse->setMaximumWidth(buttonCollapse->height()); // Header Prefix layout - layoutHeaderPrefix->setContentsMargins( 0,0,0,0 ); + layoutHeaderPrefix->setContentsMargins(0, 0, 0, 0); layoutHeaderPrefix->setSpacing(padding); // Header Suffix Layout - layoutHeaderSuffix->setContentsMargins( 0,0,0,0 ); + layoutHeaderSuffix->setContentsMargins(0, 0, 0, 0); layoutHeaderSuffix->setSpacing(padding); // Header Layout - layoutHeader->addWidget( buttonCollapse ); - layoutHeader->addLayout( layoutHeaderPrefix ); - layoutHeader->addWidget( labelTitle ); - layoutHeader->addStretch( 0 ); - layoutHeader->addLayout( layoutHeaderSuffix ); - layoutHeader->setContentsMargins( 4, padding / 2, 4, padding / 2 ); + layoutHeader->addWidget(buttonCollapse); + layoutHeader->addLayout(layoutHeaderPrefix); + layoutHeader->addWidget(labelTitle); + layoutHeader->addStretch(0); + layoutHeader->addLayout(layoutHeaderSuffix); + layoutHeader->setContentsMargins(4, padding / 2, 4, padding / 2); // Header Widget this->setLayout(layoutHeader); - this->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Maximum ); - this->setMaximumHeight(buttonCollapse->height() + padding); + this->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Maximum); + this->setFixedHeight(buttonCollapse->height() + padding); } -/* ********************************************************************************* * +/* ********************************************************************************* + * * * * Events * - * ********************************************************************************* */ + * ********************************************************************************* + */ void SectionContainerHeader::paintEvent(QPaintEvent *event) { @@ -380,18 +411,18 @@ return; int lineWidth = 1; -// QColor topLineColor( palette().color(QPalette::Mid) ); - QColor bottomLineColor( palette().color(QPalette::Dark) ); + // QColor topLineColor( palette().color(QPalette::Mid) ); + QColor bottomLineColor(palette().color(QPalette::Dark)); - QColor bgColor( palette().color(QPalette::WindowText) ); + QColor bgColor(palette().color(QPalette::WindowText)); bgColor.setAlphaF(0.07f); int headerHeight = this->height(); QRect headerRect(0, 0, this->width(), headerHeight - lineWidth); - QPainter painter( this ); + QPainter painter(this); - painter.setPen( Qt::NoPen ); + painter.setPen(Qt::NoPen); painter.setBrush(bgColor); painter.drawRect(headerRect); @@ -398,12 +429,13 @@ painter.setBrush(Qt::NoBrush); // Top Line -// painter.setPen( QPen(topLineColor, lineWidth) ); -// painter.drawLine( 0, 0,this->width(), 0 ); + // painter.setPen( QPen(topLineColor, lineWidth) ); + // painter.drawLine( 0, 0,this->width(), 0 ); // Bottom Line painter.setPen(QPen(bottomLineColor, lineWidth)); - painter.drawLine(0, headerHeight - lineWidth, this->width(), headerHeight - lineWidth); + painter.drawLine(0, headerHeight - lineWidth, this->width(), + headerHeight - lineWidth); } void SectionContainerHeader::mousePressEvent(QMouseEvent *mouseEvent) @@ -411,7 +443,6 @@ QWidget::mousePressEvent(mouseEvent); if (mouseEvent->button() == Qt::LeftButton) - { emit toggleCollpasedState(); - } + } Index: scribus/ui/widgets/section_container.h =================================================================== --- scribus/ui/widgets/section_container.h (Revision 26070) +++ scribus/ui/widgets/section_container.h (Arbeitskopie) @@ -2,13 +2,10 @@ #define SECTIONCONTAINER_H #include <QLabel> -#include <QStackedWidget> #include <QPushButton> #include <QVBoxLayout> #include <QWidget> -#include "scribusapi.h" - /* ********************************************************************************* * * * Section Container Header @@ -15,7 +12,7 @@ * * ********************************************************************************* */ -class SCRIBUS_API SectionContainerHeader : public QWidget +class SectionContainerHeader : public QWidget { Q_OBJECT @@ -41,7 +38,7 @@ void mousePressEvent(QMouseEvent *mouseEvent); signals: - void toggleCollpasedState(); + void toggleCollpasedState(); }; @@ -51,7 +48,7 @@ * * ********************************************************************************* */ -class SCRIBUS_API SectionContainer : public QWidget +class SectionContainer : public QWidget { Q_OBJECT Q_CLASSINFO("Version", "1.0.0") @@ -62,62 +59,83 @@ Q_PROPERTY(bool hasStyle READ hasStyle WRITE setHasStyle) - public: - SectionContainer(QWidget *parent = nullptr); - SectionContainer(QString title, bool isCollapsible = true, QWidget *parent = nullptr); +public: + SectionContainer(QWidget *parent = nullptr); + SectionContainer(QString title, bool isCollapsible = true, QWidget *parent = nullptr); - void setText(QString text); - QString text() const; + void setText(QString text); + QString text() const; - void setFont(QFont font); - QFont font() const; + void setFont(QFont font); + QFont font() const; - void setHasStyle(bool hasStyle); - bool hasStyle() const; + void setHasStyle(bool hasStyle); + bool hasStyle() const; - void setIsCollapsible(bool isCollapsible); - bool isCollapsible() const; - bool isCollapsed() const; + void setIsCollapsible(bool isCollapsible); + bool isCollapsible() const; + bool isCollapsed() const; - void setCollapseIcons(QIcon collapsed, QIcon expanded); + void setCollapseIcons(QIcon collapsed, QIcon expanded); - void setWidget(QWidget * widget); - QWidget *widget(); + void removeWidget(); + void setWidget(QWidget *widget); + QWidget *widget(); - void addHeaderSuffixWidget(QWidget *widget); - void insertHeaderSuffixWidget(int index, QWidget *widget); - void removeHeaderSuffixWidget(QWidget *widget); - void addHeaderSuffixSpacing(int size); - void insertHeaderSuffixSpacing(int index, int size); + bool hasBodyWidget(); - void addHeaderPrefixWidget(QWidget *widget); - void insertHeaderPrefixWidget(int index, QWidget *widget); - void removeHeaderPrefixWidget(QWidget *widget); - void addHeaderPrefixSpacing(int size); - void insertHeaderPrefixSpacing(int index, int size); + void setLayout(QLayout *layout); + QLayout *layout() const; - private: - SectionContainerHeader *widgetHeader { nullptr }; - QVBoxLayout *mainLayout { nullptr }; - QIcon iconCollapsed; - QIcon iconExpanded; - bool m_isCollapsible; - bool m_isCollapsed { false }; - bool m_hasStyle { false }; + QSize minimumSizeHint(); - void connectSlots(); + void addHeaderSuffixWidget(QWidget *widget); + void insertHeaderSuffixWidget(int index, QWidget *widget); + void removeHeaderSuffixWidget(QWidget *widget); + void addHeaderSuffixSpacing(int size); + void insertHeaderSuffixSpacing(int index, int size); - void paintEvent(QPaintEvent *event); - // bool eventFilter(QObject *object, QEvent *event); + void addHeaderPrefixWidget(QWidget *widget); + void insertHeaderPrefixWidget(int index, QWidget *widget); + void removeHeaderPrefixWidget(QWidget *widget); + void addHeaderPrefixSpacing(int size); + void insertHeaderPrefixSpacing(int index, int size); - public slots: - void toggleCollpasedState(); - void setIsCollapsed(bool state); - void iconSetChange(); +private: + SectionContainerHeader *header { nullptr }; + QWidget* body {new QWidget()}; + QVBoxLayout *mainLayout { nullptr }; + QIcon iconCollapsed; + QIcon iconExpanded; + bool m_isCollapsible; + bool m_isCollapsed { false }; + bool m_hasStyle { false }; + bool m_hasBody {false}; - signals: - void collapsedState(bool); - void currentIndexChanged(int index); + void connectSlots(); + + void paintEvent(QPaintEvent *event); + +protected: + QSize calculateSize(); + +public slots: + void toggleCollpasedState(); + void setIsCollapsed(bool state); + /** + * @brief collapse widget. Same as setIsCollapsed(true) + */ + void collapse(); + /** + * @brief expand widget. Same as setIsCollapsed(false) + */ + void expand(); + void iconSetChange(); + +signals: + void collapsedStateChanged(bool); + void currentIndexChanged(int index); + void sizeChanged(); }; #endif // SECTIONCONTAINER_H Index: scribus/ui/widgets/stacked_container.cpp =================================================================== --- scribus/ui/widgets/stacked_container.cpp (nicht existent) +++ scribus/ui/widgets/stacked_container.cpp (Arbeitskopie) @@ -0,0 +1,28 @@ +#include "stacked_container.h" +#include <QStackedLayout> + + +StackedContainer::StackedContainer(QWidget *parent) + : QStackedWidget( parent) +{ + connect(this, &QStackedWidget::currentChanged, this, &StackedContainer::updateSize); +} + +QSize StackedContainer::minimumSizeHint() const +{ + QSize s(widget(currentIndex())->sizeHint()); + s.setWidth(this->width()); + return s; +} + +QSize StackedContainer::sizeHint() const +{ + return minimumSizeHint(); +} + +void StackedContainer::updateSize() +{ + //resize(this->width(), sizeHint().height()); + adjustSize(); +} + Index: scribus/ui/widgets/stacked_container.h =================================================================== --- scribus/ui/widgets/stacked_container.h (nicht existent) +++ scribus/ui/widgets/stacked_container.h (Arbeitskopie) @@ -0,0 +1,22 @@ +#ifndef STACKEDCONTAINER_H +#define STACKEDCONTAINER_H + +#include <QStackedWidget> + + +class StackedContainer : public QStackedWidget +{ + +public: + explicit StackedContainer(QWidget *parent = nullptr); + ~StackedContainer() {}; + + QSize minimumSizeHint() const override; + QSize sizeHint() const override; + +private slots: + void updateSize(); + +}; + +#endif // STACKEDCONTAINER_H Index: scribus/util_gui.cpp =================================================================== --- scribus/util_gui.cpp (Revision 26070) +++ scribus/util_gui.cpp (Arbeitskopie) @@ -1,8 +1,12 @@ #include "util_gui.h" #include <QPainterPath> +#include <QPalette> +#include "scpainter.h" +#include "vgradient.h" +#include "scpattern.h" -void renderCircularHandle(QPainter *painter, QPointF center, qreal width, QBrush background) +void drawCircularHandle(QPainter *painter, QPointF center, qreal width, QBrush background) { qreal radius = width /2.; @@ -26,7 +30,7 @@ painter->restore(); } -void renderPointerHandle(QPainter *painter, QPointF pointer, qreal width, QColor background) +void drawPointerHandle(QPainter *painter, QPointF pointer, qreal width, QColor background, bool isEmpty) { qreal height = width *1.5; QRect rect( pointer.x() -width/2, pointer.y() , width, height ); @@ -52,7 +56,10 @@ renderCheckerPattern(painter, rect); // Draw color - painter->drawPixmap(rect, renderSplitColor(rect.size(), background, Qt::Vertical, 0.7) ); + if(isEmpty) + painter->drawPixmap(rect, renderEmptyPattern(rect.size()) ); + else + painter->drawPixmap(rect, renderColor(rect.size(), background, background, 1) ); // Draw black border painter->setBrush(Qt::NoBrush); @@ -63,6 +70,65 @@ painter->restore(); } +void drawSelectionHandle(QPainter *painter, QPointF point, QPen pen, qreal scaleFactor, bool isActive) +{ + QRectF handleRect(0, 0, 5 / scaleFactor, 5 / scaleFactor); + handleRect.moveCenter(point); + + QBrush b = QBrush( (isActive) ? pen.color() : Qt::white ); + QPen p(Qt::white, 3, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin); + p.setCosmetic(true); + + painter->setPen(p); + painter->drawRect(handleRect); + painter->setPen(pen); + painter->setBrush(b); + painter->drawRect(handleRect); +} + +void drawNodeHandle(QPainter *painter, QPointF point, QPen pen, qreal scaleFactor, bool isActive) +{ + drawSelectionHandle(painter, point, pen, scaleFactor, isActive); +} + +void drawNodeControl(QPainter *painter, QPointF point, QPen pen, qreal scaleFactor, bool isActive) +{ + bool aa = painter->testRenderHint(QPainter::Antialiasing); + + QRectF handleRect(0, 0, 6 / scaleFactor, 6 / scaleFactor); + handleRect.moveCenter(point); + + QBrush b = QBrush( (isActive) ? pen.color() : Qt::white ); + QPen p(Qt::white, 3, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin); + p.setCosmetic(true); + + painter->setRenderHint(QPainter::Antialiasing, true); + painter->setPen(p); + painter->drawEllipse(handleRect); + painter->setPen(pen); + painter->setBrush(b); + painter->drawEllipse(handleRect); + + if (!aa) + painter->setRenderHint(QPainter::Antialiasing, false); +} + +void drawWeldMarker(QPainter *painter, QPointF point, QColor color, qreal scaleFactor) +{ + bool aa = painter->testRenderHint(QPainter::Antialiasing); + + QRectF handleRect(0, 0, 8 / scaleFactor, 8 / scaleFactor); + handleRect.moveCenter(point); + + painter->setRenderHint(QPainter::Antialiasing, true); + painter->setPen(Qt::NoPen); + painter->setBrush(QBrush(color)); + painter->drawEllipse(handleRect); + + if (!aa) + painter->setRenderHint(QPainter::Antialiasing, false); +} + void renderCheckerPattern(QPainter *painter, QRectF rect) { QImage pattern(rect.width(), rect.height(), QImage::Format_ARGB32_Premultiplied); @@ -78,33 +144,52 @@ for(int x = y % 2; x < cellSizeX; x += 2) p.fillRect(QRectF(x * cellSize, y * cellSize, cellSize, cellSize), QBrush(Qt::lightGray)); + p.end(); painter->drawImage(rect, pattern); } -QPixmap renderSplitColor(QSize size, QColor color, Qt::Orientations orientation, qreal mid) +QPixmap renderColor(QSize size, QColor color, QColor colorShade, double alpha) { - mid = qBound(0., mid, 1.); + alpha = qBound(0., alpha, 1.); - QPixmap pixmap(size.width(), size.height()); - pixmap.fill(Qt::transparent); + int w = size.width(); + int h = size.height(); + double mid = 0.5; - QRectF solid( 0, 0, pixmap.width()*mid, pixmap.height() ); - QRectF alpha( pixmap.width()*mid, 0, pixmap.width()*(1-mid), pixmap.height() ); + QRectF rectColorSolid( 0, 0, w * mid, h * mid ); // top left + QRectF rectColorAlpha( w * mid, 0, w * mid, h * mid ); // top right + QRectF rectShadeSolid( 0, h * mid, w * mid, h * mid ); // bottom left + QRectF rectShadeAlpha( w * mid, h * mid, w * mid, h * mid ); // bottom right - if(orientation == Qt::Vertical){ - solid = QRectF(0, 0, pixmap.width(), pixmap.height() *mid); - alpha = QRectF(0, pixmap.height() *mid, pixmap.width(), pixmap.height() * (1-mid) ); + QColor colorSolid(color); + colorSolid.setAlphaF(1.0); + QColor colorAlpha(color); + colorAlpha.setAlphaF(alpha); + QColor shadeSolid(colorShade); + shadeSolid.setAlphaF(1.0); + QColor shadeAlpha(colorShade); + shadeAlpha.setAlphaF(alpha); + + if(alpha == 1) + { + colorAlpha = colorSolid; + shadeAlpha = shadeSolid; } - QColor col = color; - col.setAlphaF(1); + QPixmap pixmap(w, h); + pixmap.fill(Qt::transparent); QPainter p(&pixmap); - p.setBrush(QBrush(col)); p.setPen(Qt::NoPen); - p.drawRect(solid); - p.setBrush(QBrush(color)); - p.drawRect(alpha); + p.setBrush(QBrush(colorSolid)); + p.drawRect(rectColorSolid); + p.setBrush(QBrush(colorAlpha)); + p.drawRect(rectColorAlpha); + p.setBrush(QBrush(shadeSolid)); + p.drawRect(rectShadeSolid); + p.setBrush(QBrush(shadeAlpha)); + p.drawRect(rectShadeAlpha); + p.end(); return pixmap; } @@ -115,8 +200,219 @@ pixmap.fill(Qt::white); QPainter p(&pixmap); + p.setRenderHint(QPainter::Antialiasing, true); p.setPen(QPen(QBrush(Qt::red), 2)); - p.drawLine(QPoint(0, size.width()), QPoint(size.width(), 0)); + p.drawLine(QPoint(0, size.height()), QPoint(size.width(), 0)); + p.end(); return pixmap; } + +QPixmap renderGradientLinear(QSize size, VGradient gradient) +{ + int w = size.width(); + int h = size.height(); + + QImage pixm(w, h, QImage::Format_ARGB32_Premultiplied); + pixm.fill(Qt::transparent); + + ScPainter *p = new ScPainter(&pixm, w, h); + p->setPen(Qt::black, 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin); + p->setFillMode(ScPainter::Gradient); + p->fill_gradient = gradient; + p->setGradient(VGradient::linear, FPoint(0,h/2), FPoint(w, h/2), FPoint(0,0), 1, 0); + p->drawRect(0, 0, w, h); + p->end(); + delete p; + + return QPixmap::fromImage(pixm); +} + +QPixmap renderGradientRadial(QSize size, VGradient gradient) +{ + int w = size.width(); + int h = size.height(); + qreal wHalf = w / 2; + qreal hHalf = h / 2; + + QImage pixm(w, h, QImage::Format_ARGB32_Premultiplied); + pixm.fill(Qt::transparent); + + ScPainter *p = new ScPainter(&pixm, w, h); + p->setPen(Qt::black, 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin); + p->setFillMode(ScPainter::Gradient); + p->fill_gradient = gradient; + p->setGradient(VGradient::radial, FPoint(wHalf, hHalf), FPoint(w, hHalf), FPoint(wHalf, hHalf), 1, 0); + p->drawRect(0, 0, w, h); + p->end(); + delete p; + + return QPixmap::fromImage(pixm); +} + +QPixmap renderGradientConical(QSize size, VGradient gradient) +{ + int w = size.width(); + int h = size.height(); + qreal wHalf = w / 2; + qreal hHalf = h / 2; + + QConicalGradient grad(wHalf, hHalf, 0); + grad.setStops(gradient.toQGradientStops()); + + QImage pixm(w, h, QImage::Format_ARGB32_Premultiplied); + pixm.fill(Qt::transparent); + + QPainter p(&pixm); + p.setPen(Qt::NoPen); + p.setBrush(grad); + p.translate(0, h); // we have to flip vertically, because QConicalGradient is drawing counter-clockwise + p.scale(1.0, -1.0); + p.drawRect(0, 0, w, h); + p.end(); + + return QPixmap::fromImage(pixm); +} + +QPixmap renderGradient4Colors(QSize size, QColor col1, QColor col2, QColor col3, QColor col4) +{ + int w = size.width(); + int h = size.height(); + + QImage pixm(w, h, QImage::Format_ARGB32_Premultiplied); + pixm.fill(Qt::transparent); + + ScPainter *p = new ScPainter(&pixm, w, h); + p->setPen(Qt::black, 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin); + p->setFillMode(ScPainter::Gradient); + p->fill_gradient = VGradient(); + p->set4ColorGeometry(FPoint(0, 0), FPoint(w, 0), FPoint(w, h), FPoint(0, h), FPoint(0, 0), FPoint(w, 0), FPoint(w, h), FPoint(0, h)); + p->set4ColorColors(col1, col2, col3, col4); + p->drawRect(0, 0, w, h); + p->end(); + delete p; + + return QPixmap::fromImage(pixm); +} + +QPixmap renderGradientDiamond(QSize size, VGradient gradient) +{ + int w = size.width(); + int h = size.height(); + + QImage pixm(w, h, QImage::Format_ARGB32_Premultiplied); + pixm.fill(Qt::transparent); + + ScPainter *p = new ScPainter(&pixm, w, h); + p->setPen(Qt::black, 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin); + p->setFillMode(ScPainter::Gradient); + p->fill_gradient = gradient; + p->setDiamondGeometry(FPoint(0, 0), FPoint(w, 0), FPoint(w, h), FPoint(0, h), FPoint(0, 0), FPoint(w, 0), FPoint(w, h), FPoint(0, h), FPoint(w/2,h/2)); + p->drawRect(0, 0, w, h); + p->end(); + delete p; + + return QPixmap::fromImage(pixm); +} + +QPixmap renderGradientMesh(QSize size) +{ + int w = size.width(); + int w25 = w * .25; + int w50 = w * .5; + int w75 = w * .75; + int h = size.height(); + int h25 = h * .25; + int h50 = h * .5; + int h75 = h * .75; + + QImage pixm(w, h, QImage::Format_ARGB32_Premultiplied); + pixm.fill(Qt::transparent); + + QPainter p(&pixm); + p.setRenderHint(QPainter::Antialiasing); + p.setBrush(QBrush(Qt::white)); + p.drawRect(0, 0, w, h); + p.setPen(Qt::black); + p.drawLine(QPoint(0, h25), QPoint(w, h25)); + p.drawLine(QPoint(0, h50), QPoint(w, h50)); + p.drawLine(QPoint(0, h75), QPoint(w, h75)); + p.drawLine(QPoint(w25, 0), QPoint(w25, h)); + p.drawLine(QPoint(w50, 0), QPoint(w50, h)); + p.drawLine(QPoint(w75, 0), QPoint(w75, h)); + p.setBrush(QBrush(Qt::red)); + p.drawEllipse(QPoint(w50, h50), 3, 3); + p.end(); + + return QPixmap::fromImage(pixm); +} + +QPixmap renderGradientPatchMesh(QSize size) +{ + return renderGradientMesh(size); +} + +QPixmap renderHatch(QSize size, int type, double distance, double angle, bool hasBackground, QColor backgroundColor, QColor foregroundColor) +{ + int w = size.width(); + int h = size.height(); + + QImage pixm(w, h, QImage::Format_ARGB32_Premultiplied); + pixm.fill(Qt::transparent); + + ScPainter *p = new ScPainter(&pixm, w, h); + p->setPen(Qt::black, 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin); + p->setFillMode(ScPainter::Hatch); + p->setHatchParameters(type, distance, angle, hasBackground, backgroundColor, foregroundColor, w, h); + p->drawRect(0, 0, w, h); + p->end(); + delete p; + + return QPixmap::fromImage(pixm); +} + +QPixmap renderPattern(QSize size, ScPattern pattern) +{ + int w = size.width(); + int h = size.height(); + int pW = pattern.getPattern()->width(); + int pH = pattern.getPattern()->height(); + + QImage pixm(w, h, QImage::Format_ARGB32_Premultiplied); + pixm.fill(Qt::transparent); + + Qt::TransformationMode tm = Qt::FastTransformation; + + // use smooth transformation for downscale pattern + if(pW > w || pH > h) + tm = Qt::SmoothTransformation; + + QImage img; + if (pW >= pH) + img = pattern.getPattern()->scaledToWidth(w, tm); + else + img = pattern.getPattern()->scaledToHeight(h, tm); + + QPainter *qp = new QPainter(&pixm); + qp->setPen(Qt::NoPen); + qp->drawImage(w / 2 - img.width() / 2, h / 2 - img.height() / 2, img); + qp->end(); + delete qp; + + return QPixmap::fromImage(pixm); +} + +VColorStop computeInBetweenStop(const VColorStop* last, const VColorStop* actual, double t) +{ + double dist = actual->rampPoint - last->rampPoint; + double perc = (t - last->rampPoint) / dist; + double Rn = ((actual->color.redF() - last->color.redF()) * perc) + last->color.redF(); + double Gn = ((actual->color.greenF() - last->color.greenF()) * perc) + last->color.greenF(); + double Bn = ((actual->color.blueF() - last->color.blueF()) * perc) + last->color.blueF(); + QColor color; + color.setRgbF(Rn, Gn, Bn); + double opacity = ((actual->opacity - last->opacity) * perc) + last->opacity; + int shade = qRound(((actual->shade - last->shade) * perc) + last->shade); + QString name = last->name + actual->name + QString("%1").arg(perc); + return VColorStop(t, t, color, opacity, name, shade); +} Index: scribus/util_gui.h =================================================================== --- scribus/util_gui.h (Revision 26070) +++ scribus/util_gui.h (Arbeitskopie) @@ -4,10 +4,30 @@ #include <QPainter> #include "scribusapi.h" -void SCRIBUS_API renderCircularHandle(QPainter * painter, QPointF center, qreal width, QBrush background); -void SCRIBUS_API renderPointerHandle(QPainter * painter, QPointF pointer, qreal width, QColor background); +class VGradient; +class VColorStop; +class ScPattern; + +void SCRIBUS_API drawCircularHandle(QPainter * painter, QPointF center, qreal width, QBrush background); +void SCRIBUS_API drawPointerHandle(QPainter * painter, QPointF pointer, qreal width, QColor background, bool isEmpty = false); void SCRIBUS_API renderCheckerPattern(QPainter *painter, QRectF rect); +void SCRIBUS_API drawSelectionHandle(QPainter *painter, QPointF point, QPen pen, qreal scaleFactor, bool isActive = false); +void SCRIBUS_API drawNodeHandle(QPainter *painter, QPointF point, QPen pen, qreal scaleFactor, bool isActive = false); +void SCRIBUS_API drawNodeControl(QPainter *painter, QPointF point, QPen pen, qreal scaleFactor, bool isActive = false); +void SCRIBUS_API drawWeldMarker(QPainter *painter, QPointF point, QColor color, qreal scaleFactor); QPixmap SCRIBUS_API renderEmptyPattern(QSize size); -QPixmap SCRIBUS_API renderSplitColor(QSize size, QColor color, Qt::Orientations orientation = Qt::Horizontal, qreal mid = 0.5); +QPixmap SCRIBUS_API renderColor(QSize size, QColor color, QColor colorShade, double alpha = 1.0); +QPixmap SCRIBUS_API renderGradientLinear(QSize size, VGradient gradient); +QPixmap SCRIBUS_API renderGradientRadial(QSize size, VGradient gradient); +QPixmap SCRIBUS_API renderGradientConical(QSize size, VGradient gradient); +QPixmap SCRIBUS_API renderGradient4Colors(QSize size, QColor col1, QColor col2, QColor col3, QColor col4); +QPixmap SCRIBUS_API renderGradientDiamond(QSize size, VGradient gradient); +QPixmap SCRIBUS_API renderGradientMesh(QSize size); +QPixmap SCRIBUS_API renderGradientPatchMesh(QSize size); +QPixmap SCRIBUS_API renderHatch(QSize size, int type, double distance, double angle, bool hasBackground, QColor backgroundColor, QColor foregroundColor); +QPixmap SCRIBUS_API renderPattern(QSize size, ScPattern pattern); +// Helper +VColorStop SCRIBUS_API computeInBetweenStop(const VColorStop* last, const VColorStop* actual, double t); + #endif Index: scribus/vgradient.cpp =================================================================== --- scribus/vgradient.cpp (Revision 26070) +++ scribus/vgradient.cpp (Arbeitskopie) @@ -25,8 +25,10 @@ #include <algorithm> #include <QMutableListIterator> +#include <QHash> #include "vgradient.h" +#include "scribusdoc.h" // colorStop comparison function for stable_sort function bool compareStops(const VColorStop* item1, const VColorStop* item2 ) @@ -151,6 +153,17 @@ return m_colorStops; } +const QList<QGradientStop> &VGradient::toQGradientStops() const +{ + QList<QGradientStop> *list = new QList<QGradientStop>; + + foreach (VColorStop *stop, m_colorStops) { + list->append(QGradientStop(stop->rampPoint, stop->color)); + } + + return *list; +} + void VGradient::clearStops() { while (!m_colorStops.isEmpty()) @@ -244,3 +257,81 @@ my = m.m22() * m_vector.y() + m.m12() * m_vector.x() + m.dy(); m_vector = FPoint(mx, my); } + + +GradientList::GradientList(ScribusDoc* doc, bool retainDoc) + : m_doc(doc), + m_retainDoc(retainDoc) +{ + +} + +void GradientList::setDocument(ScribusDoc* doc) +{ + m_doc = doc; +} + +GradientList& GradientList::operator= (const GradientList& list) +{ + clear(); + if (!m_retainDoc) + m_doc = list.m_doc; + addGradients(list); + return *this; +} + +void GradientList::addGradients(const GradientList& gradientList, bool overwrite) +{ + GradientList::ConstIterator it; + GradientList::ConstIterator itend; + itend = gradientList.end(); + for (it = gradientList.begin(); it != itend; ++it) + { + if (overwrite || !contains(it.key())) + insert(it.key(), it.value()); + } +} + +void GradientList::addGradients(const QHash<QString, VGradient> &gradientList, bool overwrite) +{ + QHash<QString, VGradient>::const_iterator it; + + for (it = gradientList.begin(); it != gradientList.end(); ++it) + { + if (overwrite || !contains(it.key())) + insert(it.key(), it.value()); + } +} + +void GradientList::copyGradients(const GradientList& gradientList, bool overwrite) +{ + clear(); + addGradients(gradientList, overwrite); +} + +ScribusDoc* GradientList::document() const +{ + return m_doc; +} + + +QString GradientList::tryAddGradient(QString name, const VGradient& col) +{ + if (contains(name)) + return name; + bool found = false; + QString ret = name; + GradientList::Iterator it; + for (it = begin(); it != end(); ++it) + { + if (it.value() == col) + { + ret = it.key(); + found = true; + break; + } + } + if (!found) + insert(name, col); + return ret; +} Index: scribus/vgradient.h =================================================================== --- scribus/vgradient.h (Revision 26070) +++ scribus/vgradient.h (Arbeitskopie) @@ -29,10 +29,15 @@ #include <QColor> #include <QList> #include <QTransform> +#include <QMap> +#include <QPointer> +#include <QGradient> #include "fpoint.h" #include "scribusapi.h" +class ScribusDoc; + class SCRIBUS_API VColorStop { public: @@ -114,6 +119,7 @@ void setRepeatMethod(VGradientRepeatMethod repeatMethod) { m_repeatMethod = repeatMethod; } const QList<VColorStop*>& colorStops() const; + const QList<QGradientStop>& toQGradientStops() const; void addStop(const VColorStop& colorStop); void addStop(const QColor &color, double rampPoint, double midPoint, double opa, const QString& name = QString(), int shade = 100); void setStop(const QColor &color, double rampPoint, double midPoint, double opa, const QString& name = QString(), int shade = 100); @@ -137,6 +143,7 @@ void transform(const QTransform& m); + protected: QList<VColorStop*> m_colorStops; @@ -153,4 +160,32 @@ FPoint m_vector; }; +class SCRIBUS_API GradientList : public QMap<QString, VGradient> +{ +public: + GradientList(ScribusDoc* doc = nullptr, bool retainDoc = false); + + GradientList& operator= (const GradientList& list); + + /** \brief Get the document the list is related , return in cpp due to scribusdoc class delcaration */ + ScribusDoc* document() const; + + /** \brief Assign the doc to which the list belong to.*/ + void setDocument(ScribusDoc* doc); + + /** \brief Add colors from the specified list. Colors are added using shadow copy.*/ + void addGradients(const GradientList& gradientList, bool overwrite = true); + void addGradients(const QHash<QString, VGradient>& gradientList, bool overwrite = true); + + /** \brief Copy colors from the specified list.*/ + void copyGradients(const GradientList& gradientList, bool overwrite = true); + + /** \brief Try to add ScColor col to the list, if col already exists either by name or by value the existing color name is returned. */ + QString tryAddGradient(QString name, const VGradient& col); + +protected: + QPointer<ScribusDoc> m_doc; + bool m_retainDoc { false }; +}; + #endif /* __VGRADIENT_H__ */ |
|
i've now compiled the patch and, now, the properties palette (with all the "default" panes open) fits my "normal" screen vertically! that's a huge advance for scribus! while applying the patch i got warnings about spacing: for the future, you might want to take care to remove spaces and tabs at the end of lines : - ) i skimmed through your patch and i did not see much that was worrying to me. just one thing: you're commenting out some lines (instead of removing them) and you are adding some commented out lines. it would be better if in those case you would write in a comment why the code is commented out and what are the conditions for removing them. i've tried to play around with the new widget and, all in all, they already feel good. after the patch has been accepted, if you want, we can talk a bit about some of the interaction (mot of all applying the colors): i have a few ideas and i wonder what you thing about them. |
|
does nitramr need to do anything to get this to be reviewed / accepted? |
|
Hi ale, there are some UI fixes needed. I'm almost done and will provide an updated patch soon. |
|
Reference: 0015896 Although I know ale will be angry, but still... Please consider placing the base point before x,y,z. Base point tool is very useful tool! The DTP workflow logic request the tool to be before x,y,z (although I know ale rarely uses the base point tool). I have uploaded a screenshot. The new layout is no wider than the original. I thank you for hearing the request! |
|
no, i won't get angry for that : - ) but i'd really prefer not to have it on the left, since the panels already too wide! and i might get angry, if the palette eat up all the horizontal space, now that they finally fit vertically! |
|
" but i'd really prefer not to have it on the left, since the panels already too wide!" I understand! and I agree, but... ...this change will not make the panel wider (this can be seen on the screenshot), but the x,y,z panel can be used much more efficiently. This is just an opinion. The decision is yours! Thank you for your work. You guys are great! |
|
@PeterBenedek currently the width of the number input fields based on the max value length. Right now, 8 digits + suffix can fit in. If we set a fixed width for the input fields, it can look wired on different OS GUI's. But if we keep the dynamic width, the panel gets very wide if we put the base point widget in front. Honestly, it is not easy to create a nice UI if the widgets are rendered totally different on each operating system. At the moment I think it can work like it is even if it is not the "standard". But nothing is written in stone. In the meanwhile, I made a UI fix update patch. Patch Notes Updates (based on r26099): - section container are collapsible if the section is disabled - line style selector looked strange on MacOS, now it is fine - fix disabled colors for custom widgets (ColorButton, BasePointWidget, DashEditor, GradientEdtior) - support of OS dark/light theme changes (only for Qt 6.5.0+) - a light and dark splash screen (depends on the OS theme) - I guess I still forgot something :) |
|
i gave it a try. i have the feeling that the placement of the color popups has been improved. nice. (when the popup gets bigger, it still jumps to the side, but that's not a big issue for now) again, for what i'm concerned i'm ok with this getting merged and let further improvements get in in the future. here are some ideas for improvement that came to mind (i don't know if they are already planned or for some reason they will not be take in to consideration): - storing the collapsed / expanded state of the sections (now it makes sense to have a few sections always expanded, and i don't want to expand them each time i start scribus) - the color picking: personally, i would prefer a "fast" selection mode, where i can just click on a on "horizontal" list of color boxes (i attach a screenshot of libreoffice, with a list of the available colors without a name and a button for creating new colors...; in scribus the boxes might be a bit bigger than in LO...); the current widget might be better for some types of document, and there it might be welcome to have a way to switch between the fast and detailed mode. - color picking (2): there should be a way to use the mouse for applying the color and closing the dialog. (a double click on the color?) - color picking (3): i'm not sure that the three dots menu is a good idea (a collapsible section (with stored status) might be a better choice) as said, nothing that needs to get into this patch... rather for future extensions. |
|
@jghali & @cbradney did you had time to check the patch file from my last comment? Please let me know if you want me to change something or if something else is needed from my side. I would like to see the patch merged before I do more changes. |
|
I've committed it now, with some subsequent changes. |
|
I see a few problems. 1) on Windows now scribus crashes right at startup: assert in ComboLineStyle at line 24: ASSERT: "!"QListWidget::setModel() - Changing the model of the QListWidget is not allowed.". I have to comment out line 23 and 24 of combo_linestyle.cpp for it to stop crashing. 2) when clicking on some combos, the height of the displayed list is imho not acceptable 3) clicking on the color or mask buttons of PP fill and line tab often produce not effect 4) when clicking on the color or mask buttons of PP fill and line tab, the displayed dialog sometime cover the canvas so that user does not see what is being done. Imo this is a big usability regression. 5) When clicking on some PP tab, in some situations the tab parameters cannot be accessed because PP cannot be scrolled down. Especially noticeable with drop shadow and attributes tabs 6) after creating new line styles, these new line styles cannot be set from PP 7) on startup, the XYZ section is displayed with a big white space before the X, Y, W, H parameters 8) sometime clicking a collapsed PP tab does not produce correct result and section is shown only partially |
|
I will check it. |
|
ok, I fixed a few things. 1) I found a hint in the Qt documentation. It is required to set first the model and later the view. So I swapped the order. Hopefully it solves the issue. https://doc.qt.io/qt-6/qcombobox.html#setView 2) Please, can you tell me which one? ComboBox for blend mode and line style is customized, as well as the line arrows 4) Mh, the floating behavior is intended. I need to think about the positioning logic. 7) There was an issue with minumHeight() in sectionContainer that mess up the whole layout. I think it solves 5), 8) too propertiespalette_2024-05-27_01.patch.patch (1,030 bytes)
Index: scribus/ui/widgets/combo_linestyle.cpp =================================================================== --- scribus/ui/widgets/combo_linestyle.cpp (Revision 26151) +++ scribus/ui/widgets/combo_linestyle.cpp (Arbeitskopie) @@ -20,8 +20,8 @@ m_list->setViewMode(QListWidget::ListMode); m_list->setItemDelegate(new ScListItemDelegate(QListWidget::ListMode, m_size, ScListItemDelegate::Right, ScListItemDelegate::Simple)); + this->setModel(m_list->model()); this->setView(m_list); - this->setModel(m_list->model()); this->setIconSize(m_size); languageChange(); Index: scribus/ui/widgets/section_container.cpp =================================================================== --- scribus/ui/widgets/section_container.cpp (Revision 26151) +++ scribus/ui/widgets/section_container.cpp (Arbeitskopie) @@ -202,7 +202,7 @@ QSize SectionContainer::minimumSizeHint() const { - QSize s(200, childrenRect().height()); + QSize s(QWidget::minimumSizeHint()); if (isCollapsed()) s.setHeight(header->height()); |
|
Committed that change |
|
1) the crash is indeed fixed 5) seems to be ok now when application is maximized, I however still can see this issue when application is not for some reason. 7) and 8) look to be fixed. |
|
Anymore updates Martin? |
|
@cbradney unfortunately not yet. After the last update of version Qt 6.8 I found a problem with the Advanced Docking System and tried to debug it. https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System/issues/623 |
|
I made a few more changes. First, I changed the MinimumSizeHintMode of each dock. Now it relies on dock size and not stupidly on content size. Now, width based on minimum width of the content, height is auto set by the dock itself. This should fix 5) even for small screens. @ale Second, all the collapse and expand states of the collapsible sections will be loaded on the next app startup. Any state of a section container can be saved, but I limited it to only the section container in PP. propertiespalette_2024-06-09_01.patch (12,336 bytes)
Index: scribus/manager/dock_manager.cpp =================================================================== --- scribus/manager/dock_manager.cpp (Revision 26174) +++ scribus/manager/dock_manager.cpp (Arbeitskopie) @@ -230,7 +230,8 @@ * MinimumSizeHintFromContentMinimumSize */ - dock->setMinimumSizeHintMode(CDockWidget::MinimumSizeHintFromContent); + dock->setMinimumSizeHintMode(CDockWidget::MinimumSizeHintFromDockWidgetMinimumSize); + dock->setMinimumWidth(dock->widget()->minimumSizeHint().width()); connect( dock, &CDockWidget::viewToggled, this, &DockManager::restoreHiddenWorkspace); } Index: scribus/ui/propertiespalette.cpp =================================================================== --- scribus/ui/propertiespalette.cpp (Revision 26174) +++ scribus/ui/propertiespalette.cpp (Arbeitskopie) @@ -55,38 +55,45 @@ // XZY xyzPal = new PropertiesPalette_XYZ( this ); - scXYZ = new SectionContainer("X, Y, &Z"); + scXYZ = new SectionContainer("X, Y, &Z", "SectionPPXYZ", true, true); + scXYZ->setCanSaveState(true); scXYZ->setWidget(xyzPal); + scXYZ->restorePreferences(); // Drop Shadow shadowPal = new PropertiesPalette_Shadow( this ); - scShadow = new SectionContainer("Drop Shadow"); + scShadow = new SectionContainer("Drop Shadow", "SectionPPDropShadow", true, false); + scShadow->setCanSaveState(true); scShadow->setWidget(shadowPal); - scShadow->setIsCollapsed(true); + scShadow->restorePreferences(); // Shape shapePal = new PropertiesPalette_Shape( this ); - scShape = new SectionContainer("&Shape"); + scShape = new SectionContainer("&Shape", "SectionPPShape", true, false); + scShape->setCanSaveState(true); scShape->setWidget(shapePal); - scShape->setIsCollapsed(true); + scShape->restorePreferences(); // Fill fillPal = new PropertiesPalette_Fill(this); - scFill = new SectionContainer("&Fill"); + scFill = new SectionContainer("&Fill", "SectionPPFill", true, false); + scFill->setCanSaveState(true); scFill->setWidget(fillPal); - scFill->setIsCollapsed(true); + scFill->restorePreferences(); // Line linePal = new PropertiesPalette_Line(this); - scLine = new SectionContainer("&Line"); + scLine = new SectionContainer("&Line", "SectionPPLine", true, false); + scLine->setCanSaveState(true); scLine->setWidget(linePal); - scLine->setIsCollapsed(true); + scLine->restorePreferences(); // Attributes attributesPal = new PropertiesPalette_Attributes(this); - scAttributes = new SectionContainer("&Attributes"); + scAttributes = new SectionContainer("&Attributes", "SectionPPAttributes", true, false); + scAttributes->setCanSaveState(true); scAttributes->setWidget(attributesPal); - scAttributes->setIsCollapsed(true); + scAttributes->restorePreferences(); // Layout stack QVBoxLayout * lyt = new QVBoxLayout(); @@ -107,6 +114,8 @@ languageChange(); enablePalettes(false); + + ColorPicker *colorPicker = WidgetManager::instance().colorPicker(); if(colorPicker) { Index: scribus/ui/propertiespalette_text.cpp =================================================================== --- scribus/ui/propertiespalette_text.cpp (Revision 26174) +++ scribus/ui/propertiespalette_text.cpp (Arbeitskopie) @@ -47,59 +47,70 @@ { advancedWidgets = new PropertyWidget_Advanced(this); - scAdvanced = new SectionContainer(tr("Advanced Settings")); - scAdvanced->setWidget(advancedWidgets); - scAdvanced->setIsCollapsed(true); + scAdvanced = new SectionContainer(tr("Advanced Settings"), "SectionTXAdvanced", true, false); + scAdvanced->setCanSaveState(true); + scAdvanced->setWidget(advancedWidgets); + scAdvanced->restorePreferences(); distanceWidgets = new PropertyWidget_Distance(this); - scDistance = new SectionContainer(tr("Columns && Text Distances")); + scDistance = new SectionContainer(tr("Columns && Text Distances"), "SectionTXColDist", true, false); + scDistance->setCanSaveState(true); scDistance->setWidget(distanceWidgets); - scDistance->setIsCollapsed(true); + scDistance->restorePreferences(); flopBox = new PropertyWidget_Flop(this); - scFlop = new SectionContainer(tr("First Line Offset")); + scFlop = new SectionContainer(tr("First Line Offset"), "SectionTXLineOffset", true, false); + scFlop->setCanSaveState(true); scFlop->setWidget(flopBox); - scFlop->setIsCollapsed(true); + scFlop->restorePreferences(); fontfeaturesWidget = new PropertyWidget_FontFeatures(this); - scFontFeatures = new SectionContainer(tr("Font Features")); + scFontFeatures = new SectionContainer(tr("Font Features"), "SectionTXFontFeatures", true, false); + scFontFeatures->setCanSaveState(true); scFontFeatures->setWidget(fontfeaturesWidget); - scFontFeatures->setIsCollapsed(true); + scFontFeatures->restorePreferences(); hyphenationWidget = new PropertyWidget_Hyphenation(this); - scHyphenation = new SectionContainer(tr("Hyphenation")); + scHyphenation = new SectionContainer(tr("Hyphenation"), "SectionTXHyphenation", true, false); + scHyphenation->setCanSaveState(true); scHyphenation->setWidget(hyphenationWidget); - scHyphenation->setIsCollapsed(true); + scHyphenation->restorePreferences(); optMargins = new PropertyWidget_OptMargins(this); - scOptMargins = new SectionContainer(tr("Optical Margins")); + scOptMargins = new SectionContainer(tr("Optical Margins"), "SectionTXMargins", true, false); + scOptMargins->setCanSaveState(true); scOptMargins->setWidget(optMargins); - scOptMargins->setIsCollapsed(true); + scOptMargins->restorePreferences(); orphanBox = new PropertyWidget_Orphans(this); - scOrphans = new SectionContainer(tr("Orphans and Widows")); + scOrphans = new SectionContainer(tr("Orphans and Widows"), "SectionTXOrphansWidow", true, false); + scOrphans->setCanSaveState(true); scOrphans->setWidget(orphanBox); - scOrphans->setIsCollapsed(true); + scOrphans->restorePreferences(); parEffectWidgets = new PropertyWidget_ParEffect(this); - scParEffect = new SectionContainer(tr("Paragraph Effects")); + scParEffect = new SectionContainer(tr("Paragraph Effects"), "SectionTXEffects", true, false); + scParEffect->setCanSaveState(true); scParEffect->setWidget(parEffectWidgets); - scParEffect->setIsCollapsed(true); + scParEffect->restorePreferences(); pathTextWidgets = new PropertyWidget_PathText(this); - scPathText = new SectionContainer(tr("Path Text Properties")); + scPathText = new SectionContainer(tr("Path Text Properties"), "SectionTXPathText", true, false); + scPathText->setCanSaveState(true); scPathText->setWidget(pathTextWidgets); - scPathText->setIsCollapsed(true); + scPathText->restorePreferences(); textWidgets = new PropertyWidget_Text(this); - scText = new SectionContainer(tr("Text")); + scText = new SectionContainer(tr("Text"), "SectionTXText", true, true); + scText->setCanSaveState(true); scText->setWidget(textWidgets); - scText->setIsCollapsed(false); + scText->restorePreferences(); colorWidgets = new PropertyWidget_TextColor(this); - scTextColor = new SectionContainer(tr("Color && Effects")); + scTextColor = new SectionContainer(tr("Color && Effects"), "SectionTXColorEffects", true, false); + scTextColor->setCanSaveState(true); scTextColor->setWidget(colorWidgets); - scTextColor->setIsCollapsed(true); + scTextColor->restorePreferences(); // Layout stack QVBoxLayout * lyt = new QVBoxLayout(); Index: scribus/ui/widgets/section_container.cpp =================================================================== --- scribus/ui/widgets/section_container.cpp (Revision 26174) +++ scribus/ui/widgets/section_container.cpp (Arbeitskopie) @@ -9,6 +9,8 @@ #include "iconmanager.h" #include "scribusapp.h" #include "util_gui.h" +#include "prefsmanager.h" +#include "prefsfile.h" #endif /* ********************************************************************************* @@ -20,16 +22,18 @@ */ SectionContainer::SectionContainer(QWidget *parent) - : SectionContainer("Title", true, parent) {} + : SectionContainer("Title", "", true, parent) {} -SectionContainer::SectionContainer(QString title, bool isCollapsible, +SectionContainer::SectionContainer(QString title, QString objectName, bool isCollapsible, bool isExpanded, QWidget *parent) : QWidget{parent} { + + if(!objectName.isEmpty()) + setObjectName(objectName); + header = new SectionContainerHeader(title); - m_isCollapsible = isCollapsible; - m_isCollapsed = false; - m_hasStyle = true; + m_isCollapsed = !isExpanded; // Main Layout mainLayout = new QVBoxLayout(this); @@ -46,6 +50,7 @@ // initial Setup setIsCollapsible(isCollapsible); + setIsCollapsedInternal(m_isCollapsed); connectSlots(); } @@ -103,6 +108,16 @@ return m_hasStyle; } +void SectionContainer::setCanSaveState(bool saveState) +{ + m_canSaveState = saveState; +} + +bool SectionContainer::canSaveState() +{ + return m_canSaveState; +} + void SectionContainer::setIsCollapsible(bool isCollapsible) { m_isCollapsible = isCollapsible; @@ -124,6 +139,22 @@ if (isCollapsible() == false) return; + setIsCollapsedInternal(state); + +#ifndef EXCLUDE_FOR_DESIGNER_PLUGIN + savePreferences(); +#endif + + emit collapsedStateChanged(m_isCollapsed); + emit sizeChanged(); + +} + +void SectionContainer::setIsCollapsedInternal(bool state) +{ + if (isCollapsible() == false) + return; + m_isCollapsed = state; header->buttonCollapse->setIcon(m_isCollapsed ? iconCollapsed : iconExpanded); @@ -130,8 +161,6 @@ body->setVisible(!m_isCollapsed); resize(calculateSize()); - emit collapsedStateChanged(m_isCollapsed); - emit sizeChanged(); } void SectionContainer::collapse() @@ -355,6 +384,36 @@ this->height() - lineWidth); } +#ifndef EXCLUDE_FOR_DESIGNER_PLUGIN +void SectionContainer::savePreferences() +{ + if(!canSaveState()) + return; + + if(objectName().isEmpty()) + return; + + PrefsContext *prefCollapse = PrefsManager::instance().prefsFile->getContext(objectName()); + prefCollapse->set("collapsed", m_isCollapsed); + + PrefsManager::instance().prefsFile->write(); +} + +void SectionContainer::restorePreferences() +{ + if(!canSaveState()) + return; + + if(objectName().isEmpty()) + return; + + PrefsContext *prefCollapse = PrefsManager::instance().prefsFile->getContext(objectName()); + bool isCollapsed = prefCollapse->getBool("collapsed", m_isCollapsed); + + setIsCollapsedInternal(isCollapsed); +} +#endif + /* ********************************************************************************* * * * Index: scribus/ui/widgets/section_container.h =================================================================== --- scribus/ui/widgets/section_container.h (Revision 26174) +++ scribus/ui/widgets/section_container.h (Arbeitskopie) @@ -6,6 +6,10 @@ #include <QVBoxLayout> #include <QWidget> +#ifndef EXCLUDE_FOR_DESIGNER_PLUGIN +class PrefsContext; +#endif + /* ********************************************************************************* * * * Section Container Header @@ -61,7 +65,7 @@ public: SectionContainer(QWidget *parent = nullptr); - SectionContainer(QString title, bool isCollapsible = true, QWidget *parent = nullptr); + SectionContainer(QString title, QString objectName, bool isCollapsible = true, bool isExpanded = true, QWidget *parent = nullptr); void setText(QString text); QString text() const; @@ -72,6 +76,9 @@ void setHasStyle(bool hasStyle); bool hasStyle() const; + void setCanSaveState(bool saveState); + bool canSaveState(); + void setIsCollapsible(bool isCollapsible); bool isCollapsible() const; bool isCollapsed() const; @@ -103,6 +110,11 @@ void addHeaderPrefixSpacing(int size); void insertHeaderPrefixSpacing(int index, int size); +#ifndef EXCLUDE_FOR_DESIGNER_PLUGIN + void savePreferences(); + void restorePreferences(); +#endif + private: SectionContainerHeader *header { nullptr }; QWidget* body {new QWidget()}; @@ -109,10 +121,11 @@ QVBoxLayout *mainLayout { nullptr }; QIcon iconCollapsed; QIcon iconExpanded; - bool m_isCollapsible; + bool m_isCollapsible {true}; bool m_isCollapsed { false }; - bool m_hasStyle { false }; + bool m_hasStyle { true }; bool m_hasBody {false}; + bool m_canSaveState {false}; bool eventFilter(QObject *object, QEvent *event) override; @@ -122,6 +135,7 @@ protected: QSize calculateSize(); + void setIsCollapsedInternal(bool state); public slots: void toggleCollpasedState(); |
|
Patch committed, thanks Martin |
|
Minor issue... the combobox label is not aligned with the colour and erase fill ones. Its the same on the other sections for comboboxes so I suspect margins for those widgets? |
|
I'm not sure about Jean's 6), however I have somehow managed to disable a lot of the widgets on the Properties palette. I created a new line style and now I cannot use the comboboxes. I can use the colour selectors and for example line style (dashes) combo, however the actual style combo seems enabled but unusable. Its the same across most of the sections. Maybe its Jean's 5) but I didn't need to scroll, the entire palette was visible. |
|
I fixed the label alignment by changing the size policy of the form widget. The patch fixes the label issue. The issue with the combo box is strange. It looks like it relates to a custom list item delegate (ScListItemDelegate). I have no problems on Ubuntu, but history has shown that Linux is more tolerant of certain problems. I will debug the whole thing on a Mac this weekend. propertiespalette_2024-06-12_01.patch (11,504 bytes)
Index: ScribusDesignerPlugins.pro =================================================================== --- ScribusDesignerPlugins.pro (Revision 26175) +++ ScribusDesignerPlugins.pro (Arbeitskopie) @@ -19,7 +19,7 @@ DEFINES += "EXCLUDE_FOR_DESIGNER_PLUGIN=1" -QT += widgets uitools #designer +QT += widgets designer #uitools HEADERS += \ scribus/designer/formwidget_plugin.h \ Index: scribus/designer/formwidget_plugin.cpp =================================================================== --- scribus/designer/formwidget_plugin.cpp (Revision 26175) +++ scribus/designer/formwidget_plugin.cpp (Arbeitskopie) @@ -92,7 +92,7 @@ <ui language="c++" displayname="Form Widget"> <widget class="FormWidget" name="formWidget"> <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> + <sizepolicy hsizetype="Preferred" vsizetype="Minimum"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> Index: scribus/ui/propertiespalette_fill.ui =================================================================== --- scribus/ui/propertiespalette_fill.ui (Revision 26175) +++ scribus/ui/propertiespalette_fill.ui (Arbeitskopie) @@ -7,7 +7,7 @@ <x>0</x> <y>0</y> <width>335</width> - <height>66</height> + <height>68</height> </rect> </property> <property name="windowTitle"> @@ -36,12 +36,6 @@ </property> <item> <widget class="FormWidget" name="labelFillColor"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> <property name="label" stdset="0"> <string>Color</string> </property> @@ -80,12 +74,6 @@ </property> <item> <widget class="FormWidget" name="labelFillMask"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> <property name="label" stdset="0"> <string>Mask</string> </property> @@ -122,12 +110,6 @@ </item> <item> <widget class="FormWidget" name="labelBlendmode"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> <property name="label" stdset="0"> <string>Blendmode</string> </property> @@ -159,12 +141,6 @@ </item> <item> <widget class="FormWidget" name="labelFillRule"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> <property name="label" stdset="0"> <string>Fill Rule</string> </property> Index: scribus/ui/propertiespalette_linebase.ui =================================================================== --- scribus/ui/propertiespalette_linebase.ui (Revision 26175) +++ scribus/ui/propertiespalette_linebase.ui (Arbeitskopie) @@ -6,8 +6,8 @@ <rect> <x>0</x> <y>0</y> - <width>314</width> - <height>233</height> + <width>315</width> + <height>235</height> </rect> </property> <layout class="QVBoxLayout" name="verticalLayout"> @@ -57,12 +57,6 @@ </property> <item> <widget class="FormWidget" name="lineColorLabel"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> <property name="label" stdset="0"> <string>Color</string> </property> @@ -104,12 +98,6 @@ </property> <item> <widget class="FormWidget" name="lineMaskLabel"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> <property name="label" stdset="0"> <string>Mask</string> </property> @@ -143,12 +131,6 @@ </item> <item> <widget class="FormWidget" name="lineBlendmodeLabel"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> <property name="label" stdset="0"> <string>Blendmode</string> </property> @@ -180,12 +162,6 @@ </item> <item> <widget class="FormWidget" name="lineMarkerLabel"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> <property name="label" stdset="0"> <string>Marker</string> </property> @@ -274,12 +250,6 @@ </property> <item> <widget class="FormWidget" name="lineWidthLabel"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> <property name="label" stdset="0"> <string>Width</string> </property> @@ -325,12 +295,6 @@ </item> <item> <widget class="FormWidget" name="lineTypeLabel"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> <property name="label" stdset="0"> <string>Type</string> </property> @@ -393,12 +357,6 @@ </property> <item> <widget class="FormWidget" name="lineEndLabel"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> <property name="label" stdset="0"> <string>Caps</string> </property> @@ -461,12 +419,6 @@ </item> <item> <widget class="FormWidget" name="lineJoinLabel"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> <property name="label" stdset="0"> <string>Joins</string> </property> @@ -549,16 +501,16 @@ <container>1</container> </customwidget> <customwidget> + <class>ScrSpinBox</class> + <extends>QDoubleSpinBox</extends> + <header>ui/scrspinbox.h</header> + </customwidget> + <customwidget> <class>ColorButton</class> <extends>QToolButton</extends> <header>ui/widgets/color_button.h</header> </customwidget> <customwidget> - <class>ScrSpinBox</class> - <extends>QDoubleSpinBox</extends> - <header location="global">ui/scrspinbox.h</header> - </customwidget> - <customwidget> <class>LineCombo</class> <extends>QComboBox</extends> <header>ui/linecombo.h</header> Index: scribus/ui/propertiespalette_shadowbase.ui =================================================================== --- scribus/ui/propertiespalette_shadowbase.ui (Revision 26175) +++ scribus/ui/propertiespalette_shadowbase.ui (Arbeitskopie) @@ -134,12 +134,6 @@ </property> <item> <widget class="FormWidget" name="labelColor"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> <property name="label" stdset="0"> <string>Color</string> </property> @@ -176,12 +170,6 @@ </item> <item> <widget class="FormWidget" name="labelBlendmode"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> <property name="label" stdset="0"> <string>Blendmode</string> </property> @@ -311,12 +299,6 @@ </item> <item> <widget class="FormWidget" name="labelErase"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> <property name="label" stdset="0"> <string>Erase Fill</string> </property> @@ -405,12 +387,6 @@ </item> <item row="0" column="0"> <widget class="FormWidget" name="labelHasShadow"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> <property name="label" stdset="0"> <string/> </property> @@ -474,16 +450,16 @@ <container>1</container> </customwidget> <customwidget> + <class>ScrSpinBox</class> + <extends>QDoubleSpinBox</extends> + <header>ui/scrspinbox.h</header> + </customwidget> + <customwidget> <class>ColorButton</class> <extends>QToolButton</extends> <header>ui/widgets/color_button.h</header> </customwidget> <customwidget> - <class>ScrSpinBox</class> - <extends>QDoubleSpinBox</extends> - <header location="global">ui/scrspinbox.h</header> - </customwidget> - <customwidget> <class>ComboBlendMode</class> <extends>QComboBox</extends> <header>ui/widgets/combo_blendmode.h</header> Index: scribus/ui/propertiespalette_shapebase.ui =================================================================== --- scribus/ui/propertiespalette_shapebase.ui (Revision 26175) +++ scribus/ui/propertiespalette_shapebase.ui (Arbeitskopie) @@ -112,12 +112,6 @@ </property> <item> <widget class="FormWidget" name="labelTextFlow"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> <property name="label" stdset="0"> <string>Text Flow</string> </property> @@ -292,6 +286,5 @@ <connections/> <buttongroups> <buttongroup name="textFlowBtnGroup"/> - <buttongroup name="fillRuleBtnGroup"/> </buttongroups> </ui> Index: scribus/ui/widgets/form_widget.cpp =================================================================== --- scribus/ui/widgets/form_widget.cpp (Revision 26175) +++ scribus/ui/widgets/form_widget.cpp (Arbeitskopie) @@ -9,7 +9,7 @@ FormWidget::FormWidget(QWidget *parent) : QWidget(parent) { - QSizePolicy policy(QSizePolicy::Preferred, QSizePolicy::Maximum); + QSizePolicy policy(QSizePolicy::Preferred, QSizePolicy::Minimum); m_font = this->font(); setSizePolicy(policy); |
|
Thanks Martin. Tested ok and committed. I don't know how to reproduce the combobox one.. now that I have, I no longer can reproduce. Strange. |
Date Modified | Username | Field | Change |
---|---|---|---|
2024-03-23 22:29 | nitramr | New Issue | |
2024-03-23 22:29 | nitramr | Status | new => assigned |
2024-03-23 22:29 | nitramr | Assigned To | => nitramr |
2024-03-23 22:29 | nitramr | File Added: propertiespalette_2024-03-23_01.patch | |
2024-03-23 22:29 | nitramr | File Added: Bildschirmfoto vom 2024-03-23 21-58-44.png | |
2024-03-23 22:29 | nitramr | File Added: Bildschirmfoto vom 2024-03-23 22-00-32.png | |
2024-03-23 22:29 | nitramr | File Added: Bildschirmfoto vom 2024-03-23 22-00-53.png | |
2024-03-23 22:29 | nitramr | File Added: Bildschirmfoto vom 2024-03-23 22-01-05.png | |
2024-03-23 22:29 | nitramr | File Added: Bildschirmfoto vom 2024-03-23 22-01-13.png | |
2024-03-23 22:30 | nitramr | Relationship added | related to 0011417 |
2024-03-23 22:30 | nitramr | Relationship added | related to 0015813 |
2024-03-23 22:30 | nitramr | Relationship added | related to 0015896 |
2024-03-23 22:31 | nitramr | Relationship added | related to 0015899 |
2024-03-23 22:31 | nitramr | Relationship added | related to 0009694 |
2024-03-23 22:31 | nitramr | Relationship added | related to 0006044 |
2024-03-23 22:31 | nitramr | Relationship added | related to 0015915 |
2024-03-23 22:38 | nitramr | Relationship added | related to 0014085 |
2024-03-23 22:49 | nitramr | Relationship added | related to 0010785 |
2024-03-23 22:53 | nitramr | Relationship added | related to 0009569 |
2024-03-24 10:07 | ale | Note Added: 0051066 | |
2024-03-24 10:08 | ale | Note Edited: 0051066 | |
2024-03-24 11:50 | nitramr | Note Added: 0051067 | |
2024-03-24 11:50 | nitramr | File Added: Bildschirmfoto vom 2024-03-24 12-31-21.png | |
2024-03-25 21:14 | nitramr | Note Added: 0051068 | |
2024-03-25 21:14 | nitramr | File Added: propertiespalette_2024-03-25_01.patch | |
2024-03-25 21:31 | nitramr | File Deleted: propertiespalette_2024-03-23_01.patch | |
2024-03-27 18:36 | ale | Note Added: 0051070 | |
2024-04-05 09:02 | ale | Note Added: 0051082 | |
2024-04-05 13:37 | nitramr | Note Added: 0051083 | |
2024-04-06 09:02 | PeterBenedek | Note Added: 0051084 | |
2024-04-06 09:02 | PeterBenedek | File Added: PP_panel.jpg | |
2024-04-07 16:36 | ale | Note Added: 0051085 | |
2024-04-08 06:53 | PeterBenedek | Note Added: 0051086 | |
2024-04-10 21:32 | nitramr | Note Added: 0051092 | |
2024-04-10 21:32 | nitramr | File Added: propertiespalette_2024-04-10_01.patch | |
2024-04-10 21:32 | nitramr | File Added: scribus_splash_dark.png | |
2024-04-10 21:32 | nitramr | File Added: scribus_splash_light.png | |
2024-04-13 08:34 | ale | Note Added: 0051097 | |
2024-04-13 08:34 | ale | File Added: libreoffice-pick-color.png | |
2024-05-23 18:11 | nitramr | Note Added: 0051167 | |
2024-05-26 20:48 | cbradney | Note Added: 0051174 | |
2024-05-26 23:21 | jghali | Note Added: 0051175 | |
2024-05-26 23:36 | jghali | Note Edited: 0051175 | |
2024-05-26 23:46 | jghali | Note Edited: 0051175 | |
2024-05-27 00:05 | jghali | Note Edited: 0051175 | |
2024-05-27 00:08 | jghali | Note Edited: 0051175 | |
2024-05-27 16:33 | nitramr | Note Added: 0051176 | |
2024-05-27 17:51 | nitramr | Note Added: 0051177 | |
2024-05-27 17:51 | nitramr | File Added: propertiespalette_2024-05-27_01.patch.patch | |
2024-05-27 18:35 | cbradney | Note Added: 0051178 | |
2024-05-27 20:46 | jghali | Note Added: 0051179 | |
2024-05-27 20:48 | jghali | Note Edited: 0051179 | |
2024-06-05 20:13 | cbradney | Note Added: 0051200 | |
2024-06-05 20:28 | nitramr | Note Added: 0051201 | |
2024-06-09 17:42 | nitramr | Note Added: 0051204 | |
2024-06-09 17:42 | nitramr | File Added: propertiespalette_2024-06-09_01.patch | |
2024-06-10 20:18 | cbradney | Note Added: 0051207 | |
2024-06-12 20:02 | cbradney | Note Added: 0051209 | |
2024-06-12 20:02 | cbradney | File Added: image.png | |
2024-06-12 20:05 | cbradney | Note Added: 0051210 | |
2024-06-12 20:28 | cbradney | Note Edited: 0051210 | |
2024-06-12 21:22 | nitramr | Note Added: 0051211 | |
2024-06-12 21:22 | nitramr | File Added: propertiespalette_2024-06-12_01.patch | |
2024-06-12 21:34 | cbradney | Note Added: 0051212 |