mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-01 10:13:22 +00:00
Move Editor cursor color to pref.xml
This commit is contained in:
parent
1144ef6fd3
commit
12e28960e4
@ -55,6 +55,7 @@
|
||||
<option id="right_click_mode" type="RightClickMode" default="RightClickMode::PAINT_BGCOLOR" migrate="Options.RightClickMode" />
|
||||
<option id="grab_alpha" type="bool" default="false" migrate="Options.GrabAlpha" />
|
||||
<option id="auto_select_layer" type="bool" default="false" migrate="Options.AutoSelectLayer" />
|
||||
<option id="cursor_color" type="app::Color" default="app::Color::fromMask()" migrate="Tools.CursorColor" />
|
||||
</section>
|
||||
<section id="experimental" text="Experimental">
|
||||
<option id="ui_scale" type="int" default="1" />
|
||||
|
@ -164,7 +164,7 @@ void App::initialize(const AppOptions& options)
|
||||
FileFormatsManager::instance()->registerAllFormats();
|
||||
|
||||
// init editor cursor
|
||||
Editor::editor_cursor_init();
|
||||
Editor::initEditorCursor();
|
||||
|
||||
if (isPortable())
|
||||
PRINTF("Running in portable mode\n");
|
||||
@ -609,7 +609,7 @@ App::~App()
|
||||
App::instance()->Exit();
|
||||
|
||||
// Finalize modules, configuration and core.
|
||||
Editor::editor_cursor_exit();
|
||||
Editor::exitEditorCursor();
|
||||
boundary_exit();
|
||||
|
||||
delete m_legacy;
|
||||
|
@ -22,7 +22,6 @@
|
||||
#include "app/resource_finder.h"
|
||||
#include "app/send_crash.h"
|
||||
#include "app/ui/color_button.h"
|
||||
#include "app/ui/editor/editor.h"
|
||||
#include "base/bind.h"
|
||||
#include "base/convert_to.h"
|
||||
#include "base/path.h"
|
||||
@ -48,7 +47,7 @@ public:
|
||||
, m_checked_bg_color2(new ColorButton(app::Color::fromMask(), IMAGE_RGB))
|
||||
, m_pixelGridColor(new ColorButton(app::Color::fromMask(), IMAGE_RGB))
|
||||
, m_gridColor(new ColorButton(app::Color::fromMask(), IMAGE_RGB))
|
||||
, m_cursorColor(new ColorButton(Editor::get_cursor_color(), IMAGE_RGB))
|
||||
, m_cursorColor(new ColorButton(m_preferences.editor.cursorColor(), IMAGE_RGB))
|
||||
, m_curSection(curSection)
|
||||
{
|
||||
sectionListbox()->ChangeSelectedItem.connect(Bind<void>(&OptionsWindow::onChangeSection, this));
|
||||
@ -155,7 +154,6 @@ public:
|
||||
}
|
||||
|
||||
void saveConfig() {
|
||||
Editor::set_cursor_color(m_cursorColor->getColor());
|
||||
m_preferences.general.autoshowTimeline(autotimeline()->isSelected());
|
||||
|
||||
bool expandOnMouseover = expandMenubarOnMouseover()->isSelected();
|
||||
@ -178,6 +176,7 @@ public:
|
||||
m_preferences.editor.showScrollbars(showScrollbars()->isSelected());
|
||||
m_preferences.editor.zoomWithWheel(wheelZoom()->isSelected());
|
||||
m_preferences.editor.rightClickMode(static_cast<app::gen::RightClickMode>(rightClickBehavior()->getSelectedItemIndex()));
|
||||
m_preferences.editor.cursorColor(m_cursorColor->getColor());
|
||||
|
||||
m_curPref->grid.color(m_gridColor->getColor());
|
||||
m_curPref->grid.opacity(gridOpacity()->getValue());
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "app/ui/main_window.h"
|
||||
#include "app/ui_context.h"
|
||||
#include "app/util/boundary.h"
|
||||
#include "base/bind.h"
|
||||
#include "base/memory.h"
|
||||
#include "doc/algo.h"
|
||||
#include "doc/brush.h"
|
||||
@ -94,25 +95,15 @@ static color_t get_brush_color(Sprite* sprite, Layer* layer);
|
||||
// CURSOR COLOR
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
static app::Color cursor_color;
|
||||
static gfx::Color ui_cursor_color;
|
||||
static bool is_cursor_mask;
|
||||
|
||||
static void update_cursor_color()
|
||||
{
|
||||
ui_cursor_color = color_utils::color_for_ui(cursor_color);
|
||||
is_cursor_mask = (cursor_color.getType() == app::Color::MaskType);
|
||||
}
|
||||
app::Color color = Preferences::instance().editor.cursorColor();
|
||||
|
||||
app::Color Editor::get_cursor_color()
|
||||
{
|
||||
return cursor_color;
|
||||
}
|
||||
|
||||
void Editor::set_cursor_color(const app::Color& color)
|
||||
{
|
||||
cursor_color = color;
|
||||
update_cursor_color();
|
||||
ui_cursor_color = color_utils::color_for_ui(color);
|
||||
is_cursor_mask = (color.getType() == app::Color::MaskType);
|
||||
}
|
||||
|
||||
static Brush* get_current_brush()
|
||||
@ -120,23 +111,18 @@ static Brush* get_current_brush()
|
||||
return App::instance()->getMainWindow()->getContextBar()->activeBrush().get();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// CURSOR
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
void Editor::editor_cursor_init()
|
||||
void Editor::initEditorCursor()
|
||||
{
|
||||
// Cursor color
|
||||
set_cursor_color(get_config_color("Tools", "CursorColor", app::Color::fromMask()));
|
||||
update_cursor_color();
|
||||
|
||||
Preferences::instance().editor.cursorColor.AfterChange.connect(
|
||||
Bind<void>(&update_cursor_color));
|
||||
|
||||
App::instance()->PaletteChange.connect(&update_cursor_color);
|
||||
update_cursor_color();
|
||||
}
|
||||
|
||||
void Editor::editor_cursor_exit()
|
||||
void Editor::exitEditorCursor()
|
||||
{
|
||||
set_config_color("Tools", "CursorColor", cursor_color);
|
||||
|
||||
if (cursor_bound.seg)
|
||||
base_free(cursor_bound.seg);
|
||||
}
|
||||
|
@ -207,11 +207,8 @@ namespace app {
|
||||
|
||||
// in cursor.cpp
|
||||
|
||||
static app::Color get_cursor_color();
|
||||
static void set_cursor_color(const app::Color& color);
|
||||
|
||||
static void editor_cursor_init();
|
||||
static void editor_cursor_exit();
|
||||
static void initEditorCursor();
|
||||
static void exitEditorCursor();
|
||||
|
||||
protected:
|
||||
bool onProcessMessage(ui::Message* msg) override;
|
||||
|
Loading…
x
Reference in New Issue
Block a user