Misc. updates to style editor brush pages
|
@ -1535,6 +1535,12 @@ QStatusBar #StatusBarLabel {
|
|||
#HexagonalColorWheel {
|
||||
qproperty-BGColor: #303030;
|
||||
}
|
||||
#StyleChooserPage {
|
||||
qproperty-CommonChipBoxColor: black;
|
||||
qproperty-SolidChipBoxColor: #e41000;
|
||||
qproperty-SelectedChipBoxColor: white;
|
||||
qproperty-SelectedChipBox2Color: #c7ca32;
|
||||
}
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* Horizontal QSlider */
|
||||
#colorSlider::groove:horizontal {
|
||||
|
|
|
@ -1535,6 +1535,12 @@ QStatusBar #StatusBarLabel {
|
|||
#HexagonalColorWheel {
|
||||
qproperty-BGColor: #202020;
|
||||
}
|
||||
#StyleChooserPage {
|
||||
qproperty-CommonChipBoxColor: black;
|
||||
qproperty-SolidChipBoxColor: #e41000;
|
||||
qproperty-SelectedChipBoxColor: white;
|
||||
qproperty-SelectedChipBox2Color: #c7ca32;
|
||||
}
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* Horizontal QSlider */
|
||||
#colorSlider::groove:horizontal {
|
||||
|
|
|
@ -1535,6 +1535,12 @@ QStatusBar #StatusBarLabel {
|
|||
#HexagonalColorWheel {
|
||||
qproperty-BGColor: #DBDBDB;
|
||||
}
|
||||
#StyleChooserPage {
|
||||
qproperty-CommonChipBoxColor: #c0c0c0;
|
||||
qproperty-SolidChipBoxColor: #e49080;
|
||||
qproperty-SelectedChipBoxColor: black;
|
||||
qproperty-SelectedChipBox2Color: #c7ca32;
|
||||
}
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* Horizontal QSlider */
|
||||
#colorSlider::groove:horizontal {
|
||||
|
|
|
@ -1535,6 +1535,12 @@ QStatusBar #StatusBarLabel {
|
|||
#HexagonalColorWheel {
|
||||
qproperty-BGColor: #484848;
|
||||
}
|
||||
#StyleChooserPage {
|
||||
qproperty-CommonChipBoxColor: black;
|
||||
qproperty-SolidChipBoxColor: #e41000;
|
||||
qproperty-SelectedChipBoxColor: white;
|
||||
qproperty-SelectedChipBox2Color: #c7ca32;
|
||||
}
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* Horizontal QSlider */
|
||||
#colorSlider::groove:horizontal {
|
||||
|
|
|
@ -119,6 +119,12 @@
|
|||
@palette-CurrentCellColor: fade(@hl-bg-color, 50);
|
||||
@palette-ListNumpadShortcutBorderColor: rgb(175, 175, 175);
|
||||
|
||||
// StyleChooserPage Chips
|
||||
@palette-CommonChipBoxColor: black;
|
||||
@palette-SolidChipBoxColor: rgb(228, 16, 0);
|
||||
@palette-SelectedChipBoxColor: white;
|
||||
@palette-SelectedChipBox2Color: rgb(199, 202, 50);
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Button
|
||||
// -----------------------------------------------------------------------------
|
||||
|
|
|
@ -18,6 +18,13 @@
|
|||
qproperty-BGColor: @bg;
|
||||
}
|
||||
|
||||
#StyleChooserPage {
|
||||
qproperty-CommonChipBoxColor: @palette-CommonChipBoxColor;
|
||||
qproperty-SolidChipBoxColor: @palette-SolidChipBoxColor;
|
||||
qproperty-SelectedChipBoxColor: @palette-SelectedChipBoxColor;
|
||||
qproperty-SelectedChipBox2Color: @palette-SelectedChipBox2Color;
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
/* Horizontal QSlider */
|
||||
|
|
|
@ -126,6 +126,11 @@
|
|||
// List view
|
||||
@palette-ListNumpadShortcutBorderColor: rgb(105, 105, 105);
|
||||
|
||||
// StyleChooserPage Chips
|
||||
@palette-CommonChipBoxColor: rgb(192, 192, 192);
|
||||
@palette-SolidChipBoxColor: rgb(228, 144, 128);
|
||||
@palette-SelectedChipBoxColor: black;
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// File Browser / Trees
|
||||
// -----------------------------------------------------------------------------
|
||||
|
|
|
@ -1535,6 +1535,12 @@ QStatusBar #StatusBarLabel {
|
|||
#HexagonalColorWheel {
|
||||
qproperty-BGColor: #808080;
|
||||
}
|
||||
#StyleChooserPage {
|
||||
qproperty-CommonChipBoxColor: black;
|
||||
qproperty-SolidChipBoxColor: #e41000;
|
||||
qproperty-SelectedChipBoxColor: white;
|
||||
qproperty-SelectedChipBox2Color: #c7ca32;
|
||||
}
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* Horizontal QSlider */
|
||||
#colorSlider::groove:horizontal {
|
||||
|
|
BIN
stuff/library/textures/Denim2_s.bmp
Normal file
After Width: | Height: | Size: 192 KiB |
BIN
stuff/library/textures/Knit_s.bmp
Normal file
After Width: | Height: | Size: 48 KiB |
Before Width: | Height: | Size: 257 KiB After Width: | Height: | Size: 768 KiB |
BIN
stuff/library/textures/snakeskin.bmp
Normal file
After Width: | Height: | Size: 48 KiB |
BIN
stuff/library/textures/snakeskinred.bmp
Normal file
After Width: | Height: | Size: 48 KiB |
BIN
stuff/library/textures/snow.bmp
Normal file
After Width: | Height: | Size: 48 KiB |
BIN
stuff/library/textures/wornleather.bmp
Normal file
After Width: | Height: | Size: 48 KiB |
|
@ -57,6 +57,7 @@ public:
|
|||
QString getDescription() const override {
|
||||
return QCoreApplication::translate("TAirbrushRasterStyle", "Airbrush");
|
||||
}
|
||||
std::string getBrushIdName() const override { return "AirbrushRasterStyle"; }
|
||||
|
||||
int getParamCount() const override { return 1; }
|
||||
TColorStyle::ParamType getParamType(int index) const override {
|
||||
|
@ -121,6 +122,7 @@ public:
|
|||
QString getDescription() const override {
|
||||
return QCoreApplication::translate("TBlendRasterStyle", "Blend");
|
||||
}
|
||||
std::string getBrushIdName() const override { return "BlendRasterStyle"; }
|
||||
|
||||
void makeIcon(const TDimension &d) override;
|
||||
|
||||
|
@ -150,6 +152,7 @@ public:
|
|||
QString getDescription() const override {
|
||||
return QCoreApplication::translate("TNoColorRasterStyle", "Markup");
|
||||
}
|
||||
std::string getBrushIdName() const override { return "NoColorRasterStyle"; }
|
||||
|
||||
bool hasMainColor() { return false; }
|
||||
// TPixel32 getMainColor() const {return m_color;}
|
||||
|
|
|
@ -72,6 +72,7 @@ public:
|
|||
QString getDescription() const override {
|
||||
return QCoreApplication::translate("MovingSolidColor", "Offset");
|
||||
}
|
||||
std::string getBrushIdName() const override { return "MovingSolidColor"; }
|
||||
|
||||
void drawRegion(const TColorFunction *cf, const bool antiAliasing,
|
||||
TRegionOutline &boundary) const override;
|
||||
|
@ -119,6 +120,7 @@ public:
|
|||
QString getDescription() const override {
|
||||
return QCoreApplication::translate("ShadowStyle", "Hatched Shading");
|
||||
}
|
||||
std::string getBrushIdName() const override { return "ShadowStyle"; }
|
||||
|
||||
void drawRegion(const TColorFunction *cf, const bool antiAliasing,
|
||||
TRegionOutline &boundary) const override;
|
||||
|
@ -168,6 +170,7 @@ public:
|
|||
QString getDescription() const override {
|
||||
return QCoreApplication::translate("ShadowStyle2", "Plain Shadow");
|
||||
}
|
||||
std::string getBrushIdName() const override { return "ShadowStyle2"; }
|
||||
|
||||
void drawRegion(const TColorFunction *cf, const bool antiAliasing,
|
||||
TRegionOutline &boundary) const override;
|
||||
|
@ -229,6 +232,7 @@ public:
|
|||
QString getDescription() const override {
|
||||
return QCoreApplication::translate("TRubberFillStyle", "Blob");
|
||||
}
|
||||
std::string getBrushIdName() const override { return "RubberFillStyle"; }
|
||||
|
||||
void drawRegion(const TColorFunction *cf, const bool antiAliasing,
|
||||
TRegionOutline &boundary) const override;
|
||||
|
@ -283,6 +287,7 @@ void setMainColor(const TPixel32 &color){ m_shadowColor=color; }
|
|||
return QCoreApplication::translate("TPointShadowFillStyle",
|
||||
"Sponge Shading");
|
||||
}
|
||||
std::string getBrushIdName() const override { return "PointShadowFillStyle"; }
|
||||
|
||||
void drawRegion(const TColorFunction *cf, const bool antiAliasing,
|
||||
TRegionOutline &boundary) const override;
|
||||
|
@ -345,6 +350,7 @@ void setMainColor(const TPixel32 &color){ m_pointColor=color; }
|
|||
QString getDescription() const override {
|
||||
return QCoreApplication::translate("TDottedFillStyle", "Polka Dots");
|
||||
}
|
||||
std::string getBrushIdName() const override { return "DottedFillStyle"; }
|
||||
|
||||
protected:
|
||||
void loadData(TInputStreamInterface &is) override;
|
||||
|
@ -398,6 +404,7 @@ void setMainColor(const TPixel32 &color){ m_pointColor=color; }
|
|||
QString getDescription() const override {
|
||||
return QCoreApplication::translate("TCheckedFillStyle", "Square");
|
||||
}
|
||||
std::string getBrushIdName() const override { return "CheckedFillStyle"; }
|
||||
|
||||
private:
|
||||
void getHThickline(const TPointD &lc, const double lx, TPointD &p0,
|
||||
|
@ -459,6 +466,7 @@ public:
|
|||
QString getDescription() const override {
|
||||
return QCoreApplication::translate("ArtisticSolidColor", "Irregular");
|
||||
}
|
||||
std::string getBrushIdName() const override { return "ArtisticSolidColor"; }
|
||||
|
||||
void drawRegion(const TColorFunction *cf, const bool antiAliasing,
|
||||
TRegionOutline &boundary) const override;
|
||||
|
@ -507,6 +515,8 @@ void setMainColor(const TPixel32 &color){ m_color0=color; }
|
|||
QString getDescription() const override {
|
||||
return QCoreApplication::translate("TChalkFillStyle", "Chalk");
|
||||
}
|
||||
std::string getBrushIdName() const override { return "ChalkFillStyle"; }
|
||||
|
||||
void loadData(int oldId, TInputStreamInterface &) override;
|
||||
void getObsoleteTagIds(std::vector<int> &ids) const override {
|
||||
ids.push_back(1133);
|
||||
|
@ -558,6 +568,7 @@ void setMainColor(const TPixel32 &color){ m_pointColor=color; }
|
|||
QString getDescription() const override {
|
||||
return QCoreApplication::translate("TChessFillStyle", "Chessboard");
|
||||
}
|
||||
std::string getBrushIdName() const override { return "ChessFillStyle"; }
|
||||
|
||||
protected:
|
||||
void loadData(TInputStreamInterface &is) override;
|
||||
|
@ -609,6 +620,7 @@ void setMainColor(const TPixel32 &color){ m_pointColor=color; }
|
|||
QString getDescription() const override {
|
||||
return QCoreApplication::translate("TStripeFillStyle", "Banded");
|
||||
}
|
||||
std::string getBrushIdName() const override { return "StripeFillStyle"; }
|
||||
|
||||
protected:
|
||||
void loadData(TInputStreamInterface &is) override;
|
||||
|
@ -664,6 +676,7 @@ void setMainColor(const TPixel32 &color){ m_pointColor=color; }
|
|||
QString getDescription() const override {
|
||||
return QCoreApplication::translate("TLinGradFillStyle", "Linear Gradient");
|
||||
}
|
||||
std::string getBrushIdName() const override { return "LinGradFillStyle"; }
|
||||
|
||||
protected:
|
||||
void loadData(TInputStreamInterface &is) override;
|
||||
|
@ -717,6 +730,7 @@ public:
|
|||
QString getDescription() const override {
|
||||
return QCoreApplication::translate("TRadGradFillStyle", "Radial Gradient");
|
||||
}
|
||||
std::string getBrushIdName() const override { return "RadGradFillStyle"; }
|
||||
|
||||
protected:
|
||||
void loadData(TInputStreamInterface &is) override;
|
||||
|
@ -765,6 +779,9 @@ void setMainColor(const TPixel32 &color){ m_pointColor=color; }
|
|||
QString getDescription() const override {
|
||||
return QCoreApplication::translate("TCircleStripeFillStyle", "Concentric");
|
||||
}
|
||||
std::string getBrushIdName() const override {
|
||||
return "CircleStripeFillStyle";
|
||||
}
|
||||
|
||||
protected:
|
||||
void loadData(TInputStreamInterface &is) override;
|
||||
|
@ -821,6 +838,7 @@ void setMainColor(const TPixel32 &color){ m_pointColor[0]=color; }
|
|||
QString getDescription() const override {
|
||||
return QCoreApplication::translate("TMosaicFillStyle", "Stained Glass");
|
||||
}
|
||||
std::string getBrushIdName() const override { return "MosaicFillStyle"; }
|
||||
|
||||
protected:
|
||||
void loadData(TInputStreamInterface &is) override;
|
||||
|
@ -871,6 +889,7 @@ public:
|
|||
QString getDescription() const override {
|
||||
return QCoreApplication::translate("TPatchFillStyle", "Beehive");
|
||||
}
|
||||
std::string getBrushIdName() const override { return "PatchFillStyle"; }
|
||||
|
||||
private:
|
||||
void preaprePos(const TRectD &box, std::vector<TPointD> &v, int &lX, int &lY,
|
||||
|
|
|
@ -90,6 +90,7 @@ public:
|
|||
QString getDescription() const override {
|
||||
return QCoreApplication::translate("TFurStrokeStyle", "Herringbone");
|
||||
}
|
||||
std::string getBrushIdName() const override { return "FurStrokeStyle"; }
|
||||
|
||||
bool hasMainColor() const override { return true; }
|
||||
TPixel32 getMainColor() const override { return m_color; }
|
||||
|
@ -132,6 +133,7 @@ public:
|
|||
QString getDescription() const override {
|
||||
return QCoreApplication::translate("TChainStrokeStyle", "Chain");
|
||||
}
|
||||
std::string getBrushIdName() const override { return "ChainStrokeStyle"; }
|
||||
|
||||
bool hasMainColor() const override { return true; }
|
||||
TPixel32 getMainColor() const override { return m_color; }
|
||||
|
@ -163,6 +165,7 @@ public:
|
|||
QString getDescription() const override {
|
||||
return QCoreApplication::translate("TSprayStrokeStyle", "Circlets");
|
||||
}
|
||||
std::string getBrushIdName() const override { return "SprayStrokeStyle"; }
|
||||
|
||||
bool hasMainColor() const override { return true; }
|
||||
TPixel32 getMainColor() const override { return m_color; }
|
||||
|
@ -205,6 +208,9 @@ public:
|
|||
QString getDescription() const override {
|
||||
return QCoreApplication::translate("TGraphicPenStrokeStyle", "Dashes");
|
||||
}
|
||||
std::string getBrushIdName() const override {
|
||||
return "GraphicPenStrokeStyle";
|
||||
}
|
||||
|
||||
bool hasMainColor() const override { return true; }
|
||||
TPixel32 getMainColor() const override { return m_color; }
|
||||
|
@ -253,6 +259,9 @@ public:
|
|||
QString getDescription() const override {
|
||||
return QCoreApplication::translate("TDottedLineStrokeStyle", "Vanishing");
|
||||
}
|
||||
std::string getBrushIdName() const override {
|
||||
return "DottedLineStrokeStyle";
|
||||
}
|
||||
|
||||
bool hasMainColor() const override { return true; }
|
||||
TPixel32 getMainColor() const override { return m_color; }
|
||||
|
@ -298,6 +307,7 @@ public:
|
|||
QString getDescription() const override {
|
||||
return QCoreApplication::translate("TRopeStrokeStyle", "Rope");
|
||||
}
|
||||
std::string getBrushIdName() const override { return "RopeStrokeStyle"; }
|
||||
|
||||
bool hasMainColor() const override { return true; }
|
||||
TPixel32 getMainColor() const override { return m_color; }
|
||||
|
@ -341,6 +351,9 @@ public:
|
|||
QString getDescription() const override {
|
||||
return QCoreApplication::translate("TCrystallizeStrokeStyle", "Tulle");
|
||||
}
|
||||
std::string getBrushIdName() const override {
|
||||
return "CrystallizeStrokeStyle";
|
||||
}
|
||||
|
||||
bool hasMainColor() const override { return true; }
|
||||
TPixel32 getMainColor() const override { return m_color; }
|
||||
|
@ -384,6 +397,7 @@ public:
|
|||
QString getDescription() const override {
|
||||
return QCoreApplication::translate("TBraidStrokeStyle", "Plait");
|
||||
}
|
||||
std::string getBrushIdName() const override { return "BraidStrokeStyle"; }
|
||||
|
||||
bool hasMainColor() const override { return true; }
|
||||
TPixel32 getMainColor() const override { return m_colors[0]; }
|
||||
|
@ -432,6 +446,7 @@ public:
|
|||
QString getDescription() const override {
|
||||
return QCoreApplication::translate("TSketchStrokeStyle", "Fuzz");
|
||||
}
|
||||
std::string getBrushIdName() const override { return "SketchStrokeStyle"; }
|
||||
|
||||
bool hasMainColor() const override { return true; }
|
||||
TPixel32 getMainColor() const override { return m_color; }
|
||||
|
@ -474,6 +489,7 @@ public:
|
|||
QString getDescription() const override {
|
||||
return QCoreApplication::translate("TBubbleStrokeStyle", "Bubbles");
|
||||
}
|
||||
std::string getBrushIdName() const override { return "BubbleStrokeStyle"; }
|
||||
|
||||
bool hasMainColor() const override { return true; }
|
||||
TPixel32 getMainColor() const override { return m_color0; }
|
||||
|
@ -529,6 +545,7 @@ public:
|
|||
QString getDescription() const override {
|
||||
return QCoreApplication::translate("TTissueStrokeStyle", "Gauze");
|
||||
}
|
||||
std::string getBrushIdName() const override { return "TissueStrokeStyle"; }
|
||||
|
||||
bool hasMainColor() const override { return true; }
|
||||
TPixel32 getMainColor() const override { return m_color; }
|
||||
|
@ -576,6 +593,7 @@ public:
|
|||
QString getDescription() const override {
|
||||
return QCoreApplication::translate("TBiColorStrokeStyle", "Shade");
|
||||
}
|
||||
std::string getBrushIdName() const override { return "BiColorStrokeStyle"; }
|
||||
|
||||
bool hasMainColor() const override { return true; }
|
||||
TPixel32 getMainColor() const override { return m_color0; }
|
||||
|
@ -628,6 +646,7 @@ public:
|
|||
QString getDescription() const override {
|
||||
return QCoreApplication::translate("TNormal2StrokeStyle", "Bump");
|
||||
}
|
||||
std::string getBrushIdName() const override { return "Normal2StrokeStyle"; }
|
||||
|
||||
bool hasMainColor() const override { return true; }
|
||||
TPixel32 getMainColor() const override { return m_color; }
|
||||
|
@ -671,6 +690,7 @@ public:
|
|||
QString getDescription() const override {
|
||||
return QCoreApplication::translate("TChalkStrokeStyle2", "Chalk");
|
||||
}
|
||||
std::string getBrushIdName() const override { return "ChalkStrokeStyle2"; }
|
||||
|
||||
bool hasMainColor() const override { return true; }
|
||||
TPixel32 getMainColor() const override { return m_color; }
|
||||
|
@ -724,6 +744,7 @@ public:
|
|||
QString getDescription() const override {
|
||||
return QCoreApplication::translate("TBlendStrokeStyle2", "Fade");
|
||||
}
|
||||
std::string getBrushIdName() const override { return "BlendStrokeStyle2"; }
|
||||
|
||||
bool hasMainColor() const override { return true; }
|
||||
TPixel32 getMainColor() const override { return m_color; }
|
||||
|
@ -774,6 +795,7 @@ public:
|
|||
QString getDescription() const override {
|
||||
return QCoreApplication::translate("TTwirlStrokeStyle", "Ribbon");
|
||||
}
|
||||
std::string getBrushIdName() const override { return "TwirlStrokeStyle"; }
|
||||
|
||||
bool hasMainColor() const override { return true; }
|
||||
TPixel32 getMainColor() const override { return m_color; }
|
||||
|
@ -826,6 +848,7 @@ public:
|
|||
QString getDescription() const override {
|
||||
return QCoreApplication::translate("TSawToothStrokeStyle", "Jagged");
|
||||
}
|
||||
std::string getBrushIdName() const override { return "SawToothStrokeStyle"; }
|
||||
|
||||
bool hasMainColor() const override { return true; }
|
||||
TPixel32 getMainColor() const override { return m_color; }
|
||||
|
@ -871,6 +894,9 @@ public:
|
|||
QString getDescription() const override {
|
||||
return QCoreApplication::translate("TMultiLineStrokeStyle2", "Gouache");
|
||||
}
|
||||
std::string getBrushIdName() const override {
|
||||
return "MultiLineStrokeStyle2";
|
||||
}
|
||||
|
||||
bool hasMainColor() const override { return true; }
|
||||
TPixel32 getMainColor() const override { return m_color0; }
|
||||
|
@ -941,6 +967,7 @@ public:
|
|||
QString getDescription() const override {
|
||||
return QCoreApplication::translate("TZigzagStrokeStyle", "Zigzag");
|
||||
}
|
||||
std::string getBrushIdName() const override { return "ZigzagStrokeStyle"; }
|
||||
|
||||
bool hasMainColor() const override { return true; }
|
||||
TPixel32 getMainColor() const override { return m_color; }
|
||||
|
@ -989,6 +1016,7 @@ public:
|
|||
QString getDescription() const override {
|
||||
return QCoreApplication::translate("TSinStrokeStyle", "Wave");
|
||||
}
|
||||
std::string getBrushIdName() const override { return "SinStrokeStyle"; }
|
||||
|
||||
bool hasMainColor() const override { return true; }
|
||||
TPixel32 getMainColor() const override { return m_color; }
|
||||
|
@ -1028,6 +1056,7 @@ public:
|
|||
QString getDescription() const override {
|
||||
return QCoreApplication::translate("TFriezeStrokeStyle2", "Curl");
|
||||
}
|
||||
std::string getBrushIdName() const override { return "FriezeStrokeStyle2"; }
|
||||
|
||||
bool hasMainColor() const override { return true; }
|
||||
TPixel32 getMainColor() const override { return m_color; }
|
||||
|
@ -1089,6 +1118,9 @@ public:
|
|||
QString getDescription() const override {
|
||||
return QCoreApplication::translate("TDualColorStrokeStyle2", "Striped");
|
||||
}
|
||||
std::string getBrushIdName() const override {
|
||||
return "DualColorStrokeStyle2";
|
||||
}
|
||||
|
||||
bool hasMainColor() const override { return true; }
|
||||
TPixel32 getMainColor() const override { return m_color0; }
|
||||
|
@ -1151,6 +1183,9 @@ public:
|
|||
QString getDescription() const override {
|
||||
return QCoreApplication::translate("TLongBlendStrokeStyle2", "Watercolor");
|
||||
}
|
||||
std::string getBrushIdName() const override {
|
||||
return "LongBlendStrokeStyle2";
|
||||
}
|
||||
|
||||
bool hasMainColor() const override { return true; }
|
||||
TPixel32 getMainColor() const override { return m_color0; }
|
||||
|
@ -1240,6 +1275,7 @@ public:
|
|||
return QCoreApplication::translate("OutlineViewerStyle",
|
||||
"OutlineViewer(OnlyDebug)");
|
||||
}
|
||||
std::string getBrushIdName() const override { return "OutlineViewerStyle"; }
|
||||
int getTagId() const override { return 99; };
|
||||
};
|
||||
|
||||
|
@ -1303,6 +1339,8 @@ public:
|
|||
QString getDescription() const override {
|
||||
return QCoreApplication::translate("TMatrioskaStrokeStyle", "Toothpaste");
|
||||
}
|
||||
std::string getBrushIdName() const override { return "MatrioskaStrokeStyle"; }
|
||||
|
||||
int getTagId() const override { return 141; };
|
||||
};
|
||||
|
||||
|
|
|
@ -50,6 +50,7 @@ TColorStyle::TColorStyle()
|
|||
, m_icon(0)
|
||||
, m_validIcon(false)
|
||||
, m_isEditedFromOriginal(false)
|
||||
, m_hash(0)
|
||||
, m_pickedPosition()
|
||||
, m_isCustom(false) {}
|
||||
|
||||
|
@ -68,6 +69,7 @@ TColorStyle::TColorStyle(const TColorStyle &other)
|
|||
, m_enabled(other.m_enabled)
|
||||
, m_validIcon(false)
|
||||
, m_isEditedFromOriginal(other.m_isEditedFromOriginal)
|
||||
, m_hash(other.m_hash)
|
||||
, m_pickedPosition(other.m_pickedPosition)
|
||||
, m_isCustom(other.m_isCustom) {}
|
||||
|
||||
|
@ -82,6 +84,7 @@ TColorStyle &TColorStyle::operator=(const TColorStyle &other) {
|
|||
m_enabled = other.m_enabled;
|
||||
m_validIcon = false;
|
||||
m_isEditedFromOriginal = other.m_isEditedFromOriginal;
|
||||
m_hash = other.m_hash;
|
||||
m_pickedPosition = other.m_pickedPosition;
|
||||
m_isCustom = other.m_isCustom;
|
||||
|
||||
|
@ -142,6 +145,13 @@ bool TColorStyle::operator==(const TColorStyle &cs) const {
|
|||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
QString TColorStyle::getDescription() const {
|
||||
assert(false);
|
||||
return QString("");
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
QString TColorStyle::getParamNames(int index) const {
|
||||
assert(false);
|
||||
return QString("");
|
||||
|
@ -426,6 +436,23 @@ public:
|
|||
return it->second.m_style->clone();
|
||||
}
|
||||
|
||||
TColorStyle *create(std::string brushIdName) {
|
||||
int index = brushIdName.find(':');
|
||||
std::string brushIdCategory =
|
||||
(index != -1) ? brushIdName.substr(0, index) : brushIdName;
|
||||
|
||||
for (auto &table : m_table) {
|
||||
std::string name = table.second.m_style->getBrushIdName();
|
||||
int index = name.find(':');
|
||||
if (index != -1 && brushIdCategory == name.substr(0, index)) {
|
||||
return table.second.m_style->clone(brushIdName);
|
||||
} else if (index == -1 && brushIdCategory == name) {
|
||||
return table.second.m_style->clone(brushIdName);
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void getAllTags(std::vector<int> &tags) {
|
||||
tags.clear();
|
||||
tags.reserve(m_table.size());
|
||||
|
@ -576,6 +603,56 @@ TColorStyle *TColorStyle::create(int tagId) {
|
|||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
TColorStyle *TColorStyle::create(std::string brushIdName) {
|
||||
return ColorStyleList::instance()->create(brushIdName);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
void TColorStyle::getAllTags(std::vector<int> &tags) {
|
||||
ColorStyleList::instance()->getAllTags(tags);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
std::string TColorStyle::getBrushIdName() const {
|
||||
assert(false);
|
||||
return "InvalidStyle";
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
std::size_t TColorStyle::generateHash(std::string brushIdName) {
|
||||
std::hash<std::string> hasher;
|
||||
std::size_t v_hash = hasher(brushIdName);
|
||||
return v_hash;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
std::size_t TColorStyle::getBrushIdHash() {
|
||||
if (m_hash) return m_hash;
|
||||
|
||||
std::hash<std::string> hasher;
|
||||
std::string brushId = getBrushIdName();
|
||||
m_hash = hasher(brushId);
|
||||
return m_hash;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
std::string TColorStyle::getBrushIdNameClass(std::string brushIdName) {
|
||||
int index = brushIdName.find(':');
|
||||
if (index >= 0) return brushIdName.substr(0, index);
|
||||
return brushIdName;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
std::string TColorStyle::getBrushIdNameParam(std::string brushIdName) {
|
||||
int index = brushIdName.find(':');
|
||||
if (index < 0) return "";
|
||||
return brushIdName.substr(index + 1);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
|
@ -132,9 +132,9 @@ public:
|
|||
next_stage(x, y, z);
|
||||
else {
|
||||
if (stage == 2) next_stage(x, y, z);
|
||||
double l = fabs(ax + bx) > 1e-9
|
||||
? -(ay - by) / (ax + bx)
|
||||
: fabs(ay + by) > 1e-9 ? (ax - bx) / (ay + by) : 0.0;
|
||||
double l = fabs(ax + bx) > 1e-9 ? -(ay - by) / (ax + bx)
|
||||
: fabs(ay + by) > 1e-9 ? (ax - bx) / (ay + by)
|
||||
: 0.0;
|
||||
if (fabs(l) > maxl || fabs(l) < 1.0 || l > 0.0) {
|
||||
vertices.resize(vertices.size() + 12);
|
||||
double *p = &vertices.back() - 11;
|
||||
|
@ -723,6 +723,19 @@ QString TSolidColorStyle::getDescription() const { return "SolidColorStyle"; }
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
std::string TSolidColorStyle::getBrushIdName() const {
|
||||
return "SolidColorStyle";
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
std::size_t TSolidColorStyle::staticBrushIdHash() {
|
||||
static std::size_t bidHash = TColorStyle::generateHash("SolidColorStyle");
|
||||
return bidHash;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
int TSolidColorStyle::getTagId() const { return 3; }
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -888,6 +901,12 @@ QString TCenterLineStrokeStyle::getDescription() const {
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
std::string TCenterLineStrokeStyle::getBrushIdName() const {
|
||||
return "CenterLineStrokeStyle";
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
int TCenterLineStrokeStyle::getTagId() const { return 2; }
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -991,6 +1010,29 @@ TColorStyle *TRasterImagePatternStrokeStyle::clone() const {
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
TColorStyle *TRasterImagePatternStrokeStyle::clone(
|
||||
std::string brushIdName) const {
|
||||
TRasterImagePatternStrokeStyle *style =
|
||||
new TRasterImagePatternStrokeStyle(*this);
|
||||
std::string patternName = getBrushIdNameParam(brushIdName);
|
||||
if (patternName != "") style->loadLevel(patternName);
|
||||
return style;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
QString TRasterImagePatternStrokeStyle::getDescription() const {
|
||||
return "TRasterImagePatternStrokeStyle";
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
std::string TRasterImagePatternStrokeStyle::getBrushIdName() const {
|
||||
return "RasterImagePatternStrokeStyle:" + m_name;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void TRasterImagePatternStrokeStyle::makeIcon(const TDimension &size) {
|
||||
if (!m_level) loadLevel(m_name);
|
||||
m_icon = TRaster32P();
|
||||
|
@ -1410,6 +1452,29 @@ TColorStyle *TVectorImagePatternStrokeStyle::clone() const {
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
TColorStyle *TVectorImagePatternStrokeStyle::clone(
|
||||
std::string brushIdName) const {
|
||||
TVectorImagePatternStrokeStyle *style =
|
||||
new TVectorImagePatternStrokeStyle(*this);
|
||||
std::string patternName = getBrushIdNameParam(brushIdName);
|
||||
if (patternName != "") style->loadLevel(patternName);
|
||||
return style;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
QString TVectorImagePatternStrokeStyle::getDescription() const {
|
||||
return "TVectorImagePatternStrokeStyle";
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
std::string TVectorImagePatternStrokeStyle::getBrushIdName() const {
|
||||
return "VectorImagePatternStrokeStyle:" + m_name;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void TVectorImagePatternStrokeStyle::makeIcon(const TDimension &size) {
|
||||
TLevel::Iterator frameIt = m_level->begin();
|
||||
if (frameIt == m_level->end()) {
|
||||
|
|
|
@ -241,10 +241,26 @@ TColorStyle *TVectorBrushStyle::clone() const {
|
|||
|
||||
//-----------------------------------------------------------------
|
||||
|
||||
TColorStyle *TVectorBrushStyle::clone(std::string brushIdName) const {
|
||||
std::string patternName = getBrushIdNameParam(brushIdName);
|
||||
TVectorBrushStyle *theClone = new TVectorBrushStyle(patternName);
|
||||
theClone->assignNames(this);
|
||||
theClone->setFlags(getFlags());
|
||||
return theClone;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------
|
||||
|
||||
QString TVectorBrushStyle::getDescription() const { return "VectorBrushStyle"; }
|
||||
|
||||
//-----------------------------------------------------------------
|
||||
|
||||
std::string TVectorBrushStyle::getBrushIdName() const {
|
||||
return "VectorBrushStyle:" + m_brushName;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
TStrokeProp *TVectorBrushStyle::makeStrokeProp(const TStroke *stroke) {
|
||||
return new VectorBrushProp(stroke, this);
|
||||
}
|
||||
|
@ -358,7 +374,7 @@ TPixel32 TVectorBrushStyle::getColorParamValue(int index) const {
|
|||
TPalette *pal = m_brush->getPalette();
|
||||
assert(pal);
|
||||
|
||||
int styleId = getColorStyleId(index);
|
||||
int styleId = getColorStyleId(index);
|
||||
if (styleId < 0) styleId = 1;
|
||||
|
||||
return pal->getStyle(styleId)->getMainColor();
|
||||
|
@ -370,7 +386,7 @@ void TVectorBrushStyle::setColorParamValue(int index, const TPixel32 &color) {
|
|||
TPalette *pal = m_brush->getPalette();
|
||||
assert(pal);
|
||||
|
||||
int styleId = getColorStyleId(index);
|
||||
int styleId = getColorStyleId(index);
|
||||
if (styleId < 0) styleId = 1;
|
||||
|
||||
return pal->getStyle(styleId)->setMainColor(color);
|
||||
|
|
|
@ -133,6 +133,8 @@ private:
|
|||
m_pickedPosition; // picked position from color model by using style
|
||||
// picker tool with "organize palette" option.
|
||||
|
||||
std::size_t m_hash; //!< Hash value for quick comparison.
|
||||
|
||||
bool m_isCustom; // for Custom Texture
|
||||
|
||||
protected:
|
||||
|
@ -149,6 +151,7 @@ public:
|
|||
virtual ~TColorStyle();
|
||||
|
||||
virtual TColorStyle *clone() const = 0; //!< Polymorphic clone of the style.
|
||||
virtual TColorStyle *clone(std::string brushIdName) const { return clone(); }
|
||||
virtual TColorStyle ©(
|
||||
const TColorStyle &other) //!< Polymorphic copy of the style.
|
||||
{
|
||||
|
@ -368,10 +371,21 @@ For example for a stroke style we have "Constant", "Chain", "Rope", "Tulle",
|
|||
etc...
|
||||
*/
|
||||
virtual QString getDescription()
|
||||
const = 0; //!< Return a brief description of the style.
|
||||
const; //!< Return a brief description of the style.
|
||||
virtual QString getParamNames(int index)
|
||||
const; //!< Return the string that identifies the \a index-th parameter.
|
||||
|
||||
virtual std::string getBrushIdName()
|
||||
const; //!< Return a name identifying the brush.
|
||||
|
||||
static std::size_t generateHash(std::string brushIdName);
|
||||
std::size_t getBrushIdHash(); //!< Hash for quick comparison (cached).
|
||||
|
||||
static std::string getBrushIdNameClass(
|
||||
std::string brushIdName); //!< Get class inside brush id name
|
||||
static std::string getBrushIdNameParam(
|
||||
std::string brushIdName); //!< Get parameter inside brush id name
|
||||
|
||||
// I/O-related functions
|
||||
|
||||
virtual int getTagId()
|
||||
|
@ -380,15 +394,16 @@ etc...
|
|||
|
||||
void save(TOutputStreamInterface &) const; //!< Calls the local
|
||||
//! implementation of saveData()
|
||||
//! passing it also the name and
|
||||
//! the tagId of the style.
|
||||
//! passing it also the name and the tagId of the style.
|
||||
|
||||
static TColorStyle *load(TInputStreamInterface &); //!< Loads the style from
|
||||
//! disk. Calls the local
|
||||
//! implementation of
|
||||
//! loadData().
|
||||
//! implementation of loadData().
|
||||
|
||||
|
||||
static TColorStyle *create(
|
||||
int tagId); //!< Creates a new style with identifier equal to \a tagId.
|
||||
static TColorStyle *create(std::string brushIdName);
|
||||
|
||||
static void declare(
|
||||
TColorStyle *style); //!< Puts the style in the table of actual styles.
|
||||
|
|
|
@ -132,7 +132,11 @@ public:
|
|||
void setColorParamValue(int index, const TPixel32 &color) override;
|
||||
|
||||
TColorStyle *clone() const override;
|
||||
TColorStyle *clone(std::string brushIdName) const override;
|
||||
|
||||
QString getDescription() const override;
|
||||
std::string getBrushIdName() const override;
|
||||
static std::string staticBrushIdName(std::wstring texturePath);
|
||||
|
||||
bool hasMainColor() const override { return true; }
|
||||
TPixel32 getMainColor() const override { return m_averageColor; }
|
||||
|
|
|
@ -44,6 +44,7 @@ public:
|
|||
~TMyPaintBrushStyle();
|
||||
|
||||
TColorStyle *clone() const override { return new TMyPaintBrushStyle(*this); }
|
||||
TColorStyle *clone(std::string brushIdName) const override;
|
||||
|
||||
TColorStyle ©(const TColorStyle &other) override;
|
||||
|
||||
|
@ -67,6 +68,7 @@ public:
|
|||
int getTagId() const override { return 4001; }
|
||||
|
||||
QString getDescription() const override;
|
||||
std::string getBrushIdName() const override;
|
||||
|
||||
void setBaseValue(MyPaintBrushSetting id, bool enable, float value);
|
||||
void resetBaseValues();
|
||||
|
|
|
@ -40,17 +40,19 @@ class DVAPI CustomStyleManager final : public QObject {
|
|||
public:
|
||||
struct DVAPI PatternData {
|
||||
QImage *m_image;
|
||||
std::string m_patternName;
|
||||
QString m_patternName;
|
||||
bool m_isVector;
|
||||
bool m_isGenerated;
|
||||
TFilePath m_path;
|
||||
std::string m_idName; // brush id name
|
||||
|
||||
PatternData()
|
||||
: m_image(0)
|
||||
, m_patternName("")
|
||||
, m_isVector(false)
|
||||
, m_isGenerated(false)
|
||||
, m_path(TFilePath()) {}
|
||||
, m_path(TFilePath())
|
||||
, m_idName("") {}
|
||||
};
|
||||
|
||||
class StyleLoaderTask;
|
||||
|
@ -62,6 +64,10 @@ private:
|
|||
QString m_filters;
|
||||
QSize m_chipSize;
|
||||
|
||||
bool m_isIndexed;
|
||||
QList<int> m_indexes;
|
||||
QString m_searchText;
|
||||
|
||||
TThread::Executor m_executor;
|
||||
bool m_started;
|
||||
std::vector<TFilePath> m_activeLoads;
|
||||
|
@ -92,6 +98,13 @@ public:
|
|||
emit itemsUpdated();
|
||||
}
|
||||
|
||||
void applyFilter();
|
||||
void applyFilter(const QString text) {
|
||||
m_searchText = text;
|
||||
applyFilter();
|
||||
}
|
||||
QString getSearchText() const { return m_searchText; }
|
||||
|
||||
private:
|
||||
void addPattern(const TFilePath &path);
|
||||
|
||||
|
@ -110,10 +123,11 @@ class DVAPI TextureStyleManager final : public QObject {
|
|||
public:
|
||||
struct DVAPI TextureData {
|
||||
TRaster32P m_raster;
|
||||
std::string m_textureName;
|
||||
QString m_textureName;
|
||||
TFilePath m_path;
|
||||
std::string m_idName; // brush id name
|
||||
|
||||
TextureData() : m_raster(0), m_textureName(""), m_path(TFilePath()) {}
|
||||
TextureData() : m_raster(0), m_textureName(""), m_path(TFilePath()), m_idName("") {}
|
||||
};
|
||||
|
||||
private:
|
||||
|
@ -122,6 +136,10 @@ private:
|
|||
QString m_filters;
|
||||
QSize m_chipSize;
|
||||
|
||||
bool m_isIndexed;
|
||||
QList<int> m_indexes;
|
||||
QString m_searchText;
|
||||
|
||||
public:
|
||||
TextureStyleManager(const TFilePath &stylesFolder,
|
||||
QString filters = QString(),
|
||||
|
@ -138,6 +156,13 @@ public:
|
|||
void loadTexture(TFilePath &fp);
|
||||
void loadItems();
|
||||
|
||||
void applyFilter();
|
||||
void applyFilter(const QString text) {
|
||||
m_searchText = text;
|
||||
applyFilter();
|
||||
}
|
||||
QString getSearchText() const { return m_searchText; }
|
||||
|
||||
private:
|
||||
void addTexture(const TFilePath &path);
|
||||
|
||||
|
@ -156,10 +181,12 @@ class DVAPI BrushStyleManager final : public QObject {
|
|||
public:
|
||||
struct DVAPI BrushData {
|
||||
TMyPaintBrushStyle m_brush;
|
||||
std::string m_brushName;
|
||||
QString m_brushName;
|
||||
TFilePath m_path;
|
||||
std::string m_idName; // brush id name
|
||||
|
||||
BrushData() : m_brush(), m_brushName(""), m_path(TFilePath()) {}
|
||||
BrushData()
|
||||
: m_brush(), m_brushName(""), m_path(TFilePath()), m_idName("") {}
|
||||
};
|
||||
|
||||
private:
|
||||
|
@ -168,6 +195,10 @@ private:
|
|||
QString m_filters;
|
||||
QSize m_chipSize;
|
||||
|
||||
bool m_isIndexed;
|
||||
QList<int> m_indexes;
|
||||
QString m_searchText;
|
||||
|
||||
public:
|
||||
BrushStyleManager(const TFilePath &stylesFolder, QString filters = QString(),
|
||||
QSize chipSize = QSize(30, 30));
|
||||
|
@ -182,6 +213,13 @@ public:
|
|||
|
||||
void loadItems();
|
||||
|
||||
void applyFilter();
|
||||
void applyFilter(const QString text) {
|
||||
m_searchText = text;
|
||||
applyFilter();
|
||||
}
|
||||
QString getSearchText() const { return m_searchText; }
|
||||
|
||||
signals:
|
||||
|
||||
void itemsUpdated();
|
||||
|
|
|
@ -553,6 +553,43 @@ protected:
|
|||
bool m_allowFavorite = false;
|
||||
bool m_external = false;
|
||||
|
||||
enum ChipType {
|
||||
COMMONCHIP = 0, // Common chip
|
||||
SOLIDCHIP = 1 // Solid/Nobrush chip
|
||||
};
|
||||
|
||||
QColor m_commonChipBoxColor;
|
||||
QColor m_solidChipBoxColor;
|
||||
QColor m_selectedChipBoxColor;
|
||||
QColor m_selectedChipBox2Color;
|
||||
|
||||
Q_PROPERTY(QColor CommonChipBoxColor READ getCommonChipBoxColor WRITE
|
||||
setCommonChipBoxColor)
|
||||
Q_PROPERTY(QColor SolidChipBoxColor READ getSolidChipBoxColor WRITE
|
||||
setSolidChipBoxColor)
|
||||
Q_PROPERTY(QColor SelectedChipBoxColor READ getSelectedChipBoxColor WRITE
|
||||
setSelectedChipBoxColor)
|
||||
Q_PROPERTY(QColor SelectedChipBox2Color READ getSelectedChipBox2Color WRITE
|
||||
setSelectedChipBox2Color)
|
||||
|
||||
QColor getCommonChipBoxColor() const { return m_commonChipBoxColor; }
|
||||
QColor getSolidChipBoxColor() const { return m_solidChipBoxColor; }
|
||||
QColor getSelectedChipBoxColor() const { return m_selectedChipBoxColor; }
|
||||
QColor getSelectedChipBox2Color() const { return m_selectedChipBox2Color; }
|
||||
|
||||
void setSolidChipBoxColor(const QColor &color) {
|
||||
m_solidChipBoxColor = color;
|
||||
}
|
||||
void setCommonChipBoxColor(const QColor &color) {
|
||||
m_commonChipBoxColor = color;
|
||||
}
|
||||
void setSelectedChipBoxColor(const QColor &color) {
|
||||
m_selectedChipBoxColor = color;
|
||||
}
|
||||
void setSelectedChipBox2Color(const QColor &color) {
|
||||
m_selectedChipBox2Color = color;
|
||||
}
|
||||
|
||||
public:
|
||||
StyleChooserPage(TFilePath styleFolder, QWidget *parent = 0);
|
||||
|
||||
|
@ -586,7 +623,11 @@ public:
|
|||
virtual bool isLoading() { return false; }
|
||||
virtual int getChipCount() const = 0;
|
||||
|
||||
virtual void drawChip(QPainter &p, QRect rect, int index) = 0;
|
||||
virtual int drawChip(QPainter &p, QRect rect, int index) = 0;
|
||||
|
||||
virtual void applyFilter(){};
|
||||
virtual void applyFilter(const QString text){};
|
||||
|
||||
virtual void onSelect(int index) {}
|
||||
|
||||
virtual void removeSelectedStylesFromSet(std::vector<int> selection){};
|
||||
|
@ -621,13 +662,15 @@ protected:
|
|||
void resizeEvent(QResizeEvent *) override { computeSize(); }
|
||||
|
||||
void mousePressEvent(QMouseEvent *event) override;
|
||||
void mouseMoveEvent(QMouseEvent *event) override {}
|
||||
void mouseMoveEvent(QMouseEvent *event) override;
|
||||
void mouseReleaseEvent(QMouseEvent *event) override;
|
||||
void contextMenuEvent(QContextMenuEvent *event) override;
|
||||
void enterEvent(QEvent *event) override;
|
||||
|
||||
protected slots:
|
||||
public slots:
|
||||
void computeSize();
|
||||
|
||||
protected slots:
|
||||
void onTogglePage(bool toggled);
|
||||
void onRemoveStyleFromSet();
|
||||
void onEmptySet();
|
||||
|
@ -641,6 +684,7 @@ protected slots:
|
|||
void onReloadStyleSet();
|
||||
void onRenameStyleSet();
|
||||
void onLabelContextMenu(const QPoint &pos);
|
||||
|
||||
signals:
|
||||
void styleSelected(const TColorStyle &style);
|
||||
void refreshFavorites();
|
||||
|
@ -828,8 +872,19 @@ class DVAPI StyleEditor final : public QWidget, public SaveLoadQSettings {
|
|||
QAction *m_alphaAction;
|
||||
QAction *m_rgbAction;
|
||||
QAction *m_hexAction;
|
||||
QAction *m_searchAction;
|
||||
QAction *m_hexEditorAction;
|
||||
|
||||
QFrame *m_textureSearchFrame;
|
||||
QFrame *m_vectorsSearchFrame;
|
||||
QFrame *m_mypaintSearchFrame;
|
||||
QLineEdit *m_textureSearchText;
|
||||
QLineEdit *m_vectorsSearchText;
|
||||
QLineEdit *m_mypaintSearchText;
|
||||
QPushButton *m_textureSearchClear;
|
||||
QPushButton *m_vectorsSearchClear;
|
||||
QPushButton *m_mypaintSearchClear;
|
||||
|
||||
TColorStyleP
|
||||
m_oldStyle; //!< A copy of current style \a before the last change.
|
||||
TColorStyleP m_editedStyle; //!< The currently edited style. Please observe
|
||||
|
@ -1005,11 +1060,22 @@ protected slots:
|
|||
void onHexChanged();
|
||||
void onHexEditor();
|
||||
|
||||
void onSearchVisible(bool on);
|
||||
|
||||
void onHexEdited(const QString &text);
|
||||
void onHideMenu();
|
||||
void onPageChanged(int index);
|
||||
void onToggleAutoApply();
|
||||
|
||||
void onTextureSearch(const QString &);
|
||||
void onTextureClearSearch();
|
||||
|
||||
void onVectorsSearch(const QString &);
|
||||
void onVectorsClearSearch();
|
||||
|
||||
void onMyPaintSearch(const QString &);
|
||||
void onMyPaintClearSearch();
|
||||
|
||||
void onToggleTextureSet(int checkedState);
|
||||
void onToggleVectorSet(int checkedState);
|
||||
void onToggleRasterSet(int checkedState);
|
||||
|
|
|
@ -156,6 +156,8 @@ public:
|
|||
TColorStyle *clone() const override;
|
||||
|
||||
QString getDescription() const override;
|
||||
std::string getBrushIdName() const override;
|
||||
static std::size_t staticBrushIdHash();
|
||||
|
||||
bool hasMainColor() const override { return true; }
|
||||
TPixel32 getMainColor() const override { return m_color; }
|
||||
|
@ -203,6 +205,7 @@ public:
|
|||
TColorStyle *clone() const override;
|
||||
|
||||
QString getDescription() const override;
|
||||
std::string getBrushIdName() const override;
|
||||
|
||||
TPixel32 getColor() const { return m_color; }
|
||||
USHORT getStipple() const { return m_stipple; }
|
||||
|
@ -269,10 +272,10 @@ public:
|
|||
void invalidate(){};
|
||||
|
||||
TColorStyle *clone() const override;
|
||||
TColorStyle *clone(std::string brushIdName) const override;
|
||||
|
||||
QString getDescription() const override {
|
||||
return "TRasterImagePatternStrokeStyle";
|
||||
}
|
||||
QString getDescription() const override;
|
||||
std::string getBrushIdName() const override;
|
||||
|
||||
bool hasMainColor() const override { return false; }
|
||||
TPixel32 getMainColor() const override { return TPixel32::Black; }
|
||||
|
@ -348,10 +351,10 @@ public:
|
|||
void invalidate(){};
|
||||
|
||||
TColorStyle *clone() const override;
|
||||
TColorStyle *clone(std::string brushIdName) const override;
|
||||
|
||||
QString getDescription() const override {
|
||||
return "TVectorImagePatternStrokeStyle";
|
||||
}
|
||||
QString getDescription() const override;
|
||||
std::string getBrushIdName() const override;
|
||||
|
||||
bool hasMainColor() const override { return false; }
|
||||
TPixel32 getMainColor() const override { return TPixel32::Black; }
|
||||
|
|
|
@ -39,7 +39,10 @@ public:
|
|||
~TVectorBrushStyle();
|
||||
|
||||
TColorStyle *clone() const override;
|
||||
TColorStyle *clone(std::string brushIdName) const override;
|
||||
|
||||
QString getDescription() const override;
|
||||
std::string getBrushIdName() const override;
|
||||
|
||||
static TFilePath getRootDir() { return m_rootDir; }
|
||||
static void setRootDir(const TFilePath &path) {
|
||||
|
|
BIN
toonz/sources/toonz/Resources/no_texturestyle.png
Normal file
After Width: | Height: | Size: 229 B |
|
@ -643,6 +643,7 @@
|
|||
<file>Resources/no_specialstyle.png</file>
|
||||
<file>Resources/no_vectorbrush.png</file>
|
||||
<file>Resources/no_mypaintbrush.png</file>
|
||||
<file>Resources/no_texturestyle.png</file>
|
||||
<file>Resources/palette_header.svg</file>
|
||||
<file>Resources/paletteicon.svg</file>
|
||||
<file>Resources/pan.png</file>
|
||||
|
|
|
@ -112,10 +112,34 @@ TColorStyle *TTextureStyle::clone() const { return new TTextureStyle(*this); }
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
TColorStyle *TTextureStyle::clone(std::string brushIdName) const {
|
||||
TTextureStyle *style = new TTextureStyle(*this);
|
||||
|
||||
std::string name = getBrushIdNameParam(brushIdName);
|
||||
style->m_texturePath = TFilePath(name);
|
||||
style->setAverageColor();
|
||||
return style;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
QString TTextureStyle::getDescription() const { return "TextureStyle"; }
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
std::string TTextureStyle::getBrushIdName() const {
|
||||
std::wstring ws = m_texturePath.getWideString();
|
||||
const std::string s(ws.begin(), ws.end());
|
||||
return "TextureStyle:" + s;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
std::string TTextureStyle::staticBrushIdName(std::wstring texturePath) {
|
||||
const std::string s(texturePath.begin(), texturePath.end());
|
||||
return "TextureStyle:" + s;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int TTextureStyle::getTagId() const { return 4; }
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
|
@ -50,6 +50,14 @@ TMyPaintBrushStyle::~TMyPaintBrushStyle() {}
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
TColorStyle *TMyPaintBrushStyle::clone(std::string brushIdName) const {
|
||||
TMyPaintBrushStyle *style = new TMyPaintBrushStyle(*this);
|
||||
style->loadBrush(TFilePath(getBrushIdNameParam(brushIdName)));
|
||||
return style;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
TColorStyle &TMyPaintBrushStyle::copy(const TColorStyle &other) {
|
||||
const TMyPaintBrushStyle *otherBrushStyle =
|
||||
dynamic_cast<const TMyPaintBrushStyle *>(&other);
|
||||
|
@ -73,6 +81,14 @@ QString TMyPaintBrushStyle::getDescription() const {
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
std::string TMyPaintBrushStyle::getBrushIdName() const {
|
||||
std::wstring ws = m_path.getWideString();
|
||||
const std::string s(ws.begin(), ws.end());
|
||||
return "MyPaintBrushStyle:" + s;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
std::string TMyPaintBrushStyle::getBrushType() { return "myb"; }
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
|
@ -198,9 +198,10 @@ void CustomStyleManager::StyleLoaderTask::run() {
|
|||
#endif
|
||||
|
||||
m_data.m_path = m_fp;
|
||||
m_data.m_patternName = m_fp.getName();
|
||||
m_data.m_patternName = QString::fromStdString(m_fp.getName());
|
||||
m_data.m_isVector = (m_fp.getType() == "pli" || m_fp.getType() == "svg");
|
||||
m_data.m_image = image;
|
||||
m_data.m_idName = TTextureStyle::staticBrushIdName(m_fp.getLevelNameW());
|
||||
} catch (...) {
|
||||
}
|
||||
}
|
||||
|
@ -223,7 +224,10 @@ void CustomStyleManager::StyleLoaderTask::onFinished(
|
|||
|
||||
CustomStyleManager::CustomStyleManager(const TFilePath &stylesFolder,
|
||||
QString filters, QSize chipSize)
|
||||
: m_stylesFolder(stylesFolder), m_filters(filters), m_chipSize(chipSize) {
|
||||
: m_stylesFolder(stylesFolder)
|
||||
, m_filters(filters)
|
||||
, m_chipSize(chipSize)
|
||||
, m_isIndexed(false) {
|
||||
m_executor.setMaxActiveTasks(1);
|
||||
}
|
||||
|
||||
|
@ -240,17 +244,41 @@ void CustomStyleManager::loadItemFinished(TFilePath file) {
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
int CustomStyleManager::getPatternCount() { return m_patterns.size(); }
|
||||
int CustomStyleManager::getPatternCount() {
|
||||
return m_isIndexed ? m_indexes.count() : m_patterns.size();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
CustomStyleManager::PatternData CustomStyleManager::getPattern(int index) {
|
||||
if (m_isIndexed)
|
||||
return (index < 0 || index >= m_indexes.count())
|
||||
? PatternData()
|
||||
: m_patterns[m_indexes[index]];
|
||||
|
||||
return (index < 0 || index >= m_patterns.size()) ? PatternData()
|
||||
: m_patterns[index];
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void CustomStyleManager::applyFilter() {
|
||||
QList<int> indexes;
|
||||
|
||||
m_indexes.clear();
|
||||
int len = m_patterns.count();
|
||||
for (int i = 0; i < len; i++) {
|
||||
auto &chip = m_patterns[i];
|
||||
if (chip.m_patternName.indexOf(m_searchText, 0, Qt::CaseInsensitive) >= 0)
|
||||
m_indexes.append(i);
|
||||
}
|
||||
|
||||
m_indexes.append(indexes);
|
||||
m_isIndexed = (m_indexes.count() != len);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void CustomStyleManager::loadItems() {
|
||||
// Build the folder to be read
|
||||
if (m_stylesFolder == TFilePath()) return;
|
||||
|
@ -323,9 +351,10 @@ void CustomStyleManager::loadGeneratedStyle(TFilePath file) {
|
|||
convertRaster32ToImage(style->getIcon(chipSize), image);
|
||||
|
||||
pattern.m_path = file;
|
||||
pattern.m_patternName = nameParts[0].toStdString();
|
||||
pattern.m_patternName = nameParts[0];
|
||||
pattern.m_isGenerated = true;
|
||||
pattern.m_image = image;
|
||||
pattern.m_idName = style->getBrushIdName();
|
||||
|
||||
m_patterns.push_back(pattern);
|
||||
}
|
||||
|
@ -346,21 +375,48 @@ void CustomStyleManager::setStyleFolder(TFilePath styleFolder) {
|
|||
|
||||
TextureStyleManager::TextureStyleManager(const TFilePath &stylesFolder,
|
||||
QString filters, QSize chipSize)
|
||||
: m_stylesFolder(stylesFolder), m_filters(filters), m_chipSize(chipSize) {}
|
||||
: m_stylesFolder(stylesFolder)
|
||||
, m_filters(filters)
|
||||
, m_chipSize(chipSize)
|
||||
, m_isIndexed(false) {}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
int TextureStyleManager::getTextureCount() { return m_textures.size(); }
|
||||
int TextureStyleManager::getTextureCount() {
|
||||
return m_isIndexed ? m_indexes.count() : m_textures.size();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
TextureStyleManager::TextureData TextureStyleManager::getTexture(int index) {
|
||||
if (m_isIndexed)
|
||||
return (index < 0 || index >= m_indexes.count())
|
||||
? TextureData()
|
||||
: m_textures[m_indexes[index]];
|
||||
|
||||
return (index < 0 || index >= m_textures.size()) ? TextureData()
|
||||
: m_textures[index];
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void TextureStyleManager::applyFilter() {
|
||||
QList<int> indexes;
|
||||
|
||||
m_indexes.clear();
|
||||
int len = m_textures.count();
|
||||
for (int i = 0; i < len; i++) {
|
||||
auto &chip = m_textures[i];
|
||||
if (chip.m_textureName.indexOf(m_searchText, 0, Qt::CaseInsensitive) >= 0)
|
||||
m_indexes.append(i);
|
||||
}
|
||||
|
||||
m_indexes.append(indexes);
|
||||
m_isIndexed = (m_indexes.count() != len);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void TextureStyleManager::loadItems() {
|
||||
// Build the folder to be read
|
||||
|
||||
|
@ -418,8 +474,9 @@ void TextureStyleManager::loadTexture(TFilePath &fp) {
|
|||
TTextureStyle::fillCustomTextureIcon(ras);
|
||||
TextureData customText;
|
||||
customText.m_raster = ras;
|
||||
customText.m_textureName = std::string("");
|
||||
customText.m_textureName = "";
|
||||
customText.m_path = fp;
|
||||
customText.m_idName = TTextureStyle::staticBrushIdName(fp.getLevelNameW());
|
||||
|
||||
m_textures.push_back(customText);
|
||||
return;
|
||||
|
@ -448,8 +505,9 @@ void TextureStyleManager::loadTexture(TFilePath &fp) {
|
|||
|
||||
TextureData text;
|
||||
text.m_raster = texture;
|
||||
text.m_textureName = fp.getName();
|
||||
text.m_textureName = QString::fromStdString(fp.getName());
|
||||
text.m_path = fp;
|
||||
text.m_idName = TTextureStyle::staticBrushIdName(fp.getLevelNameW());
|
||||
|
||||
m_textures.push_back(text);
|
||||
}
|
||||
|
@ -470,21 +528,48 @@ void TextureStyleManager::setStyleFolder(TFilePath styleFolder) {
|
|||
|
||||
BrushStyleManager::BrushStyleManager(const TFilePath &stylesFolder,
|
||||
QString filters, QSize chipSize)
|
||||
: m_stylesFolder(stylesFolder), m_filters(filters), m_chipSize(chipSize) {}
|
||||
: m_stylesFolder(stylesFolder)
|
||||
, m_filters(filters)
|
||||
, m_chipSize(chipSize)
|
||||
, m_isIndexed(false) {}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
int BrushStyleManager::getBrushCount() { return m_brushes.size(); }
|
||||
int BrushStyleManager::getBrushCount() {
|
||||
return m_isIndexed ? m_indexes.count() : m_brushes.size();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
BrushStyleManager::BrushData BrushStyleManager::getBrush(int index) {
|
||||
if (m_isIndexed)
|
||||
return (index < 0 || index >= m_indexes.count())
|
||||
? BrushData()
|
||||
: m_brushes[m_indexes[index]];
|
||||
|
||||
return (index < 0 || index >= m_brushes.size()) ? BrushData()
|
||||
: m_brushes[index];
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void BrushStyleManager::applyFilter() {
|
||||
QList<int> indexes;
|
||||
|
||||
m_indexes.clear();
|
||||
int len = m_brushes.count();
|
||||
for (int i = 0; i < len; i++) {
|
||||
auto &chip = m_brushes[i];
|
||||
if (chip.m_brushName.indexOf(m_searchText, 0, Qt::CaseInsensitive) >= 0)
|
||||
m_indexes.append(i);
|
||||
}
|
||||
|
||||
m_indexes.append(indexes);
|
||||
m_isIndexed = (m_indexes.count() != len);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void BrushStyleManager::loadItems() {
|
||||
// Build the folder to be read
|
||||
|
||||
|
@ -524,8 +609,9 @@ void BrushStyleManager::loadItems() {
|
|||
for (TFilePathSet::iterator it = fps.begin(); it != fps.end(); it++) {
|
||||
BrushData brush;
|
||||
brush.m_brush = TMyPaintBrushStyle(*it);
|
||||
brush.m_brushName = it->getName();
|
||||
brush.m_brushName = QString::fromStdString(it->getName());
|
||||
brush.m_path = *it;
|
||||
brush.m_idName = brush.m_brush.getBrushIdName();
|
||||
|
||||
m_brushes.push_back(brush);
|
||||
brushesUpdated = true;
|
||||
|
@ -736,7 +822,7 @@ void TStyleManager::changeStyleSetFolder(CustomStyleManager *styleManager,
|
|||
std::pair<TFilePath, QString> newKey(newPath, styleManager->getFilters());
|
||||
|
||||
std::vector<std::pair<TFilePath, QString>>::iterator it;
|
||||
int i;
|
||||
int i = 0;
|
||||
for (it = m_customStyleFolders.begin(); it != m_customStyleFolders.end();
|
||||
it++) {
|
||||
if (*it == oldKey) {
|
||||
|
@ -764,7 +850,7 @@ void TStyleManager::changeStyleSetFolder(TextureStyleManager *styleManager,
|
|||
std::pair<TFilePath, QString> newKey(newPath, styleManager->getFilters());
|
||||
|
||||
std::vector<std::pair<TFilePath, QString>>::iterator it;
|
||||
int i;
|
||||
int i = 0;
|
||||
for (it = m_textureStyleFolders.begin(); it != m_textureStyleFolders.end();
|
||||
it++) {
|
||||
if (*it == oldKey) {
|
||||
|
@ -792,7 +878,7 @@ void TStyleManager::changeStyleSetFolder(BrushStyleManager *styleManager,
|
|||
std::pair<TFilePath, QString> newKey(newPath, styleManager->getFilters());
|
||||
|
||||
std::vector<std::pair<TFilePath, QString>>::iterator it;
|
||||
int i;
|
||||
int i = 0;
|
||||
for (it = m_brushStyleFolders.begin(); it != m_brushStyleFolders.end();
|
||||
it++) {
|
||||
if (*it == oldKey) {
|
||||
|
|
|
@ -1918,7 +1918,10 @@ StyleChooserPage::StyleChooserPage(TFilePath styleFolder, QWidget *parent)
|
|||
, m_allowPageDelete(true)
|
||||
, m_favorite(false)
|
||||
, m_allowFavorite(false)
|
||||
, m_external(false) {}
|
||||
, m_external(false) {
|
||||
setObjectName("StyleChooserPage");
|
||||
setMouseTracking(true);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
@ -1944,9 +1947,14 @@ void StyleChooserPage::paintEvent(QPaintEvent *) {
|
|||
for (j = 0; j < nX; j++) {
|
||||
QRect rect(x0 + chipLx * j + 2, y0 + chipLy * i + 2, chipLx, chipLy);
|
||||
|
||||
drawChip(p, rect, count);
|
||||
p.setPen(Qt::black);
|
||||
p.drawRect(rect);
|
||||
int chipType = drawChip(p, rect, count);
|
||||
if (chipType == COMMONCHIP) {
|
||||
p.setPen(m_commonChipBoxColor);
|
||||
p.drawRect(rect);
|
||||
} else { // SOLIDCHIP
|
||||
p.setPen(m_solidChipBoxColor);
|
||||
p.drawRect(rect.adjusted(0, 0, -1, -1));
|
||||
}
|
||||
|
||||
// Draw selection check boxes
|
||||
if (std::find(m_selection.begin(), m_selection.end(), count) !=
|
||||
|
@ -1983,13 +1991,13 @@ void StyleChooserPage::paintEvent(QPaintEvent *) {
|
|||
|
||||
if (!currentIndexRect.isEmpty()) {
|
||||
// Draw the curentIndex border
|
||||
p.setPen(Qt::white);
|
||||
p.setPen(m_selectedChipBoxColor);
|
||||
p.drawRect(currentIndexRect);
|
||||
p.setPen(QColor(199, 202, 50));
|
||||
p.setPen(m_selectedChipBox2Color);
|
||||
p.drawRect(currentIndexRect.adjusted(1, 1, -1, -1));
|
||||
p.setPen(Qt::white);
|
||||
p.setPen(m_selectedChipBoxColor);
|
||||
p.drawRect(currentIndexRect.adjusted(2, 2, -2, -2));
|
||||
p.setPen(Qt::black);
|
||||
p.setPen(m_commonChipBoxColor);
|
||||
p.drawRect(currentIndexRect.adjusted(3, 3, -3, -3));
|
||||
}
|
||||
}
|
||||
|
@ -2248,6 +2256,17 @@ void StyleChooserPage::enterEvent(QEvent *event) {
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void StyleChooserPage::mouseMoveEvent(QMouseEvent *event) {
|
||||
QPoint pos = event->pos();
|
||||
int currentIndex = posToIndex(pos);
|
||||
if (currentIndex >= 0 && currentIndex < getChipCount())
|
||||
setCursor(Qt::PointingHandCursor);
|
||||
else
|
||||
setCursor(Qt::ArrowCursor);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void StyleChooserPage::mouseReleaseEvent(QMouseEvent *event) {}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -2564,13 +2583,16 @@ else return false;
|
|||
void loadItems() override { m_styleManager->loadItems(); }
|
||||
|
||||
int getChipCount() const override {
|
||||
return m_styleManager->getPatternCount() + 1;
|
||||
int chipCount = m_styleManager->getPatternCount() + 1;
|
||||
if (!m_styleManager->getSearchText().isEmpty() && chipCount == 1) return 0;
|
||||
return chipCount;
|
||||
}
|
||||
|
||||
void drawChip(QPainter &p, QRect rect, int index) override {
|
||||
int drawChip(QPainter &p, QRect rect, int index) override {
|
||||
if (index == 0) {
|
||||
static QImage noSpecialStyleImage(":Resources/no_vectorbrush.png");
|
||||
p.drawImage(rect, noSpecialStyleImage);
|
||||
return SOLIDCHIP;
|
||||
} else {
|
||||
index -= 1;
|
||||
assert(0 <= index && index <= getChipCount());
|
||||
|
@ -2578,8 +2600,13 @@ else return false;
|
|||
m_styleManager->getPattern(index);
|
||||
if (pattern.m_image && !pattern.m_image->isNull())
|
||||
p.drawImage(rect, *pattern.m_image);
|
||||
return COMMONCHIP;
|
||||
}
|
||||
}
|
||||
|
||||
void applyFilter() { m_styleManager->applyFilter(); }
|
||||
void applyFilter(const QString text) { m_styleManager->applyFilter(text); }
|
||||
|
||||
void onSelect(int index) override;
|
||||
|
||||
void removeSelectedStylesFromSet(std::vector<int> selection) override;
|
||||
|
@ -2615,8 +2642,7 @@ bool CustomStyleChooserPage::event(QEvent *e) {
|
|||
|
||||
CustomStyleManager::PatternData pattern =
|
||||
m_styleManager->getPattern(chipIdx);
|
||||
QToolTip::showText(he->globalPos(),
|
||||
QString::fromStdString(pattern.m_patternName));
|
||||
QToolTip::showText(he->globalPos(), pattern.m_patternName);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -2635,7 +2661,7 @@ void CustomStyleChooserPage::onSelect(int index) {
|
|||
|
||||
if (m_currentIndex < 0) return;
|
||||
|
||||
std::string name = pattern.m_patternName;
|
||||
std::string name = pattern.m_patternName.toStdString();
|
||||
if (pattern.m_isVector) {
|
||||
TVectorImagePatternStrokeStyle cs(m_stylesFolder, name);
|
||||
emit styleSelected(cs);
|
||||
|
@ -2662,7 +2688,7 @@ void CustomStyleChooserPage::addSelectedStylesToPalette(
|
|||
CustomStyleManager::PatternData pattern =
|
||||
m_styleManager->getPattern(selection[i] - 1);
|
||||
|
||||
std::string name = pattern.m_patternName;
|
||||
std::string name = pattern.m_patternName.toStdString();
|
||||
if (pattern.m_isVector) {
|
||||
TVectorImagePatternStrokeStyle cs(m_stylesFolder, name);
|
||||
m_editor->addToPalette(cs);
|
||||
|
@ -2698,13 +2724,11 @@ void CustomStyleChooserPage::removeSelectedStylesFromSet(
|
|||
continue;
|
||||
}
|
||||
} else {
|
||||
std::string name = pattern.m_patternName;
|
||||
|
||||
TFilePathSet fileList;
|
||||
|
||||
QDir patternDir(m_stylesFolder.getQString());
|
||||
patternDir.setNameFilters(
|
||||
QStringList(QString::fromStdString(name) + ".*" +
|
||||
QStringList(pattern.m_patternName + ".*" +
|
||||
QString::fromStdString(pattern.m_path.getType())));
|
||||
TSystem::readDirectory(fileList, patternDir, false);
|
||||
|
||||
|
@ -2725,7 +2749,6 @@ void CustomStyleChooserPage::addSelectedStylesToSet(std::vector<int> selection,
|
|||
for (int i = 0; i < selection.size(); i++) {
|
||||
CustomStyleManager::PatternData pattern =
|
||||
m_styleManager->getPattern(selection[i] - 1);
|
||||
std::string name = pattern.m_patternName;
|
||||
|
||||
TFilePathSet fileList;
|
||||
|
||||
|
@ -2785,10 +2808,16 @@ public:
|
|||
void loadItems() override { m_styleManager->loadItems(); }
|
||||
|
||||
int getChipCount() const override {
|
||||
return m_styleManager->getPatternCount() + 1;
|
||||
int chipCount = m_styleManager->getPatternCount() + 1;
|
||||
if (!m_styleManager->getSearchText().isEmpty() && chipCount == 1) return 0;
|
||||
return chipCount;
|
||||
}
|
||||
|
||||
void drawChip(QPainter &p, QRect rect, int index) override;
|
||||
int drawChip(QPainter &p, QRect rect, int index) override;
|
||||
|
||||
void applyFilter() { m_styleManager->applyFilter(); }
|
||||
void applyFilter(const QString text) { m_styleManager->applyFilter(text); }
|
||||
|
||||
void onSelect(int index) override;
|
||||
|
||||
void removeSelectedStylesFromSet(std::vector<int> selection) override;
|
||||
|
@ -2819,8 +2848,7 @@ bool VectorBrushStyleChooserPage::event(QEvent *e) {
|
|||
if (chipIdx > 0) {
|
||||
CustomStyleManager::PatternData pattern =
|
||||
m_styleManager->getPattern(chipIdx - 1);
|
||||
QToolTip::showText(he->globalPos(),
|
||||
QString::fromStdString(pattern.m_patternName));
|
||||
QToolTip::showText(he->globalPos(), pattern.m_patternName);
|
||||
} else
|
||||
QToolTip::showText(
|
||||
he->globalPos(),
|
||||
|
@ -2831,15 +2859,17 @@ bool VectorBrushStyleChooserPage::event(QEvent *e) {
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void VectorBrushStyleChooserPage::drawChip(QPainter &p, QRect rect, int index) {
|
||||
int VectorBrushStyleChooserPage::drawChip(QPainter &p, QRect rect, int index) {
|
||||
if (index == 0) {
|
||||
static QImage noSpecialStyleImage(":Resources/no_vectorbrush.png");
|
||||
p.drawImage(rect, noSpecialStyleImage);
|
||||
return SOLIDCHIP;
|
||||
} else {
|
||||
assert(0 <= index && index < getChipCount());
|
||||
CustomStyleManager::PatternData pattern =
|
||||
m_styleManager->getPattern(index - 1);
|
||||
p.drawImage(rect, *pattern.m_image);
|
||||
return COMMONCHIP;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2855,7 +2885,7 @@ void VectorBrushStyleChooserPage::onSelect(int index) {
|
|||
|
||||
if (m_currentIndex < 0) return;
|
||||
|
||||
std::string name = pattern.m_patternName;
|
||||
std::string name = pattern.m_patternName.toStdString();
|
||||
assert(pattern.m_isVector);
|
||||
if (!pattern.m_isVector) return;
|
||||
|
||||
|
@ -2877,7 +2907,7 @@ void VectorBrushStyleChooserPage::addSelectedStylesToPalette(
|
|||
CustomStyleManager::PatternData pattern =
|
||||
m_styleManager->getPattern(selection[i] - 1);
|
||||
|
||||
std::string name = pattern.m_patternName;
|
||||
std::string name = pattern.m_patternName.toStdString();
|
||||
assert(pattern.m_isVector);
|
||||
if (!pattern.m_isVector) return;
|
||||
|
||||
|
@ -2896,13 +2926,12 @@ void VectorBrushStyleChooserPage::removeSelectedStylesFromSet(
|
|||
for (int i = 0; i < selection.size(); i++) {
|
||||
CustomStyleManager::PatternData pattern =
|
||||
m_styleManager->getPattern(selection[i] - 1);
|
||||
std::string name = pattern.m_patternName;
|
||||
|
||||
TFilePathSet fileList;
|
||||
|
||||
QDir patternDir(m_stylesFolder.getQString());
|
||||
patternDir.setNameFilters(
|
||||
QStringList(QString::fromStdString(name) + ".*" +
|
||||
QStringList(pattern.m_patternName + ".*" +
|
||||
QString::fromStdString(pattern.m_path.getType())));
|
||||
TSystem::readDirectory(fileList, patternDir, false);
|
||||
|
||||
|
@ -2922,13 +2951,12 @@ void VectorBrushStyleChooserPage::addSelectedStylesToSet(
|
|||
for (int i = 0; i < selection.size(); i++) {
|
||||
CustomStyleManager::PatternData pattern =
|
||||
m_styleManager->getPattern(selection[i] - 1);
|
||||
std::string name = pattern.m_patternName;
|
||||
|
||||
TFilePathSet fileList;
|
||||
|
||||
QDir patternDir(m_stylesFolder.getQString());
|
||||
patternDir.setNameFilters(
|
||||
QStringList(QString::fromStdString(name) + ".*" +
|
||||
QStringList(pattern.m_patternName + ".*" +
|
||||
QString::fromStdString(pattern.m_path.getType())));
|
||||
TSystem::readDirectory(fileList, patternDir, false);
|
||||
|
||||
|
@ -2981,13 +3009,16 @@ public:
|
|||
void loadItems() override { m_styleManager->loadItems(); }
|
||||
|
||||
int getChipCount() const override {
|
||||
return m_styleManager->getTextureCount() + 1;
|
||||
int chipCount = m_styleManager->getTextureCount() + 1;
|
||||
if (!m_styleManager->getSearchText().isEmpty() && chipCount == 1) return 0;
|
||||
return chipCount;
|
||||
}
|
||||
|
||||
void drawChip(QPainter &p, QRect rect, int index) override {
|
||||
int drawChip(QPainter &p, QRect rect, int index) override {
|
||||
if (index == 0) {
|
||||
static QImage noSpecialStyleImage(":Resources/no_vectorbrush.png");
|
||||
static QImage noSpecialStyleImage(":Resources/no_texturestyle.png");
|
||||
p.drawImage(rect, noSpecialStyleImage);
|
||||
return SOLIDCHIP;
|
||||
} else {
|
||||
index -= 1;
|
||||
assert(0 <= index && index < getChipCount());
|
||||
|
@ -2995,9 +3026,13 @@ public:
|
|||
m_styleManager->getTexture(index);
|
||||
if (texture.m_raster && !texture.m_raster->isEmpty())
|
||||
p.drawImage(rect, rasterToQImage(texture.m_raster));
|
||||
return COMMONCHIP;
|
||||
}
|
||||
}
|
||||
|
||||
void applyFilter() { m_styleManager->applyFilter(); }
|
||||
void applyFilter(const QString text) { m_styleManager->applyFilter(text); }
|
||||
|
||||
void onSelect(int index) override;
|
||||
|
||||
void removeSelectedStylesFromSet(std::vector<int> selection) override;
|
||||
|
@ -3083,7 +3118,7 @@ bool TextureStyleChooserPage::event(QEvent *e) {
|
|||
|
||||
TextureStyleManager::TextureData texture =
|
||||
m_styleManager->getTexture(chipIdx);
|
||||
toolTip = QString::fromStdString(texture.m_textureName);
|
||||
toolTip = texture.m_textureName;
|
||||
QToolTip::showText(
|
||||
helpEvent->globalPos(),
|
||||
toolTip != QString()
|
||||
|
@ -3177,21 +3212,28 @@ public:
|
|||
void loadItems() override { m_styleManager->loadItems(); }
|
||||
|
||||
int getChipCount() const override {
|
||||
return m_styleManager->getBrushCount() + 1;
|
||||
int chipCount = m_styleManager->getBrushCount() + 1;
|
||||
if (!m_styleManager->getSearchText().isEmpty() && chipCount == 1) return 0;
|
||||
return chipCount;
|
||||
}
|
||||
|
||||
void drawChip(QPainter &p, QRect rect, int index) override {
|
||||
int drawChip(QPainter &p, QRect rect, int index) override {
|
||||
if (index == 0) {
|
||||
static QImage noStyleImage(":Resources/no_mypaintbrush.png");
|
||||
p.drawImage(rect, noStyleImage);
|
||||
return SOLIDCHIP;
|
||||
} else {
|
||||
index -= 1;
|
||||
assert(0 <= index && index < getChipCount());
|
||||
BrushStyleManager::BrushData brush = m_styleManager->getBrush(index);
|
||||
p.drawImage(rect, rasterToQImage(brush.m_brush.getPreview()));
|
||||
return COMMONCHIP;
|
||||
}
|
||||
}
|
||||
|
||||
void applyFilter() { m_styleManager->applyFilter(); }
|
||||
void applyFilter(const QString text) { m_styleManager->applyFilter(text); }
|
||||
|
||||
void onSelect(int index) override;
|
||||
|
||||
void removeSelectedStylesFromSet(std::vector<int> selection) override;
|
||||
|
@ -3260,7 +3302,7 @@ bool MyPaintBrushStyleChooserPage::event(QEvent *e) {
|
|||
if (chipIdx < 0 || chipIdx >= chipCount) return false;
|
||||
|
||||
BrushStyleManager::BrushData brush = m_styleManager->getBrush(chipIdx);
|
||||
toolTip = QString::fromStdString(brush.m_brushName);
|
||||
toolTip = brush.m_brushName;
|
||||
QToolTip::showText(helpEvent->globalPos(), toolTip);
|
||||
}
|
||||
return true;
|
||||
|
@ -3312,15 +3354,28 @@ void MyPaintBrushStyleChooserPage::addSelectedStylesToSet(
|
|||
// SpecialStyleChooser definition
|
||||
//*****************************************************************************
|
||||
|
||||
struct SpecialStyleData {
|
||||
int m_tag_id;
|
||||
QImage *m_image;
|
||||
QString m_styleName;
|
||||
std::string m_idName; // brush id name
|
||||
|
||||
SpecialStyleData() : m_tag_id(), m_image(0), m_styleName(""), m_idName("") {}
|
||||
};
|
||||
|
||||
class SpecialStyleChooserPage final : public StyleChooserPage {
|
||||
static std::vector<std::pair<int, QImage *>> m_customStyles;
|
||||
static bool m_loaded;
|
||||
static QString m_filters;
|
||||
QList<SpecialStyleData> m_specialStyles;
|
||||
bool m_loaded;
|
||||
QString m_filters;
|
||||
|
||||
bool m_isIndexed;
|
||||
QList<int> m_indexes;
|
||||
QString m_searchText;
|
||||
|
||||
public:
|
||||
SpecialStyleChooserPage(TFilePath stylesFolder = TFilePath(),
|
||||
QString filters = QString(), QWidget *parent = 0)
|
||||
: StyleChooserPage(stylesFolder, parent) {
|
||||
: StyleChooserPage(stylesFolder, parent), m_loaded(false), m_isIndexed(false) {
|
||||
setPageType(StylePageType::VectorGenerated);
|
||||
m_filters = filters;
|
||||
}
|
||||
|
@ -3337,11 +3392,25 @@ public:
|
|||
} else
|
||||
return false;
|
||||
}
|
||||
int getChipCount() const override { return m_customStyles.size(); }
|
||||
int getChipCount() const override {
|
||||
int chipCount =
|
||||
m_isIndexed ? m_indexes.count() + 1 : m_specialStyles.size() + 1;
|
||||
if (chipCount == 1) return 0;
|
||||
|
||||
return chipCount;
|
||||
}
|
||||
|
||||
void loadItems() override;
|
||||
|
||||
void drawChip(QPainter &p, QRect rect, int index) override;
|
||||
SpecialStyleData getSpecialStyle(int index);
|
||||
int drawChip(QPainter &p, QRect rect, int index) override;
|
||||
|
||||
void applyFilter() override;
|
||||
void applyFilter(const QString text) {
|
||||
m_searchText = text;
|
||||
applyFilter();
|
||||
}
|
||||
|
||||
void onSelect(int index) override;
|
||||
bool event(QEvent *e) override;
|
||||
|
||||
|
@ -3352,12 +3421,33 @@ public:
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
QString SpecialStyleChooserPage::m_filters;
|
||||
SpecialStyleData SpecialStyleChooserPage::getSpecialStyle(int index) {
|
||||
if (m_isIndexed)
|
||||
return (index < 0 || index >= m_indexes.count())
|
||||
? SpecialStyleData()
|
||||
: m_specialStyles[m_indexes[index]];
|
||||
|
||||
return (index < 0 || index >= m_specialStyles.size())
|
||||
? SpecialStyleData()
|
||||
: m_specialStyles[index];
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
std::vector<std::pair<int, QImage *>> SpecialStyleChooserPage::m_customStyles;
|
||||
bool SpecialStyleChooserPage::m_loaded(false);
|
||||
void SpecialStyleChooserPage::applyFilter() {
|
||||
QList<int> indexes;
|
||||
|
||||
m_indexes.clear();
|
||||
int len = m_specialStyles.count();
|
||||
for (int i = 0; i < len; i++) {
|
||||
auto &chip = m_specialStyles[i];
|
||||
if (chip.m_styleName.indexOf(m_searchText, 0, Qt::CaseInsensitive) >= 0)
|
||||
m_indexes.append(i);
|
||||
}
|
||||
|
||||
m_indexes.append(indexes);
|
||||
m_isIndexed = (m_indexes.count() != len);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
@ -3386,41 +3476,51 @@ void SpecialStyleChooserPage::loadItems() {
|
|||
delete style;
|
||||
continue;
|
||||
}
|
||||
|
||||
TDimension chipSize(getChipSize().width(), getChipSize().height());
|
||||
QImage *image = new QImage(rasterToQImage(style->getIcon(chipSize), false));
|
||||
m_customStyles.push_back(std::make_pair(tagId, image));
|
||||
|
||||
SpecialStyleData specialStyle;
|
||||
specialStyle.m_tag_id = tagId;
|
||||
specialStyle.m_image = image;
|
||||
specialStyle.m_styleName = style->getDescription();
|
||||
specialStyle.m_idName = style->getBrushIdName();
|
||||
m_specialStyles.push_back(specialStyle);
|
||||
delete style;
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void SpecialStyleChooserPage::drawChip(QPainter &p, QRect rect, int index) {
|
||||
int SpecialStyleChooserPage::drawChip(QPainter &p, QRect rect, int index) {
|
||||
if (index == 0) {
|
||||
static QImage noSpecialStyleImage(":Resources/no_specialstyle.png");
|
||||
p.drawImage(rect, noSpecialStyleImage);
|
||||
return SOLIDCHIP;
|
||||
} else {
|
||||
int j = index - 1;
|
||||
if (0 <= j && j < (int)m_customStyles.size())
|
||||
p.drawImage(rect, *m_customStyles[j].second);
|
||||
else
|
||||
if (0 <= j && j < (int)m_specialStyles.size()) {
|
||||
SpecialStyleData specialStyle = getSpecialStyle(j);
|
||||
p.drawImage(rect, *specialStyle.m_image);
|
||||
} else
|
||||
p.fillRect(rect, QBrush(QColor(255, 0, 0)));
|
||||
return COMMONCHIP;
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void SpecialStyleChooserPage::onSelect(int index) {
|
||||
assert(0 <= index && index < (int)m_customStyles.size());
|
||||
assert(0 <= index && index < (int)m_specialStyles.size());
|
||||
TColorStyle *cs = 0;
|
||||
if (m_currentIndex < 0) return;
|
||||
if (index == 0)
|
||||
cs = new TSolidColorStyle(TPixel32::Black);
|
||||
else {
|
||||
int j = index - 1;
|
||||
assert(0 <= j && j < (int)m_customStyles.size());
|
||||
int tagId = m_customStyles[j].first;
|
||||
cs = TColorStyle::create(tagId);
|
||||
assert(0 <= j && j < (int)m_specialStyles.size());
|
||||
SpecialStyleData specialStyle = getSpecialStyle(j);
|
||||
cs = TColorStyle::create(specialStyle.m_tag_id);
|
||||
}
|
||||
emit styleSelected(*cs);
|
||||
}
|
||||
|
@ -3432,9 +3532,8 @@ void SpecialStyleChooserPage::addSelectedStylesToPalette(
|
|||
if (!selection.size()) return;
|
||||
|
||||
for (int i = 0; i < selection.size(); i++) {
|
||||
int j = selection[i] - 1;
|
||||
int tagId = m_customStyles[j].first;
|
||||
TColorStyle *cs = TColorStyle::create(tagId);
|
||||
SpecialStyleData specialStyle = getSpecialStyle(selection[i] - 1);
|
||||
TColorStyle *cs = TColorStyle::create(specialStyle.m_tag_id);
|
||||
m_editor->addToPalette(*cs);
|
||||
}
|
||||
}
|
||||
|
@ -3451,9 +3550,9 @@ bool SpecialStyleChooserPage::event(QEvent *e) {
|
|||
toolTip = QObject::tr("Plain color", "SpecialStyleChooserPage");
|
||||
else {
|
||||
int j = index - 1;
|
||||
if (0 <= j && j < (int)m_customStyles.size()) {
|
||||
int tagId = m_customStyles[j].first;
|
||||
TColorStyle *cs = TColorStyle::create(tagId);
|
||||
if (0 <= j && j < (int)m_specialStyles.size()) {
|
||||
SpecialStyleData specialStyle = getSpecialStyle(j);
|
||||
TColorStyle *cs = TColorStyle::create(specialStyle.m_tag_id);
|
||||
if (cs) {
|
||||
toolTip = cs->getDescription();
|
||||
delete cs;
|
||||
|
@ -3477,9 +3576,9 @@ void SpecialStyleChooserPage::addSelectedStylesToSet(std::vector<int> selection,
|
|||
|
||||
bool added = false;
|
||||
for (int i = 0; i < selection.size(); i++) {
|
||||
int j = selection[i] - 1;
|
||||
int tagId = m_customStyles[j].first;
|
||||
TColorStyle *cs = TColorStyle::create(tagId);
|
||||
SpecialStyleData specialStyle = getSpecialStyle(selection[i] - 1);
|
||||
int tagId = specialStyle.m_tag_id;
|
||||
TColorStyle *cs = TColorStyle::create(tagId);
|
||||
|
||||
std::string name = std::to_string(tagId);
|
||||
|
||||
|
@ -4220,28 +4319,32 @@ QFrame *StyleEditor::createBottomWidget() {
|
|||
m_toolBar->setMaximumHeight(22);
|
||||
m_toolBar->addWidget(m_colorParameterSelector);
|
||||
|
||||
QMenu *menu = new QMenu();
|
||||
m_wheelAction = new QAction(tr("Wheel"), this);
|
||||
m_hsvAction = new QAction(tr("HSV"), this);
|
||||
m_alphaAction = new QAction(tr("Alpha"), this);
|
||||
m_rgbAction = new QAction(tr("RGB"), this);
|
||||
m_hexAction = new QAction(tr("Hex"), this);
|
||||
QMenu *menu = new QMenu();
|
||||
m_wheelAction = new QAction(tr("Wheel"), this);
|
||||
m_hsvAction = new QAction(tr("HSV"), this);
|
||||
m_alphaAction = new QAction(tr("Alpha"), this);
|
||||
m_rgbAction = new QAction(tr("RGB"), this);
|
||||
m_hexAction = new QAction(tr("Hex"), this);
|
||||
m_searchAction = new QAction(tr("Search"), this);
|
||||
|
||||
m_wheelAction->setCheckable(true);
|
||||
m_hsvAction->setCheckable(true);
|
||||
m_alphaAction->setCheckable(true);
|
||||
m_rgbAction->setCheckable(true);
|
||||
m_hexAction->setCheckable(true);
|
||||
m_searchAction->setCheckable(true);
|
||||
m_wheelAction->setChecked(true);
|
||||
m_hsvAction->setChecked(false);
|
||||
m_alphaAction->setChecked(true);
|
||||
m_rgbAction->setChecked(false);
|
||||
m_hexAction->setChecked(false);
|
||||
m_searchAction->setChecked(false);
|
||||
menu->addAction(m_wheelAction);
|
||||
menu->addAction(m_alphaAction);
|
||||
menu->addAction(m_hsvAction);
|
||||
menu->addAction(m_rgbAction);
|
||||
menu->addAction(m_hexAction);
|
||||
menu->addAction(m_searchAction);
|
||||
|
||||
QFontMetrics fm(QApplication::font());
|
||||
|
||||
|
@ -4351,6 +4454,8 @@ QFrame *StyleEditor::createBottomWidget() {
|
|||
m_plainColorPage->m_rgbFrame, SLOT(setVisible(bool)));
|
||||
ret = ret && connect(m_hexAction, SIGNAL(toggled(bool)), m_hexLineEdit,
|
||||
SLOT(setVisible(bool)));
|
||||
ret = ret && connect(m_searchAction, SIGNAL(toggled(bool)), this,
|
||||
SLOT(onSearchVisible(bool)));
|
||||
ret = ret && connect(m_hexLineEdit, SIGNAL(editingFinished()), this,
|
||||
SLOT(onHexChanged()));
|
||||
ret = ret && connect(m_hexEditorAction, SIGNAL(triggered()), this,
|
||||
|
@ -4377,6 +4482,13 @@ QFrame *StyleEditor::createTexturePage() {
|
|||
QFrame *textureOutsideFrame = new QFrame(this);
|
||||
textureOutsideFrame->setMinimumWidth(50);
|
||||
|
||||
m_textureSearchFrame = new QFrame();
|
||||
m_textureSearchText = new QLineEdit();
|
||||
m_textureSearchClear = new QPushButton(tr("Clear Search"));
|
||||
m_textureSearchClear->setDisabled(true);
|
||||
m_textureSearchClear->setSizePolicy(QSizePolicy::Minimum,
|
||||
QSizePolicy::Preferred);
|
||||
|
||||
/* ------ layout ------ */
|
||||
QVBoxLayout *textureOutsideLayout = new QVBoxLayout();
|
||||
textureOutsideLayout->setMargin(0);
|
||||
|
@ -4411,10 +4523,29 @@ QFrame *StyleEditor::createTexturePage() {
|
|||
m_textureArea = makeChooserPage(textureFrame);
|
||||
m_textureArea->setMinimumWidth(50);
|
||||
textureOutsideLayout->addWidget(m_textureArea);
|
||||
|
||||
QHBoxLayout *searchLayout = new QHBoxLayout();
|
||||
searchLayout->setMargin(2);
|
||||
searchLayout->setSpacing(0);
|
||||
searchLayout->setSizeConstraint(QLayout::SetNoConstraint);
|
||||
{
|
||||
searchLayout->addWidget(m_textureSearchText);
|
||||
searchLayout->addWidget(m_textureSearchClear);
|
||||
}
|
||||
m_textureSearchFrame->setLayout(searchLayout);
|
||||
textureOutsideLayout->addWidget(m_textureSearchFrame);
|
||||
}
|
||||
textureOutsideFrame->setLayout(textureOutsideLayout);
|
||||
|
||||
return textureOutsideFrame;
|
||||
/* ------ signal-slot connections ------ */
|
||||
bool ret = true;
|
||||
ret =
|
||||
ret && connect(m_textureSearchText, SIGNAL(textChanged(const QString &)),
|
||||
this, SLOT(onTextureSearch(const QString &)));
|
||||
ret = ret && connect(m_textureSearchClear, SIGNAL(clicked()), this,
|
||||
SLOT(onTextureClearSearch()));
|
||||
|
||||
return textureOutsideFrame;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -4423,6 +4554,13 @@ QFrame *StyleEditor::createVectorPage() {
|
|||
QFrame *vectorOutsideFrame = new QFrame(this);
|
||||
vectorOutsideFrame->setMinimumWidth(50);
|
||||
|
||||
m_vectorsSearchFrame = new QFrame();
|
||||
m_vectorsSearchText = new QLineEdit();
|
||||
m_vectorsSearchClear = new QPushButton(tr("Clear Search"));
|
||||
m_vectorsSearchClear->setDisabled(true);
|
||||
m_vectorsSearchClear->setSizePolicy(QSizePolicy::Minimum,
|
||||
QSizePolicy::Preferred);
|
||||
|
||||
/* ------ layout ------ */
|
||||
QVBoxLayout *vectorOutsideLayout = new QVBoxLayout();
|
||||
vectorOutsideLayout->setMargin(0);
|
||||
|
@ -4457,9 +4595,29 @@ QFrame *StyleEditor::createVectorPage() {
|
|||
m_vectorArea = makeChooserPage(vectorFrame);
|
||||
m_vectorArea->setMinimumWidth(50);
|
||||
vectorOutsideLayout->addWidget(m_vectorArea);
|
||||
|
||||
QHBoxLayout *searchLayout = new QHBoxLayout();
|
||||
searchLayout->setMargin(2);
|
||||
searchLayout->setSpacing(0);
|
||||
searchLayout->setSizeConstraint(QLayout::SetNoConstraint);
|
||||
{
|
||||
searchLayout->addWidget(m_vectorsSearchText);
|
||||
searchLayout->addWidget(m_vectorsSearchClear);
|
||||
}
|
||||
m_vectorsSearchFrame->setLayout(searchLayout);
|
||||
vectorOutsideLayout->addWidget(m_vectorsSearchFrame);
|
||||
}
|
||||
vectorOutsideFrame->setLayout(vectorOutsideLayout);
|
||||
|
||||
/* ------ signal-slot connections ------ */
|
||||
bool ret = true;
|
||||
ret =
|
||||
ret && connect(m_vectorsSearchText, SIGNAL(textChanged(const QString &)),
|
||||
this, SLOT(onVectorsSearch(const QString &)));
|
||||
ret = ret && connect(m_vectorsSearchClear, SIGNAL(clicked()), this,
|
||||
SLOT(onVectorsClearSearch()));
|
||||
|
||||
assert(ret);
|
||||
return vectorOutsideFrame;
|
||||
}
|
||||
|
||||
|
@ -4469,6 +4627,13 @@ QFrame *StyleEditor::createRasterPage() {
|
|||
QFrame *rasterOutsideFrame = new QFrame(this);
|
||||
rasterOutsideFrame->setMinimumWidth(50);
|
||||
|
||||
m_mypaintSearchFrame = new QFrame();
|
||||
m_mypaintSearchText = new QLineEdit();
|
||||
m_mypaintSearchClear = new QPushButton(tr("Clear Search"));
|
||||
m_mypaintSearchClear->setDisabled(true);
|
||||
m_mypaintSearchClear->setSizePolicy(QSizePolicy::Minimum,
|
||||
QSizePolicy::Preferred);
|
||||
|
||||
/* ------ layout ------ */
|
||||
QVBoxLayout *rasterOutsideLayout = new QVBoxLayout();
|
||||
rasterOutsideLayout->setMargin(0);
|
||||
|
@ -4503,14 +4668,85 @@ QFrame *StyleEditor::createRasterPage() {
|
|||
m_rasterArea = makeChooserPage(rasterFrame);
|
||||
m_rasterArea->setMinimumWidth(50);
|
||||
rasterOutsideLayout->addWidget(m_rasterArea);
|
||||
|
||||
QHBoxLayout *searchLayout = new QHBoxLayout();
|
||||
searchLayout->setMargin(2);
|
||||
searchLayout->setSpacing(0);
|
||||
searchLayout->setSizeConstraint(QLayout::SetNoConstraint);
|
||||
{
|
||||
searchLayout->addWidget(m_mypaintSearchText);
|
||||
searchLayout->addWidget(m_mypaintSearchClear);
|
||||
}
|
||||
m_mypaintSearchFrame->setLayout(searchLayout);
|
||||
rasterOutsideLayout->addWidget(m_mypaintSearchFrame);
|
||||
}
|
||||
rasterOutsideFrame->setLayout(rasterOutsideLayout);
|
||||
|
||||
/* ------ signal-slot connections ------ */
|
||||
bool ret = true;
|
||||
ret =
|
||||
ret && connect(m_mypaintSearchText, SIGNAL(textChanged(const QString &)),
|
||||
this, SLOT(onMyPaintSearch(const QString &)));
|
||||
ret = ret && connect(m_mypaintSearchClear, SIGNAL(clicked()), this,
|
||||
SLOT(onMyPaintClearSearch()));
|
||||
|
||||
assert(ret);
|
||||
return rasterOutsideFrame;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void StyleEditor::onTextureSearch(const QString &search) {
|
||||
m_textureSearchClear->setDisabled(search.isEmpty());
|
||||
for (int i = 0; i < m_texturePages.size(); i++) {
|
||||
m_texturePages[i]->applyFilter(search);
|
||||
m_texturePages[i]->computeSize();
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void StyleEditor::onTextureClearSearch() {
|
||||
m_textureSearchText->setText("");
|
||||
m_textureSearchText->setFocus();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void StyleEditor::onVectorsSearch(const QString &search) {
|
||||
m_vectorsSearchClear->setDisabled(search.isEmpty());
|
||||
for (int i = 0; i < m_vectorPages.size(); i++) {
|
||||
m_vectorPages[i]->applyFilter(search);
|
||||
m_vectorPages[i]->computeSize();
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void StyleEditor::onVectorsClearSearch() {
|
||||
m_vectorsSearchText->setText("");
|
||||
m_vectorsSearchText->setFocus();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void StyleEditor::onMyPaintSearch(const QString &search) {
|
||||
m_mypaintSearchClear->setDisabled(search.isEmpty());
|
||||
for (int i = 0; i < m_rasterPages.size(); i++) {
|
||||
m_rasterPages[i]->applyFilter(search);
|
||||
m_rasterPages[i]->computeSize();
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void StyleEditor::onMyPaintClearSearch() {
|
||||
m_mypaintSearchText->setText("");
|
||||
m_mypaintSearchText->setFocus();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void StyleEditor::updateTabBar() {
|
||||
m_styleBar->clearTabBar();
|
||||
if (m_enabled && !m_enabledOnlyFirstTab && !m_enabledFirstAndLastTab) {
|
||||
|
@ -4562,6 +4798,7 @@ void StyleEditor::showEvent(QShowEvent *) {
|
|||
m_plainColorPage->m_hsvFrame->setVisible(m_hsvAction->isChecked());
|
||||
m_plainColorPage->m_rgbFrame->setVisible(m_rgbAction->isChecked());
|
||||
m_hexLineEdit->setVisible(m_hexAction->isChecked());
|
||||
onSearchVisible(m_searchAction->isChecked());
|
||||
updateOrientationButton();
|
||||
assert(ret);
|
||||
}
|
||||
|
@ -5325,6 +5562,14 @@ void StyleEditor::onToggleAutoApply() {
|
|||
: tr("Show Auto/Apply"));
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void StyleEditor::onSearchVisible(bool on) {
|
||||
m_textureSearchFrame->setVisible(on);
|
||||
m_vectorsSearchFrame->setVisible(on);
|
||||
m_mypaintSearchFrame->setVisible(on);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
QStringList StyleEditor::savePageStates(StylePageType pageType) const {
|
||||
QStringList pageStateData;
|
||||
|
@ -5419,6 +5664,7 @@ void StyleEditor::save(QSettings &settings, bool forPopupIni) const {
|
|||
if (m_alphaAction->isChecked()) visibleParts |= 0x04;
|
||||
if (m_rgbAction->isChecked()) visibleParts |= 0x08;
|
||||
if (m_hexAction->isChecked()) visibleParts |= 0x10;
|
||||
if (m_searchAction->isChecked()) visibleParts |= 0x20;
|
||||
settings.setValue("visibleParts", visibleParts);
|
||||
settings.setValue("splitterState", m_plainColorPage->getSplitterState());
|
||||
settings.setValue("texturePageStates",
|
||||
|
@ -5458,6 +5704,10 @@ void StyleEditor::load(QSettings &settings) {
|
|||
m_hexAction->setChecked(true);
|
||||
else
|
||||
m_hexAction->setChecked(false);
|
||||
if (visiblePartsInt & 0x20)
|
||||
m_searchAction->setChecked(true);
|
||||
else
|
||||
m_searchAction->setChecked(false);
|
||||
}
|
||||
QVariant splitterState = settings.value("splitterState");
|
||||
if (splitterState.canConvert(QVariant::ByteArray))
|
||||
|
|