Improved custom event code and fixed some warnings
This commit is contained in:
parent
da1a1c26cb
commit
b2fe1ab7ba
52 changed files with 193 additions and 240 deletions
|
|
@ -6,9 +6,7 @@
|
|||
#include "DrawingProgramToolBase.hpp"
|
||||
#include "../../CanvasComponents/BrushStrokeCanvasComponent.hpp"
|
||||
#include "Helpers/NetworkingObjects/NetObjTemporaryPtr.decl.hpp"
|
||||
#include "Helpers/NetworkingObjects/NetObjWeakPtr.hpp"
|
||||
#include "../../CanvasComponents/CanvasComponentContainer.hpp"
|
||||
#include <chrono>
|
||||
|
||||
#include "../../GUIStuff/ElementHelpers/TextLabelHelpers.hpp"
|
||||
#include "../../GUIStuff/ElementHelpers/CheckBoxHelpers.hpp"
|
||||
|
|
@ -176,7 +174,6 @@ void BrushTool::gui_toolbox() {
|
|||
using namespace GUIStuff;
|
||||
using namespace ElementHelpers;
|
||||
|
||||
Toolbar& t = drawP.world.main.toolbar;
|
||||
auto& gui = drawP.world.main.g.gui;
|
||||
|
||||
gui.new_id("brush tool", [&] {
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@
|
|||
#include <include/core/SkPath.h>
|
||||
#include <include/core/SkVertices.h>
|
||||
#include <Helpers/SCollision.hpp>
|
||||
#include <deque>
|
||||
#include <include/core/SkCanvas.h>
|
||||
#include "../../CanvasComponents/CanvasComponentContainer.hpp"
|
||||
#include <Helpers/NetworkingObjects/NetObjWeakPtr.hpp>
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ std::unique_ptr<DrawingProgramToolBase> DrawingProgramToolBase::allocate_tool_ty
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
void DrawingProgramToolBase::input_paste_callback(const CustomEvents::PasteEventData& paste) {}
|
||||
void DrawingProgramToolBase::input_paste_callback(const CustomEvents::PasteEvent& paste) {}
|
||||
void DrawingProgramToolBase::input_text_key_callback(const InputManager::KeyCallbackArgs& key) {}
|
||||
void DrawingProgramToolBase::input_text_callback(const InputManager::TextCallbackArgs& text) {}
|
||||
void DrawingProgramToolBase::input_key_callback(const InputManager::KeyCallbackArgs& key) {}
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ class DrawingProgramToolBase {
|
|||
virtual void draw(SkCanvas* canvas, const DrawData& drawData) = 0;
|
||||
virtual void switch_tool(DrawingProgramToolType newTool) = 0;
|
||||
virtual bool prevent_undo_or_redo() = 0;
|
||||
virtual void input_paste_callback(const CustomEvents::PasteEventData& paste);
|
||||
virtual void input_paste_callback(const CustomEvents::PasteEvent& paste);
|
||||
virtual void input_text_key_callback(const InputManager::KeyCallbackArgs& key);
|
||||
virtual void input_text_callback(const InputManager::TextCallbackArgs& text);
|
||||
virtual void input_key_callback(const InputManager::KeyCallbackArgs& key);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
#include "EditTool.hpp"
|
||||
#include <chrono>
|
||||
#include "../DrawingProgram.hpp"
|
||||
#include "../../MainProgram.hpp"
|
||||
#include "../../DrawData.hpp"
|
||||
|
|
@ -29,7 +28,6 @@ void EditTool::gui_toolbox() {
|
|||
using namespace GUIStuff;
|
||||
using namespace ElementHelpers;
|
||||
|
||||
Toolbar& t = drawP.world.main.toolbar;
|
||||
auto& gui = drawP.world.main.g.gui;
|
||||
|
||||
if(objInfoBeingEdited)
|
||||
|
|
@ -46,7 +44,7 @@ void EditTool::erase_component(CanvasComponentContainer::ObjInfo* erasedComp) {
|
|||
switch_tool(get_type());
|
||||
}
|
||||
|
||||
void EditTool::input_paste_callback(const CustomEvents::PasteEventData& paste) {
|
||||
void EditTool::input_paste_callback(const CustomEvents::PasteEvent& paste) {
|
||||
if(objInfoBeingEdited)
|
||||
compEditTool->input_paste_callback(paste);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ class EditTool : public DrawingProgramToolBase {
|
|||
virtual void switch_tool(DrawingProgramToolType newTool) override;
|
||||
virtual void draw(SkCanvas* canvas, const DrawData& drawData) override;
|
||||
virtual bool prevent_undo_or_redo() override;
|
||||
virtual void input_paste_callback(const CustomEvents::PasteEventData& paste) override;
|
||||
virtual void input_paste_callback(const CustomEvents::PasteEvent& paste) override;
|
||||
virtual void input_text_key_callback(const InputManager::KeyCallbackArgs& key) override;
|
||||
virtual void input_text_callback(const InputManager::TextCallbackArgs& text) override;
|
||||
virtual void input_key_callback(const InputManager::KeyCallbackArgs& key) override;
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
#include "../../../World.hpp"
|
||||
#include "../../../MainProgram.hpp"
|
||||
#include "../EditTool.hpp"
|
||||
#include "../../../CanvasComponents/BrushStrokeCanvasComponent.hpp"
|
||||
|
||||
#include "../../../GUIStuff/ElementHelpers/TextLabelHelpers.hpp"
|
||||
#include "../../../GUIStuff/ElementHelpers/LayoutHelpers.hpp"
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
#pragma once
|
||||
#include "DrawingProgramEditToolBase.hpp"
|
||||
#include "../../../CanvasComponents/BrushStrokeCanvasComponent.hpp"
|
||||
#include <Helpers/SCollision.hpp>
|
||||
#include <any>
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ void DrawingProgramEditToolBase::right_click_popup_gui(Vector2f popupPos) {
|
|||
t.paint_popup(popupPos);
|
||||
}
|
||||
|
||||
void DrawingProgramEditToolBase::input_paste_callback(const CustomEvents::PasteEventData& paste) {}
|
||||
void DrawingProgramEditToolBase::input_paste_callback(const CustomEvents::PasteEvent& paste) {}
|
||||
void DrawingProgramEditToolBase::input_text_key_callback(const InputManager::KeyCallbackArgs& key) {}
|
||||
void DrawingProgramEditToolBase::input_text_callback(const InputManager::TextCallbackArgs& text) {}
|
||||
void DrawingProgramEditToolBase::input_key_callback(const InputManager::KeyCallbackArgs& key) {}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ class DrawingProgramEditToolBase {
|
|||
virtual bool edit_update() = 0;
|
||||
virtual void edit_gui() = 0;
|
||||
virtual void right_click_popup_gui(Vector2f popupPos);
|
||||
virtual void input_paste_callback(const CustomEvents::PasteEventData& paste);
|
||||
virtual void input_paste_callback(const CustomEvents::PasteEvent& paste);
|
||||
virtual void input_text_key_callback(const InputManager::KeyCallbackArgs& key);
|
||||
virtual void input_text_callback(const InputManager::TextCallbackArgs& text);
|
||||
virtual void input_key_callback(const InputManager::KeyCallbackArgs& key);
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@
|
|||
#include "../../../MainProgram.hpp"
|
||||
#include "../../../DrawData.hpp"
|
||||
#include <cereal/types/vector.hpp>
|
||||
#include <memory>
|
||||
#include "../EditTool.hpp"
|
||||
|
||||
#include "../../../GUIStuff/ElementHelpers/TextLabelHelpers.hpp"
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@
|
|||
#include "../EditTool.hpp"
|
||||
#include "DrawingProgramEditToolBase.hpp"
|
||||
#include "Eigen/Geometry"
|
||||
#include <fstream>
|
||||
|
||||
#include "../../../GUIStuff/ElementHelpers/TextLabelHelpers.hpp"
|
||||
#include "../../../GUIStuff/ElementHelpers/ButtonHelpers.hpp"
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
#include "../../DrawingProgram.hpp"
|
||||
#include "../../../World.hpp"
|
||||
#include "../../../MainProgram.hpp"
|
||||
#include <memory>
|
||||
#include "../EditTool.hpp"
|
||||
|
||||
#include "../../../GUIStuff/ElementHelpers/NumberSliderHelpers.hpp"
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
#include "../../DrawingProgram.hpp"
|
||||
#include "../../../MainProgram.hpp"
|
||||
#include "../../../DrawData.hpp"
|
||||
#include "Helpers/ConvertVec.hpp"
|
||||
#include "Helpers/SCollision.hpp"
|
||||
#include <cereal/types/vector.hpp>
|
||||
#include <include/core/SkFontStyle.h>
|
||||
|
|
@ -204,7 +203,7 @@ void TextBoxEditTool::edit_gui() {
|
|||
});
|
||||
}
|
||||
|
||||
void TextBoxEditTool::input_paste_callback(const CustomEvents::PasteEventData& paste) {
|
||||
void TextBoxEditTool::input_paste_callback(const CustomEvents::PasteEvent& paste) {
|
||||
if(textboxID.has_value() && textboxID.value() == drawP.world.main.input.text.current_textbox_editing_id()) {
|
||||
auto& a = static_cast<TextBoxCanvasComponent&>(comp->obj->get_comp());
|
||||
if(userInput->input_paste_callback(paste)) {
|
||||
|
|
@ -289,10 +288,10 @@ void TextBoxEditTool::right_click_popup_gui(Vector2f popupPos) {
|
|||
text_label_light(gui, "Text menu");
|
||||
InputManager& input = drawP.world.main.input;
|
||||
drawP.popup_menu_action_button("Paste", "Paste", [&] {
|
||||
drawP.world.main.input.call_paste(CustomEvents::PasteEventDataType::TEXT, { .allowRichText = true });
|
||||
drawP.world.main.input.call_paste(CustomEvents::PasteEvent::DataType::TEXT, { .allowRichText = true });
|
||||
});
|
||||
drawP.popup_menu_action_button("Paste without formatting", "Paste without formatting", [&] {
|
||||
drawP.world.main.input.call_paste(CustomEvents::PasteEventDataType::TEXT, { .allowRichText = false });
|
||||
drawP.world.main.input.call_paste(CustomEvents::PasteEvent::DataType::TEXT, { .allowRichText = false });
|
||||
});
|
||||
if(a.cursor->selectionBeginPos != a.cursor->selectionEndPos) {
|
||||
drawP.popup_menu_action_button("Copy", "Copy", [&] {
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ class TextBoxEditTool : public DrawingProgramEditToolBase {
|
|||
virtual void edit_gui() override;
|
||||
virtual void right_click_popup_gui(Vector2f popupPos) override;
|
||||
|
||||
virtual void input_paste_callback(const CustomEvents::PasteEventData& paste) override;
|
||||
virtual void input_paste_callback(const CustomEvents::PasteEvent& paste) override;
|
||||
virtual void input_text_key_callback(const InputManager::KeyCallbackArgs& key) override;
|
||||
virtual void input_text_callback(const InputManager::TextCallbackArgs& text) override;
|
||||
virtual void input_mouse_button_on_canvas_callback(const InputManager::MouseButtonCallbackArgs& button, bool isDraggingPoint) override;
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@ void EllipseDrawTool::gui_toolbox() {
|
|||
using namespace GUIStuff;
|
||||
using namespace ElementHelpers;
|
||||
|
||||
Toolbar& t = drawP.world.main.toolbar;
|
||||
auto& gui = drawP.world.main.g.gui;
|
||||
auto& toolConfig = drawP.world.main.toolConfig;
|
||||
auto& fillStrokeMode = toolConfig.ellipseDraw.fillStrokeMode;
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ void EraserTool::gui_toolbox() {
|
|||
using namespace GUIStuff;
|
||||
using namespace ElementHelpers;
|
||||
|
||||
Toolbar& t = drawP.world.main.toolbar;
|
||||
auto& gui = drawP.world.main.g.gui;
|
||||
gui.new_id("eraser tool", [&] {
|
||||
text_label_centered(gui, "Eraser");
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
#include <include/core/SkCanvas.h>
|
||||
#include "../../DrawData.hpp"
|
||||
#include "DrawingProgramToolBase.hpp"
|
||||
#include "../DrawingProgramCache.hpp"
|
||||
|
||||
class DrawingProgram;
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@ void EyeDropperTool::gui_toolbox() {
|
|||
using namespace GUIStuff;
|
||||
using namespace ElementHelpers;
|
||||
|
||||
Toolbar& t = drawP.world.main.toolbar;
|
||||
auto& gui = drawP.world.main.g.gui;
|
||||
auto& selectingStrokeColor = drawP.world.main.toolConfig.eyeDropper.selectingStrokeColor;
|
||||
gui.new_id("Color select tool", [&] {
|
||||
|
|
|
|||
|
|
@ -2,11 +2,9 @@
|
|||
#include "../DrawingProgram.hpp"
|
||||
#include "../../MainProgram.hpp"
|
||||
#include "../../DrawData.hpp"
|
||||
#include "Helpers/Networking/NetLibrary.hpp"
|
||||
#include "Helpers/NetworkingObjects/NetObjTemporaryPtr.decl.hpp"
|
||||
#include <Helpers/NetworkingObjects/NetObjWeakPtr.hpp>
|
||||
#include <Helpers/NetworkingObjects/NetObjGenericSerializedClass.hpp>
|
||||
#include <cstddef>
|
||||
|
||||
#include "../../GUIStuff/ElementHelpers/TextLabelHelpers.hpp"
|
||||
#include "../../GUIStuff/ElementHelpers/LayoutHelpers.hpp"
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@
|
|||
#include "Helpers/SCollision.hpp"
|
||||
#include "../../CoordSpaceHelper.hpp"
|
||||
#include <ranges>
|
||||
#include "../../DrawCollision.hpp"
|
||||
#include <earcut.hpp>
|
||||
#include <include/core/SkPathBuilder.h>
|
||||
|
||||
|
|
@ -41,7 +40,6 @@ DrawingProgramToolType LassoSelectTool::get_type() {
|
|||
}
|
||||
|
||||
void LassoSelectTool::gui_toolbox() {
|
||||
auto& t = drawP.world.main.toolbar;
|
||||
auto& gui = drawP.world.main.g.gui;
|
||||
gui.new_id("lasso select tool", [&] {
|
||||
GUIStuff::ElementHelpers::text_label_centered(gui, "Lasso Select");
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@
|
|||
#include "../../CanvasComponents/BrushStrokeCanvasComponent.hpp"
|
||||
#include "../../CanvasComponents/CanvasComponentContainer.hpp"
|
||||
#include "Helpers/MathExtras.hpp"
|
||||
#include <limits>
|
||||
|
||||
#include "../../GUIStuff/ElementHelpers/TextLabelHelpers.hpp"
|
||||
#include "../../GUIStuff/ElementHelpers/CheckBoxHelpers.hpp"
|
||||
|
|
@ -22,7 +21,6 @@ DrawingProgramToolType LineDrawTool::get_type() {
|
|||
void LineDrawTool::gui_toolbox() {
|
||||
using namespace GUIStuff;
|
||||
using namespace ElementHelpers;
|
||||
Toolbar& t = drawP.world.main.toolbar;
|
||||
auto& gui = drawP.world.main.g.gui;
|
||||
auto& toolConfig = drawP.world.main.toolConfig;
|
||||
gui.new_id("rect draw tool", [&] {
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ DrawingProgramToolType PanCanvasTool::get_type() {
|
|||
}
|
||||
|
||||
void PanCanvasTool::gui_toolbox() {
|
||||
Toolbar& t = drawP.world.main.toolbar;
|
||||
auto& gui = drawP.world.main.g.gui;
|
||||
gui.new_id("Pan canvas tool", [&] {
|
||||
GUIStuff::ElementHelpers::text_label_centered(gui, "Pan tool");
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ void RectDrawTool::gui_toolbox() {
|
|||
using namespace GUIStuff;
|
||||
using namespace ElementHelpers;
|
||||
|
||||
Toolbar& t = drawP.world.main.toolbar;
|
||||
auto& gui = drawP.world.main.g.gui;
|
||||
auto& toolConfig = drawP.world.main.toolConfig;
|
||||
auto& fillStrokeMode = toolConfig.rectDraw.fillStrokeMode;
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ DrawingProgramToolType RectSelectTool::get_type() {
|
|||
}
|
||||
|
||||
void RectSelectTool::gui_toolbox() {
|
||||
auto& t = drawP.world.main.toolbar;
|
||||
auto& gui = drawP.world.main.g.gui;
|
||||
gui.new_id("rectangle select tool", [&] {
|
||||
GUIStuff::ElementHelpers::text_label_centered(gui, "Rectangle Select");
|
||||
|
|
|
|||
|
|
@ -17,9 +17,7 @@
|
|||
#include <include/encode/SkPngEncoder.h>
|
||||
#include <include/encode/SkWebpEncoder.h>
|
||||
#include <include/encode/SkJpegEncoder.h>
|
||||
#include <fstream>
|
||||
#include <include/gpu/GpuTypes.h>
|
||||
#include "../../FileHelpers.hpp"
|
||||
#include <filesystem>
|
||||
#ifdef USE_SKIA_BACKEND_GRAPHITE
|
||||
#include <include/gpu/graphite/Surface.h>
|
||||
|
|
|
|||
|
|
@ -1,10 +1,8 @@
|
|||
#include "TextBoxTool.hpp"
|
||||
#include <chrono>
|
||||
#include "../DrawingProgram.hpp"
|
||||
#include "../../MainProgram.hpp"
|
||||
#include "../../DrawData.hpp"
|
||||
#include "Helpers/MathExtras.hpp"
|
||||
#include "Helpers/SCollision.hpp"
|
||||
#include <cereal/types/vector.hpp>
|
||||
#include <memory>
|
||||
#include "../../CanvasComponents/TextBoxCanvasComponent.hpp"
|
||||
|
|
@ -22,7 +20,6 @@ DrawingProgramToolType TextBoxTool::get_type() {
|
|||
}
|
||||
|
||||
void TextBoxTool::gui_toolbox() {
|
||||
Toolbar& t = drawP.world.main.toolbar;
|
||||
auto& gui = drawP.world.main.g.gui;
|
||||
gui.new_id("textbox tool", [&] {
|
||||
GUIStuff::ElementHelpers::text_label_centered(gui, "Place textbox");
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ DrawingProgramToolType ZoomCanvasTool::get_type() {
|
|||
}
|
||||
|
||||
void ZoomCanvasTool::gui_toolbox() {
|
||||
Toolbar& t = drawP.world.main.toolbar;
|
||||
auto& gui = drawP.world.main.g.gui;
|
||||
gui.new_id("Zoom canvas tool", [&] {
|
||||
GUIStuff::ElementHelpers::text_label_centered(gui, "Zoom tool");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue