From 334b4ae3f8741c81a8288bf645328e3d3c7938d2 Mon Sep 17 00:00:00 2001 From: Relintai Date: Mon, 14 Nov 2022 17:46:37 +0100 Subject: [PATCH] Renamed PaintCanvas to PaintCanvasOld. --- modules/paint/actions/brighten_action.cpp | 2 +- modules/paint/actions/brighten_action.h | 4 +- modules/paint/actions/brush_action.cpp | 2 +- modules/paint/actions/brush_action.h | 4 +- modules/paint/actions/bucket_action.cpp | 2 +- modules/paint/actions/bucket_action.h | 4 +- modules/paint/actions/cut_action.cpp | 4 +- modules/paint/actions/cut_action.h | 6 +- modules/paint/actions/darken_action.cpp | 2 +- modules/paint/actions/darken_action.h | 4 +- modules/paint/actions/line_action.cpp | 4 +- modules/paint/actions/line_action.h | 6 +- modules/paint/actions/multiline_action.cpp | 2 +- modules/paint/actions/multiline_action.h | 6 +- modules/paint/actions/paint_action.cpp | 12 +- modules/paint/actions/paint_action.h | 14 +-- modules/paint/actions/paste_cut_action.cpp | 2 +- modules/paint/actions/paste_cut_action.h | 4 +- modules/paint/actions/pencil_action.cpp | 4 +- modules/paint/actions/pencil_action.h | 6 +- modules/paint/actions/rainbow_action.cpp | 2 +- modules/paint/actions/rainbow_action.h | 4 +- modules/paint/actions/rect_action.cpp | 4 +- modules/paint/actions/rect_action.h | 6 +- .../dialogs/paint_load_file_dialog.h | 4 +- .../dialogs/paint_save_file_dialog.h | 4 +- modules/paint/deprecated/paint_canvas.cpp | 118 +++++++++--------- modules/paint/deprecated/paint_canvas.h | 12 +- modules/paint/deprecated/paint_navbar.h | 4 +- modules/paint/deprecated/paint_window.cpp | 2 +- modules/paint/deprecated/paint_window.h | 4 +- 31 files changed, 129 insertions(+), 129 deletions(-) diff --git a/modules/paint/actions/brighten_action.cpp b/modules/paint/actions/brighten_action.cpp index d1b2be548..cc72c48fd 100644 --- a/modules/paint/actions/brighten_action.cpp +++ b/modules/paint/actions/brighten_action.cpp @@ -35,7 +35,7 @@ void BrightenAction::set_brighten_color(const float val) { brighten_color = val; } -void BrightenAction::do_action(PaintCanvas *canvas, const Array &data) { +void BrightenAction::do_action(PaintCanvasOld *canvas, const Array &data) { PaintAction::do_action(canvas, data); PoolVector2iArray pixels = PaintUtilities::get_pixels_in_line(data[0], data[1]); diff --git a/modules/paint/actions/brighten_action.h b/modules/paint/actions/brighten_action.h index 3ea14efb0..156517c8e 100644 --- a/modules/paint/actions/brighten_action.h +++ b/modules/paint/actions/brighten_action.h @@ -27,7 +27,7 @@ SOFTWARE. #include "paint_action.h" -class PaintCanvas; +class PaintCanvasOld; class BrightenAction : public PaintAction { GDCLASS(BrightenAction, PaintAction); @@ -36,7 +36,7 @@ public: float get_brighten_color(); void set_brighten_color(const float val); - void do_action(PaintCanvas *canvas, const Array &data); + void do_action(PaintCanvasOld *canvas, const Array &data); BrightenAction(); ~BrightenAction(); diff --git a/modules/paint/actions/brush_action.cpp b/modules/paint/actions/brush_action.cpp index 2bc3662ff..7f664856e 100644 --- a/modules/paint/actions/brush_action.cpp +++ b/modules/paint/actions/brush_action.cpp @@ -29,7 +29,7 @@ SOFTWARE. #include "../deprecated/paint_canvas_layer.h" #include "../paint_utilities.h" -void BrushAction::do_action(PaintCanvas *canvas, const Array &data) { +void BrushAction::do_action(PaintCanvasOld *canvas, const Array &data) { PaintAction::do_action(canvas, data); PoolVector2iArray pixels = PaintUtilities::get_pixels_in_line(data[0], data[1]); diff --git a/modules/paint/actions/brush_action.h b/modules/paint/actions/brush_action.h index cb53cfa8c..a4614f3da 100644 --- a/modules/paint/actions/brush_action.h +++ b/modules/paint/actions/brush_action.h @@ -27,13 +27,13 @@ SOFTWARE. #include "paint_action.h" -class PaintCanvas; +class PaintCanvasOld; class BrushAction : public PaintAction { GDCLASS(BrushAction, PaintAction); public: - void do_action(PaintCanvas *canvas, const Array &data); + void do_action(PaintCanvasOld *canvas, const Array &data); BrushAction(); ~BrushAction(); diff --git a/modules/paint/actions/bucket_action.cpp b/modules/paint/actions/bucket_action.cpp index 020ca43b1..beaf35954 100644 --- a/modules/paint/actions/bucket_action.cpp +++ b/modules/paint/actions/bucket_action.cpp @@ -28,7 +28,7 @@ SOFTWARE. #include "../deprecated/paint_canvas_layer.h" #include "../paint_utilities.h" -void BucketAction::do_action(PaintCanvas *canvas, const Array &data) { +void BucketAction::do_action(PaintCanvasOld *canvas, const Array &data) { PaintAction::do_action(canvas, data); Vector2i pos = data[0]; diff --git a/modules/paint/actions/bucket_action.h b/modules/paint/actions/bucket_action.h index 2ec6f9664..32b8f4cdb 100644 --- a/modules/paint/actions/bucket_action.h +++ b/modules/paint/actions/bucket_action.h @@ -27,13 +27,13 @@ SOFTWARE. #include "paint_action.h" -class PaintCanvas; +class PaintCanvasOld; class BucketAction : public PaintAction { GDCLASS(BucketAction, PaintAction); public: - void do_action(PaintCanvas *canvas, const Array &data); + void do_action(PaintCanvasOld *canvas, const Array &data); BucketAction(); ~BucketAction(); diff --git a/modules/paint/actions/cut_action.cpp b/modules/paint/actions/cut_action.cpp index a2fd5e60b..c26ec60f2 100644 --- a/modules/paint/actions/cut_action.cpp +++ b/modules/paint/actions/cut_action.cpp @@ -60,7 +60,7 @@ bool CutAction::can_commit() { return false; //ugly way of handling a cut } -void CutAction::do_action(PaintCanvas *canvas, const Array &data) { +void CutAction::do_action(PaintCanvasOld *canvas, const Array &data) { PaintAction::do_action(canvas, data); if (!mouse_start_pos_set) { @@ -91,7 +91,7 @@ void CutAction::do_action(PaintCanvas *canvas, const Array &data) { } } -void CutAction::commit_action(PaintCanvas *canvas) { +void CutAction::commit_action(PaintCanvasOld *canvas) { canvas->clear_preview_layer(); Vector2i p = mouse_start_pos; Vector2i s = mouse_end_pos - mouse_start_pos; diff --git a/modules/paint/actions/cut_action.h b/modules/paint/actions/cut_action.h index ccbae0898..389c7bec5 100644 --- a/modules/paint/actions/cut_action.h +++ b/modules/paint/actions/cut_action.h @@ -27,7 +27,7 @@ SOFTWARE. #include "paint_action.h" -class PaintCanvas; +class PaintCanvasOld; class CutAction : public PaintAction { GDCLASS(CutAction, PaintAction); @@ -47,8 +47,8 @@ public: bool can_commit(); - void do_action(PaintCanvas *canvas, const Array &data); - void commit_action(PaintCanvas *canvas); + void do_action(PaintCanvasOld *canvas, const Array &data); + void commit_action(PaintCanvasOld *canvas); CutAction(); ~CutAction(); diff --git a/modules/paint/actions/darken_action.cpp b/modules/paint/actions/darken_action.cpp index 3782c041f..2dfdd493e 100644 --- a/modules/paint/actions/darken_action.cpp +++ b/modules/paint/actions/darken_action.cpp @@ -35,7 +35,7 @@ void DarkenAction::set_dark_factor(const float val) { dark_factor = val; } -void DarkenAction::do_action(PaintCanvas *canvas, const Array &data) { +void DarkenAction::do_action(PaintCanvasOld *canvas, const Array &data) { PaintAction::do_action(canvas, data); PoolVector2iArray pixels = PaintUtilities::get_pixels_in_line(data[0], data[1]); diff --git a/modules/paint/actions/darken_action.h b/modules/paint/actions/darken_action.h index 3ab645b81..b8eda4ae8 100644 --- a/modules/paint/actions/darken_action.h +++ b/modules/paint/actions/darken_action.h @@ -27,7 +27,7 @@ SOFTWARE. #include "paint_action.h" -class PaintCanvas; +class PaintCanvasOld; class DarkenAction : public PaintAction { GDCLASS(DarkenAction, PaintAction); @@ -36,7 +36,7 @@ public: float get_dark_factor(); void set_dark_factor(const float val); - void do_action(PaintCanvas *canvas, const Array &data); + void do_action(PaintCanvasOld *canvas, const Array &data); DarkenAction(); ~DarkenAction(); diff --git a/modules/paint/actions/line_action.cpp b/modules/paint/actions/line_action.cpp index d10285576..d234b45a7 100644 --- a/modules/paint/actions/line_action.cpp +++ b/modules/paint/actions/line_action.cpp @@ -42,7 +42,7 @@ void LineAction::set_mouse_start_pos_set(const bool val) { mouse_start_pos_set = val; } -void LineAction::do_action(PaintCanvas *canvas, const Array &data) { +void LineAction::do_action(PaintCanvasOld *canvas, const Array &data) { PaintAction::do_action(canvas, data); if (!mouse_start_pos_set) { @@ -74,7 +74,7 @@ void LineAction::do_action(PaintCanvas *canvas, const Array &data) { } } -void LineAction::commit_action(PaintCanvas *canvas) { +void LineAction::commit_action(PaintCanvasOld *canvas) { canvas->clear_preview_layer(); for (int i = 0; i < preview_cells.size(); ++i) { diff --git a/modules/paint/actions/line_action.h b/modules/paint/actions/line_action.h index a6b696335..d6aea5a88 100644 --- a/modules/paint/actions/line_action.h +++ b/modules/paint/actions/line_action.h @@ -27,7 +27,7 @@ SOFTWARE. #include "paint_action.h" -class PaintCanvas; +class PaintCanvasOld; class LineAction : public PaintAction { GDCLASS(LineAction, PaintAction); @@ -39,8 +39,8 @@ public: bool get_mouse_start_pos_set(); void set_mouse_start_pos_set(const bool val); - void do_action(PaintCanvas *canvas, const Array &data); - void commit_action(PaintCanvas *canvas); + void do_action(PaintCanvasOld *canvas, const Array &data); + void commit_action(PaintCanvasOld *canvas); bool can_commit(); LineAction(); diff --git a/modules/paint/actions/multiline_action.cpp b/modules/paint/actions/multiline_action.cpp index 29ea430e7..69356c82f 100644 --- a/modules/paint/actions/multiline_action.cpp +++ b/modules/paint/actions/multiline_action.cpp @@ -32,7 +32,7 @@ bool MultiLineAction::can_commit() { return false; } -void MultiLineAction::do_action(PaintCanvas *canvas, const Array &data) { +void MultiLineAction::do_action(PaintCanvasOld *canvas, const Array &data) { PaintAction::do_action(canvas, data); PoolVector2iArray pixels = PaintUtilities::get_pixels_in_line(data[0], data[1]); diff --git a/modules/paint/actions/multiline_action.h b/modules/paint/actions/multiline_action.h index 76e64a94e..28032b8bc 100644 --- a/modules/paint/actions/multiline_action.h +++ b/modules/paint/actions/multiline_action.h @@ -27,7 +27,7 @@ SOFTWARE. #include "paint_action.h" -class PaintCanvas; +class PaintCanvasOld; class MultiLineAction : public PaintAction { GDCLASS(MultiLineAction, PaintAction); @@ -35,8 +35,8 @@ class MultiLineAction : public PaintAction { public: bool can_commit(); - void do_action(PaintCanvas *canvas, const Array &data); - //void commit_action(PaintCanvas *canvas); + void do_action(PaintCanvasOld *canvas, const Array &data); + //void commit_action(PaintCanvasOld *canvas); MultiLineAction(); ~MultiLineAction(); diff --git a/modules/paint/actions/paint_action.cpp b/modules/paint/actions/paint_action.cpp index c6300fcab..e2860bf47 100644 --- a/modules/paint/actions/paint_action.cpp +++ b/modules/paint/actions/paint_action.cpp @@ -105,18 +105,18 @@ void PaintAction::set_action_data(const Dictionary &val) { action_data = val; } -void PaintAction::do_action(PaintCanvas *canvas, const Array &data) { +void PaintAction::do_action(PaintCanvasOld *canvas, const Array &data) { layer = canvas->get_active_layer(); } -void PaintAction::commit_action(PaintCanvas *canvas) { +void PaintAction::commit_action(PaintCanvasOld *canvas) { } -void PaintAction::undo_action(PaintCanvas *canvas) { +void PaintAction::undo_action(PaintCanvasOld *canvas) { for (int idx = 0; idx < undo_cells.size(); ++idx) { canvas->_set_pixel_v(layer, undo_cells[idx], undo_colors[idx]); } } -void PaintAction::redo_action(PaintCanvas *canvas) { +void PaintAction::redo_action(PaintCanvasOld *canvas) { for (int idx = 0; idx < redo_cells.size(); ++idx) { canvas->_set_pixel_v(layer, redo_cells[idx], redo_colors[idx]); } @@ -171,7 +171,7 @@ PoolVector2iArray PaintAction::get_xy_sym_points(const int canvas_width, const i return points; } -PoolVector2iArray PaintAction::get_points(PaintCanvas *canvas, const Vector2i &pixel) { +PoolVector2iArray PaintAction::get_points(PaintCanvasOld *canvas, const Vector2i &pixel) { PoolVector2iArray points; if (canvas->symmetry_x && canvas->symmetry_y) { @@ -239,7 +239,7 @@ PoolVector2iArray PaintAction::get_points(PaintCanvas *canvas, const Vector2i &p return points; } -void PaintAction::draw_points(PaintCanvas *canvas, const PoolVector2iArray &point_arr, const PoolColorArray &color_arr) { +void PaintAction::draw_points(PaintCanvasOld *canvas, const PoolVector2iArray &point_arr, const PoolColorArray &color_arr) { for (int i = 0; i < point_arr.size(); ++i) { Vector2i pixel = point_arr[i]; diff --git a/modules/paint/actions/paint_action.h b/modules/paint/actions/paint_action.h index 5b0e5540a..833c691cd 100644 --- a/modules/paint/actions/paint_action.h +++ b/modules/paint/actions/paint_action.h @@ -33,7 +33,7 @@ SOFTWARE. #include "core/containers/pool_vector.h" #include "core/variant/variant.h" -class PaintCanvas; +class PaintCanvasOld; class PaintCanvasLayer; class PaintAction : public Resource { @@ -73,19 +73,19 @@ public: Dictionary get_action_data(); void set_action_data(const Dictionary &val); - virtual void do_action(PaintCanvas *canvas, const Array &data); - virtual void commit_action(PaintCanvas *canvas); + virtual void do_action(PaintCanvasOld *canvas, const Array &data); + virtual void commit_action(PaintCanvasOld *canvas); - virtual void undo_action(PaintCanvas *canvas); - virtual void redo_action(PaintCanvas *canvas); + virtual void undo_action(PaintCanvasOld *canvas); + virtual void redo_action(PaintCanvasOld *canvas); virtual bool can_commit(); virtual PoolVector2iArray get_x_sym_points(const int canvas_width, const Vector2i &pixel); virtual PoolVector2iArray get_y_sym_points(const int canvas_height, const Vector2i &pixel); virtual PoolVector2iArray get_xy_sym_points(const int canvas_width, const int canvas_height, const Vector2i &pixel); - virtual PoolVector2iArray get_points(PaintCanvas *canvas, const Vector2i &pixel); + virtual PoolVector2iArray get_points(PaintCanvasOld *canvas, const Vector2i &pixel); - void draw_points(PaintCanvas *canvas, const PoolVector2iArray &point_arr, const PoolColorArray &color_arr); + void draw_points(PaintCanvasOld *canvas, const PoolVector2iArray &point_arr, const PoolColorArray &color_arr); PaintAction(); ~PaintAction(); diff --git a/modules/paint/actions/paste_cut_action.cpp b/modules/paint/actions/paste_cut_action.cpp index e5d26d44c..49f4bb10a 100644 --- a/modules/paint/actions/paste_cut_action.cpp +++ b/modules/paint/actions/paste_cut_action.cpp @@ -34,7 +34,7 @@ SOFTWARE. //arr.append(_selection_colors); //arr.append(_cut_pos); //arr.append(_cut_size); -void PasteCutAction::do_action(PaintCanvas *canvas, const Array &data) { +void PasteCutAction::do_action(PaintCanvasOld *canvas, const Array &data) { PaintAction::do_action(canvas, data); PoolVector2iArray pixels = PaintUtilities::get_pixels_in_line(data[0], data[1]); diff --git a/modules/paint/actions/paste_cut_action.h b/modules/paint/actions/paste_cut_action.h index 1f754d2f9..da7c61c9a 100644 --- a/modules/paint/actions/paste_cut_action.h +++ b/modules/paint/actions/paste_cut_action.h @@ -27,13 +27,13 @@ SOFTWARE. #include "paint_action.h" -class PaintCanvas; +class PaintCanvasOld; class PasteCutAction : public PaintAction { GDCLASS(PasteCutAction, PaintAction); public: - void do_action(PaintCanvas *canvas, const Array &data); + void do_action(PaintCanvasOld *canvas, const Array &data); PasteCutAction(); ~PasteCutAction(); diff --git a/modules/paint/actions/pencil_action.cpp b/modules/paint/actions/pencil_action.cpp index 7f926c8cc..e42a99e5d 100644 --- a/modules/paint/actions/pencil_action.cpp +++ b/modules/paint/actions/pencil_action.cpp @@ -29,7 +29,7 @@ SOFTWARE. #include "../paint_utilities.h" #include "core/string/print_string.h" -void PencilAction::do_action(PaintCanvas *canvas, const Array &data) { +void PencilAction::do_action(PaintCanvasOld *canvas, const Array &data) { PaintAction::do_action(canvas, data); Color c = data[2]; @@ -49,7 +49,7 @@ void PencilAction::do_action(PaintCanvas *canvas, const Array &data) { } } -void PencilAction::_set_pixel(PaintCanvas *canvas, Vector2i pixel, Color color) { +void PencilAction::_set_pixel(PaintCanvasOld *canvas, Vector2i pixel, Color color) { undo_colors.append(canvas->get_pixel_v(pixel)); undo_cells.append(pixel); diff --git a/modules/paint/actions/pencil_action.h b/modules/paint/actions/pencil_action.h index d72657fa9..e32cf4fcd 100644 --- a/modules/paint/actions/pencil_action.h +++ b/modules/paint/actions/pencil_action.h @@ -27,15 +27,15 @@ SOFTWARE. #include "paint_action.h" -class PaintCanvas; +class PaintCanvasOld; class PencilAction : public PaintAction { GDCLASS(PencilAction, PaintAction); public: - void do_action(PaintCanvas *canvas, const Array &data); + void do_action(PaintCanvasOld *canvas, const Array &data); - void _set_pixel(PaintCanvas *canvas, Vector2i pixel, Color color); + void _set_pixel(PaintCanvasOld *canvas, Vector2i pixel, Color color); PencilAction(); ~PencilAction(); diff --git a/modules/paint/actions/rainbow_action.cpp b/modules/paint/actions/rainbow_action.cpp index 171872621..d70ec34af 100644 --- a/modules/paint/actions/rainbow_action.cpp +++ b/modules/paint/actions/rainbow_action.cpp @@ -28,7 +28,7 @@ SOFTWARE. #include "../deprecated/paint_canvas_layer.h" #include "../paint_utilities.h" -void RainbowAction::do_action(PaintCanvas *canvas, const Array &data) { +void RainbowAction::do_action(PaintCanvasOld *canvas, const Array &data) { PaintAction::do_action(canvas, data); PoolVector2iArray pixels = PaintUtilities::get_pixels_in_line(data[0], data[1]); diff --git a/modules/paint/actions/rainbow_action.h b/modules/paint/actions/rainbow_action.h index f3a4259b0..956bbd202 100644 --- a/modules/paint/actions/rainbow_action.h +++ b/modules/paint/actions/rainbow_action.h @@ -27,13 +27,13 @@ SOFTWARE. #include "paint_action.h" -class PaintCanvas; +class PaintCanvasOld; class RainbowAction : public PaintAction { GDCLASS(RainbowAction, PaintAction); public: - void do_action(PaintCanvas *canvas, const Array &data); + void do_action(PaintCanvasOld *canvas, const Array &data); RainbowAction(); ~RainbowAction(); diff --git a/modules/paint/actions/rect_action.cpp b/modules/paint/actions/rect_action.cpp index 49390a45f..568244d34 100644 --- a/modules/paint/actions/rect_action.cpp +++ b/modules/paint/actions/rect_action.cpp @@ -42,7 +42,7 @@ void RectAction::set_mouse_start_pos_set(const bool val) { mouse_start_pos_set = val; } -void RectAction::do_action(PaintCanvas *canvas, const Array &data) { +void RectAction::do_action(PaintCanvasOld *canvas, const Array &data) { PaintAction::do_action(canvas, data); if (!mouse_start_pos_set) { @@ -89,7 +89,7 @@ void RectAction::do_action(PaintCanvas *canvas, const Array &data) { preview_colors.append(tc); } } -void RectAction::commit_action(PaintCanvas *canvas) { +void RectAction::commit_action(PaintCanvasOld *canvas) { canvas->clear_preview_layer(); for (int idx = 0; idx < preview_cells.size(); ++idx) { diff --git a/modules/paint/actions/rect_action.h b/modules/paint/actions/rect_action.h index fe30f0429..ac28daf9b 100644 --- a/modules/paint/actions/rect_action.h +++ b/modules/paint/actions/rect_action.h @@ -27,7 +27,7 @@ SOFTWARE. #include "paint_action.h" -class PaintCanvas; +class PaintCanvasOld; class RectAction : public PaintAction { GDCLASS(RectAction, PaintAction); @@ -39,8 +39,8 @@ public: bool get_mouse_start_pos_set(); void set_mouse_start_pos_set(const bool val); - void do_action(PaintCanvas *canvas, const Array &data); - void commit_action(PaintCanvas *canvas); + void do_action(PaintCanvasOld *canvas, const Array &data); + void commit_action(PaintCanvasOld *canvas); bool can_commit(); RectAction(); diff --git a/modules/paint/deprecated/dialogs/paint_load_file_dialog.h b/modules/paint/deprecated/dialogs/paint_load_file_dialog.h index cf1b0649a..561298c10 100644 --- a/modules/paint/deprecated/dialogs/paint_load_file_dialog.h +++ b/modules/paint/deprecated/dialogs/paint_load_file_dialog.h @@ -27,7 +27,7 @@ SOFTWARE. #include "scene/gui/file_dialog.h" -class PaintCanvas; +class PaintCanvasOld; class PaintWindow; class PaintLoadFileDialog : public FileDialog { @@ -46,7 +46,7 @@ public: String file_path; - PaintCanvas *canvas; + PaintCanvasOld *canvas; PaintWindow *window; protected: diff --git a/modules/paint/deprecated/dialogs/paint_save_file_dialog.h b/modules/paint/deprecated/dialogs/paint_save_file_dialog.h index f60da6cd4..938130fd3 100644 --- a/modules/paint/deprecated/dialogs/paint_save_file_dialog.h +++ b/modules/paint/deprecated/dialogs/paint_save_file_dialog.h @@ -27,7 +27,7 @@ SOFTWARE. #include "scene/gui/file_dialog.h" -class PaintCanvas; +class PaintCanvasOld; class PaintSaveFileDialog : public FileDialog { GDCLASS(PaintSaveFileDialog, FileDialog); @@ -44,7 +44,7 @@ public: String file_path; - PaintCanvas *canvas; + PaintCanvasOld *canvas; protected: void _notification(int p_what); diff --git a/modules/paint/deprecated/paint_canvas.cpp b/modules/paint/deprecated/paint_canvas.cpp index cad94c145..1d3f78b86 100644 --- a/modules/paint/deprecated/paint_canvas.cpp +++ b/modules/paint/deprecated/paint_canvas.cpp @@ -59,7 +59,7 @@ static Ref make_icon(T p_src) { return texture; } -void PaintCanvas::_process(float delta) { +void PaintCanvasOld::_process(float delta) { if (!is_visible_in_tree()) { return; } @@ -68,7 +68,7 @@ void PaintCanvas::_process(float delta) { Rect2 rect = Rect2(Vector2(0, 0), get_size()); mouse_in_region = rect.has_point(mouse_position); } -void PaintCanvas::_draw() { +void PaintCanvasOld::_draw() { for (int i = 0; i < layers.size(); ++i) { Ref layer = layers[i]; @@ -81,11 +81,11 @@ void PaintCanvas::_draw() { tool_layer->update_texture(); } -int PaintCanvas::get_pixel_size() const { +int PaintCanvasOld::get_pixel_size() const { return _pixel_size; } -void PaintCanvas::set_pixel_size(const int size) { +void PaintCanvasOld::set_pixel_size(const int size) { _pixel_size = size; set_grid_size(_grid_size); set_big_grid_size(_big_grid_size); @@ -93,10 +93,10 @@ void PaintCanvas::set_pixel_size(const int size) { set_canvas_height(_canvas_height); } -int PaintCanvas::get_grid_size() const { +int PaintCanvasOld::get_grid_size() const { return _grid_size; } -void PaintCanvas::set_grid_size(const int size) { +void PaintCanvasOld::set_grid_size(const int size) { _grid_size = size; if (grid) { @@ -105,10 +105,10 @@ void PaintCanvas::set_grid_size(const int size) { } } -int PaintCanvas::get_big_grid_size() const { +int PaintCanvasOld::get_big_grid_size() const { return _big_grid_size; } -void PaintCanvas::set_big_grid_size(const int size) { +void PaintCanvasOld::set_big_grid_size(const int size) { _big_grid_size = size; if (big_grid) { @@ -117,10 +117,10 @@ void PaintCanvas::set_big_grid_size(const int size) { } } -int PaintCanvas::get_canvas_width() const { +int PaintCanvasOld::get_canvas_width() const { return _canvas_width; } -void PaintCanvas::set_canvas_width(const int val) { +void PaintCanvasOld::set_canvas_width(const int val) { _canvas_width = val; Size2 s = get_size(); @@ -128,31 +128,31 @@ void PaintCanvas::set_canvas_width(const int val) { set_size(s); } -int PaintCanvas::get_canvas_height() const { +int PaintCanvasOld::get_canvas_height() const { return _canvas_height; } -void PaintCanvas::set_canvas_height(const int val) { +void PaintCanvasOld::set_canvas_height(const int val) { _canvas_height = val; Size2 s = get_size(); s.y = _canvas_height * _pixel_size; set_size(s); } -void PaintCanvas::toggle_alpha_locked(const String &layer_name) { +void PaintCanvasOld::toggle_alpha_locked(const String &layer_name) { Ref layer = find_layer_by_name(layer_name); if (layer.is_valid()) { layer->toggle_alpha_locked(); } } -bool PaintCanvas::is_alpha_locked() { +bool PaintCanvasOld::is_alpha_locked() { if (!active_layer.is_valid()) { return false; } return active_layer->alpha_locked; } -Rect2 PaintCanvas::get_content_margin() { +Rect2 PaintCanvasOld::get_content_margin() { Rect2 rect = Rect2(999999, 999999, -999999, -999999); for (int i = 0; i < layers.size(); ++i) { @@ -181,7 +181,7 @@ Rect2 PaintCanvas::get_content_margin() { return rect; } -void PaintCanvas::crop_to_content() { +void PaintCanvasOld::crop_to_content() { /* var rect = get_content_margin() @@ -199,22 +199,22 @@ void PaintCanvas::crop_to_content() { # layer.resize(width, height) */ } -Ref PaintCanvas::get_active_layer() { +Ref PaintCanvasOld::get_active_layer() { return active_layer; } -Ref PaintCanvas::get_preview_layer() { +Ref PaintCanvasOld::get_preview_layer() { return preview_layer; } -void PaintCanvas::clear_active_layer() { +void PaintCanvasOld::clear_active_layer() { if (active_layer.is_valid()) { active_layer->clear(); } } -void PaintCanvas::clear_preview_layer() { +void PaintCanvasOld::clear_preview_layer() { preview_layer->clear(); } -void PaintCanvas::clear_layer(const String &layer_name) { +void PaintCanvasOld::clear_layer(const String &layer_name) { for (int i = 0; i < layers.size(); ++i) { Ref l = layers[i]; @@ -226,7 +226,7 @@ void PaintCanvas::clear_layer(const String &layer_name) { } } } -Ref PaintCanvas::remove_layer(const String &layer_name) { +Ref PaintCanvasOld::remove_layer(const String &layer_name) { // change current layer if the active layer is removed Ref del_layer = find_layer_by_name(layer_name); @@ -255,7 +255,7 @@ Ref PaintCanvas::remove_layer(const String &layer_name) { return active_layer; } -Ref PaintCanvas::add_new_layer(const String &layer_name) { +Ref PaintCanvasOld::add_new_layer(const String &layer_name) { for (int i = 0; i < layers.size(); ++i) { Ref layer = layers[i]; @@ -290,7 +290,7 @@ Ref PaintCanvas::add_new_layer(const String &layer_name) { return layer; } -Ref PaintCanvas::duplicate_layer(const String &layer_name, const String &new_layer_name) { +Ref PaintCanvasOld::duplicate_layer(const String &layer_name, const String &new_layer_name) { for (int i = 0; i < layers.size(); ++i) { Ref layer = layers[i]; @@ -307,7 +307,7 @@ Ref PaintCanvas::duplicate_layer(const String &layer_name, con return layer; } -void PaintCanvas::toggle_layer_visibility(const String &layer_name) { +void PaintCanvasOld::toggle_layer_visibility(const String &layer_name) { for (int i = 0; i < layers.size(); ++i) { Ref layer = layers[i]; @@ -319,7 +319,7 @@ void PaintCanvas::toggle_layer_visibility(const String &layer_name) { } } } -Ref PaintCanvas::find_layer_by_name(const String &layer_name) { +Ref PaintCanvasOld::find_layer_by_name(const String &layer_name) { for (int i = 0; i < layers.size(); ++i) { Ref layer = layers[i]; @@ -332,32 +332,32 @@ Ref PaintCanvas::find_layer_by_name(const String &layer_name) return Ref(); } -void PaintCanvas::toggle_lock_layer(const String &layer_name) { +void PaintCanvasOld::toggle_lock_layer(const String &layer_name) { find_layer_by_name(layer_name)->toggle_lock(); } -bool PaintCanvas::is_active_layer_locked() { +bool PaintCanvasOld::is_active_layer_locked() { return active_layer->locked; } -void PaintCanvas::move_layer_forward(const String &layer_name) { +void PaintCanvasOld::move_layer_forward(const String &layer_name) { TextureRect *layer = find_layer_by_name(layer_name)->texture_rect_ref; int new_idx = MAX(layer->get_index() - 1, 0); canvas_layers->move_child(layer, new_idx); } -void PaintCanvas::move_layer_back(const String &layer_name) { +void PaintCanvasOld::move_layer_back(const String &layer_name) { TextureRect *layer = find_layer_by_name(layer_name)->texture_rect_ref; canvas_layers->move_child(layer, layer->get_index() + 1); } -void PaintCanvas::select_layer(const String &layer_name) { +void PaintCanvasOld::select_layer(const String &layer_name) { active_layer = find_layer_by_name(layer_name); } -void PaintCanvas::_on_mouse_entered() { +void PaintCanvasOld::_on_mouse_entered() { mouse_on_top = true; } -void PaintCanvas::_on_mouse_exited() { +void PaintCanvasOld::_on_mouse_exited() { mouse_on_top = false; } -bool PaintCanvas::is_inside_canvas(const int x, const int y) { +bool PaintCanvasOld::is_inside_canvas(const int x, const int y) { if (x < 0 || y < 0) { return false; } @@ -371,7 +371,7 @@ bool PaintCanvas::is_inside_canvas(const int x, const int y) { //Note: Arrays are always passed by reference. To get a copy of an array which // can be modified independently of the original array, use duplicate. // (https://docs.godotengine.org/en/stable/classes/class_array.html) -void PaintCanvas::set_pixel_arr(const PoolVector2iArray &pixels, const Color &color) { +void PaintCanvasOld::set_pixel_arr(const PoolVector2iArray &pixels, const Color &color) { PoolVector2iArray::Read r = pixels.read(); for (int i = 0; i < pixels.size(); ++i) { @@ -380,52 +380,52 @@ void PaintCanvas::set_pixel_arr(const PoolVector2iArray &pixels, const Color &co _set_pixel(active_layer, pixel.x, pixel.y, color); } } -void PaintCanvas::set_pixel_v(const Vector2i &pos, const Color &color) { +void PaintCanvasOld::set_pixel_v(const Vector2i &pos, const Color &color) { set_pixel(pos.x, pos.y, color); } -void PaintCanvas::set_pixel(const int x, const int y, const Color &color) { +void PaintCanvasOld::set_pixel(const int x, const int y, const Color &color) { _set_pixel(active_layer, x, y, color); } -void PaintCanvas::_set_pixel_v(Ref layer, const Vector2i &v, const Color &color) { +void PaintCanvasOld::_set_pixel_v(Ref layer, const Vector2i &v, const Color &color) { _set_pixel(layer, v.x, v.y, color); } -void PaintCanvas::_set_pixel(Ref layer, const int x, const int y, const Color &color) { +void PaintCanvasOld::_set_pixel(Ref layer, const int x, const int y, const Color &color) { if (!is_inside_canvas(x, y)) { return; } layer->set_pixel(x, y, color); } -Color PaintCanvas::get_pixel_v(const Vector2i &pos) { +Color PaintCanvasOld::get_pixel_v(const Vector2i &pos) { return get_pixel(pos.x, pos.y); } -Color PaintCanvas::get_pixel(const int x, const int y) { +Color PaintCanvasOld::get_pixel(const int x, const int y) { if (active_layer.is_valid()) { return active_layer->get_pixel(x, y); } return Color(); } -void PaintCanvas::set_preview_pixel_v(const Vector2i &pos, const Color &color) { +void PaintCanvasOld::set_preview_pixel_v(const Vector2i &pos, const Color &color) { set_preview_pixel(pos.x, pos.y, color); } -void PaintCanvas::set_preview_pixel(const int x, const int y, const Color &color) { +void PaintCanvasOld::set_preview_pixel(const int x, const int y, const Color &color) { if (!is_inside_canvas(x, y)) { return; } preview_layer->set_pixel(x, y, color); } -Color PaintCanvas::get_preview_pixel_v(const Vector2i &pos) { +Color PaintCanvasOld::get_preview_pixel_v(const Vector2i &pos) { return get_preview_pixel(pos.x, pos.y); } -Color PaintCanvas::get_preview_pixel(const int x, const int y) { +Color PaintCanvasOld::get_preview_pixel(const int x, const int y) { return preview_layer->get_pixel(x, y); } -bool PaintCanvas::validate_pixel_v(const Vector2i &pos) const { +bool PaintCanvasOld::validate_pixel_v(const Vector2i &pos) const { if (active_layer.is_valid()) { return active_layer->validate_pixel_v(pos); } @@ -433,17 +433,17 @@ bool PaintCanvas::validate_pixel_v(const Vector2i &pos) const { return false; } -void PaintCanvas::toggle_grid() { +void PaintCanvasOld::toggle_grid() { grid->set_visible(!grid->is_visible()); } -void PaintCanvas::show_grid() { +void PaintCanvasOld::show_grid() { grid->show(); } -void PaintCanvas::hide_grid() { +void PaintCanvasOld::hide_grid() { grid->hide(); } -PoolVector2iArray PaintCanvas::select_color(const int p_x, const int p_y) { +PoolVector2iArray PaintCanvasOld::select_color(const int p_x, const int p_y) { PoolVector2iArray same_color_pixels; Color color = get_pixel(p_x, p_y); @@ -458,14 +458,14 @@ PoolVector2iArray PaintCanvas::select_color(const int p_x, const int p_y) { return same_color_pixels; } -PoolVector2iArray PaintCanvas::select_same_color(const int p_x, const int p_y) { +PoolVector2iArray PaintCanvasOld::select_same_color(const int p_x, const int p_y) { return get_neighbouring_pixels(p_x, p_y); } // returns array of Vector2 // yoinked from // https://www.geeksforgeeks.org/flood-fill-algorithm-implement-fill-paint/ -PoolVector2iArray PaintCanvas::get_neighbouring_pixels(const int pos_x, const int pos_y) { +PoolVector2iArray PaintCanvasOld::get_neighbouring_pixels(const int pos_x, const int pos_y) { PoolVector2iArray pixels; PoolIntArray to_check_queue; @@ -524,7 +524,7 @@ PoolVector2iArray PaintCanvas::get_neighbouring_pixels(const int pos_x, const in return pixels; } -void PaintCanvas::resize(int width, int height) { +void PaintCanvasOld::resize(int width, int height) { //if (get_canvas_width() == width && get_canvas_height() == height) { // return; // } @@ -559,7 +559,7 @@ void PaintCanvas::resize(int width, int height) { update(); } -void PaintCanvas::_notification(int p_what) { +void PaintCanvasOld::_notification(int p_what) { switch (p_what) { case NOTIFICATION_POSTINITIALIZE: { connect("mouse_entered", this, "_on_mouse_entered"); @@ -588,7 +588,7 @@ void PaintCanvas::_notification(int p_what) { } } -PaintCanvas::PaintCanvas() { +PaintCanvasOld::PaintCanvasOld() { big_grid = nullptr; _pixel_size = 16; @@ -646,10 +646,10 @@ PaintCanvas::PaintCanvas() { tool_layer->create(tool_preview_layer_rect, _canvas_width, _canvas_height); } -PaintCanvas::~PaintCanvas() { +PaintCanvasOld::~PaintCanvasOld() { } -void PaintCanvas::_bind_methods() { - ClassDB::bind_method(D_METHOD("_on_mouse_entered"), &PaintCanvas::_on_mouse_entered); - ClassDB::bind_method(D_METHOD("_on_mouse_exited"), &PaintCanvas::_on_mouse_exited); +void PaintCanvasOld::_bind_methods() { + ClassDB::bind_method(D_METHOD("_on_mouse_entered"), &PaintCanvasOld::_on_mouse_entered); + ClassDB::bind_method(D_METHOD("_on_mouse_exited"), &PaintCanvasOld::_on_mouse_exited); } diff --git a/modules/paint/deprecated/paint_canvas.h b/modules/paint/deprecated/paint_canvas.h index 9493546ba..c773c765d 100644 --- a/modules/paint/deprecated/paint_canvas.h +++ b/modules/paint/deprecated/paint_canvas.h @@ -1,5 +1,5 @@ -#ifndef PAINT_CANVAS_H -#define PAINT_CANVAS_H +#ifndef PAINT_CANVAS_OLD_H +#define PAINT_CANVAS_OLD_H /* Copyright (c) 2019 Flairieve @@ -39,8 +39,8 @@ class PaintCanvasLayer; class PaintCanvasBackground; //class_name GECanvas -class PaintCanvas : public MarginContainer { - GDCLASS(PaintCanvas, MarginContainer); +class PaintCanvasOld : public MarginContainer { + GDCLASS(PaintCanvasOld, MarginContainer); public: void _process(float delta); @@ -111,8 +111,8 @@ public: void resize(int width, int height); - PaintCanvas(); - ~PaintCanvas(); + PaintCanvasOld(); + ~PaintCanvasOld(); Vector> layers; Ref active_layer; diff --git a/modules/paint/deprecated/paint_navbar.h b/modules/paint/deprecated/paint_navbar.h index a87288284..e3e06ac20 100644 --- a/modules/paint/deprecated/paint_navbar.h +++ b/modules/paint/deprecated/paint_navbar.h @@ -28,7 +28,7 @@ SOFTWARE. #include "scene/gui/box_container.h" class PaintWindow; -class PaintCanvas; +class PaintCanvasOld; class MenuButton; class PaintNavbar : public BoxContainer { @@ -74,7 +74,7 @@ public: ~PaintNavbar(); PaintWindow *paint_window; - PaintCanvas *canvas; + PaintCanvasOld *canvas; MenuButton *file_menu_button; MenuButton *edit_menu_button; diff --git a/modules/paint/deprecated/paint_window.cpp b/modules/paint/deprecated/paint_window.cpp index ac94f4494..52ed79ab8 100644 --- a/modules/paint/deprecated/paint_window.cpp +++ b/modules/paint/deprecated/paint_window.cpp @@ -1438,7 +1438,7 @@ PaintWindow::PaintWindow() { paint_canvas_container->connect("mouse_exited", this, "_on_PaintCanvasContainer_mouse_exited"); app_mid_container->add_child(paint_canvas_container); - paint_canvas = memnew(PaintCanvas); + paint_canvas = memnew(PaintCanvasOld); paint_canvas->set_pixel_size(4); paint_canvas->set_canvas_width(64); paint_canvas->set_canvas_height(64); diff --git a/modules/paint/deprecated/paint_window.h b/modules/paint/deprecated/paint_window.h index 2ec89cc01..c68c66515 100644 --- a/modules/paint/deprecated/paint_window.h +++ b/modules/paint/deprecated/paint_window.h @@ -34,7 +34,7 @@ SOFTWARE. class PaintAction; class PaintCanvasLayer; -class PaintCanvas; +class PaintCanvasOld; class InputEvent; class PaintCanvasDialog; class PaintChangeGridSizeDialog; @@ -227,7 +227,7 @@ public: PanelContainer *bottom_content_panel; Control *paint_canvas_container; - PaintCanvas *paint_canvas; + PaintCanvasOld *paint_canvas; Button *paint_tool_button; Button *brush_tool_button;