From 8a3f32b47fd907bea10af50898e4f2174a71a046 Mon Sep 17 00:00:00 2001 From: David Capello Date: Fri, 3 Jul 2020 21:51:46 -0300 Subject: [PATCH] Replace all base::Bind() with lambda functions --- laf | 2 +- src/app/app_menus.cpp | 5 +- src/app/check_update.cpp | 3 +- src/app/commands/cmd_about.cpp | 1 - src/app/commands/cmd_canvas_size.cpp | 15 ++--- src/app/commands/cmd_cel_properties.cpp | 8 +-- src/app/commands/cmd_change_pixel_format.cpp | 16 ++--- src/app/commands/cmd_export_sprite_sheet.cpp | 65 +++++++++---------- src/app/commands/cmd_import_sprite_sheet.cpp | 23 ++++--- src/app/commands/cmd_keyboard_shortcuts.cpp | 21 +++--- src/app/commands/cmd_layer_properties.cpp | 12 ++-- src/app/commands/cmd_mask_by_color.cpp | 13 ++-- src/app/commands/cmd_new_file.cpp | 18 +++-- src/app/commands/cmd_open_file.cpp | 3 +- src/app/commands/cmd_options.cpp | 55 ++++++++-------- src/app/commands/cmd_paste_text.cpp | 7 +- src/app/commands/cmd_save_file.cpp | 1 - src/app/commands/cmd_sprite_properties.cpp | 3 +- src/app/commands/cmd_sprite_size.cpp | 11 ++-- src/app/commands/cmd_undo_history.cpp | 2 +- .../filters/cmd_brightness_contrast.cpp | 7 +- .../filters/cmd_convolution_matrix.cpp | 13 ++-- .../commands/filters/cmd_hue_saturation.cpp | 5 +- src/app/commands/filters/cmd_invert_color.cpp | 3 +- src/app/commands/filters/cmd_outline.cpp | 3 +- .../commands/filters/cmd_replace_color.cpp | 3 +- .../filters/filter_target_buttons.cpp | 3 +- src/app/commands/filters/filter_window.cpp | 4 +- src/app/console.cpp | 12 ++-- src/app/crash/backup_observer.cpp | 3 +- src/app/crash/session.cpp | 1 - src/app/file/webp_format.cpp | 3 +- src/app/res/http_loader.cpp | 3 +- src/app/res/palettes_loader_delegate.cpp | 3 +- src/app/res/resources_loader.cpp | 9 +-- src/app/script/dialog_class.cpp | 1 - src/app/send_crash.cpp | 5 +- src/app/thumbnail_generator.cpp | 5 +- src/app/tools/tool_box.cpp | 1 - src/app/ui/backup_indicator.cpp | 4 +- src/app/ui/brush_popup.cpp | 1 - src/app/ui/button_set.cpp | 1 - src/app/ui/color_bar.cpp | 43 ++++++------ src/app/ui/color_popup.cpp | 3 +- src/app/ui/color_shades.cpp | 1 - src/app/ui/color_sliders.cpp | 7 +- src/app/ui/color_wheel.cpp | 21 +++--- src/app/ui/configure_timeline_popup.cpp | 32 ++++----- src/app/ui/context_bar.cpp | 52 +++++++-------- src/app/ui/data_recovery_view.cpp | 19 +++--- src/app/ui/dithering_selector.cpp | 3 +- src/app/ui/editor/editor.cpp | 23 ++++--- src/app/ui/editor/editor_observers.cpp | 2 +- src/app/ui/editor/editor_view.cpp | 4 +- src/app/ui/editor/moving_pixels_state.cpp | 5 +- src/app/ui/editor/pixels_movement.cpp | 9 ++- src/app/ui/editor/standby_state.cpp | 5 +- src/app/ui/export_file_window.cpp | 35 +++++----- src/app/ui/file_selector.cpp | 23 ++++--- src/app/ui/filename_field.cpp | 25 ++++--- src/app/ui/font_popup.cpp | 9 ++- src/app/ui/home_view.cpp | 7 +- src/app/ui/main_menu_bar.cpp | 3 +- src/app/ui/main_window.cpp | 7 +- src/app/ui/palette_popup.cpp | 10 +-- src/app/ui/palette_view.cpp | 3 +- src/app/ui/palettes_listbox.cpp | 4 +- src/app/ui/popup_window_pin.cpp | 2 +- src/app/ui/preview_editor.cpp | 7 +- src/app/ui/recent_listbox.cpp | 7 +- src/app/ui/resources_listbox.cpp | 4 +- src/app/ui/select_accelerator.cpp | 20 +++--- src/app/ui/skin/skin_theme.cpp | 1 - src/app/ui/slice_window.cpp | 9 ++- src/app/ui/slider2.cpp | 5 +- src/app/ui/status_bar.cpp | 5 +- src/app/ui/timeline/ani_controls.cpp | 5 +- src/app/ui/timeline/timeline.cpp | 5 +- src/app/ui/toolbar.cpp | 5 +- src/app/widget_loader.cpp | 5 +- src/observable | 2 +- src/ui/alert.cpp | 5 +- src/ui/entry.cpp | 7 +- src/updater/check_update.cpp | 1 - 84 files changed, 373 insertions(+), 454 deletions(-) diff --git a/laf b/laf index c50096d9e..04641545a 160000 --- a/laf +++ b/laf @@ -1 +1 @@ -Subproject commit c50096d9e1d259b3e26dbb29bc85423352b284d8 +Subproject commit 04641545aab2dc5b26432279dacae2c3a7e781bc diff --git a/src/app/app_menus.cpp b/src/app/app_menus.cpp index 0f29e0937..051f78d37 100644 --- a/src/app/app_menus.cpp +++ b/src/app/app_menus.cpp @@ -26,7 +26,6 @@ #include "app/ui/main_window.h" #include "app/ui_context.h" #include "app/util/filetoks.h" -#include "base/bind.h" #include "base/fs.h" #include "base/string.h" #include "fmt/format.h" @@ -304,7 +303,7 @@ AppMenus* AppMenus::instance() static AppMenus* instance = NULL; if (!instance) { instance = new AppMenus; - App::instance()->Exit.connect(base::Bind(&destroy_instance, instance)); + App::instance()->Exit.connect([]{ destroy_instance(instance); }); } return instance; } @@ -315,7 +314,7 @@ AppMenus::AppMenus() { m_recentFilesConn = App::instance()->recentFiles()->Changed.connect( - base::Bind(&AppMenus::rebuildRecentList, this)); + [this]{ rebuildRecentList(); }); } AppMenus::~AppMenus() diff --git a/src/app/check_update.cpp b/src/app/check_update.cpp index d5a575fd7..2fe2d7714 100644 --- a/src/app/check_update.cpp +++ b/src/app/check_update.cpp @@ -15,7 +15,6 @@ #include "app/check_update_delegate.h" #include "app/pref/preferences.h" -#include "base/bind.h" #include "base/convert_to.h" #include "base/launcher.h" #include "base/replace_string.h" @@ -127,7 +126,7 @@ void CheckUpdateThreadLauncher::launch() m_delegate->onCheckingUpdates(); m_bgJob.reset(new CheckUpdateBackgroundJob); - m_thread.reset(new base::thread(base::Bind(&CheckUpdateThreadLauncher::checkForUpdates, this))); + m_thread.reset(new base::thread([this]{ checkForUpdates(); })); // Start a timer to monitoring the progress of the background job // executed in "m_thread". The "onMonitoringTick" method will be diff --git a/src/app/commands/cmd_about.cpp b/src/app/commands/cmd_about.cpp index e4e46ee82..0d8e0b262 100644 --- a/src/app/commands/cmd_about.cpp +++ b/src/app/commands/cmd_about.cpp @@ -13,7 +13,6 @@ #include "app/commands/command.h" #include "app/modules/gui.h" #include "app/ui/main_window.h" -#include "base/bind.h" #include "fmt/format.h" #include "ver/info.h" diff --git a/src/app/commands/cmd_canvas_size.cpp b/src/app/commands/cmd_canvas_size.cpp index 78a7f8051..ca7bace9b 100644 --- a/src/app/commands/cmd_canvas_size.cpp +++ b/src/app/commands/cmd_canvas_size.cpp @@ -23,7 +23,6 @@ #include "app/ui/editor/select_box_state.h" #include "app/ui/skin/skin_theme.h" #include "app/ui_context.h" -#include "base/bind.h" #include "base/clamp.h" #include "doc/image.h" #include "doc/mask.h" @@ -75,13 +74,13 @@ public: setTop(0); setBottom(0); - width() ->Change.connect(base::Bind(&CanvasSizeWindow::onSizeChange, this)); - height()->Change.connect(base::Bind(&CanvasSizeWindow::onSizeChange, this)); - dir() ->ItemChange.connect(base::Bind(&CanvasSizeWindow::onDirChange, this));; - left() ->Change.connect(base::Bind(&CanvasSizeWindow::onBorderChange, this)); - right() ->Change.connect(base::Bind(&CanvasSizeWindow::onBorderChange, this)); - top() ->Change.connect(base::Bind(&CanvasSizeWindow::onBorderChange, this)); - bottom()->Change.connect(base::Bind(&CanvasSizeWindow::onBorderChange, this)); + width() ->Change.connect([this]{ onSizeChange(); }); + height()->Change.connect([this]{ onSizeChange(); }); + dir() ->ItemChange.connect([this]{ onDirChange(); }); + left() ->Change.connect([this]{ onBorderChange(); }); + right() ->Change.connect([this]{ onBorderChange(); }); + top() ->Change.connect([this]{ onBorderChange(); }); + bottom()->Change.connect([this]{ onBorderChange(); }); m_editor->setState(m_selectBoxState); diff --git a/src/app/commands/cmd_cel_properties.cpp b/src/app/commands/cmd_cel_properties.cpp index 36b8c6044..43a7e60b7 100644 --- a/src/app/commands/cmd_cel_properties.cpp +++ b/src/app/commands/cmd_cel_properties.cpp @@ -1,4 +1,5 @@ // Aseprite +// Copyright (C) 2020 Igara Studio S.A. // Copyright (C) 2001-2018 David Capello // // This program is distributed under the terms of @@ -21,7 +22,6 @@ #include "app/ui/timeline/timeline.h" #include "app/ui/user_data_popup.h" #include "app/ui_context.h" -#include "base/bind.h" #include "base/mem_utils.h" #include "base/scoped_value.h" #include "doc/cel.h" @@ -50,9 +50,9 @@ public: , m_cel(nullptr) , m_selfUpdate(false) , m_newUserData(false) { - opacity()->Change.connect(base::Bind(&CelPropertiesWindow::onStartTimer, this)); - userData()->Click.connect(base::Bind(&CelPropertiesWindow::onPopupUserData, this)); - m_timer.Tick.connect(base::Bind(&CelPropertiesWindow::onCommitChange, this)); + opacity()->Change.connect([this]{ onStartTimer(); }); + userData()->Click.connect([this]{ onPopupUserData(); }); + m_timer.Tick.connect([this]{ onCommitChange(); }); remapWindow(); centerWindow(); diff --git a/src/app/commands/cmd_change_pixel_format.cpp b/src/app/commands/cmd_change_pixel_format.cpp index b7eefae82..59c54b63b 100644 --- a/src/app/commands/cmd_change_pixel_format.cpp +++ b/src/app/commands/cmd_change_pixel_format.cpp @@ -28,7 +28,6 @@ #include "app/ui/editor/editor_render.h" #include "app/ui/rgbmap_algorithm_selector.h" #include "app/ui/skin/skin_theme.h" -#include "base/bind.h" #include "base/thread.h" #include "doc/image.h" #include "doc/layer.h" @@ -240,12 +239,9 @@ public: advanced()->setVisible(adv); // Signals - m_ditheringSelector->Change.connect( - base::Bind(&ColorModeWindow::onIndexParamChange, this)); - m_mapAlgorithmSelector->Change.connect( - base::Bind(&ColorModeWindow::onIndexParamChange, this)); - factor()->Change.connect( - base::Bind(&ColorModeWindow::onIndexParamChange, this)); + m_ditheringSelector->Change.connect([this]{ onIndexParamChange(); }); + m_mapAlgorithmSelector->Change.connect([this]{ onIndexParamChange(); }); + factor()->Change.connect([this]{ onIndexParamChange(); }); advancedCheck()->Click.connect( [this](ui::Event&){ @@ -264,15 +260,15 @@ public: if (from != IMAGE_GRAYSCALE) { colorMode()->addChild(new ConversionItem(IMAGE_GRAYSCALE)); - toGrayCombobox()->Change.connect(base::Bind(&ColorModeWindow::onToGrayChange, this)); + toGrayCombobox()->Change.connect([this]{ onToGrayChange(); }); } colorModeView()->setMinSize( colorModeView()->sizeHint() + colorMode()->sizeHint()); - colorMode()->Change.connect(base::Bind(&ColorModeWindow::onChangeColorMode, this)); - m_timer.Tick.connect(base::Bind(&ColorModeWindow::onMonitorProgress, this)); + colorMode()->Change.connect([this]{ onChangeColorMode(); }); + m_timer.Tick.connect([this]{ onMonitorProgress(); }); progress()->setReadOnly(true); diff --git a/src/app/commands/cmd_export_sprite_sheet.cpp b/src/app/commands/cmd_export_sprite_sheet.cpp index 8eadf2d1c..04ea2e988 100644 --- a/src/app/commands/cmd_export_sprite_sheet.cpp +++ b/src/app/commands/cmd_export_sprite_sheet.cpp @@ -1,5 +1,5 @@ // Aseprite -// Copyright (C) 2019 Igara Studio S.A. +// Copyright (C) 2019-2020 Igara Studio S.A. // Copyright (C) 2001-2018 David Capello // // This program is distributed under the terms of @@ -32,7 +32,6 @@ #include "app/ui/optional_alert.h" #include "app/ui/status_bar.h" #include "app/ui/timeline/timeline.h" -#include "base/bind.h" #include "base/clamp.h" #include "base/convert_to.h" #include "base/fs.h" @@ -318,11 +317,11 @@ public: , m_executionID(0) , m_filenameFormat(params.filenameFormat()) { - sectionTabs()->ItemChange.connect(base::Bind(&ExportSpriteSheetWindow::onChangeSection, this)); - expandSections()->Click.connect(base::Bind(&ExportSpriteSheetWindow::onExpandSections, this)); - closeSpriteSection()->Click.connect(base::Bind(&ExportSpriteSheetWindow::onCloseSection, this, kSectionSprite)); - closeBordersSection()->Click.connect(base::Bind(&ExportSpriteSheetWindow::onCloseSection, this, kSectionBorders)); - closeOutputSection()->Click.connect(base::Bind(&ExportSpriteSheetWindow::onCloseSection, this, kSectionOutput)); + sectionTabs()->ItemChange.connect([this]{ onChangeSection(); }); + expandSections()->Click.connect([this]{ onExpandSections(); }); + closeSpriteSection()->Click.connect([this]{ onCloseSection(kSectionSprite); }); + closeBordersSection()->Click.connect([this]{ onCloseSection(kSectionBorders); }); + closeOutputSection()->Click.connect([this]{ onCloseSection(kSectionOutput); }); static_assert( (int)app::SpriteSheetType::None == 0 && @@ -430,32 +429,32 @@ public: m_dataFilename == kSpecifiedFilename) m_dataFilename = base + ".json"; - exportButton()->Click.connect(base::Bind(&ExportSpriteSheetWindow::onExport, this)); - sheetType()->Change.connect(&ExportSpriteSheetWindow::onSheetTypeChange, this); - constraintType()->Change.connect(&ExportSpriteSheetWindow::onConstraintTypeChange, this); - widthConstraint()->Change.connect(&ExportSpriteSheetWindow::generatePreview, this); - heightConstraint()->Change.connect(&ExportSpriteSheetWindow::generatePreview, this); - borderPadding()->Change.connect(base::Bind(&ExportSpriteSheetWindow::generatePreview, this)); - shapePadding()->Change.connect(base::Bind(&ExportSpriteSheetWindow::generatePreview, this)); - innerPadding()->Change.connect(base::Bind(&ExportSpriteSheetWindow::generatePreview, this)); - extrudeEnabled()->Click.connect(base::Bind(&ExportSpriteSheetWindow::generatePreview, this)); - mergeDups()->Click.connect(base::Bind(&ExportSpriteSheetWindow::generatePreview, this)); - ignoreEmpty()->Click.connect(base::Bind(&ExportSpriteSheetWindow::generatePreview, this)); - imageEnabled()->Click.connect(base::Bind(&ExportSpriteSheetWindow::onImageEnabledChange, this)); - imageFilename()->Click.connect(base::Bind(&ExportSpriteSheetWindow::onImageFilename, this)); - dataEnabled()->Click.connect(base::Bind(&ExportSpriteSheetWindow::onDataEnabledChange, this)); - dataFilename()->Click.connect(base::Bind(&ExportSpriteSheetWindow::onDataFilename, this)); - trimSpriteEnabled()->Click.connect(base::Bind(&ExportSpriteSheetWindow::onTrimEnabledChange, this)); - trimEnabled()->Click.connect(base::Bind(&ExportSpriteSheetWindow::onTrimEnabledChange, this)); - gridTrimEnabled()->Click.connect(base::Bind(&ExportSpriteSheetWindow::generatePreview, this)); - layers()->Change.connect(base::Bind(&ExportSpriteSheetWindow::generatePreview, this)); - splitLayers()->Click.connect(base::Bind(&ExportSpriteSheetWindow::onSplitLayersOrFrames, this)); - splitTags()->Click.connect(base::Bind(&ExportSpriteSheetWindow::onSplitLayersOrFrames, this)); - frames()->Change.connect(base::Bind(&ExportSpriteSheetWindow::generatePreview, this)); - dataFilenameFormat()->Change.connect(base::Bind(&ExportSpriteSheetWindow::onDataFilenameFormatChange, this)); - openGenerated()->Click.connect(base::Bind(&ExportSpriteSheetWindow::onOpenGeneratedChange, this)); - preview()->Click.connect(base::Bind(&ExportSpriteSheetWindow::generatePreview, this)); - m_genTimer.Tick.connect(base::Bind(&ExportSpriteSheetWindow::onGenTimerTick, this)); + exportButton()->Click.connect([this]{ onExport(); }); + sheetType()->Change.connect([this]{ onSheetTypeChange(); }); + constraintType()->Change.connect([this]{ onConstraintTypeChange(); }); + widthConstraint()->Change.connect([this]{ generatePreview(); }); + heightConstraint()->Change.connect([this]{ generatePreview(); }); + borderPadding()->Change.connect([this]{ generatePreview(); }); + shapePadding()->Change.connect([this]{ generatePreview(); }); + innerPadding()->Change.connect([this]{ generatePreview(); }); + extrudeEnabled()->Click.connect([this]{ generatePreview(); }); + mergeDups()->Click.connect([this]{ generatePreview(); }); + ignoreEmpty()->Click.connect([this]{ generatePreview(); }); + imageEnabled()->Click.connect([this]{ onImageEnabledChange(); }); + imageFilename()->Click.connect([this]{ onImageFilename(); }); + dataEnabled()->Click.connect([this]{ onDataEnabledChange(); }); + dataFilename()->Click.connect([this]{ onDataFilename(); }); + trimSpriteEnabled()->Click.connect([this]{ onTrimEnabledChange(); }); + trimEnabled()->Click.connect([this]{ onTrimEnabledChange(); }); + gridTrimEnabled()->Click.connect([this]{ generatePreview(); }); + layers()->Change.connect([this]{ generatePreview(); }); + splitLayers()->Click.connect([this]{ onSplitLayersOrFrames(); }); + splitTags()->Click.connect([this]{ onSplitLayersOrFrames(); }); + frames()->Change.connect([this]{ generatePreview(); }); + dataFilenameFormat()->Change.connect([this]{ onDataFilenameFormatChange(); }); + openGenerated()->Click.connect([this]{ onOpenGeneratedChange(); }); + preview()->Click.connect([this]{ generatePreview(); }); + m_genTimer.Tick.connect([this]{ onGenTimerTick(); }); // Select tabs { diff --git a/src/app/commands/cmd_import_sprite_sheet.cpp b/src/app/commands/cmd_import_sprite_sheet.cpp index 8386df507..9a4b2700d 100644 --- a/src/app/commands/cmd_import_sprite_sheet.cpp +++ b/src/app/commands/cmd_import_sprite_sheet.cpp @@ -1,5 +1,5 @@ // Aseprite -// Copyright (C) 2019 Igara Studio S.A. +// Copyright (C) 2019-2020 Igara Studio S.A. // Copyright (C) 2001-2018 David Capello // // This program is distributed under the terms of @@ -29,7 +29,6 @@ #include "app/ui/editor/select_box_state.h" #include "app/ui/editor/standby_state.h" #include "app/ui/workspace.h" -#include "base/bind.h" #include "doc/cel.h" #include "doc/image.h" #include "doc/layer.h" @@ -69,16 +68,16 @@ public: sheetType()->addItem("By Columns"); sheetType()->setSelectedItemIndex((int)app::SpriteSheetType::Rows-1); - sheetType()->Change.connect(base::Bind(&ImportSpriteSheetWindow::onSheetTypeChange, this)); - x()->Change.connect(base::Bind(&ImportSpriteSheetWindow::onEntriesChange, this)); - y()->Change.connect(base::Bind(&ImportSpriteSheetWindow::onEntriesChange, this)); - width()->Change.connect(base::Bind(&ImportSpriteSheetWindow::onEntriesChange, this)); - height()->Change.connect(base::Bind(&ImportSpriteSheetWindow::onEntriesChange, this)); - paddingEnabled()->Click.connect(base::Bind(&ImportSpriteSheetWindow::onPaddingEnabledChange, this)); - horizontalPadding()->Change.connect(base::Bind(&ImportSpriteSheetWindow::onEntriesChange, this)); - verticalPadding()->Change.connect(base::Bind(&ImportSpriteSheetWindow::onEntriesChange, this)); - partialTiles()->Click.connect(base::Bind(&ImportSpriteSheetWindow::onEntriesChange, this)); - selectFile()->Click.connect(base::Bind(&ImportSpriteSheetWindow::onSelectFile, this)); + sheetType()->Change.connect([this]{ onSheetTypeChange(); }); + x()->Change.connect([this]{ onEntriesChange(); }); + y()->Change.connect([this]{ onEntriesChange(); }); + width()->Change.connect([this]{ onEntriesChange(); }); + height()->Change.connect([this]{ onEntriesChange(); }); + paddingEnabled()->Click.connect([this]{ onPaddingEnabledChange(); }); + horizontalPadding()->Change.connect([this]{ onEntriesChange(); }); + verticalPadding()->Change.connect([this]{ onEntriesChange(); }); + partialTiles()->Click.connect([this]{ onEntriesChange(); }); + selectFile()->Click.connect([this]{ onSelectFile(); }); remapWindow(); centerWindow(); diff --git a/src/app/commands/cmd_keyboard_shortcuts.cpp b/src/app/commands/cmd_keyboard_shortcuts.cpp index 81cdf4e89..9b887d85f 100644 --- a/src/app/commands/cmd_keyboard_shortcuts.cpp +++ b/src/app/commands/cmd_keyboard_shortcuts.cpp @@ -26,7 +26,6 @@ #include "app/ui/select_accelerator.h" #include "app/ui/separator_in_view.h" #include "app/ui/skin/skin_theme.h" -#include "base/bind.h" #include "base/fs.h" #include "base/scoped_value.h" #include "base/split_string.h" @@ -376,13 +375,13 @@ private: m_changeConn = obs::connection(); m_changeButton.reset(new Button("")); - m_changeConn = m_changeButton->Click.connect(base::Bind(&KeyItem::onChangeAccel, this, i)); + m_changeConn = m_changeButton->Click.connect([this, i]{ onChangeAccel(i); }); m_changeButton->setStyle(SkinTheme::instance()->styles.miniButton()); addChild(m_changeButton.get()); m_deleteConn = obs::connection(); m_deleteButton.reset(new Button("")); - m_deleteConn = m_deleteButton->Click.connect(base::Bind(&KeyItem::onDeleteAccel, this, i)); + m_deleteConn = m_deleteButton->Click.connect([this, i]{ onDeleteAccel(i); }); m_deleteButton->setStyle(SkinTheme::instance()->styles.miniButton()); addChild(m_deleteButton.get()); @@ -409,7 +408,7 @@ private: (!m_menuitem || m_menuitem->getCommand())) { m_addConn = obs::connection(); m_addButton.reset(new Button("")); - m_addConn = m_addButton->Click.connect(base::Bind(&KeyItem::onAddAccel, this)); + m_addConn = m_addButton->Click.connect([this]{ onAddAccel(); }); m_addButton->setStyle(SkinTheme::instance()->styles.miniButton()); addChild(m_addButton.get()); @@ -511,14 +510,14 @@ public: onWheelBehaviorChange(); - wheelBehavior()->ItemChange.connect(base::Bind(&KeyboardShortcutsWindow::onWheelBehaviorChange, this)); - wheelZoom()->Click.connect(base::Bind(&KeyboardShortcutsWindow::onWheelZoomChange, this)); + wheelBehavior()->ItemChange.connect([this]{ onWheelBehaviorChange(); }); + wheelZoom()->Click.connect([this]{ onWheelZoomChange(); }); - search()->Change.connect(base::Bind(&KeyboardShortcutsWindow::onSearchChange, this)); - section()->Change.connect(base::Bind(&KeyboardShortcutsWindow::onSectionChange, this)); - importButton()->Click.connect(base::Bind(&KeyboardShortcutsWindow::onImport, this)); - exportButton()->Click.connect(base::Bind(&KeyboardShortcutsWindow::onExport, this)); - resetButton()->Click.connect(base::Bind(&KeyboardShortcutsWindow::onReset, this)); + search()->Change.connect([this]{ onSearchChange(); }); + section()->Change.connect([this]{ onSectionChange(); }); + importButton()->Click.connect([this]{ onImport(); }); + exportButton()->Click.connect([this]{ onExport(); }); + resetButton()->Click.connect([this]{ onReset(); }); fillAllLists(); diff --git a/src/app/commands/cmd_layer_properties.cpp b/src/app/commands/cmd_layer_properties.cpp index 5b7009fd7..64086b05b 100644 --- a/src/app/commands/cmd_layer_properties.cpp +++ b/src/app/commands/cmd_layer_properties.cpp @@ -1,4 +1,5 @@ // Aseprite +// Copyright (C) 2020 Igara Studio S.A. // Copyright (C) 2001-2018 David Capello // // This program is distributed under the terms of @@ -24,7 +25,6 @@ #include "app/ui/timeline/timeline.h" #include "app/ui/user_data_popup.h" #include "app/ui_context.h" -#include "base/bind.h" #include "base/scoped_value.h" #include "doc/image.h" #include "doc/layer.h" @@ -99,11 +99,11 @@ public: mode()->addItem(new BlendModeItem("Color", doc::BlendMode::HSL_COLOR)); mode()->addItem(new BlendModeItem("Luminosity", doc::BlendMode::HSL_LUMINOSITY)); - name()->Change.connect(base::Bind(&LayerPropertiesWindow::onStartTimer, this)); - mode()->Change.connect(base::Bind(&LayerPropertiesWindow::onStartTimer, this)); - opacity()->Change.connect(base::Bind(&LayerPropertiesWindow::onStartTimer, this)); - m_timer.Tick.connect(base::Bind(&LayerPropertiesWindow::onCommitChange, this)); - userData()->Click.connect(base::Bind(&LayerPropertiesWindow::onPopupUserData, this)); + name()->Change.connect([this]{ onStartTimer(); }); + mode()->Change.connect([this]{ onStartTimer(); }); + opacity()->Change.connect([this]{ onStartTimer(); }); + m_timer.Tick.connect([this]{ onCommitChange(); }); + userData()->Click.connect([this]{ onPopupUserData(); }); remapWindow(); centerWindow(); diff --git a/src/app/commands/cmd_mask_by_color.cpp b/src/app/commands/cmd_mask_by_color.cpp index 2120b8eaa..5c25ec729 100644 --- a/src/app/commands/cmd_mask_by_color.cpp +++ b/src/app/commands/cmd_mask_by_color.cpp @@ -24,7 +24,6 @@ #include "app/ui/color_bar.h" #include "app/ui/color_button.h" #include "app/ui/selection_mode_field.h" -#include "base/bind.h" #include "base/chrono.h" #include "base/convert_to.h" #include "base/scoped_value.h" @@ -136,13 +135,13 @@ void MaskByColorCommand::onExecute(Context* context) if (get_config_bool("MaskColor", "Preview", true)) m_checkPreview->setSelected(true); - button_ok->Click.connect(base::Bind(&Window::closeWindow, m_window, button_ok)); - button_cancel->Click.connect(base::Bind(&Window::closeWindow, m_window, button_cancel)); + button_ok->Click.connect([this, button_ok]{ m_window->closeWindow(button_ok); }); + button_cancel->Click.connect([this, button_cancel]{ m_window->closeWindow(button_cancel); }); - m_buttonColor->Change.connect(base::Bind(&MaskByColorCommand::maskPreview, this, base::Ref(reader))); - m_sliderTolerance->Change.connect(base::Bind(&MaskByColorCommand::maskPreview, this, base::Ref(reader))); - m_checkPreview->Click.connect(base::Bind(&MaskByColorCommand::maskPreview, this, base::Ref(reader))); - m_selMode->ModeChange.connect(base::Bind(&MaskByColorCommand::maskPreview, this, base::Ref(reader))); + m_buttonColor->Change.connect([&]{ maskPreview(reader); }); + m_sliderTolerance->Change.connect([&]{ maskPreview(reader); }); + m_checkPreview->Click.connect([&]{ maskPreview(reader); }); + m_selMode->ModeChange.connect([&]{ maskPreview(reader); }); button_ok->setFocusMagnet(true); m_buttonColor->setExpansive(true); diff --git a/src/app/commands/cmd_new_file.cpp b/src/app/commands/cmd_new_file.cpp index b3f4d60bf..c5a914033 100644 --- a/src/app/commands/cmd_new_file.cpp +++ b/src/app/commands/cmd_new_file.cpp @@ -27,7 +27,6 @@ #include "app/util/clipboard.h" #include "app/util/clipboard.h" #include "app/util/pixel_ratio.h" -#include "base/bind.h" #include "base/clamp.h" #include "doc/cel.h" #include "doc/image.h" @@ -155,16 +154,15 @@ void NewFileCommand::onExecute(Context* ctx) bool advanced = pref.newFile.advanced(); window.advancedCheck()->setSelected(advanced); window.advancedCheck()->Click.connect( - base::Bind( - [&]{ - gfx::Rect bounds = window.bounds(); - window.advanced()->setVisible(window.advancedCheck()->isSelected()); - window.setBounds(gfx::Rect(window.bounds().origin(), - window.sizeHint())); - window.layout(); + [&]{ + gfx::Rect bounds = window.bounds(); + window.advanced()->setVisible(window.advancedCheck()->isSelected()); + window.setBounds(gfx::Rect(window.bounds().origin(), + window.sizeHint())); + window.layout(); - window.manager()->invalidateRect(bounds); - })); + window.manager()->invalidateRect(bounds); + }); window.advanced()->setVisible(advanced); if (advanced) window.pixelRatio()->setValue(pref.newFile.pixelRatio()); diff --git a/src/app/commands/cmd_open_file.cpp b/src/app/commands/cmd_open_file.cpp index 3f3f9d302..a31409921 100644 --- a/src/app/commands/cmd_open_file.cpp +++ b/src/app/commands/cmd_open_file.cpp @@ -1,5 +1,5 @@ // Aseprite -// Copyright (C) 2019 Igara Studio S.A. +// Copyright (C) 2019-2020 Igara Studio S.A. // Copyright (C) 2001-2018 David Capello // // This program is distributed under the terms of @@ -25,7 +25,6 @@ #include "app/recent_files.h" #include "app/ui/status_bar.h" #include "app/ui_context.h" -#include "base/bind.h" #include "base/fs.h" #include "base/thread.h" #include "doc/sprite.h" diff --git a/src/app/commands/cmd_options.cpp b/src/app/commands/cmd_options.cpp index 66ac2b40b..3923d930c 100644 --- a/src/app/commands/cmd_options.cpp +++ b/src/app/commands/cmd_options.cpp @@ -31,7 +31,6 @@ #include "app/ui/rgbmap_algorithm_selector.h" #include "app/ui/separator_in_view.h" #include "app/ui/skin/skin_theme.h" -#include "base/bind.h" #include "base/clamp.h" #include "base/convert_to.h" #include "base/fs.h" @@ -203,7 +202,7 @@ public: , m_restoreScreenScaling(m_pref.general.screenScale()) , m_restoreUIScaling(m_pref.general.uiScale()) { - sectionListbox()->Change.connect(base::Bind(&OptionsWindow::onChangeSection, this)); + sectionListbox()->Change.connect([this]{ onChangeSection(); }); // Default extension to save files fillExtensionsCombobox(defaultExtension(), m_pref.saveFile.defaultExtension()); @@ -213,15 +212,15 @@ public: // Number of recent items recentFiles()->setValue(m_pref.general.recentItems()); - clearRecentFiles()->Click.connect(base::Bind(&OptionsWindow::onClearRecentFiles, this)); + clearRecentFiles()->Click.connect([this]{ onClearRecentFiles(); }); // Template item for active display color profiles m_templateTextForDisplayCS = windowCs()->getItem(2)->text(); windowCs()->deleteItem(2); // Color profiles - resetColorManagement()->Click.connect(base::Bind(&OptionsWindow::onResetColorManagement, this)); - colorManagement()->Click.connect(base::Bind(&OptionsWindow::onColorManagement, this)); + resetColorManagement()->Click.connect([this]{ onResetColorManagement(); }); + colorManagement()->Click.connect([this]{ onColorManagement(); }); { os::instance()->listColorSpaces(m_colorSpaces); for (auto& cs : m_colorSpaces) { @@ -237,7 +236,7 @@ public: } // Alerts - resetAlerts()->Click.connect(base::Bind(&OptionsWindow::onResetAlerts, this)); + resetAlerts()->Click.connect([this]{ onResetAlerts(); }); // Cursor paintingCursorType()->setSelectedItemIndex(int(m_pref.cursor.paintingCursorType())); @@ -251,7 +250,7 @@ public: cursorColorType()->setSelectedItemIndex(1); cursorColor()->setVisible(true); } - cursorColorType()->Change.connect(base::Bind(&OptionsWindow::onCursorColorType, this)); + cursorColorType()->Change.connect([this]{ onCursorColorType(); }); // Brush preview brushPreview()->setSelectedItemIndex( @@ -335,7 +334,7 @@ public: int(os::Capabilities::CustomNativeMouseCursor)) != 0) { if (m_pref.cursor.useNativeCursor()) nativeCursor()->setSelected(true); - nativeCursor()->Click.connect(base::Bind(&OptionsWindow::onNativeCursorChange, this)); + nativeCursor()->Click.connect([this]{ onNativeCursorChange(); }); cursorScale()->setSelectedItemIndex( cursorScale()->findItemIndexByValue( @@ -423,11 +422,11 @@ public: if (context->activeDocument()) { bgScope()->addItem("Background for the Active Document"); bgScope()->setSelectedItemIndex(1); - bgScope()->Change.connect(base::Bind(&OptionsWindow::onChangeBgScope, this)); + bgScope()->Change.connect([this]{ onChangeBgScope(); }); gridScope()->addItem("Grid for the Active Document"); gridScope()->setSelectedItemIndex(1); - gridScope()->Change.connect(base::Bind(&OptionsWindow::onChangeGridScope, this)); + gridScope()->Change.connect([this]{ onChangeGridScope(); }); } selectScalingItems(); @@ -482,21 +481,21 @@ public: checkedBgSize()->addItem("2x2"); checkedBgSize()->addItem("1x1"); checkedBgSize()->addItem("Custom"); - checkedBgSize()->Change.connect(base::Bind(&OptionsWindow::onCheckedBgSizeChange, this)); + checkedBgSize()->Change.connect([this]{ onCheckedBgSizeChange(); }); // Reset buttons - resetBg()->Click.connect(base::Bind(&OptionsWindow::onResetBg, this)); - resetGrid()->Click.connect(base::Bind(&OptionsWindow::onResetGrid, this)); + resetBg()->Click.connect([this]{ onResetBg(); }); + resetGrid()->Click.connect([this]{ onResetGrid(); }); // Links - locateFile()->Click.connect(base::Bind(&OptionsWindow::onLocateConfigFile, this)); + locateFile()->Click.connect([this]{ onLocateConfigFile(); }); if (!App::instance()->memoryDumpFilename().empty()) - locateCrashFolder()->Click.connect(base::Bind(&OptionsWindow::onLocateCrashFolder, this)); + locateCrashFolder()->Click.connect([this]{ onLocateCrashFolder(); }); else locateCrashFolder()->setVisible(false); // Undo preferences - limitUndo()->Click.connect(base::Bind(&OptionsWindow::onLimitUndoCheck, this)); + limitUndo()->Click.connect([this]{ onLimitUndoCheck(); }); limitUndo()->setSelected(m_pref.undo.sizeLimit() != 0); onLimitUndoCheck(); @@ -504,20 +503,20 @@ public: undoAllowNonlinearHistory()->setSelected(m_pref.undo.allowNonlinearHistory()); // Theme buttons - themeList()->Change.connect(base::Bind(&OptionsWindow::onThemeChange, this)); - themeList()->DoubleClickItem.connect(base::Bind(&OptionsWindow::onSelectTheme, this)); - selectTheme()->Click.connect(base::Bind(&OptionsWindow::onSelectTheme, this)); - openThemeFolder()->Click.connect(base::Bind(&OptionsWindow::onOpenThemeFolder, this)); + themeList()->Change.connect([this]{ onThemeChange(); }); + themeList()->DoubleClickItem.connect([this]{ onSelectTheme(); }); + selectTheme()->Click.connect([this]{ onSelectTheme(); }); + openThemeFolder()->Click.connect([this]{ onOpenThemeFolder(); }); // Extensions buttons - extensionsList()->Change.connect(base::Bind(&OptionsWindow::onExtensionChange, this)); - addExtension()->Click.connect(base::Bind(&OptionsWindow::onAddExtension, this)); - disableExtension()->Click.connect(base::Bind(&OptionsWindow::onDisableExtension, this)); - uninstallExtension()->Click.connect(base::Bind(&OptionsWindow::onUninstallExtension, this)); - openExtensionFolder()->Click.connect(base::Bind(&OptionsWindow::onOpenExtensionFolder, this)); + extensionsList()->Change.connect([this]{ onExtensionChange(); }); + addExtension()->Click.connect([this]{ onAddExtension(); }); + disableExtension()->Click.connect([this]{ onDisableExtension(); }); + uninstallExtension()->Click.connect([this]{ onUninstallExtension(); }); + openExtensionFolder()->Click.connect([this]{ onOpenExtensionFolder(); }); // Apply button - buttonApply()->Click.connect(base::Bind(&OptionsWindow::onApply, this)); + buttonApply()->Click.connect([this]{ onApply(); }); onChangeBgScope(); onChangeGridScope(); @@ -526,12 +525,12 @@ public: // Refill languages combobox when extensions are enabled/disabled m_extLanguagesChanges = App::instance()->extensions().LanguagesChange.connect( - base::Bind(&OptionsWindow::refillLanguages, this)); + [this]{ refillLanguages(); }); // Reload themes when extensions are enabled/disabled m_extThemesChanges = App::instance()->extensions().ThemesChange.connect( - base::Bind(&OptionsWindow::reloadThemes, this)); + [this]{ reloadThemes(); }); } bool ok() { diff --git a/src/app/commands/cmd_paste_text.cpp b/src/app/commands/cmd_paste_text.cpp index 61889cb49..fdbc7fb70 100644 --- a/src/app/commands/cmd_paste_text.cpp +++ b/src/app/commands/cmd_paste_text.cpp @@ -21,7 +21,6 @@ #include "app/ui/font_popup.h" #include "app/ui/timeline/timeline.h" #include "app/util/freetype_utils.h" -#include "base/bind.h" #include "base/clamp.h" #include "base/fs.h" #include "base/string.h" @@ -69,8 +68,8 @@ public: updateFontFaceButton(); fontSize()->setTextf("%d", size); - fontFace()->Click.connect(base::Bind(&PasteTextWindow::onSelectFontFile, this)); - fontFace()->DropDownClick.connect(base::Bind(&PasteTextWindow::onSelectSystemFont, this)); + fontFace()->Click.connect([this]{ onSelectFontFile(); }); + fontFace()->DropDownClick.connect([this]{ onSelectSystemFont(); }); fontColor()->setColor(color); this->antialias()->setSelected(antialias); } @@ -116,7 +115,7 @@ private: try { m_fontPopup.reset(new FontPopup()); m_fontPopup->Load.connect(&PasteTextWindow::setFontFace, this); - m_fontPopup->Close.connect(base::Bind(&PasteTextWindow::onCloseFontPopup, this)); + m_fontPopup->Close.connect([this]{ onCloseFontPopup(); }); } catch (const std::exception& ex) { Console::showException(ex); diff --git a/src/app/commands/cmd_save_file.cpp b/src/app/commands/cmd_save_file.cpp index 16e79d132..2253a55b0 100644 --- a/src/app/commands/cmd_save_file.cpp +++ b/src/app/commands/cmd_save_file.cpp @@ -33,7 +33,6 @@ #include "app/ui/layer_frame_comboboxes.h" #include "app/ui/optional_alert.h" #include "app/ui/status_bar.h" -#include "base/bind.h" #include "base/convert_to.h" #include "base/fs.h" #include "base/scoped_value.h" diff --git a/src/app/commands/cmd_sprite_properties.cpp b/src/app/commands/cmd_sprite_properties.cpp index b793859d6..21587c2d7 100644 --- a/src/app/commands/cmd_sprite_properties.cpp +++ b/src/app/commands/cmd_sprite_properties.cpp @@ -1,5 +1,5 @@ // Aseprite -// Copyright (C) 2018 Igara Studio S.A. +// Copyright (C) 2018-2020 Igara Studio S.A. // Copyright (C) 2001-2018 David Capello // // This program is distributed under the terms of @@ -22,7 +22,6 @@ #include "app/tx.h" #include "app/ui/color_button.h" #include "app/util/pixel_ratio.h" -#include "base/bind.h" #include "base/mem_utils.h" #include "doc/image.h" #include "doc/palette.h" diff --git a/src/app/commands/cmd_sprite_size.cpp b/src/app/commands/cmd_sprite_size.cpp index 07cd59c1b..98dd7aa6a 100644 --- a/src/app/commands/cmd_sprite_size.cpp +++ b/src/app/commands/cmd_sprite_size.cpp @@ -20,7 +20,6 @@ #include "app/modules/palettes.h" #include "app/sprite_job.h" #include "app/util/resize_image.h" -#include "base/bind.h" #include "base/clamp.h" #include "base/convert_to.h" #include "doc/algorithm/resize_image.h" @@ -184,11 +183,11 @@ protected: class SpriteSizeWindow : public app::gen::SpriteSize { public: SpriteSizeWindow(Context* ctx, const SpriteSizeParams& params) : m_ctx(ctx) { - lockRatio()->Click.connect(base::Bind(&SpriteSizeWindow::onLockRatioClick, this)); - widthPx()->Change.connect(base::Bind(&SpriteSizeWindow::onWidthPxChange, this)); - heightPx()->Change.connect(base::Bind(&SpriteSizeWindow::onHeightPxChange, this)); - widthPerc()->Change.connect(base::Bind(&SpriteSizeWindow::onWidthPercChange, this)); - heightPerc()->Change.connect(base::Bind(&SpriteSizeWindow::onHeightPercChange, this)); + lockRatio()->Click.connect([this]{ onLockRatioClick(); }); + widthPx()->Change.connect([this]{ onWidthPxChange(); }); + heightPx()->Change.connect([this]{ onHeightPxChange(); }); + widthPerc()->Change.connect([this]{ onWidthPercChange(); }); + heightPerc()->Change.connect([this]{ onHeightPercChange(); }); widthPx()->setTextf("%d", params.width()); heightPx()->setTextf("%d", params.height()); diff --git a/src/app/commands/cmd_undo_history.cpp b/src/app/commands/cmd_undo_history.cpp index eeab08423..8da4e2204 100644 --- a/src/app/commands/cmd_undo_history.cpp +++ b/src/app/commands/cmd_undo_history.cpp @@ -1,4 +1,5 @@ // Aseprite +// Copyright (C) 2020 Igara Studio S.A. // Copyright (C) 2015-2018 David Capello // // This program is distributed under the terms of @@ -21,7 +22,6 @@ #include "app/modules/gui.h" #include "app/modules/palettes.h" #include "app/site.h" -#include "base/bind.h" #include "base/mem_utils.h" #include "ui/listitem.h" #include "ui/message.h" diff --git a/src/app/commands/filters/cmd_brightness_contrast.cpp b/src/app/commands/filters/cmd_brightness_contrast.cpp index 613477160..b7dcc4665 100644 --- a/src/app/commands/filters/cmd_brightness_contrast.cpp +++ b/src/app/commands/filters/cmd_brightness_contrast.cpp @@ -1,5 +1,5 @@ // Aseprite -// Copyright (C) 2019 Igara Studio S.A. +// Copyright (C) 2019-2020 Igara Studio S.A. // Copyright (C) 2017 David Capello // // This program is distributed under the terms of @@ -21,7 +21,6 @@ #include "app/ui/color_button.h" #include "app/ui/color_sliders.h" #include "app/ui/slider2.h" -#include "base/bind.h" #include "doc/image.h" #include "doc/mask.h" #include "doc/sprite.h" @@ -59,8 +58,8 @@ public: getContainer()->addChild(&m_brightness); getContainer()->addChild(new ui::Label("Contrast:")); getContainer()->addChild(&m_contrast); - m_brightness.Change.connect(base::Bind(&BrightnessContrastWindow::onChange, this)); - m_contrast.Change.connect(base::Bind(&BrightnessContrastWindow::onChange, this)); + m_brightness.Change.connect([this]{ onChange(); }); + m_contrast.Change.connect([this]{ onChange(); }); } private: diff --git a/src/app/commands/filters/cmd_convolution_matrix.cpp b/src/app/commands/filters/cmd_convolution_matrix.cpp index 4edbce22a..b1f3340d5 100644 --- a/src/app/commands/filters/cmd_convolution_matrix.cpp +++ b/src/app/commands/filters/cmd_convolution_matrix.cpp @@ -1,5 +1,5 @@ // Aseprite -// Copyright (C) 2019 Igara Studio S.A. +// Copyright (C) 2019-2020 Igara Studio S.A. // Copyright (C) 2001-2018 David Capello // // This program is distributed under the terms of @@ -23,7 +23,6 @@ #include "app/ini_file.h" #include "app/load_widget.h" #include "app/pref/preferences.h" -#include "base/bind.h" #include "doc/mask.h" #include "doc/sprite.h" #include "filters/convolution_matrix.h" @@ -58,7 +57,9 @@ static const char* ConfigSection = "ConvolutionMatrix"; class ConvolutionMatrixWindow : public FilterWindow { public: - ConvolutionMatrixWindow(ConvolutionMatrixFilter& filter, FilterManagerImpl& filterMgr, ConvolutionMatrixStock& stock) + ConvolutionMatrixWindow(ConvolutionMatrixFilter& filter, + FilterManagerImpl& filterMgr, + ConvolutionMatrixStock& stock) : FilterWindow("Convolution Matrix", ConfigSection, &filterMgr, WithChannelsSelector, WithTiledCheckBox, @@ -72,14 +73,14 @@ public: { getContainer()->addChild(m_controlsWidget.get()); - m_reloadButton->Click.connect(&ConvolutionMatrixWindow::onReloadStock, this); - m_stockListBox->Change.connect(base::Bind(&ConvolutionMatrixWindow::onMatrixChange, this)); + m_reloadButton->Click.connect([this]{ onReloadStock(); }); + m_stockListBox->Change.connect([this]{ onMatrixChange(); }); fillStockListBox(); } private: - void onReloadStock(Event& ev) { + void onReloadStock() { m_stock.reloadStock(); fillStockListBox(); } diff --git a/src/app/commands/filters/cmd_hue_saturation.cpp b/src/app/commands/filters/cmd_hue_saturation.cpp index b4f1fb7f0..d28299b83 100644 --- a/src/app/commands/filters/cmd_hue_saturation.cpp +++ b/src/app/commands/filters/cmd_hue_saturation.cpp @@ -22,7 +22,6 @@ #include "app/ui/button_set.h" #include "app/ui/color_button.h" #include "app/ui/color_sliders.h" -#include "base/bind.h" #include "doc/image.h" #include "doc/mask.h" #include "doc/sprite.h" @@ -75,11 +74,11 @@ public: m_colorType.addItem("HSV+")->setFocusStop(false); m_colorType.addItem("HSL+")->setFocusStop(false); m_colorType.setSelectedItem(int(mode)); - m_colorType.ItemChange.connect(base::Bind(&HueSaturationWindow::onChangeMode, this)); + m_colorType.ItemChange.connect([this]{ onChangeMode(); }); m_sliders.setColorType(app::Color::HslType); m_sliders.setMode(ColorSliders::Mode::Relative); - m_sliders.ColorChange.connect(base::Bind(&HueSaturationWindow::onChangeControls, this)); + m_sliders.ColorChange.connect([this]{ onChangeControls(); }); onChangeMode(); } diff --git a/src/app/commands/filters/cmd_invert_color.cpp b/src/app/commands/filters/cmd_invert_color.cpp index b6f102527..6632bf4f2 100644 --- a/src/app/commands/filters/cmd_invert_color.cpp +++ b/src/app/commands/filters/cmd_invert_color.cpp @@ -1,5 +1,5 @@ // Aseprite -// Copyright (C) 2019 Igara Studio S.A. +// Copyright (C) 2019-2020 Igara Studio S.A. // Copyright (C) 2001-2017 David Capello // // This program is distributed under the terms of @@ -19,7 +19,6 @@ #include "app/ini_file.h" #include "app/modules/gui.h" #include "app/ui/color_button.h" -#include "base/bind.h" #include "doc/image.h" #include "doc/mask.h" #include "doc/sprite.h" diff --git a/src/app/commands/filters/cmd_outline.cpp b/src/app/commands/filters/cmd_outline.cpp index 76659548a..7a030fe08 100644 --- a/src/app/commands/filters/cmd_outline.cpp +++ b/src/app/commands/filters/cmd_outline.cpp @@ -1,5 +1,5 @@ // Aseprite -// Copyright (C) 2019 Igara Studio S.A. +// Copyright (C) 2019-2020 Igara Studio S.A. // // This program is distributed under the terms of // the End-User License Agreement for Aseprite. @@ -22,7 +22,6 @@ #include "app/ui/color_bar.h" #include "app/ui/color_button.h" #include "app/ui/skin/skin_theme.h" -#include "base/bind.h" #include "doc/image.h" #include "doc/mask.h" #include "doc/sprite.h" diff --git a/src/app/commands/filters/cmd_replace_color.cpp b/src/app/commands/filters/cmd_replace_color.cpp index e4eb73fc7..d4a36f6c6 100644 --- a/src/app/commands/filters/cmd_replace_color.cpp +++ b/src/app/commands/filters/cmd_replace_color.cpp @@ -1,5 +1,5 @@ // Aseprite -// Copyright (C) 2019 Igara Studio S.A. +// Copyright (C) 2019-2020 Igara Studio S.A. // Copyright (C) 2001-2018 David Capello // // This program is distributed under the terms of @@ -30,7 +30,6 @@ #include "app/ui/color_button.h" #include "app/ui/keyboard_shortcuts.h" #include "app/ui_context.h" -#include "base/bind.h" #include "doc/image.h" #include "doc/mask.h" #include "doc/sprite.h" diff --git a/src/app/commands/filters/filter_target_buttons.cpp b/src/app/commands/filters/filter_target_buttons.cpp index 1488e63a5..0e36b1e01 100644 --- a/src/app/commands/filters/filter_target_buttons.cpp +++ b/src/app/commands/filters/filter_target_buttons.cpp @@ -1,5 +1,5 @@ // Aseprite -// Copyright (C) 2019 Igara Studio S.A. +// Copyright (C) 2019-2020 Igara Studio S.A. // Copyright (C) 2001-2018 David Capello // // This program is distributed under the terms of @@ -15,7 +15,6 @@ #include "app/modules/gfx.h" #include "app/modules/gui.h" #include "app/ui/skin/skin_theme.h" -#include "base/bind.h" #include "doc/image.h" #include "ui/box.h" #include "ui/button.h" diff --git a/src/app/commands/filters/filter_window.cpp b/src/app/commands/filters/filter_window.cpp index 85832da82..dafc292a3 100644 --- a/src/app/commands/filters/filter_window.cpp +++ b/src/app/commands/filters/filter_window.cpp @@ -1,4 +1,5 @@ // Aseprite +// Copyright (C) 2020 Igara Studio S.A. // Copyright (C) 2001-2018 David Capello // // This program is distributed under the terms of @@ -17,7 +18,6 @@ #include "app/modules/gui.h" #include "app/pref/preferences.h" #include "app/ui/editor/editor.h" -#include "base/bind.h" namespace app { @@ -73,7 +73,7 @@ FilterWindow::FilterWindow(const char* title, const char* cfgSection, if (m_tiledCheck) { m_tiledCheck->setSelected(tiledMode != TiledMode::NONE); - m_tiledCheck->Click.connect(base::Bind(&FilterWindow::onTiledChange, this)); + m_tiledCheck->Click.connect([this]{ onTiledChange(); }); m_vbox.addChild(m_tiledCheck); } diff --git a/src/app/console.cpp b/src/app/console.cpp index f8db98928..3472fd1ae 100644 --- a/src/app/console.cpp +++ b/src/app/console.cpp @@ -1,5 +1,5 @@ // Aseprite -// Copyright (C) 2018-2019 Igara Studio S.A. +// Copyright (C) 2018-2020 Igara Studio S.A. // Copyright (C) 2001-2018 David Capello // // This program is distributed under the terms of @@ -13,7 +13,6 @@ #include #include -#include "base/bind.h" #include "base/memory.h" #include "base/string.h" #include "ui/ui.h" @@ -34,14 +33,13 @@ public: ConsoleWindow() : Window(Window::WithTitleBar, "Console"), m_textbox("", WORDWRAP), m_button("Cancel") { - m_button.Click.connect(base::Bind(&ConsoleWindow::closeWindow, this, &m_button)); + m_button.Click.connect([this]{ closeWindow(&m_button); }); // When the window is closed, we clear the text Close.connect( - base::Bind( - [this] { - m_textbox.setText(std::string()); - })); + [this]{ + m_textbox.setText(std::string()); + }); m_view.attachToView(&m_textbox); m_button.setMinSize(gfx::Size(60*ui::guiscale(), 0)); diff --git a/src/app/crash/backup_observer.cpp b/src/app/crash/backup_observer.cpp index dd03f5821..3dd3679eb 100644 --- a/src/app/crash/backup_observer.cpp +++ b/src/app/crash/backup_observer.cpp @@ -26,7 +26,6 @@ #include "app/doc_access.h" #include "app/doc_diff.h" #include "app/pref/preferences.h" -#include "base/bind.h" #include "base/chrono.h" #include "base/remove_from_container.h" #include "ui/system.h" @@ -63,7 +62,7 @@ BackupObserver::BackupObserver(RecoveryConfig* config, , m_session(session) , m_ctx(ctx) , m_done(false) - , m_thread(base::Bind(&BackupObserver::backgroundThread, this)) + , m_thread([this]{ backgroundThread(); }) { m_ctx->add_observer(this); m_ctx->documents().add_observer(this); diff --git a/src/app/crash/session.cpp b/src/app/crash/session.cpp index 3e2e9f70c..ba4e6e271 100644 --- a/src/app/crash/session.cpp +++ b/src/app/crash/session.cpp @@ -20,7 +20,6 @@ #include "app/doc_access.h" #include "app/file/file.h" #include "app/ui_context.h" -#include "base/bind.h" #include "base/convert_to.h" #include "base/fs.h" #include "base/fstream_path.h" diff --git a/src/app/file/webp_format.cpp b/src/app/file/webp_format.cpp index 90fb7b4b7..c1713d64f 100644 --- a/src/app/file/webp_format.cpp +++ b/src/app/file/webp_format.cpp @@ -20,7 +20,6 @@ #include "app/file/webp_options.h" #include "app/ini_file.h" #include "app/pref/preferences.h" -#include "base/bind.h" #include "base/clamp.h" #include "base/convert_to.h" #include "base/file_handle.h" @@ -421,7 +420,7 @@ FormatOptionsPtr WebPFormat::onAskUserForFormatOptions(FileOp* fop) win.imagePreset()->setSelectedItemIndex(opts->imagePreset()); updatePanels(); - win.type()->Change.connect(base::Bind(updatePanels)); + win.type()->Change.connect(updatePanels); win.openWindowInForeground(); diff --git a/src/app/res/http_loader.cpp b/src/app/res/http_loader.cpp index 62ec2637a..f2a82c39a 100644 --- a/src/app/res/http_loader.cpp +++ b/src/app/res/http_loader.cpp @@ -11,7 +11,6 @@ #include "app/res/http_loader.h" -#include "base/bind.h" #include "base/fs.h" #include "base/fstream_path.h" #include "base/replace_string.h" @@ -29,7 +28,7 @@ HttpLoader::HttpLoader(const std::string& url) : m_url(url) , m_done(false) , m_request(nullptr) - , m_thread(base::Bind(&HttpLoader::threadHttpRequest, this)) + , m_thread([this]{ threadHttpRequest(); }) { } diff --git a/src/app/res/palettes_loader_delegate.cpp b/src/app/res/palettes_loader_delegate.cpp index 4c6ea81a9..a1dcb4bbb 100644 --- a/src/app/res/palettes_loader_delegate.cpp +++ b/src/app/res/palettes_loader_delegate.cpp @@ -1,5 +1,5 @@ // Aseprite -// Copyright (C) 2019 Igara Studio S.A. +// Copyright (C) 2019-2020 Igara Studio S.A. // Copyright (C) 2001-2017 David Capello // // This program is distributed under the terms of @@ -17,7 +17,6 @@ #include "app/file_system.h" #include "app/res/palette_resource.h" #include "app/resource_finder.h" -#include "base/bind.h" #include "base/fs.h" #include "base/scoped_value.h" #include "doc/palette.h" diff --git a/src/app/res/resources_loader.cpp b/src/app/res/resources_loader.cpp index 88380f32b..83b825eb1 100644 --- a/src/app/res/resources_loader.cpp +++ b/src/app/res/resources_loader.cpp @@ -1,4 +1,5 @@ // Aseprite +// Copyright (C) 2020 Igara Studio S.A. // Copyright (C) 2001-2018 David Capello // // This program is distributed under the terms of @@ -14,7 +15,6 @@ #include "app/res/resource.h" #include "app/res/resources_loader_delegate.h" #include "app/resource_finder.h" -#include "base/bind.h" #include "base/fs.h" #include "base/scoped_value.h" @@ -24,9 +24,7 @@ ResourcesLoader::ResourcesLoader(ResourcesLoaderDelegate* delegate) : m_delegate(delegate) , m_done(false) , m_cancel(false) - , m_thread( - new base::thread( - base::Bind(&ResourcesLoader::threadLoadResources, this))) + , m_thread(new base::thread([this]{ threadLoadResources(); })) { } @@ -87,8 +85,7 @@ void ResourcesLoader::threadLoadResources() base::thread* ResourcesLoader::createThread() { - return new base::thread( - base::Bind(&ResourcesLoader::threadLoadResources, this)); + return new base::thread([this]{ threadLoadResources(); }); } } // namespace app diff --git a/src/app/script/dialog_class.cpp b/src/app/script/dialog_class.cpp index 128fc4f76..33fd9400b 100644 --- a/src/app/script/dialog_class.cpp +++ b/src/app/script/dialog_class.cpp @@ -19,7 +19,6 @@ #include "app/ui/color_shades.h" #include "app/ui/expr_entry.h" #include "app/ui/filename_field.h" -#include "base/bind.h" #include "base/paths.h" #include "ui/box.h" #include "ui/button.h" diff --git a/src/app/send_crash.cpp b/src/app/send_crash.cpp index 39a0d1402..0d15837e1 100644 --- a/src/app/send_crash.cpp +++ b/src/app/send_crash.cpp @@ -16,7 +16,6 @@ #include "app/i18n/strings.h" #include "app/resource_finder.h" #include "app/task.h" -#include "base/bind.h" #include "base/fs.h" #include "base/launcher.h" #include "fmt/format.h" @@ -139,7 +138,7 @@ void SendCrash::notificationClick() if (isDev) { dlg.official()->setVisible(false); dlg.devFilename()->setText(m_dumpFilename); - dlg.devFilename()->Click.connect(base::Bind(&SendCrash::onClickDevFilename, this)); + dlg.devFilename()->Click.connect([this]{ onClickDevFilename(); }); } else #endif // On other platforms the crash file might be useful even in @@ -148,7 +147,7 @@ void SendCrash::notificationClick() { dlg.dev()->setVisible(false); dlg.filename()->setText(m_dumpFilename); - dlg.filename()->Click.connect(base::Bind(&SendCrash::onClickFilename, this)); + dlg.filename()->Click.connect([this]{ onClickFilename(); }); } dlg.openWindowInForeground(); diff --git a/src/app/thumbnail_generator.cpp b/src/app/thumbnail_generator.cpp index 0c8802823..2f4e40066 100644 --- a/src/app/thumbnail_generator.cpp +++ b/src/app/thumbnail_generator.cpp @@ -17,7 +17,6 @@ #include "app/file/file.h" #include "app/file_system.h" #include "app/util/conversion_to_surface.h" -#include "base/bind.h" #include "base/clamp.h" #include "base/scoped_lock.h" #include "base/thread.h" @@ -46,7 +45,7 @@ public: : m_queue(queue) , m_fop(nullptr) , m_isDone(false) - , m_thread(base::Bind(&Worker::loadBgThread, this)) { + , m_thread([this]{ loadBgThread(); }) { } ~Worker() { @@ -226,7 +225,7 @@ ThumbnailGenerator* ThumbnailGenerator::instance() static ThumbnailGenerator* singleton = nullptr; if (singleton == NULL) { singleton = new ThumbnailGenerator(); - App::instance()->Exit.connect(base::Bind(&delete_singleton, singleton)); + App::instance()->Exit.connect([&]{ delete_singleton(singleton); }); } return singleton; } diff --git a/src/app/tools/tool_box.cpp b/src/app/tools/tool_box.cpp index ac5f8b9a6..d4696a917 100644 --- a/src/app/tools/tool_box.cpp +++ b/src/app/tools/tool_box.cpp @@ -20,7 +20,6 @@ #include "app/tools/stroke.h" #include "app/tools/tool_group.h" #include "app/tools/tool_loop.h" -#include "base/bind.h" #include "base/exception.h" #include "doc/algo.h" #include "doc/algorithm/floodfill.h" diff --git a/src/app/ui/backup_indicator.cpp b/src/app/ui/backup_indicator.cpp index 74df51674..ce07f7238 100644 --- a/src/app/ui/backup_indicator.cpp +++ b/src/app/ui/backup_indicator.cpp @@ -1,4 +1,5 @@ // Aseprite +// Copyright (C) 2020 Igara Studio S.A. // Copyright (C) 2001-2016 David Capello // // This program is distributed under the terms of @@ -11,7 +12,6 @@ #include "app/ui/backup_indicator.h" #include "app/ui/status_bar.h" -#include "base/bind.h" #include "ui/manager.h" namespace app { @@ -21,7 +21,7 @@ BackupIndicator::BackupIndicator() , m_small(false) , m_running(false) { - m_timer.Tick.connect(base::Bind(&BackupIndicator::onTick, this)); + m_timer.Tick.connect([this]{ onTick(); }); } BackupIndicator::~BackupIndicator() diff --git a/src/app/ui/brush_popup.cpp b/src/app/ui/brush_popup.cpp index 9466589e2..5761b888a 100644 --- a/src/app/ui/brush_popup.cpp +++ b/src/app/ui/brush_popup.cpp @@ -27,7 +27,6 @@ #include "app/ui/skin/skin_theme.h" #include "app/ui_context.h" #include "app/util/conversion_to_surface.h" -#include "base/bind.h" #include "base/convert_to.h" #include "doc/brush.h" #include "doc/image.h" diff --git a/src/app/ui/button_set.cpp b/src/app/ui/button_set.cpp index 3a8531963..e05e43eb2 100644 --- a/src/app/ui/button_set.cpp +++ b/src/app/ui/button_set.cpp @@ -13,7 +13,6 @@ #include "app/modules/gui.h" #include "app/ui/skin/skin_theme.h" -#include "base/bind.h" #include "gfx/color.h" #include "os/surface.h" #include "ui/box.h" diff --git a/src/app/ui/color_bar.cpp b/src/app/ui/color_bar.cpp index c3777b921..680ac9a0d 100644 --- a/src/app/ui/color_bar.cpp +++ b/src/app/ui/color_bar.cpp @@ -50,7 +50,6 @@ #include "app/ui_context.h" #include "app/ui_context.h" #include "app/util/clipboard.h" -#include "base/bind.h" #include "base/clamp.h" #include "base/scoped_value.h" #include "doc/cel.h" @@ -200,14 +199,14 @@ ColorBar::ColorBar(int align, TooltipManager* tooltipManager) m_fgColor.setExpansive(true); m_bgColor.setExpansive(true); - m_remapButton.Click.connect(base::Bind(&ColorBar::onRemapButtonClick, this)); + m_remapButton.Click.connect([this]{ onRemapButtonClick(); }); m_fgColor.Change.connect(&ColorBar::onFgColorButtonChange, this); m_fgColor.BeforeChange.connect(&ColorBar::onFgColorButtonBeforeChange, this); m_bgColor.Change.connect(&ColorBar::onBgColorButtonChange, this); - m_fgWarningIcon->Click.connect(base::Bind(&ColorBar::onFixWarningClick, this, &m_fgColor, m_fgWarningIcon)); - m_bgWarningIcon->Click.connect(base::Bind(&ColorBar::onFixWarningClick, this, &m_bgColor, m_bgWarningIcon)); - m_redrawTimer.Tick.connect(base::Bind(&ColorBar::onTimerTick, this)); - m_buttons.ItemChange.connect(base::Bind(&ColorBar::onPaletteButtonClick, this)); + m_fgWarningIcon->Click.connect([this]{ onFixWarningClick(&m_fgColor, m_fgWarningIcon); }); + m_bgWarningIcon->Click.connect([this]{ onFixWarningClick(&m_bgColor, m_bgWarningIcon); }); + m_redrawTimer.Tick.connect([this]{ onTimerTick(); }); + m_buttons.ItemChange.connect([this]{ onPaletteButtonClick(); }); tooltipManager->addTooltipFor(&m_fgColor, "Foreground color", LEFT); tooltipManager->addTooltipFor(&m_bgColor, "Background color", LEFT); @@ -270,13 +269,13 @@ ColorBar::ColorBar(int align, TooltipManager* tooltipManager) UIContext::instance()->add_observer(this); m_beforeCmdConn = UIContext::instance()->BeforeCommandExecution.connect(&ColorBar::onBeforeExecuteCommand, this); m_afterCmdConn = UIContext::instance()->AfterCommandExecution.connect(&ColorBar::onAfterExecuteCommand, this); - m_fgConn = Preferences::instance().colorBar.fgColor.AfterChange.connect(base::Bind(&ColorBar::onFgColorChangeFromPreferences, this)); - m_bgConn = Preferences::instance().colorBar.bgColor.AfterChange.connect(base::Bind(&ColorBar::onBgColorChangeFromPreferences, this)); - m_sepConn = Preferences::instance().colorBar.entriesSeparator.AfterChange.connect(base::Bind(&ColorBar::invalidate, this)); + m_fgConn = Preferences::instance().colorBar.fgColor.AfterChange.connect([this]{ onFgColorChangeFromPreferences(); }); + m_bgConn = Preferences::instance().colorBar.bgColor.AfterChange.connect([this]{ onBgColorChangeFromPreferences(); }); + m_sepConn = Preferences::instance().colorBar.entriesSeparator.AfterChange.connect([this]{ invalidate(); }); m_paletteView.FocusOrClick.connect(&ColorBar::onFocusPaletteView, this); m_appPalChangeConn = App::instance()->PaletteChange.connect(&ColorBar::onAppPaletteChange, this); KeyboardShortcuts::instance()->UserChange.connect( - base::Bind(&ColorBar::setupTooltips, this, tooltipManager)); + [this, tooltipManager]{ setupTooltips(tooltipManager); }); setEditMode(false); registerCommands(); @@ -1280,18 +1279,18 @@ void ColorBar::showPaletteSortOptions() if (m_ascending) asc.setSelected(true); else des.setSelected(true); - rev.Click.connect(base::Bind(&ColorBar::onReverseColors, this)); - grd.Click.connect(base::Bind(&ColorBar::onGradient, this)); - hue.Click.connect(base::Bind(&ColorBar::onSortBy, this, SortPaletteBy::HUE)); - sat.Click.connect(base::Bind(&ColorBar::onSortBy, this, SortPaletteBy::SATURATION)); - bri.Click.connect(base::Bind(&ColorBar::onSortBy, this, SortPaletteBy::VALUE)); - lum.Click.connect(base::Bind(&ColorBar::onSortBy, this, SortPaletteBy::LUMA)); - red.Click.connect(base::Bind(&ColorBar::onSortBy, this, SortPaletteBy::RED)); - grn.Click.connect(base::Bind(&ColorBar::onSortBy, this, SortPaletteBy::GREEN)); - blu.Click.connect(base::Bind(&ColorBar::onSortBy, this, SortPaletteBy::BLUE)); - alp.Click.connect(base::Bind(&ColorBar::onSortBy, this, SortPaletteBy::ALPHA)); - asc.Click.connect(base::Bind(&ColorBar::setAscending, this, true)); - des.Click.connect(base::Bind(&ColorBar::setAscending, this, false)); + rev.Click.connect([this]{ onReverseColors(); }); + grd.Click.connect([this]{ onGradient(); }); + hue.Click.connect([this]{ onSortBy(SortPaletteBy::HUE); }); + sat.Click.connect([this]{ onSortBy(SortPaletteBy::SATURATION); }); + bri.Click.connect([this]{ onSortBy(SortPaletteBy::VALUE); }); + lum.Click.connect([this]{ onSortBy(SortPaletteBy::LUMA); }); + red.Click.connect([this]{ onSortBy(SortPaletteBy::RED); }); + grn.Click.connect([this]{ onSortBy(SortPaletteBy::GREEN); }); + blu.Click.connect([this]{ onSortBy(SortPaletteBy::BLUE); }); + alp.Click.connect([this]{ onSortBy(SortPaletteBy::ALPHA); }); + asc.Click.connect([this]{ setAscending(true); }); + des.Click.connect([this]{ setAscending(false); }); menu.showPopup(gfx::Point(bounds.x, bounds.y+bounds.h)); } diff --git a/src/app/ui/color_popup.cpp b/src/app/ui/color_popup.cpp index 1619fd536..73306be6b 100644 --- a/src/app/ui/color_popup.cpp +++ b/src/app/ui/color_popup.cpp @@ -28,7 +28,6 @@ #include "app/ui/palette_view.h" #include "app/ui/skin/skin_theme.h" #include "app/ui_context.h" -#include "base/bind.h" #include "base/scoped_value.h" #include "doc/image_impl.h" #include "doc/palette.h" @@ -251,7 +250,7 @@ ColorPopup::ColorPopup(const ColorButtonOptions& options) m_vbox.addChild(&m_maskLabel); addChild(&m_vbox); - m_colorType.ItemChange.connect(base::Bind(&ColorPopup::onColorTypeClick, this)); + m_colorType.ItemChange.connect([this]{ onColorTypeClick(); }); m_sliders.ColorChange.connect(&ColorPopup::onColorSlidersChange, this); m_hexColorEntry.ColorChange.connect(&ColorPopup::onColorHexEntryChange, this); diff --git a/src/app/ui/color_shades.cpp b/src/app/ui/color_shades.cpp index 4dedd32f3..938de3c68 100644 --- a/src/app/ui/color_shades.cpp +++ b/src/app/ui/color_shades.cpp @@ -17,7 +17,6 @@ #include "app/shade.h" #include "app/ui/color_bar.h" #include "app/ui/skin/skin_theme.h" -#include "base/bind.h" #include "base/clamp.h" #include "doc/color_mode.h" #include "doc/palette.h" diff --git a/src/app/ui/color_sliders.cpp b/src/app/ui/color_sliders.cpp index d3c3e1afe..fbb7ba625 100644 --- a/src/app/ui/color_sliders.cpp +++ b/src/app/ui/color_sliders.cpp @@ -16,7 +16,6 @@ #include "app/ui/color_sliders.h" #include "app/ui/skin/skin_slider_property.h" #include "app/ui/skin/skin_theme.h" -#include "base/bind.h" #include "base/scoped_value.h" #include "gfx/hsl.h" #include "gfx/rgb.h" @@ -375,9 +374,9 @@ void ColorSliders::addSlider(const Channel channel, item.absSlider->setDoubleBuffered(true); get_skin_property(item.entry)->setLook(MiniLook); - item.absSlider->Change.connect(base::Bind(&ColorSliders::onSliderChange, this, channel)); - item.relSlider->Change.connect(base::Bind(&ColorSliders::onSliderChange, this, channel)); - item.entry->Change.connect(base::Bind(&ColorSliders::onEntryChange, this, channel)); + item.absSlider->Change.connect([this, channel]{ onSliderChange(channel); }); + item.relSlider->Change.connect([this, channel]{ onSliderChange(channel); }); + item.entry->Change.connect([this, channel]{ onEntryChange(channel); }); item.box->addChild(item.absSlider); item.box->addChild(item.relSlider); diff --git a/src/app/ui/color_wheel.cpp b/src/app/ui/color_wheel.cpp index 12cc4fc38..df5a2757a 100644 --- a/src/app/ui/color_wheel.cpp +++ b/src/app/ui/color_wheel.cpp @@ -15,7 +15,6 @@ #include "app/pref/preferences.h" #include "app/ui/skin/skin_theme.h" #include "app/ui/status_bar.h" -#include "base/bind.h" #include "base/clamp.h" #include "base/pi.h" #include "filters/color_curve.h" @@ -56,7 +55,7 @@ ColorWheel::ColorWheel() , m_options("") , m_harmonyPicked(false) { - m_options.Click.connect(base::Bind(&ColorWheel::onOptions, this)); + m_options.Click.connect([this]{ onOptions(); }); addChild(&m_options); InitTheme.connect( @@ -389,7 +388,7 @@ void ColorWheel::onOptions() if (isDiscrete()) discrete.setSelected(true); - discrete.Click.connect(base::Bind(&ColorWheel::setDiscrete, this, !isDiscrete())); + discrete.Click.connect([this]{ setDiscrete(!isDiscrete()); }); if (m_colorModel != ColorModel::NORMAL_MAP) { switch (m_harmony) { @@ -402,14 +401,14 @@ void ColorWheel::onOptions() case Harmony::TETRADIC: tetradic.setSelected(true); break; case Harmony::SQUARE: square.setSelected(true); break; } - none.Click.connect(base::Bind(&ColorWheel::setHarmony, this, Harmony::NONE)); - complementary.Click.connect(base::Bind(&ColorWheel::setHarmony, this, Harmony::COMPLEMENTARY)); - monochromatic.Click.connect(base::Bind(&ColorWheel::setHarmony, this, Harmony::MONOCHROMATIC)); - analogous.Click.connect(base::Bind(&ColorWheel::setHarmony, this, Harmony::ANALOGOUS)); - split.Click.connect(base::Bind(&ColorWheel::setHarmony, this, Harmony::SPLIT)); - triadic.Click.connect(base::Bind(&ColorWheel::setHarmony, this, Harmony::TRIADIC)); - tetradic.Click.connect(base::Bind(&ColorWheel::setHarmony, this, Harmony::TETRADIC)); - square.Click.connect(base::Bind(&ColorWheel::setHarmony, this, Harmony::SQUARE)); + none.Click.connect([this]{ setHarmony(Harmony::NONE); }); + complementary.Click.connect([this]{ setHarmony(Harmony::COMPLEMENTARY); }); + monochromatic.Click.connect([this]{ setHarmony(Harmony::MONOCHROMATIC); }); + analogous.Click.connect([this]{ setHarmony(Harmony::ANALOGOUS); }); + split.Click.connect([this]{ setHarmony(Harmony::SPLIT); }); + triadic.Click.connect([this]{ setHarmony(Harmony::TRIADIC); }); + tetradic.Click.connect([this]{ setHarmony(Harmony::TETRADIC); }); + square.Click.connect([this]{ setHarmony(Harmony::SQUARE); }); } gfx::Rect rc = m_options.bounds(); diff --git a/src/app/ui/configure_timeline_popup.cpp b/src/app/ui/configure_timeline_popup.cpp index 69e6b45e5..8090bcd8b 100644 --- a/src/app/ui/configure_timeline_popup.cpp +++ b/src/app/ui/configure_timeline_popup.cpp @@ -1,4 +1,5 @@ // Aseprite +// Copyright (C) 2020 Igara Studio S.A. // Copyright (C) 2001-2018 David Capello // // This program is distributed under the terms of @@ -22,7 +23,6 @@ #include "app/ui/main_window.h" #include "app/ui/timeline/timeline.h" #include "app/ui_context.h" -#include "base/bind.h" #include "base/scoped_value.h" #include "ui/box.h" #include "ui/button.h" @@ -53,22 +53,22 @@ ConfigureTimelinePopup::ConfigureTimelinePopup() m_box = new app::gen::TimelineConf(); addChild(m_box); - m_box->position()->ItemChange.connect(base::Bind(&ConfigureTimelinePopup::onChangePosition, this)); - m_box->firstFrame()->Change.connect(base::Bind(&ConfigureTimelinePopup::onChangeFirstFrame, this)); - m_box->merge()->Click.connect(base::Bind(&ConfigureTimelinePopup::onChangeType, this)); - m_box->tint()->Click.connect(base::Bind(&ConfigureTimelinePopup::onChangeType, this)); - m_box->opacity()->Change.connect(base::Bind(&ConfigureTimelinePopup::onOpacity, this)); - m_box->opacityStep()->Change.connect(base::Bind(&ConfigureTimelinePopup::onOpacityStep, this)); - m_box->resetOnionskin()->Click.connect(base::Bind(&ConfigureTimelinePopup::onResetOnionskin, this)); - m_box->loopTag()->Click.connect(base::Bind(&ConfigureTimelinePopup::onLoopTagChange, this)); - m_box->currentLayer()->Click.connect(base::Bind(&ConfigureTimelinePopup::onCurrentLayerChange, this)); - m_box->behind()->Click.connect(base::Bind(&ConfigureTimelinePopup::onPositionChange, this)); - m_box->infront()->Click.connect(base::Bind(&ConfigureTimelinePopup::onPositionChange, this)); + m_box->position()->ItemChange.connect([this]{ onChangePosition(); }); + m_box->firstFrame()->Change.connect([this]{ onChangeFirstFrame(); }); + m_box->merge()->Click.connect([this]{ onChangeType(); }); + m_box->tint()->Click.connect([this]{ onChangeType(); }); + m_box->opacity()->Change.connect([this]{ onOpacity(); }); + m_box->opacityStep()->Change.connect([this]{ onOpacityStep(); }); + m_box->resetOnionskin()->Click.connect([this]{ onResetOnionskin(); }); + m_box->loopTag()->Click.connect([this]{ onLoopTagChange(); }); + m_box->currentLayer()->Click.connect([this]{ onCurrentLayerChange(); }); + m_box->behind()->Click.connect([this]{ onPositionChange(); }); + m_box->infront()->Click.connect([this]{ onPositionChange(); }); - m_box->zoom()->Change.connect(base::Bind(&ConfigureTimelinePopup::onZoomChange, this)); - m_box->thumbEnabled()->Click.connect(base::Bind(&ConfigureTimelinePopup::onThumbEnabledChange, this)); - m_box->thumbOverlayEnabled()->Click.connect(base::Bind(&ConfigureTimelinePopup::onThumbOverlayEnabledChange, this)); - m_box->thumbOverlaySize()->Change.connect(base::Bind(&ConfigureTimelinePopup::onThumbOverlaySizeChange, this)); + m_box->zoom()->Change.connect([this]{ onZoomChange(); }); + m_box->thumbEnabled()->Click.connect([this]{ onThumbEnabledChange(); }); + m_box->thumbOverlayEnabled()->Click.connect([this]{ onThumbOverlayEnabledChange(); }); + m_box->thumbOverlaySize()->Change.connect([this]{ onThumbOverlaySizeChange(); }); const bool visibleThumb = docPref().thumbnails.enabled(); m_box->thumbHSeparator()->setVisible(visibleThumb); diff --git a/src/app/ui/context_bar.cpp b/src/app/ui/context_bar.cpp index 7cdd80fd6..a4f090da2 100644 --- a/src/app/ui/context_bar.cpp +++ b/src/app/ui/context_bar.cpp @@ -46,7 +46,6 @@ #include "app/ui/selection_mode_field.h" #include "app/ui/skin/skin_theme.h" #include "app/ui_context.h" -#include "base/bind.h" #include "base/clamp.h" #include "base/fs.h" #include "base/scoped_value.h" @@ -520,10 +519,10 @@ public: m_shade.setText("Select colors in the palette"); m_shade.setMinColors(2); m_conn = colorBar->ChangeSelection.connect( - base::Bind(&InkShadesField::onChangeColorBarSelection, this)); + [this]{ onChangeColorBarSelection(); }); m_button.setFocusStop(false); - m_button.Click.connect(base::Bind(&InkShadesField::onShowMenu, this)); + m_button.Click.connect([this]{ onShowMenu(); }); initTheme(); } @@ -582,8 +581,8 @@ private: bool hasShade = (m_shade.size() >= 2); reverse.setEnabled(hasShade); save.setEnabled(hasShade); - reverse.Click.connect(base::Bind(&InkShadesField::reverseShadeColors, this)); - save.Click.connect(base::Bind(&InkShadesField::onSaveShade, this)); + reverse.Click.connect([this]{ reverseShadeColors(); }); + save.Click.connect([this]{ onSaveShade(); }); if (!m_shades.empty()) { SkinTheme* theme = SkinTheme::instance(); @@ -607,11 +606,10 @@ private: }); close->initTheme(); close->Click.connect( - base::Bind( - [this, i, close]{ - m_shades.erase(m_shades.begin()+i); - close->closeWindow(); - })); + [this, i, close]{ + m_shades.erase(m_shades.begin()+i); + close->closeWindow(); + }); auto item = new HBox(); item->InitTheme.connect( @@ -770,11 +768,11 @@ public: sz.w += 2*guiscale(); m_icon.getItem(0)->setMinSize(sz); - m_icon.ItemChange.connect(base::Bind(&TransparentColorField::onPopup, this)); - m_maskColor.Change.connect(base::Bind(&TransparentColorField::onChangeColor, this)); + m_icon.ItemChange.connect([this]{ onPopup(); }); + m_maskColor.Change.connect([this]{ onChangeColor(); }); Preferences::instance().selection.opaque.AfterChange.connect( - base::Bind(&TransparentColorField::onOpaqueChange, this)); + [this]{ onOpaqueChange(); }); onOpaqueChange(); @@ -803,9 +801,9 @@ private: masked.setSelected(true); automatic.setSelected(Preferences::instance().selection.autoOpaque()); - opaque.Click.connect(base::Bind(&TransparentColorField::setOpaque, this, true)); - masked.Click.connect(base::Bind(&TransparentColorField::setOpaque, this, false)); - automatic.Click.connect(base::Bind(&TransparentColorField::onAutomatic, this)); + opaque.Click.connect([this]{ setOpaque(true); }); + masked.Click.connect([this]{ setOpaque(false); }); + automatic.Click.connect([this]{ onAutomatic(); }); menu.showPopup(gfx::Point(bounds.x, bounds.y+bounds.h)); } @@ -855,7 +853,7 @@ public: addItem(SkinTheme::instance()->parts.pivotCenter()); Preferences::instance().selection.pivotPosition.AfterChange.connect( - base::Bind(&PivotField::onPivotChange, this)); + [this]{ onPivotChange(); }); onPivotChange(); } @@ -1166,8 +1164,8 @@ public: addChild(new Label("Sample:")); addChild(&m_sample); - m_channel.Change.connect(base::Bind(&EyedropperField::onChannelChange, this)); - m_sample.Change.connect(base::Bind(&EyedropperField::onSampleChange, this)); + m_channel.Change.connect([this]{ onChannelChange(); }); + m_sample.Change.connect([this]{ onSampleChange(); }); } void updateFromPreferences(app::Preferences::Eyedropper& prefEyedropper) { @@ -1586,14 +1584,14 @@ ContextBar::ContextBar(TooltipManager* tooltipManager, auto& pref = Preferences::instance(); pref.symmetryMode.enabled.AfterChange.connect( - base::Bind(&ContextBar::onSymmetryModeChange, this)); + [this]{ onSymmetryModeChange(); }); pref.colorBar.fgColor.AfterChange.connect( - base::Bind(&ContextBar::onFgOrBgColorChange, this, doc::Brush::ImageColor::MainColor)); + [this]{ onFgOrBgColorChange(doc::Brush::ImageColor::MainColor); }); pref.colorBar.bgColor.AfterChange.connect( - base::Bind(&ContextBar::onFgOrBgColorChange, this, doc::Brush::ImageColor::BackgroundColor)); + [this]{ onFgOrBgColorChange(doc::Brush::ImageColor::BackgroundColor); }); KeyboardShortcuts::instance()->UserChange.connect( - base::Bind(&ContextBar::setupTooltips, this, tooltipManager)); + [this, tooltipManager]{ setupTooltips(tooltipManager); }); m_dropPixels->DropPixels.connect(&ContextBar::onDropPixels, this); @@ -1771,11 +1769,11 @@ void ContextBar::updateForTool(tools::Tool* tool) } if (toolPref) { - m_sizeConn = brushPref->size.AfterChange.connect(base::Bind(&ContextBar::onBrushSizeChange, this)); - m_angleConn = brushPref->angle.AfterChange.connect(base::Bind(&ContextBar::onBrushAngleChange, this)); + m_sizeConn = brushPref->size.AfterChange.connect([this]{ onBrushSizeChange(); }); + m_angleConn = brushPref->angle.AfterChange.connect([this]{ onBrushAngleChange(); }); m_opacityConn = toolPref->opacity.AfterChange.connect(&ContextBar::onToolSetOpacity, this); - m_freehandAlgoConn = toolPref->freehandAlgorithm.AfterChange.connect(base::Bind(&ContextBar::onToolSetFreehandAlgorithm, this)); - m_contiguousConn = toolPref->contiguous.AfterChange.connect(base::Bind(&ContextBar::onToolSetContiguous, this)); + m_freehandAlgoConn = toolPref->freehandAlgorithm.AfterChange.connect([this]{ onToolSetFreehandAlgorithm(); }); + m_contiguousConn = toolPref->contiguous.AfterChange.connect([this]{ onToolSetContiguous(); }); } if (tool) diff --git a/src/app/ui/data_recovery_view.cpp b/src/app/ui/data_recovery_view.cpp index 24d179ad4..ae66e22d8 100644 --- a/src/app/ui/data_recovery_view.cpp +++ b/src/app/ui/data_recovery_view.cpp @@ -28,7 +28,6 @@ #include "app/ui/workspace.h" #include "app/ui/workspace.h" #include "app/ui_context.h" -#include "base/bind.h" #include "base/fs.h" #include "fmt/format.h" #include "ui/alert.h" @@ -251,13 +250,13 @@ DataRecoveryView::DataRecoveryView(crash::DataRecovery* dataRecovery) fillList(); onChangeSelection(); - m_openButton.Click.connect(base::Bind(&DataRecoveryView::onOpen, this)); - m_openButton.DropDownClick.connect(base::Bind(&DataRecoveryView::onOpenMenu, this)); - m_deleteButton.Click.connect(base::Bind(&DataRecoveryView::onDelete, this)); - m_refreshButton.Click.connect(base::Bind(&DataRecoveryView::onRefresh, this)); - m_listBox.Change.connect(base::Bind(&DataRecoveryView::onChangeSelection, this)); - m_listBox.DoubleClickItem.connect(base::Bind(&DataRecoveryView::onOpen, this)); - m_waitToEnableRefreshTimer.Tick.connect(base::Bind(&DataRecoveryView::onCheckIfWeCanEnableRefreshButton, this)); + m_openButton.Click.connect([this]{ onOpen(); }); + m_openButton.DropDownClick.connect([this]{ onOpenMenu(); }); + m_deleteButton.Click.connect([this]{ onDelete(); }); + m_refreshButton.Click.connect([this]{ onRefresh(); }); + m_listBox.Change.connect([this]{ onChangeSelection(); }); + m_listBox.DoubleClickItem.connect([this]{ onOpen(); }); + m_waitToEnableRefreshTimer.Tick.connect([this]{ onCheckIfWeCanEnableRefreshButton(); }); m_conn = Preferences::instance() .general.showFullPath.AfterChange.connect( @@ -441,8 +440,8 @@ void DataRecoveryView::onOpenMenu() menu.addChild(&rawFrames); menu.addChild(&rawLayers); - rawFrames.Click.connect(base::Bind(&DataRecoveryView::onOpenRaw, this, crash::RawImagesAs::kFrames)); - rawLayers.Click.connect(base::Bind(&DataRecoveryView::onOpenRaw, this, crash::RawImagesAs::kLayers)); + rawFrames.Click.connect([this]{ onOpenRaw(crash::RawImagesAs::kFrames); }); + rawLayers.Click.connect([this]{ onOpenRaw(crash::RawImagesAs::kLayers); }); menu.showPopup(gfx::Point(bounds.x, bounds.y+bounds.h)); } diff --git a/src/app/ui/dithering_selector.cpp b/src/app/ui/dithering_selector.cpp index f058f4f81..85e1980ac 100644 --- a/src/app/ui/dithering_selector.cpp +++ b/src/app/ui/dithering_selector.cpp @@ -16,7 +16,6 @@ #include "app/modules/palettes.h" #include "app/ui/skin/skin_theme.h" #include "app/util/conversion_to_surface.h" -#include "base/bind.h" #include "doc/image.h" #include "doc/image_ref.h" #include "doc/primitives.h" @@ -179,7 +178,7 @@ DitheringSelector::DitheringSelector(Type type) // regenerate this DitheringSelector m_extChanges = extensions.DitheringMatricesChange.connect( - base::Bind(&DitheringSelector::regenerate, this)); + [this]{ regenerate(); }); setUseCustomWidget(true); regenerate(); diff --git a/src/app/ui/editor/editor.cpp b/src/app/ui/editor/editor.cpp index 04c90f34b..31736a55e 100644 --- a/src/app/ui/editor/editor.cpp +++ b/src/app/ui/editor/editor.cpp @@ -53,7 +53,6 @@ #include "app/ui_context.h" #include "app/util/conversion_to_surface.h" #include "app/util/layer_utils.h" -#include "base/bind.h" #include "base/chrono.h" #include "base/clamp.h" #include "base/convert_to.h" @@ -172,11 +171,11 @@ Editor::Editor(Doc* document, EditorFlags flags) m_fgColorChangeConn = Preferences::instance().colorBar.fgColor.AfterChange.connect( - base::Bind(&Editor::onFgColorChange, this)); + [this]{ onFgColorChange(); }); m_contextBarBrushChangeConn = App::instance()->contextBar()->BrushChange.connect( - base::Bind(&Editor::onContextBarBrushChange, this)); + [this]{ onContextBarBrushChange(); }); // Restore last site in preferences { @@ -190,16 +189,16 @@ Editor::Editor(Doc* document, EditorFlags flags) setLayer(layers[layerIndex]); } - m_tiledConnBefore = m_docPref.tiled.BeforeChange.connect(base::Bind(&Editor::onTiledModeBeforeChange, this)); - m_tiledConn = m_docPref.tiled.AfterChange.connect(base::Bind(&Editor::onTiledModeChange, this)); - m_gridConn = m_docPref.grid.AfterChange.connect(base::Bind(&Editor::invalidate, this)); - m_pixelGridConn = m_docPref.pixelGrid.AfterChange.connect(base::Bind(&Editor::invalidate, this)); - m_bgConn = m_docPref.bg.AfterChange.connect(base::Bind(&Editor::invalidate, this)); - m_onionskinConn = m_docPref.onionskin.AfterChange.connect(base::Bind(&Editor::invalidate, this)); - m_symmetryModeConn = Preferences::instance().symmetryMode.enabled.AfterChange.connect(base::Bind(&Editor::invalidateIfActive, this)); + m_tiledConnBefore = m_docPref.tiled.BeforeChange.connect([this]{ onTiledModeBeforeChange(); }); + m_tiledConn = m_docPref.tiled.AfterChange.connect([this]{ onTiledModeChange(); }); + m_gridConn = m_docPref.grid.AfterChange.connect([this]{ invalidate(); }); + m_pixelGridConn = m_docPref.pixelGrid.AfterChange.connect([this]{ invalidate(); }); + m_bgConn = m_docPref.bg.AfterChange.connect([this]{ invalidate(); }); + m_onionskinConn = m_docPref.onionskin.AfterChange.connect([this]{ invalidate(); }); + m_symmetryModeConn = Preferences::instance().symmetryMode.enabled.AfterChange.connect([this]{ invalidateIfActive(); }); m_showExtrasConn = m_docPref.show.AfterChange.connect( - base::Bind(&Editor::onShowExtrasChange, this)); + [this]{ onShowExtrasChange(); }); m_document->add_observer(this); @@ -2591,7 +2590,7 @@ void Editor::showAnimationSpeedMultiplierPopup(Option& playOnce, for (double option : options) { MenuItem* item = new MenuItem("Speed x" + base::convert_to(option)); - item->Click.connect(base::Bind(&Editor::setAnimationSpeedMultiplier, this, option)); + item->Click.connect([this, option]{ setAnimationSpeedMultiplier(option); }); item->setSelected(m_aniSpeed == option); menu.addChild(item); } diff --git a/src/app/ui/editor/editor_observers.cpp b/src/app/ui/editor/editor_observers.cpp index 9fc504cb3..ef9a191f3 100644 --- a/src/app/ui/editor/editor_observers.cpp +++ b/src/app/ui/editor/editor_observers.cpp @@ -1,4 +1,5 @@ // Aseprite +// Copyright (C) 2020 Igara Studio S.A. // Copyright (C) 2001-2016 David Capello // // This program is distributed under the terms of @@ -11,7 +12,6 @@ #include "app/ui/editor/editor_observers.h" #include "app/ui/editor/editor_observer.h" -#include "base/bind.h" namespace app { diff --git a/src/app/ui/editor/editor_view.cpp b/src/app/ui/editor/editor_view.cpp index 6f7d58fae..acbe4d0c0 100644 --- a/src/app/ui/editor/editor_view.cpp +++ b/src/app/ui/editor/editor_view.cpp @@ -1,4 +1,5 @@ // Aseprite +// Copyright (C) 2020 Igara Studio S.A. // Copyright (C) 2001-2017 David Capello // // This program is distributed under the terms of @@ -16,7 +17,6 @@ #include "app/pref/preferences.h" #include "app/ui/editor/editor.h" #include "app/ui/skin/skin_theme.h" -#include "base/bind.h" #include "os/surface.h" #include "ui/paint_event.h" #include "ui/resize_event.h" @@ -42,7 +42,7 @@ EditorView::EditorView(EditorView::Type type) { m_scrollSettingsConn = Preferences::instance().editor.showScrollbars.AfterChange.connect( - base::Bind(&EditorView::setupScrollbars, this)); + [this]{ setupScrollbars(); }); InitTheme.connect( [this]{ diff --git a/src/app/ui/editor/moving_pixels_state.cpp b/src/app/ui/editor/moving_pixels_state.cpp index e7c13ee32..59ecb6a83 100644 --- a/src/app/ui/editor/moving_pixels_state.cpp +++ b/src/app/ui/editor/moving_pixels_state.cpp @@ -36,7 +36,6 @@ #include "app/ui_context.h" #include "app/util/clipboard.h" #include "app/util/layer_utils.h" -#include "base/bind.h" #include "base/gcd.h" #include "base/pi.h" #include "doc/algorithm/flip_image.h" @@ -93,10 +92,10 @@ MovingPixelsState::MovingPixelsState(Editor* editor, MouseMessage* msg, PixelsMo // Listen to any change to the transparent color from the ContextBar. m_opaqueConn = Preferences::instance().selection.opaque.AfterChange.connect( - base::Bind(&MovingPixelsState::onTransparentColorChange, this)); + [this]{ onTransparentColorChange(); }); m_transparentConn = Preferences::instance().selection.transparentColor.AfterChange.connect( - base::Bind(&MovingPixelsState::onTransparentColorChange, this)); + [this]{ onTransparentColorChange(); }); // Add the current editor as filter for key message of the manager // so we can catch the Enter key, and avoid to execute the diff --git a/src/app/ui/editor/pixels_movement.cpp b/src/app/ui/editor/pixels_movement.cpp index dc1883436..dae0097b1 100644 --- a/src/app/ui/editor/pixels_movement.cpp +++ b/src/app/ui/editor/pixels_movement.cpp @@ -1,5 +1,5 @@ // Aseprite -// Copyright (C) 2019 Igara Studio S.A. +// Copyright (C) 2019-2020 Igara Studio S.A. // Copyright (C) 2001-2018 David Capello // // This program is distributed under the terms of @@ -29,7 +29,6 @@ #include "app/util/expand_cel_canvas.h" #include "app/util/new_image_from_mask.h" #include "app/util/range_utils.h" -#include "base/bind.h" #include "base/pi.h" #include "base/vector2d.h" #include "doc/algorithm/flip_image.h" @@ -146,13 +145,13 @@ PixelsMovement::PixelsMovement( m_pivotVisConn = Preferences::instance().selection.pivotVisibility.AfterChange.connect( - base::Bind(&PixelsMovement::onPivotChange, this)); + [this]{ onPivotChange(); }); m_pivotPosConn = Preferences::instance().selection.pivotPosition.AfterChange.connect( - base::Bind(&PixelsMovement::onPivotChange, this)); + [this]{ onPivotChange(); }); m_rotAlgoConn = Preferences::instance().selection.rotationAlgorithm.AfterChange.connect( - base::Bind(&PixelsMovement::onRotationAlgorithmChange, this)); + [this]{ onRotationAlgorithmChange(); }); // The extra cel must be null, because if it's not null, it means // that someone else is using it (e.g. the editor brush preview), diff --git a/src/app/ui/editor/standby_state.cpp b/src/app/ui/editor/standby_state.cpp index e16fd555c..dc442ddc3 100644 --- a/src/app/ui/editor/standby_state.cpp +++ b/src/app/ui/editor/standby_state.cpp @@ -51,7 +51,6 @@ #include "app/util/layer_utils.h" #include "app/util/new_image_from_mask.h" #include "app/util/readable_time.h" -#include "base/bind.h" #include "base/pi.h" #include "doc/layer.h" #include "doc/mask.h" @@ -108,10 +107,10 @@ void StandbyState::onEnterState(Editor* editor) m_pivotVisConn = Preferences::instance().selection.pivotVisibility.AfterChange.connect( - base::Bind(&StandbyState::onPivotChange, this, editor)); + [this, editor]{ onPivotChange(editor); }); m_pivotPosConn = Preferences::instance().selection.pivotPosition.AfterChange.connect( - base::Bind(&StandbyState::onPivotChange, this, editor)); + [this, editor]{ onPivotChange(editor); }); } void StandbyState::onActiveToolChange(Editor* editor, tools::Tool* tool) diff --git a/src/app/ui/export_file_window.cpp b/src/app/ui/export_file_window.cpp index eed89e804..476279d7e 100644 --- a/src/app/ui/export_file_window.cpp +++ b/src/app/ui/export_file_window.cpp @@ -1,5 +1,5 @@ // Aseprite -// Copyright (C) 2019 Igara Studio S.A. +// Copyright (C) 2019-2020 Igara Studio S.A. // Copyright (C) 2018 David Capello // // This program is distributed under the terms of @@ -17,7 +17,6 @@ #include "app/site.h" #include "app/ui/layer_frame_comboboxes.h" #include "app/ui_context.h" -#include "base/bind.h" #include "base/convert_to.h" #include "base/fs.h" #include "base/string.h" @@ -70,25 +69,23 @@ ExportFileWindow::ExportFileWindow(const Doc* doc) updateAdjustResizeButton(); outputFilename()->Change.connect( - base::Bind( - [this]{ - m_outputFilename = outputFilename()->text(); - onOutputFilenameEntryChange(); - })); + [this]{ + m_outputFilename = outputFilename()->text(); + onOutputFilenameEntryChange(); + }); outputFilenameBrowse()->Click.connect( - base::Bind( - [this]{ - std::string fn = SelectOutputFile(); - if (!fn.empty()) { - setOutputFilename(fn); - } - })); + [this]{ + std::string fn = SelectOutputFile(); + if (!fn.empty()) { + setOutputFilename(fn); + } + }); - resize()->Change.connect(base::Bind(&ExportFileWindow::updateAdjustResizeButton, this)); - frames()->Change.connect(base::Bind(&ExportFileWindow::updateAniDir, this)); - forTwitter()->Click.connect(base::Bind(&ExportFileWindow::updateAdjustResizeButton, this)); - adjustResize()->Click.connect(base::Bind(&ExportFileWindow::onAdjustResize, this)); - ok()->Click.connect(base::Bind(&ExportFileWindow::onOK, this)); + resize()->Change.connect([this]{ updateAdjustResizeButton(); }); + frames()->Change.connect([this]{ updateAniDir(); }); + forTwitter()->Click.connect([this]{ updateAdjustResizeButton(); }); + adjustResize()->Click.connect([this]{ onAdjustResize(); }); + ok()->Click.connect([this]{ onOK(); }); } bool ExportFileWindow::show() diff --git a/src/app/ui/file_selector.cpp b/src/app/ui/file_selector.cpp index 5878fd08b..1e8e2f6ca 100644 --- a/src/app/ui/file_selector.cpp +++ b/src/app/ui/file_selector.cpp @@ -1,5 +1,5 @@ // Aseprite -// Copyright (C) 2019 Igara Studio S.A. +// Copyright (C) 2019-2020 Igara Studio S.A. // Copyright (C) 2001-2018 David Capello // // This program is distributed under the terms of @@ -24,7 +24,6 @@ #include "app/ui/separator_in_view.h" #include "app/ui/skin/skin_theme.h" #include "app/widget_loader.h" -#include "base/bind.h" #include "base/clamp.h" #include "base/convert_to.h" #include "base/fs.h" @@ -336,16 +335,16 @@ FileSelector::FileSelector(FileSelectorType type) m_fileView->setExpansive(true); fileViewPlaceholder()->addChild(m_fileView); - goBackButton()->Click.connect(base::Bind(&FileSelector::onGoBack, this)); - goForwardButton()->Click.connect(base::Bind(&FileSelector::onGoForward, this)); - goUpButton()->Click.connect(base::Bind(&FileSelector::onGoUp, this)); - newFolderButton()->Click.connect(base::Bind(&FileSelector::onNewFolder, this)); - viewType()->ItemChange.connect(base::Bind(&FileSelector::onChangeViewType, this)); - location()->CloseListBox.connect(base::Bind(&FileSelector::onLocationCloseListBox, this)); - fileType()->Change.connect(base::Bind(&FileSelector::onFileTypeChange, this)); - m_fileList->FileSelected.connect(base::Bind(&FileSelector::onFileListFileSelected, this)); - m_fileList->FileAccepted.connect(base::Bind(&FileSelector::onFileListFileAccepted, this)); - m_fileList->CurrentFolderChanged.connect(base::Bind(&FileSelector::onFileListCurrentFolderChanged, this)); + goBackButton()->Click.connect([this]{ onGoBack(); }); + goForwardButton()->Click.connect([this]{ onGoForward(); }); + goUpButton()->Click.connect([this]{ onGoUp(); }); + newFolderButton()->Click.connect([this]{ onNewFolder(); }); + viewType()->ItemChange.connect([this]{ onChangeViewType(); }); + location()->CloseListBox.connect([this]{ onLocationCloseListBox(); }); + fileType()->Change.connect([this]{ onFileTypeChange(); }); + m_fileList->FileSelected.connect([this]{ onFileListFileSelected(); }); + m_fileList->FileAccepted.connect([this]{ onFileListFileAccepted(); }); + m_fileList->CurrentFolderChanged.connect([this]{ onFileListCurrentFolderChanged(); }); } void FileSelector::setDefaultExtension(const std::string& extension) diff --git a/src/app/ui/filename_field.cpp b/src/app/ui/filename_field.cpp index 79a897bb3..3b71571e3 100644 --- a/src/app/ui/filename_field.cpp +++ b/src/app/ui/filename_field.cpp @@ -1,5 +1,5 @@ // Aseprite -// Copyright (C) 2019 Igara Studio S.A. +// Copyright (C) 2019-2020 Igara Studio S.A. // // This program is distributed under the terms of // the End-User License Agreement for Aseprite. @@ -12,7 +12,6 @@ #include "app/i18n/strings.h" #include "app/ui/skin/skin_theme.h" -#include "base/bind.h" #include "base/fs.h" #include "ui/box.h" #include "ui/button.h" @@ -43,21 +42,19 @@ FilenameField::FilenameField(const Type type, if (m_entry) { m_entry->Change.connect( - base::Bind( - [this]{ - m_file = m_entry->text(); - Change(); - })); + [this]{ + m_file = m_entry->text(); + Change(); + }); } m_button.Click.connect( - base::Bind( - [this]{ - std::string fn = SelectFile(); - if (!fn.empty()) { - setFilename(fn); - } - })); + [this]{ + std::string fn = SelectFile(); + if (!fn.empty()) { + setFilename(fn); + } + }); initTheme(); } diff --git a/src/app/ui/font_popup.cpp b/src/app/ui/font_popup.cpp index 7424ea997..96105bfcc 100644 --- a/src/app/ui/font_popup.cpp +++ b/src/app/ui/font_popup.cpp @@ -21,7 +21,6 @@ #include "app/ui_context.h" #include "app/util/conversion_to_surface.h" #include "app/util/freetype_utils.h" -#include "base/bind.h" #include "base/fs.h" #include "base/string.h" #include "doc/image.h" @@ -144,11 +143,11 @@ FontPopup::FontPopup() addChild(m_popup); - m_popup->search()->Change.connect(base::Bind(&FontPopup::onSearchChange, this)); - m_popup->loadFont()->Click.connect(base::Bind(&FontPopup::onLoadFont, this)); + m_popup->search()->Change.connect([this]{ onSearchChange(); }); + m_popup->loadFont()->Click.connect([this]{ onLoadFont(); }); m_listBox.setFocusMagnet(true); - m_listBox.Change.connect(base::Bind(&FontPopup::onChangeFont, this)); - m_listBox.DoubleClickItem.connect(base::Bind(&FontPopup::onLoadFont, this)); + m_listBox.Change.connect([this]{ onChangeFont(); }); + m_listBox.DoubleClickItem.connect([this]{ onLoadFont(); }); m_popup->view()->attachToView(&m_listBox); diff --git a/src/app/ui/home_view.cpp b/src/app/ui/home_view.cpp index c8cc5c974..f8b8e82cc 100644 --- a/src/app/ui/home_view.cpp +++ b/src/app/ui/home_view.cpp @@ -25,7 +25,6 @@ #include "app/ui/workspace.h" #include "app/ui/workspace_tabs.h" #include "app/ui_context.h" -#include "base/bind.h" #include "base/exception.h" #include "fmt/format.h" #include "ui/label.h" @@ -53,10 +52,10 @@ HomeView::HomeView() , m_dataRecovery(App::instance()->dataRecovery()) , m_dataRecoveryView(nullptr) { - newFile()->Click.connect(base::Bind(&HomeView::onNewFile, this)); - openFile()->Click.connect(base::Bind(&HomeView::onOpenFile, this)); + newFile()->Click.connect([this]{ onNewFile(); }); + openFile()->Click.connect([this]{ onOpenFile(); }); if (m_dataRecovery) - recoverSprites()->Click.connect(base::Bind(&HomeView::onRecoverSprites, this)); + recoverSprites()->Click.connect([this]{ onRecoverSprites(); }); else recoverSprites()->setVisible(false); diff --git a/src/app/ui/main_menu_bar.cpp b/src/app/ui/main_menu_bar.cpp index e6e7b109e..85e38f2df 100644 --- a/src/app/ui/main_menu_bar.cpp +++ b/src/app/ui/main_menu_bar.cpp @@ -14,7 +14,6 @@ #include "app/app.h" #include "app/app_menus.h" #include "app/extensions.h" -#include "base/bind.h" namespace app { @@ -24,7 +23,7 @@ MainMenuBar::MainMenuBar() m_extScripts = extensions.ScriptsChange.connect( - base::Bind(&MainMenuBar::reload, this)); + [this]{ reload(); }); } void MainMenuBar::reload() diff --git a/src/app/ui/main_window.cpp b/src/app/ui/main_window.cpp index d2c264b04..fca7d4eb5 100644 --- a/src/app/ui/main_window.cpp +++ b/src/app/ui/main_window.cpp @@ -38,7 +38,6 @@ #include "app/ui/workspace.h" #include "app/ui/workspace_tabs.h" #include "app/ui_context.h" -#include "base/bind.h" #include "base/fs.h" #include "os/display.h" #include "os/system.h" @@ -153,10 +152,8 @@ MainWindow::MainWindow() // Reconfigure workspace when the timeline position is changed. auto& pref = Preferences::instance(); - pref.general.timelinePosition - .AfterChange.connect(base::Bind(&MainWindow::configureWorkspaceLayout, this)); - pref.general.showMenuBar - .AfterChange.connect(base::Bind(&MainWindow::configureWorkspaceLayout, this)); + pref.general.timelinePosition.AfterChange.connect([this]{ configureWorkspaceLayout(); }); + pref.general.showMenuBar.AfterChange.connect([this]{ configureWorkspaceLayout(); }); // Prepare the window remapWindow(); diff --git a/src/app/ui/palette_popup.cpp b/src/app/ui/palette_popup.cpp index 31e6bb032..a6467aed6 100644 --- a/src/app/ui/palette_popup.cpp +++ b/src/app/ui/palette_popup.cpp @@ -1,4 +1,5 @@ // Aseprite +// Copyright (C) 2020 Igara Studio S.A. // Copyright (C) 2001-2018 David Capello // // This program is distributed under the terms of @@ -19,7 +20,6 @@ #include "app/ui/palettes_listbox.h" #include "app/ui/search_entry.h" #include "app/ui_context.h" -#include "base/bind.h" #include "ui/box.h" #include "ui/button.h" #include "ui/scale.h" @@ -41,10 +41,10 @@ PalettePopup::PalettePopup() addChild(m_popup); - m_paletteListBox.DoubleClickItem.connect(base::Bind(&PalettePopup::onLoadPal, this)); - m_popup->search()->Change.connect(base::Bind(&PalettePopup::onSearchChange, this)); - m_popup->loadPal()->Click.connect(base::Bind(&PalettePopup::onLoadPal, this)); - m_popup->openFolder()->Click.connect(base::Bind(&PalettePopup::onOpenFolder, this)); + m_paletteListBox.DoubleClickItem.connect([this]{ onLoadPal(); }); + m_popup->search()->Change.connect([this]{ onSearchChange(); }); + m_popup->loadPal()->Click.connect([this]{ onLoadPal(); }); + m_popup->openFolder()->Click.connect([this]{ onOpenFolder(); }); m_popup->view()->attachToView(&m_paletteListBox); diff --git a/src/app/ui/palette_view.cpp b/src/app/ui/palette_view.cpp index c259cc953..67ec5a205 100644 --- a/src/app/ui/palette_view.cpp +++ b/src/app/ui/palette_view.cpp @@ -23,7 +23,6 @@ #include "app/ui/status_bar.h" #include "app/util/clipboard.h" #include "app/util/pal_ops.h" -#include "base/bind.h" #include "base/clamp.h" #include "base/convert_to.h" #include "doc/image.h" @@ -72,7 +71,7 @@ PaletteView::PaletteView(bool editable, PaletteViewStyle style, PaletteViewDeleg m_palConn = App::instance()->PaletteChange.connect(&PaletteView::onAppPaletteChange, this); m_csConn = App::instance()->ColorSpaceChange.connect( - base::Bind(&PaletteView::invalidate, this)); + [this]{ invalidate(); }); { auto& entriesSep = Preferences::instance().colorBar.entriesSeparator; diff --git a/src/app/ui/palettes_listbox.cpp b/src/app/ui/palettes_listbox.cpp index e23896d82..ca222efbf 100644 --- a/src/app/ui/palettes_listbox.cpp +++ b/src/app/ui/palettes_listbox.cpp @@ -1,4 +1,5 @@ // Aseprite +// Copyright (C) 2020 Igara Studio S.A. // Copyright (C) 2001-2017 David Capello // // This program is distributed under the terms of @@ -21,7 +22,6 @@ #include "app/ui/icon_button.h" #include "app/ui/skin/skin_theme.h" #include "app/ui_context.h" -#include "base/bind.h" #include "base/launcher.h" #include "doc/palette.h" #include "doc/sprite.h" @@ -123,7 +123,7 @@ PalettesListBox::PalettesListBox() m_extPaletteChanges = App::instance()->extensions().PalettesChange.connect( - base::Bind(&PalettesListBox::reload, this)); + [this]{ reload(); }); } doc::Palette* PalettesListBox::selectedPalette() diff --git a/src/app/ui/popup_window_pin.cpp b/src/app/ui/popup_window_pin.cpp index 4d140c920..597b51f96 100644 --- a/src/app/ui/popup_window_pin.cpp +++ b/src/app/ui/popup_window_pin.cpp @@ -1,4 +1,5 @@ // Aseprite +// Copyright (C) 2020 Igara Studio S.A. // Copyright (C) 2001-2017 David Capello // // This program is distributed under the terms of @@ -13,7 +14,6 @@ #include "app/modules/gfx.h" #include "app/modules/gui.h" #include "app/ui/skin/skin_theme.h" -#include "base/bind.h" #include "gfx/border.h" #include "gfx/size.h" #include "ui/ui.h" diff --git a/src/app/ui/preview_editor.cpp b/src/app/ui/preview_editor.cpp index a7e2d8d2b..3439ec432 100644 --- a/src/app/ui/preview_editor.cpp +++ b/src/app/ui/preview_editor.cpp @@ -26,7 +26,6 @@ #include "app/ui/status_bar.h" #include "app/ui/toolbar.h" #include "app/ui_context.h" -#include "base/bind.h" #include "doc/sprite.h" #include "gfx/rect.h" #include "ui/base.h" @@ -186,9 +185,9 @@ PreviewEditorWindow::PreviewEditorWindow() m_isEnabled = get_config_bool("MiniEditor", "Enabled", true); - m_centerButton->Click.connect(base::Bind(&PreviewEditorWindow::onCenterClicked, this)); - m_playButton->Click.connect(base::Bind(&PreviewEditorWindow::onPlayClicked, this)); - m_playButton->Popup.connect(base::Bind(&PreviewEditorWindow::onPopupSpeed, this)); + m_centerButton->Click.connect([this]{ onCenterClicked(); }); + m_playButton->Click.connect([this]{ onPlayClicked(); }); + m_playButton->Popup.connect([this]{ onPopupSpeed(); }); addChild(m_centerButton); addChild(m_playButton); diff --git a/src/app/ui/recent_listbox.cpp b/src/app/ui/recent_listbox.cpp index 2717ea497..218eb43f5 100644 --- a/src/app/ui/recent_listbox.cpp +++ b/src/app/ui/recent_listbox.cpp @@ -1,5 +1,5 @@ // Aseprite -// Copyright (C) 2018 Igara Studio S.A. +// Copyright (C) 2018-2020 Igara Studio S.A. // Copyright (C) 2001-2018 David Capello // // This program is distributed under the terms of @@ -20,7 +20,6 @@ #include "app/ui/draggable_widget.h" #include "app/ui/skin/skin_theme.h" #include "app/ui_context.h" -#include "base/bind.h" #include "base/fs.h" #include "ui/alert.h" #include "ui/graphics.h" @@ -233,11 +232,11 @@ RecentListBox::RecentListBox() { m_recentFilesConn = App::instance()->recentFiles()->Changed.connect( - base::Bind(&RecentListBox::rebuildList, this)); + [this]{ rebuildList(); }); m_showFullPathConn = Preferences::instance().general.showFullPath.AfterChange.connect( - base::Bind(&RecentListBox::invalidate, this)); + [this]{ invalidate(); }); } void RecentListBox::rebuildList() diff --git a/src/app/ui/resources_listbox.cpp b/src/app/ui/resources_listbox.cpp index 2c8e23d46..12683591a 100644 --- a/src/app/ui/resources_listbox.cpp +++ b/src/app/ui/resources_listbox.cpp @@ -1,4 +1,5 @@ // Aseprite +// Copyright (C) 2020 Igara Studio S.A. // Copyright (C) 2001-2018 David Capello // // This program is distributed under the terms of @@ -13,7 +14,6 @@ #include "app/res/resource.h" #include "app/res/resources_loader.h" #include "app/ui/skin/skin_theme.h" -#include "base/bind.h" #include "ui/graphics.h" #include "ui/message.h" #include "ui/paint_event.h" @@ -114,7 +114,7 @@ ResourcesListBox::ResourcesListBox(ResourcesLoader* resourcesLoader) , m_reload(false) , m_loadingItem(nullptr) { - m_resourcesTimer.Tick.connect(base::Bind(&ResourcesListBox::onTick, this)); + m_resourcesTimer.Tick.connect([this]{ onTick(); }); } Resource* ResourcesListBox::selectedResource() diff --git a/src/app/ui/select_accelerator.cpp b/src/app/ui/select_accelerator.cpp index 094cf05d2..ac0919f89 100644 --- a/src/app/ui/select_accelerator.cpp +++ b/src/app/ui/select_accelerator.cpp @@ -1,4 +1,5 @@ // Aseprite +// Copyright (C) 2020 Igara Studio S.A. // Copyright (C) 2001-2018 David Capello // // This program is distributed under the terms of @@ -12,7 +13,6 @@ #include "app/ui/key.h" #include "app/ui/keyboard_shortcuts.h" -#include "base/bind.h" #include "obs/signal.h" #include "ui/entry.h" #include "ui/message.h" @@ -101,17 +101,17 @@ SelectAccelerator::SelectAccelerator(const ui::Accelerator& accel, keyPlaceholder()->addChild(m_keyField); - alt()->Click.connect(base::Bind(&SelectAccelerator::onModifierChange, this, kKeyAltModifier, alt())); - cmd()->Click.connect(base::Bind(&SelectAccelerator::onModifierChange, this, kKeyCmdModifier, cmd())); - ctrl()->Click.connect(base::Bind(&SelectAccelerator::onModifierChange, this, kKeyCtrlModifier, ctrl())); - shift()->Click.connect(base::Bind(&SelectAccelerator::onModifierChange, this, kKeyShiftModifier, shift())); - space()->Click.connect(base::Bind(&SelectAccelerator::onModifierChange, this, kKeySpaceModifier, space())); - win()->Click.connect(base::Bind(&SelectAccelerator::onModifierChange, this, kKeyWinModifier, win())); + alt()->Click.connect([this]{ onModifierChange(kKeyAltModifier, alt()); }); + cmd()->Click.connect([this]{ onModifierChange(kKeyCmdModifier, cmd()); }); + ctrl()->Click.connect([this]{ onModifierChange(kKeyCtrlModifier, ctrl()); }); + shift()->Click.connect([this]{ onModifierChange(kKeyShiftModifier, shift()); }); + space()->Click.connect([this]{ onModifierChange(kKeySpaceModifier, space()); }); + win()->Click.connect([this]{ onModifierChange(kKeyWinModifier, win()); }); m_keyField->AccelChange.connect(&SelectAccelerator::onAccelChange, this); - clearButton()->Click.connect(base::Bind(&SelectAccelerator::onClear, this)); - okButton()->Click.connect(base::Bind(&SelectAccelerator::onOK, this)); - cancelButton()->Click.connect(base::Bind(&SelectAccelerator::onCancel, this)); + clearButton()->Click.connect([this]{ onClear(); }); + okButton()->Click.connect([this]{ onOK(); }); + cancelButton()->Click.connect([this]{ onCancel(); }); addChild(&m_tooltipManager); } diff --git a/src/app/ui/skin/skin_theme.cpp b/src/app/ui/skin/skin_theme.cpp index 2eb0b2284..21ee60721 100644 --- a/src/app/ui/skin/skin_theme.cpp +++ b/src/app/ui/skin/skin_theme.cpp @@ -25,7 +25,6 @@ #include "app/ui/skin/skin_slider_property.h" #include "app/xml_document.h" #include "app/xml_exception.h" -#include "base/bind.h" #include "base/clamp.h" #include "base/fs.h" #include "base/log.h" diff --git a/src/app/ui/slice_window.cpp b/src/app/ui/slice_window.cpp index cee37936c..b968c6338 100644 --- a/src/app/ui/slice_window.cpp +++ b/src/app/ui/slice_window.cpp @@ -1,5 +1,5 @@ // Aseprite -// Copyright (C) 2019 Igara Studio S.A. +// Copyright (C) 2019-2020 Igara Studio S.A. // Copyright (C) 2017 David Capello // // This program is distributed under the terms of @@ -13,7 +13,6 @@ #include "app/doc.h" #include "app/ui/user_data_popup.h" -#include "base/bind.h" #include "doc/slice.h" #include "doc/sprite.h" @@ -30,7 +29,7 @@ SliceWindow::SliceWindow(const doc::Sprite* sprite, Slice* slice = slices.frontAs(); m_userData = slice->userData(); - userData()->Click.connect(base::Bind(&SliceWindow::onPopupUserData, this)); + userData()->Click.connect([this]{ onPopupUserData(); }); if (slices.size() == 1) { // If we are going to edit just one slice, we indicate like all @@ -51,8 +50,8 @@ SliceWindow::SliceWindow(const doc::Sprite* sprite, boundsW()->setTextf("%d", key->bounds().w); boundsH()->setTextf("%d", key->bounds().h); - center()->Click.connect(base::Bind(&SliceWindow::onCenterChange, this)); - pivot()->Click.connect(base::Bind(&SliceWindow::onPivotChange, this)); + center()->Click.connect([this]{ onCenterChange(); }); + pivot()->Click.connect([this]{ onPivotChange(); }); if (key->hasCenter()) { center()->setSelected(true); diff --git a/src/app/ui/slider2.cpp b/src/app/ui/slider2.cpp index 7e99947a4..85f66bf92 100644 --- a/src/app/ui/slider2.cpp +++ b/src/app/ui/slider2.cpp @@ -12,7 +12,6 @@ #include "app/ui/slider2.h" #include "app/ui/skin/skin_property.h" -#include "base/bind.h" #include "base/clamp.h" #include "ui/manager.h" #include "ui/message.h" @@ -97,8 +96,8 @@ Slider2::Slider2(int min, int max, int value) m_slider.setSizeHint(gfx::Size(128, 0)); skin::get_skin_property(&m_entry)->setLook(skin::MiniLook); - m_slider.Change.connect(base::Bind(&Slider2::onSliderChange, this)); - m_entry.Change.connect(base::Bind(&Slider2::onEntryChange, this)); + m_slider.Change.connect([this]{ onSliderChange(); }); + m_entry.Change.connect([this]{ onEntryChange(); }); addChild(&m_slider); addChild(&m_entry); diff --git a/src/app/ui/status_bar.cpp b/src/app/ui/status_bar.cpp index f31d74472..564d5f0cd 100644 --- a/src/app/ui/status_bar.cpp +++ b/src/app/ui/status_bar.cpp @@ -35,7 +35,6 @@ #include "app/ui/zoom_entry.h" #include "app/ui_context.h" #include "app/util/range_utils.h" -#include "base/bind.h" #include "base/fs.h" #include "base/string.h" #include "doc/image.h" @@ -473,7 +472,7 @@ public: makeFloating(); addChild(&m_button); - m_button.Click.connect(base::Bind(&SnapToGridWindow::onDisableSnapToGrid, this)); + m_button.Click.connect([this]{ onDisableSnapToGrid(); }); } void setDocument(Doc* doc) { @@ -566,7 +565,7 @@ StatusBar::StatusBar(TooltipManager* tooltipManager) m_frameLabel = new Label("Frame:"); m_currentFrame = new GotoFrameEntry(); m_newFrame = new Button("+"); - m_newFrame->Click.connect(base::Bind(&StatusBar::newFrame, this)); + m_newFrame->Click.connect([this]{ newFrame(); }); m_zoomEntry = new ZoomEntry; m_zoomEntry->ZoomChange.connect(&StatusBar::onChangeZoom, this); diff --git a/src/app/ui/timeline/ani_controls.cpp b/src/app/ui/timeline/ani_controls.cpp index 3a238a7c1..706c80d4b 100644 --- a/src/app/ui/timeline/ani_controls.cpp +++ b/src/app/ui/timeline/ani_controls.cpp @@ -1,5 +1,5 @@ // Aseprite -// Copyright (C) 2018 Igara Studio S.A. +// Copyright (C) 2018-2020 Igara Studio S.A. // Copyright (C) 2001-2017 David Capello // // This program is distributed under the terms of @@ -18,7 +18,6 @@ #include "app/ui/keyboard_shortcuts.h" #include "app/ui/skin/skin_theme.h" #include "app/ui_context.h" -#include "base/bind.h" #include "ui/tooltips.h" #include @@ -50,7 +49,7 @@ AniControls::AniControls(TooltipManager* tooltipManager) addItem(theme->parts.aniPlay()); addItem(theme->parts.aniNext()); addItem(theme->parts.aniLast()); - ItemChange.connect(base::Bind(&AniControls::onClickButton, this)); + ItemChange.connect([this]{ onClickButton(); }); setTriggerOnMouseUp(true); setTransparent(true); diff --git a/src/app/ui/timeline/timeline.cpp b/src/app/ui/timeline/timeline.cpp index 96c5a024c..16e253ec8 100644 --- a/src/app/ui/timeline/timeline.cpp +++ b/src/app/ui/timeline/timeline.cpp @@ -44,7 +44,6 @@ #include "app/util/layer_boundaries.h" #include "app/util/layer_utils.h" #include "app/util/readable_time.h" -#include "base/bind.h" #include "base/clamp.h" #include "base/convert_to.h" #include "base/memory.h" @@ -354,7 +353,7 @@ void Timeline::updateUsingEditor(Editor* editor) DocumentPreferences& docPref = Preferences::instance().document(app_document); m_thumbnailsPrefConn = docPref.thumbnails.AfterChange.connect( - base::Bind(&Timeline::onThumbnailsPrefChange, this)); + [this]{ onThumbnailsPrefChange(); }); setZoom( docPref.thumbnails.enabled() ? @@ -377,7 +376,7 @@ void Timeline::updateUsingEditor(Editor* editor) m_clk.part = PART_NOTHING; m_firstFrameConn = Preferences::instance().document(m_document) - .timeline.firstFrame.AfterChange.connect(base::Bind(&Timeline::invalidate, this)); + .timeline.firstFrame.AfterChange.connect([this]{ invalidate(); }); setFocusStop(true); regenerateRows(); diff --git a/src/app/ui/toolbar.cpp b/src/app/ui/toolbar.cpp index b03ea9eef..5bb21e40c 100644 --- a/src/app/ui/toolbar.cpp +++ b/src/app/ui/toolbar.cpp @@ -1,5 +1,5 @@ // Aseprite -// Copyright (C) 2018 Igara Studio S.A. +// Copyright (C) 2018-2020 Igara Studio S.A. // Copyright (C) 2001-2018 David Capello // // This program is distributed under the terms of @@ -25,7 +25,6 @@ #include "app/ui/skin/skin_theme.h" #include "app/ui/status_bar.h" #include "app/ui_context.h" -#include "base/bind.h" #include "fmt/format.h" #include "gfx/size.h" #include "obs/signal.h" @@ -405,7 +404,7 @@ void ToolBar::openPopupWindow(int group_index, ToolGroup* tool_group) // In case this tool contains more than just one tool, show the popup window m_popupWindow = new TransparentPopupWindow(PopupWindow::ClickBehavior::CloseOnClickOutsideHotRegion); - m_closeConn = m_popupWindow->Close.connect(base::Bind(&ToolBar::onClosePopup, this)); + m_closeConn = m_popupWindow->Close.connect([this]{ onClosePopup(); }); m_openedRecently = true; ToolStrip* toolstrip = new ToolStrip(tool_group, this); diff --git a/src/app/widget_loader.cpp b/src/app/widget_loader.cpp index 684911d05..3a3ccf5a2 100644 --- a/src/app/widget_loader.cpp +++ b/src/app/widget_loader.cpp @@ -1,5 +1,5 @@ // Aseprite -// Copyright (C) 2019 Igara Studio S.A. +// Copyright (C) 2019-2020 Igara Studio S.A. // Copyright (C) 2001-2018 David Capello // // This program is distributed under the terms of @@ -27,7 +27,6 @@ #include "app/widget_not_found.h" #include "app/xml_document.h" #include "app/xml_exception.h" -#include "base/bind.h" #include "base/exception.h" #include "base/fs.h" #include "base/memory.h" @@ -184,7 +183,7 @@ Widget* WidgetLoader::convertXmlElementToWidget(const TiXmlElement* elem, Widget if (closewindow) { static_cast(widget) - ->Click.connect(base::Bind(&Widget::closeWindow, widget)); + ->Click.connect([widget]{ widget->closeWindow(); }); } } else if (elem_name == "check") { diff --git a/src/observable b/src/observable index 62da6c427..a9d766bd4 160000 --- a/src/observable +++ b/src/observable @@ -1 +1 @@ -Subproject commit 62da6c4279528505a0fb0e7e31afb9b82cd5aea9 +Subproject commit a9d766bd495b0af0f5da8c717c3e9061290a5a9e diff --git a/src/ui/alert.cpp b/src/ui/alert.cpp index c1696d207..f2c59281c 100644 --- a/src/ui/alert.cpp +++ b/src/ui/alert.cpp @@ -1,5 +1,5 @@ // Aseprite UI Library -// Copyright (C) 2019 Igara Studio S.A. +// Copyright (C) 2019-2020 Igara Studio S.A. // Copyright (C) 2001-2018 David Capello // // This file is released under the terms of the MIT license. @@ -35,7 +35,6 @@ #include "ui/alert.h" -#include "base/bind.h" #include "base/clamp.h" #include "base/string.h" #include "ui/box.h" @@ -119,7 +118,7 @@ void Alert::addButton(const std::string& text) char id[256]; sprintf(id, "button-%lu", m_buttons.size()); button->setId(id); - button->Click.connect(base::Bind(&Window::closeWindow, this, button)); + button->Click.connect([this, button]{ closeWindow(button); }); m_buttonsPlaceholder->addChild(button); } diff --git a/src/ui/entry.cpp b/src/ui/entry.cpp index baf90eaae..cab714a69 100644 --- a/src/ui/entry.cpp +++ b/src/ui/entry.cpp @@ -11,7 +11,6 @@ #include "ui/entry.h" -#include "base/bind.h" #include "base/clamp.h" #include "base/string.h" #include "os/draw_text.h" @@ -809,9 +808,9 @@ void Entry::showEditPopupMenu(const gfx::Point& pt) menu.addChild(&cut); menu.addChild(©); menu.addChild(&paste); - cut.Click.connect(base::Bind(&Entry::executeCmd, this, EntryCmd::Cut, 0, false)); - copy.Click.connect(base::Bind(&Entry::executeCmd, this, EntryCmd::Copy, 0, false)); - paste.Click.connect(base::Bind(&Entry::executeCmd, this, EntryCmd::Paste, 0, false)); + cut.Click.connect([this]{ executeCmd(EntryCmd::Cut, 0, false); }); + copy.Click.connect([this]{ executeCmd(EntryCmd::Copy, 0, false); }); + paste.Click.connect([this]{ executeCmd(EntryCmd::Paste, 0, false); }); if (isReadOnly()) { cut.setEnabled(false); diff --git a/src/updater/check_update.cpp b/src/updater/check_update.cpp index af168fe1d..cb581d3ef 100644 --- a/src/updater/check_update.cpp +++ b/src/updater/check_update.cpp @@ -11,7 +11,6 @@ #include "updater/check_update.h" -#include "base/bind.h" #include "base/convert_to.h" #include "base/debug.h" #include "net/http_headers.h"