mirror of https://github.com/aseprite/aseprite.git
Change opaque/transparent selection by default depending on the layer
This commit is contained in:
parent
bc29cd4bc5
commit
41bb23f1f1
|
@ -111,6 +111,7 @@
|
|||
<section id="selection">
|
||||
<option id="mode" type="app::tools::SelectionMode" default="app::tools::SelectionMode::DEFAULT" />
|
||||
<option id="opaque" type="bool" default="false" />
|
||||
<option id="auto_opaque" type="bool" default="true" />
|
||||
<option id="transparent_color" type="app::Color" />
|
||||
<option id="rotation_algorithm" type="app::tools::RotationAlgorithm" default="app::tools::RotationAlgorithm::DEFAULT" />
|
||||
</section>
|
||||
|
|
|
@ -58,9 +58,12 @@
|
|||
<label text="Cursor Color:" />
|
||||
<box id="cursor_color_box" /><!-- custom widget -->
|
||||
</hbox>
|
||||
|
||||
<separator text="Selection" horizontal="true" />
|
||||
<check text="Adjust opaque/transparent mode automatically" id="auto_opaque" tooltip="Depending on the layer (background/transparent), the pasted selection will be adjusted automatically (opaque/transparent)" />
|
||||
</vbox>
|
||||
|
||||
<!-- Editor -->
|
||||
<!-- Timeline -->
|
||||
<vbox id="section_timeline">
|
||||
<separator text="Timeline" horizontal="true" />
|
||||
<check text="Show timeline automatically" id="autotimeline" tooltip="Show the timeline automatically when a new frame or layer is added." />
|
||||
|
|
|
@ -84,6 +84,9 @@ public:
|
|||
if (m_preferences.editor.zoomFromCenterWithKeys())
|
||||
zoomFromCenterWithKeys()->setSelected(true);
|
||||
|
||||
if (m_preferences.selection.autoOpaque())
|
||||
autoOpaque()->setSelected(true);
|
||||
|
||||
if (m_preferences.experimental.useNativeCursor())
|
||||
nativeCursor()->setSelected(true);
|
||||
|
||||
|
@ -181,6 +184,7 @@ public:
|
|||
m_preferences.editor.zoomWithWheel(wheelZoom()->isSelected());
|
||||
m_preferences.editor.rightClickMode(static_cast<app::gen::RightClickMode>(rightClickBehavior()->getSelectedItemIndex()));
|
||||
m_preferences.editor.cursorColor(m_cursorColor->getColor());
|
||||
m_preferences.selection.autoOpaque(autoOpaque()->isSelected());
|
||||
|
||||
m_curPref->grid.color(m_gridColor->getColor());
|
||||
m_curPref->grid.opacity(gridOpacity()->getValue());
|
||||
|
|
|
@ -490,10 +490,14 @@ public:
|
|||
gfx::Size sz = m_icon.getItem(0)->getPreferredSize();
|
||||
sz.w += 2*guiscale();
|
||||
m_icon.getItem(0)->setMinSize(sz);
|
||||
setOpaque(Preferences::instance().selection.opaque());
|
||||
|
||||
m_icon.ItemChange.connect(Bind<void>(&TransparentColorField::onPopup, this));
|
||||
m_maskColor.Change.connect(Bind<void>(&TransparentColorField::onChangeColor, this));
|
||||
|
||||
Preferences::instance().selection.opaque.AfterChange.connect(
|
||||
Bind<void>(&TransparentColorField::onOpaqueChange, this));
|
||||
|
||||
setOpaque(Preferences::instance().selection.opaque());
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -525,12 +529,18 @@ private:
|
|||
}
|
||||
|
||||
void setOpaque(bool opaque) {
|
||||
Preferences::instance().selection.opaque(opaque);
|
||||
}
|
||||
|
||||
// When the preference is changed from outside the context bar
|
||||
void onOpaqueChange() {
|
||||
bool opaque = Preferences::instance().selection.opaque();
|
||||
|
||||
int part = (opaque ? PART_SELECTION_OPAQUE: PART_SELECTION_MASKED);
|
||||
m_icon.getItem(0)->setIcon(
|
||||
static_cast<SkinTheme*>(getTheme())->get_part(part));
|
||||
|
||||
m_maskColor.setVisible(!opaque);
|
||||
Preferences::instance().selection.opaque(opaque);
|
||||
if (!opaque) {
|
||||
Preferences::instance().selection.transparentColor(
|
||||
m_maskColor.getColor());
|
||||
|
|
|
@ -70,7 +70,11 @@ MovingPixelsState::MovingPixelsState(Editor* editor, MouseMessage* msg, PixelsMo
|
|||
editor->captureMouse();
|
||||
}
|
||||
|
||||
// Setup mask color
|
||||
// Setup transparent mode/mask color
|
||||
if (Preferences::instance().selection.autoOpaque()) {
|
||||
Preferences::instance().selection.opaque(
|
||||
editor->layer()->isBackground());
|
||||
}
|
||||
onTransparentColorChange();
|
||||
|
||||
// Hook BeforeCommandExecution signal so we know if the user wants
|
||||
|
|
Loading…
Reference in New Issue