Changes related to text input on Android, general bug fixes, license change to GPLv3

This commit is contained in:
Yousef Khadadeh 2026-05-11 23:06:39 +03:00
parent 8b3e321ab5
commit fc8f414b67
308 changed files with 8707 additions and 440 deletions

View file

@ -1,3 +1,21 @@
/*
* InfiniPaint
* Copyright (C) 2025-2026 Yousef Khadadeh
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "DrawingProgram.hpp"
#include "Helpers/Networking/NetLibrary.hpp"
#include "Tools/DrawingProgramToolBase.hpp"
@ -65,6 +83,10 @@ void DrawingProgram::input_paste_callback(const CustomEvents::PasteEvent& paste)
drawTool->input_paste_callback(paste);
}
void DrawingProgram::input_android_text_box_input_callback(const CustomEvents::AndroidTextBoxInputEvent& textboxInput) {
drawTool->input_android_text_box_input_callback(textboxInput);
}
void DrawingProgram::input_drop_file_callback(const InputManager::DropCallbackArgs& drop) {
if(std::filesystem::is_regular_file(drop.data)) {
#ifdef __EMSCRIPTEN_
@ -760,6 +782,26 @@ void DrawingProgram::get_used_resources(std::unordered_set<NetworkingObjects::Ne
layerMan.get_used_resources(resourceSet);
}
Vector4f* DrawingProgram::color_picker_left(Vector4f* oldColor) {
if(oldColor == &world.main.toolConfig.globalConf.foregroundColor)
return oldColor;
else if(oldColor == &world.main.toolConfig.globalConf.backgroundColor)
return oldColor;
return nullptr;
}
Vector4f* DrawingProgram::color_picker_right(Vector4f* oldColor) {
return drawTool->color_picker_color(oldColor);
}
bool DrawingProgram::phone_gui_tool_specific_bottom_toolbar_exists() {
return drawTool->phone_gui_tool_specific_bottom_toolbar_exists();
}
void DrawingProgram::phone_gui_tool_specific_bottom_toolbar(PhoneDrawingProgramScreen& t) {
drawTool->phone_gui_tool_specific_bottom_toolbar(t);
}
void DrawingProgram::draw(SkCanvas* canvas, const DrawData& drawData) {
if(drawData.takingScreenshot)
layerMan.draw(canvas, drawData);

View file

@ -1,3 +1,21 @@
/*
* InfiniPaint
* Copyright (C) 2025-2026 Yousef Khadadeh
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include "../DrawData.hpp"
#include "DrawingProgramCache.hpp"
@ -40,6 +58,11 @@ class DrawingProgram {
CanvasComponentContainer::ObjInfo* add_file_to_canvas_by_data(const std::string& fileName, std::string_view fileBuffer, Vector2f dropPos);
void get_used_resources(std::unordered_set<NetworkingObjects::NetObjID>& resourceSet);
Vector4f* color_picker_left(Vector4f* oldColor);
Vector4f* color_picker_right(Vector4f* oldColor);
bool phone_gui_tool_specific_bottom_toolbar_exists();
void phone_gui_tool_specific_bottom_toolbar(PhoneDrawingProgramScreen& t);
void load_file(cereal::PortableBinaryInputArchive& a, VersionNumber version);
void save_file(cereal::PortableBinaryOutputArchive& a) const;
World& world;
@ -61,6 +84,7 @@ class DrawingProgram {
void on_tab_out();
void input_add_file_to_canvas_callback(const CustomEvents::AddFileToCanvasEvent& addFile);
void input_paste_callback(const CustomEvents::PasteEvent& paste);
void input_android_text_box_input_callback(const CustomEvents::AndroidTextBoxInputEvent& textboxInput);
void input_drop_text_callback(const InputManager::DropCallbackArgs& drop);
void input_drop_file_callback(const InputManager::DropCallbackArgs& drop);
void input_text_key_callback(const InputManager::KeyCallbackArgs& key);

View file

@ -1,3 +1,21 @@
/*
* InfiniPaint
* Copyright (C) 2025-2026 Yousef Khadadeh
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "DrawingProgramCache.hpp"
#include "DrawingProgram.hpp"
#include "../World.hpp"

View file

@ -1,3 +1,21 @@
/*
* InfiniPaint
* Copyright (C) 2025-2026 Yousef Khadadeh
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include "../CanvasComponents/CanvasComponentContainer.hpp"
#include <unordered_map>

View file

@ -1,3 +1,21 @@
/*
* InfiniPaint
* Copyright (C) 2025-2026 Yousef Khadadeh
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "DrawingProgramSelection.hpp"
#include "DrawingProgram.hpp"
#include "../World.hpp"

View file

@ -1,3 +1,21 @@
/*
* InfiniPaint
* Copyright (C) 2025-2026 Yousef Khadadeh
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include "../CoordSpaceHelperTransform.hpp"
#include "Layers/DrawingProgramLayerManager.hpp"

View file

@ -1,3 +1,21 @@
/*
* InfiniPaint
* Copyright (C) 2025-2026 Yousef Khadadeh
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "DrawingProgramLayer.hpp"
#include "DrawingProgramLayerManager.hpp"
#include "../DrawingProgram.hpp"

View file

@ -1,3 +1,21 @@
/*
* InfiniPaint
* Copyright (C) 2025-2026 Yousef Khadadeh
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <Helpers/NetworkingObjects/NetObjOrderedList.hpp>
#include "../../CanvasComponents/CanvasComponent.hpp"

View file

@ -1,3 +1,21 @@
/*
* InfiniPaint
* Copyright (C) 2025-2026 Yousef Khadadeh
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "DrawingProgramLayerFolder.hpp"
#include "DrawingProgramLayerListItem.hpp"
#include "DrawingProgramLayer.hpp"

View file

@ -1,3 +1,21 @@
/*
* InfiniPaint
* Copyright (C) 2025-2026 Yousef Khadadeh
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <Helpers/NetworkingObjects/NetObjOrderedList.hpp>
#include <include/core/SkCanvas.h>

View file

@ -1,3 +1,21 @@
/*
* InfiniPaint
* Copyright (C) 2025-2026 Yousef Khadadeh
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "DrawingProgramLayerListItem.hpp"
#include "DrawingProgramLayerFolder.hpp"
#include <cereal/types/string.hpp>

View file

@ -1,3 +1,21 @@
/*
* InfiniPaint
* Copyright (C) 2025-2026 Yousef Khadadeh
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <Helpers/NetworkingObjects/NetObjManager.hpp>
#include <Helpers/NetworkingObjects/NetObjOrderedList.hpp>

View file

@ -1,3 +1,21 @@
/*
* InfiniPaint
* Copyright (C) 2025-2026 Yousef Khadadeh
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "DrawingProgramLayerManager.hpp"
#include "../../World.hpp"
#include "Helpers/NetworkingObjects/NetObjID.hpp"

View file

@ -1,3 +1,21 @@
/*
* InfiniPaint
* Copyright (C) 2025-2026 Yousef Khadadeh
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include "DrawingProgramLayerListItem.hpp"
#include "DrawingProgramLayerManagerGUI.hpp"

View file

@ -1,3 +1,21 @@
/*
* InfiniPaint
* Copyright (C) 2025-2026 Yousef Khadadeh
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "DrawingProgramLayerManagerGUI.hpp"
#include "DrawingProgramLayerListItem.hpp"
#include "DrawingProgramLayerManager.hpp"

View file

@ -1,3 +1,21 @@
#/*
* InfiniPaint
* Copyright (C) 2025-2026 Yousef Khadadeh
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <unordered_set>
#include <Helpers/NetworkingObjects/NetObjOrderedList.hpp>

View file

@ -1,3 +1,21 @@
/*
* InfiniPaint
* Copyright (C) 2025-2026 Yousef Khadadeh
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "SerializedBlendMode.hpp"
#include <unordered_set>

View file

@ -1,3 +1,21 @@
/*
* InfiniPaint
* Copyright (C) 2025-2026 Yousef Khadadeh
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <include/core/SkBlendMode.h>
#include <nlohmann/json.hpp>

View file

@ -1,3 +1,21 @@
/*
* InfiniPaint
* Copyright (C) 2025-2026 Yousef Khadadeh
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "ToolConfiguration.hpp"
#include "DrawingProgram.hpp"
#include "../World.hpp"

View file

@ -1,3 +1,21 @@
/*
* InfiniPaint
* Copyright (C) 2025-2026 Yousef Khadadeh
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include "../SharedTypes.hpp"
#include "nlohmann/json.hpp"

View file

@ -1,3 +1,21 @@
/*
* InfiniPaint
* Copyright (C) 2025-2026 Yousef Khadadeh
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "BrushTool.hpp"
#include <Helpers/ConvertVec.hpp>
#include "../../GUIStuff/GUIManager.hpp"

View file

@ -1,3 +1,21 @@
/*
* InfiniPaint
* Copyright (C) 2025-2026 Yousef Khadadeh
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include "DrawingProgramToolBase.hpp"
#include <Helpers/Hashes.hpp>

View file

@ -1,3 +1,21 @@
/*
* InfiniPaint
* Copyright (C) 2025-2026 Yousef Khadadeh
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "DrawingProgramToolBase.hpp"
#include "BrushTool.hpp"
@ -55,7 +73,9 @@ std::unique_ptr<DrawingProgramToolBase> DrawingProgramToolBase::allocate_tool_ty
return nullptr;
}
Vector4f* DrawingProgramToolBase::color_picker_color(Vector4f* oldColor) { return nullptr; }
void DrawingProgramToolBase::input_paste_callback(const CustomEvents::PasteEvent& paste) {}
void DrawingProgramToolBase::input_android_text_box_input_callback(const CustomEvents::AndroidTextBoxInputEvent& textboxInput) {}
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) {}
@ -65,4 +85,6 @@ void DrawingProgramToolBase::input_pen_button_callback(const InputManager::PenBu
void DrawingProgramToolBase::input_pen_touch_callback(const InputManager::PenTouchCallbackArgs& touch) {}
void DrawingProgramToolBase::input_pen_motion_callback(const InputManager::PenMotionCallbackArgs& motion) {}
void DrawingProgramToolBase::input_pen_axis_callback(const InputManager::PenAxisCallbackArgs& axis) {}
bool DrawingProgramToolBase::phone_gui_tool_specific_bottom_toolbar_exists() { return false; }
void DrawingProgramToolBase::phone_gui_tool_specific_bottom_toolbar(PhoneDrawingProgramScreen& t) {}
std::optional<InputManager::TextBoxStartInfo> DrawingProgramToolBase::get_text_box_start_info() { return std::nullopt; }

View file

@ -1,3 +1,21 @@
/*
* InfiniPaint
* Copyright (C) 2025-2026 Yousef Khadadeh
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <include/core/SkCanvas.h>
#include "../../DrawData.hpp"
@ -38,7 +56,9 @@ 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 Vector4f* color_picker_color(Vector4f* oldColor);
virtual void input_paste_callback(const CustomEvents::PasteEvent& paste);
virtual void input_android_text_box_input_callback(const CustomEvents::AndroidTextBoxInputEvent& textboxInput);
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);
@ -48,6 +68,8 @@ class DrawingProgramToolBase {
virtual void input_pen_touch_callback(const InputManager::PenTouchCallbackArgs& touch);
virtual void input_pen_motion_callback(const InputManager::PenMotionCallbackArgs& motion);
virtual void input_pen_axis_callback(const InputManager::PenAxisCallbackArgs& axis);
virtual bool phone_gui_tool_specific_bottom_toolbar_exists();
virtual void phone_gui_tool_specific_bottom_toolbar(PhoneDrawingProgramScreen& t);
virtual std::optional<InputManager::TextBoxStartInfo> get_text_box_start_info();
virtual ~DrawingProgramToolBase();
static std::unique_ptr<DrawingProgramToolBase> allocate_tool_type(DrawingProgram& drawP, DrawingProgramToolType t);

View file

@ -1,3 +1,21 @@
/*
* InfiniPaint
* Copyright (C) 2025-2026 Yousef Khadadeh
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "EditTool.hpp"
#include "../DrawingProgram.hpp"
#include "../../MainProgram.hpp"
@ -45,9 +63,13 @@ void EditTool::gui_phone_toolbox(PhoneDrawingProgramScreen& t) {
auto& gui = drawP.world.main.g.gui;
gui.new_id("edit tool", [&] {
text_label_centered(gui, "Edit");
});
if(objInfoBeingEdited)
compEditTool->gui_phone_toolbox(t);
else {
gui.new_id("edit tool", [&] {
text_label_centered(gui, "Double tap object to edit");
});
}
}
void EditTool::erase_component(CanvasComponentContainer::ObjInfo* erasedComp) {
@ -60,6 +82,11 @@ void EditTool::input_paste_callback(const CustomEvents::PasteEvent& paste) {
compEditTool->input_paste_callback(paste);
}
void EditTool::input_android_text_box_input_callback(const CustomEvents::AndroidTextBoxInputEvent& textboxInput) {
if(objInfoBeingEdited)
compEditTool->input_android_text_box_input_callback(textboxInput);
}
void EditTool::input_text_key_callback(const InputManager::KeyCallbackArgs& key) {
if(objInfoBeingEdited)
compEditTool->input_text_key_callback(key);
@ -297,6 +324,23 @@ void EditTool::tool_update() {
}
}
Vector4f* EditTool::color_picker_color(Vector4f* oldColor) {
if(objInfoBeingEdited)
return compEditTool->color_picker_color(oldColor);
return nullptr;
}
bool EditTool::phone_gui_tool_specific_bottom_toolbar_exists() {
if(objInfoBeingEdited)
return compEditTool->phone_gui_tool_specific_bottom_toolbar_exists();
return false;
}
void EditTool::phone_gui_tool_specific_bottom_toolbar(PhoneDrawingProgramScreen& t) {
if(objInfoBeingEdited)
return compEditTool->phone_gui_tool_specific_bottom_toolbar(t);
}
bool EditTool::prevent_undo_or_redo() {
return objInfoBeingEdited || drawP.selection.is_something_selected();
}

View file

@ -1,3 +1,21 @@
/*
* InfiniPaint
* Copyright (C) 2025-2026 Yousef Khadadeh
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include "DrawingProgramToolBase.hpp"
#include <Helpers/SCollision.hpp>
@ -27,7 +45,11 @@ 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 Vector4f* color_picker_color(Vector4f* oldColor) override;
virtual bool phone_gui_tool_specific_bottom_toolbar_exists() override;
virtual void phone_gui_tool_specific_bottom_toolbar(PhoneDrawingProgramScreen& t) override;
virtual void input_paste_callback(const CustomEvents::PasteEvent& paste) override;
virtual void input_android_text_box_input_callback(const CustomEvents::AndroidTextBoxInputEvent& textboxInput) 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;

View file

@ -1,3 +1,21 @@
/*
* InfiniPaint
* Copyright (C) 2025-2026 Yousef Khadadeh
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "BrushEditTool.hpp"
#include "../../DrawingProgram.hpp"
#include "../../../World.hpp"
@ -29,6 +47,29 @@ void BrushEditTool::edit_gui(Toolbar& t) {
});
}
void BrushEditTool::gui_phone_toolbox(PhoneDrawingProgramScreen& t) {
using namespace GUIStuff;
using namespace ElementHelpers;
auto& a = static_cast<BrushStrokeCanvasComponent&>(comp->obj->get_comp());
auto& gui = drawP.world.main.g.gui;
auto commit_update_func = [&] { comp->obj->commit_update(drawP); };
gui.new_id("edit tool brush", [&] {
left_to_right_line_layout(gui, [&]() {
t.color_selector_button("Outline Color", &a.d.color, { .onChange = commit_update_func });
text_label(gui, "Outline Color");
});
});
}
Vector4f* BrushEditTool::color_picker_color(Vector4f* oldColor) {
auto& a = static_cast<BrushStrokeCanvasComponent&>(comp->obj->get_comp());
if(oldColor == &a.d.color)
return oldColor;
return nullptr;
}
void BrushEditTool::edit_start(EditTool& editTool, std::any& prevData) {
auto& a = static_cast<BrushStrokeCanvasComponent&>(comp->obj->get_comp());
oldColor = a.d.color;

View file

@ -1,3 +1,21 @@
/*
* InfiniPaint
* Copyright (C) 2025-2026 Yousef Khadadeh
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include "DrawingProgramEditToolBase.hpp"
#include <Helpers/SCollision.hpp>
@ -12,6 +30,8 @@ class BrushEditTool : public DrawingProgramEditToolBase {
virtual void commit_edit_updates(std::any& prevData) override;
virtual bool edit_update() override;
virtual void edit_gui(Toolbar& t) override;
virtual void gui_phone_toolbox(PhoneDrawingProgramScreen& t) override;
virtual Vector4f* color_picker_color(Vector4f* oldColor) override;
private:
Vector4f oldColor;
};

View file

@ -1,3 +1,21 @@
/*
* InfiniPaint
* Copyright (C) 2025-2026 Yousef Khadadeh
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "DrawingProgramEditToolBase.hpp"
#include "../../../MainProgram.hpp"
@ -10,12 +28,16 @@ void DrawingProgramEditToolBase::right_click_popup_gui(Toolbar& t, Vector2f popu
t.paint_popup(popupPos);
}
Vector4f* DrawingProgramEditToolBase::color_picker_color(Vector4f* oldColor) { return nullptr; }
void DrawingProgramEditToolBase::input_paste_callback(const CustomEvents::PasteEvent& paste) {}
void DrawingProgramEditToolBase::input_android_text_box_input_callback(const CustomEvents::AndroidTextBoxInputEvent& textboxInput) {}
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) {}
void DrawingProgramEditToolBase::input_mouse_button_on_canvas_callback(const InputManager::MouseButtonCallbackArgs& button, bool isDraggingPoint) {}
void DrawingProgramEditToolBase::input_mouse_motion_callback(const InputManager::MouseMotionCallbackArgs& motion, bool isDraggingPoint) {}
bool DrawingProgramEditToolBase::phone_gui_tool_specific_bottom_toolbar_exists() { return false; }
void DrawingProgramEditToolBase::phone_gui_tool_specific_bottom_toolbar(PhoneDrawingProgramScreen& t) {}
std::optional<InputManager::TextBoxStartInfo> DrawingProgramEditToolBase::get_text_box_start_info() { return std::nullopt; }
DrawingProgramEditToolBase::~DrawingProgramEditToolBase() {}

View file

@ -1,7 +1,26 @@
/*
* InfiniPaint
* Copyright (C) 2025-2026 Yousef Khadadeh
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <include/core/SkCanvas.h>
#include "../../../DrawData.hpp"
#include "../../../CanvasComponents/CanvasComponentContainer.hpp"
#include "../../../Screens/PhoneDrawingProgramScreen.hpp"
class DrawingProgram;
class EditTool;
@ -13,8 +32,13 @@ class DrawingProgramEditToolBase {
virtual void commit_edit_updates(std::any& prevData) = 0;
virtual bool edit_update() = 0;
virtual void edit_gui(Toolbar& t) = 0;
virtual void gui_phone_toolbox(PhoneDrawingProgramScreen& t) = 0;
virtual void right_click_popup_gui(Toolbar& t, Vector2f popupPos);
virtual Vector4f* color_picker_color(Vector4f* oldColor);
virtual bool phone_gui_tool_specific_bottom_toolbar_exists();
virtual void phone_gui_tool_specific_bottom_toolbar(PhoneDrawingProgramScreen& t);
virtual void input_paste_callback(const CustomEvents::PasteEvent& paste);
virtual void input_android_text_box_input_callback(const CustomEvents::AndroidTextBoxInputEvent& textboxInput);
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);

View file

@ -1,3 +1,21 @@
/*
* InfiniPaint
* Copyright (C) 2025-2026 Yousef Khadadeh
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "EllipseDrawEditTool.hpp"
#include "../../DrawingProgram.hpp"
#include "../../../World.hpp"
@ -50,6 +68,49 @@ void EllipseDrawEditTool::edit_gui(Toolbar& t) {
});
}
Vector4f* EllipseDrawEditTool::color_picker_color(Vector4f* oldColor) {
auto& a = static_cast<EllipseCanvasComponent&>(comp->obj->get_comp());
if(oldColor == &a.d.fillColor)
return oldColor;
if(oldColor == &a.d.strokeColor)
return oldColor;
return nullptr;
}
void EllipseDrawEditTool::gui_phone_toolbox(PhoneDrawingProgramScreen& t) {
using namespace GUIStuff;
using namespace ElementHelpers;
auto& a = static_cast<EllipseCanvasComponent&>(comp->obj->get_comp());
auto& gui = drawP.world.main.g.gui;
auto commit_update_func = [&] { comp->obj->commit_update(drawP); };
auto commit_update_and_layout_func = [&] {
comp->obj->commit_update(drawP);
drawP.world.main.g.gui.set_to_layout();
};
gui.new_id("edit tool ellipse", [&] {
radio_button_selector(gui, "Fill selector", &a.d.fillStrokeMode, {
{"Fill only", 0},
{"Outline only", 1},
{"Fill and outline", 2}
}, commit_update_and_layout_func);
if(a.d.fillStrokeMode == 0 || a.d.fillStrokeMode == 2) {
left_to_right_line_layout(gui, [&] {
t.color_selector_button("Fill color button", &a.d.fillColor, { .onChange = commit_update_func });
text_label(gui, "Fill Color");
});
}
if(a.d.fillStrokeMode == 1 || a.d.fillStrokeMode == 2) {
slider_scalar_field(gui, "relstrokewidth", "Outline Size", &a.d.strokeWidth, 3.0f, 40.0f, {.onEdit = commit_update_func});
left_to_right_line_layout(gui, [&] {
t.color_selector_button("Outline color button", &a.d.strokeColor, { .onChange = commit_update_func });
text_label(gui, "Outline Color");
});
}
});
}
void EllipseDrawEditTool::edit_start(EditTool& editTool, std::any& prevData) {
auto& a = static_cast<EllipseCanvasComponent&>(comp->obj->get_comp());

View file

@ -1,3 +1,21 @@
/*
* InfiniPaint
* Copyright (C) 2025-2026 Yousef Khadadeh
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include "DrawingProgramEditToolBase.hpp"
#include "../../../CanvasComponents/CanvasComponentContainer.hpp"
@ -11,9 +29,11 @@ class EllipseDrawEditTool : public DrawingProgramEditToolBase {
public:
EllipseDrawEditTool(DrawingProgram& initDrawP, CanvasComponentContainer::ObjInfo* initComp);
virtual void edit_start(EditTool& editTool, std::any& prevData) override;
virtual void gui_phone_toolbox(PhoneDrawingProgramScreen& t) override;
virtual void commit_edit_updates(std::any& prevData) override;
virtual bool edit_update() override;
virtual void edit_gui(Toolbar& t) override;
virtual Vector4f* color_picker_color(Vector4f* oldColor) override;
private:
void commit();

View file

@ -1,3 +1,21 @@
/*
* InfiniPaint
* Copyright (C) 2025-2026 Yousef Khadadeh
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "ImageEditTool.hpp"
#include "../../DrawingProgram.hpp"
#include "../../../CanvasComponents/ImageCanvasComponent.hpp"
@ -77,3 +95,19 @@ void ImageEditTool::edit_gui(Toolbar& t) {
text_label_centered(gui, "Loading resource...");
});
}
void ImageEditTool::gui_phone_toolbox(PhoneDrawingProgramScreen& t) {
using namespace GUIStuff;
using namespace ElementHelpers;
ImageCanvasComponent& a = static_cast<ImageCanvasComponent&>(comp->obj->get_comp());
auto& gui = drawP.world.main.g.gui;
gui.new_id("edit tool image", [&] {
text_label_centered(gui, "File Properties");
auto resourceData = drawP.world.netObjMan.get_obj_temporary_ref_from_id<ResourceData>(a.d.imageID);
if(resourceData)
text_label(gui, "Name: " + resourceData->name);
else
text_label_centered(gui, "Loading resource...");
});
}

View file

@ -1,3 +1,21 @@
/*
* InfiniPaint
* Copyright (C) 2025-2026 Yousef Khadadeh
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include "DrawingProgramEditToolBase.hpp"
#include <any>
@ -11,4 +29,5 @@ class ImageEditTool : public DrawingProgramEditToolBase {
virtual void commit_edit_updates(std::any& prevData) override;
virtual bool edit_update() override;
virtual void edit_gui(Toolbar& t) override;
virtual void gui_phone_toolbox(PhoneDrawingProgramScreen& t) override;
};

View file

@ -1,3 +1,21 @@
/*
* InfiniPaint
* Copyright (C) 2025-2026 Yousef Khadadeh
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "RectDrawEditTool.hpp"
#include "../../DrawingProgram.hpp"
#include "../../../World.hpp"
@ -48,6 +66,50 @@ void RectDrawEditTool::edit_gui(Toolbar& t) {
});
}
Vector4f* RectDrawEditTool::color_picker_color(Vector4f* oldColor) {
auto& a = static_cast<RectangleCanvasComponent&>(comp->obj->get_comp());
if(oldColor == &a.d.fillColor)
return oldColor;
if(oldColor == &a.d.strokeColor)
return oldColor;
return nullptr;
}
void RectDrawEditTool::gui_phone_toolbox(PhoneDrawingProgramScreen& t) {
using namespace GUIStuff;
using namespace ElementHelpers;
auto& a = static_cast<RectangleCanvasComponent&>(comp->obj->get_comp());
auto commit_update_and_layout_func = [&] {
comp->obj->commit_update(drawP);
drawP.world.main.g.gui.set_to_layout();
};
auto commit_update_func = [&] { comp->obj->commit_update(drawP); };
auto& gui = drawP.world.main.g.gui;
gui.new_id("edit tool rectangle", [&] {
slider_scalar_field(gui, "relradiuswidth", "Corner Radius", &a.d.cornerRadius, 0.0f, 40.0f, { .onEdit = commit_update_func });
radio_button_selector(gui, "Fill selector", &a.d.fillStrokeMode, {
{"Fill only", 0},
{"Outline only", 1},
{"Fill and outline", 2}
}, commit_update_and_layout_func);
if(a.d.fillStrokeMode == 0 || a.d.fillStrokeMode == 2) {
left_to_right_line_layout(gui, [&] {
t.color_selector_button("Fill color button", &a.d.fillColor, { .onChange = commit_update_func });
text_label(gui, "Fill Color");
});
}
if(a.d.fillStrokeMode == 1 || a.d.fillStrokeMode == 2) {
slider_scalar_field(gui, "relstrokewidth", "Outline Size", &a.d.strokeWidth, 3.0f, 40.0f, { .onEdit = commit_update_func });
left_to_right_line_layout(gui, [&] {
t.color_selector_button("Outline color button", &a.d.strokeColor, { .onChange = commit_update_func });
text_label(gui, "Outline Color");
});
}
});
}
void RectDrawEditTool::edit_start(EditTool& editTool, std::any& prevData) {
auto& a = static_cast<RectangleCanvasComponent&>(comp->obj->get_comp());
prevData = a.d;

View file

@ -1,3 +1,21 @@
/*
* InfiniPaint
* Copyright (C) 2025-2026 Yousef Khadadeh
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include "DrawingProgramEditToolBase.hpp"
#include "../../../CanvasComponents/RectangleCanvasComponent.hpp"
@ -13,6 +31,8 @@ class RectDrawEditTool : public DrawingProgramEditToolBase {
virtual void commit_edit_updates(std::any& prevData) override;
virtual bool edit_update() override;
virtual void edit_gui(Toolbar& t) override;
virtual void gui_phone_toolbox(PhoneDrawingProgramScreen& t) override;
virtual Vector4f* color_picker_color(Vector4f* oldColor) override;
private:
std::optional<RectangleCanvasComponent::Data> oldData;
};

View file

@ -1,3 +1,21 @@
/*
* InfiniPaint
* Copyright (C) 2025-2026 Yousef Khadadeh
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "TextBoxEditTool.hpp"
#include "../../DrawingProgram.hpp"
#include "../../../MainProgram.hpp"
@ -17,8 +35,10 @@
#include "../../../GUIStuff/ElementHelpers/LayoutHelpers.hpp"
#include "../../../GUIStuff/ElementHelpers/ButtonHelpers.hpp"
#include "../../../GUIStuff/ElementHelpers/NumberSliderHelpers.hpp"
#include "../../../GUIStuff/Elements/PositionAdjustingPopupMenu.hpp"
#include "../../../GUIStuff/ElementHelpers/DropdownHelpers.hpp"
#include "../../../GUIStuff/Elements/FontPicker.hpp"
#include "../../../GUIStuff/Elements/LayoutElement.hpp"
#include "../../../GUIStuff/Elements/ScrollArea.hpp"
using namespace RichText;
@ -26,13 +46,31 @@ TextBoxEditTool::TextBoxEditTool(DrawingProgram& initDrawP, CanvasComponentConta
DrawingProgramEditToolBase(initDrawP, initComp)
{}
void TextBoxEditTool::commit_update_func() {
void TextBoxEditTool::commit_update_func_no_android_update() {
comp->obj->commit_update(drawP);
if(userInput)
userInput->android_force_update_modmap();
}
void TextBoxEditTool::commit_update_and_layout_func() {
void TextBoxEditTool::commit_update_and_layout_func_no_android_update() {
comp->obj->commit_update(drawP);
drawP.world.main.g.gui.set_to_layout();
// modmap update is required at the very least in response to input from the C++ side
if(userInput)
userInput->android_force_update_modmap();
}
void TextBoxEditTool::commit_update_func_and_android_update() {
comp->obj->commit_update(drawP);
if(userInput)
userInput->android_force_update_textbox_and_cursor();
}
void TextBoxEditTool::commit_update_and_layout_func_and_android_update() {
comp->obj->commit_update(drawP);
drawP.world.main.g.gui.set_to_layout();
if(userInput)
userInput->android_force_update_textbox_and_cursor();
}
void TextBoxEditTool::edit_gui(Toolbar& t) {
@ -52,7 +90,7 @@ void TextBoxEditTool::edit_gui(Toolbar& t) {
.onFontChange = [&] {
currentMods[TextStyleModifier::ModifierType::FONT_FAMILIES] = std::make_shared<FontFamiliesTextStyleModifier>(std::vector<SkString>{SkString{newFontName.c_str(), newFontName.size()}});
add_undo_if_selecting_area(a, [&]() {a.textBox->set_text_style_modifier_between(a.cursor->selectionBeginPos, a.cursor->selectionEndPos, currentMods[TextStyleModifier::ModifierType::FONT_FAMILIES]);});
commit_update_func();
commit_update_func_and_android_update();
}
});
});
@ -64,7 +102,7 @@ void TextBoxEditTool::edit_gui(Toolbar& t) {
newIsBold = !newIsBold;
currentMods[TextStyleModifier::ModifierType::WEIGHT] = std::make_shared<WeightTextStyleModifier>(newIsBold ? SkFontStyle::Weight::kBold_Weight : SkFontStyle::Weight::kNormal_Weight);
add_undo_if_selecting_area(a, [&]() {a.textBox->set_text_style_modifier_between(a.cursor->selectionBeginPos, a.cursor->selectionEndPos, currentMods[TextStyleModifier::ModifierType::WEIGHT]);});
commit_update_func();
commit_update_func_and_android_update();
}
});
@ -74,14 +112,14 @@ void TextBoxEditTool::edit_gui(Toolbar& t) {
newIsItalic = !newIsItalic;
currentMods[TextStyleModifier::ModifierType::SLANT] = std::make_shared<SlantTextStyleModifier>(newIsItalic ? SkFontStyle::Slant::kItalic_Slant : SkFontStyle::Slant::kUpright_Slant);
add_undo_if_selecting_area(a, [&]() {a.textBox->set_text_style_modifier_between(a.cursor->selectionBeginPos, a.cursor->selectionEndPos, currentMods[TextStyleModifier::ModifierType::SLANT]);});
commit_update_func();
commit_update_func_and_android_update();
}
});
auto decorationChange = [&] {
currentMods[TextStyleModifier::ModifierType::DECORATION] = std::make_shared<DecorationTextStyleModifier>(get_new_decoration_value());
add_undo_if_selecting_area(a, [&]() {a.textBox->set_text_style_modifier_between(a.cursor->selectionBeginPos, a.cursor->selectionEndPos, currentMods[TextStyleModifier::ModifierType::DECORATION]);});
commit_update_func();
commit_update_func_and_android_update();
};
svg_icon_button(gui, "Underline button", "data/icons/RemixIcon/underline.svg", {
@ -115,7 +153,7 @@ void TextBoxEditTool::edit_gui(Toolbar& t) {
.isSelected = isSelected,
.onClick = [&, func] {
add_undo(func);
commit_update_func();
commit_update_func_and_android_update();
}
});
};
@ -150,7 +188,7 @@ void TextBoxEditTool::edit_gui(Toolbar& t) {
.onEdit = [&] {
currentMods[TextStyleModifier::ModifierType::SIZE] = std::make_shared<SizeTextStyleModifier>(newFontSize);
a.textBox->set_text_style_modifier_between(a.cursor->selectionBeginPos, a.cursor->selectionEndPos, currentMods[TextStyleModifier::ModifierType::SIZE]);
commit_update_func();
commit_update_func_and_android_update();
},
.onSelect = [&] { hold_undo_data("Font Size", a); },
.onDeselect = [&] { release_undo_data("Font Size"); }
@ -161,7 +199,7 @@ void TextBoxEditTool::edit_gui(Toolbar& t) {
.onChange = [&] {
currentMods[TextStyleModifier::ModifierType::COLOR] = std::make_shared<ColorTextStyleModifier>(newTextColor);
a.textBox->set_text_style_modifier_between(a.cursor->selectionBeginPos, a.cursor->selectionEndPos, currentMods[TextStyleModifier::ModifierType::COLOR]);
commit_update_func();
commit_update_func_and_android_update();
},
.onSelect = [&] { hold_undo_data("Text Color", a); },
.onDeselect = [&] { release_undo_data("Text Color"); }
@ -176,13 +214,13 @@ void TextBoxEditTool::edit_gui(Toolbar& t) {
newHighlightColor.w() = 1.0f;
currentMods[TextStyleModifier::ModifierType::HIGHLIGHT_COLOR] = std::make_shared<HighlightColorTextStyleModifier>(newHighlightColor);
add_undo_if_selecting_area(a, [&]() {a.textBox->set_text_style_modifier_between(a.cursor->selectionBeginPos, a.cursor->selectionEndPos, currentMods[TextStyleModifier::ModifierType::HIGHLIGHT_COLOR]);});
commit_update_and_layout_func();
commit_update_and_layout_func_and_android_update();
}
},
.onChange = [&] {
currentMods[TextStyleModifier::ModifierType::HIGHLIGHT_COLOR] = std::make_shared<HighlightColorTextStyleModifier>(newHighlightColor);
a.textBox->set_text_style_modifier_between(a.cursor->selectionBeginPos, a.cursor->selectionEndPos, currentMods[TextStyleModifier::ModifierType::HIGHLIGHT_COLOR]);
commit_update_and_layout_func();
commit_update_and_layout_func_and_android_update();
},
.onSelect = [&] { hold_undo_data("Highlight Color", a); },
.onDeselect = [&] { release_undo_data("Highlight Color"); }
@ -193,7 +231,7 @@ void TextBoxEditTool::edit_gui(Toolbar& t) {
newHighlightColor = {0.0f, 0.0f, 0.0f, 0.0f};
currentMods[TextStyleModifier::ModifierType::HIGHLIGHT_COLOR] = std::make_shared<HighlightColorTextStyleModifier>(newHighlightColor);
add_undo_if_selecting_area(a, [&]() {a.textBox->set_text_style_modifier_between(a.cursor->selectionBeginPos, a.cursor->selectionEndPos, currentMods[TextStyleModifier::ModifierType::HIGHLIGHT_COLOR]);});
commit_update_and_layout_func();
commit_update_and_layout_func_and_android_update();
}
});
}
@ -202,12 +240,323 @@ void TextBoxEditTool::edit_gui(Toolbar& t) {
});
}
Vector4f* TextBoxEditTool::color_picker_color(Vector4f* oldColor) {
if(oldColor == &newTextColor)
return oldColor;
if(oldColor == &newHighlightColor)
return oldColor;
return nullptr;
}
bool TextBoxEditTool::phone_gui_tool_specific_bottom_toolbar_exists() {
return true;
}
void TextBoxEditTool::phone_gui_tool_specific_bottom_toolbar(PhoneDrawingProgramScreen& t) {
using namespace GUIStuff;
using namespace ElementHelpers;
auto& gui = drawP.world.main.g.gui;
auto& io = gui.io;
CLAY_AUTO_ID({
.layout = {
.sizing = {.width = CLAY_SIZING_FIT(0), .height = CLAY_SIZING_FIT(0) },
.childGap = io.theme->childGap1,
.childAlignment = { .x = CLAY_ALIGN_X_LEFT, .y = CLAY_ALIGN_Y_BOTTOM},
.layoutDirection = CLAY_TOP_TO_BOTTOM
}
}) {
CLAY_AUTO_ID({
.layout = {
.sizing = {.width = CLAY_SIZING_GROW(0), .height = CLAY_SIZING_GROW(0) },
.childGap = io.theme->childGap1,
.childAlignment = { .x = CLAY_ALIGN_X_CENTER, .y = CLAY_ALIGN_Y_CENTER},
.layoutDirection = CLAY_LEFT_TO_RIGHT
}
}) {
switch(phoneGUIData.popupType) {
case PhoneGUIData::PopupType::NONE:
break;
case PhoneGUIData::PopupType::TEXT_COLOR: {
if(t.colorPickerPopupData.screenType == PhoneDrawingProgramScreen::ColorPickerPopupData::ScreenType::NORMAL) {
CLAY_AUTO_ID({
.layout = {
.sizing = {.width = CLAY_SIZING_GROW(0), .height = CLAY_SIZING_FIT(0) },
}
}) {}
}
t.color_settings_popup(&newTextColor, phoneGUIData.colorSelectorData, nullptr);
break;
}
case PhoneGUIData::PopupType::HIGHLIGHT_COLOR: {
if(t.colorPickerPopupData.screenType == PhoneDrawingProgramScreen::ColorPickerPopupData::ScreenType::NORMAL) {
CLAY_AUTO_ID({
.layout = {
.sizing = {.width = CLAY_SIZING_GROW(0), .height = CLAY_SIZING_FIT(0) },
}
}) {}
}
t.color_settings_popup(&newHighlightColor, phoneGUIData.colorSelectorData, nullptr, true, true);
break;
}
}
}
CLAY_AUTO_ID({
.layout = {
.sizing = {.width = CLAY_SIZING_GROW(0), .height = CLAY_SIZING_FIT(0) },
.childGap = io.theme->childGap1,
.childAlignment = { .x = CLAY_ALIGN_X_CENTER, .y = CLAY_ALIGN_Y_CENTER},
.layoutDirection = CLAY_LEFT_TO_RIGHT
}
}) {
gui.element<LayoutElement>("bottom toolbar", [&](LayoutElement*, const Clay_ElementId& lId) {
CLAY(lId, {
.layout = {
.sizing = {.width = CLAY_SIZING_FIT(0), .height = CLAY_SIZING_FIT(0)}
},
.backgroundColor = convert_vec4<Clay_Color>(io.theme->backColor1),
.cornerRadius = CLAY_CORNER_RADIUS(io.theme->windowCorners1)
}) {
gui.clipping_element<ScrollArea>("tools scroll", ScrollArea::Options{
.scrollHorizontal = true,
.clipHorizontal = true,
.scrollbarX = ScrollArea::ScrollbarType::NONE,
.layoutDirection = CLAY_LEFT_TO_RIGHT,
.xAlign = CLAY_ALIGN_X_LEFT,
.yAlign = CLAY_ALIGN_Y_CENTER,
.innerContent = [&](auto&) {
phone_bottom_toolbar_gui(t);
}
});
}
});
}
}
}
void TextBoxEditTool::phone_bottom_toolbar_gui(PhoneDrawingProgramScreen& t) {
using namespace GUIStuff;
using namespace ElementHelpers;
auto& gui = drawP.world.main.g.gui;
auto& a = static_cast<TextBoxCanvasComponent&>(comp->obj->get_comp());
auto& currentMods = *currentModsPtr;
color_button(gui, "Text Color", &newTextColor, {
.isSelected = phoneGUIData.popupType == PhoneGUIData::PopupType::TEXT_COLOR,
.onClick = [&] {
t.reset_color_picker_popup_data();
if(phoneGUIData.popupType == PhoneGUIData::PopupType::TEXT_COLOR)
phoneGUIData.popupType = PhoneGUIData::PopupType::NONE;
else
phoneGUIData.popupType = PhoneGUIData::PopupType::TEXT_COLOR;
phoneGUIData.colorSelectorData = {
.onChange = [&] {
currentMods[TextStyleModifier::ModifierType::COLOR] = std::make_shared<ColorTextStyleModifier>(newTextColor);
a.textBox->set_text_style_modifier_between(a.cursor->selectionBeginPos, a.cursor->selectionEndPos, currentMods[TextStyleModifier::ModifierType::COLOR]);
commit_update_func_and_android_update();
},
.onSelect = [&] { hold_undo_data("Text Color", a); },
.onDeselect = [&] { release_undo_data("Text Color"); }
};
}
});
color_button(gui, "Highlight Color", &newHighlightColor, {
.isSelected = phoneGUIData.popupType == PhoneGUIData::PopupType::HIGHLIGHT_COLOR,
.onClick = [&] {
t.reset_color_picker_popup_data();
if(phoneGUIData.popupType == PhoneGUIData::PopupType::HIGHLIGHT_COLOR)
phoneGUIData.popupType = PhoneGUIData::PopupType::NONE;
else
phoneGUIData.popupType = PhoneGUIData::PopupType::HIGHLIGHT_COLOR;
phoneGUIData.colorSelectorData = {
.onChange = [&] {
currentMods[TextStyleModifier::ModifierType::HIGHLIGHT_COLOR] = std::make_shared<HighlightColorTextStyleModifier>(newHighlightColor);
a.textBox->set_text_style_modifier_between(a.cursor->selectionBeginPos, a.cursor->selectionEndPos, currentMods[TextStyleModifier::ModifierType::HIGHLIGHT_COLOR]);
commit_update_and_layout_func_and_android_update();
},
.onSelect = [&] { hold_undo_data("Highlight Color", a); },
.onDeselect = [&] { release_undo_data("Highlight Color"); }
};
}
});
CLAY_AUTO_ID({
.layout = {.sizing = {.width = CLAY_SIZING_FIXED(80)}}
}) {
number_dropdown(gui, "Font size", &newFontSize, 2, 80, 2, [&] {
currentMods[TextStyleModifier::ModifierType::SIZE] = std::make_shared<SizeTextStyleModifier>(newFontSize);
add_undo_if_selecting_area(a, [&]() {a.textBox->set_text_style_modifier_between(a.cursor->selectionBeginPos, a.cursor->selectionEndPos, currentMods[TextStyleModifier::ModifierType::SIZE]);});
commit_update_func_and_android_update();
});
}
Element* fontPickerButton = svg_icon_button(gui, "Font Picker button", "data/icons/RemixIcon/font-serif.svg", {
.drawType = SelectableButton::DrawType::TRANSPARENT_ALL,
.isSelected = fontPickerIsOpen,
.onClick = [&] {
fontPickerIsOpen = !fontPickerIsOpen;
}
});
if(fontPickerIsOpen) {
gui.set_z_index(gui.get_z_index() + 1, [&] {
dropdown_many_element_popup_layout(gui, "Font Picker Popup", DropDownPopupLayout{
.button = fontPickerButton,
.isOpen = &fontPickerIsOpen,
.entrySize = {200.0f, BIG_BUTTON_SIZE},
.entryCount = FontPicker::sorted_font_list(gui).size(),
.entryLayout = [&](size_t i) {
gui.element<SelectableButton>("font button", SelectableButton::Data{
.drawType = SelectableButton::DrawType::TRANSPARENT_ALL,
.isSelected = newFontName == FontPicker::sorted_font_list(gui)[i],
.onClick = [&, i] {
newFontName = FontPicker::sorted_font_list(gui)[i];
currentMods[TextStyleModifier::ModifierType::FONT_FAMILIES] = std::make_shared<FontFamiliesTextStyleModifier>(std::vector<SkString>{SkString{newFontName.c_str(), newFontName.size()}});
add_undo_if_selecting_area(a, [&]() {a.textBox->set_text_style_modifier_between(a.cursor->selectionBeginPos, a.cursor->selectionEndPos, currentMods[TextStyleModifier::ModifierType::FONT_FAMILIES]);});
commit_update_func_and_android_update();
fontPickerIsOpen = false;
},
.innerContent = [&, i] (const SelectableButton::InnerContentCallbackParameters&) {
CLAY_AUTO_ID({
.layout = {
.sizing = {.width = CLAY_SIZING_GROW(0), .height = CLAY_SIZING_GROW(0)},
.childAlignment = {.x = CLAY_ALIGN_X_LEFT, .y = CLAY_ALIGN_Y_CENTER}
}
}) {
TextParagraph::Data d;
RichText::TextData::Paragraph& par = d.text.paragraphs.emplace_back();
par.text = FontPicker::sorted_font_list(gui)[i];
d.allowNewlines = false;
d.ellipsis = false;
RichText::PositionedTextStyleMod& positionedMod = d.text.tStyleMods.emplace_back();
positionedMod.pos = {0, 0};
positionedMod.mods[RichText::TextStyleModifier::ModifierType::FONT_FAMILIES] = std::make_shared<RichText::FontFamiliesTextStyleModifier>(std::vector<SkString>{SkString{FontPicker::sorted_font_list(gui)[i].c_str(), FontPicker::sorted_font_list(gui)[i].size()}});
gui.element<TextParagraph>("font name", d);
}
}
});
}
});
});
}
svg_icon_button(gui, "Bold button", "data/icons/RemixIcon/bold.svg", {
.drawType = SelectableButton::DrawType::TRANSPARENT_ALL,
.isSelected = newIsBold,
.onClick = [&] {
newIsBold = !newIsBold;
currentMods[TextStyleModifier::ModifierType::WEIGHT] = std::make_shared<WeightTextStyleModifier>(newIsBold ? SkFontStyle::Weight::kBold_Weight : SkFontStyle::Weight::kNormal_Weight);
add_undo_if_selecting_area(a, [&]() {a.textBox->set_text_style_modifier_between(a.cursor->selectionBeginPos, a.cursor->selectionEndPos, currentMods[TextStyleModifier::ModifierType::WEIGHT]);});
commit_update_func_and_android_update();
}
});
svg_icon_button(gui, "Italic button", "data/icons/RemixIcon/italic.svg", {
.drawType = SelectableButton::DrawType::TRANSPARENT_ALL,
.isSelected = newIsItalic,
.onClick = [&] {
newIsItalic = !newIsItalic;
currentMods[TextStyleModifier::ModifierType::SLANT] = std::make_shared<SlantTextStyleModifier>(newIsItalic ? SkFontStyle::Slant::kItalic_Slant : SkFontStyle::Slant::kUpright_Slant);
add_undo_if_selecting_area(a, [&]() {a.textBox->set_text_style_modifier_between(a.cursor->selectionBeginPos, a.cursor->selectionEndPos, currentMods[TextStyleModifier::ModifierType::SLANT]);});
commit_update_func_and_android_update();
}
});
auto decorationChange = [&] {
currentMods[TextStyleModifier::ModifierType::DECORATION] = std::make_shared<DecorationTextStyleModifier>(get_new_decoration_value());
add_undo_if_selecting_area(a, [&]() {a.textBox->set_text_style_modifier_between(a.cursor->selectionBeginPos, a.cursor->selectionEndPos, currentMods[TextStyleModifier::ModifierType::DECORATION]);});
commit_update_func_and_android_update();
};
svg_icon_button(gui, "Underline button", "data/icons/RemixIcon/underline.svg", {
.drawType = SelectableButton::DrawType::TRANSPARENT_ALL,
.isSelected = newIsUnderlined,
.onClick = [&, decorationChange] {
newIsUnderlined = !newIsUnderlined;
decorationChange();
}
});
svg_icon_button(gui, "Strikethrough button", "data/icons/RemixIcon/strikethrough.svg", {
.drawType = SelectableButton::DrawType::TRANSPARENT_ALL,
.isSelected = newIsLinethrough,
.onClick = [&, decorationChange] {
newIsLinethrough = !newIsLinethrough;
decorationChange();
}
});
svg_icon_button(gui, "Overline button", "data/icons/RemixIcon/overline.svg", {
.drawType = SelectableButton::DrawType::TRANSPARENT_ALL,
.isSelected = newIsOverline,
.onClick = [&, decorationChange] {
newIsOverline = !newIsOverline;
decorationChange();
}
});
auto paragraph_operation_button = [&](const char* id, const char* svgPath, bool isSelected, const std::function<void()>& func) {
svg_icon_button(gui, id, svgPath, {
.drawType = SelectableButton::DrawType::TRANSPARENT_ALL,
.isSelected = isSelected,
.onClick = [&, func] {
add_undo(func);
commit_update_func_and_android_update();
}
});
};
paragraph_operation_button("Align left button", "data/icons/RemixIcon/align-left.svg", currentPStyle.textAlignment == skia::textlayout::TextAlign::kLeft, [&] {
currentPStyle.textAlignment = skia::textlayout::TextAlign::kLeft;
a.textBox->set_text_alignment_between(a.cursor->selectionBeginPos.fParagraphIndex, a.cursor->selectionEndPos.fParagraphIndex, skia::textlayout::TextAlign::kLeft);
});
paragraph_operation_button("Align center button", "data/icons/RemixIcon/align-center.svg", currentPStyle.textAlignment == skia::textlayout::TextAlign::kCenter, [&] {
currentPStyle.textAlignment = skia::textlayout::TextAlign::kCenter;
a.textBox->set_text_alignment_between(a.cursor->selectionBeginPos.fParagraphIndex, a.cursor->selectionEndPos.fParagraphIndex, skia::textlayout::TextAlign::kCenter);
});
paragraph_operation_button("Align right button", "data/icons/RemixIcon/align-right.svg", currentPStyle.textAlignment == skia::textlayout::TextAlign::kRight, [&] {
currentPStyle.textAlignment = skia::textlayout::TextAlign::kRight;
a.textBox->set_text_alignment_between(a.cursor->selectionBeginPos.fParagraphIndex, a.cursor->selectionEndPos.fParagraphIndex, skia::textlayout::TextAlign::kRight);
});
paragraph_operation_button("Align justify button", "data/icons/RemixIcon/align-justify.svg", currentPStyle.textAlignment == skia::textlayout::TextAlign::kJustify, [&] {
currentPStyle.textAlignment = skia::textlayout::TextAlign::kJustify;
a.textBox->set_text_alignment_between(a.cursor->selectionBeginPos.fParagraphIndex, a.cursor->selectionEndPos.fParagraphIndex, skia::textlayout::TextAlign::kJustify);
});
paragraph_operation_button("Text direction left button", "data/icons/RemixIcon/text-direction-l.svg", currentPStyle.textDirection == skia::textlayout::TextDirection::kLtr, [&] {
currentPStyle.textDirection = skia::textlayout::TextDirection::kLtr;
a.textBox->set_text_direction_between(a.cursor->selectionBeginPos.fParagraphIndex, a.cursor->selectionEndPos.fParagraphIndex, skia::textlayout::TextDirection::kLtr);
});
paragraph_operation_button("Text direction right button", "data/icons/RemixIcon/text-direction-r.svg", currentPStyle.textDirection == skia::textlayout::TextDirection::kRtl, [&] {
currentPStyle.textDirection = skia::textlayout::TextDirection::kRtl;
a.textBox->set_text_direction_between(a.cursor->selectionBeginPos.fParagraphIndex, a.cursor->selectionEndPos.fParagraphIndex, skia::textlayout::TextDirection::kRtl);
});
}
void TextBoxEditTool::gui_phone_toolbox(PhoneDrawingProgramScreen& t) {
}
void TextBoxEditTool::input_paste_callback(const CustomEvents::PasteEvent& paste) {
if(userInput && userInput->id == drawP.world.main.input.currentTextboxID.value()) {
auto& a = static_cast<TextBoxCanvasComponent&>(comp->obj->get_comp());
if(userInput->input_paste_callback(paste)) {
commit_update_and_layout_func();
set_styles_at_selection(a);
commit_update_and_layout_func_no_android_update();
}
}
}
void TextBoxEditTool::input_android_text_box_input_callback(const CustomEvents::AndroidTextBoxInputEvent& textboxInput) {
if(userInput && userInput->id == drawP.world.main.input.currentTextboxID.value()) {
auto& a = static_cast<TextBoxCanvasComponent&>(comp->obj->get_comp());
auto changes = userInput->input_android_text_box_input_callback(textboxInput);
if(changes.textEdited || changes.cursorChanged) {
set_styles_at_selection(a);
commit_update_and_layout_func_no_android_update();
}
}
}
@ -217,8 +566,8 @@ void TextBoxEditTool::input_text_key_callback(const InputManager::KeyCallbackArg
auto& a = static_cast<TextBoxCanvasComponent&>(comp->obj->get_comp());
auto changes = userInput->input_key_callback(drawP.world.main.input, key);
if(changes.textEdited || changes.cursorChanged) {
commit_update_and_layout_func();
set_styles_at_selection(a);
commit_update_and_layout_func_no_android_update();
}
}
}
@ -227,13 +576,13 @@ void TextBoxEditTool::input_text_callback(const InputManager::TextCallbackArgs&
if(userInput && userInput->id == drawP.world.main.input.currentTextboxID.value()) {
auto& a = static_cast<TextBoxCanvasComponent&>(comp->obj->get_comp());
userInput->add_text_to_textbox(text.str);
commit_update_and_layout_func();
set_styles_at_selection(a);
commit_update_and_layout_func_no_android_update();
}
}
void TextBoxEditTool::input_mouse_button_on_canvas_callback(const InputManager::MouseButtonCallbackArgs& button, bool isDraggingPoint) {
if(button.button == InputManager::MouseButton::LEFT && !isDraggingPoint) {
if(button.button == InputManager::MouseButton::LEFT && !isDraggingPoint && userInput) {
auto& a = static_cast<TextBoxCanvasComponent&>(comp->obj->get_comp());
SCollision::ColliderCollection<float> mousePointCollection;
@ -245,10 +594,17 @@ void TextBoxEditTool::input_mouse_button_on_canvas_callback(const InputManager::
bool collidesWithBox = comp->obj->collides_with_cam_coords(drawP.world.drawData.cam.c, mousePointCollection);
auto oldCursor = *a.cursor;
a.textBox->process_mouse_left_button(*a.cursor, a.get_mouse_pos(drawP), (button.down && button.clicks && collidesWithBox) ? button.clicks : 0, button.down, input.key(InputManager::KEY_GENERIC_LSHIFT).held);
if(button.deviceType == InputManager::MouseDeviceType::TOUCH) {
if(button.down)
userInput->input_finger_touch_down(a.get_mouse_pos(drawP));
}
else
userInput->process_mouse_left_button(a.get_mouse_pos(drawP), (button.down && button.clicks && collidesWithBox) ? button.clicks : 0, button.down, input.key(InputManager::KEY_GENERIC_LSHIFT).held);
if(oldCursor != *a.cursor) {
set_styles_at_selection(a);
commit_update_and_layout_func();
commit_update_and_layout_func_no_android_update();
}
}
}
@ -257,7 +613,7 @@ void TextBoxEditTool::input_mouse_motion_callback(const InputManager::MouseMotio
auto& a = static_cast<TextBoxCanvasComponent&>(comp->obj->get_comp());
a.init_text_box(drawP);
if(!isDraggingPoint) {
if(!isDraggingPoint && userInput) {
auto& a = static_cast<TextBoxCanvasComponent&>(comp->obj->get_comp());
SCollision::ColliderCollection<float> mousePointCollection;
@ -267,16 +623,24 @@ void TextBoxEditTool::input_mouse_motion_callback(const InputManager::MouseMotio
InputManager& input = drawP.world.main.input;
auto oldCursor = *a.cursor;
a.textBox->process_mouse_left_button(*a.cursor, a.get_mouse_pos(drawP), 0, drawP.controls.leftClickHeld, input.key(InputManager::KEY_GENERIC_LSHIFT).held);
if(motion.deviceType == InputManager::MouseDeviceType::TOUCH) {
if(drawP.controls.leftClickHeld)
userInput->input_finger_held_motion(a.get_mouse_pos(drawP));
}
else
userInput->process_mouse_left_button(a.get_mouse_pos(drawP), 0, drawP.controls.leftClickHeld, input.key(InputManager::KEY_GENERIC_LSHIFT).held);
if(oldCursor != *a.cursor) {
set_styles_at_selection(a);
commit_update_and_layout_func();
commit_update_and_layout_func_no_android_update();
}
}
}
std::optional<InputManager::TextBoxStartInfo> TextBoxEditTool::get_text_box_start_info() {
if(userInput) {
auto& a = static_cast<TextBoxCanvasComponent&>(comp->obj->get_comp());
InputManager::TextInputProperties tProps {
.inputType = SDL_TextInputType::SDL_TEXTINPUT_TYPE_TEXT,
.capitalization = SDL_Capitalization::SDL_CAPITALIZE_NONE,
@ -289,6 +653,9 @@ std::optional<InputManager::TextBoxStartInfo> TextBoxEditTool::get_text_box_star
.id = userInput->id,
.rect = std::nullopt,
.inputProperties = tProps,
.textBox = a.textBox,
.cursor = a.cursor,
.modMap = currentModsPtr
};
}
return std::nullopt;
@ -318,8 +685,8 @@ void TextBoxEditTool::right_click_popup_gui(Toolbar& t, Vector2f popupPos) {
userInput->do_textbox_operation_with_undo([&]() {
input.set_clipboard_plain_and_richtext_pair(a.textBox->process_cut(*a.cursor));
});
commit_update_and_layout_func();
set_styles_at_selection(a);
commit_update_and_layout_func_and_android_update();
});
}
});
@ -425,7 +792,7 @@ void TextBoxEditTool::edit_start(EditTool& editTool, std::any& prevData) {
comp->obj->commit_update(drawP);
userInput = std::make_unique<RichTextUserInput>(drawP.world.main.input.text_box_get_new_id(), textbox, cur, currentModsPtr);
userInput = std::make_unique<RichTextUserInput>(CustomEvents::text_box_get_new_id(), textbox, cur, currentModsPtr);
CustomEvents::emit_event(CustomEvents::RefreshTextBoxInputEvent{});
}

View file

@ -1,3 +1,21 @@
/*
* InfiniPaint
* Copyright (C) 2025-2026 Yousef Khadadeh
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include "../../../CanvasComponents/TextBoxCanvasComponent.hpp"
#include "DrawingProgramEditToolBase.hpp"
@ -15,15 +33,29 @@ class TextBoxEditTool : public DrawingProgramEditToolBase {
virtual void commit_edit_updates(std::any& prevData) override;
virtual bool edit_update() override;
virtual void edit_gui(Toolbar& t) override;
virtual void gui_phone_toolbox(PhoneDrawingProgramScreen& t) override;
virtual void right_click_popup_gui(Toolbar& t, Vector2f popupPos) override;
virtual Vector4f* color_picker_color(Vector4f* oldColor) override;
virtual bool phone_gui_tool_specific_bottom_toolbar_exists() override;
virtual void phone_gui_tool_specific_bottom_toolbar(PhoneDrawingProgramScreen& t) override;
virtual void input_paste_callback(const CustomEvents::PasteEvent& paste) override;
virtual void input_android_text_box_input_callback(const CustomEvents::AndroidTextBoxInputEvent& textboxInput) 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;
virtual void input_mouse_motion_callback(const InputManager::MouseMotionCallbackArgs& motion, bool isDraggingPoint) override;
virtual std::optional<InputManager::TextBoxStartInfo> get_text_box_start_info() override;
private:
struct PhoneGUIData {
enum class PopupType {
NONE,
TEXT_COLOR,
HIGHLIGHT_COLOR
} popupType = PopupType::NONE;
PhoneDrawingProgramScreen::ColorSelectorData colorSelectorData;
} phoneGUIData;
std::unique_ptr<RichTextUserInput> userInput;
struct TextBoxEditToolAllData {
@ -31,6 +63,7 @@ class TextBoxEditTool : public DrawingProgramEditToolBase {
RichText::TextData richText;
};
bool fontPickerIsOpen = false;
uint32_t newFontSize = 15;
Vector4f newTextColor{1.0f, 1.0f, 1.0f, 1.0f};
Vector4f newHighlightColor{1.0f, 1.0f, 1.0f, 0.0f};
@ -42,6 +75,8 @@ class TextBoxEditTool : public DrawingProgramEditToolBase {
std::string newFontName;
RichText::ParagraphStyleData currentPStyle;
void phone_bottom_toolbar_gui(PhoneDrawingProgramScreen& t);
uint8_t get_new_decoration_value();
void set_styles_at_selection(TextBoxCanvasComponent& a);
void add_undo_if_selecting_area(TextBoxCanvasComponent& a, const std::function<void()>& func);
@ -50,14 +85,14 @@ class TextBoxEditTool : public DrawingProgramEditToolBase {
void hold_undo_data(const std::string& undoName, TextBoxCanvasComponent& a);
void release_undo_data(const std::string& undoName);
void commit_update_func();
void commit_update_and_layout_func();
void commit_update_func_no_android_update();
void commit_update_and_layout_func_no_android_update();
void commit_update_func_and_android_update();
void commit_update_and_layout_func_and_android_update();
std::unordered_map<std::string, std::pair<RichText::TextBox::Cursor, RichText::TextData>> undoHeldData;
std::shared_ptr<RichText::TextStyleModifier::ModifierMap> currentModsPtr = std::make_shared<RichText::TextStyleModifier::ModifierMap>();
std::vector<std::string> sortedFontList;
TextBoxEditToolAllData get_all_data(const TextBoxCanvasComponent& a);
};

View file

@ -1,3 +1,21 @@
/*
* InfiniPaint
* Copyright (C) 2025-2026 Yousef Khadadeh
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "EllipseDrawTool.hpp"
#include "../DrawingProgram.hpp"
#include "../../MainProgram.hpp"

View file

@ -1,3 +1,21 @@
/*
* InfiniPaint
* Copyright (C) 2025-2026 Yousef Khadadeh
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include "DrawingProgramToolBase.hpp"
#include <Helpers/SCollision.hpp>

View file

@ -1,3 +1,21 @@
/*
* InfiniPaint
* Copyright (C) 2025-2026 Yousef Khadadeh
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "EraserTool.hpp"
#include "../DrawingProgram.hpp"
#include "../../MainProgram.hpp"

View file

@ -1,3 +1,21 @@
/*
* InfiniPaint
* Copyright (C) 2025-2026 Yousef Khadadeh
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <include/core/SkCanvas.h>
#include "../../DrawData.hpp"

View file

@ -1,3 +1,21 @@
/*
* InfiniPaint
* Copyright (C) 2025-2026 Yousef Khadadeh
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "EyeDropperTool.hpp"
#include "../DrawingProgram.hpp"
#include "../../MainProgram.hpp"

View file

@ -1,3 +1,21 @@
/*
* InfiniPaint
* Copyright (C) 2025-2026 Yousef Khadadeh
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include "DrawingProgramToolBase.hpp"

View file

@ -1,3 +1,21 @@
/*
* InfiniPaint
* Copyright (C) 2025-2026 Yousef Khadadeh
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "GridModifyTool.hpp"
#include "../DrawingProgram.hpp"
#include "../../MainProgram.hpp"

View file

@ -1,3 +1,21 @@
/*
* InfiniPaint
* Copyright (C) 2025-2026 Yousef Khadadeh
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include "DrawingProgramToolBase.hpp"
#include "../../WorldGrid.hpp"

View file

@ -1,3 +1,21 @@
/*
* InfiniPaint
* Copyright (C) 2025-2026 Yousef Khadadeh
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "LassoSelectTool.hpp"
#include "../DrawingProgram.hpp"
#include "../../MainProgram.hpp"

View file

@ -1,3 +1,21 @@
/*
* InfiniPaint
* Copyright (C) 2025-2026 Yousef Khadadeh
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <include/core/SkCanvas.h>
#include "../../DrawData.hpp"

View file

@ -1,3 +1,21 @@
/*
* InfiniPaint
* Copyright (C) 2025-2026 Yousef Khadadeh
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "LineDrawTool.hpp"
#include "../DrawingProgram.hpp"
#include "../../MainProgram.hpp"

View file

@ -1,3 +1,21 @@
/*
* InfiniPaint
* Copyright (C) 2025-2026 Yousef Khadadeh
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include "DrawingProgramToolBase.hpp"
#include <Helpers/SCollision.hpp>

View file

@ -1,3 +1,21 @@
/*
* InfiniPaint
* Copyright (C) 2025-2026 Yousef Khadadeh
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "PanCanvasTool.hpp"
#include "../DrawingProgram.hpp"
#include "../../MainProgram.hpp"

View file

@ -1,3 +1,21 @@
/*
* InfiniPaint
* Copyright (C) 2025-2026 Yousef Khadadeh
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include "DrawingProgramToolBase.hpp"

View file

@ -1,3 +1,21 @@
/*
* InfiniPaint
* Copyright (C) 2025-2026 Yousef Khadadeh
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "RectDrawTool.hpp"
#include "../DrawingProgram.hpp"
#include "../../MainProgram.hpp"

View file

@ -1,3 +1,21 @@
/*
* InfiniPaint
* Copyright (C) 2025-2026 Yousef Khadadeh
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include "DrawingProgramToolBase.hpp"
#include <Helpers/SCollision.hpp>

View file

@ -1,3 +1,21 @@
/*
* InfiniPaint
* Copyright (C) 2025-2026 Yousef Khadadeh
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "RectSelectTool.hpp"
#include "../DrawingProgram.hpp"
#include "../../MainProgram.hpp"

View file

@ -1,3 +1,21 @@
/*
* InfiniPaint
* Copyright (C) 2025-2026 Yousef Khadadeh
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include "DrawingProgramToolBase.hpp"
#include <Helpers/SCollision.hpp>

View file

@ -1,3 +1,21 @@
/*
* InfiniPaint
* Copyright (C) 2025-2026 Yousef Khadadeh
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "ScreenshotTool.hpp"
#include "../DrawingProgram.hpp"
#include "../../MainProgram.hpp"

View file

@ -1,3 +1,21 @@
/*
* InfiniPaint
* Copyright (C) 2025-2026 Yousef Khadadeh
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include "DrawingProgramToolBase.hpp"
#include <Helpers/SCollision.hpp>

View file

@ -1,3 +1,21 @@
/*
* InfiniPaint
* Copyright (C) 2025-2026 Yousef Khadadeh
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "TextBoxTool.hpp"
#include "../DrawingProgram.hpp"
#include "../../MainProgram.hpp"
@ -46,6 +64,8 @@ void TextBoxTool::input_mouse_button_on_canvas_callback(const InputManager::Mous
newTextBox.d.p2 = ensure_points_have_distance(newTextBox.d.p1, newTextBox.d.p2, MINIMUM_DISTANCE_BETWEEN_BOUNDS);
newTextBox.d.editing = true;
newContainer->coords = drawP.world.drawData.cam.c;
if(drawP.world.main.g.gui.io.isTouchDevice)
newContainer->coords.scale_about_double(drawP.world.drawData.cam.c.from_space(startAt), 1.0 / drawP.world.main.g.final_gui_scale());
objInfoBeingEdited = drawP.layerMan.add_component_to_layer_being_edited(newContainer);
}
else if(!button.down && objInfoBeingEdited) {

View file

@ -1,3 +1,21 @@
/*
* InfiniPaint
* Copyright (C) 2025-2026 Yousef Khadadeh
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include "DrawingProgramToolBase.hpp"
#include <Helpers/SCollision.hpp>

View file

@ -1,3 +1,21 @@
/*
* InfiniPaint
* Copyright (C) 2025-2026 Yousef Khadadeh
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "ZoomCanvasTool.hpp"
#include "../DrawingProgram.hpp"
#include "../../MainProgram.hpp"

View file

@ -1,3 +1,21 @@
/*
* InfiniPaint
* Copyright (C) 2025-2026 Yousef Khadadeh
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include "DrawingProgramToolBase.hpp"