paint: add set source button to clone tool
This commit is contained in:
@@ -44,6 +44,7 @@ void context_init() {
|
|||||||
g_context->clone_start_y = -1.0;
|
g_context->clone_start_y = -1.0;
|
||||||
g_context->clone_delta_x = 0.0;
|
g_context->clone_delta_x = 0.0;
|
||||||
g_context->clone_delta_y = 0.0;
|
g_context->clone_delta_y = 0.0;
|
||||||
|
g_context->clone_set_source = false;
|
||||||
g_context->show_compass = true;
|
g_context->show_compass = true;
|
||||||
g_context->last_paint_vec_x = -1.0;
|
g_context->last_paint_vec_x = -1.0;
|
||||||
g_context->last_paint_vec_y = -1.0;
|
g_context->last_paint_vec_y = -1.0;
|
||||||
|
|||||||
@@ -478,6 +478,12 @@ void ui_header_draw_tool_properties() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (g_context->tool == TOOL_TYPE_CLONE) {
|
||||||
|
if (ui_button(g_context->clone_set_source ? tr("Setting Source") : tr("Set Source"), UI_ALIGN_CENTER, "")) {
|
||||||
|
g_context->clone_set_source = !g_context->clone_set_source;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (g_context->tool == TOOL_TYPE_BLUR) {
|
if (g_context->tool == TOOL_TYPE_BLUR) {
|
||||||
string_array_t *blur_type_combo = any_array_create_from_raw(
|
string_array_t *blur_type_combo = any_array_create_from_raw(
|
||||||
(void *[]){
|
(void *[]){
|
||||||
|
|||||||
@@ -1,14 +1,19 @@
|
|||||||
|
|
||||||
#include "../global.h"
|
#include "../global.h"
|
||||||
|
|
||||||
|
static bool util_brush_clone_source_down = false;
|
||||||
|
|
||||||
void util_brush_update() {
|
void util_brush_update() {
|
||||||
|
bool paint_down = operator_shortcut(any_map_get(g_keymap, "action_paint"), SHORTCUT_TYPE_DOWN);
|
||||||
|
|
||||||
bool set_clone_source =
|
bool set_clone_source =
|
||||||
g_context->tool == TOOL_TYPE_CLONE &&
|
g_context->tool == TOOL_TYPE_CLONE &&
|
||||||
operator_shortcut(string("%s+%s", any_map_get(g_keymap, "set_clone_source"), any_map_get(g_keymap, "action_paint")), SHORTCUT_TYPE_DOWN);
|
(operator_shortcut(string("%s+%s", any_map_get(g_keymap, "set_clone_source"), any_map_get(g_keymap, "action_paint")), SHORTCUT_TYPE_DOWN) ||
|
||||||
|
(g_context->clone_set_source && (paint_down || pen_down("tip"))));
|
||||||
|
|
||||||
bool decal_mask = context_is_decal_mask_paint();
|
bool decal_mask = context_is_decal_mask_paint();
|
||||||
|
|
||||||
bool down = operator_shortcut(any_map_get(g_keymap, "action_paint"), SHORTCUT_TYPE_DOWN) || decal_mask || set_clone_source ||
|
bool down = paint_down || decal_mask || set_clone_source ||
|
||||||
operator_shortcut(string("%s+%s", any_map_get(g_keymap, "brush_ruler"), any_map_get(g_keymap, "action_paint")), SHORTCUT_TYPE_DOWN) ||
|
operator_shortcut(string("%s+%s", any_map_get(g_keymap, "brush_ruler"), any_map_get(g_keymap, "action_paint")), SHORTCUT_TYPE_DOWN) ||
|
||||||
(pen_down("tip") && !keyboard_down("alt"));
|
(pen_down("tip") && !keyboard_down("alt"));
|
||||||
|
|
||||||
@@ -44,6 +49,7 @@ void util_brush_update() {
|
|||||||
if (set_clone_source) {
|
if (set_clone_source) {
|
||||||
g_context->clone_start_x = mx;
|
g_context->clone_start_x = mx;
|
||||||
g_context->clone_start_y = my;
|
g_context->clone_start_y = my;
|
||||||
|
util_brush_clone_source_down = true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (g_context->brush_time == 0 && !base_is_dragging && !base_is_resizing && g_ui->combo_selected_handle == NULL) { // Paint started
|
if (g_context->brush_time == 0 && !base_is_dragging && !base_is_resizing && g_ui->combo_selected_handle == NULL) { // Paint started
|
||||||
@@ -83,4 +89,10 @@ void util_brush_update() {
|
|||||||
sys_notify_on_next_frame(&ui_base_update_ui_on_next_frame, NULL);
|
sys_notify_on_next_frame(&ui_base_update_ui_on_next_frame, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (util_brush_clone_source_down && !paint_down && !pen_down("tip")) {
|
||||||
|
util_brush_clone_source_down = false;
|
||||||
|
g_context->clone_set_source = false;
|
||||||
|
ui_header_handle->redraws = 2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user