mirror of https://github.com/aseprite/aseprite.git
Add guides/slices options in preference dialog
Also moved guide/slice colors to global preferences (instead of pref per document).
This commit is contained in:
parent
fb64d5406a
commit
add0c81260
|
@ -770,6 +770,7 @@
|
||||||
<item command="ShowLayerEdges" text="&Layer Edges" />
|
<item command="ShowLayerEdges" text="&Layer Edges" />
|
||||||
<item command="ShowSelectionEdges" text="&Selection Edges" />
|
<item command="ShowSelectionEdges" text="&Selection Edges" />
|
||||||
<item command="ShowGrid" text="&Grid" />
|
<item command="ShowGrid" text="&Grid" />
|
||||||
|
<item command="ShowAutoGuides" text="&Auto Guides" />
|
||||||
<item command="ShowSlices" text="Sl&ices" />
|
<item command="ShowSlices" text="Sl&ices" />
|
||||||
<item command="ShowPixelGrid" text="&Pixel Grid" />
|
<item command="ShowPixelGrid" text="&Pixel Grid" />
|
||||||
<separator />
|
<separator />
|
||||||
|
|
|
@ -230,6 +230,13 @@
|
||||||
<section id="perf">
|
<section id="perf">
|
||||||
<option id="show_render_time" type="bool" default="false" />
|
<option id="show_render_time" type="bool" default="false" />
|
||||||
</section>
|
</section>
|
||||||
|
<section id="guides">
|
||||||
|
<option id="layer_edges_color" type="app::Color" default="app::Color::fromRgb(0, 0, 255)" />
|
||||||
|
<option id="auto_guides_color" type="app::Color" default="app::Color::fromRgb(0, 0, 255, 128)" />
|
||||||
|
</section>
|
||||||
|
<section id="slices">
|
||||||
|
<option id="default_color" type="app::Color" default="app::Color::fromRgb(0, 0, 255)" />
|
||||||
|
</section>
|
||||||
</global>
|
</global>
|
||||||
|
|
||||||
<tool>
|
<tool>
|
||||||
|
@ -280,11 +287,6 @@
|
||||||
<option id="opacity" type="int" default="160" migrate="PixelGrid.Opacity" />
|
<option id="opacity" type="int" default="160" migrate="PixelGrid.Opacity" />
|
||||||
<option id="auto_opacity" type="bool" default="true" migrate="PixelGrid.AutoOpacity" />
|
<option id="auto_opacity" type="bool" default="true" migrate="PixelGrid.AutoOpacity" />
|
||||||
</section>
|
</section>
|
||||||
<section id="guides">
|
|
||||||
<option id="layer_edges_color" type="app::Color" default="app::Color::fromRgb(0, 0, 255)" />
|
|
||||||
<option id="default_slice_color" type="app::Color" default="app::Color::fromRgb(0, 0, 255)" />
|
|
||||||
<option id="automatic_guides_color" type="app::Color" default="app::Color::fromRgb(0, 0, 255, 128)" />
|
|
||||||
</section>
|
|
||||||
<section id="bg">
|
<section id="bg">
|
||||||
<option id="type" type="BgType" default="BgType::CHECKED_16x16" migrate="Option.CheckedBgType" />
|
<option id="type" type="BgType" default="BgType::CHECKED_16x16" migrate="Option.CheckedBgType" />
|
||||||
<option id="zoom" type="bool" default="true" migrate="Option.CheckedBgZoom" />
|
<option id="zoom" type="bool" default="true" migrate="Option.CheckedBgZoom" />
|
||||||
|
@ -356,6 +358,7 @@
|
||||||
<option id="pixel_grid" type="bool" default="false" migrate="pixel_grid.visible" />
|
<option id="pixel_grid" type="bool" default="false" migrate="pixel_grid.visible" />
|
||||||
<option id="brush_preview" type="bool" default="true" />
|
<option id="brush_preview" type="bool" default="true" />
|
||||||
<option id="slices" type="bool" default="true" />
|
<option id="slices" type="bool" default="true" />
|
||||||
|
<option id="auto_guides" type="bool" default="true" />
|
||||||
</section>
|
</section>
|
||||||
</document>
|
</document>
|
||||||
|
|
||||||
|
|
|
@ -260,6 +260,7 @@ section_timeline = Timeline
|
||||||
section_cursors = Cursors
|
section_cursors = Cursors
|
||||||
section_background = Background
|
section_background = Background
|
||||||
section_grid = Grid
|
section_grid = Grid
|
||||||
|
section_guides_and_slices = Guides && Slices
|
||||||
section_undo = Undo
|
section_undo = Undo
|
||||||
section_theme = Theme
|
section_theme = Theme
|
||||||
section_experimental = Experimental
|
section_experimental = Experimental
|
||||||
|
@ -356,6 +357,11 @@ grid_pixel_grid_visible = Visible Pixel Grid
|
||||||
grid_pixel_grid_color = Color:
|
grid_pixel_grid_color = Color:
|
||||||
grid_pixel_grid_opacity = Opacity:
|
grid_pixel_grid_opacity = Opacity:
|
||||||
reset_grid = Reset
|
reset_grid = Reset
|
||||||
|
guides = Guides
|
||||||
|
slices = Slices
|
||||||
|
layer_edges_color = Layer Edges Color:
|
||||||
|
auto_guides_color = Auto Guides Color:
|
||||||
|
default_slice_color = Default Color:
|
||||||
undo = Undo
|
undo = Undo
|
||||||
undo_size_limit = Undo Limit:
|
undo_size_limit = Undo Limit:
|
||||||
undo_size_limit_tooltip = <<<END
|
undo_size_limit_tooltip = <<<END
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
<listitem text="@.section_cursors" value="section_cursors" />
|
<listitem text="@.section_cursors" value="section_cursors" />
|
||||||
<listitem text="@.section_background" value="section_bg" />
|
<listitem text="@.section_background" value="section_bg" />
|
||||||
<listitem text="@.section_grid" value="section_grid" />
|
<listitem text="@.section_grid" value="section_grid" />
|
||||||
|
<listitem text="@.section_guides_and_slices" value="section_guides_and_slices" />
|
||||||
<listitem text="@.section_undo" value="section_undo" />
|
<listitem text="@.section_undo" value="section_undo" />
|
||||||
<listitem text="@.section_theme" value="section_theme" />
|
<listitem text="@.section_theme" value="section_theme" />
|
||||||
<listitem text="@.section_experimental" value="section_experimental" />
|
<listitem text="@.section_experimental" value="section_experimental" />
|
||||||
|
@ -216,6 +217,23 @@
|
||||||
</hbox>
|
</hbox>
|
||||||
</vbox>
|
</vbox>
|
||||||
|
|
||||||
|
<!-- Guides -->
|
||||||
|
<vbox id="section_guides_and_slices">
|
||||||
|
<separator text="@.guides" horizontal="true" />
|
||||||
|
<grid columns="2">
|
||||||
|
<label text="@.layer_edges_color" />
|
||||||
|
<colorpicker id="layer_edges_color" rgba="true" />
|
||||||
|
<label text="@.auto_guides_color" />
|
||||||
|
<colorpicker id="auto_guides_color" rgba="true" />
|
||||||
|
</grid>
|
||||||
|
|
||||||
|
<separator text="@.slices" horizontal="true" />
|
||||||
|
<hbox>
|
||||||
|
<label text="@.default_slice_color" />
|
||||||
|
<colorpicker id="default_slice_color" rgba="true" />
|
||||||
|
</hbox>
|
||||||
|
</vbox>
|
||||||
|
|
||||||
<!-- Undo -->
|
<!-- Undo -->
|
||||||
<vbox id="section_undo">
|
<vbox id="section_undo">
|
||||||
<separator text="@.section_undo" horizontal="true" />
|
<separator text="@.section_undo" horizontal="true" />
|
||||||
|
|
|
@ -105,6 +105,13 @@ public:
|
||||||
m_pixelGridColor->setId("pixel_grid_color");
|
m_pixelGridColor->setId("pixel_grid_color");
|
||||||
pixelGridColorPlaceholder()->addChild(m_pixelGridColor);
|
pixelGridColorPlaceholder()->addChild(m_pixelGridColor);
|
||||||
|
|
||||||
|
// Guide colors
|
||||||
|
layerEdgesColor()->setColor(m_pref.guides.layerEdgesColor());
|
||||||
|
autoGuidesColor()->setColor(m_pref.guides.autoGuidesColor());
|
||||||
|
|
||||||
|
// Slices default color
|
||||||
|
defaultSliceColor()->setColor(m_pref.slices.defaultColor());
|
||||||
|
|
||||||
// Others
|
// Others
|
||||||
if (m_pref.general.autoshowTimeline())
|
if (m_pref.general.autoshowTimeline())
|
||||||
autotimeline()->setSelected(true);
|
autotimeline()->setSelected(true);
|
||||||
|
@ -307,6 +314,9 @@ public:
|
||||||
m_pref.cursor.cursorScale(base::convert_to<int>(cursorScale()->getValue()));
|
m_pref.cursor.cursorScale(base::convert_to<int>(cursorScale()->getValue()));
|
||||||
m_pref.selection.autoOpaque(autoOpaque()->isSelected());
|
m_pref.selection.autoOpaque(autoOpaque()->isSelected());
|
||||||
m_pref.selection.keepSelectionAfterClear(keepSelectionAfterClear()->isSelected());
|
m_pref.selection.keepSelectionAfterClear(keepSelectionAfterClear()->isSelected());
|
||||||
|
m_pref.guides.layerEdgesColor(layerEdgesColor()->getColor());
|
||||||
|
m_pref.guides.autoGuidesColor(autoGuidesColor()->getColor());
|
||||||
|
m_pref.slices.defaultColor(defaultSliceColor()->getColor());
|
||||||
|
|
||||||
m_curPref->show.grid(gridVisible()->isSelected());
|
m_curPref->show.grid(gridVisible()->isSelected());
|
||||||
m_curPref->grid.bounds(gridBounds());
|
m_curPref->grid.bounds(gridBounds());
|
||||||
|
|
|
@ -171,6 +171,28 @@ protected:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class ShowAutoGuidesCommand : public Command {
|
||||||
|
public:
|
||||||
|
ShowAutoGuidesCommand()
|
||||||
|
: Command("ShowAutoGuides",
|
||||||
|
"Show Auto Guides",
|
||||||
|
CmdUIOnlyFlag) {
|
||||||
|
}
|
||||||
|
|
||||||
|
Command* clone() const override { return new ShowAutoGuidesCommand(*this); }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
bool onChecked(Context* ctx) override {
|
||||||
|
DocumentPreferences& docPref = Preferences::instance().document(ctx->activeDocument());
|
||||||
|
return docPref.show.autoGuides();
|
||||||
|
}
|
||||||
|
|
||||||
|
void onExecute(Context* ctx) override {
|
||||||
|
DocumentPreferences& docPref = Preferences::instance().document(ctx->activeDocument());
|
||||||
|
docPref.show.autoGuides(!docPref.show.autoGuides());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
class ShowSlicesCommand : public Command {
|
class ShowSlicesCommand : public Command {
|
||||||
public:
|
public:
|
||||||
ShowSlicesCommand()
|
ShowSlicesCommand()
|
||||||
|
@ -223,6 +245,11 @@ Command* CommandFactory::createShowBrushPreviewCommand()
|
||||||
return new ShowBrushPreviewCommand;
|
return new ShowBrushPreviewCommand;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Command* CommandFactory::createShowAutoGuidesCommand()
|
||||||
|
{
|
||||||
|
return new ShowAutoGuidesCommand;
|
||||||
|
}
|
||||||
|
|
||||||
Command* CommandFactory::createShowSlicesCommand()
|
Command* CommandFactory::createShowSlicesCommand()
|
||||||
{
|
{
|
||||||
return new ShowSlicesCommand;
|
return new ShowSlicesCommand;
|
||||||
|
|
|
@ -119,6 +119,7 @@ FOR_EACH_COMMAND(SetLoopSection)
|
||||||
FOR_EACH_COMMAND(SetPalette)
|
FOR_EACH_COMMAND(SetPalette)
|
||||||
FOR_EACH_COMMAND(SetPaletteEntrySize)
|
FOR_EACH_COMMAND(SetPaletteEntrySize)
|
||||||
FOR_EACH_COMMAND(SetSameInk)
|
FOR_EACH_COMMAND(SetSameInk)
|
||||||
|
FOR_EACH_COMMAND(ShowAutoGuides)
|
||||||
FOR_EACH_COMMAND(ShowBrushPreview)
|
FOR_EACH_COMMAND(ShowBrushPreview)
|
||||||
FOR_EACH_COMMAND(ShowExtras)
|
FOR_EACH_COMMAND(ShowExtras)
|
||||||
FOR_EACH_COMMAND(ShowGrid)
|
FOR_EACH_COMMAND(ShowGrid)
|
||||||
|
|
|
@ -807,7 +807,7 @@ void Editor::drawSpriteUnclippedRect(ui::Graphics* g, const gfx::Rect& _rc)
|
||||||
if (cel) {
|
if (cel) {
|
||||||
drawCelBounds(
|
drawCelBounds(
|
||||||
g, cel,
|
g, cel,
|
||||||
color_utils::color_for_ui(m_docPref.guides.layerEdgesColor()));
|
color_utils::color_for_ui(Preferences::instance().guides.layerEdgesColor()));
|
||||||
|
|
||||||
if (showGuidesThisCel &&
|
if (showGuidesThisCel &&
|
||||||
m_showGuidesThisCel != cel)
|
m_showGuidesThisCel != cel)
|
||||||
|
@ -1040,7 +1040,7 @@ void Editor::drawCelGuides(ui::Graphics* g, const Cel* cel, const Cel* mouseCel)
|
||||||
|
|
||||||
drawCelBounds(
|
drawCelBounds(
|
||||||
g, mouseCel,
|
g, mouseCel,
|
||||||
color_utils::color_for_ui(m_docPref.guides.automaticGuidesColor()));
|
color_utils::color_for_ui(Preferences::instance().guides.autoGuidesColor()));
|
||||||
}
|
}
|
||||||
// Use whole canvas
|
// Use whole canvas
|
||||||
else {
|
else {
|
||||||
|
@ -1116,7 +1116,7 @@ void Editor::drawCelHGuide(ui::Graphics* g,
|
||||||
const gfx::Rect& scrCelBounds, const gfx::Rect& scrCmpBounds,
|
const gfx::Rect& scrCelBounds, const gfx::Rect& scrCmpBounds,
|
||||||
const int dottedX)
|
const int dottedX)
|
||||||
{
|
{
|
||||||
auto color = color_utils::color_for_ui(m_docPref.guides.automaticGuidesColor());
|
gfx::Color color = color_utils::color_for_ui(Preferences::instance().guides.autoGuidesColor());
|
||||||
g->drawHLine(color, scrX1, scrY, scrX2 - scrX1);
|
g->drawHLine(color, scrX1, scrY, scrX2 - scrX1);
|
||||||
|
|
||||||
// Vertical guide to touch the horizontal line
|
// Vertical guide to touch the horizontal line
|
||||||
|
@ -1142,7 +1142,7 @@ void Editor::drawCelVGuide(ui::Graphics* g,
|
||||||
const gfx::Rect& scrCelBounds, const gfx::Rect& scrCmpBounds,
|
const gfx::Rect& scrCelBounds, const gfx::Rect& scrCmpBounds,
|
||||||
const int dottedY)
|
const int dottedY)
|
||||||
{
|
{
|
||||||
auto color = color_utils::color_for_ui(m_docPref.guides.automaticGuidesColor());
|
gfx::Color color = color_utils::color_for_ui(Preferences::instance().guides.autoGuidesColor());
|
||||||
g->drawVLine(color, scrX, scrY1, scrY2 - scrY1);
|
g->drawVLine(color, scrX, scrY1, scrY2 - scrY1);
|
||||||
|
|
||||||
// Horizontal guide to touch the vertical line
|
// Horizontal guide to touch the vertical line
|
||||||
|
@ -2267,6 +2267,7 @@ bool Editor::showAutoCelGuides()
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
(getCurrentEditorInk()->isCelMovement() &&
|
(getCurrentEditorInk()->isCelMovement() &&
|
||||||
|
m_docPref.show.autoGuides() &&
|
||||||
m_customizationDelegate &&
|
m_customizationDelegate &&
|
||||||
int(m_customizationDelegate->getPressedKeyAction(KeyContext::MoveTool) & KeyAction::AutoSelectLayer));
|
int(m_customizationDelegate->getPressedKeyAction(KeyContext::MoveTool) & KeyAction::AutoSelectLayer));
|
||||||
}
|
}
|
||||||
|
|
|
@ -468,7 +468,7 @@ public:
|
||||||
m_transaction.execute(new cmd::SetMask(m_document, newMask));
|
m_transaction.execute(new cmd::SetMask(m_document, newMask));
|
||||||
}
|
}
|
||||||
void addSlice(Slice* newSlice) override {
|
void addSlice(Slice* newSlice) override {
|
||||||
auto color = m_docPref.guides.defaultSliceColor();
|
auto color = Preferences::instance().slices.defaultColor();
|
||||||
newSlice->userData().setColor(
|
newSlice->userData().setColor(
|
||||||
doc::rgba(color.getRed(),
|
doc::rgba(color.getRed(),
|
||||||
color.getGreen(),
|
color.getGreen(),
|
||||||
|
|
|
@ -403,8 +403,12 @@ Widget* WidgetLoader::convertXmlElementToWidget(const TiXmlElement* elem, Widget
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (elem_name == "colorpicker") {
|
else if (elem_name == "colorpicker") {
|
||||||
|
bool rgba = bool_attr_is_true(elem, "rgba");
|
||||||
|
|
||||||
if (!widget)
|
if (!widget)
|
||||||
widget = new ColorButton(Color::fromMask(), app_get_current_pixel_format(), false);
|
widget = new ColorButton(Color::fromMask(),
|
||||||
|
rgba ? IMAGE_RGB:
|
||||||
|
app_get_current_pixel_format(), false);
|
||||||
}
|
}
|
||||||
else if (elem_name == "dropdownbutton") {
|
else if (elem_name == "dropdownbutton") {
|
||||||
if (!widget) {
|
if (!widget) {
|
||||||
|
|
Loading…
Reference in New Issue