mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-01 10:13:22 +00:00
Use new ScopedValue w/o old arg + C++17 class template argument deduction (CTAD)
This commit is contained in:
parent
d4d18c99be
commit
b28550faf5
2
laf
2
laf
@ -1 +1 @@
|
||||
Subproject commit cf1eec48af8ae0a9fb689e44cda2d6a125ce58d1
|
||||
Subproject commit 41476b78d001b82a72cc6556164bc20954d75636
|
@ -188,7 +188,7 @@ private:
|
||||
if (!m_pendingChanges)
|
||||
return;
|
||||
|
||||
base::ScopedValue<bool> switchSelf(m_selfUpdate, true, false);
|
||||
base::ScopedValue switchSelf(m_selfUpdate, true);
|
||||
|
||||
m_timer.stop();
|
||||
|
||||
@ -308,7 +308,7 @@ private:
|
||||
|
||||
m_timer.stop(); // Cancel current editions (just in case)
|
||||
|
||||
base::ScopedValue<bool> switchSelf(m_selfUpdate, true, false);
|
||||
base::ScopedValue switchSelf(m_selfUpdate, true);
|
||||
|
||||
int bgCount = 0;
|
||||
int count = countCels(&bgCount);
|
||||
|
@ -762,7 +762,7 @@ private:
|
||||
}
|
||||
|
||||
void onSearchChange() {
|
||||
base::ScopedValue<bool> flag(m_searchChange, true, false);
|
||||
base::ScopedValue flag(m_searchChange, true);
|
||||
std::string searchText = search()->text();
|
||||
|
||||
if (searchText.empty())
|
||||
|
@ -243,7 +243,7 @@ private:
|
||||
if (!m_layer)
|
||||
return;
|
||||
|
||||
base::ScopedValue<bool> switchSelf(m_selfUpdate, true, false);
|
||||
base::ScopedValue switchSelf(m_selfUpdate, true);
|
||||
|
||||
m_timer.stop();
|
||||
|
||||
@ -396,7 +396,7 @@ private:
|
||||
|
||||
m_timer.stop(); // Cancel current editions (just in case)
|
||||
|
||||
base::ScopedValue<bool> switchSelf(m_selfUpdate, true, false);
|
||||
base::ScopedValue switchSelf(m_selfUpdate, true);
|
||||
|
||||
const bool tilemapVisibility = (m_layer && m_layer->isTilemap());
|
||||
if (m_layer) {
|
||||
|
@ -153,9 +153,7 @@ void Context::executeCommandFromMenuOrShortcut(Command* command, const Params& p
|
||||
command->id().c_str(), executingCommand->id().c_str());
|
||||
return;
|
||||
}
|
||||
base::ScopedValue<Command*> commandGuard(executingCommand,
|
||||
command, nullptr);
|
||||
|
||||
base::ScopedValue commandGuard(executingCommand, command);
|
||||
executeCommand(command, params);
|
||||
}
|
||||
|
||||
|
@ -105,7 +105,7 @@ bool DocUndo::canRedo() const
|
||||
void DocUndo::undo()
|
||||
{
|
||||
ASSERT(!m_undoing);
|
||||
base::ScopedValue undoing(m_undoing, true, false);
|
||||
base::ScopedValue undoing(m_undoing, true);
|
||||
const size_t oldSize = m_totalUndoSize;
|
||||
{
|
||||
const undo::UndoState* state = nextUndo();
|
||||
@ -127,7 +127,7 @@ void DocUndo::undo()
|
||||
void DocUndo::redo()
|
||||
{
|
||||
ASSERT(!m_undoing);
|
||||
base::ScopedValue undoing(m_undoing, true, false);
|
||||
base::ScopedValue undoing(m_undoing, true);
|
||||
const size_t oldSize = m_totalUndoSize;
|
||||
{
|
||||
const undo::UndoState* state = nextRedo();
|
||||
@ -279,7 +279,7 @@ Cmd* DocUndo::lastExecutedCmd() const
|
||||
void DocUndo::moveToState(const undo::UndoState* state)
|
||||
{
|
||||
ASSERT(!m_undoing);
|
||||
base::ScopedValue undoing(m_undoing, true, false);
|
||||
base::ScopedValue undoing(m_undoing, true);
|
||||
|
||||
m_undoHistory.moveTo(state);
|
||||
|
||||
|
@ -62,7 +62,7 @@ void ResourcesLoader::reload()
|
||||
|
||||
void ResourcesLoader::threadLoadResources()
|
||||
{
|
||||
base::ScopedValue<bool> scoped(m_done, false, true);
|
||||
base::ScopedValue scoped(m_done, false, true);
|
||||
|
||||
// Load resources from extensions
|
||||
std::map<std::string, std::string> idAndPaths;
|
||||
|
@ -1029,7 +1029,7 @@ void ColorBar::onPaletteViewIndexChange(int index, ui::MouseButton button)
|
||||
{
|
||||
COLOR_BAR_TRACE("ColorBar::onPaletteViewIndexChange(%d)\n", index);
|
||||
|
||||
base::ScopedValue<bool> lock(m_fromPalView, true, m_fromPalView);
|
||||
base::ScopedValue lock(m_fromPalView, true);
|
||||
|
||||
app::Color color = app::Color::fromIndex(index);
|
||||
|
||||
@ -1294,7 +1294,7 @@ void ColorBar::onFgColorChangeFromPreferences()
|
||||
if (m_fromPref)
|
||||
return;
|
||||
|
||||
base::ScopedValue<bool> sync(m_fromPref, true, false);
|
||||
base::ScopedValue sync(m_fromPref, true);
|
||||
setFgColor(Preferences::instance().colorBar.fgColor());
|
||||
}
|
||||
|
||||
@ -1312,7 +1312,7 @@ void ColorBar::onBgColorChangeFromPreferences()
|
||||
setFgColor(Preferences::instance().colorBar.bgColor());
|
||||
}
|
||||
else {
|
||||
base::ScopedValue<bool> sync(m_fromPref, true, false);
|
||||
base::ScopedValue sync(m_fromPref, true);
|
||||
setBgColor(Preferences::instance().colorBar.bgColor());
|
||||
}
|
||||
}
|
||||
@ -1322,7 +1322,7 @@ void ColorBar::onFgTileChangeFromPreferences()
|
||||
if (m_fromPref)
|
||||
return;
|
||||
|
||||
base::ScopedValue<bool> sync(m_fromPref, true, false);
|
||||
base::ScopedValue sync(m_fromPref, true);
|
||||
auto tile = Preferences::instance().colorBar.fgTile();
|
||||
m_fgTile.setTile(tile);
|
||||
m_tilesView.selectColor(tile);
|
||||
@ -1333,7 +1333,7 @@ void ColorBar::onBgTileChangeFromPreferences()
|
||||
if (m_fromPref)
|
||||
return;
|
||||
|
||||
base::ScopedValue<bool> sync(m_fromPref, true, false);
|
||||
base::ScopedValue sync(m_fromPref, true);
|
||||
auto tile = Preferences::instance().colorBar.bgTile();
|
||||
m_bgTile.setTile(tile);
|
||||
m_tilesView.selectColor(tile);
|
||||
@ -1372,10 +1372,10 @@ void ColorBar::onFgColorButtonChange(const app::Color& color)
|
||||
if (m_fromFgButton)
|
||||
return;
|
||||
|
||||
base::ScopedValue<bool> lock(m_fromFgButton, true, false);
|
||||
base::ScopedValue lock(m_fromFgButton, true);
|
||||
|
||||
if (!m_fromPref) {
|
||||
base::ScopedValue<bool> sync(m_fromPref, true, false);
|
||||
base::ScopedValue sync(m_fromPref, true);
|
||||
Preferences::instance().colorBar.fgColor(color);
|
||||
}
|
||||
|
||||
@ -1390,13 +1390,13 @@ void ColorBar::onBgColorButtonChange(const app::Color& color)
|
||||
if (m_fromBgButton)
|
||||
return;
|
||||
|
||||
base::ScopedValue<bool> lock(m_fromBgButton, true, false);
|
||||
base::ScopedValue lock(m_fromBgButton, true);
|
||||
|
||||
if (!m_fromPalView && !inEditMode())
|
||||
m_paletteView.deselect();
|
||||
|
||||
if (!m_fromPref) {
|
||||
base::ScopedValue<bool> sync(m_fromPref, true, false);
|
||||
base::ScopedValue sync(m_fromPref, true);
|
||||
Preferences::instance().colorBar.bgColor(color);
|
||||
}
|
||||
|
||||
@ -1716,7 +1716,7 @@ void ColorBar::onFixWarningClick(ColorButton* colorButton, ui::Button* warningIc
|
||||
if (inEditMode()) {
|
||||
const int newEntries = palette->size();
|
||||
if (oldEntries != newEntries) {
|
||||
base::ScopedValue<bool> sync(m_fromPref, true, m_fromPref);
|
||||
base::ScopedValue sync(m_fromPref, true);
|
||||
app::Color newIndex = app::Color::fromIndex(newEntries-1);
|
||||
if (colorButton == &m_bgColor)
|
||||
setBgColor(newIndex);
|
||||
|
@ -374,16 +374,14 @@ void ColorPopup::onMakeFixed()
|
||||
|
||||
void ColorPopup::onPaletteViewIndexChange(int index, ui::MouseButton button)
|
||||
{
|
||||
base::ScopedValue<bool> restore(m_insideChange, true,
|
||||
m_insideChange);
|
||||
base::ScopedValue restore(m_insideChange, true);
|
||||
|
||||
setColorWithSignal(app::Color::fromIndex(index), ChangeType);
|
||||
}
|
||||
|
||||
void ColorPopup::onColorSlidersChange(ColorSlidersChangeEvent& ev)
|
||||
{
|
||||
base::ScopedValue<bool> restore(m_insideChange, true,
|
||||
m_insideChange);
|
||||
base::ScopedValue restore(m_insideChange, true);
|
||||
|
||||
setColorWithSignal(ev.color(), DontChangeType);
|
||||
findBestfitIndex(ev.color());
|
||||
@ -391,8 +389,7 @@ void ColorPopup::onColorSlidersChange(ColorSlidersChangeEvent& ev)
|
||||
|
||||
void ColorPopup::onColorHexEntryChange(const app::Color& color)
|
||||
{
|
||||
base::ScopedValue<bool> restore(m_insideChange, true,
|
||||
m_insideChange);
|
||||
base::ScopedValue restore(m_insideChange, true);
|
||||
|
||||
// Disable updating the hex entry so we don't override what the user
|
||||
// is writting in the text field.
|
||||
@ -448,8 +445,7 @@ void ColorPopup::onSimpleColorClick()
|
||||
|
||||
void ColorPopup::onColorTypeClick()
|
||||
{
|
||||
base::ScopedValue<bool> restore(m_insideChange, true,
|
||||
m_insideChange);
|
||||
base::ScopedValue restore(m_insideChange, true);
|
||||
|
||||
if (m_simpleColors)
|
||||
m_simpleColors->deselect();
|
||||
@ -492,8 +488,7 @@ void ColorPopup::onColorTypeClick()
|
||||
|
||||
void ColorPopup::onPaletteChange()
|
||||
{
|
||||
base::ScopedValue<bool> restore(m_insideChange, inEditMode(),
|
||||
m_insideChange);
|
||||
base::ScopedValue restore(m_insideChange, inEditMode());
|
||||
|
||||
setColor(getColor(), DontChangeType);
|
||||
invalidate();
|
||||
|
@ -332,7 +332,7 @@ bool ColorSelector::onProcessMessage(ui::Message* msg)
|
||||
|
||||
app::Color color = getColorByPosition(pos);
|
||||
if (color != app::Color::fromMask()) {
|
||||
base::ScopedValue<bool> switcher(m_lockColor, subColorPicked(), false);
|
||||
base::ScopedValue switcher(m_lockColor, subColorPicked());
|
||||
|
||||
StatusBar::instance()->showColor(0, color);
|
||||
if (hasCapture())
|
||||
|
@ -450,7 +450,7 @@ void ColorSliders::syncRelHsvHslSliders()
|
||||
|
||||
void ColorSliders::onSliderChange(const Channel i)
|
||||
{
|
||||
base::ScopedValue<int> lock(m_lockSlider, i, m_lockSlider);
|
||||
base::ScopedValue<int> lock(m_lockSlider, i);
|
||||
|
||||
updateEntryText(i);
|
||||
onControlChange(i);
|
||||
@ -458,7 +458,7 @@ void ColorSliders::onSliderChange(const Channel i)
|
||||
|
||||
void ColorSliders::onEntryChange(const Channel i)
|
||||
{
|
||||
base::ScopedValue<int> lock(m_lockEntry, i, m_lockEntry);
|
||||
base::ScopedValue<int> lock(m_lockEntry, i);
|
||||
|
||||
// Update the slider related to the changed entry widget.
|
||||
int value = m_items[i].entry->textInt();
|
||||
|
@ -88,7 +88,7 @@ DocumentPreferences& ConfigureTimelinePopup::docPref()
|
||||
void ConfigureTimelinePopup::updateWidgetsFromCurrentSettings()
|
||||
{
|
||||
DocumentPreferences& docPref = this->docPref();
|
||||
base::ScopedValue<bool> lockUpdates(m_lockUpdates, true, false);
|
||||
base::ScopedValue lockUpdates(m_lockUpdates, true);
|
||||
|
||||
auto position = Preferences::instance().general.timelinePosition();
|
||||
int selItem = 2;
|
||||
|
@ -257,7 +257,7 @@ private:
|
||||
return;
|
||||
|
||||
IntEntry::onValueChange();
|
||||
base::ScopedValue<bool> lockFlag(g_updatingFromCode, true, g_updatingFromCode);
|
||||
base::ScopedValue lockFlag(g_updatingFromCode, true);
|
||||
|
||||
Tool* tool = App::instance()->activeTool();
|
||||
Preferences::instance().tool(tool).brush.size(getValue());
|
||||
@ -278,7 +278,7 @@ protected:
|
||||
return;
|
||||
|
||||
IntEntry::onValueChange();
|
||||
base::ScopedValue<bool> lockFlag(g_updatingFromCode, true, g_updatingFromCode);
|
||||
base::ScopedValue lockFlag(g_updatingFromCode, true);
|
||||
|
||||
Tool* tool = App::instance()->activeTool();
|
||||
Preferences::instance().tool(tool).brush.angle(getValue());
|
||||
@ -718,7 +718,7 @@ protected:
|
||||
return;
|
||||
|
||||
IntEntry::onValueChange();
|
||||
base::ScopedValue<bool> lockFlag(g_updatingFromCode, true, g_updatingFromCode);
|
||||
base::ScopedValue lockFlag(g_updatingFromCode, true);
|
||||
|
||||
int newValue = getValue();
|
||||
Preferences& pref = Preferences::instance();
|
||||
@ -1970,7 +1970,7 @@ void ContextBar::updateForTool(tools::Tool* tool)
|
||||
// ContextBar elements.
|
||||
|
||||
const bool oldUpdatingFromCode = g_updatingFromCode;
|
||||
base::ScopedValue<bool> lockFlag(g_updatingFromCode, true, oldUpdatingFromCode);
|
||||
base::ScopedValue lockFlag(g_updatingFromCode, true);
|
||||
|
||||
ToolPreferences* toolPref = nullptr;
|
||||
ToolPreferences::Brush* brushPref = nullptr;
|
||||
|
@ -252,8 +252,7 @@ bool DrawingState::onMouseMove(Editor* editor, MouseMessage* msg)
|
||||
|
||||
// Don't process onScrollChange() messages if autoScroll() changes
|
||||
// the scroll.
|
||||
base::ScopedValue<bool> disableScroll(m_processScrollChange,
|
||||
false, m_processScrollChange);
|
||||
base::ScopedValue disableScroll(m_processScrollChange, false);
|
||||
|
||||
// Update velocity sensor.
|
||||
m_velocity.updateWithDisplayPoint(msg->position());
|
||||
|
@ -778,7 +778,7 @@ bool Timeline::onProcessMessage(Message* msg)
|
||||
break;
|
||||
}
|
||||
case PART_ROW_TEXT: {
|
||||
base::ScopedValue<bool> lock(m_fromTimeline, true, false);
|
||||
base::ScopedValue lock(m_fromTimeline, true);
|
||||
const layer_t old_layer = getLayerIndex(m_layer);
|
||||
const bool selectLayer = (mouseMsg->left() || !isLayerActive(m_clk.layer));
|
||||
const bool selectLayerInCanvas =
|
||||
@ -913,7 +913,7 @@ bool Timeline::onProcessMessage(Message* msg)
|
||||
break;
|
||||
|
||||
case PART_CEL: {
|
||||
base::ScopedValue<bool> lock(m_fromTimeline, true, false);
|
||||
base::ScopedValue lock(m_fromTimeline, true);
|
||||
const layer_t old_layer = getLayerIndex(m_layer);
|
||||
const bool selectCel = (mouseMsg->left()
|
||||
|| !isLayerActive(m_clk.layer)
|
||||
|
@ -30,7 +30,7 @@ UserDataView::UserDataView(Option<bool>& visibility)
|
||||
|
||||
void UserDataView::configureAndSet(const doc::UserData& userData, ui::Grid* parent)
|
||||
{
|
||||
base::ScopedValue<bool> switchSelf(m_selfUpdate, true, m_selfUpdate);
|
||||
base::ScopedValue switchSelf(m_selfUpdate, true);
|
||||
|
||||
if (!m_isConfigured) {
|
||||
// Find the correct hspan to add to an arbitrary grid column count:
|
||||
|
@ -55,7 +55,7 @@ void ZoomEntry::setZoom(const render::Zoom& zoom)
|
||||
|
||||
void ZoomEntry::onValueChange()
|
||||
{
|
||||
base::ScopedValue<bool> lock(m_locked, true, m_locked);
|
||||
base::ScopedValue lock(m_locked, true);
|
||||
IntEntry::onValueChange();
|
||||
|
||||
render::Zoom zoom = render::Zoom::fromLinearScale(getValue());
|
||||
|
@ -221,7 +221,7 @@ void IntEntry::closePopup()
|
||||
|
||||
void IntEntry::onChangeSlider()
|
||||
{
|
||||
base::ScopedValue<bool> lockFlag(m_changeFromSlider, true, false);
|
||||
base::ScopedValue lockFlag(m_changeFromSlider, true);
|
||||
setValue(m_slider.getValue());
|
||||
selectAllText();
|
||||
}
|
||||
|
@ -748,7 +748,7 @@ void Manager::handleWindowZOrder()
|
||||
(!window->isForeground()) &&
|
||||
// If the window is not already the top window of the manager.
|
||||
(window != win_manager->getTopWindow())) {
|
||||
base::ScopedValue<Widget*> scoped(m_lockedWindow, window, nullptr);
|
||||
base::ScopedValue<Widget*> scoped(m_lockedWindow, window);
|
||||
|
||||
window->display()->handleWindowZOrder(window);
|
||||
|
||||
|
@ -348,7 +348,7 @@ void Menu::showPopup(const gfx::Point& pos,
|
||||
// Set the owner menu item to nullptr temporarily in case that we
|
||||
// are re-using a menu from the root menu as popup menu (e.g. like
|
||||
// "animation_menu", that is used when right-cliking a Play button)
|
||||
base::ScopedValue<MenuItem*> restoreOwner(m_menuitem, nullptr, m_menuitem);
|
||||
base::ScopedValue<MenuItem*> restoreOwner(m_menuitem, nullptr);
|
||||
|
||||
// Generally, when we call showPopup() the menu shouldn't contain a
|
||||
// parent menu-box, because we're filtering kMouseDownMessage to
|
||||
|
Loading…
x
Reference in New Issue
Block a user